decocms 4.502.1 → 4.502.2

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 (376) hide show
  1. package/dist/client/assets/{ActiveShapeUtils-Dpaml8J5.js → ActiveShapeUtils-BmpX0aJ4.js} +1 -1
  2. package/dist/client/assets/{AlertCircle-CxMEbIvM.js → AlertCircle-BugQG9bV.js} +1 -1
  3. package/dist/client/assets/{AreaChart-BgtEgMgW.js → AreaChart-C2JGxQiA.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-ChZ5XGHH.js → ArrowLeft-BsOtfvqw.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-BseWcDxZ.js → ArrowUp-BM60-fZY.js} +1 -1
  6. package/dist/client/assets/{BarChart-IN_s5p-k.js → BarChart-B7UShXEl.js} +1 -1
  7. package/dist/client/assets/{Building02-BCzHZCeO.js → Building02-DqK4SREZ.js} +1 -1
  8. package/dist/client/assets/{CategoricalChart-CN6eSF60.js → CategoricalChart-B4irlNQB.js} +1 -1
  9. package/dist/client/assets/{CheckCircle-BRmDGKsS.js → CheckCircle-DIUFnJQp.js} +1 -1
  10. package/dist/client/assets/{ChevronSelectorVertical-DXUxjCek.js → ChevronSelectorVertical-CRMiEVEY.js} +1 -1
  11. package/dist/client/assets/{ChevronUp-B7Vn1Rb2.js → ChevronUp-C9gm2RHA.js} +1 -1
  12. package/dist/client/assets/{Copy01-BeZeYuYP.js → Copy01-BrqDGrTX.js} +1 -1
  13. package/dist/client/assets/{CreditCard01-CR3uiUwh.js → CreditCard01-C7MhbtAI.js} +1 -1
  14. package/dist/client/assets/{DotsVertical-C85_hpnn.js → DotsVertical-DjBJNxxU.js} +1 -1
  15. package/dist/client/assets/{ErrorBarContext-dTYYBaMt.js → ErrorBarContext-Duc4DanJ.js} +1 -1
  16. package/dist/client/assets/{Globe04-DTEEsJ26.js → Globe04-Bi1qDXFD.js} +1 -1
  17. package/dist/client/assets/{Image01-BcbXjZdM.js → Image01-LmX-9DTg.js} +1 -1
  18. package/dist/client/assets/{Key01-BnDtFdB6.js → Key01-D7fc2of0.js} +1 -1
  19. package/dist/client/assets/{Link01-CeBVtW9F.js → Link01-UOxGnkqg.js} +1 -1
  20. package/dist/client/assets/{LinkBroken01-B4m_6hKA.js → LinkBroken01-D4fcNp0y.js} +1 -1
  21. package/dist/client/assets/{Monitor01-DluZDvx0.js → Monitor01-zCUpqs5C.js} +1 -1
  22. package/dist/client/assets/{Play-C67yELx6.js → Play-BaMMHzUS.js} +1 -1
  23. package/dist/client/assets/{Plus-FrFsiUQv.js → Plus-DBwsZRbL.js} +1 -1
  24. package/dist/client/assets/{SearchMd-CTE_Dij_.js → SearchMd-Cz9CjV4u.js} +1 -1
  25. package/dist/client/assets/{Sector-DpVhdPl7.js → Sector-DRzP1YgK.js} +1 -1
  26. package/dist/client/assets/{ShoppingBag01-B47bYriG.js → ShoppingBag01-FE4oAEwY.js} +1 -1
  27. package/dist/client/assets/{Sun-BADHqp_z.js → Sun-lUDK8Dny.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-B8pZTGji.js → SwitchHorizontal01-BLoNOmQx.js} +1 -1
  29. package/dist/client/assets/{Tool01-Ceiq1yQg.js → Tool01-BYtrXXg0.js} +1 -1
  30. package/dist/client/assets/{Trash01-QaBoOmQD.js → Trash01-DmGIq4LE.js} +1 -1
  31. package/dist/client/assets/{Upload01-CfxF6ZJF.js → Upload01-B1KubIEG.js} +1 -1
  32. package/dist/client/assets/{User01-DowUGIml.js → User01-DxYW6D1x.js} +1 -1
  33. package/dist/client/assets/{UserSquare-C1l8QNgE.js → UserSquare-B3hi5v4G.js} +1 -1
  34. package/dist/client/assets/{Users01-BvAfz3hH.js → Users01-Dg9yGM1q.js} +1 -1
  35. package/dist/client/assets/{XAxis-DQTb2U_R.js → XAxis-BriqOO10.js} +1 -1
  36. package/dist/client/assets/{XClose-CDVFbEme.js → XClose-D_NlSxSm.js} +1 -1
  37. package/dist/client/assets/{ZoomOut-0IXFhA1q.js → ZoomOut-BpMDqvoU.js} +1 -1
  38. package/dist/client/assets/{access-gate-BietqhCq.js → access-gate-DawpkWaC.js} +1 -1
  39. package/dist/client/assets/{add-connection-dialog-CcwJwiyY.js → add-connection-dialog-lyugU_mj.js} +1 -1
  40. package/dist/client/assets/{agent-analytics-DbRvj_tI.js → agent-analytics-DEQNBU8x.js} +1 -1
  41. package/dist/client/assets/agent-app-B_p1zClu.js +1 -0
  42. package/dist/client/assets/{agent-assets-pN9q_Pkx.js → agent-assets-DpD_FYPJ.js} +1 -1
  43. package/dist/client/assets/{agent-automation-CvB6C4Vu.js → agent-automation-y8Q_blPP.js} +1 -1
  44. package/dist/client/assets/{agent-automations-78ZqzNjS.js → agent-automations-G_wOHGxQ.js} +1 -1
  45. package/dist/client/assets/{agent-connect-sources-374gt80i.js → agent-connect-sources-0w-hFhuF.js} +1 -1
  46. package/dist/client/assets/agent-deck-Bv4Ea3n5.js +1 -0
  47. package/dist/client/assets/{agent-e2e-DyeOXWbZ.js → agent-e2e-DDS2OBYo.js} +1 -1
  48. package/dist/client/assets/{agent-experiments-VXnZmfhk.js → agent-experiments-CDaNVjiN.js} +1 -1
  49. package/dist/client/assets/{agent-file-B0YjGOwa.js → agent-file-CZwBMDPX.js} +1 -1
  50. package/dist/client/assets/{agent-hosting-DYfoCiax.js → agent-hosting-CDM9c3HL.js} +1 -1
  51. package/dist/client/assets/{agent-icon-E5NFjGaq.js → agent-icon-Cwi3uRdu.js} +1 -1
  52. package/dist/client/assets/agent-library-B8Kx2dH6.js +1 -0
  53. package/dist/client/assets/agent-library-file-D6BfiqFR.js +1 -0
  54. package/dist/client/assets/{agent-monitor-CYXJZvch.js → agent-monitor-DgbGzFfm.js} +1 -1
  55. package/dist/client/assets/{agent-overview-CFP2r65u.js → agent-overview-D7sXtedV.js} +1 -1
  56. package/dist/client/assets/{agent-releases-BHhSgU59.js → agent-releases-DBGhKiDv.js} +1 -1
  57. package/dist/client/assets/agent-settings-CYtLsqfY.js +1 -0
  58. package/dist/client/assets/{agent-site-editor-ByLDMiSm.js → agent-site-editor-CPneBPX9.js} +1 -1
  59. package/dist/client/assets/agent-site-editor-code-CoA0Y8Pm.js +2 -0
  60. package/dist/client/assets/agent-site-editor-content-B6s0vW0K.js +1 -0
  61. package/dist/client/assets/agent-site-editor-preview-Deycj8Hn.js +1 -0
  62. package/dist/client/assets/agent-view-DKBEZHZf.js +1 -0
  63. package/dist/client/assets/{agent-view-guard-BVO3LqzS.js → agent-view-guard-B7DCW97m.js} +1 -1
  64. package/dist/client/assets/{agents-list-Dculqto5.js → agents-list-WKtrnsCY.js} +1 -1
  65. package/dist/client/assets/{ai-providers-DolR1Us6.js → ai-providers-gwsES712.js} +1 -1
  66. package/dist/client/assets/{alert-Dm5RN1oD.js → alert-DD0xrZ6s.js} +1 -1
  67. package/dist/client/assets/{alert-dialog-BY83tkfe.js → alert-dialog-Cww2cCKj.js} +1 -1
  68. package/dist/client/assets/{analytics-sections-CZp3MeQw.js → analytics-sections-fsDdSYtz.js} +1 -1
  69. package/dist/client/assets/{api-keys-CldV2ng2.js → api-keys-C4RupExd.js} +1 -1
  70. package/dist/client/assets/api-keys-DIX6Wq_J.js +1 -0
  71. package/dist/client/assets/{app-editor-CzTTzdaU.js → app-editor-BunD9Cep.js} +1 -1
  72. package/dist/client/assets/{asset-utils-DOMqsWw0.js → asset-utils-B7vSk_IG.js} +1 -1
  73. package/dist/client/assets/{auth-catchall-Dmk_X1_7.js → auth-catchall-DXOnI1Dn.js} +1 -1
  74. package/dist/client/assets/{auth-3_xtjhZa.js → auth-d1Zn25hw.js} +1 -1
  75. package/dist/client/assets/{auth-entry-uTh0V7C8.js → auth-entry-QKE13w72.js} +1 -1
  76. package/dist/client/assets/{auth-split-layout-CqYj_13F.js → auth-split-layout-BOn9jzuY.js} +1 -1
  77. package/dist/client/assets/{authenticate-and-persist-oauth-CLn5_4J6.js → authenticate-and-persist-oauth-p8iXxMbw.js} +1 -1
  78. package/dist/client/assets/{automation-list-row-dzpsPyTv.js → automation-list-row-aeiODfl-.js} +1 -1
  79. package/dist/client/assets/{automation-runs-CAYarR59.js → automation-runs-gnGbUEYl.js} +1 -1
  80. package/dist/client/assets/{automations-Dfb3WhG2.js → automations-D6uaxrsR.js} +1 -1
  81. package/dist/client/assets/{autosend-Dqgiz7-z.js → autosend-DkgNxXhw.js} +1 -1
  82. package/dist/client/assets/{avatar-D-6InH0Y.js → avatar-Bp-EkB-V.js} +1 -1
  83. package/dist/client/assets/{badge-sJYWVYje.js → badge-BIePf0xK.js} +1 -1
  84. package/dist/client/assets/{block-document-CwGtizDj.js → block-document-D9afNZe_.js} +1 -1
  85. package/dist/client/assets/{blocks-preview-workspace-context-JFuqyIhO.js → blocks-preview-workspace-context-CVDMxLIY.js} +1 -1
  86. package/dist/client/assets/{blocks-tab-states-CUi2qvXH.js → blocks-tab-states-Dgf9O_BB.js} +3 -3
  87. package/dist/client/assets/{blog-schema-CYGnXeYs.js → blog-schema-D_8LQntk.js} +1 -1
  88. package/dist/client/assets/{board-analytics-wIsQVPwo.js → board-analytics-QsikkAwD.js} +1 -1
  89. package/dist/client/assets/{buckets-CnfDBCeG.js → buckets-CELYezv2.js} +1 -1
  90. package/dist/client/assets/{build-improve-prompt-doc-CtseFH_6.js → build-improve-prompt-doc-d10qBCA_.js} +1 -1
  91. package/dist/client/assets/{calendar-CkQr_tH3.js → calendar-BnpyhDmY.js} +1 -1
  92. package/dist/client/assets/{capability-load-error-Dj0p1QAG.js → capability-load-error-D8PnCnVx.js} +1 -1
  93. package/dist/client/assets/{category-editor-BNcm0eWj.js → category-editor-BosHSdme.js} +1 -1
  94. package/dist/client/assets/{chart-CArQDy5U.js → chart-Bv9NYntf.js} +1 -1
  95. package/dist/client/assets/{chat-context-tvcXoBeE.js → chat-context-CKK4nwlA.js} +8 -8
  96. package/dist/client/assets/{chat-draft-ags4xou8.js → chat-draft-BMAMpVi3.js} +1 -1
  97. package/dist/client/assets/{checkbox-C6deEGCR.js → checkbox-Dwjm_TLd.js} +1 -1
  98. package/dist/client/assets/{choose-editor-49fvt7KT.js → choose-editor-CZoejY4P.js} +1 -1
  99. package/dist/client/assets/{cli-auth-success-CtyD07eG.js → cli-auth-success-B_GTleKO.js} +1 -1
  100. package/dist/client/assets/{client-icons-BJlX5RmN.js → client-icons-rqhSDiCg.js} +1 -1
  101. package/dist/client/assets/cms-settings-editor-B950DCbJ.js +1 -0
  102. package/dist/client/assets/{collapsible-DNW_6aVc.js → collapsible-BEHE2idT.js} +1 -1
  103. package/dist/client/assets/{collection-detail-D_oRg5uq.js → collection-detail-CEB1twCS.js} +1 -1
  104. package/dist/client/assets/{collection-display-button-CxD1zfgF.js → collection-display-button-CZETvC3F.js} +1 -1
  105. package/dist/client/assets/{collection-search-BzGtQCoT.js → collection-search-mDMHjO22.js} +1 -1
  106. package/dist/client/assets/{collection-table-wrapper-Bdkg1hq0.js → collection-table-wrapper-BTz_B-8u.js} +1 -1
  107. package/dist/client/assets/{collection-tabs-D-985lbS.js → collection-tabs-C8f6Only.js} +1 -1
  108. package/dist/client/assets/{column-rules-DTH6MFyL.js → column-rules-CHHzpXer.js} +1 -1
  109. package/dist/client/assets/{combobox-DH1NtP3D.js → combobox-DsvKNdY8.js} +1 -1
  110. package/dist/client/assets/{command-CVodN_KO.js → command-D2C8egnH.js} +1 -1
  111. package/dist/client/assets/{companion-mcps-section-DC91CD_h.js → companion-mcps-section-980W-E9y.js} +1 -1
  112. package/dist/client/assets/{config-CH426QBK.js → config-Df4GVvvj.js} +1 -1
  113. package/dist/client/assets/{connect-B4atgjM-.js → connect-BCz-doDt.js} +1 -1
  114. package/dist/client/assets/{connect-layout-Dn5RIa3-.js → connect-layout-dj6lGUOP.js} +1 -1
  115. package/dist/client/assets/{connection-BzAtvzSu.js → connection-CXmYeQRu.js} +1 -1
  116. package/dist/client/assets/{connection-card-CuDjRvQM.js → connection-card-BnbrpDH3.js} +1 -1
  117. package/dist/client/assets/{connection-detail-LDbDzTcC.js → connection-detail-DgPXb5ec.js} +1 -1
  118. package/dist/client/assets/{connection-form-helpers-DX9VWFYw.js → connection-form-helpers-a4JD1Ns8.js} +1 -1
  119. package/dist/client/assets/{connections-DPd5fcz3.js → connections-Cywtpg_p.js} +1 -1
  120. package/dist/client/assets/{content-tab-CWZGoAxh.js → content-tab-DJpFcjvc.js} +3 -3
  121. package/dist/client/assets/{context-ItK-xs8d.js → context-D3qk5qiN.js} +1 -1
  122. package/dist/client/assets/{context-menu-DwASq-2m.js → context-menu-BAv_ihvH.js} +1 -1
  123. package/dist/client/assets/{core.esm-DD7e57Ya.js → core.esm-D0fLNP6n.js} +1 -1
  124. package/dist/client/assets/{create-organization-dialog-u5RVm6vz.js → create-organization-dialog-Dz2w339w.js} +1 -1
  125. package/dist/client/assets/{daily-pulse-BrZF3U10.js → daily-pulse-BvFEfYSA.js} +1 -1
  126. package/dist/client/assets/{discover-BVHoLkk3.js → discover-LQfpS4xG.js} +1 -1
  127. package/dist/client/assets/{domain-settings-BM7hqiZ5.js → domain-settings-B0WV9_Uz.js} +1 -1
  128. package/dist/client/assets/{drawer-CkTzw9-A.js → drawer-C7TJoqXz.js} +1 -1
  129. package/dist/client/assets/{editor-classes-DwfWTmoT.js → editor-classes-B9HFPeRc.js} +1 -1
  130. package/dist/client/assets/{editor-CsrsRQNL.js → editor-r9_MTJH5.js} +1 -1
  131. package/dist/client/assets/{empty-state-Ba3qMun8.js → empty-state-ChkfcEnf.js} +1 -1
  132. package/dist/client/assets/{empty-state-CH6iGvNw.js → empty-state-DXyqmsSi.js} +1 -1
  133. package/dist/client/assets/{extract-connection-data-B_Afz4nk.js → extract-connection-data-B2gWRdBp.js} +1 -1
  134. package/dist/client/assets/{feature-gate-W48R3WT6.js → feature-gate-B6qb42zy.js} +1 -1
  135. package/dist/client/assets/{feature-paywall-D9khkBoZ.js → feature-paywall-DXx7v-jJ.js} +1 -1
  136. package/dist/client/assets/{file-explorer-DHDq6x-v.js → file-explorer-B67HF6Wo.js} +1 -1
  137. package/dist/client/assets/{file-preview-D9n-rE_m.js → file-preview-Baou4Z0N.js} +1 -1
  138. package/dist/client/assets/{file-share-button-CxU4bp8P.js → file-share-button-DtVBXYxU.js} +1 -1
  139. package/dist/client/assets/{file-type-icon-hT5Dk06T.js → file-type-icon-C2mdy7vI.js} +1 -1
  140. package/dist/client/assets/flat-project-CqneD8tb.js +1 -0
  141. package/dist/client/assets/{folder-icon-BgkcWxyT.js → folder-icon-Bqx-rRTJ.js} +1 -1
  142. package/dist/client/assets/{form-lTigv9Cm.js → form-DDdiF5DN.js} +1 -1
  143. package/dist/client/assets/{general-BW8ipZ-G.js → general-JuFqcNqn.js} +1 -1
  144. package/dist/client/assets/{home-BDeiBiYZ.js → home-UcHgTtiG.js} +1 -1
  145. package/dist/client/assets/{hosted-publish-feedback-Bttd9R-q.js → hosted-publish-feedback-5DTVDnQ-.js} +1 -1
  146. package/dist/client/assets/{icon-button-AZBqWvLN.js → icon-button-DfjCa6Mk.js} +1 -1
  147. package/dist/client/assets/{index-dmpY0k1_.js → index-2M41MwRq.js} +1 -1
  148. package/dist/client/assets/{index-CWGftR7V.js → index-BHzdhQYD.js} +1 -1
  149. package/dist/client/assets/{index-BrYnrqwa.js → index-BOey0PQ3.js} +1 -1
  150. package/dist/client/assets/{index-D19vbl6v.js → index-BVXKUS4M.js} +1 -1
  151. package/dist/client/assets/{index-B-eHj4u4.js → index-BlWeDA0T.js} +2 -2
  152. package/dist/client/assets/{index-UJRTDiss.js → index-BuXV8w2T.js} +1 -1
  153. package/dist/client/assets/{index-CSj5qaNn.js → index-CCq4aC_-.js} +3 -3
  154. package/dist/client/assets/{index-B8E6_dOg.js → index-CYLF_RCH.js} +1 -1
  155. package/dist/client/assets/{index-BlmkjYB7.js → index-Cb4Qh-54.js} +1 -1
  156. package/dist/client/assets/{index-kBSJcstK.js → index-D1I5UKBv.js} +1 -1
  157. package/dist/client/assets/{index-BVC6tsxO.js → index-D5I6z1z8.js} +1 -1
  158. package/dist/client/assets/{index-Bj0pg4Xb.js → index-DCg7x8H-.js} +1 -1
  159. package/dist/client/assets/{index-SEQedjDw.js → index-DrHP_BcE.js} +1 -1
  160. package/dist/client/assets/{index-TqnZfvlo.js → index-LPxqYo8X.js} +1 -1
  161. package/dist/client/assets/{index-redirect-C2exOEJ6.js → index-redirect-BL8ikpY8.js} +1 -1
  162. package/dist/client/assets/{index-C5owFjSB.js → index-sLNiMwXT.js} +1 -1
  163. package/dist/client/assets/{infiniteQueryObserver-OMlvsWcf.js → infiniteQueryObserver-C9osZa8h.js} +1 -1
  164. package/dist/client/assets/{infra-billing-uV4T8F6_.js → infra-billing-Cs3idU5N.js} +1 -1
  165. package/dist/client/assets/{input-0NgdpVnI.js → input-3uLsKqBB.js} +3 -3
  166. package/dist/client/assets/{input-CyiZQSl-.js → input-BSKhVE-B.js} +1 -1
  167. package/dist/client/assets/{integration-icon-DKhUl3mk.js → integration-icon-BRfynNZ5.js} +1 -1
  168. package/dist/client/assets/{jira-icon-B2cXiao2.js → jira-icon-KByV_Mf3.js} +1 -1
  169. package/dist/client/assets/{label-Hktokb9g.js → label-CCf767lm.js} +1 -1
  170. package/dist/client/assets/{layout-Nt9MYelU.js → layout-COMw43Ge.js} +1 -1
  171. package/dist/client/assets/{legacy-agents-deep-C25-uw28.js → legacy-agents-deep-bTO0GYdo.js} +1 -1
  172. package/dist/client/assets/{legacy-main-redirect-BmR3yjWi.js → legacy-main-redirect-TCc947lk.js} +1 -1
  173. package/dist/client/assets/library-D9_ShewK.js +1 -0
  174. package/dist/client/assets/{library-tab-Cw4yhIxO.js → library-tab-BGwlABCU.js} +1 -1
  175. package/dist/client/assets/{login-CmLP5OaS.js → login-Cs3tkGZ_.js} +1 -1
  176. package/dist/client/assets/{markdown-nIQQa0PZ.js → markdown-BRIlR7nZ.js} +1 -1
  177. package/dist/client/assets/{mcp-app-renderer-DJ3cRpmT.js → mcp-app-renderer-BdWVQtZT.js} +1 -1
  178. package/dist/client/assets/{mcp-oauth-BFMHXWCx.js → mcp-oauth-CbRV1ySf.js} +1 -1
  179. package/dist/client/assets/{mcp-oauth-BDYmNGyy.js → mcp-oauth-Wpa3RhmZ.js} +1 -1
  180. package/dist/client/assets/{members-BSHBMQ7h.js → members-D2nKnBqd.js} +1 -1
  181. package/dist/client/assets/{memory-D_VsBptg.js → memory-BOidyMfA.js} +1 -1
  182. package/dist/client/assets/{mini-report-page-6cVsNT3a.js → mini-report-page-Dvm9KZA4.js} +1 -1
  183. package/dist/client/assets/{mock-board-BW-Sa_Jw.js → mock-board-D7x3oR1J.js} +1 -1
  184. package/dist/client/assets/{monaco-editor-CETdPqMD.js → monaco-editor-CGec7a_K.js} +1 -1
  185. package/dist/client/assets/{monitoring-stats-row-yTtrPgRB.js → monitoring-stats-row-BBfe42aa.js} +1 -1
  186. package/dist/client/assets/{multi-select-Bt7N4nxw.js → multi-select-CWeD2kOU.js} +1 -1
  187. package/dist/client/assets/{mustache-CkmSkLcC.js → mustache-CwHM8aj-.js} +1 -1
  188. package/dist/client/assets/{new-project-dialog-BiL8l-Gz.js → new-project-dialog-D9WaXvgl.js} +1 -1
  189. package/dist/client/assets/{oauth-callback-C2OhIdyv.js → oauth-callback-BdiwSco0.js} +1 -1
  190. package/dist/client/assets/{oauth-callback-ai-provider-Dvmle1pb.js → oauth-callback-ai-provider-CgO92uMO.js} +1 -1
  191. package/dist/client/assets/{onboarding-B4ZAdkmE.js → onboarding-C0FoRXam.js} +1 -1
  192. package/dist/client/assets/{openai-conversation-B_fu8wmv.js → openai-conversation-DScTerkb.js} +1 -1
  193. package/dist/client/assets/{optimistic-project-sidebar-views-Cq91NNiT.js → optimistic-project-sidebar-views--iSxVboR.js} +1 -1
  194. package/dist/client/assets/{organization-choice-BHS7iEpR.js → organization-choice-BfKg9bh6.js} +1 -1
  195. package/dist/client/assets/{orgs-C_-EK1k8.js → orgs-DuBdGAZM.js} +1 -1
  196. package/dist/client/assets/{page-seo-form-hSczGRI6.js → page-seo-form-DobjM56n.js} +1 -1
  197. package/dist/client/assets/{pair-XFt8jz7C.js → pair-Boroas12.js} +1 -1
  198. package/dist/client/assets/{plan-ladder-Bcai7E3A.js → plan-ladder-DRlbA6Oe.js} +1 -1
  199. package/dist/client/assets/{popover-DrRqLOLZ.js → popover-C86-20Mm.js} +1 -1
  200. package/dist/client/assets/{post-calendar-DKuwQYqY.js → post-calendar-BCVyphrd.js} +1 -1
  201. package/dist/client/assets/{post-editor-DnuhIR5k.js → post-editor-BcCUjE05.js} +1 -1
  202. package/dist/client/assets/{preview-content-BmE0C6gq.js → preview-content-Dk4Scdb5.js} +1 -1
  203. package/dist/client/assets/{preview-dialog-BOiVnRWu.js → preview-dialog-BP2Zt8Py.js} +1 -1
  204. package/dist/client/assets/{preview-panel-C8DpBZEG.js → preview-panel-BGjEJtqj.js} +1 -1
  205. package/dist/client/assets/{preview-tab-DbXCdlWL.js → preview-tab-DJ2raYQ6.js} +3 -3
  206. package/dist/client/assets/{product-picker-dialog-CkF4Q27X.js → product-picker-dialog-g66EoJ_T.js} +1 -1
  207. package/dist/client/assets/{profile-7yNVObk5.js → profile-BT5VjyCv.js} +1 -1
  208. package/dist/client/assets/{project-app-view-Bp6LQc2t.js → project-app-view-DmFCm9cm.js} +1 -1
  209. package/dist/client/assets/{project-feed-DKKNi4Ua.js → project-feed-B4yf-56T.js} +1 -1
  210. package/dist/client/assets/{project-icon-D9S8dOj2.js → project-icon-CJp8KUWK.js} +1 -1
  211. package/dist/client/assets/project-reports-D8ocu1pR.js +1 -0
  212. package/dist/client/assets/project-tasks-DJVmaqrl.js +1 -0
  213. package/dist/client/assets/{projects-C_HSjbRf.js → projects-7LPBT4kF.js} +1 -1
  214. package/dist/client/assets/{projects-empty-state-CxJvmt56.js → projects-empty-state-Bwas41PR.js} +1 -1
  215. package/dist/client/assets/{prompts-CoXqq6oc.js → prompts-BVvVWZvL.js} +1 -1
  216. package/dist/client/assets/record-editor-DywGKfn_.js +1 -0
  217. package/dist/client/assets/{redirect-editor-CqykzZQ6.js → redirect-editor-CBUBt5If.js} +1 -1
  218. package/dist/client/assets/{reports-Bima2O7N.js → reports-BEw3YAN9.js} +1 -1
  219. package/dist/client/assets/{reports-onboarding-DSmSkO0F.js → reports-onboarding-C2RC2ok9.js} +1 -1
  220. package/dist/client/assets/{reports-tab-BVzkcFqa.js → reports-tab-cAMVw7Rk.js} +2 -2
  221. package/dist/client/assets/reports-wAXvk8Rj.js +1 -0
  222. package/dist/client/assets/{repositories-BQXG-rNE.js → repositories-C9isGzNA.js} +1 -1
  223. package/dist/client/assets/{repository-binding-CVI26IB4.js → repository-binding-Ds0zXEVH.js} +1 -1
  224. package/dist/client/assets/{repository-import-picker-Cv7ik8wr.js → repository-import-picker-CJrt2Qyf.js} +1 -1
  225. package/dist/client/assets/{repository-picker-CaK5oYjG.js → repository-picker-DoUZKYGY.js} +1 -1
  226. package/dist/client/assets/{require-capability-Bk3o-_ih.js → require-capability-Canamm7b.js} +1 -1
  227. package/dist/client/assets/{required-auth-layout-BA_CRgc2.js → required-auth-layout-CoQlG-uh.js} +1 -1
  228. package/dist/client/assets/{reset-password-CJR2Md-H.js → reset-password-BIKAyV8Z.js} +1 -1
  229. package/dist/client/assets/{resizable-Bvs1DfKq.js → resizable-Bu_8_8YG.js} +1 -1
  230. package/dist/client/assets/{resolve-tab-icon-CPW7joUI.js → resolve-tab-icon-BYZBv0qd.js} +1 -1
  231. package/dist/client/assets/{review-settings-C79kWvAG.js → review-settings-dkP8FuZW.js} +1 -1
  232. package/dist/client/assets/{roles-j7FKOAUh.js → roles-B5cvsmrd.js} +1 -1
  233. package/dist/client/assets/{route-CA_TH__q.js → route-1w9x4x4x.js} +1 -1
  234. package/dist/client/assets/{route-R5TXvUXW.js → route-BhzRlDpl.js} +1 -1
  235. package/dist/client/assets/route-y_BiPuKo.js +1 -0
  236. package/dist/client/assets/{sandbox-lifecycle-context-lyXe9eIS.js → sandbox-lifecycle-context-DHjDdwbp.js} +1 -1
  237. package/dist/client/assets/{schema-DDS90txY.js → schema-D-34ICTJ.js} +1 -1
  238. package/dist/client/assets/{schema-CYEVNkkO.js → schema-DO5D2eCO.js} +1 -1
  239. package/dist/client/assets/{scroll-area-BxjOHUE0.js → scroll-area-BjUjV0Z5.js} +1 -1
  240. package/dist/client/assets/{search-input-CEGrosU-.js → search-input-BaljBVL8.js} +1 -1
  241. package/dist/client/assets/{search-toggle-DGnOuR56.js → search-toggle-BagUH5ou.js} +1 -1
  242. package/dist/client/assets/{secret-ciphertext-DuXF1kfY.js → secret-ciphertext-B8vjXVJK.js} +1 -1
  243. package/dist/client/assets/{secret-picker-DNAEW5WZ.js → secret-picker-CNgtWTyP.js} +1 -1
  244. package/dist/client/assets/{secrets-CweiWstI.js → secrets-Bgw4Vhpc.js} +1 -1
  245. package/dist/client/assets/{sections-editor-zQKRHCN0.js → sections-editor-DrdT1MI7.js} +1 -1
  246. package/dist/client/assets/{select-Be8KEqhq.js → select-B54nmexC.js} +1 -1
  247. package/dist/client/assets/{select-model-DSiTAeyQ.js → select-model-BoCP7Le0.js} +1 -1
  248. package/dist/client/assets/{seo-editor-5bdlykFK.js → seo-editor-CReMwULk.js} +1 -1
  249. package/dist/client/assets/{separator-C1oZC_Nw.js → separator-BeOkUBr0.js} +1 -1
  250. package/dist/client/assets/{settings-tab-Dk-4q6cx.js → settings-tab-D75yr9EZ.js} +1 -1
  251. package/dist/client/assets/{sheet-DcLd8f_T.js → sheet-2W5SODwA.js} +1 -1
  252. package/dist/client/assets/{shell-layout-jpc-IFbN.js → shell-layout-xMF7zZJW.js} +1 -1
  253. package/dist/client/assets/site-editor-BpVflMAH.js +1 -0
  254. package/dist/client/assets/{site-editor-toast-Rw5XomcC.js → site-editor-toast-B6rO5nP0.js} +1 -1
  255. package/dist/client/assets/{skills-BgH9DrsO.js → skills-C1sp0eJN.js} +1 -1
  256. package/dist/client/assets/{slider-CpmotJcT.js → slider-BpixRq8v.js} +1 -1
  257. package/dist/client/assets/{sortable.esm-Ch2zuqy4.js → sortable.esm-B1VIDqmY.js} +1 -1
  258. package/dist/client/assets/{sso-DhgNSN8N.js → sso-B50YHclH.js} +1 -1
  259. package/dist/client/assets/{suggestion-D6gjcmHp.js → suggestion-DjstHMLc.js} +1 -1
  260. package/dist/client/assets/{switch-CkX0BpKj.js → switch-ZvhKKFCY.js} +1 -1
  261. package/dist/client/assets/{symbol-BfV3FsI2.js → symbol-CRqLTukg.js} +1 -1
  262. package/dist/client/assets/{synced-repos-BPr9w1RO.js → synced-repos-D0e12nej.js} +1 -1
  263. package/dist/client/assets/{tab-icon-glyph-CeaHu6-c.js → tab-icon-glyph-By9Irlxn.js} +1 -1
  264. package/dist/client/assets/{table-CM8IdXDA.js → table-iG31aWmE.js} +1 -1
  265. package/dist/client/assets/{tabs-Mabj7P4A.js → tabs-CtKgNHMr.js} +1 -1
  266. package/dist/client/assets/{task-board-BDqVuMua.js → task-board-C00mxWAh.js} +1 -1
  267. package/dist/client/assets/{task-route-HyrcQpIh.js → task-route-BCPomVVQ.js} +1 -1
  268. package/dist/client/assets/{task-status-BTchb5mm.js → task-status-BDiexprl.js} +1 -1
  269. package/dist/client/assets/taskboard-analytics-dOoDSrcB.js +1 -0
  270. package/dist/client/assets/{tasks-N_JbBzrQ.js → tasks-AIRARaPK.js} +1 -1
  271. package/dist/client/assets/tasks-D17PyrkT.js +1 -0
  272. package/dist/client/assets/{textarea-Cu_mwrDc.js → textarea-BLu1V32o.js} +1 -1
  273. package/dist/client/assets/{thread-analytics-B6KhxNmJ.js → thread-analytics-BMKFoeky.js} +1 -1
  274. package/dist/client/assets/{thread-intent-2PQ2tJ8y.js → thread-intent-9GHukD-s.js} +1 -1
  275. package/dist/client/assets/{thread-route-C5byRWcJ.js → thread-route-B1NXGQXt.js} +1 -1
  276. package/dist/client/assets/{thread-route-BiZeKn-m.js → thread-route-CW7xmu6G.js} +1 -1
  277. package/dist/client/assets/{thread-sheet-body-BUt_0YWK.js → thread-sheet-body-rJHE2tap.js} +1 -1
  278. package/dist/client/assets/{time-range-picker-Bf0ZJ2P5.js → time-range-picker-CNeKIOXx.js} +1 -1
  279. package/dist/client/assets/{toggle-group-BRDgtYtL.js → toggle-group-BLxmrLuD.js} +1 -1
  280. package/dist/client/assets/{tool-namespace-XBvXTguD.js → tool-namespace-Cu-DNTic.js} +1 -1
  281. package/dist/client/assets/{toolbar-icon-button-CysTSWyH.js → toolbar-icon-button-670IDOJM.js} +1 -1
  282. package/dist/client/assets/{tooltip-Wg5TOkgk.js → tooltip-B6W7NpVz.js} +1 -1
  283. package/dist/client/assets/{tooltipContext-BSZQ5pEw.js → tooltipContext-BWgKo-Vc.js} +1 -1
  284. package/dist/client/assets/{track-DDuUL9Xr.js → track-j7cOVNc5.js} +1 -1
  285. package/dist/client/assets/{types-C9g69UXw.js → types-C4NGZqb0.js} +1 -1
  286. package/dist/client/assets/{url-slug-CWeO_dvk.js → url-slug-CCgQongS.js} +1 -1
  287. package/dist/client/assets/{usage-stats-0IIA6wpa.js → usage-stats-2c6yVTyC.js} +1 -1
  288. package/dist/client/assets/{use-ai-providers-CrjK99NZ.js → use-ai-providers-BWqKJRmf.js} +1 -1
  289. package/dist/client/assets/{use-app-takeover-BEzSlm3S.js → use-app-takeover-DUugSHjQ.js} +1 -1
  290. package/dist/client/assets/{use-automations-AJoQb6lP.js → use-automations-DOCjbfCs.js} +1 -1
  291. package/dist/client/assets/{use-autosave-C7ouSmgc.js → use-autosave-BpEFoeBr.js} +1 -1
  292. package/dist/client/assets/{use-chat-navigation-BVwgk2mi.js → use-chat-navigation-CmNsxQBq.js} +1 -1
  293. package/dist/client/assets/{use-clock-tick-B6NhSBfs.js → use-clock-tick-B2MqiplU.js} +1 -1
  294. package/dist/client/assets/{use-connect-companion-WJiOGzbb.js → use-connect-companion-DCgJdQ-W.js} +1 -1
  295. package/dist/client/assets/{use-connection-D8Z-oNDI.js → use-connection-BDpvwZcn.js} +1 -1
  296. package/dist/client/assets/{use-copy-KuwVRxCe.js → use-copy-_ycKA-XN.js} +1 -1
  297. package/dist/client/assets/{use-create-virtual-mcp-RCA64tHb.js → use-create-virtual-mcp-CXKmymqn.js} +1 -1
  298. package/dist/client/assets/{use-date-fns-locale-CeeB1a5i.js → use-date-fns-locale-fMKfOMsB.js} +1 -1
  299. package/dist/client/assets/{use-debounced-autosave-CU9q8XT5.js → use-debounced-autosave-B9xt5l_2.js} +1 -1
  300. package/dist/client/assets/{use-debounced-value-B43T9Zwm.js → use-debounced-value-ByyoTH63.js} +1 -1
  301. package/dist/client/assets/{use-deco-credits-BqmDR-Hh.js → use-deco-credits-CT_j_qxS.js} +1 -1
  302. package/dist/client/assets/{use-decopilot-events-DrGKqtmd.js → use-decopilot-events-Bd-4vex6.js} +1 -1
  303. package/dist/client/assets/{use-delete-connection-dDlynrtq.js → use-delete-connection-DJ4nDOEg.js} +1 -1
  304. package/dist/client/assets/{use-deployment-admin-XCC0klqS.js → use-deployment-admin-BoLt0KCx.js} +1 -1
  305. package/dist/client/assets/{use-ensure-project-folder-DzlO-RZu.js → use-ensure-project-folder-Dd1Qlz-V.js} +1 -1
  306. package/dist/client/assets/{use-fast-preview-draft-url-CWuWJF_Z.js → use-fast-preview-draft-url-DZRNnF9t.js} +1 -1
  307. package/dist/client/assets/{use-file-configs-bBTy3-MH.js → use-file-configs-DgLGloNq.js} +1 -1
  308. package/dist/client/assets/{use-infinite-scroll-Bx08szbZ.js → use-infinite-scroll-F7T2FF-S.js} +1 -1
  309. package/dist/client/assets/{use-join-requests-9S6TcS4c.js → use-join-requests-DqXVwXAp.js} +1 -1
  310. package/dist/client/assets/{use-main-panel-tabs-DYzUw0ny.js → use-main-panel-tabs-CAJkn_vg.js} +1 -1
  311. package/dist/client/assets/{use-mcp-auth-status-x7_sjlLt.js → use-mcp-auth-status-2eKyky0r.js} +1 -1
  312. package/dist/client/assets/{use-mcp-client-fHTUkiQr.js → use-mcp-client-B333X4fs.js} +1 -1
  313. package/dist/client/assets/{use-mcp-prompts-BPRabyYT.js → use-mcp-prompts-P2KMjN9W.js} +1 -1
  314. package/dist/client/assets/{use-mcp-tools-D4mzKQtZ.js → use-mcp-tools-56vayh3K.js} +1 -1
  315. package/dist/client/assets/{use-members-CKWy7WEt.js → use-members-DfdZqgw8.js} +1 -1
  316. package/dist/client/assets/{use-mobile-BZpAUwUb.js → use-mobile-hkvDmO1w.js} +1 -1
  317. package/dist/client/assets/{use-navigate-to-agent-CsnmgB4q.js → use-navigate-to-agent-Dzg43OKn.js} +1 -1
  318. package/dist/client/assets/{use-open-billing-url-DJ2g56mK.js → use-open-billing-url-DJYL8W0U.js} +1 -1
  319. package/dist/client/assets/{use-org-auth-client-g30TuQtQ.js → use-org-auth-client-DROvF2zH.js} +1 -1
  320. package/dist/client/assets/{use-org-fs-zGIV3ymG.js → use-org-fs-D6VAaLCr.js} +1 -1
  321. package/dist/client/assets/{use-org-repo-syncs-DJQrhGC0.js → use-org-repo-syncs-DlDJxigu.js} +1 -1
  322. package/dist/client/assets/{use-org-sso-BrvNWA5X.js → use-org-sso-CH28wOEA.js} +1 -1
  323. package/dist/client/assets/{use-organization-roles-BJUlrG6W.js → use-organization-roles-BQ-3VnZ-.js} +1 -1
  324. package/dist/client/assets/{use-organization-settings-PcDKDabM.js → use-organization-settings-DxTssZLI.js} +1 -1
  325. package/dist/client/assets/{use-panel-navigate-CtG66pHN.js → use-panel-navigate-C2cHRlDL.js} +1 -1
  326. package/dist/client/assets/{use-project-native-view-presence-BK8YOIZ_.js → use-project-native-view-presence-bO2szMt1.js} +1 -1
  327. package/dist/client/assets/{use-project-scope-BIaj1klw.js → use-project-scope-BROCSZWk.js} +1 -1
  328. package/dist/client/assets/{use-recent-apps-CdBePM46.js → use-recent-apps-DhLr7_TT.js} +1 -1
  329. package/dist/client/assets/{use-releases-DiKuK1Mb.js → use-releases-D6ba4LWy.js} +1 -1
  330. package/dist/client/assets/{use-reports-diagnostic-DtOFbpHG.js → use-reports-diagnostic-BYrSJ1-D.js} +1 -1
  331. package/dist/client/assets/{use-secrets-D1EjKfHx.js → use-secrets-znuJNv0F.js} +1 -1
  332. package/dist/client/assets/{use-section-preview-base-BN73lsUn.js → use-section-preview-base-CDeugTlj.js} +1 -1
  333. package/dist/client/assets/{use-tags-DDnWaRyr.js → use-tags-frFveynu.js} +1 -1
  334. package/dist/client/assets/{use-task-board-analytics-V9Yyqptm.js → use-task-board-analytics-BLvo5Ioy.js} +1 -1
  335. package/dist/client/assets/{use-task-board-events-DqUxpNCB.js → use-task-board-events-BNCUuZ7v.js} +1 -1
  336. package/dist/client/assets/{use-task-board-item-prs-DPUdXNI8.js → use-task-board-item-prs-C03gSLLs.js} +1 -1
  337. package/dist/client/assets/{use-task-board-items-DfmdtmUR.js → use-task-board-items-gTQZEpDz.js} +1 -1
  338. package/dist/client/assets/{use-task-metadata-SrtBAv_N.js → use-task-metadata-D3ZyQdu3.js} +1 -1
  339. package/dist/client/assets/{use-thread-analytics-BqRwNmrL.js → use-thread-analytics-pc4Cx2fq.js} +1 -1
  340. package/dist/client/assets/{use-thread-outputs-2RD7K4aK.js → use-thread-outputs-BwFYAN97.js} +1 -1
  341. package/dist/client/assets/useInfiniteQuery-Z8R3F4Sd.js +1 -0
  342. package/dist/client/assets/{useQueries-CMBL6J0M.js → useQueries-6AB3hL0G.js} +1 -1
  343. package/dist/client/assets/useSuspenseInfiniteQuery-CccYtrDO.js +1 -0
  344. package/dist/client/assets/{users-RLZYAcjM.js → users-DsZm3Nkx.js} +1 -1
  345. package/dist/client/assets/{utils-Bah7tk6F.js → utils-D-T02kS4.js} +1 -1
  346. package/dist/client/assets/{variant-calendar-BZG4h9lN.js → variant-calendar-DoUmbH6Q.js} +1 -1
  347. package/dist/client/assets/{variant-draft-pointer-DT29gOvh.js → variant-draft-pointer-CGTqYMj8.js} +1 -1
  348. package/dist/client/assets/{view-mode-toggle-yaAep4gO.js → view-mode-toggle-BM2WBWnv.js} +1 -1
  349. package/dist/client/assets/{virtual-mcp-D15uuHwT.js → virtual-mcp-CM_cNcV_.js} +1 -1
  350. package/dist/client/assets/{watch-sse-pool-L6MF8kFC.js → watch-sse-pool-C1f9T3Cq.js} +1 -1
  351. package/dist/client/index.html +1 -1
  352. package/dist/server/server.js +90 -90
  353. package/package.json +1 -1
  354. package/dist/client/assets/agent-app-Cfg8VckH.js +0 -1
  355. package/dist/client/assets/agent-deck-BQQbY7E3.js +0 -1
  356. package/dist/client/assets/agent-library-BylK2zbQ.js +0 -1
  357. package/dist/client/assets/agent-library-file-UJX_CJPE.js +0 -1
  358. package/dist/client/assets/agent-settings-CAn29x6c.js +0 -1
  359. package/dist/client/assets/agent-site-editor-code-BpIt4X2L.js +0 -2
  360. package/dist/client/assets/agent-site-editor-content-CvTjIocG.js +0 -1
  361. package/dist/client/assets/agent-site-editor-preview--T44KtQU.js +0 -1
  362. package/dist/client/assets/agent-view-DR2yinn0.js +0 -1
  363. package/dist/client/assets/api-keys-VLrtxsCT.js +0 -1
  364. package/dist/client/assets/cms-settings-editor-uacj7_T7.js +0 -1
  365. package/dist/client/assets/flat-project-ip4875AZ.js +0 -1
  366. package/dist/client/assets/library-Dlw_lQxg.js +0 -1
  367. package/dist/client/assets/project-reports-_eyjOX3a.js +0 -1
  368. package/dist/client/assets/project-tasks-CfNO6dF5.js +0 -1
  369. package/dist/client/assets/record-editor-BObs3Wz8.js +0 -1
  370. package/dist/client/assets/reports-CnLAzSP2.js +0 -1
  371. package/dist/client/assets/route-Bn0LVuA1.js +0 -1
  372. package/dist/client/assets/site-editor-CDgaCne6.js +0 -1
  373. package/dist/client/assets/taskboard-analytics-DVcpMrVf.js +0 -1
  374. package/dist/client/assets/tasks-DfBffVse.js +0 -1
  375. package/dist/client/assets/useInfiniteQuery-B6mFaUqW.js +0 -1
  376. package/dist/client/assets/useSuspenseInfiniteQuery-CPzW-hST.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-zQKRHCN0.js","assets/index-B-eHj4u4.js","assets/index-m9hX09uY.css","assets/chat-context-tvcXoBeE.js","assets/use-panel-navigate-CtG66pHN.js","assets/thread-route-BiZeKn-m.js","assets/use-project-scope-BIaj1klw.js","assets/repository-binding-CVI26IB4.js","assets/use-mcp-client-fHTUkiQr.js","assets/auth-3_xtjhZa.js","assets/autosend-Dqgiz7-z.js","assets/thread-intent-2PQ2tJ8y.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/watch-sse-pool-L6MF8kFC.js","assets/task-board-BDqVuMua.js","assets/schema-CYEVNkkO.js","assets/slugify-CEUa2lfQ.js","assets/use-decopilot-events-DrGKqtmd.js","assets/use-ai-providers-CrjK99NZ.js","assets/use-chat-navigation-BVwgk2mi.js","assets/location-BjlyegC2.js","assets/use-organization-settings-PcDKDabM.js","assets/blocks-tab-states-CUi2qvXH.js","assets/site-editor-toast-Rw5XomcC.js","assets/input-0NgdpVnI.js","assets/usage-stats-0IIA6wpa.js","assets/tool-namespace-XBvXTguD.js","assets/form-lTigv9Cm.js","assets/label-Hktokb9g.js","assets/utils-CVEq3hMx.js","assets/markdown-nIQQa0PZ.js","assets/use-copy-KuwVRxCe.js","assets/Copy01-BeZeYuYP.js","assets/ZoomOut-0IXFhA1q.js","assets/use-mobile-BZpAUwUb.js","assets/tooltip-Wg5TOkgk.js","assets/index-SEQedjDw.js","assets/agent-icon-E5NFjGaq.js","assets/AlertCircle-CxMEbIvM.js","assets/Tool01-Ceiq1yQg.js","assets/ArrowUp-BseWcDxZ.js","assets/ArrowLeft-ChZ5XGHH.js","assets/LinkBroken01-B4m_6hKA.js","assets/ShoppingBag01-B47bYriG.js","assets/Building02-BCzHZCeO.js","assets/CheckCircle-BRmDGKsS.js","assets/ChevronUp-B7Vn1Rb2.js","assets/ChevronSelectorVertical-DXUxjCek.js","assets/UserSquare-C1l8QNgE.js","assets/CreditCard01-CR3uiUwh.js","assets/DotsVertical-C85_hpnn.js","assets/Image01-BcbXjZdM.js","assets/Globe04-DTEEsJ26.js","assets/SwitchHorizontal01-B8pZTGji.js","assets/Key01-BnDtFdB6.js","assets/Link01-CeBVtW9F.js","assets/Monitor01-DluZDvx0.js","assets/Sun-BADHqp_z.js","assets/Play-C67yELx6.js","assets/Plus-FrFsiUQv.js","assets/SearchMd-CTE_Dij_.js","assets/Trash01-QaBoOmQD.js","assets/Upload01-CfxF6ZJF.js","assets/User01-DowUGIml.js","assets/Users01-BvAfz3hH.js","assets/XClose-CDVFbEme.js","assets/format-time-CAj8AQXM.js","assets/differenceInSeconds-C3x8sHUj.js","assets/icon-button-AZBqWvLN.js","assets/file-type-icon-hT5Dk06T.js","assets/shell-layout-jpc-IFbN.js","assets/avatar-D-6InH0Y.js","assets/use-clock-tick-B6NhSBfs.js","assets/command-CVodN_KO.js","assets/index-CWGftR7V.js","assets/integration-icon-DKhUl3mk.js","assets/project-icon-D9S8dOj2.js","assets/new-project-dialog-BiL8l-Gz.js","assets/repository-import-picker-Cv7ik8wr.js","assets/use-navigate-to-agent-CsnmgB4q.js","assets/repository-picker-CaK5oYjG.js","assets/useInfiniteQuery-B6mFaUqW.js","assets/infiniteQueryObserver-OMlvsWcf.js","assets/collection-search-BzGtQCoT.js","assets/use-debounced-value-B43T9Zwm.js","assets/required-auth-layout-BA_CRgc2.js","assets/use-org-sso-BrvNWA5X.js","assets/shell-layout-CE2Eihra.css","assets/chat-draft-ags4xou8.js","assets/select-Be8KEqhq.js","assets/index-BdQq_4o_.js","assets/tabs-Mabj7P4A.js","assets/use-deco-credits-BqmDR-Hh.js","assets/toggle-group-BRDgtYtL.js","assets/use-open-billing-url-DJ2g56mK.js","assets/index-C5owFjSB.js","assets/checkbox-C6deEGCR.js","assets/ai-providers-logos-DD3qZ33J.js","assets/popover-DrRqLOLZ.js","assets/drawer-CkTzw9-A.js","assets/input-CyiZQSl-.js","assets/suggestion-D6gjcmHp.js","assets/use-project-native-view-presence-BK8YOIZ_.js","assets/use-file-configs-bBTy3-MH.js","assets/site-slug-DebpOoQq.js","assets/use-mcp-prompts-BPRabyYT.js","assets/use-org-fs-zGIV3ymG.js","assets/question-004-sINsf4GQ.js","assets/use-members-CKWy7WEt.js","assets/use-org-auth-client-g30TuQtQ.js","assets/feature-paywall-D9khkBoZ.js","assets/plan-ladder-Bcai7E3A.js","assets/add-connection-dialog-CcwJwiyY.js","assets/extract-connection-data-B_Afz4nk.js","assets/metadata-D72DunRR.js","assets/connection-BzAtvzSu.js","assets/url-slug-CWeO_dvk.js","assets/connection-card-CuDjRvQM.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-Cu_mwrDc.js","assets/use-connection-D8Z-oNDI.js","assets/schema-DDS90txY.js","assets/connection-form-helpers-DX9VWFYw.js","assets/authenticate-and-persist-oauth-CLn5_4J6.js","assets/mcp-oauth-BDYmNGyy.js","assets/mcp-oauth-BFMHXWCx.js","assets/collection-tabs-D-985lbS.js","assets/badge-sJYWVYje.js","assets/use-infinite-scroll-Bx08szbZ.js","assets/useSuspenseInfiniteQuery-CPzW-hST.js","assets/use-task-board-events-DqUxpNCB.js","assets/input-Bwd_JSM8.css","assets/sandbox-url-D3mC8qhT.js","assets/utils-Bah7tk6F.js","assets/index-D19vbl6v.js","assets/pair-XFt8jz7C.js","assets/collapsible-DNW_6aVc.js","assets/content-blocks-o63cs2vh.js","assets/mcp-app-renderer-DJ3cRpmT.js","assets/types-C9g69UXw.js","assets/omit-sandbox-map-jj4lCB2U.js","assets/sheet-DcLd8f_T.js","assets/use-thread-outputs-2RD7K4aK.js","assets/sandbox-git-api-CRxdlhrN.js","assets/sandbox-start-errors-BK_aDCyt.js","assets/secret-ciphertext-DuXF1kfY.js","assets/alert-Dm5RN1oD.js","assets/switch-CkX0BpKj.js","assets/scroll-area-BxjOHUE0.js","assets/monaco-editor-CETdPqMD.js","assets/editor-CsrsRQNL.js","assets/calendar-CkQr_tH3.js","assets/editor-classes-DwfWTmoT.js","assets/core.esm-DD7e57Ya.js","assets/sortable.esm-Ch2zuqy4.js","assets/view-mode-toggle-yaAep4gO.js","assets/combobox-DH1NtP3D.js","assets/alert-dialog-BY83tkfe.js","assets/search-input-CEGrosU-.js","assets/asset-utils-DOMqsWw0.js","assets/empty-state-Ba3qMun8.js","assets/mustache-CkmSkLcC.js","assets/use-section-preview-base-BN73lsUn.js","assets/section-preview-url-7zfngvgW.js","assets/page-seo-form-hSczGRI6.js","assets/variant-draft-pointer-DT29gOvh.js"])))=>i.map(i=>d[i]);
