decocms 4.344.6 → 4.345.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/dist/client/assets/{AlertCircle-tmlf170X.js → AlertCircle-piOaFPQJ.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CMltqinO.js → AreaChart-C754kxxt.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-UW8QSIYv.js → ArrowLeft-EySzpaMt.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-oW2ppAKR.js → ArrowRight-CN1prjjJ.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-C4N1jv5C.js → ArrowUp-39D5k7I2.js} +1 -1
  6. package/dist/client/assets/{Check-D43QXlgi.js → Check-CmgBwUGv.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-CzwwsIjX.js → CheckCircle-CwJqWx0e.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-BGzR3MPV.js → ChevronRight-Dk9nR_C7.js} +1 -1
  9. package/dist/client/assets/{ChevronSelectorVertical-D2JHLnW-.js → ChevronSelectorVertical-X68ci9mX.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-BMcx5g6h.js → ChevronUp-DLLvYK07.js} +1 -1
  11. package/dist/client/assets/{Copy01-gQD663SC.js → Copy01-DlxhdgMn.js} +1 -1
  12. package/dist/client/assets/{CreditCard01-C7POY4ij.js → CreditCard01-CGG5tsm6.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-T5KAvZex.js → DotsVertical-Bk31Y8qH.js} +1 -1
  14. package/dist/client/assets/{Download01-C5xZFRgI.js → Download01-CxTJDArl.js} +1 -1
  15. package/dist/client/assets/{ErrorBarContext-MyCHVq51.js → ErrorBarContext-DAIYWYhf.js} +1 -1
  16. package/dist/client/assets/{Eye-Brx0T7sd.js → Eye-UEYlbIHb.js} +1 -1
  17. package/dist/client/assets/{GitBranch01-BXJjzFHM.js → GitBranch01-DRT2X7Dj.js} +1 -1
  18. package/dist/client/assets/{Globe01-COOcKemB.js → Globe01-Z6BbST4r.js} +1 -1
  19. package/dist/client/assets/{HardDrive-WnPyGvYA.js → HardDrive--vlQvWpi.js} +1 -1
  20. package/dist/client/assets/{Image01-Cetk23Gg.js → Image01-rCxXluf6.js} +1 -1
  21. package/dist/client/assets/{Key01-CTPGBIuS.js → Key01-By90Yq6k.js} +1 -1
  22. package/dist/client/assets/{Link01-CRhSvCpz.js → Link01-CUe3c6G0.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-B71u24kv.js → LinkExternal01-D2pSy7v4.js} +1 -1
  24. package/dist/client/assets/{Monitor01-C4tpFrFH.js → Monitor01-CY2DbFkD.js} +1 -1
  25. package/dist/client/assets/{Package-BMpeE28g.js → Package-Bb4KYw9O.js} +1 -1
  26. package/dist/client/assets/{Palette-DbLDcKQl.js → Palette-o-NEtwsW.js} +1 -1
  27. package/dist/client/assets/{Play-CX-1pcs-.js → Play-DpmIDjD8.js} +1 -1
  28. package/dist/client/assets/{Plus-q_spJwnV.js → Plus-CgVmxzR4.js} +1 -1
  29. package/dist/client/assets/{SearchMd-B_sSHt1j.js → SearchMd-Cjr4mqh9.js} +1 -1
  30. package/dist/client/assets/{Sector-6YzDicdd.js → Sector-3UpSGQVE.js} +1 -1
  31. package/dist/client/assets/{Settings02-BQeN72sP.js → Settings02-Dss_LnvC.js} +1 -1
  32. package/dist/client/assets/{Share07-n-3fSUdL.js → Share07-CgTNZ1dk.js} +1 -1
  33. package/dist/client/assets/{Shield01-WuyF7MO2.js → Shield01-CNbrlPDI.js} +1 -1
  34. package/dist/client/assets/{Stars01-B_a7_AvS.js → Stars01-Dno5l14o.js} +1 -1
  35. package/dist/client/assets/{Sun-DcqY__ZL.js → Sun-DAVD-A5B.js} +1 -1
  36. package/dist/client/assets/{Tool01-BP77SoXO.js → Tool01-DdmZi7j_.js} +1 -1
  37. package/dist/client/assets/{Tool02-EHcFfjL7.js → Tool02-KStnzngn.js} +1 -1
  38. package/dist/client/assets/{Trash01-uEgLHTb-.js → Trash01-BevWobXU.js} +1 -1
  39. package/dist/client/assets/{TrendUp01-Cz7gaxLj.js → TrendUp01-NTK3Zf_M.js} +1 -1
  40. package/dist/client/assets/{Upload01-BIWfPTvJ.js → Upload01-By19QANP.js} +1 -1
  41. package/dist/client/assets/{User01-CiJaeywX.js → User01-CDRv3_oY.js} +1 -1
  42. package/dist/client/assets/{UserSquare-BATVnS3x.js → UserSquare-l4Q5fPEZ.js} +1 -1
  43. package/dist/client/assets/{Users01-CWN5RUiZ.js → Users01-sAr72jTU.js} +1 -1
  44. package/dist/client/assets/{Users03-DFR7fqkO.js → Users03-CrZajyAo.js} +1 -1
  45. package/dist/client/assets/{XCircle-ByMu8jAG.js → XCircle-BTj4-tdv.js} +1 -1
  46. package/dist/client/assets/{XClose-BUiWkR3f.js → XClose-C-bbcgCJ.js} +1 -1
  47. package/dist/client/assets/{Zap-Cul-MTXM.js → Zap-D6-O3NZl.js} +1 -1
  48. package/dist/client/assets/{ZoomOut-ENcKaGzb.js → ZoomOut-DpAkOD8e.js} +1 -1
  49. package/dist/client/assets/{access-gate-0ydYV0aM.js → access-gate-DQan09qj.js} +1 -1
  50. package/dist/client/assets/{agent-icon-B5YynjqW.js → agent-icon-BrQLA9dC.js} +1 -1
  51. package/dist/client/assets/{agents-list-BXNl_cxc.js → agents-list-BIlHhg8F.js} +1 -1
  52. package/dist/client/assets/{ai-providers-DTM0VaHo.js → ai-providers-D9jubp2s.js} +1 -1
  53. package/dist/client/assets/{alert-CEb4xO5-.js → alert-DI_JsgmI.js} +1 -1
  54. package/dist/client/assets/{alert-dialog-bPhnZuBF.js → alert-dialog-DuVJ7GC7.js} +1 -1
  55. package/dist/client/assets/{analytics-tab-FZwL75da.js → analytics-tab-gxTnWc1L.js} +1 -1
  56. package/dist/client/assets/{api-keys-DcL2_qib.js → api-keys-BJORgq17.js} +1 -1
  57. package/dist/client/assets/api-keys-DM-VC8Ks.js +1 -0
  58. package/dist/client/assets/app-editor-ueQwisxj.js +1 -0
  59. package/dist/client/assets/{auth-TNUQ-R7b.js → auth-CRmM4ftp.js} +1 -1
  60. package/dist/client/assets/{auth-catchall-yDb6dG_y.js → auth-catchall-D9f22qVk.js} +1 -1
  61. package/dist/client/assets/{auth-entry-CWvWuaXU.js → auth-entry-Z1av5utg.js} +1 -1
  62. package/dist/client/assets/{auth-split-layout-DHAKSgor.js → auth-split-layout-Dhyl4Mok.js} +1 -1
  63. package/dist/client/assets/{authenticate-and-persist-oauth-BEiz2fLb.js → authenticate-and-persist-oauth-DEZCdj-t.js} +1 -1
  64. package/dist/client/assets/{automation-list-row-BXs_Ogmi.js → automation-list-row-CJo0GDE_.js} +1 -1
  65. package/dist/client/assets/{automation-runs-D0qsHVPj.js → automation-runs-Ge9BW9cQ.js} +1 -1
  66. package/dist/client/assets/{automations-BlUIhpog.js → automations-AOZDTTBB.js} +1 -1
  67. package/dist/client/assets/{autosend-BYSImvIy.js → autosend-CI7ToXd3.js} +1 -1
  68. package/dist/client/assets/{avatar-BAfh7dfM.js → avatar-ncVfbaUx.js} +1 -1
  69. package/dist/client/assets/{badge-CF8t3kFT.js → badge-rtLQpibV.js} +1 -1
  70. package/dist/client/assets/{block-document-CbJActTO.js → block-document-WxPy4zHY.js} +1 -1
  71. package/dist/client/assets/{breadcrumb-Dt4POIrJ.js → breadcrumb-d7wNqsyt.js} +1 -1
  72. package/dist/client/assets/{buckets-cQPujbXt.js → buckets-NBI_IEuj.js} +1 -1
  73. package/dist/client/assets/{bulk-category-panel-L3wZRASt.js → bulk-category-panel-B8uZmKXZ.js} +1 -1
  74. package/dist/client/assets/{capability-load-error-fkYMRkNu.js → capability-load-error-BAq8tXOS.js} +1 -1
  75. package/dist/client/assets/{cards-Bew32vSA.js → cards-CgpdHb-U.js} +1 -1
  76. package/dist/client/assets/{category-editor-Bm5Mlq8U.js → category-editor-DrNCa6L7.js} +1 -1
  77. package/dist/client/assets/{cdn-tab-GRD3AIjn.js → cdn-tab-BflNT2VL.js} +1 -1
  78. package/dist/client/assets/{chart-VKcsR9La.js → chart-C7j_btUB.js} +1 -1
  79. package/dist/client/assets/{chat-context-DilDlwEk.js → chat-context-BcY08VKG.js} +1 -1
  80. package/dist/client/assets/{checkbox-DHBigI1P.js → checkbox-D0oTwa58.js} +1 -1
  81. package/dist/client/assets/{choose-editor-BP8m7OAm.js → choose-editor-B2cOrwQv.js} +1 -1
  82. package/dist/client/assets/{cli-auth-success-CfTa5xBk.js → cli-auth-success-G8Y4SVGK.js} +1 -1
  83. package/dist/client/assets/{client-icons-CpQxSG6O.js → client-icons-BE3evb-i.js} +1 -1
  84. package/dist/client/assets/{collection-detail-BTxWiDBI.js → collection-detail-DCICjiwT.js} +1 -1
  85. package/dist/client/assets/{collection-display-button-uSlq9nXL.js → collection-display-button-C4HtW9B5.js} +1 -1
  86. package/dist/client/assets/{collection-search-4OWVO2by.js → collection-search-UW0xDxmi.js} +1 -1
  87. package/dist/client/assets/{collection-table-wrapper-DniL_pIl.js → collection-table-wrapper-STLb6VjQ.js} +1 -1
  88. package/dist/client/assets/{collection-tabs-C7YylUDr.js → collection-tabs-644rp01A.js} +1 -1
  89. package/dist/client/assets/{command-qoguNyQb.js → command-CTH7s7Ya.js} +1 -1
  90. package/dist/client/assets/{commerce-onboarding-DKZfIC95.js → commerce-onboarding-CxUaxjg3.js} +1 -1
  91. package/dist/client/assets/{connect-wv5sge3U.js → connect-DEIsBWg2.js} +1 -1
  92. package/dist/client/assets/{connect-layout-BZH3VWOf.js → connect-layout-CmuGJ6zd.js} +1 -1
  93. package/dist/client/assets/{connection-DDLYJx4M.js → connection-CU1s53fy.js} +1 -1
  94. package/dist/client/assets/{connection-card-CT-PAzWh.js → connection-card-B-DQLE2m.js} +1 -1
  95. package/dist/client/assets/{connection-detail-CfkbPeoN.js → connection-detail-C3OYxb5o.js} +1 -1
  96. package/dist/client/assets/{connection-form-helpers-D0QJiE6z.js → connection-form-helpers-B-auMXZc.js} +1 -1
  97. package/dist/client/assets/{connections-DAkHJJnc.js → connections-DPnFX966.js} +1 -1
  98. package/dist/client/assets/{create-organization-dialog-DADjHn9s.js → create-organization-dialog-xnwS5290.js} +1 -1
  99. package/dist/client/assets/{decopilot-sse-pool-Bc0jSHS4.js → decopilot-sse-pool-CnHcYfZj.js} +1 -1
  100. package/dist/client/assets/{dialog-BZhwZpkj.js → dialog-DKxWMb0-.js} +1 -1
  101. package/dist/client/assets/{domain-settings-DGBy5i1e.js → domain-settings-yEjTU5K7.js} +1 -1
  102. package/dist/client/assets/{drawer-D2KyUzEM.js → drawer-BaA_lu4x.js} +1 -1
  103. package/dist/client/assets/{dropdown-menu-DRmaugfH.js → dropdown-menu-CC8IMYtS.js} +1 -1
  104. package/dist/client/assets/{e2e-tab-D1XNI3nb.js → e2e-tab-CyxfrSC2.js} +1 -1
  105. package/dist/client/assets/{editor-Ds1FbC2-.js → editor-Cm-sI42p.js} +1 -1
  106. package/dist/client/assets/{empty-state-BrAzdRf-.js → empty-state-BioEMyZp.js} +1 -1
  107. package/dist/client/assets/{empty-state-ClRvEbll.js → empty-state-DA8cnNqW.js} +1 -1
  108. package/dist/client/assets/{extract-connection-data-D78kSWFE.js → extract-connection-data-BdnZZmxw.js} +1 -1
  109. package/dist/client/assets/{file-explorer-i9mvkKr3.js → file-explorer-jXzlywVk.js} +1 -1
  110. package/dist/client/assets/{file-type-icon-CRkeI-TW.js → file-type-icon-ChIQfzaN.js} +1 -1
  111. package/dist/client/assets/{folder-icon-CQEOL9D6.js → folder-icon-_4CbErMC.js} +1 -1
  112. package/dist/client/assets/{form-hHdEspGG.js → form-CorLMse0.js} +1 -1
  113. package/dist/client/assets/{general-CTo9aABA.js → general-BCDanvgJ.js} +1 -1
  114. package/dist/client/assets/{github-icon-quUu4aVj.js → github-icon-CeFWgmVz.js} +1 -1
  115. package/dist/client/assets/{hooks-BqtNxB1V.js → hooks-BOHEAk9Y.js} +1 -1
  116. package/dist/client/assets/{hosting-tab-CyasLnZ9.js → hosting-tab-BktIiwOH.js} +1 -1
  117. package/dist/client/assets/{index-C1ptY-us.js → index-B8l7Wp2b.js} +1 -1
  118. package/dist/client/assets/{index-BoJcLg5E.js → index-BAPa6G_8.js} +1 -1
  119. package/dist/client/assets/{index-Bh6XNvc7.js → index-BlP07NoC.js} +6 -6
  120. package/dist/client/assets/{index-BRMxGRts.js → index-BrCtIPlH.js} +1 -1
  121. package/dist/client/assets/{index-CCnt8Ha0.js → index-CYWX8R5H.js} +1 -1
  122. package/dist/client/assets/{index-Czh__YM5.js → index-D0wjsDWq.js} +1 -1
  123. package/dist/client/assets/{index-CNDBtRKj.js → index-ObIlqSDZ.js} +1 -1
  124. package/dist/client/assets/{index-BYBiZ6IV.js → index-YZeWKaou.js} +1 -1
  125. package/dist/client/assets/{index-BtlUOIgR.js → index-fS0pDoNW.js} +4 -4
  126. package/dist/client/assets/{index-redirect-n6RfO4dh.js → index-redirect-CfbLeyNL.js} +1 -1
  127. package/dist/client/assets/{index-DWp5Jluj.js → index-w12TFwlK.js} +1 -1
  128. package/dist/client/assets/{infiniteQueryObserver-Cq1oMNof.js → infiniteQueryObserver-B62setNi.js} +1 -1
  129. package/dist/client/assets/{infra-billing-Bv3CJksv.js → infra-billing-BtMbkXjN.js} +1 -1
  130. package/dist/client/assets/{input-DVhzkeDU.js → input-DaMV0yqT.js} +1 -1
  131. package/dist/client/assets/{integration-icon-W7q1QwrY.js → integration-icon-BFx8Gs71.js} +1 -1
  132. package/dist/client/assets/{invite-member-dialog-DdkdEZWp.js → invite-member-dialog-erQjr6Dv.js} +1 -1
  133. package/dist/client/assets/{label-DVQH5HfM.js → label-Cznjg7Mb.js} +1 -1
  134. package/dist/client/assets/{layout-D9BGYUpz.js → layout-CwmaRw9Y.js} +1 -1
  135. package/dist/client/assets/{login-C2PsNRO0.js → login-DYTFtcpb.js} +1 -1
  136. package/dist/client/assets/{markdown-DRT9KRNa.js → markdown-BNMHtGi6.js} +1 -1
  137. package/dist/client/assets/{mcp-app-renderer-CgF9tJk8.js → mcp-app-renderer-Df-LUzfK.js} +1 -1
  138. package/dist/client/assets/{mcp-oauth-B0ZK0THI.js → mcp-oauth-CDjOqnrq.js} +1 -1
  139. package/dist/client/assets/{members-YTm_zSPA.js → members-s02j5DFH.js} +1 -1
  140. package/dist/client/assets/{monaco-editor-B0196ei4.js → monaco-editor-7CBGfDCH.js} +1 -1
  141. package/dist/client/assets/{monitoring-stats-row-DN2tDpM2.js → monitoring-stats-row-CO2-hLq6.js} +1 -1
  142. package/dist/client/assets/{multi-select-D98fbeiJ.js → multi-select-D1MP7iDa.js} +1 -1
  143. package/dist/client/assets/{oauth-callback-ai-provider-Co1X_4K1.js → oauth-callback-ai-provider-Ce5MHp3r.js} +1 -1
  144. package/dist/client/assets/{oauth-callback-Dx4YoSv4.js → oauth-callback-t2WmO9-v.js} +1 -1
  145. package/dist/client/assets/{onboarding-DGQT_Sfz.js → onboarding-Dg8pqQh4.js} +1 -1
  146. package/dist/client/assets/{org-layout-DN_qRhjs.js → org-layout-dq0fDq-h.js} +1 -1
  147. package/dist/client/assets/{organization-choice-DUkMQPpO.js → organization-choice-Bnr-wpFe.js} +1 -1
  148. package/dist/client/assets/{orgs-BbVpzVfI.js → orgs-DJfci181.js} +1 -1
  149. package/dist/client/assets/{page-seo-form-B3ECm2z2.js → page-seo-form-B1ADwpo8.js} +1 -1
  150. package/dist/client/assets/{popover-CXzsLJLQ.js → popover-sPMAt4On.js} +1 -1
  151. package/dist/client/assets/{post-calendar-VzuxCaB9.js → post-calendar-B4Z9Jz7b.js} +1 -1
  152. package/dist/client/assets/{post-editor-CTE0Ny-s.js → post-editor-CcXinFIi.js} +1 -1
  153. package/dist/client/assets/{primitives-CHBnIb1h.js → primitives-CGxQwrae.js} +1 -1
  154. package/dist/client/assets/{profile-BAX8XJ0q.js → profile-C9bBchUu.js} +1 -1
  155. package/dist/client/assets/{project-app-view-_pt7eBEE.js → project-app-view-DudFJRxH.js} +1 -1
  156. package/dist/client/assets/{project-icon-C_Y9lQqb.js → project-icon-DD8-TjG9.js} +1 -1
  157. package/dist/client/assets/{prompts-CUc7KVI6.js → prompts-CAxx1TcH.js} +1 -1
  158. package/dist/client/assets/record-editor-CQ7QMoAf.js +1 -0
  159. package/dist/client/assets/redirect-editor-B68PccpU.js +1 -0
  160. package/dist/client/assets/registry-CWd0I8mg.js +2 -0
  161. package/dist/client/assets/{registry-layout-D93-hFqA.js → registry-layout-Bcal-jx7.js} +1 -1
  162. package/dist/client/assets/{reports-Db_kNTwo.js → reports-BbDmvyvn.js} +1 -1
  163. package/dist/client/assets/{repositories-D4avHisP.js → repositories-DoZh9xWv.js} +1 -1
  164. package/dist/client/assets/{repository-import-picker-UuFyRapE.js → repository-import-picker-TTmQRKgM.js} +1 -1
  165. package/dist/client/assets/{repository-picker-C0sEORMq.js → repository-picker-Be7NfZEA.js} +1 -1
  166. package/dist/client/assets/{require-capability-CVGq5FAY.js → require-capability-q7uVdBbT.js} +1 -1
  167. package/dist/client/assets/{required-auth-layout-DiWJho_6.js → required-auth-layout-CR5eG3sF.js} +1 -1
  168. package/dist/client/assets/{reset-password-D97T0kGE.js → reset-password-DnIxE4MM.js} +1 -1
  169. package/dist/client/assets/{review-settings-DiOL3p8x.js → review-settings-Bit87Ep6.js} +1 -1
  170. package/dist/client/assets/roles-CYck8jTX.js +1 -0
  171. package/dist/client/assets/{schema-BqenfAhL.js → schema-CVS6b6X8.js} +1 -1
  172. package/dist/client/assets/{scroll-area-Ca3wuyBa.js → scroll-area-DIJ4XfEc.js} +1 -1
  173. package/dist/client/assets/{search-input-BMRJF5PT.js → search-input-BN_fecvo.js} +1 -1
  174. package/dist/client/assets/{secrets-WCD--wKB.js → secrets-Dr0vdQ4d.js} +1 -1
  175. package/dist/client/assets/{sections-editor-CdzZDcnU.js → sections-editor-BsuMEuNO.js} +1 -1
  176. package/dist/client/assets/{select-Cyj_p8d5.js → select-BJ0Gkkka.js} +1 -1
  177. package/dist/client/assets/{select-model-DAb9T8kG.js → select-model-D8CTPoiO.js} +1 -1
  178. package/dist/client/assets/{self-tool-result-4wUrYSY4.js → self-tool-result-KOheC4HD.js} +1 -1
  179. package/dist/client/assets/{seo-editor-CaD3hjuZ.js → seo-editor-CSFxllkC.js} +1 -1
  180. package/dist/client/assets/settings-layout-DyOsDVbj.js +1 -0
  181. package/dist/client/assets/{settings-sidebar-C2AMxvTf.js → settings-sidebar-C_Tz8rbX.js} +1 -1
  182. package/dist/client/assets/{shell-controls-vx3WbyyZ.js → shell-controls-5f0FnXKd.js} +1 -1
  183. package/dist/client/assets/{shell-layout-Cw_Zv8KH.js → shell-layout-D-M6_Jkf.js} +1 -1
  184. package/dist/client/assets/{skill-preview-CW8imphI.js → skill-preview-5YIvamOb.js} +1 -1
  185. package/dist/client/assets/{skills-E9aS_ABb.js → skills-DMmhWXLy.js} +1 -1
  186. package/dist/client/assets/{sso-DrTiu7pv.js → sso-nVCDDH4k.js} +1 -1
  187. package/dist/client/assets/{store-CS1P8DFG.js → store-LfRhnjNM.js} +1 -1
  188. package/dist/client/assets/store-registry-D-puuJzT.js +2 -0
  189. package/dist/client/assets/{switch-Do8kG-W6.js → switch-C0tiHttS.js} +1 -1
  190. package/dist/client/assets/{synced-repos-BAJNSBJM.js → synced-repos-D5wTALWx.js} +1 -1
  191. package/dist/client/assets/{table-DP9ciP81.js → table-D4dLAB1m.js} +1 -1
  192. package/dist/client/assets/{tabs-DjyEdY-W.js → tabs-CDFENeRa.js} +1 -1
  193. package/dist/client/assets/{task-board-Bx3cqwAZ.js → task-board-B4aUIKJI.js} +1 -1
  194. package/dist/client/assets/{task-route-Bv_q5i--.js → task-route-BUYfM-Mq.js} +1 -1
  195. package/dist/client/assets/tasks-COtpdI-R.js +1 -0
  196. package/dist/client/assets/{textarea-Cdferp0K.js → textarea-DIJRp6Ds.js} +1 -1
  197. package/dist/client/assets/{thread-intent-CKqHlMow.js → thread-intent-DK53ivxy.js} +1 -1
  198. package/dist/client/assets/{thread-route-AbWdgotm.js → thread-route-m3qiCJQP.js} +1 -1
  199. package/dist/client/assets/{toggle-group-6AKnVxn8.js → toggle-group-BSxkMDRS.js} +1 -1
  200. package/dist/client/assets/{toolbar-D6LmlQ1e.js → toolbar-DQ2YVpXF.js} +1 -1
  201. package/dist/client/assets/{toolbar-icon-button-RJfMkoLQ.js → toolbar-icon-button-DeXrhkGe.js} +1 -1
  202. package/dist/client/assets/{track-Bcic1GaS.js → track-J__dE1p5.js} +1 -1
  203. package/dist/client/assets/{types-CxO7wOk-.js → types-C9oYptqr.js} +1 -1
  204. package/dist/client/assets/{use-ai-providers-BzFij6Yg.js → use-ai-providers-DMdw1ZKm.js} +1 -1
  205. package/dist/client/assets/{use-automations-3EGHGpk2.js → use-automations-BrJQYtfT.js} +1 -1
  206. package/dist/client/assets/{use-autosave-BHVh7zSP.js → use-autosave-DXppOUIw.js} +1 -1
  207. package/dist/client/assets/{use-connection-C9LH9ktZ.js → use-connection-DueV7Dd9.js} +1 -1
  208. package/dist/client/assets/{use-copy-C_RcJrvS.js → use-copy-DsM8BkMO.js} +1 -1
  209. package/dist/client/assets/{use-create-virtual-mcp-C-ROTiiG.js → use-create-virtual-mcp-CXxjUZ5c.js} +1 -1
  210. package/dist/client/assets/{use-date-fns-locale-DBpL-xm-.js → use-date-fns-locale-I1vziWnN.js} +1 -1
  211. package/dist/client/assets/{use-debounced-autosave-B9WM09s6.js → use-debounced-autosave-Bep9W3RF.js} +1 -1
  212. package/dist/client/assets/{use-debounced-value-DiDBNIsK.js → use-debounced-value-CjFrELYP.js} +1 -1
  213. package/dist/client/assets/{use-decopilot-events-D9KhoRE_.js → use-decopilot-events-BxzD46W5.js} +1 -1
  214. package/dist/client/assets/{use-delete-connection-BljsV651.js → use-delete-connection-BBL_RJLP.js} +1 -1
  215. package/dist/client/assets/{use-deployment-admin-Cd6Vlilx.js → use-deployment-admin--_f948uh.js} +1 -1
  216. package/dist/client/assets/{use-destination-route-CUHeljX2.js → use-destination-route-WysfeR7S.js} +1 -1
  217. package/dist/client/assets/{use-file-configs-C1cw7bWX.js → use-file-configs-BByTBhTa.js} +1 -1
  218. package/dist/client/assets/{use-infinite-scroll-DsxXi1ne.js → use-infinite-scroll-p1RdGJsc.js} +1 -1
  219. package/dist/client/assets/{use-join-requests-JyaSOQjy.js → use-join-requests-D9qT6ziM.js} +1 -1
  220. package/dist/client/assets/{use-mcp-auth-status-BeaI0e3q.js → use-mcp-auth-status-CTnEpyYI.js} +1 -1
  221. package/dist/client/assets/{use-mcp-client-DBIpUR_Q.js → use-mcp-client-DtsRGdvB.js} +1 -1
  222. package/dist/client/assets/{use-mcp-prompts-y2MtSMBD.js → use-mcp-prompts-CD_IWJeZ.js} +1 -1
  223. package/dist/client/assets/{use-mcp-tools-BsEDXwD6.js → use-mcp-tools-BKHgcAxL.js} +1 -1
  224. package/dist/client/assets/{use-members-Fuly6XlY.js → use-members-NWhv5vIl.js} +1 -1
  225. package/dist/client/assets/{use-navigate-to-agent-Kl6EnJy1.js → use-navigate-to-agent-Bnmnhqje.js} +1 -1
  226. package/dist/client/assets/{use-org-auth-client-D5yIq9Gk.js → use-org-auth-client-CShcDth4.js} +1 -1
  227. package/dist/client/assets/{use-org-notice-DUyOhPa4.js → use-org-notice-B64MrAd9.js} +1 -1
  228. package/dist/client/assets/{use-org-sso-Ce8zUd7K.js → use-org-sso-DzsFzLff.js} +1 -1
  229. package/dist/client/assets/{use-organization-roles-CbR5UjbP.js → use-organization-roles-7PFmB_rs.js} +1 -1
  230. package/dist/client/assets/{use-organization-settings-DV6zKCpV.js → use-organization-settings-nKtEvYQd.js} +1 -1
  231. package/dist/client/assets/{use-panel-navigate-BDsIsCi2.js → use-panel-navigate-BNmxrdjd.js} +1 -1
  232. package/dist/client/assets/{use-registry-connections-C_zIH2sX.js → use-registry-connections-Bb6pjxJh.js} +1 -1
  233. package/dist/client/assets/{use-secrets-B3oN2LCY.js → use-secrets-CTUki73i.js} +1 -1
  234. package/dist/client/assets/{use-section-preview-base-XWFQsTnE.js → use-section-preview-base-BHSNiN-i.js} +1 -1
  235. package/dist/client/assets/{use-status-sounds-JH-_0XAZ.js → use-status-sounds-k-y4u-Dp.js} +1 -1
  236. package/dist/client/assets/{use-tags-Cih5ZXdl.js → use-tags-BOUHc_F8.js} +1 -1
  237. package/dist/client/assets/{use-view-mode-C2-ECVBt.js → use-view-mode-4DXLgMpz.js} +1 -1
  238. package/dist/client/assets/{use-virtual-mcp-DrMRB2eS.js → use-virtual-mcp-C5Zt0ewM.js} +1 -1
  239. package/dist/client/assets/useInfiniteQuery-CU7gRlof.js +1 -0
  240. package/dist/client/assets/useSuspenseInfiniteQuery-rXQ07VfR.js +1 -0
  241. package/dist/client/assets/{users-rpRsp_BS.js → users-DRzgVGBP.js} +1 -1
  242. package/dist/client/assets/{variant-calendar-DuJfg-z-.js → variant-calendar-TLlf4rAo.js} +1 -1
  243. package/dist/client/assets/{view-mode-toggle-D9gNMAcP.js → view-mode-toggle-CZECgOYC.js} +1 -1
  244. package/dist/client/index.html +1 -1
  245. package/dist/server/cli.js +608 -608
  246. package/dist/server/migrate.js +135 -135
  247. package/dist/server/server.js +397 -397
  248. package/package.json +1 -1
  249. package/dist/client/assets/api-keys-eLOtXH3i.js +0 -1
  250. package/dist/client/assets/app-editor-TTUJgVhd.js +0 -1
  251. package/dist/client/assets/record-editor-ssFhFAja.js +0 -1
  252. package/dist/client/assets/redirect-editor-Ct31zDHf.js +0 -1
  253. package/dist/client/assets/registry-DXRoDTIU.js +0 -2
  254. package/dist/client/assets/roles-BiRHciZQ.js +0 -1
  255. package/dist/client/assets/settings-layout-DLtg2QOW.js +0 -1
  256. package/dist/client/assets/store-registry-BAbAyhdE.js +0 -2
  257. package/dist/client/assets/tasks-GWbkl06R.js +0 -1
  258. package/dist/client/assets/useInfiniteQuery-BvtmxOq6.js +0 -1
  259. package/dist/client/assets/useSuspenseInfiniteQuery-D9bH4tUz.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-CdzZDcnU.js","assets/index-BtlUOIgR.js","assets/index-MAAh901k.css","assets/chat-context-DilDlwEk.js","assets/use-panel-navigate-BDsIsCi2.js","assets/use-destination-route-CUHeljX2.js","assets/autosend-BYSImvIy.js","assets/thread-intent-CKqHlMow.js","assets/slugify-CEUa2lfQ.js","assets/hooks-BqtNxB1V.js","assets/use-mcp-client-DBIpUR_Q.js","assets/constants-Daqiz8AS.js","assets/auth-TNUQ-R7b.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/decopilot-sse-pool-Bc0jSHS4.js","assets/task-board-Bx3cqwAZ.js","assets/schema-BqenfAhL.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-DrMRB2eS.js","assets/use-ai-providers-BzFij6Yg.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-D9KhoRE_.js","assets/thread-route-AbWdgotm.js","assets/dialog-BZhwZpkj.js","assets/Check-D43QXlgi.js","assets/Copy01-gQD663SC.js","assets/Download01-C5xZFRgI.js","assets/use-organization-settings-DV6zKCpV.js","assets/ChevronUp-BMcx5g6h.js","assets/agent-icon-B5YynjqW.js","assets/AlertCircle-tmlf170X.js","assets/Tool01-BP77SoXO.js","assets/ArrowUp-C4N1jv5C.js","assets/ArrowLeft-UW8QSIYv.js","assets/Tool02-EHcFfjL7.js","assets/ArrowRight-oW2ppAKR.js","assets/TrendUp01-Cz7gaxLj.js","assets/ZoomOut-ENcKaGzb.js","assets/Users03-DFR7fqkO.js","assets/CheckCircle-CzwwsIjX.js","assets/ChevronRight-BGzR3MPV.js","assets/ChevronSelectorVertical-D2JHLnW-.js","assets/DotsVertical-T5KAvZex.js","assets/UserSquare-BATVnS3x.js","assets/CreditCard01-C7POY4ij.js","assets/Settings02-BQeN72sP.js","assets/Eye-Brx0T7sd.js","assets/Share07-n-3fSUdL.js","assets/GitBranch01-BXJjzFHM.js","assets/Globe01-COOcKemB.js","assets/XClose-BUiWkR3f.js","assets/HardDrive-WnPyGvYA.js","assets/Image01-Cetk23Gg.js","assets/Key01-CTPGBIuS.js","assets/Link01-CRhSvCpz.js","assets/LinkExternal01-B71u24kv.js","assets/Monitor01-C4tpFrFH.js","assets/Sun-DcqY__ZL.js","assets/Package-BMpeE28g.js","assets/Palette-DbLDcKQl.js","assets/Play-CX-1pcs-.js","assets/Plus-q_spJwnV.js","assets/SearchMd-B_sSHt1j.js","assets/Shield01-WuyF7MO2.js","assets/Stars01-B_a7_AvS.js","assets/Trash01-uEgLHTb-.js","assets/Upload01-BIWfPTvJ.js","assets/User01-CiJaeywX.js","assets/Users01-CWN5RUiZ.js","assets/XCircle-ByMu8jAG.js","assets/Zap-Cul-MTXM.js","assets/scroll-area-Ca3wuyBa.js","assets/select-Cyj_p8d5.js","assets/input-DVhzkeDU.js","assets/dropdown-menu-DRmaugfH.js","assets/safe-image-url-D5z803Ot.js","assets/page-seo-form-B3ECm2z2.js","assets/label-DVQH5HfM.js","assets/switch-Do8kG-W6.js","assets/use-section-preview-base-XWFQsTnE.js","assets/automation-runs-D0qsHVPj.js","assets/useInfiniteQuery-BvtmxOq6.js","assets/infiniteQueryObserver-Cq1oMNof.js","assets/use-connection-C9LH9ktZ.js","assets/table-DP9ciP81.js","assets/empty-state-ClRvEbll.js","assets/use-infinite-scroll-DsxXi1ne.js","assets/use-members-Fuly6XlY.js","assets/use-org-auth-client-D5yIq9Gk.js","assets/use-automations-3EGHGpk2.js","assets/useSuspenseInfiniteQuery-D9bH4tUz.js","assets/avatar-BAfh7dfM.js","assets/format-time-BtXRrtv4.js","assets/differenceInSeconds-C3x8sHUj.js","assets/use-copy-C_RcJrvS.js","assets/markdown-DRT9KRNa.js","assets/monaco-editor-B0196ei4.js","assets/editor-Ds1FbC2-.js","assets/mcp-app-renderer-CgF9tJk8.js","assets/types-CxO7wOk-.js","assets/shell-layout-Cw_Zv8KH.js","assets/project-icon-C_Y9lQqb.js","assets/github-repo-CTPv5ZM2.js","assets/source-system-tabs-CnEGUb4r.js","assets/command-qoguNyQb.js","assets/index-BYBiZ6IV.js","assets/required-auth-layout-DiWJho_6.js","assets/use-org-sso-Ce8zUd7K.js","assets/use-org-notice-DUyOhPa4.js","assets/shell-layout-CuFt8bor.css","assets/integration-icon-W7q1QwrY.js","assets/use-navigate-to-agent-Kl6EnJy1.js","assets/use-mcp-prompts-y2MtSMBD.js","assets/form-hHdEspGG.js","assets/file-type-icon-CRkeI-TW.js","assets/drawer-D2KyUzEM.js","assets/collection-search-4OWVO2by.js","assets/tabs-DjyEdY-W.js","assets/toggle-group-6AKnVxn8.js","assets/task-route-Bv_q5i--.js","assets/extract-connection-data-D78kSWFE.js","assets/metadata-dUsYcpuu.js","assets/connection-DDLYJx4M.js","assets/connection-card-CT-PAzWh.js","assets/use-registry-connections-C_zIH2sX.js","assets/retry-CErkP7V6.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-Cdferp0K.js","assets/connection-form-helpers-D0QJiE6z.js","assets/authenticate-and-persist-oauth-BEiz2fLb.js","assets/mcp-oauth-B0ZK0THI.js","assets/collection-tabs-C7YylUDr.js","assets/badge-CF8t3kFT.js","assets/use-file-configs-C1cw7bWX.js","assets/site-slug-uya6Wp4-.js","assets/popover-CXzsLJLQ.js","assets/github-icon-quUu4aVj.js","assets/get-initials-D-f_fDFw.js","assets/select-model-DAb9T8kG.js","assets/checkbox-DHBigI1P.js","assets/ai-providers-logos-DD3qZ33J.js","assets/folder-icon-CQEOL9D6.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-JH-_0XAZ.js","assets/toolbar-D6LmlQ1e.js","assets/use-mcp-tools-BsEDXwD6.js","assets/skill-preview-CW8imphI.js","assets/use-date-fns-locale-DBpL-xm-.js","assets/alert-dialog-bPhnZuBF.js","assets/use-debounced-autosave-B9WM09s6.js","assets/search-input-BMRJF5PT.js","assets/use-mcp-auth-status-BeaI0e3q.js","assets/repository-import-picker-UuFyRapE.js","assets/repository-picker-C0sEORMq.js","assets/use-debounced-value-DiDBNIsK.js","assets/use-secrets-B3oN2LCY.js","assets/client-icons-CpQxSG6O.js","assets/connect-layout-BZH3VWOf.js","assets/self-tool-result-4wUrYSY4.js","assets/provision-repo-scoped-github-connection-WQFARyHG.js","assets/track-Bcic1GaS.js","assets/use-tags-Cih5ZXdl.js","assets/breadcrumb-Dt4POIrJ.js","assets/toolbar-icon-button-RJfMkoLQ.js","assets/automation-list-row-BXs_Ogmi.js","assets/site-error--i37Vnuw.js","assets/cards-Bew32vSA.js","assets/file-explorer-i9mvkKr3.js","assets/app-editor-TTUJgVhd.js","assets/post-editor-CTE0Ny-s.js","assets/multi-select-D98fbeiJ.js","assets/block-document-CbJActTO.js","assets/primitives-CHBnIb1h.js","assets/use-autosave-BHVh7zSP.js","assets/record-editor-ssFhFAja.js","assets/category-editor-Bm5Mlq8U.js","assets/bulk-category-panel-L3wZRASt.js","assets/index-CNDBtRKj.js","assets/seo-editor-CaD3hjuZ.js","assets/variant-calendar-DuJfg-z-.js","assets/view-mode-toggle-D9gNMAcP.js","assets/post-calendar-VzuxCaB9.js","assets/alert-CEb4xO5-.js","assets/redirect-editor-Ct31zDHf.js","assets/project-app-view-_pt7eBEE.js","assets/hosting-tab-CyasLnZ9.js","assets/empty-state-BrAzdRf-.js","assets/e2e-tab-D1XNI3nb.js","assets/analytics-tab-FZwL75da.js","assets/chart-VKcsR9La.js","assets/index-BoJcLg5E.js","assets/AreaChart-CMltqinO.js","assets/cdn-tab-GRD3AIjn.js","assets/ErrorBarContext-MyCHVq51.js","assets/Sector-6YzDicdd.js"])))=>i.map(i=>d[i]);
2
- import{n as Ns,r as P,ac as aN,ad as lN,ae as Rt,af as ss,ag as Ae,ah as ci,ai as cr,aj as Bh,ak as yu,al as cN,am as Pr,an as dN,ao as Jy,c as U,G as Fe,l as le,j as o,E as sn,b as ue,t as ye,a3 as Ko,J as Ja,h as nt,a1 as Ke,a2 as We,a4 as qe,ap as nn,M as Ff,B as me,aq as j2,ar as Zy,v as no,as as ps,at as ka,au as Dx,d as on,a7 as Ls,e as Rs,o as Ye,av as uN,C as sa,aw as hN,ax as e6,ay as fN,az as ti,aA as g1,aB as Wn,aC as mN,aD as x1,aE as pN,aF as gN,aG as xN,aH as bN,aI as C2,aJ as N2,aK as t6,aL as V2,x as Uf,K as at,aM as vN,aN as yN,aO as _N,aP as s6,aQ as su,m as Zt,a as Nn,z as Uu,Y as Ar,aR as zh,u as na,f as ra,I as T2,aS as LN,aT as Mx,aU as Vm,aa as n6,a9 as Ix,aV as r6,aW as i6,aX as o6,aY as wN,aZ as SN,L as Do,a_ as a6,a$ as kN,b0 as jN,b1 as CN,b2 as Fh,b3 as ja,b4 as tn,b5 as l6,b6 as c6,b7 as Mn,P as Dn,ab as d6,b8 as NN,b9 as Tt,ba as u6,bb as h6,bc as f6,bd as m6,be as p6,bf as g6,bg as VN,bh as TN,bi as PN,bj as AN,bk as x6,bl as Ks,N as sr,bm as b6,bn as EN,bo as RN,bp as v6,bq as DN,br as MN,bs as IN,bt as ON,bu as Tm,bv as Pa,bw as y6,bx as $N,by as BN,bz as zN,bA as FN,bB as UN,bC as HN,bD as P2,bE as KN,bF as WN,bG as qN}from"./index-BtlUOIgR.js";import{i as Hf,n as GN}from"./ArrowUp-C4N1jv5C.js";import{u as Za,a as dr,b as ws,c as an,d as _6,s as YN,e as QN,f as XN,g as JN,h as ZN,i as eV,j as tV,k as A2,l as L6,T as sV,A as nV,m as rV,n as iV,t as oV,o as aV,p as lV}from"./chat-context-DilDlwEk.js";import{c as E2,s as Hu,g as $i,P as Uh,d as R2,t as Hh,a as cV,M as dV,i as uV,b as Er,e as nd,f as hV,D as fV,h as mV,j as pV,k as Uc,l as gV,m as xV,u as Kf,E as bV,n as Ku,o as vV,F as yV,p as Wf,q as qf,r as w6,S as _V,v as LV,w as wV,x as SV,y as Ox,z as kV,A as S6,O as jV,B as $x,C as ni,G as CV,T as Mi,H as NV,I as oi,J as Mo,K as Pm,L as Am,N as k6,Q as VV,R as j6,U as TV,V as ur,W as PV,X as AV,Y as C6,Z as Ni,_ as EV,$ as RV,a0 as N6,a1 as ya,a2 as Bx,a3 as DV,a4 as MV,a5 as zx,a6 as IV,a7 as _u,a8 as el,a9 as di,aa as Kh,ab as D2,ac as M2,ad as OV,ae as $V,af as BV,ag as zV,ah as FV,ai as UV,aj as HV,ak as Gf,al as V6,am as T6,an as P6,ao as KV,ap as A6,aq as WV,ar as qV,as as GV,at as YV,au as Wu,av as QV,aw as XV,ax as JV,ay as ZV}from"./automation-runs-D0qsHVPj.js";import{c as ls,d as qt,b as Bt,D as zt,h as In,e as Yn,i as eT}from"./dialog-BZhwZpkj.js";import{c as tT,b as I2,a as O2,D as $2,d as sT}from"./drawer-D2KyUzEM.js";import{C as nT}from"./collection-search-4OWVO2by.js";import{u as Vn,a as rT}from"./use-mcp-client-DBIpUR_Q.js";import{a as ia,i as Em,S as qu,b as iT,g as Wh,R as oT,c as aT,d as lT,W as Ud,C as cT}from"./constants-Daqiz8AS.js";import{u as E6,g as Yf,l as Rm}from"./use-mcp-prompts-y2MtSMBD.js";import{t as ds,n as R6}from"./ChevronUp-BMcx5g6h.js";import{t as dT,z as uT,u as Gu,a as B2,b as Qf,c as Xf}from"./hooks-BqtNxB1V.js";import{K as hT,i as D6,u as oa,o as fT,f as mT}from"./shell-layout-Cw_Zv8KH.js";import{u as Vs,a as tl,b as z2,c as pT,d as gT}from"./use-virtual-mcp-DrMRB2eS.js";import{w as xT,A as bT}from"./autosend-BYSImvIy.js";import{r as M6,d as Jf,a as F2,p as vT,b as yT,s as _T,c as LT}from"./thread-intent-CKqHlMow.js";import{i as ro}from"./ArrowRight-oW2ppAKR.js";import{t as Zf,l as I6,m as U2,h as aa,o as O6,p as $6,q as B6,A as Hi,r as z6,u as Hc,j as Ki,v as F6,w as rd,x as wT,y as ST,c as U6,z as qh,B as e9,f as Dm,k as H6,C as kT,D as jT,g as K6,E as t9,F as sl,G as CT,H as H2,I as W6,J as q6,K as Mm,L as b1,M as Fx,N as Yu,O as NT,P as VT,Q as TT,R as PT,S as AT,T as ET,n as K2,U as W2,V as G6,W as Y6,X as Q6,Y as X6,Z as RT,_ as q2,$ as DT,a0 as Rr,a1 as Ux,a2 as MT,a3 as IT,d as J6,a4 as G2,a5 as id,a6 as Bi,a7 as Y2,a8 as Qu,a9 as OT,i as s9,aa as $T,ab as Q2,ac as BT,ad as zT,ae as FT,af as UT,ag as HT,ah as KT,ai as zi,aj as Hx,ak as Z6,al as WT,am as qT,an as Ia,ao as Kx,ap as GT,aq as YT,ar as QT,as as e8,at as XT,au as t8,av as JT,aw as ZT,ax as eP,ay as tP,az as nu,aA as sP,aB as nP,aC as s8,aD as X2,aE as rP,aF as iP,aG as oP,aH as aP,aI as lP}from"./agent-icon-B5YynjqW.js";import{i as $t}from"./Check-D43QXlgi.js";import{a as ar}from"./Image01-Cetk23Gg.js";import{i as Qn}from"./Upload01-BIWfPTvJ.js";import{i as vn}from"./AlertCircle-tmlf170X.js";import{a as bn}from"./Copy01-gQD663SC.js";import{F as Im,a as J2,b as Z2,c as eg,d as n8}from"./form-hHdEspGG.js";import{c as It,S as xs,b as bs,a as js,d as vs}from"./select-Cyj_p8d5.js";import{i as n9}from"./ArrowLeft-UW8QSIYv.js";import{T as Aa,a as nl,b as nr,c as od}from"./tabs-DjyEdY-W.js";import{t as Om,i as tg}from"./Tool02-EHcFfjL7.js";import{T as r9,a as Kc}from"./toggle-group-6AKnVxn8.js";import{I as yt}from"./input-DVhzkeDU.js";import{u as sg,A as r8,j as cP,b as i8,k as dP,l as uP,m as hP,n as o8,a as fP,e as $m,r as Bm,p as mP,o as pP,s as gP,q as xP,v as bP,w as vP,x as yP,y as Wx,z as _P,B as LP,C as qx,D as wP,S as ai,E as SP,F as kP,G as jP,h as CP,c as ng,H as Wo,I as hn,T as qn,t as rg,J as i9,f as zm,K as a8,L as Xu,M as ig,N as Ju,O as l8,Q as c8,R as Fm,U as d8,V as NP,W as u8,X as VP,Y as TP,Z as PP,_ as AP,$ as EP,a0 as RP,a1 as DP,a2 as MP,a3 as h8,a4 as IP,i as OP,g as $P,a5 as BP,a6 as zP,a7 as FP,a8 as Um,a9 as Gx,aa as UP,ab as HP,ac as KP,ad as WP,ae as qP,af as o9}from"./task-route-Bv_q5i--.js";import{s as lr,i as og,c as f8}from"./XClose-BUiWkR3f.js";import{M as GP,a as YP,m as a9,i as QP,g as m8,b as XP,N as JP,c as ZP}from"./select-model-DAb9T8kG.js";import{a as gs,b as ys,P as _s,c as eA}from"./popover-CXzsLJLQ.js";import{t as Fi}from"./Stars01-B_a7_AvS.js";import{b as tA,a as p8,u as l9,c as g8,d as sA}from"./use-organization-settings-DV6zKCpV.js";import{u as c9,a as nA}from"./use-ai-providers-BzFij6Yg.js";import{g as x8,c as b8,u as Zu,b as xn,L as d9,P as v8,s as y8,a as rA,f as iA,d as oA}from"./project-icon-C_Y9lQqb.js";import{f as aA,a as lA,u as Lu,b as e0,c as _8,d as cA,e as ag,g as L8,h as lg,i as dA,j as cg,k as wu,l as w8,m as uA,n as S8,o as hA}from"./folder-icon-CQEOL9D6.js";import{c as Ft,D as Ut,b as Ht,a as et,d as jr,e as Cr,f as Nr,g as Gh,h as Bo,i as Dc,j as Sd}from"./dropdown-menu-DRmaugfH.js";import{i as dg}from"./Link01-CRhSvCpz.js";import{s as Qt}from"./Plus-q_spJwnV.js";import{p as fA,q as mA}from"./question-004-sINsf4GQ.js";import{A as Fs}from"./avatar-BAfh7dfM.js";import{u as u9,a as ug}from"./use-members-Fuly6XlY.js";import{i as Us}from"./ChevronRight-BGzR3MPV.js";import{u as ad}from"./use-is-desktop-app-BNujXJc_.js";import{a as pi,b as k8,u as hg,c as j8}from"./use-panel-navigate-BDsIsCi2.js";import{i as gi}from"./CheckCircle-CzwwsIjX.js";import{i as pA}from"./XCircle-ByMu8jAG.js";import{I as io}from"./integration-icon-W7q1QwrY.js";import{a as h9,u as C8,b as fg,c as gA,d as xA,p as bA,e as vA,f as t0,g as N8,h as mg,i as yA,j as _A}from"./use-navigate-to-agent-Kl6EnJy1.js";import{e as s0}from"./backoff-CrEUbyZT.js";import{u as LA}from"./use-status-sounds-JH-_0XAZ.js";import{E as Dr}from"./empty-state-ClRvEbll.js";import{b as wA,c as n0,d as V8,u as T8,r as SA}from"./thread-route-AbWdgotm.js";import{g as la,r as Hn,h as pg,a as P8,b as A8}from"./github-repo-CTPv5ZM2.js";import{T as kA}from"./toolbar-D6LmlQ1e.js";import{i as qo,a as jA}from"./Share07-n-3fSUdL.js";import{i as Cn}from"./Globe01-COOcKemB.js";import{i as E8}from"./Monitor01-C4tpFrFH.js";import{u as ui,a as gg,b as R8}from"./use-connection-C9LH9ktZ.js";import{u as D8,a as M8}from"./use-mcp-tools-BsEDXwD6.js";import{g as I8}from"./types-CxO7wOk-.js";import{F as Go}from"./file-type-icon-CRkeI-TW.js";import{f as O8,d as r0,s as xg,c as CA,b as NA}from"./TrendUp01-Cz7gaxLj.js";import{i as Mr}from"./ZoomOut-ENcKaGzb.js";import{i as Gn}from"./GitBranch01-BXJjzFHM.js";import{a as bg}from"./Package-BMpeE28g.js";import{i as vg,r as VA,s as $8,a as B8}from"./source-system-tabs-CnEGUb4r.js";import{n as Su}from"./Download01-C5xZFRgI.js";import{n as fn}from"./LinkExternal01-B71u24kv.js";import{D as Ca}from"./use-destination-route-CUHeljX2.js";import{g as TA,s as PA,d as z8,a as AA,F as F8,b as U8,f as H8,S as K8,c as EA}from"./skill-preview-CW8imphI.js";import{i as f9}from"./Key01-CTPGBIuS.js";import{p as yg,b as dn,s as Wc,H as ku,h as ju,a as gc,c as W8,d as q8}from"./location-oTTXFrSF.js";import{m as RA,a as DA,M as ld,b as MA,O as IA}from"./markdown-DRT9KRNa.js";import{g as OA}from"./extract-connection-data-D78kSWFE.js";import{g as m9,n as $A,a as Yx,e as BA,u as zA,f as FA}from"./use-date-fns-locale-DBpL-xm-.js";import{a as UA,i as Qx}from"./mcp-oauth-B0ZK0THI.js";import{A as Wi,a as qi,b as Gi,c as Yi,d as Qi,e as Xi,f as Ji,g as Zi}from"./alert-dialog-bPhnZuBF.js";import{T as Yo}from"./textarea-Cdferp0K.js";import{i as Oa}from"./Play-CX-1pcs-.js";import{s as rn}from"./Trash01-uEgLHTb-.js";import{u as Yh}from"./use-debounced-autosave-B9WM09s6.js";import{S as rl}from"./scroll-area-Ca3wuyBa.js";import{i as Cu}from"./SearchMd-B_sSHt1j.js";import{C as il}from"./checkbox-DHBigI1P.js";import{S as p9}from"./search-input-BMRJF5PT.js";import{C as G8}from"./collection-tabs-C7YylUDr.js";import{T as Y8,u as Q8}from"./use-mcp-auth-status-BeaI0e3q.js";import{g as HA}from"./connection-slug-CITJ0kGN.js";import{a as KA,i as WA}from"./Settings02-BQeN72sP.js";import{L as At}from"./label-DVQH5HfM.js";import{S as rr}from"./switch-Do8kG-W6.js";import{s as X8}from"./slugify-CEUa2lfQ.js";import{d as cd}from"./delay-CnY5UFtP.js";import{R as i0}from"./repository-import-picker-UuFyRapE.js";import{s as J8}from"./User01-CiJaeywX.js";import{t as g9}from"./Users01-CWN5RUiZ.js";import{u as Z8,a as e7}from"./use-secrets-B3oN2LCY.js";import{G as Ir}from"./github-icon-quUu4aVj.js";import{t as xi,c as qc,m as qA,a as t7}from"./differenceInSeconds-C3x8sHUj.js";import{C as GA,a as YA,b as QA}from"./client-icons-CpQxSG6O.js";import{g as jn}from"./get-initials-D-f_fDFw.js";import{S as is,D as s7,C as n7,R as XA,a as JA,i as r7,n as ZA,b as eE}from"./task-board-Bx3cqwAZ.js";import{a as dd}from"./format-time-BtXRrtv4.js";import{u as i7,d as tE,c as sE,C as _g,a as nE}from"./connect-layout-BZH3VWOf.js";import{u as Lg,a as rE,b as iE}from"./use-tags-Cih5ZXdl.js";import{B as oE,a as aE,b as Xx,c as lE,d as cE,e as dE}from"./breadcrumb-Dt4POIrJ.js";import{u as v1}from"./use-copy-C_RcJrvS.js";import{i as wg,a as uE,c as hE,b as fE}from"./UserSquare-BATVnS3x.js";import{C as zr,a as hr,b as fr,c as On,d as as,e as Es,f as mE,g as Jx}from"./command-qoguNyQb.js";import{u as pE}from"./use-org-auth-client-D5yIq9Gk.js";import{t as gE}from"./decopilot-sse-pool-Bc0jSHS4.js";import{G as xE,u as bE}from"./repository-picker-C0sEORMq.js";import{l as vE}from"./provision-repo-scoped-github-connection-WQFARyHG.js";import{i as x9}from"./ChevronSelectorVertical-D2JHLnW-.js";import{w as Zx}from"./editor-Ds1FbC2-.js";import{T as Io,p as o7,I as a7}from"./toolbar-icon-button-RJfMkoLQ.js";import{u as Hm,C as yE,b as _E,p as l7,a as LE,s as Km,n as wE}from"./self-tool-result-4wUrYSY4.js";import{M as ud}from"./monaco-editor-B0196ei4.js";import{i as SE,a as b9,b as Sg}from"./Tool01-BP77SoXO.js";import{a as Wm}from"./Palette-DbLDcKQl.js";import{s as kE}from"./safe-image-url-D5z803Ot.js";import{s as o0}from"./Eye-Brx0T7sd.js";import{i as v9}from"./DotsVertical-T5KAvZex.js";import{u as y9}from"./use-debounced-value-DiDBNIsK.js";import{u as c7,a as kg}from"./use-file-configs-C1cw7bWX.js";import{u as d7}from"./useInfiniteQuery-BvtmxOq6.js";import{i as hi}from"./Zap-Cul-MTXM.js";import{r as u7}from"./site-slug-uya6Wp4-.js";import{B as jE}from"./badge-CF8t3kFT.js";import{u as a0,a as CE,b as NE,c as VE,d as TE}from"./use-automations-3EGHGpk2.js";import{A as PE}from"./automation-list-row-BXs_Ogmi.js";import{t as AE}from"./site-error--i37Vnuw.js";import{f as EE,p as RE,g as DE,u as ME,e as IE,a as OE,F as l0,t as h7,S as $E,B as BE,b as f7,R as zE,c as FE}from"./cards-Bew32vSA.js";function m7(t,e){const s=Ns(e);return UE({filters:{...t,status:"pending"}},s).length}function e4(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function UE(t={},e){const s=Ns(e).getMutationCache(),n=P.useRef(t),r=P.useRef(null);return r.current===null&&(r.current=e4(s,t)),P.useEffect(()=>{n.current=t}),P.useSyncExternalStore(P.useCallback(i=>s.subscribe(()=>{const a=aN(r.current,e4(s,n.current));r.current!==a&&(r.current=a,lN.schedule(i))}),[s]),()=>r.current,()=>r.current)}const p7=Rt({connection_id:Ae().describe("Connection ID"),selected_tools:ss(Ae()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:ss(Ae()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:ss(Ae()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),y1=500,g7=200,jg=200,HE=200,KE=20,WE=50,qE=100,GE=20,YE=100,QE=50,XE=100,JE=50,ZE=8192,x7=p7.extend({selected_tools:ss(Ae()).max(y1).nullable().optional().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:ss(Ae()).max(y1).nullable().optional().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:ss(Ae()).max(y1).nullable().optional().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),eR=Rt({connectionId:Ae(),toolName:Ae(),label:Ae(),icon:Ae().nullable().optional()}),tR=Rt({id:Ae().describe("Stable id; used as React key and ?tab= value"),title:Ae().describe("Tab label"),icon:Ae().optional().describe("Optional lucide icon name"),view:Rt({type:Bh("ext-app"),appId:Ae(),args:yu(Ae(),Jy()).optional()})}),b7=cr(["overview","reports","board","site-editor","assets","hosting","e2e","analytics","cdn","automations"]),sR=cr(["on","off"]),nR=new Map([["manual","on"],["auto","on"]]),rR=cr(["on","off","manual","auto"]);function iR(t){if(!t)return null;const e=nR.get(t);return e||(t==="on"||t==="off"?t:null)}const oR=Rt({defaultMainView:Rt({type:Ae(),id:Ae().optional(),toolName:Ae().optional()}).nullable().optional(),chatDefaultOpen:ci().nullable().optional(),cmsDefaultOpen:ci().nullable().optional(),cms:rR.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),sidebarViews:ss(b7).max(10).nullable().optional().describe("Deprecated layout-scoped sidebar selections. Read only as a fallback when metadata.sidebarViews is absent."),tabs:ss(tR).max(GE).optional()});function c0(t){return iR(t?.cms)??"on"}function aR(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"site-editor"}}:{}}}const t4=Rt({tileId:Ae().optional(),connectionId:Ae().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:Ae().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:Ae().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:yu(Ae(),Jy()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:Pr().int().positive().optional(),maxHeight:Pr().int().positive().optional()}),lR=Rt({banner:Ae().nullable().optional(),bannerColor:Ae().nullable().optional(),icon:Ae().nullable().optional(),themeColor:Ae().nullable().optional(),pinnedViews:ss(eR).max(qE).nullable().optional(),layout:oR.nullable().optional(),homeTile:t4.nullable().optional(),homeTiles:ss(t4).max(KE).nullable().optional(),homePrompts:ss(Ae()).max(WE).nullable().optional()}),d0=/^[A-Za-z_][A-Za-z0-9_]*$/,s4=Ae().min(1).regex(d0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),cR=dN("kind",[Rt({key:s4,kind:Bh("literal"),value:Ae().max(ZE)}),Rt({key:s4,kind:Bh("secret"),secretId:Ae().min(1)})]),Cg=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,dR=Rt({host:Ae().min(1).regex(Cg).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:Ae().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),uR=Rt({selected:Ae().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:Ae().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:Ae().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:ss(cR).max(XE).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:ss(dR).max(JE).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),hR=Rt({url:Ae().describe("GitHub repository URL"),owner:Ae().describe("Repository owner"),name:Ae().describe("Repository name"),installationId:Pr().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:Ae().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials."),repositoryId:Ae().optional().describe("First-class repository (REPOSITORY_LINK) backing this binding. When set, credentials come from the repository's git provider account rather than connectionId.")}),fR=cr(["agent-sandbox","local-api"]),mR={sandboxHandle:Ae().describe("Provider-specific handle"),previewUrl:Ae().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:Ae().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:Pr().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:Rt({packageManager:Ae().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:Ae().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:Ae().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},v7=Rt(mR);function pR(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,s={};for(const[n,r]of Object.entries(e))if(!(!r||typeof r!="object")&&!(n!=="agent-sandbox"&&n!=="local-api"))try{s[n]=v7.parse(r)}catch{}return s}const gR=yu(Ae().describe("userId"),yu(Ae().describe("branch"),cN(fR,v7))),xR=Rt({id:Ae().describe("Stable identifier for this knowledge file"),name:Ae().describe("File name shown in the UI"),kind:cr(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:Ae().describe("Org filesystem (Library) volume the file lives in"),path:Ae().describe("Path within the volume"),url:Ae().describe("Same-origin URL to read the file (display/download)"),contentType:Ae().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:Pr().nullable().optional().describe("File size in bytes"),addedAt:Ae().describe("ISO timestamp when the file was attached")}),bR=ss(xR).max(YE).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),vR=cr(["smart","code-review","open"]),yR=vR.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),_R=ci().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),LR=ci().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),wR=Ae().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),SR=Rt({branch:Ae().describe("Git branch backing this release"),name:Ae().describe('User-facing name, e.g. "Black Friday 2026"'),color:Ae().describe("Dot color token shown in the version switcher"),createdBy:Ae().optional().describe("User ID who created the release"),createdAt:Ae().optional().describe("ISO 8601 creation timestamp")}),kR=ss(SR).max(QE).nullable().optional().describe("Curated list of named, branch-backed releases shown in the version switcher. The base branch ('No ar') is derived, not stored here."),jR=ci().nullable().optional().describe("Draft & Releases mode: gates the drafts UX (releases switcher, read-only production, publish-to-production). Off (default) keeps the classic branch/PR picker and post-publish behavior."),Ng={instructions:Ae().nullable().optional().describe("Instructions also used as system prompt"),enabled_plugins:ss(Ae()).max(jg).nullable().optional().describe("List of enabled plugin IDs"),subAgents:ss(Ae()).max(HE).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Ae().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:lR.nullable().optional().describe("UI customization settings"),sidebarViews:ss(b7).max(10).nullable().optional().describe("Project views selected for the sidebar. Interpret as an exact list when sidebarViewsVersion is 1; unversioned values use legacy native-only semantics. Runtime presence gates still apply."),sidebarViewsVersion:Bh(1).optional().describe("Version 1 marks metadata.sidebarViews as an exact list that can disable legacy default rows."),githubRepo:hR.nullable().optional().describe("Linked GitHub repository"),runtime:uR.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:bR,siteSlug:Ae().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:yR,previewServerUrl:wR,productionUrl:Ae().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:ci().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:_R,releases:kR,draftsMode:jR,fastPreviewInPlace:LR},CR=Rt({id:Ae().describe("Unique identifier"),title:Ae().describe("Human-readable name"),description:Ae().nullable().describe("Description"),icon:Ae().nullable().describe("Icon URL"),created_at:Ae().describe("Creation timestamp"),updated_at:Ae().describe("Last update timestamp"),created_by:Ae().describe("User ID who created this item"),updated_by:Ae().optional().describe("User ID who last updated this item"),organization_id:Ae().describe("Organization ID this item belongs to"),status:cr(["active","inactive"]).describe("Current status"),pinned:ci().describe("Whether this space is pinned to the sidebar"),metadata:Rt(Ng).extend({instructions:Ae().nullable().describe("Instructions also used as system prompt"),sandboxMap:gR.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:ss(p7).describe("Connections with their selected tools, resources, and prompts")}),y7=Rt({title:Ae().min(1).max(120).describe("Short label shown on the chip"),description:Ae().max(280).optional().describe("One-line subtitle shown under the title"),text:Ae().min(1).max(4e3).describe("The message sent to the agent when the prompt is clicked")});Rt({title:Ae().min(1).max(255).describe("Name for the virtual MCP"),description:Ae().max(500).nullable().optional().describe("Optional description"),icon:Ae().nullish().describe("Optional icon URL"),status:cr(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:ci().optional().default(!1).describe("Pin to sidebar"),metadata:Rt(Ng).extend({enabled_plugins:ss(Ae()).max(jg).nullable().optional().describe("List of enabled plugin IDs")}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:ss(x7).max(g7).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:ss(y7).max(20).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});Rt({title:Ae().min(1).max(255).optional().describe("New name"),description:Ae().max(500).nullable().optional().describe("New description (null to clear)"),icon:Ae().nullish().describe("New icon URL"),status:cr(["active","inactive"]).optional().describe("New status"),pinned:ci().optional().describe("Pin/unpin from sidebar"),metadata:Rt(Ng).extend({enabled_plugins:ss(Ae()).max(jg).nullable().optional().describe("List of enabled plugin IDs")}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:ss(x7).max(g7).optional().describe("New connections (replaces existing)"),prompts:ss(y7).max(20).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});function Nu(t,e){const s=m9(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,r=xi(t,e?.in),i=r.getDay(),a=(i<n?7:0)+i-n;return r.setDate(r.getDate()-a),r.setHours(0,0,0,0),r}function Qh(t,e){return Nu(t,{...e,weekStartsOn:1})}function _7(t,e){const s=xi(t,e?.in),n=s.getFullYear(),r=qc(s,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const i=Qh(r),a=qc(s,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=Qh(a);return s.getTime()>=i.getTime()?n+1:s.getTime()>=l.getTime()?n:n-1}function n4(t,e){const s=xi(t,e?.in);return s.setHours(0,0,0,0),s}function NR(t,e,s){const[n,r]=$A(s?.in,t,e),i=n4(n),a=n4(r),l=+i-Yx(i),c=+a-Yx(a);return Math.round((l-c)/qA)}function VR(t,e){const s=_7(t,e),n=qc(t,0);return n.setFullYear(s,0,4),n.setHours(0,0,0,0),Qh(n)}function TR(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function PR(t){return!(!TR(t)&&typeof t!="number"||isNaN(+xi(t)))}function AR(t,e){const s=xi(t,e?.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}function ER(t,e){const s=xi(t,e?.in);return NR(s,AR(s))+1}function RR(t,e){const s=xi(t,e?.in),n=+Qh(s)-+VR(s);return Math.round(n/t7)+1}function L7(t,e){const s=xi(t,e?.in),n=s.getFullYear(),r=m9(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=qc(e?.in||t,0);a.setFullYear(n+1,0,i),a.setHours(0,0,0,0);const l=Nu(a,e),c=qc(e?.in||t,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const d=Nu(c,e);return+s>=+l?n+1:+s>=+d?n:n-1}function DR(t,e){const s=m9(),n=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,r=L7(t,e),i=qc(e?.in||t,0);return i.setFullYear(r,0,n),i.setHours(0,0,0,0),Nu(i,e)}function MR(t,e){const s=xi(t,e?.in),n=+Nu(s,e)-+DR(s,e);return Math.round(n/t7)+1}function Kt(t,e){const s=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return s+n}const jo={y(t,e){const s=t.getFullYear(),n=s>0?s:1-s;return Kt(e==="yy"?n%100:n,e.length)},M(t,e){const s=t.getMonth();return e==="M"?String(s+1):Kt(s+1,2)},d(t,e){return Kt(t.getDate(),e.length)},a(t,e){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];default:return s==="am"?"a.m.":"p.m."}},h(t,e){return Kt(t.getHours()%12||12,e.length)},H(t,e){return Kt(t.getHours(),e.length)},m(t,e){return Kt(t.getMinutes(),e.length)},s(t,e){return Kt(t.getSeconds(),e.length)},S(t,e){const s=e.length,n=t.getMilliseconds(),r=Math.trunc(n*Math.pow(10,s-3));return Kt(r,e.length)}},xc={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},r4={G:function(t,e,s){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return s.era(n,{width:"abbreviated"});case"GGGGG":return s.era(n,{width:"narrow"});default:return s.era(n,{width:"wide"})}},y:function(t,e,s){if(e==="yo"){const n=t.getFullYear(),r=n>0?n:1-n;return s.ordinalNumber(r,{unit:"year"})}return jo.y(t,e)},Y:function(t,e,s,n){const r=L7(t,n),i=r>0?r:1-r;if(e==="YY"){const a=i%100;return Kt(a,2)}return e==="Yo"?s.ordinalNumber(i,{unit:"year"}):Kt(i,e.length)},R:function(t,e){const s=_7(t);return Kt(s,e.length)},u:function(t,e){const s=t.getFullYear();return Kt(s,e.length)},Q:function(t,e,s){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Kt(n,2);case"Qo":return s.ordinalNumber(n,{unit:"quarter"});case"QQQ":return s.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(n,{width:"narrow",context:"formatting"});default:return s.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,s){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Kt(n,2);case"qo":return s.ordinalNumber(n,{unit:"quarter"});case"qqq":return s.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(n,{width:"narrow",context:"standalone"});default:return s.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,s){const n=t.getMonth();switch(e){case"M":case"MM":return jo.M(t,e);case"Mo":return s.ordinalNumber(n+1,{unit:"month"});case"MMM":return s.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(n,{width:"narrow",context:"formatting"});default:return s.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,s){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return Kt(n+1,2);case"Lo":return s.ordinalNumber(n+1,{unit:"month"});case"LLL":return s.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(n,{width:"narrow",context:"standalone"});default:return s.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,s,n){const r=MR(t,n);return e==="wo"?s.ordinalNumber(r,{unit:"week"}):Kt(r,e.length)},I:function(t,e,s){const n=RR(t);return e==="Io"?s.ordinalNumber(n,{unit:"week"}):Kt(n,e.length)},d:function(t,e,s){return e==="do"?s.ordinalNumber(t.getDate(),{unit:"date"}):jo.d(t,e)},D:function(t,e,s){const n=ER(t);return e==="Do"?s.ordinalNumber(n,{unit:"dayOfYear"}):Kt(n,e.length)},E:function(t,e,s){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return s.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(n,{width:"short",context:"formatting"});default:return s.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,s,n){const r=t.getDay(),i=(r-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Kt(i,2);case"eo":return s.ordinalNumber(i,{unit:"day"});case"eee":return s.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(r,{width:"short",context:"formatting"});default:return s.day(r,{width:"wide",context:"formatting"})}},c:function(t,e,s,n){const r=t.getDay(),i=(r-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Kt(i,e.length);case"co":return s.ordinalNumber(i,{unit:"day"});case"ccc":return s.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(r,{width:"narrow",context:"standalone"});case"cccccc":return s.day(r,{width:"short",context:"standalone"});default:return s.day(r,{width:"wide",context:"standalone"})}},i:function(t,e,s){const n=t.getDay(),r=n===0?7:n;switch(e){case"i":return String(r);case"ii":return Kt(r,e.length);case"io":return s.ordinalNumber(r,{unit:"day"});case"iii":return s.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(n,{width:"short",context:"formatting"});default:return s.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,s){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(r,{width:"narrow",context:"formatting"});default:return s.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,s){const n=t.getHours();let r;switch(n===12?r=xc.noon:n===0?r=xc.midnight:r=n/12>=1?"pm":"am",e){case"b":case"bb":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(r,{width:"narrow",context:"formatting"});default:return s.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,s){const n=t.getHours();let r;switch(n>=17?r=xc.evening:n>=12?r=xc.afternoon:n>=4?r=xc.morning:r=xc.night,e){case"B":case"BB":case"BBB":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(r,{width:"narrow",context:"formatting"});default:return s.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,s){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),s.ordinalNumber(n,{unit:"hour"})}return jo.h(t,e)},H:function(t,e,s){return e==="Ho"?s.ordinalNumber(t.getHours(),{unit:"hour"}):jo.H(t,e)},K:function(t,e,s){const n=t.getHours()%12;return e==="Ko"?s.ordinalNumber(n,{unit:"hour"}):Kt(n,e.length)},k:function(t,e,s){let n=t.getHours();return n===0&&(n=24),e==="ko"?s.ordinalNumber(n,{unit:"hour"}):Kt(n,e.length)},m:function(t,e,s){return e==="mo"?s.ordinalNumber(t.getMinutes(),{unit:"minute"}):jo.m(t,e)},s:function(t,e,s){return e==="so"?s.ordinalNumber(t.getSeconds(),{unit:"second"}):jo.s(t,e)},S:function(t,e){return jo.S(t,e)},X:function(t,e,s){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return o4(n);case"XXXX":case"XX":return _a(n);default:return _a(n,":")}},x:function(t,e,s){const n=t.getTimezoneOffset();switch(e){case"x":return o4(n);case"xxxx":case"xx":return _a(n);default:return _a(n,":")}},O:function(t,e,s){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+i4(n,":");default:return"GMT"+_a(n,":")}},z:function(t,e,s){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+i4(n,":");default:return"GMT"+_a(n,":")}},t:function(t,e,s){const n=Math.trunc(+t/1e3);return Kt(n,e.length)},T:function(t,e,s){return Kt(+t,e.length)}};function i4(t,e=""){const s=t>0?"-":"+",n=Math.abs(t),r=Math.trunc(n/60),i=n%60;return i===0?s+String(r):s+String(r)+e+Kt(i,2)}function o4(t,e){return t%60===0?(t>0?"-":"+")+Kt(Math.abs(t)/60,2):_a(t,e)}function _a(t,e=""){const s=t>0?"-":"+",n=Math.abs(t),r=Kt(Math.trunc(n/60),2),i=Kt(n%60,2);return s+r+e+i}const a4=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},w7=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},IR=(t,e)=>{const s=t.match(/(P+)(p+)?/)||[],n=s[1],r=s[2];if(!r)return a4(t,e);let i;switch(n){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",a4(n,e)).replace("{{time}}",w7(r,e))},OR={p:w7,P:IR},$R=/^D+$/,BR=/^Y+$/,zR=["D","DD","YY","YYYY"];function FR(t){return $R.test(t)}function UR(t){return BR.test(t)}function HR(t,e,s){const n=KR(t,e,s);if(console.warn(n),zR.includes(t))throw new RangeError(n)}function KR(t,e,s){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const WR=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qR=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,GR=/^'([^]*?)'?$/,YR=/''/g,QR=/[a-zA-Z]/;function XR(t,e,s){const n=m9(),r=s?.locale??n.locale??BA,i=s?.firstWeekContainsDate??s?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=s?.weekStartsOn??s?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,l=xi(t,s?.in);if(!PR(l))throw new RangeError("Invalid time value");let c=e.match(qR).map(h=>{const u=h[0];if(u==="p"||u==="P"){const f=OR[u];return f(h,r.formatLong)}return h}).join("").match(WR).map(h=>{if(h==="''")return{isToken:!1,value:"'"};const u=h[0];if(u==="'")return{isToken:!1,value:JR(h)};if(r4[u])return{isToken:!0,value:h};if(u.match(QR))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return{isToken:!1,value:h}});r.localize.preprocessor&&(c=r.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:a,locale:r};return c.map(h=>{if(!h.isToken)return h.value;const u=h.value;(!s?.useAdditionalWeekYearTokens&&UR(u)||!s?.useAdditionalDayOfYearTokens&&FR(u))&&HR(u,e,String(t));const f=r4[u[0]];return f(l,u,r.localize,d)}).join("")}function JR(t){const e=t.match(GR);return e?e[1].replace(YR,"'"):t}const l4=3,S7="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",ZR="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function k7(t){const e=U.c(46),{item:s,onSelect:n,isLoading:r,isDisabled:i,variant:a}=t,l=a===void 0?"pill":a,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const S=$i(c._meta);d=c.title??R2(c.name,S),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const h=d,u=c.description||null;if(l==="card"){let S;e[4]!==n||e[5]!==c?(S=()=>n(c),e[4]=n,e[5]=c,e[6]=S):S=e[6];const k=i||r,j=r&&"bg-accent/40",N=(i||r)&&"cursor-not-allowed opacity-50";let V;e[7]!==j||e[8]!==N?(V=le(ZR,"hover:bg-accent/60 text-foreground",j,N),e[7]=j,e[8]=N,e[9]=V):V=e[9];let C;e[10]!==h?(C=o.jsx("span",{className:"font-medium truncate capitalize",children:h}),e[10]=h,e[11]=C):C=e[11];let T;e[12]!==r?(T=r&&o.jsx(nt,{size:"xs"}),e[12]=r,e[13]=T):T=e[13];let A;e[14]!==C||e[15]!==T?(A=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[C,T]}),e[14]=C,e[15]=T,e[16]=A):A=e[16];let R;e[17]!==u?(R=u&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:u}),e[17]=u,e[18]=R):R=e[18];let E;return e[19]!==A||e[20]!==R||e[21]!==S||e[22]!==k||e[23]!==V?(E=o.jsxs("button",{type:"button",onClick:S,disabled:k,className:V,children:[A,R]}),e[19]=A,e[20]=R,e[21]=S,e[22]=k,e[23]=V,e[24]=E):E=e[24],E}let f;e[25]!==n||e[26]!==c?(f=()=>n(c),e[25]=n,e[26]=c,e[27]=f):f=e[27];const m=i||r,p=r&&"bg-muted/50",g=(i||r)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=le(S7,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==h?(b=o.jsx("span",{className:"capitalize",children:h}),e[31]=h,e[32]=b):b=e[32];let v;e[33]!==r?(v=r&&o.jsx(nt,{size:"xs"}),e[33]=r,e[34]=v):v=e[34];let _;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==v?(_=o.jsx(Ke,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:f,disabled:m,className:x,children:[b,v]})}),e[35]=f,e[36]=m,e[37]=x,e[38]=b,e[39]=v,e[40]=_):_=e[40];const L=u??h;let y;e[41]!==L?(y=o.jsx(We,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:L})}),e[41]=L,e[42]=y):y=e[42];let w;return e[43]!==_||e[44]!==y?(w=o.jsxs(qe,{delayDuration:400,children:[_,y]}),e[43]=_,e[44]=y,e[45]=w):w=e[45],w}function eD(t){const e=U.c(61),{items:s,open:n,onOpenChange:r,onSelect:i,loadingPrompt:a}=t,l=ue(),[c,d]=P.useState(""),h=!!a;let u;e[0]!==s||e[1]!==c?(u=c.trim()?s.filter(C=>{const T=c.toLowerCase();return C.prompt.name.toLowerCase().includes(T)||(C.prompt.title??"").toLowerCase().includes(T)||(C.prompt.description??"").toLowerCase().includes(T)}):s,e[0]=s,e[1]=c,e[2]=u):u=e[2];const f=u,m=Ja();let p;e[3]!==f.length||e[4]!==c||e[5]!==l?(p=f.length===0&&o.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:l("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=f.length,e[4]=c,e[5]=l,e[6]=p):p=e[6];let g;if(e[7]!==f||e[8]!==h||e[9]!==a?.name||e[10]!==r||e[11]!==i){let C;e[13]!==h||e[14]!==a?.name||e[15]!==r||e[16]!==i?(C=T=>o.jsx(k7,{item:T,variant:"card",onSelect:A=>{r(!1),i(A)},isLoading:a?.name===T.prompt.name,isDisabled:h&&a?.name!==T.prompt.name},T.prompt.name),e[13]=h,e[14]=a?.name,e[15]=r,e[16]=i,e[17]=C):C=e[17],g=f.map(C),e[7]=f,e[8]=h,e[9]=a?.name,e[10]=r,e[11]=i,e[12]=g}else g=e[12];let x;e[18]!==p||e[19]!==g?(x=o.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[p,g]})}),e[18]=p,e[19]=g,e[20]=x):x=e[20];const b=x;let v;e[21]!==l?(v=l("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=l,e[22]=v):v=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=C=>{C.key==="Escape"&&d("")},e[23]=_):_=e[23];let L;e[24]!==c||e[25]!==v?(L=o.jsx(nT,{value:c,onChange:d,placeholder:v,onKeyDown:_}),e[24]=c,e[25]=v,e[26]=L):L=e[26];const y=L;if(m){let C;e[27]!==l?(C=l("chat.iceBreakers.allPromptsTitle"),e[27]=l,e[28]=C):C=e[28];let T;e[29]!==C?(T=o.jsx(tT,{className:"sr-only",children:o.jsx(I2,{children:C})}),e[29]=C,e[30]=T):T=e[30];let A;e[31]!==l?(A=l("chat.iceBreakers.promptsLabel"),e[31]=l,e[32]=A):A=e[32];let R;e[33]!==A?(R=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:A})}),e[33]=A,e[34]=R):R=e[34];let E;e[35]!==b||e[36]!==y||e[37]!==R||e[38]!==T?(E=o.jsxs(O2,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[T,R,y,b]}),e[35]=b,e[36]=y,e[37]=R,e[38]=T,e[39]=E):E=e[39];let I;return e[40]!==r||e[41]!==n||e[42]!==E?(I=o.jsx(Ko,{delayDuration:400,children:o.jsx($2,{open:n,onOpenChange:r,children:E})}),e[40]=r,e[41]=n,e[42]=E,e[43]=I):I=e[43],I}let w;e[44]!==l?(w=l("chat.iceBreakers.allPromptsTitle"),e[44]=l,e[45]=w):w=e[45];let S;e[46]!==w?(S=o.jsx(ls,{className:"sr-only",children:o.jsx(qt,{children:w})}),e[46]=w,e[47]=S):S=e[47];let k;e[48]!==l?(k=l("chat.iceBreakers.promptsLabel"),e[48]=l,e[49]=k):k=e[49];let j;e[50]!==k?(j=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:k})}),e[50]=k,e[51]=j):j=e[51];let N;e[52]!==b||e[53]!==y||e[54]!==j||e[55]!==S?(N=o.jsxs(Bt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,j,y,b]}),e[52]=b,e[53]=y,e[54]=j,e[55]=S,e[56]=N):N=e[56];let V;return e[57]!==r||e[58]!==n||e[59]!==N?(V=o.jsx(Ko,{delayDuration:400,children:o.jsx(zt,{open:n,onOpenChange:r,children:N})}),e[57]=r,e[58]=n,e[59]=N,e[60]=V):V=e[60],V}function tD(t){const e=U.c(30),{items:s,onSelect:n,loadingPrompt:r,className:i}=t,a=ue(),[l,c]=P.useState(!1);if(s.length===0)return null;let d,h,u,f,m;if(e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==n||e[4]!==a){const b=s.slice(0,l4),v=s.slice(l4),_=!!r;let L;e[10]!==_||e[11]!==r?.name||e[12]!==n?(L=w=>o.jsx(k7,{item:w,onSelect:n,isLoading:r?.name===w.prompt.name,isDisabled:_&&r?.name!==w.prompt.name},w.prompt.name),e[10]=_,e[11]=r?.name,e[12]=n,e[13]=L):L=e[13];const y=b.map(L);d=Ko,m=400,e[14]!==i?(h=le("w-full flex flex-wrap gap-2 justify-center",i),e[14]=i,e[15]=h):h=e[15],u=y,f=v.length>0&&o.jsx("button",{type:"button",disabled:_,onClick:()=>c(!0),className:le(S7,"hover:bg-muted/70 hover:text-foreground",_&&"opacity-50 cursor-not-allowed"),children:a("chat.iceBreakers.moreButton",{count:v.length})}),e[0]=i,e[1]=s,e[2]=r,e[3]=n,e[4]=a,e[5]=d,e[6]=h,e[7]=u,e[8]=f,e[9]=m}else d=e[5],h=e[6],u=e[7],f=e[8],m=e[9];let p;e[16]!==h||e[17]!==u||e[18]!==f?(p=o.jsxs("div",{className:h,children:[u,f]}),e[16]=h,e[17]=u,e[18]=f,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==r||e[22]!==l||e[23]!==n?(g=o.jsx(eD,{items:s,open:l,onOpenChange:c,onSelect:n,loadingPrompt:r}),e[20]=s,e[21]=r,e[22]=l,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==m||e[27]!==p||e[28]!==g?(x=o.jsxs(d,{delayDuration:m,children:[p,g]}),e[25]=d,e[26]=m,e[27]=p,e[28]=g,e[29]=x):x=e[29],x}function sD(){return null}function nD(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function rD(t){const e=U.c(31),{connectionId:s}=t,n=ue(),{sendMessage:r}=dr(),{org:i}=Fe();let a;e[0]!==s||e[1]!==i.id||e[2]!==i.slug?(a={connectionId:s,orgId:i.id,orgSlug:i.slug},e[0]=s,e[1]=i.id,e[2]=i.slug,e[3]=a):a=e[3];const l=Vn(a);let c;e[4]!==l?(c={client:l,staleTime:6e4},e[4]=l,e[5]=c):c=e[5];const{data:d}=E6(c);let h;e[6]!==d?.prompts?(h=d?.prompts??[],e[6]=d?.prompts,e[7]=h):h=e[7];const u=h;let f;e[8]!==u?(f=u.map(iD),e[8]=u,e[9]=f):f=e[9];const m=f;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=P.useReducer(nD,p),[b,v]=P.useState(null);let _;e[11]!==l||e[12]!==r||e[13]!==n?(_=async(A,R)=>{if(!l){ye.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const E=await Yf(l,A.name,R);x({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[E2({id:A.name,name:Hu(A.name,$i(A._meta)),metadata:E.messages,char:"/",kind:"prompt",args:R}),{type:"text",text:" "}]}]};await r(I)}catch(E){console.error("[ice-breakers] Failed to fetch prompt:",E),ye.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=l,e[12]=r,e[13]=n,e[14]=_):_=e[14];const L=_;let y;e[15]!==L?(y=async A=>{if(A.arguments&&A.arguments.length>0){x({type:"SELECT_PROMPT",prompt:A}),v(A);return}x({type:"START_LOADING",prompt:A}),await L(A)},e[15]=L,e[16]=y):y=e[16];const w=y;let S;e[17]!==b||e[18]!==L?(S=async A=>{b&&(x({type:"START_LOADING",prompt:b,arguments:A}),v(null),await L(b,A))},e[17]=b,e[18]=L,e[19]=S):S=e[19];const k=S;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let N;e[20]!==w||e[21]!==m||e[22]!==j?(N=o.jsx(tD,{items:m,onSelect:w,loadingPrompt:j}),e[20]=w,e[21]=m,e[22]=j,e[23]=N):N=e[23];let V;e[24]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{v(null),x({type:"RESET"})},e[24]=V):V=e[24];let C;e[25]!==b||e[26]!==k?(C=o.jsx(Uh,{prompt:b,setPrompt:V,onSubmit:k}),e[25]=b,e[26]=k,e[27]=C):C=e[27];let T;return e[28]!==N||e[29]!==C?(T=o.jsxs(o.Fragment,{children:[N,C]}),e[28]=N,e[29]=C,e[30]=T):T=e[30],T}function iD(t){return{prompt:t}}function oD(t){const e=U.c(13),{className:s}=t,{selectedVirtualMcp:n}=Za(),{org:r}=Fe();let i;e[0]!==r.id?(i=ia(r.id),e[0]=r.id,e[1]=i):i=e[1];const a=i.id,l=n?.id??a;let c;e[2]!==s?(c=le("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=l??"default";let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(sD,{}),e[4]=h):h=e[4];let u;e[5]!==l?(u=o.jsx(rD,{connectionId:l}),e[5]=l,e[6]=u):u=e[6];let f;e[7]!==d||e[8]!==u?(f=o.jsx(sn,{fallback:null,children:o.jsx(P.Suspense,{fallback:h,children:u},d)}),e[7]=d,e[8]=u,e[9]=f):f=e[9];let m;return e[10]!==c||e[11]!==f?(m=o.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}const _1="cubic-bezier(0.645, 0.045, 0.355, 1)",aD=44,lD={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-warning/5 after:pointer-events-none after:-z-10"},cD={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},dD={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Qo(t){const e=U.c(69),{icon:s,label:n,count:r,title:i,footerLeft:a,footerRight:l,children:c,defaultExpanded:d,variant:h,onClose:u}=t,f=h===void 0?"default":h,m=ue(),[p,g]=P.useState(d),[x,b]=P.useState(!1);let v;e[0]!==u?(v=()=>{b(!0),u?.()},e[0]=u,e[1]=v):v=e[1];const _=v;if(x)return null;const L=cD[f],y=lD[f];let w;e[2]!==L||e[3]!==y?(w=le("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",L,y),e[2]=L,e[3]=y,e[4]=w):w=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g(uD),e[5]=S):S=e[5];const k=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let N;e[6]!==k||e[7]!==j?(N=le("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",k,j),e[6]=k,e[7]=j,e[8]=N):N=e[8];const V=dD[f];let C;e[9]!==V?(C=le("shrink-0",V),e[9]=V,e[10]=C):C=e[10];let T;e[11]!==s||e[12]!==C?(T=o.jsx("span",{className:C,children:s}),e[11]=s,e[12]=C,e[13]=T):T=e[13];let A;e[14]!==n?(A=o.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=A):A=e[15];let R;e[16]!==r?(R=r?o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:r}):null,e[16]=r,e[17]=R):R=e[17];const E=p?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==E?(I=o.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:o.jsx(ds,{size:16,style:{transform:E,transition:`transform 180ms ${_1}`}})}),e[18]=E,e[19]=I):I=e[19];let D;e[20]!==m?(D=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=D):D=e[21];let O;e[22]!==m?(O=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=O):O=e[23];let $,M;e[24]!==_?($=ce=>{ce.stopPropagation(),_()},M=ce=>{(ce.key==="Enter"||ce.key===" ")&&(ce.preventDefault(),ce.stopPropagation(),_())},e[24]=_,e[25]=$,e[26]=M):($=e[25],M=e[26]);let z;e[27]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(nn,{size:16}),e[27]=z):z=e[27];let F;e[28]!==D||e[29]!==O||e[30]!==$||e[31]!==M?(F=o.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":D,title:O,onClick:$,onKeyDown:M,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:z}),e[28]=D,e[29]=O,e[30]=$,e[31]=M,e[32]=F):F=e[32];let B;e[33]!==p||e[34]!==T||e[35]!==A||e[36]!==R||e[37]!==I||e[38]!==F||e[39]!==N?(B=o.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:S,className:N,children:[T,A,R,I,F]}),e[33]=p,e[34]=T,e[35]=A,e[36]=R,e[37]=I,e[38]=F,e[39]=N,e[40]=B):B=e[40];const H=p?"1fr":"0fr";let W;e[41]!==H?(W={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${_1}`},e[41]=H,e[42]=W):W=e[42];let K;e[43]===Symbol.for("react.memo_cache_sentinel")?(K={overflow:"hidden",minHeight:0},e[43]=K):K=e[43];const q=p?1:0;let G;e[44]!==q?(G={opacity:q,transition:`opacity 120ms ${_1}`,maxHeight:"60vh"},e[44]=q,e[45]=G):G=e[45];let te;e[46]!==i?(te=i?o.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:o.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:i})}):o.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=i,e[47]=te):te=e[47];let X;e[48]!==c||e[49]!==i?(X=c?o.jsx("div",{className:le("pb-4",!i&&"pt-4"),children:c}):null,e[48]=c,e[49]=i,e[50]=X):X=e[50];let Z;e[51]!==te||e[52]!==X?(Z=o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[te,X]}),e[51]=te,e[52]=X,e[53]=Z):Z=e[53];let ee;e[54]!==a||e[55]!==l?(ee=a||l?o.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:a}),o.jsx("div",{className:"flex items-center gap-2",children:l})]})}):null,e[54]=a,e[55]=l,e[56]=ee):ee=e[56];let se;e[57]!==G||e[58]!==Z||e[59]!==ee?(se=o.jsx("div",{style:K,children:o.jsxs("div",{className:"flex flex-col",style:G,children:[Z,ee]})}),e[57]=G,e[58]=Z,e[59]=ee,e[60]=se):se=e[60];let J;e[61]!==W||e[62]!==se?(J=o.jsx("div",{"data-testid":"collapsible-highlight-body",style:W,children:se}),e[61]=W,e[62]=se,e[63]=J):J=e[63];let oe;return e[64]!==B||e[65]!==J||e[66]!==w||e[67]!==f?(oe=o.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:w,children:[B,J]}),e[64]=B,e[65]=J,e[66]=w,e[67]=f,e[68]=oe):oe=e[68],oe}function uD(t){return!t}const hD=Rt({content:Ae().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:cr(["pending","in_progress","completed"]),activeForm:Ae().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),j7=Rt({todos:ss(hD)}),fD="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";dT({description:fD,inputSchema:uT(j7),execute:async({todos:t})=>({ok:!0,count:t.length})});const mD="tool-todo_write",pD=new Set(["input-available","output-available"]);function gD(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const n=s.parts;if(Array.isArray(n))for(let r=n.length-1;r>=0;r--){const i=n[r];if(i.type!==mD||typeof i.state!="string"||!pD.has(i.state))continue;const a=j7.safeParse(i.input);if(a.success)return a.data.todos}}return[]}function C7(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const n="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:n,friendlyName:Hh(cV(n)),input:s.input})}return e}function N7(t){return t.at(-1)}function V7(t){const e=[];for(const s of t)s.type==="tool-propose_plan"&&s.state==="input-available"&&e.push({toolCallId:s.toolCallId,plan:s.input.plan,state:s.state});return e}function xD(t){return t?t.message.startsWith("[CREDITS]"):!1}const bD="[SUBSCRIPTION_REQUIRED]";function T7(t){return t?.message.startsWith(bD)?t.message.includes("used its free task executions")?"trial_exhausted":t.message.includes("used its monthly task executions")?"monthly_exhausted":t.message.includes("reached its execution limit")?"runs_exhausted":null:null}const vD={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function yD(t){const{messages:e,error:s,finishReason:n,isStreaming:r,isWaitingForApprovals:i}=t;if(!r&&s&&xD(s))return{...vD,isCreditExhausted:!0};const a=e.at(-1),l=a?.role==="assistant"?a.parts:[],c=l,h=!!c.filter(L=>L.type==="tool-user_ask").filter(L=>L.state!=="output-available").length,u=V7(l),f=C7(c),m=gD(e),p=r?null:T7(s),g=!r&&!!s&&!p,x=f.length>0||r&&i,b=u.length>0,_=!r&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(h||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:_,hasApprovals:x,hasPlans:b,isWaitingForUserInput:h,todos:m}}function P7(){const t=U.c(6),{messages:e,error:s,finishReason:n,isStreaming:r,isWaitingForApprovals:i}=dr(),a=s??null,l=n??null;let c;return t[0]!==r||t[1]!==i||t[2]!==e||t[3]!==a||t[4]!==l?(c=yD({messages:e,error:a,finishReason:l,isStreaming:r,isWaitingForApprovals:i}),t[0]=r,t[1]=i,t[2]=e,t[3]=a,t[4]=l,t[5]=c):c=t[5],c}function _D(){const t=P7();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function A7(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(s=>s.type==="hardBreak"||s.type==="text"&&(!s.text||s.text.trim()==="")):!1)}const LD="__home__";function Vg(t,e){return Ff.chatDraft(t,e)}function wD(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const s=e.tiptapDoc;return!s||typeof s!="object"||s.type!=="doc"||!Array.isArray(s.content)?null:s}function E7(t,e,s,n,r){const i=Vg(e,s);if(A7(n)){t.removeItem(i);return}const a={tiptapDoc:n,updatedAt:Date.now()},l=JSON.stringify(a);try{t.setItem(i,l)}catch(c){if(kD(c)){const d=new TextEncoder().encode(l).byteLength;r?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function c4(t,e,s){const n=Vg(e,s),r=t.getItem(n),i=wD(r);return r!==null&&i===null&&t.removeItem(n),i}function SD(t,e,s){t.removeItem(Vg(e,s))}function kD(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function _n(t){const e=U.c(14),s=Vs(t),n=ws(),r=s?.metadata,i=n?.activeTask,a=i?.metadata?.runtime;let l;e[0]!==a?(l=vT(a),e[0]=a,e[1]=l):l=e[1];const c=l,d=!!i&&!i.partial,h=i?.metadata;let u;e[2]!==r||e[3]!==h?(u=M6(h,r),e[2]=r,e[3]=h,e[4]=u):u=e[4];const f=!!c||d&&!!s;let m;e[5]!==r?(m=Jf(r),e[5]=r,e[6]=m):m=e[6];let p;e[7]!==r?(p=F2(r),e[7]=r,e[8]=p):p=e[8];let g;return e[9]!==u||e[10]!==f||e[11]!==m||e[12]!==p?(g={runtime:u,resolved:f,projectDefault:m,previewServerUrl:p},e[9]=u,e[10]=f,e[11]=m,e[12]=p,e[13]=g):g=e[13],g}function jD(t){const e=U.c(30),{current:s,total:n,onPrev:r,onNext:i}=t,a=ue();if(n<=1)return null;const l=s===0,c=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=le("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let h;e[2]!==a?(h=a("chat.pagination.previousLabel"),e[2]=a,e[3]=h):h=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(n9,{size:14}),e[4]=u):u=e[4];let f;e[5]!==r||e[6]!==l||e[7]!==d||e[8]!==h?(f=o.jsx("button",{type:"button",onClick:r,disabled:l,className:d,"aria-label":h,children:u}),e[5]=r,e[6]=l,e[7]=d,e[8]=h,e[9]=f):f=e[9];const m=s+1;let p;e[10]!==a||e[11]!==m||e[12]!==n?(p=a("chat.pagination.counter",{current:m,total:n}),e[10]=a,e[11]=m,e[12]=n,e[13]=p):p=e[13];let g;e[14]!==p?(g=o.jsx("span",{className:"tabular-nums text-xs",children:p}),e[14]=p,e[15]=g):g=e[15];const x=s===n-1,b=s===n-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let v;e[16]!==b?(v=le("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=v):v=e[17];let _;e[18]!==a?(_=a("chat.pagination.nextLabel"),e[18]=a,e[19]=_):_=e[19];let L;e[20]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(ro,{size:14}),e[20]=L):L=e[20];let y;e[21]!==i||e[22]!==x||e[23]!==v||e[24]!==_?(y=o.jsx("button",{type:"button",onClick:i,disabled:x,className:v,"aria-label":_,children:L}),e[21]=i,e[22]=x,e[23]=v,e[24]=_,e[25]=y):y=e[25];let w;return e[26]!==y||e[27]!==f||e[28]!==g?(w=o.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[f,g,y]}),e[26]=y,e[27]=f,e[28]=g,e[29]=w):w=e[29],w}function R7(t){const e=U.c(8),{currentIndex:s,total:n,onPrev:r,onNext:i,extraLeft:a}=t;let l;e[0]!==s||e[1]!==i||e[2]!==r||e[3]!==n?(l=o.jsx(jD,{current:s,total:n,onPrev:r,onNext:i}),e[0]=s,e[1]=i,e[2]=r,e[3]=n,e[4]=l):l=e[4];let c;return e[5]!==a||e[6]!==l?(c=o.jsxs("div",{className:"flex items-center gap-2",children:[l,a]}),e[5]=a,e[6]=l,e[7]=c):c=e[7],c}function CD(t){const e=U.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:r,onAdvanceOrSubmit:i,submitLabel:a,nextLabel:l}=t,h=n?a===void 0?"Submit":a:l===void 0?"Next":l,u=n?s:!r,f=u?n?"Waiting for the assistant to finish…":"Answer this item to continue":null;let m;e[0]!==u||e[1]!==i?(m=()=>{u||i()},e[0]=u,e[1]=i,e[2]=m):m=e[2];const p=u&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=le("h-7 px-2.5 text-xs",p),e[3]=p,e[4]=g):g=e[4];let x;e[5]!==u||e[6]!==h||e[7]!==m||e[8]!==g?(x=o.jsx(me,{type:"button",size:"sm","aria-disabled":u,onClick:m,className:g,children:h}),e[5]=u,e[6]=h,e[7]=m,e[8]=g,e[9]=x):x=e[9];const b=x;if(!f)return b;let v;e[10]!==b?(v=o.jsx(Ke,{asChild:!0,children:b}),e[10]=b,e[11]=v):v=e[11];let _;e[12]!==f?(_=o.jsx(We,{children:f}),e[12]=f,e[13]=_):_=e[13];let L;return e[14]!==v||e[15]!==_?(L=o.jsxs(qe,{children:[v,_]}),e[14]=v,e[15]=_,e[16]=L):L=e[16],L}function D7(t,e,s){return t.findIndex(n=>e(n)===s)}function d4(t,e,s,n){return t.length===0?!1:t.every(r=>n(s[e(r)]))}function u4(t,e,s,n,r){if(t.length===0)return null;const i=D7(t,e,r);for(let a=1;a<=t.length;a++){const l=t[(i+a)%t.length];if(!l)continue;const c=e(l);if(c!==r&&!n(s[c]))return c}return null}function ND(t){return!t.isStreaming&&t.allAnswered}function M7(t){const{parts:e,partKey:s,schema:n,defaultValues:r,isStreaming:i,hasAnswer:a,onSubmit:l}=t,c=e[0]?s(e[0]):"",[d,h]=P.useState(c),[u,f]=P.useState(!1),m=j2({resolver:Zy(n),defaultValues:r}),p=m.watch(),g=D7(e,s,d),x=g>=0?e[g]:void 0,b=a(p[d]),v=d4(e,s,p,a),_=ND({isStreaming:i,allAnswered:v}),L=()=>{if(g>0){const V=e[g-1];V&&h(s(V))}},y=()=>{if(g>=0&&g<e.length-1){const V=e[g+1];V&&h(s(V))}},w=()=>{const V=m.getValues(),C=u4(e,s,V,a,d);C&&h(C)},S=()=>{m.handleSubmit(V=>{const C=V;for(const T of e)l(T,C[s(T)])})()},k=P.useRef(S);k.current=S;const j=()=>{_&&(f(!1),k.current())},N=()=>{const V=m.getValues();if(d4(e,s,V,a)){if(i){f(!0);return}f(!1),k.current()}else{const C=u4(e,s,V,a,d);C&&h(C)}};return P.useEffect(()=>{if(u&&!i){if(!v){f(!1);return}f(!1),k.current()}},[u,i,v]),{form:m,activeKey:d,setActiveKey:h,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:v,canSubmit:_,goPrev:L,goNext:y,advanceToNextUnanswered:w,submit:j,submitOrAdvance:N}}const I7="chat.approval.defaultDenyReason";function O7(t){const e=U.c(36),{onYolo:s}=t,n=ue(),[r,i]=no();let a,l,c,d,h,u,f,m,p;if(e[0]!==s||e[1]!==r||e[2]!==i||e[3]!==n){const L=ka.find(S=>S.value===r.toolApprovalLevel)??ka[0];let y;e[13]!==s||e[14]!==r||e[15]!==i?(y=S=>{const k=S,j=r.toolApprovalLevel??"readonly";i({...r,toolApprovalLevel:k}),k==="auto"&&s(j)},e[13]=s,e[14]=r,e[15]=i,e[16]=y):y=e[16];const w=y;c=xs,m=r.toolApprovalLevel,p=w,l=bs,h="xs",u="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",f=VD,a=js,d=n(L.shortKey),e[0]=s,e[1]=r,e[2]=i,e[3]=n,e[4]=a,e[5]=l,e[6]=c,e[7]=d,e[8]=h,e[9]=u,e[10]=f,e[11]=m,e[12]=p}else a=e[4],l=e[5],c=e[6],d=e[7],h=e[8],u=e[9],f=e[10],m=e[11],p=e[12];let g;e[17]!==a||e[18]!==d?(g=o.jsx(a,{children:d}),e[17]=a,e[18]=d,e[19]=g):g=e[19];let x;e[20]!==l||e[21]!==h||e[22]!==u||e[23]!==f||e[24]!==g?(x=o.jsx(l,{size:h,className:u,onClick:f,children:g}),e[20]=l,e[21]=h,e[22]=u,e[23]=f,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==n?(b=ka.map(L=>o.jsx(It,{value:L.value,children:n(L.labelKey)},L.value)),e[26]=n,e[27]=b):b=e[27];let v;e[28]!==b?(v=o.jsx(vs,{children:b}),e[28]=b,e[29]=v):v=e[29];let _;return e[30]!==c||e[31]!==v||e[32]!==m||e[33]!==p||e[34]!==x?(_=o.jsxs(c,{value:m,onValueChange:p,children:[x,v]}),e[30]=c,e[31]=v,e[32]=m,e[33]=p,e[34]=x,e[35]=_):_=e[35],_}function VD(t){return t.stopPropagation()}function $7(t){const e=U.c(8),{input:s}=t,n=ue();if(s==null){let a;e[0]!==n?(a=n("chat.approval.noInput"),e[0]=n,e[1]=a):a=e[1];let l;return e[2]!==a?(l=o.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:a}),e[2]=a,e[3]=l):l=e[3],l}let r;try{let a;e[4]!==s?(a=JSON.stringify(s,null,2),e[4]=s,e[5]=a):a=e[5],r=a}catch{r=String(s)}let i;return e[6]!==r?(i=o.jsx("div",{className:"px-4",children:o.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:r})}),e[6]=r,e[7]=i):i=e[7],i}function TD(t){const e=U.c(38),{approval:s,onRespond:n}=t,r=ue(),[i]=no(),a=i.toolApprovalLevel??"readonly";let l;e[0]!==s.approvalId||e[1]!==a||e[2]!==n||e[3]!==r?(l=()=>n(s.approvalId,!1,r(I7),a),e[0]=s.approvalId,e[1]=a,e[2]=n,e[3]=r,e[4]=l):l=e[4];const c=l;let d;e[5]!==s.approvalId||e[6]!==a||e[7]!==n?(d=()=>n(s.approvalId,!0,void 0,a),e[5]=s.approvalId,e[6]=a,e[7]=n,e[8]=d):d=e[8];const h=d;let u;e[9]!==s.approvalId||e[10]!==n?(u=j=>n(s.approvalId,!0,void 0,j),e[9]=s.approvalId,e[10]=n,e[11]=u):u=e[11];const f=u;let m;e[12]!==f?(m=o.jsx("div",{className:"flex items-center gap-2",children:o.jsx(O7,{onYolo:f})}),e[12]=f,e[13]=m):m=e[13];const p=m;let g;e[14]!==r?(g=r("chat.approval.denyButton"),e[14]=r,e[15]=g):g=e[15];let x;e[16]!==c||e[17]!==g?(x=o.jsx(me,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:g}),e[16]=c,e[17]=g,e[18]=x):x=e[18];let b;e[19]!==r?(b=r("chat.approval.acceptButton"),e[19]=r,e[20]=b):b=e[20];let v;e[21]!==h||e[22]!==b?(v=o.jsx(me,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:h,children:b}),e[21]=h,e[22]=b,e[23]=v):v=e[23];let _;e[24]!==x||e[25]!==v?(_=o.jsxs(o.Fragment,{children:[x,v]}),e[24]=x,e[25]=v,e[26]=_):_=e[26];const L=_;let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Zf,{size:14}),e[27]=y):y=e[27];let w;e[28]!==r?(w=r("chat.approval.needsApproval"),e[28]=r,e[29]=w):w=e[29];let S;e[30]!==s.input?(S=o.jsx($7,{input:s.input}),e[30]=s.input,e[31]=S):S=e[31];let k;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==L||e[35]!==w||e[36]!==S?(k=o.jsx(Qo,{icon:y,label:w,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:L,children:S}),e[32]=s.friendlyName,e[33]=p,e[34]=L,e[35]=w,e[36]=S,e[37]=k):k=e[37],k}const PD=yu(Ae(),Rt({approved:ci().optional(),levelOverride:cr(["auto","readonly"]).optional()}));function AD(t){const e=U.c(46),{approvals:s,isStreaming:n,onRespond:r}=t,i=ue(),[a]=no(),l=a.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(DD)),e[0]=s,e[1]=c):c=e[1];const d=c;let h;e[2]!==l||e[3]!==r||e[4]!==i?(h=(C,T)=>{const A=T;typeof A?.approved=="boolean"&&r(C.approvalId,A.approved,A.approved===!1?i(I7):void 0,A.levelOverride??l)},e[2]=l,e[3]=r,e[4]=i,e[5]=h):h=e[5];let u;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==h?(u={parts:s,partKey:RD,schema:PD,defaultValues:d,isStreaming:n,hasAnswer:ED,onSubmit:h},e[6]=s,e[7]=d,e[8]=n,e[9]=h,e[10]=u):u=e[10];const f=M7(u);let m;e[11]!==s||e[12]!==f?(m=C=>{f.form.reset(Object.fromEntries(s.map(T=>[T.approvalId,{approved:!0,levelOverride:C}]))),f.submitOrAdvance()},e[11]=s,e[12]=f,e[13]=m):m=e[13];const p=m,g=f.currentPart,x=f.form;let b;e[14]!==f?(b=C=>{C.preventDefault(),f.submit()},e[14]=f,e[15]=b):b=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(Zf,{size:14}),e[16]=v):v=e[16];let _;e[17]!==s.length||e[18]!==i?(_=i("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=i,e[19]=_):_=e[19];const L=g?.friendlyName??"";let y;e[20]!==p?(y=o.jsx(O7,{onYolo:p}),e[20]=p,e[21]=y):y=e[21];let w;e[22]!==s.length||e[23]!==f.currentIndex||e[24]!==f.goNext||e[25]!==f.goPrev||e[26]!==y?(w=o.jsx(R7,{currentIndex:f.currentIndex,total:s.length,onPrev:f.goPrev,onNext:f.goNext,extraLeft:y}),e[22]=s.length,e[23]=f.currentIndex,e[24]=f.goNext,e[25]=f.goPrev,e[26]=y,e[27]=w):w=e[27];let S;e[28]!==g||e[29]!==f.form.control||e[30]!==f.submitOrAdvance?(S=g?o.jsx(MD,{approvalId:g.approvalId,control:f.form.control,onChange:f.submitOrAdvance}):null,e[28]=g,e[29]=f.form.control,e[30]=f.submitOrAdvance,e[31]=S):S=e[31];let k;e[32]!==g?(k=g?o.jsx($7,{input:g.input}):null,e[32]=g,e[33]=k):k=e[33];let j;e[34]!==w||e[35]!==S||e[36]!==k||e[37]!==_||e[38]!==L?(j=o.jsx(Qo,{icon:v,label:_,title:L,defaultExpanded:!0,footerLeft:w,footerRight:S,children:k}),e[34]=w,e[35]=S,e[36]=k,e[37]=_,e[38]=L,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==b?(N=o.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=N):N=e[42];let V;return e[43]!==f.form||e[44]!==N?(V=o.jsx(Im,{...x,children:N}),e[43]=f.form,e[44]=N,e[45]=V):V=e[45],V}function ED(t){return typeof t?.approved=="boolean"}function RD(t){return t.approvalId}function DD(t){return[t.approvalId,{approved:void 0}]}function MD(t){const e=U.c(7),{approvalId:s,control:n,onChange:r}=t,i=ue(),a=`${s}.approved`;let l;e[0]!==r||e[1]!==i?(l=d=>{const{field:h}=d,u=h.value===!0,f=h.value===!1;return o.jsxs(o.Fragment,{children:[o.jsx(me,{type:"button",variant:f?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{h.onChange(!1),r()},"aria-pressed":f,children:i("chat.approval.denyButton")}),o.jsx(me,{type:"button",variant:u?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{h.onChange(!0),r()},"aria-pressed":u,children:i("chat.approval.acceptButton")})]})},e[0]=r,e[1]=i,e[2]=l):l=e[2];let c;return e[3]!==n||e[4]!==a||e[5]!==l?(c=o.jsx(ps,{control:n,name:a,render:l}),e[3]=n,e[4]=a,e[5]=l,e[6]=c):c=e[6],c}function ID(){const t=U.c(5),e=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Zf,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.approval.preparingRequest"),t[1]=e,t[2]=n):n=t[2];let r;return t[3]!==n?(r=o.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,o.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=r):r=t[4],r}function OD(t){const e=U.c(8),{approvals:s,isStreaming:n,onRespond:r}=t;if(n&&s.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(ID,{}),e[0]=a):a=e[0],a}if(s.length===0)return null;if(s.length===1){const a=s[0];if(!a)return null;let l;return e[1]!==r||e[2]!==a?(l=o.jsx(TD,{approval:a,onRespond:r}),e[1]=r,e[2]=a,e[3]=l):l=e[3],l}let i;return e[4]!==s||e[5]!==n||e[6]!==r?(i=o.jsx(AD,{approvals:s,isStreaming:n,onRespond:r}),e[4]=s,e[5]=n,e[6]=r,e[7]=i):i=e[7],i}function $D(t){const e=U.c(28),{plan:s,onApprove:n,onDismiss:r}=t,i=ue();let a;e[0]!==n||e[1]!==s.plan?(a=()=>{n(s.plan)},e[0]=n,e[1]=s.plan,e[2]=a):a=e[2];const l=a;let c;e[3]!==i?(c=i("chat.proposePlan.keepIterating"),e[3]=i,e[4]=c):c=e[4];let d;e[5]!==r||e[6]!==c?(d=o.jsx(me,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:r,children:c}),e[5]=r,e[6]=c,e[7]=d):d=e[7];let h;e[8]!==i?(h=i("chat.proposePlan.letsGo"),e[8]=i,e[9]=h):h=e[9];let u;e[10]!==l||e[11]!==h?(u=o.jsx(me,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:l,children:h}),e[10]=l,e[11]=h,e[12]=u):u=e[12];let f;e[13]!==d||e[14]!==u?(f=o.jsxs(o.Fragment,{children:[d,u]}),e[13]=d,e[14]=u,e[15]=f):f=e[15];const m=f;let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(I6,{size:14}),e[16]=p):p=e[16];let g;e[17]!==i?(g=i("chat.proposePlan.planReady"),e[17]=i,e[18]=g):g=e[18];let x;e[19]!==i?(x=i("chat.proposePlan.implementationPlan"),e[19]=i,e[20]=x):x=e[20];let b;e[21]!==s.plan?(b=o.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:o.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:o.jsx(dV,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=b):b=e[22];let v;return e[23]!==m||e[24]!==b||e[25]!==g||e[26]!==x?(v=o.jsx(Qo,{icon:p,label:g,title:x,defaultExpanded:!0,footerRight:m,children:b}),e[23]=m,e[24]=b,e[25]=g,e[26]=x,e[27]=v):v=e[27],v}function BD(t){const e=U.c(6),{plans:s,onApprove:n,onDismiss:r}=t;let i;e[0]!==s?(i=N7(s),e[0]=s,e[1]=i):i=e[1];const a=i;if(!a)return null;let l;return e[2]!==a||e[3]!==n||e[4]!==r?(l=o.jsx($D,{plan:a,onApprove:n,onDismiss:r}),e[2]=a,e[3]=n,e[4]=r,e[5]=l):l=e[5],l}function B7(t){return t?"response"in t?t.response:t.option??t.draft:""}const h4=Rt({response:Ae().min(1,"Response is required")}),zD=Rt({option:Ae().nullable(),draft:Ae()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),FD=Rt({response:cr(["yes","no"])});function UD(t){switch(t.type){case"text":return h4;case"choice":return zD;case"confirm":return FD;default:return h4}}function HD(t){const e={};for(const s of t)e[s.toolCallId]=UD(s.input);return Rt(e)}function KD(t){const e=U.c(7),{control:s,name:n,placeholder:r}=t,i=ue();let a;e[0]!==r||e[1]!==i?(a=c=>{const{field:d}=c,h=d.value??"";return o.jsxs(J2,{children:[o.jsx(Z2,{children:o.jsx("div",{className:"px-2",children:o.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[o.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:o.jsx(U2,{size:16,className:"text-muted-foreground"})}),o.jsx("input",{...d,value:h,type:"text",placeholder:r||i("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":i("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),o.jsx(eg,{})]})},e[0]=r,e[1]=i,e[2]=a):a=e[2];let l;return e[3]!==s||e[4]!==n||e[5]!==a?(l=o.jsx(n8,{control:s,name:n,render:a}),e[3]=s,e[4]=n,e[5]=a,e[6]=l):l=e[6],l}function z7(t,e){const s=U.c(4);let n,r;s[0]!==t||s[1]!==e?(n=()=>{const i=a=>{const l=a.target.tagName;if(l==="INPUT"||l==="TEXTAREA"||a.metaKey||a.ctrlKey||a.altKey)return;const c=Number.parseInt(a.key,10);c>=1&&c<=t&&(a.preventDefault(),e(c-1))};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},r=[t,e],s[0]=t,s[1]=e,s[2]=n,s[3]=r):(n=s[2],r=s[3]),P.useEffect(n,r)}function WD(t){const e=U.c(51),{control:s,name:n,options:r}=t,i=ue(),a=`${n}.option`;let l;e[0]!==s||e[1]!==a?(l={control:s,name:a,defaultValue:null},e[0]=s,e[1]=a,e[2]=l):l=e[2];const{field:c}=Dx(l),d=`${n}.draft`;let h;e[3]!==s||e[4]!==d?(h={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=h):h=e[5];const{field:u}=Dx(h),f=c.value,m=u.value??"";let p;if(e[6]!==c||e[7]!==r?(p=E=>{const I=r[E];I!=null&&c.onChange(I)},e[6]=c,e[7]=r,e[8]=p):p=e[8],z7(r.length,p),r.length===0)return null;const g=f===null;let x;e[9]!==i?(x=i("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=i,e[10]=x):x=e[10];let b;if(e[11]!==c||e[12]!==f||e[13]!==r||e[14]!==i){let E;e[16]!==c||e[17]!==f||e[18]!==i?(E=(I,D)=>{const O=f===I;return o.jsxs("button",{type:"button",onClick:()=>c.onChange(I),className:le("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",O&&"bg-accent/50",!O&&"hover:bg-accent/30"),"aria-label":i("chat.userAskQuestion.selectOption",{option:I}),children:[o.jsx("span",{className:le("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",O?"bg-chart-1 text-white":"bg-muted text-foreground"),children:D+1}),o.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:I})]},`${D}-${I}`)},e[16]=c,e[17]=f,e[18]=i,e[19]=E):E=e[19],b=r.map(E),e[11]=c,e[12]=f,e[13]=r,e[14]=i,e[15]=b}else b=e[15];const v=g&&"bg-accent/50",_=!g&&"hover:bg-accent/30";let L;e[20]!==v||e[21]!==_?(L=le("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",v,_),e[20]=v,e[21]=_,e[22]=L):L=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:o.jsx(U2,{size:16,className:"text-muted-foreground"})}),e[23]=y):y=e[23];const w=g?m:"";let S;e[24]!==u||e[25]!==c||e[26]!==f?(S=E=>{u.onChange(E.target.value),f!==null&&c.onChange(null)},e[24]=u,e[25]=c,e[26]=f,e[27]=S):S=e[27];let k;e[28]!==c||e[29]!==f?(k=()=>{f!==null&&c.onChange(null)},e[28]=c,e[29]=f,e[30]=k):k=e[30];let j;e[31]!==i?(j=i("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=i,e[32]=j):j=e[32];let N;e[33]!==i?(N=i("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=i,e[34]=N):N=e[34];let V;e[35]!==w||e[36]!==S||e[37]!==k||e[38]!==j||e[39]!==N?(V=o.jsx("input",{type:"text",value:w,onChange:S,onFocus:k,placeholder:j,"aria-label":N,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=w,e[36]=S,e[37]=k,e[38]=j,e[39]=N,e[40]=V):V=e[40];let C;e[41]!==L||e[42]!==V?(C=o.jsxs("label",{className:L,children:[y,V]}),e[41]=L,e[42]=V,e[43]=C):C=e[43];let T;e[44]!==C||e[45]!==x||e[46]!==b?(T=o.jsx(Z2,{children:o.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,C]})}),e[44]=C,e[45]=x,e[46]=b,e[47]=T):T=e[47];let A;e[48]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(eg,{}),e[48]=A):A=e[48];let R;return e[49]!==T?(R=o.jsxs(J2,{children:[T,A]}),e[49]=T,e[50]=R):R=e[50],R}function qD(t){const e=U.c(8),{control:s,name:n}=t,r=ue();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["yes","no"],e[0]=i):i=e[0];const a=i,l=P.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u=>{l.current?.onChange(a[u]??"")},e[1]=c):c=e[1],z7(a.length,c);let d;e[2]!==r?(d=u=>{const{field:f}=u;return l.current=f,o.jsxs(J2,{children:[o.jsx(Z2,{children:o.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":r("chat.userAskQuestion.confirmationOptionsAriaLabel"),children:a.map(m=>{const p=f.value===m;return o.jsxs("button",{type:"button",onClick:()=>f.onChange(m),className:le("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",p&&"bg-accent/50",!p&&"hover:bg-accent/30"),"aria-label":r("chat.userAskQuestion.confirmValue",{value:r(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)}),children:[o.jsx("span",{className:le("flex items-center justify-center size-6 rounded-md text-sm shrink-0",p?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),o.jsx("span",{className:"text-sm text-foreground capitalize",children:r(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)})]},m)})})}),o.jsx(eg,{})]})},e[2]=r,e[3]=d):d=e[3];let h;return e[4]!==s||e[5]!==n||e[6]!==d?(h=o.jsx(n8,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=h):h=e[7],h}function f4(t){const e=U.c(13),{input:s,control:n,toolCallId:r}=t;switch(s.type){case"text":{const i=`${r}.response`;let a;return e[0]!==n||e[1]!==s.default||e[2]!==i?(a=o.jsx(KD,{control:n,name:i,placeholder:s.default}),e[0]=n,e[1]=s.default,e[2]=i,e[3]=a):a=e[3],a}case"choice":{let i;e[4]!==s.options?(i=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=i):i=e[5];const a=i;let l;return e[6]!==n||e[7]!==a||e[8]!==r?(l=o.jsx(WD,{control:n,name:r,options:a}),e[6]=n,e[7]=a,e[8]=r,e[9]=l):l=e[9],l}case"confirm":{const i=`${r}.response`;let a;return e[10]!==n||e[11]!==i?(a=o.jsx(qD,{control:n,name:i}),e[10]=n,e[11]=i,e[12]=a):a=e[12],a}default:return null}}function GD(t){const e=U.c(91),{parts:s,isStreaming:n,onSubmit:r}=t;let i;e[0]!==s?(i=HD(s.map(JD)),e[0]=s,e[1]=i):i=e[1];const a=i;let l;e[2]!==s?(l=Object.fromEntries(s.map(XD)),e[2]=s,e[3]=l):l=e[3];const c=l;let d;e[4]!==r?(d=(M,z)=>{const F=B7(z);F&&r(M,F)},e[4]=r,e[5]=d):d=e[5];let h;e[6]!==c||e[7]!==n||e[8]!==s||e[9]!==a||e[10]!==d?(h={parts:s,partKey:QD,schema:a,defaultValues:c,isStreaming:n,hasAnswer:YD,onSubmit:d},e[6]=c,e[7]=n,e[8]=s,e[9]=a,e[10]=d,e[11]=h):h=e[11];const u=M7(h),f=u.currentPart,m=ue();let p;e[12]!==f||e[13]!==u||e[14]!==m?(p=()=>{const M=f;if(!M)return;const z=m("chat.userAskQuestion.skipMessage"),F=M.toolCallId;M.input?.type==="choice"?(u.form.setValue(`${F}.option`,null),u.form.setValue(`${F}.draft`,z)):u.form.setValue(`${F}.response`,z),u.advanceToNextUnanswered()},e[12]=f,e[13]=u,e[14]=m,e[15]=p):p=e[15];const g=p;let x;e[16]!==u.currentIndex||e[17]!==u.goNext||e[18]!==u.goPrev||e[19]!==s.length?(x=o.jsx(R7,{currentIndex:u.currentIndex,total:s.length,onPrev:u.goPrev,onNext:u.goNext}),e[16]=u.currentIndex,e[17]=u.goNext,e[18]=u.goPrev,e[19]=s.length,e[20]=x):x=e[20];const b=x;let v;e[21]!==m?(v=m("chat.userAskQuestion.skip"),e[21]=m,e[22]=v):v=e[22];let _;e[23]!==g||e[24]!==v?(_=o.jsx(me,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:v}),e[23]=g,e[24]=v,e[25]=_):_=e[25];let L;e[26]!==u.isAllAnswered||e[27]!==u.isCurrentAnswered||e[28]!==u.submitOrAdvance||e[29]!==n?(L=o.jsx(CD,{isStreaming:n,isAllAnswered:u.isAllAnswered,isCurrentAnswered:u.isCurrentAnswered,onAdvanceOrSubmit:u.submitOrAdvance}),e[26]=u.isAllAnswered,e[27]=u.isCurrentAnswered,e[28]=u.submitOrAdvance,e[29]=n,e[30]=L):L=e[30];let y;e[31]!==_||e[32]!==L?(y=o.jsxs(o.Fragment,{children:[_,L]}),e[31]=_,e[32]=L,e[33]=y):y=e[33];const w=y;if(s.length===1){const M=s[0];if(!M?.input)return null;const z=u.form;let F;e[34]!==u?(F=Z=>{Z.preventDefault(),u.submit()},e[34]=u,e[35]=F):F=e[35];let B;e[36]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(Om,{size:14}),e[36]=B):B=e[36];let H;e[37]!==m?(H=m("chat.userAskQuestion.questionPending"),e[37]=m,e[38]=H):H=e[38];let W;e[39]!==M.input?.prompt||e[40]!==m?(W=M.input?.prompt??m("chat.userAskQuestion.question"),e[39]=M.input?.prompt,e[40]=m,e[41]=W):W=e[41];const K=M.input;let q;e[42]!==u.form.control||e[43]!==M.toolCallId||e[44]!==K?(q=o.jsx(f4,{input:K,control:u.form.control,toolCallId:M.toolCallId}),e[42]=u.form.control,e[43]=M.toolCallId,e[44]=K,e[45]=q):q=e[45];let G;e[46]!==w||e[47]!==H||e[48]!==W||e[49]!==q?(G=o.jsx(Qo,{icon:B,label:H,title:W,defaultExpanded:!0,footerRight:w,children:q}),e[46]=w,e[47]=H,e[48]=W,e[49]=q,e[50]=G):G=e[50];let te;e[51]!==F||e[52]!==G?(te=o.jsx("form",{onSubmit:F,autoComplete:"off",children:G}),e[51]=F,e[52]=G,e[53]=te):te=e[53];let X;return e[54]!==u.form||e[55]!==te?(X=o.jsx(Im,{...z,children:te}),e[54]=u.form,e[55]=te,e[56]=X):X=e[56],X}const S=u.form;let k;e[57]!==u?(k=M=>{M.preventDefault(),u.submit()},e[57]=u,e[58]=k):k=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(Om,{size:14}),e[59]=j):j=e[59];let N;e[60]!==m?(N=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=N):N=e[61];const V=u.currentIndex+1;let C;e[62]!==s.length||e[63]!==m||e[64]!==V?(C=m("chat.userAskQuestion.questionCount",{current:V,total:s.length}),e[62]=s.length,e[63]=m,e[64]=V,e[65]=C):C=e[65];let T;e[66]!==f?.input?.prompt||e[67]!==m?(T=f?.input?.prompt??m("chat.userAskQuestion.question"),e[66]=f?.input?.prompt,e[67]=m,e[68]=T):T=e[68];const A=u.activeKey,R=u.setActiveKey;let E;if(e[69]!==u.form||e[70]!==s){let M;e[72]!==u.form?(M=z=>o.jsx(Aa,{value:z.toolCallId,className:"mt-0",children:o.jsx(f4,{input:z.input,control:u.form.control,toolCallId:z.toolCallId})},z.toolCallId),e[72]=u.form,e[73]=M):M=e[73],E=s.map(M),e[69]=u.form,e[70]=s,e[71]=E}else E=e[71];let I;e[74]!==u.activeKey||e[75]!==u.setActiveKey||e[76]!==E?(I=o.jsx(nl,{value:A,onValueChange:R,children:E}),e[74]=u.activeKey,e[75]=u.setActiveKey,e[76]=E,e[77]=I):I=e[77];let D;e[78]!==b||e[79]!==w||e[80]!==N||e[81]!==C||e[82]!==T||e[83]!==I?(D=o.jsx(Qo,{icon:j,label:N,count:C,title:T,defaultExpanded:!0,footerLeft:b,footerRight:w,children:I}),e[78]=b,e[79]=w,e[80]=N,e[81]=C,e[82]=T,e[83]=I,e[84]=D):D=e[84];let O;e[85]!==k||e[86]!==D?(O=o.jsx("form",{onSubmit:k,autoComplete:"off",children:D}),e[85]=k,e[86]=D,e[87]=O):O=e[87];let $;return e[88]!==u.form||e[89]!==O?($=o.jsx(Im,{...S,children:O}),e[88]=u.form,e[89]=O,e[90]=$):$=e[90],$}function YD(t){return!!B7(t)}function QD(t){return t.toolCallId}function XD(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function JD(t){return{toolCallId:t.toolCallId,input:t.input}}function ZD(){const t=U.c(5),e=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Om,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.userAskQuestion.preparingQuestion"),t[1]=e,t[2]=n):n=t[2];let r;return t[3]!==n?(r=o.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,o.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=r):r=t[4],r}function F7(t){const e=U.c(7),{userAskParts:s,isStreaming:n,onSubmit:r}=t;let i;e[0]!==s?(i=s.filter(eM),e[0]=s,e[1]=i):i=e[1];const a=i;if(a.length===0){if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(ZD,{}),e[2]=c):c=e[2],c}return null}let l;return e[3]!==n||e[4]!==r||e[5]!==a?(l=o.jsx(GD,{parts:a,isStreaming:n,onSubmit:r}),e[3]=n,e[4]=r,e[5]=a,e[6]=l):l=e[6],l}function eM(t){return t.state==="input-available"}function tM(t){const e=t.filter(i=>i.status==="in_progress"),s=t.filter(i=>i.status==="completed").length,n=t.length;if(n>0&&s===n)return{icon:"completed",activity:"All done",progress:`${n}/${n}`};const[r]=e;return r&&e.length===1?{icon:"in_progress",activity:r.activeForm,progress:`${s}/${n} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${n} done`}:s>0?{icon:"pending",activity:`${n-s} pending`,progress:`${s}/${n} done`}:{icon:"pending",activity:`${n} todos`,progress:"not started"}}function sM(t){const e=U.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=tM(s),e[0]=s,e[1]=n):n=e[1];const r=n;let i;e[2]!==r.icon?(i=o.jsx(oM,{status:r.icon}),e[2]=r.icon,e[3]=i):i=e[3];const a=r.activity,l=r.progress;let c;e[4]!==s?(c=s.map(nM),e[4]=s,e[5]=c):c=e[5];let d;e[6]!==c?(d=o.jsx("ul",{"data-testid":"todos-list",className:"flex flex-col px-2 max-h-[40vh] overflow-y-auto",children:c}),e[6]=c,e[7]=d):d=e[7];let h;return e[8]!==r.activity||e[9]!==r.progress||e[10]!==i||e[11]!==d?(h=o.jsx(Qo,{icon:i,label:a,count:l,defaultExpanded:!1,children:d}),e[8]=r.activity,e[9]=r.progress,e[10]=i,e[11]=d,e[12]=h):h=e[12],h}function nM(t,e){return o.jsx(rM,{todo:t},e)}function rM(t){const e=U.c(14),{todo:s}=t,n=s.status==="completed",i=s.status==="in_progress"?s.activeForm:s.content;let a;e[0]!==s.status?(a=o.jsx(iM,{status:s.status}),e[0]=s.status,e[1]=a):a=e[1];const l=n&&"text-muted-foreground";let c;e[2]!==l?(c=le("relative text-sm leading-snug pt-px select-none",l),e[2]=l,e[3]=c):c=e[3];const d=n?"100%":"0%",h=n?"width 300ms ease 200ms":"width 150ms ease";let u;e[4]!==d||e[5]!==h?(u=o.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:h}}),e[4]=d,e[5]=h,e[6]=u):u=e[6];let f;e[7]!==i||e[8]!==c||e[9]!==u?(f=o.jsxs("span",{className:c,children:[i,u]}),e[7]=i,e[8]=c,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==a||e[12]!==f?(m=o.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[a,f]}),e[11]=a,e[12]=f,e[13]=m):m=e[13],m}function iM(t){const e=U.c(4),{status:s}=t,n=s==="completed"?"true":void 0,r=s==="in_progress"?"true":void 0;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("svg",{viewBox:"0 0 21 21",children:o.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=i):i=e[0];let a;return e[1]!==n||e[2]!==r?(a=o.jsx("div",{className:"todo-cb mt-0.5","data-checked":n,"data-progress":r,"aria-hidden":"true",children:i}),e[1]=n,e[2]=r,e[3]=a):a=e[3],a}function oM(t){const e=U.c(13),{status:s}=t,n=ue();if(s==="completed"){let a;e[0]!==n?(a=n("chat.todoStatus.completed"),e[0]=n,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:o.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=l):l=e[2];let c;return e[3]!==a?(c=o.jsx("span",{"aria-label":a,className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:l}),e[3]=a,e[4]=c):c=e[4],c}if(s==="in_progress"){let a;e[5]!==n?(a=n("chat.todoStatus.inProgress"),e[5]=n,e[6]=a):a=e[6];let l;return e[7]!==a?(l=o.jsx("span",{"aria-label":a,className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[7]=a,e[8]=l):l=e[8],l}let r;e[9]!==n?(r=n("chat.todoStatus.pending"),e[9]=n,e[10]=r):r=e[10];let i;return e[11]!==r?(i=o.jsx("span",{"aria-label":r,className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[11]=r,e[12]=i):i=e[12],i}const aM={usd:[{dollars:10,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:20,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}],brl:[{dollars:50,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:500,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}]},lM=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function U7(t){const e=U.c(65),{onDismiss:s}=t,{org:n}=Fe(),r=on(),{decoKeyId:i}=sg(),a=Ls(),l=ue(),[c,d]=P.useState(""),[h,u]=P.useState(!1),[f,m]=P.useState("usd"),p=f==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{Ye("credits_exhausted_shown",{organization_id:n.id})},x=[n.id],e[0]=n.id,e[1]=g,e[2]=x):(g=e[1],x=e[2]),P.useEffect(g,x);let b;e[3]!==f||e[4]!==a?(b=async K=>{const{url:q}=await a.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:K,currency:f});return q},e[3]=f,e[4]=a,e[5]=b):b=e[5];let v;e[6]!==s?(v=K=>{K&&window.open(K,"_blank","noopener,noreferrer"),s?.()},e[6]=s,e[7]=v):v=e[7];let _;e[8]!==l?(_=K=>{ye.error(l("chat.creditsExhaustedBanner.topupError",{error:K.message}))},e[8]=l,e[9]=_):_=e[9];let L;e[10]!==b||e[11]!==v||e[12]!==_?(L={mutationFn:b,onSuccess:v,onError:_},e[10]=b,e[11]=v,e[12]=_,e[13]=L):L=e[13];const{mutate:y,isPending:w}=Rs(L),S=parseFloat(c),k=!isNaN(S)&&S>=1;let j;e[14]!==s?(j=K=>!K&&s?.(),e[14]=s,e[15]=j):j=e[15];let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[16]=N):N=e[16];let V;e[17]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:N.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=V):V=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[18]=C):C=e[18];let T;e[19]!==l?(T=l("chat.creditsExhaustedBanner.title"),e[19]=l,e[20]=T):T=e[20];let A;e[21]!==T?(A=o.jsx(qt,{className:"text-xl font-semibold tracking-tight",children:T}),e[21]=T,e[22]=A):A=e[22];let R;e[23]!==l?(R=l("chat.creditsExhaustedBanner.description"),e[23]=l,e[24]=R):R=e[24];let E;e[25]!==R?(E=o.jsx(In,{className:"mt-1.5 text-sm leading-relaxed",children:R}),e[25]=R,e[26]=E):E=e[26];let I;e[27]!==A||e[28]!==E?(I=o.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[V,o.jsxs(ls,{className:"relative gap-4",children:[C,o.jsxs("div",{children:[A,E]})]})]}),e[27]=A,e[28]=E,e[29]=I):I=e[29];let D;e[30]!==f||e[31]!==p||e[32]!==c||e[33]!==S||e[34]!==i||e[35]!==k||e[36]!==w||e[37]!==h||e[38]!==l||e[39]!==y?(D=i&&o.jsxs("div",{className:"px-8 pt-5 pb-6",children:[o.jsx("div",{className:"mb-4",children:o.jsxs(r9,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:K=>{K&&m(K)},children:[o.jsx(Kc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),o.jsx(Kc,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),o.jsxs("div",{className:"rounded-xl border border-border p-5",children:[o.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:aM[f].map(K=>{const{dollars:q,labelKey:G}=K;return o.jsxs("button",{type:"button",disabled:w,onClick:()=>{Ye("credits_topup_clicked",{amount_cents:q*100,currency:f,tier_label:G,source:"exhausted_banner"}),y(q*100)},className:le("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[o.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,q]}),o.jsx("span",{className:"text-xs text-muted-foreground",children:l(G)})]},q)})}),h?o.jsxs("div",{className:"flex gap-2 mt-3",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),o.jsx(yt,{type:"number",min:"1",step:"1",placeholder:l("chat.creditsExhaustedBanner.customPlaceholder"),value:c,onChange:K=>d(K.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),o.jsx(me,{className:"h-10",disabled:!k||w,onClick:()=>{Ye("credits_topup_clicked",{amount_cents:Math.round(S*100),currency:f,tier_label:"custom",source:"exhausted_banner"}),y(Math.round(S*100))},children:l(w?"chat.creditsExhaustedBanner.opening":"chat.creditsExhaustedBanner.add")})]}):o.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>u(!0),children:l("chat.creditsExhaustedBanner.enterCustom")})]}),o.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:lM.map(K=>o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:o.jsx($t,{size:12,className:"text-[hsl(var(--chart-1))]"})}),o.jsx("span",{className:"text-sm text-foreground/80",children:l(K)})]},K))})]}),e[30]=f,e[31]=p,e[32]=c,e[33]=S,e[34]=i,e[35]=k,e[36]=w,e[37]=h,e[38]=l,e[39]=y,e[40]=D):D=e[40];let O;e[41]!==l?(O=l("chat.creditsExhaustedBanner.dismiss"),e[41]=l,e[42]=O):O=e[42];let $;e[43]!==s||e[44]!==O?($=o.jsx(me,{variant:"ghost",size:"sm",onClick:s,children:O}),e[43]=s,e[44]=O,e[45]=$):$=e[45];let M;e[46]!==r||e[47]!==s||e[48]!==n.slug?(M=()=>{r({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=r,e[47]=s,e[48]=n.slug,e[49]=M):M=e[49];let z;e[50]!==l?(z=l("chat.creditsExhaustedBanner.manageProviders"),e[50]=l,e[51]=z):z=e[51];let F;e[52]!==M||e[53]!==z?(F=o.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:M,children:z}),e[52]=M,e[53]=z,e[54]=F):F=e[54];let B;e[55]!==$||e[56]!==F?(B=o.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[$,F]}),e[55]=$,e[56]=F,e[57]=B):B=e[57];let H;e[58]!==I||e[59]!==D||e[60]!==B?(H=o.jsxs(Bt,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:cM,children:[I,D,B]}),e[58]=I,e[59]=D,e[60]=B,e[61]=H):H=e[61];let W;return e[62]!==H||e[63]!==j?(W=o.jsx(zt,{open:!0,onOpenChange:j,children:H}),e[62]=H,e[63]=j,e[64]=W):W=e[64],W}function cM(t){return t.preventDefault()}const dM={trial_exhausted:{label:"chat.subscriptionLimit.trialLabel",title:"chat.subscriptionLimit.trialTitle"},monthly_exhausted:{label:"chat.subscriptionLimit.monthlyLabel",title:"chat.subscriptionLimit.monthlyTitle"},runs_exhausted:{label:"chat.subscriptionLimit.runsLabel",title:"chat.subscriptionLimit.runsTitle"}};function uM(t){const e=U.c(16),{kind:s,onDismiss:n,onSubscribe:r}=t,i=ue(),{label:a,title:l}=dM[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(aa,{size:14}),e[0]=c):c=e[0];let d;e[1]!==a||e[2]!==i?(d=i(a),e[1]=a,e[2]=i,e[3]=d):d=e[3];let h;e[4]!==i||e[5]!==l?(h=i(l),e[4]=i,e[5]=l,e[6]=h):h=e[6];let u;e[7]!==s||e[8]!==r||e[9]!==i?(u=s==="trial_exhausted"?o.jsx(me,{size:"sm",onClick:r,className:"h-7 text-xs",children:i("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=r,e[9]=i,e[10]=u):u=e[10];let f;return e[11]!==n||e[12]!==d||e[13]!==h||e[14]!==u?(f=o.jsx(Qo,{icon:c,label:d,title:h,defaultExpanded:!0,variant:"warning",onClose:n,footerRight:u}),e[11]=n,e[12]=d,e[13]=h,e[14]=u,e[15]=f):f=e[15],f}function H7(t,e){const s=U.c(9),n=Ls(),r=ue();let i;s[0]!==n||s[1]!==t?(i=async()=>{const{url:c}=await n.call(t,{});return c},s[0]=n,s[1]=t,s[2]=i):i=s[2];let a;s[3]!==e||s[4]!==r?(a=c=>ye.error(r(e,{message:c.message})),s[3]=e,s[4]=r,s[5]=a):a=s[5];let l;return s[6]!==i||s[7]!==a?(l={mutationFn:i,onSuccess:hM,onError:a},s[6]=i,s[7]=a,s[8]=l):l=s[8],Rs(l)}function hM(t){return window.open(t,"_blank","noopener,noreferrer")}function fM(t){const e=t.trim(),s=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),n=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),r=/failed to fetch|networkerror|load failed|offline/i.test(e),i=/timeout|timed out|aborted|deadline/i.test(e),a=e.length>240,l=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(l){const c=l[1]?.trim().replace(/\.$/,"");return{summary:c?`Your sandbox didn't finish starting up (${c}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return n||s&&a?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:r?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:i?{summary:"That took longer than expected. Try again.",rawDetails:t}:s||a?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const mM={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function Xh(t){const e=U.c(29),s=ue(),{variant:n,onDismiss:r}=t,i=n==="error";let a;e[0]!==i||e[1]!==s?(a=s(i?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=i,e[1]=s,e[2]=a):a=e[2];const l=a,c=i?vn:sa;let d;e[3]!==t.error||e[4]!==t.finishReason||e[5]!==t.variant||e[6]!==s?(d=t.variant==="error"?t.error.message:(()=>{const v=mM[t.finishReason];return v?s(v):s("chat.highlight.responseStoppedUnexpectedly",{reason:t.finishReason})})(),e[3]=t.error,e[4]=t.finishReason,e[5]=t.variant,e[6]=s,e[7]=d):d=e[7];const h=d;let u;e[8]!==i||e[9]!==h?(u=i?fM(h):{summary:h,rawDetails:null},e[8]=i,e[9]=h,e[10]=u):u=e[10];const{summary:f,rawDetails:m}=u;let p;e[11]!==c?(p=o.jsx(c,{size:14}),e[11]=c,e[12]=p):p=e[12];let g;e[13]!==i||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(g=i?o.jsx(me,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):o.jsx(me,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=i,e[14]=t.onContinue,e[15]=t.onFixInChat,e[16]=s,e[17]=g):g=e[17];let x;e[18]!==m||e[19]!==s?(x=m?o.jsxs("details",{className:"group mx-4",children:[o.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[o.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"m4.5 3 3 3-3 3"})}),o.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),o.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),o.jsxs("div",{className:"relative mt-2",children:[o.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(m).then(()=>ye.success(s("chat.highlight.copiedToClipboard"))).catch(()=>ye.error(s("chat.highlight.couldNotCopy")))},"aria-label":s("chat.highlight.copyErrorDetails"),title:s("chat.highlight.copy"),className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:o.jsx(bn,{className:"size-3.5"})}),o.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:m})]})]}):null,e[18]=m,e[19]=s,e[20]=x):x=e[20];let b;return e[21]!==l||e[22]!==r||e[23]!==f||e[24]!==p||e[25]!==g||e[26]!==x||e[27]!==n?(b=o.jsx(Qo,{icon:p,label:l,title:f,defaultExpanded:!0,variant:n,onClose:r,footerRight:g,children:x}),e[21]=l,e[22]=r,e[23]=f,e[24]=p,e[25]=g,e[26]=x,e[27]=n,e[28]=b):b=e[28],b}function _9(){const t=U.c(73),e=ue(),{error:s,clearError:n,finishReason:r,clearFinishReason:i,messages:a,isStreaming:l,submit:c,sendMessage:d}=dr(),[h,u]=no(),{virtualMcpId:f,createTaskWithMessage:m}=an(),{chatMode:p,simpleModeTier:g}=Za(),{mutate:x}=H7("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let b;t[0]!==x?(b=()=>x(),t[0]=x,t[1]=b):b=t[1];const v=b;let _;t[2]!==p||t[3]!==g||t[4]!==f?(_=he=>({tier:g,mode:p,toolApprovalLevel:he,agent:f?{id:f}:void 0}),t[2]=p,t[3]=g,t[4]=f,t[5]=_):_=t[5];const L=_;let y;t[6]!==h.toolApprovalLevel?(y=h.toolApprovalLevel??uN(),t[6]=h.toolApprovalLevel,t[7]=y):y=t[7];const w=y,S=a.at(-1),k=S?.role==="assistant"?S.parts:[],j=k.filter(bM),N=V7(k),V=C7(k);let C;t[8]!==s||t[9]!==d||t[10]!==e?(C=()=>{if(s){const ne={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(ne)}},t[8]=s,t[9]=d,t[10]=e,t[11]=C):C=t[11];const T=C;let A;t[12]!==d||t[13]!==e?(A=()=>{const he={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.pleaseContinue")}]}]};d(he)},t[12]=d,t[13]=e,t[14]=A):A=t[14];const R=A;let E;t[15]!==L||t[16]!==w||t[17]!==c?(E=(he,ne)=>{c({kind:"toolOutput",toolCallId:he.toolCallId,output:{response:ne}},L(w))},t[15]=L,t[16]=w,t[17]=c,t[18]=E):E=t[18];const I=E;let D;t[19]!==m||t[20]!==h||t[21]!==u||t[22]!==e||t[23]!==f?(D=he=>{u({...h,toolApprovalLevel:"auto"}),m({virtualMcpId:f,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:he})}]}})},t[19]=m,t[20]=h,t[21]=u,t[22]=e,t[23]=f,t[24]=D):D=t[24];const O=D,$=xM;let M;t[25]!==L||t[26]!==c?(M=(he,ne,Q,de)=>{c({kind:"approval",approvalId:he,approved:ne,...Q?{reason:Q}:{}},L(de))},t[25]=L,t[26]=c,t[27]=M):M=t[27];const z=M,F=P7();if(F.isCreditExhausted){let he;return t[28]!==n?(he=o.jsx(U7,{onDismiss:n}),t[28]=n,t[29]=he):he=t[29],he}const{showError:B,showWarning:H,hasApprovals:W}=F,K=j.map(gM).join("|"),q=N7(N)?.toolCallId??"",G=V.map(pM).join("|");let te;t[30]!==F.todos?(te=o.jsx(sM,{todos:F.todos}),t[30]=F.todos,t[31]=te):te=t[31];let X;t[32]!==n||t[33]!==F.subscriptionErrorKind||t[34]!==v?(X=F.subscriptionErrorKind&&o.jsx(uM,{kind:F.subscriptionErrorKind,onDismiss:n,onSubscribe:v}),t[32]=n,t[33]=F.subscriptionErrorKind,t[34]=v,t[35]=X):X=t[35];let Z;t[36]!==n||t[37]!==s||t[38]!==T||t[39]!==B?(Z=B&&o.jsx(Xh,{variant:"error",error:s,onDismiss:n,onFixInChat:T}),t[36]=n,t[37]=s,t[38]=T,t[39]=B,t[40]=Z):Z=t[40];let ee;t[41]!==i||t[42]!==r||t[43]!==R||t[44]!==H?(ee=H&&o.jsx(Xh,{variant:"warning",finishReason:r,onDismiss:i,onContinue:R}),t[41]=i,t[42]=r,t[43]=R,t[44]=H,t[45]=ee):ee=t[45];let se;t[46]!==G||t[47]!==z||t[48]!==W||t[49]!==l||t[50]!==V?(se=W&&o.jsx(OD,{approvals:V,isStreaming:l,onRespond:z},G),t[46]=G,t[47]=z,t[48]=W,t[49]=l,t[50]=V,t[51]=se):se=t[51];let J;t[52]!==F.hasPlans||t[53]!==O||t[54]!==$||t[55]!==l||t[56]!==N||t[57]!==q?(J=F.hasPlans&&o.jsx(BD,{plans:N,isStreaming:l,onApprove:O,onDismiss:$},q),t[52]=F.hasPlans,t[53]=O,t[54]=$,t[55]=l,t[56]=N,t[57]=q,t[58]=J):J=t[58];let oe;t[59]!==F.isWaitingForUserInput||t[60]!==I||t[61]!==l||t[62]!==K||t[63]!==j?(oe=F.isWaitingForUserInput&&o.jsx(F7,{userAskParts:j,isStreaming:l,onSubmit:I},K),t[59]=F.isWaitingForUserInput,t[60]=I,t[61]=l,t[62]=K,t[63]=j,t[64]=oe):oe=t[64];let ce;return t[65]!==Z||t[66]!==ee||t[67]!==se||t[68]!==J||t[69]!==oe||t[70]!==te||t[71]!==X?(ce=o.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[te,X,Z,ee,se,J,oe]}),t[65]=Z,t[66]=ee,t[67]=se,t[68]=J,t[69]=oe,t[70]=te,t[71]=X,t[72]=ce):ce=t[72],ce}function pM(t){return t.approvalId}function gM(t){return t.toolCallId}function xM(){document.querySelector("[data-chat-input]")?.focus()}function bM(t){return t.type==="tool-user_ask"}_9.Error=function(e){return o.jsx(Xh,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};_9.Warning=function(e){return o.jsx(Xh,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};_9.UserAskQuestion=F7;function vM(t){const e=U.c(20),{taskId:s}=t,n=ue(),r=_6(s),i=YN(r),a=QN(),{stop:l,removeLocalMessage:c}=dr();if(i.length===0)return null;let d;e[0]!==n?(d=n("chat.queueTray.sendNow"),e[0]=n,e[1]=d):d=e[1];let h;e[2]!==l?(h=()=>{l()},e[2]=l,e[3]=h):h=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Hf,{size:14}),e[4]=u):u=e[4];let f;e[5]!==d||e[6]!==h?(f=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:h,children:u})}),e[5]=d,e[6]=h,e[7]=f):f=e[7];let m;e[8]!==n?(m=n("chat.queueTray.sendNow"),e[8]=n,e[9]=m):m=e[9];let p;e[10]!==m?(p=o.jsx(We,{side:"top",children:o.jsx("p",{className:"text-xs",children:m})}),e[10]=m,e[11]=p):p=e[11];let g;e[12]!==f||e[13]!==p?(g=o.jsxs(qe,{delayDuration:400,children:[f,p]}),e[12]=f,e[13]=p,e[14]=g):g=e[14];let x;return e[15]!==a||e[16]!==c||e[17]!==n||e[18]!==s?(x=(b,v)=>o.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[o.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:v+1}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.text}),o.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/queuerow:opacity-100",children:o.jsx(me,{type:"button",variant:"ghost",size:"icon-sm",title:n("chat.queueTray.removeFromQueue"),"aria-label":n("chat.queueTray.removeFromQueue"),onClick:()=>{a.cancel(s,b.messageId).then(_=>{_&&(XN(s,b.messageId),c(b.messageId))})},children:o.jsx(lr,{className:"size-3.5"})})})]},b.messageId),e[15]=a,e[16]=c,e[17]=n,e[18]=s,e[19]=x):x=e[19],o.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[o.jsx("span",{children:n(i.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:i.length})}),g]}),i.map(x)]})}function yM(t,e){return t?{modelId:t.modelId,title:t.title??t.modelId,keyId:t.keyId,providerId:e,description:null,logo:null,capabilities:[],limits:null,costs:null}:null}const _M={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function LM(t){const e=U.c(31),{tier:s,orgSlot:n,userSlot:r,autoSlot:i,onPick:a,onReset:l,onClose:c}=t,d=ue(),h=c9(),u=new Set(h.map(wM)),f=JN([r,n,i],u),m=f?.keyId??null,[p,g]=P.useState(m??h[0]?.id??null),x=h.some(D=>D.id===p)?p:m??h[0]?.id??null,b=x?h.find(D=>D.id===x):null,v="flex h-[70vh] max-h-[460px] w-full flex-col",_=_M[s];let L;e[0]!==d||e[1]!==_?(L=d(_),e[0]=d,e[1]=_,e[2]=L):L=e[2];let y;e[3]!==L?(y=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:L}),e[3]=L,e[4]=y):y=e[4];let w;e[5]!==l||e[6]!==d||e[7]!==r?(w=r&&o.jsx("button",{type:"button",onClick:l,className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent cursor-pointer",children:d("chat.modelPreferences.reset")}),e[5]=l,e[6]=d,e[7]=r,e[8]=w):w=e[8];let S;e[9]!==y||e[10]!==w?(S=o.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[y,w]}),e[9]=y,e[10]=w,e[11]=S):S=e[11];const k="flex-1 min-h-0",j=P.Suspense;let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(YP,{}),e[12]=N):N=e[12];const V=GP,C=!0,T=yM(m?f:null,b?.providerId??"deco");let A;e[13]!==x||e[14]!==a||e[15]!==g?(A=D=>{const O=D.keyId??x??"";g(O),a({keyId:O,modelId:D.modelId,title:D.title})},e[13]=x,e[14]=a,e[15]=g,e[16]=A):A=e[16];let R;e[17]!==V||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==T||e[22]!==A?(R=o.jsx(V,{compact:C,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:T,onModelChange:A}),e[17]=V,e[18]=x,e[19]=c,e[20]=g,e[21]=T,e[22]=A,e[23]=R):R=e[23];let E;e[24]!==j||e[25]!==R||e[26]!==N?(E=o.jsx("div",{className:k,children:o.jsx(j,{fallback:N,children:R})}),e[24]=j,e[25]=R,e[26]=N,e[27]=E):E=e[27];let I;return e[28]!==E||e[29]!==S?(I=o.jsxs("div",{className:v,children:[S,E]}),e[28]=E,e[29]=S,e[30]=I):I=e[30],I}function wM(t){return t.id}const SM=["fast","smart","thinking"];function K7(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const kM={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function jM(t){const e=U.c(28),{tier:s,pillIcon:n,groups:r}=t,i=ue();let a;e[0]!==i?(a=K7(i),e[0]=i,e[1]=a):a=e[1];const l=a,[c,d]=P.useState(!1);let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=k=>{k.onSelect(),d(!1)},e[2]=h):h=e[2];const u=h,f=l[s];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=le("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[3]=m):m=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=le("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[4]=p):p=e[4];const g=l[s];let x;e[5]!==g?(x=o.jsx("span",{className:p,children:g}),e[5]=g,e[6]=x):x=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(ds,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=b):b=e[7];let v;e[8]!==n||e[9]!==f||e[10]!==x?(v=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"inline-flex min-w-0 shrink",children:o.jsx(gs,{asChild:!0,children:o.jsxs(me,{type:"button",variant:"ghost",size:"default","aria-label":f,className:m,children:[n,x,b]})})})}),e[8]=n,e[9]=f,e[10]=x,e[11]=v):v=e[11];let _;e[12]!==f?(_=o.jsx(We,{children:f}),e[12]=f,e[13]=_):_=e[13];let L;e[14]!==v||e[15]!==_?(L=o.jsxs(qe,{children:[v,_]}),e[14]=v,e[15]=_,e[16]=L):L=e[16];let y;if(e[17]!==r||e[18]!==i){let k;e[20]!==i?(k=j=>o.jsx("div",{className:"flex flex-col",children:j.rows.map(N=>o.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-md hover:bg-muted",children:[o.jsxs("button",{type:"button",role:"menuitem","aria-label":N.title,onClick:()=>u(N),className:le("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",N.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[N.icon&&o.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:N.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-sm",children:N.title}),N.subtitle&&o.jsx("div",{className:"text-xs text-muted-foreground",children:N.subtitle})]}),N.active&&o.jsx("span",{title:i("chat.tierTrigger.selected"),children:o.jsx($t,{size:14,className:"text-foreground mt-0.5"})})]}),N.modelOverride&&o.jsx(NM,{label:N.title,render:N.modelOverride})]},N.key))},j.key),e[20]=i,e[21]=k):k=e[21],y=r.map(k),e[17]=r,e[18]=i,e[19]=y}else y=e[19];let w;e[22]!==y?(w=o.jsx(ys,{align:"end",className:"p-1 w-64",onOpenAutoFocus:CM,children:o.jsx("div",{role:"menu",className:"flex flex-col",children:y})}),e[22]=y,e[23]=w):w=e[23];let S;return e[24]!==c||e[25]!==L||e[26]!==w?(S=o.jsxs(_s,{open:c,onOpenChange:d,children:[L,w]}),e[24]=c,e[25]=L,e[26]=w,e[27]=S):S=e[27],S}function CM(t){return t.preventDefault()}function NM(t){const e=U.c(38),{label:s,render:n}=t,r=ue(),i=Ja(),[a,l]=P.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>l(!1),e[0]=c):c=e[0];const d=c;let h;e[1]!==s||e[2]!==r?(h=r("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=r,e[3]=h):h=e[3];const u=a&&"opacity-100";let f;e[4]!==u?(f=le("absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center","size-6 rounded-md bg-background border border-border/60 shadow-sm","text-muted-foreground hover:text-foreground","opacity-100 [@media(hover:hover)]:opacity-0","[@media(hover:hover)]:group-hover/tier-row:opacity-100","[@media(hover:hover)]:group-focus-within/tier-row:opacity-100",u),e[4]=u,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx($6,{size:14}),e[6]=m):m=e[6];let p;e[7]!==h||e[8]!==f?(p=o.jsx("button",{type:"button","aria-label":h,className:f,children:m}),e[7]=h,e[8]=f,e[9]=p):p=e[9];const g=p;if(i){let L;e[10]!==g?(L=o.jsx(sT,{asChild:!0,children:g}),e[10]=g,e[11]=L):L=e[11];let y;e[12]!==s||e[13]!==r?(y=r("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=r,e[14]=y):y=e[14];let w;e[15]!==y?(w=o.jsx(I2,{className:"sr-only",children:y}),e[15]=y,e[16]=w):w=e[16];let S;e[17]!==a||e[18]!==n?(S=a&&n(d),e[17]=a,e[18]=n,e[19]=S):S=e[19];let k;e[20]!==S||e[21]!==w?(k=o.jsxs(O2,{className:"p-0 flex flex-col max-h-[95vh]",children:[w,S]}),e[20]=S,e[21]=w,e[22]=k):k=e[22];let j;return e[23]!==a||e[24]!==k||e[25]!==L?(j=o.jsxs($2,{open:a,onOpenChange:l,children:[L,k]}),e[23]=a,e[24]=k,e[25]=L,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=o.jsx(gs,{asChild:!0,children:g}),e[27]=g,e[28]=x):x=e[28];let b;e[29]!==a||e[30]!==n?(b=a&&n(d),e[29]=a,e[30]=n,e[31]=b):b=e[31];let v;e[32]!==b?(v=o.jsx(ys,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:b}),e[32]=b,e[33]=v):v=e[33];let _;return e[34]!==a||e[35]!==x||e[36]!==v?(_=o.jsxs(_s,{open:a,onOpenChange:l,children:[x,v]}),e[34]=a,e[35]=x,e[36]=v,e[37]=_):_=e[37],_}function m4(t){return t==="fast"?o.jsx(aa,{size:16}):t==="thinking"?o.jsx(O6,{size:16}):o.jsx(Fi,{size:16})}function VM(t){const e=U.c(13),s=tV();let n;e[0]!==t||e[1]!==s.tiers?(n=d=>{const h=s.tiers[d];return h?h.title??h.modelId:t.chat[d]?.title},e[0]=t,e[1]=s.tiers,e[2]=n):n=e[2];const r=n;let i;e[3]!==r?(i=r("fast"),e[3]=r,e[4]=i):i=e[4];let a;e[5]!==r?(a=r("smart"),e[5]=r,e[6]=a):a=e[6];let l;e[7]!==r?(l=r("thinking"),e[7]=r,e[8]=l):l=e[8];let c;return e[9]!==i||e[10]!==a||e[11]!==l?(c={fast:i,smart:a,thinking:l},e[9]=i,e[10]=a,e[11]=l,e[12]=c):c=e[12],c}function TM(){const t=U.c(22),e=ue(),{simpleModeTier:s,setSimpleModeTier:n}=Za(),r=tA(),i=c9(),a=nA(i),l=VM(a),{data:c,error:d}=ZN();let h;t[0]!==c?(h=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=h):h=t[1];const u=h,f=eV();let m,p;if(t[2]!==a||t[3]!==r||t[4]!==n||t[5]!==e||t[6]!==s||t[7]!==l||t[8]!==f||t[9]!==u||t[10]!==d){const _=K7(e);m="decopilot",p=SM.map(L=>{const y=l[L],w=u.tiers[L];return{key:`decopilot-${L}`,icon:m4(L),title:_[L],subtitle:y??e(kM[L]),active:s===L,onSelect:()=>n(L),modelOverride:S=>o.jsxs(o.Fragment,{children:[d&&o.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),o.jsx(LM,{tier:L,orgSlot:r.tiers[L],userSlot:w,autoSlot:a.chat[L],onClose:S,onPick:k=>f.mutate({tier:L,slot:k}),onReset:()=>f.mutate({tier:L,slot:null})},`${L}:${w?.keyId??"org"}:${w?.modelId??""}`)]})}}),t[2]=a,t[3]=r,t[4]=n,t[5]=e,t[6]=s,t[7]=l,t[8]=f,t[9]=u,t[10]=d,t[11]=m,t[12]=p}else m=t[11],p=t[12];let g;t[13]!==m||t[14]!==p?(g=[{key:m,rows:p}],t[13]=m,t[14]=p,t[15]=g):g=t[15];const x=g;let b;t[16]!==s?(b=m4(s),t[16]=s,t[17]=b):b=t[17];let v;return t[18]!==x||t[19]!==b||t[20]!==s?(v=o.jsx(jM,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=v):v=t[21],v}async function Tg(t,e,s,n,r,i){if(!a9(e)){ye.error("Selected model does not support file uploads");return}const a=s.type||"application/octet-stream";if(!QP(a,e)){const c=m8(e).parts.map(h=>i(h)).join(", "),d=e?.title??"This model";r?r({fileName:s.name,modelName:d,accepted:c}):ye.error(`"${s.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const l=10*1024*1024;if(s.size>l){ye.error(`File "${s.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((f,m)=>{c.onload=()=>{const p=c.result;if(typeof p!="string"){m(new Error("Failed to read file as data URL"));return}const g=p.includes(",")?p.split(",")[1]??p:p;f(g)},c.onerror=m});c.readAsDataURL(s);const h=await d,u={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:h};uV(t,{from:n,to:n},u)}catch(c){console.error("Failed to process file:",c),ye.error(`Failed to load file "${s.name}"`)}}function PM(t){const e=U.c(9),{editor:s,selectedModel:n,onUnsupportedFile:r}=t,i=ue(),a=P.useRef(EM);let l,c;e[0]!==s||e[1]!==r||e[2]!==n||e[3]!==i?(l=()=>{a.current=async(u,f)=>{await Tg(s,n,u,f,r,i)}},c=[s,n,r,i],e[0]=s,e[1]=r,e[2]=n,e[3]=i,e[4]=l,e[5]=c):(l=e[4],c=e[5]),P.useEffect(l,c);let d,h;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const u=new Er("fileDropHandler");s.state.plugins.find(p=>p.spec.key===u)&&s.unregisterPlugin(u);const m=new nd({key:u,props:{handleDrop:(p,g,x,b)=>{if(b)return!1;const v=g.dataTransfer?.files;if(!v||v.length===0)return!1;g.preventDefault();const _=p.posAtCoords({left:g.clientX,top:g.clientY});if(!_)return!1;const L=Array.from(v);return(async()=>{let y=_.pos;for(const w of L)await a.current?.(w,y),y=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(AM);return b.length===0?!1:(g.preventDefault(),(async()=>{let v=p.state.selection.from;for(const _ of b){const L=_.getAsFile();L&&(await a.current?.(L,v),v=p.state.selection.to)}})(),!0)}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(u)}},h=[s],e[6]=s,e[7]=d,e[8]=h):(d=e[7],h=e[8]),P.useEffect(d,h),null}function AM(t){return t.kind==="file"}function EM(){return Promise.resolve()}function RM(t){const e=U.c(43),{info:s,onClose:n}=t,r=ue(),i=s!==null;let a;e[0]!==n?(a=C=>!C&&n(),e[0]=n,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=l):l=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:l.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-warning/15 text-warning",children:o.jsx(sa,{size:18})}),e[4]=d):d=e[4];let h;e[5]!==r?(h=r("chat.uploader.fileTypeNotSupported"),e[5]=r,e[6]=h):h=e[6];let u;e[7]!==h?(u=o.jsx(qt,{className:"text-xl font-semibold tracking-tight",children:h}),e[7]=h,e[8]=u):u=e[8];const f=s?.fileName;let m;e[9]!==f?(m=o.jsxs("span",{className:"font-medium text-foreground",children:["“",f,"”"]}),e[9]=f,e[10]=m):m=e[10];let p;e[11]!==r?(p=r("chat.uploader.cantAttachToChat"),e[11]=r,e[12]=p):p=e[12];let g;e[13]!==p||e[14]!==m?(g=o.jsxs(In,{className:"mt-1.5 text-sm leading-relaxed",children:[m," ",p]}),e[13]=p,e[14]=m,e[15]=g):g=e[15];let x;e[16]!==g||e[17]!==u?(x=o.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,o.jsxs(ls,{className:"relative gap-4",children:[d,o.jsxs("div",{children:[u,g]})]})]}),e[16]=g,e[17]=u,e[18]=x):x=e[18];const b=s?.modelName??"";let v;e[19]!==r||e[20]!==b?(v=r("chat.uploader.accepts",{modelName:b}),e[19]=r,e[20]=b,e[21]=v):v=e[21];let _;e[22]!==v?(_=o.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:v}),e[22]=v,e[23]=_):_=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(B6,{size:14,className:"text-muted-foreground"}),e[24]=L):L=e[24];const y=s?.accepted;let w;e[25]!==y?(w=o.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[L,o.jsx("span",{className:"capitalize",children:y})]}),e[25]=y,e[26]=w):w=e[26];let S;e[27]!==_||e[28]!==w?(S=o.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:o.jsxs("div",{className:"rounded-xl border border-border p-4",children:[_,w]})}),e[27]=_,e[28]=w,e[29]=S):S=e[29];let k;e[30]!==r?(k=r("chat.uploader.gotIt"),e[30]=r,e[31]=k):k=e[31];let j;e[32]!==n||e[33]!==k?(j=o.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:o.jsx(me,{onClick:n,children:k})}),e[32]=n,e[33]=k,e[34]=j):j=e[34];let N;e[35]!==x||e[36]!==S||e[37]!==j?(N=o.jsxs(Bt,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:DM,children:[x,S,j]}),e[35]=x,e[36]=S,e[37]=j,e[38]=N):N=e[38];let V;return e[39]!==i||e[40]!==a||e[41]!==N?(V=o.jsx(zt,{open:i,onOpenChange:a,children:N}),e[39]=i,e[40]=a,e[41]=N,e[42]=V):V=e[42],V}function DM(t){return t.preventDefault()}function MM(){const t=U.c(3),[e,s]=P.useState(null);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>s(null),t[0]=n):n=t[0];let r;return t[1]!==e?(r={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:n},t[1]=e,t[2]=r):r=t[2],r}var Pg=hV;var IM=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],qm=IM.join(","),W7=typeof Element>"u",Vu=W7?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Jh=!W7&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},Zh=function(e,s){var n;s===void 0&&(s=!0);var r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),i=r===""||r==="true",a=i||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Zh(e.parentNode));return a},OM=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},$M=function(e,s,n){if(Zh(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(qm));return s&&Vu.call(e,qm)&&r.unshift(e),r=r.filter(n),r},Gm=function(e,s,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!Zh(a,!1))if(a.tagName==="SLOT"){var l=a.assignedElements(),c=l.length?l:a.children,d=Gm(c,!0,n);n.flatten?r.push.apply(r,d):r.push({scopeParent:a,candidates:d})}else{var h=Vu.call(a,qm);h&&n.filter(a)&&(s||!e.includes(a))&&r.push(a);var u=a.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(a),f=!Zh(u,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(u&&f){var m=Gm(u===!0?a.children:u.children,!0,n);n.flatten?r.push.apply(r,m):r.push({scopeParent:a,candidates:m})}else i.unshift.apply(i,a.children)}}return r},q7=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},G7=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||OM(e))&&!q7(e)?0:e.tabIndex},BM=function(e,s){var n=G7(e);return n<0&&s&&!q7(e)?0:n},zM=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},Y7=function(e){return e.tagName==="INPUT"},FM=function(e){return Y7(e)&&e.type==="hidden"},UM=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},HM=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},KM=function(e){if(!e.name)return!0;var s=e.form||Jh(e),n=function(l){return s.querySelectorAll('input[type="radio"][name="'+l+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var i=HM(r,e.form);return!i||i===e},WM=function(e){return Y7(e)&&e.type==="radio"},qM=function(e){return WM(e)&&!KM(e)},GM=function(e){var s,n=e&&Jh(e),r=(s=n)===null||s===void 0?void 0:s.host,i=!1;if(n&&n!==e){var a,l,c;for(i=!!((a=r)!==null&&a!==void 0&&(l=a.ownerDocument)!==null&&l!==void 0&&l.contains(r)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!i&&r;){var d,h,u;n=Jh(r),r=(d=n)===null||d===void 0?void 0:d.host,i=!!((h=r)!==null&&h!==void 0&&(u=h.ownerDocument)!==null&&u!==void 0&&u.contains(r))}}return i},p4=function(e){var s=e.getBoundingClientRect(),n=s.width,r=s.height;return n===0&&r===0},YM=function(e,s){var n=s.displayCheck,r=s.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var a=Vu.call(e,"details>summary:first-of-type"),l=a?e.parentElement:e;if(Vu.call(l,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof r=="function"){for(var c=e;e;){var d=e.parentElement,h=Jh(e);if(d&&!d.shadowRoot&&r(d)===!0)return p4(e);e.assignedSlot?e=e.assignedSlot:!d&&h!==e.ownerDocument?e=h.host:e=d}e=c}if(GM(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return p4(e);return!1},QM=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var n=0;n<s.children.length;n++){var r=s.children.item(n);if(r.tagName==="LEGEND")return Vu.call(s,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}s=s.parentElement}return!1},XM=function(e,s){return!(s.disabled||FM(s)||YM(s,e)||UM(s)||QM(s))},g4=function(e,s){return!(qM(s)||G7(s)<0||!XM(e,s))},JM=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},Q7=function(e){var s=[],n=[];return e.forEach(function(r,i){var a=!!r.scopeParent,l=a?r.scopeParent:r,c=BM(l,a),d=a?Q7(r.candidates):l;c===0?a?s.push.apply(s,d):s.push(l):n.push({documentOrder:i,tabIndex:c,item:r,isScope:a,content:d})}),n.sort(zM).reduce(function(r,i){return i.isScope?r.push.apply(r,i.content):r.push(i.content),r},[]).concat(s)},X7=function(e,s){s=s||{};var n;return s.getShadowRoot?n=Gm([e],s.includeContainer,{filter:g4.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:JM}):n=$M(e,s.includeContainer,g4.bind(null,s)),Q7(n)};function ZM(){return/apple/i.test(navigator.vendor)}const x4="data-floating-ui-focusable";function eI(t){let e=t.activeElement;for(;((s=e)==null||(s=s.shadowRoot)==null?void 0:s.activeElement)!=null;){var s;e=e.shadowRoot.activeElement}return e}function Ym(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&hN(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function kd(t){return"composedPath"in t?t.composedPath()[0]:t.target}function L1(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const s=t;return s.target!=null&&e.contains(s.target)}function tI(t){return t.matches("html,body")}function Tu(t){return t?.ownerDocument||document}function sI(t){return t?t.hasAttribute(x4)?t:t.querySelector("["+x4+"]")||t:null}function Sh(t,e,s){return s===void 0&&(s=!0),t.filter(r=>{var i;return r.parentId===e&&(!s||((i=r.context)==null?void 0:i.open))}).flatMap(r=>[r,...Sh(t,r.id,s)])}function nI(t){return"nativeEvent"in t}var rI=typeof document<"u",iI=function(){},Ea=rI?P.useLayoutEffect:iI;const oI={...e6},aI=oI.useInsertionEffect,lI=aI||(t=>t());function Cc(t){const e=P.useRef(()=>{});return lI(()=>{e.current=t}),P.useCallback(function(){for(var s=arguments.length,n=new Array(s),r=0;r<s;r++)n[r]=arguments[r];return e.current==null?void 0:e.current(...n)},[])}const J7=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Z7(t,e){const s=X7(t,J7()),n=s.length;if(n===0)return;const r=eI(Tu(t)),i=s.indexOf(r),a=i===-1?e===1?0:n-1:i+e;return s[a]}function cI(t){return Z7(Tu(t).body,1)||t}function dI(t){return Z7(Tu(t).body,-1)||t}function w1(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!Ym(s,n)}function uI(t){X7(t,J7()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function b4(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const n=s.dataset.tabindex;delete s.dataset.tabindex,n?s.setAttribute("tabindex",n):s.removeAttribute("tabindex")})}const hI="data-floating-ui-focusable",v4="active",y4="selected",fI={...e6};let _4=!1,mI=0;const L4=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+mI++;function pI(){const[t,e]=P.useState(()=>_4?L4():void 0);return Ea(()=>{t==null&&e(L4())},[]),P.useEffect(()=>{_4=!0},[]),t}const gI=fI.useId,Ag=gI||pI;function xI(){const t=new Map;return{emit(e,s){var n;(n=t.get(e))==null||n.forEach(r=>r(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var n;(n=t.get(e))==null||n.delete(s)}}}const bI=P.createContext(null),vI=P.createContext(null),e_=()=>{var t;return((t=P.useContext(bI))==null?void 0:t.id)||null},t_=()=>P.useContext(vI);function Eg(t){return"data-floating-ui-"+t}const yI={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},w4=P.forwardRef(function(e,s){const[n,r]=P.useState();Ea(()=>{ZM()&&r("button")},[]);const i={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[Eg("focus-guard")]:"",style:yI};return o.jsx("span",{...e,...i})}),_I={clipPath:"inset(50%)",position:"fixed",top:0,left:0},s_=P.createContext(null),S4=Eg("portal");function LI(t){t===void 0&&(t={});const{id:e,root:s}=t,n=Ag(),r=SI(),[i,a]=P.useState(null),l=P.useRef(null);return Ea(()=>()=>{i?.remove(),queueMicrotask(()=>{l.current=null})},[i]),Ea(()=>{if(!n||l.current)return;const c=e?document.getElementById(e):null;if(!c)return;const d=document.createElement("div");d.id=n,d.setAttribute(S4,""),c.appendChild(d),l.current=d,a(d)},[e,n]),Ea(()=>{if(s===null||!n||l.current)return;let c=s||r?.portalNode;c&&!bN(c)&&(c=c.current),c=c||document.body;let d=null;e&&(d=document.createElement("div"),d.id=e,c.appendChild(d));const h=document.createElement("div");h.id=n,h.setAttribute(S4,""),c=d||c,c.appendChild(h),l.current=h,a(h)},[e,s,n,r]),i}function wI(t){const{children:e,id:s,root:n,preserveTabOrder:r=!0}=t,i=LI({id:s,root:n}),[a,l]=P.useState(null),c=P.useRef(null),d=P.useRef(null),h=P.useRef(null),u=P.useRef(null),f=a?.modal,m=a?.open,p=!!a&&!a.modal&&a.open&&r&&!!(n||i);return P.useEffect(()=>{if(!i||!r||f)return;function g(x){i&&w1(x)&&(x.type==="focusin"?b4:uI)(i)}return i.addEventListener("focusin",g,!0),i.addEventListener("focusout",g,!0),()=>{i.removeEventListener("focusin",g,!0),i.removeEventListener("focusout",g,!0)}},[i,r,f]),P.useEffect(()=>{i&&(m||b4(i))},[m,i]),o.jsxs(s_.Provider,{value:P.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:h,afterInsideRef:u,portalNode:i,setFocusManagerState:l}),[r,i]),children:[p&&i&&o.jsx(w4,{"data-type":"outside",ref:c,onFocus:g=>{if(w1(g,i)){var x;(x=h.current)==null||x.focus()}else{const b=a?a.domReference:null,v=dI(b);v?.focus()}}}),p&&i&&o.jsx("span",{"aria-owns":i.id,style:_I}),i&&Wn.createPortal(e,i),p&&i&&o.jsx(w4,{"data-type":"outside",ref:d,onFocus:g=>{if(w1(g,i)){var x;(x=u.current)==null||x.focus()}else{const b=a?a.domReference:null,v=cI(b);v?.focus(),a?.closeOnFocusOut&&a?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const SI=()=>P.useContext(s_),kI={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},jI={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},k4=t=>{var e,s;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(s=t?.outsidePress)!=null?s:!0}};function CI(t,e){e===void 0&&(e={});const{open:s,onOpenChange:n,elements:r,dataRef:i}=t,{enabled:a=!0,escapeKey:l=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:h=!1,referencePressEvent:u="pointerdown",ancestorScroll:f=!1,bubbles:m,capture:p}=e,g=t_(),x=Cc(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,v=P.useRef(!1),{escapeKey:_,outsidePress:L}=k4(m),{escapeKey:y,outsidePress:w}=k4(p),S=P.useRef(!1),k=Cc(A=>{var R;if(!s||!a||!l||A.key!=="Escape"||S.current)return;const E=(R=i.current.floatingContext)==null?void 0:R.nodeId,I=g?Sh(g.nodesRef.current,E):[];if(!_&&(A.stopPropagation(),I.length>0)){let D=!0;if(I.forEach(O=>{var $;if(($=O.context)!=null&&$.open&&!O.context.dataRef.current.__escapeKeyBubbles){D=!1;return}}),!D)return}n(!1,nI(A)?A.nativeEvent:A,"escape-key")}),j=Cc(A=>{var R;const E=()=>{var I;k(A),(I=kd(A))==null||I.removeEventListener("keydown",E)};(R=kd(A))==null||R.addEventListener("keydown",E)}),N=Cc(A=>{var R;const E=i.current.insideReactTree;i.current.insideReactTree=!1;const I=v.current;if(v.current=!1,d==="click"&&I||E||typeof b=="function"&&!b(A))return;const D=kd(A),O="["+Eg("inert")+"]",$=Tu(r.floating).querySelectorAll(O);let M=ti(D)?D:null;for(;M&&!x1(M);){const H=pN(M);if(x1(H)||!ti(H))break;M=H}if($.length&&ti(D)&&!tI(D)&&!Ym(D,r.floating)&&Array.from($).every(H=>!Ym(M,H)))return;if(gN(D)&&T){const H=x1(D),W=xN(D),K=/auto|scroll/,q=H||K.test(W.overflowX),G=H||K.test(W.overflowY),te=q&&D.clientWidth>0&&D.scrollWidth>D.clientWidth,X=G&&D.clientHeight>0&&D.scrollHeight>D.clientHeight,Z=W.direction==="rtl",ee=X&&(Z?A.offsetX<=D.offsetWidth-D.clientWidth:A.offsetX>D.clientWidth),se=te&&A.offsetY>D.clientHeight;if(ee||se)return}const z=(R=i.current.floatingContext)==null?void 0:R.nodeId,F=g&&Sh(g.nodesRef.current,z).some(H=>{var W;return L1(A,(W=H.context)==null?void 0:W.elements.floating)});if(L1(A,r.floating)||L1(A,r.domReference)||F)return;const B=g?Sh(g.nodesRef.current,z):[];if(B.length>0){let H=!0;if(B.forEach(W=>{var K;if((K=W.context)!=null&&K.open&&!W.context.dataRef.current.__outsidePressBubbles){H=!1;return}}),!H)return}n(!1,A,"outside-press")}),V=Cc(A=>{var R;const E=()=>{var I;N(A),(I=kd(A))==null||I.removeEventListener(d,E)};(R=kd(A))==null||R.addEventListener(d,E)});P.useEffect(()=>{if(!s||!a)return;i.current.__escapeKeyBubbles=_,i.current.__outsidePressBubbles=L;let A=-1;function R($){n(!1,$,"ancestor-scroll")}function E(){window.clearTimeout(A),S.current=!0}function I(){A=window.setTimeout(()=>{S.current=!1},mN()?5:0)}const D=Tu(r.floating);l&&(D.addEventListener("keydown",y?j:k,y),D.addEventListener("compositionstart",E),D.addEventListener("compositionend",I)),b&&D.addEventListener(d,w?V:N,w);let O=[];return f&&(ti(r.domReference)&&(O=g1(r.domReference)),ti(r.floating)&&(O=O.concat(g1(r.floating))),!ti(r.reference)&&r.reference&&r.reference.contextElement&&(O=O.concat(g1(r.reference.contextElement)))),O=O.filter($=>{var M;return $!==((M=D.defaultView)==null?void 0:M.visualViewport)}),O.forEach($=>{$.addEventListener("scroll",R,{passive:!0})}),()=>{l&&(D.removeEventListener("keydown",y?j:k,y),D.removeEventListener("compositionstart",E),D.removeEventListener("compositionend",I)),b&&D.removeEventListener(d,w?V:N,w),O.forEach($=>{$.removeEventListener("scroll",R)}),window.clearTimeout(A)}},[i,r,l,b,d,s,n,f,a,_,L,k,y,j,N,w,V]),P.useEffect(()=>{i.current.insideReactTree=!1},[i,b,d]);const C=P.useMemo(()=>({onKeyDown:k,...h&&{[kI[u]]:A=>{n(!1,A.nativeEvent,"reference-press")},...u!=="click"&&{onClick(A){n(!1,A.nativeEvent,"reference-press")}}}}),[k,n,h,u]),T=P.useMemo(()=>{function A(R){R.button===0&&(v.current=!0)}return{onKeyDown:k,onMouseDown:A,onMouseUp:A,[jI[d]]:()=>{i.current.insideReactTree=!0}}},[k,d,i]);return P.useMemo(()=>a?{reference:C,floating:T}:{},[a,C,T])}function NI(t){const{open:e=!1,onOpenChange:s,elements:n}=t,r=Ag(),i=P.useRef({}),[a]=P.useState(()=>xI()),l=e_()!=null,[c,d]=P.useState(n.reference),h=Cc((m,p,g)=>{i.current.openEvent=m?p:void 0,a.emit("openchange",{open:m,event:p,reason:g,nested:l}),s?.(m,p,g)}),u=P.useMemo(()=>({setPositionReference:d}),[]),f=P.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return P.useMemo(()=>({dataRef:i,open:e,onOpenChange:h,elements:f,events:a,floatingId:r,refs:u}),[e,h,f,a,r,u])}function VI(t){t===void 0&&(t={});const{nodeId:e}=t,s=NI({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,r=n.elements,[i,a]=P.useState(null),[l,c]=P.useState(null),h=r?.domReference||i,u=P.useRef(null),f=t_();Ea(()=>{h&&(u.current=h)},[h]);const m=fN({...t,elements:{...r,...l&&{reference:l}}}),p=P.useCallback(_=>{const L=ti(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),getClientRects:()=>_.getClientRects(),contextElement:_}:_;c(L),m.refs.setReference(L)},[m.refs]),g=P.useCallback(_=>{(ti(_)||_===null)&&(u.current=_,a(_)),(ti(m.refs.reference.current)||m.refs.reference.current===null||_!==null&&!ti(_))&&m.refs.setReference(_)},[m.refs]),x=P.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:u}),[m.refs,g,p]),b=P.useMemo(()=>({...m.elements,domReference:h}),[m.elements,h]),v=P.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return Ea(()=>{n.dataRef.current.floatingContext=v;const _=f?.nodesRef.current.find(L=>L.id===e);_&&(_.context=v)}),P.useMemo(()=>({...m,context:v,refs:x,elements:b}),[m,x,b,v])}function S1(t,e,s){const n=new Map,r=s==="item";let i=t;if(r&&t){const{[v4]:a,[y4]:l,...c}=t;i=c}return{...s==="floating"&&{tabIndex:-1,[hI]:""},...i,...e.map(a=>{const l=a?a[s]:null;return typeof l=="function"?t?l(t):null:l}).concat(t).reduce((a,l)=>(l&&Object.entries(l).forEach(c=>{let[d,h]=c;if(!(r&&[v4,y4].includes(d)))if(d.indexOf("on")===0){if(n.has(d)||n.set(d,[]),typeof h=="function"){var u;(u=n.get(d))==null||u.push(h),a[d]=function(){for(var f,m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];return(f=n.get(d))==null?void 0:f.map(x=>x(...p)).find(x=>x!==void 0)}}}else a[d]=h}),a),{})}}function TI(t){t===void 0&&(t=[]);const e=t.map(l=>l?.reference),s=t.map(l=>l?.floating),n=t.map(l=>l?.item),r=P.useCallback(l=>S1(l,t,"reference"),e),i=P.useCallback(l=>S1(l,t,"floating"),s),a=P.useCallback(l=>S1(l,t,"item"),n);return P.useMemo(()=>({getReferenceProps:r,getFloatingProps:i,getItemProps:a}),[r,i,a])}const PI=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function AI(t,e){var s,n;e===void 0&&(e={});const{open:r,elements:i,floatingId:a}=t,{enabled:l=!0,role:c="dialog"}=e,d=Ag(),h=((s=i.domReference)==null?void 0:s.id)||d,u=P.useMemo(()=>{var v;return((v=sI(i.floating))==null?void 0:v.id)||a},[i.floating,a]),f=(n=PI.get(c))!=null?n:c,p=e_()!=null,g=P.useMemo(()=>f==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:r?u:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":r?u:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:h},...f==="menu"&&p&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[f,u,p,r,h,c]),x=P.useMemo(()=>{const v={id:u,...f&&{role:f}};return f==="tooltip"||c==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":h}}},[f,u,h,c]),b=P.useCallback(v=>{let{active:_,selected:L}=v;const y={role:"option",..._&&{id:u+"-fui-option"}};switch(c){case"select":case"combobox":return{...y,"aria-selected":L}}return{}},[u,c]);return P.useMemo(()=>l?{reference:g,floating:x,item:b}:{},[l,g,x,b])}function EI(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:l}=t,c=n&&!r,d=pV(s),h=new RegExp(`\\s${d}$`),u=a?"^":"",f=r?"":d,m=c?new RegExp(`${u}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${u}(?:^)?${d}[^\\s${f}]*`,"gm"),p=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!p)return null;const g=l.pos-p.length,x=Array.from(p.matchAll(m)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),v=new RegExp(`^[${i?.join("")}\0]?$`).test(b);if(i!==null&&!v)return null;const _=g+x.index;let L=_+x[0].length;return c&&h.test(p.slice(L-1,L+1))&&(x[0]+=" ",L+=1),_<l.pos&&L>=l.pos?{range:{from:_,to:L},query:x[0].slice(s.length),text:x[0]}:null}function RI(t){return t.docChanged?t.steps.some(e=>{const s=e.slice;if(!s?.content)return!1;const n=s.content.textBetween(0,s.content.size,`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-BsuMEuNO.js","assets/index-fS0pDoNW.js","assets/index-MAAh901k.css","assets/chat-context-BcY08VKG.js","assets/use-panel-navigate-BNmxrdjd.js","assets/use-destination-route-WysfeR7S.js","assets/autosend-CI7ToXd3.js","assets/thread-intent-DK53ivxy.js","assets/slugify-CEUa2lfQ.js","assets/hooks-BOHEAk9Y.js","assets/use-mcp-client-DtsRGdvB.js","assets/constants-Daqiz8AS.js","assets/auth-CRmM4ftp.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/decopilot-sse-pool-CnHcYfZj.js","assets/task-board-B4aUIKJI.js","assets/schema-CVS6b6X8.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-C5Zt0ewM.js","assets/use-ai-providers-DMdw1ZKm.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-BxzD46W5.js","assets/thread-route-m3qiCJQP.js","assets/dialog-DKxWMb0-.js","assets/Check-CmgBwUGv.js","assets/Copy01-DlxhdgMn.js","assets/Download01-CxTJDArl.js","assets/use-organization-settings-nKtEvYQd.js","assets/ChevronUp-DLLvYK07.js","assets/agent-icon-BrQLA9dC.js","assets/AlertCircle-piOaFPQJ.js","assets/Tool01-DdmZi7j_.js","assets/ArrowUp-39D5k7I2.js","assets/ArrowLeft-EySzpaMt.js","assets/Tool02-KStnzngn.js","assets/ArrowRight-CN1prjjJ.js","assets/TrendUp01-NTK3Zf_M.js","assets/ZoomOut-DpAkOD8e.js","assets/Users03-CrZajyAo.js","assets/CheckCircle-CwJqWx0e.js","assets/ChevronRight-Dk9nR_C7.js","assets/ChevronSelectorVertical-X68ci9mX.js","assets/DotsVertical-Bk31Y8qH.js","assets/UserSquare-l4Q5fPEZ.js","assets/CreditCard01-CGG5tsm6.js","assets/Settings02-Dss_LnvC.js","assets/Eye-UEYlbIHb.js","assets/Share07-CgTNZ1dk.js","assets/GitBranch01-DRT2X7Dj.js","assets/Globe01-Z6BbST4r.js","assets/XClose-C-bbcgCJ.js","assets/HardDrive--vlQvWpi.js","assets/Image01-rCxXluf6.js","assets/Key01-By90Yq6k.js","assets/Link01-CUe3c6G0.js","assets/LinkExternal01-D2pSy7v4.js","assets/Monitor01-CY2DbFkD.js","assets/Sun-DAVD-A5B.js","assets/Package-Bb4KYw9O.js","assets/Palette-o-NEtwsW.js","assets/Play-DpmIDjD8.js","assets/Plus-CgVmxzR4.js","assets/SearchMd-Cjr4mqh9.js","assets/Shield01-CNbrlPDI.js","assets/Stars01-Dno5l14o.js","assets/Trash01-BevWobXU.js","assets/Upload01-By19QANP.js","assets/User01-CDRv3_oY.js","assets/Users01-sAr72jTU.js","assets/XCircle-BTj4-tdv.js","assets/Zap-D6-O3NZl.js","assets/scroll-area-DIJ4XfEc.js","assets/select-BJ0Gkkka.js","assets/input-DaMV0yqT.js","assets/dropdown-menu-CC8IMYtS.js","assets/safe-image-url-D5z803Ot.js","assets/page-seo-form-B1ADwpo8.js","assets/label-Cznjg7Mb.js","assets/switch-C0tiHttS.js","assets/use-section-preview-base-BHSNiN-i.js","assets/automation-runs-Ge9BW9cQ.js","assets/useInfiniteQuery-CU7gRlof.js","assets/infiniteQueryObserver-B62setNi.js","assets/use-connection-DueV7Dd9.js","assets/table-D4dLAB1m.js","assets/empty-state-DA8cnNqW.js","assets/use-infinite-scroll-p1RdGJsc.js","assets/use-members-NWhv5vIl.js","assets/use-org-auth-client-CShcDth4.js","assets/use-automations-BrJQYtfT.js","assets/useSuspenseInfiniteQuery-rXQ07VfR.js","assets/avatar-ncVfbaUx.js","assets/format-time-BtXRrtv4.js","assets/differenceInSeconds-C3x8sHUj.js","assets/use-copy-DsM8BkMO.js","assets/markdown-BNMHtGi6.js","assets/monaco-editor-7CBGfDCH.js","assets/editor-Cm-sI42p.js","assets/mcp-app-renderer-Df-LUzfK.js","assets/types-C9oYptqr.js","assets/shell-layout-D-M6_Jkf.js","assets/project-icon-DD8-TjG9.js","assets/github-repo-CTPv5ZM2.js","assets/source-system-tabs-CnEGUb4r.js","assets/command-CTH7s7Ya.js","assets/index-YZeWKaou.js","assets/required-auth-layout-CR5eG3sF.js","assets/use-org-sso-DzsFzLff.js","assets/use-org-notice-B64MrAd9.js","assets/shell-layout-CuFt8bor.css","assets/integration-icon-BFx8Gs71.js","assets/use-navigate-to-agent-Bnmnhqje.js","assets/use-mcp-prompts-CD_IWJeZ.js","assets/form-CorLMse0.js","assets/file-type-icon-ChIQfzaN.js","assets/drawer-BaA_lu4x.js","assets/collection-search-UW0xDxmi.js","assets/tabs-CDFENeRa.js","assets/toggle-group-BSxkMDRS.js","assets/task-route-BUYfM-Mq.js","assets/extract-connection-data-BdnZZmxw.js","assets/metadata-dUsYcpuu.js","assets/connection-CU1s53fy.js","assets/connection-card-B-DQLE2m.js","assets/use-registry-connections-Bb6pjxJh.js","assets/retry-CErkP7V6.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-DIJRp6Ds.js","assets/connection-form-helpers-B-auMXZc.js","assets/authenticate-and-persist-oauth-DEZCdj-t.js","assets/mcp-oauth-CDjOqnrq.js","assets/collection-tabs-644rp01A.js","assets/badge-rtLQpibV.js","assets/use-file-configs-BByTBhTa.js","assets/site-slug-uya6Wp4-.js","assets/popover-sPMAt4On.js","assets/github-icon-CeFWgmVz.js","assets/get-initials-D-f_fDFw.js","assets/select-model-D8CTPoiO.js","assets/checkbox-D0oTwa58.js","assets/ai-providers-logos-DD3qZ33J.js","assets/folder-icon-_4CbErMC.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-k-y4u-Dp.js","assets/toolbar-DQ2YVpXF.js","assets/use-mcp-tools-BKHgcAxL.js","assets/skill-preview-5YIvamOb.js","assets/use-date-fns-locale-I1vziWnN.js","assets/alert-dialog-DuVJ7GC7.js","assets/use-debounced-autosave-Bep9W3RF.js","assets/search-input-BN_fecvo.js","assets/use-mcp-auth-status-CTnEpyYI.js","assets/repository-import-picker-TTmQRKgM.js","assets/repository-picker-Be7NfZEA.js","assets/use-debounced-value-CjFrELYP.js","assets/use-secrets-CTUki73i.js","assets/client-icons-BE3evb-i.js","assets/connect-layout-CmuGJ6zd.js","assets/self-tool-result-KOheC4HD.js","assets/provision-repo-scoped-github-connection-WQFARyHG.js","assets/track-J__dE1p5.js","assets/use-tags-BOUHc_F8.js","assets/breadcrumb-d7wNqsyt.js","assets/toolbar-icon-button-DeXrhkGe.js","assets/automation-list-row-CJo0GDE_.js","assets/site-error--i37Vnuw.js","assets/cards-CgpdHb-U.js","assets/file-explorer-jXzlywVk.js","assets/app-editor-ueQwisxj.js","assets/post-editor-CcXinFIi.js","assets/multi-select-D1MP7iDa.js","assets/block-document-WxPy4zHY.js","assets/primitives-CGxQwrae.js","assets/use-autosave-DXppOUIw.js","assets/record-editor-CQ7QMoAf.js","assets/category-editor-DrNCa6L7.js","assets/bulk-category-panel-B8uZmKXZ.js","assets/index-ObIlqSDZ.js","assets/seo-editor-CSFxllkC.js","assets/variant-calendar-TLlf4rAo.js","assets/view-mode-toggle-CZECgOYC.js","assets/post-calendar-B4Z9Jz7b.js","assets/alert-DI_JsgmI.js","assets/redirect-editor-B68PccpU.js","assets/project-app-view-DudFJRxH.js","assets/hosting-tab-BktIiwOH.js","assets/empty-state-BioEMyZp.js","assets/e2e-tab-CyxfrSC2.js","assets/analytics-tab-gxTnWc1L.js","assets/chart-C7j_btUB.js","assets/index-BAPa6G_8.js","assets/AreaChart-C754kxxt.js","assets/cdn-tab-BflNT2VL.js","assets/ErrorBarContext-DAIYWYhf.js","assets/Sector-3UpSGQVE.js"])))=>i.map(i=>d[i]);
2
+ import{n as Ns,r as P,ac as aN,ad as lN,ae as Rt,af as ss,ag as Ae,ah as ci,ai as cr,aj as Bh,ak as yu,al as cN,am as Pr,an as dN,ao as Jy,c as U,G as Fe,l as le,j as o,E as sn,b as ue,t as ye,a3 as Ko,J as Ja,h as nt,a1 as Ke,a2 as We,a4 as qe,ap as nn,M as Ff,B as me,aq as j2,ar as Zy,v as no,as as ps,at as ka,au as Dx,d as on,a7 as Ls,e as Rs,o as Ye,av as uN,C as sa,aw as hN,ax as e6,ay as fN,az as ti,aA as g1,aB as Wn,aC as mN,aD as x1,aE as pN,aF as gN,aG as xN,aH as bN,aI as C2,aJ as N2,aK as t6,aL as V2,x as Uf,K as at,aM as vN,aN as yN,aO as _N,aP as s6,aQ as su,m as Zt,a as Nn,z as Uu,Y as Ar,aR as zh,u as na,f as ra,I as T2,aS as LN,aT as Mx,aU as Vm,aa as n6,a9 as Ix,aV as r6,aW as i6,aX as o6,aY as wN,aZ as SN,L as Do,a_ as a6,a$ as kN,b0 as jN,b1 as CN,b2 as Fh,b3 as ja,b4 as tn,b5 as l6,b6 as c6,b7 as Mn,P as Dn,ab as d6,b8 as NN,b9 as Tt,ba as u6,bb as h6,bc as f6,bd as m6,be as p6,bf as g6,bg as VN,bh as TN,bi as PN,bj as AN,bk as x6,bl as Ks,N as sr,bm as b6,bn as EN,bo as RN,bp as v6,bq as DN,br as MN,bs as IN,bt as ON,bu as Tm,bv as Pa,bw as y6,bx as $N,by as BN,bz as zN,bA as FN,bB as UN,bC as HN,bD as P2,bE as KN,bF as WN,bG as qN}from"./index-fS0pDoNW.js";import{i as Hf,n as GN}from"./ArrowUp-39D5k7I2.js";import{u as Za,a as dr,b as ws,c as an,d as _6,s as YN,e as QN,f as XN,g as JN,h as ZN,i as eV,j as tV,k as A2,l as L6,T as sV,A as nV,m as rV,n as iV,t as oV,o as aV,p as lV}from"./chat-context-BcY08VKG.js";import{c as E2,s as Hu,g as $i,P as Uh,d as R2,t as Hh,a as cV,M as dV,i as uV,b as Er,e as nd,f as hV,D as fV,h as mV,j as pV,k as Uc,l as gV,m as xV,u as Kf,E as bV,n as Ku,o as vV,F as yV,p as Wf,q as qf,r as w6,S as _V,v as LV,w as wV,x as SV,y as Ox,z as kV,A as S6,O as jV,B as $x,C as ni,G as CV,T as Mi,H as NV,I as oi,J as Mo,K as Pm,L as Am,N as k6,Q as VV,R as j6,U as TV,V as ur,W as PV,X as AV,Y as C6,Z as Ni,_ as EV,$ as RV,a0 as N6,a1 as ya,a2 as Bx,a3 as DV,a4 as MV,a5 as zx,a6 as IV,a7 as _u,a8 as el,a9 as di,aa as Kh,ab as D2,ac as M2,ad as OV,ae as $V,af as BV,ag as zV,ah as FV,ai as UV,aj as HV,ak as Gf,al as V6,am as T6,an as P6,ao as KV,ap as A6,aq as WV,ar as qV,as as GV,at as YV,au as Wu,av as QV,aw as XV,ax as JV,ay as ZV}from"./automation-runs-Ge9BW9cQ.js";import{c as ls,d as qt,b as Bt,D as zt,h as In,e as Yn,i as eT}from"./dialog-DKxWMb0-.js";import{c as tT,b as I2,a as O2,D as $2,d as sT}from"./drawer-BaA_lu4x.js";import{C as nT}from"./collection-search-UW0xDxmi.js";import{u as Vn,a as rT}from"./use-mcp-client-DtsRGdvB.js";import{a as ia,i as Em,S as qu,b as iT,g as Wh,R as oT,c as aT,d as lT,W as Ud,C as cT}from"./constants-Daqiz8AS.js";import{u as E6,g as Yf,l as Rm}from"./use-mcp-prompts-CD_IWJeZ.js";import{t as ds,n as R6}from"./ChevronUp-DLLvYK07.js";import{t as dT,z as uT,u as Gu,a as B2,b as Qf,c as Xf}from"./hooks-BOHEAk9Y.js";import{K as hT,i as D6,u as oa,o as fT,f as mT}from"./shell-layout-D-M6_Jkf.js";import{u as Vs,a as tl,b as z2,c as pT,d as gT}from"./use-virtual-mcp-C5Zt0ewM.js";import{w as xT,A as bT}from"./autosend-CI7ToXd3.js";import{r as M6,d as Jf,a as F2,p as vT,b as yT,s as _T,c as LT}from"./thread-intent-DK53ivxy.js";import{i as ro}from"./ArrowRight-CN1prjjJ.js";import{t as Zf,l as I6,m as U2,h as aa,o as O6,p as $6,q as B6,A as Hi,r as z6,u as Hc,j as Ki,v as F6,w as rd,x as wT,y as ST,c as U6,z as qh,B as e9,f as Dm,k as H6,C as kT,D as jT,g as K6,E as t9,F as sl,G as CT,H as H2,I as W6,J as q6,K as Mm,L as b1,M as Fx,N as Yu,O as NT,P as VT,Q as TT,R as PT,S as AT,T as ET,n as K2,U as W2,V as G6,W as Y6,X as Q6,Y as X6,Z as RT,_ as q2,$ as DT,a0 as Rr,a1 as Ux,a2 as MT,a3 as IT,d as J6,a4 as G2,a5 as id,a6 as Bi,a7 as Y2,a8 as Qu,a9 as OT,i as s9,aa as $T,ab as Q2,ac as BT,ad as zT,ae as FT,af as UT,ag as HT,ah as KT,ai as zi,aj as Hx,ak as Z6,al as WT,am as qT,an as Ia,ao as Kx,ap as GT,aq as YT,ar as QT,as as e8,at as XT,au as t8,av as JT,aw as ZT,ax as eP,ay as tP,az as nu,aA as sP,aB as nP,aC as s8,aD as X2,aE as rP,aF as iP,aG as oP,aH as aP,aI as lP}from"./agent-icon-BrQLA9dC.js";import{i as $t}from"./Check-CmgBwUGv.js";import{a as ar}from"./Image01-rCxXluf6.js";import{i as Qn}from"./Upload01-By19QANP.js";import{i as vn}from"./AlertCircle-piOaFPQJ.js";import{a as bn}from"./Copy01-DlxhdgMn.js";import{F as Im,a as J2,b as Z2,c as eg,d as n8}from"./form-CorLMse0.js";import{c as It,S as xs,b as bs,a as js,d as vs}from"./select-BJ0Gkkka.js";import{i as n9}from"./ArrowLeft-EySzpaMt.js";import{T as Aa,a as nl,b as nr,c as od}from"./tabs-CDFENeRa.js";import{t as Om,i as tg}from"./Tool02-KStnzngn.js";import{T as r9,a as Kc}from"./toggle-group-BSxkMDRS.js";import{I as yt}from"./input-DaMV0yqT.js";import{u as sg,A as r8,j as cP,b as i8,k as dP,l as uP,m as hP,n as o8,a as fP,e as $m,r as Bm,p as mP,o as pP,s as gP,q as xP,v as bP,w as vP,x as yP,y as Wx,z as _P,B as LP,C as qx,D as wP,S as ai,E as SP,F as kP,G as jP,h as CP,c as ng,H as Wo,I as hn,T as qn,t as rg,J as i9,f as zm,K as a8,L as Xu,M as ig,N as Ju,O as l8,Q as c8,R as Fm,U as d8,V as NP,W as u8,X as VP,Y as TP,Z as PP,_ as AP,$ as EP,a0 as RP,a1 as DP,a2 as MP,a3 as h8,a4 as IP,i as OP,g as $P,a5 as BP,a6 as zP,a7 as FP,a8 as Um,a9 as Gx,aa as UP,ab as HP,ac as KP,ad as WP,ae as qP,af as o9}from"./task-route-BUYfM-Mq.js";import{s as lr,i as og,c as f8}from"./XClose-C-bbcgCJ.js";import{M as GP,a as YP,m as a9,i as QP,g as m8,b as XP,N as JP,c as ZP}from"./select-model-D8CTPoiO.js";import{a as gs,b as ys,P as _s,c as eA}from"./popover-sPMAt4On.js";import{t as Fi}from"./Stars01-Dno5l14o.js";import{b as tA,a as p8,u as l9,c as g8,d as sA}from"./use-organization-settings-nKtEvYQd.js";import{u as c9,a as nA}from"./use-ai-providers-DMdw1ZKm.js";import{g as x8,c as b8,u as Zu,b as xn,L as d9,P as v8,s as y8,a as rA,f as iA,d as oA}from"./project-icon-DD8-TjG9.js";import{f as aA,a as lA,u as Lu,b as e0,c as _8,d as cA,e as ag,g as L8,h as lg,i as dA,j as cg,k as wu,l as w8,m as uA,n as S8,o as hA}from"./folder-icon-_4CbErMC.js";import{c as Ft,D as Ut,b as Ht,a as et,d as jr,e as Cr,f as Nr,g as Gh,h as Bo,i as Dc,j as Sd}from"./dropdown-menu-CC8IMYtS.js";import{i as dg}from"./Link01-CUe3c6G0.js";import{s as Qt}from"./Plus-CgVmxzR4.js";import{p as fA,q as mA}from"./question-004-sINsf4GQ.js";import{A as Fs}from"./avatar-ncVfbaUx.js";import{u as u9,a as ug}from"./use-members-NWhv5vIl.js";import{i as Us}from"./ChevronRight-Dk9nR_C7.js";import{u as ad}from"./use-is-desktop-app-BNujXJc_.js";import{a as pi,b as k8,u as hg,c as j8}from"./use-panel-navigate-BNmxrdjd.js";import{i as gi}from"./CheckCircle-CwJqWx0e.js";import{i as pA}from"./XCircle-BTj4-tdv.js";import{I as io}from"./integration-icon-BFx8Gs71.js";import{a as h9,u as C8,b as fg,c as gA,d as xA,p as bA,e as vA,f as t0,g as N8,h as mg,i as yA,j as _A}from"./use-navigate-to-agent-Bnmnhqje.js";import{e as s0}from"./backoff-CrEUbyZT.js";import{u as LA}from"./use-status-sounds-k-y4u-Dp.js";import{E as Dr}from"./empty-state-DA8cnNqW.js";import{b as wA,c as n0,d as V8,u as T8,r as SA}from"./thread-route-m3qiCJQP.js";import{g as la,r as Hn,h as pg,a as P8,b as A8}from"./github-repo-CTPv5ZM2.js";import{T as kA}from"./toolbar-DQ2YVpXF.js";import{i as qo,a as jA}from"./Share07-CgTNZ1dk.js";import{i as Cn}from"./Globe01-Z6BbST4r.js";import{i as E8}from"./Monitor01-CY2DbFkD.js";import{u as ui,a as gg,b as R8}from"./use-connection-DueV7Dd9.js";import{u as D8,a as M8}from"./use-mcp-tools-BKHgcAxL.js";import{g as I8}from"./types-C9oYptqr.js";import{F as Go}from"./file-type-icon-ChIQfzaN.js";import{f as O8,d as r0,s as xg,c as CA,b as NA}from"./TrendUp01-NTK3Zf_M.js";import{i as Mr}from"./ZoomOut-DpAkOD8e.js";import{i as Gn}from"./GitBranch01-DRT2X7Dj.js";import{a as bg}from"./Package-Bb4KYw9O.js";import{i as vg,r as VA,s as $8,a as B8}from"./source-system-tabs-CnEGUb4r.js";import{n as Su}from"./Download01-CxTJDArl.js";import{n as fn}from"./LinkExternal01-D2pSy7v4.js";import{D as Ca}from"./use-destination-route-WysfeR7S.js";import{g as TA,s as PA,d as z8,a as AA,F as F8,b as U8,f as H8,S as K8,c as EA}from"./skill-preview-5YIvamOb.js";import{i as f9}from"./Key01-By90Yq6k.js";import{p as yg,b as dn,s as Wc,H as ku,h as ju,a as gc,c as W8,d as q8}from"./location-oTTXFrSF.js";import{m as RA,a as DA,M as ld,b as MA,O as IA}from"./markdown-BNMHtGi6.js";import{g as OA}from"./extract-connection-data-BdnZZmxw.js";import{g as m9,n as $A,a as Yx,e as BA,u as zA,f as FA}from"./use-date-fns-locale-I1vziWnN.js";import{a as UA,i as Qx}from"./mcp-oauth-CDjOqnrq.js";import{A as Wi,a as qi,b as Gi,c as Yi,d as Qi,e as Xi,f as Ji,g as Zi}from"./alert-dialog-DuVJ7GC7.js";import{T as Yo}from"./textarea-DIJRp6Ds.js";import{i as Oa}from"./Play-DpmIDjD8.js";import{s as rn}from"./Trash01-BevWobXU.js";import{u as Yh}from"./use-debounced-autosave-Bep9W3RF.js";import{S as rl}from"./scroll-area-DIJ4XfEc.js";import{i as Cu}from"./SearchMd-Cjr4mqh9.js";import{C as il}from"./checkbox-D0oTwa58.js";import{S as p9}from"./search-input-BN_fecvo.js";import{C as G8}from"./collection-tabs-644rp01A.js";import{T as Y8,u as Q8}from"./use-mcp-auth-status-CTnEpyYI.js";import{g as HA}from"./connection-slug-CITJ0kGN.js";import{a as KA,i as WA}from"./Settings02-Dss_LnvC.js";import{L as At}from"./label-Cznjg7Mb.js";import{S as rr}from"./switch-C0tiHttS.js";import{s as X8}from"./slugify-CEUa2lfQ.js";import{d as cd}from"./delay-CnY5UFtP.js";import{R as i0}from"./repository-import-picker-TTmQRKgM.js";import{s as J8}from"./User01-CDRv3_oY.js";import{t as g9}from"./Users01-sAr72jTU.js";import{u as Z8,a as e7}from"./use-secrets-CTUki73i.js";import{G as Ir}from"./github-icon-CeFWgmVz.js";import{t as xi,c as qc,m as qA,a as t7}from"./differenceInSeconds-C3x8sHUj.js";import{C as GA,a as YA,b as QA}from"./client-icons-BE3evb-i.js";import{g as jn}from"./get-initials-D-f_fDFw.js";import{S as is,D as s7,C as n7,R as XA,a as JA,i as r7,n as ZA,b as eE}from"./task-board-B4aUIKJI.js";import{a as dd}from"./format-time-BtXRrtv4.js";import{u as i7,d as tE,c as sE,C as _g,a as nE}from"./connect-layout-CmuGJ6zd.js";import{u as Lg,a as rE,b as iE}from"./use-tags-BOUHc_F8.js";import{B as oE,a as aE,b as Xx,c as lE,d as cE,e as dE}from"./breadcrumb-d7wNqsyt.js";import{u as v1}from"./use-copy-DsM8BkMO.js";import{i as wg,a as uE,c as hE,b as fE}from"./UserSquare-l4Q5fPEZ.js";import{C as zr,a as hr,b as fr,c as On,d as as,e as Es,f as mE,g as Jx}from"./command-CTH7s7Ya.js";import{u as pE}from"./use-org-auth-client-CShcDth4.js";import{t as gE}from"./decopilot-sse-pool-CnHcYfZj.js";import{G as xE,u as bE}from"./repository-picker-Be7NfZEA.js";import{l as vE}from"./provision-repo-scoped-github-connection-WQFARyHG.js";import{i as x9}from"./ChevronSelectorVertical-X68ci9mX.js";import{w as Zx}from"./editor-Cm-sI42p.js";import{T as Io,p as o7,I as a7}from"./toolbar-icon-button-DeXrhkGe.js";import{u as Hm,C as yE,b as _E,p as l7,a as LE,s as Km,n as wE}from"./self-tool-result-KOheC4HD.js";import{M as ud}from"./monaco-editor-7CBGfDCH.js";import{i as SE,a as b9,b as Sg}from"./Tool01-DdmZi7j_.js";import{a as Wm}from"./Palette-o-NEtwsW.js";import{s as kE}from"./safe-image-url-D5z803Ot.js";import{s as o0}from"./Eye-UEYlbIHb.js";import{i as v9}from"./DotsVertical-Bk31Y8qH.js";import{u as y9}from"./use-debounced-value-CjFrELYP.js";import{u as c7,a as kg}from"./use-file-configs-BByTBhTa.js";import{u as d7}from"./useInfiniteQuery-CU7gRlof.js";import{i as hi}from"./Zap-D6-O3NZl.js";import{r as u7}from"./site-slug-uya6Wp4-.js";import{B as jE}from"./badge-rtLQpibV.js";import{u as a0,a as CE,b as NE,c as VE,d as TE}from"./use-automations-BrJQYtfT.js";import{A as PE}from"./automation-list-row-CJo0GDE_.js";import{t as AE}from"./site-error--i37Vnuw.js";import{f as EE,p as RE,g as DE,u as ME,e as IE,a as OE,F as l0,t as h7,S as $E,B as BE,b as f7,R as zE,c as FE}from"./cards-CgpdHb-U.js";function m7(t,e){const s=Ns(e);return UE({filters:{...t,status:"pending"}},s).length}function e4(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function UE(t={},e){const s=Ns(e).getMutationCache(),n=P.useRef(t),r=P.useRef(null);return r.current===null&&(r.current=e4(s,t)),P.useEffect(()=>{n.current=t}),P.useSyncExternalStore(P.useCallback(i=>s.subscribe(()=>{const a=aN(r.current,e4(s,n.current));r.current!==a&&(r.current=a,lN.schedule(i))}),[s]),()=>r.current,()=>r.current)}const p7=Rt({connection_id:Ae().describe("Connection ID"),selected_tools:ss(Ae()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:ss(Ae()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:ss(Ae()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),y1=500,g7=200,jg=200,HE=200,KE=20,WE=50,qE=100,GE=20,YE=100,QE=50,XE=100,JE=50,ZE=8192,x7=p7.extend({selected_tools:ss(Ae()).max(y1).nullable().optional().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:ss(Ae()).max(y1).nullable().optional().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:ss(Ae()).max(y1).nullable().optional().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),eR=Rt({connectionId:Ae(),toolName:Ae(),label:Ae(),icon:Ae().nullable().optional()}),tR=Rt({id:Ae().describe("Stable id; used as React key and ?tab= value"),title:Ae().describe("Tab label"),icon:Ae().optional().describe("Optional lucide icon name"),view:Rt({type:Bh("ext-app"),appId:Ae(),args:yu(Ae(),Jy()).optional()})}),b7=cr(["overview","reports","board","site-editor","assets","hosting","e2e","analytics","cdn","automations"]),sR=cr(["on","off"]),nR=new Map([["manual","on"],["auto","on"]]),rR=cr(["on","off","manual","auto"]);function iR(t){if(!t)return null;const e=nR.get(t);return e||(t==="on"||t==="off"?t:null)}const oR=Rt({defaultMainView:Rt({type:Ae(),id:Ae().optional(),toolName:Ae().optional()}).nullable().optional(),chatDefaultOpen:ci().nullable().optional(),cmsDefaultOpen:ci().nullable().optional(),cms:rR.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),sidebarViews:ss(b7).max(10).nullable().optional().describe("Deprecated layout-scoped sidebar selections. Read only as a fallback when metadata.sidebarViews is absent."),tabs:ss(tR).max(GE).optional()});function c0(t){return iR(t?.cms)??"on"}function aR(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"site-editor"}}:{}}}const t4=Rt({tileId:Ae().optional(),connectionId:Ae().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:Ae().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:Ae().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:yu(Ae(),Jy()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:Pr().int().positive().optional(),maxHeight:Pr().int().positive().optional()}),lR=Rt({banner:Ae().nullable().optional(),bannerColor:Ae().nullable().optional(),icon:Ae().nullable().optional(),themeColor:Ae().nullable().optional(),pinnedViews:ss(eR).max(qE).nullable().optional(),layout:oR.nullable().optional(),homeTile:t4.nullable().optional(),homeTiles:ss(t4).max(KE).nullable().optional(),homePrompts:ss(Ae()).max(WE).nullable().optional()}),d0=/^[A-Za-z_][A-Za-z0-9_]*$/,s4=Ae().min(1).regex(d0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),cR=dN("kind",[Rt({key:s4,kind:Bh("literal"),value:Ae().max(ZE)}),Rt({key:s4,kind:Bh("secret"),secretId:Ae().min(1)})]),Cg=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,dR=Rt({host:Ae().min(1).regex(Cg).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:Ae().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),uR=Rt({selected:Ae().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:Ae().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:Ae().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:ss(cR).max(XE).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:ss(dR).max(JE).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),hR=Rt({url:Ae().describe("GitHub repository URL"),owner:Ae().describe("Repository owner"),name:Ae().describe("Repository name"),installationId:Pr().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:Ae().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials."),repositoryId:Ae().optional().describe("First-class repository (REPOSITORY_LINK) backing this binding. When set, credentials come from the repository's git provider account rather than connectionId.")}),fR=cr(["agent-sandbox","local-api"]),mR={sandboxHandle:Ae().describe("Provider-specific handle"),previewUrl:Ae().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:Ae().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:Pr().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:Rt({packageManager:Ae().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:Ae().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:Ae().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},v7=Rt(mR);function pR(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,s={};for(const[n,r]of Object.entries(e))if(!(!r||typeof r!="object")&&!(n!=="agent-sandbox"&&n!=="local-api"))try{s[n]=v7.parse(r)}catch{}return s}const gR=yu(Ae().describe("userId"),yu(Ae().describe("branch"),cN(fR,v7))),xR=Rt({id:Ae().describe("Stable identifier for this knowledge file"),name:Ae().describe("File name shown in the UI"),kind:cr(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:Ae().describe("Org filesystem (Library) volume the file lives in"),path:Ae().describe("Path within the volume"),url:Ae().describe("Same-origin URL to read the file (display/download)"),contentType:Ae().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:Pr().nullable().optional().describe("File size in bytes"),addedAt:Ae().describe("ISO timestamp when the file was attached")}),bR=ss(xR).max(YE).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),vR=cr(["smart","code-review","open"]),yR=vR.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),_R=ci().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),LR=ci().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),wR=Ae().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),SR=Rt({branch:Ae().describe("Git branch backing this release"),name:Ae().describe('User-facing name, e.g. "Black Friday 2026"'),color:Ae().describe("Dot color token shown in the version switcher"),createdBy:Ae().optional().describe("User ID who created the release"),createdAt:Ae().optional().describe("ISO 8601 creation timestamp")}),kR=ss(SR).max(QE).nullable().optional().describe("Curated list of named, branch-backed releases shown in the version switcher. The base branch ('No ar') is derived, not stored here."),jR=ci().nullable().optional().describe("Draft & Releases mode: gates the drafts UX (releases switcher, read-only production, publish-to-production). Off (default) keeps the classic branch/PR picker and post-publish behavior."),Ng={instructions:Ae().nullable().optional().describe("Instructions also used as system prompt"),enabled_plugins:ss(Ae()).max(jg).nullable().optional().describe("List of enabled plugin IDs"),subAgents:ss(Ae()).max(HE).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Ae().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:lR.nullable().optional().describe("UI customization settings"),sidebarViews:ss(b7).max(10).nullable().optional().describe("Project views selected for the sidebar. Interpret as an exact list when sidebarViewsVersion is 1; unversioned values use legacy native-only semantics. Runtime presence gates still apply."),sidebarViewsVersion:Bh(1).optional().describe("Version 1 marks metadata.sidebarViews as an exact list that can disable legacy default rows."),githubRepo:hR.nullable().optional().describe("Linked GitHub repository"),runtime:uR.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:bR,siteSlug:Ae().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:yR,previewServerUrl:wR,productionUrl:Ae().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:ci().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:_R,releases:kR,draftsMode:jR,fastPreviewInPlace:LR},CR=Rt({id:Ae().describe("Unique identifier"),title:Ae().describe("Human-readable name"),description:Ae().nullable().describe("Description"),icon:Ae().nullable().describe("Icon URL"),created_at:Ae().describe("Creation timestamp"),updated_at:Ae().describe("Last update timestamp"),created_by:Ae().describe("User ID who created this item"),updated_by:Ae().optional().describe("User ID who last updated this item"),organization_id:Ae().describe("Organization ID this item belongs to"),status:cr(["active","inactive"]).describe("Current status"),pinned:ci().describe("Whether this space is pinned to the sidebar"),metadata:Rt(Ng).extend({instructions:Ae().nullable().describe("Instructions also used as system prompt"),sandboxMap:gR.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:ss(p7).describe("Connections with their selected tools, resources, and prompts")}),y7=Rt({title:Ae().min(1).max(120).describe("Short label shown on the chip"),description:Ae().max(280).optional().describe("One-line subtitle shown under the title"),text:Ae().min(1).max(4e3).describe("The message sent to the agent when the prompt is clicked")});Rt({title:Ae().min(1).max(255).describe("Name for the virtual MCP"),description:Ae().max(500).nullable().optional().describe("Optional description"),icon:Ae().nullish().describe("Optional icon URL"),status:cr(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:ci().optional().default(!1).describe("Pin to sidebar"),metadata:Rt(Ng).extend({enabled_plugins:ss(Ae()).max(jg).nullable().optional().describe("List of enabled plugin IDs")}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:ss(x7).max(g7).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:ss(y7).max(20).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});Rt({title:Ae().min(1).max(255).optional().describe("New name"),description:Ae().max(500).nullable().optional().describe("New description (null to clear)"),icon:Ae().nullish().describe("New icon URL"),status:cr(["active","inactive"]).optional().describe("New status"),pinned:ci().optional().describe("Pin/unpin from sidebar"),metadata:Rt(Ng).extend({enabled_plugins:ss(Ae()).max(jg).nullable().optional().describe("List of enabled plugin IDs")}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:ss(x7).max(g7).optional().describe("New connections (replaces existing)"),prompts:ss(y7).max(20).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});function Nu(t,e){const s=m9(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,r=xi(t,e?.in),i=r.getDay(),a=(i<n?7:0)+i-n;return r.setDate(r.getDate()-a),r.setHours(0,0,0,0),r}function Qh(t,e){return Nu(t,{...e,weekStartsOn:1})}function _7(t,e){const s=xi(t,e?.in),n=s.getFullYear(),r=qc(s,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const i=Qh(r),a=qc(s,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=Qh(a);return s.getTime()>=i.getTime()?n+1:s.getTime()>=l.getTime()?n:n-1}function n4(t,e){const s=xi(t,e?.in);return s.setHours(0,0,0,0),s}function NR(t,e,s){const[n,r]=$A(s?.in,t,e),i=n4(n),a=n4(r),l=+i-Yx(i),c=+a-Yx(a);return Math.round((l-c)/qA)}function VR(t,e){const s=_7(t,e),n=qc(t,0);return n.setFullYear(s,0,4),n.setHours(0,0,0,0),Qh(n)}function TR(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function PR(t){return!(!TR(t)&&typeof t!="number"||isNaN(+xi(t)))}function AR(t,e){const s=xi(t,e?.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}function ER(t,e){const s=xi(t,e?.in);return NR(s,AR(s))+1}function RR(t,e){const s=xi(t,e?.in),n=+Qh(s)-+VR(s);return Math.round(n/t7)+1}function L7(t,e){const s=xi(t,e?.in),n=s.getFullYear(),r=m9(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=qc(e?.in||t,0);a.setFullYear(n+1,0,i),a.setHours(0,0,0,0);const l=Nu(a,e),c=qc(e?.in||t,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const d=Nu(c,e);return+s>=+l?n+1:+s>=+d?n:n-1}function DR(t,e){const s=m9(),n=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,r=L7(t,e),i=qc(e?.in||t,0);return i.setFullYear(r,0,n),i.setHours(0,0,0,0),Nu(i,e)}function MR(t,e){const s=xi(t,e?.in),n=+Nu(s,e)-+DR(s,e);return Math.round(n/t7)+1}function Kt(t,e){const s=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return s+n}const jo={y(t,e){const s=t.getFullYear(),n=s>0?s:1-s;return Kt(e==="yy"?n%100:n,e.length)},M(t,e){const s=t.getMonth();return e==="M"?String(s+1):Kt(s+1,2)},d(t,e){return Kt(t.getDate(),e.length)},a(t,e){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];default:return s==="am"?"a.m.":"p.m."}},h(t,e){return Kt(t.getHours()%12||12,e.length)},H(t,e){return Kt(t.getHours(),e.length)},m(t,e){return Kt(t.getMinutes(),e.length)},s(t,e){return Kt(t.getSeconds(),e.length)},S(t,e){const s=e.length,n=t.getMilliseconds(),r=Math.trunc(n*Math.pow(10,s-3));return Kt(r,e.length)}},xc={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},r4={G:function(t,e,s){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return s.era(n,{width:"abbreviated"});case"GGGGG":return s.era(n,{width:"narrow"});default:return s.era(n,{width:"wide"})}},y:function(t,e,s){if(e==="yo"){const n=t.getFullYear(),r=n>0?n:1-n;return s.ordinalNumber(r,{unit:"year"})}return jo.y(t,e)},Y:function(t,e,s,n){const r=L7(t,n),i=r>0?r:1-r;if(e==="YY"){const a=i%100;return Kt(a,2)}return e==="Yo"?s.ordinalNumber(i,{unit:"year"}):Kt(i,e.length)},R:function(t,e){const s=_7(t);return Kt(s,e.length)},u:function(t,e){const s=t.getFullYear();return Kt(s,e.length)},Q:function(t,e,s){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Kt(n,2);case"Qo":return s.ordinalNumber(n,{unit:"quarter"});case"QQQ":return s.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(n,{width:"narrow",context:"formatting"});default:return s.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,s){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Kt(n,2);case"qo":return s.ordinalNumber(n,{unit:"quarter"});case"qqq":return s.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(n,{width:"narrow",context:"standalone"});default:return s.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,s){const n=t.getMonth();switch(e){case"M":case"MM":return jo.M(t,e);case"Mo":return s.ordinalNumber(n+1,{unit:"month"});case"MMM":return s.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(n,{width:"narrow",context:"formatting"});default:return s.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,s){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return Kt(n+1,2);case"Lo":return s.ordinalNumber(n+1,{unit:"month"});case"LLL":return s.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(n,{width:"narrow",context:"standalone"});default:return s.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,s,n){const r=MR(t,n);return e==="wo"?s.ordinalNumber(r,{unit:"week"}):Kt(r,e.length)},I:function(t,e,s){const n=RR(t);return e==="Io"?s.ordinalNumber(n,{unit:"week"}):Kt(n,e.length)},d:function(t,e,s){return e==="do"?s.ordinalNumber(t.getDate(),{unit:"date"}):jo.d(t,e)},D:function(t,e,s){const n=ER(t);return e==="Do"?s.ordinalNumber(n,{unit:"dayOfYear"}):Kt(n,e.length)},E:function(t,e,s){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return s.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(n,{width:"short",context:"formatting"});default:return s.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,s,n){const r=t.getDay(),i=(r-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Kt(i,2);case"eo":return s.ordinalNumber(i,{unit:"day"});case"eee":return s.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(r,{width:"short",context:"formatting"});default:return s.day(r,{width:"wide",context:"formatting"})}},c:function(t,e,s,n){const r=t.getDay(),i=(r-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Kt(i,e.length);case"co":return s.ordinalNumber(i,{unit:"day"});case"ccc":return s.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(r,{width:"narrow",context:"standalone"});case"cccccc":return s.day(r,{width:"short",context:"standalone"});default:return s.day(r,{width:"wide",context:"standalone"})}},i:function(t,e,s){const n=t.getDay(),r=n===0?7:n;switch(e){case"i":return String(r);case"ii":return Kt(r,e.length);case"io":return s.ordinalNumber(r,{unit:"day"});case"iii":return s.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(n,{width:"short",context:"formatting"});default:return s.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,s){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(r,{width:"narrow",context:"formatting"});default:return s.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,s){const n=t.getHours();let r;switch(n===12?r=xc.noon:n===0?r=xc.midnight:r=n/12>=1?"pm":"am",e){case"b":case"bb":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(r,{width:"narrow",context:"formatting"});default:return s.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,s){const n=t.getHours();let r;switch(n>=17?r=xc.evening:n>=12?r=xc.afternoon:n>=4?r=xc.morning:r=xc.night,e){case"B":case"BB":case"BBB":return s.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(r,{width:"narrow",context:"formatting"});default:return s.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,s){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),s.ordinalNumber(n,{unit:"hour"})}return jo.h(t,e)},H:function(t,e,s){return e==="Ho"?s.ordinalNumber(t.getHours(),{unit:"hour"}):jo.H(t,e)},K:function(t,e,s){const n=t.getHours()%12;return e==="Ko"?s.ordinalNumber(n,{unit:"hour"}):Kt(n,e.length)},k:function(t,e,s){let n=t.getHours();return n===0&&(n=24),e==="ko"?s.ordinalNumber(n,{unit:"hour"}):Kt(n,e.length)},m:function(t,e,s){return e==="mo"?s.ordinalNumber(t.getMinutes(),{unit:"minute"}):jo.m(t,e)},s:function(t,e,s){return e==="so"?s.ordinalNumber(t.getSeconds(),{unit:"second"}):jo.s(t,e)},S:function(t,e){return jo.S(t,e)},X:function(t,e,s){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return o4(n);case"XXXX":case"XX":return _a(n);default:return _a(n,":")}},x:function(t,e,s){const n=t.getTimezoneOffset();switch(e){case"x":return o4(n);case"xxxx":case"xx":return _a(n);default:return _a(n,":")}},O:function(t,e,s){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+i4(n,":");default:return"GMT"+_a(n,":")}},z:function(t,e,s){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+i4(n,":");default:return"GMT"+_a(n,":")}},t:function(t,e,s){const n=Math.trunc(+t/1e3);return Kt(n,e.length)},T:function(t,e,s){return Kt(+t,e.length)}};function i4(t,e=""){const s=t>0?"-":"+",n=Math.abs(t),r=Math.trunc(n/60),i=n%60;return i===0?s+String(r):s+String(r)+e+Kt(i,2)}function o4(t,e){return t%60===0?(t>0?"-":"+")+Kt(Math.abs(t)/60,2):_a(t,e)}function _a(t,e=""){const s=t>0?"-":"+",n=Math.abs(t),r=Kt(Math.trunc(n/60),2),i=Kt(n%60,2);return s+r+e+i}const a4=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},w7=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},IR=(t,e)=>{const s=t.match(/(P+)(p+)?/)||[],n=s[1],r=s[2];if(!r)return a4(t,e);let i;switch(n){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",a4(n,e)).replace("{{time}}",w7(r,e))},OR={p:w7,P:IR},$R=/^D+$/,BR=/^Y+$/,zR=["D","DD","YY","YYYY"];function FR(t){return $R.test(t)}function UR(t){return BR.test(t)}function HR(t,e,s){const n=KR(t,e,s);if(console.warn(n),zR.includes(t))throw new RangeError(n)}function KR(t,e,s){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const WR=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qR=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,GR=/^'([^]*?)'?$/,YR=/''/g,QR=/[a-zA-Z]/;function XR(t,e,s){const n=m9(),r=s?.locale??n.locale??BA,i=s?.firstWeekContainsDate??s?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=s?.weekStartsOn??s?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,l=xi(t,s?.in);if(!PR(l))throw new RangeError("Invalid time value");let c=e.match(qR).map(h=>{const u=h[0];if(u==="p"||u==="P"){const f=OR[u];return f(h,r.formatLong)}return h}).join("").match(WR).map(h=>{if(h==="''")return{isToken:!1,value:"'"};const u=h[0];if(u==="'")return{isToken:!1,value:JR(h)};if(r4[u])return{isToken:!0,value:h};if(u.match(QR))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return{isToken:!1,value:h}});r.localize.preprocessor&&(c=r.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:a,locale:r};return c.map(h=>{if(!h.isToken)return h.value;const u=h.value;(!s?.useAdditionalWeekYearTokens&&UR(u)||!s?.useAdditionalDayOfYearTokens&&FR(u))&&HR(u,e,String(t));const f=r4[u[0]];return f(l,u,r.localize,d)}).join("")}function JR(t){const e=t.match(GR);return e?e[1].replace(YR,"'"):t}const l4=3,S7="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",ZR="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function k7(t){const e=U.c(46),{item:s,onSelect:n,isLoading:r,isDisabled:i,variant:a}=t,l=a===void 0?"pill":a,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const S=$i(c._meta);d=c.title??R2(c.name,S),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const h=d,u=c.description||null;if(l==="card"){let S;e[4]!==n||e[5]!==c?(S=()=>n(c),e[4]=n,e[5]=c,e[6]=S):S=e[6];const k=i||r,j=r&&"bg-accent/40",N=(i||r)&&"cursor-not-allowed opacity-50";let V;e[7]!==j||e[8]!==N?(V=le(ZR,"hover:bg-accent/60 text-foreground",j,N),e[7]=j,e[8]=N,e[9]=V):V=e[9];let C;e[10]!==h?(C=o.jsx("span",{className:"font-medium truncate capitalize",children:h}),e[10]=h,e[11]=C):C=e[11];let T;e[12]!==r?(T=r&&o.jsx(nt,{size:"xs"}),e[12]=r,e[13]=T):T=e[13];let A;e[14]!==C||e[15]!==T?(A=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[C,T]}),e[14]=C,e[15]=T,e[16]=A):A=e[16];let R;e[17]!==u?(R=u&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:u}),e[17]=u,e[18]=R):R=e[18];let E;return e[19]!==A||e[20]!==R||e[21]!==S||e[22]!==k||e[23]!==V?(E=o.jsxs("button",{type:"button",onClick:S,disabled:k,className:V,children:[A,R]}),e[19]=A,e[20]=R,e[21]=S,e[22]=k,e[23]=V,e[24]=E):E=e[24],E}let f;e[25]!==n||e[26]!==c?(f=()=>n(c),e[25]=n,e[26]=c,e[27]=f):f=e[27];const m=i||r,p=r&&"bg-muted/50",g=(i||r)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=le(S7,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==h?(b=o.jsx("span",{className:"capitalize",children:h}),e[31]=h,e[32]=b):b=e[32];let v;e[33]!==r?(v=r&&o.jsx(nt,{size:"xs"}),e[33]=r,e[34]=v):v=e[34];let _;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==v?(_=o.jsx(Ke,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:f,disabled:m,className:x,children:[b,v]})}),e[35]=f,e[36]=m,e[37]=x,e[38]=b,e[39]=v,e[40]=_):_=e[40];const L=u??h;let y;e[41]!==L?(y=o.jsx(We,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:L})}),e[41]=L,e[42]=y):y=e[42];let w;return e[43]!==_||e[44]!==y?(w=o.jsxs(qe,{delayDuration:400,children:[_,y]}),e[43]=_,e[44]=y,e[45]=w):w=e[45],w}function eD(t){const e=U.c(61),{items:s,open:n,onOpenChange:r,onSelect:i,loadingPrompt:a}=t,l=ue(),[c,d]=P.useState(""),h=!!a;let u;e[0]!==s||e[1]!==c?(u=c.trim()?s.filter(C=>{const T=c.toLowerCase();return C.prompt.name.toLowerCase().includes(T)||(C.prompt.title??"").toLowerCase().includes(T)||(C.prompt.description??"").toLowerCase().includes(T)}):s,e[0]=s,e[1]=c,e[2]=u):u=e[2];const f=u,m=Ja();let p;e[3]!==f.length||e[4]!==c||e[5]!==l?(p=f.length===0&&o.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:l("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=f.length,e[4]=c,e[5]=l,e[6]=p):p=e[6];let g;if(e[7]!==f||e[8]!==h||e[9]!==a?.name||e[10]!==r||e[11]!==i){let C;e[13]!==h||e[14]!==a?.name||e[15]!==r||e[16]!==i?(C=T=>o.jsx(k7,{item:T,variant:"card",onSelect:A=>{r(!1),i(A)},isLoading:a?.name===T.prompt.name,isDisabled:h&&a?.name!==T.prompt.name},T.prompt.name),e[13]=h,e[14]=a?.name,e[15]=r,e[16]=i,e[17]=C):C=e[17],g=f.map(C),e[7]=f,e[8]=h,e[9]=a?.name,e[10]=r,e[11]=i,e[12]=g}else g=e[12];let x;e[18]!==p||e[19]!==g?(x=o.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[p,g]})}),e[18]=p,e[19]=g,e[20]=x):x=e[20];const b=x;let v;e[21]!==l?(v=l("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=l,e[22]=v):v=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=C=>{C.key==="Escape"&&d("")},e[23]=_):_=e[23];let L;e[24]!==c||e[25]!==v?(L=o.jsx(nT,{value:c,onChange:d,placeholder:v,onKeyDown:_}),e[24]=c,e[25]=v,e[26]=L):L=e[26];const y=L;if(m){let C;e[27]!==l?(C=l("chat.iceBreakers.allPromptsTitle"),e[27]=l,e[28]=C):C=e[28];let T;e[29]!==C?(T=o.jsx(tT,{className:"sr-only",children:o.jsx(I2,{children:C})}),e[29]=C,e[30]=T):T=e[30];let A;e[31]!==l?(A=l("chat.iceBreakers.promptsLabel"),e[31]=l,e[32]=A):A=e[32];let R;e[33]!==A?(R=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:A})}),e[33]=A,e[34]=R):R=e[34];let E;e[35]!==b||e[36]!==y||e[37]!==R||e[38]!==T?(E=o.jsxs(O2,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[T,R,y,b]}),e[35]=b,e[36]=y,e[37]=R,e[38]=T,e[39]=E):E=e[39];let I;return e[40]!==r||e[41]!==n||e[42]!==E?(I=o.jsx(Ko,{delayDuration:400,children:o.jsx($2,{open:n,onOpenChange:r,children:E})}),e[40]=r,e[41]=n,e[42]=E,e[43]=I):I=e[43],I}let w;e[44]!==l?(w=l("chat.iceBreakers.allPromptsTitle"),e[44]=l,e[45]=w):w=e[45];let S;e[46]!==w?(S=o.jsx(ls,{className:"sr-only",children:o.jsx(qt,{children:w})}),e[46]=w,e[47]=S):S=e[47];let k;e[48]!==l?(k=l("chat.iceBreakers.promptsLabel"),e[48]=l,e[49]=k):k=e[49];let j;e[50]!==k?(j=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:k})}),e[50]=k,e[51]=j):j=e[51];let N;e[52]!==b||e[53]!==y||e[54]!==j||e[55]!==S?(N=o.jsxs(Bt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,j,y,b]}),e[52]=b,e[53]=y,e[54]=j,e[55]=S,e[56]=N):N=e[56];let V;return e[57]!==r||e[58]!==n||e[59]!==N?(V=o.jsx(Ko,{delayDuration:400,children:o.jsx(zt,{open:n,onOpenChange:r,children:N})}),e[57]=r,e[58]=n,e[59]=N,e[60]=V):V=e[60],V}function tD(t){const e=U.c(30),{items:s,onSelect:n,loadingPrompt:r,className:i}=t,a=ue(),[l,c]=P.useState(!1);if(s.length===0)return null;let d,h,u,f,m;if(e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==n||e[4]!==a){const b=s.slice(0,l4),v=s.slice(l4),_=!!r;let L;e[10]!==_||e[11]!==r?.name||e[12]!==n?(L=w=>o.jsx(k7,{item:w,onSelect:n,isLoading:r?.name===w.prompt.name,isDisabled:_&&r?.name!==w.prompt.name},w.prompt.name),e[10]=_,e[11]=r?.name,e[12]=n,e[13]=L):L=e[13];const y=b.map(L);d=Ko,m=400,e[14]!==i?(h=le("w-full flex flex-wrap gap-2 justify-center",i),e[14]=i,e[15]=h):h=e[15],u=y,f=v.length>0&&o.jsx("button",{type:"button",disabled:_,onClick:()=>c(!0),className:le(S7,"hover:bg-muted/70 hover:text-foreground",_&&"opacity-50 cursor-not-allowed"),children:a("chat.iceBreakers.moreButton",{count:v.length})}),e[0]=i,e[1]=s,e[2]=r,e[3]=n,e[4]=a,e[5]=d,e[6]=h,e[7]=u,e[8]=f,e[9]=m}else d=e[5],h=e[6],u=e[7],f=e[8],m=e[9];let p;e[16]!==h||e[17]!==u||e[18]!==f?(p=o.jsxs("div",{className:h,children:[u,f]}),e[16]=h,e[17]=u,e[18]=f,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==r||e[22]!==l||e[23]!==n?(g=o.jsx(eD,{items:s,open:l,onOpenChange:c,onSelect:n,loadingPrompt:r}),e[20]=s,e[21]=r,e[22]=l,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==m||e[27]!==p||e[28]!==g?(x=o.jsxs(d,{delayDuration:m,children:[p,g]}),e[25]=d,e[26]=m,e[27]=p,e[28]=g,e[29]=x):x=e[29],x}function sD(){return null}function nD(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function rD(t){const e=U.c(31),{connectionId:s}=t,n=ue(),{sendMessage:r}=dr(),{org:i}=Fe();let a;e[0]!==s||e[1]!==i.id||e[2]!==i.slug?(a={connectionId:s,orgId:i.id,orgSlug:i.slug},e[0]=s,e[1]=i.id,e[2]=i.slug,e[3]=a):a=e[3];const l=Vn(a);let c;e[4]!==l?(c={client:l,staleTime:6e4},e[4]=l,e[5]=c):c=e[5];const{data:d}=E6(c);let h;e[6]!==d?.prompts?(h=d?.prompts??[],e[6]=d?.prompts,e[7]=h):h=e[7];const u=h;let f;e[8]!==u?(f=u.map(iD),e[8]=u,e[9]=f):f=e[9];const m=f;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=P.useReducer(nD,p),[b,v]=P.useState(null);let _;e[11]!==l||e[12]!==r||e[13]!==n?(_=async(A,R)=>{if(!l){ye.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const E=await Yf(l,A.name,R);x({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[E2({id:A.name,name:Hu(A.name,$i(A._meta)),metadata:E.messages,char:"/",kind:"prompt",args:R}),{type:"text",text:" "}]}]};await r(I)}catch(E){console.error("[ice-breakers] Failed to fetch prompt:",E),ye.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=l,e[12]=r,e[13]=n,e[14]=_):_=e[14];const L=_;let y;e[15]!==L?(y=async A=>{if(A.arguments&&A.arguments.length>0){x({type:"SELECT_PROMPT",prompt:A}),v(A);return}x({type:"START_LOADING",prompt:A}),await L(A)},e[15]=L,e[16]=y):y=e[16];const w=y;let S;e[17]!==b||e[18]!==L?(S=async A=>{b&&(x({type:"START_LOADING",prompt:b,arguments:A}),v(null),await L(b,A))},e[17]=b,e[18]=L,e[19]=S):S=e[19];const k=S;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let N;e[20]!==w||e[21]!==m||e[22]!==j?(N=o.jsx(tD,{items:m,onSelect:w,loadingPrompt:j}),e[20]=w,e[21]=m,e[22]=j,e[23]=N):N=e[23];let V;e[24]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{v(null),x({type:"RESET"})},e[24]=V):V=e[24];let C;e[25]!==b||e[26]!==k?(C=o.jsx(Uh,{prompt:b,setPrompt:V,onSubmit:k}),e[25]=b,e[26]=k,e[27]=C):C=e[27];let T;return e[28]!==N||e[29]!==C?(T=o.jsxs(o.Fragment,{children:[N,C]}),e[28]=N,e[29]=C,e[30]=T):T=e[30],T}function iD(t){return{prompt:t}}function oD(t){const e=U.c(13),{className:s}=t,{selectedVirtualMcp:n}=Za(),{org:r}=Fe();let i;e[0]!==r.id?(i=ia(r.id),e[0]=r.id,e[1]=i):i=e[1];const a=i.id,l=n?.id??a;let c;e[2]!==s?(c=le("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=l??"default";let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(sD,{}),e[4]=h):h=e[4];let u;e[5]!==l?(u=o.jsx(rD,{connectionId:l}),e[5]=l,e[6]=u):u=e[6];let f;e[7]!==d||e[8]!==u?(f=o.jsx(sn,{fallback:null,children:o.jsx(P.Suspense,{fallback:h,children:u},d)}),e[7]=d,e[8]=u,e[9]=f):f=e[9];let m;return e[10]!==c||e[11]!==f?(m=o.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}const _1="cubic-bezier(0.645, 0.045, 0.355, 1)",aD=44,lD={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-warning/5 after:pointer-events-none after:-z-10"},cD={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},dD={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Qo(t){const e=U.c(69),{icon:s,label:n,count:r,title:i,footerLeft:a,footerRight:l,children:c,defaultExpanded:d,variant:h,onClose:u}=t,f=h===void 0?"default":h,m=ue(),[p,g]=P.useState(d),[x,b]=P.useState(!1);let v;e[0]!==u?(v=()=>{b(!0),u?.()},e[0]=u,e[1]=v):v=e[1];const _=v;if(x)return null;const L=cD[f],y=lD[f];let w;e[2]!==L||e[3]!==y?(w=le("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",L,y),e[2]=L,e[3]=y,e[4]=w):w=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g(uD),e[5]=S):S=e[5];const k=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let N;e[6]!==k||e[7]!==j?(N=le("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",k,j),e[6]=k,e[7]=j,e[8]=N):N=e[8];const V=dD[f];let C;e[9]!==V?(C=le("shrink-0",V),e[9]=V,e[10]=C):C=e[10];let T;e[11]!==s||e[12]!==C?(T=o.jsx("span",{className:C,children:s}),e[11]=s,e[12]=C,e[13]=T):T=e[13];let A;e[14]!==n?(A=o.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=A):A=e[15];let R;e[16]!==r?(R=r?o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:r}):null,e[16]=r,e[17]=R):R=e[17];const E=p?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==E?(I=o.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:o.jsx(ds,{size:16,style:{transform:E,transition:`transform 180ms ${_1}`}})}),e[18]=E,e[19]=I):I=e[19];let D;e[20]!==m?(D=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=D):D=e[21];let O;e[22]!==m?(O=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=O):O=e[23];let $,M;e[24]!==_?($=ce=>{ce.stopPropagation(),_()},M=ce=>{(ce.key==="Enter"||ce.key===" ")&&(ce.preventDefault(),ce.stopPropagation(),_())},e[24]=_,e[25]=$,e[26]=M):($=e[25],M=e[26]);let z;e[27]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(nn,{size:16}),e[27]=z):z=e[27];let F;e[28]!==D||e[29]!==O||e[30]!==$||e[31]!==M?(F=o.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":D,title:O,onClick:$,onKeyDown:M,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:z}),e[28]=D,e[29]=O,e[30]=$,e[31]=M,e[32]=F):F=e[32];let B;e[33]!==p||e[34]!==T||e[35]!==A||e[36]!==R||e[37]!==I||e[38]!==F||e[39]!==N?(B=o.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:S,className:N,children:[T,A,R,I,F]}),e[33]=p,e[34]=T,e[35]=A,e[36]=R,e[37]=I,e[38]=F,e[39]=N,e[40]=B):B=e[40];const H=p?"1fr":"0fr";let W;e[41]!==H?(W={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${_1}`},e[41]=H,e[42]=W):W=e[42];let K;e[43]===Symbol.for("react.memo_cache_sentinel")?(K={overflow:"hidden",minHeight:0},e[43]=K):K=e[43];const q=p?1:0;let G;e[44]!==q?(G={opacity:q,transition:`opacity 120ms ${_1}`,maxHeight:"60vh"},e[44]=q,e[45]=G):G=e[45];let te;e[46]!==i?(te=i?o.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:o.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:i})}):o.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=i,e[47]=te):te=e[47];let X;e[48]!==c||e[49]!==i?(X=c?o.jsx("div",{className:le("pb-4",!i&&"pt-4"),children:c}):null,e[48]=c,e[49]=i,e[50]=X):X=e[50];let Z;e[51]!==te||e[52]!==X?(Z=o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[te,X]}),e[51]=te,e[52]=X,e[53]=Z):Z=e[53];let ee;e[54]!==a||e[55]!==l?(ee=a||l?o.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:a}),o.jsx("div",{className:"flex items-center gap-2",children:l})]})}):null,e[54]=a,e[55]=l,e[56]=ee):ee=e[56];let se;e[57]!==G||e[58]!==Z||e[59]!==ee?(se=o.jsx("div",{style:K,children:o.jsxs("div",{className:"flex flex-col",style:G,children:[Z,ee]})}),e[57]=G,e[58]=Z,e[59]=ee,e[60]=se):se=e[60];let J;e[61]!==W||e[62]!==se?(J=o.jsx("div",{"data-testid":"collapsible-highlight-body",style:W,children:se}),e[61]=W,e[62]=se,e[63]=J):J=e[63];let oe;return e[64]!==B||e[65]!==J||e[66]!==w||e[67]!==f?(oe=o.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:w,children:[B,J]}),e[64]=B,e[65]=J,e[66]=w,e[67]=f,e[68]=oe):oe=e[68],oe}function uD(t){return!t}const hD=Rt({content:Ae().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:cr(["pending","in_progress","completed"]),activeForm:Ae().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),j7=Rt({todos:ss(hD)}),fD="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";dT({description:fD,inputSchema:uT(j7),execute:async({todos:t})=>({ok:!0,count:t.length})});const mD="tool-todo_write",pD=new Set(["input-available","output-available"]);function gD(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const n=s.parts;if(Array.isArray(n))for(let r=n.length-1;r>=0;r--){const i=n[r];if(i.type!==mD||typeof i.state!="string"||!pD.has(i.state))continue;const a=j7.safeParse(i.input);if(a.success)return a.data.todos}}return[]}function C7(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const n="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:n,friendlyName:Hh(cV(n)),input:s.input})}return e}function N7(t){return t.at(-1)}function V7(t){const e=[];for(const s of t)s.type==="tool-propose_plan"&&s.state==="input-available"&&e.push({toolCallId:s.toolCallId,plan:s.input.plan,state:s.state});return e}function xD(t){return t?t.message.startsWith("[CREDITS]"):!1}const bD="[SUBSCRIPTION_REQUIRED]";function T7(t){return t?.message.startsWith(bD)?t.message.includes("used its free task executions")?"trial_exhausted":t.message.includes("used its monthly task executions")?"monthly_exhausted":t.message.includes("reached its execution limit")?"runs_exhausted":null:null}const vD={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function yD(t){const{messages:e,error:s,finishReason:n,isStreaming:r,isWaitingForApprovals:i}=t;if(!r&&s&&xD(s))return{...vD,isCreditExhausted:!0};const a=e.at(-1),l=a?.role==="assistant"?a.parts:[],c=l,h=!!c.filter(L=>L.type==="tool-user_ask").filter(L=>L.state!=="output-available").length,u=V7(l),f=C7(c),m=gD(e),p=r?null:T7(s),g=!r&&!!s&&!p,x=f.length>0||r&&i,b=u.length>0,_=!r&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(h||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:_,hasApprovals:x,hasPlans:b,isWaitingForUserInput:h,todos:m}}function P7(){const t=U.c(6),{messages:e,error:s,finishReason:n,isStreaming:r,isWaitingForApprovals:i}=dr(),a=s??null,l=n??null;let c;return t[0]!==r||t[1]!==i||t[2]!==e||t[3]!==a||t[4]!==l?(c=yD({messages:e,error:a,finishReason:l,isStreaming:r,isWaitingForApprovals:i}),t[0]=r,t[1]=i,t[2]=e,t[3]=a,t[4]=l,t[5]=c):c=t[5],c}function _D(){const t=P7();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function A7(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(s=>s.type==="hardBreak"||s.type==="text"&&(!s.text||s.text.trim()==="")):!1)}const LD="__home__";function Vg(t,e){return Ff.chatDraft(t,e)}function wD(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const s=e.tiptapDoc;return!s||typeof s!="object"||s.type!=="doc"||!Array.isArray(s.content)?null:s}function E7(t,e,s,n,r){const i=Vg(e,s);if(A7(n)){t.removeItem(i);return}const a={tiptapDoc:n,updatedAt:Date.now()},l=JSON.stringify(a);try{t.setItem(i,l)}catch(c){if(kD(c)){const d=new TextEncoder().encode(l).byteLength;r?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function c4(t,e,s){const n=Vg(e,s),r=t.getItem(n),i=wD(r);return r!==null&&i===null&&t.removeItem(n),i}function SD(t,e,s){t.removeItem(Vg(e,s))}function kD(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function _n(t){const e=U.c(14),s=Vs(t),n=ws(),r=s?.metadata,i=n?.activeTask,a=i?.metadata?.runtime;let l;e[0]!==a?(l=vT(a),e[0]=a,e[1]=l):l=e[1];const c=l,d=!!i&&!i.partial,h=i?.metadata;let u;e[2]!==r||e[3]!==h?(u=M6(h,r),e[2]=r,e[3]=h,e[4]=u):u=e[4];const f=!!c||d&&!!s;let m;e[5]!==r?(m=Jf(r),e[5]=r,e[6]=m):m=e[6];let p;e[7]!==r?(p=F2(r),e[7]=r,e[8]=p):p=e[8];let g;return e[9]!==u||e[10]!==f||e[11]!==m||e[12]!==p?(g={runtime:u,resolved:f,projectDefault:m,previewServerUrl:p},e[9]=u,e[10]=f,e[11]=m,e[12]=p,e[13]=g):g=e[13],g}function jD(t){const e=U.c(30),{current:s,total:n,onPrev:r,onNext:i}=t,a=ue();if(n<=1)return null;const l=s===0,c=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=le("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let h;e[2]!==a?(h=a("chat.pagination.previousLabel"),e[2]=a,e[3]=h):h=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(n9,{size:14}),e[4]=u):u=e[4];let f;e[5]!==r||e[6]!==l||e[7]!==d||e[8]!==h?(f=o.jsx("button",{type:"button",onClick:r,disabled:l,className:d,"aria-label":h,children:u}),e[5]=r,e[6]=l,e[7]=d,e[8]=h,e[9]=f):f=e[9];const m=s+1;let p;e[10]!==a||e[11]!==m||e[12]!==n?(p=a("chat.pagination.counter",{current:m,total:n}),e[10]=a,e[11]=m,e[12]=n,e[13]=p):p=e[13];let g;e[14]!==p?(g=o.jsx("span",{className:"tabular-nums text-xs",children:p}),e[14]=p,e[15]=g):g=e[15];const x=s===n-1,b=s===n-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let v;e[16]!==b?(v=le("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=v):v=e[17];let _;e[18]!==a?(_=a("chat.pagination.nextLabel"),e[18]=a,e[19]=_):_=e[19];let L;e[20]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(ro,{size:14}),e[20]=L):L=e[20];let y;e[21]!==i||e[22]!==x||e[23]!==v||e[24]!==_?(y=o.jsx("button",{type:"button",onClick:i,disabled:x,className:v,"aria-label":_,children:L}),e[21]=i,e[22]=x,e[23]=v,e[24]=_,e[25]=y):y=e[25];let w;return e[26]!==y||e[27]!==f||e[28]!==g?(w=o.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[f,g,y]}),e[26]=y,e[27]=f,e[28]=g,e[29]=w):w=e[29],w}function R7(t){const e=U.c(8),{currentIndex:s,total:n,onPrev:r,onNext:i,extraLeft:a}=t;let l;e[0]!==s||e[1]!==i||e[2]!==r||e[3]!==n?(l=o.jsx(jD,{current:s,total:n,onPrev:r,onNext:i}),e[0]=s,e[1]=i,e[2]=r,e[3]=n,e[4]=l):l=e[4];let c;return e[5]!==a||e[6]!==l?(c=o.jsxs("div",{className:"flex items-center gap-2",children:[l,a]}),e[5]=a,e[6]=l,e[7]=c):c=e[7],c}function CD(t){const e=U.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:r,onAdvanceOrSubmit:i,submitLabel:a,nextLabel:l}=t,h=n?a===void 0?"Submit":a:l===void 0?"Next":l,u=n?s:!r,f=u?n?"Waiting for the assistant to finish…":"Answer this item to continue":null;let m;e[0]!==u||e[1]!==i?(m=()=>{u||i()},e[0]=u,e[1]=i,e[2]=m):m=e[2];const p=u&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=le("h-7 px-2.5 text-xs",p),e[3]=p,e[4]=g):g=e[4];let x;e[5]!==u||e[6]!==h||e[7]!==m||e[8]!==g?(x=o.jsx(me,{type:"button",size:"sm","aria-disabled":u,onClick:m,className:g,children:h}),e[5]=u,e[6]=h,e[7]=m,e[8]=g,e[9]=x):x=e[9];const b=x;if(!f)return b;let v;e[10]!==b?(v=o.jsx(Ke,{asChild:!0,children:b}),e[10]=b,e[11]=v):v=e[11];let _;e[12]!==f?(_=o.jsx(We,{children:f}),e[12]=f,e[13]=_):_=e[13];let L;return e[14]!==v||e[15]!==_?(L=o.jsxs(qe,{children:[v,_]}),e[14]=v,e[15]=_,e[16]=L):L=e[16],L}function D7(t,e,s){return t.findIndex(n=>e(n)===s)}function d4(t,e,s,n){return t.length===0?!1:t.every(r=>n(s[e(r)]))}function u4(t,e,s,n,r){if(t.length===0)return null;const i=D7(t,e,r);for(let a=1;a<=t.length;a++){const l=t[(i+a)%t.length];if(!l)continue;const c=e(l);if(c!==r&&!n(s[c]))return c}return null}function ND(t){return!t.isStreaming&&t.allAnswered}function M7(t){const{parts:e,partKey:s,schema:n,defaultValues:r,isStreaming:i,hasAnswer:a,onSubmit:l}=t,c=e[0]?s(e[0]):"",[d,h]=P.useState(c),[u,f]=P.useState(!1),m=j2({resolver:Zy(n),defaultValues:r}),p=m.watch(),g=D7(e,s,d),x=g>=0?e[g]:void 0,b=a(p[d]),v=d4(e,s,p,a),_=ND({isStreaming:i,allAnswered:v}),L=()=>{if(g>0){const V=e[g-1];V&&h(s(V))}},y=()=>{if(g>=0&&g<e.length-1){const V=e[g+1];V&&h(s(V))}},w=()=>{const V=m.getValues(),C=u4(e,s,V,a,d);C&&h(C)},S=()=>{m.handleSubmit(V=>{const C=V;for(const T of e)l(T,C[s(T)])})()},k=P.useRef(S);k.current=S;const j=()=>{_&&(f(!1),k.current())},N=()=>{const V=m.getValues();if(d4(e,s,V,a)){if(i){f(!0);return}f(!1),k.current()}else{const C=u4(e,s,V,a,d);C&&h(C)}};return P.useEffect(()=>{if(u&&!i){if(!v){f(!1);return}f(!1),k.current()}},[u,i,v]),{form:m,activeKey:d,setActiveKey:h,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:v,canSubmit:_,goPrev:L,goNext:y,advanceToNextUnanswered:w,submit:j,submitOrAdvance:N}}const I7="chat.approval.defaultDenyReason";function O7(t){const e=U.c(36),{onYolo:s}=t,n=ue(),[r,i]=no();let a,l,c,d,h,u,f,m,p;if(e[0]!==s||e[1]!==r||e[2]!==i||e[3]!==n){const L=ka.find(S=>S.value===r.toolApprovalLevel)??ka[0];let y;e[13]!==s||e[14]!==r||e[15]!==i?(y=S=>{const k=S,j=r.toolApprovalLevel??"readonly";i({...r,toolApprovalLevel:k}),k==="auto"&&s(j)},e[13]=s,e[14]=r,e[15]=i,e[16]=y):y=e[16];const w=y;c=xs,m=r.toolApprovalLevel,p=w,l=bs,h="xs",u="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",f=VD,a=js,d=n(L.shortKey),e[0]=s,e[1]=r,e[2]=i,e[3]=n,e[4]=a,e[5]=l,e[6]=c,e[7]=d,e[8]=h,e[9]=u,e[10]=f,e[11]=m,e[12]=p}else a=e[4],l=e[5],c=e[6],d=e[7],h=e[8],u=e[9],f=e[10],m=e[11],p=e[12];let g;e[17]!==a||e[18]!==d?(g=o.jsx(a,{children:d}),e[17]=a,e[18]=d,e[19]=g):g=e[19];let x;e[20]!==l||e[21]!==h||e[22]!==u||e[23]!==f||e[24]!==g?(x=o.jsx(l,{size:h,className:u,onClick:f,children:g}),e[20]=l,e[21]=h,e[22]=u,e[23]=f,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==n?(b=ka.map(L=>o.jsx(It,{value:L.value,children:n(L.labelKey)},L.value)),e[26]=n,e[27]=b):b=e[27];let v;e[28]!==b?(v=o.jsx(vs,{children:b}),e[28]=b,e[29]=v):v=e[29];let _;return e[30]!==c||e[31]!==v||e[32]!==m||e[33]!==p||e[34]!==x?(_=o.jsxs(c,{value:m,onValueChange:p,children:[x,v]}),e[30]=c,e[31]=v,e[32]=m,e[33]=p,e[34]=x,e[35]=_):_=e[35],_}function VD(t){return t.stopPropagation()}function $7(t){const e=U.c(8),{input:s}=t,n=ue();if(s==null){let a;e[0]!==n?(a=n("chat.approval.noInput"),e[0]=n,e[1]=a):a=e[1];let l;return e[2]!==a?(l=o.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:a}),e[2]=a,e[3]=l):l=e[3],l}let r;try{let a;e[4]!==s?(a=JSON.stringify(s,null,2),e[4]=s,e[5]=a):a=e[5],r=a}catch{r=String(s)}let i;return e[6]!==r?(i=o.jsx("div",{className:"px-4",children:o.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:r})}),e[6]=r,e[7]=i):i=e[7],i}function TD(t){const e=U.c(38),{approval:s,onRespond:n}=t,r=ue(),[i]=no(),a=i.toolApprovalLevel??"readonly";let l;e[0]!==s.approvalId||e[1]!==a||e[2]!==n||e[3]!==r?(l=()=>n(s.approvalId,!1,r(I7),a),e[0]=s.approvalId,e[1]=a,e[2]=n,e[3]=r,e[4]=l):l=e[4];const c=l;let d;e[5]!==s.approvalId||e[6]!==a||e[7]!==n?(d=()=>n(s.approvalId,!0,void 0,a),e[5]=s.approvalId,e[6]=a,e[7]=n,e[8]=d):d=e[8];const h=d;let u;e[9]!==s.approvalId||e[10]!==n?(u=j=>n(s.approvalId,!0,void 0,j),e[9]=s.approvalId,e[10]=n,e[11]=u):u=e[11];const f=u;let m;e[12]!==f?(m=o.jsx("div",{className:"flex items-center gap-2",children:o.jsx(O7,{onYolo:f})}),e[12]=f,e[13]=m):m=e[13];const p=m;let g;e[14]!==r?(g=r("chat.approval.denyButton"),e[14]=r,e[15]=g):g=e[15];let x;e[16]!==c||e[17]!==g?(x=o.jsx(me,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:g}),e[16]=c,e[17]=g,e[18]=x):x=e[18];let b;e[19]!==r?(b=r("chat.approval.acceptButton"),e[19]=r,e[20]=b):b=e[20];let v;e[21]!==h||e[22]!==b?(v=o.jsx(me,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:h,children:b}),e[21]=h,e[22]=b,e[23]=v):v=e[23];let _;e[24]!==x||e[25]!==v?(_=o.jsxs(o.Fragment,{children:[x,v]}),e[24]=x,e[25]=v,e[26]=_):_=e[26];const L=_;let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Zf,{size:14}),e[27]=y):y=e[27];let w;e[28]!==r?(w=r("chat.approval.needsApproval"),e[28]=r,e[29]=w):w=e[29];let S;e[30]!==s.input?(S=o.jsx($7,{input:s.input}),e[30]=s.input,e[31]=S):S=e[31];let k;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==L||e[35]!==w||e[36]!==S?(k=o.jsx(Qo,{icon:y,label:w,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:L,children:S}),e[32]=s.friendlyName,e[33]=p,e[34]=L,e[35]=w,e[36]=S,e[37]=k):k=e[37],k}const PD=yu(Ae(),Rt({approved:ci().optional(),levelOverride:cr(["auto","readonly"]).optional()}));function AD(t){const e=U.c(46),{approvals:s,isStreaming:n,onRespond:r}=t,i=ue(),[a]=no(),l=a.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(DD)),e[0]=s,e[1]=c):c=e[1];const d=c;let h;e[2]!==l||e[3]!==r||e[4]!==i?(h=(C,T)=>{const A=T;typeof A?.approved=="boolean"&&r(C.approvalId,A.approved,A.approved===!1?i(I7):void 0,A.levelOverride??l)},e[2]=l,e[3]=r,e[4]=i,e[5]=h):h=e[5];let u;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==h?(u={parts:s,partKey:RD,schema:PD,defaultValues:d,isStreaming:n,hasAnswer:ED,onSubmit:h},e[6]=s,e[7]=d,e[8]=n,e[9]=h,e[10]=u):u=e[10];const f=M7(u);let m;e[11]!==s||e[12]!==f?(m=C=>{f.form.reset(Object.fromEntries(s.map(T=>[T.approvalId,{approved:!0,levelOverride:C}]))),f.submitOrAdvance()},e[11]=s,e[12]=f,e[13]=m):m=e[13];const p=m,g=f.currentPart,x=f.form;let b;e[14]!==f?(b=C=>{C.preventDefault(),f.submit()},e[14]=f,e[15]=b):b=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(Zf,{size:14}),e[16]=v):v=e[16];let _;e[17]!==s.length||e[18]!==i?(_=i("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=i,e[19]=_):_=e[19];const L=g?.friendlyName??"";let y;e[20]!==p?(y=o.jsx(O7,{onYolo:p}),e[20]=p,e[21]=y):y=e[21];let w;e[22]!==s.length||e[23]!==f.currentIndex||e[24]!==f.goNext||e[25]!==f.goPrev||e[26]!==y?(w=o.jsx(R7,{currentIndex:f.currentIndex,total:s.length,onPrev:f.goPrev,onNext:f.goNext,extraLeft:y}),e[22]=s.length,e[23]=f.currentIndex,e[24]=f.goNext,e[25]=f.goPrev,e[26]=y,e[27]=w):w=e[27];let S;e[28]!==g||e[29]!==f.form.control||e[30]!==f.submitOrAdvance?(S=g?o.jsx(MD,{approvalId:g.approvalId,control:f.form.control,onChange:f.submitOrAdvance}):null,e[28]=g,e[29]=f.form.control,e[30]=f.submitOrAdvance,e[31]=S):S=e[31];let k;e[32]!==g?(k=g?o.jsx($7,{input:g.input}):null,e[32]=g,e[33]=k):k=e[33];let j;e[34]!==w||e[35]!==S||e[36]!==k||e[37]!==_||e[38]!==L?(j=o.jsx(Qo,{icon:v,label:_,title:L,defaultExpanded:!0,footerLeft:w,footerRight:S,children:k}),e[34]=w,e[35]=S,e[36]=k,e[37]=_,e[38]=L,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==b?(N=o.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=N):N=e[42];let V;return e[43]!==f.form||e[44]!==N?(V=o.jsx(Im,{...x,children:N}),e[43]=f.form,e[44]=N,e[45]=V):V=e[45],V}function ED(t){return typeof t?.approved=="boolean"}function RD(t){return t.approvalId}function DD(t){return[t.approvalId,{approved:void 0}]}function MD(t){const e=U.c(7),{approvalId:s,control:n,onChange:r}=t,i=ue(),a=`${s}.approved`;let l;e[0]!==r||e[1]!==i?(l=d=>{const{field:h}=d,u=h.value===!0,f=h.value===!1;return o.jsxs(o.Fragment,{children:[o.jsx(me,{type:"button",variant:f?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{h.onChange(!1),r()},"aria-pressed":f,children:i("chat.approval.denyButton")}),o.jsx(me,{type:"button",variant:u?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{h.onChange(!0),r()},"aria-pressed":u,children:i("chat.approval.acceptButton")})]})},e[0]=r,e[1]=i,e[2]=l):l=e[2];let c;return e[3]!==n||e[4]!==a||e[5]!==l?(c=o.jsx(ps,{control:n,name:a,render:l}),e[3]=n,e[4]=a,e[5]=l,e[6]=c):c=e[6],c}function ID(){const t=U.c(5),e=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Zf,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.approval.preparingRequest"),t[1]=e,t[2]=n):n=t[2];let r;return t[3]!==n?(r=o.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,o.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=r):r=t[4],r}function OD(t){const e=U.c(8),{approvals:s,isStreaming:n,onRespond:r}=t;if(n&&s.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(ID,{}),e[0]=a):a=e[0],a}if(s.length===0)return null;if(s.length===1){const a=s[0];if(!a)return null;let l;return e[1]!==r||e[2]!==a?(l=o.jsx(TD,{approval:a,onRespond:r}),e[1]=r,e[2]=a,e[3]=l):l=e[3],l}let i;return e[4]!==s||e[5]!==n||e[6]!==r?(i=o.jsx(AD,{approvals:s,isStreaming:n,onRespond:r}),e[4]=s,e[5]=n,e[6]=r,e[7]=i):i=e[7],i}function $D(t){const e=U.c(28),{plan:s,onApprove:n,onDismiss:r}=t,i=ue();let a;e[0]!==n||e[1]!==s.plan?(a=()=>{n(s.plan)},e[0]=n,e[1]=s.plan,e[2]=a):a=e[2];const l=a;let c;e[3]!==i?(c=i("chat.proposePlan.keepIterating"),e[3]=i,e[4]=c):c=e[4];let d;e[5]!==r||e[6]!==c?(d=o.jsx(me,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:r,children:c}),e[5]=r,e[6]=c,e[7]=d):d=e[7];let h;e[8]!==i?(h=i("chat.proposePlan.letsGo"),e[8]=i,e[9]=h):h=e[9];let u;e[10]!==l||e[11]!==h?(u=o.jsx(me,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:l,children:h}),e[10]=l,e[11]=h,e[12]=u):u=e[12];let f;e[13]!==d||e[14]!==u?(f=o.jsxs(o.Fragment,{children:[d,u]}),e[13]=d,e[14]=u,e[15]=f):f=e[15];const m=f;let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(I6,{size:14}),e[16]=p):p=e[16];let g;e[17]!==i?(g=i("chat.proposePlan.planReady"),e[17]=i,e[18]=g):g=e[18];let x;e[19]!==i?(x=i("chat.proposePlan.implementationPlan"),e[19]=i,e[20]=x):x=e[20];let b;e[21]!==s.plan?(b=o.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:o.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:o.jsx(dV,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=b):b=e[22];let v;return e[23]!==m||e[24]!==b||e[25]!==g||e[26]!==x?(v=o.jsx(Qo,{icon:p,label:g,title:x,defaultExpanded:!0,footerRight:m,children:b}),e[23]=m,e[24]=b,e[25]=g,e[26]=x,e[27]=v):v=e[27],v}function BD(t){const e=U.c(6),{plans:s,onApprove:n,onDismiss:r}=t;let i;e[0]!==s?(i=N7(s),e[0]=s,e[1]=i):i=e[1];const a=i;if(!a)return null;let l;return e[2]!==a||e[3]!==n||e[4]!==r?(l=o.jsx($D,{plan:a,onApprove:n,onDismiss:r}),e[2]=a,e[3]=n,e[4]=r,e[5]=l):l=e[5],l}function B7(t){return t?"response"in t?t.response:t.option??t.draft:""}const h4=Rt({response:Ae().min(1,"Response is required")}),zD=Rt({option:Ae().nullable(),draft:Ae()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),FD=Rt({response:cr(["yes","no"])});function UD(t){switch(t.type){case"text":return h4;case"choice":return zD;case"confirm":return FD;default:return h4}}function HD(t){const e={};for(const s of t)e[s.toolCallId]=UD(s.input);return Rt(e)}function KD(t){const e=U.c(7),{control:s,name:n,placeholder:r}=t,i=ue();let a;e[0]!==r||e[1]!==i?(a=c=>{const{field:d}=c,h=d.value??"";return o.jsxs(J2,{children:[o.jsx(Z2,{children:o.jsx("div",{className:"px-2",children:o.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[o.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:o.jsx(U2,{size:16,className:"text-muted-foreground"})}),o.jsx("input",{...d,value:h,type:"text",placeholder:r||i("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":i("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),o.jsx(eg,{})]})},e[0]=r,e[1]=i,e[2]=a):a=e[2];let l;return e[3]!==s||e[4]!==n||e[5]!==a?(l=o.jsx(n8,{control:s,name:n,render:a}),e[3]=s,e[4]=n,e[5]=a,e[6]=l):l=e[6],l}function z7(t,e){const s=U.c(4);let n,r;s[0]!==t||s[1]!==e?(n=()=>{const i=a=>{const l=a.target.tagName;if(l==="INPUT"||l==="TEXTAREA"||a.metaKey||a.ctrlKey||a.altKey)return;const c=Number.parseInt(a.key,10);c>=1&&c<=t&&(a.preventDefault(),e(c-1))};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},r=[t,e],s[0]=t,s[1]=e,s[2]=n,s[3]=r):(n=s[2],r=s[3]),P.useEffect(n,r)}function WD(t){const e=U.c(51),{control:s,name:n,options:r}=t,i=ue(),a=`${n}.option`;let l;e[0]!==s||e[1]!==a?(l={control:s,name:a,defaultValue:null},e[0]=s,e[1]=a,e[2]=l):l=e[2];const{field:c}=Dx(l),d=`${n}.draft`;let h;e[3]!==s||e[4]!==d?(h={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=h):h=e[5];const{field:u}=Dx(h),f=c.value,m=u.value??"";let p;if(e[6]!==c||e[7]!==r?(p=E=>{const I=r[E];I!=null&&c.onChange(I)},e[6]=c,e[7]=r,e[8]=p):p=e[8],z7(r.length,p),r.length===0)return null;const g=f===null;let x;e[9]!==i?(x=i("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=i,e[10]=x):x=e[10];let b;if(e[11]!==c||e[12]!==f||e[13]!==r||e[14]!==i){let E;e[16]!==c||e[17]!==f||e[18]!==i?(E=(I,D)=>{const O=f===I;return o.jsxs("button",{type:"button",onClick:()=>c.onChange(I),className:le("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",O&&"bg-accent/50",!O&&"hover:bg-accent/30"),"aria-label":i("chat.userAskQuestion.selectOption",{option:I}),children:[o.jsx("span",{className:le("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",O?"bg-chart-1 text-white":"bg-muted text-foreground"),children:D+1}),o.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:I})]},`${D}-${I}`)},e[16]=c,e[17]=f,e[18]=i,e[19]=E):E=e[19],b=r.map(E),e[11]=c,e[12]=f,e[13]=r,e[14]=i,e[15]=b}else b=e[15];const v=g&&"bg-accent/50",_=!g&&"hover:bg-accent/30";let L;e[20]!==v||e[21]!==_?(L=le("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",v,_),e[20]=v,e[21]=_,e[22]=L):L=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:o.jsx(U2,{size:16,className:"text-muted-foreground"})}),e[23]=y):y=e[23];const w=g?m:"";let S;e[24]!==u||e[25]!==c||e[26]!==f?(S=E=>{u.onChange(E.target.value),f!==null&&c.onChange(null)},e[24]=u,e[25]=c,e[26]=f,e[27]=S):S=e[27];let k;e[28]!==c||e[29]!==f?(k=()=>{f!==null&&c.onChange(null)},e[28]=c,e[29]=f,e[30]=k):k=e[30];let j;e[31]!==i?(j=i("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=i,e[32]=j):j=e[32];let N;e[33]!==i?(N=i("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=i,e[34]=N):N=e[34];let V;e[35]!==w||e[36]!==S||e[37]!==k||e[38]!==j||e[39]!==N?(V=o.jsx("input",{type:"text",value:w,onChange:S,onFocus:k,placeholder:j,"aria-label":N,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=w,e[36]=S,e[37]=k,e[38]=j,e[39]=N,e[40]=V):V=e[40];let C;e[41]!==L||e[42]!==V?(C=o.jsxs("label",{className:L,children:[y,V]}),e[41]=L,e[42]=V,e[43]=C):C=e[43];let T;e[44]!==C||e[45]!==x||e[46]!==b?(T=o.jsx(Z2,{children:o.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,C]})}),e[44]=C,e[45]=x,e[46]=b,e[47]=T):T=e[47];let A;e[48]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(eg,{}),e[48]=A):A=e[48];let R;return e[49]!==T?(R=o.jsxs(J2,{children:[T,A]}),e[49]=T,e[50]=R):R=e[50],R}function qD(t){const e=U.c(8),{control:s,name:n}=t,r=ue();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["yes","no"],e[0]=i):i=e[0];const a=i,l=P.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u=>{l.current?.onChange(a[u]??"")},e[1]=c):c=e[1],z7(a.length,c);let d;e[2]!==r?(d=u=>{const{field:f}=u;return l.current=f,o.jsxs(J2,{children:[o.jsx(Z2,{children:o.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":r("chat.userAskQuestion.confirmationOptionsAriaLabel"),children:a.map(m=>{const p=f.value===m;return o.jsxs("button",{type:"button",onClick:()=>f.onChange(m),className:le("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",p&&"bg-accent/50",!p&&"hover:bg-accent/30"),"aria-label":r("chat.userAskQuestion.confirmValue",{value:r(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)}),children:[o.jsx("span",{className:le("flex items-center justify-center size-6 rounded-md text-sm shrink-0",p?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),o.jsx("span",{className:"text-sm text-foreground capitalize",children:r(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)})]},m)})})}),o.jsx(eg,{})]})},e[2]=r,e[3]=d):d=e[3];let h;return e[4]!==s||e[5]!==n||e[6]!==d?(h=o.jsx(n8,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=h):h=e[7],h}function f4(t){const e=U.c(13),{input:s,control:n,toolCallId:r}=t;switch(s.type){case"text":{const i=`${r}.response`;let a;return e[0]!==n||e[1]!==s.default||e[2]!==i?(a=o.jsx(KD,{control:n,name:i,placeholder:s.default}),e[0]=n,e[1]=s.default,e[2]=i,e[3]=a):a=e[3],a}case"choice":{let i;e[4]!==s.options?(i=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=i):i=e[5];const a=i;let l;return e[6]!==n||e[7]!==a||e[8]!==r?(l=o.jsx(WD,{control:n,name:r,options:a}),e[6]=n,e[7]=a,e[8]=r,e[9]=l):l=e[9],l}case"confirm":{const i=`${r}.response`;let a;return e[10]!==n||e[11]!==i?(a=o.jsx(qD,{control:n,name:i}),e[10]=n,e[11]=i,e[12]=a):a=e[12],a}default:return null}}function GD(t){const e=U.c(91),{parts:s,isStreaming:n,onSubmit:r}=t;let i;e[0]!==s?(i=HD(s.map(JD)),e[0]=s,e[1]=i):i=e[1];const a=i;let l;e[2]!==s?(l=Object.fromEntries(s.map(XD)),e[2]=s,e[3]=l):l=e[3];const c=l;let d;e[4]!==r?(d=(M,z)=>{const F=B7(z);F&&r(M,F)},e[4]=r,e[5]=d):d=e[5];let h;e[6]!==c||e[7]!==n||e[8]!==s||e[9]!==a||e[10]!==d?(h={parts:s,partKey:QD,schema:a,defaultValues:c,isStreaming:n,hasAnswer:YD,onSubmit:d},e[6]=c,e[7]=n,e[8]=s,e[9]=a,e[10]=d,e[11]=h):h=e[11];const u=M7(h),f=u.currentPart,m=ue();let p;e[12]!==f||e[13]!==u||e[14]!==m?(p=()=>{const M=f;if(!M)return;const z=m("chat.userAskQuestion.skipMessage"),F=M.toolCallId;M.input?.type==="choice"?(u.form.setValue(`${F}.option`,null),u.form.setValue(`${F}.draft`,z)):u.form.setValue(`${F}.response`,z),u.advanceToNextUnanswered()},e[12]=f,e[13]=u,e[14]=m,e[15]=p):p=e[15];const g=p;let x;e[16]!==u.currentIndex||e[17]!==u.goNext||e[18]!==u.goPrev||e[19]!==s.length?(x=o.jsx(R7,{currentIndex:u.currentIndex,total:s.length,onPrev:u.goPrev,onNext:u.goNext}),e[16]=u.currentIndex,e[17]=u.goNext,e[18]=u.goPrev,e[19]=s.length,e[20]=x):x=e[20];const b=x;let v;e[21]!==m?(v=m("chat.userAskQuestion.skip"),e[21]=m,e[22]=v):v=e[22];let _;e[23]!==g||e[24]!==v?(_=o.jsx(me,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:v}),e[23]=g,e[24]=v,e[25]=_):_=e[25];let L;e[26]!==u.isAllAnswered||e[27]!==u.isCurrentAnswered||e[28]!==u.submitOrAdvance||e[29]!==n?(L=o.jsx(CD,{isStreaming:n,isAllAnswered:u.isAllAnswered,isCurrentAnswered:u.isCurrentAnswered,onAdvanceOrSubmit:u.submitOrAdvance}),e[26]=u.isAllAnswered,e[27]=u.isCurrentAnswered,e[28]=u.submitOrAdvance,e[29]=n,e[30]=L):L=e[30];let y;e[31]!==_||e[32]!==L?(y=o.jsxs(o.Fragment,{children:[_,L]}),e[31]=_,e[32]=L,e[33]=y):y=e[33];const w=y;if(s.length===1){const M=s[0];if(!M?.input)return null;const z=u.form;let F;e[34]!==u?(F=Z=>{Z.preventDefault(),u.submit()},e[34]=u,e[35]=F):F=e[35];let B;e[36]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(Om,{size:14}),e[36]=B):B=e[36];let H;e[37]!==m?(H=m("chat.userAskQuestion.questionPending"),e[37]=m,e[38]=H):H=e[38];let W;e[39]!==M.input?.prompt||e[40]!==m?(W=M.input?.prompt??m("chat.userAskQuestion.question"),e[39]=M.input?.prompt,e[40]=m,e[41]=W):W=e[41];const K=M.input;let q;e[42]!==u.form.control||e[43]!==M.toolCallId||e[44]!==K?(q=o.jsx(f4,{input:K,control:u.form.control,toolCallId:M.toolCallId}),e[42]=u.form.control,e[43]=M.toolCallId,e[44]=K,e[45]=q):q=e[45];let G;e[46]!==w||e[47]!==H||e[48]!==W||e[49]!==q?(G=o.jsx(Qo,{icon:B,label:H,title:W,defaultExpanded:!0,footerRight:w,children:q}),e[46]=w,e[47]=H,e[48]=W,e[49]=q,e[50]=G):G=e[50];let te;e[51]!==F||e[52]!==G?(te=o.jsx("form",{onSubmit:F,autoComplete:"off",children:G}),e[51]=F,e[52]=G,e[53]=te):te=e[53];let X;return e[54]!==u.form||e[55]!==te?(X=o.jsx(Im,{...z,children:te}),e[54]=u.form,e[55]=te,e[56]=X):X=e[56],X}const S=u.form;let k;e[57]!==u?(k=M=>{M.preventDefault(),u.submit()},e[57]=u,e[58]=k):k=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(Om,{size:14}),e[59]=j):j=e[59];let N;e[60]!==m?(N=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=N):N=e[61];const V=u.currentIndex+1;let C;e[62]!==s.length||e[63]!==m||e[64]!==V?(C=m("chat.userAskQuestion.questionCount",{current:V,total:s.length}),e[62]=s.length,e[63]=m,e[64]=V,e[65]=C):C=e[65];let T;e[66]!==f?.input?.prompt||e[67]!==m?(T=f?.input?.prompt??m("chat.userAskQuestion.question"),e[66]=f?.input?.prompt,e[67]=m,e[68]=T):T=e[68];const A=u.activeKey,R=u.setActiveKey;let E;if(e[69]!==u.form||e[70]!==s){let M;e[72]!==u.form?(M=z=>o.jsx(Aa,{value:z.toolCallId,className:"mt-0",children:o.jsx(f4,{input:z.input,control:u.form.control,toolCallId:z.toolCallId})},z.toolCallId),e[72]=u.form,e[73]=M):M=e[73],E=s.map(M),e[69]=u.form,e[70]=s,e[71]=E}else E=e[71];let I;e[74]!==u.activeKey||e[75]!==u.setActiveKey||e[76]!==E?(I=o.jsx(nl,{value:A,onValueChange:R,children:E}),e[74]=u.activeKey,e[75]=u.setActiveKey,e[76]=E,e[77]=I):I=e[77];let D;e[78]!==b||e[79]!==w||e[80]!==N||e[81]!==C||e[82]!==T||e[83]!==I?(D=o.jsx(Qo,{icon:j,label:N,count:C,title:T,defaultExpanded:!0,footerLeft:b,footerRight:w,children:I}),e[78]=b,e[79]=w,e[80]=N,e[81]=C,e[82]=T,e[83]=I,e[84]=D):D=e[84];let O;e[85]!==k||e[86]!==D?(O=o.jsx("form",{onSubmit:k,autoComplete:"off",children:D}),e[85]=k,e[86]=D,e[87]=O):O=e[87];let $;return e[88]!==u.form||e[89]!==O?($=o.jsx(Im,{...S,children:O}),e[88]=u.form,e[89]=O,e[90]=$):$=e[90],$}function YD(t){return!!B7(t)}function QD(t){return t.toolCallId}function XD(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function JD(t){return{toolCallId:t.toolCallId,input:t.input}}function ZD(){const t=U.c(5),e=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Om,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.userAskQuestion.preparingQuestion"),t[1]=e,t[2]=n):n=t[2];let r;return t[3]!==n?(r=o.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,o.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=r):r=t[4],r}function F7(t){const e=U.c(7),{userAskParts:s,isStreaming:n,onSubmit:r}=t;let i;e[0]!==s?(i=s.filter(eM),e[0]=s,e[1]=i):i=e[1];const a=i;if(a.length===0){if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(ZD,{}),e[2]=c):c=e[2],c}return null}let l;return e[3]!==n||e[4]!==r||e[5]!==a?(l=o.jsx(GD,{parts:a,isStreaming:n,onSubmit:r}),e[3]=n,e[4]=r,e[5]=a,e[6]=l):l=e[6],l}function eM(t){return t.state==="input-available"}function tM(t){const e=t.filter(i=>i.status==="in_progress"),s=t.filter(i=>i.status==="completed").length,n=t.length;if(n>0&&s===n)return{icon:"completed",activity:"All done",progress:`${n}/${n}`};const[r]=e;return r&&e.length===1?{icon:"in_progress",activity:r.activeForm,progress:`${s}/${n} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${n} done`}:s>0?{icon:"pending",activity:`${n-s} pending`,progress:`${s}/${n} done`}:{icon:"pending",activity:`${n} todos`,progress:"not started"}}function sM(t){const e=U.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=tM(s),e[0]=s,e[1]=n):n=e[1];const r=n;let i;e[2]!==r.icon?(i=o.jsx(oM,{status:r.icon}),e[2]=r.icon,e[3]=i):i=e[3];const a=r.activity,l=r.progress;let c;e[4]!==s?(c=s.map(nM),e[4]=s,e[5]=c):c=e[5];let d;e[6]!==c?(d=o.jsx("ul",{"data-testid":"todos-list",className:"flex flex-col px-2 max-h-[40vh] overflow-y-auto",children:c}),e[6]=c,e[7]=d):d=e[7];let h;return e[8]!==r.activity||e[9]!==r.progress||e[10]!==i||e[11]!==d?(h=o.jsx(Qo,{icon:i,label:a,count:l,defaultExpanded:!1,children:d}),e[8]=r.activity,e[9]=r.progress,e[10]=i,e[11]=d,e[12]=h):h=e[12],h}function nM(t,e){return o.jsx(rM,{todo:t},e)}function rM(t){const e=U.c(14),{todo:s}=t,n=s.status==="completed",i=s.status==="in_progress"?s.activeForm:s.content;let a;e[0]!==s.status?(a=o.jsx(iM,{status:s.status}),e[0]=s.status,e[1]=a):a=e[1];const l=n&&"text-muted-foreground";let c;e[2]!==l?(c=le("relative text-sm leading-snug pt-px select-none",l),e[2]=l,e[3]=c):c=e[3];const d=n?"100%":"0%",h=n?"width 300ms ease 200ms":"width 150ms ease";let u;e[4]!==d||e[5]!==h?(u=o.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:h}}),e[4]=d,e[5]=h,e[6]=u):u=e[6];let f;e[7]!==i||e[8]!==c||e[9]!==u?(f=o.jsxs("span",{className:c,children:[i,u]}),e[7]=i,e[8]=c,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==a||e[12]!==f?(m=o.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[a,f]}),e[11]=a,e[12]=f,e[13]=m):m=e[13],m}function iM(t){const e=U.c(4),{status:s}=t,n=s==="completed"?"true":void 0,r=s==="in_progress"?"true":void 0;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("svg",{viewBox:"0 0 21 21",children:o.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=i):i=e[0];let a;return e[1]!==n||e[2]!==r?(a=o.jsx("div",{className:"todo-cb mt-0.5","data-checked":n,"data-progress":r,"aria-hidden":"true",children:i}),e[1]=n,e[2]=r,e[3]=a):a=e[3],a}function oM(t){const e=U.c(13),{status:s}=t,n=ue();if(s==="completed"){let a;e[0]!==n?(a=n("chat.todoStatus.completed"),e[0]=n,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:o.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=l):l=e[2];let c;return e[3]!==a?(c=o.jsx("span",{"aria-label":a,className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:l}),e[3]=a,e[4]=c):c=e[4],c}if(s==="in_progress"){let a;e[5]!==n?(a=n("chat.todoStatus.inProgress"),e[5]=n,e[6]=a):a=e[6];let l;return e[7]!==a?(l=o.jsx("span",{"aria-label":a,className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[7]=a,e[8]=l):l=e[8],l}let r;e[9]!==n?(r=n("chat.todoStatus.pending"),e[9]=n,e[10]=r):r=e[10];let i;return e[11]!==r?(i=o.jsx("span",{"aria-label":r,className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[11]=r,e[12]=i):i=e[12],i}const aM={usd:[{dollars:10,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:20,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}],brl:[{dollars:50,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:500,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}]},lM=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function U7(t){const e=U.c(65),{onDismiss:s}=t,{org:n}=Fe(),r=on(),{decoKeyId:i}=sg(),a=Ls(),l=ue(),[c,d]=P.useState(""),[h,u]=P.useState(!1),[f,m]=P.useState("usd"),p=f==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{Ye("credits_exhausted_shown",{organization_id:n.id})},x=[n.id],e[0]=n.id,e[1]=g,e[2]=x):(g=e[1],x=e[2]),P.useEffect(g,x);let b;e[3]!==f||e[4]!==a?(b=async K=>{const{url:q}=await a.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:K,currency:f});return q},e[3]=f,e[4]=a,e[5]=b):b=e[5];let v;e[6]!==s?(v=K=>{K&&window.open(K,"_blank","noopener,noreferrer"),s?.()},e[6]=s,e[7]=v):v=e[7];let _;e[8]!==l?(_=K=>{ye.error(l("chat.creditsExhaustedBanner.topupError",{error:K.message}))},e[8]=l,e[9]=_):_=e[9];let L;e[10]!==b||e[11]!==v||e[12]!==_?(L={mutationFn:b,onSuccess:v,onError:_},e[10]=b,e[11]=v,e[12]=_,e[13]=L):L=e[13];const{mutate:y,isPending:w}=Rs(L),S=parseFloat(c),k=!isNaN(S)&&S>=1;let j;e[14]!==s?(j=K=>!K&&s?.(),e[14]=s,e[15]=j):j=e[15];let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[16]=N):N=e[16];let V;e[17]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:N.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=V):V=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[18]=C):C=e[18];let T;e[19]!==l?(T=l("chat.creditsExhaustedBanner.title"),e[19]=l,e[20]=T):T=e[20];let A;e[21]!==T?(A=o.jsx(qt,{className:"text-xl font-semibold tracking-tight",children:T}),e[21]=T,e[22]=A):A=e[22];let R;e[23]!==l?(R=l("chat.creditsExhaustedBanner.description"),e[23]=l,e[24]=R):R=e[24];let E;e[25]!==R?(E=o.jsx(In,{className:"mt-1.5 text-sm leading-relaxed",children:R}),e[25]=R,e[26]=E):E=e[26];let I;e[27]!==A||e[28]!==E?(I=o.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[V,o.jsxs(ls,{className:"relative gap-4",children:[C,o.jsxs("div",{children:[A,E]})]})]}),e[27]=A,e[28]=E,e[29]=I):I=e[29];let D;e[30]!==f||e[31]!==p||e[32]!==c||e[33]!==S||e[34]!==i||e[35]!==k||e[36]!==w||e[37]!==h||e[38]!==l||e[39]!==y?(D=i&&o.jsxs("div",{className:"px-8 pt-5 pb-6",children:[o.jsx("div",{className:"mb-4",children:o.jsxs(r9,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:K=>{K&&m(K)},children:[o.jsx(Kc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),o.jsx(Kc,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),o.jsxs("div",{className:"rounded-xl border border-border p-5",children:[o.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:aM[f].map(K=>{const{dollars:q,labelKey:G}=K;return o.jsxs("button",{type:"button",disabled:w,onClick:()=>{Ye("credits_topup_clicked",{amount_cents:q*100,currency:f,tier_label:G,source:"exhausted_banner"}),y(q*100)},className:le("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[o.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,q]}),o.jsx("span",{className:"text-xs text-muted-foreground",children:l(G)})]},q)})}),h?o.jsxs("div",{className:"flex gap-2 mt-3",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),o.jsx(yt,{type:"number",min:"1",step:"1",placeholder:l("chat.creditsExhaustedBanner.customPlaceholder"),value:c,onChange:K=>d(K.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),o.jsx(me,{className:"h-10",disabled:!k||w,onClick:()=>{Ye("credits_topup_clicked",{amount_cents:Math.round(S*100),currency:f,tier_label:"custom",source:"exhausted_banner"}),y(Math.round(S*100))},children:l(w?"chat.creditsExhaustedBanner.opening":"chat.creditsExhaustedBanner.add")})]}):o.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>u(!0),children:l("chat.creditsExhaustedBanner.enterCustom")})]}),o.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:lM.map(K=>o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:o.jsx($t,{size:12,className:"text-[hsl(var(--chart-1))]"})}),o.jsx("span",{className:"text-sm text-foreground/80",children:l(K)})]},K))})]}),e[30]=f,e[31]=p,e[32]=c,e[33]=S,e[34]=i,e[35]=k,e[36]=w,e[37]=h,e[38]=l,e[39]=y,e[40]=D):D=e[40];let O;e[41]!==l?(O=l("chat.creditsExhaustedBanner.dismiss"),e[41]=l,e[42]=O):O=e[42];let $;e[43]!==s||e[44]!==O?($=o.jsx(me,{variant:"ghost",size:"sm",onClick:s,children:O}),e[43]=s,e[44]=O,e[45]=$):$=e[45];let M;e[46]!==r||e[47]!==s||e[48]!==n.slug?(M=()=>{r({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=r,e[47]=s,e[48]=n.slug,e[49]=M):M=e[49];let z;e[50]!==l?(z=l("chat.creditsExhaustedBanner.manageProviders"),e[50]=l,e[51]=z):z=e[51];let F;e[52]!==M||e[53]!==z?(F=o.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:M,children:z}),e[52]=M,e[53]=z,e[54]=F):F=e[54];let B;e[55]!==$||e[56]!==F?(B=o.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[$,F]}),e[55]=$,e[56]=F,e[57]=B):B=e[57];let H;e[58]!==I||e[59]!==D||e[60]!==B?(H=o.jsxs(Bt,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:cM,children:[I,D,B]}),e[58]=I,e[59]=D,e[60]=B,e[61]=H):H=e[61];let W;return e[62]!==H||e[63]!==j?(W=o.jsx(zt,{open:!0,onOpenChange:j,children:H}),e[62]=H,e[63]=j,e[64]=W):W=e[64],W}function cM(t){return t.preventDefault()}const dM={trial_exhausted:{label:"chat.subscriptionLimit.trialLabel",title:"chat.subscriptionLimit.trialTitle"},monthly_exhausted:{label:"chat.subscriptionLimit.monthlyLabel",title:"chat.subscriptionLimit.monthlyTitle"},runs_exhausted:{label:"chat.subscriptionLimit.runsLabel",title:"chat.subscriptionLimit.runsTitle"}};function uM(t){const e=U.c(16),{kind:s,onDismiss:n,onSubscribe:r}=t,i=ue(),{label:a,title:l}=dM[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(aa,{size:14}),e[0]=c):c=e[0];let d;e[1]!==a||e[2]!==i?(d=i(a),e[1]=a,e[2]=i,e[3]=d):d=e[3];let h;e[4]!==i||e[5]!==l?(h=i(l),e[4]=i,e[5]=l,e[6]=h):h=e[6];let u;e[7]!==s||e[8]!==r||e[9]!==i?(u=s==="trial_exhausted"?o.jsx(me,{size:"sm",onClick:r,className:"h-7 text-xs",children:i("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=r,e[9]=i,e[10]=u):u=e[10];let f;return e[11]!==n||e[12]!==d||e[13]!==h||e[14]!==u?(f=o.jsx(Qo,{icon:c,label:d,title:h,defaultExpanded:!0,variant:"warning",onClose:n,footerRight:u}),e[11]=n,e[12]=d,e[13]=h,e[14]=u,e[15]=f):f=e[15],f}function H7(t,e){const s=U.c(9),n=Ls(),r=ue();let i;s[0]!==n||s[1]!==t?(i=async()=>{const{url:c}=await n.call(t,{});return c},s[0]=n,s[1]=t,s[2]=i):i=s[2];let a;s[3]!==e||s[4]!==r?(a=c=>ye.error(r(e,{message:c.message})),s[3]=e,s[4]=r,s[5]=a):a=s[5];let l;return s[6]!==i||s[7]!==a?(l={mutationFn:i,onSuccess:hM,onError:a},s[6]=i,s[7]=a,s[8]=l):l=s[8],Rs(l)}function hM(t){return window.open(t,"_blank","noopener,noreferrer")}function fM(t){const e=t.trim(),s=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),n=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),r=/failed to fetch|networkerror|load failed|offline/i.test(e),i=/timeout|timed out|aborted|deadline/i.test(e),a=e.length>240,l=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(l){const c=l[1]?.trim().replace(/\.$/,"");return{summary:c?`Your sandbox didn't finish starting up (${c}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return n||s&&a?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:r?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:i?{summary:"That took longer than expected. Try again.",rawDetails:t}:s||a?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const mM={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function Xh(t){const e=U.c(29),s=ue(),{variant:n,onDismiss:r}=t,i=n==="error";let a;e[0]!==i||e[1]!==s?(a=s(i?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=i,e[1]=s,e[2]=a):a=e[2];const l=a,c=i?vn:sa;let d;e[3]!==t.error||e[4]!==t.finishReason||e[5]!==t.variant||e[6]!==s?(d=t.variant==="error"?t.error.message:(()=>{const v=mM[t.finishReason];return v?s(v):s("chat.highlight.responseStoppedUnexpectedly",{reason:t.finishReason})})(),e[3]=t.error,e[4]=t.finishReason,e[5]=t.variant,e[6]=s,e[7]=d):d=e[7];const h=d;let u;e[8]!==i||e[9]!==h?(u=i?fM(h):{summary:h,rawDetails:null},e[8]=i,e[9]=h,e[10]=u):u=e[10];const{summary:f,rawDetails:m}=u;let p;e[11]!==c?(p=o.jsx(c,{size:14}),e[11]=c,e[12]=p):p=e[12];let g;e[13]!==i||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(g=i?o.jsx(me,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):o.jsx(me,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=i,e[14]=t.onContinue,e[15]=t.onFixInChat,e[16]=s,e[17]=g):g=e[17];let x;e[18]!==m||e[19]!==s?(x=m?o.jsxs("details",{className:"group mx-4",children:[o.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[o.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"m4.5 3 3 3-3 3"})}),o.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),o.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),o.jsxs("div",{className:"relative mt-2",children:[o.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(m).then(()=>ye.success(s("chat.highlight.copiedToClipboard"))).catch(()=>ye.error(s("chat.highlight.couldNotCopy")))},"aria-label":s("chat.highlight.copyErrorDetails"),title:s("chat.highlight.copy"),className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:o.jsx(bn,{className:"size-3.5"})}),o.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:m})]})]}):null,e[18]=m,e[19]=s,e[20]=x):x=e[20];let b;return e[21]!==l||e[22]!==r||e[23]!==f||e[24]!==p||e[25]!==g||e[26]!==x||e[27]!==n?(b=o.jsx(Qo,{icon:p,label:l,title:f,defaultExpanded:!0,variant:n,onClose:r,footerRight:g,children:x}),e[21]=l,e[22]=r,e[23]=f,e[24]=p,e[25]=g,e[26]=x,e[27]=n,e[28]=b):b=e[28],b}function _9(){const t=U.c(73),e=ue(),{error:s,clearError:n,finishReason:r,clearFinishReason:i,messages:a,isStreaming:l,submit:c,sendMessage:d}=dr(),[h,u]=no(),{virtualMcpId:f,createTaskWithMessage:m}=an(),{chatMode:p,simpleModeTier:g}=Za(),{mutate:x}=H7("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let b;t[0]!==x?(b=()=>x(),t[0]=x,t[1]=b):b=t[1];const v=b;let _;t[2]!==p||t[3]!==g||t[4]!==f?(_=he=>({tier:g,mode:p,toolApprovalLevel:he,agent:f?{id:f}:void 0}),t[2]=p,t[3]=g,t[4]=f,t[5]=_):_=t[5];const L=_;let y;t[6]!==h.toolApprovalLevel?(y=h.toolApprovalLevel??uN(),t[6]=h.toolApprovalLevel,t[7]=y):y=t[7];const w=y,S=a.at(-1),k=S?.role==="assistant"?S.parts:[],j=k.filter(bM),N=V7(k),V=C7(k);let C;t[8]!==s||t[9]!==d||t[10]!==e?(C=()=>{if(s){const ne={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(ne)}},t[8]=s,t[9]=d,t[10]=e,t[11]=C):C=t[11];const T=C;let A;t[12]!==d||t[13]!==e?(A=()=>{const he={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.pleaseContinue")}]}]};d(he)},t[12]=d,t[13]=e,t[14]=A):A=t[14];const R=A;let E;t[15]!==L||t[16]!==w||t[17]!==c?(E=(he,ne)=>{c({kind:"toolOutput",toolCallId:he.toolCallId,output:{response:ne}},L(w))},t[15]=L,t[16]=w,t[17]=c,t[18]=E):E=t[18];const I=E;let D;t[19]!==m||t[20]!==h||t[21]!==u||t[22]!==e||t[23]!==f?(D=he=>{u({...h,toolApprovalLevel:"auto"}),m({virtualMcpId:f,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:he})}]}})},t[19]=m,t[20]=h,t[21]=u,t[22]=e,t[23]=f,t[24]=D):D=t[24];const O=D,$=xM;let M;t[25]!==L||t[26]!==c?(M=(he,ne,Q,de)=>{c({kind:"approval",approvalId:he,approved:ne,...Q?{reason:Q}:{}},L(de))},t[25]=L,t[26]=c,t[27]=M):M=t[27];const z=M,F=P7();if(F.isCreditExhausted){let he;return t[28]!==n?(he=o.jsx(U7,{onDismiss:n}),t[28]=n,t[29]=he):he=t[29],he}const{showError:B,showWarning:H,hasApprovals:W}=F,K=j.map(gM).join("|"),q=N7(N)?.toolCallId??"",G=V.map(pM).join("|");let te;t[30]!==F.todos?(te=o.jsx(sM,{todos:F.todos}),t[30]=F.todos,t[31]=te):te=t[31];let X;t[32]!==n||t[33]!==F.subscriptionErrorKind||t[34]!==v?(X=F.subscriptionErrorKind&&o.jsx(uM,{kind:F.subscriptionErrorKind,onDismiss:n,onSubscribe:v}),t[32]=n,t[33]=F.subscriptionErrorKind,t[34]=v,t[35]=X):X=t[35];let Z;t[36]!==n||t[37]!==s||t[38]!==T||t[39]!==B?(Z=B&&o.jsx(Xh,{variant:"error",error:s,onDismiss:n,onFixInChat:T}),t[36]=n,t[37]=s,t[38]=T,t[39]=B,t[40]=Z):Z=t[40];let ee;t[41]!==i||t[42]!==r||t[43]!==R||t[44]!==H?(ee=H&&o.jsx(Xh,{variant:"warning",finishReason:r,onDismiss:i,onContinue:R}),t[41]=i,t[42]=r,t[43]=R,t[44]=H,t[45]=ee):ee=t[45];let se;t[46]!==G||t[47]!==z||t[48]!==W||t[49]!==l||t[50]!==V?(se=W&&o.jsx(OD,{approvals:V,isStreaming:l,onRespond:z},G),t[46]=G,t[47]=z,t[48]=W,t[49]=l,t[50]=V,t[51]=se):se=t[51];let J;t[52]!==F.hasPlans||t[53]!==O||t[54]!==$||t[55]!==l||t[56]!==N||t[57]!==q?(J=F.hasPlans&&o.jsx(BD,{plans:N,isStreaming:l,onApprove:O,onDismiss:$},q),t[52]=F.hasPlans,t[53]=O,t[54]=$,t[55]=l,t[56]=N,t[57]=q,t[58]=J):J=t[58];let oe;t[59]!==F.isWaitingForUserInput||t[60]!==I||t[61]!==l||t[62]!==K||t[63]!==j?(oe=F.isWaitingForUserInput&&o.jsx(F7,{userAskParts:j,isStreaming:l,onSubmit:I},K),t[59]=F.isWaitingForUserInput,t[60]=I,t[61]=l,t[62]=K,t[63]=j,t[64]=oe):oe=t[64];let ce;return t[65]!==Z||t[66]!==ee||t[67]!==se||t[68]!==J||t[69]!==oe||t[70]!==te||t[71]!==X?(ce=o.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[te,X,Z,ee,se,J,oe]}),t[65]=Z,t[66]=ee,t[67]=se,t[68]=J,t[69]=oe,t[70]=te,t[71]=X,t[72]=ce):ce=t[72],ce}function pM(t){return t.approvalId}function gM(t){return t.toolCallId}function xM(){document.querySelector("[data-chat-input]")?.focus()}function bM(t){return t.type==="tool-user_ask"}_9.Error=function(e){return o.jsx(Xh,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};_9.Warning=function(e){return o.jsx(Xh,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};_9.UserAskQuestion=F7;function vM(t){const e=U.c(20),{taskId:s}=t,n=ue(),r=_6(s),i=YN(r),a=QN(),{stop:l,removeLocalMessage:c}=dr();if(i.length===0)return null;let d;e[0]!==n?(d=n("chat.queueTray.sendNow"),e[0]=n,e[1]=d):d=e[1];let h;e[2]!==l?(h=()=>{l()},e[2]=l,e[3]=h):h=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Hf,{size:14}),e[4]=u):u=e[4];let f;e[5]!==d||e[6]!==h?(f=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:h,children:u})}),e[5]=d,e[6]=h,e[7]=f):f=e[7];let m;e[8]!==n?(m=n("chat.queueTray.sendNow"),e[8]=n,e[9]=m):m=e[9];let p;e[10]!==m?(p=o.jsx(We,{side:"top",children:o.jsx("p",{className:"text-xs",children:m})}),e[10]=m,e[11]=p):p=e[11];let g;e[12]!==f||e[13]!==p?(g=o.jsxs(qe,{delayDuration:400,children:[f,p]}),e[12]=f,e[13]=p,e[14]=g):g=e[14];let x;return e[15]!==a||e[16]!==c||e[17]!==n||e[18]!==s?(x=(b,v)=>o.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[o.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:v+1}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.text}),o.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/queuerow:opacity-100",children:o.jsx(me,{type:"button",variant:"ghost",size:"icon-sm",title:n("chat.queueTray.removeFromQueue"),"aria-label":n("chat.queueTray.removeFromQueue"),onClick:()=>{a.cancel(s,b.messageId).then(_=>{_&&(XN(s,b.messageId),c(b.messageId))})},children:o.jsx(lr,{className:"size-3.5"})})})]},b.messageId),e[15]=a,e[16]=c,e[17]=n,e[18]=s,e[19]=x):x=e[19],o.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[o.jsx("span",{children:n(i.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:i.length})}),g]}),i.map(x)]})}function yM(t,e){return t?{modelId:t.modelId,title:t.title??t.modelId,keyId:t.keyId,providerId:e,description:null,logo:null,capabilities:[],limits:null,costs:null}:null}const _M={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function LM(t){const e=U.c(31),{tier:s,orgSlot:n,userSlot:r,autoSlot:i,onPick:a,onReset:l,onClose:c}=t,d=ue(),h=c9(),u=new Set(h.map(wM)),f=JN([r,n,i],u),m=f?.keyId??null,[p,g]=P.useState(m??h[0]?.id??null),x=h.some(D=>D.id===p)?p:m??h[0]?.id??null,b=x?h.find(D=>D.id===x):null,v="flex h-[70vh] max-h-[460px] w-full flex-col",_=_M[s];let L;e[0]!==d||e[1]!==_?(L=d(_),e[0]=d,e[1]=_,e[2]=L):L=e[2];let y;e[3]!==L?(y=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:L}),e[3]=L,e[4]=y):y=e[4];let w;e[5]!==l||e[6]!==d||e[7]!==r?(w=r&&o.jsx("button",{type:"button",onClick:l,className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent cursor-pointer",children:d("chat.modelPreferences.reset")}),e[5]=l,e[6]=d,e[7]=r,e[8]=w):w=e[8];let S;e[9]!==y||e[10]!==w?(S=o.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[y,w]}),e[9]=y,e[10]=w,e[11]=S):S=e[11];const k="flex-1 min-h-0",j=P.Suspense;let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(YP,{}),e[12]=N):N=e[12];const V=GP,C=!0,T=yM(m?f:null,b?.providerId??"deco");let A;e[13]!==x||e[14]!==a||e[15]!==g?(A=D=>{const O=D.keyId??x??"";g(O),a({keyId:O,modelId:D.modelId,title:D.title})},e[13]=x,e[14]=a,e[15]=g,e[16]=A):A=e[16];let R;e[17]!==V||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==T||e[22]!==A?(R=o.jsx(V,{compact:C,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:T,onModelChange:A}),e[17]=V,e[18]=x,e[19]=c,e[20]=g,e[21]=T,e[22]=A,e[23]=R):R=e[23];let E;e[24]!==j||e[25]!==R||e[26]!==N?(E=o.jsx("div",{className:k,children:o.jsx(j,{fallback:N,children:R})}),e[24]=j,e[25]=R,e[26]=N,e[27]=E):E=e[27];let I;return e[28]!==E||e[29]!==S?(I=o.jsxs("div",{className:v,children:[S,E]}),e[28]=E,e[29]=S,e[30]=I):I=e[30],I}function wM(t){return t.id}const SM=["fast","smart","thinking"];function K7(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const kM={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function jM(t){const e=U.c(28),{tier:s,pillIcon:n,groups:r}=t,i=ue();let a;e[0]!==i?(a=K7(i),e[0]=i,e[1]=a):a=e[1];const l=a,[c,d]=P.useState(!1);let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=k=>{k.onSelect(),d(!1)},e[2]=h):h=e[2];const u=h,f=l[s];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=le("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[3]=m):m=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=le("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[4]=p):p=e[4];const g=l[s];let x;e[5]!==g?(x=o.jsx("span",{className:p,children:g}),e[5]=g,e[6]=x):x=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(ds,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=b):b=e[7];let v;e[8]!==n||e[9]!==f||e[10]!==x?(v=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"inline-flex min-w-0 shrink",children:o.jsx(gs,{asChild:!0,children:o.jsxs(me,{type:"button",variant:"ghost",size:"default","aria-label":f,className:m,children:[n,x,b]})})})}),e[8]=n,e[9]=f,e[10]=x,e[11]=v):v=e[11];let _;e[12]!==f?(_=o.jsx(We,{children:f}),e[12]=f,e[13]=_):_=e[13];let L;e[14]!==v||e[15]!==_?(L=o.jsxs(qe,{children:[v,_]}),e[14]=v,e[15]=_,e[16]=L):L=e[16];let y;if(e[17]!==r||e[18]!==i){let k;e[20]!==i?(k=j=>o.jsx("div",{className:"flex flex-col",children:j.rows.map(N=>o.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-md hover:bg-muted",children:[o.jsxs("button",{type:"button",role:"menuitem","aria-label":N.title,onClick:()=>u(N),className:le("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",N.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[N.icon&&o.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:N.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-sm",children:N.title}),N.subtitle&&o.jsx("div",{className:"text-xs text-muted-foreground",children:N.subtitle})]}),N.active&&o.jsx("span",{title:i("chat.tierTrigger.selected"),children:o.jsx($t,{size:14,className:"text-foreground mt-0.5"})})]}),N.modelOverride&&o.jsx(NM,{label:N.title,render:N.modelOverride})]},N.key))},j.key),e[20]=i,e[21]=k):k=e[21],y=r.map(k),e[17]=r,e[18]=i,e[19]=y}else y=e[19];let w;e[22]!==y?(w=o.jsx(ys,{align:"end",className:"p-1 w-64",onOpenAutoFocus:CM,children:o.jsx("div",{role:"menu",className:"flex flex-col",children:y})}),e[22]=y,e[23]=w):w=e[23];let S;return e[24]!==c||e[25]!==L||e[26]!==w?(S=o.jsxs(_s,{open:c,onOpenChange:d,children:[L,w]}),e[24]=c,e[25]=L,e[26]=w,e[27]=S):S=e[27],S}function CM(t){return t.preventDefault()}function NM(t){const e=U.c(38),{label:s,render:n}=t,r=ue(),i=Ja(),[a,l]=P.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>l(!1),e[0]=c):c=e[0];const d=c;let h;e[1]!==s||e[2]!==r?(h=r("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=r,e[3]=h):h=e[3];const u=a&&"opacity-100";let f;e[4]!==u?(f=le("absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center","size-6 rounded-md bg-background border border-border/60 shadow-sm","text-muted-foreground hover:text-foreground","opacity-100 [@media(hover:hover)]:opacity-0","[@media(hover:hover)]:group-hover/tier-row:opacity-100","[@media(hover:hover)]:group-focus-within/tier-row:opacity-100",u),e[4]=u,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx($6,{size:14}),e[6]=m):m=e[6];let p;e[7]!==h||e[8]!==f?(p=o.jsx("button",{type:"button","aria-label":h,className:f,children:m}),e[7]=h,e[8]=f,e[9]=p):p=e[9];const g=p;if(i){let L;e[10]!==g?(L=o.jsx(sT,{asChild:!0,children:g}),e[10]=g,e[11]=L):L=e[11];let y;e[12]!==s||e[13]!==r?(y=r("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=r,e[14]=y):y=e[14];let w;e[15]!==y?(w=o.jsx(I2,{className:"sr-only",children:y}),e[15]=y,e[16]=w):w=e[16];let S;e[17]!==a||e[18]!==n?(S=a&&n(d),e[17]=a,e[18]=n,e[19]=S):S=e[19];let k;e[20]!==S||e[21]!==w?(k=o.jsxs(O2,{className:"p-0 flex flex-col max-h-[95vh]",children:[w,S]}),e[20]=S,e[21]=w,e[22]=k):k=e[22];let j;return e[23]!==a||e[24]!==k||e[25]!==L?(j=o.jsxs($2,{open:a,onOpenChange:l,children:[L,k]}),e[23]=a,e[24]=k,e[25]=L,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=o.jsx(gs,{asChild:!0,children:g}),e[27]=g,e[28]=x):x=e[28];let b;e[29]!==a||e[30]!==n?(b=a&&n(d),e[29]=a,e[30]=n,e[31]=b):b=e[31];let v;e[32]!==b?(v=o.jsx(ys,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:b}),e[32]=b,e[33]=v):v=e[33];let _;return e[34]!==a||e[35]!==x||e[36]!==v?(_=o.jsxs(_s,{open:a,onOpenChange:l,children:[x,v]}),e[34]=a,e[35]=x,e[36]=v,e[37]=_):_=e[37],_}function m4(t){return t==="fast"?o.jsx(aa,{size:16}):t==="thinking"?o.jsx(O6,{size:16}):o.jsx(Fi,{size:16})}function VM(t){const e=U.c(13),s=tV();let n;e[0]!==t||e[1]!==s.tiers?(n=d=>{const h=s.tiers[d];return h?h.title??h.modelId:t.chat[d]?.title},e[0]=t,e[1]=s.tiers,e[2]=n):n=e[2];const r=n;let i;e[3]!==r?(i=r("fast"),e[3]=r,e[4]=i):i=e[4];let a;e[5]!==r?(a=r("smart"),e[5]=r,e[6]=a):a=e[6];let l;e[7]!==r?(l=r("thinking"),e[7]=r,e[8]=l):l=e[8];let c;return e[9]!==i||e[10]!==a||e[11]!==l?(c={fast:i,smart:a,thinking:l},e[9]=i,e[10]=a,e[11]=l,e[12]=c):c=e[12],c}function TM(){const t=U.c(22),e=ue(),{simpleModeTier:s,setSimpleModeTier:n}=Za(),r=tA(),i=c9(),a=nA(i),l=VM(a),{data:c,error:d}=ZN();let h;t[0]!==c?(h=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=h):h=t[1];const u=h,f=eV();let m,p;if(t[2]!==a||t[3]!==r||t[4]!==n||t[5]!==e||t[6]!==s||t[7]!==l||t[8]!==f||t[9]!==u||t[10]!==d){const _=K7(e);m="decopilot",p=SM.map(L=>{const y=l[L],w=u.tiers[L];return{key:`decopilot-${L}`,icon:m4(L),title:_[L],subtitle:y??e(kM[L]),active:s===L,onSelect:()=>n(L),modelOverride:S=>o.jsxs(o.Fragment,{children:[d&&o.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),o.jsx(LM,{tier:L,orgSlot:r.tiers[L],userSlot:w,autoSlot:a.chat[L],onClose:S,onPick:k=>f.mutate({tier:L,slot:k}),onReset:()=>f.mutate({tier:L,slot:null})},`${L}:${w?.keyId??"org"}:${w?.modelId??""}`)]})}}),t[2]=a,t[3]=r,t[4]=n,t[5]=e,t[6]=s,t[7]=l,t[8]=f,t[9]=u,t[10]=d,t[11]=m,t[12]=p}else m=t[11],p=t[12];let g;t[13]!==m||t[14]!==p?(g=[{key:m,rows:p}],t[13]=m,t[14]=p,t[15]=g):g=t[15];const x=g;let b;t[16]!==s?(b=m4(s),t[16]=s,t[17]=b):b=t[17];let v;return t[18]!==x||t[19]!==b||t[20]!==s?(v=o.jsx(jM,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=v):v=t[21],v}async function Tg(t,e,s,n,r,i){if(!a9(e)){ye.error("Selected model does not support file uploads");return}const a=s.type||"application/octet-stream";if(!QP(a,e)){const c=m8(e).parts.map(h=>i(h)).join(", "),d=e?.title??"This model";r?r({fileName:s.name,modelName:d,accepted:c}):ye.error(`"${s.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const l=10*1024*1024;if(s.size>l){ye.error(`File "${s.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((f,m)=>{c.onload=()=>{const p=c.result;if(typeof p!="string"){m(new Error("Failed to read file as data URL"));return}const g=p.includes(",")?p.split(",")[1]??p:p;f(g)},c.onerror=m});c.readAsDataURL(s);const h=await d,u={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:h};uV(t,{from:n,to:n},u)}catch(c){console.error("Failed to process file:",c),ye.error(`Failed to load file "${s.name}"`)}}function PM(t){const e=U.c(9),{editor:s,selectedModel:n,onUnsupportedFile:r}=t,i=ue(),a=P.useRef(EM);let l,c;e[0]!==s||e[1]!==r||e[2]!==n||e[3]!==i?(l=()=>{a.current=async(u,f)=>{await Tg(s,n,u,f,r,i)}},c=[s,n,r,i],e[0]=s,e[1]=r,e[2]=n,e[3]=i,e[4]=l,e[5]=c):(l=e[4],c=e[5]),P.useEffect(l,c);let d,h;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const u=new Er("fileDropHandler");s.state.plugins.find(p=>p.spec.key===u)&&s.unregisterPlugin(u);const m=new nd({key:u,props:{handleDrop:(p,g,x,b)=>{if(b)return!1;const v=g.dataTransfer?.files;if(!v||v.length===0)return!1;g.preventDefault();const _=p.posAtCoords({left:g.clientX,top:g.clientY});if(!_)return!1;const L=Array.from(v);return(async()=>{let y=_.pos;for(const w of L)await a.current?.(w,y),y=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(AM);return b.length===0?!1:(g.preventDefault(),(async()=>{let v=p.state.selection.from;for(const _ of b){const L=_.getAsFile();L&&(await a.current?.(L,v),v=p.state.selection.to)}})(),!0)}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(u)}},h=[s],e[6]=s,e[7]=d,e[8]=h):(d=e[7],h=e[8]),P.useEffect(d,h),null}function AM(t){return t.kind==="file"}function EM(){return Promise.resolve()}function RM(t){const e=U.c(43),{info:s,onClose:n}=t,r=ue(),i=s!==null;let a;e[0]!==n?(a=C=>!C&&n(),e[0]=n,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=l):l=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:l.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-warning/15 text-warning",children:o.jsx(sa,{size:18})}),e[4]=d):d=e[4];let h;e[5]!==r?(h=r("chat.uploader.fileTypeNotSupported"),e[5]=r,e[6]=h):h=e[6];let u;e[7]!==h?(u=o.jsx(qt,{className:"text-xl font-semibold tracking-tight",children:h}),e[7]=h,e[8]=u):u=e[8];const f=s?.fileName;let m;e[9]!==f?(m=o.jsxs("span",{className:"font-medium text-foreground",children:["“",f,"”"]}),e[9]=f,e[10]=m):m=e[10];let p;e[11]!==r?(p=r("chat.uploader.cantAttachToChat"),e[11]=r,e[12]=p):p=e[12];let g;e[13]!==p||e[14]!==m?(g=o.jsxs(In,{className:"mt-1.5 text-sm leading-relaxed",children:[m," ",p]}),e[13]=p,e[14]=m,e[15]=g):g=e[15];let x;e[16]!==g||e[17]!==u?(x=o.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,o.jsxs(ls,{className:"relative gap-4",children:[d,o.jsxs("div",{children:[u,g]})]})]}),e[16]=g,e[17]=u,e[18]=x):x=e[18];const b=s?.modelName??"";let v;e[19]!==r||e[20]!==b?(v=r("chat.uploader.accepts",{modelName:b}),e[19]=r,e[20]=b,e[21]=v):v=e[21];let _;e[22]!==v?(_=o.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:v}),e[22]=v,e[23]=_):_=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(B6,{size:14,className:"text-muted-foreground"}),e[24]=L):L=e[24];const y=s?.accepted;let w;e[25]!==y?(w=o.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[L,o.jsx("span",{className:"capitalize",children:y})]}),e[25]=y,e[26]=w):w=e[26];let S;e[27]!==_||e[28]!==w?(S=o.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:o.jsxs("div",{className:"rounded-xl border border-border p-4",children:[_,w]})}),e[27]=_,e[28]=w,e[29]=S):S=e[29];let k;e[30]!==r?(k=r("chat.uploader.gotIt"),e[30]=r,e[31]=k):k=e[31];let j;e[32]!==n||e[33]!==k?(j=o.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:o.jsx(me,{onClick:n,children:k})}),e[32]=n,e[33]=k,e[34]=j):j=e[34];let N;e[35]!==x||e[36]!==S||e[37]!==j?(N=o.jsxs(Bt,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:DM,children:[x,S,j]}),e[35]=x,e[36]=S,e[37]=j,e[38]=N):N=e[38];let V;return e[39]!==i||e[40]!==a||e[41]!==N?(V=o.jsx(zt,{open:i,onOpenChange:a,children:N}),e[39]=i,e[40]=a,e[41]=N,e[42]=V):V=e[42],V}function DM(t){return t.preventDefault()}function MM(){const t=U.c(3),[e,s]=P.useState(null);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>s(null),t[0]=n):n=t[0];let r;return t[1]!==e?(r={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:n},t[1]=e,t[2]=r):r=t[2],r}var Pg=hV;var IM=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],qm=IM.join(","),W7=typeof Element>"u",Vu=W7?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Jh=!W7&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},Zh=function(e,s){var n;s===void 0&&(s=!0);var r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),i=r===""||r==="true",a=i||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Zh(e.parentNode));return a},OM=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},$M=function(e,s,n){if(Zh(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(qm));return s&&Vu.call(e,qm)&&r.unshift(e),r=r.filter(n),r},Gm=function(e,s,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!Zh(a,!1))if(a.tagName==="SLOT"){var l=a.assignedElements(),c=l.length?l:a.children,d=Gm(c,!0,n);n.flatten?r.push.apply(r,d):r.push({scopeParent:a,candidates:d})}else{var h=Vu.call(a,qm);h&&n.filter(a)&&(s||!e.includes(a))&&r.push(a);var u=a.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(a),f=!Zh(u,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(u&&f){var m=Gm(u===!0?a.children:u.children,!0,n);n.flatten?r.push.apply(r,m):r.push({scopeParent:a,candidates:m})}else i.unshift.apply(i,a.children)}}return r},q7=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},G7=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||OM(e))&&!q7(e)?0:e.tabIndex},BM=function(e,s){var n=G7(e);return n<0&&s&&!q7(e)?0:n},zM=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},Y7=function(e){return e.tagName==="INPUT"},FM=function(e){return Y7(e)&&e.type==="hidden"},UM=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},HM=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},KM=function(e){if(!e.name)return!0;var s=e.form||Jh(e),n=function(l){return s.querySelectorAll('input[type="radio"][name="'+l+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var i=HM(r,e.form);return!i||i===e},WM=function(e){return Y7(e)&&e.type==="radio"},qM=function(e){return WM(e)&&!KM(e)},GM=function(e){var s,n=e&&Jh(e),r=(s=n)===null||s===void 0?void 0:s.host,i=!1;if(n&&n!==e){var a,l,c;for(i=!!((a=r)!==null&&a!==void 0&&(l=a.ownerDocument)!==null&&l!==void 0&&l.contains(r)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!i&&r;){var d,h,u;n=Jh(r),r=(d=n)===null||d===void 0?void 0:d.host,i=!!((h=r)!==null&&h!==void 0&&(u=h.ownerDocument)!==null&&u!==void 0&&u.contains(r))}}return i},p4=function(e){var s=e.getBoundingClientRect(),n=s.width,r=s.height;return n===0&&r===0},YM=function(e,s){var n=s.displayCheck,r=s.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var a=Vu.call(e,"details>summary:first-of-type"),l=a?e.parentElement:e;if(Vu.call(l,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof r=="function"){for(var c=e;e;){var d=e.parentElement,h=Jh(e);if(d&&!d.shadowRoot&&r(d)===!0)return p4(e);e.assignedSlot?e=e.assignedSlot:!d&&h!==e.ownerDocument?e=h.host:e=d}e=c}if(GM(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return p4(e);return!1},QM=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var n=0;n<s.children.length;n++){var r=s.children.item(n);if(r.tagName==="LEGEND")return Vu.call(s,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}s=s.parentElement}return!1},XM=function(e,s){return!(s.disabled||FM(s)||YM(s,e)||UM(s)||QM(s))},g4=function(e,s){return!(qM(s)||G7(s)<0||!XM(e,s))},JM=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},Q7=function(e){var s=[],n=[];return e.forEach(function(r,i){var a=!!r.scopeParent,l=a?r.scopeParent:r,c=BM(l,a),d=a?Q7(r.candidates):l;c===0?a?s.push.apply(s,d):s.push(l):n.push({documentOrder:i,tabIndex:c,item:r,isScope:a,content:d})}),n.sort(zM).reduce(function(r,i){return i.isScope?r.push.apply(r,i.content):r.push(i.content),r},[]).concat(s)},X7=function(e,s){s=s||{};var n;return s.getShadowRoot?n=Gm([e],s.includeContainer,{filter:g4.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:JM}):n=$M(e,s.includeContainer,g4.bind(null,s)),Q7(n)};function ZM(){return/apple/i.test(navigator.vendor)}const x4="data-floating-ui-focusable";function eI(t){let e=t.activeElement;for(;((s=e)==null||(s=s.shadowRoot)==null?void 0:s.activeElement)!=null;){var s;e=e.shadowRoot.activeElement}return e}function Ym(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&hN(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function kd(t){return"composedPath"in t?t.composedPath()[0]:t.target}function L1(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const s=t;return s.target!=null&&e.contains(s.target)}function tI(t){return t.matches("html,body")}function Tu(t){return t?.ownerDocument||document}function sI(t){return t?t.hasAttribute(x4)?t:t.querySelector("["+x4+"]")||t:null}function Sh(t,e,s){return s===void 0&&(s=!0),t.filter(r=>{var i;return r.parentId===e&&(!s||((i=r.context)==null?void 0:i.open))}).flatMap(r=>[r,...Sh(t,r.id,s)])}function nI(t){return"nativeEvent"in t}var rI=typeof document<"u",iI=function(){},Ea=rI?P.useLayoutEffect:iI;const oI={...e6},aI=oI.useInsertionEffect,lI=aI||(t=>t());function Cc(t){const e=P.useRef(()=>{});return lI(()=>{e.current=t}),P.useCallback(function(){for(var s=arguments.length,n=new Array(s),r=0;r<s;r++)n[r]=arguments[r];return e.current==null?void 0:e.current(...n)},[])}const J7=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Z7(t,e){const s=X7(t,J7()),n=s.length;if(n===0)return;const r=eI(Tu(t)),i=s.indexOf(r),a=i===-1?e===1?0:n-1:i+e;return s[a]}function cI(t){return Z7(Tu(t).body,1)||t}function dI(t){return Z7(Tu(t).body,-1)||t}function w1(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!Ym(s,n)}function uI(t){X7(t,J7()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function b4(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const n=s.dataset.tabindex;delete s.dataset.tabindex,n?s.setAttribute("tabindex",n):s.removeAttribute("tabindex")})}const hI="data-floating-ui-focusable",v4="active",y4="selected",fI={...e6};let _4=!1,mI=0;const L4=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+mI++;function pI(){const[t,e]=P.useState(()=>_4?L4():void 0);return Ea(()=>{t==null&&e(L4())},[]),P.useEffect(()=>{_4=!0},[]),t}const gI=fI.useId,Ag=gI||pI;function xI(){const t=new Map;return{emit(e,s){var n;(n=t.get(e))==null||n.forEach(r=>r(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var n;(n=t.get(e))==null||n.delete(s)}}}const bI=P.createContext(null),vI=P.createContext(null),e_=()=>{var t;return((t=P.useContext(bI))==null?void 0:t.id)||null},t_=()=>P.useContext(vI);function Eg(t){return"data-floating-ui-"+t}const yI={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},w4=P.forwardRef(function(e,s){const[n,r]=P.useState();Ea(()=>{ZM()&&r("button")},[]);const i={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[Eg("focus-guard")]:"",style:yI};return o.jsx("span",{...e,...i})}),_I={clipPath:"inset(50%)",position:"fixed",top:0,left:0},s_=P.createContext(null),S4=Eg("portal");function LI(t){t===void 0&&(t={});const{id:e,root:s}=t,n=Ag(),r=SI(),[i,a]=P.useState(null),l=P.useRef(null);return Ea(()=>()=>{i?.remove(),queueMicrotask(()=>{l.current=null})},[i]),Ea(()=>{if(!n||l.current)return;const c=e?document.getElementById(e):null;if(!c)return;const d=document.createElement("div");d.id=n,d.setAttribute(S4,""),c.appendChild(d),l.current=d,a(d)},[e,n]),Ea(()=>{if(s===null||!n||l.current)return;let c=s||r?.portalNode;c&&!bN(c)&&(c=c.current),c=c||document.body;let d=null;e&&(d=document.createElement("div"),d.id=e,c.appendChild(d));const h=document.createElement("div");h.id=n,h.setAttribute(S4,""),c=d||c,c.appendChild(h),l.current=h,a(h)},[e,s,n,r]),i}function wI(t){const{children:e,id:s,root:n,preserveTabOrder:r=!0}=t,i=LI({id:s,root:n}),[a,l]=P.useState(null),c=P.useRef(null),d=P.useRef(null),h=P.useRef(null),u=P.useRef(null),f=a?.modal,m=a?.open,p=!!a&&!a.modal&&a.open&&r&&!!(n||i);return P.useEffect(()=>{if(!i||!r||f)return;function g(x){i&&w1(x)&&(x.type==="focusin"?b4:uI)(i)}return i.addEventListener("focusin",g,!0),i.addEventListener("focusout",g,!0),()=>{i.removeEventListener("focusin",g,!0),i.removeEventListener("focusout",g,!0)}},[i,r,f]),P.useEffect(()=>{i&&(m||b4(i))},[m,i]),o.jsxs(s_.Provider,{value:P.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:h,afterInsideRef:u,portalNode:i,setFocusManagerState:l}),[r,i]),children:[p&&i&&o.jsx(w4,{"data-type":"outside",ref:c,onFocus:g=>{if(w1(g,i)){var x;(x=h.current)==null||x.focus()}else{const b=a?a.domReference:null,v=dI(b);v?.focus()}}}),p&&i&&o.jsx("span",{"aria-owns":i.id,style:_I}),i&&Wn.createPortal(e,i),p&&i&&o.jsx(w4,{"data-type":"outside",ref:d,onFocus:g=>{if(w1(g,i)){var x;(x=u.current)==null||x.focus()}else{const b=a?a.domReference:null,v=cI(b);v?.focus(),a?.closeOnFocusOut&&a?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const SI=()=>P.useContext(s_),kI={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},jI={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},k4=t=>{var e,s;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(s=t?.outsidePress)!=null?s:!0}};function CI(t,e){e===void 0&&(e={});const{open:s,onOpenChange:n,elements:r,dataRef:i}=t,{enabled:a=!0,escapeKey:l=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:h=!1,referencePressEvent:u="pointerdown",ancestorScroll:f=!1,bubbles:m,capture:p}=e,g=t_(),x=Cc(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,v=P.useRef(!1),{escapeKey:_,outsidePress:L}=k4(m),{escapeKey:y,outsidePress:w}=k4(p),S=P.useRef(!1),k=Cc(A=>{var R;if(!s||!a||!l||A.key!=="Escape"||S.current)return;const E=(R=i.current.floatingContext)==null?void 0:R.nodeId,I=g?Sh(g.nodesRef.current,E):[];if(!_&&(A.stopPropagation(),I.length>0)){let D=!0;if(I.forEach(O=>{var $;if(($=O.context)!=null&&$.open&&!O.context.dataRef.current.__escapeKeyBubbles){D=!1;return}}),!D)return}n(!1,nI(A)?A.nativeEvent:A,"escape-key")}),j=Cc(A=>{var R;const E=()=>{var I;k(A),(I=kd(A))==null||I.removeEventListener("keydown",E)};(R=kd(A))==null||R.addEventListener("keydown",E)}),N=Cc(A=>{var R;const E=i.current.insideReactTree;i.current.insideReactTree=!1;const I=v.current;if(v.current=!1,d==="click"&&I||E||typeof b=="function"&&!b(A))return;const D=kd(A),O="["+Eg("inert")+"]",$=Tu(r.floating).querySelectorAll(O);let M=ti(D)?D:null;for(;M&&!x1(M);){const H=pN(M);if(x1(H)||!ti(H))break;M=H}if($.length&&ti(D)&&!tI(D)&&!Ym(D,r.floating)&&Array.from($).every(H=>!Ym(M,H)))return;if(gN(D)&&T){const H=x1(D),W=xN(D),K=/auto|scroll/,q=H||K.test(W.overflowX),G=H||K.test(W.overflowY),te=q&&D.clientWidth>0&&D.scrollWidth>D.clientWidth,X=G&&D.clientHeight>0&&D.scrollHeight>D.clientHeight,Z=W.direction==="rtl",ee=X&&(Z?A.offsetX<=D.offsetWidth-D.clientWidth:A.offsetX>D.clientWidth),se=te&&A.offsetY>D.clientHeight;if(ee||se)return}const z=(R=i.current.floatingContext)==null?void 0:R.nodeId,F=g&&Sh(g.nodesRef.current,z).some(H=>{var W;return L1(A,(W=H.context)==null?void 0:W.elements.floating)});if(L1(A,r.floating)||L1(A,r.domReference)||F)return;const B=g?Sh(g.nodesRef.current,z):[];if(B.length>0){let H=!0;if(B.forEach(W=>{var K;if((K=W.context)!=null&&K.open&&!W.context.dataRef.current.__outsidePressBubbles){H=!1;return}}),!H)return}n(!1,A,"outside-press")}),V=Cc(A=>{var R;const E=()=>{var I;N(A),(I=kd(A))==null||I.removeEventListener(d,E)};(R=kd(A))==null||R.addEventListener(d,E)});P.useEffect(()=>{if(!s||!a)return;i.current.__escapeKeyBubbles=_,i.current.__outsidePressBubbles=L;let A=-1;function R($){n(!1,$,"ancestor-scroll")}function E(){window.clearTimeout(A),S.current=!0}function I(){A=window.setTimeout(()=>{S.current=!1},mN()?5:0)}const D=Tu(r.floating);l&&(D.addEventListener("keydown",y?j:k,y),D.addEventListener("compositionstart",E),D.addEventListener("compositionend",I)),b&&D.addEventListener(d,w?V:N,w);let O=[];return f&&(ti(r.domReference)&&(O=g1(r.domReference)),ti(r.floating)&&(O=O.concat(g1(r.floating))),!ti(r.reference)&&r.reference&&r.reference.contextElement&&(O=O.concat(g1(r.reference.contextElement)))),O=O.filter($=>{var M;return $!==((M=D.defaultView)==null?void 0:M.visualViewport)}),O.forEach($=>{$.addEventListener("scroll",R,{passive:!0})}),()=>{l&&(D.removeEventListener("keydown",y?j:k,y),D.removeEventListener("compositionstart",E),D.removeEventListener("compositionend",I)),b&&D.removeEventListener(d,w?V:N,w),O.forEach($=>{$.removeEventListener("scroll",R)}),window.clearTimeout(A)}},[i,r,l,b,d,s,n,f,a,_,L,k,y,j,N,w,V]),P.useEffect(()=>{i.current.insideReactTree=!1},[i,b,d]);const C=P.useMemo(()=>({onKeyDown:k,...h&&{[kI[u]]:A=>{n(!1,A.nativeEvent,"reference-press")},...u!=="click"&&{onClick(A){n(!1,A.nativeEvent,"reference-press")}}}}),[k,n,h,u]),T=P.useMemo(()=>{function A(R){R.button===0&&(v.current=!0)}return{onKeyDown:k,onMouseDown:A,onMouseUp:A,[jI[d]]:()=>{i.current.insideReactTree=!0}}},[k,d,i]);return P.useMemo(()=>a?{reference:C,floating:T}:{},[a,C,T])}function NI(t){const{open:e=!1,onOpenChange:s,elements:n}=t,r=Ag(),i=P.useRef({}),[a]=P.useState(()=>xI()),l=e_()!=null,[c,d]=P.useState(n.reference),h=Cc((m,p,g)=>{i.current.openEvent=m?p:void 0,a.emit("openchange",{open:m,event:p,reason:g,nested:l}),s?.(m,p,g)}),u=P.useMemo(()=>({setPositionReference:d}),[]),f=P.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return P.useMemo(()=>({dataRef:i,open:e,onOpenChange:h,elements:f,events:a,floatingId:r,refs:u}),[e,h,f,a,r,u])}function VI(t){t===void 0&&(t={});const{nodeId:e}=t,s=NI({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,r=n.elements,[i,a]=P.useState(null),[l,c]=P.useState(null),h=r?.domReference||i,u=P.useRef(null),f=t_();Ea(()=>{h&&(u.current=h)},[h]);const m=fN({...t,elements:{...r,...l&&{reference:l}}}),p=P.useCallback(_=>{const L=ti(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),getClientRects:()=>_.getClientRects(),contextElement:_}:_;c(L),m.refs.setReference(L)},[m.refs]),g=P.useCallback(_=>{(ti(_)||_===null)&&(u.current=_,a(_)),(ti(m.refs.reference.current)||m.refs.reference.current===null||_!==null&&!ti(_))&&m.refs.setReference(_)},[m.refs]),x=P.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:u}),[m.refs,g,p]),b=P.useMemo(()=>({...m.elements,domReference:h}),[m.elements,h]),v=P.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return Ea(()=>{n.dataRef.current.floatingContext=v;const _=f?.nodesRef.current.find(L=>L.id===e);_&&(_.context=v)}),P.useMemo(()=>({...m,context:v,refs:x,elements:b}),[m,x,b,v])}function S1(t,e,s){const n=new Map,r=s==="item";let i=t;if(r&&t){const{[v4]:a,[y4]:l,...c}=t;i=c}return{...s==="floating"&&{tabIndex:-1,[hI]:""},...i,...e.map(a=>{const l=a?a[s]:null;return typeof l=="function"?t?l(t):null:l}).concat(t).reduce((a,l)=>(l&&Object.entries(l).forEach(c=>{let[d,h]=c;if(!(r&&[v4,y4].includes(d)))if(d.indexOf("on")===0){if(n.has(d)||n.set(d,[]),typeof h=="function"){var u;(u=n.get(d))==null||u.push(h),a[d]=function(){for(var f,m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];return(f=n.get(d))==null?void 0:f.map(x=>x(...p)).find(x=>x!==void 0)}}}else a[d]=h}),a),{})}}function TI(t){t===void 0&&(t=[]);const e=t.map(l=>l?.reference),s=t.map(l=>l?.floating),n=t.map(l=>l?.item),r=P.useCallback(l=>S1(l,t,"reference"),e),i=P.useCallback(l=>S1(l,t,"floating"),s),a=P.useCallback(l=>S1(l,t,"item"),n);return P.useMemo(()=>({getReferenceProps:r,getFloatingProps:i,getItemProps:a}),[r,i,a])}const PI=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function AI(t,e){var s,n;e===void 0&&(e={});const{open:r,elements:i,floatingId:a}=t,{enabled:l=!0,role:c="dialog"}=e,d=Ag(),h=((s=i.domReference)==null?void 0:s.id)||d,u=P.useMemo(()=>{var v;return((v=sI(i.floating))==null?void 0:v.id)||a},[i.floating,a]),f=(n=PI.get(c))!=null?n:c,p=e_()!=null,g=P.useMemo(()=>f==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:r?u:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":r?u:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:h},...f==="menu"&&p&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[f,u,p,r,h,c]),x=P.useMemo(()=>{const v={id:u,...f&&{role:f}};return f==="tooltip"||c==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":h}}},[f,u,h,c]),b=P.useCallback(v=>{let{active:_,selected:L}=v;const y={role:"option",..._&&{id:u+"-fui-option"}};switch(c){case"select":case"combobox":return{...y,"aria-selected":L}}return{}},[u,c]);return P.useMemo(()=>l?{reference:g,floating:x,item:b}:{},[l,g,x,b])}function EI(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:l}=t,c=n&&!r,d=pV(s),h=new RegExp(`\\s${d}$`),u=a?"^":"",f=r?"":d,m=c?new RegExp(`${u}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${u}(?:^)?${d}[^\\s${f}]*`,"gm"),p=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!p)return null;const g=l.pos-p.length,x=Array.from(p.matchAll(m)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),v=new RegExp(`^[${i?.join("")}\0]?$`).test(b);if(i!==null&&!v)return null;const _=g+x.index;let L=_+x[0].length;return c&&h.test(p.slice(L-1,L+1))&&(x[0]+=" ",L+=1),_<l.pos&&L>=l.pos?{range:{from:_,to:L},query:x[0].slice(s.length),text:x[0]}:null}function RI(t){return t.docChanged?t.steps.some(e=>{const s=e.slice;if(!s?.content)return!1;const n=s.content.textBetween(0,s.content.size,`
3
3
  `);return/\s/.test(n)}):!1}function DI(t){return()=>{const e=t.state.selection.$anchor.pos,{top:s,right:n,bottom:r,left:i}=t.view.coordsAtPos(e);try{return new DOMRect(i,s,n-i,r-s)}catch{return null}}}function MI(t,e,s,n){return s?()=>{const r=n.getState(t.state),i=r?.decorationId,a=e.dom.querySelector(`[data-decoration-id="${i}"]`);return a?.getBoundingClientRect()||null}:DI(t)}function II({match:t,dismissedRange:e,state:s,transaction:n,editor:r,shouldResetDismissed:i,effectiveAllowSpaces:a}){return i?.({editor:r,state:s,range:e,match:t,transaction:n,allowSpaces:a})?!1:a?t.range.from===e.from:t.range.from===e.from&&!RI(n)}function OI({view:t,pluginKeyRef:e}){const s=t.state.tr.setMeta(e,{exit:!0});t.dispatch(s)}function $I({pluginKey:t,decorationTag:e,decorationClass:s,decorationContent:n,decorationEmptyClass:r,renderer:i,dispatchExit:a}){return{handleKeyDown(l,c){var d;const h=t.getState(l.state);if(!h.active)return!1;if(c.key==="Escape"||c.key==="Esc"){var u;return i==null||(u=i.onKeyDown)===null||u===void 0||u.call(i,{view:l,event:c,range:h.range}),a(l),!0}return(i==null||(d=i.onKeyDown)===null||d===void 0?void 0:d.call(i,{view:l,event:c,range:h.range}))||!1},decorations(l){const{active:c,range:d,decorationId:h,query:u}=t.getState(l);if(!c)return null;const f=!u?.length,m=[s];return f&&m.push(r),fV.create(l.doc,[mV.inline(d.from,d.to,{nodeName:e,class:m.join(" "),"data-decoration-id":h||void 0,"data-decoration-content":n})])}}}function BI({editor:t,char:e,effectiveAllowSpaces:s,allowToIncludeChar:n,allowedPrefixes:r,startOfLine:i,findSuggestionMatch:a,allow:l,shouldShow:c,shouldKeepDismissed:d,pluginKey:h}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(u,f,m,p){const{isEditable:g}=t,{composing:x}=t.view,{selection:b}=u,{empty:v,from:_}=b,L={...f},y=u.getMeta(h);if(y&&y.exit)return L.active=!1,L.decorationId=null,L.range={from:0,to:0},L.query=null,L.text=null,L.dismissedRange=f.active?{...f.range}:f.dismissedRange,L;if(L.composing=x,u.docChanged&&L.dismissedRange!==null&&(L.dismissedRange={from:u.mapping.map(L.dismissedRange.from),to:u.mapping.map(L.dismissedRange.to)}),g&&(v||t.view.composing)){(_<f.range.from||_>f.range.to)&&!x&&!f.composing&&(L.active=!1);const w=a({char:e,allowSpaces:s,allowToIncludeChar:n,allowedPrefixes:r,startOfLine:i,$position:b.$from}),S=`id_${Math.floor(Math.random()*4294967295)}`;w&&l({editor:t,state:p,range:w.range,isActive:f.active})&&(!c||c({editor:t,range:w.range,query:w.query,text:w.text,transaction:u}))?(L.dismissedRange!==null&&!d({match:w,dismissedRange:L.dismissedRange,state:p,transaction:u})&&(L.dismissedRange=null),L.dismissedRange===null?(L.active=!0,L.decorationId=f.decorationId||S,L.range=w.range,L.query=w.query,L.text=w.text):L.active=!1):(w||(L.dismissedRange=null),L.active=!1)}else L.active=!1;return L.active||(L.decorationId=null,L.range={from:0,to:0},L.query=null,L.text=null),L}}}function zI({editor:t,items:e}){let s=null,n=null,r=null;const i=()=>{n!==null&&(clearTimeout(n),n=null),r?.(),r=null},a=d=>new Promise(h=>{r=h,n=setTimeout(()=>{n=null;const u=r;r=null,u?.()},d)}),l=()=>{s?.abort(),i(),s=null};return{abort:l,fetch:async(d,h)=>{l(),s=new AbortController;const u=s;if(h>0&&await a(h),s!==u||u.signal.aborted)return{status:"aborted"};try{const f=await e({editor:t,query:d,signal:u.signal});return s!==u||u.signal.aborted?{status:"aborted"}:{status:"resolved",items:f}}catch{return s!==u||u.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function FI({placement:t,offset:e,flip:s,floatingUi:n}){var r,i,a,l;const c=[C2({mainAxis:(r=e.mainAxis)!==null&&r!==void 0?r:4,crossAxis:(i=e.crossAxis)!==null&&i!==void 0?i:0})];return s&&c.push(N2()),!(n==null||(a=n.middleware)===null||a===void 0)&&a.length&&c.push(...n.middleware),{placement:t,strategy:(l=n?.strategy)!==null&&l!==void 0?l:"absolute",middleware:c}}function UI(t){if(t instanceof HTMLElement)return t;if(typeof t=="string")try{const e=document.querySelector(t);if(e)return e}catch{return document.body}return document.body}function HI({getReferenceRect:t,contextElement:e,config:s,container:n,dismissOnOutsideClick:r,dismiss:i}){return(a,l={})=>{const c={getBoundingClientRect:()=>{var p;return(p=t())!==null&&p!==void 0?p:new DOMRect},contextElement:e};let d=!1;const h=!a.isConnected;h&&UI(n).appendChild(a),l.onPosition||(a.style.visibility="hidden",a.style.width="max-content");const f=t6(c,a,()=>{V2(c,a,{placement:s.placement,strategy:s.strategy,middleware:s.middleware}).then(({x:p,y:g,placement:x,strategy:b})=>{if(l.onPosition){l.onPosition({x:p,y:g,placement:x,strategy:b});return}Object.assign(a.style,{position:b,left:`${p}px`,top:`${g}px`}),d||(d=!0,a.style.visibility="")})},l.autoUpdate);let m;return r&&(m=p=>{const g=p.target;!(g instanceof Node)||a.contains(g)||e.contains(g)||i()},document.addEventListener("pointerdown",m,!0)),()=>{f(),m&&document.removeEventListener("pointerdown",m,!0),h&&a.remove()}}}function KI({editor:t,pluginKey:e,items:s,renderer:n,minQueryLength:r,debounce:i,initialItems:a,placement:l,offset:c,container:d,flip:h,floatingUi:u,dismissOnOutsideClick:f,command:m,clientRectFor:p,dispatchExit:g}){let x;const b=zI({editor:t,items:s}),v=FI({placement:l,offset:c,flip:h,floatingUi:u});function _(L,y){switch(L){case"started":var w;n==null||(w=n.onStart)===null||w===void 0||w.call(n,y);break;case"updated":var S;n==null||(S=n.onUpdate)===null||S===void 0||S.call(n,y);break;case"stopped":var k;n==null||(k=n.onExit)===null||k===void 0||k.call(n,y)}}return{update:async(L,y)=>{var w,S;const k=e.getState(y),j=e.getState(L.state);if(!k||!j)return;let N=null;const V=k.query!==j.query,C=k.text!==j.text,T=k.range.from!==j.range.from||k.range.to!==j.range.to,A=V||C||T;if(!k.active&&j.active)N="started";else if(k.active&&!j.active)N="stopped";else if(j.active&&A)N="updated";else return;const R=N==="stopped"?k:j,E=L.dom.querySelector(`[data-decoration-id="${R.decorationId}"]`),I=p(L,E),D=r===0||(R.query?R.query.length>=r:!1),O=(N==="started"||N==="updated")&&D;if(x={editor:t,range:R.range,query:R.query||"",text:R.text||"",items:a??[],command:z=>m({editor:t,range:R.range,props:z}),decorationNode:E,clientRect:I,loading:O,placement:l,offset:{mainAxis:(w=c.mainAxis)!==null&&w!==void 0?w:4,crossAxis:(S=c.crossAxis)!==null&&S!==void 0?S:0},container:d,flip:h,floatingUi:v,mount:HI({getReferenceRect:I,contextElement:L.dom,config:v,container:d,dismissOnOutsideClick:f,dismiss:()=>g(t.view)})},N==="started"){var $;n==null||($=n.onBeforeStart)===null||$===void 0||$.call(n,x)}if(N==="updated"){var M;n==null||(M=n.onBeforeUpdate)===null||M===void 0||M.call(n,x)}if(N==="started"&&_(N,x),N==="started"||N==="updated")if(!O)b.abort(),x={...x,items:a??[],loading:!1};else{x={...x,items:a??[],loading:!0},N="updated",_(N,x);const z=await b.fetch(R.query||"",i);if(z.status==="aborted")return;const F=e.getState(L.state);if(!F?.active){b.abort();return}x=z.status==="resolved"?{...x,items:z.items,loading:!1}:{...x,loading:!1}}if(N==="stopped"){b.abort(),_(N,x),x=void 0;return}N==="updated"&&_(N,x)},destroy:()=>{var L;b.abort(),x&&(n==null||(L=n.onExit)===null||L===void 0||L.call(n,x))}}}const n_=new Er("suggestion");function r_({pluginKey:t=n_,editor:e,char:s="@",allowSpaces:n=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:a=!1,decorationTag:l="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:h="is-empty",command:u=()=>null,items:f=()=>[],minQueryLength:m=0,debounce:p=0,initialItems:g,placement:x="bottom-start",offset:b={},container:v,flip:_=!0,floatingUi:L,dismissOnOutsideClick:y=!0,render:w=()=>({}),allow:S=()=>!0,findSuggestionMatch:k=EI,shouldShow:j,shouldResetDismissed:N}){const V=w?.(),C=n&&!r,T=(E,I)=>MI(e,E,I,t);function A(E){return II({...E,editor:e,shouldResetDismissed:N,effectiveAllowSpaces:C})}const R=E=>OI({view:E,pluginKeyRef:t});return new nd({key:t,view:()=>KI({editor:e,pluginKey:t,items:f,renderer:V,minQueryLength:m,debounce:p,initialItems:g,placement:x,offset:b,container:v,flip:_,floatingUi:L,dismissOnOutsideClick:y,command:u,clientRectFor:T,dispatchExit:R}),state:BI({editor:e,char:s,effectiveAllowSpaces:C,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,findSuggestionMatch:k,allow:S,shouldShow:j,shouldKeepDismissed:A,pluginKey:t}),props:$I({pluginKey:t,decorationTag:l,decorationClass:c,decorationContent:d,decorationEmptyClass:h,renderer:V,dispatchExit:R})})}function i_(t,e=n_){const s=t.state.tr.setMeta(e,{exit:!0});t.dispatch(s)}var WI=r_;function qI(t){const e=U.c(24),{editor:s,query:n,items:r,onSelect:i,onClose:a}=t,[l,c]=P.useState(0),d=P.useRef(r),h=P.useRef(l),u=P.useRef(i),f=P.useRef(a),m=P.useDeferredValue(n);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{c(0)},e[0]=p):p=e[0];let g;e[1]!==m?(g=[m],e[1]=m,e[2]=g):g=e[2],P.useEffect(p,g);let x,b;e[3]!==r.length||e[4]!==l?(x=()=>{l>=r.length&&r.length>0&&c(0)},b=[r.length,l],e[3]=r.length,e[4]=l,e[5]=x,e[6]=b):(x=e[5],b=e[6]),P.useEffect(x,b);let v,_;e[7]!==r?(v=()=>{d.current=r},_=[r],e[7]=r,e[8]=v,e[9]=_):(v=e[8],_=e[9]),P.useEffect(v,_);let L,y;e[10]!==l?(L=()=>{h.current=l},y=[l],e[10]=l,e[11]=L,e[12]=y):(L=e[11],y=e[12]),P.useEffect(L,y);let w,S;e[13]!==i?(S=()=>{u.current=i},w=[i],e[13]=i,e[14]=w,e[15]=S):(w=e[14],S=e[15]),P.useEffect(S,w);let k,j;e[16]!==a?(k=()=>{f.current=a},j=[a],e[16]=a,e[17]=k,e[18]=j):(k=e[17],j=e[18]),P.useEffect(k,j);let N,V;e[19]!==s?(N=()=>{if(s?.isDestroyed)return;let A;try{A=s.view.dom}catch{return}if(!A)return;const R=I=>{const D=d.current;if(!D.length)return!1;const O=()=>c(M=>(M+1)%D.length),$=()=>c(M=>(M-1+D.length)%D.length);switch(I.key){case"ArrowUp":return I.preventDefault(),$(),!0;case"ArrowDown":return I.preventDefault(),O(),!0;case"Tab":return I.preventDefault(),I.shiftKey?$():O(),!0;case"Home":return I.preventDefault(),c(0),!0;case"End":return I.preventDefault(),c(D.length-1),!0;case"Enter":{if(I.isComposing)return!1;I.preventDefault();const M=h.current;return M!==-1&&D[M]&&u.current?.(D[M],M),!0}case"Escape":return I.preventDefault(),f.current?.(),!0;default:return!1}},E=I=>{R(I)};return A.addEventListener("keydown",E,!0),()=>{A?.removeEventListener("keydown",E,!0)}},V=[s],e[19]=s,e[20]=N,e[21]=V):(N=e[20],V=e[21]),P.useEffect(N,V);const C=r.length?l:void 0;let T;return e[22]!==C?(T={selectedIndex:C,setSelectedIndex:c},e[22]=C,e[23]=T):T=e[23],T}function GI(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const o_=P.createContext(void 0);function a_(){const t=P.useContext(o_);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function YI(t){const e=U.c(16),{editor:s,char:n,pluginKey:r,allow:i,onOpenChange:a}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=l):l=e[0];const[c,d]=P.useReducer(GI,l);let h;e[1]!==a?(h=g=>{a?.(g)},e[1]=a,e[2]=h):h=e[2];const u=P.useEffectEvent(h);let f;e[3]!==n||e[4]!==i||e[5]!==s||e[6]!==u||e[7]!==r?(f=()=>{if(s?.isDestroyed)return;const g=r instanceof Er?r:new Er(r);s.state.plugins.find(v=>v.spec.key===g)&&s.unregisterPlugin(g);const b=r_({pluginKey:g,editor:s,char:n,allow(v){const _=s.state.doc.resolve(v.range.from);for(let L=_.depth;L>0;L--)if(_.node(L).type.name==="image")return!1;return!(i&&!i(v))},command(){},render:()=>({onStart:v=>{d({type:"ON_START",payload:{element:v.decorationNode??null,query:v.query,range:v.range}}),u(!0)},onUpdate:v=>{d({type:"ON_UPDATE",payload:{element:v.decorationNode??null,query:v.query,range:v.range}})},onKeyDown:v=>v.event.key==="Escape"?(d({type:"ON_EXIT"}),!0):!1,onExit:()=>{d({type:"ON_EXIT"}),u(!1)}}),items:QI});return s.registerPlugin(b),()=>{s?.isDestroyed||s.unregisterPlugin(g)}},e[3]=n,e[4]=i,e[5]=s,e[6]=u,e[7]=r,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==i||e[11]!==s||e[12]!==r?(m=[s,r,n,d,i],e[9]=n,e[10]=i,e[11]=s,e[12]=r,e[13]=m):m=e[13],P.useEffect(f,m);let p;return e[14]!==c?(p={state:c,dispatch:d},e[14]=c,e[15]=p):p=e[15],p}function QI(){return[]}function XI({editor:t,queryKey:e,queryFn:s,onSelect:n}){const{state:r,dispatch:i}=a_(),a=P.useDeferredValue(r.query),{data:l}=Uf({queryKey:at.suggestionItems(e,r.open,a),queryFn:()=>r.open?s({query:a}):[]}),c=()=>{i({type:"ON_EXIT"})},d=async(u,f)=>{if(!(r.selectedItem!==null||!r.range)){i({type:"SET_SELECTED_ITEM",payload:u});try{const{view:m}=t,g=m.state.selection.$to.nodeAfter?.text?.startsWith(" "),x=r.range?{...r.range}:{from:0,to:0};g&&r.range&&(x.to+=1),await n({range:x,item:u})===!1?i({type:"SET_SELECTED_ITEM",payload:null}):c()}catch{c()}}},{selectedIndex:h}=qI({editor:t,query:a,items:l,onSelect:d,onClose:c});return{selectedItem:r.selectedItem,items:l,selectedIndex:h,close:c,onSelect:d}}function JI({children:t}){const{state:e,dispatch:s}=a_(),{open:n,element:r}=e,i=()=>{s({type:"ON_EXIT"})},{refs:a,floatingStyles:l,context:c}=VI({placement:"bottom-start",open:n,onOpenChange:f=>{f||i()},elements:{reference:r},middleware:[vN(10),yN(),_N()],whileElementsMounted:t6}),d=CI(c,{outsidePress:f=>!(f.target instanceof Element&&f.target.closest(".ProseMirror"))}),h=AI(c,{role:"listbox"}),{getFloatingProps:u}=TI([d,h]);return n?o.jsx(wI,{children:o.jsx("div",{ref:a.setFloating,style:l,...u(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const ZI=t=>{const e=U.c(29),{item:s,isSelected:n,onSelect:r,isLoading:i,ref:a}=t;let l;if(e[0]!==s){const w=$i(s._meta);l=s.title||R2(s.name,w),e[0]=s,e[1]=l}else l=e[1];const c=l,d=s.description||null,h=s.icon,u=n&&"bg-accent text-accent-foreground",f=i&&"pointer-events-none opacity-50";let m;e[2]!==u||e[3]!==f?(m=le("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",u,f),e[2]=u,e[3]=f,e[4]=m):m=e[4];let p;e[5]!==h||e[6]!==c?(p=h!==void 0&&o.jsx(Hi,{icon:h,name:c,size:"xs",className:"mr-2"}),e[5]=h,e[6]=c,e[7]=p):p=e[7];let g;e[8]!==c?(g=o.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:c}),e[8]=c,e[9]=g):g=e[9];let x;e[10]!==i?(x=i&&o.jsx(nt,{size:"xs"}),e[10]=i,e[11]=x):x=e[11];let b;e[12]!==g||e[13]!==x?(b=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g,x]}),e[12]=g,e[13]=x,e[14]=b):b=e[14];let v;e[15]!==d?(v=d&&o.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d}),e[15]=d,e[16]=v):v=e[16];let _;e[17]!==b||e[18]!==v?(_=o.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,v]}),e[17]=b,e[18]=v,e[19]=_):_=e[19];let L;e[20]!==s.drillable?(L=s.drillable&&o.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"}),e[20]=s.drillable,e[21]=L):L=e[21];let y;return e[22]!==r||e[23]!==a||e[24]!==_||e[25]!==L||e[26]!==m||e[27]!==p?(y=o.jsxs("div",{ref:a,onClick:r,className:m,children:[p,_,L]}),e[22]=r,e[23]=a,e[24]=_,e[25]=L,e[26]=m,e[27]=p,e[28]=y):y=e[28],y},eO=t=>{const e=U.c(21),{editor:s,queryKey:n,queryFn:r,onSelect:i}=t,a=ue();let l;e[0]!==s||e[1]!==i||e[2]!==r||e[3]!==n?(l={editor:s,queryKey:n,queryFn:r,onSelect:i},e[0]=s,e[1]=i,e[2]=r,e[3]=n,e[4]=l):l=e[4];const{items:c,selectedIndex:d,onSelect:h,selectedItem:u}=XI(l);if(!c.length){let g;e[5]!==a?(g=a("chat.mention.noItemsFound"),e[5]=a,e[6]=g):g=e[6];let x;return e[7]!==g?(x=o.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:g}),e[7]=g,e[8]=x):x=e[8],x}let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[9]=f):f=e[9];let m;if(e[10]!==h||e[11]!==c||e[12]!==d||e[13]!==u?.name){let g;e[15]!==h||e[16]!==d||e[17]!==u?.name?(g=(x,b)=>o.jsx(ZI,{item:x,isSelected:b===d,ref:b===d?nO:void 0,onSelect:()=>h(x,b),isLoading:u?.name===x.name},`${x.kind??"item"}:${x.name}`),e[15]=h,e[16]=d,e[17]=u?.name,e[18]=g):g=e[18],m=c.map(g),e[10]=h,e[11]=c,e[12]=d,e[13]=u?.name,e[14]=m}else m=e[14];let p;return e[19]!==m?(p=o.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:f,children:o.jsx("div",{className:"p-1",children:m})}),e[19]=m,e[20]=p):p=e[20],p};function tO(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"p-1",children:[...Array(3)].map(sO)}),t[0]=e):e=t[0],e}function sO(t,e){return o.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[o.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),o.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function l_(t){const e=U.c(18),{editor:s,char:n,pluginKey:r,queryKey:i,queryFn:a,onSelect:l,allow:c,onOpenChange:d}=t;let h;e[0]!==c||e[1]!==n||e[2]!==s||e[3]!==d||e[4]!==r?(h={editor:s,char:n,pluginKey:r,allow:c,onOpenChange:d},e[0]=c,e[1]=n,e[2]=s,e[3]=d,e[4]=r,e[5]=h):h=e[5];const{state:u,dispatch:f}=YI(h);let m;e[6]!==f||e[7]!==u?(m={state:u,dispatch:f},e[6]=f,e[7]=u,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(tO,{}),e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==l||e[12]!==a||e[13]!==i?(g=o.jsx(JI,{children:o.jsx(P.Suspense,{fallback:p,children:o.jsx(eO,{editor:s,queryKey:i,queryFn:a,onSelect:l})})}),e[10]=s,e[11]=l,e[12]=a,e[13]=i,e[14]=g):g=e[14];let x;return e[15]!==m||e[16]!==g?(x=o.jsx(o_.Provider,{value:m,children:g}),e[15]=m,e[16]=g,e[17]=x):x=e[17],x}function nO(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const rO=t=>{const e=U.c(53),{editor:s,virtualMcpId:n,suggestionOpenRef:r}=t,i=ue(),a=Ns(),{org:l}=Fe(),c=tl();let d;e[0]!==c?(d=x8(c),e[0]=c,e[1]=d):d=e[1];const h=d;let u;e[2]!==l.id||e[3]!==l.slug||e[4]!==n?(u={connectionId:n,orgId:l.id,orgSlug:l.slug},e[2]=l.id,e[3]=l.slug,e[4]=n,e[5]=u):u=e[5];const f=Vn(u);let m;e[6]!==l.id||e[7]!==n?(m=at.virtualMcpResources(n,l.id),e[6]=l.id,e[7]=n,e[8]=m):m=e[8];const p=m,[g,x]=P.useState("categories");let b;e[9]!==g?(b=()=>g,e[9]=g,e[10]=b):b=e[10];const v=P.useEffectEvent(b),_=P.useRef(null),L=P.useRef(!1),y=n??"default";let w;e[11]!==g||e[12]!==l.id||e[13]!==y?(w=["at-mention",l.id,y,g],e[11]=g,e[12]=l.id,e[13]=y,e[14]=w):w=e[14];const S=w;let k;e[15]!==i?(k=i("chat.mentionAt.agentsTitle"),e[15]=i,e[16]=k):k=e[16];let j;e[17]!==i?(j=i("chat.mentionAt.agentsDescription"),e[17]=i,e[18]=j):j=e[18];let N;e[19]!==k||e[20]!==j?(N={name:"agents",title:k,description:j,kind:"category",drillable:!0},e[19]=k,e[20]=j,e[21]=N):N=e[21];let V;e[22]!==i?(V=i("chat.mentionAt.resourcesTitle"),e[22]=i,e[23]=V):V=e[23];let C;e[24]!==i?(C=i("chat.mentionAt.resourcesDescription"),e[24]=i,e[25]=C):C=e[25];let T;e[26]!==V||e[27]!==C?(T={name:"resources",title:V,description:C,kind:"category",drillable:!0},e[26]=V,e[27]=C,e[28]=T):T=e[28];let A;e[29]!==T||e[30]!==N?(A=[N,T],e[29]=T,e[30]=N,e[31]=A):A=e[31];const R=A;let E;e[32]!==f||e[33]!==s||e[34]!==i?(E=async F=>{const{item:B,range:H}=F;if(Ye("chat_picker_item_selected",{picker:"@",item_kind:B.kind,item_name:B.name}),B.kind!=="category"&&(L.current=!0),B.kind==="category")return x(B.name==="agents"?"agents":"resources"),!1;if(B.kind==="agent"&&B.agentId){Uc(s,H,{id:B.agentId,name:B.name,metadata:{agentId:B.agentId,title:B.name},char:"@"}),x("categories");return}if(B.kind==="resource"&&B.uri&&f){try{const W=await s6(f,B.uri);Uc(s,H,{id:B.uri,name:B.uri,metadata:W.contents,char:"@"})}catch(W){console.error("[at-mention] Failed to fetch resource:",W),ye.error(i("chat.mentionAt.failedToLoadResource"))}x("categories");return}},e[32]=f,e[33]=s,e[34]=i,e[35]=E):E=e[35];const I=E;let D;e[36]!==c||e[37]!==R||e[38]!==f||e[39]!==h||e[40]!==v||e[41]!==a||e[42]!==p||e[43]!==n?(D=async F=>{const{query:B}=F,H=v();if(H==="categories"){if(!B.trim())return R;const q=B.toLowerCase(),G=c.filter(X=>X.status==="active"&&(!X.id||!Em(X.id))&&!h.has(X.id)&&X.id!==n&&(X.title.toLowerCase().includes(q)||X.description?.toLowerCase().includes(q))).map(iO),te=await(async()=>{if(!f)return[];let X=a.getQueryData(p);return X||(X=await a.fetchQuery({queryKey:p,queryFn:()=>su(f),staleTime:6e4})),(X?.resources??[]).filter(Z=>Z.uri.toLowerCase().includes(q)||Z.name?.toLowerCase().includes(q)||Z.description?.toLowerCase().includes(q)).map(oO)})();return[...G,...te]}if(H==="agents"){let q=c.filter(G=>G.status==="active"&&(!G.id||!Em(G.id))&&!h.has(G.id)&&G.id!==n);if(B.trim()){const G=B.toLowerCase();q=q.filter(te=>te.title.toLowerCase().includes(G)||te.description?.toLowerCase().includes(G))}return q.map(aO)}if(!f)return[];let W=a.getQueryData(p);W?a.fetchQuery({queryKey:p,queryFn:()=>su(f),staleTime:6e4}).catch(lO):W=await a.fetchQuery({queryKey:p,queryFn:()=>su(f),staleTime:6e4});let K=W?.resources??[];if(B.trim()){const q=B.toLowerCase();K=K.filter(G=>G.uri.toLowerCase().includes(q)||G.name?.toLowerCase().includes(q)||G.description?.toLowerCase().includes(q))}return K.map(cO)},e[36]=c,e[37]=R,e[38]=f,e[39]=h,e[40]=v,e[41]=a,e[42]=p,e[43]=n,e[44]=D):D=e[44];const O=D;let $;e[45]!==r?($=F=>{if(r&&(r.current=F),F)_.current=Date.now(),L.current=!1,Ye("chat_picker_opened",{picker:"@"});else{const B=_.current;Ye("chat_picker_closed",{picker:"@",outcome:L.current?"selected":"dismissed",duration_ms:B?Date.now()-B:null}),_.current=null,x("categories")}},e[45]=r,e[46]=$):$=e[46];const M=$;let z;return e[47]!==s||e[48]!==O||e[49]!==I||e[50]!==M||e[51]!==S?(z=o.jsx(l_,{editor:s,char:"@",pluginKey:"atDropdownMenu",queryKey:S,queryFn:O,onSelect:I,onOpenChange:M}),e[47]=s,e[48]=O,e[49]=I,e[50]=M,e[51]=S,e[52]=z):z=e[52],z};function iO(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function oO(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function aO(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function lO(){}function cO(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}async function j4(t,e,s,n,r,i,a){try{const l=await Yf(s,n,i);Uc(t,e,{id:n,name:Hu(n,r),metadata:l.messages,char:"/",kind:"prompt",args:i})}catch(l){console.error("[slash] Failed to fetch prompt:",l),ye.error(a.t("chat.mentionSlash.failedLoadPrompt"))}}async function dO(t,e,s,n,r){try{const i=await s6(s,n);Uc(t,e,{id:n,name:n,metadata:i.contents,char:"/",kind:"resource"})}catch(i){console.error("[slash] Failed to fetch resource:",i),ye.error(r.t("chat.mentionSlash.failedLoadResource"))}}async function uO(t,e,s,n,r){try{const{files:i,omittedPaths:a}=await aA(s,n.volume,n.path),l={sandboxPath:n.sandboxPath,files:i,omittedPaths:a};Uc(t,e,{id:n.id,name:n.name,metadata:l,char:"/",kind:"skill"})}catch(i){console.error("[slash] Failed to fetch skill:",i),ye.error(r.t("chat.mentionSlash.failedLoadSkill"))}}const hO=({editor:t,virtualMcpId:e,suggestionOpenRef:s})=>{const n=ue(),r=Ns(),{org:i}=Fe(),a=Vn({connectionId:e,orgId:i.id,orgSlug:i.slug}),l=at.virtualMcpPrompts(e,i.id),c=at.virtualMcpResources(e,i.id),d=at.slashSkills(i.id),h=["slash-mention",i.id,e??"default"],[u,f]=P.useState(null),[m,p]=P.useState(null),g=gV(t);g&&(g.onEditChip=async S=>{if(a)try{const j=(await C4(r,l,a)).find(N=>N.name===S.promptId);if(!j?.arguments||j.arguments.length===0)return;p({...S,prompt:j})}catch(k){console.error("[slash] Failed to load prompt for editing:",k),ye.error(n("chat.mentionSlash.failedLoadPrompt"))}});const x=P.useRef(null),b=P.useRef(!1),v=async({item:S,range:k})=>{if(Ye("chat_picker_item_selected",{picker:"/",item_kind:S.kind,item_name:S.name}),b.current=!0,!!a)if(S.kind==="prompt"){if(S.arguments&&S.arguments.length>0){f({range:k,item:S});return}const j=$i(S._meta);await j4(t,k,a,S.name,j,void 0,{t:n})}else S.kind==="skill"?S.skill&&await uO(t,k,i.slug,S.skill,{t:n}):S.uri&&await dO(t,k,a,S.uri,{t:n})},_=async S=>{if(!u||!a)return;const{range:k,item:j}=u,N=$i(j._meta);await j4(t,k,a,j.name,N,S,{t:n}),f(null)},L=async S=>{if(!(!m||!a)){if(!xV(t,m.pos,m.promptId)){ye.error(n("chat.mentionSlash.failedUpdatePrompt")),p(null);return}try{const k=await Yf(a,m.promptId,S),j=$i(m.prompt._meta);t.chain().focus().setNodeSelection(m.pos).deleteSelection().insertContentAt(m.pos,E2({id:m.promptId,name:Hu(m.promptId,j),metadata:k.messages,char:"/",kind:"prompt",args:S})).run(),Ye("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:m.promptId})}catch(k){console.error("[slash] Failed to update prompt:",k),ye.error(n("chat.mentionSlash.failedUpdatePrompt"))}p(null)}},y=async S=>{const{query:k}=S;if(!a)return[];const[j,N,V]=await Promise.all([C4(r,l,a),mO(r,c,a),fO(r,d,i.slug)]),C=k.trim().toLowerCase(),T=(j??[]).filter(E=>!C||E.name.toLowerCase().includes(C)||E.title?.toLowerCase().includes(C)||E.description?.toLowerCase().includes(C)).map(E=>({name:E.name,title:E.title,description:E.description,kind:"prompt",arguments:E.arguments,_meta:E._meta})),A=(N??[]).filter(E=>!C||E.uri.toLowerCase().includes(C)||E.name?.toLowerCase().includes(C)||E.description?.toLowerCase().includes(C)).map(E=>({name:E.name??E.uri,title:E.name,description:E.description,kind:"resource",uri:E.uri})),R=(V??[]).filter(E=>!C||E.name.toLowerCase().includes(C)||E.id.toLowerCase().includes(C)||E.description?.toLowerCase().includes(C)).map(E=>({name:E.name,title:E.name,description:E.description??void 0,kind:"skill",skill:E}));return[...T,...A,...R]},w=u?.item.kind==="prompt"?{name:u.item.name,title:u.item.title,arguments:u.item.arguments,description:u.item.description,_meta:u.item._meta}:null;return o.jsxs(o.Fragment,{children:[o.jsx(l_,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:h,queryFn:y,onSelect:v,onOpenChange:S=>{if(s&&(s.current=S),S)x.current=Date.now(),b.current=!1,Ye("chat_picker_opened",{picker:"/"});else{const k=x.current;Ye("chat_picker_closed",{picker:"/",outcome:b.current?"selected":"dismissed",duration_ms:k?Date.now()-k:null}),x.current=null}}}),o.jsx(Uh,{prompt:w,setPrompt:()=>f(null),onSubmit:_}),o.jsx(Uh,{prompt:m?.prompt??null,setPrompt:()=>p(null),onSubmit:L,defaultValues:m?.args},m?`edit-${m.promptId}-${m.pos}`:"edit-idle")]})};async function C4(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>Rm(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>Rm(s),staleTime:6e4}),n?.prompts??[]}async function fO(t,e,s){const n=t.getQueryData(e),r=()=>t.fetchQuery({queryKey:e,queryFn:()=>lA(s),staleTime:6e4});return n?(r().catch(()=>{}),n):r().catch(()=>[])}async function mO(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>su(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>su(s),staleTime:6e4}),n?.resources??[]}const c_="Ask anything, / for prompts & skills, @ for agents & resources...";function pO(t){return[Wf.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),Pg.configure({placeholder:()=>t.current??c_,showOnlyWhenEditable:!1}),vV,yV]}function d_({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:n=!1,placeholder:r,onSubmit:i,suggestionOpenRef:a,children:l}){const c=P.useRef(i),d=P.useRef(e),h=P.useRef(n),u=P.useRef(r),f=Kf({extensions:pO(u),content:t||"",editorProps:{attributes:{"data-chat-input":"true",role:"textbox","aria-multiline":"true","aria-label":r??c_,class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,p)=>p.key==="Enter"&&!p.shiftKey&&h.current&&!a?.current?(p.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{d.current(m?.getJSON())}});return P.useEffect(()=>{f?.setEditable(!s)},[f,s]),P.useEffect(()=>{c.current=i},[i]),P.useEffect(()=>{d.current=e},[e]),P.useEffect(()=>{h.current=n},[n]),P.useEffect(()=>{u.current=r},[r]),P.useEffect(()=>{if(!f||f.isDestroyed)return;const m=JSON.stringify(f.getJSON()),p=JSON.stringify(t||{type:"doc",content:[]});m!==p&&f.commands.setContent(t||{type:"doc",content:[]})},[f,t]),o.jsx(bV.Provider,{value:{editor:f},children:l})}function u_(t){const e=U.c(29),{disabled:s,virtualMcpId:n,showFileUploader:r,selectedModel:i,onUnsupportedFile:a,suggestionOpenRef:l,ref:c,className:d}=t,h=s===void 0?!1:s,u=r===void 0?!1:r,{editor:f}=Ku();let m,p;if(e[0]!==f?(m=()=>({focus:()=>{f?.commands.focus()},clear:()=>{f?.commands.clearContent(!0)},appendText:j=>{if(!f)return;const N=f.state.doc.textContent.trim()==="";f.commands.focus("end"),N||f.commands.insertContent(" "),f.commands.insertContent(j)},syncVoiceText:(j,N)=>{if(f&&(f.commands.setContent(j||{type:"doc",content:[]}),N)){f.commands.focus("end");const V=f.state.doc.textContent.trim().length>0;f.commands.insertContent({type:"text",text:V?" "+N:N})}},restoreContent:j=>{f&&f.commands.setContent(j||{type:"doc",content:[]})}}),p=[f],e[0]=f,e[1]=m,e[2]=p):(m=e[1],p=e[2]),P.useImperativeHandle(c??null,m,p),!f)return null;const g=h&&"cursor-not-allowed opacity-70",x=h&&"[&_.ProseMirror]:cursor-not-allowed";let b;e[3]!==d||e[4]!==g||e[5]!==x?(b=le("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",d,"[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0","[&_.ProseMirror_p.is-editor-empty:first-child::before]:w-full","[&_.ProseMirror_p.is-editor-empty:first-child::before]:break-words",g,x),e[3]=d,e[4]=g,e[5]=x,e[6]=b):b=e[6];let v;e[7]!==f||e[8]!==b?(v=o.jsx(qf,{editor:f,className:b}),e[7]=f,e[8]=b,e[9]=v):v=e[9];const _=n??null;let L;e[10]!==f||e[11]!==l||e[12]!==_?(L=o.jsx(P.Suspense,{fallback:null,children:o.jsx(hO,{editor:f,virtualMcpId:_,suggestionOpenRef:l})}),e[10]=f,e[11]=l,e[12]=_,e[13]=L):L=e[13];const y=n??null;let w;e[14]!==f||e[15]!==l||e[16]!==y?(w=o.jsx(P.Suspense,{fallback:null,children:o.jsx(rO,{editor:f,virtualMcpId:y,suggestionOpenRef:l})}),e[14]=f,e[15]=l,e[16]=y,e[17]=w):w=e[17];let S;e[18]!==h||e[19]!==f||e[20]!==a||e[21]!==i||e[22]!==u?(S=u&&i&&!h?o.jsx(PM,{editor:f,selectedModel:i,onUnsupportedFile:a}):null,e[18]=h,e[19]=f,e[20]=a,e[21]=i,e[22]=u,e[23]=S):S=e[23];let k;return e[24]!==L||e[25]!==w||e[26]!==S||e[27]!==v?(k=o.jsxs(o.Fragment,{children:[v,L,w,S]}),e[24]=L,e[25]=w,e[26]=S,e[27]=v,e[28]=k):k=e[28],k}function h_(t){const e=U.c(3),[s]=no();let n;return e[0]!==s.enableSounds||e[1]!==t?(n=()=>{s.enableSounds&&fA(t.dataUri).catch(i=>{console.warn(`[sound] ${t.name} playback failed:`,i)})},e[0]=s.enableSounds,e[1]=t,e[2]=n):n=e[2],n}const gO={name:"switch-005",dataUri:"data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0VAAAAOAAADTGF2ZjYyLjMuMTAwAAAAAAAAAAAAAAD/+1DAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABkAABU4ABMTEx0dHR0nJycnMTExMTs7OztERERETk5OTlhYWFhiYmJibGxsbHZ2dnZ/f39/iYmJiZOTk5OdnZ2dp6enp7GxsbG7u7u7xMTExM7Ozs7Y2NjY4uLi4uzs7Oz29vb2/////wAAAABMYXZjNjIuMTEAAAAAAAAAAAAAAAAkBVYAAAAAAAAVOPCP8KUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//tQxAAACEwDXvQRAAG8Ii93HtACUCAABAKCJwfaCEHwfeoEAQdEAYygIHBOCAIAgCAJh9QIOg+D5/ygPh/wfB8DuKAgCHyn9QPh/5SCDv+CEHAQdxOD4B27c39tbckkqYbBAYAN9bNJLB+aXAf5wQAKdzxfbmrVIRQ4xNx3HwnoDmLhfMhgJiiw/HREXNCHqjvHEPEG8QjBYlxQNepJAT0kC8ip6JzSWj1TasoG+iyycbf2Uil1ovf1f/oUtR1qP+s1WSBFKoAAU02BDjMhuP/7UsQEgws8bRpd8YABJYPeBf9wCGXTGxBYcw5AJFMFMAmQQAhGAxgLBgHIAMYAAALhgAchipbe/91aU1VV4zcZj1Vf1XgYCIMBNrsBAIGs9/Ue4i/xFPeqCqwViI9/UeLf///rOngdA3OPHFjmOBv+EQnGahgaZxVplmkAH5JadDTQlNCEuGNiWYbCCONWdUJg6HXNazFdu1T+VgaEpOP70exv7f2/4b/yH//2/4cqCX/zWRUrIw+IPNMNlDnjAXQas/I4AzmYifA0tMSCgQDF//tSxBCDSzzi3k/sQwEyCtjJ/rBZAk+Uqj1YhA5YMCAAMwgOUchTkK7OR7LbMl0W1H6SvzG0Q2ZzfKUhnmTobv9DNhS1v7P8h//8Gv8gTRt1jReZ7YEjmMQg9hhwwMycHooasFmZyjcZGBKJD+IwbMCQQLoi+IQXCcIoydKoilI2MWFS5uJdDEu2taRrYI2ZSqKY50pJLv2NfjUAAuQAMfqVQ/T3PDQgMJMeEZ45hJzY6MNoFMxqTj1zNGQKJjAxEsSCBgQJBSIL0mcKYQJfVAn/+1LEGwLKlEKrD3MiYcuMkVa/wABB8Vh6M1q1epbvXwWBURhkyEhWZ/////////////9gjZ/Wt4w+4MNMCpE4TBYQl4w1IHvMDdA2zBngBMwc8COMDhCpDAfgOAAgrBgNYU+YC0FBGAkAMpgWoSCYAGESGBGAKBgXgJOdiOJmMCmNwCYNDJhYRPykRCJhTBnEUzlsjv4UNLj/z97n3Mv/7z1nZqyitYAZIqErIwMwJAqEw0GAAMFptJMaqFwB8CQIWlhuhuDAwNjfuwrQFAYXCf/7UsQVAA+9PTP42gYRdiIu9zBwAPbFUCi0DAhgNcS+7cDwVgM05A9bUDeuQMyE/u3CygVISgZhpIau/9PhdQG2C9DpxZZJmn/dn/Psmt0EFm////l84ThUTopE4VD/9JkubOGasTvN30C20G21qgUCkVCoUCgPMywrPCGly27V5q5t24vl/8jSlSAPCxzNseNCw3oh3NGBu4BZJ5hv7DRSfR/+eWG7nA8IKh2Olv5iz3q5m3//Joxo3JqNyYkSuGt/k6D4DeoBOHmHdl0dkZYA//tSxAUAC4B1Z/2DADEcA17Z/uhI4Yoik/TrZo+ww7UtmpW4LDWu2IacoJKJJeTSM+ZmAYBEiU+ZnnAwCn1VVVV6JUJQVnioKhrgqdKgqGpUFeCp0sDR3ztQNREDRUFioKuxKCpYGQBlRIBk+aLwb8KblGQVDdphPYTUdBOGbVpAaTF6ZdjEV0iRUZRCYkA4oUQDx5zqDugtXvza/7fuNNvfZ+j9v+T/2f//J/4cAAOTpE5K4zksR9MfIB+TDcQTI4gNs1XKAzEFUrGkxABYEBb/+1LEEYNKrEjgT/TCwYYVmUX+mHoKgWhKU5Eiw9SFIRmppw+3fYo4siPhUFeexM8KgIO6wVuPDDy01qeRaVbw357//y3+o8M0pBNlNLCGBzGKwyYw2IIFOE1WNTjRM6x8MlA1AxDhUHTAkEiyKpnbWrLcaOBotBUKbk1pypcWDAIK00AhKLGkUco6q9VWvM53mcaq3tVa8zjTM/tX//EDP//////////XAAmrwAAPoKwcw0ShDCZD/BQlhzinxQdorsOuXTEIC01ZkJyu4k/qPP/7UsQUAEjkrrkvZaPBIRXUoe5QObfMhYKX9RVgTPqCSCaSCaSC0XVdV1f/////6IAlguuAJSiDRNloNBsZg+0+Ts8MMCn81WUTRAlIi+GHECD0y8AWDIqswYsxGOSKVV7MqOni8tkVOip0fZX/////9HrMCbAz2EHGS4GKAAiRAAAYAcDdKd4G6Z/nwYgJ0ZAIgZyC8aPAs/iPBhwMpWDQNARltNS5Y61v//9i8Yl4SkFkIGTkAc0UBrIYLPA4MYBEy+YLMRuY4nhTC3hZA68H//tSxCoAyQC6mY6CkWDJBIsBz/QUrgNmahSzcrYw0/HhfnMAZBojDsgTFkDR5MDkG/DZEbk2FCmowqdqv2TYABiJwqqYjaQRGZ1URZ1DhSsdiHX/GBu0QpzIBNSaLqZ0ARkwFARxMrpt/Eh47mbQAhhU6sisFUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LESoHHJCRaj/dmYAIAQAAQAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsSLg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsShg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",duration:.609,format:"mp3",license:"CC0",author:"Kenney"},xO=hT.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),bO=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function vO(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center -space-x-1.5",children:bO.map(yO)}),t[0]=e):e=t[0],e}function yO(t){return o.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function _O({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:n,isStreaming:r,onUnsupportedFile:i}){const a=ue(),[l,c]=P.useState(!1),d=h_(gO),{org:h}=Fe(),{editor:u}=Ku(),f=P.useRef(null),m=a9(n),p=()=>{!m||r||(c(!1),f.current?.click())},g=async K=>{const q=K.target.files;if(!q||q.length===0||!u)return;const G=Array.from(q);try{let te=u.state.selection.from;for(const X of G)await Tg(u,n??null,X,te,i,a),te=u.state.selection.to}finally{f.current&&(f.current.value="")}},x=Vn({connectionId:s,orgId:h.id,orgSlug:h.slug}),b=at.virtualMcpPrompts(s,h.id),{data:v,isLoading:_}=Zt({queryKey:b,queryFn:()=>Rm(x),staleTime:6e4,enabled:l&&!!x}),L=v?.prompts??[],[y,w]=P.useState(null),{chatMode:S,setChatMode:k}=Za(),[j,N]=no(),V=ka.find(K=>K.value===j.toolApprovalLevel)??ka[0],C=a(V.shortKey),T=K=>{const q=ka.find(G=>G.value===K);if(q){if(q.value===j.toolApprovalLevel){c(!1);return}d(),Ye("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:q.value,source:"tools_popover"}),N({...j,toolApprovalLevel:q.value}),c(!1)}},A=S==="plan",R=()=>{d();const K=A?"default":"plan";Ye("chat_mode_changed",{from_mode:S,to_mode:K,source:"tools_popover"}),k(K),c(!1)},E=()=>{e(),c(!1)},I=async(K,q)=>{if(!u||!x)return;const G=$i(K._meta),te={from:u.state.selection.from,to:u.state.selection.to};try{const X=await Yf(x,K.name,q);Uc(u,te,{id:K.name,name:Hu(K.name,G),metadata:X.messages,char:"/",kind:"prompt",args:q})}catch{ye.error(a("chat.toolsPopover.failedLoadPrompt"))}},D=async K=>{c(!1);const q=!!(K.arguments&&K.arguments.length>0);if(Ye("chat_prompt_inserted",{prompt_name:K.name,with_arguments:q}),q){w(K);return}await I(K)},O=async K=>{y&&(await I(y,K),w(null))},$=()=>{d();const K=S==="gen-image"?"default":"gen-image";Ye("chat_mode_changed",{from_mode:S,to_mode:K,source:"tools_popover"}),k(K),c(!1)},M=()=>{d();const K=S==="web-search"?"default":"web-search";Ye("chat_mode_changed",{from_mode:S,to_mode:K,source:"tools_popover"}),k(K),c(!1)},z=()=>{d();const K=S==="deep-research"?"default":"deep-research";Ye("chat_mode_changed",{from_mode:S,to_mode:K,source:"tools_popover"}),k(K),c(!1)},F=S==="gen-image",B=S==="web-search",H=S==="deep-research",W=o.jsx("input",{ref:f,type:"file",multiple:!0,accept:XP(n??null),className:"hidden",onChange:g,disabled:r});return o.jsxs(o.Fragment,{children:[W,o.jsxs(Ft,{open:l,onOpenChange:K=>{K&&!l&&Ye("chat_tools_popover_opened",{chat_mode:S}),c(K)},children:[o.jsx(Ut,{asChild:!0,children:o.jsxs(me,{type:"button",variant:"ghost",size:"default",disabled:t,title:a("chat.toolsPopover.tools"),"aria-label":a("chat.toolsPopover.tools"),className:le("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[o.jsx(z6,{size:14}),o.jsx("span",{className:le("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:a("chat.toolsPopover.tools")})]})}),o.jsxs(Ht,{align:"start",className:"w-56 p-1.5 space-y-1",children:[m?o.jsxs(et,{onClick:p,disabled:r,children:[o.jsx(Qt,{size:16}),o.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.addFile")})]}):o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(et,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:K=>K.preventDefault(),children:[o.jsx(Qt,{size:16}),o.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.addFile")})]})}),o.jsx(We,{side:"right",children:a("chat.toolsPopover.modelNoFileSupport")})]}),o.jsxs(et,{onClick:R,className:le(A&&"text-special"),children:[o.jsx(Hc,{size:16,className:le(A&&"text-special")}),o.jsx("span",{className:"flex-1 whitespace-nowrap",children:a("chat.toolsPopover.planMode")}),o.jsx("span",{className:le("text-xs text-muted-foreground",A&&"text-special font-medium"),children:xO})]}),o.jsxs(et,{onClick:$,className:le(F&&"text-special"),children:[o.jsx(ar,{size:16,className:le(F&&"text-special")}),o.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.createImage")}),F&&o.jsx("span",{className:"text-xs text-special font-medium",children:a("chat.toolsPopover.on")})]}),o.jsxs(et,{onClick:M,className:le(B&&"text-special"),children:[o.jsx(Ki,{size:16,className:le(B&&"text-special")}),o.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.webSearch")}),B&&o.jsx("span",{className:"text-xs text-special font-medium",children:a("chat.toolsPopover.on")})]}),o.jsxs(et,{onClick:z,className:le(H&&"text-special"),children:[o.jsx(F6,{size:16,className:le(H&&"text-special")}),o.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.deepResearch")}),H&&o.jsx("span",{className:"text-xs text-special font-medium",children:a("chat.toolsPopover.on")})]}),o.jsxs(jr,{children:[o.jsxs(Cr,{className:"gap-2",children:[o.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),o.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.prompts")})]}),o.jsx(Nr,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:_?o.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[o.jsx(nt,{className:"size-3.5"}),a("chat.toolsPopover.loadingPrompts")]}):L.length===0?o.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:a("chat.toolsPopover.noPromptsAvailable")}):L.map(K=>o.jsxs(et,{onClick:()=>D(K),className:"flex flex-col items-start gap-0.5",children:[o.jsx("span",{className:"font-medium text-sm capitalize",children:K.title||R2(K.name,$i(K._meta))}),K.description&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:K.description})]},K.name))})]}),o.jsxs(jr,{children:[o.jsxs(Cr,{className:"gap-2",children:[o.jsx(Zf,{size:16}),o.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.approval")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:C})]}),o.jsx(Nr,{className:"w-48 p-1.5",children:o.jsx(Gh,{value:j.toolApprovalLevel,onValueChange:T,children:ka.map(K=>o.jsx(Bo,{value:K.value,children:a(K.labelKey)},K.value))})})]}),o.jsxs(et,{onClick:E,children:[o.jsx(dg,{size:16}),o.jsx("span",{className:"flex-1",children:a("chat.toolsPopover.connections")}),o.jsx(P.Suspense,{children:o.jsx(vO,{})})]})]})]}),o.jsx(Uh,{prompt:y,setPrompt:w,onSubmit:O})]})}const LO=[{src:"/connections/github.png",name:"GitHub"},{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/linear.png",name:"Linear"},{src:"/connections/shopify.png",name:"Shopify"},{src:"/connections/firecrawl.png",name:"Firecrawl"},{src:"/connections/perplexity.png",name:"Perplexity"}];function wO(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center -space-x-1",children:LO.map(SO)}),t[0]=e):e=t[0],e}function SO(t){return o.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function kO(t){const e=U.c(10),{onClick:s}=t,n=ue();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=le("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),e[0]=r):r=e[0];let i;e[1]!==n?(i=n("chat.connectionsBanner.description"),e[1]=n,e[2]=i):i=e[2];let a;e[3]!==i?(a=o.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:i}),e[3]=i,e[4]=a):a=e[4];let l,c;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(wO,{}),c=o.jsx(Us,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[5]=l,e[6]=c):(l=e[5],c=e[6]);let d;return e[7]!==s||e[8]!==a?(d=o.jsxs("button",{type:"button",onClick:s,className:r,children:[a,l,c]}),e[7]=s,e[8]=a,e[9]=d):d=e[9],d}const Hd=48;function jO(){const t=U.c(9),[e,s]=P.useState("idle"),[n,r]=P.useState(""),[i,a]=P.useState(""),[l,c]=P.useState(VO),d=P.useRef(null),h=P.useRef(null),u=P.useRef(null),f=P.useRef(null),m=P.useRef(0),p=P.useRef(!1),g=P.useRef(""),x=P.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let v;t[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0),h.current?.close().catch(NO),f.current?.getTracks().forEach(CO),u.current=null,h.current=null,f.current=null},t[0]=v):v=t[0];const _=v;let L;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const V=C=>{f.current=C;const T=new AudioContext;h.current=T;const A=T.createMediaStreamSource(C),R=T.createAnalyser();R.fftSize=128,R.smoothingTimeConstant=.8,A.connect(R),u.current=R;const E=new Uint8Array(R.frequencyBinCount),I=()=>{if(!u.current)return;u.current.getByteFrequencyData(E);const D=[];for(let O=0;O<Hd;O++){const $=Math.floor(O/Hd*E.length);D.push(Math.max(.04,(E[$]??0)/255))}c(D),m.current=requestAnimationFrame(I)};I()};L=async()=>{const C=window.SpeechRecognition||window.webkitSpeechRecognition;if(!C)return s("unsupported"),"unsupported";let T;try{T=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return s("permission-denied"),"permission-denied"}r(""),a(""),x.current="",g.current="",p.current=!0,s("recording"),V(T);const A=new C;d.current=A,A.interimResults=!0,A.continuous=!0,A.lang=navigator.language||"en-US",A.onresult=R=>{if(d.current!==A)return;let E="",I="";for(let D=R.resultIndex;D<R.results.length;D++){const O=R.results[D],$=O?.[0]?.transcript??"";O?.isFinal?I=I+$:E=E+$}I&&(g.current=g.current+I,r(g.current)),x.current=E,a(E)},A.onerror=R=>{d.current===A&&R.error!=="no-speech"&&(p.current=!1,d.current=null,_(),s(R.error==="not-allowed"?"permission-denied":"idle"))},A.onend=()=>{if(d.current===A&&p.current)try{A.start()}catch{}};try{A.start()}catch{return p.current=!1,d.current=null,_(),s("idle"),"idle"}return"recording"},t[1]=L}else L=t[1];const y=L;let w;t[2]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{p.current=!1,d.current?.stop(),_(),s("idle"),c(Array(Hd).fill(.05)),a("");const V=(g.current+(x.current?" "+x.current:"")).trim();return r(""),g.current="",x.current="",V},t[2]=w):w=t[2];const S=w;let k;t[3]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{p.current=!1,d.current?.abort(),_(),s("idle"),r(""),a(""),c(Array(Hd).fill(.05)),g.current="",x.current=""},t[3]=k):k=t[3];const j=k;let N;return t[4]!==i||t[5]!==e||t[6]!==n||t[7]!==l?(N={status:e,transcript:n,interimTranscript:i,waveformData:l,isSupported:b,startRecording:y,stopRecording:S,cancelRecording:j},t[4]=i,t[5]=e,t[6]=n,t[7]=l,t[8]=N):N=t[8],N}function CO(t){return t.stop()}function NO(){}function VO(){return Array(Hd).fill(.05)}function TO(t){const e=U.c(4),{data:s}=t;let n;e[0]!==s?(n=s.map(PO),e[0]=s,e[1]=n):n=e[1];let r;return e[2]!==n?(r=o.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:n}),e[2]=n,e[3]=r):r=e[3],r}function PO(t,e){return o.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}function AO(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function M0(t){const e=U.c(7),{message:s,icon:n}=t;let r;e[0]!==n?(r=n??o.jsx(Uu,{size:14,className:"shrink-0"}),e[0]=n,e[1]=r):r=e[1];const i=s??"";let a;e[2]!==i?(a=o.jsx("span",{className:"text-sm",children:i}),e[2]=i,e[3]=a):a=e[3];let l;return e[4]!==r||e[5]!==a?(l=o.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[r,a]}),e[4]=r,e[5]=a,e[6]=l):l=e[6],l}function EO(t,e,s){const n=U.c(7),{editor:r}=Ku(),i=ue(),[a,l]=P.useState(!1),c=P.useRef(0);let d,h;return n[0]!==s||n[1]!==r||n[2]!==e||n[3]!==t||n[4]!==i?(d=()=>{const u=g=>{g.dataTransfer?.types.includes("Files")&&(g.preventDefault(),c.current=c.current+1,l(!0))},f=g=>{g.preventDefault(),c.current=Math.max(0,c.current-1),c.current===0&&l(!1)},m=RO,p=g=>{if(g.preventDefault(),c.current=0,l(!1),s||!r||!t||!a9(t))return;const x=g.dataTransfer?.files;if(!x||x.length===0)return;const b=Array.from(x);(async()=>{let v=r.state.selection.from;for(const _ of b)await Tg(r,t,_,v,e,i),v=r.state.selection.to})()};return window.addEventListener("dragenter",u),window.addEventListener("dragleave",f),window.addEventListener("dragover",m),window.addEventListener("drop",p),()=>{window.removeEventListener("dragenter",u),window.removeEventListener("dragleave",f),window.removeEventListener("dragover",m),window.removeEventListener("drop",p)}},h=[r,t,e,i,s],n[0]=s,n[1]=r,n[2]=e,n[3]=t,n[4]=i,n[5]=d,n[6]=h):(d=n[5],h=n[6]),P.useEffect(d,h),a}function RO(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function DO(t){const e=U.c(14),{selectedModel:s}=t,n=ue();let r,i,a;if(e[0]!==s||e[1]!==n){const{parts:d}=m8(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(Qn,{size:24}),e[5]=a):a=e[5],r="text-sm font-medium";let h;e[6]!==n?(h=u=>n(u),e[6]=n,e[7]=h):h=e[7],i=n("chat.input.dropFilesHere",{fileTypes:d.map(h).join(", ")}),e[0]=s,e[1]=n,e[2]=r,e[3]=i,e[4]=a}else r=e[2],i=e[3],a=e[4];let l;e[8]!==r||e[9]!==i?(l=o.jsx("span",{className:r,children:i}),e[8]=r,e[9]=i,e[10]=l):l=e[10];let c;return e[11]!==a||e[12]!==l?(c=o.jsxs(o.Fragment,{children:[a,l]}),e[11]=a,e[12]=l,e[13]=c):c=e[13],c}function MO(){const t=U.c(5),e=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Uu,{size:24}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.input.modelCannotReadAttachments"),t[1]=e,t[2]=n):n=t[2];let r;return t[3]!==n?(r=o.jsxs(o.Fragment,{children:[s,o.jsx("span",{className:"text-sm font-medium",children:n})]}),t[3]=n,t[4]=r):r=t[4],r}function IO(t){const e=U.c(11),{selectedModel:s,onUnsupportedFile:n,disabled:r}=t,i=EO(s,n,r);let a;e[0]!==s?(a=a9(s),e[0]=s,e[1]=a):a=e[1];const l=a,c=i?"opacity-100":"opacity-0 pointer-events-none",d=l?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let h;e[2]!==c||e[3]!==d?(h=le("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,d),e[2]=c,e[3]=d,e[4]=h):h=e[4];let u;e[5]!==s||e[6]!==l?(u=l?o.jsx(DO,{selectedModel:s}):o.jsx(MO,{}),e[5]=s,e[6]=l,e[7]=u):u=e[7];let f;return e[8]!==h||e[9]!==u?(f=o.jsx("div",{className:h,children:u}),e[8]=h,e[9]=u,e[10]=f):f=e[10],f}function I0(t){const e=U.c(14),{onClick:s,label:n,icon:r,colorClass:i,maxWidthClass:a}=t;let l;e[0]!==i?(l=le("flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium group min-w-0 shrink animate-in fade-in duration-200",i),e[0]=i,e[1]=l):l=e[1];let c;e[2]!==a?(c=le("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:opacity-100",a),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==n||e[5]!==c?(d=o.jsx("span",{className:c,children:n}),e[4]=n,e[5]=c,e[6]=d):d=e[6];let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(nn,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"}),e[7]=h):h=e[7];let u;return e[8]!==r||e[9]!==n||e[10]!==s||e[11]!==l||e[12]!==d?(u=o.jsxs("button",{type:"button",onClick:s,title:n,"aria-label":n,className:l,children:[r,d,h]}),e[8]=r,e[9]=n,e[10]=s,e[11]=l,e[12]=d,e[13]=u):u=e[13],u}function OO(){const t=U.c(6),e=on(),{org:s,locator:n}=Fe(),{create:r}=Gu();let i;return t[0]!==r||t[1]!==n||t[2]!==e||t[3]!==s.id||t[4]!==s.slug?(i=async a=>{const{tiptapDoc:l,virtualMcp:c}=a,d=crypto.randomUUID(),h=c?.id??ia(s.id).id;xT(sessionStorage,n,d,{tiptapDoc:l});try{await r({id:d,virtual_mcp_id:h})}catch{}const u={virtualmcpid:h,autosend:bT};e({to:"/$org/$taskId",params:{org:s.slug,taskId:d},search:u})},t[0]=r,t[1]=n,t[2]=e,t[3]=s.id,t[4]=s.slug,t[5]=i):i=t[5],i}function $O({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=ue(),n=A2(),r=ws(),i=n?.messages??[],a=n?.isStreaming??!1,l=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=r?.taskId??"",h=d||LD,u=OO(),{selectedModel:f,selectedVirtualMcp:m,isModelsLoading:p,tiptapDocRef:g,imageModel:x,webSearchModel:b,deepResearchModel:v,chatMode:_,setChatMode:L}=Za(),{data:y}=Nn.useSession(),w=y?.user?.id,{org:S,locator:k}=Fe(),j=ia(S.id).id,N=Vs(m?.id),V=_n(N?.id).runtime==="cms",C=h_(mA),[T,A]=P.useState(!1),{unsupportedFile:R,onUnsupportedFile:E,clearUnsupportedFile:I}=MM(),D=jO(),O=P.useRef(void 0),$=async()=>{O.current=X;const Le=await D.startRecording();Ye("chat_voice_started",{thread_id:d,outcome:Le==="recording"?"started":Le==="unsupported"?"unsupported":Le==="permission-denied"?"permission_denied":"unknown"})},M=()=>{Ye("chat_voice_confirmed",{thread_id:d});const Le=D.stopRecording();ce.current?.syncVoiceText(O.current,Le),ce.current?.focus()},z=()=>{Ye("chat_voice_cancelled",{thread_id:d}),D.cancelRecording(),ce.current?.restoreContent(O.current)};P.useEffect(()=>{if(D.status!=="recording")return;const Le=(D.transcript+(D.interimTranscript?" "+D.interimTranscript:"")).trim();ce.current?.syncVoiceText(O.current,Le)},[D.transcript,D.interimTranscript,D.status]);const F=r?.activeTask??null,B=F?.created_by,H=!!(w&&B&&B!==w),{data:W}=u9({enabled:H}),K=(W?.data?.members??[]).find(Le=>Le.userId===B),q=K?.user?.name??K?.user?.email?.split("@")[0]??null,G=ad(),te=L6({isDesktopApp:G,harnessId:F?.harness_id}),[X,Z]=P.useState(()=>c4(sessionStorage,k,h)??void 0),ee=Le=>{Z(Le),g.current=Le,E7(sessionStorage,k,h,Le,{onQuotaExceeded:({docSizeBytes:ke})=>{Ye("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:ke}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},se=P.useRef(d);if(se.current!==d){se.current=d;const Le=c4(sessionStorage,k,h)??void 0;Z(Le),g.current=Le}const oe=[...i].reverse().find(Le=>Le.role==="assistant")?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow,ce=P.useRef(null),he=P.useRef(!1),ne=_==="plan",Q=Le=>{C(),Ye("chat_mode_changed",{from_mode:Le,to_mode:"default",source:"pill_dismiss"}),L("default")};P.useEffect(()=>{const Le=ke=>{D6(ke)&&ke.code==="KeyL"&&(ke.preventDefault(),ke.shiftKey&&L(_==="plan"?"default":"plan"),ce.current?.focus())};return document.addEventListener("keydown",Le),()=>document.removeEventListener("keydown",Le)},[_,L]);const de=w6(i),re=[...i].reverse().find(Le=>Le.role==="assistant"&&Le.metadata?.usage)?.metadata?.usage?.contextTokens??0,ie=!p&&!A7(X),Y=AO({hasDraft:ie,isStreaming:a,isRunInProgress:l}),pe=Y==="send",be=Y==="stop",_e=Le=>{if(Le?.preventDefault(),Y==="send"&&X){if(Ye("chat_message_sent",{thread_id:d||null,mode:_,model_id:f?.modelId??null,model_provider:f?.providerId??null,virtual_mcp_id:m?.id??null,submission:Le?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){ye.info(s("chat.input.stillSendingPreviousMessage"));return}n.sendMessage(X)}else u({tiptapDoc:X,virtualMcp:m});SD(sessionStorage,k,h),ee(void 0)}else Y==="stop"&&(Ye("chat_message_stopped",{thread_id:d}),c())};if(H)return o.jsx(M0,{message:q?s("chat.input.readOnlyOthersChatNamed",{name:q}):s("chat.input.readOnlyOthersChat"),icon:q?o.jsx(Fs,{shape:"circle",size:"2xs",url:K?.user?.image??void 0,fallback:q.slice(0,2).toUpperCase()}):void 0});if(F?.metadata?.read_only)return o.jsx(M0,{message:s("chat.input.readOnlyThread")});if(te)return o.jsx(M0,{message:s("chat.input.codingAgentRequiresDesktop")});if(V){if(!r)return o.jsx(M0,{message:s("chat.input.fastPreviewUnavailable")});const Le=()=>{const ke=r.createTask({runtime:"sandbox"});Ye("coding_session_started",{thread_id:ke})};return o.jsxs("button",{type:"button",onClick:Le,className:"group flex w-full items-center gap-3 rounded-2xl border border-border bg-background/60 px-4 py-3.5 text-left shadow-sm backdrop-blur-sm transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[o.jsx(rd,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:s("chat.fastPreview.startCodingSession")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:s("chat.fastPreview.chatNeedsSession")})]}),o.jsx(ro,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})}return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex flex-col w-full justify-end",children:o.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&o.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&r&&o.jsx(_9,{}),n&&r&&d?o.jsx(vM,{taskId:d}):null,o.jsx(d_,{tiptapDoc:X,setTiptapDoc:ee,disabled:D.status==="recording",enterToSubmit:!0,placeholder:s("chat.input.placeholder"),onSubmit:_e,suggestionOpenRef:he,children:o.jsxs("form",{onSubmit:_e,className:le("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[o.jsx(IO,{selectedModel:f,onUnsupportedFile:E,disabled:D.status==="recording"}),o.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:o.jsx(u_,{ref:ce,disabled:D.status==="recording",virtualMcpId:m?.id??j,showFileUploader:!0,selectedModel:f,onUnsupportedFile:E,suggestionOpenRef:he})}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:D.status==="recording"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex-1"}),o.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[o.jsx(TO,{data:D.waveformData.slice(0,28)}),o.jsx("button",{type:"button",onClick:z,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":s("chat.input.cancelRecording"),children:o.jsx(nn,{size:16})}),o.jsx("button",{type:"button",onClick:M,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":s("chat.input.useTranscription"),children:o.jsx($t,{size:16})})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[o.jsx(_O,{disabled:!1,onOpenConnections:()=>{Ye("connections_dialog_opened",{source:"tools_popover",mode:"add"}),A(!0)},virtualMcpId:m?.id??j,selectedModel:f,isStreaming:a,onUnsupportedFile:E}),ne&&o.jsx(I0,{onClick:()=>Q("plan"),label:s("chat.input.planMode"),icon:o.jsx(Hc,{size:14,className:"shrink-0"}),colorClass:"text-violet-600 dark:text-violet-400 hover:bg-violet-500/10",maxWidthClass:"@[320px]/chat-bottom:max-w-32"}),_==="gen-image"&&x&&o.jsx(I0,{onClick:()=>Q("gen-image"),label:s("chat.input.createImage"),icon:o.jsx(ar,{size:14,className:"shrink-0"}),colorClass:"text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),_==="web-search"&&b&&o.jsx(I0,{onClick:()=>Q("web-search"),label:s("chat.input.webSearch"),icon:o.jsx(Ki,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),_==="deep-research"&&v&&o.jsx(I0,{onClick:()=>Q("deep-research"),label:s("chat.input.deepResearch"),icon:o.jsx(F6,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),oe&&re>0&&o.jsx(_V,{usage:de,totalTokens:re,contextWindow:oe,onOpenContextPanel:t})]}),o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[o.jsx(TM,{}),D.isSupported&&o.jsx(me,{type:"button",onClick:$,disabled:!1,variant:"ghost",size:"icon",className:le("size-8 rounded-lg transition-colors",D.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:D.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),"aria-label":D.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),children:o.jsx(wT,{size:18})}),o.jsx(me,{type:be?"button":"submit",onClick:Le=>{be&&(Le.preventDefault(),Le.stopPropagation(),c())},variant:pe||be?"default":"ghost",size:"icon",disabled:!pe&&!be,className:le("size-8 rounded-lg transition-all",!pe&&!be&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:s(Y==="stop"?a?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessageEnter"),"aria-label":s(Y==="stop"?a?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessage"),children:be?o.jsx(ST,{size:20}):o.jsx(Hf,{size:20})})]})]})})]})},d),e&&o.jsx(kO,{onClick:()=>{Ye("connections_banner_clicked",{source:"home_chat_input"}),Ye("connections_dialog_opened",{source:"home_banner",mode:"add"}),A(!0)}})]})}),o.jsx(r8,{mode:"browse",open:T,onOpenChange:A,defaultTab:"all"}),o.jsx(RM,{info:R,onClose:I})]})}function BO(t){let e=0;for(const s of t)for(const n of s.parts??[]){const r=n;r.type==="tool-load_repo"&&r.state==="output-available"&&r.output?.success===!0&&e++}return e}function zO(){const t=U.c(8),{openPanel:e}=pi(),s=B2(),n=A2()?.messages??[],r=ws()?.taskId??null;let i;t[0]!==n?(i=BO(n),t[0]=n,t[1]=i):i=t[1];const a=i,l=P.useRef(null),c=P.useRef(null);let d,h;t[2]!==a||t[3]!==s||t[4]!==e||t[5]!==r?(d=()=>{if(!a||!r)return;const u=`${r}:${a}`;c.current!==u&&(c.current=u,s?.refreshThreadMetadata(r)),l.current!==r&&(l.current=r,e("site-editor"))},h=[a,r,e,s],t[2]=a,t[3]=s,t[4]=e,t[5]=r,t[6]=d,t[7]=h):(d=t[6],h=t[7]),P.useEffect(d,h)}const FO={usd:[{dollars:10,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:20,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.bestValueLabel"}],brl:[{dollars:50,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:500,labelKey:"chat.creditsEmptyState.bestValueLabel"}]};function f_(t){return`deco-credits-empty-dismissed:${t}`}function UO(t){try{return localStorage.getItem(f_(t))==="1"}catch{return!1}}function HO(){const t=U.c(68),e=ue(),{org:s}=Fe(),n=on(),{decoKeyId:r}=sg(),i=Ls(),[a,l]=P.useState(!0),[c,d]=P.useState(""),[h,u]=P.useState(!1),[f,m]=P.useState("usd"),p=f==="brl"?"R$":"$";let g;t[0]!==s.id?(g=()=>{Ye("credits_empty_state_dismissed",{organization_id:s.id}),l(!1);try{localStorage.setItem(f_(s.id),"1")}catch{}},t[0]=s.id,t[1]=g):g=t[1];const x=g;let b,v;t[2]!==a||t[3]!==s.id?(b=()=>{a&&Ye("credits_empty_state_shown",{organization_id:s.id})},v=[a,s.id],t[2]=a,t[3]=s.id,t[4]=b,t[5]=v):(b=t[4],v=t[5]),P.useEffect(b,v);let _;t[6]!==f||t[7]!==i?(_=async G=>{const{url:te}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:G,currency:f});return te},t[6]=f,t[7]=i,t[8]=_):_=t[8];let L;t[9]!==x?(L=G=>{G&&window.open(G,"_blank","noopener,noreferrer"),x()},t[9]=x,t[10]=L):L=t[10];let y;t[11]!==e?(y=G=>{ye.error(e("chat.creditsEmptyState.topUpFailed",{message:G.message}))},t[11]=e,t[12]=y):y=t[12];let w;t[13]!==_||t[14]!==L||t[15]!==y?(w={mutationFn:_,onSuccess:L,onError:y},t[13]=_,t[14]=L,t[15]=y,t[16]=w):w=t[16];const{mutate:S,isPending:k}=Rs(w),j=parseFloat(c),N=!isNaN(j)&&j>=1;if(!a)return null;let V;t[17]!==x?(V=G=>!G&&x(),t[17]=x,t[18]=V):V=t[18];let C;t[19]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-warning/8 to-transparent pointer-events-none rounded-t-lg"}),t[19]=C):C=t[19];let T;t[20]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:o.jsx(U6,{size:20,className:"text-warning"})}),t[20]=T):T=t[20];let A;t[21]!==e?(A=e("chat.creditsEmptyState.title"),t[21]=e,t[22]=A):A=t[22];let R;t[23]!==A?(R=o.jsx(qt,{className:"text-lg font-semibold",children:A}),t[23]=A,t[24]=R):R=t[24];let E;t[25]!==e?(E=e("chat.creditsEmptyState.description"),t[25]=e,t[26]=E):E=t[26];let I;t[27]!==E?(I=o.jsx(In,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:E}),t[27]=E,t[28]=I):I=t[28];let D;t[29]!==R||t[30]!==I?(D=o.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[C,o.jsxs(ls,{className:"relative gap-3",children:[T,o.jsxs("div",{className:"text-center",children:[R,I]})]})]}),t[29]=R,t[30]=I,t[31]=D):D=t[31];let O;t[32]!==f||t[33]!==p||t[34]!==c||t[35]!==j||t[36]!==r||t[37]!==N||t[38]!==k||t[39]!==h||t[40]!==e||t[41]!==S?(O=r&&o.jsxs("div",{className:"px-6 pb-5",children:[o.jsx("div",{className:"mb-4",children:o.jsxs(r9,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:G=>{G&&m(G)},children:[o.jsx(Kc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),o.jsx(Kc,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),o.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:FO[f].map(G=>{const{dollars:te,labelKey:X}=G;return o.jsxs("button",{type:"button",disabled:k,onClick:()=>{Ye("credits_topup_clicked",{amount_cents:te*100,currency:f,tier_label:X,source:"empty_state"}),S(te*100)},className:le("relative flex flex-col items-center gap-1 py-6 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[o.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,te]}),o.jsx("span",{className:"text-xs text-muted-foreground",children:e(X)})]},te)})}),h?o.jsxs("div",{className:"flex gap-2 mt-3",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),o.jsx(yt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:G=>d(G.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),o.jsx(me,{className:"h-10",disabled:!N||k,onClick:()=>{Ye("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:f,tier_label:"custom",source:"empty_state"}),S(Math.round(j*100))},children:e(k?"chat.creditsEmptyState.opening":"chat.creditsEmptyState.add")})]}):o.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>u(!0),children:e("chat.creditsEmptyState.enterCustomAmount")})]}),t[32]=f,t[33]=p,t[34]=c,t[35]=j,t[36]=r,t[37]=N,t[38]=k,t[39]=h,t[40]=e,t[41]=S,t[42]=O):O=t[42];let $;t[43]!==x||t[44]!==n||t[45]!==s.slug?($=()=>{n({to:"/$org/settings/ai-providers",params:{org:s.slug}}),x()},t[43]=x,t[44]=n,t[45]=s.slug,t[46]=$):$=t[46];let M;t[47]!==e?(M=e("chat.creditsEmptyState.useYourOwnProvider"),t[47]=e,t[48]=M):M=t[48];let z;t[49]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(ro,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[49]=z):z=t[49];let F;t[50]!==$||t[51]!==M?(F=o.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:$,children:[M,z]}),t[50]=$,t[51]=M,t[52]=F):F=t[52];let B;t[53]!==e?(B=e("chat.creditsEmptyState.skipForNow"),t[53]=e,t[54]=B):B=t[54];let H;t[55]!==x||t[56]!==B?(H=o.jsx(me,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:x,children:B}),t[55]=x,t[56]=B,t[57]=H):H=t[57];let W;t[58]!==F||t[59]!==H?(W=o.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[F,H]}),t[58]=F,t[59]=H,t[60]=W):W=t[60];let K;t[61]!==D||t[62]!==O||t[63]!==W?(K=o.jsxs(Bt,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:KO,children:[D,O,W]}),t[61]=D,t[62]=O,t[63]=W,t[64]=K):K=t[64];let q;return t[65]!==K||t[66]!==V?(q=o.jsx(zt,{open:!0,onOpenChange:V,children:K}),t[65]=K,t[66]=V,t[67]=q):q=t[67],q}function KO(t){return t.preventDefault()}function WO(t){const e=U.c(6),{balanceDollars:s}=t;let n;e[0]!==s?(n=s.toFixed(2),e[0]=s,e[1]=n):n=e[1];const r=n;let i,a;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=le("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-success/10 border border-success/20","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),a=o.jsx(U6,{size:13,className:"text-success"}),e[2]=i,e[3]=a):(i=e[2],a=e[3]);let l;return e[4]!==r?(l=o.jsxs("div",{className:i,children:[a,o.jsxs("span",{className:"text-xs font-medium text-success tabular-nums",children:["$",r," in credits to get started"]})]}),e[4]=r,e[5]=l):l=e[5],l}function qO(){const t=U.c(8),{org:e}=Fe(),s=on();let n;t[0]!==s||t[1]!==e.slug?(n=()=>s({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=s,t[1]=e.slug,t[2]=n):n=t[2];let r,i,a;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=le("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-warning/10 border border-warning/20","hover:bg-warning/15","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),i=o.jsx(vn,{size:13,className:"text-warning"}),a=o.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=r,t[4]=i,t[5]=a):(r=t[3],i=t[4],a=t[5]);let l;return t[6]!==n?(l=o.jsxs("button",{type:"button",onClick:n,className:r,children:[i,a]}),t[6]=n,t[7]=l):l=t[7],l}function GO(t){const e=U.c(7),{scrollRef:s,sentinelRef:n,hasMoreOlder:r,isFetchingOlder:i,fetchOlderMessages:a}=t;let l,c;e[0]!==a||e[1]!==r||e[2]!==i||e[3]!==s||e[4]!==n?(l=()=>{const d=n.current,h=s.current;if(!d||!h||!r)return;const u=new IntersectionObserver(async f=>{if(!f[0]?.isIntersecting||i||!r)return;const p=h.scrollHeight,g=h.scrollTop;await a(),requestAnimationFrame(()=>{const x=h.scrollHeight;h.scrollTop=g+(x-p)})},{root:h,rootMargin:"200px 0px 0px 0px"});return u.observe(d),()=>u.disconnect()},c=[s,n,r,i,a],e[0]=a,e[1]=r,e[2]=i,e[3]=s,e[4]=n,e[5]=l,e[6]=c):(l=e[5],c=e[6]),P.useEffect(l,c)}function YO(t){const e=U.c(5),{className:s,children:n}=t;let r;e[0]!==s?(r=le("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=r):r=e[1];let i;return e[2]!==n||e[3]!==r?(i=o.jsx("div",{className:r,children:n}),e[2]=n,e[3]=r,e[4]=i):i=e[4],i}function QO(t){const e=U.c(5),{children:s,className:n}=t;let r;e[0]!==n?(r=le("flex-1 min-h-0 overflow-y-auto isolate",n),e[0]=n,e[1]=r):r=e[1];let i;return e[2]!==s||e[3]!==r?(i=o.jsx("div",{className:r,children:s}),e[2]=s,e[3]=r,e[4]=i):i=e[4],i}function XO(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:s}),e[0]=s,e[1]=n):n=e[1],n}function JO(){const t=ue(),{messages:e,status:s,hasMoreOlder:n,isFetchingOlder:r,fetchOlderMessages:i}=dr(),{taskId:a}=an();zO();const l=_6(a??""),c=iV(l),d=c.size===0?e:e.filter(v=>!c.has(v.id)),h=LV(d),u=h.at(-1),m=_D()*aD+16,p=P.useRef(null),g=P.useRef(null);GO({scrollRef:p,sentinelRef:g,hasMoreOlder:n,isFetchingOlder:r,fetchOlderMessages:i});const x=wV({initial:!1}),b=v=>{p.current=v,x.scrollRef(v)};return o.jsx(SV,{messages:e,children:o.jsxs("div",{className:"relative h-full w-full min-w-0",children:[o.jsx("div",{ref:b,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:m},children:o.jsxs("div",{ref:x.contentRef,className:"overflow-x-clip",children:[o.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[o.jsx("div",{ref:g,"aria-hidden":!0,className:"h-px"}),r&&o.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:t("chat.chat.loadingOlderMessages")}),h.slice(0,-1).map((v,_)=>o.jsx(Ox,{pair:v,isLastPair:!1,status:_===h.length-1?s:void 0},`pair-${v.user?.id??v.assistant?.id}`))]}),u&&o.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:o.jsx(Ox,{pair:u,isLastPair:!0,status:s},`pair-${u.user?.id??u.assistant?.id}`)})]})}),!x.isAtBottom&&o.jsx(me,{type:"button",variant:"outline",size:"icon-sm","aria-label":t("chat.chat.jumpToLatest"),className:"absolute left-1/2 z-50 -translate-x-1/2 rounded-full shadow-md animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:m+8},onClick:()=>{x.scrollToBottom()},children:o.jsx(GN,{size:14})})]})})}function ZO(t){const e=U.c(5),{children:s,className:n}=t;let r;e[0]!==n?(r=le("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",n),e[0]=n,e[1]=r):r=e[1];let i;return e[2]!==s||e[3]!==r?(i=o.jsx("div",{className:r,children:s}),e[2]=s,e[3]=r,e[4]=i):i=e[4],i}const cn=Object.assign(YO,{Main:QO,Messages:JO,EmptyState:XO,Footer:ZO,Input:$O,Provider:rV,ActiveTaskProvider:nV,ThreadlessProvider:sV,IceBreakers:oD,NoAiProviderEmptyState:JP,CreditsEmptyState:HO,CreditsEyebrow:WO,NoCreditsEyebrow:qO,CreditsExhaustedBanner:U7});function Rg(t){return`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`}function Dg(t,e,s){return["decofile-write",t,e,s]}function Mg(t){return`/api/${t.orgSlug}/decofile/${encodeURIComponent(t.virtualMcpId)}/${encodeURIComponent(t.branch)}`}async function L9(t,e){const s=await t.json().catch(()=>({}));throw new Error(s.error??`${e} failed (${t.status})`)}function Ig(t,e,s){t.setQueryData(at.decofileDraft(Rg(e)),s)}function e$(t){const e=U.c(4);let s;e[0]!==t?(s=at.decofileDraft(t?Rg(t):""),e[0]=t,e[1]=s):s=e[1];let n;e[2]!==s?(n={queryKey:s,enabled:!1,queryFn:t$,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},e[2]=s,e[3]=n):n=e[3];const{data:r}=Zt(n);return r??null}async function t$(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function s$(t,e){const s=await fetch(Mg(e),{cache:"no-store"});if(!s.ok){const r=new Error(`Failed to fetch decofile: ${s.status}`);throw r.status=s.status,r}const n=await s.json();return n.token&&Ig(t,e,{version:n.version,token:n.token,apiHost:n.apiHost??window.location.host}),n.decofile}const n$=2880*60*1e3;function r$(t,e,s=n$){if(!t)return!1;const n=new Date(t).getTime();return Number.isNaN(n)?!1:e-n>s}async function i$(t){const e=await fetch(`${Mg(t)}/status`,{cache:"no-store"});return e.ok?await e.json():L9(e,"Status")}function o$(t){return{queryKey:at.decofileStatus(Rg(t)),queryFn:()=>i$(t),staleTime:3e4}}async function m_(t,e){const s=await fetch(Mg(t),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)});if(!s.ok)return L9(s,"Save");const n=await s.json();return{...n,apiHost:n.apiHost??window.location.host}}function a$({isThreadLocked:t,hasCloudProviderKeys:e}){return t?!1:!e}function l$(){const t=U.c(3),e=c9(),n=ws()?.isThreadLocked??!1,r=e.length>0;let i;return t[0]!==n||t[1]!==r?(i=a$({isThreadLocked:n,hasCloudProviderKeys:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function jd(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function k1(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function c$(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function d$(t){const e=U.c(4),{items:s}=t;let n;e[0]!==s?(n=s.map(u$),e[0]=s,e[1]=n):n=e[1];let r;return e[2]!==n?(r=o.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:n}),e[2]=n,e[3]=r):r=e[3],r}function u$(t){return o.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),o.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function h$(t){const e=U.c(33),{userTokens:s,assistantTokens:n,otherTokens:r}=t,i=ue(),a=s+n+r,l=a>0?s/a*100:0,c=a>0?n/a*100:0,d=a>0?r/a*100:0;let h;e[0]!==l?(h=l>0&&o.jsx("div",{className:"h-full bg-chart-1",style:{width:`${l}%`}}),e[0]=l,e[1]=h):h=e[1];let u;e[2]!==c?(u=c>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${c}%`}}),e[2]=c,e[3]=u):u=e[3];let f;e[4]!==d?(f=d>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${d}%`}}),e[4]=d,e[5]=f):f=e[5];let m;e[6]!==h||e[7]!==u||e[8]!==f?(m=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[h,u,f]}),e[6]=h,e[7]=u,e[8]=f,e[9]=m):m=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=p):p=e[10];let g;e[11]!==i||e[12]!==l?(g=i("chat.contextPanel.userPercent",{pct:l.toFixed(1)}),e[11]=i,e[12]=l,e[13]=g):g=e[13];let x;e[14]!==g?(x=o.jsxs("div",{className:"flex items-center gap-1.5",children:[p,o.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e[14]=g,e[15]=x):x=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[16]=b):b=e[16];let v;e[17]!==c||e[18]!==i?(v=i("chat.contextPanel.assistantPercent",{pct:c.toFixed(1)}),e[17]=c,e[18]=i,e[19]=v):v=e[19];let _;e[20]!==v?(_=o.jsxs("div",{className:"flex items-center gap-1.5",children:[b,o.jsx("span",{className:"text-xs text-muted-foreground",children:v})]}),e[20]=v,e[21]=_):_=e[21];let L;e[22]!==d||e[23]!==r||e[24]!==i?(L=r>0&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:i("chat.contextPanel.otherPercent",{pct:d.toFixed(1)})})]}),e[22]=d,e[23]=r,e[24]=i,e[25]=L):L=e[25];let y;e[26]!==_||e[27]!==L||e[28]!==x?(y=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[x,_,L]}),e[26]=_,e[27]=L,e[28]=x,e[29]=y):y=e[29];let w;return e[30]!==y||e[31]!==m?(w=o.jsxs("div",{className:"flex flex-col gap-2",children:[m,y]}),e[30]=y,e[31]=m,e[32]=w):w=e[32],w}function f$(t){const e=U.c(14),{agentId:s,isError:n}=t,r=Vs(s),i=ue();let a;e[0]!==r?.title||e[1]!==i?(a=r?.title??i("chat.subtask.subtaskNoun"),e[0]=r?.title,e[1]=i,e[2]=a):a=e[2];const l=a,c=r?.icon??null;let d;e[3]!==c||e[4]!==l?(d=o.jsx(io,{icon:c,name:l,size:"xs",className:"size-6 rounded-md shrink-0"}),e[3]=c,e[4]=l,e[5]=d):d=e[5];const h=n?"text-destructive":"text-foreground";let u;e[6]!==h?(u=le("shrink-0 font-medium",h),e[6]=h,e[7]=u):u=e[7];let f;e[8]!==l||e[9]!==u?(f=o.jsx("span",{className:u,children:l}),e[8]=l,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==d||e[12]!==f?(m=o.jsxs(o.Fragment,{children:[d,f]}),e[11]=d,e[12]=f,e[13]=m):m=e[13],m}function m$(t){const e=U.c(12),{isError:s}=t,n=ue();let r;e[0]!==n?(r=n("chat.contextPanel.subtask"),e[0]=n,e[1]=r):r=e[1];const i=r;let a;e[2]!==i?(a=o.jsx(io,{icon:null,name:i,size:"xs",className:"size-6 rounded-md shrink-0"}),e[2]=i,e[3]=a):a=e[3];const l=s?"text-destructive":"text-foreground";let c;e[4]!==l?(c=le("shrink-0 font-medium",l),e[4]=l,e[5]=c):c=e[5];let d;e[6]!==i||e[7]!==c?(d=o.jsx("span",{className:c,children:i}),e[6]=i,e[7]=c,e[8]=d):d=e[8];let h;return e[9]!==a||e[10]!==d?(h=o.jsxs(o.Fragment,{children:[a,d]}),e[9]=a,e[10]=d,e[11]=h):h=e[11],h}function p$(t){const e=U.c(18),{part:s}=t,n=s.input?.agent_id,r=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,i=s.state==="output-error",a=s.state==="approval-requested";let l;e[0]!==i?(l=o.jsx(m$,{isError:i}),e[0]=i,e[1]=l):l=e[1];let c;e[2]!==n||e[3]!==i?(c=o.jsx(f$,{agentId:n,isError:i}),e[2]=n,e[3]=i,e[4]=c):c=e[4];let d;e[5]!==l||e[6]!==c?(d=o.jsx(P.Suspense,{fallback:l,children:c}),e[5]=l,e[6]=c,e[7]=d):d=e[7];let h;e[8]!==s.input?(h=s.input?.prompt&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground/50",children:"·"}),o.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=h):h=e[9];let u;e[10]!==a||e[11]!==i||e[12]!==r?(u=o.jsx("span",{className:"ml-auto shrink-0",children:r?o.jsx(nt,{className:"size-3 text-muted-foreground"}):i?o.jsx(pA,{size:12,className:"text-destructive"}):a?o.jsx(vn,{size:12,className:"text-warning"}):o.jsx(gi,{size:12,className:"text-success"})}),e[10]=a,e[11]=i,e[12]=r,e[13]=u):u=e[13];let f;return e[14]!==d||e[15]!==h||e[16]!==u?(f=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[d,h,u]}),e[14]=d,e[15]=h,e[16]=u,e[17]=f):f=e[17],f}function g$(t){const e=U.c(78),{onClose:s,back:n,className:r}=t,i=ue(),[a,l]=P.useState(null),{messages:c}=dr(),{activeTask:d}=an(),{selectedModel:h,selectedVirtualMcp:u}=Za();let f,m,p,g,x,b,v,_;if(e[0]!==d||e[1]!==n||e[2]!==r||e[3]!==c||e[4]!==s||e[5]!==a?.id||e[6]!==h||e[7]!==u?.title||e[8]!==i){_=Symbol.for("react.early_return_sentinel");e:{const w=w6(c),S=[...c].reverse().find(C$),k=S?.metadata?.usage,j=S?.metadata?.modelLimits?.contextWindow??h?.limits?.contextWindow??null,N=k?.contextTokens??0,V=j&&j>0?(N/j*100).toFixed(1):null,C=c;let T;e[17]!==C?(T=C.filter(j$).reduce(k$,0),e[17]=C,e[18]=T):T=e[18];const A=T,R=c;let E;e[19]!==R?(E=R.filter(S$).reduce(w$,0),e[19]=R,e[20]=E):E=e[20];const I=E,D=Math.max(0,w.totalTokens-A-I),O=c[0],$=c.at(-1),M=O?.metadata?.created_at??d?.created_at,z=$?.metadata?.created_at??d?.updated_at,F=c.filter(L$),B=c.flatMap(y$),H=h?.modelId?c$(h.modelId):"—",W=u?.title??"Super Agent",K=[{label:i("chat.contextPanel.sessionLabel"),value:d?.title??i("chat.contextPanel.newChat")},{label:i("chat.contextPanel.messagesLabel"),value:F.length},{label:i("chat.contextPanel.agentLabel"),value:W},{label:i("chat.contextPanel.modelLabel"),value:H},{label:i("chat.contextPanel.contextLimitLabel"),value:j?jd(j):"—"},{label:i("chat.contextPanel.sessionTokensLabel"),value:w.totalTokens>0?jd(w.totalTokens):"0"},{label:i("chat.contextPanel.usageLabel"),value:V!==null?`${V}%`:"—"},{label:i("chat.contextPanel.inputTokensLabel"),value:w.inputTokens>0?jd(w.inputTokens):"0"},{label:i("chat.contextPanel.outputTokensLabel"),value:w.outputTokens>0?jd(w.outputTokens):"0"},{label:i("chat.contextPanel.reasoningTokensLabel"),value:w.reasoningTokens>0?jd(w.reasoningTokens):"0"},{label:i("chat.contextPanel.costLabel"),value:w.cost>0?`$${w.cost<.001?w.cost.toFixed(6):w.cost.toFixed(4)}`:"$0.00"},{label:i("chat.contextPanel.sessionCreatedLabel"),value:k1(M)},{label:i("chat.contextPanel.lastActivityLabel"),value:k1(z)}];if(!d&&F.length===0){let J;e[21]!==r?(J=le("flex flex-col h-full w-full border-l border-border bg-background",r),e[21]=r,e[22]=J):J=e[22];let oe;e[23]!==i?(oe=i("chat.contextPanel.title"),e[23]=i,e[24]=oe):oe=e[24];let ce;e[25]!==oe?(ce=o.jsx("span",{className:"text-sm font-medium text-foreground",children:oe}),e[25]=oe,e[26]=ce):ce=e[26];let he;e[27]!==n?(he=n?o.jsx(qh,{size:14,className:"text-muted-foreground"}):o.jsx(lr,{size:14,className:"text-muted-foreground"}),e[27]=n,e[28]=he):he=e[28];let ne;e[29]!==s||e[30]!==he?(ne=o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:he}),e[29]=s,e[30]=he,e[31]=ne):ne=e[31];let Q;e[32]!==ce||e[33]!==ne?(Q=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[ce,ne]}),e[32]=ce,e[33]=ne,e[34]=Q):Q=e[34];let de;e[35]!==i?(de=i("chat.contextPanel.emptyState"),e[35]=i,e[36]=de):de=e[36];let ae;e[37]!==de?(ae=o.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:de})}),e[37]=de,e[38]=ae):ae=e[38];let re;e[39]!==J||e[40]!==Q||e[41]!==ae?(re=o.jsxs("div",{className:J,children:[Q,ae]}),e[39]=J,e[40]=Q,e[41]=ae,e[42]=re):re=e[42],_=re;break e}e[43]!==r?(b=le("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[43]=r,e[44]=b):b=e[44];let q;e[45]!==i?(q=i("chat.contextPanel.title"),e[45]=i,e[46]=q):q=e[46];let G;e[47]!==q?(G=o.jsx("span",{className:"text-sm font-medium text-foreground",children:q}),e[47]=q,e[48]=G):G=e[48];let te;e[49]!==n?(te=n?o.jsx(qh,{size:14}):o.jsx(lr,{size:14}),e[49]=n,e[50]=te):te=e[50];let X;e[51]!==s||e[52]!==te?(X=o.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:te}),e[51]=s,e[52]=te,e[53]=X):X=e[53],e[54]!==G||e[55]!==X?(v=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[G,X]}),e[54]=G,e[55]=X,e[56]=v):v=e[56],f="flex flex-col gap-8 p-6",m=B.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:i("chat.contextPanel.subtasksSection")}),o.jsx("div",{className:"flex flex-col gap-1",children:B.map(v$)})]}),p=o.jsx(d$,{items:K});let Z;e[57]!==i?(Z=i("chat.contextPanel.contextBreakdownSection"),e[57]=i,e[58]=Z):Z=e[58];let ee;e[59]!==Z?(ee=o.jsx("span",{className:"text-xs text-muted-foreground",children:Z}),e[59]=Z,e[60]=ee):ee=e[60];let se;e[61]!==I||e[62]!==D||e[63]!==A?(se=o.jsx(h$,{userTokens:A,assistantTokens:I,otherTokens:D}),e[61]=I,e[62]=D,e[63]=A,e[64]=se):se=e[64],e[65]!==ee||e[66]!==se?(g=o.jsxs("div",{className:"flex flex-col gap-3",children:[ee,se]}),e[65]=ee,e[66]=se,e[67]=g):g=e[67],x=F.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:i("chat.contextPanel.rawMessagesSection")}),o.jsx("div",{className:"flex flex-col gap-1",children:F.map(J=>{const oe=J.metadata?.created_at,ce=a?.id===J.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>l(ce?null:J),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:le("shrink-0 font-medium",J.role==="user"?"text-chart-1":"text-chart-2"),children:J.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:J.id})]}),oe&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:k1(oe)})]}),ce&&o.jsxs(o.Fragment,{children:[J.role==="assistant"&&(()=>{const he=J.metadata?._request;if(!he)return null;const ne=he.systemSections??[],Q=Math.max(1,...ne.map(b$)),de=ne.reduce(x$,0);return o.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium text-foreground",children:i("chat.contextPanel.requestLabel")}),o.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[he.activeTools??0," / ",he.tools??0," ",i("chat.contextPanel.toolsActive")]})]}),ne.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"text-muted-foreground",children:[i("chat.contextPanel.systemPromptLabel")," ",o.jsxs("span",{className:"tabular-nums",children:["~",Math.round(de/4).toLocaleString()," ",i("chat.contextPanel.tokAbbrev")]})]}),ne.map((ae,re)=>{const ie=ae.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${re}`,Y=ae.chars/Q*100,pe=Math.round(ae.chars/4);return o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-mono text-foreground truncate",children:ie}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",pe.toLocaleString()," ",i("chat.contextPanel.tokAbbrev")]})]}),o.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${Y}%`}})})]},re)})]})]})})(),o.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(J,null,2)})]})]},J.id)})})]})}e[0]=d,e[1]=n,e[2]=r,e[3]=c,e[4]=s,e[5]=a?.id,e[6]=h,e[7]=u?.title,e[8]=i,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=x,e[14]=b,e[15]=v,e[16]=_}else f=e[9],m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],v=e[15],_=e[16];if(_!==Symbol.for("react.early_return_sentinel"))return _;let L;e[68]!==f||e[69]!==m||e[70]!==p||e[71]!==g||e[72]!==x?(L=o.jsxs("div",{className:f,children:[m,p,g,x]}),e[68]=f,e[69]=m,e[70]=p,e[71]=g,e[72]=x,e[73]=L):L=e[73];let y;return e[74]!==b||e[75]!==v||e[76]!==L?(y=o.jsxs("div",{className:b,children:[v,L]}),e[74]=b,e[75]=v,e[76]=L,e[77]=y):y=e[77],y}function x$(t,e){return t+e.chars}function b$(t){return t.chars}function v$(t,e){return o.jsx(p$,{part:t},e)}function y$(t){return(t.parts??[]).filter(_$)}function _$(t){return t.type==="tool-subtask"}function L$(t){return t.role!=="system"}function w$(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function S$(t){return t.role==="assistant"}function k$(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function j$(t){return t.role==="user"}function C$(t){return t.role==="assistant"&&t.metadata?.usage}function N$(t){const e=U.c(21),{onOpenContextPanel:s}=t,{org:n}=Fe(),{selectedVirtualMcp:r}=Za();let i;e[0]!==n.id?(i=ia(n.id),e[0]=n.id,e[1]=i):i=e[1];const l=r??i,d=Vs(l.id)??l,h=d.title??"Super Agent",u=d.icon??null,f=d.description??null;let m;e[2]!==u||e[3]!==h?(m=o.jsx(Hi,{icon:u,name:h,size:"lg"}),e[2]=u,e[3]=h,e[4]=m):m=e[4];let p;e[5]!==h?(p=o.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:h}),e[5]=h,e[6]=p):p=e[6];let g;e[7]!==f?(g=f?o.jsx("p",{className:"text-sm text-muted-foreground max-w-md text-balance",children:f}):null,e[7]=f,e[8]=g):g=e[8];let x;e[9]!==p||e[10]!==g?(x=o.jsxs("div",{className:"space-y-1.5",children:[p,g]}),e[9]=p,e[10]=g,e[11]=x):x=e[11];let b;e[12]!==m||e[13]!==x?(b=o.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center gap-4 px-6 text-center overflow-hidden",children:[m,x]}),e[12]=m,e[13]=x,e[14]=b):b=e[14];let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(cn.IceBreakers,{className:"pb-3"}),e[15]=v):v=e[15];let _;e[16]!==s?(_=o.jsxs(cn.Footer,{children:[v,o.jsx(cn.Input,{onOpenContextPanel:s})]}),e[16]=s,e[17]=_):_=e[17];let L;return e[18]!==b||e[19]!==_?(L=o.jsxs(o.Fragment,{children:[b,_]}),e[18]=b,e[19]=_,e[20]=L):L=e[20],L}function N4(t){const e=U.c(17),{outputs:s,collapsed:n,onToggle:r,variant:i}=t,a=i==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let l;e[0]!==a?(l=le(a),e[0]=a,e[1]=l):l=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=c):c=e[2];const d=n&&"-rotate-90";let h;e[3]!==d?(h=le("size-4 text-muted-foreground transition-transform",d),e[3]=d,e[4]=h):h=e[4];let u;e[5]!==h?(u=o.jsx(ds,{className:h}),e[5]=h,e[6]=u):u=e[6];let f;e[7]!==r||e[8]!==u?(f=o.jsxs("button",{type:"button",onClick:r,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[c,u]}),e[7]=r,e[8]=u,e[9]=f):f=e[9];let m;e[10]!==n||e[11]!==s?(m=!n&&o.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(V$)}),e[10]=n,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==l||e[14]!==f||e[15]!==m?(p=o.jsxs("div",{className:l,children:[f,m]}),e[13]=l,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function V$(t){return o.jsx(jV,{file:t},t.key)}function T$(){const t=U.c(13),e=ws()?.taskId??null,s=kV();let n;t[0]!==s?(n={enabled:s},t[0]=s,t[1]=n):n=t[1];const{data:r}=S6(e,n),[i,a]=P.useState(!1),[l,c]=P.useState(!0);if(!e||!r||r.length===0)return null;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>a(A$),t[2]=d):d=t[2];let h;t[3]!==i||t[4]!==r?(h=o.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:o.jsx(N4,{variant:"card",outputs:r,collapsed:i,onToggle:d})}),t[3]=i,t[4]=r,t[5]=h):h=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>c(P$),t[6]=u):u=t[6];let f;t[7]!==l||t[8]!==r?(f=o.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:o.jsx(N4,{variant:"bar",outputs:r,collapsed:l,onToggle:u})}),t[7]=l,t[8]=r,t[9]=f):f=t[9];let m;return t[10]!==h||t[11]!==f?(m=o.jsxs(o.Fragment,{children:[h,f]}),t[10]=h,t[11]=f,t[12]=m):m=t[12],m}function P$(t){return!t}function A$(t){return!t}function E$(){const t=U.c(31),{org:e}=Fe(),s=ws(),{isChatEmpty:n}=dr(),[r,i]=P.useState("chat"),a=sg(),l=l$(),{runtime:c}=_n(s?.virtualMcpId);if(l&&c!=="cms"){let N;return t[0]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(cn,{className:"animate-in fade-in-0 duration-200",children:o.jsx(cn.Main,{className:"flex flex-col items-center",children:o.jsx(cn.EmptyState,{children:o.jsx(cn.NoAiProviderEmptyState,{})})})}),t[0]=N):N=t[0],N}let h;t[1]!==a.hasDecoKey||t[2]!==a.hasOnlyDecoProvider||t[3]!==a.isLoading||t[4]!==a.isZeroBalance||t[5]!==n||t[6]!==e?(h=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&n&&!UO(e.id),t[1]=a.hasDecoKey,t[2]=a.hasOnlyDecoProvider,t[3]=a.isLoading,t[4]=a.isZeroBalance,t[5]=n,t[6]=e,t[7]=h):h=t[7];const u=h;let f;t[8]!==u?(f=u&&o.jsx(cn.CreditsEmptyState,{}),t[8]=u,t[9]=f):f=t[9];const m=r!=="chat"?!0:void 0,p=r!=="chat",g=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let x;t[10]!==g?(x=le("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",g),t[10]=g,t[11]=x):x=t[11];let b;t[12]!==n||t[13]!==c?(b=n&&c!=="cms"?o.jsx(N$,{onOpenContextPanel:()=>i("context")}):o.jsxs(o.Fragment,{children:[o.jsxs(cn.Main,{className:"relative flex flex-col overflow-hidden @container",children:[o.jsx(T$,{}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(cn.Messages,{})})]}),o.jsx(cn.Footer,{children:o.jsx(cn.Input,{onOpenContextPanel:()=>i("context")})})]}),t[12]=n,t[13]=c,t[14]=b):b=t[14];let v;t[15]!==m||t[16]!==p||t[17]!==x||t[18]!==b?(v=o.jsx("div",{inert:m,"aria-hidden":p,className:x,children:b}),t[15]=m,t[16]=p,t[17]=x,t[18]=b,t[19]=v):v=t[19];const _=r!=="context"?!0:void 0,L=r!=="context",y=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let w;t[20]!==y?(w=le("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",y),t[20]=y,t[21]=w):w=t[21];let S;t[22]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(g$,{back:!0,onClose:()=>i("chat")}),t[22]=S):S=t[22];let k;t[23]!==w||t[24]!==_||t[25]!==L?(k=o.jsx("div",{inert:_,"aria-hidden":L,className:w,children:S}),t[23]=w,t[24]=_,t[25]=L,t[26]=k):k=t[26];let j;return t[27]!==f||t[28]!==k||t[29]!==v?(j=o.jsxs(cn,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[f,v,k]}),t[27]=f,t[28]=k,t[29]=v,t[30]=j):j=t[30],j}function p_(){const t=U.c(7),e=ue();let s;t[0]!==e?(s=e("agentShellLayout.agentShellLayout.chatLoadingError"),t[0]=e,t[1]=s):s=t[1];let n;t[2]!==s?(n=o.jsx("div",{role:"alert",className:"flex h-full flex-1 items-center justify-center text-sm text-muted-foreground",children:s}),t[2]=s,t[3]=n):n=t[3];let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Ar,{children:o.jsx(E$,{})}),t[4]=r):r=t[4];let i;return t[5]!==n?(i=o.jsx(sn,{fallback:n,children:r}),t[5]=n,t[6]=i):i=t[6],i}function R$(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function w9(t){return t?.name||t?.email?.split("@")[0]||void 0}function Xo(t){const e=R$(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}async function D$(t,e,s){const n=await t.callTool({name:e,arguments:s});if(n.isError){const r=n.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(r)}return n}const g_=["SANDBOX_START"],O0=new Map,M$=t=>`${t.virtualMcpId}::${t.branch??""}`,I$=t=>t.message.includes("retry shortly"),j1=new Set,Qm={mark:(t,e)=>j1.add(`${t}::${e}`),clear:(t,e)=>j1.delete(`${t}::${e}`),isStopped:(t,e)=>j1.has(`${t}::${e}`)};function x_(t,e){const s=Ns();return Rs({mutationKey:g_,retry:(n,r)=>I$(r)&&n<6,retryDelay:n=>s0(5e3,500,n,2,0),mutationFn:async n=>{n.branch&&Qm.clear(n.virtualMcpId,n.branch);const r=M$(n),i=O0.get(r);if(i)return i;const a=(async()=>(await D$(t,"SANDBOX_START",n)).structuredContent)();O0.set(r,a);try{return await a}finally{O0.get(r)===a&&O0.delete(r)}},onSuccess:()=>{zh(s),e?.onStarted?.()}})}function O$(t,e){const s=U.c(3);let n;return s[0]!==e||s[1]!==t?(n={mutationKey:g_,predicate:i=>{if(!t)return!1;const a=i.state.variables;return!a||a.virtualMcpId!==t?!1:(a.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=n):n=s[2],m7(n)>0}function b_(t){return!!t.harness_id||!!t.title&&t.title!=="New chat"}function $$(t){return{threadId:t.routeThreadId,providerKey:t.routeThreadId??t.fallbackKey}}function V4(t,e){return Number(e.sidePanelOpen)+Number(e.mainOpen)<=1?!1:t==="side"?e.sidePanelOpen:e.mainOpen}function B$(t){return t.sidePanelOpen||t.mainOpen?t:{...t,sidePanelOpen:!0}}function z$(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",n=t.mainPanelParam??(t.panelNamed||!!t.routeDefaultMain||!s),r=t.routeDefaultMain?!1:s||t.entityMetadata?.chatDefaultOpen===!0||t.threadHasMessages===!0,i=t.sidePanelParamPresent?t.sidePanelParamValue===!0:r;return B$({sidePanelOpen:i,mainOpen:n})}function T4(t,e){switch(t.type){case"toggleSidePanel":return e.sidePanelOpen?V4("side",e)?{sidepanel:!1}:null:{sidepanel:!0};case"toggleMain":return e.mainOpen?V4("main",e)?{mainpanel:!1}:null:{mainpanel:!0};case"openSidePanel":return e.sidePanelOpen?null:{sidepanel:!0}}}function F$(t){return t.sidePanelOpen&&t.mainOpen?{side:33,main:67}:t.sidePanelOpen?{side:100,main:0}:t.mainOpen?{side:0,main:100}:{side:0,main:0}}function U$(t){const{sidePanelOpen:e,mainOpen:s}=t.visibility;return e&&(t.sidePanelParamPresent||!s)?"chat":s?"main":"chat"}function H$(t){return t==="main"?{sidepanel:!1,mainpanel:!0}:{sidepanel:!0,mainpanel:!1}}function K$(t,e){const s=on(),n=wA(),r=na({strict:!1}),i=ra({strict:!1}),{create:a}=Gu(),{threads:l}=Qf(),{virtualMcpId:c,isAgentRoute:d}=e,h=k8(),u=hg(),f=n0(),m=P.useRef(crypto.randomUUID()),{threadId:p,providerKey:g}=$$({routeThreadId:f,fallbackKey:m.current}),x=p!=null?l.find(j=>j.id===p):void 0,{sidePanelOpen:b,mainOpen:v}=z$({entityMetadata:t,mainPanelParam:r.mainpanel,panelNamed:u!==void 0,sidePanelParamPresent:r.sidepanel!==void 0,sidePanelParamValue:r.sidepanel,routeDefaultMain:h,threadHasMessages:x?b_(x):!1}),_={sidePanelOpen:b,mainOpen:v},L=d&&!i.project?{virtualmcpid:c}:{},y=(j,N)=>{s({to:".",search:V=>({...V,...j}),replace:N?.replace??!1})},w=()=>{const j=T4({type:"toggleMain"},_);j&&y(j,{replace:!0})},S=()=>{const j=T4({type:"toggleSidePanel"},_);j&&y(j,{replace:!0})},k=async()=>{const j=crypto.randomUUID(),N=l.find(V=>V.id===p)?.branch??null;try{await a({id:j,virtual_mcp_id:c,...N?{branch:N}:{}})}catch{}n(j,()=>({...L}))};return{threadId:p,providerKey:g,sidePanelOpen:b,mainOpen:v,sidePanelParamPresent:r.sidepanel!==void 0,toggleMain:w,toggleSidePanel:S,createNewTask:k}}function W$(t){const e=U.c(10),{org:s}=Fe(),n=B2(),{data:r}=Nn.useSession(),i=r?.user?.id,a=t?.id??null,l=!!t&&!!i&&!!t.created_by&&t.created_by!==i;let c;e[0]!==s.id||e[1]!==a?(c=at.viewedThreadMetadataRefresh(s.id,a??""),e[0]=s.id,e[1]=a,e[2]=c):c=e[2];const d=!!n&&!!a&&l;let h;e[3]!==n||e[4]!==a?(h=async()=>(await n?.refreshThreadMetadata(a??""),!0),e[3]=n,e[4]=a,e[5]=h):h=e[5];let u;e[6]!==c||e[7]!==d||e[8]!==h?(u={queryKey:c,enabled:d,staleTime:Number.POSITIVE_INFINITY,queryFn:h},e[6]=c,e[7]=d,e[8]=h,e[9]=u):u=e[9],Zt(u)}function q$(){const t=new Map;return{run(e,s){const n=(t.get(e)??Promise.resolve()).then(s),r=n.then(()=>{},()=>{});return t.set(e,r),r.then(()=>{t.get(e)===r&&t.delete(e)}),n},activeKeyCount:()=>t.size}}const G$=q$();function v_(t,e){return G$.run(t,e)}function Y$(t,e){return t.some(s=>s.branch===e.branch)?t:[...t,e]}function Q$(t,e){return t.filter(s=>s.branch!==e)}function X$(t,e,s){return t.map(n=>n.branch===e?{...n,name:s}:n)}const P4=["orange","violet","blue","pink","amber","teal"];function kh(t){return P4[t%P4.length]}function Xm(t,e){const s=`${e} `,n=t.reduce((r,i)=>{if(!i.name.startsWith(s))return r;const a=Number(i.name.slice(s.length));return Number.isInteger(a)&&a>r?a:r},0);return`${e} ${n+1}`}const J$={orange:"bg-orange-500",violet:"bg-violet-500",blue:"bg-blue-500",pink:"bg-pink-500",amber:"bg-amber-500",teal:"bg-teal-500"};function C1(t){return t&&J$[t]||"bg-muted-foreground"}function S9(t){const e=U.c(26),s=Vs(t),n=z2(),{org:r}=Fe(),i=Ns();let a;e[0]!==s?.metadata?.releases?(a=s?.metadata?.releases??[],e[0]=s?.metadata?.releases,e[1]=a):a=e[1];const l=a;let c;e[2]!==r||e[3]!==t?(c=y=>y[1]===r.id&&y[3]==="collection"&&y[4]==="VIRTUAL_MCP"&&y[5]===t,e[2]=r,e[3]=t,e[4]=c):c=e[4];const d=c;let h;e[5]!==d||e[6]!==i||e[7]!==l?(h=()=>{for(const[,y]of i.getQueriesData({predicate:w=>d(w.queryKey)}))if(y?.item)return y.item.metadata?.releases??[];return l},e[5]=d,e[6]=i,e[7]=l,e[8]=h):h=e[8];const u=h;let f;e[9]!==n||e[10]!==d||e[11]!==i||e[12]!==u||e[13]!==t?(f=y=>v_(`vm-releases:${t}`,async()=>{const w=u(),S=y(w);if(S!==w){i.setQueriesData({predicate:k=>d(k.queryKey)},k=>k?.item?{item:{...k.item,metadata:{...k.item.metadata,releases:S}}}:k);try{await n.update.mutateAsync({id:t,data:{metadata:{releases:S}}})}catch(k){const j=k;throw i.invalidateQueries({predicate:N=>d(N.queryKey)}),j}}}),e[9]=n,e[10]=d,e[11]=i,e[12]=u,e[13]=t,e[14]=f):f=e[14];const m=f;let p;e[15]!==m?(p=y=>m(w=>Y$(w,y)),e[15]=m,e[16]=p):p=e[16];const g=p;let x;e[17]!==m?(x=(y,w)=>m(S=>X$(S,y,w)),e[17]=m,e[18]=x):x=e[18];const b=x;let v;e[19]!==m?(v=y=>m(w=>Q$(w,y)),e[19]=m,e[20]=v):v=e[20];const _=v;let L;return e[21]!==g||e[22]!==_||e[23]!==l||e[24]!==b?(L={releases:l,createRelease:g,renameRelease:b,deleteRelease:_},e[21]=g,e[22]=_,e[23]=l,e[24]=b,e[25]=L):L=e[25],L}function Z$(t,e){const s=getComputedStyle(t),n=parseFloat(s.fontSize);return e*n}function eB(t,e){const s=getComputedStyle(t.ownerDocument.documentElement),n=parseFloat(s.fontSize);return e*n}function tB(t){return t/100*window.innerHeight}function sB(t){return t/100*window.innerWidth}function nB(t){switch(typeof t){case"number":return[t,"px"];case"string":{const e=parseFloat(t);return t.endsWith("%")?[e,"%"]:t.endsWith("px")?[e,"px"]:t.endsWith("rem")?[e,"rem"]:t.endsWith("em")?[e,"em"]:t.endsWith("vh")?[e,"vh"]:t.endsWith("vw")?[e,"vw"]:[e,"%"]}}}function Kd({groupSize:t,panelElement:e,styleProp:s}){let n;const[r,i]=nB(s);switch(i){case"%":{n=r/100*t;break}case"px":{n=r;break}case"rem":{n=eB(e,r);break}case"em":{n=Z$(e,r);break}case"vh":{n=tB(r);break}case"vw":{n=sB(r);break}}return n}function wn(t){return parseFloat(t.toFixed(3))}function Gc({group:t}){const{orientation:e,panels:s}=t;return s.reduce((n,r)=>(n+=e==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,n),0)}function Jm(t){const{panels:e}=t,s=Gc({group:t});return s===0?e.map(n=>({groupResizeBehavior:n.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:n.panelConstraints.disabled,minSize:0,maxSize:100,panelId:n.id})):e.map(n=>{const{element:r,panelConstraints:i}=n;let a=0;if(i.collapsedSize!==void 0){const h=Kd({groupSize:s,panelElement:r,styleProp:i.collapsedSize});a=wn(h/s*100)}let l;if(i.defaultSize!==void 0){const h=Kd({groupSize:s,panelElement:r,styleProp:i.defaultSize});l=wn(h/s*100)}let c=0;if(i.minSize!==void 0){const h=Kd({groupSize:s,panelElement:r,styleProp:i.minSize});c=wn(h/s*100)}let d=100;if(i.maxSize!==void 0){const h=Kd({groupSize:s,panelElement:r,styleProp:i.maxSize});d=wn(h/s*100)}return{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:a,collapsible:i.collapsible===!0,defaultSize:l,disabled:i.disabled,minSize:c,maxSize:d,panelId:n.id}})}function Yt(t,e="Assertion error"){if(!t)throw Error(e)}function Zm(t,e){return Array.from(e).sort(t==="horizontal"?rB:iB)}function rB(t,e){const s=t.element.offsetLeft-e.element.offsetLeft;return s!==0?s:t.element.offsetWidth-e.element.offsetWidth}function iB(t,e){const s=t.element.offsetTop-e.element.offsetTop;return s!==0?s:t.element.offsetHeight-e.element.offsetHeight}function y_(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function __(t,e){return{x:t.x>=e.left&&t.x<=e.right?0:Math.min(Math.abs(t.x-e.left),Math.abs(t.x-e.right)),y:t.y>=e.top&&t.y<=e.bottom?0:Math.min(Math.abs(t.y-e.top),Math.abs(t.y-e.bottom))}}function oB({orientation:t,rects:e,targetRect:s}){const n={x:s.x+s.width/2,y:s.y+s.height/2};let r,i=Number.MAX_VALUE;for(const a of e){const{x:l,y:c}=__(n,a),d=t==="horizontal"?l:c;d<i&&(i=d,r=a)}return Yt(r,"No rect found"),r}let $0;function aB(){return $0===void 0&&(typeof matchMedia=="function"?$0=!!matchMedia("(pointer:coarse)").matches:$0=!1),$0}function L_(t){const{element:e,orientation:s,panels:n,separators:r}=t,i=Zm(s,Array.from(e.children).filter(y_).map(p=>({element:p}))).map(({element:p})=>p),a=[];let l=!1,c=!1,d=-1,h=-1,u=0,f,m=[];{let p=-1;for(const g of i)g.hasAttribute("data-panel")&&(p++,g.hasAttribute("data-disabled")||(u++,d===-1&&(d=p),h=p))}if(u>1){let p=-1;for(const g of i)if(g.hasAttribute("data-panel")){p++;const x=n.find(b=>b.element===g);if(x){if(f){const b=f.element.getBoundingClientRect(),v=g.getBoundingClientRect();let _;if(c){const L=s==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),y=s==="horizontal"?new DOMRect(v.left,v.top,0,v.height):new DOMRect(v.left,v.top,v.width,0);switch(m.length){case 0:{_=[L,y];break}case 1:{const w=m[0],S=oB({orientation:s,rects:[b,v],targetRect:w.element.getBoundingClientRect()});_=[w,S===b?y:L];break}default:{_=m;break}}}else m.length?_=m:_=[s==="horizontal"?new DOMRect(b.right,v.top,v.left-b.right,v.height):new DOMRect(v.left,b.bottom,v.width,v.top-b.bottom)];for(const L of _){let y="width"in L?L:L.element.getBoundingClientRect();const w=aB()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(y.width<w){const k=w-y.width;y=new DOMRect(y.x-k/2,y.y,y.width+k,y.height)}if(y.height<w){const k=w-y.height;y=new DOMRect(y.x,y.y-k/2,y.width,y.height+k)}const S=p<=d||p>h;!l&&!S&&a.push({group:t,groupSize:Gc({group:t}),panels:[f,x],separator:"width"in L?void 0:L,rect:y}),l=!1}}c=!1,f=x,m=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(l=!0);const x=r.find(b=>b.element===g);x?m.push(x):(f=void 0,m=[])}else c=!0}return a}let w_=class{#e={};addListener(e,s){const n=this.#e[e];return n===void 0?this.#e[e]=[s]:n.includes(s)||n.push(s),()=>{this.removeListener(e,s)}}emit(e,s){const n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,s);else{let r=!1,i=null;const a=Array.from(n);for(let l=0;l<a.length;l++){const c=a[l];try{c.call(null,s)}catch(d){i===null&&(r=!0,i=d)}}if(r)throw i}}removeAllListeners(){this.#e={}}removeListener(e,s){const n=this.#e[e];if(n!==void 0){const r=n.indexOf(s);r>=0&&n.splice(r,1)}}},Mc={cursorFlags:0,state:"inactive"};const Og=new w_;function $a(){return Mc}function lB(t){return Og.addListener("change",t)}function cB(t){const e=Mc,s={...Mc};s.cursorFlags=t,Mc=s,Og.emit("change",{prev:e,next:s})}function Ic(t){const e=Mc;Mc=t,Og.emit("change",{prev:e,next:t})}const dB=t=>t,N1=()=>{},S_=1,k_=2,j_=4,C_=8,A4=3,E4=12;let B0;function R4(){return B0===void 0&&(B0=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(B0=!0)),B0}function uB({cursorFlags:t,groups:e,state:s}){let n=0,r=0;switch(s){case"active":case"hover":e.forEach(i=>{if(!i.mutableState.disableCursor)switch(i.orientation){case"horizontal":{n++;break}case"vertical":{r++;break}}})}if(!(n===0&&r===0)){switch(s){case"active":{if(t&&R4()){const i=(t&S_)!==0,a=(t&k_)!==0,l=(t&j_)!==0,c=(t&C_)!==0;if(i)return l?"se-resize":c?"ne-resize":"e-resize";if(a)return l?"sw-resize":c?"nw-resize":"w-resize";if(l)return"s-resize";if(c)return"n-resize"}break}}return R4()?n>0&&r>0?"move":n>0?"ew-resize":"ns-resize":n>0&&r>0?"grab":n>0?"col-resize":"row-resize"}}const D4=new WeakMap;function $g(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:s}=D4.get(t)??{};s===void 0&&(s=new t.defaultView.CSSStyleSheet,t.adoptedStyleSheets&&(Object.isExtensible(t.adoptedStyleSheets)?t.adoptedStyleSheets.push(s):t.adoptedStyleSheets=[...t.adoptedStyleSheets,s]));const n=$a();switch(n.state){case"active":case"hover":{const r=uB({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(a=>a.group),state:n.state}),i=`*, *:hover {cursor: ${r} !important; }`;if(e===i)return;e=i,r?s.cssRules.length===0?s.insertRule(i):s.replaceSync(i):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{e=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}D4.set(t,{prevStyle:e,styleSheet:s})}let ri=new Map;const N_=new w_;function hB(t){ri=new Map(ri),ri.delete(t)}function M4(t,e){for(const[s]of ri)if(s.id===t)return s}function zo(t,e){for(const[s,n]of ri)if(s.id===t)return n;if(e)throw Error(`Could not find data for Group with id ${t}`)}function ol(){return ri}function Bg(t,e){return N_.addListener("groupChange",s=>{s.group.id===t&&e(s)})}function eo(t,e,s){const n=ri.get(t);ri=new Map(ri),ri.set(t,e),N_.emit("groupChange",{group:t,isUserInteraction:s?.isUserInteraction===!0,prev:n,next:e})}function V_(t){const e=$a();let s=!1;return e.state==="active"&&(Ic({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&($g(t),s=!0,e.hitRegions.forEach(n=>{const r=zo(n.group.id,!0);eo(n.group,r,{isUserInteraction:!0})}))),s}function I4(t){t.defaultPrevented||V_(t.currentTarget)}function fB(t,e,s){let n,r={x:1/0,y:1/0};for(const i of e){const a=__(s,i.rect);switch(t){case"horizontal":{a.x<=r.x&&(n=i,r=a);break}case"vertical":{a.y<=r.y&&(n=i,r=a);break}}}return n?{distance:r,hitRegion:n}:void 0}function mB(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function pB(t,e){if(t===e)throw new Error("Cannot compare node with itself");const s={a:B4(t),b:B4(e)};let n;for(;s.a.at(-1)===s.b.at(-1);)n=s.a.pop(),s.b.pop();Yt(n,"Stacking order can only be calculated for elements with a common ancestor");const r={a:$4(O4(s.a)),b:$4(O4(s.b))};if(r.a===r.b){const i=n.childNodes,a={a:s.a.at(-1),b:s.b.at(-1)};let l=i.length;for(;l--;){const c=i[l];if(c===a.a)return 1;if(c===a.b)return-1}}return Math.sign(r.a-r.b)}const gB=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function xB(t){const e=getComputedStyle(T_(t)??t).display;return e==="flex"||e==="inline-flex"}function bB(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||xB(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||gB.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function O4(t){let e=t.length;for(;e--;){const s=t[e];if(Yt(s,"Missing node"),bB(s))return s}return null}function $4(t){return t&&Number(getComputedStyle(t).zIndex)||0}function B4(t){const e=[];for(;t;)e.push(t),t=T_(t);return e}function T_(t){const{parentNode:e}=t;return mB(e)?e.host:e}function vB(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function yB({groupElement:t,hitRegion:e,pointerEventTarget:s}){if(!y_(s)||s.contains(t)||t.contains(s))return!0;if(pB(s,t)>0){let n=s;for(;n;){if(n.contains(t))return!0;if(vB(n.getBoundingClientRect(),e))return!1;n=n.parentElement}}return!0}function zg(t,e){const s=[];return e.forEach((n,r)=>{if(r.disabled)return;const i=L_(r),a=fB(r.orientation,i,{x:t.clientX,y:t.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&yB({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:t.target})&&s.push(a.hitRegion)}),s}function _B(t,e){if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!=e[s])return!1;return!0}function gn(t,e,s=0){return Math.abs(wn(t)-wn(e))<=s}function ei(t,e){return gn(t,e)?0:t>e?1:-1}function Tc({overrideDisabledPanels:t,panelConstraints:e,prevSize:s,size:n}){const{collapsedSize:r=0,collapsible:i,disabled:a,maxSize:l=100,minSize:c=0}=e;if(a&&!t)return s;if(ei(n,c)<0)if(i){const d=(r+c)/2;ei(n,d)<0?n=r:n=c}else n=c;return n=Math.min(l,n),n=wn(n),n}function Pu({delta:t,initialLayout:e,panelConstraints:s,pivotIndices:n,prevLayout:r,trigger:i}){if(gn(t,0))return e;const a=i==="imperative-api",l=Object.values(e),c=Object.values(r),d=[...l],[h,u]=n;Yt(h!=null,"Invalid first pivot index"),Yt(u!=null,"Invalid second pivot index");let f=0;switch(i){case"keyboard":{{const g=t<0?u:h,x=s[g];Yt(x,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:_=0}=x;if(v){const L=l[g];if(Yt(L!=null,`Previous layout not found for panel index ${g}`),gn(L,b)){const y=_-L;ei(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{const g=t<0?h:u,x=s[g];Yt(x,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:_=0}=x;if(v){const L=l[g];if(Yt(L!=null,`Previous layout not found for panel index ${g}`),gn(L,_)){const y=L-b;ei(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}break}default:{const g=t<0?u:h,x=s[g];Yt(x,`Panel constraints not found for index ${g}`);const b=l[g],{collapsible:v,collapsedSize:_,minSize:L}=x;if(v&&ei(b,L)<0)if(t>0){const y=L-_,w=y/2,S=b+t;ei(S,L)<0&&(t=ei(t,w)<=0?0:y)}else{const y=L-_,w=100-y/2,S=b-t;ei(S,L)<0&&(t=ei(100+t,w)>0?0:-y)}break}}{const g=t<0?1:-1;let x=t<0?u:h,b=0;for(;;){const _=l[x];Yt(_!=null,`Previous layout not found for panel index ${x}`);const L=Tc({overrideDisabledPanels:a,panelConstraints:s[x],prevSize:_,size:100})-_;if(b+=L,x+=g,x<0||x>=s.length)break}const v=Math.min(Math.abs(t),Math.abs(b));t=t<0?0-v:v}{let g=t<0?h:u;for(;g>=0&&g<s.length;){const x=Math.abs(t)-Math.abs(f),b=l[g];Yt(b!=null,`Previous layout not found for panel index ${g}`);const v=b-x,_=Tc({overrideDisabledPanels:a,panelConstraints:s[g],prevSize:b,size:v});if(!gn(b,_)&&(f+=b-_,d[g]=_,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(_B(c,d))return r;{const g=t<0?u:h,x=l[g];Yt(x!=null,`Previous layout not found for panel index ${g}`);const b=x+f,v=Tc({overrideDisabledPanels:a,panelConstraints:s[g],prevSize:x,size:b});if(d[g]=v,!gn(v,b)){let _=b-v,L=t<0?u:h;for(;L>=0&&L<s.length;){const y=d[L];Yt(y!=null,`Previous layout not found for panel index ${L}`);const w=y+_,S=Tc({overrideDisabledPanels:a,panelConstraints:s[L],prevSize:y,size:w});if(gn(y,S)||(_-=S-y,d[L]=S),gn(_,0))break;t>0?L--:L++}}}const m=Object.values(d).reduce((g,x)=>x+g,0);if(!gn(m,100,.1))return r;const p=Object.keys(r);return d.reduce((g,x,b)=>(g[p[b]]=x,g),{})}function Ba(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(e[s]===void 0||ei(t[s],e[s])!==0)return!1;return!0}function za({layout:t,panelConstraints:e}){const s=Object.values(t),n=[...s],r=n.reduce((l,c)=>l+c,0);if(n.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${n.map(l=>`${l}%`).join(", ")}`);if(!gn(r,100)&&n.length>0)for(let l=0;l<e.length;l++){const c=n[l];Yt(c!=null,`No layout data found for index ${l}`);const d=100/r*c;n[l]=d}let i=0;for(let l=0;l<e.length;l++){const c=s[l];Yt(c!=null,`No layout data found for index ${l}`);const d=n[l];Yt(d!=null,`No layout data found for index ${l}`);const h=Tc({overrideDisabledPanels:!0,panelConstraints:e[l],prevSize:c,size:d});d!=h&&(i+=d-h,n[l]=h)}if(!gn(i,0))for(let l=0;l<e.length;l++){const c=n[l];Yt(c!=null,`No layout data found for index ${l}`);const d=c+i,h=Tc({overrideDisabledPanels:!0,panelConstraints:e[l],prevSize:c,size:d});if(c!==h&&(i-=h-c,n[l]=h,gn(i,0)))break}const a=Object.keys(t);return n.reduce((l,c,d)=>(l[a[d]]=c,l),{})}function P_({groupId:t,panelId:e}){const s=()=>{const c=ol();for(const[d,{defaultLayoutDeferred:h,derivedPanelConstraints:u,layout:f,groupSize:m,separatorToPanels:p}]of c)if(d.id===t)return{defaultLayoutDeferred:h,derivedPanelConstraints:u,group:d,groupSize:m,layout:f,separatorToPanels:p};throw Error(`Group ${t} not found`)},n=()=>{const c=s().derivedPanelConstraints.find(d=>d.panelId===e);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${e}`)},r=()=>{const c=s().group.panels.find(d=>d.id===e);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},i=()=>{const c=s().layout[e];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},a=({nextSize:c,panels:d,prevLayout:h,derivedPanelConstraints:u})=>{const f=i(),m=d.findIndex(x=>x.id===e),p=m===0,g=m===d.length-1;if(g&&c<f&&(p||d.slice(0,m).every((x,b)=>{const v=u[b];return v?.collapsible&&gn(v.collapsedSize,h[v.panelId])}))){const x=d.slice(0,m).reduce((b,v)=>b+h[v.id],0);return{...h,[e]:wn(100-x)}}return Pu({delta:g?f-c:c-f,initialLayout:h,panelConstraints:u,pivotIndices:g?[m-1,m]:[m,m+1],prevLayout:h,trigger:"imperative-api"})},l=c=>{const d=i();if(c===d)return;const{defaultLayoutDeferred:h,derivedPanelConstraints:u,group:f,groupSize:m,layout:p,separatorToPanels:g}=s(),x=a({nextSize:c,panels:f.panels,prevLayout:p,derivedPanelConstraints:u}),b=za({layout:x,panelConstraints:u});Ba(p,b)||eo(f,{defaultLayoutDeferred:h,derivedPanelConstraints:u,groupSize:m,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:d}=n(),{mutableValues:h}=r(),u=i();c&&u!==d&&(h.expandToSize=u,l(d))},expand:()=>{const{collapsible:c,collapsedSize:d,minSize:h}=n(),{mutableValues:u}=r(),f=i();if(c&&f===d){let m=u.expandToSize??h;m===0&&(m=1),l(m)}},getSize:()=>{const{group:c}=s(),d=i(),{element:h}=r(),u=c.orientation==="horizontal"?h.offsetWidth:h.offsetHeight;return{asPercentage:d,inPixels:u}},isCollapsed:()=>{const{collapsible:c,collapsedSize:d}=n(),h=i();return c&&gn(d,h)},resize:c=>{const{group:d}=s(),{element:h}=r(),u=Gc({group:d}),f=Kd({groupSize:u,panelElement:h,styleProp:c}),m=wn(f/u*100);l(m)}}}function z4(t){if(t.defaultPrevented)return;const e=ol();zg(t,e).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const n=s.panels.find(r=>r.panelConstraints.defaultSize!==void 0);if(n){const r=n.panelConstraints.defaultSize,i=P_({groupId:s.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),t.preventDefault())}}})}function jh(t){const e=ol();for(const[s]of e)if(s.separators.some(n=>n.element===t))return s;throw Error("Could not find parent Group for separator element")}function A_({groupId:t}){const e=()=>{const s=ol();for(const[n,r]of s)if(n.id===t)return{group:n,...r};throw Error(`Could not find Group with id "${t}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:n}=e();return s?{}:n},setLayout(s){const{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:l,separatorToPanels:c}=e(),d=za({layout:s,panelConstraints:r});return n?l:(Ba(l,d)||eo(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:d,separatorToPanels:c}),d)}}}function pa(t,e){const s=jh(t),n=zo(s.id,!0),r=s.separators.find(h=>h.element===t);Yt(r,"Matching separator not found");const i=n.separatorToPanels.get(r);Yt(i,"Matching panels not found");const a=i.map(h=>s.panels.indexOf(h)),l=A_({groupId:s.id}).getLayout(),c=Pu({delta:e,initialLayout:l,panelConstraints:n.derivedPanelConstraints,pivotIndices:a,prevLayout:l,trigger:"keyboard"}),d=za({layout:c,panelConstraints:n.derivedPanelConstraints});Ba(l,d)||eo(s,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:d,separatorToPanels:n.separatorToPanels},{isUserInteraction:!0})}function F4(t){if(t.defaultPrevented)return;const e=t.currentTarget,s=jh(e);if(!s.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),s.orientation==="vertical"&&pa(e,5);break}case"ArrowLeft":{t.preventDefault(),s.orientation==="horizontal"&&pa(e,-5);break}case"ArrowRight":{t.preventDefault(),s.orientation==="horizontal"&&pa(e,5);break}case"ArrowUp":{t.preventDefault(),s.orientation==="vertical"&&pa(e,-5);break}case"End":{t.preventDefault(),pa(e,100);break}case"Enter":{t.preventDefault();const n=jh(e),r=zo(n.id,!0),{derivedPanelConstraints:i,layout:a,separatorToPanels:l}=r,c=n.separators.find(f=>f.element===e);Yt(c,"Matching separator not found");const d=l.get(c);Yt(d,"Matching panels not found");const h=d[0],u=i.find(f=>f.panelId===h.id);if(Yt(u,"Panel metadata not found"),u.collapsible){const f=a[h.id],m=u.collapsedSize===f?n.mutableState.expandedPanelSizes[h.id]??u.minSize:u.collapsedSize;pa(e,m-f)}break}case"F6":{t.preventDefault();const n=jh(e).separators.map(a=>a.element),r=Array.from(n).findIndex(a=>a===t.currentTarget);Yt(r!==null,"Index not found");const i=t.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0;n[i].focus({preventScroll:!0});break}case"Home":{t.preventDefault(),pa(e,-100);break}}}function U4(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=ol(),s=zg(t,e),n=new Map;let r=!1;s.forEach(i=>{i.separator&&(r||(r=!0,i.separator.element.focus({focusVisible:!1,preventScroll:!0})));const a=e.get(i.group);a&&n.set(i.group,a.layout)}),Ic({cursorFlags:0,hitRegions:s,initialLayoutMap:n,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),s.length&&t.preventDefault()}function E_({document:t,event:e,hitRegions:s,initialLayoutMap:n,mountedGroups:r,pointerDownAtPoint:i,prevCursorFlags:a}){let l=0;s.forEach(d=>{const{group:h,groupSize:u}=d,{orientation:f,panels:m}=h,{disableCursor:p}=h.mutableState;let g=0;i?f==="horizontal"?g=(e.clientX-i.x)/u*100:g=(e.clientY-i.y)/u*100:f==="horizontal"?g=e.clientX<0?-100:100:g=e.clientY<0?-100:100;const x=n.get(h),b=r.get(h);if(!x||!b)return;const{defaultLayoutDeferred:v,derivedPanelConstraints:_,groupSize:L,layout:y,separatorToPanels:w}=b;if(_&&y&&w){const S=Pu({delta:g,initialLayout:x,panelConstraints:_,pivotIndices:d.panels.map(k=>m.indexOf(k)),prevLayout:y,trigger:"mouse-or-touch"});if(Ba(S,y)){if(g!==0&&!p)switch(f){case"horizontal":{l|=g<0?S_:k_;break}case"vertical":{l|=g<0?j_:C_;break}}}else eo(d.group,{defaultLayoutDeferred:v,derivedPanelConstraints:_,groupSize:L,layout:S,separatorToPanels:w})}});let c=0;e.movementX===0?c|=a&A4:c|=l&A4,e.movementY===0?c|=a&E4:c|=l&E4,cB(c),$g(t)}function H4(t){const e=ol(),s=$a();s.state==="active"&&E_({document:t.currentTarget,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:e,prevCursorFlags:s.cursorFlags})}function K4(t){if(t.defaultPrevented)return;const e=$a(),s=ol();switch(e.state){case"active":{if(t.buttons===0){Ic({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{const r=zo(n.group.id,!0);eo(n.group,r,{isUserInteraction:!0})});return}for(const n of e.hitRegions)if(n.separator){const{element:r}=n.separator;r.hasPointerCapture?.(t.pointerId)||r.setPointerCapture?.(t.pointerId)}E_({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const n=zg(t,s);n.length===0?e.state!=="inactive"&&Ic({cursorFlags:0,state:"inactive"}):Ic({cursorFlags:0,hitRegions:n,state:"hover"}),$g(t.currentTarget);break}}}function W4(t){t.relatedTarget instanceof HTMLIFrameElement&&$a().state==="hover"&&Ic({cursorFlags:0,state:"inactive"})}function q4(t){t.defaultPrevented||t.pointerType==="mouse"&&t.button>0||V_(t.currentTarget)&&t.preventDefault()}function G4(t){let e=0,s=0;const n={};for(const i of t)if(i.defaultSize!==void 0){e++;const a=wn(i.defaultSize);s+=a,n[i.panelId]=a}else n[i.panelId]=void 0;const r=t.length-e;if(r!==0){const i=wn((100-s)/r);for(const a of t)a.defaultSize===void 0&&(n[a.panelId]=i)}return n}function LB(t,e,s){if(!s[0])return;const n=t.panels.find(c=>c.element===e);if(!n||!n.onResize)return;const r=Gc({group:t}),i=t.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,a=n.mutableValues.prevSize,l={asPercentage:wn(i/r*100),inPixels:i};n.mutableValues.prevSize=l,n.onResize(l,n.id,a)}function wB(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function SB({group:t,nextGroupSize:e,prevGroupSize:s,prevLayout:n}){if(s<=0||e<=0||s===e)return n;let r=0,i=0,a=!1;const l=new Map,c=[];for(const u of t.panels){const f=n[u.id]??0;if(u.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){a=!0;const m=f/100*s,p=wn(m/e*100);l.set(u.id,p),r+=p}else c.push(u.id),i+=f}if(!a||c.length===0)return n;const d=100-r,h={...n};if(l.forEach((u,f)=>{h[f]=u}),i>0)for(const u of c){const f=n[u]??0;h[u]=wn(f/i*d)}else{const u=wn(d/c.length);for(const f of c)h[f]=u}return h}function kB(t,e){const s=t.map(r=>r.id),n=Object.keys(e);if(s.length!==n.length)return!1;for(const r of s)if(!n.includes(r))return!1;return!0}const bc=new Map;function jB(t){let e=!0;Yt(t.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=t.element.ownerDocument.defaultView.ResizeObserver,n=new Set,r=new Set,i=new s(p=>{for(const g of p){const{borderBoxSize:x,target:b}=g;if(b===t.element){if(e){const v=Gc({group:t});if(v===0)return;const _=zo(t.id);if(!_)return;const L=Jm(t),y=_.defaultLayoutDeferred?G4(L):_.layout,w=SB({group:t,nextGroupSize:v,prevGroupSize:_.groupSize,prevLayout:y}),S=za({layout:w,panelConstraints:L});if(!_.defaultLayoutDeferred&&Ba(_.layout,S)&&wB(_.derivedPanelConstraints,L)&&_.groupSize===v)return;eo(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:L,groupSize:v,layout:S,separatorToPanels:_.separatorToPanels})}}else LB(t,b,x)}});i.observe(t.element),t.panels.forEach(p=>{Yt(!n.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),n.add(p.id),p.onResize&&i.observe(p.element)});const a=Gc({group:t}),l=Jm(t),c=t.panels.map(({id:p})=>p).join(",");let d=t.mutableState.defaultLayout;d&&(kB(t.panels,d)||(d=void 0));const h=t.mutableState.layouts[c]??d??G4(l),u=za({layout:h,panelConstraints:l}),f=t.element.ownerDocument;bc.set(f,(bc.get(f)??0)+1);const m=new Map;return L_(t).forEach(p=>{p.separator&&m.set(p.separator,p.panels)}),eo(t,{defaultLayoutDeferred:a===0,derivedPanelConstraints:l,groupSize:a,layout:u,separatorToPanels:m}),t.separators.forEach(p=>{Yt(!r.has(p.id),`Separator ids must be unique; id "${p.id}" was used more than once`),r.add(p.id),p.element.addEventListener("keydown",F4)}),bc.get(f)===1&&(f.addEventListener("contextmenu",I4,!0),f.addEventListener("dblclick",z4,!0),f.addEventListener("pointerdown",U4,!0),f.addEventListener("pointerleave",H4),f.addEventListener("pointermove",K4),f.addEventListener("pointerout",W4),f.addEventListener("pointerup",q4,!0)),function(){e=!1,bc.set(f,Math.max(0,(bc.get(f)??0)-1)),hB(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",F4)}),bc.get(f)||(f.removeEventListener("contextmenu",I4,!0),f.removeEventListener("dblclick",z4,!0),f.removeEventListener("pointerdown",U4,!0),f.removeEventListener("pointerleave",H4),f.removeEventListener("pointermove",K4),f.removeEventListener("pointerout",W4),f.removeEventListener("pointerup",q4,!0)),i.disconnect()}}function CB(){const[t,e]=P.useState({}),s=P.useCallback(()=>e({}),[]);return[t,s]}function Fg(t){const e=P.useId();return`${t??e}`}const al=typeof window<"u"?P.useLayoutEffect:P.useEffect;function ru(t){const e=P.useRef(t);return al(()=>{e.current=t},[t]),P.useCallback((...s)=>e.current?.(...s),[e])}function Ug(...t){return ru(e=>{t.forEach(s=>{if(s)switch(typeof s){case"function":{s(e);break}case"object":{s.current=e;break}}})})}function Hg(t){const e=P.useRef({...t});return al(()=>{for(const s in t)e.current[s]=t[s]},[t]),e.current}const R_=P.createContext(null);function NB(t,e){const s=P.useRef({getLayout:()=>({}),setLayout:dB});P.useImperativeHandle(e,()=>s.current,[]),al(()=>{Object.assign(s.current,A_({groupId:t}))})}function D_({children:t,className:e,defaultLayout:s,disableCursor:n,disabled:r,elementRef:i,groupRef:a,id:l,onLayoutChange:c,onLayoutChanged:d,orientation:h="horizontal",resizeTargetMinimumSize:u={coarse:20,fine:10},style:f,...m}){const p=P.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=ru(V=>{Ba(p.current.onLayoutChange,V)||(p.current.onLayoutChange=V,c?.(V))}),x=ru((V,C)=>{Ba(p.current.onLayoutChanged,V)||(p.current.onLayoutChanged=V,d?.(V,{isUserInteraction:C}))}),b=Fg(l),v=P.useRef(null),[_,L]=CB(),y=P.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:u,separators:[]}),w=Ug(v,i);NB(b,a);const S=ru((V,C)=>{const T=$a(),A=M4(V),R=zo(V);if(R){let E=!1;return T.state==="active"&&(E=T.hitRegions.some(I=>I.group===A)),{flexGrow:R.layout[C]??1,pointerEvents:E?"none":void 0}}if(s?.[C])return{flexGrow:s?.[C]}}),k=Hg({defaultLayout:s,disableCursor:n}),j=P.useMemo(()=>({get disableCursor(){return!!k.disableCursor},getPanelStyles:S,id:b,orientation:h,registerPanel:V=>{const C=y.current;return C.panels=Zm(h,[...C.panels,V]),L(),()=>{C.panels=C.panels.filter(T=>T!==V),L()}},registerSeparator:V=>{const C=y.current;return C.separators=Zm(h,[...C.separators,V]),L(),()=>{C.separators=C.separators.filter(T=>T!==V),L()}},updatePanelProps:(V,{disabled:C})=>{const T=y.current.panels.find(E=>E.id===V);T&&(T.panelConstraints.disabled=C);const A=M4(b),R=zo(b);A&&R&&eo(A,{...R,derivedPanelConstraints:Jm(A)})},updateSeparatorProps:(V,{disabled:C,disableDoubleClick:T})=>{const A=y.current.separators.find(R=>R.id===V);A&&(A.disabled=C,A.disableDoubleClick=T)}}),[S,b,L,h,k]),N=P.useRef(null);return al(()=>{const V=v.current;if(V===null)return;const C=y.current;let T;if(k.defaultLayout!==void 0&&Object.keys(k.defaultLayout).length===C.panels.length){T={};for(const $ of C.panels){const M=k.defaultLayout[$.id];M!==void 0&&(T[$.id]=M)}}const A={disabled:!!r,element:V,id:b,mutableState:{defaultLayout:T,disableCursor:!!k.disableCursor,expandedPanelSizes:y.current.lastExpandedPanelSizes,layouts:y.current.layouts},orientation:h,panels:C.panels,resizeTargetMinimumSize:C.resizeTargetMinimumSize,separators:C.separators};N.current=A;const R=jB(A),{defaultLayoutDeferred:E,derivedPanelConstraints:I,layout:D}=zo(A.id,!0);!E&&I.length>0&&(g(D),x(D,!1));const O=Bg(b,$=>{const{defaultLayoutDeferred:M,derivedPanelConstraints:z,layout:F}=$.next;if(M||z.length===0)return;const B=A.panels.map(({id:W})=>W).join(",");A.mutableState.layouts[B]=F,z.forEach(W=>{if(W.collapsible){const{layout:K}=$.prev??{};if(K){const q=gn(W.collapsedSize,F[W.panelId]),G=gn(W.collapsedSize,K[W.panelId]);q&&!G&&(A.mutableState.expandedPanelSizes[W.panelId]=K[W.panelId])}}});const H=$a().state!=="active";g(F),H&&x(F,$.isUserInteraction)});return()=>{N.current=null,R(),O()}},[r,b,x,g,h,_,k]),P.useEffect(()=>{const V=N.current;V&&(V.mutableState.defaultLayout=s,V.mutableState.disableCursor=!!n)}),o.jsx(R_.Provider,{value:j,children:o.jsx("div",{...m,className:e,"data-group":!0,"data-testid":b,id:b,ref:w,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:h==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:h==="horizontal"?"pan-y":"pan-x"},children:t})})}D_.displayName="Group";function Kg(){const t=P.useContext(R_);return Yt(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function VB(t,e){const{id:s}=Kg(),n=P.useRef({collapse:N1,expand:N1,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:N1});P.useImperativeHandle(e,()=>n.current,[]),al(()=>{Object.assign(n.current,P_({groupId:s,panelId:t}))})}function M_({children:t,className:e,collapsedSize:s="0%",collapsible:n=!1,defaultSize:r,disabled:i,elementRef:a,groupResizeBehavior:l="preserve-relative-size",id:c,maxSize:d="100%",minSize:h="0%",onResize:u,panelRef:f,style:m,...p}){const g=!!c,x=Fg(c),b=Hg({disabled:i}),v=P.useRef(null),_=Ug(v,a),{getPanelStyles:L,id:y,orientation:w,registerPanel:S,updatePanelProps:k}=Kg(),j=u!==null,N=ru((A,R,E)=>{u?.(A,c,E)});al(()=>{const A=v.current;if(A!==null){const R={element:A,id:x,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?N:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:s,collapsible:n,defaultSize:r,disabled:b.disabled,maxSize:d,minSize:h}};return S(R)}},[l,s,n,r,j,x,g,d,h,N,S,b]),P.useEffect(()=>{k(x,{disabled:i})},[i,x,k]),VB(x,f);const V=()=>{const A=L(y,x);if(A)return JSON.stringify(A)},C=P.useSyncExternalStore(A=>Bg(y,A),V,V);let T;return C?T=JSON.parse(C):r!==void 0?T={flexGrow:void 0,flexShrink:void 0,flexBasis:r}:T={flexGrow:1},o.jsx("div",{...p,"data-disabled":i||void 0,"data-panel":!0,"data-testid":x,id:x,ref:_,style:{...TB,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...T},children:o.jsx("div",{className:e,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:w==="horizontal"?"pan-y":"pan-x"},children:t})})}M_.displayName="Panel";const TB={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function PB({layout:t,panelConstraints:e,panelId:s,panelIndex:n}){let r,i;const a=t[s],l=e.find(c=>c.panelId===s);if(l){const c=l.maxSize,d=l.collapsible?l.collapsedSize:l.minSize,h=[n,n+1];i=za({layout:Pu({delta:d-a,initialLayout:t,panelConstraints:e,pivotIndices:h,prevLayout:t}),panelConstraints:e})[s],r=za({layout:Pu({delta:c-a,initialLayout:t,panelConstraints:e,pivotIndices:h,prevLayout:t}),panelConstraints:e})[s]}return{valueControls:s,valueMax:r,valueMin:i,valueNow:a}}function I_({children:t,className:e,disabled:s,disableDoubleClick:n,elementRef:r,id:i,style:a,...l}){const c=Fg(i),d=Hg({disabled:s,disableDoubleClick:n}),[h,u]=P.useState({}),[f,m]=P.useState("inactive"),[p,g]=P.useState(!1),x=P.useRef(null),b=Ug(x,r),{disableCursor:v,id:_,orientation:L,registerSeparator:y,updateSeparatorProps:w}=Kg(),S=L==="horizontal"?"vertical":"horizontal";al(()=>{const N=x.current;if(N!==null){const V={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:N,id:c},C=y(V),T=lB(R=>{m(R.next.state!=="inactive"&&R.next.hitRegions.some(E=>E.separator===V)?R.next.state:"inactive")}),A=Bg(_,R=>{const{derivedPanelConstraints:E,layout:I,separatorToPanels:D}=R.next,O=D.get(V);if(O){const $=O[0],M=O.indexOf($);u(PB({layout:I,panelConstraints:E,panelId:$.id,panelIndex:M}))}});return()=>{T(),A(),C()}}},[_,c,y,d]),P.useEffect(()=>{w(c,{disabled:s,disableDoubleClick:n})},[s,n,c,w]);let k;s&&!v&&(k="not-allowed");let j;return s?j="disabled":f==="active"?j="active":p?j="focus":j=f,o.jsx("div",{...l,"aria-controls":h.valueControls,"aria-disabled":s||void 0,"aria-orientation":S,"aria-valuemax":h.valueMax,"aria-valuemin":h.valueMin,"aria-valuenow":h.valueNow,children:t,className:e,"data-separator":j,"data-testid":c,id:c,onBlur:()=>g(!1),onFocus:()=>g(!0),ref:b,role:"separator",style:{flexBasis:"auto",cursor:k,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}I_.displayName="Separator";function ep(t){const e=U.c(10);let s,n,r;e[0]!==t?({className:s,ref:r,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=r):(s=e[1],n=e[2],r=e[3]);let i;e[4]!==s?(i=le("flex h-full w-full",s),e[4]=s,e[5]=i):i=e[5];let a;return e[6]!==n||e[7]!==r||e[8]!==i?(a=o.jsx(D_,{groupRef:r,"data-slot":"resizable-panel-group",className:i,...n}),e[6]=n,e[7]=r,e[8]=i,e[9]=a):a=e[9],a}function Pc(t){const e=U.c(10);let s,n,r;e[0]!==t?({ref:n,style:r,...s}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=r):(s=e[1],n=e[2],r=e[3]);let i;e[4]!==r?(i={overflow:"hidden",...r},e[4]=r,e[5]=i):i=e[5];let a;return e[6]!==s||e[7]!==n||e[8]!==i?(a=o.jsx(M_,{panelRef:n,"data-slot":"resizable-panel",style:i,...s}),e[6]=s,e[7]=n,e[8]=i,e[9]=a):a=e[9],a}function tp(t){const e=U.c(12);let s,n,r;e[0]!==t?({withHandle:r,className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=r):(s=e[1],n=e[2],r=e[3]);let i;e[4]!==s?(i=le("bg-border focus-visible:ring-ring relative flex w-[0.5px] items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:-translate-y-1/2 aria-[orientation=horizontal]:after:translate-x-0 [&[aria-orientation=horizontal]>div]:rotate-90",s),e[4]=s,e[5]=i):i=e[5];let a;e[6]!==r?(a=r&&o.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:o.jsx(e9,{className:"size-2.5"})}),e[6]=r,e[7]=a):a=e[7];let l;return e[8]!==n||e[9]!==i||e[10]!==a?(l=o.jsx(I_,{"data-slot":"resizable-handle",className:i,...n,children:a}),e[8]=n,e[9]=i,e[10]=a,e[11]=l):l=e[11],l}function Y4(t,e){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function AB(t,e){const s=U.c(8);let n;s[0]!==e?(n=c=>Y4(c,e),s[0]=e,s[1]=n):n=s[1];const[r,i]=T2(t,n);let a;s[2]!==e||s[3]!==r?(a=Y4(r,e),s[2]=e,s[3]=r,s[4]=a):a=s[4];let l;return s[5]!==i||s[6]!==a?(l=[a,i],s[5]=i,s[6]=a,s[7]=l):l=s[7],l}const EB=33;function RB(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Ff.sidePanelWidth(),t[0]=e):e=t[0],AB(e,EB)}function to(t,e,s){const n=`/api/${t.orgSlug}/sandbox/${encodeURIComponent(t.virtualMcpId)}/${encodeURIComponent(t.branch)}/${e}`,r=new URLSearchParams;t.threadId&&r.set("thread",t.threadId);for(const[a,l]of Object.entries(s??{}))l!==void 0&&r.set(a,l);const i=r.toString();return i?`${n}?${i}`:n}function Q4(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const X4=/[\r\n<>]/,DB=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function k9(t){const e=t?.userName?.trim();if(!e||X4.test(e))return null;const s=t?.userEmail?.trim();return!s||X4.test(s)?{userName:e}:DB.test(s)?{userName:e,userEmail:s}:{userName:e}}function MB(t){return t.split(`
4
4
  `).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
5
5
  `).trimEnd()}function IB(t){const e=t.userName.trim(),s=t.userEmail?.trim();return s?`Co-authored-by: ${e} <${s}>`:`Co-authored-by: ${e}`}function O_(t,e){const s=k9(e);if(!s)return t;const n=MB(t),r=IB(s);if(n.includes(r))return n;const i=n.trimEnd();return i.length>0?`${i}
@@ -621,10 +621,10 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
621
621
  22% { opacity: 0; }
622
622
  }
623
623
  `}),e[27]=y):y=e[27];let w;return e[28]!==L||e[29]!==u?(w=o.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 select-none [clip-path:inset(-24px_0_-200px_0)]",children:[u,L,y]}),e[28]=L,e[29]=u,e[30]=w):w=e[30],w}function rh(t){const e=U.c(10),{phase:s,current:n,children:r}=t,i=s-n,a=i<0,l=i===0,c=a?90:i*-22,d=a?.94:1-Math.max(i,0)*.04,h=a?0:l?1:i===1?.8:.55,u=a?10:30-i,f=!l;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=le("absolute inset-0 overflow-hidden rounded-xl border border-foreground/10 bg-background shadow-[0_20px_60px_-20px_rgb(0_0_0_/_0.35)] transition-all ease-[cubic-bezier(0.22,1,0.36,1)]"),e[0]=m):m=e[0];const p=`translateY(${c}px) scale(${d})`,g=l?"auto":"none";let x;e[1]!==h||e[2]!==p||e[3]!==g||e[4]!==u?(x={transform:p,opacity:h,zIndex:u,transitionDuration:"1000ms",pointerEvents:g},e[1]=h,e[2]=p,e[3]=g,e[4]=u,e[5]=x):x=e[5];let b;return e[6]!==r||e[7]!==f||e[8]!==x?(b=o.jsx("div",{"aria-hidden":f,className:m,style:x,children:r}),e[6]=r,e[7]=f,e[8]=x,e[9]=b):b=e[9],b}function K9(t){const e=U.c(7),{showUrl:s}=t,n=s===void 0?!1:s;let r,i,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:le("size-2.5 rounded-full",er)}),i=o.jsx("div",{className:le("size-2.5 rounded-full",er)}),a=o.jsx("div",{className:le("size-2.5 rounded-full",er)}),e[0]=r,e[1]=i,e[2]=a):(r=e[0],i=e[1],a=e[2]);let l;e[3]!==n?(l=n&&o.jsx("div",{className:le("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",si)}),e[3]=n,e[4]=l):l=e[4];let c;return e[5]!==l?(c=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[r,i,a,l]}),e[5]=l,e[6]=c):c=e[6],c}function Jee(){const t=U.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(K9,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsx("div",{className:"flex flex-1 px-8 py-5",children:o.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:Wee.map(Zee)})})]}),t[1]=s):s=t[1],s}function Zee(t,e){if(e===HS)return o.jsx("div",{className:"rounded-md bg-chart-1/[0.55]",style:{animation:"vm-breathe 2.4s ease-in-out infinite"}},e);const s=t;return o.jsx("div",{className:le("relative rounded-md",er),children:o.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${KS}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function ete(){const t=U.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(K9,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:le("w-[18%] rounded-md",si),style:{animation:"vm-breathe 3s ease-in-out infinite"}}),t[1]=s):s=t[1];let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"h-[42%] shrink-0 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.4s infinite"}}),t[2]=n):n=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"col-span-3 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.8s infinite"}}),t[3]=r):r=t[3];let i;return t[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[n,o.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[r,o.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[o.jsx("div",{className:le("rounded-md",si),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),o.jsx("div",{className:le("rounded-md",si),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=i):i=t[4],i}function tte(){const t=U.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(K9,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:o.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:Yee.map(ste)})})]}),t[1]=s):s=t[1],s}function ste(t,e){return o.jsx("div",{className:le("aspect-square rounded-md",Qee[e]?"bg-chart-2/70":er),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function nte(){const t=U.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(K9,{showUrl:!0}),t[0]=e):e=t[0];let s,n,r,i,a;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),n=o.jsx("div",{className:le("h-1.5 w-[70%] rounded-sm",er)}),r=o.jsx("div",{className:le("h-1.5 w-[55%] rounded-sm",er)}),i=o.jsx("div",{className:le("h-1.5 w-[80%] rounded-sm",er)}),a=o.jsx("div",{className:le("h-1.5 w-[50%] rounded-sm",er)}),t[1]=s,t[2]=n,t[3]=r,t[4]=i,t[5]=a):(s=t[1],n=t[2],r=t[3],i=t[4],a=t[5]);let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsxs("div",{className:"flex w-[18%] shrink-0 flex-col gap-1.5 bg-chart-1/[0.05] p-2.5",children:[s,n,r,i,a,o.jsx("div",{className:"mt-auto",children:o.jsx("div",{className:le("h-4 rounded-md",er)})})]}),t[6]=l):l=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:o.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[o.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),o.jsx("div",{className:le("h-1.5 w-[55%] rounded-sm",si)})]})}),t[7]=c):c=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[o.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),o.jsx("div",{className:le("h-4 w-10 rounded-full",si)}),o.jsx("div",{className:le("h-4 w-14 rounded-full",si)})]}),t[8]=d):d=t[8];let h;t[9]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsxs("div",{className:le("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",si),children:[o.jsx("div",{className:le("h-1.5 w-[50%] rounded-sm",er)}),o.jsx("div",{className:le("h-1 w-[75%] rounded-sm",er)})]}),t[9]=h):h=t[9];let u;return t[10]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsxs("div",{className:"flex min-h-0 flex-1",children:[l,o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c,o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[d,o.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[h,o.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[o.jsx("div",{className:le("rounded-md",si)}),o.jsx("div",{className:le("rounded-md",si)})]})]})]})]})]})]}),t[10]=u):u=t[10],u}function zc(t){const e=U.c(52),s=ue();if(t.kind==="starting"){let m;return e[0]!==t.claimPhase||e[1]!==t.progress?(m=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsx(Xee,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=m):m=e[2],m}if(t.kind==="errored"){const m=t.error.code===sp.githubNotAuthenticated,p=t.error.code===sp.githubConnectionMissing;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(sa,{className:"size-12 text-destructive"}),e[3]=g):g=e[3];let x;e[4]!==s?(x=s("sandbox.stateCard.erroredHeadline"),e[4]=s,e[5]=x):x=e[5];let b;e[6]!==x?(b=o.jsx("h3",{className:"text-lg font-medium",children:x}),e[6]=x,e[7]=b):b=e[7];let v;e[8]!==p||e[9]!==m||e[10]!==t.error.message||e[11]!==s?(v=p?s("sandbox.stateCard.githubConnectionMissingMessage"):m?s("sandbox.stateCard.githubNotAuthenticatedMessage"):t.error.message,e[8]=p,e[9]=m,e[10]=t.error.message,e[11]=s,e[12]=v):v=e[12];let _;e[13]!==v?(_=o.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:v}),e[13]=v,e[14]=_):_=e[14];let L;e[15]!==p||e[16]!==m||e[17]!==t.connectionsHref||e[18]!==s?(L=(m||p)&&t.connectionsHref&&o.jsx(me,{asChild:!0,children:o.jsx("a",{href:t.connectionsHref,children:s(p?"sandbox.stateCard.linkRepoAgain":"sandbox.stateCard.reconnectGithub")})}),e[15]=p,e[16]=m,e[17]=t.connectionsHref,e[18]=s,e[19]=L):L=e[19];const y=t.onRetry;let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Mn,{className:"size-4"}),e[20]=w):w=e[20];let S;e[21]!==s?(S=s("sandbox.stateCard.retry"),e[21]=s,e[22]=S):S=e[22];let k;e[23]!==t.onRetry||e[24]!==S?(k=o.jsxs(me,{variant:"outline",onClick:y,children:[w," ",S]}),e[23]=t.onRetry,e[24]=S,e[25]=k):k=e[25];let j;e[26]!==L||e[27]!==k?(j=o.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[L,k]}),e[26]=L,e[27]=k,e[28]=j):j=e[28];let N;return e[29]!==j||e[30]!==b||e[31]!==_?(N=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[g,b,_,j]})}),e[29]=j,e[30]=b,e[31]=_,e[32]=N):N=e[32],N}let n;e[33]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx($T,{className:"size-12 text-blue-500"}),e[33]=n):n=e[33];let r;e[34]!==s?(r=s("sandbox.stateCard.suspendedHeadline"),e[34]=s,e[35]=r):r=e[35];let i;e[36]!==r?(i=o.jsx("h3",{className:"text-lg font-medium",children:r}),e[36]=r,e[37]=i):i=e[37];let a;e[38]!==s?(a=s("sandbox.stateCard.resumeToContinue"),e[38]=s,e[39]=a):a=e[39];let l;e[40]!==a?(l=o.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:a}),e[40]=a,e[41]=l):l=e[41];const c=t.onResume;let d;e[42]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Oa,{className:"size-4"}),e[42]=d):d=e[42];let h;e[43]!==s?(h=s("sandbox.stateCard.resume"),e[43]=s,e[44]=h):h=e[44];let u;e[45]!==t.onResume||e[46]!==h?(u=o.jsxs(me,{onClick:c,className:"mt-2",children:[d," ",h]}),e[45]=t.onResume,e[46]=h,e[47]=u):u=e[47];let f;return e[48]!==i||e[49]!==l||e[50]!==u?(f=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[n,i,l,u]})}),e[48]=i,e[49]=l,e[50]=u,e[51]=f):f=e[51],f}function H3(t,e,s){return`deco:preview:last-page:${t}:${e}:${s}`}function rte(t){if(!t)return null;try{const e=JSON.parse(t);if(!e||typeof e!="object"||Array.isArray(e)||typeof e.path!="string"||!e.path.startsWith("/"))return null;const s=typeof e.pageKey=="string"?e.pageKey:null,n={};if(e.params&&typeof e.params=="object")for(const[r,i]of Object.entries(e.params))typeof i=="string"&&(n[r]=i);return{path:e.path,pageKey:s,params:n}}catch{return null}}function K3(t){try{return rte(localStorage.getItem(t))}catch{return null}}function ite(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function WS(t){switch(t.lifecycle.phase){case"cloning":case"checking-out":return{step:"cloning",status:"doing"};case"clone-failed":return{step:"cloning",status:"failed"};case"installing":return{step:"install",status:"doing"};case"install-failed":return{step:"install",status:"failed"};case"starting":return{step:"dev",status:"doing"};case"running":return{step:"dev",status:"done"};case"start-failed":return{step:"dev",status:"failed"};case"crashed":return{step:"dev",status:"failed"};case"idle":return t.claimPhase&&t.claimPhase.kind!=="ready"&&t.claimPhase.kind!=="failed"?{step:"provision",status:"doing"}:{step:"cloning",status:"doing"}}}const Vb="site-links",ote=/details?page|\bpdp\b/i,ate=/listingpage|\bplp\b/i;function lte(t,e,s){const n=new Set;for(const l of s)ote.test(l)&&n.add("product"),ate.test(l)&&n.add("category");const r=mf(Fo(t)),i=r[r.length-1],a=r[r.length-2];return i?.type==="text"&&i.text==="/p"&&a?.type==="param"&&a.name===e&&n.add("product"),e==="*"&&r.some(l=>l.type==="param"&&l.name==="*")&&n.add("category"),n}const cte=["rosa","preto","pink","black"];function ih(t,e){const s=e.trim();return s?t(s):cte.flatMap(n=>t(n))}function dte(t,e){const s=e.trim(),n=[];/^\d+$/.test(s)&&n.push({resolveType:t,props:{ids:[s]}});const i=s.includes("-")&&!/\s/.test(s)?s.replace(/-+/g," "):s;return n.push({resolveType:t,props:{query:i,count:10}}),n}const qS=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function W3(t){return t.split("/")[0]??""}function ute(t){const e=new Set;for(const s of t){const n=W3(s);qS.has(n)&&e.add(n)}return e}function hte(t,e){const s=W3(t);return!qS.has(s)||e.size===0?!0:e.has(s)}const fte=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>ih(s=>dte(t,s),e),optionsFromPayload:oh},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>ih(s=>[{resolveType:t,props:{props:{search:s,pageSize:10,currentPage:1}}}],e),optionsFromPayload:oh},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>ih(s=>[{resolveType:t,props:{term:s,hitsPerPage:10}}],e),optionsFromPayload:oh},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>ih(s=>[{resolveType:t,props:{query:s,term:s,count:10,hitsPerPage:10}}],e),optionsFromPayload:oh},{kind:"category",test:t=>t==="vtex/loaders/categories/tree.ts"||/categor(y|ies).*tree/i.test(t),clientFilter:!0,buildRequests:t=>[{resolveType:t,props:{}}],optionsFromPayload:yte}];function mte(t,e,s=new Set){const n=[...e],r=l=>{const c=[];for(const d of fte){if(d.kind!==l)continue;const h=n.find(u=>d.test(u)&&hte(u,s));h&&c.push({cand:d,resolveType:h})}return c.find(d=>s.has(W3(d.resolveType)))??c[0]},i=(l,c,d)=>({kind:l.kind,id:`${l.kind}:${c}`,resolveType:c,clientFilter:l.clientFilter,isFallback:d,buildRequests:h=>l.buildRequests(c,h),optionsFromPayload:l.optionsFromPayload}),a=[];for(const l of["product","category"]){if(!t.has(l))continue;const c=r(l);c&&a.push(i(c.cand,c.resolveType,!1))}return t.size>0&&a.push(pte(t.has("category")?"category":"product")),a}function pte(t){return{kind:t,id:Vb,resolveType:Vb,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,s)=>kte(e,s)}}function Na(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function gte(t,e,s){const n=new Set,r=new Set,i=a=>{if(Array.isArray(a)){for(const d of a)i(d);return}const l=Na(a);if(!l)return;const c=l.__resolveType;if(typeof c=="string"){if(s(c))n.add(c);else if(c in e&&!r.has(c)){r.add(c);const d=Na(e[c])?.__resolveType;typeof d=="string"&&s(d)&&n.add(c),i(e[c])}}for(const d of Object.values(l))i(d)};return i(t),n}function GS(t){const e=new Set,s=[];for(const n of t)for(const r of n)e.has(r.value)||(e.add(r.value),s.push(r));return s}function YS(t){try{return decodeURIComponent(t)}catch{return t}}function xte(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bte(t){const e=[];let s="^";for(const n of t)n.type==="text"?s+=xte(n.text):(e.push(n.name),s+=n.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${s}$`),order:e}}function QS(t,e,s){if(typeof t!="string"||!t)return null;let n;try{n=new URL(t,"https://placeholder.invalid").pathname}catch{return null}n=n.replace(/\/+$/,"");const r=mf(Fo(e)),{pattern:i,order:a}=bte(r),l=a.indexOf(s);if(l===-1)return null;const c=n.match(i);if(!c)return null;const d=c[l+1]?.replace(/^\/+|\/+$/g,"");return d?YS(d):null}function oh(t,e){const s=Na(t),n=Array.isArray(t)?t:Array.isArray(s?.products)?s.products:Array.isArray(s?.list)?s.list:[],r=[],i=new Set;for(const a of n){const l=Na(a);if(!l)continue;const c=QS(l.url,e.template,e.paramName);if(!c||i.has(c))continue;i.add(c);const d=Na(l.isVariantOf),h=typeof d?.name=="string"&&d.name||typeof l.name=="string"&&l.name||c,u=Array.isArray(l.image)?Na(l.image[0]):null,f=typeof u?.url=="string"?u.url:void 0;r.push({value:c,label:h,image:f})}return r}function vte(t){if(typeof t!="string"||!t)return null;let e;try{e=new URL(t,"https://placeholder.invalid").pathname}catch{return null}const s=e.replace(/^\/+|\/+$/g,"");return s?YS(s):null}function yte(t){const e=[],s=new Set,n=(r,i)=>{const a=Na(r);if(!a)return;const l=typeof a.name=="string"&&a.name?a.name:"",c=l?[...i,l]:i,d=vte(a.url);if(d&&!s.has(d)&&(s.add(d),e.push({value:d,label:c.join(" › ")||d})),Array.isArray(a.children))for(const h of a.children)n(h,c)};if(Array.isArray(t))for(const r of t)n(r,[]);return e}const _te=new Set(["login","logout","signin","sign-in","signup","sign-up","register","account","myaccount","my-account","minha-conta","conta","cart","carrinho","checkout","wishlist","favoritos","favorites","orders","pedidos","help","hc","sac","atendimento","contato","contact","institucional","newsletter","customer","sales","catalogsearch","search","busca","privacy-policy-cookie-restriction-mode"]);function Lte(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,s=>s.toUpperCase())}function wte(t){if(typeof t!="string"||!t)return[];const e=[],s=/<a\b[^>]*?\bhref="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi;let n,r=0;for(;(n=s.exec(t))!==null&&r++<5e3;){const i=n[1]??"",a=(n[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:i,text:a})}return e}function Ste(t){if(typeof t!="string"||!t)return[];const e=[],s=new Set,n=/"@type":"Product"[\s\S]{0,600}?(?:"url"|\burl):"([^"]+)"[\s\S]{0,300}?(?:"name"|\bname):"([^"]+)"/g,r=/(?:"image"|\bimage):\s*\[\s*\{[\s\S]{0,400}?(?:"url"|\burl):"([^"]+)"/;let i,a=0;for(;(i=n.exec(t))!==null&&a++<3e3;){const l=(i[1]??"").replace(/\\\//g,"/");if(!l||s.has(l))continue;s.add(l);const c=t.slice(i.index,i.index+900).match(r)?.[1]?.replace(/\\\//g,"/");e.push({url:l,name:i[2]??"",image:c||void 0})}return e}function kte(t,e){const s=[],n=new Set,r=(i,a,l,c)=>{if(s.length>=200)return;const d=QS(i,e.template,e.paramName);!d||n.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||l==="category"&&_te.has(d.split("/")[0]??"")||(n.add(d),s.push({value:d,label:a&&a.length<=80?a:Lte(d),kind:l,image:c}))};for(const{url:i,name:a,image:l}of Ste(t))r(i,a,"product",l);for(const{href:i,text:a}of wte(t))i.startsWith("/")&&!i.startsWith("//")&&r(i,a,"category");return s}function Pd(t,e,s=50){const n=e.trim().toLowerCase();return(n?t.filter(i=>i.label.toLowerCase().includes(n)||i.value.toLowerCase().includes(n)):t).slice(0,s)}const XS=1e4;function jte(t){return{product:{noun:t("sandbox.pathParamPickerChip.kindProductNoun"),heading:t("sandbox.pathParamPickerChip.kindProductHeading")},category:{noun:t("sandbox.pathParamPickerChip.kindCategoryNoun"),heading:t("sandbox.pathParamPickerChip.kindCategoryHeading")}}}async function Cte(t,{resolveType:e,props:s}){const n=await fetch(cS(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(XS)});if(!n.ok)throw new Error(`Failed to fetch options: ${n.status}`);return n.json()}async function Tb(t,e){const s=await fetch(lS(t,e),{signal:AbortSignal.timeout(XS)});if(!s.ok)throw new Error(`Failed to fetch page: ${s.status}`);return s.text()}async function Nte(t,e,s){const n=e.optionsFromPayload(await Tb(t,"/"),s),r=n.find(a=>a.kind==="category");if(!r)return n;const i=Ri(s.template,{[s.paramName]:r.value});if(i==="/")return n;try{const a=e.optionsFromPayload(await Tb(t,i),s).filter(l=>l.kind==="product");return GS([n,a])}catch{return n}}function Vte(t,e,s){return at.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":s}`)}async function Tte(t,e,s,n){if(e.homepageLinks)return Nte(t,e,n);const r=e.buildRequests?.(s)??[];if(r.length===0)return[];const i=await Promise.allSettled(r.map(l=>Cte(t,l))),a=i.filter(l=>l.status==="fulfilled").map(l=>l.value);if(a.length===0){const l=i.find(c=>c.status==="rejected");throw l?l.reason:new Error("Failed to fetch options")}return GS(a.map(l=>e.optionsFromPayload(l,n)))}function Cp(t,e,s,n,r){return{queryKey:Vte(t,e,s),queryFn:()=>Tte(t,e,s,n),enabled:r,staleTime:6e4,retry:1}}function Ad(t){const e=U.c(16),{heading:s,iconKind:n,options:r,template:i,paramName:a,keyPrefix:l,onSelect:c}=t;if(r.length===0)return null;let d;if(e[0]!==n||e[1]!==l||e[2]!==c||e[3]!==r||e[4]!==a||e[5]!==i){let u;e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==a||e[11]!==i?(u=f=>o.jsxs(as,{value:`${l}:${f.value}`,className:"gap-3 py-2",onSelect:()=>c(f.value),children:[n==="product"&&o.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:f.image?o.jsx("img",{src:f.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):o.jsx(Q2,{size:14,className:"text-muted-foreground"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm",children:f.label}),o.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Ri(i,{[a]:f.value})})]})]},`${l}:${f.value}`),e[7]=n,e[8]=l,e[9]=c,e[10]=a,e[11]=i,e[12]=u):u=e[12],d=r.map(u),e[0]=n,e[1]=l,e[2]=c,e[3]=r,e[4]=a,e[5]=i,e[6]=d}else d=e[6];let h;return e[13]!==s||e[14]!==d?(h=o.jsx(Es,{heading:s,children:d}),e[13]=s,e[14]=d,e[15]=h):h=e[15],h}function Pb(t){const e=U.c(2),{text:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Pte(t){const e=U.c(52),{sources:s,template:n,paramName:r,value:i,sandboxRef:a,onCommit:l}=t,c=ue(),[d,h]=P.useState(!1),[u,f]=P.useState(""),[m,p]=P.useState(""),g=P.useRef(null),x=r==="*"?c("sandbox.preview.catchAllParamLabel"):`:${r}`,b=jte(c),_=[...new Set(s.map(je=>b[je.kind].noun))].join(" or ");let L;e[0]!==c||e[1]!==_?(L=c("sandbox.pathParamPickerChip.searchPlaceholder",{options:_}),e[0]=c,e[1]=_,e[2]=L):L=e[2];const y=L,w={template:n,paramName:r};let S;e[3]!==u?(S=(je,we)=>({source:je,query:we,options:je.clientFilter?Pd(we.data??[],u):we.data??[]}),e[3]=u,e[4]=S):S=e[4];const k=S,j=s.filter($te),N=s.filter(Ote),V=Hm({queries:j.map(je=>Cp(a,je,m,w,d))});let C;e[5]!==V||e[6]!==k?(C=(je,we)=>k(je,V[we]),e[5]=V,e[6]=k,e[7]=C):C=e[7];const T=j.map(C),A=T.length===0||T.every(Ite),R=Hm({queries:N.map(je=>Cp(a,je,m,w,d&&A))});let E;e[8]!==R||e[9]!==k?(E=(je,we)=>k(je,R[we]),e[8]=R,e[9]=k,e[10]=E):E=e[10];const I=N.map(E),D=A?I:T,O=D.length===1&&D[0]?.source.homepageLinks?D[0]:null,M=O&&!O.query.isLoading&&!O.query.isError?O?.query.data??[]:[],z=Pd(M.filter(Mte),u),F=Pd(M.filter(Dte),u),B=z.length>0&&F.length>0,H=je=>{h(je),g.current&&clearTimeout(g.current),f(je?i:""),p(je?i:"")};let W;e[11]===Symbol.for("react.memo_cache_sentinel")?(W=je=>{f(je),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{p(je)},300)},e[11]=W):W=e[11];const K=W,q=je=>{l(je),H(!1)},G=gS(u),te=Ri(n,{[r]:G}),X=zt,Z=Bt,ee="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",se=Rte;let J;e[12]!==x||e[13]!==c?(J=c("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:x}),e[12]=x,e[13]=c,e[14]=J):J=e[14];let oe;e[15]!==J?(oe=o.jsx(ls,{className:"sr-only",children:o.jsx(qt,{children:J})}),e[15]=J,e[16]=oe):oe=e[16];let ce;e[17]===Symbol.for("react.memo_cache_sentinel")?(ce=o.jsx(Q2,{size:16,className:"shrink-0 text-foreground"}),e[17]=ce):ce=e[17];let he;e[18]!==c?(he=c("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=c,e[19]=he):he=e[19];let ne;e[20]!==x?(ne=o.jsx("span",{className:"rounded-sm bg-violet-500/15 px-1 py-0.5 font-mono text-[12px] text-violet-600 dark:text-violet-400",children:x}),e[20]=x,e[21]=ne):ne=e[21];let Q;e[22]!==he||e[23]!==ne?(Q=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[ce,o.jsxs("span",{className:"text-sm font-medium text-foreground",children:[he," ",ne]})]}),e[22]=he,e[23]=ne,e[24]=Q):Q=e[24];const de=zr,ae=!1,re="min-h-0 flex-1";let ie;e[25]!==y||e[26]!==u?(ie=o.jsx(hr,{autoFocus:!0,placeholder:y,value:u,onValueChange:K}),e[25]=y,e[26]=u,e[27]=ie):ie=e[27];const Y=fr,pe="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let be;e[28]!==c?(be=c("sandbox.pathParamPickerChip.noResults"),e[28]=c,e[29]=be):be=e[29];let _e;e[30]!==be?(_e=o.jsx(On,{children:be}),e[30]=be,e[31]=_e):_e=e[31];const Le=G&&o.jsx(Es,{className:"shrink-0",children:o.jsxs(as,{value:`__raw__:${G}`,className:"gap-3 py-2",onSelect:()=>q(G),children:[o.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:o.jsx(ro,{size:14,className:"text-muted-foreground"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm",children:c("sandbox.pathParamPickerChip.useRawValue",{rawTerm:G,paramLabel:x})}),o.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:te})]})]})}),ke=B?o.jsxs("div",{className:"flex min-h-0 flex-1",children:[o.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto border-r border-border",children:o.jsx(Ad,{heading:b.category.heading,iconKind:"category",options:z,template:n,paramName:r,keyPrefix:`${O?.source.id}:cat`,onSelect:q})}),o.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:o.jsx(Ad,{heading:b.product.heading,iconKind:"product",options:F,template:n,paramName:r,keyPrefix:`${O?.source.id}:prod`,onSelect:q})})]}):o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:D.map(je=>{const{source:we,query:Ce,options:Oe}=je,{noun:rt}=b[we.kind];if(Ce.isLoading)return o.jsx(Pb,{text:c("sandbox.pathParamPickerChip.loading",{noun:rt})},we.id);if(Ce.isError)return o.jsx(Pb,{text:c("sandbox.pathParamPickerChip.couldNotLoad")},we.id);if(we.homepageLinks){const Ge=Ce.data??[];return o.jsxs(P.Fragment,{children:[o.jsx(Ad,{heading:b.category.heading,iconKind:"category",options:Pd(Ge.filter(Ete),u),template:n,paramName:r,keyPrefix:`${we.id}:cat`,onSelect:q}),o.jsx(Ad,{heading:b.product.heading,iconKind:"product",options:Pd(Ge.filter(Ate),u),template:n,paramName:r,keyPrefix:`${we.id}:prod`,onSelect:q})]},we.id)}return o.jsx(Ad,{heading:D.length>1?b[we.kind].heading:void 0,iconKind:we.kind,options:Oe,template:n,paramName:r,keyPrefix:we.id,onSelect:q},we.id)})});let Ve;e[32]!==Y||e[33]!==_e||e[34]!==Le||e[35]!==ke?(Ve=o.jsxs(Y,{className:pe,children:[_e,Le,ke]}),e[32]=Y,e[33]=_e,e[34]=Le,e[35]=ke,e[36]=Ve):Ve=e[36];let Pe;e[37]!==de||e[38]!==ie||e[39]!==Ve?(Pe=o.jsxs(de,{shouldFilter:ae,className:re,children:[ie,Ve]}),e[37]=de,e[38]=ie,e[39]=Ve,e[40]=Pe):Pe=e[40];let xe;e[41]!==Z||e[42]!==oe||e[43]!==Q||e[44]!==Pe||e[45]!==se?(xe=o.jsxs(Z,{className:ee,onClick:se,children:[oe,Q,Pe]}),e[41]=Z,e[42]=oe,e[43]=Q,e[44]=Pe,e[45]=se,e[46]=xe):xe=e[46];let Ne;return e[47]!==X||e[48]!==H||e[49]!==d||e[50]!==xe?(Ne=o.jsx(X,{open:d,onOpenChange:H,children:xe}),e[47]=X,e[48]=H,e[49]=d,e[50]=xe,e[51]=Ne):Ne=e[51],o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",title:c("sandbox.pathParamPickerChip.buttonTitle",{paramLabel:x}),className:"max-w-64 shrink-0 cursor-pointer truncate rounded-sm bg-violet-500/15 px-1 py-0.5 text-[12px] text-violet-600 hover:bg-violet-500/25 dark:text-violet-400",onClick:je=>{je.stopPropagation(),H(!0)},children:i||x}),Ne]})}function Ate(t){return t.kind==="product"}function Ete(t){return t.kind!=="product"}function Rte(t){return t.stopPropagation()}function Dte(t){return t.kind==="product"}function Mte(t){return t.kind!=="product"}function Ite(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function Ote(t){return t.isFallback}function $te(t){return!t.isFallback}function Bte(t){const e=U.c(8),{sources:s,template:n,paramName:r,sandboxRef:i,onFill:a}=t;let l,c;if(e[0]!==r||e[1]!==i||e[2]!==s||e[3]!==n){const m={template:n,paramName:r},p=s.filter(zte);c=Hm,l=p.map(g=>Cp(i,g,"",m,!0)),e[0]=r,e[1]=i,e[2]=s,e[3]=n,e[4]=l,e[5]=c}else l=e[4],c=e[5];let d;e[6]!==l?(d={queries:l},e[6]=l,e[7]=d):d=e[7];const h=c(d),[u,f]=P.useState(!1);if(!u)for(const m of h){if(m.isLoading)break;const p=m.data?.[0];if(p){f(!0),queueMicrotask(()=>a(p.value));break}}return null}function zte(t){return!t.isFallback}function Fte(t){const e=U.c(31),{name:s,value:n,onCommit:r}=t,i=ue(),[a,l]=P.useState(n),[c,d]=P.useState(!1),h=P.useRef(!1);let u;e[0]!==s||e[1]!==i?(u=s==="*"?i("sandbox.preview.catchAllParamLabel"):`:${s}`,e[0]=s,e[1]=i,e[2]=u):u=e[2];const f=u,m=a||f;let p;e[3]!==m?(p=o.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-[12px]",children:m}),e[3]=m,e[4]=p):p=e[4];let g;e[5]!==f||e[6]!==i?(g=i("sandbox.preview.valueForParam",{label:f}),e[5]=f,e[6]=i,e[7]=g):g=e[7];let x,b;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=k=>l(k.target.value),b=()=>d(!0),e[8]=x,e[9]=b):(x=e[8],b=e[9]);let v;e[10]!==n?(v=k=>{k.key==="Enter"&&k.currentTarget.blur(),k.key==="Escape"&&(h.current=!0,l(n),k.currentTarget.blur())},e[10]=n,e[11]=v):v=e[11];let _;e[12]!==a||e[13]!==r||e[14]!==n?(_=()=>{if(d(!1),h.current){h.current=!1;return}const k=gS(a);l(k),k!==n&&r(k)},e[12]=a,e[13]=r,e[14]=n,e[15]=_):_=e[15];let L;e[16]!==a||e[17]!==f||e[18]!==g||e[19]!==v||e[20]!==_?(L=o.jsx("input",{type:"text",value:a,placeholder:f,title:g,spellCheck:!1,className:"absolute inset-0 rounded-sm bg-violet-500/15 px-1 text-[12px] text-violet-600 outline-none placeholder:text-violet-500/60 focus:bg-violet-500/25 dark:text-violet-400",onClick:Ute,onChange:x,onFocus:b,onKeyDown:v,onBlur:_}),e[16]=a,e[17]=f,e[18]=g,e[19]=v,e[20]=_,e[21]=L):L=e[21];let y;e[22]!==p||e[23]!==L?(y=o.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[p,L]}),e[22]=p,e[23]=L,e[24]=y):y=e[24];let w;e[25]!==c||e[26]!==i?(w=c&&o.jsxs("span",{className:"pointer-events-none ml-1.5 flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-border bg-muted px-1 py-0.5 text-[10px] text-muted-foreground",children:[o.jsx(BT,{size:10}),i("sandbox.preview.enterToGo")]}),e[25]=c,e[26]=i,e[27]=w):w=e[27];let S;return e[28]!==w||e[29]!==y?(S=o.jsxs(o.Fragment,{children:[y,w]}),e[28]=w,e[29]=y,e[30]=S):S=e[30],S}function Ute(t){return t.stopPropagation()}function Hte(t){if(t.activeGlobalSectionName)return t.activeGlobalSectionName;const e=t.iframeBase;if(!e)return t.noServerLabel;try{const s=new URL(e),n=t.resolvedPath==="/"?"":t.resolvedPath;return`${s.host}${n}`}catch{return e}}function Kte(t){return t.showPreviewToolbar&&t.contentEditingEnabled}const Ab={resolveType:"website/pages/Page.tsx",seoResolveType:"website/sections/Seo/SeoV2.tsx"};function q3(t){return`pages-${encodeURIComponent(t)}-${crypto.randomUUID()}`}function JS(t,e){return{name:t,path:e,sections:[],seo:{__resolveType:Ab.seoResolveType},__resolveType:Ab.resolveType}}const Wte=700;function w0({orgSlug:t,virtualMcpId:e,branch:s}){const n=Ns(),r=ws()?.taskId??null,i=L0(e),a=_n(e).runtime==="cms";return Rs({mutationKey:Dg(t,e,s),mutationFn:async({blockKey:l,data:c})=>{if(a){const f=await m_({orgSlug:t,virtualMcpId:e,branch:s},{set:{[l]:c}});return Ig(n,{orgSlug:t,virtualMcpId:e,branch:s},f),await n.invalidateQueries({queryKey:y0({orgSlug:t,virtualMcpId:e,branch:s,threadId:r})}),f}const d=_0(i,z8(l)),h=JSON.stringify(c,null,2),u=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/write`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:d,content:h})});return u.ok?u.json():L9(u,"Write")},onMutate:async({blockKey:l,data:c})=>{const d=`${t}/${e}/${s}`,h=at.decofile(d);await n.cancelQueries({queryKey:h});const u=n.getQueryData(h),f=!!u&&l in u,m=u?.[l];return n.setQueryData(h,p=>({...p??{},[l]:c})),{queryKey:h,blockKey:l,hadKey:f,previousValue:m}},onError:(l,c,d)=>{d&&n.setQueryData(d.queryKey,h=>{if(!h)return h;if(!d.hadKey){const{[d.blockKey]:u,...f}=h;return f}return{...h,[d.blockKey]:d.previousValue}})},onSuccess:(l,{blockKey:c,data:d})=>{const h=`${t}/${e}/${s}`;n.setQueryData(at.decofile(h),u=>({...u??{},[c]:d}))}})}function G3(t,e){const s=U.c(16),n=w0(t),r=ue();let i;s[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Map,s[0]=i):i=s[0];const a=P.useRef(i);let l;s[1]===Symbol.for("react.memo_cache_sentinel")?(l=new Map,s[1]=l):l=s[1];const c=P.useRef(l);let d;s[2]!==e||s[3]!==n||s[4]!==r?(d=v=>{const _=a.current.get(v);if(!_)return;const L=typeof _=="function"?_():_;a.current.delete(v),L&&n.mutate({blockKey:v,data:L},{onSuccess:()=>e?.onSaved?.(),onError:y=>ye.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:y.message}))})},s[2]=e,s[3]=n,s[4]=r,s[5]=d):d=s[5];const h=d;let u;s[6]!==h?(u=()=>{for(const v of c.current.values())clearTimeout(v);c.current.clear();for(const v of[...a.current.keys()])h(v)},s[6]=h,s[7]=u):u=s[7];const f=u;let m,p;s[8]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{const v=c.current;return()=>{for(const _ of v.values())clearTimeout(_)}},p=[],s[8]=m,s[9]=p):(m=s[8],p=s[9]),P.useEffect(m,p);let g;s[10]!==h?(g=(v,_)=>{a.current.set(v,_);const L=c.current.get(v);L&&clearTimeout(L),c.current.set(v,setTimeout(()=>{c.current.delete(v),h(v)},Wte))},s[10]=h,s[11]=g):g=s[11];const x=g;let b;return s[12]!==f||s[13]!==x||s[14]!==n.isPending?(b={save:x,flush:f,isPending:n.isPending},s[12]=f,s[13]=x,s[14]=n.isPending,s[15]=b):b=s[15],b}function qte(t){const e=U.c(5);let s;e[0]!==t?(s=t??{orgSlug:"",virtualMcpId:"",branch:""},e[0]=t,e[1]=s):s=e[1];const n=w0(s);let r;return e[2]!==t||e[3]!==n?(r={mutationFn:async i=>{const{name:a,path:l,template:c}=i;if(!t?.virtualMcpId||!t.branch)throw new Error("Sandbox not ready");const d=q3(a),h=c?{...c,name:a,path:l}:JS(a,l);return await n.mutateAsync({blockKey:d,data:h}),{key:d,name:a,path:l}}},e[2]=t,e[3]=n,e[4]=r):r=e[4],Rs(r)}const Uo="__blank__";function ZS(t){const e=U.c(65),{id:s,value:n,onChange:r,templates:i,disabled:a}=t,l=ue(),[c,d]=P.useState(!1);let h;if(e[0]!==i||e[1]!==n){let O;e[3]!==n?(O=$=>$.key===n,e[3]=n,e[4]=O):O=e[4],h=i.find(O),e[0]=i,e[1]=n,e[2]=h}else h=e[2];const u=h;let f;e[5]!==u?.name||e[6]!==l?(f=u?.name??l("sectionsEditor.pageTemplateSelect.blankPageDefaultLabel"),e[5]=u?.name,e[6]=l,e[7]=f):f=e[7];let m;e[8]!==f?(m=o.jsx("span",{className:"truncate",children:f}),e[8]=f,e[9]=m):m=e[9];let p;e[10]!==u?(p=u?.path?o.jsx("span",{className:"truncate text-muted-foreground",children:u.path}):null,e[10]=u,e[11]=p):p=e[11];let g;e[12]!==m||e[13]!==p?(g=o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m,p]}),e[12]=m,e[13]=p,e[14]=g):g=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(x9,{className:"shrink-0 opacity-50"}),e[15]=x):x=e[15];let b;e[16]!==a||e[17]!==s||e[18]!==c||e[19]!==g?(b=o.jsx(gs,{asChild:!0,children:o.jsxs(me,{id:s,type:"button",variant:"outline",role:"combobox","aria-expanded":c,disabled:a,className:"w-full justify-between font-normal",children:[g,x]})}),e[16]=a,e[17]=s,e[18]=c,e[19]=g,e[20]=b):b=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v={width:"var(--radix-popover-trigger-width)"},e[21]=v):v=e[21];let _;e[22]!==l?(_=l("sectionsEditor.pageTemplateSelect.searchPlaceholder"),e[22]=l,e[23]=_):_=e[23];let L;e[24]!==_?(L=o.jsx(hr,{placeholder:_,className:"h-9"}),e[24]=_,e[25]=L):L=e[25];let y;e[26]!==l?(y=l("sectionsEditor.pageTemplateSelect.noPagesFoundMessage"),e[26]=l,e[27]=y):y=e[27];let w;e[28]!==y?(w=o.jsx(On,{children:y}),e[28]=y,e[29]=w):w=e[29];let S;e[30]!==l?(S=l("sectionsEditor.pageTemplateSelect.blankPageLabel"),e[30]=l,e[31]=S):S=e[31];let k;e[32]!==r?(k=()=>{r(Uo),d(!1)},e[32]=r,e[33]=k):k=e[33];let j;e[34]!==l?(j=l("sectionsEditor.pageTemplateSelect.blankPageLabel"),e[34]=l,e[35]=j):j=e[35];const N=n===Uo?"opacity-100":"opacity-0";let V;e[36]!==N?(V=le("ml-auto",N),e[36]=N,e[37]=V):V=e[37];let C;e[38]!==V?(C=o.jsx($t,{className:V}),e[38]=V,e[39]=C):C=e[39];let T;e[40]!==S||e[41]!==k||e[42]!==j||e[43]!==C?(T=o.jsxs(as,{value:S,onSelect:k,children:[j,C]}),e[40]=S,e[41]=k,e[42]=j,e[43]=C,e[44]=T):T=e[44];let A;if(e[45]!==r||e[46]!==i||e[47]!==n){let O;e[49]!==r||e[50]!==n?(O=$=>o.jsxs(as,{value:`${$.name} ${$.path}`,onSelect:()=>{r($.key),d(!1)},children:[o.jsxs("div",{className:"flex min-w-0 flex-col",children:[o.jsx("span",{className:"truncate",children:$.name}),o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:$.path})]}),o.jsx($t,{className:le("ml-auto",n===$.key?"opacity-100":"opacity-0")})]},$.key),e[49]=r,e[50]=n,e[51]=O):O=e[51],A=i.map(O),e[45]=r,e[46]=i,e[47]=n,e[48]=A}else A=e[48];let R;e[52]!==T||e[53]!==A?(R=o.jsxs(Es,{children:[T,A]}),e[52]=T,e[53]=A,e[54]=R):R=e[54];let E;e[55]!==w||e[56]!==R?(E=o.jsxs(fr,{onWheel:Gte,children:[w,R]}),e[55]=w,e[56]=R,e[57]=E):E=e[57];let I;e[58]!==L||e[59]!==E?(I=o.jsx(ys,{className:"p-0",style:v,children:o.jsxs(zr,{children:[L,E]})}),e[58]=L,e[59]=E,e[60]=I):I=e[60];let D;return e[61]!==c||e[62]!==I||e[63]!==b?(D=o.jsxs(_s,{open:c,onOpenChange:d,children:[b,I]}),e[61]=c,e[62]=I,e[63]=b,e[64]=D):D=e[64],D}function Gte(t){const e=t.deltaMode===1?16:1;t.currentTarget.scrollTop=t.currentTarget.scrollTop+t.deltaY*e}function Yte(t){const e=U.c(89),{open:s,onOpenChange:n,isPending:r,error:i,templates:a,onSubmit:l}=t,c=r===void 0?!1:r,d=ue();let h;e[0]!==d?(h=d("sectionsEditor.createPageModal.defaultPageName"),e[0]=d,e[1]=h):h=e[1];const[u,f]=P.useState(h);let m;e[2]!==d?(m=d("sectionsEditor.createPageModal.defaultPagePath"),e[2]=d,e[3]=m):m=e[3];const[p,g]=P.useState(m),[x,b]=P.useState(Uo),[v,_]=P.useState(null),[L,y]=P.useState(s);s!==L&&(y(s),s&&(f(d("sectionsEditor.createPageModal.defaultPageName")),g(d("sectionsEditor.createPageModal.defaultPagePath")),b(Uo),_(null)));const w=!!a?.length;let S;e[4]!==c||e[5]!==n?(S=he=>{!he&&!c&&(_(null),n(!1))},e[4]=c,e[5]=n,e[6]=S):S=e[6];const k=S;let j;e[7]!==c||e[8]!==u||e[9]!==l||e[10]!==p||e[11]!==w||e[12]!==x?(j=async he=>{he.preventDefault();const ne=u.trim(),Q=p.trim();if(!ne||!Q||c)return;const de=F9(Q);if(de){_(de);return}_(null),await l({name:ne,path:Q,templateKey:w&&x!==Uo?x:null})},e[7]=c,e[8]=u,e[9]=l,e[10]=p,e[11]=w,e[12]=x,e[13]=j):j=e[13];const N=j,V=v??i;let C;e[14]!==d?(C=d("sectionsEditor.createPageModal.title"),e[14]=d,e[15]=C):C=e[15];let T;e[16]!==C?(T=o.jsx(ls,{children:o.jsx(qt,{children:C})}),e[16]=C,e[17]=T):T=e[17];let A;e[18]!==d?(A=d("sectionsEditor.createPageModal.nameLabel"),e[18]=d,e[19]=A):A=e[19];let R;e[20]!==A?(R=o.jsx("label",{htmlFor:"new-page-name",className:"text-xs font-medium text-muted-foreground",children:A}),e[20]=A,e[21]=R):R=e[21];let E;e[22]===Symbol.for("react.memo_cache_sentinel")?(E=he=>f(he.target.value),e[22]=E):E=e[22];let I;e[23]!==d?(I=d("sectionsEditor.createPageModal.namePlaceholder"),e[23]=d,e[24]=I):I=e[24];let D;e[25]!==c||e[26]!==u||e[27]!==I?(D=o.jsx(yt,{id:"new-page-name",value:u,onChange:E,placeholder:I,autoFocus:!0,disabled:c}),e[25]=c,e[26]=u,e[27]=I,e[28]=D):D=e[28];let O;e[29]!==D||e[30]!==R?(O=o.jsxs("div",{className:"space-y-1.5",children:[R,D]}),e[29]=D,e[30]=R,e[31]=O):O=e[31];let $;e[32]!==d?($=d("sectionsEditor.createPageModal.pathLabel"),e[32]=d,e[33]=$):$=e[33];let M;e[34]!==$?(M=o.jsx("label",{htmlFor:"new-page-path",className:"text-xs font-medium text-muted-foreground",children:$}),e[34]=$,e[35]=M):M=e[35];let z;e[36]===Symbol.for("react.memo_cache_sentinel")?(z=he=>g(he.target.value),e[36]=z):z=e[36];let F;e[37]!==d?(F=d("sectionsEditor.createPageModal.pathPlaceholder"),e[37]=d,e[38]=F):F=e[38];let B;e[39]!==c||e[40]!==p||e[41]!==F?(B=o.jsx(yt,{id:"new-page-path",value:p,onChange:z,placeholder:F,disabled:c}),e[39]=c,e[40]=p,e[41]=F,e[42]=B):B=e[42];let H;e[43]!==M||e[44]!==B?(H=o.jsxs("div",{className:"space-y-1.5",children:[M,B]}),e[43]=M,e[44]=B,e[45]=H):H=e[45];let W;e[46]!==c||e[47]!==w||e[48]!==d||e[49]!==x||e[50]!==a?(W=w&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"new-page-template",className:"text-xs font-medium text-muted-foreground",children:d("sectionsEditor.createPageModal.templateLabel")}),o.jsx(ZS,{id:"new-page-template",value:x,onChange:b,templates:a??[],disabled:c})]}),e[46]=c,e[47]=w,e[48]=d,e[49]=x,e[50]=a,e[51]=W):W=e[51];let K;e[52]!==V?(K=V&&o.jsx("p",{className:"text-xs text-destructive",children:V}),e[52]=V,e[53]=K):K=e[53];let q;e[54]!==O||e[55]!==H||e[56]!==W||e[57]!==K?(q=o.jsxs("div",{className:"space-y-4 py-4",children:[O,H,W,K]}),e[54]=O,e[55]=H,e[56]=W,e[57]=K,e[58]=q):q=e[58];let G;e[59]!==n?(G=()=>n(!1),e[59]=n,e[60]=G):G=e[60];let te;e[61]!==d?(te=d("sectionsEditor.createPageModal.cancelButton"),e[61]=d,e[62]=te):te=e[62];let X;e[63]!==c||e[64]!==G||e[65]!==te?(X=o.jsx(me,{type:"button",variant:"outline",onClick:G,disabled:c,children:te}),e[63]=c,e[64]=G,e[65]=te,e[66]=X):X=e[66];let Z;e[67]!==c||e[68]!==u||e[69]!==p?(Z=!u.trim()||!p.trim()||c,e[67]=c,e[68]=u,e[69]=p,e[70]=Z):Z=e[70];let ee;e[71]!==c||e[72]!==d?(ee=c?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),d("sectionsEditor.createPageModal.creatingButton")]}):d("sectionsEditor.createPageModal.createButton"),e[71]=c,e[72]=d,e[73]=ee):ee=e[73];let se;e[74]!==Z||e[75]!==ee?(se=o.jsx(me,{type:"submit",disabled:Z,children:ee}),e[74]=Z,e[75]=ee,e[76]=se):se=e[76];let J;e[77]!==X||e[78]!==se?(J=o.jsxs(Yn,{children:[X,se]}),e[77]=X,e[78]=se,e[79]=J):J=e[79];let oe;e[80]!==N||e[81]!==q||e[82]!==J||e[83]!==T?(oe=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:N,children:[T,q,J]})}),e[80]=N,e[81]=q,e[82]=J,e[83]=T,e[84]=oe):oe=e[84];let ce;return e[85]!==k||e[86]!==s||e[87]!==oe?(ce=o.jsx(zt,{open:s,onOpenChange:k,children:oe}),e[85]=k,e[86]=s,e[87]=oe,e[88]=ce):ce=e[88],ce}const Qte={loaders:"loader",actions:"action"},ek=new Set(["workflows"]);function tk(t){return Qte[t]}function sk(t,e,s){const n=t.manifest?.blocks??{};for(const[r,i]of Object.entries(n))if(r.includes(s)&&e in i)return!0;return!1}function Xte(t,e,s){return/\.tsx?$/.test(e)?!0:sk(t,e,s)}function Jte(t,e){const s=new Set,n=t.manifest?.blocks??{};for(const[r,i]of Object.entries(n))if(r.includes(e))for(const a of Object.keys(i))s.add(a);return s}function Zte(t,e){return/\.tsx?$/.test(t)?!1:e.has(`${t}.ts`)||e.has(`${t}.tsx`)}function nk(t,e){const s=t.manifest?.blocks??{},n=[],r=new Set;for(const[i,a]of Object.entries(s))if(i.includes(e))for(const l of Object.keys(a))r.add(l);for(const i of r){if(i.toLowerCase().includes("preview")||wS.has(i)||ek.has(Y3(i))||Zte(i,r))continue;const a=ua(i,t);if(a.hidden)continue;const l=a.title&&a.title!==i?a.title:ms(i);n.push({resolveType:i,title:l})}return n.sort((i,a)=>i.title.localeCompare(a.title))}function Eb(t,e){return nk(t,e).length}function Y3(t){return t.startsWith("deco-sites/")?t.split("/")[1]||"site":t.startsWith("$live")||t.startsWith("deco/")?"deco":t.split("/")[0]||"other"}const ese={deco:"Deco",std:"Deco Standard",website:"Website"};function tse(t){return ese[t]??t}function rk(t){const e=Y3(t);let n=t.split("/").filter(Boolean).slice(t.startsWith("deco-sites/")?2:1);return(n[0]==="loaders"||n[0]==="actions")&&(n=n.slice(1)),[e,...n.slice(0,-1)]}function ik(t,e,s){const n=[];for(const[r,i]of Object.entries(e)){if(Xte(t,r,s)||z9(r)||!i||typeof i!="object"||Array.isArray(i))continue;const a=i,l=a.__resolveType;typeof l=="string"&&(wS.has(l)||ek.has(Y3(l))||sk(t,l,s)&&n.push({key:r,resolveType:l,title:typeof a.name=="string"&&a.name?a.name:r}))}return n.sort((r,i)=>r.title.localeCompare(i.title))}function ok(t,e){const s=t[e],n=typeof s?.__resolveType=="string"?s.__resolveType:"",{__resolveType:r,...i}=s??{},a=typeof s?.name=="string"&&s.name?s.name:e;return{resolveType:n,props:i,title:a}}const sse={target:null,editSeoPageKey:null,variantOverride:null};function nse(t,e){switch(e.type){case"select":return{...t,target:e.target,variantOverride:null,editSeoPageKey:null};case"edit-seo":return{...t,target:e.target,editSeoPageKey:e.target.key,variantOverride:null};case"consume-edit-seo":return{...t,editSeoPageKey:null};case"variant-override":return{...t,variantOverride:e.params}}}const ak=P.createContext(null);function Rb(t){const e=U.c(9),{children:s}=t,[n,r]=P.useReducer(nse,sse);let i,a,l,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=u=>r({type:"select",target:u}),a=u=>r({type:"edit-seo",target:u}),l=()=>r({type:"consume-edit-seo"}),c=u=>r({type:"variant-override",params:u}),e[0]=i,e[1]=a,e[2]=l,e[3]=c):(i=e[0],a=e[1],l=e[2],c=e[3]);let d;e[4]!==n?(d={state:n,selectTarget:i,editSeo:a,consumeEditSeo:l,setVariantOverride:c},e[4]=n,e[5]=d):d=e[5];let h;return e[6]!==s||e[7]!==d?(h=o.jsx(ak,{value:d,children:s}),e[6]=s,e[7]=d,e[8]=h):h=e[8],h}function lk(){const t=P.use(ak);if(!t)throw new Error("useBlocksPreviewWorkspace must be used inside BlocksPreviewWorkspaceProvider");return t}function Q3(t){return(e,s)=>{AA(e),t(e,s)}}const rse="cursor-help underline decoration-dotted decoration-muted-foreground/50 underline-offset-4";function W9(t){return Vs(t)?.metadata?.fieldDescriptionTooltips??!1}function X3(t){const e=U.c(9),{description:s,virtualMcpId:n,children:r}=t,i=W9(n);if(!s||!i)return r;let a;e[0]!==r?(a=P.cloneElement(r,{className:le(r.props.className,rse)}),e[0]=r,e[1]=a):a=e[1];let l;e[2]!==a?(l=o.jsx(Ke,{asChild:!0,children:a}),e[2]=a,e[3]=l):l=e[3];let c;e[4]!==s?(c=o.jsx(We,{className:"max-w-64",children:s}),e[4]=s,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=o.jsxs(qe,{delayDuration:300,children:[l,c]}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function zs(t){const e=U.c(17),{htmlFor:s,label:n,description:r,labelClassName:i,virtualMcpId:a}=t;if(!W9(a)){let h;e[0]!==s||e[1]!==n||e[2]!==i?(h=o.jsx(At,{htmlFor:s,className:i,children:n}),e[0]=s,e[1]=n,e[2]=i,e[3]=h):h=e[3];let u;e[4]!==r?(u=r&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:r}),e[4]=r,e[5]=u):u=e[5];let f;return e[6]!==h||e[7]!==u?(f=o.jsxs("div",{className:"space-y-0.5",children:[h,u]}),e[6]=h,e[7]=u,e[8]=f):f=e[8],f}let c;e[9]!==s||e[10]!==n||e[11]!==i?(c=o.jsx(At,{htmlFor:s,className:i,children:n}),e[9]=s,e[10]=n,e[11]=i,e[12]=c):c=e[12];let d;return e[13]!==r||e[14]!==c||e[15]!==a?(d=o.jsx(X3,{description:r,virtualMcpId:a,children:c}),e[13]=r,e[14]=c,e[15]=a,e[16]=d):d=e[16],d}const ise=ur.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(s=>e.updateAttributes(s,{textAlign:t})).some(s=>s):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:s})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?s.unsetTextAlign():s.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});var ose=ise;const ase=20,ck=(t,e=0)=>{const s=[];return!t.children.length||e>ase||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?s.push(n):n.children.length&&s.push(...ck(n,e+1))}),s},lse=t=>{if(!t.children.length)return;const e=ck(t);e&&e.forEach(s=>{var n;const r=s.getAttribute("style"),i=(n=s.parentElement)===null||n===void 0||(n=n.closest("span"))===null||n===void 0?void 0:n.getAttribute("style");s.setAttribute("style",`${i};${r}`)})},dk=YV.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&lse(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",di(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(s,n)=>{if(!s.isInline)return!0;s.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(i=>!!i))||t.removeMark(n,n+s.nodeSize,this.type)}),!0}}}}),cse=ur.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const s=(e=Wu(t,"background-color"))!==null&&e!==void 0?e:t.style.backgroundColor;return s?.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),uk=ur.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const s=(e=Wu(t,"color"))!==null&&e!==void 0?e:t.style.color;return s?.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),dse=ur.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>{var e;return(e=Wu(t,"font-family"))!==null&&e!==void 0?e:t.style.fontFamily},renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),hk=ur.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var e;return(e=Wu(t,"font-size"))!==null&&e!==void 0?e:t.style.fontSize},renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),use=ur.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>{var e;return(e=Wu(t,"line-height"))!==null&&e!==void 0?e:t.style.lineHeight},renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});ur.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(cse.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(uk.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(dse.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(hk.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(use.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(dk.configure(this.options.textStyle)),t}});const hse=["#000000","#525252","#a3a3a3","#ffffff","#e11d48","#ea580c","#ca8a04","#16a34a","#0891b2","#2563eb","#7c3aed","#db2777"];function fse(t){const e=U.c(30),{editor:s,currentColor:n,open:r,onOpenChange:i}=t,a=ue(),[l,c]=P.useState("#000000");let d;e[0]!==s||e[1]!==i?(d=w=>{s.chain().focus().setColor(w).run(),i(!1)},e[0]=s,e[1]=i,e[2]=d):d=e[2];const h=d;let u;e[3]!==s||e[4]!==i?(u=()=>{s.chain().focus().unsetColor().run(),i(!1)},e[3]=s,e[4]=i,e[5]=u):u=e[5];const f=u,m=r||n!==null;let p;e[6]!==a?(p=a("sectionsEditor.richTextColorControl.colorButtonLabel"),e[6]=a,e[7]=p):p=e[7];let g;e[8]!==i||e[9]!==r?(g=()=>i(!r),e[8]=i,e[9]=r,e[10]=g):g=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Wm,{size:14}),e[11]=x):x=e[11];const b=n??"currentColor";let v;e[12]!==b?(v=o.jsxs("span",{className:"relative flex flex-col items-center",children:[x,o.jsx("span",{className:"mt-0.5 h-0.5 w-3.5 rounded-full",style:{backgroundColor:b}})]}),e[12]=b,e[13]=v):v=e[13];let _;e[14]!==m||e[15]!==p||e[16]!==g||e[17]!==v?(_=o.jsx(Xt,{active:m,label:p,onClick:g,children:v}),e[14]=m,e[15]=p,e[16]=g,e[17]=v,e[18]=_):_=e[18];let L;e[19]!==h||e[20]!==f||e[21]!==n||e[22]!==l||e[23]!==i||e[24]!==r||e[25]!==a?(L=r&&o.jsxs("div",{tabIndex:-1,className:"absolute left-0 top-full z-20 mt-1.5 flex w-56 flex-col gap-2 rounded-md border bg-popover p-2 shadow-md",onBlur:w=>{w.currentTarget.contains(w.relatedTarget)||i(!1)},children:[o.jsx("div",{className:"grid grid-cols-6 gap-1",children:hse.map(w=>o.jsx("button",{type:"button","aria-label":w,"aria-pressed":n===w,onMouseDown:gse,onClick:()=>h(w),className:le("h-6 w-6 rounded border border-border/60 transition-transform cursor-pointer hover:scale-110",n===w&&"ring-2 ring-ring ring-offset-1"),style:{backgroundColor:w}},w))}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs("label",{className:"flex flex-1 items-center gap-1.5 rounded bg-muted/40 px-2 py-1 text-xs text-muted-foreground cursor-pointer",children:[o.jsx("input",{type:"color",value:l,onMouseDown:pse,onChange:w=>c(w.target.value),onBlur:()=>h(l),className:"h-5 w-5 cursor-pointer rounded border-0 bg-transparent p-0"}),a("sectionsEditor.richTextColorControl.customLabel")]}),o.jsx("button",{type:"button",onMouseDown:mse,onClick:f,className:"rounded px-2 py-1 text-xs text-muted-foreground transition-colors cursor-pointer hover:bg-muted hover:text-foreground",children:a("sectionsEditor.richTextColorControl.defaultLabel")})]})]}),e[19]=h,e[20]=f,e[21]=n,e[22]=l,e[23]=i,e[24]=r,e[25]=a,e[26]=L):L=e[26];let y;return e[27]!==L||e[28]!==_?(y=o.jsxs("div",{className:"relative",children:[_,L]}),e[27]=L,e[28]=_,e[29]=y):y=e[29],y}function mse(t){return t.preventDefault()}function pse(t){return t.stopPropagation()}function gse(t){return t.preventDefault()}const ah=[1,2,3,4,5,6];function xse(t){const e=new DOMParser().parseFromString(t,"text/html").body,s=Array.from(e.children);return s.length===0?e.innerHTML:s.map(n=>n.innerHTML).join("<br>")}const bse=8,vse=128,yse=16,Db=1;function _se({schema:t,value:e,onChange:s,path:n,label:r,sandbox:i,inline:a=!1}){const l=ue(),c=typeof e=="string"?e:"",d=P.useRef(s);d.current=s;const[h,u]=P.useState(!1),[f,m]=P.useState(!1),p=Kf({extensions:[Wf.configure({heading:a?!1:{levels:[...ah]},bulletList:a?!1:void 0,orderedList:a?!1:void 0,listItem:a?!1:void 0,blockquote:a?!1:void 0,link:{HTMLAttributes:{}}}),...a?[]:[ose.configure({types:["heading","paragraph"]})],dk,hk,uk],content:c||"",editorProps:{attributes:{class:le("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:y})=>{const w=y.getHTML(),S=a?xse(w):w;d.current(S==="<p></p>"||S===""?"":S)}}),g=C6({editor:p,selector:({editor:y})=>({bold:y?.isActive("bold")??!1,italic:y?.isActive("italic")??!1,underline:y?.isActive("underline")??!1,strike:y?.isActive("strike")??!1,headingLevel:ah.find(w=>y?.isActive("heading",{level:w})??!1)??0,fontSize:y?.getAttributes("textStyle").fontSize??null,color:y?.getAttributes("textStyle").color??null,bulletList:y?.isActive("bulletList")??!1,orderedList:y?.isActive("orderedList")??!1,link:y?.isActive("link")??!1,alignLeft:y?.isActive({textAlign:"left"})??!1,alignCenter:y?.isActive({textAlign:"center"})??!1,alignRight:y?.isActive({textAlign:"right"})??!1,alignJustify:y?.isActive({textAlign:"justify"})??!1})});if(!p)return null;const x=g.headingLevel>0?`h${g.headingLevel}`:"paragraph",b=y=>{const w=p.chain().focus();if(y==="paragraph"){w.setParagraph().run();return}const S=ah.find(k=>`h${k}`===y);S&&w.setHeading({level:S}).run()},v=g.fontSize?parseInt(g.fontSize,10):NaN,_=Number.isFinite(v)?v:yse,L=y=>{const w=Math.min(vse,Math.max(bse,y));p.chain().focus().setFontSize(`${w}px`).run()};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(zs,{htmlFor:n,label:r,description:t.description,virtualMcpId:i?.virtualMcpId}),o.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-border/60 bg-muted/30 px-1.5 py-1",children:[o.jsx(Xt,{active:g.bold,label:l("sectionsEditor.richTextField.bold"),onClick:()=>p.chain().focus().toggleBold().run(),children:o.jsx(Y6,{size:14})}),o.jsx(Xt,{active:g.italic,label:l("sectionsEditor.richTextField.italic"),onClick:()=>p.chain().focus().toggleItalic().run(),children:o.jsx(Q6,{size:14})}),o.jsx(Xt,{active:g.underline,label:l("sectionsEditor.richTextField.underline"),onClick:()=>p.chain().focus().toggleUnderline().run(),children:o.jsx(zT,{size:14})}),o.jsx(Xt,{active:g.strike,label:l("sectionsEditor.richTextField.strikethrough"),onClick:()=>p.chain().focus().toggleStrike().run(),children:o.jsx(X6,{size:14})}),!a&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsxs(xs,{value:x,onValueChange:b,children:[o.jsx(bs,{size:"sm","aria-label":l("sectionsEditor.richTextField.styleLabel"),onMouseDown:y=>y.preventDefault(),className:"w-[116px] gap-1 bg-transparent px-2 text-muted-foreground shadow-none! hover:bg-muted hover:text-foreground",children:o.jsx(js,{})}),o.jsxs(vs,{children:[o.jsx(It,{value:"paragraph",children:l("sectionsEditor.richTextField.styleParagraph")}),ah.map(y=>o.jsx(It,{value:`h${y}`,children:l("sectionsEditor.richTextField.styleHeading",{level:y})},y))]})]})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx(Xt,{active:!1,label:l("sectionsEditor.richTextField.fontSizeDecrease"),onClick:()=>L(_-Db),children:o.jsx(FT,{size:14})}),o.jsx("span",{className:"min-w-[2ch] text-center text-xs tabular-nums text-muted-foreground",children:_}),o.jsx(Xt,{active:!1,label:l("sectionsEditor.richTextField.fontSizeIncrease"),onClick:()=>L(_+Db),children:o.jsx(Qt,{size:14})})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(fse,{editor:p,currentColor:g.color,open:f,onOpenChange:m}),!a&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(Xt,{active:g.bulletList,label:l("sectionsEditor.richTextField.bulletList"),onClick:()=>p.chain().focus().toggleBulletList().run(),children:o.jsx(og,{size:14})}),o.jsx(Xt,{active:g.orderedList,label:l("sectionsEditor.richTextField.orderedList"),onClick:()=>p.chain().focus().toggleOrderedList().run(),children:o.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(GW,{editor:p,active:g.link,open:h,onOpenChange:u}),!a&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(Xt,{active:g.alignLeft,label:l("sectionsEditor.richTextField.alignLeft"),onClick:()=>p.chain().focus().setTextAlign("left").run(),children:o.jsx(SE,{size:14})}),o.jsx(Xt,{active:g.alignCenter,label:l("sectionsEditor.richTextField.alignCenter"),onClick:()=>p.chain().focus().setTextAlign("center").run(),children:o.jsx(UT,{size:14})}),o.jsx(Xt,{active:g.alignRight,label:l("sectionsEditor.richTextField.alignRight"),onClick:()=>p.chain().focus().setTextAlign("right").run(),children:o.jsx(HT,{size:14})}),o.jsx(Xt,{active:g.alignJustify,label:l("sectionsEditor.richTextField.alignJustify"),onClick:()=>p.chain().focus().setTextAlign("justify").run(),children:o.jsx(KT,{size:14})})]})]}),o.jsx(qf,{editor:p})]})]})}const Ac=t=>String(t).padStart(2,"0"),Lse="1900-01-01",wse="2099-12-31",Sse="1900-01-01T00:00",kse="2099-12-31T23:59";function jse(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const s=new Date(t);return Number.isNaN(s.getTime())?"":`${s.getUTCFullYear()}-${Ac(s.getUTCMonth()+1)}-${Ac(s.getUTCDate())}`}function Cse(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function Nse(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Ac(e.getMonth()+1)}-${Ac(e.getDate())}T${Ac(e.getHours())}:${Ac(e.getMinutes())}`}function Vse(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function Tse(t){const e=U.c(41),{id:s,withTime:n,value:r,onChange:i,calendarLabel:a}=t,[l,c]=P.useState(!1);let d;e[0]!==n?(d=O=>n?Nse(O):jse(O),e[0]=n,e[1]=d):d=e[1];const h=d;let u;e[2]!==n?(u=O=>n?Vse(O):Cse(O),e[2]=n,e[3]=u):u=e[3];const f=u;let m;e[4]!==h||e[5]!==r?(m=()=>h(r),e[4]=h,e[5]=r,e[6]=m):m=e[6];const[p,g]=P.useState(m),[x,b]=P.useState(r);if(r!==x){b(r);const O=h(r);O!==p&&g(O)}let v;e[7]!==i||e[8]!==f?(v=O=>{g(O.target.value),i(f(O.target.value))},e[7]=i,e[8]=f,e[9]=v):v=e[9];const _=v;let L;if(e[10]!==r){const O=r?new Date(r):null;L=O&&!Number.isNaN(O.getTime())?O:null,e[10]=r,e[11]=L}else L=e[11];const y=L;let w;e[12]!==i||e[13]!==y||e[14]!==h||e[15]!==n?(w=O=>{if(!O)return;n&&y?O.setHours(y.getHours(),y.getMinutes(),0,0):O.setHours(0,0,0,0);const $=O.toISOString();g(h($)),b($),i($),c(!1)},e[12]=i,e[13]=y,e[14]=h,e[15]=n,e[16]=w):w=e[16];const S=w,k=n?"datetime-local":"date",j=n?Sse:Lse,N=n?kse:wse;let V;e[17]!==h||e[18]!==r?(V=()=>g(h(r)),e[17]=h,e[18]=r,e[19]=V):V=e[19];let C;e[20]!==_||e[21]!==s||e[22]!==p||e[23]!==V||e[24]!==k||e[25]!==j||e[26]!==N?(C=o.jsx(yt,{id:s,type:k,min:j,max:N,value:p,onChange:_,onBlur:V,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[20]=_,e[21]=s,e[22]=p,e[23]=V,e[24]=k,e[25]=j,e[26]=N,e[27]=C):C=e[27];let T;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(id,{className:"h-4 w-4"}),e[28]=T):T=e[28];let A;e[29]!==a?(A=o.jsx(gs,{asChild:!0,children:o.jsx(me,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":a,children:T})}),e[29]=a,e[30]=A):A=e[30];const R=y??void 0;let E;e[31]!==S||e[32]!==R?(E=o.jsx(ys,{className:"w-auto p-0",align:"end",onCloseAutoFocus:Pse,children:o.jsx(Gf,{mode:"single",selected:R,onSelect:S,initialFocus:!0})}),e[31]=S,e[32]=R,e[33]=E):E=e[33];let I;e[34]!==l||e[35]!==A||e[36]!==E?(I=o.jsxs(_s,{open:l,onOpenChange:c,children:[A,E]}),e[34]=l,e[35]=A,e[36]=E,e[37]=I):I=e[37];let D;return e[38]!==C||e[39]!==I?(D=o.jsxs("div",{className:"flex gap-1",children:[C,I]}),e[38]=C,e[39]=I,e[40]=D):D=e[40],D}function Pse(t){return t.preventDefault()}function lh(t){const e=U.c(76),{schema:s,value:n,onChange:r,path:i,label:a,sandbox:l}=t,c=ue(),d=typeof n=="string"?n:"",h=s.format;if(h==="rich-text"||h==="rich-text-inline"||h==="html"){const _=h==="rich-text-inline";let L;return e[0]!==a||e[1]!==r||e[2]!==i||e[3]!==l||e[4]!==s||e[5]!==_||e[6]!==n?(L=o.jsx(_se,{schema:s,value:n,onChange:r,path:i,label:a,sandbox:l,inline:_}),e[0]=a,e[1]=r,e[2]=i,e[3]=l,e[4]=s,e[5]=_,e[6]=n,e[7]=L):L=e[7],L}if(h==="textarea"||h==="markdown"){const _=l?.virtualMcpId;let L;e[8]!==a||e[9]!==i||e[10]!==s.description||e[11]!==_?(L=o.jsx(zs,{htmlFor:i,label:a,description:s.description,virtualMcpId:_}),e[8]=a,e[9]=i,e[10]=s.description,e[11]=_,e[12]=L):L=e[12];let y;e[13]!==r?(y=k=>r(k.target.value),e[13]=r,e[14]=y):y=e[14];let w;e[15]!==i||e[16]!==d||e[17]!==y?(w=o.jsx(Yo,{id:i,value:d,onChange:y,rows:4}),e[15]=i,e[16]=d,e[17]=y,e[18]=w):w=e[18];let S;return e[19]!==L||e[20]!==w?(S=o.jsxs("div",{className:"space-y-2",children:[L,w]}),e[19]=L,e[20]=w,e[21]=S):S=e[21],S}const u=h==="date-time"||h==="datetime";if(h==="date"||u){const _=l?.virtualMcpId;let L;e[22]!==a||e[23]!==i||e[24]!==s.description||e[25]!==_?(L=o.jsx(zs,{htmlFor:i,label:a,description:s.description,virtualMcpId:_}),e[22]=a,e[23]=i,e[24]=s.description,e[25]=_,e[26]=L):L=e[26];let y;e[27]!==c?(y=c("sectionsEditor.stringField.openCalendar"),e[27]=c,e[28]=y):y=e[28];let w;e[29]!==u||e[30]!==r||e[31]!==i||e[32]!==d||e[33]!==y?(w=o.jsx(Tse,{id:i,withTime:u,value:d,onChange:r,calendarLabel:y}),e[29]=u,e[30]=r,e[31]=i,e[32]=d,e[33]=y,e[34]=w):w=e[34];let S;return e[35]!==L||e[36]!==w?(S=o.jsxs("div",{className:"space-y-2",children:[L,w]}),e[35]=L,e[36]=w,e[37]=S):S=e[37],S}if(h==="color-input"||h==="color"){const _=l?.virtualMcpId;let L;e[38]!==a||e[39]!==i||e[40]!==s.description||e[41]!==_?(L=o.jsx(zs,{htmlFor:i,label:a,description:s.description,virtualMcpId:_}),e[38]=a,e[39]=i,e[40]=s.description,e[41]=_,e[42]=L):L=e[42];const y=d||"#000000";let w;e[43]!==r?(w=C=>r(C.target.value),e[43]=r,e[44]=w):w=e[44];let S;e[45]!==y||e[46]!==w?(S=o.jsx("input",{type:"color",value:y,onChange:w,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[45]=y,e[46]=w,e[47]=S):S=e[47];let k;e[48]!==r?(k=C=>r(C.target.value),e[48]=r,e[49]=k):k=e[49];let j;e[50]!==i||e[51]!==d||e[52]!==k?(j=o.jsx(yt,{id:i,value:d,onChange:k,placeholder:"#000000",className:"h-10 flex-1"}),e[50]=i,e[51]=d,e[52]=k,e[53]=j):j=e[53];let N;e[54]!==S||e[55]!==j?(N=o.jsxs("div",{className:"flex items-center gap-2",children:[S,j]}),e[54]=S,e[55]=j,e[56]=N):N=e[56];let V;return e[57]!==L||e[58]!==N?(V=o.jsxs("div",{className:"space-y-2",children:[L,N]}),e[57]=L,e[58]=N,e[59]=V):V=e[59],V}const f=l?.virtualMcpId;let m;e[60]!==a||e[61]!==i||e[62]!==s.description||e[63]!==f?(m=o.jsx(zs,{htmlFor:i,label:a,description:s.description,virtualMcpId:f}),e[60]=a,e[61]=i,e[62]=s.description,e[63]=f,e[64]=m):m=e[64];const p=h==="url"?"url":"text";let g;e[65]!==r?(g=_=>r(_.target.value),e[65]=r,e[66]=g):g=e[66];const x=s.default!=null?String(s.default):void 0;let b;e[67]!==i||e[68]!==d||e[69]!==p||e[70]!==g||e[71]!==x?(b=o.jsx(yt,{id:i,type:p,value:d,onChange:g,placeholder:x,className:"h-10"}),e[67]=i,e[68]=d,e[69]=p,e[70]=g,e[71]=x,e[72]=b):b=e[72];let v;return e[73]!==m||e[74]!==b?(v=o.jsxs("div",{className:"space-y-2",children:[m,b]}),e[73]=m,e[74]=b,e[75]=v):v=e[75],v}const Ase=/^[+-]?\d*\.?\d*(?:[eE][+-]?\d*)?$/,Ese=/^[+-]?\d*$/;function Rse(t,e){return(e?Ese:Ase).test(t)}function Dse(t){const e=U.c(16),{schema:s,value:n,onChange:r,path:i,label:a,sandbox:l}=t,c=typeof n=="number"?String(n):"",[d,h]=P.useState(c),[u,f]=P.useState(c);c!==u&&(f(c),d!==""&&c!==""&&Number(d)===Number(c)||h(c));const m=l?.virtualMcpId;let p;e[0]!==a||e[1]!==i||e[2]!==s.description||e[3]!==m?(p=o.jsx(zs,{htmlFor:i,label:a,description:s.description,virtualMcpId:m}),e[0]=a,e[1]=i,e[2]=s.description,e[3]=m,e[4]=p):p=e[4];const g=s.type==="integer"?"numeric":"decimal";let x;e[5]!==r||e[6]!==s.type?(x=_=>{const L=_.target.value,y=s.type==="integer";if(L!==""&&!Rse(L,y))return;h(L);const w=Number(L);r(L===""||Number.isNaN(w)?void 0:w)},e[5]=r,e[6]=s.type,e[7]=x):x=e[7];let b;e[8]!==i||e[9]!==d||e[10]!==g||e[11]!==x?(b=o.jsx(yt,{id:i,type:"text",inputMode:g,value:d,onChange:x,className:"h-10"}),e[8]=i,e[9]=d,e[10]=g,e[11]=x,e[12]=b):b=e[12];let v;return e[13]!==p||e[14]!==b?(v=o.jsxs("div",{className:"space-y-2",children:[p,b]}),e[13]=p,e[14]=b,e[15]=v):v=e[15],v}function Mse(t){const e=U.c(14),{value:s,onChange:n,path:r,label:i,schema:a,sandbox:l}=t,c=typeof s=="boolean"?s:!1,d=l?.virtualMcpId;let h;e[0]!==i||e[1]!==r||e[2]!==a.description||e[3]!==d?(h=o.jsx(zs,{htmlFor:r,label:i,description:a.description,virtualMcpId:d}),e[0]=i,e[1]=r,e[2]=a.description,e[3]=d,e[4]=h):h=e[4];let u;e[5]!==n?(u=p=>n(p),e[5]=n,e[6]=u):u=e[6];let f;e[7]!==c||e[8]!==r||e[9]!==u?(f=o.jsx(rr,{id:r,checked:c,onCheckedChange:u}),e[7]=c,e[8]=r,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==h||e[12]!==f?(m=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[h,f]}),e[11]=h,e[12]=f,e[13]=m):m=e[13],m}const J3="__enum_empty__",fk="__enum_clear__";function Z3(t){return t===""?J3:String(t)}function Ise(t,e){if(t===J3)return"";const s=e.find(n=>Z3(n)===t);return s!==void 0?s:t}function Ose(t,e){if(t!==fk)return Ise(t,e)}function $se(t,e){return t==null?e.some(s=>s==="")?J3:void 0:Z3(t)}function Bse(t){return t===""?"":String(t)}function zse(t){const e=U.c(39),{schema:s,value:n,onChange:r,path:i,label:a,required:l,sandbox:c}=t,d=ue();let h;e[0]!==s.enum?(h=s.enum??[],e[0]=s.enum,e[1]=h):h=e[1];const u=h;let f;e[2]!==u||e[3]!==n?(f=$se(n,u),e[2]=u,e[3]=n,e[4]=f):f=e[4];const m=f;let p;e[5]!==u||e[6]!==l?(p=!l&&!u.some(Use),e[5]=u,e[6]=l,e[7]=p):p=e[7];const g=p,x=c?.virtualMcpId;let b;e[8]!==a||e[9]!==i||e[10]!==s.description||e[11]!==x?(b=o.jsx(zs,{htmlFor:i,label:a,description:s.description,virtualMcpId:x}),e[8]=a,e[9]=i,e[10]=s.description,e[11]=x,e[12]=b):b=e[12];let v;e[13]!==r||e[14]!==u?(v=V=>r(Ose(V,u)),e[13]=r,e[14]=u,e[15]=v):v=e[15];let _;e[16]!==d?(_=d("sectionsEditor.enumField.selectPlaceholder"),e[16]=d,e[17]=_):_=e[17];let L;e[18]!==_?(L=o.jsx(js,{placeholder:_}),e[18]=_,e[19]=L):L=e[19];let y;e[20]!==i||e[21]!==L?(y=o.jsx(bs,{id:i,className:"h-10 w-full min-w-0",children:L}),e[20]=i,e[21]=L,e[22]=y):y=e[22];let w;e[23]!==g||e[24]!==d?(w=g&&o.jsx(It,{value:fk,className:"text-muted-foreground",children:d("sectionsEditor.enumField.clearOption")}),e[23]=g,e[24]=d,e[25]=w):w=e[25];let S;e[26]!==u?(S=u.map(Fse),e[26]=u,e[27]=S):S=e[27];let k;e[28]!==w||e[29]!==S?(k=o.jsxs(vs,{children:[w,S]}),e[28]=w,e[29]=S,e[30]=k):k=e[30];let j;e[31]!==m||e[32]!==k||e[33]!==v||e[34]!==y?(j=o.jsxs(xs,{value:m,onValueChange:v,children:[y,k]}),e[31]=m,e[32]=k,e[33]=v,e[34]=y,e[35]=j):j=e[35];let N;return e[36]!==j||e[37]!==b?(N=o.jsxs("div",{className:"space-y-2",children:[b,j]}),e[36]=j,e[37]=b,e[38]=N):N=e[38],N}function Fse(t){const e=Z3(t);return o.jsx(It,{value:e,children:Bse(t)},e)}function Use(t){return t===""}const mk={duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)",sideEffects:void 0};function pk(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;return Array.isArray(e.variants)?e:null}function du(t){return pk(t)?.variants?.[0]?.rule?.__resolveType===gd}function Mb(t){return{__resolveType:Zo,variants:[{value:t,rule:{__resolveType:gd}}]}}function gk(t){return du(t)?pk(t)?.variants?.[0]?.value:t}function Ec(t){return du(t)?gk(t):t}function ex(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Cs(e)){const n=t.section?.__resolveType;return typeof n=="string"?n:e}return e}function Hse(t){return t.includes("flags/multivariate")}function Kse(t){return ms(t)}function Wse(t){const e=t.title?_p(t.title)?.blockId:void 0;return e||(t.title&&!t.title.includes("/")?t.title:Lp(t.resolveType)??ms(t.resolveType))}function qse(t,e){const s=[...t],n=new Set(s.map(i=>i.resolveType)),r=(i,a)=>{!i||n.has(i)||(n.add(i),s.push({resolveType:i,title:a??Kse(i)}))};if(e.savedBlockKey&&r(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const i=ex(e.editorValue);i?.includes("/")&&r(i)}return s}function Gse(t,e,s){const n=e[0]?.resolveType??"";if(s)return s;if(!t||typeof t!="object"||Array.isArray(t))return n;const r=t,i=r.__resolveType;if(typeof i=="string"){if(ir(i)){const u=e.find(f=>f.resolveType===i);return u?u.resolveType:i}const d=e.find(u=>_b(u.resolveType,i));if(d)return d.resolveType;const h=e.find(u=>u.resolveType===i);if(h)return h.resolveType;if(i.includes("/"))return i}const a=typeof r.type=="string"?r.type:void 0;if(a){const d=e.find(h=>h.discriminatorValue===a||h.resolveType===a||_b(h.resolveType,a));if(d)return d.resolveType}let l=n,c=-1;for(const d of e){if(!d.schema?.properties)continue;const u=Object.keys(d.schema.properties).filter(f=>!f.startsWith("__")&&f!=="@type"&&f!=="action"&&f!=="alt").filter(f=>r[f]!==void 0).length;u>0&&u>c&&(c=u,l=d.resolveType)}return c>0,l}function Ib(t,e,s){if(!t||typeof t!="object"||Array.isArray(t))return s??null;const n=ex(t);if(!n)return s??null;if(!e)return n.includes("/")?null:s??null;const r=$n(n,e);return r||(n.includes("/")?null:s??null)}function Yse(t,e){if(!t?.properties||!e)return t??null;if(!(e in t.properties))return t;const s={...t.properties};return delete s[e],{...t,properties:s}}function xk(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!Cs(e.__resolveType))return null;const s=e.section;return!s||typeof s!="object"||Array.isArray(s)?null:s}function Qse(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t,n=ex(s);return n&&Hse(n)?Array.isArray(s.variants)&&s.variants.length>0:Object.keys(s).some(r=>!r.startsWith("__")&&r!=="@type")}function tx(t){if(typeof t=="string")return t;if(!t||typeof t!="object")return"";const e=t;if(Array.isArray(e.variants)){const s=e.variants,n=s.find(i=>i.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const r=s.find(i=>typeof i.value=="string");if(r)return r.value}return typeof e.src=="string"?e.src:typeof e.url=="string"?e.url:typeof e.value=="string"?e.value:""}const Xse=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Jse=5,Zse=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function Ob(t){const{start:e,end:s}=t,n=typeof e=="string"?e:"",r=typeof s=="string"?s:"";if(!n&&!r)return null;const i=c=>{if(!c)return null;const d=new Date(c);return Number.isNaN(d.getTime())?null:Zse.format(d)},a=i(n),l=i(r);return a&&l?`${a} → ${l}`:a?`From ${a}`:l?`Until ${l}`:null}function Zc(t,e=0){if(!t)return"Default";if(e>Jse)return"...";const s=t.__resolveType??"";if(["website/matchers/always.ts","$live/matchers/MatchAlways.ts"].includes(s)||s==="")return"Default";switch(s){case"website/matchers/never.ts":return"Hidden";case"website/matchers/device.ts":case"$live/matchers/MatchDevice.ts":{const{mobile:r,tablet:i,desktop:a,devices:l=[]}=t,c=[...l];return r&&c.push("Mobile"),i&&c.push("Tablet"),a&&c.push("Desktop"),c.length>0?c.map(Xse).join(" & "):ms(s)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return Ob(t)??ms(s);case"website/matchers/random.ts":case"$live/matchers/MatchRandom.ts":{const{traffic:r}=t;return typeof r=="number"?`${Math.ceil(r*100)}% of sessions`:ms(s)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:r,match:i}=t,a=[];return r&&a.push(r),i&&a.push(i),a.length>0?a.join(" - "):ms(s)}case"website/matchers/pathname.ts":{const r=t.case,{type:i,pathname:a}=r??{};return i&&a?`Pathname ${i} ${a}`:ms(s)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:r,excludeLocations:i}=t,a=d=>[d.city,d.regionCode,d.country].filter(Boolean).join(" - "),l=r?.[0];if(l){const d=(r?.length??0)-1;return`${a(l)}${d>0?` +${d}`:""}`}const c=i?.[0];if(c){const d=(i?.length??0)-1;return`Except ${a(c)}${d>0?` +${d}`:""}`}return"Any location"}case"website/matchers/multi.ts":case"$live/matchers/MatchMulti.ts":{const{matchers:r,op:i="AND"}=t;if(r&&r.length>0){const a=i==="OR"?"OR":"AND";return r.map(l=>Zc(l,e+1)).join(` ${a} `)}return ms(s)}default:{const r=Ob(t);return r||ms(s)||"Default"}}}function bk(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function vk(t,e){if(e.length===0)return 0;const s=bk(t);for(let i=0;i<e.length;i++){const a=e[i].discriminators;if(a&&Object.keys(a).length>0&&Object.entries(a).every(([c,d])=>s[c]===d))return i}let n=0,r=-1;for(let i=0;i<e.length;i++){const a=e[i],l=new Set(Object.keys(a.discriminators??{})),d=a.propertyKeys.filter(h=>!l.has(h)).filter(h=>s[h]!==void 0&&s[h]!==null&&s[h]!=="").length;d>r&&(r=d,n=i)}return n}function ene(t,e){const s=bk(t),n=new Set(e);return Object.fromEntries(Object.entries(s).filter(([r])=>!n.has(r)))}const tne="$live/matchers/MatchAlways.ts";function sne(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(r=>r.rule?.__resolveType===R3||r.rule?.__resolveType===tne)??e.find(r=>r.value!=null);if(n&&n.value!=null)return n.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function Np(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Np);const e=t;if(e.__resolveType){const s=sne(e);return s===void 0?t:Np(s)}return yk(e)}function yk(t){const e={};for(const[s,n]of Object.entries(t))e[s]=Np(n);return e}function nne(t,e){return e.split(".").reduce((s,n)=>{if(!(s==null||typeof s!="object"))return s[n]},t)}function _k(t){return t==null?"":Array.isArray(t)?t.map(_k).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function Lf(t,e){if(!t.includes("{"))return;const s=yk(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(r,i,a)=>{const l=(i??a??"").trim();return _k(nne(s,l))}).trim()||void 0}function rne(t){return t.replace(/<[^>]*>/g,"").trim()}function ine(t){return t.replace(/\{\{\{?[^{}]*\}?\}\}/g,"").replace(/\s+/g," ").trim()}function one(t){return/^Option \d+$/.test(t)}function ane(t,e){if(e.includes("{"))return Lf(e,t);const s=t[e];if(typeof s=="string"&&s)return s;if(Array.isArray(s)){const n=s.map(r=>r==null?"":String(r)).filter(Boolean).join(",");if(n)return n}}function Lk(t,e,s){if(typeof t=="string")return t.trim()?t:`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){let n=Ec(t);const r=xk(n);if(r&&(n=r,n=Ec(n)),s?.titleBy){const a=ane(n,s.titleBy);if(a)return a}if(s?.inlineUnionBranches?.length){const a=vk(n,s.inlineUnionBranches.map(c=>({discriminators:c.discriminators,propertyKeys:Object.keys(c.schema?.properties??{})}))),l=s.inlineUnionBranches[a]?.title;if(l&&!one(l)){const c=Lf(l,n);if(c)return c;if(!l.includes("{"))return l}}for(const a of["name","label","title","alt","text","href","id","key"]){const l=n[a];if(typeof l=="string"&&l.trim()){const c=s?.properties?.[a]?.format;if(c==="rich-text"||c==="html"){const d=rne(l);if(d)return d;continue}return l}if(Array.isArray(l)){const c=l.map(d=>d==null?"":String(d)).filter(Boolean).join(",");if(c)return c}}const i=n.__resolveType;if(typeof i=="string"&&i)return i.includes("/matchers/")?Zc(n):ms(i);if(s?.title){const a=Lf(s.title,n);if(a)return a;if(!s.title.includes("{"))return s.title}}return`Item ${e+1}`}function wf(t,e){return t.map((s,n)=>Lk(s,n,e))}function wk(t,e,s){return Lk(t,e,s)}function lne(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const s=e.properties;return s?.mobile?"{{{image.mobile}}}":s?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function $b(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const s=lne(e);if(!s)return;const n=Lf(s,t);if(!n)return;const r=tx(n)||n;return kE(r)}function sx(t){return t===so||t===Zo}function q9(t,e){if(!Object.hasOwn(e,t))return null;const s=e[t]??{},n=s.__resolveType??t;return{data:{...s},resolveType:n}}function Sf(t,e){const s=t.__resolveType??"";if(!s)return null;if(Cs(s)){const n=t.section??{};return Sk(n,e)}if(sx(s)){const n=t.variants?.[0]?.value;return n?Sf(n,e):null}return!ir(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:q9(s,e)}function Sk(t,e){const s=t.__resolveType??"";if(!s)return null;if(sx(s)){const n=t.variants?.[0]?.value;return n?Sf(n,e):null}return!ir(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:q9(s,e)}function kk(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t.__resolveType;if(typeof n!="string"||!ir(n)||!Object.hasOwn(e,n))return null;const r=q9(n,e);return r?{blockKey:n,...r}:null}function Oge(t,e){if(!e.isSavedBlock)return null;if(e.isHidden){const i=(Cs(t.__resolveType)?t.section:t)?.variants?.[0]?.value;if(!i)return null;const a=i.__resolveType??"";return Cs(a)?i.section?.__resolveType??a??null:a||null}return(e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType)||null}function cne(t,e,s){if(e.isMultivariate)return null;if(e.isSavedBlock&&!e.isHidden){const n=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return q9(n,s)}if(e.isHidden){const i=(Cs(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t,a=i.__resolveType??"",l=Cs(a)?i.section?.__resolveType??a:a;return sx(l)?null:Sf(i,s)}if(e.isLazy||Cs(t.__resolveType)){const n=t.section??{};return Sk(n,s)}return Sf(t,s)}function kn(t){return typeof t=="string"?t:t.label}function bd(t){return typeof t=="object"}function Bb(t){return bd(t)?t.arrayLabel:void 0}function zb(t){return bd(t)?t.fieldKey:void 0}function dne(t){return bd(t)?t.ownerPath:void 0}function Fb(t,e,s){return t!=null&&typeof t=="object"?{...t,label:e,itemIndex:s}:{label:e,itemIndex:s}}function Mu(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Wa(t){return t.normalize("NFC").trim()}function une(t,e){return e.length>0&&Wa(kn(e[0]))===Wa(t)?e:[t,...e]}function hne(t,e){return e.map(s=>{if(!bd(s))return s;const n=s.ownerPath??[];return n[0]===t?s:{...s,ownerPath:[t,...n]}})}function ts(t,e){return Wa(t)===Wa(e)}function kf(t,e){return Wa(t).replace(/\s+/g,"").toLowerCase()===Wa(e).replace(/\s+/g,"").toLowerCase()}function fne(t,e,s){return(s?.hasSiblingDrillDownFields??!1)||(s?.itemLabelFromSchema??!1)||ts(e,t)||s?.arrayKey!=null&&ts(e,s.arrayKey)}function ch(t,e,s,n,r){const i=Wa(s);if(t.some(l=>ts(kn(l),i)||ts(kn(l),s)))return t;const a={label:s,itemIndex:n};return fne(e,s,r)&&(a.arrayLabel=e),r?.arrayKey&&(a.fieldKey=r.arrayKey),[...t,a]}function mne(t,e){return t.slice(0,t.length-e.length)}function pne(t,e,s,n){if(s.length===0)return s;const r=s[0];if(bd(r))return s;const i=n??qa(t,e),a=kn(r);return ts(a,i)||ts(a,t)?s.slice(1):s}function qa(t,e){return e.title??Mu(t)}function Iu(t,e,s){const n=s[t];if(!n)return Mu(t);const r=qa(t,n);return e.some(a=>{if(a===t)return!1;const l=s[a];return l!=null&&qa(a,l)===r})?Mu(t):r}function $ge(t,e){return e.isMultivariateSectionTop?0:t-2}function Bge(t,e){return e<=0?[]:t.slice(0,e)}function Fc(t,e){return t.type==="array"&&t.items||H9(t)?!0:Array.isArray(e)}function jk(t,e=0){if(e>6||!t.properties)return!1;for(const s of Object.keys(t.properties)){const n=t.properties[s];if(n&&(Fc(n)||n.type==="object"&&jk(n,e+1)))return!0}return!1}function Ck(t,e=0){if(e>6||t==null||typeof t!="object")return!1;if(Array.isArray(t))return t.some(s=>s!=null&&typeof s=="object"&&!Array.isArray(s));for(const[s,n]of Object.entries(t))if(!s.startsWith("__")&&Ck(n,e+1))return!0;return!1}function gne(t,e,s={}){const n=t.filter(r=>{const i=e[r];if(!i)return!1;if(i.type==="object"&&jk(i))return!0;const a=s[r];return a!=null&&typeof a=="object"&&!Array.isArray(a)?Ck(a):!1});return n.length>1?new Set(n):new Set}function Ub(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function xne(t,e){if(t==null||typeof t!="object"||Array.isArray(t))return;const s=wk(t,e);return s===`Item ${e+1}`?void 0:s}function uu(t,e,s={n:4e3},n=0){if(n>4||s.n<=0||t==null||typeof t!="object")return!1;if(Array.isArray(t)){for(let r=0;r<t.length;r++){const i=t[r];if(--s.n<=0)return!1;const a=xne(i,r);if(a&&ts(a,e)||uu(i,e,s,n+1))return!0}return!1}for(const[r,i]of Object.entries(t))if(!r.startsWith("__")){if(--s.n<=0)return!1;if((Array.isArray(i)||i!=null&&typeof i=="object")&&(kf(Mu(r),e)||kf(r,e))||uu(i,e,s,n+1))return!0}return!1}function Vp(t,e,s,n=0){if(!s||n>4||t==null||typeof t!="object")return!1;const r=t.__resolveType;if(typeof r!="string"||!r)return!1;const i=$n(r,s)?.properties;if(!i)return!1;const a=Object.keys(i);for(const l of a){const c=i[l];if(!c)continue;if(Fc(c)){const h=Iu(l,a,i);if(ts(h,e)||ts(l,e))return!0}const d=t[l];if(d!=null&&typeof d=="object"&&!Array.isArray(d)&&Vp(d,e,s,n+1))return!0}return!1}function Va(t,e,s,n,r,i){if(n.length===0)return null;const a=kn(n[0]),l=zb(n[0]);if(l!=null)for(const b of t){const v=e[b];if(!(!v||!Fc(v,s[b]))&&b===l)return b}const c=n.flatMap(b=>dne(b)??[]);if(c.length>0){const b=t.filter(v=>e[v]?.type==="block-ref"&&c.includes(v));if(b.length===1)return b[0]}for(const b of t){const v=e[b];if(!v||!Fc(v,s[b]))continue;const _=Iu(b,t,e);if(ts(a,_)||ts(a,b)||n.some(L=>{if(ts(kn(L),_)||ts(kn(L),b))return!0;const y=Bb(L);return y!=null&&(ts(y,_)||ts(y,b))}))return b}for(const b of t){const v=e[b];if(!v||!Fc(v,s[b]))continue;const _=s[b];if(!Array.isArray(_))continue;if(wf(_,v.items).some(y=>ts(y,a)))return b}let d=null,h=!1,u=null,f=!1;for(const b of t){const v=e[b];if(v?.type!=="object"||!v.properties)continue;const _=Object.keys(v.properties),L=Ub(s[b]),y=Iu(b,t,e);if((ts(a,y)||ts(a,b))&&Va(_,v.properties,L,n.slice(1),r,i)!=null){d===null?d=b:h=!0;continue}Va(_,v.properties,L,n,r,i)!=null&&(u===null?u=b:f=!0)}if(d!==null)return h?null:d;if(u!==null)return f?null:u;for(const b of t){const v=e[b];if(v?.type!=="inline-union"||!v.inlineUnionBranches?.length)continue;const _=Ub(s[b]),L=qa(b,v);for(const y of v.inlineUnionBranches){const w=y.schema?.properties;if(!w)continue;const S=Object.keys(w);if(Va(S,w,_,n,r,i)||(ts(a,L)||ts(a,b))&&Va(S,w,_,n.slice(1),r,i))return b}}let m=null;const p=[],g=n.map(Bb).filter(b=>b!=null),x=n.map(zb).filter(b=>b!=null);for(const b of t){const v=e[b];if(v?.type!=="block-ref")continue;const _=qa(b,v);if(a!==_&&a!==b){const L=s[b],w=(r?kk(L,r):null)?.data??L;(uu(w,a)||x.some(S=>uu(w,S)||Vp(w,S,i))||g.some(S=>uu(w,S)||Vp(w,S,i)))&&p.push(b);continue}if(n.length>1){const L=s[b];if(L&&typeof L=="object"&&!Array.isArray(L)){const y=kn(n[1]);if(Object.keys(L).some(S=>!S.startsWith("__")&&(kf(Mu(S),y)||kf(S,y))))return b}}m||(m=b)}return m||(p.length===1?p[0]:(p.length>1,null))}function bne(t,e,s,n,r,i){return Va(t,e,s,n,r,i)}function vne(t,e,s,n,r,i,a){if(r.length===0||!s.properties)return!1;const l=Object.keys(s.properties);if(Va(l,s.properties,n,r,i,a))return!0;const c=kn(r[0]);return!ts(c,e)&&!ts(c,t)?!1:r.length>1||Va(l,s.properties,n,r.slice(1),i,a)!==null}function Hb(t,e,s,n,r){if(!bd(s))return-1;if(s.fieldKey!=null&&r!=null)return s.fieldKey!==r?-1:s.itemIndex>=0&&s.itemIndex<t.length?s.itemIndex:-1;const i=wf(t,e);if(s.itemIndex>=0&&s.itemIndex<t.length&&ts(i[s.itemIndex],s.label))return s.itemIndex;if(n!=null&&n===s.itemIndex&&n>=0&&n<t.length)return n;const a=n!=null?i[n]:void 0;return a!==void 0&&ts(a,s.label)?n:i.findIndex(l=>ts(l,s.label))}function yne(t,e,s,n,r,i){if(e.length===0)return null;for(let l=0;l<e.length;l++){const c=e[l],d=Hb(s,n,c,r,i);if(d>=0)return{index:d,innerPath:e.slice(l+1),crumbIndex:l}}const a=e.findIndex(l=>ts(kn(l),t));if(a>=0&&e.length>a+1){const l=e[a+1],c=Hb(s,n,l,r,i);if(c>=0)return{index:c,innerPath:e.slice(a+2),crumbIndex:a+1}}return null}function G1(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===so}function _ne(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(s=>G1(s.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(s=>G1(s.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(s=>G1(s.resolveType)):!1}function Lne(t,e){if(e==="global"||e==="sections"||H9(t))return!0;const s=t.type==="array"?t.items:void 0;return s?_ne(s):!1}function Kb(t){return Array.from({length:t},(e,s)=>({id:crypto.randomUUID(),index:s}))}function Nk(t){return t.map((e,s)=>({...e,index:s}))}function wne(t,e){if(e===t.length)return t;if(e<t.length)return Nk(t.slice(0,e));const s=Array.from({length:e-t.length},(n,r)=>({id:crypto.randomUUID(),index:t.length+r}));return[...t,...s]}function Sne(t,e){const s=t.findIndex(i=>i.index===e),n=t.map(i=>i.index>e?{...i,index:i.index+1}:i),r={id:crypto.randomUUID(),index:e+1};return s===-1?[...n,r]:[...n.slice(0,s+1),r,...n.slice(s+1)]}function kne(t,e){return t.filter(s=>s.index!==e).map(s=>s.index>e?{...s,index:s.index-1}:s)}const jne="w-6 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",Cne="w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-6 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-6 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",Nne="w-6 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100";function Wb(t,e){return le("h-6 shrink-0 overflow-hidden",e?jne:t?Nne:Cne)}function Vne(t){const e=U.c(8),{labelText:s,imageSrc:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(e9,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=r):r=e[0];let i;e[1]!==n?(i=n&&o.jsx("img",{src:n,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=n,e[2]=i):i=e[2];let a;e[3]!==s?(a=o.jsx("span",{className:"min-w-0 truncate",children:s}),e[3]=s,e[4]=a):a=e[4];let l;return e[5]!==i||e[6]!==a?(l=o.jsxs(o.Fragment,{children:[r,o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[i,a]})]}),e[5]=i,e[6]=a,e[7]=l):l=e[7],l}function Tne(t){const e=U.c(67),{sortableId:s,labelText:n,imageSrc:r,hidden:i,onToggleHidden:a,onOpen:l,onDuplicate:c,onRemove:d}=t,h=ue();let u;e[0]!==s?(u={id:s,animateLayoutChanges:Rne},e[0]=s,e[1]=u):u=e[1];const{attributes:f,listeners:m,setNodeRef:p,transform:g,isDragging:x}=i3(u);let b;e[2]!==g?(b=fi.Transform.toString(g?{...g,x:0}:null),e[2]=g,e[3]=b):b=e[3];const v=x?0:void 0;let _;e[4]!==b||e[5]!==v?(_={transform:b,opacity:v},e[4]=b,e[5]=v,e[6]=_):_=e[6];const L=_;let y;e[7]!==l?(y=G=>{(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),l())},e[7]=l,e[8]=y):y=e[8];const w=x?"cursor-grabbing":"cursor-pointer";let S;e[9]!==w?(S=le("group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground touch-none",w),e[9]=w,e[10]=S):S=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(e9,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=k):k=e[11];let j;e[12]!==r?(j=r&&o.jsx("img",{src:r,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=r,e[13]=j):j=e[13];const N=i&&"line-through opacity-50";let V;e[14]!==N?(V=le("min-w-0 flex-1 truncate text-sm",N),e[14]=N,e[15]=V):V=e[15];let C;e[16]!==n||e[17]!==V?(C=o.jsx("span",{className:V,children:n}),e[16]=n,e[17]=V,e[18]=C):C=e[18];let T;e[19]!==i||e[20]!==a||e[21]!==h?(T=a&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":h(i?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem"),className:le(Wb(i===!0,i===!0)),onClick:G=>{G.stopPropagation(),a()},onPointerDown:Ene,children:i?o.jsx(WA,{size:14}):o.jsx(o0,{size:14})})}),o.jsx(We,{side:"bottom",children:h(i?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem")})]}),e[19]=i,e[20]=a,e[21]=h,e[22]=T):T=e[22];let A;e[23]!==n||e[24]!==h?(A=h("sectionsEditor.arrayField.openActionsFor",{label:n}),e[23]=n,e[24]=h,e[25]=A):A=e[25];let R;e[26]!==i?(R=le(Wb(i===!0,!1),"data-[state=open]:ml-0 data-[state=open]:w-6 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]"),e[26]=i,e[27]=R):R=e[27];let E;e[28]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Rr,{size:14}),e[28]=E):E=e[28];let I;e[29]!==A||e[30]!==R?(I=o.jsx(Ut,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":A,className:R,onClick:Ane,onPointerDown:Pne,children:E})}),e[29]=A,e[30]=R,e[31]=I):I=e[31];let D;e[32]!==c?(D=G=>{G.stopPropagation(),c()},e[32]=c,e[33]=D):D=e[33];let O;e[34]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(bn,{size:14}),e[34]=O):O=e[34];let $;e[35]!==h?($=h("sectionsEditor.arrayField.duplicate"),e[35]=h,e[36]=$):$=e[36];let M;e[37]!==D||e[38]!==$?(M=o.jsxs(et,{onClick:D,children:[O,$]}),e[37]=D,e[38]=$,e[39]=M):M=e[39];let z;e[40]!==d?(z=G=>{G.stopPropagation(),d()},e[40]=d,e[41]=z):z=e[41];let F;e[42]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(rn,{size:14}),e[42]=F):F=e[42];let B;e[43]!==h?(B=h("sectionsEditor.arrayField.delete"),e[43]=h,e[44]=B):B=e[44];let H;e[45]!==z||e[46]!==B?(H=o.jsxs(et,{className:"text-destructive focus:text-destructive",onClick:z,children:[F,B]}),e[45]=z,e[46]=B,e[47]=H):H=e[47];let W;e[48]!==M||e[49]!==H?(W=o.jsxs(Ht,{align:"end",children:[M,H]}),e[48]=M,e[49]=H,e[50]=W):W=e[50];let K;e[51]!==I||e[52]!==W?(K=o.jsxs(Ft,{children:[I,W]}),e[51]=I,e[52]=W,e[53]=K):K=e[53];let q;return e[54]!==f||e[55]!==n||e[56]!==m||e[57]!==l||e[58]!==p||e[59]!==L||e[60]!==C||e[61]!==T||e[62]!==K||e[63]!==y||e[64]!==S||e[65]!==j?(q=o.jsxs("div",{ref:p,style:L,...f,...m,role:"button",tabIndex:0,onClick:l,onKeyDown:y,className:S,title:n,children:[k,j,C,T,K]}),e[54]=f,e[55]=n,e[56]=m,e[57]=l,e[58]=p,e[59]=L,e[60]=C,e[61]=T,e[62]=K,e[63]=y,e[64]=S,e[65]=j,e[66]=q):q=e[66],q}function Pne(t){return t.stopPropagation()}function Ane(t){return t.stopPropagation()}function Ene(t){return t.stopPropagation()}function Rne(){return!1}function Dne(t,e,s,n,r){if(e?.type==="object"&&e.properties&&Object.keys(e.properties).length>0||e?.type==="block-ref"&&e.anyOfRefs?.length)return e;if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const i=t.__resolveType;if(typeof i=="string"&&s){const a=$n(i,s);if(a?.properties&&Object.keys(a.properties).length>0)return a}}if(s&&n&&r){const a=$n(n,s)?.properties?.[r]?.items;if(a?.properties&&Object.keys(a.properties).length>0)return{...a,titleBy:a.titleBy??e?.titleBy}}return e}function Mne(t){const e=t.split(".").filter(s=>!/^\d+$/.test(s));return e[e.length-1]??t}function dh({schema:t,value:e,onChange:s,path:n,label:r,breadcrumbPath:i=[],onBreadcrumbChange:a,hasSiblingDrillDownFields:l,meta:c,decofile:d,onSaveReferencedBlock:h,containerResolveType:u,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}){const x=ue(),b=W9(g?.virtualMcpId),v=Array.isArray(e)?e:[],_=t.items,L=Mne(n),y={arrayKey:L,hasSiblingDrillDownFields:l,itemLabelFromSchema:!!(_?.titleBy||_?.inlineUnionBranches?.length)},w=Lne(t,L),S=!w&&_?.type==="object",[k,j]=P.useState(null),N=yne(r,i,v,_,k,L),V=N?.index??null;N===null?k!==null&&j(null):N.index!==k&&j(N.index);const[C,T]=P.useState(()=>Kb(v.length)),[A,R]=P.useState(null),[E,I]=P.useState(n),[D,O]=P.useState(v.length),$=P.useRef(!1),M=P.useRef(null);E!==n?(I(n),O(v.length),T(Kb(v.length)),j(null)):D!==v.length&&(O(v.length),T(Q=>wne(Q,v.length)));const z=(Q,de)=>wk(Ec(Q),de,_),F=Q=>{if($.current)return;const de=z(v[Q],Q);j(Q),a?.(ch(i,r,de,Q,y))},B=Q=>{const de=[...v,Q];s(de);const ae=de.length-1;j(ae);const re=z(Q,ae);a?.(ch(i,r,re,ae,y))},H=()=>{const Q=_?.type,de=_?.default!==void 0?_.default:Q==="object"?{}:Q==="block-ref"?(()=>{const Y=_?.anyOfRefs?.[0]?.resolveType;return typeof Y!="string"||cu(Y)?{}:{__resolveType:Y}})():Q==="number"||Q==="integer"?0:Q==="boolean"?!1:Q==="array"?[]:"",ae=[...v,de];s(ae);const re=ae.length-1;j(re);const ie=z(de,re);a?.(ch(i,r,ie,re,y))},W=()=>{if(w){if(!f){ye.error(x("sectionsEditor.arrayField.startPreviewServer"));return}if(p){p({append:B});return}ye.error(x("sectionsEditor.arrayField.sectionPickerNotAvailable"));return}H()},K=Q=>{const de=v[Q],ae=typeof structuredClone=="function"?structuredClone(de):JSON.parse(JSON.stringify(de??null)),re=[...v.slice(0,Q+1),ae,...v.slice(Q+1)];s(re),T(ie=>Sne(ie,Q))},q=Q=>{const de=v[Q],ae=[...v];ae[Q]=du(de)?gk(de):Mb(de),s(ae)},G=Q=>{s(v.filter((de,ae)=>ae!==Q)),T(de=>kne(de,Q))},te=(Q,de)=>{const ae=[...v];if(ae[Q]=du(v[Q])?Mb(de):de,s(ae),Q===V&&N){const re=z(v[Q],Q),ie=z(ae[Q],Q);if(M.current={path:n,index:Q,label:ie},re!==ie){const Y=[...i];Y[N.crumbIndex]=Fb(i[N.crumbIndex],ie,Q),a?.(Y)}}},X=Xg(Yc(p0,{activationConstraint:{distance:8}}),Yc(m0,{coordinateGetter:o3})),Z=C.map(Q=>Q.id),ee=Q=>{R(String(Q.active.id))},se=Q=>{R(null);const{active:de,over:ae}=Q;if(!ae||de.id===ae.id)return;const re=Z.indexOf(String(de.id)),ie=Z.indexOf(String(ae.id));re===-1||ie===-1||(T(Y=>Nk(Qc([...Y],re,ie))),s(Qc([...v],re,ie)),$.current=!0,requestAnimationFrame(()=>{$.current=!1}))},J=()=>{R(null)},oe=A?C.find(Q=>Q.id===A):null,ce=oe!=null?v[oe.index]:void 0,he=oe!=null&&ce!==void 0?wf(v,_)[oe.index]:null,ne=oe!=null&&ce!==void 0?$b(Ec(ce),_):void 0;if(V!==null&&V<v.length){const Q=Ec(v[V]),de=Dne(Q,_,c,u,L),ae=()=>{if(!N)return ch(i,r,z(Q,V),V,y);const re=i.slice(0,N.crumbIndex+1),ie=M.current,Y=ie?.path===n&&ie.index===V?ie.label:z(Q,V);return re[N.crumbIndex]=Fb(re[N.crumbIndex],Y,V),re};return o.jsx("div",{className:"min-w-0",children:de?.type==="object"&&de.properties?o.jsx(Hr,{schema:de,value:Q,onChange:re=>te(V,re),basePath:`${n}.${V}`,breadcrumbPath:N?.innerPath??[],onBreadcrumbChange:re=>{a?.([...ae(),...re])},meta:c,decofile:d,onSaveReferencedBlock:h,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}):de?Ga({schema:de,value:Q,onChange:re=>te(V,re),path:`${n}.${V}`,required:!0,label:de.title&&!de.title.includes("{{")?de.title:z(Q,V),breadcrumbPath:N?.innerPath??[],onBreadcrumbChange:re=>{a?.([...ae(),...re])},meta:c,decofile:d,onSaveReferencedBlock:h,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}):null})}return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[o.jsx(X3,{description:t.description,virtualMcpId:g?.virtualMcpId,children:o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:r})}),v.length>0&&o.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:v.length})]}),!b&&t.description&&o.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:t.description}),v.length>0&&o.jsx("div",{className:le(A&&"cursor-grabbing"),children:o.jsxs(t3,{sensors:X,collisionDetection:hL,onDragStart:ee,onDragEnd:se,onDragCancel:J,children:[o.jsx(r3,{items:Z,strategy:n3,children:o.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:(()=>{const Q=wf(v,_);return C.map(de=>{const ae=v[de.index];if(ae===void 0)return null;const re=Q[de.index]??z(ae,de.index),ie=$b(Ec(ae),_);return o.jsx(Tne,{sortableId:de.id,labelText:re,imageSrc:ie,hidden:du(ae),onToggleHidden:S?()=>q(de.index):void 0,onOpen:()=>F(de.index),onDuplicate:()=>K(de.index),onRemove:()=>G(de.index)},de.id)})})()})}),Wn.createPortal(o.jsx(s3,{dropAnimation:mk,children:he?o.jsx("div",{className:"flex min-w-0 items-center gap-2.5 rounded-lg border border-border/60 bg-background px-2 py-2.5 shadow-lg ring-1 ring-border/60",children:o.jsx(Vne,{labelText:he,imageSrc:ne})}):null}),document.body)]})}),o.jsxs("button",{type:"button",onClick:W,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30 disabled:pointer-events-none disabled:opacity-50",children:[o.jsx(Qt,{size:14}),x(w?"sectionsEditor.arrayField.addSection":"sectionsEditor.arrayField.addItem")]})]})}function Ine(t){const e=U.c(53),{schema:s,value:n,onChange:r,path:i,label:a,breadcrumbPath:l,onBreadcrumbChange:c,focused:d,meta:h,decofile:u,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}=t;let b;e[0]!==l?(b=l===void 0?[]:l,e[0]=l,e[1]=b):b=e[1];const v=b,[_,L]=P.useState(!1),y=W9(x?.virtualMcpId);let w;e[2]!==n?(w=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},e[2]=n,e[3]=w):w=e[3];const S=w;if(!s.properties)return null;let k;e[4]!==v||e[5]!==u||e[6]!==h||e[7]!==S||e[8]!==p||e[9]!==c||e[10]!==r||e[11]!==g||e[12]!==f||e[13]!==i||e[14]!==m||e[15]!==x||e[16]!==s?(k=o.jsx(Hr,{schema:s,value:S,onChange:r,basePath:i,breadcrumbPath:v,onBreadcrumbChange:c,meta:h,decofile:u,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}),e[4]=v,e[5]=u,e[6]=h,e[7]=S,e[8]=p,e[9]=c,e[10]=r,e[11]=g,e[12]=f,e[13]=i,e[14]=m,e[15]=x,e[16]=s,e[17]=k):k=e[17];const j=k;if(d)return j;let N;e[18]!==i?(N=i.split(".").pop()??i,e[18]=i,e[19]=N):N=e[19];const V=N;let C;e[20]!==v||e[21]!==u||e[22]!==V||e[23]!==a||e[24]!==h||e[25]!==S||e[26]!==s?(C=vne(V,a,s,S,v,u,h),e[20]=v,e[21]=u,e[22]=V,e[23]=a,e[24]=h,e[25]=S,e[26]=s,e[27]=C):C=e[27];const A=_||C,R=`${i}-fields`;let E;e[28]===Symbol.for("react.memo_cache_sentinel")?(E=()=>L(One),e[28]=E):E=e[28];let I;e[29]!==A?(I=o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:A?o.jsx(ds,{size:16}):o.jsx(Us,{size:16})}),e[29]=A,e[30]=I):I=e[30];const D=x?.virtualMcpId;let O;e[31]!==a?(O=o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:a}),e[31]=a,e[32]=O):O=e[32];let $;e[33]!==s.description||e[34]!==O||e[35]!==D?($=o.jsx(X3,{description:s.description,virtualMcpId:D,children:O}),e[33]=s.description,e[34]=O,e[35]=D,e[36]=$):$=e[36];let M;e[37]!==R||e[38]!==A||e[39]!==$||e[40]!==I?(M=o.jsxs("button",{type:"button","aria-expanded":A,"aria-controls":R,onClick:E,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[I,$]}),e[37]=R,e[38]=A,e[39]=$,e[40]=I,e[41]=M):M=e[41];let z;e[42]!==s.description||e[43]!==y?(z=!y&&s.description&&o.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:s.description}),e[42]=s.description,e[43]=y,e[44]=z):z=e[44];let F;e[45]!==R||e[46]!==j||e[47]!==A?(F=A&&o.jsx("div",{id:R,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:j}),e[45]=R,e[46]=j,e[47]=A,e[48]=F):F=e[48];let B;return e[49]!==M||e[50]!==z||e[51]!==F?(B=o.jsxs("div",{className:"min-w-0 space-y-2",children:[M,z,F]}),e[49]=M,e[50]=z,e[51]=F,e[52]=B):B=e[52],B}function One(t){return!t}function zge(t,e,s,n,r){const i={...t[e]};if(r.length>1){const a=i.sections,l=[...a?.variants??[]];l[n]&&(l[n]={...l[n],value:s}),i.sections={...a,variants:l}}else i.sections=s;return i}function Fge(t){return structuredClone(t)}function Uge(t){return!t.isSavedBlock&&!t.isMultivariate&&!t.isHidden}function Vk(t){const e=t.replace(/[^A-Za-z0-9_ -]/g,"").replace(/\s+/g," ").trim();return/^[A-Za-z]/.test(e)?e:e?`Block ${e}`:""}function nx(t,e){const s=t.trim();return s?s.includes("/")?"Block name cannot contain slashes.":Object.hasOwn(e,s)?"A block with this name already exists.":/^[A-Za-z][A-Za-z0-9_ -]*$/.test(s)?null:"Use letters, numbers, spaces, hyphens, or underscores. Must start with a letter.":"Block name is required."}function rx(t){const e=U.c(61),{open:s,onOpenChange:n,defaultBlockId:r,isPending:i,onSubmit:a}=t,l=r===void 0?"":r,c=i===void 0?!1:i,[d,h]=P.useState(l),[u,f]=P.useState(s);s!==u&&(f(s),s&&h(l));let m;e[0]!==c||e[1]!==n?(m=z=>{!z&&!c&&n(!1)},e[0]=c,e[1]=n,e[2]=m):m=e[2];const p=m;let g;e[3]!==d||e[4]!==c||e[5]!==a?(g=async z=>{z.preventDefault();const F=d.trim();!F||c||await a(F)},e[3]=d,e[4]=c,e[5]=a,e[6]=g):g=e[6];const x=g,b=ue();let v;e[7]!==b?(v=b("sectionsEditor.makeReusableModal.title"),e[7]=b,e[8]=v):v=e[8];let _;e[9]!==v?(_=o.jsx(qt,{children:v}),e[9]=v,e[10]=_):_=e[10];let L;e[11]!==b?(L=b("sectionsEditor.makeReusableModal.description"),e[11]=b,e[12]=L):L=e[12];let y;e[13]!==L?(y=o.jsx(In,{children:L}),e[13]=L,e[14]=y):y=e[14];let w;e[15]!==_||e[16]!==y?(w=o.jsxs(ls,{children:[_,y]}),e[15]=_,e[16]=y,e[17]=w):w=e[17];let S;e[18]!==b?(S=b("sectionsEditor.makeReusableModal.blockNameLabel"),e[18]=b,e[19]=S):S=e[19];let k;e[20]!==S?(k=o.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:S}),e[20]=S,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=z=>h(z.target.value),e[22]=j):j=e[22];let N;e[23]!==b?(N=b("sectionsEditor.makeReusableModal.blockNamePlaceholder"),e[23]=b,e[24]=N):N=e[24];let V;e[25]!==d||e[26]!==c||e[27]!==N?(V=o.jsx(yt,{id:"block-id",value:d,onChange:j,placeholder:N,autoFocus:!0,disabled:c}),e[25]=d,e[26]=c,e[27]=N,e[28]=V):V=e[28];let C;e[29]!==k||e[30]!==V?(C=o.jsxs("div",{className:"py-4 space-y-2",children:[k,V]}),e[29]=k,e[30]=V,e[31]=C):C=e[31];let T;e[32]!==n?(T=()=>n(!1),e[32]=n,e[33]=T):T=e[33];let A;e[34]!==b?(A=b("sectionsEditor.makeReusableModal.cancel"),e[34]=b,e[35]=A):A=e[35];let R;e[36]!==c||e[37]!==T||e[38]!==A?(R=o.jsx(me,{type:"button",variant:"outline",onClick:T,disabled:c,children:A}),e[36]=c,e[37]=T,e[38]=A,e[39]=R):R=e[39];let E;e[40]!==d||e[41]!==c?(E=!d.trim()||c,e[40]=d,e[41]=c,e[42]=E):E=e[42];let I;e[43]!==c||e[44]!==b?(I=c?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),b("sectionsEditor.makeReusableModal.saving")]}):b("sectionsEditor.makeReusableModal.save"),e[43]=c,e[44]=b,e[45]=I):I=e[45];let D;e[46]!==E||e[47]!==I?(D=o.jsx(me,{type:"submit",disabled:E,children:I}),e[46]=E,e[47]=I,e[48]=D):D=e[48];let O;e[49]!==R||e[50]!==D?(O=o.jsxs(Yn,{children:[R,D]}),e[49]=R,e[50]=D,e[51]=O):O=e[51];let $;e[52]!==x||e[53]!==C||e[54]!==O||e[55]!==w?($=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:x,children:[w,C,O]})}),e[52]=x,e[53]=C,e[54]=O,e[55]=w,e[56]=$):$=e[56];let M;return e[57]!==p||e[58]!==s||e[59]!==$?(M=o.jsx(zt,{open:s,onOpenChange:p,children:$}),e[57]=p,e[58]=s,e[59]=$,e[60]=M):M=e[60],M}function $ne(t){if(!t?.properties)return{};const e={};for(const[s,n]of Object.entries(t.properties))s.startsWith("__")||s==="@type"||(n.default!==void 0?e[s]=n.default:n.type==="boolean"?e[s]=!1:n.type==="string"?e[s]="":n.type==="number"||n.type==="integer"?e[s]=0:n.type==="object"&&(e[s]={}));return e}function Bne(t){const e=U.c(13),{blockKey:s}=t,n=ue();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Cn,{size:11}),e[0]=r):r=e[0];let i;e[1]!==n?(i=n("sectionsEditor.anyOfField.global"),e[1]=n,e[2]=i):i=e[2];let a;e[3]!==i?(a=o.jsx(Ke,{asChild:!0,children:o.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[r,i]})}),e[3]=i,e[4]=a):a=e[4];let l;e[5]!==s||e[6]!==n?(l=n("sectionsEditor.anyOfField.globalLoaderTooltip",{blockKey:s}),e[5]=s,e[6]=n,e[7]=l):l=e[7];let c;e[8]!==l?(c=o.jsx(We,{side:"top",className:"max-w-[260px]",children:l}),e[8]=l,e[9]=c):c=e[9];let d;return e[10]!==a||e[11]!==c?(d=o.jsxs(qe,{children:[a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12],d}function zne(t){const e=U.c(36),{path:s,open:n,onOpenChange:r,title:i,nested:a,nestedBlockRef:l,globalBlockKey:c,onDetach:d,onMakeGlobal:h}=t,u=ue(),f=`${s}-loader-config`,m=l&&"ml-1";let p;e[0]!==m?(p=le("rounded-lg border border-border/80 bg-muted/30",m),e[0]=m,e[1]=p):p=e[1];let g;e[2]!==r||e[3]!==n?(g=()=>r(!n),e[2]=r,e[3]=n,e[4]=g):g=e[4];let x;e[5]!==n?(x=o.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:n?o.jsx(ds,{size:16}):o.jsx(Us,{size:16})}),e[5]=n,e[6]=x):x=e[6];let b;e[7]!==i?(b=o.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:i}),e[7]=i,e[8]=b):b=e[8];let v;e[9]!==c?(v=c&&o.jsx(Bne,{blockKey:c}),e[9]=c,e[10]=v):v=e[10];let _;e[11]!==b||e[12]!==v?(_=o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,v]}),e[11]=b,e[12]=v,e[13]=_):_=e[13];let L;e[14]!==f||e[15]!==n||e[16]!==g||e[17]!==x||e[18]!==_?(L=o.jsxs("button",{type:"button","aria-expanded":n,"aria-controls":f,onClick:g,className:"flex min-w-0 flex-1 items-center gap-2 rounded-lg px-3 py-2.5 text-left",children:[x,_]}),e[14]=f,e[15]=n,e[16]=g,e[17]=x,e[18]=_,e[19]=L):L=e[19];let y;e[20]!==c||e[21]!==d||e[22]!==h||e[23]!==u?(y=(d||h)&&o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":u("sectionsEditor.anyOfField.loaderActions"),className:"h-7 w-7 shrink-0 text-muted-foreground",children:o.jsx(Rr,{size:16})})}),o.jsxs(Ht,{align:"end",className:"w-48",children:[c&&d&&o.jsxs(et,{onClick:d,children:[o.jsx(zi,{className:"h-4 w-4"}),u("sectionsEditor.anyOfField.detach")]}),!c&&h&&o.jsxs(et,{onClick:h,children:[o.jsx(Cn,{className:"h-4 w-4"}),u("sectionsEditor.anyOfField.makeGlobal")]})]})]}),e[20]=c,e[21]=d,e[22]=h,e[23]=u,e[24]=y):y=e[24];let w;e[25]!==L||e[26]!==y?(w=o.jsxs("div",{className:"group flex w-full min-w-0 items-center gap-1 rounded-lg pr-2 transition-colors hover:bg-accent/50",children:[L,y]}),e[25]=L,e[26]=y,e[27]=w):w=e[27];let S;e[28]!==f||e[29]!==a||e[30]!==n?(S=n&&o.jsx("div",{id:f,className:"border-t border-border/60 px-4 pb-4 pt-3",children:o.jsx("div",{className:"border-l border-border/80 pl-4",children:a})}),e[28]=f,e[29]=a,e[30]=n,e[31]=S):S=e[31];let k;return e[32]!==w||e[33]!==S||e[34]!==p?(k=o.jsxs("div",{className:p,children:[w,S]}),e[32]=w,e[33]=S,e[34]=p,e[35]=k):k=e[35],k}function qb(t){const e=U.c(42),{schema:s,value:n,onChange:r,path:i,label:a,breadcrumbPath:l,onBreadcrumbChange:c,meta:d,decofile:h,onSaveReferencedBlock:u,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}=t,g=ue(),x=(s.anyOfRefs??[]).filter(Hne),b=h&&n?kk(n,h):null,v=b?.data??n,_=b?null:xk(v),L=_??v,y=qse(x,{savedBlockKey:b?.blockKey,editorValue:v}),w=y.length>0?Gse(v,y,b?.blockKey):y[0]?.resolveType??"",k=s.type==="block-ref"&&y.some(Une);let j;e[0]!==a||e[1]!==i?(j=a??(i.includes(".")?i.split(".")[0]:i),e[0]=a,e[1]=i,e[2]=j):j=e[2];const N=j;let V;e[3]!==l?(V=l??[],e[3]=l,e[4]=V):V=e[4];const C=V,T=k&&C.length>0&&kn(C[0])===N,A=T?C.slice(1):C,R=T?X=>{c?.([N,...X])}:c,[E,I]=P.useState(w),[D,O]=P.useState(w);D!==w&&(O(w),I(w));const[$,M]=P.useState(()=>Qse(v,b?.blockKey)),[z,F]=P.useState(!1);if(y.length>0){const X=E||w;let Z;e[5]!==X?(Z=Pe=>Pe.resolveType===X,e[5]=X,e[6]=Z):Z=e[6];const ee=y.find(Z),se=Ib(v,d,ee?.schema),J=Yse(se??ee?.schema??null,s.discriminatorKey),oe=s.discriminatorKey,ce=Pe=>{I(Pe);const xe=y.find(rt=>rt.resolveType===Pe),Ne=Ib(v,d,xe?.schema),je=new Set(Object.keys((Ne??xe?.schema)?.properties??{})),we=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},Ce=Object.fromEntries(Object.entries(we).filter(rt=>{const[Ge]=rt;return je.has(Ge)})),Oe={...$ne(xe?.schema),...Ce};if(oe){const rt=xe?.discriminatorValue??Pe;r({...Oe,[oe]:rt});return}if(cu(Pe)){r(Oe);return}r({...Oe,__resolveType:Pe})};let he;e[7]!==X||e[8]!==oe||e[9]!==r?(he=Pe=>{if(oe||!cu(X)||Pe===null||typeof Pe!="object"||Array.isArray(Pe)){r(Pe);return}const{__resolveType:xe,...Ne}=Pe;r(Ne)},e[7]=X,e[8]=oe,e[9]=r,e[10]=he):he=e[10];const ne=he,Q=J?.properties?o.jsx(Hr,{schema:J,value:L,onChange:Pe=>{if(b&&u){u(b.blockKey,Pe);return}if(_){r({...v,section:Pe});return}ne(Pe)},basePath:i,breadcrumbPath:A,onBreadcrumbChange:R,meta:d,decofile:h,onSaveReferencedBlock:u,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}):null;if(k&&Q&&A.length>0){let Pe;return e[11]!==Q?(Pe=o.jsx("div",{className:"min-w-0",children:Q}),e[11]=Q,e[12]=Pe):Pe=e[12],Pe}let de;e[13]!==i?(de=i.includes("."),e[13]=i,e[14]=de):de=e[14];const ae=de,re=b?()=>{const{name:Pe,...xe}=b.data;r(xe)}:void 0,ie=!b&&!_&&!!u&&k&&!cu(X)&&X.includes("/"),Y=L&&typeof L=="object"&&!Array.isArray(L)?L:{},pe=Pe=>{if(!u)return;const xe=Pe.trim(),Ne=nx(xe,h??{});if(Ne){ye.error(Ne);return}u(xe,{...Y,__resolveType:X,name:xe}),r({__resolveType:xe}),F(!1),ye.success(g("sectionsEditor.anyOfField.globalBlockSaved",{name:xe}))},be=f?.virtualMcpId;let _e;e[15]!==a||e[16]!==i||e[17]!==s.description||e[18]!==be?(_e=o.jsx(zs,{htmlFor:i,label:a,description:s.description,virtualMcpId:be}),e[15]=a,e[16]=i,e[17]=s.description,e[18]=be,e[19]=_e):_e=e[19];let Le;e[20]!==g?(Le=g("sectionsEditor.anyOfField.selectPlaceholder"),e[20]=g,e[21]=Le):Le=e[21];let ke;e[22]!==Le?(ke=o.jsx(js,{placeholder:Le}),e[22]=Le,e[23]=ke):ke=e[23];let Ve;return e[24]!==i||e[25]!==ke?(Ve=o.jsx(bs,{id:i,className:"w-full min-w-0",children:ke}),e[24]=i,e[25]=ke,e[26]=Ve):Ve=e[26],o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[_e,o.jsxs(xs,{value:X||void 0,onValueChange:ce,children:[Ve,o.jsx(vs,{children:y.map(Fne)})]})]}),Q&&(k?o.jsx(zne,{path:i,open:$,onOpenChange:M,title:g(ae?"sectionsEditor.anyOfField.configuration":"sectionsEditor.anyOfField.loaderConfiguration"),nested:Q,nestedBlockRef:ae,globalBlockKey:b?.blockKey,onDetach:re,onMakeGlobal:ie?()=>F(!0):void 0}):Q),ie&&o.jsx(rx,{open:z,onOpenChange:F,defaultBlockId:Vk(ms(X)),onSubmit:pe})]})}if(s.anyOfRefs&&s.anyOfRefs.length>0)return null;const B=f?.virtualMcpId;let H;e[27]!==a||e[28]!==i||e[29]!==s.description||e[30]!==B?(H=o.jsx(zs,{htmlFor:i,label:a,description:s.description,virtualMcpId:B}),e[27]=a,e[28]=i,e[29]=s.description,e[30]=B,e[31]=H):H=e[31];const W=n!=null?String(n):"";let K;e[32]!==r?(K=X=>r(X.target.value),e[32]=r,e[33]=K):K=e[33];const q=s.description??"";let G;e[34]!==i||e[35]!==W||e[36]!==K||e[37]!==q?(G=o.jsx("input",{id:i,type:"text",value:W,onChange:K,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:q}),e[34]=i,e[35]=W,e[36]=K,e[37]=q,e[38]=G):G=e[38];let te;return e[39]!==H||e[40]!==G?(te=o.jsxs("div",{className:"space-y-1.5",children:[H,G]}),e[39]=H,e[40]=G,e[41]=te):te=e[41],te}function Fne(t){const e=Wse(t);return o.jsx(It,{value:t.resolveType,children:e},t.resolveType)}function Une(t){return t.resolveType.includes("/")&&!cu(t.resolveType)}function Hne(t){return t.resolveType!==""}const Y1=(t,e)=>t.match(new RegExp(`\\b${e}\\s*=\\s*"([^"]*)"`,"i"))?.[1];function Kne(t){const e={};if(typeof t!="string")return e;const s=/<symbol\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/symbol>/gi;for(const n of t.matchAll(s)){const r=n[1]??"",i=n[2]??"",a=Y1(r,"id");if(!a)continue;const l=Y1(r,"viewBox"),c=Y1(r,"fill"),d=['xmlns="http://www.w3.org/2000/svg"',l?`viewBox="${l}"`:"",c?`fill="${c}"`:""].filter(Boolean).join(" ");e[a]=`<svg ${d}>${i}</svg>`}return e}async function Wne(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch sprite sheet: ${e.status}`);return Kne(await e.text())}function qne(t){if(!Array.isArray(t))return[];const e=[];for(const s of t)if(typeof s=="string")e.push({value:s,label:s});else if(s&&typeof s=="object"&&"value"in s){const n=s;e.push({value:String(n.value),label:typeof n.label=="string"?n.label:String(n.value),image:typeof n.image=="string"?n.image:void 0,icon:typeof n.icon=="string"?n.icon:void 0})}return e}function Gne(t){if(!Array.isArray(t))return[];const e=[];for(const s of t)typeof s=="string"&&e.push({value:s,label:s});return e}function Yne(t,e){return t.length>0?t:e}function Qne(t,e){const s=e.trim().toLowerCase();return s?t.filter(n=>n.value.toLowerCase().includes(s)||(n.label??"").toLowerCase().includes(s)):t}function Xne({loaderPath:t,isIconSelect:e,enumFallbackCount:s,trimmedSearch:n,optionValues:r,optionsSettled:i}){return!!t&&!e&&s===0&&i&&n.length>0&&!r.includes(n)}function Tk(t,e){const n=`<style>${e?`svg{color:${e}}`:""}.fill-current{fill:currentColor}.stroke-current{stroke:currentColor}.text-current{color:currentColor}</style>`,r=t.replace(/(<svg[^>]*>)/i,`$1${n}`);return`data:image/svg+xml;utf8,${encodeURIComponent(r)}`}function Jne(){return getComputedStyle(document.documentElement).getPropertyValue("--foreground").trim()||void 0}function Zne(t,e){if(t.previewSrc)return t.previewSrc;if(t.image)return t.image;if(t.icon)return Tk(t.icon,e)}async function ere(t,e,s){const n={};s&&(n.term=s);const i=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,a=await fetch(i,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`Failed to fetch dynamic options: ${a.status}`);const l=await a.json();return qne(l)}function Gb(t){const e=U.c(9),{option:s,className:n,fg:r}=t;let i;e[0]!==r||e[1]!==s?(i=Zne(s,r),e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=i;if(!a)return null;const l=s.image?"rounded object-cover":"object-contain";let c;e[3]!==n||e[4]!==l?(c=le("shrink-0",l,n),e[3]=n,e[4]=l,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==c?(d=o.jsx("img",{src:a,alt:"",referrerPolicy:"no-referrer",className:c}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function tre(t){const e=U.c(53),{schema:s,value:n,onChange:r,path:i,label:a,sandbox:l}=t,c=ue(),d=s.options,h=l?.previewUrl,[u,f]=P.useState(!1),[m,p]=P.useState(""),[g,x]=P.useState(""),b=P.useRef(null);let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=ne=>{p(ne),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(ne)},300)},e[0]=v):v=e[0];const _=v,L=l?`${l.orgSlug}/${l.virtualMcpId}/${l.branch}`:"",y=typeof n=="string"?n:"",w=s.format==="icon-select";let S;e[1]!==g||e[2]!==d||e[3]!==L?(S=at.sandboxInvoke(L,`dynamic-options:${d??""}:${g}`),e[1]=g,e[2]=d,e[3]=L,e[4]=S):S=e[4];let k;e[5]!==g||e[6]!==d||e[7]!==h?(k=()=>ere(h,d,g||void 0),e[5]=g,e[6]=d,e[7]=h,e[8]=k):k=e[8];const j=!!h&&!!d&&(u||!!y);let N;e[9]!==S||e[10]!==k||e[11]!==j?(N={queryKey:S,queryFn:k,enabled:j,staleTime:6e4,retry:1},e[9]=S,e[10]=k,e[11]=j,e[12]=N):N=e[12];const V=Zt(N),C=V.data??[];let T;e[13]!==L?(T=at.sandboxSprite(L),e[13]=L,e[14]=T):T=e[14];let A;e[15]!==h||e[16]!==l?(A=()=>Wne(uS({orgSlug:l.orgSlug,virtualMcpId:l.virtualMcpId,branch:l.branch,threadId:l.threadId,previewUrl:h},"/sprites.svg")),e[15]=h,e[16]=l,e[17]=A):A=e[17];const R=w&&!!l&&(u||!!y)&&(!d||V.isFetched&&C.length===0);let E;e[18]!==T||e[19]!==A||e[20]!==R?(E={queryKey:T,queryFn:A,enabled:R,staleTime:3e5,retry:1},e[18]=T,e[19]=A,e[20]=R,e[21]=E):E=e[21];const I=Zt(E),D=Gne(s.enum),O=I.data??{},$=Jne(),M=Object.fromEntries(Object.entries(O).map(ne=>{const[Q,de]=ne;return[Q,Tk(de,$)]})),z=w&&Object.keys(M).length>0?D.map(ne=>({...ne,previewSrc:M[ne.value]})):D,F=Yne(C,z),B=Qne(F,m);let H;e[22]!==y?(H=ne=>ne.value===y,e[22]=y,e[23]=H):H=e[23];const W=F.find(H),K=m.trim(),q=V.isFetched&&!V.isFetching&&m===g,G=Xne({loaderPath:d,isIconSelect:w,enumFallbackCount:D.length,trimmedSearch:K,optionValues:F.map(sre),optionsSettled:q});if((!h||!d)&&D.length===0){const ne=l?.virtualMcpId;let Q;e[24]!==a||e[25]!==i||e[26]!==s.description||e[27]!==ne?(Q=o.jsx(zs,{htmlFor:i,label:a,description:s.description,virtualMcpId:ne}),e[24]=a,e[25]=i,e[26]=s.description,e[27]=ne,e[28]=Q):Q=e[28];let de;e[29]!==r?(de=ie=>r(ie.target.value),e[29]=r,e[30]=de):de=e[30];let ae;e[31]!==y||e[32]!==i||e[33]!==de?(ae=o.jsx(yt,{id:i,type:"text",value:y,onChange:de}),e[31]=y,e[32]=i,e[33]=de,e[34]=ae):ae=e[34];let re;return e[35]!==Q||e[36]!==ae?(re=o.jsxs("div",{className:"space-y-2",children:[Q,ae]}),e[35]=Q,e[36]=ae,e[37]=re):re=e[37],re}const X=l?.virtualMcpId;let Z;e[38]!==a||e[39]!==i||e[40]!==s.description||e[41]!==X?(Z=o.jsx(zs,{htmlFor:i,label:a,description:s.description,virtualMcpId:X}),e[38]=a,e[39]=i,e[40]=s.description,e[41]=X,e[42]=Z):Z=e[42];const ee=W?o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(Gb,{option:W,className:"h-6 w-6",fg:$}),o.jsx("span",{className:"truncate",children:W.label??W.value})]}):y?o.jsx("span",{className:"truncate",children:y}):o.jsx("span",{className:"text-muted-foreground",children:c("sectionsEditor.dynamicOptionsField.selectPlaceholder")});let se;e[43]===Symbol.for("react.memo_cache_sentinel")?(se=o.jsx(x9,{className:"size-4 shrink-0 opacity-50"}),e[43]=se):se=e[43];let J;e[44]!==u||e[45]!==ee?(J=o.jsx(gs,{asChild:!0,children:o.jsxs(me,{variant:"outline",role:"combobox","aria-expanded":u,className:"h-10 w-full justify-between font-normal",children:[ee,se]})}),e[44]=u,e[45]=ee,e[46]=J):J=e[46];let oe;e[47]===Symbol.for("react.memo_cache_sentinel")?(oe={width:"var(--radix-popover-trigger-width)"},e[47]=oe):oe=e[47];let ce;e[48]!==c?(ce=c("sectionsEditor.dynamicOptionsField.searchPlaceholder"),e[48]=c,e[49]=ce):ce=e[49];let he;return e[50]!==m||e[51]!==ce?(he=o.jsx(hr,{placeholder:ce,className:"h-9",value:m,onValueChange:_}),e[50]=m,e[51]=ce,e[52]=he):he=e[52],o.jsxs("div",{className:"space-y-2",children:[Z,o.jsxs(_s,{open:u,onOpenChange:f,children:[J,o.jsx(ys,{className:"p-0",style:oe,children:o.jsxs(zr,{shouldFilter:!1,children:[he,o.jsxs(fr,{children:[!G&&o.jsx(On,{children:V.isLoading?c("sectionsEditor.dynamicOptionsField.loading"):c("sectionsEditor.dynamicOptionsField.noResults")}),o.jsx(Es,{children:B.map(ne=>o.jsxs(as,{value:ne.value,className:"cursor-pointer",onSelect:()=>{r(ne.value===y?"":ne.value),f(!1)},children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(Gb,{option:ne,className:le(ne.image?"h-9 w-9":"h-6 w-6"),fg:$}),o.jsx("span",{className:"truncate",children:ne.label??ne.value})]}),o.jsx($t,{className:le("ml-auto size-4 shrink-0",y===ne.value?"opacity-100":"opacity-0")})]},ne.value))}),G&&o.jsx(Es,{children:o.jsx(as,{value:K,className:"cursor-pointer",onSelect:()=>{r(K),p(""),x(""),f(!1)},children:o.jsx("span",{className:"truncate",children:c("sectionsEditor.dynamicOptionsField.useValue",{value:K})})})})]})]})})]})]})}function sre(t){return t.value}function Pk(t){const e=U.c(17),{org:s}=Fe(),n=Ls();let r,i,a,l;e[0]!==s.id||e[1]!==t.configId||e[2]!==t.imageOnly||e[3]!==t.search?(i=t.search?.trim()||void 0,r=t.imageOnly??!1,l=d7,a=at.filePickerObjects(s.id,t.configId,i,r),e[0]=s.id,e[1]=t.configId,e[2]=t.imageOnly,e[3]=t.search,e[4]=r,e[5]=i,e[6]=a,e[7]=l):(r=e[4],i=e[5],a=e[6],l=e[7]);const c=t.enabled!==!1&&!!t.configId;let d;e[8]!==r||e[9]!==t.configId||e[10]!==i||e[11]!==n?(d=async u=>{const{pageParam:f}=u;return await n.call("FILE_OBJECTS_LIST",{configId:t.configId,cursor:f??void 0,search:i,imageOnly:r||void 0})},e[8]=r,e[9]=t.configId,e[10]=i,e[11]=n,e[12]=d):d=e[12];let h;return e[13]!==a||e[14]!==c||e[15]!==d?(h={queryKey:a,enabled:c,staleTime:3e4,initialPageParam:null,queryFn:d,getNextPageParam:nre},e[13]=a,e[14]=c,e[15]=d,e[16]=h):h=e[16],l(h)}function nre(t){return t.nextCursor??void 0}function G9(){const t=U.c(2),{org:e}=Fe();let s;return t[0]!==e?(s={mutationFn:async n=>{const r=n.file.type||"application/octet-stream",i=await fetch(`/api/${encodeURIComponent(e.slug)}/file-configs/${encodeURIComponent(n.configId)}/upload?filename=${encodeURIComponent(n.file.name)}`,{method:"POST",headers:{"Content-Type":r},body:n.file});if(!i.ok){const a=await i.text().catch(rre);let l=`${i.status} ${i.statusText}`;try{const c=JSON.parse(a);c.message&&(l=c.message)}catch{a&&(l=a.slice(0,200))}throw new Error(`Upload failed: ${l}`)}return await i.json()}},t[0]=e,t[1]=s):s=t[1],Rs(s)}function rre(){return""}function ire(){const t=U.c(8),{org:e}=Fe(),s=Ls(),n=Ns();let r;t[0]!==s?(r=l=>s.call("FILE_OBJECT_DELETE",l),t[0]=s,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=(l,c)=>{n.invalidateQueries({queryKey:at.filePickerObjectsByConfig(e.id,c.configId)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;return t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7],Rs(a)}function ix(t){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(t)}function Ak(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"file":t.slice(e+1).toLowerCase()}function jf(t){const e=t.split("/");return e[e.length-1]??t}function Ek(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}const Y9="file-picker:last-config-id";function Rk(t){const e=U.c(31),s=ue(),n=t.open,r=t.onOpenChange;let i;e[0]!==t.mode||e[1]!==s?(i=t.mode==="image"?s("filePicker.filePickerDialog.pickAnImage"):s("filePicker.filePickerDialog.pickAFile"),e[0]=t.mode,e[1]=s,e[2]=i):i=e[2];let a;e[3]!==i?(a=o.jsx(qt,{children:i}),e[3]=i,e[4]=a):a=e[4];let l;e[5]!==s?(l=s("filePicker.filePickerDialog.description"),e[5]=s,e[6]=l):l=e[6];let c;e[7]!==l?(c=o.jsx(In,{children:l}),e[7]=l,e[8]=c):c=e[8];let d;e[9]!==a||e[10]!==c?(d=o.jsxs(ls,{children:[a,c]}),e[9]=a,e[10]=c,e[11]=d):d=e[11];let h;e[12]!==s?(h=b=>{const{error:v}=b;return o.jsx(ore,{error:v??new Error(s("filePicker.filePickerDialog.failedToLoadBuckets"))})},e[12]=s,e[13]=h):h=e[13];let u;e[14]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(tn,{className:"h-64 w-full"}),e[14]=u):u=e[14];let f;e[15]!==t?(f=b=>{t.onSelect(b),t.onOpenChange(!1)},e[15]=t,e[16]=f):f=e[16];let m;e[17]!==t.lockedConfigId||e[18]!==t.mode||e[19]!==f?(m=o.jsx(P.Suspense,{fallback:u,children:o.jsx(are,{mode:t.mode,lockedConfigId:t.lockedConfigId,onSelect:f})}),e[17]=t.lockedConfigId,e[18]=t.mode,e[19]=f,e[20]=m):m=e[20];let p;e[21]!==m||e[22]!==h?(p=o.jsx(sn,{fallback:h,children:m}),e[21]=m,e[22]=h,e[23]=p):p=e[23];let g;e[24]!==p||e[25]!==d?(g=o.jsxs(Bt,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[d,p]}),e[24]=p,e[25]=d,e[26]=g):g=e[26];let x;return e[27]!==t.onOpenChange||e[28]!==t.open||e[29]!==g?(x=o.jsx(zt,{open:n,onOpenChange:r,children:g}),e[27]=t.onOpenChange,e[28]=t.open,e[29]=g,e[30]=x):x=e[30],x}function ore(t){const e=U.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(vn,{size:16}),e[0]=n):n=e[0];let r;return e[1]!==s.message?(r=o.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,o.jsx("span",{className:"text-sm font-medium",children:s.message})]}),e[1]=s.message,e[2]=r):r=e[2],r}function are(t){const e=U.c(32),{mode:s,lockedConfigId:n,onSelect:r}=t,i=c7();if(i.length===0){let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(dre,{}),e[0]=p):p=e[0],p}if(n){let p;if(e[1]!==i||e[2]!==n){let x;e[4]!==n?(x=b=>b.id===n,e[4]=n,e[5]=x):x=e[5],p=i.find(x),e[1]=i,e[2]=n,e[3]=p}else p=e[3];const g=p;if(g){let x;return e[6]!==g||e[7]!==s||e[8]!==r?(x=o.jsx(Q1,{config:g,mode:s,onSelect:r}),e[6]=g,e[7]=s,e[8]=r,e[9]=x):x=e[9],x}}if(i.length===1){const p=i[0];let g;return e[10]!==p||e[11]!==s||e[12]!==r?(g=o.jsx(Q1,{config:p,mode:s,onSelect:r}),e[10]=p,e[11]=s,e[12]=r,e[13]=g):g=e[13],g}let a;e[14]===Symbol.for("react.memo_cache_sentinel")?(a=typeof window<"u"?window.localStorage.getItem(Y9):null,e[14]=a):a=e[14];const l=a;let c;e[15]!==i?(c=i.find(p=>p.id===l)?.id??i[0].id,e[15]=i,e[16]=c):c=e[16];const d=c;let h;e[17]!==i?(h=i.map(lre),e[17]=i,e[18]=h):h=e[18];let u;e[19]!==h?(u=o.jsx(od,{className:"self-start",children:h}),e[19]=h,e[20]=u):u=e[20];let f;if(e[21]!==i||e[22]!==s||e[23]!==r){let p;e[25]!==s||e[26]!==r?(p=g=>o.jsx(Aa,{value:g.id,className:"min-h-0 flex-1 overflow-hidden flex flex-col",children:o.jsx(Q1,{config:g,mode:s,onSelect:r})},g.id),e[25]=s,e[26]=r,e[27]=p):p=e[27],f=i.map(p),e[21]=i,e[22]=s,e[23]=r,e[24]=f}else f=e[24];let m;return e[28]!==d||e[29]!==u||e[30]!==f?(m=o.jsxs(nl,{defaultValue:d,onValueChange:cre,className:"min-h-0 flex-1 flex flex-col",children:[u,f]}),e[28]=d,e[29]=u,e[30]=f,e[31]=m):m=e[31],m}function lre(t){return o.jsx(nr,{value:t.id,children:t.name},t.id)}function cre(t){typeof window<"u"&&window.localStorage.setItem(Y9,t)}function dre(){const t=U.c(12),e=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:o.jsx(Qn,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noBucketConfigured"),t[1]=e,t[2]=n):n=t[2];let r;t[3]!==n?(r=o.jsx("p",{className:"font-medium text-sm",children:n}),t[3]=n,t[4]=r):r=t[4];let i;t[5]!==e?(i=e("filePicker.filePickerDialog.noBucketDescription"),t[5]=e,t[6]=i):i=t[6];let a;t[7]!==i?(a=o.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:i}),t[7]=i,t[8]=a):a=t[8];let l;return t[9]!==r||t[10]!==a?(l=o.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[s,o.jsxs("div",{children:[r,a]})]}),t[9]=r,t[10]=a,t[11]=l):l=t[11],l}function Q1({config:t,mode:e,onSelect:s}){const n=ue(),[r,i]=P.useState(""),a=y9(r,300),l=Pk({configId:t.id,search:a,imageOnly:e==="image"}),c=G9(),[d,h]=P.useState(!1),u=P.useRef(null),f=e==="image"?"image/*":void 0;async function m(S){if(!S)return;const k=Array.from(S);if(k.length===0)return;let j=null;const N=[];for(const V of k)try{const C=await c.mutateAsync({configId:t.id,file:V});j??=C.publicUrl}catch(C){N.push(`${V.name} (${C instanceof Error?C.message:"upload failed"})`)}await l.refetch(),N.length>0&&ye.error(N.length===k.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:N.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:N.join("; ")})),j&&s(j)}function p(S){S.preventDefault(),h(!0)}function g(){h(!1)}function x(S){S.preventDefault(),S.stopPropagation(),h(!1),m(S.dataTransfer.files)}const v=(l.data?.pages??[]).flatMap(S=>S.items),_=v.filter(S=>e==="image"?ix(S.key):!0),L=a.trim(),y=v.length>0||r.trim().length>0,w=r!==a||l.isFetching&&!l.isFetchingNextPage;return o.jsxs("div",{className:"flex flex-col gap-3 min-h-0 flex-1",children:[o.jsxs("button",{type:"button",onClick:()=>u.current?.click(),onDragOver:p,onDragLeave:g,onDrop:x,className:le("rounded-xl border border-dashed border-border/60 p-6 flex flex-col items-center justify-center gap-2 text-center transition-colors",d&&"border-primary bg-primary/5",c.isPending&&"opacity-60 pointer-events-none"),children:[o.jsx(Qn,{size:18,className:"text-muted-foreground"}),o.jsx("p",{className:"text-sm font-medium",children:c.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick")}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("filePicker.filePickerDialog.uploadSizeLimit")," ",n(e==="image"?"filePicker.filePickerDialog.imagesOnlyTypes":"filePicker.filePickerDialog.commonMediaTypes")]}),o.jsx("input",{ref:u,type:"file",accept:f,multiple:!0,className:"hidden",onChange:S=>{const k=Array.from(S.target.files??[]);S.target.value="",m(k)}})]}),y?o.jsx(p9,{value:r,onChange:i,isSearching:w,placeholder:n(e==="image"?"filePicker.filePickerDialog.searchImagesPlaceholder":"filePicker.filePickerDialog.searchFilesPlaceholder"),className:"shrink-0"}):null,o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[_.length===0?L?o.jsx(fre,{query:L}):e==="image"&&v.length>0?o.jsx(hre,{}):o.jsx(ure,{}):e==="image"?o.jsx(mre,{items:_,onSelect:s}):o.jsx(pre,{items:_,onSelect:s}),l.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(me,{type:"button",variant:"outline",size:"sm",disabled:l.isFetchingNextPage,onClick:()=>l.fetchNextPage(),children:l.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})})]})]})}function ure(){const t=U.c(12),e=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(ar,{size:18,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noFilesYet"),t[1]=e,t[2]=n):n=t[2];let r;t[3]!==n?(r=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=r):r=t[4];let i;t[5]!==e?(i=e("filePicker.filePickerDialog.dropFileToGetStarted"),t[5]=e,t[6]=i):i=t[6];let a;t[7]!==i?(a=o.jsx("p",{className:"text-xs text-muted-foreground",children:i}),t[7]=i,t[8]=a):a=t[8];let l;return t[9]!==r||t[10]!==a?(l=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[s,r,a]}),t[9]=r,t[10]=a,t[11]=l):l=t[11],l}function hre(){const t=U.c(12),e=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(ar,{size:18,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noImagesYet"),t[1]=e,t[2]=n):n=t[2];let r;t[3]!==n?(r=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=r):r=t[4];let i;t[5]!==e?(i=e("filePicker.filePickerDialog.noImagesFormatDesc"),t[5]=e,t[6]=i):i=t[6];let a;t[7]!==i?(a=o.jsx("p",{className:"text-xs text-muted-foreground",children:i}),t[7]=i,t[8]=a):a=t[8];let l;return t[9]!==r||t[10]!==a?(l=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[s,r,a]}),t[9]=r,t[10]=a,t[11]=l):l=t[11],l}function fre(t){const e=U.c(13),{query:s}=t,n=ue();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(ar,{size:18,className:"text-muted-foreground"})}),e[0]=r):r=e[0];let i;e[1]!==s||e[2]!==n?(i=n("filePicker.filePickerDialog.noMatches",{query:s}),e[1]=s,e[2]=n,e[3]=i):i=e[3];let a;e[4]!==i?(a=o.jsx("p",{className:"text-sm font-medium",children:i}),e[4]=i,e[5]=a):a=e[5];let l;e[6]!==n?(l=n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore"),e[6]=n,e[7]=l):l=e[7];let c;e[8]!==l?(c=o.jsx("p",{className:"text-xs text-muted-foreground",children:l}),e[8]=l,e[9]=c):c=e[9];let d;return e[10]!==a||e[11]!==c?(d=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[r,a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12],d}function mre(t){const e=U.c(7),{items:s,onSelect:n}=t;let r;if(e[0]!==s||e[1]!==n){let a;e[3]!==n?(a=l=>o.jsx(Dk,{item:l,variant:"image",onSelect:n},l.key),e[3]=n,e[4]=a):a=e[4],r=s.map(a),e[0]=s,e[1]=n,e[2]=r}else r=e[2];let i;return e[5]!==r?(i=o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:r}),e[5]=r,e[6]=i):i=e[6],i}function pre(t){const e=U.c(7),{items:s,onSelect:n}=t;let r;if(e[0]!==s||e[1]!==n){let a;e[3]!==n?(a=l=>o.jsx("li",{children:o.jsx(Dk,{item:l,variant:"row",onSelect:n})},l.key),e[3]=n,e[4]=a):a=e[4],r=s.map(a),e[0]=s,e[1]=n,e[2]=r}else r=e[2];let i;return e[5]!==r?(i=o.jsx("ul",{className:"divide-y divide-border/60 rounded-lg border border-border/60",children:r}),e[5]=r,e[6]=i):i=e[6],i}function Dk(t){const e=U.c(58),{item:s,variant:n,onSelect:r}=t;let i;e[0]!==s.key?(i=Ak(s.key),e[0]=s.key,e[1]=i):i=e[1];const a=i;if(n==="image"){let _;e[2]!==s.publicUrl||e[3]!==r?(_=()=>r(s.publicUrl),e[2]=s.publicUrl,e[3]=r,e[4]=_):_=e[4];let L;e[5]!==s.key||e[6]!==s.publicUrl?(L=o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"h-full w-full object-cover",onError:gre}),e[5]=s.key,e[6]=s.publicUrl,e[7]=L):L=e[7];let y;e[8]!==s.key||e[9]!==_||e[10]!==L?(y=o.jsx("button",{type:"button",onClick:_,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:s.key,children:L}),e[8]=s.key,e[9]=_,e[10]=L,e[11]=y):y=e[11];let w;e[12]!==a?(w=o.jsx("span",{className:"pointer-events-none absolute left-1.5 top-1.5 rounded bg-background/80 px-1.5 py-0.5 text-[10px] font-medium uppercase text-foreground opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100",children:a}),e[12]=a,e[13]=w):w=e[13];let S;e[14]!==s||e[15]!==r?(S=o.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx(Yb,{item:s,onSelect:r})}),e[14]=s,e[15]=r,e[16]=S):S=e[16];let k;e[17]!==s.key?(k=jf(s.key),e[17]=s.key,e[18]=k):k=e[18];let j;e[19]!==k?(j=o.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent p-2 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx("p",{className:"truncate text-xs text-white",children:k})}),e[19]=k,e[20]=j):j=e[20];let N;return e[21]!==y||e[22]!==w||e[23]!==S||e[24]!==j?(N=o.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[y,w,S,j]}),e[21]=y,e[22]=w,e[23]=S,e[24]=j,e[25]=N):N=e[25],N}let l;e[26]!==s.publicUrl||e[27]!==r?(l=()=>r(s.publicUrl),e[26]=s.publicUrl,e[27]=r,e[28]=l):l=e[28];let c;e[29]!==s.key?(c=o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:ix(s.key)?o.jsx(ar,{size:16,className:"text-muted-foreground"}):o.jsx(Mr,{size:16,className:"text-muted-foreground"})}),e[29]=s.key,e[30]=c):c=e[30];let d;e[31]!==s.key?(d=jf(s.key),e[31]=s.key,e[32]=d):d=e[32];let h;e[33]!==d?(h=o.jsx("p",{className:"truncate text-sm font-medium",children:d}),e[33]=d,e[34]=h):h=e[34];let u;e[35]!==s.key?(u=o.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:s.key}),e[35]=s.key,e[36]=u):u=e[36];let f;e[37]!==h||e[38]!==u?(f=o.jsxs("div",{className:"min-w-0 flex-1",children:[h,u]}),e[37]=h,e[38]=u,e[39]=f):f=e[39];let m;e[40]!==a?(m=o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:a}),e[40]=a,e[41]=m):m=e[41];let p;e[42]!==s.size?(p=Ek(s.size),e[42]=s.size,e[43]=p):p=e[43];let g;e[44]!==p?(g=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:p}),e[44]=p,e[45]=g):g=e[45];let x;e[46]!==g||e[47]!==l||e[48]!==c||e[49]!==f||e[50]!==m?(x=o.jsxs("button",{type:"button",onClick:l,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[c,f,m,g]}),e[46]=g,e[47]=l,e[48]=c,e[49]=f,e[50]=m,e[51]=x):x=e[51];let b;e[52]!==s||e[53]!==r?(b=o.jsx(Yb,{item:s,onSelect:r}),e[52]=s,e[53]=r,e[54]=b):b=e[54];let v;return e[55]!==x||e[56]!==b?(v=o.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2 transition hover:bg-muted/50",children:[x,b]}),e[55]=x,e[56]=b,e[57]=v):v=e[57],v}function gre(t){t.target.style.display="none"}function Yb(t){const e=U.c(39),{item:s,onSelect:n}=t,r=ue(),[i,a]=P.useState(!1);let l;e[0]!==s.publicUrl||e[1]!==r?(l=async function(N){N.preventDefault(),N.stopPropagation();try{await navigator.clipboard.writeText(s.publicUrl),a(!0),window.setTimeout(()=>a(!1),1500)}catch{ye.error(r("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=r,e[2]=l):l=e[2];const c=l;let d;e[3]!==r?(d=r("filePicker.filePickerDialog.assetActions"),e[3]=r,e[4]=d):d=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(v9,{size:14}),e[5]=h):h=e[5];let u;e[6]!==d?(u=o.jsx(Ut,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:vre,"aria-label":d,children:h})}),e[6]=d,e[7]=u):u=e[7];let f;e[8]!==s.publicUrl||e[9]!==n?(f=()=>n(s.publicUrl),e[8]=s.publicUrl,e[9]=n,e[10]=f):f=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx($t,{size:14}),e[11]=m):m=e[11];let p;e[12]!==r?(p=r("filePicker.filePickerDialog.useThis"),e[12]=r,e[13]=p):p=e[13];let g;e[14]!==f||e[15]!==p?(g=o.jsxs(et,{onClick:f,children:[m,p]}),e[14]=f,e[15]=p,e[16]=g):g=e[16];let x;e[17]!==i?(x=i?o.jsx($t,{size:14}):o.jsx(bn,{size:14}),e[17]=i,e[18]=x):x=e[18];let b;e[19]!==i||e[20]!==r?(b=r(i?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[19]=i,e[20]=r,e[21]=b):b=e[21];let v;e[22]!==c||e[23]!==b||e[24]!==x?(v=o.jsxs(et,{onClick:c,children:[x,b]}),e[22]=c,e[23]=b,e[24]=x,e[25]=v):v=e[25];const _=s.publicUrl;let L;e[26]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(fn,{size:14}),e[26]=L):L=e[26];let y;e[27]!==r?(y=r("filePicker.filePickerDialog.openInNewTab"),e[27]=r,e[28]=y):y=e[28];let w;e[29]!==s.publicUrl||e[30]!==y?(w=o.jsx(et,{asChild:!0,children:o.jsxs("a",{href:_,target:"_blank",rel:"noreferrer",onClick:xre,children:[L,y]})}),e[29]=s.publicUrl,e[30]=y,e[31]=w):w=e[31];let S;e[32]!==v||e[33]!==w||e[34]!==g?(S=o.jsxs(Ht,{align:"end",onClick:bre,children:[g,v,w]}),e[32]=v,e[33]=w,e[34]=g,e[35]=S):S=e[35];let k;return e[36]!==S||e[37]!==u?(k=o.jsxs(Ft,{children:[u,S]}),e[36]=S,e[37]=u,e[38]=k):k=e[38],k}function xre(t){return t.stopPropagation()}function bre(t){return t.stopPropagation()}function vre(t){return t.stopPropagation()}function Mk(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:o.jsxs("span",{className:"flex items-center gap-1.5 rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:[o.jsx(Qn,{size:14}),"Click to replace"]})}),t[0]=e):e=t[0],e}function Ik(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function Ok(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}const yre=["low","medium","high","original"];function $k(t){return t==="low"||t==="medium"||t==="high"||t==="original"}function Bk(t,e){try{return new URL(t).searchParams.get(e)}catch{const s=_re(t);for(const n of s){const r=n.indexOf("=");if((r>=0?n.slice(0,r):n)===e)return r>=0?n.slice(r+1):""}return null}}function zk(t,e,s){const n=t.indexOf("#"),r=n>=0?t.slice(n):"",i=n>=0?t.slice(0,n):t,a=i.indexOf("?"),l=a>=0?i.slice(0,a):i,c=(a>=0?i.slice(a+1).split("&"):[]).filter(Boolean).filter(d=>{const h=d.indexOf("=");return(h>=0?d.slice(0,h):d)!==e});return s!==void 0&&c.push(`${e}=${s}`),`${l}${c.length?`?${c.join("&")}`:""}${r}`}function _re(t){const e=t.indexOf("#"),s=e>=0?t.slice(0,e):t,n=s.indexOf("?");return n<0?[]:s.slice(n+1).split("&").filter(Boolean)}function Lre(t){if(!t)return;const e=Bk(t,"quality");return $k(e)?e:void 0}function wre(t,e){return zk(t,"quality",e)}function Sre(t){return t?Bk(t,"muted")!=="false":!0}function kre(t,e){return zk(t,"muted",e?void 0:"false")}function Fk(t){const e=U.c(36),{value:s,onChange:n,showMuted:r}=t,i=r===void 0?!1:r,a=ue(),l=P.useId();let c;e[0]!==s?(c=Lre(s),e[0]=s,e[1]=c):c=e[1];const d=c;let h;e[2]!==s?(h=Sre(s),e[2]=s,e[3]=h):h=e[3];const u=h;let f;e[4]!==a?(f=a("sectionsEditor.mediaTransformControls.mediaOptionsLabel"),e[4]=a,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(v9,{size:14}),e[6]=m):m=e[6];let p;e[7]!==f?(p=o.jsx(gs,{asChild:!0,children:o.jsx(me,{type:"button",variant:"outline",size:"sm",className:"h-9 shrink-0","aria-label":f,children:m})}),e[7]=f,e[8]=p):p=e[8];let g;e[9]!==a?(g=a("sectionsEditor.mediaTransformControls.qualityLabel"),e[9]=a,e[10]=g):g=e[10];let x;e[11]!==g?(x=o.jsx(At,{className:"text-xs text-muted-foreground",children:g}),e[11]=g,e[12]=x):x=e[12];const b=d??"";let v;e[13]!==n||e[14]!==s?(v=j=>n(wre(s,$k(j)?j:void 0)),e[13]=n,e[14]=s,e[15]=v):v=e[15];let _;e[16]===Symbol.for("react.memo_cache_sentinel")?(_=yre.map(jre),e[16]=_):_=e[16];let L;e[17]!==v||e[18]!==b?(L=o.jsx(r9,{type:"single",variant:"outline",size:"sm",value:b,onValueChange:v,children:_}),e[17]=v,e[18]=b,e[19]=L):L=e[19];let y;e[20]!==L||e[21]!==x?(y=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[x,L]}),e[20]=L,e[21]=x,e[22]=y):y=e[22];let w;e[23]!==u||e[24]!==l||e[25]!==n||e[26]!==i||e[27]!==a||e[28]!==s?(w=i&&o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx(At,{htmlFor:l,className:"text-xs text-muted-foreground",children:a("sectionsEditor.mediaTransformControls.mutedLabel")}),o.jsx(rr,{id:l,checked:u,onCheckedChange:j=>n(kre(s,j))})]}),e[23]=u,e[24]=l,e[25]=n,e[26]=i,e[27]=a,e[28]=s,e[29]=w):w=e[29];let S;e[30]!==y||e[31]!==w?(S=o.jsx(ys,{align:"end",className:"w-auto min-w-52 p-3",children:o.jsxs("div",{className:"flex flex-col gap-3",children:[y,w]})}),e[30]=y,e[31]=w,e[32]=S):S=e[32];let k;return e[33]!==S||e[34]!==p?(k=o.jsxs(_s,{children:[p,S]}),e[33]=S,e[34]=p,e[35]=k):k=e[35],k}function jre(t){return o.jsx(Kc,{value:t,className:"h-8 px-3 text-xs capitalize",children:t},t)}function Uk(t,e,s){return e||(t.length===1?t[0].id:t.length===0?null:t.some(n=>n.id===s)?s:null)}function Qb(t){const e=U.c(2),{ext:s}=t;if(!s)return null;let n;return e[0]!==s?(n=o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Cre(t){const e=U.c(81),{schema:s,value:n,onChange:r,path:i,label:a,sandbox:l}=t,c=ue(),d=s.format==="video-uri",h=tx(n),[u,f]=P.useState(!1),[m,p]=P.useState(!1),g=h?Ik(h):"",x=g?Ok(g):"",b=kg(),v=G9();let _;e[0]!==b.data?.configs?(_=b.data?.configs??[],e[0]=b.data?.configs,e[1]=_):_=e[1];const L=l?.siteSlug;let y;e[2]!==_||e[3]!==L?(y=o9(_,L),e[2]=_,e[3]=L,e[4]=y):y=e[4];const w=y;let S;e[5]!==b.data?.configs||e[6]!==d||e[7]!==w?.id||e[8]!==r||e[9]!==f||e[10]!==c||e[11]!==v?(S=async function(se){if(!se)return;let J=Array.from(se);if(J.length===0)return;if(d&&(J=J.filter(Nre),J.length===0)){ye.error(c("sectionsEditor.fileField.videoFileError"));return}const oe=Uk(b.data?.configs??[],w?.id,typeof window<"u"?window.localStorage.getItem(Y9):null);if(!oe){f(!0);return}try{const ce=await v.mutateAsync({configId:oe,file:J[0]});r(ce.publicUrl),J.length>1&&ye.info(c("sectionsEditor.fileField.multiFileWarning",{fileName:J[0].name}))}catch(ce){const he=ce;ye.error(he instanceof Error?he.message:c("sectionsEditor.fileField.uploadFailed"))}},e[5]=b.data?.configs,e[6]=d,e[7]=w?.id,e[8]=r,e[9]=f,e[10]=c,e[11]=v,e[12]=S):S=e[12];const k=S;let j;e[13]!==p?(j=function(se){se.preventDefault(),se.dataTransfer.types.includes("Files")&&p(!0)},e[13]=p,e[14]=j):j=e[14];const N=j;let V;e[15]!==p?(V=function(se){se.currentTarget===se.target&&p(!1)},e[15]=p,e[16]=V):V=e[16];const C=V;let T;e[17]!==k||e[18]!==p?(T=function(se){se.preventDefault(),se.stopPropagation(),p(!1),k(se.dataTransfer.files)},e[17]=k,e[18]=p,e[19]=T):T=e[19];const A=T,R=l?.virtualMcpId;let E;e[20]!==a||e[21]!==i||e[22]!==s.description||e[23]!==R?(E=o.jsx("div",{className:"min-w-0",children:o.jsx(zs,{htmlFor:i,label:a,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:R})}),e[20]=a,e[21]=i,e[22]=s.description,e[23]=R,e[24]=E):E=e[24];const I=m&&"border-primary ring-2 ring-primary/30",D=v.isPending&&"pointer-events-none opacity-60";let O;e[25]!==I||e[26]!==D?(O=le("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",I,D),e[25]=I,e[26]=D,e[27]=O):O=e[27];let $;e[28]!==x||e[29]!==g||e[30]!==d||e[31]!==f||e[32]!==h||e[33]!==c||e[34]!==v.isPending?($=h?d?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>f(!0),"aria-label":c("sectionsEditor.fileField.replaceVideoLabel"),className:"relative block h-40 w-full cursor-pointer overflow-hidden bg-black",children:[o.jsx("video",{src:h,preload:"metadata",className:"h-full w-full object-contain"},h),o.jsx(Mk,{})]}),o.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[o.jsx(Hx,{size:14,className:"shrink-0 text-muted-foreground"}),o.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:g}),o.jsx(Qb,{ext:x})]})]}):o.jsxs("button",{type:"button",onClick:()=>f(!0),"aria-label":c("sectionsEditor.fileField.replaceFileLabel"),className:"flex w-full cursor-pointer items-center gap-3 px-3 py-2.5 text-left hover:bg-muted/60",children:[o.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:o.jsx(Mr,{size:18,className:"text-muted-foreground"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate text-sm font-medium",children:g}),o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:h})]}),o.jsx(Qb,{ext:x})]}):o.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[d?o.jsx(Hx,{size:20}):o.jsx(Mr,{size:20}),o.jsx("span",{className:"text-sm font-medium",children:v.isPending?c("sectionsEditor.fileField.uploading"):c(d?"sectionsEditor.fileField.dropVideoHint":"sectionsEditor.fileField.dropFileHint")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.fileField.sizeLimit")})]}),e[28]=x,e[29]=g,e[30]=d,e[31]=f,e[32]=h,e[33]=c,e[34]=v.isPending,e[35]=$):$=e[35];let M;e[36]!==m||e[37]!==c?(M=m&&o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:o.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:c("sectionsEditor.fileField.dropToUpload")})}),e[36]=m,e[37]=c,e[38]=M):M=e[38];let z;e[39]!==C||e[40]!==N||e[41]!==A||e[42]!==O||e[43]!==$||e[44]!==M?(z=o.jsxs("div",{onDragOver:N,onDragLeave:C,onDrop:A,className:O,children:[$,M]}),e[39]=C,e[40]=N,e[41]=A,e[42]=O,e[43]=$,e[44]=M,e[45]=z):z=e[45];let F;e[46]!==r?(F=ee=>r(ee.target.value),e[46]=r,e[47]=F):F=e[47];let B;e[48]!==i||e[49]!==h||e[50]!==F?(B=o.jsx(yt,{id:i,type:"url",value:h,onChange:F,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[48]=i,e[49]=h,e[50]=F,e[51]=B):B=e[51];let H;e[52]!==f||e[53]!==h||e[54]!==c?(H=!h&&o.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:()=>f(!0),className:"h-9 shrink-0",children:[o.jsx(Qn,{size:14}),c("sectionsEditor.fileField.browseButton")]}),e[52]=f,e[53]=h,e[54]=c,e[55]=H):H=e[55];let W;e[56]!==d||e[57]!==r||e[58]!==h?(W=d&&h&&o.jsx(Fk,{value:h,onChange:r,showMuted:!0}),e[56]=d,e[57]=r,e[58]=h,e[59]=W):W=e[59];let K;e[60]!==r||e[61]!==h||e[62]!==c?(K=h&&o.jsx(me,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.fileField.removeFileLabel"),children:o.jsx(rn,{size:14})}),e[60]=r,e[61]=h,e[62]=c,e[63]=K):K=e[63];let q;e[64]!==B||e[65]!==H||e[66]!==W||e[67]!==K?(q=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[B,H,W,K]}),e[64]=B,e[65]=H,e[66]=W,e[67]=K,e[68]=q):q=e[68];let G;e[69]!==r?(G=ee=>r(ee),e[69]=r,e[70]=G):G=e[70];const te=w?.id??null;let X;e[71]!==u||e[72]!==f||e[73]!==G||e[74]!==te?(X=o.jsx(Rk,{open:u,onOpenChange:f,mode:"any",onSelect:G,lockedConfigId:te}),e[71]=u,e[72]=f,e[73]=G,e[74]=te,e[75]=X):X=e[75];let Z;return e[76]!==z||e[77]!==q||e[78]!==X||e[79]!==E?(Z=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[E,z,q,X]}),e[76]=z,e[77]=q,e[78]=X,e[79]=E,e[80]=Z):Z=e[80],Z}function Nre(t){return t.type.startsWith("video/")}const Vre=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function Tre(t){const e=U.c(86),{schema:s,value:n,onChange:r,path:i,label:a,sandbox:l}=t,c=ue(),d=tx(n),[h,u]=P.useState(!1),[f,m]=P.useState(!1),[p,g]=P.useState(!1),[x,b]=P.useState(!1),v=d?Ik(d):"",_=v?Ok(v):"",L=kg(),y=G9();let w;e[0]!==L.data?.configs?(w=L.data?.configs??[],e[0]=L.data?.configs,e[1]=w):w=e[1];const S=l?.siteSlug;let k;e[2]!==w||e[3]!==S?(k=o9(w,S),e[2]=w,e[3]=S,e[4]=k):k=e[4];const j=k;let N;e[5]!==r||e[6]!==b||e[7]!==g?(N=function(ne){g(!1),b(!1),r(ne)},e[5]=r,e[6]=b,e[7]=g,e[8]=N):N=e[8];const V=N;let C;e[9]!==L.data?.configs||e[10]!==j?.id||e[11]!==u||e[12]!==V||e[13]!==c||e[14]!==y?(C=async function(ne){if(!ne)return;const Q=Array.from(ne).filter(Pre);if(Q.length===0){ye.error(c("sectionsEditor.imageField.onlyImageFilesAccepted"));return}const de=Uk(L.data?.configs??[],j?.id,typeof window<"u"?window.localStorage.getItem(Y9):null);if(!de){u(!0);return}try{const ae=await y.mutateAsync({configId:de,file:Q[0]});V(ae.publicUrl),Q.length>1&&ye.info(c("sectionsEditor.imageField.uploadedWithExtraFilesIgnored",{fileName:Q[0].name}))}catch(ae){const re=ae;ye.error(re instanceof Error?re.message:c("sectionsEditor.imageField.uploadFailed"))}},e[9]=L.data?.configs,e[10]=j?.id,e[11]=u,e[12]=V,e[13]=c,e[14]=y,e[15]=C):C=e[15];const T=C;let A;e[16]!==m?(A=function(ne){ne.preventDefault(),ne.dataTransfer.types.includes("Files")&&m(!0)},e[16]=m,e[17]=A):A=e[17];const R=A;let E;e[18]!==m?(E=function(ne){ne.currentTarget===ne.target&&m(!1)},e[18]=m,e[19]=E):E=e[19];const I=E;let D;e[20]!==T||e[21]!==m?(D=function(ne){ne.preventDefault(),ne.stopPropagation(),m(!1),T(ne.dataTransfer.files)},e[20]=T,e[21]=m,e[22]=D):D=e[22];const O=D,$=l?.virtualMcpId;let M;e[23]!==a||e[24]!==i||e[25]!==s.description||e[26]!==$?(M=o.jsx("div",{className:"min-w-0",children:o.jsx(zs,{htmlFor:i,label:a,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:$})}),e[23]=a,e[24]=i,e[25]=s.description,e[26]=$,e[27]=M):M=e[27];const z=f&&"border-primary ring-2 ring-primary/30",F=y.isPending&&"pointer-events-none opacity-60";let B;e[28]!==z||e[29]!==F?(B=le("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",z,F),e[28]=z,e[29]=F,e[30]=B):B=e[30];let H;e[31]!==_||e[32]!==v||e[33]!==x||e[34]!==p||e[35]!==a||e[36]!==b||e[37]!==g||e[38]!==u||e[39]!==d||e[40]!==c||e[41]!==y.isPending?(H=d?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>u(!0),"aria-label":c("sectionsEditor.imageField.replaceImage"),className:"relative block h-40 w-full cursor-pointer bg-[image:linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%),linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%)] bg-[position:0_0,8px_8px] [background-size:16px_16px]",children:[!x&&o.jsx("img",{src:d,alt:a,className:le("h-full w-full object-contain transition-opacity",!p&&"opacity-0"),onLoad:()=>g(!0),onError:()=>b(!0)},d),x&&o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[o.jsx(ar,{size:20}),o.jsx("p",{className:"text-xs",children:c("sectionsEditor.imageField.previewUnavailable")})]}),!p&&!x&&o.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"}),o.jsx(Mk,{})]}),o.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:v}),_&&o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:_})]})]}):o.jsxs("button",{type:"button",onClick:()=>u(!0),className:"flex h-40 w-full flex-col items-center justify-center gap-2 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[o.jsx(ar,{size:20}),o.jsx("span",{className:"text-sm font-medium",children:y.isPending?c("sectionsEditor.imageField.uploading"):c("sectionsEditor.imageField.dropImageOrClickToBrowse")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.imageField.supportedFormatsAndSize")})]}),e[31]=_,e[32]=v,e[33]=x,e[34]=p,e[35]=a,e[36]=b,e[37]=g,e[38]=u,e[39]=d,e[40]=c,e[41]=y.isPending,e[42]=H):H=e[42];let W;e[43]!==f||e[44]!==c?(W=f&&o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:o.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:c("sectionsEditor.imageField.dropToUpload")})}),e[43]=f,e[44]=c,e[45]=W):W=e[45];let K;e[46]!==I||e[47]!==R||e[48]!==O||e[49]!==B||e[50]!==H||e[51]!==W?(K=o.jsxs("div",{onDragOver:R,onDragLeave:I,onDrop:O,className:B,children:[H,W]}),e[46]=I,e[47]=R,e[48]=O,e[49]=B,e[50]=H,e[51]=W,e[52]=K):K=e[52];let q;e[53]!==V?(q=he=>V(he.target.value),e[53]=V,e[54]=q):q=e[54];let G;e[55]!==c?(G=c("sectionsEditor.imageField.urlPlaceholder"),e[55]=c,e[56]=G):G=e[56];let te;e[57]!==i||e[58]!==d||e[59]!==q||e[60]!==G?(te=o.jsx(yt,{id:i,type:"url",value:d,onChange:q,placeholder:G,className:"h-9 min-w-0 flex-1"}),e[57]=i,e[58]=d,e[59]=q,e[60]=G,e[61]=te):te=e[61];let X;e[62]!==u||e[63]!==d||e[64]!==c?(X=!d&&o.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:()=>u(!0),className:"h-9 shrink-0",children:[o.jsx(Qn,{size:14}),c("sectionsEditor.imageField.browse")]}),e[62]=u,e[63]=d,e[64]=c,e[65]=X):X=e[65];let Z;e[66]!==V||e[67]!==d||e[68]!==c?(Z=d&&o.jsxs(o.Fragment,{children:[o.jsx(Fk,{value:d,onChange:V}),o.jsx(me,{type:"button",variant:"ghost",size:"sm",onClick:()=>V(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.imageField.removeImage"),children:o.jsx(rn,{size:14})})]}),e[66]=V,e[67]=d,e[68]=c,e[69]=Z):Z=e[69];let ee;e[70]!==te||e[71]!==X||e[72]!==Z?(ee=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[te,X,Z]}),e[70]=te,e[71]=X,e[72]=Z,e[73]=ee):ee=e[73];let se;e[74]!==V?(se=he=>V(he),e[74]=V,e[75]=se):se=e[75];const J=j?.id??null;let oe;e[76]!==h||e[77]!==u||e[78]!==se||e[79]!==J?(oe=o.jsx(Rk,{open:h,onOpenChange:u,mode:"image",onSelect:se,lockedConfigId:J}),e[76]=h,e[77]=u,e[78]=se,e[79]=J,e[80]=oe):oe=e[80];let ce;return e[81]!==M||e[82]!==K||e[83]!==ee||e[84]!==oe?(ce=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[M,K,ee,oe]}),e[81]=M,e[82]=K,e[83]=ee,e[84]=oe,e[85]=ce):ce=e[85],ce}function Pre(t){return Vre.has(t.type||"")}const Are="0 0 1080 1080",Ere="matrix(1 0 0 1 540 540)",ox=[{code:"AC",name:"Acre",gTransform:"matrix(1 0 0 1 -248.53 -95.16)",pathTransform:"translate(-57.47, -224.1)",d:"M 30.47 237.77 L 28.39 237.73 L 28.93 235.92 L 28.72 235.09 L 28.47 234.6 L 27.22 233.9 L 27.08 233.45 L 27.35 232.3 L 26.58 230.35 L 25.49 229.71 L 19.89 228.46 L 12.55 228.27 L 12.82 227.71 L 15.31 225.45 L 16.2 224.22 L 16.49 223.02 L 16.27 221.79 L 15.59 220.88 L 14.76 220.44 L 13.08 217.49 L 12.31 217.05 L 11.41 216.86 L 10.28 215.73 L 9.36 213.35 L 7.36 211.82 L 6.38 208.2 L 5.51 206.56 L 3.63 205.48 L 3.55 204.31 L 4.36 204.41 L 4.78 203.89 L 4.85 203.22 L 4.65 202.8 L 2.53 201.87 L 2.17 201.21 L 0 199.32 L 0.04 198.95 L 0.66 198.9 L 1.16 197.58 L 1.15 196.27 L 4.16 195.88 L 4.66 195.49 L 4.44 194.14 L 3.27 192.57 L 3.27 192.57 L 21.22 200.05 L 44.88 205.71 L 57.02 208.85 L 83.46 223.02 L 111.97 235.15 L 111.97 235.15 L 114.94 236.41 L 114.94 236.41 L 114.64 236.89 L 113.07 237.55 L 110.98 239.14 L 108.12 241.93 L 106.47 242.79 L 105.81 242.61 L 104.28 242.79 L 104.23 243.35 L 102.31 244.65 L 100.23 245.64 L 98.79 247.47 L 98.35 248.65 L 97.74 248.93 L 96.57 248.18 L 95.81 248.05 L 93.44 248.1 L 92.76 248.36 L 92.13 248.81 L 91.77 249.67 L 89.33 253.15 L 85.56 254.4 L 84.72 255.09 L 82.78 255.6 L 81.75 255.63 L 81.83 253.52 L 80.47 253.72 L 76.92 252.95 L 71.68 252.48 L 66.59 252.86 L 65.93 252.28 L 63.66 252.11 L 60.1 253.94 L 57.37 254.56 L 55.69 253.89 L 54.29 252.45 L 52.65 253.61 L 52.69 236.06 L 52.74 234.96 L 53.21 234.25 L 53.28 231.9 L 53.02 231.02 L 53.99 229.84 L 54.47 228.7 L 53.31 228.9 L 50.34 231.49 L 48.74 232.5 L 46.68 234.88 L 44.73 235.55 L 44.08 236.63 L 42.27 237.62 z"},{code:"AL",name:"Alagoas",gTransform:"matrix(1 0 0 1 276.36 -86.82)",pathTransform:"translate(-582.36, -232.44)",d:"M 561.91 230.3 L 561.71 229.57 L 560.29 228.79 L 559.84 228.88 L 558.82 228.59 L 558.28 227.19 L 558.28 227.19 L 559.6 226.12 L 560.24 225.03 L 562.41 224.27 L 564.79 220.98 L 564.88 220.29 L 565.7 219.69 L 566.7 220.91 L 568.37 221.21 L 569.45 221.09 L 572 223.11 L 573.9 225.23 L 575.68 226.28 L 577.59 226.76 L 580.09 226.11 L 583.23 226.4 L 584.4 226.29 L 586.26 225.23 L 587.42 225.28 L 589.23 224.17 L 591.41 221.88 L 591.53 221.43 L 593.08 220.19 L 595.08 219.95 L 597.32 220.8 L 599.88 219.51 L 601.35 219.32 L 603.27 220.13 L 606.17 220.4 L 606.44 220.61 L 606.44 220.61 L 603.66 225.57 L 599.11 230.7 L 595.53 234.28 L 592.49 238.86 L 589.16 241.74 L 588.16 243.77 L 586.84 245.56 L 586.84 245.56 L 586.24 244.25 L 582.65 242.02 L 582.19 241.99 L 580.53 241.2 L 578.77 239.75 L 577.47 237.3 L 572.05 234.23 L 568.37 233.28 z"},{code:"AM",name:"Amazonas",gTransform:"matrix(1 0 0 1 -166.8 -178.05)",pathTransform:"translate(-139.2, -141.22)",d:"M 165.82 47.29 L 166.54 48.07 L 167.29 48.41 L 167.9 48.42 L 169.03 48 L 169.66 48.11 L 169.72 49.07 L 170.93 50.24 L 171.9 50.61 L 172.78 50.4 L 174.14 50.51 L 176.09 51.46 L 176.58 52.12 L 175.67 55.44 L 174.96 56.94 L 177.69 60.68 L 179.35 65.44 L 179.54 67.7 L 180.41 68.82 L 180.46 69.27 L 178.84 70.73 L 179.2 72.32 L 179.86 73.9 L 179.09 76.94 L 178.52 77.9 L 178.81 82.88 L 179.69 85.05 L 180.91 85.89 L 181.49 86.79 L 182.62 91.12 L 182.56 91.7 L 181.42 93.02 L 179.58 92.69 L 179.44 93.83 L 184.45 98.25 L 184.97 98.29 L 186.93 99.6 L 188.41 101.25 L 189.45 103.29 L 189.98 103.36 L 191.32 102.94 L 193.68 103.98 L 193.24 101.87 L 193.99 99.58 L 194.24 97.85 L 193.87 96.05 L 194.69 93.08 L 195.71 91.82 L 196.99 91.13 L 199.08 90.42 L 199.63 89.53 L 201.23 89.47 L 204.06 90.4 L 205.93 92.44 L 206.85 94.95 L 208.67 95.18 L 209.92 94.72 L 211.33 93.31 L 213.36 92.76 L 213.78 92.37 L 213.8 91.84 L 212.66 90.43 L 212.43 89.7 L 212.54 89.04 L 213.69 86.4 L 213.76 85.27 L 215.42 82.24 L 217.75 78.98 L 217.72 78.3 L 236.21 78.37 L 236.21 78.37 L 236.61 83.23 L 236.18 84.68 L 236.36 86.95 L 236.6 87.63 L 238.3 88.48 L 238.48 88.89 L 238.13 89.58 L 238.08 91.69 L 239.91 93.68 L 240.27 93.87 L 240.97 93.69 L 242.81 94.92 L 243.36 96.75 L 243.4 97.68 L 243.7 98.13 L 248.34 101.9 L 252.92 104.44 L 253.55 105.34 L 254.9 106.43 L 256.78 107.1 L 259.15 108.41 L 261.41 109.06 L 262.77 109.21 L 264.09 110.03 L 264.17 110.64 L 265.44 111.98 L 268.14 113.42 L 269.24 115.59 L 271.11 116.38 L 271.96 115.77 L 273.34 115.42 L 273.53 115.9 L 273.4 116.68 L 275.21 118.35 L 245.31 182.59 L 244.53 183.9 L 243.08 185.03 L 242.5 186 L 242.47 187.13 L 243.29 189.46 L 243.67 190.03 L 244.74 190.61 L 246.32 192.17 L 246.96 193.43 L 247.11 195.39 L 247.68 195.96 L 247.68 195.96 L 246.5 197.16 L 246.3 197.77 L 246.24 198.53 L 246.58 199.37 L 246.31 200.38 L 245.11 202.2 L 244.25 202.84 L 243.83 203.69 L 243.93 204.54 L 244.59 205.91 L 245.05 207.85 L 243.67 212.07 L 242.49 217.29 L 241.28 218.02 L 193.43 218.34 L 193.43 218.34 L 193.47 217.64 L 193.11 217.26 L 191.72 216.98 L 189.8 218.06 L 189.26 219.8 L 188.58 219.99 L 185.34 218.51 L 184.66 215.63 L 184.04 215.43 L 183.06 215.56 L 182.6 215.35 L 181.35 212.08 L 178.81 211.1 L 177.48 209.83 L 176.68 207.92 L 176.23 207.43 L 174.08 206.3 L 163.29 206.36 L 161.91 208.92 L 160.19 209.42 L 160.28 210.59 L 160.02 210.81 L 157.54 211.34 L 156.35 212.93 L 156.3 213.6 L 157.2 214.3 L 157.37 214.75 L 157.01 215.77 L 156.2 216.92 L 154.14 218.13 L 154.03 219.94 L 154.27 221.4 L 150.4 220.94 L 148.27 221.32 L 147.07 222.39 L 145.28 222.29 L 144.44 221.74 L 143.98 221.72 L 142.23 222.98 L 141.7 223.82 L 141.96 225.57 L 139.42 228.73 L 138.74 228.81 L 138.06 228.28 L 137.42 226.02 L 137.04 225.93 L 135.2 226.95 L 133.9 228.16 L 132.53 228.55 L 131.76 228.42 L 130.68 228.92 L 130.27 229.45 L 130.14 230.17 L 128.92 230.96 L 128.55 230.98 L 126.24 228.65 L 125.52 228.28 L 122.65 228.61 L 118.69 228.35 L 118.85 229.64 L 118.7 230.2 L 117.15 232.01 L 115.23 232.59 L 111.97 235.15 L 111.97 235.15 L 83.46 223.02 L 57.02 208.85 L 44.88 205.71 L 21.22 200.05 L 3.27 192.57 L 3.27 192.57 L 3.2 191.92 L 3.9 189 L 5.12 187.6 L 10.04 184.13 L 12.3 183.89 L 12.77 183.59 L 13.75 182.03 L 13.83 181 L 12.09 176.51 L 12.47 175.32 L 13.65 173.13 L 14.93 171.81 L 15.85 170.56 L 16.27 169.58 L 16.57 167.84 L 16.28 166.52 L 16.95 164.48 L 17.26 162.17 L 17.99 161.42 L 21.65 159.79 L 23.84 158.56 L 24.99 157.52 L 25.43 156.12 L 26.21 155.75 L 27.62 155.64 L 29.27 154.71 L 32.81 151.98 L 35.23 151.55 L 36.74 151.84 L 40.93 150.62 L 42.43 149.85 L 44.25 149.49 L 47.58 149.87 L 48.88 148.28 L 49.51 146.83 L 50.6 146.22 L 52.74 146.42 L 53.38 146.96 L 54.7 146.72 L 55.8 145.98 L 57.51 146.1 L 57.82 146.63 L 57.8 147.81 L 59.41 149.1 L 62.24 149.18 L 62.82 148.78 L 63.28 148 L 63.17 147.61 L 64.34 142.69 L 71.04 105.52 L 72.2 102.6 L 71.21 97.64 L 71.33 97.38 L 70.03 96.33 L 68.55 93.58 L 68.51 93.09 L 69.16 91.7 L 68.64 89.92 L 68.27 89.52 L 66.57 88.93 L 63.54 86.58 L 61.6 84.3 L 61.8 72.79 L 65.69 72.53 L 67.44 71.36 L 70.94 70.44 L 73.62 72.2 L 74.84 72.31 L 76.11 71.88 L 75.62 70.19 L 75.92 68.47 L 74.55 66.37 L 73.98 65.83 L 72.83 65.23 L 71.32 65.76 L 68.53 65.15 L 64.96 65.24 L 64.9 55.34 L 65.86 55.38 L 67.18 54.8 L 69.46 54.2 L 72.3 55.07 L 91.33 55.13 L 90.87 54.47 L 90.08 54.33 L 89.7 53.13 L 90.65 51.2 L 92.08 51.6 L 92.69 53.12 L 93.56 54.44 L 94.22 54.79 L 95.05 54.8 L 96.66 54.19 L 98.6 52.1 L 98.92 51.26 L 100.18 50.02 L 102.73 48.63 L 104.02 49.09 L 105.19 51.67 L 106.81 53.66 L 107.55 54.96 L 108.21 56.74 L 108.44 58.29 L 107.95 61.92 L 108.15 63.68 L 111.35 62.93 L 119.66 69.99 L 120.45 70.27 L 122.95 70.48 L 125.25 69.48 L 126.95 67.78 L 129.06 66.62 L 131.25 66.51 L 131.81 66.8 L 132.58 67.88 L 132.56 68.85 L 131.45 70.55 L 131.82 71.53 L 132.4 71.8 L 133.73 71.08 L 134.29 70.17 L 134.52 68.88 L 135.52 67.72 L 135.99 67.49 L 136.99 67.67 L 137.54 67.49 L 137.95 66.83 L 138.41 64.52 L 138.92 64.15 L 140.43 63.79 L 143.36 62.02 L 144.33 62.57 L 145.26 62.28 L 146.86 61.24 L 147.88 59.63 L 149.99 58.42 L 152.02 58.97 L 154.38 57.32 L 154.93 56.5 L 155.37 53.84 L 155.34 52.55 L 156.11 51.63 L 157.14 51.21 L 158.88 51.19 L 160.22 50.8 L 162.28 49.2 L 163.24 48.83 L 165.52 48.53 z"},{code:"AP",name:"Amapá",gTransform:"matrix(1 0 0 1 32.29 -262.31)",pathTransform:"translate(-338.29, -56.97)",d:"M 344.98 99.7 L 344.04 99.64 L 343.27000000000004 99.98 L 341.97 100.10000000000001 L 339.18 99.42 L 337.73 98.39 L 337.3 96.89 L 335.43 95.5 L 335.32 94.2 L 335.53 93.51 L 335.21999999999997 91.93 L 334.89 91.46000000000001 L 333.94 91.27000000000001 L 333.53 90.33000000000001 L 333.60999999999996 87.9 L 330.67999999999995 84.62 L 329.9 84.98 L 329.08 84.79 L 327.58 81.31 L 327.71 79.73 L 327.12 77.92 L 326.5 77.36 L 325.83 75.85 L 325.64 73.74 L 326.07 70.6 L 325.9 70.27 L 323.33 69.53999999999999 L 321.31 67.27999999999999 L 320.55 64.44999999999999 L 320.74 63.72999999999999 L 321.42 63.49999999999999 L 320.93 62.31999999999999 L 320.25 62.349999999999994 L 317.41 59.69 L 316.47 59.83 L 316.09000000000003 60.25 L 314.76000000000005 60.39 L 313.9200000000001 60.12 L 313.12000000000006 59.14 L 311.9800000000001 58.3 L 310.7900000000001 58.18 L 310.30000000000007 56.9 L 309.63000000000005 56.1 L 307.70000000000005 55.050000000000004 L 306.41 54.56 L 303.02000000000004 54.190000000000005 L 301.94000000000005 54.480000000000004 L 300.77000000000004 54.46 L 300.46000000000004 53.92 L 300.22 52.480000000000004 L 300.47 47.940000000000005 L 301.09000000000003 46.64000000000001 L 300.72 44.34000000000001 L 300.1 43.77000000000001 L 300.1 43.77000000000001 L 300.45000000000005 43.56000000000001 L 301.44000000000005 43.86000000000001 L 301.43000000000006 44.67000000000001 L 301.14000000000004 44.85000000000001 L 301.48 45.82000000000001 L 302.95000000000005 45.760000000000005 L 303.77000000000004 45.99 L 304.12000000000006 46.89 L 304.96000000000004 47.6 L 307.21000000000004 48.38 L 310.50000000000006 49.13 L 313.26000000000005 47.35 L 313.61000000000007 46.59 L 315.3400000000001 45.42 L 316.1700000000001 45.13 L 316.86000000000007 46.07 L 319.57000000000005 47.01 L 320.65000000000003 46.89 L 322.37000000000006 45.88 L 322.49000000000007 45.46 L 322.81000000000006 45.49 L 324.27000000000004 46.79 L 324.07000000000005 47.66 L 326.44000000000005 47.489999999999995 L 326.95000000000005 47.989999999999995 L 327.90000000000003 48.16 L 328.52000000000004 48.15 L 329.43000000000006 47.67 L 331.1000000000001 46.17 L 332.88000000000005 45.07 L 334.63000000000005 42.77 L 335.00000000000006 41.77 L 334.80000000000007 41.230000000000004 L 337.93000000000006 34.730000000000004 L 338.0400000000001 32.910000000000004 L 339.1500000000001 31.610000000000003 L 339.8800000000001 31.42 L 343.48000000000013 25.630000000000003 L 343.71000000000015 24.480000000000004 L 344.5500000000001 23.280000000000005 L 346.34000000000015 21.730000000000004 L 346.97000000000014 20.070000000000004 L 349.08000000000015 18.930000000000003 L 349.5500000000002 18.01 L 350.5900000000002 17.430000000000003 L 351.1500000000002 18.890000000000004 L 352.0300000000002 20.250000000000004 L 350.3600000000002 15.450000000000003 L 350.2900000000002 14.160000000000004 L 350.4700000000002 13.830000000000004 L 353.8400000000002 16.250000000000004 L 354.9800000000002 17.460000000000004 L 355.8900000000002 18.680000000000003 L 356.4100000000002 19.870000000000005 L 356.44000000000017 21.450000000000003 L 356.88000000000017 21.76 L 357.20000000000016 21.28 L 357.58000000000015 21.18 L 357.79000000000013 21.58 L 358.0000000000001 29.47 L 358.66000000000014 33.339999999999996 L 361.3700000000001 39.38999999999999 L 364.03000000000014 48.32999999999999 L 367.35000000000014 53.32999999999999 L 368.3600000000001 53.67999999999999 L 371.6300000000001 53.599999999999994 L 374.4100000000001 54.53999999999999 L 375.7000000000001 55.38999999999999 L 376.4700000000001 58.03999999999999 L 376.31000000000006 61.36999999999999 L 375.02000000000004 62.32999999999999 L 373.29 62.75999999999999 L 372.91 63.08999999999999 L 374.70000000000005 62.93999999999999 L 375.74000000000007 62.51999999999999 L 376.02000000000004 62.749999999999986 L 376.14000000000004 63.33999999999999 L 375.97 64.07 L 370.94000000000005 68.13 L 369.77000000000004 70.22999999999999 L 367.62000000000006 71.63999999999999 L 365.68000000000006 75.35999999999999 L 362.77000000000004 78.85999999999999 L 362.07000000000005 79.31999999999998 L 361.13000000000005 79.22999999999998 L 359.68000000000006 79.74999999999997 L 357.6000000000001 82.72999999999998 L 357.6000000000001 82.72999999999998 L 356.2600000000001 82.79999999999997 L 355.5100000000001 83.69999999999997 L 355.5100000000001 83.69999999999997 L 354.0400000000001 85.37999999999998 L 353.07000000000005 87.59999999999998 L 351.95000000000005 89.46999999999998 L 351.11000000000007 90.11999999999999 L 348.1000000000001 93.57 L 347.74000000000007 95.97 L 347.9100000000001 97.77 L 345.9600000000001 99.58 L 344.98 99.7 z M 368.34 52.71 L 367.89 52.38 L 366.78999999999996 50.52 L 366.85999999999996 49.64 L 367.09 49.230000000000004 L 368.75 48.78 L 369.18 49.17 L 370.01 51.440000000000005 L 369.02 52.540000000000006 L 368.34 52.71 z M 370.83 70.32 L 370.43 70.07 L 370.35 69.36 L 371.46000000000004 68.26 L 372.34000000000003 68.11 L 373.59000000000003 68.35 L 374.05 68.24 L 374.49 67.6 L 374.54 68.19 L 373.57 69.63 L 372.58 70.13 L 370.83 70.32 z M 374.27 67.45 L 373.49 67.22 L 373.49 66.66 L 374.21000000000004 65.61999999999999 L 375.46000000000004 65.52 L 375.64000000000004 65.86999999999999 L 375.54 66.38 L 374.27 67.45 z M 367.08 49.03 L 366.32 48.53 L 366.58 47.7 L 367.46 47.53 L 368.32 47.85 L 368.33 48.58 L 367.08 49.03 z"},{code:"BA",name:"Bahia",gTransform:"matrix(1 0 0 1 193.52 -26.39)",pathTransform:"translate(-499.52, -292.87)",d:"M 527.5 365.33 L 527.14 364.5 L 527.8199999999999 363.15 L 527.81 362.62 L 527.28 361.58 L 523.15 358.53 L 523 358.02 L 523.22 356.51 L 522.65 355.28 L 522 355.52 L 521.8 355.96999999999997 L 521.4599999999999 356.15 L 521.2399999999999 355.9 L 521.7699999999999 351.5 L 522.5899999999999 348.2 L 523.41 347.32 L 525.88 347.56 L 526.9 346.85 L 526.9 346.43 L 526.34 345.41 L 526.5 342.76000000000005 L 531.46 338.54 L 532.9300000000001 335.46000000000004 L 532.5100000000001 334.29 L 531.7300000000001 333.27000000000004 L 530.8400000000001 333.21000000000004 L 530.1100000000001 332.83000000000004 L 527.2800000000001 330.36 L 525.1600000000001 330.38 L 522.97 329.78 L 520.7 328.7 L 517.97 328.14 L 515.99 328 L 514.67 328.99 L 513.1999999999999 329.49 L 510.5899999999999 329.04 L 510.0199999999999 329.25 L 509.5799999999999 325.29 L 503.05999999999995 319.09000000000003 L 502.67999999999995 318.91 L 498.28999999999996 320.14000000000004 L 496.76 318.90000000000003 L 496.25 319.11 L 495.32 318.89 L 492.78 317.66999999999996 L 490.60999999999996 316.04999999999995 L 489.62999999999994 316.22999999999996 L 485.2799999999999 312.59999999999997 L 484.1799999999999 312.05999999999995 L 481.4499999999999 311.30999999999995 L 479.6799999999999 311.55999999999995 L 477.7999999999999 312.4599999999999 L 476.9899999999999 313.5799999999999 L 476.3499999999999 313.75999999999993 L 471.0199999999999 312.2899999999999 L 470.4099999999999 311.7999999999999 L 470.1499999999999 310.2999999999999 L 470.2899999999999 309.4099999999999 L 471.5799999999999 306.6699999999999 L 470.7199999999999 306.2099999999999 L 468.43999999999994 305.68999999999994 L 466.25999999999993 305.6499999999999 L 465.05999999999995 305.1499999999999 L 463.2699999999999 305.06999999999994 L 459.43999999999994 306.6499999999999 L 455.17999999999995 309.6799999999999 L 454.53999999999996 310.7899999999999 L 451.16999999999996 312.6599999999999 L 449.15 313.0599999999999 L 448.2 314.2399999999999 L 446.39 315.7899999999999 L 444.96 316.3099999999999 L 443.96 316.1599999999999 L 442.10999999999996 318.7399999999999 L 441.06999999999994 319.5099999999999 L 438.93999999999994 319.1299999999999 L 438.2199999999999 319.2599999999999 L 437.5299999999999 320.2599999999999 L 436.18999999999994 321.1799999999999 L 435.78999999999996 320.9399999999999 L 437.21999999999997 317.5099999999999 L 436.71 315.09999999999985 L 436.71 315.09999999999985 L 438.19 313.1299999999998 L 438.44 312.35999999999984 L 438.21 311.08999999999986 L 437.53999999999996 309.36999999999983 L 437.64 308.6999999999998 L 438.34999999999997 307.2799999999998 L 438.29999999999995 306.8199999999998 L 435.09 304.1999999999998 L 433.4 300.73999999999984 L 432.78 297.21999999999986 L 432.83 295.66999999999985 L 434.03 291.83999999999986 L 435.61999999999995 290.8099999999999 L 435.84999999999997 290.4299999999999 L 435.90999999999997 289.4899999999999 L 434.28 288.6499999999999 L 434.16999999999996 288.31999999999994 L 434.65 285.79999999999995 L 436.08 284.73999999999995 L 436.06 284.36999999999995 L 433.34 281.90999999999997 L 433.34 281.90999999999997 L 433.29999999999995 280.97999999999996 L 434.65999999999997 278.59999999999997 L 434.61999999999995 277.53 L 434.44999999999993 277.10999999999996 L 432.98999999999995 276.61999999999995 L 432.04999999999995 275.96999999999997 L 431.69999999999993 274.71 L 431.75999999999993 271.78999999999996 L 431.94999999999993 270.93999999999994 L 433.8999999999999 269.2699999999999 L 435.0399999999999 268.8499999999999 L 435.9999999999999 268.1299999999999 L 435.70999999999987 267.4999999999999 L 435.1299999999999 266.9799999999999 L 434.20999999999987 266.6899999999999 L 433.1799999999999 266.8699999999999 L 432.82999999999987 266.5399999999999 L 432.7399999999999 266.0399999999999 L 433.1599999999999 265.0799999999999 L 435.19999999999993 264.25999999999993 L 435.75999999999993 263.80999999999995 L 435.7199999999999 263.04999999999995 L 433.8399999999999 262.06999999999994 L 430.25999999999993 261.3999999999999 L 428.3999999999999 259.43999999999994 L 428.1699999999999 258.5199999999999 L 428.6699999999999 257.3599999999999 L 429.6799999999999 256.6299999999999 L 431.1999999999999 253.1499999999999 L 432.09999999999985 252.53999999999988 L 433.10999999999984 252.26999999999987 L 433.45999999999987 251.88999999999987 L 432.16999999999985 250.08999999999986 L 432.35999999999984 249.71999999999986 L 435.5699999999998 247.09999999999985 L 439.3899999999998 245.07999999999984 L 439.9499999999998 244.60999999999984 L 440.16999999999985 243.62999999999985 L 440.85999999999984 242.97999999999985 L 440.85999999999984 242.97999999999985 L 443.1899999999998 242.95999999999984 L 444.6299999999998 244.29999999999984 L 445.28999999999985 245.33999999999983 L 445.8199999999998 247.54999999999984 L 447.5799999999998 250.03999999999985 L 451.7599999999998 251.89999999999986 L 453.55999999999983 251.37999999999985 L 455.66999999999985 251.55999999999986 L 455.99999999999983 251.34999999999985 L 456.74999999999983 249.89999999999986 L 457.8899999999998 249.52999999999986 L 458.55999999999983 248.65999999999985 L 459.72999999999985 247.76999999999987 L 461.9399999999998 247.01999999999987 L 463.2699999999998 247.18999999999986 L 464.74999999999983 247.71999999999986 L 466.09999999999985 247.29999999999987 L 469.0699999999999 244.87999999999988 L 472.01999999999987 239.82999999999987 L 472.7399999999999 238.96999999999986 L 472.9799999999999 238.04999999999987 L 473.2799999999999 235.48999999999987 L 473.1599999999999 234.32999999999987 L 470.9199999999999 229.89999999999986 L 470.9699999999999 228.96999999999986 L 474.2099999999999 227.31999999999985 L 476.1599999999999 227.29999999999984 L 477.6599999999999 227.75999999999985 L 478.06999999999994 228.68999999999986 L 478.38999999999993 228.86999999999986 L 480.50999999999993 228.43999999999986 L 481.8999999999999 227.89999999999986 L 483.2299999999999 228.27999999999986 L 484.9399999999999 229.26999999999987 L 484.8099999999999 229.91999999999987 L 484.9999999999999 230.20999999999987 L 485.8199999999999 230.48999999999987 L 488.8199999999999 230.37999999999985 L 490.2899999999999 229.73999999999987 L 491.9899999999999 229.63999999999987 L 492.8099999999999 228.41999999999987 L 494.3199999999999 227.07999999999987 L 497.0499999999999 226.73999999999987 L 497.8199999999999 226.37999999999985 L 498.6299999999999 225.39999999999986 L 500.7999999999999 225.40999999999985 L 501.4199999999999 226.03999999999985 L 501.7299999999999 226.08999999999986 L 503.5899999999999 224.27999999999986 L 503.4899999999999 221.87999999999985 L 505.4799999999999 221.49999999999986 L 506.2699999999999 221.67999999999986 L 507.31999999999994 221.01999999999987 L 508.81999999999994 218.70999999999987 L 509.2799999999999 217.55999999999986 L 509.2799999999999 217.55999999999986 L 510.1699999999999 217.95999999999987 L 511.3299999999999 217.68999999999986 L 513.53 217.97999999999985 L 516.35 219.36999999999983 L 516.7900000000001 219.87999999999982 L 516.7300000000001 222.60999999999981 L 517.4500000000002 224.5499999999998 L 519.6600000000002 225.4599999999998 L 519.9300000000002 227.4599999999998 L 519.0100000000002 229.13999999999982 L 520.8400000000003 229.75999999999982 L 521.8000000000003 229.53999999999982 L 522.6200000000003 228.61999999999983 L 525.4900000000004 227.73999999999984 L 526.2600000000003 224.15999999999983 L 526.7600000000003 223.28999999999982 L 527.5100000000003 223.12999999999982 L 528.2900000000003 223.65999999999983 L 528.9200000000003 223.70999999999984 L 531.3100000000003 222.68999999999983 L 532.4100000000003 221.44999999999982 L 532.5800000000003 220.85999999999981 L 532.3300000000003 219.4999999999998 L 532.6200000000002 219.2499999999998 L 534.8600000000002 218.7999999999998 L 535.6300000000002 216.7499999999998 L 537.2800000000002 216.3099999999998 L 539.8100000000002 214.8499999999998 L 540.4000000000002 214.7499999999998 L 541.8900000000002 215.3099999999998 L 542.7200000000003 216.7499999999998 L 544.0800000000003 217.5599999999998 L 546.4400000000003 218.3399999999998 L 549.4300000000003 218.7399999999998 L 551.0100000000003 219.88999999999982 L 551.5500000000003 221.53999999999982 L 551.9400000000003 221.80999999999983 L 552.3700000000002 221.65999999999983 L 552.6600000000002 219.90999999999983 L 553.0900000000001 219.46999999999983 L 554.0900000000001 219.45999999999984 L 554.5400000000002 219.77999999999983 L 554.5600000000002 220.40999999999983 L 553.9400000000002 221.28999999999982 L 554.3900000000002 222.11999999999983 L 554.8900000000002 222.48999999999984 L 556.9900000000002 223.34999999999985 L 557.0100000000002 224.28999999999985 L 558.2300000000002 227.33999999999986 L 558.2300000000002 227.33999999999986 L 558.7700000000002 228.73999999999987 L 559.7900000000002 229.02999999999986 L 560.2400000000002 228.93999999999986 L 561.6700000000002 229.72999999999985 L 561.8700000000002 230.44999999999985 L 561.8700000000002 230.44999999999985 L 561.2000000000003 231.60999999999984 L 561.4100000000003 233.74999999999983 L 562.6900000000003 236.24999999999983 L 564.6800000000003 238.19999999999982 L 565.4300000000003 239.34999999999982 L 565.3500000000003 242.46999999999983 L 564.6900000000003 244.08999999999983 L 564.6000000000003 244.96999999999983 L 565.3600000000002 247.71999999999983 L 565.0600000000003 248.29999999999984 L 564.3700000000002 248.84999999999985 L 561.8200000000003 249.84999999999985 L 560.6900000000003 249.09999999999985 L 558.9800000000002 249.08999999999986 L 558.6600000000002 249.38999999999987 L 558.0700000000002 250.96999999999989 L 558.0900000000001 251.7399999999999 L 559.0400000000002 253.3399999999999 L 560.1400000000002 253.9999999999999 L 560.6600000000002 255.4899999999999 L 562.0900000000001 256.9999999999999 L 562.2400000000001 257.3899999999999 L 562.1100000000001 258.8099999999999 L 561.7700000000001 259.1999999999999 L 561.8900000000001 259.6199999999999 L 562.4800000000001 260.1399999999999 L 564.4100000000001 261.0599999999999 L 564.8900000000001 261.76999999999987 L 565.4300000000001 262.10999999999984 L 566.98 262.74999999999983 L 569.87 261.86999999999983 L 569.87 261.86999999999983 L 570.51 261.84999999999985 L 570.87 262.2599999999999 L 566.79 271.08999999999986 L 562.9599999999999 276.27999999999986 L 561.93 278.60999999999984 L 556.9 284.34999999999985 L 554.4499999999999 285.60999999999984 L 553.5799999999999 285.59999999999985 L 553.8799999999999 284.16999999999985 L 554.2499999999999 284.01999999999987 L 554.3899999999999 282.91999999999985 L 553.9399999999998 280.98999999999984 L 552.0699999999998 280.73999999999984 L 551.6399999999999 279.4399999999998 L 550.9599999999999 278.6899999999998 L 550.5899999999999 279.28999999999985 L 550.1299999999999 281.61999999999983 L 549.6299999999999 282.48999999999984 L 549.0799999999999 282.86999999999983 L 548.52 282.5799999999998 L 548.03 280.8399999999998 L 548.14 280.5199999999998 L 548.4499999999999 280.3899999999998 L 548.42 279.99999999999983 L 547.55 281.28999999999985 L 548.4799999999999 282.97999999999985 L 548.9399999999999 283.20999999999987 L 549.31 283.0599999999999 L 550.4599999999999 283.3199999999999 L 549.9999999999999 285.1299999999999 L 548.7899999999998 286.27999999999986 L 548.5399999999998 288.09999999999985 L 547.2899999999998 289.0699999999999 L 546.9399999999998 289.7399999999999 L 546.7399999999998 290.57999999999987 L 546.9199999999997 291.4299999999999 L 545.5699999999997 291.0399999999999 L 545.3599999999997 291.4299999999999 L 544.9999999999997 293.9499999999999 L 545.3599999999997 293.22999999999985 L 546.1099999999997 293.4399999999998 L 546.3499999999997 293.97999999999985 L 546.1199999999997 294.3899999999999 L 546.1799999999996 295.0099999999999 L 546.4799999999996 295.3099999999999 L 546.8099999999996 296.3099999999999 L 545.7699999999996 298.8199999999999 L 546.3399999999997 302.2599999999999 L 545.7899999999997 302.7499999999999 L 545.2199999999997 302.52999999999986 L 545.0799999999997 303.65999999999985 L 545.6699999999997 304.11999999999983 L 546.8799999999998 302.3999999999998 L 546.4099999999997 300.1899999999998 L 547.2299999999998 299.5799999999998 L 547.4799999999998 300.11999999999983 L 547.4199999999998 301.8799999999998 L 546.4599999999998 304.48999999999984 L 545.7199999999998 309.91999999999985 L 545.2099999999998 311.72999999999985 L 545.4099999999999 314.1999999999999 L 546.1899999999998 317.0499999999999 L 546.3799999999999 321.5899999999999 L 547.2499999999999 327.99999999999994 L 548.2399999999999 331.41999999999996 L 546.0299999999999 338.08 L 544.6799999999998 344.72999999999996 L 544.2099999999998 345.73999999999995 L 544.0499999999998 348.59999999999997 L 542.9899999999999 352.32 L 542.8999999999999 354.65 L 543.2899999999998 359.07 L 544.1799999999998 360.78 L 541.9399999999998 363.76 L 540.1299999999999 364.43 L 539.1899999999998 365.07 L 536.4699999999998 368.96 L 535.9 371 L 535.9 371 L 527.81 365.86 L 527.5 365.33 z M 549.78 287.33 L 549.55 286.13 L 550.29 285.71999999999997 L 551.3499999999999 284.67999999999995 L 551.5099999999999 284.03999999999996 L 551.1399999999999 283.30999999999995 L 551.8999999999999 283.44999999999993 L 552.7199999999999 284.49999999999994 L 552.67 285.0299999999999 L 549.78 287.33 z M 547.25 294.18 L 546.62 294.15000000000003 L 546.63 293.48 L 546.89 293.12 L 546.09 292.9 L 545.6700000000001 292.5 L 545.8000000000001 291.43 L 547.6700000000001 291.28000000000003 L 547.83 291.48 L 547.94 292.61 L 547.25 294.18 z"},{code:"CE",name:"Ceará",gTransform:"matrix(1 0 0 1 235.04 -154.64)",pathTransform:"translate(-541.04, -164.62)",d:"M 573.79 156.85 L 568.9 158.44 L 566.29 160.45 L 562.99 167.14 L 562.15 168.26 L 561.28 168.83 L 560.63 170.5 L 560.78 171.24 L 559.38 173.68 L 557.92 175.19 L 557.35 176.29 L 556.32 176.55 L 555.54 176.04 L 555.03 176.11 L 554.19 176.99 L 552.78 179.24 L 552.44 181.21 L 553.08 181.38 L 553.74 181 L 553.74 181 L 553.66 181.54 L 552.82 182.69 L 551.79 185.69 L 552.31 187 L 551.65 188.31 L 550.56 188.94 L 550.39 189.32 L 550.27 190.25 L 550.51 190.66 L 551.09 190.95 L 551.44 191.67 L 551.42 193.33 L 552.66 194.22 L 553.35 194.3 L 553.69 195.49 L 552.08 198.98 L 550.89 200.1 L 551.06 200.35 L 551.06 200.35 L 549.47 200.84 L 548.4 201.67 L 546.86 203.96 L 545.21 204.01 L 544.58 202.37 L 543.8 201.8 L 542.44 201.32 L 541.43 200.25 L 540.97 199.26 L 539.14 198.43 L 536.29 196.53 L 533.21 196.11 L 531.92 196.21 L 529.78 197.01 L 528.15 197.2 L 527.26 196.96 L 522.33 196.76 L 522.33 196.76 L 522.39 195.44 L 521.71 194.76 L 521.63 193.79 L 522.77 190.68 L 524.27 188.43 L 524.28 187.74 L 523.51 186.58 L 520.95 186.11 L 519.64 185.46 L 518.63 182.79 L 517.58 177.59 L 516.82 175.02 L 517.06 174.57 L 516.12 166.41 L 516.01 166.03 L 515.09 165.34 L 515.89 164.76 L 516.48 163.18 L 515.88 160.19 L 514.88 158.18 L 515.36 156.58 L 514.57 152.71 L 515.31 151.35 L 515.33 150.59 L 513.97 149 L 513.53 147.27 L 510.38 140.85 L 508.58 136.13 L 508.29 134.84 L 508.47 133.38 L 510.05 131.41 L 511.14 129.56 L 511.25 128.76 L 511.25 128.76 L 511.44 128.62 L 511.4 128 L 511 127.34 L 511.65 126.53 L 518.39 126.31 L 521.28 125.88 L 523.35 125.22 L 530.75 126.01 L 532.87 127.13 L 534.81 128.63 L 538.93 130.81 L 540.39 131.33 L 545.21 134.33 L 546.42 134.53 L 548.64 136.82 L 551.63 138.93 L 554.2 139.65 L 556.64 142.56 L 557.86 143.17 L 560.82 146.98 L 564.98 150.06 L 566.44 152.06 L 567.48 153.05 L 568.98 153.87 L 570.13 153.9 L 572.5 154.82 L 573.29 155.49 z"},{code:"DF",name:"Distrito Federal",gTransform:"matrix(1 0 0 1 103.1 10.18)",pathTransform:"translate(-409.11, -329.45)",d:"M 416.71 333.87 L 402.02 333.85 L 401.5 330.59 L 402.42 328.76 L 402.8 325.03 L 414.75 325.04 L 416.58 327.02 L 416.64 329.23 L 416.05 330.42 L 415.84 332.86 z"},{code:"ES",name:"Espírito Santo",gTransform:"matrix(1 0 0 1 212.62 72.56)",pathTransform:"translate(-518.62, -391.82)",d:"M 501.63 411.37 L 501.34 411.23 L 501.78 408.89 L 502.35 407.59 L 501.76 404.47 L 501.92 404.05 L 503.64 401.99 L 508.79 402.02 L 509.34 401.7 L 510.31 398.46 L 511.42 397.19 L 512.3 394.9 L 512.54 393.18 L 512.8 392.74 L 514.04 391.88 L 515.75 389.79 L 516.29 386.82 L 516 384.39 L 514.73 381.58 L 513.63 380.31 L 513.11 380.22 L 512.66 380.51 L 511.9 380.23 L 511.41 379.52 L 511.84 378.97 L 513.32 378.88 L 514.12 379.23 L 515.09 379.26 L 516.04 379.02 L 516.36 378.6 L 516.19 376.88 L 514.88 376.53 L 514.67 376.12 L 514.97 374.58 L 515 372.66 L 514.48 372 L 513.15 371.33 L 512.85 370.63 L 514.02 368.7 L 516.19 367.39 L 516.5 367.37 L 517.55 368.11 L 518.68 368.22 L 518.7 367.41 L 517.03 365.14 L 518.37 365.27 L 520.55 364.98 L 521.39 364.37 L 522.47 364.05 L 524.05 363.97 L 526.59 364.78 L 527.5 365.33 L 527.5 365.33 L 527.5 365.33 L 527.5 365.33 L 527.8 365.86 L 535.9 371 L 535.9 371 L 534.97 374.35 L 534.66 377.21 L 534.78 380.8 L 535.5 386.95 L 535.19 389.42 L 533.7 392.6 L 530.95 393.99 L 530.4 394.59 L 528.73 397.92 L 527.75 401.72 L 526.98 403.19 L 526.15 402.51 L 525.27 402.38 L 524.98 403.66 L 526.33 404.18 L 524.39 408.42 L 520.94 412.26 L 520.7 411.99 L 518.84 412.65 L 518.04 413.88 L 517.98 415.27 L 517.56 416.52 L 515.97 418.54 L 515.68 419.67 L 515.68 419.67 L 514.06 418.61 L 511.07 418.98 L 506.73 417.97 L 504.23 416.84 L 503.56 412.13 z"},{code:"GO",name:"Goiás",gTransform:"matrix(1 0 0 1 75.37 14.13)",pathTransform:"translate(-381.37, -333.38)",d:"M 416.71 333.87 L 415.84 332.86 L 416.05 330.42 L 416.64 329.23 L 416.58 327.02 L 414.75 325.04 L 402.8 325.03 L 402.42 328.76 L 401.5 330.59 L 402.02 333.85 L 416.71 333.87 L 416.71 333.87 L 416.71 333.87 L 416.71 333.87 L 416.18 335.39 L 416.49 336.96 L 415.81 338.55 L 414.77 339.8 L 414.36 341.27 L 415.21 342.48 L 416.06 342.82 L 417.48 343.85 L 419.13 348.41 L 419.13 349.01 L 416.81 351.72 L 413.57 354.73 L 413.14 356.87 L 414.23 357.98 L 415.13 357.51 L 416.71 358.08 L 417.18 358.69 L 417.36 359.69 L 417.19 360.4 L 416.46 361.3 L 415.95 363.19 L 417.14 366.65 L 414.05 368.71 L 412.89 368.91 L 412.03 369.81 L 411.55 370.93 L 406.66 373.67 L 405.96 372.9 L 401.61 371.04 L 401.06 371.52 L 400.48 371.61 L 398.73 371.62 L 397.25 371.34 L 393.39 371.5 L 391.38 370.61 L 387.25 373.25 L 384.34 376.17 L 384.01 376.17 L 382.7 374.75 L 381.18 374.45 L 377.99 376.09 L 374.28 375.47 L 371.8 376.43 L 369.57 376.97 L 368.16 379.07 L 366.95 381.53 L 367.01 382.53 L 366.17 383.83 L 365.35 384.11 L 364.51 383.95 L 364.06 384.09 L 363.12 384.83 L 361.48 386.93 L 360.91 388.83 L 361.47 389.44 L 361.46 389.78 L 361.1 390.01 L 360.24 389.55 L 360.24 389.55 L 360 389.1 L 357.34 386.86 L 354.19 386.25 L 352.57 384.7 L 350.67 384.27 L 349.18 384.23 L 345.83 382.89 L 345.15 382.04 L 342.08 380.48 L 341.41 379.87 L 339.97 379.16 L 338.83 378.99 L 336.13 377.31 L 333.35 377.47 L 329.55 376.77 L 329.42 376.44 L 329.68 375.6 L 330.25 374.43 L 331.56 372.67 L 331.48 372.25 L 329.23 371.35 L 328.09 372.02 L 327.43 371.83 L 327.15 371.42 L 326.92 370.31 L 327.18 367.73 L 326.99 365.96 L 326.99 365.96 L 326.04 363.76 L 325.86 360.33 L 324.45 358.14 L 324.29 357.43 L 324.69 354.02 L 327.24 350.17 L 327.62 347.26 L 328.32 346.49 L 330.34 345.65 L 332.26 343.88 L 333.51 341.86 L 333.84 339.91 L 334.34 338.9 L 335.62 337.86 L 336.44 336.43 L 336.52 334.89 L 338.27 333.92 L 339.67 331.3 L 342.32 331.17 L 345.04 330.31 L 345.36 330.03 L 347.34 325.84 L 348.05 324.88 L 348.69 320.78 L 349.07 320.04 L 350.99 318.1 L 352.64 317.09 L 353.71 316.83 L 354.94 317.51 L 356.15 316.78 L 357.54 315.35 L 358.38 312.42 L 359.55 309.55 L 359.54 308.75 L 359.06 307.61 L 359.64 304.87 L 361.24 301.78 L 361.12 296.6 L 362.33 295.82 L 363.36 293.19 L 365.36 290.02 L 365.75 288.95 L 365.59 286.23 L 365.94 285.33 L 366.91 284.47 L 367.18 283.34 L 367.1 282.71 L 367.1 282.71 L 367.44 282.26 L 367.64 280.38 L 368.3 279.15 L 370.11 277.06 L 370.67 276.76 L 370.64 278.47 L 369.42 280.35 L 368.9 282.69 L 371.3 283.09 L 373.5 284.12 L 377.43 284.52 L 380.52 286.23 L 384.59 287.66 L 385.22 287.43 L 386.85 281.49 L 388.32 279.1 L 389.5 278.13 L 390.65 279.44 L 391.69 281.32 L 392.8 285.03 L 393.41 288.13 L 394.55 288.18 L 395.3 287.43 L 395.6 286.43 L 396.16 285.89 L 398.92 286.23 L 403.45 285.7 L 403.67 286.44 L 403.11 288 L 406.24 289.47 L 409.59 290.15 L 410.28 290.07 L 410.79 286.77 L 411.34 286.8 L 412.85 289.42 L 413.31 289.66 L 415.09 288.76 L 417.61 286.68 L 422.14 285.68 L 423.69 285.68 L 426.25 284.58 L 427.99 283.24 L 433.35 281.82 L 433.35 281.82 L 436.07 284.28 L 436.09 284.66 L 434.66 285.72 L 434.18 288.24 L 434.28 288.57 L 435.91 289.41 L 435.85 290.35 L 435.62 290.73 L 434.03 291.76 L 432.84 295.59 L 432.79 297.14 L 433.41 300.66 L 435.11 304.12 L 438.32 306.74 L 438.37 307.21 L 437.65 308.63 L 437.55 309.3 L 438.22 311.02 L 438.45 312.3 L 438.2 313.07 L 436.72 315.04 L 436.72 315.04 L 435.72 316.05 L 432.49 315.71 L 431.59 313.95 L 429.17 312.47 L 428 313.96 L 428.58 317.73 L 428.01 318.27 L 427.61 318.4 L 424.83 317.26 L 423.66 317.49 L 423.29 317.77 L 422.57 320.95 L 423.29 321.05 L 423.78 322.21 L 423.21 323.15 L 422.48 323.85 L 422.52 325.75 L 422.94 326.36 L 423.47 326.55 L 424.16 330.81 L 423.63 331.34 L 420.27 332.24 L 417.98 333.75 z"},{code:"MA",name:"Maranhão",gTransform:"matrix(1 0 0 1 142.22 -148.63)",pathTransform:"translate(-448.22, -170.64)",d:"M 458.57 128.92 L 458.53 129.25 L 456.48999999999995 131.4 L 456.05999999999995 131.57 L 456.0199999999999 133.01 L 457.98999999999995 131.31 L 458.66999999999996 130.1 L 460.78999999999996 128.51999999999998 L 461.67999999999995 127.37999999999998 L 462.7099999999999 121.04999999999998 L 463.8599999999999 120.34999999999998 L 464.9699999999999 120.22999999999998 L 466.63999999999993 119.30999999999997 L 467.2899999999999 119.17999999999998 L 467.7499999999999 119.29999999999998 L 467.82999999999987 120.92999999999998 L 467.6299999999999 121.37999999999998 L 466.20999999999987 123.24999999999999 L 462.9999999999999 124.99999999999999 L 462.9699999999999 125.71999999999998 L 463.69999999999993 125.83999999999999 L 464.1499999999999 125.02999999999999 L 465.2999999999999 124.71999999999998 L 465.5199999999999 125.54999999999998 L 464.92999999999995 126.05999999999999 L 465.17999999999995 126.35999999999999 L 469.38999999999993 121.38999999999999 L 470.24999999999994 121.71999999999998 L 472.8299999999999 120.78999999999998 L 476.86999999999995 121.21999999999998 L 476.40999999999997 118.80999999999999 L 477.02 118.57999999999998 L 479.44 118.65999999999998 L 481.21999999999997 119.03999999999998 L 483.84999999999997 120.08999999999997 L 484.89 120.19999999999997 L 487.03999999999996 121.57999999999997 L 488.43999999999994 121.60999999999997 L 489.69999999999993 122.90999999999997 L 491.5899999999999 124.22999999999996 L 494.0899999999999 124.80999999999996 L 495.24999999999994 124.61999999999996 L 495.80999999999995 125.37999999999997 L 496.1499999999999 125.42999999999996 L 497.7399999999999 125.33999999999996 L 500.1999999999999 125.99999999999996 L 500.45999999999987 125.09999999999995 L 499.78999999999985 124.62999999999995 L 501.45999999999987 124.24999999999996 L 502.02999999999986 124.35999999999996 L 501.9399999999999 124.77999999999996 L 501.9399999999999 124.77999999999996 L 501.4799999999999 126.20999999999997 L 501.7099999999999 126.92999999999996 L 502.3399999999999 127.46999999999997 L 501.9599999999999 128.99999999999997 L 500.1699999999999 131.26999999999998 L 496.0399999999999 135.23999999999998 L 492.7199999999999 135.7 L 491.9199999999999 135.54 L 488.9999999999999 138.94 L 489.0399999999999 140.74 L 488.1599999999999 142.57000000000002 L 486.2699999999999 144.42000000000002 L 485.44999999999993 146.4 L 484.80999999999995 146.57 L 484.03999999999996 147.62 L 484.4 149.54 L 485.63 150.37 L 486.01 151.65 L 485.73 153.11 L 484.59000000000003 155.98000000000002 L 486.17 158.79000000000002 L 486.72 161.77 L 486.61 164.20000000000002 L 486.40000000000003 164.75000000000003 L 482.3 169.17000000000002 L 482.13 171.65 L 482.25 173.76000000000002 L 482.76 176.06000000000003 L 484.53999999999996 178.10000000000002 L 486.15 179.01000000000002 L 486.32 179.51000000000002 L 486.45 180.35000000000002 L 486.06 182.55 L 485.77 182.99 L 485.65 184.20000000000002 L 485.15 185.66000000000003 L 483.94 186.97000000000003 L 481.65 187.26000000000002 L 481 186.98000000000002 L 480.17 187.02 L 477.74 187.88000000000002 L 476.22 187.99000000000004 L 473.72 186.17000000000004 L 472.71000000000004 185.96000000000004 L 471.25000000000006 186.15000000000003 L 470.24000000000007 186.75000000000003 L 469.12000000000006 187.01000000000002 L 468.89000000000004 186.71 L 468.05000000000007 186.95000000000002 L 467.55000000000007 187.17000000000002 L 465.6500000000001 189.08 L 465.6600000000001 189.54000000000002 L 465.0300000000001 190.41000000000003 L 463.0200000000001 192.41000000000003 L 460.6800000000001 193.32000000000002 L 457.8100000000001 195.88000000000002 L 456.48000000000013 196.41000000000003 L 455.4300000000001 196.45000000000002 L 453.73000000000013 197.98000000000002 L 452.65000000000015 198.34000000000003 L 450.04000000000013 198.66000000000003 L 447.3200000000001 199.42000000000002 L 445.1900000000001 201.37 L 444.2100000000001 204.34 L 443.8200000000001 207.31 L 443.1900000000001 209.63 L 441.7400000000001 212.37 L 441.4400000000001 212.59 L 441.10000000000014 213.41 L 440.97000000000014 214.93 L 439.77000000000015 217.41 L 438.07000000000016 218.81 L 437.34000000000015 220.81 L 438.0500000000001 222.75 L 438.52000000000015 225.93 L 440.25000000000017 228.99 L 440.21000000000015 229.51000000000002 L 439.45000000000016 230.91000000000003 L 439.32000000000016 237.27000000000004 L 438.1700000000002 239.72000000000003 L 437.9100000000002 240.78000000000003 L 437.8600000000002 242.70000000000002 L 437.8600000000002 242.70000000000002 L 436.5800000000002 242.04000000000002 L 435.9700000000002 241.22000000000003 L 435.1500000000002 240.77000000000004 L 434.1600000000002 240.48000000000005 L 432.3800000000002 240.68000000000004 L 431.67000000000024 240.50000000000003 L 430.3200000000002 238.50000000000003 L 429.3300000000002 235.64000000000001 L 427.2000000000002 234.02 L 427.06000000000023 232.37 L 428.7000000000002 230.56 L 428.62000000000023 230.03 L 424.74000000000024 228.08 L 424.12000000000023 227.03 L 424.06000000000023 225.37 L 423.31000000000023 223.78 L 422.37000000000023 223.09 L 420.29000000000025 222.81 L 420.09000000000026 222.39000000000001 L 420.35000000000025 221.68 L 422.98000000000025 219.14000000000001 L 422.61000000000024 217.83 L 423.34000000000026 215.15 L 424.03000000000026 213.72 L 424.60000000000025 213.17 L 425.9400000000002 212.63 L 429.3300000000002 212.28 L 428.9400000000002 210.93 L 429.5800000000002 207.68 L 429.5000000000002 205.92000000000002 L 427.7000000000002 204.71 L 423.43000000000023 205.65 L 421.28000000000026 206.99 L 419.0100000000003 203.97 L 418.10000000000025 203.12 L 415.10000000000025 198.97 L 414.22000000000025 199.04 L 413.3800000000003 197.6 L 413.9900000000003 196.41 L 413.8800000000003 195.53 L 413.6300000000003 195.19 L 412.2600000000003 194.95 L 411.84000000000026 195.22 L 409.91000000000025 193.89 L 410.09000000000026 193.17999999999998 L 411.85000000000025 192.51999999999998 L 413.60000000000025 190.48 L 413.85000000000025 188.89 L 413.5700000000003 187.89 L 413.8800000000003 185.52999999999997 L 415.65000000000026 179.36999999999998 L 415.66000000000025 178.93999999999997 L 414.98000000000025 177.79999999999998 L 414.7500000000002 176.71999999999997 L 414.9600000000002 172.99999999999997 L 414.3200000000002 171.49999999999997 L 413.8500000000002 168.00999999999996 L 413.0100000000002 166.97999999999996 L 409.61000000000024 165.53999999999996 L 408.3900000000002 165.51999999999995 L 408.11000000000024 165.19999999999996 L 408.03000000000026 164.16999999999996 L 407.4400000000003 163.47999999999996 L 405.7000000000003 163.18999999999997 L 404.7400000000003 163.70999999999998 L 403.3400000000003 163.61999999999998 L 400.56000000000034 162.10999999999999 L 399.70000000000033 162.04999999999998 L 397.74000000000035 162.57999999999998 L 395.12000000000035 164.42999999999998 L 394.5900000000004 165.06999999999996 L 394.5900000000004 165.06999999999996 L 394.10000000000036 164.98999999999995 L 408.81000000000034 153.15999999999994 L 411.16000000000037 153.38999999999993 L 412.3300000000004 152.46999999999994 L 413.8800000000004 150.29999999999995 L 414.3100000000004 149.14999999999995 L 415.8600000000004 147.97999999999996 L 416.4800000000004 145.09999999999997 L 417.6000000000004 144.63999999999996 L 420.0400000000004 142.31999999999996 L 420.51000000000045 141.10999999999996 L 420.80000000000047 139.20999999999995 L 422.4000000000005 134.51999999999995 L 424.36000000000047 132.97999999999996 L 425.8400000000005 131.21999999999997 L 426.67000000000047 129.76999999999998 L 427.13000000000045 128.48999999999998 L 426.95000000000044 126.66999999999999 L 427.74000000000046 125.85999999999999 L 426.70000000000044 124.27999999999999 L 430.38000000000045 121.18999999999998 L 430.25000000000045 119.54999999999998 L 430.75000000000045 117.16999999999999 L 432.49000000000046 115.6 L 432.8500000000005 114.89 L 433.75000000000045 111.87 L 433.83000000000044 110.26 L 433.40000000000043 109.73 L 432.4100000000004 109.89 L 432.14000000000044 109.4 L 432.19000000000045 108.78 L 433.33000000000044 108.63 L 433.90000000000043 107.89 L 434.6100000000004 103.5 L 434.4500000000004 102.12 L 434.9200000000004 101.09 L 435.6900000000004 100.64 L 435.6900000000004 100.64 L 436.3200000000004 100.64 L 436.5600000000004 100.4 L 436.5000000000004 99.86 L 436.8400000000004 99.11 L 437.42000000000036 98.58 L 438.76000000000033 99.56 L 439.2100000000003 101.4 L 440.4000000000003 101.52000000000001 L 441.1700000000003 100.16000000000001 L 441.7800000000003 103.09000000000002 L 442.7700000000003 103.13000000000002 L 443.06000000000034 102.64000000000003 L 443.13000000000034 101.70000000000003 L 443.98000000000036 101.66000000000003 L 445.67000000000036 102.19000000000003 L 446.17000000000036 102.88000000000002 L 444.74000000000035 104.58000000000003 L 445.41000000000037 105.28000000000003 L 445.43000000000035 105.83000000000003 L 446.6400000000003 103.79000000000002 L 447.13000000000034 102.25000000000001 L 447.5800000000003 102.25000000000001 L 447.9800000000003 103.27000000000001 L 447.9800000000003 103.85000000000001 L 447.1100000000003 104.77000000000001 L 446.8400000000003 105.76 L 446.9200000000003 108.47 L 447.1800000000003 108.8 L 447.6500000000003 108.92 L 448.2300000000003 108.78 L 449.1900000000003 107.85 L 448.72000000000025 106.85 L 448.86000000000024 106.25 L 450.18000000000023 104.82 L 451.23000000000025 104.57 L 453.36000000000024 105.16 L 454.86000000000024 104.05 L 454.91000000000025 104.97 L 454.55000000000024 105.17999999999999 L 453.42000000000024 106.71 L 454.0100000000002 107.28999999999999 L 454.11000000000024 106.91999999999999 L 455.36000000000024 106.32 L 455.9400000000002 107.11 L 455.80000000000024 108.32 L 457.43000000000023 110.07 L 458.29000000000025 109.63 L 459.87000000000023 110.3 L 460.6400000000002 112.7 L 460.5300000000002 113.65 L 458.3400000000002 116.38000000000001 L 457.9600000000002 117.27000000000001 L 458.06000000000023 117.93 L 458.66000000000025 116.9 L 460.41000000000025 115.22 L 461.24000000000024 115.19 L 462.11000000000024 116 L 462.6300000000002 117.89 L 462.36000000000024 119.12 L 461.3900000000002 119.31 L 460.36000000000024 120.22 L 459.2000000000002 121.71 L 459.2700000000002 122.47999999999999 L 458.1100000000002 124.82999999999998 L 457.4900000000002 128.35 L 457.70000000000016 128.69 L 458.57 128.92 z M 459.09 129.37 L 459.03 128.58 L 459.55999999999995 127.05000000000001 L 459.1499999999999 125.98000000000002 L 459.2799999999999 125.32000000000002 L 460.18999999999994 124.08000000000003 L 460.73999999999995 123.89000000000003 L 460.78999999999996 126.24000000000002 L 460.56999999999994 127.58000000000003 L 459.7699999999999 128.18000000000004 L 459.09 129.37 z M 452.79 103.61 L 452.35 103.15 L 452.27000000000004 102.55000000000001 L 453.07000000000005 101.43 L 453.91 101.4 L 454.59000000000003 101.82000000000001 L 454.69000000000005 102.16000000000001 L 454.50000000000006 102.52000000000001 L 452.79 103.61 z M 456.29 107.79 L 456 107.49000000000001 L 456.06 106.96000000000001 L 457.12 106.07000000000001 L 457.6 106.14 L 458.1 106.99 L 457.96000000000004 107.6 L 457.56000000000006 107.42999999999999 L 456.29 107.79 z M 442.13 102.98 L 441.92 102.93 L 442.87 99.35000000000001 L 443.17 99.44000000000001 L 443.2 99.67000000000002 L 442.78999999999996 102.73000000000002 L 442.13 102.98 z"},{code:"MG",name:"Minas Gerais",gTransform:"matrix(1 0 0 1 139.79 56.66)",pathTransform:"translate(-445.79, -375.93)",d:"M 527.5 365.33 L 526.59 364.78 L 524.05 363.97 L 522.47 364.05 L 521.39 364.37 L 520.55 364.98 L 518.37 365.27 L 517.03 365.14 L 518.7 367.41 L 518.68 368.22 L 517.55 368.11 L 516.5 367.37 L 516.19 367.39 L 514.02 368.7 L 512.85 370.63 L 513.15 371.33 L 514.48 372 L 515 372.66 L 514.97 374.58 L 514.67 376.12 L 514.88 376.53 L 516.19 376.88 L 516.36 378.6 L 516.04 379.02 L 515.09 379.26 L 514.12 379.23 L 513.32 378.88 L 511.84 378.97 L 511.41 379.52 L 511.9 380.23 L 512.66 380.51 L 513.11 380.22 L 513.63 380.31 L 514.73 381.58 L 516 384.39 L 516.29 386.82 L 515.75 389.79 L 514.04 391.88 L 512.8 392.74 L 512.54 393.18 L 512.3 394.9 L 511.42 397.19 L 510.31 398.46 L 509.34 401.7 L 508.79 402.02 L 503.64 401.99 L 501.92 404.05 L 501.76 404.47 L 502.35 407.59 L 501.78 408.89 L 501.34 411.23 L 501.63 411.37 L 501.63 411.37 L 499.1 413.72 L 497.86 413.99 L 497.3 414.49 L 498.04 415.19 L 495.68 421.24 L 493.78 424.95 L 493.69 425.7 L 495.13 425.83 L 495.42 426.44 L 495.21 426.96 L 492.68 427.94 L 483.17 432.47 L 481.8 432.67 L 481.82 432.21 L 481.33 432.04 L 478.8 431.77 L 478.23 431.83 L 476.61 432.77 L 475.36 432.93 L 472.16 433.01 L 471.8 432.69 L 471.29 432.77 L 467.19 434.55 L 466.14 435.32 L 464.43 436.09 L 463.93 435.81 L 461.34 435.98 L 458.43 437.32 L 456.01 438.06 L 455.33 438.55 L 455.33 438.55 L 454.08 439.28 L 451.88 439.5 L 449.95 440.52 L 448.72 441.76 L 446.93 442.43 L 444.55 442.68 L 442.21 442.6 L 442.2 442.11 L 442.55 441.62 L 442.46 441.27 L 441.27 441.6 L 441.09 443.9 L 441.33 444.13 L 441.28 444.97 L 440.53 445.95 L 439.23 446.27 L 438.66 445.84 L 435.05 446.84 L 434.86 446.31 L 432.85 446.55 L 431.73 446.3 L 429.7 442.99 L 430.92 442.28 L 430.4 440.57 L 428.6 439.74 L 426.81 438.51 L 426.1 436.9 L 426.63 435.34 L 426.82 431.89 L 426.56 428.95 L 428.42 426.23 L 429.12 424.05 L 429.17 422.78 L 428.94 422.41 L 425.24 421.09 L 424.24 421.14 L 423.96 421.5 L 423.18 421.81 L 421.57 421.86 L 421.6 421.01 L 420.77 419.02 L 419.47 417.23 L 419.1 415.02 L 418.79 414.4 L 418 413.66 L 418.19 411.72 L 419.71 409.69 L 419.77 409.13 L 419.37 407.58 L 417.49 406.37 L 416.91 405.76 L 417.2 403.39 L 417.77 402.38 L 417.57 401.34 L 414.3 397.99 L 413 398.28 L 412.15 398.92 L 410.5 398.14 L 408.12 398.25 L 407.81 398.86 L 408.01 399.32 L 407.57 400.31 L 404.79 400.99 L 403.68 400.56 L 402.17 399.11 L 401.16 400.36 L 392.98 401.04 L 392.52 401.52 L 392.04 402.71 L 392.31 405.25 L 391.9 405.69 L 390.71 405.17 L 390.7 402.39 L 390.45 401.43 L 390.09 401.04 L 389.53 400.99 L 389.27 401.18 L 388.86 402.31 L 388.19 403.25 L 387.65 403.57 L 387.03 403.55 L 385.82 401.45 L 385.49 400.03 L 385.63 399.12 L 383.95 398.33 L 381.77 396.91 L 379.78 397.5 L 378.16 397.28 L 376.49 397.63 L 372.2 396.67 L 369.65 396.59 L 367.92 395.04 L 367.17 394.9 L 365.67 395.51 L 364.24 397.2 L 362.32 397.57 L 360.17 398.68 L 358.95 399.81 L 358.95 399.81 L 359.26 397.19 L 358.67 393.98 L 359.66 389.8 L 360.24 389.55 L 360.24 389.55 L 361.1 390.01 L 361.46 389.78 L 361.47 389.44 L 360.91 388.83 L 361.48 386.93 L 363.12 384.83 L 364.06 384.09 L 364.51 383.95 L 365.35 384.11 L 366.17 383.83 L 367.01 382.53 L 366.95 381.53 L 368.16 379.07 L 369.57 376.97 L 371.8 376.43 L 374.28 375.47 L 377.99 376.09 L 381.18 374.45 L 382.7 374.75 L 384.01 376.17 L 384.34 376.17 L 387.25 373.25 L 391.38 370.61 L 393.39 371.5 L 397.25 371.34 L 398.73 371.62 L 400.48 371.61 L 401.06 371.52 L 401.61 371.04 L 405.96 372.9 L 406.66 373.67 L 411.55 370.93 L 412.03 369.81 L 412.89 368.91 L 414.05 368.71 L 417.14 366.65 L 415.95 363.19 L 416.46 361.3 L 417.19 360.4 L 417.36 359.69 L 417.18 358.69 L 416.71 358.08 L 415.13 357.51 L 414.23 357.98 L 413.14 356.87 L 413.57 354.73 L 416.81 351.72 L 419.13 349.01 L 419.13 348.41 L 417.48 343.85 L 416.06 342.82 L 415.21 342.48 L 414.36 341.27 L 414.77 339.8 L 415.81 338.55 L 416.49 336.96 L 416.18 335.39 L 416.71 333.87 L 417.98 333.75 L 420.27 332.24 L 423.63 331.34 L 424.16 330.81 L 423.47 326.55 L 422.94 326.36 L 422.52 325.75 L 422.48 323.85 L 423.21 323.15 L 423.78 322.21 L 423.29 321.05 L 422.57 320.95 L 423.29 317.77 L 423.66 317.49 L 424.83 317.26 L 427.61 318.4 L 428.01 318.27 L 428.58 317.73 L 428 313.96 L 429.17 312.47 L 431.59 313.95 L 432.49 315.71 L 435.72 316.05 L 436.72 315.04 L 436.72 315.04 L 437.23 317.45 L 435.8 320.89 L 436.2 321.12 L 437.54 320.21 L 438.24 319.21 L 438.96 319.08 L 441.09 319.46 L 442.13 318.69 L 443.98 316.12 L 444.97 316.27 L 446.4 315.74 L 448.21 314.19 L 449.16 313.02 L 451.18 312.61 L 454.55 310.75 L 455.19 309.64 L 459.46 306.61 L 463.28 305.03 L 465.08 305.12 L 466.28 305.62 L 468.46 305.65 L 470.74 306.18 L 471.59 306.64 L 470.3 309.38 L 470.15 310.27 L 470.41 311.76 L 471.02 312.26 L 476.35 313.72 L 476.99 313.55 L 477.8 312.43 L 479.68 311.54 L 481.45 311.28 L 484.18 312.03 L 485.28 312.57 L 489.63 316.21 L 490.61 316.03 L 492.78 317.65 L 495.31 318.87 L 496.24 319.09 L 496.75 318.88 L 498.28 320.12 L 502.67 318.89 L 503.05 319.07 L 509.57 325.27 L 510.01 329.23 L 510.58 329.02 L 513.19 329.47 L 514.66 328.97 L 515.98 327.98 L 517.97 328.13 L 520.7 328.69 L 522.96 329.77 L 525.15 330.38 L 527.27 330.35 L 530.1 332.82 L 530.83 333.2 L 531.72 333.27 L 532.5 334.29 L 532.92 335.46 L 531.45 338.54 L 526.49 342.76 L 526.34 345.41 L 526.9 346.43 L 526.9 346.85 L 525.88 347.56 L 523.4 347.32 L 522.58 348.2 L 521.76 351.5 L 521.23 355.9 L 521.45 356.15 L 521.8 355.96 L 522 355.51 L 522.64 355.27 L 523.22 356.5 L 523 358.01 L 523.15 358.52 L 527.29 361.58 L 527.82 362.62 L 527.83 363.15 L 527.15 364.5 z"},{code:"MS",name:"Mato Grosso do Sul",gTransform:"matrix(1 0 0 1 -2.22 90.13)",pathTransform:"translate(-303.77, -409.4)",d:"M 358.95 399.81 L 358.55 402.27 L 358.27 402.67 L 356.77 403.45 L 355.45 403.49 L 354.98 403.71 L 353.76 404.74 L 351.77 407.42 L 351.04 408.07 L 350.03 408.37 L 349.41 410.05 L 349.25 412.98 L 346.66 416.62 L 345.7 417.14 L 345.47 417.52 L 345.78 419.45 L 345.7 420.4 L 344.49 422.74 L 342.49 425 L 342.84 425.85 L 342.56 427.06 L 341.12 428.09 L 340.72 429.3 L 338.99 430.99 L 337.73 433.43 L 335.78 435.3 L 328.22 439.83 L 326.96 440.97 L 326.22 442.51 L 325.38 443.59 L 325.38 443.59 L 319.97 445.86 L 318.86 446.68 L 317.93 449.01 L 317.95 450.16 L 316.5 453.72 L 315.83 454.4 L 314.17 455.41 L 313.06 455.73 L 312.73 456.08 L 311.16 464 L 310.8 464.82 L 308.42 466.38 L 308.42 466.38 L 305.87 464.05 L 302.46 462.16 L 298.47 464.13 L 297.79 464.88 L 296.13 465.37 L 293.55 465.8 L 291.19 465.34 L 290.18 464.69 L 289.71 460.42 L 289.39 459.72 L 288.49 458.77 L 288.26 456.3 L 288.77 454.96 L 288.13 454.17 L 288.04 453.73 L 288.04 450.86 L 287.15 448.89 L 286.55 446.15 L 286.5 445.43 L 287.09 444.07 L 287.11 442.46 L 285.54 441.37 L 285.16 440.57 L 285 438.41 L 283.35 436.59 L 281.18 436.33 L 279.67 436.64 L 277.84 436.35 L 275.38 434.39 L 274.82 432.9 L 273.28 433.23 L 271.11 435.97 L 270.11 435.37 L 268.39 436.18 L 267.31 436.34 L 265.57 435.65 L 263.01 435.16 L 259.55 435.39 L 255.89 434.68 L 255.41 433.77 L 253.42 433.64 L 252.53 434.16 L 250.03 433.28 L 250.94 426.01 L 250.51 423.63 L 251.11 422.21 L 252.09 420.75 L 252.69 414.72 L 252.03 412.39 L 251.98 410.66 L 251.22 409.7 L 250.79 409.61 L 250.3 410.26 L 249.66 407 L 248.87 405.13 L 247.66 403.11 L 247.31 401.28 L 251.34 398.98 L 252.1 398.1 L 247.9 394.24 L 253.28 382.82 L 254.4 382.76 L 254.12 380.63 L 253.38 380.5 L 256.61 370.17 L 257.27 369.01 L 254.18 363.16 L 254.21 361.25 L 254.21 361.25 L 254.91 361.45 L 255.93 362.55 L 258.08 364.07 L 263.7 362.1 L 265.75 360.1 L 267.77 357.15 L 267.86 355.98 L 269.26 354.53 L 271.85 354.56 L 273.41 354.34 L 274.18 354.68 L 275.84 354.17 L 277.19 352.92 L 279.21 352.43 L 280.48 352.63 L 281.24 353.78 L 284.03 355.03 L 286.65 355.5 L 287.3 355.85 L 287.57 356.71 L 288.35 357.73 L 291.38 358.89 L 292.64 360 L 293.88 360.57 L 298.4 359.94 L 299.66 359.14 L 300.15 358.29 L 301.58 357.68 L 304.02 357.75 L 305.61 358.79 L 305.91 360.16 L 306.15 360.41 L 307.14 360.45 L 309.27 359.57 L 310.28 359.63 L 315.9 353.62 L 317.24 353.49 L 316.01 360.1 L 314.21 360.8 L 312.55 363.63 L 312.36 364.09 L 312.51 364.62 L 313.81 364.73 L 315.55 366 L 320.17 366.27 L 320.74 365.7 L 323.4 365.62 L 324.27 365.7 L 325.44 366.27 L 326.99 365.96 L 326.99 365.96 L 327.18 367.73 L 326.92 370.31 L 327.15 371.42 L 327.43 371.83 L 328.09 372.02 L 329.23 371.35 L 331.48 372.25 L 331.56 372.67 L 330.25 374.43 L 329.68 375.6 L 329.42 376.44 L 329.55 376.77 L 333.35 377.47 L 336.13 377.31 L 338.83 378.99 L 339.97 379.16 L 341.41 379.87 L 342.08 380.48 L 345.15 382.04 L 345.83 382.89 L 349.18 384.23 L 350.67 384.27 L 352.57 384.7 L 354.19 386.25 L 357.34 386.86 L 360 389.1 L 360.24 389.55 L 360.24 389.55 L 359.66 389.8 L 358.67 393.98 L 359.26 397.19 z"},{code:"MT",name:"Mato Grosso",gTransform:"matrix(1 0 0 1 -23.8 -38.15)",pathTransform:"translate(-282.2, -281.12)",d:"M 206.96 296.05 L 208.43 294.62 L 212.54 292.05 L 213.06 289.6 L 214.49 285.82 L 215.42 284.74 L 217.06 284.21 L 217.49 283.8 L 218.07 282.96 L 218.59 280.71 L 220.25 278.7 L 220.81 276.46 L 220.88 274.75 L 220.3 273.26 L 220.34 271.21 L 218.81 267.87 L 217.91 267.9 L 217.33 267.39 L 216.9 264.14 L 217.04 262.82 L 218.4 261.74 L 219.8 259.99 L 219.97 259.24 L 218.56 255.65 L 217.49 255.22 L 216.38 255.11 L 212.88 255.2 L 211.66 254.09 L 211.9 253.53 L 194.74 253.48 L 195.64 244.48 L 194.14 241.73 L 193.87 239.97 L 193.9 239.17 L 194.9 235.65 L 194.52 233.72 L 195.46 232.05 L 194.63 229.78 L 194.48 228.39 L 194.22 227.78 L 193.44 227.31 L 193.38 226.96 L 194.67 221.97 L 195.43 220.55 L 194.83 219.31 L 193.43 218.34 L 193.43 218.34 L 241.28 218.02 L 242.49 217.29 L 243.67 212.07 L 245.05 207.85 L 244.59 205.91 L 243.93 204.54 L 243.83 203.69 L 244.25 202.84 L 245.11 202.2 L 246.31 200.38 L 246.58 199.37 L 246.24 198.53 L 246.3 197.77 L 246.5 197.16 L 247.68 195.96 L 247.68 195.96 L 248.85 197.04 L 251.3 201.1 L 251.7 202.86 L 253.07 206.82 L 254.39 208.75 L 255.16 210.37 L 254.93 212.81 L 255.41 215.21 L 256.14 217.41 L 257.67 218.52 L 260.67 221.27 L 264.05 222.97 L 264.28 223.91 L 264.24 225.01 L 264.47 225.5 L 265.42 225.9 L 266.24 225.73 L 267.87 226.18 L 268.41 226.9 L 268.61 227.98 L 268.96 228.3 L 270.33 227.85 L 274.02 229.34 L 308.06 231.76 L 371.03 235.24 L 371.03 235.24 L 370.38 236.26 L 369.82 238.15 L 368.72 239.4 L 368.28 242.54 L 367.85 243.39 L 367.48 243.66 L 365.54 248.95 L 365 251.92 L 364.96 254.87 L 363.08 260.86 L 363.14 261.72 L 364.53 263.06 L 364.37 263.93 L 363.55 264.82 L 363.5 265.32 L 364.6 267.57 L 364.13 270.88 L 364.14 272.45 L 364.66 273.03 L 365.1 276.08 L 364.36 278.84 L 365.34 282.18 L 366.3 282.69 L 367.1 282.71 L 367.1 282.71 L 367.18 283.34 L 366.91 284.47 L 365.94 285.33 L 365.59 286.23 L 365.75 288.95 L 365.36 290.02 L 363.36 293.19 L 362.33 295.82 L 361.12 296.6 L 361.24 301.78 L 359.64 304.87 L 359.06 307.61 L 359.54 308.75 L 359.55 309.55 L 358.38 312.42 L 357.54 315.35 L 356.15 316.78 L 354.94 317.51 L 353.71 316.83 L 352.64 317.09 L 350.99 318.1 L 349.07 320.04 L 348.69 320.78 L 348.05 324.88 L 347.34 325.84 L 345.36 330.03 L 345.04 330.31 L 342.32 331.17 L 339.67 331.3 L 338.27 333.92 L 336.52 334.89 L 336.44 336.43 L 335.62 337.86 L 334.34 338.9 L 333.84 339.91 L 333.51 341.86 L 332.26 343.88 L 330.34 345.65 L 328.32 346.49 L 327.62 347.26 L 327.24 350.17 L 324.69 354.02 L 324.29 357.43 L 324.45 358.14 L 325.86 360.33 L 326.04 363.76 L 326.99 365.96 L 326.99 365.96 L 325.44 366.27 L 324.27 365.7 L 323.4 365.62 L 320.74 365.7 L 320.17 366.27 L 315.55 366 L 313.81 364.73 L 312.51 364.62 L 312.36 364.09 L 312.55 363.63 L 314.21 360.8 L 316.01 360.1 L 317.24 353.49 L 315.9 353.62 L 310.28 359.63 L 309.27 359.57 L 307.14 360.45 L 306.15 360.41 L 305.91 360.16 L 305.61 358.79 L 304.02 357.75 L 301.58 357.68 L 300.15 358.29 L 299.66 359.14 L 298.4 359.94 L 293.88 360.57 L 292.64 360 L 291.38 358.89 L 288.35 357.73 L 287.57 356.71 L 287.3 355.85 L 286.65 355.5 L 284.03 355.03 L 281.24 353.78 L 280.48 352.63 L 279.21 352.43 L 277.19 352.92 L 275.84 354.17 L 274.18 354.68 L 273.41 354.34 L 271.85 354.56 L 269.26 354.53 L 267.86 355.98 L 267.77 357.15 L 265.75 360.1 L 263.7 362.1 L 258.08 364.07 L 255.93 362.55 L 254.91 361.45 L 254.21 361.25 L 254.21 361.25 L 253.55 360.58 L 253.23 359.78 L 253.77 359.07 L 251.33 356.92 L 250.05 357.55 L 249.53 357.5 L 248.36 356.82 L 247.91 356.12 L 245.89 354.71 L 244 353.95 L 243.7 353.63 L 243.4 352.51 L 243.17 349.58 L 242.56 347.81 L 242.37 344.15 L 243.25 342.51 L 244.39 341.42 L 244.73 339.64 L 244.68 337.75 L 243.72 337.81 L 243.32 338.41 L 242.94 338.57 L 216.08 337.49 L 215.03 324.84 L 209.66 318.71 L 214.54 318.65 L 214.19 311.1 L 211.55 305.78 L 211.06 303.81 L 211.32 302.75 L 211.93 302.2 L 212.58 300.92 L 211.14 297.99 L 208.03 296.95 z"},{code:"PA",name:"Pará",gTransform:"matrix(1 0 0 1 29.16 -180.48)",pathTransform:"translate(-335.15, -138.78)",d:"M 371.03 235.24 L 308.05999999999995 231.76000000000002 L 274.0199999999999 229.34000000000003 L 270.3299999999999 227.85000000000002 L 268.9599999999999 228.3 L 268.6099999999999 227.99 L 268.4099999999999 226.9 L 267.8599999999999 226.18 L 266.2299999999999 225.73000000000002 L 265.4099999999999 225.9 L 264.4599999999999 225.51000000000002 L 264.2299999999999 225.01000000000002 L 264.2699999999999 223.91000000000003 L 264.0399999999999 222.97000000000003 L 260.6599999999999 221.27000000000004 L 257.6599999999999 218.51000000000005 L 256.1199999999999 217.40000000000003 L 255.3999999999999 215.20000000000005 L 254.9199999999999 212.81000000000006 L 255.1499999999999 210.37000000000006 L 254.37999999999988 208.74000000000007 L 253.04999999999987 206.81000000000006 L 251.67999999999986 202.86000000000007 L 251.28999999999988 201.10000000000008 L 248.8399999999999 197.04000000000008 L 247.65999999999988 195.96000000000006 L 247.65999999999988 195.96000000000006 L 247.0899999999999 195.40000000000006 L 246.93999999999988 193.44000000000005 L 246.2999999999999 192.18000000000006 L 244.7099999999999 190.62000000000006 L 243.6399999999999 190.04000000000005 L 243.2699999999999 189.47000000000006 L 242.43999999999988 187.13000000000005 L 242.46999999999989 186.00000000000006 L 243.0499999999999 185.03000000000006 L 244.4999999999999 183.90000000000006 L 245.2799999999999 182.59000000000006 L 275.1799999999999 118.35000000000007 L 273.3699999999999 116.68000000000006 L 273.4999999999999 115.90000000000006 L 273.3099999999999 115.42000000000006 L 271.9199999999999 115.77000000000005 L 271.0699999999999 116.38000000000005 L 269.1999999999999 115.60000000000005 L 268.09999999999985 113.43000000000005 L 265.40999999999985 111.98000000000005 L 264.1399999999999 110.64000000000004 L 264.0599999999999 110.04000000000005 L 262.7399999999999 109.22000000000006 L 261.3699999999999 109.07000000000005 L 259.1199999999999 108.42000000000004 L 256.7399999999999 107.11000000000004 L 254.8599999999999 106.44000000000004 L 253.5099999999999 105.35000000000004 L 252.8799999999999 104.45000000000003 L 248.2999999999999 101.91000000000003 L 243.6599999999999 98.14000000000003 L 243.3599999999999 97.70000000000003 L 243.3199999999999 96.77000000000002 L 242.7699999999999 94.94000000000003 L 240.9299999999999 93.71000000000002 L 240.2299999999999 93.90000000000002 L 239.8699999999999 93.70000000000002 L 238.03999999999988 91.72000000000001 L 238.0899999999999 89.61000000000001 L 238.43999999999988 88.92000000000002 L 238.25999999999988 88.51000000000002 L 236.56999999999988 87.66000000000003 L 236.32999999999987 86.98000000000002 L 236.14999999999986 84.71000000000002 L 236.57999999999987 83.26000000000002 L 236.17999999999986 78.40000000000002 L 236.17999999999986 78.40000000000002 L 234.58999999999986 61.43000000000002 L 234.58999999999986 61.43000000000002 L 235.33999999999986 61.75000000000002 L 235.76999999999987 62.33000000000002 L 235.74999999999986 62.81000000000002 L 236.19999999999985 63.210000000000015 L 237.11999999999983 63.490000000000016 L 238.48999999999984 62.780000000000015 L 238.95999999999984 61.97000000000001 L 241.66999999999985 62.20000000000001 L 242.47999999999985 61.15000000000001 L 241.93999999999986 59.34000000000001 L 243.72999999999985 58.98000000000001 L 245.13999999999984 57.35000000000001 L 247.77999999999983 58.36000000000001 L 249.65999999999983 58.39000000000001 L 250.19999999999982 56.870000000000005 L 253.52999999999983 55.25000000000001 L 255.49999999999983 55.64000000000001 L 256.65999999999985 55.53000000000001 L 257.14999999999986 55.28000000000001 L 258.34999999999985 53.80000000000001 L 258.74999999999983 52.40000000000001 L 260.2099999999998 51.30000000000001 L 261.0699999999998 51.19000000000001 L 261.7199999999998 51.65000000000001 L 263.8299999999998 50.52000000000001 L 264.23999999999984 50.63000000000001 L 264.60999999999984 51.62000000000001 L 265.33999999999986 52.070000000000014 L 267.36999999999983 52.55000000000001 L 268.97999999999985 52.80000000000001 L 269.53999999999985 52.20000000000001 L 271.20999999999987 51.81000000000001 L 271.98999999999984 52.09000000000001 L 272.80999999999983 52.08000000000001 L 273.66999999999985 51.74000000000001 L 275.90999999999985 52.040000000000006 L 280.57999999999987 53.42000000000001 L 281.53999999999985 53.28000000000001 L 282.53999999999985 52.41000000000001 L 282.5099999999999 50.13000000000001 L 280.4399999999999 47.63000000000001 L 279.1999999999999 47.00000000000001 L 279.6899999999999 45.32000000000001 L 280.9999999999999 43.870000000000005 L 281.27999999999986 42.760000000000005 L 281.58999999999986 42.59 L 282.29999999999984 42.78 L 283.1299999999998 43.54 L 285.47999999999985 44.65 L 297.09999999999985 42.32 L 298.66999999999985 44.01 L 299.6899999999998 44.07 L 300.1299999999998 43.78 L 300.1299999999998 43.78 L 300.74999999999983 44.35 L 301.11999999999983 46.65 L 300.49999999999983 47.949999999999996 L 300.24999999999983 52.489999999999995 L 300.48999999999984 53.92999999999999 L 300.79999999999984 54.46999999999999 L 301.96999999999986 54.489999999999995 L 303.04999999999984 54.199999999999996 L 306.4399999999998 54.56999999999999 L 307.72999999999985 55.059999999999995 L 309.65999999999985 56.10999999999999 L 310.32999999999987 56.90999999999999 L 310.8199999999999 58.18999999999999 L 312.0099999999999 58.30999999999999 L 313.14999999999986 59.14999999999999 L 313.9499999999999 60.12999999999999 L 314.78999999999985 60.39999999999999 L 316.11999999999983 60.25999999999999 L 316.49999999999983 59.83999999999999 L 317.4399999999998 59.69999999999999 L 320.2799999999998 62.359999999999985 L 320.9599999999998 62.329999999999984 L 321.4499999999998 63.509999999999984 L 320.7699999999998 63.73999999999998 L 320.5799999999998 64.45999999999998 L 321.3399999999998 67.28999999999998 L 323.3599999999998 69.54999999999998 L 325.9299999999998 70.27999999999999 L 326.0999999999998 70.60999999999999 L 325.6699999999998 73.74999999999999 L 325.8599999999998 75.85999999999999 L 326.5299999999998 77.36999999999999 L 327.1499999999998 77.92999999999999 L 327.7399999999998 79.74 L 327.6099999999998 81.32 L 329.1099999999998 84.8 L 329.9299999999998 84.99 L 330.70999999999975 84.63 L 333.63999999999976 87.91 L 333.5599999999998 90.34 L 333.9699999999998 91.28 L 334.9199999999998 91.47 L 335.2499999999998 91.94 L 335.5599999999998 93.52 L 335.3499999999998 94.21 L 335.4599999999998 95.50999999999999 L 337.3299999999998 96.89999999999999 L 337.7599999999998 98.39999999999999 L 339.2099999999998 99.42999999999999 L 341.99999999999983 100.11 L 343.29999999999984 99.99 L 344.0699999999998 99.64999999999999 L 345.0099999999998 99.71 L 345.0099999999998 99.71 L 344.47999999999985 100.44999999999999 L 344.76999999999987 102.03999999999999 L 344.59999999999985 102.57 L 343.30999999999983 103.67999999999999 L 341.91999999999985 103.85 L 341.41999999999985 103.66999999999999 L 340.57999999999987 102.87999999999998 L 339.91999999999985 102.72999999999998 L 336.53999999999985 104.30999999999997 L 336.16999999999985 104.84999999999998 L 334.5699999999998 105.56999999999998 L 333.9399999999998 105.54999999999998 L 332.3899999999998 106.13999999999999 L 332.42999999999984 106.71999999999998 L 338.8899999999998 105.65999999999998 L 339.7699999999998 106.31999999999998 L 339.8999999999998 106.77999999999997 L 339.8999999999998 107.43999999999997 L 339.2799999999998 107.93999999999997 L 339.5799999999998 108.29999999999997 L 340.2099999999998 108.09999999999997 L 341.0699999999998 107.09999999999997 L 342.0899999999998 107.08999999999996 L 342.6199999999998 106.81999999999996 L 343.2199999999998 106.93999999999997 L 344.2899999999998 106.51999999999997 L 345.4299999999998 105.94999999999997 L 348.70999999999975 103.60999999999997 L 350.20999999999975 103.25999999999998 L 352.0499999999997 102.44999999999997 L 355.20999999999975 100.60999999999997 L 355.7499999999998 99.60999999999997 L 356.4199999999998 99.08999999999997 L 358.50999999999976 98.07999999999997 L 359.1699999999998 97.35999999999997 L 358.9199999999998 96.68999999999997 L 359.12999999999977 96.27999999999997 L 360.25999999999976 95.99999999999997 L 361.34999999999974 96.05999999999997 L 361.75999999999976 96.26999999999997 L 362.13999999999976 100.06999999999996 L 361.6199999999998 102.64999999999996 L 361.94999999999976 104.26999999999997 L 362.75999999999976 105.86999999999996 L 364.06999999999977 107.21999999999996 L 364.3699999999998 108.85999999999996 L 364.2499999999998 109.32999999999996 L 362.4099999999998 111.16999999999996 L 361.93999999999977 111.29999999999995 L 361.06999999999977 110.77999999999996 L 359.2499999999998 110.25999999999996 L 357.9899999999998 109.94999999999996 L 357.0599999999998 110.08999999999996 L 354.9299999999998 109.04999999999995 L 354.6699999999998 107.92999999999995 L 353.7899999999998 107.39999999999995 L 351.5099999999998 111.21999999999994 L 350.8999999999998 113.58999999999995 L 351.5799999999998 116.55999999999995 L 352.05999999999983 117.19999999999995 L 352.97999999999985 117.81999999999995 L 351.96999999999986 116.67999999999995 L 351.53999999999985 113.98999999999995 L 351.65999999999985 113.46999999999996 L 354.22999999999985 109.24999999999996 L 356.53999999999985 110.42999999999996 L 356.64999999999986 110.87999999999997 L 359.17999999999984 113.32999999999997 L 358.92999999999984 115.34999999999997 L 358.1899999999998 115.89999999999996 L 358.5899999999998 118.22999999999996 L 359.1099999999998 119.35999999999996 L 360.2299999999998 120.10999999999996 L 360.9699999999998 120.25999999999996 L 361.4899999999998 120.74999999999996 L 361.1499999999998 120.10999999999996 L 360.3799999999998 119.86999999999996 L 359.17999999999984 118.82999999999996 L 358.9599999999998 118.14999999999995 L 359.2999999999998 113.94999999999995 L 360.1199999999998 112.75999999999995 L 361.5499999999998 113.48999999999995 L 362.37999999999977 114.68999999999996 L 362.2899999999998 115.47999999999996 L 363.4899999999998 116.33999999999996 L 363.7399999999998 116.04999999999995 L 362.7399999999998 114.78999999999995 L 361.81999999999977 112.68999999999996 L 361.81999999999977 112.24999999999996 L 364.07999999999976 109.92999999999996 L 365.69999999999976 110.01999999999997 L 367.62999999999977 110.65999999999997 L 367.96999999999974 111.21999999999997 L 367.35999999999973 111.80999999999997 L 367.6799999999997 112.08999999999997 L 368.15999999999974 112.11999999999998 L 369.1899999999997 111.94999999999997 L 370.5199999999997 111.04999999999997 L 374.6099999999997 110.08999999999997 L 375.37999999999965 110.28999999999998 L 377.11999999999966 111.34999999999998 L 380.2899999999997 110.92999999999998 L 381.3599999999997 110.51999999999998 L 382.37999999999965 109.50999999999998 L 383.3599999999997 108.91999999999997 L 385.0999999999997 108.40999999999997 L 385.86999999999966 108.47999999999996 L 385.92999999999967 109.22999999999996 L 383.88999999999965 113.24999999999996 L 383.64999999999964 114.74999999999996 L 383.18999999999966 115.81999999999995 L 382.3599999999997 116.84999999999995 L 382.3499999999997 117.72999999999995 L 382.92999999999967 119.14999999999995 L 382.6099999999997 121.61999999999995 L 383.48999999999967 120.42999999999995 L 383.49999999999966 119.02999999999994 L 385.0399999999997 116.02999999999994 L 386.1699999999997 112.83999999999995 L 387.2899999999997 111.27999999999994 L 387.55999999999966 111.00999999999995 L 388.31999999999965 110.95999999999995 L 388.89999999999964 110.60999999999996 L 390.71999999999963 110.37999999999995 L 391.5999999999996 109.02999999999996 L 393.1099999999996 107.33999999999996 L 394.46999999999963 105.07999999999996 L 394.9899999999996 104.61999999999996 L 395.77999999999963 105.10999999999996 L 396.39999999999964 104.64999999999996 L 398.01999999999964 106.98999999999997 L 399.20999999999964 107.57999999999997 L 399.1599999999996 106.83999999999997 L 398.8099999999996 106.08999999999997 L 399.4299999999996 105.07999999999997 L 402.9399999999996 104.56999999999996 L 401.9099999999996 104.24999999999997 L 398.39999999999964 104.70999999999997 L 398.08999999999963 104.49999999999997 L 398.37999999999965 102.06999999999996 L 398.88999999999965 101.77999999999996 L 399.55999999999966 102.15999999999995 L 400.57999999999964 102.26999999999995 L 401.64999999999964 99.16999999999996 L 400.96999999999963 97.77999999999996 L 400.9999999999996 97.09999999999995 L 402.1699999999996 95.28999999999995 L 405.0099999999996 92.80999999999995 L 405.3699999999996 92.72999999999995 L 406.4799999999996 93.86999999999995 L 409.4099999999996 91.77999999999994 L 409.8699999999996 91.70999999999995 L 410.2699999999996 92.15999999999995 L 410.3699999999996 92.72999999999995 L 410.0499999999996 93.39999999999995 L 411.1199999999996 93.23999999999995 L 411.9299999999996 92.65999999999995 L 412.2899999999996 91.87999999999995 L 412.9199999999996 91.68999999999996 L 413.1999999999996 91.83999999999996 L 413.9399999999996 93.22999999999996 L 415.2699999999996 94.42999999999996 L 415.4699999999996 93.86999999999996 L 415.35999999999956 93.48999999999997 L 414.4 93 L 414.26 92.71 L 414.13 91.50999999999999 L 414.3 91.08999999999999 L 414.74 90.89999999999999 L 417.02 91.16 L 418.2 91.81 L 418.82 92.83 L 420.45 93.53999999999999 L 422.09999999999997 92.75999999999999 L 422.62999999999994 94.89999999999999 L 422.12999999999994 95.21 L 422.09999999999997 95.8 L 423.02 95.28 L 424.18 92.93 L 424.56 93.16000000000001 L 424.33 94.49000000000001 L 424.74 94.93 L 427.25 94.67 L 427.7 95.32000000000001 L 428.15999999999997 97.00000000000001 L 427.55999999999995 97.95000000000002 L 428.40999999999997 97.45000000000002 L 428.66999999999996 97.82000000000002 L 430.55999999999995 97.96000000000002 L 434.0899999999999 96.72000000000003 L 433.7799999999999 98.30000000000003 L 433.0299999999999 100.13000000000002 L 434.49999999999994 99.64000000000003 L 435.0899999999999 99.02000000000002 L 435.7199999999999 100.64000000000003 L 435.7199999999999 100.64000000000003 L 434.94999999999993 101.09000000000003 L 434.4799999999999 102.12000000000003 L 434.63999999999993 103.50000000000003 L 433.92999999999995 107.89000000000003 L 433.35999999999996 108.63000000000002 L 432.21999999999997 108.78000000000003 L 432.16999999999996 109.40000000000003 L 432.43999999999994 109.89000000000003 L 433.42999999999995 109.73000000000003 L 433.85999999999996 110.26000000000003 L 433.78 111.87000000000003 L 432.88 114.89000000000003 L 432.52 115.60000000000002 L 430.78 117.17000000000002 L 430.28 119.55000000000001 L 430.40999999999997 121.19000000000001 L 426.72999999999996 124.28000000000002 L 427.77 125.86000000000001 L 426.97999999999996 126.67000000000002 L 427.15999999999997 128.49 L 426.7 129.77 L 425.87 131.22 L 424.39 132.98 L 422.43 134.51999999999998 L 420.83 139.20999999999998 L 420.53999999999996 141.10999999999999 L 420.06999999999994 142.32 L 417.62999999999994 144.64 L 416.50999999999993 145.1 L 415.88999999999993 147.98 L 414.3399999999999 149.14999999999998 L 413.9099999999999 150.29999999999998 L 412.3599999999999 152.46999999999997 L 411.1899999999999 153.38999999999996 L 408.83999999999986 153.15999999999997 L 394.1299999999999 164.98999999999998 L 394.6199999999999 165.07 L 394.6199999999999 165.07 L 396.9099999999999 165.88 L 398.7799999999999 165.64 L 400.06999999999994 165.76 L 401.0899999999999 167.42 L 401.4799999999999 167.73 L 402.3499999999999 167.86999999999998 L 403.6099999999999 169.03999999999996 L 403.5699999999999 169.66999999999996 L 403.1999999999999 170.33999999999995 L 402.47999999999985 170.70999999999995 L 401.5099999999998 170.77999999999994 L 401.2199999999998 171.05999999999995 L 401.3099999999998 172.46999999999994 L 402.31999999999977 173.80999999999995 L 401.39999999999975 176.55999999999995 L 400.75999999999976 177.03999999999994 L 399.2999999999998 177.49999999999994 L 399.0499999999998 177.95999999999995 L 399.3399999999998 179.15999999999994 L 399.1499999999998 180.49999999999994 L 397.8499999999998 180.64999999999995 L 396.3399999999998 181.98999999999995 L 395.4899999999998 183.25999999999996 L 395.63999999999976 184.76999999999995 L 395.39999999999975 185.26999999999995 L 392.89999999999975 186.46999999999994 L 389.4899999999997 187.60999999999993 L 387.0199999999997 189.38999999999993 L 386.8299999999997 189.73999999999992 L 387.2599999999997 191.92999999999992 L 387.3199999999997 194.5999999999999 L 386.03999999999974 196.6999999999999 L 384.6299999999997 198.3799999999999 L 384.47999999999973 198.9499999999999 L 384.64999999999975 199.8299999999999 L 385.2399999999997 200.7899999999999 L 386.90999999999974 202.52999999999992 L 387.65999999999974 202.8499999999999 L 387.8099999999997 203.14999999999992 L 387.1499999999997 207.1899999999999 L 385.3899999999997 212.33999999999992 L 384.3099999999997 213.14999999999992 L 382.60999999999973 216.38999999999993 L 382.4299999999997 217.37999999999994 L 381.4899999999997 218.91999999999993 L 380.7499999999997 219.76999999999992 L 379.6999999999997 219.92999999999992 L 378.3299999999997 220.8499999999999 L 377.2999999999997 222.7699999999999 L 376.08999999999975 224.4499999999999 L 374.90999999999974 225.5399999999999 L 373.75999999999976 227.11999999999992 L 372.62999999999977 231.57999999999993 L 371.03 235.24 z M 392.19 104.93 L 387.67 106.89 L 384.28000000000003 107.41 L 382.26000000000005 107.1 L 381.61000000000007 108.22999999999999 L 379.7700000000001 109.41999999999999 L 379.05000000000007 108.80999999999999 L 378.44000000000005 107.27999999999999 L 378.21000000000004 107.55999999999999 L 378.63000000000005 108.78999999999999 L 378.2900000000001 109.6 L 377.5800000000001 110.00999999999999 L 373.8100000000001 108.36999999999999 L 373.0100000000001 109.08999999999999 L 368.8200000000001 110.35 L 365.6200000000001 109.78 L 364.8100000000001 109.17 L 364.5700000000001 107.32000000000001 L 364.3400000000001 106.91000000000001 L 363.2300000000001 105.89000000000001 L 362.1700000000001 104.29000000000002 L 361.9600000000001 102.51000000000002 L 362.4800000000001 99.76000000000002 L 363.1000000000001 99.38000000000002 L 364.86000000000007 99.74000000000002 L 365.7900000000001 98.99000000000002 L 365.87000000000006 98.43000000000002 L 364.57000000000005 98.86000000000003 L 363.35 98.73000000000003 L 362.41 98.02000000000004 L 362.23 96.97000000000004 L 362.57 91.89000000000004 L 363.3 91.13000000000004 L 363.65000000000003 91.88000000000004 L 365.41 92.48000000000003 L 365.96000000000004 92.42000000000003 L 365.50000000000006 92.00000000000003 L 364.2300000000001 91.78000000000003 L 363.3300000000001 89.62000000000003 L 363.6900000000001 87.94000000000003 L 364.5800000000001 85.97000000000003 L 365.9100000000001 84.64000000000003 L 366.87000000000006 84.07000000000004 L 368.21000000000004 83.58000000000004 L 369.53000000000003 83.45000000000005 L 372.99 83.97000000000004 L 380.2 85.74000000000004 L 383.9 85.28000000000004 L 384.01 84.98000000000005 L 385.15 84.36000000000004 L 387.31 83.99000000000004 L 390.2 84.28000000000004 L 393 85.10000000000004 L 399.48 85.95000000000003 L 400.11 86.42000000000003 L 400.06 87.65000000000003 L 399.36 88.39000000000003 L 398.68 89.89000000000003 L 398.32 92.54000000000003 L 397.46 95.84000000000003 L 396.16999999999996 96.52000000000004 L 395.81999999999994 97.21000000000004 L 396.04999999999995 98.40000000000003 L 394.06999999999994 100.98000000000003 L 392.67999999999995 104.48000000000003 L 392.19 104.93 z M 344.98 104.76 L 344.23 104.25 L 345.33000000000004 102 L 345.24000000000007 100.21 L 345.49000000000007 100 L 347.82000000000005 99.52 L 348.72 98.66 L 348.87 98.16 L 348.67 95.82 L 349.53000000000003 93.24 L 350.79 91.75 L 353.08000000000004 90.28 L 355.95000000000005 90.08 L 356.6700000000001 92.44 L 355.57000000000005 94.63 L 354.72 97.67 L 353.62 98.34 L 352.28000000000003 100.37 L 351.50000000000006 101.09 L 346.56000000000006 104.4 L 344.98 104.76 z M 373.46 81.86 L 372.43 81.61 L 369.98 81.69 L 369.19 81.53 L 368.9 81.27 L 368.52 80.17999999999999 L 368.53 78.94 L 370.03999999999996 78.52 L 371.92999999999995 78.56 L 374.11999999999995 77.27 L 378.92999999999995 76.67 L 379.69999999999993 76.93 L 380.37999999999994 77.61000000000001 L 380.19999999999993 78.63000000000001 L 377.63999999999993 80.02000000000001 L 375.85999999999996 82.50000000000001 L 374.76 83 L 373.46 81.86 z M 378.25 81.86 L 380.11 80.66 L 382.09000000000003 80.69 L 383.74 81.31 L 384.27 82.3 L 384.32 82.92 L 383.44 83.69 L 380.59 83.97 L 379.41999999999996 84.28999999999999 L 377.15999999999997 83.39999999999999 L 376.96 82.86999999999999 L 378.25 81.86 z M 361.27 86.25 L 360.77 85.99 L 360.15999999999997 86.03 L 358.61999999999995 85.34 L 358.8299999999999 84.18 L 359.4699999999999 83.26 L 361.38999999999993 82.86 L 363.74999999999994 81.96 L 365.06999999999994 82.03999999999999 L 365.86999999999995 82.72 L 365.9599999999999 82.85 L 364.0299999999999 84.46 L 362.9599999999999 84.8 L 361.27 86.25 z M 370.69 76.56 L 369.87 76.26 L 369.7 74.60000000000001 L 369.84999999999997 74.00000000000001 L 371.02 72.69000000000001 L 373.46999999999997 71.77000000000001 L 373.71999999999997 71.89000000000001 L 374.24999999999994 72.57000000000002 L 374.28999999999996 73.46000000000002 L 372.34 75.45000000000002 L 370.69 76.56 z M 356.86 96.78 L 356.72 96.37 L 356.91 95.44 L 357.95000000000005 92.63 L 360.54 90.94 L 361.26000000000005 90.66 L 361.95000000000005 90.8 L 361.79 92.59 L 360.23 93.03 L 358.61 95.22 L 356.86 96.78 z M 367.77 79.21 L 366.58 78.89999999999999 L 366.28 78.41999999999999 L 367.15999999999997 77.46 L 367.86999999999995 73.50999999999999 L 368.75999999999993 72.27999999999999 L 369.04999999999995 72.40999999999998 L 369.11999999999995 72.72999999999998 L 369.09999999999997 75.20999999999998 L 369.7 77.07999999999998 L 369.38 77.95999999999998 L 368.35 78.35999999999999 L 367.77 79.21 z M 352.96 89.4 L 352.69 89.21000000000001 L 352.81 88.60000000000001 L 353.36 88.24000000000001 L 354.55 86.53000000000002 L 355.31 84.99000000000001 L 356.04 84.33000000000001 L 357.49 83.79 L 357.29 85.28 L 356.89000000000004 86.28 L 355.17 87.94 L 352.96 89.4 z M 366.83 82.37 L 366.22999999999996 82.22 L 365.39 81.51 L 364.43 79.87 L 364.38 79.49000000000001 L 364.61 79.2 L 365.42 78.62 L 367.27000000000004 79.46000000000001 L 367.56000000000006 79.89000000000001 L 367.80000000000007 81.98000000000002 L 366.83 82.37 z M 361.45 112.93 L 360.8 112.82000000000001 L 359.92 112.30000000000001 L 359.23 112.76 L 358.48 112.48 L 356.8 110.74000000000001 L 356.8 110.13000000000001 L 358.08 110.12 L 361.14 111.44 L 361.45 112.93 z M 340.3 107.39 L 340.34000000000003 106.36 L 340.14000000000004 106.06 L 340.74000000000007 105.07000000000001 L 343.1000000000001 104.19000000000001 L 343.88000000000005 104.57000000000001 L 344.75000000000006 105.43 L 344.46000000000004 105.78 L 343.43000000000006 106.25 L 340.89000000000004 106.66 L 340.3 107.39 z M 353 100.7 L 352.82 100.67 L 352.83 100.32000000000001 L 353.37 99.38000000000001 L 355.16 97.76 L 355.58000000000004 96.52000000000001 L 355.63000000000005 95.22000000000001 L 355.87000000000006 94.92000000000002 L 356.19000000000005 95.36000000000001 L 356.19000000000005 96.87000000000002 L 355.30000000000007 99.60000000000002 L 354.68000000000006 100.25000000000003 L 353 100.7 z M 359.3 90.8 L 360.95 87.84 L 361.83 87.63000000000001 L 362.53999999999996 87.82000000000001 L 362.80999999999995 88.69000000000001 L 362.22999999999996 89.4 L 359.3 90.8 z M 390.72 109.77 L 389.88000000000005 109.42 L 389.5400000000001 108.36 L 390.5800000000001 106.64 L 391.6500000000001 106.31 L 391.8400000000001 106.41 L 391.8200000000001 107.14999999999999 L 391.0800000000001 109.38999999999999 L 390.72 109.77 z M 357.24 90.3 L 356.7 90.1 L 357.02 88.05999999999999 L 358.34999999999997 86.24999999999999 L 358.58 86.28999999999999 L 359.87 87.16999999999999 L 359.86 87.41999999999999 L 358.31 88.05999999999999 L 357.24 90.3 z M 359.47 95.33 L 360.19000000000005 95.36 L 359.7900000000001 95.81 L 358.8500000000001 96.12 L 358.74000000000007 97.24000000000001 L 357.95000000000005 97.95 L 356.26000000000005 98.79 L 356.1 98.61 L 356.37 97.78 L 356.84000000000003 97.15 L 358.57000000000005 95.48 L 359.47 95.33 z M 336.91 105.54 L 336.36 105.35000000000001 L 336.29 105.00000000000001 L 336.72 104.60000000000001 L 340.28000000000003 103.00000000000001 L 340.82000000000005 103.70000000000002 L 340.81000000000006 103.90000000000002 L 339.4100000000001 104.63000000000002 L 336.91 105.54 z M 400.44 100.76 L 399.41 100.57000000000001 L 398.59000000000003 99.78 L 399.46000000000004 98.53 L 400.8 98.52 L 400.99 99.71 L 400.89 100.3 L 400.44 100.76 z M 363.19 81.86 L 360.83 82.56 L 360.24 82.57000000000001 L 360.06 82.36000000000001 L 361.09 81.32000000000001 L 362.13 80.81 L 363.17 80.98 L 363.61 81.32000000000001 L 363.76 81.55000000000001 L 363.61 81.76 L 363.19 81.86 z M 357.92 90.45 L 357.84000000000003 89.69 L 358.09000000000003 89.19 L 360.57000000000005 87.73 L 359.6700000000001 89.73 L 358.86000000000007 90.36 L 357.92 90.45 z M 360.06 94.98 L 359.61 94.86 L 359.54 94.63 L 360.32 93.13 L 361.51 93.14999999999999 L 361.39 94.49999999999999 L 360.06 94.98 z M 388.1 110.81 L 387.82000000000005 110.58 L 388.72 108.98 L 389.40000000000003 108.58 L 389.63000000000005 109.33 L 390.14000000000004 109.7 L 389.88000000000005 110.22 L 389.45000000000005 110.56 L 388.82000000000005 110.38 L 388.1 110.81 z M 361.44 87.49 L 360.55 87.42 L 360.57 87.23 L 362.93 85.39 L 362.97 86.35 L 362.74 86.97999999999999 L 362.49 87.32 L 361.44 87.49 z M 428.9 97.71 L 428.52 97.17999999999999 L 428.71 96.41999999999999 L 429.72999999999996 95.50999999999999 L 429.97999999999996 95.66 L 430.21 97.41 L 428.9 97.71 z"},{code:"PB",name:"Paraíba",gTransform:"matrix(1 0 0 1 275.13 -126.21)",pathTransform:"translate(-581.13, -193.05)",d:"M 610.43 199.15 L 607.93 197.09 L 607.11 196.83 L 604.46 196.62 L 602.15 197.69 L 600.67 198.97 L 600.22 200.77 L 598.32 201.8 L 596.31 202.25 L 595.17 202.23 L 595.17 202.83 L 594.37 203.36 L 592.19 203.65 L 588.31 203.39 L 586.7 204.27 L 586.15 204.91 L 584.33 205.01 L 583.44 205.7 L 582.9 206.46 L 583.29 207.19 L 583.3 207.73 L 582.9 208.21 L 581.12 209.74 L 579.78 209.9 L 578.13 210.74 L 576.53 209.95 L 575.58 209.01 L 575.23 206.77 L 575.47 206.28 L 575.29 205.98 L 574.15 205.66 L 573.71 205.95 L 572.2 206.2 L 572.24 205.75 L 574.77 203.11 L 574.94 202.68 L 574.22 200.81 L 574.18 200.34 L 574.55 199.56 L 577.55 198.49 L 577.66 198.19 L 577.16 196.8 L 573.66 194.88 L 572.18 195.29 L 569.96 196.55 L 569.03 198.06 L 567.55 198.93 L 566.5 199.24 L 563.8 201.12 L 562.28 202.76 L 560.65 202.99 L 558.02 203.96 L 557.25 203.63 L 557.3 202.95 L 556.67 201.71 L 556.29 201.63 L 555.36 202.36 L 553.85 202.68 L 552.86 202.35 L 551.46 200.44 L 551.06 200.35 L 551.06 200.35 L 550.89 200.1 L 552.08 198.98 L 553.69 195.49 L 553.35 194.3 L 552.66 194.22 L 551.42 193.33 L 551.44 191.67 L 551.09 190.95 L 550.51 190.66 L 550.27 190.25 L 550.39 189.32 L 550.56 188.94 L 551.65 188.31 L 552.31 187 L 551.79 185.69 L 552.82 182.69 L 553.66 181.54 L 553.74 181 L 553.74 181 L 554.31 180.54 L 556.24 182.18 L 557.14 182.6 L 560.02 183.21 L 561.18 182.08 L 564.41 180.42 L 565.23 179.71 L 565.33 178.67 L 565.74 177.72 L 568.92 176.51 L 570.35 176.39 L 573.61 175.35 L 574.25 175.43 L 574.78 175.87 L 574.79 177.06 L 571.8 180.27 L 571.36 181.23 L 570.98 182.97 L 570.57 183.35 L 569.72 183.6 L 569.51 183.91 L 569.43 185.63 L 572.96 186.15 L 573.28 186.38 L 573.59 187.76 L 573.88 187.99 L 577.03 186.73 L 578.8 186.65 L 580.75 186.95 L 581.64 188.12 L 581.12 189.66 L 581.95 190.4 L 584.3 189.47 L 584.8 188.73 L 585.35 187.52 L 584.88 186.58 L 584.72 185.16 L 585.2 184.57 L 586.21 184.89 L 585.68 183.36 L 584.96 182.58 L 585.27 181.1 L 587.09 179.75 L 588.47 179.7 L 588.89 180.09 L 588.79 181.09 L 589.41 181.58 L 592.83 181.98 L 593.36 182.33 L 599.19 181.94 L 601.36 182.24 L 603.82 183.34 L 604.86 182.94 L 608.36 183.15 L 609.29 182.91 L 609.29 182.91 L 609.38 185.31 L 610.83 189.7 L 610.89 190.34 L 610.71 191.28 L 610.34 191.73 L 610.31 192.61 L 610.89 191.87 L 611.4 190.37 L 611.41 192.35 L 612 193.36 L 611.73 198.54 L 611.37 199.14 z"},{code:"PE",name:"Pernambuco",gTransform:"matrix(1 0 0 1 254.6 -106.99)",pathTransform:"translate(-560.6, -212.26)",d:"M 558.28 227.19 L 557.06 224.15 L 557.05 223.21 L 554.94 222.35 L 554.44 221.98 L 553.99 221.15 L 554.6 220.26 L 554.58 219.64 L 554.13 219.32 L 553.13 219.33 L 552.7 219.77 L 552.41 221.51 L 551.98 221.66 L 551.59 221.4 L 551.05 219.75 L 549.47 218.6 L 546.48 218.2 L 544.12 217.43 L 542.77 216.62 L 541.94 215.18 L 540.45 214.62 L 539.86 214.73 L 537.33 216.19 L 535.68 216.63 L 534.91 218.68 L 532.68 219.13 L 532.39 219.38 L 532.64 220.74 L 532.47 221.33 L 531.37 222.57 L 528.98 223.6 L 528.34 223.54 L 527.57 223.01 L 526.81 223.18 L 526.31 224.05 L 525.54 227.62 L 522.67 228.5 L 521.85 229.42 L 520.89 229.65 L 519.05 229.03 L 519.97 227.35 L 519.71 225.35 L 517.5 224.44 L 516.78 222.5 L 516.84 219.77 L 516.4 219.26 L 513.59 217.88 L 511.39 217.59 L 510.23 217.85 L 509.33 217.45 L 509.33 217.45 L 511.95 216.18 L 513.92 214.47 L 514.46 213.6 L 516.75 212.27 L 517.72 211.99 L 521.61 208.12 L 522.35 206.36 L 522.41 204.09 L 522.12 203.55 L 520.5 201.97 L 520.57 199.78 L 519.97 198.65 L 519.91 197.7 L 520.02 197.25 L 520.54 196.92 L 522.33 196.76 L 522.33 196.76 L 527.26 196.96 L 528.15 197.2 L 529.78 197.01 L 531.92 196.21 L 533.21 196.11 L 536.29 196.53 L 539.14 198.43 L 540.97 199.26 L 541.43 200.25 L 542.44 201.32 L 543.8 201.8 L 544.58 202.37 L 545.21 204.01 L 546.86 203.96 L 548.4 201.67 L 549.47 200.84 L 551.06 200.35 L 551.06 200.35 L 551.46 200.44 L 552.86 202.35 L 553.85 202.68 L 555.36 202.36 L 556.29 201.63 L 556.67 201.71 L 557.3 202.95 L 557.25 203.63 L 558.02 203.96 L 560.65 202.99 L 562.28 202.76 L 563.8 201.12 L 566.5 199.24 L 567.55 198.93 L 569.03 198.06 L 569.96 196.55 L 572.18 195.29 L 573.66 194.88 L 577.16 196.8 L 577.66 198.19 L 577.55 198.49 L 574.55 199.56 L 574.18 200.34 L 574.22 200.81 L 574.94 202.68 L 574.77 203.11 L 572.24 205.75 L 572.2 206.2 L 573.71 205.95 L 574.15 205.66 L 575.29 205.98 L 575.47 206.28 L 575.23 206.77 L 575.58 209.01 L 576.53 209.95 L 578.13 210.74 L 579.78 209.9 L 581.12 209.74 L 582.9 208.21 L 583.3 207.73 L 583.29 207.19 L 582.9 206.46 L 583.44 205.7 L 584.33 205.01 L 586.15 204.91 L 586.7 204.27 L 588.31 203.39 L 592.19 203.65 L 594.37 203.36 L 595.17 202.83 L 595.17 202.23 L 596.31 202.25 L 598.32 201.8 L 600.22 200.77 L 600.67 198.97 L 602.15 197.69 L 604.46 196.62 L 607.11 196.83 L 607.93 197.09 L 610.43 199.15 L 610.43 199.15 L 611.31 199.38 L 611.86 200.6 L 610.59 202.32 L 610.48 202.87 L 610.49 203.35 L 611.19 203.72 L 611.46 204.22 L 611.65 205.28 L 609.69 211.66 L 606.44 220.61 L 606.44 220.61 L 606.17 220.4 L 603.27 220.13 L 601.35 219.32 L 599.88 219.51 L 597.32 220.8 L 595.08 219.95 L 593.08 220.19 L 591.53 221.43 L 591.41 221.88 L 589.23 224.17 L 587.42 225.28 L 586.26 225.23 L 584.4 226.29 L 583.23 226.4 L 580.09 226.11 L 577.59 226.76 L 575.68 226.28 L 573.9 225.23 L 572 223.11 L 569.45 221.09 L 568.37 221.21 L 566.7 220.91 L 565.7 219.69 L 564.88 220.29 L 564.79 220.98 L 562.41 224.27 L 560.24 225.03 L 559.6 226.12 z"},{code:"PI",name:"Piauí",gTransform:"matrix(1 0 0 1 174.84 -130.97)",pathTransform:"translate(-480.85, -188.29)",d:"M 505.7 126.91 L 507.01 127.03 L 507.7 126.8 L 509.94 127.31 L 510.93 128.16 L 511.25 128.76 L 511.25 128.76 L 511.14 129.56 L 510.05 131.41 L 508.47 133.38 L 508.29 134.84 L 508.58 136.13 L 510.38 140.85 L 513.53 147.27 L 513.97 149 L 515.33 150.59 L 515.31 151.35 L 514.57 152.71 L 515.36 156.58 L 514.88 158.18 L 515.88 160.19 L 516.48 163.18 L 515.89 164.76 L 515.09 165.34 L 516.01 166.03 L 516.12 166.41 L 517.06 174.57 L 516.82 175.02 L 517.58 177.59 L 518.63 182.79 L 519.64 185.46 L 520.95 186.11 L 523.51 186.58 L 524.28 187.74 L 524.27 188.43 L 522.77 190.68 L 521.63 193.79 L 521.71 194.76 L 522.39 195.44 L 522.33 196.76 L 522.33 196.76 L 520.54 196.92 L 520.02 197.25 L 519.91 197.7 L 519.97 198.65 L 520.57 199.78 L 520.5 201.97 L 522.12 203.55 L 522.41 204.09 L 522.35 206.36 L 521.61 208.12 L 517.72 211.99 L 516.75 212.27 L 514.46 213.6 L 513.92 214.47 L 511.95 216.18 L 509.33 217.45 L 509.33 217.45 L 508.88 218.61 L 507.38 220.91 L 506.33 221.58 L 505.54 221.4 L 503.54 221.78 L 503.65 224.18 L 501.79 225.98 L 501.47 225.93 L 500.85 225.31 L 498.69 225.3 L 497.87 226.28 L 497.1 226.64 L 494.37 226.98 L 492.86 228.32 L 492.04 229.54 L 490.34 229.64 L 488.86 230.28 L 485.86 230.39 L 485.04 230.11 L 484.85 229.83 L 484.98 229.17 L 483.27 228.19 L 481.94 227.8 L 480.55 228.35 L 478.42 228.78 L 478.1 228.6 L 477.69 227.67 L 476.19 227.21 L 474.24 227.23 L 471 228.88 L 470.94 229.81 L 473.18 234.25 L 473.3 235.4 L 473.01 237.97 L 472.76 238.88 L 472.04 239.74 L 469.09 244.79 L 466.12 247.21 L 464.77 247.63 L 463.29 247.1 L 461.95 246.93 L 459.75 247.68 L 458.58 248.57 L 457.91 249.44 L 456.77 249.82 L 456.02 251.27 L 455.69 251.48 L 453.58 251.3 L 451.78 251.82 L 447.6 249.97 L 445.83 247.48 L 445.3 245.27 L 444.64 244.23 L 443.2 242.89 L 440.87 242.91 L 440.87 242.91 L 437.93 242.7 L 437.93 242.7 L 437.98 240.78 L 438.24 239.72 L 439.39 237.27 L 439.52 230.91 L 440.28 229.51 L 440.31 229 L 438.58 225.94 L 438.11 222.75 L 437.41 220.81 L 438.14 218.81 L 439.84 217.41 L 441.04 214.93 L 441.17 213.42 L 441.51 212.59 L 441.81 212.38 L 443.25 209.64 L 443.88 207.32 L 444.27 204.35 L 445.25 201.37 L 447.38 199.42 L 450.1 198.66 L 452.71 198.35 L 453.78 197.98 L 455.48 196.45 L 456.53 196.41 L 457.87 195.89 L 460.73 193.32 L 463.07 192.41 L 465.08 190.41 L 465.71 189.54 L 465.71 189.08 L 467.61 187.16 L 468.11 186.94 L 468.95 186.7 L 469.18 187 L 470.3 186.74 L 471.3 186.14 L 472.76 185.95 L 473.77 186.16 L 476.28 187.98 L 477.79 187.88 L 480.23 187.02 L 481.06 186.98 L 481.71 187.26 L 483.99 186.97 L 485.2 185.66 L 485.7 184.2 L 485.82 182.99 L 486.11 182.55 L 486.5 180.35 L 486.37 179.5 L 486.2 179 L 484.59 178.09 L 482.81 176.06 L 482.3 173.76 L 482.19 171.65 L 482.36 169.17 L 486.46 164.74 L 486.67 164.19 L 486.77 161.76 L 486.22 158.78 L 484.64 155.98 L 485.78 153.11 L 486.06 151.64 L 485.68 150.37 L 484.45 149.53 L 484.1 147.61 L 484.87 146.56 L 485.51 146.39 L 486.33 144.41 L 488.22 142.56 L 489.1 140.73 L 489.06 138.94 L 491.98 135.53 L 492.79 135.69 L 496.1 135.23 L 500.23 131.26 L 502.02 128.99 L 502.41 127.46 L 501.77 126.93 L 501.55 126.21 L 502.01 124.77 L 502.01 124.77 L 502.74 124.89 L 504.21 125.76 L 504.72 126.27 L 504.59 126.58 z"},{code:"PR",name:"Paraná",gTransform:"matrix(1 0 0 1 47.59 157)",pathTransform:"translate(-353.59, -476.27)",d:"M 396.75 499.4 L 391.51 499.37 L 391.18 499.81 L 389.44 500.05 L 388.68 499.98 L 388.57 499.59 L 387 500.16 L 385.65 501.59 L 382.3 503.72 L 380.86 503.56 L 379.63 502.94 L 376.5 500.34 L 375.47 499.95 L 374.71 499.94 L 371.87 500.67 L 369.54 500.84 L 368.73 500.81 L 367.31 500.05 L 366.2 500.19 L 364.67 500.84 L 364.08 502.31 L 363.35 503.18 L 361.48 504.16 L 357.91 503.75 L 355.91 504.9 L 355.19 505.67 L 354.5 507.26 L 355.35 510.25 L 354.48 511.11 L 353.56 511.13 L 352.81 511.51 L 352.64 512 L 351.31 510.11 L 347.06 510.24 L 343.3 509.81 L 341.72 508.63 L 341.56 508.22 L 340.53 507.59 L 336.27 507.23 L 330.98 505.55 L 328.64 506.12 L 325.95 506.09 L 323.93 504.68 L 323.61 504.17 L 322.55 503.93 L 322.02 503.92 L 321.31 504.29 L 317.68 504.27 L 317.68 504.27 L 317.46 503.06 L 314.93 498.88 L 314.95 496.29 L 313.96 493.41 L 310.54 491.04 L 309.45 492.17 L 307.33 492.06 L 306.23 492.49 L 305.16 493.39 L 303.7 492.31 L 302.88 492.37 L 302.6 490.17 L 303.26 488.6 L 304.33 487.33 L 305.55 485.15 L 305.61 484.81 L 305.12 484.06 L 305.14 482.82 L 306.04 479.18 L 307.3 476.16 L 307.05 473.86 L 308.33 471.48 L 308.12 470.46 L 307.28 469.58 L 306.97 467.98 L 307.63 466.92 L 308.42 466.38 L 308.42 466.38 L 310.8 464.82 L 311.16 464 L 312.73 456.08 L 313.06 455.73 L 314.17 455.41 L 315.83 454.4 L 316.5 453.72 L 317.95 450.16 L 317.93 449.01 L 318.86 446.68 L 319.97 445.86 L 325.38 443.59 L 325.38 443.59 L 328.64 441.3 L 332.47 441.95 L 336.48 441.84 L 339.75 442.13 L 340.96 441.51 L 341.31 440.91 L 342.04 440.54 L 343.21 440.83 L 344.69 441.61 L 347.21 442.07 L 349.85 443.16 L 351.16 443.29 L 352.23 442.75 L 354.81 442.74 L 355.59 443.74 L 357.34 444.58 L 360.85 445.38 L 361.48 445.89 L 362.19 447.21 L 363.92 447.28 L 364.34 446.94 L 365.99 447.09 L 366.65 447.63 L 371.96 447.76 L 374.93 446.91 L 376.06 448.46 L 379.65 451.29 L 380.54 453.05 L 380.55 455.79 L 380.16 456.37 L 380 457.18 L 380.38 459.02 L 381.68 460.53 L 381.6 462.29 L 381.24 462.85 L 382.73 465.85 L 383.94 467 L 384.61 467.28 L 385.11 467.96 L 385.06 468.85 L 385.98 470.82 L 386.58 471.11 L 386.83 471.55 L 386.58 472.6 L 385.31 474.73 L 385.63 476.77 L 386.23 477.15 L 387.24 477.36 L 389.62 477.24 L 393.04 476.71 L 393.54 477.1 L 395.12 476.91 L 396.71 477.04 L 398.32 478.3 L 398.18 478.71 L 397.29 479.36 L 396.6 482.66 L 396.95 483.44 L 398.02 483.97 L 398.67 483.12 L 399.77 480.36 L 400.53 480.19 L 402.67 480.77 L 402.27 482.72 L 403 486.02 L 404.42 486.6 L 404.58 487.92 L 404.58 487.92 L 403.23 488.94 L 402.62 490.42 L 402.07 490.3 L 402.34 488.36 L 403.78 487.41 L 402.37 487.69 L 401.48 488.18 L 400.61 488.16 L 400.27 487.77 L 399.7 487.6 L 399.16 487.97 L 398.88 488.9 L 399.4 489.7 L 398.67 490.66 L 398.37 490.76 L 395.89 490.23 L 395.1 489.69 L 394.65 489.81 L 394.47 490.71 L 394.81 491.08 L 396.42 491.64 L 397.82 491.39 L 399.95 491.99 L 400.22 492.47 L 399.25 493.15 L 397.71 495.93 L 396.47 496.7 L 394.05 497.27 L 393.85 497.72 L 396.8 497.52 L 396.95 498.71 z"},{code:"RJ",name:"Rio de Janeiro",gTransform:"matrix(1 0 0 1 179.27 113.69)",pathTransform:"translate(-485.28, -432.95)",d:"M 468.35 450.28 L 468.28000000000003 449.5 L 468.66 449.23 L 471.85 449.45000000000005 L 474.44 448.86000000000007 L 471.91 447.31000000000006 L 470.51000000000005 446.81000000000006 L 467.70000000000005 447.49000000000007 L 466.34000000000003 449.0900000000001 L 465.31000000000006 449.4100000000001 L 464.61000000000007 449.36000000000007 L 463.26000000000005 447.2100000000001 L 462.78000000000003 447.2100000000001 L 461.88000000000005 447.6300000000001 L 460.9200000000001 448.6900000000001 L 457.7700000000001 449.4900000000001 L 457.4300000000001 450.40000000000015 L 457.2400000000001 452.3000000000001 L 459.4300000000001 452.4300000000001 L 460.5000000000001 453.4400000000001 L 459.35000000000014 454.5200000000001 L 458.41000000000014 454.3500000000001 L 456.9900000000001 454.5200000000001 L 456.9900000000001 454.5200000000001 L 456.5100000000001 454.2600000000001 L 454.8800000000001 452.5300000000001 L 454.8300000000001 452.12000000000006 L 455.9200000000001 448.62000000000006 L 457.01000000000005 447.4700000000001 L 459.36000000000007 446.4600000000001 L 459.86000000000007 446.61000000000007 L 462.63000000000005 446.25000000000006 L 464.13000000000005 445.5400000000001 L 465.78000000000003 443.3900000000001 L 465.03000000000003 441.7500000000001 L 463.33000000000004 441.7400000000001 L 460.18000000000006 442.2700000000001 L 458.4100000000001 441.8800000000001 L 457.18000000000006 440.29000000000013 L 456.62000000000006 439.1200000000001 L 455.3500000000001 438.5800000000001 L 455.3500000000001 438.5800000000001 L 456.0300000000001 438.0900000000001 L 458.4500000000001 437.3500000000001 L 461.3600000000001 436.0100000000001 L 463.9400000000001 435.8400000000001 L 464.4400000000001 436.11000000000007 L 466.16000000000014 435.3400000000001 L 467.21000000000015 434.5700000000001 L 471.3000000000001 432.7800000000001 L 471.8200000000001 432.7100000000001 L 472.1800000000001 433.0200000000001 L 475.3800000000001 432.9500000000001 L 476.6300000000001 432.7800000000001 L 478.2600000000001 431.8400000000001 L 478.8300000000001 431.7800000000001 L 481.36000000000007 432.05000000000007 L 481.8500000000001 432.2200000000001 L 481.8300000000001 432.6900000000001 L 483.2100000000001 432.4900000000001 L 492.7200000000001 427.96000000000015 L 495.25000000000006 426.97000000000014 L 495.46000000000004 426.45000000000016 L 495.18000000000006 425.84000000000015 L 493.74000000000007 425.71000000000015 L 493.83000000000004 424.96000000000015 L 495.72 421.25000000000017 L 498.08000000000004 415.21000000000015 L 497.35 414.50000000000017 L 497.91 414.01000000000016 L 499.15000000000003 413.7400000000002 L 501.68 411.38000000000017 L 501.68 411.38000000000017 L 503.61 412.14000000000016 L 504.28000000000003 416.85000000000014 L 506.78000000000003 417.98000000000013 L 511.11 418.9900000000001 L 514.1 418.6200000000001 L 515.72 419.6800000000001 L 515.72 419.6800000000001 L 515.64 420.9500000000001 L 514.6999999999999 422.5600000000001 L 514.4799999999999 424.6900000000001 L 515.6199999999999 431.4700000000001 L 515.1199999999999 432.1500000000001 L 512.0399999999998 433.9000000000001 L 506.0699999999998 435.8400000000001 L 503.23999999999984 437.5600000000001 L 499.73999999999984 441.2500000000001 L 499.6299999999998 442.91000000000014 L 499.9399999999998 444.10000000000014 L 499.74999999999983 445.72000000000014 L 499.0199999999998 447.20000000000016 L 497.1999999999998 447.71000000000015 L 490.6499999999998 447.54000000000013 L 484.8599999999998 448.2400000000001 L 482.4699999999998 447.78000000000014 L 481.9799999999998 447.40000000000015 L 481.9199999999998 446.72000000000014 L 482.94999999999976 445.2400000000001 L 483.6199999999998 443.79000000000013 L 483.5299999999998 443.17000000000013 L 482.74999999999983 442.9900000000001 L 479.9599999999998 444.1400000000001 L 479.6999999999998 444.8300000000001 L 480.0099999999998 445.6200000000001 L 481.3899999999998 446.79000000000013 L 481.6399999999998 447.76000000000016 L 481.04999999999984 448.28000000000014 L 479.41999999999985 448.79000000000013 L 477.84999999999985 448.76000000000016 L 469.80999999999983 449.83000000000015 L 468.35 450.28 z M 463.24 452.27 L 462.57 451.29999999999995 L 464.68 449.74999999999994 L 466.54 450.68999999999994 L 466.97 451.38999999999993 L 464.51000000000005 451.88999999999993 L 464.1 451.5399999999999 L 463.63 451.5399999999999 L 463.24 452.27 z"},{code:"RN",name:"Rio Grande do Norte",gTransform:"matrix(1 0 0 1 274.86 -145.63)",pathTransform:"translate(-580.87, -173.63)",d:"M 609.29 182.91 L 608.36 183.15 L 604.86 182.94 L 603.82 183.34 L 601.36 182.24 L 599.19 181.94 L 593.36 182.33 L 592.83 181.98 L 589.41 181.58 L 588.79 181.09 L 588.89 180.09 L 588.47 179.7 L 587.09 179.75 L 585.27 181.1 L 584.96 182.58 L 585.68 183.36 L 586.21 184.89 L 585.2 184.57 L 584.72 185.16 L 584.88 186.58 L 585.35 187.52 L 584.8 188.73 L 584.3 189.47 L 581.95 190.4 L 581.12 189.66 L 581.64 188.12 L 580.75 186.95 L 578.8 186.65 L 577.03 186.73 L 573.88 187.99 L 573.59 187.76 L 573.28 186.38 L 572.96 186.15 L 569.43 185.63 L 569.51 183.91 L 569.72 183.6 L 570.57 183.35 L 570.98 182.97 L 571.36 181.23 L 571.8 180.27 L 574.79 177.06 L 574.78 175.87 L 574.25 175.43 L 573.61 175.35 L 570.35 176.39 L 568.92 176.51 L 565.74 177.72 L 565.33 178.67 L 565.23 179.71 L 564.41 180.42 L 561.18 182.08 L 560.02 183.21 L 557.14 182.6 L 556.24 182.18 L 554.31 180.54 L 553.74 181 L 553.74 181 L 553.08 181.38 L 552.44 181.21 L 552.78 179.24 L 554.19 176.99 L 555.03 176.11 L 555.54 176.04 L 556.32 176.55 L 557.35 176.29 L 557.92 175.19 L 559.38 173.68 L 560.78 171.24 L 560.63 170.5 L 561.28 168.83 L 562.15 168.26 L 562.99 167.14 L 566.29 160.45 L 568.9 158.44 L 573.79 156.85 L 573.79 156.85 L 574.26 157.61 L 575.12 158.36 L 578.25 158.35 L 579.47 158.76 L 581.16 160.51 L 582.48 161.01 L 585.81 160.69 L 588.69 161.21 L 591.23 160.97 L 593.56 160.24 L 598.06 161.16 L 599.33 161.2 L 601.28 162.06 L 602.3 162.88 L 602.94 163.82 L 605.25 168.56 L 605.75 170.35 L 605.71 171.1 L 607.19 176.48 L 607.4 178.16 L 608.12 178.7 L 609.08 181.39 z"},{code:"RO",name:"Rondônia",gTransform:"matrix(1 0 0 1 -139.57 -68.08)",pathTransform:"translate(-166.43, -251.18)",d:"M 187.32 290.95 L 186.03 289.5 L 185.59 287.62 L 184.03 287.1 L 183.17 287.42 L 181.36 287.5 L 177.29 285.69 L 177.28 285.29 L 176.62 284.68 L 175.35 285.27 L 173.37 283.59 L 171.85 282.62 L 170.99 281.16 L 170.71 279.77 L 169.67 279.38 L 167.9 280.5 L 166.68 280.47 L 165.27 279.67 L 164.4 278.34 L 161.27 276.76 L 159.31 276.59 L 158.17 277.13 L 157.27 277.98 L 155.84 277.81 L 155.53 277.51 L 153.39 277 L 150.33 276.72 L 149.57 276.29 L 148.39 275.1 L 148.09 273.13 L 146.51 272.64 L 144.62 271.67 L 143.8 269.95 L 143.51 269.75 L 140.79 269.47 L 140.41 269.12 L 139.57 265.41 L 138.69 264.52 L 138.21 265.68 L 137.55 265.36 L 137.28 264.72 L 137.9 263.19 L 137.06 261.67 L 135.7 261.28 L 134.44 257.81 L 134.27 256.15 L 135.82 253.24 L 135.61 251.58 L 134.45 249.61 L 133.7 247.45 L 133.64 245.16 L 134.26 244.66 L 134.64 243.29 L 135.68 242.24 L 136.04 240.77 L 135.8 239.28 L 135.38 238.39 L 135.29 236.86 L 135.83 235.21 L 134.66 233.03 L 133.64 232.65 L 132.55 233.63 L 132.49 234.14 L 131.65 235.1 L 131.08 235.1 L 128.9 234.08 L 123.72 234.16 L 118.11 235.94 L 116.42 235.93 L 114.94 236.41 L 114.94 236.41 L 111.97 235.15 L 111.97 235.15 L 115.23 232.59 L 117.15 232.01 L 118.7 230.2 L 118.85 229.64 L 118.69 228.35 L 122.65 228.61 L 125.52 228.28 L 126.24 228.65 L 128.55 230.98 L 128.92 230.96 L 130.14 230.17 L 130.27 229.45 L 130.68 228.92 L 131.76 228.42 L 132.53 228.55 L 133.9 228.16 L 135.2 226.95 L 137.04 225.93 L 137.42 226.02 L 138.06 228.28 L 138.74 228.81 L 139.42 228.73 L 141.96 225.57 L 141.7 223.82 L 142.23 222.98 L 143.98 221.72 L 144.44 221.74 L 145.28 222.29 L 147.07 222.39 L 148.27 221.32 L 150.4 220.94 L 154.27 221.4 L 154.03 219.94 L 154.14 218.13 L 156.2 216.92 L 157.01 215.77 L 157.37 214.75 L 157.2 214.3 L 156.3 213.6 L 156.35 212.93 L 157.54 211.34 L 160.02 210.81 L 160.28 210.59 L 160.19 209.42 L 161.91 208.92 L 163.29 206.36 L 174.08 206.3 L 176.23 207.43 L 176.68 207.92 L 177.48 209.83 L 178.81 211.1 L 181.35 212.08 L 182.6 215.35 L 183.06 215.56 L 184.04 215.43 L 184.66 215.63 L 185.34 218.51 L 188.58 219.99 L 189.26 219.8 L 189.8 218.06 L 191.72 216.98 L 193.11 217.26 L 193.47 217.64 L 193.43 218.34 L 193.43 218.34 L 194.83 219.31 L 195.43 220.55 L 194.67 221.97 L 193.38 226.96 L 193.44 227.31 L 194.22 227.78 L 194.48 228.39 L 194.63 229.78 L 195.46 232.05 L 194.52 233.72 L 194.9 235.65 L 193.9 239.17 L 193.87 239.97 L 194.14 241.73 L 195.64 244.48 L 194.74 253.48 L 211.9 253.53 L 211.66 254.09 L 212.88 255.2 L 216.38 255.11 L 217.49 255.22 L 218.56 255.65 L 219.97 259.24 L 219.8 259.99 L 218.4 261.74 L 217.04 262.82 L 216.9 264.14 L 217.33 267.39 L 217.91 267.9 L 218.81 267.87 L 220.34 271.21 L 220.3 273.26 L 220.88 274.75 L 220.81 276.46 L 220.25 278.7 L 218.59 280.71 L 218.07 282.96 L 217.49 283.8 L 217.06 284.21 L 215.42 284.74 L 214.49 285.82 L 213.06 289.6 L 212.54 292.05 L 208.43 294.62 L 206.96 296.05 L 206.96 296.05 L 206.22 296.01 L 203.63 294.46 L 202.36 293.03 L 195.28 293.99 L 193.96 293.56 L 193.71 293.26 L 190.33 293.92 L 189.85 293.76 L 189.33 292.41 z"},{code:"RR",name:"Roraima",gTransform:"matrix(1 0 0 1 -116.08 -267.27)",pathTransform:"translate(-189.92, -51.99)",d:"M 234.61 61.4 L 236.21 78.37 L 236.21 78.37 L 217.72 78.3 L 217.75 78.98 L 215.42 82.24 L 213.76 85.27 L 213.69 86.4 L 212.54 89.04 L 212.43 89.7 L 212.66 90.43 L 213.8 91.84 L 213.78 92.37 L 213.36 92.76 L 211.33 93.31 L 209.92 94.72 L 208.67 95.18 L 206.85 94.95 L 205.93 92.44 L 204.06 90.4 L 201.23 89.47 L 199.63 89.53 L 199.08 90.42 L 196.99 91.13 L 195.71 91.82 L 194.69 93.08 L 193.87 96.05 L 194.24 97.85 L 193.99 99.58 L 193.24 101.87 L 193.68 103.98 L 191.32 102.94 L 189.98 103.36 L 189.45 103.29 L 188.41 101.25 L 186.93 99.6 L 184.97 98.29 L 184.45 98.25 L 179.44 93.83 L 179.58 92.69 L 181.42 93.02 L 182.56 91.7 L 182.62 91.12 L 181.49 86.79 L 180.91 85.89 L 179.69 85.05 L 178.81 82.88 L 178.52 77.9 L 179.09 76.94 L 179.86 73.9 L 179.2 72.32 L 178.84 70.73 L 180.46 69.27 L 180.41 68.82 L 179.54 67.7 L 179.35 65.44 L 177.69 60.68 L 174.96 56.94 L 175.67 55.44 L 176.58 52.12 L 176.09 51.46 L 174.14 50.51 L 172.78 50.4 L 171.9 50.61 L 170.93 50.24 L 169.72 49.07 L 169.66 48.11 L 169.03 48 L 167.9 48.42 L 167.29 48.41 L 166.54 48.07 L 165.82 47.29 L 165.82 47.29 L 166.12 46.83 L 166.35 44.55 L 166.05 44.33 L 162.68 44.1 L 158.93 44.24 L 155.62 43.54 L 155.42 42.94 L 156.22 41.18 L 156.34 39.7 L 155.61 37.93 L 153.67 34.39 L 152.94 32.33 L 152.47 28.61 L 153.26 27.13 L 153.18 26.17 L 151.34 24.17 L 149.18 23.11 L 146.37 20.33 L 145.31 18.52 L 145.02 17.56 L 143.88 16.91 L 143.63 16.52 L 143.66 15.68 L 143.95 15.35 L 144.85 15.42 L 145.97 16.08 L 146.91 17.81 L 147.52 17.9 L 150.91 17.4 L 152.26 17.5 L 154.17 18.09 L 154.78 19.29 L 155.33 21.22 L 155.87 21.57 L 156.83 21.49 L 157.57 20.84 L 158.52 20.44 L 161.7 20.6 L 162.17 20.65 L 163.48 21.86 L 164.08 22.01 L 164.6 21.87 L 165.21 20.31 L 166.52 20.45 L 167.97 21.38 L 171.9 25.95 L 172.95 26.52 L 173.66 26.63 L 175.17 25.95 L 175.91 24.82 L 176.01 23.98 L 175.18 21.22 L 175.54 19.48 L 176 19.2 L 177.93 19.15 L 178.94 18.05 L 180.49 16.96 L 181.24 17.01 L 185.14 18.35 L 185.73 18.18 L 186.53 17.46 L 187.56 17.16 L 188.69 17.51 L 189.72 17.3 L 191.06 16.02 L 192.06 15.77 L 193.21 16 L 194.32 15.93 L 195 15.08 L 195.05 13.73 L 198.08 11.92 L 200.41 12.11 L 203.17 11.72 L 204.06 10.59 L 204.15 9.88 L 204.74 8.76 L 205.49 8.63 L 207.34 7.73 L 208.44 6.69 L 209.55 4.98 L 208.35 1.42 L 207.18 1.06 L 207.82 0.88 L 209.25 0.95 L 210.05 1.27 L 213.62 1.17 L 214.68 0.22 L 215.42 0 L 216.79 0.42 L 217.32 1.73 L 218.36 2.53 L 218.84 3.9 L 218.17 8.8 L 217.45 10.18 L 216.2 10.88 L 216.26 11.71 L 217.87 12.12 L 219.49 11.9 L 221.84 12.71 L 223.66 13.81 L 222.78 15.24 L 222.77 16.39 L 225.11 19.81 L 225.31 21.36 L 223.8 24.28 L 221.92 25.69 L 221.2 27.19 L 221.47 27.58 L 221.53 29.75 L 220.06 32.16 L 219.16 34.93 L 218.85 37.5 L 218.76 40.17 L 219.74 42.04 L 220.25 43.8 L 220.24 45.2 L 221.81 46.23 L 222.71 46.43 L 222.84 47.11 L 222.38 52.26 L 222.5 53 L 224.31 53.29 L 223.65 54.46 L 224.11 54.96 L 226.26 55.7 L 227.72 57.62 L 230.38 60.36 z"},{code:"RS",name:"Rio Grande do Sul",gTransform:"matrix(1 0 0 1 11.62 259.25)",pathTransform:"translate(-317.63, -578.5)",d:"M 321.99 638.52 L 321.63 638.53 L 319.69 637.42 L 319.49 636.96 L 320.01 632.69 L 319.55 628.44 L 319.7 627.37 L 320.33 626.13 L 323.17 623.75 L 324 622.19 L 326.3 619.63 L 324.84 617.98 L 323.77 617.36 L 321.52 616.76 L 319.2 614.51 L 317.99 612.89 L 317.89 611.3 L 317.46 610.12 L 316.23 608.09 L 314.17 605.85 L 313.5 605.26 L 311.11 604.05 L 309.66 604.26 L 307.76 602.75 L 306.24 601.12 L 304.99 600.34 L 304.85 598.64 L 302.95 596.48 L 299.63 596.02 L 298.71 595.55 L 296.98 593.89 L 295.22 594.02 L 293.05 592.64 L 291.14 588.93 L 290.03 587.44 L 287.5 585.32 L 286.8 585.4 L 286.13 587.19 L 283.54 589.43 L 280.87 589.55 L 280.97 586.69 L 281.37 585.41 L 280.98 584.41 L 277.33 580.12 L 274.96 578.35 L 272.78 576.29 L 271.03 574.18 L 268.34 571.97 L 266.44 571.83 L 264.29 572.04 L 263.15 573.4 L 263.09 574.36 L 262.06 575.33 L 260.95 575.35 L 260.37 574.87 L 257.21 575.01 L 256.56 574.53 L 256.4 573.62 L 255.91 573.4 L 256.76 573.18 L 257.8 572.46 L 260.32 569.69 L 260.43 567.85 L 261.03 566.6 L 261.85 566.15 L 263.14 566.08 L 263.78 565.82 L 264.7 564.82 L 270.15 558.34 L 270.78 556.92 L 270.95 555.81 L 271.77 554.74 L 272.97 553.89 L 274.34 553.48 L 276.3 549.26 L 276.4 548.65 L 276.71 548.28 L 278.35 547.42 L 279.98 545.62 L 280.83 544.47 L 281.34 543.18 L 282.68 541.08 L 283.61 540.79 L 285.18 540.97 L 285.73 541.76 L 286.2 540.48 L 285.99 539.9 L 284.64 539.08 L 284.59 538.72 L 284.94 538.39 L 286.02 538.01 L 286.84 537.05 L 289.63 536.1 L 290.68 535.03 L 290.78 534.11 L 291.6 533.2 L 293.81 532.05 L 296.28 531.65 L 298.05 529.84 L 298.2 528.78 L 299.52 526.42 L 299.85 526.38 L 299.9 526.74 L 300.19 526.94 L 301.52 526.77 L 303.96 525.64 L 306.64 525.05 L 307.85 524.48 L 309.95 522.13 L 310.45 522.14 L 311.12 521.75 L 312.13 520.4 L 314.44 519.67 L 314.74 520.05 L 314.74 520.05 L 318.26 520.44 L 321.52 519.29 L 322.08 518.48 L 323.43 519.06 L 323.28 519.98 L 326.36 519.95 L 327.99 520.94 L 330.55 520.57 L 332.47 521.72 L 335.05 521.31 L 336.59 521.49 L 339.39 521.33 L 341.65 522.25 L 344.13 523.65 L 345.13 526.09 L 346.72 526.28 L 346.81 525.8 L 348.62 525.45 L 354.18 528.99 L 355.55 530.54 L 356.26 530.51 L 357.82 531.49 L 360.85 534.98 L 362.49 537.19 L 362.97 538.67 L 365.14 541.33 L 366.31 541.88 L 373 542.94 L 375.11 542.54 L 378.46 542.88 L 379.34 545.22 L 377.26 546.8 L 375.99 547.21 L 375.26 549.07 L 375.48 551.26 L 375.1 552.82 L 374.58 554.12 L 373.4 554.32 L 372.11 556.01 L 372.08 557.42 L 373.88 558.59 L 374.15 558.39 L 373.87 557.42 L 373.88 556.46 L 375.37 555.64 L 376.95 556.28 L 377.68 557.19 L 378.85 558.04 L 379.3 558.01 L 379.3 558.01 L 377.9 559.74 L 374 566.78 L 369.79 578.38 L 363.49 588.86 L 358.05 595.52 L 351.54 601.48 L 345.45 605.16 L 342.35 609.47 L 342.17 609.04 L 342.82 607.46 L 343.16 605.28 L 341.98 603.57 L 342.08 603.15 L 343.01 602.98 L 344.02 603.38 L 344.58 603.96 L 345.6 604 L 348.18 602.59 L 349 601.91 L 351.85 598.2 L 352.6 597.51 L 353.05 597.7 L 354.07 597.51 L 355.12 596.67 L 356.05 595.4 L 356.42 593.92 L 356.6 592.99 L 356.37 590.89 L 356.57 589.52 L 358.14 589.45 L 358.88 589.75 L 359.15 590.58 L 359.5 590.32 L 359.21 588.92 L 359.72 586.85 L 360.2 586.28 L 362.94 584.69 L 363.67 583.61 L 364.14 580.86 L 363.93 578.58 L 364.49 577.9 L 364.99 578.7 L 365.36 578.73 L 365.79 578.31 L 366.26 575.23 L 366.16 574.79 L 365.21 573.57 L 364.54 573.54 L 364.28 574.23 L 364.45 574.62 L 364.31 575.19 L 363.96 575.39 L 362.45 575.37 L 360.44 575.77 L 360.1 577.38 L 359.57 577.43 L 358.76 576.99 L 358.86 575.28 L 358.04 574.39 L 357 574.72 L 356.4 574.24 L 355.67 572.98 L 355.27 571.53 L 355.39 570.96 L 354.75 570.27 L 354.14 572.98 L 354.58 575.23 L 355.83 577.34 L 355.26 578.15 L 354.52 580.69 L 354.9 583.72 L 354.72 584.49 L 354.24 584.12 L 354.5 583.88 L 354.47 583.17 L 354 581.89 L 353.55 581.5 L 353.02 582.16 L 352.99 583.53 L 351.58 586.8 L 351.53 588.69 L 351.75 589.21 L 351.03 589.91 L 349.42 590.55 L 348.81 592.13 L 344.72 593.7 L 344 594.23 L 343.47 595.82 L 343.37 598.09 L 342.4 600.36 L 340.04 601.66 L 339.93 603.42 L 340.41 604.25 L 340.66 605.27 L 339.71 605.83 L 339.46 607.34 L 339.89 607.94 L 340.57 607.8 L 341.87 608.43 L 342.02 609.34 L 339.89 610.99 L 337.57 615.51 L 335.64 622.39 L 333.63 626.88 L 331.95 629.4 L 324.16 636.93 z"},{code:"SC",name:"Santa Catarina",gTransform:"matrix(1 0 0 1 51.41 209.71)",pathTransform:"translate(-357.4, -528.97)",d:"M 379.3 558.01 L 378.85 558.04 L 377.68 557.1899999999999 L 376.95 556.27 L 375.36 555.64 L 373.88 556.46 L 373.87 557.4200000000001 L 374.15 558.3900000000001 L 373.88 558.5900000000001 L 372.08 557.4200000000002 L 372.12 556.0100000000002 L 373.4 554.3200000000002 L 374.58 554.1200000000001 L 375.10999999999996 552.8100000000002 L 375.47999999999996 551.2600000000002 L 375.25999999999993 549.0700000000002 L 375.98999999999995 547.2100000000002 L 377.25999999999993 546.7900000000002 L 379.3399999999999 545.2100000000002 L 378.4599999999999 542.8700000000001 L 375.1099999999999 542.5300000000001 L 372.9999999999999 542.9300000000001 L 366.3099999999999 541.8700000000001 L 365.14999999999986 541.3300000000002 L 362.97999999999985 538.6700000000002 L 362.48999999999984 537.1900000000002 L 360.85999999999984 534.9800000000001 L 357.82999999999987 531.4900000000001 L 356.2599999999999 530.5000000000001 L 355.5499999999999 530.5300000000001 L 354.1799999999999 528.9800000000001 L 348.6199999999999 525.4400000000002 L 346.8099999999999 525.7800000000002 L 346.7199999999999 526.2600000000002 L 345.1199999999999 526.0700000000002 L 344.1199999999999 523.6300000000001 L 341.64999999999986 522.2400000000001 L 339.3799999999999 521.3100000000002 L 336.58999999999986 521.4700000000001 L 335.04999999999984 521.2900000000002 L 332.45999999999987 521.7000000000002 L 330.54999999999984 520.5500000000002 L 327.97999999999985 520.9100000000002 L 326.34999999999985 519.9300000000002 L 323.26999999999987 519.9600000000002 L 323.41999999999985 519.0300000000002 L 322.0699999999998 518.4500000000002 L 321.5099999999998 519.2600000000001 L 318.24999999999983 520.4200000000001 L 314.72999999999985 520.0300000000001 L 314.72999999999985 520.0300000000001 L 316.17999999999984 517.1000000000001 L 316.90999999999985 515.0100000000001 L 316.32999999999987 511.7600000000001 L 316.7399999999999 508.5500000000001 L 316.6999999999999 506.0000000000001 L 317.65999999999985 504.2500000000001 L 317.65999999999985 504.2500000000001 L 321.28999999999985 504.2700000000001 L 321.99999999999983 503.8900000000001 L 322.5299999999998 503.9000000000001 L 323.5899999999998 504.1400000000001 L 323.8999999999998 504.6500000000001 L 325.9299999999998 506.0600000000001 L 328.6099999999998 506.0900000000001 L 330.94999999999976 505.5100000000001 L 336.2399999999998 507.1900000000001 L 340.4999999999998 507.5500000000001 L 341.51999999999975 508.1800000000001 L 341.68999999999977 508.59000000000015 L 343.25999999999976 509.77000000000015 L 347.02999999999975 510.19000000000017 L 351.27999999999975 510.0600000000002 L 352.60999999999973 511.96000000000015 L 352.78999999999974 511.46000000000015 L 353.52999999999975 511.08000000000015 L 354.44999999999976 511.0600000000002 L 355.31999999999977 510.20000000000016 L 354.46999999999974 507.21000000000015 L 355.15999999999974 505.63000000000017 L 355.87999999999977 504.8500000000002 L 357.87999999999977 503.7100000000002 L 361.44999999999976 504.1100000000002 L 363.31999999999977 503.14000000000016 L 364.0499999999998 502.27000000000015 L 364.63999999999976 500.79000000000013 L 366.16999999999973 500.14000000000016 L 367.27999999999975 500.00000000000017 L 368.69999999999976 500.76000000000016 L 369.50999999999976 500.79000000000013 L 371.83999999999975 500.6200000000001 L 374.6799999999997 499.8900000000001 L 375.4299999999997 499.9000000000001 L 376.46999999999974 500.30000000000007 L 379.58999999999975 502.9000000000001 L 380.81999999999977 503.5200000000001 L 382.25999999999976 503.6800000000001 L 385.6099999999998 501.5500000000001 L 386.9599999999998 500.1200000000001 L 388.5199999999998 499.5500000000001 L 388.6399999999998 499.9400000000001 L 389.3999999999998 500.0100000000001 L 391.1399999999998 499.7800000000001 L 391.4699999999998 499.3400000000001 L 396.7099999999998 499.37000000000006 L 396.7099999999998 499.37000000000006 L 396.3199999999998 500.69000000000005 L 396.8299999999998 502.34000000000003 L 396.7599999999998 502.73 L 395.2599999999998 503.87 L 394.2799999999998 503.39 L 393.4599999999998 500.86 L 393.4399999999998 501.98 L 394.0299999999998 504.70000000000005 L 395.7399999999998 506.36000000000007 L 396.2999999999998 507.31000000000006 L 395.2899999999998 509.6000000000001 L 395.12999999999977 511.9200000000001 L 395.2299999999998 512.35 L 395.9899999999998 513.08 L 396.2499999999998 518.94 L 396.5599999999998 519.49 L 396.9899999999998 519.69 L 397.75999999999976 519.1800000000001 L 398.1099999999998 519.9000000000001 L 398.2099999999998 520.7700000000001 L 397.7399999999998 520.83 L 397.3099999999998 520.5500000000001 L 396.1199999999998 521.1800000000001 L 395.7799999999998 525.0200000000001 L 396.3499999999998 527.6100000000001 L 395.7799999999998 528.3600000000001 L 396.0899999999998 530.2900000000001 L 396.99999999999983 532.1700000000001 L 396.1399999999998 534.5100000000001 L 395.61999999999983 538.5200000000001 L 393.90999999999985 543.2 L 393.5699999999999 543.1 L 393.20999999999987 542.34 L 393.41999999999985 541.37 L 392.49999999999983 540.19 L 392.23999999999984 540.5200000000001 L 392.41999999999985 542.95 L 393.57999999999987 543.7800000000001 L 392.65999999999985 545.44 L 391.01999999999987 546.09 L 386.8899999999999 549.13 L 384.08999999999986 551.6899999999999 L 380.33999999999986 556.13 L 379.3 558.01 z M 397.18 531.46 L 397.03000000000003 530.99 L 397.28000000000003 529.24 L 398.04 526.84 L 397.64000000000004 525.6600000000001 L 397.80000000000007 524.6400000000001 L 399.20000000000005 523.8800000000001 L 399.4200000000001 523.94 L 400.0800000000001 524.8800000000001 L 399.5400000000001 527.44 L 398.7200000000001 528.3000000000001 L 398.1300000000001 529.5200000000001 L 398.3300000000001 530.69 L 397.18 531.46 z M 396.73 507.09 L 394.86 505.07 L 397.41 502.63 L 397.66 502.67 L 398.31 503.72 L 397.45 505.04 L 396.73 507.09 z"},{code:"SE",name:"Sergipe",gTransform:"matrix(1 0 0 1 266.49 -72.82)",pathTransform:"translate(-572.49, -246.44)",d:"M 569.94 261.69 L 567.04 262.58 L 565.49 261.94 L 564.95 261.6 L 564.47 260.88 L 562.55 259.96 L 561.95 259.44 L 561.83 259.03 L 562.17 258.64 L 562.3 257.22 L 562.15 256.83 L 560.72 255.32 L 560.2 253.83 L 559.11 253.16 L 558.15 251.56 L 558.13 250.79 L 558.72 249.21 L 559.04 248.91 L 560.74 248.92 L 561.87 249.67 L 564.42 248.68 L 565.11 248.13 L 565.41 247.55 L 564.65 244.8 L 564.73 243.92 L 565.39 242.3 L 565.47 239.19 L 564.72 238.04 L 562.73 236.09 L 561.46 233.59 L 561.24 231.45 L 561.91 230.3 L 561.91 230.3 L 568.37 233.28 L 572.05 234.23 L 577.47 237.3 L 578.77 239.75 L 580.53 241.2 L 582.19 241.99 L 582.65 242.02 L 586.24 244.25 L 586.84 245.56 L 586.84 245.56 L 584.46 246.32 L 579.89 249.26 L 578.92 250.15 L 577.37 252.36 L 577.05 252.34 L 577.16 251.24 L 576.11 249.42 L 575.12 249.58 L 575.46 250.74 L 576.7 250.74 L 576.93 250.98 L 576.41 252.95 L 575.14 255.04 L 574.61 254.69 L 574.24 254.02 L 573.25 253.86 L 573.45 254.54 L 574.58 255.16 L 574.32 256.93 L 573.46 258.08 L 572.53 260.11 L 571.75 260.26 L 571.45 259.8 L 571.93 258.4 L 572.34 258.27 L 572.65 257.84 L 573.02 256.8 L 572.21 256.43 L 572.31 257.11 L 571.86 258.24 L 571.38 258.74 L 571.12 259.83 L 571.4 260.55 L 571.14 261.07 z"},{code:"SP",name:"São Paulo",gTransform:"matrix(1 0 0 1 89.6 122.15)",pathTransform:"translate(-395.6, -441.42)",d:"M 404.58 487.92 L 404.41999999999996 486.59000000000003 L 402.99999999999994 486.02000000000004 L 402.2699999999999 482.72 L 402.6699999999999 480.77000000000004 L 400.5299999999999 480.19000000000005 L 399.7699999999999 480.36000000000007 L 398.6699999999999 483.13000000000005 L 398.0099999999999 483.9800000000001 L 396.9499999999999 483.4500000000001 L 396.59999999999985 482.67000000000013 L 397.28999999999985 479.3700000000001 L 398.17999999999984 478.7100000000001 L 398.3199999999998 478.3100000000001 L 396.7099999999998 477.04000000000013 L 395.11999999999983 476.91000000000014 L 393.53999999999985 477.10000000000014 L 393.03999999999985 476.72000000000014 L 389.6299999999998 477.2500000000001 L 387.24999999999983 477.3700000000001 L 386.23999999999984 477.16000000000014 L 385.6399999999998 476.77000000000015 L 385.30999999999983 474.73000000000013 L 386.5899999999998 472.6100000000001 L 386.8399999999998 471.5600000000001 L 386.5899999999998 471.1200000000001 L 385.9899999999998 470.8200000000001 L 385.06999999999977 468.8500000000001 L 385.12999999999977 467.9600000000001 L 384.62999999999977 467.2800000000001 L 383.95999999999975 466.99000000000007 L 382.7499999999998 465.8500000000001 L 381.25999999999976 462.8400000000001 L 381.6199999999998 462.2900000000001 L 381.69999999999976 460.5300000000001 L 380.39999999999975 459.0100000000001 L 380.01999999999975 457.17000000000013 L 380.18999999999977 456.3600000000001 L 380.57999999999976 455.78000000000014 L 380.5599999999998 453.04000000000013 L 379.6699999999998 451.28000000000014 L 376.0799999999998 448.45000000000016 L 374.9499999999998 446.90000000000015 L 371.9799999999998 447.76000000000016 L 366.6699999999998 447.63000000000017 L 366.00999999999976 447.09000000000015 L 364.3599999999998 446.95000000000016 L 363.93999999999977 447.29000000000013 L 362.21999999999974 447.22000000000014 L 361.4999999999997 445.90000000000015 L 360.8699999999997 445.39000000000016 L 357.35999999999973 444.59000000000015 L 355.60999999999973 443.75000000000017 L 354.82999999999976 442.75000000000017 L 352.2499999999998 442.76000000000016 L 351.1799999999998 443.3000000000002 L 349.8599999999998 443.1700000000002 L 347.2199999999998 442.0800000000002 L 344.6899999999998 441.62000000000023 L 343.2099999999998 440.8300000000002 L 342.0399999999998 440.5400000000002 L 341.3099999999998 440.9100000000002 L 340.9699999999998 441.5100000000002 L 339.7599999999998 442.1300000000002 L 336.47999999999985 441.8400000000002 L 332.46999999999986 441.9500000000002 L 328.6399999999999 441.30000000000024 L 325.3899999999999 443.59000000000026 L 325.3899999999999 443.59000000000026 L 326.22999999999985 442.5100000000003 L 326.95999999999987 440.97000000000025 L 328.21999999999986 439.83000000000027 L 335.77999999999986 435.29000000000025 L 337.72999999999985 433.42000000000024 L 338.98999999999984 430.99000000000024 L 340.71999999999986 429.30000000000024 L 341.11999999999983 428.09000000000026 L 342.55999999999983 427.0600000000003 L 342.8399999999998 425.84000000000026 L 342.4899999999998 425.0000000000003 L 344.4899999999998 422.7400000000003 L 345.69999999999976 420.4000000000003 L 345.76999999999975 419.4600000000003 L 345.45999999999975 417.5300000000003 L 345.68999999999977 417.1400000000003 L 346.64999999999975 416.62000000000035 L 349.2499999999998 412.98000000000036 L 349.4099999999998 410.05000000000035 L 350.0299999999998 408.37000000000035 L 351.0399999999998 408.07000000000033 L 351.7699999999998 407.43000000000035 L 353.7599999999998 404.75000000000034 L 354.97999999999985 403.73000000000036 L 355.4499999999999 403.50000000000034 L 356.7599999999999 403.4600000000003 L 358.2599999999999 402.68000000000035 L 358.53999999999985 402.28000000000037 L 358.9399999999998 399.8200000000004 L 358.9399999999998 399.8200000000004 L 360.15999999999985 398.6900000000004 L 362.30999999999983 397.5800000000004 L 364.22999999999985 397.2100000000004 L 365.65999999999985 395.5200000000004 L 367.15999999999985 394.91000000000037 L 367.90999999999985 395.05000000000035 L 369.6399999999999 396.60000000000036 L 372.1899999999999 396.68000000000035 L 376.4799999999999 397.6400000000003 L 378.1499999999999 397.2800000000003 L 379.7699999999999 397.50000000000034 L 381.7699999999999 396.91000000000037 L 383.94999999999993 398.3300000000004 L 385.61999999999995 399.1200000000004 L 385.48999999999995 400.0400000000004 L 385.81999999999994 401.46000000000043 L 387.0299999999999 403.5500000000004 L 387.6599999999999 403.5800000000004 L 388.19999999999993 403.2600000000004 L 388.86999999999995 402.3200000000004 L 389.28 401.1900000000004 L 389.53999999999996 401.0000000000004 L 390.09 401.0500000000004 L 390.45 401.4400000000004 L 390.7 402.4000000000004 L 390.71 405.18000000000035 L 391.90999999999997 405.7100000000003 L 392.32 405.26000000000033 L 392.05 402.7200000000003 L 392.54 401.5300000000003 L 392.99 401.0500000000003 L 401.17 400.3800000000003 L 402.18 399.1300000000003 L 403.68 400.59000000000026 L 404.8 401.02000000000027 L 407.58 400.33000000000027 L 408.02 399.34000000000026 L 407.82 398.8800000000003 L 408.13 398.27000000000027 L 410.51 398.16000000000025 L 412.17 398.9400000000002 L 413.02000000000004 398.30000000000024 L 414.33000000000004 398.0100000000002 L 417.59000000000003 401.36000000000024 L 417.79 402.40000000000026 L 417.22 403.41000000000025 L 416.93 405.78000000000026 L 417.51 406.39000000000027 L 419.4 407.60000000000025 L 419.79999999999995 409.15000000000026 L 419.73999999999995 409.71000000000026 L 418.21999999999997 411.74000000000024 L 418.03999999999996 413.68000000000023 L 418.83 414.42000000000024 L 419.14 415.03000000000026 L 419.51 417.24000000000024 L 420.81 419.04000000000025 L 421.64 421.03000000000026 L 421.61 421.8800000000003 L 423.22 421.83000000000027 L 424 421.52000000000027 L 424.28 421.16000000000025 L 425.28 421.11000000000024 L 428.97999999999996 422.43000000000023 L 429.21 422.80000000000024 L 429.15999999999997 424.0700000000002 L 428.46 426.2500000000002 L 426.59999999999997 428.97000000000025 L 426.85999999999996 431.91000000000025 L 426.66999999999996 435.36000000000024 L 426.14 436.92000000000024 L 426.86 438.52000000000027 L 428.64 439.7600000000003 L 430.45 440.59000000000026 L 430.96 442.3100000000003 L 429.75 443.0100000000003 L 431.77 446.3200000000003 L 432.9 446.5700000000003 L 434.90999999999997 446.33000000000027 L 435.09 446.86000000000024 L 438.71 445.86000000000024 L 439.27 446.28000000000026 L 440.58 445.96000000000026 L 441.33 444.98000000000025 L 441.38 444.14000000000027 L 441.14 443.90000000000026 L 441.31 441.60000000000025 L 442.5 441.27000000000027 L 442.59 441.6200000000003 L 442.23999999999995 442.1100000000003 L 442.24999999999994 442.5900000000003 L 444.5899999999999 442.6700000000003 L 446.9799999999999 442.4200000000003 L 448.7699999999999 441.7500000000003 L 449.99999999999994 440.5100000000003 L 451.92999999999995 439.4900000000003 L 454.13999999999993 439.27000000000027 L 455.37999999999994 438.54000000000025 L 455.37999999999994 438.54000000000025 L 456.6499999999999 439.08000000000027 L 457.2099999999999 440.2500000000003 L 458.43999999999994 441.84000000000026 L 460.2099999999999 442.23000000000025 L 463.3599999999999 441.7000000000003 L 465.0599999999999 441.71000000000026 L 465.8099999999999 443.35000000000025 L 464.1599999999999 445.5000000000002 L 462.6599999999999 446.2100000000002 L 459.88999999999993 446.5700000000002 L 459.38999999999993 446.42000000000024 L 457.0399999999999 447.43000000000023 L 455.94999999999993 448.5800000000002 L 454.85999999999996 452.0800000000002 L 454.90999999999997 452.49000000000024 L 456.53999999999996 454.22000000000025 L 457.02 454.48000000000025 L 457.02 454.48000000000025 L 456.96 454.68000000000023 L 455.27 455.10000000000025 L 454.21 454.28000000000026 L 452.72999999999996 455.39000000000027 L 452.29999999999995 456.04000000000025 L 452.56999999999994 456.2600000000003 L 451.80999999999995 456.90000000000026 L 448.5899999999999 458.4500000000003 L 446.3399999999999 459.15000000000026 L 446.05999999999995 459.59000000000026 L 446.09999999999997 460.55000000000024 L 446.59999999999997 462.10000000000025 L 446.28 462.52000000000027 L 444.88 462.78000000000026 L 444.18 462.14000000000027 L 442.84000000000003 461.85000000000025 L 439.72 461.35000000000025 L 438.86 461.5000000000002 L 437.54 461.8400000000002 L 435.81 462.6600000000002 L 435.31 463.1700000000002 L 434.1 465.32000000000016 L 432.79 465.89000000000016 L 432.29 465.77000000000015 L 432.87 465.3000000000001 L 432.39 464.0800000000001 L 431.21999999999997 463.2300000000001 L 430.39 464.4600000000001 L 430.65 465.2100000000001 L 430.34999999999997 465.8200000000001 L 422.72999999999996 470.0600000000001 L 421.78 470.8800000000001 L 421.46999999999997 472.04000000000013 L 418.2 475.04000000000013 L 414.95 476.9900000000001 L 413.03 477.5200000000001 L 408.53 480.7300000000001 L 406.2 482.69000000000005 L 405.53 482.77000000000004 L 405.09 483.39000000000004 L 405.98999999999995 483.82000000000005 L 406.65 483.88000000000005 L 407.58 483.52000000000004 L 407.58 484.28000000000003 L 406.96 485.59000000000003 L 405.64 486.44000000000005 L 404.58 487.92 z M 448.89 464.91 L 447.34999999999997 464.26000000000005 L 446.18999999999994 464.44000000000005 L 445.69999999999993 464.06000000000006 L 445.79999999999995 463.2800000000001 L 446.74999999999994 462.6300000000001 L 447.8399999999999 460.7800000000001 L 448.55999999999995 461.0300000000001 L 449.21999999999997 461.68000000000006 L 449.34999999999997 464.5900000000001 L 448.89 464.91 z"},{code:"TO",name:"Tocantins",gTransform:"matrix(1 0 0 1 95.98 -93.17)",pathTransform:"translate(-401.98, -226.09)",d:"M 433.35 281.82 L 427.99 283.24 L 426.25 284.58 L 423.69 285.68 L 422.14 285.68 L 417.61 286.68 L 415.09 288.76 L 413.31 289.66 L 412.85 289.42 L 411.34 286.8 L 410.79 286.77 L 410.28 290.07 L 409.59 290.15 L 406.24 289.47 L 403.11 288 L 403.67 286.44 L 403.45 285.7 L 398.92 286.23 L 396.16 285.89 L 395.6 286.43 L 395.3 287.43 L 394.55 288.18 L 393.41 288.13 L 392.8 285.03 L 391.69 281.32 L 390.65 279.44 L 389.5 278.13 L 388.32 279.1 L 386.85 281.49 L 385.22 287.43 L 384.59 287.66 L 380.52 286.23 L 377.43 284.52 L 373.5 284.12 L 371.3 283.09 L 368.9 282.69 L 369.42 280.35 L 370.64 278.47 L 370.67 276.76 L 370.11 277.06 L 368.3 279.15 L 367.64 280.38 L 367.44 282.26 L 367.1 282.71 L 367.1 282.71 L 366.3 282.69 L 365.34 282.18 L 364.36 278.84 L 365.1 276.08 L 364.66 273.03 L 364.14 272.45 L 364.13 270.88 L 364.6 267.57 L 363.5 265.32 L 363.55 264.82 L 364.37 263.93 L 364.53 263.06 L 363.14 261.72 L 363.08 260.86 L 364.96 254.87 L 365 251.92 L 365.54 248.95 L 367.48 243.66 L 367.85 243.39 L 368.28 242.54 L 368.72 239.4 L 369.82 238.15 L 370.38 236.26 L 371.03 235.24 L 371.03 235.24 L 372.65 231.55 L 373.78 227.1 L 374.93 225.52 L 376.12 224.42 L 377.33 222.74 L 378.36 220.82 L 379.73 219.9 L 380.78 219.74 L 381.51 218.89 L 382.45 217.35 L 382.63 216.36 L 384.33 213.12 L 385.42 212.32 L 387.18 207.17 L 387.84 203.13 L 387.69 202.83 L 386.95 202.51 L 385.28 200.77 L 384.68 199.82 L 384.52 198.94 L 384.66 198.37 L 386.07 196.68 L 387.36 194.58 L 387.3 191.91 L 386.87 189.73 L 387.06 189.38 L 389.53 187.6 L 392.94 186.46 L 395.44 185.25 L 395.68 184.75 L 395.53 183.24 L 396.39 181.97 L 397.9 180.63 L 399.19 180.48 L 399.38 179.14 L 399.09 177.94 L 399.34 177.48 L 400.8 177.02 L 401.44 176.54 L 402.37 173.79 L 401.35 172.45 L 401.26 171.05 L 401.55 170.77 L 402.52 170.69 L 403.24 170.32 L 403.61 169.66 L 403.64 169.02 L 402.38 167.85 L 401.51 167.71 L 401.12 167.4 L 400.1 165.74 L 398.81 165.62 L 396.94 165.87 L 394.65 165.06 L 394.65 165.06 L 395.18 164.42 L 397.8 162.57 L 399.76 162.04 L 400.63 162.09 L 403.41 163.61 L 404.81 163.69 L 405.76 163.17 L 407.5 163.46 L 408.09 164.15 L 408.17 165.18 L 408.45 165.5 L 409.67 165.53 L 413.07 166.96 L 413.91 167.99 L 414.38 171.49 L 415.02 172.99 L 414.81 176.71 L 415.04 177.79 L 415.71 178.92 L 415.7 179.36 L 413.93 185.51 L 413.62 187.88 L 413.9 188.88 L 413.65 190.47 L 411.9 192.51 L 410.14 193.18 L 409.96 193.89 L 411.9 195.21 L 412.32 194.94 L 413.69 195.18 L 413.94 195.53 L 414.05 196.41 L 413.43 197.6 L 414.28 199.04 L 415.16 198.97 L 418.16 203.13 L 419.07 203.98 L 421.35 207 L 423.49 205.66 L 427.76 204.72 L 429.56 205.94 L 429.64 207.69 L 429 210.94 L 429.39 212.29 L 426 212.64 L 424.66 213.18 L 424.09 213.73 L 423.41 215.16 L 422.68 217.84 L 423.05 219.14 L 420.42 221.69 L 420.16 222.39 L 420.36 222.81 L 422.44 223.1 L 423.38 223.79 L 424.12 225.38 L 424.18 227.04 L 424.8 228.08 L 428.68 230.03 L 428.77 230.56 L 427.13 232.37 L 427.26 234.02 L 429.4 235.64 L 430.39 238.51 L 431.73 240.51 L 432.44 240.69 L 434.22 240.48 L 435.22 240.78 L 436.04 241.22 L 436.65 242.04 L 437.93 242.7 L 437.93 242.7 L 440.87 242.91 L 440.87 242.91 L 440.18 243.56 L 439.96 244.54 L 439.4 245.01 L 435.58 247.03 L 432.37 249.65 L 432.18 250.02 L 433.47 251.82 L 433.11 252.21 L 432.1 252.48 L 431.2 253.09 L 429.68 256.58 L 428.67 257.3 L 428.17 258.46 L 428.4 259.38 L 430.26 261.33 L 433.85 262 L 435.72 262.99 L 435.77 263.75 L 435.21 264.2 L 433.17 265.01 L 432.74 265.97 L 432.83 266.47 L 433.18 266.8 L 434.21 266.62 L 435.13 266.91 L 435.71 267.42 L 436 268.06 L 435.04 268.77 L 433.89 269.19 L 431.94 270.86 L 431.75 271.71 L 431.7 274.63 L 432.05 275.88 L 432.99 276.54 L 434.04 276.78 L 434.45 277.03 L 434.62 277.45 L 434.67 278.51 L 433.31 280.89 z"}];function Rre({selected:t,onSelect:e}){const s=ue(),[n,r]=P.useState(Are),i=a=>{if(a)try{const l=a.getBBox();if(!l.width||!l.height)return;const c=Math.max(l.width,l.height)*.04,d=`${l.x-c} ${l.y-c} ${l.width+c*2} ${l.height+c*2}`;r(h=>h===d?h:d)}catch{}};return o.jsx("svg",{ref:i,viewBox:n,role:"group","aria-label":s("sectionsEditor.brazilMap.ariaLabel"),className:"h-72 w-full rounded-md border border-border/60 bg-muted/20",children:o.jsx("g",{transform:Ere,children:ox.map(a=>{const l=a.code===t;return o.jsx("g",{transform:a.gTransform,children:o.jsx("path",{d:a.d,transform:a.pathTransform,role:"button",tabIndex:0,"aria-label":a.name,"aria-pressed":l,onClick:()=>e(a.code),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),e(a.code))},className:le("cursor-pointer stroke-background outline-none transition-colors [stroke-width:1] [vector-effect:non-scaling-stroke]","hover:fill-primary/50 focus-visible:fill-primary/50",l?"fill-primary":"fill-muted-foreground/40")})},a.code)})})})}const Dre=[{code:"AF",name:"Afghanistan"},{code:"AX",name:"Åland Islands"},{code:"AL",name:"Albania"},{code:"DZ",name:"Algeria"},{code:"AS",name:"American Samoa"},{code:"AD",name:"Andorra"},{code:"AO",name:"Angola"},{code:"AI",name:"Anguilla"},{code:"AQ",name:"Antarctica"},{code:"AG",name:"Antigua & Barbuda"},{code:"AR",name:"Argentina"},{code:"AM",name:"Armenia"},{code:"AW",name:"Aruba"},{code:"AU",name:"Australia"},{code:"AT",name:"Austria"},{code:"AZ",name:"Azerbaijan"},{code:"BS",name:"Bahamas"},{code:"BH",name:"Bahrain"},{code:"BD",name:"Bangladesh"},{code:"BB",name:"Barbados"},{code:"BY",name:"Belarus"},{code:"BE",name:"Belgium"},{code:"BZ",name:"Belize"},{code:"BJ",name:"Benin"},{code:"BM",name:"Bermuda"},{code:"BT",name:"Bhutan"},{code:"BO",name:"Bolivia"},{code:"BA",name:"Bosnia & Herzegovina"},{code:"BW",name:"Botswana"},{code:"BV",name:"Bouvet Island"},{code:"BR",name:"Brazil"},{code:"VG",name:"British Virgin Islands"},{code:"BN",name:"Brunei"},{code:"BG",name:"Bulgaria"},{code:"BF",name:"Burkina Faso"},{code:"BI",name:"Burundi"},{code:"KH",name:"Cambodia"},{code:"CM",name:"Cameroon"},{code:"CA",name:"Canada"},{code:"CV",name:"Cape Verde"},{code:"BQ",name:"Caribbean Netherlands"},{code:"KY",name:"Cayman Islands"},{code:"CF",name:"Central African Republic"},{code:"TD",name:"Chad"},{code:"IO",name:"Chagos Archipelago"},{code:"CL",name:"Chile"},{code:"CN",name:"China mainland"},{code:"CX",name:"Christmas Island"},{code:"CC",name:"Cocos (Keeling) Islands"},{code:"CO",name:"Colombia"},{code:"KM",name:"Comoros"},{code:"CG",name:"Congo - Brazzaville"},{code:"CD",name:"Congo - Kinshasa"},{code:"CK",name:"Cook Islands"},{code:"CR",name:"Costa Rica"},{code:"CI",name:"Côte d’Ivoire"},{code:"HR",name:"Croatia"},{code:"CU",name:"Cuba"},{code:"CW",name:"Curaçao"},{code:"CY",name:"Cyprus"},{code:"CZ",name:"Czechia"},{code:"DK",name:"Denmark"},{code:"DJ",name:"Djibouti"},{code:"DM",name:"Dominica"},{code:"DO",name:"Dominican Republic"},{code:"EC",name:"Ecuador"},{code:"EG",name:"Egypt"},{code:"SV",name:"El Salvador"},{code:"GQ",name:"Equatorial Guinea"},{code:"ER",name:"Eritrea"},{code:"EE",name:"Estonia"},{code:"SZ",name:"Eswatini"},{code:"ET",name:"Ethiopia"},{code:"FK",name:"Falkland Islands"},{code:"FO",name:"Faroe Islands"},{code:"FJ",name:"Fiji"},{code:"FI",name:"Finland"},{code:"FR",name:"France"},{code:"GF",name:"French Guiana"},{code:"PF",name:"French Polynesia"},{code:"TF",name:"French Southern Territories"},{code:"GA",name:"Gabon"},{code:"GM",name:"Gambia"},{code:"GE",name:"Georgia"},{code:"DE",name:"Germany"},{code:"GH",name:"Ghana"},{code:"GI",name:"Gibraltar"},{code:"GR",name:"Greece"},{code:"GL",name:"Greenland"},{code:"GD",name:"Grenada"},{code:"GP",name:"Guadeloupe"},{code:"GU",name:"Guam"},{code:"GT",name:"Guatemala"},{code:"GG",name:"Guernsey"},{code:"GN",name:"Guinea"},{code:"GW",name:"Guinea-Bissau"},{code:"GY",name:"Guyana"},{code:"HT",name:"Haiti"},{code:"HM",name:"Heard & McDonald Islands"},{code:"HN",name:"Honduras"},{code:"HK",name:"Hong Kong"},{code:"HU",name:"Hungary"},{code:"IS",name:"Iceland"},{code:"IN",name:"India"},{code:"ID",name:"Indonesia"},{code:"IR",name:"Iran"},{code:"IQ",name:"Iraq"},{code:"IE",name:"Ireland"},{code:"IM",name:"Isle of Man"},{code:"IL",name:"Israel"},{code:"IT",name:"Italy"},{code:"JM",name:"Jamaica"},{code:"JP",name:"Japan"},{code:"JE",name:"Jersey"},{code:"JO",name:"Jordan"},{code:"KZ",name:"Kazakhstan"},{code:"KE",name:"Kenya"},{code:"KI",name:"Kiribati"},{code:"KW",name:"Kuwait"},{code:"KG",name:"Kyrgyzstan"},{code:"LA",name:"Laos"},{code:"LV",name:"Latvia"},{code:"LB",name:"Lebanon"},{code:"LS",name:"Lesotho"},{code:"LR",name:"Liberia"},{code:"LY",name:"Libya"},{code:"LI",name:"Liechtenstein"},{code:"LT",name:"Lithuania"},{code:"LU",name:"Luxembourg"},{code:"MO",name:"Macao"},{code:"MG",name:"Madagascar"},{code:"MW",name:"Malawi"},{code:"MY",name:"Malaysia"},{code:"MV",name:"Maldives"},{code:"ML",name:"Mali"},{code:"MT",name:"Malta"},{code:"MH",name:"Marshall Islands"},{code:"MQ",name:"Martinique"},{code:"MR",name:"Mauritania"},{code:"MU",name:"Mauritius"},{code:"YT",name:"Mayotte"},{code:"MX",name:"Mexico"},{code:"FM",name:"Micronesia"},{code:"MD",name:"Moldova"},{code:"MC",name:"Monaco"},{code:"MN",name:"Mongolia"},{code:"ME",name:"Montenegro"},{code:"MS",name:"Montserrat"},{code:"MA",name:"Morocco"},{code:"MZ",name:"Mozambique"},{code:"MM",name:"Myanmar (Burma)"},{code:"NA",name:"Namibia"},{code:"NR",name:"Nauru"},{code:"NP",name:"Nepal"},{code:"NL",name:"Netherlands"},{code:"NC",name:"New Caledonia"},{code:"NZ",name:"New Zealand"},{code:"NI",name:"Nicaragua"},{code:"NE",name:"Niger"},{code:"NG",name:"Nigeria"},{code:"NU",name:"Niue"},{code:"NF",name:"Norfolk Island"},{code:"KP",name:"North Korea"},{code:"MK",name:"North Macedonia"},{code:"MP",name:"Northern Mariana Islands"},{code:"NO",name:"Norway"},{code:"OM",name:"Oman"},{code:"PK",name:"Pakistan"},{code:"PW",name:"Palau"},{code:"PS",name:"Palestinian Territories"},{code:"PA",name:"Panama"},{code:"PG",name:"Papua New Guinea"},{code:"PY",name:"Paraguay"},{code:"PE",name:"Peru"},{code:"PH",name:"Philippines"},{code:"PN",name:"Pitcairn Islands"},{code:"PL",name:"Poland"},{code:"PT",name:"Portugal"},{code:"PR",name:"Puerto Rico"},{code:"QA",name:"Qatar"},{code:"RE",name:"Réunion"},{code:"RO",name:"Romania"},{code:"RU",name:"Russia"},{code:"RW",name:"Rwanda"},{code:"WS",name:"Samoa"},{code:"SM",name:"San Marino"},{code:"ST",name:"São Tomé & Príncipe"},{code:"SA",name:"Saudi Arabia"},{code:"SN",name:"Senegal"},{code:"RS",name:"Serbia"},{code:"SC",name:"Seychelles"},{code:"SL",name:"Sierra Leone"},{code:"SG",name:"Singapore"},{code:"SX",name:"Sint Maarten"},{code:"SK",name:"Slovakia"},{code:"SI",name:"Slovenia"},{code:"GS",name:"So. Georgia & So. Sandwich Isl."},{code:"SB",name:"Solomon Islands"},{code:"SO",name:"Somalia"},{code:"ZA",name:"South Africa"},{code:"KR",name:"South Korea"},{code:"SS",name:"South Sudan"},{code:"ES",name:"Spain"},{code:"LK",name:"Sri Lanka"},{code:"BL",name:"St. Barthélemy"},{code:"SH",name:"St. Helena"},{code:"KN",name:"St. Kitts & Nevis"},{code:"LC",name:"St. Lucia"},{code:"MF",name:"St. Martin"},{code:"PM",name:"St. Pierre & Miquelon"},{code:"VC",name:"St. Vincent & Grenadines"},{code:"SD",name:"Sudan"},{code:"SR",name:"Suriname"},{code:"SJ",name:"Svalbard & Jan Mayen"},{code:"SE",name:"Sweden"},{code:"CH",name:"Switzerland"},{code:"SY",name:"Syria"},{code:"TW",name:"Taiwan"},{code:"TJ",name:"Tajikistan"},{code:"TZ",name:"Tanzania"},{code:"TH",name:"Thailand"},{code:"TL",name:"Timor-Leste"},{code:"TG",name:"Togo"},{code:"TK",name:"Tokelau"},{code:"TO",name:"Tonga"},{code:"T1",name:"Tor network (Cloudflare)"},{code:"TT",name:"Trinidad & Tobago"},{code:"TN",name:"Tunisia"},{code:"TR",name:"Türkiye"},{code:"TM",name:"Turkmenistan"},{code:"TC",name:"Turks & Caicos Islands"},{code:"TV",name:"Tuvalu"},{code:"UM",name:"U.S. Outlying Islands"},{code:"VI",name:"U.S. Virgin Islands"},{code:"UG",name:"Uganda"},{code:"UA",name:"Ukraine"},{code:"AE",name:"United Arab Emirates"},{code:"GB",name:"United Kingdom"},{code:"US",name:"United States"},{code:"XX",name:"Unknown (Cloudflare could not determine)"},{code:"UY",name:"Uruguay"},{code:"UZ",name:"Uzbekistan"},{code:"VU",name:"Vanuatu"},{code:"VA",name:"Vatican City"},{code:"VE",name:"Venezuela"},{code:"VN",name:"Vietnam"},{code:"WF",name:"Wallis & Futuna"},{code:"EH",name:"Western Sahara"},{code:"YE",name:"Yemen"},{code:"ZM",name:"Zambia"},{code:"ZW",name:"Zimbabwe"}],Mre="BR";function Ire(t){if(!t)return!1;const e=Object.keys(t).sort();return e.length===3&&e[0]==="city"&&e[1]==="country"&&e[2]==="regionCode"}function Ore(t){const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return{city:typeof e.city=="string"?e.city:"",regionCode:typeof e.regionCode=="string"?e.regionCode:"",country:typeof e.country=="string"?e.country:""}}function $re(t,e){const s={...t,...e},n={};for(const r of["city","regionCode","country"])s[r]&&(n[r]=s[r]);return n}function Xb(t){const e=U.c(37),{id:s,options:n,value:r,placeholder:i,emptyMessage:a,onChange:l}=t,[c,d]=P.useState(!1);let h;if(e[0]!==n||e[1]!==r){let S;e[3]!==r?(S=k=>k.value===r,e[3]=r,e[4]=S):S=e[4],h=n.find(S),e[0]=n,e[1]=r,e[2]=h}else h=e[2];const u=h;let f;e[5]!==i||e[6]!==u?(f=u?o.jsx("span",{className:"truncate",children:u.label}):o.jsx("span",{className:"text-muted-foreground",children:i}),e[5]=i,e[6]=u,e[7]=f):f=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(x9,{className:"size-4 shrink-0 opacity-50"}),e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==c||e[11]!==f?(p=o.jsx(gs,{asChild:!0,children:o.jsxs(me,{id:s,variant:"outline",role:"combobox","aria-expanded":c,className:"h-10 w-full justify-between font-normal",children:[f,m]})}),e[9]=s,e[10]=c,e[11]=f,e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g={width:"var(--radix-popover-trigger-width)"},e[13]=g):g=e[13];let x;e[14]!==i?(x=o.jsx(hr,{placeholder:i,className:"h-9"}),e[14]=i,e[15]=x):x=e[15];let b;e[16]!==a?(b=o.jsx(On,{children:a}),e[16]=a,e[17]=b):b=e[17];let v;if(e[18]!==l||e[19]!==n||e[20]!==r){let S;e[22]!==l||e[23]!==r?(S=k=>o.jsxs(as,{value:`${k.label} ${k.value}`,onSelect:()=>{l(k.value===r?"":k.value),d(!1)},children:[o.jsx("span",{className:"truncate",children:k.label}),o.jsx($t,{className:le("ml-auto size-4 shrink-0",r===k.value?"opacity-100":"opacity-0")})]},k.value),e[22]=l,e[23]=r,e[24]=S):S=e[24],v=n.map(S),e[18]=l,e[19]=n,e[20]=r,e[21]=v}else v=e[21];let _;e[25]!==v?(_=o.jsx(Es,{children:v}),e[25]=v,e[26]=_):_=e[26];let L;e[27]!==b||e[28]!==_?(L=o.jsxs(fr,{children:[b,_]}),e[27]=b,e[28]=_,e[29]=L):L=e[29];let y;e[30]!==L||e[31]!==x?(y=o.jsx(ys,{className:"p-0",style:g,children:o.jsxs(zr,{children:[x,L]})}),e[30]=L,e[31]=x,e[32]=y):y=e[32];let w;return e[33]!==c||e[34]!==y||e[35]!==p?(w=o.jsxs(_s,{open:c,onOpenChange:d,children:[p,y]}),e[33]=c,e[34]=y,e[35]=p,e[36]=w):w=e[36],w}const Bre=Dre.map(t=>({value:t.code,label:`${t.name} (${t.code})`})),zre=ox.map(t=>({value:t.code,label:`${t.name} (${t.code})`}));function Hk(t){const e=U.c(66),{schema:s,value:n,onChange:r,path:i,sandbox:a}=t,l=ue();let c;e[0]!==n?(c=Ore(n),e[0]=n,e[1]=c):c=e[1];const d=c,{city:h,regionCode:u,country:f}=d;let m;e[2]!==s.properties?(m=s.properties??{},e[2]=s.properties,e[3]=m):m=e[3];const p=m;let g;e[4]!==p.country?.title||e[5]!==l?(g=p.country?.title??l("sectionsEditor.locationField.countryDefault"),e[4]=p.country?.title,e[5]=l,e[6]=g):g=e[6];const x=g;let b;e[7]!==p.regionCode?.title||e[8]!==l?(b=p.regionCode?.title??l("sectionsEditor.locationField.regionDefault"),e[7]=p.regionCode?.title,e[8]=l,e[9]=b):b=e[9];const v=b;let _;e[10]!==p.city?.title||e[11]!==l?(_=p.city?.title??l("sectionsEditor.locationField.cityDefault"),e[10]=p.city?.title,e[11]=l,e[12]=_):_=e[12];const L=_;let y;e[13]!==d||e[14]!==r?(y=j=>{r($re(d,j))},e[13]=d,e[14]=r,e[15]=y):y=e[15];const w=y,S=f===Mre;let k;if(e[16]!==h||e[17]!==L||e[18]!==f||e[19]!==x||e[20]!==w||e[21]!==S||e[22]!==i||e[23]!==u||e[24]!==v||e[25]!==a?.virtualMcpId||e[26]!==s.description||e[27]!==s.title||e[28]!==l){let j;e[30]!==u?(j=B=>B.code===u,e[30]=u,e[31]=j):j=e[31];const N=ox.find(j),V=`${i}.country`;let C;e[32]!==s.title||e[33]!==l?(C=s.title??l("sectionsEditor.locationField.locationDefault"),e[32]=s.title,e[33]=l,e[34]=C):C=e[34];const T=a?.virtualMcpId;let A;e[35]!==s.description||e[36]!==C||e[37]!==T||e[38]!==V?(A=o.jsx(zs,{htmlFor:V,label:C,description:s.description,virtualMcpId:T}),e[35]=s.description,e[36]=C,e[37]=T,e[38]=V,e[39]=A):A=e[39];const R=`${i}.country`;let E;e[40]!==x||e[41]!==R?(E=o.jsx(At,{htmlFor:R,className:"text-xs",children:x}),e[40]=x,e[41]=R,e[42]=E):E=e[42];const I=`${i}.country`;let D;e[43]!==l?(D=l("sectionsEditor.locationField.selectCountryPlaceholder"),e[43]=l,e[44]=D):D=e[44];let O;e[45]!==l?(O=l("sectionsEditor.locationField.noCountryFound"),e[45]=l,e[46]=O):O=e[46];let $;e[47]!==w?($=B=>w({country:B,regionCode:"",city:""}),e[47]=w,e[48]=$):$=e[48];let M;e[49]!==f||e[50]!==I||e[51]!==D||e[52]!==O||e[53]!==$?(M=o.jsx(Xb,{id:I,options:Bre,value:f,placeholder:D,emptyMessage:O,onChange:$}),e[49]=f,e[50]=I,e[51]=D,e[52]=O,e[53]=$,e[54]=M):M=e[54];let z;e[55]!==E||e[56]!==M?(z=o.jsxs("div",{className:"space-y-1.5",children:[E,M]}),e[55]=E,e[56]=M,e[57]=z):z=e[57];let F;e[58]!==f||e[59]!==w||e[60]!==S||e[61]!==i||e[62]!==u||e[63]!==v||e[64]!==l?(F=f&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(At,{htmlFor:`${i}.regionCode`,className:"text-xs",children:v}),S?o.jsxs("div",{className:"space-y-2",children:[o.jsx(Rre,{selected:u,onSelect:B=>w({regionCode:B===u?"":B,city:""})}),o.jsx(Xb,{id:`${i}.regionCode`,options:zre,value:u,placeholder:l("sectionsEditor.locationField.selectStatePlaceholder"),emptyMessage:l("sectionsEditor.locationField.noStateFound"),onChange:B=>w({regionCode:B,city:""})})]}):o.jsxs(o.Fragment,{children:[o.jsx(yt,{id:`${i}.regionCode`,type:"text",value:u,placeholder:l("sectionsEditor.locationField.regionCodePlaceholder"),onChange:B=>w({regionCode:B.target.value})}),o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:l("sectionsEditor.locationField.regionCodeHelperText")})]})]}),e[58]=f,e[59]=w,e[60]=S,e[61]=i,e[62]=u,e[63]=v,e[64]=l,e[65]=F):F=e[65],k=o.jsxs("div",{className:"space-y-4",children:[A,z,F,f&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(At,{htmlFor:`${i}.city`,className:"text-xs",children:L}),o.jsx(yt,{id:`${i}.city`,type:"text",value:h,placeholder:S&&N?l("sectionsEditor.locationField.cityPlaceholderWithState",{state:N.name}):l("sectionsEditor.locationField.cityPlaceholder"),onChange:B=>w({city:B.target.value})}),o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:l("sectionsEditor.locationField.cityHelperText")})]})]}),e[16]=h,e[17]=L,e[18]=f,e[19]=x,e[20]=w,e[21]=S,e[22]=i,e[23]=u,e[24]=v,e[25]=a?.virtualMcpId,e[26]=s.description,e[27]=s.title,e[28]=l,e[29]=k}else k=e[29];return k}function Fre(t){const e=t.schema;if(!e?.properties)return null;const s=new Set(Object.keys(t.discriminators??{}));if(s.size===0)return e;const n={};for(const[r,i]of Object.entries(e.properties))s.has(r)||(n[r]=i);return Object.keys(n).length===0?null:{...e,properties:n}}function Ure(t){const e=U.c(52),s=ue(),{schema:n,value:r,onChange:i,path:a,label:l}=t;let c,d;e[0]!==n.inlineUnionBranches||e[1]!==r?(c=n.inlineUnionBranches??[],d=vk(r,c.map(Hre)),e[0]=n.inlineUnionBranches,e[1]=r,e[2]=c,e[3]=d):(c=e[2],d=e[3]);const h=d,[u,f]=P.useState(h),[m,p]=P.useState(h);m!==h&&(p(h),f(h));const g=Math.min(u,c.length-1),x=c[g];let b;e[4]!==c||e[5]!==i?(b=D=>{const O=Number(D);f(O),i({...c[O]?.discriminators??{}})},e[4]=c,e[5]=i,e[6]=b):b=e[6];const v=b;if(c.length===0)return null;let _;e[7]!==x?(_=x?Fre(x):null,e[7]=x,e[8]=_):_=e[8];const L=_;let y;if(e[9]!==x?.schema?.properties||e[10]!==r){let D;e[12]!==x?.schema?.properties?(D=x?.schema?.properties??{},e[12]=x?.schema?.properties,e[13]=D):D=e[13],y=ene(r,Object.keys(D)),e[9]=x?.schema?.properties,e[10]=r,e[11]=y}else y=e[11];const w=y;let S;e[14]!==l||e[15]!==a||e[16]!==t.sandbox?.virtualMcpId||e[17]!==n.description?(S=l&&o.jsx(zs,{htmlFor:a,label:l,description:n.description,virtualMcpId:t.sandbox?.virtualMcpId}),e[14]=l,e[15]=a,e[16]=t.sandbox?.virtualMcpId,e[17]=n.description,e[18]=S):S=e[18];const k=String(g);let j;e[19]!==s?(j=s("sectionsEditor.inlineUnionField.selectPlaceholder"),e[19]=s,e[20]=j):j=e[20];let N;e[21]!==j?(N=o.jsx(js,{placeholder:j}),e[21]=j,e[22]=N):N=e[22];let V;e[23]!==a||e[24]!==N?(V=o.jsx(bs,{id:a,className:"w-full min-w-0",children:N}),e[23]=a,e[24]=N,e[25]=V):V=e[25];let C;if(e[26]!==c||e[27]!==s){let D;e[29]!==s?(D=(O,$)=>o.jsx(It,{value:String($),children:ine(O.title)||s("sectionsEditor.inlineUnionField.branchFallback",{index:$+1})},O.title),e[29]=s,e[30]=D):D=e[30],C=c.map(D),e[26]=c,e[27]=s,e[28]=C}else C=e[28];let T;e[31]!==C?(T=o.jsx(vs,{children:C}),e[31]=C,e[32]=T):T=e[32];let A;e[33]!==v||e[34]!==T||e[35]!==k||e[36]!==V?(A=o.jsxs(xs,{value:k,onValueChange:v,children:[V,T]}),e[33]=v,e[34]=T,e[35]=k,e[36]=V,e[37]=A):A=e[37];let R;e[38]!==A||e[39]!==S?(R=o.jsxs("div",{className:"space-y-1.5",children:[S,A]}),e[38]=A,e[39]=S,e[40]=R):R=e[40];let E;e[41]!==x||e[42]!==L||e[43]!==i||e[44]!==a||e[45]!==w||e[46]!==t||e[47]!==r?(E=x&&(Ire(x.schema?.properties)?o.jsx(Hk,{...t,schema:x.schema,onChange:D=>i({...w,...D,...x.discriminators??{}})}):L?o.jsx(Hr,{schema:L,value:r,onChange:D=>i({...D,...x.discriminators??{}}),basePath:a,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:t.meta,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,sandbox:t.sandbox,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection}):null),e[41]=x,e[42]=L,e[43]=i,e[44]=a,e[45]=w,e[46]=t,e[47]=r,e[48]=E):E=e[48];let I;return e[49]!==R||e[50]!==E?(I=o.jsxs("div",{className:"space-y-3",children:[R,E]}),e[49]=R,e[50]=E,e[51]=I):I=e[51],I}function Hre(t){return{discriminators:t.discriminators,propertyKeys:Object.keys(t.schema?.properties??{})}}const Kre={lat:-21.9,lng:-41.42},Tp=1e5;let uh=null;function Wre(t){return uh||(uh=new Promise((e,s)=>{if(typeof window>"u"){s(new Error("Google Maps requires a browser environment"));return}const n=window;if(n.google?.maps){e(n.google.maps);return}const r=()=>{const l=window.google?.maps;l?e(l):s(new Error("Google Maps script loaded without google.maps"))},i=document.querySelector("script[data-google-maps-loader]");if(i){i.addEventListener("load",r),i.addEventListener("error",()=>s(new Error("Failed to load Google Maps")));return}const a=document.createElement("script");a.src=`https://maps.googleapis.com/maps/api/js?key=${t}&v=weekly&libraries=maps`,a.async=!0,a.defer=!0,a.dataset.googleMapsLoader="true",a.addEventListener("load",r),a.addEventListener("error",()=>s(new Error("Failed to load Google Maps"))),document.head.appendChild(a)}),uh)}function qre(t){if(typeof t!="string"||!t)return null;const e=t.split(",").map(Number),[s,n,r]=e;return!Number.isFinite(s)||!Number.isFinite(n)?null:{lat:s,lng:n,radius:Number.isFinite(r)?r:Tp}}function Gre({schema:t,value:e,onChange:s,path:n,label:r,sandbox:i}){const a=Tm().googleMapsApiKey,l=P.useRef(s);l.current=s;const c=P.useRef(qre(e)),[d,h]=P.useState(null),u=P.useRef(null),f=m=>{if(!m||!a)return;const p={disposed:!1,circle:null,listeners:[]};return Wre(a).then(g=>{if(p.disposed)return;const x=c.current,b=x?{lat:x.lat,lng:x.lng}:Kre,v=x?.radius??Tp,_=new g.Map(m,{center:b,zoom:v?Math.round(Math.log2(768e4/v))+1:4,draggable:!0,streetViewControl:!1,mapTypeControl:!1}),L=new g.Circle({strokeColor:"#2E6ED9",strokeOpacity:.8,strokeWeight:2,fillColor:"#2E6ED9",fillOpacity:.35,editable:!0,draggable:!0,map:_,center:b,radius:v});p.circle=L;const y=()=>{const S=L.getCenter(),k=L.getRadius();S&&l.current(`${S.lat()},${S.lng()},${k}`)},w=S=>{S&&p.listeners.push(S)};w(_.addListener("click",S=>{S.latLng&&(L.setCenter({lat:S.latLng.lat(),lng:S.latLng.lng()}),L.getRadius()||L.setRadius(Tp),y())})),w(L.addListener("radius_changed",y)),w(L.addListener("dragend",y))},g=>{p.disposed||h(g instanceof Error?g.message:"Failed to load map")}),()=>{p.disposed=!0;for(const g of p.listeners)try{g?.remove()}catch{}if(p.listeners=[],p.circle){try{p.circle.setMap(null)}catch{}p.circle=null}}};return u.current||(u.current=f),o.jsxs("div",{className:"space-y-2",children:[o.jsx(zs,{htmlFor:n,label:r,description:t.description,virtualMcpId:i?.virtualMcpId}),a?d?o.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:d}):o.jsx("div",{ref:u.current,id:n,className:"h-72 w-full rounded-md border border-border/60"}):o.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:["The map picker is unavailable — set"," ",o.jsx("code",{className:"font-mono",children:"GOOGLE_MAPS_API_KEY"})," on the server to enable it."]})]})}const Yre="oklch(0.65 0.15 160)",Qre="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",Kk="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]",Hge="text-[oklch(0.45_0.15_160)] focus:bg-[oklch(0.65_0.15_160/0.12)] focus:text-[oklch(0.45_0.15_160)] dark:text-[oklch(0.78_0.15_160)] dark:focus:bg-[oklch(0.65_0.15_160/0.15)] dark:focus:text-[oklch(0.78_0.15_160)]";function Jb(t){return t.map(e=>e.label).join(`
624
- `)}function Zb(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function Xre(t,e){const s=new Map;for(const n of t){const r=s.get(n.label);r?r.push(n):s.set(n.label,[n])}return e.map(n=>({id:s.get(n.label)?.shift()?.id??crypto.randomUUID(),index:n.index,label:n.label}))}function Jre(t){return t.map((e,s)=>({...e,index:s}))}function Wk(t){const e=U.c(19),{label:s,canDelete:n,dragging:r,onRename:i,onDuplicate:a,onDelete:l}=t,c=ue(),d=r?"opacity-100":"opacity-0 group-hover:opacity-100";let h;e[0]!==d?(h=le("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=h):h=e[1];let u;e[2]!==h?(u=o.jsx(e9,{className:h}),e[2]=h,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(zi,{className:"h-4 w-4 shrink-0",style:{color:Yre}}),e[4]=f):f=e[4];let m;e[5]!==s?(m=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==r||e[9]!==s||e[10]!==l||e[11]!==a||e[12]!==i||e[13]!==c?(p=!r&&o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionVariantList.openActionsFor",{label:s}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 data-[state=open]:opacity-100",onClick:eie,onPointerDown:Zre,children:o.jsx(Rr,{size:14})})}),o.jsxs(Ht,{align:"end",children:[i&&o.jsxs(et,{onClick:x=>{x.stopPropagation(),i()},children:[o.jsx(Z6,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),o.jsxs(et,{onClick:x=>{x.stopPropagation(),a?.()},children:[o.jsx(bn,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),o.jsxs(et,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),l?.()},children:[o.jsx(rn,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=r,e[9]=s,e[10]=l,e[11]=a,e[12]=i,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==u||e[16]!==m||e[17]!==p?(g=o.jsxs(o.Fragment,{children:[u,f,m,p]}),e[15]=u,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function Zre(t){return t.stopPropagation()}function eie(t){return t.stopPropagation()}function tie(t){const e=U.c(27),{entry:s,selected:n,canDelete:r,onSelect:i,onRename:a,onDuplicate:l,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:sie},e[0]=s.id,e[1]=d):d=e[1];const{attributes:h,listeners:u,setNodeRef:f,transform:m,isDragging:p}=i3(d);let g;e[2]!==m?(g=fi.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const v=b;let _;e[7]!==i?(_=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),i())},e[7]=i,e[8]=_):_=e[8];const L=p?"cursor-grabbing":"cursor-grab",y=n?Kk:Qre;let w;e[9]!==L||e[10]!==y?(w=le("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",L,y),e[9]=L,e[10]=y,e[11]=w):w=e[11];let S;e[12]!==r||e[13]!==s.label||e[14]!==c||e[15]!==l||e[16]!==a?(S=o.jsx(Wk,{label:s.label,canDelete:r,onRename:a,onDuplicate:l,onDelete:c}),e[12]=r,e[13]=s.label,e[14]=c,e[15]=l,e[16]=a,e[17]=S):S=e[17];let k;return e[18]!==h||e[19]!==u||e[20]!==i||e[21]!==f||e[22]!==v||e[23]!==_||e[24]!==w||e[25]!==S?(k=o.jsx("div",{ref:f,style:v,...h,...u,onClick:i,onKeyDown:_,className:w,children:S}),e[18]=h,e[19]=u,e[20]=i,e[21]=f,e[22]=v,e[23]=_,e[24]=w,e[25]=S,e[26]=k):k=e[26],k}function sie(){return!1}function nie(t){const e=U.c(103),{listKey:s,variants:n,selectedIndex:r,onSelect:i,onRename:a,onDuplicate:l,onDelete:c,onRemoveAll:d,onReorder:h,onAdd:u}=t,f=ue(),m=n.length>1;let p;e[0]!==n?(p=()=>Zb(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=P.useState(p),[b,v]=P.useState(null),[_,L]=P.useState(s),[y,w]=P.useState(n.length);let S;e[2]!==n?(S=()=>Jb(n),e[2]=n,e[3]=S):S=e[3];const[k,j]=P.useState(S),N=P.useRef(!1),V=Jb(n);_!==s?(L(s),w(n.length),j(V),x(Zb(n))):(y!==n.length||k!==V)&&(w(n.length),j(V),x(ae=>Xre(ae,n)));let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C={activationConstraint:{distance:8}},e[4]=C):C=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T={coordinateGetter:o3},e[5]=T):T=e[5];const A=Xg(Yc(p0,C),Yc(m0,T));let R;e[6]!==g?(R=g.map(rie),e[6]=g,e[7]=R):R=e[7];const E=R;let I;e[8]!==g?(I=ae=>{const re=String(ae.active.id);v(g.find(ie=>ie.id===re)??null)},e[8]=g,e[9]=I):I=e[9];const D=I;let O;e[10]!==E||e[11]!==h?(O=ae=>{v(null);const{active:re,over:ie}=ae;if(!ie||re.id===ie.id)return;const Y=E.indexOf(String(re.id)),pe=E.indexOf(String(ie.id));Y===-1||pe===-1||(x(be=>Jre(Qc([...be],Y,pe))),N.current=!0,requestAnimationFrame(()=>{N.current=!1}),h(Y,pe))},e[10]=E,e[11]=h,e[12]=O):O=e[12];const $=O;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{v(null)},e[13]=M):M=e[13];const z=M;let F,B,H,W,K,q,G,te,X,Z,ee,se,J;if(e[14]!==m||e[15]!==g||e[16]!==E||e[17]!==$||e[18]!==D||e[19]!==u||e[20]!==c||e[21]!==l||e[22]!==d||e[23]!==a||e[24]!==i||e[25]!==r||e[26]!==A||e[27]!==f){const ae=Oe=>{N.current||i(Oe)};ee="space-y-1 border-b p-2";let re;e[41]!==f?(re=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=re):re=e[42];let ie;e[43]!==re?(ie=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:re}),e[43]=re,e[44]=ie):ie=e[44];let Y;e[45]!==f?(Y=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=Y):Y=e[46];let pe;e[47]===Symbol.for("react.memo_cache_sentinel")?(pe=o.jsx(Qt,{size:14}),e[47]=pe):pe=e[47];let be;e[48]!==u||e[49]!==Y?(be=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":Y,className:"size-6",onClick:u,children:pe})}),e[48]=u,e[49]=Y,e[50]=be):be=e[50];let _e;e[51]!==f?(_e=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=_e):_e=e[52];let Le;e[53]!==_e?(Le=o.jsx(We,{children:_e}),e[53]=_e,e[54]=Le):Le=e[54];let ke;e[55]!==be||e[56]!==Le?(ke=o.jsxs(qe,{children:[be,Le]}),e[55]=be,e[56]=Le,e[57]=ke):ke=e[57];let Ve;e[58]!==f?(Ve=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=Ve):Ve=e[59];let Pe;e[60]===Symbol.for("react.memo_cache_sentinel")?(Pe=o.jsx(rn,{size:14}),e[60]=Pe):Pe=e[60];let xe;e[61]!==d||e[62]!==Ve?(xe=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":Ve,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Pe})}),e[61]=d,e[62]=Ve,e[63]=xe):xe=e[63];let Ne;e[64]!==f?(Ne=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Ne):Ne=e[65];let je;e[66]!==Ne?(je=o.jsx(We,{children:Ne}),e[66]=Ne,e[67]=je):je=e[67];let we;e[68]!==xe||e[69]!==je?(we=o.jsxs(qe,{children:[xe,je]}),e[68]=xe,e[69]=je,e[70]=we):we=e[70];let Ce;e[71]!==ke||e[72]!==we?(Ce=o.jsxs("div",{className:"flex items-center gap-0.5",children:[ke,we]}),e[71]=ke,e[72]=we,e[73]=Ce):Ce=e[73],e[74]!==ie||e[75]!==Ce?(se=o.jsxs("div",{className:"flex items-center justify-between",children:[ie,Ce]}),e[74]=ie,e[75]=Ce,e[76]=se):se=e[76],B=t3,q=A,G=hL,te=D,X=$,Z=z,F=r3,W=E,K=n3,J="space-y-0.5",H=g.map(Oe=>o.jsx(tie,{entry:Oe,selected:Oe.index===r,canDelete:m,onSelect:()=>ae(Oe.index),onRename:a?()=>a(Oe.index):void 0,onDuplicate:()=>l(Oe.index),onDelete:()=>c(Oe.index)},Oe.id)),e[14]=m,e[15]=g,e[16]=E,e[17]=$,e[18]=D,e[19]=u,e[20]=c,e[21]=l,e[22]=d,e[23]=a,e[24]=i,e[25]=r,e[26]=A,e[27]=f,e[28]=F,e[29]=B,e[30]=H,e[31]=W,e[32]=K,e[33]=q,e[34]=G,e[35]=te,e[36]=X,e[37]=Z,e[38]=ee,e[39]=se,e[40]=J}else F=e[28],B=e[29],H=e[30],W=e[31],K=e[32],q=e[33],G=e[34],te=e[35],X=e[36],Z=e[37],ee=e[38],se=e[39],J=e[40];let oe;e[77]!==H||e[78]!==J?(oe=o.jsx("div",{className:J,children:H}),e[77]=H,e[78]=J,e[79]=oe):oe=e[79];let ce;e[80]!==F||e[81]!==W||e[82]!==K||e[83]!==oe?(ce=o.jsx(F,{items:W,strategy:K,children:oe}),e[80]=F,e[81]=W,e[82]=K,e[83]=oe,e[84]=ce):ce=e[84];let he;e[85]!==b||e[86]!==m?(he=b?o.jsx("div",{className:le("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",Kk),children:o.jsx(Wk,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=he):he=e[87];let ne;e[88]!==he?(ne=Wn.createPortal(o.jsx(s3,{dropAnimation:mk,children:he}),document.body),e[88]=he,e[89]=ne):ne=e[89];let Q;e[90]!==B||e[91]!==q||e[92]!==G||e[93]!==te||e[94]!==X||e[95]!==Z||e[96]!==ce||e[97]!==ne?(Q=o.jsxs(B,{sensors:q,collisionDetection:G,onDragStart:te,onDragEnd:X,onDragCancel:Z,children:[ce,ne]}),e[90]=B,e[91]=q,e[92]=G,e[93]=te,e[94]=X,e[95]=Z,e[96]=ce,e[97]=ne,e[98]=Q):Q=e[98];let de;return e[99]!==ee||e[100]!==se||e[101]!==Q?(de=o.jsxs("div",{className:ee,children:[se,Q]}),e[99]=ee,e[100]=se,e[101]=Q,e[102]=de):de=e[102],de}function rie(t){return t.id}const iie=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],oie={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",gift:"Gift01","user-check":"UserCheck01","user-x":"UserX01",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function X1(t){return sl(t)!==void 0}function ax(t,e){if(e){if(X1(e))return e;const s=oie[e];if(s&&X1(s))return s}for(const[s,n]of iie)if(s.test(t)&&X1(n))return n;return"FilterLines"}function aie(t){return sl(t)??tg}function J1(t){const e=U.c(11),{iconName:s,size:n,className:r}=t,i=n===void 0?"md":n;let a;e[0]!==s?(a=aie(s),e[0]=s,e[1]=a):a=e[1];const l=a,c=i==="sm"?"size-7":"size-9",d=i==="sm"?16:18;let h;e[2]!==c||e[3]!==r?(h=le("flex shrink-0 items-center justify-center rounded-full bg-muted",c,r),e[2]=c,e[3]=r,e[4]=h):h=e[4];let u;e[5]!==l||e[6]!==d?(u=o.jsx(l,{size:d,className:"text-muted-foreground"}),e[5]=l,e[6]=d,e[7]=u):u=e[7];let f;return e[8]!==h||e[9]!==u?(f=o.jsx("div",{className:h,children:u}),e[8]=h,e[9]=u,e[10]=f):f=e[10],f}function Kge(t,e){return ree(t,e).map(s=>{const n=e[s.blockKey]??{},r=AS(aee(s.blockKey),e,t);return{blockKey:s.blockKey,title:Ka(s.blockKey,n),description:Zc(r),iconName:ax(s.matcherResolveType)}})}const qk="Users03";function lie(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function cie(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[r,i]of Object.entries(e))if(r.includes("matchers")&&!r.startsWith("$live/"))for(const a of Object.keys(i)){if(a.toLowerCase().includes("always")||n.has(a))continue;n.add(a);const l=ua(a,t);s.push({resolveType:a,title:l.title??ms(a),description:l.description,iconName:ax(a,l.icon)})}return s}function die(t,e){if(!t)return qk;const s=e.find(n=>n.resolveType===t);return s?s.iconName:ax(t)}function uie(t){const e=U.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:r,matchers:i,globals:a,onSelect:l,onSelectGlobal:c}=t,d=a===void 0?[]:a,[h,u]=P.useState(!1),f=ue(),p=(r?d.find(se=>se.blockKey===r):void 0)?.iconName??die(s,i),g=sl(p);let x;e[0]!==l||e[1]!==u?(x=se=>{l(se),u(!1)},e[0]=l,e[1]=u,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==u?(v=se=>{c?.(se),u(!1)},e[3]=c,e[4]=u,e[5]=v):v=e[5];const _=v;let L;e[6]!==u?(L=()=>u(!0),e[6]=u,e[7]=L):L=e[7];let y;e[8]!==g?(y=g&&o.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=y):y=e[9];let w;e[10]!==n?(w=o.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=w):w=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(ds,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=S):S=e[12];let k;e[13]!==L||e[14]!==y||e[15]!==w?(k=o.jsxs("button",{type:"button",onClick:L,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[y,w,S]}),e[13]=L,e[14]=y,e[15]=w,e[16]=k):k=e[16];let j;e[17]!==f?(j=f("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=f,e[18]=j):j=e[18];let N;e[19]!==f?(N=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=N):N=e[20];let V;e[21]!==f?(V=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=V):V=e[22];let C;e[23]!==V?(C=o.jsx(hr,{placeholder:V}),e[23]=V,e[24]=C):C=e[24];let T;e[25]!==f?(T=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=T):T=e[26];let A;e[27]!==T?(A=o.jsx(On,{children:T}),e[27]=T,e[28]=A):A=e[28];let R;e[29]!==f?(R=f("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=f,e[30]=R):R=e[30];let E;e[31]!==f?(E=f("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=f,e[32]=E):E=e[32];const I=`${R} ${E}`;let D;e[33]!==b?(D=()=>b(""),e[33]=b,e[34]=D):D=e[34];const O=!s&&!r&&"bg-accent/60";let $;e[35]!==O?($=le("gap-2.5",O),e[35]=O,e[36]=$):$=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(J1,{iconName:qk,size:"sm"}),e[37]=M):M=e[37];let z;e[38]!==f?(z=f("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=f,e[39]=z):z=e[39];let F;e[40]!==z?(F=o.jsx("span",{className:"text-sm",children:z}),e[40]=z,e[41]=F):F=e[41];let B;e[42]!==f?(B=f("sectionsEditor.matcherPicker.targetAllUsers"),e[42]=f,e[43]=B):B=e[43];let H;e[44]!==B?(H=o.jsx("span",{className:"text-xs text-muted-foreground",children:B}),e[44]=B,e[45]=H):H=e[45];let W;e[46]!==F||e[47]!==H?(W=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[F,H]}),e[46]=F,e[47]=H,e[48]=W):W=e[48];let K;e[49]!==I||e[50]!==D||e[51]!==$||e[52]!==W?(K=o.jsxs(as,{value:I,onSelect:D,className:$,children:[M,W]}),e[49]=I,e[50]=D,e[51]=$,e[52]=W,e[53]=K):K=e[53];let q;if(e[54]!==r||e[55]!==s||e[56]!==b||e[57]!==i){let se;e[59]!==r||e[60]!==s||e[61]!==b?(se=J=>o.jsxs(as,{value:`${J.title} ${J.resolveType} ${J.description??""}`,onSelect:()=>b(J.resolveType),className:le("gap-2.5",!r&&s===J.resolveType&&"bg-accent/60"),children:[o.jsx(J1,{iconName:J.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm",children:J.title}),J.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:J.description})]})]},J.resolveType),e[59]=r,e[60]=s,e[61]=b,e[62]=se):se=e[62],q=i.map(se),e[54]=r,e[55]=s,e[56]=b,e[57]=i,e[58]=q}else q=e[58];let G;e[63]!==K||e[64]!==q?(G=o.jsxs(Es,{children:[K,q]}),e[63]=K,e[64]=q,e[65]=G):G=e[65];let te;e[66]!==r||e[67]!==d||e[68]!==_||e[69]!==f?(te=d.length>0&&o.jsx(Es,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(se=>o.jsxs(as,{value:`${se.title} ${se.blockKey} ${se.description??""}`,onSelect:()=>_(se.blockKey),className:le("gap-2.5",r===se.blockKey&&"bg-accent/60"),children:[o.jsx(J1,{iconName:se.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm",children:se.title}),se.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:se.description})]})]},se.blockKey))}),e[66]=r,e[67]=d,e[68]=_,e[69]=f,e[70]=te):te=e[70];let X;e[71]!==A||e[72]!==G||e[73]!==te?(X=o.jsxs(fr,{children:[A,G,te]}),e[71]=A,e[72]=G,e[73]=te,e[74]=X):X=e[74];let Z;e[75]!==h||e[76]!==u||e[77]!==N||e[78]!==C||e[79]!==X||e[80]!==j?(Z=o.jsxs(mE,{open:h,onOpenChange:u,title:j,description:N,className:"sm:max-w-lg",filter:lie,children:[C,X]}),e[75]=h,e[76]=u,e[77]=N,e[78]=C,e[79]=X,e[80]=j,e[81]=Z):Z=e[81];let ee;return e[82]!==Z||e[83]!==k?(ee=o.jsxs(o.Fragment,{children:[k,Z]}),e[82]=Z,e[83]=k,e[84]=ee):ee=e[84],ee}const hie="website/sections/Rendering/Lazy.tsx";function Cf(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function lx(t){if(!Cf(t))return!1;const e=t.__resolveType;return typeof e=="string"&&Cs(e)}function fie(t){return t!=null}function Pp(t){if(t==null)return t;if(lx(t)){const e=t.section;return e==null?null:Cf(e)?e:{}}return Cf(t)?t:void 0}function mie(t,e){return t===null?null:lx(e)?{...e,section:t}:t}function Wge(t){return{__resolveType:t}}function qge(t,e){if(!fie(e))return null;if(t){const s=Pp(e)??{};return{__resolveType:hie,section:s}}return lx(e)?Pp(e)??null:Cf(e)?e:null}const pie="General";function ed(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function Gk(t,e){return t===ea?pie:e}function Yk(t){const e=gf(t),s=new Set,n=[];for(const r of e)ed(r.resolveType)&&(ir(r.resolveType)||s.has(r.resolveType)||(s.add(r.resolveType),n.push({resolveType:r.resolveType,title:Gk(r.resolveType,r.title),description:r.description})));return n}function cx(t){const e=pf(t),s=$n(e,t),n=Yk(s?.properties?.seo);return n.length>0?n:gie(t)}function gie(t){const e=t.manifest?.blocks??{},s=[];for(const[n,r]of Object.entries(e))if(n.includes("sections"))for(const i of Object.keys(r)){if(!ed(i))continue;const a=i.split("/").pop()?.replace(/\.tsx?$/,"")??i;s.push({resolveType:i,title:Gk(i,a)})}return s}function Qk(t){const e=cx(t),s=e.find(n=>n.resolveType===ea);return s?s.resolveType:e[0]?.resolveType??ea}function Xk(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=$n(s,t),r=Yk(n?.properties?.seo);if(r.length>0)return r}return cx(t)}function xie(t,e){const s=Xk(t,e),n=s.find(r=>r.resolveType===ea);return n?n.resolveType:s[0]?.resolveType??Qk(t)}function bie(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:Qk(t)}function vie(t,e,s){const n=s.__resolveType;return typeof n=="string"&&ed(n)?n:xie(t,e)}const yie=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),ea="website/sections/Seo/SeoV2.tsx",_ie=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function hu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Lie(t){return typeof t.__resolveType=="string"&&ed(t.__resolveType)?!0:_ie.some(e=>e in t)}function wie(t,e){for(const[s,n]of Object.entries(t)){if(!hu(n))continue;const r=n,i=r.__resolveType;if(typeof i=="string"&&yie.has(i))continue;const a=r.seo;if(hu(a)){const l=a;if(Lie(l))return{blockKey:s,kind:"nested",seoData:l,blockData:r,seoResolveType:e?vie(e,r,l):typeof l.__resolveType=="string"&&ed(l.__resolveType)?l.__resolveType:ea}}}for(const[s,n]of Object.entries(t)){if(!hu(n))continue;const r=n;if(typeof r.__resolveType=="string"&&ed(r.__resolveType))return{blockKey:s,kind:"block",seoData:r,blockData:r,seoResolveType:r.__resolveType}}return null}function Sie(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function Gge(t,e,s){if(e.kind==="site"){const c=wie(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?Xk(s,c.blockData):void 0,build:d=>Sie(c,d)}:null}const n=t[e.pageKey];if(!hu(n))return null;const r=n,i=r.seo,a=Pp(i),l=a&&hu(a)?a:void 0;return{blockKey:e.pageKey,seoData:l,rawSeoData:i,seoResolveType:s?bie(s,l):typeof l?.__resolveType=="string"?l.__resolveType:ea,seoTypeOptions:s?cx(s):void 0,build:c=>({...r,seo:c===null?null:mie(c,i)})}}const dx=["type","title","description","canonical","noIndexing","favicon","image","themeColor"],kie=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],jie=["jsonLD","title","description","noIndexing","configJsonLD"];function Jk(t){return t===ea||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function Cie(t){switch(t){case"general":return dx;case"pdp":return kie;case"plp":return jie;default:return null}}function Zk(t,e){const s=Cie(Jk(e));if(!s||!t.properties)return t;const n={};for(const r of s){const i=t.properties[r];i&&(n[r]=i)}return{...t,properties:n}}function Nie(){return dx.filter(t=>t!=="type")}function Vie(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function Tie(t,e){return t[e]===void 0}function Pie(t){const e=U.c(13),{schema:s,value:n,onChange:r,siteDefaultSeo:i,formResetKey:a}=t,l=ue(),d=Zk(s,ea).properties??{},h=Nie();let u;e[0]!==i?(u=!!i&&Object.keys(i).length>0,e[0]=i,e[1]=u):u=e[1];const f=u,[m,p]=P.useState(a);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=P.useState(g);m!==a&&(p(a),b({}));let v;e[3]!==x||e[4]!==n?(v=j=>x[j]!==void 0?x[j]:Tie(n,j),e[3]=x,e[4]=n,e[5]=v):v=e[5];const _=v;let L;e[6]!==r||e[7]!==i||e[8]!==n?(L=(j,N)=>{b(C=>({...C,[j]:N}));const V={...n};if(N)delete V[j];else{const C=i?.[j];V[j]=C??(j==="type"?"website":"")}r(V)},e[6]=r,e[7]=i,e[8]=n,e[9]=L):L=e[9];const y=L,w="min-w-0 space-y-6",S=dx.map(j=>{const N=d[j];if(!N)return null;const V=f&&h.includes(j),C=V&&_(j),T=C?i?.[j]??n[j]:n[j],A=N.title??Vie(j);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:le(C&&"pointer-events-none opacity-60"),children:Ga({schema:N,value:T,onChange:R=>{C||r({...n,[j]:R})},path:j,label:A,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:Aie})}),V&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rr,{id:`seo-use-default-${j}`,checked:C,onCheckedChange:R=>y(j,R)}),o.jsx(At,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:l("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let k;return e[10]!==a||e[11]!==S?(k=o.jsx("div",{className:w,children:S},a),e[10]=a,e[11]=S,e[12]=k):k=e[12],k}function Aie(){}function Eie(t){const e=U.c(18),{schema:s,resolveType:n,value:r,formResetKey:i,onChange:a,onBreadcrumbChange:l,siteDefaultSeo:c}=t;if(Jk(n)==="general"){let g;e[0]!==a?(g=b=>a(b),e[0]=a,e[1]=g):g=e[1];let x;return e[2]!==i||e[3]!==s||e[4]!==c||e[5]!==g||e[6]!==r?(x=o.jsx(Pie,{schema:s,value:r,onChange:g,siteDefaultSeo:c,formResetKey:i}),e[2]=i,e[3]=s,e[4]=c,e[5]=g,e[6]=r,e[7]=x):x=e[7],x}let h;e[8]!==n||e[9]!==s?(h=Zk(s,n),e[8]=n,e[9]=s,e[10]=h):h=e[10];const u=h;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const m=l??Rie;let p;return e[12]!==u||e[13]!==i||e[14]!==a||e[15]!==m||e[16]!==r?(p=o.jsx(Hr,{schema:u,value:r,onChange:a,basePath:"",breadcrumbPath:f,onBreadcrumbChange:m},i),e[12]=u,e[13]=i,e[14]=a,e[15]=m,e[16]=r,e[17]=p):p=e[17],p}function Rie(){}function Die(t){const e=U.c(16),{schema:s,value:n,onChange:r,meta:i,decofile:a,onSaveReferencedBlock:l,sandbox:c}=t,d=ue();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[u,f]=P.useState(h);let m;e[1]!==u||e[2]!==d?(m=u.length>0&&o.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[o.jsx("button",{type:"button",onClick:()=>f([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:o.jsx(qh,{className:"size-3.5"})}),u.map((x,b)=>{const v=b===u.length-1,_=kn(x);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&o.jsx(Us,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(u.slice(0,b+1)),title:_,className:le("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",v?"font-medium text-foreground":"text-muted-foreground"),children:_})]},`${_}-${b}`)})]}),e[1]=u,e[2]=d,e[3]=m):m=e[3];let p;e[4]!==u||e[5]!==a||e[6]!==i||e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==n?(p=o.jsx(Hr,{schema:s,value:n,onChange:r,basePath:"",breadcrumbPath:u,onBreadcrumbChange:f,meta:i,decofile:a,onSaveReferencedBlock:l,sandbox:c}),e[4]=u,e[5]=a,e[6]=i,e[7]=r,e[8]=l,e[9]=c,e[10]=s,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"space-y-2",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function Yge(t){const e=U.c(23),{activeSchema:s,formValue:n,formResetKey:r,onFormChange:i,onBreadcrumbChange:a,breadcrumbPath:l,emptyMessage:c,beforeForm:d,seoResolveType:h,siteDefaultSeo:u,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let v;e[0]!==l?(v=l===void 0?[]:l,e[0]=l,e[1]=v):v=e[1];const _=v;let L;e[2]!==s||e[3]!==_||e[4]!==m||e[5]!==r||e[6]!==n||e[7]!==f||e[8]!==a||e[9]!==i||e[10]!==b||e[11]!==p||e[12]!==x||e[13]!==g||e[14]!==h||e[15]!==u?(L=s&&n?h?o.jsx(Eie,{schema:s,resolveType:h,value:n,formResetKey:r,onChange:i,onBreadcrumbChange:a,siteDefaultSeo:u}):o.jsx(Hr,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:_,onBreadcrumbChange:a,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},r):null,e[2]=s,e[3]=_,e[4]=m,e[5]=r,e[6]=n,e[7]=f,e[8]=a,e[9]=i,e[10]=b,e[11]=p,e[12]=x,e[13]=g,e[14]=h,e[15]=u,e[16]=L):L=e[16];const y=L;let w;e[17]!==c||e[18]!==y?(w=y??o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=y,e[19]=w):w=e[19];let S;return e[20]!==d||e[21]!==w?(S=o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[d,w]})}),e[20]=d,e[21]=w,e[22]=S):S=e[22],S}const Qge="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function Xge(t,e){return Oee(t,e,Zc)}function Jge(t){const e=U.c(69),{pageKey:s,initialName:n,initialPath:r,onFieldChange:i}=t,a=ue(),[l,c]=P.useState(n),[d,h]=P.useState(r),[u,f]=P.useState(s),[m,p]=P.useState(null),g=P.useRef(!1),[x,b]=P.useState(null);u!==s&&(f(s),c(n),h(r),p(null),b(null));let v;e[0]!==r||e[1]!==d?(v=()=>{if(g.current){g.current=!1;return}const ee=d.trim();if(ee===r.trim()){h(r),b(null);return}const se=F9(ee);if(se){b(se),h(r);return}b(null),p(ee)},e[0]=r,e[1]=d,e[2]=v):v=e[2];const _=v;let L;e[3]!==i||e[4]!==m?(L=()=>{m!==null&&(h(m),i("path",m),p(null))},e[3]=i,e[4]=m,e[5]=L):L=e[5];const y=L;let w;e[6]!==r?(w=()=>{h(r),p(null)},e[6]=r,e[7]=w):w=e[7];const S=w;let k;e[8]!==i?(k=ee=>{c(ee.target.value),i("name",ee.target.value)},e[8]=i,e[9]=k):k=e[9];let j;e[10]!==a?(j=a("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=a,e[11]=j):j=e[11];let N;e[12]!==l||e[13]!==k||e[14]!==j?(N=o.jsx("input",{type:"text",value:l,onChange:k,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:j}),e[12]=l,e[13]=k,e[14]=j,e[15]=N):N=e[15];let V;e[16]===Symbol.for("react.memo_cache_sentinel")?(V=ee=>{h(ee.target.value),b(null)},e[16]=V):V=e[16];let C;e[17]!==r?(C=ee=>{ee.key==="Enter"?(ee.preventDefault(),ee.currentTarget.blur()):ee.key==="Escape"&&(ee.preventDefault(),g.current=!0,h(r),b(null),ee.currentTarget.blur())},e[17]=r,e[18]=C):C=e[18];let T;e[19]!==a?(T=a("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[19]=a,e[20]=T):T=e[20];let A;e[21]!==_||e[22]!==d||e[23]!==C||e[24]!==T?(A=o.jsx("input",{type:"text",value:d,onChange:V,onBlur:_,onKeyDown:C,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:T}),e[21]=_,e[22]=d,e[23]=C,e[24]=T,e[25]=A):A=e[25];let R;e[26]!==x?(R=x&&o.jsx("p",{className:"text-xs text-destructive",children:x}),e[26]=x,e[27]=R):R=e[27];const E=m!==null;let I;e[28]!==S?(I=ee=>{ee||S()},e[28]=S,e[29]=I):I=e[29];let D;e[30]!==a?(D=a("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[30]=a,e[31]=D):D=e[31];let O;e[32]!==D?(O=o.jsx(Yi,{children:D}),e[32]=D,e[33]=O):O=e[33];const $=m??"";let M;e[34]!==r||e[35]!==a||e[36]!==$?(M=a("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:r,to:$}),e[34]=r,e[35]=a,e[36]=$,e[37]=M):M=e[37];let z;e[38]!==M?(z=o.jsx(Qi,{children:M}),e[38]=M,e[39]=z):z=e[39];let F;e[40]!==O||e[41]!==z?(F=o.jsxs(Gi,{children:[O,z]}),e[40]=O,e[41]=z,e[42]=F):F=e[42];let B;e[43]!==a?(B=a("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[43]=a,e[44]=B):B=e[44];let H;e[45]!==B?(H=o.jsx(Ji,{children:B}),e[45]=B,e[46]=H):H=e[46];let W;e[47]!==y?(W=ee=>{ee.preventDefault(),y()},e[47]=y,e[48]=W):W=e[48];let K;e[49]!==a?(K=a("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[49]=a,e[50]=K):K=e[50];let q;e[51]!==W||e[52]!==K?(q=o.jsx(Zi,{onClick:W,children:K}),e[51]=W,e[52]=K,e[53]=q):q=e[53];let G;e[54]!==H||e[55]!==q?(G=o.jsxs(Xi,{children:[H,q]}),e[54]=H,e[55]=q,e[56]=G):G=e[56];let te;e[57]!==F||e[58]!==G?(te=o.jsxs(qi,{children:[F,G]}),e[57]=F,e[58]=G,e[59]=te):te=e[59];let X;e[60]!==E||e[61]!==I||e[62]!==te?(X=o.jsx(Wi,{open:E,onOpenChange:I,children:te}),e[60]=E,e[61]=I,e[62]=te,e[63]=X):X=e[63];let Z;return e[64]!==A||e[65]!==R||e[66]!==X||e[67]!==N?(Z=o.jsxs("div",{className:"space-y-1",children:[N,A,R,X]}),e[64]=A,e[65]=R,e[66]=X,e[67]=N,e[68]=Z):Z=e[68],Z}function Zge(t){const e=U.c(13),{onClick:s}=t,n=ue();let r;e[0]!==n?(r=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=n,e[1]=r):r=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(xg,{size:14}),e[2]=i):i=e[2];let a;e[3]!==s||e[4]!==r?(a=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":r,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:i})}),e[3]=s,e[4]=r,e[5]=a):a=e[5];let l;e[6]!==n?(l=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=l):l=e[7];let c;e[8]!==l?(c=o.jsx(We,{side:"bottom",children:l}),e[8]=l,e[9]=c):c=e[9];let d;return e[10]!==a||e[11]!==c?(d=o.jsxs(qe,{children:[a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12],d}const ev=new WeakMap;function Mie(t,e){let s=ev.get(e);s||(s=new Map,ev.set(e,s));let n=s.get(t);return n===void 0&&(n=$n(t,e),s.set(t,n)),n}function Iie(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function Oie(t,e){return{__resolveType:e,variants:[{rule:Xc(),value:structuredClone(t)},{rule:Xc(),value:structuredClone(t)}]}}function $ie(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>U3(n.rule));return s?s.value:e[e.length-1]?.value}function Bie(t){const e=[...t.variants],s=e[e.length-1],n={rule:Xc(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function zie(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function Fie(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function Uie(t,e,s){return e<t?t-1:Math.min(t,s-1)}function Hie(t,e,s){const n=[...t.variants];if(e===s||e<0||s<0||e>=n.length||s>=n.length)return t;const[r]=n.splice(e,1);return r?(n.splice(s,0,r),{...t,variants:n}):t}function Kie(t,e,s){const n=[...t.variants],r=n[e];return r?(n[e]={...r,value:s},{...t,variants:n}):t}function tv(t,e,s){const n=[...t.variants],r=n[e];return r?(n[e]={...r,rule:s},{...t,variants:n}):t}const sv=new WeakMap;function Wie(t){let e=sv.get(t);return e||(e=cie(t),sv.set(t,e)),e}function ej(t){const e=U.c(13),{multivariateResolveType:s,renderInnerField:n,...r}=t,i=ue(),{value:a,onChange:l,meta:c,path:d}=r,[h,u]=P.useState(0);if(!Iie(a)){let $;e[0]!==i?($=i("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=i,e[1]=$):$=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(xg,{size:14}),e[2]=M):M=e[2];let z;e[3]!==i?(z=i("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=i,e[4]=z):z=e[4];let F;return e[5]!==z?(F=o.jsx(We,{children:z}),e[5]=z,e[6]=F):F=e[6],o.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":$,onClick:()=>{l(Oie(a,s)),u(0)},children:M})}),F]}),n(r)]})}const f=a,m=f.variants,p=Math.min(h,m.length-1);let g;e[7]!==i?(g=($,M)=>({index:M,label:Zc($.rule)||i("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=i,e[8]=g):g=e[8];const x=m.map(g),b=m[p],v=b?.rule??{},_=v.__resolveType??"",L=b?.value,y=c?Wie(c):[],w=_&&c?Mie(_,c):null,{__resolveType:S,...k}=v,j=()=>{l($ie(f)),u(0)},N=()=>{const $=Bie(f);l($),u($.variants.length-1)},V=$=>{const M=zie(f,$);M&&(l(M),u(Uie(p,$,M.variants.length)))},C=$=>{const M=Fie(f,$);l(M),u($+1)},T=($,M)=>{const z=Hie(f,$,M);l(z),p===$&&u(M)},A=$=>{const M=$?lee($,c):{__resolveType:R3};l(tv(f,p,M))},R=$=>{const M=$,z=_?{...M,__resolveType:_}:{...M};l(tv(f,p,z))},E=$=>{l(Kie(f,p,$))},I=`${d}-${f.__resolveType}`;let D;e[9]!==i?(D=i("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=i,e[10]=D):D=e[10];let O;return e[11]!==D?(O=o.jsx(At,{className:"text-xs text-muted-foreground",children:D}),e[11]=D,e[12]=O):O=e[12],o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[o.jsx(nie,{listKey:I,variants:x,selectedIndex:p,onSelect:u,onDuplicate:C,onDelete:V,onRemoveAll:j,onReorder:T,onAdd:N}),o.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[O,o.jsx(uie,{currentRt:_,currentLabel:Zc(v),matchers:y,onSelect:A}),w&&o.jsx("div",{className:"pt-1",children:o.jsx(Die,{schema:w,value:k,onChange:R,meta:c,decofile:r.decofile,onSaveReferencedBlock:r.onSaveReferencedBlock,sandbox:r.sandbox},`${p}-${_}`)})]}),n({...r,value:L,onChange:E})]})]})}const qie="website/loaders/secret.ts";function fu(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function Gie(){return{__resolveType:qie,name:"",encrypted:""}}function Yie(t){const{value:e,...s}=t;return s}function Z1(t){const e=U.c(53),{schema:s,value:n,onChange:r,label:i,path:a,sandbox:l}=t,c=ue();if(typeof n=="string"||n==null&&!fu(n)){const N=typeof n=="string"?n:"",V=l?.virtualMcpId;let C;e[0]!==i||e[1]!==a||e[2]!==s.description||e[3]!==V?(C=o.jsx(zs,{htmlFor:a,label:i,description:s.description,virtualMcpId:V}),e[0]=i,e[1]=a,e[2]=s.description,e[3]=V,e[4]=C):C=e[4];let T;e[5]!==c?(T=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=T):T=e[6];let A;e[7]!==r?(A=I=>r(I.target.value),e[7]=r,e[8]=A):A=e[8];let R;e[9]!==a||e[10]!==N||e[11]!==T||e[12]!==A?(R=o.jsx(yt,{id:a,type:"password",value:N,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:T,onChange:A,className:"h-10"}),e[9]=a,e[10]=N,e[11]=T,e[12]=A,e[13]=R):R=e[13];let E;return e[14]!==C||e[15]!==R?(E=o.jsxs("div",{className:"space-y-2",children:[C,R]}),e[14]=C,e[15]=R,e[16]=E):E=e[16],E}let d;e[17]!==n?(d=fu(n)?n:Gie(),e[17]=n,e[18]=d):d=e[18];const h=d,u=typeof h.name=="string"?h.name:"",f=typeof h.encrypted=="string"&&h.encrypted,m=`${a}-name`,p=l?.virtualMcpId;let g;e[19]!==i||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=o.jsx(zs,{htmlFor:m,label:i,description:s.description,virtualMcpId:p}),e[19]=i,e[20]=s.description,e[21]=m,e[22]=p,e[23]=g):g=e[23];const x=`${a}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let v;e[26]!==h||e[27]!==r?(v=N=>r({...h,name:N.target.value}),e[26]=h,e[27]=r,e[28]=v):v=e[28];let _;e[29]!==u||e[30]!==x||e[31]!==b||e[32]!==v?(_=o.jsx(yt,{id:x,value:u,placeholder:b,onChange:v,className:"h-10"}),e[29]=u,e[30]=x,e[31]=b,e[32]=v,e[33]=_):_=e[33];const L=`${a}-value`;let y;e[34]!==f||e[35]!==c?(y=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=y):y=e[36];let w;e[37]!==h||e[38]!==f||e[39]!==r?(w=N=>{const V=N.target.value;if(!V){r(f?Yie(h):h);return}r({...h,value:V})},e[37]=h,e[38]=f,e[39]=r,e[40]=w):w=e[40];let S;e[41]!==y||e[42]!==w||e[43]!==L?(S=o.jsx(yt,{id:L,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:y,onChange:w,className:"h-10"}),e[41]=y,e[42]=w,e[43]=L,e[44]=S):S=e[44];let k;e[45]!==f||e[46]!==c?(k=f&&o.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=f,e[46]=c,e[47]=k):k=e[47];let j;return e[48]!==S||e[49]!==k||e[50]!==g||e[51]!==_?(j=o.jsxs("div",{className:"space-y-2",children:[g,_,S,k]}),e[48]=S,e[49]=k,e[50]=g,e[51]=_,e[52]=j):j=e[52],j}function Qie(t,e){const s=t.anyOfRefs;if(!s?.length)return;const n=e.find(d=>d!=null&&typeof d=="object"&&!Array.isArray(d)),r=n?Object.keys(n).filter(d=>!d.startsWith("__")):[],i=[],a=d=>{d?.type==="object"&&d.properties&&i.push(d)};for(const d of s){const h=d.schema;if(h&&(h.type==="array"&&a(h.items),h.properties))for(const u of Object.values(h.properties))u?.type==="array"&&a(u.items)}if(i.length===0)return;if(r.length===0)return i.length===1?i[0]:void 0;let l,c=-1;for(const d of i){const h=d.properties??{},u=r.filter(f=>f in h).length*2+(d.titleBy?1:0);u>c&&(c=u,l=d)}return c>=2?l:void 0}function Xie(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const s={};for(const[n,r]of Object.entries(e))n.startsWith("__")||(typeof r=="string"?s[n]={type:"string"}:typeof r=="number"?s[n]={type:"number"}:typeof r=="boolean"&&(s[n]={type:"boolean"}));return Object.keys(s).length>0?{type:"object",properties:s}:void 0}const Jie=new Set(["__resolveType","@type"]);function Zie(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return!1;const e=t.anyOfRefs[0].schema;return!!(e?.properties?.variants||!e&&t.plainSchema)}function eoe(t){if(H9(t))for(const e of t.anyOfRefs??[]){const r=e.schema?.properties?.variants?.items?.properties?.value;if(r?.type==="array"&&r.items)return r.items}}function nv(t){if(t.type==="array"&&t.items)return t;const e=t.items??eoe(t);return e?{...t,type:"array",items:e}:null}function toe(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function tj(t){const{value:e,meta:s}=t;if(e===null||typeof e!="object"||Array.isArray(e))return null;const n=e.__resolveType;if(typeof n!="string"||!s)return null;const r=$n(n,s);return r?o.jsx(Hr,{schema:r,value:e,onChange:t.onChange,basePath:t.path,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:s,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection,sandbox:t.sandbox},t.path):null}function Ga(t){const{schema:e,value:s}=t;if(_f(s)){const a=Dee(s),l=nv(e);if(a!==null&&l)return o.jsx(dh,{...t,schema:l,value:a,onChange:c=>t.onChange(Mee(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&H9(e)){const a=nv(e);if(a)return o.jsx(dh,{...t,schema:a,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!_f(s)&&e.type==="block-ref"){const a=Qie(e,s)??Xie(s);if(a){const l={...e,type:"array",items:a};return o.jsx(dh,{...t,schema:l,value:s,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||s!==null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.__resolveType=="string"&&e.anyOfRefs){if(Zie(e)){const a=e.anyOfRefs[0],l=a.schema?.properties?.variants?.items?.properties?.value,c=l&&l.type!=="block-ref"?l:e.plainSchema??l?.plainSchema??{type:"string"},d=h=>Ga({...h,schema:c});return o.jsx(ej,{...t,multivariateResolveType:a.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?o.jsx(qb,{...t},t.path):null}if(e.type==="inline-union")return o.jsx(Ure,{...t},t.path);if(e.format==="image-uri")return o.jsx(Tre,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return o.jsx(Cre,{...t},t.path);if(e.format==="map")return o.jsx(Gre,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return o.jsx(tre,{...t},t.path);if(e.format==="location")return o.jsx(Hk,{...t},t.path);if(e.enum&&e.enum.length>0)return o.jsx(zse,{...t},t.path);if(e.type==="anyOf")return o.jsx(qb,{...t},t.path);if(fu(s)||e.format==="password"||s==null&&e.format==="password")return o.jsx(Z1,{...t},t.path);if(!e.format&&!e.enum){const a=tj(t);if(a)return a}const n=s??toe(e.type,e.default);if(n==null)return fu(s)?o.jsx(Z1,{...t},t.path):null;if(fu(n))return o.jsx(Z1,{...t,value:n},t.path);const r={...t,value:n},i=s==null?e.type??typeof n:Array.isArray(n)?"array":typeof n;if(i==="array"||Array.isArray(n))return o.jsx(dh,{...r},t.path);switch(i){case"boolean":return o.jsx(Mse,{...r},t.path);case"number":case"integer":return o.jsx(Dse,{...r},t.path);case"string":{const a=e.format;return a==="color-input"||a==="color"?o.jsx(lh,{...r},t.path):a==="textarea"||a==="rich-text"||a==="html"?o.jsx(lh,{...r},t.path):o.jsx(lh,{...r},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?o.jsx(Ine,{...r},t.path):null;default:return o.jsx(lh,{...r},t.path)}}function soe(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Ga({...t,schema:e});const s=tj(t);return s||Ga(e?{...t,schema:e}:t)}function Hr({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:r=[],onBreadcrumbChange:i,meta:a,decofile:l,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}){const m=ue(),p=t.properties;if(!p)return t.type==="inline-union"?Ga({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:r,onBreadcrumbChange:i,meta:a,decofile:l,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}):null;if(Ree(e)&&p.variants){const C=p.variants.items?.properties?.value;return o.jsx(ej,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:r,onBreadcrumbChange:i,meta:a,decofile:l,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:T=>soe(T,C)},n)}const g=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},x=Object.keys(p).filter(C=>!Jie.has(C)&&p[C]?.hidden!==!0),b=new Set(t.required??[]);if(x.length===0)return o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sectionsEditor.sectionsEditor.noEditableFields")});const v=(C,T)=>{if(T===void 0){const{[C]:A,...R}=g;s(R);return}s({...g,[C]:T})},_=typeof g.__resolveType=="string"?g.__resolveType:void 0,L=x.filter(C=>{const T=p[C];return T!=null&&Fc(T,g[C])}).length>1,y=gne(x,p,g),w=r.length>0?bne(x,p,g,r,l,a):null,S=w?p[w]:null,k=w&&S?[w]:x,j=w&&S?pne(w,S,r,Iu(w,x,p)):r,N=mne(r,j),V=N.length>0&&i?C=>i([...N,...C]):i;return o.jsx("div",{className:"min-w-0 space-y-6",children:k.map(C=>{const T=p[C];if(!T)return null;const A=n?`${n}.${C}`:C,R=Iu(C,x,p),E=qa(C,T),O=(N.length===0&&x.some($=>{const M=p[$];return $!==C&&M!=null&&qa($,M)===E})||N.length===0&&y.has(C))&&V?T.type==="block-ref"?$=>V(hne(C,$)):$=>V(une(R,$)):V;return Ga({schema:T,value:g[C],onChange:$=>v(C,$),path:A,label:R,required:b.has(C),breadcrumbPath:j,onBreadcrumbChange:O,hasSiblingDrillDownFields:L,focused:w===C,meta:a,decofile:l,onSaveReferencedBlock:c,containerResolveType:_,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f})})})}function noe(t){const e=U.c(3),{isPending:s,isError:n}=t;if(n){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(vn,{size:13}),"Couldn't save"]}),e[0]=i):i=e[0],i}if(s){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(nt,{className:"size-[13px]"}),"Saving…"]}),e[1]=i):i=e[1],i}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[o.jsx($t,{size:13}),"Saved"]}),e[2]=r):r=e[2],r}const rv=3e4;function roe(t,e,s,n){const r=new URL(`/deco/invoke/${e}`,t);return r.searchParams.set("__cb",n.toString(36)),r.searchParams.set("__decoFBT","0"),r.searchParams.set("__d",`run-${n.toString(36)}`),r.searchParams.set("props",btoa(encodeURIComponent(JSON.stringify(s)))),r.href}async function ioe(t,{resolveType:e,props:s}){let n;try{n=await fetch(cS(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(rv)})}catch(l){throw l instanceof DOMException&&l.name==="TimeoutError"?new Error(`Run timed out after ${rv/1e3}s — the block may be slow or the preview unresponsive.`):l}const r=await n.text();let i=null,a=!1;try{i=r?JSON.parse(r):null,a=!0}catch{}if(!n.ok){const l=a&&i&&typeof i=="object"&&"error"in i&&typeof i.error=="string"?i.error:r||`Run failed (${n.status})`;throw new Error(l)}return a?i:r}function ooe(t){const e=U.c(2);let s;return e[0]!==t?(s={mutationFn:n=>ioe(t,n)},e[0]=t,e[1]=s):s=e[1],Rs(s)}function sj({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:r,decofile:i,kind:a,target:l,initialValue:c,isCreating:d,onCreate:h,onSaveReferencedBlock:u,onBack:f,showRun:m=!0}){const p=ws()?.taskId??null,g=ue(),x=lo(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,v=$n(l.resolveType,r),_=!v&&BZ(l.resolveType,r),L=_?zZ(c):null,y=v??L,[w,S]=P.useState(c),[k,j]=P.useState([]),[N,V]=P.useState(0),[C,T]=P.useState(!1),[A,R]=P.useState(null),[E,I]=P.useState(!1),[D,O]=P.useState(!1),[$,M]=P.useState(!1),z=A!==null,{save:F,flush:B,isPending:H}=G3({orgSlug:t,virtualMcpId:e,branch:s}),W=ooe({orgSlug:t,virtualMcpId:e,branch:s,threadId:p});P.useEffect(()=>()=>{B()},[]);const K=tk(a),q=l.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??l.resolveType,G={orgSlug:t,virtualMcpId:e,branch:s,threadId:p,previewUrl:n??void 0,siteSlug:b},te=he=>{S(he),l.mode==="saved"&&F(l.blockKey,{__resolveType:l.resolveType,...he})},X=()=>{z?(R(null),T(!1),V(he=>he+1)):R(JSON.stringify(w,null,2))},Z=he=>{const ne=he??"";try{const Q=JSON.parse(ne);if(Q&&typeof Q=="object"&&!Array.isArray(Q)){T(!1),te(Q);return}T(!0)}catch{T(!0)}},ee=async he=>{const ne=nx(he,i);if(ne){ye.error(ne);return}await h(he,{__resolveType:l.resolveType,...w}),I(!1)},se=()=>{O(!0),W.mutate({resolveType:l.resolveType,props:w})},J=()=>{n&&window.open(roe(n,l.resolveType,w,Date.now()),"_blank","noopener")},oe=[l.title,...k],ce=he=>{j(k.slice(0,he)),V(ne=>ne+1)};return o.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:o.jsx(n9,{size:14})}),o.jsx("nav",{"aria-label":g("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:oe.map((he,ne)=>{const Q=ne===oe.length-1,de=kn(he);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ne>0&&o.jsx(Us,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>ce(ne),title:de,className:le("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",Q?"font-medium text-foreground":"text-muted-foreground"),children:de})]},`${de}-${ne}`)})}),l.mode==="saved"&&o.jsx(noe,{isPending:H,isError:!1}),m&&o.jsxs(me,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:se,disabled:W.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:K}),children:[W.isPending?o.jsx(nt,{className:"size-3.5"}):o.jsx(Oa,{size:14}),g("sandbox.runnableBlockEditor.run")]}),l.mode==="available"&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>I(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:K}),children:o.jsx(W2,{size:14})})}),o.jsx(We,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:K})})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:z?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:X,"aria-label":g(z?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":z,children:z?o.jsx(nn,{size:14}):o.jsx(rd,{size:14})})}),o.jsx(We,{side:"bottom",children:g(z?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:l.mode==="saved"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:K}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:q,singular:K})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("div",{className:le("relative min-h-0 flex-1",D&&$&&"hidden"),children:[o.jsx(rl,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[L&&y===L&&o.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:g("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:K})}),y?o.jsx(Hr,{schema:y,value:w,onChange:he=>te(he),basePath:"",breadcrumbPath:k,onBreadcrumbChange:j,meta:r,decofile:i,onSaveReferencedBlock:u,sandbox:G},N):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:_?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:K}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:K})})]})})}),A!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[C&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:g("sandbox.runnableBlockEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ud,{language:"json",height:"100%",code:A,onChange:Z,onSave:he=>{Z(he),B()}})})]})]}),D&&o.jsx(aoe,{singular:K,result:{isPending:W.isPending,error:W.error,data:W.data,hasRun:W.status!=="idle"},expanded:$,onToggleExpand:()=>M(he=>!he),onOpenInNewTab:n?J:void 0,onClose:()=>{O(!1),M(!1)}})]}),o.jsx(rx,{open:E,onOpenChange:I,defaultBlockId:"",isPending:d,onSubmit:ee})]})}function aoe(t){const e=U.c(54),{singular:s,result:n,expanded:r,onToggleExpand:i,onOpenInNewTab:a,onClose:l}=t,c=ue();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const h=d,u=r?"flex-1":"h-[45%] shrink-0";let f;e[2]!==u?(f=le("flex min-h-0 flex-col border-t",u),e[2]=u,e[3]=f):f=e[3];let m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:m}),e[6]=m,e[7]=p):p=e[7];let g;e[8]!==a||e[9]!==s||e[10]!==c?(g=a&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:o.jsx(fn,{size:14})})}),o.jsx(We,{side:"bottom",children:c("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:s})})]}),e[8]=a,e[9]=s,e[10]=c,e[11]=g):g=e[11];let x;e[12]!==r||e[13]!==c?(x=c(r?"sandbox.runnableBlockEditor.collapseResult":"sandbox.runnableBlockEditor.expandResult"),e[12]=r,e[13]=c,e[14]=x):x=e[14];let b;e[15]!==r?(b=r?o.jsx(WT,{size:14}):o.jsx(G6,{size:14}),e[15]=r,e[16]=b):b=e[16];let v;e[17]!==r||e[18]!==i||e[19]!==x||e[20]!==b?(v=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:i,"aria-label":x,"aria-pressed":r,children:b})}),e[17]=r,e[18]=i,e[19]=x,e[20]=b,e[21]=v):v=e[21];let _;e[22]!==r||e[23]!==c?(_=c(r?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=r,e[23]=c,e[24]=_):_=e[24];let L;e[25]!==_?(L=o.jsx(We,{side:"bottom",children:_}),e[25]=_,e[26]=L):L=e[26];let y;e[27]!==L||e[28]!==v?(y=o.jsxs(qe,{children:[v,L]}),e[27]=L,e[28]=v,e[29]=y):y=e[29];let w;e[30]!==c?(w=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=w):w=e[31];let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(nn,{size:14}),e[32]=S):S=e[32];let k;e[33]!==l||e[34]!==w?(k=o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":w,children:S}),e[33]=l,e[34]=w,e[35]=k):k=e[35];let j;e[36]!==y||e[37]!==k||e[38]!==g?(j=o.jsxs("div",{className:"flex items-center gap-0.5",children:[g,y,k]}),e[36]=y,e[37]=k,e[38]=g,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==p?(N=o.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[p,j]}),e[40]=j,e[41]=p,e[42]=N):N=e[42];let V;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==h||e[47]!==s||e[48]!==c?(V=o.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?o.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[o.jsx(nt,{className:"size-4"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?o.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[o.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),o.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?o.jsx(ud,{language:"json",height:"100%",code:h,readOnly:!0}):o.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:c("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:s})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=h,e[47]=s,e[48]=c,e[49]=V):V=e[49];let C;return e[50]!==N||e[51]!==V||e[52]!==f?(C=o.jsxs("div",{className:f,children:[N,V]}),e[50]=N,e[51]=V,e[52]=f,e[53]=C):C=e[53],C}function loe(t){const e=U.c(29),{orgSlug:s,virtualMcpId:n,branch:r,previewUrl:i,meta:a,decofile:l,blockKey:c}=t,d=ue();let h;e[0]!==r||e[1]!==s||e[2]!==n?(h={orgSlug:s,virtualMcpId:n,branch:r},e[0]=r,e[1]=s,e[2]=n,e[3]=h):h=e[3];const u=w0(h);let f;e[4]!==u?(f=Q3((y,w)=>u.mutate({blockKey:y,data:w})),e[4]=u,e[5]=f):f=e[5];const m=f;let p;e[6]!==c||e[7]!==l?(p=ok(l,c),e[6]=c,e[7]=l,e[8]=p):p=e[8];const{resolveType:g,props:x,title:b}=p;if(!g){let y;e[9]!==d?(y=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=y):y=e[10];let w;return e[11]!==y?(w=o.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:y}),e[11]=y,e[12]=w):w=e[12],w}const v=`loader:${c}`;let _;e[13]!==c||e[14]!==g||e[15]!==b?(_={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=_):_=e[16];let L;return e[17]!==r||e[18]!==l||e[19]!==a||e[20]!==s||e[21]!==i||e[22]!==x||e[23]!==u.isPending||e[24]!==m||e[25]!==v||e[26]!==_||e[27]!==n?(L=o.jsx(sj,{orgSlug:s,virtualMcpId:n,branch:r,previewUrl:i,meta:a,decofile:l,kind:"loaders",target:_,initialValue:x,isCreating:u.isPending,onCreate:coe,onSaveReferencedBlock:m,showRun:!1},v),e[17]=r,e[18]=l,e[19]=a,e[20]=s,e[21]=i,e[22]=x,e[23]=u.isPending,e[24]=m,e[25]=v,e[26]=_,e[27]=n,e[28]=L):L=e[28],L}async function coe(){}function doe(t){if(t instanceof Error&&"status"in t&&typeof t.status=="number")return t.status}function iv(t){return{status:t.status,hasData:t.data!==void 0,errorStatus:doe(t.error)}}function uoe(t){switch(t){case"clone-failed":case"install-failed":case"start-failed":return"terminal-error";case"idle":case"cloning":return"booting";case"checking-out":case"installing":case"starting":case"running":case"crashed":return"snapshot-readable"}}function hoe(t){if(t.fastPreviewActive)return t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData?{kind:"error",source:"data"}:!t.decofile.hasData||!t.meta.hasData?{kind:"loading"}:t.hasEditableContent?{kind:"content"}:{kind:"empty",reason:"no-content"};const e=uoe(t.lifecyclePhase);if(e==="terminal-error")return{kind:"error",source:"sandbox"};if(e==="booting")return{kind:"loading"};const s=t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData;return s&&t.lifecyclePhase==="checking-out"?{kind:"loading"}:[t.decofile,t.meta].some(r=>r.status==="error"&&!r.hasData&&r.errorStatus===404)?{kind:"empty",reason:"framework-missing"}:s?t.lifecyclePhase==="running"||t.lifecyclePhase==="crashed"?{kind:"error",source:"data"}:{kind:"loading"}:!t.decofile.hasData||!t.meta.hasData?{kind:"loading"}:t.hasEditableContent?{kind:"content"}:{kind:"empty",reason:"no-content"}}const foe="https://github.com/decocms/blocks";function moe(){const t=U.c(14),e=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(qT,{size:48,className:"text-muted-foreground"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("mainPanelTabs.blocksTabStates.emptyStateTitle"),t[1]=e,t[2]=n):n=t[2];let r;t[3]!==e?(r=e("mainPanelTabs.blocksTabStates.emptyStateDescription"),t[3]=e,t[4]=r):r=t[4];let i;t[5]!==e?(i=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=i):i=t[6];let a;t[7]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(fn,{size:14}),t[7]=a):a=t[7];let l;t[8]!==i?(l=o.jsx(me,{size:"sm",asChild:!0,children:o.jsxs("a",{href:foe,target:"_blank",rel:"noreferrer",children:[i,a]})}),t[8]=i,t[9]=l):l=t[9];let c;return t[10]!==n||t[11]!==r||t[12]!==l?(c=o.jsx(Dr,{className:"h-full w-full",image:s,title:n,description:r,actions:l}),t[10]=n,t[11]=r,t[12]=l,t[13]=c):c=t[13],c}function poe(t){const e=U.c(15),{source:s,onRetry:n}=t,r=ue();let i;e[0]!==s||e[1]!==r?(i=r(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=r,e[2]=i):i=e[2];const a=i;let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(vn,{size:48,className:"text-muted-foreground"}),e[3]=l):l=e[3];let c;e[4]!==r?(c=r("mainPanelTabs.blocksTabStates.errorStateTitle"),e[4]=r,e[5]=c):c=e[5];let d;e[6]!==r?(d=r("mainPanelTabs.blocksTabStates.retry"),e[6]=r,e[7]=d):d=e[7];let h;e[8]!==n||e[9]!==d?(h=o.jsx(me,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=h):h=e[10];let u;return e[11]!==a||e[12]!==c||e[13]!==h?(u=o.jsx(Dr,{image:l,title:c,description:a,actions:h}),e[11]=a,e[12]=c,e[13]=h,e[14]=u):u=e[14],u}const goe=P.lazy(()=>Ks(()=>import("./sections-editor-CdzZDcnU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SectionsEditor})));function ov(t){const e=U.c(49),{virtualMcpId:s,externalSelection:n,onViewJsonFile:r}=t,i=n===void 0?null:n,{org:a}=Fe(),{currentBranch:l,taskId:c}=an(),d=mr(),h=ca(),u=lk(),f=d.lifecycle.phase==="running",m=h.previewUrl;let p;e[0]!==l||e[1]!==a||e[2]!==m||e[3]!==c||e[4]!==s?(p=l?{orgSlug:a.slug,virtualMcpId:s,branch:l,threadId:c??null,previewUrl:m}:null,e[0]=l,e[1]=a,e[2]=m,e[3]=c,e[4]=s,e[5]=p):p=e[5];const g=p;let x;e[6]!==f?(x={fetchEnabled:f},e[6]=f,e[7]=x):x=e[7];const b=B9(g,x);let v;e[8]!==f?(v={fetchEnabled:f},e[8]=f,e[9]=v):v=e[9];const _=z3(g,v),L=hoe({lifecyclePhase:d.lifecycle.phase,decofile:iv(b),meta:iv(_),hasEditableContent:VS(b.data,_.data),fastPreviewActive:_n(s).runtime==="cms"}),y=xoe;if(L.kind==="loading"){let M;return e[10]===Symbol.for("react.memo_cache_sentinel")?(M=y(o.jsx(Pa,{})),e[10]=M):M=e[10],M}if(L.kind==="empty"){let M;return e[11]===Symbol.for("react.memo_cache_sentinel")?(M=y(o.jsx(moe,{})),e[11]=M):M=e[11],M}if(L.kind==="error"){let M;e[12]!==b||e[13]!==h||e[14]!==_||e[15]!==L.source?(M=()=>{if(L.source==="sandbox"){h.retry();return}Promise.all([b.refetch(),_.refetch()])},e[12]=b,e[13]=h,e[14]=_,e[15]=L.source,e[16]=M):M=e[16];const z=M;let F;return e[17]!==z||e[18]!==L.source?(F=y(o.jsx(poe,{source:L.source,onRetry:z})),e[17]=z,e[18]=L.source,e[19]=F):F=e[19],F}let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=M=>y(o.jsx("div",{className:"h-full min-h-0",children:M})),e[20]=w):w=e[20];const S=w,k=u.state.target;if(k?.kind==="loader"&&b.data&&_.data){const M=l??"",z=m??null;let F;return e[21]!==b.data||e[22]!==_.data||e[23]!==a.slug||e[24]!==M||e[25]!==z||e[26]!==k.key||e[27]!==s?(F=S(o.jsx(loe,{orgSlug:a.slug,virtualMcpId:s,branch:M,previewUrl:z,meta:_.data,decofile:b.data,blockKey:k.key})),e[21]=b.data,e[22]=_.data,e[23]=a.slug,e[24]=M,e[25]=z,e[26]=k.key,e[27]=s,e[28]=F):F=e[28],F}let j;e[29]!==l||e[30]!==a.slug||e[31]!==k||e[32]!==s?(j=k||!l?null:K3(H3(a.slug,s,l)),e[29]=l,e[30]=a.slug,e[31]=k,e[32]=s,e[33]=j):j=e[33];const N=j;let V="/",C=null,T=null;k?.kind==="page"?(V=k.path,C=k.key):k?.kind==="section"?T=k.key:N&&(V=N.path,C=N.pageKey);const A=C?`page:${C}`:T?`section:${T}`:`path:${V}`;let R;e[34]===Symbol.for("react.memo_cache_sentinel")?(R=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(nt,{className:"size-5 text-muted-foreground"})}),e[34]=R):R=e[34];const E=l??"",I=m??void 0,D=T?null:i,O=!!C&&u.state.editSeoPageKey===C;let $;return e[35]!==T||e[36]!==C||e[37]!==V||e[38]!==A||e[39]!==r||e[40]!==a.slug||e[41]!==D||e[42]!==O||e[43]!==E||e[44]!==I||e[45]!==s||e[46]!==u.consumeEditSeo||e[47]!==u.setVariantOverride?($=S(o.jsx(P.Suspense,{fallback:R,children:o.jsx(goe,{orgSlug:a.slug,virtualMcpId:s,branch:E,previewReady:!0,previewUrl:I,currentPath:V,activePageBlockKey:C,activeGlobalBlockKey:T,externalSelection:D,initialEditSeo:O,onExitSeo:u.consumeEditSeo,onVariantPreviewOverride:u.setVariantOverride,onViewJsonFile:r},A)})),e[35]=T,e[36]=C,e[37]=V,e[38]=A,e[39]=r,e[40]=a.slug,e[41]=D,e[42]=O,e[43]=E,e[44]=I,e[45]=s,e[46]=u.consumeEditSeo,e[47]=u.setVariantOverride,e[48]=$):$=e[48],$}function xoe(t){return o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:t})}function av(t){const e=U.c(44),{virtualMcpId:s,pageKey:n,onClose:r,ref:i}=t,a=ue(),{org:l}=Fe(),{currentBranch:c,taskId:d}=an(),u=ca().previewUrl;let f;e[0]!==c||e[1]!==l.slug||e[2]!==u||e[3]!==d||e[4]!==s?(f=c?{orgSlug:l.slug,virtualMcpId:s,branch:c,threadId:d??null,previewUrl:u}:null,e[0]=c,e[1]=l.slug,e[2]=u,e[3]=d,e[4]=s,e[5]=f):f=e[5];const p=B9(f),g=c??"";let x;e[6]!==l.slug||e[7]!==g||e[8]!==s?(x={orgSlug:l.slug,virtualMcpId:s,branch:g},e[6]=l.slug,e[7]=g,e[8]=s,e[9]=x):x=e[9];const{save:b,flush:v}=G3(x),_=p.data?.[n],L=p.data===void 0&&p.isLoading,y=p.data!==void 0&&_===void 0,w=!c||y||L;let S;e[10]!==_?(S=_===void 0?"":JSON.stringify(_,null,2),e[10]=_,e[11]=S):S=e[11];const k=S;let j;e[12]!==n||e[13]!==w||e[14]!==b?(j=$=>{if(w)return;let M;try{M=JSON.parse($)}catch{return}M===null||typeof M!="object"||Array.isArray(M)||b(n,M)},e[12]=n,e[13]=w,e[14]=b,e[15]=j):j=e[15];const N=j;let V;e[16]!==v?(V=()=>({flush:v}),e[16]=v,e[17]=V):V=e[17],P.useImperativeHandle(i,V);let C;e[18]!==a?(C=a("sectionsEditor.pageJsonDialog.titleShort"),e[18]=a,e[19]=C):C=e[19];let T;e[20]!==C?(T=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:C}),e[20]=C,e[21]=T):T=e[21];let A;e[22]!==a?(A=a("sectionsEditor.pageJsonDialog.close"),e[22]=a,e[23]=A):A=e[23];let R;e[24]===Symbol.for("react.memo_cache_sentinel")?(R=o.jsx(nn,{size:14}),e[24]=R):R=e[24];let E;e[25]!==r||e[26]!==A?(E=o.jsx(me,{variant:"ghost",size:"icon",onClick:r,"aria-label":A,className:"size-7 shrink-0",children:R}),e[25]=r,e[26]=A,e[27]=E):E=e[27];let I;e[28]!==E||e[29]!==T?(I=o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[T,E]}),e[28]=E,e[29]=T,e[30]=I):I=e[30];let D;e[31]!==p.data||e[32]!==v||e[33]!==k||e[34]!==L||e[35]!==y||e[36]!==n||e[37]!==w||e[38]!==N||e[39]!==a?(D=L?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(nt,{className:"size-5 text-muted-foreground"})}):y?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",a("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ud,{code:k,language:"json",readOnly:w,height:"100%",onChange:$=>N($??""),onSave:$=>{N($),v()}},`${n}:${p.data===void 0?"loading":"ready"}`)}),e[31]=p.data,e[32]=v,e[33]=k,e[34]=L,e[35]=y,e[36]=n,e[37]=w,e[38]=N,e[39]=a,e[40]=D):D=e[40];let O;return e[41]!==I||e[42]!==D?(O=o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[I,D]}),e[41]=I,e[42]=D,e[43]=O):O=e[43],O}function nj(t){return t.contentEditingEnabled&&!t.isMobile}function boe(t,e){return t!=="visual"?"visual":e?"blocks":"preview"}function voe(t){return nj({contentEditingEnabled:B8(t.cmsMode),isMobile:t.isMobile})?"blocks":"preview"}function yoe(t){return t.editingMode==="blocks"&&!t.blocksEditingEnabled||t.editingMode==="visual"&&!t.sandboxDisplay?"preview":t.editingMode}const _oe=500,Loe={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},lv=1,em=["desktop","mobile","tablet"],cv={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function dv(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function woe(t){if(!t)return null;try{const e=new URL(t,window.location.href);return e.searchParams.set("__decoFBT","0"),e.searchParams.set("__deco_ssr","1"),e.href}catch{return t}}function hh(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function tm(t,e){try{return new URL(t,e).href}catch{return null}}function Soe(t,e,s){const n=t.toLowerCase(),r=e.toLowerCase(),i=r.split("/").filter(Boolean),a=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let h=40;return d===0?h+=30:/[\s/-]/.test(c[d-1]??"")&&(h+=20),h+=Math.round(s.length/c.length*20),h};let l=Math.max(a(n),a(r));return i.at(-1)===s?l=Math.max(l,95):i.includes(s)&&(l=Math.max(l,90)),l}function koe(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function joe({virtualMcpId:t}){const e=ue(),s=ad(),n=Ja(),r=wZ(),{currentBranch:i,taskId:a}=an(),l=lk(),c=lo(),d=_n(t),h=c0(c?.entity?.id===t?c.entity.metadata?.ui?.layout??null:null),u=B8(h),f=nj({contentEditingEnabled:u,isMobile:n}),[m,p]=P.useState(()=>voe({cmsMode:h,isMobile:n})),[g,x]=P.useState("desktop"),[b,v]=P.useState(null),[_,L]=P.useState(null),y=P.useRef(null),w=P.useRef(null),[S,k]=P.useState(!1),j=P.useRef(null),N=()=>{j.current?.flush(),k(!1)},V=()=>k(ve=>(ve&&j.current?.flush(),!ve)),[C,T]=P.useState({width:0,height:0}),[A,R]=P.useState(null),[E,I]=P.useState(!1),[D,O]=P.useState(""),$=P.useRef(null),[M,z]=P.useState(!1),[F,B]=P.useState(),[H,W]=P.useState(null),[K,q]=P.useState(null),[G,te]=P.useState(null),[X,Z]=P.useState("/"),[ee,se]=P.useState(null),[J,oe]=P.useState({}),[ce,he]=P.useState(!1),ne=P.useRef(null),Q=()=>{he(!0),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>he(!1),15e3)},de=()=>{ne.current&&(clearTimeout(ne.current),ne.current=null),he(!1)},{org:ae}=Fe(),re=mr(),ie=ca(),Y=ie.vmEntry,pe=ie.previewUrl,be=re.lifecycle.phase,_e=be==="running",Le=c?.entity?.id===t?F2(c.entity.metadata):null,ke=c?.entity?.id===t&&d.runtime==="cms",Ve=d.projectDefault==="cms",Pe=bee({sandboxUrl:pe,previewServerUrl:Le,fastPreviewActive:ke}),xe=t&&i?{orgSlug:ae.slug,virtualMcpId:t,branch:i,threadId:a??null,previewUrl:pe}:null,Ne=B9(xe,{fetchEnabled:_e}),je=z3(xe,{fetchEnabled:_e}),we=Ne.data,Ce=je.data,Oe=we?bf(we).sort((ve,Re)=>ve.name.localeCompare(Re.name)):[],rt=t&&i?{orgSlug:ae.slug,virtualMcpId:t,branch:i}:null,Ge=qte(rt),Vt=we&&Ce?B3(we,Ce):[],lt=we&&Ce?ik(Ce,we,"loaders"):[],tt=D?(()=>{const ve=D.toLowerCase();return Oe.map(Re=>({page:Re,score:Soe(Re.name,Re.path,ve)})).filter(({score:Re})=>Re>0).sort((Re,bt)=>bt.score-Re.score||Re.page.path.length-bt.page.path.length).map(({page:Re})=>Re)})():Oe,ft=Vt.filter(ve=>{if(!D)return!0;const Re=D.toLowerCase();return ve.name.toLowerCase().includes(Re)||ve.key.toLowerCase().includes(Re)||ve.resolveType.toLowerCase().includes(Re)}),Lt=f?lt:[],mt=Lt.filter(ve=>{if(!D)return!0;const Re=D.toLowerCase();return ve.title.toLowerCase().includes(Re)||ve.key.toLowerCase().includes(Re)||ve.resolveType.toLowerCase().includes(Re)}),Qe=K?lt.find(ve=>ve.key===K)??null:null,st=Fo,gt=H||K?null:wp(Oe,X,ee),ge=H?H.name:Qe?.title??gt?.name,Ee=gt?.key??null,De=gt?.path??null,dt=(Ee?J[Ee]:void 0)??{},ht=Ri(X,dt),ut={};if(_e&&pe&&Ce&&we){const ve=Jte(Ce,"loaders"),Re=Ee?we[Ee]:void 0,bt=gte(Re,we,rs=>ve.has(rs)),kt=ute(bt);for(const rs of mf(X)){if(rs.type!=="param")continue;const mn=lte(X,rs.name,bt),Ys=mte(mn,ve,kt);Ys.length>0&&(ut[rs.name]=Ys)}}const ct=t&&i?{orgSlug:ae.slug,virtualMcpId:t,branch:i,threadId:a??null}:null,it=we&&Ee?FS(we,Ee,0):[],Ue=we?IS(it,we):[],_t=Ue.map(ve=>ve.isSavedBlock?ve.label:""),St=Ue.map(ve=>ve.isSavedBlock?"global":ve.isMultivariate?"variant":"normal"),Mt=it.map(ve=>kp(ve,we??{})),Pt=P.useRef(null),Ie=P.useRef(null),xt=re.status.state==="paused",Se=re.phase,ze=WS({claimPhase:Se,lifecycle:re.lifecycle}),ot=ie.previewState,fe=ie.userStopped,Me=F3(ae.slug,t??"",i??""),{url:He}=MS(ke&&t&&i?{orgSlug:ae.slug,virtualMcpId:t,branch:i,previewServerUrl:Le??null,path:ht}:null),Je=Ve&&d.runtime==="sandbox",Ze=pZ({previewState:ot,progressStatus:ze.status,previewServerUrl:Le,fastPreviewActive:ke,fastPreviewReady:!!He,codingSession:Je}),wt=Ze.mode!=="none",Ws=Ze.mode==="production"&&Ze.iframeBase?hh(Ze.iframeBase):null,pt=!s,qs=Ze.mode==="production"?Ws:hh(pe),vi=c?.entity?.id===t&&c.entity.metadata?.fastPreviewInPlace===!0,Ot=Ze.mode==="production"&&ke&&vi&&f&&m==="blocks",yi=P.useRef(null);Ot||(yi.current=He);const co=yi.current,uo=Ot?co??He:He,Gs=woe(Ze.mode==="sandbox"?sh(dv(G??tm(ht,Ze.iframeBase)??Ze.iframeBase,g),l.state.variantOverride??[]):Ze.mode==="production"&&pt?sh(dv(DS(G??uo??tm(ht,Ze.iframeBase)??Ze.iframeBase,Ze.showWakingPill?gee:null),g),l.state.variantOverride??[]):null);P.useEffect(()=>{},[s,Ws,A]);const _i="sandbox.preview.openInNewTab",pr=He??(Ze.iframeBase?tm(ht,Ze.iframeBase):null),ho=Ze.mode==="production"?pr?sh(pr,l.state.variantOverride??[]):null:Gs??Ze.iframeBase,fo=async()=>{const ve=ho;if(ve){window.open(ve,"_blank","noopener");return}},gr=t&&i?H3(ae.slug,t,i):null,xr=ve=>{gr&&ite(gr,ve)},us=l.state.target;P.useEffect(()=>{if(!(!us||!Pe||!Ce))if(us.kind==="page"){const ve=J[us.key]??{};Ie.current=Ri(us.path,ve),W(null),q(null),te(null),se(us.key),Z(us.path),xr({path:us.path,pageKey:us.key,params:ve})}else if(us.kind==="loader")Ie.current=null,W(null),q(us.key),te(null);else{const ve=Vt.find(Re=>Re.key===us.key);if(ve){Ie.current=null;const Re=pf(Ce);q(null),W(ve),te(kb(Pe,Re,ve.key))}}},[us,Pe,Ce,J]),P.useEffect(()=>{!Ee||De===null||us?.kind==="page"&&us.key===Ee&&us.path===De||l.selectTarget({kind:"page",key:Ee,path:De})},[Ee,De,us]);const[br,mo]=P.useState(null);if(ot.kind==="iframe"&&br!==ot.previewUrl){const ve=br!==null;mo(ot.previewUrl);const Re=gr?K3(gr):null;if(Re){if(Ie.current=Ri(Re.path,Re.params),Z(Re.path),se(Re.pageKey),te(null),W(null),q(null),Re.pageKey&&Object.keys(Re.params).length>0){const bt=Re.pageKey;oe(kt=>({...kt,[bt]:Re.params}))}}else ve&&(Ie.current=null,Z("/"),te(null),se(null),W(null),q(null))}Pt.current=Gs;const vr=vZ({iframeRef:y,src:Ze.mode==="sandbox"?Gs:null,active:Ze.mode==="sandbox"}),Li=P.useRef(null);P.useEffect(()=>{if(!He||!Gs||Li.current===He)return;Li.current=He;const ve=y.current;ve&&ve.getAttribute("src")!==Gs&&(Q(),ve.src=Gs)},[He,Gs]);const wi=()=>{const ve=y.current?.contentWindow,Re=qs;if(!ve||!Re||!we||!Ee)return;const bt=we[Ee];if(!bt||typeof bt!="object")return;const kt=xee({previewBaseUrl:Re,pageBlock:bt,decofile:we,path:ht,pathTemplate:X});if(!kt)return;const rs=sh(kt.src,l.state.variantOverride??[]);ve.postMessage({type:"cms-editor::render",src:rs,body:kt.body},Re)},yr=P.useRef(null);P.useEffect(()=>{if(!Ot||H||K||!Ee||!we){yr.current=null;return}const ve=JSON.stringify({page:Ee,path:ht,pathTemplate:X,decofile:we});if(yr.current===ve)return;const Re=yr.current===null;yr.current=ve,!Re&&wi()},[we,Ot,H,K,Ee,ht,X]);const ha=P.useRef(null);P.useEffect(()=>{if(!Ot||H||K||!Ee||!we){ha.current=null;return}const ve=JSON.stringify(l.state.variantOverride??null),Re=ha.current;ha.current={page:Ee,sig:ve},!(!Re||Re.page!==Ee||Re.sig===ve)&&wi()},[l.state.variantOverride,Ot,H,K,Ee]);const po=!!t&&!!i&&!re.notFound&&!fe&&!xt&&(Se?.kind==="ready"||be!=="idle"),Ps=yoe({editingMode:m,sandboxDisplay:Ze.mode==="sandbox",blocksEditingEnabled:f});P.useEffect(()=>{const ve=qs;if(!ve)return;const Re=bt=>{if(bt.origin===ve)if(bt.data?.type==="visual-editor::element-clicked"){const kt=wee.safeParse(bt.data.payload);kt.success&&v(kt.data)}else if(bt.data?.type==="cms-editor::section-clicked"){const kt=jee.safeParse(bt.data.payload);kt.success&&L({index:kt.data.sectionIndex,seq:kt.data.clickSeq})}else bt.data?.type==="cms-editor::render-start"?Q():bt.data?.type==="cms-editor::render-end"?(de(),y.current?.contentWindow?.postMessage({type:"cms-editor::set-labels",labels:_t,kinds:St,keys:Mt},ve)):bt.data?.type==="cms-editor::render-error"&&de()};return window.addEventListener("message",Re),()=>window.removeEventListener("message",Re)},[qs,_t,St,Mt]);const fa=()=>{const ve=y.current?.contentWindow,Re=hh(pe);!ve||!Re||ve.postMessage({type:"visual-editor::activate",script:See},Re)},go=()=>{const ve=y.current?.contentWindow,Re=hh(pe);!ve||!Re||ve.postMessage({type:"visual-editor::deactivate"},Re)},Kr=()=>{const ve=y.current?.contentWindow,Re=qs;!ve||!Re||(ve.postMessage(Ze.mode==="production"?{type:"editor::inject",args:{script:Cb}}:{type:"visual-editor::activate",script:Cb},Re),ve.postMessage({type:"cms-editor::set-labels",labels:_t,kinds:St,keys:Mt},Re))},Ld=()=>{const ve=y.current?.contentWindow,Re=qs;!ve||!Re||ve.postMessage({type:"cms-editor::deactivate"},Re)},Wr=ve=>{if(ve==="blocks"&&!f)return;const Re=m;!n&&ve!==Re&&(ve==="blocks"?w.current?.resize("30%"):w.current?.collapse()),ve!=="blocks"&&N(),p(ve),v(null),L(null),ve!=="blocks"&&q(null),Re==="visual"&&go(),ve==="visual"&&fa(),Re==="blocks"&&ve!=="blocks"&&Ld(),ve==="blocks"&&Kr()},xo=()=>{Wr(boe(m,f))},bo=()=>{if(!y.current||!Gs)return;Q();const ve=y.current;ve.src=Gs};YB(()=>{const ve=y.current;if(!ve)return;Q();const Re=document.activeElement,bt=ve.tabIndex;ve.tabIndex=-1,ve.style.pointerEvents="none",ve.blur(),koe(ve,Pt.current);let kt;const rs=()=>{clearTimeout(kt),ve.tabIndex=bt,ve.style.pointerEvents="";const mn=document.activeElement;(!mn||mn===document.body||mn===ve)&&Re?.focus(),ve.removeEventListener("load",rs)};ve.addEventListener("load",rs),kt=setTimeout(rs,3e3)});const vo=()=>{const ve=em.indexOf(g);x(em[(ve+1)%em.length])},qr=(ve,Re)=>{if(!Ee)return;const bt=Ee,kt={...dt,[ve]:Re};Ie.current=Ri(X,kt),oe(rs=>({...rs,[bt]:kt})),xr({path:X,pageKey:bt,params:kt})},Si=Hte({iframeBase:Ze.iframeBase,resolvedPath:ht,activeGlobalSectionName:H?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Gr=ve=>{const Re=J[ve.key]??{},bt=Ri(ve.path,Re);(H||st(bt)!==st(ht))&&Q(),Ie.current=bt,W(null),q(null),te(null),L(null),se(ve.key),Z(ve.path),xr({path:ve.path,pageKey:ve.key,params:Re}),l.selectTarget({kind:"page",key:ve.key,path:ve.path})},yo=ve=>{if(!Pe||!Ce){ye.error(e("sandbox.preview.previewMetadataNotReady"));return}Q(),Ie.current=null;const Re=pf(Ce),bt=kb(Pe,Re,ve.key);W(ve),q(null),te(bt),L(null),l.selectTarget({kind:"section",key:ve.key})},n1=ve=>{f&&(W(null),q(ve.key),te(null),Wr("blocks"),l.selectTarget({kind:"loader",key:ve.key}))},_o=async({name:ve,path:Re,templateKey:bt})=>{if(!t||!i)return;const kt=F9(Re);if(kt){B(kt);return}const rs=Re.trim().startsWith("/")?Re.trim():`/${Re.trim()}`;if(Oe.some(Ys=>st(Ys.path)===st(rs))){B(e("sandbox.preview.pageAlreadyExists",{path:rs}));return}let mn;if(bt&&(mn=we?.[bt],!mn)){B(e("sandbox.preview.templateNoLongerExists"));return}B(void 0);try{const Ys=await Ge.mutateAsync({name:ve,path:rs,template:mn});z(!1),ye.success(e("sandbox.preview.pageCreated",{name:ve})),await cd(_oe),Gr({key:Ys.key,name:Ys.name,path:Ys.path}),Wr("blocks")}catch(Ys){B(Ys instanceof Error?Ys.message:e("sandbox.preview.failedToCreatePage"))}},ki=wt&&(po||Ze.mode==="production"),Lo=Kte({showPreviewToolbar:ki,contentEditingEnabled:u}),_r=ki?o.jsxs(o.Fragment,{children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Io,{onClick:bo,"aria-label":e("sandbox.preview.refresh"),children:o.jsx(Mn,{size:16})})}),o.jsx(We,{side:"bottom",children:e("sandbox.preview.refresh")})]}),Lo?o.jsxs("div",{ref:$,className:"relative min-w-0 w-64 shrink",children:[o.jsxs("div",{className:"flex h-7 w-full min-w-0 items-center rounded-md border border-border bg-background transition-colors duration-200 hover:bg-accent",children:[o.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>I(ve=>!ve),children:[H&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[o.jsx(Ki,{size:11}),"Global"]}),Qe&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[o.jsx(Ia,{size:11}),e("sandbox.preview.loaderBadge")]}),o.jsx("span",{className:le("text-[13px] font-medium text-foreground",ge==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:ge??Si}),!H&&!K&&ge!=null&&X&&o.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:mf(X).map((ve,Re)=>{if(ve.type==="text")return o.jsx("span",{className:le(Re===0?"min-w-0 truncate":"shrink-0"),children:ve.text},`text-${Re}`);const bt=ut[ve.name];return bt&&ct?o.jsx(Pte,{sources:bt,template:X,paramName:ve.name,value:dt[ve.name]??"",sandboxRef:ct,onCommit:kt=>qr(ve.name,kt)},`${Ee}:${ve.name}`):o.jsx(Fte,{name:ve.name,value:dt[ve.name]??"",onCommit:kt=>qr(ve.name,kt)},`${Ee}:${ve.name}`)})})]}),o.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>I(ve=>!ve),"aria-label":e("sandbox.preview.choosePage"),"aria-expanded":E,children:o.jsx(ds,{size:12,className:le("shrink-0 text-muted-foreground transition-transform",E&&"rotate-180")})})]}),E&&o.jsxs("div",{className:"absolute left-1/2 top-full z-50 mt-1.5 w-[500px] max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[o.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[o.jsx(r0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("input",{type:"text",value:D,onChange:ve=>O(ve.target.value),onKeyDown:ve=>{if(ve.key!=="Enter")return;const Re=D.trim();if(!Re)return;const bt=tt.find(kt=>st(kt.path)===st(Re));bt&&(ve.preventDefault(),I(!1),O(""),Gr(bt))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),o.jsx("div",{className:"p-1.5 border-b",children:o.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ve=>{ve.preventDefault(),I(!1),O(""),B(void 0),z(!0)},children:[o.jsx(Qt,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),tt.length===0&&ft.length===0&&mt.length===0?o.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Oe.length===0&&Vt.length===0&&Lt.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):o.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[tt.length>0&&o.jsx("div",{className:"p-1.5",children:tt.map(ve=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Re=>{Re.preventDefault(),I(!1),O(""),Gr(ve)},children:[o.jsx(zi,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.path})]},ve.key))}),ft.length>0&&o.jsxs("div",{className:le("p-1.5",tt.length>0&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),ft.map(ve=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Re=>{Re.preventDefault(),I(!1),O(""),yo(ve)},children:[o.jsx(Ki,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ve.key))]}),mt.length>0&&o.jsxs("div",{className:le("p-1.5",(tt.length>0||ft.length>0)&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalLoaders")}),mt.map(ve=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Re=>{Re.preventDefault(),I(!1),O(""),n1(ve)},children:[o.jsx(Ia,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.title}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ve.key))]})]})]})]}):o.jsx("span",{className:"min-w-0 truncate px-2 text-[13px] text-muted-foreground",children:Si}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Io,{"aria-label":e(_i),onClick:()=>{fo()},children:o.jsx(fn,{size:16})})}),o.jsx(We,{side:"bottom",children:e(_i)})]})]}):null,ji=_r?o.jsx("div",{className:"flex min-w-0 items-center gap-0.5",children:_r}):null,wo=Ze.mode==="sandbox",Lr=Loe[g],wr=g==="desktop"&&(C.width===0||C.width>=Lr.width+2*lv),Ci=wr?1:Math.min(C.width>0?C.width/(Lr.width+2*lv):1,1),So=wr?{width:"100%",height:"100%"}:{width:`${Lr.width}px`,height:C.height>0?`${C.height/Ci}px`:`${Lr.height}px`,transform:`scale(${Ci})`,transformOrigin:"top center"},wd=wt?o.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:o.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[wo&&o.jsxs(o.Fragment,{children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Io,{onClick:xo,"aria-pressed":Ps==="visual","aria-label":e("sandbox.preview.visualEditor"),active:Ps==="visual",className:"rounded-full",children:o.jsx(Kx,{size:16})})}),o.jsx(We,{side:"top",children:e("sandbox.preview.visualEditor")})]}),o.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Io,{onClick:vo,"aria-label":e(cv[g]),className:"rounded-full",children:o.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[g==="mobile"&&o.jsx(GT,{size:16}),g==="tablet"&&o.jsx(YT,{size:16}),g==="desktop"&&o.jsx(QT,{size:16})]},g)})}),o.jsx(We,{side:"top",children:e(cv[g])})]})]})}):null,ko=!!K&&Ps==="blocks";return o.jsxs("div",{className:"flex flex-col w-full h-full",children:[ct&&Object.entries(ut).map(([ve,Re])=>(dt[ve]??"")===""?o.jsx(Bte,{sources:Re,template:X,paramName:ve,sandboxRef:ct,onFill:bt=>qr(ve,bt)},`${Ee}:${ve}`):null),r?ji&&o.jsx(LZ,{children:ji}):_r&&o.jsxs("div",{className:"@container/panel-header relative flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3 md:px-4",children:[o.jsx("div",{className:"flex-1"}),o.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:_r}),o.jsx("div",{className:"flex-1"})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:ko?o.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[o.jsx(ov,{virtualMcpId:t,externalSelection:_,onViewJsonFile:V}),S&&Ee&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(av,{ref:j,virtualMcpId:t,pageKey:Ee,onClose:N})})]}):o.jsxs(ep,{orientation:"horizontal",disabled:Ps!=="blocks",children:[o.jsx(Pc,{ref:w,id:"preview-blocks-editor",defaultSize:Ps==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Ps==="blocks"&&o.jsx(ov,{virtualMcpId:t,externalSelection:_,onViewJsonFile:V})}),Ps==="blocks"&&o.jsx(tp,{withHandle:!0}),o.jsx(Pc,{id:"preview-canvas",defaultSize:Ps==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:o.jsxs(ep,{orientation:"horizontal",disabled:!(S&&Ee),children:[S&&Ee&&o.jsxs(o.Fragment,{children:[o.jsx(Pc,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:o.jsx(av,{ref:j,virtualMcpId:t,pageKey:Ee,onClose:N})}),o.jsx(tp,{withHandle:!0})]}),o.jsx(Pc,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:o.jsxs("div",{ref:ve=>{if(!ve)return;const Re=()=>T(kt=>kt.width===ve.clientWidth&&kt.height===ve.clientHeight?kt:{width:ve.clientWidth,height:ve.clientHeight});Re();const bt=new ResizeObserver(Re);return bt.observe(ve),()=>bt.disconnect()},className:le("h-full relative overflow-clip flex justify-center",wt&&!wr&&"bg-muted/30"),children:[(ce||Me)&&wt&&o.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:o.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),Ze.showBlockingOverlay&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(zc,{kind:"starting",progress:ze,claimPhase:Se})}),ot.kind==="suspended"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(zc,{kind:"suspended",onResume:ie.resume})}),ot.kind==="errored"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(zc,{kind:"errored",error:ot.error,onRetry:ie.retry,connectionsHref:`/${ae.slug}/settings/connections`})}),Ze.showWakingPill&&o.jsxs("div",{className:"absolute top-4 left-1/2 z-20 flex max-w-md -translate-x-1/2 items-start gap-3 rounded-xl border border-border bg-muted px-4 py-3 shadow-lg pointer-events-none select-none",children:[o.jsx(nt,{className:"size-4.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),Ps==="visual"&&!b&&o.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[o.jsx(Kx,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Ps==="visual"&&b&&o.jsx(Uee,{element:b,onDismiss:()=>v(null)}),wd,wt&&Gs&&o.jsx("div",{className:le("shrink-0",!wr&&"border-x border-border bg-background shadow-sm"),style:So,children:o.jsx("iframe",{ref:y,src:Gs,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:vr.handleError,onLoad:()=>{if(vr.handleLoad(),de(),Ze.mode!=="sandbox"){Ze.mode==="production"&&!Ze.showWakingPill&&Ps==="blocks"&&Kr();return}if(Ye("vm_preview_loaded",{view_mode:Ps,vm_id:Y?.sandboxHandle??null}),!H)try{const ve=y.current?.contentWindow?.location?.pathname;if(!ve)return;const Re=Ie.current;if(Re!==null&&(Ie.current=null,st(ve)!==st(Re))||st(ve)===st(ht))return;Z(ve),xr({path:ve,pageKey:ee,params:dt})}catch{}Ps==="visual"&&fa(),Ps==="blocks"&&Kr()}},Ze.iframeBase)})]})})]})})]})}),o.jsx(Yte,{open:M,onOpenChange:z,isPending:Ge.isPending,error:F,templates:Oe,onSubmit:_o})]})}function Coe(t){const e=U.c(22),{virtualMcpId:s}=t,n=ue(),r=Vs(s),{activeTask:i,taskId:a,currentBranch:l}=an(),c=W_(a),[d,h]=P.useState(!1);if(q_({threadId:a,sandboxBranch:i?.branch??l,agentHasRepo:xn(r?.metadata),threadHasRepo:xn(c)||xn(i?.metadata)})==="none"){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(Ir,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>h(!0),b=o.jsx(Ir,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let v;e[7]!==n?(v=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=v):v=e[8];let _;e[9]!==v?(_=o.jsxs(me,{onClick:x,children:[b,v]}),e[9]=v,e[10]=_):_=e[10];let L;e[11]!==p||e[12]!==g||e[13]!==_?(L=o.jsx(Dr,{className:"h-full",image:m,title:p,description:g,actions:_}),e[11]=p,e[12]=g,e[13]=_,e[14]=L):L=e[14];let y;e[15]!==d?(y=o.jsx(i0,{open:d,onOpenChange:h,mode:"agent"}),e[15]=d,e[16]=y):y=e[16];let w;return e[17]!==L||e[18]!==y?(w=o.jsxs(o.Fragment,{children:[L,y]}),e[17]=L,e[18]=y,e[19]=w):w=e[19],w}let f;return e[20]!==s?(f=o.jsx(joe,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}function Noe(t){const e=U.c(14),{orgSlug:s,virtualMcpId:n,branch:r,threadId:i,enabled:a}=t,l=a===void 0?!0:a;let c;e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==n?(c=at.sandboxRepoDir(s,n,r,i),e[0]=r,e[1]=s,e[2]=i,e[3]=n,e[4]=c):c=e[4];let d;e[5]!==r||e[6]!==s||e[7]!==i||e[8]!==n?(d=async()=>{const f=to({orgSlug:s,virtualMcpId:n,branch:r,threadId:i},"config"),m=await fetch(f);return m.ok?(await m.json()).repoDir??null:null},e[5]=r,e[6]=s,e[7]=i,e[8]=n,e[9]=d):d=e[9];let h;return e[10]!==l||e[11]!==c||e[12]!==d?(h={queryKey:c,queryFn:d,enabled:l,staleTime:1/0},e[10]=l,e[11]=c,e[12]=d,e[13]=h):h=e[13],Zt(h).data??null}const Voe=P.lazy(()=>Ks(()=>import("./file-explorer-i9mvkKr3.js"),__vite__mapDeps([168,1,2,30,31,32,33,34,35,36,37,38,39,40,25,29,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,98,101,92,102,103,104,105,106,107,108,109,110,74,149,147,96,142,115,81,82,83,84,85,86,87,88,89,90,91,93,94,95,97,99,100,111,112,113,114,78,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,143,144,145,146,148,150,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.FileExplorer})));function Toe(t){const e=U.c(26),{openPath:s}=t,n=ue(),r=lo(),{org:i}=Fe(),{currentBranch:a,taskId:l}=an(),c=r?.entity?.id??null,d=ad(),h=ca(),u=mr();h.vmEntry,u.lifecycle.phase;const f=d,m=c??"",p=a??"",g=l??null,x=f;let b;e[0]!==i.slug||e[1]!==m||e[2]!==p||e[3]!==g||e[4]!==x?(b={orgSlug:i.slug,virtualMcpId:m,branch:p,threadId:g,enabled:x},e[0]=i.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x,e[5]=b):b=e[5],Noe(b);const v=null;if(!c||!a){let k;e[6]!==n?(k=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[6]=n,e[7]=k):k=e[7];let j;e[8]!==n?(j=n("mainPanelTabs.codeTab.noSandboxToBrowseDescription"),e[8]=n,e[9]=j):j=e[9];let N;return e[10]!==k||e[11]!==j?(N=o.jsx(Dr,{className:"h-full",title:k,description:j}),e[10]=k,e[11]=j,e[12]=N):N=e[12],N}let _;e[13]!==v||e[14]!==n?(_=v,e[13]=v,e[14]=n,e[15]=_):_=e[15];let L;e[16]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(nt,{className:"size-5 text-muted-foreground"})}),e[16]=L):L=e[16];const y=l??null;let w;e[17]!==a||e[18]!==s||e[19]!==i.slug||e[20]!==y||e[21]!==c?(w=o.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:o.jsx(P.Suspense,{fallback:L,children:o.jsx(Voe,{orgSlug:i.slug,virtualMcpId:c,branch:a,threadId:y,openPath:s})})}),e[17]=a,e[18]=s,e[19]=i.slug,e[20]=y,e[21]=c,e[22]=w):w=e[22];let S;return e[23]!==_||e[24]!==w?(S=o.jsxs("div",{className:"flex flex-col w-full h-full",children:[_,w]}),e[23]=_,e[24]=w,e[25]=S):S=e[25],S}function Poe(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([n])=>!e.includes(n)));return Object.keys(s).length>0?{...t,properties:s}:t}function Aoe(t,e,s){return typeof t!="string"?null:Poe($n(t,e),s)}function rj(t,e,s){if(!e||typeof t!="string")return!1;const n=Aoe(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function Eoe({orgSlug:t,virtualMcpId:e,branch:s}){const n=Ns(),r=ws()?.taskId??null,i=L0(e),a=_n(e).runtime==="cms";return Rs({mutationKey:Dg(t,e,s),mutationFn:async({blockKey:l})=>{if(a){const h=await m_({orgSlug:t,virtualMcpId:e,branch:s},{delete:[l]});return Ig(n,{orgSlug:t,virtualMcpId:e,branch:s},h),await n.invalidateQueries({queryKey:y0({orgSlug:t,virtualMcpId:e,branch:s,threadId:r})}),{ok:!0,existed:!0}}const c=_0(i,z8(l)),d=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:c})});return d.ok?d.json():L9(d,"Delete")},onMutate:async({blockKey:l})=>{const c=`${t}/${e}/${s}`,d=at.decofile(c);await n.cancelQueries({queryKey:d});const h=n.getQueryData(d),u=!!h&&l in h,f=h?.[l];return n.setQueryData(d,m=>{if(!m)return m;const{[l]:p,...g}=m;return g}),{queryKey:d,blockKey:l,hadKey:u,previousValue:f}},onError:(l,c,d)=>{d&&n.setQueryData(d.queryKey,h=>d.hadKey?{...h??{},[d.blockKey]:d.previousValue}:h)},onSuccess:()=>{n.invalidateQueries({queryKey:at.liveMeta(t,e,s)})}})}function wc(t){const e=U.c(6),{hasItems:s,emptyLabel:n,emptyHint:r}=t;let i;e[0]!==r||e[1]!==n||e[2]!==s?(i=s?"No results match your search.":o.jsxs(o.Fragment,{children:[o.jsx("div",{children:n}),o.jsx("div",{className:"mt-1 text-muted-foreground/80",children:r})]}),e[0]=r,e[1]=n,e[2]=s,e[3]=i):i=e[3];let a;return e[4]!==i?(a=o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=a):a=e[5],a}function Q9(t,e){return`${t}-${e}`}function ij(t,e){return`site/apps/${t}/${e}.ts`}function oj(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function Roe(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function Doe(t){return t==="local"?"Custom":"Installed"}function aj(t,e,s){const n=new Set([Q9(t,e),e].map(i=>i.toLowerCase())),r=ij(t,e);for(const[i,a]of Object.entries(s)){if(i.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=a;if(n.has(i.toLowerCase())||l.__resolveType===r)return i}return null}function Moe(t,e){const s=t.vendor.alias,n=t.name,r=aj(s,n,e);return{id:Q9(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:ij(s,n),blockKey:r,installed:r!==null}}function Ioe(t,e,s){if(t===$3)return null;const n=oj(t);if(!n)return null;const{vendor:r,app:i}=n,a=aj(r,i,s),l=ua(t,e);return{id:Q9(r,i),app:i,vendor:r,title:l.title??i,description:l.description??"",category:"Others",logo:l.logo??l.icon,resolveType:t,blockKey:a,installed:a!==null}}function Ooe(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Jc(t,e)||!pS(n))return null;const r=oj(n)??Roe(t);if(!r)return null;const i=ua(n,s),{vendor:a,app:l}=r;return{id:Q9(a,l),app:l,vendor:a,title:i.title??vf(t,e,s),description:i.description??"",category:Doe(a),logo:i.logo??i.icon,resolveType:n,blockKey:t,installed:!0}}function $oe(t,e,s){const n=new Map;for(const i of t){const a=Moe(i,s);n.set(a.id,a)}const r=e.manifest?.blocks?.apps??{};for(const i of Object.keys(r)){const a=Ioe(i,e,s);!a||n.has(a.id)||n.set(a.id,a)}for(const[i,a]of Object.entries(s)){if(i.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=Ooe(i,a,e);!l||n.has(l.id)||n.set(l.id,l)}return[...n.values()].sort(Boe)}function Boe(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function zoe(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function Foe(t,e,s){const n=U.c(12),r=s?.enabled??!0;let i;n[0]===Symbol.for("react.memo_cache_sentinel")?(i=at.decoApps(),n[0]=i):i=n[0];let a;n[1]!==r?(a={queryKey:i,queryFn:zoe,staleTime:3e5,retry:1,enabled:r},n[1]=r,n[2]=a):a=n[2];const l=Zt(a);let c;n[3]!==e||n[4]!==t||n[5]!==l.data?(c=t&&e?$oe(l.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=l.data,n[6]=c):c=n[6];const d=c,h=l.isLoading&&!l.isError;let u;return n[7]!==d||n[8]!==l.isError||n[9]!==l.refetch||n[10]!==h?(u={catalog:d,isLoading:h,isError:l.isError,refetch:l.refetch},n[7]=d,n[8]=l.isError,n[9]=l.refetch,n[10]=h,n[11]=u):u=n[11],u}function Uoe(t){const e=U.c(86),{active:s,counts:n,showBlog:r,onSelect:i}=t,a=ue();let l;e[0]!==a?(l=a("sandbox.collectionsSidebar.content"),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==l?(c=o.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:o.jsx("span",{className:"text-sm font-medium",children:l})}),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==a?(d=a("sandbox.collectionsSidebar.pages"),e[4]=a,e[5]=d):d=e[5];const h=s==="pages";let u;e[6]!==n.pages||e[7]!==i||e[8]!==d||e[9]!==h?(u=o.jsx(Bn,{id:"pages",icon:zi,label:d,count:n.pages,active:h,onSelect:i}),e[6]=n.pages,e[7]=i,e[8]=d,e[9]=h,e[10]=u):u=e[10];let f;e[11]!==a?(f=a("sandbox.collectionsSidebar.sections"),e[11]=a,e[12]=f):f=e[12];const m=s==="sections";let p;e[13]!==n.sections||e[14]!==i||e[15]!==f||e[16]!==m?(p=o.jsx(Bn,{id:"sections",icon:Ki,label:f,count:n.sections,active:m,onSelect:i}),e[13]=n.sections,e[14]=i,e[15]=f,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==a?(g=a("sandbox.collectionsSidebar.apps"),e[18]=a,e[19]=g):g=e[19];const x=s==="apps";let b;e[20]!==n.apps||e[21]!==i||e[22]!==x||e[23]!==g?(b=o.jsx(Bn,{id:"apps",icon:f8,label:g,count:n.apps,active:x,onSelect:i}),e[20]=n.apps,e[21]=i,e[22]=x,e[23]=g,e[24]=b):b=e[24];let v;e[25]!==a?(v=a("sandbox.collectionsSidebar.redirects"),e[25]=a,e[26]=v):v=e[26];const _=s==="redirects";let L;e[27]!==n.redirects||e[28]!==i||e[29]!==v||e[30]!==_?(L=o.jsx(Bn,{id:"redirects",icon:e8,label:v,count:n.redirects,active:_,onSelect:i}),e[27]=n.redirects,e[28]=i,e[29]=v,e[30]=_,e[31]=L):L=e[31];let y;e[32]!==a?(y=a("sandbox.collectionsSidebar.loaders"),e[32]=a,e[33]=y):y=e[33];const w=s==="loaders";let S;e[34]!==n.loaders||e[35]!==i||e[36]!==y||e[37]!==w?(S=o.jsx(Bn,{id:"loaders",icon:Ia,label:y,count:n.loaders,active:w,onSelect:i}),e[34]=n.loaders,e[35]=i,e[36]=y,e[37]=w,e[38]=S):S=e[38];let k;e[39]!==a?(k=a("sandbox.collectionsSidebar.actions"),e[39]=a,e[40]=k):k=e[40];const j=s==="actions";let N;e[41]!==n.actions||e[42]!==i||e[43]!==k||e[44]!==j?(N=o.jsx(Bn,{id:"actions",icon:hi,label:k,count:n.actions,active:j,onSelect:i}),e[41]=n.actions,e[42]=i,e[43]=k,e[44]=j,e[45]=N):N=e[45];let V;e[46]!==a?(V=a("sandbox.collectionsSidebar.site"),e[46]=a,e[47]=V):V=e[47];const C=s==="site";let T;e[48]!==i||e[49]!==V||e[50]!==C?(T=o.jsx(Bn,{id:"site",icon:$6,label:V,active:C,onSelect:i}),e[48]=i,e[49]=V,e[50]=C,e[51]=T):T=e[51];let A;e[52]!==a?(A=a("sandbox.collectionsSidebar.seo"),e[52]=a,e[53]=A):A=e[53];const R=s==="seo";let E;e[54]!==i||e[55]!==A||e[56]!==R?(E=o.jsx(Bn,{id:"seo",icon:t8,label:A,active:R,onSelect:i}),e[54]=i,e[55]=A,e[56]=R,e[57]=E):E=e[57];let I;e[58]!==a?(I=a("sandbox.collectionsSidebar.calendar"),e[58]=a,e[59]=I):I=e[59];const D=s==="calendar";let O;e[60]!==i||e[61]!==I||e[62]!==D?(O=o.jsx(Bn,{id:"calendar",icon:id,label:I,active:D,onSelect:i}),e[60]=i,e[61]=I,e[62]=D,e[63]=O):O=e[63];let $;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==i||e[69]!==r||e[70]!==a?($=r&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[o.jsx(Hc,{size:13,className:"shrink-0"}),a("sandbox.collectionsSidebar.blog")]}),o.jsx(Bn,{id:"posts",icon:Mr,label:a("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:i}),o.jsx(Bn,{id:"authors",icon:g9,label:a("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:i}),o.jsx(Bn,{id:"categories",icon:G2,label:a("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:i}),o.jsx(Bn,{id:"post-schedule",icon:XT,label:a("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:i})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=i,e[69]=r,e[70]=a,e[71]=$):$=e[71];let M;e[72]!==b||e[73]!==L||e[74]!==S||e[75]!==N||e[76]!==T||e[77]!==E||e[78]!==O||e[79]!==$||e[80]!==u||e[81]!==p?(M=o.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[u,p,b,L,S,N,T,E,O,$]}),e[72]=b,e[73]=L,e[74]=S,e[75]=N,e[76]=T,e[77]=E,e[78]=O,e[79]=$,e[80]=u,e[81]=p,e[82]=M):M=e[82];let z;return e[83]!==c||e[84]!==M?(z=o.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,M]}),e[83]=c,e[84]=M,e[85]=z):z=e[85],z}function Bn(t){const e=U.c(18),{id:s,icon:n,label:r,count:i,active:a,onSelect:l}=t;let c;e[0]!==s||e[1]!==l?(c=()=>l(s),e[0]=s,e[1]=l,e[2]=c):c=e[2];const d=a?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let h;e[3]!==d?(h=le("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",d),e[3]=d,e[4]=h):h=e[4];let u;e[5]!==n?(u=o.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=u):u=e[6];let f;e[7]!==r?(f=o.jsx("span",{className:"flex-1 truncate",children:r}),e[7]=r,e[8]=f):f=e[8];let m;e[9]!==a||e[10]!==i?(m=i!==void 0&&o.jsx("span",{className:le("shrink-0 text-xs tabular-nums",a?"text-accent-foreground/70":"text-muted-foreground/70"),children:i}),e[9]=a,e[10]=i,e[11]=m):m=e[11];let p;return e[12]!==c||e[13]!==h||e[14]!==u||e[15]!==f||e[16]!==m?(p=o.jsxs("button",{type:"button",onClick:c,className:h,children:[u,f,m]}),e[12]=c,e[13]=h,e[14]=u,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function Hoe(t){const e=U.c(12),{state:s,claimPhase:n,lifecycle:r,onStart:i,connectionsHref:a}=t;switch(s.kind){case"starting":{let l;e[0]!==n||e[1]!==r?(l=WS({claimPhase:n,lifecycle:r}),e[0]=n,e[1]=r,e[2]=l):l=e[2];let c;return e[3]!==n||e[4]!==l?(c=o.jsx(zc,{kind:"starting",progress:l,claimPhase:n}),e[3]=n,e[4]=l,e[5]=c):c=e[5],c}case"suspended":{let l;return e[6]!==i?(l=o.jsx(zc,{kind:"suspended",onResume:i}),e[6]=i,e[7]=l):l=e[7],l}case"errored":{let l;return e[8]!==a||e[9]!==i||e[10]!==s.error?(l=o.jsx(zc,{kind:"errored",error:s.error,onRetry:i,connectionsHref:a}),e[8]=a,e[9]=i,e[10]=s.error,e[11]=l):l=e[11],l}}}const Koe=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Woe(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!Koe.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function uv(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),n=`${s} (copy)`;if(!t.has(n))return n;for(let r=2;r<1e3;r++){const i=`${s} (copy ${r})`;if(!t.has(i))return i}return`${s} (copy ${Date.now()})`}function qoe(t,e){const s=Fo,n=e.replace(/-copy(?:-\d+)?$/,""),r=`${n}-copy`;if(!t.has(s(r)))return r;for(let i=2;i<1e3;i++){const a=`${n}-copy-${i}`;if(!t.has(s(a)))return a}return`${n}-copy-${Date.now()}`}function Goe(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),n=`${s}_copy`;if(!Object.hasOwn(t,n))return n;for(let r=2;r<1e3;r++){const i=`${s}_copy_${r}`;if(!Object.hasOwn(t,i))return i}return`${s}_copy_${Date.now()}`}function Yoe(t){const e=q3(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function Qoe(t,e){return JS(t,e)}const Xoe=1e3;function Joe(t,e){for(let s=0;s<Xoe;s++){const n=q3(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const Zoe={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},eae={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},tae={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function sae(t){const e=U.c(88),{open:s,mode:n,initialName:r,initialPath:i,isPending:a,error:l,templates:c,validate:d,onSubmit:h,onOpenChange:u}=t,f=a===void 0?!1:a,m=ue(),[p,g]=P.useState(r),[x,b]=P.useState(i),[v,_]=P.useState(Uo),[L,y]=P.useState(null),[w,S]=P.useState(s);s!==w&&(S(s),s&&(g(r),b(i),_(Uo),y(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==u?(j=de=>{!de&&!f&&(y(null),u(!1))},e[0]=f,e[1]=u,e[2]=j):j=e[2];const N=j;let V;e[3]!==f||e[4]!==p||e[5]!==h||e[6]!==x||e[7]!==k||e[8]!==v||e[9]!==d?(V=async de=>{de.preventDefault();const ae=p.trim(),re=x.trim();if(!ae||!re||f)return;const ie=F9(re);if(ie){y(ie);return}const Y=d?.({name:ae,path:re});if(Y){y(Y);return}y(null),await h({name:ae,path:re,templateKey:k&&v!==Uo?v:null})},e[3]=f,e[4]=p,e[5]=h,e[6]=x,e[7]=k,e[8]=v,e[9]=d,e[10]=V):V=e[10];const C=V,T=L??l,A=Zoe[n];let R;e[11]!==m||e[12]!==A?(R=m(A),e[11]=m,e[12]=A,e[13]=R):R=e[13];let E;e[14]!==R?(E=o.jsx(ls,{children:o.jsx(qt,{children:R})}),e[14]=R,e[15]=E):E=e[15];let I;e[16]!==f||e[17]!==k||e[18]!==m||e[19]!==v||e[20]!==c?(I=k&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:m("sandbox.pageFormDialog.labelTemplate")}),o.jsx(ZS,{id:"page-form-template",value:v,onChange:_,templates:c??[],disabled:f})]}),e[16]=f,e[17]=k,e[18]=m,e[19]=v,e[20]=c,e[21]=I):I=e[21];let D;e[22]!==m?(D=m("sandbox.pageFormDialog.labelName"),e[22]=m,e[23]=D):D=e[23];let O;e[24]!==D?(O=o.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:D}),e[24]=D,e[25]=O):O=e[25];let $;e[26]===Symbol.for("react.memo_cache_sentinel")?($=de=>g(de.target.value),e[26]=$):$=e[26];let M;e[27]!==m?(M=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=M):M=e[28];let z;e[29]!==f||e[30]!==p||e[31]!==M?(z=o.jsx(yt,{id:"page-form-name",value:p,onChange:$,placeholder:M,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=M,e[32]=z):z=e[32];let F;e[33]!==z||e[34]!==O?(F=o.jsxs("div",{className:"space-y-1.5",children:[O,z]}),e[33]=z,e[34]=O,e[35]=F):F=e[35];let B;e[36]!==m?(B=m("sandbox.pageFormDialog.labelPath"),e[36]=m,e[37]=B):B=e[37];let H;e[38]!==B?(H=o.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:B}),e[38]=B,e[39]=H):H=e[39];let W;e[40]===Symbol.for("react.memo_cache_sentinel")?(W=de=>b(de.target.value),e[40]=W):W=e[40];let K;e[41]!==m?(K=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=K):K=e[42];let q;e[43]!==f||e[44]!==x||e[45]!==K?(q=o.jsx(yt,{id:"page-form-path",value:x,onChange:W,placeholder:K,disabled:f}),e[43]=f,e[44]=x,e[45]=K,e[46]=q):q=e[46];let G;e[47]!==H||e[48]!==q?(G=o.jsxs("div",{className:"space-y-1.5",children:[H,q]}),e[47]=H,e[48]=q,e[49]=G):G=e[49];let te;e[50]!==T?(te=T&&o.jsx("p",{className:"text-xs text-destructive",children:T}),e[50]=T,e[51]=te):te=e[51];let X;e[52]!==F||e[53]!==G||e[54]!==te||e[55]!==I?(X=o.jsxs("div",{className:"space-y-4 py-4",children:[I,F,G,te]}),e[52]=F,e[53]=G,e[54]=te,e[55]=I,e[56]=X):X=e[56];let Z;e[57]!==u?(Z=()=>u(!1),e[57]=u,e[58]=Z):Z=e[58];let ee;e[59]!==m?(ee=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=ee):ee=e[60];let se;e[61]!==f||e[62]!==Z||e[63]!==ee?(se=o.jsx(me,{type:"button",variant:"outline",onClick:Z,disabled:f,children:ee}),e[61]=f,e[62]=Z,e[63]=ee,e[64]=se):se=e[64];let J;e[65]!==f||e[66]!==p||e[67]!==x?(J=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=J):J=e[68];let oe;e[69]!==f||e[70]!==n||e[71]!==m?(oe=f?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),m(tae[n])]}):m(eae[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=oe):oe=e[72];let ce;e[73]!==J||e[74]!==oe?(ce=o.jsx(me,{type:"submit",disabled:J,children:oe}),e[73]=J,e[74]=oe,e[75]=ce):ce=e[75];let he;e[76]!==se||e[77]!==ce?(he=o.jsxs(Yn,{children:[se,ce]}),e[76]=se,e[77]=ce,e[78]=he):he=e[78];let ne;e[79]!==C||e[80]!==X||e[81]!==he||e[82]!==E?(ne=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:C,children:[E,X,he]})}),e[79]=C,e[80]=X,e[81]=he,e[82]=E,e[83]=ne):ne=e[83];let Q;return e[84]!==N||e[85]!==s||e[86]!==ne?(Q=o.jsx(zt,{open:s,onOpenChange:N,children:ne}),e[84]=N,e[85]=s,e[86]=ne,e[87]=Q):Q=e[87],Q}const nae=[{value:"temporary",labelKey:"sandbox.redirectEditor.typeTemporary"},{value:"permanent",labelKey:"sandbox.redirectEditor.typePermanent"}],hv={from:"",to:"",type:"temporary",discardQueryParameters:!1};function rae(t){const e=U.c(111),{open:s,isPending:n,error:r,onSubmit:i,onOpenChange:a}=t,l=n===void 0?!1:n,c=ue(),[d,h]=P.useState(hv),[u,f]=P.useState(null),[m,p]=P.useState(s);s!==m&&(p(s),s&&(h(hv),f(null)));let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=ke=>h(Ve=>({...Ve,...ke})),e[0]=g):g=e[0];const x=g;let b;e[1]!==l||e[2]!==a?(b=ke=>{!ke&&!l&&(f(null),a(!1))},e[1]=l,e[2]=a,e[3]=b):b=e[3];const v=b;let _;e[4]!==l||e[5]!==i||e[6]!==d||e[7]!==c?(_=async ke=>{ke.preventDefault();const Ve=d.from.trim(),Pe=d.to.trim();if(!Ve||!Pe||l){f(c("sandbox.redirectFormDialog.errorRequired"));return}f(null),await i({...d,from:Ve,to:Pe})},e[4]=l,e[5]=i,e[6]=d,e[7]=c,e[8]=_):_=e[8];const L=_,y=u??r;let w;e[9]!==l||e[10]!==d.from||e[11]!==d.to?(w=!!d.from.trim()&&!!d.to.trim()&&!l,e[9]=l,e[10]=d.from,e[11]=d.to,e[12]=w):w=e[12];const S=w;let k;e[13]!==c?(k=c("sandbox.redirectFormDialog.title"),e[13]=c,e[14]=k):k=e[14];let j;e[15]!==k?(j=o.jsx(ls,{children:o.jsx(qt,{children:k})}),e[15]=k,e[16]=j):j=e[16];let N;e[17]!==c?(N=c("sandbox.redirectEditor.fromLabel"),e[17]=c,e[18]=N):N=e[18];let V;e[19]!==N?(V=o.jsx(At,{htmlFor:"redirect-form-from",children:N}),e[19]=N,e[20]=V):V=e[20];const C=d.from;let T;e[21]===Symbol.for("react.memo_cache_sentinel")?(T=ke=>x({from:ke.target.value}),e[21]=T):T=e[21];let A;e[22]!==c?(A=c("sandbox.redirectEditor.fromPlaceholder"),e[22]=c,e[23]=A):A=e[23];let R;e[24]!==l||e[25]!==d.from||e[26]!==A?(R=o.jsx(yt,{id:"redirect-form-from",value:C,onChange:T,placeholder:A,autoFocus:!0,disabled:l}),e[24]=l,e[25]=d.from,e[26]=A,e[27]=R):R=e[27];let E;e[28]!==R||e[29]!==V?(E=o.jsxs("div",{className:"space-y-1.5",children:[V,R]}),e[28]=R,e[29]=V,e[30]=E):E=e[30];let I;e[31]!==c?(I=c("sandbox.redirectEditor.toLabel"),e[31]=c,e[32]=I):I=e[32];let D;e[33]!==I?(D=o.jsx(At,{htmlFor:"redirect-form-to",children:I}),e[33]=I,e[34]=D):D=e[34];const O=d.to;let $;e[35]===Symbol.for("react.memo_cache_sentinel")?($=ke=>x({to:ke.target.value}),e[35]=$):$=e[35];let M;e[36]!==c?(M=c("sandbox.redirectEditor.toPlaceholder"),e[36]=c,e[37]=M):M=e[37];let z;e[38]!==l||e[39]!==d.to||e[40]!==M?(z=o.jsx(yt,{id:"redirect-form-to",value:O,onChange:$,placeholder:M,disabled:l}),e[38]=l,e[39]=d.to,e[40]=M,e[41]=z):z=e[41];let F;e[42]!==D||e[43]!==z?(F=o.jsxs("div",{className:"space-y-1.5",children:[D,z]}),e[42]=D,e[43]=z,e[44]=F):F=e[44];let B;e[45]!==c?(B=c("sandbox.redirectEditor.typeLabel"),e[45]=c,e[46]=B):B=e[46];let H;e[47]!==B?(H=o.jsx(At,{htmlFor:"redirect-form-type",children:B}),e[47]=B,e[48]=H):H=e[48];const W=d.type;let K;e[49]===Symbol.for("react.memo_cache_sentinel")?(K=ke=>x({type:ke}),e[49]=K):K=e[49];let q;e[50]!==c?(q=c("sandbox.redirectEditor.typePlaceholder"),e[50]=c,e[51]=q):q=e[51];let G;e[52]!==q?(G=o.jsx(bs,{id:"redirect-form-type",className:"w-full",children:o.jsx(js,{placeholder:q})}),e[52]=q,e[53]=G):G=e[53];let te;e[54]!==c?(te=nae.map(ke=>o.jsx(It,{value:ke.value,children:c(ke.labelKey,{status:SS[ke.value]})},ke.value)),e[54]=c,e[55]=te):te=e[55];let X;e[56]!==te?(X=o.jsx(vs,{children:te}),e[56]=te,e[57]=X):X=e[57];let Z;e[58]!==l||e[59]!==d.type||e[60]!==G||e[61]!==X?(Z=o.jsxs(xs,{value:W,onValueChange:K,disabled:l,children:[G,X]}),e[58]=l,e[59]=d.type,e[60]=G,e[61]=X,e[62]=Z):Z=e[62];let ee;e[63]!==H||e[64]!==Z?(ee=o.jsxs("div",{className:"space-y-1.5",children:[H,Z]}),e[63]=H,e[64]=Z,e[65]=ee):ee=e[65];let se;e[66]===Symbol.for("react.memo_cache_sentinel")?(se=ke=>x({discardQueryParameters:ke===!0}),e[66]=se):se=e[66];let J;e[67]!==l||e[68]!==d.discardQueryParameters?(J=o.jsx(il,{checked:d.discardQueryParameters,disabled:l,onCheckedChange:se}),e[67]=l,e[68]=d.discardQueryParameters,e[69]=J):J=e[69];let oe;e[70]!==c?(oe=c("sandbox.redirectEditor.discardQueryParameters"),e[70]=c,e[71]=oe):oe=e[71];let ce;e[72]!==oe?(ce=o.jsx("span",{className:"text-sm",children:oe}),e[72]=oe,e[73]=ce):ce=e[73];let he;e[74]!==J||e[75]!==ce?(he=o.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5",children:[J,ce]}),e[74]=J,e[75]=ce,e[76]=he):he=e[76];let ne;e[77]!==y?(ne=y&&o.jsx("p",{className:"text-xs text-destructive",children:y}),e[77]=y,e[78]=ne):ne=e[78];let Q;e[79]!==E||e[80]!==F||e[81]!==ee||e[82]!==he||e[83]!==ne?(Q=o.jsxs("div",{className:"space-y-4 py-4",children:[E,F,ee,he,ne]}),e[79]=E,e[80]=F,e[81]=ee,e[82]=he,e[83]=ne,e[84]=Q):Q=e[84];let de;e[85]!==a?(de=()=>a(!1),e[85]=a,e[86]=de):de=e[86];let ae;e[87]!==c?(ae=c("sandbox.redirectFormDialog.cancel"),e[87]=c,e[88]=ae):ae=e[88];let re;e[89]!==l||e[90]!==de||e[91]!==ae?(re=o.jsx(me,{type:"button",variant:"outline",onClick:de,disabled:l,children:ae}),e[89]=l,e[90]=de,e[91]=ae,e[92]=re):re=e[92];const ie=!S;let Y;e[93]!==l||e[94]!==c?(Y=l?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),c("sandbox.redirectFormDialog.pending")]}):c("sandbox.redirectFormDialog.submit"),e[93]=l,e[94]=c,e[95]=Y):Y=e[95];let pe;e[96]!==ie||e[97]!==Y?(pe=o.jsx(me,{type:"submit",disabled:ie,children:Y}),e[96]=ie,e[97]=Y,e[98]=pe):pe=e[98];let be;e[99]!==re||e[100]!==pe?(be=o.jsxs(Yn,{children:[re,pe]}),e[99]=re,e[100]=pe,e[101]=be):be=e[101];let _e;e[102]!==L||e[103]!==Q||e[104]!==be||e[105]!==j?(_e=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:L,children:[j,Q,be]})}),e[102]=L,e[103]=Q,e[104]=be,e[105]=j,e[106]=_e):_e=e[106];let Le;return e[107]!==v||e[108]!==s||e[109]!==_e?(Le=o.jsx(zt,{open:s,onOpenChange:v,children:_e}),e[107]=v,e[108]=s,e[109]=_e,e[110]=Le):Le=e[110],Le}function iae(t){const e=U.c(70),{open:s,blockKey:n,initialName:r,isPending:i,onSubmit:a,onOpenChange:l}=t,c=i===void 0?!1:i,d=ue(),[h,u]=P.useState(r),[f,m]=P.useState(s);s!==f&&(m(s),s&&u(r));let p;e[0]!==c||e[1]!==l?(p=W=>{!W&&!c&&l(!1)},e[0]=c,e[1]=l,e[2]=p):p=e[2];const g=p;let x;e[3]!==c||e[4]!==h||e[5]!==a?(x=async W=>{W.preventDefault();const K=h.trim();!K||c||await a(K)},e[3]=c,e[4]=h,e[5]=a,e[6]=x):x=e[6];const b=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let _;e[9]!==v?(_=o.jsx(qt,{children:v}),e[9]=v,e[10]=_):_=e[10];let L;e[11]!==d?(L=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=L):L=e[12];let y;e[13]!==L?(y=o.jsx(In,{children:L}),e[13]=L,e[14]=y):y=e[14];let w;e[15]!==_||e[16]!==y?(w=o.jsxs(ls,{children:[_,y]}),e[15]=_,e[16]=y,e[17]=w):w=e[17];let S;e[18]!==d?(S=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=S):S=e[19];let k;e[20]!==S?(k=o.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:S}),e[20]=S,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=W=>u(W.target.value),e[22]=j):j=e[22];let N;e[23]!==c||e[24]!==h?(N=o.jsx(yt,{id:"section-rename-name",value:h,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=h,e[25]=N):N=e[25];let V;e[26]!==k||e[27]!==N?(V=o.jsxs("div",{className:"space-y-1.5",children:[k,N]}),e[26]=k,e[27]=N,e[28]=V):V=e[28];let C;e[29]!==d?(C=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=C):C=e[30];let T;e[31]!==C?(T=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:C}),e[31]=C,e[32]=T):T=e[32];let A;e[33]!==n?(A=o.jsx(yt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=A):A=e[34];let R;e[35]!==T||e[36]!==A?(R=o.jsxs("div",{className:"space-y-1.5",children:[T,A]}),e[35]=T,e[36]=A,e[37]=R):R=e[37];let E;e[38]!==V||e[39]!==R?(E=o.jsxs("div",{className:"space-y-4 py-4",children:[V,R]}),e[38]=V,e[39]=R,e[40]=E):E=e[40];let I;e[41]!==l?(I=()=>l(!1),e[41]=l,e[42]=I):I=e[42];let D;e[43]!==d?(D=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=D):D=e[44];let O;e[45]!==c||e[46]!==I||e[47]!==D?(O=o.jsx(me,{type:"button",variant:"outline",onClick:I,disabled:c,children:D}),e[45]=c,e[46]=I,e[47]=D,e[48]=O):O=e[48];let $;e[49]!==c||e[50]!==h?($=!h.trim()||c,e[49]=c,e[50]=h,e[51]=$):$=e[51];let M;e[52]!==c||e[53]!==d?(M=c?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=M):M=e[54];let z;e[55]!==$||e[56]!==M?(z=o.jsx(me,{type:"submit",disabled:$,children:M}),e[55]=$,e[56]=M,e[57]=z):z=e[57];let F;e[58]!==O||e[59]!==z?(F=o.jsxs(Yn,{children:[O,z]}),e[58]=O,e[59]=z,e[60]=F):F=e[60];let B;e[61]!==b||e[62]!==E||e[63]!==F||e[64]!==w?(B=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:b,children:[w,E,F]})}),e[61]=b,e[62]=E,e[63]=F,e[64]=w,e[65]=B):B=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==B?(H=o.jsx(zt,{open:s,onOpenChange:g,children:B}),e[66]=g,e[67]=s,e[68]=B,e[69]=H):H=e[69],H}function oae(t){const e=U.c(7),{type:s}=t,n=SS[s];let r;e[0]!==n?(r=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:n})}),e[0]=n,e[1]=r):r=e[1];const i=s==="permanent"?"Permanent":"Temporary";let a;e[2]!==i?(a=o.jsx(We,{side:"left",children:i}),e[2]=i,e[3]=a):a=e[3];let l;return e[4]!==r||e[5]!==a?(l=o.jsxs(qe,{children:[r,a]}),e[4]=r,e[5]=a,e[6]=l):l=e[6],l}const sm={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},ux=["posts","authors","categories"],mu={posts:"post",authors:"author",categories:"category"};function pu(t){return ux.includes(t)}const hx={posts:"post",authors:"author",categories:"category"},lj={posts:sm.post,authors:sm.author,categories:sm.category},aae=Object.fromEntries(Object.entries(lj).map(([t,e])=>[e,t]));function lae(t){return typeof t=="string"?aae[t]??null:null}function ta(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function os(t){return typeof t=="string"?t:""}function cae(t,e){switch(t){case"posts":return{label:os(e.title)||"Untitled post",subtitle:os(e.slug)};case"authors":return{label:os(e.name)||"Unnamed author",subtitle:os(e.email)};case"categories":return{label:os(e.name)||"Unnamed category",subtitle:os(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function cj(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const r=ta(n);if(!r)continue;const i=lae(r.__resolveType);if(!i)continue;const a=ta(r[hx[i]])??{},{label:l,subtitle:c}=cae(i,a);e[i].push({key:s,kind:i,label:l,subtitle:c})}for(const s of ux)e[s].sort((n,r)=>n.label.localeCompare(r.label));return e}function dae(t,e){return cj(t)[e]}function Ou(t,e){return dae(t,e).map(s=>({key:s.key,payload:Yd(ta(t[s.key])??void 0,e)}))}const fv=Object.freeze({});function Yd(t,e){return t?ta(t[hx[e]])??fv:fv}function Sc(t,e,s){return{name:t,__resolveType:lj[e],[hx[e]]:s}}function e3e({records:t,selected:e,valueField:s,toRef:n}){const r=Array.isArray(e)?e:[],i=f=>typeof f=="string"?f:os(ta(f)?.[s]),a=f=>typeof f=="string"?f:os(ta(f)?.name),l=f=>{const m=i(f),p=m?t.find(({payload:x})=>os(x[s])===m):void 0;if(p)return p;const g=a(f);return g?t.find(({payload:x})=>os(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:os(m.name)||os(m[s])||f})),d=new Map,h=[];return r.forEach((f,m)=>{const p=l(f);if(p){h.includes(p.key)||h.push(p.key);return}const g=`unresolved:${m}`;d.set(g,f),h.push(g),c.push({value:g,label:a(f)||i(f)||"Unknown"})}),{options:c,selectedValues:h,refsForValues:f=>f.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function Ya(t){return Array.isArray(t)?t:[]}function Ui(t){if(typeof t=="string")return t;const e=ta(t);return e?os(e.slug):""}function uae(t){if(typeof t=="string")return t;const e=ta(t);return e?os(e.email):""}function dj(t){const e=[];return os(t.title).trim()||e.push("Title"),os(t.slug).trim()||e.push("Slug"),Ya(t.categories).map(Ui).filter(Boolean).length===0&&e.push("Category"),os(t.excerpt).trim()||e.push("Excerpt"),os(t.image).trim()||e.push("Cover image"),e}const uj=8;function hj(t){const e=os(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function t3e(t,e){return e!=="published"||hj(t)==="published"?!1:dj(t).length>0}function hae(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,uj).toISOString()}function s3e(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=os(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?hae(s):n}}function fj(t){return Ou(t,"posts").map(({key:e,payload:s})=>({key:e,title:os(s.title)||"Untitled post",slug:os(s.slug),date:os(s.date),scheduledDatetime:os(s.scheduledDatetime),categorySlugs:Ya(s.categories).map(Ui).filter(Boolean),authorEmails:Ya(s.authors).map(uae).filter(Boolean),missing:dj(s),status:hj(s)}))}function fae(t,e){const s=Ya(t.categories);return s.some(n=>Ui(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function mae(t,e){const s=Ya(t.categories);return s.length===1&&Ui(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function n3e(t,e,s){const n=Ya(t.categories);if(!n.some(l=>Ui(l)===e))return t;const r=n.map(l=>{const c=Ui(l);return c===e||c===s.slug?{name:s.name,slug:s.slug}:l}),i=new Set,a=r.filter(l=>{const c=Ui(l);return c?i.has(c)?!1:(i.add(c),!0):!0});return{...t,categories:a}}function pae(t,e){const s=Ya(t.categories);return s.some(n=>Ui(n)===e)?{...t,categories:s.filter(n=>Ui(n)!==e)}:t}function mv(t){return{...t,dateModified:new Date().toISOString()}}function Ap(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function nm(t,e){const s=`collections/blog/${e}/${Ap(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function mj(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Ap(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${Ap(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const gae={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},pv="Box";function xae(t){return t.startsWith("site/")?"site":"app"}function bae(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Ed(...t){for(const e of t)if(e!==void 0)return e}function r3e(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const r of Object.values(n))for(const i of Object.keys(r)){if(!_ae(i)||e.has(i))continue;e.add(i);const a=ua(i,t),l=vae(i),c=gae[l],d=xae(i),h=(d==="site"?Ed(a.title,c?.title):Ed(c?.title,a.title))??l,u=d==="site"?Ed(a.description,c?.description):Ed(c?.description,a.description),f=d==="site"?a.icon:void 0,m=f&&bae(f)?f:void 0,p=m!==void 0?c?.iconName??pv:Ed(f,c?.iconName)??pv;s.push({resolveType:i,title:h,description:u,iconName:p,iconUrl:m,source:d})}return s.sort((r,i)=>r.title.localeCompare(i.title))}function vae(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const yae=["blog/sections/blocks/","site/sections/Blog/Post/"];function _ae(t){return yae.some(e=>t.startsWith(e))}const i3e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],o3e=["January","February","March","April","May","June","July","August","September","October","November","December"],pj=1440*60*1e3;function Ra(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function a3e(t){return new Date(t.getFullYear(),t.getMonth(),1)}function l3e(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Nf(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function Ep(t,e){return Math.round((Ra(t).getTime()-Ra(e).getTime())/pj)}function Lae(t){const e=(t.getTime()-Ra(t).getTime())/pj;return Math.min(Math.max(e,0),1)}function gv(t,e){return Ep(t,e)+Lae(t)}function c3e(t){const e=Nf(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const r=[];for(let i=0;i<7;i++)r.push(Nf(e,n*7+i));s.push(r)}for(;s.length>0&&s[s.length-1].every(n=>n.getMonth()!==t.getMonth());)s.pop();return s}function d3e(t,e){const s=Ra(t[0]),n=Nf(s,7),r=s.getTime(),i=n.getTime(),a=[];for(const d of e){const h=Ra(d.start),u=Ra(d.end);if(u.getTime()<s.getTime()||h.getTime()>=n.getTime())continue;const f=h.getTime()<s.getTime()?s:h,m=u.getTime()>=n.getTime()?Nf(n,-1):u,p=Ep(f,s),g=Ep(m,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),r),b=Math.min(d.end.getTime(),i),v=gv(new Date(x),s),_=Math.max(gv(new Date(b),s)-v,0);_<=0||a.push({variant:d,startCol:p,span:g,leftUnits:v,widthUnits:_})}a.sort((d,h)=>d.startCol-h.startCol||h.span-d.span||d.variant.blockKey.localeCompare(h.variant.blockKey));const l=[],c=[];for(const d of a){let h=l.findIndex(u=>u<=d.startCol);h===-1&&(h=l.length,l.push(0)),l[h]=d.startCol+d.span,c.push({...d,lane:h})}return c}function Vf(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const gj=/^(\d{4})-(\d{2})-(\d{2})$/;function Tf(t){const e=t.trim();if(!e)return null;const s=gj.exec(e);if(s){const r=Number(s[1]),i=Number(s[2])-1,a=Number(s[3]),l=new Date(r,i,a);return l.getMonth()===i&&l.getDate()===a?l:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:Ra(n)}function wae(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),uj);return{...mj("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:Vf(t)}}function Sae(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(gj.test(e))return Tf(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function kae(t,e){const s=Sae(t.scheduledDatetime);if(!s)return null;const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),r={...t,scheduledDatetime:n.toISOString()};return(typeof t.date=="string"?t.date:"")===Vf(s)&&(r.date=Vf(n)),r}function jae(t){return Tf(t.scheduledDatetime)??Tf(t.date)}function u3e(t){const e=new Map,s=[];for(const r of t){const i={post:r,scheduled:Tf(r.scheduledDatetime)!==null},a=jae(r);if(!a){s.push(i);continue}const l=Vf(a),c=e.get(l);c?c.push(i):e.set(l,[i])}const n=(r,i)=>Number(i.scheduled)-Number(r.scheduled)||r.post.title.localeCompare(i.post.title);for(const r of e.values())r.sort(n);return s.sort(n),{byDay:e,undated:s}}const Cae="0.161.0",Nae="0.162.0",h3e="deno task update";function xv(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function bv(t,e){const s=xv(t),n=xv(e);if(!s||!n)return 0;for(let r=0;r<3;r++){const i=s[r]-n[r];if(i!==0)return i}return 0}const xj=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Vae(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const n=xj.exec(s)?.[1];if(n)return n}return null}function Tae(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const n=s?.title;if(typeof n!="string")continue;const r=xj.exec(n)?.[1];if(r)return r}return null}function Pae(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=Vae(t.denoJson)??Tae(t.meta);return!e||bv(e,Cae)<0?{kind:"outdated",version:e}:bv(e,Nae)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function f3e(t){return t.kind==="publish-only"||t.kind==="full"}function m3e(t){return t.kind==="full"}function Aae(t){const e=U.c(16),s=Vs(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=L0(t.virtualMcpId),r=ws()?.taskId??null;let i;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(i=at.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=i):i=e[3];let a;e[4]!==n||e[5]!==t||e[6]!==r?(a=async()=>{const f=await T3({...t,threadId:r},_0(n,"deno.json"));return f.kind==="data"?f.data:null},e[4]=n,e[5]=t,e[6]=r,e[7]=a):a=e[7];const l=s==="deno";let c;e[8]!==i||e[9]!==a||e[10]!==l?(c={queryKey:i,queryFn:a,enabled:l,staleTime:3e5},e[8]=i,e[9]=a,e[10]=l,e[11]=c):c=e[11];const{data:d}=Zt(c),h=d??null;let u;return e[12]!==s||e[13]!==t.meta||e[14]!==h?(u=Pae({packageManager:s,denoJson:h,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=h,e[15]=u):u=e[15],u}function Eae({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:r}){const i=ue(),a=n[s],l=a===void 0,c=l?"":JSON.stringify(a,null,2),[d,h]=P.useState(!1),[u,f]=P.useState(c),[m,p]=P.useState(!1),g=!r||l,x=u!==c,b=()=>{navigator.clipboard.writeText(u).then(()=>{h(!0),setTimeout(()=>h(!1),2e3)})},v=async _=>{if(!r||m)return;let L;try{L=JSON.parse(_)}catch{ye.error(i("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await r(L),ye.success(i("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(y){ye.error(i("sectionsEditor.pageJsonDialog.saveError",{error:y instanceof Error?y.message:String(y)}))}finally{p(!1)}};return o.jsx(zt,{open:t,onOpenChange:e,children:o.jsxs(Bt,{className:"max-w-3xl p-0 gap-0",children:[o.jsxs(ls,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[o.jsx(qt,{className:"text-sm font-semibold",children:i("sectionsEditor.pageJsonDialog.title")}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs(me,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?o.jsx(gi,{size:12}):o.jsx(bn,{size:12}),i(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&o.jsx(me,{size:"sm",onClick:()=>v(u),disabled:!x||m,className:"h-7 text-xs",children:i(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),l?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",i("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"h-[70vh]",children:o.jsx(ud,{code:c,language:"json",readOnly:g,height:"100%",onChange:_=>f(_??""),onSave:_=>{v(_)}})})]})})}function kr(t){const e=U.c(46),{icon:s,logoUrl:n,title:r,subtitle:i,active:a,accent:l,variantCount:c,trailing:d,selectable:h,selectionActive:u,selected:f,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,v=ue(),_=l==="global";let L;e[0]!==s||e[1]!==a||e[2]!==_||e[3]!==n||e[4]!==c?(L=c&&c>1?o.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(s,{size:16,className:"shrink-0 text-success"})}),o.jsxs(We,{side:"right",children:[c," variants"]})]})}):n?o.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):o.jsx("span",{className:le("flex size-8 shrink-0 items-center justify-center rounded-lg",_?"bg-global-section/15":"bg-muted"),children:o.jsx(s,{size:16,className:le("shrink-0",!_&&(a?"text-accent-foreground":"text-muted-foreground")),style:_?{color:E3}:void 0})}),e[0]=s,e[1]=a,e[2]=_,e[3]=n,e[4]=c,e[5]=L):L=e[5];const y=L,w=a?_?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":_?"hover:bg-global-section/10":"hover:bg-muted";let S;e[6]!==w?(S=le("group relative flex min-w-0 items-center rounded-md transition-colors",w),e[6]=w,e[7]=S):S=e[7];let k;e[8]!==g||e[9]!==h||e[10]!==f||e[11]!==u||e[12]!==v||e[13]!==r?(k=h&&o.jsx("span",{className:le("flex shrink-0 items-center pl-2.5 transition-opacity",f||u?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:Rae,children:o.jsx(il,{checked:f,onCheckedChange:()=>g?.(),"aria-label":v("sandbox.itemRow.selectItem",{title:r})})}),e[8]=g,e[9]=h,e[10]=f,e[11]=u,e[12]=v,e[13]=r,e[14]=k):k=e[14];const j=m&&!a&&"text-destructive";let N;e[15]!==j?(N=le("block truncate text-sm font-medium",j),e[15]=j,e[16]=N):N=e[16];let V;e[17]!==N||e[18]!==r?(V=o.jsx("span",{className:N,children:r}),e[17]=N,e[18]=r,e[19]=V):V=e[19];const C=a?"text-accent-foreground/70":"text-muted-foreground";let T;e[20]!==C?(T=le("block truncate text-xs",C),e[20]=C,e[21]=T):T=e[21];let A;e[22]!==i||e[23]!==T?(A=o.jsx("span",{className:T,children:i}),e[22]=i,e[23]=T,e[24]=A):A=e[24];let R;e[25]!==A||e[26]!==V?(R=o.jsxs("span",{className:"min-w-0 flex-1",children:[V,A]}),e[25]=A,e[26]=V,e[27]=R):R=e[27];let E;e[28]!==a||e[29]!==m||e[30]!==p?(E=m&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:le("flex shrink-0 items-center",a?"text-accent-foreground":"text-destructive"),children:o.jsx(vn,{size:14})})}),p&&o.jsx(We,{side:"bottom",children:p})]}),e[28]=a,e[29]=m,e[30]=p,e[31]=E):E=e[31];let I;e[32]!==x||e[33]!==y||e[34]!==R||e[35]!==E||e[36]!==d?(I=o.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[y,R,E,d]}),e[32]=x,e[33]=y,e[34]=R,e[35]=E,e[36]=d,e[37]=I):I=e[37];let D;e[38]!==a||e[39]!==b?(D=b&&o.jsx("div",{className:le("pr-1 opacity-0 transition-opacity group-hover:opacity-100",a&&"opacity-100"),children:b}),e[38]=a,e[39]=b,e[40]=D):D=e[40];let O;return e[41]!==I||e[42]!==D||e[43]!==S||e[44]!==k?(O=o.jsxs("div",{className:S,children:[k,I,D]}),e[41]=I,e[42]=D,e[43]=S,e[44]=k,e[45]=O):O=e[45],O}function Rae(t){return t.stopPropagation()}function Oo(t){const e=U.c(10),{icon:s,title:n,description:r}=t;let i;e[0]!==s?(i=s&&o.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=i):i=e[1];let a;e[2]!==n?(a=o.jsx("div",{children:n}),e[2]=n,e[3]=a):a=e[3];let l;e[4]!==r?(l=r&&o.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:r}),e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==i||e[7]!==a||e[8]!==l?(c=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[i,a,l]}),e[6]=i,e[7]=a,e[8]=l,e[9]=c):c=e[9],c}const Dae={loaders:Ia,actions:hi},Mae={loaders:"Loaders",actions:"Actions"},Iae={analytics:NA,blog:Hc,commerce:CA,site:JT,website:Cn};function Oae(t,e){return e===0?Iae[t.toLowerCase()]??qo:qo}function fh(t,e){return e===0?tse(t):t}function $ae(t){const e=U.c(98),{orgSlug:s,virtualMcpId:n,branch:r,previewUrl:i,meta:a,decofile:l,kind:c}=t,d=ue();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[u,f]=P.useState(h),[m,p]=P.useState(null),[g,x]=P.useState(""),[b,v]=P.useState(qae),[_,L]=P.useState(c);_!==c&&(L(c),f([]),p(null),x(""),v(new Set));let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=B=>{v(H=>{const W=new Set(H);return W.has(B)?W.delete(B):W.add(B),W})},e[1]=y):y=e[1];const w=y;let S;e[2]!==r||e[3]!==s||e[4]!==n?(S={orgSlug:s,virtualMcpId:n,branch:r},e[2]=r,e[3]=s,e[4]=n,e[5]=S):S=e[5];const k=w0(S);let j;e[6]!==k?(j=Q3((B,H)=>k.mutate({blockKey:B,data:H})),e[6]=k,e[7]=j):j=e[7];const N=j;let V;e[8]!==c?(V=tk(c),e[8]=c,e[9]=V):V=e[9];const C=V,T=Dae[c];let A,R,E,I,D,O,$;if(e[10]!==T||e[11]!==r||e[12]!==l||e[13]!==c||e[14]!==a||e[15]!==b||e[16]!==s||e[17]!==u||e[18]!==i||e[19]!==k||e[20]!==N||e[21]!==g||e[22]!==m||e[23]!==C||e[24]!==d||e[25]!==n){E=Symbol.for("react.early_return_sentinel");e:{const B=[...ik(a,l,c).map(Wae),...nk(a,c).map(Kae)],H=g.trim().toLowerCase(),W=H.length>0,K=W?B.filter(xe=>xe.title.toLowerCase().includes(H)||xe.resolveType.toLowerCase().includes(H)):[],q=new Map,G=[],te=new Map;if(!W){for(const xe of B){const Ne=xe.folderPath;if(!(Ne.length<u.length)&&u.every((je,we)=>Ne[we]===je))if(Ne.length===u.length)if(xe.savedKey!==void 0){const je=te.get(xe.resolveType);je?je.push(xe):te.set(xe.resolveType,[xe])}else G.push(xe);else{const je=Ne[u.length],we=q.get(je)??{count:0,savedCount:0};xe.savedKey!==void 0?we.savedCount=we.savedCount+1:we.count=we.count+1,q.set(je,we)}}G.sort(Hae);for(const xe of te.values())xe.sort(Uae)}const X=[...te.entries()].filter(xe=>{const[Ne]=xe;return!G.some(je=>je.resolveType===Ne)}).flatMap(Fae).sort(zae);let Z;e[33]!==u?(Z=(xe,Ne)=>fh(xe.name,u.length).localeCompare(fh(Ne.name,u.length)),e[33]=u,e[34]=Z):Z=e[34];const ee=[...q.entries()].map(Bae).sort(Z);let se;e[35]===Symbol.for("react.memo_cache_sentinel")?(se=xe=>{p(xe.savedKey!==void 0?{mode:"saved",key:xe.savedKey}:{mode:"available",resolveType:xe.resolveType,title:xe.title})},e[35]=se):se=e[35];const J=se;let oe;e[36]!==k||e[37]!==C||e[38]!==d?(oe=async(xe,Ne)=>{await k.mutateAsync({blockKey:xe,data:Ne}),ye.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:C,blockId:xe})),p({mode:"saved",key:xe})},e[36]=k,e[37]=C,e[38]=d,e[39]=oe):oe=e[39];const ce=oe;let he;e[40]!==l||e[41]!==m?(he=Gae(m,l),e[40]=l,e[41]=m,e[42]=he):he=e[42];const ne=he;if(ne){const xe=`${ne.mode}:${ne.mode==="saved"?ne.blockKey:ne.resolveType}`;let Ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(Ne=()=>p(null),e[43]=Ne):Ne=e[43];let je;e[44]!==r||e[45]!==l||e[46]!==ce||e[47]!==c||e[48]!==a||e[49]!==s||e[50]!==i||e[51]!==k.isPending||e[52]!==N||e[53]!==xe||e[54]!==ne.editorTarget||e[55]!==ne.initialValue||e[56]!==n?(je=o.jsx(sj,{orgSlug:s,virtualMcpId:n,branch:r,previewUrl:i,meta:a,decofile:l,kind:c,target:ne.editorTarget,initialValue:ne.initialValue,isCreating:k.isPending,onCreate:ce,onSaveReferencedBlock:N,onBack:Ne},xe),e[44]=r,e[45]=l,e[46]=ce,e[47]=c,e[48]=a,e[49]=s,e[50]=i,e[51]=k.isPending,e[52]=N,e[53]=xe,e[54]=ne.editorTarget,e[55]=ne.initialValue,e[56]=n,e[57]=je):je=e[57],E=je;break e}$="flex h-full w-full min-w-0 flex-col";let Q;e[58]!==d?(Q=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=Q):Q=e[59];let de;e[60]===Symbol.for("react.memo_cache_sentinel")?(de=()=>f([]),e[60]=de):de=e[60];const ae=u.length===0?"font-medium text-foreground":"text-muted-foreground";let re;e[61]!==ae?(re=le("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",ae),e[61]=ae,e[62]=re):re=e[62];const ie=Mae[c];let Y;e[63]!==re||e[64]!==ie?(Y=o.jsx("button",{type:"button",onClick:de,className:re,children:ie}),e[63]=re,e[64]=ie,e[65]=Y):Y=e[65];let pe;e[66]!==u?(pe=u.map((xe,Ne)=>{const je=Ne===u.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o.jsx(Us,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(u.slice(0,Ne+1)),className:le("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",je?"font-medium text-foreground":"text-muted-foreground"),children:fh(xe,Ne)})]},`${xe}-${Ne}`)}),e[66]=u,e[67]=pe):pe=e[67];let be;e[68]!==Q||e[69]!==Y||e[70]!==pe?(be=o.jsxs("nav",{"aria-label":Q,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[Y,pe]}),e[68]=Q,e[69]=Y,e[70]=pe,e[71]=be):be=e[71];let _e;e[72]===Symbol.for("react.memo_cache_sentinel")?(_e=o.jsx(r0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=_e):_e=e[72];let Le;e[73]===Symbol.for("react.memo_cache_sentinel")?(Le=xe=>x(xe.target.value),e[73]=Le):Le=e[73];let ke;e[74]!==c||e[75]!==d?(ke=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=ke):ke=e[76];let Ve;e[77]!==c||e[78]!==d?(Ve=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=Ve):Ve=e[79];let Pe;e[80]!==g||e[81]!==ke||e[82]!==Ve?(Pe=o.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[_e,o.jsx("input",{type:"text",value:g,onChange:Le,placeholder:ke,"aria-label":Ve,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=ke,e[82]=Ve,e[83]=Pe):Pe=e[83],e[84]!==be||e[85]!==Pe?(R=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[be,Pe]}),e[84]=be,e[85]=Pe,e[86]=R):R=e[86],A=rl,O="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",I="mx-auto w-full max-w-4xl px-6 py-5",D=W?K.length===0?o.jsx(Oo,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):o.jsx("div",{className:"flex flex-col gap-1",children:K.map(xe=>o.jsx(kr,{icon:T,accent:xe.savedKey!==void 0?"global":void 0,title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>J(xe)},xe.savedKey??xe.resolveType))}):ee.length===0&&G.length===0&&X.length===0?o.jsx(Oo,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:u.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):o.jsxs(o.Fragment,{children:[ee.length>0&&o.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:ee.map(xe=>{const Ne=Oae(xe.name,u.length);return o.jsxs("button",{type:"button",onClick:()=>f([...u,xe.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[o.jsx(Ne,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium",children:fh(xe.name,u.length)}),o.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[xe.count," ",xe.count===1?C:c,xe.savedCount>0&&o.jsxs(o.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:xe.savedCount})]})]})]})]},xe.name)})}),(G.length>0||X.length>0)&&o.jsxs("div",{className:le("flex flex-col gap-1",ee.length>0&&"mt-4"),children:[G.map(xe=>{const Ne=te.get(xe.resolveType)??[],je=b.has(xe.resolveType);return o.jsxs("div",{className:"flex flex-col",children:[o.jsx(kr,{icon:T,title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>J(xe)}),Ne.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>w(xe.resolveType),"aria-expanded":je,className:"flex items-center gap-1 self-start rounded-md px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:E3},children:[je?o.jsx(ds,{size:12,className:"shrink-0"}):o.jsx(Us,{size:12,className:"shrink-0"}),d(je?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Ne.length,")"]}),je&&o.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Ne.map(we=>o.jsx(kr,{icon:T,accent:"global",title:we.title,subtitle:we.resolveType,active:!1,onClick:()=>J(we)},we.savedKey))})]})]},xe.resolveType)}),X.map(xe=>o.jsx(kr,{icon:T,accent:"global",title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>J(xe)},xe.savedKey))]})]})}e[10]=T,e[11]=r,e[12]=l,e[13]=c,e[14]=a,e[15]=b,e[16]=s,e[17]=u,e[18]=i,e[19]=k,e[20]=N,e[21]=g,e[22]=m,e[23]=C,e[24]=d,e[25]=n,e[26]=A,e[27]=R,e[28]=E,e[29]=I,e[30]=D,e[31]=O,e[32]=$}else A=e[26],R=e[27],E=e[28],I=e[29],D=e[30],O=e[31],$=e[32];if(E!==Symbol.for("react.early_return_sentinel"))return E;let M;e[87]!==I||e[88]!==D?(M=o.jsx("div",{className:I,children:D}),e[87]=I,e[88]=D,e[89]=M):M=e[89];let z;e[90]!==A||e[91]!==M||e[92]!==O?(z=o.jsx(A,{className:O,children:M}),e[90]=A,e[91]=M,e[92]=O,e[93]=z):z=e[93];let F;return e[94]!==R||e[95]!==z||e[96]!==$?(F=o.jsxs("div",{className:$,children:[R,z]}),e[94]=R,e[95]=z,e[96]=$,e[97]=F):F=e[97],F}function Bae(t){const[e,s]=t;return{name:e,...s}}function zae(t,e){return t.title.localeCompare(e.title)}function Fae(t){const[,e]=t;return e}function Uae(t,e){return t.title.localeCompare(e.title)}function Hae(t,e){return t.title.localeCompare(e.title)}function Kae(t){return{resolveType:t.resolveType,title:t.title,folderPath:rk(t.resolveType)}}function Wae(t){return{resolveType:t.resolveType,title:t.title,folderPath:rk(t.resolveType),savedKey:t.key}}function qae(){return new Set}function Gae(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:n,title:r}=ok(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:r},initialValue:n}}function Yae(t){const e=U.c(83),{orgSlug:s,virtualMcpId:n,branch:r,previewUrl:i,meta:a,decofile:l,resolveType:c,title:d,defaultBlockId:h,isCreating:u,onCreate:f,onSaveReferencedBlock:m}=t,p=ue(),g=lo(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[v,_]=P.useState(b);let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=[],e[1]=L):L=e[1];const[y,w]=P.useState(L),[S,k]=P.useState(0),[j,N]=P.useState(!1);let V;e[2]!==a||e[3]!==c?(V=$n(c,a),e[2]=a,e[3]=c,e[4]=V):V=e[4];const C=V,T=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,A=ws()?.taskId??null,R=i??void 0;let E;e[5]!==x||e[6]!==r||e[7]!==s||e[8]!==R||e[9]!==A||e[10]!==n?(E={orgSlug:s,virtualMcpId:n,branch:r,threadId:A,previewUrl:R,siteSlug:x},e[5]=x,e[6]=r,e[7]=s,e[8]=R,e[9]=A,e[10]=n,e[11]=E):E=e[11];const I=E;let D,O,$,M,z,F,B,H;if(e[12]!==l||e[13]!==y||e[14]!==v||e[15]!==f||e[16]!==p||e[17]!==d){const re=[d,...y],ie=pe=>{w(y.slice(0,pe)),k(Qae)};let Y;e[26]!==l||e[27]!==v||e[28]!==f?(Y=async pe=>{const be=nx(pe,l);if(be){ye.error(be);return}await f(pe,v),N(!1)},e[26]=l,e[27]=v,e[28]=f,e[29]=Y):Y=e[29],D=Y,M="flex h-full w-full min-w-0",$="flex min-w-0 flex-1 flex-col",O="shrink-0 border-b px-3 py-2.5",H="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==p?(z=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=p,e[31]=z):z=e[31],F="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",B=re.map((pe,be)=>{const _e=be===re.length-1,Le=kn(pe);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[be>0&&o.jsx(Us,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>ie(be),title:Le,className:le("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",_e?"font-medium text-foreground":"text-muted-foreground"),children:Le})]},`${Le}-${be}`)}),e[12]=l,e[13]=y,e[14]=v,e[15]=f,e[16]=p,e[17]=d,e[18]=D,e[19]=O,e[20]=$,e[21]=M,e[22]=z,e[23]=F,e[24]=B,e[25]=H}else D=e[18],O=e[19],$=e[20],M=e[21],z=e[22],F=e[23],B=e[24],H=e[25];let W;e[32]!==z||e[33]!==F||e[34]!==B?(W=o.jsx("nav",{"aria-label":z,className:F,children:B}),e[32]=z,e[33]=F,e[34]=B,e[35]=W):W=e[35];let K;e[36]===Symbol.for("react.memo_cache_sentinel")?(K=()=>N(!0),e[36]=K):K=e[36];let q;e[37]!==p?(q=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=p,e[38]=q):q=e[38];let G;e[39]===Symbol.for("react.memo_cache_sentinel")?(G=o.jsx(W2,{size:14}),e[39]=G):G=e[39];let te;e[40]!==u||e[41]!==q?(te=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{size:"icon",className:"size-8 shrink-0",disabled:u,onClick:K,"aria-label":q,children:G})}),e[40]=u,e[41]=q,e[42]=te):te=e[42];let X;e[43]!==p?(X=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=p,e[44]=X):X=e[44];let Z;e[45]!==X?(Z=o.jsx(We,{side:"bottom",children:X}),e[45]=X,e[46]=Z):Z=e[46];let ee;e[47]!==te||e[48]!==Z?(ee=o.jsxs(qe,{children:[te,Z]}),e[47]=te,e[48]=Z,e[49]=ee):ee=e[49];let se;e[50]!==W||e[51]!==ee||e[52]!==H?(se=o.jsxs("div",{className:H,children:[W,ee]}),e[50]=W,e[51]=ee,e[52]=H,e[53]=se):se=e[53];const J="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",oe=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:T});let ce;e[54]!==oe?(ce=o.jsx("p",{className:J,children:oe}),e[54]=oe,e[55]=ce):ce=e[55];let he;e[56]!==O||e[57]!==se||e[58]!==ce?(he=o.jsxs("div",{className:O,children:[se,ce]}),e[56]=O,e[57]=se,e[58]=ce,e[59]=he):he=e[59];let ne;e[60]!==l||e[61]!==y||e[62]!==S||e[63]!==v||e[64]!==a||e[65]!==m||e[66]!==I||e[67]!==C||e[68]!==p?(ne=o.jsx(rl,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:C?o.jsx(Hr,{schema:C,value:v,onChange:re=>_(re),basePath:"",breadcrumbPath:y,onBreadcrumbChange:w,meta:a,decofile:l,onSaveReferencedBlock:m,sandbox:I},S):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=l,e[61]=y,e[62]=S,e[63]=v,e[64]=a,e[65]=m,e[66]=I,e[67]=C,e[68]=p,e[69]=ne):ne=e[69];let Q;e[70]!==$||e[71]!==he||e[72]!==ne?(Q=o.jsxs("div",{className:$,children:[he,ne]}),e[70]=$,e[71]=he,e[72]=ne,e[73]=Q):Q=e[73];let de;e[74]!==h||e[75]!==D||e[76]!==u||e[77]!==j?(de=o.jsx(rx,{open:j,onOpenChange:N,defaultBlockId:h,isPending:u,onSubmit:D}),e[74]=h,e[75]=D,e[76]=u,e[77]=j,e[78]=de):de=e[78];let ae;return e[79]!==M||e[80]!==Q||e[81]!==de?(ae=o.jsxs("div",{className:M,children:[Q,de]}),e[79]=M,e[80]=Q,e[81]=de,e[82]=ae):ae=e[82],ae}function Qae(t){return t+1}var Xae=Object.prototype.toString,vd=Array.isArray||function(e){return Xae.call(e)==="[object Array]"};function fx(t){return typeof t=="function"}function Jae(t){return vd(t)?"array":typeof t}function rm(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function vv(t,e){return t!=null&&typeof t=="object"&&e in t}function Zae(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var ele=RegExp.prototype.test;function tle(t,e){return ele.call(t,e)}var sle=/\S/;function nle(t){return!tle(sle,t)}var rle={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function ile(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return rle[s]})}var ole=/\s*/,ale=/\s+/,yv=/\s*=/,lle=/\s*\}/,cle=/#|\^|\/|>|\{|&|=|!/;function dle(t,e){if(!t)return[];var s=!1,n=[],r=[],i=[],a=!1,l=!1,c="",d=0;function h(){if(a&&!l)for(;i.length;)delete r[i.pop()];else i=[];a=!1,l=!1}var u,f,m;function p(k){if(typeof k=="string"&&(k=k.split(ale,2)),!vd(k)||k.length!==2)throw new Error("Invalid tags: "+k);u=new RegExp(rm(k[0])+"\\s*"),f=new RegExp("\\s*"+rm(k[1])),m=new RegExp("\\s*"+rm("}"+k[1]))}p(e||Br.tags);for(var g=new S0(t),x,b,v,_,L,y;!g.eos();){if(x=g.pos,v=g.scanUntil(u),v)for(var w=0,S=v.length;w<S;++w)_=v.charAt(w),nle(_)?(i.push(r.length),c+=_):(l=!0,s=!0,c+=" "),r.push(["text",_,x,x+1]),x+=1,_===`
624
+ `)}function Zb(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function Xre(t,e){const s=new Map;for(const n of t){const r=s.get(n.label);r?r.push(n):s.set(n.label,[n])}return e.map(n=>({id:s.get(n.label)?.shift()?.id??crypto.randomUUID(),index:n.index,label:n.label}))}function Jre(t){return t.map((e,s)=>({...e,index:s}))}function Wk(t){const e=U.c(19),{label:s,canDelete:n,dragging:r,onRename:i,onDuplicate:a,onDelete:l}=t,c=ue(),d=r?"opacity-100":"opacity-0 group-hover:opacity-100";let h;e[0]!==d?(h=le("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=h):h=e[1];let u;e[2]!==h?(u=o.jsx(e9,{className:h}),e[2]=h,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(zi,{className:"h-4 w-4 shrink-0",style:{color:Yre}}),e[4]=f):f=e[4];let m;e[5]!==s?(m=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==r||e[9]!==s||e[10]!==l||e[11]!==a||e[12]!==i||e[13]!==c?(p=!r&&o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionVariantList.openActionsFor",{label:s}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 data-[state=open]:opacity-100",onClick:eie,onPointerDown:Zre,children:o.jsx(Rr,{size:14})})}),o.jsxs(Ht,{align:"end",children:[i&&o.jsxs(et,{onClick:x=>{x.stopPropagation(),i()},children:[o.jsx(Z6,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),o.jsxs(et,{onClick:x=>{x.stopPropagation(),a?.()},children:[o.jsx(bn,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),o.jsxs(et,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),l?.()},children:[o.jsx(rn,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=r,e[9]=s,e[10]=l,e[11]=a,e[12]=i,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==u||e[16]!==m||e[17]!==p?(g=o.jsxs(o.Fragment,{children:[u,f,m,p]}),e[15]=u,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function Zre(t){return t.stopPropagation()}function eie(t){return t.stopPropagation()}function tie(t){const e=U.c(27),{entry:s,selected:n,canDelete:r,onSelect:i,onRename:a,onDuplicate:l,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:sie},e[0]=s.id,e[1]=d):d=e[1];const{attributes:h,listeners:u,setNodeRef:f,transform:m,isDragging:p}=i3(d);let g;e[2]!==m?(g=fi.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const v=b;let _;e[7]!==i?(_=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),i())},e[7]=i,e[8]=_):_=e[8];const L=p?"cursor-grabbing":"cursor-grab",y=n?Kk:Qre;let w;e[9]!==L||e[10]!==y?(w=le("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",L,y),e[9]=L,e[10]=y,e[11]=w):w=e[11];let S;e[12]!==r||e[13]!==s.label||e[14]!==c||e[15]!==l||e[16]!==a?(S=o.jsx(Wk,{label:s.label,canDelete:r,onRename:a,onDuplicate:l,onDelete:c}),e[12]=r,e[13]=s.label,e[14]=c,e[15]=l,e[16]=a,e[17]=S):S=e[17];let k;return e[18]!==h||e[19]!==u||e[20]!==i||e[21]!==f||e[22]!==v||e[23]!==_||e[24]!==w||e[25]!==S?(k=o.jsx("div",{ref:f,style:v,...h,...u,onClick:i,onKeyDown:_,className:w,children:S}),e[18]=h,e[19]=u,e[20]=i,e[21]=f,e[22]=v,e[23]=_,e[24]=w,e[25]=S,e[26]=k):k=e[26],k}function sie(){return!1}function nie(t){const e=U.c(103),{listKey:s,variants:n,selectedIndex:r,onSelect:i,onRename:a,onDuplicate:l,onDelete:c,onRemoveAll:d,onReorder:h,onAdd:u}=t,f=ue(),m=n.length>1;let p;e[0]!==n?(p=()=>Zb(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=P.useState(p),[b,v]=P.useState(null),[_,L]=P.useState(s),[y,w]=P.useState(n.length);let S;e[2]!==n?(S=()=>Jb(n),e[2]=n,e[3]=S):S=e[3];const[k,j]=P.useState(S),N=P.useRef(!1),V=Jb(n);_!==s?(L(s),w(n.length),j(V),x(Zb(n))):(y!==n.length||k!==V)&&(w(n.length),j(V),x(ae=>Xre(ae,n)));let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C={activationConstraint:{distance:8}},e[4]=C):C=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T={coordinateGetter:o3},e[5]=T):T=e[5];const A=Xg(Yc(p0,C),Yc(m0,T));let R;e[6]!==g?(R=g.map(rie),e[6]=g,e[7]=R):R=e[7];const E=R;let I;e[8]!==g?(I=ae=>{const re=String(ae.active.id);v(g.find(ie=>ie.id===re)??null)},e[8]=g,e[9]=I):I=e[9];const D=I;let O;e[10]!==E||e[11]!==h?(O=ae=>{v(null);const{active:re,over:ie}=ae;if(!ie||re.id===ie.id)return;const Y=E.indexOf(String(re.id)),pe=E.indexOf(String(ie.id));Y===-1||pe===-1||(x(be=>Jre(Qc([...be],Y,pe))),N.current=!0,requestAnimationFrame(()=>{N.current=!1}),h(Y,pe))},e[10]=E,e[11]=h,e[12]=O):O=e[12];const $=O;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{v(null)},e[13]=M):M=e[13];const z=M;let F,B,H,W,K,q,G,te,X,Z,ee,se,J;if(e[14]!==m||e[15]!==g||e[16]!==E||e[17]!==$||e[18]!==D||e[19]!==u||e[20]!==c||e[21]!==l||e[22]!==d||e[23]!==a||e[24]!==i||e[25]!==r||e[26]!==A||e[27]!==f){const ae=Oe=>{N.current||i(Oe)};ee="space-y-1 border-b p-2";let re;e[41]!==f?(re=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=re):re=e[42];let ie;e[43]!==re?(ie=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:re}),e[43]=re,e[44]=ie):ie=e[44];let Y;e[45]!==f?(Y=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=Y):Y=e[46];let pe;e[47]===Symbol.for("react.memo_cache_sentinel")?(pe=o.jsx(Qt,{size:14}),e[47]=pe):pe=e[47];let be;e[48]!==u||e[49]!==Y?(be=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":Y,className:"size-6",onClick:u,children:pe})}),e[48]=u,e[49]=Y,e[50]=be):be=e[50];let _e;e[51]!==f?(_e=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=_e):_e=e[52];let Le;e[53]!==_e?(Le=o.jsx(We,{children:_e}),e[53]=_e,e[54]=Le):Le=e[54];let ke;e[55]!==be||e[56]!==Le?(ke=o.jsxs(qe,{children:[be,Le]}),e[55]=be,e[56]=Le,e[57]=ke):ke=e[57];let Ve;e[58]!==f?(Ve=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=Ve):Ve=e[59];let Pe;e[60]===Symbol.for("react.memo_cache_sentinel")?(Pe=o.jsx(rn,{size:14}),e[60]=Pe):Pe=e[60];let xe;e[61]!==d||e[62]!==Ve?(xe=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":Ve,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Pe})}),e[61]=d,e[62]=Ve,e[63]=xe):xe=e[63];let Ne;e[64]!==f?(Ne=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Ne):Ne=e[65];let je;e[66]!==Ne?(je=o.jsx(We,{children:Ne}),e[66]=Ne,e[67]=je):je=e[67];let we;e[68]!==xe||e[69]!==je?(we=o.jsxs(qe,{children:[xe,je]}),e[68]=xe,e[69]=je,e[70]=we):we=e[70];let Ce;e[71]!==ke||e[72]!==we?(Ce=o.jsxs("div",{className:"flex items-center gap-0.5",children:[ke,we]}),e[71]=ke,e[72]=we,e[73]=Ce):Ce=e[73],e[74]!==ie||e[75]!==Ce?(se=o.jsxs("div",{className:"flex items-center justify-between",children:[ie,Ce]}),e[74]=ie,e[75]=Ce,e[76]=se):se=e[76],B=t3,q=A,G=hL,te=D,X=$,Z=z,F=r3,W=E,K=n3,J="space-y-0.5",H=g.map(Oe=>o.jsx(tie,{entry:Oe,selected:Oe.index===r,canDelete:m,onSelect:()=>ae(Oe.index),onRename:a?()=>a(Oe.index):void 0,onDuplicate:()=>l(Oe.index),onDelete:()=>c(Oe.index)},Oe.id)),e[14]=m,e[15]=g,e[16]=E,e[17]=$,e[18]=D,e[19]=u,e[20]=c,e[21]=l,e[22]=d,e[23]=a,e[24]=i,e[25]=r,e[26]=A,e[27]=f,e[28]=F,e[29]=B,e[30]=H,e[31]=W,e[32]=K,e[33]=q,e[34]=G,e[35]=te,e[36]=X,e[37]=Z,e[38]=ee,e[39]=se,e[40]=J}else F=e[28],B=e[29],H=e[30],W=e[31],K=e[32],q=e[33],G=e[34],te=e[35],X=e[36],Z=e[37],ee=e[38],se=e[39],J=e[40];let oe;e[77]!==H||e[78]!==J?(oe=o.jsx("div",{className:J,children:H}),e[77]=H,e[78]=J,e[79]=oe):oe=e[79];let ce;e[80]!==F||e[81]!==W||e[82]!==K||e[83]!==oe?(ce=o.jsx(F,{items:W,strategy:K,children:oe}),e[80]=F,e[81]=W,e[82]=K,e[83]=oe,e[84]=ce):ce=e[84];let he;e[85]!==b||e[86]!==m?(he=b?o.jsx("div",{className:le("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",Kk),children:o.jsx(Wk,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=he):he=e[87];let ne;e[88]!==he?(ne=Wn.createPortal(o.jsx(s3,{dropAnimation:mk,children:he}),document.body),e[88]=he,e[89]=ne):ne=e[89];let Q;e[90]!==B||e[91]!==q||e[92]!==G||e[93]!==te||e[94]!==X||e[95]!==Z||e[96]!==ce||e[97]!==ne?(Q=o.jsxs(B,{sensors:q,collisionDetection:G,onDragStart:te,onDragEnd:X,onDragCancel:Z,children:[ce,ne]}),e[90]=B,e[91]=q,e[92]=G,e[93]=te,e[94]=X,e[95]=Z,e[96]=ce,e[97]=ne,e[98]=Q):Q=e[98];let de;return e[99]!==ee||e[100]!==se||e[101]!==Q?(de=o.jsxs("div",{className:ee,children:[se,Q]}),e[99]=ee,e[100]=se,e[101]=Q,e[102]=de):de=e[102],de}function rie(t){return t.id}const iie=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],oie={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",gift:"Gift01","user-check":"UserCheck01","user-x":"UserX01",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function X1(t){return sl(t)!==void 0}function ax(t,e){if(e){if(X1(e))return e;const s=oie[e];if(s&&X1(s))return s}for(const[s,n]of iie)if(s.test(t)&&X1(n))return n;return"FilterLines"}function aie(t){return sl(t)??tg}function J1(t){const e=U.c(11),{iconName:s,size:n,className:r}=t,i=n===void 0?"md":n;let a;e[0]!==s?(a=aie(s),e[0]=s,e[1]=a):a=e[1];const l=a,c=i==="sm"?"size-7":"size-9",d=i==="sm"?16:18;let h;e[2]!==c||e[3]!==r?(h=le("flex shrink-0 items-center justify-center rounded-full bg-muted",c,r),e[2]=c,e[3]=r,e[4]=h):h=e[4];let u;e[5]!==l||e[6]!==d?(u=o.jsx(l,{size:d,className:"text-muted-foreground"}),e[5]=l,e[6]=d,e[7]=u):u=e[7];let f;return e[8]!==h||e[9]!==u?(f=o.jsx("div",{className:h,children:u}),e[8]=h,e[9]=u,e[10]=f):f=e[10],f}function Kge(t,e){return ree(t,e).map(s=>{const n=e[s.blockKey]??{},r=AS(aee(s.blockKey),e,t);return{blockKey:s.blockKey,title:Ka(s.blockKey,n),description:Zc(r),iconName:ax(s.matcherResolveType)}})}const qk="Users03";function lie(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function cie(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[r,i]of Object.entries(e))if(r.includes("matchers")&&!r.startsWith("$live/"))for(const a of Object.keys(i)){if(a.toLowerCase().includes("always")||n.has(a))continue;n.add(a);const l=ua(a,t);s.push({resolveType:a,title:l.title??ms(a),description:l.description,iconName:ax(a,l.icon)})}return s}function die(t,e){if(!t)return qk;const s=e.find(n=>n.resolveType===t);return s?s.iconName:ax(t)}function uie(t){const e=U.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:r,matchers:i,globals:a,onSelect:l,onSelectGlobal:c}=t,d=a===void 0?[]:a,[h,u]=P.useState(!1),f=ue(),p=(r?d.find(se=>se.blockKey===r):void 0)?.iconName??die(s,i),g=sl(p);let x;e[0]!==l||e[1]!==u?(x=se=>{l(se),u(!1)},e[0]=l,e[1]=u,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==u?(v=se=>{c?.(se),u(!1)},e[3]=c,e[4]=u,e[5]=v):v=e[5];const _=v;let L;e[6]!==u?(L=()=>u(!0),e[6]=u,e[7]=L):L=e[7];let y;e[8]!==g?(y=g&&o.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=y):y=e[9];let w;e[10]!==n?(w=o.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=w):w=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(ds,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=S):S=e[12];let k;e[13]!==L||e[14]!==y||e[15]!==w?(k=o.jsxs("button",{type:"button",onClick:L,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[y,w,S]}),e[13]=L,e[14]=y,e[15]=w,e[16]=k):k=e[16];let j;e[17]!==f?(j=f("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=f,e[18]=j):j=e[18];let N;e[19]!==f?(N=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=N):N=e[20];let V;e[21]!==f?(V=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=V):V=e[22];let C;e[23]!==V?(C=o.jsx(hr,{placeholder:V}),e[23]=V,e[24]=C):C=e[24];let T;e[25]!==f?(T=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=T):T=e[26];let A;e[27]!==T?(A=o.jsx(On,{children:T}),e[27]=T,e[28]=A):A=e[28];let R;e[29]!==f?(R=f("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=f,e[30]=R):R=e[30];let E;e[31]!==f?(E=f("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=f,e[32]=E):E=e[32];const I=`${R} ${E}`;let D;e[33]!==b?(D=()=>b(""),e[33]=b,e[34]=D):D=e[34];const O=!s&&!r&&"bg-accent/60";let $;e[35]!==O?($=le("gap-2.5",O),e[35]=O,e[36]=$):$=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(J1,{iconName:qk,size:"sm"}),e[37]=M):M=e[37];let z;e[38]!==f?(z=f("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=f,e[39]=z):z=e[39];let F;e[40]!==z?(F=o.jsx("span",{className:"text-sm",children:z}),e[40]=z,e[41]=F):F=e[41];let B;e[42]!==f?(B=f("sectionsEditor.matcherPicker.targetAllUsers"),e[42]=f,e[43]=B):B=e[43];let H;e[44]!==B?(H=o.jsx("span",{className:"text-xs text-muted-foreground",children:B}),e[44]=B,e[45]=H):H=e[45];let W;e[46]!==F||e[47]!==H?(W=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[F,H]}),e[46]=F,e[47]=H,e[48]=W):W=e[48];let K;e[49]!==I||e[50]!==D||e[51]!==$||e[52]!==W?(K=o.jsxs(as,{value:I,onSelect:D,className:$,children:[M,W]}),e[49]=I,e[50]=D,e[51]=$,e[52]=W,e[53]=K):K=e[53];let q;if(e[54]!==r||e[55]!==s||e[56]!==b||e[57]!==i){let se;e[59]!==r||e[60]!==s||e[61]!==b?(se=J=>o.jsxs(as,{value:`${J.title} ${J.resolveType} ${J.description??""}`,onSelect:()=>b(J.resolveType),className:le("gap-2.5",!r&&s===J.resolveType&&"bg-accent/60"),children:[o.jsx(J1,{iconName:J.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm",children:J.title}),J.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:J.description})]})]},J.resolveType),e[59]=r,e[60]=s,e[61]=b,e[62]=se):se=e[62],q=i.map(se),e[54]=r,e[55]=s,e[56]=b,e[57]=i,e[58]=q}else q=e[58];let G;e[63]!==K||e[64]!==q?(G=o.jsxs(Es,{children:[K,q]}),e[63]=K,e[64]=q,e[65]=G):G=e[65];let te;e[66]!==r||e[67]!==d||e[68]!==_||e[69]!==f?(te=d.length>0&&o.jsx(Es,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(se=>o.jsxs(as,{value:`${se.title} ${se.blockKey} ${se.description??""}`,onSelect:()=>_(se.blockKey),className:le("gap-2.5",r===se.blockKey&&"bg-accent/60"),children:[o.jsx(J1,{iconName:se.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm",children:se.title}),se.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:se.description})]})]},se.blockKey))}),e[66]=r,e[67]=d,e[68]=_,e[69]=f,e[70]=te):te=e[70];let X;e[71]!==A||e[72]!==G||e[73]!==te?(X=o.jsxs(fr,{children:[A,G,te]}),e[71]=A,e[72]=G,e[73]=te,e[74]=X):X=e[74];let Z;e[75]!==h||e[76]!==u||e[77]!==N||e[78]!==C||e[79]!==X||e[80]!==j?(Z=o.jsxs(mE,{open:h,onOpenChange:u,title:j,description:N,className:"sm:max-w-lg",filter:lie,children:[C,X]}),e[75]=h,e[76]=u,e[77]=N,e[78]=C,e[79]=X,e[80]=j,e[81]=Z):Z=e[81];let ee;return e[82]!==Z||e[83]!==k?(ee=o.jsxs(o.Fragment,{children:[k,Z]}),e[82]=Z,e[83]=k,e[84]=ee):ee=e[84],ee}const hie="website/sections/Rendering/Lazy.tsx";function Cf(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function lx(t){if(!Cf(t))return!1;const e=t.__resolveType;return typeof e=="string"&&Cs(e)}function fie(t){return t!=null}function Pp(t){if(t==null)return t;if(lx(t)){const e=t.section;return e==null?null:Cf(e)?e:{}}return Cf(t)?t:void 0}function mie(t,e){return t===null?null:lx(e)?{...e,section:t}:t}function Wge(t){return{__resolveType:t}}function qge(t,e){if(!fie(e))return null;if(t){const s=Pp(e)??{};return{__resolveType:hie,section:s}}return lx(e)?Pp(e)??null:Cf(e)?e:null}const pie="General";function ed(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function Gk(t,e){return t===ea?pie:e}function Yk(t){const e=gf(t),s=new Set,n=[];for(const r of e)ed(r.resolveType)&&(ir(r.resolveType)||s.has(r.resolveType)||(s.add(r.resolveType),n.push({resolveType:r.resolveType,title:Gk(r.resolveType,r.title),description:r.description})));return n}function cx(t){const e=pf(t),s=$n(e,t),n=Yk(s?.properties?.seo);return n.length>0?n:gie(t)}function gie(t){const e=t.manifest?.blocks??{},s=[];for(const[n,r]of Object.entries(e))if(n.includes("sections"))for(const i of Object.keys(r)){if(!ed(i))continue;const a=i.split("/").pop()?.replace(/\.tsx?$/,"")??i;s.push({resolveType:i,title:Gk(i,a)})}return s}function Qk(t){const e=cx(t),s=e.find(n=>n.resolveType===ea);return s?s.resolveType:e[0]?.resolveType??ea}function Xk(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=$n(s,t),r=Yk(n?.properties?.seo);if(r.length>0)return r}return cx(t)}function xie(t,e){const s=Xk(t,e),n=s.find(r=>r.resolveType===ea);return n?n.resolveType:s[0]?.resolveType??Qk(t)}function bie(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:Qk(t)}function vie(t,e,s){const n=s.__resolveType;return typeof n=="string"&&ed(n)?n:xie(t,e)}const yie=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),ea="website/sections/Seo/SeoV2.tsx",_ie=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function hu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Lie(t){return typeof t.__resolveType=="string"&&ed(t.__resolveType)?!0:_ie.some(e=>e in t)}function wie(t,e){for(const[s,n]of Object.entries(t)){if(!hu(n))continue;const r=n,i=r.__resolveType;if(typeof i=="string"&&yie.has(i))continue;const a=r.seo;if(hu(a)){const l=a;if(Lie(l))return{blockKey:s,kind:"nested",seoData:l,blockData:r,seoResolveType:e?vie(e,r,l):typeof l.__resolveType=="string"&&ed(l.__resolveType)?l.__resolveType:ea}}}for(const[s,n]of Object.entries(t)){if(!hu(n))continue;const r=n;if(typeof r.__resolveType=="string"&&ed(r.__resolveType))return{blockKey:s,kind:"block",seoData:r,blockData:r,seoResolveType:r.__resolveType}}return null}function Sie(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function Gge(t,e,s){if(e.kind==="site"){const c=wie(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?Xk(s,c.blockData):void 0,build:d=>Sie(c,d)}:null}const n=t[e.pageKey];if(!hu(n))return null;const r=n,i=r.seo,a=Pp(i),l=a&&hu(a)?a:void 0;return{blockKey:e.pageKey,seoData:l,rawSeoData:i,seoResolveType:s?bie(s,l):typeof l?.__resolveType=="string"?l.__resolveType:ea,seoTypeOptions:s?cx(s):void 0,build:c=>({...r,seo:c===null?null:mie(c,i)})}}const dx=["type","title","description","canonical","noIndexing","favicon","image","themeColor"],kie=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],jie=["jsonLD","title","description","noIndexing","configJsonLD"];function Jk(t){return t===ea||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function Cie(t){switch(t){case"general":return dx;case"pdp":return kie;case"plp":return jie;default:return null}}function Zk(t,e){const s=Cie(Jk(e));if(!s||!t.properties)return t;const n={};for(const r of s){const i=t.properties[r];i&&(n[r]=i)}return{...t,properties:n}}function Nie(){return dx.filter(t=>t!=="type")}function Vie(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function Tie(t,e){return t[e]===void 0}function Pie(t){const e=U.c(13),{schema:s,value:n,onChange:r,siteDefaultSeo:i,formResetKey:a}=t,l=ue(),d=Zk(s,ea).properties??{},h=Nie();let u;e[0]!==i?(u=!!i&&Object.keys(i).length>0,e[0]=i,e[1]=u):u=e[1];const f=u,[m,p]=P.useState(a);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=P.useState(g);m!==a&&(p(a),b({}));let v;e[3]!==x||e[4]!==n?(v=j=>x[j]!==void 0?x[j]:Tie(n,j),e[3]=x,e[4]=n,e[5]=v):v=e[5];const _=v;let L;e[6]!==r||e[7]!==i||e[8]!==n?(L=(j,N)=>{b(C=>({...C,[j]:N}));const V={...n};if(N)delete V[j];else{const C=i?.[j];V[j]=C??(j==="type"?"website":"")}r(V)},e[6]=r,e[7]=i,e[8]=n,e[9]=L):L=e[9];const y=L,w="min-w-0 space-y-6",S=dx.map(j=>{const N=d[j];if(!N)return null;const V=f&&h.includes(j),C=V&&_(j),T=C?i?.[j]??n[j]:n[j],A=N.title??Vie(j);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:le(C&&"pointer-events-none opacity-60"),children:Ga({schema:N,value:T,onChange:R=>{C||r({...n,[j]:R})},path:j,label:A,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:Aie})}),V&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rr,{id:`seo-use-default-${j}`,checked:C,onCheckedChange:R=>y(j,R)}),o.jsx(At,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:l("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let k;return e[10]!==a||e[11]!==S?(k=o.jsx("div",{className:w,children:S},a),e[10]=a,e[11]=S,e[12]=k):k=e[12],k}function Aie(){}function Eie(t){const e=U.c(18),{schema:s,resolveType:n,value:r,formResetKey:i,onChange:a,onBreadcrumbChange:l,siteDefaultSeo:c}=t;if(Jk(n)==="general"){let g;e[0]!==a?(g=b=>a(b),e[0]=a,e[1]=g):g=e[1];let x;return e[2]!==i||e[3]!==s||e[4]!==c||e[5]!==g||e[6]!==r?(x=o.jsx(Pie,{schema:s,value:r,onChange:g,siteDefaultSeo:c,formResetKey:i}),e[2]=i,e[3]=s,e[4]=c,e[5]=g,e[6]=r,e[7]=x):x=e[7],x}let h;e[8]!==n||e[9]!==s?(h=Zk(s,n),e[8]=n,e[9]=s,e[10]=h):h=e[10];const u=h;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const m=l??Rie;let p;return e[12]!==u||e[13]!==i||e[14]!==a||e[15]!==m||e[16]!==r?(p=o.jsx(Hr,{schema:u,value:r,onChange:a,basePath:"",breadcrumbPath:f,onBreadcrumbChange:m},i),e[12]=u,e[13]=i,e[14]=a,e[15]=m,e[16]=r,e[17]=p):p=e[17],p}function Rie(){}function Die(t){const e=U.c(16),{schema:s,value:n,onChange:r,meta:i,decofile:a,onSaveReferencedBlock:l,sandbox:c}=t,d=ue();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[u,f]=P.useState(h);let m;e[1]!==u||e[2]!==d?(m=u.length>0&&o.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[o.jsx("button",{type:"button",onClick:()=>f([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:o.jsx(qh,{className:"size-3.5"})}),u.map((x,b)=>{const v=b===u.length-1,_=kn(x);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&o.jsx(Us,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(u.slice(0,b+1)),title:_,className:le("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",v?"font-medium text-foreground":"text-muted-foreground"),children:_})]},`${_}-${b}`)})]}),e[1]=u,e[2]=d,e[3]=m):m=e[3];let p;e[4]!==u||e[5]!==a||e[6]!==i||e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==n?(p=o.jsx(Hr,{schema:s,value:n,onChange:r,basePath:"",breadcrumbPath:u,onBreadcrumbChange:f,meta:i,decofile:a,onSaveReferencedBlock:l,sandbox:c}),e[4]=u,e[5]=a,e[6]=i,e[7]=r,e[8]=l,e[9]=c,e[10]=s,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"space-y-2",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function Yge(t){const e=U.c(23),{activeSchema:s,formValue:n,formResetKey:r,onFormChange:i,onBreadcrumbChange:a,breadcrumbPath:l,emptyMessage:c,beforeForm:d,seoResolveType:h,siteDefaultSeo:u,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let v;e[0]!==l?(v=l===void 0?[]:l,e[0]=l,e[1]=v):v=e[1];const _=v;let L;e[2]!==s||e[3]!==_||e[4]!==m||e[5]!==r||e[6]!==n||e[7]!==f||e[8]!==a||e[9]!==i||e[10]!==b||e[11]!==p||e[12]!==x||e[13]!==g||e[14]!==h||e[15]!==u?(L=s&&n?h?o.jsx(Eie,{schema:s,resolveType:h,value:n,formResetKey:r,onChange:i,onBreadcrumbChange:a,siteDefaultSeo:u}):o.jsx(Hr,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:_,onBreadcrumbChange:a,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},r):null,e[2]=s,e[3]=_,e[4]=m,e[5]=r,e[6]=n,e[7]=f,e[8]=a,e[9]=i,e[10]=b,e[11]=p,e[12]=x,e[13]=g,e[14]=h,e[15]=u,e[16]=L):L=e[16];const y=L;let w;e[17]!==c||e[18]!==y?(w=y??o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=y,e[19]=w):w=e[19];let S;return e[20]!==d||e[21]!==w?(S=o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[d,w]})}),e[20]=d,e[21]=w,e[22]=S):S=e[22],S}const Qge="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function Xge(t,e){return Oee(t,e,Zc)}function Jge(t){const e=U.c(69),{pageKey:s,initialName:n,initialPath:r,onFieldChange:i}=t,a=ue(),[l,c]=P.useState(n),[d,h]=P.useState(r),[u,f]=P.useState(s),[m,p]=P.useState(null),g=P.useRef(!1),[x,b]=P.useState(null);u!==s&&(f(s),c(n),h(r),p(null),b(null));let v;e[0]!==r||e[1]!==d?(v=()=>{if(g.current){g.current=!1;return}const ee=d.trim();if(ee===r.trim()){h(r),b(null);return}const se=F9(ee);if(se){b(se),h(r);return}b(null),p(ee)},e[0]=r,e[1]=d,e[2]=v):v=e[2];const _=v;let L;e[3]!==i||e[4]!==m?(L=()=>{m!==null&&(h(m),i("path",m),p(null))},e[3]=i,e[4]=m,e[5]=L):L=e[5];const y=L;let w;e[6]!==r?(w=()=>{h(r),p(null)},e[6]=r,e[7]=w):w=e[7];const S=w;let k;e[8]!==i?(k=ee=>{c(ee.target.value),i("name",ee.target.value)},e[8]=i,e[9]=k):k=e[9];let j;e[10]!==a?(j=a("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=a,e[11]=j):j=e[11];let N;e[12]!==l||e[13]!==k||e[14]!==j?(N=o.jsx("input",{type:"text",value:l,onChange:k,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:j}),e[12]=l,e[13]=k,e[14]=j,e[15]=N):N=e[15];let V;e[16]===Symbol.for("react.memo_cache_sentinel")?(V=ee=>{h(ee.target.value),b(null)},e[16]=V):V=e[16];let C;e[17]!==r?(C=ee=>{ee.key==="Enter"?(ee.preventDefault(),ee.currentTarget.blur()):ee.key==="Escape"&&(ee.preventDefault(),g.current=!0,h(r),b(null),ee.currentTarget.blur())},e[17]=r,e[18]=C):C=e[18];let T;e[19]!==a?(T=a("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[19]=a,e[20]=T):T=e[20];let A;e[21]!==_||e[22]!==d||e[23]!==C||e[24]!==T?(A=o.jsx("input",{type:"text",value:d,onChange:V,onBlur:_,onKeyDown:C,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:T}),e[21]=_,e[22]=d,e[23]=C,e[24]=T,e[25]=A):A=e[25];let R;e[26]!==x?(R=x&&o.jsx("p",{className:"text-xs text-destructive",children:x}),e[26]=x,e[27]=R):R=e[27];const E=m!==null;let I;e[28]!==S?(I=ee=>{ee||S()},e[28]=S,e[29]=I):I=e[29];let D;e[30]!==a?(D=a("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[30]=a,e[31]=D):D=e[31];let O;e[32]!==D?(O=o.jsx(Yi,{children:D}),e[32]=D,e[33]=O):O=e[33];const $=m??"";let M;e[34]!==r||e[35]!==a||e[36]!==$?(M=a("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:r,to:$}),e[34]=r,e[35]=a,e[36]=$,e[37]=M):M=e[37];let z;e[38]!==M?(z=o.jsx(Qi,{children:M}),e[38]=M,e[39]=z):z=e[39];let F;e[40]!==O||e[41]!==z?(F=o.jsxs(Gi,{children:[O,z]}),e[40]=O,e[41]=z,e[42]=F):F=e[42];let B;e[43]!==a?(B=a("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[43]=a,e[44]=B):B=e[44];let H;e[45]!==B?(H=o.jsx(Ji,{children:B}),e[45]=B,e[46]=H):H=e[46];let W;e[47]!==y?(W=ee=>{ee.preventDefault(),y()},e[47]=y,e[48]=W):W=e[48];let K;e[49]!==a?(K=a("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[49]=a,e[50]=K):K=e[50];let q;e[51]!==W||e[52]!==K?(q=o.jsx(Zi,{onClick:W,children:K}),e[51]=W,e[52]=K,e[53]=q):q=e[53];let G;e[54]!==H||e[55]!==q?(G=o.jsxs(Xi,{children:[H,q]}),e[54]=H,e[55]=q,e[56]=G):G=e[56];let te;e[57]!==F||e[58]!==G?(te=o.jsxs(qi,{children:[F,G]}),e[57]=F,e[58]=G,e[59]=te):te=e[59];let X;e[60]!==E||e[61]!==I||e[62]!==te?(X=o.jsx(Wi,{open:E,onOpenChange:I,children:te}),e[60]=E,e[61]=I,e[62]=te,e[63]=X):X=e[63];let Z;return e[64]!==A||e[65]!==R||e[66]!==X||e[67]!==N?(Z=o.jsxs("div",{className:"space-y-1",children:[N,A,R,X]}),e[64]=A,e[65]=R,e[66]=X,e[67]=N,e[68]=Z):Z=e[68],Z}function Zge(t){const e=U.c(13),{onClick:s}=t,n=ue();let r;e[0]!==n?(r=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=n,e[1]=r):r=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(xg,{size:14}),e[2]=i):i=e[2];let a;e[3]!==s||e[4]!==r?(a=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":r,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:i})}),e[3]=s,e[4]=r,e[5]=a):a=e[5];let l;e[6]!==n?(l=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=l):l=e[7];let c;e[8]!==l?(c=o.jsx(We,{side:"bottom",children:l}),e[8]=l,e[9]=c):c=e[9];let d;return e[10]!==a||e[11]!==c?(d=o.jsxs(qe,{children:[a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12],d}const ev=new WeakMap;function Mie(t,e){let s=ev.get(e);s||(s=new Map,ev.set(e,s));let n=s.get(t);return n===void 0&&(n=$n(t,e),s.set(t,n)),n}function Iie(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function Oie(t,e){return{__resolveType:e,variants:[{rule:Xc(),value:structuredClone(t)},{rule:Xc(),value:structuredClone(t)}]}}function $ie(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>U3(n.rule));return s?s.value:e[e.length-1]?.value}function Bie(t){const e=[...t.variants],s=e[e.length-1],n={rule:Xc(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function zie(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function Fie(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function Uie(t,e,s){return e<t?t-1:Math.min(t,s-1)}function Hie(t,e,s){const n=[...t.variants];if(e===s||e<0||s<0||e>=n.length||s>=n.length)return t;const[r]=n.splice(e,1);return r?(n.splice(s,0,r),{...t,variants:n}):t}function Kie(t,e,s){const n=[...t.variants],r=n[e];return r?(n[e]={...r,value:s},{...t,variants:n}):t}function tv(t,e,s){const n=[...t.variants],r=n[e];return r?(n[e]={...r,rule:s},{...t,variants:n}):t}const sv=new WeakMap;function Wie(t){let e=sv.get(t);return e||(e=cie(t),sv.set(t,e)),e}function ej(t){const e=U.c(13),{multivariateResolveType:s,renderInnerField:n,...r}=t,i=ue(),{value:a,onChange:l,meta:c,path:d}=r,[h,u]=P.useState(0);if(!Iie(a)){let $;e[0]!==i?($=i("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=i,e[1]=$):$=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(xg,{size:14}),e[2]=M):M=e[2];let z;e[3]!==i?(z=i("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=i,e[4]=z):z=e[4];let F;return e[5]!==z?(F=o.jsx(We,{children:z}),e[5]=z,e[6]=F):F=e[6],o.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":$,onClick:()=>{l(Oie(a,s)),u(0)},children:M})}),F]}),n(r)]})}const f=a,m=f.variants,p=Math.min(h,m.length-1);let g;e[7]!==i?(g=($,M)=>({index:M,label:Zc($.rule)||i("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=i,e[8]=g):g=e[8];const x=m.map(g),b=m[p],v=b?.rule??{},_=v.__resolveType??"",L=b?.value,y=c?Wie(c):[],w=_&&c?Mie(_,c):null,{__resolveType:S,...k}=v,j=()=>{l($ie(f)),u(0)},N=()=>{const $=Bie(f);l($),u($.variants.length-1)},V=$=>{const M=zie(f,$);M&&(l(M),u(Uie(p,$,M.variants.length)))},C=$=>{const M=Fie(f,$);l(M),u($+1)},T=($,M)=>{const z=Hie(f,$,M);l(z),p===$&&u(M)},A=$=>{const M=$?lee($,c):{__resolveType:R3};l(tv(f,p,M))},R=$=>{const M=$,z=_?{...M,__resolveType:_}:{...M};l(tv(f,p,z))},E=$=>{l(Kie(f,p,$))},I=`${d}-${f.__resolveType}`;let D;e[9]!==i?(D=i("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=i,e[10]=D):D=e[10];let O;return e[11]!==D?(O=o.jsx(At,{className:"text-xs text-muted-foreground",children:D}),e[11]=D,e[12]=O):O=e[12],o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[o.jsx(nie,{listKey:I,variants:x,selectedIndex:p,onSelect:u,onDuplicate:C,onDelete:V,onRemoveAll:j,onReorder:T,onAdd:N}),o.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[O,o.jsx(uie,{currentRt:_,currentLabel:Zc(v),matchers:y,onSelect:A}),w&&o.jsx("div",{className:"pt-1",children:o.jsx(Die,{schema:w,value:k,onChange:R,meta:c,decofile:r.decofile,onSaveReferencedBlock:r.onSaveReferencedBlock,sandbox:r.sandbox},`${p}-${_}`)})]}),n({...r,value:L,onChange:E})]})]})}const qie="website/loaders/secret.ts";function fu(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function Gie(){return{__resolveType:qie,name:"",encrypted:""}}function Yie(t){const{value:e,...s}=t;return s}function Z1(t){const e=U.c(53),{schema:s,value:n,onChange:r,label:i,path:a,sandbox:l}=t,c=ue();if(typeof n=="string"||n==null&&!fu(n)){const N=typeof n=="string"?n:"",V=l?.virtualMcpId;let C;e[0]!==i||e[1]!==a||e[2]!==s.description||e[3]!==V?(C=o.jsx(zs,{htmlFor:a,label:i,description:s.description,virtualMcpId:V}),e[0]=i,e[1]=a,e[2]=s.description,e[3]=V,e[4]=C):C=e[4];let T;e[5]!==c?(T=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=T):T=e[6];let A;e[7]!==r?(A=I=>r(I.target.value),e[7]=r,e[8]=A):A=e[8];let R;e[9]!==a||e[10]!==N||e[11]!==T||e[12]!==A?(R=o.jsx(yt,{id:a,type:"password",value:N,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:T,onChange:A,className:"h-10"}),e[9]=a,e[10]=N,e[11]=T,e[12]=A,e[13]=R):R=e[13];let E;return e[14]!==C||e[15]!==R?(E=o.jsxs("div",{className:"space-y-2",children:[C,R]}),e[14]=C,e[15]=R,e[16]=E):E=e[16],E}let d;e[17]!==n?(d=fu(n)?n:Gie(),e[17]=n,e[18]=d):d=e[18];const h=d,u=typeof h.name=="string"?h.name:"",f=typeof h.encrypted=="string"&&h.encrypted,m=`${a}-name`,p=l?.virtualMcpId;let g;e[19]!==i||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=o.jsx(zs,{htmlFor:m,label:i,description:s.description,virtualMcpId:p}),e[19]=i,e[20]=s.description,e[21]=m,e[22]=p,e[23]=g):g=e[23];const x=`${a}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let v;e[26]!==h||e[27]!==r?(v=N=>r({...h,name:N.target.value}),e[26]=h,e[27]=r,e[28]=v):v=e[28];let _;e[29]!==u||e[30]!==x||e[31]!==b||e[32]!==v?(_=o.jsx(yt,{id:x,value:u,placeholder:b,onChange:v,className:"h-10"}),e[29]=u,e[30]=x,e[31]=b,e[32]=v,e[33]=_):_=e[33];const L=`${a}-value`;let y;e[34]!==f||e[35]!==c?(y=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=y):y=e[36];let w;e[37]!==h||e[38]!==f||e[39]!==r?(w=N=>{const V=N.target.value;if(!V){r(f?Yie(h):h);return}r({...h,value:V})},e[37]=h,e[38]=f,e[39]=r,e[40]=w):w=e[40];let S;e[41]!==y||e[42]!==w||e[43]!==L?(S=o.jsx(yt,{id:L,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:y,onChange:w,className:"h-10"}),e[41]=y,e[42]=w,e[43]=L,e[44]=S):S=e[44];let k;e[45]!==f||e[46]!==c?(k=f&&o.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=f,e[46]=c,e[47]=k):k=e[47];let j;return e[48]!==S||e[49]!==k||e[50]!==g||e[51]!==_?(j=o.jsxs("div",{className:"space-y-2",children:[g,_,S,k]}),e[48]=S,e[49]=k,e[50]=g,e[51]=_,e[52]=j):j=e[52],j}function Qie(t,e){const s=t.anyOfRefs;if(!s?.length)return;const n=e.find(d=>d!=null&&typeof d=="object"&&!Array.isArray(d)),r=n?Object.keys(n).filter(d=>!d.startsWith("__")):[],i=[],a=d=>{d?.type==="object"&&d.properties&&i.push(d)};for(const d of s){const h=d.schema;if(h&&(h.type==="array"&&a(h.items),h.properties))for(const u of Object.values(h.properties))u?.type==="array"&&a(u.items)}if(i.length===0)return;if(r.length===0)return i.length===1?i[0]:void 0;let l,c=-1;for(const d of i){const h=d.properties??{},u=r.filter(f=>f in h).length*2+(d.titleBy?1:0);u>c&&(c=u,l=d)}return c>=2?l:void 0}function Xie(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const s={};for(const[n,r]of Object.entries(e))n.startsWith("__")||(typeof r=="string"?s[n]={type:"string"}:typeof r=="number"?s[n]={type:"number"}:typeof r=="boolean"&&(s[n]={type:"boolean"}));return Object.keys(s).length>0?{type:"object",properties:s}:void 0}const Jie=new Set(["__resolveType","@type"]);function Zie(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return!1;const e=t.anyOfRefs[0].schema;return!!(e?.properties?.variants||!e&&t.plainSchema)}function eoe(t){if(H9(t))for(const e of t.anyOfRefs??[]){const r=e.schema?.properties?.variants?.items?.properties?.value;if(r?.type==="array"&&r.items)return r.items}}function nv(t){if(t.type==="array"&&t.items)return t;const e=t.items??eoe(t);return e?{...t,type:"array",items:e}:null}function toe(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function tj(t){const{value:e,meta:s}=t;if(e===null||typeof e!="object"||Array.isArray(e))return null;const n=e.__resolveType;if(typeof n!="string"||!s)return null;const r=$n(n,s);return r?o.jsx(Hr,{schema:r,value:e,onChange:t.onChange,basePath:t.path,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:s,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection,sandbox:t.sandbox},t.path):null}function Ga(t){const{schema:e,value:s}=t;if(_f(s)){const a=Dee(s),l=nv(e);if(a!==null&&l)return o.jsx(dh,{...t,schema:l,value:a,onChange:c=>t.onChange(Mee(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&H9(e)){const a=nv(e);if(a)return o.jsx(dh,{...t,schema:a,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!_f(s)&&e.type==="block-ref"){const a=Qie(e,s)??Xie(s);if(a){const l={...e,type:"array",items:a};return o.jsx(dh,{...t,schema:l,value:s,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||s!==null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.__resolveType=="string"&&e.anyOfRefs){if(Zie(e)){const a=e.anyOfRefs[0],l=a.schema?.properties?.variants?.items?.properties?.value,c=l&&l.type!=="block-ref"?l:e.plainSchema??l?.plainSchema??{type:"string"},d=h=>Ga({...h,schema:c});return o.jsx(ej,{...t,multivariateResolveType:a.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?o.jsx(qb,{...t},t.path):null}if(e.type==="inline-union")return o.jsx(Ure,{...t},t.path);if(e.format==="image-uri")return o.jsx(Tre,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return o.jsx(Cre,{...t},t.path);if(e.format==="map")return o.jsx(Gre,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return o.jsx(tre,{...t},t.path);if(e.format==="location")return o.jsx(Hk,{...t},t.path);if(e.enum&&e.enum.length>0)return o.jsx(zse,{...t},t.path);if(e.type==="anyOf")return o.jsx(qb,{...t},t.path);if(fu(s)||e.format==="password"||s==null&&e.format==="password")return o.jsx(Z1,{...t},t.path);if(!e.format&&!e.enum){const a=tj(t);if(a)return a}const n=s??toe(e.type,e.default);if(n==null)return fu(s)?o.jsx(Z1,{...t},t.path):null;if(fu(n))return o.jsx(Z1,{...t,value:n},t.path);const r={...t,value:n},i=s==null?e.type??typeof n:Array.isArray(n)?"array":typeof n;if(i==="array"||Array.isArray(n))return o.jsx(dh,{...r},t.path);switch(i){case"boolean":return o.jsx(Mse,{...r},t.path);case"number":case"integer":return o.jsx(Dse,{...r},t.path);case"string":{const a=e.format;return a==="color-input"||a==="color"?o.jsx(lh,{...r},t.path):a==="textarea"||a==="rich-text"||a==="html"?o.jsx(lh,{...r},t.path):o.jsx(lh,{...r},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?o.jsx(Ine,{...r},t.path):null;default:return o.jsx(lh,{...r},t.path)}}function soe(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Ga({...t,schema:e});const s=tj(t);return s||Ga(e?{...t,schema:e}:t)}function Hr({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:r=[],onBreadcrumbChange:i,meta:a,decofile:l,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}){const m=ue(),p=t.properties;if(!p)return t.type==="inline-union"?Ga({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:r,onBreadcrumbChange:i,meta:a,decofile:l,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}):null;if(Ree(e)&&p.variants){const C=p.variants.items?.properties?.value;return o.jsx(ej,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:r,onBreadcrumbChange:i,meta:a,decofile:l,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:T=>soe(T,C)},n)}const g=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},x=Object.keys(p).filter(C=>!Jie.has(C)&&p[C]?.hidden!==!0),b=new Set(t.required??[]);if(x.length===0)return o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sectionsEditor.sectionsEditor.noEditableFields")});const v=(C,T)=>{if(T===void 0){const{[C]:A,...R}=g;s(R);return}s({...g,[C]:T})},_=typeof g.__resolveType=="string"?g.__resolveType:void 0,L=x.filter(C=>{const T=p[C];return T!=null&&Fc(T,g[C])}).length>1,y=gne(x,p,g),w=r.length>0?bne(x,p,g,r,l,a):null,S=w?p[w]:null,k=w&&S?[w]:x,j=w&&S?pne(w,S,r,Iu(w,x,p)):r,N=mne(r,j),V=N.length>0&&i?C=>i([...N,...C]):i;return o.jsx("div",{className:"min-w-0 space-y-6",children:k.map(C=>{const T=p[C];if(!T)return null;const A=n?`${n}.${C}`:C,R=Iu(C,x,p),E=qa(C,T),O=(N.length===0&&x.some($=>{const M=p[$];return $!==C&&M!=null&&qa($,M)===E})||N.length===0&&y.has(C))&&V?T.type==="block-ref"?$=>V(hne(C,$)):$=>V(une(R,$)):V;return Ga({schema:T,value:g[C],onChange:$=>v(C,$),path:A,label:R,required:b.has(C),breadcrumbPath:j,onBreadcrumbChange:O,hasSiblingDrillDownFields:L,focused:w===C,meta:a,decofile:l,onSaveReferencedBlock:c,containerResolveType:_,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f})})})}function noe(t){const e=U.c(3),{isPending:s,isError:n}=t;if(n){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(vn,{size:13}),"Couldn't save"]}),e[0]=i):i=e[0],i}if(s){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(nt,{className:"size-[13px]"}),"Saving…"]}),e[1]=i):i=e[1],i}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[o.jsx($t,{size:13}),"Saved"]}),e[2]=r):r=e[2],r}const rv=3e4;function roe(t,e,s,n){const r=new URL(`/deco/invoke/${e}`,t);return r.searchParams.set("__cb",n.toString(36)),r.searchParams.set("__decoFBT","0"),r.searchParams.set("__d",`run-${n.toString(36)}`),r.searchParams.set("props",btoa(encodeURIComponent(JSON.stringify(s)))),r.href}async function ioe(t,{resolveType:e,props:s}){let n;try{n=await fetch(cS(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(rv)})}catch(l){throw l instanceof DOMException&&l.name==="TimeoutError"?new Error(`Run timed out after ${rv/1e3}s — the block may be slow or the preview unresponsive.`):l}const r=await n.text();let i=null,a=!1;try{i=r?JSON.parse(r):null,a=!0}catch{}if(!n.ok){const l=a&&i&&typeof i=="object"&&"error"in i&&typeof i.error=="string"?i.error:r||`Run failed (${n.status})`;throw new Error(l)}return a?i:r}function ooe(t){const e=U.c(2);let s;return e[0]!==t?(s={mutationFn:n=>ioe(t,n)},e[0]=t,e[1]=s):s=e[1],Rs(s)}function sj({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:r,decofile:i,kind:a,target:l,initialValue:c,isCreating:d,onCreate:h,onSaveReferencedBlock:u,onBack:f,showRun:m=!0}){const p=ws()?.taskId??null,g=ue(),x=lo(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,v=$n(l.resolveType,r),_=!v&&BZ(l.resolveType,r),L=_?zZ(c):null,y=v??L,[w,S]=P.useState(c),[k,j]=P.useState([]),[N,V]=P.useState(0),[C,T]=P.useState(!1),[A,R]=P.useState(null),[E,I]=P.useState(!1),[D,O]=P.useState(!1),[$,M]=P.useState(!1),z=A!==null,{save:F,flush:B,isPending:H}=G3({orgSlug:t,virtualMcpId:e,branch:s}),W=ooe({orgSlug:t,virtualMcpId:e,branch:s,threadId:p});P.useEffect(()=>()=>{B()},[]);const K=tk(a),q=l.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??l.resolveType,G={orgSlug:t,virtualMcpId:e,branch:s,threadId:p,previewUrl:n??void 0,siteSlug:b},te=he=>{S(he),l.mode==="saved"&&F(l.blockKey,{__resolveType:l.resolveType,...he})},X=()=>{z?(R(null),T(!1),V(he=>he+1)):R(JSON.stringify(w,null,2))},Z=he=>{const ne=he??"";try{const Q=JSON.parse(ne);if(Q&&typeof Q=="object"&&!Array.isArray(Q)){T(!1),te(Q);return}T(!0)}catch{T(!0)}},ee=async he=>{const ne=nx(he,i);if(ne){ye.error(ne);return}await h(he,{__resolveType:l.resolveType,...w}),I(!1)},se=()=>{O(!0),W.mutate({resolveType:l.resolveType,props:w})},J=()=>{n&&window.open(roe(n,l.resolveType,w,Date.now()),"_blank","noopener")},oe=[l.title,...k],ce=he=>{j(k.slice(0,he)),V(ne=>ne+1)};return o.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:o.jsx(n9,{size:14})}),o.jsx("nav",{"aria-label":g("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:oe.map((he,ne)=>{const Q=ne===oe.length-1,de=kn(he);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ne>0&&o.jsx(Us,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>ce(ne),title:de,className:le("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",Q?"font-medium text-foreground":"text-muted-foreground"),children:de})]},`${de}-${ne}`)})}),l.mode==="saved"&&o.jsx(noe,{isPending:H,isError:!1}),m&&o.jsxs(me,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:se,disabled:W.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:K}),children:[W.isPending?o.jsx(nt,{className:"size-3.5"}):o.jsx(Oa,{size:14}),g("sandbox.runnableBlockEditor.run")]}),l.mode==="available"&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>I(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:K}),children:o.jsx(W2,{size:14})})}),o.jsx(We,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:K})})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:z?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:X,"aria-label":g(z?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":z,children:z?o.jsx(nn,{size:14}):o.jsx(rd,{size:14})})}),o.jsx(We,{side:"bottom",children:g(z?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:l.mode==="saved"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:K}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:q,singular:K})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("div",{className:le("relative min-h-0 flex-1",D&&$&&"hidden"),children:[o.jsx(rl,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[L&&y===L&&o.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:g("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:K})}),y?o.jsx(Hr,{schema:y,value:w,onChange:he=>te(he),basePath:"",breadcrumbPath:k,onBreadcrumbChange:j,meta:r,decofile:i,onSaveReferencedBlock:u,sandbox:G},N):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:_?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:K}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:K})})]})})}),A!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[C&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:g("sandbox.runnableBlockEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ud,{language:"json",height:"100%",code:A,onChange:Z,onSave:he=>{Z(he),B()}})})]})]}),D&&o.jsx(aoe,{singular:K,result:{isPending:W.isPending,error:W.error,data:W.data,hasRun:W.status!=="idle"},expanded:$,onToggleExpand:()=>M(he=>!he),onOpenInNewTab:n?J:void 0,onClose:()=>{O(!1),M(!1)}})]}),o.jsx(rx,{open:E,onOpenChange:I,defaultBlockId:"",isPending:d,onSubmit:ee})]})}function aoe(t){const e=U.c(54),{singular:s,result:n,expanded:r,onToggleExpand:i,onOpenInNewTab:a,onClose:l}=t,c=ue();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const h=d,u=r?"flex-1":"h-[45%] shrink-0";let f;e[2]!==u?(f=le("flex min-h-0 flex-col border-t",u),e[2]=u,e[3]=f):f=e[3];let m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:m}),e[6]=m,e[7]=p):p=e[7];let g;e[8]!==a||e[9]!==s||e[10]!==c?(g=a&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:o.jsx(fn,{size:14})})}),o.jsx(We,{side:"bottom",children:c("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:s})})]}),e[8]=a,e[9]=s,e[10]=c,e[11]=g):g=e[11];let x;e[12]!==r||e[13]!==c?(x=c(r?"sandbox.runnableBlockEditor.collapseResult":"sandbox.runnableBlockEditor.expandResult"),e[12]=r,e[13]=c,e[14]=x):x=e[14];let b;e[15]!==r?(b=r?o.jsx(WT,{size:14}):o.jsx(G6,{size:14}),e[15]=r,e[16]=b):b=e[16];let v;e[17]!==r||e[18]!==i||e[19]!==x||e[20]!==b?(v=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:i,"aria-label":x,"aria-pressed":r,children:b})}),e[17]=r,e[18]=i,e[19]=x,e[20]=b,e[21]=v):v=e[21];let _;e[22]!==r||e[23]!==c?(_=c(r?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=r,e[23]=c,e[24]=_):_=e[24];let L;e[25]!==_?(L=o.jsx(We,{side:"bottom",children:_}),e[25]=_,e[26]=L):L=e[26];let y;e[27]!==L||e[28]!==v?(y=o.jsxs(qe,{children:[v,L]}),e[27]=L,e[28]=v,e[29]=y):y=e[29];let w;e[30]!==c?(w=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=w):w=e[31];let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(nn,{size:14}),e[32]=S):S=e[32];let k;e[33]!==l||e[34]!==w?(k=o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":w,children:S}),e[33]=l,e[34]=w,e[35]=k):k=e[35];let j;e[36]!==y||e[37]!==k||e[38]!==g?(j=o.jsxs("div",{className:"flex items-center gap-0.5",children:[g,y,k]}),e[36]=y,e[37]=k,e[38]=g,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==p?(N=o.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[p,j]}),e[40]=j,e[41]=p,e[42]=N):N=e[42];let V;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==h||e[47]!==s||e[48]!==c?(V=o.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?o.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[o.jsx(nt,{className:"size-4"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?o.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[o.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),o.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?o.jsx(ud,{language:"json",height:"100%",code:h,readOnly:!0}):o.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:c("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:s})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=h,e[47]=s,e[48]=c,e[49]=V):V=e[49];let C;return e[50]!==N||e[51]!==V||e[52]!==f?(C=o.jsxs("div",{className:f,children:[N,V]}),e[50]=N,e[51]=V,e[52]=f,e[53]=C):C=e[53],C}function loe(t){const e=U.c(29),{orgSlug:s,virtualMcpId:n,branch:r,previewUrl:i,meta:a,decofile:l,blockKey:c}=t,d=ue();let h;e[0]!==r||e[1]!==s||e[2]!==n?(h={orgSlug:s,virtualMcpId:n,branch:r},e[0]=r,e[1]=s,e[2]=n,e[3]=h):h=e[3];const u=w0(h);let f;e[4]!==u?(f=Q3((y,w)=>u.mutate({blockKey:y,data:w})),e[4]=u,e[5]=f):f=e[5];const m=f;let p;e[6]!==c||e[7]!==l?(p=ok(l,c),e[6]=c,e[7]=l,e[8]=p):p=e[8];const{resolveType:g,props:x,title:b}=p;if(!g){let y;e[9]!==d?(y=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=y):y=e[10];let w;return e[11]!==y?(w=o.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:y}),e[11]=y,e[12]=w):w=e[12],w}const v=`loader:${c}`;let _;e[13]!==c||e[14]!==g||e[15]!==b?(_={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=_):_=e[16];let L;return e[17]!==r||e[18]!==l||e[19]!==a||e[20]!==s||e[21]!==i||e[22]!==x||e[23]!==u.isPending||e[24]!==m||e[25]!==v||e[26]!==_||e[27]!==n?(L=o.jsx(sj,{orgSlug:s,virtualMcpId:n,branch:r,previewUrl:i,meta:a,decofile:l,kind:"loaders",target:_,initialValue:x,isCreating:u.isPending,onCreate:coe,onSaveReferencedBlock:m,showRun:!1},v),e[17]=r,e[18]=l,e[19]=a,e[20]=s,e[21]=i,e[22]=x,e[23]=u.isPending,e[24]=m,e[25]=v,e[26]=_,e[27]=n,e[28]=L):L=e[28],L}async function coe(){}function doe(t){if(t instanceof Error&&"status"in t&&typeof t.status=="number")return t.status}function iv(t){return{status:t.status,hasData:t.data!==void 0,errorStatus:doe(t.error)}}function uoe(t){switch(t){case"clone-failed":case"install-failed":case"start-failed":return"terminal-error";case"idle":case"cloning":return"booting";case"checking-out":case"installing":case"starting":case"running":case"crashed":return"snapshot-readable"}}function hoe(t){if(t.fastPreviewActive)return t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData?{kind:"error",source:"data"}:!t.decofile.hasData||!t.meta.hasData?{kind:"loading"}:t.hasEditableContent?{kind:"content"}:{kind:"empty",reason:"no-content"};const e=uoe(t.lifecyclePhase);if(e==="terminal-error")return{kind:"error",source:"sandbox"};if(e==="booting")return{kind:"loading"};const s=t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData;return s&&t.lifecyclePhase==="checking-out"?{kind:"loading"}:[t.decofile,t.meta].some(r=>r.status==="error"&&!r.hasData&&r.errorStatus===404)?{kind:"empty",reason:"framework-missing"}:s?t.lifecyclePhase==="running"||t.lifecyclePhase==="crashed"?{kind:"error",source:"data"}:{kind:"loading"}:!t.decofile.hasData||!t.meta.hasData?{kind:"loading"}:t.hasEditableContent?{kind:"content"}:{kind:"empty",reason:"no-content"}}const foe="https://github.com/decocms/blocks";function moe(){const t=U.c(14),e=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(qT,{size:48,className:"text-muted-foreground"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("mainPanelTabs.blocksTabStates.emptyStateTitle"),t[1]=e,t[2]=n):n=t[2];let r;t[3]!==e?(r=e("mainPanelTabs.blocksTabStates.emptyStateDescription"),t[3]=e,t[4]=r):r=t[4];let i;t[5]!==e?(i=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=i):i=t[6];let a;t[7]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(fn,{size:14}),t[7]=a):a=t[7];let l;t[8]!==i?(l=o.jsx(me,{size:"sm",asChild:!0,children:o.jsxs("a",{href:foe,target:"_blank",rel:"noreferrer",children:[i,a]})}),t[8]=i,t[9]=l):l=t[9];let c;return t[10]!==n||t[11]!==r||t[12]!==l?(c=o.jsx(Dr,{className:"h-full w-full",image:s,title:n,description:r,actions:l}),t[10]=n,t[11]=r,t[12]=l,t[13]=c):c=t[13],c}function poe(t){const e=U.c(15),{source:s,onRetry:n}=t,r=ue();let i;e[0]!==s||e[1]!==r?(i=r(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=r,e[2]=i):i=e[2];const a=i;let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(vn,{size:48,className:"text-muted-foreground"}),e[3]=l):l=e[3];let c;e[4]!==r?(c=r("mainPanelTabs.blocksTabStates.errorStateTitle"),e[4]=r,e[5]=c):c=e[5];let d;e[6]!==r?(d=r("mainPanelTabs.blocksTabStates.retry"),e[6]=r,e[7]=d):d=e[7];let h;e[8]!==n||e[9]!==d?(h=o.jsx(me,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=h):h=e[10];let u;return e[11]!==a||e[12]!==c||e[13]!==h?(u=o.jsx(Dr,{image:l,title:c,description:a,actions:h}),e[11]=a,e[12]=c,e[13]=h,e[14]=u):u=e[14],u}const goe=P.lazy(()=>Ks(()=>import("./sections-editor-BsuMEuNO.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SectionsEditor})));function ov(t){const e=U.c(49),{virtualMcpId:s,externalSelection:n,onViewJsonFile:r}=t,i=n===void 0?null:n,{org:a}=Fe(),{currentBranch:l,taskId:c}=an(),d=mr(),h=ca(),u=lk(),f=d.lifecycle.phase==="running",m=h.previewUrl;let p;e[0]!==l||e[1]!==a||e[2]!==m||e[3]!==c||e[4]!==s?(p=l?{orgSlug:a.slug,virtualMcpId:s,branch:l,threadId:c??null,previewUrl:m}:null,e[0]=l,e[1]=a,e[2]=m,e[3]=c,e[4]=s,e[5]=p):p=e[5];const g=p;let x;e[6]!==f?(x={fetchEnabled:f},e[6]=f,e[7]=x):x=e[7];const b=B9(g,x);let v;e[8]!==f?(v={fetchEnabled:f},e[8]=f,e[9]=v):v=e[9];const _=z3(g,v),L=hoe({lifecyclePhase:d.lifecycle.phase,decofile:iv(b),meta:iv(_),hasEditableContent:VS(b.data,_.data),fastPreviewActive:_n(s).runtime==="cms"}),y=xoe;if(L.kind==="loading"){let M;return e[10]===Symbol.for("react.memo_cache_sentinel")?(M=y(o.jsx(Pa,{})),e[10]=M):M=e[10],M}if(L.kind==="empty"){let M;return e[11]===Symbol.for("react.memo_cache_sentinel")?(M=y(o.jsx(moe,{})),e[11]=M):M=e[11],M}if(L.kind==="error"){let M;e[12]!==b||e[13]!==h||e[14]!==_||e[15]!==L.source?(M=()=>{if(L.source==="sandbox"){h.retry();return}Promise.all([b.refetch(),_.refetch()])},e[12]=b,e[13]=h,e[14]=_,e[15]=L.source,e[16]=M):M=e[16];const z=M;let F;return e[17]!==z||e[18]!==L.source?(F=y(o.jsx(poe,{source:L.source,onRetry:z})),e[17]=z,e[18]=L.source,e[19]=F):F=e[19],F}let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=M=>y(o.jsx("div",{className:"h-full min-h-0",children:M})),e[20]=w):w=e[20];const S=w,k=u.state.target;if(k?.kind==="loader"&&b.data&&_.data){const M=l??"",z=m??null;let F;return e[21]!==b.data||e[22]!==_.data||e[23]!==a.slug||e[24]!==M||e[25]!==z||e[26]!==k.key||e[27]!==s?(F=S(o.jsx(loe,{orgSlug:a.slug,virtualMcpId:s,branch:M,previewUrl:z,meta:_.data,decofile:b.data,blockKey:k.key})),e[21]=b.data,e[22]=_.data,e[23]=a.slug,e[24]=M,e[25]=z,e[26]=k.key,e[27]=s,e[28]=F):F=e[28],F}let j;e[29]!==l||e[30]!==a.slug||e[31]!==k||e[32]!==s?(j=k||!l?null:K3(H3(a.slug,s,l)),e[29]=l,e[30]=a.slug,e[31]=k,e[32]=s,e[33]=j):j=e[33];const N=j;let V="/",C=null,T=null;k?.kind==="page"?(V=k.path,C=k.key):k?.kind==="section"?T=k.key:N&&(V=N.path,C=N.pageKey);const A=C?`page:${C}`:T?`section:${T}`:`path:${V}`;let R;e[34]===Symbol.for("react.memo_cache_sentinel")?(R=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(nt,{className:"size-5 text-muted-foreground"})}),e[34]=R):R=e[34];const E=l??"",I=m??void 0,D=T?null:i,O=!!C&&u.state.editSeoPageKey===C;let $;return e[35]!==T||e[36]!==C||e[37]!==V||e[38]!==A||e[39]!==r||e[40]!==a.slug||e[41]!==D||e[42]!==O||e[43]!==E||e[44]!==I||e[45]!==s||e[46]!==u.consumeEditSeo||e[47]!==u.setVariantOverride?($=S(o.jsx(P.Suspense,{fallback:R,children:o.jsx(goe,{orgSlug:a.slug,virtualMcpId:s,branch:E,previewReady:!0,previewUrl:I,currentPath:V,activePageBlockKey:C,activeGlobalBlockKey:T,externalSelection:D,initialEditSeo:O,onExitSeo:u.consumeEditSeo,onVariantPreviewOverride:u.setVariantOverride,onViewJsonFile:r},A)})),e[35]=T,e[36]=C,e[37]=V,e[38]=A,e[39]=r,e[40]=a.slug,e[41]=D,e[42]=O,e[43]=E,e[44]=I,e[45]=s,e[46]=u.consumeEditSeo,e[47]=u.setVariantOverride,e[48]=$):$=e[48],$}function xoe(t){return o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:t})}function av(t){const e=U.c(44),{virtualMcpId:s,pageKey:n,onClose:r,ref:i}=t,a=ue(),{org:l}=Fe(),{currentBranch:c,taskId:d}=an(),u=ca().previewUrl;let f;e[0]!==c||e[1]!==l.slug||e[2]!==u||e[3]!==d||e[4]!==s?(f=c?{orgSlug:l.slug,virtualMcpId:s,branch:c,threadId:d??null,previewUrl:u}:null,e[0]=c,e[1]=l.slug,e[2]=u,e[3]=d,e[4]=s,e[5]=f):f=e[5];const p=B9(f),g=c??"";let x;e[6]!==l.slug||e[7]!==g||e[8]!==s?(x={orgSlug:l.slug,virtualMcpId:s,branch:g},e[6]=l.slug,e[7]=g,e[8]=s,e[9]=x):x=e[9];const{save:b,flush:v}=G3(x),_=p.data?.[n],L=p.data===void 0&&p.isLoading,y=p.data!==void 0&&_===void 0,w=!c||y||L;let S;e[10]!==_?(S=_===void 0?"":JSON.stringify(_,null,2),e[10]=_,e[11]=S):S=e[11];const k=S;let j;e[12]!==n||e[13]!==w||e[14]!==b?(j=$=>{if(w)return;let M;try{M=JSON.parse($)}catch{return}M===null||typeof M!="object"||Array.isArray(M)||b(n,M)},e[12]=n,e[13]=w,e[14]=b,e[15]=j):j=e[15];const N=j;let V;e[16]!==v?(V=()=>({flush:v}),e[16]=v,e[17]=V):V=e[17],P.useImperativeHandle(i,V);let C;e[18]!==a?(C=a("sectionsEditor.pageJsonDialog.titleShort"),e[18]=a,e[19]=C):C=e[19];let T;e[20]!==C?(T=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:C}),e[20]=C,e[21]=T):T=e[21];let A;e[22]!==a?(A=a("sectionsEditor.pageJsonDialog.close"),e[22]=a,e[23]=A):A=e[23];let R;e[24]===Symbol.for("react.memo_cache_sentinel")?(R=o.jsx(nn,{size:14}),e[24]=R):R=e[24];let E;e[25]!==r||e[26]!==A?(E=o.jsx(me,{variant:"ghost",size:"icon",onClick:r,"aria-label":A,className:"size-7 shrink-0",children:R}),e[25]=r,e[26]=A,e[27]=E):E=e[27];let I;e[28]!==E||e[29]!==T?(I=o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[T,E]}),e[28]=E,e[29]=T,e[30]=I):I=e[30];let D;e[31]!==p.data||e[32]!==v||e[33]!==k||e[34]!==L||e[35]!==y||e[36]!==n||e[37]!==w||e[38]!==N||e[39]!==a?(D=L?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(nt,{className:"size-5 text-muted-foreground"})}):y?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",a("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ud,{code:k,language:"json",readOnly:w,height:"100%",onChange:$=>N($??""),onSave:$=>{N($),v()}},`${n}:${p.data===void 0?"loading":"ready"}`)}),e[31]=p.data,e[32]=v,e[33]=k,e[34]=L,e[35]=y,e[36]=n,e[37]=w,e[38]=N,e[39]=a,e[40]=D):D=e[40];let O;return e[41]!==I||e[42]!==D?(O=o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[I,D]}),e[41]=I,e[42]=D,e[43]=O):O=e[43],O}function nj(t){return t.contentEditingEnabled&&!t.isMobile}function boe(t,e){return t!=="visual"?"visual":e?"blocks":"preview"}function voe(t){return nj({contentEditingEnabled:B8(t.cmsMode),isMobile:t.isMobile})?"blocks":"preview"}function yoe(t){return t.editingMode==="blocks"&&!t.blocksEditingEnabled||t.editingMode==="visual"&&!t.sandboxDisplay?"preview":t.editingMode}const _oe=500,Loe={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},lv=1,em=["desktop","mobile","tablet"],cv={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function dv(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function woe(t){if(!t)return null;try{const e=new URL(t,window.location.href);return e.searchParams.set("__decoFBT","0"),e.searchParams.set("__deco_ssr","1"),e.href}catch{return t}}function hh(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function tm(t,e){try{return new URL(t,e).href}catch{return null}}function Soe(t,e,s){const n=t.toLowerCase(),r=e.toLowerCase(),i=r.split("/").filter(Boolean),a=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let h=40;return d===0?h+=30:/[\s/-]/.test(c[d-1]??"")&&(h+=20),h+=Math.round(s.length/c.length*20),h};let l=Math.max(a(n),a(r));return i.at(-1)===s?l=Math.max(l,95):i.includes(s)&&(l=Math.max(l,90)),l}function koe(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function joe({virtualMcpId:t}){const e=ue(),s=ad(),n=Ja(),r=wZ(),{currentBranch:i,taskId:a}=an(),l=lk(),c=lo(),d=_n(t),h=c0(c?.entity?.id===t?c.entity.metadata?.ui?.layout??null:null),u=B8(h),f=nj({contentEditingEnabled:u,isMobile:n}),[m,p]=P.useState(()=>voe({cmsMode:h,isMobile:n})),[g,x]=P.useState("desktop"),[b,v]=P.useState(null),[_,L]=P.useState(null),y=P.useRef(null),w=P.useRef(null),[S,k]=P.useState(!1),j=P.useRef(null),N=()=>{j.current?.flush(),k(!1)},V=()=>k(ve=>(ve&&j.current?.flush(),!ve)),[C,T]=P.useState({width:0,height:0}),[A,R]=P.useState(null),[E,I]=P.useState(!1),[D,O]=P.useState(""),$=P.useRef(null),[M,z]=P.useState(!1),[F,B]=P.useState(),[H,W]=P.useState(null),[K,q]=P.useState(null),[G,te]=P.useState(null),[X,Z]=P.useState("/"),[ee,se]=P.useState(null),[J,oe]=P.useState({}),[ce,he]=P.useState(!1),ne=P.useRef(null),Q=()=>{he(!0),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>he(!1),15e3)},de=()=>{ne.current&&(clearTimeout(ne.current),ne.current=null),he(!1)},{org:ae}=Fe(),re=mr(),ie=ca(),Y=ie.vmEntry,pe=ie.previewUrl,be=re.lifecycle.phase,_e=be==="running",Le=c?.entity?.id===t?F2(c.entity.metadata):null,ke=c?.entity?.id===t&&d.runtime==="cms",Ve=d.projectDefault==="cms",Pe=bee({sandboxUrl:pe,previewServerUrl:Le,fastPreviewActive:ke}),xe=t&&i?{orgSlug:ae.slug,virtualMcpId:t,branch:i,threadId:a??null,previewUrl:pe}:null,Ne=B9(xe,{fetchEnabled:_e}),je=z3(xe,{fetchEnabled:_e}),we=Ne.data,Ce=je.data,Oe=we?bf(we).sort((ve,Re)=>ve.name.localeCompare(Re.name)):[],rt=t&&i?{orgSlug:ae.slug,virtualMcpId:t,branch:i}:null,Ge=qte(rt),Vt=we&&Ce?B3(we,Ce):[],lt=we&&Ce?ik(Ce,we,"loaders"):[],tt=D?(()=>{const ve=D.toLowerCase();return Oe.map(Re=>({page:Re,score:Soe(Re.name,Re.path,ve)})).filter(({score:Re})=>Re>0).sort((Re,bt)=>bt.score-Re.score||Re.page.path.length-bt.page.path.length).map(({page:Re})=>Re)})():Oe,ft=Vt.filter(ve=>{if(!D)return!0;const Re=D.toLowerCase();return ve.name.toLowerCase().includes(Re)||ve.key.toLowerCase().includes(Re)||ve.resolveType.toLowerCase().includes(Re)}),Lt=f?lt:[],mt=Lt.filter(ve=>{if(!D)return!0;const Re=D.toLowerCase();return ve.title.toLowerCase().includes(Re)||ve.key.toLowerCase().includes(Re)||ve.resolveType.toLowerCase().includes(Re)}),Qe=K?lt.find(ve=>ve.key===K)??null:null,st=Fo,gt=H||K?null:wp(Oe,X,ee),ge=H?H.name:Qe?.title??gt?.name,Ee=gt?.key??null,De=gt?.path??null,dt=(Ee?J[Ee]:void 0)??{},ht=Ri(X,dt),ut={};if(_e&&pe&&Ce&&we){const ve=Jte(Ce,"loaders"),Re=Ee?we[Ee]:void 0,bt=gte(Re,we,rs=>ve.has(rs)),kt=ute(bt);for(const rs of mf(X)){if(rs.type!=="param")continue;const mn=lte(X,rs.name,bt),Ys=mte(mn,ve,kt);Ys.length>0&&(ut[rs.name]=Ys)}}const ct=t&&i?{orgSlug:ae.slug,virtualMcpId:t,branch:i,threadId:a??null}:null,it=we&&Ee?FS(we,Ee,0):[],Ue=we?IS(it,we):[],_t=Ue.map(ve=>ve.isSavedBlock?ve.label:""),St=Ue.map(ve=>ve.isSavedBlock?"global":ve.isMultivariate?"variant":"normal"),Mt=it.map(ve=>kp(ve,we??{})),Pt=P.useRef(null),Ie=P.useRef(null),xt=re.status.state==="paused",Se=re.phase,ze=WS({claimPhase:Se,lifecycle:re.lifecycle}),ot=ie.previewState,fe=ie.userStopped,Me=F3(ae.slug,t??"",i??""),{url:He}=MS(ke&&t&&i?{orgSlug:ae.slug,virtualMcpId:t,branch:i,previewServerUrl:Le??null,path:ht}:null),Je=Ve&&d.runtime==="sandbox",Ze=pZ({previewState:ot,progressStatus:ze.status,previewServerUrl:Le,fastPreviewActive:ke,fastPreviewReady:!!He,codingSession:Je}),wt=Ze.mode!=="none",Ws=Ze.mode==="production"&&Ze.iframeBase?hh(Ze.iframeBase):null,pt=!s,qs=Ze.mode==="production"?Ws:hh(pe),vi=c?.entity?.id===t&&c.entity.metadata?.fastPreviewInPlace===!0,Ot=Ze.mode==="production"&&ke&&vi&&f&&m==="blocks",yi=P.useRef(null);Ot||(yi.current=He);const co=yi.current,uo=Ot?co??He:He,Gs=woe(Ze.mode==="sandbox"?sh(dv(G??tm(ht,Ze.iframeBase)??Ze.iframeBase,g),l.state.variantOverride??[]):Ze.mode==="production"&&pt?sh(dv(DS(G??uo??tm(ht,Ze.iframeBase)??Ze.iframeBase,Ze.showWakingPill?gee:null),g),l.state.variantOverride??[]):null);P.useEffect(()=>{},[s,Ws,A]);const _i="sandbox.preview.openInNewTab",pr=He??(Ze.iframeBase?tm(ht,Ze.iframeBase):null),ho=Ze.mode==="production"?pr?sh(pr,l.state.variantOverride??[]):null:Gs??Ze.iframeBase,fo=async()=>{const ve=ho;if(ve){window.open(ve,"_blank","noopener");return}},gr=t&&i?H3(ae.slug,t,i):null,xr=ve=>{gr&&ite(gr,ve)},us=l.state.target;P.useEffect(()=>{if(!(!us||!Pe||!Ce))if(us.kind==="page"){const ve=J[us.key]??{};Ie.current=Ri(us.path,ve),W(null),q(null),te(null),se(us.key),Z(us.path),xr({path:us.path,pageKey:us.key,params:ve})}else if(us.kind==="loader")Ie.current=null,W(null),q(us.key),te(null);else{const ve=Vt.find(Re=>Re.key===us.key);if(ve){Ie.current=null;const Re=pf(Ce);q(null),W(ve),te(kb(Pe,Re,ve.key))}}},[us,Pe,Ce,J]),P.useEffect(()=>{!Ee||De===null||us?.kind==="page"&&us.key===Ee&&us.path===De||l.selectTarget({kind:"page",key:Ee,path:De})},[Ee,De,us]);const[br,mo]=P.useState(null);if(ot.kind==="iframe"&&br!==ot.previewUrl){const ve=br!==null;mo(ot.previewUrl);const Re=gr?K3(gr):null;if(Re){if(Ie.current=Ri(Re.path,Re.params),Z(Re.path),se(Re.pageKey),te(null),W(null),q(null),Re.pageKey&&Object.keys(Re.params).length>0){const bt=Re.pageKey;oe(kt=>({...kt,[bt]:Re.params}))}}else ve&&(Ie.current=null,Z("/"),te(null),se(null),W(null),q(null))}Pt.current=Gs;const vr=vZ({iframeRef:y,src:Ze.mode==="sandbox"?Gs:null,active:Ze.mode==="sandbox"}),Li=P.useRef(null);P.useEffect(()=>{if(!He||!Gs||Li.current===He)return;Li.current=He;const ve=y.current;ve&&ve.getAttribute("src")!==Gs&&(Q(),ve.src=Gs)},[He,Gs]);const wi=()=>{const ve=y.current?.contentWindow,Re=qs;if(!ve||!Re||!we||!Ee)return;const bt=we[Ee];if(!bt||typeof bt!="object")return;const kt=xee({previewBaseUrl:Re,pageBlock:bt,decofile:we,path:ht,pathTemplate:X});if(!kt)return;const rs=sh(kt.src,l.state.variantOverride??[]);ve.postMessage({type:"cms-editor::render",src:rs,body:kt.body},Re)},yr=P.useRef(null);P.useEffect(()=>{if(!Ot||H||K||!Ee||!we){yr.current=null;return}const ve=JSON.stringify({page:Ee,path:ht,pathTemplate:X,decofile:we});if(yr.current===ve)return;const Re=yr.current===null;yr.current=ve,!Re&&wi()},[we,Ot,H,K,Ee,ht,X]);const ha=P.useRef(null);P.useEffect(()=>{if(!Ot||H||K||!Ee||!we){ha.current=null;return}const ve=JSON.stringify(l.state.variantOverride??null),Re=ha.current;ha.current={page:Ee,sig:ve},!(!Re||Re.page!==Ee||Re.sig===ve)&&wi()},[l.state.variantOverride,Ot,H,K,Ee]);const po=!!t&&!!i&&!re.notFound&&!fe&&!xt&&(Se?.kind==="ready"||be!=="idle"),Ps=yoe({editingMode:m,sandboxDisplay:Ze.mode==="sandbox",blocksEditingEnabled:f});P.useEffect(()=>{const ve=qs;if(!ve)return;const Re=bt=>{if(bt.origin===ve)if(bt.data?.type==="visual-editor::element-clicked"){const kt=wee.safeParse(bt.data.payload);kt.success&&v(kt.data)}else if(bt.data?.type==="cms-editor::section-clicked"){const kt=jee.safeParse(bt.data.payload);kt.success&&L({index:kt.data.sectionIndex,seq:kt.data.clickSeq})}else bt.data?.type==="cms-editor::render-start"?Q():bt.data?.type==="cms-editor::render-end"?(de(),y.current?.contentWindow?.postMessage({type:"cms-editor::set-labels",labels:_t,kinds:St,keys:Mt},ve)):bt.data?.type==="cms-editor::render-error"&&de()};return window.addEventListener("message",Re),()=>window.removeEventListener("message",Re)},[qs,_t,St,Mt]);const fa=()=>{const ve=y.current?.contentWindow,Re=hh(pe);!ve||!Re||ve.postMessage({type:"visual-editor::activate",script:See},Re)},go=()=>{const ve=y.current?.contentWindow,Re=hh(pe);!ve||!Re||ve.postMessage({type:"visual-editor::deactivate"},Re)},Kr=()=>{const ve=y.current?.contentWindow,Re=qs;!ve||!Re||(ve.postMessage(Ze.mode==="production"?{type:"editor::inject",args:{script:Cb}}:{type:"visual-editor::activate",script:Cb},Re),ve.postMessage({type:"cms-editor::set-labels",labels:_t,kinds:St,keys:Mt},Re))},Ld=()=>{const ve=y.current?.contentWindow,Re=qs;!ve||!Re||ve.postMessage({type:"cms-editor::deactivate"},Re)},Wr=ve=>{if(ve==="blocks"&&!f)return;const Re=m;!n&&ve!==Re&&(ve==="blocks"?w.current?.resize("30%"):w.current?.collapse()),ve!=="blocks"&&N(),p(ve),v(null),L(null),ve!=="blocks"&&q(null),Re==="visual"&&go(),ve==="visual"&&fa(),Re==="blocks"&&ve!=="blocks"&&Ld(),ve==="blocks"&&Kr()},xo=()=>{Wr(boe(m,f))},bo=()=>{if(!y.current||!Gs)return;Q();const ve=y.current;ve.src=Gs};YB(()=>{const ve=y.current;if(!ve)return;Q();const Re=document.activeElement,bt=ve.tabIndex;ve.tabIndex=-1,ve.style.pointerEvents="none",ve.blur(),koe(ve,Pt.current);let kt;const rs=()=>{clearTimeout(kt),ve.tabIndex=bt,ve.style.pointerEvents="";const mn=document.activeElement;(!mn||mn===document.body||mn===ve)&&Re?.focus(),ve.removeEventListener("load",rs)};ve.addEventListener("load",rs),kt=setTimeout(rs,3e3)});const vo=()=>{const ve=em.indexOf(g);x(em[(ve+1)%em.length])},qr=(ve,Re)=>{if(!Ee)return;const bt=Ee,kt={...dt,[ve]:Re};Ie.current=Ri(X,kt),oe(rs=>({...rs,[bt]:kt})),xr({path:X,pageKey:bt,params:kt})},Si=Hte({iframeBase:Ze.iframeBase,resolvedPath:ht,activeGlobalSectionName:H?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Gr=ve=>{const Re=J[ve.key]??{},bt=Ri(ve.path,Re);(H||st(bt)!==st(ht))&&Q(),Ie.current=bt,W(null),q(null),te(null),L(null),se(ve.key),Z(ve.path),xr({path:ve.path,pageKey:ve.key,params:Re}),l.selectTarget({kind:"page",key:ve.key,path:ve.path})},yo=ve=>{if(!Pe||!Ce){ye.error(e("sandbox.preview.previewMetadataNotReady"));return}Q(),Ie.current=null;const Re=pf(Ce),bt=kb(Pe,Re,ve.key);W(ve),q(null),te(bt),L(null),l.selectTarget({kind:"section",key:ve.key})},n1=ve=>{f&&(W(null),q(ve.key),te(null),Wr("blocks"),l.selectTarget({kind:"loader",key:ve.key}))},_o=async({name:ve,path:Re,templateKey:bt})=>{if(!t||!i)return;const kt=F9(Re);if(kt){B(kt);return}const rs=Re.trim().startsWith("/")?Re.trim():`/${Re.trim()}`;if(Oe.some(Ys=>st(Ys.path)===st(rs))){B(e("sandbox.preview.pageAlreadyExists",{path:rs}));return}let mn;if(bt&&(mn=we?.[bt],!mn)){B(e("sandbox.preview.templateNoLongerExists"));return}B(void 0);try{const Ys=await Ge.mutateAsync({name:ve,path:rs,template:mn});z(!1),ye.success(e("sandbox.preview.pageCreated",{name:ve})),await cd(_oe),Gr({key:Ys.key,name:Ys.name,path:Ys.path}),Wr("blocks")}catch(Ys){B(Ys instanceof Error?Ys.message:e("sandbox.preview.failedToCreatePage"))}},ki=wt&&(po||Ze.mode==="production"),Lo=Kte({showPreviewToolbar:ki,contentEditingEnabled:u}),_r=ki?o.jsxs(o.Fragment,{children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Io,{onClick:bo,"aria-label":e("sandbox.preview.refresh"),children:o.jsx(Mn,{size:16})})}),o.jsx(We,{side:"bottom",children:e("sandbox.preview.refresh")})]}),Lo?o.jsxs("div",{ref:$,className:"relative min-w-0 w-64 shrink",children:[o.jsxs("div",{className:"flex h-7 w-full min-w-0 items-center rounded-md border border-border bg-background transition-colors duration-200 hover:bg-accent",children:[o.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>I(ve=>!ve),children:[H&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[o.jsx(Ki,{size:11}),"Global"]}),Qe&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[o.jsx(Ia,{size:11}),e("sandbox.preview.loaderBadge")]}),o.jsx("span",{className:le("text-[13px] font-medium text-foreground",ge==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:ge??Si}),!H&&!K&&ge!=null&&X&&o.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:mf(X).map((ve,Re)=>{if(ve.type==="text")return o.jsx("span",{className:le(Re===0?"min-w-0 truncate":"shrink-0"),children:ve.text},`text-${Re}`);const bt=ut[ve.name];return bt&&ct?o.jsx(Pte,{sources:bt,template:X,paramName:ve.name,value:dt[ve.name]??"",sandboxRef:ct,onCommit:kt=>qr(ve.name,kt)},`${Ee}:${ve.name}`):o.jsx(Fte,{name:ve.name,value:dt[ve.name]??"",onCommit:kt=>qr(ve.name,kt)},`${Ee}:${ve.name}`)})})]}),o.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>I(ve=>!ve),"aria-label":e("sandbox.preview.choosePage"),"aria-expanded":E,children:o.jsx(ds,{size:12,className:le("shrink-0 text-muted-foreground transition-transform",E&&"rotate-180")})})]}),E&&o.jsxs("div",{className:"absolute left-1/2 top-full z-50 mt-1.5 w-[500px] max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[o.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[o.jsx(r0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("input",{type:"text",value:D,onChange:ve=>O(ve.target.value),onKeyDown:ve=>{if(ve.key!=="Enter")return;const Re=D.trim();if(!Re)return;const bt=tt.find(kt=>st(kt.path)===st(Re));bt&&(ve.preventDefault(),I(!1),O(""),Gr(bt))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),o.jsx("div",{className:"p-1.5 border-b",children:o.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ve=>{ve.preventDefault(),I(!1),O(""),B(void 0),z(!0)},children:[o.jsx(Qt,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),tt.length===0&&ft.length===0&&mt.length===0?o.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Oe.length===0&&Vt.length===0&&Lt.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):o.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[tt.length>0&&o.jsx("div",{className:"p-1.5",children:tt.map(ve=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Re=>{Re.preventDefault(),I(!1),O(""),Gr(ve)},children:[o.jsx(zi,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.path})]},ve.key))}),ft.length>0&&o.jsxs("div",{className:le("p-1.5",tt.length>0&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),ft.map(ve=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Re=>{Re.preventDefault(),I(!1),O(""),yo(ve)},children:[o.jsx(Ki,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ve.key))]}),mt.length>0&&o.jsxs("div",{className:le("p-1.5",(tt.length>0||ft.length>0)&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalLoaders")}),mt.map(ve=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Re=>{Re.preventDefault(),I(!1),O(""),n1(ve)},children:[o.jsx(Ia,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.title}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ve.key))]})]})]})]}):o.jsx("span",{className:"min-w-0 truncate px-2 text-[13px] text-muted-foreground",children:Si}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Io,{"aria-label":e(_i),onClick:()=>{fo()},children:o.jsx(fn,{size:16})})}),o.jsx(We,{side:"bottom",children:e(_i)})]})]}):null,ji=_r?o.jsx("div",{className:"flex min-w-0 items-center gap-0.5",children:_r}):null,wo=Ze.mode==="sandbox",Lr=Loe[g],wr=g==="desktop"&&(C.width===0||C.width>=Lr.width+2*lv),Ci=wr?1:Math.min(C.width>0?C.width/(Lr.width+2*lv):1,1),So=wr?{width:"100%",height:"100%"}:{width:`${Lr.width}px`,height:C.height>0?`${C.height/Ci}px`:`${Lr.height}px`,transform:`scale(${Ci})`,transformOrigin:"top center"},wd=wt?o.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:o.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[wo&&o.jsxs(o.Fragment,{children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Io,{onClick:xo,"aria-pressed":Ps==="visual","aria-label":e("sandbox.preview.visualEditor"),active:Ps==="visual",className:"rounded-full",children:o.jsx(Kx,{size:16})})}),o.jsx(We,{side:"top",children:e("sandbox.preview.visualEditor")})]}),o.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Io,{onClick:vo,"aria-label":e(cv[g]),className:"rounded-full",children:o.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[g==="mobile"&&o.jsx(GT,{size:16}),g==="tablet"&&o.jsx(YT,{size:16}),g==="desktop"&&o.jsx(QT,{size:16})]},g)})}),o.jsx(We,{side:"top",children:e(cv[g])})]})]})}):null,ko=!!K&&Ps==="blocks";return o.jsxs("div",{className:"flex flex-col w-full h-full",children:[ct&&Object.entries(ut).map(([ve,Re])=>(dt[ve]??"")===""?o.jsx(Bte,{sources:Re,template:X,paramName:ve,sandboxRef:ct,onFill:bt=>qr(ve,bt)},`${Ee}:${ve}`):null),r?ji&&o.jsx(LZ,{children:ji}):_r&&o.jsxs("div",{className:"@container/panel-header relative flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3 md:px-4",children:[o.jsx("div",{className:"flex-1"}),o.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:_r}),o.jsx("div",{className:"flex-1"})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:ko?o.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[o.jsx(ov,{virtualMcpId:t,externalSelection:_,onViewJsonFile:V}),S&&Ee&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(av,{ref:j,virtualMcpId:t,pageKey:Ee,onClose:N})})]}):o.jsxs(ep,{orientation:"horizontal",disabled:Ps!=="blocks",children:[o.jsx(Pc,{ref:w,id:"preview-blocks-editor",defaultSize:Ps==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Ps==="blocks"&&o.jsx(ov,{virtualMcpId:t,externalSelection:_,onViewJsonFile:V})}),Ps==="blocks"&&o.jsx(tp,{withHandle:!0}),o.jsx(Pc,{id:"preview-canvas",defaultSize:Ps==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:o.jsxs(ep,{orientation:"horizontal",disabled:!(S&&Ee),children:[S&&Ee&&o.jsxs(o.Fragment,{children:[o.jsx(Pc,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:o.jsx(av,{ref:j,virtualMcpId:t,pageKey:Ee,onClose:N})}),o.jsx(tp,{withHandle:!0})]}),o.jsx(Pc,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:o.jsxs("div",{ref:ve=>{if(!ve)return;const Re=()=>T(kt=>kt.width===ve.clientWidth&&kt.height===ve.clientHeight?kt:{width:ve.clientWidth,height:ve.clientHeight});Re();const bt=new ResizeObserver(Re);return bt.observe(ve),()=>bt.disconnect()},className:le("h-full relative overflow-clip flex justify-center",wt&&!wr&&"bg-muted/30"),children:[(ce||Me)&&wt&&o.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:o.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),Ze.showBlockingOverlay&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(zc,{kind:"starting",progress:ze,claimPhase:Se})}),ot.kind==="suspended"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(zc,{kind:"suspended",onResume:ie.resume})}),ot.kind==="errored"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(zc,{kind:"errored",error:ot.error,onRetry:ie.retry,connectionsHref:`/${ae.slug}/settings/connections`})}),Ze.showWakingPill&&o.jsxs("div",{className:"absolute top-4 left-1/2 z-20 flex max-w-md -translate-x-1/2 items-start gap-3 rounded-xl border border-border bg-muted px-4 py-3 shadow-lg pointer-events-none select-none",children:[o.jsx(nt,{className:"size-4.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),Ps==="visual"&&!b&&o.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[o.jsx(Kx,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Ps==="visual"&&b&&o.jsx(Uee,{element:b,onDismiss:()=>v(null)}),wd,wt&&Gs&&o.jsx("div",{className:le("shrink-0",!wr&&"border-x border-border bg-background shadow-sm"),style:So,children:o.jsx("iframe",{ref:y,src:Gs,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:vr.handleError,onLoad:()=>{if(vr.handleLoad(),de(),Ze.mode!=="sandbox"){Ze.mode==="production"&&!Ze.showWakingPill&&Ps==="blocks"&&Kr();return}if(Ye("vm_preview_loaded",{view_mode:Ps,vm_id:Y?.sandboxHandle??null}),!H)try{const ve=y.current?.contentWindow?.location?.pathname;if(!ve)return;const Re=Ie.current;if(Re!==null&&(Ie.current=null,st(ve)!==st(Re))||st(ve)===st(ht))return;Z(ve),xr({path:ve,pageKey:ee,params:dt})}catch{}Ps==="visual"&&fa(),Ps==="blocks"&&Kr()}},Ze.iframeBase)})]})})]})})]})}),o.jsx(Yte,{open:M,onOpenChange:z,isPending:Ge.isPending,error:F,templates:Oe,onSubmit:_o})]})}function Coe(t){const e=U.c(22),{virtualMcpId:s}=t,n=ue(),r=Vs(s),{activeTask:i,taskId:a,currentBranch:l}=an(),c=W_(a),[d,h]=P.useState(!1);if(q_({threadId:a,sandboxBranch:i?.branch??l,agentHasRepo:xn(r?.metadata),threadHasRepo:xn(c)||xn(i?.metadata)})==="none"){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(Ir,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>h(!0),b=o.jsx(Ir,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let v;e[7]!==n?(v=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=v):v=e[8];let _;e[9]!==v?(_=o.jsxs(me,{onClick:x,children:[b,v]}),e[9]=v,e[10]=_):_=e[10];let L;e[11]!==p||e[12]!==g||e[13]!==_?(L=o.jsx(Dr,{className:"h-full",image:m,title:p,description:g,actions:_}),e[11]=p,e[12]=g,e[13]=_,e[14]=L):L=e[14];let y;e[15]!==d?(y=o.jsx(i0,{open:d,onOpenChange:h,mode:"agent"}),e[15]=d,e[16]=y):y=e[16];let w;return e[17]!==L||e[18]!==y?(w=o.jsxs(o.Fragment,{children:[L,y]}),e[17]=L,e[18]=y,e[19]=w):w=e[19],w}let f;return e[20]!==s?(f=o.jsx(joe,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}function Noe(t){const e=U.c(14),{orgSlug:s,virtualMcpId:n,branch:r,threadId:i,enabled:a}=t,l=a===void 0?!0:a;let c;e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==n?(c=at.sandboxRepoDir(s,n,r,i),e[0]=r,e[1]=s,e[2]=i,e[3]=n,e[4]=c):c=e[4];let d;e[5]!==r||e[6]!==s||e[7]!==i||e[8]!==n?(d=async()=>{const f=to({orgSlug:s,virtualMcpId:n,branch:r,threadId:i},"config"),m=await fetch(f);return m.ok?(await m.json()).repoDir??null:null},e[5]=r,e[6]=s,e[7]=i,e[8]=n,e[9]=d):d=e[9];let h;return e[10]!==l||e[11]!==c||e[12]!==d?(h={queryKey:c,queryFn:d,enabled:l,staleTime:1/0},e[10]=l,e[11]=c,e[12]=d,e[13]=h):h=e[13],Zt(h).data??null}const Voe=P.lazy(()=>Ks(()=>import("./file-explorer-jXzlywVk.js"),__vite__mapDeps([168,1,2,30,31,32,33,34,35,36,37,38,39,40,25,29,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,98,101,92,102,103,104,105,106,107,108,109,110,74,149,147,96,142,115,81,82,83,84,85,86,87,88,89,90,91,93,94,95,97,99,100,111,112,113,114,78,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,143,144,145,146,148,150,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.FileExplorer})));function Toe(t){const e=U.c(26),{openPath:s}=t,n=ue(),r=lo(),{org:i}=Fe(),{currentBranch:a,taskId:l}=an(),c=r?.entity?.id??null,d=ad(),h=ca(),u=mr();h.vmEntry,u.lifecycle.phase;const f=d,m=c??"",p=a??"",g=l??null,x=f;let b;e[0]!==i.slug||e[1]!==m||e[2]!==p||e[3]!==g||e[4]!==x?(b={orgSlug:i.slug,virtualMcpId:m,branch:p,threadId:g,enabled:x},e[0]=i.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x,e[5]=b):b=e[5],Noe(b);const v=null;if(!c||!a){let k;e[6]!==n?(k=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[6]=n,e[7]=k):k=e[7];let j;e[8]!==n?(j=n("mainPanelTabs.codeTab.noSandboxToBrowseDescription"),e[8]=n,e[9]=j):j=e[9];let N;return e[10]!==k||e[11]!==j?(N=o.jsx(Dr,{className:"h-full",title:k,description:j}),e[10]=k,e[11]=j,e[12]=N):N=e[12],N}let _;e[13]!==v||e[14]!==n?(_=v,e[13]=v,e[14]=n,e[15]=_):_=e[15];let L;e[16]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(nt,{className:"size-5 text-muted-foreground"})}),e[16]=L):L=e[16];const y=l??null;let w;e[17]!==a||e[18]!==s||e[19]!==i.slug||e[20]!==y||e[21]!==c?(w=o.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:o.jsx(P.Suspense,{fallback:L,children:o.jsx(Voe,{orgSlug:i.slug,virtualMcpId:c,branch:a,threadId:y,openPath:s})})}),e[17]=a,e[18]=s,e[19]=i.slug,e[20]=y,e[21]=c,e[22]=w):w=e[22];let S;return e[23]!==_||e[24]!==w?(S=o.jsxs("div",{className:"flex flex-col w-full h-full",children:[_,w]}),e[23]=_,e[24]=w,e[25]=S):S=e[25],S}function Poe(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([n])=>!e.includes(n)));return Object.keys(s).length>0?{...t,properties:s}:t}function Aoe(t,e,s){return typeof t!="string"?null:Poe($n(t,e),s)}function rj(t,e,s){if(!e||typeof t!="string")return!1;const n=Aoe(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function Eoe({orgSlug:t,virtualMcpId:e,branch:s}){const n=Ns(),r=ws()?.taskId??null,i=L0(e),a=_n(e).runtime==="cms";return Rs({mutationKey:Dg(t,e,s),mutationFn:async({blockKey:l})=>{if(a){const h=await m_({orgSlug:t,virtualMcpId:e,branch:s},{delete:[l]});return Ig(n,{orgSlug:t,virtualMcpId:e,branch:s},h),await n.invalidateQueries({queryKey:y0({orgSlug:t,virtualMcpId:e,branch:s,threadId:r})}),{ok:!0,existed:!0}}const c=_0(i,z8(l)),d=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:c})});return d.ok?d.json():L9(d,"Delete")},onMutate:async({blockKey:l})=>{const c=`${t}/${e}/${s}`,d=at.decofile(c);await n.cancelQueries({queryKey:d});const h=n.getQueryData(d),u=!!h&&l in h,f=h?.[l];return n.setQueryData(d,m=>{if(!m)return m;const{[l]:p,...g}=m;return g}),{queryKey:d,blockKey:l,hadKey:u,previousValue:f}},onError:(l,c,d)=>{d&&n.setQueryData(d.queryKey,h=>d.hadKey?{...h??{},[d.blockKey]:d.previousValue}:h)},onSuccess:()=>{n.invalidateQueries({queryKey:at.liveMeta(t,e,s)})}})}function wc(t){const e=U.c(6),{hasItems:s,emptyLabel:n,emptyHint:r}=t;let i;e[0]!==r||e[1]!==n||e[2]!==s?(i=s?"No results match your search.":o.jsxs(o.Fragment,{children:[o.jsx("div",{children:n}),o.jsx("div",{className:"mt-1 text-muted-foreground/80",children:r})]}),e[0]=r,e[1]=n,e[2]=s,e[3]=i):i=e[3];let a;return e[4]!==i?(a=o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=a):a=e[5],a}function Q9(t,e){return`${t}-${e}`}function ij(t,e){return`site/apps/${t}/${e}.ts`}function oj(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function Roe(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function Doe(t){return t==="local"?"Custom":"Installed"}function aj(t,e,s){const n=new Set([Q9(t,e),e].map(i=>i.toLowerCase())),r=ij(t,e);for(const[i,a]of Object.entries(s)){if(i.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=a;if(n.has(i.toLowerCase())||l.__resolveType===r)return i}return null}function Moe(t,e){const s=t.vendor.alias,n=t.name,r=aj(s,n,e);return{id:Q9(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:ij(s,n),blockKey:r,installed:r!==null}}function Ioe(t,e,s){if(t===$3)return null;const n=oj(t);if(!n)return null;const{vendor:r,app:i}=n,a=aj(r,i,s),l=ua(t,e);return{id:Q9(r,i),app:i,vendor:r,title:l.title??i,description:l.description??"",category:"Others",logo:l.logo??l.icon,resolveType:t,blockKey:a,installed:a!==null}}function Ooe(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Jc(t,e)||!pS(n))return null;const r=oj(n)??Roe(t);if(!r)return null;const i=ua(n,s),{vendor:a,app:l}=r;return{id:Q9(a,l),app:l,vendor:a,title:i.title??vf(t,e,s),description:i.description??"",category:Doe(a),logo:i.logo??i.icon,resolveType:n,blockKey:t,installed:!0}}function $oe(t,e,s){const n=new Map;for(const i of t){const a=Moe(i,s);n.set(a.id,a)}const r=e.manifest?.blocks?.apps??{};for(const i of Object.keys(r)){const a=Ioe(i,e,s);!a||n.has(a.id)||n.set(a.id,a)}for(const[i,a]of Object.entries(s)){if(i.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=Ooe(i,a,e);!l||n.has(l.id)||n.set(l.id,l)}return[...n.values()].sort(Boe)}function Boe(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function zoe(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function Foe(t,e,s){const n=U.c(12),r=s?.enabled??!0;let i;n[0]===Symbol.for("react.memo_cache_sentinel")?(i=at.decoApps(),n[0]=i):i=n[0];let a;n[1]!==r?(a={queryKey:i,queryFn:zoe,staleTime:3e5,retry:1,enabled:r},n[1]=r,n[2]=a):a=n[2];const l=Zt(a);let c;n[3]!==e||n[4]!==t||n[5]!==l.data?(c=t&&e?$oe(l.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=l.data,n[6]=c):c=n[6];const d=c,h=l.isLoading&&!l.isError;let u;return n[7]!==d||n[8]!==l.isError||n[9]!==l.refetch||n[10]!==h?(u={catalog:d,isLoading:h,isError:l.isError,refetch:l.refetch},n[7]=d,n[8]=l.isError,n[9]=l.refetch,n[10]=h,n[11]=u):u=n[11],u}function Uoe(t){const e=U.c(86),{active:s,counts:n,showBlog:r,onSelect:i}=t,a=ue();let l;e[0]!==a?(l=a("sandbox.collectionsSidebar.content"),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==l?(c=o.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:o.jsx("span",{className:"text-sm font-medium",children:l})}),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==a?(d=a("sandbox.collectionsSidebar.pages"),e[4]=a,e[5]=d):d=e[5];const h=s==="pages";let u;e[6]!==n.pages||e[7]!==i||e[8]!==d||e[9]!==h?(u=o.jsx(Bn,{id:"pages",icon:zi,label:d,count:n.pages,active:h,onSelect:i}),e[6]=n.pages,e[7]=i,e[8]=d,e[9]=h,e[10]=u):u=e[10];let f;e[11]!==a?(f=a("sandbox.collectionsSidebar.sections"),e[11]=a,e[12]=f):f=e[12];const m=s==="sections";let p;e[13]!==n.sections||e[14]!==i||e[15]!==f||e[16]!==m?(p=o.jsx(Bn,{id:"sections",icon:Ki,label:f,count:n.sections,active:m,onSelect:i}),e[13]=n.sections,e[14]=i,e[15]=f,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==a?(g=a("sandbox.collectionsSidebar.apps"),e[18]=a,e[19]=g):g=e[19];const x=s==="apps";let b;e[20]!==n.apps||e[21]!==i||e[22]!==x||e[23]!==g?(b=o.jsx(Bn,{id:"apps",icon:f8,label:g,count:n.apps,active:x,onSelect:i}),e[20]=n.apps,e[21]=i,e[22]=x,e[23]=g,e[24]=b):b=e[24];let v;e[25]!==a?(v=a("sandbox.collectionsSidebar.redirects"),e[25]=a,e[26]=v):v=e[26];const _=s==="redirects";let L;e[27]!==n.redirects||e[28]!==i||e[29]!==v||e[30]!==_?(L=o.jsx(Bn,{id:"redirects",icon:e8,label:v,count:n.redirects,active:_,onSelect:i}),e[27]=n.redirects,e[28]=i,e[29]=v,e[30]=_,e[31]=L):L=e[31];let y;e[32]!==a?(y=a("sandbox.collectionsSidebar.loaders"),e[32]=a,e[33]=y):y=e[33];const w=s==="loaders";let S;e[34]!==n.loaders||e[35]!==i||e[36]!==y||e[37]!==w?(S=o.jsx(Bn,{id:"loaders",icon:Ia,label:y,count:n.loaders,active:w,onSelect:i}),e[34]=n.loaders,e[35]=i,e[36]=y,e[37]=w,e[38]=S):S=e[38];let k;e[39]!==a?(k=a("sandbox.collectionsSidebar.actions"),e[39]=a,e[40]=k):k=e[40];const j=s==="actions";let N;e[41]!==n.actions||e[42]!==i||e[43]!==k||e[44]!==j?(N=o.jsx(Bn,{id:"actions",icon:hi,label:k,count:n.actions,active:j,onSelect:i}),e[41]=n.actions,e[42]=i,e[43]=k,e[44]=j,e[45]=N):N=e[45];let V;e[46]!==a?(V=a("sandbox.collectionsSidebar.site"),e[46]=a,e[47]=V):V=e[47];const C=s==="site";let T;e[48]!==i||e[49]!==V||e[50]!==C?(T=o.jsx(Bn,{id:"site",icon:$6,label:V,active:C,onSelect:i}),e[48]=i,e[49]=V,e[50]=C,e[51]=T):T=e[51];let A;e[52]!==a?(A=a("sandbox.collectionsSidebar.seo"),e[52]=a,e[53]=A):A=e[53];const R=s==="seo";let E;e[54]!==i||e[55]!==A||e[56]!==R?(E=o.jsx(Bn,{id:"seo",icon:t8,label:A,active:R,onSelect:i}),e[54]=i,e[55]=A,e[56]=R,e[57]=E):E=e[57];let I;e[58]!==a?(I=a("sandbox.collectionsSidebar.calendar"),e[58]=a,e[59]=I):I=e[59];const D=s==="calendar";let O;e[60]!==i||e[61]!==I||e[62]!==D?(O=o.jsx(Bn,{id:"calendar",icon:id,label:I,active:D,onSelect:i}),e[60]=i,e[61]=I,e[62]=D,e[63]=O):O=e[63];let $;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==i||e[69]!==r||e[70]!==a?($=r&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[o.jsx(Hc,{size:13,className:"shrink-0"}),a("sandbox.collectionsSidebar.blog")]}),o.jsx(Bn,{id:"posts",icon:Mr,label:a("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:i}),o.jsx(Bn,{id:"authors",icon:g9,label:a("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:i}),o.jsx(Bn,{id:"categories",icon:G2,label:a("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:i}),o.jsx(Bn,{id:"post-schedule",icon:XT,label:a("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:i})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=i,e[69]=r,e[70]=a,e[71]=$):$=e[71];let M;e[72]!==b||e[73]!==L||e[74]!==S||e[75]!==N||e[76]!==T||e[77]!==E||e[78]!==O||e[79]!==$||e[80]!==u||e[81]!==p?(M=o.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[u,p,b,L,S,N,T,E,O,$]}),e[72]=b,e[73]=L,e[74]=S,e[75]=N,e[76]=T,e[77]=E,e[78]=O,e[79]=$,e[80]=u,e[81]=p,e[82]=M):M=e[82];let z;return e[83]!==c||e[84]!==M?(z=o.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,M]}),e[83]=c,e[84]=M,e[85]=z):z=e[85],z}function Bn(t){const e=U.c(18),{id:s,icon:n,label:r,count:i,active:a,onSelect:l}=t;let c;e[0]!==s||e[1]!==l?(c=()=>l(s),e[0]=s,e[1]=l,e[2]=c):c=e[2];const d=a?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let h;e[3]!==d?(h=le("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",d),e[3]=d,e[4]=h):h=e[4];let u;e[5]!==n?(u=o.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=u):u=e[6];let f;e[7]!==r?(f=o.jsx("span",{className:"flex-1 truncate",children:r}),e[7]=r,e[8]=f):f=e[8];let m;e[9]!==a||e[10]!==i?(m=i!==void 0&&o.jsx("span",{className:le("shrink-0 text-xs tabular-nums",a?"text-accent-foreground/70":"text-muted-foreground/70"),children:i}),e[9]=a,e[10]=i,e[11]=m):m=e[11];let p;return e[12]!==c||e[13]!==h||e[14]!==u||e[15]!==f||e[16]!==m?(p=o.jsxs("button",{type:"button",onClick:c,className:h,children:[u,f,m]}),e[12]=c,e[13]=h,e[14]=u,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function Hoe(t){const e=U.c(12),{state:s,claimPhase:n,lifecycle:r,onStart:i,connectionsHref:a}=t;switch(s.kind){case"starting":{let l;e[0]!==n||e[1]!==r?(l=WS({claimPhase:n,lifecycle:r}),e[0]=n,e[1]=r,e[2]=l):l=e[2];let c;return e[3]!==n||e[4]!==l?(c=o.jsx(zc,{kind:"starting",progress:l,claimPhase:n}),e[3]=n,e[4]=l,e[5]=c):c=e[5],c}case"suspended":{let l;return e[6]!==i?(l=o.jsx(zc,{kind:"suspended",onResume:i}),e[6]=i,e[7]=l):l=e[7],l}case"errored":{let l;return e[8]!==a||e[9]!==i||e[10]!==s.error?(l=o.jsx(zc,{kind:"errored",error:s.error,onRetry:i,connectionsHref:a}),e[8]=a,e[9]=i,e[10]=s.error,e[11]=l):l=e[11],l}}}const Koe=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Woe(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!Koe.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function uv(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),n=`${s} (copy)`;if(!t.has(n))return n;for(let r=2;r<1e3;r++){const i=`${s} (copy ${r})`;if(!t.has(i))return i}return`${s} (copy ${Date.now()})`}function qoe(t,e){const s=Fo,n=e.replace(/-copy(?:-\d+)?$/,""),r=`${n}-copy`;if(!t.has(s(r)))return r;for(let i=2;i<1e3;i++){const a=`${n}-copy-${i}`;if(!t.has(s(a)))return a}return`${n}-copy-${Date.now()}`}function Goe(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),n=`${s}_copy`;if(!Object.hasOwn(t,n))return n;for(let r=2;r<1e3;r++){const i=`${s}_copy_${r}`;if(!Object.hasOwn(t,i))return i}return`${s}_copy_${Date.now()}`}function Yoe(t){const e=q3(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function Qoe(t,e){return JS(t,e)}const Xoe=1e3;function Joe(t,e){for(let s=0;s<Xoe;s++){const n=q3(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const Zoe={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},eae={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},tae={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function sae(t){const e=U.c(88),{open:s,mode:n,initialName:r,initialPath:i,isPending:a,error:l,templates:c,validate:d,onSubmit:h,onOpenChange:u}=t,f=a===void 0?!1:a,m=ue(),[p,g]=P.useState(r),[x,b]=P.useState(i),[v,_]=P.useState(Uo),[L,y]=P.useState(null),[w,S]=P.useState(s);s!==w&&(S(s),s&&(g(r),b(i),_(Uo),y(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==u?(j=de=>{!de&&!f&&(y(null),u(!1))},e[0]=f,e[1]=u,e[2]=j):j=e[2];const N=j;let V;e[3]!==f||e[4]!==p||e[5]!==h||e[6]!==x||e[7]!==k||e[8]!==v||e[9]!==d?(V=async de=>{de.preventDefault();const ae=p.trim(),re=x.trim();if(!ae||!re||f)return;const ie=F9(re);if(ie){y(ie);return}const Y=d?.({name:ae,path:re});if(Y){y(Y);return}y(null),await h({name:ae,path:re,templateKey:k&&v!==Uo?v:null})},e[3]=f,e[4]=p,e[5]=h,e[6]=x,e[7]=k,e[8]=v,e[9]=d,e[10]=V):V=e[10];const C=V,T=L??l,A=Zoe[n];let R;e[11]!==m||e[12]!==A?(R=m(A),e[11]=m,e[12]=A,e[13]=R):R=e[13];let E;e[14]!==R?(E=o.jsx(ls,{children:o.jsx(qt,{children:R})}),e[14]=R,e[15]=E):E=e[15];let I;e[16]!==f||e[17]!==k||e[18]!==m||e[19]!==v||e[20]!==c?(I=k&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:m("sandbox.pageFormDialog.labelTemplate")}),o.jsx(ZS,{id:"page-form-template",value:v,onChange:_,templates:c??[],disabled:f})]}),e[16]=f,e[17]=k,e[18]=m,e[19]=v,e[20]=c,e[21]=I):I=e[21];let D;e[22]!==m?(D=m("sandbox.pageFormDialog.labelName"),e[22]=m,e[23]=D):D=e[23];let O;e[24]!==D?(O=o.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:D}),e[24]=D,e[25]=O):O=e[25];let $;e[26]===Symbol.for("react.memo_cache_sentinel")?($=de=>g(de.target.value),e[26]=$):$=e[26];let M;e[27]!==m?(M=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=M):M=e[28];let z;e[29]!==f||e[30]!==p||e[31]!==M?(z=o.jsx(yt,{id:"page-form-name",value:p,onChange:$,placeholder:M,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=M,e[32]=z):z=e[32];let F;e[33]!==z||e[34]!==O?(F=o.jsxs("div",{className:"space-y-1.5",children:[O,z]}),e[33]=z,e[34]=O,e[35]=F):F=e[35];let B;e[36]!==m?(B=m("sandbox.pageFormDialog.labelPath"),e[36]=m,e[37]=B):B=e[37];let H;e[38]!==B?(H=o.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:B}),e[38]=B,e[39]=H):H=e[39];let W;e[40]===Symbol.for("react.memo_cache_sentinel")?(W=de=>b(de.target.value),e[40]=W):W=e[40];let K;e[41]!==m?(K=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=K):K=e[42];let q;e[43]!==f||e[44]!==x||e[45]!==K?(q=o.jsx(yt,{id:"page-form-path",value:x,onChange:W,placeholder:K,disabled:f}),e[43]=f,e[44]=x,e[45]=K,e[46]=q):q=e[46];let G;e[47]!==H||e[48]!==q?(G=o.jsxs("div",{className:"space-y-1.5",children:[H,q]}),e[47]=H,e[48]=q,e[49]=G):G=e[49];let te;e[50]!==T?(te=T&&o.jsx("p",{className:"text-xs text-destructive",children:T}),e[50]=T,e[51]=te):te=e[51];let X;e[52]!==F||e[53]!==G||e[54]!==te||e[55]!==I?(X=o.jsxs("div",{className:"space-y-4 py-4",children:[I,F,G,te]}),e[52]=F,e[53]=G,e[54]=te,e[55]=I,e[56]=X):X=e[56];let Z;e[57]!==u?(Z=()=>u(!1),e[57]=u,e[58]=Z):Z=e[58];let ee;e[59]!==m?(ee=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=ee):ee=e[60];let se;e[61]!==f||e[62]!==Z||e[63]!==ee?(se=o.jsx(me,{type:"button",variant:"outline",onClick:Z,disabled:f,children:ee}),e[61]=f,e[62]=Z,e[63]=ee,e[64]=se):se=e[64];let J;e[65]!==f||e[66]!==p||e[67]!==x?(J=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=J):J=e[68];let oe;e[69]!==f||e[70]!==n||e[71]!==m?(oe=f?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),m(tae[n])]}):m(eae[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=oe):oe=e[72];let ce;e[73]!==J||e[74]!==oe?(ce=o.jsx(me,{type:"submit",disabled:J,children:oe}),e[73]=J,e[74]=oe,e[75]=ce):ce=e[75];let he;e[76]!==se||e[77]!==ce?(he=o.jsxs(Yn,{children:[se,ce]}),e[76]=se,e[77]=ce,e[78]=he):he=e[78];let ne;e[79]!==C||e[80]!==X||e[81]!==he||e[82]!==E?(ne=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:C,children:[E,X,he]})}),e[79]=C,e[80]=X,e[81]=he,e[82]=E,e[83]=ne):ne=e[83];let Q;return e[84]!==N||e[85]!==s||e[86]!==ne?(Q=o.jsx(zt,{open:s,onOpenChange:N,children:ne}),e[84]=N,e[85]=s,e[86]=ne,e[87]=Q):Q=e[87],Q}const nae=[{value:"temporary",labelKey:"sandbox.redirectEditor.typeTemporary"},{value:"permanent",labelKey:"sandbox.redirectEditor.typePermanent"}],hv={from:"",to:"",type:"temporary",discardQueryParameters:!1};function rae(t){const e=U.c(111),{open:s,isPending:n,error:r,onSubmit:i,onOpenChange:a}=t,l=n===void 0?!1:n,c=ue(),[d,h]=P.useState(hv),[u,f]=P.useState(null),[m,p]=P.useState(s);s!==m&&(p(s),s&&(h(hv),f(null)));let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=ke=>h(Ve=>({...Ve,...ke})),e[0]=g):g=e[0];const x=g;let b;e[1]!==l||e[2]!==a?(b=ke=>{!ke&&!l&&(f(null),a(!1))},e[1]=l,e[2]=a,e[3]=b):b=e[3];const v=b;let _;e[4]!==l||e[5]!==i||e[6]!==d||e[7]!==c?(_=async ke=>{ke.preventDefault();const Ve=d.from.trim(),Pe=d.to.trim();if(!Ve||!Pe||l){f(c("sandbox.redirectFormDialog.errorRequired"));return}f(null),await i({...d,from:Ve,to:Pe})},e[4]=l,e[5]=i,e[6]=d,e[7]=c,e[8]=_):_=e[8];const L=_,y=u??r;let w;e[9]!==l||e[10]!==d.from||e[11]!==d.to?(w=!!d.from.trim()&&!!d.to.trim()&&!l,e[9]=l,e[10]=d.from,e[11]=d.to,e[12]=w):w=e[12];const S=w;let k;e[13]!==c?(k=c("sandbox.redirectFormDialog.title"),e[13]=c,e[14]=k):k=e[14];let j;e[15]!==k?(j=o.jsx(ls,{children:o.jsx(qt,{children:k})}),e[15]=k,e[16]=j):j=e[16];let N;e[17]!==c?(N=c("sandbox.redirectEditor.fromLabel"),e[17]=c,e[18]=N):N=e[18];let V;e[19]!==N?(V=o.jsx(At,{htmlFor:"redirect-form-from",children:N}),e[19]=N,e[20]=V):V=e[20];const C=d.from;let T;e[21]===Symbol.for("react.memo_cache_sentinel")?(T=ke=>x({from:ke.target.value}),e[21]=T):T=e[21];let A;e[22]!==c?(A=c("sandbox.redirectEditor.fromPlaceholder"),e[22]=c,e[23]=A):A=e[23];let R;e[24]!==l||e[25]!==d.from||e[26]!==A?(R=o.jsx(yt,{id:"redirect-form-from",value:C,onChange:T,placeholder:A,autoFocus:!0,disabled:l}),e[24]=l,e[25]=d.from,e[26]=A,e[27]=R):R=e[27];let E;e[28]!==R||e[29]!==V?(E=o.jsxs("div",{className:"space-y-1.5",children:[V,R]}),e[28]=R,e[29]=V,e[30]=E):E=e[30];let I;e[31]!==c?(I=c("sandbox.redirectEditor.toLabel"),e[31]=c,e[32]=I):I=e[32];let D;e[33]!==I?(D=o.jsx(At,{htmlFor:"redirect-form-to",children:I}),e[33]=I,e[34]=D):D=e[34];const O=d.to;let $;e[35]===Symbol.for("react.memo_cache_sentinel")?($=ke=>x({to:ke.target.value}),e[35]=$):$=e[35];let M;e[36]!==c?(M=c("sandbox.redirectEditor.toPlaceholder"),e[36]=c,e[37]=M):M=e[37];let z;e[38]!==l||e[39]!==d.to||e[40]!==M?(z=o.jsx(yt,{id:"redirect-form-to",value:O,onChange:$,placeholder:M,disabled:l}),e[38]=l,e[39]=d.to,e[40]=M,e[41]=z):z=e[41];let F;e[42]!==D||e[43]!==z?(F=o.jsxs("div",{className:"space-y-1.5",children:[D,z]}),e[42]=D,e[43]=z,e[44]=F):F=e[44];let B;e[45]!==c?(B=c("sandbox.redirectEditor.typeLabel"),e[45]=c,e[46]=B):B=e[46];let H;e[47]!==B?(H=o.jsx(At,{htmlFor:"redirect-form-type",children:B}),e[47]=B,e[48]=H):H=e[48];const W=d.type;let K;e[49]===Symbol.for("react.memo_cache_sentinel")?(K=ke=>x({type:ke}),e[49]=K):K=e[49];let q;e[50]!==c?(q=c("sandbox.redirectEditor.typePlaceholder"),e[50]=c,e[51]=q):q=e[51];let G;e[52]!==q?(G=o.jsx(bs,{id:"redirect-form-type",className:"w-full",children:o.jsx(js,{placeholder:q})}),e[52]=q,e[53]=G):G=e[53];let te;e[54]!==c?(te=nae.map(ke=>o.jsx(It,{value:ke.value,children:c(ke.labelKey,{status:SS[ke.value]})},ke.value)),e[54]=c,e[55]=te):te=e[55];let X;e[56]!==te?(X=o.jsx(vs,{children:te}),e[56]=te,e[57]=X):X=e[57];let Z;e[58]!==l||e[59]!==d.type||e[60]!==G||e[61]!==X?(Z=o.jsxs(xs,{value:W,onValueChange:K,disabled:l,children:[G,X]}),e[58]=l,e[59]=d.type,e[60]=G,e[61]=X,e[62]=Z):Z=e[62];let ee;e[63]!==H||e[64]!==Z?(ee=o.jsxs("div",{className:"space-y-1.5",children:[H,Z]}),e[63]=H,e[64]=Z,e[65]=ee):ee=e[65];let se;e[66]===Symbol.for("react.memo_cache_sentinel")?(se=ke=>x({discardQueryParameters:ke===!0}),e[66]=se):se=e[66];let J;e[67]!==l||e[68]!==d.discardQueryParameters?(J=o.jsx(il,{checked:d.discardQueryParameters,disabled:l,onCheckedChange:se}),e[67]=l,e[68]=d.discardQueryParameters,e[69]=J):J=e[69];let oe;e[70]!==c?(oe=c("sandbox.redirectEditor.discardQueryParameters"),e[70]=c,e[71]=oe):oe=e[71];let ce;e[72]!==oe?(ce=o.jsx("span",{className:"text-sm",children:oe}),e[72]=oe,e[73]=ce):ce=e[73];let he;e[74]!==J||e[75]!==ce?(he=o.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5",children:[J,ce]}),e[74]=J,e[75]=ce,e[76]=he):he=e[76];let ne;e[77]!==y?(ne=y&&o.jsx("p",{className:"text-xs text-destructive",children:y}),e[77]=y,e[78]=ne):ne=e[78];let Q;e[79]!==E||e[80]!==F||e[81]!==ee||e[82]!==he||e[83]!==ne?(Q=o.jsxs("div",{className:"space-y-4 py-4",children:[E,F,ee,he,ne]}),e[79]=E,e[80]=F,e[81]=ee,e[82]=he,e[83]=ne,e[84]=Q):Q=e[84];let de;e[85]!==a?(de=()=>a(!1),e[85]=a,e[86]=de):de=e[86];let ae;e[87]!==c?(ae=c("sandbox.redirectFormDialog.cancel"),e[87]=c,e[88]=ae):ae=e[88];let re;e[89]!==l||e[90]!==de||e[91]!==ae?(re=o.jsx(me,{type:"button",variant:"outline",onClick:de,disabled:l,children:ae}),e[89]=l,e[90]=de,e[91]=ae,e[92]=re):re=e[92];const ie=!S;let Y;e[93]!==l||e[94]!==c?(Y=l?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),c("sandbox.redirectFormDialog.pending")]}):c("sandbox.redirectFormDialog.submit"),e[93]=l,e[94]=c,e[95]=Y):Y=e[95];let pe;e[96]!==ie||e[97]!==Y?(pe=o.jsx(me,{type:"submit",disabled:ie,children:Y}),e[96]=ie,e[97]=Y,e[98]=pe):pe=e[98];let be;e[99]!==re||e[100]!==pe?(be=o.jsxs(Yn,{children:[re,pe]}),e[99]=re,e[100]=pe,e[101]=be):be=e[101];let _e;e[102]!==L||e[103]!==Q||e[104]!==be||e[105]!==j?(_e=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:L,children:[j,Q,be]})}),e[102]=L,e[103]=Q,e[104]=be,e[105]=j,e[106]=_e):_e=e[106];let Le;return e[107]!==v||e[108]!==s||e[109]!==_e?(Le=o.jsx(zt,{open:s,onOpenChange:v,children:_e}),e[107]=v,e[108]=s,e[109]=_e,e[110]=Le):Le=e[110],Le}function iae(t){const e=U.c(70),{open:s,blockKey:n,initialName:r,isPending:i,onSubmit:a,onOpenChange:l}=t,c=i===void 0?!1:i,d=ue(),[h,u]=P.useState(r),[f,m]=P.useState(s);s!==f&&(m(s),s&&u(r));let p;e[0]!==c||e[1]!==l?(p=W=>{!W&&!c&&l(!1)},e[0]=c,e[1]=l,e[2]=p):p=e[2];const g=p;let x;e[3]!==c||e[4]!==h||e[5]!==a?(x=async W=>{W.preventDefault();const K=h.trim();!K||c||await a(K)},e[3]=c,e[4]=h,e[5]=a,e[6]=x):x=e[6];const b=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let _;e[9]!==v?(_=o.jsx(qt,{children:v}),e[9]=v,e[10]=_):_=e[10];let L;e[11]!==d?(L=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=L):L=e[12];let y;e[13]!==L?(y=o.jsx(In,{children:L}),e[13]=L,e[14]=y):y=e[14];let w;e[15]!==_||e[16]!==y?(w=o.jsxs(ls,{children:[_,y]}),e[15]=_,e[16]=y,e[17]=w):w=e[17];let S;e[18]!==d?(S=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=S):S=e[19];let k;e[20]!==S?(k=o.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:S}),e[20]=S,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=W=>u(W.target.value),e[22]=j):j=e[22];let N;e[23]!==c||e[24]!==h?(N=o.jsx(yt,{id:"section-rename-name",value:h,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=h,e[25]=N):N=e[25];let V;e[26]!==k||e[27]!==N?(V=o.jsxs("div",{className:"space-y-1.5",children:[k,N]}),e[26]=k,e[27]=N,e[28]=V):V=e[28];let C;e[29]!==d?(C=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=C):C=e[30];let T;e[31]!==C?(T=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:C}),e[31]=C,e[32]=T):T=e[32];let A;e[33]!==n?(A=o.jsx(yt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=A):A=e[34];let R;e[35]!==T||e[36]!==A?(R=o.jsxs("div",{className:"space-y-1.5",children:[T,A]}),e[35]=T,e[36]=A,e[37]=R):R=e[37];let E;e[38]!==V||e[39]!==R?(E=o.jsxs("div",{className:"space-y-4 py-4",children:[V,R]}),e[38]=V,e[39]=R,e[40]=E):E=e[40];let I;e[41]!==l?(I=()=>l(!1),e[41]=l,e[42]=I):I=e[42];let D;e[43]!==d?(D=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=D):D=e[44];let O;e[45]!==c||e[46]!==I||e[47]!==D?(O=o.jsx(me,{type:"button",variant:"outline",onClick:I,disabled:c,children:D}),e[45]=c,e[46]=I,e[47]=D,e[48]=O):O=e[48];let $;e[49]!==c||e[50]!==h?($=!h.trim()||c,e[49]=c,e[50]=h,e[51]=$):$=e[51];let M;e[52]!==c||e[53]!==d?(M=c?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=M):M=e[54];let z;e[55]!==$||e[56]!==M?(z=o.jsx(me,{type:"submit",disabled:$,children:M}),e[55]=$,e[56]=M,e[57]=z):z=e[57];let F;e[58]!==O||e[59]!==z?(F=o.jsxs(Yn,{children:[O,z]}),e[58]=O,e[59]=z,e[60]=F):F=e[60];let B;e[61]!==b||e[62]!==E||e[63]!==F||e[64]!==w?(B=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:b,children:[w,E,F]})}),e[61]=b,e[62]=E,e[63]=F,e[64]=w,e[65]=B):B=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==B?(H=o.jsx(zt,{open:s,onOpenChange:g,children:B}),e[66]=g,e[67]=s,e[68]=B,e[69]=H):H=e[69],H}function oae(t){const e=U.c(7),{type:s}=t,n=SS[s];let r;e[0]!==n?(r=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:n})}),e[0]=n,e[1]=r):r=e[1];const i=s==="permanent"?"Permanent":"Temporary";let a;e[2]!==i?(a=o.jsx(We,{side:"left",children:i}),e[2]=i,e[3]=a):a=e[3];let l;return e[4]!==r||e[5]!==a?(l=o.jsxs(qe,{children:[r,a]}),e[4]=r,e[5]=a,e[6]=l):l=e[6],l}const sm={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},ux=["posts","authors","categories"],mu={posts:"post",authors:"author",categories:"category"};function pu(t){return ux.includes(t)}const hx={posts:"post",authors:"author",categories:"category"},lj={posts:sm.post,authors:sm.author,categories:sm.category},aae=Object.fromEntries(Object.entries(lj).map(([t,e])=>[e,t]));function lae(t){return typeof t=="string"?aae[t]??null:null}function ta(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function os(t){return typeof t=="string"?t:""}function cae(t,e){switch(t){case"posts":return{label:os(e.title)||"Untitled post",subtitle:os(e.slug)};case"authors":return{label:os(e.name)||"Unnamed author",subtitle:os(e.email)};case"categories":return{label:os(e.name)||"Unnamed category",subtitle:os(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function cj(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const r=ta(n);if(!r)continue;const i=lae(r.__resolveType);if(!i)continue;const a=ta(r[hx[i]])??{},{label:l,subtitle:c}=cae(i,a);e[i].push({key:s,kind:i,label:l,subtitle:c})}for(const s of ux)e[s].sort((n,r)=>n.label.localeCompare(r.label));return e}function dae(t,e){return cj(t)[e]}function Ou(t,e){return dae(t,e).map(s=>({key:s.key,payload:Yd(ta(t[s.key])??void 0,e)}))}const fv=Object.freeze({});function Yd(t,e){return t?ta(t[hx[e]])??fv:fv}function Sc(t,e,s){return{name:t,__resolveType:lj[e],[hx[e]]:s}}function e3e({records:t,selected:e,valueField:s,toRef:n}){const r=Array.isArray(e)?e:[],i=f=>typeof f=="string"?f:os(ta(f)?.[s]),a=f=>typeof f=="string"?f:os(ta(f)?.name),l=f=>{const m=i(f),p=m?t.find(({payload:x})=>os(x[s])===m):void 0;if(p)return p;const g=a(f);return g?t.find(({payload:x})=>os(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:os(m.name)||os(m[s])||f})),d=new Map,h=[];return r.forEach((f,m)=>{const p=l(f);if(p){h.includes(p.key)||h.push(p.key);return}const g=`unresolved:${m}`;d.set(g,f),h.push(g),c.push({value:g,label:a(f)||i(f)||"Unknown"})}),{options:c,selectedValues:h,refsForValues:f=>f.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function Ya(t){return Array.isArray(t)?t:[]}function Ui(t){if(typeof t=="string")return t;const e=ta(t);return e?os(e.slug):""}function uae(t){if(typeof t=="string")return t;const e=ta(t);return e?os(e.email):""}function dj(t){const e=[];return os(t.title).trim()||e.push("Title"),os(t.slug).trim()||e.push("Slug"),Ya(t.categories).map(Ui).filter(Boolean).length===0&&e.push("Category"),os(t.excerpt).trim()||e.push("Excerpt"),os(t.image).trim()||e.push("Cover image"),e}const uj=8;function hj(t){const e=os(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function t3e(t,e){return e!=="published"||hj(t)==="published"?!1:dj(t).length>0}function hae(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,uj).toISOString()}function s3e(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=os(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?hae(s):n}}function fj(t){return Ou(t,"posts").map(({key:e,payload:s})=>({key:e,title:os(s.title)||"Untitled post",slug:os(s.slug),date:os(s.date),scheduledDatetime:os(s.scheduledDatetime),categorySlugs:Ya(s.categories).map(Ui).filter(Boolean),authorEmails:Ya(s.authors).map(uae).filter(Boolean),missing:dj(s),status:hj(s)}))}function fae(t,e){const s=Ya(t.categories);return s.some(n=>Ui(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function mae(t,e){const s=Ya(t.categories);return s.length===1&&Ui(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function n3e(t,e,s){const n=Ya(t.categories);if(!n.some(l=>Ui(l)===e))return t;const r=n.map(l=>{const c=Ui(l);return c===e||c===s.slug?{name:s.name,slug:s.slug}:l}),i=new Set,a=r.filter(l=>{const c=Ui(l);return c?i.has(c)?!1:(i.add(c),!0):!0});return{...t,categories:a}}function pae(t,e){const s=Ya(t.categories);return s.some(n=>Ui(n)===e)?{...t,categories:s.filter(n=>Ui(n)!==e)}:t}function mv(t){return{...t,dateModified:new Date().toISOString()}}function Ap(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function nm(t,e){const s=`collections/blog/${e}/${Ap(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function mj(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Ap(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${Ap(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const gae={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},pv="Box";function xae(t){return t.startsWith("site/")?"site":"app"}function bae(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Ed(...t){for(const e of t)if(e!==void 0)return e}function r3e(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const r of Object.values(n))for(const i of Object.keys(r)){if(!_ae(i)||e.has(i))continue;e.add(i);const a=ua(i,t),l=vae(i),c=gae[l],d=xae(i),h=(d==="site"?Ed(a.title,c?.title):Ed(c?.title,a.title))??l,u=d==="site"?Ed(a.description,c?.description):Ed(c?.description,a.description),f=d==="site"?a.icon:void 0,m=f&&bae(f)?f:void 0,p=m!==void 0?c?.iconName??pv:Ed(f,c?.iconName)??pv;s.push({resolveType:i,title:h,description:u,iconName:p,iconUrl:m,source:d})}return s.sort((r,i)=>r.title.localeCompare(i.title))}function vae(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const yae=["blog/sections/blocks/","site/sections/Blog/Post/"];function _ae(t){return yae.some(e=>t.startsWith(e))}const i3e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],o3e=["January","February","March","April","May","June","July","August","September","October","November","December"],pj=1440*60*1e3;function Ra(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function a3e(t){return new Date(t.getFullYear(),t.getMonth(),1)}function l3e(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Nf(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function Ep(t,e){return Math.round((Ra(t).getTime()-Ra(e).getTime())/pj)}function Lae(t){const e=(t.getTime()-Ra(t).getTime())/pj;return Math.min(Math.max(e,0),1)}function gv(t,e){return Ep(t,e)+Lae(t)}function c3e(t){const e=Nf(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const r=[];for(let i=0;i<7;i++)r.push(Nf(e,n*7+i));s.push(r)}for(;s.length>0&&s[s.length-1].every(n=>n.getMonth()!==t.getMonth());)s.pop();return s}function d3e(t,e){const s=Ra(t[0]),n=Nf(s,7),r=s.getTime(),i=n.getTime(),a=[];for(const d of e){const h=Ra(d.start),u=Ra(d.end);if(u.getTime()<s.getTime()||h.getTime()>=n.getTime())continue;const f=h.getTime()<s.getTime()?s:h,m=u.getTime()>=n.getTime()?Nf(n,-1):u,p=Ep(f,s),g=Ep(m,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),r),b=Math.min(d.end.getTime(),i),v=gv(new Date(x),s),_=Math.max(gv(new Date(b),s)-v,0);_<=0||a.push({variant:d,startCol:p,span:g,leftUnits:v,widthUnits:_})}a.sort((d,h)=>d.startCol-h.startCol||h.span-d.span||d.variant.blockKey.localeCompare(h.variant.blockKey));const l=[],c=[];for(const d of a){let h=l.findIndex(u=>u<=d.startCol);h===-1&&(h=l.length,l.push(0)),l[h]=d.startCol+d.span,c.push({...d,lane:h})}return c}function Vf(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const gj=/^(\d{4})-(\d{2})-(\d{2})$/;function Tf(t){const e=t.trim();if(!e)return null;const s=gj.exec(e);if(s){const r=Number(s[1]),i=Number(s[2])-1,a=Number(s[3]),l=new Date(r,i,a);return l.getMonth()===i&&l.getDate()===a?l:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:Ra(n)}function wae(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),uj);return{...mj("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:Vf(t)}}function Sae(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(gj.test(e))return Tf(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function kae(t,e){const s=Sae(t.scheduledDatetime);if(!s)return null;const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),r={...t,scheduledDatetime:n.toISOString()};return(typeof t.date=="string"?t.date:"")===Vf(s)&&(r.date=Vf(n)),r}function jae(t){return Tf(t.scheduledDatetime)??Tf(t.date)}function u3e(t){const e=new Map,s=[];for(const r of t){const i={post:r,scheduled:Tf(r.scheduledDatetime)!==null},a=jae(r);if(!a){s.push(i);continue}const l=Vf(a),c=e.get(l);c?c.push(i):e.set(l,[i])}const n=(r,i)=>Number(i.scheduled)-Number(r.scheduled)||r.post.title.localeCompare(i.post.title);for(const r of e.values())r.sort(n);return s.sort(n),{byDay:e,undated:s}}const Cae="0.161.0",Nae="0.162.0",h3e="deno task update";function xv(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function bv(t,e){const s=xv(t),n=xv(e);if(!s||!n)return 0;for(let r=0;r<3;r++){const i=s[r]-n[r];if(i!==0)return i}return 0}const xj=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Vae(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const n=xj.exec(s)?.[1];if(n)return n}return null}function Tae(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const n=s?.title;if(typeof n!="string")continue;const r=xj.exec(n)?.[1];if(r)return r}return null}function Pae(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=Vae(t.denoJson)??Tae(t.meta);return!e||bv(e,Cae)<0?{kind:"outdated",version:e}:bv(e,Nae)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function f3e(t){return t.kind==="publish-only"||t.kind==="full"}function m3e(t){return t.kind==="full"}function Aae(t){const e=U.c(16),s=Vs(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=L0(t.virtualMcpId),r=ws()?.taskId??null;let i;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(i=at.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=i):i=e[3];let a;e[4]!==n||e[5]!==t||e[6]!==r?(a=async()=>{const f=await T3({...t,threadId:r},_0(n,"deno.json"));return f.kind==="data"?f.data:null},e[4]=n,e[5]=t,e[6]=r,e[7]=a):a=e[7];const l=s==="deno";let c;e[8]!==i||e[9]!==a||e[10]!==l?(c={queryKey:i,queryFn:a,enabled:l,staleTime:3e5},e[8]=i,e[9]=a,e[10]=l,e[11]=c):c=e[11];const{data:d}=Zt(c),h=d??null;let u;return e[12]!==s||e[13]!==t.meta||e[14]!==h?(u=Pae({packageManager:s,denoJson:h,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=h,e[15]=u):u=e[15],u}function Eae({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:r}){const i=ue(),a=n[s],l=a===void 0,c=l?"":JSON.stringify(a,null,2),[d,h]=P.useState(!1),[u,f]=P.useState(c),[m,p]=P.useState(!1),g=!r||l,x=u!==c,b=()=>{navigator.clipboard.writeText(u).then(()=>{h(!0),setTimeout(()=>h(!1),2e3)})},v=async _=>{if(!r||m)return;let L;try{L=JSON.parse(_)}catch{ye.error(i("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await r(L),ye.success(i("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(y){ye.error(i("sectionsEditor.pageJsonDialog.saveError",{error:y instanceof Error?y.message:String(y)}))}finally{p(!1)}};return o.jsx(zt,{open:t,onOpenChange:e,children:o.jsxs(Bt,{className:"max-w-3xl p-0 gap-0",children:[o.jsxs(ls,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[o.jsx(qt,{className:"text-sm font-semibold",children:i("sectionsEditor.pageJsonDialog.title")}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs(me,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?o.jsx(gi,{size:12}):o.jsx(bn,{size:12}),i(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&o.jsx(me,{size:"sm",onClick:()=>v(u),disabled:!x||m,className:"h-7 text-xs",children:i(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),l?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",i("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"h-[70vh]",children:o.jsx(ud,{code:c,language:"json",readOnly:g,height:"100%",onChange:_=>f(_??""),onSave:_=>{v(_)}})})]})})}function kr(t){const e=U.c(46),{icon:s,logoUrl:n,title:r,subtitle:i,active:a,accent:l,variantCount:c,trailing:d,selectable:h,selectionActive:u,selected:f,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,v=ue(),_=l==="global";let L;e[0]!==s||e[1]!==a||e[2]!==_||e[3]!==n||e[4]!==c?(L=c&&c>1?o.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(s,{size:16,className:"shrink-0 text-success"})}),o.jsxs(We,{side:"right",children:[c," variants"]})]})}):n?o.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):o.jsx("span",{className:le("flex size-8 shrink-0 items-center justify-center rounded-lg",_?"bg-global-section/15":"bg-muted"),children:o.jsx(s,{size:16,className:le("shrink-0",!_&&(a?"text-accent-foreground":"text-muted-foreground")),style:_?{color:E3}:void 0})}),e[0]=s,e[1]=a,e[2]=_,e[3]=n,e[4]=c,e[5]=L):L=e[5];const y=L,w=a?_?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":_?"hover:bg-global-section/10":"hover:bg-muted";let S;e[6]!==w?(S=le("group relative flex min-w-0 items-center rounded-md transition-colors",w),e[6]=w,e[7]=S):S=e[7];let k;e[8]!==g||e[9]!==h||e[10]!==f||e[11]!==u||e[12]!==v||e[13]!==r?(k=h&&o.jsx("span",{className:le("flex shrink-0 items-center pl-2.5 transition-opacity",f||u?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:Rae,children:o.jsx(il,{checked:f,onCheckedChange:()=>g?.(),"aria-label":v("sandbox.itemRow.selectItem",{title:r})})}),e[8]=g,e[9]=h,e[10]=f,e[11]=u,e[12]=v,e[13]=r,e[14]=k):k=e[14];const j=m&&!a&&"text-destructive";let N;e[15]!==j?(N=le("block truncate text-sm font-medium",j),e[15]=j,e[16]=N):N=e[16];let V;e[17]!==N||e[18]!==r?(V=o.jsx("span",{className:N,children:r}),e[17]=N,e[18]=r,e[19]=V):V=e[19];const C=a?"text-accent-foreground/70":"text-muted-foreground";let T;e[20]!==C?(T=le("block truncate text-xs",C),e[20]=C,e[21]=T):T=e[21];let A;e[22]!==i||e[23]!==T?(A=o.jsx("span",{className:T,children:i}),e[22]=i,e[23]=T,e[24]=A):A=e[24];let R;e[25]!==A||e[26]!==V?(R=o.jsxs("span",{className:"min-w-0 flex-1",children:[V,A]}),e[25]=A,e[26]=V,e[27]=R):R=e[27];let E;e[28]!==a||e[29]!==m||e[30]!==p?(E=m&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:le("flex shrink-0 items-center",a?"text-accent-foreground":"text-destructive"),children:o.jsx(vn,{size:14})})}),p&&o.jsx(We,{side:"bottom",children:p})]}),e[28]=a,e[29]=m,e[30]=p,e[31]=E):E=e[31];let I;e[32]!==x||e[33]!==y||e[34]!==R||e[35]!==E||e[36]!==d?(I=o.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[y,R,E,d]}),e[32]=x,e[33]=y,e[34]=R,e[35]=E,e[36]=d,e[37]=I):I=e[37];let D;e[38]!==a||e[39]!==b?(D=b&&o.jsx("div",{className:le("pr-1 opacity-0 transition-opacity group-hover:opacity-100",a&&"opacity-100"),children:b}),e[38]=a,e[39]=b,e[40]=D):D=e[40];let O;return e[41]!==I||e[42]!==D||e[43]!==S||e[44]!==k?(O=o.jsxs("div",{className:S,children:[k,I,D]}),e[41]=I,e[42]=D,e[43]=S,e[44]=k,e[45]=O):O=e[45],O}function Rae(t){return t.stopPropagation()}function Oo(t){const e=U.c(10),{icon:s,title:n,description:r}=t;let i;e[0]!==s?(i=s&&o.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=i):i=e[1];let a;e[2]!==n?(a=o.jsx("div",{children:n}),e[2]=n,e[3]=a):a=e[3];let l;e[4]!==r?(l=r&&o.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:r}),e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==i||e[7]!==a||e[8]!==l?(c=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[i,a,l]}),e[6]=i,e[7]=a,e[8]=l,e[9]=c):c=e[9],c}const Dae={loaders:Ia,actions:hi},Mae={loaders:"Loaders",actions:"Actions"},Iae={analytics:NA,blog:Hc,commerce:CA,site:JT,website:Cn};function Oae(t,e){return e===0?Iae[t.toLowerCase()]??qo:qo}function fh(t,e){return e===0?tse(t):t}function $ae(t){const e=U.c(98),{orgSlug:s,virtualMcpId:n,branch:r,previewUrl:i,meta:a,decofile:l,kind:c}=t,d=ue();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[u,f]=P.useState(h),[m,p]=P.useState(null),[g,x]=P.useState(""),[b,v]=P.useState(qae),[_,L]=P.useState(c);_!==c&&(L(c),f([]),p(null),x(""),v(new Set));let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=B=>{v(H=>{const W=new Set(H);return W.has(B)?W.delete(B):W.add(B),W})},e[1]=y):y=e[1];const w=y;let S;e[2]!==r||e[3]!==s||e[4]!==n?(S={orgSlug:s,virtualMcpId:n,branch:r},e[2]=r,e[3]=s,e[4]=n,e[5]=S):S=e[5];const k=w0(S);let j;e[6]!==k?(j=Q3((B,H)=>k.mutate({blockKey:B,data:H})),e[6]=k,e[7]=j):j=e[7];const N=j;let V;e[8]!==c?(V=tk(c),e[8]=c,e[9]=V):V=e[9];const C=V,T=Dae[c];let A,R,E,I,D,O,$;if(e[10]!==T||e[11]!==r||e[12]!==l||e[13]!==c||e[14]!==a||e[15]!==b||e[16]!==s||e[17]!==u||e[18]!==i||e[19]!==k||e[20]!==N||e[21]!==g||e[22]!==m||e[23]!==C||e[24]!==d||e[25]!==n){E=Symbol.for("react.early_return_sentinel");e:{const B=[...ik(a,l,c).map(Wae),...nk(a,c).map(Kae)],H=g.trim().toLowerCase(),W=H.length>0,K=W?B.filter(xe=>xe.title.toLowerCase().includes(H)||xe.resolveType.toLowerCase().includes(H)):[],q=new Map,G=[],te=new Map;if(!W){for(const xe of B){const Ne=xe.folderPath;if(!(Ne.length<u.length)&&u.every((je,we)=>Ne[we]===je))if(Ne.length===u.length)if(xe.savedKey!==void 0){const je=te.get(xe.resolveType);je?je.push(xe):te.set(xe.resolveType,[xe])}else G.push(xe);else{const je=Ne[u.length],we=q.get(je)??{count:0,savedCount:0};xe.savedKey!==void 0?we.savedCount=we.savedCount+1:we.count=we.count+1,q.set(je,we)}}G.sort(Hae);for(const xe of te.values())xe.sort(Uae)}const X=[...te.entries()].filter(xe=>{const[Ne]=xe;return!G.some(je=>je.resolveType===Ne)}).flatMap(Fae).sort(zae);let Z;e[33]!==u?(Z=(xe,Ne)=>fh(xe.name,u.length).localeCompare(fh(Ne.name,u.length)),e[33]=u,e[34]=Z):Z=e[34];const ee=[...q.entries()].map(Bae).sort(Z);let se;e[35]===Symbol.for("react.memo_cache_sentinel")?(se=xe=>{p(xe.savedKey!==void 0?{mode:"saved",key:xe.savedKey}:{mode:"available",resolveType:xe.resolveType,title:xe.title})},e[35]=se):se=e[35];const J=se;let oe;e[36]!==k||e[37]!==C||e[38]!==d?(oe=async(xe,Ne)=>{await k.mutateAsync({blockKey:xe,data:Ne}),ye.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:C,blockId:xe})),p({mode:"saved",key:xe})},e[36]=k,e[37]=C,e[38]=d,e[39]=oe):oe=e[39];const ce=oe;let he;e[40]!==l||e[41]!==m?(he=Gae(m,l),e[40]=l,e[41]=m,e[42]=he):he=e[42];const ne=he;if(ne){const xe=`${ne.mode}:${ne.mode==="saved"?ne.blockKey:ne.resolveType}`;let Ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(Ne=()=>p(null),e[43]=Ne):Ne=e[43];let je;e[44]!==r||e[45]!==l||e[46]!==ce||e[47]!==c||e[48]!==a||e[49]!==s||e[50]!==i||e[51]!==k.isPending||e[52]!==N||e[53]!==xe||e[54]!==ne.editorTarget||e[55]!==ne.initialValue||e[56]!==n?(je=o.jsx(sj,{orgSlug:s,virtualMcpId:n,branch:r,previewUrl:i,meta:a,decofile:l,kind:c,target:ne.editorTarget,initialValue:ne.initialValue,isCreating:k.isPending,onCreate:ce,onSaveReferencedBlock:N,onBack:Ne},xe),e[44]=r,e[45]=l,e[46]=ce,e[47]=c,e[48]=a,e[49]=s,e[50]=i,e[51]=k.isPending,e[52]=N,e[53]=xe,e[54]=ne.editorTarget,e[55]=ne.initialValue,e[56]=n,e[57]=je):je=e[57],E=je;break e}$="flex h-full w-full min-w-0 flex-col";let Q;e[58]!==d?(Q=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=Q):Q=e[59];let de;e[60]===Symbol.for("react.memo_cache_sentinel")?(de=()=>f([]),e[60]=de):de=e[60];const ae=u.length===0?"font-medium text-foreground":"text-muted-foreground";let re;e[61]!==ae?(re=le("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",ae),e[61]=ae,e[62]=re):re=e[62];const ie=Mae[c];let Y;e[63]!==re||e[64]!==ie?(Y=o.jsx("button",{type:"button",onClick:de,className:re,children:ie}),e[63]=re,e[64]=ie,e[65]=Y):Y=e[65];let pe;e[66]!==u?(pe=u.map((xe,Ne)=>{const je=Ne===u.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o.jsx(Us,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(u.slice(0,Ne+1)),className:le("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",je?"font-medium text-foreground":"text-muted-foreground"),children:fh(xe,Ne)})]},`${xe}-${Ne}`)}),e[66]=u,e[67]=pe):pe=e[67];let be;e[68]!==Q||e[69]!==Y||e[70]!==pe?(be=o.jsxs("nav",{"aria-label":Q,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[Y,pe]}),e[68]=Q,e[69]=Y,e[70]=pe,e[71]=be):be=e[71];let _e;e[72]===Symbol.for("react.memo_cache_sentinel")?(_e=o.jsx(r0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=_e):_e=e[72];let Le;e[73]===Symbol.for("react.memo_cache_sentinel")?(Le=xe=>x(xe.target.value),e[73]=Le):Le=e[73];let ke;e[74]!==c||e[75]!==d?(ke=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=ke):ke=e[76];let Ve;e[77]!==c||e[78]!==d?(Ve=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=Ve):Ve=e[79];let Pe;e[80]!==g||e[81]!==ke||e[82]!==Ve?(Pe=o.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[_e,o.jsx("input",{type:"text",value:g,onChange:Le,placeholder:ke,"aria-label":Ve,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=ke,e[82]=Ve,e[83]=Pe):Pe=e[83],e[84]!==be||e[85]!==Pe?(R=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[be,Pe]}),e[84]=be,e[85]=Pe,e[86]=R):R=e[86],A=rl,O="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",I="mx-auto w-full max-w-4xl px-6 py-5",D=W?K.length===0?o.jsx(Oo,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):o.jsx("div",{className:"flex flex-col gap-1",children:K.map(xe=>o.jsx(kr,{icon:T,accent:xe.savedKey!==void 0?"global":void 0,title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>J(xe)},xe.savedKey??xe.resolveType))}):ee.length===0&&G.length===0&&X.length===0?o.jsx(Oo,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:u.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):o.jsxs(o.Fragment,{children:[ee.length>0&&o.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:ee.map(xe=>{const Ne=Oae(xe.name,u.length);return o.jsxs("button",{type:"button",onClick:()=>f([...u,xe.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[o.jsx(Ne,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium",children:fh(xe.name,u.length)}),o.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[xe.count," ",xe.count===1?C:c,xe.savedCount>0&&o.jsxs(o.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:xe.savedCount})]})]})]})]},xe.name)})}),(G.length>0||X.length>0)&&o.jsxs("div",{className:le("flex flex-col gap-1",ee.length>0&&"mt-4"),children:[G.map(xe=>{const Ne=te.get(xe.resolveType)??[],je=b.has(xe.resolveType);return o.jsxs("div",{className:"flex flex-col",children:[o.jsx(kr,{icon:T,title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>J(xe)}),Ne.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>w(xe.resolveType),"aria-expanded":je,className:"flex items-center gap-1 self-start rounded-md px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:E3},children:[je?o.jsx(ds,{size:12,className:"shrink-0"}):o.jsx(Us,{size:12,className:"shrink-0"}),d(je?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Ne.length,")"]}),je&&o.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Ne.map(we=>o.jsx(kr,{icon:T,accent:"global",title:we.title,subtitle:we.resolveType,active:!1,onClick:()=>J(we)},we.savedKey))})]})]},xe.resolveType)}),X.map(xe=>o.jsx(kr,{icon:T,accent:"global",title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>J(xe)},xe.savedKey))]})]})}e[10]=T,e[11]=r,e[12]=l,e[13]=c,e[14]=a,e[15]=b,e[16]=s,e[17]=u,e[18]=i,e[19]=k,e[20]=N,e[21]=g,e[22]=m,e[23]=C,e[24]=d,e[25]=n,e[26]=A,e[27]=R,e[28]=E,e[29]=I,e[30]=D,e[31]=O,e[32]=$}else A=e[26],R=e[27],E=e[28],I=e[29],D=e[30],O=e[31],$=e[32];if(E!==Symbol.for("react.early_return_sentinel"))return E;let M;e[87]!==I||e[88]!==D?(M=o.jsx("div",{className:I,children:D}),e[87]=I,e[88]=D,e[89]=M):M=e[89];let z;e[90]!==A||e[91]!==M||e[92]!==O?(z=o.jsx(A,{className:O,children:M}),e[90]=A,e[91]=M,e[92]=O,e[93]=z):z=e[93];let F;return e[94]!==R||e[95]!==z||e[96]!==$?(F=o.jsxs("div",{className:$,children:[R,z]}),e[94]=R,e[95]=z,e[96]=$,e[97]=F):F=e[97],F}function Bae(t){const[e,s]=t;return{name:e,...s}}function zae(t,e){return t.title.localeCompare(e.title)}function Fae(t){const[,e]=t;return e}function Uae(t,e){return t.title.localeCompare(e.title)}function Hae(t,e){return t.title.localeCompare(e.title)}function Kae(t){return{resolveType:t.resolveType,title:t.title,folderPath:rk(t.resolveType)}}function Wae(t){return{resolveType:t.resolveType,title:t.title,folderPath:rk(t.resolveType),savedKey:t.key}}function qae(){return new Set}function Gae(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:n,title:r}=ok(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:r},initialValue:n}}function Yae(t){const e=U.c(83),{orgSlug:s,virtualMcpId:n,branch:r,previewUrl:i,meta:a,decofile:l,resolveType:c,title:d,defaultBlockId:h,isCreating:u,onCreate:f,onSaveReferencedBlock:m}=t,p=ue(),g=lo(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[v,_]=P.useState(b);let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=[],e[1]=L):L=e[1];const[y,w]=P.useState(L),[S,k]=P.useState(0),[j,N]=P.useState(!1);let V;e[2]!==a||e[3]!==c?(V=$n(c,a),e[2]=a,e[3]=c,e[4]=V):V=e[4];const C=V,T=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,A=ws()?.taskId??null,R=i??void 0;let E;e[5]!==x||e[6]!==r||e[7]!==s||e[8]!==R||e[9]!==A||e[10]!==n?(E={orgSlug:s,virtualMcpId:n,branch:r,threadId:A,previewUrl:R,siteSlug:x},e[5]=x,e[6]=r,e[7]=s,e[8]=R,e[9]=A,e[10]=n,e[11]=E):E=e[11];const I=E;let D,O,$,M,z,F,B,H;if(e[12]!==l||e[13]!==y||e[14]!==v||e[15]!==f||e[16]!==p||e[17]!==d){const re=[d,...y],ie=pe=>{w(y.slice(0,pe)),k(Qae)};let Y;e[26]!==l||e[27]!==v||e[28]!==f?(Y=async pe=>{const be=nx(pe,l);if(be){ye.error(be);return}await f(pe,v),N(!1)},e[26]=l,e[27]=v,e[28]=f,e[29]=Y):Y=e[29],D=Y,M="flex h-full w-full min-w-0",$="flex min-w-0 flex-1 flex-col",O="shrink-0 border-b px-3 py-2.5",H="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==p?(z=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=p,e[31]=z):z=e[31],F="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",B=re.map((pe,be)=>{const _e=be===re.length-1,Le=kn(pe);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[be>0&&o.jsx(Us,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>ie(be),title:Le,className:le("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",_e?"font-medium text-foreground":"text-muted-foreground"),children:Le})]},`${Le}-${be}`)}),e[12]=l,e[13]=y,e[14]=v,e[15]=f,e[16]=p,e[17]=d,e[18]=D,e[19]=O,e[20]=$,e[21]=M,e[22]=z,e[23]=F,e[24]=B,e[25]=H}else D=e[18],O=e[19],$=e[20],M=e[21],z=e[22],F=e[23],B=e[24],H=e[25];let W;e[32]!==z||e[33]!==F||e[34]!==B?(W=o.jsx("nav",{"aria-label":z,className:F,children:B}),e[32]=z,e[33]=F,e[34]=B,e[35]=W):W=e[35];let K;e[36]===Symbol.for("react.memo_cache_sentinel")?(K=()=>N(!0),e[36]=K):K=e[36];let q;e[37]!==p?(q=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=p,e[38]=q):q=e[38];let G;e[39]===Symbol.for("react.memo_cache_sentinel")?(G=o.jsx(W2,{size:14}),e[39]=G):G=e[39];let te;e[40]!==u||e[41]!==q?(te=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{size:"icon",className:"size-8 shrink-0",disabled:u,onClick:K,"aria-label":q,children:G})}),e[40]=u,e[41]=q,e[42]=te):te=e[42];let X;e[43]!==p?(X=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=p,e[44]=X):X=e[44];let Z;e[45]!==X?(Z=o.jsx(We,{side:"bottom",children:X}),e[45]=X,e[46]=Z):Z=e[46];let ee;e[47]!==te||e[48]!==Z?(ee=o.jsxs(qe,{children:[te,Z]}),e[47]=te,e[48]=Z,e[49]=ee):ee=e[49];let se;e[50]!==W||e[51]!==ee||e[52]!==H?(se=o.jsxs("div",{className:H,children:[W,ee]}),e[50]=W,e[51]=ee,e[52]=H,e[53]=se):se=e[53];const J="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",oe=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:T});let ce;e[54]!==oe?(ce=o.jsx("p",{className:J,children:oe}),e[54]=oe,e[55]=ce):ce=e[55];let he;e[56]!==O||e[57]!==se||e[58]!==ce?(he=o.jsxs("div",{className:O,children:[se,ce]}),e[56]=O,e[57]=se,e[58]=ce,e[59]=he):he=e[59];let ne;e[60]!==l||e[61]!==y||e[62]!==S||e[63]!==v||e[64]!==a||e[65]!==m||e[66]!==I||e[67]!==C||e[68]!==p?(ne=o.jsx(rl,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:C?o.jsx(Hr,{schema:C,value:v,onChange:re=>_(re),basePath:"",breadcrumbPath:y,onBreadcrumbChange:w,meta:a,decofile:l,onSaveReferencedBlock:m,sandbox:I},S):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=l,e[61]=y,e[62]=S,e[63]=v,e[64]=a,e[65]=m,e[66]=I,e[67]=C,e[68]=p,e[69]=ne):ne=e[69];let Q;e[70]!==$||e[71]!==he||e[72]!==ne?(Q=o.jsxs("div",{className:$,children:[he,ne]}),e[70]=$,e[71]=he,e[72]=ne,e[73]=Q):Q=e[73];let de;e[74]!==h||e[75]!==D||e[76]!==u||e[77]!==j?(de=o.jsx(rx,{open:j,onOpenChange:N,defaultBlockId:h,isPending:u,onSubmit:D}),e[74]=h,e[75]=D,e[76]=u,e[77]=j,e[78]=de):de=e[78];let ae;return e[79]!==M||e[80]!==Q||e[81]!==de?(ae=o.jsxs("div",{className:M,children:[Q,de]}),e[79]=M,e[80]=Q,e[81]=de,e[82]=ae):ae=e[82],ae}function Qae(t){return t+1}var Xae=Object.prototype.toString,vd=Array.isArray||function(e){return Xae.call(e)==="[object Array]"};function fx(t){return typeof t=="function"}function Jae(t){return vd(t)?"array":typeof t}function rm(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function vv(t,e){return t!=null&&typeof t=="object"&&e in t}function Zae(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var ele=RegExp.prototype.test;function tle(t,e){return ele.call(t,e)}var sle=/\S/;function nle(t){return!tle(sle,t)}var rle={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function ile(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return rle[s]})}var ole=/\s*/,ale=/\s+/,yv=/\s*=/,lle=/\s*\}/,cle=/#|\^|\/|>|\{|&|=|!/;function dle(t,e){if(!t)return[];var s=!1,n=[],r=[],i=[],a=!1,l=!1,c="",d=0;function h(){if(a&&!l)for(;i.length;)delete r[i.pop()];else i=[];a=!1,l=!1}var u,f,m;function p(k){if(typeof k=="string"&&(k=k.split(ale,2)),!vd(k)||k.length!==2)throw new Error("Invalid tags: "+k);u=new RegExp(rm(k[0])+"\\s*"),f=new RegExp("\\s*"+rm(k[1])),m=new RegExp("\\s*"+rm("}"+k[1]))}p(e||Br.tags);for(var g=new S0(t),x,b,v,_,L,y;!g.eos();){if(x=g.pos,v=g.scanUntil(u),v)for(var w=0,S=v.length;w<S;++w)_=v.charAt(w),nle(_)?(i.push(r.length),c+=_):(l=!0,s=!0,c+=" "),r.push(["text",_,x,x+1]),x+=1,_===`
625
625
  `&&(h(),c="",d=0,s=!1);if(!g.scan(u))break;if(a=!0,b=g.scan(cle)||"name",g.scan(ole),b==="="?(v=g.scanUntil(yv),g.scan(yv),g.scanUntil(f)):b==="{"?(v=g.scanUntil(m),g.scan(lle),g.scanUntil(f),b="&"):v=g.scanUntil(f),!g.scan(f))throw new Error("Unclosed tag at "+g.pos);if(b==">"?L=[b,v,x,g.pos,c,d,s]:L=[b,v,x,g.pos],d++,r.push(L),b==="#"||b==="^")n.push(L);else if(b==="/"){if(y=n.pop(),!y)throw new Error('Unopened section "'+v+'" at '+x);if(y[1]!==v)throw new Error('Unclosed section "'+y[1]+'" at '+x)}else b==="name"||b==="{"||b==="&"?l=!0:b==="="&&p(v)}if(h(),y=n.pop(),y)throw new Error('Unclosed section "'+y[1]+'" at '+g.pos);return hle(ule(r))}function ule(t){for(var e=[],s,n,r=0,i=t.length;r<i;++r)s=t[r],s&&(s[0]==="text"&&n&&n[0]==="text"?(n[1]+=s[1],n[3]=s[3]):(e.push(s),n=s));return e}function hle(t){for(var e=[],s=e,n=[],r,i,a=0,l=t.length;a<l;++a)switch(r=t[a],r[0]){case"#":case"^":s.push(r),n.push(r),s=r[4]=[];break;case"/":i=n.pop(),i[5]=r[2],s=n.length>0?n[n.length-1][4]:e;break;default:s.push(r)}return e}function S0(t){this.string=t,this.tail=t,this.pos=0}S0.prototype.eos=function(){return this.tail===""};S0.prototype.scan=function(e){var s=this.tail.match(e);if(!s||s.index!==0)return"";var n=s[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};S0.prototype.scanUntil=function(e){var s=this.tail.search(e),n;switch(s){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,s),this.tail=this.tail.substring(s)}return this.pos+=n.length,n};function td(t,e){this.view=t,this.cache={".":this.view},this.parent=e}td.prototype.push=function(e){return new td(e,this)};td.prototype.lookup=function(e){var s=this.cache,n;if(s.hasOwnProperty(e))n=s[e];else{for(var r=this,i,a,l,c=!1;r;){if(e.indexOf(".")>0)for(i=r.view,a=e.split("."),l=0;i!=null&&l<a.length;)l===a.length-1&&(c=vv(i,a[l])||Zae(i,a[l])),i=i[a[l++]];else i=r.view[e],c=vv(r.view,e);if(c){n=i;break}r=r.parent}s[e]=n}return fx(n)&&(n=n.call(this.view)),n};function Pn(){this.templateCache={_cache:{},set:function(e,s){this._cache[e]=s},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}Pn.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Pn.prototype.parse=function(e,s){var n=this.templateCache,r=e+":"+(s||Br.tags).join(":"),i=typeof n<"u",a=i?n.get(r):void 0;return a==null&&(a=dle(e,s),i&&n.set(r,a)),a};Pn.prototype.render=function(e,s,n,r){var i=this.getConfigTags(r),a=this.parse(e,i),l=s instanceof td?s:new td(s,void 0);return this.renderTokens(a,l,n,e,r)};Pn.prototype.renderTokens=function(e,s,n,r,i){for(var a="",l,c,d,h=0,u=e.length;h<u;++h)d=void 0,l=e[h],c=l[0],c==="#"?d=this.renderSection(l,s,n,r,i):c==="^"?d=this.renderInverted(l,s,n,r,i):c===">"?d=this.renderPartial(l,s,n,i):c==="&"?d=this.unescapedValue(l,s):c==="name"?d=this.escapedValue(l,s,i):c==="text"&&(d=this.rawValue(l)),d!==void 0&&(a+=d);return a};Pn.prototype.renderSection=function(e,s,n,r,i){var a=this,l="",c=s.lookup(e[1]);function d(f){return a.render(f,s,n,i)}if(c){if(vd(c))for(var h=0,u=c.length;h<u;++h)l+=this.renderTokens(e[4],s.push(c[h]),n,r,i);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")l+=this.renderTokens(e[4],s.push(c),n,r,i);else if(fx(c)){if(typeof r!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(s.view,r.slice(e[3],e[5]),d),c!=null&&(l+=c)}else l+=this.renderTokens(e[4],s,n,r,i);return l}};Pn.prototype.renderInverted=function(e,s,n,r,i){var a=s.lookup(e[1]);if(!a||vd(a)&&a.length===0)return this.renderTokens(e[4],s,n,r,i)};Pn.prototype.indentPartial=function(e,s,n){for(var r=s.replace(/[^ \t]/g,""),i=e.split(`
626
626
  `),a=0;a<i.length;a++)i[a].length&&(a>0||!n)&&(i[a]=r+i[a]);return i.join(`
627
- `)};Pn.prototype.renderPartial=function(e,s,n,r){if(n){var i=this.getConfigTags(r),a=fx(n)?n(e[1]):n[e[1]];if(a!=null){var l=e[6],c=e[5],d=e[4],h=a;c==0&&d&&(h=this.indentPartial(a,d,l));var u=this.parse(h,i);return this.renderTokens(u,s,n,h,r)}}};Pn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Pn.prototype.escapedValue=function(e,s,n){var r=this.getConfigEscape(n)||Br.escape,i=s.lookup(e[1]);if(i!=null)return typeof i=="number"&&r===Br.escape?String(i):r(i)};Pn.prototype.rawValue=function(e){return e[1]};Pn.prototype.getConfigTags=function(e){return vd(e)?e:e&&typeof e=="object"?e.tags:void 0};Pn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!vd(e))return e.escape};var Br={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){$u.templateCache=t},get templateCache(){return $u.templateCache}},$u=new Pn;Br.clearCache=function(){return $u.clearCache()};Br.parse=function(e,s){return $u.parse(e,s)};Br.render=function(e,s,n,r){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Jae(e)+'" was given as the first argument for mustache#render(template, view, partials)');return $u.render(e,s,n,r)};Br.escape=ile;Br.Scanner=S0;Br.Context=td;Br.Writer=Pn;function fle(t,e){const s={__resolveType:t},n=IS([s],e)[0];return n?cne(s,n,e):null}function mle({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:r,decofile:i,blockKey:a,onSaveReferencedBlock:l}){const c=ue(),d=lo(),h=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[u]=P.useState(()=>fle(a,i)),[f,m]=P.useState(u?.data??{}),[p,g]=P.useState([]),[x,b]=P.useState(0),[v,_]=P.useState(!1),[L,y]=P.useState(null),w=L!==null,{save:S,flush:k}=G3({orgSlug:t,virtualMcpId:e,branch:s}),j=u?.resolveType?$n(u.resolveType,r):null,N=i[a],V=N?Ka(a,N):a,C=ws()?.taskId??null,T={orgSlug:t,virtualMcpId:e,branch:s,threadId:C,previewUrl:n??void 0,siteSlug:h},A=O=>{m(O),S(a,O)},R=()=>{w?(y(null),_(!1),b(O=>O+1)):y(JSON.stringify(f,null,2))},E=O=>{const $=O??"";try{const M=JSON.parse($);if(M&&typeof M=="object"&&!Array.isArray(M)){_(!1),A(M);return}_(!0)}catch{_(!0)}},I=[V,...p],D=O=>{g(p.slice(0,O)),b($=>$+1)};return o.jsx("div",{className:"flex h-full w-full min-w-0",children:o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:E3},"aria-hidden":!0}),o.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:I.map((O,$)=>{const M=$===I.length-1,z=kn(O);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[$>0&&o.jsx(Us,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>D($),title:z,className:le("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",M?"font-medium text-foreground":"text-muted-foreground"),children:z})]},`${z}-${$}`)})}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:w?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:R,"aria-label":c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":w,children:w?o.jsx(nn,{size:14}):o.jsx(rd,{size:14})})}),o.jsx(We,{side:"bottom",children:c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),o.jsxs("div",{className:"relative min-h-0 flex-1",children:[o.jsx(rl,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:j?o.jsx(Hr,{schema:j,value:f,onChange:O=>A(O),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:r,decofile:i,onSaveReferencedBlock:l,sandbox:T},x):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),L!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[v&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ud,{language:"json",height:"100%",code:L,onChange:E,onSave:O=>{E(O),k()}})})]})]})]})})}function ple(t){const e=U.c(36),{selection:s,orgSlug:n,virtualMcpId:r,branch:i,previewUrl:a,meta:l,decofile:c,isCreating:d,onCreateAvailable:h,onSaveReferencedBlock:u}=t,f=ue();if(!s){let g;e[0]!==f?(g=f("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=f,e[1]=g):g=e[1];let x;e[2]!==f?(x=f("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=f,e[3]=x):x=e[3];let b;return e[4]!==g||e[5]!==x?(b=o.jsx(Oo,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=b):b=e[6],b}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,b=s.title;let v;e[7]!==s.title?(v=Vk(s.title),e[7]=s.title,e[8]=v):v=e[8];let _;e[9]!==h||e[10]!==s.resolveType?(_=(y,w)=>h(s.resolveType,y,w),e[9]=h,e[10]=s.resolveType,e[11]=_):_=e[11];let L;return e[12]!==i||e[13]!==c||e[14]!==d||e[15]!==l||e[16]!==u||e[17]!==n||e[18]!==a||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==v||e[23]!==_||e[24]!==r?(L=o.jsx(Yae,{orgSlug:n,virtualMcpId:r,branch:i,previewUrl:a,meta:l,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:_,onSaveReferencedBlock:u},g),e[12]=i,e[13]=c,e[14]=d,e[15]=l,e[16]=u,e[17]=n,e[18]=a,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=v,e[23]=_,e[24]=r,e[25]=L):L=e[25],L}const m=`saved:${s.key}`;let p;return e[26]!==i||e[27]!==c||e[28]!==l||e[29]!==u||e[30]!==n||e[31]!==a||e[32]!==s.key||e[33]!==m||e[34]!==r?(p=o.jsx(mle,{orgSlug:n,virtualMcpId:r,branch:i,previewUrl:a,meta:l,decofile:c,blockKey:s.key,onSaveReferencedBlock:u},m),e[26]=i,e[27]=c,e[28]=l,e[29]=u,e[30]=n,e[31]=a,e[32]=s.key,e[33]=m,e[34]=r,e[35]=p):p=e[35],p}const _v="__all__",Lv={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},gle={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},Ph={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},wv="status:";function Sv(t){if(!t.startsWith(wv))return null;const e=t.slice(wv.length);return e in Ph?e:null}const kv=P.forwardRef(function(e,s){const n=U.c(20);let r,i,a,l,c;n[0]!==e?({icon:r,active:i,value:c,className:a,...l}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=l,n[5]=c):(r=n[1],i=n[2],a=n[3],l=n[4],c=n[5]);const d=i?"text-foreground":"text-muted-foreground";let h;n[6]!==a||n[7]!==d?(h=le("h-7 gap-1 px-1.5 text-xs",d,a),n[6]=a,n[7]=d,n[8]=h):h=n[8];let u;n[9]!==r?(u=o.jsx(r,{size:14,className:"shrink-0"}),n[9]=r,n[10]=u):u=n[10];let f;n[11]!==c?(f=c&&o.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=f):f=n[12];let m;n[13]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(ds,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==l||n[15]!==s||n[16]!==h||n[17]!==u||n[18]!==f?(p=o.jsxs(me,{ref:s,type:"button",variant:"ghost",size:"sm",className:h,...l,children:[u,f,m]}),n[14]=l,n[15]=s,n[16]=h,n[17]=u,n[18]=f,n[19]=p):p=n[19],p});function mx(t){const e=U.c(2),{count:s}=t;let n;return e[0]!==s?(n=o.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=n):n=e[1],n}function xle(t){const e=U.c(101),{categories:s,authors:n,statusCounts:r,categoryFilter:i,authorFilter:a,statusFilter:l,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:h,onStatusFilterChange:u,onSortChange:f}=t,m=ue();let p;if(e[0]!==s||e[1]!==i){let ne;e[3]!==i?(ne=Q=>Q.slug===i,e[3]=i,e[4]=ne):ne=e[4],p=s.find(ne),e[0]=s,e[1]=i,e[2]=p}else p=e[2];const g=p;let x;if(e[5]!==a||e[6]!==n){let ne;e[8]!==a?(ne=Q=>Q.email===a,e[8]=a,e[9]=ne):ne=e[9],x=n.find(ne),e[5]=a,e[6]=n,e[7]=x}else x=e[7];const b=x,v=!!(i||a||l);let _;e[10]!==b?.name||e[11]!==g?.name||e[12]!==l||e[13]!==m?(_=g?.name??b?.name??m(l?Ph[l]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=l,e[13]=m,e[14]=_):_=e[14];const L=_,y=i?`cat:${i}`:a?`author:${a}`:l?`status:${l}`:_v;let w;e[15]!==h||e[16]!==d||e[17]!==u?(w=()=>{d(null),h(null),u(null)},e[15]=h,e[16]=d,e[17]=u,e[18]=w):w=e[18];const S=w;let k;e[19]!==S||e[20]!==h||e[21]!==d||e[22]!==u?(k=ne=>{ne.startsWith("cat:")?(h(null),u(null),d(ne.slice(4))):ne.startsWith("author:")?(d(null),u(null),h(ne.slice(7))):Sv(ne)?(d(null),h(null),u(Sv(ne))):S()},e[19]=S,e[20]=h,e[21]=d,e[22]=u,e[23]=k):k=e[23];const j=k;let N;e[24]!==L||e[25]!==v?(N=o.jsx(Ut,{asChild:!0,children:o.jsx(kv,{icon:ZT,active:v,value:L,className:"min-w-0 shrink"})}),e[24]=L,e[25]=v,e[26]=N):N=e[26];let V;e[27]!==m?(V=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=V):V=e[28];let C;e[29]!==V?(C=o.jsx(Sd,{children:V}),e[29]=V,e[30]=C):C=e[30];let T;e[31]!==m?(T=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=T):T=e[32];let A;e[33]!==T?(A=o.jsx(Bo,{value:_v,children:T}),e[33]=T,e[34]=A):A=e[34];let R;e[35]!==m?(R=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=R):R=e[36];let E;e[37]!==R?(E=o.jsx(Sd,{className:"text-muted-foreground/70",children:R}),e[37]=R,e[38]=E):E=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=Object.keys(Ph),e[39]=I):I=e[39];let D;e[40]!==r||e[41]!==m?(D=I.map(ne=>o.jsxs(Bo,{value:`status:${ne}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(Ph[ne])}),o.jsx(mx,{count:r[ne]})]},`status:${ne}`)),e[40]=r,e[41]=m,e[42]=D):D=e[42];let O;e[43]!==s.length||e[44]!==m?(O=s.length>0&&o.jsx(Sd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=O):O=e[45];let $;e[46]!==s?($=s.map(vle),e[46]=s,e[47]=$):$=e[47];let M;e[48]!==n.length||e[49]!==m?(M=n.length>0&&o.jsx(Sd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=M):M=e[50];let z;e[51]!==n?(z=n.map(ble),e[51]=n,e[52]=z):z=e[52];let F;e[53]!==y||e[54]!==j||e[55]!==A||e[56]!==E||e[57]!==D||e[58]!==O||e[59]!==$||e[60]!==M||e[61]!==z?(F=o.jsxs(Gh,{value:y,onValueChange:j,children:[A,E,D,O,$,M,z]}),e[53]=y,e[54]=j,e[55]=A,e[56]=E,e[57]=D,e[58]=O,e[59]=$,e[60]=M,e[61]=z,e[62]=F):F=e[62];let B;e[63]!==F||e[64]!==C?(B=o.jsxs(Ht,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[C,F]}),e[63]=F,e[64]=C,e[65]=B):B=e[65];let H;e[66]!==B||e[67]!==N?(H=o.jsxs(Ft,{children:[N,B]}),e[66]=B,e[67]=N,e[68]=H):H=e[68];let W;e[69]!==S||e[70]!==v||e[71]!==m?(W=v&&o.jsx(yle,{label:m("sandbox.postToolbar.clearFilter"),onClick:S}),e[69]=S,e[70]=v,e[71]=m,e[72]=W):W=e[72];const K=gle[c];let q;e[73]!==m||e[74]!==K?(q=m(K),e[73]=m,e[74]=K,e[75]=q):q=e[75];let G;e[76]!==q?(G=o.jsx(Ut,{asChild:!0,children:o.jsx(kv,{icon:eP,active:!0,value:q})}),e[76]=q,e[77]=G):G=e[77];let te;e[78]!==m?(te=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=te):te=e[79];let X;e[80]!==te?(X=o.jsx(Sd,{children:te}),e[80]=te,e[81]=X):X=e[81];let Z;e[82]!==f?(Z=ne=>f(ne),e[82]=f,e[83]=Z):Z=e[83];let ee;e[84]===Symbol.for("react.memo_cache_sentinel")?(ee=Object.keys(Lv),e[84]=ee):ee=e[84];let se;e[85]!==m?(se=ee.map(ne=>o.jsx(Bo,{value:ne,children:m(Lv[ne])},ne)),e[85]=m,e[86]=se):se=e[86];let J;e[87]!==c||e[88]!==Z||e[89]!==se?(J=o.jsx(Gh,{value:c,onValueChange:Z,children:se}),e[87]=c,e[88]=Z,e[89]=se,e[90]=J):J=e[90];let oe;e[91]!==X||e[92]!==J?(oe=o.jsxs(Ht,{align:"end",className:"w-44",children:[X,J]}),e[91]=X,e[92]=J,e[93]=oe):oe=e[93];let ce;e[94]!==G||e[95]!==oe?(ce=o.jsx("div",{className:"ml-auto shrink-0",children:o.jsxs(Ft,{children:[G,oe]})}),e[94]=G,e[95]=oe,e[96]=ce):ce=e[96];let he;return e[97]!==H||e[98]!==W||e[99]!==ce?(he=o.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[H,W,ce]}),e[97]=H,e[98]=W,e[99]=ce,e[100]=he):he=e[100],he}function ble(t){return o.jsxs(Bo,{value:`author:${t.email}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(mx,{count:t.count})]},`author:${t.email}`)}function vle(t){return o.jsxs(Bo,{value:`cat:${t.slug}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(mx,{count:t.count})]},`cat:${t.slug}`)}function yle(t){const e=U.c(4),{label:s,onClick:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(nn,{size:12}),e[0]=r):r=e[0];let i;return e[1]!==s||e[2]!==n?(i=o.jsx("button",{type:"button","aria-label":s,onClick:n,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:r}),e[1]=s,e[2]=n,e[3]=i):i=e[3],i}function _le(t){const e=U.c(18),{checked:s,disabled:n,onToggle:r}=t,i=ue();let a;e[0]!==r?(a=()=>r(),e[0]=r,e[1]=a):a=e[1];let l;e[2]!==s||e[3]!==i?(l=i(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=i,e[4]=l):l=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==a||e[8]!==l?(c=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Lle,children:o.jsx(il,{checked:s,disabled:n,onCheckedChange:a,"aria-label":l})})}),e[5]=s,e[6]=n,e[7]=a,e[8]=l,e[9]=c):c=e[9];let d;e[10]!==s||e[11]!==i?(d=i(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=i,e[12]=d):d=e[12];let h;e[13]!==d?(h=o.jsx(We,{side:"bottom",children:d}),e[13]=d,e[14]=h):h=e[14];let u;return e[15]!==c||e[16]!==h?(u=o.jsxs(qe,{children:[c,h]}),e[15]=c,e[16]=h,e[17]=u):u=e[17],u}function Lle(t){return t.stopPropagation()}function wle(t){const e=U.c(42),{count:s,allSelected:n,onToggleSelectAll:r,onDelete:i,onExit:a}=t,l=ue();let c;e[0]!==n||e[1]!==r?(c=o.jsx(_le,{checked:n,onToggle:r}),e[0]=n,e[1]=r,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==l?(d=l("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=l,e[5]=d):d=e[5];let h;e[6]!==d?(h=o.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=h):h=e[7];const u=s===0;let f;e[8]!==l?(f=l("sandbox.postToolbar.deleteSelectedPosts"),e[8]=l,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(rn,{size:14}),e[10]=m):m=e[10];let p;e[11]!==i||e[12]!==u||e[13]!==f?(p=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:u,onClick:i,"aria-label":f,children:m})}),e[11]=i,e[12]=u,e[13]=f,e[14]=p):p=e[14];let g;e[15]!==l?(g=l("sandbox.postToolbar.deleteSelected"),e[15]=l,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(We,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=o.jsxs(qe,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==l?(v=l("sandbox.postToolbar.exitSelection"),e[22]=l,e[23]=v):v=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(nn,{size:14}),e[24]=_):_=e[24];let L;e[25]!==a||e[26]!==v?(L=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,"aria-label":v,children:_})}),e[25]=a,e[26]=v,e[27]=L):L=e[27];let y;e[28]!==l?(y=l("sandbox.postToolbar.exitSelection"),e[28]=l,e[29]=y):y=e[29];let w;e[30]!==y?(w=o.jsx(We,{side:"bottom",children:y}),e[30]=y,e[31]=w):w=e[31];let S;e[32]!==L||e[33]!==w?(S=o.jsxs(qe,{children:[L,w]}),e[32]=L,e[33]=w,e[34]=S):S=e[34];let k;e[35]!==b||e[36]!==S?(k=o.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,S]}),e[35]=b,e[36]=S,e[37]=k):k=e[37];let j;return e[38]!==c||e[39]!==k||e[40]!==h?(j=o.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,h,k]}),e[38]=c,e[39]=k,e[40]=h,e[41]=j):j=e[41],j}function Rd(t){const e=U.c(34),{onDuplicate:s,onRename:n,onAddVariant:r,onEditSeo:i,onViewJson:a,onDelete:l}=t,c=ue();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Rr,{size:14}),e[2]=h):h=e[2];let u;e[3]!==d?(u=o.jsx(Ut,{asChild:!0,children:o.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:Sle,children:h})}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&o.jsxs(et,{onClick:n,children:[o.jsx(b9,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let m;e[8]!==s||e[9]!==c?(m=s&&o.jsxs(et,{onClick:s,children:[o.jsx(bn,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=m):m=e[10];let p;e[11]!==r||e[12]!==c?(p=r&&o.jsxs(o.Fragment,{children:[o.jsx(Dc,{}),o.jsxs(et,{onClick:r,className:"cursor-pointer text-success focus:text-success",children:[o.jsx(xg,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=r,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==i||e[15]!==a||e[16]!==c?(g=(i||a)&&o.jsxs(o.Fragment,{children:[o.jsx(Dc,{}),i&&o.jsxs(et,{onClick:i,children:[o.jsx(t8,{size:14}),c("sandbox.itemActions.editSeo")]}),a&&o.jsxs(et,{onClick:a,children:[o.jsx(rd,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=i,e[15]=a,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Dc,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(rn,{size:14}),e[19]=b):b=e[19];let v;e[20]!==c?(v=c("sandbox.itemActions.delete"),e[20]=c,e[21]=v):v=e[21];let _;e[22]!==l||e[23]!==v?(_=o.jsxs(et,{onClick:l,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=l,e[23]=v,e[24]=_):_=e[24];let L;e[25]!==_||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(L=o.jsxs(Ht,{align:"end",className:"w-44",children:[f,m,p,g,x,_]}),e[25]=_,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=L):L=e[30];let y;return e[31]!==L||e[32]!==u?(y=o.jsxs(Ft,{children:[u,L]}),e[31]=L,e[32]=u,e[33]=y):y=e[33],y}function Sle(t){return t.stopPropagation()}function kle(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function jle(t){const e=new Map;for(const s of t){const n=kle(s.resolveType),r=e.get(n);r?r.push(s):e.set(n,[s])}return[...e.entries()].map(([s,n])=>({label:s,sections:n})).sort((s,n)=>s.label.localeCompare(n.label))}function jv(t){const e=U.c(8),{icon:s,label:n,className:r}=t;let i;e[0]!==r?(i=le("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",r),e[0]=r,e[1]=i):i=e[1];let a;e[2]!==s?(a=o.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==n||e[5]!==i||e[6]!==a?(l=o.jsxs("div",{className:i,children:[a,n]}),e[4]=n,e[5]=i,e[6]=a,e[7]=l):l=e[7],l}const Cv=P.lazy(()=>Ks(()=>import("./app-editor-TTUJgVhd.js"),__vite__mapDeps([169,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,41,72,73,29,80,30,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,74,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.AppEditor}))),Cle=P.lazy(()=>Ks(()=>import("./post-editor-CTE0Ny-s.js"),__vite__mapDeps([170,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,31,56,30,32,33,34,35,36,37,38,39,40,29,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,74,78,171,133,140,105,106,136,118,79,128,172,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,107,108,109,110,111,112,113,114,115,173,174,116,117,73,119,120,121,122,123,124,125,126,127,129,130,131,132,134,135,75,137,138,139,141,142,143,144,145,146,147,148,149,150,72,151,152,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.PostEditor}))),Nle=P.lazy(()=>Ks(()=>import("./record-editor-ssFhFAja.js"),__vite__mapDeps([175,1,2,74,78,73,25,29,128,173,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,174,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,72,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.RecordEditor}))),Vle=P.lazy(()=>Ks(()=>import("./category-editor-Bm5Mlq8U.js"),__vite__mapDeps([176,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,36,38,56,30,31,32,33,34,35,37,39,40,29,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,149,74,78,172,105,106,136,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,107,108,109,110,111,112,113,114,115,173,174,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,137,138,139,140,141,142,143,144,145,146,147,148,150,72,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.CategoryEditor}))),Tle=P.lazy(()=>Ks(()=>import("./bulk-category-panel-L3wZRASt.js"),__vite__mapDeps([177,1,2,38,78,178,43,73,25,29])).then(t=>({default:t.BulkCategoryPanel}))),Ple=P.lazy(()=>Ks(()=>import("./sections-editor-CdzZDcnU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SectionsEditor}))),Ale=P.lazy(()=>Ks(()=>import("./seo-editor-CaD3hjuZ.js"),__vite__mapDeps([179,1,2,41,30,31,32,33,34,35,36,37,38,39,40,25,29,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,77,78,79,76,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,74,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SeoEditor}))),Ele=P.lazy(()=>Ks(()=>import("./variant-calendar-DuJfg-z-.js"),__vite__mapDeps([180,1,2,30,31,32,33,34,35,36,37,38,39,40,25,29,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,78,72,73,79,181,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,74,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.VariantCalendar}))),Rle=P.lazy(()=>Ks(()=>import("./post-calendar-VzuxCaB9.js"),__vite__mapDeps([182,1,2,31,30,32,33,34,35,36,37,38,39,40,25,29,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,183,72,73,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,74,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.PostCalendar}))),Dle=P.lazy(()=>Ks(()=>import("./redirect-editor-Ct31zDHf.js"),__vite__mapDeps([184,1,2,140,25,74,78,73,29,174,33,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,81,30,31,32,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,141,142,143,144,145,146,147,148,149,150,72,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.RedirectEditor})));function Mle(t){const e=U.c(20),{deepLinkPage:s}=t,n=lo(),{currentBranch:r}=an(),{org:i}=Fe(),a=n?.entity?.id??null,l=mr(),c=ca(),{runtime:d,previewServerUrl:h}=_n(a),u=d==="cms";let f;e[0]!==u||e[1]!==c.previewState||e[2]!==l.lifecycle.phase?(f=Woe({fastPreviewActive:u,previewState:c.previewState,lifecyclePhase:l.lifecycle.phase}),e[0]=u,e[1]=c.previewState,e[2]=l.lifecycle.phase,e[3]=f):f=e[3];const m=f;if(m.kind==="sandbox-card"){const x=`/${i.slug}/settings/connections`;let b;return e[4]!==m.state||e[5]!==c.start||e[6]!==x||e[7]!==l.lifecycle||e[8]!==l.phase?(b=o.jsx(Hoe,{state:m.state,claimPhase:l.phase,lifecycle:l.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=m.state,e[5]=c.start,e[6]=x,e[7]=l.lifecycle,e[8]=l.phase,e[9]=b):b=e[9],b}if(!a||!r){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Oo,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const p=u?h:c.previewUrl;let g;return e[11]!==r||e[12]!==s||e[13]!==m.devServerReady||e[14]!==m.sandboxWarming||e[15]!==c.previewUrl||e[16]!==i.slug||e[17]!==p||e[18]!==a?(g=o.jsx(Ole,{orgSlug:i.slug,virtualMcpId:a,branch:r,previewUrl:c.previewUrl,sitePreviewUrl:p,deepLinkPage:s,devServerReady:m.devServerReady,sandboxWarming:m.sandboxWarming}),e[11]=r,e[12]=s,e[13]=m.devServerReady,e[14]=m.sandboxWarming,e[15]=c.previewUrl,e[16]=i.slug,e[17]=p,e[18]=a,e[19]=g):g=e[19],g}const Nv=2e3,Ile=15;function Vv(t,e,s,n){return typeof e!="string"||s&&(rj(e,s,n)||t.state.dataUpdateCount>=Ile)?!1:Nv}function Ole({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:r,deepLinkPage:i,devServerReady:a,sandboxWarming:l}){const c=ue(),d=ws()?.taskId??null,h={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:u,isLoading:f}=B9(h,{fetchEnabled:a}),[m,p]=P.useState("pages"),[g,x]=P.useState(null),[b,v]=P.useState(null),_=!!(i?.pageId||i?.path||i?.pathTemplate),[L,y]=P.useState(!1);if(_&&!L&&g===null&&u){y(!0);const fe=eee(bf(u),i??{});fe&&(p("pages"),x({collection:"pages",key:fe.key,path:fe.path}))}const[w,S]=P.useState(""),[k,j]=P.useState(null),[N,V]=P.useState(null),[C,T]=P.useState(null),[A,R]=P.useState("date-desc"),[E,I]=P.useState(()=>new Set),[D,O]=P.useState(null),$=()=>{I(new Set),O(null)},M=fe=>{x(fe),v(null)},[z,F]=P.useState(m);z!==m&&(F(m),S(""),j(null),V(null),T(null),R("date-desc"),I(new Set),O(null));const{data:B,isLoading:H,isFetching:W}=z3(h,{fetchEnabled:a,refetchInterval:fe=>{const Me=fe.state.data;if(m==="apps"&&g&&g.collection==="apps"){const He=u?.[g.key];return Vv(fe,typeof He?.__resolveType=="string"?He.__resolveType:void 0,Me)}if(m==="site"&&u){const He=Me?Sp(u,Me):null,Je=u.site,Ze=He?.resolveType??(typeof Je?.__resolveType=="string"?Je.__resolveType:void 0);return Vv(fe,Ze,Me,["seo"])}return!1}}),K=(fe,Me)=>!rj(fe,B,Me)&&(H||W),{catalog:q,isLoading:G}=Foe(B??void 0,u??void 0,{enabled:m==="apps"}),te=Aae({orgSlug:t,virtualMcpId:e,branch:s,meta:B}),X=w0(h),Z=Eoe(h),[ee,se]=P.useState(null),[J,oe]=P.useState(),[ce,he]=P.useState(!1),[ne,Q]=P.useState(),[de,ae]=P.useState(null),[re,ie]=P.useState(null),[Y,pe]=P.useState(null),be=!u||!B;if(f||H||be&&l)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(nt,{className:"size-5 text-muted-foreground"})});if(be)return o.jsx(Oo,{title:"Could not load site data."});const _e=bf(u).sort((fe,Me)=>fe.name.localeCompare(Me.name)),Le=jS(u).sort((fe,Me)=>fe.from.localeCompare(Me.from)),ke=B3(u,B),Ve=m==="sections"?WZ(B):[],Pe=Sp(u,B),xe=cj(u),Ne=ux.some(fe=>xe[fe].length>0),je=pu(m)?xe[m]:[],we=(Ne?Ou(u,"categories"):[]).map(({key:fe,payload:Me})=>{const He=typeof Me.slug=="string"?Me.slug:"",Je=typeof Me.name=="string"?Me.name:"";return{slug:He||fe,name:Je||He||fe}}).filter(fe=>fe.slug).sort((fe,Me)=>fe.name.localeCompare(Me.name)),Ce=m==="posts"&&(E.size>0||D!==null),Oe=Ce?fj(u).filter(fe=>E.has(fe.key)):[],rt=Eb(B,"loaders"),Ge=Eb(B,"actions");if(!VS(u,B)&&!Ne&&rt===0&&Ge===0)return o.jsx(Oo,{icon:vn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const Vt={pages:_e.length,sections:ke.length,apps:q.length,loaders:rt,actions:Ge,redirects:Le.length,posts:xe.posts.length,authors:xe.authors.length,categories:xe.categories.length},lt=new Set(_e.map(fe=>Fo(fe.path))),tt=new Set(_e.map(fe=>fe.name)),ft=new Set(ke.map(fe=>fe.name)),Lt=async fe=>{const Me=u[fe.key];if(!Me)return;const He=zS(u,fe.key),Je=FS(u,fe.key,Math.max(0,He-1)),Ze=$ee(Me.sections,Je);if(Ze)try{await X.mutateAsync({blockKey:fe.key,data:{...Me,sections:Ze}}),ye.success(`Variant added to "${fe.name}"`),x({collection:"pages",key:fe.key,path:fe.path})}catch(wt){ye.error(wt instanceof Error?wt.message:"Could not add variant")}},mt=()=>{oe(void 0),se({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},Qe=fe=>{oe(void 0),se({mode:"duplicate",sourceKey:fe.key,initialName:uv(tt,fe.name),initialPath:qoe(lt,fe.path)})},st=fe=>{oe(void 0),se({mode:"rename",sourceKey:fe.key,initialName:fe.name,initialPath:fe.path})},gt=async fe=>{if(!ee)return;const{mode:Me,sourceKey:He}=ee;try{if(Me==="create"){let Je;if(fe.templateKey){const wt=u[fe.templateKey];if(!wt)throw new Error("Selected template no longer exists.");Je={...wt,name:fe.name,path:fe.path}}else Je=Qoe(fe.name,fe.path);const Ze=Joe(u,fe.name);await X.mutateAsync({blockKey:Ze,data:Je}),ye.success(`Created "${fe.name}"`),x({collection:"pages",key:Ze,path:fe.path})}else if(Me==="duplicate"&&He){const Je=u[He];if(!Je)throw new Error("Source page not found");const{key:Ze,data:wt}=Yoe({source:Je,pages:_e,newName:fe.name,newPath:fe.path});await X.mutateAsync({blockKey:Ze,data:wt}),ye.success(`Duplicated as "${fe.name}"`),x({collection:"pages",key:Ze,path:fe.path})}else if(Me==="rename"&&He){const Je=u[He];if(!Je)throw new Error("Page not found");const Ze={...Je,name:fe.name,path:fe.path};await X.mutateAsync({blockKey:He,data:Ze}),ye.success("Page updated"),g?.collection==="pages"&&g.key===He&&x({collection:"pages",key:He,path:fe.path})}se(null)}catch(Je){oe(Je instanceof Error?Je.message:"Save failed")}},ge=({path:fe})=>{if(!ee)return null;const Me=Fo(fe);return(ee.mode==="rename"?Fo(ee.initialPath):null)!==Me&&lt.has(Me)?`A page with path "${fe}" already exists.`:null},Ee=async(fe,Me,He)=>{await X.mutateAsync({blockKey:Me,data:{...He,name:Me,__resolveType:fe}}),ye.success(c("sandbox.contentBrowser.createdSection",{name:Me})),x({collection:"sections",key:Me})},De=Q3((fe,Me)=>X.mutate({blockKey:fe,data:Me})),dt=async fe=>{const Me=u[fe.key];if(!Me){ye.error(c("sandbox.contentBrowser.sectionNotFound"));return}const He=Goe(u,fe.key),Je=uv(ft,fe.name),Ze={...Me,name:Je};try{await X.mutateAsync({blockKey:He,data:Ze}),ye.success(c("sandbox.contentBrowser.duplicatedSection",{name:fe.name})),x({collection:"sections",key:He})}catch(wt){ye.error(wt instanceof Error?wt.message:c("sandbox.contentBrowser.duplicateFailed"))}},ht=async fe=>{if(!de)return;const Me=u[de];if(!Me){ye.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await X.mutateAsync({blockKey:de,data:{...Me,name:fe}}),ye.success(c("sandbox.contentBrowser.sectionRenamed")),ae(null)}catch(He){ye.error(He instanceof Error?He.message:c("sandbox.contentBrowser.renameFailed"))}},ut=()=>{Q(void 0),he(!0)},ct=async fe=>{const Me=ZZ(u,fe.from),He=QZ(fe);try{await X.mutateAsync({blockKey:Me,data:He}),ye.success("Created redirect"),he(!1),x({collection:"redirects",key:Me})}catch(Je){Q(Je instanceof Error?Je.message:"Could not create redirect")}},it=async fe=>{const Me=nm(u,fe),He=Sc(Me,fe,mj(fe));try{await X.mutateAsync({blockKey:Me,data:He}),ye.success(`Created ${mu[fe]}`),x({collection:fe,key:Me})}catch(Je){ye.error(Je instanceof Error?Je.message:"Could not create")}},Ue=async fe=>{const Me=nm(u,"posts"),He=Sc(Me,"posts",wae(fe));try{await X.mutateAsync({blockKey:Me,data:He}),ye.success(c("sandbox.postCalendar.createdScheduledPost")),p("posts"),F("posts"),x({collection:"posts",key:Me}),v(null)}catch(Je){ye.error(Je instanceof Error?Je.message:c("sandbox.postCalendar.couldNotCreate"))}},_t=async(fe,Me)=>{const He=u[fe],Je=He?kae(Yd(He,"posts"),Me):null;if(!Je){ye.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await X.mutateAsync({blockKey:fe,data:Sc(fe,"posts",Je)})}catch(Ze){ye.error(Ze instanceof Error?Ze.message:c("sandbox.postCalendar.couldNotReschedule"))}},St=async fe=>{const Me=u[fe.key];if(!Me){ye.error("Record not found.");return}const He=nm(u,fe.kind),Je=fe.kind==="posts"?"title":"name",Ze={...structuredClone(Yd(Me,fe.kind)),[Je]:`${fe.label} (copy)`};try{await X.mutateAsync({blockKey:He,data:Sc(He,fe.kind,Ze)}),ye.success(`Duplicated "${fe.label}"`),x({collection:fe.kind,key:He})}catch(wt){ye.error(wt instanceof Error?wt.message:"Duplicate failed")}},Mt=fe=>{I(Me=>{const He=new Set(Me);return He.has(fe)?He.delete(fe):He.add(fe),He})},Pt=fe=>{p("posts"),F("posts"),x(null),v(null),S(""),j(null),V(null),T(null),R("date-desc"),I(new Set),O(fe||null)},Ie=async(fe,Me)=>{const He=[...E];let Je=0;for(const Ze of He){const wt=u[Ze],Ws=Yd(wt,"posts"),pt=fe==="add"?fae(Ws,Me):mae(Ws,Me);pt!==Ws&&(await X.mutateAsync({blockKey:Ze,data:Sc(Ze,"posts",mv(pt))}),Je+=1)}return Je},xt=async(fe,Me)=>{const He=E.size;try{const Je=await Ie(fe,Me),Ze=fe==="add"?"Added to":"Moved",wt=He-Je;ye.success(`${Ze} ${Je} ${Je===1?"post":"posts"}`+(wt>0?` (${wt} already set)`:"")),$()}catch(Je){ye.error(Je instanceof Error?Je.message:"Bulk update failed")}},Se=async()=>{if(re)try{if(re.kind==="blog-bulk"){for(const Je of re.keys)await Z.mutateAsync({blockKey:Je});ye.success(`Deleted ${re.count} ${re.count===1?"post":"posts"}`),g&&g.collection!=="available-section"&&re.keys.includes(g.key)&&x(null),$(),ie(null);return}const{kind:fe,key:Me,label:He}=re;if(fe==="blog"){if(re.blogKind==="categories"){const Je=Yd(u[Me],"categories").slug,Ze=typeof Je=="string"?Je:"";if(Ze)for(const{key:wt,payload:Ws}of Ou(u,"posts")){const pt=pae(Ws,Ze);pt!==Ws&&await X.mutateAsync({blockKey:wt,data:Sc(wt,"posts",mv(pt))})}}await Z.mutateAsync({blockKey:Me})}else await Z.mutateAsync({blockKey:Me});ye.success(`Deleted "${He}"`),g&&g.collection!=="available-section"&&g.key===Me&&x(null),ie(null)}catch(fe){ye.error(fe instanceof Error?fe.message:"Delete failed")}},ze=Z.isPending||X.isPending,ot=re?.kind==="blog"?mu[re.blogKind]:re?.kind==="blog-bulk"?`${re.count} ${re.count===1?"post":"posts"}`:re?.kind??"item";return o.jsxs("div",{className:"flex h-full w-full",children:[o.jsx(Uoe,{active:m,counts:Vt,showBlog:Ne,onSelect:fe=>{p(fe),x(null),v(null)}}),m!=="seo"&&m!=="site"&&m!=="calendar"&&m!=="post-schedule"&&m!=="loaders"&&m!=="actions"&&o.jsx($le,{activeCollection:m,pages:_e,redirects:Le,sections:ke,availableSections:Ve,appCatalog:q,appCatalogLoading:G,blogEntries:je,decofile:u,searchQuery:w,onSearchChange:S,postCategoryFilter:k,postAuthorFilter:N,postStatusFilter:C,postSort:A,onPostCategoryFilterChange:fe=>{j(fe),I(new Set)},onPostAuthorFilterChange:fe=>{V(fe),I(new Set)},onPostStatusFilterChange:fe=>{T(fe),I(new Set)},onPostSortChange:R,selectedPostKeys:E,postBulkPanelOpen:Ce,onTogglePostSelect:Mt,onSelectAllPosts:fe=>I(new Set(fe)),onClearPostSelection:()=>I(new Set),onExitPostSelection:$,onBulkDeletePosts:()=>ie({kind:"blog-bulk",keys:[...E],count:E.size}),selection:g,onSelect:M,onCreate:()=>{m==="pages"?mt():m==="redirects"?ut():pu(m)&&it(m)},onDuplicatePage:Qe,onRenamePage:st,onAddPageVariant:Lt,onDeletePage:fe=>ie({kind:"page",key:fe.key,label:fe.name}),onEditPageSeo:fe=>{const Me={collection:"pages",key:fe.key,path:fe.path};x(Me),v(fe.key)},onViewPageJson:fe=>pe(fe.key),onDuplicateSection:dt,onRenameSection:fe=>ae(fe.key),onDeleteSection:fe=>ie({kind:"section",key:fe.key,label:fe.name}),onDeleteRedirect:fe=>ie({kind:"redirect",key:fe.key,label:fe.from||fe.key}),onDuplicateBlog:St,onDeleteBlog:fe=>ie({kind:"blog",blogKind:fe.kind,key:fe.key,label:fe.label})}),o.jsx("div",{className:"flex-1 min-w-0",children:m==="loaders"||m==="actions"?o.jsx($ae,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:B,decofile:u,kind:m}):o.jsx(P.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(nt,{className:"size-5 text-muted-foreground"})}),children:m==="calendar"?o.jsx(Ele,{decofile:u}):m==="post-schedule"?o.jsx(Rle,{decofile:u,support:te,isCreating:X.isPending,onCreate:fe=>{Ue(fe)},onReschedule:(fe,Me)=>{_t(fe,Me)},onSelect:fe=>{p("posts"),F("posts"),x({collection:"posts",key:fe}),v(null)}}):m==="site"?Pe?o.jsx(Cv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:Pe.key,block:u[Pe.key],decofile:u,meta:B,title:"Site",excludeFields:["seo"],schemaPending:K(Pe.resolveType,["seo"]),previewBaseUrl:n},`site:${Pe.key}`):o.jsx(Oo,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):m==="seo"?o.jsx(Ale,{orgSlug:t,virtualMcpId:e,branch:s,decofile:u,meta:B,target:{kind:"site"},previewBaseUrl:r}):m==="sections"?o.jsx(ple,{selection:g?.collection==="sections"||g?.collection==="available-section"?g:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:B,decofile:u,isCreating:X.isPending,onCreateAvailable:Ee,onSaveReferencedBlock:De}):Ce?o.jsx(Tle,{posts:Oe,categories:we,initialSlug:D,isPending:X.isPending,onApply:(fe,Me)=>{xt(fe,Me)},onClose:$},D??"selection"):g&&g.collection!=="available-section"?g.collection==="apps"?o.jsx(Cv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key],decofile:u,meta:B,previewBaseUrl:n,schemaPending:K(typeof u[g.key]?.__resolveType=="string"?String(u[g.key].__resolveType):void 0)},`app:${g.key}`):g.collection==="posts"?o.jsx(Cle,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key],decofile:u,meta:B,previewBaseUrl:r},`post:${g.key}`):g.collection==="categories"?o.jsx(Vle,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key],decofile:u,meta:B,onManagePosts:Pt,onOpenPost:fe=>{p("posts"),F("posts"),x({collection:"posts",key:fe}),v(null)},previewBaseUrl:r},`category:${g.key}`):g.collection==="authors"?o.jsx(Nle,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:g.key,block:u[g.key]},`authors:${g.key}`):g.collection==="redirects"?o.jsx(Dle,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key]},`redirect:${g.key}`):o.jsx(Ple,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:g.collection==="pages"?g.path:"/",activePageBlockKey:g.collection==="pages"?g.key:null,activeGlobalBlockKey:g.collection==="sections"?g.key:null,initialEditSeo:g.collection==="pages"&&b===g.key,onExitSeo:()=>v(null)},g.collection==="pages"?`page:${g.key}`:`section:${g.key}`):o.jsx(Oo,{title:`Select ${pu(m)?`a ${mu[m]}`:m==="pages"?"a page":m==="apps"?"an app":m==="redirects"?"a redirect":"a section"} to edit`,description:m==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),ee&&o.jsx(sae,{open:!!ee,mode:ee.mode,initialName:ee.initialName,initialPath:ee.initialPath,isPending:X.isPending,error:J,templates:_e,validate:ge,onSubmit:gt,onOpenChange:fe=>{fe||(se(null),oe(void 0))}}),o.jsx(rae,{open:ce,isPending:X.isPending,error:ne,onSubmit:ct,onOpenChange:fe=>{fe||(he(!1),Q(void 0))}}),de&&o.jsx(iae,{open:!!de,blockKey:de,initialName:ke.find(fe=>fe.key===de)?.name??de,isPending:X.isPending,onSubmit:ht,onOpenChange:fe=>{fe||ae(null)}}),Y&&o.jsx(Eae,{open:!!Y,onOpenChange:fe=>{fe||pe(null)},pageKey:Y,decofile:u,onSave:fe=>X.mutateAsync({blockKey:Y,data:fe})}),o.jsx(Wi,{open:!!re,onOpenChange:fe=>{!fe&&!ze&&ie(null)},children:o.jsxs(qi,{children:[o.jsxs(Gi,{children:[o.jsx(Yi,{children:`Delete ${ot}?`}),o.jsx(Qi,{children:re?.kind==="section"?`"${re.label}" will be removed. Pages that still reference it will lose this section.`:re?.kind==="blog-bulk"?`${re.count} ${re.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:re?`"${re.label}" will be removed permanently. This can't be undone.`:null})]}),o.jsxs(Xi,{children:[o.jsx(Ji,{disabled:ze,children:"Cancel"}),o.jsx(Zi,{onClick:fe=>{fe.preventDefault(),Se()},disabled:ze,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ze?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function $le(t){const e=U.c(82),{activeCollection:s,pages:n,redirects:r,sections:i,availableSections:a,appCatalog:l,appCatalogLoading:c,blogEntries:d,decofile:h,searchQuery:u,onSearchChange:f,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostStatusFilterChange:_,onPostSortChange:L,selectedPostKeys:y,postBulkPanelOpen:w,onTogglePostSelect:S,onSelectAllPosts:k,onClearPostSelection:j,onExitPostSelection:N,onBulkDeletePosts:V,selection:C,onSelect:T,onCreate:A,onDuplicatePage:R,onRenamePage:E,onAddPageVariant:I,onDeletePage:D,onEditPageSeo:O,onViewPageJson:$,onDuplicateSection:M,onRenameSection:z,onDeleteSection:F,onDeleteRedirect:B,onDuplicateBlog:H,onDeleteBlog:W}=t;let K,q,G,te,X,Z,ee;if(e[0]!==s||e[1]!==l||e[2]!==c||e[3]!==a||e[4]!==d||e[5]!==h||e[6]!==I||e[7]!==V||e[8]!==j||e[9]!==A||e[10]!==W||e[11]!==D||e[12]!==B||e[13]!==F||e[14]!==H||e[15]!==R||e[16]!==M||e[17]!==O||e[18]!==N||e[19]!==v||e[20]!==b||e[21]!==L||e[22]!==_||e[23]!==E||e[24]!==z||e[25]!==f||e[26]!==T||e[27]!==k||e[28]!==S||e[29]!==$||e[30]!==n||e[31]!==p||e[32]!==w||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==r||e[37]!==u||e[38]!==i||e[39]!==y||e[40]!==C){const ce=u.toLowerCase(),he=n.filter(ge=>!ce||ge.name.toLowerCase().includes(ce)||ge.path.toLowerCase().includes(ce)),ne=r.filter(ge=>!ce||ge.from.toLowerCase().includes(ce)||ge.to.toLowerCase().includes(ce)),Q=i.filter(ge=>!ce||ge.name.toLowerCase().includes(ce)||ge.key.toLowerCase().includes(ce)||ge.resolveType.toLowerCase().includes(ce)),de=a.filter(ge=>!ce||ge.title.toLowerCase().includes(ce)||ge.resolveType.toLowerCase().includes(ce)||(ge.description?.toLowerCase().includes(ce)??!1)),ae=jle(Q),re=l.filter(ge=>!ce||ge.title.toLowerCase().includes(ce)||ge.app.toLowerCase().includes(ce)||ge.vendor.toLowerCase().includes(ce)||ge.category.toLowerCase().includes(ce)),ie=d.filter(ge=>!ce||ge.label.toLowerCase().includes(ce)||ge.subtitle.toLowerCase().includes(ce)),Y=s==="posts",pe=Ule,be=Y?fj(h):[],_e=new Map,Le=new Map,ke={published:0,scheduled:0,draft:0};for(const ge of be)ke[ge.status]=ke[ge.status]+1;for(const ge of be){for(const Ee of ge.categorySlugs)_e.set(Ee,(_e.get(Ee)??0)+1);for(const Ee of ge.authorEmails)Le.set(Ee,(Le.get(Ee)??0)+1)}const Ve=(Y?Ou(h,"categories"):[]).map(ge=>{const{key:Ee,payload:De}=ge,dt=pe(De.slug)||Ee;return{slug:dt,name:pe(De.name)||pe(De.slug)||Ee,count:_e.get(dt)??0}}).filter(Fle),Pe=(Y?Ou(h,"authors"):[]).map(ge=>{const{key:Ee,payload:De}=ge,dt=pe(De.email);return{email:dt,name:pe(De.name)||pe(De.email)||Ee,count:Le.get(dt)??0}}).filter(zle);let xe;e[48]!==m?(xe=ge=>!m||ge.categorySlugs.includes(m),e[48]=m,e[49]=xe):xe=e[49];let Ne;e[50]!==p?(Ne=ge=>!p||ge.authorEmails.includes(p),e[50]=p,e[51]=Ne):Ne=e[51];let je;e[52]!==g?(je=ge=>!g||ge.status===g,e[52]=g,e[53]=je):je=e[53];let we;e[54]!==x?(we=(ge,Ee)=>{if(x==="az")return ge.title.localeCompare(Ee.title);if(x==="za")return Ee.title.localeCompare(ge.title);const De=ge.date.localeCompare(Ee.date);return x==="date-asc"?De:-De},e[54]=x,e[55]=we):we=e[55];const Ce=be.filter(ge=>!ce||ge.title.toLowerCase().includes(ce)||ge.slug.toLowerCase().includes(ce)).filter(xe).filter(Ne).filter(je).sort(we),Oe=y.size,rt=Ce.map(Ble),Ge=rt.length>0&&rt.every(ge=>y.has(ge)),Vt=Oe>0||w,lt=()=>{Ge?j():k(rt)},tt=`Search ${s}…`,ft=pu(s)?`Create new ${mu[s]}`:s==="redirects"?"Create new redirect":"Create new page",Lt=s!=="apps"&&s!=="sections";X="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let mt;e[56]===Symbol.for("react.memo_cache_sentinel")?(mt=o.jsx(r0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=mt):mt=e[56];let Qe;e[57]!==f?(Qe=ge=>f(ge.target.value),e[57]=f,e[58]=Qe):Qe=e[58];let st;e[59]!==tt||e[60]!==u||e[61]!==Qe?(st=o.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[mt,o.jsx("input",{type:"text",value:u,onChange:Qe,placeholder:tt,"aria-label":tt,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=tt,e[60]=u,e[61]=Qe,e[62]=st):st=e[62];let gt;e[63]!==ft||e[64]!==A||e[65]!==Lt?(gt=Lt&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",onClick:A,"aria-label":ft,children:o.jsx(Qt,{size:14})})}),o.jsx(We,{side:"bottom",children:ft})]}),e[63]=ft,e[64]=A,e[65]=Lt,e[66]=gt):gt=e[66],e[67]!==st||e[68]!==gt?(Z=o.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[st,gt]}),e[67]=st,e[68]=gt,e[69]=Z):Z=e[69],ee=Y&&(Vt?o.jsx(wle,{count:Oe,allSelected:Ge,onToggleSelectAll:lt,onDelete:V,onExit:N}):o.jsx(xle,{categories:Ve,authors:Pe,categoryFilter:m,statusCounts:ke,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onStatusFilterChange:_,onSortChange:L})),K=rl,te="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",q="flex flex-col gap-1 p-1.5",G=s==="pages"?he.length===0?o.jsx(wc,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):he.map(ge=>{const Ee=C?.collection==="pages"&&C.key===ge.key,De=zS(h,ge.key);return o.jsx(kr,{icon:zi,title:ge.name,subtitle:ge.path,active:Ee,variantCount:De,onClick:()=>T({collection:"pages",key:ge.key,path:ge.path}),menu:o.jsx(Rd,{onDuplicate:()=>R(ge),onRename:()=>E(ge),onAddVariant:()=>I(ge),onEditSeo:()=>O(ge),onViewJson:()=>$(ge),onDelete:()=>D(ge)})},ge.key)}):s==="sections"?Q.length===0&&de.length===0?o.jsx(wc,{hasItems:i.length>0||a.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):o.jsxs(o.Fragment,{children:[ae.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(jv,{icon:Ki,label:"Saved sections"}),ae.map(ge=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:ge.label}),ge.sections.map(Ee=>{const De=C?.collection==="sections"&&C.key===Ee.key;return o.jsx(kr,{icon:Ki,accent:"global",title:Ee.name,subtitle:ge.label,active:De,onClick:()=>T({collection:"sections",key:Ee.key}),menu:o.jsx(Rd,{onDuplicate:()=>M(Ee),onRename:()=>z(Ee),onDelete:()=>F(Ee)})},Ee.key)})]},ge.label))]}),de.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(jv,{icon:zi,label:"Available sections",className:le(ae.length>0&&"mt-3")}),de.map(ge=>{const Ee=C?.collection==="available-section"&&C.resolveType===ge.resolveType,De=ge.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return o.jsx(kr,{icon:zi,title:ge.title,subtitle:De??ge.resolveType,active:Ee,onClick:()=>T({collection:"available-section",resolveType:ge.resolveType,title:ge.title})},ge.resolveType)})]})]}):s==="apps"?c?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(nt,{className:"size-4.5 text-muted-foreground"})}):re.length===0?o.jsx(wc,{hasItems:l.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):re.map(ge=>{const Ee=C?.collection==="apps"&&ge.blockKey!==null&&C.key===ge.blockKey;return o.jsx(kr,{icon:f8,logoUrl:ge.logo,title:ge.title,subtitle:ge.category,active:Ee,trailing:ge.installed?o.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!ge.installed||!ge.blockKey){ye.message(`${ge.title} is not installed on this site.`);return}T({collection:"apps",key:ge.blockKey})}},ge.id)}):s==="redirects"?ne.length===0?o.jsx(wc,{hasItems:r.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):ne.map(ge=>o.jsx(kr,{icon:e8,title:ge.from||"(no source)",subtitle:`→ ${ge.to||"(no target)"}`,active:C?.collection==="redirects"&&C.key===ge.key,trailing:o.jsx(oae,{type:ge.type}),onClick:()=>T({collection:"redirects",key:ge.key}),menu:o.jsx(Rd,{onDelete:()=>B(ge)})},ge.key)):Y?Ce.length===0?o.jsx(wc,{hasItems:be.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):Ce.map(ge=>{const Ee={key:ge.key,kind:"posts",label:ge.title,subtitle:ge.slug};return o.jsx(kr,{icon:Mr,title:ge.title,subtitle:ge.slug||"no slug",invalid:ge.missing.length>0,invalidReason:`Missing: ${ge.missing.join(", ")}`,active:C?.collection==="posts"&&C.key===ge.key,selectable:!0,selectionActive:Vt,selected:y.has(ge.key),onToggleSelect:()=>S(ge.key),onClick:()=>Vt?S(ge.key):T({collection:"posts",key:ge.key}),menu:o.jsx(Rd,{onDuplicate:()=>H(Ee),onDelete:()=>W(Ee)})},ge.key)}):ie.length===0?o.jsx(wc,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${pu(s)?mu[s]:"item"}.`}):ie.map(ge=>{const Ee=C?.collection===ge.kind&&C.key===ge.key;return o.jsx(kr,{icon:ge.kind==="posts"?Mr:ge.kind==="authors"?g9:G2,title:ge.label,subtitle:ge.subtitle,active:Ee,onClick:()=>T({collection:ge.kind,key:ge.key}),menu:o.jsx(Rd,{onDuplicate:()=>H(ge),onDelete:()=>W(ge)})},ge.key)}),e[0]=s,e[1]=l,e[2]=c,e[3]=a,e[4]=d,e[5]=h,e[6]=I,e[7]=V,e[8]=j,e[9]=A,e[10]=W,e[11]=D,e[12]=B,e[13]=F,e[14]=H,e[15]=R,e[16]=M,e[17]=O,e[18]=N,e[19]=v,e[20]=b,e[21]=L,e[22]=_,e[23]=E,e[24]=z,e[25]=f,e[26]=T,e[27]=k,e[28]=S,e[29]=$,e[30]=n,e[31]=p,e[32]=w,e[33]=m,e[34]=x,e[35]=g,e[36]=r,e[37]=u,e[38]=i,e[39]=y,e[40]=C,e[41]=K,e[42]=q,e[43]=G,e[44]=te,e[45]=X,e[46]=Z,e[47]=ee}else K=e[41],q=e[42],G=e[43],te=e[44],X=e[45],Z=e[46],ee=e[47];let se;e[70]!==q||e[71]!==G?(se=o.jsx("div",{className:q,children:G}),e[70]=q,e[71]=G,e[72]=se):se=e[72];let J;e[73]!==K||e[74]!==te||e[75]!==se?(J=o.jsx(K,{className:te,children:se}),e[73]=K,e[74]=te,e[75]=se,e[76]=J):J=e[76];let oe;return e[77]!==X||e[78]!==Z||e[79]!==ee||e[80]!==J?(oe=o.jsxs("div",{className:X,children:[Z,ee,J]}),e[77]=X,e[78]=Z,e[79]=ee,e[80]=J,e[81]=oe):oe=e[81],oe}function Ble(t){return t.key}function zle(t){return t.email}function Fle(t){return t.slug}function Ule(t){return typeof t=="string"?t:""}function Hle(t){const e=U.c(25),{virtualMcpId:s}=t,n=ue(),[r,i]=P.useState(!1),a=Vs(s),{activeTask:l}=an();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},e[0]=c):c=e[0];const d=na(c);if(!(xn(a?.metadata)||xn(l?.metadata))){let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(Ir,{className:"size-7 text-foreground"})}),e[1]=f):f=e[1];let m;e[2]!==n?(m=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=m):m=e[3];let p;e[4]!==n?(p=n("mainPanelTabs.contentTab.connectGithubDescription"),e[4]=n,e[5]=p):p=e[5];let g,x;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>i(!0),x=o.jsx(Ir,{className:"size-4"}),e[6]=g,e[7]=x):(g=e[6],x=e[7]);let b;e[8]!==n?(b=n("mainPanelTabs.previewTab.connectGithub"),e[8]=n,e[9]=b):b=e[9];let v;e[10]!==b?(v=o.jsxs(me,{onClick:g,children:[x,b]}),e[10]=b,e[11]=v):v=e[11];let _;e[12]!==m||e[13]!==p||e[14]!==v?(_=o.jsx(Dr,{className:"h-full",image:f,title:m,description:p,actions:v}),e[12]=m,e[13]=p,e[14]=v,e[15]=_):_=e[15];let L;e[16]!==r?(L=o.jsx(i0,{open:r,onOpenChange:i,mode:"agent"}),e[16]=r,e[17]=L):L=e[17];let y;return e[18]!==L||e[19]!==_?(y=o.jsxs(o.Fragment,{children:[_,L]}),e[18]=L,e[19]=_,e[20]=y):y=e[20],y}let u;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(u=o.jsx(Mle,{deepLinkPage:{pageId:d.contentPageId,path:d.contentPath,pathTemplate:d.contentPathTemplate}}),e[21]=d.contentPageId,e[22]=d.contentPath,e[23]=d.contentPathTemplate,e[24]=u):u=e[24],u}function Kle(){const t=U.c(3),[e,s]=P.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=a=>{if(!a)return;const l=()=>s(a.clientWidth);l();const c=new ResizeObserver(l);return c.observe(a),()=>c.disconnect()},t[0]=n):n=t[0];const r=n;let i;return t[1]!==e?(i=[e,r],t[1]=e,t[2]=i):i=t[2],i}function Wle(t){const e=U.c(6),{virtualMcpId:s}=t,n=Vs(s),r=c7();let i;e[0]!==r||e[1]!==n?(i=o9(r,u7(n)),e[0]=r,e[1]=n,e[2]=i):i=e[2];const a=i;if(!a){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(qle,{}),e[3]=c):c=e[3],c}let l;return e[4]!==a?(l=o.jsx(Qle,{config:a}),e[4]=a,e[5]=l):l=e[5],l}function qle(){const t=U.c(12),e=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:o.jsx(bg,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("assets.browser.noBucketTitle"),t[1]=e,t[2]=n):n=t[2];let r;t[3]!==n?(r=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=r):r=t[4];let i;t[5]!==e?(i=e("assets.browser.noBucketDescription"),t[5]=e,t[6]=i):i=t[6];let a;t[7]!==i?(a=o.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:i}),t[7]=i,t[8]=a):a=t[8];let l;return t[9]!==r||t[10]!==a?(l=o.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-3 p-10 text-center",children:[s,o.jsxs("div",{children:[r,a]})]}),t[9]=r,t[10]=a,t[11]=l):l=t[11],l}function Gle(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function Yle(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,r)=>s[r%e].push(n)),s}function Qle(t){const e=U.c(99),{config:s}=t,n=ue(),[r,i]=P.useState(""),a=y9(r,300);let l;e[0]!==s.id||e[1]!==a?(l={configId:s.id,search:a},e[0]=s.id,e[1]=a,e[2]=l):l=e[2];const c=Pk(l),d=G9(),[h,u]=P.useState(!1),[f,m]=P.useState(null),p=P.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(M){if(!M)return;const z=Array.from(M);if(z.length===0)return;const F=[];for(const B of z)try{await d.mutateAsync({configId:s.id,file:B})}catch(H){const W=H;F.push(`${B.name} (${W instanceof Error?W.message:"upload failed"})`)}await c.refetch(),F.length>0&&ye.error(F.length===z.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:F.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:F.join("; ")}))},e[3]=s.id,e[4]=c,e[5]=n,e[6]=d,e[7]=g):g=e[7];const x=g;let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=function(M){M.preventDefault(),u(!0)},e[8]=b):b=e[8];const v=b;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=function(){u(!1)},e[9]=_):_=e[9];const L=_;let y;e[10]!==x?(y=function(M){M.preventDefault(),M.stopPropagation(),u(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=y):y=e[11];const w=y,[S,k]=Kle();let j,N,V,C,T,A;if(e[12]!==s.name||e[13]!==a||e[14]!==k||e[15]!==S||e[16]!==x||e[17]!==h||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==w||e[22]!==r||e[23]!==n||e[24]!==d.isPending){const M=(c.data?.pages??[]).flatMap(Xle),z=Yle(M,Gle(S)),F=a.trim(),B=r!==a||c.isFetching&&!c.isFetchingNextPage;T="flex h-full min-h-0 flex-col gap-3 p-4";let H;e[31]!==n?(H=n("assets.browser.title"),e[31]=n,e[32]=H):H=e[32];let W;e[33]!==H?(W=o.jsx("h2",{className:"text-sm font-semibold",children:H}),e[33]=H,e[34]=W):W=e[34];let K;e[35]!==s.name||e[36]!==n?(K=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=K):K=e[37];let q;e[38]!==K?(q=o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:K}),e[38]=K,e[39]=q):q=e[39];let G;e[40]!==W||e[41]!==q?(G=o.jsxs("div",{className:"min-w-0",children:[W,q]}),e[40]=W,e[41]=q,e[42]=G):G=e[42];let te;e[43]===Symbol.for("react.memo_cache_sentinel")?(te=()=>p.current?.click(),e[43]=te):te=e[43];let X;e[44]!==d.isPending?(X=d.isPending?o.jsx(nt,{className:"size-3.5"}):o.jsx(Qn,{size:14}),e[44]=d.isPending,e[45]=X):X=e[45];let Z;e[46]!==n||e[47]!==d.isPending?(Z=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=Z):Z=e[48];let ee;e[49]!==X||e[50]!==Z||e[51]!==d.isPending?(ee=o.jsxs(me,{type:"button",size:"sm",disabled:d.isPending,onClick:te,children:[X,Z]}),e[49]=X,e[50]=Z,e[51]=d.isPending,e[52]=ee):ee=e[52];let se;e[53]!==x?(se=o.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:ie=>{const Y=Array.from(ie.target.files??[]);ie.target.value="",x(Y)}}),e[53]=x,e[54]=se):se=e[54],e[55]!==G||e[56]!==ee||e[57]!==se?(A=o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[G,ee,se]}),e[55]=G,e[56]=ee,e[57]=se,e[58]=A):A=e[58];let J;e[59]!==n?(J=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=J):J=e[60],e[61]!==B||e[62]!==r||e[63]!==J?(j=o.jsx(p9,{value:r,onChange:i,isSearching:B,placeholder:J,className:"shrink-0"}),e[61]=B,e[62]=r,e[63]=J,e[64]=j):j=e[64];let oe;e[65]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>p.current?.click(),e[65]=oe):oe=e[65];const ce=h&&"border-primary bg-primary/5",he=d.isPending&&"pointer-events-none opacity-60";let ne;e[66]!==ce||e[67]!==he?(ne=le("flex shrink-0 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border/60 p-4 text-center transition-colors",ce,he),e[66]=ce,e[67]=he,e[68]=ne):ne=e[68];let Q;e[69]===Symbol.for("react.memo_cache_sentinel")?(Q=o.jsx(Qn,{size:16,className:"text-muted-foreground"}),e[69]=Q):Q=e[69];let de;e[70]!==n?(de=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=de):de=e[71];let ae;e[72]!==n?(ae=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=ae):ae=e[73];let re;e[74]!==de||e[75]!==ae?(re=o.jsxs("p",{className:"text-xs text-muted-foreground",children:[de," ",ae]}),e[74]=de,e[75]=ae,e[76]=re):re=e[76],e[77]!==w||e[78]!==ne||e[79]!==re?(N=o.jsxs("button",{type:"button",onClick:oe,onDragOver:v,onDragLeave:L,onDrop:w,className:ne,children:[Q,re]}),e[77]=w,e[78]=ne,e[79]=re,e[80]=N):N=e[80],V="min-h-0 flex-1 overflow-y-auto pr-1",C=M.length===0?F?o.jsx(Tv,{title:n("filePicker.filePickerDialog.noMatches",{query:F}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):o.jsx(Tv,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):o.jsx("div",{ref:k,className:"flex items-start gap-3",children:z.map((ie,Y)=>o.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:ie.map(pe=>o.jsx(Jle,{item:pe,onDelete:()=>m(pe)},pe.key))},Y))}),e[12]=s.name,e[13]=a,e[14]=k,e[15]=S,e[16]=x,e[17]=h,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=w,e[22]=r,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=N,e[27]=V,e[28]=C,e[29]=T,e[30]=A}else j=e[25],N=e[26],V=e[27],C=e[28],T=e[29],A=e[30];let R;e[81]!==c||e[82]!==n?(R=c.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(me,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=R):R=e[83];let E;e[84]!==R||e[85]!==V||e[86]!==C?(E=o.jsxs("div",{className:V,children:[C,R]}),e[84]=R,e[85]=V,e[86]=C,e[87]=E):E=e[87];let I;e[88]===Symbol.for("react.memo_cache_sentinel")?(I=()=>m(null),e[88]=I):I=e[88];let D;e[89]!==s.id||e[90]!==f?(D=o.jsx(tce,{configId:s.id,item:f,onClose:I}),e[89]=s.id,e[90]=f,e[91]=D):D=e[91];let O;return e[92]!==j||e[93]!==N||e[94]!==E||e[95]!==D||e[96]!==T||e[97]!==A?(O=o.jsxs("div",{className:T,children:[A,j,N,E,D]}),e[92]=j,e[93]=N,e[94]=E,e[95]=D,e[96]=T,e[97]=A,e[98]=O):O=e[98],O}function Xle(t){return t.items}function Tv(t){const e=U.c(8),{title:s,description:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(ar,{size:18,className:"text-muted-foreground"})}),e[0]=r):r=e[0];let i;e[1]!==s?(i=o.jsx("p",{className:"text-sm font-medium",children:s}),e[1]=s,e[2]=i):i=e[2];let a;e[3]!==n?(a=o.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=a):a=e[4];let l;return e[5]!==i||e[6]!==a?(l=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[r,i,a]}),e[5]=i,e[6]=a,e[7]=l):l=e[7],l}function Jle(t){const e=U.c(34),{item:s,onDelete:n}=t;let r;e[0]!==s.key?(r=Ak(s.key),e[0]=s.key,e[1]=r):r=e[1];const i=r;let a;e[2]!==s.key?(a=ix(s.key),e[2]=s.key,e[3]=a):a=e[3];const l=a;let c;e[4]!==l||e[5]!==s.key||e[6]!==s.publicUrl?(c=l?o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:Zle}):o.jsx("div",{className:"flex aspect-square items-center justify-center",children:o.jsx(Mr,{size:28,className:"text-muted-foreground"})}),e[4]=l,e[5]=s.key,e[6]=s.publicUrl,e[7]=c):c=e[7];let d;e[8]!==s.key||e[9]!==s.publicUrl||e[10]!==c?(d=o.jsx("a",{href:s.publicUrl,target:"_blank",rel:"noreferrer",title:s.key,className:"block transition hover:ring-2 hover:ring-inset hover:ring-primary",children:c}),e[8]=s.key,e[9]=s.publicUrl,e[10]=c,e[11]=d):d=e[11];const h=s.key;let u;e[12]!==s.key?(u=jf(s.key),e[12]=s.key,e[13]=u):u=e[13];let f;e[14]!==s.key||e[15]!==u?(f=o.jsx("p",{className:"truncate text-xs font-medium",title:h,children:u}),e[14]=s.key,e[15]=u,e[16]=f):f=e[16];let m;e[17]!==s.size?(m=Ek(s.size),e[17]=s.size,e[18]=m):m=e[18];let p;e[19]!==i||e[20]!==m?(p=o.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[i," · ",m]}),e[19]=i,e[20]=m,e[21]=p):p=e[21];let g;e[22]!==f||e[23]!==p?(g=o.jsxs("div",{className:"min-w-0 flex-1",children:[f,p]}),e[22]=f,e[23]=p,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=o.jsx(ece,{item:s,onDelete:n}),e[25]=s,e[26]=n,e[27]=x):x=e[27];let b;e[28]!==g||e[29]!==x?(b=o.jsxs("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background px-2 py-1.5",children:[g,x]}),e[28]=g,e[29]=x,e[30]=b):b=e[30];let v;return e[31]!==b||e[32]!==d?(v=o.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border/60 bg-muted",children:[d,b]}),e[31]=b,e[32]=d,e[33]=v):v=e[33],v}function Zle(t){t.target.style.display="none"}function ece(t){const e=U.c(36),{item:s,onDelete:n}=t,r=ue(),[i,a]=P.useState(!1);let l;e[0]!==s.publicUrl||e[1]!==r?(l=async function(){try{await navigator.clipboard.writeText(s.publicUrl),a(!0),window.setTimeout(()=>a(!1),1500)}catch{ye.error(r("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=r,e[2]=l):l=e[2];const c=l;let d;e[3]!==r?(d=r("filePicker.filePickerDialog.assetActions"),e[3]=r,e[4]=d):d=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(v9,{size:14}),e[5]=h):h=e[5];let u;e[6]!==d?(u=o.jsx(Ut,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:h})}),e[6]=d,e[7]=u):u=e[7];let f;e[8]!==i?(f=i?o.jsx($t,{size:14}):o.jsx(bn,{size:14}),e[8]=i,e[9]=f):f=e[9];let m;e[10]!==i||e[11]!==r?(m=r(i?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=i,e[11]=r,e[12]=m):m=e[12];let p;e[13]!==c||e[14]!==f||e[15]!==m?(p=o.jsxs(et,{onClick:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(fn,{size:14}),e[17]=x):x=e[17];let b;e[18]!==r?(b=r("filePicker.filePickerDialog.openInNewTab"),e[18]=r,e[19]=b):b=e[19];let v;e[20]!==s.publicUrl||e[21]!==b?(v=o.jsx(et,{asChild:!0,children:o.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=v):v=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(rn,{size:14}),e[23]=_):_=e[23];let L;e[24]!==r?(L=r("assets.browser.deleteAction"),e[24]=r,e[25]=L):L=e[25];let y;e[26]!==n||e[27]!==L?(y=o.jsxs(et,{variant:"destructive",onClick:n,children:[_,L]}),e[26]=n,e[27]=L,e[28]=y):y=e[28];let w;e[29]!==v||e[30]!==y||e[31]!==p?(w=o.jsxs(Ht,{align:"end",children:[p,v,y]}),e[29]=v,e[30]=y,e[31]=p,e[32]=w):w=e[32];let S;return e[33]!==w||e[34]!==u?(S=o.jsxs(Ft,{children:[u,w]}),e[33]=w,e[34]=u,e[35]=S):S=e[35],S}function tce(t){const e=U.c(47),{configId:s,item:n,onClose:r}=t,i=ue(),a=ire();let l;e[0]!==s||e[1]!==a||e[2]!==n||e[3]!==r||e[4]!==i?(l=async function(){if(n)try{await a.mutateAsync({configId:s,key:n.key}),ye.success(i("assets.browser.deleted")),r()}catch{ye.error(i("assets.browser.deleteFailed"))}},e[0]=s,e[1]=a,e[2]=n,e[3]=r,e[4]=i,e[5]=l):l=e[5];const c=l,d=!!n;let h;e[6]!==r?(h=C=>!C&&r(),e[6]=r,e[7]=h):h=e[7];let u;e[8]!==i?(u=i("assets.browser.deleteConfirmTitle"),e[8]=i,e[9]=u):u=e[9];let f;e[10]!==u?(f=o.jsx(Yi,{children:u}),e[10]=u,e[11]=f):f=e[11];let m;e[12]!==n||e[13]!==i?(m=i("assets.browser.deleteConfirmDescription",{name:n?jf(n.key):""}),e[12]=n,e[13]=i,e[14]=m):m=e[14];let p;e[15]!==m?(p=o.jsx(Qi,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==f||e[18]!==p?(g=o.jsxs(Gi,{children:[f,p]}),e[17]=f,e[18]=p,e[19]=g):g=e[19];const x=a.isPending;let b;e[20]!==i?(b=i("assets.browser.deleteCancel"),e[20]=i,e[21]=b):b=e[21];let v;e[22]!==a.isPending||e[23]!==b?(v=o.jsx(Ji,{disabled:x,children:b}),e[22]=a.isPending,e[23]=b,e[24]=v):v=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=le(y6({variant:"destructive"})),e[25]=_):_=e[25];const L=a.isPending;let y;e[26]!==c?(y=C=>{C.preventDefault(),c()},e[26]=c,e[27]=y):y=e[27];let w;e[28]!==a.isPending?(w=a.isPending?o.jsx(nt,{className:"size-3.5"}):null,e[28]=a.isPending,e[29]=w):w=e[29];let S;e[30]!==i?(S=i("assets.browser.deleteConfirm"),e[30]=i,e[31]=S):S=e[31];let k;e[32]!==a.isPending||e[33]!==y||e[34]!==w||e[35]!==S?(k=o.jsxs(Zi,{className:_,disabled:L,onClick:y,children:[w,S]}),e[32]=a.isPending,e[33]=y,e[34]=w,e[35]=S,e[36]=k):k=e[36];let j;e[37]!==v||e[38]!==k?(j=o.jsxs(Xi,{children:[v,k]}),e[37]=v,e[38]=k,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==g?(N=o.jsxs(qi,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=N):N=e[42];let V;return e[43]!==N||e[44]!==d||e[45]!==h?(V=o.jsx(Wi,{open:d,onOpenChange:h,children:N}),e[43]=N,e[44]=d,e[45]=h,e[46]=V):V=e[46],V}const im={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:aa},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Fi},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:O6}},sce=["fast","smart","thinking"];function nce(t){const e=U.c(19),{tier:s,onSelect:n}=t,r=ue(),[i,a]=P.useState(!1),l=im[s].icon;let c;e[0]!==l?(c=o.jsx(l,{size:14,className:"text-muted-foreground"}),e[0]=l,e[1]=c):c=e[1];const d=im[s];let h;e[2]!==r||e[3]!==d.labelKey?(h=r(d.labelKey),e[2]=r,e[3]=d.labelKey,e[4]=h):h=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(ds,{size:14,className:"text-muted-foreground"}),e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==h?(f=o.jsx(gs,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,h,u]})}),e[6]=c,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==r||e[11]!==s?(m=sce.map(x=>{const b=im[x],v=b.icon;return o.jsxs("button",{type:"button",onClick:()=>{n(x),a(!1)},className:le("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[o.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"text-sm",children:r(b.labelKey)}),o.jsx("div",{className:"text-xs text-muted-foreground",children:r(b.subtitleKey)})]}),x===s&&o.jsx($t,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=r,e[11]=s,e[12]=m):m=e[12];let p;e[13]!==m?(p=o.jsx(ys,{align:"start",className:"p-1 w-64",children:o.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==i||e[16]!==f||e[17]!==p?(g=o.jsxs(_s,{open:i,onOpenChange:a,children:[f,p]}),e[15]=i,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function rce(t){const e=U.c(27),{tier:s,onTierChange:n,override:r,onOverrideChange:i}=t,a=ue(),[l,c]=P.useState(r!==null);let d;e[0]!==a?(d=a("automations.automationConfig.modelLabel"),e[0]=a,e[1]=d):d=e[1];let h;e[2]!==d?(h=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=h):h=e[3];let u;e[4]!==i||e[5]!==n||e[6]!==r||e[7]!==a||e[8]!==s||e[9]!==l?(u=l?o.jsx(P.Suspense,{fallback:o.jsx(me,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:a("automations.automationConfig.loadingModels")}),children:o.jsx(ice,{override:r,onOverrideChange:i})}):o.jsx(nce,{tier:s,onSelect:n}),e[4]=i,e[5]=n,e[6]=r,e[7]=a,e[8]=s,e[9]=l,e[10]=u):u=e[10];let f;e[11]!==i?(f=v=>{c(v),v||i(null)},e[11]=i,e[12]=f):f=e[12];let m;e[13]!==f||e[14]!==l?(m=o.jsx(rr,{checked:l,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=l,e[15]=m):m=e[15];let p;e[16]!==a?(p=a("automations.automationConfig.specificModel"),e[16]=a,e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==p?(g=o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20];let x;e[21]!==u||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u,g]}),e[21]=u,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==h||e[25]!==x?(b=o.jsxs("div",{className:"flex flex-col gap-2",children:[h,x]}),e[24]=h,e[25]=x,e[26]=b):b=e[26],b}function ice(t){const e=U.c(25),{override:s,onOverrideChange:n}=t,r=ue(),i=c9(),a=i[0]?.id??null;let l;e[0]!==a||e[1]!==i||e[2]!==s?.credentialId?(l=i.some(b=>b.id===s?.credentialId)?s?.credentialId??null:a,e[0]=a,e[1]=i,e[2]=s?.credentialId,e[3]=l):l=e[3];const[c,d]=P.useState(l);let h;e[4]!==c||e[5]!==a||e[6]!==i?(h=i.some(b=>b.id===c)?c:a,e[4]=c,e[5]=a,e[6]=i,e[7]=h):h=e[7];const u=h;let f;e[8]!==i||e[9]!==s?(f=s&&i.some(b=>b.id===s.credentialId)?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[8]=i,e[9]=s,e[10]=f):f=e[10];const m=f;if(i.length===0){let b;e[11]!==r?(b=r("automations.automationConfig.connectAiProviderHint"),e[11]=r,e[12]=b):b=e[12];let v;return e[13]!==b?(v=o.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=v):v=e[14],v}let p;e[15]!==r?(p=r("automations.automationConfig.pickModelPlaceholder"),e[15]=r,e[16]=p):p=e[16];let g;e[17]!==u||e[18]!==n?(g=b=>{const v=b.keyId??u??"";d(v),n({modelId:b.modelId,credentialId:v,title:b.title??b.modelId})},e[17]=u,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==u||e[21]!==m||e[22]!==p||e[23]!==g?(x=o.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:o.jsx(ZP,{variant:"bordered",placeholder:p,model:m,credentialId:u,onCredentialChange:d,onModelChange:g})}),e[20]=u,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const bj=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:Sg,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:Cn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:ar},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:Gn},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:Qu}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:qo,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:s9},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:b9},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:U2},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Cu},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:qo},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:tP}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Ia,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Ia},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Hc},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Hc}]}],oce=bj.flatMap(t=>t.tools.map(e=>e.name));function ace(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function lce(t){const e=U.c(12),{agentId:s,value:n,onChange:r}=t,i=ue();let a;e[0]!==i?(a=i("automations.automationConfig.toolsLabel"),e[0]=i,e[1]=a):a=e[1];let l;e[2]!==a?(l=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:a}),e[2]=a,e[3]=l):l=e[3];let c;e[4]!==s||e[5]!==r||e[6]!==i||e[7]!==n?(c=s?o.jsx(P.Suspense,{fallback:o.jsxs(me,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[o.jsx(Sg,{size:14}),i("automations.automationConfig.loadingTools")]}),children:o.jsx(cce,{agentId:s,value:n,onChange:r})}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:i("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=r,e[6]=i,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==l||e[10]!==c?(d=o.jsxs("div",{className:"flex flex-col gap-2",children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function Pv(t){const e=U.c(17),{value:s,checked:n,onToggle:r,title:i,description:a,leading:l}=t;let c;e[0]!==n?(c=o.jsx(il,{checked:n,className:"pointer-events-none mt-0.5"}),e[0]=n,e[1]=c):c=e[1];let d;e[2]!==l?(d=l&&o.jsx("span",{className:"mt-px shrink-0",children:l}),e[2]=l,e[3]=d):d=e[3];let h;e[4]!==i?(h=o.jsx("span",{className:"truncate text-sm leading-tight",children:i}),e[4]=i,e[5]=h):h=e[5];let u;e[6]!==a?(u=a&&o.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:a}),e[6]=a,e[7]=u):u=e[7];let f;e[8]!==h||e[9]!==u?(f=o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[h,u]}),e[8]=h,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(m=o.jsxs(as,{value:s,onSelect:r,className:"items-start gap-2.5 py-2",children:[c,d,f]}),e[11]=r,e[12]=c,e[13]=d,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function Av(t){const e=U.c(27),{conn:s,label:n,icon:r,on:i,total:a,onToggle:l}=t,c=ue(),d=i===a;let h;e[0]!==r||e[1]!==s?(h=s?o.jsx(io,{icon:s.icon,name:s.title,size:"2xs"}):r?o.jsx(r,{size:14,className:"text-muted-foreground"}):o.jsx(hE,{size:14,className:"text-muted-foreground"}),e[0]=r,e[1]=s,e[2]=h):h=e[2];let u;e[3]!==s?.title||e[4]!==n||e[5]!==c?(u=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=u):u=e[6];let f;e[7]!==u?(f=o.jsx("span",{className:"truncate",children:u}),e[7]=u,e[8]=f):f=e[8];let m;e[9]!==i||e[10]!==a?(m=o.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[i,"/",a]}),e[9]=i,e[10]=a,e[11]=m):m=e[11];let p;e[12]!==l?(p=_=>{_.stopPropagation(),l()},e[12]=l,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==g?(x=o.jsx("button",{type:"button",onClick:p,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==m||e[21]!==x?(b=o.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=b):b=e[22];let v;return e[23]!==h||e[24]!==f||e[25]!==b?(v=o.jsxs("div",{className:"flex items-center gap-2",children:[h,f,b]}),e[23]=h,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function cce(t){const e=U.c(83),{agentId:s,value:n,onChange:r}=t,i=ue(),{org:a}=Fe(),[l,c]=P.useState(!1);let d;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(d={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=d):d=e[3];const h=Vn(d);let u;e[4]!==h?(u={client:h},e[4]=h,e[5]=u):u=e[5];const{data:f,isLoading:m}=D8(u),p=ui();let g,x,b,v,_,L,y,w,S,k,j,N,V;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==r||e[10]!==l||e[11]!==i||e[12]!==n){const E=new Map(p.map(mce)),I=new Map;for(const ae of f?.tools??[]){const re=$i(ae._meta)??"__other__",ie=Hu(ae.name,re==="__other__"?void 0:re),Y=ae.title,pe=Y&&Y!==ae.name?Y:ace(ie);I.has(re)||I.set(re,{clientId:re,conn:E.get(re),tools:[]}),I.get(re).tools.push({name:ae.name,display:pe,description:ae.description})}const D=[...I.values()].sort(fce),O=(f?.tools??[]).map(hce),$=[...oce,...O],M=n===null?new Set($):new Set(n),z=$.every(ae=>M.has(ae)),F=ae=>r($.every(re=>ae.has(re))?null:[...ae]),B=ae=>{const re=new Set(M);re.has(ae)?re.delete(ae):re.add(ae),F(re)},H=(ae,re)=>{const ie=new Set(M);for(const Y of ae)re?ie.add(Y):ie.delete(Y);F(ie)};v=_s,V=l,_=c;let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(Sg,{size:14,className:"text-muted-foreground"}),e[26]=W):W=e[26];let K;e[27]!==z||e[28]!==i?(K=i(z?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=z,e[28]=i,e[29]=K):K=e[29];const q=!z&&o.jsxs(jE,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",$.length]});let G;e[30]===Symbol.for("react.memo_cache_sentinel")?(G=o.jsx(ds,{size:14,className:"text-muted-foreground"}),e[30]=G):G=e[30],e[31]!==K||e[32]!==q?(L=o.jsx(gs,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[W,K,q,G]})}),e[31]=K,e[32]=q,e[33]=L):L=e[33],b=ys,j="p-0 w-80",N="start",x=zr;let te;e[34]!==i?(te=i("automations.automationConfig.searchToolsPlaceholder"),e[34]=i,e[35]=te):te=e[35],e[36]!==te?(S=o.jsx(hr,{placeholder:te}),e[36]=te,e[37]=S):S=e[37];const X=z?i("automations.automationConfig.allToolsEnabled",{count:$.length}):i("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:$.length});let Z;e[38]!==X?(Z=o.jsx("span",{className:"text-xs text-muted-foreground",children:X}),e[38]=X,e[39]=Z):Z=e[39];let ee;e[40]!==r?(ee=()=>r(null),e[40]=r,e[41]=ee):ee=e[41];let se;e[42]!==i?(se=i("automations.automationConfig.selectAll"),e[42]=i,e[43]=se):se=e[43];let J;e[44]!==z||e[45]!==ee||e[46]!==se?(J=o.jsx("button",{type:"button",onClick:ee,disabled:z,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:se}),e[44]=z,e[45]=ee,e[46]=se,e[47]=J):J=e[47];let oe;e[48]===Symbol.for("react.memo_cache_sentinel")?(oe=o.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=oe):oe=e[48];let ce;e[49]!==r?(ce=()=>r([]),e[49]=r,e[50]=ce):ce=e[50];const he=M.size===0;let ne;e[51]!==i?(ne=i("automations.automationConfig.clear"),e[51]=i,e[52]=ne):ne=e[52];let Q;e[53]!==ce||e[54]!==he||e[55]!==ne?(Q=o.jsx("button",{type:"button",onClick:ce,disabled:he,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:ne}),e[53]=ce,e[54]=he,e[55]=ne,e[56]=Q):Q=e[56];let de;e[57]!==J||e[58]!==Q?(de=o.jsxs("div",{className:"flex items-center gap-2",children:[J,oe,Q]}),e[57]=J,e[58]=Q,e[59]=de):de=e[59],e[60]!==Z||e[61]!==de?(k=o.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[Z,de]}),e[60]=Z,e[61]=de,e[62]=k):k=e[62],g=fr,y="max-h-80",w=m?o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:i("automations.automationConfig.loadingTools")}):o.jsxs(o.Fragment,{children:[o.jsx(On,{children:i("automations.automationConfig.noToolsFound")}),bj.map(ae=>{const re=ae.tools.map(uce),ie=re.filter(Y=>M.has(Y)).length;return o.jsx(Es,{heading:o.jsx(Av,{label:i(ae.headingKey),icon:ae.icon,on:ie,total:re.length,onToggle:()=>H(re,ie!==re.length)}),children:ae.tools.map(Y=>o.jsx(Pv,{value:`${i(Y.titleKey)} ${Y.name}`,checked:M.has(Y.name),onToggle:()=>B(Y.name),title:i(Y.titleKey),description:i(Y.descriptionKey),leading:o.jsx(Y.icon,{size:16,className:"text-muted-foreground"})},Y.name))},ae.key)}),D.map(ae=>{const re=ae.tools.map(dce),ie=re.filter(Y=>M.has(Y)).length;return o.jsx(Es,{heading:o.jsx(Av,{conn:ae.conn,on:ie,total:re.length,onToggle:()=>H(re,ie!==re.length)}),children:ae.tools.map(Y=>o.jsx(Pv,{value:`${Y.display} ${Y.name} ${ae.conn?.title??""}`,checked:M.has(Y.name),onToggle:()=>B(Y.name),title:Y.display,description:Y.description},Y.name))},ae.clientId)})]}),e[6]=p,e[7]=f?.tools,e[8]=m,e[9]=r,e[10]=l,e[11]=i,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=v,e[17]=_,e[18]=L,e[19]=y,e[20]=w,e[21]=S,e[22]=k,e[23]=j,e[24]=N,e[25]=V}else g=e[13],x=e[14],b=e[15],v=e[16],_=e[17],L=e[18],y=e[19],w=e[20],S=e[21],k=e[22],j=e[23],N=e[24],V=e[25];let C;e[63]!==g||e[64]!==y||e[65]!==w?(C=o.jsx(g,{className:y,children:w}),e[63]=g,e[64]=y,e[65]=w,e[66]=C):C=e[66];let T;e[67]!==x||e[68]!==C||e[69]!==S||e[70]!==k?(T=o.jsxs(x,{children:[S,k,C]}),e[67]=x,e[68]=C,e[69]=S,e[70]=k,e[71]=T):T=e[71];let A;e[72]!==b||e[73]!==T||e[74]!==j||e[75]!==N?(A=o.jsx(b,{className:j,align:N,children:T}),e[72]=b,e[73]=T,e[74]=j,e[75]=N,e[76]=A):A=e[76];let R;return e[77]!==v||e[78]!==_||e[79]!==L||e[80]!==A||e[81]!==V?(R=o.jsxs(v,{open:V,onOpenChange:_,children:[L,A]}),e[77]=v,e[78]=_,e[79]=L,e[80]=A,e[81]=V,e[82]=R):R=e[82],R}function dce(t){return t.name}function uce(t){return t.name}function hce(t){return t.name}function fce(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function mce(t){return[t.id,t]}function gu(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function pce(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return`Every ${n[1]} hours`;const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const l=parseInt(r[1]??"1");return l%7===0?`Every ${l/7} weeks`:`Every ${l} days`}const i=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(i){const l=(i[2]??"0").padStart(2,"0"),c=(i[1]??"0").padStart(2,"0");return`Every day at ${l}:${c} UTC`}const a=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(a){const c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(a[3]??"0")]??"day",d=(a[2]??"0").padStart(2,"0"),h=(a[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${h} UTC`}return t}function gce(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function xce(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return{count:parseInt(n[1]),unit:"hours"};const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);return r?{count:parseInt(r[1]),unit:"days"}:null}function bce(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const vce=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function yce({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:r,onWebhookCreated:i}){const a=ue(),{triggerAdd:l}=a0(),[c,d]=P.useState(!1),h=e??c,u=p=>{s?s(p):d(p)},f=async p=>{try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),ye.success(a("automations.addStarterPopover.starterAdded")),u(!1)}catch(g){const x=g instanceof Error?g.message:a("automations.addStarterPopover.failedAddStarter");ye.error(x)}},m=async()=>{try{const p=await l.mutateAsync({automation_id:t,type:"webhook"});u(!1),p.webhook?i?.(p.webhook):ye.success(a("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:a("automations.addStarterPopover.failedAddWebhookStarter");ye.error(g)}};return o.jsxs(Ft,{open:h,onOpenChange:u,children:[o.jsx(Ut,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(Qt,{size:14}),a("automations.addStarterPopover.addStarter")]})}),o.jsxs(Ht,{align:"end",className:"w-[200px]",children:[o.jsxs(jr,{children:[o.jsxs(Cr,{className:"gap-2.5",children:[o.jsx(nu,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.every")]}),o.jsx(Nr,{className:"w-[160px]",children:vce.map(p=>o.jsxs(et,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:l.isPending,children:[o.jsx(nu,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),o.jsxs(et,{className:"gap-2.5",onSelect:()=>{u(!1),n?.()},children:[o.jsx(nu,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.customCron")]}),o.jsxs(et,{className:"gap-2.5",onSelect:()=>{u(!1),r?.()},children:[o.jsx(hi,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.event")]}),o.jsxs(et,{className:"gap-2.5",onSelect:()=>{m()},disabled:l.isPending,children:[o.jsx(Cn,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.webhook")]})]})]})}function vj(t){const e=U.c(39),{open:s,onOpenChange:n,url:r,token:i,title:a,description:l}=t,c=a===void 0?"Webhook ready":a,d=l===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":l,h=ue(),[u,f]=P.useState(null),[m,p]=P.useState("curl"),[g,x]=P.useState("header"),b=P.useId();let v;e[0]!==h?(v=async(D,O)=>{try{await navigator.clipboard.writeText(D),f(O),ye.success(h("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{ye.error(h("automations.webhookSecretDialog.failedCopy"))}},e[0]=h,e[1]=v):v=e[1];const _=v;let L;e[2]!==g||e[3]!==i||e[4]!==r?(L=r&&i&&g==="url"?`${r.replace(/\/$/,"")}/${i}`:r??"",e[2]=g,e[3]=i,e[4]=r,e[5]=L):L=e[5];const y=L,w=r&&i?g==="header"?`curl -X POST "${y}" \\
627
+ `)};Pn.prototype.renderPartial=function(e,s,n,r){if(n){var i=this.getConfigTags(r),a=fx(n)?n(e[1]):n[e[1]];if(a!=null){var l=e[6],c=e[5],d=e[4],h=a;c==0&&d&&(h=this.indentPartial(a,d,l));var u=this.parse(h,i);return this.renderTokens(u,s,n,h,r)}}};Pn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Pn.prototype.escapedValue=function(e,s,n){var r=this.getConfigEscape(n)||Br.escape,i=s.lookup(e[1]);if(i!=null)return typeof i=="number"&&r===Br.escape?String(i):r(i)};Pn.prototype.rawValue=function(e){return e[1]};Pn.prototype.getConfigTags=function(e){return vd(e)?e:e&&typeof e=="object"?e.tags:void 0};Pn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!vd(e))return e.escape};var Br={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){$u.templateCache=t},get templateCache(){return $u.templateCache}},$u=new Pn;Br.clearCache=function(){return $u.clearCache()};Br.parse=function(e,s){return $u.parse(e,s)};Br.render=function(e,s,n,r){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Jae(e)+'" was given as the first argument for mustache#render(template, view, partials)');return $u.render(e,s,n,r)};Br.escape=ile;Br.Scanner=S0;Br.Context=td;Br.Writer=Pn;function fle(t,e){const s={__resolveType:t},n=IS([s],e)[0];return n?cne(s,n,e):null}function mle({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:r,decofile:i,blockKey:a,onSaveReferencedBlock:l}){const c=ue(),d=lo(),h=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[u]=P.useState(()=>fle(a,i)),[f,m]=P.useState(u?.data??{}),[p,g]=P.useState([]),[x,b]=P.useState(0),[v,_]=P.useState(!1),[L,y]=P.useState(null),w=L!==null,{save:S,flush:k}=G3({orgSlug:t,virtualMcpId:e,branch:s}),j=u?.resolveType?$n(u.resolveType,r):null,N=i[a],V=N?Ka(a,N):a,C=ws()?.taskId??null,T={orgSlug:t,virtualMcpId:e,branch:s,threadId:C,previewUrl:n??void 0,siteSlug:h},A=O=>{m(O),S(a,O)},R=()=>{w?(y(null),_(!1),b(O=>O+1)):y(JSON.stringify(f,null,2))},E=O=>{const $=O??"";try{const M=JSON.parse($);if(M&&typeof M=="object"&&!Array.isArray(M)){_(!1),A(M);return}_(!0)}catch{_(!0)}},I=[V,...p],D=O=>{g(p.slice(0,O)),b($=>$+1)};return o.jsx("div",{className:"flex h-full w-full min-w-0",children:o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:E3},"aria-hidden":!0}),o.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:I.map((O,$)=>{const M=$===I.length-1,z=kn(O);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[$>0&&o.jsx(Us,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>D($),title:z,className:le("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",M?"font-medium text-foreground":"text-muted-foreground"),children:z})]},`${z}-${$}`)})}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:w?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:R,"aria-label":c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":w,children:w?o.jsx(nn,{size:14}):o.jsx(rd,{size:14})})}),o.jsx(We,{side:"bottom",children:c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),o.jsxs("div",{className:"relative min-h-0 flex-1",children:[o.jsx(rl,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:j?o.jsx(Hr,{schema:j,value:f,onChange:O=>A(O),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:r,decofile:i,onSaveReferencedBlock:l,sandbox:T},x):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),L!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[v&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ud,{language:"json",height:"100%",code:L,onChange:E,onSave:O=>{E(O),k()}})})]})]})]})})}function ple(t){const e=U.c(36),{selection:s,orgSlug:n,virtualMcpId:r,branch:i,previewUrl:a,meta:l,decofile:c,isCreating:d,onCreateAvailable:h,onSaveReferencedBlock:u}=t,f=ue();if(!s){let g;e[0]!==f?(g=f("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=f,e[1]=g):g=e[1];let x;e[2]!==f?(x=f("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=f,e[3]=x):x=e[3];let b;return e[4]!==g||e[5]!==x?(b=o.jsx(Oo,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=b):b=e[6],b}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,b=s.title;let v;e[7]!==s.title?(v=Vk(s.title),e[7]=s.title,e[8]=v):v=e[8];let _;e[9]!==h||e[10]!==s.resolveType?(_=(y,w)=>h(s.resolveType,y,w),e[9]=h,e[10]=s.resolveType,e[11]=_):_=e[11];let L;return e[12]!==i||e[13]!==c||e[14]!==d||e[15]!==l||e[16]!==u||e[17]!==n||e[18]!==a||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==v||e[23]!==_||e[24]!==r?(L=o.jsx(Yae,{orgSlug:n,virtualMcpId:r,branch:i,previewUrl:a,meta:l,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:_,onSaveReferencedBlock:u},g),e[12]=i,e[13]=c,e[14]=d,e[15]=l,e[16]=u,e[17]=n,e[18]=a,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=v,e[23]=_,e[24]=r,e[25]=L):L=e[25],L}const m=`saved:${s.key}`;let p;return e[26]!==i||e[27]!==c||e[28]!==l||e[29]!==u||e[30]!==n||e[31]!==a||e[32]!==s.key||e[33]!==m||e[34]!==r?(p=o.jsx(mle,{orgSlug:n,virtualMcpId:r,branch:i,previewUrl:a,meta:l,decofile:c,blockKey:s.key,onSaveReferencedBlock:u},m),e[26]=i,e[27]=c,e[28]=l,e[29]=u,e[30]=n,e[31]=a,e[32]=s.key,e[33]=m,e[34]=r,e[35]=p):p=e[35],p}const _v="__all__",Lv={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},gle={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},Ph={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},wv="status:";function Sv(t){if(!t.startsWith(wv))return null;const e=t.slice(wv.length);return e in Ph?e:null}const kv=P.forwardRef(function(e,s){const n=U.c(20);let r,i,a,l,c;n[0]!==e?({icon:r,active:i,value:c,className:a,...l}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=l,n[5]=c):(r=n[1],i=n[2],a=n[3],l=n[4],c=n[5]);const d=i?"text-foreground":"text-muted-foreground";let h;n[6]!==a||n[7]!==d?(h=le("h-7 gap-1 px-1.5 text-xs",d,a),n[6]=a,n[7]=d,n[8]=h):h=n[8];let u;n[9]!==r?(u=o.jsx(r,{size:14,className:"shrink-0"}),n[9]=r,n[10]=u):u=n[10];let f;n[11]!==c?(f=c&&o.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=f):f=n[12];let m;n[13]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(ds,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==l||n[15]!==s||n[16]!==h||n[17]!==u||n[18]!==f?(p=o.jsxs(me,{ref:s,type:"button",variant:"ghost",size:"sm",className:h,...l,children:[u,f,m]}),n[14]=l,n[15]=s,n[16]=h,n[17]=u,n[18]=f,n[19]=p):p=n[19],p});function mx(t){const e=U.c(2),{count:s}=t;let n;return e[0]!==s?(n=o.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=n):n=e[1],n}function xle(t){const e=U.c(101),{categories:s,authors:n,statusCounts:r,categoryFilter:i,authorFilter:a,statusFilter:l,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:h,onStatusFilterChange:u,onSortChange:f}=t,m=ue();let p;if(e[0]!==s||e[1]!==i){let ne;e[3]!==i?(ne=Q=>Q.slug===i,e[3]=i,e[4]=ne):ne=e[4],p=s.find(ne),e[0]=s,e[1]=i,e[2]=p}else p=e[2];const g=p;let x;if(e[5]!==a||e[6]!==n){let ne;e[8]!==a?(ne=Q=>Q.email===a,e[8]=a,e[9]=ne):ne=e[9],x=n.find(ne),e[5]=a,e[6]=n,e[7]=x}else x=e[7];const b=x,v=!!(i||a||l);let _;e[10]!==b?.name||e[11]!==g?.name||e[12]!==l||e[13]!==m?(_=g?.name??b?.name??m(l?Ph[l]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=l,e[13]=m,e[14]=_):_=e[14];const L=_,y=i?`cat:${i}`:a?`author:${a}`:l?`status:${l}`:_v;let w;e[15]!==h||e[16]!==d||e[17]!==u?(w=()=>{d(null),h(null),u(null)},e[15]=h,e[16]=d,e[17]=u,e[18]=w):w=e[18];const S=w;let k;e[19]!==S||e[20]!==h||e[21]!==d||e[22]!==u?(k=ne=>{ne.startsWith("cat:")?(h(null),u(null),d(ne.slice(4))):ne.startsWith("author:")?(d(null),u(null),h(ne.slice(7))):Sv(ne)?(d(null),h(null),u(Sv(ne))):S()},e[19]=S,e[20]=h,e[21]=d,e[22]=u,e[23]=k):k=e[23];const j=k;let N;e[24]!==L||e[25]!==v?(N=o.jsx(Ut,{asChild:!0,children:o.jsx(kv,{icon:ZT,active:v,value:L,className:"min-w-0 shrink"})}),e[24]=L,e[25]=v,e[26]=N):N=e[26];let V;e[27]!==m?(V=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=V):V=e[28];let C;e[29]!==V?(C=o.jsx(Sd,{children:V}),e[29]=V,e[30]=C):C=e[30];let T;e[31]!==m?(T=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=T):T=e[32];let A;e[33]!==T?(A=o.jsx(Bo,{value:_v,children:T}),e[33]=T,e[34]=A):A=e[34];let R;e[35]!==m?(R=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=R):R=e[36];let E;e[37]!==R?(E=o.jsx(Sd,{className:"text-muted-foreground/70",children:R}),e[37]=R,e[38]=E):E=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=Object.keys(Ph),e[39]=I):I=e[39];let D;e[40]!==r||e[41]!==m?(D=I.map(ne=>o.jsxs(Bo,{value:`status:${ne}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(Ph[ne])}),o.jsx(mx,{count:r[ne]})]},`status:${ne}`)),e[40]=r,e[41]=m,e[42]=D):D=e[42];let O;e[43]!==s.length||e[44]!==m?(O=s.length>0&&o.jsx(Sd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=O):O=e[45];let $;e[46]!==s?($=s.map(vle),e[46]=s,e[47]=$):$=e[47];let M;e[48]!==n.length||e[49]!==m?(M=n.length>0&&o.jsx(Sd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=M):M=e[50];let z;e[51]!==n?(z=n.map(ble),e[51]=n,e[52]=z):z=e[52];let F;e[53]!==y||e[54]!==j||e[55]!==A||e[56]!==E||e[57]!==D||e[58]!==O||e[59]!==$||e[60]!==M||e[61]!==z?(F=o.jsxs(Gh,{value:y,onValueChange:j,children:[A,E,D,O,$,M,z]}),e[53]=y,e[54]=j,e[55]=A,e[56]=E,e[57]=D,e[58]=O,e[59]=$,e[60]=M,e[61]=z,e[62]=F):F=e[62];let B;e[63]!==F||e[64]!==C?(B=o.jsxs(Ht,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[C,F]}),e[63]=F,e[64]=C,e[65]=B):B=e[65];let H;e[66]!==B||e[67]!==N?(H=o.jsxs(Ft,{children:[N,B]}),e[66]=B,e[67]=N,e[68]=H):H=e[68];let W;e[69]!==S||e[70]!==v||e[71]!==m?(W=v&&o.jsx(yle,{label:m("sandbox.postToolbar.clearFilter"),onClick:S}),e[69]=S,e[70]=v,e[71]=m,e[72]=W):W=e[72];const K=gle[c];let q;e[73]!==m||e[74]!==K?(q=m(K),e[73]=m,e[74]=K,e[75]=q):q=e[75];let G;e[76]!==q?(G=o.jsx(Ut,{asChild:!0,children:o.jsx(kv,{icon:eP,active:!0,value:q})}),e[76]=q,e[77]=G):G=e[77];let te;e[78]!==m?(te=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=te):te=e[79];let X;e[80]!==te?(X=o.jsx(Sd,{children:te}),e[80]=te,e[81]=X):X=e[81];let Z;e[82]!==f?(Z=ne=>f(ne),e[82]=f,e[83]=Z):Z=e[83];let ee;e[84]===Symbol.for("react.memo_cache_sentinel")?(ee=Object.keys(Lv),e[84]=ee):ee=e[84];let se;e[85]!==m?(se=ee.map(ne=>o.jsx(Bo,{value:ne,children:m(Lv[ne])},ne)),e[85]=m,e[86]=se):se=e[86];let J;e[87]!==c||e[88]!==Z||e[89]!==se?(J=o.jsx(Gh,{value:c,onValueChange:Z,children:se}),e[87]=c,e[88]=Z,e[89]=se,e[90]=J):J=e[90];let oe;e[91]!==X||e[92]!==J?(oe=o.jsxs(Ht,{align:"end",className:"w-44",children:[X,J]}),e[91]=X,e[92]=J,e[93]=oe):oe=e[93];let ce;e[94]!==G||e[95]!==oe?(ce=o.jsx("div",{className:"ml-auto shrink-0",children:o.jsxs(Ft,{children:[G,oe]})}),e[94]=G,e[95]=oe,e[96]=ce):ce=e[96];let he;return e[97]!==H||e[98]!==W||e[99]!==ce?(he=o.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[H,W,ce]}),e[97]=H,e[98]=W,e[99]=ce,e[100]=he):he=e[100],he}function ble(t){return o.jsxs(Bo,{value:`author:${t.email}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(mx,{count:t.count})]},`author:${t.email}`)}function vle(t){return o.jsxs(Bo,{value:`cat:${t.slug}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(mx,{count:t.count})]},`cat:${t.slug}`)}function yle(t){const e=U.c(4),{label:s,onClick:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(nn,{size:12}),e[0]=r):r=e[0];let i;return e[1]!==s||e[2]!==n?(i=o.jsx("button",{type:"button","aria-label":s,onClick:n,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:r}),e[1]=s,e[2]=n,e[3]=i):i=e[3],i}function _le(t){const e=U.c(18),{checked:s,disabled:n,onToggle:r}=t,i=ue();let a;e[0]!==r?(a=()=>r(),e[0]=r,e[1]=a):a=e[1];let l;e[2]!==s||e[3]!==i?(l=i(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=i,e[4]=l):l=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==a||e[8]!==l?(c=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Lle,children:o.jsx(il,{checked:s,disabled:n,onCheckedChange:a,"aria-label":l})})}),e[5]=s,e[6]=n,e[7]=a,e[8]=l,e[9]=c):c=e[9];let d;e[10]!==s||e[11]!==i?(d=i(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=i,e[12]=d):d=e[12];let h;e[13]!==d?(h=o.jsx(We,{side:"bottom",children:d}),e[13]=d,e[14]=h):h=e[14];let u;return e[15]!==c||e[16]!==h?(u=o.jsxs(qe,{children:[c,h]}),e[15]=c,e[16]=h,e[17]=u):u=e[17],u}function Lle(t){return t.stopPropagation()}function wle(t){const e=U.c(42),{count:s,allSelected:n,onToggleSelectAll:r,onDelete:i,onExit:a}=t,l=ue();let c;e[0]!==n||e[1]!==r?(c=o.jsx(_le,{checked:n,onToggle:r}),e[0]=n,e[1]=r,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==l?(d=l("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=l,e[5]=d):d=e[5];let h;e[6]!==d?(h=o.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=h):h=e[7];const u=s===0;let f;e[8]!==l?(f=l("sandbox.postToolbar.deleteSelectedPosts"),e[8]=l,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(rn,{size:14}),e[10]=m):m=e[10];let p;e[11]!==i||e[12]!==u||e[13]!==f?(p=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:u,onClick:i,"aria-label":f,children:m})}),e[11]=i,e[12]=u,e[13]=f,e[14]=p):p=e[14];let g;e[15]!==l?(g=l("sandbox.postToolbar.deleteSelected"),e[15]=l,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(We,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=o.jsxs(qe,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==l?(v=l("sandbox.postToolbar.exitSelection"),e[22]=l,e[23]=v):v=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(nn,{size:14}),e[24]=_):_=e[24];let L;e[25]!==a||e[26]!==v?(L=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,"aria-label":v,children:_})}),e[25]=a,e[26]=v,e[27]=L):L=e[27];let y;e[28]!==l?(y=l("sandbox.postToolbar.exitSelection"),e[28]=l,e[29]=y):y=e[29];let w;e[30]!==y?(w=o.jsx(We,{side:"bottom",children:y}),e[30]=y,e[31]=w):w=e[31];let S;e[32]!==L||e[33]!==w?(S=o.jsxs(qe,{children:[L,w]}),e[32]=L,e[33]=w,e[34]=S):S=e[34];let k;e[35]!==b||e[36]!==S?(k=o.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,S]}),e[35]=b,e[36]=S,e[37]=k):k=e[37];let j;return e[38]!==c||e[39]!==k||e[40]!==h?(j=o.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,h,k]}),e[38]=c,e[39]=k,e[40]=h,e[41]=j):j=e[41],j}function Rd(t){const e=U.c(34),{onDuplicate:s,onRename:n,onAddVariant:r,onEditSeo:i,onViewJson:a,onDelete:l}=t,c=ue();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Rr,{size:14}),e[2]=h):h=e[2];let u;e[3]!==d?(u=o.jsx(Ut,{asChild:!0,children:o.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:Sle,children:h})}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&o.jsxs(et,{onClick:n,children:[o.jsx(b9,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let m;e[8]!==s||e[9]!==c?(m=s&&o.jsxs(et,{onClick:s,children:[o.jsx(bn,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=m):m=e[10];let p;e[11]!==r||e[12]!==c?(p=r&&o.jsxs(o.Fragment,{children:[o.jsx(Dc,{}),o.jsxs(et,{onClick:r,className:"cursor-pointer text-success focus:text-success",children:[o.jsx(xg,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=r,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==i||e[15]!==a||e[16]!==c?(g=(i||a)&&o.jsxs(o.Fragment,{children:[o.jsx(Dc,{}),i&&o.jsxs(et,{onClick:i,children:[o.jsx(t8,{size:14}),c("sandbox.itemActions.editSeo")]}),a&&o.jsxs(et,{onClick:a,children:[o.jsx(rd,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=i,e[15]=a,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Dc,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(rn,{size:14}),e[19]=b):b=e[19];let v;e[20]!==c?(v=c("sandbox.itemActions.delete"),e[20]=c,e[21]=v):v=e[21];let _;e[22]!==l||e[23]!==v?(_=o.jsxs(et,{onClick:l,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=l,e[23]=v,e[24]=_):_=e[24];let L;e[25]!==_||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(L=o.jsxs(Ht,{align:"end",className:"w-44",children:[f,m,p,g,x,_]}),e[25]=_,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=L):L=e[30];let y;return e[31]!==L||e[32]!==u?(y=o.jsxs(Ft,{children:[u,L]}),e[31]=L,e[32]=u,e[33]=y):y=e[33],y}function Sle(t){return t.stopPropagation()}function kle(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function jle(t){const e=new Map;for(const s of t){const n=kle(s.resolveType),r=e.get(n);r?r.push(s):e.set(n,[s])}return[...e.entries()].map(([s,n])=>({label:s,sections:n})).sort((s,n)=>s.label.localeCompare(n.label))}function jv(t){const e=U.c(8),{icon:s,label:n,className:r}=t;let i;e[0]!==r?(i=le("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",r),e[0]=r,e[1]=i):i=e[1];let a;e[2]!==s?(a=o.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==n||e[5]!==i||e[6]!==a?(l=o.jsxs("div",{className:i,children:[a,n]}),e[4]=n,e[5]=i,e[6]=a,e[7]=l):l=e[7],l}const Cv=P.lazy(()=>Ks(()=>import("./app-editor-ueQwisxj.js"),__vite__mapDeps([169,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,41,72,73,29,80,30,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,74,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.AppEditor}))),Cle=P.lazy(()=>Ks(()=>import("./post-editor-CcXinFIi.js"),__vite__mapDeps([170,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,31,56,30,32,33,34,35,36,37,38,39,40,29,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,74,78,171,133,140,105,106,136,118,79,128,172,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,107,108,109,110,111,112,113,114,115,173,174,116,117,73,119,120,121,122,123,124,125,126,127,129,130,131,132,134,135,75,137,138,139,141,142,143,144,145,146,147,148,149,150,72,151,152,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.PostEditor}))),Nle=P.lazy(()=>Ks(()=>import("./record-editor-CQ7QMoAf.js"),__vite__mapDeps([175,1,2,74,78,73,25,29,128,173,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,174,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,72,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.RecordEditor}))),Vle=P.lazy(()=>Ks(()=>import("./category-editor-DrNCa6L7.js"),__vite__mapDeps([176,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,36,38,56,30,31,32,33,34,35,37,39,40,29,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,149,74,78,172,105,106,136,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,107,108,109,110,111,112,113,114,115,173,174,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,137,138,139,140,141,142,143,144,145,146,147,148,150,72,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.CategoryEditor}))),Tle=P.lazy(()=>Ks(()=>import("./bulk-category-panel-B8uZmKXZ.js"),__vite__mapDeps([177,1,2,38,78,178,43,73,25,29])).then(t=>({default:t.BulkCategoryPanel}))),Ple=P.lazy(()=>Ks(()=>import("./sections-editor-BsuMEuNO.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SectionsEditor}))),Ale=P.lazy(()=>Ks(()=>import("./seo-editor-CSFxllkC.js"),__vite__mapDeps([179,1,2,41,30,31,32,33,34,35,36,37,38,39,40,25,29,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,77,78,79,76,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,74,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SeoEditor}))),Ele=P.lazy(()=>Ks(()=>import("./variant-calendar-TLlf4rAo.js"),__vite__mapDeps([180,1,2,30,31,32,33,34,35,36,37,38,39,40,25,29,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,78,72,73,79,181,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,74,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.VariantCalendar}))),Rle=P.lazy(()=>Ks(()=>import("./post-calendar-B4Z9Jz7b.js"),__vite__mapDeps([182,1,2,31,30,32,33,34,35,36,37,38,39,40,25,29,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,183,72,73,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,74,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.PostCalendar}))),Dle=P.lazy(()=>Ks(()=>import("./redirect-editor-B68PccpU.js"),__vite__mapDeps([184,1,2,140,25,74,78,73,29,174,33,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,81,30,31,32,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,141,142,143,144,145,146,147,148,149,150,72,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.RedirectEditor})));function Mle(t){const e=U.c(20),{deepLinkPage:s}=t,n=lo(),{currentBranch:r}=an(),{org:i}=Fe(),a=n?.entity?.id??null,l=mr(),c=ca(),{runtime:d,previewServerUrl:h}=_n(a),u=d==="cms";let f;e[0]!==u||e[1]!==c.previewState||e[2]!==l.lifecycle.phase?(f=Woe({fastPreviewActive:u,previewState:c.previewState,lifecyclePhase:l.lifecycle.phase}),e[0]=u,e[1]=c.previewState,e[2]=l.lifecycle.phase,e[3]=f):f=e[3];const m=f;if(m.kind==="sandbox-card"){const x=`/${i.slug}/settings/connections`;let b;return e[4]!==m.state||e[5]!==c.start||e[6]!==x||e[7]!==l.lifecycle||e[8]!==l.phase?(b=o.jsx(Hoe,{state:m.state,claimPhase:l.phase,lifecycle:l.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=m.state,e[5]=c.start,e[6]=x,e[7]=l.lifecycle,e[8]=l.phase,e[9]=b):b=e[9],b}if(!a||!r){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Oo,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const p=u?h:c.previewUrl;let g;return e[11]!==r||e[12]!==s||e[13]!==m.devServerReady||e[14]!==m.sandboxWarming||e[15]!==c.previewUrl||e[16]!==i.slug||e[17]!==p||e[18]!==a?(g=o.jsx(Ole,{orgSlug:i.slug,virtualMcpId:a,branch:r,previewUrl:c.previewUrl,sitePreviewUrl:p,deepLinkPage:s,devServerReady:m.devServerReady,sandboxWarming:m.sandboxWarming}),e[11]=r,e[12]=s,e[13]=m.devServerReady,e[14]=m.sandboxWarming,e[15]=c.previewUrl,e[16]=i.slug,e[17]=p,e[18]=a,e[19]=g):g=e[19],g}const Nv=2e3,Ile=15;function Vv(t,e,s,n){return typeof e!="string"||s&&(rj(e,s,n)||t.state.dataUpdateCount>=Ile)?!1:Nv}function Ole({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:r,deepLinkPage:i,devServerReady:a,sandboxWarming:l}){const c=ue(),d=ws()?.taskId??null,h={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:u,isLoading:f}=B9(h,{fetchEnabled:a}),[m,p]=P.useState("pages"),[g,x]=P.useState(null),[b,v]=P.useState(null),_=!!(i?.pageId||i?.path||i?.pathTemplate),[L,y]=P.useState(!1);if(_&&!L&&g===null&&u){y(!0);const fe=eee(bf(u),i??{});fe&&(p("pages"),x({collection:"pages",key:fe.key,path:fe.path}))}const[w,S]=P.useState(""),[k,j]=P.useState(null),[N,V]=P.useState(null),[C,T]=P.useState(null),[A,R]=P.useState("date-desc"),[E,I]=P.useState(()=>new Set),[D,O]=P.useState(null),$=()=>{I(new Set),O(null)},M=fe=>{x(fe),v(null)},[z,F]=P.useState(m);z!==m&&(F(m),S(""),j(null),V(null),T(null),R("date-desc"),I(new Set),O(null));const{data:B,isLoading:H,isFetching:W}=z3(h,{fetchEnabled:a,refetchInterval:fe=>{const Me=fe.state.data;if(m==="apps"&&g&&g.collection==="apps"){const He=u?.[g.key];return Vv(fe,typeof He?.__resolveType=="string"?He.__resolveType:void 0,Me)}if(m==="site"&&u){const He=Me?Sp(u,Me):null,Je=u.site,Ze=He?.resolveType??(typeof Je?.__resolveType=="string"?Je.__resolveType:void 0);return Vv(fe,Ze,Me,["seo"])}return!1}}),K=(fe,Me)=>!rj(fe,B,Me)&&(H||W),{catalog:q,isLoading:G}=Foe(B??void 0,u??void 0,{enabled:m==="apps"}),te=Aae({orgSlug:t,virtualMcpId:e,branch:s,meta:B}),X=w0(h),Z=Eoe(h),[ee,se]=P.useState(null),[J,oe]=P.useState(),[ce,he]=P.useState(!1),[ne,Q]=P.useState(),[de,ae]=P.useState(null),[re,ie]=P.useState(null),[Y,pe]=P.useState(null),be=!u||!B;if(f||H||be&&l)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(nt,{className:"size-5 text-muted-foreground"})});if(be)return o.jsx(Oo,{title:"Could not load site data."});const _e=bf(u).sort((fe,Me)=>fe.name.localeCompare(Me.name)),Le=jS(u).sort((fe,Me)=>fe.from.localeCompare(Me.from)),ke=B3(u,B),Ve=m==="sections"?WZ(B):[],Pe=Sp(u,B),xe=cj(u),Ne=ux.some(fe=>xe[fe].length>0),je=pu(m)?xe[m]:[],we=(Ne?Ou(u,"categories"):[]).map(({key:fe,payload:Me})=>{const He=typeof Me.slug=="string"?Me.slug:"",Je=typeof Me.name=="string"?Me.name:"";return{slug:He||fe,name:Je||He||fe}}).filter(fe=>fe.slug).sort((fe,Me)=>fe.name.localeCompare(Me.name)),Ce=m==="posts"&&(E.size>0||D!==null),Oe=Ce?fj(u).filter(fe=>E.has(fe.key)):[],rt=Eb(B,"loaders"),Ge=Eb(B,"actions");if(!VS(u,B)&&!Ne&&rt===0&&Ge===0)return o.jsx(Oo,{icon:vn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const Vt={pages:_e.length,sections:ke.length,apps:q.length,loaders:rt,actions:Ge,redirects:Le.length,posts:xe.posts.length,authors:xe.authors.length,categories:xe.categories.length},lt=new Set(_e.map(fe=>Fo(fe.path))),tt=new Set(_e.map(fe=>fe.name)),ft=new Set(ke.map(fe=>fe.name)),Lt=async fe=>{const Me=u[fe.key];if(!Me)return;const He=zS(u,fe.key),Je=FS(u,fe.key,Math.max(0,He-1)),Ze=$ee(Me.sections,Je);if(Ze)try{await X.mutateAsync({blockKey:fe.key,data:{...Me,sections:Ze}}),ye.success(`Variant added to "${fe.name}"`),x({collection:"pages",key:fe.key,path:fe.path})}catch(wt){ye.error(wt instanceof Error?wt.message:"Could not add variant")}},mt=()=>{oe(void 0),se({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},Qe=fe=>{oe(void 0),se({mode:"duplicate",sourceKey:fe.key,initialName:uv(tt,fe.name),initialPath:qoe(lt,fe.path)})},st=fe=>{oe(void 0),se({mode:"rename",sourceKey:fe.key,initialName:fe.name,initialPath:fe.path})},gt=async fe=>{if(!ee)return;const{mode:Me,sourceKey:He}=ee;try{if(Me==="create"){let Je;if(fe.templateKey){const wt=u[fe.templateKey];if(!wt)throw new Error("Selected template no longer exists.");Je={...wt,name:fe.name,path:fe.path}}else Je=Qoe(fe.name,fe.path);const Ze=Joe(u,fe.name);await X.mutateAsync({blockKey:Ze,data:Je}),ye.success(`Created "${fe.name}"`),x({collection:"pages",key:Ze,path:fe.path})}else if(Me==="duplicate"&&He){const Je=u[He];if(!Je)throw new Error("Source page not found");const{key:Ze,data:wt}=Yoe({source:Je,pages:_e,newName:fe.name,newPath:fe.path});await X.mutateAsync({blockKey:Ze,data:wt}),ye.success(`Duplicated as "${fe.name}"`),x({collection:"pages",key:Ze,path:fe.path})}else if(Me==="rename"&&He){const Je=u[He];if(!Je)throw new Error("Page not found");const Ze={...Je,name:fe.name,path:fe.path};await X.mutateAsync({blockKey:He,data:Ze}),ye.success("Page updated"),g?.collection==="pages"&&g.key===He&&x({collection:"pages",key:He,path:fe.path})}se(null)}catch(Je){oe(Je instanceof Error?Je.message:"Save failed")}},ge=({path:fe})=>{if(!ee)return null;const Me=Fo(fe);return(ee.mode==="rename"?Fo(ee.initialPath):null)!==Me&&lt.has(Me)?`A page with path "${fe}" already exists.`:null},Ee=async(fe,Me,He)=>{await X.mutateAsync({blockKey:Me,data:{...He,name:Me,__resolveType:fe}}),ye.success(c("sandbox.contentBrowser.createdSection",{name:Me})),x({collection:"sections",key:Me})},De=Q3((fe,Me)=>X.mutate({blockKey:fe,data:Me})),dt=async fe=>{const Me=u[fe.key];if(!Me){ye.error(c("sandbox.contentBrowser.sectionNotFound"));return}const He=Goe(u,fe.key),Je=uv(ft,fe.name),Ze={...Me,name:Je};try{await X.mutateAsync({blockKey:He,data:Ze}),ye.success(c("sandbox.contentBrowser.duplicatedSection",{name:fe.name})),x({collection:"sections",key:He})}catch(wt){ye.error(wt instanceof Error?wt.message:c("sandbox.contentBrowser.duplicateFailed"))}},ht=async fe=>{if(!de)return;const Me=u[de];if(!Me){ye.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await X.mutateAsync({blockKey:de,data:{...Me,name:fe}}),ye.success(c("sandbox.contentBrowser.sectionRenamed")),ae(null)}catch(He){ye.error(He instanceof Error?He.message:c("sandbox.contentBrowser.renameFailed"))}},ut=()=>{Q(void 0),he(!0)},ct=async fe=>{const Me=ZZ(u,fe.from),He=QZ(fe);try{await X.mutateAsync({blockKey:Me,data:He}),ye.success("Created redirect"),he(!1),x({collection:"redirects",key:Me})}catch(Je){Q(Je instanceof Error?Je.message:"Could not create redirect")}},it=async fe=>{const Me=nm(u,fe),He=Sc(Me,fe,mj(fe));try{await X.mutateAsync({blockKey:Me,data:He}),ye.success(`Created ${mu[fe]}`),x({collection:fe,key:Me})}catch(Je){ye.error(Je instanceof Error?Je.message:"Could not create")}},Ue=async fe=>{const Me=nm(u,"posts"),He=Sc(Me,"posts",wae(fe));try{await X.mutateAsync({blockKey:Me,data:He}),ye.success(c("sandbox.postCalendar.createdScheduledPost")),p("posts"),F("posts"),x({collection:"posts",key:Me}),v(null)}catch(Je){ye.error(Je instanceof Error?Je.message:c("sandbox.postCalendar.couldNotCreate"))}},_t=async(fe,Me)=>{const He=u[fe],Je=He?kae(Yd(He,"posts"),Me):null;if(!Je){ye.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await X.mutateAsync({blockKey:fe,data:Sc(fe,"posts",Je)})}catch(Ze){ye.error(Ze instanceof Error?Ze.message:c("sandbox.postCalendar.couldNotReschedule"))}},St=async fe=>{const Me=u[fe.key];if(!Me){ye.error("Record not found.");return}const He=nm(u,fe.kind),Je=fe.kind==="posts"?"title":"name",Ze={...structuredClone(Yd(Me,fe.kind)),[Je]:`${fe.label} (copy)`};try{await X.mutateAsync({blockKey:He,data:Sc(He,fe.kind,Ze)}),ye.success(`Duplicated "${fe.label}"`),x({collection:fe.kind,key:He})}catch(wt){ye.error(wt instanceof Error?wt.message:"Duplicate failed")}},Mt=fe=>{I(Me=>{const He=new Set(Me);return He.has(fe)?He.delete(fe):He.add(fe),He})},Pt=fe=>{p("posts"),F("posts"),x(null),v(null),S(""),j(null),V(null),T(null),R("date-desc"),I(new Set),O(fe||null)},Ie=async(fe,Me)=>{const He=[...E];let Je=0;for(const Ze of He){const wt=u[Ze],Ws=Yd(wt,"posts"),pt=fe==="add"?fae(Ws,Me):mae(Ws,Me);pt!==Ws&&(await X.mutateAsync({blockKey:Ze,data:Sc(Ze,"posts",mv(pt))}),Je+=1)}return Je},xt=async(fe,Me)=>{const He=E.size;try{const Je=await Ie(fe,Me),Ze=fe==="add"?"Added to":"Moved",wt=He-Je;ye.success(`${Ze} ${Je} ${Je===1?"post":"posts"}`+(wt>0?` (${wt} already set)`:"")),$()}catch(Je){ye.error(Je instanceof Error?Je.message:"Bulk update failed")}},Se=async()=>{if(re)try{if(re.kind==="blog-bulk"){for(const Je of re.keys)await Z.mutateAsync({blockKey:Je});ye.success(`Deleted ${re.count} ${re.count===1?"post":"posts"}`),g&&g.collection!=="available-section"&&re.keys.includes(g.key)&&x(null),$(),ie(null);return}const{kind:fe,key:Me,label:He}=re;if(fe==="blog"){if(re.blogKind==="categories"){const Je=Yd(u[Me],"categories").slug,Ze=typeof Je=="string"?Je:"";if(Ze)for(const{key:wt,payload:Ws}of Ou(u,"posts")){const pt=pae(Ws,Ze);pt!==Ws&&await X.mutateAsync({blockKey:wt,data:Sc(wt,"posts",mv(pt))})}}await Z.mutateAsync({blockKey:Me})}else await Z.mutateAsync({blockKey:Me});ye.success(`Deleted "${He}"`),g&&g.collection!=="available-section"&&g.key===Me&&x(null),ie(null)}catch(fe){ye.error(fe instanceof Error?fe.message:"Delete failed")}},ze=Z.isPending||X.isPending,ot=re?.kind==="blog"?mu[re.blogKind]:re?.kind==="blog-bulk"?`${re.count} ${re.count===1?"post":"posts"}`:re?.kind??"item";return o.jsxs("div",{className:"flex h-full w-full",children:[o.jsx(Uoe,{active:m,counts:Vt,showBlog:Ne,onSelect:fe=>{p(fe),x(null),v(null)}}),m!=="seo"&&m!=="site"&&m!=="calendar"&&m!=="post-schedule"&&m!=="loaders"&&m!=="actions"&&o.jsx($le,{activeCollection:m,pages:_e,redirects:Le,sections:ke,availableSections:Ve,appCatalog:q,appCatalogLoading:G,blogEntries:je,decofile:u,searchQuery:w,onSearchChange:S,postCategoryFilter:k,postAuthorFilter:N,postStatusFilter:C,postSort:A,onPostCategoryFilterChange:fe=>{j(fe),I(new Set)},onPostAuthorFilterChange:fe=>{V(fe),I(new Set)},onPostStatusFilterChange:fe=>{T(fe),I(new Set)},onPostSortChange:R,selectedPostKeys:E,postBulkPanelOpen:Ce,onTogglePostSelect:Mt,onSelectAllPosts:fe=>I(new Set(fe)),onClearPostSelection:()=>I(new Set),onExitPostSelection:$,onBulkDeletePosts:()=>ie({kind:"blog-bulk",keys:[...E],count:E.size}),selection:g,onSelect:M,onCreate:()=>{m==="pages"?mt():m==="redirects"?ut():pu(m)&&it(m)},onDuplicatePage:Qe,onRenamePage:st,onAddPageVariant:Lt,onDeletePage:fe=>ie({kind:"page",key:fe.key,label:fe.name}),onEditPageSeo:fe=>{const Me={collection:"pages",key:fe.key,path:fe.path};x(Me),v(fe.key)},onViewPageJson:fe=>pe(fe.key),onDuplicateSection:dt,onRenameSection:fe=>ae(fe.key),onDeleteSection:fe=>ie({kind:"section",key:fe.key,label:fe.name}),onDeleteRedirect:fe=>ie({kind:"redirect",key:fe.key,label:fe.from||fe.key}),onDuplicateBlog:St,onDeleteBlog:fe=>ie({kind:"blog",blogKind:fe.kind,key:fe.key,label:fe.label})}),o.jsx("div",{className:"flex-1 min-w-0",children:m==="loaders"||m==="actions"?o.jsx($ae,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:B,decofile:u,kind:m}):o.jsx(P.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(nt,{className:"size-5 text-muted-foreground"})}),children:m==="calendar"?o.jsx(Ele,{decofile:u}):m==="post-schedule"?o.jsx(Rle,{decofile:u,support:te,isCreating:X.isPending,onCreate:fe=>{Ue(fe)},onReschedule:(fe,Me)=>{_t(fe,Me)},onSelect:fe=>{p("posts"),F("posts"),x({collection:"posts",key:fe}),v(null)}}):m==="site"?Pe?o.jsx(Cv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:Pe.key,block:u[Pe.key],decofile:u,meta:B,title:"Site",excludeFields:["seo"],schemaPending:K(Pe.resolveType,["seo"]),previewBaseUrl:n},`site:${Pe.key}`):o.jsx(Oo,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):m==="seo"?o.jsx(Ale,{orgSlug:t,virtualMcpId:e,branch:s,decofile:u,meta:B,target:{kind:"site"},previewBaseUrl:r}):m==="sections"?o.jsx(ple,{selection:g?.collection==="sections"||g?.collection==="available-section"?g:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:B,decofile:u,isCreating:X.isPending,onCreateAvailable:Ee,onSaveReferencedBlock:De}):Ce?o.jsx(Tle,{posts:Oe,categories:we,initialSlug:D,isPending:X.isPending,onApply:(fe,Me)=>{xt(fe,Me)},onClose:$},D??"selection"):g&&g.collection!=="available-section"?g.collection==="apps"?o.jsx(Cv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key],decofile:u,meta:B,previewBaseUrl:n,schemaPending:K(typeof u[g.key]?.__resolveType=="string"?String(u[g.key].__resolveType):void 0)},`app:${g.key}`):g.collection==="posts"?o.jsx(Cle,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key],decofile:u,meta:B,previewBaseUrl:r},`post:${g.key}`):g.collection==="categories"?o.jsx(Vle,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key],decofile:u,meta:B,onManagePosts:Pt,onOpenPost:fe=>{p("posts"),F("posts"),x({collection:"posts",key:fe}),v(null)},previewBaseUrl:r},`category:${g.key}`):g.collection==="authors"?o.jsx(Nle,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:g.key,block:u[g.key]},`authors:${g.key}`):g.collection==="redirects"?o.jsx(Dle,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key]},`redirect:${g.key}`):o.jsx(Ple,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:g.collection==="pages"?g.path:"/",activePageBlockKey:g.collection==="pages"?g.key:null,activeGlobalBlockKey:g.collection==="sections"?g.key:null,initialEditSeo:g.collection==="pages"&&b===g.key,onExitSeo:()=>v(null)},g.collection==="pages"?`page:${g.key}`:`section:${g.key}`):o.jsx(Oo,{title:`Select ${pu(m)?`a ${mu[m]}`:m==="pages"?"a page":m==="apps"?"an app":m==="redirects"?"a redirect":"a section"} to edit`,description:m==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),ee&&o.jsx(sae,{open:!!ee,mode:ee.mode,initialName:ee.initialName,initialPath:ee.initialPath,isPending:X.isPending,error:J,templates:_e,validate:ge,onSubmit:gt,onOpenChange:fe=>{fe||(se(null),oe(void 0))}}),o.jsx(rae,{open:ce,isPending:X.isPending,error:ne,onSubmit:ct,onOpenChange:fe=>{fe||(he(!1),Q(void 0))}}),de&&o.jsx(iae,{open:!!de,blockKey:de,initialName:ke.find(fe=>fe.key===de)?.name??de,isPending:X.isPending,onSubmit:ht,onOpenChange:fe=>{fe||ae(null)}}),Y&&o.jsx(Eae,{open:!!Y,onOpenChange:fe=>{fe||pe(null)},pageKey:Y,decofile:u,onSave:fe=>X.mutateAsync({blockKey:Y,data:fe})}),o.jsx(Wi,{open:!!re,onOpenChange:fe=>{!fe&&!ze&&ie(null)},children:o.jsxs(qi,{children:[o.jsxs(Gi,{children:[o.jsx(Yi,{children:`Delete ${ot}?`}),o.jsx(Qi,{children:re?.kind==="section"?`"${re.label}" will be removed. Pages that still reference it will lose this section.`:re?.kind==="blog-bulk"?`${re.count} ${re.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:re?`"${re.label}" will be removed permanently. This can't be undone.`:null})]}),o.jsxs(Xi,{children:[o.jsx(Ji,{disabled:ze,children:"Cancel"}),o.jsx(Zi,{onClick:fe=>{fe.preventDefault(),Se()},disabled:ze,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ze?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function $le(t){const e=U.c(82),{activeCollection:s,pages:n,redirects:r,sections:i,availableSections:a,appCatalog:l,appCatalogLoading:c,blogEntries:d,decofile:h,searchQuery:u,onSearchChange:f,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostStatusFilterChange:_,onPostSortChange:L,selectedPostKeys:y,postBulkPanelOpen:w,onTogglePostSelect:S,onSelectAllPosts:k,onClearPostSelection:j,onExitPostSelection:N,onBulkDeletePosts:V,selection:C,onSelect:T,onCreate:A,onDuplicatePage:R,onRenamePage:E,onAddPageVariant:I,onDeletePage:D,onEditPageSeo:O,onViewPageJson:$,onDuplicateSection:M,onRenameSection:z,onDeleteSection:F,onDeleteRedirect:B,onDuplicateBlog:H,onDeleteBlog:W}=t;let K,q,G,te,X,Z,ee;if(e[0]!==s||e[1]!==l||e[2]!==c||e[3]!==a||e[4]!==d||e[5]!==h||e[6]!==I||e[7]!==V||e[8]!==j||e[9]!==A||e[10]!==W||e[11]!==D||e[12]!==B||e[13]!==F||e[14]!==H||e[15]!==R||e[16]!==M||e[17]!==O||e[18]!==N||e[19]!==v||e[20]!==b||e[21]!==L||e[22]!==_||e[23]!==E||e[24]!==z||e[25]!==f||e[26]!==T||e[27]!==k||e[28]!==S||e[29]!==$||e[30]!==n||e[31]!==p||e[32]!==w||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==r||e[37]!==u||e[38]!==i||e[39]!==y||e[40]!==C){const ce=u.toLowerCase(),he=n.filter(ge=>!ce||ge.name.toLowerCase().includes(ce)||ge.path.toLowerCase().includes(ce)),ne=r.filter(ge=>!ce||ge.from.toLowerCase().includes(ce)||ge.to.toLowerCase().includes(ce)),Q=i.filter(ge=>!ce||ge.name.toLowerCase().includes(ce)||ge.key.toLowerCase().includes(ce)||ge.resolveType.toLowerCase().includes(ce)),de=a.filter(ge=>!ce||ge.title.toLowerCase().includes(ce)||ge.resolveType.toLowerCase().includes(ce)||(ge.description?.toLowerCase().includes(ce)??!1)),ae=jle(Q),re=l.filter(ge=>!ce||ge.title.toLowerCase().includes(ce)||ge.app.toLowerCase().includes(ce)||ge.vendor.toLowerCase().includes(ce)||ge.category.toLowerCase().includes(ce)),ie=d.filter(ge=>!ce||ge.label.toLowerCase().includes(ce)||ge.subtitle.toLowerCase().includes(ce)),Y=s==="posts",pe=Ule,be=Y?fj(h):[],_e=new Map,Le=new Map,ke={published:0,scheduled:0,draft:0};for(const ge of be)ke[ge.status]=ke[ge.status]+1;for(const ge of be){for(const Ee of ge.categorySlugs)_e.set(Ee,(_e.get(Ee)??0)+1);for(const Ee of ge.authorEmails)Le.set(Ee,(Le.get(Ee)??0)+1)}const Ve=(Y?Ou(h,"categories"):[]).map(ge=>{const{key:Ee,payload:De}=ge,dt=pe(De.slug)||Ee;return{slug:dt,name:pe(De.name)||pe(De.slug)||Ee,count:_e.get(dt)??0}}).filter(Fle),Pe=(Y?Ou(h,"authors"):[]).map(ge=>{const{key:Ee,payload:De}=ge,dt=pe(De.email);return{email:dt,name:pe(De.name)||pe(De.email)||Ee,count:Le.get(dt)??0}}).filter(zle);let xe;e[48]!==m?(xe=ge=>!m||ge.categorySlugs.includes(m),e[48]=m,e[49]=xe):xe=e[49];let Ne;e[50]!==p?(Ne=ge=>!p||ge.authorEmails.includes(p),e[50]=p,e[51]=Ne):Ne=e[51];let je;e[52]!==g?(je=ge=>!g||ge.status===g,e[52]=g,e[53]=je):je=e[53];let we;e[54]!==x?(we=(ge,Ee)=>{if(x==="az")return ge.title.localeCompare(Ee.title);if(x==="za")return Ee.title.localeCompare(ge.title);const De=ge.date.localeCompare(Ee.date);return x==="date-asc"?De:-De},e[54]=x,e[55]=we):we=e[55];const Ce=be.filter(ge=>!ce||ge.title.toLowerCase().includes(ce)||ge.slug.toLowerCase().includes(ce)).filter(xe).filter(Ne).filter(je).sort(we),Oe=y.size,rt=Ce.map(Ble),Ge=rt.length>0&&rt.every(ge=>y.has(ge)),Vt=Oe>0||w,lt=()=>{Ge?j():k(rt)},tt=`Search ${s}…`,ft=pu(s)?`Create new ${mu[s]}`:s==="redirects"?"Create new redirect":"Create new page",Lt=s!=="apps"&&s!=="sections";X="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let mt;e[56]===Symbol.for("react.memo_cache_sentinel")?(mt=o.jsx(r0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=mt):mt=e[56];let Qe;e[57]!==f?(Qe=ge=>f(ge.target.value),e[57]=f,e[58]=Qe):Qe=e[58];let st;e[59]!==tt||e[60]!==u||e[61]!==Qe?(st=o.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[mt,o.jsx("input",{type:"text",value:u,onChange:Qe,placeholder:tt,"aria-label":tt,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=tt,e[60]=u,e[61]=Qe,e[62]=st):st=e[62];let gt;e[63]!==ft||e[64]!==A||e[65]!==Lt?(gt=Lt&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",onClick:A,"aria-label":ft,children:o.jsx(Qt,{size:14})})}),o.jsx(We,{side:"bottom",children:ft})]}),e[63]=ft,e[64]=A,e[65]=Lt,e[66]=gt):gt=e[66],e[67]!==st||e[68]!==gt?(Z=o.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[st,gt]}),e[67]=st,e[68]=gt,e[69]=Z):Z=e[69],ee=Y&&(Vt?o.jsx(wle,{count:Oe,allSelected:Ge,onToggleSelectAll:lt,onDelete:V,onExit:N}):o.jsx(xle,{categories:Ve,authors:Pe,categoryFilter:m,statusCounts:ke,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onStatusFilterChange:_,onSortChange:L})),K=rl,te="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",q="flex flex-col gap-1 p-1.5",G=s==="pages"?he.length===0?o.jsx(wc,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):he.map(ge=>{const Ee=C?.collection==="pages"&&C.key===ge.key,De=zS(h,ge.key);return o.jsx(kr,{icon:zi,title:ge.name,subtitle:ge.path,active:Ee,variantCount:De,onClick:()=>T({collection:"pages",key:ge.key,path:ge.path}),menu:o.jsx(Rd,{onDuplicate:()=>R(ge),onRename:()=>E(ge),onAddVariant:()=>I(ge),onEditSeo:()=>O(ge),onViewJson:()=>$(ge),onDelete:()=>D(ge)})},ge.key)}):s==="sections"?Q.length===0&&de.length===0?o.jsx(wc,{hasItems:i.length>0||a.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):o.jsxs(o.Fragment,{children:[ae.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(jv,{icon:Ki,label:"Saved sections"}),ae.map(ge=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:ge.label}),ge.sections.map(Ee=>{const De=C?.collection==="sections"&&C.key===Ee.key;return o.jsx(kr,{icon:Ki,accent:"global",title:Ee.name,subtitle:ge.label,active:De,onClick:()=>T({collection:"sections",key:Ee.key}),menu:o.jsx(Rd,{onDuplicate:()=>M(Ee),onRename:()=>z(Ee),onDelete:()=>F(Ee)})},Ee.key)})]},ge.label))]}),de.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(jv,{icon:zi,label:"Available sections",className:le(ae.length>0&&"mt-3")}),de.map(ge=>{const Ee=C?.collection==="available-section"&&C.resolveType===ge.resolveType,De=ge.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return o.jsx(kr,{icon:zi,title:ge.title,subtitle:De??ge.resolveType,active:Ee,onClick:()=>T({collection:"available-section",resolveType:ge.resolveType,title:ge.title})},ge.resolveType)})]})]}):s==="apps"?c?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(nt,{className:"size-4.5 text-muted-foreground"})}):re.length===0?o.jsx(wc,{hasItems:l.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):re.map(ge=>{const Ee=C?.collection==="apps"&&ge.blockKey!==null&&C.key===ge.blockKey;return o.jsx(kr,{icon:f8,logoUrl:ge.logo,title:ge.title,subtitle:ge.category,active:Ee,trailing:ge.installed?o.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!ge.installed||!ge.blockKey){ye.message(`${ge.title} is not installed on this site.`);return}T({collection:"apps",key:ge.blockKey})}},ge.id)}):s==="redirects"?ne.length===0?o.jsx(wc,{hasItems:r.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):ne.map(ge=>o.jsx(kr,{icon:e8,title:ge.from||"(no source)",subtitle:`→ ${ge.to||"(no target)"}`,active:C?.collection==="redirects"&&C.key===ge.key,trailing:o.jsx(oae,{type:ge.type}),onClick:()=>T({collection:"redirects",key:ge.key}),menu:o.jsx(Rd,{onDelete:()=>B(ge)})},ge.key)):Y?Ce.length===0?o.jsx(wc,{hasItems:be.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):Ce.map(ge=>{const Ee={key:ge.key,kind:"posts",label:ge.title,subtitle:ge.slug};return o.jsx(kr,{icon:Mr,title:ge.title,subtitle:ge.slug||"no slug",invalid:ge.missing.length>0,invalidReason:`Missing: ${ge.missing.join(", ")}`,active:C?.collection==="posts"&&C.key===ge.key,selectable:!0,selectionActive:Vt,selected:y.has(ge.key),onToggleSelect:()=>S(ge.key),onClick:()=>Vt?S(ge.key):T({collection:"posts",key:ge.key}),menu:o.jsx(Rd,{onDuplicate:()=>H(Ee),onDelete:()=>W(Ee)})},ge.key)}):ie.length===0?o.jsx(wc,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${pu(s)?mu[s]:"item"}.`}):ie.map(ge=>{const Ee=C?.collection===ge.kind&&C.key===ge.key;return o.jsx(kr,{icon:ge.kind==="posts"?Mr:ge.kind==="authors"?g9:G2,title:ge.label,subtitle:ge.subtitle,active:Ee,onClick:()=>T({collection:ge.kind,key:ge.key}),menu:o.jsx(Rd,{onDuplicate:()=>H(ge),onDelete:()=>W(ge)})},ge.key)}),e[0]=s,e[1]=l,e[2]=c,e[3]=a,e[4]=d,e[5]=h,e[6]=I,e[7]=V,e[8]=j,e[9]=A,e[10]=W,e[11]=D,e[12]=B,e[13]=F,e[14]=H,e[15]=R,e[16]=M,e[17]=O,e[18]=N,e[19]=v,e[20]=b,e[21]=L,e[22]=_,e[23]=E,e[24]=z,e[25]=f,e[26]=T,e[27]=k,e[28]=S,e[29]=$,e[30]=n,e[31]=p,e[32]=w,e[33]=m,e[34]=x,e[35]=g,e[36]=r,e[37]=u,e[38]=i,e[39]=y,e[40]=C,e[41]=K,e[42]=q,e[43]=G,e[44]=te,e[45]=X,e[46]=Z,e[47]=ee}else K=e[41],q=e[42],G=e[43],te=e[44],X=e[45],Z=e[46],ee=e[47];let se;e[70]!==q||e[71]!==G?(se=o.jsx("div",{className:q,children:G}),e[70]=q,e[71]=G,e[72]=se):se=e[72];let J;e[73]!==K||e[74]!==te||e[75]!==se?(J=o.jsx(K,{className:te,children:se}),e[73]=K,e[74]=te,e[75]=se,e[76]=J):J=e[76];let oe;return e[77]!==X||e[78]!==Z||e[79]!==ee||e[80]!==J?(oe=o.jsxs("div",{className:X,children:[Z,ee,J]}),e[77]=X,e[78]=Z,e[79]=ee,e[80]=J,e[81]=oe):oe=e[81],oe}function Ble(t){return t.key}function zle(t){return t.email}function Fle(t){return t.slug}function Ule(t){return typeof t=="string"?t:""}function Hle(t){const e=U.c(25),{virtualMcpId:s}=t,n=ue(),[r,i]=P.useState(!1),a=Vs(s),{activeTask:l}=an();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},e[0]=c):c=e[0];const d=na(c);if(!(xn(a?.metadata)||xn(l?.metadata))){let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(Ir,{className:"size-7 text-foreground"})}),e[1]=f):f=e[1];let m;e[2]!==n?(m=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=m):m=e[3];let p;e[4]!==n?(p=n("mainPanelTabs.contentTab.connectGithubDescription"),e[4]=n,e[5]=p):p=e[5];let g,x;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>i(!0),x=o.jsx(Ir,{className:"size-4"}),e[6]=g,e[7]=x):(g=e[6],x=e[7]);let b;e[8]!==n?(b=n("mainPanelTabs.previewTab.connectGithub"),e[8]=n,e[9]=b):b=e[9];let v;e[10]!==b?(v=o.jsxs(me,{onClick:g,children:[x,b]}),e[10]=b,e[11]=v):v=e[11];let _;e[12]!==m||e[13]!==p||e[14]!==v?(_=o.jsx(Dr,{className:"h-full",image:f,title:m,description:p,actions:v}),e[12]=m,e[13]=p,e[14]=v,e[15]=_):_=e[15];let L;e[16]!==r?(L=o.jsx(i0,{open:r,onOpenChange:i,mode:"agent"}),e[16]=r,e[17]=L):L=e[17];let y;return e[18]!==L||e[19]!==_?(y=o.jsxs(o.Fragment,{children:[_,L]}),e[18]=L,e[19]=_,e[20]=y):y=e[20],y}let u;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(u=o.jsx(Mle,{deepLinkPage:{pageId:d.contentPageId,path:d.contentPath,pathTemplate:d.contentPathTemplate}}),e[21]=d.contentPageId,e[22]=d.contentPath,e[23]=d.contentPathTemplate,e[24]=u):u=e[24],u}function Kle(){const t=U.c(3),[e,s]=P.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=a=>{if(!a)return;const l=()=>s(a.clientWidth);l();const c=new ResizeObserver(l);return c.observe(a),()=>c.disconnect()},t[0]=n):n=t[0];const r=n;let i;return t[1]!==e?(i=[e,r],t[1]=e,t[2]=i):i=t[2],i}function Wle(t){const e=U.c(6),{virtualMcpId:s}=t,n=Vs(s),r=c7();let i;e[0]!==r||e[1]!==n?(i=o9(r,u7(n)),e[0]=r,e[1]=n,e[2]=i):i=e[2];const a=i;if(!a){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(qle,{}),e[3]=c):c=e[3],c}let l;return e[4]!==a?(l=o.jsx(Qle,{config:a}),e[4]=a,e[5]=l):l=e[5],l}function qle(){const t=U.c(12),e=ue();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:o.jsx(bg,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("assets.browser.noBucketTitle"),t[1]=e,t[2]=n):n=t[2];let r;t[3]!==n?(r=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=r):r=t[4];let i;t[5]!==e?(i=e("assets.browser.noBucketDescription"),t[5]=e,t[6]=i):i=t[6];let a;t[7]!==i?(a=o.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:i}),t[7]=i,t[8]=a):a=t[8];let l;return t[9]!==r||t[10]!==a?(l=o.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-3 p-10 text-center",children:[s,o.jsxs("div",{children:[r,a]})]}),t[9]=r,t[10]=a,t[11]=l):l=t[11],l}function Gle(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function Yle(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,r)=>s[r%e].push(n)),s}function Qle(t){const e=U.c(99),{config:s}=t,n=ue(),[r,i]=P.useState(""),a=y9(r,300);let l;e[0]!==s.id||e[1]!==a?(l={configId:s.id,search:a},e[0]=s.id,e[1]=a,e[2]=l):l=e[2];const c=Pk(l),d=G9(),[h,u]=P.useState(!1),[f,m]=P.useState(null),p=P.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(M){if(!M)return;const z=Array.from(M);if(z.length===0)return;const F=[];for(const B of z)try{await d.mutateAsync({configId:s.id,file:B})}catch(H){const W=H;F.push(`${B.name} (${W instanceof Error?W.message:"upload failed"})`)}await c.refetch(),F.length>0&&ye.error(F.length===z.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:F.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:F.join("; ")}))},e[3]=s.id,e[4]=c,e[5]=n,e[6]=d,e[7]=g):g=e[7];const x=g;let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=function(M){M.preventDefault(),u(!0)},e[8]=b):b=e[8];const v=b;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=function(){u(!1)},e[9]=_):_=e[9];const L=_;let y;e[10]!==x?(y=function(M){M.preventDefault(),M.stopPropagation(),u(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=y):y=e[11];const w=y,[S,k]=Kle();let j,N,V,C,T,A;if(e[12]!==s.name||e[13]!==a||e[14]!==k||e[15]!==S||e[16]!==x||e[17]!==h||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==w||e[22]!==r||e[23]!==n||e[24]!==d.isPending){const M=(c.data?.pages??[]).flatMap(Xle),z=Yle(M,Gle(S)),F=a.trim(),B=r!==a||c.isFetching&&!c.isFetchingNextPage;T="flex h-full min-h-0 flex-col gap-3 p-4";let H;e[31]!==n?(H=n("assets.browser.title"),e[31]=n,e[32]=H):H=e[32];let W;e[33]!==H?(W=o.jsx("h2",{className:"text-sm font-semibold",children:H}),e[33]=H,e[34]=W):W=e[34];let K;e[35]!==s.name||e[36]!==n?(K=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=K):K=e[37];let q;e[38]!==K?(q=o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:K}),e[38]=K,e[39]=q):q=e[39];let G;e[40]!==W||e[41]!==q?(G=o.jsxs("div",{className:"min-w-0",children:[W,q]}),e[40]=W,e[41]=q,e[42]=G):G=e[42];let te;e[43]===Symbol.for("react.memo_cache_sentinel")?(te=()=>p.current?.click(),e[43]=te):te=e[43];let X;e[44]!==d.isPending?(X=d.isPending?o.jsx(nt,{className:"size-3.5"}):o.jsx(Qn,{size:14}),e[44]=d.isPending,e[45]=X):X=e[45];let Z;e[46]!==n||e[47]!==d.isPending?(Z=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=Z):Z=e[48];let ee;e[49]!==X||e[50]!==Z||e[51]!==d.isPending?(ee=o.jsxs(me,{type:"button",size:"sm",disabled:d.isPending,onClick:te,children:[X,Z]}),e[49]=X,e[50]=Z,e[51]=d.isPending,e[52]=ee):ee=e[52];let se;e[53]!==x?(se=o.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:ie=>{const Y=Array.from(ie.target.files??[]);ie.target.value="",x(Y)}}),e[53]=x,e[54]=se):se=e[54],e[55]!==G||e[56]!==ee||e[57]!==se?(A=o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[G,ee,se]}),e[55]=G,e[56]=ee,e[57]=se,e[58]=A):A=e[58];let J;e[59]!==n?(J=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=J):J=e[60],e[61]!==B||e[62]!==r||e[63]!==J?(j=o.jsx(p9,{value:r,onChange:i,isSearching:B,placeholder:J,className:"shrink-0"}),e[61]=B,e[62]=r,e[63]=J,e[64]=j):j=e[64];let oe;e[65]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>p.current?.click(),e[65]=oe):oe=e[65];const ce=h&&"border-primary bg-primary/5",he=d.isPending&&"pointer-events-none opacity-60";let ne;e[66]!==ce||e[67]!==he?(ne=le("flex shrink-0 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border/60 p-4 text-center transition-colors",ce,he),e[66]=ce,e[67]=he,e[68]=ne):ne=e[68];let Q;e[69]===Symbol.for("react.memo_cache_sentinel")?(Q=o.jsx(Qn,{size:16,className:"text-muted-foreground"}),e[69]=Q):Q=e[69];let de;e[70]!==n?(de=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=de):de=e[71];let ae;e[72]!==n?(ae=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=ae):ae=e[73];let re;e[74]!==de||e[75]!==ae?(re=o.jsxs("p",{className:"text-xs text-muted-foreground",children:[de," ",ae]}),e[74]=de,e[75]=ae,e[76]=re):re=e[76],e[77]!==w||e[78]!==ne||e[79]!==re?(N=o.jsxs("button",{type:"button",onClick:oe,onDragOver:v,onDragLeave:L,onDrop:w,className:ne,children:[Q,re]}),e[77]=w,e[78]=ne,e[79]=re,e[80]=N):N=e[80],V="min-h-0 flex-1 overflow-y-auto pr-1",C=M.length===0?F?o.jsx(Tv,{title:n("filePicker.filePickerDialog.noMatches",{query:F}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):o.jsx(Tv,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):o.jsx("div",{ref:k,className:"flex items-start gap-3",children:z.map((ie,Y)=>o.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:ie.map(pe=>o.jsx(Jle,{item:pe,onDelete:()=>m(pe)},pe.key))},Y))}),e[12]=s.name,e[13]=a,e[14]=k,e[15]=S,e[16]=x,e[17]=h,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=w,e[22]=r,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=N,e[27]=V,e[28]=C,e[29]=T,e[30]=A}else j=e[25],N=e[26],V=e[27],C=e[28],T=e[29],A=e[30];let R;e[81]!==c||e[82]!==n?(R=c.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(me,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(nt,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=R):R=e[83];let E;e[84]!==R||e[85]!==V||e[86]!==C?(E=o.jsxs("div",{className:V,children:[C,R]}),e[84]=R,e[85]=V,e[86]=C,e[87]=E):E=e[87];let I;e[88]===Symbol.for("react.memo_cache_sentinel")?(I=()=>m(null),e[88]=I):I=e[88];let D;e[89]!==s.id||e[90]!==f?(D=o.jsx(tce,{configId:s.id,item:f,onClose:I}),e[89]=s.id,e[90]=f,e[91]=D):D=e[91];let O;return e[92]!==j||e[93]!==N||e[94]!==E||e[95]!==D||e[96]!==T||e[97]!==A?(O=o.jsxs("div",{className:T,children:[A,j,N,E,D]}),e[92]=j,e[93]=N,e[94]=E,e[95]=D,e[96]=T,e[97]=A,e[98]=O):O=e[98],O}function Xle(t){return t.items}function Tv(t){const e=U.c(8),{title:s,description:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(ar,{size:18,className:"text-muted-foreground"})}),e[0]=r):r=e[0];let i;e[1]!==s?(i=o.jsx("p",{className:"text-sm font-medium",children:s}),e[1]=s,e[2]=i):i=e[2];let a;e[3]!==n?(a=o.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=a):a=e[4];let l;return e[5]!==i||e[6]!==a?(l=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[r,i,a]}),e[5]=i,e[6]=a,e[7]=l):l=e[7],l}function Jle(t){const e=U.c(34),{item:s,onDelete:n}=t;let r;e[0]!==s.key?(r=Ak(s.key),e[0]=s.key,e[1]=r):r=e[1];const i=r;let a;e[2]!==s.key?(a=ix(s.key),e[2]=s.key,e[3]=a):a=e[3];const l=a;let c;e[4]!==l||e[5]!==s.key||e[6]!==s.publicUrl?(c=l?o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:Zle}):o.jsx("div",{className:"flex aspect-square items-center justify-center",children:o.jsx(Mr,{size:28,className:"text-muted-foreground"})}),e[4]=l,e[5]=s.key,e[6]=s.publicUrl,e[7]=c):c=e[7];let d;e[8]!==s.key||e[9]!==s.publicUrl||e[10]!==c?(d=o.jsx("a",{href:s.publicUrl,target:"_blank",rel:"noreferrer",title:s.key,className:"block transition hover:ring-2 hover:ring-inset hover:ring-primary",children:c}),e[8]=s.key,e[9]=s.publicUrl,e[10]=c,e[11]=d):d=e[11];const h=s.key;let u;e[12]!==s.key?(u=jf(s.key),e[12]=s.key,e[13]=u):u=e[13];let f;e[14]!==s.key||e[15]!==u?(f=o.jsx("p",{className:"truncate text-xs font-medium",title:h,children:u}),e[14]=s.key,e[15]=u,e[16]=f):f=e[16];let m;e[17]!==s.size?(m=Ek(s.size),e[17]=s.size,e[18]=m):m=e[18];let p;e[19]!==i||e[20]!==m?(p=o.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[i," · ",m]}),e[19]=i,e[20]=m,e[21]=p):p=e[21];let g;e[22]!==f||e[23]!==p?(g=o.jsxs("div",{className:"min-w-0 flex-1",children:[f,p]}),e[22]=f,e[23]=p,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=o.jsx(ece,{item:s,onDelete:n}),e[25]=s,e[26]=n,e[27]=x):x=e[27];let b;e[28]!==g||e[29]!==x?(b=o.jsxs("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background px-2 py-1.5",children:[g,x]}),e[28]=g,e[29]=x,e[30]=b):b=e[30];let v;return e[31]!==b||e[32]!==d?(v=o.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border/60 bg-muted",children:[d,b]}),e[31]=b,e[32]=d,e[33]=v):v=e[33],v}function Zle(t){t.target.style.display="none"}function ece(t){const e=U.c(36),{item:s,onDelete:n}=t,r=ue(),[i,a]=P.useState(!1);let l;e[0]!==s.publicUrl||e[1]!==r?(l=async function(){try{await navigator.clipboard.writeText(s.publicUrl),a(!0),window.setTimeout(()=>a(!1),1500)}catch{ye.error(r("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=r,e[2]=l):l=e[2];const c=l;let d;e[3]!==r?(d=r("filePicker.filePickerDialog.assetActions"),e[3]=r,e[4]=d):d=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(v9,{size:14}),e[5]=h):h=e[5];let u;e[6]!==d?(u=o.jsx(Ut,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:h})}),e[6]=d,e[7]=u):u=e[7];let f;e[8]!==i?(f=i?o.jsx($t,{size:14}):o.jsx(bn,{size:14}),e[8]=i,e[9]=f):f=e[9];let m;e[10]!==i||e[11]!==r?(m=r(i?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=i,e[11]=r,e[12]=m):m=e[12];let p;e[13]!==c||e[14]!==f||e[15]!==m?(p=o.jsxs(et,{onClick:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(fn,{size:14}),e[17]=x):x=e[17];let b;e[18]!==r?(b=r("filePicker.filePickerDialog.openInNewTab"),e[18]=r,e[19]=b):b=e[19];let v;e[20]!==s.publicUrl||e[21]!==b?(v=o.jsx(et,{asChild:!0,children:o.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=v):v=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(rn,{size:14}),e[23]=_):_=e[23];let L;e[24]!==r?(L=r("assets.browser.deleteAction"),e[24]=r,e[25]=L):L=e[25];let y;e[26]!==n||e[27]!==L?(y=o.jsxs(et,{variant:"destructive",onClick:n,children:[_,L]}),e[26]=n,e[27]=L,e[28]=y):y=e[28];let w;e[29]!==v||e[30]!==y||e[31]!==p?(w=o.jsxs(Ht,{align:"end",children:[p,v,y]}),e[29]=v,e[30]=y,e[31]=p,e[32]=w):w=e[32];let S;return e[33]!==w||e[34]!==u?(S=o.jsxs(Ft,{children:[u,w]}),e[33]=w,e[34]=u,e[35]=S):S=e[35],S}function tce(t){const e=U.c(47),{configId:s,item:n,onClose:r}=t,i=ue(),a=ire();let l;e[0]!==s||e[1]!==a||e[2]!==n||e[3]!==r||e[4]!==i?(l=async function(){if(n)try{await a.mutateAsync({configId:s,key:n.key}),ye.success(i("assets.browser.deleted")),r()}catch{ye.error(i("assets.browser.deleteFailed"))}},e[0]=s,e[1]=a,e[2]=n,e[3]=r,e[4]=i,e[5]=l):l=e[5];const c=l,d=!!n;let h;e[6]!==r?(h=C=>!C&&r(),e[6]=r,e[7]=h):h=e[7];let u;e[8]!==i?(u=i("assets.browser.deleteConfirmTitle"),e[8]=i,e[9]=u):u=e[9];let f;e[10]!==u?(f=o.jsx(Yi,{children:u}),e[10]=u,e[11]=f):f=e[11];let m;e[12]!==n||e[13]!==i?(m=i("assets.browser.deleteConfirmDescription",{name:n?jf(n.key):""}),e[12]=n,e[13]=i,e[14]=m):m=e[14];let p;e[15]!==m?(p=o.jsx(Qi,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==f||e[18]!==p?(g=o.jsxs(Gi,{children:[f,p]}),e[17]=f,e[18]=p,e[19]=g):g=e[19];const x=a.isPending;let b;e[20]!==i?(b=i("assets.browser.deleteCancel"),e[20]=i,e[21]=b):b=e[21];let v;e[22]!==a.isPending||e[23]!==b?(v=o.jsx(Ji,{disabled:x,children:b}),e[22]=a.isPending,e[23]=b,e[24]=v):v=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=le(y6({variant:"destructive"})),e[25]=_):_=e[25];const L=a.isPending;let y;e[26]!==c?(y=C=>{C.preventDefault(),c()},e[26]=c,e[27]=y):y=e[27];let w;e[28]!==a.isPending?(w=a.isPending?o.jsx(nt,{className:"size-3.5"}):null,e[28]=a.isPending,e[29]=w):w=e[29];let S;e[30]!==i?(S=i("assets.browser.deleteConfirm"),e[30]=i,e[31]=S):S=e[31];let k;e[32]!==a.isPending||e[33]!==y||e[34]!==w||e[35]!==S?(k=o.jsxs(Zi,{className:_,disabled:L,onClick:y,children:[w,S]}),e[32]=a.isPending,e[33]=y,e[34]=w,e[35]=S,e[36]=k):k=e[36];let j;e[37]!==v||e[38]!==k?(j=o.jsxs(Xi,{children:[v,k]}),e[37]=v,e[38]=k,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==g?(N=o.jsxs(qi,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=N):N=e[42];let V;return e[43]!==N||e[44]!==d||e[45]!==h?(V=o.jsx(Wi,{open:d,onOpenChange:h,children:N}),e[43]=N,e[44]=d,e[45]=h,e[46]=V):V=e[46],V}const im={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:aa},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Fi},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:O6}},sce=["fast","smart","thinking"];function nce(t){const e=U.c(19),{tier:s,onSelect:n}=t,r=ue(),[i,a]=P.useState(!1),l=im[s].icon;let c;e[0]!==l?(c=o.jsx(l,{size:14,className:"text-muted-foreground"}),e[0]=l,e[1]=c):c=e[1];const d=im[s];let h;e[2]!==r||e[3]!==d.labelKey?(h=r(d.labelKey),e[2]=r,e[3]=d.labelKey,e[4]=h):h=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(ds,{size:14,className:"text-muted-foreground"}),e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==h?(f=o.jsx(gs,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,h,u]})}),e[6]=c,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==r||e[11]!==s?(m=sce.map(x=>{const b=im[x],v=b.icon;return o.jsxs("button",{type:"button",onClick:()=>{n(x),a(!1)},className:le("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[o.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"text-sm",children:r(b.labelKey)}),o.jsx("div",{className:"text-xs text-muted-foreground",children:r(b.subtitleKey)})]}),x===s&&o.jsx($t,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=r,e[11]=s,e[12]=m):m=e[12];let p;e[13]!==m?(p=o.jsx(ys,{align:"start",className:"p-1 w-64",children:o.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==i||e[16]!==f||e[17]!==p?(g=o.jsxs(_s,{open:i,onOpenChange:a,children:[f,p]}),e[15]=i,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function rce(t){const e=U.c(27),{tier:s,onTierChange:n,override:r,onOverrideChange:i}=t,a=ue(),[l,c]=P.useState(r!==null);let d;e[0]!==a?(d=a("automations.automationConfig.modelLabel"),e[0]=a,e[1]=d):d=e[1];let h;e[2]!==d?(h=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=h):h=e[3];let u;e[4]!==i||e[5]!==n||e[6]!==r||e[7]!==a||e[8]!==s||e[9]!==l?(u=l?o.jsx(P.Suspense,{fallback:o.jsx(me,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:a("automations.automationConfig.loadingModels")}),children:o.jsx(ice,{override:r,onOverrideChange:i})}):o.jsx(nce,{tier:s,onSelect:n}),e[4]=i,e[5]=n,e[6]=r,e[7]=a,e[8]=s,e[9]=l,e[10]=u):u=e[10];let f;e[11]!==i?(f=v=>{c(v),v||i(null)},e[11]=i,e[12]=f):f=e[12];let m;e[13]!==f||e[14]!==l?(m=o.jsx(rr,{checked:l,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=l,e[15]=m):m=e[15];let p;e[16]!==a?(p=a("automations.automationConfig.specificModel"),e[16]=a,e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==p?(g=o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20];let x;e[21]!==u||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u,g]}),e[21]=u,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==h||e[25]!==x?(b=o.jsxs("div",{className:"flex flex-col gap-2",children:[h,x]}),e[24]=h,e[25]=x,e[26]=b):b=e[26],b}function ice(t){const e=U.c(25),{override:s,onOverrideChange:n}=t,r=ue(),i=c9(),a=i[0]?.id??null;let l;e[0]!==a||e[1]!==i||e[2]!==s?.credentialId?(l=i.some(b=>b.id===s?.credentialId)?s?.credentialId??null:a,e[0]=a,e[1]=i,e[2]=s?.credentialId,e[3]=l):l=e[3];const[c,d]=P.useState(l);let h;e[4]!==c||e[5]!==a||e[6]!==i?(h=i.some(b=>b.id===c)?c:a,e[4]=c,e[5]=a,e[6]=i,e[7]=h):h=e[7];const u=h;let f;e[8]!==i||e[9]!==s?(f=s&&i.some(b=>b.id===s.credentialId)?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[8]=i,e[9]=s,e[10]=f):f=e[10];const m=f;if(i.length===0){let b;e[11]!==r?(b=r("automations.automationConfig.connectAiProviderHint"),e[11]=r,e[12]=b):b=e[12];let v;return e[13]!==b?(v=o.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=v):v=e[14],v}let p;e[15]!==r?(p=r("automations.automationConfig.pickModelPlaceholder"),e[15]=r,e[16]=p):p=e[16];let g;e[17]!==u||e[18]!==n?(g=b=>{const v=b.keyId??u??"";d(v),n({modelId:b.modelId,credentialId:v,title:b.title??b.modelId})},e[17]=u,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==u||e[21]!==m||e[22]!==p||e[23]!==g?(x=o.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:o.jsx(ZP,{variant:"bordered",placeholder:p,model:m,credentialId:u,onCredentialChange:d,onModelChange:g})}),e[20]=u,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const bj=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:Sg,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:Cn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:ar},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:Gn},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:Qu}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:qo,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:s9},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:b9},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:U2},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Cu},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:qo},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:tP}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Ia,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Ia},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Hc},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Hc}]}],oce=bj.flatMap(t=>t.tools.map(e=>e.name));function ace(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function lce(t){const e=U.c(12),{agentId:s,value:n,onChange:r}=t,i=ue();let a;e[0]!==i?(a=i("automations.automationConfig.toolsLabel"),e[0]=i,e[1]=a):a=e[1];let l;e[2]!==a?(l=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:a}),e[2]=a,e[3]=l):l=e[3];let c;e[4]!==s||e[5]!==r||e[6]!==i||e[7]!==n?(c=s?o.jsx(P.Suspense,{fallback:o.jsxs(me,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[o.jsx(Sg,{size:14}),i("automations.automationConfig.loadingTools")]}),children:o.jsx(cce,{agentId:s,value:n,onChange:r})}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:i("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=r,e[6]=i,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==l||e[10]!==c?(d=o.jsxs("div",{className:"flex flex-col gap-2",children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function Pv(t){const e=U.c(17),{value:s,checked:n,onToggle:r,title:i,description:a,leading:l}=t;let c;e[0]!==n?(c=o.jsx(il,{checked:n,className:"pointer-events-none mt-0.5"}),e[0]=n,e[1]=c):c=e[1];let d;e[2]!==l?(d=l&&o.jsx("span",{className:"mt-px shrink-0",children:l}),e[2]=l,e[3]=d):d=e[3];let h;e[4]!==i?(h=o.jsx("span",{className:"truncate text-sm leading-tight",children:i}),e[4]=i,e[5]=h):h=e[5];let u;e[6]!==a?(u=a&&o.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:a}),e[6]=a,e[7]=u):u=e[7];let f;e[8]!==h||e[9]!==u?(f=o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[h,u]}),e[8]=h,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(m=o.jsxs(as,{value:s,onSelect:r,className:"items-start gap-2.5 py-2",children:[c,d,f]}),e[11]=r,e[12]=c,e[13]=d,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function Av(t){const e=U.c(27),{conn:s,label:n,icon:r,on:i,total:a,onToggle:l}=t,c=ue(),d=i===a;let h;e[0]!==r||e[1]!==s?(h=s?o.jsx(io,{icon:s.icon,name:s.title,size:"2xs"}):r?o.jsx(r,{size:14,className:"text-muted-foreground"}):o.jsx(hE,{size:14,className:"text-muted-foreground"}),e[0]=r,e[1]=s,e[2]=h):h=e[2];let u;e[3]!==s?.title||e[4]!==n||e[5]!==c?(u=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=u):u=e[6];let f;e[7]!==u?(f=o.jsx("span",{className:"truncate",children:u}),e[7]=u,e[8]=f):f=e[8];let m;e[9]!==i||e[10]!==a?(m=o.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[i,"/",a]}),e[9]=i,e[10]=a,e[11]=m):m=e[11];let p;e[12]!==l?(p=_=>{_.stopPropagation(),l()},e[12]=l,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==g?(x=o.jsx("button",{type:"button",onClick:p,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==m||e[21]!==x?(b=o.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=b):b=e[22];let v;return e[23]!==h||e[24]!==f||e[25]!==b?(v=o.jsxs("div",{className:"flex items-center gap-2",children:[h,f,b]}),e[23]=h,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function cce(t){const e=U.c(83),{agentId:s,value:n,onChange:r}=t,i=ue(),{org:a}=Fe(),[l,c]=P.useState(!1);let d;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(d={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=d):d=e[3];const h=Vn(d);let u;e[4]!==h?(u={client:h},e[4]=h,e[5]=u):u=e[5];const{data:f,isLoading:m}=D8(u),p=ui();let g,x,b,v,_,L,y,w,S,k,j,N,V;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==r||e[10]!==l||e[11]!==i||e[12]!==n){const E=new Map(p.map(mce)),I=new Map;for(const ae of f?.tools??[]){const re=$i(ae._meta)??"__other__",ie=Hu(ae.name,re==="__other__"?void 0:re),Y=ae.title,pe=Y&&Y!==ae.name?Y:ace(ie);I.has(re)||I.set(re,{clientId:re,conn:E.get(re),tools:[]}),I.get(re).tools.push({name:ae.name,display:pe,description:ae.description})}const D=[...I.values()].sort(fce),O=(f?.tools??[]).map(hce),$=[...oce,...O],M=n===null?new Set($):new Set(n),z=$.every(ae=>M.has(ae)),F=ae=>r($.every(re=>ae.has(re))?null:[...ae]),B=ae=>{const re=new Set(M);re.has(ae)?re.delete(ae):re.add(ae),F(re)},H=(ae,re)=>{const ie=new Set(M);for(const Y of ae)re?ie.add(Y):ie.delete(Y);F(ie)};v=_s,V=l,_=c;let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(Sg,{size:14,className:"text-muted-foreground"}),e[26]=W):W=e[26];let K;e[27]!==z||e[28]!==i?(K=i(z?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=z,e[28]=i,e[29]=K):K=e[29];const q=!z&&o.jsxs(jE,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",$.length]});let G;e[30]===Symbol.for("react.memo_cache_sentinel")?(G=o.jsx(ds,{size:14,className:"text-muted-foreground"}),e[30]=G):G=e[30],e[31]!==K||e[32]!==q?(L=o.jsx(gs,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[W,K,q,G]})}),e[31]=K,e[32]=q,e[33]=L):L=e[33],b=ys,j="p-0 w-80",N="start",x=zr;let te;e[34]!==i?(te=i("automations.automationConfig.searchToolsPlaceholder"),e[34]=i,e[35]=te):te=e[35],e[36]!==te?(S=o.jsx(hr,{placeholder:te}),e[36]=te,e[37]=S):S=e[37];const X=z?i("automations.automationConfig.allToolsEnabled",{count:$.length}):i("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:$.length});let Z;e[38]!==X?(Z=o.jsx("span",{className:"text-xs text-muted-foreground",children:X}),e[38]=X,e[39]=Z):Z=e[39];let ee;e[40]!==r?(ee=()=>r(null),e[40]=r,e[41]=ee):ee=e[41];let se;e[42]!==i?(se=i("automations.automationConfig.selectAll"),e[42]=i,e[43]=se):se=e[43];let J;e[44]!==z||e[45]!==ee||e[46]!==se?(J=o.jsx("button",{type:"button",onClick:ee,disabled:z,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:se}),e[44]=z,e[45]=ee,e[46]=se,e[47]=J):J=e[47];let oe;e[48]===Symbol.for("react.memo_cache_sentinel")?(oe=o.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=oe):oe=e[48];let ce;e[49]!==r?(ce=()=>r([]),e[49]=r,e[50]=ce):ce=e[50];const he=M.size===0;let ne;e[51]!==i?(ne=i("automations.automationConfig.clear"),e[51]=i,e[52]=ne):ne=e[52];let Q;e[53]!==ce||e[54]!==he||e[55]!==ne?(Q=o.jsx("button",{type:"button",onClick:ce,disabled:he,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:ne}),e[53]=ce,e[54]=he,e[55]=ne,e[56]=Q):Q=e[56];let de;e[57]!==J||e[58]!==Q?(de=o.jsxs("div",{className:"flex items-center gap-2",children:[J,oe,Q]}),e[57]=J,e[58]=Q,e[59]=de):de=e[59],e[60]!==Z||e[61]!==de?(k=o.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[Z,de]}),e[60]=Z,e[61]=de,e[62]=k):k=e[62],g=fr,y="max-h-80",w=m?o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:i("automations.automationConfig.loadingTools")}):o.jsxs(o.Fragment,{children:[o.jsx(On,{children:i("automations.automationConfig.noToolsFound")}),bj.map(ae=>{const re=ae.tools.map(uce),ie=re.filter(Y=>M.has(Y)).length;return o.jsx(Es,{heading:o.jsx(Av,{label:i(ae.headingKey),icon:ae.icon,on:ie,total:re.length,onToggle:()=>H(re,ie!==re.length)}),children:ae.tools.map(Y=>o.jsx(Pv,{value:`${i(Y.titleKey)} ${Y.name}`,checked:M.has(Y.name),onToggle:()=>B(Y.name),title:i(Y.titleKey),description:i(Y.descriptionKey),leading:o.jsx(Y.icon,{size:16,className:"text-muted-foreground"})},Y.name))},ae.key)}),D.map(ae=>{const re=ae.tools.map(dce),ie=re.filter(Y=>M.has(Y)).length;return o.jsx(Es,{heading:o.jsx(Av,{conn:ae.conn,on:ie,total:re.length,onToggle:()=>H(re,ie!==re.length)}),children:ae.tools.map(Y=>o.jsx(Pv,{value:`${Y.display} ${Y.name} ${ae.conn?.title??""}`,checked:M.has(Y.name),onToggle:()=>B(Y.name),title:Y.display,description:Y.description},Y.name))},ae.clientId)})]}),e[6]=p,e[7]=f?.tools,e[8]=m,e[9]=r,e[10]=l,e[11]=i,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=v,e[17]=_,e[18]=L,e[19]=y,e[20]=w,e[21]=S,e[22]=k,e[23]=j,e[24]=N,e[25]=V}else g=e[13],x=e[14],b=e[15],v=e[16],_=e[17],L=e[18],y=e[19],w=e[20],S=e[21],k=e[22],j=e[23],N=e[24],V=e[25];let C;e[63]!==g||e[64]!==y||e[65]!==w?(C=o.jsx(g,{className:y,children:w}),e[63]=g,e[64]=y,e[65]=w,e[66]=C):C=e[66];let T;e[67]!==x||e[68]!==C||e[69]!==S||e[70]!==k?(T=o.jsxs(x,{children:[S,k,C]}),e[67]=x,e[68]=C,e[69]=S,e[70]=k,e[71]=T):T=e[71];let A;e[72]!==b||e[73]!==T||e[74]!==j||e[75]!==N?(A=o.jsx(b,{className:j,align:N,children:T}),e[72]=b,e[73]=T,e[74]=j,e[75]=N,e[76]=A):A=e[76];let R;return e[77]!==v||e[78]!==_||e[79]!==L||e[80]!==A||e[81]!==V?(R=o.jsxs(v,{open:V,onOpenChange:_,children:[L,A]}),e[77]=v,e[78]=_,e[79]=L,e[80]=A,e[81]=V,e[82]=R):R=e[82],R}function dce(t){return t.name}function uce(t){return t.name}function hce(t){return t.name}function fce(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function mce(t){return[t.id,t]}function gu(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function pce(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return`Every ${n[1]} hours`;const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const l=parseInt(r[1]??"1");return l%7===0?`Every ${l/7} weeks`:`Every ${l} days`}const i=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(i){const l=(i[2]??"0").padStart(2,"0"),c=(i[1]??"0").padStart(2,"0");return`Every day at ${l}:${c} UTC`}const a=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(a){const c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(a[3]??"0")]??"day",d=(a[2]??"0").padStart(2,"0"),h=(a[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${h} UTC`}return t}function gce(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function xce(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return{count:parseInt(n[1]),unit:"hours"};const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);return r?{count:parseInt(r[1]),unit:"days"}:null}function bce(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const vce=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function yce({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:r,onWebhookCreated:i}){const a=ue(),{triggerAdd:l}=a0(),[c,d]=P.useState(!1),h=e??c,u=p=>{s?s(p):d(p)},f=async p=>{try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),ye.success(a("automations.addStarterPopover.starterAdded")),u(!1)}catch(g){const x=g instanceof Error?g.message:a("automations.addStarterPopover.failedAddStarter");ye.error(x)}},m=async()=>{try{const p=await l.mutateAsync({automation_id:t,type:"webhook"});u(!1),p.webhook?i?.(p.webhook):ye.success(a("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:a("automations.addStarterPopover.failedAddWebhookStarter");ye.error(g)}};return o.jsxs(Ft,{open:h,onOpenChange:u,children:[o.jsx(Ut,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(Qt,{size:14}),a("automations.addStarterPopover.addStarter")]})}),o.jsxs(Ht,{align:"end",className:"w-[200px]",children:[o.jsxs(jr,{children:[o.jsxs(Cr,{className:"gap-2.5",children:[o.jsx(nu,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.every")]}),o.jsx(Nr,{className:"w-[160px]",children:vce.map(p=>o.jsxs(et,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:l.isPending,children:[o.jsx(nu,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),o.jsxs(et,{className:"gap-2.5",onSelect:()=>{u(!1),n?.()},children:[o.jsx(nu,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.customCron")]}),o.jsxs(et,{className:"gap-2.5",onSelect:()=>{u(!1),r?.()},children:[o.jsx(hi,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.event")]}),o.jsxs(et,{className:"gap-2.5",onSelect:()=>{m()},disabled:l.isPending,children:[o.jsx(Cn,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.webhook")]})]})]})}function vj(t){const e=U.c(39),{open:s,onOpenChange:n,url:r,token:i,title:a,description:l}=t,c=a===void 0?"Webhook ready":a,d=l===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":l,h=ue(),[u,f]=P.useState(null),[m,p]=P.useState("curl"),[g,x]=P.useState("header"),b=P.useId();let v;e[0]!==h?(v=async(D,O)=>{try{await navigator.clipboard.writeText(D),f(O),ye.success(h("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{ye.error(h("automations.webhookSecretDialog.failedCopy"))}},e[0]=h,e[1]=v):v=e[1];const _=v;let L;e[2]!==g||e[3]!==i||e[4]!==r?(L=r&&i&&g==="url"?`${r.replace(/\/$/,"")}/${i}`:r??"",e[2]=g,e[3]=i,e[4]=r,e[5]=L):L=e[5];const y=L,w=r&&i?g==="header"?`curl -X POST "${y}" \\
628
628
  -H "Authorization: Bearer ${i}" \\
629
629
  -H "Content-Type: application/json" \\
630
630
  -d '{"hello":"world"}'`:`curl -X POST "${y}" \\
@@ -643,7 +643,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
643
643
  },
644
644
  body: JSON.stringify({ hello: "world" }),
645
645
  });`:"",k=m==="curl"?w:S;let j;e[6]!==c?(j=o.jsx(qt,{children:c}),e[6]=c,e[7]=j):j=e[7];let N;e[8]!==d?(N=o.jsx(In,{children:d}),e[8]=d,e[9]=N):N=e[9];let V;e[10]!==j||e[11]!==N?(V=o.jsxs(ls,{children:[j,N]}),e[10]=j,e[11]=N,e[12]=V):V=e[12];let C;e[13]!==g||e[14]!==u||e[15]!==_||e[16]!==y||e[17]!==m||e[18]!==k||e[19]!==h||e[20]!==i||e[21]!==b||e[22]!==r?(C=r&&i?o.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:h("automations.webhookSecretDialog.url")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:y}),o.jsxs(me,{size:"sm",variant:"outline",onClick:()=>_(y,"url"),children:[o.jsx(bn,{size:13}),h(u==="url"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]})]}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:h("automations.webhookSecretDialog.tokenLabel")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:i}),o.jsxs(me,{size:"sm",variant:"outline",onClick:()=>_(i,"token"),children:[o.jsx(bn,{size:13}),h(u==="token"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:h("automations.webhookSecretDialog.snippet")}),o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(nl,{value:m,onValueChange:D=>p(D),children:o.jsxs(od,{className:"h-8 p-[2px]",children:[o.jsx(nr,{value:"curl",className:"h-7 px-2.5 text-xs",children:"curl"}),o.jsx(nr,{value:"fetch",className:"h-7 px-2.5 text-xs",children:"fetch"})]})}),o.jsxs("label",{htmlFor:b,className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer select-none",children:[o.jsx(il,{id:b,checked:g==="url",onCheckedChange:D=>x(D?"url":"header")}),h("automations.webhookSecretDialog.tokenInUrl")]})]}),o.jsxs(me,{size:"sm",variant:"outline",onClick:()=>_(k,"example"),children:[o.jsx(bn,{size:13}),h(u==="example"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]}),o.jsx("div",{className:"rounded-md border overflow-hidden min-w-0",children:o.jsx(ud,{code:k,language:m==="curl"?"shell":"typescript",readOnly:!0,disableDiagnostics:!0,height:180})})]})]}):null,e[13]=g,e[14]=u,e[15]=_,e[16]=y,e[17]=m,e[18]=k,e[19]=h,e[20]=i,e[21]=b,e[22]=r,e[23]=C):C=e[23];let T;e[24]!==n?(T=()=>n(!1),e[24]=n,e[25]=T):T=e[25];let A;e[26]!==h?(A=h("automations.webhookSecretDialog.done"),e[26]=h,e[27]=A):A=e[27];let R;e[28]!==A||e[29]!==T?(R=o.jsx(Yn,{children:o.jsx(me,{onClick:T,children:A})}),e[28]=A,e[29]=T,e[30]=R):R=e[30];let E;e[31]!==R||e[32]!==V||e[33]!==C?(E=o.jsxs(Bt,{className:"max-w-lg",children:[V,C,R]}),e[31]=R,e[32]=V,e[33]=C,e[34]=E):E=e[34];let I;return e[35]!==n||e[36]!==s||e[37]!==E?(I=o.jsx(zt,{open:s,onOpenChange:n,children:E}),e[35]=n,e[36]=s,e[37]=E,e[38]=I):I=e[38],I}function _ce(t){const e=U.c(137),{trigger:s,automationId:n,connectionName:r}=t,i=ue(),{triggerAdd:a,triggerRemove:l,triggerRotateToken:c}=a0(),[d,h]=P.useState(!1),[u,f]=P.useState(!1),[m,p]=P.useState(null);let g;e[0]!==s.cron_expression?(g=s.cron_expression?xce(s.cron_expression):null,e[0]=s.cron_expression,e[1]=g):g=e[1];const x=g,[b,v]=P.useState(x?.count??1),[_,L]=P.useState(!1),[y,w]=P.useState(s.cron_expression??""),S=l.isPending||a.isPending||c.isPending,k=s.type==="cron",j=s.type==="webhook";let N;e[2]!==n||e[3]!==l||e[4]!==i||e[5]!==s.id?(N=async()=>{try{await l.mutateAsync({trigger_id:s.id,automation_id:n}),ye.success(i("automations.triggerCard.starterRemoved"))}catch{ye.error(i("automations.triggerCard.failedToRemoveStarter"))}h(!1)},e[2]=n,e[3]=l,e[4]=i,e[5]=s.id,e[6]=N):N=e[6];const V=N;let C;e[7]!==a||e[8]!==n||e[9]!==l||e[10]!==s.id?(C=async Ge=>{await a.mutateAsync({automation_id:n,type:"cron",cron_expression:Ge}),await l.mutateAsync({trigger_id:s.id,automation_id:n})},e[7]=a,e[8]=n,e[9]=l,e[10]=s.id,e[11]=C):C=e[11];const T=C;let A;e[12]!==y||e[13]!==T||e[14]!==i||e[15]!==s.cron_expression?(A=async()=>{const Ge=y.trim();if(!Ge||!gu(Ge)||Ge===s.cron_expression){L(!1),w(s.cron_expression??"");return}try{await T(Ge),L(!1)}catch{ye.error(i("automations.triggerCard.failedToUpdateStarter")),w(s.cron_expression??""),L(!1)}},e[12]=y,e[13]=T,e[14]=i,e[15]=s.cron_expression,e[16]=A):A=e[16];const R=A;let E;e[17]!==n||e[18]!==c||e[19]!==s.id?(E=async()=>{f(!1);try{const Ge=await c.mutateAsync({trigger_id:s.id,automation_id:n});p({url:Ge.url,token:Ge.token})}catch(Ge){const Vt=Ge,lt=Vt instanceof Error?Vt.message:"Failed to rotate token";ye.error(lt)}},e[17]=n,e[18]=c,e[19]=s.id,e[20]=E):E=e[20];const I=E;let D;e[21]!==x||e[22]!==T||e[23]!==i||e[24]!==s.cron_expression?(D=async Ge=>{if(!x)return;const Vt=x.unit==="minutes"?5:1,lt=Math.max(Vt,Ge);lt!==Ge&&v(lt);const tt=gce(lt,x.unit);if(tt!==s.cron_expression)try{await T(tt)}catch{ye.error(i("automations.triggerCard.failedToUpdateStarter")),v(x.count)}},e[21]=x,e[22]=T,e[23]=i,e[24]=s.cron_expression,e[25]=D):D=e[25];const O=D;let $;e[26]!==k||e[27]!==j?($=k?o.jsx(nu,{size:14,className:"text-muted-foreground shrink-0"}):j?o.jsx(Cn,{size:14,className:"text-muted-foreground shrink-0"}):o.jsx(hi,{size:14,className:"text-muted-foreground shrink-0"}),e[26]=k,e[27]=j,e[28]=$):$=e[28];let M;e[29]!==r||e[30]!==b||e[31]!==y||e[32]!==O||e[33]!==R||e[34]!==x||e[35]!==k||e[36]!==_||e[37]!==S||e[38]!==j||e[39]!==i||e[40]!==s.cron_expression||e[41]!==s.event_type||e[42]!==s.params?(M=x&&k?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:i("automations.triggerCard.every")}),o.jsx("input",{type:"number",min:x.unit==="minutes"?5:1,value:b,onChange:Ge=>v(parseInt(Ge.target.value)||1),onBlur:()=>O(b),onKeyDown:Ge=>{Ge.key==="Enter"&&Ge.target.blur(),Ge.key==="Escape"&&v(x.count)},disabled:S,className:"w-12 text-center text-sm h-7 border border-border rounded-md bg-background px-1 focus:outline-none focus:ring-1 focus:ring-ring"}),o.jsx("span",{className:"text-sm",children:bce(x.unit,b)})]}):k&&_?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"text",value:y,onChange:Ge=>w(Ge.target.value),onBlur:R,onKeyDown:Ge=>{Ge.key==="Enter"&&Ge.target.blur(),Ge.key==="Escape"&&(L(!1),w(s.cron_expression??""))},className:"flex-1 text-sm font-mono bg-transparent outline-none",autoFocus:!0}),y&&!gu(y)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:i("automations.triggerCard.invalid")})]}):o.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-mono text-xs text-muted-foreground truncate",children:k?pce(s.cron_expression??""):j?i("automations.triggerCard.webhookPostToFire"):`${s.event_type}${r?` · ${r}`:""}`}),!k&&!j&&s.params&&Object.keys(s.params).length>0&&o.jsx("span",{className:"text-xs text-muted-foreground/60 truncate",children:Object.entries(s.params).map(Lce).join(", ")})]}),e[29]=r,e[30]=b,e[31]=y,e[32]=O,e[33]=R,e[34]=x,e[35]=k,e[36]=_,e[37]=S,e[38]=j,e[39]=i,e[40]=s.cron_expression,e[41]=s.event_type,e[42]=s.params,e[43]=M):M=e[43];let z;e[44]!==S?(z=S&&o.jsx(nt,{className:"size-[13px] text-muted-foreground"}),e[44]=S,e[45]=z):z=e[45];let F;e[46]!==x||e[47]!==k||e[48]!==_||e[49]!==s.cron_expression?(F=k&&!x&&!_&&o.jsx(me,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{w(s.cron_expression??""),L(!0)},children:o.jsx(b9,{size:13,className:"text-muted-foreground"})}),e[46]=x,e[47]=k,e[48]=_,e[49]=s.cron_expression,e[50]=F):F=e[50];let B;e[51]!==j||e[52]!==i?(B=j&&o.jsx(me,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",title:i("automations.triggerCard.rotateToken"),onClick:()=>f(!0),children:o.jsx(Mn,{size:13,className:"text-muted-foreground"})}),e[51]=j,e[52]=i,e[53]=B):B=e[53];let H;e[54]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(me,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>h(!0),children:o.jsx(lr,{size:13,className:"text-muted-foreground"})}),e[54]=H):H=e[54];let W;e[55]!==F||e[56]!==B||e[57]!==z?(W=o.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[z,F,B,H]}),e[55]=F,e[56]=B,e[57]=z,e[58]=W):W=e[58];let K;e[59]!==W||e[60]!==$||e[61]!==M?(K=o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[$,M,W]}),e[59]=W,e[60]=$,e[61]=M,e[62]=K):K=e[62];let q;e[63]!==i?(q=i("automations.triggerCard.removeStarter"),e[63]=i,e[64]=q):q=e[64];let G;e[65]!==q?(G=o.jsx(Yi,{children:q}),e[65]=q,e[66]=G):G=e[66];let te;e[67]!==i?(te=i("automations.triggerCard.confirmRemoveStarter"),e[67]=i,e[68]=te):te=e[68];let X;e[69]!==te?(X=o.jsx(Qi,{children:te}),e[69]=te,e[70]=X):X=e[70];let Z;e[71]!==G||e[72]!==X?(Z=o.jsxs(Gi,{children:[G,X]}),e[71]=G,e[72]=X,e[73]=Z):Z=e[73];let ee;e[74]!==i?(ee=i("automations.triggerCard.cancel"),e[74]=i,e[75]=ee):ee=e[75];let se;e[76]!==ee?(se=o.jsx(Ji,{children:ee}),e[76]=ee,e[77]=se):se=e[77];let J;e[78]!==i?(J=i("automations.triggerCard.remove"),e[78]=i,e[79]=J):J=e[79];let oe;e[80]!==V||e[81]!==J?(oe=o.jsx(Zi,{onClick:V,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:J}),e[80]=V,e[81]=J,e[82]=oe):oe=e[82];let ce;e[83]!==se||e[84]!==oe?(ce=o.jsxs(Xi,{children:[se,oe]}),e[83]=se,e[84]=oe,e[85]=ce):ce=e[85];let he;e[86]!==Z||e[87]!==ce?(he=o.jsxs(qi,{children:[Z,ce]}),e[86]=Z,e[87]=ce,e[88]=he):he=e[88];let ne;e[89]!==d||e[90]!==he?(ne=o.jsx(Wi,{open:d,onOpenChange:h,children:he}),e[89]=d,e[90]=he,e[91]=ne):ne=e[91];let Q;e[92]!==i?(Q=i("automations.triggerCard.rotateWebhookToken"),e[92]=i,e[93]=Q):Q=e[93];let de;e[94]!==Q?(de=o.jsx(Yi,{children:Q}),e[94]=Q,e[95]=de):de=e[95];let ae;e[96]!==i?(ae=i("automations.triggerCard.rotateWebhookTokenDescription"),e[96]=i,e[97]=ae):ae=e[97];let re;e[98]!==ae?(re=o.jsx(Qi,{children:ae}),e[98]=ae,e[99]=re):re=e[99];let ie;e[100]!==de||e[101]!==re?(ie=o.jsxs(Gi,{children:[de,re]}),e[100]=de,e[101]=re,e[102]=ie):ie=e[102];let Y;e[103]!==i?(Y=i("automations.triggerCard.cancel"),e[103]=i,e[104]=Y):Y=e[104];let pe;e[105]!==Y?(pe=o.jsx(Ji,{children:Y}),e[105]=Y,e[106]=pe):pe=e[106];let be;e[107]!==i?(be=i("automations.triggerCard.rotate"),e[107]=i,e[108]=be):be=e[108];let _e;e[109]!==I||e[110]!==be?(_e=o.jsx(Zi,{onClick:I,children:be}),e[109]=I,e[110]=be,e[111]=_e):_e=e[111];let Le;e[112]!==pe||e[113]!==_e?(Le=o.jsxs(Xi,{children:[pe,_e]}),e[112]=pe,e[113]=_e,e[114]=Le):Le=e[114];let ke;e[115]!==ie||e[116]!==Le?(ke=o.jsxs(qi,{children:[ie,Le]}),e[115]=ie,e[116]=Le,e[117]=ke):ke=e[117];let Ve;e[118]!==u||e[119]!==ke?(Ve=o.jsx(Wi,{open:u,onOpenChange:f,children:ke}),e[118]=u,e[119]=ke,e[120]=Ve):Ve=e[120];const Pe=m!==null;let xe;e[121]===Symbol.for("react.memo_cache_sentinel")?(xe=Ge=>{Ge||p(null)},e[121]=xe):xe=e[121];const Ne=m?.url??null,je=m?.token??null;let we;e[122]!==i?(we=i("automations.triggerCard.newWebhookToken"),e[122]=i,e[123]=we):we=e[123];let Ce;e[124]!==i?(Ce=i("automations.triggerCard.newWebhookTokenDescription"),e[124]=i,e[125]=Ce):Ce=e[125];let Oe;e[126]!==Pe||e[127]!==Ne||e[128]!==je||e[129]!==we||e[130]!==Ce?(Oe=o.jsx(vj,{open:Pe,onOpenChange:xe,url:Ne,token:je,title:we,description:Ce}),e[126]=Pe,e[127]=Ne,e[128]=je,e[129]=we,e[130]=Ce,e[131]=Oe):Oe=e[131];let rt;return e[132]!==K||e[133]!==ne||e[134]!==Ve||e[135]!==Oe?(rt=o.jsxs(o.Fragment,{children:[K,ne,Ve,Oe]}),e[132]=K,e[133]=ne,e[134]=Ve,e[135]=Oe,e[136]=rt):rt=e[136],rt}function Lce(t){const[e,s]=t;return`${e}: ${s}`}function wce(t){const e=U.c(70),{automationId:s,onDone:n}=t,r=ue();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={binding:"TRIGGER"},e[0]=i):i=e[0];const a=ui(i),[l,c]=P.useState(),[d,h]=P.useState();let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u={},e[1]=u):u=e[1];const[f,m]=P.useState(u),{triggerAdd:p}=a0(),{data:g,isLoading:x}=CE(l);let b,v,_,L,y,w;if(e[2]!==p||e[3]!==s||e[4]!==l||e[5]!==d||e[6]!==x||e[7]!==n||e[8]!==f||e[9]!==r||e[10]!==a||e[11]!==g){const j=g?.find(z=>z.type===d);let N;e[18]!==p||e[19]!==s||e[20]!==l||e[21]!==d||e[22]!==n||e[23]!==f||e[24]!==r?(N=async()=>{if(!(!l||!d))try{await p.mutateAsync({automation_id:s,type:"event",event_type:d,connection_id:l,params:f}),Ye("automation_trigger_added",{automation_id:s,trigger_type:"event",connection_id:l,event_type:d}),ye.success(r("automations.eventTriggerForm.successAdded")),n()}catch{ye.error(r("automations.eventTriggerForm.errorFailed"))}},e[18]=p,e[19]=s,e[20]=l,e[21]=d,e[22]=n,e[23]=f,e[24]=r,e[25]=N):N=e[25],b=N,v="flex flex-col gap-3 px-3 py-3 rounded-lg border border-border bg-background";let V;e[26]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(hi,{size:14,className:"text-muted-foreground shrink-0"}),e[26]=V):V=e[26];let C;e[27]!==r?(C=r("automations.eventTriggerForm.title"),e[27]=r,e[28]=C):C=e[28];let T;e[29]!==C?(T=o.jsx("span",{className:"text-sm font-medium",children:C}),e[29]=C,e[30]=T):T=e[30];let A;e[31]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(lr,{size:13}),e[31]=A):A=e[31];let R;e[32]!==n?(R=o.jsx("button",{type:"button",className:"ml-auto shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground",onClick:n,children:A}),e[32]=n,e[33]=R):R=e[33],e[34]!==T||e[35]!==R?(_=o.jsxs("div",{className:"flex items-center gap-2",children:[V,T,R]}),e[34]=T,e[35]=R,e[36]=_):_=e[36];const E=l??"";let I;e[37]===Symbol.for("react.memo_cache_sentinel")?(I=z=>{c(z),h(void 0),m({})},e[37]=I):I=e[37];let D;e[38]!==r?(D=r("automations.eventTriggerForm.selectConnectionPlaceholder"),e[38]=r,e[39]=D):D=e[39];let O;e[40]!==D?(O=o.jsx(bs,{className:"w-full",children:o.jsx(js,{placeholder:D})}),e[40]=D,e[41]=O):O=e[41];let $;e[42]!==r||e[43]!==a?($=a.length===0?o.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:r("automations.eventTriggerForm.noConnectionsWithTrigger")}):a.map(jce),e[42]=r,e[43]=a,e[44]=$):$=e[44];let M;e[45]!==$?(M=o.jsx(vs,{children:$}),e[45]=$,e[46]=M):M=e[46],e[47]!==E||e[48]!==O||e[49]!==M?(L=o.jsxs(xs,{value:E,onValueChange:I,children:[O,M]}),e[47]=E,e[48]=O,e[49]=M,e[50]=L):L=e[50],e[51]!==l||e[52]!==d||e[53]!==x||e[54]!==r||e[55]!==g?(y=l&&o.jsxs(xs,{value:d??"",onValueChange:z=>{h(z),m({})},children:[o.jsx(bs,{className:"w-full",children:x?o.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(nt,{className:"size-[13px]"}),r("automations.eventTriggerForm.loadingEvents")]}):o.jsx(js,{placeholder:r("automations.eventTriggerForm.selectEventTypePlaceholder"),children:d??r("automations.eventTriggerForm.selectEventTypePlaceholder")})}),o.jsx(vs,{children:g?.map(kce)})]}),e[51]=l,e[52]=d,e[53]=x,e[54]=r,e[55]=g,e[56]=y):y=e[56],w=j?.paramsSchema&&Object.keys(j.paramsSchema).length>0&&o.jsx("div",{className:"flex flex-col gap-2",children:Object.entries(j.paramsSchema).map(z=>{const[F,B]=z;return o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("label",{className:"text-xs text-muted-foreground",children:[F,B.description&&o.jsxs("span",{className:"text-muted-foreground/60",children:[" ","— ",B.description]})]}),B.enum?o.jsxs(xs,{value:f[F]??"",onValueChange:H=>m(W=>({...W,[F]:H})),children:[o.jsx(bs,{className:"w-full",children:o.jsx(js,{placeholder:r("automations.eventTriggerForm.selectParamPlaceholder",{key:F})})}),o.jsx(vs,{children:B.enum.map(Sce)})]}):o.jsx("input",{type:"text",value:f[F]??"",onChange:H=>m(W=>({...W,[F]:H.target.value})),placeholder:B.description??F,className:"text-sm border border-border rounded-md bg-background px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-ring"})]},F)})}),e[2]=p,e[3]=s,e[4]=l,e[5]=d,e[6]=x,e[7]=n,e[8]=f,e[9]=r,e[10]=a,e[11]=g,e[12]=b,e[13]=v,e[14]=_,e[15]=L,e[16]=y,e[17]=w}else b=e[12],v=e[13],_=e[14],L=e[15],y=e[16],w=e[17];let S;e[57]!==p||e[58]!==l||e[59]!==d||e[60]!==b||e[61]!==r?(S=l&&d&&o.jsx(me,{size:"sm",onClick:b,disabled:p.isPending,children:p.isPending?o.jsx(nt,{className:"size-[13px]"}):r("automations.eventTriggerForm.addTriggerButton")}),e[57]=p,e[58]=l,e[59]=d,e[60]=b,e[61]=r,e[62]=S):S=e[62];let k;return e[63]!==v||e[64]!==_||e[65]!==L||e[66]!==y||e[67]!==w||e[68]!==S?(k=o.jsxs("div",{className:v,children:[_,L,y,w,S]}),e[63]=v,e[64]=_,e[65]=L,e[66]=y,e[67]=w,e[68]=S,e[69]=k):k=e[69],k}function Sce(t){return o.jsx(It,{value:t,children:t},t)}function kce(t){return o.jsx(It,{value:t.type,children:o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{children:t.type}),o.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]})},t.type)}function jce(t){return o.jsx(It,{value:t.id,children:t.title},t.id)}const Cce=30;function Nce(t,e){switch(e.type){case"accumulate":{const s=t??{start:e.now,fields:new Set,saveCount:0},n=new Set(s.fields);for(const r of e.fields)n.add(r);return{...s,fields:n,saveCount:s.saveCount+1}}case"reset":return null}}function Vce({automationId:t,automation:e,onBack:s,onDelete:n}){const r=ue(),i=e.virtual_mcp_id,{org:a}=Fe(),{update:l,triggerAdd:c,run:d}=a0(),h=ui(),u=new Map(h.map(J=>[J.id,J.title])),{openTask:f}=an(),{openSidePanel:m}=oa(),{sendMessage:p}=dr(),g=e.messages?.[0]?.metadata?.tiptapDoc??void 0,[x,b]=P.useState(g),[v,_]=P.useState(!1),[L,y]=P.useState(!1),[w,S]=P.useState(!1),[k,j]=P.useState(""),[N,V]=P.useState(!1),[C,T]=P.useState(null),[A,R]=P.useState(!1),[E,I]=P.useState(!1),[D,O]=P.useState(!1),$=async()=>{if(A)return;const oe=aV(x).filter(ce=>ce.type==="text").map(ce=>ce.text).join(`
646
- `);if(oe.trim()){R(!0);try{Z(),Ye("automation_improve_clicked",{automation_id:t,agent_id:i,instructions_length:oe.length}),m(),await p({tiptapDoc:G_({managerAgentId:lT.AUTOMATION_MANAGER(a.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:oe})})}finally{R(!1)}}},M=e.models?.tier??"smart",z=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,F=j2({defaultValues:{name:e.name,active:e.active,tier:M,modelOverride:z,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),B=F.watch("active"),[H,W]=P.useReducer(Nce,null),K=()=>{H!==null&&(Ye("automation_updated",{automation_id:t,agent_id:i,fields:Array.from(H.fields),save_count:H.saveCount,edit_duration_ms:Date.now()-H.start}),W({type:"reset"}))},q=async()=>{const J=F.control._formState.dirtyFields,oe=Object.keys(J);if(oe.length===0&&!D)return!0;const ce=F.getValues(),he=F.control._defaultValues;F.reset(ce,{keepValues:!0});const ne=D;O(!1);const Q={tier:ce.tier,...ce.modelOverride?{modelId:ce.modelOverride.modelId,credentialId:ce.modelOverride.credentialId,modelTitle:ce.modelOverride.title}:{}},de={id:t,name:ce.name,active:ce.active,models:Q,tools:ce.tools,maxAgentSteps:ce.maxAgentSteps,messages:oV(x),temperature:0};try{await l.mutateAsync(de)}catch{return F.reset(he,{keepValues:!0}),ne&&O(!0),!1}const ae=[...oe];return ne&&ae.push("messages"),W({type:"accumulate",now:Date.now(),fields:ae}),X(),!0},{schedule:G,flush:te}=Yh({save:q}),{schedule:X,flush:Z}=Yh({delayMs:3e4,save:async()=>K()});P.useEffect(()=>{const J=F.watch(()=>G());return()=>J.unsubscribe()},[]);const ee=J=>{if(b(J),!E){I(!0);return}O(!0),G()},se=async()=>{Ye("automation_test_clicked",{automation_id:t,agent_id:i});const J=await te();if(Z(),!!J){if(!x){ye.error(r("automations.automationDetail.noInstructionsConfigured"));return}try{const oe=await d.mutateAsync(t);oe.threadId&&(m(),f(oe.threadId))}catch{}}};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(me,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(n9,{size:14}),r("automations.automationDetail.backToList")]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(ps,{control:F.control,name:"name",render:({field:J})=>o.jsx(yt,{...J,placeholder:r("automations.automationDetail.automationNamePlaceholder"),className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),n&&o.jsx(me,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:o.jsx(rn,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ps,{control:F.control,name:"active",render:({field:J})=>o.jsx(rr,{checked:J.value,onCheckedChange:oe=>{J.onChange(oe),te()},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:r(B?"automations.automationDetail.active":"automations.automationDetail.inactive")}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(Y_,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:r("automations.automationDetail.starter")}),o.jsx(yce,{automationId:t,open:v,onOpenChange:_,onCustomSelect:()=>{S(!0),V(!1),j("")},onEventSelect:()=>{V(!0),S(!1)},onWebhookCreated:J=>{Ye("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),T(J)}})]}),e.triggers.length===0&&!w?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[r("automations.automationDetail.whenShouldRun")," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>_(!0),children:r("automations.automationDetail.addStarter")})," ",r("automations.automationDetail.toGetGoing")]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(J=>o.jsx(_ce,{trigger:J,automationId:t,connectionName:J.connection_id?u.get(J.connection_id):void 0},J.id))}),w&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(nu,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:k,onChange:J=>j(J.target.value),onBlur:async()=>{const J=k.trim();if(!(!J||!gu(J)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:J}),Ye("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),ye.success(r("automations.automationDetail.starterAdded")),S(!1),j("")}catch{ye.error(r("automations.automationDetail.failedToAddStarter"))}},onKeyDown:async J=>{const oe=k.trim();J.key==="Enter"&&oe&&gu(oe)&&J.target.blur(),J.key==="Escape"&&(S(!1),j(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),k&&!gu(k)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:r("automations.automationDetail.invalid")}),c.isPending&&o.jsx(nt,{className:"size-[13px] text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{S(!1),j("")},children:o.jsx(lr,{size:13})})]}),N&&o.jsx(P.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(nt,{className:"size-[13px] text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:r("automations.automationDetail.loadingConnections")})]}),children:o.jsx(wce,{automationId:t,onDone:()=>V(!1)})}),o.jsx(vj,{open:C!==null,onOpenChange:J=>{J||T(null)},url:C?.url??null,token:C?.token??null})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:r("automations.automationDetail.instructions")}),o.jsxs(me,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:A||!x,onClick:$,children:[o.jsx(Fi,{size:13}),r("automations.automationDetail.improve")]})]}),o.jsx(d_,{tiptapDoc:x,setTiptapDoc:ee,placeholder:r("automations.automationDetail.instructionsPlaceholder"),children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(u_,{virtualMcpId:i||null,className:"max-h-[45vh]"}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(me,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:se,disabled:!i,children:[o.jsx(Hf,{size:16}),r("automations.automationDetail.test")]})}),o.jsx(We,{children:r("automations.automationDetail.testAutomation")})]})})]})})]}),o.jsxs(P6,{open:L,onOpenChange:y,className:"flex flex-col gap-2.5",children:[o.jsxs(V6,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:r("automations.automationDetail.advanced")}),o.jsx(ds,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),o.jsxs(T6,{className:"flex flex-col gap-5 pt-0.5",children:[o.jsx(rce,{tier:F.watch("tier"),onTierChange:J=>F.setValue("tier",J,{shouldDirty:!0}),override:F.watch("modelOverride"),onOverrideChange:J=>F.setValue("modelOverride",J,{shouldDirty:!0})}),o.jsx(lce,{agentId:i||null,value:F.watch("tools"),onChange:J=>F.setValue("tools",J,{shouldDirty:!0})}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:r("automations.automationDetail.maxSteps")}),o.jsx(yt,{type:"number",min:1,max:100,className:"w-40",placeholder:r("automations.automationDetail.maxStepsPlaceholder",{default:Cce}),value:F.watch("maxAgentSteps")??"",onChange:J=>{const oe=J.target.value.trim(),ce=oe===""?null:Number(oe);F.setValue("maxAgentSteps",ce===null||Number.isNaN(ce)?null:ce,{shouldDirty:!0})}})]})]})]})]})]})}const yj=[{key:"24h",labelKey:"mainPanelTabs.automationTab.last24hours",ms:1440*60*1e3},{key:"7d",labelKey:"mainPanelTabs.automationTab.last7days",ms:10080*60*1e3},{key:"30d",labelKey:"mainPanelTabs.automationTab.last30days",ms:720*60*60*1e3}];function _j(t){const e=yj.find(n=>n.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function Tce(t){const e=U.c(16),{automationId:s,triggerIds:n}=t,r=ue(),[i,a]=P.useState("30d"),[l,c]=P.useState(Pce);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=x=>{const b=x;a(b),c(_j(b))},e[0]=d):d=e[0];let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(bs,{className:"w-44",children:o.jsx(js,{})}),e[1]=h):h=e[1];let u;e[2]!==r?(u=yj.map(x=>o.jsx(It,{value:x.key,children:r(x.labelKey)},x.key)),e[2]=r,e[3]=u):u=e[3];let f;e[4]!==u?(f=o.jsx(vs,{children:u}),e[4]=u,e[5]=f):f=e[5];let m;e[6]!==f||e[7]!==i?(m=o.jsx("div",{className:"flex items-center justify-end",children:o.jsxs(xs,{value:i,onValueChange:d,children:[h,f]})}),e[6]=f,e[7]=i,e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==l||e[11]!==n?(p=o.jsx(QV,{automationId:s,triggerIds:n,range:l}),e[9]=s,e[10]=l,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"flex flex-col gap-5",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function Pce(){return _j("30d")}function Ace(t){const e=U.c(5),{tabId:s}=t;let n;e[0]!==s?(n=n6(s),e[0]=s,e[1]=n):n=e[1];const r=n;if(!r)return null;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Pa,{}),e[2]=i):i=e[2];let a;return e[3]!==r.id?(a=o.jsx(P.Suspense,{fallback:i,children:o.jsx(Ece,{id:r.id})}),e[3]=r.id,e[4]=a):a=e[4],a}function Ece(t){const e=U.c(41),{id:s}=t,n=ue(),{openPanel:r}=pi(),{data:i,isLoading:a}=NE(s),[l,c]=P.useState("settings");let d;e[0]!==r?(d=()=>r("automations"),e[0]=r,e[1]=d):d=e[1];const h=d;if(a){let N;return e[2]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(Pa,{}),e[2]=N):N=e[2],N}if(!i){let N;e[3]!==n?(N=n("mainPanelTabs.automationTab.automationNotFound"),e[3]=n,e[4]=N):N=e[4];let V;return e[5]!==N?(V=o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:N}),e[5]=N,e[6]=V):V=e[6],V}let u;e[7]!==i.triggers?(u=i.triggers.map(Rce),e[7]=i.triggers,e[8]=u):u=e[8];const f=u;let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(n9,{size:14}),e[9]=m):m=e[9];let p;e[10]!==n?(p=n("mainPanelTabs.automationTab.backToList"),e[10]=n,e[11]=p):p=e[11];let g;e[12]!==h||e[13]!==p?(g=o.jsxs(me,{variant:"ghost",size:"sm",onClick:h,children:[m,p]}),e[12]=h,e[13]=p,e[14]=g):g=e[14];let x;e[15]!==n?(x=n("mainPanelTabs.automationTab.settings"),e[15]=n,e[16]=x):x=e[16];let b;e[17]!==x?(b={id:"settings",label:x},e[17]=x,e[18]=b):b=e[18];let v;e[19]!==n?(v=n("mainPanelTabs.automationTab.runs"),e[19]=n,e[20]=v):v=e[20];let _;e[21]!==v?(_={id:"runs",label:v},e[21]=v,e[22]=_):_=e[22];let L;e[23]!==b||e[24]!==_?(L=[b,_],e[23]=b,e[24]=_,e[25]=L):L=e[25];let y;e[26]===Symbol.for("react.memo_cache_sentinel")?(y=N=>c(N),e[26]=y):y=e[26];let w;e[27]!==L||e[28]!==l?(w=o.jsx(G8,{tabs:L,activeTab:l,onTabChange:y}),e[27]=L,e[28]=l,e[29]=w):w=e[29];let S;e[30]!==w||e[31]!==g?(S=o.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[g,w]}),e[30]=w,e[31]=g,e[32]=S):S=e[32];let k;e[33]!==i||e[34]!==s||e[35]!==l||e[36]!==f?(k=l==="settings"?o.jsx(Vce,{automationId:s,automation:i}):o.jsx(Tce,{automationId:s,triggerIds:f}),e[33]=i,e[34]=s,e[35]=l,e[36]=f,e[37]=k):k=e[37];let j;return e[38]!==S||e[39]!==k?(j=o.jsx(Dn,{children:o.jsx(Dn.Content,{children:o.jsxs(Dn.Body,{children:[S,k]})})}),e[38]=S,e[39]=k,e[40]=j):j=e[40],j}function Rce(t){return t.id}function Dce(t){const e=U.c(29),{virtualMcpId:s}=t,n=ue(),{openPanel:r}=pi(),{data:i}=VE(s),a=i===void 0?[]:i,{create:l}=a0(),[c,d]=P.useState(""),h=c.toLowerCase(),u=a.filter(E=>E.name.toLowerCase().includes(h));let f;e[0]!==r?(f=E=>r(`automation:${E}`),e[0]=r,e[1]=f):f=e[1];const m=f,p=async()=>{if(l.isPending)return;Ye("automation_new_clicked",{virtual_mcp_id:s,existing_count:a.length});const E=await l.mutateAsync(TE(s));m(E.id)},g=l.isPending;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Qt,{size:14}),e[2]=x):x=e[2];let b;e[3]!==n?(b=n("automations.automationsList.newAutomation"),e[3]=n,e[4]=b):b=e[4];let v;e[5]!==l.isPending||e[6]!==p||e[7]!==b?(v=o.jsxs(me,{size:"sm",onClick:p,disabled:g,children:[x,b]}),e[5]=l.isPending,e[6]=p,e[7]=b,e[8]=v):v=e[8];const _=v,L=Dn,y=Dn,w=Dn;let S;e[9]!==n?(S=n("automations.automationsList.title"),e[9]=n,e[10]=S):S=e[10];let k;e[11]!==S?(k=o.jsx(Dn.Title,{children:S}),e[11]=S,e[12]=k):k=e[12];const j=a.length>0&&o.jsx(p9,{value:c,onChange:d,placeholder:n("automations.automationsList.searchPlaceholder"),className:"w-full md:w-[375px]"});let N;e[13]!==_||e[14]!==j?(N=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[j,_]}),e[13]=_,e[14]=j,e[15]=N):N=e[15];let V;e[16]!==k||e[17]!==N?(V=o.jsxs("div",{className:"flex flex-col gap-6",children:[k,N]}),e[16]=k,e[17]=N,e[18]=V):V=e[18];const C=a.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Dr,{image:o.jsx(hi,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.emptyTitle"),description:n("automations.automationsList.emptyDescription"),actions:_})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Dr,{image:o.jsx(hi,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.noResultsTitle"),description:n("automations.automationsList.noResultsDescription",{search:c})})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(E=>o.jsx(PE,{automation:E,onClick:()=>m(E.id)},E.id))});let T;e[19]!==V||e[20]!==C||e[21]!==w.Body?(T=o.jsxs(w.Body,{children:[V,C]}),e[19]=V,e[20]=C,e[21]=w.Body,e[22]=T):T=e[22];let A;e[23]!==T||e[24]!==y.Content?(A=o.jsx(y.Content,{children:T}),e[23]=T,e[24]=y.Content,e[25]=A):A=e[25];let R;return e[26]!==L||e[27]!==A?(R=o.jsx(L,{children:A}),e[26]=L,e[27]=A,e[28]=R):R=e[28],R}function Mce(t){const e=U.c(3),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Pa,{}),e[0]=n):n=e[0];let r;return e[1]!==s?(r=o.jsx(P.Suspense,{fallback:n,children:o.jsx(Dce,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}function Ice(t){const e=U.c(60),{file:s,onClose:n}=t,r=ue();let i,a;e[0]!==s.filename?(i=o.jsx(Go,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),a=o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=i,e[2]=a):(i=e[1],a=e[2]);let l;e[3]!==s.size?(l=H8(s.size),e[3]=s.size,e[4]=l):l=e[4];let c;e[5]!==l?(c=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:l}),e[5]=l,e[6]=c):c=e[6];let d;e[7]!==i||e[8]!==a||e[9]!==c?(d=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[i,a,c]}),e[7]=i,e[8]=a,e[9]=c,e[10]=d):d=e[10];let h;e[11]!==r?(h=r("mainPanelTabs.fileTab.download"),e[11]=r,e[12]=h):h=e[12];let u;e[13]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Su,{size:14}),e[13]=u):u=e[13];let f;e[14]!==s.downloadUrl||e[15]!==s.filename?(f=o.jsx("a",{href:s.downloadUrl,download:s.filename,children:u}),e[14]=s.downloadUrl,e[15]=s.filename,e[16]=f):f=e[16];let m;e[17]!==h||e[18]!==f?(m=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":h,asChild:!0,children:f})}),e[17]=h,e[18]=f,e[19]=m):m=e[19];let p;e[20]!==r?(p=r("mainPanelTabs.fileTab.download"),e[20]=r,e[21]=p):p=e[21];let g;e[22]!==p?(g=o.jsx(We,{side:"bottom",children:p}),e[22]=p,e[23]=g):g=e[23];let x;e[24]!==g||e[25]!==m?(x=o.jsxs(qe,{children:[m,g]}),e[24]=g,e[25]=m,e[26]=x):x=e[26];let b;e[27]!==r?(b=r("mainPanelTabs.fileTab.openInNewTab"),e[27]=r,e[28]=b):b=e[28];let v;e[29]!==s.downloadUrl?(v=()=>window.open(s.downloadUrl,"_blank","noopener"),e[29]=s.downloadUrl,e[30]=v):v=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(fn,{size:14}),e[31]=_):_=e[31];let L;e[32]!==b||e[33]!==v?(L=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":b,onClick:v,children:_})}),e[32]=b,e[33]=v,e[34]=L):L=e[34];let y;e[35]!==r?(y=r("mainPanelTabs.fileTab.openInNewTab"),e[35]=r,e[36]=y):y=e[36];let w;e[37]!==y?(w=o.jsx(We,{side:"bottom",children:y}),e[37]=y,e[38]=w):w=e[38];let S;e[39]!==L||e[40]!==w?(S=o.jsxs(qe,{children:[L,w]}),e[39]=L,e[40]=w,e[41]=S):S=e[41];let k;e[42]!==r?(k=r("mainPanelTabs.fileTab.close"),e[42]=r,e[43]=k):k=e[43];let j;e[44]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(lr,{size:14}),e[44]=j):j=e[44];let N;e[45]!==n||e[46]!==k?(N=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":k,onClick:n,children:j})}),e[45]=n,e[46]=k,e[47]=N):N=e[47];let V;e[48]!==r?(V=r("mainPanelTabs.fileTab.close"),e[48]=r,e[49]=V):V=e[49];let C;e[50]!==V?(C=o.jsx(We,{side:"bottom",children:V}),e[50]=V,e[51]=C):C=e[51];let T;e[52]!==N||e[53]!==C?(T=o.jsxs(qe,{children:[N,C]}),e[52]=N,e[53]=C,e[54]=T):T=e[54];let A;return e[55]!==x||e[56]!==S||e[57]!==T||e[58]!==d?(A=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,x,S,T]}),e[55]=x,e[56]=S,e[57]=T,e[58]=d,e[59]=A):A=e[59],A}function Oce(t){const e=U.c(31),{fileKey:s,taskId:n}=t,r=ue(),{closePanel:i}=pi(),{data:a,isPending:l}=S6(n);let c;e[0]!==s||e[1]!==a?(c=a?.find(g=>g.key===s)??null,e[0]=s,e[1]=a,e[2]=c):c=e[2];const d=c;let h;e[3]!==i?(h=()=>i(),e[3]=i,e[4]=h):h=e[4];const u=h;if(!d){if(l){let w;return e[5]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("div",{className:"h-full w-full bg-background",children:o.jsx(F8,{})}),e[5]=w):w=e[5],w}let g;e[6]!==s?(g=s.split("/").pop()??s,e[6]=s,e[7]=g):g=e[7];let x;e[8]!==g?(x=o.jsx(Go,{filename:g,className:"h-7.5 w-6"}),e[8]=g,e[9]=x):x=e[9];let b;e[10]!==r?(b=r("mainPanelTabs.fileTab.fileNotAvailable"),e[10]=r,e[11]=b):b=e[11];let v;e[12]!==b?(v=o.jsx("span",{className:"text-sm text-muted-foreground",children:b}),e[12]=b,e[13]=v):v=e[13];let _;e[14]!==r?(_=r("mainPanelTabs.fileTab.close"),e[14]=r,e[15]=_):_=e[15];let L;e[16]!==u||e[17]!==_?(L=o.jsx(me,{variant:"ghost",size:"sm",onClick:u,children:_}),e[16]=u,e[17]=_,e[18]=L):L=e[18];let y;return e[19]!==x||e[20]!==v||e[21]!==L?(y=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[x,v,L]}),e[19]=x,e[20]=v,e[21]=L,e[22]=y):y=e[22],y}let f;e[23]!==d||e[24]!==u?(f=o.jsx(Ice,{file:d,onClose:u}),e[23]=d,e[24]=u,e[25]=f):f=e[25];let m;e[26]!==d?(m=o.jsx("div",{className:"relative min-h-0 flex-1",children:o.jsx(U8,{file:d})}),e[26]=d,e[27]=m):m=e[27];let p;return e[28]!==f||e[29]!==m?(p=o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[f,m]}),e[28]=f,e[29]=m,e[30]=p):p=e[30],p}function $ce(t){const e=U.c(7),{onClose:s}=t,n=ue();let r;e[0]!==n?(r=n("routes.commerceOnboarding.connectModal.loadError"),e[0]=n,e[1]=r):r=e[1];let i;e[2]!==r?(i=o.jsx("p",{className:"text-sm text-muted-foreground",children:r}),e[2]=r,e[3]=i):i=e[3];let a;return e[4]!==s||e[5]!==i?(a=o.jsx(_g,{onClose:s,footer:null,children:i}),e[4]=s,e[5]=i,e[6]=a):a=e[6],a}function Bce(){const t=U.c(10),{closePanel:e}=pi();let s;t[0]!==e?(s=()=>e(),t[0]=e,t[1]=s):s=t[1];const n=s;let r;t[2]!==n?(r=()=>o.jsx($ce,{onClose:n}),t[2]=n,t[3]=r):r=t[3];let i;t[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(yE,{}),t[4]=i):i=t[4];let a;t[5]!==n?(a=o.jsx(P.Suspense,{fallback:o.jsx(_g,{onClose:n,footer:null,children:i}),children:o.jsx(zce,{onDone:n,onClose:n})}),t[5]=n,t[6]=a):a=t[6];let l;return t[7]!==r||t[8]!==a?(l=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(sn,{fallback:r,children:a})}),t[7]=r,t[8]=a,t[9]=l):l=t[9],l}function zce(t){const e=U.c(46),{onDone:s,onClose:n}=t,r=ue(),{org:i}=Fe();let a;e[0]!==i.id?(a=Ud.COMMERCE_DISCOVERY(i.id),e[0]=i.id,e[1]=a):a=e[1];const l=a;let c;e[2]!==i.id||e[3]!==i.slug?(c={connectionId:qu,orgId:i.id,orgSlug:i.slug},e[2]=i.id,e[3]=i.slug,e[4]=c):c=e[4];const d=Vn(c);let h;e[5]!==l||e[6]!==i||e[7]!==d?(h={selfClient:d,org:i,cdConnectionId:l},e[5]=l,e[6]=i,e[7]=d,e[8]=h):h=e[8];const u=_E(h),[f,m]=P.useState(!1),[p,g]=P.useState(null);let x;e[9]!==d?(x={mutationFn:async A=>l7(await d.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:A}})),retry:!1},e[9]=d,e[10]=x):x=e[10];const b=Rs(x);let v;e[11]!==s||e[12]!==b||e[13]!==u||e[14]!==r?(v=async()=>{if(g(null),u)try{await b.mutateAsync(u)}catch{g(r("routes.commerceOnboarding.connectModal.somethingWentWrong"));return}s()},e[11]=s,e[12]=b,e[13]=u,e[14]=r,e[15]=v):v=e[15];const _=v;let L;e[16]!==p?(L=p?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:p}):null,e[16]=p,e[17]=L):L=e[17];let y;e[18]!==b.isPending||e[19]!==r?(y=b.isPending?r("routes.commerceOnboarding.connectSourcesTab.refreshing"):r("routes.commerceOnboarding.connectSourcesTab.refresh"),e[18]=b.isPending,e[19]=r,e[20]=y):y=e[20];let w;e[21]!==_?(w=()=>{_()},e[21]=_,e[22]=w):w=e[22];let S;e[23]!==f||e[24]!==b.isPending||e[25]!==y||e[26]!==w?(S=o.jsx(nE,{ready:f,pending:b.isPending,label:y,onClick:w}),e[23]=f,e[24]=b.isPending,e[25]=y,e[26]=w,e[27]=S):S=e[27];let k;e[28]!==L||e[29]!==S?(k=o.jsxs(o.Fragment,{children:[L,S]}),e[28]=L,e[29]=S,e[30]=k):k=e[30];let j;e[31]!==r?(j=r("routes.commerceOnboarding.connectSourcesTab.title"),e[31]=r,e[32]=j):j=e[32];let N;e[33]!==j?(N=o.jsx("h2",{className:"text-xl font-medium leading-tight text-foreground",children:j}),e[33]=j,e[34]=N):N=e[34];let V;e[35]!==l||e[36]!==i||e[37]!==u?(V=o.jsx(LE,{org:i,cdConnectionId:l,siteUrl:u,onReadinessChange:m}),e[35]=l,e[36]=i,e[37]=u,e[38]=V):V=e[38];let C;e[39]!==N||e[40]!==V?(C=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto",children:[N,V]}),e[39]=N,e[40]=V,e[41]=C):C=e[41];let T;return e[42]!==n||e[43]!==k||e[44]!==C?(T=o.jsx(_g,{onClose:n,footer:k,children:C}),e[42]=n,e[43]=k,e[44]=C,e[45]=T):T=e[45],T}const Fce=P.lazy(()=>Ks(()=>import("./project-app-view-_pt7eBEE.js"),__vite__mapDeps([185,1,2,81,30,31,32,33,34,35,36,37,38,39,40,25,29,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,82,83,84,10,11,12,19,85,86,87,88,89,90,91,92,93,94,95,96,24,4,5,9,13,14,15,16,17,3,6,7,8,18,20,21,22,23,28,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,74,115,146,159,121,122,123,160,155,130,131,161,116,117,73,118,119,120,124,125,126,127,128,129,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,147,148,149,150,72,151,152,79,153,154,156,157,158,162,163,164,76,165,166,167])).then(t=>({default:t.AppViewContent})));function Uce(){const t=U.c(12),{diagnostic:e,isLoading:s,siteUrl:n,connectionId:r}=i7();if(s){let d;return t[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Pa,{}),t[0]=d):d=t[0],d}if(e){let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Pa,{}),t[1]=d):d=t[1];let h;return t[2]!==r?(h=o.jsx(P.Suspense,{fallback:d,children:o.jsx(Fce,{connectionId:r,toolName:cT})}),t[2]=r,t[3]=h):h=t[3],h}let i;t[4]!==n?(i=()=>o.jsx(Lj,{claimedSiteUrl:n}),t[4]=n,t[5]=i):i=t[5];let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(Pa,{}),t[6]=a):a=t[6];let l;t[7]!==n?(l=o.jsx(P.Suspense,{fallback:a,children:o.jsx(Kce,{claimedSiteUrl:n})}),t[7]=n,t[8]=l):l=t[8];let c;return t[9]!==i||t[10]!==l?(c=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsx(sn,{fallback:i,children:l})}),t[9]=i,t[10]=l,t[11]=c):c=t[11],c}const Hce=["reports.emptyState.checkPerformance","reports.emptyState.checkSeo","reports.emptyState.checkFunnel","reports.emptyState.checkTracking"];function Lj(t){const e=U.c(27),{claimedSiteUrl:s,children:n}=t,r=ue(),i=s??void 0;let a;e[0]!==i?(a=Km(i),e[0]=i,e[1]=a):a=e[1];const l=a;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsxs("div",{className:"relative flex items-end justify-center pt-4",children:[o.jsx("div",{"aria-hidden":!0,className:"absolute -bottom-6 size-56 rounded-full bg-success/10 blur-3xl"}),o.jsx(np,{className:"relative h-52 w-40 -rotate-6"}),o.jsx(np,{className:"relative -ml-14 h-56 w-44 rotate-3"})]}),e[2]=c):c=e[2];let d;e[3]!==r?(d=r("reports.emptyState.title"),e[3]=r,e[4]=d):d=e[4];let h;e[5]!==d?(h=o.jsx("h2",{className:"text-lg font-medium leading-7 text-foreground",children:d}),e[5]=d,e[6]=h):h=e[6];let u;e[7]!==r?(u=r("reports.emptyState.description"),e[7]=r,e[8]=u):u=e[8];let f;e[9]!==u?(f=o.jsx("p",{className:"max-w-sm text-sm leading-5 text-muted-foreground",children:u}),e[9]=u,e[10]=f):f=e[10];let m;e[11]!==h||e[12]!==f?(m=o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[h,f]}),e[11]=h,e[12]=f,e[13]=m):m=e[13];let p;e[14]!==n||e[15]!==l?(p=n??(l?o.jsx("p",{className:"text-sm text-muted-foreground",children:l}):null),e[14]=n,e[15]=l,e[16]=p):p=e[16];let g;e[17]!==r?(g=Hce.map(_=>o.jsx("li",{className:"rounded-full border border-border bg-card px-3 py-1 text-xs text-muted-foreground",children:r(_)},_)),e[17]=r,e[18]=g):g=e[18];let x;e[19]!==g?(x=o.jsx("ul",{className:"flex flex-wrap items-center justify-center gap-2",children:g}),e[19]=g,e[20]=x):x=e[20];let b;e[21]!==x||e[22]!==p?(b=o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4",children:[p,x]}),e[21]=x,e[22]=p,e[23]=b):b=e[23];let v;return e[24]!==b||e[25]!==m?(v=o.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-8 p-6",children:[c,m,b]}),e[24]=b,e[25]=m,e[26]=v):v=e[26],v}function Kce(t){const e=U.c(46),{claimedSiteUrl:s}=t,n=ue(),r=on(),{org:i}=Fe();let a;e[0]!==i.id||e[1]!==i.slug?(a={connectionId:qu,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=a):a=e[2];const l=Vn(a);let c;e[3]!==s?(c=Km(s??void 0)??"",e[3]=s,e[4]=c):c=e[4];const[d,h]=P.useState(c),[u,f]=P.useState(null);let m;e[5]!==l?(m={mutationFn:async R=>l7(await l.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:R}})),retry:!1},e[5]=l,e[6]=m):m=e[6];const p=Rs(m);let g;e[7]!==r||e[8]!==i.id||e[9]!==i.slug||e[10]!==p?(g=async R=>{const E=wE(R);if(!E.ok){f(E.error);return}f(null);const I=Km(E.value)??void 0;Ye("reports_start_diagnostic_submitted",{organization_id:i.id,domain:I});try{await p.mutateAsync(E.value)}catch(D){const O=D;Ye("reports_start_diagnostic_failed",{organization_id:i.id,domain:I,error:O instanceof Error?O.message:String(O)}),f(O instanceof Error?O.message:"__configurationFailed");return}r({to:Ca.agents,params:{org:i.slug,panel:void 0},search:{virtualmcpid:ia(i.id).id,connect:"1",siteUrl:E.value}})},e[7]=r,e[8]=i.id,e[9]=i.slug,e[10]=p,e[11]=g):g=e[11];const x=g;let b;e[12]!==d||e[13]!==x?(b=R=>{R.preventDefault(),x(d)},e[12]=d,e[13]=x,e[14]=b):b=e[14];const v=b;let _;e[15]!==n?(_=n("reports.emptyState.siteUrlLabel"),e[15]=n,e[16]=_):_=e[16];let L;e[17]===Symbol.for("react.memo_cache_sentinel")?(L=R=>h(R.target.value),e[17]=L):L=e[17];let y;e[18]!==n?(y=n("reports.emptyState.siteUrlPlaceholder"),e[18]=n,e[19]=y):y=e[19];const w=!!u;let S;e[20]!==p.isPending||e[21]!==d||e[22]!==_||e[23]!==y||e[24]!==w?(S=o.jsx(yt,{"aria-label":_,type:"text",inputMode:"url",className:"min-w-0 flex-1",value:d,onChange:L,placeholder:y,"aria-invalid":w,disabled:p.isPending}),e[20]=p.isPending,e[21]=d,e[22]=_,e[23]=y,e[24]=w,e[25]=S):S=e[25];let k;e[26]!==p.isPending||e[27]!==n?(k=p.isPending?n("reports.emptyState.starting"):n("reports.emptyState.start"),e[26]=p.isPending,e[27]=n,e[28]=k):k=e[28];let j;e[29]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(ro,{size:16}),e[29]=j):j=e[29];let N;e[30]!==p.isPending||e[31]!==k?(N=o.jsxs(me,{type:"submit",className:"shrink-0",disabled:p.isPending,children:[k,j]}),e[30]=p.isPending,e[31]=k,e[32]=N):N=e[32];let V;e[33]!==S||e[34]!==N?(V=o.jsxs("div",{className:"flex flex-col items-stretch gap-2 sm:flex-row sm:items-center",children:[S,N]}),e[33]=S,e[34]=N,e[35]=V):V=e[35];let C;e[36]!==u||e[37]!==n?(C=u?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:AE(n,u)}):null,e[36]=u,e[37]=n,e[38]=C):C=e[38];let T;e[39]!==v||e[40]!==V||e[41]!==C?(T=o.jsxs("form",{className:"flex w-full flex-col gap-2",onSubmit:v,children:[V,C]}),e[39]=v,e[40]=V,e[41]=C,e[42]=T):T=e[42];let A;return e[43]!==s||e[44]!==T?(A=o.jsx(Lj,{claimedSiteUrl:s,children:T}),e[43]=s,e[44]=T,e[45]=A):A=e[45],A}function Wce(t){return[Ud.SELF(t),Ud.REGISTRY(t),Ud.COMMUNITY_REGISTRY(t),Ud.DEV_ASSETS(t)]}function qce(t,e){const s=new Set(Wce(e));return t.some(n=>!s.has(n.id))}function Gce(){const t=U.c(78),e=ue(),{org:s}=Fe(),n=ui();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={slug:"mcp-github"},t[0]=r):r=t[0];const i=ui(r),{projects:a}=Zu(),l=u9();let c;t[1]!==s.slug?(c={org:s.slug},t[1]=s.slug,t[2]=c):c=t[2];const d=c;let h;t[3]!==e?(h=e("discover.setup.connectTitle"),t[3]=e,t[4]=h):h=t[4];let u;t[5]!==e?(u=e("discover.setup.connectBody"),t[5]=e,t[6]=u):u=t[6];let f;t[7]!==n||t[8]!==s.id?(f=qce(n,s.id),t[7]=n,t[8]=s.id,t[9]=f):f=t[9];let m;t[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Ia,{size:18}),t[10]=m):m=t[10];let p;t[11]===Symbol.for("react.memo_cache_sentinel")?(p={tab:"all"},t[11]=p):p=t[11];let g;t[12]!==e?(g=e("discover.setup.connectAction"),t[12]=e,t[13]=g):g=t[13];let x;t[14]!==d||t[15]!==g?(x=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Do,{to:"/$org/settings/connections",params:d,search:p,children:g})}),t[14]=d,t[15]=g,t[16]=x):x=t[16];let b;t[17]!==h||t[18]!==u||t[19]!==f||t[20]!==x?(b={key:"connect",title:h,body:u,done:f,icon:m,action:x},t[17]=h,t[18]=u,t[19]=f,t[20]=x,t[21]=b):b=t[21];let v;t[22]!==e?(v=e("discover.setup.githubTitle"),t[22]=e,t[23]=v):v=t[23];let _;t[24]!==e?(_=e("discover.setup.githubBody"),t[24]=e,t[25]=_):_=t[25];const L=i.length>0;let y;t[26]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Ir,{className:"size-[18px]"}),t[26]=y):y=t[26];let w;t[27]===Symbol.for("react.memo_cache_sentinel")?(w={tab:"all"},t[27]=w):w=t[27];let S;t[28]!==e?(S=e("discover.setup.githubAction"),t[28]=e,t[29]=S):S=t[29];let k;t[30]!==d||t[31]!==S?(k=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Do,{to:"/$org/settings/connections",params:d,search:w,children:S})}),t[30]=d,t[31]=S,t[32]=k):k=t[32];let j;t[33]!==v||t[34]!==_||t[35]!==L||t[36]!==k?(j={key:"github",title:v,body:_,done:L,icon:y,action:k},t[33]=v,t[34]=_,t[35]=L,t[36]=k,t[37]=j):j=t[37];let N;t[38]!==e?(N=e("discover.setup.projectTitle"),t[38]=e,t[39]=N):N=t[39];let V;t[40]!==e?(V=e("discover.setup.projectBody"),t[40]=e,t[41]=V):V=t[41];const C=a.length>0;let T;t[42]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Qt,{size:18}),t[42]=T):T=t[42];let A;t[43]!==s.slug?(A={org:s.slug,panel:void 0},t[43]=s.slug,t[44]=A):A=t[44];let R;t[45]===Symbol.for("react.memo_cache_sentinel")?(R={virtualmcpid:void 0},t[45]=R):R=t[45];let E;t[46]!==e?(E=e("discover.setup.projectAction"),t[46]=e,t[47]=E):E=t[47];let I;t[48]!==A||t[49]!==E?(I=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Do,{to:Ca.agents,params:A,search:R,children:E})}),t[48]=A,t[49]=E,t[50]=I):I=t[50];let D;t[51]!==N||t[52]!==V||t[53]!==C||t[54]!==I?(D={key:"project",title:N,body:V,done:C,icon:T,action:I},t[51]=N,t[52]=V,t[53]=C,t[54]=I,t[55]=D):D=t[55];let O;t[56]!==e?(O=e("discover.setup.inviteTitle"),t[56]=e,t[57]=O):O=t[57];let $;t[58]!==e?($=e("discover.setup.inviteBody"),t[58]=e,t[59]=$):$=t[59];let M;t[60]!==l.data?.data?.members?(M=l.data?.data?.members??[],t[60]=l.data?.data?.members,t[61]=M):M=t[61];const z=M.length>1;let F;t[62]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(g9,{size:18}),t[62]=F):F=t[62];let B;t[63]!==e?(B=e("discover.setup.inviteAction"),t[63]=e,t[64]=B):B=t[64];let H;t[65]!==d||t[66]!==B?(H=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Do,{to:"/$org/settings/members",params:d,children:B})}),t[65]=d,t[66]=B,t[67]=H):H=t[67];let W;t[68]!==O||t[69]!==$||t[70]!==z||t[71]!==H?(W={key:"invite",title:O,body:$,done:z,icon:F,action:H},t[68]=O,t[69]=$,t[70]=z,t[71]=H,t[72]=W):W=t[72];let K;return t[73]!==j||t[74]!==D||t[75]!==W||t[76]!==b?(K=[b,j,D,W],t[73]=j,t[74]=D,t[75]=W,t[76]=b,t[77]=K):K=t[77],K}function Yce(){const t=U.c(51),e=ue(),{projects:s}=Zu();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={slug:"mcp-github"},t[0]=n):n=t[0];const r=ui(n),i=kg();let a;t[1]!==s?(a=s.some(Xce),t[1]=s,t[2]=a):a=t[2];const l=a;let c;t[3]!==s?(c=s.some(Qce),t[3]=s,t[4]=c):c=t[4];const d=c;let h;if(t[5]!==i||t[6]!==s){let A;t[8]!==i?(A=R=>o9(i.data?.configs??[],u7(R)),t[8]=i,t[9]=A):A=t[9],h=s.some(A),t[5]=i,t[6]=s,t[7]=h}else h=t[7];const u=h;let f;t[10]!==e?(f=e("discover.capabilities.previewTitle"),t[10]=e,t[11]=f):f=t[11];let m;t[12]!==e?(m=e("discover.capabilities.previewRequirement"),t[12]=e,t[13]=m):m=t[13];let p;t[14]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Mr,{size:18}),t[14]=p):p=t[14];let g;t[15]!==l||t[16]!==f||t[17]!==m?(g={key:"preview",title:f,requirement:m,satisfied:l,icon:p},t[15]=l,t[16]=f,t[17]=m,t[18]=g):g=t[18];let x;t[19]!==e?(x=e("discover.capabilities.gitTitle"),t[19]=e,t[20]=x):x=t[20];let b;t[21]!==e?(b=e("discover.capabilities.gitRequirement"),t[21]=e,t[22]=b):b=t[22];const v=r.length>0&&l;let _;t[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ir,{className:"size-[18px]"}),t[23]=_):_=t[23];let L;t[24]!==v||t[25]!==x||t[26]!==b?(L={key:"git",title:x,requirement:b,satisfied:v,icon:_},t[24]=v,t[25]=x,t[26]=b,t[27]=L):L=t[27];let y;t[28]!==e?(y=e("discover.capabilities.contentTitle"),t[28]=e,t[29]=y):y=t[29];let w;t[30]!==e?(w=e("discover.capabilities.contentRequirement"),t[30]=e,t[31]=w):w=t[31];let S;t[32]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Mr,{size:18}),t[32]=S):S=t[32];let k;t[33]!==d||t[34]!==y||t[35]!==w?(k={key:"content",title:y,requirement:w,satisfied:d,icon:S},t[33]=d,t[34]=y,t[35]=w,t[36]=k):k=t[36];let j;t[37]!==e?(j=e("discover.capabilities.assetsTitle"),t[37]=e,t[38]=j):j=t[38];let N;t[39]!==e?(N=e("discover.capabilities.assetsRequirement"),t[39]=e,t[40]=N):N=t[40];let V;t[41]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(ar,{size:18}),t[41]=V):V=t[41];let C;t[42]!==u||t[43]!==j||t[44]!==N?(C={key:"assets",title:j,requirement:N,satisfied:u,icon:V},t[42]=u,t[43]=j,t[44]=N,t[45]=C):C=t[45];let T;return t[46]!==L||t[47]!==k||t[48]!==C||t[49]!==g?(T=[g,L,k,C],t[46]=L,t[47]=k,t[48]=C,t[49]=g,t[50]=T):T=t[50],T}function Qce(t){return!!la(t)&&c0(t.metadata?.ui?.layout)!=="off"}function Xce(t){return la(t)}function om(t){const e=U.c(10),{title:s,description:n,children:r}=t;let i;e[0]!==s?(i=o.jsx("h2",{className:"text-base font-semibold text-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let a;e[2]!==n?(a=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:n}),e[2]=n,e[3]=a):a=e[3];let l;e[4]!==i||e[5]!==a?(l=o.jsxs("div",{className:"flex flex-col gap-1",children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6];let c;return e[7]!==r||e[8]!==l?(c=o.jsxs("section",{className:"flex flex-col gap-3",children:[l,r]}),e[7]=r,e[8]=l,e[9]=c):c=e[9],c}function Jce(){const t=U.c(63),e=ue(),{org:s}=Fe(),n=Gce(),r=Yce();let i;t[0]!==n?(i=n.filter(tde),t[0]=n,t[1]=i):i=t[1];const a=i;let l;t[2]!==e?(l=e("discover.title"),t[2]=e,t[3]=l):l=t[3];let c;t[4]!==l?(c=o.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:l}),t[4]=l,t[5]=c):c=t[5];let d;t[6]!==e?(d=e("discover.subtitle"),t[6]=e,t[7]=d):d=t[7];let h;t[8]!==d?(h=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:d}),t[8]=d,t[9]=h):h=t[9];let u;t[10]!==c||t[11]!==h?(u=o.jsxs("header",{className:"flex flex-col gap-2",children:[c,h]}),t[10]=c,t[11]=h,t[12]=u):u=t[12];let f;t[13]!==e?(f=e("discover.setup.title"),t[13]=e,t[14]=f):f=t[14];let m;t[15]!==a.length||t[16]!==e?(m=a.length===0?e("discover.setup.allDone"):e("discover.setup.description"),t[15]=a.length,t[16]=e,t[17]=m):m=t[17];let p;t[18]!==n?(p=n.map(ede),t[18]=n,t[19]=p):p=t[19];let g;t[20]!==p?(g=o.jsx("ul",{className:"flex flex-col gap-2",children:p}),t[20]=p,t[21]=g):g=t[21];let x;t[22]!==f||t[23]!==m||t[24]!==g?(x=o.jsx(om,{title:f,description:m,children:g}),t[22]=f,t[23]=m,t[24]=g,t[25]=x):x=t[25];let b;t[26]!==e?(b=e("discover.capabilities.title"),t[26]=e,t[27]=b):b=t[27];let v;t[28]!==e?(v=e("discover.capabilities.description"),t[28]=e,t[29]=v):v=t[29];let _;if(t[30]!==r||t[31]!==e){let R;t[33]!==e?(R=E=>o.jsxs("li",{className:"flex items-start gap-3 rounded-xl border border-border bg-card p-4",children:[o.jsx("span",{className:le("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg",E.satisfied?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:E.satisfied?o.jsx($t,{size:18}):E.icon}),o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:E.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:E.satisfied?e("discover.capabilities.ready"):E.requirement})]})]},E.key),t[33]=e,t[34]=R):R=t[34],_=r.map(R),t[30]=r,t[31]=e,t[32]=_}else _=t[32];let L;t[35]!==_?(L=o.jsx("ul",{className:"grid gap-2 sm:grid-cols-2",children:_}),t[35]=_,t[36]=L):L=t[36];let y;t[37]!==b||t[38]!==v||t[39]!==L?(y=o.jsx(om,{title:b,description:v,children:L}),t[37]=b,t[38]=v,t[39]=L,t[40]=y):y=t[40];let w;t[41]!==e?(w=e("discover.catalog.title"),t[41]=e,t[42]=w):w=t[42];let S;t[43]!==e?(S=e("discover.catalog.description"),t[43]=e,t[44]=S):S=t[44];let k;t[45]!==s.slug?(k={org:s.slug},t[45]=s.slug,t[46]=k):k=t[46];let j;t[47]===Symbol.for("react.memo_cache_sentinel")?(j={tab:"all"},t[47]=j):j=t[47];let N;t[48]!==e?(N=e("discover.catalog.action"),t[48]=e,t[49]=N):N=t[49];let V;t[50]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(ro,{size:18}),t[50]=V):V=t[50];let C;t[51]!==k||t[52]!==N?(C=o.jsx("div",{children:o.jsx(me,{asChild:!0,size:"lg",children:o.jsxs(Do,{to:"/$org/settings/connections",params:k,search:j,onClick:Zce,children:[N,V]})})}),t[51]=k,t[52]=N,t[53]=C):C=t[53];let T;t[54]!==w||t[55]!==S||t[56]!==C?(T=o.jsx(om,{title:w,description:S,children:C}),t[54]=w,t[55]=S,t[56]=C,t[57]=T):T=t[57];let A;return t[58]!==x||t[59]!==y||t[60]!==T||t[61]!==u?(A=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-10 p-6 md:p-10",children:[u,x,y,T]})}),t[58]=x,t[59]=y,t[60]=T,t[61]=u,t[62]=A):A=t[62],A}function Zce(){return Ye("discover_catalog_opened",{})}function ede(t){return o.jsxs("li",{className:le("flex items-start gap-3 rounded-xl border border-border bg-card p-4",t.done&&"opacity-60"),children:[o.jsx("span",{className:le("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg",t.done?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:t.done?o.jsx($t,{size:18}):t.icon}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:t.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:t.body})]}),!t.done&&o.jsx("div",{className:"shrink-0",children:t.action})]},t.key)}function tde(t){return!t.done}function sde(t){const e=U.c(52),{readUrl:s,editor:n,downloadName:r,trailing:i}=t,a=ue();let l;e[0]!==s?(l=new URL(s,window.location.origin).toString(),e[0]=s,e[1]=l):l=e[1];const c=l;let d;e[2]!==n||e[3]!==a?(d=n.deckDetected&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:n.railOpen?"secondary":"ghost",size:"icon","aria-label":n.railOpen?a("deck.deckToolbar.hideSlideList"):a("deck.deckToolbar.showSlideList"),onClick:()=>n.setRailOpen(!n.railOpen),children:o.jsx(a6,{size:14})})}),o.jsx(We,{side:"bottom",children:n.railOpen?a("deck.deckToolbar.hideSlideList"):a("deck.deckToolbar.showSlideList")})]}),e[2]=n,e[3]=a,e[4]=d):d=e[4];let h;e[5]!==c?(h=()=>window.open(c,"_blank","noopener"),e[5]=c,e[6]=h):h=e[6];let u;e[7]!==c?(u=o.jsx("span",{className:"truncate",children:c}),e[7]=c,e[8]=u):u=e[8];let f;e[9]!==c||e[10]!==h||e[11]!==u?(f=o.jsx("button",{type:"button",onClick:h,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:c,children:u}),e[9]=c,e[10]=h,e[11]=u,e[12]=f):f=e[12];let m;e[13]!==n.agentUpdated||e[14]!==n.reload||e[15]!==a?(m=n.agentUpdated&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx(Mn,{size:12}),a("deck.deckToolbar.agentUpdatedReload")]})}),o.jsx(We,{side:"bottom",children:a("deck.deckToolbar.agentRewriteWarning")})]}),e[13]=n.agentUpdated,e[14]=n.reload,e[15]=a,e[16]=m):m=e[16];let p;e[17]!==n.saving||e[18]!==a?(p=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:a("deck.deckToolbar.saving")}),e[17]=n.saving,e[18]=a,e[19]=p):p=e[19];let g;e[20]!==n||e[21]!==a?(g=n.deckDetected&&n.writable&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?a("deck.deckToolbar.doneEditing"):a("deck.deckToolbar.editInline"),className:le(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(Z6,{size:14})})}),o.jsx(We,{side:"bottom",children:n.editMode?a("deck.deckToolbar.doneEditing"):a("deck.deckToolbar.editInlineTooltip")})]}),e[20]=n,e[21]=a,e[22]=g):g=e[22];let x;e[23]!==c||e[24]!==r||e[25]!==n.deckDetected||e[26]!==a?(x=n.deckDetected?o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":a("deck.deckToolbar.download"),children:o.jsx(Su,{size:14})})}),o.jsxs(Ht,{align:"end",children:[o.jsxs(et,{onClick:()=>window.open(`${c}#print`,"_blank","noopener"),children:[o.jsx(sP,{size:14}),a("deck.deckToolbar.exportAsPdf")]}),o.jsx(et,{asChild:!0,children:o.jsxs("a",{href:c,download:r,children:[o.jsx(s9,{size:14}),a("deck.deckToolbar.downloadHtml")]})})]})]}):o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":a("deck.deckToolbar.download"),asChild:!0,children:o.jsx("a",{href:c,download:r,children:o.jsx(Su,{size:14})})})}),o.jsx(We,{side:"bottom",children:a("deck.deckToolbar.download")})]}),e[23]=c,e[24]=r,e[25]=n.deckDetected,e[26]=a,e[27]=x):x=e[27];let b;e[28]!==a?(b=a("deck.deckToolbar.openInNewTab"),e[28]=a,e[29]=b):b=e[29];let v;e[30]!==c?(v=()=>window.open(c,"_blank","noopener"),e[30]=c,e[31]=v):v=e[31];let _;e[32]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(fn,{size:14}),e[32]=_):_=e[32];let L;e[33]!==b||e[34]!==v?(L=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":b,onClick:v,children:_})}),e[33]=b,e[34]=v,e[35]=L):L=e[35];let y;e[36]!==a?(y=a("deck.deckToolbar.openInNewTab"),e[36]=a,e[37]=y):y=e[37];let w;e[38]!==y?(w=o.jsx(We,{side:"bottom",children:y}),e[38]=y,e[39]=w):w=e[39];let S;e[40]!==L||e[41]!==w?(S=o.jsxs(qe,{children:[L,w]}),e[40]=L,e[41]=w,e[42]=S):S=e[42];let k;return e[43]!==S||e[44]!==d||e[45]!==f||e[46]!==m||e[47]!==p||e[48]!==g||e[49]!==x||e[50]!==i?(k=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,f,m,p,g,x,S,i]}),e[43]=S,e[44]=d,e[45]=f,e[46]=m,e[47]=p,e[48]=g,e[49]=x,e[50]=i,e[51]=k):k=e[51],k}const Nc=1;function nde(t){if(typeof t!="object"||t===null||t.v!==Nc||t.source!=="deck-viewer")return null;const e=t;return e.type==="ready"||e.type==="state"||e.type==="op"&&typeof e.opId=="string"&&e.op?e:null}class To extends Error{constructor(e,s){super(e),this.code=s,this.name="DeckOpError"}code}function wj(t){return[...t.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function rde(t){const s=new DOMParser().parseFromString(t,"text/html").querySelector("deck-viewer");return s?wj(s).length:null}function ide(t,e){const s=new DOMParser().parseFromString(t,"text/html"),n=s.querySelector("deck-viewer");if(!n)throw new To("no <deck-viewer> element in source","no-viewer");const r=wj(n),i=e.kind==="move"?e.from:e.at,a=r[i];if(!a)throw new To(`slide index ${i} out of range (${r.length})`,"stale-index");switch(e.kind){case"remove":{if(r.length<=1)throw new To("cannot remove the last slide","bad-op");a.remove();break}case"duplicate":{const c=a.cloneNode(!0);c.removeAttribute("id");for(const d of c.querySelectorAll("[id]"))d.removeAttribute("id");a.after(c);break}case"move":{if(e.to<0||e.to>=r.length)throw new To(`move target ${e.to} out of range`,"stale-index");if(e.to!==e.from){const c=e.to<e.from?r[e.to]:r[e.to].nextSibling;n.insertBefore(a,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new To(`invalid attribute name: ${e.name}`,"bad-op");a.setAttribute(e.name,e.value);break}case"remove-attr":{a.removeAttribute(e.name);break}case"replace":{const d=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!d)throw new To("replace html has no root element","bad-op");a.replaceWith(s.importNode(d,!0));break}default:throw new To(`unknown op kind: ${e.kind}`,"bad-op")}return`${t.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
646
+ `);if(oe.trim()){R(!0);try{Z(),Ye("automation_improve_clicked",{automation_id:t,agent_id:i,instructions_length:oe.length}),m(),await p({tiptapDoc:G_({managerAgentId:lT.AUTOMATION_MANAGER(a.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:oe})})}finally{R(!1)}}},M=e.models?.tier??"smart",z=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,F=j2({defaultValues:{name:e.name,active:e.active,tier:M,modelOverride:z,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),B=F.watch("active"),[H,W]=P.useReducer(Nce,null),K=()=>{H!==null&&(Ye("automation_updated",{automation_id:t,agent_id:i,fields:Array.from(H.fields),save_count:H.saveCount,edit_duration_ms:Date.now()-H.start}),W({type:"reset"}))},q=async()=>{const J=F.control._formState.dirtyFields,oe=Object.keys(J);if(oe.length===0&&!D)return!0;const ce=F.getValues(),he=F.control._defaultValues;F.reset(ce,{keepValues:!0});const ne=D;O(!1);const Q={tier:ce.tier,...ce.modelOverride?{modelId:ce.modelOverride.modelId,credentialId:ce.modelOverride.credentialId,modelTitle:ce.modelOverride.title}:{}},de={id:t,name:ce.name,active:ce.active,models:Q,tools:ce.tools,maxAgentSteps:ce.maxAgentSteps,messages:oV(x),temperature:0};try{await l.mutateAsync(de)}catch{return F.reset(he,{keepValues:!0}),ne&&O(!0),!1}const ae=[...oe];return ne&&ae.push("messages"),W({type:"accumulate",now:Date.now(),fields:ae}),X(),!0},{schedule:G,flush:te}=Yh({save:q}),{schedule:X,flush:Z}=Yh({delayMs:3e4,save:async()=>K()});P.useEffect(()=>{const J=F.watch(()=>G());return()=>J.unsubscribe()},[]);const ee=J=>{if(b(J),!E){I(!0);return}O(!0),G()},se=async()=>{Ye("automation_test_clicked",{automation_id:t,agent_id:i});const J=await te();if(Z(),!!J){if(!x){ye.error(r("automations.automationDetail.noInstructionsConfigured"));return}try{const oe=await d.mutateAsync(t);oe.threadId&&(m(),f(oe.threadId))}catch{}}};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(me,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(n9,{size:14}),r("automations.automationDetail.backToList")]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(ps,{control:F.control,name:"name",render:({field:J})=>o.jsx(yt,{...J,placeholder:r("automations.automationDetail.automationNamePlaceholder"),className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),n&&o.jsx(me,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:o.jsx(rn,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ps,{control:F.control,name:"active",render:({field:J})=>o.jsx(rr,{checked:J.value,onCheckedChange:oe=>{J.onChange(oe),te()},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:r(B?"automations.automationDetail.active":"automations.automationDetail.inactive")}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(Y_,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:r("automations.automationDetail.starter")}),o.jsx(yce,{automationId:t,open:v,onOpenChange:_,onCustomSelect:()=>{S(!0),V(!1),j("")},onEventSelect:()=>{V(!0),S(!1)},onWebhookCreated:J=>{Ye("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),T(J)}})]}),e.triggers.length===0&&!w?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[r("automations.automationDetail.whenShouldRun")," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>_(!0),children:r("automations.automationDetail.addStarter")})," ",r("automations.automationDetail.toGetGoing")]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(J=>o.jsx(_ce,{trigger:J,automationId:t,connectionName:J.connection_id?u.get(J.connection_id):void 0},J.id))}),w&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(nu,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:k,onChange:J=>j(J.target.value),onBlur:async()=>{const J=k.trim();if(!(!J||!gu(J)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:J}),Ye("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),ye.success(r("automations.automationDetail.starterAdded")),S(!1),j("")}catch{ye.error(r("automations.automationDetail.failedToAddStarter"))}},onKeyDown:async J=>{const oe=k.trim();J.key==="Enter"&&oe&&gu(oe)&&J.target.blur(),J.key==="Escape"&&(S(!1),j(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),k&&!gu(k)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:r("automations.automationDetail.invalid")}),c.isPending&&o.jsx(nt,{className:"size-[13px] text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{S(!1),j("")},children:o.jsx(lr,{size:13})})]}),N&&o.jsx(P.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(nt,{className:"size-[13px] text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:r("automations.automationDetail.loadingConnections")})]}),children:o.jsx(wce,{automationId:t,onDone:()=>V(!1)})}),o.jsx(vj,{open:C!==null,onOpenChange:J=>{J||T(null)},url:C?.url??null,token:C?.token??null})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:r("automations.automationDetail.instructions")}),o.jsxs(me,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:A||!x,onClick:$,children:[o.jsx(Fi,{size:13}),r("automations.automationDetail.improve")]})]}),o.jsx(d_,{tiptapDoc:x,setTiptapDoc:ee,placeholder:r("automations.automationDetail.instructionsPlaceholder"),children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(u_,{virtualMcpId:i||null,className:"max-h-[45vh]"}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(me,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:se,disabled:!i,children:[o.jsx(Hf,{size:16}),r("automations.automationDetail.test")]})}),o.jsx(We,{children:r("automations.automationDetail.testAutomation")})]})})]})})]}),o.jsxs(P6,{open:L,onOpenChange:y,className:"flex flex-col gap-2.5",children:[o.jsxs(V6,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:r("automations.automationDetail.advanced")}),o.jsx(ds,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),o.jsxs(T6,{className:"flex flex-col gap-5 pt-0.5",children:[o.jsx(rce,{tier:F.watch("tier"),onTierChange:J=>F.setValue("tier",J,{shouldDirty:!0}),override:F.watch("modelOverride"),onOverrideChange:J=>F.setValue("modelOverride",J,{shouldDirty:!0})}),o.jsx(lce,{agentId:i||null,value:F.watch("tools"),onChange:J=>F.setValue("tools",J,{shouldDirty:!0})}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:r("automations.automationDetail.maxSteps")}),o.jsx(yt,{type:"number",min:1,max:100,className:"w-40",placeholder:r("automations.automationDetail.maxStepsPlaceholder",{default:Cce}),value:F.watch("maxAgentSteps")??"",onChange:J=>{const oe=J.target.value.trim(),ce=oe===""?null:Number(oe);F.setValue("maxAgentSteps",ce===null||Number.isNaN(ce)?null:ce,{shouldDirty:!0})}})]})]})]})]})]})}const yj=[{key:"24h",labelKey:"mainPanelTabs.automationTab.last24hours",ms:1440*60*1e3},{key:"7d",labelKey:"mainPanelTabs.automationTab.last7days",ms:10080*60*1e3},{key:"30d",labelKey:"mainPanelTabs.automationTab.last30days",ms:720*60*60*1e3}];function _j(t){const e=yj.find(n=>n.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function Tce(t){const e=U.c(16),{automationId:s,triggerIds:n}=t,r=ue(),[i,a]=P.useState("30d"),[l,c]=P.useState(Pce);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=x=>{const b=x;a(b),c(_j(b))},e[0]=d):d=e[0];let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(bs,{className:"w-44",children:o.jsx(js,{})}),e[1]=h):h=e[1];let u;e[2]!==r?(u=yj.map(x=>o.jsx(It,{value:x.key,children:r(x.labelKey)},x.key)),e[2]=r,e[3]=u):u=e[3];let f;e[4]!==u?(f=o.jsx(vs,{children:u}),e[4]=u,e[5]=f):f=e[5];let m;e[6]!==f||e[7]!==i?(m=o.jsx("div",{className:"flex items-center justify-end",children:o.jsxs(xs,{value:i,onValueChange:d,children:[h,f]})}),e[6]=f,e[7]=i,e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==l||e[11]!==n?(p=o.jsx(QV,{automationId:s,triggerIds:n,range:l}),e[9]=s,e[10]=l,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"flex flex-col gap-5",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function Pce(){return _j("30d")}function Ace(t){const e=U.c(5),{tabId:s}=t;let n;e[0]!==s?(n=n6(s),e[0]=s,e[1]=n):n=e[1];const r=n;if(!r)return null;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Pa,{}),e[2]=i):i=e[2];let a;return e[3]!==r.id?(a=o.jsx(P.Suspense,{fallback:i,children:o.jsx(Ece,{id:r.id})}),e[3]=r.id,e[4]=a):a=e[4],a}function Ece(t){const e=U.c(41),{id:s}=t,n=ue(),{openPanel:r}=pi(),{data:i,isLoading:a}=NE(s),[l,c]=P.useState("settings");let d;e[0]!==r?(d=()=>r("automations"),e[0]=r,e[1]=d):d=e[1];const h=d;if(a){let N;return e[2]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(Pa,{}),e[2]=N):N=e[2],N}if(!i){let N;e[3]!==n?(N=n("mainPanelTabs.automationTab.automationNotFound"),e[3]=n,e[4]=N):N=e[4];let V;return e[5]!==N?(V=o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:N}),e[5]=N,e[6]=V):V=e[6],V}let u;e[7]!==i.triggers?(u=i.triggers.map(Rce),e[7]=i.triggers,e[8]=u):u=e[8];const f=u;let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(n9,{size:14}),e[9]=m):m=e[9];let p;e[10]!==n?(p=n("mainPanelTabs.automationTab.backToList"),e[10]=n,e[11]=p):p=e[11];let g;e[12]!==h||e[13]!==p?(g=o.jsxs(me,{variant:"ghost",size:"sm",onClick:h,children:[m,p]}),e[12]=h,e[13]=p,e[14]=g):g=e[14];let x;e[15]!==n?(x=n("mainPanelTabs.automationTab.settings"),e[15]=n,e[16]=x):x=e[16];let b;e[17]!==x?(b={id:"settings",label:x},e[17]=x,e[18]=b):b=e[18];let v;e[19]!==n?(v=n("mainPanelTabs.automationTab.runs"),e[19]=n,e[20]=v):v=e[20];let _;e[21]!==v?(_={id:"runs",label:v},e[21]=v,e[22]=_):_=e[22];let L;e[23]!==b||e[24]!==_?(L=[b,_],e[23]=b,e[24]=_,e[25]=L):L=e[25];let y;e[26]===Symbol.for("react.memo_cache_sentinel")?(y=N=>c(N),e[26]=y):y=e[26];let w;e[27]!==L||e[28]!==l?(w=o.jsx(G8,{tabs:L,activeTab:l,onTabChange:y}),e[27]=L,e[28]=l,e[29]=w):w=e[29];let S;e[30]!==w||e[31]!==g?(S=o.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[g,w]}),e[30]=w,e[31]=g,e[32]=S):S=e[32];let k;e[33]!==i||e[34]!==s||e[35]!==l||e[36]!==f?(k=l==="settings"?o.jsx(Vce,{automationId:s,automation:i}):o.jsx(Tce,{automationId:s,triggerIds:f}),e[33]=i,e[34]=s,e[35]=l,e[36]=f,e[37]=k):k=e[37];let j;return e[38]!==S||e[39]!==k?(j=o.jsx(Dn,{children:o.jsx(Dn.Content,{children:o.jsxs(Dn.Body,{children:[S,k]})})}),e[38]=S,e[39]=k,e[40]=j):j=e[40],j}function Rce(t){return t.id}function Dce(t){const e=U.c(29),{virtualMcpId:s}=t,n=ue(),{openPanel:r}=pi(),{data:i}=VE(s),a=i===void 0?[]:i,{create:l}=a0(),[c,d]=P.useState(""),h=c.toLowerCase(),u=a.filter(E=>E.name.toLowerCase().includes(h));let f;e[0]!==r?(f=E=>r(`automation:${E}`),e[0]=r,e[1]=f):f=e[1];const m=f,p=async()=>{if(l.isPending)return;Ye("automation_new_clicked",{virtual_mcp_id:s,existing_count:a.length});const E=await l.mutateAsync(TE(s));m(E.id)},g=l.isPending;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Qt,{size:14}),e[2]=x):x=e[2];let b;e[3]!==n?(b=n("automations.automationsList.newAutomation"),e[3]=n,e[4]=b):b=e[4];let v;e[5]!==l.isPending||e[6]!==p||e[7]!==b?(v=o.jsxs(me,{size:"sm",onClick:p,disabled:g,children:[x,b]}),e[5]=l.isPending,e[6]=p,e[7]=b,e[8]=v):v=e[8];const _=v,L=Dn,y=Dn,w=Dn;let S;e[9]!==n?(S=n("automations.automationsList.title"),e[9]=n,e[10]=S):S=e[10];let k;e[11]!==S?(k=o.jsx(Dn.Title,{children:S}),e[11]=S,e[12]=k):k=e[12];const j=a.length>0&&o.jsx(p9,{value:c,onChange:d,placeholder:n("automations.automationsList.searchPlaceholder"),className:"w-full md:w-[375px]"});let N;e[13]!==_||e[14]!==j?(N=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[j,_]}),e[13]=_,e[14]=j,e[15]=N):N=e[15];let V;e[16]!==k||e[17]!==N?(V=o.jsxs("div",{className:"flex flex-col gap-6",children:[k,N]}),e[16]=k,e[17]=N,e[18]=V):V=e[18];const C=a.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Dr,{image:o.jsx(hi,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.emptyTitle"),description:n("automations.automationsList.emptyDescription"),actions:_})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Dr,{image:o.jsx(hi,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.noResultsTitle"),description:n("automations.automationsList.noResultsDescription",{search:c})})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(E=>o.jsx(PE,{automation:E,onClick:()=>m(E.id)},E.id))});let T;e[19]!==V||e[20]!==C||e[21]!==w.Body?(T=o.jsxs(w.Body,{children:[V,C]}),e[19]=V,e[20]=C,e[21]=w.Body,e[22]=T):T=e[22];let A;e[23]!==T||e[24]!==y.Content?(A=o.jsx(y.Content,{children:T}),e[23]=T,e[24]=y.Content,e[25]=A):A=e[25];let R;return e[26]!==L||e[27]!==A?(R=o.jsx(L,{children:A}),e[26]=L,e[27]=A,e[28]=R):R=e[28],R}function Mce(t){const e=U.c(3),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Pa,{}),e[0]=n):n=e[0];let r;return e[1]!==s?(r=o.jsx(P.Suspense,{fallback:n,children:o.jsx(Dce,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}function Ice(t){const e=U.c(60),{file:s,onClose:n}=t,r=ue();let i,a;e[0]!==s.filename?(i=o.jsx(Go,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),a=o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=i,e[2]=a):(i=e[1],a=e[2]);let l;e[3]!==s.size?(l=H8(s.size),e[3]=s.size,e[4]=l):l=e[4];let c;e[5]!==l?(c=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:l}),e[5]=l,e[6]=c):c=e[6];let d;e[7]!==i||e[8]!==a||e[9]!==c?(d=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[i,a,c]}),e[7]=i,e[8]=a,e[9]=c,e[10]=d):d=e[10];let h;e[11]!==r?(h=r("mainPanelTabs.fileTab.download"),e[11]=r,e[12]=h):h=e[12];let u;e[13]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Su,{size:14}),e[13]=u):u=e[13];let f;e[14]!==s.downloadUrl||e[15]!==s.filename?(f=o.jsx("a",{href:s.downloadUrl,download:s.filename,children:u}),e[14]=s.downloadUrl,e[15]=s.filename,e[16]=f):f=e[16];let m;e[17]!==h||e[18]!==f?(m=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":h,asChild:!0,children:f})}),e[17]=h,e[18]=f,e[19]=m):m=e[19];let p;e[20]!==r?(p=r("mainPanelTabs.fileTab.download"),e[20]=r,e[21]=p):p=e[21];let g;e[22]!==p?(g=o.jsx(We,{side:"bottom",children:p}),e[22]=p,e[23]=g):g=e[23];let x;e[24]!==g||e[25]!==m?(x=o.jsxs(qe,{children:[m,g]}),e[24]=g,e[25]=m,e[26]=x):x=e[26];let b;e[27]!==r?(b=r("mainPanelTabs.fileTab.openInNewTab"),e[27]=r,e[28]=b):b=e[28];let v;e[29]!==s.downloadUrl?(v=()=>window.open(s.downloadUrl,"_blank","noopener"),e[29]=s.downloadUrl,e[30]=v):v=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(fn,{size:14}),e[31]=_):_=e[31];let L;e[32]!==b||e[33]!==v?(L=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":b,onClick:v,children:_})}),e[32]=b,e[33]=v,e[34]=L):L=e[34];let y;e[35]!==r?(y=r("mainPanelTabs.fileTab.openInNewTab"),e[35]=r,e[36]=y):y=e[36];let w;e[37]!==y?(w=o.jsx(We,{side:"bottom",children:y}),e[37]=y,e[38]=w):w=e[38];let S;e[39]!==L||e[40]!==w?(S=o.jsxs(qe,{children:[L,w]}),e[39]=L,e[40]=w,e[41]=S):S=e[41];let k;e[42]!==r?(k=r("mainPanelTabs.fileTab.close"),e[42]=r,e[43]=k):k=e[43];let j;e[44]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(lr,{size:14}),e[44]=j):j=e[44];let N;e[45]!==n||e[46]!==k?(N=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":k,onClick:n,children:j})}),e[45]=n,e[46]=k,e[47]=N):N=e[47];let V;e[48]!==r?(V=r("mainPanelTabs.fileTab.close"),e[48]=r,e[49]=V):V=e[49];let C;e[50]!==V?(C=o.jsx(We,{side:"bottom",children:V}),e[50]=V,e[51]=C):C=e[51];let T;e[52]!==N||e[53]!==C?(T=o.jsxs(qe,{children:[N,C]}),e[52]=N,e[53]=C,e[54]=T):T=e[54];let A;return e[55]!==x||e[56]!==S||e[57]!==T||e[58]!==d?(A=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,x,S,T]}),e[55]=x,e[56]=S,e[57]=T,e[58]=d,e[59]=A):A=e[59],A}function Oce(t){const e=U.c(31),{fileKey:s,taskId:n}=t,r=ue(),{closePanel:i}=pi(),{data:a,isPending:l}=S6(n);let c;e[0]!==s||e[1]!==a?(c=a?.find(g=>g.key===s)??null,e[0]=s,e[1]=a,e[2]=c):c=e[2];const d=c;let h;e[3]!==i?(h=()=>i(),e[3]=i,e[4]=h):h=e[4];const u=h;if(!d){if(l){let w;return e[5]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("div",{className:"h-full w-full bg-background",children:o.jsx(F8,{})}),e[5]=w):w=e[5],w}let g;e[6]!==s?(g=s.split("/").pop()??s,e[6]=s,e[7]=g):g=e[7];let x;e[8]!==g?(x=o.jsx(Go,{filename:g,className:"h-7.5 w-6"}),e[8]=g,e[9]=x):x=e[9];let b;e[10]!==r?(b=r("mainPanelTabs.fileTab.fileNotAvailable"),e[10]=r,e[11]=b):b=e[11];let v;e[12]!==b?(v=o.jsx("span",{className:"text-sm text-muted-foreground",children:b}),e[12]=b,e[13]=v):v=e[13];let _;e[14]!==r?(_=r("mainPanelTabs.fileTab.close"),e[14]=r,e[15]=_):_=e[15];let L;e[16]!==u||e[17]!==_?(L=o.jsx(me,{variant:"ghost",size:"sm",onClick:u,children:_}),e[16]=u,e[17]=_,e[18]=L):L=e[18];let y;return e[19]!==x||e[20]!==v||e[21]!==L?(y=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[x,v,L]}),e[19]=x,e[20]=v,e[21]=L,e[22]=y):y=e[22],y}let f;e[23]!==d||e[24]!==u?(f=o.jsx(Ice,{file:d,onClose:u}),e[23]=d,e[24]=u,e[25]=f):f=e[25];let m;e[26]!==d?(m=o.jsx("div",{className:"relative min-h-0 flex-1",children:o.jsx(U8,{file:d})}),e[26]=d,e[27]=m):m=e[27];let p;return e[28]!==f||e[29]!==m?(p=o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[f,m]}),e[28]=f,e[29]=m,e[30]=p):p=e[30],p}function $ce(t){const e=U.c(7),{onClose:s}=t,n=ue();let r;e[0]!==n?(r=n("routes.commerceOnboarding.connectModal.loadError"),e[0]=n,e[1]=r):r=e[1];let i;e[2]!==r?(i=o.jsx("p",{className:"text-sm text-muted-foreground",children:r}),e[2]=r,e[3]=i):i=e[3];let a;return e[4]!==s||e[5]!==i?(a=o.jsx(_g,{onClose:s,footer:null,children:i}),e[4]=s,e[5]=i,e[6]=a):a=e[6],a}function Bce(){const t=U.c(10),{closePanel:e}=pi();let s;t[0]!==e?(s=()=>e(),t[0]=e,t[1]=s):s=t[1];const n=s;let r;t[2]!==n?(r=()=>o.jsx($ce,{onClose:n}),t[2]=n,t[3]=r):r=t[3];let i;t[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(yE,{}),t[4]=i):i=t[4];let a;t[5]!==n?(a=o.jsx(P.Suspense,{fallback:o.jsx(_g,{onClose:n,footer:null,children:i}),children:o.jsx(zce,{onDone:n,onClose:n})}),t[5]=n,t[6]=a):a=t[6];let l;return t[7]!==r||t[8]!==a?(l=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(sn,{fallback:r,children:a})}),t[7]=r,t[8]=a,t[9]=l):l=t[9],l}function zce(t){const e=U.c(46),{onDone:s,onClose:n}=t,r=ue(),{org:i}=Fe();let a;e[0]!==i.id?(a=Ud.COMMERCE_DISCOVERY(i.id),e[0]=i.id,e[1]=a):a=e[1];const l=a;let c;e[2]!==i.id||e[3]!==i.slug?(c={connectionId:qu,orgId:i.id,orgSlug:i.slug},e[2]=i.id,e[3]=i.slug,e[4]=c):c=e[4];const d=Vn(c);let h;e[5]!==l||e[6]!==i||e[7]!==d?(h={selfClient:d,org:i,cdConnectionId:l},e[5]=l,e[6]=i,e[7]=d,e[8]=h):h=e[8];const u=_E(h),[f,m]=P.useState(!1),[p,g]=P.useState(null);let x;e[9]!==d?(x={mutationFn:async A=>l7(await d.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:A}})),retry:!1},e[9]=d,e[10]=x):x=e[10];const b=Rs(x);let v;e[11]!==s||e[12]!==b||e[13]!==u||e[14]!==r?(v=async()=>{if(g(null),u)try{await b.mutateAsync(u)}catch{g(r("routes.commerceOnboarding.connectModal.somethingWentWrong"));return}s()},e[11]=s,e[12]=b,e[13]=u,e[14]=r,e[15]=v):v=e[15];const _=v;let L;e[16]!==p?(L=p?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:p}):null,e[16]=p,e[17]=L):L=e[17];let y;e[18]!==b.isPending||e[19]!==r?(y=b.isPending?r("routes.commerceOnboarding.connectSourcesTab.refreshing"):r("routes.commerceOnboarding.connectSourcesTab.refresh"),e[18]=b.isPending,e[19]=r,e[20]=y):y=e[20];let w;e[21]!==_?(w=()=>{_()},e[21]=_,e[22]=w):w=e[22];let S;e[23]!==f||e[24]!==b.isPending||e[25]!==y||e[26]!==w?(S=o.jsx(nE,{ready:f,pending:b.isPending,label:y,onClick:w}),e[23]=f,e[24]=b.isPending,e[25]=y,e[26]=w,e[27]=S):S=e[27];let k;e[28]!==L||e[29]!==S?(k=o.jsxs(o.Fragment,{children:[L,S]}),e[28]=L,e[29]=S,e[30]=k):k=e[30];let j;e[31]!==r?(j=r("routes.commerceOnboarding.connectSourcesTab.title"),e[31]=r,e[32]=j):j=e[32];let N;e[33]!==j?(N=o.jsx("h2",{className:"text-xl font-medium leading-tight text-foreground",children:j}),e[33]=j,e[34]=N):N=e[34];let V;e[35]!==l||e[36]!==i||e[37]!==u?(V=o.jsx(LE,{org:i,cdConnectionId:l,siteUrl:u,onReadinessChange:m}),e[35]=l,e[36]=i,e[37]=u,e[38]=V):V=e[38];let C;e[39]!==N||e[40]!==V?(C=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto",children:[N,V]}),e[39]=N,e[40]=V,e[41]=C):C=e[41];let T;return e[42]!==n||e[43]!==k||e[44]!==C?(T=o.jsx(_g,{onClose:n,footer:k,children:C}),e[42]=n,e[43]=k,e[44]=C,e[45]=T):T=e[45],T}const Fce=P.lazy(()=>Ks(()=>import("./project-app-view-DudFJRxH.js"),__vite__mapDeps([185,1,2,81,30,31,32,33,34,35,36,37,38,39,40,25,29,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,82,83,84,10,11,12,19,85,86,87,88,89,90,91,92,93,94,95,96,24,4,5,9,13,14,15,16,17,3,6,7,8,18,20,21,22,23,28,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,74,115,146,159,121,122,123,160,155,130,131,161,116,117,73,118,119,120,124,125,126,127,128,129,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,147,148,149,150,72,151,152,79,153,154,156,157,158,162,163,164,76,165,166,167])).then(t=>({default:t.AppViewContent})));function Uce(){const t=U.c(12),{diagnostic:e,isLoading:s,siteUrl:n,connectionId:r}=i7();if(s){let d;return t[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Pa,{}),t[0]=d):d=t[0],d}if(e){let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Pa,{}),t[1]=d):d=t[1];let h;return t[2]!==r?(h=o.jsx(P.Suspense,{fallback:d,children:o.jsx(Fce,{connectionId:r,toolName:cT})}),t[2]=r,t[3]=h):h=t[3],h}let i;t[4]!==n?(i=()=>o.jsx(Lj,{claimedSiteUrl:n}),t[4]=n,t[5]=i):i=t[5];let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(Pa,{}),t[6]=a):a=t[6];let l;t[7]!==n?(l=o.jsx(P.Suspense,{fallback:a,children:o.jsx(Kce,{claimedSiteUrl:n})}),t[7]=n,t[8]=l):l=t[8];let c;return t[9]!==i||t[10]!==l?(c=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsx(sn,{fallback:i,children:l})}),t[9]=i,t[10]=l,t[11]=c):c=t[11],c}const Hce=["reports.emptyState.checkPerformance","reports.emptyState.checkSeo","reports.emptyState.checkFunnel","reports.emptyState.checkTracking"];function Lj(t){const e=U.c(27),{claimedSiteUrl:s,children:n}=t,r=ue(),i=s??void 0;let a;e[0]!==i?(a=Km(i),e[0]=i,e[1]=a):a=e[1];const l=a;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsxs("div",{className:"relative flex items-end justify-center pt-4",children:[o.jsx("div",{"aria-hidden":!0,className:"absolute -bottom-6 size-56 rounded-full bg-success/10 blur-3xl"}),o.jsx(np,{className:"relative h-52 w-40 -rotate-6"}),o.jsx(np,{className:"relative -ml-14 h-56 w-44 rotate-3"})]}),e[2]=c):c=e[2];let d;e[3]!==r?(d=r("reports.emptyState.title"),e[3]=r,e[4]=d):d=e[4];let h;e[5]!==d?(h=o.jsx("h2",{className:"text-lg font-medium leading-7 text-foreground",children:d}),e[5]=d,e[6]=h):h=e[6];let u;e[7]!==r?(u=r("reports.emptyState.description"),e[7]=r,e[8]=u):u=e[8];let f;e[9]!==u?(f=o.jsx("p",{className:"max-w-sm text-sm leading-5 text-muted-foreground",children:u}),e[9]=u,e[10]=f):f=e[10];let m;e[11]!==h||e[12]!==f?(m=o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[h,f]}),e[11]=h,e[12]=f,e[13]=m):m=e[13];let p;e[14]!==n||e[15]!==l?(p=n??(l?o.jsx("p",{className:"text-sm text-muted-foreground",children:l}):null),e[14]=n,e[15]=l,e[16]=p):p=e[16];let g;e[17]!==r?(g=Hce.map(_=>o.jsx("li",{className:"rounded-full border border-border bg-card px-3 py-1 text-xs text-muted-foreground",children:r(_)},_)),e[17]=r,e[18]=g):g=e[18];let x;e[19]!==g?(x=o.jsx("ul",{className:"flex flex-wrap items-center justify-center gap-2",children:g}),e[19]=g,e[20]=x):x=e[20];let b;e[21]!==x||e[22]!==p?(b=o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4",children:[p,x]}),e[21]=x,e[22]=p,e[23]=b):b=e[23];let v;return e[24]!==b||e[25]!==m?(v=o.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-8 p-6",children:[c,m,b]}),e[24]=b,e[25]=m,e[26]=v):v=e[26],v}function Kce(t){const e=U.c(46),{claimedSiteUrl:s}=t,n=ue(),r=on(),{org:i}=Fe();let a;e[0]!==i.id||e[1]!==i.slug?(a={connectionId:qu,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=a):a=e[2];const l=Vn(a);let c;e[3]!==s?(c=Km(s??void 0)??"",e[3]=s,e[4]=c):c=e[4];const[d,h]=P.useState(c),[u,f]=P.useState(null);let m;e[5]!==l?(m={mutationFn:async R=>l7(await l.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:R}})),retry:!1},e[5]=l,e[6]=m):m=e[6];const p=Rs(m);let g;e[7]!==r||e[8]!==i.id||e[9]!==i.slug||e[10]!==p?(g=async R=>{const E=wE(R);if(!E.ok){f(E.error);return}f(null);const I=Km(E.value)??void 0;Ye("reports_start_diagnostic_submitted",{organization_id:i.id,domain:I});try{await p.mutateAsync(E.value)}catch(D){const O=D;Ye("reports_start_diagnostic_failed",{organization_id:i.id,domain:I,error:O instanceof Error?O.message:String(O)}),f(O instanceof Error?O.message:"__configurationFailed");return}r({to:Ca.agents,params:{org:i.slug,panel:void 0},search:{virtualmcpid:ia(i.id).id,connect:"1",siteUrl:E.value}})},e[7]=r,e[8]=i.id,e[9]=i.slug,e[10]=p,e[11]=g):g=e[11];const x=g;let b;e[12]!==d||e[13]!==x?(b=R=>{R.preventDefault(),x(d)},e[12]=d,e[13]=x,e[14]=b):b=e[14];const v=b;let _;e[15]!==n?(_=n("reports.emptyState.siteUrlLabel"),e[15]=n,e[16]=_):_=e[16];let L;e[17]===Symbol.for("react.memo_cache_sentinel")?(L=R=>h(R.target.value),e[17]=L):L=e[17];let y;e[18]!==n?(y=n("reports.emptyState.siteUrlPlaceholder"),e[18]=n,e[19]=y):y=e[19];const w=!!u;let S;e[20]!==p.isPending||e[21]!==d||e[22]!==_||e[23]!==y||e[24]!==w?(S=o.jsx(yt,{"aria-label":_,type:"text",inputMode:"url",className:"min-w-0 flex-1",value:d,onChange:L,placeholder:y,"aria-invalid":w,disabled:p.isPending}),e[20]=p.isPending,e[21]=d,e[22]=_,e[23]=y,e[24]=w,e[25]=S):S=e[25];let k;e[26]!==p.isPending||e[27]!==n?(k=p.isPending?n("reports.emptyState.starting"):n("reports.emptyState.start"),e[26]=p.isPending,e[27]=n,e[28]=k):k=e[28];let j;e[29]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(ro,{size:16}),e[29]=j):j=e[29];let N;e[30]!==p.isPending||e[31]!==k?(N=o.jsxs(me,{type:"submit",className:"shrink-0",disabled:p.isPending,children:[k,j]}),e[30]=p.isPending,e[31]=k,e[32]=N):N=e[32];let V;e[33]!==S||e[34]!==N?(V=o.jsxs("div",{className:"flex flex-col items-stretch gap-2 sm:flex-row sm:items-center",children:[S,N]}),e[33]=S,e[34]=N,e[35]=V):V=e[35];let C;e[36]!==u||e[37]!==n?(C=u?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:AE(n,u)}):null,e[36]=u,e[37]=n,e[38]=C):C=e[38];let T;e[39]!==v||e[40]!==V||e[41]!==C?(T=o.jsxs("form",{className:"flex w-full flex-col gap-2",onSubmit:v,children:[V,C]}),e[39]=v,e[40]=V,e[41]=C,e[42]=T):T=e[42];let A;return e[43]!==s||e[44]!==T?(A=o.jsx(Lj,{claimedSiteUrl:s,children:T}),e[43]=s,e[44]=T,e[45]=A):A=e[45],A}function Wce(t){return[Ud.SELF(t),Ud.REGISTRY(t),Ud.COMMUNITY_REGISTRY(t),Ud.DEV_ASSETS(t)]}function qce(t,e){const s=new Set(Wce(e));return t.some(n=>!s.has(n.id))}function Gce(){const t=U.c(78),e=ue(),{org:s}=Fe(),n=ui();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={slug:"mcp-github"},t[0]=r):r=t[0];const i=ui(r),{projects:a}=Zu(),l=u9();let c;t[1]!==s.slug?(c={org:s.slug},t[1]=s.slug,t[2]=c):c=t[2];const d=c;let h;t[3]!==e?(h=e("discover.setup.connectTitle"),t[3]=e,t[4]=h):h=t[4];let u;t[5]!==e?(u=e("discover.setup.connectBody"),t[5]=e,t[6]=u):u=t[6];let f;t[7]!==n||t[8]!==s.id?(f=qce(n,s.id),t[7]=n,t[8]=s.id,t[9]=f):f=t[9];let m;t[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Ia,{size:18}),t[10]=m):m=t[10];let p;t[11]===Symbol.for("react.memo_cache_sentinel")?(p={tab:"all"},t[11]=p):p=t[11];let g;t[12]!==e?(g=e("discover.setup.connectAction"),t[12]=e,t[13]=g):g=t[13];let x;t[14]!==d||t[15]!==g?(x=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Do,{to:"/$org/settings/connections",params:d,search:p,children:g})}),t[14]=d,t[15]=g,t[16]=x):x=t[16];let b;t[17]!==h||t[18]!==u||t[19]!==f||t[20]!==x?(b={key:"connect",title:h,body:u,done:f,icon:m,action:x},t[17]=h,t[18]=u,t[19]=f,t[20]=x,t[21]=b):b=t[21];let v;t[22]!==e?(v=e("discover.setup.githubTitle"),t[22]=e,t[23]=v):v=t[23];let _;t[24]!==e?(_=e("discover.setup.githubBody"),t[24]=e,t[25]=_):_=t[25];const L=i.length>0;let y;t[26]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Ir,{className:"size-[18px]"}),t[26]=y):y=t[26];let w;t[27]===Symbol.for("react.memo_cache_sentinel")?(w={tab:"all"},t[27]=w):w=t[27];let S;t[28]!==e?(S=e("discover.setup.githubAction"),t[28]=e,t[29]=S):S=t[29];let k;t[30]!==d||t[31]!==S?(k=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Do,{to:"/$org/settings/connections",params:d,search:w,children:S})}),t[30]=d,t[31]=S,t[32]=k):k=t[32];let j;t[33]!==v||t[34]!==_||t[35]!==L||t[36]!==k?(j={key:"github",title:v,body:_,done:L,icon:y,action:k},t[33]=v,t[34]=_,t[35]=L,t[36]=k,t[37]=j):j=t[37];let N;t[38]!==e?(N=e("discover.setup.projectTitle"),t[38]=e,t[39]=N):N=t[39];let V;t[40]!==e?(V=e("discover.setup.projectBody"),t[40]=e,t[41]=V):V=t[41];const C=a.length>0;let T;t[42]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Qt,{size:18}),t[42]=T):T=t[42];let A;t[43]!==s.slug?(A={org:s.slug,panel:void 0},t[43]=s.slug,t[44]=A):A=t[44];let R;t[45]===Symbol.for("react.memo_cache_sentinel")?(R={virtualmcpid:void 0},t[45]=R):R=t[45];let E;t[46]!==e?(E=e("discover.setup.projectAction"),t[46]=e,t[47]=E):E=t[47];let I;t[48]!==A||t[49]!==E?(I=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Do,{to:Ca.agents,params:A,search:R,children:E})}),t[48]=A,t[49]=E,t[50]=I):I=t[50];let D;t[51]!==N||t[52]!==V||t[53]!==C||t[54]!==I?(D={key:"project",title:N,body:V,done:C,icon:T,action:I},t[51]=N,t[52]=V,t[53]=C,t[54]=I,t[55]=D):D=t[55];let O;t[56]!==e?(O=e("discover.setup.inviteTitle"),t[56]=e,t[57]=O):O=t[57];let $;t[58]!==e?($=e("discover.setup.inviteBody"),t[58]=e,t[59]=$):$=t[59];let M;t[60]!==l.data?.data?.members?(M=l.data?.data?.members??[],t[60]=l.data?.data?.members,t[61]=M):M=t[61];const z=M.length>1;let F;t[62]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(g9,{size:18}),t[62]=F):F=t[62];let B;t[63]!==e?(B=e("discover.setup.inviteAction"),t[63]=e,t[64]=B):B=t[64];let H;t[65]!==d||t[66]!==B?(H=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Do,{to:"/$org/settings/members",params:d,children:B})}),t[65]=d,t[66]=B,t[67]=H):H=t[67];let W;t[68]!==O||t[69]!==$||t[70]!==z||t[71]!==H?(W={key:"invite",title:O,body:$,done:z,icon:F,action:H},t[68]=O,t[69]=$,t[70]=z,t[71]=H,t[72]=W):W=t[72];let K;return t[73]!==j||t[74]!==D||t[75]!==W||t[76]!==b?(K=[b,j,D,W],t[73]=j,t[74]=D,t[75]=W,t[76]=b,t[77]=K):K=t[77],K}function Yce(){const t=U.c(51),e=ue(),{projects:s}=Zu();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={slug:"mcp-github"},t[0]=n):n=t[0];const r=ui(n),i=kg();let a;t[1]!==s?(a=s.some(Xce),t[1]=s,t[2]=a):a=t[2];const l=a;let c;t[3]!==s?(c=s.some(Qce),t[3]=s,t[4]=c):c=t[4];const d=c;let h;if(t[5]!==i||t[6]!==s){let A;t[8]!==i?(A=R=>o9(i.data?.configs??[],u7(R)),t[8]=i,t[9]=A):A=t[9],h=s.some(A),t[5]=i,t[6]=s,t[7]=h}else h=t[7];const u=h;let f;t[10]!==e?(f=e("discover.capabilities.previewTitle"),t[10]=e,t[11]=f):f=t[11];let m;t[12]!==e?(m=e("discover.capabilities.previewRequirement"),t[12]=e,t[13]=m):m=t[13];let p;t[14]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Mr,{size:18}),t[14]=p):p=t[14];let g;t[15]!==l||t[16]!==f||t[17]!==m?(g={key:"preview",title:f,requirement:m,satisfied:l,icon:p},t[15]=l,t[16]=f,t[17]=m,t[18]=g):g=t[18];let x;t[19]!==e?(x=e("discover.capabilities.gitTitle"),t[19]=e,t[20]=x):x=t[20];let b;t[21]!==e?(b=e("discover.capabilities.gitRequirement"),t[21]=e,t[22]=b):b=t[22];const v=r.length>0&&l;let _;t[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ir,{className:"size-[18px]"}),t[23]=_):_=t[23];let L;t[24]!==v||t[25]!==x||t[26]!==b?(L={key:"git",title:x,requirement:b,satisfied:v,icon:_},t[24]=v,t[25]=x,t[26]=b,t[27]=L):L=t[27];let y;t[28]!==e?(y=e("discover.capabilities.contentTitle"),t[28]=e,t[29]=y):y=t[29];let w;t[30]!==e?(w=e("discover.capabilities.contentRequirement"),t[30]=e,t[31]=w):w=t[31];let S;t[32]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Mr,{size:18}),t[32]=S):S=t[32];let k;t[33]!==d||t[34]!==y||t[35]!==w?(k={key:"content",title:y,requirement:w,satisfied:d,icon:S},t[33]=d,t[34]=y,t[35]=w,t[36]=k):k=t[36];let j;t[37]!==e?(j=e("discover.capabilities.assetsTitle"),t[37]=e,t[38]=j):j=t[38];let N;t[39]!==e?(N=e("discover.capabilities.assetsRequirement"),t[39]=e,t[40]=N):N=t[40];let V;t[41]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(ar,{size:18}),t[41]=V):V=t[41];let C;t[42]!==u||t[43]!==j||t[44]!==N?(C={key:"assets",title:j,requirement:N,satisfied:u,icon:V},t[42]=u,t[43]=j,t[44]=N,t[45]=C):C=t[45];let T;return t[46]!==L||t[47]!==k||t[48]!==C||t[49]!==g?(T=[g,L,k,C],t[46]=L,t[47]=k,t[48]=C,t[49]=g,t[50]=T):T=t[50],T}function Qce(t){return!!la(t)&&c0(t.metadata?.ui?.layout)!=="off"}function Xce(t){return la(t)}function om(t){const e=U.c(10),{title:s,description:n,children:r}=t;let i;e[0]!==s?(i=o.jsx("h2",{className:"text-base font-semibold text-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let a;e[2]!==n?(a=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:n}),e[2]=n,e[3]=a):a=e[3];let l;e[4]!==i||e[5]!==a?(l=o.jsxs("div",{className:"flex flex-col gap-1",children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6];let c;return e[7]!==r||e[8]!==l?(c=o.jsxs("section",{className:"flex flex-col gap-3",children:[l,r]}),e[7]=r,e[8]=l,e[9]=c):c=e[9],c}function Jce(){const t=U.c(63),e=ue(),{org:s}=Fe(),n=Gce(),r=Yce();let i;t[0]!==n?(i=n.filter(tde),t[0]=n,t[1]=i):i=t[1];const a=i;let l;t[2]!==e?(l=e("discover.title"),t[2]=e,t[3]=l):l=t[3];let c;t[4]!==l?(c=o.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:l}),t[4]=l,t[5]=c):c=t[5];let d;t[6]!==e?(d=e("discover.subtitle"),t[6]=e,t[7]=d):d=t[7];let h;t[8]!==d?(h=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:d}),t[8]=d,t[9]=h):h=t[9];let u;t[10]!==c||t[11]!==h?(u=o.jsxs("header",{className:"flex flex-col gap-2",children:[c,h]}),t[10]=c,t[11]=h,t[12]=u):u=t[12];let f;t[13]!==e?(f=e("discover.setup.title"),t[13]=e,t[14]=f):f=t[14];let m;t[15]!==a.length||t[16]!==e?(m=a.length===0?e("discover.setup.allDone"):e("discover.setup.description"),t[15]=a.length,t[16]=e,t[17]=m):m=t[17];let p;t[18]!==n?(p=n.map(ede),t[18]=n,t[19]=p):p=t[19];let g;t[20]!==p?(g=o.jsx("ul",{className:"flex flex-col gap-2",children:p}),t[20]=p,t[21]=g):g=t[21];let x;t[22]!==f||t[23]!==m||t[24]!==g?(x=o.jsx(om,{title:f,description:m,children:g}),t[22]=f,t[23]=m,t[24]=g,t[25]=x):x=t[25];let b;t[26]!==e?(b=e("discover.capabilities.title"),t[26]=e,t[27]=b):b=t[27];let v;t[28]!==e?(v=e("discover.capabilities.description"),t[28]=e,t[29]=v):v=t[29];let _;if(t[30]!==r||t[31]!==e){let R;t[33]!==e?(R=E=>o.jsxs("li",{className:"flex items-start gap-3 rounded-xl border border-border bg-card p-4",children:[o.jsx("span",{className:le("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg",E.satisfied?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:E.satisfied?o.jsx($t,{size:18}):E.icon}),o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:E.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:E.satisfied?e("discover.capabilities.ready"):E.requirement})]})]},E.key),t[33]=e,t[34]=R):R=t[34],_=r.map(R),t[30]=r,t[31]=e,t[32]=_}else _=t[32];let L;t[35]!==_?(L=o.jsx("ul",{className:"grid gap-2 sm:grid-cols-2",children:_}),t[35]=_,t[36]=L):L=t[36];let y;t[37]!==b||t[38]!==v||t[39]!==L?(y=o.jsx(om,{title:b,description:v,children:L}),t[37]=b,t[38]=v,t[39]=L,t[40]=y):y=t[40];let w;t[41]!==e?(w=e("discover.catalog.title"),t[41]=e,t[42]=w):w=t[42];let S;t[43]!==e?(S=e("discover.catalog.description"),t[43]=e,t[44]=S):S=t[44];let k;t[45]!==s.slug?(k={org:s.slug},t[45]=s.slug,t[46]=k):k=t[46];let j;t[47]===Symbol.for("react.memo_cache_sentinel")?(j={tab:"all"},t[47]=j):j=t[47];let N;t[48]!==e?(N=e("discover.catalog.action"),t[48]=e,t[49]=N):N=t[49];let V;t[50]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(ro,{size:18}),t[50]=V):V=t[50];let C;t[51]!==k||t[52]!==N?(C=o.jsx("div",{children:o.jsx(me,{asChild:!0,size:"lg",children:o.jsxs(Do,{to:"/$org/settings/connections",params:k,search:j,onClick:Zce,children:[N,V]})})}),t[51]=k,t[52]=N,t[53]=C):C=t[53];let T;t[54]!==w||t[55]!==S||t[56]!==C?(T=o.jsx(om,{title:w,description:S,children:C}),t[54]=w,t[55]=S,t[56]=C,t[57]=T):T=t[57];let A;return t[58]!==x||t[59]!==y||t[60]!==T||t[61]!==u?(A=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-10 p-6 md:p-10",children:[u,x,y,T]})}),t[58]=x,t[59]=y,t[60]=T,t[61]=u,t[62]=A):A=t[62],A}function Zce(){return Ye("discover_catalog_opened",{})}function ede(t){return o.jsxs("li",{className:le("flex items-start gap-3 rounded-xl border border-border bg-card p-4",t.done&&"opacity-60"),children:[o.jsx("span",{className:le("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg",t.done?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:t.done?o.jsx($t,{size:18}):t.icon}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:t.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:t.body})]}),!t.done&&o.jsx("div",{className:"shrink-0",children:t.action})]},t.key)}function tde(t){return!t.done}function sde(t){const e=U.c(52),{readUrl:s,editor:n,downloadName:r,trailing:i}=t,a=ue();let l;e[0]!==s?(l=new URL(s,window.location.origin).toString(),e[0]=s,e[1]=l):l=e[1];const c=l;let d;e[2]!==n||e[3]!==a?(d=n.deckDetected&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:n.railOpen?"secondary":"ghost",size:"icon","aria-label":n.railOpen?a("deck.deckToolbar.hideSlideList"):a("deck.deckToolbar.showSlideList"),onClick:()=>n.setRailOpen(!n.railOpen),children:o.jsx(a6,{size:14})})}),o.jsx(We,{side:"bottom",children:n.railOpen?a("deck.deckToolbar.hideSlideList"):a("deck.deckToolbar.showSlideList")})]}),e[2]=n,e[3]=a,e[4]=d):d=e[4];let h;e[5]!==c?(h=()=>window.open(c,"_blank","noopener"),e[5]=c,e[6]=h):h=e[6];let u;e[7]!==c?(u=o.jsx("span",{className:"truncate",children:c}),e[7]=c,e[8]=u):u=e[8];let f;e[9]!==c||e[10]!==h||e[11]!==u?(f=o.jsx("button",{type:"button",onClick:h,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:c,children:u}),e[9]=c,e[10]=h,e[11]=u,e[12]=f):f=e[12];let m;e[13]!==n.agentUpdated||e[14]!==n.reload||e[15]!==a?(m=n.agentUpdated&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx(Mn,{size:12}),a("deck.deckToolbar.agentUpdatedReload")]})}),o.jsx(We,{side:"bottom",children:a("deck.deckToolbar.agentRewriteWarning")})]}),e[13]=n.agentUpdated,e[14]=n.reload,e[15]=a,e[16]=m):m=e[16];let p;e[17]!==n.saving||e[18]!==a?(p=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:a("deck.deckToolbar.saving")}),e[17]=n.saving,e[18]=a,e[19]=p):p=e[19];let g;e[20]!==n||e[21]!==a?(g=n.deckDetected&&n.writable&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?a("deck.deckToolbar.doneEditing"):a("deck.deckToolbar.editInline"),className:le(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(Z6,{size:14})})}),o.jsx(We,{side:"bottom",children:n.editMode?a("deck.deckToolbar.doneEditing"):a("deck.deckToolbar.editInlineTooltip")})]}),e[20]=n,e[21]=a,e[22]=g):g=e[22];let x;e[23]!==c||e[24]!==r||e[25]!==n.deckDetected||e[26]!==a?(x=n.deckDetected?o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":a("deck.deckToolbar.download"),children:o.jsx(Su,{size:14})})}),o.jsxs(Ht,{align:"end",children:[o.jsxs(et,{onClick:()=>window.open(`${c}#print`,"_blank","noopener"),children:[o.jsx(sP,{size:14}),a("deck.deckToolbar.exportAsPdf")]}),o.jsx(et,{asChild:!0,children:o.jsxs("a",{href:c,download:r,children:[o.jsx(s9,{size:14}),a("deck.deckToolbar.downloadHtml")]})})]})]}):o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":a("deck.deckToolbar.download"),asChild:!0,children:o.jsx("a",{href:c,download:r,children:o.jsx(Su,{size:14})})})}),o.jsx(We,{side:"bottom",children:a("deck.deckToolbar.download")})]}),e[23]=c,e[24]=r,e[25]=n.deckDetected,e[26]=a,e[27]=x):x=e[27];let b;e[28]!==a?(b=a("deck.deckToolbar.openInNewTab"),e[28]=a,e[29]=b):b=e[29];let v;e[30]!==c?(v=()=>window.open(c,"_blank","noopener"),e[30]=c,e[31]=v):v=e[31];let _;e[32]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(fn,{size:14}),e[32]=_):_=e[32];let L;e[33]!==b||e[34]!==v?(L=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":b,onClick:v,children:_})}),e[33]=b,e[34]=v,e[35]=L):L=e[35];let y;e[36]!==a?(y=a("deck.deckToolbar.openInNewTab"),e[36]=a,e[37]=y):y=e[37];let w;e[38]!==y?(w=o.jsx(We,{side:"bottom",children:y}),e[38]=y,e[39]=w):w=e[39];let S;e[40]!==L||e[41]!==w?(S=o.jsxs(qe,{children:[L,w]}),e[40]=L,e[41]=w,e[42]=S):S=e[42];let k;return e[43]!==S||e[44]!==d||e[45]!==f||e[46]!==m||e[47]!==p||e[48]!==g||e[49]!==x||e[50]!==i?(k=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,f,m,p,g,x,S,i]}),e[43]=S,e[44]=d,e[45]=f,e[46]=m,e[47]=p,e[48]=g,e[49]=x,e[50]=i,e[51]=k):k=e[51],k}const Nc=1;function nde(t){if(typeof t!="object"||t===null||t.v!==Nc||t.source!=="deck-viewer")return null;const e=t;return e.type==="ready"||e.type==="state"||e.type==="op"&&typeof e.opId=="string"&&e.op?e:null}class To extends Error{constructor(e,s){super(e),this.code=s,this.name="DeckOpError"}code}function wj(t){return[...t.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function rde(t){const s=new DOMParser().parseFromString(t,"text/html").querySelector("deck-viewer");return s?wj(s).length:null}function ide(t,e){const s=new DOMParser().parseFromString(t,"text/html"),n=s.querySelector("deck-viewer");if(!n)throw new To("no <deck-viewer> element in source","no-viewer");const r=wj(n),i=e.kind==="move"?e.from:e.at,a=r[i];if(!a)throw new To(`slide index ${i} out of range (${r.length})`,"stale-index");switch(e.kind){case"remove":{if(r.length<=1)throw new To("cannot remove the last slide","bad-op");a.remove();break}case"duplicate":{const c=a.cloneNode(!0);c.removeAttribute("id");for(const d of c.querySelectorAll("[id]"))d.removeAttribute("id");a.after(c);break}case"move":{if(e.to<0||e.to>=r.length)throw new To(`move target ${e.to} out of range`,"stale-index");if(e.to!==e.from){const c=e.to<e.from?r[e.to]:r[e.to].nextSibling;n.insertBefore(a,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new To(`invalid attribute name: ${e.name}`,"bad-op");a.setAttribute(e.name,e.value);break}case"remove-attr":{a.removeAttribute(e.name);break}case"replace":{const d=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!d)throw new To("replace html has no root element","bad-op");a.replaceWith(s.importNode(d,!0));break}default:throw new To(`unknown op kind: ${e.kind}`,"bad-op")}return`${t.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
647
647
  `:""}${s.documentElement.outerHTML}
648
648
  `}const Ev="home",ode=400,ade=800;function lde(t){const e=t.savePath!==void 0,{org:s}=Fe(),n=Ns(),r=L8(Ev),[i,a]=P.useState(!1),[l,c]=P.useState(!1),[d,h]=P.useState(!1),[u,f]=P.useState(!1),[m,p]=P.useState(!1),[g,x]=P.useState(!1),[b,v]=P.useState(null),[_,L]=P.useState(null),[y,w]=P.useState(0),[S]=P.useState(()=>({iframe:null,source:null,queue:Promise.resolve(),saveTimer:null,selfMarkers:new Set})),k=i||g||m,j=()=>{t.savePath!==void 0&&(n.invalidateQueries({queryKey:at.orgFsStat(s.id,Ev,t.savePath)}),n.invalidateQueries({queryKey:at.orgFsRecent(s.id)}))},N=M=>{S.iframe?.contentWindow?.postMessage(M,"*")},V=()=>{S.source=null,f(!1),_&&v(_),w(M=>M+1),j()};t.statMarker!==_&&(L(t.statMarker),t.statMarker!==null&&(b===null?v(t.statMarker):S.selfMarkers.has(t.statMarker)||t.statMarker!==b&&(k?f(!0):(S.source=null,v(t.statMarker)))));const C=async()=>{S.saveTimer=null;const M=S.source;if(M===null){x(!1);return}p(!0);try{const z=await r.mutateAsync({path:t.savePath,body:M});S.selfMarkers.add(lg(z)),j()}catch(z){console.error("[deck-editor] save failed",z),ye.error("Couldn't save deck edits — reloading the preview."),I.current.reload()}finally{p(!1),x(!1)}},T=M=>{x(!0),S.saveTimer&&clearTimeout(S.saveTimer),S.saveTimer=setTimeout(()=>{I.current.flushSave()},M)},A=(M,z,F)=>{N({v:Nc,type:"ack",opId:M,ok:z,error:F})},R=async M=>{if(!e){A(M.opId,!1,"read-only preview");return}try{if(S.source===null){const F=await fetch(t.readUrl,{credentials:"include"});if(!F.ok)throw new Error(`HTTP ${F.status}`);S.source=await F.text()}const z=rde(S.source);if(z===null||z!==M.witness.childCount)throw new To(`slide count drifted (source ${z}, iframe ${M.witness.childCount})`,"stale-index");S.source=ide(S.source,M.op),A(M.opId,!0),T(M.op.kind==="replace"?ade:ode)}catch(z){console.error("[deck-editor] op failed",M.op,z),A(M.opId,!1,z instanceof Error?z.message:String(z)),ye.error("That edit couldn't be saved — reloading the preview."),I.current.reload()}},E=M=>{if(!S.iframe||M.source!==S.iframe.contentWindow)return;const z=nde(M.data);if(z){if(z.type==="ready"){c(!0),I.current.editMode?N({v:Nc,type:"set-edit-mode",enabled:!0}):I.current.railOpen&&N({v:Nc,type:"set-rail",open:!0});return}z.type==="op"&&(S.queue=S.queue.then(()=>I.current.handleOp(z)).catch(()=>{}))}},I=P.useRef({onMessage:E,handleOp:R,flushSave:C,reload:V,editMode:i,railOpen:d});I.current={onMessage:E,handleOp:R,flushSave:C,reload:V,editMode:i,railOpen:d};const[D]=P.useState(()=>{let M=null;return z=>{if(z){S.iframe=z;const F=B=>I.current.onMessage(B);window.addEventListener("message",F),M=()=>window.removeEventListener("message",F)}else M?.(),M=null,S.iframe=null}}),O=M=>{h(M),N({v:Nc,type:"set-rail",open:M})},$=M=>{a(M),N({v:Nc,type:"set-edit-mode",enabled:M}),M&&h(!0),!M&&u&&!g&&!m&&V()};return{iframeRef:D,deckDetected:l,writable:e,displayedMarker:b===null?null:`${b}.${y}`,editMode:i,setEditMode:$,railOpen:d,setRailOpen:O,saving:m,agentUpdated:u,reload:V,postToIframe:N}}const cde=300;function Sj({readUrl:t,marker:e,title:s,savePath:n,trailing:r}){const i=lde({readUrl:t,statMarker:e,savePath:n}),[a,l]=P.useState(null);if(i.displayedMarker===null)return null;const c=t.includes("?")?"&":"?",d=`${t}${c}v=${encodeURIComponent(i.displayedMarker)}`,h=a===d;return o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[o.jsx(sde,{readUrl:t,editor:i,downloadName:s.split("/").pop()??s,trailing:r}),o.jsx("div",{className:"relative flex-1",children:o.jsx("iframe",{ref:i.iframeRef,src:d,onLoad:()=>l(d),sandbox:"allow-scripts allow-downloads",className:le("absolute inset-0 block h-full w-full bg-white","transition-opacity ease-out",h?"opacity-100":"opacity-0"),style:{transitionDuration:`${cde}ms`},title:s},d)})]})}const dde=[{mode:"private",labelKey:"library.fileShareButton.modeOrgOnly",Icon:Uu},{mode:"public",labelKey:"library.fileShareButton.modePublic",Icon:Cn},{mode:"password",labelKey:"library.fileShareButton.modePassword",Icon:f9}];function kj(t){const e=U.c(56),{volume:s,path:n,kind:r,shareMode:i,effectivePublic:a,url:l}=t,c=ue(),d=dA(s),{data:h}=cg(s,n),u=h?.shareMode??i,m=(h?.effectivePublic??a)&&u==="private",p=r==="dir",g=p?"folder":"file",[x,b]=P.useState(!1),[v,_]=P.useState(""),[L,y]=P.useState(!1);let w;e[0]!==n||e[1]!==d||e[2]!==g||e[3]!==c?(w=(M,z)=>{d.mutate({path:n,mode:M,password:z},{onSuccess:()=>{b(!1),_(""),ye.success(M==="private"?c("library.fileShareButton.toastOrgOnly",{subject:g}):M==="public"?c("library.fileShareButton.toastPublic",{subject:g}):c("library.fileShareButton.toastPassword",{subject:g}))},onError:F=>ye.error(F instanceof Error?F.message:c("library.fileShareButton.failedUpdateSharing"))})},e[0]=n,e[1]=d,e[2]=g,e[3]=c,e[4]=w):w=e[4];const S=w;let k;e[5]!==S?(k=M=>{if(M==="password"){b(!0);return}b(!1),S(M)},e[5]=S,e[6]=k):k=e[6];const j=k,N=x?"password":u;let V;e[7]!==c||e[8]!==l?(V=async()=>{l&&(await navigator.clipboard.writeText(l),y(!0),ye.success(c("library.fileShareButton.linkCopied")),setTimeout(()=>y(!1),2e3))},e[7]=c,e[8]=l,e[9]=V):V=e[9];const C=V;let T;e[10]!==L||e[11]!==C||e[12]!==c||e[13]!==l?(T=l?o.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-input bg-muted/50 px-2 py-1.5",children:[o.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:l}),o.jsx(me,{variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:C,"aria-label":c("library.fileShareButton.copyLink"),children:L?o.jsx($t,{size:12,className:"text-success"}):o.jsx(bn,{size:12})})]}):null,e[10]=L,e[11]=C,e[12]=c,e[13]=l,e[14]=T):T=e[14];const A=T;if(m){let M;e[15]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx("div",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:o.jsx(Cn,{size:16})}),e[15]=M):M=e[15];let z;e[16]!==c?(z=c("library.fileShareButton.sharedViaParent"),e[16]=c,e[17]=z):z=e[17];let F;e[18]!==z?(F=o.jsx("span",{className:"text-sm font-medium text-foreground",children:z}),e[18]=z,e[19]=F):F=e[19];const B=p?"files in this folder":"this file";let H;e[20]!==c||e[21]!==B?(H=c("library.fileShareButton.inheritedDescription",{target:B}),e[20]=c,e[21]=B,e[22]=H):H=e[22];let W;e[23]!==H?(W=o.jsx("span",{className:"text-xs text-muted-foreground",children:H}),e[23]=H,e[24]=W):W=e[24];let K;e[25]!==W||e[26]!==F?(K=o.jsxs("div",{className:"flex items-start gap-3",children:[M,o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[F,W]})]}),e[25]=W,e[26]=F,e[27]=K):K=e[27];let q;return e[28]!==A||e[29]!==K?(q=o.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[K,A]}),e[28]=A,e[29]=K,e[30]=q):q=e[30],q}let R;e[31]!==N||e[32]!==j||e[33]!==d.isPending||e[34]!==c?(R=dde.map(M=>{const{mode:z,labelKey:F,Icon:B}=M;return o.jsxs("button",{type:"button",disabled:d.isPending,onClick:()=>j(z),className:le("flex flex-col items-center gap-1 rounded-md px-2 py-2 text-xs font-medium transition-colors disabled:opacity-60",N===z?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(B,{size:15}),c(F)]},z)}),e[31]=N,e[32]=j,e[33]=d.isPending,e[34]=c,e[35]=R):R=e[35];let E;e[36]!==R?(E=o.jsx("div",{className:"grid grid-cols-3 gap-1 rounded-lg bg-muted p-1",children:R}),e[36]=R,e[37]=E):E=e[37];let I;e[38]!==N||e[39]!==p||e[40]!==c?(I=N==="private"?c("library.fileShareButton.privateDescription",{target:p?"these files":"this link"}):N==="public"?c(p?"library.fileShareButton.publicFolderDescription":"library.fileShareButton.publicFileDescription"):c("library.fileShareButton.passwordDescription",{target:p?"files in this folder":"this file"}),e[38]=N,e[39]=p,e[40]=c,e[41]=I):I=e[41];let D;e[42]!==I?(D=o.jsx("p",{className:"text-xs text-muted-foreground",children:I}),e[42]=I,e[43]=D):D=e[43];let O;e[44]!==N||e[45]!==S||e[46]!==u||e[47]!==v||e[48]!==d.isPending||e[49]!==c?(O=N==="password"&&o.jsxs("form",{className:"flex items-center gap-2",onSubmit:M=>{M.preventDefault(),v&&S("password",v)},children:[o.jsx(yt,{type:"password",value:v,onChange:M=>_(M.target.value),placeholder:c(u==="password"?"library.fileShareButton.newPasswordPlaceholder":"library.fileShareButton.passwordPlaceholder"),autoComplete:"new-password",className:"h-8 text-xs"}),o.jsx(me,{type:"submit",size:"sm",className:"shrink-0",disabled:!v||d.isPending,children:c(u==="password"?"library.fileShareButton.buttonUpdate":"library.fileShareButton.buttonSet")})]}),e[44]=N,e[45]=S,e[46]=u,e[47]=v,e[48]=d.isPending,e[49]=c,e[50]=O):O=e[50];let $;return e[51]!==A||e[52]!==E||e[53]!==D||e[54]!==O?($=o.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[E,D,O,A]}),e[51]=A,e[52]=E,e[53]=D,e[54]=O,e[55]=$):$=e[55],$}function Rp(t){const e=U.c(21),{volume:s,path:n,shareMode:r,effectivePublic:i,url:a}=t,l=ue();let c;e[0]!==l?(c=l("library.fileShareButton.share"),e[0]=l,e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(jA,{size:14}),e[2]=d):d=e[2];let h;e[3]!==c?(h=o.jsx(Ke,{asChild:!0,children:o.jsx(gs,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":c,children:d})})}),e[3]=c,e[4]=h):h=e[4];let u;e[5]!==l?(u=l("library.fileShareButton.share"),e[5]=l,e[6]=u):u=e[6];let f;e[7]!==u?(f=o.jsx(We,{side:"bottom",children:u}),e[7]=u,e[8]=f):f=e[8];let m;e[9]!==h||e[10]!==f?(m=o.jsxs(qe,{children:[h,f]}),e[9]=h,e[10]=f,e[11]=m):m=e[11];let p;e[12]!==i||e[13]!==n||e[14]!==r||e[15]!==a||e[16]!==s?(p=o.jsx(ys,{align:"end",className:"w-80 p-3",children:o.jsx(kj,{volume:s,path:n,kind:"file",shareMode:r,effectivePublic:i,url:a})}),e[12]=i,e[13]=n,e[14]=r,e[15]=a,e[16]=s,e[17]=p):p=e[17];let g;return e[18]!==m||e[19]!==p?(g=o.jsxs(_s,{children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20],g}function ude(t){const e=U.c(14),{target:s,onOpenChange:n}=t,r=ue(),i=!!s,a=s?.kind==="dir"?"folder":"file";let l;e[0]!==r||e[1]!==a?(l=r("library.fileShareButton.shareDialogTitle",{type:a}),e[0]=r,e[1]=a,e[2]=l):l=e[2];let c;e[3]!==l?(c=o.jsx(ls,{children:o.jsx(qt,{children:l})}),e[3]=l,e[4]=c):c=e[4];let d;e[5]!==s?(d=s&&o.jsx(kj,{...s}),e[5]=s,e[6]=d):d=e[6];let h;e[7]!==c||e[8]!==d?(h=o.jsxs(Bt,{className:"sm:max-w-md",children:[c,d]}),e[7]=c,e[8]=d,e[9]=h):h=e[9];let u;return e[10]!==n||e[11]!==i||e[12]!==h?(u=o.jsx(zt,{open:i,onOpenChange:n,children:h}),e[10]=n,e[11]=i,e[12]=h,e[13]=u):u=e[13],u}const am="home";function hde(t){const e=U.c(5),{label:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(tn,{className:"aspect-video w-2/3 max-w-xl"}),e[0]=n):n=e[0];let r;e[1]!==s?(r=s&&o.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e[1]=s,e[2]=r):r=e[2];let i;return e[3]!==r?(i=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-background",children:[n,r]}),e[3]=r,e[4]=i):i=e[4],i}function fde(t){const e=U.c(15),{path:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={refetchIntervalWhenAbsent:2e3},e[0]=n):n=e[0];const r=cg(am,s,n),i=ag(am)(s);if(r.isPending||!r.data){const f=!r.isPending&&!r.data?"Waiting for the deck to sync…":void 0;let m;return e[1]!==f?(m=o.jsx(hde,{label:f}),e[1]=f,e[2]=m):m=e[2],m}let a;e[3]!==r.data?(a=lg(r.data),e[3]=r.data,e[4]=a):a=e[4];const l=r.data.shareMode??"private",c=r.data.effectivePublic??!1,d=window.location.origin+i;let h;e[5]!==s||e[6]!==l||e[7]!==c||e[8]!==d?(h=o.jsx(Rp,{volume:am,path:s,shareMode:l,effectivePublic:c,url:d}),e[5]=s,e[6]=l,e[7]=c,e[8]=d,e[9]=h):h=e[9];let u;return e[10]!==s||e[11]!==i||e[12]!==a||e[13]!==h?(u=o.jsx(Sj,{readUrl:i,marker:a,title:s,savePath:s,trailing:h}),e[10]=s,e[11]=i,e[12]=a,e[13]=h,e[14]=u):u=e[14],u}function mde(t){const e=U.c(13),{previewPath:s}=t,n=ue(),r=on(),i=ra({strict:!1}).org??"";let a;e[0]!==s?(a=s.split("/").slice(0,-1).join("/"),e[0]=s,e[1]=a):a=e[1];const l=a;let c;e[2]!==r||e[3]!==i||e[4]!==l||e[5]!==s?(c=()=>{r({to:Ca.library,params:{org:i},search:{path:l||void 0,preview:s}})},e[2]=r,e[3]=i,e[4]=l,e[5]=s,e[6]=c):c=e[6];const d=c;let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(qo,{size:14}),e[7]=h):h=e[7];let u;e[8]!==n?(u=n("library.seeInLibrary.label"),e[8]=n,e[9]=u):u=e[9];let f;return e[10]!==d||e[11]!==u?(f=o.jsxs(me,{variant:"ghost",size:"sm",onClick:d,className:"shrink-0 gap-1.5 text-xs text-muted-foreground",children:[h,u]}),e[10]=d,e[11]=u,e[12]=f):f=e[12],f}const pde=t=>/\.html?$/i.test(t);function Rv(t){const e=U.c(10),{onClose:s}=t,n=ue();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(lr,{size:14}),e[0]=r):r=e[0];let i;e[1]!==s?(i=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",onClick:s,children:r})}),e[1]=s,e[2]=i):i=e[2];let a;e[3]!==n?(a=n("library.previewContent.close"),e[3]=n,e[4]=a):a=e[4];let l;e[5]!==a?(l=o.jsx(We,{side:"bottom",children:a}),e[5]=a,e[6]=l):l=e[6];let c;return e[7]!==i||e[8]!==l?(c=o.jsxs(qe,{children:[i,l]}),e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function jj(t){const e=U.c(67),{previewPath:s,onClose:n,showSeeInLibrary:r,variant:i}=t,a=r===void 0?!1:r,l=ue();let c;e[0]!==s?(c=yg(s),e[0]=s,e[1]=c):c=e[1];const d=c,{volume:h,dirPath:u}=d,{data:f,isPending:m}=cg(h,u),p=ag(h??"");let g,x,b,v,_,L,y,w,S;if(e[2]!==p||e[3]!==f||e[4]!==u||e[5]!==n||e[6]!==s||e[7]!==a||e[8]!==i||e[9]!==h){S=Symbol.for("react.early_return_sentinel");e:{x=dn(u),b=i==="dialog";let A;e[19]!==s||e[20]!==a?(A=a?o.jsx(mde,{previewPath:s}):null,e[19]=s,e[20]=a,e[21]=A):A=e[21];const R=A;if(g=f&&f.kind==="file"?{key:s,filename:x,size:f.size,downloadUrl:p(f.path)}:null,g&&f&&pde(x)){const I=g.downloadUrl;let D;e[22]!==f?(D=lg(f),e[22]=f,e[23]=D):D=e[23];const O=h??"",$=f.shareMode??"private",M=f.effectivePublic??!1,z=window.location.origin+g.downloadUrl;let F;e[24]!==u||e[25]!==O||e[26]!==$||e[27]!==M||e[28]!==z?(F=o.jsx(Rp,{volume:O,path:u,shareMode:$,effectivePublic:M,url:z}),e[24]=u,e[25]=O,e[26]=$,e[27]=M,e[28]=z,e[29]=F):F=e[29];let B;e[30]!==b||e[31]!==n?(B=b?o.jsx("div",{className:"w-8 shrink-0"}):o.jsx(Rv,{onClose:n}),e[30]=b,e[31]=n,e[32]=B):B=e[32];let H;e[33]!==R||e[34]!==F||e[35]!==B?(H=o.jsxs(o.Fragment,{children:[F,R,B]}),e[33]=R,e[34]=F,e[35]=B,e[36]=H):H=e[36],S=o.jsxs(o.Fragment,{children:[b&&o.jsx(qt,{className:"sr-only",children:x}),o.jsx(Sj,{readUrl:I,marker:D,title:x,savePath:h==="home"?u:void 0,trailing:H},s)]});break e}const E=b?"h-11 py-1 pr-12 pl-2":"h-9 px-2";e[37]!==E?(w=le("flex shrink-0 items-center gap-1 border-b border-border/60",E),e[37]=E,e[38]=w):w=e[38],v="flex min-w-0 flex-1 items-center gap-2 px-2",_=o.jsx(Go,{filename:x,className:"h-4.5 w-3.5 shrink-0"}),L=b?o.jsx(qt,{className:"truncate text-xs font-medium text-foreground",children:x}):o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:x}),y=g&&o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:H8(g.size)})}e[2]=p,e[3]=f,e[4]=u,e[5]=n,e[6]=s,e[7]=a,e[8]=i,e[9]=h,e[10]=g,e[11]=x,e[12]=b,e[13]=v,e[14]=_,e[15]=L,e[16]=y,e[17]=w,e[18]=S}else g=e[10],x=e[11],b=e[12],v=e[13],_=e[14],L=e[15],y=e[16],w=e[17],S=e[18];if(S!==Symbol.for("react.early_return_sentinel"))return S;let k;e[39]!==v||e[40]!==_||e[41]!==L||e[42]!==y?(k=o.jsxs("div",{className:v,children:[_,L,y]}),e[39]=v,e[40]=_,e[41]=L,e[42]=y,e[43]=k):k=e[43];let j;e[44]!==f?.effectivePublic||e[45]!==f?.shareMode||e[46]!==g||e[47]!==u||e[48]!==l||e[49]!==h?(j=g&&o.jsxs(o.Fragment,{children:[o.jsx(Rp,{volume:h??"",path:u,shareMode:f?.shareMode??"private",effectivePublic:f?.effectivePublic??!1,url:window.location.origin+g.downloadUrl}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",asChild:!0,children:o.jsx("a",{href:g.downloadUrl,download:g.filename,children:o.jsx(Su,{size:14})})})}),o.jsx(We,{side:"bottom",children:l("library.previewContent.download")})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",onClick:()=>window.open(g.downloadUrl,"_blank","noopener"),children:o.jsx(fn,{size:14})})}),o.jsx(We,{side:"bottom",children:l("library.previewContent.openInNewTab")})]})]}),e[44]=f?.effectivePublic,e[45]=f?.shareMode,e[46]=g,e[47]=u,e[48]=l,e[49]=h,e[50]=j):j=e[50];let N;e[51]!==b||e[52]!==n?(N=!b&&o.jsx(Rv,{onClose:n}),e[51]=b,e[52]=n,e[53]=N):N=e[53];let V;e[54]!==j||e[55]!==N||e[56]!==w||e[57]!==k?(V=o.jsxs("div",{className:w,children:[k,j,N]}),e[54]=j,e[55]=N,e[56]=w,e[57]=k,e[58]=V):V=e[58];let C;e[59]!==g||e[60]!==x||e[61]!==m||e[62]!==l?(C=o.jsx("div",{className:"relative min-h-0 flex-1 bg-background",children:g?o.jsx(U8,{file:g}):m?o.jsx(F8,{}):o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[o.jsx(Go,{filename:x,className:"h-7.5 w-6"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:l("library.previewContent.fileNotAvailable")})]})}),e[59]=g,e[60]=x,e[61]=m,e[62]=l,e[63]=C):C=e[63];let T;return e[64]!==V||e[65]!==C?(T=o.jsxs(o.Fragment,{children:[V,C]}),e[64]=V,e[65]=C,e[66]=T):T=e[66],T}function gde(t){const e=U.c(4),{previewPath:s,onClose:n,showSeeInLibrary:r}=t,i=r===void 0?!1:r;let a;return e[0]!==n||e[1]!==s||e[2]!==i?(a=o.jsx("div",{className:"flex h-full w-full flex-col bg-background",children:o.jsx(jj,{previewPath:s,onClose:n,showSeeInLibrary:i,variant:"panel"})}),e[0]=n,e[1]=s,e[2]=i,e[3]=a):a=e[3],a}function xde(t){const e=U.c(5),{path:s}=t,{closePanel:n}=pi();let r;e[0]!==n?(r=()=>n(),e[0]=n,e[1]=r):r=e[1];const i=r;let a;return e[2]!==i||e[3]!==s?(a=o.jsx(gde,{previewPath:s,onClose:i,showSeeInLibrary:!0}),e[2]=i,e[3]=s,e[4]=a):a=e[4],a}function bde(t){const e=t("library.brandComponentsPreview.title"),s=t("library.brandComponentsPreview.subtitle"),n=t("library.brandComponentsPreview.monthlySavingsLabel"),r=t("library.brandComponentsPreview.primaryButton"),i=t("library.brandComponentsPreview.secondaryButton"),a=t("library.brandComponentsPreview.ghostButton"),l=t("library.brandComponentsPreview.successBadge"),c=t("library.brandComponentsPreview.warningBadge"),d=t("library.brandComponentsPreview.errorBadge"),h=t("library.brandComponentsPreview.infoBadge"),u=t("library.brandComponentsPreview.allChip"),f=t("library.brandComponentsPreview.incomeChip"),m=t("library.brandComponentsPreview.spendingChip"),p=t("library.brandComponentsPreview.emailPlaceholder");return`
649
649
  <div class="stack">
@@ -805,7 +805,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
805
805
  <p class="cta">slides-create --theme &hellip;</p>
806
806
  </section>`].join(`
807
807
 
808
- `);function Sde(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",wde).replaceAll("{{title}}",Lde).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function kde(t){const e=U.c(8),{readUrl:s,title:n,tokensUrl:r}=t,i=wu(s),a=wu(r??"");if(i.isPending||r&&a.isPending){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:o.jsx(tn,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=h):h=e[0],h}if(i.isError||!i.data){let h;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[1]=h):h=e[1],h}const l=a.data??null;let c;e[2]!==l||e[3]!==i.data?(c=Sde(i.data,l),e[2]=l,e[3]=i.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=o.jsx("iframe",{title:n,srcDoc:c,sandbox:"allow-scripts",className:"block h-full w-full border-0 bg-white"}),e[5]=c,e[6]=n,e[7]=d):d=e[7],d}function Qd(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function jde(t){const e=U.c(16),{family:s,tokens:n,editing:r,valueOf:i,onEdit:a}=t;let l;e[0]!==s?(l=o.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=l):l=e[1];let c;if(e[2]!==r||e[3]!==a||e[4]!==n||e[5]!==i){let u;e[7]!==r||e[8]!==a||e[9]!==i?(u=f=>{const m=i(f),p=`${f.name.replace(/^--brand-/,"")}: ${m}`;return r&&/^#/.test(m)?o.jsx("input",{type:"color","aria-label":f.name,title:p,value:IE(m),onChange:g=>a(f.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},f.name):o.jsx("span",{title:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},f.name)},e[7]=r,e[8]=a,e[9]=i,e[10]=u):u=e[10],c=n.map(u),e[2]=r,e[3]=a,e[4]=n,e[5]=i,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-wrap gap-1",children:c}),e[11]=c,e[12]=d):d=e[12];let h;return e[13]!==l||e[14]!==d?(h=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,d]}),e[13]=l,e[14]=d,e[15]=h):h=e[15],h}function Cde(t){const e=U.c(9),{token:s,value:n}=t;if(s.kind==="space"){let i;return e[0]!==n?(i=o.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:o.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=i):i=e[1],i}if(s.kind==="radius"){let i;return e[2]!==n?(i=o.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=i):i=e[3],i}if(s.kind==="shadow"){let i;return e[4]!==n?(i=o.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=i):i=e[5],i}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const i=`min(${n}, 22px)`;let a;return e[6]!==i?(a=o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:i},children:"Ag"}),e[6]=i,e[7]=a):a=e[7],a}let r;return e[8]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("span",{className:"size-7 shrink-0"}),e[8]=r):r=e[8],r}function Cj(t){const e=U.c(17),{token:s,value:n,editing:r,onEdit:i}=t;let a;e[0]!==s||e[1]!==n?(a=o.jsx(Cde,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=a):a=e[2];let l;if(e[3]!==s.name){let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=/^--brand-/,e[5]=u):u=e[5],l=s.name.replace(u,""),e[3]=s.name,e[4]=l}else l=e[4];let c;e[6]!==l?(c=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:l}),e[6]=l,e[7]=c):c=e[7];let d;e[8]!==r||e[9]!==i||e[10]!==s.name||e[11]!==n?(d=r?o.jsx(yt,{value:n,onChange:u=>i(s.name,u.target.value),className:"h-8 w-40 font-mono text-xs"}):o.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=r,e[9]=i,e[10]=s.name,e[11]=n,e[12]=d):d=e[12];let h;return e[13]!==a||e[14]!==c||e[15]!==d?(h=o.jsxs("div",{className:"flex items-center gap-3",children:[a,c,d]}),e[13]=a,e[14]=c,e[15]=d,e[16]=h):h=e[16],h}function Dd(t){const e=U.c(16),{label:s,tokens:n,editing:r,valueOf:i,onEdit:a}=t;if(n.length===0)return null;let l;e[0]!==s?(l=o.jsx(Qd,{children:s}),e[0]=s,e[1]=l):l=e[1];let c;if(e[2]!==r||e[3]!==a||e[4]!==n||e[5]!==i){let u;e[7]!==r||e[8]!==a||e[9]!==i?(u=f=>o.jsx(Cj,{token:f,value:i(f),editing:r,onEdit:a},f.name),e[7]=r,e[8]=a,e[9]=i,e[10]=u):u=e[10],c=n.map(u),e[2]=r,e[3]=a,e[4]=n,e[5]=i,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-col gap-2.5",children:c}),e[11]=c,e[12]=d):d=e[12];let h;return e[13]!==l||e[14]!==d?(h=o.jsxs("div",{className:"flex flex-col gap-3",children:[l,d]}),e[13]=l,e[14]=d,e[15]=h):h=e[15],h}function Nde({brandPath:t,onClose:e,variant:s}){const n=ue(),{org:r}=Fe(),i=yg(t),a=i.volume??"",l=i.dirPath,c=dn(l),d=i.readOnly,h=Ns(),u=e0(),f=L8(a),{upload:m,remove:p}=Lu(a),g=P.useRef(null),x=w8(a,l),b=x.data??[],v=Y=>b.some(pe=>pe.kind==="file"&&dn(pe.path)===Y),_=v("tokens.css"),L=v("brand.md"),y=v("slides-theme.html"),w=EE(b),S=u(a,`${l}/tokens.css`),k=u(a,`${l}/brand.md`),j=u(a,`${l}/slides-theme.html`),N=wu(S,{enabled:_}),V=wu(k,{enabled:L}),[C,T]=P.useState(!1),[A,R]=P.useState({}),[E,I]=P.useState(null),[D,O]=P.useState(!1),[$,M]=P.useState(!1),[z,F]=P.useState("deck"),B=N.data?RE(N.data):[],H=Y=>B.find(pe=>pe.name===Y)?.value,W=Y=>A[Y.name]??Y.value,K=DE(B),q=B.filter(Y=>Y.kind==="font"),G=B.filter(Y=>Y.kind==="type"),te=B.filter(Y=>Y.kind==="space"),X=B.filter(Y=>Y.kind==="radius"),Z=B.filter(Y=>Y.kind==="shadow"),ee=B.filter(Y=>Y.kind==="motion"),se=B.filter(Y=>Y.kind==="other"),J=(Y,pe)=>R(be=>({...be,[Y]:pe})),oe=y&&z==="deck",ce=E??V.data??"",he=Object.entries(A).filter(([Y,pe])=>H(Y)!==pe),ne=E!==null&&E!==(V.data??""),Q=he.length>0||ne;function de(){R({}),I(null),T(!1)}async function ae(){O(!0);try{if(he.length>0){let Y=N.data??"";for(const[pe,be]of he)Y=ME(Y,pe,be);await f.mutateAsync({path:`${l}/tokens.css`,body:Y,contentType:"text/css; charset=utf-8"}),h.invalidateQueries({queryKey:at.fileText(S)})}ne&&E!==null&&(await f.mutateAsync({path:`${l}/brand.md`,body:E,contentType:"text/markdown; charset=utf-8"}),h.invalidateQueries({queryKey:at.fileText(k)})),h.invalidateQueries({queryKey:at.orgFsVolume(r.id,a)}),h.invalidateQueries({queryKey:at.orgFsRecent(r.id)}),R({}),I(null),T(!1),ye.success(n("library.brandPreview.brandSaved"))}catch(Y){ye.error(Y instanceof Error?Y.message:n("library.brandPreview.failedSaveBrand"))}finally{O(!1)}}async function re(Y){const pe=Y?.[0];if(!pe)return;const _e=`logo.${(pe.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:l,files:[new File([pe],_e,{type:pe.type})]}),w&&dn(w)!==_e&&await p.mutateAsync(w),ye.success(n("library.brandPreview.logoUpdated"))}catch(Le){ye.error(Le instanceof Error?Le.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const ie=!x.isPending&&!_&&!L&&!w;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:o.jsx(Wm,{size:18})}),s==="dialog"?o.jsx(qt,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):o.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(C?o.jsxs(o.Fragment,{children:[o.jsx(me,{variant:"ghost",size:"sm",onClick:de,disabled:D,children:n("library.brandPreview.cancel")}),o.jsx(me,{size:"sm",disabled:!Q||D,onClick:()=>{ae()},children:n(D?"library.brandPreview.saving":"library.brandPreview.save")})]}):o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[o.jsx(nP,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?o.jsx(eT,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:o.jsx(nn,{size:16})})}):o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:o.jsx(nn,{size:16})})]}),o.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?o.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[o.jsx(tn,{className:"h-40 w-full rounded-xl"}),o.jsx(tn,{className:"h-4 w-1/3"}),o.jsx(tn,{className:"h-4 w-2/3"})]}):ie?o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):o.jsxs(o.Fragment,{children:[(y||_)&&o.jsxs("div",{className:"shrink-0 border-b border-border",children:[o.jsxs("div",{role:"button",tabIndex:0,"aria-label":n($?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(Y=>!Y),onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),M(pe=>!pe))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:Y=>Y.stopPropagation(),children:[y&&o.jsx("button",{type:"button",onClick:()=>{F("deck"),M(!1)},className:le("rounded-md px-2.5 py-1",oe?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),o.jsx("button",{type:"button",onClick:()=>{F("components"),M(!1)},className:le("rounded-md px-2.5 py-1",oe?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),$?o.jsx(ds,{size:16,className:"shrink-0 text-muted-foreground"}):o.jsx(R6,{size:16,className:"shrink-0 text-muted-foreground"})]}),!$&&o.jsx("div",{className:"px-4 pb-4",children:o.jsx("div",{className:le("w-full overflow-hidden rounded-xl border border-border bg-muted/30",oe?"aspect-[16/9]":"h-96"),children:oe?o.jsx(kde,{readUrl:j,title:`${c} deck theme`,tokensUrl:S}):o.jsx(_de,{tokensUrl:S})})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Qd,{children:n("library.brandPreview.logo")}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:w?o.jsx("img",{src:u(a,w),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):o.jsx(Wm,{size:28,className:"text-muted-foreground/50"})}),C&&o.jsxs("div",{children:[o.jsxs(me,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[o.jsx(Qn,{size:14}),n(w?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),o.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:Y=>{re(Y.target.files)}})]})]})]}),K.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Qd,{children:n("library.brandPreview.colors")}),K.map(Y=>o.jsx(jde,{family:Y.family,tokens:Y.tokens,editing:C,valueOf:W,onEdit:J},Y.family))]}),(q.length>0||G.length>0)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Qd,{children:n("library.brandPreview.typography")}),q.map(Y=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:Y.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),C?o.jsx(yt,{value:W(Y),onChange:pe=>J(Y.name,pe.target.value),className:"h-9"}):o.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:W(Y)},children:W(Y)})]},Y.name)),G.map(Y=>o.jsx(Cj,{token:Y,value:W(Y),editing:C,onEdit:J},Y.name))]}),o.jsx(Dd,{label:n("library.brandPreview.spacing"),tokens:te,editing:C,valueOf:W,onEdit:J}),o.jsx(Dd,{label:n("library.brandPreview.radius"),tokens:X,editing:C,valueOf:W,onEdit:J}),o.jsx(Dd,{label:n("library.brandPreview.shadows"),tokens:Z,editing:C,valueOf:W,onEdit:J}),o.jsx(Dd,{label:n("library.brandPreview.motion"),tokens:ee,editing:C,valueOf:W,onEdit:J}),o.jsx(Dd,{label:n("library.brandPreview.tokens"),tokens:se,editing:C,valueOf:W,onEdit:J}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Qd,{children:n("library.brandPreview.voiceGuidelines")}),C?o.jsx(Yo,{value:ce,onChange:Y=>I(Y.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):V.isPending&&L?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(tn,{className:"h-3 w-full"}),o.jsx(tn,{className:"h-3 w-5/6"})]}):ce.trim()?o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:o.jsx(ld,{id:`brand-preview-${t}`,text:ce})}):o.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function Nj(t){const e=U.c(8),{brandPath:s,onClose:n}=t;let r;e[0]!==n?(r=l=>{l||n()},e[0]=n,e[1]=r):r=e[1];let i;e[2]!==s||e[3]!==n?(i=o.jsx(Bt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:o.jsx(Nde,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=o.jsx(zt,{open:!0,onOpenChange:r,children:i}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function Vj(t){const e=U.c(9),{previewPath:s,onClose:n,showSeeInLibrary:r}=t,i=r===void 0?!1:r;let a;e[0]!==n?(a=d=>{d||n()},e[0]=n,e[1]=a):a=e[1];let l;e[2]!==n||e[3]!==s||e[4]!==i?(l=o.jsx(Bt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:o.jsx(jj,{previewPath:s,onClose:n,showSeeInLibrary:i,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=i,e[5]=l):l=e[5];let c;return e[6]!==a||e[7]!==l?(c=o.jsx(zt,{open:!0,onOpenChange:a,children:l}),e[6]=a,e[7]=l,e[8]=c):c=e[8],c}function Vde(t){const e=U.c(11),{onOpenDir:s}=t,n=ue(),r=OE();let i;e[0]!==r.data?(i=r.data??[],e[0]=r.data,e[1]=i):i=e[1];let a;if(e[2]!==s||e[3]!==n||e[4]!==i){let c;e[6]!==s||e[7]!==n?(c=d=>o.jsx(l0,{name:d.volume,glyph:Gn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:h7(d.lastSyncedAt)}):n("library.syncedRepos.waitingFirstSync"),onOpen:()=>s(d.volume)},d.id),e[6]=s,e[7]=n,e[8]=c):c=e[8],a=i.map(c),e[2]=s,e[3]=n,e[4]=i,e[5]=a}else a=e[5];let l;return e[9]!==a?(l=o.jsx(o.Fragment,{children:a}),e[9]=a,e[10]=l):l=e[10],l}function px(t){return`${window.location.origin}${t}`}function xu(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const Tde=[ku,"uploads","outputs"],Tj=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Qn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Fi}],Dp=new Set([...Tj.map(t=>t.volume),Wc("public")]),Pde=6;function Pj(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",r=W8(t),i=r?`public/${r}`:t==="home"?ju(s):t;return n?`${i}/${n}`:i}function mh(t,e,s){return{onDragStart:n=>{s.onDragStart?.(t),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("application/x-studio-library-path",t)},onContextMenu:n=>{n.preventDefault(),s.onContextMenu?.(t,e)},onDrop:s.onDrop?n=>{n.preventDefault();const r=n.dataTransfer.getData("application/x-studio-library-path");r&&r!==t&&!t.startsWith(r+"/")&&s.onDrop(r,t)}:void 0}}function Ro(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Di(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"@container",children:o.jsx("div",{className:"grid grid-cols-1 gap-3 @[440px]:grid-cols-2 @[660px]:grid-cols-3",children:s})}),e[0]=s,e[1]=n):n=e[1],n}function X9(t){const e=U.c(2),{rows:s}=t,n=s===void 0?1:s;let r;return e[0]!==n?(r=o.jsx(Di,{children:Array.from({length:n*3},Ade)}),e[0]=n,e[1]=r):r=e[1],r}function Ade(t,e){return o.jsx(tn,{className:"h-16 rounded-2xl"},e)}function gx(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Ede(t){const e=U.c(12),{volume:s,descriptionKey:n,glyph:r,onOpen:i}=t,a=ue(),l=hA(s);let c;e[0]!==a||e[1]!==l.data?(c=l.data?a("library.libraryViews.filesCount",{count:l.data.files}):void 0,e[0]=a,e[1]=l.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==a?(d=a(n),e[3]=n,e[4]=a,e[5]=d):d=e[5];let h;return e[6]!==r||e[7]!==i||e[8]!==c||e[9]!==d||e[10]!==s?(h=o.jsx(l0,{name:s,meta:c,subtitle:d,glyph:r,tone:"system",onOpen:i}),e[6]=r,e[7]=i,e[8]=c,e[9]=d,e[10]=s,e[11]=h):h=e[11],h}function Rde(t){const e=U.c(12),{onOpenDir:s}=t,n=ue(),i=S8().data?.length??0;let a;e[0]!==s?(a=Tj.map(h=>o.jsx(Ede,{volume:h.volume,descriptionKey:h.descriptionKey,glyph:h.glyph,onOpen:()=>s(h.volume)},h.volume)),e[0]=s,e[1]=a):a=e[1];let l;e[2]!==s||e[3]!==i||e[4]!==n?(l=i>0&&o.jsx(l0,{name:Wc("public"),meta:n("library.libraryViews.skillSetsCount",{count:i}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:hi,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=i,e[4]=n,e[5]=l):l=e[5];let c;e[6]!==s?(c=o.jsx(Vde,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==a||e[9]!==l||e[10]!==c?(d=o.jsxs(o.Fragment,{children:[a,l,c]}),e[8]=a,e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function Dde(t){const e=U.c(19),{segments:s,onNavigate:n}=t,{org:r}=Fe();let i;e[0]!==s?(i=s[0]===ku?s.slice(1):s,e[0]=s,e[1]=i):i=e[1];const a=i,l=s.length-a.length,c=a.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==r.slug?(d=c?o.jsx("span",{className:"truncate font-medium text-foreground",children:ju(r.slug)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(ku),children:ju(r.slug)}),e[2]=c,e[3]=n,e[4]=r.slug,e[5]=d):d=e[5];let h;if(e[6]!==l||e[7]!==n||e[8]!==a||e[9]!==s){let f;e[11]!==l||e[12]!==n||e[13]!==a.length||e[14]!==s?(f=(m,p)=>{const g=s.slice(0,l+p+1).join("/"),x=p===a.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx(Us,{size:12,className:"shrink-0 text-muted-foreground"}),x?o.jsx("span",{className:"truncate font-medium text-foreground",children:Wc(m)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Wc(m)})]},g)},e[11]=l,e[12]=n,e[13]=a.length,e[14]=s,e[15]=f):f=e[15],h=a.map(f),e[6]=l,e[7]=n,e[8]=a,e[9]=s,e[10]=h}else h=e[10];let u;return e[16]!==d||e[17]!==h?(u=o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,h]}),e[16]=d,e[17]=h,e[18]=u):u=e[18],u}function Mde(t){const e=U.c(43),{query:s,scope:n,stale:r,onOpenFile:i,onShare:a,onDelete:l}=t,c=ue(),{org:d}=Fe(),h=e0(),u=uA(s,n);let f;e[0]!==h||e[1]!==a?(f=S=>a({volume:S.volume,path:S.path,kind:"file",shareMode:S.shareMode??"private",effectivePublic:S.effectivePublic??!1,url:px(h(S.volume,S.path))}),e[0]=h,e[1]=a,e[2]=f):f=e[2];const m=f;if(u.isPending){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(X9,{rows:2}),e[3]=S):S=e[3],S}let p,g,x,b,v;if(e[4]!==s||e[5]!==u.data||e[6]!==u.isPlaceholderData||e[7]!==r||e[8]!==c){v=Symbol.for("react.early_return_sentinel");e:{if(g=u.data??[],g.length===0){let k;e[14]!==s||e[15]!==c?(k=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=k):k=e[16];let j;e[17]!==k?(j=o.jsx(gx,{children:k}),e[17]=k,e[18]=j):j=e[18],v=j;break e}const S=(r||u.isPlaceholderData)&&"opacity-50";e[19]!==S?(b=le("flex flex-col gap-3",S),e[19]=S,e[20]=b):b=e[20],p=Ro,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=u.data,e[6]=u.isPlaceholderData,e[7]=r,e[8]=c,e[9]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=v}else p=e[9],g=e[10],x=e[11],b=e[12],v=e[13];if(v!==Symbol.for("react.early_return_sentinel"))return v;let _;e[21]!==p||e[22]!==x?(_=o.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=_):_=e[23];let L;if(e[24]!==h||e[25]!==l||e[26]!==i||e[27]!==d||e[28]!==g||e[29]!==m){let S;e[31]!==h||e[32]!==l||e[33]!==i||e[34]!==d||e[35]!==m?(S=k=>{const j=W8(k.volume)!==null;return o.jsx(f7,{filename:dn(k.path),updatedAt:k.updatedAt,downloadUrl:h(k.volume,k.path),subtitle:Pj(k.volume,k.path,d.slug),publicState:xu(k),onOpen:()=>i(q8(k.volume,k.path)),onShare:j?void 0:()=>m(k),onDelete:j?void 0:()=>l({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[31]=h,e[32]=l,e[33]=i,e[34]=d,e[35]=m,e[36]=S):S=e[36],L=g.map(S),e[24]=h,e[25]=l,e[26]=i,e[27]=d,e[28]=g,e[29]=m,e[30]=L}else L=e[30];let y;e[37]!==L?(y=o.jsx(Di,{children:L}),e[37]=L,e[38]=y):y=e[38];let w;return e[39]!==b||e[40]!==_||e[41]!==y?(w=o.jsxs("div",{className:b,children:[_,y]}),e[39]=b,e[40]=_,e[41]=y,e[42]=w):w=e[42],w}function Ide(t){const e=U.c(39),{onOpenFile:s,onShare:n,onDelete:r}=t,i=ue(),{org:a}=Fe(),l=_8(),c=e0();let d;e[0]!==c||e[1]!==n?(d=v=>n({volume:v.volume,path:v.path,kind:"file",shareMode:v.shareMode??"private",effectivePublic:v.effectivePublic??!1,url:px(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const h=d;if(l.isPending){let v;e[3]!==i?(v=i("library.libraryViews.recentlyAdded"),e[3]=i,e[4]=v):v=e[4];let _;e[5]!==v?(_=o.jsx(Ro,{children:v}),e[5]=v,e[6]=_):_=e[6];let L;e[7]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(X9,{}),e[7]=L):L=e[7];let y;return e[8]!==_?(y=o.jsxs("div",{className:"flex flex-col gap-3",children:[_,L]}),e[8]=_,e[9]=y):y=e[9],y}let u,f,m,p,g;if(e[10]!==c||e[11]!==r||e[12]!==s||e[13]!==a||e[14]!==l.data||e[15]!==h||e[16]!==i){g=Symbol.for("react.early_return_sentinel");e:{const v=(l.data??[]).slice(0,Pde);if(v.length===0){g=null;break e}m="flex flex-col gap-3";let _;e[22]!==i?(_=i("library.libraryViews.recentlyAdded"),e[22]=i,e[23]=_):_=e[23],e[24]!==_?(p=o.jsx(Ro,{children:_}),e[24]=_,e[25]=p):p=e[25],u=Di;let L;e[26]!==c||e[27]!==r||e[28]!==s||e[29]!==a||e[30]!==h?(L=y=>o.jsx(zE,{filename:dn(y.path),updatedAt:y.updatedAt,size:y.size,downloadUrl:c(y.volume,y.path),subtitle:Pj(y.volume,y.path,a.slug),publicState:xu(y),onOpen:()=>s(q8(y.volume,y.path)),onShare:()=>h(y),onDelete:()=>r({volume:y.volume,path:y.path,kind:"file"})},`${y.volume}/${y.path}`),e[26]=c,e[27]=r,e[28]=s,e[29]=a,e[30]=h,e[31]=L):L=e[31],f=v.map(L)}e[10]=c,e[11]=r,e[12]=s,e[13]=a,e[14]=l.data,e[15]=h,e[16]=i,e[17]=u,e[18]=f,e[19]=m,e[20]=p,e[21]=g}else u=e[17],f=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==u||e[33]!==f?(x=o.jsx(u,{children:f}),e[32]=u,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=o.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function Ode(t){const e=U.c(16),{onOpenDir:s}=t,n=ue(),r=S8();if(r.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(X9,{}),e[0]=d):d=e[0],d}let i;e[1]!==r.data?(i=r.data??[],e[1]=r.data,e[2]=i):i=e[2];const a=i;if(a.length===0){let d;e[3]!==n?(d=n("library.libraryViews.noPublicSkillSetsConfigured"),e[3]=n,e[4]=d):d=e[4];let h;return e[5]!==d?(h=o.jsx(gx,{children:d}),e[5]=d,e[6]=h):h=e[6],h}let l;if(e[7]!==s||e[8]!==a||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=h=>o.jsx(l0,{name:h,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${h}`)},h),e[11]=s,e[12]=n,e[13]=d):d=e[13],l=a.map(d),e[7]=s,e[8]=a,e[9]=n,e[10]=l}else l=e[10];let c;return e[14]!==l?(c=o.jsx(Di,{children:l}),e[14]=l,e[15]=c):c=e[15],c}function $de(t){const e=U.c(63),{location:s,onOpenDir:n,onOpenFile:r,onOpenSkill:i,onOpenBrand:a,onShare:l,onDelete:c,onDragStart:d,onContextMenu:h,onMove:u}=t,f=ue(),{org:m}=Fe(),p=s.volume??"",g=w8(p,s.dirPath),x=e0();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=C=>s.isHomeRoot&&Dp.has(C.toLowerCase())?`${ju(m.slug)}/${C}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const v=b;let _;e[3]!==s.isHomeRoot||e[4]!==n?(_=s.isHomeRoot?o.jsx(Rde,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=_):_=e[5];const L=_;if(g.isPending){let C;e[6]!==L||e[7]!==f?(C=L&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ro,{children:f("library.libraryViews.folders")}),o.jsx(Di,{children:L})]}),e[6]=L,e[7]=f,e[8]=C):C=e[8];let T;e[9]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(X9,{rows:2}),e[9]=T):T=e[9];let A;return e[10]!==C?(A=o.jsxs(o.Fragment,{children:[C,T]}),e[10]=C,e[11]=A):A=e[11],A}if(g.isError){let C;e[12]!==g.error||e[13]!==f?(C=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=C):C=e[14];let T;return e[15]!==C?(T=o.jsx("p",{className:"text-sm text-destructive",children:C}),e[15]=C,e[16]=T):T=e[16],T}let y,w,S,k,j;if(e[17]!==v||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==h||e[22]!==c||e[23]!==d||e[24]!==u||e[25]!==a||e[26]!==n||e[27]!==r||e[28]!==i||e[29]!==l||e[30]!==L||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const C=g.data??[],T=C.filter(Ude),A=C.filter(Fde),R=C.filter(zde),E=C.filter(Bde);if(C.length===0&&!s.isHomeRoot){let M;e[38]!==s.readOnly||e[39]!==f?(M=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=M):M=e[40];let z;e[41]!==M?(z=o.jsx(gx,{children:M}),e[41]=M,e[42]=z):z=e[42],j=z;break e}let I;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(I=M=>s.readOnly?void 0:()=>c({volume:p,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=I):I=e[46];const D=I;let O;e[47]!==x||e[48]!==s.readOnly||e[49]!==l||e[50]!==p?(O=M=>s.readOnly?void 0:()=>l({volume:p,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?px(x(p,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=l,e[50]=p,e[51]=O):O=e[51];const $=O;y=T.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ro,{children:f("library.libraryViews.skills")}),o.jsx(Di,{children:T.map(M=>o.jsx($E,{dirName:dn(M.path),updatedAt:M.updatedAt,skillMdUrl:x(p,`${M.path}/SKILL.md`),publicState:xu(M),onOpen:()=>i(gc(s,M.path)),onBrowse:()=>n(gc(s,M.path)),onShare:$(M),onDelete:D(M),draggable:!s.readOnly,...mh(M.path,"dir",{onDragStart:d,onContextMenu:h})},M.path))})]}),w=A.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ro,{children:f("library.libraryViews.brands")}),o.jsx(Di,{children:A.map(M=>o.jsx(BE,{dirName:dn(M.path),updatedAt:M.updatedAt,tokensUrl:x(p,`${M.path}/tokens.css`),onOpen:()=>a(gc(s,M.path)),onBrowse:()=>n(gc(s,M.path)),onDelete:D(M),draggable:!s.readOnly,...mh(M.path,"dir",{onDragStart:d,onContextMenu:h})},M.path))})]}),S=(R.length>0||L)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ro,{children:f("library.libraryViews.folders")}),o.jsxs(Di,{children:[L,R.map(M=>o.jsx(l0,{name:dn(M.path),meta:h7(M.updatedAt),subtitle:v(dn(M.path)),readOnly:s.readOnly,publicState:xu(M),onOpen:()=>n(gc(s,M.path)),onShare:$(M),onDelete:D(M),draggable:!s.readOnly,...mh(M.path,"dir",{onDragStart:d,onContextMenu:h,onDrop:u})},M.path))]})]}),k=E.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ro,{children:f("library.libraryViews.files")}),o.jsx(Di,{children:E.map(M=>o.jsx(f7,{filename:dn(M.path),updatedAt:M.updatedAt,downloadUrl:x(p,M.path),publicState:xu(M),onOpen:()=>r(gc(s,M.path)),onShare:$(M),onDelete:D(M),draggable:!s.readOnly,...mh(M.path,"file",{onDragStart:d,onContextMenu:h})},M.path))})]})}e[17]=v,e[18]=x,e[19]=g.data,e[20]=s,e[21]=h,e[22]=c,e[23]=d,e[24]=u,e[25]=a,e[26]=n,e[27]=r,e[28]=i,e[29]=l,e[30]=L,e[31]=f,e[32]=p,e[33]=y,e[34]=w,e[35]=S,e[36]=k,e[37]=j}else y=e[33],w=e[34],S=e[35],k=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let N;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==r||e[55]!==l?(N=s.isHomeRoot&&o.jsx(Ide,{onOpenFile:r,onShare:l,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=r,e[55]=l,e[56]=N):N=e[56];let V;return e[57]!==y||e[58]!==w||e[59]!==S||e[60]!==k||e[61]!==N?(V=o.jsxs(o.Fragment,{children:[y,w,S,k,N]}),e[57]=y,e[58]=w,e[59]=S,e[60]=k,e[61]=N,e[62]=V):V=e[62],V}function Bde(t){return t.kind==="file"}function zde(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function Fde(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function Ude(t){return t.kind==="dir"&&t.hasSkill}function Hde({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=ue(),{org:r}=Fe(),i=Ns(),a=on(),l=Ja(),c=na({strict:!1}),d=c.path||ku,h=yg(d),u=FE(),f=h.volume!==null&&u.has(h.volume)?{...h,readOnly:!0}:h,m=(Y,pe)=>a({to:".",search:be=>({...be,[Y]:pe||void 0})}),p=Y=>m("path",Y),g=(Y,pe)=>a({to:".",search:be=>({...be,preview:void 0,skill:void 0,brand:void 0,[Y]:pe})}),x=t??(Y=>g("preview",Y)),b=e??(Y=>g("skill",Y)),v=s??(Y=>g("brand",Y)),[_,L]=P.useState(""),y=y9(_.trim(),300),w=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,S=w?n("library.library.searchInPlaceholder",{folder:Wc(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),k=f.isHomeRoot?ju(r.slug):Wc(f.segments.at(-1)??""),[j,N]=P.useState(null),[V,C]=P.useState(null),[T,A]=P.useState(!1),[R,E]=P.useState(""),[I,D]=P.useState(!1),[O,$]=P.useState(null),[M,z]=P.useState(""),F=P.useRef(null),[B,H]=P.useState(!1),W=P.useRef(0),K=f.readOnly?null:f.volume,{upload:q,mkdir:G,move:te}=Lu(K??ku),{remove:X}=Lu(j?.volume??"uploads");async function Z(Y){if(!(!K||!Y||Y.length===0))try{await q.mutateAsync({dir:f.dirPath,files:[...Y]}),ye.success(Y.length===1?n("library.library.uploadedSingle",{filename:Y[0]?.name??""}):n("library.library.uploadedMultiple",{count:Y.length}))}catch(pe){ye.error(pe instanceof Error?pe.message:n("library.library.uploadFailed"))}finally{F.current&&(F.current.value="")}}const ee=K!==null;function se(Y){return Y.dataTransfer.types.includes("Files")}function J(Y){!ee||!se(Y)||(Y.preventDefault(),W.current+=1,H(!0))}function oe(Y){!ee||!se(Y)||Y.preventDefault()}function ce(){ee&&(W.current=Math.max(0,W.current-1),W.current===0&&H(!1))}function he(Y){ee&&(Y.preventDefault(),Y.stopPropagation(),W.current=0,H(!1),Y.dataTransfer.files.length>0&&Z(Y.dataTransfer.files))}async function ne(){const Y=R.trim();if(!(!K||!Y)){if(f.isHomeRoot&&Dp.has(Y.toLowerCase())){ye.error(n("library.library.folderNameReserved",{name:Y}));return}try{const pe=f.dirPath;await G.mutateAsync(pe?`${pe}/${Y}`:Y),ye.success(n("library.library.folderCreated",{name:Y})),A(!1),E("")}catch(pe){ye.error(pe instanceof Error?pe.message:n("library.library.folderCreateFailed"))}}}async function Q(){if(!j)return;const Y=j;try{await X.mutateAsync(Y.path),ye.success(n("library.library.deleted",{name:dn(Y.path)}))}catch(pe){ye.error(pe instanceof Error?pe.message:n("library.library.deleteFailed"))}finally{N(null)}}async function de(){if(!O)return;const Y=M.trim();if(!Y||Y.includes("/")||Y.includes("..")||Y===dn(O.path)){D(!1),$(null),z("");return}if(O.kind==="dir"&&f.isHomeRoot&&Dp.has(Y.toLowerCase())){ye.error(n("library.library.folderNameReserved",{name:Y}));return}try{const pe=O.path.includes("/")?O.path.slice(0,O.path.lastIndexOf("/")):"",be=pe?`${pe}/${Y}`:Y;await te.mutateAsync({from:O.path,to:be});const _e=Y.replace(/[<>]/g,"");ye.success(n("library.library.renamed",{name:_e}))}catch(pe){ye.error(pe instanceof Error?pe.message:n("library.library.renameFailed"))}finally{D(!1),$(null),z("")}}async function ae(Y,pe){try{const be=dn(Y),_e=pe?`${pe}/${be}`:be;await te.mutateAsync({from:Y,to:_e}),ye.success(n("library.library.moved",{name:be,destination:pe||n("library.library.theLibrary")}))}catch(be){ye.error(be instanceof Error?be.message:n("library.library.moveFailed"))}}function re(){for(const Y of Tde)i.invalidateQueries({queryKey:at.orgFsVolume(r.id,Y)});f.volume&&i.invalidateQueries({queryKey:at.orgFsVolume(r.id,f.volume)}),i.invalidateQueries({queryKey:at.orgFsRecent(r.id)}),i.invalidateQueries({queryKey:at.orgFsSearchRoot(r.id)}),i.invalidateQueries({queryKey:at.orgFsPublicSets(r.id)})}function ie(Y){Y.defaultPrevented||!K||Y.target.closest("input, textarea, button, a, [role='button']")||(Y.preventDefault(),A(!0))}return o.jsxs("div",{className:"relative h-full",onDragEnter:J,onDragOver:oe,onDragLeave:ce,onDrop:he,onContextMenu:ie,children:[B&&o.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/80 p-6 backdrop-blur-sm",children:o.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-primary px-10 py-8 text-center",children:[o.jsx(Qn,{size:28,className:"text-primary"}),o.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:k})})]})}),o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:o.jsx(Dde,{segments:f.segments,onNavigate:p})}),o.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[o.jsx(r0,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),o.jsx(yt,{value:_,onChange:Y=>L(Y.target.value),onKeyDown:Y=>{Y.key==="Escape"&&L("")},placeholder:S,className:"h-9 rounded-xl pr-9 pl-9"}),_&&o.jsx(me,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>L(""),"aria-label":n("library.library.clearSearch"),children:o.jsx(lr,{size:14})})]}),o.jsx(me,{variant:"ghost",size:"icon",onClick:re,"aria-label":n("library.library.refresh"),children:o.jsx(Mn,{size:14})}),K&&o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>A(!0),children:[o.jsx(Qt,{size:14}),n("library.library.newFolder")]}),f.readOnly?o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(o0,{size:12}),n("library.library.readOnly")]}):o.jsxs(me,{size:"sm",disabled:q.isPending,onClick:()=>F.current?.click(),children:[o.jsx(Qn,{size:14}),q.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),o.jsx("input",{ref:F,type:"file",multiple:!0,className:"hidden",onChange:Y=>{Z(Y.target.files)}})]}),y?o.jsx(Mde,{query:y,scope:w,stale:_.trim()!==y,onOpenFile:x,onShare:C,onDelete:N}):f.volume===null?o.jsx(Ode,{onOpenDir:p}):o.jsx($de,{location:f,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:v,onShare:C,onDelete:N,onContextMenu:(Y,pe)=>{$({path:Y,kind:pe}),z(dn(Y)),D(!0)},onMove:ae},f.volume)]})}),l&&(c.preview?o.jsx(Vj,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?o.jsx(K8,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?o.jsx(Nj,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),o.jsx(zt,{open:T,onOpenChange:A,children:o.jsxs(Bt,{children:[o.jsxs(ls,{children:[o.jsx(qt,{children:n("library.library.newFolderTitle")}),o.jsx(In,{children:n("library.library.newFolderDescription",{path:k||n("library.library.theLibrary")})})]}),o.jsx(yt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:R,onChange:Y=>E(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&ne()}}),o.jsxs(Yn,{children:[o.jsx(me,{variant:"outline",onClick:()=>A(!1),children:n("library.library.cancel")}),o.jsx(me,{disabled:!R.trim()||G.isPending,onClick:()=>{ne()},children:n("library.library.create")})]})]})}),o.jsx(zt,{open:I,onOpenChange:Y=>{D(Y),Y||($(null),z(""))},children:o.jsxs(Bt,{children:[o.jsxs(ls,{children:[o.jsx(qt,{children:O&&n("library.library.renameTitle",{name:dn(O.path)})}),o.jsx(In,{children:n("library.library.renameDescription")})]}),o.jsx(yt,{autoFocus:!0,value:M,onChange:Y=>z(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&de()}}),o.jsxs(Yn,{children:[o.jsx(me,{variant:"outline",onClick:()=>D(!1),children:n("library.library.cancel")}),o.jsx(me,{disabled:!M.trim()||te.isPending,onClick:()=>{de()},children:n("library.library.rename")})]})]})}),o.jsx(ude,{target:V,onOpenChange:Y=>{Y||C(null)}}),o.jsx(Wi,{open:j!==null,onOpenChange:Y=>{Y||N(null)},children:o.jsxs(qi,{children:[o.jsxs(Gi,{children:[o.jsx(Yi,{children:n("library.library.deleteTitle",{name:j?dn(j.path):""})}),o.jsx(Qi,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),o.jsxs(Xi,{children:[o.jsx(Ji,{children:n("library.library.cancel")}),o.jsx(Zi,{onClick:()=>{Q()},children:n("library.library.delete")})]})]})})]})}function Kde(){const t=U.c(10),{openPanel:e}=pi(),[s,n]=P.useState(null),[r,i]=P.useState(null);let a;t[0]!==e?(a=o.jsx(Hde,{onOpenFile:h=>e($N(h)),onOpenSkill:n,onOpenBrand:i}),t[0]=e,t[1]=a):a=t[1];let l;t[2]!==s?(l=s&&o.jsx(K8,{skillPath:s,onClose:()=>n(null)},s),t[2]=s,t[3]=l):l=t[3];let c;t[4]!==r?(c=r&&o.jsx(Nj,{brandPath:r,onClose:()=>i(null)},r),t[4]=r,t[5]=c):c=t[5];let d;return t[6]!==a||t[7]!==l||t[8]!==c?(d=o.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[a,l,c]}),t[6]=a,t[7]=l,t[8]=c,t[9]=d):d=t[9],d}const Dv=P.lazy(()=>Ks(()=>import("./project-app-view-_pt7eBEE.js"),__vite__mapDeps([185,1,2,81,30,31,32,33,34,35,36,37,38,39,40,25,29,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,82,83,84,10,11,12,19,85,86,87,88,89,90,91,92,93,94,95,96,24,4,5,9,13,14,15,16,17,3,6,7,8,18,20,21,22,23,28,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,74,115,146,159,121,122,123,160,155,130,131,161,116,117,73,118,119,120,124,125,126,127,128,129,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,147,148,149,150,72,151,152,79,153,154,156,157,158,162,163,164,76,165,166,167])).then(t=>({default:t.AppViewContent}))),Wde=P.lazy(()=>Ks(()=>import("./hosting-tab-CyasLnZ9.js"),__vite__mapDeps([186,1,2,31,29,41,30,32,33,34,35,36,37,38,39,40,25,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,133,74,78,149,24,73,85,187,19,10,11,12,135])).then(t=>({default:t.HostingTab}))),qde=P.lazy(()=>Ks(()=>import("./e2e-tab-D1XNI3nb.js"),__vite__mapDeps([188,1,2,37,29,41,30,31,32,33,34,35,36,38,39,40,25,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,133,74,78,149,24,73,85,187,19,10,11,12,135,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,4,5,9,13,14,15,16,17,3,6,7,8,18,20,21,22,23,28,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,118])).then(t=>({default:t.E2eTab}))),Gde=P.lazy(()=>Ks(()=>import("./analytics-tab-FZwL75da.js"),__vite__mapDeps([189,1,2,30,31,32,33,34,35,36,37,38,39,40,25,29,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,133,140,74,78,85,190,191,192,149,24,187,19,10,11,12,135])).then(t=>({default:t.AnalyticsTab}))),Yde=P.lazy(()=>Ks(()=>import("./cdn-tab-GRD3AIjn.js"),__vite__mapDeps([193,1,2,50,190,191,192,187,136,19,10,11,12,135,194,195])).then(t=>({default:t.CdnTab})));function Qde(){const t=U.c(2),e=rA();let s;return t[0]!==e?(s=e?o.jsx($U,{}):o.jsx(EU,{}),t[0]=e,t[1]=s):s=t[1],s}function Xde({activeTab:t,virtualMcpId:e,taskId:s,layoutTabs:n,expandedTools:r,automationTabParsed:i}){const a=sA(),l=Tm().monitorEnabled===!0||Tm().auth.localMode===!0;if(t==="overview")return o.jsx(Qde,{});if(t==="board")return o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(yX,{})});if(BN(t))return o.jsx(d5,{virtualMcpId:e});if(t==="git")return o.jsx(uZ,{virtualMcpId:e});if(t==="automations")return o.jsx(Mce,{virtualMcpId:e});if(t==="site-editor")return o.jsx(Coe,{virtualMcpId:e});const c=Vm(t);if(c)return o.jsx(Toe,{openPath:c.path});if(t==="content")return o.jsx(Hle,{virtualMcpId:e});if(t==="assets")return o.jsx(Wle,{virtualMcpId:e});if(t==="hosting"&&a.hosting)return o.jsx(Wde,{virtualMcpId:e});if(t==="e2e"&&a.e2e)return o.jsx(qde,{virtualMcpId:e});if(t==="analytics"&&a.analytics)return o.jsx(Gde,{virtualMcpId:e});if(t==="cdn"&&l&&a.monitor)return o.jsx(Yde,{virtualMcpId:e});if(t==="files")return o.jsx(Kde,{});if(t==="reports")return o.jsx(Uce,{});if(t==="discover")return o.jsx(Jce,{});if(t==="connect-sources")return o.jsx(Bce,{});if(i)return o.jsx(Ace,{tabId:t});const d=i6(t);if(d)return o.jsx(fde,{path:d.path},d.path);const h=r6(t);if(h)return o.jsx(Oce,{fileKey:h.key,taskId:s});const u=o6(t);if(u)return o.jsx(xde,{path:u.path},u.path);const f=zN(t);if(f){const p=r.find(g=>g.appId===f.connectionId&&g.toolName===f.toolName);return o.jsx(Ar,{children:o.jsx(Dv,{connectionId:f.connectionId,toolName:f.toolName,args:p?.args},t)})}const m=n.find(p=>p.id===t);return m?o.jsx(Ar,{children:o.jsx(Dv,{connectionId:m.view.appId,toolName:m.id,args:m.view.args},t)}):o.jsx(d5,{virtualMcpId:e})}function Jde(t){const e=U.c(13),{taskId:s,virtualMcpId:n}=t;let r;e[0]!==s||e[1]!==n?(r={virtualMcpId:n,taskId:s},e[0]=s,e[1]=n,e[2]=r):r=e[2];const{activeTab:i,layoutTabs:a,expandedTools:l,automationTabParsed:c}=Wg(r);let d;e[3]!==i||e[4]!==c||e[5]!==l||e[6]!==a||e[7]!==s||e[8]!==n?(d=o.jsx(Ar,{children:o.jsx(Xde,{activeTab:i,virtualMcpId:n,taskId:s,layoutTabs:a,expandedTools:l,automationTabParsed:c})}),e[3]=i,e[4]=c,e[5]=l,e[6]=a,e[7]=s,e[8]=n,e[9]=d):d=e[9];let h;return e[10]!==i||e[11]!==d?(h=o.jsx(sn,{children:d},i),e[10]=i,e[11]=d,e[12]=h):h=e[12],h}const Zde=new Set(["site-editor","content"]);function eue(t){return t.hasClonableSource&&!t.fastPreviewActive&&t.mainTab!==null&&Zde.has(t.mainTab)}const Da="setup";function tue(t){const e=U.c(57),s=ue();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let L;e[3]!==t.scriptTabs?(L=y=>!t.scriptTabs.includes(y),e[3]=t.scriptTabs,e[4]=L):L=e[4],n=t.scripts.filter(L),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const r=n;let i;e[5]!==t?(i=()=>{t.active===Da?t.onToggle():t.onSelectTab(Da)},e[5]=t,e[6]=i):i=e[6];const a=i;let l;e[7]!==t.open||e[8]!==s?(l=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=l):l=e[9];let c;e[10]!==t.open?(c=t.open?o.jsx(ds,{className:"size-4"}):o.jsx(R6,{className:"size-4"}),e[10]=t.open,e[11]=c):c=e[11];let d;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==l||e[15]!==c?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":l,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=l,e[15]=c,e[16]=d):d=e[16];let h;e[17]!==t.open||e[18]!==s?(h=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=h):h=e[19];let u;e[20]!==h?(u=o.jsx(We,{children:h}),e[20]=h,e[21]=u):u=e[21];let f;e[22]!==d||e[23]!==u?(f=o.jsxs(qe,{children:[d,u]}),e[22]=d,e[23]=u,e[24]=f):f=e[24];const m=t.active===Da;let p;e[25]!==a||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=o.jsx(sue,{active:m,open:t.open,onClick:a,t:s}),e[25]=a,e[26]=t.open,e[27]=s,e[28]=m,e[29]=p):p=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(L=>o.jsx(rue,{active:t.active===L,onClick:()=>{t.active===L?t.onToggle():t.onSelectTab(L)},onClose:()=>t.onCloseScript(L),t:s,children:L},L)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==r||e[34]!==t.onAddScript?(x=o.jsx(iue,{scripts:r,onRun:t.onAddScript}),e[33]=r,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==p?(b=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,g,x]}),e[36]=g,e[37]=x,e[38]=p,e[39]=b):b=e[39];let v;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(v=t.showScriptControls?o.jsx(oue,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):o.jsx(nue,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=v):v=e[52];let _;return e[53]!==b||e[54]!==v||e[55]!==f?(_=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,b,v]}),e[53]=b,e[54]=v,e[55]=f,e[56]=_):_=e[56],_}function sue(t){const e=U.c(11),{active:s,open:n,onClick:r,t:i}=t,a=s&&n,l=s&&n,c=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let d;e[0]!==c?(d=le("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(fE,{className:"size-4"}),e[2]=h):h=e[2];let u;e[3]!==i?(u=i("sandbox.toolbar.setupTab"),e[3]=i,e[4]=u):u=e[4];let f;return e[5]!==r||e[6]!==a||e[7]!==l||e[8]!==d||e[9]!==u?(f=o.jsxs("button",{type:"button","aria-pressed":a,"aria-expanded":l,onClick:r,className:d,children:[h,u]}),e[5]=r,e[6]=a,e[7]=l,e[8]=d,e[9]=u,e[10]=f):f=e[10],f}function nue(t){const e=U.c(40),{status:s,onStart:n,onStop:r,onRestart:i,onResume:a,onRetry:l,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Oa,{className:"size-3.5"}),e[0]=d):d=e[0];let h;e[1]!==c?(h=c("sandbox.toolbar.start"),e[1]=c,e[2]=h):h=e[2];let u;return e[3]!==n||e[4]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:n,children:[d," ",h]}),e[3]=n,e[4]=h,e[5]=u):u=e[5],u}if(s==="suspended"&&a){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Oa,{className:"size-3.5"}),e[6]=d):d=e[6];let h;e[7]!==c?(h=c("sandbox.toolbar.resume"),e[7]=c,e[8]=h):h=e[8];let u;return e[9]!==a||e[10]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:a,children:[d," ",h]}),e[9]=a,e[10]=h,e[11]=u):u=e[11],u}if(s==="errored"&&l){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Mn,{className:"size-3.5"}),e[12]=d):d=e[12];let h;e[13]!==c?(h=c("sandbox.toolbar.retry"),e[13]=c,e[14]=h):h=e[14];let u;return e[15]!==l||e[16]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:l,children:[d," ",h]}),e[15]=l,e[16]=h,e[17]=u):u=e[17],u}if(s==="starting"||s==="running"){const d=s==="running"&&!!i,h=d?"rounded-r-none border-r-0":void 0;let u;e[18]!==h?(u=le(h),e[18]=h,e[19]=u):u=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let m;e[22]!==r||e[23]!==u||e[24]!==f?(m=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",onClick:r,className:u,children:f})}),e[22]=r,e[23]=u,e[24]=f,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=o.jsx(We,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=o.jsxs(qe,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==i||e[34]!==d||e[35]!==c?(b=d&&o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":c("sandbox.toolbar.moreActions"),children:o.jsx(ds,{className:"size-3"})})}),o.jsx(Ht,{align:"end",children:o.jsxs(et,{onClick:i,children:[o.jsx(Mn,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=i,e[34]=d,e[35]=c,e[36]=b):b=e[36];let v;return e[37]!==x||e[38]!==b?(v=o.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=v):v=e[39],v}return null}function rue(t){const e=U.c(17),{active:s,onClick:n,onClose:r,children:i,t:a}=t,l=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==l?(c=le("flex h-6 items-center rounded-md border text-xs",l),e[0]=l,e[1]=c):c=e[1];const d=r?"pl-2 pr-1":"px-2",h=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let u;e[2]!==d||e[3]!==h?(u=le("flex h-full items-center",d,h),e[2]=d,e[3]=h,e[4]=u):u=e[4];let f;e[5]!==i||e[6]!==n||e[7]!==u?(f=o.jsx("button",{type:"button",onClick:n,className:u,children:i}),e[5]=i,e[6]=n,e[7]=u,e[8]=f):f=e[8];let m;e[9]!==i||e[10]!==r||e[11]!==a?(m=r&&o.jsx("button",{type:"button","aria-label":a("sandbox.toolbar.closeTab",{tab:String(i)}),onClick:r,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:o.jsx(nn,{className:"size-3.5"})}),e[9]=i,e[10]=r,e[11]=a,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==f||e[15]!==m?(p=o.jsxs("div",{className:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function iue(t){const e=U.c(27),{scripts:s,onRun:n}=t,r=ue(),[i,a]=P.useState(!1);let l;e[0]!==r?(l=r("sandbox.toolbar.runScript"),e[0]=r,e[1]=l):l=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Qt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==l?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(gs,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"xs","aria-label":l,children:c})})}),e[3]=l,e[4]=d):d=e[4];let h;e[5]!==r?(h=r("sandbox.toolbar.runScript"),e[5]=r,e[6]=h):h=e[6];let u;e[7]!==h?(u=o.jsx(We,{children:h}),e[7]=h,e[8]=u):u=e[8];let f;e[9]!==d||e[10]!==u?(f=o.jsxs(qe,{children:[d,u]}),e[9]=d,e[10]=u,e[11]=f):f=e[11];let m;e[12]!==r?(m=r("sandbox.toolbar.runAScript"),e[12]=r,e[13]=m):m=e[13];let p;e[14]!==m?(p=o.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:m}),e[14]=m,e[15]=p):p=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==r?(g=s.length===0?o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:r("sandbox.toolbar.noScriptsFound")}):s.map(v=>o.jsxs("button",{type:"button",onClick:()=>{a(!1),n(v)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",v]},v)),e[16]=n,e[17]=s,e[18]=r,e[19]=g):g=e[19];let x;e[20]!==p||e[21]!==g?(x=o.jsxs(ys,{align:"start",className:"p-1 w-56",children:[p,g]}),e[20]=p,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==i||e[24]!==x||e[25]!==f?(b=o.jsxs(_s,{open:i,onOpenChange:a,children:[f,x]}),e[23]=i,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function oue(t){const e=U.c(30),{isRunning:s,isKilling:n,onRun:r,onStop:i,t:a}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(nt,{className:"size-3.5"}),e[0]=f):f=e[0];let m;e[1]!==a?(m=a("sandbox.toolbar.stopping"),e[1]=a,e[2]=m):m=e[2];let p;return e[3]!==m?(p=o.jsxs(me,{variant:"outline",size:"xs",disabled:!0,children:[f," ",m]}),e[3]=m,e[4]=p):p=e[4],p}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Oa,{className:"size-3.5"}),e[5]=f):f=e[5];let m;e[6]!==a?(m=a("sandbox.toolbar.run"),e[6]=a,e[7]=m):m=e[7];let p;e[8]!==r||e[9]!==m?(p=o.jsx(Ke,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"xs",onClick:r,children:[f," ",m]})}),e[8]=r,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==a?(g=a("sandbox.toolbar.startProcess"),e[11]=a,e[12]=g):g=e[12];let x;e[13]!==g?(x=o.jsx(We,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=o.jsxs(qe,{children:[p,x]}),e[15]=p,e[16]=x,e[17]=b):b=e[17],b}let l;e[18]!==a?(l=a("sandbox.toolbar.stop"),e[18]=a,e[19]=l):l=e[19];let c;e[20]!==i||e[21]!==l?(c=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",onClick:i,children:l})}),e[20]=i,e[21]=l,e[22]=c):c=e[22];let d;e[23]!==a?(d=a("sandbox.toolbar.stopProcess"),e[23]=a,e[24]=d):d=e[24];let h;e[25]!==d?(h=o.jsx(We,{children:d}),e[25]=d,e[26]=h):h=e[26];let u;return e[27]!==c||e[28]!==h?(u=o.jsxs(qe,{children:[c,h]}),e[27]=c,e[28]=h,e[29]=u):u=e[29],u}var Aj=Object.defineProperty,aue=Object.getOwnPropertyDescriptor,lue=(t,e)=>{for(var s in e)Aj(t,s,{get:e[s],enumerable:!0})},Ts=(t,e,s,n)=>{for(var r=n>1?void 0:n?aue(e,s):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(r=(n?a(e,s,r):a(r))||r);return n&&r&&Aj(e,s,r),r},Xe=(t,e)=>(s,n)=>e(s,n,t),Mv="Terminal input",Mp={get:()=>Mv,set:t=>Mv=t},Iv="Too much output to announce, navigate to rows manually to read",Ip={get:()=>Iv,set:t=>Iv=t};function cue(t){return t.replace(/\r?\n/g,"\r")}function due(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function uue(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function hue(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");Ej(r,e,s,n)}}function Ej(t,e,s,n){t=cue(t),t=due(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function Rj(t,e,s){let n=s.getBoundingClientRect(),r=t.clientX-n.left-10,i=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${i}px`,e.style.zIndex="1000",e.focus()}function Ov(t,e,s,n,r){Rj(t,e,s),r&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Ao(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function J9(t,e=0,s=t.length){let n="";for(let r=e;r<s;++r){let i=t[r];i>65535?(i-=65536,n+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):n+=String.fromCharCode(i)}return n}var fue=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let n=0,r=0;if(this._interim){let i=t.charCodeAt(r++);56320<=i&&i<=57343?e[n++]=(this._interim-55296)*1024+i-56320+65536:(e[n++]=this._interim,e[n++]=i),this._interim=0}for(let i=r;i<s;++i){let a=t.charCodeAt(i);if(55296<=a&&a<=56319){if(++i>=s)return this._interim=a,n;let l=t.charCodeAt(i);56320<=l&&l<=57343?e[n++]=(a-55296)*1024+l-56320+65536:(e[n++]=a,e[n++]=l);continue}a!==65279&&(e[n++]=a)}return n}},mue=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let n=0,r,i,a,l,c=0,d=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-p;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}f||(x===2?m<128?d--:e[n++]=m:x===3?m<2048||m>=55296&&m<=57343||m===65279||(e[n++]=m):m<65536||m>1114111||(e[n++]=m)),this.interim.fill(0)}let h=s-4,u=d;for(;u<s;){for(;u<h&&!((r=t[u])&128)&&!((i=t[u+1])&128)&&!((a=t[u+2])&128)&&!((l=t[u+3])&128);)e[n++]=r,e[n++]=i,e[n++]=a,e[n++]=l,u+=4;if(r=t[u++],r<128)e[n++]=r;else if((r&224)===192){if(u>=s)return this.interim[0]=r,n;if(i=t[u++],(i&192)!==128){u--;continue}if(c=(r&31)<<6|i&63,c<128){u--;continue}e[n++]=c}else if((r&240)===224){if(u>=s)return this.interim[0]=r,n;if(i=t[u++],(i&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=i,n;if(a=t[u++],(a&192)!==128){u--;continue}if(c=(r&15)<<12|(i&63)<<6|a&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[n++]=c}else if((r&248)===240){if(u>=s)return this.interim[0]=r,n;if(i=t[u++],(i&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=i,n;if(a=t[u++],(a&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,n;if(l=t[u++],(l&192)!==128){u--;continue}if(c=(r&7)<<18|(i&63)<<12|(a&63)<<6|l&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},Dj="",$o=" ",k0=class Mj{constructor(){this.fg=0,this.bg=0,this.extended=new Pf}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Mj;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Pf=class Ij{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new Ij(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},or=class Oj extends k0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Pf,this.combinedData=""}static fromCharData(e){let s=new Oj;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ao(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},$v="di$target",Op="di$dependencies",lm=new Map;function pue(t){return t[Op]||[]}function ln(t){if(lm.has(t))return lm.get(t);let e=function(s,n,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");gue(e,s,r)};return e._id=t,lm.set(t,e),e}function gue(t,e,s){e[$v]===e?e[Op].push({id:t,index:s}):(e[Op]=[{id:t,index:s}],e[$v]=e)}var An=ln("BufferService"),$j=ln("CoreMouseService"),fl=ln("CoreService"),xue=ln("CharsetService"),xx=ln("InstantiationService"),Bj=ln("LogService"),En=ln("OptionsService"),zj=ln("OscLinkService"),bue=ln("UnicodeService"),j0=ln("DecorationService"),$p=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let n=[],r=this._optionsService.rawOptions.linkHandler,i=new or,a=s.getTrimmedLength(),l=-1,c=-1,d=!1;for(let h=0;h<a;h++)if(!(c===-1&&!s.hasContent(h))){if(s.loadCell(h,i),i.hasExtendedAttrs()&&i.extended.urlId)if(c===-1){c=h,l=i.extended.urlId;continue}else d=i.extended.urlId!==l;else c!==-1&&(d=!0);if(d||c!==-1&&h===a-1){let u=this._oscLinkService.getLinkData(l)?.uri;if(u){let f={start:{x:c+1,y:t},end:{x:h+(!d&&h===a-1?1:0),y:t}},m=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(u);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:u,range:f,activate:(p,g)=>r?r.activate(p,g,f):vue(p,g),hover:(p,g)=>r?.hover?.(p,g,f),leave:(p,g)=>r?.leave?.(p,g,f)})}d=!1,i.hasExtendedAttrs()&&i.extended.urlId?(c=h,l=i.extended.urlId):(c=-1,l=-1)}}e(n)}};$p=Ts([Xe(0,An),Xe(1,En),Xe(2,zj)],$p);function vue(t,e){if(confirm(`Do you want to navigate to ${e}?
808
+ `);function Sde(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",wde).replaceAll("{{title}}",Lde).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function kde(t){const e=U.c(8),{readUrl:s,title:n,tokensUrl:r}=t,i=wu(s),a=wu(r??"");if(i.isPending||r&&a.isPending){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:o.jsx(tn,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=h):h=e[0],h}if(i.isError||!i.data){let h;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[1]=h):h=e[1],h}const l=a.data??null;let c;e[2]!==l||e[3]!==i.data?(c=Sde(i.data,l),e[2]=l,e[3]=i.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=o.jsx("iframe",{title:n,srcDoc:c,sandbox:"allow-scripts",className:"block h-full w-full border-0 bg-white"}),e[5]=c,e[6]=n,e[7]=d):d=e[7],d}function Qd(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function jde(t){const e=U.c(16),{family:s,tokens:n,editing:r,valueOf:i,onEdit:a}=t;let l;e[0]!==s?(l=o.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=l):l=e[1];let c;if(e[2]!==r||e[3]!==a||e[4]!==n||e[5]!==i){let u;e[7]!==r||e[8]!==a||e[9]!==i?(u=f=>{const m=i(f),p=`${f.name.replace(/^--brand-/,"")}: ${m}`;return r&&/^#/.test(m)?o.jsx("input",{type:"color","aria-label":f.name,title:p,value:IE(m),onChange:g=>a(f.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},f.name):o.jsx("span",{title:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},f.name)},e[7]=r,e[8]=a,e[9]=i,e[10]=u):u=e[10],c=n.map(u),e[2]=r,e[3]=a,e[4]=n,e[5]=i,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-wrap gap-1",children:c}),e[11]=c,e[12]=d):d=e[12];let h;return e[13]!==l||e[14]!==d?(h=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,d]}),e[13]=l,e[14]=d,e[15]=h):h=e[15],h}function Cde(t){const e=U.c(9),{token:s,value:n}=t;if(s.kind==="space"){let i;return e[0]!==n?(i=o.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:o.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=i):i=e[1],i}if(s.kind==="radius"){let i;return e[2]!==n?(i=o.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=i):i=e[3],i}if(s.kind==="shadow"){let i;return e[4]!==n?(i=o.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=i):i=e[5],i}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const i=`min(${n}, 22px)`;let a;return e[6]!==i?(a=o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:i},children:"Ag"}),e[6]=i,e[7]=a):a=e[7],a}let r;return e[8]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("span",{className:"size-7 shrink-0"}),e[8]=r):r=e[8],r}function Cj(t){const e=U.c(17),{token:s,value:n,editing:r,onEdit:i}=t;let a;e[0]!==s||e[1]!==n?(a=o.jsx(Cde,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=a):a=e[2];let l;if(e[3]!==s.name){let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=/^--brand-/,e[5]=u):u=e[5],l=s.name.replace(u,""),e[3]=s.name,e[4]=l}else l=e[4];let c;e[6]!==l?(c=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:l}),e[6]=l,e[7]=c):c=e[7];let d;e[8]!==r||e[9]!==i||e[10]!==s.name||e[11]!==n?(d=r?o.jsx(yt,{value:n,onChange:u=>i(s.name,u.target.value),className:"h-8 w-40 font-mono text-xs"}):o.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=r,e[9]=i,e[10]=s.name,e[11]=n,e[12]=d):d=e[12];let h;return e[13]!==a||e[14]!==c||e[15]!==d?(h=o.jsxs("div",{className:"flex items-center gap-3",children:[a,c,d]}),e[13]=a,e[14]=c,e[15]=d,e[16]=h):h=e[16],h}function Dd(t){const e=U.c(16),{label:s,tokens:n,editing:r,valueOf:i,onEdit:a}=t;if(n.length===0)return null;let l;e[0]!==s?(l=o.jsx(Qd,{children:s}),e[0]=s,e[1]=l):l=e[1];let c;if(e[2]!==r||e[3]!==a||e[4]!==n||e[5]!==i){let u;e[7]!==r||e[8]!==a||e[9]!==i?(u=f=>o.jsx(Cj,{token:f,value:i(f),editing:r,onEdit:a},f.name),e[7]=r,e[8]=a,e[9]=i,e[10]=u):u=e[10],c=n.map(u),e[2]=r,e[3]=a,e[4]=n,e[5]=i,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-col gap-2.5",children:c}),e[11]=c,e[12]=d):d=e[12];let h;return e[13]!==l||e[14]!==d?(h=o.jsxs("div",{className:"flex flex-col gap-3",children:[l,d]}),e[13]=l,e[14]=d,e[15]=h):h=e[15],h}function Nde({brandPath:t,onClose:e,variant:s}){const n=ue(),{org:r}=Fe(),i=yg(t),a=i.volume??"",l=i.dirPath,c=dn(l),d=i.readOnly,h=Ns(),u=e0(),f=L8(a),{upload:m,remove:p}=Lu(a),g=P.useRef(null),x=w8(a,l),b=x.data??[],v=Y=>b.some(pe=>pe.kind==="file"&&dn(pe.path)===Y),_=v("tokens.css"),L=v("brand.md"),y=v("slides-theme.html"),w=EE(b),S=u(a,`${l}/tokens.css`),k=u(a,`${l}/brand.md`),j=u(a,`${l}/slides-theme.html`),N=wu(S,{enabled:_}),V=wu(k,{enabled:L}),[C,T]=P.useState(!1),[A,R]=P.useState({}),[E,I]=P.useState(null),[D,O]=P.useState(!1),[$,M]=P.useState(!1),[z,F]=P.useState("deck"),B=N.data?RE(N.data):[],H=Y=>B.find(pe=>pe.name===Y)?.value,W=Y=>A[Y.name]??Y.value,K=DE(B),q=B.filter(Y=>Y.kind==="font"),G=B.filter(Y=>Y.kind==="type"),te=B.filter(Y=>Y.kind==="space"),X=B.filter(Y=>Y.kind==="radius"),Z=B.filter(Y=>Y.kind==="shadow"),ee=B.filter(Y=>Y.kind==="motion"),se=B.filter(Y=>Y.kind==="other"),J=(Y,pe)=>R(be=>({...be,[Y]:pe})),oe=y&&z==="deck",ce=E??V.data??"",he=Object.entries(A).filter(([Y,pe])=>H(Y)!==pe),ne=E!==null&&E!==(V.data??""),Q=he.length>0||ne;function de(){R({}),I(null),T(!1)}async function ae(){O(!0);try{if(he.length>0){let Y=N.data??"";for(const[pe,be]of he)Y=ME(Y,pe,be);await f.mutateAsync({path:`${l}/tokens.css`,body:Y,contentType:"text/css; charset=utf-8"}),h.invalidateQueries({queryKey:at.fileText(S)})}ne&&E!==null&&(await f.mutateAsync({path:`${l}/brand.md`,body:E,contentType:"text/markdown; charset=utf-8"}),h.invalidateQueries({queryKey:at.fileText(k)})),h.invalidateQueries({queryKey:at.orgFsVolume(r.id,a)}),h.invalidateQueries({queryKey:at.orgFsRecent(r.id)}),R({}),I(null),T(!1),ye.success(n("library.brandPreview.brandSaved"))}catch(Y){ye.error(Y instanceof Error?Y.message:n("library.brandPreview.failedSaveBrand"))}finally{O(!1)}}async function re(Y){const pe=Y?.[0];if(!pe)return;const _e=`logo.${(pe.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:l,files:[new File([pe],_e,{type:pe.type})]}),w&&dn(w)!==_e&&await p.mutateAsync(w),ye.success(n("library.brandPreview.logoUpdated"))}catch(Le){ye.error(Le instanceof Error?Le.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const ie=!x.isPending&&!_&&!L&&!w;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:o.jsx(Wm,{size:18})}),s==="dialog"?o.jsx(qt,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):o.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(C?o.jsxs(o.Fragment,{children:[o.jsx(me,{variant:"ghost",size:"sm",onClick:de,disabled:D,children:n("library.brandPreview.cancel")}),o.jsx(me,{size:"sm",disabled:!Q||D,onClick:()=>{ae()},children:n(D?"library.brandPreview.saving":"library.brandPreview.save")})]}):o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[o.jsx(nP,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?o.jsx(eT,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:o.jsx(nn,{size:16})})}):o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:o.jsx(nn,{size:16})})]}),o.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?o.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[o.jsx(tn,{className:"h-40 w-full rounded-xl"}),o.jsx(tn,{className:"h-4 w-1/3"}),o.jsx(tn,{className:"h-4 w-2/3"})]}):ie?o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):o.jsxs(o.Fragment,{children:[(y||_)&&o.jsxs("div",{className:"shrink-0 border-b border-border",children:[o.jsxs("div",{role:"button",tabIndex:0,"aria-label":n($?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(Y=>!Y),onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),M(pe=>!pe))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:Y=>Y.stopPropagation(),children:[y&&o.jsx("button",{type:"button",onClick:()=>{F("deck"),M(!1)},className:le("rounded-md px-2.5 py-1",oe?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),o.jsx("button",{type:"button",onClick:()=>{F("components"),M(!1)},className:le("rounded-md px-2.5 py-1",oe?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),$?o.jsx(ds,{size:16,className:"shrink-0 text-muted-foreground"}):o.jsx(R6,{size:16,className:"shrink-0 text-muted-foreground"})]}),!$&&o.jsx("div",{className:"px-4 pb-4",children:o.jsx("div",{className:le("w-full overflow-hidden rounded-xl border border-border bg-muted/30",oe?"aspect-[16/9]":"h-96"),children:oe?o.jsx(kde,{readUrl:j,title:`${c} deck theme`,tokensUrl:S}):o.jsx(_de,{tokensUrl:S})})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Qd,{children:n("library.brandPreview.logo")}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:w?o.jsx("img",{src:u(a,w),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):o.jsx(Wm,{size:28,className:"text-muted-foreground/50"})}),C&&o.jsxs("div",{children:[o.jsxs(me,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[o.jsx(Qn,{size:14}),n(w?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),o.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:Y=>{re(Y.target.files)}})]})]})]}),K.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Qd,{children:n("library.brandPreview.colors")}),K.map(Y=>o.jsx(jde,{family:Y.family,tokens:Y.tokens,editing:C,valueOf:W,onEdit:J},Y.family))]}),(q.length>0||G.length>0)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Qd,{children:n("library.brandPreview.typography")}),q.map(Y=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:Y.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),C?o.jsx(yt,{value:W(Y),onChange:pe=>J(Y.name,pe.target.value),className:"h-9"}):o.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:W(Y)},children:W(Y)})]},Y.name)),G.map(Y=>o.jsx(Cj,{token:Y,value:W(Y),editing:C,onEdit:J},Y.name))]}),o.jsx(Dd,{label:n("library.brandPreview.spacing"),tokens:te,editing:C,valueOf:W,onEdit:J}),o.jsx(Dd,{label:n("library.brandPreview.radius"),tokens:X,editing:C,valueOf:W,onEdit:J}),o.jsx(Dd,{label:n("library.brandPreview.shadows"),tokens:Z,editing:C,valueOf:W,onEdit:J}),o.jsx(Dd,{label:n("library.brandPreview.motion"),tokens:ee,editing:C,valueOf:W,onEdit:J}),o.jsx(Dd,{label:n("library.brandPreview.tokens"),tokens:se,editing:C,valueOf:W,onEdit:J}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Qd,{children:n("library.brandPreview.voiceGuidelines")}),C?o.jsx(Yo,{value:ce,onChange:Y=>I(Y.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):V.isPending&&L?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(tn,{className:"h-3 w-full"}),o.jsx(tn,{className:"h-3 w-5/6"})]}):ce.trim()?o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:o.jsx(ld,{id:`brand-preview-${t}`,text:ce})}):o.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function Nj(t){const e=U.c(8),{brandPath:s,onClose:n}=t;let r;e[0]!==n?(r=l=>{l||n()},e[0]=n,e[1]=r):r=e[1];let i;e[2]!==s||e[3]!==n?(i=o.jsx(Bt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:o.jsx(Nde,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=o.jsx(zt,{open:!0,onOpenChange:r,children:i}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function Vj(t){const e=U.c(9),{previewPath:s,onClose:n,showSeeInLibrary:r}=t,i=r===void 0?!1:r;let a;e[0]!==n?(a=d=>{d||n()},e[0]=n,e[1]=a):a=e[1];let l;e[2]!==n||e[3]!==s||e[4]!==i?(l=o.jsx(Bt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:o.jsx(jj,{previewPath:s,onClose:n,showSeeInLibrary:i,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=i,e[5]=l):l=e[5];let c;return e[6]!==a||e[7]!==l?(c=o.jsx(zt,{open:!0,onOpenChange:a,children:l}),e[6]=a,e[7]=l,e[8]=c):c=e[8],c}function Vde(t){const e=U.c(11),{onOpenDir:s}=t,n=ue(),r=OE();let i;e[0]!==r.data?(i=r.data??[],e[0]=r.data,e[1]=i):i=e[1];let a;if(e[2]!==s||e[3]!==n||e[4]!==i){let c;e[6]!==s||e[7]!==n?(c=d=>o.jsx(l0,{name:d.volume,glyph:Gn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:h7(d.lastSyncedAt)}):n("library.syncedRepos.waitingFirstSync"),onOpen:()=>s(d.volume)},d.id),e[6]=s,e[7]=n,e[8]=c):c=e[8],a=i.map(c),e[2]=s,e[3]=n,e[4]=i,e[5]=a}else a=e[5];let l;return e[9]!==a?(l=o.jsx(o.Fragment,{children:a}),e[9]=a,e[10]=l):l=e[10],l}function px(t){return`${window.location.origin}${t}`}function xu(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const Tde=[ku,"uploads","outputs"],Tj=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Qn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Fi}],Dp=new Set([...Tj.map(t=>t.volume),Wc("public")]),Pde=6;function Pj(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",r=W8(t),i=r?`public/${r}`:t==="home"?ju(s):t;return n?`${i}/${n}`:i}function mh(t,e,s){return{onDragStart:n=>{s.onDragStart?.(t),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("application/x-studio-library-path",t)},onContextMenu:n=>{n.preventDefault(),s.onContextMenu?.(t,e)},onDrop:s.onDrop?n=>{n.preventDefault();const r=n.dataTransfer.getData("application/x-studio-library-path");r&&r!==t&&!t.startsWith(r+"/")&&s.onDrop(r,t)}:void 0}}function Ro(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Di(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"@container",children:o.jsx("div",{className:"grid grid-cols-1 gap-3 @[440px]:grid-cols-2 @[660px]:grid-cols-3",children:s})}),e[0]=s,e[1]=n):n=e[1],n}function X9(t){const e=U.c(2),{rows:s}=t,n=s===void 0?1:s;let r;return e[0]!==n?(r=o.jsx(Di,{children:Array.from({length:n*3},Ade)}),e[0]=n,e[1]=r):r=e[1],r}function Ade(t,e){return o.jsx(tn,{className:"h-16 rounded-2xl"},e)}function gx(t){const e=U.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Ede(t){const e=U.c(12),{volume:s,descriptionKey:n,glyph:r,onOpen:i}=t,a=ue(),l=hA(s);let c;e[0]!==a||e[1]!==l.data?(c=l.data?a("library.libraryViews.filesCount",{count:l.data.files}):void 0,e[0]=a,e[1]=l.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==a?(d=a(n),e[3]=n,e[4]=a,e[5]=d):d=e[5];let h;return e[6]!==r||e[7]!==i||e[8]!==c||e[9]!==d||e[10]!==s?(h=o.jsx(l0,{name:s,meta:c,subtitle:d,glyph:r,tone:"system",onOpen:i}),e[6]=r,e[7]=i,e[8]=c,e[9]=d,e[10]=s,e[11]=h):h=e[11],h}function Rde(t){const e=U.c(12),{onOpenDir:s}=t,n=ue(),i=S8().data?.length??0;let a;e[0]!==s?(a=Tj.map(h=>o.jsx(Ede,{volume:h.volume,descriptionKey:h.descriptionKey,glyph:h.glyph,onOpen:()=>s(h.volume)},h.volume)),e[0]=s,e[1]=a):a=e[1];let l;e[2]!==s||e[3]!==i||e[4]!==n?(l=i>0&&o.jsx(l0,{name:Wc("public"),meta:n("library.libraryViews.skillSetsCount",{count:i}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:hi,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=i,e[4]=n,e[5]=l):l=e[5];let c;e[6]!==s?(c=o.jsx(Vde,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==a||e[9]!==l||e[10]!==c?(d=o.jsxs(o.Fragment,{children:[a,l,c]}),e[8]=a,e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function Dde(t){const e=U.c(19),{segments:s,onNavigate:n}=t,{org:r}=Fe();let i;e[0]!==s?(i=s[0]===ku?s.slice(1):s,e[0]=s,e[1]=i):i=e[1];const a=i,l=s.length-a.length,c=a.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==r.slug?(d=c?o.jsx("span",{className:"truncate font-medium text-foreground",children:ju(r.slug)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(ku),children:ju(r.slug)}),e[2]=c,e[3]=n,e[4]=r.slug,e[5]=d):d=e[5];let h;if(e[6]!==l||e[7]!==n||e[8]!==a||e[9]!==s){let f;e[11]!==l||e[12]!==n||e[13]!==a.length||e[14]!==s?(f=(m,p)=>{const g=s.slice(0,l+p+1).join("/"),x=p===a.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx(Us,{size:12,className:"shrink-0 text-muted-foreground"}),x?o.jsx("span",{className:"truncate font-medium text-foreground",children:Wc(m)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Wc(m)})]},g)},e[11]=l,e[12]=n,e[13]=a.length,e[14]=s,e[15]=f):f=e[15],h=a.map(f),e[6]=l,e[7]=n,e[8]=a,e[9]=s,e[10]=h}else h=e[10];let u;return e[16]!==d||e[17]!==h?(u=o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,h]}),e[16]=d,e[17]=h,e[18]=u):u=e[18],u}function Mde(t){const e=U.c(43),{query:s,scope:n,stale:r,onOpenFile:i,onShare:a,onDelete:l}=t,c=ue(),{org:d}=Fe(),h=e0(),u=uA(s,n);let f;e[0]!==h||e[1]!==a?(f=S=>a({volume:S.volume,path:S.path,kind:"file",shareMode:S.shareMode??"private",effectivePublic:S.effectivePublic??!1,url:px(h(S.volume,S.path))}),e[0]=h,e[1]=a,e[2]=f):f=e[2];const m=f;if(u.isPending){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(X9,{rows:2}),e[3]=S):S=e[3],S}let p,g,x,b,v;if(e[4]!==s||e[5]!==u.data||e[6]!==u.isPlaceholderData||e[7]!==r||e[8]!==c){v=Symbol.for("react.early_return_sentinel");e:{if(g=u.data??[],g.length===0){let k;e[14]!==s||e[15]!==c?(k=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=k):k=e[16];let j;e[17]!==k?(j=o.jsx(gx,{children:k}),e[17]=k,e[18]=j):j=e[18],v=j;break e}const S=(r||u.isPlaceholderData)&&"opacity-50";e[19]!==S?(b=le("flex flex-col gap-3",S),e[19]=S,e[20]=b):b=e[20],p=Ro,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=u.data,e[6]=u.isPlaceholderData,e[7]=r,e[8]=c,e[9]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=v}else p=e[9],g=e[10],x=e[11],b=e[12],v=e[13];if(v!==Symbol.for("react.early_return_sentinel"))return v;let _;e[21]!==p||e[22]!==x?(_=o.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=_):_=e[23];let L;if(e[24]!==h||e[25]!==l||e[26]!==i||e[27]!==d||e[28]!==g||e[29]!==m){let S;e[31]!==h||e[32]!==l||e[33]!==i||e[34]!==d||e[35]!==m?(S=k=>{const j=W8(k.volume)!==null;return o.jsx(f7,{filename:dn(k.path),updatedAt:k.updatedAt,downloadUrl:h(k.volume,k.path),subtitle:Pj(k.volume,k.path,d.slug),publicState:xu(k),onOpen:()=>i(q8(k.volume,k.path)),onShare:j?void 0:()=>m(k),onDelete:j?void 0:()=>l({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[31]=h,e[32]=l,e[33]=i,e[34]=d,e[35]=m,e[36]=S):S=e[36],L=g.map(S),e[24]=h,e[25]=l,e[26]=i,e[27]=d,e[28]=g,e[29]=m,e[30]=L}else L=e[30];let y;e[37]!==L?(y=o.jsx(Di,{children:L}),e[37]=L,e[38]=y):y=e[38];let w;return e[39]!==b||e[40]!==_||e[41]!==y?(w=o.jsxs("div",{className:b,children:[_,y]}),e[39]=b,e[40]=_,e[41]=y,e[42]=w):w=e[42],w}function Ide(t){const e=U.c(39),{onOpenFile:s,onShare:n,onDelete:r}=t,i=ue(),{org:a}=Fe(),l=_8(),c=e0();let d;e[0]!==c||e[1]!==n?(d=v=>n({volume:v.volume,path:v.path,kind:"file",shareMode:v.shareMode??"private",effectivePublic:v.effectivePublic??!1,url:px(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const h=d;if(l.isPending){let v;e[3]!==i?(v=i("library.libraryViews.recentlyAdded"),e[3]=i,e[4]=v):v=e[4];let _;e[5]!==v?(_=o.jsx(Ro,{children:v}),e[5]=v,e[6]=_):_=e[6];let L;e[7]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(X9,{}),e[7]=L):L=e[7];let y;return e[8]!==_?(y=o.jsxs("div",{className:"flex flex-col gap-3",children:[_,L]}),e[8]=_,e[9]=y):y=e[9],y}let u,f,m,p,g;if(e[10]!==c||e[11]!==r||e[12]!==s||e[13]!==a||e[14]!==l.data||e[15]!==h||e[16]!==i){g=Symbol.for("react.early_return_sentinel");e:{const v=(l.data??[]).slice(0,Pde);if(v.length===0){g=null;break e}m="flex flex-col gap-3";let _;e[22]!==i?(_=i("library.libraryViews.recentlyAdded"),e[22]=i,e[23]=_):_=e[23],e[24]!==_?(p=o.jsx(Ro,{children:_}),e[24]=_,e[25]=p):p=e[25],u=Di;let L;e[26]!==c||e[27]!==r||e[28]!==s||e[29]!==a||e[30]!==h?(L=y=>o.jsx(zE,{filename:dn(y.path),updatedAt:y.updatedAt,size:y.size,downloadUrl:c(y.volume,y.path),subtitle:Pj(y.volume,y.path,a.slug),publicState:xu(y),onOpen:()=>s(q8(y.volume,y.path)),onShare:()=>h(y),onDelete:()=>r({volume:y.volume,path:y.path,kind:"file"})},`${y.volume}/${y.path}`),e[26]=c,e[27]=r,e[28]=s,e[29]=a,e[30]=h,e[31]=L):L=e[31],f=v.map(L)}e[10]=c,e[11]=r,e[12]=s,e[13]=a,e[14]=l.data,e[15]=h,e[16]=i,e[17]=u,e[18]=f,e[19]=m,e[20]=p,e[21]=g}else u=e[17],f=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==u||e[33]!==f?(x=o.jsx(u,{children:f}),e[32]=u,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=o.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function Ode(t){const e=U.c(16),{onOpenDir:s}=t,n=ue(),r=S8();if(r.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(X9,{}),e[0]=d):d=e[0],d}let i;e[1]!==r.data?(i=r.data??[],e[1]=r.data,e[2]=i):i=e[2];const a=i;if(a.length===0){let d;e[3]!==n?(d=n("library.libraryViews.noPublicSkillSetsConfigured"),e[3]=n,e[4]=d):d=e[4];let h;return e[5]!==d?(h=o.jsx(gx,{children:d}),e[5]=d,e[6]=h):h=e[6],h}let l;if(e[7]!==s||e[8]!==a||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=h=>o.jsx(l0,{name:h,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${h}`)},h),e[11]=s,e[12]=n,e[13]=d):d=e[13],l=a.map(d),e[7]=s,e[8]=a,e[9]=n,e[10]=l}else l=e[10];let c;return e[14]!==l?(c=o.jsx(Di,{children:l}),e[14]=l,e[15]=c):c=e[15],c}function $de(t){const e=U.c(63),{location:s,onOpenDir:n,onOpenFile:r,onOpenSkill:i,onOpenBrand:a,onShare:l,onDelete:c,onDragStart:d,onContextMenu:h,onMove:u}=t,f=ue(),{org:m}=Fe(),p=s.volume??"",g=w8(p,s.dirPath),x=e0();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=C=>s.isHomeRoot&&Dp.has(C.toLowerCase())?`${ju(m.slug)}/${C}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const v=b;let _;e[3]!==s.isHomeRoot||e[4]!==n?(_=s.isHomeRoot?o.jsx(Rde,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=_):_=e[5];const L=_;if(g.isPending){let C;e[6]!==L||e[7]!==f?(C=L&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ro,{children:f("library.libraryViews.folders")}),o.jsx(Di,{children:L})]}),e[6]=L,e[7]=f,e[8]=C):C=e[8];let T;e[9]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(X9,{rows:2}),e[9]=T):T=e[9];let A;return e[10]!==C?(A=o.jsxs(o.Fragment,{children:[C,T]}),e[10]=C,e[11]=A):A=e[11],A}if(g.isError){let C;e[12]!==g.error||e[13]!==f?(C=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=C):C=e[14];let T;return e[15]!==C?(T=o.jsx("p",{className:"text-sm text-destructive",children:C}),e[15]=C,e[16]=T):T=e[16],T}let y,w,S,k,j;if(e[17]!==v||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==h||e[22]!==c||e[23]!==d||e[24]!==u||e[25]!==a||e[26]!==n||e[27]!==r||e[28]!==i||e[29]!==l||e[30]!==L||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const C=g.data??[],T=C.filter(Ude),A=C.filter(Fde),R=C.filter(zde),E=C.filter(Bde);if(C.length===0&&!s.isHomeRoot){let M;e[38]!==s.readOnly||e[39]!==f?(M=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=M):M=e[40];let z;e[41]!==M?(z=o.jsx(gx,{children:M}),e[41]=M,e[42]=z):z=e[42],j=z;break e}let I;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(I=M=>s.readOnly?void 0:()=>c({volume:p,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=I):I=e[46];const D=I;let O;e[47]!==x||e[48]!==s.readOnly||e[49]!==l||e[50]!==p?(O=M=>s.readOnly?void 0:()=>l({volume:p,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?px(x(p,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=l,e[50]=p,e[51]=O):O=e[51];const $=O;y=T.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ro,{children:f("library.libraryViews.skills")}),o.jsx(Di,{children:T.map(M=>o.jsx($E,{dirName:dn(M.path),updatedAt:M.updatedAt,skillMdUrl:x(p,`${M.path}/SKILL.md`),publicState:xu(M),onOpen:()=>i(gc(s,M.path)),onBrowse:()=>n(gc(s,M.path)),onShare:$(M),onDelete:D(M),draggable:!s.readOnly,...mh(M.path,"dir",{onDragStart:d,onContextMenu:h})},M.path))})]}),w=A.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ro,{children:f("library.libraryViews.brands")}),o.jsx(Di,{children:A.map(M=>o.jsx(BE,{dirName:dn(M.path),updatedAt:M.updatedAt,tokensUrl:x(p,`${M.path}/tokens.css`),onOpen:()=>a(gc(s,M.path)),onBrowse:()=>n(gc(s,M.path)),onDelete:D(M),draggable:!s.readOnly,...mh(M.path,"dir",{onDragStart:d,onContextMenu:h})},M.path))})]}),S=(R.length>0||L)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ro,{children:f("library.libraryViews.folders")}),o.jsxs(Di,{children:[L,R.map(M=>o.jsx(l0,{name:dn(M.path),meta:h7(M.updatedAt),subtitle:v(dn(M.path)),readOnly:s.readOnly,publicState:xu(M),onOpen:()=>n(gc(s,M.path)),onShare:$(M),onDelete:D(M),draggable:!s.readOnly,...mh(M.path,"dir",{onDragStart:d,onContextMenu:h,onDrop:u})},M.path))]})]}),k=E.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ro,{children:f("library.libraryViews.files")}),o.jsx(Di,{children:E.map(M=>o.jsx(f7,{filename:dn(M.path),updatedAt:M.updatedAt,downloadUrl:x(p,M.path),publicState:xu(M),onOpen:()=>r(gc(s,M.path)),onShare:$(M),onDelete:D(M),draggable:!s.readOnly,...mh(M.path,"file",{onDragStart:d,onContextMenu:h})},M.path))})]})}e[17]=v,e[18]=x,e[19]=g.data,e[20]=s,e[21]=h,e[22]=c,e[23]=d,e[24]=u,e[25]=a,e[26]=n,e[27]=r,e[28]=i,e[29]=l,e[30]=L,e[31]=f,e[32]=p,e[33]=y,e[34]=w,e[35]=S,e[36]=k,e[37]=j}else y=e[33],w=e[34],S=e[35],k=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let N;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==r||e[55]!==l?(N=s.isHomeRoot&&o.jsx(Ide,{onOpenFile:r,onShare:l,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=r,e[55]=l,e[56]=N):N=e[56];let V;return e[57]!==y||e[58]!==w||e[59]!==S||e[60]!==k||e[61]!==N?(V=o.jsxs(o.Fragment,{children:[y,w,S,k,N]}),e[57]=y,e[58]=w,e[59]=S,e[60]=k,e[61]=N,e[62]=V):V=e[62],V}function Bde(t){return t.kind==="file"}function zde(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function Fde(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function Ude(t){return t.kind==="dir"&&t.hasSkill}function Hde({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=ue(),{org:r}=Fe(),i=Ns(),a=on(),l=Ja(),c=na({strict:!1}),d=c.path||ku,h=yg(d),u=FE(),f=h.volume!==null&&u.has(h.volume)?{...h,readOnly:!0}:h,m=(Y,pe)=>a({to:".",search:be=>({...be,[Y]:pe||void 0})}),p=Y=>m("path",Y),g=(Y,pe)=>a({to:".",search:be=>({...be,preview:void 0,skill:void 0,brand:void 0,[Y]:pe})}),x=t??(Y=>g("preview",Y)),b=e??(Y=>g("skill",Y)),v=s??(Y=>g("brand",Y)),[_,L]=P.useState(""),y=y9(_.trim(),300),w=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,S=w?n("library.library.searchInPlaceholder",{folder:Wc(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),k=f.isHomeRoot?ju(r.slug):Wc(f.segments.at(-1)??""),[j,N]=P.useState(null),[V,C]=P.useState(null),[T,A]=P.useState(!1),[R,E]=P.useState(""),[I,D]=P.useState(!1),[O,$]=P.useState(null),[M,z]=P.useState(""),F=P.useRef(null),[B,H]=P.useState(!1),W=P.useRef(0),K=f.readOnly?null:f.volume,{upload:q,mkdir:G,move:te}=Lu(K??ku),{remove:X}=Lu(j?.volume??"uploads");async function Z(Y){if(!(!K||!Y||Y.length===0))try{await q.mutateAsync({dir:f.dirPath,files:[...Y]}),ye.success(Y.length===1?n("library.library.uploadedSingle",{filename:Y[0]?.name??""}):n("library.library.uploadedMultiple",{count:Y.length}))}catch(pe){ye.error(pe instanceof Error?pe.message:n("library.library.uploadFailed"))}finally{F.current&&(F.current.value="")}}const ee=K!==null;function se(Y){return Y.dataTransfer.types.includes("Files")}function J(Y){!ee||!se(Y)||(Y.preventDefault(),W.current+=1,H(!0))}function oe(Y){!ee||!se(Y)||Y.preventDefault()}function ce(){ee&&(W.current=Math.max(0,W.current-1),W.current===0&&H(!1))}function he(Y){ee&&(Y.preventDefault(),Y.stopPropagation(),W.current=0,H(!1),Y.dataTransfer.files.length>0&&Z(Y.dataTransfer.files))}async function ne(){const Y=R.trim();if(!(!K||!Y)){if(f.isHomeRoot&&Dp.has(Y.toLowerCase())){ye.error(n("library.library.folderNameReserved",{name:Y}));return}try{const pe=f.dirPath;await G.mutateAsync(pe?`${pe}/${Y}`:Y),ye.success(n("library.library.folderCreated",{name:Y})),A(!1),E("")}catch(pe){ye.error(pe instanceof Error?pe.message:n("library.library.folderCreateFailed"))}}}async function Q(){if(!j)return;const Y=j;try{await X.mutateAsync(Y.path),ye.success(n("library.library.deleted",{name:dn(Y.path)}))}catch(pe){ye.error(pe instanceof Error?pe.message:n("library.library.deleteFailed"))}finally{N(null)}}async function de(){if(!O)return;const Y=M.trim();if(!Y||Y.includes("/")||Y.includes("..")||Y===dn(O.path)){D(!1),$(null),z("");return}if(O.kind==="dir"&&f.isHomeRoot&&Dp.has(Y.toLowerCase())){ye.error(n("library.library.folderNameReserved",{name:Y}));return}try{const pe=O.path.includes("/")?O.path.slice(0,O.path.lastIndexOf("/")):"",be=pe?`${pe}/${Y}`:Y;await te.mutateAsync({from:O.path,to:be});const _e=Y.replace(/[<>]/g,"");ye.success(n("library.library.renamed",{name:_e}))}catch(pe){ye.error(pe instanceof Error?pe.message:n("library.library.renameFailed"))}finally{D(!1),$(null),z("")}}async function ae(Y,pe){try{const be=dn(Y),_e=pe?`${pe}/${be}`:be;await te.mutateAsync({from:Y,to:_e}),ye.success(n("library.library.moved",{name:be,destination:pe||n("library.library.theLibrary")}))}catch(be){ye.error(be instanceof Error?be.message:n("library.library.moveFailed"))}}function re(){for(const Y of Tde)i.invalidateQueries({queryKey:at.orgFsVolume(r.id,Y)});f.volume&&i.invalidateQueries({queryKey:at.orgFsVolume(r.id,f.volume)}),i.invalidateQueries({queryKey:at.orgFsRecent(r.id)}),i.invalidateQueries({queryKey:at.orgFsSearchRoot(r.id)}),i.invalidateQueries({queryKey:at.orgFsPublicSets(r.id)})}function ie(Y){Y.defaultPrevented||!K||Y.target.closest("input, textarea, button, a, [role='button']")||(Y.preventDefault(),A(!0))}return o.jsxs("div",{className:"relative h-full",onDragEnter:J,onDragOver:oe,onDragLeave:ce,onDrop:he,onContextMenu:ie,children:[B&&o.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/80 p-6 backdrop-blur-sm",children:o.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-primary px-10 py-8 text-center",children:[o.jsx(Qn,{size:28,className:"text-primary"}),o.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:k})})]})}),o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:o.jsx(Dde,{segments:f.segments,onNavigate:p})}),o.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[o.jsx(r0,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),o.jsx(yt,{value:_,onChange:Y=>L(Y.target.value),onKeyDown:Y=>{Y.key==="Escape"&&L("")},placeholder:S,className:"h-9 rounded-xl pr-9 pl-9"}),_&&o.jsx(me,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>L(""),"aria-label":n("library.library.clearSearch"),children:o.jsx(lr,{size:14})})]}),o.jsx(me,{variant:"ghost",size:"icon",onClick:re,"aria-label":n("library.library.refresh"),children:o.jsx(Mn,{size:14})}),K&&o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>A(!0),children:[o.jsx(Qt,{size:14}),n("library.library.newFolder")]}),f.readOnly?o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(o0,{size:12}),n("library.library.readOnly")]}):o.jsxs(me,{size:"sm",disabled:q.isPending,onClick:()=>F.current?.click(),children:[o.jsx(Qn,{size:14}),q.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),o.jsx("input",{ref:F,type:"file",multiple:!0,className:"hidden",onChange:Y=>{Z(Y.target.files)}})]}),y?o.jsx(Mde,{query:y,scope:w,stale:_.trim()!==y,onOpenFile:x,onShare:C,onDelete:N}):f.volume===null?o.jsx(Ode,{onOpenDir:p}):o.jsx($de,{location:f,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:v,onShare:C,onDelete:N,onContextMenu:(Y,pe)=>{$({path:Y,kind:pe}),z(dn(Y)),D(!0)},onMove:ae},f.volume)]})}),l&&(c.preview?o.jsx(Vj,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?o.jsx(K8,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?o.jsx(Nj,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),o.jsx(zt,{open:T,onOpenChange:A,children:o.jsxs(Bt,{children:[o.jsxs(ls,{children:[o.jsx(qt,{children:n("library.library.newFolderTitle")}),o.jsx(In,{children:n("library.library.newFolderDescription",{path:k||n("library.library.theLibrary")})})]}),o.jsx(yt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:R,onChange:Y=>E(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&ne()}}),o.jsxs(Yn,{children:[o.jsx(me,{variant:"outline",onClick:()=>A(!1),children:n("library.library.cancel")}),o.jsx(me,{disabled:!R.trim()||G.isPending,onClick:()=>{ne()},children:n("library.library.create")})]})]})}),o.jsx(zt,{open:I,onOpenChange:Y=>{D(Y),Y||($(null),z(""))},children:o.jsxs(Bt,{children:[o.jsxs(ls,{children:[o.jsx(qt,{children:O&&n("library.library.renameTitle",{name:dn(O.path)})}),o.jsx(In,{children:n("library.library.renameDescription")})]}),o.jsx(yt,{autoFocus:!0,value:M,onChange:Y=>z(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&de()}}),o.jsxs(Yn,{children:[o.jsx(me,{variant:"outline",onClick:()=>D(!1),children:n("library.library.cancel")}),o.jsx(me,{disabled:!M.trim()||te.isPending,onClick:()=>{de()},children:n("library.library.rename")})]})]})}),o.jsx(ude,{target:V,onOpenChange:Y=>{Y||C(null)}}),o.jsx(Wi,{open:j!==null,onOpenChange:Y=>{Y||N(null)},children:o.jsxs(qi,{children:[o.jsxs(Gi,{children:[o.jsx(Yi,{children:n("library.library.deleteTitle",{name:j?dn(j.path):""})}),o.jsx(Qi,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),o.jsxs(Xi,{children:[o.jsx(Ji,{children:n("library.library.cancel")}),o.jsx(Zi,{onClick:()=>{Q()},children:n("library.library.delete")})]})]})})]})}function Kde(){const t=U.c(10),{openPanel:e}=pi(),[s,n]=P.useState(null),[r,i]=P.useState(null);let a;t[0]!==e?(a=o.jsx(Hde,{onOpenFile:h=>e($N(h)),onOpenSkill:n,onOpenBrand:i}),t[0]=e,t[1]=a):a=t[1];let l;t[2]!==s?(l=s&&o.jsx(K8,{skillPath:s,onClose:()=>n(null)},s),t[2]=s,t[3]=l):l=t[3];let c;t[4]!==r?(c=r&&o.jsx(Nj,{brandPath:r,onClose:()=>i(null)},r),t[4]=r,t[5]=c):c=t[5];let d;return t[6]!==a||t[7]!==l||t[8]!==c?(d=o.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[a,l,c]}),t[6]=a,t[7]=l,t[8]=c,t[9]=d):d=t[9],d}const Dv=P.lazy(()=>Ks(()=>import("./project-app-view-DudFJRxH.js"),__vite__mapDeps([185,1,2,81,30,31,32,33,34,35,36,37,38,39,40,25,29,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,82,83,84,10,11,12,19,85,86,87,88,89,90,91,92,93,94,95,96,24,4,5,9,13,14,15,16,17,3,6,7,8,18,20,21,22,23,28,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,74,115,146,159,121,122,123,160,155,130,131,161,116,117,73,118,119,120,124,125,126,127,128,129,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,147,148,149,150,72,151,152,79,153,154,156,157,158,162,163,164,76,165,166,167])).then(t=>({default:t.AppViewContent}))),Wde=P.lazy(()=>Ks(()=>import("./hosting-tab-BktIiwOH.js"),__vite__mapDeps([186,1,2,31,29,41,30,32,33,34,35,36,37,38,39,40,25,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,133,74,78,149,24,73,85,187,19,10,11,12,135])).then(t=>({default:t.HostingTab}))),qde=P.lazy(()=>Ks(()=>import("./e2e-tab-CyxfrSC2.js"),__vite__mapDeps([188,1,2,37,29,41,30,31,32,33,34,35,36,38,39,40,25,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,133,74,78,149,24,73,85,187,19,10,11,12,135,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,4,5,9,13,14,15,16,17,3,6,7,8,18,20,21,22,23,28,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,118])).then(t=>({default:t.E2eTab}))),Gde=P.lazy(()=>Ks(()=>import("./analytics-tab-gxTnWc1L.js"),__vite__mapDeps([189,1,2,30,31,32,33,34,35,36,37,38,39,40,25,29,41,42,43,44,26,45,27,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,133,140,74,78,85,190,191,192,149,24,187,19,10,11,12,135])).then(t=>({default:t.AnalyticsTab}))),Yde=P.lazy(()=>Ks(()=>import("./cdn-tab-BflNT2VL.js"),__vite__mapDeps([193,1,2,50,190,191,192,187,136,19,10,11,12,135,194,195])).then(t=>({default:t.CdnTab})));function Qde(){const t=U.c(2),e=rA();let s;return t[0]!==e?(s=e?o.jsx($U,{}):o.jsx(EU,{}),t[0]=e,t[1]=s):s=t[1],s}function Xde({activeTab:t,virtualMcpId:e,taskId:s,layoutTabs:n,expandedTools:r,automationTabParsed:i}){const a=sA(),l=Tm().monitorEnabled===!0||Tm().auth.localMode===!0;if(t==="overview")return o.jsx(Qde,{});if(t==="board")return o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(yX,{})});if(BN(t))return o.jsx(d5,{virtualMcpId:e});if(t==="git")return o.jsx(uZ,{virtualMcpId:e});if(t==="automations")return o.jsx(Mce,{virtualMcpId:e});if(t==="site-editor")return o.jsx(Coe,{virtualMcpId:e});const c=Vm(t);if(c)return o.jsx(Toe,{openPath:c.path});if(t==="content")return o.jsx(Hle,{virtualMcpId:e});if(t==="assets")return o.jsx(Wle,{virtualMcpId:e});if(t==="hosting"&&a.hosting)return o.jsx(Wde,{virtualMcpId:e});if(t==="e2e"&&a.e2e)return o.jsx(qde,{virtualMcpId:e});if(t==="analytics"&&a.analytics)return o.jsx(Gde,{virtualMcpId:e});if(t==="cdn"&&l&&a.monitor)return o.jsx(Yde,{virtualMcpId:e});if(t==="files")return o.jsx(Kde,{});if(t==="reports")return o.jsx(Uce,{});if(t==="discover")return o.jsx(Jce,{});if(t==="connect-sources")return o.jsx(Bce,{});if(i)return o.jsx(Ace,{tabId:t});const d=i6(t);if(d)return o.jsx(fde,{path:d.path},d.path);const h=r6(t);if(h)return o.jsx(Oce,{fileKey:h.key,taskId:s});const u=o6(t);if(u)return o.jsx(xde,{path:u.path},u.path);const f=zN(t);if(f){const p=r.find(g=>g.appId===f.connectionId&&g.toolName===f.toolName);return o.jsx(Ar,{children:o.jsx(Dv,{connectionId:f.connectionId,toolName:f.toolName,args:p?.args},t)})}const m=n.find(p=>p.id===t);return m?o.jsx(Ar,{children:o.jsx(Dv,{connectionId:m.view.appId,toolName:m.id,args:m.view.args},t)}):o.jsx(d5,{virtualMcpId:e})}function Jde(t){const e=U.c(13),{taskId:s,virtualMcpId:n}=t;let r;e[0]!==s||e[1]!==n?(r={virtualMcpId:n,taskId:s},e[0]=s,e[1]=n,e[2]=r):r=e[2];const{activeTab:i,layoutTabs:a,expandedTools:l,automationTabParsed:c}=Wg(r);let d;e[3]!==i||e[4]!==c||e[5]!==l||e[6]!==a||e[7]!==s||e[8]!==n?(d=o.jsx(Ar,{children:o.jsx(Xde,{activeTab:i,virtualMcpId:n,taskId:s,layoutTabs:a,expandedTools:l,automationTabParsed:c})}),e[3]=i,e[4]=c,e[5]=l,e[6]=a,e[7]=s,e[8]=n,e[9]=d):d=e[9];let h;return e[10]!==i||e[11]!==d?(h=o.jsx(sn,{children:d},i),e[10]=i,e[11]=d,e[12]=h):h=e[12],h}const Zde=new Set(["site-editor","content"]);function eue(t){return t.hasClonableSource&&!t.fastPreviewActive&&t.mainTab!==null&&Zde.has(t.mainTab)}const Da="setup";function tue(t){const e=U.c(57),s=ue();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let L;e[3]!==t.scriptTabs?(L=y=>!t.scriptTabs.includes(y),e[3]=t.scriptTabs,e[4]=L):L=e[4],n=t.scripts.filter(L),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const r=n;let i;e[5]!==t?(i=()=>{t.active===Da?t.onToggle():t.onSelectTab(Da)},e[5]=t,e[6]=i):i=e[6];const a=i;let l;e[7]!==t.open||e[8]!==s?(l=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=l):l=e[9];let c;e[10]!==t.open?(c=t.open?o.jsx(ds,{className:"size-4"}):o.jsx(R6,{className:"size-4"}),e[10]=t.open,e[11]=c):c=e[11];let d;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==l||e[15]!==c?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":l,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=l,e[15]=c,e[16]=d):d=e[16];let h;e[17]!==t.open||e[18]!==s?(h=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=h):h=e[19];let u;e[20]!==h?(u=o.jsx(We,{children:h}),e[20]=h,e[21]=u):u=e[21];let f;e[22]!==d||e[23]!==u?(f=o.jsxs(qe,{children:[d,u]}),e[22]=d,e[23]=u,e[24]=f):f=e[24];const m=t.active===Da;let p;e[25]!==a||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=o.jsx(sue,{active:m,open:t.open,onClick:a,t:s}),e[25]=a,e[26]=t.open,e[27]=s,e[28]=m,e[29]=p):p=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(L=>o.jsx(rue,{active:t.active===L,onClick:()=>{t.active===L?t.onToggle():t.onSelectTab(L)},onClose:()=>t.onCloseScript(L),t:s,children:L},L)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==r||e[34]!==t.onAddScript?(x=o.jsx(iue,{scripts:r,onRun:t.onAddScript}),e[33]=r,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==p?(b=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,g,x]}),e[36]=g,e[37]=x,e[38]=p,e[39]=b):b=e[39];let v;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(v=t.showScriptControls?o.jsx(oue,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):o.jsx(nue,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=v):v=e[52];let _;return e[53]!==b||e[54]!==v||e[55]!==f?(_=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,b,v]}),e[53]=b,e[54]=v,e[55]=f,e[56]=_):_=e[56],_}function sue(t){const e=U.c(11),{active:s,open:n,onClick:r,t:i}=t,a=s&&n,l=s&&n,c=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let d;e[0]!==c?(d=le("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(fE,{className:"size-4"}),e[2]=h):h=e[2];let u;e[3]!==i?(u=i("sandbox.toolbar.setupTab"),e[3]=i,e[4]=u):u=e[4];let f;return e[5]!==r||e[6]!==a||e[7]!==l||e[8]!==d||e[9]!==u?(f=o.jsxs("button",{type:"button","aria-pressed":a,"aria-expanded":l,onClick:r,className:d,children:[h,u]}),e[5]=r,e[6]=a,e[7]=l,e[8]=d,e[9]=u,e[10]=f):f=e[10],f}function nue(t){const e=U.c(40),{status:s,onStart:n,onStop:r,onRestart:i,onResume:a,onRetry:l,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Oa,{className:"size-3.5"}),e[0]=d):d=e[0];let h;e[1]!==c?(h=c("sandbox.toolbar.start"),e[1]=c,e[2]=h):h=e[2];let u;return e[3]!==n||e[4]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:n,children:[d," ",h]}),e[3]=n,e[4]=h,e[5]=u):u=e[5],u}if(s==="suspended"&&a){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Oa,{className:"size-3.5"}),e[6]=d):d=e[6];let h;e[7]!==c?(h=c("sandbox.toolbar.resume"),e[7]=c,e[8]=h):h=e[8];let u;return e[9]!==a||e[10]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:a,children:[d," ",h]}),e[9]=a,e[10]=h,e[11]=u):u=e[11],u}if(s==="errored"&&l){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Mn,{className:"size-3.5"}),e[12]=d):d=e[12];let h;e[13]!==c?(h=c("sandbox.toolbar.retry"),e[13]=c,e[14]=h):h=e[14];let u;return e[15]!==l||e[16]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:l,children:[d," ",h]}),e[15]=l,e[16]=h,e[17]=u):u=e[17],u}if(s==="starting"||s==="running"){const d=s==="running"&&!!i,h=d?"rounded-r-none border-r-0":void 0;let u;e[18]!==h?(u=le(h),e[18]=h,e[19]=u):u=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let m;e[22]!==r||e[23]!==u||e[24]!==f?(m=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",onClick:r,className:u,children:f})}),e[22]=r,e[23]=u,e[24]=f,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=o.jsx(We,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=o.jsxs(qe,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==i||e[34]!==d||e[35]!==c?(b=d&&o.jsxs(Ft,{children:[o.jsx(Ut,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":c("sandbox.toolbar.moreActions"),children:o.jsx(ds,{className:"size-3"})})}),o.jsx(Ht,{align:"end",children:o.jsxs(et,{onClick:i,children:[o.jsx(Mn,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=i,e[34]=d,e[35]=c,e[36]=b):b=e[36];let v;return e[37]!==x||e[38]!==b?(v=o.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=v):v=e[39],v}return null}function rue(t){const e=U.c(17),{active:s,onClick:n,onClose:r,children:i,t:a}=t,l=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==l?(c=le("flex h-6 items-center rounded-md border text-xs",l),e[0]=l,e[1]=c):c=e[1];const d=r?"pl-2 pr-1":"px-2",h=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let u;e[2]!==d||e[3]!==h?(u=le("flex h-full items-center",d,h),e[2]=d,e[3]=h,e[4]=u):u=e[4];let f;e[5]!==i||e[6]!==n||e[7]!==u?(f=o.jsx("button",{type:"button",onClick:n,className:u,children:i}),e[5]=i,e[6]=n,e[7]=u,e[8]=f):f=e[8];let m;e[9]!==i||e[10]!==r||e[11]!==a?(m=r&&o.jsx("button",{type:"button","aria-label":a("sandbox.toolbar.closeTab",{tab:String(i)}),onClick:r,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:o.jsx(nn,{className:"size-3.5"})}),e[9]=i,e[10]=r,e[11]=a,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==f||e[15]!==m?(p=o.jsxs("div",{className:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function iue(t){const e=U.c(27),{scripts:s,onRun:n}=t,r=ue(),[i,a]=P.useState(!1);let l;e[0]!==r?(l=r("sandbox.toolbar.runScript"),e[0]=r,e[1]=l):l=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Qt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==l?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(gs,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"xs","aria-label":l,children:c})})}),e[3]=l,e[4]=d):d=e[4];let h;e[5]!==r?(h=r("sandbox.toolbar.runScript"),e[5]=r,e[6]=h):h=e[6];let u;e[7]!==h?(u=o.jsx(We,{children:h}),e[7]=h,e[8]=u):u=e[8];let f;e[9]!==d||e[10]!==u?(f=o.jsxs(qe,{children:[d,u]}),e[9]=d,e[10]=u,e[11]=f):f=e[11];let m;e[12]!==r?(m=r("sandbox.toolbar.runAScript"),e[12]=r,e[13]=m):m=e[13];let p;e[14]!==m?(p=o.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:m}),e[14]=m,e[15]=p):p=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==r?(g=s.length===0?o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:r("sandbox.toolbar.noScriptsFound")}):s.map(v=>o.jsxs("button",{type:"button",onClick:()=>{a(!1),n(v)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",v]},v)),e[16]=n,e[17]=s,e[18]=r,e[19]=g):g=e[19];let x;e[20]!==p||e[21]!==g?(x=o.jsxs(ys,{align:"start",className:"p-1 w-56",children:[p,g]}),e[20]=p,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==i||e[24]!==x||e[25]!==f?(b=o.jsxs(_s,{open:i,onOpenChange:a,children:[f,x]}),e[23]=i,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function oue(t){const e=U.c(30),{isRunning:s,isKilling:n,onRun:r,onStop:i,t:a}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(nt,{className:"size-3.5"}),e[0]=f):f=e[0];let m;e[1]!==a?(m=a("sandbox.toolbar.stopping"),e[1]=a,e[2]=m):m=e[2];let p;return e[3]!==m?(p=o.jsxs(me,{variant:"outline",size:"xs",disabled:!0,children:[f," ",m]}),e[3]=m,e[4]=p):p=e[4],p}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Oa,{className:"size-3.5"}),e[5]=f):f=e[5];let m;e[6]!==a?(m=a("sandbox.toolbar.run"),e[6]=a,e[7]=m):m=e[7];let p;e[8]!==r||e[9]!==m?(p=o.jsx(Ke,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"xs",onClick:r,children:[f," ",m]})}),e[8]=r,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==a?(g=a("sandbox.toolbar.startProcess"),e[11]=a,e[12]=g):g=e[12];let x;e[13]!==g?(x=o.jsx(We,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=o.jsxs(qe,{children:[p,x]}),e[15]=p,e[16]=x,e[17]=b):b=e[17],b}let l;e[18]!==a?(l=a("sandbox.toolbar.stop"),e[18]=a,e[19]=l):l=e[19];let c;e[20]!==i||e[21]!==l?(c=o.jsx(Ke,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",onClick:i,children:l})}),e[20]=i,e[21]=l,e[22]=c):c=e[22];let d;e[23]!==a?(d=a("sandbox.toolbar.stopProcess"),e[23]=a,e[24]=d):d=e[24];let h;e[25]!==d?(h=o.jsx(We,{children:d}),e[25]=d,e[26]=h):h=e[26];let u;return e[27]!==c||e[28]!==h?(u=o.jsxs(qe,{children:[c,h]}),e[27]=c,e[28]=h,e[29]=u):u=e[29],u}var Aj=Object.defineProperty,aue=Object.getOwnPropertyDescriptor,lue=(t,e)=>{for(var s in e)Aj(t,s,{get:e[s],enumerable:!0})},Ts=(t,e,s,n)=>{for(var r=n>1?void 0:n?aue(e,s):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(r=(n?a(e,s,r):a(r))||r);return n&&r&&Aj(e,s,r),r},Xe=(t,e)=>(s,n)=>e(s,n,t),Mv="Terminal input",Mp={get:()=>Mv,set:t=>Mv=t},Iv="Too much output to announce, navigate to rows manually to read",Ip={get:()=>Iv,set:t=>Iv=t};function cue(t){return t.replace(/\r?\n/g,"\r")}function due(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function uue(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function hue(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");Ej(r,e,s,n)}}function Ej(t,e,s,n){t=cue(t),t=due(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function Rj(t,e,s){let n=s.getBoundingClientRect(),r=t.clientX-n.left-10,i=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${i}px`,e.style.zIndex="1000",e.focus()}function Ov(t,e,s,n,r){Rj(t,e,s),r&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Ao(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function J9(t,e=0,s=t.length){let n="";for(let r=e;r<s;++r){let i=t[r];i>65535?(i-=65536,n+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):n+=String.fromCharCode(i)}return n}var fue=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let n=0,r=0;if(this._interim){let i=t.charCodeAt(r++);56320<=i&&i<=57343?e[n++]=(this._interim-55296)*1024+i-56320+65536:(e[n++]=this._interim,e[n++]=i),this._interim=0}for(let i=r;i<s;++i){let a=t.charCodeAt(i);if(55296<=a&&a<=56319){if(++i>=s)return this._interim=a,n;let l=t.charCodeAt(i);56320<=l&&l<=57343?e[n++]=(a-55296)*1024+l-56320+65536:(e[n++]=a,e[n++]=l);continue}a!==65279&&(e[n++]=a)}return n}},mue=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let n=0,r,i,a,l,c=0,d=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-p;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}f||(x===2?m<128?d--:e[n++]=m:x===3?m<2048||m>=55296&&m<=57343||m===65279||(e[n++]=m):m<65536||m>1114111||(e[n++]=m)),this.interim.fill(0)}let h=s-4,u=d;for(;u<s;){for(;u<h&&!((r=t[u])&128)&&!((i=t[u+1])&128)&&!((a=t[u+2])&128)&&!((l=t[u+3])&128);)e[n++]=r,e[n++]=i,e[n++]=a,e[n++]=l,u+=4;if(r=t[u++],r<128)e[n++]=r;else if((r&224)===192){if(u>=s)return this.interim[0]=r,n;if(i=t[u++],(i&192)!==128){u--;continue}if(c=(r&31)<<6|i&63,c<128){u--;continue}e[n++]=c}else if((r&240)===224){if(u>=s)return this.interim[0]=r,n;if(i=t[u++],(i&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=i,n;if(a=t[u++],(a&192)!==128){u--;continue}if(c=(r&15)<<12|(i&63)<<6|a&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[n++]=c}else if((r&248)===240){if(u>=s)return this.interim[0]=r,n;if(i=t[u++],(i&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=i,n;if(a=t[u++],(a&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,n;if(l=t[u++],(l&192)!==128){u--;continue}if(c=(r&7)<<18|(i&63)<<12|(a&63)<<6|l&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},Dj="",$o=" ",k0=class Mj{constructor(){this.fg=0,this.bg=0,this.extended=new Pf}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Mj;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Pf=class Ij{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new Ij(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},or=class Oj extends k0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Pf,this.combinedData=""}static fromCharData(e){let s=new Oj;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ao(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},$v="di$target",Op="di$dependencies",lm=new Map;function pue(t){return t[Op]||[]}function ln(t){if(lm.has(t))return lm.get(t);let e=function(s,n,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");gue(e,s,r)};return e._id=t,lm.set(t,e),e}function gue(t,e,s){e[$v]===e?e[Op].push({id:t,index:s}):(e[Op]=[{id:t,index:s}],e[$v]=e)}var An=ln("BufferService"),$j=ln("CoreMouseService"),fl=ln("CoreService"),xue=ln("CharsetService"),xx=ln("InstantiationService"),Bj=ln("LogService"),En=ln("OptionsService"),zj=ln("OscLinkService"),bue=ln("UnicodeService"),j0=ln("DecorationService"),$p=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let n=[],r=this._optionsService.rawOptions.linkHandler,i=new or,a=s.getTrimmedLength(),l=-1,c=-1,d=!1;for(let h=0;h<a;h++)if(!(c===-1&&!s.hasContent(h))){if(s.loadCell(h,i),i.hasExtendedAttrs()&&i.extended.urlId)if(c===-1){c=h,l=i.extended.urlId;continue}else d=i.extended.urlId!==l;else c!==-1&&(d=!0);if(d||c!==-1&&h===a-1){let u=this._oscLinkService.getLinkData(l)?.uri;if(u){let f={start:{x:c+1,y:t},end:{x:h+(!d&&h===a-1?1:0),y:t}},m=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(u);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:u,range:f,activate:(p,g)=>r?r.activate(p,g,f):vue(p,g),hover:(p,g)=>r?.hover?.(p,g,f),leave:(p,g)=>r?.leave?.(p,g,f)})}d=!1,i.hasExtendedAttrs()&&i.extended.urlId?(c=h,l=i.extended.urlId):(c=-1,l=-1)}}e(n)}};$p=Ts([Xe(0,An),Xe(1,En),Xe(2,zj)],$p);function vue(t,e){if(confirm(`Do you want to navigate to ${e}?
809
809
 
810
810
  WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var Z9=ln("CharSizeService"),oo=ln("CoreBrowserService"),bx=ln("MouseService"),ao=ln("RenderService"),yue=ln("SelectionService"),Fj=ln("CharacterJoinerService"),yd=ln("ThemeService"),Uj=ln("LinkProviderService"),_ue=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Bv.isErrorNoTelemetry(t)?new Bv(t.message+`
811
811