2
- import{c as ne,j as s,r as S,l as Mt,b as _e,B as Xe,aF as $t,aY as Ye,aG as Ne,q as As,D as Os,K as Ds,s as Bs,v as Fs,e as Ir,h as gt,I as ns,w as Ur,aZ as Hr,a2 as yn,a_ as Vr,aX as qr,at as ss,av as rs,a5 as Wr,P as as,y as Gr,t as os,o as Jr,m as Yr}from"./index-B-eHj4u4.js";import{u as Ms,g as Qr,c as Xr,B as ln,P as Zr,r as ea,R as ta,a as na,b as $s,d as Ks,i as sa,S as ra,e as aa,f as oa,C as ia,h as la,j as ca,l as da,m as ua,p as fa,k as ma,n as cn,N as pa}from"./blocks-tab-states-CUi2qvXH.js";import{b as ha,c as It,r as zs,l as Is,f as ga,g as va,w as ba}from"./chat-context-tvcXoBeE.js";import{t as xa}from"./ChevronUp-B7Vn1Rb2.js";import{S as ya,T as wa,J as Us,U as ka,b as Sa,V as Pa,W as Ea,X as ja,Y as Na,Z as is,L as Ta}from"./agent-icon-E5NFjGaq.js";import{a as Ca}from"./UserSquare-C1l8QNgE.js";import{s as Ra}from"./Plus-FrFsiUQv.js";import{P as La,a as _a,b as Aa}from"./popover-DrRqLOLZ.js";import{a as mt,b as pt,c as Hs,d as Vs,e as qs,C as Ws}from"./command-CVodN_KO.js";import{c as Oa,a as Da}from"./repository-binding-CVI26IB4.js";import{b as wn}from"./sandbox-lifecycle-context-lyXe9eIS.js";import{e as Ba}from"./backoff-CrEUbyZT.js";import{f as Fa}from"./thread-intent-2PQ2tJ8y.js";import{a as Gs}from"./input-0NgdpVnI.js";import{S as Js,A as Ma,B as $a,C as Ka,F as za,G as Ia,H as Ua,I as Ha,u as kn,J as Sn,K as Ys,L as Va,M as qa,N as Wa,c as Ga,b as Qs,O as Ja,P as Qe,z as Ya,Q as Qa,R as Xa,U as Za,x as eo,V as ls,w as to,W as no,e as so}from"./site-editor-toast-Rw5XomcC.js";import{u as ro}from"./use-mobile-BZpAUwUb.js";import{c as dn,T as un,a as fn}from"./tooltip-Wg5TOkgk.js";import{T as ct}from"./toolbar-icon-button-CysTSWyH.js";import{b as ao,w as At,a as cs,i as oo}from"./variant-draft-pointer-DT29gOvh.js";import{d as io,s as lo,L as co,R as Kt,h as ds,N as uo,j as fo,k as ht,n as Pn,l as Xs,f as Fe,v as Zs,m as mo,o as po,q as ho,r as go,t as vo,u as us}from"./secret-ciphertext-DuXF1kfY.js";import{r as bo,D as fs,w as ms,b as ps,a as xo}from"./section-preview-url-7zfngvgW.js";import{u as yo}from"./use-fast-preview-draft-url-CWuWJF_Z.js";import{a as wo,c as er}from"./shell-layout-jpc-IFbN.js";import{u as tr,b as ko}from"./index-D19vbl6v.js";import{u as vn}from"./useQueries-CMBL6J0M.js";import{i as So}from"./LinkBroken01-B4m_6hKA.js";import{u as nr}from"./blocks-preview-workspace-context-JFuqyIhO.js";import{MonacoCodeEditor as Po}from"./monaco-editor-CETdPqMD.js";import{a as Eo}from"./utils-Bah7tk6F.js";import{R as hs,a as Ot,b as gs}from"./resizable-Bvs1DfKq.js";import{c as jo,a as mn}from"./use-project-native-view-presence-BK8YOIZ_.js";import{w as vs}from"./device-hint-SeLRi17j.js";import{r as No}from"./virtual-mcp-D15uuHwT.js";import{d as To}from"./delay-CnY5UFtP.js";import{E as Co}from"./empty-state-Ba3qMun8.js";import{G as bs}from"./repository-picker-CaK5oYjG.js";import{R as Ro}from"./repository-import-picker-Cv7ik8wr.js";import{r as Lo}from"./preview-source-BsRLGWUP.js";import{A as _o,a as Ao,b as Oo}from"./alert-Dm5RN1oD.js";import{u as Do}from"./use-task-metadata-SrtBAv_N.js";function Bo(t){const e=ne.c(10),{waiting:n}=t,r=n?"true":"false";let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("span",{className:"flex size-10 items-center justify-center rounded-xl bg-muted text-muted-foreground sm:size-12",children:s.jsx(ya,{className:"size-5 sm:size-6"})}),e[0]=i):i=e[0];let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("span",{className:"h-px w-full border-t border-dashed border-muted-foreground/40"}),e[1]=u):u=e[1];let a;e[2]!==n?(a=n&&s.jsx("span",{"data-testid":"connection-dot",className:"absolute top-0 size-2 animate-[connection-shuttle_1.8s_var(--ease-in-out-cubic)_infinite_alternate] rounded-full bg-foreground"}),e[2]=n,e[3]=a):a=e[3];let o;e[4]!==a?(o=s.jsxs("span",{className:"relative flex h-2 w-16 items-center sm:w-20",children:[u,a]}),e[4]=a,e[5]=o):o=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("span",{className:"flex size-10 items-center justify-center rounded-xl bg-muted text-muted-foreground sm:size-12",children:s.jsx(wa,{className:"size-5 sm:size-6"})}),e[6]=l):l=e[6];let d;return e[7]!==r||e[8]!==o?(d=s.jsxs("div",{"aria-hidden":"true","data-testid":"connection-wire","data-waiting":r,className:"flex items-center gap-2",children:[i,o,l]}),e[7]=r,e[8]=o,e[9]=d):d=e[9],d}function Fo(t){const e=ne.c(25),{index:n,numbered:r,step:i,heading:u}=t,a=S.useId();let o;e[0]!==n||e[1]!==r?(o=r&&s.jsx("span",{"aria-hidden":"true",className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium tabular-nums text-foreground",children:n}),e[0]=n,e[1]=r,e[2]=o):o=e[2];let l;e[3]!==u||e[4]!==a||e[5]!==i.title?(l=s.jsx(u,{id:a,className:"text-sm font-medium text-foreground",children:i.title}),e[3]=u,e[4]=a,e[5]=i.title,e[6]=l):l=e[6];let d;e[7]!==o||e[8]!==l?(d=s.jsxs("div",{className:"flex items-center gap-3",children:[o,l]}),e[7]=o,e[8]=l,e[9]=d):d=e[9];const p=r&&"sm:pl-9";let m;e[10]!==p?(m=Mt("flex min-w-0 flex-col gap-3",p),e[10]=p,e[11]=m):m=e[11];let f;e[12]!==i.body?(f=i.body&&s.jsx("p",{className:"text-sm text-muted-foreground",children:i.body}),e[12]=i.body,e[13]=f):f=e[13];let x;e[14]!==i.command?(x=i.command&&s.jsx(io,{command:i.command}),e[14]=i.command,e[15]=x):x=e[15];let v;e[16]!==i.after||e[17]!==m||e[18]!==f||e[19]!==x?(v=s.jsxs("div",{className:m,children:[f,x,i.after]}),e[16]=i.after,e[17]=m,e[18]=f,e[19]=x,e[20]=v):v=e[20];let E;return e[21]!==a||e[22]!==d||e[23]!==v?(E=s.jsxs("li",{"aria-labelledby":a,className:"surface flex flex-col gap-3 p-4 sm:p-5",children:[d,v]}),e[21]=a,e[22]=d,e[23]=v,e[24]=E):E=e[24],E}const Mo=[];function zt(t){const e=ne.c(20),{title:n,lead:r,waiting:i,alerts:u,steps:a,footer:o,headingLevel:l}=t,d=a===void 0?Mo:a,p=l===void 0?1:l,m=p===1?"h1":"h2",f=i&&d.length===0?"status":void 0;let x;e[0]!==i?(x=s.jsx(Bo,{waiting:i}),e[0]=i,e[1]=x):x=e[1];let v;e[2]!==m||e[3]!==n?(v=s.jsx(m,{tabIndex:-1,className:"text-balance text-lg font-medium text-foreground outline-none sm:text-xl",children:n}),e[2]=m,e[3]=n,e[4]=v):v=e[4];let E;e[5]!==r?(E=r&&s.jsx("p",{className:"text-pretty text-sm text-muted-foreground",children:r}),e[5]=r,e[6]=E):E=e[6];let g;e[7]!==f||e[8]!==x||e[9]!==v||e[10]!==E?(g=s.jsxs("header",{role:f,className:"flex flex-col items-center gap-3 text-center",children:[x,v,E]}),e[7]=f,e[8]=x,e[9]=v,e[10]=E,e[11]=g):g=e[11];let k;e[12]!==p||e[13]!==d?(k=d.length>0&&s.jsx("ol",{className:"flex flex-col gap-3",children:d.map((y,b)=>s.jsx(Fo,{index:b+1,numbered:d.length>1,step:y,heading:p===1?"h2":"h3"},y.title))}),e[12]=p,e[13]=d,e[14]=k):k=e[14];let j;return e[15]!==u||e[16]!==o||e[17]!==g||e[18]!==k?(j=s.jsx("div",{className:"h-full w-full overflow-y-auto",children:s.jsxs("div",{className:"mx-auto flex min-h-full w-full max-w-xl flex-col justify-center gap-6 px-4 py-8 sm:py-12",children:[g,u,k,o]})}),e[15]=u,e[16]=o,e[17]=g,e[18]=k,e[19]=j):j=e[19],j}function $o(t){const e=ne.c(55),{wait:n,hosts:r,invalidLink:i}=t,u=i===void 0?!1:i,a=_e();let o;e[0]!==u||e[1]!==a?(o=u&&s.jsx(_o,{variant:"warning",children:s.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[s.jsx(Ao,{className:"line-clamp-none text-foreground",children:a("decoServe.link.invalidTitle")}),s.jsx(Oo,{children:a("decoServe.link.invalidBody")})]})}),e[0]=u,e[1]=a,e[2]=o):o=e[2];const l=o;if(n.kind==="problem"){let B;e[3]!==a||e[4]!==n.host||e[5]!==n.problem?(B=lo(a,n.problem,n.host),e[3]=a,e[4]=n.host,e[5]=n.problem,e[6]=B):B=e[6];const{title:R,body:D}=B;let O;e[7]!==D?(O=s.jsx(Kt,{text:D}),e[7]=D,e[8]=O):O=e[8];let F;e[9]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(ds,{className:"border-t border-border pt-4",links:["troubleshooting","serve"]}),e[9]=F):F=e[9];let _;return e[10]!==l||e[11]!==O||e[12]!==R?(_=s.jsx(zt,{headingLevel:2,waiting:!1,title:R,lead:O,alerts:l,footer:F}),e[10]=l,e[11]=O,e[12]=R,e[13]=_):_=e[13],_}const d=n.kind==="looking",p=d&&!n.paused;let m;e[14]!==a?(m=a("decoServe.waiting.title"),e[14]=a,e[15]=m):m=e[15];let f;e[16]!==a?(f=a("decoServe.waiting.lead"),e[16]=a,e[17]=f):f=e[17];let x;e[18]!==l||e[19]!==n.kind?(x=(l||n.kind==="denied")&&s.jsxs(s.Fragment,{children:[l,n.kind==="denied"&&s.jsx(co,{})]}),e[18]=l,e[19]=n.kind,e[20]=x):x=e[20];let v;e[21]!==a?(v=a("decoServe.guide.step1.title"),e[21]=a,e[22]=v):v=e[22];let E;e[23]!==a?(E=a("decoServe.guide.step1.body"),e[23]=a,e[24]=E):E=e[24];let g;e[25]!==E?(g=s.jsx(Kt,{text:E}),e[25]=E,e[26]=g):g=e[26];let k;e[27]!==v||e[28]!==g?(k={title:v,body:g,command:Js},e[27]=v,e[28]=g,e[29]=k):k=e[29];let j;e[30]!==a?(j=a("decoServe.waiting.step2.title"),e[30]=a,e[31]=j):j=e[31];let y;e[32]!==a?(y=a("decoServe.waiting.step2.body"),e[32]=a,e[33]=y):y=e[33];let b;e[34]!==r||e[35]!==d||e[36]!==a||e[37]!==n.kind||e[38]!==n.onStart||e[39]!==n.paused?(b=n.kind==="needs-gesture"?s.jsx(Xe,{variant:"outline",className:"self-start",onClick:n.onStart,children:a("decoServe.guide.step2.start")}):d&&s.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:n.paused?a("decoServe.guide.step2.paused"):a("decoServe.guide.step2.looking",{hosts:r})}),e[34]=r,e[35]=d,e[36]=a,e[37]=n.kind,e[38]=n.onStart,e[39]=n.paused,e[40]=b):b=e[40];let w;e[41]!==j||e[42]!==y||e[43]!==b?(w={title:j,body:y,after:b},e[41]=j,e[42]=y,e[43]=b,e[44]=w):w=e[44];let T;e[45]!==k||e[46]!==w?(T=[k,w],e[45]=k,e[46]=w,e[47]=T):T=e[47];let P;e[48]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(ds,{className:"border-t border-border pt-4",links:["siteEditor","serve","troubleshooting"]}),e[48]=P):P=e[48];let N;return e[49]!==T||e[50]!==p||e[51]!==m||e[52]!==f||e[53]!==x?(N=s.jsx(zt,{headingLevel:2,waiting:p,title:m,lead:f,alerts:x,steps:T,footer:P}),e[49]=T,e[50]=p,e[51]=m,e[52]=f,e[53]=x,e[54]=N):N=e[54],N}function Ko(t,e){switch(t.kind){case"needs-permission":return{kind:"denied"};case"problem":return{kind:"problem",problem:t.problem,host:e};default:return{kind:"looking"}}}const zo=15e3,Io=3e3;function Uo(t){const{candidates:e,probe:n,onFound:r,onChange:i,doc:u=document,setTimer:a=(b,w)=>setTimeout(b,w),clearTimer:o=b=>clearTimeout(b),timeoutMs:l=Io}=t;let d={status:"searching",firstRoundDone:!1,problem:null},p=!1,m=!1,f=0,x=null,v=null;const E=()=>u.visibilityState==="hidden",g=b=>{d={...d,...b},i(d)},k=async b=>{v=new AbortController;const w=v,T=a(()=>w.abort(),l);try{return await n(b,w.signal),!0}catch(P){if(p)return!1;const N=$a(P);return N.reason!=="not-answering"?g({problem:{...N,endpoint:b}}):d.problem?.endpoint===b&&g({problem:null}),!1}finally{o(T),v=null}},j=async()=>{if(x=null,!(p||m)){if(e.length===0){g({status:"stopped",firstRoundDone:!0});return}if(E()){g({status:"paused"});return}m=!0,d.status!=="searching"&&g({status:"searching"});for(const b of e){if(p)break;if(await k(b)){if(m=!1,p)return;p=!0,u.removeEventListener("visibilitychange",y),g({status:"found",firstRoundDone:!0}),r(b);return}}if(m=!1,!p){if(f+=1,d.firstRoundDone||g({firstRoundDone:!0}),E()){g({status:"paused"});return}x=a(()=>{j()},Ma(f,zo))}}};function y(){if(!p){if(E()){x!==null&&(o(x),x=null),m||g({status:"paused"});return}x!==null&&o(x),f=0,j()}}return u.addEventListener("visibilitychange",y),i(d),j(),()=>{p=!0,x!==null&&o(x),v?.abort(),u.removeEventListener("visibilitychange",y)}}function Ho(t,e){return za(Ia({endpoint:t,fetch:n=>fetch(n,{signal:e})}))}const Vo=["loopback-network","local-network-access"];async function qo(){if(Ka(window.location.origin))return null;for(const t of Vo)try{return await navigator.permissions.query({name:t})}catch{}return null}let sr=null,xs=!1;const pn=new Set;function Wo(t){if(pn.add(t),!xs){xs=!0;const e=n=>{sr=n;for(const r of pn)r()};qo().then(n=>{if(!n)return e("unsupported");e(n.state),n.addEventListener("change",()=>e(n.state))})}return()=>pn.delete(t)}const Go={status:"stopped",firstRoundDone:!1,problem:null},hn=new Map;function Jo(t){const e=hn.get(t);if(e)return e;let n={status:"searching",firstRoundDone:!1,problem:null};const r=new Set;let i=null;const u={onFound:()=>{},getSnapshot:()=>n,subscribe:a=>(r.add(a),i??=Uo({candidates:t.split(" "),probe:Ho,onFound:o=>u.onFound(o),onChange:o=>{n=o;for(const l of r)l()}}),()=>{r.delete(a),!(r.size>0)&&(i?.(),i=null,hn.delete(t))})};return hn.set(t,u),u}function rr(){return S.useSyncExternalStore(Wo,ws,ws)}const Yo=()=>()=>{},ys=()=>Go,ws=()=>sr;function Sc(t){const e=ne.c(9),{candidates:n,onFound:r}=t,[i,u]=S.useState(!1),a=rr(),l=(a==="granted"||a==="unsupported"||a==="prompt"&&i)&&n.length>0;let d;e[0]!==l||e[1]!==n||e[2]!==r?(d=l?Jo(n.join(" ")):null,d&&(d.onFound=r),e[0]=l,e[1]=n,e[2]=r,e[3]=d):d=e[3];const p=S.useSyncExternalStore(d?.subscribe??Yo,d?.getSnapshot??ys,d?.getSnapshot??ys),m=a==="prompt"&&!i;let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=()=>u(!0),e[4]=f):f=e[4];let x;return e[5]!==a||e[6]!==p||e[7]!==m?(x={state:p,access:a,needsGesture:m,start:f},e[5]=a,e[6]=p,e[7]=m,e[8]=x):x=e[8],x}const ks={mode:"none",iframeBase:null,showBlockingOverlay:!1,showWakingPill:!1};function Qo(t){const{previewState:e,progressStatus:n,fastPreviewActive:r=!1,fastPreviewReady:i=!1,codingSession:u=!1,hostedDraft:a=!1}=t,o=u?null:t.previewServerUrl;return t.deciding?{...ks,showDecidingLoader:!0}:t.localPreviewUrl?{mode:"sandbox",iframeBase:t.localPreviewUrl,showBlockingOverlay:!1,showWakingPill:!1}:e.kind==="suspended"||e.kind==="errored"?ks:r&&i&&o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!1}:r&&a&&o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!1}:!r&&e.kind==="iframe"&&n!=="doing"?{mode:"sandbox",iframeBase:e.previewUrl,showBlockingOverlay:!1,showWakingPill:!1}:o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!0}:{mode:"none",iframeBase:null,showBlockingOverlay:!0,showWakingPill:!1}}const Xo=1e4,Zo=1e3,ei=3e4;function ti({iframeRef:t,src:e,active:n}){const r=S.useRef(0),i=S.useRef(null),u=S.useRef(null),a=S.useRef(e),o=S.useRef(n);a.current=e,o.current=n;const l=()=>{i.current&&clearTimeout(i.current),u.current&&clearTimeout(u.current),i.current=null,u.current=null},d=()=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,p()},Xo)},p=()=>{if(!o.current||!a.current)return;u.current&&clearTimeout(u.current);const x=Ba(ei,Zo,r.current,2,.5);r.current+=1,u.current=setTimeout(()=>{u.current=null;const v=t.current,E=a.current;!v||!E||!o.current||(v.src=E,d())},x)},m=()=>{r.current=0,l()},f=()=>{i.current&&(clearTimeout(i.current),i.current=null),p()};return S.useEffect(()=>{if(l(),r.current=0,!(!n||!e))return d(),l},[e,n]),{handleLoad:m,handleError:f}}const ni=1500,si=500;function ri({iframe:t,reload:e,waitMs:n=ni,confirmMs:r=si}){let i;const u=()=>{clearTimeout(a),i=setTimeout(e,r)};t.addEventListener("load",u,{once:!0});const a=setTimeout(()=>{t.removeEventListener("load",u),e()},n);return()=>{clearTimeout(a),clearTimeout(i),t.removeEventListener("load",u)}}const ai=$t({tag:Ne(),id:Ne(),classes:Ne(),text:Ne(),html:Ne(),manifestKey:Ne().nullable(),componentName:Ne().nullable(),parents:Ne(),url:Ne(),path:Ne(),viewport:$t({width:Ye(),height:Ye()}),position:$t({x:Ye(),y:Ye()})}),oi=`(function() {
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-DrdT1MI7.js","assets/index-BlWeDA0T.js","assets/index-m9hX09uY.css","assets/chat-context-CKK4nwlA.js","assets/use-panel-navigate-C2cHRlDL.js","assets/thread-route-CW7xmu6G.js","assets/use-project-scope-BROCSZWk.js","assets/repository-binding-Ds0zXEVH.js","assets/use-mcp-client-B333X4fs.js","assets/auth-d1Zn25hw.js","assets/autosend-DkgNxXhw.js","assets/thread-intent-9GHukD-s.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/watch-sse-pool-C1f9T3Cq.js","assets/task-board-C00mxWAh.js","assets/schema-DO5D2eCO.js","assets/slugify-CEUa2lfQ.js","assets/use-decopilot-events-Bd-4vex6.js","assets/use-ai-providers-BWqKJRmf.js","assets/use-chat-navigation-CmNsxQBq.js","assets/location-BjlyegC2.js","assets/use-organization-settings-DxTssZLI.js","assets/blocks-tab-states-Dgf9O_BB.js","assets/site-editor-toast-B6rO5nP0.js","assets/input-3uLsKqBB.js","assets/usage-stats-2c6yVTyC.js","assets/tool-namespace-Cu-DNTic.js","assets/form-DDdiF5DN.js","assets/label-CCf767lm.js","assets/utils-CVEq3hMx.js","assets/markdown-BRIlR7nZ.js","assets/use-copy-_ycKA-XN.js","assets/Copy01-BrqDGrTX.js","assets/ZoomOut-BpMDqvoU.js","assets/use-mobile-hkvDmO1w.js","assets/tooltip-B6W7NpVz.js","assets/index-DrHP_BcE.js","assets/agent-icon-Cwi3uRdu.js","assets/AlertCircle-BugQG9bV.js","assets/Tool01-BYtrXXg0.js","assets/ArrowUp-BM60-fZY.js","assets/ArrowLeft-BsOtfvqw.js","assets/LinkBroken01-D4fcNp0y.js","assets/ShoppingBag01-FE4oAEwY.js","assets/Building02-DqK4SREZ.js","assets/CheckCircle-DIUFnJQp.js","assets/ChevronUp-C9gm2RHA.js","assets/ChevronSelectorVertical-CRMiEVEY.js","assets/UserSquare-B3hi5v4G.js","assets/CreditCard01-C7MhbtAI.js","assets/DotsVertical-DjBJNxxU.js","assets/Image01-LmX-9DTg.js","assets/Globe04-Bi1qDXFD.js","assets/SwitchHorizontal01-BLoNOmQx.js","assets/Key01-D7fc2of0.js","assets/Link01-UOxGnkqg.js","assets/Monitor01-zCUpqs5C.js","assets/Sun-lUDK8Dny.js","assets/Play-BaMMHzUS.js","assets/Plus-DBwsZRbL.js","assets/SearchMd-Cz9CjV4u.js","assets/Trash01-DmGIq4LE.js","assets/Upload01-B1KubIEG.js","assets/User01-DxYW6D1x.js","assets/Users01-Dg9yGM1q.js","assets/XClose-D_NlSxSm.js","assets/format-time-CAj8AQXM.js","assets/differenceInSeconds-C3x8sHUj.js","assets/icon-button-DfjCa6Mk.js","assets/file-type-icon-C2mdy7vI.js","assets/shell-layout-xMF7zZJW.js","assets/avatar-Bp-EkB-V.js","assets/use-clock-tick-B2MqiplU.js","assets/command-D2C8egnH.js","assets/index-BHzdhQYD.js","assets/integration-icon-BRfynNZ5.js","assets/project-icon-CJp8KUWK.js","assets/new-project-dialog-D9WaXvgl.js","assets/repository-import-picker-CJrt2Qyf.js","assets/use-navigate-to-agent-Dzg43OKn.js","assets/repository-picker-DoUZKYGY.js","assets/useInfiniteQuery-Z8R3F4Sd.js","assets/infiniteQueryObserver-C9osZa8h.js","assets/collection-search-mDMHjO22.js","assets/use-debounced-value-ByyoTH63.js","assets/required-auth-layout-CoQlG-uh.js","assets/use-org-sso-CH28wOEA.js","assets/shell-layout-CE2Eihra.css","assets/chat-draft-BMAMpVi3.js","assets/select-B54nmexC.js","assets/index-BdQq_4o_.js","assets/tabs-CtKgNHMr.js","assets/use-deco-credits-CT_j_qxS.js","assets/toggle-group-BLxmrLuD.js","assets/use-open-billing-url-DJYL8W0U.js","assets/index-sLNiMwXT.js","assets/checkbox-Dwjm_TLd.js","assets/ai-providers-logos-DD3qZ33J.js","assets/popover-C86-20Mm.js","assets/drawer-C7TJoqXz.js","assets/input-BSKhVE-B.js","assets/suggestion-DjstHMLc.js","assets/use-project-native-view-presence-bO2szMt1.js","assets/use-file-configs-DgLGloNq.js","assets/site-slug-DebpOoQq.js","assets/use-mcp-prompts-P2KMjN9W.js","assets/use-org-fs-D6VAaLCr.js","assets/question-004-sINsf4GQ.js","assets/use-members-DfdZqgw8.js","assets/use-org-auth-client-DROvF2zH.js","assets/feature-paywall-DXx7v-jJ.js","assets/plan-ladder-DRlbA6Oe.js","assets/add-connection-dialog-lyugU_mj.js","assets/extract-connection-data-B2gWRdBp.js","assets/metadata-D72DunRR.js","assets/connection-CXmYeQRu.js","assets/url-slug-CCgQongS.js","assets/connection-card-BnbrpDH3.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-BLu1V32o.js","assets/use-connection-BDpvwZcn.js","assets/schema-D-34ICTJ.js","assets/connection-form-helpers-a4JD1Ns8.js","assets/authenticate-and-persist-oauth-p8iXxMbw.js","assets/mcp-oauth-Wpa3RhmZ.js","assets/mcp-oauth-CbRV1ySf.js","assets/collection-tabs-C8f6Only.js","assets/badge-BIePf0xK.js","assets/use-infinite-scroll-F7T2FF-S.js","assets/useSuspenseInfiniteQuery-CccYtrDO.js","assets/use-task-board-events-BNCUuZ7v.js","assets/input-Bwd_JSM8.css","assets/sandbox-url-D3mC8qhT.js","assets/utils-D-T02kS4.js","assets/index-BVXKUS4M.js","assets/pair-Boroas12.js","assets/collapsible-BEHE2idT.js","assets/content-blocks-o63cs2vh.js","assets/mcp-app-renderer-BdWVQtZT.js","assets/types-C4NGZqb0.js","assets/omit-sandbox-map-jj4lCB2U.js","assets/sheet-2W5SODwA.js","assets/use-thread-outputs-BwFYAN97.js","assets/sandbox-git-api-CRxdlhrN.js","assets/sandbox-start-errors-BK_aDCyt.js","assets/secret-ciphertext-B8vjXVJK.js","assets/alert-DD0xrZ6s.js","assets/switch-ZvhKKFCY.js","assets/scroll-area-BjUjV0Z5.js","assets/monaco-editor-CGec7a_K.js","assets/editor-r9_MTJH5.js","assets/calendar-BnpyhDmY.js","assets/editor-classes-B9HFPeRc.js","assets/core.esm-D0fLNP6n.js","assets/sortable.esm-B1VIDqmY.js","assets/view-mode-toggle-BM2WBWnv.js","assets/combobox-DsvKNdY8.js","assets/alert-dialog-Cww2cCKj.js","assets/search-input-BaljBVL8.js","assets/asset-utils-B7vSk_IG.js","assets/empty-state-ChkfcEnf.js","assets/mustache-CwHM8aj-.js","assets/use-section-preview-base-CDeugTlj.js","assets/section-preview-url-7zfngvgW.js","assets/page-seo-form-DobjM56n.js","assets/variant-draft-pointer-CGTqYMj8.js"])))=>i.map(i=>d[i]);
2
+ import{c as ne,j as s,r as S,l as Mt,b as _e,B as Xe,aF as $t,aY as Ye,aG as Ne,q as As,D as Os,K as Ds,s as Bs,v as Fs,e as Ir,h as gt,I as ns,w as Ur,aZ as Hr,a2 as yn,a_ as Vr,aX as qr,at as ss,av as rs,a5 as Wr,P as as,y as Gr,t as os,o as Jr,m as Yr}from"./index-BlWeDA0T.js";import{u as Ms,g as Qr,c as Xr,B as ln,P as Zr,r as ea,R as ta,a as na,b as $s,d as Ks,i as sa,S as ra,e as aa,f as oa,C as ia,h as la,j as ca,l as da,m as ua,p as fa,k as ma,n as cn,N as pa}from"./blocks-tab-states-Dgf9O_BB.js";import{b as ha,c as It,r as zs,l as Is,f as ga,g as va,w as ba}from"./chat-context-CKK4nwlA.js";import{t as xa}from"./ChevronUp-C9gm2RHA.js";import{S as ya,T as wa,J as Us,U as ka,b as Sa,V as Pa,W as Ea,X as ja,Y as Na,Z as is,L as Ta}from"./agent-icon-Cwi3uRdu.js";import{a as Ca}from"./UserSquare-B3hi5v4G.js";import{s as Ra}from"./Plus-DBwsZRbL.js";import{P as La,a as _a,b as Aa}from"./popover-C86-20Mm.js";import{a as mt,b as pt,c as Hs,d as Vs,e as qs,C as Ws}from"./command-D2C8egnH.js";import{c as Oa,a as Da}from"./repository-binding-Ds0zXEVH.js";import{b as wn}from"./sandbox-lifecycle-context-DHjDdwbp.js";import{e as Ba}from"./backoff-CrEUbyZT.js";import{f as Fa}from"./thread-intent-9GHukD-s.js";import{a as Gs}from"./input-3uLsKqBB.js";import{S as Js,A as Ma,B as $a,C as Ka,F as za,G as Ia,H as Ua,I as Ha,u as kn,J as Sn,K as Ys,L as Va,M as qa,N as Wa,c as Ga,b as Qs,O as Ja,P as Qe,z as Ya,Q as Qa,R as Xa,U as Za,x as eo,V as ls,w as to,W as no,e as so}from"./site-editor-toast-B6rO5nP0.js";import{u as ro}from"./use-mobile-hkvDmO1w.js";import{c as dn,T as un,a as fn}from"./tooltip-B6W7NpVz.js";import{T as ct}from"./toolbar-icon-button-670IDOJM.js";import{b as ao,w as At,a as cs,i as oo}from"./variant-draft-pointer-CGTqYMj8.js";import{d as io,s as lo,L as co,R as Kt,h as ds,N as uo,j as fo,k as ht,n as Pn,l as Xs,f as Fe,v as Zs,m as mo,o as po,q as ho,r as go,t as vo,u as us}from"./secret-ciphertext-B8vjXVJK.js";import{r as bo,D as fs,w as ms,b as ps,a as xo}from"./section-preview-url-7zfngvgW.js";import{u as yo}from"./use-fast-preview-draft-url-DZRNnF9t.js";import{a as wo,c as er}from"./shell-layout-xMF7zZJW.js";import{u as tr,b as ko}from"./index-BVXKUS4M.js";import{u as vn}from"./useQueries-6AB3hL0G.js";import{i as So}from"./LinkBroken01-D4fcNp0y.js";import{u as nr}from"./blocks-preview-workspace-context-CVDMxLIY.js";import{MonacoCodeEditor as Po}from"./monaco-editor-CGec7a_K.js";import{a as Eo}from"./utils-D-T02kS4.js";import{R as hs,a as Ot,b as gs}from"./resizable-Bu_8_8YG.js";import{c as jo,a as mn}from"./use-project-native-view-presence-bO2szMt1.js";import{w as vs}from"./device-hint-SeLRi17j.js";import{r as No}from"./virtual-mcp-CM_cNcV_.js";import{d as To}from"./delay-CnY5UFtP.js";import{E as Co}from"./empty-state-ChkfcEnf.js";import{G as bs}from"./repository-picker-DoUZKYGY.js";import{R as Ro}from"./repository-import-picker-CJrt2Qyf.js";import{r as Lo}from"./preview-source-BsRLGWUP.js";import{A as _o,a as Ao,b as Oo}from"./alert-DD0xrZ6s.js";import{u as Do}from"./use-task-metadata-D3ZyQdu3.js";function Bo(t){const e=ne.c(10),{waiting:n}=t,r=n?"true":"false";let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("span",{className:"flex size-10 items-center justify-center rounded-xl bg-muted text-muted-foreground sm:size-12",children:s.jsx(ya,{className:"size-5 sm:size-6"})}),e[0]=i):i=e[0];let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("span",{className:"h-px w-full border-t border-dashed border-muted-foreground/40"}),e[1]=u):u=e[1];let a;e[2]!==n?(a=n&&s.jsx("span",{"data-testid":"connection-dot",className:"absolute top-0 size-2 animate-[connection-shuttle_1.8s_var(--ease-in-out-cubic)_infinite_alternate] rounded-full bg-foreground"}),e[2]=n,e[3]=a):a=e[3];let o;e[4]!==a?(o=s.jsxs("span",{className:"relative flex h-2 w-16 items-center sm:w-20",children:[u,a]}),e[4]=a,e[5]=o):o=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("span",{className:"flex size-10 items-center justify-center rounded-xl bg-muted text-muted-foreground sm:size-12",children:s.jsx(wa,{className:"size-5 sm:size-6"})}),e[6]=l):l=e[6];let d;return e[7]!==r||e[8]!==o?(d=s.jsxs("div",{"aria-hidden":"true","data-testid":"connection-wire","data-waiting":r,className:"flex items-center gap-2",children:[i,o,l]}),e[7]=r,e[8]=o,e[9]=d):d=e[9],d}function Fo(t){const e=ne.c(25),{index:n,numbered:r,step:i,heading:u}=t,a=S.useId();let o;e[0]!==n||e[1]!==r?(o=r&&s.jsx("span",{"aria-hidden":"true",className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium tabular-nums text-foreground",children:n}),e[0]=n,e[1]=r,e[2]=o):o=e[2];let l;e[3]!==u||e[4]!==a||e[5]!==i.title?(l=s.jsx(u,{id:a,className:"text-sm font-medium text-foreground",children:i.title}),e[3]=u,e[4]=a,e[5]=i.title,e[6]=l):l=e[6];let d;e[7]!==o||e[8]!==l?(d=s.jsxs("div",{className:"flex items-center gap-3",children:[o,l]}),e[7]=o,e[8]=l,e[9]=d):d=e[9];const p=r&&"sm:pl-9";let m;e[10]!==p?(m=Mt("flex min-w-0 flex-col gap-3",p),e[10]=p,e[11]=m):m=e[11];let f;e[12]!==i.body?(f=i.body&&s.jsx("p",{className:"text-sm text-muted-foreground",children:i.body}),e[12]=i.body,e[13]=f):f=e[13];let x;e[14]!==i.command?(x=i.command&&s.jsx(io,{command:i.command}),e[14]=i.command,e[15]=x):x=e[15];let v;e[16]!==i.after||e[17]!==m||e[18]!==f||e[19]!==x?(v=s.jsxs("div",{className:m,children:[f,x,i.after]}),e[16]=i.after,e[17]=m,e[18]=f,e[19]=x,e[20]=v):v=e[20];let E;return e[21]!==a||e[22]!==d||e[23]!==v?(E=s.jsxs("li",{"aria-labelledby":a,className:"surface flex flex-col gap-3 p-4 sm:p-5",children:[d,v]}),e[21]=a,e[22]=d,e[23]=v,e[24]=E):E=e[24],E}const Mo=[];function zt(t){const e=ne.c(20),{title:n,lead:r,waiting:i,alerts:u,steps:a,footer:o,headingLevel:l}=t,d=a===void 0?Mo:a,p=l===void 0?1:l,m=p===1?"h1":"h2",f=i&&d.length===0?"status":void 0;let x;e[0]!==i?(x=s.jsx(Bo,{waiting:i}),e[0]=i,e[1]=x):x=e[1];let v;e[2]!==m||e[3]!==n?(v=s.jsx(m,{tabIndex:-1,className:"text-balance text-lg font-medium text-foreground outline-none sm:text-xl",children:n}),e[2]=m,e[3]=n,e[4]=v):v=e[4];let E;e[5]!==r?(E=r&&s.jsx("p",{className:"text-pretty text-sm text-muted-foreground",children:r}),e[5]=r,e[6]=E):E=e[6];let g;e[7]!==f||e[8]!==x||e[9]!==v||e[10]!==E?(g=s.jsxs("header",{role:f,className:"flex flex-col items-center gap-3 text-center",children:[x,v,E]}),e[7]=f,e[8]=x,e[9]=v,e[10]=E,e[11]=g):g=e[11];let k;e[12]!==p||e[13]!==d?(k=d.length>0&&s.jsx("ol",{className:"flex flex-col gap-3",children:d.map((y,b)=>s.jsx(Fo,{index:b+1,numbered:d.length>1,step:y,heading:p===1?"h2":"h3"},y.title))}),e[12]=p,e[13]=d,e[14]=k):k=e[14];let j;return e[15]!==u||e[16]!==o||e[17]!==g||e[18]!==k?(j=s.jsx("div",{className:"h-full w-full overflow-y-auto",children:s.jsxs("div",{className:"mx-auto flex min-h-full w-full max-w-xl flex-col justify-center gap-6 px-4 py-8 sm:py-12",children:[g,u,k,o]})}),e[15]=u,e[16]=o,e[17]=g,e[18]=k,e[19]=j):j=e[19],j}function $o(t){const e=ne.c(55),{wait:n,hosts:r,invalidLink:i}=t,u=i===void 0?!1:i,a=_e();let o;e[0]!==u||e[1]!==a?(o=u&&s.jsx(_o,{variant:"warning",children:s.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[s.jsx(Ao,{className:"line-clamp-none text-foreground",children:a("decoServe.link.invalidTitle")}),s.jsx(Oo,{children:a("decoServe.link.invalidBody")})]})}),e[0]=u,e[1]=a,e[2]=o):o=e[2];const l=o;if(n.kind==="problem"){let B;e[3]!==a||e[4]!==n.host||e[5]!==n.problem?(B=lo(a,n.problem,n.host),e[3]=a,e[4]=n.host,e[5]=n.problem,e[6]=B):B=e[6];const{title:R,body:D}=B;let O;e[7]!==D?(O=s.jsx(Kt,{text:D}),e[7]=D,e[8]=O):O=e[8];let F;e[9]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(ds,{className:"border-t border-border pt-4",links:["troubleshooting","serve"]}),e[9]=F):F=e[9];let _;return e[10]!==l||e[11]!==O||e[12]!==R?(_=s.jsx(zt,{headingLevel:2,waiting:!1,title:R,lead:O,alerts:l,footer:F}),e[10]=l,e[11]=O,e[12]=R,e[13]=_):_=e[13],_}const d=n.kind==="looking",p=d&&!n.paused;let m;e[14]!==a?(m=a("decoServe.waiting.title"),e[14]=a,e[15]=m):m=e[15];let f;e[16]!==a?(f=a("decoServe.waiting.lead"),e[16]=a,e[17]=f):f=e[17];let x;e[18]!==l||e[19]!==n.kind?(x=(l||n.kind==="denied")&&s.jsxs(s.Fragment,{children:[l,n.kind==="denied"&&s.jsx(co,{})]}),e[18]=l,e[19]=n.kind,e[20]=x):x=e[20];let v;e[21]!==a?(v=a("decoServe.guide.step1.title"),e[21]=a,e[22]=v):v=e[22];let E;e[23]!==a?(E=a("decoServe.guide.step1.body"),e[23]=a,e[24]=E):E=e[24];let g;e[25]!==E?(g=s.jsx(Kt,{text:E}),e[25]=E,e[26]=g):g=e[26];let k;e[27]!==v||e[28]!==g?(k={title:v,body:g,command:Js},e[27]=v,e[28]=g,e[29]=k):k=e[29];let j;e[30]!==a?(j=a("decoServe.waiting.step2.title"),e[30]=a,e[31]=j):j=e[31];let y;e[32]!==a?(y=a("decoServe.waiting.step2.body"),e[32]=a,e[33]=y):y=e[33];let b;e[34]!==r||e[35]!==d||e[36]!==a||e[37]!==n.kind||e[38]!==n.onStart||e[39]!==n.paused?(b=n.kind==="needs-gesture"?s.jsx(Xe,{variant:"outline",className:"self-start",onClick:n.onStart,children:a("decoServe.guide.step2.start")}):d&&s.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:n.paused?a("decoServe.guide.step2.paused"):a("decoServe.guide.step2.looking",{hosts:r})}),e[34]=r,e[35]=d,e[36]=a,e[37]=n.kind,e[38]=n.onStart,e[39]=n.paused,e[40]=b):b=e[40];let w;e[41]!==j||e[42]!==y||e[43]!==b?(w={title:j,body:y,after:b},e[41]=j,e[42]=y,e[43]=b,e[44]=w):w=e[44];let T;e[45]!==k||e[46]!==w?(T=[k,w],e[45]=k,e[46]=w,e[47]=T):T=e[47];let P;e[48]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(ds,{className:"border-t border-border pt-4",links:["siteEditor","serve","troubleshooting"]}),e[48]=P):P=e[48];let N;return e[49]!==T||e[50]!==p||e[51]!==m||e[52]!==f||e[53]!==x?(N=s.jsx(zt,{headingLevel:2,waiting:p,title:m,lead:f,alerts:x,steps:T,footer:P}),e[49]=T,e[50]=p,e[51]=m,e[52]=f,e[53]=x,e[54]=N):N=e[54],N}function Ko(t,e){switch(t.kind){case"needs-permission":return{kind:"denied"};case"problem":return{kind:"problem",problem:t.problem,host:e};default:return{kind:"looking"}}}const zo=15e3,Io=3e3;function Uo(t){const{candidates:e,probe:n,onFound:r,onChange:i,doc:u=document,setTimer:a=(b,w)=>setTimeout(b,w),clearTimer:o=b=>clearTimeout(b),timeoutMs:l=Io}=t;let d={status:"searching",firstRoundDone:!1,problem:null},p=!1,m=!1,f=0,x=null,v=null;const E=()=>u.visibilityState==="hidden",g=b=>{d={...d,...b},i(d)},k=async b=>{v=new AbortController;const w=v,T=a(()=>w.abort(),l);try{return await n(b,w.signal),!0}catch(P){if(p)return!1;const N=$a(P);return N.reason!=="not-answering"?g({problem:{...N,endpoint:b}}):d.problem?.endpoint===b&&g({problem:null}),!1}finally{o(T),v=null}},j=async()=>{if(x=null,!(p||m)){if(e.length===0){g({status:"stopped",firstRoundDone:!0});return}if(E()){g({status:"paused"});return}m=!0,d.status!=="searching"&&g({status:"searching"});for(const b of e){if(p)break;if(await k(b)){if(m=!1,p)return;p=!0,u.removeEventListener("visibilitychange",y),g({status:"found",firstRoundDone:!0}),r(b);return}}if(m=!1,!p){if(f+=1,d.firstRoundDone||g({firstRoundDone:!0}),E()){g({status:"paused"});return}x=a(()=>{j()},Ma(f,zo))}}};function y(){if(!p){if(E()){x!==null&&(o(x),x=null),m||g({status:"paused"});return}x!==null&&o(x),f=0,j()}}return u.addEventListener("visibilitychange",y),i(d),j(),()=>{p=!0,x!==null&&o(x),v?.abort(),u.removeEventListener("visibilitychange",y)}}function Ho(t,e){return za(Ia({endpoint:t,fetch:n=>fetch(n,{signal:e})}))}const Vo=["loopback-network","local-network-access"];async function qo(){if(Ka(window.location.origin))return null;for(const t of Vo)try{return await navigator.permissions.query({name:t})}catch{}return null}let sr=null,xs=!1;const pn=new Set;function Wo(t){if(pn.add(t),!xs){xs=!0;const e=n=>{sr=n;for(const r of pn)r()};qo().then(n=>{if(!n)return e("unsupported");e(n.state),n.addEventListener("change",()=>e(n.state))})}return()=>pn.delete(t)}const Go={status:"stopped",firstRoundDone:!1,problem:null},hn=new Map;function Jo(t){const e=hn.get(t);if(e)return e;let n={status:"searching",firstRoundDone:!1,problem:null};const r=new Set;let i=null;const u={onFound:()=>{},getSnapshot:()=>n,subscribe:a=>(r.add(a),i??=Uo({candidates:t.split(" "),probe:Ho,onFound:o=>u.onFound(o),onChange:o=>{n=o;for(const l of r)l()}}),()=>{r.delete(a),!(r.size>0)&&(i?.(),i=null,hn.delete(t))})};return hn.set(t,u),u}function rr(){return S.useSyncExternalStore(Wo,ws,ws)}const Yo=()=>()=>{},ys=()=>Go,ws=()=>sr;function Sc(t){const e=ne.c(9),{candidates:n,onFound:r}=t,[i,u]=S.useState(!1),a=rr(),l=(a==="granted"||a==="unsupported"||a==="prompt"&&i)&&n.length>0;let d;e[0]!==l||e[1]!==n||e[2]!==r?(d=l?Jo(n.join(" ")):null,d&&(d.onFound=r),e[0]=l,e[1]=n,e[2]=r,e[3]=d):d=e[3];const p=S.useSyncExternalStore(d?.subscribe??Yo,d?.getSnapshot??ys,d?.getSnapshot??ys),m=a==="prompt"&&!i;let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=()=>u(!0),e[4]=f):f=e[4];let x;return e[5]!==a||e[6]!==p||e[7]!==m?(x={state:p,access:a,needsGesture:m,start:f},e[5]=a,e[6]=p,e[7]=m,e[8]=x):x=e[8],x}const ks={mode:"none",iframeBase:null,showBlockingOverlay:!1,showWakingPill:!1};function Qo(t){const{previewState:e,progressStatus:n,fastPreviewActive:r=!1,fastPreviewReady:i=!1,codingSession:u=!1,hostedDraft:a=!1}=t,o=u?null:t.previewServerUrl;return t.deciding?{...ks,showDecidingLoader:!0}:t.localPreviewUrl?{mode:"sandbox",iframeBase:t.localPreviewUrl,showBlockingOverlay:!1,showWakingPill:!1}:e.kind==="suspended"||e.kind==="errored"?ks:r&&i&&o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!1}:r&&a&&o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!1}:!r&&e.kind==="iframe"&&n!=="doing"?{mode:"sandbox",iframeBase:e.previewUrl,showBlockingOverlay:!1,showWakingPill:!1}:o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!0}:{mode:"none",iframeBase:null,showBlockingOverlay:!0,showWakingPill:!1}}const Xo=1e4,Zo=1e3,ei=3e4;function ti({iframeRef:t,src:e,active:n}){const r=S.useRef(0),i=S.useRef(null),u=S.useRef(null),a=S.useRef(e),o=S.useRef(n);a.current=e,o.current=n;const l=()=>{i.current&&clearTimeout(i.current),u.current&&clearTimeout(u.current),i.current=null,u.current=null},d=()=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,p()},Xo)},p=()=>{if(!o.current||!a.current)return;u.current&&clearTimeout(u.current);const x=Ba(ei,Zo,r.current,2,.5);r.current+=1,u.current=setTimeout(()=>{u.current=null;const v=t.current,E=a.current;!v||!E||!o.current||(v.src=E,d())},x)},m=()=>{r.current=0,l()},f=()=>{i.current&&(clearTimeout(i.current),i.current=null),p()};return S.useEffect(()=>{if(l(),r.current=0,!(!n||!e))return d(),l},[e,n]),{handleLoad:m,handleError:f}}const ni=1500,si=500;function ri({iframe:t,reload:e,waitMs:n=ni,confirmMs:r=si}){let i;const u=()=>{clearTimeout(a),i=setTimeout(e,r)};t.addEventListener("load",u,{once:!0});const a=setTimeout(()=>{t.removeEventListener("load",u),e()},n);return()=>{clearTimeout(a),clearTimeout(i),t.removeEventListener("load",u)}}const ai=$t({tag:Ne(),id:Ne(),classes:Ne(),text:Ne(),html:Ne(),manifestKey:Ne().nullable(),componentName:Ne().nullable(),parents:Ne(),url:Ne(),path:Ne(),viewport:$t({width:Ye(),height:Ye()}),position:$t({x:Ye(),y:Ye()})}),oi=`(function() {
3
3
  if (window.__visualEditorActive) return;
4
4
  window.__visualEditorActive = true;
5
5
 
@@ -548,4 +548,4 @@ import{c as ne,j as s,r as S,l as Mt,b as _e,B as Xe,aF as $t,aY as Ye,aG as Ne,
548
548
  }
549
549
  });
550
550
  })();`;function bn(t,e){let n=t,r=typeof n?.__resolveType=="string"?n.__resolveType:"";for(let i=0;r&&i<5;i++){const u=e[r];if(u&&typeof u=="object"&&"__resolveType"in u){const a=u.__resolveType;if(typeof a=="string"&&a&&a!==r){n=u,r=a;continue}}break}if(!r)return[];if(r.includes("flags/multivariate")){const i=Array.isArray(n.variants)?n.variants:[];if(i.length===0||i.every(o=>o?.rule?.__resolveType===uo))return null;const a=[];for(const o of i){const l=o?.value;if(l&&typeof l=="object")for(const d of bn(l,e)??[])a.includes(d)||a.push(d)}return a}if(fo(r)){const i=n.section&&typeof n.section=="object"?bn(n.section,e):[];return i===null?null:i.length?[r,...i]:[r]}return[r]}function Je(t){return t.replace(/[`*_]/g,"\\$&")}function ci(t,e){const n=[`The user selected an element on the live preview and asked: **"${Je(e.trim())}"**`,"","For text content changes, locate the correct source file and apply the change.","For code and CSS changes, understand which component the user is referring to and apply changes to the correct component.",""];t.manifestKey&&n.push(`**Section resolveType:** \`${Je(t.manifestKey)}\``,"","This is a Deco resolveType, not a literal file path. The leading segment is the app name, not a directory — the actual source file lives under a sections directory whose root varies by site (commonly `sections/`, `src/sections/`, or `site/sections/`). Locate the file by searching for the trailing path (e.g. the component filename), don't assume the resolveType is a valid path on disk.","");const r=`<${t.tag}${t.classes?` class="${Je(t.classes)}"`:""}>`;n.push(`**Clicked element:** \`${r}\``),t.parents&&n.push(`**DOM breadcrumb:** ${Je(t.parents)} > ${t.tag}`),t.text&&n.push(`**Text content:** "${Je(t.text)}"`),t.componentName&&n.push(`**Component name:** ${Je(t.componentName)}`);const i=t.html.replace(/```/g,"`` `");return n.push("","**HTML snippet:**","```html",i,"```"),n.push("","Please read the source file, locate the element, and apply the requested change."),n.join(`
551
- `)}function di(t,e,n=320,r=44,i=12){const{x:u,y:a}=t,{width:o,height:l}=e,d=Math.max(i,Math.min(u-n/2,o-n-i)),m=a/l>.68?Math.max(i,a-r-18):Math.min(a+18,l-r-i);return{leftPct:d/o*100,topPct:m/l*100}}function ui(t){const e=ne.c(45),{element:n,onDismiss:r}=t,[i,u]=S.useState(""),a=S.useRef(null),{sendMessage:o}=ha(),{openSidePanel:l}=wo(),d=_e();let p;e[0]!==n||e[1]!==i||e[2]!==r||e[3]!==l||e[4]!==o?(p=()=>{if(!i.trim())return;const U=ci(n,i);l(),o({parts:[{type:"text",text:U}]}),r()},e[0]=n,e[1]=i,e[2]=r,e[3]=l,e[4]=o,e[5]=p):p=e[5];const m=p;let f;e[6]!==n.position||e[7]!==n.viewport?(f=di(n.position,n.viewport),e[6]=n.position,e[7]=n.viewport,e[8]=f):f=e[8];const x=f,v=`${x.leftPct}%`,E=`${x.topPct}%`;let g;e[9]!==v||e[10]!==E?(g={left:v,top:E,width:"320px"},e[9]=v,e[10]=E,e[11]=g):g=e[11];let k;e[12]!==m?(k=U=>{U.preventDefault(),m()},e[12]=m,e[13]=k):k=e[13];let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=U=>u(U.target.value),e[14]=j):j=e[14];let y;e[15]!==r?(y=U=>{U.key==="Escape"&&r()},e[15]=r,e[16]=y):y=e[16];let b;e[17]!==d?(b=d("sandbox.visualEditorPrompt.inputPlaceholder"),e[17]=d,e[18]=b):b=e[18];let w;e[19]!==i||e[20]!==y||e[21]!==b?(w=s.jsx("input",{ref:a,autoFocus:!0,type:"text",value:i,onChange:j,onKeyDown:y,placeholder:b,className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"}),e[19]=i,e[20]=y,e[21]=b,e[22]=w):w=e[22];let T;e[23]!==i?(T=i.trim(),e[23]=i,e[24]=T):T=e[24];const P=!T;let N;e[25]!==d?(N=d("sandbox.visualEditorPrompt.sendButton"),e[25]=d,e[26]=N):N=e[26];let B;e[27]!==d?(B=d("sandbox.visualEditorPrompt.sendButton"),e[27]=d,e[28]=B):B=e[28];let R;e[29]!==B?(R=s.jsx("title",{children:B}),e[29]=B,e[30]=R):R=e[30];let D;e[31]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e[31]=D):D=e[31];let O;e[32]!==R?(O=s.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[R,D]}),e[32]=R,e[33]=O):O=e[33];let F;e[34]!==P||e[35]!==N||e[36]!==O?(F=s.jsx("button",{type:"submit",disabled:P,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg bg-foreground text-background transition-opacity disabled:opacity-30",title:N,children:O}),e[34]=P,e[35]=N,e[36]=O,e[37]=F):F=e[37];let _;e[38]!==w||e[39]!==F||e[40]!==k?(_=s.jsxs("form",{className:"pointer-events-auto flex w-full items-center gap-1.5 rounded-xl border border-border bg-background/95 px-3 py-1.5 shadow-lg backdrop-blur",onSubmit:k,children:[w,F]}),e[38]=w,e[39]=F,e[40]=k,e[41]=_):_=e[41];let I;return e[42]!==_||e[43]!==g?(I=s.jsx("div",{className:"absolute z-30 pointer-events-none",style:g,children:_}),e[42]=_,e[43]=g,e[44]=I):I=e[44],I}const Ps="site-links",fi=/details?page|\bpdp\b/i,mi=/listingpage|\bplp\b/i;function pi(t,e,n){const r=new Set;for(const o of n)fi.test(o)&&r.add("product"),mi.test(o)&&r.add("category");const i=ht(Pn(t)),u=i[i.length-1],a=i[i.length-2];return u?.type==="text"&&u.text==="/p"&&a?.type==="param"&&a.name===e&&r.add("product"),e==="*"&&i.some(o=>o.type==="param"&&o.name==="*")&&r.add("category"),r}const hi=["rosa","preto","pink","black"];function Dt(t,e){const n=e.trim();return n?t(n):hi.flatMap(r=>t(r))}function gi(t,e){const n=e.trim(),r=[];/^\d+$/.test(n)&&r.push({resolveType:t,props:{ids:[n]}});const u=n.includes("-")&&!/\s/.test(n)?n.replace(/-+/g," "):n;return r.push({resolveType:t,props:{query:u,count:10}}),r}const ar=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function En(t){return t.split("/")[0]??""}function vi(t){const e=new Set;for(const n of t){const r=En(n);ar.has(r)&&e.add(r)}return e}function bi(t,e){const n=En(t);return!ar.has(n)||e.size===0?!0:e.has(n)}const xi=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>Dt(n=>gi(t,n),e),optionsFromPayload:Bt},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Dt(n=>[{resolveType:t,props:{props:{search:n,pageSize:10,currentPage:1}}}],e),optionsFromPayload:Bt},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Dt(n=>[{resolveType:t,props:{term:n,hitsPerPage:10}}],e),optionsFromPayload:Bt},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Dt(n=>[{resolveType:t,props:{query:n,term:n,count:10,hitsPerPage:10}}],e),optionsFromPayload:Bt},{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:ji}];function yi(t,e,n=new Set){const r=[...e],i=o=>{const l=[];for(const d of xi){if(d.kind!==o)continue;const p=r.find(m=>d.test(m)&&bi(m,n));p&&l.push({cand:d,resolveType:p})}return l.find(d=>n.has(En(d.resolveType)))??l[0]},u=(o,l,d)=>({kind:o.kind,id:`${o.kind}:${l}`,resolveType:l,clientFilter:o.clientFilter,isFallback:d,buildRequests:p=>o.buildRequests(l,p),optionsFromPayload:o.optionsFromPayload}),a=[];for(const o of["product","category"]){if(!t.has(o))continue;const l=i(o);l&&a.push(u(l.cand,l.resolveType,!1))}return t.size>0&&a.push(wi(t.has("category")?"category":"product")),a}function wi(t){return{kind:t,id:Ps,resolveType:Ps,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,n)=>Li(e,n)}}function Ie(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function ki(t,e,n){const r=new Set,i=new Set,u=a=>{if(Array.isArray(a)){for(const d of a)u(d);return}const o=Ie(a);if(!o)return;const l=o.__resolveType;if(typeof l=="string"){if(n(l))r.add(l);else if(l in e&&!i.has(l)){i.add(l);const d=Ie(e[l])?.__resolveType;typeof d=="string"&&n(d)&&r.add(l),u(e[l])}}for(const d of Object.values(o))u(d)};return u(t),r}function or(t){const e=new Set,n=[];for(const r of t)for(const i of r)e.has(i.value)||(e.add(i.value),n.push(i));return n}function ir(t){try{return decodeURIComponent(t)}catch{return t}}function Si(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pi(t){const e=[];let n="^";for(const r of t)r.type==="text"?n+=Si(r.text):(e.push(r.name),n+=r.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${n}$`),order:e}}function lr(t,e,n){if(typeof t!="string"||!t)return null;let r;try{r=new URL(t,"https://placeholder.invalid").pathname}catch{return null}r=r.replace(/\/+$/,"");const i=ht(Pn(e)),{pattern:u,order:a}=Pi(i),o=a.indexOf(n);if(o===-1)return null;const l=r.match(u);if(!l)return null;const d=l[o+1]?.replace(/^\/+|\/+$/g,"");return d?ir(d):null}function Bt(t,e){const n=Ie(t),r=Array.isArray(t)?t:Array.isArray(n?.products)?n.products:Array.isArray(n?.list)?n.list:[],i=[],u=new Set;for(const a of r){const o=Ie(a);if(!o)continue;const l=lr(o.url,e.template,e.paramName);if(!l||u.has(l))continue;u.add(l);const d=Ie(o.isVariantOf),p=typeof d?.name=="string"&&d.name||typeof o.name=="string"&&o.name||l,m=Array.isArray(o.image)?Ie(o.image[0]):null,f=typeof m?.url=="string"?m.url:void 0;i.push({value:l,label:p,image:f})}return i}function Ei(t){if(typeof t!="string"||!t)return null;let e;try{e=new URL(t,"https://placeholder.invalid").pathname}catch{return null}const n=e.replace(/^\/+|\/+$/g,"");return n?ir(n):null}function ji(t){const e=[],n=new Set,r=(i,u)=>{const a=Ie(i);if(!a)return;const o=typeof a.name=="string"&&a.name?a.name:"",l=o?[...u,o]:u,d=Ei(a.url);if(d&&!n.has(d)&&(n.add(d),e.push({value:d,label:l.join(" › ")||d})),Array.isArray(a.children))for(const p of a.children)r(p,l)};if(Array.isArray(t))for(const i of t)r(i,[]);return e}const Ni=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 Ti(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,n=>n.toUpperCase())}function Ci(t){if(typeof t!="string"||!t)return[];const e=[],n=/<a\b[^>]*?\bhref="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi;let r,i=0;for(;(r=n.exec(t))!==null&&i++<5e3;){const u=r[1]??"",a=(r[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:u,text:a})}return e}function Ri(t){if(typeof t!="string"||!t)return[];const e=[],n=new Set,r=/"@type":"Product"[\s\S]{0,600}?(?:"url"|\burl):"([^"]+)"[\s\S]{0,300}?(?:"name"|\bname):"([^"]+)"/g,i=/(?:"image"|\bimage):\s*\[\s*\{[\s\S]{0,400}?(?:"url"|\burl):"([^"]+)"/;let u,a=0;for(;(u=r.exec(t))!==null&&a++<3e3;){const o=(u[1]??"").replace(/\\\//g,"/");if(!o||n.has(o))continue;n.add(o);const l=t.slice(u.index,u.index+900).match(i)?.[1]?.replace(/\\\//g,"/");e.push({url:o,name:u[2]??"",image:l||void 0})}return e}function Li(t,e){const n=[],r=new Set,i=(u,a,o,l)=>{if(n.length>=200)return;const d=lr(u,e.template,e.paramName);!d||r.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||o==="category"&&Ni.has(d.split("/")[0]??"")||(r.add(d),n.push({value:d,label:a&&a.length<=80?a:Ti(d),kind:o,image:l}))};for(const{url:u,name:a,image:o}of Ri(t))i(u,a,"product",o);for(const{href:u,text:a}of Ci(t))u.startsWith("/")&&!u.startsWith("//")&&i(u,a,"category");return n}function dt(t,e,n=50){const r=e.trim().toLowerCase();return(r?t.filter(u=>u.label.toLowerCase().includes(r)||u.value.toLowerCase().includes(r)):t).slice(0,n)}const cr=1e4;function _i(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 Ai(t,{resolveType:e,props:n}){const r=await fetch(Ua(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...n}),signal:AbortSignal.timeout(cr)});if(!r.ok)throw new Error(`Failed to fetch options: ${r.status}`);return r.json()}async function Es(t,e){const n=await fetch(Ha(t,e),{signal:AbortSignal.timeout(cr)});if(!n.ok)throw new Error(`Failed to fetch page: ${n.status}`);return n.text()}async function Oi(t,e,n){const r=e.optionsFromPayload(await Es(t,"/"),n),i=r.find(a=>a.kind==="category");if(!i)return r;const u=Fe(n.template,{[n.paramName]:i.value});if(u==="/")return r;try{const a=e.optionsFromPayload(await Es(t,u),n).filter(o=>o.kind==="product");return or([r,a])}catch{return r}}function Di(t,e,n){return Ds.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":n}`)}async function Bi(t,e,n,r){if(e.homepageLinks)return Oi(t,e,r);const i=e.buildRequests?.(n)??[];if(i.length===0)return[];const u=await Promise.allSettled(i.map(o=>Ai(t,o))),a=u.filter(o=>o.status==="fulfilled").map(o=>o.value);if(a.length===0){const o=u.find(l=>l.status==="rejected");throw o?o.reason:new Error("Failed to fetch options")}return or(a.map(o=>e.optionsFromPayload(o,r)))}function xn(t,e,n,r,i){return{queryKey:Di(t,e,n),queryFn:()=>Bi(t,e,n,r),enabled:i,staleTime:6e4,retry:1}}function ut(t){const e=ne.c(16),{heading:n,iconKind:r,options:i,template:u,paramName:a,keyPrefix:o,onSelect:l}=t;if(i.length===0)return null;let d;if(e[0]!==r||e[1]!==o||e[2]!==l||e[3]!==i||e[4]!==a||e[5]!==u){let m;e[7]!==r||e[8]!==o||e[9]!==l||e[10]!==a||e[11]!==u?(m=f=>s.jsxs(pt,{value:`${o}:${f.value}`,className:"gap-3 py-2",onSelect:()=>l(f.value),children:[r==="product"&&s.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?s.jsx("img",{src:f.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):s.jsx(Us,{size:14,className:"text-muted-foreground"})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm",children:f.label}),s.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Fe(u,{[a]:f.value})})]})]},`${o}:${f.value}`),e[7]=r,e[8]=o,e[9]=l,e[10]=a,e[11]=u,e[12]=m):m=e[12],d=i.map(m),e[0]=r,e[1]=o,e[2]=l,e[3]=i,e[4]=a,e[5]=u,e[6]=d}else d=e[6];let p;return e[13]!==n||e[14]!==d?(p=s.jsx(mt,{heading:n,children:d}),e[13]=n,e[14]=d,e[15]=p):p=e[15],p}function js(t){const e=ne.c(2),{text:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Fi(t){const e=ne.c(52),{sources:n,template:r,paramName:i,value:u,sandboxRef:a,onCommit:o}=t,l=_e(),[d,p]=S.useState(!1),[m,f]=S.useState(""),[x,v]=S.useState(""),E=S.useRef(null),g=i==="*"?l("sandbox.preview.catchAllParamLabel"):`:${i}`,k=_i(l),y=[...new Set(n.map(M=>k[M.kind].noun))].join(" or ");let b;e[0]!==l||e[1]!==y?(b=l("sandbox.pathParamPickerChip.searchPlaceholder",{options:y}),e[0]=l,e[1]=y,e[2]=b):b=e[2];const w=b,T={template:r,paramName:i};let P;e[3]!==m?(P=(M,G)=>({source:M,query:G,options:M.clientFilter?dt(G.data??[],m):G.data??[]}),e[3]=m,e[4]=P):P=e[4];const N=P,B=n.filter(Vi),R=n.filter(Hi),D=vn({queries:B.map(M=>xn(a,M,x,T,d))});let O;e[5]!==D||e[6]!==N?(O=(M,G)=>N(M,D[G]),e[5]=D,e[6]=N,e[7]=O):O=e[7];const F=B.map(O),_=F.length===0||F.every(Ui),I=vn({queries:R.map(M=>xn(a,M,x,T,d&&_))});let U;e[8]!==I||e[9]!==N?(U=(M,G)=>N(M,I[G]),e[8]=I,e[9]=N,e[10]=U):U=e[10];const X=R.map(U),z=_?X:F,q=z.length===1&&z[0]?.source.homepageLinks?z[0]:null,ee=q&&!q.query.isLoading&&!q.query.isError?q?.query.data??[]:[],ce=dt(ee.filter(Ii),m),C=dt(ee.filter(zi),m),H=ce.length>0&&C.length>0,A=M=>{p(M),E.current&&clearTimeout(E.current),f(M?u:""),v(M?u:"")};let J;e[11]===Symbol.for("react.memo_cache_sentinel")?(J=M=>{f(M),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{v(M)},300)},e[11]=J):J=e[11];const Y=J,Q=M=>{o(M),A(!1)},he=Xs(m),se=Fe(r,{[i]:he}),W=Os,oe=As,ye="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",de=Ki;let re;e[12]!==g||e[13]!==l?(re=l("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:g}),e[12]=g,e[13]=l,e[14]=re):re=e[14];let ue;e[15]!==re?(ue=s.jsx(Bs,{className:"sr-only",children:s.jsx(Fs,{children:re})}),e[15]=re,e[16]=ue):ue=e[16];let we;e[17]===Symbol.for("react.memo_cache_sentinel")?(we=s.jsx(Us,{size:16,className:"shrink-0 text-foreground"}),e[17]=we):we=e[17];let ae;e[18]!==l?(ae=l("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=l,e[19]=ae):ae=e[19];let fe;e[20]!==g?(fe=s.jsx("span",{className:"rounded-sm bg-special/15 px-1 py-0.5 font-mono text-[12px] text-special",children:g}),e[20]=g,e[21]=fe):fe=e[21];let ie;e[22]!==ae||e[23]!==fe?(ie=s.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[we,s.jsxs("span",{className:"text-sm font-medium text-foreground",children:[ae," ",fe]})]}),e[22]=ae,e[23]=fe,e[24]=ie):ie=e[24];const Te=Vs,ke=!1,Me="min-h-0 flex-1";let ge;e[25]!==w||e[26]!==m?(ge=s.jsx(qs,{autoFocus:!0,placeholder:w,value:m,onValueChange:Y}),e[25]=w,e[26]=m,e[27]=ge):ge=e[27];const Ze=Hs,vt="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let Be;e[28]!==l?(Be=l("sandbox.pathParamPickerChip.noResults"),e[28]=l,e[29]=Be):Be=e[29];let Ae;e[30]!==Be?(Ae=s.jsx(Ws,{children:Be}),e[30]=Be,e[31]=Ae):Ae=e[31];const Se=he&&s.jsx(mt,{className:"shrink-0",children:s.jsxs(pt,{value:`__raw__:${he}`,className:"gap-3 py-2",onSelect:()=>Q(he),children:[s.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:s.jsx(So,{size:14,className:"text-muted-foreground"})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm",children:l("sandbox.pathParamPickerChip.useRawValue",{rawTerm:he,paramLabel:g})}),s.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:se})]})]})}),$e=H?s.jsxs("div",{className:"flex min-h-0 flex-1",children:[s.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto border-r border-border",children:s.jsx(ut,{heading:k.category.heading,iconKind:"category",options:ce,template:r,paramName:i,keyPrefix:`${q?.source.id}:cat`,onSelect:Q})}),s.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:s.jsx(ut,{heading:k.product.heading,iconKind:"product",options:C,template:r,paramName:i,keyPrefix:`${q?.source.id}:prod`,onSelect:Q})})]}):s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:z.map(M=>{const{source:G,query:Ke,options:et}=M,{noun:Ue}=k[G.kind];if(Ke.isLoading)return s.jsx(js,{text:l("sandbox.pathParamPickerChip.loading",{noun:Ue})},G.id);if(Ke.isError)return s.jsx(js,{text:l("sandbox.pathParamPickerChip.couldNotLoad")},G.id);if(G.homepageLinks){const bt=Ke.data??[];return s.jsxs(S.Fragment,{children:[s.jsx(ut,{heading:k.category.heading,iconKind:"category",options:dt(bt.filter($i),m),template:r,paramName:i,keyPrefix:`${G.id}:cat`,onSelect:Q}),s.jsx(ut,{heading:k.product.heading,iconKind:"product",options:dt(bt.filter(Mi),m),template:r,paramName:i,keyPrefix:`${G.id}:prod`,onSelect:Q})]},G.id)}return s.jsx(ut,{heading:z.length>1?k[G.kind].heading:void 0,iconKind:G.kind,options:et,template:r,paramName:i,keyPrefix:G.id,onSelect:Q},G.id)})});let Ce;e[32]!==Ze||e[33]!==Ae||e[34]!==Se||e[35]!==$e?(Ce=s.jsxs(Ze,{className:vt,children:[Ae,Se,$e]}),e[32]=Ze,e[33]=Ae,e[34]=Se,e[35]=$e,e[36]=Ce):Ce=e[36];let Re;e[37]!==Te||e[38]!==ge||e[39]!==Ce?(Re=s.jsxs(Te,{shouldFilter:ke,className:Me,children:[ge,Ce]}),e[37]=Te,e[38]=ge,e[39]=Ce,e[40]=Re):Re=e[40];let Pe;e[41]!==oe||e[42]!==ue||e[43]!==ie||e[44]!==Re||e[45]!==de?(Pe=s.jsxs(oe,{className:ye,onClick:de,children:[ue,ie,Re]}),e[41]=oe,e[42]=ue,e[43]=ie,e[44]=Re,e[45]=de,e[46]=Pe):Pe=e[46];let ve;return e[47]!==W||e[48]!==A||e[49]!==d||e[50]!==Pe?(ve=s.jsx(W,{open:d,onOpenChange:A,children:Pe}),e[47]=W,e[48]=A,e[49]=d,e[50]=Pe,e[51]=ve):ve=e[51],s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",title:l("sandbox.pathParamPickerChip.buttonTitle",{paramLabel:g}),className:"max-w-64 shrink-0 cursor-pointer truncate rounded-lg bg-special/15 px-1 py-0.5 text-[12px] text-special hover:bg-special/25",onClick:M=>{M.stopPropagation(),A(!0)},children:u||g}),ve]})}function Mi(t){return t.kind==="product"}function $i(t){return t.kind!=="product"}function Ki(t){return t.stopPropagation()}function zi(t){return t.kind==="product"}function Ii(t){return t.kind!=="product"}function Ui(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function Hi(t){return t.isFallback}function Vi(t){return!t.isFallback}function qi(t){const e=ne.c(8),{sources:n,template:r,paramName:i,sandboxRef:u,onFill:a}=t;let o,l;if(e[0]!==i||e[1]!==u||e[2]!==n||e[3]!==r){const x={template:r,paramName:i},v=n.filter(Wi);l=vn,o=v.map(E=>xn(u,E,"",x,!0)),e[0]=i,e[1]=u,e[2]=n,e[3]=r,e[4]=o,e[5]=l}else o=e[4],l=e[5];let d;e[6]!==o?(d={queries:o},e[6]=o,e[7]=d):d=e[7];const p=l(d),[m,f]=S.useState(!1);if(!m)for(const x of p){if(x.isLoading)break;const v=x.data?.[0];if(v){f(!0),queueMicrotask(()=>a(v.value));break}}return null}function Wi(t){return!t.isFallback}function Gi(t){const e=ne.c(31),{name:n,value:r,onCommit:i}=t,u=_e(),[a,o]=S.useState(r),[l,d]=S.useState(!1),p=S.useRef(!1);let m;e[0]!==n||e[1]!==u?(m=n==="*"?u("sandbox.preview.catchAllParamLabel"):`:${n}`,e[0]=n,e[1]=u,e[2]=m):m=e[2];const f=m,x=a||f;let v;e[3]!==x?(v=s.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-[12px]",children:x}),e[3]=x,e[4]=v):v=e[4];let E;e[5]!==f||e[6]!==u?(E=u("sandbox.preview.valueForParam",{label:f}),e[5]=f,e[6]=u,e[7]=E):E=e[7];let g,k;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=N=>o(N.target.value),k=()=>d(!0),e[8]=g,e[9]=k):(g=e[8],k=e[9]);let j;e[10]!==r?(j=N=>{N.key==="Enter"&&N.currentTarget.blur(),N.key==="Escape"&&(p.current=!0,o(r),N.currentTarget.blur())},e[10]=r,e[11]=j):j=e[11];let y;e[12]!==a||e[13]!==i||e[14]!==r?(y=()=>{if(d(!1),p.current){p.current=!1;return}const N=Xs(a);o(N),N!==r&&i(N)},e[12]=a,e[13]=i,e[14]=r,e[15]=y):y=e[15];let b;e[16]!==a||e[17]!==f||e[18]!==E||e[19]!==j||e[20]!==y?(b=s.jsx("input",{type:"text",value:a,placeholder:f,title:E,spellCheck:!1,className:"absolute inset-0 rounded-sm bg-special/15 px-1 text-[12px] text-special outline-none placeholder:text-special/60 focus:bg-special/25",onClick:Ji,onChange:g,onFocus:k,onKeyDown:j,onBlur:y}),e[16]=a,e[17]=f,e[18]=E,e[19]=j,e[20]=y,e[21]=b):b=e[21];let w;e[22]!==v||e[23]!==b?(w=s.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[v,b]}),e[22]=v,e[23]=b,e[24]=w):w=e[24];let T;e[25]!==l||e[26]!==u?(T=l&&s.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:[s.jsx(ka,{size:10}),u("sandbox.preview.enterToGo")]}),e[25]=l,e[26]=u,e[27]=T):T=e[27];let P;return e[28]!==T||e[29]!==w?(P=s.jsxs(s.Fragment,{children:[w,T]}),e[28]=T,e[29]=w,e[30]=P):P=e[30],P}function Ji(t){return t.stopPropagation()}function Yi(t){if(t.activeGlobalSectionName)return t.activeGlobalSectionName;const e=t.iframeBase;if(!e)return t.noServerLabel;try{const n=new URL(e),r=t.resolvedPath==="/"?"":t.resolvedPath;return`${n.host}${r}`}catch{return e}}function Qi(t){return t.previewSurfaceActive&&(t.daemonReady||t.production||!!t.servePreviewUrl)}function Xi(t){return t.showPreviewToolbar&&t.contentEditingEnabled}function Zi(t){const e=ne.c(5);let n;e[0]!==t?(n=t??{orgSlug:"",virtualMcpId:"",branch:""},e[0]=t,e[1]=n):n=e[1];const r=Ms(n);let i;return e[2]!==t||e[3]!==r?(i={mutationFn:async u=>{const{name:a,path:o,template:l}=u;if(!t?.virtualMcpId||!t.branch)throw new Error("Sandbox not ready");const d=Qr(a),p=l?{...l,name:a,path:o}:Xr(a,o);return await r.mutateAsync({blockKey:d,data:p}),{key:d,name:a,path:o}}},e[2]=t,e[3]=r,e[4]=i):i=e[4],Ir(i)}function el(t){const e=ne.c(89),{open:n,onOpenChange:r,isPending:i,error:u,templates:a,onSubmit:o}=t,l=i===void 0?!1:i,d=_e();let p;e[0]!==d?(p=d("sectionsEditor.createPageModal.defaultPageName"),e[0]=d,e[1]=p):p=e[1];const[m,f]=S.useState(p);let x;e[2]!==d?(x=d("sectionsEditor.createPageModal.defaultPagePath"),e[2]=d,e[3]=x):x=e[3];const[v,E]=S.useState(x),[g,k]=S.useState(ln),[j,y]=S.useState(null),[b,w]=S.useState(n);n!==b&&(w(n),n&&(f(d("sectionsEditor.createPageModal.defaultPageName")),E(d("sectionsEditor.createPageModal.defaultPagePath")),k(ln),y(null)));const T=!!a?.length;let P;e[4]!==l||e[5]!==r?(P=ae=>{!ae&&!l&&(y(null),r(!1))},e[4]=l,e[5]=r,e[6]=P):P=e[6];const N=P;let B;e[7]!==l||e[8]!==m||e[9]!==o||e[10]!==v||e[11]!==T||e[12]!==g?(B=async ae=>{ae.preventDefault();const fe=m.trim(),ie=v.trim();if(!fe||!ie||l)return;const Te=Zs(ie);if(Te){y(Te);return}y(null),await o({name:fe,path:ie,templateKey:T&&g!==ln?g:null})},e[7]=l,e[8]=m,e[9]=o,e[10]=v,e[11]=T,e[12]=g,e[13]=B):B=e[13];const R=B,D=j??u;let O;e[14]!==d?(O=d("sectionsEditor.createPageModal.title"),e[14]=d,e[15]=O):O=e[15];let F;e[16]!==O?(F=s.jsx(Bs,{children:s.jsx(Fs,{children:O})}),e[16]=O,e[17]=F):F=e[17];let _;e[18]!==d?(_=d("sectionsEditor.createPageModal.nameLabel"),e[18]=d,e[19]=_):_=e[19];let I;e[20]!==_?(I=s.jsx("label",{htmlFor:"new-page-name",className:"text-xs font-medium text-muted-foreground",children:_}),e[20]=_,e[21]=I):I=e[21];let U;e[22]===Symbol.for("react.memo_cache_sentinel")?(U=ae=>f(ae.target.value),e[22]=U):U=e[22];let X;e[23]!==d?(X=d("sectionsEditor.createPageModal.namePlaceholder"),e[23]=d,e[24]=X):X=e[24];let z;e[25]!==l||e[26]!==m||e[27]!==X?(z=s.jsx(ns,{id:"new-page-name",value:m,onChange:U,placeholder:X,autoFocus:!0,disabled:l}),e[25]=l,e[26]=m,e[27]=X,e[28]=z):z=e[28];let q;e[29]!==z||e[30]!==I?(q=s.jsxs("div",{className:"space-y-1.5",children:[I,z]}),e[29]=z,e[30]=I,e[31]=q):q=e[31];let te;e[32]!==d?(te=d("sectionsEditor.createPageModal.pathLabel"),e[32]=d,e[33]=te):te=e[33];let ee;e[34]!==te?(ee=s.jsx("label",{htmlFor:"new-page-path",className:"text-xs font-medium text-muted-foreground",children:te}),e[34]=te,e[35]=ee):ee=e[35];let ce;e[36]===Symbol.for("react.memo_cache_sentinel")?(ce=ae=>E(ae.target.value),e[36]=ce):ce=e[36];let C;e[37]!==d?(C=d("sectionsEditor.createPageModal.pathPlaceholder"),e[37]=d,e[38]=C):C=e[38];let H;e[39]!==l||e[40]!==v||e[41]!==C?(H=s.jsx(ns,{id:"new-page-path",value:v,onChange:ce,placeholder:C,disabled:l}),e[39]=l,e[40]=v,e[41]=C,e[42]=H):H=e[42];let A;e[43]!==ee||e[44]!==H?(A=s.jsxs("div",{className:"space-y-1.5",children:[ee,H]}),e[43]=ee,e[44]=H,e[45]=A):A=e[45];let J;e[46]!==l||e[47]!==T||e[48]!==d||e[49]!==g||e[50]!==a?(J=T&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"new-page-template",className:"text-xs font-medium text-muted-foreground",children:d("sectionsEditor.createPageModal.templateLabel")}),s.jsx(Zr,{id:"new-page-template",value:g,onChange:k,templates:a??[],disabled:l})]}),e[46]=l,e[47]=T,e[48]=d,e[49]=g,e[50]=a,e[51]=J):J=e[51];let Y;e[52]!==D?(Y=D&&s.jsx("p",{className:"text-xs text-destructive",children:D}),e[52]=D,e[53]=Y):Y=e[53];let Q;e[54]!==q||e[55]!==A||e[56]!==J||e[57]!==Y?(Q=s.jsxs("div",{className:"space-y-4 py-4",children:[q,A,J,Y]}),e[54]=q,e[55]=A,e[56]=J,e[57]=Y,e[58]=Q):Q=e[58];let he;e[59]!==r?(he=()=>r(!1),e[59]=r,e[60]=he):he=e[60];let se;e[61]!==d?(se=d("sectionsEditor.createPageModal.cancelButton"),e[61]=d,e[62]=se):se=e[62];let W;e[63]!==l||e[64]!==he||e[65]!==se?(W=s.jsx(Xe,{type:"button",variant:"outline",onClick:he,disabled:l,children:se}),e[63]=l,e[64]=he,e[65]=se,e[66]=W):W=e[66];let oe;e[67]!==l||e[68]!==m||e[69]!==v?(oe=!m.trim()||!v.trim()||l,e[67]=l,e[68]=m,e[69]=v,e[70]=oe):oe=e[70];let ye;e[71]!==l||e[72]!==d?(ye=l?s.jsxs(s.Fragment,{children:[s.jsx(gt,{className:"size-3.5"}),d("sectionsEditor.createPageModal.creatingButton")]}):d("sectionsEditor.createPageModal.createButton"),e[71]=l,e[72]=d,e[73]=ye):ye=e[73];let de;e[74]!==oe||e[75]!==ye?(de=s.jsx(Xe,{type:"submit",disabled:oe,children:ye}),e[74]=oe,e[75]=ye,e[76]=de):de=e[76];let re;e[77]!==W||e[78]!==de?(re=s.jsxs(Ur,{children:[W,de]}),e[77]=W,e[78]=de,e[79]=re):re=e[79];let ue;e[80]!==R||e[81]!==Q||e[82]!==re||e[83]!==F?(ue=s.jsx(As,{className:"sm:max-w-md",children:s.jsxs("form",{onSubmit:R,children:[F,Q,re]})}),e[80]=R,e[81]=Q,e[82]=re,e[83]=F,e[84]=ue):ue=e[84];let we;return e[85]!==N||e[86]!==n||e[87]!==ue?(we=s.jsx(Os,{open:n,onOpenChange:N,children:ue}),e[85]=N,e[86]=n,e[87]=ue,e[88]=we):we=e[88],we}function tl(t){const e=ne.c(29),{orgSlug:n,virtualMcpId:r,branch:i,previewUrl:u,meta:a,decofile:o,blockKey:l}=t,d=_e();let p;e[0]!==i||e[1]!==n||e[2]!==r?(p={orgSlug:n,virtualMcpId:r,branch:i},e[0]=i,e[1]=n,e[2]=r,e[3]=p):p=e[3];const m=Ms(p);let f;e[4]!==m?(f=na((w,T)=>m.mutate({blockKey:w,data:T})),e[4]=m,e[5]=f):f=e[5];const x=f;let v;e[6]!==l||e[7]!==o?(v=ea(o,l),e[6]=l,e[7]=o,e[8]=v):v=e[8];const{resolveType:E,props:g,title:k}=v;if(!E){let w;e[9]!==d?(w=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=w):w=e[10];let T;return e[11]!==w?(T=s.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:w}),e[11]=w,e[12]=T):T=e[12],T}const j=`loader:${l}`;let y;e[13]!==l||e[14]!==E||e[15]!==k?(y={mode:"saved",blockKey:l,resolveType:E,title:k},e[13]=l,e[14]=E,e[15]=k,e[16]=y):y=e[16];let b;return e[17]!==i||e[18]!==o||e[19]!==a||e[20]!==n||e[21]!==u||e[22]!==g||e[23]!==m.isPending||e[24]!==x||e[25]!==j||e[26]!==y||e[27]!==r?(b=s.jsx(ta,{orgSlug:n,virtualMcpId:r,branch:i,previewUrl:u,meta:a,decofile:o,kind:"loaders",target:y,initialValue:g,isCreating:m.isPending,onCreate:nl,onSaveReferencedBlock:x,showRun:!1},j),e[17]=i,e[18]=o,e[19]=a,e[20]=n,e[21]=u,e[22]=g,e[23]=m.isPending,e[24]=x,e[25]=j,e[26]=y,e[27]=r,e[28]=b):b=e[28],b}async function nl(){}function sl(t){if(t instanceof Error&&"status"in t&&typeof t.status=="number")return t.status}function Ns(t){return{status:t.status,hasData:t.data!==void 0,errorStatus:sl(t.error)}}function rl(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 al(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=rl(t.lifecyclePhase);if(e==="terminal-error")return{kind:"error",source:"sandbox"};if(e==="booting")return{kind:"loading"};const n=t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData;return n&&t.lifecyclePhase==="checking-out"?{kind:"loading"}:[t.decofile,t.meta].some(i=>i.status==="error"&&!i.hasData&&i.errorStatus===404)?{kind:"empty",reason:"framework-missing"}:n?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 ol=S.lazy(()=>Hr(()=>import("./sections-editor-zQKRHCN0.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])).then(t=>({default:t.SectionsEditor})));function Ts(t){const e=ne.c(60),{virtualMcpId:n,externalSelection:r,onViewJsonFile:i}=t,u=r===void 0?null:r,{org:a}=yn(),{currentBranch:o,taskId:l}=It(),d=tr(),p=wn(),m=nr(),f=d.lifecycle.phase==="running",x=p.previewUrl;let v;e[0]!==o||e[1]!==a||e[2]!==x||e[3]!==l||e[4]!==n?(v=o?{orgSlug:a.slug,virtualMcpId:n,branch:o,threadId:l??null,previewUrl:x}:null,e[0]=o,e[1]=a,e[2]=x,e[3]=l,e[4]=n,e[5]=v):v=e[5];const E=v,g=kn(n,o);let k;e[6]!==f?(k={fetchEnabled:f},e[6]=f,e[7]=k):k=e[7];const j=Sn(E,k);let y;e[8]!==f?(y={fetchEnabled:f},e[8]=f,e[9]=y):y=e[9];const b=$s(E,y),w=al({lifecyclePhase:d.lifecycle.phase,decofile:Ns(j),meta:Ns(b),hasEditableContent:mo(j.data,b.data),fastPreviewActive:Gs(n).runtime==="cms"||Ys(g)}),T=Ks()===void 0,P=il;if(sa(g)){let C;return e[10]===Symbol.for("react.memo_cache_sentinel")?(C=P(s.jsx(oa,{})),e[10]=C):C=e[10],C}if(g.kind==="pending"&&g.retrying){let C;return e[11]!==g?(C=P(s.jsx(ia,{backend:g})),e[11]=g,e[12]=C):C=e[12],C}if(w.kind==="loading"||T){let C;return e[13]===Symbol.for("react.memo_cache_sentinel")?(C=P(s.jsx(Vr,{})),e[13]=C):C=e[13],C}if(j.data&&Va(b.data)){const C=m.state.target,H=C?.kind==="page"||C?.kind==="section"?C.key:null,A=H??"",J=o??"";let Y;return e[14]!==j.data||e[15]!==H||e[16]!==a.slug||e[17]!==A||e[18]!==J||e[19]!==n?(Y=P(s.jsx(ra,{orgSlug:a.slug,virtualMcpId:n,branch:J,decofile:j.data,initialKey:H,compact:!0},A)),e[14]=j.data,e[15]=H,e[16]=a.slug,e[17]=A,e[18]=J,e[19]=n,e[20]=Y):Y=e[20],Y}if(w.kind==="empty"){let C;return e[21]===Symbol.for("react.memo_cache_sentinel")?(C=P(s.jsx(la,{})),e[21]=C):C=e[21],C}if(w.kind==="error"){let C;e[22]!==j||e[23]!==p||e[24]!==b||e[25]!==w.source?(C=()=>{if(w.source==="sandbox"){p.retry();return}Promise.all([j.refetch(),b.refetch()])},e[22]=j,e[23]=p,e[24]=b,e[25]=w.source,e[26]=C):C=e[26];const H=C;let A;return e[27]!==H||e[28]!==w.source?(A=P(s.jsx(aa,{source:w.source,onRetry:H})),e[27]=H,e[28]=w.source,e[29]=A):A=e[29],A}let N;e[30]===Symbol.for("react.memo_cache_sentinel")?(N=C=>P(s.jsx("div",{className:"h-full min-h-0",children:C})),e[30]=N):N=e[30];const B=N,R=m.state.target;if(R?.kind==="loader"&&j.data&&b.data){const C=o??"",H=x??null;let A;return e[31]!==j.data||e[32]!==b.data||e[33]!==a.slug||e[34]!==C||e[35]!==H||e[36]!==R.key||e[37]!==n?(A=B(s.jsx(tl,{orgSlug:a.slug,virtualMcpId:n,branch:C,previewUrl:H,meta:b.data,decofile:j.data,blockKey:R.key})),e[31]=j.data,e[32]=b.data,e[33]=a.slug,e[34]=C,e[35]=H,e[36]=R.key,e[37]=n,e[38]=A):A=e[38],A}let D;e[39]!==o||e[40]!==a.slug||e[41]!==R||e[42]!==n?(D=R||!o?null:zs(Is(a.slug,n,o)),e[39]=o,e[40]=a.slug,e[41]=R,e[42]=n,e[43]=D):D=e[43];const O=D;let F="/",_=null,I=null;R?.kind==="page"?(F=R.path,_=R.key):R?.kind==="section"?I=R.key:O&&(F=O.path,_=O.pageKey);const U=_?`page:${_}`:I?`section:${I}`:`path:${F}`;let X;e[44]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx("div",{className:"h-full flex items-center justify-center",children:s.jsx(gt,{className:"size-5 text-muted-foreground"})}),e[44]=X):X=e[44];const z=o??"",q=x??void 0,te=I?null:u,ee=!!_&&m.state.editSeoPageKey===_;let ce;return e[45]!==I||e[46]!==_||e[47]!==F||e[48]!==U||e[49]!==i||e[50]!==a.slug||e[51]!==te||e[52]!==ee||e[53]!==z||e[54]!==q||e[55]!==n||e[56]!==m.consumeEditSeo||e[57]!==m.setFocusedBlock||e[58]!==m.setVariantOverride?(ce=B(s.jsx(S.Suspense,{fallback:X,children:s.jsx(ol,{orgSlug:a.slug,virtualMcpId:n,branch:z,previewReady:!0,previewUrl:q,currentPath:F,activePageBlockKey:_,activeGlobalBlockKey:I,externalSelection:te,initialEditSeo:ee,onExitSeo:m.consumeEditSeo,onVariantPreviewOverride:m.setVariantOverride,onFocusedBlockChange:m.setFocusedBlock,onViewJsonFile:i},U)})),e[45]=I,e[46]=_,e[47]=F,e[48]=U,e[49]=i,e[50]=a.slug,e[51]=te,e[52]=ee,e[53]=z,e[54]=q,e[55]=n,e[56]=m.consumeEditSeo,e[57]=m.setFocusedBlock,e[58]=m.setVariantOverride,e[59]=ce):ce=e[59],ce}function il(t){return s.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:t})}function Cs(t){const e=ne.c(39),{virtualMcpId:n,pageKey:r,onClose:i,ref:u}=t,a=_e(),o=Ks(),l=o===!0,d=qa(n);let p;e[0]!==d||e[1]!==r?(p=Wa(d,Eo(r)),e[0]=d,e[1]=r,e[2]=p):p=e[2];const m=p,{org:f}=yn(),{currentBranch:x,taskId:v}=It(),g=wn().previewUrl;let k;e[3]!==x||e[4]!==f.slug||e[5]!==g||e[6]!==v||e[7]!==n?(k=x?{orgSlug:f.slug,virtualMcpId:n,branch:x,threadId:v??null,previewUrl:g}:null,e[3]=x,e[4]=f.slug,e[5]=g,e[6]=v,e[7]=n,e[8]=k):k=e[8];const y=Sn(k),b=x??"";let w;e[9]!==f.slug||e[10]!==b||e[11]!==n?(w={orgSlug:f.slug,virtualMcpId:n,branch:b},e[9]=f.slug,e[10]=b,e[11]=n,e[12]=w):w=e[12];const{save:T,flush:P}=ca(w),N=y.data?.[r],B=y.data===void 0&&y.isLoading||o===void 0,R=y.data!==void 0&&N===void 0,D=!x||R||B;let O;e[13]!==N?(O=N===void 0?"":JSON.stringify(N,null,2),e[13]=N,e[14]=O):O=e[14];const F=O;let _;e[15]!==r||e[16]!==D||e[17]!==T?(_=te=>{if(D)return;let ee;try{ee=JSON.parse(te)}catch{return}ee===null||typeof ee!="object"||Array.isArray(ee)||T(r,ee)},e[15]=r,e[16]=D,e[17]=T,e[18]=_):_=e[18];const I=_;let U;e[19]!==P?(U=()=>({flush:P}),e[19]=P,e[20]=U):U=e[20],S.useImperativeHandle(u,U);let X;e[21]!==m||e[22]!==l||e[23]!==i||e[24]!==a?(X=l?s.jsx("div",{className:"flex shrink-0 items-center border-b px-3 py-2.5",children:s.jsx("span",{title:m,className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:m})}):s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[s.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:a("sectionsEditor.pageJsonDialog.titleShort")}),s.jsx(Xe,{variant:"ghost",size:"icon",onClick:i,"aria-label":a("sectionsEditor.pageJsonDialog.close"),className:"size-7 shrink-0",children:s.jsx(qr,{size:14})})]}),e[21]=m,e[22]=l,e[23]=i,e[24]=a,e[25]=X):X=e[25];let z;e[26]!==y.data||e[27]!==P||e[28]!==F||e[29]!==B||e[30]!==R||e[31]!==r||e[32]!==D||e[33]!==I||e[34]!==a?(z=B?s.jsx("div",{className:"flex flex-1 items-center justify-center",children:s.jsx(gt,{className:"size-5 text-muted-foreground"})}):R?s.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",a("sectionsEditor.pageJsonDialog.pageNotFound")]}):s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(Po,{code:F,language:"json",readOnly:D,height:"100%",onChange:te=>I(te??""),onSave:te=>{I(te),P()}},`${r}:${y.data===void 0?"loading":"ready"}`)}),e[26]=y.data,e[27]=P,e[28]=F,e[29]=B,e[30]=R,e[31]=r,e[32]=D,e[33]=I,e[34]=a,e[35]=z):z=e[35];let q;return e[36]!==X||e[37]!==z?(q=s.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[X,z]}),e[36]=X,e[37]=z,e[38]=q):q=e[38],q}function dr(t){return t.contentEditingEnabled&&!t.isMobile}function ll(t,e){return t!=="visual"?"visual":e?"blocks":"preview"}function cl(t,e){return t==="blocks"?"preview":e?"blocks":t}function dl(t){return dr({contentEditingEnabled:er(t.cmsMode),isMobile:t.isMobile})?"blocks":"preview"}function ul(t){return t.editingMode==="blocks"&&!t.blocksEditingEnabled||t.editingMode==="visual"&&!t.sandboxDisplay?"preview":t.editingMode}const fl=15e3;function ml(t,e,n){return n?t.src===e||t.loading?t:{src:e,loading:!0}:t.src===e&&!t.loading?t:{src:e,loading:!1}}function Rs(t){return t.loading?{...t,loading:!1}:t}const pl=500,hl={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},Ls=1,Ft=["desktop","mobile","tablet"],gl=["preview","visual","blocks"],_s={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function vl(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 ft(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function gn(t,e){try{return new URL(t,e).href}catch{return null}}function bl(t,e){if(!e.inPlaceRenderActive)return{pin:e.draftPreviewUrl?{path:e.resolvedPath,url:e.draftPreviewUrl}:null,effective:e.draftPreviewUrl};if(e.draftPreviewUrl!==null&&t?.path!==e.resolvedPath){const n={path:e.resolvedPath,url:e.draftPreviewUrl};return{pin:n,effective:n.url}}return{pin:t,effective:t?.url??null}}function xl(t,e){return!t||t.nav!==e.nav?!1:t.content!==e.content}function yl(t,e,n){const r=t.toLowerCase(),i=e.toLowerCase(),u=i.split("/").filter(Boolean),a=l=>{if(l===n)return 100;const d=l.indexOf(n);if(d===-1)return 0;let p=40;return d===0?p+=30:/[\s/-]/.test(l[d-1]??"")&&(p+=20),p+=Math.round(n.length/l.length*20),p};let o=Math.max(a(r),a(i));return u.at(-1)===n?o=Math.max(o,95):u.includes(n)&&(o=Math.max(o,90)),o}function wl(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function kl({virtualMcpId:t}){const e=_e(),n=ro(),{currentBranch:r,taskId:i,virtualMcpId:u}=It(),a=!!ga(),o=nr(),l=Oa(u===t?t:null),d=Gs(t),p=No(l?.metadata?.ui?.layout??null),m=er(p),f=dr({contentEditingEnabled:m,isMobile:n}),[x]=S.useState(()=>dl({cmsMode:p,isMobile:n})),[v,E]=ss(rs.previewEditingMode(t),c=>c&&gl.includes(c)?c:null),g=v??x,[k,j]=ss(rs.previewDeviceSize(t),c=>c&&Ft.includes(c)?c:"desktop"),[y,b]=S.useState(null),[w,T]=S.useState(null),P=S.useRef(null),N=S.useRef(null),[B,R]=S.useState(!1),D=S.useRef(null),O=()=>{D.current?.flush(),R(!1)},F=()=>R(c=>(c&&D.current?.flush(),!c)),[_,I]=S.useState({width:0,height:0}),[U,X]=S.useState(!1),[z,q]=S.useState(""),te=S.useRef(null),[ee,ce]=S.useState(!1),[C,H]=S.useState(),[A,J]=S.useState(null),[Y,Q]=S.useState(null),[he,se]=S.useState(null),[W,oe]=S.useState(()=>o.state.target?.kind==="page"?o.state.target.path:"/"),[ye,de]=S.useState(()=>o.state.target?.kind==="page"?o.state.target.key:null),[re,ue]=S.useState({}),[we,ae]=S.useState(!1),fe=S.useRef(null),ie=()=>{ae(!0),fe.current&&clearTimeout(fe.current),fe.current=setTimeout(()=>ae(!1),15e3)},Te=()=>{fe.current&&(clearTimeout(fe.current),fe.current=null),ae(!1)},{org:ke}=yn(),Me=tr(),ge=wn(),Ze=ge.vmEntry,vt=Me.lifecycle.phase,{url:Be,undecided:Ae}=Ga(t),Se=kn(t,r),{connection:$e}=Qs(t),Ce=jo(t),Re=Ja({hasServeConnection:!!$e,runtime:d.runtime}),Pe=Ae||Re==="github"&&(Ce==="loading"||Ce==="error"),ve=!Ys(Se)&&!Pe&&!(Re==="github"&&Se.kind==="pending"),M=Qe(Se)??Be,G=M??ge.previewUrl,Ke=!!M||vt==="running",et=l?.id===t?Fa(l.metadata):null,Ue=!M&&!Ae&&l?.id===t&&d.runtime==="cms",bt=d.projectDefault==="cms",tt=ve?bo({sandboxUrl:G,previewServerUrl:et,fastPreviewActive:Ue}):null,jn=t&&r?{orgSlug:ke.slug,virtualMcpId:t,branch:r,threadId:i??null,previewUrl:G}:null,Nn=Sn(jn,{fetchEnabled:Ke}),Tn=$s(jn,{fetchEnabled:Ke}),Z=Nn.data,be=Tn.data,He=Z?po(Z,be).sort((c,h)=>c.name.localeCompare(h.name)):[],Cn=t&&r?{orgSlug:ke.slug,virtualMcpId:t,branch:r}:null,Rn=Zi(Cn),Ut=Z&&be?ho(Z,be):[],Ln=ve&&Z&&be?da(be,Z,"loaders"):[],_n=z?(()=>{const c=z.toLowerCase();return He.map(h=>({page:h,score:yl(h.name,h.path,c)})).filter(({score:h})=>h>0).sort((h,L)=>L.score-h.score||h.page.path.length-L.page.path.length).map(({page:h})=>h)})():He,An=Ut.filter(c=>{if(!z)return!0;const h=z.toLowerCase();return c.name.toLowerCase().includes(h)||c.key.toLowerCase().includes(h)||c.resolveType.toLowerCase().includes(h)}),On=f?Ln:[],Dn=On.filter(c=>{if(!z)return!0;const h=z.toLowerCase();return c.title.toLowerCase().includes(h)||c.key.toLowerCase().includes(h)||c.resolveType.toLowerCase().includes(h)}),xt=Y?Ln.find(c=>c.key===Y)??null:null,Le=Pn,Ht=A||Y?null:go(He,W,ye),V=Ht?.key??null,Ve=o.state.target?.kind==="section"?o.state.target.key:o.state.focusedBlockKey??V,yt=Ht?.path??null,qe=(V?re[V]:void 0)??{},xe=Fe(W,qe),Vt={};if(ve&&Ke&&G&&be&&Z){const c=ua(be,"loaders"),h=V?Z[V]:void 0,L=ki(h,Z,le=>c.has(le)),K=vi(L);for(const le of ht(W)){if(le.type!=="param")continue;const De=pi(W,le.name,L),je=yi(De,c,K);je.length>0&&(Vt[le.name]=je)}}const wt=t&&r?{orgSlug:ke.slug,virtualMcpId:t,branch:r,threadId:i??null}:null,Bn=Z&&V?vo(Z,V,0):[],Fn=Z?fa(Bn,Z):[],qt=Fn.map(c=>c.isSavedBlock?c.label:""),Wt=Fn.map(c=>c.isSavedBlock?"global":c.isMultivariate?"variant":"normal"),Gt=Bn.map(c=>bn(c,Z??{})),kt=S.useRef(null),Ee=S.useRef(null),ur=Me.status.state==="paused",Jt=Me.phase,Mn=ma({claimPhase:Jt,lifecycle:Me.lifecycle}),ze=ge.previewState,fr=ge.userStopped,mr=Ya(ke.slug,t??""),{url:Oe}=yo(Ue&&t&&r?{orgSlug:ke.slug,virtualMcpId:t,branch:r,previewServerUrl:et??null,path:xe}:null),pr=bt&&d.runtime==="sandbox",Yt=Qa(Se,Re,Ce),$=Qo({previewState:ze,progressStatus:Mn.status,previewServerUrl:et,fastPreviewActive:Ue,fastPreviewReady:!!Oe,codingSession:pr,localPreviewUrl:M,hostedDraft:Yt,deciding:Pe}),hr=$.showWakingPill||Yt&&$.mode==="production"&&!Oe,nt=$.mode!=="none",gr=$.mode==="production"&&$.iframeBase?ft($.iframeBase):null,We=$.mode==="production"?gr:ft(G),vr=l?.id===t&&l.metadata?.fastPreviewInPlace===!0,st=ve?M?$.mode==="sandbox"&&f&&g==="blocks":$.mode==="production"&&Ue&&vr&&f&&g==="blocks":!1,$n=S.useRef(null),{pin:br,effective:xr}=bl($n.current,{inPlaceRenderActive:st,draftPreviewUrl:Oe,resolvedPath:xe});$n.current=br;const Kn=o.state.variantOverride??[],St=ve?Kn:[],Qt=ve?[]:Kn,yr=$e&&Qe(Se)?ao($e.endpoint,Qt)??fs:null,Ge=vl($.mode==="sandbox"?At(vs(ms(he??gn(xe,$.iframeBase)??$.iframeBase,yr),k),St):$.mode==="production"?At(vs(cs(ms(he??xr??gn(xe,$.iframeBase)??$.iframeBase,hr?fs:null),Qt),k),St):null),zn=Oe??($.iframeBase?gn(xe,$.iframeBase):null),wr=$.mode==="production"?zn?At(cs(zn,Qt),St):null:Ge??$.iframeBase,kr=()=>{const c=wr;c&&window.open(c,"_blank","noopener")},rt=t&&r?Is(ke.slug,t,r):null,at=c=>{rt&&ba(rt,c)},me=o.state.target;S.useEffect(()=>{if(!(!me||!tt||!be))if(me.kind==="page"){const c=re[me.key]??{};Ee.current=Fe(me.path,c),J(null),Q(null),se(null),de(me.key),oe(me.path),at({path:me.path,pageKey:me.key,params:c})}else if(me.kind==="loader")Ee.current=null,J(null),Q(me.key),se(null);else{const c=Ut.find(h=>h.key===me.key);if(c){Ee.current=null;const h=us(be);Q(null),J(c),se(ps(tt,h,c.key))}}},[me,tt,be,re]),S.useEffect(()=>{!V||yt===null||me?.kind==="page"&&me.key===V&&me.path===yt||o.selectTarget({kind:"page",key:V,path:yt})},[V,yt,me]);const[In,Sr]=S.useState(null);if(ze.kind==="iframe"&&In!==ze.previewUrl){const c=In!==null;Sr(ze.previewUrl);const h=rt?zs(rt):null;if(h){if(Ee.current=Fe(h.path,h.params),oe(h.path),de(h.pageKey),se(null),J(null),Q(null),h.pageKey&&Object.keys(h.params).length>0){const L=h.pageKey;ue(K=>({...K,[L]:h.params}))}}else c&&(Ee.current=null,oe("/"),se(null),de(null),J(null),Q(null))}kt.current=Ge;const Pr=$.mode==="production"&&!!Oe&&!M,[Un,Xt]=S.useState({src:Ge??void 0,loading:!1}),Pt=ml(Un,Ge??void 0,Pr);Pt!==Un&&Xt(Pt);const ot=Pt.src,Hn=Pt.loading,Vn=ti({iframeRef:P,src:$.mode==="sandbox"?Ge:null,active:$.mode==="sandbox"}),qn=S.useRef(null);S.useEffect(()=>{const c=Hn?setTimeout(()=>Xt(Rs),fl):null,h=()=>{c&&clearTimeout(c)};if(!Oe||!ot||qn.current===Oe)return h;qn.current=Oe;const L=P.current;return L&&L.getAttribute("src")!==ot&&(ie(),L.src=ot),h},[Oe,ot,Hn]);const Wn=()=>{const c=P.current?.contentWindow,h=We;if(!c||!h||!Z||!V)return;const L=Z[V];if(!L||typeof L!="object")return;const K=xo({previewBaseUrl:h,pageBlock:L,decofile:Z,path:xe,pathTemplate:W});if(!K)return;const le=At(K.src,oo(St,V));c.postMessage({type:"cms-editor::render",src:le,body:K.body},h)},Zt=S.useRef(null);S.useEffect(()=>{if(!st||A||Y||!V||!Z){Zt.current=null;return}const c={nav:JSON.stringify({page:V,path:xe,pathTemplate:W}),content:JSON.stringify(Z)},h=xl(Zt.current,c);Zt.current=c,h&&Wn()},[Z,st,A,Y,V,xe,W]);const en=S.useRef(null);S.useEffect(()=>{if(!st||A||Y||!V||!Z){en.current=null;return}const c=JSON.stringify(o.state.variantOverride??null),h=en.current;en.current={page:V,sig:c},!(!h||h.page!==V||h.sig===c)&&Wn()},[o.state.variantOverride,st,A,Y,V]);const Er=!!t&&!!r&&!Me.notFound&&!fr&&!ur&&(Jt?.kind==="ready"||vt!=="idle"),pe=ul({editingMode:g,sandboxDisplay:$.mode==="sandbox",blocksEditingEnabled:f});S.useEffect(()=>{const c=We;if(!c)return;const h=L=>{if(L.origin===c)if(L.data?.type==="visual-editor::element-clicked"){const K=ai.safeParse(L.data.payload);K.success&&b(K.data)}else if(L.data?.type==="cms-editor::section-clicked"){const K=li.safeParse(L.data.payload);K.success&&T({index:K.data.sectionIndex,seq:K.data.clickSeq})}else L.data?.type==="cms-editor::render-start"?ie():L.data?.type==="cms-editor::render-end"?(Te(),P.current?.contentWindow?.postMessage({type:"cms-editor::set-labels",labels:qt,kinds:Wt,keys:Gt},c)):L.data?.type==="cms-editor::render-error"&&Te()};return window.addEventListener("message",h),()=>window.removeEventListener("message",h)},[We,qt,Wt,Gt]);const Gn=()=>{const c=P.current?.contentWindow,h=ft(G);!c||!h||c.postMessage({type:"visual-editor::activate",script:oi},h)},jr=()=>{const c=P.current?.contentWindow,h=ft(G);!c||!h||c.postMessage({type:"visual-editor::deactivate"},h)},tn=()=>{const c=P.current?.contentWindow,h=We;!c||!h||(c.postMessage($.mode==="production"||M?{type:"editor::inject",args:{script:Ss}}:{type:"visual-editor::activate",script:Ss},h),c.postMessage({type:"cms-editor::set-labels",labels:qt,kinds:Wt,keys:Gt},h))},Nr=()=>{const c=P.current?.contentWindow,h=We;!c||!h||c.postMessage({type:"cms-editor::deactivate"},h)},Tr=()=>{const c=P.current?.contentWindow,h=We;!c||!h||(c.postMessage({type:"cms-editor::clear-hover"},h),c.postMessage({type:"visual-editor::clear-hover"},h))},Et=c=>{if(c==="blocks"&&!f)return;const h=g;!n&&c!==h&&(c==="blocks"?N.current?.resize("30%"):N.current?.collapse()),E(c),b(null),T(null),c!=="blocks"&&Q(null),h==="visual"&&jr(),c==="visual"&&Gn(),h==="blocks"&&c!=="blocks"&&Nr(),c==="blocks"&&tn()},Cr=()=>{Et(ll(g,f))},Rr=()=>{Et(cl(g,f))},nn=()=>{const c=P.current;if(!c)return;ie();const h=document.activeElement,L=c.tabIndex;c.tabIndex=-1,c.style.pointerEvents="none",c.blur(),wl(c,kt.current);let K;const le=()=>{clearTimeout(K),c.tabIndex=L,c.style.pointerEvents="";const De=document.activeElement;(!De||De===document.body||De===c)&&h?.focus(),c.removeEventListener("load",le)};c.addEventListener("load",le),K=setTimeout(le,3e3)};ko(nn);const jt=Xa(ke.slug,t??""),Nt=Yt&&nt&&!!t,Jn=S.useRef(null);S.useEffect(()=>{if(Nt)return Za(jt)},[Nt,jt]);const{reload:it}=eo(ke.slug,t??""),Yn=S.useRef(it.seq);S.useEffect(()=>{if(Yn.current!==it.seq&&(Yn.current=it.seq,!!Nt&&Jn.current===kt.current)){if(it.navigates){ls(jt);return}nn()}},[it.seq]);const Lr=to(Cn),lt=no(Qe(Se)?Lr:""),Qn=S.useRef(lt);S.useEffect(()=>{const c=Qn.current;if(Qn.current=lt,!c||!lt||c===lt)return;const h=P.current;if(h)return ri({iframe:h,reload:nn})},[lt]);const _r=()=>{const c=Ft.indexOf(k);j(Ft[(c+1)%Ft.length])},sn=(c,h)=>{if(!V)return;const L=V,K={...qe,[c]:h};Ee.current=Fe(W,K),ue(le=>({...le,[L]:K})),at({path:W,pageKey:L,params:K})},Ar=Yi({iframeBase:$.iframeBase,resolvedPath:xe,activeGlobalSectionName:A?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Xn=c=>{const h=re[c.key]??{},L=Fe(c.path,h);(A||Le(L)!==Le(xe))&&ie(),Ee.current=L,J(null),Q(null),se(null),T(null),de(c.key),oe(c.path),at({path:c.path,pageKey:c.key,params:h}),o.selectTarget({kind:"page",key:c.key,path:c.path})};va(rt,c=>{(A||Le(c)!==Le(xe))&&ie(),Ee.current=c,J(null),Q(null),se(null),T(null),de(null),oe(c),at({path:c,pageKey:null,params:{}})});const Or=c=>{if(!tt||!be){os.error(e("sandbox.preview.previewMetadataNotReady"));return}ie(),Ee.current=null;const h=us(be),L=ps(tt,h,c.key);J(c),Q(null),se(L),T(null),o.selectTarget({kind:"section",key:c.key})},Dr=c=>{f&&(J(null),Q(c.key),se(null),Et("blocks"),o.selectTarget({kind:"loader",key:c.key}))},Br=async({name:c,path:h,templateKey:L})=>{if(!t||!r)return;const K=Zs(h);if(K){H(K);return}const le=h.trim().startsWith("/")?h.trim():`/${h.trim()}`;if(He.some(je=>Le(je.path)===Le(le))){H(e("sandbox.preview.pageAlreadyExists",{path:le}));return}let De;if(L&&(De=Z?.[L],!De)){H(e("sandbox.preview.templateNoLongerExists"));return}H(void 0);try{const je=await Rn.mutateAsync({name:c,path:le,template:De});ce(!1),os.success(e("sandbox.preview.pageCreated",{name:c})),await To(pl),Xn({key:je.key,name:je.name,path:je.path}),Et("blocks")}catch(je){H(je instanceof Error?je.message:e("sandbox.preview.failedToCreatePage"))}},Tt=Qi({previewSurfaceActive:nt,daemonReady:Er,production:$.mode==="production",servePreviewUrl:Qe(Se)}),Fr=Xi({showPreviewToolbar:Tt,contentEditingEnabled:m}),Ct=()=>{X(!1),q("")},rn=A?.name??xt?.title??Ht?.name,an=Nn.isPending||Tn.isPending,on=an?ft($.iframeBase):rn,Rt=A?`section:${A.key}`:Y?`loader:${Y}`:V?`page:${V}`:void 0,Mr=Tt?Fr?s.jsxs(La,{open:U,onOpenChange:c=>{X(c),c||q("")},children:[s.jsx(_a,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":e("sandbox.preview.choosePage"),"data-testid":"preview-page-picker",title:an?on??void 0:A||xt?rn:[rn,W].filter(Boolean).join(" · "),className:"group/page-picker flex h-7 w-fit min-w-[320px] items-stretch overflow-hidden whitespace-nowrap rounded-[var(--studio-button-radius,calc(var(--radius)*1.333))] border border-border/60 bg-background text-left text-xs text-muted-foreground transition-colors hover:border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:s.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 px-2 transition-colors group-hover/page-picker:bg-accent/50 group-data-[state=open]/page-picker:bg-accent/50",children:[A&&s.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:[s.jsx(Sa,{size:11}),e("sandbox.preview.globalBadge")]}),xt&&s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[s.jsx(Pa,{size:11}),e("sandbox.preview.loaderBadge")]}),on&&s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:on}),!an&&!A&&!xt&&s.jsx("span",{"data-testid":"preview-page-path",className:"ml-auto min-w-0 truncate text-right font-mono text-muted-foreground",children:W}),s.jsx(xa,{size:12,className:Mt("shrink-0 transition-transform",U&&"rotate-180")})]})})}),s.jsxs(Aa,{className:"w-112 max-w-[calc(100vw-2rem)] p-0",align:"center",sideOffset:8,children:[s.jsxs(Vs,{shouldFilter:!1,defaultValue:Rt,children:[s.jsx(qs,{value:z,onValueChange:c=>{q(c),te.current?.scrollTo({top:0})},placeholder:e("sandbox.preview.searchPagesAndComponents")}),s.jsxs(Hs,{ref:te,className:"max-h-80",children:[s.jsx(Ws,{children:He.length===0&&Ut.length===0&&On.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}),_n.length>0&&s.jsx(mt,{children:_n.map(c=>s.jsxs(pt,{value:`page:${c.key}`,"aria-current":Rt===`page:${c.key}`||void 0,title:`${c.name} · ${c.path}`,onSelect:()=>{Ct(),Xn(c)},className:"gap-3 px-3 py-2.5 aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:c.name}),s.jsx("span",{className:"min-w-0 max-w-1/2 truncate text-right font-mono text-xs text-muted-foreground",children:c.path})]},c.key))}),An.length>0&&s.jsx(mt,{heading:e("sandbox.preview.globalComponents"),children:An.map(c=>s.jsx(pt,{value:`section:${c.key}`,"aria-current":Rt===`section:${c.key}`||void 0,className:"aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",onSelect:()=>{Ct(),Or(c)},children:s.jsx("span",{className:"truncate",children:c.name})},c.key))}),Dn.length>0&&s.jsx(mt,{heading:e("sandbox.preview.globalLoaders"),children:Dn.map(c=>s.jsx(pt,{value:`loader:${c.key}`,"aria-current":Rt===`loader:${c.key}`||void 0,className:"aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",onSelect:()=>{Ct(),Dr(c)},children:s.jsx("span",{className:"truncate",children:c.title})},c.key))})]})]}),!A&&!Y&&ht(W).some(c=>c.type!=="text")&&s.jsx("div",{className:"flex flex-wrap items-center gap-1 border-t px-3 py-3 text-xs text-muted-foreground",children:ht(W).map((c,h)=>{if(c.type==="text")return s.jsx("span",{children:c.text},`text-${h}`);const L=Vt[c.name];return L&&wt?s.jsx(Fi,{sources:L,template:W,paramName:c.name,value:qe[c.name]??"",sandboxRef:wt,onCommit:K=>sn(c.name,K)},`${V}:${c.name}`):s.jsx(Gi,{name:c.name,value:qe[c.name]??"",onCommit:K=>sn(c.name,K)},`${V}:${c.name}`)})}),s.jsx("div",{className:"border-t p-1.5",children:s.jsxs(Xe,{variant:"ghost",className:"w-full justify-start",onClick:()=>{Ct(),H(void 0),ce(!0)},children:[s.jsx(Ra,{size:16}),e("sandbox.preview.createNewPage")]})})]})]}):s.jsx("span",{className:"min-w-0 truncate text-xs text-muted-foreground",children:Ar}):null,Zn=Tt||m?s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[s.jsxs(dn,{children:[s.jsx(un,{asChild:!0,children:s.jsx(ct,{onClick:_r,"aria-label":e(_s[k]),children:k==="mobile"?s.jsx(Ea,{size:16}):k==="tablet"?s.jsx(ja,{size:16}):s.jsx(Na,{size:16})})}),s.jsx(fn,{children:e(_s[k])})]}),Mr,s.jsx("div",{className:"flex shrink-0 items-center gap-1",children:s.jsx(ct,{onClick:kr,"aria-label":e("sandbox.preview.openInNewTab"),children:s.jsx(Wr,{size:16})})})]}):null,$r=(ve||a)&&$.mode==="sandbox",Lt=hl[k],_t=k==="desktop"&&(_.width===0||_.width>=Lt.width+2*Ls),es=_t?1:Math.min(_.width>0?_.width/(Lt.width+2*Ls):1,1),Kr=_t?{width:"100%",height:"100%"}:{width:`${Lt.width}px`,height:_.height>0?`${_.height/es}px`:`${Lt.height}px`,transform:`scale(${es})`,transformOrigin:"top center"},ts=s.jsxs(s.Fragment,{children:[$r&&(Tt||m)&&s.jsx(ct,{onClick:Cr,"aria-pressed":pe==="visual","aria-label":e("sandbox.preview.visualEditor"),active:pe==="visual",children:s.jsx(is,{size:16})}),f&&s.jsxs(dn,{children:[s.jsx(un,{asChild:!0,children:s.jsx(ct,{onClick:Rr,"aria-pressed":pe==="blocks","aria-label":e("sandbox.preview.blocksEditor"),active:pe==="blocks",children:s.jsx(Ca,{size:16})})}),s.jsx(fn,{children:e("sandbox.preview.blocksEditor")})]}),Ve&&s.jsxs(dn,{children:[s.jsx(un,{asChild:!0,children:s.jsx(ct,{onClick:F,"aria-pressed":B,"aria-label":e("sectionsEditor.sectionsEditor.viewJson"),active:B,children:s.jsx(Ta,{size:16})})}),s.jsx(fn,{children:e("sectionsEditor.sectionsEditor.viewJson")})]})]}),zr=!!Y&&pe==="blocks";return s.jsxs("div",{className:"flex flex-col w-full h-full",children:[wt&&Object.entries(Vt).map(([c,h])=>(qe[c]??"")===""?s.jsx(qi,{sources:h,template:W,paramName:c,sandboxRef:wt,onFill:L=>sn(c,L)},`${V}:${c}`):null),s.jsxs(s.Fragment,{children:[s.jsx(as.Toolbar.Center.Portal,{fallback:s.jsx("div",{className:"flex min-w-0 items-center justify-center border-b p-2",children:Zn}),children:Zn}),s.jsx(as.Toolbar.Right.Portal,{fallback:ts,children:ts})]}),s.jsx("div",{className:"flex-1 overflow-hidden relative",children:zr?s.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[s.jsx(Ts,{virtualMcpId:t,externalSelection:w,onViewJsonFile:F}),B&&Ve&&s.jsx("div",{className:"absolute inset-0 z-10",children:s.jsx(Cs,{ref:D,virtualMcpId:t,pageKey:Ve,onClose:O})})]}):s.jsxs(hs,{orientation:"horizontal",disabled:pe!=="blocks",className:"relative isolate",children:[s.jsx(Ot,{ref:N,id:"preview-blocks-editor",defaultSize:pe==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:pe==="blocks"&&s.jsx(Ts,{virtualMcpId:t,externalSelection:w,onViewJsonFile:F})}),pe==="blocks"&&s.jsx(gs,{withHandle:!0}),s.jsx(Ot,{id:"preview-canvas",defaultSize:pe==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden relative z-0",children:s.jsxs(hs,{orientation:"horizontal",disabled:!(B&&Ve),children:[s.jsx(Ot,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:s.jsxs("div",{ref:c=>{if(!c)return;const h=()=>I(K=>K.width===c.clientWidth&&K.height===c.clientHeight?K:{width:c.clientWidth,height:c.clientHeight});h();const L=new ResizeObserver(h);return L.observe(c),()=>L.disconnect()},className:Mt("h-full relative overflow-clip flex justify-center",nt&&!_t&&"bg-muted/30"),children:[(we||mr)&&nt&&s.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:s.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),$.showDecidingLoader&&s.jsx("div",{"data-testid":"preview-deciding",className:"absolute inset-0 z-30 flex items-center justify-center",children:s.jsx(gt,{className:"size-5 text-muted-foreground"})}),$.showBlockingOverlay&&s.jsx("div",{className:"absolute inset-0 z-30",children:s.jsx(cn,{kind:"starting",progress:Mn,claimPhase:Jt})}),!M&&!Pe&&ze.kind==="suspended"&&s.jsx("div",{className:"absolute inset-0 z-30",children:s.jsx(cn,{kind:"suspended",onResume:ge.resume})}),!M&&!Pe&&ze.kind==="errored"&&s.jsx("div",{className:"absolute inset-0 z-30",children:s.jsx(cn,{kind:"errored",error:ze.error,onRetry:ge.retry,connectionsHref:`/${ke.slug}/settings/connections`})}),$.showWakingPill&&s.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:[s.jsx(gt,{className:"size-4.5 mt-0.5 shrink-0 text-muted-foreground"}),s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),s.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),pe==="visual"&&!y&&s.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:[s.jsx(is,{size:12}),e("sandbox.preview.clickElementToAsk")]}),pe==="visual"&&y&&s.jsx(ui,{element:y,onDismiss:()=>b(null)}),nt&&Ge&&s.jsx("div",{className:Mt("shrink-0",!_t&&"border-x border-border bg-background shadow-sm"),style:Kr,onMouseLeave:Tr,children:s.jsx("iframe",{ref:P,src:ot,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Vn.handleError,onLoad:()=>{if(Xt(Rs),Vn.handleLoad(),Te(),Jn.current=kt.current,Nt&&ls(jt),$.mode!=="sandbox"||M){($.mode==="production"&&!$.showWakingPill||M)&&pe==="blocks"&&tn();return}if(Gr("vm_preview_loaded",{view_mode:pe,vm_id:Ze?.sandboxHandle??null}),!A)try{const c=P.current?.contentWindow?.location?.pathname;if(!c)return;const h=Ee.current;if(h!==null&&(Ee.current=null,Le(c)!==Le(h))||Le(c)===Le(xe))return;oe(c),at({path:c,pageKey:ye,params:qe})}catch{}pe==="visual"&&Gn(),pe==="blocks"&&tn()}},$.iframeBase)})]})}),B&&Ve&&s.jsxs(s.Fragment,{children:[s.jsx(gs,{withHandle:!0}),s.jsx(Ot,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:s.jsx(Cs,{ref:D,virtualMcpId:t,pageKey:Ve,onClose:O})})]})]})})]})}),s.jsx(el,{open:ee,onOpenChange:ce,isPending:Rn.isPending,error:C,templates:He,onSubmit:Br})]})}const Sl=async(t,e)=>{try{return await fetch(t,{method:"HEAD",mode:"no-cors",cache:"no-store",credentials:"omit",signal:e}),!0}catch{return!1}},Pl=1e4,El=1e4,jl=5e3,Nl=2;function Tl(t,e){return t&&e===0?El:Math.min(1e3*2**Math.max(0,e-1),jl)}function Cl(t,e,n){return e?!0:t===!0&&n<Nl}function Rl(t,e){const n=ne.c(11),r=Sl,i=Jr();let u;n[0]!==t?(u=Ds.localAppReachable(t??""),n[0]=t,n[1]=u):u=n[1];const a=u;let o;n[2]!==r||n[3]!==i||n[4]!==a||n[5]!==t?(o=async m=>{const{signal:f}=m,x=new AbortController,v=()=>x.abort();f.addEventListener("abort",v);const E=setTimeout(v,Pl),g=await r(t,x.signal).catch(_l);clearTimeout(E),f.removeEventListener("abort",v);const k=i.getQueryData(a),j=g?0:(k?.failures??0)+1;return{up:Cl(k?.up??null,g,j),failures:j}},n[2]=r,n[3]=i,n[4]=a,n[5]=t,n[6]=o):o=n[6];const l=!!t;let d;n[7]!==a||n[8]!==o||n[9]!==l?(d={queryKey:a,queryFn:o,enabled:l,retry:!1,staleTime:0,gcTime:0,refetchInterval:Ll},n[7]=a,n[8]=o,n[9]=l,n[10]=d):d=n[10];const{data:p}=Yr(d);return t?p?.up??null:null}function Ll(t){return t.state.data?Tl(t.state.data.up,t.state.data.failures):!1}function _l(){return!1}function Al(t){const{backend:e}=t;if(e.kind==="protocol"&&e.source==="local")return{kind:"connected"};if(e.kind==="unavailable"&&e.source==="local"){const n=e.problem;return!n||n.reason==="not-answering"?t.access==="denied"?{kind:"needs-permission"}:{kind:"not-running"}:{kind:"problem",problem:n}}return{kind:"connecting"}}function Pc(t){const e=ne.c(48),{virtualMcpId:n}=t,r=_e(),i=Da(n),{connection:u}=Qs(n),{activeTask:a,taskId:o,currentBranch:l}=It(),d=Do(o),[p,m]=S.useState(!1),f=kn(n,l);let x;e[0]!==f||e[1]!==u?(x=u?Qe(f):null,e[0]=f,e[1]=u,e[2]=x):x=e[2];const v=x,E=Rl(v),g=rr();if(Lo({threadId:o,sandboxBranch:a?.branch??l,agentHasRepo:mn(i?.metadata),threadHasRepo:mn(d)||mn(a?.metadata)})==="none"&&!u){let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:s.jsx(bs,{className:"size-7 text-foreground"})}),e[3]=y):y=e[3];let b;e[4]!==r?(b=r("mainPanelTabs.previewTab.noSourceToPreview"),e[4]=r,e[5]=b):b=e[5];let w;e[6]!==r?(w=r("mainPanelTabs.previewTab.connectGithubDescription"),e[6]=r,e[7]=w):w=e[7];let T,P;e[8]===Symbol.for("react.memo_cache_sentinel")?(T=()=>m(!0),P=s.jsx(bs,{className:"size-4"}),e[8]=T,e[9]=P):(T=e[8],P=e[9]);let N;e[10]!==r?(N=r("mainPanelTabs.previewTab.connectGithub"),e[10]=r,e[11]=N):N=e[11];let B;e[12]!==N?(B=s.jsxs(Xe,{onClick:T,children:[P,N]}),e[12]=N,e[13]=B):B=e[13];let R;e[14]!==b||e[15]!==w||e[16]!==B?(R=s.jsx(Co,{className:"h-full",image:y,title:b,description:w,actions:B}),e[14]=b,e[15]=w,e[16]=B,e[17]=R):R=e[17];let D;e[18]!==p?(D=s.jsx(Ro,{open:p,onOpenChange:m,mode:"agent"}),e[18]=p,e[19]=D):D=e[19];let O;return e[20]!==D||e[21]!==R?(O=s.jsxs(s.Fragment,{children:[R,D]}),e[20]=D,e[21]=R,e[22]=O):O=e[22],O}if(u&&i&&!Qe(f)){let y;e[23]!==g||e[24]!==f?(y=Al({backend:f,access:g}),e[23]=g,e[24]=f,e[25]=y):y=e[25];let b;e[26]!==u.endpoint?(b=so(u.endpoint),e[26]=u.endpoint,e[27]=b):b=e[27];let w;return e[28]!==y||e[29]!==b?(w=s.jsx(Dl,{status:y,host:b}),e[28]=y,e[29]=b,e[30]=w):w=e[30],w}if(v&&E!==!0){let y;e[31]!==r?(y=r("mainPanelTabs.previewTab.localAppWaiting.title"),e[31]=r,e[32]=y):y=e[32];let b;e[33]!==v||e[34]!==r?(b=r("mainPanelTabs.previewTab.localAppWaiting.body",{host:Ol(v)}),e[33]=v,e[34]=r,e[35]=b):b=e[35];let w;e[36]!==b?(w=s.jsx(Kt,{text:b}),e[36]=b,e[37]=w):w=e[37];let T;e[38]!==r?(T=r("mainPanelTabs.previewTab.localAppWaiting.hint"),e[38]=r,e[39]=T):T=e[39];let P;e[40]!==T?(P=s.jsx("p",{role:"status",className:"text-center text-sm text-muted-foreground",children:T}),e[40]=T,e[41]=P):P=e[41];let N;return e[42]!==y||e[43]!==w||e[44]!==P?(N=s.jsx(zt,{headingLevel:2,waiting:!0,title:y,lead:w,footer:P}),e[42]=y,e[43]=w,e[44]=P,e[45]=N):N=e[45],N}let j;return e[46]!==n?(j=s.jsx(pa,{children:s.jsx(kl,{virtualMcpId:n})}),e[46]=n,e[47]=j):j=e[47],j}function Ol(t){try{return new URL(t).host}catch{return t}}function Dl(t){const e=ne.c(20),{status:n,host:r}=t,i=_e();if(n.kind==="connected"){let o;e[0]!==i?(o=i("mainPanelTabs.previewTab.localhostNoPreview.title"),e[0]=i,e[1]=o):o=e[1];let l;e[2]!==i?(l=i("mainPanelTabs.previewTab.localhostNoPreview.body"),e[2]=i,e[3]=l):l=e[3];let d;e[4]!==l?(d=s.jsx(Kt,{text:l}),e[4]=l,e[5]=d):d=e[5];let p;e[6]!==i?(p=i("mainPanelTabs.previewTab.localhostNoPreview.step.title"),e[6]=i,e[7]=p):p=e[7];let m;e[8]!==p?(m=[{title:p,command:`${Js} --preview localhost:3000`}],e[8]=p,e[9]=m):m=e[9];let f;return e[10]!==o||e[11]!==d||e[12]!==m?(f=s.jsx(zt,{headingLevel:2,waiting:!1,title:o,lead:d,steps:m}),e[10]=o,e[11]=d,e[12]=m,e[13]=f):f=e[13],f}let u;e[14]!==r||e[15]!==n?(u=Ko(n,r),e[14]=r,e[15]=n,e[16]=u):u=e[16];let a;return e[17]!==r||e[18]!==u?(a=s.jsx($o,{wait:u,hosts:r}),e[17]=r,e[18]=u,e[19]=a):a=e[19],a}export{$o as L,Pc as P,zt as S,Sc as u};
551
+ `)}function di(t,e,n=320,r=44,i=12){const{x:u,y:a}=t,{width:o,height:l}=e,d=Math.max(i,Math.min(u-n/2,o-n-i)),m=a/l>.68?Math.max(i,a-r-18):Math.min(a+18,l-r-i);return{leftPct:d/o*100,topPct:m/l*100}}function ui(t){const e=ne.c(45),{element:n,onDismiss:r}=t,[i,u]=S.useState(""),a=S.useRef(null),{sendMessage:o}=ha(),{openSidePanel:l}=wo(),d=_e();let p;e[0]!==n||e[1]!==i||e[2]!==r||e[3]!==l||e[4]!==o?(p=()=>{if(!i.trim())return;const U=ci(n,i);l(),o({parts:[{type:"text",text:U}]}),r()},e[0]=n,e[1]=i,e[2]=r,e[3]=l,e[4]=o,e[5]=p):p=e[5];const m=p;let f;e[6]!==n.position||e[7]!==n.viewport?(f=di(n.position,n.viewport),e[6]=n.position,e[7]=n.viewport,e[8]=f):f=e[8];const x=f,v=`${x.leftPct}%`,E=`${x.topPct}%`;let g;e[9]!==v||e[10]!==E?(g={left:v,top:E,width:"320px"},e[9]=v,e[10]=E,e[11]=g):g=e[11];let k;e[12]!==m?(k=U=>{U.preventDefault(),m()},e[12]=m,e[13]=k):k=e[13];let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=U=>u(U.target.value),e[14]=j):j=e[14];let y;e[15]!==r?(y=U=>{U.key==="Escape"&&r()},e[15]=r,e[16]=y):y=e[16];let b;e[17]!==d?(b=d("sandbox.visualEditorPrompt.inputPlaceholder"),e[17]=d,e[18]=b):b=e[18];let w;e[19]!==i||e[20]!==y||e[21]!==b?(w=s.jsx("input",{ref:a,autoFocus:!0,type:"text",value:i,onChange:j,onKeyDown:y,placeholder:b,className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"}),e[19]=i,e[20]=y,e[21]=b,e[22]=w):w=e[22];let T;e[23]!==i?(T=i.trim(),e[23]=i,e[24]=T):T=e[24];const P=!T;let N;e[25]!==d?(N=d("sandbox.visualEditorPrompt.sendButton"),e[25]=d,e[26]=N):N=e[26];let B;e[27]!==d?(B=d("sandbox.visualEditorPrompt.sendButton"),e[27]=d,e[28]=B):B=e[28];let R;e[29]!==B?(R=s.jsx("title",{children:B}),e[29]=B,e[30]=R):R=e[30];let D;e[31]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e[31]=D):D=e[31];let O;e[32]!==R?(O=s.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[R,D]}),e[32]=R,e[33]=O):O=e[33];let F;e[34]!==P||e[35]!==N||e[36]!==O?(F=s.jsx("button",{type:"submit",disabled:P,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg bg-foreground text-background transition-opacity disabled:opacity-30",title:N,children:O}),e[34]=P,e[35]=N,e[36]=O,e[37]=F):F=e[37];let _;e[38]!==w||e[39]!==F||e[40]!==k?(_=s.jsxs("form",{className:"pointer-events-auto flex w-full items-center gap-1.5 rounded-xl border border-border bg-background/95 px-3 py-1.5 shadow-lg backdrop-blur",onSubmit:k,children:[w,F]}),e[38]=w,e[39]=F,e[40]=k,e[41]=_):_=e[41];let I;return e[42]!==_||e[43]!==g?(I=s.jsx("div",{className:"absolute z-30 pointer-events-none",style:g,children:_}),e[42]=_,e[43]=g,e[44]=I):I=e[44],I}const Ps="site-links",fi=/details?page|\bpdp\b/i,mi=/listingpage|\bplp\b/i;function pi(t,e,n){const r=new Set;for(const o of n)fi.test(o)&&r.add("product"),mi.test(o)&&r.add("category");const i=ht(Pn(t)),u=i[i.length-1],a=i[i.length-2];return u?.type==="text"&&u.text==="/p"&&a?.type==="param"&&a.name===e&&r.add("product"),e==="*"&&i.some(o=>o.type==="param"&&o.name==="*")&&r.add("category"),r}const hi=["rosa","preto","pink","black"];function Dt(t,e){const n=e.trim();return n?t(n):hi.flatMap(r=>t(r))}function gi(t,e){const n=e.trim(),r=[];/^\d+$/.test(n)&&r.push({resolveType:t,props:{ids:[n]}});const u=n.includes("-")&&!/\s/.test(n)?n.replace(/-+/g," "):n;return r.push({resolveType:t,props:{query:u,count:10}}),r}const ar=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function En(t){return t.split("/")[0]??""}function vi(t){const e=new Set;for(const n of t){const r=En(n);ar.has(r)&&e.add(r)}return e}function bi(t,e){const n=En(t);return!ar.has(n)||e.size===0?!0:e.has(n)}const xi=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>Dt(n=>gi(t,n),e),optionsFromPayload:Bt},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Dt(n=>[{resolveType:t,props:{props:{search:n,pageSize:10,currentPage:1}}}],e),optionsFromPayload:Bt},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Dt(n=>[{resolveType:t,props:{term:n,hitsPerPage:10}}],e),optionsFromPayload:Bt},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>Dt(n=>[{resolveType:t,props:{query:n,term:n,count:10,hitsPerPage:10}}],e),optionsFromPayload:Bt},{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:ji}];function yi(t,e,n=new Set){const r=[...e],i=o=>{const l=[];for(const d of xi){if(d.kind!==o)continue;const p=r.find(m=>d.test(m)&&bi(m,n));p&&l.push({cand:d,resolveType:p})}return l.find(d=>n.has(En(d.resolveType)))??l[0]},u=(o,l,d)=>({kind:o.kind,id:`${o.kind}:${l}`,resolveType:l,clientFilter:o.clientFilter,isFallback:d,buildRequests:p=>o.buildRequests(l,p),optionsFromPayload:o.optionsFromPayload}),a=[];for(const o of["product","category"]){if(!t.has(o))continue;const l=i(o);l&&a.push(u(l.cand,l.resolveType,!1))}return t.size>0&&a.push(wi(t.has("category")?"category":"product")),a}function wi(t){return{kind:t,id:Ps,resolveType:Ps,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,n)=>Li(e,n)}}function Ie(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function ki(t,e,n){const r=new Set,i=new Set,u=a=>{if(Array.isArray(a)){for(const d of a)u(d);return}const o=Ie(a);if(!o)return;const l=o.__resolveType;if(typeof l=="string"){if(n(l))r.add(l);else if(l in e&&!i.has(l)){i.add(l);const d=Ie(e[l])?.__resolveType;typeof d=="string"&&n(d)&&r.add(l),u(e[l])}}for(const d of Object.values(o))u(d)};return u(t),r}function or(t){const e=new Set,n=[];for(const r of t)for(const i of r)e.has(i.value)||(e.add(i.value),n.push(i));return n}function ir(t){try{return decodeURIComponent(t)}catch{return t}}function Si(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pi(t){const e=[];let n="^";for(const r of t)r.type==="text"?n+=Si(r.text):(e.push(r.name),n+=r.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${n}$`),order:e}}function lr(t,e,n){if(typeof t!="string"||!t)return null;let r;try{r=new URL(t,"https://placeholder.invalid").pathname}catch{return null}r=r.replace(/\/+$/,"");const i=ht(Pn(e)),{pattern:u,order:a}=Pi(i),o=a.indexOf(n);if(o===-1)return null;const l=r.match(u);if(!l)return null;const d=l[o+1]?.replace(/^\/+|\/+$/g,"");return d?ir(d):null}function Bt(t,e){const n=Ie(t),r=Array.isArray(t)?t:Array.isArray(n?.products)?n.products:Array.isArray(n?.list)?n.list:[],i=[],u=new Set;for(const a of r){const o=Ie(a);if(!o)continue;const l=lr(o.url,e.template,e.paramName);if(!l||u.has(l))continue;u.add(l);const d=Ie(o.isVariantOf),p=typeof d?.name=="string"&&d.name||typeof o.name=="string"&&o.name||l,m=Array.isArray(o.image)?Ie(o.image[0]):null,f=typeof m?.url=="string"?m.url:void 0;i.push({value:l,label:p,image:f})}return i}function Ei(t){if(typeof t!="string"||!t)return null;let e;try{e=new URL(t,"https://placeholder.invalid").pathname}catch{return null}const n=e.replace(/^\/+|\/+$/g,"");return n?ir(n):null}function ji(t){const e=[],n=new Set,r=(i,u)=>{const a=Ie(i);if(!a)return;const o=typeof a.name=="string"&&a.name?a.name:"",l=o?[...u,o]:u,d=Ei(a.url);if(d&&!n.has(d)&&(n.add(d),e.push({value:d,label:l.join(" › ")||d})),Array.isArray(a.children))for(const p of a.children)r(p,l)};if(Array.isArray(t))for(const i of t)r(i,[]);return e}const Ni=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 Ti(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,n=>n.toUpperCase())}function Ci(t){if(typeof t!="string"||!t)return[];const e=[],n=/<a\b[^>]*?\bhref="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi;let r,i=0;for(;(r=n.exec(t))!==null&&i++<5e3;){const u=r[1]??"",a=(r[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:u,text:a})}return e}function Ri(t){if(typeof t!="string"||!t)return[];const e=[],n=new Set,r=/"@type":"Product"[\s\S]{0,600}?(?:"url"|\burl):"([^"]+)"[\s\S]{0,300}?(?:"name"|\bname):"([^"]+)"/g,i=/(?:"image"|\bimage):\s*\[\s*\{[\s\S]{0,400}?(?:"url"|\burl):"([^"]+)"/;let u,a=0;for(;(u=r.exec(t))!==null&&a++<3e3;){const o=(u[1]??"").replace(/\\\//g,"/");if(!o||n.has(o))continue;n.add(o);const l=t.slice(u.index,u.index+900).match(i)?.[1]?.replace(/\\\//g,"/");e.push({url:o,name:u[2]??"",image:l||void 0})}return e}function Li(t,e){const n=[],r=new Set,i=(u,a,o,l)=>{if(n.length>=200)return;const d=lr(u,e.template,e.paramName);!d||r.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||o==="category"&&Ni.has(d.split("/")[0]??"")||(r.add(d),n.push({value:d,label:a&&a.length<=80?a:Ti(d),kind:o,image:l}))};for(const{url:u,name:a,image:o}of Ri(t))i(u,a,"product",o);for(const{href:u,text:a}of Ci(t))u.startsWith("/")&&!u.startsWith("//")&&i(u,a,"category");return n}function dt(t,e,n=50){const r=e.trim().toLowerCase();return(r?t.filter(u=>u.label.toLowerCase().includes(r)||u.value.toLowerCase().includes(r)):t).slice(0,n)}const cr=1e4;function _i(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 Ai(t,{resolveType:e,props:n}){const r=await fetch(Ua(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...n}),signal:AbortSignal.timeout(cr)});if(!r.ok)throw new Error(`Failed to fetch options: ${r.status}`);return r.json()}async function Es(t,e){const n=await fetch(Ha(t,e),{signal:AbortSignal.timeout(cr)});if(!n.ok)throw new Error(`Failed to fetch page: ${n.status}`);return n.text()}async function Oi(t,e,n){const r=e.optionsFromPayload(await Es(t,"/"),n),i=r.find(a=>a.kind==="category");if(!i)return r;const u=Fe(n.template,{[n.paramName]:i.value});if(u==="/")return r;try{const a=e.optionsFromPayload(await Es(t,u),n).filter(o=>o.kind==="product");return or([r,a])}catch{return r}}function Di(t,e,n){return Ds.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":n}`)}async function Bi(t,e,n,r){if(e.homepageLinks)return Oi(t,e,r);const i=e.buildRequests?.(n)??[];if(i.length===0)return[];const u=await Promise.allSettled(i.map(o=>Ai(t,o))),a=u.filter(o=>o.status==="fulfilled").map(o=>o.value);if(a.length===0){const o=u.find(l=>l.status==="rejected");throw o?o.reason:new Error("Failed to fetch options")}return or(a.map(o=>e.optionsFromPayload(o,r)))}function xn(t,e,n,r,i){return{queryKey:Di(t,e,n),queryFn:()=>Bi(t,e,n,r),enabled:i,staleTime:6e4,retry:1}}function ut(t){const e=ne.c(16),{heading:n,iconKind:r,options:i,template:u,paramName:a,keyPrefix:o,onSelect:l}=t;if(i.length===0)return null;let d;if(e[0]!==r||e[1]!==o||e[2]!==l||e[3]!==i||e[4]!==a||e[5]!==u){let m;e[7]!==r||e[8]!==o||e[9]!==l||e[10]!==a||e[11]!==u?(m=f=>s.jsxs(pt,{value:`${o}:${f.value}`,className:"gap-3 py-2",onSelect:()=>l(f.value),children:[r==="product"&&s.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?s.jsx("img",{src:f.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):s.jsx(Us,{size:14,className:"text-muted-foreground"})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm",children:f.label}),s.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Fe(u,{[a]:f.value})})]})]},`${o}:${f.value}`),e[7]=r,e[8]=o,e[9]=l,e[10]=a,e[11]=u,e[12]=m):m=e[12],d=i.map(m),e[0]=r,e[1]=o,e[2]=l,e[3]=i,e[4]=a,e[5]=u,e[6]=d}else d=e[6];let p;return e[13]!==n||e[14]!==d?(p=s.jsx(mt,{heading:n,children:d}),e[13]=n,e[14]=d,e[15]=p):p=e[15],p}function js(t){const e=ne.c(2),{text:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Fi(t){const e=ne.c(52),{sources:n,template:r,paramName:i,value:u,sandboxRef:a,onCommit:o}=t,l=_e(),[d,p]=S.useState(!1),[m,f]=S.useState(""),[x,v]=S.useState(""),E=S.useRef(null),g=i==="*"?l("sandbox.preview.catchAllParamLabel"):`:${i}`,k=_i(l),y=[...new Set(n.map(M=>k[M.kind].noun))].join(" or ");let b;e[0]!==l||e[1]!==y?(b=l("sandbox.pathParamPickerChip.searchPlaceholder",{options:y}),e[0]=l,e[1]=y,e[2]=b):b=e[2];const w=b,T={template:r,paramName:i};let P;e[3]!==m?(P=(M,G)=>({source:M,query:G,options:M.clientFilter?dt(G.data??[],m):G.data??[]}),e[3]=m,e[4]=P):P=e[4];const N=P,B=n.filter(Vi),R=n.filter(Hi),D=vn({queries:B.map(M=>xn(a,M,x,T,d))});let O;e[5]!==D||e[6]!==N?(O=(M,G)=>N(M,D[G]),e[5]=D,e[6]=N,e[7]=O):O=e[7];const F=B.map(O),_=F.length===0||F.every(Ui),I=vn({queries:R.map(M=>xn(a,M,x,T,d&&_))});let U;e[8]!==I||e[9]!==N?(U=(M,G)=>N(M,I[G]),e[8]=I,e[9]=N,e[10]=U):U=e[10];const X=R.map(U),z=_?X:F,q=z.length===1&&z[0]?.source.homepageLinks?z[0]:null,ee=q&&!q.query.isLoading&&!q.query.isError?q?.query.data??[]:[],ce=dt(ee.filter(Ii),m),C=dt(ee.filter(zi),m),H=ce.length>0&&C.length>0,A=M=>{p(M),E.current&&clearTimeout(E.current),f(M?u:""),v(M?u:"")};let J;e[11]===Symbol.for("react.memo_cache_sentinel")?(J=M=>{f(M),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{v(M)},300)},e[11]=J):J=e[11];const Y=J,Q=M=>{o(M),A(!1)},he=Xs(m),se=Fe(r,{[i]:he}),W=Os,oe=As,ye="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",de=Ki;let re;e[12]!==g||e[13]!==l?(re=l("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:g}),e[12]=g,e[13]=l,e[14]=re):re=e[14];let ue;e[15]!==re?(ue=s.jsx(Bs,{className:"sr-only",children:s.jsx(Fs,{children:re})}),e[15]=re,e[16]=ue):ue=e[16];let we;e[17]===Symbol.for("react.memo_cache_sentinel")?(we=s.jsx(Us,{size:16,className:"shrink-0 text-foreground"}),e[17]=we):we=e[17];let ae;e[18]!==l?(ae=l("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=l,e[19]=ae):ae=e[19];let fe;e[20]!==g?(fe=s.jsx("span",{className:"rounded-sm bg-special/15 px-1 py-0.5 font-mono text-[12px] text-special",children:g}),e[20]=g,e[21]=fe):fe=e[21];let ie;e[22]!==ae||e[23]!==fe?(ie=s.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[we,s.jsxs("span",{className:"text-sm font-medium text-foreground",children:[ae," ",fe]})]}),e[22]=ae,e[23]=fe,e[24]=ie):ie=e[24];const Te=Vs,ke=!1,Me="min-h-0 flex-1";let ge;e[25]!==w||e[26]!==m?(ge=s.jsx(qs,{autoFocus:!0,placeholder:w,value:m,onValueChange:Y}),e[25]=w,e[26]=m,e[27]=ge):ge=e[27];const Ze=Hs,vt="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let Be;e[28]!==l?(Be=l("sandbox.pathParamPickerChip.noResults"),e[28]=l,e[29]=Be):Be=e[29];let Ae;e[30]!==Be?(Ae=s.jsx(Ws,{children:Be}),e[30]=Be,e[31]=Ae):Ae=e[31];const Se=he&&s.jsx(mt,{className:"shrink-0",children:s.jsxs(pt,{value:`__raw__:${he}`,className:"gap-3 py-2",onSelect:()=>Q(he),children:[s.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:s.jsx(So,{size:14,className:"text-muted-foreground"})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm",children:l("sandbox.pathParamPickerChip.useRawValue",{rawTerm:he,paramLabel:g})}),s.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:se})]})]})}),$e=H?s.jsxs("div",{className:"flex min-h-0 flex-1",children:[s.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto border-r border-border",children:s.jsx(ut,{heading:k.category.heading,iconKind:"category",options:ce,template:r,paramName:i,keyPrefix:`${q?.source.id}:cat`,onSelect:Q})}),s.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:s.jsx(ut,{heading:k.product.heading,iconKind:"product",options:C,template:r,paramName:i,keyPrefix:`${q?.source.id}:prod`,onSelect:Q})})]}):s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:z.map(M=>{const{source:G,query:Ke,options:et}=M,{noun:Ue}=k[G.kind];if(Ke.isLoading)return s.jsx(js,{text:l("sandbox.pathParamPickerChip.loading",{noun:Ue})},G.id);if(Ke.isError)return s.jsx(js,{text:l("sandbox.pathParamPickerChip.couldNotLoad")},G.id);if(G.homepageLinks){const bt=Ke.data??[];return s.jsxs(S.Fragment,{children:[s.jsx(ut,{heading:k.category.heading,iconKind:"category",options:dt(bt.filter($i),m),template:r,paramName:i,keyPrefix:`${G.id}:cat`,onSelect:Q}),s.jsx(ut,{heading:k.product.heading,iconKind:"product",options:dt(bt.filter(Mi),m),template:r,paramName:i,keyPrefix:`${G.id}:prod`,onSelect:Q})]},G.id)}return s.jsx(ut,{heading:z.length>1?k[G.kind].heading:void 0,iconKind:G.kind,options:et,template:r,paramName:i,keyPrefix:G.id,onSelect:Q},G.id)})});let Ce;e[32]!==Ze||e[33]!==Ae||e[34]!==Se||e[35]!==$e?(Ce=s.jsxs(Ze,{className:vt,children:[Ae,Se,$e]}),e[32]=Ze,e[33]=Ae,e[34]=Se,e[35]=$e,e[36]=Ce):Ce=e[36];let Re;e[37]!==Te||e[38]!==ge||e[39]!==Ce?(Re=s.jsxs(Te,{shouldFilter:ke,className:Me,children:[ge,Ce]}),e[37]=Te,e[38]=ge,e[39]=Ce,e[40]=Re):Re=e[40];let Pe;e[41]!==oe||e[42]!==ue||e[43]!==ie||e[44]!==Re||e[45]!==de?(Pe=s.jsxs(oe,{className:ye,onClick:de,children:[ue,ie,Re]}),e[41]=oe,e[42]=ue,e[43]=ie,e[44]=Re,e[45]=de,e[46]=Pe):Pe=e[46];let ve;return e[47]!==W||e[48]!==A||e[49]!==d||e[50]!==Pe?(ve=s.jsx(W,{open:d,onOpenChange:A,children:Pe}),e[47]=W,e[48]=A,e[49]=d,e[50]=Pe,e[51]=ve):ve=e[51],s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",title:l("sandbox.pathParamPickerChip.buttonTitle",{paramLabel:g}),className:"max-w-64 shrink-0 cursor-pointer truncate rounded-lg bg-special/15 px-1 py-0.5 text-[12px] text-special hover:bg-special/25",onClick:M=>{M.stopPropagation(),A(!0)},children:u||g}),ve]})}function Mi(t){return t.kind==="product"}function $i(t){return t.kind!=="product"}function Ki(t){return t.stopPropagation()}function zi(t){return t.kind==="product"}function Ii(t){return t.kind!=="product"}function Ui(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function Hi(t){return t.isFallback}function Vi(t){return!t.isFallback}function qi(t){const e=ne.c(8),{sources:n,template:r,paramName:i,sandboxRef:u,onFill:a}=t;let o,l;if(e[0]!==i||e[1]!==u||e[2]!==n||e[3]!==r){const x={template:r,paramName:i},v=n.filter(Wi);l=vn,o=v.map(E=>xn(u,E,"",x,!0)),e[0]=i,e[1]=u,e[2]=n,e[3]=r,e[4]=o,e[5]=l}else o=e[4],l=e[5];let d;e[6]!==o?(d={queries:o},e[6]=o,e[7]=d):d=e[7];const p=l(d),[m,f]=S.useState(!1);if(!m)for(const x of p){if(x.isLoading)break;const v=x.data?.[0];if(v){f(!0),queueMicrotask(()=>a(v.value));break}}return null}function Wi(t){return!t.isFallback}function Gi(t){const e=ne.c(31),{name:n,value:r,onCommit:i}=t,u=_e(),[a,o]=S.useState(r),[l,d]=S.useState(!1),p=S.useRef(!1);let m;e[0]!==n||e[1]!==u?(m=n==="*"?u("sandbox.preview.catchAllParamLabel"):`:${n}`,e[0]=n,e[1]=u,e[2]=m):m=e[2];const f=m,x=a||f;let v;e[3]!==x?(v=s.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-[12px]",children:x}),e[3]=x,e[4]=v):v=e[4];let E;e[5]!==f||e[6]!==u?(E=u("sandbox.preview.valueForParam",{label:f}),e[5]=f,e[6]=u,e[7]=E):E=e[7];let g,k;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=N=>o(N.target.value),k=()=>d(!0),e[8]=g,e[9]=k):(g=e[8],k=e[9]);let j;e[10]!==r?(j=N=>{N.key==="Enter"&&N.currentTarget.blur(),N.key==="Escape"&&(p.current=!0,o(r),N.currentTarget.blur())},e[10]=r,e[11]=j):j=e[11];let y;e[12]!==a||e[13]!==i||e[14]!==r?(y=()=>{if(d(!1),p.current){p.current=!1;return}const N=Xs(a);o(N),N!==r&&i(N)},e[12]=a,e[13]=i,e[14]=r,e[15]=y):y=e[15];let b;e[16]!==a||e[17]!==f||e[18]!==E||e[19]!==j||e[20]!==y?(b=s.jsx("input",{type:"text",value:a,placeholder:f,title:E,spellCheck:!1,className:"absolute inset-0 rounded-sm bg-special/15 px-1 text-[12px] text-special outline-none placeholder:text-special/60 focus:bg-special/25",onClick:Ji,onChange:g,onFocus:k,onKeyDown:j,onBlur:y}),e[16]=a,e[17]=f,e[18]=E,e[19]=j,e[20]=y,e[21]=b):b=e[21];let w;e[22]!==v||e[23]!==b?(w=s.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[v,b]}),e[22]=v,e[23]=b,e[24]=w):w=e[24];let T;e[25]!==l||e[26]!==u?(T=l&&s.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:[s.jsx(ka,{size:10}),u("sandbox.preview.enterToGo")]}),e[25]=l,e[26]=u,e[27]=T):T=e[27];let P;return e[28]!==T||e[29]!==w?(P=s.jsxs(s.Fragment,{children:[w,T]}),e[28]=T,e[29]=w,e[30]=P):P=e[30],P}function Ji(t){return t.stopPropagation()}function Yi(t){if(t.activeGlobalSectionName)return t.activeGlobalSectionName;const e=t.iframeBase;if(!e)return t.noServerLabel;try{const n=new URL(e),r=t.resolvedPath==="/"?"":t.resolvedPath;return`${n.host}${r}`}catch{return e}}function Qi(t){return t.previewSurfaceActive&&(t.daemonReady||t.production||!!t.servePreviewUrl)}function Xi(t){return t.showPreviewToolbar&&t.contentEditingEnabled}function Zi(t){const e=ne.c(5);let n;e[0]!==t?(n=t??{orgSlug:"",virtualMcpId:"",branch:""},e[0]=t,e[1]=n):n=e[1];const r=Ms(n);let i;return e[2]!==t||e[3]!==r?(i={mutationFn:async u=>{const{name:a,path:o,template:l}=u;if(!t?.virtualMcpId||!t.branch)throw new Error("Sandbox not ready");const d=Qr(a),p=l?{...l,name:a,path:o}:Xr(a,o);return await r.mutateAsync({blockKey:d,data:p}),{key:d,name:a,path:o}}},e[2]=t,e[3]=r,e[4]=i):i=e[4],Ir(i)}function el(t){const e=ne.c(89),{open:n,onOpenChange:r,isPending:i,error:u,templates:a,onSubmit:o}=t,l=i===void 0?!1:i,d=_e();let p;e[0]!==d?(p=d("sectionsEditor.createPageModal.defaultPageName"),e[0]=d,e[1]=p):p=e[1];const[m,f]=S.useState(p);let x;e[2]!==d?(x=d("sectionsEditor.createPageModal.defaultPagePath"),e[2]=d,e[3]=x):x=e[3];const[v,E]=S.useState(x),[g,k]=S.useState(ln),[j,y]=S.useState(null),[b,w]=S.useState(n);n!==b&&(w(n),n&&(f(d("sectionsEditor.createPageModal.defaultPageName")),E(d("sectionsEditor.createPageModal.defaultPagePath")),k(ln),y(null)));const T=!!a?.length;let P;e[4]!==l||e[5]!==r?(P=ae=>{!ae&&!l&&(y(null),r(!1))},e[4]=l,e[5]=r,e[6]=P):P=e[6];const N=P;let B;e[7]!==l||e[8]!==m||e[9]!==o||e[10]!==v||e[11]!==T||e[12]!==g?(B=async ae=>{ae.preventDefault();const fe=m.trim(),ie=v.trim();if(!fe||!ie||l)return;const Te=Zs(ie);if(Te){y(Te);return}y(null),await o({name:fe,path:ie,templateKey:T&&g!==ln?g:null})},e[7]=l,e[8]=m,e[9]=o,e[10]=v,e[11]=T,e[12]=g,e[13]=B):B=e[13];const R=B,D=j??u;let O;e[14]!==d?(O=d("sectionsEditor.createPageModal.title"),e[14]=d,e[15]=O):O=e[15];let F;e[16]!==O?(F=s.jsx(Bs,{children:s.jsx(Fs,{children:O})}),e[16]=O,e[17]=F):F=e[17];let _;e[18]!==d?(_=d("sectionsEditor.createPageModal.nameLabel"),e[18]=d,e[19]=_):_=e[19];let I;e[20]!==_?(I=s.jsx("label",{htmlFor:"new-page-name",className:"text-xs font-medium text-muted-foreground",children:_}),e[20]=_,e[21]=I):I=e[21];let U;e[22]===Symbol.for("react.memo_cache_sentinel")?(U=ae=>f(ae.target.value),e[22]=U):U=e[22];let X;e[23]!==d?(X=d("sectionsEditor.createPageModal.namePlaceholder"),e[23]=d,e[24]=X):X=e[24];let z;e[25]!==l||e[26]!==m||e[27]!==X?(z=s.jsx(ns,{id:"new-page-name",value:m,onChange:U,placeholder:X,autoFocus:!0,disabled:l}),e[25]=l,e[26]=m,e[27]=X,e[28]=z):z=e[28];let q;e[29]!==z||e[30]!==I?(q=s.jsxs("div",{className:"space-y-1.5",children:[I,z]}),e[29]=z,e[30]=I,e[31]=q):q=e[31];let te;e[32]!==d?(te=d("sectionsEditor.createPageModal.pathLabel"),e[32]=d,e[33]=te):te=e[33];let ee;e[34]!==te?(ee=s.jsx("label",{htmlFor:"new-page-path",className:"text-xs font-medium text-muted-foreground",children:te}),e[34]=te,e[35]=ee):ee=e[35];let ce;e[36]===Symbol.for("react.memo_cache_sentinel")?(ce=ae=>E(ae.target.value),e[36]=ce):ce=e[36];let C;e[37]!==d?(C=d("sectionsEditor.createPageModal.pathPlaceholder"),e[37]=d,e[38]=C):C=e[38];let H;e[39]!==l||e[40]!==v||e[41]!==C?(H=s.jsx(ns,{id:"new-page-path",value:v,onChange:ce,placeholder:C,disabled:l}),e[39]=l,e[40]=v,e[41]=C,e[42]=H):H=e[42];let A;e[43]!==ee||e[44]!==H?(A=s.jsxs("div",{className:"space-y-1.5",children:[ee,H]}),e[43]=ee,e[44]=H,e[45]=A):A=e[45];let J;e[46]!==l||e[47]!==T||e[48]!==d||e[49]!==g||e[50]!==a?(J=T&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"new-page-template",className:"text-xs font-medium text-muted-foreground",children:d("sectionsEditor.createPageModal.templateLabel")}),s.jsx(Zr,{id:"new-page-template",value:g,onChange:k,templates:a??[],disabled:l})]}),e[46]=l,e[47]=T,e[48]=d,e[49]=g,e[50]=a,e[51]=J):J=e[51];let Y;e[52]!==D?(Y=D&&s.jsx("p",{className:"text-xs text-destructive",children:D}),e[52]=D,e[53]=Y):Y=e[53];let Q;e[54]!==q||e[55]!==A||e[56]!==J||e[57]!==Y?(Q=s.jsxs("div",{className:"space-y-4 py-4",children:[q,A,J,Y]}),e[54]=q,e[55]=A,e[56]=J,e[57]=Y,e[58]=Q):Q=e[58];let he;e[59]!==r?(he=()=>r(!1),e[59]=r,e[60]=he):he=e[60];let se;e[61]!==d?(se=d("sectionsEditor.createPageModal.cancelButton"),e[61]=d,e[62]=se):se=e[62];let W;e[63]!==l||e[64]!==he||e[65]!==se?(W=s.jsx(Xe,{type:"button",variant:"outline",onClick:he,disabled:l,children:se}),e[63]=l,e[64]=he,e[65]=se,e[66]=W):W=e[66];let oe;e[67]!==l||e[68]!==m||e[69]!==v?(oe=!m.trim()||!v.trim()||l,e[67]=l,e[68]=m,e[69]=v,e[70]=oe):oe=e[70];let ye;e[71]!==l||e[72]!==d?(ye=l?s.jsxs(s.Fragment,{children:[s.jsx(gt,{className:"size-3.5"}),d("sectionsEditor.createPageModal.creatingButton")]}):d("sectionsEditor.createPageModal.createButton"),e[71]=l,e[72]=d,e[73]=ye):ye=e[73];let de;e[74]!==oe||e[75]!==ye?(de=s.jsx(Xe,{type:"submit",disabled:oe,children:ye}),e[74]=oe,e[75]=ye,e[76]=de):de=e[76];let re;e[77]!==W||e[78]!==de?(re=s.jsxs(Ur,{children:[W,de]}),e[77]=W,e[78]=de,e[79]=re):re=e[79];let ue;e[80]!==R||e[81]!==Q||e[82]!==re||e[83]!==F?(ue=s.jsx(As,{className:"sm:max-w-md",children:s.jsxs("form",{onSubmit:R,children:[F,Q,re]})}),e[80]=R,e[81]=Q,e[82]=re,e[83]=F,e[84]=ue):ue=e[84];let we;return e[85]!==N||e[86]!==n||e[87]!==ue?(we=s.jsx(Os,{open:n,onOpenChange:N,children:ue}),e[85]=N,e[86]=n,e[87]=ue,e[88]=we):we=e[88],we}function tl(t){const e=ne.c(29),{orgSlug:n,virtualMcpId:r,branch:i,previewUrl:u,meta:a,decofile:o,blockKey:l}=t,d=_e();let p;e[0]!==i||e[1]!==n||e[2]!==r?(p={orgSlug:n,virtualMcpId:r,branch:i},e[0]=i,e[1]=n,e[2]=r,e[3]=p):p=e[3];const m=Ms(p);let f;e[4]!==m?(f=na((w,T)=>m.mutate({blockKey:w,data:T})),e[4]=m,e[5]=f):f=e[5];const x=f;let v;e[6]!==l||e[7]!==o?(v=ea(o,l),e[6]=l,e[7]=o,e[8]=v):v=e[8];const{resolveType:E,props:g,title:k}=v;if(!E){let w;e[9]!==d?(w=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=w):w=e[10];let T;return e[11]!==w?(T=s.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:w}),e[11]=w,e[12]=T):T=e[12],T}const j=`loader:${l}`;let y;e[13]!==l||e[14]!==E||e[15]!==k?(y={mode:"saved",blockKey:l,resolveType:E,title:k},e[13]=l,e[14]=E,e[15]=k,e[16]=y):y=e[16];let b;return e[17]!==i||e[18]!==o||e[19]!==a||e[20]!==n||e[21]!==u||e[22]!==g||e[23]!==m.isPending||e[24]!==x||e[25]!==j||e[26]!==y||e[27]!==r?(b=s.jsx(ta,{orgSlug:n,virtualMcpId:r,branch:i,previewUrl:u,meta:a,decofile:o,kind:"loaders",target:y,initialValue:g,isCreating:m.isPending,onCreate:nl,onSaveReferencedBlock:x,showRun:!1},j),e[17]=i,e[18]=o,e[19]=a,e[20]=n,e[21]=u,e[22]=g,e[23]=m.isPending,e[24]=x,e[25]=j,e[26]=y,e[27]=r,e[28]=b):b=e[28],b}async function nl(){}function sl(t){if(t instanceof Error&&"status"in t&&typeof t.status=="number")return t.status}function Ns(t){return{status:t.status,hasData:t.data!==void 0,errorStatus:sl(t.error)}}function rl(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 al(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=rl(t.lifecyclePhase);if(e==="terminal-error")return{kind:"error",source:"sandbox"};if(e==="booting")return{kind:"loading"};const n=t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData;return n&&t.lifecyclePhase==="checking-out"?{kind:"loading"}:[t.decofile,t.meta].some(i=>i.status==="error"&&!i.hasData&&i.errorStatus===404)?{kind:"empty",reason:"framework-missing"}:n?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 ol=S.lazy(()=>Hr(()=>import("./sections-editor-DrdT1MI7.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])).then(t=>({default:t.SectionsEditor})));function Ts(t){const e=ne.c(60),{virtualMcpId:n,externalSelection:r,onViewJsonFile:i}=t,u=r===void 0?null:r,{org:a}=yn(),{currentBranch:o,taskId:l}=It(),d=tr(),p=wn(),m=nr(),f=d.lifecycle.phase==="running",x=p.previewUrl;let v;e[0]!==o||e[1]!==a||e[2]!==x||e[3]!==l||e[4]!==n?(v=o?{orgSlug:a.slug,virtualMcpId:n,branch:o,threadId:l??null,previewUrl:x}:null,e[0]=o,e[1]=a,e[2]=x,e[3]=l,e[4]=n,e[5]=v):v=e[5];const E=v,g=kn(n,o);let k;e[6]!==f?(k={fetchEnabled:f},e[6]=f,e[7]=k):k=e[7];const j=Sn(E,k);let y;e[8]!==f?(y={fetchEnabled:f},e[8]=f,e[9]=y):y=e[9];const b=$s(E,y),w=al({lifecyclePhase:d.lifecycle.phase,decofile:Ns(j),meta:Ns(b),hasEditableContent:mo(j.data,b.data),fastPreviewActive:Gs(n).runtime==="cms"||Ys(g)}),T=Ks()===void 0,P=il;if(sa(g)){let C;return e[10]===Symbol.for("react.memo_cache_sentinel")?(C=P(s.jsx(oa,{})),e[10]=C):C=e[10],C}if(g.kind==="pending"&&g.retrying){let C;return e[11]!==g?(C=P(s.jsx(ia,{backend:g})),e[11]=g,e[12]=C):C=e[12],C}if(w.kind==="loading"||T){let C;return e[13]===Symbol.for("react.memo_cache_sentinel")?(C=P(s.jsx(Vr,{})),e[13]=C):C=e[13],C}if(j.data&&Va(b.data)){const C=m.state.target,H=C?.kind==="page"||C?.kind==="section"?C.key:null,A=H??"",J=o??"";let Y;return e[14]!==j.data||e[15]!==H||e[16]!==a.slug||e[17]!==A||e[18]!==J||e[19]!==n?(Y=P(s.jsx(ra,{orgSlug:a.slug,virtualMcpId:n,branch:J,decofile:j.data,initialKey:H,compact:!0},A)),e[14]=j.data,e[15]=H,e[16]=a.slug,e[17]=A,e[18]=J,e[19]=n,e[20]=Y):Y=e[20],Y}if(w.kind==="empty"){let C;return e[21]===Symbol.for("react.memo_cache_sentinel")?(C=P(s.jsx(la,{})),e[21]=C):C=e[21],C}if(w.kind==="error"){let C;e[22]!==j||e[23]!==p||e[24]!==b||e[25]!==w.source?(C=()=>{if(w.source==="sandbox"){p.retry();return}Promise.all([j.refetch(),b.refetch()])},e[22]=j,e[23]=p,e[24]=b,e[25]=w.source,e[26]=C):C=e[26];const H=C;let A;return e[27]!==H||e[28]!==w.source?(A=P(s.jsx(aa,{source:w.source,onRetry:H})),e[27]=H,e[28]=w.source,e[29]=A):A=e[29],A}let N;e[30]===Symbol.for("react.memo_cache_sentinel")?(N=C=>P(s.jsx("div",{className:"h-full min-h-0",children:C})),e[30]=N):N=e[30];const B=N,R=m.state.target;if(R?.kind==="loader"&&j.data&&b.data){const C=o??"",H=x??null;let A;return e[31]!==j.data||e[32]!==b.data||e[33]!==a.slug||e[34]!==C||e[35]!==H||e[36]!==R.key||e[37]!==n?(A=B(s.jsx(tl,{orgSlug:a.slug,virtualMcpId:n,branch:C,previewUrl:H,meta:b.data,decofile:j.data,blockKey:R.key})),e[31]=j.data,e[32]=b.data,e[33]=a.slug,e[34]=C,e[35]=H,e[36]=R.key,e[37]=n,e[38]=A):A=e[38],A}let D;e[39]!==o||e[40]!==a.slug||e[41]!==R||e[42]!==n?(D=R||!o?null:zs(Is(a.slug,n,o)),e[39]=o,e[40]=a.slug,e[41]=R,e[42]=n,e[43]=D):D=e[43];const O=D;let F="/",_=null,I=null;R?.kind==="page"?(F=R.path,_=R.key):R?.kind==="section"?I=R.key:O&&(F=O.path,_=O.pageKey);const U=_?`page:${_}`:I?`section:${I}`:`path:${F}`;let X;e[44]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx("div",{className:"h-full flex items-center justify-center",children:s.jsx(gt,{className:"size-5 text-muted-foreground"})}),e[44]=X):X=e[44];const z=o??"",q=x??void 0,te=I?null:u,ee=!!_&&m.state.editSeoPageKey===_;let ce;return e[45]!==I||e[46]!==_||e[47]!==F||e[48]!==U||e[49]!==i||e[50]!==a.slug||e[51]!==te||e[52]!==ee||e[53]!==z||e[54]!==q||e[55]!==n||e[56]!==m.consumeEditSeo||e[57]!==m.setFocusedBlock||e[58]!==m.setVariantOverride?(ce=B(s.jsx(S.Suspense,{fallback:X,children:s.jsx(ol,{orgSlug:a.slug,virtualMcpId:n,branch:z,previewReady:!0,previewUrl:q,currentPath:F,activePageBlockKey:_,activeGlobalBlockKey:I,externalSelection:te,initialEditSeo:ee,onExitSeo:m.consumeEditSeo,onVariantPreviewOverride:m.setVariantOverride,onFocusedBlockChange:m.setFocusedBlock,onViewJsonFile:i},U)})),e[45]=I,e[46]=_,e[47]=F,e[48]=U,e[49]=i,e[50]=a.slug,e[51]=te,e[52]=ee,e[53]=z,e[54]=q,e[55]=n,e[56]=m.consumeEditSeo,e[57]=m.setFocusedBlock,e[58]=m.setVariantOverride,e[59]=ce):ce=e[59],ce}function il(t){return s.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:t})}function Cs(t){const e=ne.c(39),{virtualMcpId:n,pageKey:r,onClose:i,ref:u}=t,a=_e(),o=Ks(),l=o===!0,d=qa(n);let p;e[0]!==d||e[1]!==r?(p=Wa(d,Eo(r)),e[0]=d,e[1]=r,e[2]=p):p=e[2];const m=p,{org:f}=yn(),{currentBranch:x,taskId:v}=It(),g=wn().previewUrl;let k;e[3]!==x||e[4]!==f.slug||e[5]!==g||e[6]!==v||e[7]!==n?(k=x?{orgSlug:f.slug,virtualMcpId:n,branch:x,threadId:v??null,previewUrl:g}:null,e[3]=x,e[4]=f.slug,e[5]=g,e[6]=v,e[7]=n,e[8]=k):k=e[8];const y=Sn(k),b=x??"";let w;e[9]!==f.slug||e[10]!==b||e[11]!==n?(w={orgSlug:f.slug,virtualMcpId:n,branch:b},e[9]=f.slug,e[10]=b,e[11]=n,e[12]=w):w=e[12];const{save:T,flush:P}=ca(w),N=y.data?.[r],B=y.data===void 0&&y.isLoading||o===void 0,R=y.data!==void 0&&N===void 0,D=!x||R||B;let O;e[13]!==N?(O=N===void 0?"":JSON.stringify(N,null,2),e[13]=N,e[14]=O):O=e[14];const F=O;let _;e[15]!==r||e[16]!==D||e[17]!==T?(_=te=>{if(D)return;let ee;try{ee=JSON.parse(te)}catch{return}ee===null||typeof ee!="object"||Array.isArray(ee)||T(r,ee)},e[15]=r,e[16]=D,e[17]=T,e[18]=_):_=e[18];const I=_;let U;e[19]!==P?(U=()=>({flush:P}),e[19]=P,e[20]=U):U=e[20],S.useImperativeHandle(u,U);let X;e[21]!==m||e[22]!==l||e[23]!==i||e[24]!==a?(X=l?s.jsx("div",{className:"flex shrink-0 items-center border-b px-3 py-2.5",children:s.jsx("span",{title:m,className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:m})}):s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[s.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:a("sectionsEditor.pageJsonDialog.titleShort")}),s.jsx(Xe,{variant:"ghost",size:"icon",onClick:i,"aria-label":a("sectionsEditor.pageJsonDialog.close"),className:"size-7 shrink-0",children:s.jsx(qr,{size:14})})]}),e[21]=m,e[22]=l,e[23]=i,e[24]=a,e[25]=X):X=e[25];let z;e[26]!==y.data||e[27]!==P||e[28]!==F||e[29]!==B||e[30]!==R||e[31]!==r||e[32]!==D||e[33]!==I||e[34]!==a?(z=B?s.jsx("div",{className:"flex flex-1 items-center justify-center",children:s.jsx(gt,{className:"size-5 text-muted-foreground"})}):R?s.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",a("sectionsEditor.pageJsonDialog.pageNotFound")]}):s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(Po,{code:F,language:"json",readOnly:D,height:"100%",onChange:te=>I(te??""),onSave:te=>{I(te),P()}},`${r}:${y.data===void 0?"loading":"ready"}`)}),e[26]=y.data,e[27]=P,e[28]=F,e[29]=B,e[30]=R,e[31]=r,e[32]=D,e[33]=I,e[34]=a,e[35]=z):z=e[35];let q;return e[36]!==X||e[37]!==z?(q=s.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[X,z]}),e[36]=X,e[37]=z,e[38]=q):q=e[38],q}function dr(t){return t.contentEditingEnabled&&!t.isMobile}function ll(t,e){return t!=="visual"?"visual":e?"blocks":"preview"}function cl(t,e){return t==="blocks"?"preview":e?"blocks":t}function dl(t){return dr({contentEditingEnabled:er(t.cmsMode),isMobile:t.isMobile})?"blocks":"preview"}function ul(t){return t.editingMode==="blocks"&&!t.blocksEditingEnabled||t.editingMode==="visual"&&!t.sandboxDisplay?"preview":t.editingMode}const fl=15e3;function ml(t,e,n){return n?t.src===e||t.loading?t:{src:e,loading:!0}:t.src===e&&!t.loading?t:{src:e,loading:!1}}function Rs(t){return t.loading?{...t,loading:!1}:t}const pl=500,hl={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},Ls=1,Ft=["desktop","mobile","tablet"],gl=["preview","visual","blocks"],_s={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function vl(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 ft(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function gn(t,e){try{return new URL(t,e).href}catch{return null}}function bl(t,e){if(!e.inPlaceRenderActive)return{pin:e.draftPreviewUrl?{path:e.resolvedPath,url:e.draftPreviewUrl}:null,effective:e.draftPreviewUrl};if(e.draftPreviewUrl!==null&&t?.path!==e.resolvedPath){const n={path:e.resolvedPath,url:e.draftPreviewUrl};return{pin:n,effective:n.url}}return{pin:t,effective:t?.url??null}}function xl(t,e){return!t||t.nav!==e.nav?!1:t.content!==e.content}function yl(t,e,n){const r=t.toLowerCase(),i=e.toLowerCase(),u=i.split("/").filter(Boolean),a=l=>{if(l===n)return 100;const d=l.indexOf(n);if(d===-1)return 0;let p=40;return d===0?p+=30:/[\s/-]/.test(l[d-1]??"")&&(p+=20),p+=Math.round(n.length/l.length*20),p};let o=Math.max(a(r),a(i));return u.at(-1)===n?o=Math.max(o,95):u.includes(n)&&(o=Math.max(o,90)),o}function wl(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function kl({virtualMcpId:t}){const e=_e(),n=ro(),{currentBranch:r,taskId:i,virtualMcpId:u}=It(),a=!!ga(),o=nr(),l=Oa(u===t?t:null),d=Gs(t),p=No(l?.metadata?.ui?.layout??null),m=er(p),f=dr({contentEditingEnabled:m,isMobile:n}),[x]=S.useState(()=>dl({cmsMode:p,isMobile:n})),[v,E]=ss(rs.previewEditingMode(t),c=>c&&gl.includes(c)?c:null),g=v??x,[k,j]=ss(rs.previewDeviceSize(t),c=>c&&Ft.includes(c)?c:"desktop"),[y,b]=S.useState(null),[w,T]=S.useState(null),P=S.useRef(null),N=S.useRef(null),[B,R]=S.useState(!1),D=S.useRef(null),O=()=>{D.current?.flush(),R(!1)},F=()=>R(c=>(c&&D.current?.flush(),!c)),[_,I]=S.useState({width:0,height:0}),[U,X]=S.useState(!1),[z,q]=S.useState(""),te=S.useRef(null),[ee,ce]=S.useState(!1),[C,H]=S.useState(),[A,J]=S.useState(null),[Y,Q]=S.useState(null),[he,se]=S.useState(null),[W,oe]=S.useState(()=>o.state.target?.kind==="page"?o.state.target.path:"/"),[ye,de]=S.useState(()=>o.state.target?.kind==="page"?o.state.target.key:null),[re,ue]=S.useState({}),[we,ae]=S.useState(!1),fe=S.useRef(null),ie=()=>{ae(!0),fe.current&&clearTimeout(fe.current),fe.current=setTimeout(()=>ae(!1),15e3)},Te=()=>{fe.current&&(clearTimeout(fe.current),fe.current=null),ae(!1)},{org:ke}=yn(),Me=tr(),ge=wn(),Ze=ge.vmEntry,vt=Me.lifecycle.phase,{url:Be,undecided:Ae}=Ga(t),Se=kn(t,r),{connection:$e}=Qs(t),Ce=jo(t),Re=Ja({hasServeConnection:!!$e,runtime:d.runtime}),Pe=Ae||Re==="github"&&(Ce==="loading"||Ce==="error"),ve=!Ys(Se)&&!Pe&&!(Re==="github"&&Se.kind==="pending"),M=Qe(Se)??Be,G=M??ge.previewUrl,Ke=!!M||vt==="running",et=l?.id===t?Fa(l.metadata):null,Ue=!M&&!Ae&&l?.id===t&&d.runtime==="cms",bt=d.projectDefault==="cms",tt=ve?bo({sandboxUrl:G,previewServerUrl:et,fastPreviewActive:Ue}):null,jn=t&&r?{orgSlug:ke.slug,virtualMcpId:t,branch:r,threadId:i??null,previewUrl:G}:null,Nn=Sn(jn,{fetchEnabled:Ke}),Tn=$s(jn,{fetchEnabled:Ke}),Z=Nn.data,be=Tn.data,He=Z?po(Z,be).sort((c,h)=>c.name.localeCompare(h.name)):[],Cn=t&&r?{orgSlug:ke.slug,virtualMcpId:t,branch:r}:null,Rn=Zi(Cn),Ut=Z&&be?ho(Z,be):[],Ln=ve&&Z&&be?da(be,Z,"loaders"):[],_n=z?(()=>{const c=z.toLowerCase();return He.map(h=>({page:h,score:yl(h.name,h.path,c)})).filter(({score:h})=>h>0).sort((h,L)=>L.score-h.score||h.page.path.length-L.page.path.length).map(({page:h})=>h)})():He,An=Ut.filter(c=>{if(!z)return!0;const h=z.toLowerCase();return c.name.toLowerCase().includes(h)||c.key.toLowerCase().includes(h)||c.resolveType.toLowerCase().includes(h)}),On=f?Ln:[],Dn=On.filter(c=>{if(!z)return!0;const h=z.toLowerCase();return c.title.toLowerCase().includes(h)||c.key.toLowerCase().includes(h)||c.resolveType.toLowerCase().includes(h)}),xt=Y?Ln.find(c=>c.key===Y)??null:null,Le=Pn,Ht=A||Y?null:go(He,W,ye),V=Ht?.key??null,Ve=o.state.target?.kind==="section"?o.state.target.key:o.state.focusedBlockKey??V,yt=Ht?.path??null,qe=(V?re[V]:void 0)??{},xe=Fe(W,qe),Vt={};if(ve&&Ke&&G&&be&&Z){const c=ua(be,"loaders"),h=V?Z[V]:void 0,L=ki(h,Z,le=>c.has(le)),K=vi(L);for(const le of ht(W)){if(le.type!=="param")continue;const De=pi(W,le.name,L),je=yi(De,c,K);je.length>0&&(Vt[le.name]=je)}}const wt=t&&r?{orgSlug:ke.slug,virtualMcpId:t,branch:r,threadId:i??null}:null,Bn=Z&&V?vo(Z,V,0):[],Fn=Z?fa(Bn,Z):[],qt=Fn.map(c=>c.isSavedBlock?c.label:""),Wt=Fn.map(c=>c.isSavedBlock?"global":c.isMultivariate?"variant":"normal"),Gt=Bn.map(c=>bn(c,Z??{})),kt=S.useRef(null),Ee=S.useRef(null),ur=Me.status.state==="paused",Jt=Me.phase,Mn=ma({claimPhase:Jt,lifecycle:Me.lifecycle}),ze=ge.previewState,fr=ge.userStopped,mr=Ya(ke.slug,t??""),{url:Oe}=yo(Ue&&t&&r?{orgSlug:ke.slug,virtualMcpId:t,branch:r,previewServerUrl:et??null,path:xe}:null),pr=bt&&d.runtime==="sandbox",Yt=Qa(Se,Re,Ce),$=Qo({previewState:ze,progressStatus:Mn.status,previewServerUrl:et,fastPreviewActive:Ue,fastPreviewReady:!!Oe,codingSession:pr,localPreviewUrl:M,hostedDraft:Yt,deciding:Pe}),hr=$.showWakingPill||Yt&&$.mode==="production"&&!Oe,nt=$.mode!=="none",gr=$.mode==="production"&&$.iframeBase?ft($.iframeBase):null,We=$.mode==="production"?gr:ft(G),vr=l?.id===t&&l.metadata?.fastPreviewInPlace===!0,st=ve?M?$.mode==="sandbox"&&f&&g==="blocks":$.mode==="production"&&Ue&&vr&&f&&g==="blocks":!1,$n=S.useRef(null),{pin:br,effective:xr}=bl($n.current,{inPlaceRenderActive:st,draftPreviewUrl:Oe,resolvedPath:xe});$n.current=br;const Kn=o.state.variantOverride??[],St=ve?Kn:[],Qt=ve?[]:Kn,yr=$e&&Qe(Se)?ao($e.endpoint,Qt)??fs:null,Ge=vl($.mode==="sandbox"?At(vs(ms(he??gn(xe,$.iframeBase)??$.iframeBase,yr),k),St):$.mode==="production"?At(vs(cs(ms(he??xr??gn(xe,$.iframeBase)??$.iframeBase,hr?fs:null),Qt),k),St):null),zn=Oe??($.iframeBase?gn(xe,$.iframeBase):null),wr=$.mode==="production"?zn?At(cs(zn,Qt),St):null:Ge??$.iframeBase,kr=()=>{const c=wr;c&&window.open(c,"_blank","noopener")},rt=t&&r?Is(ke.slug,t,r):null,at=c=>{rt&&ba(rt,c)},me=o.state.target;S.useEffect(()=>{if(!(!me||!tt||!be))if(me.kind==="page"){const c=re[me.key]??{};Ee.current=Fe(me.path,c),J(null),Q(null),se(null),de(me.key),oe(me.path),at({path:me.path,pageKey:me.key,params:c})}else if(me.kind==="loader")Ee.current=null,J(null),Q(me.key),se(null);else{const c=Ut.find(h=>h.key===me.key);if(c){Ee.current=null;const h=us(be);Q(null),J(c),se(ps(tt,h,c.key))}}},[me,tt,be,re]),S.useEffect(()=>{!V||yt===null||me?.kind==="page"&&me.key===V&&me.path===yt||o.selectTarget({kind:"page",key:V,path:yt})},[V,yt,me]);const[In,Sr]=S.useState(null);if(ze.kind==="iframe"&&In!==ze.previewUrl){const c=In!==null;Sr(ze.previewUrl);const h=rt?zs(rt):null;if(h){if(Ee.current=Fe(h.path,h.params),oe(h.path),de(h.pageKey),se(null),J(null),Q(null),h.pageKey&&Object.keys(h.params).length>0){const L=h.pageKey;ue(K=>({...K,[L]:h.params}))}}else c&&(Ee.current=null,oe("/"),se(null),de(null),J(null),Q(null))}kt.current=Ge;const Pr=$.mode==="production"&&!!Oe&&!M,[Un,Xt]=S.useState({src:Ge??void 0,loading:!1}),Pt=ml(Un,Ge??void 0,Pr);Pt!==Un&&Xt(Pt);const ot=Pt.src,Hn=Pt.loading,Vn=ti({iframeRef:P,src:$.mode==="sandbox"?Ge:null,active:$.mode==="sandbox"}),qn=S.useRef(null);S.useEffect(()=>{const c=Hn?setTimeout(()=>Xt(Rs),fl):null,h=()=>{c&&clearTimeout(c)};if(!Oe||!ot||qn.current===Oe)return h;qn.current=Oe;const L=P.current;return L&&L.getAttribute("src")!==ot&&(ie(),L.src=ot),h},[Oe,ot,Hn]);const Wn=()=>{const c=P.current?.contentWindow,h=We;if(!c||!h||!Z||!V)return;const L=Z[V];if(!L||typeof L!="object")return;const K=xo({previewBaseUrl:h,pageBlock:L,decofile:Z,path:xe,pathTemplate:W});if(!K)return;const le=At(K.src,oo(St,V));c.postMessage({type:"cms-editor::render",src:le,body:K.body},h)},Zt=S.useRef(null);S.useEffect(()=>{if(!st||A||Y||!V||!Z){Zt.current=null;return}const c={nav:JSON.stringify({page:V,path:xe,pathTemplate:W}),content:JSON.stringify(Z)},h=xl(Zt.current,c);Zt.current=c,h&&Wn()},[Z,st,A,Y,V,xe,W]);const en=S.useRef(null);S.useEffect(()=>{if(!st||A||Y||!V||!Z){en.current=null;return}const c=JSON.stringify(o.state.variantOverride??null),h=en.current;en.current={page:V,sig:c},!(!h||h.page!==V||h.sig===c)&&Wn()},[o.state.variantOverride,st,A,Y,V]);const Er=!!t&&!!r&&!Me.notFound&&!fr&&!ur&&(Jt?.kind==="ready"||vt!=="idle"),pe=ul({editingMode:g,sandboxDisplay:$.mode==="sandbox",blocksEditingEnabled:f});S.useEffect(()=>{const c=We;if(!c)return;const h=L=>{if(L.origin===c)if(L.data?.type==="visual-editor::element-clicked"){const K=ai.safeParse(L.data.payload);K.success&&b(K.data)}else if(L.data?.type==="cms-editor::section-clicked"){const K=li.safeParse(L.data.payload);K.success&&T({index:K.data.sectionIndex,seq:K.data.clickSeq})}else L.data?.type==="cms-editor::render-start"?ie():L.data?.type==="cms-editor::render-end"?(Te(),P.current?.contentWindow?.postMessage({type:"cms-editor::set-labels",labels:qt,kinds:Wt,keys:Gt},c)):L.data?.type==="cms-editor::render-error"&&Te()};return window.addEventListener("message",h),()=>window.removeEventListener("message",h)},[We,qt,Wt,Gt]);const Gn=()=>{const c=P.current?.contentWindow,h=ft(G);!c||!h||c.postMessage({type:"visual-editor::activate",script:oi},h)},jr=()=>{const c=P.current?.contentWindow,h=ft(G);!c||!h||c.postMessage({type:"visual-editor::deactivate"},h)},tn=()=>{const c=P.current?.contentWindow,h=We;!c||!h||(c.postMessage($.mode==="production"||M?{type:"editor::inject",args:{script:Ss}}:{type:"visual-editor::activate",script:Ss},h),c.postMessage({type:"cms-editor::set-labels",labels:qt,kinds:Wt,keys:Gt},h))},Nr=()=>{const c=P.current?.contentWindow,h=We;!c||!h||c.postMessage({type:"cms-editor::deactivate"},h)},Tr=()=>{const c=P.current?.contentWindow,h=We;!c||!h||(c.postMessage({type:"cms-editor::clear-hover"},h),c.postMessage({type:"visual-editor::clear-hover"},h))},Et=c=>{if(c==="blocks"&&!f)return;const h=g;!n&&c!==h&&(c==="blocks"?N.current?.resize("30%"):N.current?.collapse()),E(c),b(null),T(null),c!=="blocks"&&Q(null),h==="visual"&&jr(),c==="visual"&&Gn(),h==="blocks"&&c!=="blocks"&&Nr(),c==="blocks"&&tn()},Cr=()=>{Et(ll(g,f))},Rr=()=>{Et(cl(g,f))},nn=()=>{const c=P.current;if(!c)return;ie();const h=document.activeElement,L=c.tabIndex;c.tabIndex=-1,c.style.pointerEvents="none",c.blur(),wl(c,kt.current);let K;const le=()=>{clearTimeout(K),c.tabIndex=L,c.style.pointerEvents="";const De=document.activeElement;(!De||De===document.body||De===c)&&h?.focus(),c.removeEventListener("load",le)};c.addEventListener("load",le),K=setTimeout(le,3e3)};ko(nn);const jt=Xa(ke.slug,t??""),Nt=Yt&&nt&&!!t,Jn=S.useRef(null);S.useEffect(()=>{if(Nt)return Za(jt)},[Nt,jt]);const{reload:it}=eo(ke.slug,t??""),Yn=S.useRef(it.seq);S.useEffect(()=>{if(Yn.current!==it.seq&&(Yn.current=it.seq,!!Nt&&Jn.current===kt.current)){if(it.navigates){ls(jt);return}nn()}},[it.seq]);const Lr=to(Cn),lt=no(Qe(Se)?Lr:""),Qn=S.useRef(lt);S.useEffect(()=>{const c=Qn.current;if(Qn.current=lt,!c||!lt||c===lt)return;const h=P.current;if(h)return ri({iframe:h,reload:nn})},[lt]);const _r=()=>{const c=Ft.indexOf(k);j(Ft[(c+1)%Ft.length])},sn=(c,h)=>{if(!V)return;const L=V,K={...qe,[c]:h};Ee.current=Fe(W,K),ue(le=>({...le,[L]:K})),at({path:W,pageKey:L,params:K})},Ar=Yi({iframeBase:$.iframeBase,resolvedPath:xe,activeGlobalSectionName:A?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Xn=c=>{const h=re[c.key]??{},L=Fe(c.path,h);(A||Le(L)!==Le(xe))&&ie(),Ee.current=L,J(null),Q(null),se(null),T(null),de(c.key),oe(c.path),at({path:c.path,pageKey:c.key,params:h}),o.selectTarget({kind:"page",key:c.key,path:c.path})};va(rt,c=>{(A||Le(c)!==Le(xe))&&ie(),Ee.current=c,J(null),Q(null),se(null),T(null),de(null),oe(c),at({path:c,pageKey:null,params:{}})});const Or=c=>{if(!tt||!be){os.error(e("sandbox.preview.previewMetadataNotReady"));return}ie(),Ee.current=null;const h=us(be),L=ps(tt,h,c.key);J(c),Q(null),se(L),T(null),o.selectTarget({kind:"section",key:c.key})},Dr=c=>{f&&(J(null),Q(c.key),se(null),Et("blocks"),o.selectTarget({kind:"loader",key:c.key}))},Br=async({name:c,path:h,templateKey:L})=>{if(!t||!r)return;const K=Zs(h);if(K){H(K);return}const le=h.trim().startsWith("/")?h.trim():`/${h.trim()}`;if(He.some(je=>Le(je.path)===Le(le))){H(e("sandbox.preview.pageAlreadyExists",{path:le}));return}let De;if(L&&(De=Z?.[L],!De)){H(e("sandbox.preview.templateNoLongerExists"));return}H(void 0);try{const je=await Rn.mutateAsync({name:c,path:le,template:De});ce(!1),os.success(e("sandbox.preview.pageCreated",{name:c})),await To(pl),Xn({key:je.key,name:je.name,path:je.path}),Et("blocks")}catch(je){H(je instanceof Error?je.message:e("sandbox.preview.failedToCreatePage"))}},Tt=Qi({previewSurfaceActive:nt,daemonReady:Er,production:$.mode==="production",servePreviewUrl:Qe(Se)}),Fr=Xi({showPreviewToolbar:Tt,contentEditingEnabled:m}),Ct=()=>{X(!1),q("")},rn=A?.name??xt?.title??Ht?.name,an=Nn.isPending||Tn.isPending,on=an?ft($.iframeBase):rn,Rt=A?`section:${A.key}`:Y?`loader:${Y}`:V?`page:${V}`:void 0,Mr=Tt?Fr?s.jsxs(La,{open:U,onOpenChange:c=>{X(c),c||q("")},children:[s.jsx(_a,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":e("sandbox.preview.choosePage"),"data-testid":"preview-page-picker",title:an?on??void 0:A||xt?rn:[rn,W].filter(Boolean).join(" · "),className:"group/page-picker flex h-7 w-fit min-w-[320px] items-stretch overflow-hidden whitespace-nowrap rounded-[var(--studio-button-radius,calc(var(--radius)*1.333))] border border-border/60 bg-background text-left text-xs text-muted-foreground transition-colors hover:border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:s.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 px-2 transition-colors group-hover/page-picker:bg-accent/50 group-data-[state=open]/page-picker:bg-accent/50",children:[A&&s.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:[s.jsx(Sa,{size:11}),e("sandbox.preview.globalBadge")]}),xt&&s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[s.jsx(Pa,{size:11}),e("sandbox.preview.loaderBadge")]}),on&&s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:on}),!an&&!A&&!xt&&s.jsx("span",{"data-testid":"preview-page-path",className:"ml-auto min-w-0 truncate text-right font-mono text-muted-foreground",children:W}),s.jsx(xa,{size:12,className:Mt("shrink-0 transition-transform",U&&"rotate-180")})]})})}),s.jsxs(Aa,{className:"w-112 max-w-[calc(100vw-2rem)] p-0",align:"center",sideOffset:8,children:[s.jsxs(Vs,{shouldFilter:!1,defaultValue:Rt,children:[s.jsx(qs,{value:z,onValueChange:c=>{q(c),te.current?.scrollTo({top:0})},placeholder:e("sandbox.preview.searchPagesAndComponents")}),s.jsxs(Hs,{ref:te,className:"max-h-80",children:[s.jsx(Ws,{children:He.length===0&&Ut.length===0&&On.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}),_n.length>0&&s.jsx(mt,{children:_n.map(c=>s.jsxs(pt,{value:`page:${c.key}`,"aria-current":Rt===`page:${c.key}`||void 0,title:`${c.name} · ${c.path}`,onSelect:()=>{Ct(),Xn(c)},className:"gap-3 px-3 py-2.5 aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:c.name}),s.jsx("span",{className:"min-w-0 max-w-1/2 truncate text-right font-mono text-xs text-muted-foreground",children:c.path})]},c.key))}),An.length>0&&s.jsx(mt,{heading:e("sandbox.preview.globalComponents"),children:An.map(c=>s.jsx(pt,{value:`section:${c.key}`,"aria-current":Rt===`section:${c.key}`||void 0,className:"aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",onSelect:()=>{Ct(),Or(c)},children:s.jsx("span",{className:"truncate",children:c.name})},c.key))}),Dn.length>0&&s.jsx(mt,{heading:e("sandbox.preview.globalLoaders"),children:Dn.map(c=>s.jsx(pt,{value:`loader:${c.key}`,"aria-current":Rt===`loader:${c.key}`||void 0,className:"aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",onSelect:()=>{Ct(),Dr(c)},children:s.jsx("span",{className:"truncate",children:c.title})},c.key))})]})]}),!A&&!Y&&ht(W).some(c=>c.type!=="text")&&s.jsx("div",{className:"flex flex-wrap items-center gap-1 border-t px-3 py-3 text-xs text-muted-foreground",children:ht(W).map((c,h)=>{if(c.type==="text")return s.jsx("span",{children:c.text},`text-${h}`);const L=Vt[c.name];return L&&wt?s.jsx(Fi,{sources:L,template:W,paramName:c.name,value:qe[c.name]??"",sandboxRef:wt,onCommit:K=>sn(c.name,K)},`${V}:${c.name}`):s.jsx(Gi,{name:c.name,value:qe[c.name]??"",onCommit:K=>sn(c.name,K)},`${V}:${c.name}`)})}),s.jsx("div",{className:"border-t p-1.5",children:s.jsxs(Xe,{variant:"ghost",className:"w-full justify-start",onClick:()=>{Ct(),H(void 0),ce(!0)},children:[s.jsx(Ra,{size:16}),e("sandbox.preview.createNewPage")]})})]})]}):s.jsx("span",{className:"min-w-0 truncate text-xs text-muted-foreground",children:Ar}):null,Zn=Tt||m?s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[s.jsxs(dn,{children:[s.jsx(un,{asChild:!0,children:s.jsx(ct,{onClick:_r,"aria-label":e(_s[k]),children:k==="mobile"?s.jsx(Ea,{size:16}):k==="tablet"?s.jsx(ja,{size:16}):s.jsx(Na,{size:16})})}),s.jsx(fn,{children:e(_s[k])})]}),Mr,s.jsx("div",{className:"flex shrink-0 items-center gap-1",children:s.jsx(ct,{onClick:kr,"aria-label":e("sandbox.preview.openInNewTab"),children:s.jsx(Wr,{size:16})})})]}):null,$r=(ve||a)&&$.mode==="sandbox",Lt=hl[k],_t=k==="desktop"&&(_.width===0||_.width>=Lt.width+2*Ls),es=_t?1:Math.min(_.width>0?_.width/(Lt.width+2*Ls):1,1),Kr=_t?{width:"100%",height:"100%"}:{width:`${Lt.width}px`,height:_.height>0?`${_.height/es}px`:`${Lt.height}px`,transform:`scale(${es})`,transformOrigin:"top center"},ts=s.jsxs(s.Fragment,{children:[$r&&(Tt||m)&&s.jsx(ct,{onClick:Cr,"aria-pressed":pe==="visual","aria-label":e("sandbox.preview.visualEditor"),active:pe==="visual",children:s.jsx(is,{size:16})}),f&&s.jsxs(dn,{children:[s.jsx(un,{asChild:!0,children:s.jsx(ct,{onClick:Rr,"aria-pressed":pe==="blocks","aria-label":e("sandbox.preview.blocksEditor"),active:pe==="blocks",children:s.jsx(Ca,{size:16})})}),s.jsx(fn,{children:e("sandbox.preview.blocksEditor")})]}),Ve&&s.jsxs(dn,{children:[s.jsx(un,{asChild:!0,children:s.jsx(ct,{onClick:F,"aria-pressed":B,"aria-label":e("sectionsEditor.sectionsEditor.viewJson"),active:B,children:s.jsx(Ta,{size:16})})}),s.jsx(fn,{children:e("sectionsEditor.sectionsEditor.viewJson")})]})]}),zr=!!Y&&pe==="blocks";return s.jsxs("div",{className:"flex flex-col w-full h-full",children:[wt&&Object.entries(Vt).map(([c,h])=>(qe[c]??"")===""?s.jsx(qi,{sources:h,template:W,paramName:c,sandboxRef:wt,onFill:L=>sn(c,L)},`${V}:${c}`):null),s.jsxs(s.Fragment,{children:[s.jsx(as.Toolbar.Center.Portal,{fallback:s.jsx("div",{className:"flex min-w-0 items-center justify-center border-b p-2",children:Zn}),children:Zn}),s.jsx(as.Toolbar.Right.Portal,{fallback:ts,children:ts})]}),s.jsx("div",{className:"flex-1 overflow-hidden relative",children:zr?s.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[s.jsx(Ts,{virtualMcpId:t,externalSelection:w,onViewJsonFile:F}),B&&Ve&&s.jsx("div",{className:"absolute inset-0 z-10",children:s.jsx(Cs,{ref:D,virtualMcpId:t,pageKey:Ve,onClose:O})})]}):s.jsxs(hs,{orientation:"horizontal",disabled:pe!=="blocks",className:"relative isolate",children:[s.jsx(Ot,{ref:N,id:"preview-blocks-editor",defaultSize:pe==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:pe==="blocks"&&s.jsx(Ts,{virtualMcpId:t,externalSelection:w,onViewJsonFile:F})}),pe==="blocks"&&s.jsx(gs,{withHandle:!0}),s.jsx(Ot,{id:"preview-canvas",defaultSize:pe==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden relative z-0",children:s.jsxs(hs,{orientation:"horizontal",disabled:!(B&&Ve),children:[s.jsx(Ot,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:s.jsxs("div",{ref:c=>{if(!c)return;const h=()=>I(K=>K.width===c.clientWidth&&K.height===c.clientHeight?K:{width:c.clientWidth,height:c.clientHeight});h();const L=new ResizeObserver(h);return L.observe(c),()=>L.disconnect()},className:Mt("h-full relative overflow-clip flex justify-center",nt&&!_t&&"bg-muted/30"),children:[(we||mr)&&nt&&s.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:s.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),$.showDecidingLoader&&s.jsx("div",{"data-testid":"preview-deciding",className:"absolute inset-0 z-30 flex items-center justify-center",children:s.jsx(gt,{className:"size-5 text-muted-foreground"})}),$.showBlockingOverlay&&s.jsx("div",{className:"absolute inset-0 z-30",children:s.jsx(cn,{kind:"starting",progress:Mn,claimPhase:Jt})}),!M&&!Pe&&ze.kind==="suspended"&&s.jsx("div",{className:"absolute inset-0 z-30",children:s.jsx(cn,{kind:"suspended",onResume:ge.resume})}),!M&&!Pe&&ze.kind==="errored"&&s.jsx("div",{className:"absolute inset-0 z-30",children:s.jsx(cn,{kind:"errored",error:ze.error,onRetry:ge.retry,connectionsHref:`/${ke.slug}/settings/connections`})}),$.showWakingPill&&s.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:[s.jsx(gt,{className:"size-4.5 mt-0.5 shrink-0 text-muted-foreground"}),s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),s.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),pe==="visual"&&!y&&s.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:[s.jsx(is,{size:12}),e("sandbox.preview.clickElementToAsk")]}),pe==="visual"&&y&&s.jsx(ui,{element:y,onDismiss:()=>b(null)}),nt&&Ge&&s.jsx("div",{className:Mt("shrink-0",!_t&&"border-x border-border bg-background shadow-sm"),style:Kr,onMouseLeave:Tr,children:s.jsx("iframe",{ref:P,src:ot,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Vn.handleError,onLoad:()=>{if(Xt(Rs),Vn.handleLoad(),Te(),Jn.current=kt.current,Nt&&ls(jt),$.mode!=="sandbox"||M){($.mode==="production"&&!$.showWakingPill||M)&&pe==="blocks"&&tn();return}if(Gr("vm_preview_loaded",{view_mode:pe,vm_id:Ze?.sandboxHandle??null}),!A)try{const c=P.current?.contentWindow?.location?.pathname;if(!c)return;const h=Ee.current;if(h!==null&&(Ee.current=null,Le(c)!==Le(h))||Le(c)===Le(xe))return;oe(c),at({path:c,pageKey:ye,params:qe})}catch{}pe==="visual"&&Gn(),pe==="blocks"&&tn()}},$.iframeBase)})]})}),B&&Ve&&s.jsxs(s.Fragment,{children:[s.jsx(gs,{withHandle:!0}),s.jsx(Ot,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:s.jsx(Cs,{ref:D,virtualMcpId:t,pageKey:Ve,onClose:O})})]})]})})]})}),s.jsx(el,{open:ee,onOpenChange:ce,isPending:Rn.isPending,error:C,templates:He,onSubmit:Br})]})}const Sl=async(t,e)=>{try{return await fetch(t,{method:"HEAD",mode:"no-cors",cache:"no-store",credentials:"omit",signal:e}),!0}catch{return!1}},Pl=1e4,El=1e4,jl=5e3,Nl=2;function Tl(t,e){return t&&e===0?El:Math.min(1e3*2**Math.max(0,e-1),jl)}function Cl(t,e,n){return e?!0:t===!0&&n<Nl}function Rl(t,e){const n=ne.c(11),r=Sl,i=Jr();let u;n[0]!==t?(u=Ds.localAppReachable(t??""),n[0]=t,n[1]=u):u=n[1];const a=u;let o;n[2]!==r||n[3]!==i||n[4]!==a||n[5]!==t?(o=async m=>{const{signal:f}=m,x=new AbortController,v=()=>x.abort();f.addEventListener("abort",v);const E=setTimeout(v,Pl),g=await r(t,x.signal).catch(_l);clearTimeout(E),f.removeEventListener("abort",v);const k=i.getQueryData(a),j=g?0:(k?.failures??0)+1;return{up:Cl(k?.up??null,g,j),failures:j}},n[2]=r,n[3]=i,n[4]=a,n[5]=t,n[6]=o):o=n[6];const l=!!t;let d;n[7]!==a||n[8]!==o||n[9]!==l?(d={queryKey:a,queryFn:o,enabled:l,retry:!1,staleTime:0,gcTime:0,refetchInterval:Ll},n[7]=a,n[8]=o,n[9]=l,n[10]=d):d=n[10];const{data:p}=Yr(d);return t?p?.up??null:null}function Ll(t){return t.state.data?Tl(t.state.data.up,t.state.data.failures):!1}function _l(){return!1}function Al(t){const{backend:e}=t;if(e.kind==="protocol"&&e.source==="local")return{kind:"connected"};if(e.kind==="unavailable"&&e.source==="local"){const n=e.problem;return!n||n.reason==="not-answering"?t.access==="denied"?{kind:"needs-permission"}:{kind:"not-running"}:{kind:"problem",problem:n}}return{kind:"connecting"}}function Pc(t){const e=ne.c(48),{virtualMcpId:n}=t,r=_e(),i=Da(n),{connection:u}=Qs(n),{activeTask:a,taskId:o,currentBranch:l}=It(),d=Do(o),[p,m]=S.useState(!1),f=kn(n,l);let x;e[0]!==f||e[1]!==u?(x=u?Qe(f):null,e[0]=f,e[1]=u,e[2]=x):x=e[2];const v=x,E=Rl(v),g=rr();if(Lo({threadId:o,sandboxBranch:a?.branch??l,agentHasRepo:mn(i?.metadata),threadHasRepo:mn(d)||mn(a?.metadata)})==="none"&&!u){let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:s.jsx(bs,{className:"size-7 text-foreground"})}),e[3]=y):y=e[3];let b;e[4]!==r?(b=r("mainPanelTabs.previewTab.noSourceToPreview"),e[4]=r,e[5]=b):b=e[5];let w;e[6]!==r?(w=r("mainPanelTabs.previewTab.connectGithubDescription"),e[6]=r,e[7]=w):w=e[7];let T,P;e[8]===Symbol.for("react.memo_cache_sentinel")?(T=()=>m(!0),P=s.jsx(bs,{className:"size-4"}),e[8]=T,e[9]=P):(T=e[8],P=e[9]);let N;e[10]!==r?(N=r("mainPanelTabs.previewTab.connectGithub"),e[10]=r,e[11]=N):N=e[11];let B;e[12]!==N?(B=s.jsxs(Xe,{onClick:T,children:[P,N]}),e[12]=N,e[13]=B):B=e[13];let R;e[14]!==b||e[15]!==w||e[16]!==B?(R=s.jsx(Co,{className:"h-full",image:y,title:b,description:w,actions:B}),e[14]=b,e[15]=w,e[16]=B,e[17]=R):R=e[17];let D;e[18]!==p?(D=s.jsx(Ro,{open:p,onOpenChange:m,mode:"agent"}),e[18]=p,e[19]=D):D=e[19];let O;return e[20]!==D||e[21]!==R?(O=s.jsxs(s.Fragment,{children:[R,D]}),e[20]=D,e[21]=R,e[22]=O):O=e[22],O}if(u&&i&&!Qe(f)){let y;e[23]!==g||e[24]!==f?(y=Al({backend:f,access:g}),e[23]=g,e[24]=f,e[25]=y):y=e[25];let b;e[26]!==u.endpoint?(b=so(u.endpoint),e[26]=u.endpoint,e[27]=b):b=e[27];let w;return e[28]!==y||e[29]!==b?(w=s.jsx(Dl,{status:y,host:b}),e[28]=y,e[29]=b,e[30]=w):w=e[30],w}if(v&&E!==!0){let y;e[31]!==r?(y=r("mainPanelTabs.previewTab.localAppWaiting.title"),e[31]=r,e[32]=y):y=e[32];let b;e[33]!==v||e[34]!==r?(b=r("mainPanelTabs.previewTab.localAppWaiting.body",{host:Ol(v)}),e[33]=v,e[34]=r,e[35]=b):b=e[35];let w;e[36]!==b?(w=s.jsx(Kt,{text:b}),e[36]=b,e[37]=w):w=e[37];let T;e[38]!==r?(T=r("mainPanelTabs.previewTab.localAppWaiting.hint"),e[38]=r,e[39]=T):T=e[39];let P;e[40]!==T?(P=s.jsx("p",{role:"status",className:"text-center text-sm text-muted-foreground",children:T}),e[40]=T,e[41]=P):P=e[41];let N;return e[42]!==y||e[43]!==w||e[44]!==P?(N=s.jsx(zt,{headingLevel:2,waiting:!0,title:y,lead:w,footer:P}),e[42]=y,e[43]=w,e[44]=P,e[45]=N):N=e[45],N}let j;return e[46]!==n?(j=s.jsx(pa,{children:s.jsx(kl,{virtualMcpId:n})}),e[46]=n,e[47]=j):j=e[47],j}function Ol(t){try{return new URL(t).host}catch{return t}}function Dl(t){const e=ne.c(20),{status:n,host:r}=t,i=_e();if(n.kind==="connected"){let o;e[0]!==i?(o=i("mainPanelTabs.previewTab.localhostNoPreview.title"),e[0]=i,e[1]=o):o=e[1];let l;e[2]!==i?(l=i("mainPanelTabs.previewTab.localhostNoPreview.body"),e[2]=i,e[3]=l):l=e[3];let d;e[4]!==l?(d=s.jsx(Kt,{text:l}),e[4]=l,e[5]=d):d=e[5];let p;e[6]!==i?(p=i("mainPanelTabs.previewTab.localhostNoPreview.step.title"),e[6]=i,e[7]=p):p=e[7];let m;e[8]!==p?(m=[{title:p,command:`${Js} --preview localhost:3000`}],e[8]=p,e[9]=m):m=e[9];let f;return e[10]!==o||e[11]!==d||e[12]!==m?(f=s.jsx(zt,{headingLevel:2,waiting:!1,title:o,lead:d,steps:m}),e[10]=o,e[11]=d,e[12]=m,e[13]=f):f=e[13],f}let u;e[14]!==r||e[15]!==n?(u=Ko(n,r),e[14]=r,e[15]=n,e[16]=u):u=e[16];let a;return e[17]!==r||e[18]!==u?(a=s.jsx($o,{wait:u,hosts:r}),e[17]=r,e[18]=u,e[19]=a):a=e[19],a}export{$o as L,Pc as P,zt as S,Sc as u};
@@ -1 +1 @@
1
- import{s as ye}from"./thread-intent-2PQ2tJ8y.js";import{c as w,K as ie,m as ae,b as se,j as f,h as xe,r as H,l as re,I as le,ah as be,s as je,v as Pe,B as ke,q as ve,D as Se}from"./index-B-eHj4u4.js";import{J as Ce,D as we}from"./agent-icon-E5NFjGaq.js";import{ap as Ne}from"./site-editor-toast-Rw5XomcC.js";const De="https://placeholder.invalid";function Ge(s,e){const t=(s??"").trim();if(!t)return"";const o=ye((e??"").trim());if(!o)return"";try{const i=new URL(t,De),a=new URL(o);return a.pathname=i.pathname,a.search=i.search,a.hash=i.hash,a.href}catch{return""}}const fe="vtex/loaders/intelligentSearch/productList.ts",Te="vtex/loaders/categories/tree.ts",Ee=24;function J(s){return s&&typeof s=="object"&&!Array.isArray(s)?s:null}function Le(s){return s.split("/").filter(Boolean).map((t,o)=>`category-${o+1}/${t}`).join("/")}function $e(s,e){const t=e.trim(),o=fe,i=Ee;if(s==="cluster")return t?[{resolveType:o,props:{collection:t,count:i}}]:[];if(s==="category"){if(!t)return[];const d=Le(t);return d?[{resolveType:o,props:{facets:d,count:i}}]:[]}if(!t)return[{resolveType:o,props:{query:"",count:i}}];const a=[];/^\d+$/.test(t)&&a.push({resolveType:o,props:{ids:[t]}});const l=t.includes("-")&&!/\s/.test(t)?t.replace(/-+/g," "):t;return a.push({resolveType:o,props:{query:l,count:i}}),a}function Ie(){return{resolveType:Te,props:{}}}function _e(s){return{resolveType:fe,props:{ids:s}}}function de(s){return typeof s=="string"||typeof s=="number"?String(s):""}function pe(s){const e=J(s),t=Array.isArray(s)?s:Array.isArray(e?.products)?e.products:[],o=[],i=new Set;for(const a of t){const r=J(a);if(!r)continue;const l=de(r.productID)||de(r.sku);if(!l||i.has(l))continue;i.add(l);const d=J(r.isVariantOf),u=typeof d?.name=="string"&&d.name||typeof r.name=="string"&&r.name||l,n=qe(r.image),c=n[0],m=typeof r.url=="string"&&r.url||typeof d?.url=="string"&&d.url||void 0;o.push({id:l,label:u,image:c,images:n,url:m,category:Ae(r.category),description:Fe(r,d)})}return o}function qe(s){if(!Array.isArray(s))return[];const e=[];for(const t of s){const o=J(t),i=typeof o?.url=="string"?o.url:"";i&&!e.includes(i)&&e.push(i)}return e}function Ae(s){return typeof s!="string"||!s.trim()?void 0:s.split(/[>/]/).map(t=>t.trim()).filter(Boolean).pop()||void 0}function Fe(s,e){const o=(typeof s.description=="string"&&s.description||typeof e?.description=="string"&&e.description||"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();if(o)return o.length>400?`${o.slice(0,400).trimEnd()}…`:o}function Oe(s){if(typeof s!="string"||!s)return null;let e;try{e=new URL(s,"https://placeholder.invalid").pathname}catch{return null}return e.replace(/^\/+|\/+$/g,"")||null}function Re(s){const e=[],t=new Set,o=(i,a)=>{const r=J(i);if(!r)return;const l=typeof r.name=="string"&&r.name?r.name:"",d=l?[...a,l]:a,u=Oe(r.url);if(u&&!t.has(u)&&(t.add(u),e.push({path:u,label:d.join(" › ")||u,url:typeof r.url=="string"?r.url:`/${u}`})),Array.isArray(r.children))for(const n of r.children)o(n,d)};if(Array.isArray(s))for(const i of s)o(i,[]);return e}function Ke(s,e,t=50){const o=e.trim().toLowerCase();return(o?s.filter(a=>a.label.toLowerCase().includes(o)||a.path.toLowerCase().includes(o)):s).slice(0,t)}const ze=1e4;async function ce(s,{resolveType:e,props:t}){const o=await fetch(Ne(s),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...t}),signal:AbortSignal.timeout(ze)});if(!o.ok)throw new Error(`Failed to fetch (${o.status})`);return o.json()}function We(s,e){const t=w.c(20);let o;t[0]!==e?(o=new Set(e.filter(Boolean)),t[0]=e,t[1]=o):o=t[1];let i;t[2]!==o?(i=[...o],t[2]=o,t[3]=i):i=t[3];const a=i;let r;t[4]!==a||t[5]!==s?(r=ie.sandboxInvoke(s?`${s.orgSlug}/${s.virtualMcpId}/${s.branch}`:"none",`blog-products-by-ids:${a.join(",")}`),t[4]=a,t[5]=s,t[6]=r):r=t[6];let l;t[7]!==a||t[8]!==s?(l=()=>ce(s,_e(a)).then(pe),t[7]=a,t[8]=s,t[9]=l):l=t[9];const d=!!s&&a.length>0;let u;t[10]!==r||t[11]!==l||t[12]!==d?(u={queryKey:r,queryFn:l,enabled:d,staleTime:6e4,retry:1},t[10]=r,t[11]=l,t[12]=d,t[13]=u):u=t[13];const n=ae(u);let c;if(t[14]!==n.data){c=new Map;for(const p of n.data??[])c.set(p.id,p);t[14]=n.data,t[15]=c}else c=t[15];let m;return t[16]!==c||t[17]!==n.isError||t[18]!==n.isLoading?(m={byId:c,isLoading:n.isLoading,isError:n.isError},t[16]=c,t[17]=n.isError,t[18]=n.isLoading,t[19]=m):m=t[19],m}function me(s){return`${s.orgSlug}/${s.virtualMcpId}/${s.branch}`}function ge(s){const e=w.c(9),{query:t,emptyLabel:o,loadingLabel:i}=s,a=se();if(t.isLoading){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=f.jsx(xe,{size:"xs"}),e[0]=l):l=e[0];let d;return e[1]!==i?(d=f.jsxs("div",{className:"flex items-center gap-2 px-2 py-6 text-sm text-muted-foreground",children:[l,i]}),e[1]=i,e[2]=d):d=e[2],d}if(t.isError){let l;e[3]!==a?(l=a("sandbox.productPickerDialog.couldNotLoad"),e[3]=a,e[4]=l):l=e[4];let d;return e[5]!==l?(d=f.jsx("p",{className:"px-2 py-6 text-sm text-muted-foreground",children:l}),e[5]=l,e[6]=d):d=e[6],d}let r;return e[7]!==o?(r=f.jsx("p",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:o}),e[7]=o,e[8]=r):r=e[8],r}function Be(s){const e=w.c(32),{sandboxRef:t,enabled:o,onSelect:i,className:a}=s,r=se(),[l,d]=H.useState("");let u;e[0]!==t?(u=ie.sandboxInvoke(me(t),"blog-category-tree"),e[0]=t,e[1]=u):u=e[1];let n;e[2]!==t?(n=()=>ce(t,Ie()).then(Re),e[2]=t,e[3]=n):n=e[3];let c;e[4]!==o||e[5]!==u||e[6]!==n?(c={queryKey:u,queryFn:n,enabled:o,staleTime:6e4,retry:1},e[4]=o,e[5]=u,e[6]=n,e[7]=c):c=e[7];const m=ae(c);let p,g,h,P;if(e[8]!==a||e[9]!==l||e[10]!==i||e[11]!==m||e[12]!==r){const C=Ke(m.data??[],l);h="space-y-2";let j;e[17]===Symbol.for("react.memo_cache_sentinel")?(j=S=>d(S.target.value),e[17]=j):j=e[17];let b;e[18]!==r?(b=r("sandbox.productPickerDialog.filterCategoriesPlaceholder"),e[18]=r,e[19]=b):b=e[19],e[20]!==l||e[21]!==b?(P=f.jsx(le,{value:l,onChange:j,placeholder:b,className:"h-9"}),e[20]=l,e[21]=b,e[22]=P):P=e[22],e[23]!==a?(p=re("overflow-y-auto rounded-md border",a),e[23]=a,e[24]=p):p=e[24],g=C.length===0?f.jsx(ge,{query:m,loadingLabel:r("sandbox.productPickerDialog.loadingCategories"),emptyLabel:r("sandbox.productPickerDialog.noCategories")}):f.jsx("div",{className:"p-1",children:C.map(S=>f.jsx("button",{type:"button",onClick:()=>i(S),className:"block w-full truncate px-2 py-1.5 text-left text-sm hover:bg-muted/60 rounded-lg",children:S.label},S.path))}),e[8]=a,e[9]=l,e[10]=i,e[11]=m,e[12]=r,e[13]=p,e[14]=g,e[15]=h,e[16]=P}else p=e[13],g=e[14],h=e[15],P=e[16];let x;e[25]!==p||e[26]!==g?(x=f.jsx("div",{className:p,children:g}),e[25]=p,e[26]=g,e[27]=x):x=e[27];let v;return e[28]!==h||e[29]!==P||e[30]!==x?(v=f.jsxs("div",{className:h,children:[P,x]}),e[28]=h,e[29]=P,e[30]=x,e[31]=v):v=e[31],v}const Ue=[{id:"search",labelKey:"sandbox.productPickerDialog.modeSearch"},{id:"category",labelKey:"sandbox.productPickerDialog.modeCategory"},{id:"cluster",labelKey:"sandbox.productPickerDialog.modeClusterId"}];async function Me(s,e){if(e.length===0)return[];const t=await Promise.allSettled(e.map(r=>ce(s,r))),o=t.filter(r=>r.status==="fulfilled").map(r=>r.value);if(o.length===0){const r=t.find(l=>l.status==="rejected");throw r?r.reason:new Error("Failed to fetch products")}const i=[],a=new Set;for(const r of o)for(const l of pe(r))a.has(l.id)||(a.add(l.id),i.push(l));return i}function ue(s){const e=w.c(6),[t,o]=H.useState(""),[i,a]=H.useState(""),r=H.useRef(null);let l;e[0]!==s?(l=n=>{o(n),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>a(n),s)},e[0]=s,e[1]=l):l=e[1];const d=l;let u;return e[2]!==i||e[3]!==d||e[4]!==t?(u={value:t,debounced:i,onChange:d},e[2]=i,e[3]=d,e[4]=t,e[5]=u):u=e[5],u}function Ve(s){const e=w.c(23),{option:t,selected:o,onToggle:i}=s,a=o?"border-primary/40 bg-primary/5":"border-transparent hover:bg-muted/60";let r;e[0]!==a?(r=re("flex w-full items-center gap-3 rounded-lg border px-2 py-2 text-left transition-colors",a),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==t.image?(l=f.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:t.image?f.jsx("img",{src:t.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):f.jsx(Ce,{size:14,className:"text-muted-foreground"})}),e[2]=t.image,e[3]=l):l=e[3];let d;e[4]!==t.label?(d=f.jsx("span",{className:"line-clamp-2 text-sm",children:t.label}),e[4]=t.label,e[5]=d):d=e[5];let u;e[6]!==t.id?(u=f.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:["ID ",t.id]}),e[6]=t.id,e[7]=u):u=e[7];let n;e[8]!==d||e[9]!==u?(n=f.jsxs("span",{className:"min-w-0 flex-1",children:[d,u]}),e[8]=d,e[9]=u,e[10]=n):n=e[10];const c=o?"border-primary bg-primary text-primary-foreground":"border-border text-transparent";let m;e[11]!==c?(m=re("flex h-5 w-5 shrink-0 items-center justify-center rounded-full border",c),e[11]=c,e[12]=m):m=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=f.jsx(be,{size:12}),e[13]=p):p=e[13];let g;e[14]!==m?(g=f.jsx("span",{className:m,children:p}),e[14]=m,e[15]=g):g=e[15];let h;return e[16]!==i||e[17]!==o||e[18]!==g||e[19]!==r||e[20]!==l||e[21]!==n?(h=f.jsxs("button",{type:"button",onClick:i,"aria-pressed":o,className:r,children:[l,n,g]}),e[16]=i,e[17]=o,e[18]=g,e[19]=r,e[20]=l,e[21]=n,e[22]=h):h=e[22],h}function Ye(s){const e=w.c(20),{sandboxRef:t,open:o,selected:i,onSelect:a}=s,r=se();if(i){let d;e[0]!==a?(d=()=>a(null),e[0]=a,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=f.jsx(we,{size:14}),e[2]=u):u=e[2];let n;e[3]!==r?(n=r("sandbox.productPickerDialog.categoryLabel"),e[3]=r,e[4]=n):n=e[4];let c;e[5]!==i.label?(c=f.jsx("span",{className:"text-foreground",children:i.label}),e[5]=i.label,e[6]=c):c=e[6];let m;e[7]!==r?(m=r("sandbox.productPickerDialog.change"),e[7]=r,e[8]=m):m=e[8];let p;e[9]!==n||e[10]!==c||e[11]!==m?(p=f.jsxs("span",{className:"truncate",children:[n,c," —",m]}),e[9]=n,e[10]=c,e[11]=m,e[12]=p):p=e[12];let g;return e[13]!==d||e[14]!==p?(g=f.jsxs("button",{type:"button",onClick:d,className:"flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[u,p]}),e[13]=d,e[14]=p,e[15]=g):g=e[15],g}let l;return e[16]!==a||e[17]!==o||e[18]!==t?(l=f.jsx(Be,{sandboxRef:t,enabled:o,onSelect:a,className:"h-48"}),e[16]=a,e[17]=o,e[18]=t,e[19]=l):l=e[19],l}function Ze(s){const e=w.c(90),{open:t,onOpenChange:o,sandboxRef:i,selectedIds:a,onChange:r,onPicked:l,multiple:d}=s,u=d===void 0?!0:d,n=se(),[c,m]=H.useState("search"),p=ue(300),g=ue(300),[h,P]=H.useState(null),x=c==="search"?p.debounced:c==="cluster"?g.debounced:h?.path??"";let v;e[0]!==c||e[1]!==x?(v=$e(c,x),e[0]=c,e[1]=x,e[2]=v):v=e[2];const C=v;let j;e[3]!==c||e[4]!==i||e[5]!==x?(j=ie.sandboxInvoke(me(i),`blog-product:${c}:${x}`),e[3]=c,e[4]=i,e[5]=x,e[6]=j):j=e[6];let b;e[7]!==C||e[8]!==i?(b=()=>Me(i,C),e[7]=C,e[8]=i,e[9]=b):b=e[9];const S=t&&C.length>0;let Q;e[10]!==j||e[11]!==b||e[12]!==S?(Q={queryKey:j,queryFn:b,enabled:S,staleTime:6e4,retry:1},e[10]=j,e[11]=b,e[12]=S,e[13]=Q):Q=e[13];const N=ae(Q);let X;e[14]!==a?(X=new Set(a.filter(Boolean)),e[14]=a,e[15]=X):X=e[15];const k=X;let G;e[16]!==u||e[17]!==r||e[18]!==l||e[19]!==k||e[20]!==a?(G=y=>{const te=y.id,ne=k.has(te);if(l){l(y,!ne);return}r(u?ne?a.filter(he=>he!==te):[...a.filter(Boolean),te]:ne?[]:[te])},e[16]=u,e[17]=r,e[18]=l,e[19]=k,e[20]=a,e[21]=G):G=e[21];const oe=G;let W;e[22]!==N.data?(W=N.data??[],e[22]=N.data,e[23]=W):W=e[23];const Z=W,D=C.length===0;let T;e[24]!==u||e[25]!==n?(T=n(u?"sandbox.productPickerDialog.addProducts":"sandbox.productPickerDialog.chooseProduct"),e[24]=u,e[25]=n,e[26]=T):T=e[26];let E;e[27]!==T?(E=f.jsx(je,{className:"border-b border-border px-4 py-3",children:f.jsx(Pe,{className:"text-sm font-medium",children:T})}),e[27]=T,e[28]=E):E=e[28];let L;e[29]!==c||e[30]!==n?(L=Ue.map(y=>f.jsx("button",{type:"button",onClick:()=>m(y.id),className:re("rounded-lg px-2.5 py-1 text-sm transition-colors",c===y.id?"bg-muted font-medium text-foreground":"text-muted-foreground hover:text-foreground"),children:n(y.labelKey)},y.id)),e[29]=c,e[30]=n,e[31]=L):L=e[31];let $;e[32]!==L?($=f.jsx("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-4 py-2",children:L}),e[32]=L,e[33]=$):$=e[33];let I;e[34]!==c||e[35]!==p||e[36]!==n?(I=c==="search"&&f.jsx(le,{autoFocus:!0,value:p.value,onChange:y=>p.onChange(y.target.value),placeholder:n("sandbox.productPickerDialog.searchProductsPlaceholder"),className:"h-9"}),e[34]=c,e[35]=p,e[36]=n,e[37]=I):I=e[37];let _;e[38]!==g||e[39]!==c||e[40]!==n?(_=c==="cluster"&&f.jsx(le,{autoFocus:!0,value:g.value,onChange:y=>g.onChange(y.target.value),placeholder:n("sandbox.productPickerDialog.clusterIdPlaceholder"),className:"h-9"}),e[38]=g,e[39]=c,e[40]=n,e[41]=_):_=e[41];let q;e[42]!==h||e[43]!==c||e[44]!==t||e[45]!==i?(q=c==="category"&&f.jsx(Ye,{sandboxRef:i,open:t,selected:h,onSelect:P}),e[42]=h,e[43]=c,e[44]=t,e[45]=i,e[46]=q):q=e[46];let A;e[47]!==I||e[48]!==_||e[49]!==q?(A=f.jsxs("div",{className:"shrink-0 space-y-2 px-4 py-3",children:[I,_,q]}),e[47]=I,e[48]=_,e[49]=q,e[50]=A):A=e[50];let F;e[51]!==Z||e[52]!==N||e[53]!==k||e[54]!==D||e[55]!==n||e[56]!==oe?(F=Z.length>0?Z.map(y=>f.jsx(Ve,{option:y,selected:k.has(y.id),onToggle:()=>oe(y)},y.id)):!D&&f.jsx(ge,{query:N,loadingLabel:n("sandbox.productPickerDialog.loadingProducts"),emptyLabel:n("sandbox.productPickerDialog.noProductsFound")}),e[51]=Z,e[52]=N,e[53]=k,e[54]=D,e[55]=n,e[56]=oe,e[57]=F):F=e[57];let O;e[58]!==c||e[59]!==D||e[60]!==n?(O=D&&f.jsx("p",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:n(c==="category"?"sandbox.productPickerDialog.pickCategoryPrompt":"sandbox.productPickerDialog.enterClusterPrompt")}),e[58]=c,e[59]=D,e[60]=n,e[61]=O):O=e[61];let R;e[62]!==F||e[63]!==O?(R=f.jsxs("div",{className:"min-h-0 flex-1 space-y-1 overflow-y-auto border-t border-border px-3 py-2",children:[F,O]}),e[62]=F,e[63]=O,e[64]=R):R=e[64];let K;e[65]!==k.size||e[66]!==n?(K=k.size===0?n("sandbox.productPickerDialog.noneSelected"):n("sandbox.productPickerDialog.selectedCount",{count:String(k.size)}),e[65]=k.size,e[66]=n,e[67]=K):K=e[67];let z;e[68]!==K?(z=f.jsx("span",{className:"text-xs text-muted-foreground",children:K}),e[68]=K,e[69]=z):z=e[69];let B;e[70]!==o?(B=()=>o(!1),e[70]=o,e[71]=B):B=e[71];let U;e[72]!==n?(U=n("sandbox.productPickerDialog.done"),e[72]=n,e[73]=U):U=e[73];let M;e[74]!==B||e[75]!==U?(M=f.jsx(ke,{size:"sm",onClick:B,children:U}),e[74]=B,e[75]=U,e[76]=M):M=e[76];let V;e[77]!==z||e[78]!==M?(V=f.jsxs("div",{className:"flex shrink-0 items-center justify-between border-t border-border px-4 py-3",children:[z,M]}),e[77]=z,e[78]=M,e[79]=V):V=e[79];let Y;e[80]!==E||e[81]!==$||e[82]!==A||e[83]!==R||e[84]!==V?(Y=f.jsxs(ve,{className:"flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[560px] sm:max-w-[560px]",children:[E,$,A,R,V]}),e[80]=E,e[81]=$,e[82]=A,e[83]=R,e[84]=V,e[85]=Y):Y=e[85];let ee;return e[86]!==o||e[87]!==t||e[88]!==Y?(ee=f.jsx(Se,{open:t,onOpenChange:o,children:Y}),e[86]=o,e[87]=t,e[88]=Y,e[89]=ee):ee=e[89],ee}export{Be as C,Ze as P,$e as b,ce as i,pe as p,Ge as r,We as u};
1
+ import{s as ye}from"./thread-intent-9GHukD-s.js";import{c as w,K as ie,m as ae,b as se,j as f,h as xe,r as H,l as re,I as le,ah as be,s as je,v as Pe,B as ke,q as ve,D as Se}from"./index-BlWeDA0T.js";import{J as Ce,D as we}from"./agent-icon-Cwi3uRdu.js";import{ap as Ne}from"./site-editor-toast-B6rO5nP0.js";const De="https://placeholder.invalid";function Ge(s,e){const t=(s??"").trim();if(!t)return"";const o=ye((e??"").trim());if(!o)return"";try{const i=new URL(t,De),a=new URL(o);return a.pathname=i.pathname,a.search=i.search,a.hash=i.hash,a.href}catch{return""}}const fe="vtex/loaders/intelligentSearch/productList.ts",Te="vtex/loaders/categories/tree.ts",Ee=24;function J(s){return s&&typeof s=="object"&&!Array.isArray(s)?s:null}function Le(s){return s.split("/").filter(Boolean).map((t,o)=>`category-${o+1}/${t}`).join("/")}function $e(s,e){const t=e.trim(),o=fe,i=Ee;if(s==="cluster")return t?[{resolveType:o,props:{collection:t,count:i}}]:[];if(s==="category"){if(!t)return[];const d=Le(t);return d?[{resolveType:o,props:{facets:d,count:i}}]:[]}if(!t)return[{resolveType:o,props:{query:"",count:i}}];const a=[];/^\d+$/.test(t)&&a.push({resolveType:o,props:{ids:[t]}});const l=t.includes("-")&&!/\s/.test(t)?t.replace(/-+/g," "):t;return a.push({resolveType:o,props:{query:l,count:i}}),a}function Ie(){return{resolveType:Te,props:{}}}function _e(s){return{resolveType:fe,props:{ids:s}}}function de(s){return typeof s=="string"||typeof s=="number"?String(s):""}function pe(s){const e=J(s),t=Array.isArray(s)?s:Array.isArray(e?.products)?e.products:[],o=[],i=new Set;for(const a of t){const r=J(a);if(!r)continue;const l=de(r.productID)||de(r.sku);if(!l||i.has(l))continue;i.add(l);const d=J(r.isVariantOf),u=typeof d?.name=="string"&&d.name||typeof r.name=="string"&&r.name||l,n=qe(r.image),c=n[0],m=typeof r.url=="string"&&r.url||typeof d?.url=="string"&&d.url||void 0;o.push({id:l,label:u,image:c,images:n,url:m,category:Ae(r.category),description:Fe(r,d)})}return o}function qe(s){if(!Array.isArray(s))return[];const e=[];for(const t of s){const o=J(t),i=typeof o?.url=="string"?o.url:"";i&&!e.includes(i)&&e.push(i)}return e}function Ae(s){return typeof s!="string"||!s.trim()?void 0:s.split(/[>/]/).map(t=>t.trim()).filter(Boolean).pop()||void 0}function Fe(s,e){const o=(typeof s.description=="string"&&s.description||typeof e?.description=="string"&&e.description||"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();if(o)return o.length>400?`${o.slice(0,400).trimEnd()}…`:o}function Oe(s){if(typeof s!="string"||!s)return null;let e;try{e=new URL(s,"https://placeholder.invalid").pathname}catch{return null}return e.replace(/^\/+|\/+$/g,"")||null}function Re(s){const e=[],t=new Set,o=(i,a)=>{const r=J(i);if(!r)return;const l=typeof r.name=="string"&&r.name?r.name:"",d=l?[...a,l]:a,u=Oe(r.url);if(u&&!t.has(u)&&(t.add(u),e.push({path:u,label:d.join(" › ")||u,url:typeof r.url=="string"?r.url:`/${u}`})),Array.isArray(r.children))for(const n of r.children)o(n,d)};if(Array.isArray(s))for(const i of s)o(i,[]);return e}function Ke(s,e,t=50){const o=e.trim().toLowerCase();return(o?s.filter(a=>a.label.toLowerCase().includes(o)||a.path.toLowerCase().includes(o)):s).slice(0,t)}const ze=1e4;async function ce(s,{resolveType:e,props:t}){const o=await fetch(Ne(s),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...t}),signal:AbortSignal.timeout(ze)});if(!o.ok)throw new Error(`Failed to fetch (${o.status})`);return o.json()}function We(s,e){const t=w.c(20);let o;t[0]!==e?(o=new Set(e.filter(Boolean)),t[0]=e,t[1]=o):o=t[1];let i;t[2]!==o?(i=[...o],t[2]=o,t[3]=i):i=t[3];const a=i;let r;t[4]!==a||t[5]!==s?(r=ie.sandboxInvoke(s?`${s.orgSlug}/${s.virtualMcpId}/${s.branch}`:"none",`blog-products-by-ids:${a.join(",")}`),t[4]=a,t[5]=s,t[6]=r):r=t[6];let l;t[7]!==a||t[8]!==s?(l=()=>ce(s,_e(a)).then(pe),t[7]=a,t[8]=s,t[9]=l):l=t[9];const d=!!s&&a.length>0;let u;t[10]!==r||t[11]!==l||t[12]!==d?(u={queryKey:r,queryFn:l,enabled:d,staleTime:6e4,retry:1},t[10]=r,t[11]=l,t[12]=d,t[13]=u):u=t[13];const n=ae(u);let c;if(t[14]!==n.data){c=new Map;for(const p of n.data??[])c.set(p.id,p);t[14]=n.data,t[15]=c}else c=t[15];let m;return t[16]!==c||t[17]!==n.isError||t[18]!==n.isLoading?(m={byId:c,isLoading:n.isLoading,isError:n.isError},t[16]=c,t[17]=n.isError,t[18]=n.isLoading,t[19]=m):m=t[19],m}function me(s){return`${s.orgSlug}/${s.virtualMcpId}/${s.branch}`}function ge(s){const e=w.c(9),{query:t,emptyLabel:o,loadingLabel:i}=s,a=se();if(t.isLoading){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=f.jsx(xe,{size:"xs"}),e[0]=l):l=e[0];let d;return e[1]!==i?(d=f.jsxs("div",{className:"flex items-center gap-2 px-2 py-6 text-sm text-muted-foreground",children:[l,i]}),e[1]=i,e[2]=d):d=e[2],d}if(t.isError){let l;e[3]!==a?(l=a("sandbox.productPickerDialog.couldNotLoad"),e[3]=a,e[4]=l):l=e[4];let d;return e[5]!==l?(d=f.jsx("p",{className:"px-2 py-6 text-sm text-muted-foreground",children:l}),e[5]=l,e[6]=d):d=e[6],d}let r;return e[7]!==o?(r=f.jsx("p",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:o}),e[7]=o,e[8]=r):r=e[8],r}function Be(s){const e=w.c(32),{sandboxRef:t,enabled:o,onSelect:i,className:a}=s,r=se(),[l,d]=H.useState("");let u;e[0]!==t?(u=ie.sandboxInvoke(me(t),"blog-category-tree"),e[0]=t,e[1]=u):u=e[1];let n;e[2]!==t?(n=()=>ce(t,Ie()).then(Re),e[2]=t,e[3]=n):n=e[3];let c;e[4]!==o||e[5]!==u||e[6]!==n?(c={queryKey:u,queryFn:n,enabled:o,staleTime:6e4,retry:1},e[4]=o,e[5]=u,e[6]=n,e[7]=c):c=e[7];const m=ae(c);let p,g,h,P;if(e[8]!==a||e[9]!==l||e[10]!==i||e[11]!==m||e[12]!==r){const C=Ke(m.data??[],l);h="space-y-2";let j;e[17]===Symbol.for("react.memo_cache_sentinel")?(j=S=>d(S.target.value),e[17]=j):j=e[17];let b;e[18]!==r?(b=r("sandbox.productPickerDialog.filterCategoriesPlaceholder"),e[18]=r,e[19]=b):b=e[19],e[20]!==l||e[21]!==b?(P=f.jsx(le,{value:l,onChange:j,placeholder:b,className:"h-9"}),e[20]=l,e[21]=b,e[22]=P):P=e[22],e[23]!==a?(p=re("overflow-y-auto rounded-md border",a),e[23]=a,e[24]=p):p=e[24],g=C.length===0?f.jsx(ge,{query:m,loadingLabel:r("sandbox.productPickerDialog.loadingCategories"),emptyLabel:r("sandbox.productPickerDialog.noCategories")}):f.jsx("div",{className:"p-1",children:C.map(S=>f.jsx("button",{type:"button",onClick:()=>i(S),className:"block w-full truncate px-2 py-1.5 text-left text-sm hover:bg-muted/60 rounded-lg",children:S.label},S.path))}),e[8]=a,e[9]=l,e[10]=i,e[11]=m,e[12]=r,e[13]=p,e[14]=g,e[15]=h,e[16]=P}else p=e[13],g=e[14],h=e[15],P=e[16];let x;e[25]!==p||e[26]!==g?(x=f.jsx("div",{className:p,children:g}),e[25]=p,e[26]=g,e[27]=x):x=e[27];let v;return e[28]!==h||e[29]!==P||e[30]!==x?(v=f.jsxs("div",{className:h,children:[P,x]}),e[28]=h,e[29]=P,e[30]=x,e[31]=v):v=e[31],v}const Ue=[{id:"search",labelKey:"sandbox.productPickerDialog.modeSearch"},{id:"category",labelKey:"sandbox.productPickerDialog.modeCategory"},{id:"cluster",labelKey:"sandbox.productPickerDialog.modeClusterId"}];async function Me(s,e){if(e.length===0)return[];const t=await Promise.allSettled(e.map(r=>ce(s,r))),o=t.filter(r=>r.status==="fulfilled").map(r=>r.value);if(o.length===0){const r=t.find(l=>l.status==="rejected");throw r?r.reason:new Error("Failed to fetch products")}const i=[],a=new Set;for(const r of o)for(const l of pe(r))a.has(l.id)||(a.add(l.id),i.push(l));return i}function ue(s){const e=w.c(6),[t,o]=H.useState(""),[i,a]=H.useState(""),r=H.useRef(null);let l;e[0]!==s?(l=n=>{o(n),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>a(n),s)},e[0]=s,e[1]=l):l=e[1];const d=l;let u;return e[2]!==i||e[3]!==d||e[4]!==t?(u={value:t,debounced:i,onChange:d},e[2]=i,e[3]=d,e[4]=t,e[5]=u):u=e[5],u}function Ve(s){const e=w.c(23),{option:t,selected:o,onToggle:i}=s,a=o?"border-primary/40 bg-primary/5":"border-transparent hover:bg-muted/60";let r;e[0]!==a?(r=re("flex w-full items-center gap-3 rounded-lg border px-2 py-2 text-left transition-colors",a),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==t.image?(l=f.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:t.image?f.jsx("img",{src:t.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):f.jsx(Ce,{size:14,className:"text-muted-foreground"})}),e[2]=t.image,e[3]=l):l=e[3];let d;e[4]!==t.label?(d=f.jsx("span",{className:"line-clamp-2 text-sm",children:t.label}),e[4]=t.label,e[5]=d):d=e[5];let u;e[6]!==t.id?(u=f.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:["ID ",t.id]}),e[6]=t.id,e[7]=u):u=e[7];let n;e[8]!==d||e[9]!==u?(n=f.jsxs("span",{className:"min-w-0 flex-1",children:[d,u]}),e[8]=d,e[9]=u,e[10]=n):n=e[10];const c=o?"border-primary bg-primary text-primary-foreground":"border-border text-transparent";let m;e[11]!==c?(m=re("flex h-5 w-5 shrink-0 items-center justify-center rounded-full border",c),e[11]=c,e[12]=m):m=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=f.jsx(be,{size:12}),e[13]=p):p=e[13];let g;e[14]!==m?(g=f.jsx("span",{className:m,children:p}),e[14]=m,e[15]=g):g=e[15];let h;return e[16]!==i||e[17]!==o||e[18]!==g||e[19]!==r||e[20]!==l||e[21]!==n?(h=f.jsxs("button",{type:"button",onClick:i,"aria-pressed":o,className:r,children:[l,n,g]}),e[16]=i,e[17]=o,e[18]=g,e[19]=r,e[20]=l,e[21]=n,e[22]=h):h=e[22],h}function Ye(s){const e=w.c(20),{sandboxRef:t,open:o,selected:i,onSelect:a}=s,r=se();if(i){let d;e[0]!==a?(d=()=>a(null),e[0]=a,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=f.jsx(we,{size:14}),e[2]=u):u=e[2];let n;e[3]!==r?(n=r("sandbox.productPickerDialog.categoryLabel"),e[3]=r,e[4]=n):n=e[4];let c;e[5]!==i.label?(c=f.jsx("span",{className:"text-foreground",children:i.label}),e[5]=i.label,e[6]=c):c=e[6];let m;e[7]!==r?(m=r("sandbox.productPickerDialog.change"),e[7]=r,e[8]=m):m=e[8];let p;e[9]!==n||e[10]!==c||e[11]!==m?(p=f.jsxs("span",{className:"truncate",children:[n,c," —",m]}),e[9]=n,e[10]=c,e[11]=m,e[12]=p):p=e[12];let g;return e[13]!==d||e[14]!==p?(g=f.jsxs("button",{type:"button",onClick:d,className:"flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[u,p]}),e[13]=d,e[14]=p,e[15]=g):g=e[15],g}let l;return e[16]!==a||e[17]!==o||e[18]!==t?(l=f.jsx(Be,{sandboxRef:t,enabled:o,onSelect:a,className:"h-48"}),e[16]=a,e[17]=o,e[18]=t,e[19]=l):l=e[19],l}function Ze(s){const e=w.c(90),{open:t,onOpenChange:o,sandboxRef:i,selectedIds:a,onChange:r,onPicked:l,multiple:d}=s,u=d===void 0?!0:d,n=se(),[c,m]=H.useState("search"),p=ue(300),g=ue(300),[h,P]=H.useState(null),x=c==="search"?p.debounced:c==="cluster"?g.debounced:h?.path??"";let v;e[0]!==c||e[1]!==x?(v=$e(c,x),e[0]=c,e[1]=x,e[2]=v):v=e[2];const C=v;let j;e[3]!==c||e[4]!==i||e[5]!==x?(j=ie.sandboxInvoke(me(i),`blog-product:${c}:${x}`),e[3]=c,e[4]=i,e[5]=x,e[6]=j):j=e[6];let b;e[7]!==C||e[8]!==i?(b=()=>Me(i,C),e[7]=C,e[8]=i,e[9]=b):b=e[9];const S=t&&C.length>0;let Q;e[10]!==j||e[11]!==b||e[12]!==S?(Q={queryKey:j,queryFn:b,enabled:S,staleTime:6e4,retry:1},e[10]=j,e[11]=b,e[12]=S,e[13]=Q):Q=e[13];const N=ae(Q);let X;e[14]!==a?(X=new Set(a.filter(Boolean)),e[14]=a,e[15]=X):X=e[15];const k=X;let G;e[16]!==u||e[17]!==r||e[18]!==l||e[19]!==k||e[20]!==a?(G=y=>{const te=y.id,ne=k.has(te);if(l){l(y,!ne);return}r(u?ne?a.filter(he=>he!==te):[...a.filter(Boolean),te]:ne?[]:[te])},e[16]=u,e[17]=r,e[18]=l,e[19]=k,e[20]=a,e[21]=G):G=e[21];const oe=G;let W;e[22]!==N.data?(W=N.data??[],e[22]=N.data,e[23]=W):W=e[23];const Z=W,D=C.length===0;let T;e[24]!==u||e[25]!==n?(T=n(u?"sandbox.productPickerDialog.addProducts":"sandbox.productPickerDialog.chooseProduct"),e[24]=u,e[25]=n,e[26]=T):T=e[26];let E;e[27]!==T?(E=f.jsx(je,{className:"border-b border-border px-4 py-3",children:f.jsx(Pe,{className:"text-sm font-medium",children:T})}),e[27]=T,e[28]=E):E=e[28];let L;e[29]!==c||e[30]!==n?(L=Ue.map(y=>f.jsx("button",{type:"button",onClick:()=>m(y.id),className:re("rounded-lg px-2.5 py-1 text-sm transition-colors",c===y.id?"bg-muted font-medium text-foreground":"text-muted-foreground hover:text-foreground"),children:n(y.labelKey)},y.id)),e[29]=c,e[30]=n,e[31]=L):L=e[31];let $;e[32]!==L?($=f.jsx("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-4 py-2",children:L}),e[32]=L,e[33]=$):$=e[33];let I;e[34]!==c||e[35]!==p||e[36]!==n?(I=c==="search"&&f.jsx(le,{autoFocus:!0,value:p.value,onChange:y=>p.onChange(y.target.value),placeholder:n("sandbox.productPickerDialog.searchProductsPlaceholder"),className:"h-9"}),e[34]=c,e[35]=p,e[36]=n,e[37]=I):I=e[37];let _;e[38]!==g||e[39]!==c||e[40]!==n?(_=c==="cluster"&&f.jsx(le,{autoFocus:!0,value:g.value,onChange:y=>g.onChange(y.target.value),placeholder:n("sandbox.productPickerDialog.clusterIdPlaceholder"),className:"h-9"}),e[38]=g,e[39]=c,e[40]=n,e[41]=_):_=e[41];let q;e[42]!==h||e[43]!==c||e[44]!==t||e[45]!==i?(q=c==="category"&&f.jsx(Ye,{sandboxRef:i,open:t,selected:h,onSelect:P}),e[42]=h,e[43]=c,e[44]=t,e[45]=i,e[46]=q):q=e[46];let A;e[47]!==I||e[48]!==_||e[49]!==q?(A=f.jsxs("div",{className:"shrink-0 space-y-2 px-4 py-3",children:[I,_,q]}),e[47]=I,e[48]=_,e[49]=q,e[50]=A):A=e[50];let F;e[51]!==Z||e[52]!==N||e[53]!==k||e[54]!==D||e[55]!==n||e[56]!==oe?(F=Z.length>0?Z.map(y=>f.jsx(Ve,{option:y,selected:k.has(y.id),onToggle:()=>oe(y)},y.id)):!D&&f.jsx(ge,{query:N,loadingLabel:n("sandbox.productPickerDialog.loadingProducts"),emptyLabel:n("sandbox.productPickerDialog.noProductsFound")}),e[51]=Z,e[52]=N,e[53]=k,e[54]=D,e[55]=n,e[56]=oe,e[57]=F):F=e[57];let O;e[58]!==c||e[59]!==D||e[60]!==n?(O=D&&f.jsx("p",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:n(c==="category"?"sandbox.productPickerDialog.pickCategoryPrompt":"sandbox.productPickerDialog.enterClusterPrompt")}),e[58]=c,e[59]=D,e[60]=n,e[61]=O):O=e[61];let R;e[62]!==F||e[63]!==O?(R=f.jsxs("div",{className:"min-h-0 flex-1 space-y-1 overflow-y-auto border-t border-border px-3 py-2",children:[F,O]}),e[62]=F,e[63]=O,e[64]=R):R=e[64];let K;e[65]!==k.size||e[66]!==n?(K=k.size===0?n("sandbox.productPickerDialog.noneSelected"):n("sandbox.productPickerDialog.selectedCount",{count:String(k.size)}),e[65]=k.size,e[66]=n,e[67]=K):K=e[67];let z;e[68]!==K?(z=f.jsx("span",{className:"text-xs text-muted-foreground",children:K}),e[68]=K,e[69]=z):z=e[69];let B;e[70]!==o?(B=()=>o(!1),e[70]=o,e[71]=B):B=e[71];let U;e[72]!==n?(U=n("sandbox.productPickerDialog.done"),e[72]=n,e[73]=U):U=e[73];let M;e[74]!==B||e[75]!==U?(M=f.jsx(ke,{size:"sm",onClick:B,children:U}),e[74]=B,e[75]=U,e[76]=M):M=e[76];let V;e[77]!==z||e[78]!==M?(V=f.jsxs("div",{className:"flex shrink-0 items-center justify-between border-t border-border px-4 py-3",children:[z,M]}),e[77]=z,e[78]=M,e[79]=V):V=e[79];let Y;e[80]!==E||e[81]!==$||e[82]!==A||e[83]!==R||e[84]!==V?(Y=f.jsxs(ve,{className:"flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[560px] sm:max-w-[560px]",children:[E,$,A,R,V]}),e[80]=E,e[81]=$,e[82]=A,e[83]=R,e[84]=V,e[85]=Y):Y=e[85];let ee;return e[86]!==o||e[87]!==t||e[88]!==Y?(ee=f.jsx(Se,{open:t,onOpenChange:o,children:Y}),e[86]=o,e[87]=t,e[88]=Y,e[89]=ee):ee=e[89],ee}export{Be as C,Ze as P,$e as b,ce as i,pe as p,Ge as r,We as u};