decocms 4.311.0 → 4.311.1

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 (239) hide show
  1. package/dist/client/assets/{AlertCircle-C0recpiM.js → AlertCircle-CV0wkmkm.js} +1 -1
  2. package/dist/client/assets/{AreaChart-XSelV74e.js → AreaChart-C1cHRb4_.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-B2Z12k58.js → ArrowLeft-IJ5Bt6rF.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-B_j1WdZ5.js → ArrowUp-D1z7pWNj.js} +1 -1
  5. package/dist/client/assets/{Check-BejV2053.js → Check-BHC3_AaF.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-CFTFD5Ed.js → CheckCircle-Ck6NP4ZR.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-D5RFRhzf.js → ChevronDown-B7_Xvf9X.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-DV9U9V1C.js → ChevronRight-BAd6R5vM.js} +1 -1
  9. package/dist/client/assets/{ChevronSelectorVertical-CsU1yTcH.js → ChevronSelectorVertical-BuMW96nw.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-D4IrNOCC.js → ChevronUp-BwgqH970.js} +1 -1
  11. package/dist/client/assets/{Copy01-Cr3MDnu-.js → Copy01-CCWxdpWb.js} +1 -1
  12. package/dist/client/assets/{CreditCard01-D_XNSGw3.js → CreditCard01-DygKVzhJ.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-DqsE4vgP.js → DotsVertical-DDZxDsoM.js} +1 -1
  14. package/dist/client/assets/{Download01-Cu0GEQBo.js → Download01-B-85Q1ff.js} +1 -1
  15. package/dist/client/assets/{Eye-DhUWQAZM.js → Eye-CFdbtUej.js} +1 -1
  16. package/dist/client/assets/{FilterLines-DahI-t1v.js → FilterLines-Dcx0EftC.js} +1 -1
  17. package/dist/client/assets/{GitBranch01-B7UokEiw.js → GitBranch01-CMJwWlxW.js} +1 -1
  18. package/dist/client/assets/{Globe01-8plmq2TA.js → Globe01-qzkbgw6Z.js} +1 -1
  19. package/dist/client/assets/{Globe04-DlFdM3LP.js → Globe04-D9zY4y4d.js} +1 -1
  20. package/dist/client/assets/{HardDrive-57Sc_B7u.js → HardDrive-Bn4IEQJY.js} +1 -1
  21. package/dist/client/assets/{Image01-HOTAu7DE.js → Image01-D-AxQSgh.js} +1 -1
  22. package/dist/client/assets/{Key01-DLcgmMi7.js → Key01-BpVUK5pT.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-C5L2pr2x.js → LinkExternal01-BE54YHhd.js} +1 -1
  24. package/dist/client/assets/{LockUnlocked01-BleHTt-O.js → LockUnlocked01-871SLvf7.js} +1 -1
  25. package/dist/client/assets/{LogOut01-CfPLGrdh.js → LogOut01-CJWERaXO.js} +1 -1
  26. package/dist/client/assets/{Monitor01-CGzGmiSx.js → Monitor01-CsG8STIy.js} +1 -1
  27. package/dist/client/assets/{Package-WyJYCcJV.js → Package-BuYOwIZB.js} +1 -1
  28. package/dist/client/assets/{Palette-ivE2ilgf.js → Palette-BGSolCEG.js} +1 -1
  29. package/dist/client/assets/{Play-CsI3qh5P.js → Play-CKSey6H3.js} +1 -1
  30. package/dist/client/assets/{Plus-BNnPvfG8.js → Plus-nBmz9X8R.js} +1 -1
  31. package/dist/client/assets/{SearchLg-Ccchnc4p.js → SearchLg-BIcfiyKV.js} +1 -1
  32. package/dist/client/assets/{SearchMd-BJmbTOt_.js → SearchMd-BFdtfhDn.js} +1 -1
  33. package/dist/client/assets/{Settings02-By8pQbcj.js → Settings02-CuNh9WdQ.js} +1 -1
  34. package/dist/client/assets/{Share07-dg97NqNd.js → Share07-DswLt_KK.js} +1 -1
  35. package/dist/client/assets/{Shield01-CxgaYLbk.js → Shield01-BuMl41yz.js} +1 -1
  36. package/dist/client/assets/{Stars01-C5bXx9wk.js → Stars01-BisNbns8.js} +1 -1
  37. package/dist/client/assets/{Stars02-Dco9Mo0t.js → Stars02-CK8VDMM0.js} +1 -1
  38. package/dist/client/assets/{Sun-CZ4AN-2E.js → Sun-B0Nzj3KW.js} +1 -1
  39. package/dist/client/assets/{SwitchHorizontal01-BfZwTC3u.js → SwitchHorizontal01-CnsWKOU4.js} +1 -1
  40. package/dist/client/assets/{Tool01-BPHywJEb.js → Tool01-h31Lne8n.js} +1 -1
  41. package/dist/client/assets/{Tool02-D4AQe9SD.js → Tool02-CNWGQ_ok.js} +1 -1
  42. package/dist/client/assets/{Trash01-Bkd5f3e4.js → Trash01-Dc1xlq4H.js} +1 -1
  43. package/dist/client/assets/{TrendUp01-C29DtCbZ.js → TrendUp01-CFqXlqp7.js} +1 -1
  44. package/dist/client/assets/{Upload01-CPHyTAd0.js → Upload01-C9iaZjZJ.js} +1 -1
  45. package/dist/client/assets/{User01-rDgL3Cs0.js → User01-Cwj6RUTo.js} +1 -1
  46. package/dist/client/assets/{UserSquare-BO9lFHlw.js → UserSquare-CujtKzAT.js} +1 -1
  47. package/dist/client/assets/{Users01-CGiHQkW6.js → Users01-CJ5UoxWH.js} +1 -1
  48. package/dist/client/assets/{Users03-K46FZ0yi.js → Users03-Cg9bNhp7.js} +1 -1
  49. package/dist/client/assets/{XCircle-Dgz569F-.js → XCircle-DIVDWsBu.js} +1 -1
  50. package/dist/client/assets/{XClose-DRl5snCd.js → XClose-ehDN2GbO.js} +1 -1
  51. package/dist/client/assets/{YAxis-BunnDhD0.js → YAxis-D9p2zL9v.js} +1 -1
  52. package/dist/client/assets/{Zap-CqYQM_jt.js → Zap-IBwSvyRi.js} +1 -1
  53. package/dist/client/assets/{ZapSquare-C3xSe5yB.js → ZapSquare-BeFw43GM.js} +1 -1
  54. package/dist/client/assets/{ZoomOut-B8EEsxrO.js → ZoomOut-CDRlJdUE.js} +1 -1
  55. package/dist/client/assets/{access-gate-BL_s88yN.js → access-gate-D9WZsOrC.js} +1 -1
  56. package/dist/client/assets/{agent-icon-BGP9U6d6.js → agent-icon-CY9ycwem.js} +1 -1
  57. package/dist/client/assets/{agents-list-C83xGM8F.js → agents-list-BYNSI_jE.js} +1 -1
  58. package/dist/client/assets/{ai-providers-B0dgXRVJ.js → ai-providers-BLTn-7iD.js} +1 -1
  59. package/dist/client/assets/{alert-ABstJkwk.js → alert-B_RUXka_.js} +1 -1
  60. package/dist/client/assets/{alert-dialog-Csnli2CD.js → alert-dialog-BJ4wEVSQ.js} +1 -1
  61. package/dist/client/assets/{api-keys-BMxF1-9_.js → api-keys-Bz4lMS3L.js} +1 -1
  62. package/dist/client/assets/{app-editor-6p_LrTu2.js → app-editor-Cg3q49SP.js} +1 -1
  63. package/dist/client/assets/{auth-CYohcmQZ.js → auth-CLm5_F0l.js} +1 -1
  64. package/dist/client/assets/{auth-catchall-BDEFidGh.js → auth-catchall-QxxpsKnp.js} +1 -1
  65. package/dist/client/assets/{auth-entry-CKyE-hFY.js → auth-entry-BGVJUHAs.js} +1 -1
  66. package/dist/client/assets/{auth-split-layout-Duguccx1.js → auth-split-layout-DeofWKZe.js} +1 -1
  67. package/dist/client/assets/{authenticate-and-persist-oauth-Ds-Znneo.js → authenticate-and-persist-oauth-CB4PlrBf.js} +1 -1
  68. package/dist/client/assets/{automation-list-row-ByC4kR2D.js → automation-list-row-i7POabA6.js} +1 -1
  69. package/dist/client/assets/{automation-runs-8GLe55cG.js → automation-runs-Fq4mNYDj.js} +1 -1
  70. package/dist/client/assets/{automations-OEcEm9qP.js → automations-DdbReSDn.js} +1 -1
  71. package/dist/client/assets/{avatar-BuHFImQ0.js → avatar-Wa6VrEnP.js} +1 -1
  72. package/dist/client/assets/{badge-CO8RwMr5.js → badge-B61gpb4G.js} +1 -1
  73. package/dist/client/assets/{block-document-BqLhkJsx.js → block-document-Bp2k8Wc9.js} +1 -1
  74. package/dist/client/assets/{breadcrumb-B40XpKTU.js → breadcrumb-BPv7fTV_.js} +1 -1
  75. package/dist/client/assets/{buckets-CIG9EGU3.js → buckets-BSde592M.js} +1 -1
  76. package/dist/client/assets/{bulk-category-panel-DKVwuCXm.js → bulk-category-panel-Cla8YbNK.js} +1 -1
  77. package/dist/client/assets/{capability-load-error-BqilZ1PU.js → capability-load-error-89RNplOP.js} +1 -1
  78. package/dist/client/assets/{cards-vcKmBwGO.js → cards-CtYnELx3.js} +1 -1
  79. package/dist/client/assets/{category-editor-CYCrdpS-.js → category-editor-mFpEwJXE.js} +1 -1
  80. package/dist/client/assets/{chart-Z15NQIs8.js → chart-CT4bmwai.js} +1 -1
  81. package/dist/client/assets/{chat-context-CY2SGM0h.js → chat-context-BHrex6rH.js} +1 -1
  82. package/dist/client/assets/{checkbox-oWGgw210.js → checkbox-B7WKgEsi.js} +1 -1
  83. package/dist/client/assets/{choose-editor-DPo8388D.js → choose-editor-dBiqStIP.js} +1 -1
  84. package/dist/client/assets/{cli-auth-success-Bd0MHIpk.js → cli-auth-success-CZqw8_EH.js} +1 -1
  85. package/dist/client/assets/{collection-detail-CjvpPo2_.js → collection-detail-DceIOUlA.js} +1 -1
  86. package/dist/client/assets/{collection-display-button-rTFLLVxa.js → collection-display-button-vdSC1mZB.js} +1 -1
  87. package/dist/client/assets/{collection-search-BJAxACkb.js → collection-search-Br3z0w3m.js} +1 -1
  88. package/dist/client/assets/{collection-table-wrapper-DbZwnA9i.js → collection-table-wrapper-CSU5MEwz.js} +1 -1
  89. package/dist/client/assets/{collection-tabs-Lzes2Hm5.js → collection-tabs-DlzEhHVW.js} +1 -1
  90. package/dist/client/assets/{command-Bp1UIw04.js → command-8ooWizOU.js} +1 -1
  91. package/dist/client/assets/{commerce-onboarding-rZiNksbG.js → commerce-onboarding-Dz04S2-9.js} +1 -1
  92. package/dist/client/assets/{config-DRDl0YmS.js → config-BgO9IgWA.js} +1 -1
  93. package/dist/client/assets/{connect-ClZgmNOs.js → connect-N4YVPEVP.js} +1 -1
  94. package/dist/client/assets/{connection-49NkL3aX.js → connection-Bs46H06Q.js} +1 -1
  95. package/dist/client/assets/{connection-card-IfNei3OO.js → connection-card-CbmmPQd2.js} +1 -1
  96. package/dist/client/assets/{connection-detail-MTvaJYNp.js → connection-detail-rw5xbHIJ.js} +1 -1
  97. package/dist/client/assets/{connection-form-helpers-C174Udb3.js → connection-form-helpers-BiyQETTa.js} +1 -1
  98. package/dist/client/assets/{connections-CHRgTc8W.js → connections-maNXjMd_.js} +1 -1
  99. package/dist/client/assets/decopilot-sse-pool-Btz5P3dg.js +1 -0
  100. package/dist/client/assets/{dialog-hItRl0PM.js → dialog-EZiQKr-k.js} +1 -1
  101. package/dist/client/assets/{domain-settings-DWE5A_EC.js → domain-settings-BvHByewm.js} +1 -1
  102. package/dist/client/assets/{drawer-DuLBqwDu.js → drawer-BuLJB_Ng.js} +1 -1
  103. package/dist/client/assets/{dropdown-menu-LWFsRDES.js → dropdown-menu-LJireLy5.js} +1 -1
  104. package/dist/client/assets/{editor-C4Sw9hGx.js → editor-DSb1EWz5.js} +1 -1
  105. package/dist/client/assets/{empty-state-DhZFNn9P.js → empty-state-aNTsPxQg.js} +1 -1
  106. package/dist/client/assets/{extract-connection-data-DPiIwaYg.js → extract-connection-data-H0biCpIG.js} +1 -1
  107. package/dist/client/assets/{file-explorer-BH-3KCjE.js → file-explorer-CH3ShuuH.js} +1 -1
  108. package/dist/client/assets/{file-type-icon-zHhC_odk.js → file-type-icon-C1V83sRx.js} +1 -1
  109. package/dist/client/assets/{folder-icon-CnUII1sC.js → folder-icon-DPyDuMsa.js} +1 -1
  110. package/dist/client/assets/{form-BTWHqvdt.js → form-DFbk408D.js} +1 -1
  111. package/dist/client/assets/{general-DhZ7IsJ7.js → general-DIEQLeUB.js} +1 -1
  112. package/dist/client/assets/{github-repo-picker-olEJzk4H.js → github-repo-picker-BS5F3L-U.js} +1 -1
  113. package/dist/client/assets/{hooks-CkIombAK.js → hooks-X49XWoE0.js} +1 -1
  114. package/dist/client/assets/{index-BRM630BW.js → index-7Eri-5FF.js} +1 -1
  115. package/dist/client/assets/{index-BuyUDL-f.js → index-BFUkCadY.js} +3 -3
  116. package/dist/client/assets/{index-BbLo6MAX.js → index-BoXZxFc9.js} +1 -1
  117. package/dist/client/assets/{index-qyhd0IMj.js → index-BsBcva3V.js} +1 -1
  118. package/dist/client/assets/{index-C_7lMH7J.js → index-CF7KjtFB.js} +1 -1
  119. package/dist/client/assets/{index-DmOnt-rS.js → index-DcWWjsQx.js} +6 -6
  120. package/dist/client/assets/{index-DhgCD36A.js → index-Di7eH1Bd.js} +1 -1
  121. package/dist/client/assets/{index-PL6ljojl.js → index-nBmHAkVz.js} +1 -1
  122. package/dist/client/assets/{index-redirect-Cy_NnU2a.js → index-redirect-oLZruQry.js} +1 -1
  123. package/dist/client/assets/{index-DuLRhFZC.js → index-zJiZ-442.js} +1 -1
  124. package/dist/client/assets/{infra-billing-CmiuUO1m.js → infra-billing-yGKUAjy3.js} +1 -1
  125. package/dist/client/assets/{input-Cb9iSFEg.js → input-B9IgjWfA.js} +1 -1
  126. package/dist/client/assets/{integration-icon-DDXwHQKF.js → integration-icon-BO6Z-DRY.js} +1 -1
  127. package/dist/client/assets/{invite-member-dialog-CWPn4669.js → invite-member-dialog-DSu8X4wK.js} +1 -1
  128. package/dist/client/assets/{label-BkQvhQIM.js → label-DkU_8hZR.js} +1 -1
  129. package/dist/client/assets/{layout-DEY36XRI.js → layout-DTB8w965.js} +1 -1
  130. package/dist/client/assets/{login-D6sPFCW8.js → login-BaXuN3jF.js} +1 -1
  131. package/dist/client/assets/{markdown-0fiCCcV1.js → markdown-BG1ybiOX.js} +1 -1
  132. package/dist/client/assets/{mcp-oauth-DBjycbCF.js → mcp-oauth-DC5O97rk.js} +1 -1
  133. package/dist/client/assets/{members-h-rh3eGF.js → members-Tq-14Ycu.js} +1 -1
  134. package/dist/client/assets/{monaco-editor-C-Q5HTYn.js → monaco-editor-DkEyyAuR.js} +1 -1
  135. package/dist/client/assets/{monitoring-stats-row-B4FAuCa9.js → monitoring-stats-row-DvtCfJhr.js} +1 -1
  136. package/dist/client/assets/{multi-select-Cs1r8Ubg.js → multi-select-DTZRJI8W.js} +1 -1
  137. package/dist/client/assets/{oauth-callback-CM5je5KD.js → oauth-callback-BCxzsOVA.js} +1 -1
  138. package/dist/client/assets/{oauth-callback-ai-provider-Bcr-4szJ.js → oauth-callback-ai-provider-CMNxP96j.js} +1 -1
  139. package/dist/client/assets/{onboarding-Lb-gRBGv.js → onboarding-JQ_L8T3S.js} +1 -1
  140. package/dist/client/assets/{org-layout-CZ39vVwh.js → org-layout-BLxZm0mH.js} +1 -1
  141. package/dist/client/assets/{organization-choice-D1rU5_LS.js → organization-choice-ORfyYu4G.js} +1 -1
  142. package/dist/client/assets/{orgs-YHtQLebS.js → orgs-DjoyAiP1.js} +1 -1
  143. package/dist/client/assets/{page-seo-form-C3aLwSt0.js → page-seo-form-n3Jr5UKD.js} +1 -1
  144. package/dist/client/assets/{popover-CzFHMi1-.js → popover-kWquax2C.js} +1 -1
  145. package/dist/client/assets/{post-calendar-DX9-IYRC.js → post-calendar-V5YkHzT5.js} +1 -1
  146. package/dist/client/assets/{post-editor-C_J5WNPs.js → post-editor-Dw0XoUW-.js} +1 -1
  147. package/dist/client/assets/{primitives-B9LqLGWx.js → primitives-BBB2PKL9.js} +1 -1
  148. package/dist/client/assets/{profile-D8e5tSeS.js → profile-BAP7bs-P.js} +1 -1
  149. package/dist/client/assets/{project-app-view-B27k8y98.js → project-app-view-CMOtQWit.js} +1 -1
  150. package/dist/client/assets/{prompts-DlKoJN67.js → prompts-CeZHcagY.js} +1 -1
  151. package/dist/client/assets/record-editor-D8eYeCmw.js +1 -0
  152. package/dist/client/assets/{redirect-editor-DJxCUYg3.js → redirect-editor-ZpJCTshJ.js} +1 -1
  153. package/dist/client/assets/registry-Dk9PWC-T.js +2 -0
  154. package/dist/client/assets/{registry-layout-Cpcl6TSK.js → registry-layout-BZAYM7jo.js} +1 -1
  155. package/dist/client/assets/{reports-DTxubJgw.js → reports-DdHpzxeM.js} +1 -1
  156. package/dist/client/assets/{require-capability-DuFIGwof.js → require-capability-mikSj6Ng.js} +1 -1
  157. package/dist/client/assets/{required-auth-layout-DGJe8Mlj.js → required-auth-layout-Dfxw0YDf.js} +1 -1
  158. package/dist/client/assets/{reset-password-DxbtkbOg.js → reset-password-B-Q8Xis7.js} +1 -1
  159. package/dist/client/assets/{review-settings-DnhAqpkA.js → review-settings-C8yPcONA.js} +1 -1
  160. package/dist/client/assets/{roles-3q89My_0.js → roles-CZZnv709.js} +1 -1
  161. package/dist/client/assets/{scroll-area-Djm3-sbg.js → scroll-area-DhVLP3PL.js} +1 -1
  162. package/dist/client/assets/{search-input-qkdY6KsE.js → search-input-CEzUTux_.js} +1 -1
  163. package/dist/client/assets/{secrets-DEA-aVW1.js → secrets-BbaKQqXw.js} +1 -1
  164. package/dist/client/assets/{sections-editor-B_M-97ti.js → sections-editor-Dp1jPPnU.js} +1 -1
  165. package/dist/client/assets/{select-BOHmdb8C.js → select-CWvBEvKe.js} +1 -1
  166. package/dist/client/assets/{select-model-CPmeNaNO.js → select-model-YQjbGnxo.js} +1 -1
  167. package/dist/client/assets/{self-tool-result-xX9-YD6Y.js → self-tool-result-CecU6Ah-.js} +1 -1
  168. package/dist/client/assets/{seo-editor-DJVpxpW3.js → seo-editor-DesDFA61.js} +1 -1
  169. package/dist/client/assets/{settings-layout-CeyvpLOE.js → settings-layout-B--7Pa-e.js} +1 -1
  170. package/dist/client/assets/{shell-controls-CXOCgzwX.js → shell-controls-CyjYu8xs.js} +1 -1
  171. package/dist/client/assets/{shell-layout-TUjOtQhE.js → shell-layout-khmxpGoo.js} +1 -1
  172. package/dist/client/assets/{skill-preview-B4NfqEEV.js → skill-preview-Bw7bGCaH.js} +1 -1
  173. package/dist/client/assets/{skills-CzZ5YAGr.js → skills-DmBwHZTU.js} +1 -1
  174. package/dist/client/assets/{spinner-BQad3GmW.js → spinner-C9VRn5KD.js} +1 -1
  175. package/dist/client/assets/{sso-bHeadfgf.js → sso-WSFa-jq1.js} +1 -1
  176. package/dist/client/assets/{store-C4oH3kPo.js → store-BqJVQJcM.js} +1 -1
  177. package/dist/client/assets/store-registry-CACSGdig.js +2 -0
  178. package/dist/client/assets/{super-agent-icon-CPbKPIBh.js → super-agent-icon-BGH3Ovdk.js} +1 -1
  179. package/dist/client/assets/{switch-dQhgVuCH.js → switch-C5WRym-1.js} +1 -1
  180. package/dist/client/assets/{synced-repos-Cbj-TInP.js → synced-repos-Oa6XPby4.js} +1 -1
  181. package/dist/client/assets/{table-D_CXPJQu.js → table-9A7mh_ze.js} +1 -1
  182. package/dist/client/assets/{tabs-DZiIU_cf.js → tabs-VcTBcGpQ.js} +1 -1
  183. package/dist/client/assets/{task-board-C5vC-P5k.js → task-board-BsEuBpWv.js} +1 -1
  184. package/dist/client/assets/{tasks-C1pjzmKc.js → tasks-B134eJj-.js} +1 -1
  185. package/dist/client/assets/{textarea-CliLWMBV.js → textarea-ClB5SMay.js} +1 -1
  186. package/dist/client/assets/{thread-route-bh7ZH4NA.js → thread-route-DZ4IYYBA.js} +1 -1
  187. package/dist/client/assets/{toggle-group-Dwtxjfc4.js → toggle-group-BHdQxqTI.js} +1 -1
  188. package/dist/client/assets/{toolbar-3fMfxNen.js → toolbar-CRVklWRM.js} +1 -1
  189. package/dist/client/assets/{track-9YygJVzx.js → track-CN0o4_D1.js} +1 -1
  190. package/dist/client/assets/{types-nGmsoTZv.js → types-LyowwSS5.js} +1 -1
  191. package/dist/client/assets/{use-ai-providers-DwlhpRes.js → use-ai-providers-BtgQbZIG.js} +1 -1
  192. package/dist/client/assets/{use-api-keys-B5cZ7wvR.js → use-api-keys-ChE1m_Yw.js} +1 -1
  193. package/dist/client/assets/{use-automations-CmgiIky3.js → use-automations-wHx6KnEj.js} +1 -1
  194. package/dist/client/assets/{use-autosave-2HBwk4wx.js → use-autosave-WBXLWYPk.js} +1 -1
  195. package/dist/client/assets/{use-connection-bZgPnZOr.js → use-connection-BKvd7uNd.js} +1 -1
  196. package/dist/client/assets/{use-copy-Cq30lUsM.js → use-copy-CPtc2zDl.js} +1 -1
  197. package/dist/client/assets/{use-create-virtual-mcp-DMHxG54f.js → use-create-virtual-mcp-DAlSNJRt.js} +1 -1
  198. package/dist/client/assets/{use-debounced-autosave-DvptVode.js → use-debounced-autosave-BjLAKNcT.js} +1 -1
  199. package/dist/client/assets/{use-debounced-value-DqFNyMpP.js → use-debounced-value-DMcS7FSl.js} +1 -1
  200. package/dist/client/assets/{use-decopilot-events-Cv4HgIi3.js → use-decopilot-events-CeQUVSoy.js} +1 -1
  201. package/dist/client/assets/{use-delete-connection-CsW8T7ZH.js → use-delete-connection-B1W-lrMY.js} +1 -1
  202. package/dist/client/assets/{use-deployment-admin-aSXK_ggq.js → use-deployment-admin-B98G8PcG.js} +1 -1
  203. package/dist/client/assets/{use-destination-route-B_24Whcs.js → use-destination-route-CghQsdF8.js} +1 -1
  204. package/dist/client/assets/{use-file-configs-EoWVXyV1.js → use-file-configs-JseEd11j.js} +1 -1
  205. package/dist/client/assets/{use-infinite-scroll-CY3oO4vc.js → use-infinite-scroll-CMDxuacA.js} +1 -1
  206. package/dist/client/assets/{use-join-requests-EgMaCxaX.js → use-join-requests-DZbIPLac.js} +1 -1
  207. package/dist/client/assets/{use-mcp-auth-status-DObWVXL7.js → use-mcp-auth-status-CY1yj4lV.js} +1 -1
  208. package/dist/client/assets/{use-mcp-client-BISqHyTj.js → use-mcp-client-DBxtnKrM.js} +1 -1
  209. package/dist/client/assets/{use-mcp-tools-Dtv8_qE-.js → use-mcp-tools-TLuFrkim.js} +1 -1
  210. package/dist/client/assets/{use-members-CGZd946r.js → use-members-DaPDZRH4.js} +1 -1
  211. package/dist/client/assets/{use-navigate-to-agent-DDo0Ri7O.js → use-navigate-to-agent-B-ZKJ--7.js} +1 -1
  212. package/dist/client/assets/{use-org-auth-client-DK9IhaDS.js → use-org-auth-client-CLWvfwor.js} +1 -1
  213. package/dist/client/assets/{use-org-repo-syncs-DDOe1mEV.js → use-org-repo-syncs-OQj8Y5Nz.js} +1 -1
  214. package/dist/client/assets/{use-org-sso-BlnuVfy8.js → use-org-sso-DwTAjKoT.js} +1 -1
  215. package/dist/client/assets/{use-organization-roles-vQX1qheI.js → use-organization-roles-BHiS6OQv.js} +1 -1
  216. package/dist/client/assets/{use-organization-settings-9gyyAmDC.js → use-organization-settings-DpT8kLw9.js} +1 -1
  217. package/dist/client/assets/{use-panel-navigate-Dl8TU9Fq.js → use-panel-navigate-DAN1_bgS.js} +1 -1
  218. package/dist/client/assets/{use-registry-connections-C6Vm545i.js → use-registry-connections-2ihnJXRy.js} +1 -1
  219. package/dist/client/assets/{use-secrets-CebeVclF.js → use-secrets-DQgK4fpK.js} +1 -1
  220. package/dist/client/assets/{use-section-preview-base-C3CbXEpd.js → use-section-preview-base-BBcuF_Mg.js} +1 -1
  221. package/dist/client/assets/{use-status-sounds-CZScO2ta.js → use-status-sounds-BHyKjwK2.js} +1 -1
  222. package/dist/client/assets/{use-tags-Bo6st0jt.js → use-tags-dgY3696p.js} +1 -1
  223. package/dist/client/assets/{use-view-mode-CfFp3geX.js → use-view-mode-DVQqdIQZ.js} +1 -1
  224. package/dist/client/assets/{use-virtual-mcp-B6D2i_ny.js → use-virtual-mcp-CBOJyRo8.js} +1 -1
  225. package/dist/client/assets/useInfiniteQuery-DgMDXNM-.js +1 -0
  226. package/dist/client/assets/useSuspenseInfiniteQuery-Ce9i6Dj2.js +1 -0
  227. package/dist/client/assets/{users-KKKtts0z.js → users-Q8mpydd0.js} +1 -1
  228. package/dist/client/assets/{variant-calendar-DPptfq0B.js → variant-calendar-CnvdiA98.js} +1 -1
  229. package/dist/client/assets/{view-mode-toggle-CkVDMUHU.js → view-mode-toggle-DU9mNhqt.js} +1 -1
  230. package/dist/client/index.html +1 -1
  231. package/dist/server/cli.js +1 -1
  232. package/dist/server/server.js +1 -1
  233. package/package.json +1 -1
  234. package/dist/client/assets/decopilot-sse-pool-MEiWGftu.js +0 -1
  235. package/dist/client/assets/record-editor-CAQX4Dhe.js +0 -1
  236. package/dist/client/assets/registry-CgaDNZ4i.js +0 -2
  237. package/dist/client/assets/store-registry-OTCH0UWM.js +0 -2
  238. package/dist/client/assets/useInfiniteQuery-D5GGzERO.js +0 -1
  239. package/dist/client/assets/useSuspenseInfiniteQuery-Dq_znrqe.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-B_M-97ti.js","assets/index-BuyUDL-f.js","assets/index-DS-wHxfn.css","assets/chat-context-CY2SGM0h.js","assets/use-panel-navigate-Dl8TU9Fq.js","assets/use-destination-route-B_24Whcs.js","assets/thread-route-bh7ZH4NA.js","assets/dialog-hItRl0PM.js","assets/Check-BejV2053.js","assets/Copy01-Cr3MDnu-.js","assets/Download01-Cu0GEQBo.js","assets/constants-dLUUoWH7.js","assets/session-runtime-C-KTDVeQ.js","assets/slugify-CEUa2lfQ.js","assets/hooks-CkIombAK.js","assets/use-mcp-client-BISqHyTj.js","assets/auth-CYohcmQZ.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/decopilot-sse-pool-MEiWGftu.js","assets/task-board-C5vC-P5k.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-B6D2i_ny.js","assets/use-ai-providers-DwlhpRes.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-Cv4HgIi3.js","assets/use-organization-settings-9gyyAmDC.js","assets/ChevronDown-D5RFRhzf.js","assets/agent-icon-BGP9U6d6.js","assets/AlertCircle-C0recpiM.js","assets/UserSquare-BO9lFHlw.js","assets/Tool01-BPHywJEb.js","assets/ArrowUp-B_j1WdZ5.js","assets/ArrowLeft-B2Z12k58.js","assets/Tool02-D4AQe9SD.js","assets/XCircle-Dgz569F-.js","assets/TrendUp01-C29DtCbZ.js","assets/ZapSquare-C3xSe5yB.js","assets/ZoomOut-B8EEsxrO.js","assets/Users03-K46FZ0yi.js","assets/CheckCircle-CFTFD5Ed.js","assets/ChevronRight-DV9U9V1C.js","assets/ChevronSelectorVertical-CsU1yTcH.js","assets/ChevronUp-D4IrNOCC.js","assets/DotsVertical-DqsE4vgP.js","assets/Stars02-Dco9Mo0t.js","assets/CreditCard01-D_XNSGw3.js","assets/Settings02-By8pQbcj.js","assets/Eye-DhUWQAZM.js","assets/FilterLines-DahI-t1v.js","assets/Share07-dg97NqNd.js","assets/GitBranch01-B7UokEiw.js","assets/Globe01-8plmq2TA.js","assets/Globe04-DlFdM3LP.js","assets/SwitchHorizontal01-BfZwTC3u.js","assets/HardDrive-57Sc_B7u.js","assets/Image01-HOTAu7DE.js","assets/Key01-DLcgmMi7.js","assets/LinkExternal01-C5L2pr2x.js","assets/LockUnlocked01-BleHTt-O.js","assets/LogOut01-CfPLGrdh.js","assets/Monitor01-CGzGmiSx.js","assets/Sun-CZ4AN-2E.js","assets/Package-WyJYCcJV.js","assets/Palette-ivE2ilgf.js","assets/Play-CsI3qh5P.js","assets/Plus-BNnPvfG8.js","assets/SearchLg-Ccchnc4p.js","assets/SearchMd-BJmbTOt_.js","assets/Shield01-CxgaYLbk.js","assets/Stars01-C5bXx9wk.js","assets/Trash01-Bkd5f3e4.js","assets/Upload01-CPHyTAd0.js","assets/User01-rDgL3Cs0.js","assets/Users01-CGiHQkW6.js","assets/XClose-DRl5snCd.js","assets/Zap-CqYQM_jt.js","assets/scroll-area-Djm3-sbg.js","assets/select-BOHmdb8C.js","assets/input-Cb9iSFEg.js","assets/dropdown-menu-LWFsRDES.js","assets/page-seo-form-C3aLwSt0.js","assets/label-BkQvhQIM.js","assets/switch-dQhgVuCH.js","assets/use-section-preview-base-C3CbXEpd.js","assets/automation-runs-8GLe55cG.js","assets/useInfiniteQuery-D5GGzERO.js","assets/use-infinite-scroll-CY3oO4vc.js","assets/use-connection-bZgPnZOr.js","assets/table-D_CXPJQu.js","assets/empty-state-DhZFNn9P.js","assets/use-members-CGZd946r.js","assets/use-org-auth-client-DK9IhaDS.js","assets/use-automations-CmgiIky3.js","assets/useSuspenseInfiniteQuery-Dq_znrqe.js","assets/avatar-BuHFImQ0.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-Cq30lUsM.js","assets/markdown-0fiCCcV1.js","assets/monaco-editor-C-Q5HTYn.js","assets/spinner-BQad3GmW.js","assets/editor-C4Sw9hGx.js","assets/types-nGmsoTZv.js","assets/shell-layout-TUjOtQhE.js","assets/required-auth-layout-DGJe8Mlj.js","assets/use-org-sso-BlnuVfy8.js","assets/integration-icon-DDXwHQKF.js","assets/use-navigate-to-agent-DDo0Ri7O.js","assets/chart-Z15NQIs8.js","assets/index-BRM630BW.js","assets/form-BTWHqvdt.js","assets/file-type-icon-zHhC_odk.js","assets/drawer-DuLBqwDu.js","assets/collection-search-BJAxACkb.js","assets/tabs-DZiIU_cf.js","assets/toggle-group-Dwtxjfc4.js","assets/super-agent-icon-CPbKPIBh.js","assets/self-tool-result-xX9-YD6Y.js","assets/alert-dialog-Csnli2CD.js","assets/extract-connection-data-DPiIwaYg.js","assets/metadata-dUsYcpuu.js","assets/provision-repo-scoped-github-connection-CMPWtdMv.js","assets/use-debounced-value-DqFNyMpP.js","assets/authenticate-and-persist-oauth-Ds-Znneo.js","assets/mcp-oauth-DBjycbCF.js","assets/track-9YygJVzx.js","assets/popover-CzFHMi1-.js","assets/toolbar-3fMfxNen.js","assets/github-repo-picker-olEJzk4H.js","assets/use-mcp-tools-Dtv8_qE-.js","assets/agent-capabilities-B52k7xCe.js","assets/connection-card-IfNei3OO.js","assets/use-registry-connections-C6Vm545i.js","assets/retry-CErkP7V6.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-CliLWMBV.js","assets/connection-form-helpers-C174Udb3.js","assets/collection-tabs-Lzes2Hm5.js","assets/badge-CO8RwMr5.js","assets/select-model-CPmeNaNO.js","assets/checkbox-oWGgw210.js","assets/ai-providers-logos-DD3qZ33J.js","assets/folder-icon-CnUII1sC.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-CZScO2ta.js","assets/skill-preview-B4NfqEEV.js","assets/use-file-configs-EoWVXyV1.js","assets/pt-BR-CLy76QW2.js","assets/use-debounced-autosave-DvptVode.js","assets/search-input-qkdY6KsE.js","assets/use-mcp-auth-status-DObWVXL7.js","assets/use-secrets-CebeVclF.js","assets/AreaChart-XSelV74e.js","assets/config-DRDl0YmS.js","assets/command-Bp1UIw04.js","assets/index-C_7lMH7J.js","assets/get-initials-D-f_fDFw.js","assets/breadcrumb-B40XpKTU.js","assets/use-tags-Bo6st0jt.js","assets/automation-list-row-ByC4kR2D.js","assets/site-error--i37Vnuw.js","assets/use-org-repo-syncs-DDOe1mEV.js","assets/cards-vcKmBwGO.js","assets/file-explorer-BH-3KCjE.js","assets/app-editor-6p_LrTu2.js","assets/post-editor-C_J5WNPs.js","assets/multi-select-Cs1r8Ubg.js","assets/block-document-BqLhkJsx.js","assets/primitives-B9LqLGWx.js","assets/use-autosave-2HBwk4wx.js","assets/record-editor-CAQX4Dhe.js","assets/category-editor-CYCrdpS-.js","assets/bulk-category-panel-DKVwuCXm.js","assets/index-PL6ljojl.js","assets/seo-editor-DJVpxpW3.js","assets/variant-calendar-DPptfq0B.js","assets/view-mode-toggle-CkVDMUHU.js","assets/post-calendar-DX9-IYRC.js","assets/alert-ABstJkwk.js","assets/redirect-editor-DJxCUYg3.js","assets/project-app-view-B27k8y98.js"])))=>i.map(i=>d[i]);
2
- import{p as ps,r as P,ai as IN,aj as MN,ak as Et,al as Cs,am as ki,an as Re,ao as xr,ap as Cu,aq as ON,ar as Li,as as $N,at as Dm,au as h6,c as B,H as Fe,n as ie,j as o,E as Us,b as re,t as xe,aa as Jr,a5 as fl,a8 as Ke,a9 as We,ab as qe,av as Ds,I as D2,B as ue,aw as I2,ax as m6,x as br,ay as js,az as El,aA as n4,d as Ws,ac as ws,e as Rs,q as Ye,aB as BN,D as so,aC as zN,aD as p6,aE as FN,aF as Qi,aG as k1,aH as _n,aI as UN,aJ as j1,aK as HN,aL as KN,aM as WN,aN as qN,aO as M2,aP as O2,aQ as g6,aR as $2,z as Gh,K as Je,aS as GN,aT as YN,aU as JN,aV as x6,aW as du,o as Tt,k as ot,a as Nn,C as Zu,aX as Nu,m as QN,u as hl,f as no,R as Yh,aY as B2,aZ as XN,a_ as H0,a$ as b6,b0 as Im,b1 as v6,b2 as y6,b3 as _6,b4 as ZN,b5 as eT,L as tT,a3 as L6,b6 as sT,b7 as Jf,b8 as Rl,Y as At,b9 as w6,ba as S6,bb as Dn,P as wi,bc as Nt,s as k6,bd as j6,be as nT,bf as C6,bg as N6,bh as T6,bi as V6,bj as A6,bk as P6,bl as E6,bm as R6,bn as D6,bo as I6,bp as xn,N as ri,bq as iT,br as M6,bs as rT,bt as oT,bu as O6,bv as lT,bw as aT,bx as cT,by as dT,bz as uT,bA as fT,bB as $6,bC as hT,bD as mT,bE as pT,bF as gT,bG as xT,bH as bT,bI as vT,bJ as yT,bK as _T,bL as LT,bM as wT,bN as ST,ah as kT}from"./index-BuyUDL-f.js";import{i as Jh,n as jT}from"./ArrowUp-B_j1WdZ5.js";import{u as la,a as ui,b as As,c as sn,d as B6,s as CT,e as NT,f as TT,g as VT,h as AT,i as PT,j as ET,k as z2,l as z6,T as RT,A as DT,m as IT,n as MT,t as OT,o as $T,p as BT,q as zT}from"./chat-context-CY2SGM0h.js";import{c as Qh,s as id,g as rr,P as Tu,d as F2,t as Ul,a as FT,M as UT,i as HT,b as ji,e as rd,f as KT,D as WT,h as qT,j as GT,k as zc,l as YT,m as JT,u as Xh,E as QT,n as e0,o as XT,F as ZT,p as Zh,q as e9,r as F6,S as eV,v as tV,w as sV,x as nV,y as i4,z as iV,A as U6,O as rV,B as r4,C as Zi,G as oV,T as Ur,H as lV,I as or,J as $o,K as Mm,L as Om,N as H6,Q as aV,R as K6,U as cV,V as fi,W as dV,X as uV,Y as W6,Z as Dr,_ as fV,$ as hV,a0 as q6,a1 as Tl,a2 as o4,a3 as mV,a4 as pV,a5 as l4,a6 as gV,a7 as Vu,a8 as aa,a9 as ur,aa as Qf,ab as U2,ac as H2,ad as xV,ae as bV,af as vV,ag as yV,ah as _V,ai as LV,aj as wV,ak as t9,al as G6,am as Y6,an as J6,ao as SV,ap as Q6,aq as kV,ar as jV,as as CV,at as NV,au as t0,av as TV,aw as VV,ax as AV,ay as PV}from"./automation-runs-8GLe55cG.js";import{S as Fc}from"./spinner-BQad3GmW.js";import{a as hs,b as Yt,d as Ut,e as Ht,h as kn,c as Wn,i as EV}from"./dialog-hItRl0PM.js";import{c as RV,b as s9,a as n9,D as i9,d as X6,e as DV,f as IV}from"./drawer-DuLBqwDu.js";import{C as MV}from"./collection-search-BJAxACkb.js";import{u as Jt,a as OV,m as $V}from"./use-mcp-client-BISqHyTj.js";import{a as ca,i as Xf,S as ml,b as BV,g as Zf,c as Z6,d as a4,R as zV,e as FV,W as UV,C as HV}from"./constants-dLUUoWH7.js";import{u as e8,g as s0,l as $m,C as KV,a as WV,b as qV}from"./chart-Z15NQIs8.js";import{t as Qt}from"./ChevronDown-D5RFRhzf.js";import{t as GV,z as YV,a as od,u as K2,b as W2,c as r9}from"./hooks-CkIombAK.js";import{K as JV,i as t8,u as pl,a as s8,m as QV,f as XV}from"./shell-layout-TUjOtQhE.js";import{a as Is,u as da,b as q2,c as ZV}from"./use-virtual-mcp-B6D2i_ny.js";import{w as n8,A as eA,c as tA,b as o9,d as sA,r as nA,e as iA}from"./thread-route-bh7ZH4NA.js";import{r as i8,d as G2,a as Y2,p as rA,b as oA,s as lA}from"./session-runtime-C-KTDVeQ.js";import{i as gl,b as J2,a as aA}from"./XCircle-Dgz569F-.js";import{f as r8,g as Q2,h as ua,j as o8,n as l8,A as ci,k as a8,l as Uc,s as Hl,m as c8,o as fa,p as cA,q as dA,c as d8,r as Bm,u as ld,v as uA,w as u8,d as fA,x as l9,y as ha,z as hA,B as X2,C as f8,D as h8,E as zm,F as C1,G as c4,H as a9,I as mA,J as pA,K as gA,L as xA,M as bA,N as Z2,O as m8,P as qn,Q as eg,R as tg,S as n0,T as lr,U as c9,V as d9,W as p8,X as g8,Y as x8,Z as vA,_ as sg,$ as yA,a0 as d4,a1 as _A,a2 as LA,t as b8,a3 as Ho,a4 as i0,a5 as wA,i as u9,a6 as SA,a7 as kA,a8 as jA,a9 as CA,aa as NA,ab as TA,ac as Ko,ad as u4,ae as v8,af as VA,ag as AA,ah as PA,ai as Hc,aj as ng,ak as EA,al as f4,am as RA,an as DA,ao as IA,ap as y8,aq as MA,ar as OA,as as $A,at as BA,au as zA,av as FA,aw as UA,ax as HA,ay as _8,az as L8,aA as KA,aB as WA,aC as qA,aD as GA,aE as YA,aF as JA}from"./agent-icon-BGP9U6d6.js";import{i as Ft}from"./Check-BejV2053.js";import{a as fr}from"./Image01-HOTAu7DE.js";import{i as Gn}from"./Upload01-CPHyTAd0.js";import{i as pn}from"./AlertCircle-C0recpiM.js";import{a as an}from"./Copy01-Cr3MDnu-.js";import{F as Fm,a as ig,b as rg,c as og,d as w8}from"./form-BTWHqvdt.js";import{d as Rt,S as ys,a as _s,b as Ns,c as Ls}from"./select-BOHmdb8C.js";import{t as f9,a as lg,i as h9,b as ag,c as QA,d as XA,e as ZA}from"./UserSquare-BO9lFHlw.js";import{i as m9}from"./ArrowLeft-B2Z12k58.js";import{T as Ol,a as ad,b as ar,c as r0}from"./tabs-DZiIU_cf.js";import{t as Um}from"./Tool02-D4AQe9SD.js";import{T as p9,a as Kc}from"./toggle-group-Dwtxjfc4.js";import{I as mt}from"./input-Cb9iSFEg.js";import{u as cg,b as dg,f as S8,g as eP,c as tP,p as h4,S as oi,t as ug,C as fg,a as sP,h as nP,N as iP}from"./super-agent-icon-CPbKPIBh.js";import{u as k8,M as rP,a as oP,m as g9,i as lP,g as j8,b as aP,N as cP,c as dP}from"./select-model-CPmeNaNO.js";import{s as Ci}from"./XClose-DRl5snCd.js";import{a as ns,b as is,P as rs,c as uP}from"./popover-CzFHMi1-.js";import{t as Wr}from"./Stars01-C5bXx9wk.js";import{b as fP,a as x9,c as C8,d as N8,u as b9,e as T8}from"./use-organization-settings-9gyyAmDC.js";import{u as v9,a as hP}from"./use-ai-providers-DwlhpRes.js";import{g as hg,c as cd,d as V8,a as Zs,r as mg,f as mP,e as pP}from"./agent-capabilities-B52k7xCe.js";import{f as gP,a as xP,u as Au,b as o0,c as A8,d as bP,e as pg,g as P8,h as gg,i as vP,j as xg,k as Pu,l as E8,m as yP,n as R8,o as _P}from"./folder-icon-CnUII1sC.js";import{c as $t,D as Bt,b as zt,a as Xe,d as er,e as tr,f as sr,g as Wc,h as Kn,i as qr,j as Pd}from"./dropdown-menu-LWFsRDES.js";import{s as Kt}from"./Plus-BNnPvfG8.js";import{p as LP,q as wP}from"./question-004-sINsf4GQ.js";import{A as Ts}from"./avatar-BuHFImQ0.js";import{u as D8,a as l0}from"./use-members-CGZd946r.js";import{i as en}from"./ChevronRight-DV9U9V1C.js";import{u as dd}from"./use-is-desktop-app-BNujXJc_.js";import{u as hi,a as bg}from"./use-panel-navigate-Dl8TU9Fq.js";import{i as mi}from"./CheckCircle-CFTFD5Ed.js";import{I as Ei}from"./integration-icon-DDXwHQKF.js";import{f as I8}from"./use-navigate-to-agent-DDo0Ri7O.js";import{e as a0}from"./backoff-CrEUbyZT.js";import{u as SP}from"./use-status-sounds-CZScO2ta.js";import{E as Qo}from"./empty-state-DhZFNn9P.js";import{T as Bo,a as kP}from"./toolbar-3fMfxNen.js";import{b as M8,n as O8}from"./ZapSquare-C3xSe5yB.js";import{i as Xo,a as jP}from"./Share07-dg97NqNd.js";import{i as Mn}from"./Globe01-8plmq2TA.js";import{i as CP}from"./Monitor01-CGzGmiSx.js";import{u as di,a as vg,b as yg}from"./use-connection-bZgPnZOr.js";import{u as $8,a as _g,b as B8}from"./use-mcp-tools-Dtv8_qE-.js";import{g as y9,M as NP}from"./types-nGmsoTZv.js";import{d as Lg,s as TP,g as VP,a as AP,F as z8,b as F8,f as U8,S as H8,c as PP}from"./skill-preview-B4NfqEEV.js";import{F as Zo}from"./file-type-icon-zHhC_odk.js";import{i as Qr}from"./ZoomOut-B8EEsxrO.js";import{i as Si}from"./GitBranch01-B7UokEiw.js";import{a as wg}from"./Package-WyJYCcJV.js";import{u as Sg,a as K8}from"./use-file-configs-EoWVXyV1.js";import{n as Eu}from"./Download01-Cu0GEQBo.js";import{n as hn}from"./LinkExternal01-C5L2pr2x.js";import{D as Cc}from"./use-destination-route-B_24Whcs.js";import{i as _9}from"./Key01-DLcgmMi7.js";import{p as kg,b as rn,s as qc,H as Ru,h as Du,a as mc,c as W8,d as q8}from"./location-oTTXFrSF.js";import{m as EP,a as RP,M as ud,b as DP,O as IP}from"./markdown-0fiCCcV1.js";import{p as MP,f as OP}from"./pt-BR-CLy76QW2.js";import{g as $P,e as BP}from"./extract-connection-data-DPiIwaYg.js";import{a as zP,i as m4}from"./mcp-oauth-DBjycbCF.js";import{A as el,a as tl,b as sl,c as nl,d as il,e as rl,f as ol,g as ll}from"./alert-dialog-Csnli2CD.js";import{T as Xr}from"./textarea-CliLWMBV.js";import{i as Kl}from"./Play-CsI3qh5P.js";import{s as tn}from"./Trash01-Bkd5f3e4.js";import{u as eh}from"./use-debounced-autosave-DvptVode.js";import{S as xl}from"./scroll-area-Djm3-sbg.js";import{i as Iu}from"./SearchMd-BJmbTOt_.js";import{C as fd}from"./checkbox-oWGgw210.js";import{S as L9}from"./search-input-qkdY6KsE.js";import{C as G8}from"./collection-tabs-Lzes2Hm5.js";import{T as Y8,u as J8}from"./use-mcp-auth-status-DObWVXL7.js";import{n as FP}from"./LockUnlocked01-BleHTt-O.js";import{g as UP}from"./connection-slug-CITJ0kGN.js";import{a as Q8,i as HP}from"./Settings02-By8pQbcj.js";import{L as Mt}from"./label-BkQvhQIM.js";import{S as hr}from"./switch-dQhgVuCH.js";import{s as X8}from"./slugify-CEUa2lfQ.js";import{d as hd}from"./delay-CnY5UFtP.js";import{G as jn,a as jg,u as KP}from"./github-repo-picker-olEJzk4H.js";import{s as th}from"./User01-rDgL3Cs0.js";import{t as Cg}from"./Users01-CGiHQkW6.js";import{u as Z8,a as e7}from"./use-secrets-CebeVclF.js";import{a as ma}from"./format-time-BnbuEtat.js";import{c as Ng,s as c0,b as WP}from"./TrendUp01-C29DtCbZ.js";import{f as t7,g as qP,l as s7,a as GP}from"./provision-repo-scoped-github-connection-CMPWtdMv.js";import{a as YP}from"./authenticate-and-persist-oauth-Ds-Znneo.js";import{X as JP,A as QP,a as XP}from"./AreaChart-XSelV74e.js";import{P as ln,a as d0,t as Wl,f as n7,u as i7,b as Tg,s as r7,l as sh,c as Mu,m as o7,T as zo,d as l7,i as ZP,e as eE,g as tE,S as sE,h as a7,j as c7,r as d7,k as nE,n as iE,o as rE,p as oE,q as lE,L as Hm,v as p4,w as aE,H as cE,x as dE}from"./config-DRDl0YmS.js";import{C as On,a as Cn,b as Wt,c as fs,d as $n,e as Yn,f as uE,g as g4}from"./command-Bp1UIw04.js";import{i as w9}from"./FilterLines-DahI-t1v.js";import{g as mn}from"./get-initials-D-f_fDFw.js";import{S as ls,R as fE,a as hE,D as mE,i as u7,n as pE,b as gE}from"./task-board-C5vC-P5k.js";import{B as xE,a as bE,b as x4,c as vE,d as yE,e as _E}from"./breadcrumb-B40XpKTU.js";import{u as N1}from"./use-copy-Cq30lUsM.js";import{i as Vg,c as f7}from"./SwitchHorizontal01-BfZwTC3u.js";import{u as LE}from"./use-org-auth-client-DK9IhaDS.js";import{u as Ag,a as wE,b as SE}from"./use-tags-Bo6st0jt.js";import{i as S9}from"./ChevronSelectorVertical-CsU1yTcH.js";import{w as b4}from"./editor-C4Sw9hGx.js";import{i as k9}from"./SearchLg-Ccchnc4p.js";import{u as Km,a as kE,c as jE,p as h7,b as CE,s as Wm,n as NE}from"./self-tool-result-xX9-YD6Y.js";import{M as md}from"./monaco-editor-C-Q5HTYn.js";import{i as TE,a as Pg,b as Eg}from"./Tool01-BPHywJEb.js";import{a as qm}from"./Palette-ivE2ilgf.js";import{s as u0}from"./Eye-DhUWQAZM.js";import{i as Rg}from"./DotsVertical-DqsE4vgP.js";import{u as j9}from"./use-debounced-value-DqFNyMpP.js";import{u as m7}from"./useInfiniteQuery-D5GGzERO.js";import{i as mr}from"./Zap-CqYQM_jt.js";import{B as VE}from"./badge-CO8RwMr5.js";import{u as f0,a as AE,b as PE,c as EE,d as RE}from"./use-automations-CmgiIky3.js";import{s as uu,n as DE}from"./Stars02-Dco9Mo0t.js";import{A as IE}from"./automation-list-row-ByC4kR2D.js";import{t as ME}from"./site-error--i37Vnuw.js";import{u as OE,a as $E}from"./use-org-repo-syncs-DDOe1mEV.js";import{n as p7}from"./ChevronUp-D4IrNOCC.js";import{f as BE,p as zE,g as FE,u as UE,e as HE,F as h0,t as g7,S as KE,B as WE,a as x7,R as qE}from"./cards-vcKmBwGO.js";function b7(t,e){const s=ps(e);return GE({filters:{...t,status:"pending"}},s).length}function v4(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function GE(t={},e){const s=ps(e).getMutationCache(),n=P.useRef(t),i=P.useRef(null);return i.current===null&&(i.current=v4(s,t)),P.useEffect(()=>{n.current=t}),P.useSyncExternalStore(P.useCallback(r=>s.subscribe(()=>{const l=IN(i.current,v4(s,n.current));i.current!==l&&(i.current=l,MN.schedule(r))}),[s]),()=>i.current,()=>i.current)}const Qd=Et({connection_id:Re().describe("Connection ID"),selected_tools:Cs(Re()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:Cs(Re()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:Cs(Re()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),v7=Qd.extend({selected_tools:Qd.shape.selected_tools.optional(),selected_resources:Qd.shape.selected_resources.optional(),selected_prompts:Qd.shape.selected_prompts.optional()}),YE=Et({connectionId:Re(),toolName:Re(),label:Re(),icon:Re().nullable().optional()}),JE=Et({id:Re().describe("Stable id; used as React key and ?tab= value"),title:Re().describe("Tab label"),icon:Re().optional().describe("Optional lucide icon name"),view:Et({type:Dm("ext-app"),appId:Re(),args:Cu(Re(),h6()).optional()})}),y7=xr(["off","manual","auto"]),QE=Et({defaultMainView:Et({type:Re(),id:Re().optional(),toolName:Re().optional()}).nullable().optional(),chatDefaultOpen:ki().nullable().optional(),cmsDefaultOpen:ki().nullable().optional(),cms:y7.nullable().optional().describe("How this agent offers content editing. Absent falls back to cmsDefaultOpen."),tabs:Cs(JE).optional()});function m0(t){return t?.cms?t.cms:t?.cmsDefaultOpen?"auto":"manual"}function XE(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"preview"}}:{}}}const y4=Et({tileId:Re().optional(),connectionId:Re().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:Re().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:Re().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:Cu(Re(),h6()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:Li().int().positive().optional(),maxHeight:Li().int().positive().optional()}),Dg=Et({banner:Re().nullable().optional(),bannerColor:Re().nullable().optional(),icon:Re().nullable().optional(),themeColor:Re().nullable().optional(),pinnedViews:Cs(YE).nullable().optional(),layout:QE.nullable().optional(),homeTile:y4.nullable().optional(),homeTiles:Cs(y4).nullable().optional(),homePrompts:Cs(Re()).nullable().optional()});function Gc(t){const e=t?.homeTiles;if(Array.isArray(e)&&e.length>0)return e;const s=t?.homeTile;return s?[s]:[]}const p0=/^[A-Za-z_][A-Za-z0-9_]*$/,_4=Re().min(1).regex(p0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),ZE=$N("kind",[Et({key:_4,kind:Dm("literal"),value:Re()}),Et({key:_4,kind:Dm("secret"),secretId:Re().min(1)})]),Ig=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,eR=Et({host:Re().min(1).regex(Ig).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:Re().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),Mg=Et({selected:Re().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:Re().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:Re().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:Cs(ZE).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:Cs(eR).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),Og=Et({url:Re().describe("GitHub repository URL"),owner:Re().describe("Repository owner"),name:Re().describe("Repository name"),installationId:Li().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:Re().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),tR=xr(["agent-sandbox","local-api"]),sR={sandboxHandle:Re().describe("Provider-specific handle"),previewUrl:Re().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:Re().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:Li().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:Et({packageManager:Re().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:Re().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:Re().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},_7=Et(sR);function nR(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,s={};for(const[n,i]of Object.entries(e))if(!(!i||typeof i!="object")&&!(n!=="agent-sandbox"&&n!=="local-api"))try{s[n]=_7.parse(i)}catch{}return s}const iR=Cu(Re().describe("userId"),Cu(Re().describe("branch"),ON(tR,_7))),rR=Et({id:Re().describe("Stable identifier for this knowledge file"),name:Re().describe("File name shown in the UI"),kind:xr(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:Re().describe("Org filesystem (Library) volume the file lives in"),path:Re().describe("Path within the volume"),url:Re().describe("Same-origin URL to read the file (display/download)"),contentType:Re().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:Li().nullable().optional().describe("File size in bytes"),addedAt:Re().describe("ISO timestamp when the file was attached")}),$g=Cs(rR).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),oR=xr(["smart","code-review","open"]),Bg=oR.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),zg=ki().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),Fg=ki().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),Ug=Re().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),lR=Et({id:Re().describe("Unique identifier"),title:Re().describe("Human-readable name"),description:Re().nullable().describe("Description"),icon:Re().nullable().describe("Icon URL"),created_at:Re().describe("Creation timestamp"),updated_at:Re().describe("Last update timestamp"),created_by:Re().describe("User ID who created this item"),updated_by:Re().optional().describe("User ID who last updated this item"),organization_id:Re().describe("Organization ID this item belongs to"),status:xr(["active","inactive"]).describe("Current status"),pinned:ki().describe("Whether this space is pinned to the sidebar"),metadata:Et({instructions:Re().nullable().describe("Instructions also used as system prompt"),enabled_plugins:Cs(Re()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:Cs(Re()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Re().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Dg.nullable().optional().describe("UI customization settings"),githubRepo:Og.nullable().optional().describe("Linked GitHub repository"),runtime:Mg.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:iR.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }"),knowledge:$g,siteSlug:Re().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:Bg,previewServerUrl:Ug,productionUrl:Re().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:ki().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:zg,fastPreviewInPlace:Fg}).loose().describe("Metadata"),connections:Cs(Qd).describe("Connections with their selected tools, resources, and prompts")}),L7=Et({title:Re().min(1).max(120).describe("Short label shown on the chip"),description:Re().max(280).optional().describe("One-line subtitle shown under the title"),text:Re().min(1).describe("The message sent to the agent when the prompt is clicked")});Et({title:Re().min(1).max(255).describe("Name for the virtual MCP"),description:Re().nullable().optional().describe("Optional description"),icon:Re().nullish().describe("Optional icon URL"),status:xr(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:ki().optional().default(!1).describe("Pin to sidebar"),metadata:Et({instructions:Re().nullable().optional().describe("MCP server instructions"),enabled_plugins:Cs(Re()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:Cs(Re()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Re().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Dg.nullable().optional().describe("UI customization settings"),githubRepo:Og.nullable().optional().describe("Linked GitHub repository"),runtime:Mg.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:$g,siteSlug:Re().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:Bg,previewServerUrl:Ug,productionUrl:Re().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:ki().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:zg,fastPreviewInPlace:Fg}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:Cs(v7).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:Cs(L7).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});Et({title:Re().min(1).max(255).optional().describe("New name"),description:Re().nullable().optional().describe("New description (null to clear)"),icon:Re().nullish().describe("New icon URL"),status:xr(["active","inactive"]).optional().describe("New status"),pinned:ki().optional().describe("Pin/unpin from sidebar"),metadata:Et({instructions:Re().nullable().optional().describe("MCP server instructions"),enabled_plugins:Cs(Re()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:Cs(Re()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Re().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Dg.nullable().optional().describe("UI customization settings"),githubRepo:Og.nullable().optional().describe("Linked GitHub repository"),runtime:Mg.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:$g,siteSlug:Re().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:Bg,previewServerUrl:Ug,productionUrl:Re().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:ki().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:zg,fastPreviewInPlace:Fg}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:Cs(v7).optional().describe("New connections (replaces existing)"),prompts:Cs(L7).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});const L4=3,w7="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",aR="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function S7(t){const e=B.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:r,variant:l}=t,a=l===void 0?"pill":l,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const S=rr(c._meta);d=c.title??F2(c.name,S),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const f=d,u=c.description||null;if(a==="card"){let S;e[4]!==n||e[5]!==c?(S=()=>n(c),e[4]=n,e[5]=c,e[6]=S):S=e[6];const k=r||i,j=i&&"bg-accent/40",C=(r||i)&&"cursor-not-allowed opacity-50";let T;e[7]!==j||e[8]!==C?(T=ie(aR,"hover:bg-accent/60 text-foreground",j,C),e[7]=j,e[8]=C,e[9]=T):T=e[9];let N;e[10]!==f?(N=o.jsx("span",{className:"font-medium truncate capitalize",children:f}),e[10]=f,e[11]=N):N=e[11];let V;e[12]!==i?(V=i&&o.jsx(Fc,{size:"xs"}),e[12]=i,e[13]=V):V=e[13];let A;e[14]!==N||e[15]!==V?(A=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[N,V]}),e[14]=N,e[15]=V,e[16]=A):A=e[16];let E;e[17]!==u?(E=u&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:u}),e[17]=u,e[18]=E):E=e[18];let R;return e[19]!==A||e[20]!==E||e[21]!==S||e[22]!==k||e[23]!==T?(R=o.jsxs("button",{type:"button",onClick:S,disabled:k,className:T,children:[A,E]}),e[19]=A,e[20]=E,e[21]=S,e[22]=k,e[23]=T,e[24]=R):R=e[24],R}let h;e[25]!==n||e[26]!==c?(h=()=>n(c),e[25]=n,e[26]=c,e[27]=h):h=e[27];const m=r||i,p=i&&"bg-muted/50",g=(r||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=ie(w7,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==f?(b=o.jsx("span",{className:"capitalize",children:f}),e[31]=f,e[32]=b):b=e[32];let y;e[33]!==i?(y=i&&o.jsx(Fc,{size:"xs"}),e[33]=i,e[34]=y):y=e[34];let L;e[35]!==h||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==y?(L=o.jsx(Ke,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:h,disabled:m,className:x,children:[b,y]})}),e[35]=h,e[36]=m,e[37]=x,e[38]=b,e[39]=y,e[40]=L):L=e[40];const v=u??f;let _;e[41]!==v?(_=o.jsx(We,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:v})}),e[41]=v,e[42]=_):_=e[42];let w;return e[43]!==L||e[44]!==_?(w=o.jsxs(qe,{delayDuration:400,children:[L,_]}),e[43]=L,e[44]=_,e[45]=w):w=e[45],w}function cR(t){const e=B.c(61),{items:s,open:n,onOpenChange:i,onSelect:r,loadingPrompt:l}=t,a=re(),[c,d]=P.useState(""),f=!!l;let u;e[0]!==s||e[1]!==c?(u=c.trim()?s.filter(N=>{const V=c.toLowerCase();return N.prompt.name.toLowerCase().includes(V)||(N.prompt.title??"").toLowerCase().includes(V)||(N.prompt.description??"").toLowerCase().includes(V)}):s,e[0]=s,e[1]=c,e[2]=u):u=e[2];const h=u,m=fl();let p;e[3]!==h.length||e[4]!==c||e[5]!==a?(p=h.length===0&&o.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:a("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=h.length,e[4]=c,e[5]=a,e[6]=p):p=e[6];let g;if(e[7]!==h||e[8]!==f||e[9]!==l?.name||e[10]!==i||e[11]!==r){let N;e[13]!==f||e[14]!==l?.name||e[15]!==i||e[16]!==r?(N=V=>o.jsx(S7,{item:V,variant:"card",onSelect:A=>{i(!1),r(A)},isLoading:l?.name===V.prompt.name,isDisabled:f&&l?.name!==V.prompt.name},V.prompt.name),e[13]=f,e[14]=l?.name,e[15]=i,e[16]=r,e[17]=N):N=e[17],g=h.map(N),e[7]=h,e[8]=f,e[9]=l?.name,e[10]=i,e[11]=r,e[12]=g}else g=e[12];let x;e[18]!==p||e[19]!==g?(x=o.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[p,g]})}),e[18]=p,e[19]=g,e[20]=x):x=e[20];const b=x;let y;e[21]!==a?(y=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=y):y=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=N=>{N.key==="Escape"&&d("")},e[23]=L):L=e[23];let v;e[24]!==c||e[25]!==y?(v=o.jsx(MV,{value:c,onChange:d,placeholder:y,onKeyDown:L}),e[24]=c,e[25]=y,e[26]=v):v=e[26];const _=v;if(m){let N;e[27]!==a?(N=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=N):N=e[28];let V;e[29]!==N?(V=o.jsx(RV,{className:"sr-only",children:o.jsx(s9,{children:N})}),e[29]=N,e[30]=V):V=e[30];let A;e[31]!==a?(A=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=A):A=e[32];let E;e[33]!==A?(E=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:A})}),e[33]=A,e[34]=E):E=e[34];let R;e[35]!==b||e[36]!==_||e[37]!==E||e[38]!==V?(R=o.jsxs(n9,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[V,E,_,b]}),e[35]=b,e[36]=_,e[37]=E,e[38]=V,e[39]=R):R=e[39];let I;return e[40]!==i||e[41]!==n||e[42]!==R?(I=o.jsx(Jr,{delayDuration:400,children:o.jsx(i9,{open:n,onOpenChange:i,children:R})}),e[40]=i,e[41]=n,e[42]=R,e[43]=I):I=e[43],I}let w;e[44]!==a?(w=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=w):w=e[45];let S;e[46]!==w?(S=o.jsx(hs,{className:"sr-only",children:o.jsx(Yt,{children:w})}),e[46]=w,e[47]=S):S=e[47];let k;e[48]!==a?(k=a("chat.iceBreakers.promptsLabel"),e[48]=a,e[49]=k):k=e[49];let j;e[50]!==k?(j=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:k})}),e[50]=k,e[51]=j):j=e[51];let C;e[52]!==b||e[53]!==_||e[54]!==j||e[55]!==S?(C=o.jsxs(Ut,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,j,_,b]}),e[52]=b,e[53]=_,e[54]=j,e[55]=S,e[56]=C):C=e[56];let T;return e[57]!==i||e[58]!==n||e[59]!==C?(T=o.jsx(Jr,{delayDuration:400,children:o.jsx(Ht,{open:n,onOpenChange:i,children:C})}),e[57]=i,e[58]=n,e[59]=C,e[60]=T):T=e[60],T}function dR(t){const e=B.c(30),{items:s,onSelect:n,loadingPrompt:i,className:r}=t,l=re(),[a,c]=P.useState(!1);if(s.length===0)return null;let d,f,u,h,m;if(e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,L4),y=s.slice(L4),L=!!i;let v;e[10]!==L||e[11]!==i?.name||e[12]!==n?(v=w=>o.jsx(S7,{item:w,onSelect:n,isLoading:i?.name===w.prompt.name,isDisabled:L&&i?.name!==w.prompt.name},w.prompt.name),e[10]=L,e[11]=i?.name,e[12]=n,e[13]=v):v=e[13];const _=b.map(v);d=Jr,m=400,e[14]!==r?(f=ie("w-full flex flex-wrap gap-2 justify-center",r),e[14]=r,e[15]=f):f=e[15],u=_,h=y.length>0&&o.jsx("button",{type:"button",disabled:L,onClick:()=>c(!0),className:ie(w7,"hover:bg-muted/70 hover:text-foreground",L&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:y.length})}),e[0]=r,e[1]=s,e[2]=i,e[3]=n,e[4]=l,e[5]=d,e[6]=f,e[7]=u,e[8]=h,e[9]=m}else d=e[5],f=e[6],u=e[7],h=e[8],m=e[9];let p;e[16]!==f||e[17]!==u||e[18]!==h?(p=o.jsxs("div",{className:f,children:[u,h]}),e[16]=f,e[17]=u,e[18]=h,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=o.jsx(cR,{items:s,open:a,onOpenChange:c,onSelect:n,loadingPrompt:i}),e[20]=s,e[21]=i,e[22]=a,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==m||e[27]!==p||e[28]!==g?(x=o.jsxs(d,{delayDuration:m,children:[p,g]}),e[25]=d,e[26]=m,e[27]=p,e[28]=g,e[29]=x):x=e[29],x}function uR(){return null}function fR(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function hR(t){const e=B.c(31),{connectionId:s}=t,n=re(),{sendMessage:i}=ui(),{org:r}=Fe();let l;e[0]!==s||e[1]!==r.id||e[2]!==r.slug?(l={connectionId:s,orgId:r.id,orgSlug:r.slug},e[0]=s,e[1]=r.id,e[2]=r.slug,e[3]=l):l=e[3];const a=Jt(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=e8(c);let f;e[6]!==d?.prompts?(f=d?.prompts??[],e[6]=d?.prompts,e[7]=f):f=e[7];const u=f;let h;e[8]!==u?(h=u.map(mR),e[8]=u,e[9]=h):h=e[9];const m=h;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=P.useReducer(fR,p),[b,y]=P.useState(null);let L;e[11]!==a||e[12]!==i||e[13]!==n?(L=async(A,E)=>{if(!a){xe.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const R=await s0(a,A.name,E);x({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[Qh({id:A.name,name:id(A.name,rr(A._meta)),metadata:R.messages,char:"/",kind:"prompt",args:E}),{type:"text",text:" "}]}]};await i(I)}catch(R){console.error("[ice-breakers] Failed to fetch prompt:",R),xe.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=L):L=e[14];const v=L;let _;e[15]!==v?(_=async A=>{if(A.arguments&&A.arguments.length>0){x({type:"SELECT_PROMPT",prompt:A}),y(A);return}x({type:"START_LOADING",prompt:A}),await v(A)},e[15]=v,e[16]=_):_=e[16];const w=_;let S;e[17]!==b||e[18]!==v?(S=async A=>{b&&(x({type:"START_LOADING",prompt:b,arguments:A}),y(null),await v(b,A))},e[17]=b,e[18]=v,e[19]=S):S=e[19];const k=S;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let C;e[20]!==w||e[21]!==m||e[22]!==j?(C=o.jsx(dR,{items:m,onSelect:w,loadingPrompt:j}),e[20]=w,e[21]=m,e[22]=j,e[23]=C):C=e[23];let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{y(null),x({type:"RESET"})},e[24]=T):T=e[24];let N;e[25]!==b||e[26]!==k?(N=o.jsx(Tu,{prompt:b,setPrompt:T,onSubmit:k}),e[25]=b,e[26]=k,e[27]=N):N=e[27];let V;return e[28]!==C||e[29]!==N?(V=o.jsxs(o.Fragment,{children:[C,N]}),e[28]=C,e[29]=N,e[30]=V):V=e[30],V}function mR(t){return{prompt:t}}function pR(t){const e=B.c(13),{className:s}=t,{selectedVirtualMcp:n}=la(),{org:i}=Fe();let r;e[0]!==i.id?(r=ca(i.id),e[0]=i.id,e[1]=r):r=e[1];const l=r.id,a=n?.id??l;let c;e[2]!==s?(c=ie("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=a??"default";let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(uR,{}),e[4]=f):f=e[4];let u;e[5]!==a?(u=o.jsx(hR,{connectionId:a}),e[5]=a,e[6]=u):u=e[6];let h;e[7]!==d||e[8]!==u?(h=o.jsx(Us,{fallback:null,children:o.jsx(P.Suspense,{fallback:f,children:u},d)}),e[7]=d,e[8]=u,e[9]=h):h=e[9];let m;return e[10]!==c||e[11]!==h?(m=o.jsx("div",{className:c,children:h}),e[10]=c,e[11]=h,e[12]=m):m=e[12],m}const T1="cubic-bezier(0.645, 0.045, 0.355, 1)",gR=44,xR={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-warning/5 after:pointer-events-none after:-z-10"},bR={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},vR={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function al(t){const e=B.c(69),{icon:s,label:n,count:i,title:r,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:f,onClose:u}=t,h=f===void 0?"default":f,m=re(),[p,g]=P.useState(d),[x,b]=P.useState(!1);let y;e[0]!==u?(y=()=>{b(!0),u?.()},e[0]=u,e[1]=y):y=e[1];const L=y;if(x)return null;const v=bR[h],_=xR[h];let w;e[2]!==v||e[3]!==_?(w=ie("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,_),e[2]=v,e[3]=_,e[4]=w):w=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g(yR),e[5]=S):S=e[5];const k=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let C;e[6]!==k||e[7]!==j?(C=ie("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",k,j),e[6]=k,e[7]=j,e[8]=C):C=e[8];const T=vR[h];let N;e[9]!==T?(N=ie("shrink-0",T),e[9]=T,e[10]=N):N=e[10];let V;e[11]!==s||e[12]!==N?(V=o.jsx("span",{className:N,children:s}),e[11]=s,e[12]=N,e[13]=V):V=e[13];let A;e[14]!==n?(A=o.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=A):A=e[15];let E;e[16]!==i?(E=i?o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=E):E=e[17];const R=p?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==R?(I=o.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:o.jsx(Qt,{size:16,style:{transform:R,transition:`transform 180ms ${T1}`}})}),e[18]=R,e[19]=I):I=e[19];let D;e[20]!==m?(D=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=D):D=e[21];let O;e[22]!==m?(O=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=O):O=e[23];let z,M;e[24]!==L?(z=Z=>{Z.stopPropagation(),L()},M=Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),Z.stopPropagation(),L())},e[24]=L,e[25]=z,e[26]=M):(z=e[25],M=e[26]);let $;e[27]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Ds,{size:16}),e[27]=$):$=e[27];let F;e[28]!==D||e[29]!==O||e[30]!==z||e[31]!==M?(F=o.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":D,title:O,onClick:z,onKeyDown:M,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:$}),e[28]=D,e[29]=O,e[30]=z,e[31]=M,e[32]=F):F=e[32];let U;e[33]!==p||e[34]!==V||e[35]!==A||e[36]!==E||e[37]!==I||e[38]!==F||e[39]!==C?(U=o.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:S,className:C,children:[V,A,E,I,F]}),e[33]=p,e[34]=V,e[35]=A,e[36]=E,e[37]=I,e[38]=F,e[39]=C,e[40]=U):U=e[40];const H=p?"1fr":"0fr";let q;e[41]!==H?(q={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${T1}`},e[41]=H,e[42]=q):q=e[42];let W;e[43]===Symbol.for("react.memo_cache_sentinel")?(W={overflow:"hidden",minHeight:0},e[43]=W):W=e[43];const G=p?1:0;let Y;e[44]!==G?(Y={opacity:G,transition:`opacity 120ms ${T1}`,maxHeight:"60vh"},e[44]=G,e[45]=Y):Y=e[45];let J;e[46]!==r?(J=r?o.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:o.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:r})}):o.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=r,e[47]=J):J=e[47];let se;e[48]!==c||e[49]!==r?(se=c?o.jsx("div",{className:ie("pb-4",!r&&"pt-4"),children:c}):null,e[48]=c,e[49]=r,e[50]=se):se=e[50];let oe;e[51]!==J||e[52]!==se?(oe=o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[J,se]}),e[51]=J,e[52]=se,e[53]=oe):oe=e[53];let ne;e[54]!==l||e[55]!==a?(ne=l||a?o.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:l}),o.jsx("div",{className:"flex items-center gap-2",children:a})]})}):null,e[54]=l,e[55]=a,e[56]=ne):ne=e[56];let Q;e[57]!==Y||e[58]!==oe||e[59]!==ne?(Q=o.jsx("div",{style:W,children:o.jsxs("div",{className:"flex flex-col",style:Y,children:[oe,ne]})}),e[57]=Y,e[58]=oe,e[59]=ne,e[60]=Q):Q=e[60];let K;e[61]!==q||e[62]!==Q?(K=o.jsx("div",{"data-testid":"collapsible-highlight-body",style:q,children:Q}),e[61]=q,e[62]=Q,e[63]=K):K=e[63];let X;return e[64]!==U||e[65]!==K||e[66]!==w||e[67]!==h?(X=o.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":h,className:w,children:[U,K]}),e[64]=U,e[65]=K,e[66]=w,e[67]=h,e[68]=X):X=e[68],X}function yR(t){return!t}const _R=Et({content:Re().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:xr(["pending","in_progress","completed"]),activeForm:Re().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),k7=Et({todos:Cs(_R)}),LR="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";GV({description:LR,inputSchema:YV(k7),execute:async({todos:t})=>({ok:!0,count:t.length})});const wR="tool-todo_write",SR=new Set(["input-available","output-available"]);function kR(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const n=s.parts;if(Array.isArray(n))for(let i=n.length-1;i>=0;i--){const r=n[i];if(r.type!==wR||typeof r.state!="string"||!SR.has(r.state))continue;const l=k7.safeParse(r.input);if(l.success)return l.data.todos}}return[]}function j7(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const n="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:n,friendlyName:Ul(FT(n)),input:s.input})}return e}function C7(t){return t.at(-1)}function N7(t){const e=[];for(const s of t)s.type==="tool-propose_plan"&&s.state==="input-available"&&e.push({toolCallId:s.toolCallId,plan:s.input.plan,state:s.state});return e}function jR(t){return t?t.message.startsWith("[CREDITS]"):!1}const CR="[SUBSCRIPTION_REQUIRED]";function T7(t){return t?.message.startsWith(CR)?t.message.includes("used its free task executions")?"trial_exhausted":t.message.includes("used its monthly task executions")?"monthly_exhausted":t.message.includes("reached its execution limit")?"runs_exhausted":null:null}const NR={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function TR(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=t;if(!i&&s&&jR(s))return{...NR,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,f=!!c.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,u=N7(a),h=j7(c),m=kR(e),p=i?null:T7(s),g=!i&&!!s&&!p,x=h.length>0||i&&r,b=u.length>0,L=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(f||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:L,hasApprovals:x,hasPlans:b,isWaitingForUserInput:f,todos:m}}function V7(){const t=B.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=ui(),l=s??null,a=n??null;let c;return t[0]!==i||t[1]!==r||t[2]!==e||t[3]!==l||t[4]!==a?(c=TR({messages:e,error:l,finishReason:a,isStreaming:i,isWaitingForApprovals:r}),t[0]=i,t[1]=r,t[2]=e,t[3]=l,t[4]=a,t[5]=c):c=t[5],c}function VR(){const t=V7();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function A7(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(s=>s.type==="hardBreak"||s.type==="text"&&(!s.text||s.text.trim()==="")):!1)}const AR="__home__";function Hg(t,e){return D2.chatDraft(t,e)}function PR(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const s=e.tiptapDoc;return!s||typeof s!="object"||s.type!=="doc"||!Array.isArray(s.content)?null:s}function P7(t,e,s,n,i){const r=Hg(e,s);if(A7(n)){t.removeItem(r);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(r,a)}catch(c){if(RR(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function w4(t,e,s){const n=Hg(e,s),i=t.getItem(n),r=PR(i);return i!==null&&r===null&&t.removeItem(n),r}function ER(t,e,s){t.removeItem(Hg(e,s))}function RR(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function Tn(t){const e=B.c(14),s=Is(t),n=As(),i=s?.metadata,r=n?.activeTask,l=r?.metadata?.runtime;let a;e[0]!==l?(a=rA(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=!!r&&!r.partial,f=r?.metadata;let u;e[2]!==i||e[3]!==f?(u=i8(f,i),e[2]=i,e[3]=f,e[4]=u):u=e[4];const h=!!c||d&&!!s;let m;e[5]!==i?(m=G2(i),e[5]=i,e[6]=m):m=e[6];let p;e[7]!==i?(p=Y2(i),e[7]=i,e[8]=p):p=e[8];let g;return e[9]!==u||e[10]!==h||e[11]!==m||e[12]!==p?(g={runtime:u,resolved:h,projectDefault:m,previewServerUrl:p},e[9]=u,e[10]=h,e[11]=m,e[12]=p,e[13]=g):g=e[13],g}function DR(t){const e=B.c(30),{current:s,total:n,onPrev:i,onNext:r}=t,l=re();if(n<=1)return null;const a=s===0,c=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=ie("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let f;e[2]!==l?(f=l("chat.pagination.previousLabel"),e[2]=l,e[3]=f):f=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(m9,{size:14}),e[4]=u):u=e[4];let h;e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==f?(h=o.jsx("button",{type:"button",onClick:i,disabled:a,className:d,"aria-label":f,children:u}),e[5]=i,e[6]=a,e[7]=d,e[8]=f,e[9]=h):h=e[9];const m=s+1;let p;e[10]!==l||e[11]!==m||e[12]!==n?(p=l("chat.pagination.counter",{current:m,total:n}),e[10]=l,e[11]=m,e[12]=n,e[13]=p):p=e[13];let g;e[14]!==p?(g=o.jsx("span",{className:"tabular-nums text-xs",children:p}),e[14]=p,e[15]=g):g=e[15];const x=s===n-1,b=s===n-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let y;e[16]!==b?(y=ie("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=y):y=e[17];let L;e[18]!==l?(L=l("chat.pagination.nextLabel"),e[18]=l,e[19]=L):L=e[19];let v;e[20]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(gl,{size:14}),e[20]=v):v=e[20];let _;e[21]!==r||e[22]!==x||e[23]!==y||e[24]!==L?(_=o.jsx("button",{type:"button",onClick:r,disabled:x,className:y,"aria-label":L,children:v}),e[21]=r,e[22]=x,e[23]=y,e[24]=L,e[25]=_):_=e[25];let w;return e[26]!==_||e[27]!==h||e[28]!==g?(w=o.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[h,g,_]}),e[26]=_,e[27]=h,e[28]=g,e[29]=w):w=e[29],w}function E7(t){const e=B.c(8),{currentIndex:s,total:n,onPrev:i,onNext:r,extraLeft:l}=t;let a;e[0]!==s||e[1]!==r||e[2]!==i||e[3]!==n?(a=o.jsx(DR,{current:s,total:n,onPrev:i,onNext:r}),e[0]=s,e[1]=r,e[2]=i,e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==l||e[6]!==a?(c=o.jsxs("div",{className:"flex items-center gap-2",children:[a,l]}),e[5]=l,e[6]=a,e[7]=c):c=e[7],c}function IR(t){const e=B.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:i,onAdvanceOrSubmit:r,submitLabel:l,nextLabel:a}=t,f=n?l===void 0?"Submit":l:a===void 0?"Next":a,u=n?s:!i,h=u?n?"Waiting for the assistant to finish…":"Answer this item to continue":null;let m;e[0]!==u||e[1]!==r?(m=()=>{u||r()},e[0]=u,e[1]=r,e[2]=m):m=e[2];const p=u&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=ie("h-7 px-2.5 text-xs",p),e[3]=p,e[4]=g):g=e[4];let x;e[5]!==u||e[6]!==f||e[7]!==m||e[8]!==g?(x=o.jsx(ue,{type:"button",size:"sm","aria-disabled":u,onClick:m,className:g,children:f}),e[5]=u,e[6]=f,e[7]=m,e[8]=g,e[9]=x):x=e[9];const b=x;if(!h)return b;let y;e[10]!==b?(y=o.jsx(Ke,{asChild:!0,children:b}),e[10]=b,e[11]=y):y=e[11];let L;e[12]!==h?(L=o.jsx(We,{children:h}),e[12]=h,e[13]=L):L=e[13];let v;return e[14]!==y||e[15]!==L?(v=o.jsxs(qe,{children:[y,L]}),e[14]=y,e[15]=L,e[16]=v):v=e[16],v}function R7(t,e,s){return t.findIndex(n=>e(n)===s)}function S4(t,e,s,n){return t.length===0?!1:t.every(i=>n(s[e(i)]))}function k4(t,e,s,n,i){if(t.length===0)return null;const r=R7(t,e,i);for(let l=1;l<=t.length;l++){const a=t[(r+l)%t.length];if(!a)continue;const c=e(a);if(c!==i&&!n(s[c]))return c}return null}function MR(t){return!t.isStreaming&&t.allAnswered}function D7(t){const{parts:e,partKey:s,schema:n,defaultValues:i,isStreaming:r,hasAnswer:l,onSubmit:a}=t,c=e[0]?s(e[0]):"",[d,f]=P.useState(c),[u,h]=P.useState(!1),m=I2({resolver:m6(n),defaultValues:i}),p=m.watch(),g=R7(e,s,d),x=g>=0?e[g]:void 0,b=l(p[d]),y=S4(e,s,p,l),L=MR({isStreaming:r,allAnswered:y}),v=()=>{if(g>0){const T=e[g-1];T&&f(s(T))}},_=()=>{if(g>=0&&g<e.length-1){const T=e[g+1];T&&f(s(T))}},w=()=>{const T=m.getValues(),N=k4(e,s,T,l,d);N&&f(N)},S=()=>{m.handleSubmit(T=>{const N=T;for(const V of e)a(V,N[s(V)])})()},k=P.useRef(S);k.current=S;const j=()=>{L&&(h(!1),k.current())},C=()=>{const T=m.getValues();if(S4(e,s,T,l)){if(r){h(!0);return}h(!1),k.current()}else{const N=k4(e,s,T,l,d);N&&f(N)}};return P.useEffect(()=>{if(u&&!r){if(!y){h(!1);return}h(!1),k.current()}},[u,r,y]),{form:m,activeKey:d,setActiveKey:f,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:y,canSubmit:L,goPrev:v,goNext:_,advanceToNextUnanswered:w,submit:j,submitOrAdvance:C}}const I7="chat.approval.defaultDenyReason";function M7(t){const e=B.c(36),{onYolo:s}=t,n=re(),[i,r]=br();let l,a,c,d,f,u,h,m,p;if(e[0]!==s||e[1]!==i||e[2]!==r||e[3]!==n){const v=El.find(S=>S.value===i.toolApprovalLevel)??El[0];let _;e[13]!==s||e[14]!==i||e[15]!==r?(_=S=>{const k=S,j=i.toolApprovalLevel??"readonly";r({...i,toolApprovalLevel:k}),k==="auto"&&s(j)},e[13]=s,e[14]=i,e[15]=r,e[16]=_):_=e[16];const w=_;c=ys,m=i.toolApprovalLevel,p=w,a=_s,f="xs",u="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",h=OR,l=Ns,d=n(v.shortKey),e[0]=s,e[1]=i,e[2]=r,e[3]=n,e[4]=l,e[5]=a,e[6]=c,e[7]=d,e[8]=f,e[9]=u,e[10]=h,e[11]=m,e[12]=p}else l=e[4],a=e[5],c=e[6],d=e[7],f=e[8],u=e[9],h=e[10],m=e[11],p=e[12];let g;e[17]!==l||e[18]!==d?(g=o.jsx(l,{children:d}),e[17]=l,e[18]=d,e[19]=g):g=e[19];let x;e[20]!==a||e[21]!==f||e[22]!==u||e[23]!==h||e[24]!==g?(x=o.jsx(a,{size:f,className:u,onClick:h,children:g}),e[20]=a,e[21]=f,e[22]=u,e[23]=h,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==n?(b=El.map(v=>o.jsx(Rt,{value:v.value,children:n(v.labelKey)},v.value)),e[26]=n,e[27]=b):b=e[27];let y;e[28]!==b?(y=o.jsx(Ls,{children:b}),e[28]=b,e[29]=y):y=e[29];let L;return e[30]!==c||e[31]!==y||e[32]!==m||e[33]!==p||e[34]!==x?(L=o.jsxs(c,{value:m,onValueChange:p,children:[x,y]}),e[30]=c,e[31]=y,e[32]=m,e[33]=p,e[34]=x,e[35]=L):L=e[35],L}function OR(t){return t.stopPropagation()}function O7(t){const e=B.c(8),{input:s}=t,n=re();if(s==null){let l;e[0]!==n?(l=n("chat.approval.noInput"),e[0]=n,e[1]=l):l=e[1];let a;return e[2]!==l?(a=o.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:l}),e[2]=l,e[3]=a):a=e[3],a}let i;try{let l;e[4]!==s?(l=JSON.stringify(s,null,2),e[4]=s,e[5]=l):l=e[5],i=l}catch{i=String(s)}let r;return e[6]!==i?(r=o.jsx("div",{className:"px-4",children:o.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:i})}),e[6]=i,e[7]=r):r=e[7],r}function $R(t){const e=B.c(38),{approval:s,onRespond:n}=t,i=re(),[r]=br(),l=r.toolApprovalLevel??"readonly";let a;e[0]!==s.approvalId||e[1]!==l||e[2]!==n||e[3]!==i?(a=()=>n(s.approvalId,!1,i(I7),l),e[0]=s.approvalId,e[1]=l,e[2]=n,e[3]=i,e[4]=a):a=e[4];const c=a;let d;e[5]!==s.approvalId||e[6]!==l||e[7]!==n?(d=()=>n(s.approvalId,!0,void 0,l),e[5]=s.approvalId,e[6]=l,e[7]=n,e[8]=d):d=e[8];const f=d;let u;e[9]!==s.approvalId||e[10]!==n?(u=j=>n(s.approvalId,!0,void 0,j),e[9]=s.approvalId,e[10]=n,e[11]=u):u=e[11];const h=u;let m;e[12]!==h?(m=o.jsx("div",{className:"flex items-center gap-2",children:o.jsx(M7,{onYolo:h})}),e[12]=h,e[13]=m):m=e[13];const p=m;let g;e[14]!==i?(g=i("chat.approval.denyButton"),e[14]=i,e[15]=g):g=e[15];let x;e[16]!==c||e[17]!==g?(x=o.jsx(ue,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:g}),e[16]=c,e[17]=g,e[18]=x):x=e[18];let b;e[19]!==i?(b=i("chat.approval.acceptButton"),e[19]=i,e[20]=b):b=e[20];let y;e[21]!==f||e[22]!==b?(y=o.jsx(ue,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:f,children:b}),e[21]=f,e[22]=b,e[23]=y):y=e[23];let L;e[24]!==x||e[25]!==y?(L=o.jsxs(o.Fragment,{children:[x,y]}),e[24]=x,e[25]=y,e[26]=L):L=e[26];const v=L;let _;e[27]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(f9,{size:14}),e[27]=_):_=e[27];let w;e[28]!==i?(w=i("chat.approval.needsApproval"),e[28]=i,e[29]=w):w=e[29];let S;e[30]!==s.input?(S=o.jsx(O7,{input:s.input}),e[30]=s.input,e[31]=S):S=e[31];let k;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==v||e[35]!==w||e[36]!==S?(k=o.jsx(al,{icon:_,label:w,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:v,children:S}),e[32]=s.friendlyName,e[33]=p,e[34]=v,e[35]=w,e[36]=S,e[37]=k):k=e[37],k}const BR=Cu(Re(),Et({approved:ki().optional(),levelOverride:xr(["auto","readonly"]).optional()}));function zR(t){const e=B.c(46),{approvals:s,isStreaming:n,onRespond:i}=t,r=re(),[l]=br(),a=l.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(HR)),e[0]=s,e[1]=c):c=e[1];const d=c;let f;e[2]!==a||e[3]!==i||e[4]!==r?(f=(N,V)=>{const A=V;typeof A?.approved=="boolean"&&i(N.approvalId,A.approved,A.approved===!1?r(I7):void 0,A.levelOverride??a)},e[2]=a,e[3]=i,e[4]=r,e[5]=f):f=e[5];let u;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==f?(u={parts:s,partKey:UR,schema:BR,defaultValues:d,isStreaming:n,hasAnswer:FR,onSubmit:f},e[6]=s,e[7]=d,e[8]=n,e[9]=f,e[10]=u):u=e[10];const h=D7(u);let m;e[11]!==s||e[12]!==h?(m=N=>{h.form.reset(Object.fromEntries(s.map(V=>[V.approvalId,{approved:!0,levelOverride:N}]))),h.submitOrAdvance()},e[11]=s,e[12]=h,e[13]=m):m=e[13];const p=m,g=h.currentPart,x=h.form;let b;e[14]!==h?(b=N=>{N.preventDefault(),h.submit()},e[14]=h,e[15]=b):b=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(f9,{size:14}),e[16]=y):y=e[16];let L;e[17]!==s.length||e[18]!==r?(L=r("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=r,e[19]=L):L=e[19];const v=g?.friendlyName??"";let _;e[20]!==p?(_=o.jsx(M7,{onYolo:p}),e[20]=p,e[21]=_):_=e[21];let w;e[22]!==s.length||e[23]!==h.currentIndex||e[24]!==h.goNext||e[25]!==h.goPrev||e[26]!==_?(w=o.jsx(E7,{currentIndex:h.currentIndex,total:s.length,onPrev:h.goPrev,onNext:h.goNext,extraLeft:_}),e[22]=s.length,e[23]=h.currentIndex,e[24]=h.goNext,e[25]=h.goPrev,e[26]=_,e[27]=w):w=e[27];let S;e[28]!==g||e[29]!==h.form.control||e[30]!==h.submitOrAdvance?(S=g?o.jsx(KR,{approvalId:g.approvalId,control:h.form.control,onChange:h.submitOrAdvance}):null,e[28]=g,e[29]=h.form.control,e[30]=h.submitOrAdvance,e[31]=S):S=e[31];let k;e[32]!==g?(k=g?o.jsx(O7,{input:g.input}):null,e[32]=g,e[33]=k):k=e[33];let j;e[34]!==w||e[35]!==S||e[36]!==k||e[37]!==L||e[38]!==v?(j=o.jsx(al,{icon:y,label:L,title:v,defaultExpanded:!0,footerLeft:w,footerRight:S,children:k}),e[34]=w,e[35]=S,e[36]=k,e[37]=L,e[38]=v,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==b?(C=o.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=C):C=e[42];let T;return e[43]!==h.form||e[44]!==C?(T=o.jsx(Fm,{...x,children:C}),e[43]=h.form,e[44]=C,e[45]=T):T=e[45],T}function FR(t){return typeof t?.approved=="boolean"}function UR(t){return t.approvalId}function HR(t){return[t.approvalId,{approved:void 0}]}function KR(t){const e=B.c(7),{approvalId:s,control:n,onChange:i}=t,r=re(),l=`${s}.approved`;let a;e[0]!==i||e[1]!==r?(a=d=>{const{field:f}=d,u=f.value===!0,h=f.value===!1;return o.jsxs(o.Fragment,{children:[o.jsx(ue,{type:"button",variant:h?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{f.onChange(!1),i()},"aria-pressed":h,children:r("chat.approval.denyButton")}),o.jsx(ue,{type:"button",variant:u?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{f.onChange(!0),i()},"aria-pressed":u,children:r("chat.approval.acceptButton")})]})},e[0]=i,e[1]=r,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==l||e[5]!==a?(c=o.jsx(js,{control:n,name:l,render:a}),e[3]=n,e[4]=l,e[5]=a,e[6]=c):c=e[6],c}function WR(){const t=B.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(f9,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.approval.preparingRequest"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=o.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,o.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function qR(t){const e=B.c(8),{approvals:s,isStreaming:n,onRespond:i}=t;if(n&&s.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(WR,{}),e[0]=l):l=e[0],l}if(s.length===0)return null;if(s.length===1){const l=s[0];if(!l)return null;let a;return e[1]!==i||e[2]!==l?(a=o.jsx($R,{approval:l,onRespond:i}),e[1]=i,e[2]=l,e[3]=a):a=e[3],a}let r;return e[4]!==s||e[5]!==n||e[6]!==i?(r=o.jsx(zR,{approvals:s,isStreaming:n,onRespond:i}),e[4]=s,e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function GR(t){const e=B.c(28),{plan:s,onApprove:n,onDismiss:i}=t,r=re();let l;e[0]!==n||e[1]!==s.plan?(l=()=>{n(s.plan)},e[0]=n,e[1]=s.plan,e[2]=l):l=e[2];const a=l;let c;e[3]!==r?(c=r("chat.proposePlan.keepIterating"),e[3]=r,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==c?(d=o.jsx(ue,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:i,children:c}),e[5]=i,e[6]=c,e[7]=d):d=e[7];let f;e[8]!==r?(f=r("chat.proposePlan.letsGo"),e[8]=r,e[9]=f):f=e[9];let u;e[10]!==a||e[11]!==f?(u=o.jsx(ue,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:a,children:f}),e[10]=a,e[11]=f,e[12]=u):u=e[12];let h;e[13]!==d||e[14]!==u?(h=o.jsxs(o.Fragment,{children:[d,u]}),e[13]=d,e[14]=u,e[15]=h):h=e[15];const m=h;let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(r8,{size:14}),e[16]=p):p=e[16];let g;e[17]!==r?(g=r("chat.proposePlan.planReady"),e[17]=r,e[18]=g):g=e[18];let x;e[19]!==r?(x=r("chat.proposePlan.implementationPlan"),e[19]=r,e[20]=x):x=e[20];let b;e[21]!==s.plan?(b=o.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:o.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:o.jsx(UT,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=b):b=e[22];let y;return e[23]!==m||e[24]!==b||e[25]!==g||e[26]!==x?(y=o.jsx(al,{icon:p,label:g,title:x,defaultExpanded:!0,footerRight:m,children:b}),e[23]=m,e[24]=b,e[25]=g,e[26]=x,e[27]=y):y=e[27],y}function YR(t){const e=B.c(6),{plans:s,onApprove:n,onDismiss:i}=t;let r;e[0]!==s?(r=C7(s),e[0]=s,e[1]=r):r=e[1];const l=r;if(!l)return null;let a;return e[2]!==l||e[3]!==n||e[4]!==i?(a=o.jsx(GR,{plan:l,onApprove:n,onDismiss:i}),e[2]=l,e[3]=n,e[4]=i,e[5]=a):a=e[5],a}function $7(t){return t?"response"in t?t.response:t.option??t.draft:""}const j4=Et({response:Re().min(1,"Response is required")}),JR=Et({option:Re().nullable(),draft:Re()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),QR=Et({response:xr(["yes","no"])});function XR(t){switch(t.type){case"text":return j4;case"choice":return JR;case"confirm":return QR;default:return j4}}function ZR(t){const e={};for(const s of t)e[s.toolCallId]=XR(s.input);return Et(e)}function eD(t){const e=B.c(7),{control:s,name:n,placeholder:i}=t,r=re();let l;e[0]!==i||e[1]!==r?(l=c=>{const{field:d}=c,f=d.value??"";return o.jsxs(ig,{children:[o.jsx(rg,{children:o.jsx("div",{className:"px-2",children:o.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[o.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:o.jsx(Q2,{size:16,className:"text-muted-foreground"})}),o.jsx("input",{...d,value:f,type:"text",placeholder:i||r("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":r("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),o.jsx(og,{})]})},e[0]=i,e[1]=r,e[2]=l):l=e[2];let a;return e[3]!==s||e[4]!==n||e[5]!==l?(a=o.jsx(w8,{control:s,name:n,render:l}),e[3]=s,e[4]=n,e[5]=l,e[6]=a):a=e[6],a}function B7(t,e){const s=B.c(4);let n,i;s[0]!==t||s[1]!==e?(n=()=>{const r=l=>{const a=l.target.tagName;if(a==="INPUT"||a==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const c=Number.parseInt(l.key,10);c>=1&&c<=t&&(l.preventDefault(),e(c-1))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},i=[t,e],s[0]=t,s[1]=e,s[2]=n,s[3]=i):(n=s[2],i=s[3]),P.useEffect(n,i)}function tD(t){const e=B.c(51),{control:s,name:n,options:i}=t,r=re(),l=`${n}.option`;let a;e[0]!==s||e[1]!==l?(a={control:s,name:l,defaultValue:null},e[0]=s,e[1]=l,e[2]=a):a=e[2];const{field:c}=n4(a),d=`${n}.draft`;let f;e[3]!==s||e[4]!==d?(f={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=f):f=e[5];const{field:u}=n4(f),h=c.value,m=u.value??"";let p;if(e[6]!==c||e[7]!==i?(p=R=>{const I=i[R];I!=null&&c.onChange(I)},e[6]=c,e[7]=i,e[8]=p):p=e[8],B7(i.length,p),i.length===0)return null;const g=h===null;let x;e[9]!==r?(x=r("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=r,e[10]=x):x=e[10];let b;if(e[11]!==c||e[12]!==h||e[13]!==i||e[14]!==r){let R;e[16]!==c||e[17]!==h||e[18]!==r?(R=(I,D)=>{const O=h===I;return o.jsxs("button",{type:"button",onClick:()=>c.onChange(I),className:ie("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",O&&"bg-accent/50",!O&&"hover:bg-accent/30"),"aria-label":r("chat.userAskQuestion.selectOption",{option:I}),children:[o.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",O?"bg-chart-1 text-white":"bg-muted text-foreground"),children:D+1}),o.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:I})]},`${D}-${I}`)},e[16]=c,e[17]=h,e[18]=r,e[19]=R):R=e[19],b=i.map(R),e[11]=c,e[12]=h,e[13]=i,e[14]=r,e[15]=b}else b=e[15];const y=g&&"bg-accent/50",L=!g&&"hover:bg-accent/30";let v;e[20]!==y||e[21]!==L?(v=ie("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",y,L),e[20]=y,e[21]=L,e[22]=v):v=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:o.jsx(Q2,{size:16,className:"text-muted-foreground"})}),e[23]=_):_=e[23];const w=g?m:"";let S;e[24]!==u||e[25]!==c||e[26]!==h?(S=R=>{u.onChange(R.target.value),h!==null&&c.onChange(null)},e[24]=u,e[25]=c,e[26]=h,e[27]=S):S=e[27];let k;e[28]!==c||e[29]!==h?(k=()=>{h!==null&&c.onChange(null)},e[28]=c,e[29]=h,e[30]=k):k=e[30];let j;e[31]!==r?(j=r("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=r,e[32]=j):j=e[32];let C;e[33]!==r?(C=r("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=r,e[34]=C):C=e[34];let T;e[35]!==w||e[36]!==S||e[37]!==k||e[38]!==j||e[39]!==C?(T=o.jsx("input",{type:"text",value:w,onChange:S,onFocus:k,placeholder:j,"aria-label":C,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=w,e[36]=S,e[37]=k,e[38]=j,e[39]=C,e[40]=T):T=e[40];let N;e[41]!==v||e[42]!==T?(N=o.jsxs("label",{className:v,children:[_,T]}),e[41]=v,e[42]=T,e[43]=N):N=e[43];let V;e[44]!==N||e[45]!==x||e[46]!==b?(V=o.jsx(rg,{children:o.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,N]})}),e[44]=N,e[45]=x,e[46]=b,e[47]=V):V=e[47];let A;e[48]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(og,{}),e[48]=A):A=e[48];let E;return e[49]!==V?(E=o.jsxs(ig,{children:[V,A]}),e[49]=V,e[50]=E):E=e[50],E}function sD(t){const e=B.c(8),{control:s,name:n}=t,i=re();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=["yes","no"],e[0]=r):r=e[0];const l=r,a=P.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u=>{a.current?.onChange(l[u]??"")},e[1]=c):c=e[1],B7(l.length,c);let d;e[2]!==i?(d=u=>{const{field:h}=u;return a.current=h,o.jsxs(ig,{children:[o.jsx(rg,{children:o.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":i("chat.userAskQuestion.confirmationOptionsAriaLabel"),children:l.map(m=>{const p=h.value===m;return o.jsxs("button",{type:"button",onClick:()=>h.onChange(m),className:ie("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",p&&"bg-accent/50",!p&&"hover:bg-accent/30"),"aria-label":i("chat.userAskQuestion.confirmValue",{value:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)}),children:[o.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0",p?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),o.jsx("span",{className:"text-sm text-foreground capitalize",children:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)})]},m)})})}),o.jsx(og,{})]})},e[2]=i,e[3]=d):d=e[3];let f;return e[4]!==s||e[5]!==n||e[6]!==d?(f=o.jsx(w8,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=f):f=e[7],f}function C4(t){const e=B.c(13),{input:s,control:n,toolCallId:i}=t;switch(s.type){case"text":{const r=`${i}.response`;let l;return e[0]!==n||e[1]!==s.default||e[2]!==r?(l=o.jsx(eD,{control:n,name:r,placeholder:s.default}),e[0]=n,e[1]=s.default,e[2]=r,e[3]=l):l=e[3],l}case"choice":{let r;e[4]!==s.options?(r=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=r):r=e[5];const l=r;let a;return e[6]!==n||e[7]!==l||e[8]!==i?(a=o.jsx(tD,{control:n,name:i,options:l}),e[6]=n,e[7]=l,e[8]=i,e[9]=a):a=e[9],a}case"confirm":{const r=`${i}.response`;let l;return e[10]!==n||e[11]!==r?(l=o.jsx(sD,{control:n,name:r}),e[10]=n,e[11]=r,e[12]=l):l=e[12],l}default:return null}}function nD(t){const e=B.c(91),{parts:s,isStreaming:n,onSubmit:i}=t;let r;e[0]!==s?(r=ZR(s.map(lD)),e[0]=s,e[1]=r):r=e[1];const l=r;let a;e[2]!==s?(a=Object.fromEntries(s.map(oD)),e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==i?(d=(M,$)=>{const F=$7($);F&&i(M,F)},e[4]=i,e[5]=d):d=e[5];let f;e[6]!==c||e[7]!==n||e[8]!==s||e[9]!==l||e[10]!==d?(f={parts:s,partKey:rD,schema:l,defaultValues:c,isStreaming:n,hasAnswer:iD,onSubmit:d},e[6]=c,e[7]=n,e[8]=s,e[9]=l,e[10]=d,e[11]=f):f=e[11];const u=D7(f),h=u.currentPart,m=re();let p;e[12]!==h||e[13]!==u||e[14]!==m?(p=()=>{const M=h;if(!M)return;const $=m("chat.userAskQuestion.skipMessage"),F=M.toolCallId;M.input?.type==="choice"?(u.form.setValue(`${F}.option`,null),u.form.setValue(`${F}.draft`,$)):u.form.setValue(`${F}.response`,$),u.advanceToNextUnanswered()},e[12]=h,e[13]=u,e[14]=m,e[15]=p):p=e[15];const g=p;let x;e[16]!==u.currentIndex||e[17]!==u.goNext||e[18]!==u.goPrev||e[19]!==s.length?(x=o.jsx(E7,{currentIndex:u.currentIndex,total:s.length,onPrev:u.goPrev,onNext:u.goNext}),e[16]=u.currentIndex,e[17]=u.goNext,e[18]=u.goPrev,e[19]=s.length,e[20]=x):x=e[20];const b=x;let y;e[21]!==m?(y=m("chat.userAskQuestion.skip"),e[21]=m,e[22]=y):y=e[22];let L;e[23]!==g||e[24]!==y?(L=o.jsx(ue,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:y}),e[23]=g,e[24]=y,e[25]=L):L=e[25];let v;e[26]!==u.isAllAnswered||e[27]!==u.isCurrentAnswered||e[28]!==u.submitOrAdvance||e[29]!==n?(v=o.jsx(IR,{isStreaming:n,isAllAnswered:u.isAllAnswered,isCurrentAnswered:u.isCurrentAnswered,onAdvanceOrSubmit:u.submitOrAdvance}),e[26]=u.isAllAnswered,e[27]=u.isCurrentAnswered,e[28]=u.submitOrAdvance,e[29]=n,e[30]=v):v=e[30];let _;e[31]!==L||e[32]!==v?(_=o.jsxs(o.Fragment,{children:[L,v]}),e[31]=L,e[32]=v,e[33]=_):_=e[33];const w=_;if(s.length===1){const M=s[0];if(!M?.input)return null;const $=u.form;let F;e[34]!==u?(F=oe=>{oe.preventDefault(),u.submit()},e[34]=u,e[35]=F):F=e[35];let U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Um,{size:14}),e[36]=U):U=e[36];let H;e[37]!==m?(H=m("chat.userAskQuestion.questionPending"),e[37]=m,e[38]=H):H=e[38];let q;e[39]!==M.input?.prompt||e[40]!==m?(q=M.input?.prompt??m("chat.userAskQuestion.question"),e[39]=M.input?.prompt,e[40]=m,e[41]=q):q=e[41];const W=M.input;let G;e[42]!==u.form.control||e[43]!==M.toolCallId||e[44]!==W?(G=o.jsx(C4,{input:W,control:u.form.control,toolCallId:M.toolCallId}),e[42]=u.form.control,e[43]=M.toolCallId,e[44]=W,e[45]=G):G=e[45];let Y;e[46]!==w||e[47]!==H||e[48]!==q||e[49]!==G?(Y=o.jsx(al,{icon:U,label:H,title:q,defaultExpanded:!0,footerRight:w,children:G}),e[46]=w,e[47]=H,e[48]=q,e[49]=G,e[50]=Y):Y=e[50];let J;e[51]!==F||e[52]!==Y?(J=o.jsx("form",{onSubmit:F,autoComplete:"off",children:Y}),e[51]=F,e[52]=Y,e[53]=J):J=e[53];let se;return e[54]!==u.form||e[55]!==J?(se=o.jsx(Fm,{...$,children:J}),e[54]=u.form,e[55]=J,e[56]=se):se=e[56],se}const S=u.form;let k;e[57]!==u?(k=M=>{M.preventDefault(),u.submit()},e[57]=u,e[58]=k):k=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(Um,{size:14}),e[59]=j):j=e[59];let C;e[60]!==m?(C=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=C):C=e[61];const T=u.currentIndex+1;let N;e[62]!==s.length||e[63]!==m||e[64]!==T?(N=m("chat.userAskQuestion.questionCount",{current:T,total:s.length}),e[62]=s.length,e[63]=m,e[64]=T,e[65]=N):N=e[65];let V;e[66]!==h?.input?.prompt||e[67]!==m?(V=h?.input?.prompt??m("chat.userAskQuestion.question"),e[66]=h?.input?.prompt,e[67]=m,e[68]=V):V=e[68];const A=u.activeKey,E=u.setActiveKey;let R;if(e[69]!==u.form||e[70]!==s){let M;e[72]!==u.form?(M=$=>o.jsx(Ol,{value:$.toolCallId,className:"mt-0",children:o.jsx(C4,{input:$.input,control:u.form.control,toolCallId:$.toolCallId})},$.toolCallId),e[72]=u.form,e[73]=M):M=e[73],R=s.map(M),e[69]=u.form,e[70]=s,e[71]=R}else R=e[71];let I;e[74]!==u.activeKey||e[75]!==u.setActiveKey||e[76]!==R?(I=o.jsx(ad,{value:A,onValueChange:E,children:R}),e[74]=u.activeKey,e[75]=u.setActiveKey,e[76]=R,e[77]=I):I=e[77];let D;e[78]!==b||e[79]!==w||e[80]!==C||e[81]!==N||e[82]!==V||e[83]!==I?(D=o.jsx(al,{icon:j,label:C,count:N,title:V,defaultExpanded:!0,footerLeft:b,footerRight:w,children:I}),e[78]=b,e[79]=w,e[80]=C,e[81]=N,e[82]=V,e[83]=I,e[84]=D):D=e[84];let O;e[85]!==k||e[86]!==D?(O=o.jsx("form",{onSubmit:k,autoComplete:"off",children:D}),e[85]=k,e[86]=D,e[87]=O):O=e[87];let z;return e[88]!==u.form||e[89]!==O?(z=o.jsx(Fm,{...S,children:O}),e[88]=u.form,e[89]=O,e[90]=z):z=e[90],z}function iD(t){return!!$7(t)}function rD(t){return t.toolCallId}function oD(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function lD(t){return{toolCallId:t.toolCallId,input:t.input}}function aD(){const t=B.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Um,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.userAskQuestion.preparingQuestion"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=o.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,o.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function z7(t){const e=B.c(7),{userAskParts:s,isStreaming:n,onSubmit:i}=t;let r;e[0]!==s?(r=s.filter(cD),e[0]=s,e[1]=r):r=e[1];const l=r;if(l.length===0){if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(aD,{}),e[2]=c):c=e[2],c}return null}let a;return e[3]!==n||e[4]!==i||e[5]!==l?(a=o.jsx(nD,{parts:l,isStreaming:n,onSubmit:i}),e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function cD(t){return t.state==="input-available"}function dD(t){const e=t.filter(r=>r.status==="in_progress"),s=t.filter(r=>r.status==="completed").length,n=t.length;if(n>0&&s===n)return{icon:"completed",activity:"All done",progress:`${n}/${n}`};const[i]=e;return i&&e.length===1?{icon:"in_progress",activity:i.activeForm,progress:`${s}/${n} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${n} done`}:s>0?{icon:"pending",activity:`${n-s} pending`,progress:`${s}/${n} done`}:{icon:"pending",activity:`${n} todos`,progress:"not started"}}function uD(t){const e=B.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=dD(s),e[0]=s,e[1]=n):n=e[1];const i=n;let r;e[2]!==i.icon?(r=o.jsx(pD,{status:i.icon}),e[2]=i.icon,e[3]=r):r=e[3];const l=i.activity,a=i.progress;let c;e[4]!==s?(c=s.map(fD),e[4]=s,e[5]=c):c=e[5];let d;e[6]!==c?(d=o.jsx("ul",{"data-testid":"todos-list",className:"flex flex-col px-2 max-h-[40vh] overflow-y-auto",children:c}),e[6]=c,e[7]=d):d=e[7];let f;return e[8]!==i.activity||e[9]!==i.progress||e[10]!==r||e[11]!==d?(f=o.jsx(al,{icon:r,label:l,count:a,defaultExpanded:!1,children:d}),e[8]=i.activity,e[9]=i.progress,e[10]=r,e[11]=d,e[12]=f):f=e[12],f}function fD(t,e){return o.jsx(hD,{todo:t},e)}function hD(t){const e=B.c(14),{todo:s}=t,n=s.status==="completed",r=s.status==="in_progress"?s.activeForm:s.content;let l;e[0]!==s.status?(l=o.jsx(mD,{status:s.status}),e[0]=s.status,e[1]=l):l=e[1];const a=n&&"text-muted-foreground";let c;e[2]!==a?(c=ie("relative text-sm leading-snug pt-px select-none",a),e[2]=a,e[3]=c):c=e[3];const d=n?"100%":"0%",f=n?"width 300ms ease 200ms":"width 150ms ease";let u;e[4]!==d||e[5]!==f?(u=o.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:f}}),e[4]=d,e[5]=f,e[6]=u):u=e[6];let h;e[7]!==r||e[8]!==c||e[9]!==u?(h=o.jsxs("span",{className:c,children:[r,u]}),e[7]=r,e[8]=c,e[9]=u,e[10]=h):h=e[10];let m;return e[11]!==l||e[12]!==h?(m=o.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,h]}),e[11]=l,e[12]=h,e[13]=m):m=e[13],m}function mD(t){const e=B.c(4),{status:s}=t,n=s==="completed"?"true":void 0,i=s==="in_progress"?"true":void 0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("svg",{viewBox:"0 0 21 21",children:o.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=r):r=e[0];let l;return e[1]!==n||e[2]!==i?(l=o.jsx("div",{className:"todo-cb mt-0.5","data-checked":n,"data-progress":i,"aria-hidden":"true",children:r}),e[1]=n,e[2]=i,e[3]=l):l=e[3],l}function pD(t){const e=B.c(13),{status:s}=t,n=re();if(s==="completed"){let l;e[0]!==n?(l=n("chat.todoStatus.completed"),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:o.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=a):a=e[2];let c;return e[3]!==l?(c=o.jsx("span",{"aria-label":l,className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:a}),e[3]=l,e[4]=c):c=e[4],c}if(s==="in_progress"){let l;e[5]!==n?(l=n("chat.todoStatus.inProgress"),e[5]=n,e[6]=l):l=e[6];let a;return e[7]!==l?(a=o.jsx("span",{"aria-label":l,className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[7]=l,e[8]=a):a=e[8],a}let i;e[9]!==n?(i=n("chat.todoStatus.pending"),e[9]=n,e[10]=i):i=e[10];let r;return e[11]!==i?(r=o.jsx("span",{"aria-label":i,className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[11]=i,e[12]=r):r=e[12],r}const gD={usd:[{dollars:10,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:20,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}],brl:[{dollars:50,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:500,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}]},xD=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function F7(t){const e=B.c(65),{onDismiss:s}=t,{org:n}=Fe(),i=Ws(),{decoKeyId:r}=cg(),l=ws(),a=re(),[c,d]=P.useState(""),[f,u]=P.useState(!1),[h,m]=P.useState("usd"),p=h==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{Ye("credits_exhausted_shown",{organization_id:n.id})},x=[n.id],e[0]=n.id,e[1]=g,e[2]=x):(g=e[1],x=e[2]),P.useEffect(g,x);let b;e[3]!==h||e[4]!==l?(b=async W=>{const{url:G}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:W,currency:h});return G},e[3]=h,e[4]=l,e[5]=b):b=e[5];let y;e[6]!==s?(y=W=>{W&&window.open(W,"_blank","noopener,noreferrer"),s?.()},e[6]=s,e[7]=y):y=e[7];let L;e[8]!==a?(L=W=>{xe.error(a("chat.creditsExhaustedBanner.topupError",{error:W.message}))},e[8]=a,e[9]=L):L=e[9];let v;e[10]!==b||e[11]!==y||e[12]!==L?(v={mutationFn:b,onSuccess:y,onError:L},e[10]=b,e[11]=y,e[12]=L,e[13]=v):v=e[13];const{mutate:_,isPending:w}=Rs(v),S=parseFloat(c),k=!isNaN(S)&&S>=1;let j;e[14]!==s?(j=W=>!W&&s?.(),e[14]=s,e[15]=j):j=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[16]=C):C=e[16];let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:C.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=T):T=e[17];let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[18]=N):N=e[18];let V;e[19]!==a?(V=a("chat.creditsExhaustedBanner.title"),e[19]=a,e[20]=V):V=e[20];let A;e[21]!==V?(A=o.jsx(Yt,{className:"text-xl font-semibold tracking-tight",children:V}),e[21]=V,e[22]=A):A=e[22];let E;e[23]!==a?(E=a("chat.creditsExhaustedBanner.description"),e[23]=a,e[24]=E):E=e[24];let R;e[25]!==E?(R=o.jsx(kn,{className:"mt-1.5 text-sm leading-relaxed",children:E}),e[25]=E,e[26]=R):R=e[26];let I;e[27]!==A||e[28]!==R?(I=o.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[T,o.jsxs(hs,{className:"relative gap-4",children:[N,o.jsxs("div",{children:[A,R]})]})]}),e[27]=A,e[28]=R,e[29]=I):I=e[29];let D;e[30]!==h||e[31]!==p||e[32]!==c||e[33]!==S||e[34]!==r||e[35]!==k||e[36]!==w||e[37]!==f||e[38]!==a||e[39]!==_?(D=r&&o.jsxs("div",{className:"px-8 pt-5 pb-6",children:[o.jsx("div",{className:"mb-4",children:o.jsxs(p9,{type:"single",variant:"outline",size:"sm",value:h,onValueChange:W=>{W&&m(W)},children:[o.jsx(Kc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),o.jsx(Kc,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),o.jsxs("div",{className:"rounded-xl border border-border p-5",children:[o.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:gD[h].map(W=>{const{dollars:G,labelKey:Y}=W;return o.jsxs("button",{type:"button",disabled:w,onClick:()=>{Ye("credits_topup_clicked",{amount_cents:G*100,currency:h,tier_label:Y,source:"exhausted_banner"}),_(G*100)},className:ie("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[o.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,G]}),o.jsx("span",{className:"text-xs text-muted-foreground",children:a(Y)})]},G)})}),f?o.jsxs("div",{className:"flex gap-2 mt-3",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),o.jsx(mt,{type:"number",min:"1",step:"1",placeholder:a("chat.creditsExhaustedBanner.customPlaceholder"),value:c,onChange:W=>d(W.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),o.jsx(ue,{className:"h-10",disabled:!k||w,onClick:()=>{Ye("credits_topup_clicked",{amount_cents:Math.round(S*100),currency:h,tier_label:"custom",source:"exhausted_banner"}),_(Math.round(S*100))},children:a(w?"chat.creditsExhaustedBanner.opening":"chat.creditsExhaustedBanner.add")})]}):o.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>u(!0),children:a("chat.creditsExhaustedBanner.enterCustom")})]}),o.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:xD.map(W=>o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:o.jsx(Ft,{size:12,className:"text-[hsl(var(--chart-1))]"})}),o.jsx("span",{className:"text-sm text-foreground/80",children:a(W)})]},W))})]}),e[30]=h,e[31]=p,e[32]=c,e[33]=S,e[34]=r,e[35]=k,e[36]=w,e[37]=f,e[38]=a,e[39]=_,e[40]=D):D=e[40];let O;e[41]!==a?(O=a("chat.creditsExhaustedBanner.dismiss"),e[41]=a,e[42]=O):O=e[42];let z;e[43]!==s||e[44]!==O?(z=o.jsx(ue,{variant:"ghost",size:"sm",onClick:s,children:O}),e[43]=s,e[44]=O,e[45]=z):z=e[45];let M;e[46]!==i||e[47]!==s||e[48]!==n.slug?(M=()=>{i({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=i,e[47]=s,e[48]=n.slug,e[49]=M):M=e[49];let $;e[50]!==a?($=a("chat.creditsExhaustedBanner.manageProviders"),e[50]=a,e[51]=$):$=e[51];let F;e[52]!==M||e[53]!==$?(F=o.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:M,children:$}),e[52]=M,e[53]=$,e[54]=F):F=e[54];let U;e[55]!==z||e[56]!==F?(U=o.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[z,F]}),e[55]=z,e[56]=F,e[57]=U):U=e[57];let H;e[58]!==I||e[59]!==D||e[60]!==U?(H=o.jsxs(Ut,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:bD,children:[I,D,U]}),e[58]=I,e[59]=D,e[60]=U,e[61]=H):H=e[61];let q;return e[62]!==H||e[63]!==j?(q=o.jsx(Ht,{open:!0,onOpenChange:j,children:H}),e[62]=H,e[63]=j,e[64]=q):q=e[64],q}function bD(t){return t.preventDefault()}const vD={trial_exhausted:{label:"chat.subscriptionLimit.trialLabel",title:"chat.subscriptionLimit.trialTitle"},monthly_exhausted:{label:"chat.subscriptionLimit.monthlyLabel",title:"chat.subscriptionLimit.monthlyTitle"},runs_exhausted:{label:"chat.subscriptionLimit.runsLabel",title:"chat.subscriptionLimit.runsTitle"}};function yD(t){const e=B.c(16),{kind:s,onDismiss:n,onSubscribe:i}=t,r=re(),{label:l,title:a}=vD[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(ua,{size:14}),e[0]=c):c=e[0];let d;e[1]!==l||e[2]!==r?(d=r(l),e[1]=l,e[2]=r,e[3]=d):d=e[3];let f;e[4]!==r||e[5]!==a?(f=r(a),e[4]=r,e[5]=a,e[6]=f):f=e[6];let u;e[7]!==s||e[8]!==i||e[9]!==r?(u=s==="trial_exhausted"?o.jsx(ue,{size:"sm",onClick:i,className:"h-7 text-xs",children:r("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=i,e[9]=r,e[10]=u):u=e[10];let h;return e[11]!==n||e[12]!==d||e[13]!==f||e[14]!==u?(h=o.jsx(al,{icon:c,label:d,title:f,defaultExpanded:!0,variant:"warning",onClose:n,footerRight:u}),e[11]=n,e[12]=d,e[13]=f,e[14]=u,e[15]=h):h=e[15],h}function _D(t){const e=t.trim(),s=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),n=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),i=/failed to fetch|networkerror|load failed|offline/i.test(e),r=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,a=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(a){const c=a[1]?.trim().replace(/\.$/,"");return{summary:c?`Your sandbox didn't finish starting up (${c}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return n||s&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:i?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:r?{summary:"That took longer than expected. Try again.",rawDetails:t}:s||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const LD={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function nh(t){const e=B.c(29),s=re(),{variant:n,onDismiss:i}=t,r=n==="error";let l;e[0]!==r||e[1]!==s?(l=s(r?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=r,e[1]=s,e[2]=l):l=e[2];const a=l,c=r?pn:so;let d;e[3]!==t.error||e[4]!==t.finishReason||e[5]!==t.variant||e[6]!==s?(d=t.variant==="error"?t.error.message:(()=>{const y=LD[t.finishReason];return y?s(y):s("chat.highlight.responseStoppedUnexpectedly",{reason:t.finishReason})})(),e[3]=t.error,e[4]=t.finishReason,e[5]=t.variant,e[6]=s,e[7]=d):d=e[7];const f=d;let u;e[8]!==r||e[9]!==f?(u=r?_D(f):{summary:f,rawDetails:null},e[8]=r,e[9]=f,e[10]=u):u=e[10];const{summary:h,rawDetails:m}=u;let p;e[11]!==c?(p=o.jsx(c,{size:14}),e[11]=c,e[12]=p):p=e[12];let g;e[13]!==r||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(g=r?o.jsx(ue,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):o.jsx(ue,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=r,e[14]=t.onContinue,e[15]=t.onFixInChat,e[16]=s,e[17]=g):g=e[17];let x;e[18]!==m||e[19]!==s?(x=m?o.jsxs("details",{className:"group mx-4",children:[o.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[o.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"m4.5 3 3 3-3 3"})}),o.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),o.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),o.jsxs("div",{className:"relative mt-2",children:[o.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(m).then(()=>xe.success(s("chat.highlight.copiedToClipboard"))).catch(()=>xe.error(s("chat.highlight.couldNotCopy")))},"aria-label":s("chat.highlight.copyErrorDetails"),title:s("chat.highlight.copy"),className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:o.jsx(an,{className:"size-3.5"})}),o.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:m})]})]}):null,e[18]=m,e[19]=s,e[20]=x):x=e[20];let b;return e[21]!==a||e[22]!==i||e[23]!==h||e[24]!==p||e[25]!==g||e[26]!==x||e[27]!==n?(b=o.jsx(al,{icon:p,label:a,title:h,defaultExpanded:!0,variant:n,onClose:i,footerRight:g,children:x}),e[21]=a,e[22]=i,e[23]=h,e[24]=p,e[25]=g,e[26]=x,e[27]=n,e[28]=b):b=e[28],b}function C9(){const t=B.c(73),e=re(),{error:s,clearError:n,finishReason:i,clearFinishReason:r,messages:l,isStreaming:a,submit:c,sendMessage:d}=ui(),[f,u]=br(),{virtualMcpId:h,createTaskWithMessage:m}=sn(),{chatMode:p,simpleModeTier:g}=la(),{mutate:x}=k8("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let b;t[0]!==x?(b=()=>x(),t[0]=x,t[1]=b):b=t[1];const y=b;let L;t[2]!==p||t[3]!==g||t[4]!==h?(L=le=>({tier:g,mode:p,toolApprovalLevel:le,agent:h?{id:h}:void 0}),t[2]=p,t[3]=g,t[4]=h,t[5]=L):L=t[5];const v=L;let _;t[6]!==f.toolApprovalLevel?(_=f.toolApprovalLevel??BN(),t[6]=f.toolApprovalLevel,t[7]=_):_=t[7];const w=_,S=l.at(-1),k=S?.role==="assistant"?S.parts:[],j=k.filter(jD),C=N7(k),T=j7(k);let N;t[8]!==s||t[9]!==d||t[10]!==e?(N=()=>{if(s){const ee={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(ee)}},t[8]=s,t[9]=d,t[10]=e,t[11]=N):N=t[11];const V=N;let A;t[12]!==d||t[13]!==e?(A=()=>{const le={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.pleaseContinue")}]}]};d(le)},t[12]=d,t[13]=e,t[14]=A):A=t[14];const E=A;let R;t[15]!==v||t[16]!==w||t[17]!==c?(R=(le,ee)=>{c({kind:"toolOutput",toolCallId:le.toolCallId,output:{response:ee}},v(w))},t[15]=v,t[16]=w,t[17]=c,t[18]=R):R=t[18];const I=R;let D;t[19]!==m||t[20]!==f||t[21]!==u||t[22]!==e||t[23]!==h?(D=le=>{u({...f,toolApprovalLevel:"auto"}),m({virtualMcpId:h,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:le})}]}})},t[19]=m,t[20]=f,t[21]=u,t[22]=e,t[23]=h,t[24]=D):D=t[24];const O=D,z=kD;let M;t[25]!==v||t[26]!==c?(M=(le,ee,ae,ce)=>{c({kind:"approval",approvalId:le,approved:ee,...ae?{reason:ae}:{}},v(ce))},t[25]=v,t[26]=c,t[27]=M):M=t[27];const $=M,F=V7();if(F.isCreditExhausted){let le;return t[28]!==n?(le=o.jsx(F7,{onDismiss:n}),t[28]=n,t[29]=le):le=t[29],le}const{showError:U,showWarning:H,hasApprovals:q}=F,W=j.map(SD).join("|"),G=C7(C)?.toolCallId??"",Y=T.map(wD).join("|");let J;t[30]!==F.todos?(J=o.jsx(uD,{todos:F.todos}),t[30]=F.todos,t[31]=J):J=t[31];let se;t[32]!==n||t[33]!==F.subscriptionErrorKind||t[34]!==y?(se=F.subscriptionErrorKind&&o.jsx(yD,{kind:F.subscriptionErrorKind,onDismiss:n,onSubscribe:y}),t[32]=n,t[33]=F.subscriptionErrorKind,t[34]=y,t[35]=se):se=t[35];let oe;t[36]!==n||t[37]!==s||t[38]!==V||t[39]!==U?(oe=U&&o.jsx(nh,{variant:"error",error:s,onDismiss:n,onFixInChat:V}),t[36]=n,t[37]=s,t[38]=V,t[39]=U,t[40]=oe):oe=t[40];let ne;t[41]!==r||t[42]!==i||t[43]!==E||t[44]!==H?(ne=H&&o.jsx(nh,{variant:"warning",finishReason:i,onDismiss:r,onContinue:E}),t[41]=r,t[42]=i,t[43]=E,t[44]=H,t[45]=ne):ne=t[45];let Q;t[46]!==Y||t[47]!==$||t[48]!==q||t[49]!==a||t[50]!==T?(Q=q&&o.jsx(qR,{approvals:T,isStreaming:a,onRespond:$},Y),t[46]=Y,t[47]=$,t[48]=q,t[49]=a,t[50]=T,t[51]=Q):Q=t[51];let K;t[52]!==F.hasPlans||t[53]!==O||t[54]!==z||t[55]!==a||t[56]!==C||t[57]!==G?(K=F.hasPlans&&o.jsx(YR,{plans:C,isStreaming:a,onApprove:O,onDismiss:z},G),t[52]=F.hasPlans,t[53]=O,t[54]=z,t[55]=a,t[56]=C,t[57]=G,t[58]=K):K=t[58];let X;t[59]!==F.isWaitingForUserInput||t[60]!==I||t[61]!==a||t[62]!==W||t[63]!==j?(X=F.isWaitingForUserInput&&o.jsx(z7,{userAskParts:j,isStreaming:a,onSubmit:I},W),t[59]=F.isWaitingForUserInput,t[60]=I,t[61]=a,t[62]=W,t[63]=j,t[64]=X):X=t[64];let Z;return t[65]!==oe||t[66]!==ne||t[67]!==Q||t[68]!==K||t[69]!==X||t[70]!==J||t[71]!==se?(Z=o.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[J,se,oe,ne,Q,K,X]}),t[65]=oe,t[66]=ne,t[67]=Q,t[68]=K,t[69]=X,t[70]=J,t[71]=se,t[72]=Z):Z=t[72],Z}function wD(t){return t.approvalId}function SD(t){return t.toolCallId}function kD(){document.querySelector("[data-chat-input]")?.focus()}function jD(t){return t.type==="tool-user_ask"}C9.Error=function(e){return o.jsx(nh,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};C9.Warning=function(e){return o.jsx(nh,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};C9.UserAskQuestion=z7;function CD(t){const e=B.c(20),{taskId:s}=t,n=re(),i=B6(s),r=CT(i),l=NT(),{stop:a,removeLocalMessage:c}=ui();if(r.length===0)return null;let d;e[0]!==n?(d=n("chat.queueTray.sendNow"),e[0]=n,e[1]=d):d=e[1];let f;e[2]!==a?(f=()=>{a()},e[2]=a,e[3]=f):f=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Jh,{size:14}),e[4]=u):u=e[4];let h;e[5]!==d||e[6]!==f?(h=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:f,children:u})}),e[5]=d,e[6]=f,e[7]=h):h=e[7];let m;e[8]!==n?(m=n("chat.queueTray.sendNow"),e[8]=n,e[9]=m):m=e[9];let p;e[10]!==m?(p=o.jsx(We,{side:"top",children:o.jsx("p",{className:"text-xs",children:m})}),e[10]=m,e[11]=p):p=e[11];let g;e[12]!==h||e[13]!==p?(g=o.jsxs(qe,{delayDuration:400,children:[h,p]}),e[12]=h,e[13]=p,e[14]=g):g=e[14];let x;return e[15]!==l||e[16]!==c||e[17]!==n||e[18]!==s?(x=(b,y)=>o.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[o.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:y+1}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.text}),o.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/queuerow:opacity-100",children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm",title:n("chat.queueTray.removeFromQueue"),"aria-label":n("chat.queueTray.removeFromQueue"),onClick:()=>{l.cancel(s,b.messageId).then(L=>{L&&(TT(s,b.messageId),c(b.messageId))})},children:o.jsx(Ci,{className:"size-3.5"})})})]},b.messageId),e[15]=l,e[16]=c,e[17]=n,e[18]=s,e[19]=x):x=e[19],o.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[o.jsx("span",{children:n(r.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:r.length})}),g]}),r.map(x)]})}function ND(t,e){return t?{modelId:t.modelId,title:t.title??t.modelId,keyId:t.keyId,providerId:e,description:null,logo:null,capabilities:[],limits:null,costs:null}:null}const TD={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function VD(t){const e=B.c(31),{tier:s,orgSlot:n,userSlot:i,autoSlot:r,onPick:l,onReset:a,onClose:c}=t,d=re(),f=v9(),u=new Set(f.map(AD)),h=VT([i,n,r],u),m=h?.keyId??null,[p,g]=P.useState(m??f[0]?.id??null),x=f.some(D=>D.id===p)?p:m??f[0]?.id??null,b=x?f.find(D=>D.id===x):null,y="flex h-[70vh] max-h-[460px] w-full flex-col",L=TD[s];let v;e[0]!==d||e[1]!==L?(v=d(L),e[0]=d,e[1]=L,e[2]=v):v=e[2];let _;e[3]!==v?(_=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:v}),e[3]=v,e[4]=_):_=e[4];let w;e[5]!==a||e[6]!==d||e[7]!==i?(w=i&&o.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent cursor-pointer",children:d("chat.modelPreferences.reset")}),e[5]=a,e[6]=d,e[7]=i,e[8]=w):w=e[8];let S;e[9]!==_||e[10]!==w?(S=o.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[_,w]}),e[9]=_,e[10]=w,e[11]=S):S=e[11];const k="flex-1 min-h-0",j=P.Suspense;let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(oP,{}),e[12]=C):C=e[12];const T=rP,N=!0,V=ND(m?h:null,b?.providerId??"deco");let A;e[13]!==x||e[14]!==l||e[15]!==g?(A=D=>{const O=D.keyId??x??"";g(O),l({keyId:O,modelId:D.modelId,title:D.title})},e[13]=x,e[14]=l,e[15]=g,e[16]=A):A=e[16];let E;e[17]!==T||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==V||e[22]!==A?(E=o.jsx(T,{compact:N,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:V,onModelChange:A}),e[17]=T,e[18]=x,e[19]=c,e[20]=g,e[21]=V,e[22]=A,e[23]=E):E=e[23];let R;e[24]!==j||e[25]!==E||e[26]!==C?(R=o.jsx("div",{className:k,children:o.jsx(j,{fallback:C,children:E})}),e[24]=j,e[25]=E,e[26]=C,e[27]=R):R=e[27];let I;return e[28]!==R||e[29]!==S?(I=o.jsxs("div",{className:y,children:[S,R]}),e[28]=R,e[29]=S,e[30]=I):I=e[30],I}function AD(t){return t.id}const PD=["fast","smart","thinking"];function U7(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const ED={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function RD(t){const e=B.c(28),{tier:s,pillIcon:n,groups:i}=t,r=re();let l;e[0]!==r?(l=U7(r),e[0]=r,e[1]=l):l=e[1];const a=l,[c,d]=P.useState(!1);let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=k=>{k.onSelect(),d(!1)},e[2]=f):f=e[2];const u=f,h=a[s];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[3]=m):m=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[4]=p):p=e[4];const g=a[s];let x;e[5]!==g?(x=o.jsx("span",{className:p,children:g}),e[5]=g,e[6]=x):x=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Qt,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=b):b=e[7];let y;e[8]!==n||e[9]!==h||e[10]!==x?(y=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"inline-flex min-w-0 shrink",children:o.jsx(ns,{asChild:!0,children:o.jsxs(ue,{type:"button",variant:"ghost",size:"default","aria-label":h,className:m,children:[n,x,b]})})})}),e[8]=n,e[9]=h,e[10]=x,e[11]=y):y=e[11];let L;e[12]!==h?(L=o.jsx(We,{children:h}),e[12]=h,e[13]=L):L=e[13];let v;e[14]!==y||e[15]!==L?(v=o.jsxs(qe,{children:[y,L]}),e[14]=y,e[15]=L,e[16]=v):v=e[16];let _;if(e[17]!==i||e[18]!==r){let k;e[20]!==r?(k=j=>o.jsx("div",{className:"flex flex-col",children:j.rows.map(C=>o.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-md hover:bg-muted",children:[o.jsxs("button",{type:"button",role:"menuitem","aria-label":C.title,onClick:()=>u(C),className:ie("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",C.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[C.icon&&o.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:C.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-sm",children:C.title}),C.subtitle&&o.jsx("div",{className:"text-xs text-muted-foreground",children:C.subtitle})]}),C.active&&o.jsx("span",{title:r("chat.tierTrigger.selected"),children:o.jsx(Ft,{size:14,className:"text-foreground mt-0.5"})})]}),C.modelOverride&&o.jsx(ID,{label:C.title,render:C.modelOverride})]},C.key))},j.key),e[20]=r,e[21]=k):k=e[21],_=i.map(k),e[17]=i,e[18]=r,e[19]=_}else _=e[19];let w;e[22]!==_?(w=o.jsx(is,{align:"end",className:"p-1 w-64",onOpenAutoFocus:DD,children:o.jsx("div",{role:"menu",className:"flex flex-col",children:_})}),e[22]=_,e[23]=w):w=e[23];let S;return e[24]!==c||e[25]!==v||e[26]!==w?(S=o.jsxs(rs,{open:c,onOpenChange:d,children:[v,w]}),e[24]=c,e[25]=v,e[26]=w,e[27]=S):S=e[27],S}function DD(t){return t.preventDefault()}function ID(t){const e=B.c(38),{label:s,render:n}=t,i=re(),r=fl(),[l,a]=P.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(!1),e[0]=c):c=e[0];const d=c;let f;e[1]!==s||e[2]!==i?(f=i("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=i,e[3]=f):f=e[3];const u=l&&"opacity-100";let h;e[4]!==u?(h=ie("absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center","size-6 rounded-md bg-background border border-border/60 shadow-sm","text-muted-foreground hover:text-foreground","opacity-100 [@media(hover:hover)]:opacity-0","[@media(hover:hover)]:group-hover/tier-row:opacity-100","[@media(hover:hover)]:group-focus-within/tier-row:opacity-100",u),e[4]=u,e[5]=h):h=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(lg,{size:14}),e[6]=m):m=e[6];let p;e[7]!==f||e[8]!==h?(p=o.jsx("button",{type:"button","aria-label":f,className:h,children:m}),e[7]=f,e[8]=h,e[9]=p):p=e[9];const g=p;if(r){let v;e[10]!==g?(v=o.jsx(X6,{asChild:!0,children:g}),e[10]=g,e[11]=v):v=e[11];let _;e[12]!==s||e[13]!==i?(_=i("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=i,e[14]=_):_=e[14];let w;e[15]!==_?(w=o.jsx(s9,{className:"sr-only",children:_}),e[15]=_,e[16]=w):w=e[16];let S;e[17]!==l||e[18]!==n?(S=l&&n(d),e[17]=l,e[18]=n,e[19]=S):S=e[19];let k;e[20]!==S||e[21]!==w?(k=o.jsxs(n9,{className:"p-0 flex flex-col max-h-[95vh]",children:[w,S]}),e[20]=S,e[21]=w,e[22]=k):k=e[22];let j;return e[23]!==l||e[24]!==k||e[25]!==v?(j=o.jsxs(i9,{open:l,onOpenChange:a,children:[v,k]}),e[23]=l,e[24]=k,e[25]=v,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=o.jsx(ns,{asChild:!0,children:g}),e[27]=g,e[28]=x):x=e[28];let b;e[29]!==l||e[30]!==n?(b=l&&n(d),e[29]=l,e[30]=n,e[31]=b):b=e[31];let y;e[32]!==b?(y=o.jsx(is,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:b}),e[32]=b,e[33]=y):y=e[33];let L;return e[34]!==l||e[35]!==x||e[36]!==y?(L=o.jsxs(rs,{open:l,onOpenChange:a,children:[x,y]}),e[34]=l,e[35]=x,e[36]=y,e[37]=L):L=e[37],L}function N4(t){return t==="fast"?o.jsx(ua,{size:16}):t==="thinking"?o.jsx(o8,{size:16}):o.jsx(Wr,{size:16})}function MD(t){const e=B.c(13),s=ET();let n;e[0]!==t||e[1]!==s.tiers?(n=d=>{const f=s.tiers[d];return f?f.title??f.modelId:t.chat[d]?.title},e[0]=t,e[1]=s.tiers,e[2]=n):n=e[2];const i=n;let r;e[3]!==i?(r=i("fast"),e[3]=i,e[4]=r):r=e[4];let l;e[5]!==i?(l=i("smart"),e[5]=i,e[6]=l):l=e[6];let a;e[7]!==i?(a=i("thinking"),e[7]=i,e[8]=a):a=e[8];let c;return e[9]!==r||e[10]!==l||e[11]!==a?(c={fast:r,smart:l,thinking:a},e[9]=r,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function OD(){const t=B.c(22),e=re(),{simpleModeTier:s,setSimpleModeTier:n}=la(),i=fP(),r=v9(),l=hP(r),a=MD(l),{data:c,error:d}=AT();let f;t[0]!==c?(f=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=f):f=t[1];const u=f,h=PT();let m,p;if(t[2]!==l||t[3]!==i||t[4]!==n||t[5]!==e||t[6]!==s||t[7]!==a||t[8]!==h||t[9]!==u||t[10]!==d){const L=U7(e);m="decopilot",p=PD.map(v=>{const _=a[v],w=u.tiers[v];return{key:`decopilot-${v}`,icon:N4(v),title:L[v],subtitle:_??e(ED[v]),active:s===v,onSelect:()=>n(v),modelOverride:S=>o.jsxs(o.Fragment,{children:[d&&o.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),o.jsx(VD,{tier:v,orgSlot:i.tiers[v],userSlot:w,autoSlot:l.chat[v],onClose:S,onPick:k=>h.mutate({tier:v,slot:k}),onReset:()=>h.mutate({tier:v,slot:null})},`${v}:${w?.keyId??"org"}:${w?.modelId??""}`)]})}}),t[2]=l,t[3]=i,t[4]=n,t[5]=e,t[6]=s,t[7]=a,t[8]=h,t[9]=u,t[10]=d,t[11]=m,t[12]=p}else m=t[11],p=t[12];let g;t[13]!==m||t[14]!==p?(g=[{key:m,rows:p}],t[13]=m,t[14]=p,t[15]=g):g=t[15];const x=g;let b;t[16]!==s?(b=N4(s),t[16]=s,t[17]=b):b=t[17];let y;return t[18]!==x||t[19]!==b||t[20]!==s?(y=o.jsx(RD,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=y):y=t[21],y}async function Kg(t,e,s,n,i,r){if(!g9(e)){xe.error("Selected model does not support file uploads");return}const l=s.type||"application/octet-stream";if(!lP(l,e)){const c=j8(e).parts.map(f=>r(f)).join(", "),d=e?.title??"This model";i?i({fileName:s.name,modelName:d,accepted:c}):xe.error(`"${s.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){xe.error(`File "${s.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((h,m)=>{c.onload=()=>{const p=c.result;if(typeof p!="string"){m(new Error("Failed to read file as data URL"));return}const g=p.includes(",")?p.split(",")[1]??p:p;h(g)},c.onerror=m});c.readAsDataURL(s);const f=await d,u={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:f};HT(t,{from:n,to:n},u)}catch(c){console.error("Failed to process file:",c),xe.error(`Failed to load file "${s.name}"`)}}function $D(t){const e=B.c(9),{editor:s,selectedModel:n,onUnsupportedFile:i}=t,r=re(),l=P.useRef(zD);let a,c;e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==r?(a=()=>{l.current=async(u,h)=>{await Kg(s,n,u,h,i,r)}},c=[s,n,i,r],e[0]=s,e[1]=i,e[2]=n,e[3]=r,e[4]=a,e[5]=c):(a=e[4],c=e[5]),P.useEffect(a,c);let d,f;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const u=new ji("fileDropHandler");s.state.plugins.find(p=>p.spec.key===u)&&s.unregisterPlugin(u);const m=new rd({key:u,props:{handleDrop:(p,g,x,b)=>{if(b)return!1;const y=g.dataTransfer?.files;if(!y||y.length===0)return!1;g.preventDefault();const L=p.posAtCoords({left:g.clientX,top:g.clientY});if(!L)return!1;const v=Array.from(y);return(async()=>{let _=L.pos;for(const w of v)await l.current?.(w,_),_=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(BD);return b.length===0?!1:(g.preventDefault(),(async()=>{let y=p.state.selection.from;for(const L of b){const v=L.getAsFile();v&&(await l.current?.(v,y),y=p.state.selection.to)}})(),!0)}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(u)}},f=[s],e[6]=s,e[7]=d,e[8]=f):(d=e[7],f=e[8]),P.useEffect(d,f),null}function BD(t){return t.kind==="file"}function zD(){return Promise.resolve()}function FD(t){const e=B.c(43),{info:s,onClose:n}=t,i=re(),r=s!==null;let l;e[0]!==n?(l=N=>!N&&n(),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=a):a=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:a.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-warning/15 text-warning",children:o.jsx(so,{size:18})}),e[4]=d):d=e[4];let f;e[5]!==i?(f=i("chat.uploader.fileTypeNotSupported"),e[5]=i,e[6]=f):f=e[6];let u;e[7]!==f?(u=o.jsx(Yt,{className:"text-xl font-semibold tracking-tight",children:f}),e[7]=f,e[8]=u):u=e[8];const h=s?.fileName;let m;e[9]!==h?(m=o.jsxs("span",{className:"font-medium text-foreground",children:["“",h,"”"]}),e[9]=h,e[10]=m):m=e[10];let p;e[11]!==i?(p=i("chat.uploader.cantAttachToChat"),e[11]=i,e[12]=p):p=e[12];let g;e[13]!==p||e[14]!==m?(g=o.jsxs(kn,{className:"mt-1.5 text-sm leading-relaxed",children:[m," ",p]}),e[13]=p,e[14]=m,e[15]=g):g=e[15];let x;e[16]!==g||e[17]!==u?(x=o.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,o.jsxs(hs,{className:"relative gap-4",children:[d,o.jsxs("div",{children:[u,g]})]})]}),e[16]=g,e[17]=u,e[18]=x):x=e[18];const b=s?.modelName??"";let y;e[19]!==i||e[20]!==b?(y=i("chat.uploader.accepts",{modelName:b}),e[19]=i,e[20]=b,e[21]=y):y=e[21];let L;e[22]!==y?(L=o.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:y}),e[22]=y,e[23]=L):L=e[23];let v;e[24]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(l8,{size:14,className:"text-muted-foreground"}),e[24]=v):v=e[24];const _=s?.accepted;let w;e[25]!==_?(w=o.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[v,o.jsx("span",{className:"capitalize",children:_})]}),e[25]=_,e[26]=w):w=e[26];let S;e[27]!==L||e[28]!==w?(S=o.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:o.jsxs("div",{className:"rounded-xl border border-border p-4",children:[L,w]})}),e[27]=L,e[28]=w,e[29]=S):S=e[29];let k;e[30]!==i?(k=i("chat.uploader.gotIt"),e[30]=i,e[31]=k):k=e[31];let j;e[32]!==n||e[33]!==k?(j=o.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:o.jsx(ue,{onClick:n,children:k})}),e[32]=n,e[33]=k,e[34]=j):j=e[34];let C;e[35]!==x||e[36]!==S||e[37]!==j?(C=o.jsxs(Ut,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:UD,children:[x,S,j]}),e[35]=x,e[36]=S,e[37]=j,e[38]=C):C=e[38];let T;return e[39]!==r||e[40]!==l||e[41]!==C?(T=o.jsx(Ht,{open:r,onOpenChange:l,children:C}),e[39]=r,e[40]=l,e[41]=C,e[42]=T):T=e[42],T}function UD(t){return t.preventDefault()}function HD(){const t=B.c(3),[e,s]=P.useState(null);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>s(null),t[0]=n):n=t[0];let i;return t[1]!==e?(i={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:n},t[1]=e,t[2]=i):i=t[2],i}var Wg=KT;var KD=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Gm=KD.join(","),H7=typeof Element>"u",Ou=H7?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ih=!H7&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},rh=function(e,s){var n;s===void 0&&(s=!0);var i=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),r=i===""||i==="true",l=r||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):rh(e.parentNode));return l},WD=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},qD=function(e,s,n){if(rh(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(Gm));return s&&Ou.call(e,Gm)&&i.unshift(e),i=i.filter(n),i},Ym=function(e,s,n){for(var i=[],r=Array.from(e);r.length;){var l=r.shift();if(!rh(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),c=a.length?a:l.children,d=Ym(c,!0,n);n.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{var f=Ou.call(l,Gm);f&&n.filter(l)&&(s||!e.includes(l))&&i.push(l);var u=l.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(l),h=!rh(u,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(l));if(u&&h){var m=Ym(u===!0?l.children:u.children,!0,n);n.flatten?i.push.apply(i,m):i.push({scopeParent:l,candidates:m})}else r.unshift.apply(r,l.children)}}return i},K7=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},W7=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||WD(e))&&!K7(e)?0:e.tabIndex},GD=function(e,s){var n=W7(e);return n<0&&s&&!K7(e)?0:n},YD=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},q7=function(e){return e.tagName==="INPUT"},JD=function(e){return q7(e)&&e.type==="hidden"},QD=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},XD=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},ZD=function(e){if(!e.name)return!0;var s=e.form||ih(e),n=function(a){return s.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(e.name));else try{i=n(e.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var r=XD(i,e.form);return!r||r===e},eI=function(e){return q7(e)&&e.type==="radio"},tI=function(e){return eI(e)&&!ZD(e)},sI=function(e){var s,n=e&&ih(e),i=(s=n)===null||s===void 0?void 0:s.host,r=!1;if(n&&n!==e){var l,a,c;for(r=!!((l=i)!==null&&l!==void 0&&(a=l.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!r&&i;){var d,f,u;n=ih(i),i=(d=n)===null||d===void 0?void 0:d.host,r=!!((f=i)!==null&&f!==void 0&&(u=f.ownerDocument)!==null&&u!==void 0&&u.contains(i))}}return r},T4=function(e){var s=e.getBoundingClientRect(),n=s.width,i=s.height;return n===0&&i===0},nI=function(e,s){var n=s.displayCheck,i=s.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var r=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!r}if(getComputedStyle(e).visibility==="hidden")return!0;var l=Ou.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(Ou.call(a,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof i=="function"){for(var c=e;e;){var d=e.parentElement,f=ih(e);if(d&&!d.shadowRoot&&i(d)===!0)return T4(e);e.assignedSlot?e=e.assignedSlot:!d&&f!==e.ownerDocument?e=f.host:e=d}e=c}if(sI(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return T4(e);return!1},iI=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var n=0;n<s.children.length;n++){var i=s.children.item(n);if(i.tagName==="LEGEND")return Ou.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},rI=function(e,s){return!(s.disabled||JD(s)||nI(s,e)||QD(s)||iI(s))},V4=function(e,s){return!(tI(s)||W7(s)<0||!rI(e,s))},oI=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},G7=function(e){var s=[],n=[];return e.forEach(function(i,r){var l=!!i.scopeParent,a=l?i.scopeParent:i,c=GD(a,l),d=l?G7(i.candidates):a;c===0?l?s.push.apply(s,d):s.push(a):n.push({documentOrder:r,tabIndex:c,item:i,isScope:l,content:d})}),n.sort(YD).reduce(function(i,r){return r.isScope?i.push.apply(i,r.content):i.push(r.content),i},[]).concat(s)},Y7=function(e,s){s=s||{};var n;return s.getShadowRoot?n=Ym([e],s.includeContainer,{filter:V4.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:oI}):n=qD(e,s.includeContainer,V4.bind(null,s)),G7(n)};function lI(){return/apple/i.test(navigator.vendor)}const A4="data-floating-ui-focusable";function aI(t){let e=t.activeElement;for(;((s=e)==null||(s=s.shadowRoot)==null?void 0:s.activeElement)!=null;){var s;e=e.shadowRoot.activeElement}return e}function Jm(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&zN(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function Ed(t){return"composedPath"in t?t.composedPath()[0]:t.target}function V1(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const s=t;return s.target!=null&&e.contains(s.target)}function cI(t){return t.matches("html,body")}function $u(t){return t?.ownerDocument||document}function dI(t){return t?t.hasAttribute(A4)?t:t.querySelector("["+A4+"]")||t:null}function Df(t,e,s){return s===void 0&&(s=!0),t.filter(i=>{var r;return i.parentId===e&&(!s||((r=i.context)==null?void 0:r.open))}).flatMap(i=>[i,...Df(t,i.id,s)])}function uI(t){return"nativeEvent"in t}var fI=typeof document<"u",hI=function(){},$l=fI?P.useLayoutEffect:hI;const mI={...p6},pI=mI.useInsertionEffect,gI=pI||(t=>t());function wc(t){const e=P.useRef(()=>{});return gI(()=>{e.current=t}),P.useCallback(function(){for(var s=arguments.length,n=new Array(s),i=0;i<s;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}const J7=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Q7(t,e){const s=Y7(t,J7()),n=s.length;if(n===0)return;const i=aI($u(t)),r=s.indexOf(i),l=r===-1?e===1?0:n-1:r+e;return s[l]}function xI(t){return Q7($u(t).body,1)||t}function bI(t){return Q7($u(t).body,-1)||t}function A1(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!Jm(s,n)}function vI(t){Y7(t,J7()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function P4(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const n=s.dataset.tabindex;delete s.dataset.tabindex,n?s.setAttribute("tabindex",n):s.removeAttribute("tabindex")})}const yI="data-floating-ui-focusable",E4="active",R4="selected",_I={...p6};let D4=!1,LI=0;const I4=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+LI++;function wI(){const[t,e]=P.useState(()=>D4?I4():void 0);return $l(()=>{t==null&&e(I4())},[]),P.useEffect(()=>{D4=!0},[]),t}const SI=_I.useId,qg=SI||wI;function kI(){const t=new Map;return{emit(e,s){var n;(n=t.get(e))==null||n.forEach(i=>i(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var n;(n=t.get(e))==null||n.delete(s)}}}const jI=P.createContext(null),CI=P.createContext(null),X7=()=>{var t;return((t=P.useContext(jI))==null?void 0:t.id)||null},Z7=()=>P.useContext(CI);function Gg(t){return"data-floating-ui-"+t}const NI={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},M4=P.forwardRef(function(e,s){const[n,i]=P.useState();$l(()=>{lI()&&i("button")},[]);const r={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[Gg("focus-guard")]:"",style:NI};return o.jsx("span",{...e,...r})}),TI={clipPath:"inset(50%)",position:"fixed",top:0,left:0},e_=P.createContext(null),O4=Gg("portal");function VI(t){t===void 0&&(t={});const{id:e,root:s}=t,n=qg(),i=PI(),[r,l]=P.useState(null),a=P.useRef(null);return $l(()=>()=>{r?.remove(),queueMicrotask(()=>{a.current=null})},[r]),$l(()=>{if(!n||a.current)return;const c=e?document.getElementById(e):null;if(!c)return;const d=document.createElement("div");d.id=n,d.setAttribute(O4,""),c.appendChild(d),a.current=d,l(d)},[e,n]),$l(()=>{if(s===null||!n||a.current)return;let c=s||i?.portalNode;c&&!qN(c)&&(c=c.current),c=c||document.body;let d=null;e&&(d=document.createElement("div"),d.id=e,c.appendChild(d));const f=document.createElement("div");f.id=n,f.setAttribute(O4,""),c=d||c,c.appendChild(f),a.current=f,l(f)},[e,s,n,i]),r}function AI(t){const{children:e,id:s,root:n,preserveTabOrder:i=!0}=t,r=VI({id:s,root:n}),[l,a]=P.useState(null),c=P.useRef(null),d=P.useRef(null),f=P.useRef(null),u=P.useRef(null),h=l?.modal,m=l?.open,p=!!l&&!l.modal&&l.open&&i&&!!(n||r);return P.useEffect(()=>{if(!r||!i||h)return;function g(x){r&&A1(x)&&(x.type==="focusin"?P4:vI)(r)}return r.addEventListener("focusin",g,!0),r.addEventListener("focusout",g,!0),()=>{r.removeEventListener("focusin",g,!0),r.removeEventListener("focusout",g,!0)}},[r,i,h]),P.useEffect(()=>{r&&(m||P4(r))},[m,r]),o.jsxs(e_.Provider,{value:P.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:f,afterInsideRef:u,portalNode:r,setFocusManagerState:a}),[i,r]),children:[p&&r&&o.jsx(M4,{"data-type":"outside",ref:c,onFocus:g=>{if(A1(g,r)){var x;(x=f.current)==null||x.focus()}else{const b=l?l.domReference:null,y=bI(b);y?.focus()}}}),p&&r&&o.jsx("span",{"aria-owns":r.id,style:TI}),r&&_n.createPortal(e,r),p&&r&&o.jsx(M4,{"data-type":"outside",ref:d,onFocus:g=>{if(A1(g,r)){var x;(x=u.current)==null||x.focus()}else{const b=l?l.domReference:null,y=xI(b);y?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const PI=()=>P.useContext(e_),EI={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},RI={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},$4=t=>{var e,s;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(s=t?.outsidePress)!=null?s:!0}};function DI(t,e){e===void 0&&(e={});const{open:s,onOpenChange:n,elements:i,dataRef:r}=t,{enabled:l=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:f=!1,referencePressEvent:u="pointerdown",ancestorScroll:h=!1,bubbles:m,capture:p}=e,g=Z7(),x=wc(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,y=P.useRef(!1),{escapeKey:L,outsidePress:v}=$4(m),{escapeKey:_,outsidePress:w}=$4(p),S=P.useRef(!1),k=wc(A=>{var E;if(!s||!l||!a||A.key!=="Escape"||S.current)return;const R=(E=r.current.floatingContext)==null?void 0:E.nodeId,I=g?Df(g.nodesRef.current,R):[];if(!L&&(A.stopPropagation(),I.length>0)){let D=!0;if(I.forEach(O=>{var z;if((z=O.context)!=null&&z.open&&!O.context.dataRef.current.__escapeKeyBubbles){D=!1;return}}),!D)return}n(!1,uI(A)?A.nativeEvent:A,"escape-key")}),j=wc(A=>{var E;const R=()=>{var I;k(A),(I=Ed(A))==null||I.removeEventListener("keydown",R)};(E=Ed(A))==null||E.addEventListener("keydown",R)}),C=wc(A=>{var E;const R=r.current.insideReactTree;r.current.insideReactTree=!1;const I=y.current;if(y.current=!1,d==="click"&&I||R||typeof b=="function"&&!b(A))return;const D=Ed(A),O="["+Gg("inert")+"]",z=$u(i.floating).querySelectorAll(O);let M=Qi(D)?D:null;for(;M&&!j1(M);){const H=HN(M);if(j1(H)||!Qi(H))break;M=H}if(z.length&&Qi(D)&&!cI(D)&&!Jm(D,i.floating)&&Array.from(z).every(H=>!Jm(M,H)))return;if(KN(D)&&V){const H=j1(D),q=WN(D),W=/auto|scroll/,G=H||W.test(q.overflowX),Y=H||W.test(q.overflowY),J=G&&D.clientWidth>0&&D.scrollWidth>D.clientWidth,se=Y&&D.clientHeight>0&&D.scrollHeight>D.clientHeight,oe=q.direction==="rtl",ne=se&&(oe?A.offsetX<=D.offsetWidth-D.clientWidth:A.offsetX>D.clientWidth),Q=J&&A.offsetY>D.clientHeight;if(ne||Q)return}const $=(E=r.current.floatingContext)==null?void 0:E.nodeId,F=g&&Df(g.nodesRef.current,$).some(H=>{var q;return V1(A,(q=H.context)==null?void 0:q.elements.floating)});if(V1(A,i.floating)||V1(A,i.domReference)||F)return;const U=g?Df(g.nodesRef.current,$):[];if(U.length>0){let H=!0;if(U.forEach(q=>{var W;if((W=q.context)!=null&&W.open&&!q.context.dataRef.current.__outsidePressBubbles){H=!1;return}}),!H)return}n(!1,A,"outside-press")}),T=wc(A=>{var E;const R=()=>{var I;C(A),(I=Ed(A))==null||I.removeEventListener(d,R)};(E=Ed(A))==null||E.addEventListener(d,R)});P.useEffect(()=>{if(!s||!l)return;r.current.__escapeKeyBubbles=L,r.current.__outsidePressBubbles=v;let A=-1;function E(z){n(!1,z,"ancestor-scroll")}function R(){window.clearTimeout(A),S.current=!0}function I(){A=window.setTimeout(()=>{S.current=!1},UN()?5:0)}const D=$u(i.floating);a&&(D.addEventListener("keydown",_?j:k,_),D.addEventListener("compositionstart",R),D.addEventListener("compositionend",I)),b&&D.addEventListener(d,w?T:C,w);let O=[];return h&&(Qi(i.domReference)&&(O=k1(i.domReference)),Qi(i.floating)&&(O=O.concat(k1(i.floating))),!Qi(i.reference)&&i.reference&&i.reference.contextElement&&(O=O.concat(k1(i.reference.contextElement)))),O=O.filter(z=>{var M;return z!==((M=D.defaultView)==null?void 0:M.visualViewport)}),O.forEach(z=>{z.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(D.removeEventListener("keydown",_?j:k,_),D.removeEventListener("compositionstart",R),D.removeEventListener("compositionend",I)),b&&D.removeEventListener(d,w?T:C,w),O.forEach(z=>{z.removeEventListener("scroll",E)}),window.clearTimeout(A)}},[r,i,a,b,d,s,n,h,l,L,v,k,_,j,C,w,T]),P.useEffect(()=>{r.current.insideReactTree=!1},[r,b,d]);const N=P.useMemo(()=>({onKeyDown:k,...f&&{[EI[u]]:A=>{n(!1,A.nativeEvent,"reference-press")},...u!=="click"&&{onClick(A){n(!1,A.nativeEvent,"reference-press")}}}}),[k,n,f,u]),V=P.useMemo(()=>{function A(E){E.button===0&&(y.current=!0)}return{onKeyDown:k,onMouseDown:A,onMouseUp:A,[RI[d]]:()=>{r.current.insideReactTree=!0}}},[k,d,r]);return P.useMemo(()=>l?{reference:N,floating:V}:{},[l,N,V])}function II(t){const{open:e=!1,onOpenChange:s,elements:n}=t,i=qg(),r=P.useRef({}),[l]=P.useState(()=>kI()),a=X7()!=null,[c,d]=P.useState(n.reference),f=wc((m,p,g)=>{r.current.openEvent=m?p:void 0,l.emit("openchange",{open:m,event:p,reason:g,nested:a}),s?.(m,p,g)}),u=P.useMemo(()=>({setPositionReference:d}),[]),h=P.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return P.useMemo(()=>({dataRef:r,open:e,onOpenChange:f,elements:h,events:l,floatingId:i,refs:u}),[e,f,h,l,i,u])}function MI(t){t===void 0&&(t={});const{nodeId:e}=t,s=II({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,i=n.elements,[r,l]=P.useState(null),[a,c]=P.useState(null),f=i?.domReference||r,u=P.useRef(null),h=Z7();$l(()=>{f&&(u.current=f)},[f]);const m=FN({...t,elements:{...i,...a&&{reference:a}}}),p=P.useCallback(L=>{const v=Qi(L)?{getBoundingClientRect:()=>L.getBoundingClientRect(),getClientRects:()=>L.getClientRects(),contextElement:L}:L;c(v),m.refs.setReference(v)},[m.refs]),g=P.useCallback(L=>{(Qi(L)||L===null)&&(u.current=L,l(L)),(Qi(m.refs.reference.current)||m.refs.reference.current===null||L!==null&&!Qi(L))&&m.refs.setReference(L)},[m.refs]),x=P.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:u}),[m.refs,g,p]),b=P.useMemo(()=>({...m.elements,domReference:f}),[m.elements,f]),y=P.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return $l(()=>{n.dataRef.current.floatingContext=y;const L=h?.nodesRef.current.find(v=>v.id===e);L&&(L.context=y)}),P.useMemo(()=>({...m,context:y,refs:x,elements:b}),[m,x,b,y])}function P1(t,e,s){const n=new Map,i=s==="item";let r=t;if(i&&t){const{[E4]:l,[R4]:a,...c}=t;r=c}return{...s==="floating"&&{tabIndex:-1,[yI]:""},...r,...e.map(l=>{const a=l?l[s]:null;return typeof a=="function"?t?a(t):null:a}).concat(t).reduce((l,a)=>(a&&Object.entries(a).forEach(c=>{let[d,f]=c;if(!(i&&[E4,R4].includes(d)))if(d.indexOf("on")===0){if(n.has(d)||n.set(d,[]),typeof f=="function"){var u;(u=n.get(d))==null||u.push(f),l[d]=function(){for(var h,m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];return(h=n.get(d))==null?void 0:h.map(x=>x(...p)).find(x=>x!==void 0)}}}else l[d]=f}),l),{})}}function OI(t){t===void 0&&(t=[]);const e=t.map(a=>a?.reference),s=t.map(a=>a?.floating),n=t.map(a=>a?.item),i=P.useCallback(a=>P1(a,t,"reference"),e),r=P.useCallback(a=>P1(a,t,"floating"),s),l=P.useCallback(a=>P1(a,t,"item"),n);return P.useMemo(()=>({getReferenceProps:i,getFloatingProps:r,getItemProps:l}),[i,r,l])}const $I=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function BI(t,e){var s,n;e===void 0&&(e={});const{open:i,elements:r,floatingId:l}=t,{enabled:a=!0,role:c="dialog"}=e,d=qg(),f=((s=r.domReference)==null?void 0:s.id)||d,u=P.useMemo(()=>{var y;return((y=dI(r.floating))==null?void 0:y.id)||l},[r.floating,l]),h=(n=$I.get(c))!=null?n:c,p=X7()!=null,g=P.useMemo(()=>h==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:i?u:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":h==="alertdialog"?"dialog":h,"aria-controls":i?u:void 0,...h==="listbox"&&{role:"combobox"},...h==="menu"&&{id:f},...h==="menu"&&p&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[h,u,p,i,f,c]),x=P.useMemo(()=>{const y={id:u,...h&&{role:h}};return h==="tooltip"||c==="label"?y:{...y,...h==="menu"&&{"aria-labelledby":f}}},[h,u,f,c]),b=P.useCallback(y=>{let{active:L,selected:v}=y;const _={role:"option",...L&&{id:u+"-fui-option"}};switch(c){case"select":case"combobox":return{..._,"aria-selected":v}}return{}},[u,c]);return P.useMemo(()=>a?{reference:g,floating:x,item:b}:{},[a,g,x,b])}function zI(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:r,startOfLine:l,$position:a}=t,c=n&&!i,d=GT(s),f=new RegExp(`\\s${d}$`),u=l?"^":"",h=i?"":d,m=c?new RegExp(`${u}${d}.*?(?=\\s${h}|$)`,"gm"):new RegExp(`${u}(?:^)?${d}[^\\s${h}]*`,"gm"),p=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!p)return null;const g=a.pos-p.length,x=Array.from(p.matchAll(m)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),y=new RegExp(`^[${r?.join("")}\0]?$`).test(b);if(r!==null&&!y)return null;const L=g+x.index;let v=L+x[0].length;return c&&f.test(p.slice(v-1,v+1))&&(x[0]+=" ",v+=1),L<a.pos&&v>=a.pos?{range:{from:L,to:v},query:x[0].slice(s.length),text:x[0]}:null}function FI(t){return t.docChanged?t.steps.some(e=>{const s=e.slice;if(!s?.content)return!1;const n=s.content.textBetween(0,s.content.size,`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-Dp1jPPnU.js","assets/index-BFUkCadY.js","assets/index-DS-wHxfn.css","assets/chat-context-BHrex6rH.js","assets/use-panel-navigate-DAN1_bgS.js","assets/use-destination-route-CghQsdF8.js","assets/thread-route-DZ4IYYBA.js","assets/dialog-EZiQKr-k.js","assets/Check-BHC3_AaF.js","assets/Copy01-CCWxdpWb.js","assets/Download01-B-85Q1ff.js","assets/constants-dLUUoWH7.js","assets/session-runtime-C-KTDVeQ.js","assets/slugify-CEUa2lfQ.js","assets/hooks-X49XWoE0.js","assets/use-mcp-client-DBxtnKrM.js","assets/auth-CLm5_F0l.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/decopilot-sse-pool-Btz5P3dg.js","assets/task-board-BsEuBpWv.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-CBOJyRo8.js","assets/use-ai-providers-BtgQbZIG.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-CeQUVSoy.js","assets/use-organization-settings-DpT8kLw9.js","assets/ChevronDown-B7_Xvf9X.js","assets/agent-icon-CY9ycwem.js","assets/AlertCircle-CV0wkmkm.js","assets/UserSquare-CujtKzAT.js","assets/Tool01-h31Lne8n.js","assets/ArrowUp-D1z7pWNj.js","assets/ArrowLeft-IJ5Bt6rF.js","assets/Tool02-CNWGQ_ok.js","assets/XCircle-DIVDWsBu.js","assets/TrendUp01-CFqXlqp7.js","assets/ZapSquare-BeFw43GM.js","assets/ZoomOut-CDRlJdUE.js","assets/Users03-Cg9bNhp7.js","assets/CheckCircle-Ck6NP4ZR.js","assets/ChevronRight-BAd6R5vM.js","assets/ChevronSelectorVertical-BuMW96nw.js","assets/ChevronUp-BwgqH970.js","assets/DotsVertical-DDZxDsoM.js","assets/Stars02-CK8VDMM0.js","assets/CreditCard01-DygKVzhJ.js","assets/Settings02-CuNh9WdQ.js","assets/Eye-CFdbtUej.js","assets/FilterLines-Dcx0EftC.js","assets/Share07-DswLt_KK.js","assets/GitBranch01-CMJwWlxW.js","assets/Globe01-qzkbgw6Z.js","assets/Globe04-D9zY4y4d.js","assets/SwitchHorizontal01-CnsWKOU4.js","assets/HardDrive-Bn4IEQJY.js","assets/Image01-D-AxQSgh.js","assets/Key01-BpVUK5pT.js","assets/LinkExternal01-BE54YHhd.js","assets/LockUnlocked01-871SLvf7.js","assets/LogOut01-CJWERaXO.js","assets/Monitor01-CsG8STIy.js","assets/Sun-B0Nzj3KW.js","assets/Package-BuYOwIZB.js","assets/Palette-BGSolCEG.js","assets/Play-CKSey6H3.js","assets/Plus-nBmz9X8R.js","assets/SearchLg-BIcfiyKV.js","assets/SearchMd-BFdtfhDn.js","assets/Shield01-BuMl41yz.js","assets/Stars01-BisNbns8.js","assets/Trash01-Dc1xlq4H.js","assets/Upload01-C9iaZjZJ.js","assets/User01-Cwj6RUTo.js","assets/Users01-CJ5UoxWH.js","assets/XClose-ehDN2GbO.js","assets/Zap-IBwSvyRi.js","assets/scroll-area-DhVLP3PL.js","assets/select-CWvBEvKe.js","assets/input-B9IgjWfA.js","assets/dropdown-menu-LJireLy5.js","assets/page-seo-form-n3Jr5UKD.js","assets/label-DkU_8hZR.js","assets/switch-C5WRym-1.js","assets/use-section-preview-base-BBcuF_Mg.js","assets/automation-runs-Fq4mNYDj.js","assets/useInfiniteQuery-DgMDXNM-.js","assets/use-infinite-scroll-CMDxuacA.js","assets/use-connection-BKvd7uNd.js","assets/table-9A7mh_ze.js","assets/empty-state-aNTsPxQg.js","assets/use-members-DaPDZRH4.js","assets/use-org-auth-client-CLWvfwor.js","assets/use-automations-wHx6KnEj.js","assets/useSuspenseInfiniteQuery-Ce9i6Dj2.js","assets/avatar-Wa6VrEnP.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-CPtc2zDl.js","assets/markdown-BG1ybiOX.js","assets/monaco-editor-DkEyyAuR.js","assets/spinner-C9VRn5KD.js","assets/editor-DSb1EWz5.js","assets/types-LyowwSS5.js","assets/shell-layout-khmxpGoo.js","assets/required-auth-layout-Dfxw0YDf.js","assets/use-org-sso-DwTAjKoT.js","assets/integration-icon-BO6Z-DRY.js","assets/use-navigate-to-agent-B-ZKJ--7.js","assets/chart-CT4bmwai.js","assets/index-7Eri-5FF.js","assets/form-DFbk408D.js","assets/file-type-icon-C1V83sRx.js","assets/drawer-BuLJB_Ng.js","assets/collection-search-Br3z0w3m.js","assets/tabs-VcTBcGpQ.js","assets/toggle-group-BHdQxqTI.js","assets/super-agent-icon-BGH3Ovdk.js","assets/self-tool-result-CecU6Ah-.js","assets/alert-dialog-BJ4wEVSQ.js","assets/extract-connection-data-H0biCpIG.js","assets/metadata-dUsYcpuu.js","assets/provision-repo-scoped-github-connection-CMPWtdMv.js","assets/use-debounced-value-DMcS7FSl.js","assets/authenticate-and-persist-oauth-CB4PlrBf.js","assets/mcp-oauth-DC5O97rk.js","assets/track-CN0o4_D1.js","assets/popover-kWquax2C.js","assets/toolbar-CRVklWRM.js","assets/github-repo-picker-BS5F3L-U.js","assets/use-mcp-tools-TLuFrkim.js","assets/agent-capabilities-B52k7xCe.js","assets/connection-card-CbmmPQd2.js","assets/use-registry-connections-2ihnJXRy.js","assets/retry-CErkP7V6.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-ClB5SMay.js","assets/connection-form-helpers-BiyQETTa.js","assets/collection-tabs-DlzEhHVW.js","assets/badge-B61gpb4G.js","assets/select-model-YQjbGnxo.js","assets/checkbox-B7WKgEsi.js","assets/ai-providers-logos-DD3qZ33J.js","assets/folder-icon-DPyDuMsa.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-BHyKjwK2.js","assets/skill-preview-Bw7bGCaH.js","assets/use-file-configs-JseEd11j.js","assets/pt-BR-CLy76QW2.js","assets/use-debounced-autosave-BjLAKNcT.js","assets/search-input-CEzUTux_.js","assets/use-mcp-auth-status-CY1yj4lV.js","assets/use-secrets-DQgK4fpK.js","assets/AreaChart-C1cHRb4_.js","assets/config-BgO9IgWA.js","assets/command-8ooWizOU.js","assets/index-CF7KjtFB.js","assets/get-initials-D-f_fDFw.js","assets/breadcrumb-BPv7fTV_.js","assets/use-tags-dgY3696p.js","assets/automation-list-row-i7POabA6.js","assets/site-error--i37Vnuw.js","assets/use-org-repo-syncs-OQj8Y5Nz.js","assets/cards-CtYnELx3.js","assets/file-explorer-CH3ShuuH.js","assets/app-editor-Cg3q49SP.js","assets/post-editor-Dw0XoUW-.js","assets/multi-select-DTZRJI8W.js","assets/block-document-Bp2k8Wc9.js","assets/primitives-BBB2PKL9.js","assets/use-autosave-WBXLWYPk.js","assets/record-editor-D8eYeCmw.js","assets/category-editor-mFpEwJXE.js","assets/bulk-category-panel-Cla8YbNK.js","assets/index-nBmHAkVz.js","assets/seo-editor-DesDFA61.js","assets/variant-calendar-CnvdiA98.js","assets/view-mode-toggle-DU9mNhqt.js","assets/post-calendar-V5YkHzT5.js","assets/alert-B_RUXka_.js","assets/redirect-editor-ZpJCTshJ.js","assets/project-app-view-CMOtQWit.js"])))=>i.map(i=>d[i]);
2
+ import{p as ps,r as P,ai as IN,aj as MN,ak as Et,al as Cs,am as ki,an as Re,ao as xr,ap as Cu,aq as ON,ar as Li,as as $N,at as Dm,au as h6,c as B,H as Fe,n as ie,j as o,E as Us,b as re,t as xe,aa as Jr,a5 as fl,a8 as Ke,a9 as We,ab as qe,av as Ds,I as D2,B as ue,aw as I2,ax as m6,x as br,ay as js,az as El,aA as n4,d as Ws,ac as ws,e as Rs,q as Ye,aB as BN,D as so,aC as zN,aD as p6,aE as FN,aF as Qi,aG as k1,aH as _n,aI as UN,aJ as j1,aK as HN,aL as KN,aM as WN,aN as qN,aO as M2,aP as O2,aQ as g6,aR as $2,z as Gh,K as Je,aS as GN,aT as YN,aU as JN,aV as x6,aW as du,o as Tt,k as ot,a as Nn,C as Zu,aX as Nu,m as QN,u as hl,f as no,R as Yh,aY as B2,aZ as XN,a_ as H0,a$ as b6,b0 as Im,b1 as v6,b2 as y6,b3 as _6,b4 as ZN,b5 as eT,L as tT,a3 as L6,b6 as sT,b7 as Jf,b8 as Rl,Y as At,b9 as w6,ba as S6,bb as Dn,P as wi,bc as Nt,s as k6,bd as j6,be as nT,bf as C6,bg as N6,bh as T6,bi as V6,bj as A6,bk as P6,bl as E6,bm as R6,bn as D6,bo as I6,bp as xn,N as ri,bq as iT,br as M6,bs as rT,bt as oT,bu as O6,bv as lT,bw as aT,bx as cT,by as dT,bz as uT,bA as fT,bB as $6,bC as hT,bD as mT,bE as pT,bF as gT,bG as xT,bH as bT,bI as vT,bJ as yT,bK as _T,bL as LT,bM as wT,bN as ST,ah as kT}from"./index-BFUkCadY.js";import{i as Jh,n as jT}from"./ArrowUp-D1z7pWNj.js";import{u as la,a as ui,b as As,c as sn,d as B6,s as CT,e as NT,f as TT,g as VT,h as AT,i as PT,j as ET,k as z2,l as z6,T as RT,A as DT,m as IT,n as MT,t as OT,o as $T,p as BT,q as zT}from"./chat-context-BHrex6rH.js";import{c as Qh,s as id,g as rr,P as Tu,d as F2,t as Ul,a as FT,M as UT,i as HT,b as ji,e as rd,f as KT,D as WT,h as qT,j as GT,k as zc,l as YT,m as JT,u as Xh,E as QT,n as e0,o as XT,F as ZT,p as Zh,q as e9,r as F6,S as eV,v as tV,w as sV,x as nV,y as i4,z as iV,A as U6,O as rV,B as r4,C as Zi,G as oV,T as Ur,H as lV,I as or,J as $o,K as Mm,L as Om,N as H6,Q as aV,R as K6,U as cV,V as fi,W as dV,X as uV,Y as W6,Z as Dr,_ as fV,$ as hV,a0 as q6,a1 as Tl,a2 as o4,a3 as mV,a4 as pV,a5 as l4,a6 as gV,a7 as Vu,a8 as aa,a9 as ur,aa as Qf,ab as U2,ac as H2,ad as xV,ae as bV,af as vV,ag as yV,ah as _V,ai as LV,aj as wV,ak as t9,al as G6,am as Y6,an as J6,ao as SV,ap as Q6,aq as kV,ar as jV,as as CV,at as NV,au as t0,av as TV,aw as VV,ax as AV,ay as PV}from"./automation-runs-Fq4mNYDj.js";import{S as Fc}from"./spinner-C9VRn5KD.js";import{a as hs,b as Yt,d as Ut,e as Ht,h as kn,c as Wn,i as EV}from"./dialog-EZiQKr-k.js";import{c as RV,b as s9,a as n9,D as i9,d as X6,e as DV,f as IV}from"./drawer-BuLJB_Ng.js";import{C as MV}from"./collection-search-Br3z0w3m.js";import{u as Jt,a as OV,m as $V}from"./use-mcp-client-DBxtnKrM.js";import{a as ca,i as Xf,S as ml,b as BV,g as Zf,c as Z6,d as a4,R as zV,e as FV,W as UV,C as HV}from"./constants-dLUUoWH7.js";import{u as e8,g as s0,l as $m,C as KV,a as WV,b as qV}from"./chart-CT4bmwai.js";import{t as Qt}from"./ChevronDown-B7_Xvf9X.js";import{t as GV,z as YV,a as od,u as K2,b as W2,c as r9}from"./hooks-X49XWoE0.js";import{K as JV,i as t8,u as pl,a as s8,m as QV,f as XV}from"./shell-layout-khmxpGoo.js";import{a as Is,u as da,b as q2,c as ZV}from"./use-virtual-mcp-CBOJyRo8.js";import{w as n8,A as eA,c as tA,b as o9,d as sA,r as nA,e as iA}from"./thread-route-DZ4IYYBA.js";import{r as i8,d as G2,a as Y2,p as rA,b as oA,s as lA}from"./session-runtime-C-KTDVeQ.js";import{i as gl,b as J2,a as aA}from"./XCircle-DIVDWsBu.js";import{f as r8,g as Q2,h as ua,j as o8,n as l8,A as ci,k as a8,l as Uc,s as Hl,m as c8,o as fa,p as cA,q as dA,c as d8,r as Bm,u as ld,v as uA,w as u8,d as fA,x as l9,y as ha,z as hA,B as X2,C as f8,D as h8,E as zm,F as C1,G as c4,H as a9,I as mA,J as pA,K as gA,L as xA,M as bA,N as Z2,O as m8,P as qn,Q as eg,R as tg,S as n0,T as lr,U as c9,V as d9,W as p8,X as g8,Y as x8,Z as vA,_ as sg,$ as yA,a0 as d4,a1 as _A,a2 as LA,t as b8,a3 as Ho,a4 as i0,a5 as wA,i as u9,a6 as SA,a7 as kA,a8 as jA,a9 as CA,aa as NA,ab as TA,ac as Ko,ad as u4,ae as v8,af as VA,ag as AA,ah as PA,ai as Hc,aj as ng,ak as EA,al as f4,am as RA,an as DA,ao as IA,ap as y8,aq as MA,ar as OA,as as $A,at as BA,au as zA,av as FA,aw as UA,ax as HA,ay as _8,az as L8,aA as KA,aB as WA,aC as qA,aD as GA,aE as YA,aF as JA}from"./agent-icon-CY9ycwem.js";import{i as Ft}from"./Check-BHC3_AaF.js";import{a as fr}from"./Image01-D-AxQSgh.js";import{i as Gn}from"./Upload01-C9iaZjZJ.js";import{i as pn}from"./AlertCircle-CV0wkmkm.js";import{a as an}from"./Copy01-CCWxdpWb.js";import{F as Fm,a as ig,b as rg,c as og,d as w8}from"./form-DFbk408D.js";import{d as Rt,S as ys,a as _s,b as Ns,c as Ls}from"./select-CWvBEvKe.js";import{t as f9,a as lg,i as h9,b as ag,c as QA,d as XA,e as ZA}from"./UserSquare-CujtKzAT.js";import{i as m9}from"./ArrowLeft-IJ5Bt6rF.js";import{T as Ol,a as ad,b as ar,c as r0}from"./tabs-VcTBcGpQ.js";import{t as Um}from"./Tool02-CNWGQ_ok.js";import{T as p9,a as Kc}from"./toggle-group-BHdQxqTI.js";import{I as mt}from"./input-B9IgjWfA.js";import{u as cg,b as dg,f as S8,g as eP,c as tP,p as h4,S as oi,t as ug,C as fg,a as sP,h as nP,N as iP}from"./super-agent-icon-BGH3Ovdk.js";import{u as k8,M as rP,a as oP,m as g9,i as lP,g as j8,b as aP,N as cP,c as dP}from"./select-model-YQjbGnxo.js";import{s as Ci}from"./XClose-ehDN2GbO.js";import{a as ns,b as is,P as rs,c as uP}from"./popover-kWquax2C.js";import{t as Wr}from"./Stars01-BisNbns8.js";import{b as fP,a as x9,c as C8,d as N8,u as b9,e as T8}from"./use-organization-settings-DpT8kLw9.js";import{u as v9,a as hP}from"./use-ai-providers-BtgQbZIG.js";import{g as hg,c as cd,d as V8,a as Zs,r as mg,f as mP,e as pP}from"./agent-capabilities-B52k7xCe.js";import{f as gP,a as xP,u as Au,b as o0,c as A8,d as bP,e as pg,g as P8,h as gg,i as vP,j as xg,k as Pu,l as E8,m as yP,n as R8,o as _P}from"./folder-icon-DPyDuMsa.js";import{c as $t,D as Bt,b as zt,a as Xe,d as er,e as tr,f as sr,g as Wc,h as Kn,i as qr,j as Pd}from"./dropdown-menu-LJireLy5.js";import{s as Kt}from"./Plus-nBmz9X8R.js";import{p as LP,q as wP}from"./question-004-sINsf4GQ.js";import{A as Ts}from"./avatar-Wa6VrEnP.js";import{u as D8,a as l0}from"./use-members-DaPDZRH4.js";import{i as en}from"./ChevronRight-BAd6R5vM.js";import{u as dd}from"./use-is-desktop-app-BNujXJc_.js";import{u as hi,a as bg}from"./use-panel-navigate-DAN1_bgS.js";import{i as mi}from"./CheckCircle-Ck6NP4ZR.js";import{I as Ei}from"./integration-icon-BO6Z-DRY.js";import{f as I8}from"./use-navigate-to-agent-B-ZKJ--7.js";import{e as a0}from"./backoff-CrEUbyZT.js";import{u as SP}from"./use-status-sounds-BHyKjwK2.js";import{E as Qo}from"./empty-state-aNTsPxQg.js";import{T as Bo,a as kP}from"./toolbar-CRVklWRM.js";import{b as M8,n as O8}from"./ZapSquare-BeFw43GM.js";import{i as Xo,a as jP}from"./Share07-DswLt_KK.js";import{i as Mn}from"./Globe01-qzkbgw6Z.js";import{i as CP}from"./Monitor01-CsG8STIy.js";import{u as di,a as vg,b as yg}from"./use-connection-BKvd7uNd.js";import{u as $8,a as _g,b as B8}from"./use-mcp-tools-TLuFrkim.js";import{g as y9,M as NP}from"./types-LyowwSS5.js";import{d as Lg,s as TP,g as VP,a as AP,F as z8,b as F8,f as U8,S as H8,c as PP}from"./skill-preview-Bw7bGCaH.js";import{F as Zo}from"./file-type-icon-C1V83sRx.js";import{i as Qr}from"./ZoomOut-CDRlJdUE.js";import{i as Si}from"./GitBranch01-CMJwWlxW.js";import{a as wg}from"./Package-BuYOwIZB.js";import{u as Sg,a as K8}from"./use-file-configs-JseEd11j.js";import{n as Eu}from"./Download01-B-85Q1ff.js";import{n as hn}from"./LinkExternal01-BE54YHhd.js";import{D as Cc}from"./use-destination-route-CghQsdF8.js";import{i as _9}from"./Key01-BpVUK5pT.js";import{p as kg,b as rn,s as qc,H as Ru,h as Du,a as mc,c as W8,d as q8}from"./location-oTTXFrSF.js";import{m as EP,a as RP,M as ud,b as DP,O as IP}from"./markdown-BG1ybiOX.js";import{p as MP,f as OP}from"./pt-BR-CLy76QW2.js";import{g as $P,e as BP}from"./extract-connection-data-H0biCpIG.js";import{a as zP,i as m4}from"./mcp-oauth-DC5O97rk.js";import{A as el,a as tl,b as sl,c as nl,d as il,e as rl,f as ol,g as ll}from"./alert-dialog-BJ4wEVSQ.js";import{T as Xr}from"./textarea-ClB5SMay.js";import{i as Kl}from"./Play-CKSey6H3.js";import{s as tn}from"./Trash01-Dc1xlq4H.js";import{u as eh}from"./use-debounced-autosave-BjLAKNcT.js";import{S as xl}from"./scroll-area-DhVLP3PL.js";import{i as Iu}from"./SearchMd-BFdtfhDn.js";import{C as fd}from"./checkbox-B7WKgEsi.js";import{S as L9}from"./search-input-CEzUTux_.js";import{C as G8}from"./collection-tabs-DlzEhHVW.js";import{T as Y8,u as J8}from"./use-mcp-auth-status-CY1yj4lV.js";import{n as FP}from"./LockUnlocked01-871SLvf7.js";import{g as UP}from"./connection-slug-CITJ0kGN.js";import{a as Q8,i as HP}from"./Settings02-CuNh9WdQ.js";import{L as Mt}from"./label-DkU_8hZR.js";import{S as hr}from"./switch-C5WRym-1.js";import{s as X8}from"./slugify-CEUa2lfQ.js";import{d as hd}from"./delay-CnY5UFtP.js";import{G as jn,a as jg,u as KP}from"./github-repo-picker-BS5F3L-U.js";import{s as th}from"./User01-Cwj6RUTo.js";import{t as Cg}from"./Users01-CJ5UoxWH.js";import{u as Z8,a as e7}from"./use-secrets-DQgK4fpK.js";import{a as ma}from"./format-time-BnbuEtat.js";import{c as Ng,s as c0,b as WP}from"./TrendUp01-CFqXlqp7.js";import{f as t7,g as qP,l as s7,a as GP}from"./provision-repo-scoped-github-connection-CMPWtdMv.js";import{a as YP}from"./authenticate-and-persist-oauth-CB4PlrBf.js";import{X as JP,A as QP,a as XP}from"./AreaChart-C1cHRb4_.js";import{P as ln,a as d0,t as Wl,f as n7,u as i7,b as Tg,s as r7,l as sh,c as Mu,m as o7,T as zo,d as l7,i as ZP,e as eE,g as tE,S as sE,h as a7,j as c7,r as d7,k as nE,n as iE,o as rE,p as oE,q as lE,L as Hm,v as p4,w as aE,H as cE,x as dE}from"./config-BgO9IgWA.js";import{C as On,a as Cn,b as Wt,c as fs,d as $n,e as Yn,f as uE,g as g4}from"./command-8ooWizOU.js";import{i as w9}from"./FilterLines-Dcx0EftC.js";import{g as mn}from"./get-initials-D-f_fDFw.js";import{S as ls,R as fE,a as hE,D as mE,i as u7,n as pE,b as gE}from"./task-board-BsEuBpWv.js";import{B as xE,a as bE,b as x4,c as vE,d as yE,e as _E}from"./breadcrumb-BPv7fTV_.js";import{u as N1}from"./use-copy-CPtc2zDl.js";import{i as Vg,c as f7}from"./SwitchHorizontal01-CnsWKOU4.js";import{u as LE}from"./use-org-auth-client-CLWvfwor.js";import{u as Ag,a as wE,b as SE}from"./use-tags-dgY3696p.js";import{i as S9}from"./ChevronSelectorVertical-BuMW96nw.js";import{w as b4}from"./editor-DSb1EWz5.js";import{i as k9}from"./SearchLg-BIcfiyKV.js";import{u as Km,a as kE,c as jE,p as h7,b as CE,s as Wm,n as NE}from"./self-tool-result-CecU6Ah-.js";import{M as md}from"./monaco-editor-DkEyyAuR.js";import{i as TE,a as Pg,b as Eg}from"./Tool01-h31Lne8n.js";import{a as qm}from"./Palette-BGSolCEG.js";import{s as u0}from"./Eye-CFdbtUej.js";import{i as Rg}from"./DotsVertical-DDZxDsoM.js";import{u as j9}from"./use-debounced-value-DMcS7FSl.js";import{u as m7}from"./useInfiniteQuery-DgMDXNM-.js";import{i as mr}from"./Zap-IBwSvyRi.js";import{B as VE}from"./badge-B61gpb4G.js";import{u as f0,a as AE,b as PE,c as EE,d as RE}from"./use-automations-wHx6KnEj.js";import{s as uu,n as DE}from"./Stars02-CK8VDMM0.js";import{A as IE}from"./automation-list-row-i7POabA6.js";import{t as ME}from"./site-error--i37Vnuw.js";import{u as OE,a as $E}from"./use-org-repo-syncs-OQj8Y5Nz.js";import{n as p7}from"./ChevronUp-BwgqH970.js";import{f as BE,p as zE,g as FE,u as UE,e as HE,F as h0,t as g7,S as KE,B as WE,a as x7,R as qE}from"./cards-CtYnELx3.js";function b7(t,e){const s=ps(e);return GE({filters:{...t,status:"pending"}},s).length}function v4(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function GE(t={},e){const s=ps(e).getMutationCache(),n=P.useRef(t),i=P.useRef(null);return i.current===null&&(i.current=v4(s,t)),P.useEffect(()=>{n.current=t}),P.useSyncExternalStore(P.useCallback(r=>s.subscribe(()=>{const l=IN(i.current,v4(s,n.current));i.current!==l&&(i.current=l,MN.schedule(r))}),[s]),()=>i.current,()=>i.current)}const Qd=Et({connection_id:Re().describe("Connection ID"),selected_tools:Cs(Re()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:Cs(Re()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:Cs(Re()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),v7=Qd.extend({selected_tools:Qd.shape.selected_tools.optional(),selected_resources:Qd.shape.selected_resources.optional(),selected_prompts:Qd.shape.selected_prompts.optional()}),YE=Et({connectionId:Re(),toolName:Re(),label:Re(),icon:Re().nullable().optional()}),JE=Et({id:Re().describe("Stable id; used as React key and ?tab= value"),title:Re().describe("Tab label"),icon:Re().optional().describe("Optional lucide icon name"),view:Et({type:Dm("ext-app"),appId:Re(),args:Cu(Re(),h6()).optional()})}),y7=xr(["off","manual","auto"]),QE=Et({defaultMainView:Et({type:Re(),id:Re().optional(),toolName:Re().optional()}).nullable().optional(),chatDefaultOpen:ki().nullable().optional(),cmsDefaultOpen:ki().nullable().optional(),cms:y7.nullable().optional().describe("How this agent offers content editing. Absent falls back to cmsDefaultOpen."),tabs:Cs(JE).optional()});function m0(t){return t?.cms?t.cms:t?.cmsDefaultOpen?"auto":"manual"}function XE(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"preview"}}:{}}}const y4=Et({tileId:Re().optional(),connectionId:Re().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:Re().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:Re().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:Cu(Re(),h6()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:Li().int().positive().optional(),maxHeight:Li().int().positive().optional()}),Dg=Et({banner:Re().nullable().optional(),bannerColor:Re().nullable().optional(),icon:Re().nullable().optional(),themeColor:Re().nullable().optional(),pinnedViews:Cs(YE).nullable().optional(),layout:QE.nullable().optional(),homeTile:y4.nullable().optional(),homeTiles:Cs(y4).nullable().optional(),homePrompts:Cs(Re()).nullable().optional()});function Gc(t){const e=t?.homeTiles;if(Array.isArray(e)&&e.length>0)return e;const s=t?.homeTile;return s?[s]:[]}const p0=/^[A-Za-z_][A-Za-z0-9_]*$/,_4=Re().min(1).regex(p0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),ZE=$N("kind",[Et({key:_4,kind:Dm("literal"),value:Re()}),Et({key:_4,kind:Dm("secret"),secretId:Re().min(1)})]),Ig=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,eR=Et({host:Re().min(1).regex(Ig).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:Re().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),Mg=Et({selected:Re().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:Re().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:Re().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:Cs(ZE).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:Cs(eR).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),Og=Et({url:Re().describe("GitHub repository URL"),owner:Re().describe("Repository owner"),name:Re().describe("Repository name"),installationId:Li().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:Re().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),tR=xr(["agent-sandbox","local-api"]),sR={sandboxHandle:Re().describe("Provider-specific handle"),previewUrl:Re().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:Re().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:Li().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:Et({packageManager:Re().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:Re().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:Re().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},_7=Et(sR);function nR(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,s={};for(const[n,i]of Object.entries(e))if(!(!i||typeof i!="object")&&!(n!=="agent-sandbox"&&n!=="local-api"))try{s[n]=_7.parse(i)}catch{}return s}const iR=Cu(Re().describe("userId"),Cu(Re().describe("branch"),ON(tR,_7))),rR=Et({id:Re().describe("Stable identifier for this knowledge file"),name:Re().describe("File name shown in the UI"),kind:xr(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:Re().describe("Org filesystem (Library) volume the file lives in"),path:Re().describe("Path within the volume"),url:Re().describe("Same-origin URL to read the file (display/download)"),contentType:Re().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:Li().nullable().optional().describe("File size in bytes"),addedAt:Re().describe("ISO timestamp when the file was attached")}),$g=Cs(rR).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),oR=xr(["smart","code-review","open"]),Bg=oR.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),zg=ki().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),Fg=ki().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),Ug=Re().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),lR=Et({id:Re().describe("Unique identifier"),title:Re().describe("Human-readable name"),description:Re().nullable().describe("Description"),icon:Re().nullable().describe("Icon URL"),created_at:Re().describe("Creation timestamp"),updated_at:Re().describe("Last update timestamp"),created_by:Re().describe("User ID who created this item"),updated_by:Re().optional().describe("User ID who last updated this item"),organization_id:Re().describe("Organization ID this item belongs to"),status:xr(["active","inactive"]).describe("Current status"),pinned:ki().describe("Whether this space is pinned to the sidebar"),metadata:Et({instructions:Re().nullable().describe("Instructions also used as system prompt"),enabled_plugins:Cs(Re()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:Cs(Re()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Re().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Dg.nullable().optional().describe("UI customization settings"),githubRepo:Og.nullable().optional().describe("Linked GitHub repository"),runtime:Mg.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:iR.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }"),knowledge:$g,siteSlug:Re().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:Bg,previewServerUrl:Ug,productionUrl:Re().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:ki().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:zg,fastPreviewInPlace:Fg}).loose().describe("Metadata"),connections:Cs(Qd).describe("Connections with their selected tools, resources, and prompts")}),L7=Et({title:Re().min(1).max(120).describe("Short label shown on the chip"),description:Re().max(280).optional().describe("One-line subtitle shown under the title"),text:Re().min(1).describe("The message sent to the agent when the prompt is clicked")});Et({title:Re().min(1).max(255).describe("Name for the virtual MCP"),description:Re().nullable().optional().describe("Optional description"),icon:Re().nullish().describe("Optional icon URL"),status:xr(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:ki().optional().default(!1).describe("Pin to sidebar"),metadata:Et({instructions:Re().nullable().optional().describe("MCP server instructions"),enabled_plugins:Cs(Re()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:Cs(Re()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Re().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Dg.nullable().optional().describe("UI customization settings"),githubRepo:Og.nullable().optional().describe("Linked GitHub repository"),runtime:Mg.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:$g,siteSlug:Re().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:Bg,previewServerUrl:Ug,productionUrl:Re().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:ki().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:zg,fastPreviewInPlace:Fg}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:Cs(v7).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:Cs(L7).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});Et({title:Re().min(1).max(255).optional().describe("New name"),description:Re().nullable().optional().describe("New description (null to clear)"),icon:Re().nullish().describe("New icon URL"),status:xr(["active","inactive"]).optional().describe("New status"),pinned:ki().optional().describe("Pin/unpin from sidebar"),metadata:Et({instructions:Re().nullable().optional().describe("MCP server instructions"),enabled_plugins:Cs(Re()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:Cs(Re()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Re().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Dg.nullable().optional().describe("UI customization settings"),githubRepo:Og.nullable().optional().describe("Linked GitHub repository"),runtime:Mg.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:$g,siteSlug:Re().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:Bg,previewServerUrl:Ug,productionUrl:Re().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:ki().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:zg,fastPreviewInPlace:Fg}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:Cs(v7).optional().describe("New connections (replaces existing)"),prompts:Cs(L7).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});const L4=3,w7="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",aR="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function S7(t){const e=B.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:r,variant:l}=t,a=l===void 0?"pill":l,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const S=rr(c._meta);d=c.title??F2(c.name,S),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const f=d,u=c.description||null;if(a==="card"){let S;e[4]!==n||e[5]!==c?(S=()=>n(c),e[4]=n,e[5]=c,e[6]=S):S=e[6];const k=r||i,j=i&&"bg-accent/40",C=(r||i)&&"cursor-not-allowed opacity-50";let T;e[7]!==j||e[8]!==C?(T=ie(aR,"hover:bg-accent/60 text-foreground",j,C),e[7]=j,e[8]=C,e[9]=T):T=e[9];let N;e[10]!==f?(N=o.jsx("span",{className:"font-medium truncate capitalize",children:f}),e[10]=f,e[11]=N):N=e[11];let V;e[12]!==i?(V=i&&o.jsx(Fc,{size:"xs"}),e[12]=i,e[13]=V):V=e[13];let A;e[14]!==N||e[15]!==V?(A=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[N,V]}),e[14]=N,e[15]=V,e[16]=A):A=e[16];let E;e[17]!==u?(E=u&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:u}),e[17]=u,e[18]=E):E=e[18];let R;return e[19]!==A||e[20]!==E||e[21]!==S||e[22]!==k||e[23]!==T?(R=o.jsxs("button",{type:"button",onClick:S,disabled:k,className:T,children:[A,E]}),e[19]=A,e[20]=E,e[21]=S,e[22]=k,e[23]=T,e[24]=R):R=e[24],R}let h;e[25]!==n||e[26]!==c?(h=()=>n(c),e[25]=n,e[26]=c,e[27]=h):h=e[27];const m=r||i,p=i&&"bg-muted/50",g=(r||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=ie(w7,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==f?(b=o.jsx("span",{className:"capitalize",children:f}),e[31]=f,e[32]=b):b=e[32];let y;e[33]!==i?(y=i&&o.jsx(Fc,{size:"xs"}),e[33]=i,e[34]=y):y=e[34];let L;e[35]!==h||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==y?(L=o.jsx(Ke,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:h,disabled:m,className:x,children:[b,y]})}),e[35]=h,e[36]=m,e[37]=x,e[38]=b,e[39]=y,e[40]=L):L=e[40];const v=u??f;let _;e[41]!==v?(_=o.jsx(We,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:v})}),e[41]=v,e[42]=_):_=e[42];let w;return e[43]!==L||e[44]!==_?(w=o.jsxs(qe,{delayDuration:400,children:[L,_]}),e[43]=L,e[44]=_,e[45]=w):w=e[45],w}function cR(t){const e=B.c(61),{items:s,open:n,onOpenChange:i,onSelect:r,loadingPrompt:l}=t,a=re(),[c,d]=P.useState(""),f=!!l;let u;e[0]!==s||e[1]!==c?(u=c.trim()?s.filter(N=>{const V=c.toLowerCase();return N.prompt.name.toLowerCase().includes(V)||(N.prompt.title??"").toLowerCase().includes(V)||(N.prompt.description??"").toLowerCase().includes(V)}):s,e[0]=s,e[1]=c,e[2]=u):u=e[2];const h=u,m=fl();let p;e[3]!==h.length||e[4]!==c||e[5]!==a?(p=h.length===0&&o.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:a("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=h.length,e[4]=c,e[5]=a,e[6]=p):p=e[6];let g;if(e[7]!==h||e[8]!==f||e[9]!==l?.name||e[10]!==i||e[11]!==r){let N;e[13]!==f||e[14]!==l?.name||e[15]!==i||e[16]!==r?(N=V=>o.jsx(S7,{item:V,variant:"card",onSelect:A=>{i(!1),r(A)},isLoading:l?.name===V.prompt.name,isDisabled:f&&l?.name!==V.prompt.name},V.prompt.name),e[13]=f,e[14]=l?.name,e[15]=i,e[16]=r,e[17]=N):N=e[17],g=h.map(N),e[7]=h,e[8]=f,e[9]=l?.name,e[10]=i,e[11]=r,e[12]=g}else g=e[12];let x;e[18]!==p||e[19]!==g?(x=o.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[p,g]})}),e[18]=p,e[19]=g,e[20]=x):x=e[20];const b=x;let y;e[21]!==a?(y=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=y):y=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=N=>{N.key==="Escape"&&d("")},e[23]=L):L=e[23];let v;e[24]!==c||e[25]!==y?(v=o.jsx(MV,{value:c,onChange:d,placeholder:y,onKeyDown:L}),e[24]=c,e[25]=y,e[26]=v):v=e[26];const _=v;if(m){let N;e[27]!==a?(N=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=N):N=e[28];let V;e[29]!==N?(V=o.jsx(RV,{className:"sr-only",children:o.jsx(s9,{children:N})}),e[29]=N,e[30]=V):V=e[30];let A;e[31]!==a?(A=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=A):A=e[32];let E;e[33]!==A?(E=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:A})}),e[33]=A,e[34]=E):E=e[34];let R;e[35]!==b||e[36]!==_||e[37]!==E||e[38]!==V?(R=o.jsxs(n9,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[V,E,_,b]}),e[35]=b,e[36]=_,e[37]=E,e[38]=V,e[39]=R):R=e[39];let I;return e[40]!==i||e[41]!==n||e[42]!==R?(I=o.jsx(Jr,{delayDuration:400,children:o.jsx(i9,{open:n,onOpenChange:i,children:R})}),e[40]=i,e[41]=n,e[42]=R,e[43]=I):I=e[43],I}let w;e[44]!==a?(w=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=w):w=e[45];let S;e[46]!==w?(S=o.jsx(hs,{className:"sr-only",children:o.jsx(Yt,{children:w})}),e[46]=w,e[47]=S):S=e[47];let k;e[48]!==a?(k=a("chat.iceBreakers.promptsLabel"),e[48]=a,e[49]=k):k=e[49];let j;e[50]!==k?(j=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:k})}),e[50]=k,e[51]=j):j=e[51];let C;e[52]!==b||e[53]!==_||e[54]!==j||e[55]!==S?(C=o.jsxs(Ut,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,j,_,b]}),e[52]=b,e[53]=_,e[54]=j,e[55]=S,e[56]=C):C=e[56];let T;return e[57]!==i||e[58]!==n||e[59]!==C?(T=o.jsx(Jr,{delayDuration:400,children:o.jsx(Ht,{open:n,onOpenChange:i,children:C})}),e[57]=i,e[58]=n,e[59]=C,e[60]=T):T=e[60],T}function dR(t){const e=B.c(30),{items:s,onSelect:n,loadingPrompt:i,className:r}=t,l=re(),[a,c]=P.useState(!1);if(s.length===0)return null;let d,f,u,h,m;if(e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,L4),y=s.slice(L4),L=!!i;let v;e[10]!==L||e[11]!==i?.name||e[12]!==n?(v=w=>o.jsx(S7,{item:w,onSelect:n,isLoading:i?.name===w.prompt.name,isDisabled:L&&i?.name!==w.prompt.name},w.prompt.name),e[10]=L,e[11]=i?.name,e[12]=n,e[13]=v):v=e[13];const _=b.map(v);d=Jr,m=400,e[14]!==r?(f=ie("w-full flex flex-wrap gap-2 justify-center",r),e[14]=r,e[15]=f):f=e[15],u=_,h=y.length>0&&o.jsx("button",{type:"button",disabled:L,onClick:()=>c(!0),className:ie(w7,"hover:bg-muted/70 hover:text-foreground",L&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:y.length})}),e[0]=r,e[1]=s,e[2]=i,e[3]=n,e[4]=l,e[5]=d,e[6]=f,e[7]=u,e[8]=h,e[9]=m}else d=e[5],f=e[6],u=e[7],h=e[8],m=e[9];let p;e[16]!==f||e[17]!==u||e[18]!==h?(p=o.jsxs("div",{className:f,children:[u,h]}),e[16]=f,e[17]=u,e[18]=h,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=o.jsx(cR,{items:s,open:a,onOpenChange:c,onSelect:n,loadingPrompt:i}),e[20]=s,e[21]=i,e[22]=a,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==m||e[27]!==p||e[28]!==g?(x=o.jsxs(d,{delayDuration:m,children:[p,g]}),e[25]=d,e[26]=m,e[27]=p,e[28]=g,e[29]=x):x=e[29],x}function uR(){return null}function fR(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function hR(t){const e=B.c(31),{connectionId:s}=t,n=re(),{sendMessage:i}=ui(),{org:r}=Fe();let l;e[0]!==s||e[1]!==r.id||e[2]!==r.slug?(l={connectionId:s,orgId:r.id,orgSlug:r.slug},e[0]=s,e[1]=r.id,e[2]=r.slug,e[3]=l):l=e[3];const a=Jt(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=e8(c);let f;e[6]!==d?.prompts?(f=d?.prompts??[],e[6]=d?.prompts,e[7]=f):f=e[7];const u=f;let h;e[8]!==u?(h=u.map(mR),e[8]=u,e[9]=h):h=e[9];const m=h;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=P.useReducer(fR,p),[b,y]=P.useState(null);let L;e[11]!==a||e[12]!==i||e[13]!==n?(L=async(A,E)=>{if(!a){xe.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const R=await s0(a,A.name,E);x({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[Qh({id:A.name,name:id(A.name,rr(A._meta)),metadata:R.messages,char:"/",kind:"prompt",args:E}),{type:"text",text:" "}]}]};await i(I)}catch(R){console.error("[ice-breakers] Failed to fetch prompt:",R),xe.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=L):L=e[14];const v=L;let _;e[15]!==v?(_=async A=>{if(A.arguments&&A.arguments.length>0){x({type:"SELECT_PROMPT",prompt:A}),y(A);return}x({type:"START_LOADING",prompt:A}),await v(A)},e[15]=v,e[16]=_):_=e[16];const w=_;let S;e[17]!==b||e[18]!==v?(S=async A=>{b&&(x({type:"START_LOADING",prompt:b,arguments:A}),y(null),await v(b,A))},e[17]=b,e[18]=v,e[19]=S):S=e[19];const k=S;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let C;e[20]!==w||e[21]!==m||e[22]!==j?(C=o.jsx(dR,{items:m,onSelect:w,loadingPrompt:j}),e[20]=w,e[21]=m,e[22]=j,e[23]=C):C=e[23];let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{y(null),x({type:"RESET"})},e[24]=T):T=e[24];let N;e[25]!==b||e[26]!==k?(N=o.jsx(Tu,{prompt:b,setPrompt:T,onSubmit:k}),e[25]=b,e[26]=k,e[27]=N):N=e[27];let V;return e[28]!==C||e[29]!==N?(V=o.jsxs(o.Fragment,{children:[C,N]}),e[28]=C,e[29]=N,e[30]=V):V=e[30],V}function mR(t){return{prompt:t}}function pR(t){const e=B.c(13),{className:s}=t,{selectedVirtualMcp:n}=la(),{org:i}=Fe();let r;e[0]!==i.id?(r=ca(i.id),e[0]=i.id,e[1]=r):r=e[1];const l=r.id,a=n?.id??l;let c;e[2]!==s?(c=ie("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=a??"default";let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(uR,{}),e[4]=f):f=e[4];let u;e[5]!==a?(u=o.jsx(hR,{connectionId:a}),e[5]=a,e[6]=u):u=e[6];let h;e[7]!==d||e[8]!==u?(h=o.jsx(Us,{fallback:null,children:o.jsx(P.Suspense,{fallback:f,children:u},d)}),e[7]=d,e[8]=u,e[9]=h):h=e[9];let m;return e[10]!==c||e[11]!==h?(m=o.jsx("div",{className:c,children:h}),e[10]=c,e[11]=h,e[12]=m):m=e[12],m}const T1="cubic-bezier(0.645, 0.045, 0.355, 1)",gR=44,xR={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-warning/5 after:pointer-events-none after:-z-10"},bR={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},vR={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function al(t){const e=B.c(69),{icon:s,label:n,count:i,title:r,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:f,onClose:u}=t,h=f===void 0?"default":f,m=re(),[p,g]=P.useState(d),[x,b]=P.useState(!1);let y;e[0]!==u?(y=()=>{b(!0),u?.()},e[0]=u,e[1]=y):y=e[1];const L=y;if(x)return null;const v=bR[h],_=xR[h];let w;e[2]!==v||e[3]!==_?(w=ie("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,_),e[2]=v,e[3]=_,e[4]=w):w=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g(yR),e[5]=S):S=e[5];const k=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let C;e[6]!==k||e[7]!==j?(C=ie("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",k,j),e[6]=k,e[7]=j,e[8]=C):C=e[8];const T=vR[h];let N;e[9]!==T?(N=ie("shrink-0",T),e[9]=T,e[10]=N):N=e[10];let V;e[11]!==s||e[12]!==N?(V=o.jsx("span",{className:N,children:s}),e[11]=s,e[12]=N,e[13]=V):V=e[13];let A;e[14]!==n?(A=o.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=A):A=e[15];let E;e[16]!==i?(E=i?o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=E):E=e[17];const R=p?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==R?(I=o.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:o.jsx(Qt,{size:16,style:{transform:R,transition:`transform 180ms ${T1}`}})}),e[18]=R,e[19]=I):I=e[19];let D;e[20]!==m?(D=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=D):D=e[21];let O;e[22]!==m?(O=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=O):O=e[23];let z,M;e[24]!==L?(z=Z=>{Z.stopPropagation(),L()},M=Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),Z.stopPropagation(),L())},e[24]=L,e[25]=z,e[26]=M):(z=e[25],M=e[26]);let $;e[27]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Ds,{size:16}),e[27]=$):$=e[27];let F;e[28]!==D||e[29]!==O||e[30]!==z||e[31]!==M?(F=o.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":D,title:O,onClick:z,onKeyDown:M,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:$}),e[28]=D,e[29]=O,e[30]=z,e[31]=M,e[32]=F):F=e[32];let U;e[33]!==p||e[34]!==V||e[35]!==A||e[36]!==E||e[37]!==I||e[38]!==F||e[39]!==C?(U=o.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:S,className:C,children:[V,A,E,I,F]}),e[33]=p,e[34]=V,e[35]=A,e[36]=E,e[37]=I,e[38]=F,e[39]=C,e[40]=U):U=e[40];const H=p?"1fr":"0fr";let q;e[41]!==H?(q={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${T1}`},e[41]=H,e[42]=q):q=e[42];let W;e[43]===Symbol.for("react.memo_cache_sentinel")?(W={overflow:"hidden",minHeight:0},e[43]=W):W=e[43];const G=p?1:0;let Y;e[44]!==G?(Y={opacity:G,transition:`opacity 120ms ${T1}`,maxHeight:"60vh"},e[44]=G,e[45]=Y):Y=e[45];let J;e[46]!==r?(J=r?o.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:o.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:r})}):o.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=r,e[47]=J):J=e[47];let se;e[48]!==c||e[49]!==r?(se=c?o.jsx("div",{className:ie("pb-4",!r&&"pt-4"),children:c}):null,e[48]=c,e[49]=r,e[50]=se):se=e[50];let oe;e[51]!==J||e[52]!==se?(oe=o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[J,se]}),e[51]=J,e[52]=se,e[53]=oe):oe=e[53];let ne;e[54]!==l||e[55]!==a?(ne=l||a?o.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:l}),o.jsx("div",{className:"flex items-center gap-2",children:a})]})}):null,e[54]=l,e[55]=a,e[56]=ne):ne=e[56];let Q;e[57]!==Y||e[58]!==oe||e[59]!==ne?(Q=o.jsx("div",{style:W,children:o.jsxs("div",{className:"flex flex-col",style:Y,children:[oe,ne]})}),e[57]=Y,e[58]=oe,e[59]=ne,e[60]=Q):Q=e[60];let K;e[61]!==q||e[62]!==Q?(K=o.jsx("div",{"data-testid":"collapsible-highlight-body",style:q,children:Q}),e[61]=q,e[62]=Q,e[63]=K):K=e[63];let X;return e[64]!==U||e[65]!==K||e[66]!==w||e[67]!==h?(X=o.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":h,className:w,children:[U,K]}),e[64]=U,e[65]=K,e[66]=w,e[67]=h,e[68]=X):X=e[68],X}function yR(t){return!t}const _R=Et({content:Re().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:xr(["pending","in_progress","completed"]),activeForm:Re().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),k7=Et({todos:Cs(_R)}),LR="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";GV({description:LR,inputSchema:YV(k7),execute:async({todos:t})=>({ok:!0,count:t.length})});const wR="tool-todo_write",SR=new Set(["input-available","output-available"]);function kR(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const n=s.parts;if(Array.isArray(n))for(let i=n.length-1;i>=0;i--){const r=n[i];if(r.type!==wR||typeof r.state!="string"||!SR.has(r.state))continue;const l=k7.safeParse(r.input);if(l.success)return l.data.todos}}return[]}function j7(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const n="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:n,friendlyName:Ul(FT(n)),input:s.input})}return e}function C7(t){return t.at(-1)}function N7(t){const e=[];for(const s of t)s.type==="tool-propose_plan"&&s.state==="input-available"&&e.push({toolCallId:s.toolCallId,plan:s.input.plan,state:s.state});return e}function jR(t){return t?t.message.startsWith("[CREDITS]"):!1}const CR="[SUBSCRIPTION_REQUIRED]";function T7(t){return t?.message.startsWith(CR)?t.message.includes("used its free task executions")?"trial_exhausted":t.message.includes("used its monthly task executions")?"monthly_exhausted":t.message.includes("reached its execution limit")?"runs_exhausted":null:null}const NR={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function TR(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=t;if(!i&&s&&jR(s))return{...NR,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,f=!!c.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,u=N7(a),h=j7(c),m=kR(e),p=i?null:T7(s),g=!i&&!!s&&!p,x=h.length>0||i&&r,b=u.length>0,L=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(f||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:L,hasApprovals:x,hasPlans:b,isWaitingForUserInput:f,todos:m}}function V7(){const t=B.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=ui(),l=s??null,a=n??null;let c;return t[0]!==i||t[1]!==r||t[2]!==e||t[3]!==l||t[4]!==a?(c=TR({messages:e,error:l,finishReason:a,isStreaming:i,isWaitingForApprovals:r}),t[0]=i,t[1]=r,t[2]=e,t[3]=l,t[4]=a,t[5]=c):c=t[5],c}function VR(){const t=V7();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function A7(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(s=>s.type==="hardBreak"||s.type==="text"&&(!s.text||s.text.trim()==="")):!1)}const AR="__home__";function Hg(t,e){return D2.chatDraft(t,e)}function PR(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const s=e.tiptapDoc;return!s||typeof s!="object"||s.type!=="doc"||!Array.isArray(s.content)?null:s}function P7(t,e,s,n,i){const r=Hg(e,s);if(A7(n)){t.removeItem(r);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(r,a)}catch(c){if(RR(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function w4(t,e,s){const n=Hg(e,s),i=t.getItem(n),r=PR(i);return i!==null&&r===null&&t.removeItem(n),r}function ER(t,e,s){t.removeItem(Hg(e,s))}function RR(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function Tn(t){const e=B.c(14),s=Is(t),n=As(),i=s?.metadata,r=n?.activeTask,l=r?.metadata?.runtime;let a;e[0]!==l?(a=rA(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=!!r&&!r.partial,f=r?.metadata;let u;e[2]!==i||e[3]!==f?(u=i8(f,i),e[2]=i,e[3]=f,e[4]=u):u=e[4];const h=!!c||d&&!!s;let m;e[5]!==i?(m=G2(i),e[5]=i,e[6]=m):m=e[6];let p;e[7]!==i?(p=Y2(i),e[7]=i,e[8]=p):p=e[8];let g;return e[9]!==u||e[10]!==h||e[11]!==m||e[12]!==p?(g={runtime:u,resolved:h,projectDefault:m,previewServerUrl:p},e[9]=u,e[10]=h,e[11]=m,e[12]=p,e[13]=g):g=e[13],g}function DR(t){const e=B.c(30),{current:s,total:n,onPrev:i,onNext:r}=t,l=re();if(n<=1)return null;const a=s===0,c=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=ie("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let f;e[2]!==l?(f=l("chat.pagination.previousLabel"),e[2]=l,e[3]=f):f=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(m9,{size:14}),e[4]=u):u=e[4];let h;e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==f?(h=o.jsx("button",{type:"button",onClick:i,disabled:a,className:d,"aria-label":f,children:u}),e[5]=i,e[6]=a,e[7]=d,e[8]=f,e[9]=h):h=e[9];const m=s+1;let p;e[10]!==l||e[11]!==m||e[12]!==n?(p=l("chat.pagination.counter",{current:m,total:n}),e[10]=l,e[11]=m,e[12]=n,e[13]=p):p=e[13];let g;e[14]!==p?(g=o.jsx("span",{className:"tabular-nums text-xs",children:p}),e[14]=p,e[15]=g):g=e[15];const x=s===n-1,b=s===n-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let y;e[16]!==b?(y=ie("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=y):y=e[17];let L;e[18]!==l?(L=l("chat.pagination.nextLabel"),e[18]=l,e[19]=L):L=e[19];let v;e[20]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(gl,{size:14}),e[20]=v):v=e[20];let _;e[21]!==r||e[22]!==x||e[23]!==y||e[24]!==L?(_=o.jsx("button",{type:"button",onClick:r,disabled:x,className:y,"aria-label":L,children:v}),e[21]=r,e[22]=x,e[23]=y,e[24]=L,e[25]=_):_=e[25];let w;return e[26]!==_||e[27]!==h||e[28]!==g?(w=o.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[h,g,_]}),e[26]=_,e[27]=h,e[28]=g,e[29]=w):w=e[29],w}function E7(t){const e=B.c(8),{currentIndex:s,total:n,onPrev:i,onNext:r,extraLeft:l}=t;let a;e[0]!==s||e[1]!==r||e[2]!==i||e[3]!==n?(a=o.jsx(DR,{current:s,total:n,onPrev:i,onNext:r}),e[0]=s,e[1]=r,e[2]=i,e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==l||e[6]!==a?(c=o.jsxs("div",{className:"flex items-center gap-2",children:[a,l]}),e[5]=l,e[6]=a,e[7]=c):c=e[7],c}function IR(t){const e=B.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:i,onAdvanceOrSubmit:r,submitLabel:l,nextLabel:a}=t,f=n?l===void 0?"Submit":l:a===void 0?"Next":a,u=n?s:!i,h=u?n?"Waiting for the assistant to finish…":"Answer this item to continue":null;let m;e[0]!==u||e[1]!==r?(m=()=>{u||r()},e[0]=u,e[1]=r,e[2]=m):m=e[2];const p=u&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=ie("h-7 px-2.5 text-xs",p),e[3]=p,e[4]=g):g=e[4];let x;e[5]!==u||e[6]!==f||e[7]!==m||e[8]!==g?(x=o.jsx(ue,{type:"button",size:"sm","aria-disabled":u,onClick:m,className:g,children:f}),e[5]=u,e[6]=f,e[7]=m,e[8]=g,e[9]=x):x=e[9];const b=x;if(!h)return b;let y;e[10]!==b?(y=o.jsx(Ke,{asChild:!0,children:b}),e[10]=b,e[11]=y):y=e[11];let L;e[12]!==h?(L=o.jsx(We,{children:h}),e[12]=h,e[13]=L):L=e[13];let v;return e[14]!==y||e[15]!==L?(v=o.jsxs(qe,{children:[y,L]}),e[14]=y,e[15]=L,e[16]=v):v=e[16],v}function R7(t,e,s){return t.findIndex(n=>e(n)===s)}function S4(t,e,s,n){return t.length===0?!1:t.every(i=>n(s[e(i)]))}function k4(t,e,s,n,i){if(t.length===0)return null;const r=R7(t,e,i);for(let l=1;l<=t.length;l++){const a=t[(r+l)%t.length];if(!a)continue;const c=e(a);if(c!==i&&!n(s[c]))return c}return null}function MR(t){return!t.isStreaming&&t.allAnswered}function D7(t){const{parts:e,partKey:s,schema:n,defaultValues:i,isStreaming:r,hasAnswer:l,onSubmit:a}=t,c=e[0]?s(e[0]):"",[d,f]=P.useState(c),[u,h]=P.useState(!1),m=I2({resolver:m6(n),defaultValues:i}),p=m.watch(),g=R7(e,s,d),x=g>=0?e[g]:void 0,b=l(p[d]),y=S4(e,s,p,l),L=MR({isStreaming:r,allAnswered:y}),v=()=>{if(g>0){const T=e[g-1];T&&f(s(T))}},_=()=>{if(g>=0&&g<e.length-1){const T=e[g+1];T&&f(s(T))}},w=()=>{const T=m.getValues(),N=k4(e,s,T,l,d);N&&f(N)},S=()=>{m.handleSubmit(T=>{const N=T;for(const V of e)a(V,N[s(V)])})()},k=P.useRef(S);k.current=S;const j=()=>{L&&(h(!1),k.current())},C=()=>{const T=m.getValues();if(S4(e,s,T,l)){if(r){h(!0);return}h(!1),k.current()}else{const N=k4(e,s,T,l,d);N&&f(N)}};return P.useEffect(()=>{if(u&&!r){if(!y){h(!1);return}h(!1),k.current()}},[u,r,y]),{form:m,activeKey:d,setActiveKey:f,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:y,canSubmit:L,goPrev:v,goNext:_,advanceToNextUnanswered:w,submit:j,submitOrAdvance:C}}const I7="chat.approval.defaultDenyReason";function M7(t){const e=B.c(36),{onYolo:s}=t,n=re(),[i,r]=br();let l,a,c,d,f,u,h,m,p;if(e[0]!==s||e[1]!==i||e[2]!==r||e[3]!==n){const v=El.find(S=>S.value===i.toolApprovalLevel)??El[0];let _;e[13]!==s||e[14]!==i||e[15]!==r?(_=S=>{const k=S,j=i.toolApprovalLevel??"readonly";r({...i,toolApprovalLevel:k}),k==="auto"&&s(j)},e[13]=s,e[14]=i,e[15]=r,e[16]=_):_=e[16];const w=_;c=ys,m=i.toolApprovalLevel,p=w,a=_s,f="xs",u="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",h=OR,l=Ns,d=n(v.shortKey),e[0]=s,e[1]=i,e[2]=r,e[3]=n,e[4]=l,e[5]=a,e[6]=c,e[7]=d,e[8]=f,e[9]=u,e[10]=h,e[11]=m,e[12]=p}else l=e[4],a=e[5],c=e[6],d=e[7],f=e[8],u=e[9],h=e[10],m=e[11],p=e[12];let g;e[17]!==l||e[18]!==d?(g=o.jsx(l,{children:d}),e[17]=l,e[18]=d,e[19]=g):g=e[19];let x;e[20]!==a||e[21]!==f||e[22]!==u||e[23]!==h||e[24]!==g?(x=o.jsx(a,{size:f,className:u,onClick:h,children:g}),e[20]=a,e[21]=f,e[22]=u,e[23]=h,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==n?(b=El.map(v=>o.jsx(Rt,{value:v.value,children:n(v.labelKey)},v.value)),e[26]=n,e[27]=b):b=e[27];let y;e[28]!==b?(y=o.jsx(Ls,{children:b}),e[28]=b,e[29]=y):y=e[29];let L;return e[30]!==c||e[31]!==y||e[32]!==m||e[33]!==p||e[34]!==x?(L=o.jsxs(c,{value:m,onValueChange:p,children:[x,y]}),e[30]=c,e[31]=y,e[32]=m,e[33]=p,e[34]=x,e[35]=L):L=e[35],L}function OR(t){return t.stopPropagation()}function O7(t){const e=B.c(8),{input:s}=t,n=re();if(s==null){let l;e[0]!==n?(l=n("chat.approval.noInput"),e[0]=n,e[1]=l):l=e[1];let a;return e[2]!==l?(a=o.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:l}),e[2]=l,e[3]=a):a=e[3],a}let i;try{let l;e[4]!==s?(l=JSON.stringify(s,null,2),e[4]=s,e[5]=l):l=e[5],i=l}catch{i=String(s)}let r;return e[6]!==i?(r=o.jsx("div",{className:"px-4",children:o.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:i})}),e[6]=i,e[7]=r):r=e[7],r}function $R(t){const e=B.c(38),{approval:s,onRespond:n}=t,i=re(),[r]=br(),l=r.toolApprovalLevel??"readonly";let a;e[0]!==s.approvalId||e[1]!==l||e[2]!==n||e[3]!==i?(a=()=>n(s.approvalId,!1,i(I7),l),e[0]=s.approvalId,e[1]=l,e[2]=n,e[3]=i,e[4]=a):a=e[4];const c=a;let d;e[5]!==s.approvalId||e[6]!==l||e[7]!==n?(d=()=>n(s.approvalId,!0,void 0,l),e[5]=s.approvalId,e[6]=l,e[7]=n,e[8]=d):d=e[8];const f=d;let u;e[9]!==s.approvalId||e[10]!==n?(u=j=>n(s.approvalId,!0,void 0,j),e[9]=s.approvalId,e[10]=n,e[11]=u):u=e[11];const h=u;let m;e[12]!==h?(m=o.jsx("div",{className:"flex items-center gap-2",children:o.jsx(M7,{onYolo:h})}),e[12]=h,e[13]=m):m=e[13];const p=m;let g;e[14]!==i?(g=i("chat.approval.denyButton"),e[14]=i,e[15]=g):g=e[15];let x;e[16]!==c||e[17]!==g?(x=o.jsx(ue,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:g}),e[16]=c,e[17]=g,e[18]=x):x=e[18];let b;e[19]!==i?(b=i("chat.approval.acceptButton"),e[19]=i,e[20]=b):b=e[20];let y;e[21]!==f||e[22]!==b?(y=o.jsx(ue,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:f,children:b}),e[21]=f,e[22]=b,e[23]=y):y=e[23];let L;e[24]!==x||e[25]!==y?(L=o.jsxs(o.Fragment,{children:[x,y]}),e[24]=x,e[25]=y,e[26]=L):L=e[26];const v=L;let _;e[27]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(f9,{size:14}),e[27]=_):_=e[27];let w;e[28]!==i?(w=i("chat.approval.needsApproval"),e[28]=i,e[29]=w):w=e[29];let S;e[30]!==s.input?(S=o.jsx(O7,{input:s.input}),e[30]=s.input,e[31]=S):S=e[31];let k;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==v||e[35]!==w||e[36]!==S?(k=o.jsx(al,{icon:_,label:w,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:v,children:S}),e[32]=s.friendlyName,e[33]=p,e[34]=v,e[35]=w,e[36]=S,e[37]=k):k=e[37],k}const BR=Cu(Re(),Et({approved:ki().optional(),levelOverride:xr(["auto","readonly"]).optional()}));function zR(t){const e=B.c(46),{approvals:s,isStreaming:n,onRespond:i}=t,r=re(),[l]=br(),a=l.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(HR)),e[0]=s,e[1]=c):c=e[1];const d=c;let f;e[2]!==a||e[3]!==i||e[4]!==r?(f=(N,V)=>{const A=V;typeof A?.approved=="boolean"&&i(N.approvalId,A.approved,A.approved===!1?r(I7):void 0,A.levelOverride??a)},e[2]=a,e[3]=i,e[4]=r,e[5]=f):f=e[5];let u;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==f?(u={parts:s,partKey:UR,schema:BR,defaultValues:d,isStreaming:n,hasAnswer:FR,onSubmit:f},e[6]=s,e[7]=d,e[8]=n,e[9]=f,e[10]=u):u=e[10];const h=D7(u);let m;e[11]!==s||e[12]!==h?(m=N=>{h.form.reset(Object.fromEntries(s.map(V=>[V.approvalId,{approved:!0,levelOverride:N}]))),h.submitOrAdvance()},e[11]=s,e[12]=h,e[13]=m):m=e[13];const p=m,g=h.currentPart,x=h.form;let b;e[14]!==h?(b=N=>{N.preventDefault(),h.submit()},e[14]=h,e[15]=b):b=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(f9,{size:14}),e[16]=y):y=e[16];let L;e[17]!==s.length||e[18]!==r?(L=r("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=r,e[19]=L):L=e[19];const v=g?.friendlyName??"";let _;e[20]!==p?(_=o.jsx(M7,{onYolo:p}),e[20]=p,e[21]=_):_=e[21];let w;e[22]!==s.length||e[23]!==h.currentIndex||e[24]!==h.goNext||e[25]!==h.goPrev||e[26]!==_?(w=o.jsx(E7,{currentIndex:h.currentIndex,total:s.length,onPrev:h.goPrev,onNext:h.goNext,extraLeft:_}),e[22]=s.length,e[23]=h.currentIndex,e[24]=h.goNext,e[25]=h.goPrev,e[26]=_,e[27]=w):w=e[27];let S;e[28]!==g||e[29]!==h.form.control||e[30]!==h.submitOrAdvance?(S=g?o.jsx(KR,{approvalId:g.approvalId,control:h.form.control,onChange:h.submitOrAdvance}):null,e[28]=g,e[29]=h.form.control,e[30]=h.submitOrAdvance,e[31]=S):S=e[31];let k;e[32]!==g?(k=g?o.jsx(O7,{input:g.input}):null,e[32]=g,e[33]=k):k=e[33];let j;e[34]!==w||e[35]!==S||e[36]!==k||e[37]!==L||e[38]!==v?(j=o.jsx(al,{icon:y,label:L,title:v,defaultExpanded:!0,footerLeft:w,footerRight:S,children:k}),e[34]=w,e[35]=S,e[36]=k,e[37]=L,e[38]=v,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==b?(C=o.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=C):C=e[42];let T;return e[43]!==h.form||e[44]!==C?(T=o.jsx(Fm,{...x,children:C}),e[43]=h.form,e[44]=C,e[45]=T):T=e[45],T}function FR(t){return typeof t?.approved=="boolean"}function UR(t){return t.approvalId}function HR(t){return[t.approvalId,{approved:void 0}]}function KR(t){const e=B.c(7),{approvalId:s,control:n,onChange:i}=t,r=re(),l=`${s}.approved`;let a;e[0]!==i||e[1]!==r?(a=d=>{const{field:f}=d,u=f.value===!0,h=f.value===!1;return o.jsxs(o.Fragment,{children:[o.jsx(ue,{type:"button",variant:h?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{f.onChange(!1),i()},"aria-pressed":h,children:r("chat.approval.denyButton")}),o.jsx(ue,{type:"button",variant:u?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{f.onChange(!0),i()},"aria-pressed":u,children:r("chat.approval.acceptButton")})]})},e[0]=i,e[1]=r,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==l||e[5]!==a?(c=o.jsx(js,{control:n,name:l,render:a}),e[3]=n,e[4]=l,e[5]=a,e[6]=c):c=e[6],c}function WR(){const t=B.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(f9,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.approval.preparingRequest"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=o.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,o.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function qR(t){const e=B.c(8),{approvals:s,isStreaming:n,onRespond:i}=t;if(n&&s.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(WR,{}),e[0]=l):l=e[0],l}if(s.length===0)return null;if(s.length===1){const l=s[0];if(!l)return null;let a;return e[1]!==i||e[2]!==l?(a=o.jsx($R,{approval:l,onRespond:i}),e[1]=i,e[2]=l,e[3]=a):a=e[3],a}let r;return e[4]!==s||e[5]!==n||e[6]!==i?(r=o.jsx(zR,{approvals:s,isStreaming:n,onRespond:i}),e[4]=s,e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function GR(t){const e=B.c(28),{plan:s,onApprove:n,onDismiss:i}=t,r=re();let l;e[0]!==n||e[1]!==s.plan?(l=()=>{n(s.plan)},e[0]=n,e[1]=s.plan,e[2]=l):l=e[2];const a=l;let c;e[3]!==r?(c=r("chat.proposePlan.keepIterating"),e[3]=r,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==c?(d=o.jsx(ue,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:i,children:c}),e[5]=i,e[6]=c,e[7]=d):d=e[7];let f;e[8]!==r?(f=r("chat.proposePlan.letsGo"),e[8]=r,e[9]=f):f=e[9];let u;e[10]!==a||e[11]!==f?(u=o.jsx(ue,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:a,children:f}),e[10]=a,e[11]=f,e[12]=u):u=e[12];let h;e[13]!==d||e[14]!==u?(h=o.jsxs(o.Fragment,{children:[d,u]}),e[13]=d,e[14]=u,e[15]=h):h=e[15];const m=h;let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(r8,{size:14}),e[16]=p):p=e[16];let g;e[17]!==r?(g=r("chat.proposePlan.planReady"),e[17]=r,e[18]=g):g=e[18];let x;e[19]!==r?(x=r("chat.proposePlan.implementationPlan"),e[19]=r,e[20]=x):x=e[20];let b;e[21]!==s.plan?(b=o.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:o.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:o.jsx(UT,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=b):b=e[22];let y;return e[23]!==m||e[24]!==b||e[25]!==g||e[26]!==x?(y=o.jsx(al,{icon:p,label:g,title:x,defaultExpanded:!0,footerRight:m,children:b}),e[23]=m,e[24]=b,e[25]=g,e[26]=x,e[27]=y):y=e[27],y}function YR(t){const e=B.c(6),{plans:s,onApprove:n,onDismiss:i}=t;let r;e[0]!==s?(r=C7(s),e[0]=s,e[1]=r):r=e[1];const l=r;if(!l)return null;let a;return e[2]!==l||e[3]!==n||e[4]!==i?(a=o.jsx(GR,{plan:l,onApprove:n,onDismiss:i}),e[2]=l,e[3]=n,e[4]=i,e[5]=a):a=e[5],a}function $7(t){return t?"response"in t?t.response:t.option??t.draft:""}const j4=Et({response:Re().min(1,"Response is required")}),JR=Et({option:Re().nullable(),draft:Re()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),QR=Et({response:xr(["yes","no"])});function XR(t){switch(t.type){case"text":return j4;case"choice":return JR;case"confirm":return QR;default:return j4}}function ZR(t){const e={};for(const s of t)e[s.toolCallId]=XR(s.input);return Et(e)}function eD(t){const e=B.c(7),{control:s,name:n,placeholder:i}=t,r=re();let l;e[0]!==i||e[1]!==r?(l=c=>{const{field:d}=c,f=d.value??"";return o.jsxs(ig,{children:[o.jsx(rg,{children:o.jsx("div",{className:"px-2",children:o.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[o.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:o.jsx(Q2,{size:16,className:"text-muted-foreground"})}),o.jsx("input",{...d,value:f,type:"text",placeholder:i||r("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":r("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),o.jsx(og,{})]})},e[0]=i,e[1]=r,e[2]=l):l=e[2];let a;return e[3]!==s||e[4]!==n||e[5]!==l?(a=o.jsx(w8,{control:s,name:n,render:l}),e[3]=s,e[4]=n,e[5]=l,e[6]=a):a=e[6],a}function B7(t,e){const s=B.c(4);let n,i;s[0]!==t||s[1]!==e?(n=()=>{const r=l=>{const a=l.target.tagName;if(a==="INPUT"||a==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const c=Number.parseInt(l.key,10);c>=1&&c<=t&&(l.preventDefault(),e(c-1))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},i=[t,e],s[0]=t,s[1]=e,s[2]=n,s[3]=i):(n=s[2],i=s[3]),P.useEffect(n,i)}function tD(t){const e=B.c(51),{control:s,name:n,options:i}=t,r=re(),l=`${n}.option`;let a;e[0]!==s||e[1]!==l?(a={control:s,name:l,defaultValue:null},e[0]=s,e[1]=l,e[2]=a):a=e[2];const{field:c}=n4(a),d=`${n}.draft`;let f;e[3]!==s||e[4]!==d?(f={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=f):f=e[5];const{field:u}=n4(f),h=c.value,m=u.value??"";let p;if(e[6]!==c||e[7]!==i?(p=R=>{const I=i[R];I!=null&&c.onChange(I)},e[6]=c,e[7]=i,e[8]=p):p=e[8],B7(i.length,p),i.length===0)return null;const g=h===null;let x;e[9]!==r?(x=r("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=r,e[10]=x):x=e[10];let b;if(e[11]!==c||e[12]!==h||e[13]!==i||e[14]!==r){let R;e[16]!==c||e[17]!==h||e[18]!==r?(R=(I,D)=>{const O=h===I;return o.jsxs("button",{type:"button",onClick:()=>c.onChange(I),className:ie("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",O&&"bg-accent/50",!O&&"hover:bg-accent/30"),"aria-label":r("chat.userAskQuestion.selectOption",{option:I}),children:[o.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",O?"bg-chart-1 text-white":"bg-muted text-foreground"),children:D+1}),o.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:I})]},`${D}-${I}`)},e[16]=c,e[17]=h,e[18]=r,e[19]=R):R=e[19],b=i.map(R),e[11]=c,e[12]=h,e[13]=i,e[14]=r,e[15]=b}else b=e[15];const y=g&&"bg-accent/50",L=!g&&"hover:bg-accent/30";let v;e[20]!==y||e[21]!==L?(v=ie("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",y,L),e[20]=y,e[21]=L,e[22]=v):v=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:o.jsx(Q2,{size:16,className:"text-muted-foreground"})}),e[23]=_):_=e[23];const w=g?m:"";let S;e[24]!==u||e[25]!==c||e[26]!==h?(S=R=>{u.onChange(R.target.value),h!==null&&c.onChange(null)},e[24]=u,e[25]=c,e[26]=h,e[27]=S):S=e[27];let k;e[28]!==c||e[29]!==h?(k=()=>{h!==null&&c.onChange(null)},e[28]=c,e[29]=h,e[30]=k):k=e[30];let j;e[31]!==r?(j=r("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=r,e[32]=j):j=e[32];let C;e[33]!==r?(C=r("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=r,e[34]=C):C=e[34];let T;e[35]!==w||e[36]!==S||e[37]!==k||e[38]!==j||e[39]!==C?(T=o.jsx("input",{type:"text",value:w,onChange:S,onFocus:k,placeholder:j,"aria-label":C,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=w,e[36]=S,e[37]=k,e[38]=j,e[39]=C,e[40]=T):T=e[40];let N;e[41]!==v||e[42]!==T?(N=o.jsxs("label",{className:v,children:[_,T]}),e[41]=v,e[42]=T,e[43]=N):N=e[43];let V;e[44]!==N||e[45]!==x||e[46]!==b?(V=o.jsx(rg,{children:o.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,N]})}),e[44]=N,e[45]=x,e[46]=b,e[47]=V):V=e[47];let A;e[48]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(og,{}),e[48]=A):A=e[48];let E;return e[49]!==V?(E=o.jsxs(ig,{children:[V,A]}),e[49]=V,e[50]=E):E=e[50],E}function sD(t){const e=B.c(8),{control:s,name:n}=t,i=re();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=["yes","no"],e[0]=r):r=e[0];const l=r,a=P.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u=>{a.current?.onChange(l[u]??"")},e[1]=c):c=e[1],B7(l.length,c);let d;e[2]!==i?(d=u=>{const{field:h}=u;return a.current=h,o.jsxs(ig,{children:[o.jsx(rg,{children:o.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":i("chat.userAskQuestion.confirmationOptionsAriaLabel"),children:l.map(m=>{const p=h.value===m;return o.jsxs("button",{type:"button",onClick:()=>h.onChange(m),className:ie("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",p&&"bg-accent/50",!p&&"hover:bg-accent/30"),"aria-label":i("chat.userAskQuestion.confirmValue",{value:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)}),children:[o.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0",p?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),o.jsx("span",{className:"text-sm text-foreground capitalize",children:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)})]},m)})})}),o.jsx(og,{})]})},e[2]=i,e[3]=d):d=e[3];let f;return e[4]!==s||e[5]!==n||e[6]!==d?(f=o.jsx(w8,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=f):f=e[7],f}function C4(t){const e=B.c(13),{input:s,control:n,toolCallId:i}=t;switch(s.type){case"text":{const r=`${i}.response`;let l;return e[0]!==n||e[1]!==s.default||e[2]!==r?(l=o.jsx(eD,{control:n,name:r,placeholder:s.default}),e[0]=n,e[1]=s.default,e[2]=r,e[3]=l):l=e[3],l}case"choice":{let r;e[4]!==s.options?(r=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=r):r=e[5];const l=r;let a;return e[6]!==n||e[7]!==l||e[8]!==i?(a=o.jsx(tD,{control:n,name:i,options:l}),e[6]=n,e[7]=l,e[8]=i,e[9]=a):a=e[9],a}case"confirm":{const r=`${i}.response`;let l;return e[10]!==n||e[11]!==r?(l=o.jsx(sD,{control:n,name:r}),e[10]=n,e[11]=r,e[12]=l):l=e[12],l}default:return null}}function nD(t){const e=B.c(91),{parts:s,isStreaming:n,onSubmit:i}=t;let r;e[0]!==s?(r=ZR(s.map(lD)),e[0]=s,e[1]=r):r=e[1];const l=r;let a;e[2]!==s?(a=Object.fromEntries(s.map(oD)),e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==i?(d=(M,$)=>{const F=$7($);F&&i(M,F)},e[4]=i,e[5]=d):d=e[5];let f;e[6]!==c||e[7]!==n||e[8]!==s||e[9]!==l||e[10]!==d?(f={parts:s,partKey:rD,schema:l,defaultValues:c,isStreaming:n,hasAnswer:iD,onSubmit:d},e[6]=c,e[7]=n,e[8]=s,e[9]=l,e[10]=d,e[11]=f):f=e[11];const u=D7(f),h=u.currentPart,m=re();let p;e[12]!==h||e[13]!==u||e[14]!==m?(p=()=>{const M=h;if(!M)return;const $=m("chat.userAskQuestion.skipMessage"),F=M.toolCallId;M.input?.type==="choice"?(u.form.setValue(`${F}.option`,null),u.form.setValue(`${F}.draft`,$)):u.form.setValue(`${F}.response`,$),u.advanceToNextUnanswered()},e[12]=h,e[13]=u,e[14]=m,e[15]=p):p=e[15];const g=p;let x;e[16]!==u.currentIndex||e[17]!==u.goNext||e[18]!==u.goPrev||e[19]!==s.length?(x=o.jsx(E7,{currentIndex:u.currentIndex,total:s.length,onPrev:u.goPrev,onNext:u.goNext}),e[16]=u.currentIndex,e[17]=u.goNext,e[18]=u.goPrev,e[19]=s.length,e[20]=x):x=e[20];const b=x;let y;e[21]!==m?(y=m("chat.userAskQuestion.skip"),e[21]=m,e[22]=y):y=e[22];let L;e[23]!==g||e[24]!==y?(L=o.jsx(ue,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:y}),e[23]=g,e[24]=y,e[25]=L):L=e[25];let v;e[26]!==u.isAllAnswered||e[27]!==u.isCurrentAnswered||e[28]!==u.submitOrAdvance||e[29]!==n?(v=o.jsx(IR,{isStreaming:n,isAllAnswered:u.isAllAnswered,isCurrentAnswered:u.isCurrentAnswered,onAdvanceOrSubmit:u.submitOrAdvance}),e[26]=u.isAllAnswered,e[27]=u.isCurrentAnswered,e[28]=u.submitOrAdvance,e[29]=n,e[30]=v):v=e[30];let _;e[31]!==L||e[32]!==v?(_=o.jsxs(o.Fragment,{children:[L,v]}),e[31]=L,e[32]=v,e[33]=_):_=e[33];const w=_;if(s.length===1){const M=s[0];if(!M?.input)return null;const $=u.form;let F;e[34]!==u?(F=oe=>{oe.preventDefault(),u.submit()},e[34]=u,e[35]=F):F=e[35];let U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Um,{size:14}),e[36]=U):U=e[36];let H;e[37]!==m?(H=m("chat.userAskQuestion.questionPending"),e[37]=m,e[38]=H):H=e[38];let q;e[39]!==M.input?.prompt||e[40]!==m?(q=M.input?.prompt??m("chat.userAskQuestion.question"),e[39]=M.input?.prompt,e[40]=m,e[41]=q):q=e[41];const W=M.input;let G;e[42]!==u.form.control||e[43]!==M.toolCallId||e[44]!==W?(G=o.jsx(C4,{input:W,control:u.form.control,toolCallId:M.toolCallId}),e[42]=u.form.control,e[43]=M.toolCallId,e[44]=W,e[45]=G):G=e[45];let Y;e[46]!==w||e[47]!==H||e[48]!==q||e[49]!==G?(Y=o.jsx(al,{icon:U,label:H,title:q,defaultExpanded:!0,footerRight:w,children:G}),e[46]=w,e[47]=H,e[48]=q,e[49]=G,e[50]=Y):Y=e[50];let J;e[51]!==F||e[52]!==Y?(J=o.jsx("form",{onSubmit:F,autoComplete:"off",children:Y}),e[51]=F,e[52]=Y,e[53]=J):J=e[53];let se;return e[54]!==u.form||e[55]!==J?(se=o.jsx(Fm,{...$,children:J}),e[54]=u.form,e[55]=J,e[56]=se):se=e[56],se}const S=u.form;let k;e[57]!==u?(k=M=>{M.preventDefault(),u.submit()},e[57]=u,e[58]=k):k=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(Um,{size:14}),e[59]=j):j=e[59];let C;e[60]!==m?(C=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=C):C=e[61];const T=u.currentIndex+1;let N;e[62]!==s.length||e[63]!==m||e[64]!==T?(N=m("chat.userAskQuestion.questionCount",{current:T,total:s.length}),e[62]=s.length,e[63]=m,e[64]=T,e[65]=N):N=e[65];let V;e[66]!==h?.input?.prompt||e[67]!==m?(V=h?.input?.prompt??m("chat.userAskQuestion.question"),e[66]=h?.input?.prompt,e[67]=m,e[68]=V):V=e[68];const A=u.activeKey,E=u.setActiveKey;let R;if(e[69]!==u.form||e[70]!==s){let M;e[72]!==u.form?(M=$=>o.jsx(Ol,{value:$.toolCallId,className:"mt-0",children:o.jsx(C4,{input:$.input,control:u.form.control,toolCallId:$.toolCallId})},$.toolCallId),e[72]=u.form,e[73]=M):M=e[73],R=s.map(M),e[69]=u.form,e[70]=s,e[71]=R}else R=e[71];let I;e[74]!==u.activeKey||e[75]!==u.setActiveKey||e[76]!==R?(I=o.jsx(ad,{value:A,onValueChange:E,children:R}),e[74]=u.activeKey,e[75]=u.setActiveKey,e[76]=R,e[77]=I):I=e[77];let D;e[78]!==b||e[79]!==w||e[80]!==C||e[81]!==N||e[82]!==V||e[83]!==I?(D=o.jsx(al,{icon:j,label:C,count:N,title:V,defaultExpanded:!0,footerLeft:b,footerRight:w,children:I}),e[78]=b,e[79]=w,e[80]=C,e[81]=N,e[82]=V,e[83]=I,e[84]=D):D=e[84];let O;e[85]!==k||e[86]!==D?(O=o.jsx("form",{onSubmit:k,autoComplete:"off",children:D}),e[85]=k,e[86]=D,e[87]=O):O=e[87];let z;return e[88]!==u.form||e[89]!==O?(z=o.jsx(Fm,{...S,children:O}),e[88]=u.form,e[89]=O,e[90]=z):z=e[90],z}function iD(t){return!!$7(t)}function rD(t){return t.toolCallId}function oD(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function lD(t){return{toolCallId:t.toolCallId,input:t.input}}function aD(){const t=B.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Um,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.userAskQuestion.preparingQuestion"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=o.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s,o.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function z7(t){const e=B.c(7),{userAskParts:s,isStreaming:n,onSubmit:i}=t;let r;e[0]!==s?(r=s.filter(cD),e[0]=s,e[1]=r):r=e[1];const l=r;if(l.length===0){if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(aD,{}),e[2]=c):c=e[2],c}return null}let a;return e[3]!==n||e[4]!==i||e[5]!==l?(a=o.jsx(nD,{parts:l,isStreaming:n,onSubmit:i}),e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function cD(t){return t.state==="input-available"}function dD(t){const e=t.filter(r=>r.status==="in_progress"),s=t.filter(r=>r.status==="completed").length,n=t.length;if(n>0&&s===n)return{icon:"completed",activity:"All done",progress:`${n}/${n}`};const[i]=e;return i&&e.length===1?{icon:"in_progress",activity:i.activeForm,progress:`${s}/${n} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${n} done`}:s>0?{icon:"pending",activity:`${n-s} pending`,progress:`${s}/${n} done`}:{icon:"pending",activity:`${n} todos`,progress:"not started"}}function uD(t){const e=B.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=dD(s),e[0]=s,e[1]=n):n=e[1];const i=n;let r;e[2]!==i.icon?(r=o.jsx(pD,{status:i.icon}),e[2]=i.icon,e[3]=r):r=e[3];const l=i.activity,a=i.progress;let c;e[4]!==s?(c=s.map(fD),e[4]=s,e[5]=c):c=e[5];let d;e[6]!==c?(d=o.jsx("ul",{"data-testid":"todos-list",className:"flex flex-col px-2 max-h-[40vh] overflow-y-auto",children:c}),e[6]=c,e[7]=d):d=e[7];let f;return e[8]!==i.activity||e[9]!==i.progress||e[10]!==r||e[11]!==d?(f=o.jsx(al,{icon:r,label:l,count:a,defaultExpanded:!1,children:d}),e[8]=i.activity,e[9]=i.progress,e[10]=r,e[11]=d,e[12]=f):f=e[12],f}function fD(t,e){return o.jsx(hD,{todo:t},e)}function hD(t){const e=B.c(14),{todo:s}=t,n=s.status==="completed",r=s.status==="in_progress"?s.activeForm:s.content;let l;e[0]!==s.status?(l=o.jsx(mD,{status:s.status}),e[0]=s.status,e[1]=l):l=e[1];const a=n&&"text-muted-foreground";let c;e[2]!==a?(c=ie("relative text-sm leading-snug pt-px select-none",a),e[2]=a,e[3]=c):c=e[3];const d=n?"100%":"0%",f=n?"width 300ms ease 200ms":"width 150ms ease";let u;e[4]!==d||e[5]!==f?(u=o.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:f}}),e[4]=d,e[5]=f,e[6]=u):u=e[6];let h;e[7]!==r||e[8]!==c||e[9]!==u?(h=o.jsxs("span",{className:c,children:[r,u]}),e[7]=r,e[8]=c,e[9]=u,e[10]=h):h=e[10];let m;return e[11]!==l||e[12]!==h?(m=o.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,h]}),e[11]=l,e[12]=h,e[13]=m):m=e[13],m}function mD(t){const e=B.c(4),{status:s}=t,n=s==="completed"?"true":void 0,i=s==="in_progress"?"true":void 0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("svg",{viewBox:"0 0 21 21",children:o.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=r):r=e[0];let l;return e[1]!==n||e[2]!==i?(l=o.jsx("div",{className:"todo-cb mt-0.5","data-checked":n,"data-progress":i,"aria-hidden":"true",children:r}),e[1]=n,e[2]=i,e[3]=l):l=e[3],l}function pD(t){const e=B.c(13),{status:s}=t,n=re();if(s==="completed"){let l;e[0]!==n?(l=n("chat.todoStatus.completed"),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:o.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=a):a=e[2];let c;return e[3]!==l?(c=o.jsx("span",{"aria-label":l,className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:a}),e[3]=l,e[4]=c):c=e[4],c}if(s==="in_progress"){let l;e[5]!==n?(l=n("chat.todoStatus.inProgress"),e[5]=n,e[6]=l):l=e[6];let a;return e[7]!==l?(a=o.jsx("span",{"aria-label":l,className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[7]=l,e[8]=a):a=e[8],a}let i;e[9]!==n?(i=n("chat.todoStatus.pending"),e[9]=n,e[10]=i):i=e[10];let r;return e[11]!==i?(r=o.jsx("span",{"aria-label":i,className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[11]=i,e[12]=r):r=e[12],r}const gD={usd:[{dollars:10,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:20,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}],brl:[{dollars:50,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:500,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}]},xD=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function F7(t){const e=B.c(65),{onDismiss:s}=t,{org:n}=Fe(),i=Ws(),{decoKeyId:r}=cg(),l=ws(),a=re(),[c,d]=P.useState(""),[f,u]=P.useState(!1),[h,m]=P.useState("usd"),p=h==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{Ye("credits_exhausted_shown",{organization_id:n.id})},x=[n.id],e[0]=n.id,e[1]=g,e[2]=x):(g=e[1],x=e[2]),P.useEffect(g,x);let b;e[3]!==h||e[4]!==l?(b=async W=>{const{url:G}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:W,currency:h});return G},e[3]=h,e[4]=l,e[5]=b):b=e[5];let y;e[6]!==s?(y=W=>{W&&window.open(W,"_blank","noopener,noreferrer"),s?.()},e[6]=s,e[7]=y):y=e[7];let L;e[8]!==a?(L=W=>{xe.error(a("chat.creditsExhaustedBanner.topupError",{error:W.message}))},e[8]=a,e[9]=L):L=e[9];let v;e[10]!==b||e[11]!==y||e[12]!==L?(v={mutationFn:b,onSuccess:y,onError:L},e[10]=b,e[11]=y,e[12]=L,e[13]=v):v=e[13];const{mutate:_,isPending:w}=Rs(v),S=parseFloat(c),k=!isNaN(S)&&S>=1;let j;e[14]!==s?(j=W=>!W&&s?.(),e[14]=s,e[15]=j):j=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[16]=C):C=e[16];let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:C.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=T):T=e[17];let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[18]=N):N=e[18];let V;e[19]!==a?(V=a("chat.creditsExhaustedBanner.title"),e[19]=a,e[20]=V):V=e[20];let A;e[21]!==V?(A=o.jsx(Yt,{className:"text-xl font-semibold tracking-tight",children:V}),e[21]=V,e[22]=A):A=e[22];let E;e[23]!==a?(E=a("chat.creditsExhaustedBanner.description"),e[23]=a,e[24]=E):E=e[24];let R;e[25]!==E?(R=o.jsx(kn,{className:"mt-1.5 text-sm leading-relaxed",children:E}),e[25]=E,e[26]=R):R=e[26];let I;e[27]!==A||e[28]!==R?(I=o.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[T,o.jsxs(hs,{className:"relative gap-4",children:[N,o.jsxs("div",{children:[A,R]})]})]}),e[27]=A,e[28]=R,e[29]=I):I=e[29];let D;e[30]!==h||e[31]!==p||e[32]!==c||e[33]!==S||e[34]!==r||e[35]!==k||e[36]!==w||e[37]!==f||e[38]!==a||e[39]!==_?(D=r&&o.jsxs("div",{className:"px-8 pt-5 pb-6",children:[o.jsx("div",{className:"mb-4",children:o.jsxs(p9,{type:"single",variant:"outline",size:"sm",value:h,onValueChange:W=>{W&&m(W)},children:[o.jsx(Kc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),o.jsx(Kc,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),o.jsxs("div",{className:"rounded-xl border border-border p-5",children:[o.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:gD[h].map(W=>{const{dollars:G,labelKey:Y}=W;return o.jsxs("button",{type:"button",disabled:w,onClick:()=>{Ye("credits_topup_clicked",{amount_cents:G*100,currency:h,tier_label:Y,source:"exhausted_banner"}),_(G*100)},className:ie("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[o.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,G]}),o.jsx("span",{className:"text-xs text-muted-foreground",children:a(Y)})]},G)})}),f?o.jsxs("div",{className:"flex gap-2 mt-3",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),o.jsx(mt,{type:"number",min:"1",step:"1",placeholder:a("chat.creditsExhaustedBanner.customPlaceholder"),value:c,onChange:W=>d(W.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),o.jsx(ue,{className:"h-10",disabled:!k||w,onClick:()=>{Ye("credits_topup_clicked",{amount_cents:Math.round(S*100),currency:h,tier_label:"custom",source:"exhausted_banner"}),_(Math.round(S*100))},children:a(w?"chat.creditsExhaustedBanner.opening":"chat.creditsExhaustedBanner.add")})]}):o.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>u(!0),children:a("chat.creditsExhaustedBanner.enterCustom")})]}),o.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:xD.map(W=>o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:o.jsx(Ft,{size:12,className:"text-[hsl(var(--chart-1))]"})}),o.jsx("span",{className:"text-sm text-foreground/80",children:a(W)})]},W))})]}),e[30]=h,e[31]=p,e[32]=c,e[33]=S,e[34]=r,e[35]=k,e[36]=w,e[37]=f,e[38]=a,e[39]=_,e[40]=D):D=e[40];let O;e[41]!==a?(O=a("chat.creditsExhaustedBanner.dismiss"),e[41]=a,e[42]=O):O=e[42];let z;e[43]!==s||e[44]!==O?(z=o.jsx(ue,{variant:"ghost",size:"sm",onClick:s,children:O}),e[43]=s,e[44]=O,e[45]=z):z=e[45];let M;e[46]!==i||e[47]!==s||e[48]!==n.slug?(M=()=>{i({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=i,e[47]=s,e[48]=n.slug,e[49]=M):M=e[49];let $;e[50]!==a?($=a("chat.creditsExhaustedBanner.manageProviders"),e[50]=a,e[51]=$):$=e[51];let F;e[52]!==M||e[53]!==$?(F=o.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:M,children:$}),e[52]=M,e[53]=$,e[54]=F):F=e[54];let U;e[55]!==z||e[56]!==F?(U=o.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[z,F]}),e[55]=z,e[56]=F,e[57]=U):U=e[57];let H;e[58]!==I||e[59]!==D||e[60]!==U?(H=o.jsxs(Ut,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:bD,children:[I,D,U]}),e[58]=I,e[59]=D,e[60]=U,e[61]=H):H=e[61];let q;return e[62]!==H||e[63]!==j?(q=o.jsx(Ht,{open:!0,onOpenChange:j,children:H}),e[62]=H,e[63]=j,e[64]=q):q=e[64],q}function bD(t){return t.preventDefault()}const vD={trial_exhausted:{label:"chat.subscriptionLimit.trialLabel",title:"chat.subscriptionLimit.trialTitle"},monthly_exhausted:{label:"chat.subscriptionLimit.monthlyLabel",title:"chat.subscriptionLimit.monthlyTitle"},runs_exhausted:{label:"chat.subscriptionLimit.runsLabel",title:"chat.subscriptionLimit.runsTitle"}};function yD(t){const e=B.c(16),{kind:s,onDismiss:n,onSubscribe:i}=t,r=re(),{label:l,title:a}=vD[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(ua,{size:14}),e[0]=c):c=e[0];let d;e[1]!==l||e[2]!==r?(d=r(l),e[1]=l,e[2]=r,e[3]=d):d=e[3];let f;e[4]!==r||e[5]!==a?(f=r(a),e[4]=r,e[5]=a,e[6]=f):f=e[6];let u;e[7]!==s||e[8]!==i||e[9]!==r?(u=s==="trial_exhausted"?o.jsx(ue,{size:"sm",onClick:i,className:"h-7 text-xs",children:r("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=i,e[9]=r,e[10]=u):u=e[10];let h;return e[11]!==n||e[12]!==d||e[13]!==f||e[14]!==u?(h=o.jsx(al,{icon:c,label:d,title:f,defaultExpanded:!0,variant:"warning",onClose:n,footerRight:u}),e[11]=n,e[12]=d,e[13]=f,e[14]=u,e[15]=h):h=e[15],h}function _D(t){const e=t.trim(),s=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),n=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),i=/failed to fetch|networkerror|load failed|offline/i.test(e),r=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,a=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(a){const c=a[1]?.trim().replace(/\.$/,"");return{summary:c?`Your sandbox didn't finish starting up (${c}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return n||s&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:i?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:r?{summary:"That took longer than expected. Try again.",rawDetails:t}:s||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const LD={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function nh(t){const e=B.c(29),s=re(),{variant:n,onDismiss:i}=t,r=n==="error";let l;e[0]!==r||e[1]!==s?(l=s(r?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=r,e[1]=s,e[2]=l):l=e[2];const a=l,c=r?pn:so;let d;e[3]!==t.error||e[4]!==t.finishReason||e[5]!==t.variant||e[6]!==s?(d=t.variant==="error"?t.error.message:(()=>{const y=LD[t.finishReason];return y?s(y):s("chat.highlight.responseStoppedUnexpectedly",{reason:t.finishReason})})(),e[3]=t.error,e[4]=t.finishReason,e[5]=t.variant,e[6]=s,e[7]=d):d=e[7];const f=d;let u;e[8]!==r||e[9]!==f?(u=r?_D(f):{summary:f,rawDetails:null},e[8]=r,e[9]=f,e[10]=u):u=e[10];const{summary:h,rawDetails:m}=u;let p;e[11]!==c?(p=o.jsx(c,{size:14}),e[11]=c,e[12]=p):p=e[12];let g;e[13]!==r||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(g=r?o.jsx(ue,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):o.jsx(ue,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=r,e[14]=t.onContinue,e[15]=t.onFixInChat,e[16]=s,e[17]=g):g=e[17];let x;e[18]!==m||e[19]!==s?(x=m?o.jsxs("details",{className:"group mx-4",children:[o.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[o.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"m4.5 3 3 3-3 3"})}),o.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),o.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),o.jsxs("div",{className:"relative mt-2",children:[o.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(m).then(()=>xe.success(s("chat.highlight.copiedToClipboard"))).catch(()=>xe.error(s("chat.highlight.couldNotCopy")))},"aria-label":s("chat.highlight.copyErrorDetails"),title:s("chat.highlight.copy"),className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:o.jsx(an,{className:"size-3.5"})}),o.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:m})]})]}):null,e[18]=m,e[19]=s,e[20]=x):x=e[20];let b;return e[21]!==a||e[22]!==i||e[23]!==h||e[24]!==p||e[25]!==g||e[26]!==x||e[27]!==n?(b=o.jsx(al,{icon:p,label:a,title:h,defaultExpanded:!0,variant:n,onClose:i,footerRight:g,children:x}),e[21]=a,e[22]=i,e[23]=h,e[24]=p,e[25]=g,e[26]=x,e[27]=n,e[28]=b):b=e[28],b}function C9(){const t=B.c(73),e=re(),{error:s,clearError:n,finishReason:i,clearFinishReason:r,messages:l,isStreaming:a,submit:c,sendMessage:d}=ui(),[f,u]=br(),{virtualMcpId:h,createTaskWithMessage:m}=sn(),{chatMode:p,simpleModeTier:g}=la(),{mutate:x}=k8("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let b;t[0]!==x?(b=()=>x(),t[0]=x,t[1]=b):b=t[1];const y=b;let L;t[2]!==p||t[3]!==g||t[4]!==h?(L=le=>({tier:g,mode:p,toolApprovalLevel:le,agent:h?{id:h}:void 0}),t[2]=p,t[3]=g,t[4]=h,t[5]=L):L=t[5];const v=L;let _;t[6]!==f.toolApprovalLevel?(_=f.toolApprovalLevel??BN(),t[6]=f.toolApprovalLevel,t[7]=_):_=t[7];const w=_,S=l.at(-1),k=S?.role==="assistant"?S.parts:[],j=k.filter(jD),C=N7(k),T=j7(k);let N;t[8]!==s||t[9]!==d||t[10]!==e?(N=()=>{if(s){const ee={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(ee)}},t[8]=s,t[9]=d,t[10]=e,t[11]=N):N=t[11];const V=N;let A;t[12]!==d||t[13]!==e?(A=()=>{const le={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.pleaseContinue")}]}]};d(le)},t[12]=d,t[13]=e,t[14]=A):A=t[14];const E=A;let R;t[15]!==v||t[16]!==w||t[17]!==c?(R=(le,ee)=>{c({kind:"toolOutput",toolCallId:le.toolCallId,output:{response:ee}},v(w))},t[15]=v,t[16]=w,t[17]=c,t[18]=R):R=t[18];const I=R;let D;t[19]!==m||t[20]!==f||t[21]!==u||t[22]!==e||t[23]!==h?(D=le=>{u({...f,toolApprovalLevel:"auto"}),m({virtualMcpId:h,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:le})}]}})},t[19]=m,t[20]=f,t[21]=u,t[22]=e,t[23]=h,t[24]=D):D=t[24];const O=D,z=kD;let M;t[25]!==v||t[26]!==c?(M=(le,ee,ae,ce)=>{c({kind:"approval",approvalId:le,approved:ee,...ae?{reason:ae}:{}},v(ce))},t[25]=v,t[26]=c,t[27]=M):M=t[27];const $=M,F=V7();if(F.isCreditExhausted){let le;return t[28]!==n?(le=o.jsx(F7,{onDismiss:n}),t[28]=n,t[29]=le):le=t[29],le}const{showError:U,showWarning:H,hasApprovals:q}=F,W=j.map(SD).join("|"),G=C7(C)?.toolCallId??"",Y=T.map(wD).join("|");let J;t[30]!==F.todos?(J=o.jsx(uD,{todos:F.todos}),t[30]=F.todos,t[31]=J):J=t[31];let se;t[32]!==n||t[33]!==F.subscriptionErrorKind||t[34]!==y?(se=F.subscriptionErrorKind&&o.jsx(yD,{kind:F.subscriptionErrorKind,onDismiss:n,onSubscribe:y}),t[32]=n,t[33]=F.subscriptionErrorKind,t[34]=y,t[35]=se):se=t[35];let oe;t[36]!==n||t[37]!==s||t[38]!==V||t[39]!==U?(oe=U&&o.jsx(nh,{variant:"error",error:s,onDismiss:n,onFixInChat:V}),t[36]=n,t[37]=s,t[38]=V,t[39]=U,t[40]=oe):oe=t[40];let ne;t[41]!==r||t[42]!==i||t[43]!==E||t[44]!==H?(ne=H&&o.jsx(nh,{variant:"warning",finishReason:i,onDismiss:r,onContinue:E}),t[41]=r,t[42]=i,t[43]=E,t[44]=H,t[45]=ne):ne=t[45];let Q;t[46]!==Y||t[47]!==$||t[48]!==q||t[49]!==a||t[50]!==T?(Q=q&&o.jsx(qR,{approvals:T,isStreaming:a,onRespond:$},Y),t[46]=Y,t[47]=$,t[48]=q,t[49]=a,t[50]=T,t[51]=Q):Q=t[51];let K;t[52]!==F.hasPlans||t[53]!==O||t[54]!==z||t[55]!==a||t[56]!==C||t[57]!==G?(K=F.hasPlans&&o.jsx(YR,{plans:C,isStreaming:a,onApprove:O,onDismiss:z},G),t[52]=F.hasPlans,t[53]=O,t[54]=z,t[55]=a,t[56]=C,t[57]=G,t[58]=K):K=t[58];let X;t[59]!==F.isWaitingForUserInput||t[60]!==I||t[61]!==a||t[62]!==W||t[63]!==j?(X=F.isWaitingForUserInput&&o.jsx(z7,{userAskParts:j,isStreaming:a,onSubmit:I},W),t[59]=F.isWaitingForUserInput,t[60]=I,t[61]=a,t[62]=W,t[63]=j,t[64]=X):X=t[64];let Z;return t[65]!==oe||t[66]!==ne||t[67]!==Q||t[68]!==K||t[69]!==X||t[70]!==J||t[71]!==se?(Z=o.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[J,se,oe,ne,Q,K,X]}),t[65]=oe,t[66]=ne,t[67]=Q,t[68]=K,t[69]=X,t[70]=J,t[71]=se,t[72]=Z):Z=t[72],Z}function wD(t){return t.approvalId}function SD(t){return t.toolCallId}function kD(){document.querySelector("[data-chat-input]")?.focus()}function jD(t){return t.type==="tool-user_ask"}C9.Error=function(e){return o.jsx(nh,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};C9.Warning=function(e){return o.jsx(nh,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};C9.UserAskQuestion=z7;function CD(t){const e=B.c(20),{taskId:s}=t,n=re(),i=B6(s),r=CT(i),l=NT(),{stop:a,removeLocalMessage:c}=ui();if(r.length===0)return null;let d;e[0]!==n?(d=n("chat.queueTray.sendNow"),e[0]=n,e[1]=d):d=e[1];let f;e[2]!==a?(f=()=>{a()},e[2]=a,e[3]=f):f=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Jh,{size:14}),e[4]=u):u=e[4];let h;e[5]!==d||e[6]!==f?(h=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:f,children:u})}),e[5]=d,e[6]=f,e[7]=h):h=e[7];let m;e[8]!==n?(m=n("chat.queueTray.sendNow"),e[8]=n,e[9]=m):m=e[9];let p;e[10]!==m?(p=o.jsx(We,{side:"top",children:o.jsx("p",{className:"text-xs",children:m})}),e[10]=m,e[11]=p):p=e[11];let g;e[12]!==h||e[13]!==p?(g=o.jsxs(qe,{delayDuration:400,children:[h,p]}),e[12]=h,e[13]=p,e[14]=g):g=e[14];let x;return e[15]!==l||e[16]!==c||e[17]!==n||e[18]!==s?(x=(b,y)=>o.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[o.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:y+1}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.text}),o.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/queuerow:opacity-100",children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm",title:n("chat.queueTray.removeFromQueue"),"aria-label":n("chat.queueTray.removeFromQueue"),onClick:()=>{l.cancel(s,b.messageId).then(L=>{L&&(TT(s,b.messageId),c(b.messageId))})},children:o.jsx(Ci,{className:"size-3.5"})})})]},b.messageId),e[15]=l,e[16]=c,e[17]=n,e[18]=s,e[19]=x):x=e[19],o.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[o.jsx("span",{children:n(r.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:r.length})}),g]}),r.map(x)]})}function ND(t,e){return t?{modelId:t.modelId,title:t.title??t.modelId,keyId:t.keyId,providerId:e,description:null,logo:null,capabilities:[],limits:null,costs:null}:null}const TD={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function VD(t){const e=B.c(31),{tier:s,orgSlot:n,userSlot:i,autoSlot:r,onPick:l,onReset:a,onClose:c}=t,d=re(),f=v9(),u=new Set(f.map(AD)),h=VT([i,n,r],u),m=h?.keyId??null,[p,g]=P.useState(m??f[0]?.id??null),x=f.some(D=>D.id===p)?p:m??f[0]?.id??null,b=x?f.find(D=>D.id===x):null,y="flex h-[70vh] max-h-[460px] w-full flex-col",L=TD[s];let v;e[0]!==d||e[1]!==L?(v=d(L),e[0]=d,e[1]=L,e[2]=v):v=e[2];let _;e[3]!==v?(_=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:v}),e[3]=v,e[4]=_):_=e[4];let w;e[5]!==a||e[6]!==d||e[7]!==i?(w=i&&o.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent cursor-pointer",children:d("chat.modelPreferences.reset")}),e[5]=a,e[6]=d,e[7]=i,e[8]=w):w=e[8];let S;e[9]!==_||e[10]!==w?(S=o.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[_,w]}),e[9]=_,e[10]=w,e[11]=S):S=e[11];const k="flex-1 min-h-0",j=P.Suspense;let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(oP,{}),e[12]=C):C=e[12];const T=rP,N=!0,V=ND(m?h:null,b?.providerId??"deco");let A;e[13]!==x||e[14]!==l||e[15]!==g?(A=D=>{const O=D.keyId??x??"";g(O),l({keyId:O,modelId:D.modelId,title:D.title})},e[13]=x,e[14]=l,e[15]=g,e[16]=A):A=e[16];let E;e[17]!==T||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==V||e[22]!==A?(E=o.jsx(T,{compact:N,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:V,onModelChange:A}),e[17]=T,e[18]=x,e[19]=c,e[20]=g,e[21]=V,e[22]=A,e[23]=E):E=e[23];let R;e[24]!==j||e[25]!==E||e[26]!==C?(R=o.jsx("div",{className:k,children:o.jsx(j,{fallback:C,children:E})}),e[24]=j,e[25]=E,e[26]=C,e[27]=R):R=e[27];let I;return e[28]!==R||e[29]!==S?(I=o.jsxs("div",{className:y,children:[S,R]}),e[28]=R,e[29]=S,e[30]=I):I=e[30],I}function AD(t){return t.id}const PD=["fast","smart","thinking"];function U7(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const ED={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function RD(t){const e=B.c(28),{tier:s,pillIcon:n,groups:i}=t,r=re();let l;e[0]!==r?(l=U7(r),e[0]=r,e[1]=l):l=e[1];const a=l,[c,d]=P.useState(!1);let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=k=>{k.onSelect(),d(!1)},e[2]=f):f=e[2];const u=f,h=a[s];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[3]=m):m=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[4]=p):p=e[4];const g=a[s];let x;e[5]!==g?(x=o.jsx("span",{className:p,children:g}),e[5]=g,e[6]=x):x=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Qt,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=b):b=e[7];let y;e[8]!==n||e[9]!==h||e[10]!==x?(y=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"inline-flex min-w-0 shrink",children:o.jsx(ns,{asChild:!0,children:o.jsxs(ue,{type:"button",variant:"ghost",size:"default","aria-label":h,className:m,children:[n,x,b]})})})}),e[8]=n,e[9]=h,e[10]=x,e[11]=y):y=e[11];let L;e[12]!==h?(L=o.jsx(We,{children:h}),e[12]=h,e[13]=L):L=e[13];let v;e[14]!==y||e[15]!==L?(v=o.jsxs(qe,{children:[y,L]}),e[14]=y,e[15]=L,e[16]=v):v=e[16];let _;if(e[17]!==i||e[18]!==r){let k;e[20]!==r?(k=j=>o.jsx("div",{className:"flex flex-col",children:j.rows.map(C=>o.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-md hover:bg-muted",children:[o.jsxs("button",{type:"button",role:"menuitem","aria-label":C.title,onClick:()=>u(C),className:ie("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",C.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[C.icon&&o.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:C.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-sm",children:C.title}),C.subtitle&&o.jsx("div",{className:"text-xs text-muted-foreground",children:C.subtitle})]}),C.active&&o.jsx("span",{title:r("chat.tierTrigger.selected"),children:o.jsx(Ft,{size:14,className:"text-foreground mt-0.5"})})]}),C.modelOverride&&o.jsx(ID,{label:C.title,render:C.modelOverride})]},C.key))},j.key),e[20]=r,e[21]=k):k=e[21],_=i.map(k),e[17]=i,e[18]=r,e[19]=_}else _=e[19];let w;e[22]!==_?(w=o.jsx(is,{align:"end",className:"p-1 w-64",onOpenAutoFocus:DD,children:o.jsx("div",{role:"menu",className:"flex flex-col",children:_})}),e[22]=_,e[23]=w):w=e[23];let S;return e[24]!==c||e[25]!==v||e[26]!==w?(S=o.jsxs(rs,{open:c,onOpenChange:d,children:[v,w]}),e[24]=c,e[25]=v,e[26]=w,e[27]=S):S=e[27],S}function DD(t){return t.preventDefault()}function ID(t){const e=B.c(38),{label:s,render:n}=t,i=re(),r=fl(),[l,a]=P.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(!1),e[0]=c):c=e[0];const d=c;let f;e[1]!==s||e[2]!==i?(f=i("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=i,e[3]=f):f=e[3];const u=l&&"opacity-100";let h;e[4]!==u?(h=ie("absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center","size-6 rounded-md bg-background border border-border/60 shadow-sm","text-muted-foreground hover:text-foreground","opacity-100 [@media(hover:hover)]:opacity-0","[@media(hover:hover)]:group-hover/tier-row:opacity-100","[@media(hover:hover)]:group-focus-within/tier-row:opacity-100",u),e[4]=u,e[5]=h):h=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(lg,{size:14}),e[6]=m):m=e[6];let p;e[7]!==f||e[8]!==h?(p=o.jsx("button",{type:"button","aria-label":f,className:h,children:m}),e[7]=f,e[8]=h,e[9]=p):p=e[9];const g=p;if(r){let v;e[10]!==g?(v=o.jsx(X6,{asChild:!0,children:g}),e[10]=g,e[11]=v):v=e[11];let _;e[12]!==s||e[13]!==i?(_=i("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=i,e[14]=_):_=e[14];let w;e[15]!==_?(w=o.jsx(s9,{className:"sr-only",children:_}),e[15]=_,e[16]=w):w=e[16];let S;e[17]!==l||e[18]!==n?(S=l&&n(d),e[17]=l,e[18]=n,e[19]=S):S=e[19];let k;e[20]!==S||e[21]!==w?(k=o.jsxs(n9,{className:"p-0 flex flex-col max-h-[95vh]",children:[w,S]}),e[20]=S,e[21]=w,e[22]=k):k=e[22];let j;return e[23]!==l||e[24]!==k||e[25]!==v?(j=o.jsxs(i9,{open:l,onOpenChange:a,children:[v,k]}),e[23]=l,e[24]=k,e[25]=v,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=o.jsx(ns,{asChild:!0,children:g}),e[27]=g,e[28]=x):x=e[28];let b;e[29]!==l||e[30]!==n?(b=l&&n(d),e[29]=l,e[30]=n,e[31]=b):b=e[31];let y;e[32]!==b?(y=o.jsx(is,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:b}),e[32]=b,e[33]=y):y=e[33];let L;return e[34]!==l||e[35]!==x||e[36]!==y?(L=o.jsxs(rs,{open:l,onOpenChange:a,children:[x,y]}),e[34]=l,e[35]=x,e[36]=y,e[37]=L):L=e[37],L}function N4(t){return t==="fast"?o.jsx(ua,{size:16}):t==="thinking"?o.jsx(o8,{size:16}):o.jsx(Wr,{size:16})}function MD(t){const e=B.c(13),s=ET();let n;e[0]!==t||e[1]!==s.tiers?(n=d=>{const f=s.tiers[d];return f?f.title??f.modelId:t.chat[d]?.title},e[0]=t,e[1]=s.tiers,e[2]=n):n=e[2];const i=n;let r;e[3]!==i?(r=i("fast"),e[3]=i,e[4]=r):r=e[4];let l;e[5]!==i?(l=i("smart"),e[5]=i,e[6]=l):l=e[6];let a;e[7]!==i?(a=i("thinking"),e[7]=i,e[8]=a):a=e[8];let c;return e[9]!==r||e[10]!==l||e[11]!==a?(c={fast:r,smart:l,thinking:a},e[9]=r,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function OD(){const t=B.c(22),e=re(),{simpleModeTier:s,setSimpleModeTier:n}=la(),i=fP(),r=v9(),l=hP(r),a=MD(l),{data:c,error:d}=AT();let f;t[0]!==c?(f=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=f):f=t[1];const u=f,h=PT();let m,p;if(t[2]!==l||t[3]!==i||t[4]!==n||t[5]!==e||t[6]!==s||t[7]!==a||t[8]!==h||t[9]!==u||t[10]!==d){const L=U7(e);m="decopilot",p=PD.map(v=>{const _=a[v],w=u.tiers[v];return{key:`decopilot-${v}`,icon:N4(v),title:L[v],subtitle:_??e(ED[v]),active:s===v,onSelect:()=>n(v),modelOverride:S=>o.jsxs(o.Fragment,{children:[d&&o.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),o.jsx(VD,{tier:v,orgSlot:i.tiers[v],userSlot:w,autoSlot:l.chat[v],onClose:S,onPick:k=>h.mutate({tier:v,slot:k}),onReset:()=>h.mutate({tier:v,slot:null})},`${v}:${w?.keyId??"org"}:${w?.modelId??""}`)]})}}),t[2]=l,t[3]=i,t[4]=n,t[5]=e,t[6]=s,t[7]=a,t[8]=h,t[9]=u,t[10]=d,t[11]=m,t[12]=p}else m=t[11],p=t[12];let g;t[13]!==m||t[14]!==p?(g=[{key:m,rows:p}],t[13]=m,t[14]=p,t[15]=g):g=t[15];const x=g;let b;t[16]!==s?(b=N4(s),t[16]=s,t[17]=b):b=t[17];let y;return t[18]!==x||t[19]!==b||t[20]!==s?(y=o.jsx(RD,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=y):y=t[21],y}async function Kg(t,e,s,n,i,r){if(!g9(e)){xe.error("Selected model does not support file uploads");return}const l=s.type||"application/octet-stream";if(!lP(l,e)){const c=j8(e).parts.map(f=>r(f)).join(", "),d=e?.title??"This model";i?i({fileName:s.name,modelName:d,accepted:c}):xe.error(`"${s.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){xe.error(`File "${s.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((h,m)=>{c.onload=()=>{const p=c.result;if(typeof p!="string"){m(new Error("Failed to read file as data URL"));return}const g=p.includes(",")?p.split(",")[1]??p:p;h(g)},c.onerror=m});c.readAsDataURL(s);const f=await d,u={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:f};HT(t,{from:n,to:n},u)}catch(c){console.error("Failed to process file:",c),xe.error(`Failed to load file "${s.name}"`)}}function $D(t){const e=B.c(9),{editor:s,selectedModel:n,onUnsupportedFile:i}=t,r=re(),l=P.useRef(zD);let a,c;e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==r?(a=()=>{l.current=async(u,h)=>{await Kg(s,n,u,h,i,r)}},c=[s,n,i,r],e[0]=s,e[1]=i,e[2]=n,e[3]=r,e[4]=a,e[5]=c):(a=e[4],c=e[5]),P.useEffect(a,c);let d,f;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const u=new ji("fileDropHandler");s.state.plugins.find(p=>p.spec.key===u)&&s.unregisterPlugin(u);const m=new rd({key:u,props:{handleDrop:(p,g,x,b)=>{if(b)return!1;const y=g.dataTransfer?.files;if(!y||y.length===0)return!1;g.preventDefault();const L=p.posAtCoords({left:g.clientX,top:g.clientY});if(!L)return!1;const v=Array.from(y);return(async()=>{let _=L.pos;for(const w of v)await l.current?.(w,_),_=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(BD);return b.length===0?!1:(g.preventDefault(),(async()=>{let y=p.state.selection.from;for(const L of b){const v=L.getAsFile();v&&(await l.current?.(v,y),y=p.state.selection.to)}})(),!0)}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(u)}},f=[s],e[6]=s,e[7]=d,e[8]=f):(d=e[7],f=e[8]),P.useEffect(d,f),null}function BD(t){return t.kind==="file"}function zD(){return Promise.resolve()}function FD(t){const e=B.c(43),{info:s,onClose:n}=t,i=re(),r=s!==null;let l;e[0]!==n?(l=N=>!N&&n(),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=a):a=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:a.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-warning/15 text-warning",children:o.jsx(so,{size:18})}),e[4]=d):d=e[4];let f;e[5]!==i?(f=i("chat.uploader.fileTypeNotSupported"),e[5]=i,e[6]=f):f=e[6];let u;e[7]!==f?(u=o.jsx(Yt,{className:"text-xl font-semibold tracking-tight",children:f}),e[7]=f,e[8]=u):u=e[8];const h=s?.fileName;let m;e[9]!==h?(m=o.jsxs("span",{className:"font-medium text-foreground",children:["“",h,"”"]}),e[9]=h,e[10]=m):m=e[10];let p;e[11]!==i?(p=i("chat.uploader.cantAttachToChat"),e[11]=i,e[12]=p):p=e[12];let g;e[13]!==p||e[14]!==m?(g=o.jsxs(kn,{className:"mt-1.5 text-sm leading-relaxed",children:[m," ",p]}),e[13]=p,e[14]=m,e[15]=g):g=e[15];let x;e[16]!==g||e[17]!==u?(x=o.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,o.jsxs(hs,{className:"relative gap-4",children:[d,o.jsxs("div",{children:[u,g]})]})]}),e[16]=g,e[17]=u,e[18]=x):x=e[18];const b=s?.modelName??"";let y;e[19]!==i||e[20]!==b?(y=i("chat.uploader.accepts",{modelName:b}),e[19]=i,e[20]=b,e[21]=y):y=e[21];let L;e[22]!==y?(L=o.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:y}),e[22]=y,e[23]=L):L=e[23];let v;e[24]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(l8,{size:14,className:"text-muted-foreground"}),e[24]=v):v=e[24];const _=s?.accepted;let w;e[25]!==_?(w=o.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[v,o.jsx("span",{className:"capitalize",children:_})]}),e[25]=_,e[26]=w):w=e[26];let S;e[27]!==L||e[28]!==w?(S=o.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:o.jsxs("div",{className:"rounded-xl border border-border p-4",children:[L,w]})}),e[27]=L,e[28]=w,e[29]=S):S=e[29];let k;e[30]!==i?(k=i("chat.uploader.gotIt"),e[30]=i,e[31]=k):k=e[31];let j;e[32]!==n||e[33]!==k?(j=o.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:o.jsx(ue,{onClick:n,children:k})}),e[32]=n,e[33]=k,e[34]=j):j=e[34];let C;e[35]!==x||e[36]!==S||e[37]!==j?(C=o.jsxs(Ut,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:UD,children:[x,S,j]}),e[35]=x,e[36]=S,e[37]=j,e[38]=C):C=e[38];let T;return e[39]!==r||e[40]!==l||e[41]!==C?(T=o.jsx(Ht,{open:r,onOpenChange:l,children:C}),e[39]=r,e[40]=l,e[41]=C,e[42]=T):T=e[42],T}function UD(t){return t.preventDefault()}function HD(){const t=B.c(3),[e,s]=P.useState(null);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>s(null),t[0]=n):n=t[0];let i;return t[1]!==e?(i={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:n},t[1]=e,t[2]=i):i=t[2],i}var Wg=KT;var KD=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Gm=KD.join(","),H7=typeof Element>"u",Ou=H7?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ih=!H7&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},rh=function(e,s){var n;s===void 0&&(s=!0);var i=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),r=i===""||i==="true",l=r||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):rh(e.parentNode));return l},WD=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},qD=function(e,s,n){if(rh(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(Gm));return s&&Ou.call(e,Gm)&&i.unshift(e),i=i.filter(n),i},Ym=function(e,s,n){for(var i=[],r=Array.from(e);r.length;){var l=r.shift();if(!rh(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),c=a.length?a:l.children,d=Ym(c,!0,n);n.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{var f=Ou.call(l,Gm);f&&n.filter(l)&&(s||!e.includes(l))&&i.push(l);var u=l.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(l),h=!rh(u,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(l));if(u&&h){var m=Ym(u===!0?l.children:u.children,!0,n);n.flatten?i.push.apply(i,m):i.push({scopeParent:l,candidates:m})}else r.unshift.apply(r,l.children)}}return i},K7=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},W7=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||WD(e))&&!K7(e)?0:e.tabIndex},GD=function(e,s){var n=W7(e);return n<0&&s&&!K7(e)?0:n},YD=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},q7=function(e){return e.tagName==="INPUT"},JD=function(e){return q7(e)&&e.type==="hidden"},QD=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},XD=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},ZD=function(e){if(!e.name)return!0;var s=e.form||ih(e),n=function(a){return s.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(e.name));else try{i=n(e.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var r=XD(i,e.form);return!r||r===e},eI=function(e){return q7(e)&&e.type==="radio"},tI=function(e){return eI(e)&&!ZD(e)},sI=function(e){var s,n=e&&ih(e),i=(s=n)===null||s===void 0?void 0:s.host,r=!1;if(n&&n!==e){var l,a,c;for(r=!!((l=i)!==null&&l!==void 0&&(a=l.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!r&&i;){var d,f,u;n=ih(i),i=(d=n)===null||d===void 0?void 0:d.host,r=!!((f=i)!==null&&f!==void 0&&(u=f.ownerDocument)!==null&&u!==void 0&&u.contains(i))}}return r},T4=function(e){var s=e.getBoundingClientRect(),n=s.width,i=s.height;return n===0&&i===0},nI=function(e,s){var n=s.displayCheck,i=s.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var r=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!r}if(getComputedStyle(e).visibility==="hidden")return!0;var l=Ou.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(Ou.call(a,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof i=="function"){for(var c=e;e;){var d=e.parentElement,f=ih(e);if(d&&!d.shadowRoot&&i(d)===!0)return T4(e);e.assignedSlot?e=e.assignedSlot:!d&&f!==e.ownerDocument?e=f.host:e=d}e=c}if(sI(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return T4(e);return!1},iI=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var n=0;n<s.children.length;n++){var i=s.children.item(n);if(i.tagName==="LEGEND")return Ou.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},rI=function(e,s){return!(s.disabled||JD(s)||nI(s,e)||QD(s)||iI(s))},V4=function(e,s){return!(tI(s)||W7(s)<0||!rI(e,s))},oI=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},G7=function(e){var s=[],n=[];return e.forEach(function(i,r){var l=!!i.scopeParent,a=l?i.scopeParent:i,c=GD(a,l),d=l?G7(i.candidates):a;c===0?l?s.push.apply(s,d):s.push(a):n.push({documentOrder:r,tabIndex:c,item:i,isScope:l,content:d})}),n.sort(YD).reduce(function(i,r){return r.isScope?i.push.apply(i,r.content):i.push(r.content),i},[]).concat(s)},Y7=function(e,s){s=s||{};var n;return s.getShadowRoot?n=Ym([e],s.includeContainer,{filter:V4.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:oI}):n=qD(e,s.includeContainer,V4.bind(null,s)),G7(n)};function lI(){return/apple/i.test(navigator.vendor)}const A4="data-floating-ui-focusable";function aI(t){let e=t.activeElement;for(;((s=e)==null||(s=s.shadowRoot)==null?void 0:s.activeElement)!=null;){var s;e=e.shadowRoot.activeElement}return e}function Jm(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&zN(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function Ed(t){return"composedPath"in t?t.composedPath()[0]:t.target}function V1(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const s=t;return s.target!=null&&e.contains(s.target)}function cI(t){return t.matches("html,body")}function $u(t){return t?.ownerDocument||document}function dI(t){return t?t.hasAttribute(A4)?t:t.querySelector("["+A4+"]")||t:null}function Df(t,e,s){return s===void 0&&(s=!0),t.filter(i=>{var r;return i.parentId===e&&(!s||((r=i.context)==null?void 0:r.open))}).flatMap(i=>[i,...Df(t,i.id,s)])}function uI(t){return"nativeEvent"in t}var fI=typeof document<"u",hI=function(){},$l=fI?P.useLayoutEffect:hI;const mI={...p6},pI=mI.useInsertionEffect,gI=pI||(t=>t());function wc(t){const e=P.useRef(()=>{});return gI(()=>{e.current=t}),P.useCallback(function(){for(var s=arguments.length,n=new Array(s),i=0;i<s;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}const J7=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Q7(t,e){const s=Y7(t,J7()),n=s.length;if(n===0)return;const i=aI($u(t)),r=s.indexOf(i),l=r===-1?e===1?0:n-1:r+e;return s[l]}function xI(t){return Q7($u(t).body,1)||t}function bI(t){return Q7($u(t).body,-1)||t}function A1(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!Jm(s,n)}function vI(t){Y7(t,J7()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function P4(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const n=s.dataset.tabindex;delete s.dataset.tabindex,n?s.setAttribute("tabindex",n):s.removeAttribute("tabindex")})}const yI="data-floating-ui-focusable",E4="active",R4="selected",_I={...p6};let D4=!1,LI=0;const I4=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+LI++;function wI(){const[t,e]=P.useState(()=>D4?I4():void 0);return $l(()=>{t==null&&e(I4())},[]),P.useEffect(()=>{D4=!0},[]),t}const SI=_I.useId,qg=SI||wI;function kI(){const t=new Map;return{emit(e,s){var n;(n=t.get(e))==null||n.forEach(i=>i(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var n;(n=t.get(e))==null||n.delete(s)}}}const jI=P.createContext(null),CI=P.createContext(null),X7=()=>{var t;return((t=P.useContext(jI))==null?void 0:t.id)||null},Z7=()=>P.useContext(CI);function Gg(t){return"data-floating-ui-"+t}const NI={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},M4=P.forwardRef(function(e,s){const[n,i]=P.useState();$l(()=>{lI()&&i("button")},[]);const r={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[Gg("focus-guard")]:"",style:NI};return o.jsx("span",{...e,...r})}),TI={clipPath:"inset(50%)",position:"fixed",top:0,left:0},e_=P.createContext(null),O4=Gg("portal");function VI(t){t===void 0&&(t={});const{id:e,root:s}=t,n=qg(),i=PI(),[r,l]=P.useState(null),a=P.useRef(null);return $l(()=>()=>{r?.remove(),queueMicrotask(()=>{a.current=null})},[r]),$l(()=>{if(!n||a.current)return;const c=e?document.getElementById(e):null;if(!c)return;const d=document.createElement("div");d.id=n,d.setAttribute(O4,""),c.appendChild(d),a.current=d,l(d)},[e,n]),$l(()=>{if(s===null||!n||a.current)return;let c=s||i?.portalNode;c&&!qN(c)&&(c=c.current),c=c||document.body;let d=null;e&&(d=document.createElement("div"),d.id=e,c.appendChild(d));const f=document.createElement("div");f.id=n,f.setAttribute(O4,""),c=d||c,c.appendChild(f),a.current=f,l(f)},[e,s,n,i]),r}function AI(t){const{children:e,id:s,root:n,preserveTabOrder:i=!0}=t,r=VI({id:s,root:n}),[l,a]=P.useState(null),c=P.useRef(null),d=P.useRef(null),f=P.useRef(null),u=P.useRef(null),h=l?.modal,m=l?.open,p=!!l&&!l.modal&&l.open&&i&&!!(n||r);return P.useEffect(()=>{if(!r||!i||h)return;function g(x){r&&A1(x)&&(x.type==="focusin"?P4:vI)(r)}return r.addEventListener("focusin",g,!0),r.addEventListener("focusout",g,!0),()=>{r.removeEventListener("focusin",g,!0),r.removeEventListener("focusout",g,!0)}},[r,i,h]),P.useEffect(()=>{r&&(m||P4(r))},[m,r]),o.jsxs(e_.Provider,{value:P.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:f,afterInsideRef:u,portalNode:r,setFocusManagerState:a}),[i,r]),children:[p&&r&&o.jsx(M4,{"data-type":"outside",ref:c,onFocus:g=>{if(A1(g,r)){var x;(x=f.current)==null||x.focus()}else{const b=l?l.domReference:null,y=bI(b);y?.focus()}}}),p&&r&&o.jsx("span",{"aria-owns":r.id,style:TI}),r&&_n.createPortal(e,r),p&&r&&o.jsx(M4,{"data-type":"outside",ref:d,onFocus:g=>{if(A1(g,r)){var x;(x=u.current)==null||x.focus()}else{const b=l?l.domReference:null,y=xI(b);y?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const PI=()=>P.useContext(e_),EI={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},RI={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},$4=t=>{var e,s;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(s=t?.outsidePress)!=null?s:!0}};function DI(t,e){e===void 0&&(e={});const{open:s,onOpenChange:n,elements:i,dataRef:r}=t,{enabled:l=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:f=!1,referencePressEvent:u="pointerdown",ancestorScroll:h=!1,bubbles:m,capture:p}=e,g=Z7(),x=wc(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,y=P.useRef(!1),{escapeKey:L,outsidePress:v}=$4(m),{escapeKey:_,outsidePress:w}=$4(p),S=P.useRef(!1),k=wc(A=>{var E;if(!s||!l||!a||A.key!=="Escape"||S.current)return;const R=(E=r.current.floatingContext)==null?void 0:E.nodeId,I=g?Df(g.nodesRef.current,R):[];if(!L&&(A.stopPropagation(),I.length>0)){let D=!0;if(I.forEach(O=>{var z;if((z=O.context)!=null&&z.open&&!O.context.dataRef.current.__escapeKeyBubbles){D=!1;return}}),!D)return}n(!1,uI(A)?A.nativeEvent:A,"escape-key")}),j=wc(A=>{var E;const R=()=>{var I;k(A),(I=Ed(A))==null||I.removeEventListener("keydown",R)};(E=Ed(A))==null||E.addEventListener("keydown",R)}),C=wc(A=>{var E;const R=r.current.insideReactTree;r.current.insideReactTree=!1;const I=y.current;if(y.current=!1,d==="click"&&I||R||typeof b=="function"&&!b(A))return;const D=Ed(A),O="["+Gg("inert")+"]",z=$u(i.floating).querySelectorAll(O);let M=Qi(D)?D:null;for(;M&&!j1(M);){const H=HN(M);if(j1(H)||!Qi(H))break;M=H}if(z.length&&Qi(D)&&!cI(D)&&!Jm(D,i.floating)&&Array.from(z).every(H=>!Jm(M,H)))return;if(KN(D)&&V){const H=j1(D),q=WN(D),W=/auto|scroll/,G=H||W.test(q.overflowX),Y=H||W.test(q.overflowY),J=G&&D.clientWidth>0&&D.scrollWidth>D.clientWidth,se=Y&&D.clientHeight>0&&D.scrollHeight>D.clientHeight,oe=q.direction==="rtl",ne=se&&(oe?A.offsetX<=D.offsetWidth-D.clientWidth:A.offsetX>D.clientWidth),Q=J&&A.offsetY>D.clientHeight;if(ne||Q)return}const $=(E=r.current.floatingContext)==null?void 0:E.nodeId,F=g&&Df(g.nodesRef.current,$).some(H=>{var q;return V1(A,(q=H.context)==null?void 0:q.elements.floating)});if(V1(A,i.floating)||V1(A,i.domReference)||F)return;const U=g?Df(g.nodesRef.current,$):[];if(U.length>0){let H=!0;if(U.forEach(q=>{var W;if((W=q.context)!=null&&W.open&&!q.context.dataRef.current.__outsidePressBubbles){H=!1;return}}),!H)return}n(!1,A,"outside-press")}),T=wc(A=>{var E;const R=()=>{var I;C(A),(I=Ed(A))==null||I.removeEventListener(d,R)};(E=Ed(A))==null||E.addEventListener(d,R)});P.useEffect(()=>{if(!s||!l)return;r.current.__escapeKeyBubbles=L,r.current.__outsidePressBubbles=v;let A=-1;function E(z){n(!1,z,"ancestor-scroll")}function R(){window.clearTimeout(A),S.current=!0}function I(){A=window.setTimeout(()=>{S.current=!1},UN()?5:0)}const D=$u(i.floating);a&&(D.addEventListener("keydown",_?j:k,_),D.addEventListener("compositionstart",R),D.addEventListener("compositionend",I)),b&&D.addEventListener(d,w?T:C,w);let O=[];return h&&(Qi(i.domReference)&&(O=k1(i.domReference)),Qi(i.floating)&&(O=O.concat(k1(i.floating))),!Qi(i.reference)&&i.reference&&i.reference.contextElement&&(O=O.concat(k1(i.reference.contextElement)))),O=O.filter(z=>{var M;return z!==((M=D.defaultView)==null?void 0:M.visualViewport)}),O.forEach(z=>{z.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(D.removeEventListener("keydown",_?j:k,_),D.removeEventListener("compositionstart",R),D.removeEventListener("compositionend",I)),b&&D.removeEventListener(d,w?T:C,w),O.forEach(z=>{z.removeEventListener("scroll",E)}),window.clearTimeout(A)}},[r,i,a,b,d,s,n,h,l,L,v,k,_,j,C,w,T]),P.useEffect(()=>{r.current.insideReactTree=!1},[r,b,d]);const N=P.useMemo(()=>({onKeyDown:k,...f&&{[EI[u]]:A=>{n(!1,A.nativeEvent,"reference-press")},...u!=="click"&&{onClick(A){n(!1,A.nativeEvent,"reference-press")}}}}),[k,n,f,u]),V=P.useMemo(()=>{function A(E){E.button===0&&(y.current=!0)}return{onKeyDown:k,onMouseDown:A,onMouseUp:A,[RI[d]]:()=>{r.current.insideReactTree=!0}}},[k,d,r]);return P.useMemo(()=>l?{reference:N,floating:V}:{},[l,N,V])}function II(t){const{open:e=!1,onOpenChange:s,elements:n}=t,i=qg(),r=P.useRef({}),[l]=P.useState(()=>kI()),a=X7()!=null,[c,d]=P.useState(n.reference),f=wc((m,p,g)=>{r.current.openEvent=m?p:void 0,l.emit("openchange",{open:m,event:p,reason:g,nested:a}),s?.(m,p,g)}),u=P.useMemo(()=>({setPositionReference:d}),[]),h=P.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return P.useMemo(()=>({dataRef:r,open:e,onOpenChange:f,elements:h,events:l,floatingId:i,refs:u}),[e,f,h,l,i,u])}function MI(t){t===void 0&&(t={});const{nodeId:e}=t,s=II({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,i=n.elements,[r,l]=P.useState(null),[a,c]=P.useState(null),f=i?.domReference||r,u=P.useRef(null),h=Z7();$l(()=>{f&&(u.current=f)},[f]);const m=FN({...t,elements:{...i,...a&&{reference:a}}}),p=P.useCallback(L=>{const v=Qi(L)?{getBoundingClientRect:()=>L.getBoundingClientRect(),getClientRects:()=>L.getClientRects(),contextElement:L}:L;c(v),m.refs.setReference(v)},[m.refs]),g=P.useCallback(L=>{(Qi(L)||L===null)&&(u.current=L,l(L)),(Qi(m.refs.reference.current)||m.refs.reference.current===null||L!==null&&!Qi(L))&&m.refs.setReference(L)},[m.refs]),x=P.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:u}),[m.refs,g,p]),b=P.useMemo(()=>({...m.elements,domReference:f}),[m.elements,f]),y=P.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return $l(()=>{n.dataRef.current.floatingContext=y;const L=h?.nodesRef.current.find(v=>v.id===e);L&&(L.context=y)}),P.useMemo(()=>({...m,context:y,refs:x,elements:b}),[m,x,b,y])}function P1(t,e,s){const n=new Map,i=s==="item";let r=t;if(i&&t){const{[E4]:l,[R4]:a,...c}=t;r=c}return{...s==="floating"&&{tabIndex:-1,[yI]:""},...r,...e.map(l=>{const a=l?l[s]:null;return typeof a=="function"?t?a(t):null:a}).concat(t).reduce((l,a)=>(a&&Object.entries(a).forEach(c=>{let[d,f]=c;if(!(i&&[E4,R4].includes(d)))if(d.indexOf("on")===0){if(n.has(d)||n.set(d,[]),typeof f=="function"){var u;(u=n.get(d))==null||u.push(f),l[d]=function(){for(var h,m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];return(h=n.get(d))==null?void 0:h.map(x=>x(...p)).find(x=>x!==void 0)}}}else l[d]=f}),l),{})}}function OI(t){t===void 0&&(t=[]);const e=t.map(a=>a?.reference),s=t.map(a=>a?.floating),n=t.map(a=>a?.item),i=P.useCallback(a=>P1(a,t,"reference"),e),r=P.useCallback(a=>P1(a,t,"floating"),s),l=P.useCallback(a=>P1(a,t,"item"),n);return P.useMemo(()=>({getReferenceProps:i,getFloatingProps:r,getItemProps:l}),[i,r,l])}const $I=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function BI(t,e){var s,n;e===void 0&&(e={});const{open:i,elements:r,floatingId:l}=t,{enabled:a=!0,role:c="dialog"}=e,d=qg(),f=((s=r.domReference)==null?void 0:s.id)||d,u=P.useMemo(()=>{var y;return((y=dI(r.floating))==null?void 0:y.id)||l},[r.floating,l]),h=(n=$I.get(c))!=null?n:c,p=X7()!=null,g=P.useMemo(()=>h==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:i?u:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":h==="alertdialog"?"dialog":h,"aria-controls":i?u:void 0,...h==="listbox"&&{role:"combobox"},...h==="menu"&&{id:f},...h==="menu"&&p&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[h,u,p,i,f,c]),x=P.useMemo(()=>{const y={id:u,...h&&{role:h}};return h==="tooltip"||c==="label"?y:{...y,...h==="menu"&&{"aria-labelledby":f}}},[h,u,f,c]),b=P.useCallback(y=>{let{active:L,selected:v}=y;const _={role:"option",...L&&{id:u+"-fui-option"}};switch(c){case"select":case"combobox":return{..._,"aria-selected":v}}return{}},[u,c]);return P.useMemo(()=>a?{reference:g,floating:x,item:b}:{},[a,g,x,b])}function zI(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:r,startOfLine:l,$position:a}=t,c=n&&!i,d=GT(s),f=new RegExp(`\\s${d}$`),u=l?"^":"",h=i?"":d,m=c?new RegExp(`${u}${d}.*?(?=\\s${h}|$)`,"gm"):new RegExp(`${u}(?:^)?${d}[^\\s${h}]*`,"gm"),p=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!p)return null;const g=a.pos-p.length,x=Array.from(p.matchAll(m)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),y=new RegExp(`^[${r?.join("")}\0]?$`).test(b);if(r!==null&&!y)return null;const L=g+x.index;let v=L+x[0].length;return c&&f.test(p.slice(v-1,v+1))&&(x[0]+=" ",v+=1),L<a.pos&&v>=a.pos?{range:{from:L,to:v},query:x[0].slice(s.length),text:x[0]}:null}function FI(t){return t.docChanged?t.steps.some(e=>{const s=e.slice;if(!s?.content)return!1;const n=s.content.textBetween(0,s.content.size,`
3
3
  `);return/\s/.test(n)}):!1}function UI(t){return()=>{const e=t.state.selection.$anchor.pos,{top:s,right:n,bottom:i,left:r}=t.view.coordsAtPos(e);try{return new DOMRect(r,s,n-r,i-s)}catch{return null}}}function HI(t,e,s,n){return s?()=>{const i=n.getState(t.state),r=i?.decorationId,l=e.dom.querySelector(`[data-decoration-id="${r}"]`);return l?.getBoundingClientRect()||null}:UI(t)}function KI({match:t,dismissedRange:e,state:s,transaction:n,editor:i,shouldResetDismissed:r,effectiveAllowSpaces:l}){return r?.({editor:i,state:s,range:e,match:t,transaction:n,allowSpaces:l})?!1:l?t.range.from===e.from:t.range.from===e.from&&!FI(n)}function WI({view:t,pluginKeyRef:e}){const s=t.state.tr.setMeta(e,{exit:!0});t.dispatch(s)}function qI({pluginKey:t,decorationTag:e,decorationClass:s,decorationContent:n,decorationEmptyClass:i,renderer:r,dispatchExit:l}){return{handleKeyDown(a,c){var d;const f=t.getState(a.state);if(!f.active)return!1;if(c.key==="Escape"||c.key==="Esc"){var u;return r==null||(u=r.onKeyDown)===null||u===void 0||u.call(r,{view:a,event:c,range:f.range}),l(a),!0}return(r==null||(d=r.onKeyDown)===null||d===void 0?void 0:d.call(r,{view:a,event:c,range:f.range}))||!1},decorations(a){const{active:c,range:d,decorationId:f,query:u}=t.getState(a);if(!c)return null;const h=!u?.length,m=[s];return h&&m.push(i),WT.create(a.doc,[qT.inline(d.from,d.to,{nodeName:e,class:m.join(" "),"data-decoration-id":f||void 0,"data-decoration-content":n})])}}}function GI({editor:t,char:e,effectiveAllowSpaces:s,allowToIncludeChar:n,allowedPrefixes:i,startOfLine:r,findSuggestionMatch:l,allow:a,shouldShow:c,shouldKeepDismissed:d,pluginKey:f}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(u,h,m,p){const{isEditable:g}=t,{composing:x}=t.view,{selection:b}=u,{empty:y,from:L}=b,v={...h},_=u.getMeta(f);if(_&&_.exit)return v.active=!1,v.decorationId=null,v.range={from:0,to:0},v.query=null,v.text=null,v.dismissedRange=h.active?{...h.range}:h.dismissedRange,v;if(v.composing=x,u.docChanged&&v.dismissedRange!==null&&(v.dismissedRange={from:u.mapping.map(v.dismissedRange.from),to:u.mapping.map(v.dismissedRange.to)}),g&&(y||t.view.composing)){(L<h.range.from||L>h.range.to)&&!x&&!h.composing&&(v.active=!1);const w=l({char:e,allowSpaces:s,allowToIncludeChar:n,allowedPrefixes:i,startOfLine:r,$position:b.$from}),S=`id_${Math.floor(Math.random()*4294967295)}`;w&&a({editor:t,state:p,range:w.range,isActive:h.active})&&(!c||c({editor:t,range:w.range,query:w.query,text:w.text,transaction:u}))?(v.dismissedRange!==null&&!d({match:w,dismissedRange:v.dismissedRange,state:p,transaction:u})&&(v.dismissedRange=null),v.dismissedRange===null?(v.active=!0,v.decorationId=h.decorationId||S,v.range=w.range,v.query=w.query,v.text=w.text):v.active=!1):(w||(v.dismissedRange=null),v.active=!1)}else v.active=!1;return v.active||(v.decorationId=null,v.range={from:0,to:0},v.query=null,v.text=null),v}}}function YI({editor:t,items:e}){let s=null,n=null,i=null;const r=()=>{n!==null&&(clearTimeout(n),n=null),i?.(),i=null},l=d=>new Promise(f=>{i=f,n=setTimeout(()=>{n=null;const u=i;i=null,u?.()},d)}),a=()=>{s?.abort(),r(),s=null};return{abort:a,fetch:async(d,f)=>{a(),s=new AbortController;const u=s;if(f>0&&await l(f),s!==u||u.signal.aborted)return{status:"aborted"};try{const h=await e({editor:t,query:d,signal:u.signal});return s!==u||u.signal.aborted?{status:"aborted"}:{status:"resolved",items:h}}catch{return s!==u||u.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function JI({placement:t,offset:e,flip:s,floatingUi:n}){var i,r,l,a;const c=[M2({mainAxis:(i=e.mainAxis)!==null&&i!==void 0?i:4,crossAxis:(r=e.crossAxis)!==null&&r!==void 0?r:0})];return s&&c.push(O2()),!(n==null||(l=n.middleware)===null||l===void 0)&&l.length&&c.push(...n.middleware),{placement:t,strategy:(a=n?.strategy)!==null&&a!==void 0?a:"absolute",middleware:c}}function QI(t){if(t instanceof HTMLElement)return t;if(typeof t=="string")try{const e=document.querySelector(t);if(e)return e}catch{return document.body}return document.body}function XI({getReferenceRect:t,contextElement:e,config:s,container:n,dismissOnOutsideClick:i,dismiss:r}){return(l,a={})=>{const c={getBoundingClientRect:()=>{var p;return(p=t())!==null&&p!==void 0?p:new DOMRect},contextElement:e};let d=!1;const f=!l.isConnected;f&&QI(n).appendChild(l),a.onPosition||(l.style.visibility="hidden",l.style.width="max-content");const h=g6(c,l,()=>{$2(c,l,{placement:s.placement,strategy:s.strategy,middleware:s.middleware}).then(({x:p,y:g,placement:x,strategy:b})=>{if(a.onPosition){a.onPosition({x:p,y:g,placement:x,strategy:b});return}Object.assign(l.style,{position:b,left:`${p}px`,top:`${g}px`}),d||(d=!0,l.style.visibility="")})},a.autoUpdate);let m;return i&&(m=p=>{const g=p.target;!(g instanceof Node)||l.contains(g)||e.contains(g)||r()},document.addEventListener("pointerdown",m,!0)),()=>{h(),m&&document.removeEventListener("pointerdown",m,!0),f&&l.remove()}}}function ZI({editor:t,pluginKey:e,items:s,renderer:n,minQueryLength:i,debounce:r,initialItems:l,placement:a,offset:c,container:d,flip:f,floatingUi:u,dismissOnOutsideClick:h,command:m,clientRectFor:p,dispatchExit:g}){let x;const b=YI({editor:t,items:s}),y=JI({placement:a,offset:c,flip:f,floatingUi:u});function L(v,_){switch(v){case"started":var w;n==null||(w=n.onStart)===null||w===void 0||w.call(n,_);break;case"updated":var S;n==null||(S=n.onUpdate)===null||S===void 0||S.call(n,_);break;case"stopped":var k;n==null||(k=n.onExit)===null||k===void 0||k.call(n,_)}}return{update:async(v,_)=>{var w,S;const k=e.getState(_),j=e.getState(v.state);if(!k||!j)return;let C=null;const T=k.query!==j.query,N=k.text!==j.text,V=k.range.from!==j.range.from||k.range.to!==j.range.to,A=T||N||V;if(!k.active&&j.active)C="started";else if(k.active&&!j.active)C="stopped";else if(j.active&&A)C="updated";else return;const E=C==="stopped"?k:j,R=v.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`),I=p(v,R),D=i===0||(E.query?E.query.length>=i:!1),O=(C==="started"||C==="updated")&&D;if(x={editor:t,range:E.range,query:E.query||"",text:E.text||"",items:l??[],command:$=>m({editor:t,range:E.range,props:$}),decorationNode:R,clientRect:I,loading:O,placement:a,offset:{mainAxis:(w=c.mainAxis)!==null&&w!==void 0?w:4,crossAxis:(S=c.crossAxis)!==null&&S!==void 0?S:0},container:d,flip:f,floatingUi:y,mount:XI({getReferenceRect:I,contextElement:v.dom,config:y,container:d,dismissOnOutsideClick:h,dismiss:()=>g(t.view)})},C==="started"){var z;n==null||(z=n.onBeforeStart)===null||z===void 0||z.call(n,x)}if(C==="updated"){var M;n==null||(M=n.onBeforeUpdate)===null||M===void 0||M.call(n,x)}if(C==="started"&&L(C,x),C==="started"||C==="updated")if(!O)b.abort(),x={...x,items:l??[],loading:!1};else{x={...x,items:l??[],loading:!0},C="updated",L(C,x);const $=await b.fetch(E.query||"",r);if($.status==="aborted")return;const F=e.getState(v.state);if(!F?.active){b.abort();return}x=$.status==="resolved"?{...x,items:$.items,loading:!1}:{...x,loading:!1}}if(C==="stopped"){b.abort(),L(C,x),x=void 0;return}C==="updated"&&L(C,x)},destroy:()=>{var v;b.abort(),x&&(n==null||(v=n.onExit)===null||v===void 0||v.call(n,x))}}}const t_=new ji("suggestion");function s_({pluginKey:t=t_,editor:e,char:s="@",allowSpaces:n=!1,allowToIncludeChar:i=!1,allowedPrefixes:r=[" "],startOfLine:l=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:f="is-empty",command:u=()=>null,items:h=()=>[],minQueryLength:m=0,debounce:p=0,initialItems:g,placement:x="bottom-start",offset:b={},container:y,flip:L=!0,floatingUi:v,dismissOnOutsideClick:_=!0,render:w=()=>({}),allow:S=()=>!0,findSuggestionMatch:k=zI,shouldShow:j,shouldResetDismissed:C}){const T=w?.(),N=n&&!i,V=(R,I)=>HI(e,R,I,t);function A(R){return KI({...R,editor:e,shouldResetDismissed:C,effectiveAllowSpaces:N})}const E=R=>WI({view:R,pluginKeyRef:t});return new rd({key:t,view:()=>ZI({editor:e,pluginKey:t,items:h,renderer:T,minQueryLength:m,debounce:p,initialItems:g,placement:x,offset:b,container:y,flip:L,floatingUi:v,dismissOnOutsideClick:_,command:u,clientRectFor:V,dispatchExit:E}),state:GI({editor:e,char:s,effectiveAllowSpaces:N,allowToIncludeChar:i,allowedPrefixes:r,startOfLine:l,findSuggestionMatch:k,allow:S,shouldShow:j,shouldKeepDismissed:A,pluginKey:t}),props:qI({pluginKey:t,decorationTag:a,decorationClass:c,decorationContent:d,decorationEmptyClass:f,renderer:T,dispatchExit:E})})}function n_(t,e=t_){const s=t.state.tr.setMeta(e,{exit:!0});t.dispatch(s)}var eM=s_;function tM(t){const e=B.c(24),{editor:s,query:n,items:i,onSelect:r,onClose:l}=t,[a,c]=P.useState(0),d=P.useRef(i),f=P.useRef(a),u=P.useRef(r),h=P.useRef(l),m=P.useDeferredValue(n);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{c(0)},e[0]=p):p=e[0];let g;e[1]!==m?(g=[m],e[1]=m,e[2]=g):g=e[2],P.useEffect(p,g);let x,b;e[3]!==i.length||e[4]!==a?(x=()=>{a>=i.length&&i.length>0&&c(0)},b=[i.length,a],e[3]=i.length,e[4]=a,e[5]=x,e[6]=b):(x=e[5],b=e[6]),P.useEffect(x,b);let y,L;e[7]!==i?(y=()=>{d.current=i},L=[i],e[7]=i,e[8]=y,e[9]=L):(y=e[8],L=e[9]),P.useEffect(y,L);let v,_;e[10]!==a?(v=()=>{f.current=a},_=[a],e[10]=a,e[11]=v,e[12]=_):(v=e[11],_=e[12]),P.useEffect(v,_);let w,S;e[13]!==r?(S=()=>{u.current=r},w=[r],e[13]=r,e[14]=w,e[15]=S):(w=e[14],S=e[15]),P.useEffect(S,w);let k,j;e[16]!==l?(k=()=>{h.current=l},j=[l],e[16]=l,e[17]=k,e[18]=j):(k=e[17],j=e[18]),P.useEffect(k,j);let C,T;e[19]!==s?(C=()=>{if(s?.isDestroyed)return;let A;try{A=s.view.dom}catch{return}if(!A)return;const E=I=>{const D=d.current;if(!D.length)return!1;const O=()=>c(M=>(M+1)%D.length),z=()=>c(M=>(M-1+D.length)%D.length);switch(I.key){case"ArrowUp":return I.preventDefault(),z(),!0;case"ArrowDown":return I.preventDefault(),O(),!0;case"Tab":return I.preventDefault(),I.shiftKey?z():O(),!0;case"Home":return I.preventDefault(),c(0),!0;case"End":return I.preventDefault(),c(D.length-1),!0;case"Enter":{if(I.isComposing)return!1;I.preventDefault();const M=f.current;return M!==-1&&D[M]&&u.current?.(D[M],M),!0}case"Escape":return I.preventDefault(),h.current?.(),!0;default:return!1}},R=I=>{E(I)};return A.addEventListener("keydown",R,!0),()=>{A?.removeEventListener("keydown",R,!0)}},T=[s],e[19]=s,e[20]=C,e[21]=T):(C=e[20],T=e[21]),P.useEffect(C,T);const N=i.length?a:void 0;let V;return e[22]!==N?(V={selectedIndex:N,setSelectedIndex:c},e[22]=N,e[23]=V):V=e[23],V}function sM(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const i_=P.createContext(void 0);function r_(){const t=P.useContext(i_);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function nM(t){const e=B.c(16),{editor:s,char:n,pluginKey:i,allow:r,onOpenChange:l}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=a):a=e[0];const[c,d]=P.useReducer(sM,a);let f;e[1]!==l?(f=g=>{l?.(g)},e[1]=l,e[2]=f):f=e[2];const u=P.useEffectEvent(f);let h;e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==u||e[7]!==i?(h=()=>{if(s?.isDestroyed)return;const g=i instanceof ji?i:new ji(i);s.state.plugins.find(y=>y.spec.key===g)&&s.unregisterPlugin(g);const b=s_({pluginKey:g,editor:s,char:n,allow(y){const L=s.state.doc.resolve(y.range.from);for(let v=L.depth;v>0;v--)if(L.node(v).type.name==="image")return!1;return!(r&&!r(y))},command(){},render:()=>({onStart:y=>{d({type:"ON_START",payload:{element:y.decorationNode??null,query:y.query,range:y.range}}),u(!0)},onUpdate:y=>{d({type:"ON_UPDATE",payload:{element:y.decorationNode??null,query:y.query,range:y.range}})},onKeyDown:y=>y.event.key==="Escape"?(d({type:"ON_EXIT"}),!0):!1,onExit:()=>{d({type:"ON_EXIT"}),u(!1)}}),items:iM});return s.registerPlugin(b),()=>{s?.isDestroyed||s.unregisterPlugin(g)}},e[3]=n,e[4]=r,e[5]=s,e[6]=u,e[7]=i,e[8]=h):h=e[8];let m;e[9]!==n||e[10]!==r||e[11]!==s||e[12]!==i?(m=[s,i,n,d,r],e[9]=n,e[10]=r,e[11]=s,e[12]=i,e[13]=m):m=e[13],P.useEffect(h,m);let p;return e[14]!==c?(p={state:c,dispatch:d},e[14]=c,e[15]=p):p=e[15],p}function iM(){return[]}function rM({editor:t,queryKey:e,queryFn:s,onSelect:n}){const{state:i,dispatch:r}=r_(),l=P.useDeferredValue(i.query),{data:a}=Gh({queryKey:Je.suggestionItems(e,i.open,l),queryFn:()=>i.open?s({query:l}):[]}),c=()=>{r({type:"ON_EXIT"})},d=async(u,h)=>{if(!(i.selectedItem!==null||!i.range)){r({type:"SET_SELECTED_ITEM",payload:u});try{const{view:m}=t,g=m.state.selection.$to.nodeAfter?.text?.startsWith(" "),x=i.range?{...i.range}:{from:0,to:0};g&&i.range&&(x.to+=1),await n({range:x,item:u})===!1?r({type:"SET_SELECTED_ITEM",payload:null}):c()}catch{c()}}},{selectedIndex:f}=tM({editor:t,query:l,items:a,onSelect:d,onClose:c});return{selectedItem:i.selectedItem,items:a,selectedIndex:f,close:c,onSelect:d}}function oM({children:t}){const{state:e,dispatch:s}=r_(),{open:n,element:i}=e,r=()=>{s({type:"ON_EXIT"})},{refs:l,floatingStyles:a,context:c}=MI({placement:"bottom-start",open:n,onOpenChange:h=>{h||r()},elements:{reference:i},middleware:[GN(10),YN(),JN()],whileElementsMounted:g6}),d=DI(c,{outsidePress:h=>!(h.target instanceof Element&&h.target.closest(".ProseMirror"))}),f=BI(c,{role:"listbox"}),{getFloatingProps:u}=OI([d,f]);return n?o.jsx(AI,{children:o.jsx("div",{ref:l.setFloating,style:a,...u(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const lM=t=>{const e=B.c(29),{item:s,isSelected:n,onSelect:i,isLoading:r,ref:l}=t;let a;if(e[0]!==s){const w=rr(s._meta);a=s.title||F2(s.name,w),e[0]=s,e[1]=a}else a=e[1];const c=a,d=s.description||null,f=s.icon,u=n&&"bg-accent text-accent-foreground",h=r&&"pointer-events-none opacity-50";let m;e[2]!==u||e[3]!==h?(m=ie("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",u,h),e[2]=u,e[3]=h,e[4]=m):m=e[4];let p;e[5]!==f||e[6]!==c?(p=f!==void 0&&o.jsx(ci,{icon:f,name:c,size:"xs",className:"mr-2"}),e[5]=f,e[6]=c,e[7]=p):p=e[7];let g;e[8]!==c?(g=o.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:c}),e[8]=c,e[9]=g):g=e[9];let x;e[10]!==r?(x=r&&o.jsx(Fc,{size:"xs"}),e[10]=r,e[11]=x):x=e[11];let b;e[12]!==g||e[13]!==x?(b=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g,x]}),e[12]=g,e[13]=x,e[14]=b):b=e[14];let y;e[15]!==d?(y=d&&o.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d}),e[15]=d,e[16]=y):y=e[16];let L;e[17]!==b||e[18]!==y?(L=o.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,y]}),e[17]=b,e[18]=y,e[19]=L):L=e[19];let v;e[20]!==s.drillable?(v=s.drillable&&o.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"}),e[20]=s.drillable,e[21]=v):v=e[21];let _;return e[22]!==i||e[23]!==l||e[24]!==L||e[25]!==v||e[26]!==m||e[27]!==p?(_=o.jsxs("div",{ref:l,onClick:i,className:m,children:[p,L,v]}),e[22]=i,e[23]=l,e[24]=L,e[25]=v,e[26]=m,e[27]=p,e[28]=_):_=e[28],_},aM=t=>{const e=B.c(21),{editor:s,queryKey:n,queryFn:i,onSelect:r}=t,l=re();let a;e[0]!==s||e[1]!==r||e[2]!==i||e[3]!==n?(a={editor:s,queryKey:n,queryFn:i,onSelect:r},e[0]=s,e[1]=r,e[2]=i,e[3]=n,e[4]=a):a=e[4];const{items:c,selectedIndex:d,onSelect:f,selectedItem:u}=rM(a);if(!c.length){let g;e[5]!==l?(g=l("chat.mention.noItemsFound"),e[5]=l,e[6]=g):g=e[6];let x;return e[7]!==g?(x=o.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:g}),e[7]=g,e[8]=x):x=e[8],x}let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[9]=h):h=e[9];let m;if(e[10]!==f||e[11]!==c||e[12]!==d||e[13]!==u?.name){let g;e[15]!==f||e[16]!==d||e[17]!==u?.name?(g=(x,b)=>o.jsx(lM,{item:x,isSelected:b===d,ref:b===d?uM:void 0,onSelect:()=>f(x,b),isLoading:u?.name===x.name},`${x.kind??"item"}:${x.name}`),e[15]=f,e[16]=d,e[17]=u?.name,e[18]=g):g=e[18],m=c.map(g),e[10]=f,e[11]=c,e[12]=d,e[13]=u?.name,e[14]=m}else m=e[14];let p;return e[19]!==m?(p=o.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:h,children:o.jsx("div",{className:"p-1",children:m})}),e[19]=m,e[20]=p):p=e[20],p};function cM(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"p-1",children:[...Array(3)].map(dM)}),t[0]=e):e=t[0],e}function dM(t,e){return o.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[o.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),o.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function o_(t){const e=B.c(18),{editor:s,char:n,pluginKey:i,queryKey:r,queryFn:l,onSelect:a,allow:c,onOpenChange:d}=t;let f;e[0]!==c||e[1]!==n||e[2]!==s||e[3]!==d||e[4]!==i?(f={editor:s,char:n,pluginKey:i,allow:c,onOpenChange:d},e[0]=c,e[1]=n,e[2]=s,e[3]=d,e[4]=i,e[5]=f):f=e[5];const{state:u,dispatch:h}=nM(f);let m;e[6]!==h||e[7]!==u?(m={state:u,dispatch:h},e[6]=h,e[7]=u,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(cM,{}),e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==a||e[12]!==l||e[13]!==r?(g=o.jsx(oM,{children:o.jsx(P.Suspense,{fallback:p,children:o.jsx(aM,{editor:s,queryKey:r,queryFn:l,onSelect:a})})}),e[10]=s,e[11]=a,e[12]=l,e[13]=r,e[14]=g):g=e[14];let x;return e[15]!==m||e[16]!==g?(x=o.jsx(i_.Provider,{value:m,children:g}),e[15]=m,e[16]=g,e[17]=x):x=e[17],x}function uM(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const fM=t=>{const e=B.c(53),{editor:s,virtualMcpId:n,suggestionOpenRef:i}=t,r=re(),l=ps(),{org:a}=Fe(),c=da();let d;e[0]!==c?(d=hg(c),e[0]=c,e[1]=d):d=e[1];const f=d;let u;e[2]!==a.id||e[3]!==a.slug||e[4]!==n?(u={connectionId:n,orgId:a.id,orgSlug:a.slug},e[2]=a.id,e[3]=a.slug,e[4]=n,e[5]=u):u=e[5];const h=Jt(u);let m;e[6]!==a.id||e[7]!==n?(m=Je.virtualMcpResources(n,a.id),e[6]=a.id,e[7]=n,e[8]=m):m=e[8];const p=m,[g,x]=P.useState("categories");let b;e[9]!==g?(b=()=>g,e[9]=g,e[10]=b):b=e[10];const y=P.useEffectEvent(b),L=P.useRef(null),v=P.useRef(!1),_=n??"default";let w;e[11]!==g||e[12]!==a.id||e[13]!==_?(w=["at-mention",a.id,_,g],e[11]=g,e[12]=a.id,e[13]=_,e[14]=w):w=e[14];const S=w;let k;e[15]!==r?(k=r("chat.mentionAt.agentsTitle"),e[15]=r,e[16]=k):k=e[16];let j;e[17]!==r?(j=r("chat.mentionAt.agentsDescription"),e[17]=r,e[18]=j):j=e[18];let C;e[19]!==k||e[20]!==j?(C={name:"agents",title:k,description:j,kind:"category",drillable:!0},e[19]=k,e[20]=j,e[21]=C):C=e[21];let T;e[22]!==r?(T=r("chat.mentionAt.resourcesTitle"),e[22]=r,e[23]=T):T=e[23];let N;e[24]!==r?(N=r("chat.mentionAt.resourcesDescription"),e[24]=r,e[25]=N):N=e[25];let V;e[26]!==T||e[27]!==N?(V={name:"resources",title:T,description:N,kind:"category",drillable:!0},e[26]=T,e[27]=N,e[28]=V):V=e[28];let A;e[29]!==V||e[30]!==C?(A=[C,V],e[29]=V,e[30]=C,e[31]=A):A=e[31];const E=A;let R;e[32]!==h||e[33]!==s||e[34]!==r?(R=async F=>{const{item:U,range:H}=F;if(Ye("chat_picker_item_selected",{picker:"@",item_kind:U.kind,item_name:U.name}),U.kind!=="category"&&(v.current=!0),U.kind==="category")return x(U.name==="agents"?"agents":"resources"),!1;if(U.kind==="agent"&&U.agentId){zc(s,H,{id:U.agentId,name:U.name,metadata:{agentId:U.agentId,title:U.name},char:"@"}),x("categories");return}if(U.kind==="resource"&&U.uri&&h){try{const q=await x6(h,U.uri);zc(s,H,{id:U.uri,name:U.uri,metadata:q.contents,char:"@"})}catch(q){console.error("[at-mention] Failed to fetch resource:",q),xe.error(r("chat.mentionAt.failedToLoadResource"))}x("categories");return}},e[32]=h,e[33]=s,e[34]=r,e[35]=R):R=e[35];const I=R;let D;e[36]!==c||e[37]!==E||e[38]!==h||e[39]!==f||e[40]!==y||e[41]!==l||e[42]!==p||e[43]!==n?(D=async F=>{const{query:U}=F,H=y();if(H==="categories"){if(!U.trim())return E;const G=U.toLowerCase(),Y=c.filter(se=>se.status==="active"&&(!se.id||!Xf(se.id))&&!f.has(se.id)&&se.id!==n&&(se.title.toLowerCase().includes(G)||se.description?.toLowerCase().includes(G))).map(hM),J=await(async()=>{if(!h)return[];let se=l.getQueryData(p);return se||(se=await l.fetchQuery({queryKey:p,queryFn:()=>du(h),staleTime:6e4})),(se?.resources??[]).filter(oe=>oe.uri.toLowerCase().includes(G)||oe.name?.toLowerCase().includes(G)||oe.description?.toLowerCase().includes(G)).map(mM)})();return[...Y,...J]}if(H==="agents"){let G=c.filter(Y=>Y.status==="active"&&(!Y.id||!Xf(Y.id))&&!f.has(Y.id)&&Y.id!==n);if(U.trim()){const Y=U.toLowerCase();G=G.filter(J=>J.title.toLowerCase().includes(Y)||J.description?.toLowerCase().includes(Y))}return G.map(pM)}if(!h)return[];let q=l.getQueryData(p);q?l.fetchQuery({queryKey:p,queryFn:()=>du(h),staleTime:6e4}).catch(gM):q=await l.fetchQuery({queryKey:p,queryFn:()=>du(h),staleTime:6e4});let W=q?.resources??[];if(U.trim()){const G=U.toLowerCase();W=W.filter(Y=>Y.uri.toLowerCase().includes(G)||Y.name?.toLowerCase().includes(G)||Y.description?.toLowerCase().includes(G))}return W.map(xM)},e[36]=c,e[37]=E,e[38]=h,e[39]=f,e[40]=y,e[41]=l,e[42]=p,e[43]=n,e[44]=D):D=e[44];const O=D;let z;e[45]!==i?(z=F=>{if(i&&(i.current=F),F)L.current=Date.now(),v.current=!1,Ye("chat_picker_opened",{picker:"@"});else{const U=L.current;Ye("chat_picker_closed",{picker:"@",outcome:v.current?"selected":"dismissed",duration_ms:U?Date.now()-U:null}),L.current=null,x("categories")}},e[45]=i,e[46]=z):z=e[46];const M=z;let $;return e[47]!==s||e[48]!==O||e[49]!==I||e[50]!==M||e[51]!==S?($=o.jsx(o_,{editor:s,char:"@",pluginKey:"atDropdownMenu",queryKey:S,queryFn:O,onSelect:I,onOpenChange:M}),e[47]=s,e[48]=O,e[49]=I,e[50]=M,e[51]=S,e[52]=$):$=e[52],$};function hM(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function mM(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function pM(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function gM(){}function xM(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}async function B4(t,e,s,n,i,r,l){try{const a=await s0(s,n,r);zc(t,e,{id:n,name:id(n,i),metadata:a.messages,char:"/",kind:"prompt",args:r})}catch(a){console.error("[slash] Failed to fetch prompt:",a),xe.error(l.t("chat.mentionSlash.failedLoadPrompt"))}}async function bM(t,e,s,n,i){try{const r=await x6(s,n);zc(t,e,{id:n,name:n,metadata:r.contents,char:"/",kind:"resource"})}catch(r){console.error("[slash] Failed to fetch resource:",r),xe.error(i.t("chat.mentionSlash.failedLoadResource"))}}async function vM(t,e,s,n,i){try{const{files:r,omittedPaths:l}=await gP(s,n.volume,n.path),a={sandboxPath:n.sandboxPath,files:r,omittedPaths:l};zc(t,e,{id:n.id,name:n.name,metadata:a,char:"/",kind:"skill"})}catch(r){console.error("[slash] Failed to fetch skill:",r),xe.error(i.t("chat.mentionSlash.failedLoadSkill"))}}const yM=({editor:t,virtualMcpId:e,suggestionOpenRef:s})=>{const n=re(),i=ps(),{org:r}=Fe(),l=Jt({connectionId:e,orgId:r.id,orgSlug:r.slug}),a=Je.virtualMcpPrompts(e,r.id),c=Je.virtualMcpResources(e,r.id),d=Je.slashSkills(r.id),f=["slash-mention",r.id,e??"default"],[u,h]=P.useState(null),[m,p]=P.useState(null),g=YT(t);g&&(g.onEditChip=async S=>{if(l)try{const j=(await z4(i,a,l)).find(C=>C.name===S.promptId);if(!j?.arguments||j.arguments.length===0)return;p({...S,prompt:j})}catch(k){console.error("[slash] Failed to load prompt for editing:",k),xe.error(n("chat.mentionSlash.failedLoadPrompt"))}});const x=P.useRef(null),b=P.useRef(!1),y=async({item:S,range:k})=>{if(Ye("chat_picker_item_selected",{picker:"/",item_kind:S.kind,item_name:S.name}),b.current=!0,!!l)if(S.kind==="prompt"){if(S.arguments&&S.arguments.length>0){h({range:k,item:S});return}const j=rr(S._meta);await B4(t,k,l,S.name,j,void 0,{t:n})}else S.kind==="skill"?S.skill&&await vM(t,k,r.slug,S.skill,{t:n}):S.uri&&await bM(t,k,l,S.uri,{t:n})},L=async S=>{if(!u||!l)return;const{range:k,item:j}=u,C=rr(j._meta);await B4(t,k,l,j.name,C,S,{t:n}),h(null)},v=async S=>{if(!(!m||!l)){if(!JT(t,m.pos,m.promptId)){xe.error(n("chat.mentionSlash.failedUpdatePrompt")),p(null);return}try{const k=await s0(l,m.promptId,S),j=rr(m.prompt._meta);t.chain().focus().setNodeSelection(m.pos).deleteSelection().insertContentAt(m.pos,Qh({id:m.promptId,name:id(m.promptId,j),metadata:k.messages,char:"/",kind:"prompt",args:S})).run(),Ye("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:m.promptId})}catch(k){console.error("[slash] Failed to update prompt:",k),xe.error(n("chat.mentionSlash.failedUpdatePrompt"))}p(null)}},_=async S=>{const{query:k}=S;if(!l)return[];const[j,C,T]=await Promise.all([z4(i,a,l),LM(i,c,l),_M(i,d,r.slug)]),N=k.trim().toLowerCase(),V=(j??[]).filter(R=>!N||R.name.toLowerCase().includes(N)||R.title?.toLowerCase().includes(N)||R.description?.toLowerCase().includes(N)).map(R=>({name:R.name,title:R.title,description:R.description,kind:"prompt",arguments:R.arguments,_meta:R._meta})),A=(C??[]).filter(R=>!N||R.uri.toLowerCase().includes(N)||R.name?.toLowerCase().includes(N)||R.description?.toLowerCase().includes(N)).map(R=>({name:R.name??R.uri,title:R.name,description:R.description,kind:"resource",uri:R.uri})),E=(T??[]).filter(R=>!N||R.name.toLowerCase().includes(N)||R.id.toLowerCase().includes(N)||R.description?.toLowerCase().includes(N)).map(R=>({name:R.name,title:R.name,description:R.description??void 0,kind:"skill",skill:R}));return[...V,...A,...E]},w=u?.item.kind==="prompt"?{name:u.item.name,title:u.item.title,arguments:u.item.arguments,description:u.item.description,_meta:u.item._meta}:null;return o.jsxs(o.Fragment,{children:[o.jsx(o_,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:f,queryFn:_,onSelect:y,onOpenChange:S=>{if(s&&(s.current=S),S)x.current=Date.now(),b.current=!1,Ye("chat_picker_opened",{picker:"/"});else{const k=x.current;Ye("chat_picker_closed",{picker:"/",outcome:b.current?"selected":"dismissed",duration_ms:k?Date.now()-k:null}),x.current=null}}}),o.jsx(Tu,{prompt:w,setPrompt:()=>h(null),onSubmit:L}),o.jsx(Tu,{prompt:m?.prompt??null,setPrompt:()=>p(null),onSubmit:v,defaultValues:m?.args},m?`edit-${m.promptId}-${m.pos}`:"edit-idle")]})};async function z4(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>$m(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>$m(s),staleTime:6e4}),n?.prompts??[]}async function _M(t,e,s){const n=t.getQueryData(e),i=()=>t.fetchQuery({queryKey:e,queryFn:()=>xP(s),staleTime:6e4});return n?(i().catch(()=>{}),n):i().catch(()=>[])}async function LM(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>du(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>du(s),staleTime:6e4}),n?.resources??[]}const l_="Ask anything, / for prompts & skills, @ for agents & resources...";function wM(t){return[Zh.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),Wg.configure({placeholder:()=>t.current??l_,showOnlyWhenEditable:!1}),XT,ZT]}function a_({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:n=!1,placeholder:i,onSubmit:r,suggestionOpenRef:l,children:a}){const c=P.useRef(r),d=P.useRef(e),f=P.useRef(n),u=P.useRef(i),h=Xh({extensions:wM(u),content:t||"",editorProps:{attributes:{"data-chat-input":"true",role:"textbox","aria-multiline":"true","aria-label":i??l_,class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,p)=>p.key==="Enter"&&!p.shiftKey&&f.current&&!l?.current?(p.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{d.current(m?.getJSON())}});return P.useEffect(()=>{h?.setEditable(!s)},[h,s]),P.useEffect(()=>{c.current=r},[r]),P.useEffect(()=>{d.current=e},[e]),P.useEffect(()=>{f.current=n},[n]),P.useEffect(()=>{u.current=i},[i]),P.useEffect(()=>{if(!h||h.isDestroyed)return;const m=JSON.stringify(h.getJSON()),p=JSON.stringify(t||{type:"doc",content:[]});m!==p&&h.commands.setContent(t||{type:"doc",content:[]})},[h,t]),o.jsx(QT.Provider,{value:{editor:h},children:a})}function c_(t){const e=B.c(29),{disabled:s,virtualMcpId:n,showFileUploader:i,selectedModel:r,onUnsupportedFile:l,suggestionOpenRef:a,ref:c,className:d}=t,f=s===void 0?!1:s,u=i===void 0?!1:i,{editor:h}=e0();let m,p;if(e[0]!==h?(m=()=>({focus:()=>{h?.commands.focus()},clear:()=>{h?.commands.clearContent(!0)},appendText:j=>{if(!h)return;const C=h.state.doc.textContent.trim()==="";h.commands.focus("end"),C||h.commands.insertContent(" "),h.commands.insertContent(j)},syncVoiceText:(j,C)=>{if(h&&(h.commands.setContent(j||{type:"doc",content:[]}),C)){h.commands.focus("end");const T=h.state.doc.textContent.trim().length>0;h.commands.insertContent({type:"text",text:T?" "+C:C})}},restoreContent:j=>{h&&h.commands.setContent(j||{type:"doc",content:[]})}}),p=[h],e[0]=h,e[1]=m,e[2]=p):(m=e[1],p=e[2]),P.useImperativeHandle(c??null,m,p),!h)return null;const g=f&&"cursor-not-allowed opacity-70",x=f&&"[&_.ProseMirror]:cursor-not-allowed";let b;e[3]!==d||e[4]!==g||e[5]!==x?(b=ie("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",d,"[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0","[&_.ProseMirror_p.is-editor-empty:first-child::before]:w-full","[&_.ProseMirror_p.is-editor-empty:first-child::before]:break-words",g,x),e[3]=d,e[4]=g,e[5]=x,e[6]=b):b=e[6];let y;e[7]!==h||e[8]!==b?(y=o.jsx(e9,{editor:h,className:b}),e[7]=h,e[8]=b,e[9]=y):y=e[9];const L=n??null;let v;e[10]!==h||e[11]!==a||e[12]!==L?(v=o.jsx(P.Suspense,{fallback:null,children:o.jsx(yM,{editor:h,virtualMcpId:L,suggestionOpenRef:a})}),e[10]=h,e[11]=a,e[12]=L,e[13]=v):v=e[13];const _=n??null;let w;e[14]!==h||e[15]!==a||e[16]!==_?(w=o.jsx(P.Suspense,{fallback:null,children:o.jsx(fM,{editor:h,virtualMcpId:_,suggestionOpenRef:a})}),e[14]=h,e[15]=a,e[16]=_,e[17]=w):w=e[17];let S;e[18]!==f||e[19]!==h||e[20]!==l||e[21]!==r||e[22]!==u?(S=u&&r&&!f?o.jsx($D,{editor:h,selectedModel:r,onUnsupportedFile:l}):null,e[18]=f,e[19]=h,e[20]=l,e[21]=r,e[22]=u,e[23]=S):S=e[23];let k;return e[24]!==v||e[25]!==w||e[26]!==S||e[27]!==y?(k=o.jsxs(o.Fragment,{children:[y,v,w,S]}),e[24]=v,e[25]=w,e[26]=S,e[27]=y,e[28]=k):k=e[28],k}function d_(t){const e=B.c(3),[s]=br();let n;return e[0]!==s.enableSounds||e[1]!==t?(n=()=>{s.enableSounds&&LP(t.dataUri).catch(r=>{console.warn(`[sound] ${t.name} playback failed:`,r)})},e[0]=s.enableSounds,e[1]=t,e[2]=n):n=e[2],n}const SM={name:"switch-005",dataUri:"data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0VAAAAOAAADTGF2ZjYyLjMuMTAwAAAAAAAAAAAAAAD/+1DAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABkAABU4ABMTEx0dHR0nJycnMTExMTs7OztERERETk5OTlhYWFhiYmJibGxsbHZ2dnZ/f39/iYmJiZOTk5OdnZ2dp6enp7GxsbG7u7u7xMTExM7Ozs7Y2NjY4uLi4uzs7Oz29vb2/////wAAAABMYXZjNjIuMTEAAAAAAAAAAAAAAAAkBVYAAAAAAAAVOPCP8KUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//tQxAAACEwDXvQRAAG8Ii93HtACUCAABAKCJwfaCEHwfeoEAQdEAYygIHBOCAIAgCAJh9QIOg+D5/ygPh/wfB8DuKAgCHyn9QPh/5SCDv+CEHAQdxOD4B27c39tbckkqYbBAYAN9bNJLB+aXAf5wQAKdzxfbmrVIRQ4xNx3HwnoDmLhfMhgJiiw/HREXNCHqjvHEPEG8QjBYlxQNepJAT0kC8ip6JzSWj1TasoG+iyycbf2Uil1ovf1f/oUtR1qP+s1WSBFKoAAU02BDjMhuP/7UsQEgws8bRpd8YABJYPeBf9wCGXTGxBYcw5AJFMFMAmQQAhGAxgLBgHIAMYAAALhgAchipbe/91aU1VV4zcZj1Vf1XgYCIMBNrsBAIGs9/Ue4i/xFPeqCqwViI9/UeLf///rOngdA3OPHFjmOBv+EQnGahgaZxVplmkAH5JadDTQlNCEuGNiWYbCCONWdUJg6HXNazFdu1T+VgaEpOP70exv7f2/4b/yH//2/4cqCX/zWRUrIw+IPNMNlDnjAXQas/I4AzmYifA0tMSCgQDF//tSxBCDSzzi3k/sQwEyCtjJ/rBZAk+Uqj1YhA5YMCAAMwgOUchTkK7OR7LbMl0W1H6SvzG0Q2ZzfKUhnmTobv9DNhS1v7P8h//8Gv8gTRt1jReZ7YEjmMQg9hhwwMycHooasFmZyjcZGBKJD+IwbMCQQLoi+IQXCcIoydKoilI2MWFS5uJdDEu2taRrYI2ZSqKY50pJLv2NfjUAAuQAMfqVQ/T3PDQgMJMeEZ45hJzY6MNoFMxqTj1zNGQKJjAxEsSCBgQJBSIL0mcKYQJfVAn/+1LEGwLKlEKrD3MiYcuMkVa/wABB8Vh6M1q1epbvXwWBURhkyEhWZ/////////////9gjZ/Wt4w+4MNMCpE4TBYQl4w1IHvMDdA2zBngBMwc8COMDhCpDAfgOAAgrBgNYU+YC0FBGAkAMpgWoSCYAGESGBGAKBgXgJOdiOJmMCmNwCYNDJhYRPykRCJhTBnEUzlsjv4UNLj/z97n3Mv/7z1nZqyitYAZIqErIwMwJAqEw0GAAMFptJMaqFwB8CQIWlhuhuDAwNjfuwrQFAYXCf/7UsQVAA+9PTP42gYRdiIu9zBwAPbFUCi0DAhgNcS+7cDwVgM05A9bUDeuQMyE/u3CygVISgZhpIau/9PhdQG2C9DpxZZJmn/dn/Psmt0EFm////l84ThUTopE4VD/9JkubOGasTvN30C20G21qgUCkVCoUCgPMywrPCGly27V5q5t24vl/8jSlSAPCxzNseNCw3oh3NGBu4BZJ5hv7DRSfR/+eWG7nA8IKh2Olv5iz3q5m3//Joxo3JqNyYkSuGt/k6D4DeoBOHmHdl0dkZYA//tSxAUAC4B1Z/2DADEcA17Z/uhI4Yoik/TrZo+ww7UtmpW4LDWu2IacoJKJJeTSM+ZmAYBEiU+ZnnAwCn1VVVV6JUJQVnioKhrgqdKgqGpUFeCp0sDR3ztQNREDRUFioKuxKCpYGQBlRIBk+aLwb8KblGQVDdphPYTUdBOGbVpAaTF6ZdjEV0iRUZRCYkA4oUQDx5zqDugtXvza/7fuNNvfZ+j9v+T/2f//J/4cAAOTpE5K4zksR9MfIB+TDcQTI4gNs1XKAzEFUrGkxABYEBb/+1LEEYNKrEjgT/TCwYYVmUX+mHoKgWhKU5Eiw9SFIRmppw+3fYo4siPhUFeexM8KgIO6wVuPDDy01qeRaVbw357//y3+o8M0pBNlNLCGBzGKwyYw2IIFOE1WNTjRM6x8MlA1AxDhUHTAkEiyKpnbWrLcaOBotBUKbk1pypcWDAIK00AhKLGkUco6q9VWvM53mcaq3tVa8zjTM/tX//EDP//////////XAAmrwAAPoKwcw0ShDCZD/BQlhzinxQdorsOuXTEIC01ZkJyu4k/qPP/7UsQUAEjkrrkvZaPBIRXUoe5QObfMhYKX9RVgTPqCSCaSCaSC0XVdV1f/////6IAlguuAJSiDRNloNBsZg+0+Ts8MMCn81WUTRAlIi+GHECD0y8AWDIqswYsxGOSKVV7MqOni8tkVOip0fZX/////9HrMCbAz2EHGS4GKAAiRAAAYAcDdKd4G6Z/nwYgJ0ZAIgZyC8aPAs/iPBhwMpWDQNARltNS5Y61v//9i8Yl4SkFkIGTkAc0UBrIYLPA4MYBEy+YLMRuY4nhTC3hZA68H//tSxCoAyQC6mY6CkWDJBIsBz/QUrgNmahSzcrYw0/HhfnMAZBojDsgTFkDR5MDkG/DZEbk2FCmowqdqv2TYABiJwqqYjaQRGZ1URZ1DhSsdiHX/GBu0QpzIBNSaLqZ0ARkwFARxMrpt/Eh47mbQAhhU6sisFUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LESoHHJCRaj/dmYAIAQAAQAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsSLg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsShg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",duration:.609,format:"mp3",license:"CC0",author:"Kenney"},kM=JV.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),jM=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function CM(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center -space-x-1.5",children:jM.map(NM)}),t[0]=e):e=t[0],e}function NM(t){return o.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function TM({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:n,isStreaming:i,onUnsupportedFile:r}){const l=re(),[a,c]=P.useState(!1),d=d_(SM),{org:f}=Fe(),{editor:u}=e0(),h=P.useRef(null),m=g9(n),p=()=>{!m||i||(c(!1),h.current?.click())},g=async W=>{const G=W.target.files;if(!G||G.length===0||!u)return;const Y=Array.from(G);try{let J=u.state.selection.from;for(const se of Y)await Kg(u,n??null,se,J,r,l),J=u.state.selection.to}finally{h.current&&(h.current.value="")}},x=Jt({connectionId:s,orgId:f.id,orgSlug:f.slug}),b=Je.virtualMcpPrompts(s,f.id),{data:y,isLoading:L}=Tt({queryKey:b,queryFn:()=>$m(x),staleTime:6e4,enabled:a&&!!x}),v=y?.prompts??[],[_,w]=P.useState(null),{chatMode:S,setChatMode:k}=la(),[j,C]=br(),T=El.find(W=>W.value===j.toolApprovalLevel)??El[0],N=l(T.shortKey),V=W=>{const G=El.find(Y=>Y.value===W);if(G){if(G.value===j.toolApprovalLevel){c(!1);return}d(),Ye("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:G.value,source:"tools_popover"}),C({...j,toolApprovalLevel:G.value}),c(!1)}},A=S==="plan",E=()=>{d();const W=A?"default":"plan";Ye("chat_mode_changed",{from_mode:S,to_mode:W,source:"tools_popover"}),k(W),c(!1)},R=()=>{e(),c(!1)},I=async(W,G)=>{if(!u||!x)return;const Y=rr(W._meta),J={from:u.state.selection.from,to:u.state.selection.to};try{const se=await s0(x,W.name,G);zc(u,J,{id:W.name,name:id(W.name,Y),metadata:se.messages,char:"/",kind:"prompt",args:G})}catch{xe.error(l("chat.toolsPopover.failedLoadPrompt"))}},D=async W=>{c(!1);const G=!!(W.arguments&&W.arguments.length>0);if(Ye("chat_prompt_inserted",{prompt_name:W.name,with_arguments:G}),G){w(W);return}await I(W)},O=async W=>{_&&(await I(_,W),w(null))},z=()=>{d();const W=S==="gen-image"?"default":"gen-image";Ye("chat_mode_changed",{from_mode:S,to_mode:W,source:"tools_popover"}),k(W),c(!1)},M=()=>{d();const W=S==="web-search"?"default":"web-search";Ye("chat_mode_changed",{from_mode:S,to_mode:W,source:"tools_popover"}),k(W),c(!1)},$=()=>{d();const W=S==="deep-research"?"default":"deep-research";Ye("chat_mode_changed",{from_mode:S,to_mode:W,source:"tools_popover"}),k(W),c(!1)},F=S==="gen-image",U=S==="web-search",H=S==="deep-research",q=o.jsx("input",{ref:h,type:"file",multiple:!0,accept:aP(n??null),className:"hidden",onChange:g,disabled:i});return o.jsxs(o.Fragment,{children:[q,o.jsxs($t,{open:a,onOpenChange:W=>{W&&!a&&Ye("chat_tools_popover_opened",{chat_mode:S}),c(W)},children:[o.jsx(Bt,{asChild:!0,children:o.jsxs(ue,{type:"button",variant:"ghost",size:"default",disabled:t,title:l("chat.toolsPopover.tools"),"aria-label":l("chat.toolsPopover.tools"),className:ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[o.jsx(a8,{size:14}),o.jsx("span",{className:ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:l("chat.toolsPopover.tools")})]})}),o.jsxs(zt,{align:"start",className:"w-56 p-1.5 space-y-1",children:[m?o.jsxs(Xe,{onClick:p,disabled:i,children:[o.jsx(Kt,{size:16}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]}):o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(Xe,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:W=>W.preventDefault(),children:[o.jsx(Kt,{size:16}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]})}),o.jsx(We,{side:"right",children:l("chat.toolsPopover.modelNoFileSupport")})]}),o.jsxs(Xe,{onClick:E,className:ie(A&&"text-special"),children:[o.jsx(Uc,{size:16,className:ie(A&&"text-special")}),o.jsx("span",{className:"flex-1 whitespace-nowrap",children:l("chat.toolsPopover.planMode")}),o.jsx("span",{className:ie("text-xs text-muted-foreground",A&&"text-special font-medium"),children:kM})]}),o.jsxs(Xe,{onClick:z,className:ie(F&&"text-special"),children:[o.jsx(fr,{size:16,className:ie(F&&"text-special")}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.createImage")}),F&&o.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),o.jsxs(Xe,{onClick:M,className:ie(U&&"text-special"),children:[o.jsx(Hl,{size:16,className:ie(U&&"text-special")}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.webSearch")}),U&&o.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),o.jsxs(Xe,{onClick:$,className:ie(H&&"text-special"),children:[o.jsx(c8,{size:16,className:ie(H&&"text-special")}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.deepResearch")}),H&&o.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),o.jsxs(er,{children:[o.jsxs(tr,{className:"gap-2",children:[o.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.prompts")})]}),o.jsx(sr,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:L?o.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[o.jsx(ot,{size:14,className:"animate-spin"}),l("chat.toolsPopover.loadingPrompts")]}):v.length===0?o.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:l("chat.toolsPopover.noPromptsAvailable")}):v.map(W=>o.jsxs(Xe,{onClick:()=>D(W),className:"flex flex-col items-start gap-0.5",children:[o.jsx("span",{className:"font-medium text-sm capitalize",children:W.title||F2(W.name,rr(W._meta))}),W.description&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:W.description})]},W.name))})]}),o.jsxs(er,{children:[o.jsxs(tr,{className:"gap-2",children:[o.jsx(f9,{size:16}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.approval")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:N})]}),o.jsx(sr,{className:"w-48 p-1.5",children:o.jsx(Wc,{value:j.toolApprovalLevel,onValueChange:V,children:El.map(W=>o.jsx(Kn,{value:W.value,children:l(W.labelKey)},W.value))})})]}),o.jsxs(Xe,{onClick:R,children:[o.jsx(J2,{size:16}),o.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.connections")}),o.jsx(P.Suspense,{children:o.jsx(CM,{})})]})]})]}),o.jsx(Tu,{prompt:_,setPrompt:w,onSubmit:O})]})}const VM=[{src:"/connections/github.png",name:"GitHub"},{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/linear.png",name:"Linear"},{src:"/connections/shopify.png",name:"Shopify"},{src:"/connections/firecrawl.png",name:"Firecrawl"},{src:"/connections/perplexity.png",name:"Perplexity"}];function AM(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center -space-x-1",children:VM.map(PM)}),t[0]=e):e=t[0],e}function PM(t){return o.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function EM(t){const e=B.c(10),{onClick:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=ie("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),e[0]=i):i=e[0];let r;e[1]!==n?(r=n("chat.connectionsBanner.description"),e[1]=n,e[2]=r):r=e[2];let l;e[3]!==r?(l=o.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:r}),e[3]=r,e[4]=l):l=e[4];let a,c;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(AM,{}),c=o.jsx(en,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[5]=a,e[6]=c):(a=e[5],c=e[6]);let d;return e[7]!==s||e[8]!==l?(d=o.jsxs("button",{type:"button",onClick:s,className:i,children:[l,a,c]}),e[7]=s,e[8]=l,e[9]=d):d=e[9],d}const Xd=48;function RM(){const t=B.c(9),[e,s]=P.useState("idle"),[n,i]=P.useState(""),[r,l]=P.useState(""),[a,c]=P.useState(MM),d=P.useRef(null),f=P.useRef(null),u=P.useRef(null),h=P.useRef(null),m=P.useRef(0),p=P.useRef(!1),g=P.useRef(""),x=P.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let y;t[0]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0),f.current?.close().catch(IM),h.current?.getTracks().forEach(DM),u.current=null,f.current=null,h.current=null},t[0]=y):y=t[0];const L=y;let v;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const T=N=>{h.current=N;const V=new AudioContext;f.current=V;const A=V.createMediaStreamSource(N),E=V.createAnalyser();E.fftSize=128,E.smoothingTimeConstant=.8,A.connect(E),u.current=E;const R=new Uint8Array(E.frequencyBinCount),I=()=>{if(!u.current)return;u.current.getByteFrequencyData(R);const D=[];for(let O=0;O<Xd;O++){const z=Math.floor(O/Xd*R.length);D.push(Math.max(.04,(R[z]??0)/255))}c(D),m.current=requestAnimationFrame(I)};I()};v=async()=>{const N=window.SpeechRecognition||window.webkitSpeechRecognition;if(!N)return s("unsupported"),"unsupported";let V;try{V=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return s("permission-denied"),"permission-denied"}i(""),l(""),x.current="",g.current="",p.current=!0,s("recording"),T(V);const A=new N;d.current=A,A.interimResults=!0,A.continuous=!0,A.lang=navigator.language||"en-US",A.onresult=E=>{if(d.current!==A)return;let R="",I="";for(let D=E.resultIndex;D<E.results.length;D++){const O=E.results[D],z=O?.[0]?.transcript??"";O?.isFinal?I=I+z:R=R+z}I&&(g.current=g.current+I,i(g.current)),x.current=R,l(R)},A.onerror=E=>{d.current===A&&E.error!=="no-speech"&&(p.current=!1,d.current=null,L(),s(E.error==="not-allowed"?"permission-denied":"idle"))},A.onend=()=>{if(d.current===A&&p.current)try{A.start()}catch{}};try{A.start()}catch{return p.current=!1,d.current=null,L(),s("idle"),"idle"}return"recording"},t[1]=v}else v=t[1];const _=v;let w;t[2]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{p.current=!1,d.current?.stop(),L(),s("idle"),c(Array(Xd).fill(.05)),l("");const T=(g.current+(x.current?" "+x.current:"")).trim();return i(""),g.current="",x.current="",T},t[2]=w):w=t[2];const S=w;let k;t[3]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{p.current=!1,d.current?.abort(),L(),s("idle"),i(""),l(""),c(Array(Xd).fill(.05)),g.current="",x.current=""},t[3]=k):k=t[3];const j=k;let C;return t[4]!==r||t[5]!==e||t[6]!==n||t[7]!==a?(C={status:e,transcript:n,interimTranscript:r,waveformData:a,isSupported:b,startRecording:_,stopRecording:S,cancelRecording:j},t[4]=r,t[5]=e,t[6]=n,t[7]=a,t[8]=C):C=t[8],C}function DM(t){return t.stop()}function IM(){}function MM(){return Array(Xd).fill(.05)}function OM(t){const e=B.c(4),{data:s}=t;let n;e[0]!==s?(n=s.map($M),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=o.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:n}),e[2]=n,e[3]=i):i=e[3],i}function $M(t,e){return o.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}function BM(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function K0(t){const e=B.c(7),{message:s,icon:n}=t;let i;e[0]!==n?(i=n??o.jsx(Zu,{size:14,className:"shrink-0"}),e[0]=n,e[1]=i):i=e[1];const r=s??"";let l;e[2]!==r?(l=o.jsx("span",{className:"text-sm",children:r}),e[2]=r,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=o.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function zM(t,e,s){const n=B.c(7),{editor:i}=e0(),r=re(),[l,a]=P.useState(!1),c=P.useRef(0);let d,f;return n[0]!==s||n[1]!==i||n[2]!==e||n[3]!==t||n[4]!==r?(d=()=>{const u=g=>{g.dataTransfer?.types.includes("Files")&&(g.preventDefault(),c.current=c.current+1,a(!0))},h=g=>{g.preventDefault(),c.current=Math.max(0,c.current-1),c.current===0&&a(!1)},m=FM,p=g=>{if(g.preventDefault(),c.current=0,a(!1),s||!i||!t||!g9(t))return;const x=g.dataTransfer?.files;if(!x||x.length===0)return;const b=Array.from(x);(async()=>{let y=i.state.selection.from;for(const L of b)await Kg(i,t,L,y,e,r),y=i.state.selection.to})()};return window.addEventListener("dragenter",u),window.addEventListener("dragleave",h),window.addEventListener("dragover",m),window.addEventListener("drop",p),()=>{window.removeEventListener("dragenter",u),window.removeEventListener("dragleave",h),window.removeEventListener("dragover",m),window.removeEventListener("drop",p)}},f=[i,t,e,r,s],n[0]=s,n[1]=i,n[2]=e,n[3]=t,n[4]=r,n[5]=d,n[6]=f):(d=n[5],f=n[6]),P.useEffect(d,f),l}function FM(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function UM(t){const e=B.c(14),{selectedModel:s}=t,n=re();let i,r,l;if(e[0]!==s||e[1]!==n){const{parts:d}=j8(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Gn,{size:24}),e[5]=l):l=e[5],i="text-sm font-medium";let f;e[6]!==n?(f=u=>n(u),e[6]=n,e[7]=f):f=e[7],r=n("chat.input.dropFilesHere",{fileTypes:d.map(f).join(", ")}),e[0]=s,e[1]=n,e[2]=i,e[3]=r,e[4]=l}else i=e[2],r=e[3],l=e[4];let a;e[8]!==i||e[9]!==r?(a=o.jsx("span",{className:i,children:r}),e[8]=i,e[9]=r,e[10]=a):a=e[10];let c;return e[11]!==l||e[12]!==a?(c=o.jsxs(o.Fragment,{children:[l,a]}),e[11]=l,e[12]=a,e[13]=c):c=e[13],c}function HM(){const t=B.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Zu,{size:24}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.input.modelCannotReadAttachments"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=o.jsxs(o.Fragment,{children:[s,o.jsx("span",{className:"text-sm font-medium",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function KM(t){const e=B.c(11),{selectedModel:s,onUnsupportedFile:n,disabled:i}=t,r=zM(s,n,i);let l;e[0]!==s?(l=g9(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=r?"opacity-100":"opacity-0 pointer-events-none",d=a?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let f;e[2]!==c||e[3]!==d?(f=ie("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,d),e[2]=c,e[3]=d,e[4]=f):f=e[4];let u;e[5]!==s||e[6]!==a?(u=a?o.jsx(UM,{selectedModel:s}):o.jsx(HM,{}),e[5]=s,e[6]=a,e[7]=u):u=e[7];let h;return e[8]!==f||e[9]!==u?(h=o.jsx("div",{className:f,children:u}),e[8]=f,e[9]=u,e[10]=h):h=e[10],h}function W0(t){const e=B.c(14),{onClick:s,label:n,icon:i,colorClass:r,maxWidthClass:l}=t;let a;e[0]!==r?(a=ie("flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium group min-w-0 shrink animate-in fade-in duration-200",r),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==l?(c=ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:opacity-100",l),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==n||e[5]!==c?(d=o.jsx("span",{className:c,children:n}),e[4]=n,e[5]=c,e[6]=d):d=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Ds,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"}),e[7]=f):f=e[7];let u;return e[8]!==i||e[9]!==n||e[10]!==s||e[11]!==a||e[12]!==d?(u=o.jsxs("button",{type:"button",onClick:s,title:n,"aria-label":n,className:a,children:[i,d,f]}),e[8]=i,e[9]=n,e[10]=s,e[11]=a,e[12]=d,e[13]=u):u=e[13],u}function WM(){const t=B.c(6),e=Ws(),{org:s,locator:n}=Fe(),{create:i}=od();let r;return t[0]!==i||t[1]!==n||t[2]!==e||t[3]!==s.id||t[4]!==s.slug?(r=async l=>{const{tiptapDoc:a,virtualMcp:c}=l,d=crypto.randomUUID(),f=c?.id??ca(s.id).id;n8(sessionStorage,n,d,{tiptapDoc:a});try{await i({id:d,virtual_mcp_id:f})}catch{}const u={virtualmcpid:f,autosend:eA};e({to:"/$org/$taskId",params:{org:s.slug,taskId:d},search:u})},t[0]=i,t[1]=n,t[2]=e,t[3]=s.id,t[4]=s.slug,t[5]=r):r=t[5],r}function qM({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=re(),n=z2(),i=As(),r=n?.messages??[],l=n?.isStreaming??!1,a=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=i?.taskId??"",f=d||AR,u=WM(),{selectedModel:h,selectedVirtualMcp:m,isModelsLoading:p,tiptapDocRef:g,imageModel:x,webSearchModel:b,deepResearchModel:y,chatMode:L,setChatMode:v}=la(),{data:_}=Nn.useSession(),w=_?.user?.id,{org:S,locator:k}=Fe(),j=ca(S.id).id,C=Is(m?.id),T=Tn(C?.id).runtime==="cms",N=d_(wP),[V,A]=P.useState(!1),{unsupportedFile:E,onUnsupportedFile:R,clearUnsupportedFile:I}=HD(),D=RM(),O=P.useRef(void 0),z=async()=>{O.current=se;const ye=await D.startRecording();Ye("chat_voice_started",{thread_id:d,outcome:ye==="recording"?"started":ye==="unsupported"?"unsupported":ye==="permission-denied"?"permission_denied":"unknown"})},M=()=>{Ye("chat_voice_confirmed",{thread_id:d});const ye=D.stopRecording();Z.current?.syncVoiceText(O.current,ye),Z.current?.focus()},$=()=>{Ye("chat_voice_cancelled",{thread_id:d}),D.cancelRecording(),Z.current?.restoreContent(O.current)};P.useEffect(()=>{if(D.status!=="recording")return;const ye=(D.transcript+(D.interimTranscript?" "+D.interimTranscript:"")).trim();Z.current?.syncVoiceText(O.current,ye)},[D.transcript,D.interimTranscript,D.status]);const F=i?.activeTask??null,U=F?.created_by,H=!!(w&&U&&U!==w),{data:q}=D8({enabled:H}),W=(q?.data?.members??[]).find(ye=>ye.userId===U),G=W?.user?.name??W?.user?.email?.split("@")[0]??null,Y=dd(),J=z6({isDesktopApp:Y,harnessId:F?.harness_id}),[se,oe]=P.useState(()=>w4(sessionStorage,k,f)??void 0),ne=ye=>{oe(ye),g.current=ye,P7(sessionStorage,k,f,ye,{onQuotaExceeded:({docSizeBytes:ke})=>{Ye("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:ke}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},Q=P.useRef(d);if(Q.current!==d){Q.current=d;const ye=w4(sessionStorage,k,f)??void 0;oe(ye),g.current=ye}const X=[...r].reverse().find(ye=>ye.role==="assistant")?.metadata?.modelLimits?.contextWindow??h?.limits?.contextWindow,Z=P.useRef(null),le=P.useRef(!1),ee=L==="plan",ae=ye=>{N(),Ye("chat_mode_changed",{from_mode:ye,to_mode:"default",source:"pill_dismiss"}),v("default")};P.useEffect(()=>{const ye=ke=>{t8(ke)&&ke.code==="KeyL"&&(ke.preventDefault(),ke.shiftKey&&v(L==="plan"?"default":"plan"),Z.current?.focus())};return document.addEventListener("keydown",ye),()=>document.removeEventListener("keydown",ye)},[L,v]);const ce=F6(r),de=[...r].reverse().find(ye=>ye.role==="assistant"&&ye.metadata?.usage)?.metadata?.usage?.contextTokens??0,pe=!p&&!A7(se),te=BM({hasDraft:pe,isStreaming:l,isRunInProgress:a}),ge=te==="send",ve=te==="stop",Se=ye=>{if(ye?.preventDefault(),te==="send"&&se){if(Ye("chat_message_sent",{thread_id:d||null,mode:L,model_id:h?.modelId??null,model_provider:h?.providerId??null,virtual_mcp_id:m?.id??null,submission:ye?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){xe.info(s("chat.input.stillSendingPreviousMessage"));return}n.sendMessage(se)}else u({tiptapDoc:se,virtualMcp:m});ER(sessionStorage,k,f),ne(void 0)}else te==="stop"&&(Ye("chat_message_stopped",{thread_id:d}),c())};if(H)return o.jsx(K0,{message:G?s("chat.input.readOnlyOthersChatNamed",{name:G}):s("chat.input.readOnlyOthersChat"),icon:G?o.jsx(Ts,{shape:"circle",size:"2xs",url:W?.user?.image??void 0,fallback:G.slice(0,2).toUpperCase()}):void 0});if(F?.metadata?.read_only)return o.jsx(K0,{message:s("chat.input.readOnlyThread")});if(J)return o.jsx(K0,{message:s("chat.input.codingAgentRequiresDesktop")});if(T){if(!i)return o.jsx(K0,{message:s("chat.input.fastPreviewUnavailable")});const ye=()=>{const ke=i.createTask({runtime:"sandbox"});Ye("coding_session_started",{thread_id:ke})};return o.jsxs("button",{type:"button",onClick:ye,className:"group flex w-full items-center gap-3 rounded-2xl border border-border bg-background/60 px-4 py-3.5 text-left shadow-sm backdrop-blur-sm transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[o.jsx(fa,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:s("chat.fastPreview.startCodingSession")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:s("chat.fastPreview.chatNeedsSession")})]}),o.jsx(gl,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})}return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex flex-col w-full justify-end",children:o.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&o.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&i&&o.jsx(C9,{}),n&&i&&d?o.jsx(CD,{taskId:d}):null,o.jsx(a_,{tiptapDoc:se,setTiptapDoc:ne,disabled:D.status==="recording",enterToSubmit:!0,placeholder:s("chat.input.placeholder"),onSubmit:Se,suggestionOpenRef:le,children:o.jsxs("form",{onSubmit:Se,className:ie("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[o.jsx(KM,{selectedModel:h,onUnsupportedFile:R,disabled:D.status==="recording"}),o.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:o.jsx(c_,{ref:Z,disabled:D.status==="recording",virtualMcpId:m?.id??j,showFileUploader:!0,selectedModel:h,onUnsupportedFile:R,suggestionOpenRef:le})}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:D.status==="recording"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex-1"}),o.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[o.jsx(OM,{data:D.waveformData.slice(0,28)}),o.jsx("button",{type:"button",onClick:$,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":s("chat.input.cancelRecording"),children:o.jsx(Ds,{size:16})}),o.jsx("button",{type:"button",onClick:M,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":s("chat.input.useTranscription"),children:o.jsx(Ft,{size:16})})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[o.jsx(TM,{disabled:!1,onOpenConnections:()=>{Ye("connections_dialog_opened",{source:"tools_popover",mode:"add"}),A(!0)},virtualMcpId:m?.id??j,selectedModel:h,isStreaming:l,onUnsupportedFile:R}),ee&&o.jsx(W0,{onClick:()=>ae("plan"),label:s("chat.input.planMode"),icon:o.jsx(Uc,{size:14,className:"shrink-0"}),colorClass:"text-violet-600 dark:text-violet-400 hover:bg-violet-500/10",maxWidthClass:"@[320px]/chat-bottom:max-w-32"}),L==="gen-image"&&x&&o.jsx(W0,{onClick:()=>ae("gen-image"),label:s("chat.input.createImage"),icon:o.jsx(fr,{size:14,className:"shrink-0"}),colorClass:"text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),L==="web-search"&&b&&o.jsx(W0,{onClick:()=>ae("web-search"),label:s("chat.input.webSearch"),icon:o.jsx(Hl,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),L==="deep-research"&&y&&o.jsx(W0,{onClick:()=>ae("deep-research"),label:s("chat.input.deepResearch"),icon:o.jsx(c8,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),X&&de>0&&o.jsx(eV,{usage:ce,totalTokens:de,contextWindow:X,onOpenContextPanel:t})]}),o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[o.jsx(OD,{}),D.isSupported&&o.jsx(ue,{type:"button",onClick:z,disabled:!1,variant:"ghost",size:"icon",className:ie("size-8 rounded-lg transition-colors",D.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:D.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),"aria-label":D.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),children:o.jsx(cA,{size:18})}),o.jsx(ue,{type:ve?"button":"submit",onClick:ye=>{ve&&(ye.preventDefault(),ye.stopPropagation(),c())},variant:ge||ve?"default":"ghost",size:"icon",disabled:!ge&&!ve,className:ie("size-8 rounded-lg transition-all",!ge&&!ve&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:s(te==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessageEnter"),"aria-label":s(te==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessage"),children:ve?o.jsx(dA,{size:20}):o.jsx(Jh,{size:20})})]})]})})]})},d),e&&o.jsx(EM,{onClick:()=>{Ye("connections_banner_clicked",{source:"home_chat_input"}),Ye("connections_dialog_opened",{source:"home_banner",mode:"add"}),A(!0)}})]})}),o.jsx(dg,{mode:"browse",open:V,onOpenChange:A,defaultTab:"all"}),o.jsx(FD,{info:E,onClose:I})]})}function GM(t){let e=0;for(const s of t)for(const n of s.parts??[]){const i=n;i.type==="tool-load_repo"&&i.state==="output-available"&&i.output?.success===!0&&e++}return e}function YM(){const t=B.c(8),{openPanel:e}=hi(),s=K2(),n=z2()?.messages??[],i=As()?.taskId??null;let r;t[0]!==n?(r=GM(n),t[0]=n,t[1]=r):r=t[1];const l=r,a=P.useRef(null),c=P.useRef(null);let d,f;t[2]!==l||t[3]!==s||t[4]!==e||t[5]!==i?(d=()=>{if(!l||!i)return;const u=`${i}:${l}`;c.current!==u&&(c.current=u,s?.refreshThreadMetadata(i)),a.current!==i&&(a.current=i,e("preview"))},f=[l,i,e,s],t[2]=l,t[3]=s,t[4]=e,t[5]=i,t[6]=d,t[7]=f):(d=t[6],f=t[7]),P.useEffect(d,f)}const JM={usd:[{dollars:10,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:20,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.bestValueLabel"}],brl:[{dollars:50,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:500,labelKey:"chat.creditsEmptyState.bestValueLabel"}]};function u_(t){return`deco-credits-empty-dismissed:${t}`}function QM(t){try{return localStorage.getItem(u_(t))==="1"}catch{return!1}}function XM(){const t=B.c(68),e=re(),{org:s}=Fe(),n=Ws(),{decoKeyId:i}=cg(),r=ws(),[l,a]=P.useState(!0),[c,d]=P.useState(""),[f,u]=P.useState(!1),[h,m]=P.useState("usd"),p=h==="brl"?"R$":"$";let g;t[0]!==s.id?(g=()=>{Ye("credits_empty_state_dismissed",{organization_id:s.id}),a(!1);try{localStorage.setItem(u_(s.id),"1")}catch{}},t[0]=s.id,t[1]=g):g=t[1];const x=g;let b,y;t[2]!==l||t[3]!==s.id?(b=()=>{l&&Ye("credits_empty_state_shown",{organization_id:s.id})},y=[l,s.id],t[2]=l,t[3]=s.id,t[4]=b,t[5]=y):(b=t[4],y=t[5]),P.useEffect(b,y);let L;t[6]!==h||t[7]!==r?(L=async Y=>{const{url:J}=await r.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:Y,currency:h});return J},t[6]=h,t[7]=r,t[8]=L):L=t[8];let v;t[9]!==x?(v=Y=>{Y&&window.open(Y,"_blank","noopener,noreferrer"),x()},t[9]=x,t[10]=v):v=t[10];let _;t[11]!==e?(_=Y=>{xe.error(e("chat.creditsEmptyState.topUpFailed",{message:Y.message}))},t[11]=e,t[12]=_):_=t[12];let w;t[13]!==L||t[14]!==v||t[15]!==_?(w={mutationFn:L,onSuccess:v,onError:_},t[13]=L,t[14]=v,t[15]=_,t[16]=w):w=t[16];const{mutate:S,isPending:k}=Rs(w),j=parseFloat(c),C=!isNaN(j)&&j>=1;if(!l)return null;let T;t[17]!==x?(T=Y=>!Y&&x(),t[17]=x,t[18]=T):T=t[18];let N;t[19]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-warning/8 to-transparent pointer-events-none rounded-t-lg"}),t[19]=N):N=t[19];let V;t[20]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:o.jsx(d8,{size:20,className:"text-warning"})}),t[20]=V):V=t[20];let A;t[21]!==e?(A=e("chat.creditsEmptyState.title"),t[21]=e,t[22]=A):A=t[22];let E;t[23]!==A?(E=o.jsx(Yt,{className:"text-lg font-semibold",children:A}),t[23]=A,t[24]=E):E=t[24];let R;t[25]!==e?(R=e("chat.creditsEmptyState.description"),t[25]=e,t[26]=R):R=t[26];let I;t[27]!==R?(I=o.jsx(kn,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:R}),t[27]=R,t[28]=I):I=t[28];let D;t[29]!==E||t[30]!==I?(D=o.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[N,o.jsxs(hs,{className:"relative gap-3",children:[V,o.jsxs("div",{className:"text-center",children:[E,I]})]})]}),t[29]=E,t[30]=I,t[31]=D):D=t[31];let O;t[32]!==h||t[33]!==p||t[34]!==c||t[35]!==j||t[36]!==i||t[37]!==C||t[38]!==k||t[39]!==f||t[40]!==e||t[41]!==S?(O=i&&o.jsxs("div",{className:"px-6 pb-5",children:[o.jsx("div",{className:"mb-4",children:o.jsxs(p9,{type:"single",variant:"outline",size:"sm",value:h,onValueChange:Y=>{Y&&m(Y)},children:[o.jsx(Kc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),o.jsx(Kc,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),o.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:JM[h].map(Y=>{const{dollars:J,labelKey:se}=Y;return o.jsxs("button",{type:"button",disabled:k,onClick:()=>{Ye("credits_topup_clicked",{amount_cents:J*100,currency:h,tier_label:se,source:"empty_state"}),S(J*100)},className:ie("relative flex flex-col items-center gap-1 py-6 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[o.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,J]}),o.jsx("span",{className:"text-xs text-muted-foreground",children:e(se)})]},J)})}),f?o.jsxs("div",{className:"flex gap-2 mt-3",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),o.jsx(mt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:Y=>d(Y.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),o.jsx(ue,{className:"h-10",disabled:!C||k,onClick:()=>{Ye("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:h,tier_label:"custom",source:"empty_state"}),S(Math.round(j*100))},children:e(k?"chat.creditsEmptyState.opening":"chat.creditsEmptyState.add")})]}):o.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>u(!0),children:e("chat.creditsEmptyState.enterCustomAmount")})]}),t[32]=h,t[33]=p,t[34]=c,t[35]=j,t[36]=i,t[37]=C,t[38]=k,t[39]=f,t[40]=e,t[41]=S,t[42]=O):O=t[42];let z;t[43]!==x||t[44]!==n||t[45]!==s.slug?(z=()=>{n({to:"/$org/settings/ai-providers",params:{org:s.slug}}),x()},t[43]=x,t[44]=n,t[45]=s.slug,t[46]=z):z=t[46];let M;t[47]!==e?(M=e("chat.creditsEmptyState.useYourOwnProvider"),t[47]=e,t[48]=M):M=t[48];let $;t[49]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(gl,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[49]=$):$=t[49];let F;t[50]!==z||t[51]!==M?(F=o.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:z,children:[M,$]}),t[50]=z,t[51]=M,t[52]=F):F=t[52];let U;t[53]!==e?(U=e("chat.creditsEmptyState.skipForNow"),t[53]=e,t[54]=U):U=t[54];let H;t[55]!==x||t[56]!==U?(H=o.jsx(ue,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:x,children:U}),t[55]=x,t[56]=U,t[57]=H):H=t[57];let q;t[58]!==F||t[59]!==H?(q=o.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[F,H]}),t[58]=F,t[59]=H,t[60]=q):q=t[60];let W;t[61]!==D||t[62]!==O||t[63]!==q?(W=o.jsxs(Ut,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:ZM,children:[D,O,q]}),t[61]=D,t[62]=O,t[63]=q,t[64]=W):W=t[64];let G;return t[65]!==W||t[66]!==T?(G=o.jsx(Ht,{open:!0,onOpenChange:T,children:W}),t[65]=W,t[66]=T,t[67]=G):G=t[67],G}function ZM(t){return t.preventDefault()}function eO(t){const e=B.c(6),{balanceDollars:s}=t;let n;e[0]!==s?(n=s.toFixed(2),e[0]=s,e[1]=n):n=e[1];const i=n;let r,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=ie("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-success/10 border border-success/20","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),l=o.jsx(d8,{size:13,className:"text-success"}),e[2]=r,e[3]=l):(r=e[2],l=e[3]);let a;return e[4]!==i?(a=o.jsxs("div",{className:r,children:[l,o.jsxs("span",{className:"text-xs font-medium text-success tabular-nums",children:["$",i," in credits to get started"]})]}),e[4]=i,e[5]=a):a=e[5],a}function tO(){const t=B.c(8),{org:e}=Fe(),s=Ws();let n;t[0]!==s||t[1]!==e.slug?(n=()=>s({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=s,t[1]=e.slug,t[2]=n):n=t[2];let i,r,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=ie("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-warning/10 border border-warning/20","hover:bg-warning/15","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),r=o.jsx(pn,{size:13,className:"text-warning"}),l=o.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=i,t[4]=r,t[5]=l):(i=t[3],r=t[4],l=t[5]);let a;return t[6]!==n?(a=o.jsxs("button",{type:"button",onClick:n,className:i,children:[r,l]}),t[6]=n,t[7]=a):a=t[7],a}function sO(t){const e=B.c(11),{className:s}=t;let n;e[0]!==s?(n=ie("flex h-full w-full flex-col bg-background",s),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=i):i=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("div",{className:"flex items-center gap-3",children:[i,o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),o.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=r):r=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:o.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[r,o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),o.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=l):l=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[o.jsx(q0,{align:"right",width:"w-3/4"}),o.jsx(q0,{align:"left",width:"w-full",lines:3}),o.jsx(q0,{align:"right",width:"w-2/3"}),o.jsx(q0,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=a):a=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:o.jsx("div",{className:"relative flex-1",children:o.jsxs("div",{className:"space-y-2 p-2",children:[o.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),o.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=c):c=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"flex items-center gap-1",children:o.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=d):d=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"px-4 py-4",children:o.jsx("div",{className:"mx-auto w-full max-w-2xl",children:o.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[c,o.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[d,o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),o.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=f):f=e[8];let u;return e[9]!==n?(u=o.jsxs("div",{className:n,children:[l,a,f]}),e[9]=n,e[10]=u):u=e[10],u}function q0(t){const e=B.c(22),{align:s,width:n,lines:i}=t,r=n===void 0?"w-full":n,l=i===void 0?1:i,a=s==="right"?"flex-row-reverse":"flex-row";let c;e[0]!==a?(c=ie("flex w-full gap-4 px-4 py-2",a),e[0]=a,e[1]=c):c=e[1];const d=s==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let f;e[2]!==d?(f=ie("flex min-w-0 flex-col gap-2",d),e[2]=d,e[3]=f):f=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=u):u=e[4];const h=s==="right"?"bg-muted":"bg-transparent border border-border/40";let m;e[5]!==h||e[6]!==r?(m=ie("min-w-0 rounded-2xl p-4",h,r),e[5]=h,e[6]=r,e[7]=m):m=e[7];let p;e[8]!==l?(p=Array.from({length:l}),e[8]=l,e[9]=p):p=e[9];let g;e[10]!==l||e[11]!==p?(g=o.jsx("div",{className:"space-y-2",children:p.map((L,v)=>o.jsx("div",{className:ie("h-3 rounded bg-muted-foreground/20 animate-pulse",v===l-1?"w-3/4":"w-full"),style:{animationDelay:`${v*.1}s`}},v))}),e[10]=l,e[11]=p,e[12]=g):g=e[12];let x;e[13]!==g||e[14]!==m?(x=o.jsx("div",{className:m,children:g}),e[13]=g,e[14]=m,e[15]=x):x=e[15];let b;e[16]!==x||e[17]!==f?(b=o.jsxs("div",{className:f,children:[u,x]}),e[16]=x,e[17]=f,e[18]=b):b=e[18];let y;return e[19]!==b||e[20]!==c?(y=o.jsx("div",{className:c,children:b}),e[19]=b,e[20]=c,e[21]=y):y=e[21],y}function nO(t){const e=B.c(7),{scrollRef:s,sentinelRef:n,hasMoreOlder:i,isFetchingOlder:r,fetchOlderMessages:l}=t;let a,c;e[0]!==l||e[1]!==i||e[2]!==r||e[3]!==s||e[4]!==n?(a=()=>{const d=n.current,f=s.current;if(!d||!f||!i)return;const u=new IntersectionObserver(async h=>{if(!h[0]?.isIntersecting||r||!i)return;const p=f.scrollHeight,g=f.scrollTop;await l(),requestAnimationFrame(()=>{const x=f.scrollHeight;f.scrollTop=g+(x-p)})},{root:f,rootMargin:"200px 0px 0px 0px"});return u.observe(d),()=>u.disconnect()},c=[s,n,i,r,l],e[0]=l,e[1]=i,e[2]=r,e[3]=s,e[4]=n,e[5]=a,e[6]=c):(a=e[5],c=e[6]),P.useEffect(a,c)}function iO(t){const e=B.c(5),{className:s,children:n}=t;let i;e[0]!==s?(i=ie("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=o.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function rO(t){const e=B.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("flex-1 min-h-0 overflow-y-auto isolate",n),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==s||e[3]!==i?(r=o.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=r):r=e[4],r}function oO(t){const e=B.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:s}),e[0]=s,e[1]=n):n=e[1],n}function lO(){const t=re(),{messages:e,status:s,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:r}=ui(),{taskId:l}=sn();YM();const a=B6(l??""),c=MT(a),d=c.size===0?e:e.filter(y=>!c.has(y.id)),f=tV(d),u=f.at(-1),m=VR()*gR+16,p=P.useRef(null),g=P.useRef(null);nO({scrollRef:p,sentinelRef:g,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:r});const x=sV({initial:!1}),b=y=>{p.current=y,x.scrollRef(y)};return o.jsx(nV,{messages:e,children:o.jsxs("div",{className:"relative h-full w-full min-w-0",children:[o.jsx("div",{ref:b,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:m},children:o.jsxs("div",{ref:x.contentRef,className:"overflow-x-clip",children:[o.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[o.jsx("div",{ref:g,"aria-hidden":!0,className:"h-px"}),i&&o.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:t("chat.chat.loadingOlderMessages")}),f.slice(0,-1).map((y,L)=>o.jsx(i4,{pair:y,isLastPair:!1,status:L===f.length-1?s:void 0},`pair-${y.user?.id??y.assistant?.id}`))]}),u&&o.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:o.jsx(i4,{pair:u,isLastPair:!0,status:s},`pair-${u.user?.id??u.assistant?.id}`)})]})}),!x.isAtBottom&&o.jsx(ue,{type:"button",variant:"outline",size:"icon-sm","aria-label":t("chat.chat.jumpToLatest"),className:"absolute left-1/2 z-50 -translate-x-1/2 rounded-full shadow-md animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:m+8},onClick:()=>{x.scrollToBottom()},children:o.jsx(jT,{size:14})})]})})}function aO(t){const e=B.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",n),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==s||e[3]!==i?(r=o.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=r):r=e[4],r}const ds=Object.assign(iO,{Main:rO,Messages:lO,EmptyState:oO,Footer:aO,Input:qM,Provider:IT,ActiveTaskProvider:DT,ThreadlessProvider:RT,Skeleton:sO,IceBreakers:pR,NoAiProviderEmptyState:cP,CreditsEmptyState:XM,CreditsEyebrow:eO,NoCreditsEyebrow:tO,CreditsExhaustedBanner:F7});function Yg(t){return`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`}function Jg(t,e,s){return["decofile-write",t,e,s]}function Qg(t){return`/api/${t.orgSlug}/decofile/${encodeURIComponent(t.virtualMcpId)}/${encodeURIComponent(t.branch)}`}async function N9(t,e){const s=await t.json().catch(()=>({}));throw new Error(s.error??`${e} failed (${t.status})`)}function Xg(t,e,s){t.setQueryData(Je.decofileDraft(Yg(e)),s)}function cO(t){const e=B.c(4);let s;e[0]!==t?(s=Je.decofileDraft(t?Yg(t):""),e[0]=t,e[1]=s):s=e[1];let n;e[2]!==s?(n={queryKey:s,enabled:!1,queryFn:dO,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},e[2]=s,e[3]=n):n=e[3];const{data:i}=Tt(n);return i??null}async function dO(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function uO(t,e){const s=await fetch(Qg(e),{cache:"no-store"});if(!s.ok){const i=new Error(`Failed to fetch decofile: ${s.status}`);throw i.status=s.status,i}const n=await s.json();return n.token&&Xg(t,e,{version:n.version,token:n.token,apiHost:n.apiHost??window.location.host}),n.decofile}const fO=2880*60*1e3;function hO(t,e,s=fO){if(!t)return!1;const n=new Date(t).getTime();return Number.isNaN(n)?!1:e-n>s}async function mO(t){const e=await fetch(`${Qg(t)}/status`,{cache:"no-store"});return e.ok?await e.json():N9(e,"Status")}function pO(t){return{queryKey:Je.decofileStatus(Yg(t)),queryFn:()=>mO(t),staleTime:3e4}}async function f_(t,e){const s=await fetch(Qg(t),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)});if(!s.ok)return N9(s,"Save");const n=await s.json();return{...n,apiHost:n.apiHost??window.location.host}}function gO({isThreadLocked:t,hasCloudProviderKeys:e}){return t?!1:!e}function xO(){const t=B.c(3),e=v9(),n=As()?.isThreadLocked??!1,i=e.length>0;let r;return t[0]!==n||t[1]!==i?(r=gO({isThreadLocked:n,hasCloudProviderKeys:i}),t[0]=n,t[1]=i,t[2]=r):r=t[2],r}function Rd(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function E1(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function bO(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function vO(t){const e=B.c(4),{items:s}=t;let n;e[0]!==s?(n=s.map(yO),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=o.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:n}),e[2]=n,e[3]=i):i=e[3],i}function yO(t){return o.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),o.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function _O(t){const e=B.c(33),{userTokens:s,assistantTokens:n,otherTokens:i}=t,r=re(),l=s+n+i,a=l>0?s/l*100:0,c=l>0?n/l*100:0,d=l>0?i/l*100:0;let f;e[0]!==a?(f=a>0&&o.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=f):f=e[1];let u;e[2]!==c?(u=c>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${c}%`}}),e[2]=c,e[3]=u):u=e[3];let h;e[4]!==d?(h=d>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${d}%`}}),e[4]=d,e[5]=h):h=e[5];let m;e[6]!==f||e[7]!==u||e[8]!==h?(m=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[f,u,h]}),e[6]=f,e[7]=u,e[8]=h,e[9]=m):m=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=p):p=e[10];let g;e[11]!==r||e[12]!==a?(g=r("chat.contextPanel.userPercent",{pct:a.toFixed(1)}),e[11]=r,e[12]=a,e[13]=g):g=e[13];let x;e[14]!==g?(x=o.jsxs("div",{className:"flex items-center gap-1.5",children:[p,o.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e[14]=g,e[15]=x):x=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[16]=b):b=e[16];let y;e[17]!==c||e[18]!==r?(y=r("chat.contextPanel.assistantPercent",{pct:c.toFixed(1)}),e[17]=c,e[18]=r,e[19]=y):y=e[19];let L;e[20]!==y?(L=o.jsxs("div",{className:"flex items-center gap-1.5",children:[b,o.jsx("span",{className:"text-xs text-muted-foreground",children:y})]}),e[20]=y,e[21]=L):L=e[21];let v;e[22]!==d||e[23]!==i||e[24]!==r?(v=i>0&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:r("chat.contextPanel.otherPercent",{pct:d.toFixed(1)})})]}),e[22]=d,e[23]=i,e[24]=r,e[25]=v):v=e[25];let _;e[26]!==L||e[27]!==v||e[28]!==x?(_=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[x,L,v]}),e[26]=L,e[27]=v,e[28]=x,e[29]=_):_=e[29];let w;return e[30]!==_||e[31]!==m?(w=o.jsxs("div",{className:"flex flex-col gap-2",children:[m,_]}),e[30]=_,e[31]=m,e[32]=w):w=e[32],w}function LO(t){const e=B.c(14),{agentId:s,isError:n}=t,i=Is(s),r=re();let l;e[0]!==i?.title||e[1]!==r?(l=i?.title??r("chat.subtask.subtaskNoun"),e[0]=i?.title,e[1]=r,e[2]=l):l=e[2];const a=l,c=i?.icon??null;let d;e[3]!==c||e[4]!==a?(d=o.jsx(Ei,{icon:c,name:a,size:"xs",className:"size-6 rounded-md shrink-0"}),e[3]=c,e[4]=a,e[5]=d):d=e[5];const f=n?"text-destructive":"text-foreground";let u;e[6]!==f?(u=ie("shrink-0 font-medium",f),e[6]=f,e[7]=u):u=e[7];let h;e[8]!==a||e[9]!==u?(h=o.jsx("span",{className:u,children:a}),e[8]=a,e[9]=u,e[10]=h):h=e[10];let m;return e[11]!==d||e[12]!==h?(m=o.jsxs(o.Fragment,{children:[d,h]}),e[11]=d,e[12]=h,e[13]=m):m=e[13],m}function wO(t){const e=B.c(12),{isError:s}=t,n=re();let i;e[0]!==n?(i=n("chat.contextPanel.subtask"),e[0]=n,e[1]=i):i=e[1];const r=i;let l;e[2]!==r?(l=o.jsx(Ei,{icon:null,name:r,size:"xs",className:"size-6 rounded-md shrink-0"}),e[2]=r,e[3]=l):l=e[3];const a=s?"text-destructive":"text-foreground";let c;e[4]!==a?(c=ie("shrink-0 font-medium",a),e[4]=a,e[5]=c):c=e[5];let d;e[6]!==r||e[7]!==c?(d=o.jsx("span",{className:c,children:r}),e[6]=r,e[7]=c,e[8]=d):d=e[8];let f;return e[9]!==l||e[10]!==d?(f=o.jsxs(o.Fragment,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=f):f=e[11],f}function SO(t){const e=B.c(18),{part:s}=t,n=s.input?.agent_id,i=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,r=s.state==="output-error",l=s.state==="approval-requested";let a;e[0]!==r?(a=o.jsx(wO,{isError:r}),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==n||e[3]!==r?(c=o.jsx(LO,{agentId:n,isError:r}),e[2]=n,e[3]=r,e[4]=c):c=e[4];let d;e[5]!==a||e[6]!==c?(d=o.jsx(P.Suspense,{fallback:a,children:c}),e[5]=a,e[6]=c,e[7]=d):d=e[7];let f;e[8]!==s.input?(f=s.input?.prompt&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground/50",children:"·"}),o.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=f):f=e[9];let u;e[10]!==l||e[11]!==r||e[12]!==i?(u=o.jsx("span",{className:"ml-auto shrink-0",children:i?o.jsx(ot,{size:12,className:"animate-spin text-muted-foreground"}):r?o.jsx(aA,{size:12,className:"text-destructive"}):l?o.jsx(pn,{size:12,className:"text-warning"}):o.jsx(mi,{size:12,className:"text-success"})}),e[10]=l,e[11]=r,e[12]=i,e[13]=u):u=e[13];let h;return e[14]!==d||e[15]!==f||e[16]!==u?(h=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[d,f,u]}),e[14]=d,e[15]=f,e[16]=u,e[17]=h):h=e[17],h}function kO(t){const e=B.c(78),{onClose:s,back:n,className:i}=t,r=re(),[l,a]=P.useState(null),{messages:c}=ui(),{activeTask:d}=sn(),{selectedModel:f,selectedVirtualMcp:u}=la();let h,m,p,g,x,b,y,L;if(e[0]!==d||e[1]!==n||e[2]!==i||e[3]!==c||e[4]!==s||e[5]!==l?.id||e[6]!==f||e[7]!==u?.title||e[8]!==r){L=Symbol.for("react.early_return_sentinel");e:{const w=F6(c),S=[...c].reverse().find(IO),k=S?.metadata?.usage,j=S?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow??null,C=k?.contextTokens??0,T=j&&j>0?(C/j*100).toFixed(1):null,N=c;let V;e[17]!==N?(V=N.filter(DO).reduce(RO,0),e[17]=N,e[18]=V):V=e[18];const A=V,E=c;let R;e[19]!==E?(R=E.filter(EO).reduce(PO,0),e[19]=E,e[20]=R):R=e[20];const I=R,D=Math.max(0,w.totalTokens-A-I),O=c[0],z=c.at(-1),M=O?.metadata?.created_at??d?.created_at,$=z?.metadata?.created_at??d?.updated_at,F=c.filter(AO),U=c.flatMap(TO),H=f?.modelId?bO(f.modelId):"—",q=u?.title??"Super Agent",W=[{label:r("chat.contextPanel.sessionLabel"),value:d?.title??r("chat.contextPanel.newChat")},{label:r("chat.contextPanel.messagesLabel"),value:F.length},{label:r("chat.contextPanel.agentLabel"),value:q},{label:r("chat.contextPanel.modelLabel"),value:H},{label:r("chat.contextPanel.contextLimitLabel"),value:j?Rd(j):"—"},{label:r("chat.contextPanel.sessionTokensLabel"),value:w.totalTokens>0?Rd(w.totalTokens):"0"},{label:r("chat.contextPanel.usageLabel"),value:T!==null?`${T}%`:"—"},{label:r("chat.contextPanel.inputTokensLabel"),value:w.inputTokens>0?Rd(w.inputTokens):"0"},{label:r("chat.contextPanel.outputTokensLabel"),value:w.outputTokens>0?Rd(w.outputTokens):"0"},{label:r("chat.contextPanel.reasoningTokensLabel"),value:w.reasoningTokens>0?Rd(w.reasoningTokens):"0"},{label:r("chat.contextPanel.costLabel"),value:w.cost>0?`$${w.cost<.001?w.cost.toFixed(6):w.cost.toFixed(4)}`:"$0.00"},{label:r("chat.contextPanel.sessionCreatedLabel"),value:E1(M)},{label:r("chat.contextPanel.lastActivityLabel"),value:E1($)}];if(!d&&F.length===0){let K;e[21]!==i?(K=ie("flex flex-col h-full w-full border-l border-border bg-background",i),e[21]=i,e[22]=K):K=e[22];let X;e[23]!==r?(X=r("chat.contextPanel.title"),e[23]=r,e[24]=X):X=e[24];let Z;e[25]!==X?(Z=o.jsx("span",{className:"text-sm font-medium text-foreground",children:X}),e[25]=X,e[26]=Z):Z=e[26];let le;e[27]!==n?(le=n?o.jsx(Bm,{size:14,className:"text-muted-foreground"}):o.jsx(Ci,{size:14,className:"text-muted-foreground"}),e[27]=n,e[28]=le):le=e[28];let ee;e[29]!==s||e[30]!==le?(ee=o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:le}),e[29]=s,e[30]=le,e[31]=ee):ee=e[31];let ae;e[32]!==Z||e[33]!==ee?(ae=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[Z,ee]}),e[32]=Z,e[33]=ee,e[34]=ae):ae=e[34];let ce;e[35]!==r?(ce=r("chat.contextPanel.emptyState"),e[35]=r,e[36]=ce):ce=e[36];let fe;e[37]!==ce?(fe=o.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:ce})}),e[37]=ce,e[38]=fe):fe=e[38];let de;e[39]!==K||e[40]!==ae||e[41]!==fe?(de=o.jsxs("div",{className:K,children:[ae,fe]}),e[39]=K,e[40]=ae,e[41]=fe,e[42]=de):de=e[42],L=de;break e}e[43]!==i?(b=ie("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",i),e[43]=i,e[44]=b):b=e[44];let G;e[45]!==r?(G=r("chat.contextPanel.title"),e[45]=r,e[46]=G):G=e[46];let Y;e[47]!==G?(Y=o.jsx("span",{className:"text-sm font-medium text-foreground",children:G}),e[47]=G,e[48]=Y):Y=e[48];let J;e[49]!==n?(J=n?o.jsx(Bm,{size:14}):o.jsx(Ci,{size:14}),e[49]=n,e[50]=J):J=e[50];let se;e[51]!==s||e[52]!==J?(se=o.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:J}),e[51]=s,e[52]=J,e[53]=se):se=e[53],e[54]!==Y||e[55]!==se?(y=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[Y,se]}),e[54]=Y,e[55]=se,e[56]=y):y=e[56],h="flex flex-col gap-8 p-6",m=U.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:r("chat.contextPanel.subtasksSection")}),o.jsx("div",{className:"flex flex-col gap-1",children:U.map(NO)})]}),p=o.jsx(vO,{items:W});let oe;e[57]!==r?(oe=r("chat.contextPanel.contextBreakdownSection"),e[57]=r,e[58]=oe):oe=e[58];let ne;e[59]!==oe?(ne=o.jsx("span",{className:"text-xs text-muted-foreground",children:oe}),e[59]=oe,e[60]=ne):ne=e[60];let Q;e[61]!==I||e[62]!==D||e[63]!==A?(Q=o.jsx(_O,{userTokens:A,assistantTokens:I,otherTokens:D}),e[61]=I,e[62]=D,e[63]=A,e[64]=Q):Q=e[64],e[65]!==ne||e[66]!==Q?(g=o.jsxs("div",{className:"flex flex-col gap-3",children:[ne,Q]}),e[65]=ne,e[66]=Q,e[67]=g):g=e[67],x=F.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:r("chat.contextPanel.rawMessagesSection")}),o.jsx("div",{className:"flex flex-col gap-1",children:F.map(K=>{const X=K.metadata?.created_at,Z=l?.id===K.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(Z?null:K),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:ie("shrink-0 font-medium",K.role==="user"?"text-chart-1":"text-chart-2"),children:K.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:K.id})]}),X&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:E1(X)})]}),Z&&o.jsxs(o.Fragment,{children:[K.role==="assistant"&&(()=>{const le=K.metadata?._request;if(!le)return null;const ee=le.systemSections??[],ae=Math.max(1,...ee.map(CO)),ce=ee.reduce(jO,0);return o.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium text-foreground",children:r("chat.contextPanel.requestLabel")}),o.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[le.activeTools??0," / ",le.tools??0," ",r("chat.contextPanel.toolsActive")]})]}),ee.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"text-muted-foreground",children:[r("chat.contextPanel.systemPromptLabel")," ",o.jsxs("span",{className:"tabular-nums",children:["~",Math.round(ce/4).toLocaleString()," ",r("chat.contextPanel.tokAbbrev")]})]}),ee.map((fe,de)=>{const pe=fe.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${de}`,te=fe.chars/ae*100,ge=Math.round(fe.chars/4);return o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-mono text-foreground truncate",children:pe}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",ge.toLocaleString()," ",r("chat.contextPanel.tokAbbrev")]})]}),o.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${te}%`}})})]},de)})]})]})})(),o.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(K,null,2)})]})]},K.id)})})]})}e[0]=d,e[1]=n,e[2]=i,e[3]=c,e[4]=s,e[5]=l?.id,e[6]=f,e[7]=u?.title,e[8]=r,e[9]=h,e[10]=m,e[11]=p,e[12]=g,e[13]=x,e[14]=b,e[15]=y,e[16]=L}else h=e[9],m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],y=e[15],L=e[16];if(L!==Symbol.for("react.early_return_sentinel"))return L;let v;e[68]!==h||e[69]!==m||e[70]!==p||e[71]!==g||e[72]!==x?(v=o.jsxs("div",{className:h,children:[m,p,g,x]}),e[68]=h,e[69]=m,e[70]=p,e[71]=g,e[72]=x,e[73]=v):v=e[73];let _;return e[74]!==b||e[75]!==y||e[76]!==v?(_=o.jsxs("div",{className:b,children:[y,v]}),e[74]=b,e[75]=y,e[76]=v,e[77]=_):_=e[77],_}function jO(t,e){return t+e.chars}function CO(t){return t.chars}function NO(t,e){return o.jsx(SO,{part:t},e)}function TO(t){return(t.parts??[]).filter(VO)}function VO(t){return t.type==="tool-subtask"}function AO(t){return t.role!=="system"}function PO(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function EO(t){return t.role==="assistant"}function RO(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function DO(t){return t.role==="user"}function IO(t){return t.role==="assistant"&&t.metadata?.usage}function MO(t){const e=B.c(21),{onOpenContextPanel:s}=t,{org:n}=Fe(),{selectedVirtualMcp:i}=la();let r;e[0]!==n.id?(r=ca(n.id),e[0]=n.id,e[1]=r):r=e[1];const a=i??r,d=Is(a.id)??a,f=d.title??"Super Agent",u=d.icon??null,h=d.description??null;let m;e[2]!==u||e[3]!==f?(m=o.jsx(ci,{icon:u,name:f,size:"lg"}),e[2]=u,e[3]=f,e[4]=m):m=e[4];let p;e[5]!==f?(p=o.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:f}),e[5]=f,e[6]=p):p=e[6];let g;e[7]!==h?(g=h?o.jsx("p",{className:"text-sm text-muted-foreground max-w-md text-balance",children:h}):null,e[7]=h,e[8]=g):g=e[8];let x;e[9]!==p||e[10]!==g?(x=o.jsxs("div",{className:"space-y-1.5",children:[p,g]}),e[9]=p,e[10]=g,e[11]=x):x=e[11];let b;e[12]!==m||e[13]!==x?(b=o.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center gap-4 px-6 text-center overflow-hidden",children:[m,x]}),e[12]=m,e[13]=x,e[14]=b):b=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(ds.IceBreakers,{className:"pb-3"}),e[15]=y):y=e[15];let L;e[16]!==s?(L=o.jsxs(ds.Footer,{children:[y,o.jsx(ds.Input,{onOpenContextPanel:s})]}),e[16]=s,e[17]=L):L=e[17];let v;return e[18]!==b||e[19]!==L?(v=o.jsxs(o.Fragment,{children:[b,L]}),e[18]=b,e[19]=L,e[20]=v):v=e[20],v}function F4(t){const e=B.c(17),{outputs:s,collapsed:n,onToggle:i,variant:r}=t,l=r==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let a;e[0]!==l?(a=ie(l),e[0]=l,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=c):c=e[2];const d=n&&"-rotate-90";let f;e[3]!==d?(f=ie("size-4 text-muted-foreground transition-transform",d),e[3]=d,e[4]=f):f=e[4];let u;e[5]!==f?(u=o.jsx(Qt,{className:f}),e[5]=f,e[6]=u):u=e[6];let h;e[7]!==i||e[8]!==u?(h=o.jsxs("button",{type:"button",onClick:i,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[c,u]}),e[7]=i,e[8]=u,e[9]=h):h=e[9];let m;e[10]!==n||e[11]!==s?(m=!n&&o.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(OO)}),e[10]=n,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==a||e[14]!==h||e[15]!==m?(p=o.jsxs("div",{className:a,children:[h,m]}),e[13]=a,e[14]=h,e[15]=m,e[16]=p):p=e[16],p}function OO(t){return o.jsx(rV,{file:t},t.key)}function $O(){const t=B.c(13),e=As()?.taskId??null,s=iV();let n;t[0]!==s?(n={enabled:s},t[0]=s,t[1]=n):n=t[1];const{data:i}=U6(e,n),[r,l]=P.useState(!1),[a,c]=P.useState(!0);if(!e||!i||i.length===0)return null;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>l(zO),t[2]=d):d=t[2];let f;t[3]!==r||t[4]!==i?(f=o.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:o.jsx(F4,{variant:"card",outputs:i,collapsed:r,onToggle:d})}),t[3]=r,t[4]=i,t[5]=f):f=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>c(BO),t[6]=u):u=t[6];let h;t[7]!==a||t[8]!==i?(h=o.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:o.jsx(F4,{variant:"bar",outputs:i,collapsed:a,onToggle:u})}),t[7]=a,t[8]=i,t[9]=h):h=t[9];let m;return t[10]!==f||t[11]!==h?(m=o.jsxs(o.Fragment,{children:[f,h]}),t[10]=f,t[11]=h,t[12]=m):m=t[12],m}function BO(t){return!t}function zO(t){return!t}function FO(){const t=B.c(31),{org:e}=Fe(),s=As(),{isChatEmpty:n}=ui(),[i,r]=P.useState("chat"),l=cg(),a=xO(),{runtime:c}=Tn(s?.virtualMcpId);if(a&&c!=="cms"){let C;return t[0]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(ds,{className:"animate-in fade-in-0 duration-200",children:o.jsx(ds.Main,{className:"flex flex-col items-center",children:o.jsx(ds.EmptyState,{children:o.jsx(ds.NoAiProviderEmptyState,{})})})}),t[0]=C):C=t[0],C}let f;t[1]!==l.hasDecoKey||t[2]!==l.hasOnlyDecoProvider||t[3]!==l.isLoading||t[4]!==l.isZeroBalance||t[5]!==n||t[6]!==e?(f=l.hasDecoKey&&l.isZeroBalance&&l.hasOnlyDecoProvider&&!l.isLoading&&n&&!QM(e.id),t[1]=l.hasDecoKey,t[2]=l.hasOnlyDecoProvider,t[3]=l.isLoading,t[4]=l.isZeroBalance,t[5]=n,t[6]=e,t[7]=f):f=t[7];const u=f;let h;t[8]!==u?(h=u&&o.jsx(ds.CreditsEmptyState,{}),t[8]=u,t[9]=h):h=t[9];const m=i!=="chat"?!0:void 0,p=i!=="chat",g=i!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let x;t[10]!==g?(x=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",g),t[10]=g,t[11]=x):x=t[11];let b;t[12]!==n||t[13]!==c?(b=n&&c!=="cms"?o.jsx(MO,{onOpenContextPanel:()=>r("context")}):o.jsxs(o.Fragment,{children:[o.jsxs(ds.Main,{className:"relative flex flex-col overflow-hidden @container",children:[o.jsx($O,{}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(ds.Messages,{})})]}),o.jsx(ds.Footer,{children:o.jsx(ds.Input,{onOpenContextPanel:()=>r("context")})})]}),t[12]=n,t[13]=c,t[14]=b):b=t[14];let y;t[15]!==m||t[16]!==p||t[17]!==x||t[18]!==b?(y=o.jsx("div",{inert:m,"aria-hidden":p,className:x,children:b}),t[15]=m,t[16]=p,t[17]=x,t[18]=b,t[19]=y):y=t[19];const L=i!=="context"?!0:void 0,v=i!=="context",_=i==="context"?"opacity-100":"opacity-0 pointer-events-none";let w;t[20]!==_?(w=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",_),t[20]=_,t[21]=w):w=t[21];let S;t[22]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(kO,{back:!0,onClose:()=>r("chat")}),t[22]=S):S=t[22];let k;t[23]!==w||t[24]!==L||t[25]!==v?(k=o.jsx("div",{inert:L,"aria-hidden":v,className:w,children:S}),t[23]=w,t[24]=L,t[25]=v,t[26]=k):k=t[26];let j;return t[27]!==h||t[28]!==k||t[29]!==y?(j=o.jsxs(ds,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[h,y,k]}),t[27]=h,t[28]=k,t[29]=y,t[30]=j):j=t[30],j}function h_(){const t=B.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(ds.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Us,{fallback:e,children:o.jsx(P.Suspense,{fallback:o.jsx(ds.Skeleton,{}),children:o.jsx(FO,{})})}),t[1]=s):s=t[1],s}function UO(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function Zg(t){return t?.name||t?.email?.split("@")[0]||void 0}function Bu(t){const e=UO(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}async function HO(t,e,s){const n=await t.callTool({name:e,arguments:s});if(n.isError){const i=n.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(i)}return n}const m_=["SANDBOX_START"],G0=new Map,KO=t=>`${t.virtualMcpId}::${t.branch??""}`,WO=t=>t.message.includes("retry shortly"),R1=new Set,Qm={mark:(t,e)=>R1.add(`${t}::${e}`),clear:(t,e)=>R1.delete(`${t}::${e}`),isStopped:(t,e)=>R1.has(`${t}::${e}`)};function p_(t,e){const s=ps();return Rs({mutationKey:m_,retry:(n,i)=>WO(i)&&n<6,retryDelay:n=>a0(5e3,500,n,2,0),mutationFn:async n=>{n.branch&&Qm.clear(n.virtualMcpId,n.branch);const i=KO(n),r=G0.get(i);if(r)return r;const l=(async()=>(await HO(t,"SANDBOX_START",n)).structuredContent)();G0.set(i,l);try{return await l}finally{G0.get(i)===l&&G0.delete(i)}},onSuccess:()=>{Nu(s),e?.onStarted?.()}})}function qO(t,e){const s=B.c(3);let n;return s[0]!==e||s[1]!==t?(n={mutationKey:m_,predicate:r=>{if(!t)return!1;const l=r.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=n):n=s[2],b7(n)>0}function g_(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e={select:GO},t[0]=e):e=t[0],QN(e)}function GO(t){for(let e=t.matches.length-1;e>=0;e--){const s=t.matches[e]?.staticData.defaultMain;if(s)return s}return null}function x_(t){return!!t.harness_id||!!t.title&&t.title!=="New chat"}function YO(t){return{threadId:t.routeThreadId,providerKey:t.routeThreadId??t.fallbackKey}}function U4(t,e){return Number(e.sidePanelOpen)+Number(e.mainOpen)<=1?!1:t==="side"?e.sidePanelOpen:e.mainOpen}function JO(t){return t.sidePanelOpen||t.mainOpen?t:{...t,sidePanelOpen:!0}}function QO(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",n=t.mainPanelParam??(t.panelNamed||!!t.routeDefaultMain||!s),i=t.routeDefaultMain?!1:s||t.entityMetadata?.chatDefaultOpen===!0||t.threadHasMessages===!0,r=t.sidePanelParamPresent?t.sidePanelParamValue===!0:i;return JO({sidePanelOpen:r,mainOpen:n})}function H4(t,e){switch(t.type){case"toggleSidePanel":return e.sidePanelOpen?U4("side",e)?{sidepanel:!1}:null:{sidepanel:!0};case"toggleMain":return e.mainOpen?U4("main",e)?{mainpanel:!1}:null:{mainpanel:!0};case"openSidePanel":return e.sidePanelOpen?null:{sidepanel:!0}}}function XO(t){return t.sidePanelOpen&&t.mainOpen?{side:33,main:67}:t.sidePanelOpen?{side:100,main:0}:t.mainOpen?{side:0,main:100}:{side:0,main:0}}function ZO(t){const{sidePanelOpen:e,mainOpen:s}=t.visibility;return e&&(t.sidePanelParamPresent||!s)?"chat":s?"main":"chat"}function e$(t){return{sidepanel:!0,mainpanel:!1}}function t$(t,e){const s=Ws(),n=tA(),i=hl({strict:!1}),r=no({strict:!1}),{create:l}=od(),{threads:a}=W2(),{virtualMcpId:c,isAgentRoute:d}=e,f=g_(),u=bg(),h=o9(),m=P.useRef(crypto.randomUUID()),{threadId:p,providerKey:g}=YO({routeThreadId:h,fallbackKey:m.current}),x=p!=null?a.find(j=>j.id===p):void 0,{sidePanelOpen:b,mainOpen:y}=QO({entityMetadata:t,mainPanelParam:i.mainpanel,panelNamed:u!==void 0,sidePanelParamPresent:i.sidepanel!==void 0,sidePanelParamValue:i.sidepanel,routeDefaultMain:f,threadHasMessages:x?x_(x):!1}),L={sidePanelOpen:b,mainOpen:y},v=d&&!r.project?{virtualmcpid:c}:{},_=(j,C)=>{s({to:".",search:T=>({...T,...j}),replace:C?.replace??!1})},w=()=>{const j=H4({type:"toggleMain"},L);j&&_(j,{replace:!0})},S=()=>{const j=H4({type:"toggleSidePanel"},L);j&&_(j,{replace:!0})},k=async()=>{const j=crypto.randomUUID(),C=a.find(T=>T.id===p)?.branch??null;try{await l({id:j,virtual_mcp_id:c,...C?{branch:C}:{}})}catch{}n(j,()=>({...v}))};return{threadId:p,providerKey:g,sidePanelOpen:b,mainOpen:y,sidePanelParamPresent:i.sidepanel!==void 0,toggleMain:w,toggleSidePanel:S,createNewTask:k}}function s$(t){const e=B.c(10),{org:s}=Fe(),n=K2(),{data:i}=Nn.useSession(),r=i?.user?.id,l=t?.id??null,a=!!t&&!!r&&!!t.created_by&&t.created_by!==r;let c;e[0]!==s.id||e[1]!==l?(c=Je.viewedThreadMetadataRefresh(s.id,l??""),e[0]=s.id,e[1]=l,e[2]=c):c=e[2];const d=!!n&&!!l&&a;let f;e[3]!==n||e[4]!==l?(f=async()=>(await n?.refreshThreadMetadata(l??""),!0),e[3]=n,e[4]=l,e[5]=f):f=e[5];let u;e[6]!==c||e[7]!==d||e[8]!==f?(u={queryKey:c,enabled:d,staleTime:Number.POSITIVE_INFINITY,queryFn:f},e[6]=c,e[7]=d,e[8]=f,e[9]=u):u=e[9],Tt(u)}function n$(t,e){const s=getComputedStyle(t),n=parseFloat(s.fontSize);return e*n}function i$(t,e){const s=getComputedStyle(t.ownerDocument.documentElement),n=parseFloat(s.fontSize);return e*n}function r$(t){return t/100*window.innerHeight}function o$(t){return t/100*window.innerWidth}function l$(t){switch(typeof t){case"number":return[t,"px"];case"string":{const e=parseFloat(t);return t.endsWith("%")?[e,"%"]:t.endsWith("px")?[e,"px"]:t.endsWith("rem")?[e,"rem"]:t.endsWith("em")?[e,"em"]:t.endsWith("vh")?[e,"vh"]:t.endsWith("vw")?[e,"vw"]:[e,"%"]}}}function Zd({groupSize:t,panelElement:e,styleProp:s}){let n;const[i,r]=l$(s);switch(r){case"%":{n=i/100*t;break}case"px":{n=i;break}case"rem":{n=i$(e,i);break}case"em":{n=n$(e,i);break}case"vh":{n=r$(i);break}case"vw":{n=o$(i);break}}return n}function Ln(t){return parseFloat(t.toFixed(3))}function Yc({group:t}){const{orientation:e,panels:s}=t;return s.reduce((n,i)=>(n+=e==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,n),0)}function Xm(t){const{panels:e}=t,s=Yc({group:t});return s===0?e.map(n=>({groupResizeBehavior:n.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:n.panelConstraints.disabled,minSize:0,maxSize:100,panelId:n.id})):e.map(n=>{const{element:i,panelConstraints:r}=n;let l=0;if(r.collapsedSize!==void 0){const f=Zd({groupSize:s,panelElement:i,styleProp:r.collapsedSize});l=Ln(f/s*100)}let a;if(r.defaultSize!==void 0){const f=Zd({groupSize:s,panelElement:i,styleProp:r.defaultSize});a=Ln(f/s*100)}let c=0;if(r.minSize!==void 0){const f=Zd({groupSize:s,panelElement:i,styleProp:r.minSize});c=Ln(f/s*100)}let d=100;if(r.maxSize!==void 0){const f=Zd({groupSize:s,panelElement:i,styleProp:r.maxSize});d=Ln(f/s*100)}return{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:l,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:c,maxSize:d,panelId:n.id}})}function Zt(t,e="Assertion error"){if(!t)throw Error(e)}function Zm(t,e){return Array.from(e).sort(t==="horizontal"?a$:c$)}function a$(t,e){const s=t.element.offsetLeft-e.element.offsetLeft;return s!==0?s:t.element.offsetWidth-e.element.offsetWidth}function c$(t,e){const s=t.element.offsetTop-e.element.offsetTop;return s!==0?s:t.element.offsetHeight-e.element.offsetHeight}function b_(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function v_(t,e){return{x:t.x>=e.left&&t.x<=e.right?0:Math.min(Math.abs(t.x-e.left),Math.abs(t.x-e.right)),y:t.y>=e.top&&t.y<=e.bottom?0:Math.min(Math.abs(t.y-e.top),Math.abs(t.y-e.bottom))}}function d$({orientation:t,rects:e,targetRect:s}){const n={x:s.x+s.width/2,y:s.y+s.height/2};let i,r=Number.MAX_VALUE;for(const l of e){const{x:a,y:c}=v_(n,l),d=t==="horizontal"?a:c;d<r&&(r=d,i=l)}return Zt(i,"No rect found"),i}let Y0;function u$(){return Y0===void 0&&(typeof matchMedia=="function"?Y0=!!matchMedia("(pointer:coarse)").matches:Y0=!1),Y0}function y_(t){const{element:e,orientation:s,panels:n,separators:i}=t,r=Zm(s,Array.from(e.children).filter(b_).map(p=>({element:p}))).map(({element:p})=>p),l=[];let a=!1,c=!1,d=-1,f=-1,u=0,h,m=[];{let p=-1;for(const g of r)g.hasAttribute("data-panel")&&(p++,g.hasAttribute("data-disabled")||(u++,d===-1&&(d=p),f=p))}if(u>1){let p=-1;for(const g of r)if(g.hasAttribute("data-panel")){p++;const x=n.find(b=>b.element===g);if(x){if(h){const b=h.element.getBoundingClientRect(),y=g.getBoundingClientRect();let L;if(c){const v=s==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),_=s==="horizontal"?new DOMRect(y.left,y.top,0,y.height):new DOMRect(y.left,y.top,y.width,0);switch(m.length){case 0:{L=[v,_];break}case 1:{const w=m[0],S=d$({orientation:s,rects:[b,y],targetRect:w.element.getBoundingClientRect()});L=[w,S===b?_:v];break}default:{L=m;break}}}else m.length?L=m:L=[s==="horizontal"?new DOMRect(b.right,y.top,y.left-b.right,y.height):new DOMRect(y.left,b.bottom,y.width,y.top-b.bottom)];for(const v of L){let _="width"in v?v:v.element.getBoundingClientRect();const w=u$()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(_.width<w){const k=w-_.width;_=new DOMRect(_.x-k/2,_.y,_.width+k,_.height)}if(_.height<w){const k=w-_.height;_=new DOMRect(_.x,_.y-k/2,_.width,_.height+k)}const S=p<=d||p>f;!a&&!S&&l.push({group:t,groupSize:Yc({group:t}),panels:[h,x],separator:"width"in v?void 0:v,rect:_}),a=!1}}c=!1,h=x,m=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(a=!0);const x=i.find(b=>b.element===g);x?m.push(x):(h=void 0,m=[])}else c=!0}return l}let __=class{#e={};addListener(e,s){const n=this.#e[e];return n===void 0?this.#e[e]=[s]:n.includes(s)||n.push(s),()=>{this.removeListener(e,s)}}emit(e,s){const n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,s);else{let i=!1,r=null;const l=Array.from(n);for(let a=0;a<l.length;a++){const c=l[a];try{c.call(null,s)}catch(d){r===null&&(i=!0,r=d)}}if(i)throw r}}removeAllListeners(){this.#e={}}removeListener(e,s){const n=this.#e[e];if(n!==void 0){const i=n.indexOf(s);i>=0&&n.splice(i,1)}}},Ec={cursorFlags:0,state:"inactive"};const e3=new __;function ql(){return Ec}function f$(t){return e3.addListener("change",t)}function h$(t){const e=Ec,s={...Ec};s.cursorFlags=t,Ec=s,e3.emit("change",{prev:e,next:s})}function Rc(t){const e=Ec;Ec=t,e3.emit("change",{prev:e,next:t})}const m$=t=>t,D1=()=>{},L_=1,w_=2,S_=4,k_=8,K4=3,W4=12;let J0;function q4(){return J0===void 0&&(J0=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(J0=!0)),J0}function p$({cursorFlags:t,groups:e,state:s}){let n=0,i=0;switch(s){case"active":case"hover":e.forEach(r=>{if(!r.mutableState.disableCursor)switch(r.orientation){case"horizontal":{n++;break}case"vertical":{i++;break}}})}if(!(n===0&&i===0)){switch(s){case"active":{if(t&&q4()){const r=(t&L_)!==0,l=(t&w_)!==0,a=(t&S_)!==0,c=(t&k_)!==0;if(r)return a?"se-resize":c?"ne-resize":"e-resize";if(l)return a?"sw-resize":c?"nw-resize":"w-resize";if(a)return"s-resize";if(c)return"n-resize"}break}}return q4()?n>0&&i>0?"move":n>0?"ew-resize":"ns-resize":n>0&&i>0?"grab":n>0?"col-resize":"row-resize"}}const G4=new WeakMap;function t3(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:s}=G4.get(t)??{};s===void 0&&(s=new t.defaultView.CSSStyleSheet,t.adoptedStyleSheets&&(Object.isExtensible(t.adoptedStyleSheets)?t.adoptedStyleSheets.push(s):t.adoptedStyleSheets=[...t.adoptedStyleSheets,s]));const n=ql();switch(n.state){case"active":case"hover":{const i=p$({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(l=>l.group),state:n.state}),r=`*, *:hover {cursor: ${i} !important; }`;if(e===r)return;e=r,i?s.cssRules.length===0?s.insertRule(r):s.replaceSync(r):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{e=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}G4.set(t,{prevStyle:e,styleSheet:s})}let nr=new Map;const j_=new __;function g$(t){nr=new Map(nr),nr.delete(t)}function Y4(t,e){for(const[s]of nr)if(s.id===t)return s}function Wo(t,e){for(const[s,n]of nr)if(s.id===t)return n;if(e)throw Error(`Could not find data for Group with id ${t}`)}function pa(){return nr}function s3(t,e){return j_.addListener("groupChange",s=>{s.group.id===t&&e(s)})}function Zr(t,e,s){const n=nr.get(t);nr=new Map(nr),nr.set(t,e),j_.emit("groupChange",{group:t,isUserInteraction:s?.isUserInteraction===!0,prev:n,next:e})}function C_(t){const e=ql();let s=!1;return e.state==="active"&&(Rc({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(t3(t),s=!0,e.hitRegions.forEach(n=>{const i=Wo(n.group.id,!0);Zr(n.group,i,{isUserInteraction:!0})}))),s}function J4(t){t.defaultPrevented||C_(t.currentTarget)}function x$(t,e,s){let n,i={x:1/0,y:1/0};for(const r of e){const l=v_(s,r.rect);switch(t){case"horizontal":{l.x<=i.x&&(n=r,i=l);break}case"vertical":{l.y<=i.y&&(n=r,i=l);break}}}return n?{distance:i,hitRegion:n}:void 0}function b$(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function v$(t,e){if(t===e)throw new Error("Cannot compare node with itself");const s={a:Z4(t),b:Z4(e)};let n;for(;s.a.at(-1)===s.b.at(-1);)n=s.a.pop(),s.b.pop();Zt(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:X4(Q4(s.a)),b:X4(Q4(s.b))};if(i.a===i.b){const r=n.childNodes,l={a:s.a.at(-1),b:s.b.at(-1)};let a=r.length;for(;a--;){const c=r[a];if(c===l.a)return 1;if(c===l.b)return-1}}return Math.sign(i.a-i.b)}const y$=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function _$(t){const e=getComputedStyle(N_(t)??t).display;return e==="flex"||e==="inline-flex"}function L$(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||_$(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||y$.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function Q4(t){let e=t.length;for(;e--;){const s=t[e];if(Zt(s,"Missing node"),L$(s))return s}return null}function X4(t){return t&&Number(getComputedStyle(t).zIndex)||0}function Z4(t){const e=[];for(;t;)e.push(t),t=N_(t);return e}function N_(t){const{parentNode:e}=t;return b$(e)?e.host:e}function w$(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function S$({groupElement:t,hitRegion:e,pointerEventTarget:s}){if(!b_(s)||s.contains(t)||t.contains(s))return!0;if(v$(s,t)>0){let n=s;for(;n;){if(n.contains(t))return!0;if(w$(n.getBoundingClientRect(),e))return!1;n=n.parentElement}}return!0}function n3(t,e){const s=[];return e.forEach((n,i)=>{if(i.disabled)return;const r=y_(i),l=x$(i.orientation,r,{x:t.clientX,y:t.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&S$({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:t.target})&&s.push(l.hitRegion)}),s}function k$(t,e){if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!=e[s])return!1;return!0}function fn(t,e,s=0){return Math.abs(Ln(t)-Ln(e))<=s}function Ji(t,e){return fn(t,e)?0:t>e?1:-1}function Nc({overrideDisabledPanels:t,panelConstraints:e,prevSize:s,size:n}){const{collapsedSize:i=0,collapsible:r,disabled:l,maxSize:a=100,minSize:c=0}=e;if(l&&!t)return s;if(Ji(n,c)<0)if(r){const d=(i+c)/2;Ji(n,d)<0?n=i:n=c}else n=c;return n=Math.min(a,n),n=Ln(n),n}function zu({delta:t,initialLayout:e,panelConstraints:s,pivotIndices:n,prevLayout:i,trigger:r}){if(fn(t,0))return e;const l=r==="imperative-api",a=Object.values(e),c=Object.values(i),d=[...a],[f,u]=n;Zt(f!=null,"Invalid first pivot index"),Zt(u!=null,"Invalid second pivot index");let h=0;switch(r){case"keyboard":{{const g=t<0?u:f,x=s[g];Zt(x,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:y,minSize:L=0}=x;if(y){const v=a[g];if(Zt(v!=null,`Previous layout not found for panel index ${g}`),fn(v,b)){const _=L-v;Ji(_,Math.abs(t))>0&&(t=t<0?0-_:_)}}}{const g=t<0?f:u,x=s[g];Zt(x,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:y,minSize:L=0}=x;if(y){const v=a[g];if(Zt(v!=null,`Previous layout not found for panel index ${g}`),fn(v,L)){const _=v-b;Ji(_,Math.abs(t))>0&&(t=t<0?0-_:_)}}}break}default:{const g=t<0?u:f,x=s[g];Zt(x,`Panel constraints not found for index ${g}`);const b=a[g],{collapsible:y,collapsedSize:L,minSize:v}=x;if(y&&Ji(b,v)<0)if(t>0){const _=v-L,w=_/2,S=b+t;Ji(S,v)<0&&(t=Ji(t,w)<=0?0:_)}else{const _=v-L,w=100-_/2,S=b-t;Ji(S,v)<0&&(t=Ji(100+t,w)>0?0:-_)}break}}{const g=t<0?1:-1;let x=t<0?u:f,b=0;for(;;){const L=a[x];Zt(L!=null,`Previous layout not found for panel index ${x}`);const v=Nc({overrideDisabledPanels:l,panelConstraints:s[x],prevSize:L,size:100})-L;if(b+=v,x+=g,x<0||x>=s.length)break}const y=Math.min(Math.abs(t),Math.abs(b));t=t<0?0-y:y}{let g=t<0?f:u;for(;g>=0&&g<s.length;){const x=Math.abs(t)-Math.abs(h),b=a[g];Zt(b!=null,`Previous layout not found for panel index ${g}`);const y=b-x,L=Nc({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:b,size:y});if(!fn(b,L)&&(h+=b-L,d[g]=L,h.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(k$(c,d))return i;{const g=t<0?u:f,x=a[g];Zt(x!=null,`Previous layout not found for panel index ${g}`);const b=x+h,y=Nc({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:x,size:b});if(d[g]=y,!fn(y,b)){let L=b-y,v=t<0?u:f;for(;v>=0&&v<s.length;){const _=d[v];Zt(_!=null,`Previous layout not found for panel index ${v}`);const w=_+L,S=Nc({overrideDisabledPanels:l,panelConstraints:s[v],prevSize:_,size:w});if(fn(_,S)||(L-=S-_,d[v]=S),fn(L,0))break;t>0?v--:v++}}}const m=Object.values(d).reduce((g,x)=>x+g,0);if(!fn(m,100,.1))return i;const p=Object.keys(i);return d.reduce((g,x,b)=>(g[p[b]]=x,g),{})}function Gl(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(e[s]===void 0||Ji(t[s],e[s])!==0)return!1;return!0}function Yl({layout:t,panelConstraints:e}){const s=Object.values(t),n=[...s],i=n.reduce((a,c)=>a+c,0);if(n.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${n.map(a=>`${a}%`).join(", ")}`);if(!fn(i,100)&&n.length>0)for(let a=0;a<e.length;a++){const c=n[a];Zt(c!=null,`No layout data found for index ${a}`);const d=100/i*c;n[a]=d}let r=0;for(let a=0;a<e.length;a++){const c=s[a];Zt(c!=null,`No layout data found for index ${a}`);const d=n[a];Zt(d!=null,`No layout data found for index ${a}`);const f=Nc({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});d!=f&&(r+=d-f,n[a]=f)}if(!fn(r,0))for(let a=0;a<e.length;a++){const c=n[a];Zt(c!=null,`No layout data found for index ${a}`);const d=c+r,f=Nc({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});if(c!==f&&(r-=f-c,n[a]=f,fn(r,0)))break}const l=Object.keys(t);return n.reduce((a,c,d)=>(a[l[d]]=c,a),{})}function T_({groupId:t,panelId:e}){const s=()=>{const c=pa();for(const[d,{defaultLayoutDeferred:f,derivedPanelConstraints:u,layout:h,groupSize:m,separatorToPanels:p}]of c)if(d.id===t)return{defaultLayoutDeferred:f,derivedPanelConstraints:u,group:d,groupSize:m,layout:h,separatorToPanels:p};throw Error(`Group ${t} not found`)},n=()=>{const c=s().derivedPanelConstraints.find(d=>d.panelId===e);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${e}`)},i=()=>{const c=s().group.panels.find(d=>d.id===e);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},r=()=>{const c=s().layout[e];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},l=({nextSize:c,panels:d,prevLayout:f,derivedPanelConstraints:u})=>{const h=r(),m=d.findIndex(x=>x.id===e),p=m===0,g=m===d.length-1;if(g&&c<h&&(p||d.slice(0,m).every((x,b)=>{const y=u[b];return y?.collapsible&&fn(y.collapsedSize,f[y.panelId])}))){const x=d.slice(0,m).reduce((b,y)=>b+f[y.id],0);return{...f,[e]:Ln(100-x)}}return zu({delta:g?h-c:c-h,initialLayout:f,panelConstraints:u,pivotIndices:g?[m-1,m]:[m,m+1],prevLayout:f,trigger:"imperative-api"})},a=c=>{const d=r();if(c===d)return;const{defaultLayoutDeferred:f,derivedPanelConstraints:u,group:h,groupSize:m,layout:p,separatorToPanels:g}=s(),x=l({nextSize:c,panels:h.panels,prevLayout:p,derivedPanelConstraints:u}),b=Yl({layout:x,panelConstraints:u});Gl(p,b)||Zr(h,{defaultLayoutDeferred:f,derivedPanelConstraints:u,groupSize:m,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:d}=n(),{mutableValues:f}=i(),u=r();c&&u!==d&&(f.expandToSize=u,a(d))},expand:()=>{const{collapsible:c,collapsedSize:d,minSize:f}=n(),{mutableValues:u}=i(),h=r();if(c&&h===d){let m=u.expandToSize??f;m===0&&(m=1),a(m)}},getSize:()=>{const{group:c}=s(),d=r(),{element:f}=i(),u=c.orientation==="horizontal"?f.offsetWidth:f.offsetHeight;return{asPercentage:d,inPixels:u}},isCollapsed:()=>{const{collapsible:c,collapsedSize:d}=n(),f=r();return c&&fn(d,f)},resize:c=>{const{group:d}=s(),{element:f}=i(),u=Yc({group:d}),h=Zd({groupSize:u,panelElement:f,styleProp:c}),m=Ln(h/u*100);a(m)}}}function e5(t){if(t.defaultPrevented)return;const e=pa();n3(t,e).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const n=s.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(n){const i=n.panelConstraints.defaultSize,r=T_({groupId:s.group.id,panelId:n.id});r&&i!==void 0&&(r.resize(i),t.preventDefault())}}})}function If(t){const e=pa();for(const[s]of e)if(s.separators.some(n=>n.element===t))return s;throw Error("Could not find parent Group for separator element")}function V_({groupId:t}){const e=()=>{const s=pa();for(const[n,i]of s)if(n.id===t)return{group:n,...i};throw Error(`Could not find Group with id "${t}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:n}=e();return s?{}:n},setLayout(s){const{defaultLayoutDeferred:n,derivedPanelConstraints:i,group:r,groupSize:l,layout:a,separatorToPanels:c}=e(),d=Yl({layout:s,panelConstraints:i});return n?a:(Gl(a,d)||Zr(r,{defaultLayoutDeferred:n,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c}),d)}}}function kl(t,e){const s=If(t),n=Wo(s.id,!0),i=s.separators.find(f=>f.element===t);Zt(i,"Matching separator not found");const r=n.separatorToPanels.get(i);Zt(r,"Matching panels not found");const l=r.map(f=>s.panels.indexOf(f)),a=V_({groupId:s.id}).getLayout(),c=zu({delta:e,initialLayout:a,panelConstraints:n.derivedPanelConstraints,pivotIndices:l,prevLayout:a,trigger:"keyboard"}),d=Yl({layout:c,panelConstraints:n.derivedPanelConstraints});Gl(a,d)||Zr(s,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:d,separatorToPanels:n.separatorToPanels},{isUserInteraction:!0})}function t5(t){if(t.defaultPrevented)return;const e=t.currentTarget,s=If(e);if(!s.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),s.orientation==="vertical"&&kl(e,5);break}case"ArrowLeft":{t.preventDefault(),s.orientation==="horizontal"&&kl(e,-5);break}case"ArrowRight":{t.preventDefault(),s.orientation==="horizontal"&&kl(e,5);break}case"ArrowUp":{t.preventDefault(),s.orientation==="vertical"&&kl(e,-5);break}case"End":{t.preventDefault(),kl(e,100);break}case"Enter":{t.preventDefault();const n=If(e),i=Wo(n.id,!0),{derivedPanelConstraints:r,layout:l,separatorToPanels:a}=i,c=n.separators.find(h=>h.element===e);Zt(c,"Matching separator not found");const d=a.get(c);Zt(d,"Matching panels not found");const f=d[0],u=r.find(h=>h.panelId===f.id);if(Zt(u,"Panel metadata not found"),u.collapsible){const h=l[f.id],m=u.collapsedSize===h?n.mutableState.expandedPanelSizes[f.id]??u.minSize:u.collapsedSize;kl(e,m-h)}break}case"F6":{t.preventDefault();const n=If(e).separators.map(l=>l.element),i=Array.from(n).findIndex(l=>l===t.currentTarget);Zt(i!==null,"Index not found");const r=t.shiftKey?i>0?i-1:n.length-1:i+1<n.length?i+1:0;n[r].focus({preventScroll:!0});break}case"Home":{t.preventDefault(),kl(e,-100);break}}}function s5(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=pa(),s=n3(t,e),n=new Map;let i=!1;s.forEach(r=>{r.separator&&(i||(i=!0,r.separator.element.focus({focusVisible:!1,preventScroll:!0})));const l=e.get(r.group);l&&n.set(r.group,l.layout)}),Rc({cursorFlags:0,hitRegions:s,initialLayoutMap:n,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),s.length&&t.preventDefault()}function A_({document:t,event:e,hitRegions:s,initialLayoutMap:n,mountedGroups:i,pointerDownAtPoint:r,prevCursorFlags:l}){let a=0;s.forEach(d=>{const{group:f,groupSize:u}=d,{orientation:h,panels:m}=f,{disableCursor:p}=f.mutableState;let g=0;r?h==="horizontal"?g=(e.clientX-r.x)/u*100:g=(e.clientY-r.y)/u*100:h==="horizontal"?g=e.clientX<0?-100:100:g=e.clientY<0?-100:100;const x=n.get(f),b=i.get(f);if(!x||!b)return;const{defaultLayoutDeferred:y,derivedPanelConstraints:L,groupSize:v,layout:_,separatorToPanels:w}=b;if(L&&_&&w){const S=zu({delta:g,initialLayout:x,panelConstraints:L,pivotIndices:d.panels.map(k=>m.indexOf(k)),prevLayout:_,trigger:"mouse-or-touch"});if(Gl(S,_)){if(g!==0&&!p)switch(h){case"horizontal":{a|=g<0?L_:w_;break}case"vertical":{a|=g<0?S_:k_;break}}}else Zr(d.group,{defaultLayoutDeferred:y,derivedPanelConstraints:L,groupSize:v,layout:S,separatorToPanels:w})}});let c=0;e.movementX===0?c|=l&K4:c|=a&K4,e.movementY===0?c|=l&W4:c|=a&W4,h$(c),t3(t)}function n5(t){const e=pa(),s=ql();s.state==="active"&&A_({document:t.currentTarget,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:e,prevCursorFlags:s.cursorFlags})}function i5(t){if(t.defaultPrevented)return;const e=ql(),s=pa();switch(e.state){case"active":{if(t.buttons===0){Rc({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{const i=Wo(n.group.id,!0);Zr(n.group,i,{isUserInteraction:!0})});return}for(const n of e.hitRegions)if(n.separator){const{element:i}=n.separator;i.hasPointerCapture?.(t.pointerId)||i.setPointerCapture?.(t.pointerId)}A_({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const n=n3(t,s);n.length===0?e.state!=="inactive"&&Rc({cursorFlags:0,state:"inactive"}):Rc({cursorFlags:0,hitRegions:n,state:"hover"}),t3(t.currentTarget);break}}}function r5(t){t.relatedTarget instanceof HTMLIFrameElement&&ql().state==="hover"&&Rc({cursorFlags:0,state:"inactive"})}function o5(t){t.defaultPrevented||t.pointerType==="mouse"&&t.button>0||C_(t.currentTarget)&&t.preventDefault()}function l5(t){let e=0,s=0;const n={};for(const r of t)if(r.defaultSize!==void 0){e++;const l=Ln(r.defaultSize);s+=l,n[r.panelId]=l}else n[r.panelId]=void 0;const i=t.length-e;if(i!==0){const r=Ln((100-s)/i);for(const l of t)l.defaultSize===void 0&&(n[l.panelId]=r)}return n}function j$(t,e,s){if(!s[0])return;const n=t.panels.find(c=>c.element===e);if(!n||!n.onResize)return;const i=Yc({group:t}),r=t.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,l=n.mutableValues.prevSize,a={asPercentage:Ln(r/i*100),inPixels:r};n.mutableValues.prevSize=a,n.onResize(a,n.id,l)}function C$(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function N$({group:t,nextGroupSize:e,prevGroupSize:s,prevLayout:n}){if(s<=0||e<=0||s===e)return n;let i=0,r=0,l=!1;const a=new Map,c=[];for(const u of t.panels){const h=n[u.id]??0;if(u.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){l=!0;const m=h/100*s,p=Ln(m/e*100);a.set(u.id,p),i+=p}else c.push(u.id),r+=h}if(!l||c.length===0)return n;const d=100-i,f={...n};if(a.forEach((u,h)=>{f[h]=u}),r>0)for(const u of c){const h=n[u]??0;f[u]=Ln(h/r*d)}else{const u=Ln(d/c.length);for(const h of c)f[h]=u}return f}function T$(t,e){const s=t.map(i=>i.id),n=Object.keys(e);if(s.length!==n.length)return!1;for(const i of s)if(!n.includes(i))return!1;return!0}const pc=new Map;function V$(t){let e=!0;Zt(t.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=t.element.ownerDocument.defaultView.ResizeObserver,n=new Set,i=new Set,r=new s(p=>{for(const g of p){const{borderBoxSize:x,target:b}=g;if(b===t.element){if(e){const y=Yc({group:t});if(y===0)return;const L=Wo(t.id);if(!L)return;const v=Xm(t),_=L.defaultLayoutDeferred?l5(v):L.layout,w=N$({group:t,nextGroupSize:y,prevGroupSize:L.groupSize,prevLayout:_}),S=Yl({layout:w,panelConstraints:v});if(!L.defaultLayoutDeferred&&Gl(L.layout,S)&&C$(L.derivedPanelConstraints,v)&&L.groupSize===y)return;Zr(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:v,groupSize:y,layout:S,separatorToPanels:L.separatorToPanels})}}else j$(t,b,x)}});r.observe(t.element),t.panels.forEach(p=>{Zt(!n.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),n.add(p.id),p.onResize&&r.observe(p.element)});const l=Yc({group:t}),a=Xm(t),c=t.panels.map(({id:p})=>p).join(",");let d=t.mutableState.defaultLayout;d&&(T$(t.panels,d)||(d=void 0));const f=t.mutableState.layouts[c]??d??l5(a),u=Yl({layout:f,panelConstraints:a}),h=t.element.ownerDocument;pc.set(h,(pc.get(h)??0)+1);const m=new Map;return y_(t).forEach(p=>{p.separator&&m.set(p.separator,p.panels)}),Zr(t,{defaultLayoutDeferred:l===0,derivedPanelConstraints:a,groupSize:l,layout:u,separatorToPanels:m}),t.separators.forEach(p=>{Zt(!i.has(p.id),`Separator ids must be unique; id "${p.id}" was used more than once`),i.add(p.id),p.element.addEventListener("keydown",t5)}),pc.get(h)===1&&(h.addEventListener("contextmenu",J4,!0),h.addEventListener("dblclick",e5,!0),h.addEventListener("pointerdown",s5,!0),h.addEventListener("pointerleave",n5),h.addEventListener("pointermove",i5),h.addEventListener("pointerout",r5),h.addEventListener("pointerup",o5,!0)),function(){e=!1,pc.set(h,Math.max(0,(pc.get(h)??0)-1)),g$(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",t5)}),pc.get(h)||(h.removeEventListener("contextmenu",J4,!0),h.removeEventListener("dblclick",e5,!0),h.removeEventListener("pointerdown",s5,!0),h.removeEventListener("pointerleave",n5),h.removeEventListener("pointermove",i5),h.removeEventListener("pointerout",r5),h.removeEventListener("pointerup",o5,!0)),r.disconnect()}}function A$(){const[t,e]=P.useState({}),s=P.useCallback(()=>e({}),[]);return[t,s]}function i3(t){const e=P.useId();return`${t??e}`}const ga=typeof window<"u"?P.useLayoutEffect:P.useEffect;function fu(t){const e=P.useRef(t);return ga(()=>{e.current=t},[t]),P.useCallback((...s)=>e.current?.(...s),[e])}function r3(...t){return fu(e=>{t.forEach(s=>{if(s)switch(typeof s){case"function":{s(e);break}case"object":{s.current=e;break}}})})}function o3(t){const e=P.useRef({...t});return ga(()=>{for(const s in t)e.current[s]=t[s]},[t]),e.current}const P_=P.createContext(null);function P$(t,e){const s=P.useRef({getLayout:()=>({}),setLayout:m$});P.useImperativeHandle(e,()=>s.current,[]),ga(()=>{Object.assign(s.current,V_({groupId:t}))})}function E_({children:t,className:e,defaultLayout:s,disableCursor:n,disabled:i,elementRef:r,groupRef:l,id:a,onLayoutChange:c,onLayoutChanged:d,orientation:f="horizontal",resizeTargetMinimumSize:u={coarse:20,fine:10},style:h,...m}){const p=P.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=fu(T=>{Gl(p.current.onLayoutChange,T)||(p.current.onLayoutChange=T,c?.(T))}),x=fu((T,N)=>{Gl(p.current.onLayoutChanged,T)||(p.current.onLayoutChanged=T,d?.(T,{isUserInteraction:N}))}),b=i3(a),y=P.useRef(null),[L,v]=A$(),_=P.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:u,separators:[]}),w=r3(y,r);P$(b,l);const S=fu((T,N)=>{const V=ql(),A=Y4(T),E=Wo(T);if(E){let R=!1;return V.state==="active"&&(R=V.hitRegions.some(I=>I.group===A)),{flexGrow:E.layout[N]??1,pointerEvents:R?"none":void 0}}if(s?.[N])return{flexGrow:s?.[N]}}),k=o3({defaultLayout:s,disableCursor:n}),j=P.useMemo(()=>({get disableCursor(){return!!k.disableCursor},getPanelStyles:S,id:b,orientation:f,registerPanel:T=>{const N=_.current;return N.panels=Zm(f,[...N.panels,T]),v(),()=>{N.panels=N.panels.filter(V=>V!==T),v()}},registerSeparator:T=>{const N=_.current;return N.separators=Zm(f,[...N.separators,T]),v(),()=>{N.separators=N.separators.filter(V=>V!==T),v()}},updatePanelProps:(T,{disabled:N})=>{const V=_.current.panels.find(R=>R.id===T);V&&(V.panelConstraints.disabled=N);const A=Y4(b),E=Wo(b);A&&E&&Zr(A,{...E,derivedPanelConstraints:Xm(A)})},updateSeparatorProps:(T,{disabled:N,disableDoubleClick:V})=>{const A=_.current.separators.find(E=>E.id===T);A&&(A.disabled=N,A.disableDoubleClick=V)}}),[S,b,v,f,k]),C=P.useRef(null);return ga(()=>{const T=y.current;if(T===null)return;const N=_.current;let V;if(k.defaultLayout!==void 0&&Object.keys(k.defaultLayout).length===N.panels.length){V={};for(const z of N.panels){const M=k.defaultLayout[z.id];M!==void 0&&(V[z.id]=M)}}const A={disabled:!!i,element:T,id:b,mutableState:{defaultLayout:V,disableCursor:!!k.disableCursor,expandedPanelSizes:_.current.lastExpandedPanelSizes,layouts:_.current.layouts},orientation:f,panels:N.panels,resizeTargetMinimumSize:N.resizeTargetMinimumSize,separators:N.separators};C.current=A;const E=V$(A),{defaultLayoutDeferred:R,derivedPanelConstraints:I,layout:D}=Wo(A.id,!0);!R&&I.length>0&&(g(D),x(D,!1));const O=s3(b,z=>{const{defaultLayoutDeferred:M,derivedPanelConstraints:$,layout:F}=z.next;if(M||$.length===0)return;const U=A.panels.map(({id:q})=>q).join(",");A.mutableState.layouts[U]=F,$.forEach(q=>{if(q.collapsible){const{layout:W}=z.prev??{};if(W){const G=fn(q.collapsedSize,F[q.panelId]),Y=fn(q.collapsedSize,W[q.panelId]);G&&!Y&&(A.mutableState.expandedPanelSizes[q.panelId]=W[q.panelId])}}});const H=ql().state!=="active";g(F),H&&x(F,z.isUserInteraction)});return()=>{C.current=null,E(),O()}},[i,b,x,g,f,L,k]),P.useEffect(()=>{const T=C.current;T&&(T.mutableState.defaultLayout=s,T.mutableState.disableCursor=!!n)}),o.jsx(P_.Provider,{value:j,children:o.jsx("div",{...m,className:e,"data-group":!0,"data-testid":b,id:b,ref:w,style:{height:"100%",width:"100%",overflow:"hidden",...h,display:"flex",flexDirection:f==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:f==="horizontal"?"pan-y":"pan-x"},children:t})})}E_.displayName="Group";function l3(){const t=P.useContext(P_);return Zt(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function E$(t,e){const{id:s}=l3(),n=P.useRef({collapse:D1,expand:D1,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:D1});P.useImperativeHandle(e,()=>n.current,[]),ga(()=>{Object.assign(n.current,T_({groupId:s,panelId:t}))})}function R_({children:t,className:e,collapsedSize:s="0%",collapsible:n=!1,defaultSize:i,disabled:r,elementRef:l,groupResizeBehavior:a="preserve-relative-size",id:c,maxSize:d="100%",minSize:f="0%",onResize:u,panelRef:h,style:m,...p}){const g=!!c,x=i3(c),b=o3({disabled:r}),y=P.useRef(null),L=r3(y,l),{getPanelStyles:v,id:_,orientation:w,registerPanel:S,updatePanelProps:k}=l3(),j=u!==null,C=fu((A,E,R)=>{u?.(A,c,R)});ga(()=>{const A=y.current;if(A!==null){const E={element:A,id:x,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?C:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:s,collapsible:n,defaultSize:i,disabled:b.disabled,maxSize:d,minSize:f}};return S(E)}},[a,s,n,i,j,x,g,d,f,C,S,b]),P.useEffect(()=>{k(x,{disabled:r})},[r,x,k]),E$(x,h);const T=()=>{const A=v(_,x);if(A)return JSON.stringify(A)},N=P.useSyncExternalStore(A=>s3(_,A),T,T);let V;return N?V=JSON.parse(N):i!==void 0?V={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:V={flexGrow:1},o.jsx("div",{...p,"data-disabled":r||void 0,"data-panel":!0,"data-testid":x,id:x,ref:L,style:{...R$,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...V},children:o.jsx("div",{className:e,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:w==="horizontal"?"pan-y":"pan-x"},children:t})})}R_.displayName="Panel";const R$={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function D$({layout:t,panelConstraints:e,panelId:s,panelIndex:n}){let i,r;const l=t[s],a=e.find(c=>c.panelId===s);if(a){const c=a.maxSize,d=a.collapsible?a.collapsedSize:a.minSize,f=[n,n+1];r=Yl({layout:zu({delta:d-l,initialLayout:t,panelConstraints:e,pivotIndices:f,prevLayout:t}),panelConstraints:e})[s],i=Yl({layout:zu({delta:c-l,initialLayout:t,panelConstraints:e,pivotIndices:f,prevLayout:t}),panelConstraints:e})[s]}return{valueControls:s,valueMax:i,valueMin:r,valueNow:l}}function D_({children:t,className:e,disabled:s,disableDoubleClick:n,elementRef:i,id:r,style:l,...a}){const c=i3(r),d=o3({disabled:s,disableDoubleClick:n}),[f,u]=P.useState({}),[h,m]=P.useState("inactive"),[p,g]=P.useState(!1),x=P.useRef(null),b=r3(x,i),{disableCursor:y,id:L,orientation:v,registerSeparator:_,updateSeparatorProps:w}=l3(),S=v==="horizontal"?"vertical":"horizontal";ga(()=>{const C=x.current;if(C!==null){const T={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:C,id:c},N=_(T),V=f$(E=>{m(E.next.state!=="inactive"&&E.next.hitRegions.some(R=>R.separator===T)?E.next.state:"inactive")}),A=s3(L,E=>{const{derivedPanelConstraints:R,layout:I,separatorToPanels:D}=E.next,O=D.get(T);if(O){const z=O[0],M=O.indexOf(z);u(D$({layout:I,panelConstraints:R,panelId:z.id,panelIndex:M}))}});return()=>{V(),A(),N()}}},[L,c,_,d]),P.useEffect(()=>{w(c,{disabled:s,disableDoubleClick:n})},[s,n,c,w]);let k;s&&!y&&(k="not-allowed");let j;return s?j="disabled":h==="active"?j="active":p?j="focus":j=h,o.jsx("div",{...a,"aria-controls":f.valueControls,"aria-disabled":s||void 0,"aria-orientation":S,"aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:t,className:e,"data-separator":j,"data-testid":c,id:c,onBlur:()=>g(!1),onFocus:()=>g(!0),ref:b,role:"separator",style:{flexBasis:"auto",cursor:k,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}D_.displayName="Separator";function ep(t){const e=B.c(10);let s,n,i;e[0]!==t?({className:s,ref:i,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let r;e[4]!==s?(r=ie("flex h-full w-full",s),e[4]=s,e[5]=r):r=e[5];let l;return e[6]!==n||e[7]!==i||e[8]!==r?(l=o.jsx(E_,{groupRef:i,"data-slot":"resizable-panel-group",className:r,...n}),e[6]=n,e[7]=i,e[8]=r,e[9]=l):l=e[9],l}function Tc(t){const e=B.c(10);let s,n,i;e[0]!==t?({ref:n,style:i,...s}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let r;e[4]!==i?(r={overflow:"hidden",...i},e[4]=i,e[5]=r):r=e[5];let l;return e[6]!==s||e[7]!==n||e[8]!==r?(l=o.jsx(R_,{panelRef:n,"data-slot":"resizable-panel",style:r,...s}),e[6]=s,e[7]=n,e[8]=r,e[9]=l):l=e[9],l}function tp(t){const e=B.c(12);let s,n,i;e[0]!==t?({withHandle:i,className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let r;e[4]!==s?(r=ie("bg-border focus-visible:ring-ring relative flex w-[0.5px] items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:-translate-y-1/2 aria-[orientation=horizontal]:after:translate-x-0 [&[aria-orientation=horizontal]>div]:rotate-90",s),e[4]=s,e[5]=r):r=e[5];let l;e[6]!==i?(l=i&&o.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:o.jsx(ld,{className:"size-2.5"})}),e[6]=i,e[7]=l):l=e[7];let a;return e[8]!==n||e[9]!==r||e[10]!==l?(a=o.jsx(D_,{"data-slot":"resizable-handle",className:r,...n,children:l}),e[8]=n,e[9]=r,e[10]=l,e[11]=a):a=e[11],a}function a5(t,e){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function I$(t,e){const s=B.c(8);let n;s[0]!==e?(n=c=>a5(c,e),s[0]=e,s[1]=n):n=s[1];const[i,r]=Yh(t,n);let l;s[2]!==e||s[3]!==i?(l=a5(i,e),s[2]=e,s[3]=i,s[4]=l):l=s[4];let a;return s[5]!==r||s[6]!==l?(a=[l,r],s[5]=r,s[6]=l,s[7]=a):a=s[7],a}const M$=33;function O$(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=D2.sidePanelWidth(),t[0]=e):e=t[0],I$(e,M$)}function sp(){const t=B.c(3),[e,s]=P.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const a=()=>s(l.clientWidth);a();const c=new ResizeObserver(a);return c.observe(l),()=>c.disconnect()},t[0]=n):n=t[0];const i=n;let r;return t[1]!==e?(r=[e,i],t[1]=e,t[2]=r):r=t[2],r}function I_(t){if(!t||typeof t!="object")return null;const e=t;return e.isError?e.content?.find(n=>n.type==="text")?.text?.trim()||"GitHub MCP tool returned an error":null}function a3(t){const e=I_(t);if(e)throw new Error(e)}function $$(t){try{return JSON.parse(t)}catch{return null}}function B$(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(r=>r.type==="text")?.text,n=s?$$(s):null,i=e.structuredContent;return i==null?n:typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0?n??i:i}function g0(t){const e=B$(t);return e===null?null:e}function M_(t){if(!t)return null;const e=t.match(/\/pull\/(\d+)\b/);if(!e)return null;const s=Number(e[1]);return Number.isFinite(s)&&s>0?s:null}function z$(t){if(!t||typeof t!="object")return null;const e=t.content?.find(i=>i.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],n=M_(s);return!n||!s?null:{number:n,htmlUrl:s}}function c5(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const d5=/[\r\n<>]/,F$=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function x0(t){const e=t?.userName?.trim();if(!e||d5.test(e))return null;const s=t?.userEmail?.trim();return!s||d5.test(s)?{userName:e}:F$.test(s)?{userName:e,userEmail:s}:{userName:e}}function U$(t){return t.split(`
4
4
  `).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
5
5
  `).trimEnd()}function H$(t){const e=t.userName.trim(),s=t.userEmail?.trim();return s?`Co-authored-by: ${e} <${s}>`:`Co-authored-by: ${e}`}function O_(t,e){const s=x0(e);if(!s)return t;const n=U$(t),i=H$(s);if(n.includes(i))return n;const r=n.trimEnd();return r.length>0?`${r}
@@ -619,10 +619,10 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
619
619
  22% { opacity: 0; }
620
620
  }
621
621
  `}),e[27]=_):_=e[27];let w;return e[28]!==v||e[29]!==u?(w=o.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 select-none [clip-path:inset(-24px_0_-200px_0)]",children:[u,v,_]}),e[28]=v,e[29]=u,e[30]=w):w=e[30],w}function pf(t){const e=B.c(10),{phase:s,current:n,children:i}=t,r=s-n,l=r<0,a=r===0,c=l?90:r*-22,d=l?.94:1-Math.max(r,0)*.04,f=l?0:a?1:r===1?.8:.55,u=l?10:30-r,h=!a;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=ie("absolute inset-0 overflow-hidden rounded-xl border border-foreground/10 bg-background shadow-[0_20px_60px_-20px_rgb(0_0_0_/_0.35)] transition-all ease-[cubic-bezier(0.22,1,0.36,1)]"),e[0]=m):m=e[0];const p=`translateY(${c}px) scale(${d})`,g=a?"auto":"none";let x;e[1]!==f||e[2]!==p||e[3]!==g||e[4]!==u?(x={transform:p,opacity:f,zIndex:u,transitionDuration:"1000ms",pointerEvents:g},e[1]=f,e[2]=p,e[3]=g,e[4]=u,e[5]=x):x=e[5];let b;return e[6]!==i||e[7]!==h||e[8]!==x?(b=o.jsx("div",{"aria-hidden":h,className:m,style:x,children:i}),e[6]=i,e[7]=h,e[8]=x,e[9]=b):b=e[9],b}function s1(t){const e=B.c(7),{showUrl:s}=t,n=s===void 0?!1:s;let i,r,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:ie("size-2.5 rounded-full",ni)}),r=o.jsx("div",{className:ie("size-2.5 rounded-full",ni)}),l=o.jsx("div",{className:ie("size-2.5 rounded-full",ni)}),e[0]=i,e[1]=r,e[2]=l):(i=e[0],r=e[1],l=e[2]);let a;e[3]!==n?(a=n&&o.jsx("div",{className:ie("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",Xi)}),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==a?(c=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[i,r,l,a]}),e[5]=a,e[6]=c):c=e[6],c}function use(){const t=B.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(s1,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsx("div",{className:"flex flex-1 px-8 py-5",children:o.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:rse.map(fse)})})]}),t[1]=s):s=t[1],s}function fse(t,e){if(e===Lk)return o.jsx("div",{className:"rounded-md bg-chart-1/[0.55]",style:{animation:"vm-breathe 2.4s ease-in-out infinite"}},e);const s=t;return o.jsx("div",{className:ie("relative rounded-md",ni),children:o.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${wk}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function hse(){const t=B.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(s1,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:ie("w-[18%] rounded-md",Xi),style:{animation:"vm-breathe 3s ease-in-out infinite"}}),t[1]=s):s=t[1];let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"h-[42%] shrink-0 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.4s infinite"}}),t[2]=n):n=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"col-span-3 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.8s infinite"}}),t[3]=i):i=t[3];let r;return t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[n,o.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[i,o.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[o.jsx("div",{className:ie("rounded-md",Xi),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),o.jsx("div",{className:ie("rounded-md",Xi),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=r):r=t[4],r}function mse(){const t=B.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(s1,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:o.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:ase.map(pse)})})]}),t[1]=s):s=t[1],s}function pse(t,e){return o.jsx("div",{className:ie("aspect-square rounded-md",cse[e]?"bg-chart-2/70":ni),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function gse(){const t=B.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(s1,{showUrl:!0}),t[0]=e):e=t[0];let s,n,i,r,l;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),n=o.jsx("div",{className:ie("h-1.5 w-[70%] rounded-sm",ni)}),i=o.jsx("div",{className:ie("h-1.5 w-[55%] rounded-sm",ni)}),r=o.jsx("div",{className:ie("h-1.5 w-[80%] rounded-sm",ni)}),l=o.jsx("div",{className:ie("h-1.5 w-[50%] rounded-sm",ni)}),t[1]=s,t[2]=n,t[3]=i,t[4]=r,t[5]=l):(s=t[1],n=t[2],i=t[3],r=t[4],l=t[5]);let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsxs("div",{className:"flex w-[18%] shrink-0 flex-col gap-1.5 bg-chart-1/[0.05] p-2.5",children:[s,n,i,r,l,o.jsx("div",{className:"mt-auto",children:o.jsx("div",{className:ie("h-4 rounded-md",ni)})})]}),t[6]=a):a=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:o.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[o.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),o.jsx("div",{className:ie("h-1.5 w-[55%] rounded-sm",Xi)})]})}),t[7]=c):c=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[o.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),o.jsx("div",{className:ie("h-4 w-10 rounded-full",Xi)}),o.jsx("div",{className:ie("h-4 w-14 rounded-full",Xi)})]}),t[8]=d):d=t[8];let f;t[9]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsxs("div",{className:ie("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",Xi),children:[o.jsx("div",{className:ie("h-1.5 w-[50%] rounded-sm",ni)}),o.jsx("div",{className:ie("h-1 w-[75%] rounded-sm",ni)})]}),t[9]=f):f=t[9];let u;return t[10]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsxs("div",{className:"flex min-h-0 flex-1",children:[a,o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c,o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[d,o.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[f,o.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[o.jsx("div",{className:ie("rounded-md",Xi)}),o.jsx("div",{className:ie("rounded-md",Xi)})]})]})]})]})]})]}),t[10]=u):u=t[10],u}function $c(t){const e=B.c(52),s=re();if(t.kind==="starting"){let m;return e[0]!==t.claimPhase||e[1]!==t.progress?(m=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsx(dse,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=m):m=e[2],m}if(t.kind==="errored"){const m=t.error.code===lp.githubNotAuthenticated,p=t.error.code===lp.githubConnectionMissing;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(so,{className:"size-12 text-destructive"}),e[3]=g):g=e[3];let x;e[4]!==s?(x=s("sandbox.stateCard.erroredHeadline"),e[4]=s,e[5]=x):x=e[5];let b;e[6]!==x?(b=o.jsx("h3",{className:"text-lg font-medium",children:x}),e[6]=x,e[7]=b):b=e[7];let y;e[8]!==p||e[9]!==m||e[10]!==t.error.message||e[11]!==s?(y=p?s("sandbox.stateCard.githubConnectionMissingMessage"):m?s("sandbox.stateCard.githubNotAuthenticatedMessage"):t.error.message,e[8]=p,e[9]=m,e[10]=t.error.message,e[11]=s,e[12]=y):y=e[12];let L;e[13]!==y?(L=o.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:y}),e[13]=y,e[14]=L):L=e[14];let v;e[15]!==p||e[16]!==m||e[17]!==t.connectionsHref||e[18]!==s?(v=(m||p)&&t.connectionsHref&&o.jsx(ue,{asChild:!0,children:o.jsx("a",{href:t.connectionsHref,children:s(p?"sandbox.stateCard.linkRepoAgain":"sandbox.stateCard.reconnectGithub")})}),e[15]=p,e[16]=m,e[17]=t.connectionsHref,e[18]=s,e[19]=v):v=e[19];const _=t.onRetry;let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Dn,{className:"size-4"}),e[20]=w):w=e[20];let S;e[21]!==s?(S=s("sandbox.stateCard.retry"),e[21]=s,e[22]=S):S=e[22];let k;e[23]!==t.onRetry||e[24]!==S?(k=o.jsxs(ue,{variant:"outline",onClick:_,children:[w," ",S]}),e[23]=t.onRetry,e[24]=S,e[25]=k):k=e[25];let j;e[26]!==v||e[27]!==k?(j=o.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[v,k]}),e[26]=v,e[27]=k,e[28]=j):j=e[28];let C;return e[29]!==j||e[30]!==b||e[31]!==L?(C=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[g,b,L,j]})}),e[29]=j,e[30]=b,e[31]=L,e[32]=C):C=e[32],C}let n;e[33]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(SA,{className:"size-12 text-blue-500"}),e[33]=n):n=e[33];let i;e[34]!==s?(i=s("sandbox.stateCard.suspendedHeadline"),e[34]=s,e[35]=i):i=e[35];let r;e[36]!==i?(r=o.jsx("h3",{className:"text-lg font-medium",children:i}),e[36]=i,e[37]=r):r=e[37];let l;e[38]!==s?(l=s("sandbox.stateCard.resumeToContinue"),e[38]=s,e[39]=l):l=e[39];let a;e[40]!==l?(a=o.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:l}),e[40]=l,e[41]=a):a=e[41];const c=t.onResume;let d;e[42]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Kl,{className:"size-4"}),e[42]=d):d=e[42];let f;e[43]!==s?(f=s("sandbox.stateCard.resume"),e[43]=s,e[44]=f):f=e[44];let u;e[45]!==t.onResume||e[46]!==f?(u=o.jsxs(ue,{onClick:c,className:"mt-2",children:[d," ",f]}),e[45]=t.onResume,e[46]=f,e[47]=u):u=e[47];let h;return e[48]!==r||e[49]!==a||e[50]!==u?(h=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[n,r,a,u]})}),e[48]=r,e[49]=a,e[50]=u,e[51]=h):h=e[51],h}function mx(t,e,s){return`deco:preview:last-page:${t}:${e}:${s}`}function xse(t){if(!t)return null;try{const e=JSON.parse(t);if(!e||typeof e!="object"||Array.isArray(e)||typeof e.path!="string"||!e.path.startsWith("/"))return null;const s=typeof e.pageKey=="string"?e.pageKey:null,n={};if(e.params&&typeof e.params=="object")for(const[i,r]of Object.entries(e.params))typeof r=="string"&&(n[i]=r);return{path:e.path,pageKey:s,params:n}}catch{return null}}function px(t){try{return xse(localStorage.getItem(t))}catch{return null}}function bse(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function Sk(t){switch(t.lifecycle.phase){case"cloning":case"checking-out":return{step:"cloning",status:"doing"};case"clone-failed":return{step:"cloning",status:"failed"};case"installing":return{step:"install",status:"doing"};case"install-failed":return{step:"install",status:"failed"};case"starting":return{step:"dev",status:"doing"};case"running":return{step:"dev",status:"done"};case"start-failed":return{step:"dev",status:"failed"};case"crashed":return{step:"dev",status:"failed"};case"idle":return t.claimPhase&&t.claimPhase.kind!=="ready"&&t.claimPhase.kind!=="failed"?{step:"provision",status:"doing"}:{step:"cloning",status:"doing"}}}const Jb="site-links",vse=/details?page|\bpdp\b/i,yse=/listingpage|\bplp\b/i;function _se(t,e,s){const n=new Set;for(const a of s)vse.test(a)&&n.add("product"),yse.test(a)&&n.add("category");const i=oh(qo(t)),r=i[i.length-1],l=i[i.length-2];return r?.type==="text"&&r.text==="/p"&&l?.type==="param"&&l.name===e&&n.add("product"),e==="*"&&i.some(a=>a.type==="param"&&a.name==="*")&&n.add("category"),n}const Lse=["rosa","preto","pink","black"];function gf(t,e){const s=e.trim();return s?t(s):Lse.flatMap(n=>t(n))}function wse(t,e){const s=e.trim(),n=[];/^\d+$/.test(s)&&n.push({resolveType:t,props:{ids:[s]}});const r=s.includes("-")&&!/\s/.test(s)?s.replace(/-+/g," "):s;return n.push({resolveType:t,props:{query:r,count:10}}),n}const kk=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function gx(t){return t.split("/")[0]??""}function Sse(t){const e=new Set;for(const s of t){const n=gx(s);kk.has(n)&&e.add(n)}return e}function kse(t,e){const s=gx(t);return!kk.has(s)||e.size===0?!0:e.has(s)}const jse=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>gf(s=>wse(t,s),e),optionsFromPayload:xf},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>gf(s=>[{resolveType:t,props:{props:{search:s,pageSize:10,currentPage:1}}}],e),optionsFromPayload:xf},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>gf(s=>[{resolveType:t,props:{term:s,hitsPerPage:10}}],e),optionsFromPayload:xf},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>gf(s=>[{resolveType:t,props:{query:s,term:s,count:10,hitsPerPage:10}}],e),optionsFromPayload:xf},{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:Ese}];function Cse(t,e,s=new Set){const n=[...e],i=a=>{const c=[];for(const d of jse){if(d.kind!==a)continue;const f=n.find(u=>d.test(u)&&kse(u,s));f&&c.push({cand:d,resolveType:f})}return c.find(d=>s.has(gx(d.resolveType)))??c[0]},r=(a,c,d)=>({kind:a.kind,id:`${a.kind}:${c}`,resolveType:c,clientFilter:a.clientFilter,isFallback:d,buildRequests:f=>a.buildRequests(c,f),optionsFromPayload:a.optionsFromPayload}),l=[];for(const a of["product","category"]){if(!t.has(a))continue;const c=i(a);c&&l.push(r(c.cand,c.resolveType,!1))}return t.size>0&&l.push(Nse(t.has("category")?"category":"product")),l}function Nse(t){return{kind:t,id:Jb,resolveType:Jb,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,s)=>Ose(e,s)}}function Dl(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Tse(t,e,s){const n=new Set,i=new Set,r=l=>{if(Array.isArray(l)){for(const d of l)r(d);return}const a=Dl(l);if(!a)return;const c=a.__resolveType;if(typeof c=="string"){if(s(c))n.add(c);else if(c in e&&!i.has(c)){i.add(c);const d=Dl(e[c])?.__resolveType;typeof d=="string"&&s(d)&&n.add(c),r(e[c])}}for(const d of Object.values(a))r(d)};return r(t),n}function jk(t){const e=new Set,s=[];for(const n of t)for(const i of n)e.has(i.value)||(e.add(i.value),s.push(i));return s}function Ck(t){try{return decodeURIComponent(t)}catch{return t}}function Vse(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ase(t){const e=[];let s="^";for(const n of t)n.type==="text"?s+=Vse(n.text):(e.push(n.name),s+=n.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${s}$`),order:e}}function Nk(t,e,s){if(typeof t!="string"||!t)return null;let n;try{n=new URL(t,"https://placeholder.invalid").pathname}catch{return null}n=n.replace(/\/+$/,"");const i=oh(qo(e)),{pattern:r,order:l}=Ase(i),a=l.indexOf(s);if(a===-1)return null;const c=n.match(r);if(!c)return null;const d=c[a+1]?.replace(/^\/+|\/+$/g,"");return d?Ck(d):null}function xf(t,e){const s=Dl(t),n=Array.isArray(t)?t:Array.isArray(s?.products)?s.products:Array.isArray(s?.list)?s.list:[],i=[],r=new Set;for(const l of n){const a=Dl(l);if(!a)continue;const c=Nk(a.url,e.template,e.paramName);if(!c||r.has(c))continue;r.add(c);const d=Dl(a.isVariantOf),f=typeof d?.name=="string"&&d.name||typeof a.name=="string"&&a.name||c,u=Array.isArray(a.image)?Dl(a.image[0]):null,h=typeof u?.url=="string"?u.url:void 0;i.push({value:c,label:f,image:h})}return i}function Pse(t){if(typeof t!="string"||!t)return null;let e;try{e=new URL(t,"https://placeholder.invalid").pathname}catch{return null}const s=e.replace(/^\/+|\/+$/g,"");return s?Ck(s):null}function Ese(t){const e=[],s=new Set,n=(i,r)=>{const l=Dl(i);if(!l)return;const a=typeof l.name=="string"&&l.name?l.name:"",c=a?[...r,a]:r,d=Pse(l.url);if(d&&!s.has(d)&&(s.add(d),e.push({value:d,label:c.join(" › ")||d})),Array.isArray(l.children))for(const f of l.children)n(f,c)};if(Array.isArray(t))for(const i of t)n(i,[]);return e}const Rse=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 Dse(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,s=>s.toUpperCase())}function Ise(t){if(typeof t!="string"||!t)return[];const e=[],s=/<a\b[^>]*?\bhref="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi;let n,i=0;for(;(n=s.exec(t))!==null&&i++<5e3;){const r=n[1]??"",l=(n[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:r,text:l})}return e}function Mse(t){if(typeof t!="string"||!t)return[];const e=[],s=new Set,n=/"@type":"Product"[\s\S]{0,600}?(?:"url"|\burl):"([^"]+)"[\s\S]{0,300}?(?:"name"|\bname):"([^"]+)"/g,i=/(?:"image"|\bimage):\s*\[\s*\{[\s\S]{0,400}?(?:"url"|\burl):"([^"]+)"/;let r,l=0;for(;(r=n.exec(t))!==null&&l++<3e3;){const a=(r[1]??"").replace(/\\\//g,"/");if(!a||s.has(a))continue;s.add(a);const c=t.slice(r.index,r.index+900).match(i)?.[1]?.replace(/\\\//g,"/");e.push({url:a,name:r[2]??"",image:c||void 0})}return e}function Ose(t,e){const s=[],n=new Set,i=(r,l,a,c)=>{if(s.length>=200)return;const d=Nk(r,e.template,e.paramName);!d||n.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||a==="category"&&Rse.has(d.split("/")[0]??"")||(n.add(d),s.push({value:d,label:l&&l.length<=80?l:Dse(d),kind:a,image:c}))};for(const{url:r,name:l,image:a}of Mse(t))i(r,l,"product",a);for(const{href:r,text:l}of Ise(t))r.startsWith("/")&&!r.startsWith("//")&&i(r,l,"category");return s}function $d(t,e,s=50){const n=e.trim().toLowerCase();return(n?t.filter(r=>r.label.toLowerCase().includes(n)||r.value.toLowerCase().includes(n)):t).slice(0,s)}const Tk=1e4;function $se(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 Bse(t,{resolveType:e,props:s}){const n=await fetch(H_(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(Tk)});if(!n.ok)throw new Error(`Failed to fetch options: ${n.status}`);return n.json()}async function Qb(t,e){const s=await fetch(U_(t,e),{signal:AbortSignal.timeout(Tk)});if(!s.ok)throw new Error(`Failed to fetch page: ${s.status}`);return s.text()}async function zse(t,e,s){const n=e.optionsFromPayload(await Qb(t,"/"),s),i=n.find(l=>l.kind==="category");if(!i)return n;const r=Br(s.template,{[s.paramName]:i.value});if(r==="/")return n;try{const l=e.optionsFromPayload(await Qb(t,r),s).filter(a=>a.kind==="product");return jk([n,l])}catch{return n}}function Fse(t,e,s){return Je.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":s}`)}async function Use(t,e,s,n){if(e.homepageLinks)return zse(t,e,n);const i=e.buildRequests?.(s)??[];if(i.length===0)return[];const r=await Promise.allSettled(i.map(a=>Bse(t,a))),l=r.filter(a=>a.status==="fulfilled").map(a=>a.value);if(l.length===0){const a=r.find(c=>c.status==="rejected");throw a?a.reason:new Error("Failed to fetch options")}return jk(l.map(a=>e.optionsFromPayload(a,n)))}function Ip(t,e,s,n,i){return{queryKey:Fse(t,e,s),queryFn:()=>Use(t,e,s,n),enabled:i,staleTime:6e4,retry:1}}function Bd(t){const e=B.c(16),{heading:s,iconKind:n,options:i,template:r,paramName:l,keyPrefix:a,onSelect:c}=t;if(i.length===0)return null;let d;if(e[0]!==n||e[1]!==a||e[2]!==c||e[3]!==i||e[4]!==l||e[5]!==r){let u;e[7]!==n||e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==r?(u=h=>o.jsxs(Wt,{value:`${a}:${h.value}`,className:"gap-3 py-2",onSelect:()=>c(h.value),children:[n==="product"&&o.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:h.image?o.jsx("img",{src:h.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):o.jsx(n0,{size:14,className:"text-muted-foreground"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm",children:h.label}),o.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Br(r,{[l]:h.value})})]})]},`${a}:${h.value}`),e[7]=n,e[8]=a,e[9]=c,e[10]=l,e[11]=r,e[12]=u):u=e[12],d=i.map(u),e[0]=n,e[1]=a,e[2]=c,e[3]=i,e[4]=l,e[5]=r,e[6]=d}else d=e[6];let f;return e[13]!==s||e[14]!==d?(f=o.jsx(fs,{heading:s,children:d}),e[13]=s,e[14]=d,e[15]=f):f=e[15],f}function Xb(t){const e=B.c(2),{text:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Hse(t){const e=B.c(52),{sources:s,template:n,paramName:i,value:r,sandboxRef:l,onCommit:a}=t,c=re(),[d,f]=P.useState(!1),[u,h]=P.useState(""),[m,p]=P.useState(""),g=P.useRef(null),x=i==="*"?c("sandbox.preview.catchAllParamLabel"):`:${i}`,b=$se(c),L=[...new Set(s.map(Ne=>b[Ne.kind].noun))].join(" or ");let v;e[0]!==c||e[1]!==L?(v=c("sandbox.pathParamPickerChip.searchPlaceholder",{options:L}),e[0]=c,e[1]=L,e[2]=v):v=e[2];const _=v,w={template:n,paramName:i};let S;e[3]!==u?(S=(Ne,Ie)=>({source:Ne,query:Ie,options:Ne.clientFilter?$d(Ie.data??[],u):Ie.data??[]}),e[3]=u,e[4]=S):S=e[4];const k=S,j=s.filter(Xse),C=s.filter(Qse),T=Km({queries:j.map(Ne=>Ip(l,Ne,m,w,d))});let N;e[5]!==T||e[6]!==k?(N=(Ne,Ie)=>k(Ne,T[Ie]),e[5]=T,e[6]=k,e[7]=N):N=e[7];const V=j.map(N),A=V.length===0||V.every(Jse),E=Km({queries:C.map(Ne=>Ip(l,Ne,m,w,d&&A))});let R;e[8]!==E||e[9]!==k?(R=(Ne,Ie)=>k(Ne,E[Ie]),e[8]=E,e[9]=k,e[10]=R):R=e[10];const I=C.map(R),D=A?I:V,O=D.length===1&&D[0]?.source.homepageLinks?D[0]:null,M=O&&!O.query.isLoading&&!O.query.isError?O?.query.data??[]:[],$=$d(M.filter(Yse),u),F=$d(M.filter(Gse),u),U=$.length>0&&F.length>0,H=Ne=>{f(Ne),g.current&&clearTimeout(g.current),h(Ne?r:""),p(Ne?r:"")};let q;e[11]===Symbol.for("react.memo_cache_sentinel")?(q=Ne=>{h(Ne),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{p(Ne)},300)},e[11]=q):q=e[11];const W=q,G=Ne=>{a(Ne),H(!1)},Y=Q_(u),J=Br(n,{[i]:Y}),se=Ht,oe=Ut,ne="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",Q=qse;let K;e[12]!==x||e[13]!==c?(K=c("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:x}),e[12]=x,e[13]=c,e[14]=K):K=e[14];let X;e[15]!==K?(X=o.jsx(hs,{className:"sr-only",children:o.jsx(Yt,{children:K})}),e[15]=K,e[16]=X):X=e[16];let Z;e[17]===Symbol.for("react.memo_cache_sentinel")?(Z=o.jsx(n0,{size:16,className:"shrink-0 text-foreground"}),e[17]=Z):Z=e[17];let le;e[18]!==c?(le=c("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=c,e[19]=le):le=e[19];let ee;e[20]!==x?(ee=o.jsx("span",{className:"rounded-sm bg-violet-500/15 px-1 py-0.5 font-mono text-[12px] text-violet-600 dark:text-violet-400",children:x}),e[20]=x,e[21]=ee):ee=e[21];let ae;e[22]!==le||e[23]!==ee?(ae=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[Z,o.jsxs("span",{className:"text-sm font-medium text-foreground",children:[le," ",ee]})]}),e[22]=le,e[23]=ee,e[24]=ae):ae=e[24];const ce=Yn,fe=!1,de="min-h-0 flex-1";let pe;e[25]!==_||e[26]!==u?(pe=o.jsx(On,{autoFocus:!0,placeholder:_,value:u,onValueChange:W}),e[25]=_,e[26]=u,e[27]=pe):pe=e[27];const te=$n,ge="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let ve;e[28]!==c?(ve=c("sandbox.pathParamPickerChip.noResults"),e[28]=c,e[29]=ve):ve=e[29];let Se;e[30]!==ve?(Se=o.jsx(Cn,{children:ve}),e[30]=ve,e[31]=Se):Se=e[31];const ye=Y&&o.jsx(fs,{className:"shrink-0",children:o.jsxs(Wt,{value:`__raw__:${Y}`,className:"gap-3 py-2",onSelect:()=>G(Y),children:[o.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:o.jsx(gl,{size:14,className:"text-muted-foreground"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm",children:c("sandbox.pathParamPickerChip.useRawValue",{rawTerm:Y,paramLabel:x})}),o.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:J})]})]})}),ke=U?o.jsxs("div",{className:"flex min-h-0 flex-1",children:[o.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto border-r border-border",children:o.jsx(Bd,{heading:b.category.heading,iconKind:"category",options:$,template:n,paramName:i,keyPrefix:`${O?.source.id}:cat`,onSelect:G})}),o.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:o.jsx(Bd,{heading:b.product.heading,iconKind:"product",options:F,template:n,paramName:i,keyPrefix:`${O?.source.id}:prod`,onSelect:G})})]}):o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:D.map(Ne=>{const{source:Ie,query:et,options:Ze}=Ne,{noun:Te}=b[Ie.kind];if(et.isLoading)return o.jsx(Xb,{text:c("sandbox.pathParamPickerChip.loading",{noun:Te})},Ie.id);if(et.isError)return o.jsx(Xb,{text:c("sandbox.pathParamPickerChip.couldNotLoad")},Ie.id);if(Ie.homepageLinks){const Me=et.data??[];return o.jsxs(P.Fragment,{children:[o.jsx(Bd,{heading:b.category.heading,iconKind:"category",options:$d(Me.filter(Wse),u),template:n,paramName:i,keyPrefix:`${Ie.id}:cat`,onSelect:G}),o.jsx(Bd,{heading:b.product.heading,iconKind:"product",options:$d(Me.filter(Kse),u),template:n,paramName:i,keyPrefix:`${Ie.id}:prod`,onSelect:G})]},Ie.id)}return o.jsx(Bd,{heading:D.length>1?b[Ie.kind].heading:void 0,iconKind:Ie.kind,options:Ze,template:n,paramName:i,keyPrefix:Ie.id,onSelect:G},Ie.id)})});let we;e[32]!==te||e[33]!==Se||e[34]!==ye||e[35]!==ke?(we=o.jsxs(te,{className:ge,children:[Se,ye,ke]}),e[32]=te,e[33]=Se,e[34]=ye,e[35]=ke,e[36]=we):we=e[36];let je;e[37]!==ce||e[38]!==pe||e[39]!==we?(je=o.jsxs(ce,{shouldFilter:fe,className:de,children:[pe,we]}),e[37]=ce,e[38]=pe,e[39]=we,e[40]=je):je=e[40];let me;e[41]!==oe||e[42]!==X||e[43]!==ae||e[44]!==je||e[45]!==Q?(me=o.jsxs(oe,{className:ne,onClick:Q,children:[X,ae,je]}),e[41]=oe,e[42]=X,e[43]=ae,e[44]=je,e[45]=Q,e[46]=me):me=e[46];let Ce;return e[47]!==se||e[48]!==H||e[49]!==d||e[50]!==me?(Ce=o.jsx(se,{open:d,onOpenChange:H,children:me}),e[47]=se,e[48]=H,e[49]=d,e[50]=me,e[51]=Ce):Ce=e[51],o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",title:c("sandbox.pathParamPickerChip.buttonTitle",{paramLabel:x}),className:"max-w-64 shrink-0 cursor-pointer truncate rounded-sm bg-violet-500/15 px-1 py-0.5 text-[12px] text-violet-600 hover:bg-violet-500/25 dark:text-violet-400",onClick:Ne=>{Ne.stopPropagation(),H(!0)},children:r||x}),Ce]})}function Kse(t){return t.kind==="product"}function Wse(t){return t.kind!=="product"}function qse(t){return t.stopPropagation()}function Gse(t){return t.kind==="product"}function Yse(t){return t.kind!=="product"}function Jse(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function Qse(t){return t.isFallback}function Xse(t){return!t.isFallback}function Zse(t){const e=B.c(8),{sources:s,template:n,paramName:i,sandboxRef:r,onFill:l}=t;let a,c;if(e[0]!==i||e[1]!==r||e[2]!==s||e[3]!==n){const m={template:n,paramName:i},p=s.filter(ene);c=Km,a=p.map(g=>Ip(r,g,"",m,!0)),e[0]=i,e[1]=r,e[2]=s,e[3]=n,e[4]=a,e[5]=c}else a=e[4],c=e[5];let d;e[6]!==a?(d={queries:a},e[6]=a,e[7]=d):d=e[7];const f=c(d),[u,h]=P.useState(!1);if(!u)for(const m of f){if(m.isLoading)break;const p=m.data?.[0];if(p){h(!0),queueMicrotask(()=>l(p.value));break}}return null}function ene(t){return!t.isFallback}function tne(t){const e=B.c(31),{name:s,value:n,onCommit:i}=t,r=re(),[l,a]=P.useState(n),[c,d]=P.useState(!1),f=P.useRef(!1);let u;e[0]!==s||e[1]!==r?(u=s==="*"?r("sandbox.preview.catchAllParamLabel"):`:${s}`,e[0]=s,e[1]=r,e[2]=u):u=e[2];const h=u,m=l||h;let p;e[3]!==m?(p=o.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-[12px]",children:m}),e[3]=m,e[4]=p):p=e[4];let g;e[5]!==h||e[6]!==r?(g=r("sandbox.preview.valueForParam",{label:h}),e[5]=h,e[6]=r,e[7]=g):g=e[7];let x,b;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=k=>a(k.target.value),b=()=>d(!0),e[8]=x,e[9]=b):(x=e[8],b=e[9]);let y;e[10]!==n?(y=k=>{k.key==="Enter"&&k.currentTarget.blur(),k.key==="Escape"&&(f.current=!0,a(n),k.currentTarget.blur())},e[10]=n,e[11]=y):y=e[11];let L;e[12]!==l||e[13]!==i||e[14]!==n?(L=()=>{if(d(!1),f.current){f.current=!1;return}const k=Q_(l);a(k),k!==n&&i(k)},e[12]=l,e[13]=i,e[14]=n,e[15]=L):L=e[15];let v;e[16]!==l||e[17]!==h||e[18]!==g||e[19]!==y||e[20]!==L?(v=o.jsx("input",{type:"text",value:l,placeholder:h,title:g,spellCheck:!1,className:"absolute inset-0 rounded-sm bg-violet-500/15 px-1 text-[12px] text-violet-600 outline-none placeholder:text-violet-500/60 focus:bg-violet-500/25 dark:text-violet-400",onClick:sne,onChange:x,onFocus:b,onKeyDown:y,onBlur:L}),e[16]=l,e[17]=h,e[18]=g,e[19]=y,e[20]=L,e[21]=v):v=e[21];let _;e[22]!==p||e[23]!==v?(_=o.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[p,v]}),e[22]=p,e[23]=v,e[24]=_):_=e[24];let w;e[25]!==c||e[26]!==r?(w=c&&o.jsxs("span",{className:"pointer-events-none ml-1.5 flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-border bg-muted px-1 py-0.5 text-[10px] text-muted-foreground",children:[o.jsx(kA,{size:10}),r("sandbox.preview.enterToGo")]}),e[25]=c,e[26]=r,e[27]=w):w=e[27];let S;return e[28]!==w||e[29]!==_?(S=o.jsxs(o.Fragment,{children:[_,w]}),e[28]=w,e[29]=_,e[30]=S):S=e[30],S}function sne(t){return t.stopPropagation()}const nne={loaders:"loader",actions:"action"},Vk=new Set(["workflows"]);function Ak(t){return nne[t]}function Pk(t,e,s){const n=t.manifest?.blocks??{};for(const[i,r]of Object.entries(n))if(i.includes(s)&&e in r)return!0;return!1}function ine(t,e,s){return/\.tsx?$/.test(e)?!0:Pk(t,e,s)}function rne(t,e){const s=new Set,n=t.manifest?.blocks??{};for(const[i,r]of Object.entries(n))if(i.includes(e))for(const l of Object.keys(r))s.add(l);return s}function one(t,e){return/\.tsx?$/.test(t)?!1:e.has(`${t}.ts`)||e.has(`${t}.tsx`)}function Ek(t,e){const s=t.manifest?.blocks??{},n=[],i=new Set;for(const[r,l]of Object.entries(s))if(r.includes(e))for(const a of Object.keys(l))i.add(a);for(const r of i){if(r.toLowerCase().includes("preview")||iL.has(r)||Vk.has(xx(r))||one(r,i))continue;const l=bl(r,t);if(l.hidden)continue;const a=l.title&&l.title!==r?l.title:vs(r);n.push({resolveType:r,title:a})}return n.sort((r,l)=>r.title.localeCompare(l.title))}function Zb(t,e){return Ek(t,e).length}function xx(t){return t.startsWith("deco-sites/")?t.split("/")[1]||"site":t.startsWith("$live")||t.startsWith("deco/")?"deco":t.split("/")[0]||"other"}const lne={deco:"Deco",std:"Deco Standard",website:"Website"};function ane(t){return lne[t]??t}function Rk(t){const e=xx(t);let n=t.split("/").filter(Boolean).slice(t.startsWith("deco-sites/")?2:1);return(n[0]==="loaders"||n[0]==="actions")&&(n=n.slice(1)),[e,...n.slice(0,-1)]}function Dk(t,e,s){const n=[];for(const[i,r]of Object.entries(e)){if(ine(t,i,s)||P9(i)||!r||typeof r!="object"||Array.isArray(r))continue;const l=r,a=l.__resolveType;typeof a=="string"&&(iL.has(a)||Vk.has(xx(a))||Pk(t,a,s)&&n.push({key:i,resolveType:a,title:typeof l.name=="string"&&l.name?l.name:i}))}return n.sort((i,r)=>i.title.localeCompare(r.title))}function Ik(t,e){const s=t[e],n=typeof s?.__resolveType=="string"?s.__resolveType:"",{__resolveType:i,...r}=s??{},l=typeof s?.name=="string"&&s.name?s.name:e;return{resolveType:n,props:r,title:l}}function Mk(t){const e=B.c(14),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,enabled:l}=t,a=l===void 0?!0:l;let c;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==n?(c=Je.sandboxRepoDir(s,n,i,r),e[0]=i,e[1]=s,e[2]=r,e[3]=n,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s||e[7]!==r||e[8]!==n?(d=async()=>{const h=eo({orgSlug:s,virtualMcpId:n,branch:i,threadId:r},"config"),m=await fetch(h);return m.ok?(await m.json()).repoDir??null:null},e[5]=i,e[6]=s,e[7]=r,e[8]=n,e[9]=d):d=e[9];let f;return e[10]!==a||e[11]!==c||e[12]!==d?(f={queryKey:c,queryFn:d,enabled:a,staleTime:1/0},e[10]=a,e[11]=c,e[12]=d,e[13]=f):f=e[13],Tt(f).data??null}const cne={target:null,editSeoPageKey:null,variantOverride:null};function dne(t,e){switch(e.type){case"select":return{...t,target:e.target,variantOverride:null,editSeoPageKey:null};case"edit-seo":return{...t,target:e.target,editSeoPageKey:e.target.key,variantOverride:null};case"consume-edit-seo":return{...t,editSeoPageKey:null};case"variant-override":return{...t,variantOverride:e.params}}}const Ok=P.createContext(null);function ev(t){const e=B.c(9),{children:s}=t,[n,i]=P.useReducer(dne,cne);let r,l,a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=u=>i({type:"select",target:u}),l=u=>i({type:"edit-seo",target:u}),a=()=>i({type:"consume-edit-seo"}),c=u=>i({type:"variant-override",params:u}),e[0]=r,e[1]=l,e[2]=a,e[3]=c):(r=e[0],l=e[1],a=e[2],c=e[3]);let d;e[4]!==n?(d={state:n,selectTarget:r,editSeo:l,consumeEditSeo:a,setVariantOverride:c},e[4]=n,e[5]=d):d=e[5];let f;return e[6]!==s||e[7]!==d?(f=o.jsx(Ok,{value:d,children:s}),e[6]=s,e[7]=d,e[8]=f):f=e[8],f}function $k(){const t=P.use(Ok);if(!t)throw new Error("useBlocksPreviewWorkspace must be used inside BlocksPreviewWorkspaceProvider");return t}function bx(t){return(e,s)=>{AP(e),t(e,s)}}const une="cursor-help underline decoration-dotted decoration-muted-foreground/50 underline-offset-4";function n1(t){return Is(t)?.metadata?.fieldDescriptionTooltips??!1}function vx(t){const e=B.c(9),{description:s,virtualMcpId:n,children:i}=t,r=n1(n);if(!s||!r)return i;let l;e[0]!==i?(l=P.cloneElement(i,{className:ie(i.props.className,une)}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==l?(a=o.jsx(Ke,{asChild:!0,children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s?(c=o.jsx(We,{className:"max-w-64",children:s}),e[4]=s,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==c?(d=o.jsxs(qe,{delayDuration:300,children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function Hs(t){const e=B.c(17),{htmlFor:s,label:n,description:i,labelClassName:r,virtualMcpId:l}=t;if(!n1(l)){let f;e[0]!==s||e[1]!==n||e[2]!==r?(f=o.jsx(Mt,{htmlFor:s,className:r,children:n}),e[0]=s,e[1]=n,e[2]=r,e[3]=f):f=e[3];let u;e[4]!==i?(u=i&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[4]=i,e[5]=u):u=e[5];let h;return e[6]!==f||e[7]!==u?(h=o.jsxs("div",{className:"space-y-0.5",children:[f,u]}),e[6]=f,e[7]=u,e[8]=h):h=e[8],h}let c;e[9]!==s||e[10]!==n||e[11]!==r?(c=o.jsx(Mt,{htmlFor:s,className:r,children:n}),e[9]=s,e[10]=n,e[11]=r,e[12]=c):c=e[12];let d;return e[13]!==i||e[14]!==c||e[15]!==l?(d=o.jsx(vx,{description:i,virtualMcpId:l,children:c}),e[13]=i,e[14]=c,e[15]=l,e[16]=d):d=e[16],d}const fne=fi.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(s=>e.updateAttributes(s,{textAlign:t})).some(s=>s):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:s})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?s.unsetTextAlign():s.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});var hne=fne;const mne=20,Bk=(t,e=0)=>{const s=[];return!t.children.length||e>mne||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?s.push(n):n.children.length&&s.push(...Bk(n,e+1))}),s},pne=t=>{if(!t.children.length)return;const e=Bk(t);e&&e.forEach(s=>{var n;const i=s.getAttribute("style"),r=(n=s.parentElement)===null||n===void 0||(n=n.closest("span"))===null||n===void 0?void 0:n.getAttribute("style");s.setAttribute("style",`${r};${i}`)})},zk=NV.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&pne(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",ur(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(s,n)=>{if(!s.isInline)return!0;s.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(r=>!!r))||t.removeMark(n,n+s.nodeSize,this.type)}),!0}}}}),gne=fi.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const s=(e=t0(t,"background-color"))!==null&&e!==void 0?e:t.style.backgroundColor;return s?.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),Fk=fi.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const s=(e=t0(t,"color"))!==null&&e!==void 0?e:t.style.color;return s?.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),xne=fi.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>{var e;return(e=t0(t,"font-family"))!==null&&e!==void 0?e:t.style.fontFamily},renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Uk=fi.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var e;return(e=t0(t,"font-size"))!==null&&e!==void 0?e:t.style.fontSize},renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),bne=fi.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>{var e;return(e=t0(t,"line-height"))!==null&&e!==void 0?e:t.style.lineHeight},renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});fi.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(gne.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(Fk.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(xne.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(Uk.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(bne.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(zk.configure(this.options.textStyle)),t}});const vne=["#000000","#525252","#a3a3a3","#ffffff","#e11d48","#ea580c","#ca8a04","#16a34a","#0891b2","#2563eb","#7c3aed","#db2777"];function yne(t){const e=B.c(30),{editor:s,currentColor:n,open:i,onOpenChange:r}=t,l=re(),[a,c]=P.useState("#000000");let d;e[0]!==s||e[1]!==r?(d=w=>{s.chain().focus().setColor(w).run(),r(!1)},e[0]=s,e[1]=r,e[2]=d):d=e[2];const f=d;let u;e[3]!==s||e[4]!==r?(u=()=>{s.chain().focus().unsetColor().run(),r(!1)},e[3]=s,e[4]=r,e[5]=u):u=e[5];const h=u,m=i||n!==null;let p;e[6]!==l?(p=l("sectionsEditor.richTextColorControl.colorButtonLabel"),e[6]=l,e[7]=p):p=e[7];let g;e[8]!==r||e[9]!==i?(g=()=>r(!i),e[8]=r,e[9]=i,e[10]=g):g=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(qm,{size:14}),e[11]=x):x=e[11];const b=n??"currentColor";let y;e[12]!==b?(y=o.jsxs("span",{className:"relative flex flex-col items-center",children:[x,o.jsx("span",{className:"mt-0.5 h-0.5 w-3.5 rounded-full",style:{backgroundColor:b}})]}),e[12]=b,e[13]=y):y=e[13];let L;e[14]!==m||e[15]!==p||e[16]!==g||e[17]!==y?(L=o.jsx(es,{active:m,label:p,onClick:g,children:y}),e[14]=m,e[15]=p,e[16]=g,e[17]=y,e[18]=L):L=e[18];let v;e[19]!==f||e[20]!==h||e[21]!==n||e[22]!==a||e[23]!==r||e[24]!==i||e[25]!==l?(v=i&&o.jsxs("div",{tabIndex:-1,className:"absolute left-0 top-full z-20 mt-1.5 flex w-56 flex-col gap-2 rounded-md border bg-popover p-2 shadow-md",onBlur:w=>{w.currentTarget.contains(w.relatedTarget)||r(!1)},children:[o.jsx("div",{className:"grid grid-cols-6 gap-1",children:vne.map(w=>o.jsx("button",{type:"button","aria-label":w,"aria-pressed":n===w,onMouseDown:wne,onClick:()=>f(w),className:ie("h-6 w-6 rounded border border-border/60 transition-transform cursor-pointer hover:scale-110",n===w&&"ring-2 ring-ring ring-offset-1"),style:{backgroundColor:w}},w))}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs("label",{className:"flex flex-1 items-center gap-1.5 rounded bg-muted/40 px-2 py-1 text-xs text-muted-foreground cursor-pointer",children:[o.jsx("input",{type:"color",value:a,onMouseDown:Lne,onChange:w=>c(w.target.value),onBlur:()=>f(a),className:"h-5 w-5 cursor-pointer rounded border-0 bg-transparent p-0"}),l("sectionsEditor.richTextColorControl.customLabel")]}),o.jsx("button",{type:"button",onMouseDown:_ne,onClick:h,className:"rounded px-2 py-1 text-xs text-muted-foreground transition-colors cursor-pointer hover:bg-muted hover:text-foreground",children:l("sectionsEditor.richTextColorControl.defaultLabel")})]})]}),e[19]=f,e[20]=h,e[21]=n,e[22]=a,e[23]=r,e[24]=i,e[25]=l,e[26]=v):v=e[26];let _;return e[27]!==v||e[28]!==L?(_=o.jsxs("div",{className:"relative",children:[L,v]}),e[27]=v,e[28]=L,e[29]=_):_=e[29],_}function _ne(t){return t.preventDefault()}function Lne(t){return t.stopPropagation()}function wne(t){return t.preventDefault()}const bf=[1,2,3,4,5,6];function Sne(t){const e=new DOMParser().parseFromString(t,"text/html").body,s=Array.from(e.children);return s.length===0?e.innerHTML:s.map(n=>n.innerHTML).join("<br>")}const kne=8,jne=128,Cne=16,tv=1;function Nne({schema:t,value:e,onChange:s,path:n,label:i,sandbox:r,inline:l=!1}){const a=re(),c=typeof e=="string"?e:"",d=P.useRef(s);d.current=s;const[f,u]=P.useState(!1),[h,m]=P.useState(!1),p=Xh({extensions:[Zh.configure({heading:l?!1:{levels:[...bf]},bulletList:l?!1:void 0,orderedList:l?!1:void 0,listItem:l?!1:void 0,blockquote:l?!1:void 0,link:{HTMLAttributes:{}}}),...l?[]:[hne.configure({types:["heading","paragraph"]})],zk,Uk,Fk],content:c||"",editorProps:{attributes:{class:ie("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:_})=>{const w=_.getHTML(),S=l?Sne(w):w;d.current(S==="<p></p>"||S===""?"":S)}}),g=W6({editor:p,selector:({editor:_})=>({bold:_?.isActive("bold")??!1,italic:_?.isActive("italic")??!1,underline:_?.isActive("underline")??!1,strike:_?.isActive("strike")??!1,headingLevel:bf.find(w=>_?.isActive("heading",{level:w})??!1)??0,fontSize:_?.getAttributes("textStyle").fontSize??null,color:_?.getAttributes("textStyle").color??null,bulletList:_?.isActive("bulletList")??!1,orderedList:_?.isActive("orderedList")??!1,link:_?.isActive("link")??!1,alignLeft:_?.isActive({textAlign:"left"})??!1,alignCenter:_?.isActive({textAlign:"center"})??!1,alignRight:_?.isActive({textAlign:"right"})??!1,alignJustify:_?.isActive({textAlign:"justify"})??!1})});if(!p)return null;const x=g.headingLevel>0?`h${g.headingLevel}`:"paragraph",b=_=>{const w=p.chain().focus();if(_==="paragraph"){w.setParagraph().run();return}const S=bf.find(k=>`h${k}`===_);S&&w.setHeading({level:S}).run()},y=g.fontSize?parseInt(g.fontSize,10):NaN,L=Number.isFinite(y)?y:Cne,v=_=>{const w=Math.min(jne,Math.max(kne,_));p.chain().focus().setFontSize(`${w}px`).run()};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(Hs,{htmlFor:n,label:i,description:t.description,virtualMcpId:r?.virtualMcpId}),o.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-border/60 bg-muted/30 px-1.5 py-1",children:[o.jsx(es,{active:g.bold,label:a("sectionsEditor.richTextField.bold"),onClick:()=>p.chain().focus().toggleBold().run(),children:o.jsx(p8,{size:14})}),o.jsx(es,{active:g.italic,label:a("sectionsEditor.richTextField.italic"),onClick:()=>p.chain().focus().toggleItalic().run(),children:o.jsx(g8,{size:14})}),o.jsx(es,{active:g.underline,label:a("sectionsEditor.richTextField.underline"),onClick:()=>p.chain().focus().toggleUnderline().run(),children:o.jsx(jA,{size:14})}),o.jsx(es,{active:g.strike,label:a("sectionsEditor.richTextField.strikethrough"),onClick:()=>p.chain().focus().toggleStrike().run(),children:o.jsx(x8,{size:14})}),!l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsxs(ys,{value:x,onValueChange:b,children:[o.jsx(_s,{size:"sm","aria-label":a("sectionsEditor.richTextField.styleLabel"),onMouseDown:_=>_.preventDefault(),className:"w-[116px] gap-1 bg-transparent px-2 text-muted-foreground shadow-none! hover:bg-muted hover:text-foreground",children:o.jsx(Ns,{})}),o.jsxs(Ls,{children:[o.jsx(Rt,{value:"paragraph",children:a("sectionsEditor.richTextField.styleParagraph")}),bf.map(_=>o.jsx(Rt,{value:`h${_}`,children:a("sectionsEditor.richTextField.styleHeading",{level:_})},_))]})]})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx(es,{active:!1,label:a("sectionsEditor.richTextField.fontSizeDecrease"),onClick:()=>v(L-tv),children:o.jsx(tg,{size:14})}),o.jsx("span",{className:"min-w-[2ch] text-center text-xs tabular-nums text-muted-foreground",children:L}),o.jsx(es,{active:!1,label:a("sectionsEditor.richTextField.fontSizeIncrease"),onClick:()=>v(L+tv),children:o.jsx(Kt,{size:14})})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(yne,{editor:p,currentColor:g.color,open:h,onOpenChange:m}),!l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(es,{active:g.bulletList,label:a("sectionsEditor.richTextField.bulletList"),onClick:()=>p.chain().focus().toggleBulletList().run(),children:o.jsx(Vg,{size:14})}),o.jsx(es,{active:g.orderedList,label:a("sectionsEditor.richTextField.orderedList"),onClick:()=>p.chain().focus().toggleOrderedList().run(),children:o.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(KG,{editor:p,active:g.link,open:f,onOpenChange:u}),!l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(es,{active:g.alignLeft,label:a("sectionsEditor.richTextField.alignLeft"),onClick:()=>p.chain().focus().setTextAlign("left").run(),children:o.jsx(TE,{size:14})}),o.jsx(es,{active:g.alignCenter,label:a("sectionsEditor.richTextField.alignCenter"),onClick:()=>p.chain().focus().setTextAlign("center").run(),children:o.jsx(CA,{size:14})}),o.jsx(es,{active:g.alignRight,label:a("sectionsEditor.richTextField.alignRight"),onClick:()=>p.chain().focus().setTextAlign("right").run(),children:o.jsx(NA,{size:14})}),o.jsx(es,{active:g.alignJustify,label:a("sectionsEditor.richTextField.alignJustify"),onClick:()=>p.chain().focus().setTextAlign("justify").run(),children:o.jsx(TA,{size:14})})]})]}),o.jsx(e9,{editor:p})]})]})}const Vc=t=>String(t).padStart(2,"0"),Tne="1900-01-01",Vne="2099-12-31",Ane="1900-01-01T00:00",Pne="2099-12-31T23:59";function Ene(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const s=new Date(t);return Number.isNaN(s.getTime())?"":`${s.getUTCFullYear()}-${Vc(s.getUTCMonth()+1)}-${Vc(s.getUTCDate())}`}function Rne(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function Dne(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Vc(e.getMonth()+1)}-${Vc(e.getDate())}T${Vc(e.getHours())}:${Vc(e.getMinutes())}`}function Ine(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function Mne(t){const e=B.c(41),{id:s,withTime:n,value:i,onChange:r,calendarLabel:l}=t,[a,c]=P.useState(!1);let d;e[0]!==n?(d=O=>n?Dne(O):Ene(O),e[0]=n,e[1]=d):d=e[1];const f=d;let u;e[2]!==n?(u=O=>n?Ine(O):Rne(O),e[2]=n,e[3]=u):u=e[3];const h=u;let m;e[4]!==f||e[5]!==i?(m=()=>f(i),e[4]=f,e[5]=i,e[6]=m):m=e[6];const[p,g]=P.useState(m),[x,b]=P.useState(i);if(i!==x){b(i);const O=f(i);O!==p&&g(O)}let y;e[7]!==r||e[8]!==h?(y=O=>{g(O.target.value),r(h(O.target.value))},e[7]=r,e[8]=h,e[9]=y):y=e[9];const L=y;let v;if(e[10]!==i){const O=i?new Date(i):null;v=O&&!Number.isNaN(O.getTime())?O:null,e[10]=i,e[11]=v}else v=e[11];const _=v;let w;e[12]!==r||e[13]!==_||e[14]!==f||e[15]!==n?(w=O=>{if(!O)return;n&&_?O.setHours(_.getHours(),_.getMinutes(),0,0):O.setHours(0,0,0,0);const z=O.toISOString();g(f(z)),b(z),r(z),c(!1)},e[12]=r,e[13]=_,e[14]=f,e[15]=n,e[16]=w):w=e[16];const S=w,k=n?"datetime-local":"date",j=n?Ane:Tne,C=n?Pne:Vne;let T;e[17]!==f||e[18]!==i?(T=()=>g(f(i)),e[17]=f,e[18]=i,e[19]=T):T=e[19];let N;e[20]!==L||e[21]!==s||e[22]!==p||e[23]!==T||e[24]!==k||e[25]!==j||e[26]!==C?(N=o.jsx(mt,{id:s,type:k,min:j,max:C,value:p,onChange:L,onBlur:T,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[20]=L,e[21]=s,e[22]=p,e[23]=T,e[24]=k,e[25]=j,e[26]=C,e[27]=N):N=e[27];let V;e[28]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(lr,{className:"h-4 w-4"}),e[28]=V):V=e[28];let A;e[29]!==l?(A=o.jsx(ns,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":l,children:V})}),e[29]=l,e[30]=A):A=e[30];const E=_??void 0;let R;e[31]!==S||e[32]!==E?(R=o.jsx(is,{className:"w-auto p-0",align:"end",onCloseAutoFocus:One,children:o.jsx(t9,{mode:"single",selected:E,onSelect:S,initialFocus:!0})}),e[31]=S,e[32]=E,e[33]=R):R=e[33];let I;e[34]!==a||e[35]!==A||e[36]!==R?(I=o.jsxs(rs,{open:a,onOpenChange:c,children:[A,R]}),e[34]=a,e[35]=A,e[36]=R,e[37]=I):I=e[37];let D;return e[38]!==N||e[39]!==I?(D=o.jsxs("div",{className:"flex gap-1",children:[N,I]}),e[38]=N,e[39]=I,e[40]=D):D=e[40],D}function One(t){return t.preventDefault()}function vf(t){const e=B.c(76),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=re(),d=typeof n=="string"?n:"",f=s.format;if(f==="rich-text"||f==="rich-text-inline"||f==="html"){const L=f==="rich-text-inline";let v;return e[0]!==l||e[1]!==i||e[2]!==r||e[3]!==a||e[4]!==s||e[5]!==L||e[6]!==n?(v=o.jsx(Nne,{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a,inline:L}),e[0]=l,e[1]=i,e[2]=r,e[3]=a,e[4]=s,e[5]=L,e[6]=n,e[7]=v):v=e[7],v}if(f==="textarea"||f==="markdown"){const L=a?.virtualMcpId;let v;e[8]!==l||e[9]!==r||e[10]!==s.description||e[11]!==L?(v=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:L}),e[8]=l,e[9]=r,e[10]=s.description,e[11]=L,e[12]=v):v=e[12];let _;e[13]!==i?(_=k=>i(k.target.value),e[13]=i,e[14]=_):_=e[14];let w;e[15]!==r||e[16]!==d||e[17]!==_?(w=o.jsx(Xr,{id:r,value:d,onChange:_,rows:4}),e[15]=r,e[16]=d,e[17]=_,e[18]=w):w=e[18];let S;return e[19]!==v||e[20]!==w?(S=o.jsxs("div",{className:"space-y-2",children:[v,w]}),e[19]=v,e[20]=w,e[21]=S):S=e[21],S}const u=f==="date-time"||f==="datetime";if(f==="date"||u){const L=a?.virtualMcpId;let v;e[22]!==l||e[23]!==r||e[24]!==s.description||e[25]!==L?(v=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:L}),e[22]=l,e[23]=r,e[24]=s.description,e[25]=L,e[26]=v):v=e[26];let _;e[27]!==c?(_=c("sectionsEditor.stringField.openCalendar"),e[27]=c,e[28]=_):_=e[28];let w;e[29]!==u||e[30]!==i||e[31]!==r||e[32]!==d||e[33]!==_?(w=o.jsx(Mne,{id:r,withTime:u,value:d,onChange:i,calendarLabel:_}),e[29]=u,e[30]=i,e[31]=r,e[32]=d,e[33]=_,e[34]=w):w=e[34];let S;return e[35]!==v||e[36]!==w?(S=o.jsxs("div",{className:"space-y-2",children:[v,w]}),e[35]=v,e[36]=w,e[37]=S):S=e[37],S}if(f==="color-input"||f==="color"){const L=a?.virtualMcpId;let v;e[38]!==l||e[39]!==r||e[40]!==s.description||e[41]!==L?(v=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:L}),e[38]=l,e[39]=r,e[40]=s.description,e[41]=L,e[42]=v):v=e[42];const _=d||"#000000";let w;e[43]!==i?(w=N=>i(N.target.value),e[43]=i,e[44]=w):w=e[44];let S;e[45]!==_||e[46]!==w?(S=o.jsx("input",{type:"color",value:_,onChange:w,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[45]=_,e[46]=w,e[47]=S):S=e[47];let k;e[48]!==i?(k=N=>i(N.target.value),e[48]=i,e[49]=k):k=e[49];let j;e[50]!==r||e[51]!==d||e[52]!==k?(j=o.jsx(mt,{id:r,value:d,onChange:k,placeholder:"#000000",className:"h-10 flex-1"}),e[50]=r,e[51]=d,e[52]=k,e[53]=j):j=e[53];let C;e[54]!==S||e[55]!==j?(C=o.jsxs("div",{className:"flex items-center gap-2",children:[S,j]}),e[54]=S,e[55]=j,e[56]=C):C=e[56];let T;return e[57]!==v||e[58]!==C?(T=o.jsxs("div",{className:"space-y-2",children:[v,C]}),e[57]=v,e[58]=C,e[59]=T):T=e[59],T}const h=a?.virtualMcpId;let m;e[60]!==l||e[61]!==r||e[62]!==s.description||e[63]!==h?(m=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:h}),e[60]=l,e[61]=r,e[62]=s.description,e[63]=h,e[64]=m):m=e[64];const p=f==="url"?"url":"text";let g;e[65]!==i?(g=L=>i(L.target.value),e[65]=i,e[66]=g):g=e[66];const x=s.default!=null?String(s.default):void 0;let b;e[67]!==r||e[68]!==d||e[69]!==p||e[70]!==g||e[71]!==x?(b=o.jsx(mt,{id:r,type:p,value:d,onChange:g,placeholder:x,className:"h-10"}),e[67]=r,e[68]=d,e[69]=p,e[70]=g,e[71]=x,e[72]=b):b=e[72];let y;return e[73]!==m||e[74]!==b?(y=o.jsxs("div",{className:"space-y-2",children:[m,b]}),e[73]=m,e[74]=b,e[75]=y):y=e[75],y}const $ne=/^[+-]?\d*\.?\d*(?:[eE][+-]?\d*)?$/,Bne=/^[+-]?\d*$/;function zne(t,e){return(e?Bne:$ne).test(t)}function Fne(t){const e=B.c(16),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=typeof n=="number"?String(n):"",[d,f]=P.useState(c),[u,h]=P.useState(c);c!==u&&(h(c),d!==""&&c!==""&&Number(d)===Number(c)||f(c));const m=a?.virtualMcpId;let p;e[0]!==l||e[1]!==r||e[2]!==s.description||e[3]!==m?(p=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:m}),e[0]=l,e[1]=r,e[2]=s.description,e[3]=m,e[4]=p):p=e[4];const g=s.type==="integer"?"numeric":"decimal";let x;e[5]!==i||e[6]!==s.type?(x=L=>{const v=L.target.value,_=s.type==="integer";if(v!==""&&!zne(v,_))return;f(v);const w=Number(v);i(v===""||Number.isNaN(w)?void 0:w)},e[5]=i,e[6]=s.type,e[7]=x):x=e[7];let b;e[8]!==r||e[9]!==d||e[10]!==g||e[11]!==x?(b=o.jsx(mt,{id:r,type:"text",inputMode:g,value:d,onChange:x,className:"h-10"}),e[8]=r,e[9]=d,e[10]=g,e[11]=x,e[12]=b):b=e[12];let y;return e[13]!==p||e[14]!==b?(y=o.jsxs("div",{className:"space-y-2",children:[p,b]}),e[13]=p,e[14]=b,e[15]=y):y=e[15],y}function Une(t){const e=B.c(14),{value:s,onChange:n,path:i,label:r,schema:l,sandbox:a}=t,c=typeof s=="boolean"?s:!1,d=a?.virtualMcpId;let f;e[0]!==r||e[1]!==i||e[2]!==l.description||e[3]!==d?(f=o.jsx(Hs,{htmlFor:i,label:r,description:l.description,virtualMcpId:d}),e[0]=r,e[1]=i,e[2]=l.description,e[3]=d,e[4]=f):f=e[4];let u;e[5]!==n?(u=p=>n(p),e[5]=n,e[6]=u):u=e[6];let h;e[7]!==c||e[8]!==i||e[9]!==u?(h=o.jsx(hr,{id:i,checked:c,onCheckedChange:u}),e[7]=c,e[8]=i,e[9]=u,e[10]=h):h=e[10];let m;return e[11]!==f||e[12]!==h?(m=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[f,h]}),e[11]=f,e[12]=h,e[13]=m):m=e[13],m}const yx="__enum_empty__",Hk="__enum_clear__";function _x(t){return t===""?yx:String(t)}function Hne(t,e){if(t===yx)return"";const s=e.find(n=>_x(n)===t);return s!==void 0?s:t}function Kne(t,e){if(t!==Hk)return Hne(t,e)}function Wne(t,e){return t==null?e.some(s=>s==="")?yx:void 0:_x(t)}function qne(t){return t===""?"":String(t)}function Gne(t){const e=B.c(39),{schema:s,value:n,onChange:i,path:r,label:l,required:a,sandbox:c}=t,d=re();let f;e[0]!==s.enum?(f=s.enum??[],e[0]=s.enum,e[1]=f):f=e[1];const u=f;let h;e[2]!==u||e[3]!==n?(h=Wne(n,u),e[2]=u,e[3]=n,e[4]=h):h=e[4];const m=h;let p;e[5]!==u||e[6]!==a?(p=!a&&!u.some(Jne),e[5]=u,e[6]=a,e[7]=p):p=e[7];const g=p,x=c?.virtualMcpId;let b;e[8]!==l||e[9]!==r||e[10]!==s.description||e[11]!==x?(b=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:x}),e[8]=l,e[9]=r,e[10]=s.description,e[11]=x,e[12]=b):b=e[12];let y;e[13]!==i||e[14]!==u?(y=T=>i(Kne(T,u)),e[13]=i,e[14]=u,e[15]=y):y=e[15];let L;e[16]!==d?(L=d("sectionsEditor.enumField.selectPlaceholder"),e[16]=d,e[17]=L):L=e[17];let v;e[18]!==L?(v=o.jsx(Ns,{placeholder:L}),e[18]=L,e[19]=v):v=e[19];let _;e[20]!==r||e[21]!==v?(_=o.jsx(_s,{id:r,className:"h-10 w-full min-w-0",children:v}),e[20]=r,e[21]=v,e[22]=_):_=e[22];let w;e[23]!==g||e[24]!==d?(w=g&&o.jsx(Rt,{value:Hk,className:"text-muted-foreground",children:d("sectionsEditor.enumField.clearOption")}),e[23]=g,e[24]=d,e[25]=w):w=e[25];let S;e[26]!==u?(S=u.map(Yne),e[26]=u,e[27]=S):S=e[27];let k;e[28]!==w||e[29]!==S?(k=o.jsxs(Ls,{children:[w,S]}),e[28]=w,e[29]=S,e[30]=k):k=e[30];let j;e[31]!==m||e[32]!==k||e[33]!==y||e[34]!==_?(j=o.jsxs(ys,{value:m,onValueChange:y,children:[_,k]}),e[31]=m,e[32]=k,e[33]=y,e[34]=_,e[35]=j):j=e[35];let C;return e[36]!==j||e[37]!==b?(C=o.jsxs("div",{className:"space-y-2",children:[b,j]}),e[36]=j,e[37]=b,e[38]=C):C=e[38],C}function Yne(t){const e=_x(t);return o.jsx(Rt,{value:e,children:qne(t)},e)}function Jne(t){return t===""}const Kk={duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)",sideEffects:void 0};function Wk(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;return Array.isArray(e.variants)?e:null}function bu(t){return Wk(t)?.variants?.[0]?.rule?.__resolveType===pd}function sv(t){return{__resolveType:cl,variants:[{value:t,rule:{__resolveType:pd}}]}}function qk(t){return bu(t)?Wk(t)?.variants?.[0]?.value:t}function Ac(t){return bu(t)?qk(t):t}function Lx(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Vs(e)){const n=t.section?.__resolveType;return typeof n=="string"?n:e}return e}function Qne(t){return t.includes("flags/multivariate")}function Xne(t){return vs(t)}function Zne(t){const e=t.title?np(t.title)?.blockId:void 0;return e||(t.title&&!t.title.includes("/")?t.title:ip(t.resolveType)??vs(t.resolveType))}function eie(t,e){const s=[...t],n=new Set(s.map(r=>r.resolveType)),i=(r,l)=>{!r||n.has(r)||(n.add(r),s.push({resolveType:r,title:l??Xne(r)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const r=Lx(e.editorValue);r?.includes("/")&&i(r)}return s}function tie(t,e,s){const n=e[0]?.resolveType??"";if(s)return s;if(!t||typeof t!="object"||Array.isArray(t))return n;const i=t,r=i.__resolveType;if(typeof r=="string"){if(li(r)){const u=e.find(h=>h.resolveType===r);return u?u.resolveType:r}const d=e.find(u=>f5(u.resolveType,r));if(d)return d.resolveType;const f=e.find(u=>u.resolveType===r);if(f)return f.resolveType;if(r.includes("/"))return r}const l=typeof i.type=="string"?i.type:void 0;if(l){const d=e.find(f=>f.discriminatorValue===l||f.resolveType===l||f5(f.resolveType,l));if(d)return d.resolveType}let a=n,c=-1;for(const d of e){if(!d.schema?.properties)continue;const u=Object.keys(d.schema.properties).filter(h=>!h.startsWith("__")&&h!=="@type"&&h!=="action"&&h!=="alt").filter(h=>i[h]!==void 0).length;u>0&&u>c&&(c=u,a=d.resolveType)}return c>0,a}function nv(t,e,s){if(!t||typeof t!="object"||Array.isArray(t))return s??null;const n=Lx(t);if(!n)return s??null;if(!e)return n.includes("/")?null:s??null;const i=In(n,e);return i||(n.includes("/")?null:s??null)}function sie(t,e){if(!t?.properties||!e)return t??null;if(!(e in t.properties))return t;const s={...t.properties};return delete s[e],{...t,properties:s}}function Gk(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!Vs(e.__resolveType))return null;const s=e.section;return!s||typeof s!="object"||Array.isArray(s)?null:s}function nie(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t,n=Lx(s);return n&&Qne(n)?Array.isArray(s.variants)&&s.variants.length>0:Object.keys(s).some(i=>!i.startsWith("__")&&i!=="@type")}function wx(t){if(typeof t=="string")return t;if(!t||typeof t!="object")return"";const e=t;if(Array.isArray(e.variants)){const s=e.variants,n=s.find(r=>r.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const i=s.find(r=>typeof r.value=="string");if(i)return i.value}return typeof e.src=="string"?e.src:typeof e.url=="string"?e.url:typeof e.value=="string"?e.value:""}const iie=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),rie=5,oie=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function iv(t){const{start:e,end:s}=t,n=typeof e=="string"?e:"",i=typeof s=="string"?s:"";if(!n&&!i)return null;const r=c=>{if(!c)return null;const d=new Date(c);return Number.isNaN(d.getTime())?null:oie.format(d)},l=r(n),a=r(i);return l&&a?`${l} → ${a}`:l?`From ${l}`:a?`Until ${a}`:null}function ed(t,e=0){if(!t)return"Default";if(e>rie)return"...";const s=t.__resolveType??"";if(["website/matchers/always.ts","$live/matchers/MatchAlways.ts"].includes(s)||s==="")return"Default";switch(s){case"website/matchers/never.ts":return"Hidden";case"website/matchers/device.ts":case"$live/matchers/MatchDevice.ts":{const{mobile:i,tablet:r,desktop:l,devices:a=[]}=t,c=[...a];return i&&c.push("Mobile"),r&&c.push("Tablet"),l&&c.push("Desktop"),c.length>0?c.map(iie).join(" & "):vs(s)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return iv(t)??vs(s);case"website/matchers/random.ts":case"$live/matchers/MatchRandom.ts":{const{traffic:i}=t;return typeof i=="number"?`${Math.ceil(i*100)}% of sessions`:vs(s)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:i,match:r}=t,l=[];return i&&l.push(i),r&&l.push(r),l.length>0?l.join(" - "):vs(s)}case"website/matchers/pathname.ts":{const i=t.case,{type:r,pathname:l}=i??{};return r&&l?`Pathname ${r} ${l}`:vs(s)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:i,excludeLocations:r}=t,l=d=>[d.city,d.regionCode,d.country].filter(Boolean).join(" - "),a=i?.[0];if(a){const d=(i?.length??0)-1;return`${l(a)}${d>0?` +${d}`:""}`}const c=r?.[0];if(c){const d=(r?.length??0)-1;return`Except ${l(c)}${d>0?` +${d}`:""}`}return"Any location"}case"website/matchers/multi.ts":case"$live/matchers/MatchMulti.ts":{const{matchers:i,op:r="AND"}=t;if(i&&i.length>0){const l=r==="OR"?"OR":"AND";return i.map(a=>ed(a,e+1)).join(` ${l} `)}return vs(s)}default:{const i=iv(t);return i||vs(s)||"Default"}}}function Yk(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Jk(t,e){if(e.length===0)return 0;const s=Yk(t);for(let r=0;r<e.length;r++){const l=e[r].discriminators;if(l&&Object.keys(l).length>0&&Object.entries(l).every(([c,d])=>s[c]===d))return r}let n=0,i=-1;for(let r=0;r<e.length;r++){const l=e[r],a=new Set(Object.keys(l.discriminators??{})),d=l.propertyKeys.filter(f=>!a.has(f)).filter(f=>s[f]!==void 0&&s[f]!==null&&s[f]!=="").length;d>i&&(i=d,n=r)}return n}function lie(t,e){const s=Yk(t),n=new Set(e);return Object.fromEntries(Object.entries(s).filter(([i])=>!n.has(i)))}function aie(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}const cie="$live/matchers/MatchAlways.ts";function die(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType===p3||i.rule?.__resolveType===cie)??e.find(i=>i.value!=null);if(n&&n.value!=null)return n.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function Mp(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Mp);const e=t;if(e.__resolveType){const s=die(e);return s===void 0?t:Mp(s)}return Qk(e)}function Qk(t){const e={};for(const[s,n]of Object.entries(t))e[s]=Mp(n);return e}function uie(t,e){return e.split(".").reduce((s,n)=>{if(!(s==null||typeof s!="object"))return s[n]},t)}function Xk(t){return t==null?"":Array.isArray(t)?t.map(Xk).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function Th(t,e){if(!t.includes("{"))return;const s=Qk(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,r,l)=>{const a=(r??l??"").trim();return Xk(uie(s,a))}).trim()||void 0}function fie(t){return t.replace(/<[^>]*>/g,"").trim()}function hie(t){return t.replace(/\{\{\{?[^{}]*\}?\}\}/g,"").replace(/\s+/g," ").trim()}function mie(t){return/^Option \d+$/.test(t)}function pie(t,e){if(e.includes("{"))return Th(e,t);const s=t[e];if(typeof s=="string"&&s)return s;if(Array.isArray(s)){const n=s.map(i=>i==null?"":String(i)).filter(Boolean).join(",");if(n)return n}}function Zk(t,e,s){if(typeof t=="string")return t.trim()?t:`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){let n=Ac(t);const i=Gk(n);if(i&&(n=i,n=Ac(n)),s?.titleBy){const l=pie(n,s.titleBy);if(l)return l}if(s?.inlineUnionBranches?.length){const l=Jk(n,s.inlineUnionBranches.map(c=>({discriminators:c.discriminators,propertyKeys:Object.keys(c.schema?.properties??{})}))),a=s.inlineUnionBranches[l]?.title;if(a&&!mie(a)){const c=Th(a,n);if(c)return c;if(!a.includes("{"))return a}}for(const l of["name","label","title","alt","text","href","id","key"]){const a=n[l];if(typeof a=="string"&&a.trim()){const c=s?.properties?.[l]?.format;if(c==="rich-text"||c==="html"){const d=fie(a);if(d)return d;continue}return a}if(Array.isArray(a)){const c=a.map(d=>d==null?"":String(d)).filter(Boolean).join(",");if(c)return c}}const r=n.__resolveType;if(typeof r=="string"&&r)return r.includes("/matchers/")?ed(n):vs(r);if(s?.title){const l=Th(s.title,n);if(l)return l;if(!s.title.includes("{"))return s.title}}return`Item ${e+1}`}function Vh(t,e){return t.map((s,n)=>Zk(s,n,e))}function ej(t,e,s){return Zk(t,e,s)}function gie(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const s=e.properties;return s?.mobile?"{{{image.mobile}}}":s?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function rv(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const s=gie(e);if(!s)return;const n=Th(s,t);if(!n)return;const i=wx(n)||n;return aie(i)}function Sx(t){return t===to||t===cl}function i1(t,e){if(!Object.hasOwn(e,t))return null;const s=e[t]??{},n=s.__resolveType??t;return{data:{...s},resolveType:n}}function Ah(t,e){const s=t.__resolveType??"";if(!s)return null;if(Vs(s)){const n=t.section??{};return tj(n,e)}if(Sx(s)){const n=t.variants?.[0]?.value;return n?Ah(n,e):null}return!li(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:i1(s,e)}function tj(t,e){const s=t.__resolveType??"";if(!s)return null;if(Sx(s)){const n=t.variants?.[0]?.value;return n?Ah(n,e):null}return!li(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:i1(s,e)}function sj(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t.__resolveType;if(typeof n!="string"||!li(n)||!Object.hasOwn(e,n))return null;const i=i1(n,e);return i?{blockKey:n,...i}:null}function v3e(t,e){if(!e.isSavedBlock)return null;if(e.isHidden){const r=(Vs(t.__resolveType)?t.section:t)?.variants?.[0]?.value;if(!r)return null;const l=r.__resolveType??"";return Vs(l)?r.section?.__resolveType??l??null:l||null}return(e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType)||null}function xie(t,e,s){if(e.isMultivariate)return null;if(e.isSavedBlock&&!e.isHidden){const n=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return i1(n,s)}if(e.isHidden){const r=(Vs(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t,l=r.__resolveType??"",a=Vs(l)?r.section?.__resolveType??l:l;return Sx(a)?null:Ah(r,s)}if(e.isLazy||Vs(t.__resolveType)){const n=t.section??{};return tj(n,s)}return Ah(t,s)}function Sn(t){return typeof t=="string"?t:t.label}function Sd(t){return typeof t=="object"}function ov(t){return Sd(t)?t.arrayLabel:void 0}function bie(t){return Sd(t)?t.fieldKey:void 0}function vie(t){return Sd(t)?t.ownerPath:void 0}function lv(t,e,s){return t!=null&&typeof t=="object"?{...t,label:e,itemIndex:s}:{label:e,itemIndex:s}}function Wu(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function ta(t){return t.normalize("NFC").trim()}function yie(t,e){return e.length>0&&ta(Sn(e[0]))===ta(t)?e:[t,...e]}function _ie(t,e){return e.map(s=>{if(!Sd(s))return s;const n=s.ownerPath??[];return n[0]===t?s:{...s,ownerPath:[t,...n]}})}function ss(t,e){return ta(t)===ta(e)}function Ph(t,e){return ta(t).replace(/\s+/g,"").toLowerCase()===ta(e).replace(/\s+/g,"").toLowerCase()}function Lie(t,e,s){return(s?.hasSiblingDrillDownFields??!1)||(s?.itemLabelFromSchema??!1)||ss(e,t)||s?.arrayKey!=null&&ss(e,s.arrayKey)}function yf(t,e,s,n,i){const r=ta(s);if(t.some(a=>ss(Sn(a),r)||ss(Sn(a),s)))return t;const l={label:s,itemIndex:n};return Lie(e,s,i)&&(l.arrayLabel=e),i?.arrayKey&&(l.fieldKey=i.arrayKey),[...t,l]}function wie(t,e){return t.slice(0,t.length-e.length)}function Sie(t,e,s,n){if(s.length===0)return s;const i=s[0];if(Sd(i))return s;const r=n??sa(t,e),l=Sn(i);return ss(l,r)||ss(l,t)?s.slice(1):s}function sa(t,e){return e.title??Wu(t)}function qu(t,e,s){const n=s[t];if(!n)return Wu(t);const i=sa(t,n);return e.some(l=>{if(l===t)return!1;const a=s[l];return a!=null&&sa(l,a)===i})?Wu(t):i}function y3e(t,e){return e.isMultivariateSectionTop?0:t-2}function _3e(t,e){return e<=0?[]:t.slice(0,e)}function Bc(t,e){return t.type==="array"&&t.items||t1(t)?!0:Array.isArray(e)}function nj(t,e=0){if(e>6||!t.properties)return!1;for(const s of Object.keys(t.properties)){const n=t.properties[s];if(n&&(Bc(n)||n.type==="object"&&nj(n,e+1)))return!0}return!1}function ij(t,e=0){if(e>6||t==null||typeof t!="object")return!1;if(Array.isArray(t))return t.some(s=>s!=null&&typeof s=="object"&&!Array.isArray(s));for(const[s,n]of Object.entries(t))if(!s.startsWith("__")&&ij(n,e+1))return!0;return!1}function kie(t,e,s={}){const n=t.filter(i=>{const r=e[i];if(!r)return!1;if(r.type==="object"&&nj(r))return!0;const l=s[i];return l!=null&&typeof l=="object"&&!Array.isArray(l)?ij(l):!1});return n.length>1?new Set(n):new Set}function av(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function jie(t,e){if(t==null||typeof t!="object"||Array.isArray(t))return;const s=ej(t,e);return s===`Item ${e+1}`?void 0:s}function Eh(t,e,s={n:4e3},n=0){if(n>4||s.n<=0||t==null||typeof t!="object")return!1;if(Array.isArray(t)){for(let i=0;i<t.length;i++){const r=t[i];if(--s.n<=0)return!1;const l=jie(r,i);if(l&&ss(l,e)||Eh(r,e,s,n+1))return!0}return!1}for(const[i,r]of Object.entries(t))if(!i.startsWith("__")){if(--s.n<=0)return!1;if((Array.isArray(r)||r!=null&&typeof r=="object")&&(Ph(Wu(i),e)||Ph(i,e))||Eh(r,e,s,n+1))return!0}return!1}function rj(t,e,s,n=0){if(!s||n>4||t==null||typeof t!="object")return!1;const i=t.__resolveType;if(typeof i!="string"||!i)return!1;const r=In(i,s)?.properties;if(!r)return!1;const l=Object.keys(r);for(const a of l){const c=r[a];if(!c)continue;if(Bc(c)){const f=qu(a,l,r);if(ss(f,e)||ss(a,e))return!0}const d=t[a];if(d!=null&&typeof d=="object"&&!Array.isArray(d)&&rj(d,e,s,n+1))return!0}return!1}function Il(t,e,s,n,i,r){if(n.length===0)return null;const l=Sn(n[0]),a=bie(n[0]);if(a!=null)for(const x of t){const b=e[x];if(!(!b||!Bc(b,s[x]))&&x===a)return x}const c=n.flatMap(x=>vie(x)??[]);if(c.length>0){const x=t.filter(b=>e[b]?.type==="block-ref"&&c.includes(b));if(x.length===1)return x[0]}for(const x of t){const b=e[x];if(!b||!Bc(b,s[x]))continue;const y=qu(x,t,e);if(ss(l,y)||ss(l,x)||n.some(L=>{if(ss(Sn(L),y)||ss(Sn(L),x))return!0;const v=ov(L);return v!=null&&(ss(v,y)||ss(v,x))}))return x}for(const x of t){const b=e[x];if(!b||!Bc(b,s[x]))continue;const y=s[x];if(!Array.isArray(y))continue;if(Vh(y,b.items).some(v=>ss(v,l)))return x}let d=null,f=!1,u=null,h=!1;for(const x of t){const b=e[x];if(b?.type!=="object"||!b.properties)continue;const y=Object.keys(b.properties),L=av(s[x]),v=qu(x,t,e);if((ss(l,v)||ss(l,x))&&Il(y,b.properties,L,n.slice(1),i,r)!=null){d===null?d=x:f=!0;continue}Il(y,b.properties,L,n,i,r)!=null&&(u===null?u=x:h=!0)}if(d!==null)return f?null:d;if(u!==null)return h?null:u;for(const x of t){const b=e[x];if(b?.type!=="inline-union"||!b.inlineUnionBranches?.length)continue;const y=av(s[x]),L=sa(x,b);for(const v of b.inlineUnionBranches){const _=v.schema?.properties;if(!_)continue;const w=Object.keys(_);if(Il(w,_,y,n,i,r)||(ss(l,L)||ss(l,x))&&Il(w,_,y,n.slice(1),i,r))return x}}let m=null;const p=[],g=n.map(ov).filter(x=>x!=null);for(const x of t){const b=e[x];if(b?.type!=="block-ref")continue;const y=sa(x,b);if(l!==y&&l!==x){const L=s[x],_=(i?sj(L,i):null)?.data??L;(Eh(_,l)||g.some(w=>Eh(_,w)||rj(_,w,r)))&&p.push(x);continue}if(n.length>1){const L=s[x];if(L&&typeof L=="object"&&!Array.isArray(L)){const v=Sn(n[1]);if(Object.keys(L).some(w=>!w.startsWith("__")&&(Ph(Wu(w),v)||Ph(w,v))))return x}}m||(m=x)}return m||(p.length===1?p[0]:(p.length>1,null))}function Cie(t,e,s,n,i,r){return Il(t,e,s,n,i,r)}function Nie(t,e,s,n,i,r,l){if(i.length===0||!s.properties)return!1;const a=Object.keys(s.properties);if(Il(a,s.properties,n,i,r,l))return!0;const c=Sn(i[0]);return!ss(c,e)&&!ss(c,t)?!1:i.length>1||Il(a,s.properties,n,i.slice(1),r,l)!==null}function cv(t,e,s,n,i){if(!Sd(s))return-1;if(s.fieldKey!=null&&i!=null)return s.fieldKey!==i?-1:s.itemIndex>=0&&s.itemIndex<t.length?s.itemIndex:-1;const r=Vh(t,e);if(s.itemIndex>=0&&s.itemIndex<t.length&&ss(r[s.itemIndex],s.label))return s.itemIndex;if(n!=null&&n===s.itemIndex&&n>=0&&n<t.length)return n;const l=n!=null?r[n]:void 0;return l!==void 0&&ss(l,s.label)?n:r.findIndex(a=>ss(a,s.label))}function Tie(t,e,s,n,i,r){if(e.length===0)return null;for(let a=0;a<e.length;a++){const c=e[a],d=cv(s,n,c,i,r);if(d>=0)return{index:d,innerPath:e.slice(a+1),crumbIndex:a}}const l=e.findIndex(a=>ss(Sn(a),t));if(l>=0&&e.length>l+1){const a=e[l+1],c=cv(s,n,a,i,r);if(c>=0)return{index:c,innerPath:e.slice(l+2),crumbIndex:l+1}}return null}function tm(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===to}function Vie(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(s=>tm(s.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(s=>tm(s.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(s=>tm(s.resolveType)):!1}function Aie(t,e){if(e==="global"||e==="sections"||t1(t))return!0;const s=t.type==="array"?t.items:void 0;return s?Vie(s):!1}function dv(t){return Array.from({length:t},(e,s)=>({id:crypto.randomUUID(),index:s}))}function oj(t){return t.map((e,s)=>({...e,index:s}))}function Pie(t,e){if(e===t.length)return t;if(e<t.length)return oj(t.slice(0,e));const s=Array.from({length:e-t.length},(n,i)=>({id:crypto.randomUUID(),index:t.length+i}));return[...t,...s]}function Eie(t,e){const s=t.findIndex(r=>r.index===e),n=t.map(r=>r.index>e?{...r,index:r.index+1}:r),i={id:crypto.randomUUID(),index:e+1};return s===-1?[...n,i]:[...n.slice(0,s+1),i,...n.slice(s+1)]}function Rie(t,e){return t.filter(s=>s.index!==e).map(s=>s.index>e?{...s,index:s.index-1}:s)}const Die="w-6 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",Iie="w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-6 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-6 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",Mie="w-6 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100";function uv(t,e){return ie("h-6 shrink-0 overflow-hidden",e?Die:t?Mie:Iie)}function Oie(t){const e=B.c(8),{labelText:s,imageSrc:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(ld,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let r;e[1]!==n?(r=n&&o.jsx("img",{src:n,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=n,e[2]=r):r=e[2];let l;e[3]!==s?(l=o.jsx("span",{className:"min-w-0 truncate",children:s}),e[3]=s,e[4]=l):l=e[4];let a;return e[5]!==r||e[6]!==l?(a=o.jsxs(o.Fragment,{children:[i,o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[r,l]})]}),e[5]=r,e[6]=l,e[7]=a):a=e[7],a}function $ie(t){const e=B.c(67),{sortableId:s,labelText:n,imageSrc:i,hidden:r,onToggleHidden:l,onOpen:a,onDuplicate:c,onRemove:d}=t,f=re();let u;e[0]!==s?(u={id:s,animateLayoutChanges:Uie},e[0]=s,e[1]=u):u=e[1];const{attributes:h,listeners:m,setNodeRef:p,transform:g,isDragging:x}=K9(u);let b;e[2]!==g?(b=Ti.Transform.toString(g?{...g,x:0}:null),e[2]=g,e[3]=b):b=e[3];const y=x?0:void 0;let L;e[4]!==b||e[5]!==y?(L={transform:b,opacity:y},e[4]=b,e[5]=y,e[6]=L):L=e[6];const v=L;let _;e[7]!==a?(_=Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),a())},e[7]=a,e[8]=_):_=e[8];const w=x?"cursor-grabbing":"cursor-pointer";let S;e[9]!==w?(S=ie("group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground touch-none",w),e[9]=w,e[10]=S):S=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(ld,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=k):k=e[11];let j;e[12]!==i?(j=i&&o.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=j):j=e[13];const C=r&&"line-through opacity-50";let T;e[14]!==C?(T=ie("min-w-0 flex-1 truncate text-sm",C),e[14]=C,e[15]=T):T=e[15];let N;e[16]!==n||e[17]!==T?(N=o.jsx("span",{className:T,children:n}),e[16]=n,e[17]=T,e[18]=N):N=e[18];let V;e[19]!==r||e[20]!==l||e[21]!==f?(V=l&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":f(r?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem"),className:ie(uv(r===!0,r===!0)),onClick:Y=>{Y.stopPropagation(),l()},onPointerDown:Fie,children:r?o.jsx(HP,{size:14}):o.jsx(u0,{size:14})})}),o.jsx(We,{side:"bottom",children:f(r?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem")})]}),e[19]=r,e[20]=l,e[21]=f,e[22]=V):V=e[22];let A;e[23]!==n||e[24]!==f?(A=f("sectionsEditor.arrayField.openActionsFor",{label:n}),e[23]=n,e[24]=f,e[25]=A):A=e[25];let E;e[26]!==r?(E=ie(uv(r===!0,!1),"data-[state=open]:ml-0 data-[state=open]:w-6 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]"),e[26]=r,e[27]=E):E=e[27];let R;e[28]===Symbol.for("react.memo_cache_sentinel")?(R=o.jsx(qn,{size:14}),e[28]=R):R=e[28];let I;e[29]!==A||e[30]!==E?(I=o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":A,className:E,onClick:zie,onPointerDown:Bie,children:R})}),e[29]=A,e[30]=E,e[31]=I):I=e[31];let D;e[32]!==c?(D=Y=>{Y.stopPropagation(),c()},e[32]=c,e[33]=D):D=e[33];let O;e[34]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(an,{size:14}),e[34]=O):O=e[34];let z;e[35]!==f?(z=f("sectionsEditor.arrayField.duplicate"),e[35]=f,e[36]=z):z=e[36];let M;e[37]!==D||e[38]!==z?(M=o.jsxs(Xe,{onClick:D,children:[O,z]}),e[37]=D,e[38]=z,e[39]=M):M=e[39];let $;e[40]!==d?($=Y=>{Y.stopPropagation(),d()},e[40]=d,e[41]=$):$=e[41];let F;e[42]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(tn,{size:14}),e[42]=F):F=e[42];let U;e[43]!==f?(U=f("sectionsEditor.arrayField.delete"),e[43]=f,e[44]=U):U=e[44];let H;e[45]!==$||e[46]!==U?(H=o.jsxs(Xe,{className:"text-destructive focus:text-destructive",onClick:$,children:[F,U]}),e[45]=$,e[46]=U,e[47]=H):H=e[47];let q;e[48]!==M||e[49]!==H?(q=o.jsxs(zt,{align:"end",children:[M,H]}),e[48]=M,e[49]=H,e[50]=q):q=e[50];let W;e[51]!==I||e[52]!==q?(W=o.jsxs($t,{children:[I,q]}),e[51]=I,e[52]=q,e[53]=W):W=e[53];let G;return e[54]!==h||e[55]!==n||e[56]!==m||e[57]!==a||e[58]!==p||e[59]!==v||e[60]!==N||e[61]!==V||e[62]!==W||e[63]!==_||e[64]!==S||e[65]!==j?(G=o.jsxs("div",{ref:p,style:v,...h,...m,role:"button",tabIndex:0,onClick:a,onKeyDown:_,className:S,title:n,children:[k,j,N,V,W]}),e[54]=h,e[55]=n,e[56]=m,e[57]=a,e[58]=p,e[59]=v,e[60]=N,e[61]=V,e[62]=W,e[63]=_,e[64]=S,e[65]=j,e[66]=G):G=e[66],G}function Bie(t){return t.stopPropagation()}function zie(t){return t.stopPropagation()}function Fie(t){return t.stopPropagation()}function Uie(){return!1}function Hie(t,e,s,n,i){if(e?.type==="object"&&e.properties&&Object.keys(e.properties).length>0||e?.type==="block-ref"&&e.anyOfRefs?.length)return e;if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const r=t.__resolveType;if(typeof r=="string"&&s){const l=In(r,s);if(l?.properties&&Object.keys(l.properties).length>0)return l}}if(s&&n&&i){const l=In(n,s)?.properties?.[i]?.items;if(l?.properties&&Object.keys(l.properties).length>0)return{...l,titleBy:l.titleBy??e?.titleBy}}return e}function Kie(t){const e=t.split(".").filter(s=>!/^\d+$/.test(s));return e[e.length-1]??t}function _f({schema:t,value:e,onChange:s,path:n,label:i,breadcrumbPath:r=[],onBreadcrumbChange:l,hasSiblingDrillDownFields:a,meta:c,decofile:d,onSaveReferencedBlock:f,containerResolveType:u,previewBaseUrl:h,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}){const x=re(),b=n1(g?.virtualMcpId),y=Array.isArray(e)?e:[],L=t.items,v=Kie(n),_={arrayKey:v,hasSiblingDrillDownFields:a,itemLabelFromSchema:!!(L?.titleBy||L?.inlineUnionBranches?.length)},w=Aie(t,v),S=!w&&L?.type==="object",[k,j]=P.useState(null),C=Tie(i,r,y,L,k,v),T=C?.index??null;C===null?k!==null&&j(null):C.index!==k&&j(C.index);const[N,V]=P.useState(()=>dv(y.length)),[A,E]=P.useState(null),[R,I]=P.useState(n),[D,O]=P.useState(y.length),z=P.useRef(!1),M=P.useRef(null);R!==n?(I(n),O(y.length),V(dv(y.length)),j(null)):D!==y.length&&(O(y.length),V(ae=>Pie(ae,y.length)));const $=(ae,ce)=>ej(Ac(ae),ce,L),F=ae=>{if(z.current)return;const ce=$(y[ae],ae);j(ae),l?.(yf(r,i,ce,ae,_))},U=ae=>{const ce=[...y,ae];s(ce);const fe=ce.length-1;j(fe);const de=$(ae,fe);l?.(yf(r,i,de,fe,_))},H=()=>{const ae=L?.type,ce=L?.default!==void 0?L.default:ae==="object"?{}:ae==="block-ref"?(()=>{const te=L?.anyOfRefs?.[0]?.resolveType;return typeof te!="string"||hu(te)?{}:{__resolveType:te}})():ae==="number"||ae==="integer"?0:ae==="boolean"?!1:ae==="array"?[]:"",fe=[...y,ce];s(fe);const de=fe.length-1;j(de);const pe=$(ce,de);l?.(yf(r,i,pe,de,_))},q=()=>{if(w){if(!h){xe.error(x("sectionsEditor.arrayField.startPreviewServer"));return}if(p){p({append:U});return}xe.error(x("sectionsEditor.arrayField.sectionPickerNotAvailable"));return}H()},W=ae=>{const ce=y[ae],fe=typeof structuredClone=="function"?structuredClone(ce):JSON.parse(JSON.stringify(ce??null)),de=[...y.slice(0,ae+1),fe,...y.slice(ae+1)];s(de),V(pe=>Eie(pe,ae))},G=ae=>{const ce=y[ae],fe=[...y];fe[ae]=bu(ce)?qk(ce):sv(ce),s(fe)},Y=ae=>{s(y.filter((ce,fe)=>fe!==ae)),V(ce=>Rie(ce,ae))},J=(ae,ce)=>{const fe=[...y];if(fe[ae]=bu(y[ae])?sv(ce):ce,s(fe),ae===T&&C){const de=$(y[ae],ae),pe=$(fe[ae],ae);if(M.current={path:n,index:ae,label:pe},de!==pe){const te=[...r];te[C.crumbIndex]=lv(r[C.crumbIndex],pe,ae),l?.(te)}}},se=S0(pr(ba,{activationConstraint:{distance:8}}),pr(xa,{coordinateGetter:W9})),oe=N.map(ae=>ae.id),ne=ae=>{E(String(ae.active.id))},Q=ae=>{E(null);const{active:ce,over:fe}=ae;if(!fe||ce.id===fe.id)return;const de=oe.indexOf(String(ce.id)),pe=oe.indexOf(String(fe.id));de===-1||pe===-1||(V(te=>oj(Ql([...te],de,pe))),s(Ql([...y],de,pe)),z.current=!0,requestAnimationFrame(()=>{z.current=!1}))},K=()=>{E(null)},X=A?N.find(ae=>ae.id===A):null,Z=X!=null?y[X.index]:void 0,le=X!=null&&Z!==void 0?Vh(y,L)[X.index]:null,ee=X!=null&&Z!==void 0?rv(Ac(Z),L):void 0;if(T!==null&&T<y.length){const ae=Ac(y[T]),ce=Hie(ae,L,c,u,v),fe=()=>{if(!C)return yf(r,i,$(ae,T),T,_);const de=r.slice(0,C.crumbIndex+1),pe=M.current,te=pe?.path===n&&pe.index===T?pe.label:$(ae,T);return de[C.crumbIndex]=lv(de[C.crumbIndex],te,T),de};return o.jsx("div",{className:"min-w-0",children:ce?.type==="object"&&ce.properties?o.jsx(Ii,{schema:ce,value:ae,onChange:de=>J(T,de),basePath:`${n}.${T}`,breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:de=>{l?.([...fe(),...de])},meta:c,decofile:d,onSaveReferencedBlock:f,previewBaseUrl:h,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}):ce?na({schema:ce,value:ae,onChange:de=>J(T,de),path:`${n}.${T}`,required:!0,label:ce.title&&!ce.title.includes("{{")?ce.title:$(ae,T),breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:de=>{l?.([...fe(),...de])},meta:c,decofile:d,onSaveReferencedBlock:f,previewBaseUrl:h,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}):null})}return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[o.jsx(vx,{description:t.description,virtualMcpId:g?.virtualMcpId,children:o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:i})}),y.length>0&&o.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:y.length})]}),!b&&t.description&&o.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:t.description}),y.length>0&&o.jsx("div",{className:ie(A&&"cursor-grabbing"),children:o.jsxs(j0,{sensors:se,collisionDetection:T3,onDragStart:ne,onDragEnd:Q,onDragCancel:K,children:[o.jsx(H9,{items:oe,strategy:U9,children:o.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:(()=>{const ae=Vh(y,L);return N.map(ce=>{const fe=y[ce.index];if(fe===void 0)return null;const de=ae[ce.index]??$(fe,ce.index),pe=rv(Ac(fe),L);return o.jsx($ie,{sortableId:ce.id,labelText:de,imageSrc:pe,hidden:bu(fe),onToggleHidden:S?()=>G(ce.index):void 0,onOpen:()=>F(ce.index),onDuplicate:()=>W(ce.index),onRemove:()=>Y(ce.index)},ce.id)})})()})}),_n.createPortal(o.jsx(F9,{dropAnimation:Kk,children:le?o.jsx("div",{className:"flex min-w-0 items-center gap-2.5 rounded-lg border border-border/60 bg-background px-2 py-2.5 shadow-lg ring-1 ring-border/60",children:o.jsx(Oie,{labelText:le,imageSrc:ee})}):null}),document.body)]})}),o.jsxs("button",{type:"button",onClick:q,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30",children:[o.jsx(Kt,{size:14}),x(w?"sectionsEditor.arrayField.addSection":"sectionsEditor.arrayField.addItem")]})]})}function Wie(t){const e=B.c(53),{schema:s,value:n,onChange:i,path:r,label:l,breadcrumbPath:a,onBreadcrumbChange:c,focused:d,meta:f,decofile:u,onSaveReferencedBlock:h,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}=t;let b;e[0]!==a?(b=a===void 0?[]:a,e[0]=a,e[1]=b):b=e[1];const y=b,[L,v]=P.useState(!1),_=n1(x?.virtualMcpId);let w;e[2]!==n?(w=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},e[2]=n,e[3]=w):w=e[3];const S=w;if(!s.properties)return null;let k;e[4]!==y||e[5]!==u||e[6]!==f||e[7]!==S||e[8]!==p||e[9]!==c||e[10]!==i||e[11]!==g||e[12]!==h||e[13]!==r||e[14]!==m||e[15]!==x||e[16]!==s?(k=o.jsx(Ii,{schema:s,value:S,onChange:i,basePath:r,breadcrumbPath:y,onBreadcrumbChange:c,meta:f,decofile:u,onSaveReferencedBlock:h,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}),e[4]=y,e[5]=u,e[6]=f,e[7]=S,e[8]=p,e[9]=c,e[10]=i,e[11]=g,e[12]=h,e[13]=r,e[14]=m,e[15]=x,e[16]=s,e[17]=k):k=e[17];const j=k;if(d)return j;let C;e[18]!==r?(C=r.split(".").pop()??r,e[18]=r,e[19]=C):C=e[19];const T=C;let N;e[20]!==y||e[21]!==u||e[22]!==T||e[23]!==l||e[24]!==f||e[25]!==S||e[26]!==s?(N=Nie(T,l,s,S,y,u,f),e[20]=y,e[21]=u,e[22]=T,e[23]=l,e[24]=f,e[25]=S,e[26]=s,e[27]=N):N=e[27];const A=L||N,E=`${r}-fields`;let R;e[28]===Symbol.for("react.memo_cache_sentinel")?(R=()=>v(qie),e[28]=R):R=e[28];let I;e[29]!==A?(I=o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:A?o.jsx(Qt,{size:16}):o.jsx(en,{size:16})}),e[29]=A,e[30]=I):I=e[30];const D=x?.virtualMcpId;let O;e[31]!==l?(O=o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[31]=l,e[32]=O):O=e[32];let z;e[33]!==s.description||e[34]!==O||e[35]!==D?(z=o.jsx(vx,{description:s.description,virtualMcpId:D,children:O}),e[33]=s.description,e[34]=O,e[35]=D,e[36]=z):z=e[36];let M;e[37]!==E||e[38]!==A||e[39]!==z||e[40]!==I?(M=o.jsxs("button",{type:"button","aria-expanded":A,"aria-controls":E,onClick:R,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[I,z]}),e[37]=E,e[38]=A,e[39]=z,e[40]=I,e[41]=M):M=e[41];let $;e[42]!==s.description||e[43]!==_?($=!_&&s.description&&o.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:s.description}),e[42]=s.description,e[43]=_,e[44]=$):$=e[44];let F;e[45]!==E||e[46]!==j||e[47]!==A?(F=A&&o.jsx("div",{id:E,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:j}),e[45]=E,e[46]=j,e[47]=A,e[48]=F):F=e[48];let U;return e[49]!==M||e[50]!==$||e[51]!==F?(U=o.jsxs("div",{className:"min-w-0 space-y-2",children:[M,$,F]}),e[49]=M,e[50]=$,e[51]=F,e[52]=U):U=e[52],U}function qie(t){return!t}function L3e(t,e,s,n,i){const r={...t[e]};if(i.length>1){const l=r.sections,a=[...l?.variants??[]];a[n]&&(a[n]={...a[n],value:s}),r.sections={...l,variants:a}}else r.sections=s;return r}function w3e(t){return structuredClone(t)}function S3e(t){return!t.isSavedBlock&&!t.isMultivariate&&!t.isHidden}function lj(t){const e=t.replace(/[^A-Za-z0-9_ -]/g,"").replace(/\s+/g," ").trim();return/^[A-Za-z]/.test(e)?e:e?`Block ${e}`:""}function kx(t,e){const s=t.trim();return s?s.includes("/")?"Block name cannot contain slashes.":Object.hasOwn(e,s)?"A block with this name already exists.":/^[A-Za-z][A-Za-z0-9_ -]*$/.test(s)?null:"Use letters, numbers, spaces, hyphens, or underscores. Must start with a letter.":"Block name is required."}function jx(t){const e=B.c(61),{open:s,onOpenChange:n,defaultBlockId:i,isPending:r,onSubmit:l}=t,a=i===void 0?"":i,c=r===void 0?!1:r,[d,f]=P.useState(a),[u,h]=P.useState(s);s!==u&&(h(s),s&&f(a));let m;e[0]!==c||e[1]!==n?(m=$=>{!$&&!c&&n(!1)},e[0]=c,e[1]=n,e[2]=m):m=e[2];const p=m;let g;e[3]!==d||e[4]!==c||e[5]!==l?(g=async $=>{$.preventDefault();const F=d.trim();!F||c||await l(F)},e[3]=d,e[4]=c,e[5]=l,e[6]=g):g=e[6];const x=g,b=re();let y;e[7]!==b?(y=b("sectionsEditor.makeReusableModal.title"),e[7]=b,e[8]=y):y=e[8];let L;e[9]!==y?(L=o.jsx(Yt,{children:y}),e[9]=y,e[10]=L):L=e[10];let v;e[11]!==b?(v=b("sectionsEditor.makeReusableModal.description"),e[11]=b,e[12]=v):v=e[12];let _;e[13]!==v?(_=o.jsx(kn,{children:v}),e[13]=v,e[14]=_):_=e[14];let w;e[15]!==L||e[16]!==_?(w=o.jsxs(hs,{children:[L,_]}),e[15]=L,e[16]=_,e[17]=w):w=e[17];let S;e[18]!==b?(S=b("sectionsEditor.makeReusableModal.blockNameLabel"),e[18]=b,e[19]=S):S=e[19];let k;e[20]!==S?(k=o.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:S}),e[20]=S,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=$=>f($.target.value),e[22]=j):j=e[22];let C;e[23]!==b?(C=b("sectionsEditor.makeReusableModal.blockNamePlaceholder"),e[23]=b,e[24]=C):C=e[24];let T;e[25]!==d||e[26]!==c||e[27]!==C?(T=o.jsx(mt,{id:"block-id",value:d,onChange:j,placeholder:C,autoFocus:!0,disabled:c}),e[25]=d,e[26]=c,e[27]=C,e[28]=T):T=e[28];let N;e[29]!==k||e[30]!==T?(N=o.jsxs("div",{className:"py-4 space-y-2",children:[k,T]}),e[29]=k,e[30]=T,e[31]=N):N=e[31];let V;e[32]!==n?(V=()=>n(!1),e[32]=n,e[33]=V):V=e[33];let A;e[34]!==b?(A=b("sectionsEditor.makeReusableModal.cancel"),e[34]=b,e[35]=A):A=e[35];let E;e[36]!==c||e[37]!==V||e[38]!==A?(E=o.jsx(ue,{type:"button",variant:"outline",onClick:V,disabled:c,children:A}),e[36]=c,e[37]=V,e[38]=A,e[39]=E):E=e[39];let R;e[40]!==d||e[41]!==c?(R=!d.trim()||c,e[40]=d,e[41]=c,e[42]=R):R=e[42];let I;e[43]!==c||e[44]!==b?(I=c?o.jsxs(o.Fragment,{children:[o.jsx(ot,{size:14,className:"animate-spin"}),b("sectionsEditor.makeReusableModal.saving")]}):b("sectionsEditor.makeReusableModal.save"),e[43]=c,e[44]=b,e[45]=I):I=e[45];let D;e[46]!==R||e[47]!==I?(D=o.jsx(ue,{type:"submit",disabled:R,children:I}),e[46]=R,e[47]=I,e[48]=D):D=e[48];let O;e[49]!==E||e[50]!==D?(O=o.jsxs(Wn,{children:[E,D]}),e[49]=E,e[50]=D,e[51]=O):O=e[51];let z;e[52]!==x||e[53]!==N||e[54]!==O||e[55]!==w?(z=o.jsx(Ut,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:x,children:[w,N,O]})}),e[52]=x,e[53]=N,e[54]=O,e[55]=w,e[56]=z):z=e[56];let M;return e[57]!==p||e[58]!==s||e[59]!==z?(M=o.jsx(Ht,{open:s,onOpenChange:p,children:z}),e[57]=p,e[58]=s,e[59]=z,e[60]=M):M=e[60],M}function Gie(t){if(!t?.properties)return{};const e={};for(const[s,n]of Object.entries(t.properties))s.startsWith("__")||s==="@type"||(n.default!==void 0?e[s]=n.default:n.type==="boolean"?e[s]=!1:n.type==="string"?e[s]="":n.type==="number"||n.type==="integer"?e[s]=0:n.type==="object"&&(e[s]={}));return e}function Yie(t){const e=B.c(13),{blockKey:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Mn,{size:11}),e[0]=i):i=e[0];let r;e[1]!==n?(r=n("sectionsEditor.anyOfField.global"),e[1]=n,e[2]=r):r=e[2];let l;e[3]!==r?(l=o.jsx(Ke,{asChild:!0,children:o.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[i,r]})}),e[3]=r,e[4]=l):l=e[4];let a;e[5]!==s||e[6]!==n?(a=n("sectionsEditor.anyOfField.globalLoaderTooltip",{blockKey:s}),e[5]=s,e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx(We,{side:"top",className:"max-w-[260px]",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=o.jsxs(qe,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function Jie(t){const e=B.c(36),{path:s,open:n,onOpenChange:i,title:r,nested:l,nestedBlockRef:a,globalBlockKey:c,onDetach:d,onMakeGlobal:f}=t,u=re(),h=`${s}-loader-config`,m=a&&"ml-1";let p;e[0]!==m?(p=ie("rounded-lg border border-border/80 bg-muted/30",m),e[0]=m,e[1]=p):p=e[1];let g;e[2]!==i||e[3]!==n?(g=()=>i(!n),e[2]=i,e[3]=n,e[4]=g):g=e[4];let x;e[5]!==n?(x=o.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:n?o.jsx(Qt,{size:16}):o.jsx(en,{size:16})}),e[5]=n,e[6]=x):x=e[6];let b;e[7]!==r?(b=o.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:r}),e[7]=r,e[8]=b):b=e[8];let y;e[9]!==c?(y=c&&o.jsx(Yie,{blockKey:c}),e[9]=c,e[10]=y):y=e[10];let L;e[11]!==b||e[12]!==y?(L=o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,y]}),e[11]=b,e[12]=y,e[13]=L):L=e[13];let v;e[14]!==h||e[15]!==n||e[16]!==g||e[17]!==x||e[18]!==L?(v=o.jsxs("button",{type:"button","aria-expanded":n,"aria-controls":h,onClick:g,className:"flex min-w-0 flex-1 items-center gap-2 rounded-lg px-3 py-2.5 text-left",children:[x,L]}),e[14]=h,e[15]=n,e[16]=g,e[17]=x,e[18]=L,e[19]=v):v=e[19];let _;e[20]!==c||e[21]!==d||e[22]!==f||e[23]!==u?(_=(d||f)&&o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":u("sectionsEditor.anyOfField.loaderActions"),className:"h-7 w-7 shrink-0 text-muted-foreground",children:o.jsx(qn,{size:16})})}),o.jsxs(zt,{align:"end",className:"w-48",children:[c&&d&&o.jsxs(Xe,{onClick:d,children:[o.jsx(Ko,{className:"h-4 w-4"}),u("sectionsEditor.anyOfField.detach")]}),!c&&f&&o.jsxs(Xe,{onClick:f,children:[o.jsx(Mn,{className:"h-4 w-4"}),u("sectionsEditor.anyOfField.makeGlobal")]})]})]}),e[20]=c,e[21]=d,e[22]=f,e[23]=u,e[24]=_):_=e[24];let w;e[25]!==v||e[26]!==_?(w=o.jsxs("div",{className:"group flex w-full min-w-0 items-center gap-1 rounded-lg pr-2 transition-colors hover:bg-accent/50",children:[v,_]}),e[25]=v,e[26]=_,e[27]=w):w=e[27];let S;e[28]!==h||e[29]!==l||e[30]!==n?(S=n&&o.jsx("div",{id:h,className:"border-t border-border/60 px-4 pb-4 pt-3",children:o.jsx("div",{className:"border-l border-border/80 pl-4",children:l})}),e[28]=h,e[29]=l,e[30]=n,e[31]=S):S=e[31];let k;return e[32]!==w||e[33]!==S||e[34]!==p?(k=o.jsxs("div",{className:p,children:[w,S]}),e[32]=w,e[33]=S,e[34]=p,e[35]=k):k=e[35],k}function fv(t){const e=B.c(42),{schema:s,value:n,onChange:i,path:r,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:d,decofile:f,onSaveReferencedBlock:u,sandbox:h,previewBaseUrl:m,onRequestAddSection:p}=t,g=re(),x=(s.anyOfRefs??[]).filter(Zie),b=f&&n?sj(n,f):null,y=b?.data??n,L=b?null:Gk(y),v=L??y,_=eie(x,{savedBlockKey:b?.blockKey,editorValue:y}),w=_.length>0?tie(y,_,b?.blockKey):_[0]?.resolveType??"",k=s.type==="block-ref"&&_.some(Xie);let j;e[0]!==l||e[1]!==r?(j=l??(r.includes(".")?r.split(".")[0]:r),e[0]=l,e[1]=r,e[2]=j):j=e[2];const C=j;let T;e[3]!==a?(T=a??[],e[3]=a,e[4]=T):T=e[4];const N=T,V=k&&N.length>0&&Sn(N[0])===C,A=V?N.slice(1):N,E=V?se=>{c?.([C,...se])}:c,[R,I]=P.useState(w),[D,O]=P.useState(w);D!==w&&(O(w),I(w));const[z,M]=P.useState(()=>nie(y,b?.blockKey)),[$,F]=P.useState(!1);if(_.length>0){const se=R||w;let oe;e[5]!==se?(oe=je=>je.resolveType===se,e[5]=se,e[6]=oe):oe=e[6];const ne=_.find(oe),Q=nv(y,d,ne?.schema),K=sie(Q??ne?.schema??null,s.discriminatorKey),X=s.discriminatorKey,Z=je=>{I(je);const me=_.find(Te=>Te.resolveType===je),Ce=nv(y,d,me?.schema),Ne=new Set(Object.keys((Ce??me?.schema)?.properties??{})),Ie=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},et=Object.fromEntries(Object.entries(Ie).filter(Te=>{const[Me]=Te;return Ne.has(Me)})),Ze={...Gie(me?.schema),...et};if(X){const Te=me?.discriminatorValue??je;i({...Ze,[X]:Te});return}if(hu(je)){i(Ze);return}i({...Ze,__resolveType:je})};let le;e[7]!==se||e[8]!==X||e[9]!==i?(le=je=>{if(X||!hu(se)||je===null||typeof je!="object"||Array.isArray(je)){i(je);return}const{__resolveType:me,...Ce}=je;i(Ce)},e[7]=se,e[8]=X,e[9]=i,e[10]=le):le=e[10];const ee=le,ae=K?.properties?o.jsx(Ii,{schema:K,value:v,onChange:je=>{if(b&&u){u(b.blockKey,je);return}if(L){i({...y,section:je});return}ee(je)},basePath:r,breadcrumbPath:A,onBreadcrumbChange:E,meta:d,decofile:f,onSaveReferencedBlock:u,sandbox:h,previewBaseUrl:m,onRequestAddSection:p}):null;if(k&&ae&&A.length>0){let je;return e[11]!==ae?(je=o.jsx("div",{className:"min-w-0",children:ae}),e[11]=ae,e[12]=je):je=e[12],je}let ce;e[13]!==r?(ce=r.includes("."),e[13]=r,e[14]=ce):ce=e[14];const fe=ce,de=b?()=>{const{name:je,...me}=b.data;i(me)}:void 0,pe=!b&&!L&&!!u&&k&&!hu(se)&&se.includes("/"),te=v&&typeof v=="object"&&!Array.isArray(v)?v:{},ge=je=>{if(!u)return;const me=je.trim(),Ce=kx(me,f??{});if(Ce){xe.error(Ce);return}u(me,{...te,__resolveType:se,name:me}),i({__resolveType:me}),F(!1),xe.success(g("sectionsEditor.anyOfField.globalBlockSaved",{name:me}))},ve=h?.virtualMcpId;let Se;e[15]!==l||e[16]!==r||e[17]!==s.description||e[18]!==ve?(Se=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:ve}),e[15]=l,e[16]=r,e[17]=s.description,e[18]=ve,e[19]=Se):Se=e[19];let ye;e[20]!==g?(ye=g("sectionsEditor.anyOfField.selectPlaceholder"),e[20]=g,e[21]=ye):ye=e[21];let ke;e[22]!==ye?(ke=o.jsx(Ns,{placeholder:ye}),e[22]=ye,e[23]=ke):ke=e[23];let we;return e[24]!==r||e[25]!==ke?(we=o.jsx(_s,{id:r,className:"w-full min-w-0",children:ke}),e[24]=r,e[25]=ke,e[26]=we):we=e[26],o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[Se,o.jsxs(ys,{value:se||void 0,onValueChange:Z,children:[we,o.jsx(Ls,{children:_.map(Qie)})]})]}),ae&&(k?o.jsx(Jie,{path:r,open:z,onOpenChange:M,title:g(fe?"sectionsEditor.anyOfField.configuration":"sectionsEditor.anyOfField.loaderConfiguration"),nested:ae,nestedBlockRef:fe,globalBlockKey:b?.blockKey,onDetach:de,onMakeGlobal:pe?()=>F(!0):void 0}):ae),pe&&o.jsx(jx,{open:$,onOpenChange:F,defaultBlockId:lj(vs(se)),onSubmit:ge})]})}if(s.anyOfRefs&&s.anyOfRefs.length>0)return null;const U=h?.virtualMcpId;let H;e[27]!==l||e[28]!==r||e[29]!==s.description||e[30]!==U?(H=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:U}),e[27]=l,e[28]=r,e[29]=s.description,e[30]=U,e[31]=H):H=e[31];const q=n!=null?String(n):"";let W;e[32]!==i?(W=se=>i(se.target.value),e[32]=i,e[33]=W):W=e[33];const G=s.description??"";let Y;e[34]!==r||e[35]!==q||e[36]!==W||e[37]!==G?(Y=o.jsx("input",{id:r,type:"text",value:q,onChange:W,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:G}),e[34]=r,e[35]=q,e[36]=W,e[37]=G,e[38]=Y):Y=e[38];let J;return e[39]!==H||e[40]!==Y?(J=o.jsxs("div",{className:"space-y-1.5",children:[H,Y]}),e[39]=H,e[40]=Y,e[41]=J):J=e[41],J}function Qie(t){const e=Zne(t);return o.jsx(Rt,{value:t.resolveType,children:e},t.resolveType)}function Xie(t){return t.resolveType.includes("/")&&!hu(t.resolveType)}function Zie(t){return t.resolveType!==""}const sm=(t,e)=>t.match(new RegExp(`\\b${e}\\s*=\\s*"([^"]*)"`,"i"))?.[1];function ere(t){const e={};if(typeof t!="string")return e;const s=/<symbol\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/symbol>/gi;for(const n of t.matchAll(s)){const i=n[1]??"",r=n[2]??"",l=sm(i,"id");if(!l)continue;const a=sm(i,"viewBox"),c=sm(i,"fill"),d=['xmlns="http://www.w3.org/2000/svg"',a?`viewBox="${a}"`:"",c?`fill="${c}"`:""].filter(Boolean).join(" ");e[l]=`<svg ${d}>${r}</svg>`}return e}async function tre(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch sprite sheet: ${e.status}`);return ere(await e.text())}function sre(t){if(!Array.isArray(t))return[];const e=[];for(const s of t)if(typeof s=="string")e.push({value:s,label:s});else if(s&&typeof s=="object"&&"value"in s){const n=s;e.push({value:String(n.value),label:typeof n.label=="string"?n.label:String(n.value),image:typeof n.image=="string"?n.image:void 0,icon:typeof n.icon=="string"?n.icon:void 0})}return e}function nre(t){if(!Array.isArray(t))return[];const e=[];for(const s of t)typeof s=="string"&&e.push({value:s,label:s});return e}function ire(t,e){return t.length>0?t:e}function rre(t,e){const s=e.trim().toLowerCase();return s?t.filter(n=>n.value.toLowerCase().includes(s)||(n.label??"").toLowerCase().includes(s)):t}function ore({loaderPath:t,isIconSelect:e,enumFallbackCount:s,trimmedSearch:n,optionValues:i,optionsSettled:r}){return!!t&&!e&&s===0&&r&&n.length>0&&!i.includes(n)}function aj(t,e){const n=`<style>${e?`svg{color:${e}}`:""}.fill-current{fill:currentColor}.stroke-current{stroke:currentColor}.text-current{color:currentColor}</style>`,i=t.replace(/(<svg[^>]*>)/i,`$1${n}`);return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function lre(){return getComputedStyle(document.documentElement).getPropertyValue("--foreground").trim()||void 0}function are(t,e){if(t.previewSrc)return t.previewSrc;if(t.image)return t.image;if(t.icon)return aj(t.icon,e)}async function cre(t,e,s){const n={};s&&(n.term=s);const r=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,l=await fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!l.ok)throw new Error(`Failed to fetch dynamic options: ${l.status}`);const a=await l.json();return sre(a)}function hv(t){const e=B.c(9),{option:s,className:n,fg:i}=t;let r;e[0]!==i||e[1]!==s?(r=are(s,i),e[0]=i,e[1]=s,e[2]=r):r=e[2];const l=r;if(!l)return null;const a=s.image?"rounded object-cover":"object-contain";let c;e[3]!==n||e[4]!==a?(c=ie("shrink-0",a,n),e[3]=n,e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=o.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",className:c}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function dre(t){const e=B.c(53),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=re(),d=s.options,f=a?.previewUrl,[u,h]=P.useState(!1),[m,p]=P.useState(""),[g,x]=P.useState(""),b=P.useRef(null);let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=ee=>{p(ee),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(ee)},300)},e[0]=y):y=e[0];const L=y,v=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"",_=typeof n=="string"?n:"",w=s.format==="icon-select";let S;e[1]!==g||e[2]!==d||e[3]!==v?(S=Je.sandboxInvoke(v,`dynamic-options:${d??""}:${g}`),e[1]=g,e[2]=d,e[3]=v,e[4]=S):S=e[4];let k;e[5]!==g||e[6]!==d||e[7]!==f?(k=()=>cre(f,d,g||void 0),e[5]=g,e[6]=d,e[7]=f,e[8]=k):k=e[8];const j=!!f&&!!d&&(u||!!_);let C;e[9]!==S||e[10]!==k||e[11]!==j?(C={queryKey:S,queryFn:k,enabled:j,staleTime:6e4,retry:1},e[9]=S,e[10]=k,e[11]=j,e[12]=C):C=e[12];const T=Tt(C),N=T.data??[];let V;e[13]!==v?(V=Je.sandboxSprite(v),e[13]=v,e[14]=V):V=e[14];let A;e[15]!==f||e[16]!==a?(A=()=>tre(W_({orgSlug:a.orgSlug,virtualMcpId:a.virtualMcpId,branch:a.branch,threadId:a.threadId,previewUrl:f},"/sprites.svg")),e[15]=f,e[16]=a,e[17]=A):A=e[17];const E=w&&!!a&&(u||!!_)&&(!d||T.isFetched&&N.length===0);let R;e[18]!==V||e[19]!==A||e[20]!==E?(R={queryKey:V,queryFn:A,enabled:E,staleTime:3e5,retry:1},e[18]=V,e[19]=A,e[20]=E,e[21]=R):R=e[21];const I=Tt(R),D=nre(s.enum),O=I.data??{},z=lre(),M=Object.fromEntries(Object.entries(O).map(ee=>{const[ae,ce]=ee;return[ae,aj(ce,z)]})),$=w&&Object.keys(M).length>0?D.map(ee=>({...ee,previewSrc:M[ee.value]})):D,F=ire(N,$),U=rre(F,m);let H;e[22]!==_?(H=ee=>ee.value===_,e[22]=_,e[23]=H):H=e[23];const q=F.find(H),W=m.trim(),G=T.isFetched&&!T.isFetching&&m===g,Y=ore({loaderPath:d,isIconSelect:w,enumFallbackCount:D.length,trimmedSearch:W,optionValues:F.map(ure),optionsSettled:G});if((!f||!d)&&D.length===0){const ee=a?.virtualMcpId;let ae;e[24]!==l||e[25]!==r||e[26]!==s.description||e[27]!==ee?(ae=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:ee}),e[24]=l,e[25]=r,e[26]=s.description,e[27]=ee,e[28]=ae):ae=e[28];let ce;e[29]!==i?(ce=pe=>i(pe.target.value),e[29]=i,e[30]=ce):ce=e[30];let fe;e[31]!==_||e[32]!==r||e[33]!==ce?(fe=o.jsx(mt,{id:r,type:"text",value:_,onChange:ce}),e[31]=_,e[32]=r,e[33]=ce,e[34]=fe):fe=e[34];let de;return e[35]!==ae||e[36]!==fe?(de=o.jsxs("div",{className:"space-y-2",children:[ae,fe]}),e[35]=ae,e[36]=fe,e[37]=de):de=e[37],de}const se=a?.virtualMcpId;let oe;e[38]!==l||e[39]!==r||e[40]!==s.description||e[41]!==se?(oe=o.jsx(Hs,{htmlFor:r,label:l,description:s.description,virtualMcpId:se}),e[38]=l,e[39]=r,e[40]=s.description,e[41]=se,e[42]=oe):oe=e[42];const ne=q?o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(hv,{option:q,className:"h-6 w-6",fg:z}),o.jsx("span",{className:"truncate",children:q.label??q.value})]}):_?o.jsx("span",{className:"truncate",children:_}):o.jsx("span",{className:"text-muted-foreground",children:c("sectionsEditor.dynamicOptionsField.selectPlaceholder")});let Q;e[43]===Symbol.for("react.memo_cache_sentinel")?(Q=o.jsx(S9,{className:"size-4 shrink-0 opacity-50"}),e[43]=Q):Q=e[43];let K;e[44]!==u||e[45]!==ne?(K=o.jsx(ns,{asChild:!0,children:o.jsxs(ue,{variant:"outline",role:"combobox","aria-expanded":u,className:"h-10 w-full justify-between font-normal",children:[ne,Q]})}),e[44]=u,e[45]=ne,e[46]=K):K=e[46];let X;e[47]===Symbol.for("react.memo_cache_sentinel")?(X={width:"var(--radix-popover-trigger-width)"},e[47]=X):X=e[47];let Z;e[48]!==c?(Z=c("sectionsEditor.dynamicOptionsField.searchPlaceholder"),e[48]=c,e[49]=Z):Z=e[49];let le;return e[50]!==m||e[51]!==Z?(le=o.jsx(On,{placeholder:Z,className:"h-9",value:m,onValueChange:L}),e[50]=m,e[51]=Z,e[52]=le):le=e[52],o.jsxs("div",{className:"space-y-2",children:[oe,o.jsxs(rs,{open:u,onOpenChange:h,children:[K,o.jsx(is,{className:"p-0",style:X,children:o.jsxs(Yn,{shouldFilter:!1,children:[le,o.jsxs($n,{children:[!Y&&o.jsx(Cn,{children:T.isLoading?c("sectionsEditor.dynamicOptionsField.loading"):c("sectionsEditor.dynamicOptionsField.noResults")}),o.jsx(fs,{children:U.map(ee=>o.jsxs(Wt,{value:ee.value,className:"cursor-pointer",onSelect:()=>{i(ee.value===_?"":ee.value),h(!1)},children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(hv,{option:ee,className:ie(ee.image?"h-9 w-9":"h-6 w-6"),fg:z}),o.jsx("span",{className:"truncate",children:ee.label??ee.value})]}),o.jsx(Ft,{className:ie("ml-auto size-4 shrink-0",_===ee.value?"opacity-100":"opacity-0")})]},ee.value))}),Y&&o.jsx(fs,{children:o.jsx(Wt,{value:W,className:"cursor-pointer",onSelect:()=>{i(W),p(""),x(""),h(!1)},children:o.jsx("span",{className:"truncate",children:c("sectionsEditor.dynamicOptionsField.useValue",{value:W})})})})]})]})})]})]})}function ure(t){return t.value}function cj(t){const e=B.c(17),{org:s}=Fe(),n=ws();let i,r,l,a;e[0]!==s.id||e[1]!==t.configId||e[2]!==t.imageOnly||e[3]!==t.search?(r=t.search?.trim()||void 0,i=t.imageOnly??!1,a=m7,l=Je.filePickerObjects(s.id,t.configId,r,i),e[0]=s.id,e[1]=t.configId,e[2]=t.imageOnly,e[3]=t.search,e[4]=i,e[5]=r,e[6]=l,e[7]=a):(i=e[4],r=e[5],l=e[6],a=e[7]);const c=t.enabled!==!1&&!!t.configId;let d;e[8]!==i||e[9]!==t.configId||e[10]!==r||e[11]!==n?(d=async u=>{const{pageParam:h}=u;return await n.call("FILE_OBJECTS_LIST",{configId:t.configId,cursor:h??void 0,search:r,imageOnly:i||void 0})},e[8]=i,e[9]=t.configId,e[10]=r,e[11]=n,e[12]=d):d=e[12];let f;return e[13]!==l||e[14]!==c||e[15]!==d?(f={queryKey:l,enabled:c,staleTime:3e4,initialPageParam:null,queryFn:d,getNextPageParam:fre},e[13]=l,e[14]=c,e[15]=d,e[16]=f):f=e[16],a(f)}function fre(t){return t.nextCursor??void 0}function r1(){const t=B.c(2),{org:e}=Fe();let s;return t[0]!==e?(s={mutationFn:async n=>{const i=n.file.type||"application/octet-stream",r=await fetch(`/api/${encodeURIComponent(e.slug)}/file-configs/${encodeURIComponent(n.configId)}/upload?filename=${encodeURIComponent(n.file.name)}`,{method:"POST",headers:{"Content-Type":i},body:n.file});if(!r.ok){const l=await r.text().catch(hre);let a=`${r.status} ${r.statusText}`;try{const c=JSON.parse(l);c.message&&(a=c.message)}catch{l&&(a=l.slice(0,200))}throw new Error(`Upload failed: ${a}`)}return await r.json()}},t[0]=e,t[1]=s):s=t[1],Rs(s)}function hre(){return""}function mre(){const t=B.c(8),{org:e}=Fe(),s=ws(),n=ps();let i;t[0]!==s?(i=a=>s.call("FILE_OBJECT_DELETE",a),t[0]=s,t[1]=i):i=t[1];let r;t[2]!==e||t[3]!==n?(r=(a,c)=>{n.invalidateQueries({queryKey:Je.filePickerObjectsByConfig(e.id,c.configId)})},t[2]=e,t[3]=n,t[4]=r):r=t[4];let l;return t[5]!==i||t[6]!==r?(l={mutationFn:i,onSuccess:r},t[5]=i,t[6]=r,t[7]=l):l=t[7],Rs(l)}function Cx(t){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(t)}function dj(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"file":t.slice(e+1).toLowerCase()}function Rh(t){const e=t.split("/");return e[e.length-1]??t}function uj(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}const o1="file-picker:last-config-id";function fj(t){const e=B.c(31),s=re(),n=t.open,i=t.onOpenChange;let r;e[0]!==t.mode||e[1]!==s?(r=t.mode==="image"?s("filePicker.filePickerDialog.pickAnImage"):s("filePicker.filePickerDialog.pickAFile"),e[0]=t.mode,e[1]=s,e[2]=r):r=e[2];let l;e[3]!==r?(l=o.jsx(Yt,{children:r}),e[3]=r,e[4]=l):l=e[4];let a;e[5]!==s?(a=s("filePicker.filePickerDialog.description"),e[5]=s,e[6]=a):a=e[6];let c;e[7]!==a?(c=o.jsx(kn,{children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=o.jsxs(hs,{children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11];let f;e[12]!==s?(f=b=>{const{error:y}=b;return o.jsx(pre,{error:y??new Error(s("filePicker.filePickerDialog.failedToLoadBuckets"))})},e[12]=s,e[13]=f):f=e[13];let u;e[14]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(At,{className:"h-64 w-full"}),e[14]=u):u=e[14];let h;e[15]!==t?(h=b=>{t.onSelect(b),t.onOpenChange(!1)},e[15]=t,e[16]=h):h=e[16];let m;e[17]!==t.lockedConfigId||e[18]!==t.mode||e[19]!==h?(m=o.jsx(P.Suspense,{fallback:u,children:o.jsx(gre,{mode:t.mode,lockedConfigId:t.lockedConfigId,onSelect:h})}),e[17]=t.lockedConfigId,e[18]=t.mode,e[19]=h,e[20]=m):m=e[20];let p;e[21]!==m||e[22]!==f?(p=o.jsx(Us,{fallback:f,children:m}),e[21]=m,e[22]=f,e[23]=p):p=e[23];let g;e[24]!==p||e[25]!==d?(g=o.jsxs(Ut,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[d,p]}),e[24]=p,e[25]=d,e[26]=g):g=e[26];let x;return e[27]!==t.onOpenChange||e[28]!==t.open||e[29]!==g?(x=o.jsx(Ht,{open:n,onOpenChange:i,children:g}),e[27]=t.onOpenChange,e[28]=t.open,e[29]=g,e[30]=x):x=e[30],x}function pre(t){const e=B.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(pn,{size:16}),e[0]=n):n=e[0];let i;return e[1]!==s.message?(i=o.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,o.jsx("span",{className:"text-sm font-medium",children:s.message})]}),e[1]=s.message,e[2]=i):i=e[2],i}function gre(t){const e=B.c(32),{mode:s,lockedConfigId:n,onSelect:i}=t,r=K8();if(r.length===0){let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(vre,{}),e[0]=p):p=e[0],p}if(n){let p;if(e[1]!==r||e[2]!==n){let x;e[4]!==n?(x=b=>b.id===n,e[4]=n,e[5]=x):x=e[5],p=r.find(x),e[1]=r,e[2]=n,e[3]=p}else p=e[3];const g=p;if(g){let x;return e[6]!==g||e[7]!==s||e[8]!==i?(x=o.jsx(nm,{config:g,mode:s,onSelect:i}),e[6]=g,e[7]=s,e[8]=i,e[9]=x):x=e[9],x}}if(r.length===1){const p=r[0];let g;return e[10]!==p||e[11]!==s||e[12]!==i?(g=o.jsx(nm,{config:p,mode:s,onSelect:i}),e[10]=p,e[11]=s,e[12]=i,e[13]=g):g=e[13],g}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=typeof window<"u"?window.localStorage.getItem(o1):null,e[14]=l):l=e[14];const a=l;let c;e[15]!==r?(c=r.find(p=>p.id===a)?.id??r[0].id,e[15]=r,e[16]=c):c=e[16];const d=c;let f;e[17]!==r?(f=r.map(xre),e[17]=r,e[18]=f):f=e[18];let u;e[19]!==f?(u=o.jsx(r0,{className:"self-start",children:f}),e[19]=f,e[20]=u):u=e[20];let h;if(e[21]!==r||e[22]!==s||e[23]!==i){let p;e[25]!==s||e[26]!==i?(p=g=>o.jsx(Ol,{value:g.id,className:"min-h-0 flex-1 overflow-hidden flex flex-col",children:o.jsx(nm,{config:g,mode:s,onSelect:i})},g.id),e[25]=s,e[26]=i,e[27]=p):p=e[27],h=r.map(p),e[21]=r,e[22]=s,e[23]=i,e[24]=h}else h=e[24];let m;return e[28]!==d||e[29]!==u||e[30]!==h?(m=o.jsxs(ad,{defaultValue:d,onValueChange:bre,className:"min-h-0 flex-1 flex flex-col",children:[u,h]}),e[28]=d,e[29]=u,e[30]=h,e[31]=m):m=e[31],m}function xre(t){return o.jsx(ar,{value:t.id,children:t.name},t.id)}function bre(t){typeof window<"u"&&window.localStorage.setItem(o1,t)}function vre(){const t=B.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:o.jsx(Gn,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noBucketConfigured"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"font-medium text-sm",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("filePicker.filePickerDialog.noBucketDescription"),t[5]=e,t[6]=r):r=t[6];let l;t[7]!==r?(l=o.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=o.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[s,o.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function nm({config:t,mode:e,onSelect:s}){const n=re(),[i,r]=P.useState(""),l=j9(i,300),a=cj({configId:t.id,search:l,imageOnly:e==="image"}),c=r1(),[d,f]=P.useState(!1),u=P.useRef(null),h=e==="image"?"image/*":void 0;async function m(S){if(!S)return;const k=Array.from(S);if(k.length===0)return;let j=null;const C=[];for(const T of k)try{const N=await c.mutateAsync({configId:t.id,file:T});j??=N.publicUrl}catch(N){C.push(`${T.name} (${N instanceof Error?N.message:"upload failed"})`)}await a.refetch(),C.length>0&&xe.error(C.length===k.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:C.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:C.join("; ")})),j&&s(j)}function p(S){S.preventDefault(),f(!0)}function g(){f(!1)}function x(S){S.preventDefault(),S.stopPropagation(),f(!1),m(S.dataTransfer.files)}const y=(a.data?.pages??[]).flatMap(S=>S.items),L=y.filter(S=>e==="image"?Cx(S.key):!0),v=l.trim(),_=y.length>0||i.trim().length>0,w=i!==l||a.isFetching&&!a.isFetchingNextPage;return o.jsxs("div",{className:"flex flex-col gap-3 min-h-0 flex-1",children:[o.jsxs("button",{type:"button",onClick:()=>u.current?.click(),onDragOver:p,onDragLeave:g,onDrop:x,className:ie("rounded-xl border border-dashed border-border/60 p-6 flex flex-col items-center justify-center gap-2 text-center transition-colors",d&&"border-primary bg-primary/5",c.isPending&&"opacity-60 pointer-events-none"),children:[o.jsx(Gn,{size:18,className:"text-muted-foreground"}),o.jsx("p",{className:"text-sm font-medium",children:c.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick")}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("filePicker.filePickerDialog.uploadSizeLimit")," ",n(e==="image"?"filePicker.filePickerDialog.imagesOnlyTypes":"filePicker.filePickerDialog.commonMediaTypes")]}),o.jsx("input",{ref:u,type:"file",accept:h,multiple:!0,className:"hidden",onChange:S=>{const k=Array.from(S.target.files??[]);S.target.value="",m(k)}})]}),_?o.jsx(L9,{value:i,onChange:r,isSearching:w,placeholder:n(e==="image"?"filePicker.filePickerDialog.searchImagesPlaceholder":"filePicker.filePickerDialog.searchFilesPlaceholder"),className:"shrink-0"}):null,o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[L.length===0?v?o.jsx(Lre,{query:v}):e==="image"&&y.length>0?o.jsx(_re,{}):o.jsx(yre,{}):e==="image"?o.jsx(wre,{items:L,onSelect:s}):o.jsx(Sre,{items:L,onSelect:s}),a.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(ue,{type:"button",variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>a.fetchNextPage(),children:a.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(ot,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})})]})]})}function yre(){const t=B.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(fr,{size:18,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noFilesYet"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("filePicker.filePickerDialog.dropFileToGetStarted"),t[5]=e,t[6]=r):r=t[6];let l;t[7]!==r?(l=o.jsx("p",{className:"text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[s,i,l]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function _re(){const t=B.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(fr,{size:18,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noImagesYet"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("filePicker.filePickerDialog.noImagesFormatDesc"),t[5]=e,t[6]=r):r=t[6];let l;t[7]!==r?(l=o.jsx("p",{className:"text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[s,i,l]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function Lre(t){const e=B.c(13),{query:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(fr,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let r;e[1]!==s||e[2]!==n?(r=n("filePicker.filePickerDialog.noMatches",{query:s}),e[1]=s,e[2]=n,e[3]=r):r=e[3];let l;e[4]!==r?(l=o.jsx("p",{className:"text-sm font-medium",children:r}),e[4]=r,e[5]=l):l=e[5];let a;e[6]!==n?(a=n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx("p",{className:"text-xs text-muted-foreground",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function wre(t){const e=B.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>o.jsx(hj,{item:a,variant:"image",onSelect:n},a.key),e[3]=n,e[4]=l):l=e[4],i=s.map(l),e[0]=s,e[1]=n,e[2]=i}else i=e[2];let r;return e[5]!==i?(r=o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:i}),e[5]=i,e[6]=r):r=e[6],r}function Sre(t){const e=B.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>o.jsx("li",{children:o.jsx(hj,{item:a,variant:"row",onSelect:n})},a.key),e[3]=n,e[4]=l):l=e[4],i=s.map(l),e[0]=s,e[1]=n,e[2]=i}else i=e[2];let r;return e[5]!==i?(r=o.jsx("ul",{className:"divide-y divide-border/60 rounded-lg border border-border/60",children:i}),e[5]=i,e[6]=r):r=e[6],r}function hj(t){const e=B.c(58),{item:s,variant:n,onSelect:i}=t;let r;e[0]!==s.key?(r=dj(s.key),e[0]=s.key,e[1]=r):r=e[1];const l=r;if(n==="image"){let L;e[2]!==s.publicUrl||e[3]!==i?(L=()=>i(s.publicUrl),e[2]=s.publicUrl,e[3]=i,e[4]=L):L=e[4];let v;e[5]!==s.key||e[6]!==s.publicUrl?(v=o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"h-full w-full object-cover",onError:kre}),e[5]=s.key,e[6]=s.publicUrl,e[7]=v):v=e[7];let _;e[8]!==s.key||e[9]!==L||e[10]!==v?(_=o.jsx("button",{type:"button",onClick:L,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:s.key,children:v}),e[8]=s.key,e[9]=L,e[10]=v,e[11]=_):_=e[11];let w;e[12]!==l?(w=o.jsx("span",{className:"pointer-events-none absolute left-1.5 top-1.5 rounded bg-background/80 px-1.5 py-0.5 text-[10px] font-medium uppercase text-foreground opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100",children:l}),e[12]=l,e[13]=w):w=e[13];let S;e[14]!==s||e[15]!==i?(S=o.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx(mv,{item:s,onSelect:i})}),e[14]=s,e[15]=i,e[16]=S):S=e[16];let k;e[17]!==s.key?(k=Rh(s.key),e[17]=s.key,e[18]=k):k=e[18];let j;e[19]!==k?(j=o.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent p-2 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx("p",{className:"truncate text-xs text-white",children:k})}),e[19]=k,e[20]=j):j=e[20];let C;return e[21]!==_||e[22]!==w||e[23]!==S||e[24]!==j?(C=o.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[_,w,S,j]}),e[21]=_,e[22]=w,e[23]=S,e[24]=j,e[25]=C):C=e[25],C}let a;e[26]!==s.publicUrl||e[27]!==i?(a=()=>i(s.publicUrl),e[26]=s.publicUrl,e[27]=i,e[28]=a):a=e[28];let c;e[29]!==s.key?(c=o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:Cx(s.key)?o.jsx(fr,{size:16,className:"text-muted-foreground"}):o.jsx(Qr,{size:16,className:"text-muted-foreground"})}),e[29]=s.key,e[30]=c):c=e[30];let d;e[31]!==s.key?(d=Rh(s.key),e[31]=s.key,e[32]=d):d=e[32];let f;e[33]!==d?(f=o.jsx("p",{className:"truncate text-sm font-medium",children:d}),e[33]=d,e[34]=f):f=e[34];let u;e[35]!==s.key?(u=o.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:s.key}),e[35]=s.key,e[36]=u):u=e[36];let h;e[37]!==f||e[38]!==u?(h=o.jsxs("div",{className:"min-w-0 flex-1",children:[f,u]}),e[37]=f,e[38]=u,e[39]=h):h=e[39];let m;e[40]!==l?(m=o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:l}),e[40]=l,e[41]=m):m=e[41];let p;e[42]!==s.size?(p=uj(s.size),e[42]=s.size,e[43]=p):p=e[43];let g;e[44]!==p?(g=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:p}),e[44]=p,e[45]=g):g=e[45];let x;e[46]!==g||e[47]!==a||e[48]!==c||e[49]!==h||e[50]!==m?(x=o.jsxs("button",{type:"button",onClick:a,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[c,h,m,g]}),e[46]=g,e[47]=a,e[48]=c,e[49]=h,e[50]=m,e[51]=x):x=e[51];let b;e[52]!==s||e[53]!==i?(b=o.jsx(mv,{item:s,onSelect:i}),e[52]=s,e[53]=i,e[54]=b):b=e[54];let y;return e[55]!==x||e[56]!==b?(y=o.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2 transition hover:bg-muted/50",children:[x,b]}),e[55]=x,e[56]=b,e[57]=y):y=e[57],y}function kre(t){t.target.style.display="none"}function mv(t){const e=B.c(39),{item:s,onSelect:n}=t,i=re(),[r,l]=P.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(C){C.preventDefault(),C.stopPropagation();try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{xe.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Rg,{size:14}),e[5]=f):f=e[5];let u;e[6]!==d?(u=o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:Nre,"aria-label":d,children:f})}),e[6]=d,e[7]=u):u=e[7];let h;e[8]!==s.publicUrl||e[9]!==n?(h=()=>n(s.publicUrl),e[8]=s.publicUrl,e[9]=n,e[10]=h):h=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Ft,{size:14}),e[11]=m):m=e[11];let p;e[12]!==i?(p=i("filePicker.filePickerDialog.useThis"),e[12]=i,e[13]=p):p=e[13];let g;e[14]!==h||e[15]!==p?(g=o.jsxs(Xe,{onClick:h,children:[m,p]}),e[14]=h,e[15]=p,e[16]=g):g=e[16];let x;e[17]!==r?(x=r?o.jsx(Ft,{size:14}):o.jsx(an,{size:14}),e[17]=r,e[18]=x):x=e[18];let b;e[19]!==r||e[20]!==i?(b=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[19]=r,e[20]=i,e[21]=b):b=e[21];let y;e[22]!==c||e[23]!==b||e[24]!==x?(y=o.jsxs(Xe,{onClick:c,children:[x,b]}),e[22]=c,e[23]=b,e[24]=x,e[25]=y):y=e[25];const L=s.publicUrl;let v;e[26]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(hn,{size:14}),e[26]=v):v=e[26];let _;e[27]!==i?(_=i("filePicker.filePickerDialog.openInNewTab"),e[27]=i,e[28]=_):_=e[28];let w;e[29]!==s.publicUrl||e[30]!==_?(w=o.jsx(Xe,{asChild:!0,children:o.jsxs("a",{href:L,target:"_blank",rel:"noreferrer",onClick:jre,children:[v,_]})}),e[29]=s.publicUrl,e[30]=_,e[31]=w):w=e[31];let S;e[32]!==y||e[33]!==w||e[34]!==g?(S=o.jsxs(zt,{align:"end",onClick:Cre,children:[g,y,w]}),e[32]=y,e[33]=w,e[34]=g,e[35]=S):S=e[35];let k;return e[36]!==S||e[37]!==u?(k=o.jsxs($t,{children:[u,S]}),e[36]=S,e[37]=u,e[38]=k):k=e[38],k}function jre(t){return t.stopPropagation()}function Cre(t){return t.stopPropagation()}function Nre(t){return t.stopPropagation()}function mj(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:o.jsxs("span",{className:"flex items-center gap-1.5 rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:[o.jsx(Gn,{size:14}),"Click to replace"]})}),t[0]=e):e=t[0],e}function pj(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function gj(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}const Tre=["low","medium","high","original"];function xj(t){return t==="low"||t==="medium"||t==="high"||t==="original"}function bj(t,e){try{return new URL(t).searchParams.get(e)}catch{const s=Vre(t);for(const n of s){const i=n.indexOf("=");if((i>=0?n.slice(0,i):n)===e)return i>=0?n.slice(i+1):""}return null}}function vj(t,e,s){const n=t.indexOf("#"),i=n>=0?t.slice(n):"",r=n>=0?t.slice(0,n):t,l=r.indexOf("?"),a=l>=0?r.slice(0,l):r,c=(l>=0?r.slice(l+1).split("&"):[]).filter(Boolean).filter(d=>{const f=d.indexOf("=");return(f>=0?d.slice(0,f):d)!==e});return s!==void 0&&c.push(`${e}=${s}`),`${a}${c.length?`?${c.join("&")}`:""}${i}`}function Vre(t){const e=t.indexOf("#"),s=e>=0?t.slice(0,e):t,n=s.indexOf("?");return n<0?[]:s.slice(n+1).split("&").filter(Boolean)}function Are(t){if(!t)return;const e=bj(t,"quality");return xj(e)?e:void 0}function Pre(t,e){return vj(t,"quality",e)}function Ere(t){return t?bj(t,"muted")!=="false":!0}function Rre(t,e){return vj(t,"muted",e?void 0:"false")}function yj(t){const e=B.c(36),{value:s,onChange:n,showMuted:i}=t,r=i===void 0?!1:i,l=re(),a=P.useId();let c;e[0]!==s?(c=Are(s),e[0]=s,e[1]=c):c=e[1];const d=c;let f;e[2]!==s?(f=Ere(s),e[2]=s,e[3]=f):f=e[3];const u=f;let h;e[4]!==l?(h=l("sectionsEditor.mediaTransformControls.mediaOptionsLabel"),e[4]=l,e[5]=h):h=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Rg,{size:14}),e[6]=m):m=e[6];let p;e[7]!==h?(p=o.jsx(ns,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"outline",size:"sm",className:"h-9 shrink-0","aria-label":h,children:m})}),e[7]=h,e[8]=p):p=e[8];let g;e[9]!==l?(g=l("sectionsEditor.mediaTransformControls.qualityLabel"),e[9]=l,e[10]=g):g=e[10];let x;e[11]!==g?(x=o.jsx(Mt,{className:"text-xs text-muted-foreground",children:g}),e[11]=g,e[12]=x):x=e[12];const b=d??"";let y;e[13]!==n||e[14]!==s?(y=j=>n(Pre(s,xj(j)?j:void 0)),e[13]=n,e[14]=s,e[15]=y):y=e[15];let L;e[16]===Symbol.for("react.memo_cache_sentinel")?(L=Tre.map(Dre),e[16]=L):L=e[16];let v;e[17]!==y||e[18]!==b?(v=o.jsx(p9,{type:"single",variant:"outline",size:"sm",value:b,onValueChange:y,children:L}),e[17]=y,e[18]=b,e[19]=v):v=e[19];let _;e[20]!==v||e[21]!==x?(_=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[x,v]}),e[20]=v,e[21]=x,e[22]=_):_=e[22];let w;e[23]!==u||e[24]!==a||e[25]!==n||e[26]!==r||e[27]!==l||e[28]!==s?(w=r&&o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx(Mt,{htmlFor:a,className:"text-xs text-muted-foreground",children:l("sectionsEditor.mediaTransformControls.mutedLabel")}),o.jsx(hr,{id:a,checked:u,onCheckedChange:j=>n(Rre(s,j))})]}),e[23]=u,e[24]=a,e[25]=n,e[26]=r,e[27]=l,e[28]=s,e[29]=w):w=e[29];let S;e[30]!==_||e[31]!==w?(S=o.jsx(is,{align:"end",className:"w-auto min-w-52 p-3",children:o.jsxs("div",{className:"flex flex-col gap-3",children:[_,w]})}),e[30]=_,e[31]=w,e[32]=S):S=e[32];let k;return e[33]!==S||e[34]!==p?(k=o.jsxs(rs,{children:[p,S]}),e[33]=S,e[34]=p,e[35]=k):k=e[35],k}function Dre(t){return o.jsx(Kc,{value:t,className:"h-8 px-3 text-xs capitalize",children:t},t)}function _j(t,e,s){return e||(t.length===1?t[0].id:t.length===0?null:t.some(n=>n.id===s)?s:null)}function pv(t){const e=B.c(2),{ext:s}=t;if(!s)return null;let n;return e[0]!==s?(n=o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Ire(t){const e=B.c(81),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=re(),d=s.format==="video-uri",f=wx(n),[u,h]=P.useState(!1),[m,p]=P.useState(!1),g=f?pj(f):"",x=g?gj(g):"",b=Sg(),y=r1();let L;e[0]!==b.data?.configs?(L=b.data?.configs??[],e[0]=b.data?.configs,e[1]=L):L=e[1];const v=a?.siteSlug;let _;e[2]!==L||e[3]!==v?(_=D9(L,v),e[2]=L,e[3]=v,e[4]=_):_=e[4];const w=_;let S;e[5]!==b.data?.configs||e[6]!==d||e[7]!==w?.id||e[8]!==i||e[9]!==h||e[10]!==c||e[11]!==y?(S=async function(Q){if(!Q)return;let K=Array.from(Q);if(K.length===0)return;if(d&&(K=K.filter(Mre),K.length===0)){xe.error(c("sectionsEditor.fileField.videoFileError"));return}const X=_j(b.data?.configs??[],w?.id,typeof window<"u"?window.localStorage.getItem(o1):null);if(!X){h(!0);return}try{const Z=await y.mutateAsync({configId:X,file:K[0]});i(Z.publicUrl),K.length>1&&xe.info(c("sectionsEditor.fileField.multiFileWarning",{fileName:K[0].name}))}catch(Z){const le=Z;xe.error(le instanceof Error?le.message:c("sectionsEditor.fileField.uploadFailed"))}},e[5]=b.data?.configs,e[6]=d,e[7]=w?.id,e[8]=i,e[9]=h,e[10]=c,e[11]=y,e[12]=S):S=e[12];const k=S;let j;e[13]!==p?(j=function(Q){Q.preventDefault(),Q.dataTransfer.types.includes("Files")&&p(!0)},e[13]=p,e[14]=j):j=e[14];const C=j;let T;e[15]!==p?(T=function(Q){Q.currentTarget===Q.target&&p(!1)},e[15]=p,e[16]=T):T=e[16];const N=T;let V;e[17]!==k||e[18]!==p?(V=function(Q){Q.preventDefault(),Q.stopPropagation(),p(!1),k(Q.dataTransfer.files)},e[17]=k,e[18]=p,e[19]=V):V=e[19];const A=V,E=a?.virtualMcpId;let R;e[20]!==l||e[21]!==r||e[22]!==s.description||e[23]!==E?(R=o.jsx("div",{className:"min-w-0",children:o.jsx(Hs,{htmlFor:r,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:E})}),e[20]=l,e[21]=r,e[22]=s.description,e[23]=E,e[24]=R):R=e[24];const I=m&&"border-primary ring-2 ring-primary/30",D=y.isPending&&"pointer-events-none opacity-60";let O;e[25]!==I||e[26]!==D?(O=ie("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",I,D),e[25]=I,e[26]=D,e[27]=O):O=e[27];let z;e[28]!==x||e[29]!==g||e[30]!==d||e[31]!==h||e[32]!==f||e[33]!==c||e[34]!==y.isPending?(z=f?d?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>h(!0),"aria-label":c("sectionsEditor.fileField.replaceVideoLabel"),className:"relative block h-40 w-full cursor-pointer overflow-hidden bg-black",children:[o.jsx("video",{src:f,preload:"metadata",className:"h-full w-full object-contain"},f),o.jsx(mj,{})]}),o.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[o.jsx(u4,{size:14,className:"shrink-0 text-muted-foreground"}),o.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:g}),o.jsx(pv,{ext:x})]})]}):o.jsxs("button",{type:"button",onClick:()=>h(!0),"aria-label":c("sectionsEditor.fileField.replaceFileLabel"),className:"flex w-full cursor-pointer items-center gap-3 px-3 py-2.5 text-left hover:bg-muted/60",children:[o.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:o.jsx(Qr,{size:18,className:"text-muted-foreground"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate text-sm font-medium",children:g}),o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:f})]}),o.jsx(pv,{ext:x})]}):o.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[d?o.jsx(u4,{size:20}):o.jsx(Qr,{size:20}),o.jsx("span",{className:"text-sm font-medium",children:y.isPending?c("sectionsEditor.fileField.uploading"):c(d?"sectionsEditor.fileField.dropVideoHint":"sectionsEditor.fileField.dropFileHint")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.fileField.sizeLimit")})]}),e[28]=x,e[29]=g,e[30]=d,e[31]=h,e[32]=f,e[33]=c,e[34]=y.isPending,e[35]=z):z=e[35];let M;e[36]!==m||e[37]!==c?(M=m&&o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:o.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:c("sectionsEditor.fileField.dropToUpload")})}),e[36]=m,e[37]=c,e[38]=M):M=e[38];let $;e[39]!==N||e[40]!==C||e[41]!==A||e[42]!==O||e[43]!==z||e[44]!==M?($=o.jsxs("div",{onDragOver:C,onDragLeave:N,onDrop:A,className:O,children:[z,M]}),e[39]=N,e[40]=C,e[41]=A,e[42]=O,e[43]=z,e[44]=M,e[45]=$):$=e[45];let F;e[46]!==i?(F=ne=>i(ne.target.value),e[46]=i,e[47]=F):F=e[47];let U;e[48]!==r||e[49]!==f||e[50]!==F?(U=o.jsx(mt,{id:r,type:"url",value:f,onChange:F,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[48]=r,e[49]=f,e[50]=F,e[51]=U):U=e[51];let H;e[52]!==h||e[53]!==f||e[54]!==c?(H=!f&&o.jsxs(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>h(!0),className:"h-9 shrink-0",children:[o.jsx(Gn,{size:14}),c("sectionsEditor.fileField.browseButton")]}),e[52]=h,e[53]=f,e[54]=c,e[55]=H):H=e[55];let q;e[56]!==d||e[57]!==i||e[58]!==f?(q=d&&f&&o.jsx(yj,{value:f,onChange:i,showMuted:!0}),e[56]=d,e[57]=i,e[58]=f,e[59]=q):q=e[59];let W;e[60]!==i||e[61]!==f||e[62]!==c?(W=f&&o.jsx(ue,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.fileField.removeFileLabel"),children:o.jsx(tn,{size:14})}),e[60]=i,e[61]=f,e[62]=c,e[63]=W):W=e[63];let G;e[64]!==U||e[65]!==H||e[66]!==q||e[67]!==W?(G=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[U,H,q,W]}),e[64]=U,e[65]=H,e[66]=q,e[67]=W,e[68]=G):G=e[68];let Y;e[69]!==i?(Y=ne=>i(ne),e[69]=i,e[70]=Y):Y=e[70];const J=w?.id??null;let se;e[71]!==u||e[72]!==h||e[73]!==Y||e[74]!==J?(se=o.jsx(fj,{open:u,onOpenChange:h,mode:"any",onSelect:Y,lockedConfigId:J}),e[71]=u,e[72]=h,e[73]=Y,e[74]=J,e[75]=se):se=e[75];let oe;return e[76]!==$||e[77]!==G||e[78]!==se||e[79]!==R?(oe=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[R,$,G,se]}),e[76]=$,e[77]=G,e[78]=se,e[79]=R,e[80]=oe):oe=e[80],oe}function Mre(t){return t.type.startsWith("video/")}const Ore=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function $re(t){const e=B.c(86),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=re(),d=wx(n),[f,u]=P.useState(!1),[h,m]=P.useState(!1),[p,g]=P.useState(!1),[x,b]=P.useState(!1),y=d?pj(d):"",L=y?gj(y):"",v=Sg(),_=r1();let w;e[0]!==v.data?.configs?(w=v.data?.configs??[],e[0]=v.data?.configs,e[1]=w):w=e[1];const S=a?.siteSlug;let k;e[2]!==w||e[3]!==S?(k=D9(w,S),e[2]=w,e[3]=S,e[4]=k):k=e[4];const j=k;let C;e[5]!==i||e[6]!==b||e[7]!==g?(C=function(ee){g(!1),b(!1),i(ee)},e[5]=i,e[6]=b,e[7]=g,e[8]=C):C=e[8];const T=C;let N;e[9]!==v.data?.configs||e[10]!==j?.id||e[11]!==u||e[12]!==T||e[13]!==c||e[14]!==_?(N=async function(ee){if(!ee)return;const ae=Array.from(ee).filter(Bre);if(ae.length===0){xe.error(c("sectionsEditor.imageField.onlyImageFilesAccepted"));return}const ce=_j(v.data?.configs??[],j?.id,typeof window<"u"?window.localStorage.getItem(o1):null);if(!ce){u(!0);return}try{const fe=await _.mutateAsync({configId:ce,file:ae[0]});T(fe.publicUrl),ae.length>1&&xe.info(c("sectionsEditor.imageField.uploadedWithExtraFilesIgnored",{fileName:ae[0].name}))}catch(fe){const de=fe;xe.error(de instanceof Error?de.message:c("sectionsEditor.imageField.uploadFailed"))}},e[9]=v.data?.configs,e[10]=j?.id,e[11]=u,e[12]=T,e[13]=c,e[14]=_,e[15]=N):N=e[15];const V=N;let A;e[16]!==m?(A=function(ee){ee.preventDefault(),ee.dataTransfer.types.includes("Files")&&m(!0)},e[16]=m,e[17]=A):A=e[17];const E=A;let R;e[18]!==m?(R=function(ee){ee.currentTarget===ee.target&&m(!1)},e[18]=m,e[19]=R):R=e[19];const I=R;let D;e[20]!==V||e[21]!==m?(D=function(ee){ee.preventDefault(),ee.stopPropagation(),m(!1),V(ee.dataTransfer.files)},e[20]=V,e[21]=m,e[22]=D):D=e[22];const O=D,z=a?.virtualMcpId;let M;e[23]!==l||e[24]!==r||e[25]!==s.description||e[26]!==z?(M=o.jsx("div",{className:"min-w-0",children:o.jsx(Hs,{htmlFor:r,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:z})}),e[23]=l,e[24]=r,e[25]=s.description,e[26]=z,e[27]=M):M=e[27];const $=h&&"border-primary ring-2 ring-primary/30",F=_.isPending&&"pointer-events-none opacity-60";let U;e[28]!==$||e[29]!==F?(U=ie("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",$,F),e[28]=$,e[29]=F,e[30]=U):U=e[30];let H;e[31]!==L||e[32]!==y||e[33]!==x||e[34]!==p||e[35]!==l||e[36]!==b||e[37]!==g||e[38]!==u||e[39]!==d||e[40]!==c||e[41]!==_.isPending?(H=d?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>u(!0),"aria-label":c("sectionsEditor.imageField.replaceImage"),className:"relative block h-40 w-full cursor-pointer bg-[image:linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%),linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%)] bg-[position:0_0,8px_8px] [background-size:16px_16px]",children:[!x&&o.jsx("img",{src:d,alt:l,className:ie("h-full w-full object-contain transition-opacity",!p&&"opacity-0"),onLoad:()=>g(!0),onError:()=>b(!0)},d),x&&o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[o.jsx(fr,{size:20}),o.jsx("p",{className:"text-xs",children:c("sectionsEditor.imageField.previewUnavailable")})]}),!p&&!x&&o.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"}),o.jsx(mj,{})]}),o.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:y}),L&&o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:L})]})]}):o.jsxs("button",{type:"button",onClick:()=>u(!0),className:"flex h-40 w-full flex-col items-center justify-center gap-2 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[o.jsx(fr,{size:20}),o.jsx("span",{className:"text-sm font-medium",children:_.isPending?c("sectionsEditor.imageField.uploading"):c("sectionsEditor.imageField.dropImageOrClickToBrowse")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.imageField.supportedFormatsAndSize")})]}),e[31]=L,e[32]=y,e[33]=x,e[34]=p,e[35]=l,e[36]=b,e[37]=g,e[38]=u,e[39]=d,e[40]=c,e[41]=_.isPending,e[42]=H):H=e[42];let q;e[43]!==h||e[44]!==c?(q=h&&o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:o.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:c("sectionsEditor.imageField.dropToUpload")})}),e[43]=h,e[44]=c,e[45]=q):q=e[45];let W;e[46]!==I||e[47]!==E||e[48]!==O||e[49]!==U||e[50]!==H||e[51]!==q?(W=o.jsxs("div",{onDragOver:E,onDragLeave:I,onDrop:O,className:U,children:[H,q]}),e[46]=I,e[47]=E,e[48]=O,e[49]=U,e[50]=H,e[51]=q,e[52]=W):W=e[52];let G;e[53]!==T?(G=le=>T(le.target.value),e[53]=T,e[54]=G):G=e[54];let Y;e[55]!==c?(Y=c("sectionsEditor.imageField.urlPlaceholder"),e[55]=c,e[56]=Y):Y=e[56];let J;e[57]!==r||e[58]!==d||e[59]!==G||e[60]!==Y?(J=o.jsx(mt,{id:r,type:"url",value:d,onChange:G,placeholder:Y,className:"h-9 min-w-0 flex-1"}),e[57]=r,e[58]=d,e[59]=G,e[60]=Y,e[61]=J):J=e[61];let se;e[62]!==u||e[63]!==d||e[64]!==c?(se=!d&&o.jsxs(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>u(!0),className:"h-9 shrink-0",children:[o.jsx(Gn,{size:14}),c("sectionsEditor.imageField.browse")]}),e[62]=u,e[63]=d,e[64]=c,e[65]=se):se=e[65];let oe;e[66]!==T||e[67]!==d||e[68]!==c?(oe=d&&o.jsxs(o.Fragment,{children:[o.jsx(yj,{value:d,onChange:T}),o.jsx(ue,{type:"button",variant:"ghost",size:"sm",onClick:()=>T(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.imageField.removeImage"),children:o.jsx(tn,{size:14})})]}),e[66]=T,e[67]=d,e[68]=c,e[69]=oe):oe=e[69];let ne;e[70]!==J||e[71]!==se||e[72]!==oe?(ne=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[J,se,oe]}),e[70]=J,e[71]=se,e[72]=oe,e[73]=ne):ne=e[73];let Q;e[74]!==T?(Q=le=>T(le),e[74]=T,e[75]=Q):Q=e[75];const K=j?.id??null;let X;e[76]!==f||e[77]!==u||e[78]!==Q||e[79]!==K?(X=o.jsx(fj,{open:f,onOpenChange:u,mode:"image",onSelect:Q,lockedConfigId:K}),e[76]=f,e[77]=u,e[78]=Q,e[79]=K,e[80]=X):X=e[80];let Z;return e[81]!==M||e[82]!==W||e[83]!==ne||e[84]!==X?(Z=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[M,W,ne,X]}),e[81]=M,e[82]=W,e[83]=ne,e[84]=X,e[85]=Z):Z=e[85],Z}function Bre(t){return Ore.has(t.type||"")}const zre="0 0 1080 1080",Fre="matrix(1 0 0 1 540 540)",Nx=[{code:"AC",name:"Acre",gTransform:"matrix(1 0 0 1 -248.53 -95.16)",pathTransform:"translate(-57.47, -224.1)",d:"M 30.47 237.77 L 28.39 237.73 L 28.93 235.92 L 28.72 235.09 L 28.47 234.6 L 27.22 233.9 L 27.08 233.45 L 27.35 232.3 L 26.58 230.35 L 25.49 229.71 L 19.89 228.46 L 12.55 228.27 L 12.82 227.71 L 15.31 225.45 L 16.2 224.22 L 16.49 223.02 L 16.27 221.79 L 15.59 220.88 L 14.76 220.44 L 13.08 217.49 L 12.31 217.05 L 11.41 216.86 L 10.28 215.73 L 9.36 213.35 L 7.36 211.82 L 6.38 208.2 L 5.51 206.56 L 3.63 205.48 L 3.55 204.31 L 4.36 204.41 L 4.78 203.89 L 4.85 203.22 L 4.65 202.8 L 2.53 201.87 L 2.17 201.21 L 0 199.32 L 0.04 198.95 L 0.66 198.9 L 1.16 197.58 L 1.15 196.27 L 4.16 195.88 L 4.66 195.49 L 4.44 194.14 L 3.27 192.57 L 3.27 192.57 L 21.22 200.05 L 44.88 205.71 L 57.02 208.85 L 83.46 223.02 L 111.97 235.15 L 111.97 235.15 L 114.94 236.41 L 114.94 236.41 L 114.64 236.89 L 113.07 237.55 L 110.98 239.14 L 108.12 241.93 L 106.47 242.79 L 105.81 242.61 L 104.28 242.79 L 104.23 243.35 L 102.31 244.65 L 100.23 245.64 L 98.79 247.47 L 98.35 248.65 L 97.74 248.93 L 96.57 248.18 L 95.81 248.05 L 93.44 248.1 L 92.76 248.36 L 92.13 248.81 L 91.77 249.67 L 89.33 253.15 L 85.56 254.4 L 84.72 255.09 L 82.78 255.6 L 81.75 255.63 L 81.83 253.52 L 80.47 253.72 L 76.92 252.95 L 71.68 252.48 L 66.59 252.86 L 65.93 252.28 L 63.66 252.11 L 60.1 253.94 L 57.37 254.56 L 55.69 253.89 L 54.29 252.45 L 52.65 253.61 L 52.69 236.06 L 52.74 234.96 L 53.21 234.25 L 53.28 231.9 L 53.02 231.02 L 53.99 229.84 L 54.47 228.7 L 53.31 228.9 L 50.34 231.49 L 48.74 232.5 L 46.68 234.88 L 44.73 235.55 L 44.08 236.63 L 42.27 237.62 z"},{code:"AL",name:"Alagoas",gTransform:"matrix(1 0 0 1 276.36 -86.82)",pathTransform:"translate(-582.36, -232.44)",d:"M 561.91 230.3 L 561.71 229.57 L 560.29 228.79 L 559.84 228.88 L 558.82 228.59 L 558.28 227.19 L 558.28 227.19 L 559.6 226.12 L 560.24 225.03 L 562.41 224.27 L 564.79 220.98 L 564.88 220.29 L 565.7 219.69 L 566.7 220.91 L 568.37 221.21 L 569.45 221.09 L 572 223.11 L 573.9 225.23 L 575.68 226.28 L 577.59 226.76 L 580.09 226.11 L 583.23 226.4 L 584.4 226.29 L 586.26 225.23 L 587.42 225.28 L 589.23 224.17 L 591.41 221.88 L 591.53 221.43 L 593.08 220.19 L 595.08 219.95 L 597.32 220.8 L 599.88 219.51 L 601.35 219.32 L 603.27 220.13 L 606.17 220.4 L 606.44 220.61 L 606.44 220.61 L 603.66 225.57 L 599.11 230.7 L 595.53 234.28 L 592.49 238.86 L 589.16 241.74 L 588.16 243.77 L 586.84 245.56 L 586.84 245.56 L 586.24 244.25 L 582.65 242.02 L 582.19 241.99 L 580.53 241.2 L 578.77 239.75 L 577.47 237.3 L 572.05 234.23 L 568.37 233.28 z"},{code:"AM",name:"Amazonas",gTransform:"matrix(1 0 0 1 -166.8 -178.05)",pathTransform:"translate(-139.2, -141.22)",d:"M 165.82 47.29 L 166.54 48.07 L 167.29 48.41 L 167.9 48.42 L 169.03 48 L 169.66 48.11 L 169.72 49.07 L 170.93 50.24 L 171.9 50.61 L 172.78 50.4 L 174.14 50.51 L 176.09 51.46 L 176.58 52.12 L 175.67 55.44 L 174.96 56.94 L 177.69 60.68 L 179.35 65.44 L 179.54 67.7 L 180.41 68.82 L 180.46 69.27 L 178.84 70.73 L 179.2 72.32 L 179.86 73.9 L 179.09 76.94 L 178.52 77.9 L 178.81 82.88 L 179.69 85.05 L 180.91 85.89 L 181.49 86.79 L 182.62 91.12 L 182.56 91.7 L 181.42 93.02 L 179.58 92.69 L 179.44 93.83 L 184.45 98.25 L 184.97 98.29 L 186.93 99.6 L 188.41 101.25 L 189.45 103.29 L 189.98 103.36 L 191.32 102.94 L 193.68 103.98 L 193.24 101.87 L 193.99 99.58 L 194.24 97.85 L 193.87 96.05 L 194.69 93.08 L 195.71 91.82 L 196.99 91.13 L 199.08 90.42 L 199.63 89.53 L 201.23 89.47 L 204.06 90.4 L 205.93 92.44 L 206.85 94.95 L 208.67 95.18 L 209.92 94.72 L 211.33 93.31 L 213.36 92.76 L 213.78 92.37 L 213.8 91.84 L 212.66 90.43 L 212.43 89.7 L 212.54 89.04 L 213.69 86.4 L 213.76 85.27 L 215.42 82.24 L 217.75 78.98 L 217.72 78.3 L 236.21 78.37 L 236.21 78.37 L 236.61 83.23 L 236.18 84.68 L 236.36 86.95 L 236.6 87.63 L 238.3 88.48 L 238.48 88.89 L 238.13 89.58 L 238.08 91.69 L 239.91 93.68 L 240.27 93.87 L 240.97 93.69 L 242.81 94.92 L 243.36 96.75 L 243.4 97.68 L 243.7 98.13 L 248.34 101.9 L 252.92 104.44 L 253.55 105.34 L 254.9 106.43 L 256.78 107.1 L 259.15 108.41 L 261.41 109.06 L 262.77 109.21 L 264.09 110.03 L 264.17 110.64 L 265.44 111.98 L 268.14 113.42 L 269.24 115.59 L 271.11 116.38 L 271.96 115.77 L 273.34 115.42 L 273.53 115.9 L 273.4 116.68 L 275.21 118.35 L 245.31 182.59 L 244.53 183.9 L 243.08 185.03 L 242.5 186 L 242.47 187.13 L 243.29 189.46 L 243.67 190.03 L 244.74 190.61 L 246.32 192.17 L 246.96 193.43 L 247.11 195.39 L 247.68 195.96 L 247.68 195.96 L 246.5 197.16 L 246.3 197.77 L 246.24 198.53 L 246.58 199.37 L 246.31 200.38 L 245.11 202.2 L 244.25 202.84 L 243.83 203.69 L 243.93 204.54 L 244.59 205.91 L 245.05 207.85 L 243.67 212.07 L 242.49 217.29 L 241.28 218.02 L 193.43 218.34 L 193.43 218.34 L 193.47 217.64 L 193.11 217.26 L 191.72 216.98 L 189.8 218.06 L 189.26 219.8 L 188.58 219.99 L 185.34 218.51 L 184.66 215.63 L 184.04 215.43 L 183.06 215.56 L 182.6 215.35 L 181.35 212.08 L 178.81 211.1 L 177.48 209.83 L 176.68 207.92 L 176.23 207.43 L 174.08 206.3 L 163.29 206.36 L 161.91 208.92 L 160.19 209.42 L 160.28 210.59 L 160.02 210.81 L 157.54 211.34 L 156.35 212.93 L 156.3 213.6 L 157.2 214.3 L 157.37 214.75 L 157.01 215.77 L 156.2 216.92 L 154.14 218.13 L 154.03 219.94 L 154.27 221.4 L 150.4 220.94 L 148.27 221.32 L 147.07 222.39 L 145.28 222.29 L 144.44 221.74 L 143.98 221.72 L 142.23 222.98 L 141.7 223.82 L 141.96 225.57 L 139.42 228.73 L 138.74 228.81 L 138.06 228.28 L 137.42 226.02 L 137.04 225.93 L 135.2 226.95 L 133.9 228.16 L 132.53 228.55 L 131.76 228.42 L 130.68 228.92 L 130.27 229.45 L 130.14 230.17 L 128.92 230.96 L 128.55 230.98 L 126.24 228.65 L 125.52 228.28 L 122.65 228.61 L 118.69 228.35 L 118.85 229.64 L 118.7 230.2 L 117.15 232.01 L 115.23 232.59 L 111.97 235.15 L 111.97 235.15 L 83.46 223.02 L 57.02 208.85 L 44.88 205.71 L 21.22 200.05 L 3.27 192.57 L 3.27 192.57 L 3.2 191.92 L 3.9 189 L 5.12 187.6 L 10.04 184.13 L 12.3 183.89 L 12.77 183.59 L 13.75 182.03 L 13.83 181 L 12.09 176.51 L 12.47 175.32 L 13.65 173.13 L 14.93 171.81 L 15.85 170.56 L 16.27 169.58 L 16.57 167.84 L 16.28 166.52 L 16.95 164.48 L 17.26 162.17 L 17.99 161.42 L 21.65 159.79 L 23.84 158.56 L 24.99 157.52 L 25.43 156.12 L 26.21 155.75 L 27.62 155.64 L 29.27 154.71 L 32.81 151.98 L 35.23 151.55 L 36.74 151.84 L 40.93 150.62 L 42.43 149.85 L 44.25 149.49 L 47.58 149.87 L 48.88 148.28 L 49.51 146.83 L 50.6 146.22 L 52.74 146.42 L 53.38 146.96 L 54.7 146.72 L 55.8 145.98 L 57.51 146.1 L 57.82 146.63 L 57.8 147.81 L 59.41 149.1 L 62.24 149.18 L 62.82 148.78 L 63.28 148 L 63.17 147.61 L 64.34 142.69 L 71.04 105.52 L 72.2 102.6 L 71.21 97.64 L 71.33 97.38 L 70.03 96.33 L 68.55 93.58 L 68.51 93.09 L 69.16 91.7 L 68.64 89.92 L 68.27 89.52 L 66.57 88.93 L 63.54 86.58 L 61.6 84.3 L 61.8 72.79 L 65.69 72.53 L 67.44 71.36 L 70.94 70.44 L 73.62 72.2 L 74.84 72.31 L 76.11 71.88 L 75.62 70.19 L 75.92 68.47 L 74.55 66.37 L 73.98 65.83 L 72.83 65.23 L 71.32 65.76 L 68.53 65.15 L 64.96 65.24 L 64.9 55.34 L 65.86 55.38 L 67.18 54.8 L 69.46 54.2 L 72.3 55.07 L 91.33 55.13 L 90.87 54.47 L 90.08 54.33 L 89.7 53.13 L 90.65 51.2 L 92.08 51.6 L 92.69 53.12 L 93.56 54.44 L 94.22 54.79 L 95.05 54.8 L 96.66 54.19 L 98.6 52.1 L 98.92 51.26 L 100.18 50.02 L 102.73 48.63 L 104.02 49.09 L 105.19 51.67 L 106.81 53.66 L 107.55 54.96 L 108.21 56.74 L 108.44 58.29 L 107.95 61.92 L 108.15 63.68 L 111.35 62.93 L 119.66 69.99 L 120.45 70.27 L 122.95 70.48 L 125.25 69.48 L 126.95 67.78 L 129.06 66.62 L 131.25 66.51 L 131.81 66.8 L 132.58 67.88 L 132.56 68.85 L 131.45 70.55 L 131.82 71.53 L 132.4 71.8 L 133.73 71.08 L 134.29 70.17 L 134.52 68.88 L 135.52 67.72 L 135.99 67.49 L 136.99 67.67 L 137.54 67.49 L 137.95 66.83 L 138.41 64.52 L 138.92 64.15 L 140.43 63.79 L 143.36 62.02 L 144.33 62.57 L 145.26 62.28 L 146.86 61.24 L 147.88 59.63 L 149.99 58.42 L 152.02 58.97 L 154.38 57.32 L 154.93 56.5 L 155.37 53.84 L 155.34 52.55 L 156.11 51.63 L 157.14 51.21 L 158.88 51.19 L 160.22 50.8 L 162.28 49.2 L 163.24 48.83 L 165.52 48.53 z"},{code:"AP",name:"Amapá",gTransform:"matrix(1 0 0 1 32.29 -262.31)",pathTransform:"translate(-338.29, -56.97)",d:"M 344.98 99.7 L 344.04 99.64 L 343.27000000000004 99.98 L 341.97 100.10000000000001 L 339.18 99.42 L 337.73 98.39 L 337.3 96.89 L 335.43 95.5 L 335.32 94.2 L 335.53 93.51 L 335.21999999999997 91.93 L 334.89 91.46000000000001 L 333.94 91.27000000000001 L 333.53 90.33000000000001 L 333.60999999999996 87.9 L 330.67999999999995 84.62 L 329.9 84.98 L 329.08 84.79 L 327.58 81.31 L 327.71 79.73 L 327.12 77.92 L 326.5 77.36 L 325.83 75.85 L 325.64 73.74 L 326.07 70.6 L 325.9 70.27 L 323.33 69.53999999999999 L 321.31 67.27999999999999 L 320.55 64.44999999999999 L 320.74 63.72999999999999 L 321.42 63.49999999999999 L 320.93 62.31999999999999 L 320.25 62.349999999999994 L 317.41 59.69 L 316.47 59.83 L 316.09000000000003 60.25 L 314.76000000000005 60.39 L 313.9200000000001 60.12 L 313.12000000000006 59.14 L 311.9800000000001 58.3 L 310.7900000000001 58.18 L 310.30000000000007 56.9 L 309.63000000000005 56.1 L 307.70000000000005 55.050000000000004 L 306.41 54.56 L 303.02000000000004 54.190000000000005 L 301.94000000000005 54.480000000000004 L 300.77000000000004 54.46 L 300.46000000000004 53.92 L 300.22 52.480000000000004 L 300.47 47.940000000000005 L 301.09000000000003 46.64000000000001 L 300.72 44.34000000000001 L 300.1 43.77000000000001 L 300.1 43.77000000000001 L 300.45000000000005 43.56000000000001 L 301.44000000000005 43.86000000000001 L 301.43000000000006 44.67000000000001 L 301.14000000000004 44.85000000000001 L 301.48 45.82000000000001 L 302.95000000000005 45.760000000000005 L 303.77000000000004 45.99 L 304.12000000000006 46.89 L 304.96000000000004 47.6 L 307.21000000000004 48.38 L 310.50000000000006 49.13 L 313.26000000000005 47.35 L 313.61000000000007 46.59 L 315.3400000000001 45.42 L 316.1700000000001 45.13 L 316.86000000000007 46.07 L 319.57000000000005 47.01 L 320.65000000000003 46.89 L 322.37000000000006 45.88 L 322.49000000000007 45.46 L 322.81000000000006 45.49 L 324.27000000000004 46.79 L 324.07000000000005 47.66 L 326.44000000000005 47.489999999999995 L 326.95000000000005 47.989999999999995 L 327.90000000000003 48.16 L 328.52000000000004 48.15 L 329.43000000000006 47.67 L 331.1000000000001 46.17 L 332.88000000000005 45.07 L 334.63000000000005 42.77 L 335.00000000000006 41.77 L 334.80000000000007 41.230000000000004 L 337.93000000000006 34.730000000000004 L 338.0400000000001 32.910000000000004 L 339.1500000000001 31.610000000000003 L 339.8800000000001 31.42 L 343.48000000000013 25.630000000000003 L 343.71000000000015 24.480000000000004 L 344.5500000000001 23.280000000000005 L 346.34000000000015 21.730000000000004 L 346.97000000000014 20.070000000000004 L 349.08000000000015 18.930000000000003 L 349.5500000000002 18.01 L 350.5900000000002 17.430000000000003 L 351.1500000000002 18.890000000000004 L 352.0300000000002 20.250000000000004 L 350.3600000000002 15.450000000000003 L 350.2900000000002 14.160000000000004 L 350.4700000000002 13.830000000000004 L 353.8400000000002 16.250000000000004 L 354.9800000000002 17.460000000000004 L 355.8900000000002 18.680000000000003 L 356.4100000000002 19.870000000000005 L 356.44000000000017 21.450000000000003 L 356.88000000000017 21.76 L 357.20000000000016 21.28 L 357.58000000000015 21.18 L 357.79000000000013 21.58 L 358.0000000000001 29.47 L 358.66000000000014 33.339999999999996 L 361.3700000000001 39.38999999999999 L 364.03000000000014 48.32999999999999 L 367.35000000000014 53.32999999999999 L 368.3600000000001 53.67999999999999 L 371.6300000000001 53.599999999999994 L 374.4100000000001 54.53999999999999 L 375.7000000000001 55.38999999999999 L 376.4700000000001 58.03999999999999 L 376.31000000000006 61.36999999999999 L 375.02000000000004 62.32999999999999 L 373.29 62.75999999999999 L 372.91 63.08999999999999 L 374.70000000000005 62.93999999999999 L 375.74000000000007 62.51999999999999 L 376.02000000000004 62.749999999999986 L 376.14000000000004 63.33999999999999 L 375.97 64.07 L 370.94000000000005 68.13 L 369.77000000000004 70.22999999999999 L 367.62000000000006 71.63999999999999 L 365.68000000000006 75.35999999999999 L 362.77000000000004 78.85999999999999 L 362.07000000000005 79.31999999999998 L 361.13000000000005 79.22999999999998 L 359.68000000000006 79.74999999999997 L 357.6000000000001 82.72999999999998 L 357.6000000000001 82.72999999999998 L 356.2600000000001 82.79999999999997 L 355.5100000000001 83.69999999999997 L 355.5100000000001 83.69999999999997 L 354.0400000000001 85.37999999999998 L 353.07000000000005 87.59999999999998 L 351.95000000000005 89.46999999999998 L 351.11000000000007 90.11999999999999 L 348.1000000000001 93.57 L 347.74000000000007 95.97 L 347.9100000000001 97.77 L 345.9600000000001 99.58 L 344.98 99.7 z M 368.34 52.71 L 367.89 52.38 L 366.78999999999996 50.52 L 366.85999999999996 49.64 L 367.09 49.230000000000004 L 368.75 48.78 L 369.18 49.17 L 370.01 51.440000000000005 L 369.02 52.540000000000006 L 368.34 52.71 z M 370.83 70.32 L 370.43 70.07 L 370.35 69.36 L 371.46000000000004 68.26 L 372.34000000000003 68.11 L 373.59000000000003 68.35 L 374.05 68.24 L 374.49 67.6 L 374.54 68.19 L 373.57 69.63 L 372.58 70.13 L 370.83 70.32 z M 374.27 67.45 L 373.49 67.22 L 373.49 66.66 L 374.21000000000004 65.61999999999999 L 375.46000000000004 65.52 L 375.64000000000004 65.86999999999999 L 375.54 66.38 L 374.27 67.45 z M 367.08 49.03 L 366.32 48.53 L 366.58 47.7 L 367.46 47.53 L 368.32 47.85 L 368.33 48.58 L 367.08 49.03 z"},{code:"BA",name:"Bahia",gTransform:"matrix(1 0 0 1 193.52 -26.39)",pathTransform:"translate(-499.52, -292.87)",d:"M 527.5 365.33 L 527.14 364.5 L 527.8199999999999 363.15 L 527.81 362.62 L 527.28 361.58 L 523.15 358.53 L 523 358.02 L 523.22 356.51 L 522.65 355.28 L 522 355.52 L 521.8 355.96999999999997 L 521.4599999999999 356.15 L 521.2399999999999 355.9 L 521.7699999999999 351.5 L 522.5899999999999 348.2 L 523.41 347.32 L 525.88 347.56 L 526.9 346.85 L 526.9 346.43 L 526.34 345.41 L 526.5 342.76000000000005 L 531.46 338.54 L 532.9300000000001 335.46000000000004 L 532.5100000000001 334.29 L 531.7300000000001 333.27000000000004 L 530.8400000000001 333.21000000000004 L 530.1100000000001 332.83000000000004 L 527.2800000000001 330.36 L 525.1600000000001 330.38 L 522.97 329.78 L 520.7 328.7 L 517.97 328.14 L 515.99 328 L 514.67 328.99 L 513.1999999999999 329.49 L 510.5899999999999 329.04 L 510.0199999999999 329.25 L 509.5799999999999 325.29 L 503.05999999999995 319.09000000000003 L 502.67999999999995 318.91 L 498.28999999999996 320.14000000000004 L 496.76 318.90000000000003 L 496.25 319.11 L 495.32 318.89 L 492.78 317.66999999999996 L 490.60999999999996 316.04999999999995 L 489.62999999999994 316.22999999999996 L 485.2799999999999 312.59999999999997 L 484.1799999999999 312.05999999999995 L 481.4499999999999 311.30999999999995 L 479.6799999999999 311.55999999999995 L 477.7999999999999 312.4599999999999 L 476.9899999999999 313.5799999999999 L 476.3499999999999 313.75999999999993 L 471.0199999999999 312.2899999999999 L 470.4099999999999 311.7999999999999 L 470.1499999999999 310.2999999999999 L 470.2899999999999 309.4099999999999 L 471.5799999999999 306.6699999999999 L 470.7199999999999 306.2099999999999 L 468.43999999999994 305.68999999999994 L 466.25999999999993 305.6499999999999 L 465.05999999999995 305.1499999999999 L 463.2699999999999 305.06999999999994 L 459.43999999999994 306.6499999999999 L 455.17999999999995 309.6799999999999 L 454.53999999999996 310.7899999999999 L 451.16999999999996 312.6599999999999 L 449.15 313.0599999999999 L 448.2 314.2399999999999 L 446.39 315.7899999999999 L 444.96 316.3099999999999 L 443.96 316.1599999999999 L 442.10999999999996 318.7399999999999 L 441.06999999999994 319.5099999999999 L 438.93999999999994 319.1299999999999 L 438.2199999999999 319.2599999999999 L 437.5299999999999 320.2599999999999 L 436.18999999999994 321.1799999999999 L 435.78999999999996 320.9399999999999 L 437.21999999999997 317.5099999999999 L 436.71 315.09999999999985 L 436.71 315.09999999999985 L 438.19 313.1299999999998 L 438.44 312.35999999999984 L 438.21 311.08999999999986 L 437.53999999999996 309.36999999999983 L 437.64 308.6999999999998 L 438.34999999999997 307.2799999999998 L 438.29999999999995 306.8199999999998 L 435.09 304.1999999999998 L 433.4 300.73999999999984 L 432.78 297.21999999999986 L 432.83 295.66999999999985 L 434.03 291.83999999999986 L 435.61999999999995 290.8099999999999 L 435.84999999999997 290.4299999999999 L 435.90999999999997 289.4899999999999 L 434.28 288.6499999999999 L 434.16999999999996 288.31999999999994 L 434.65 285.79999999999995 L 436.08 284.73999999999995 L 436.06 284.36999999999995 L 433.34 281.90999999999997 L 433.34 281.90999999999997 L 433.29999999999995 280.97999999999996 L 434.65999999999997 278.59999999999997 L 434.61999999999995 277.53 L 434.44999999999993 277.10999999999996 L 432.98999999999995 276.61999999999995 L 432.04999999999995 275.96999999999997 L 431.69999999999993 274.71 L 431.75999999999993 271.78999999999996 L 431.94999999999993 270.93999999999994 L 433.8999999999999 269.2699999999999 L 435.0399999999999 268.8499999999999 L 435.9999999999999 268.1299999999999 L 435.70999999999987 267.4999999999999 L 435.1299999999999 266.9799999999999 L 434.20999999999987 266.6899999999999 L 433.1799999999999 266.8699999999999 L 432.82999999999987 266.5399999999999 L 432.7399999999999 266.0399999999999 L 433.1599999999999 265.0799999999999 L 435.19999999999993 264.25999999999993 L 435.75999999999993 263.80999999999995 L 435.7199999999999 263.04999999999995 L 433.8399999999999 262.06999999999994 L 430.25999999999993 261.3999999999999 L 428.3999999999999 259.43999999999994 L 428.1699999999999 258.5199999999999 L 428.6699999999999 257.3599999999999 L 429.6799999999999 256.6299999999999 L 431.1999999999999 253.1499999999999 L 432.09999999999985 252.53999999999988 L 433.10999999999984 252.26999999999987 L 433.45999999999987 251.88999999999987 L 432.16999999999985 250.08999999999986 L 432.35999999999984 249.71999999999986 L 435.5699999999998 247.09999999999985 L 439.3899999999998 245.07999999999984 L 439.9499999999998 244.60999999999984 L 440.16999999999985 243.62999999999985 L 440.85999999999984 242.97999999999985 L 440.85999999999984 242.97999999999985 L 443.1899999999998 242.95999999999984 L 444.6299999999998 244.29999999999984 L 445.28999999999985 245.33999999999983 L 445.8199999999998 247.54999999999984 L 447.5799999999998 250.03999999999985 L 451.7599999999998 251.89999999999986 L 453.55999999999983 251.37999999999985 L 455.66999999999985 251.55999999999986 L 455.99999999999983 251.34999999999985 L 456.74999999999983 249.89999999999986 L 457.8899999999998 249.52999999999986 L 458.55999999999983 248.65999999999985 L 459.72999999999985 247.76999999999987 L 461.9399999999998 247.01999999999987 L 463.2699999999998 247.18999999999986 L 464.74999999999983 247.71999999999986 L 466.09999999999985 247.29999999999987 L 469.0699999999999 244.87999999999988 L 472.01999999999987 239.82999999999987 L 472.7399999999999 238.96999999999986 L 472.9799999999999 238.04999999999987 L 473.2799999999999 235.48999999999987 L 473.1599999999999 234.32999999999987 L 470.9199999999999 229.89999999999986 L 470.9699999999999 228.96999999999986 L 474.2099999999999 227.31999999999985 L 476.1599999999999 227.29999999999984 L 477.6599999999999 227.75999999999985 L 478.06999999999994 228.68999999999986 L 478.38999999999993 228.86999999999986 L 480.50999999999993 228.43999999999986 L 481.8999999999999 227.89999999999986 L 483.2299999999999 228.27999999999986 L 484.9399999999999 229.26999999999987 L 484.8099999999999 229.91999999999987 L 484.9999999999999 230.20999999999987 L 485.8199999999999 230.48999999999987 L 488.8199999999999 230.37999999999985 L 490.2899999999999 229.73999999999987 L 491.9899999999999 229.63999999999987 L 492.8099999999999 228.41999999999987 L 494.3199999999999 227.07999999999987 L 497.0499999999999 226.73999999999987 L 497.8199999999999 226.37999999999985 L 498.6299999999999 225.39999999999986 L 500.7999999999999 225.40999999999985 L 501.4199999999999 226.03999999999985 L 501.7299999999999 226.08999999999986 L 503.5899999999999 224.27999999999986 L 503.4899999999999 221.87999999999985 L 505.4799999999999 221.49999999999986 L 506.2699999999999 221.67999999999986 L 507.31999999999994 221.01999999999987 L 508.81999999999994 218.70999999999987 L 509.2799999999999 217.55999999999986 L 509.2799999999999 217.55999999999986 L 510.1699999999999 217.95999999999987 L 511.3299999999999 217.68999999999986 L 513.53 217.97999999999985 L 516.35 219.36999999999983 L 516.7900000000001 219.87999999999982 L 516.7300000000001 222.60999999999981 L 517.4500000000002 224.5499999999998 L 519.6600000000002 225.4599999999998 L 519.9300000000002 227.4599999999998 L 519.0100000000002 229.13999999999982 L 520.8400000000003 229.75999999999982 L 521.8000000000003 229.53999999999982 L 522.6200000000003 228.61999999999983 L 525.4900000000004 227.73999999999984 L 526.2600000000003 224.15999999999983 L 526.7600000000003 223.28999999999982 L 527.5100000000003 223.12999999999982 L 528.2900000000003 223.65999999999983 L 528.9200000000003 223.70999999999984 L 531.3100000000003 222.68999999999983 L 532.4100000000003 221.44999999999982 L 532.5800000000003 220.85999999999981 L 532.3300000000003 219.4999999999998 L 532.6200000000002 219.2499999999998 L 534.8600000000002 218.7999999999998 L 535.6300000000002 216.7499999999998 L 537.2800000000002 216.3099999999998 L 539.8100000000002 214.8499999999998 L 540.4000000000002 214.7499999999998 L 541.8900000000002 215.3099999999998 L 542.7200000000003 216.7499999999998 L 544.0800000000003 217.5599999999998 L 546.4400000000003 218.3399999999998 L 549.4300000000003 218.7399999999998 L 551.0100000000003 219.88999999999982 L 551.5500000000003 221.53999999999982 L 551.9400000000003 221.80999999999983 L 552.3700000000002 221.65999999999983 L 552.6600000000002 219.90999999999983 L 553.0900000000001 219.46999999999983 L 554.0900000000001 219.45999999999984 L 554.5400000000002 219.77999999999983 L 554.5600000000002 220.40999999999983 L 553.9400000000002 221.28999999999982 L 554.3900000000002 222.11999999999983 L 554.8900000000002 222.48999999999984 L 556.9900000000002 223.34999999999985 L 557.0100000000002 224.28999999999985 L 558.2300000000002 227.33999999999986 L 558.2300000000002 227.33999999999986 L 558.7700000000002 228.73999999999987 L 559.7900000000002 229.02999999999986 L 560.2400000000002 228.93999999999986 L 561.6700000000002 229.72999999999985 L 561.8700000000002 230.44999999999985 L 561.8700000000002 230.44999999999985 L 561.2000000000003 231.60999999999984 L 561.4100000000003 233.74999999999983 L 562.6900000000003 236.24999999999983 L 564.6800000000003 238.19999999999982 L 565.4300000000003 239.34999999999982 L 565.3500000000003 242.46999999999983 L 564.6900000000003 244.08999999999983 L 564.6000000000003 244.96999999999983 L 565.3600000000002 247.71999999999983 L 565.0600000000003 248.29999999999984 L 564.3700000000002 248.84999999999985 L 561.8200000000003 249.84999999999985 L 560.6900000000003 249.09999999999985 L 558.9800000000002 249.08999999999986 L 558.6600000000002 249.38999999999987 L 558.0700000000002 250.96999999999989 L 558.0900000000001 251.7399999999999 L 559.0400000000002 253.3399999999999 L 560.1400000000002 253.9999999999999 L 560.6600000000002 255.4899999999999 L 562.0900000000001 256.9999999999999 L 562.2400000000001 257.3899999999999 L 562.1100000000001 258.8099999999999 L 561.7700000000001 259.1999999999999 L 561.8900000000001 259.6199999999999 L 562.4800000000001 260.1399999999999 L 564.4100000000001 261.0599999999999 L 564.8900000000001 261.76999999999987 L 565.4300000000001 262.10999999999984 L 566.98 262.74999999999983 L 569.87 261.86999999999983 L 569.87 261.86999999999983 L 570.51 261.84999999999985 L 570.87 262.2599999999999 L 566.79 271.08999999999986 L 562.9599999999999 276.27999999999986 L 561.93 278.60999999999984 L 556.9 284.34999999999985 L 554.4499999999999 285.60999999999984 L 553.5799999999999 285.59999999999985 L 553.8799999999999 284.16999999999985 L 554.2499999999999 284.01999999999987 L 554.3899999999999 282.91999999999985 L 553.9399999999998 280.98999999999984 L 552.0699999999998 280.73999999999984 L 551.6399999999999 279.4399999999998 L 550.9599999999999 278.6899999999998 L 550.5899999999999 279.28999999999985 L 550.1299999999999 281.61999999999983 L 549.6299999999999 282.48999999999984 L 549.0799999999999 282.86999999999983 L 548.52 282.5799999999998 L 548.03 280.8399999999998 L 548.14 280.5199999999998 L 548.4499999999999 280.3899999999998 L 548.42 279.99999999999983 L 547.55 281.28999999999985 L 548.4799999999999 282.97999999999985 L 548.9399999999999 283.20999999999987 L 549.31 283.0599999999999 L 550.4599999999999 283.3199999999999 L 549.9999999999999 285.1299999999999 L 548.7899999999998 286.27999999999986 L 548.5399999999998 288.09999999999985 L 547.2899999999998 289.0699999999999 L 546.9399999999998 289.7399999999999 L 546.7399999999998 290.57999999999987 L 546.9199999999997 291.4299999999999 L 545.5699999999997 291.0399999999999 L 545.3599999999997 291.4299999999999 L 544.9999999999997 293.9499999999999 L 545.3599999999997 293.22999999999985 L 546.1099999999997 293.4399999999998 L 546.3499999999997 293.97999999999985 L 546.1199999999997 294.3899999999999 L 546.1799999999996 295.0099999999999 L 546.4799999999996 295.3099999999999 L 546.8099999999996 296.3099999999999 L 545.7699999999996 298.8199999999999 L 546.3399999999997 302.2599999999999 L 545.7899999999997 302.7499999999999 L 545.2199999999997 302.52999999999986 L 545.0799999999997 303.65999999999985 L 545.6699999999997 304.11999999999983 L 546.8799999999998 302.3999999999998 L 546.4099999999997 300.1899999999998 L 547.2299999999998 299.5799999999998 L 547.4799999999998 300.11999999999983 L 547.4199999999998 301.8799999999998 L 546.4599999999998 304.48999999999984 L 545.7199999999998 309.91999999999985 L 545.2099999999998 311.72999999999985 L 545.4099999999999 314.1999999999999 L 546.1899999999998 317.0499999999999 L 546.3799999999999 321.5899999999999 L 547.2499999999999 327.99999999999994 L 548.2399999999999 331.41999999999996 L 546.0299999999999 338.08 L 544.6799999999998 344.72999999999996 L 544.2099999999998 345.73999999999995 L 544.0499999999998 348.59999999999997 L 542.9899999999999 352.32 L 542.8999999999999 354.65 L 543.2899999999998 359.07 L 544.1799999999998 360.78 L 541.9399999999998 363.76 L 540.1299999999999 364.43 L 539.1899999999998 365.07 L 536.4699999999998 368.96 L 535.9 371 L 535.9 371 L 527.81 365.86 L 527.5 365.33 z M 549.78 287.33 L 549.55 286.13 L 550.29 285.71999999999997 L 551.3499999999999 284.67999999999995 L 551.5099999999999 284.03999999999996 L 551.1399999999999 283.30999999999995 L 551.8999999999999 283.44999999999993 L 552.7199999999999 284.49999999999994 L 552.67 285.0299999999999 L 549.78 287.33 z M 547.25 294.18 L 546.62 294.15000000000003 L 546.63 293.48 L 546.89 293.12 L 546.09 292.9 L 545.6700000000001 292.5 L 545.8000000000001 291.43 L 547.6700000000001 291.28000000000003 L 547.83 291.48 L 547.94 292.61 L 547.25 294.18 z"},{code:"CE",name:"Ceará",gTransform:"matrix(1 0 0 1 235.04 -154.64)",pathTransform:"translate(-541.04, -164.62)",d:"M 573.79 156.85 L 568.9 158.44 L 566.29 160.45 L 562.99 167.14 L 562.15 168.26 L 561.28 168.83 L 560.63 170.5 L 560.78 171.24 L 559.38 173.68 L 557.92 175.19 L 557.35 176.29 L 556.32 176.55 L 555.54 176.04 L 555.03 176.11 L 554.19 176.99 L 552.78 179.24 L 552.44 181.21 L 553.08 181.38 L 553.74 181 L 553.74 181 L 553.66 181.54 L 552.82 182.69 L 551.79 185.69 L 552.31 187 L 551.65 188.31 L 550.56 188.94 L 550.39 189.32 L 550.27 190.25 L 550.51 190.66 L 551.09 190.95 L 551.44 191.67 L 551.42 193.33 L 552.66 194.22 L 553.35 194.3 L 553.69 195.49 L 552.08 198.98 L 550.89 200.1 L 551.06 200.35 L 551.06 200.35 L 549.47 200.84 L 548.4 201.67 L 546.86 203.96 L 545.21 204.01 L 544.58 202.37 L 543.8 201.8 L 542.44 201.32 L 541.43 200.25 L 540.97 199.26 L 539.14 198.43 L 536.29 196.53 L 533.21 196.11 L 531.92 196.21 L 529.78 197.01 L 528.15 197.2 L 527.26 196.96 L 522.33 196.76 L 522.33 196.76 L 522.39 195.44 L 521.71 194.76 L 521.63 193.79 L 522.77 190.68 L 524.27 188.43 L 524.28 187.74 L 523.51 186.58 L 520.95 186.11 L 519.64 185.46 L 518.63 182.79 L 517.58 177.59 L 516.82 175.02 L 517.06 174.57 L 516.12 166.41 L 516.01 166.03 L 515.09 165.34 L 515.89 164.76 L 516.48 163.18 L 515.88 160.19 L 514.88 158.18 L 515.36 156.58 L 514.57 152.71 L 515.31 151.35 L 515.33 150.59 L 513.97 149 L 513.53 147.27 L 510.38 140.85 L 508.58 136.13 L 508.29 134.84 L 508.47 133.38 L 510.05 131.41 L 511.14 129.56 L 511.25 128.76 L 511.25 128.76 L 511.44 128.62 L 511.4 128 L 511 127.34 L 511.65 126.53 L 518.39 126.31 L 521.28 125.88 L 523.35 125.22 L 530.75 126.01 L 532.87 127.13 L 534.81 128.63 L 538.93 130.81 L 540.39 131.33 L 545.21 134.33 L 546.42 134.53 L 548.64 136.82 L 551.63 138.93 L 554.2 139.65 L 556.64 142.56 L 557.86 143.17 L 560.82 146.98 L 564.98 150.06 L 566.44 152.06 L 567.48 153.05 L 568.98 153.87 L 570.13 153.9 L 572.5 154.82 L 573.29 155.49 z"},{code:"DF",name:"Distrito Federal",gTransform:"matrix(1 0 0 1 103.1 10.18)",pathTransform:"translate(-409.11, -329.45)",d:"M 416.71 333.87 L 402.02 333.85 L 401.5 330.59 L 402.42 328.76 L 402.8 325.03 L 414.75 325.04 L 416.58 327.02 L 416.64 329.23 L 416.05 330.42 L 415.84 332.86 z"},{code:"ES",name:"Espírito Santo",gTransform:"matrix(1 0 0 1 212.62 72.56)",pathTransform:"translate(-518.62, -391.82)",d:"M 501.63 411.37 L 501.34 411.23 L 501.78 408.89 L 502.35 407.59 L 501.76 404.47 L 501.92 404.05 L 503.64 401.99 L 508.79 402.02 L 509.34 401.7 L 510.31 398.46 L 511.42 397.19 L 512.3 394.9 L 512.54 393.18 L 512.8 392.74 L 514.04 391.88 L 515.75 389.79 L 516.29 386.82 L 516 384.39 L 514.73 381.58 L 513.63 380.31 L 513.11 380.22 L 512.66 380.51 L 511.9 380.23 L 511.41 379.52 L 511.84 378.97 L 513.32 378.88 L 514.12 379.23 L 515.09 379.26 L 516.04 379.02 L 516.36 378.6 L 516.19 376.88 L 514.88 376.53 L 514.67 376.12 L 514.97 374.58 L 515 372.66 L 514.48 372 L 513.15 371.33 L 512.85 370.63 L 514.02 368.7 L 516.19 367.39 L 516.5 367.37 L 517.55 368.11 L 518.68 368.22 L 518.7 367.41 L 517.03 365.14 L 518.37 365.27 L 520.55 364.98 L 521.39 364.37 L 522.47 364.05 L 524.05 363.97 L 526.59 364.78 L 527.5 365.33 L 527.5 365.33 L 527.5 365.33 L 527.5 365.33 L 527.8 365.86 L 535.9 371 L 535.9 371 L 534.97 374.35 L 534.66 377.21 L 534.78 380.8 L 535.5 386.95 L 535.19 389.42 L 533.7 392.6 L 530.95 393.99 L 530.4 394.59 L 528.73 397.92 L 527.75 401.72 L 526.98 403.19 L 526.15 402.51 L 525.27 402.38 L 524.98 403.66 L 526.33 404.18 L 524.39 408.42 L 520.94 412.26 L 520.7 411.99 L 518.84 412.65 L 518.04 413.88 L 517.98 415.27 L 517.56 416.52 L 515.97 418.54 L 515.68 419.67 L 515.68 419.67 L 514.06 418.61 L 511.07 418.98 L 506.73 417.97 L 504.23 416.84 L 503.56 412.13 z"},{code:"GO",name:"Goiás",gTransform:"matrix(1 0 0 1 75.37 14.13)",pathTransform:"translate(-381.37, -333.38)",d:"M 416.71 333.87 L 415.84 332.86 L 416.05 330.42 L 416.64 329.23 L 416.58 327.02 L 414.75 325.04 L 402.8 325.03 L 402.42 328.76 L 401.5 330.59 L 402.02 333.85 L 416.71 333.87 L 416.71 333.87 L 416.71 333.87 L 416.71 333.87 L 416.18 335.39 L 416.49 336.96 L 415.81 338.55 L 414.77 339.8 L 414.36 341.27 L 415.21 342.48 L 416.06 342.82 L 417.48 343.85 L 419.13 348.41 L 419.13 349.01 L 416.81 351.72 L 413.57 354.73 L 413.14 356.87 L 414.23 357.98 L 415.13 357.51 L 416.71 358.08 L 417.18 358.69 L 417.36 359.69 L 417.19 360.4 L 416.46 361.3 L 415.95 363.19 L 417.14 366.65 L 414.05 368.71 L 412.89 368.91 L 412.03 369.81 L 411.55 370.93 L 406.66 373.67 L 405.96 372.9 L 401.61 371.04 L 401.06 371.52 L 400.48 371.61 L 398.73 371.62 L 397.25 371.34 L 393.39 371.5 L 391.38 370.61 L 387.25 373.25 L 384.34 376.17 L 384.01 376.17 L 382.7 374.75 L 381.18 374.45 L 377.99 376.09 L 374.28 375.47 L 371.8 376.43 L 369.57 376.97 L 368.16 379.07 L 366.95 381.53 L 367.01 382.53 L 366.17 383.83 L 365.35 384.11 L 364.51 383.95 L 364.06 384.09 L 363.12 384.83 L 361.48 386.93 L 360.91 388.83 L 361.47 389.44 L 361.46 389.78 L 361.1 390.01 L 360.24 389.55 L 360.24 389.55 L 360 389.1 L 357.34 386.86 L 354.19 386.25 L 352.57 384.7 L 350.67 384.27 L 349.18 384.23 L 345.83 382.89 L 345.15 382.04 L 342.08 380.48 L 341.41 379.87 L 339.97 379.16 L 338.83 378.99 L 336.13 377.31 L 333.35 377.47 L 329.55 376.77 L 329.42 376.44 L 329.68 375.6 L 330.25 374.43 L 331.56 372.67 L 331.48 372.25 L 329.23 371.35 L 328.09 372.02 L 327.43 371.83 L 327.15 371.42 L 326.92 370.31 L 327.18 367.73 L 326.99 365.96 L 326.99 365.96 L 326.04 363.76 L 325.86 360.33 L 324.45 358.14 L 324.29 357.43 L 324.69 354.02 L 327.24 350.17 L 327.62 347.26 L 328.32 346.49 L 330.34 345.65 L 332.26 343.88 L 333.51 341.86 L 333.84 339.91 L 334.34 338.9 L 335.62 337.86 L 336.44 336.43 L 336.52 334.89 L 338.27 333.92 L 339.67 331.3 L 342.32 331.17 L 345.04 330.31 L 345.36 330.03 L 347.34 325.84 L 348.05 324.88 L 348.69 320.78 L 349.07 320.04 L 350.99 318.1 L 352.64 317.09 L 353.71 316.83 L 354.94 317.51 L 356.15 316.78 L 357.54 315.35 L 358.38 312.42 L 359.55 309.55 L 359.54 308.75 L 359.06 307.61 L 359.64 304.87 L 361.24 301.78 L 361.12 296.6 L 362.33 295.82 L 363.36 293.19 L 365.36 290.02 L 365.75 288.95 L 365.59 286.23 L 365.94 285.33 L 366.91 284.47 L 367.18 283.34 L 367.1 282.71 L 367.1 282.71 L 367.44 282.26 L 367.64 280.38 L 368.3 279.15 L 370.11 277.06 L 370.67 276.76 L 370.64 278.47 L 369.42 280.35 L 368.9 282.69 L 371.3 283.09 L 373.5 284.12 L 377.43 284.52 L 380.52 286.23 L 384.59 287.66 L 385.22 287.43 L 386.85 281.49 L 388.32 279.1 L 389.5 278.13 L 390.65 279.44 L 391.69 281.32 L 392.8 285.03 L 393.41 288.13 L 394.55 288.18 L 395.3 287.43 L 395.6 286.43 L 396.16 285.89 L 398.92 286.23 L 403.45 285.7 L 403.67 286.44 L 403.11 288 L 406.24 289.47 L 409.59 290.15 L 410.28 290.07 L 410.79 286.77 L 411.34 286.8 L 412.85 289.42 L 413.31 289.66 L 415.09 288.76 L 417.61 286.68 L 422.14 285.68 L 423.69 285.68 L 426.25 284.58 L 427.99 283.24 L 433.35 281.82 L 433.35 281.82 L 436.07 284.28 L 436.09 284.66 L 434.66 285.72 L 434.18 288.24 L 434.28 288.57 L 435.91 289.41 L 435.85 290.35 L 435.62 290.73 L 434.03 291.76 L 432.84 295.59 L 432.79 297.14 L 433.41 300.66 L 435.11 304.12 L 438.32 306.74 L 438.37 307.21 L 437.65 308.63 L 437.55 309.3 L 438.22 311.02 L 438.45 312.3 L 438.2 313.07 L 436.72 315.04 L 436.72 315.04 L 435.72 316.05 L 432.49 315.71 L 431.59 313.95 L 429.17 312.47 L 428 313.96 L 428.58 317.73 L 428.01 318.27 L 427.61 318.4 L 424.83 317.26 L 423.66 317.49 L 423.29 317.77 L 422.57 320.95 L 423.29 321.05 L 423.78 322.21 L 423.21 323.15 L 422.48 323.85 L 422.52 325.75 L 422.94 326.36 L 423.47 326.55 L 424.16 330.81 L 423.63 331.34 L 420.27 332.24 L 417.98 333.75 z"},{code:"MA",name:"Maranhão",gTransform:"matrix(1 0 0 1 142.22 -148.63)",pathTransform:"translate(-448.22, -170.64)",d:"M 458.57 128.92 L 458.53 129.25 L 456.48999999999995 131.4 L 456.05999999999995 131.57 L 456.0199999999999 133.01 L 457.98999999999995 131.31 L 458.66999999999996 130.1 L 460.78999999999996 128.51999999999998 L 461.67999999999995 127.37999999999998 L 462.7099999999999 121.04999999999998 L 463.8599999999999 120.34999999999998 L 464.9699999999999 120.22999999999998 L 466.63999999999993 119.30999999999997 L 467.2899999999999 119.17999999999998 L 467.7499999999999 119.29999999999998 L 467.82999999999987 120.92999999999998 L 467.6299999999999 121.37999999999998 L 466.20999999999987 123.24999999999999 L 462.9999999999999 124.99999999999999 L 462.9699999999999 125.71999999999998 L 463.69999999999993 125.83999999999999 L 464.1499999999999 125.02999999999999 L 465.2999999999999 124.71999999999998 L 465.5199999999999 125.54999999999998 L 464.92999999999995 126.05999999999999 L 465.17999999999995 126.35999999999999 L 469.38999999999993 121.38999999999999 L 470.24999999999994 121.71999999999998 L 472.8299999999999 120.78999999999998 L 476.86999999999995 121.21999999999998 L 476.40999999999997 118.80999999999999 L 477.02 118.57999999999998 L 479.44 118.65999999999998 L 481.21999999999997 119.03999999999998 L 483.84999999999997 120.08999999999997 L 484.89 120.19999999999997 L 487.03999999999996 121.57999999999997 L 488.43999999999994 121.60999999999997 L 489.69999999999993 122.90999999999997 L 491.5899999999999 124.22999999999996 L 494.0899999999999 124.80999999999996 L 495.24999999999994 124.61999999999996 L 495.80999999999995 125.37999999999997 L 496.1499999999999 125.42999999999996 L 497.7399999999999 125.33999999999996 L 500.1999999999999 125.99999999999996 L 500.45999999999987 125.09999999999995 L 499.78999999999985 124.62999999999995 L 501.45999999999987 124.24999999999996 L 502.02999999999986 124.35999999999996 L 501.9399999999999 124.77999999999996 L 501.9399999999999 124.77999999999996 L 501.4799999999999 126.20999999999997 L 501.7099999999999 126.92999999999996 L 502.3399999999999 127.46999999999997 L 501.9599999999999 128.99999999999997 L 500.1699999999999 131.26999999999998 L 496.0399999999999 135.23999999999998 L 492.7199999999999 135.7 L 491.9199999999999 135.54 L 488.9999999999999 138.94 L 489.0399999999999 140.74 L 488.1599999999999 142.57000000000002 L 486.2699999999999 144.42000000000002 L 485.44999999999993 146.4 L 484.80999999999995 146.57 L 484.03999999999996 147.62 L 484.4 149.54 L 485.63 150.37 L 486.01 151.65 L 485.73 153.11 L 484.59000000000003 155.98000000000002 L 486.17 158.79000000000002 L 486.72 161.77 L 486.61 164.20000000000002 L 486.40000000000003 164.75000000000003 L 482.3 169.17000000000002 L 482.13 171.65 L 482.25 173.76000000000002 L 482.76 176.06000000000003 L 484.53999999999996 178.10000000000002 L 486.15 179.01000000000002 L 486.32 179.51000000000002 L 486.45 180.35000000000002 L 486.06 182.55 L 485.77 182.99 L 485.65 184.20000000000002 L 485.15 185.66000000000003 L 483.94 186.97000000000003 L 481.65 187.26000000000002 L 481 186.98000000000002 L 480.17 187.02 L 477.74 187.88000000000002 L 476.22 187.99000000000004 L 473.72 186.17000000000004 L 472.71000000000004 185.96000000000004 L 471.25000000000006 186.15000000000003 L 470.24000000000007 186.75000000000003 L 469.12000000000006 187.01000000000002 L 468.89000000000004 186.71 L 468.05000000000007 186.95000000000002 L 467.55000000000007 187.17000000000002 L 465.6500000000001 189.08 L 465.6600000000001 189.54000000000002 L 465.0300000000001 190.41000000000003 L 463.0200000000001 192.41000000000003 L 460.6800000000001 193.32000000000002 L 457.8100000000001 195.88000000000002 L 456.48000000000013 196.41000000000003 L 455.4300000000001 196.45000000000002 L 453.73000000000013 197.98000000000002 L 452.65000000000015 198.34000000000003 L 450.04000000000013 198.66000000000003 L 447.3200000000001 199.42000000000002 L 445.1900000000001 201.37 L 444.2100000000001 204.34 L 443.8200000000001 207.31 L 443.1900000000001 209.63 L 441.7400000000001 212.37 L 441.4400000000001 212.59 L 441.10000000000014 213.41 L 440.97000000000014 214.93 L 439.77000000000015 217.41 L 438.07000000000016 218.81 L 437.34000000000015 220.81 L 438.0500000000001 222.75 L 438.52000000000015 225.93 L 440.25000000000017 228.99 L 440.21000000000015 229.51000000000002 L 439.45000000000016 230.91000000000003 L 439.32000000000016 237.27000000000004 L 438.1700000000002 239.72000000000003 L 437.9100000000002 240.78000000000003 L 437.8600000000002 242.70000000000002 L 437.8600000000002 242.70000000000002 L 436.5800000000002 242.04000000000002 L 435.9700000000002 241.22000000000003 L 435.1500000000002 240.77000000000004 L 434.1600000000002 240.48000000000005 L 432.3800000000002 240.68000000000004 L 431.67000000000024 240.50000000000003 L 430.3200000000002 238.50000000000003 L 429.3300000000002 235.64000000000001 L 427.2000000000002 234.02 L 427.06000000000023 232.37 L 428.7000000000002 230.56 L 428.62000000000023 230.03 L 424.74000000000024 228.08 L 424.12000000000023 227.03 L 424.06000000000023 225.37 L 423.31000000000023 223.78 L 422.37000000000023 223.09 L 420.29000000000025 222.81 L 420.09000000000026 222.39000000000001 L 420.35000000000025 221.68 L 422.98000000000025 219.14000000000001 L 422.61000000000024 217.83 L 423.34000000000026 215.15 L 424.03000000000026 213.72 L 424.60000000000025 213.17 L 425.9400000000002 212.63 L 429.3300000000002 212.28 L 428.9400000000002 210.93 L 429.5800000000002 207.68 L 429.5000000000002 205.92000000000002 L 427.7000000000002 204.71 L 423.43000000000023 205.65 L 421.28000000000026 206.99 L 419.0100000000003 203.97 L 418.10000000000025 203.12 L 415.10000000000025 198.97 L 414.22000000000025 199.04 L 413.3800000000003 197.6 L 413.9900000000003 196.41 L 413.8800000000003 195.53 L 413.6300000000003 195.19 L 412.2600000000003 194.95 L 411.84000000000026 195.22 L 409.91000000000025 193.89 L 410.09000000000026 193.17999999999998 L 411.85000000000025 192.51999999999998 L 413.60000000000025 190.48 L 413.85000000000025 188.89 L 413.5700000000003 187.89 L 413.8800000000003 185.52999999999997 L 415.65000000000026 179.36999999999998 L 415.66000000000025 178.93999999999997 L 414.98000000000025 177.79999999999998 L 414.7500000000002 176.71999999999997 L 414.9600000000002 172.99999999999997 L 414.3200000000002 171.49999999999997 L 413.8500000000002 168.00999999999996 L 413.0100000000002 166.97999999999996 L 409.61000000000024 165.53999999999996 L 408.3900000000002 165.51999999999995 L 408.11000000000024 165.19999999999996 L 408.03000000000026 164.16999999999996 L 407.4400000000003 163.47999999999996 L 405.7000000000003 163.18999999999997 L 404.7400000000003 163.70999999999998 L 403.3400000000003 163.61999999999998 L 400.56000000000034 162.10999999999999 L 399.70000000000033 162.04999999999998 L 397.74000000000035 162.57999999999998 L 395.12000000000035 164.42999999999998 L 394.5900000000004 165.06999999999996 L 394.5900000000004 165.06999999999996 L 394.10000000000036 164.98999999999995 L 408.81000000000034 153.15999999999994 L 411.16000000000037 153.38999999999993 L 412.3300000000004 152.46999999999994 L 413.8800000000004 150.29999999999995 L 414.3100000000004 149.14999999999995 L 415.8600000000004 147.97999999999996 L 416.4800000000004 145.09999999999997 L 417.6000000000004 144.63999999999996 L 420.0400000000004 142.31999999999996 L 420.51000000000045 141.10999999999996 L 420.80000000000047 139.20999999999995 L 422.4000000000005 134.51999999999995 L 424.36000000000047 132.97999999999996 L 425.8400000000005 131.21999999999997 L 426.67000000000047 129.76999999999998 L 427.13000000000045 128.48999999999998 L 426.95000000000044 126.66999999999999 L 427.74000000000046 125.85999999999999 L 426.70000000000044 124.27999999999999 L 430.38000000000045 121.18999999999998 L 430.25000000000045 119.54999999999998 L 430.75000000000045 117.16999999999999 L 432.49000000000046 115.6 L 432.8500000000005 114.89 L 433.75000000000045 111.87 L 433.83000000000044 110.26 L 433.40000000000043 109.73 L 432.4100000000004 109.89 L 432.14000000000044 109.4 L 432.19000000000045 108.78 L 433.33000000000044 108.63 L 433.90000000000043 107.89 L 434.6100000000004 103.5 L 434.4500000000004 102.12 L 434.9200000000004 101.09 L 435.6900000000004 100.64 L 435.6900000000004 100.64 L 436.3200000000004 100.64 L 436.5600000000004 100.4 L 436.5000000000004 99.86 L 436.8400000000004 99.11 L 437.42000000000036 98.58 L 438.76000000000033 99.56 L 439.2100000000003 101.4 L 440.4000000000003 101.52000000000001 L 441.1700000000003 100.16000000000001 L 441.7800000000003 103.09000000000002 L 442.7700000000003 103.13000000000002 L 443.06000000000034 102.64000000000003 L 443.13000000000034 101.70000000000003 L 443.98000000000036 101.66000000000003 L 445.67000000000036 102.19000000000003 L 446.17000000000036 102.88000000000002 L 444.74000000000035 104.58000000000003 L 445.41000000000037 105.28000000000003 L 445.43000000000035 105.83000000000003 L 446.6400000000003 103.79000000000002 L 447.13000000000034 102.25000000000001 L 447.5800000000003 102.25000000000001 L 447.9800000000003 103.27000000000001 L 447.9800000000003 103.85000000000001 L 447.1100000000003 104.77000000000001 L 446.8400000000003 105.76 L 446.9200000000003 108.47 L 447.1800000000003 108.8 L 447.6500000000003 108.92 L 448.2300000000003 108.78 L 449.1900000000003 107.85 L 448.72000000000025 106.85 L 448.86000000000024 106.25 L 450.18000000000023 104.82 L 451.23000000000025 104.57 L 453.36000000000024 105.16 L 454.86000000000024 104.05 L 454.91000000000025 104.97 L 454.55000000000024 105.17999999999999 L 453.42000000000024 106.71 L 454.0100000000002 107.28999999999999 L 454.11000000000024 106.91999999999999 L 455.36000000000024 106.32 L 455.9400000000002 107.11 L 455.80000000000024 108.32 L 457.43000000000023 110.07 L 458.29000000000025 109.63 L 459.87000000000023 110.3 L 460.6400000000002 112.7 L 460.5300000000002 113.65 L 458.3400000000002 116.38000000000001 L 457.9600000000002 117.27000000000001 L 458.06000000000023 117.93 L 458.66000000000025 116.9 L 460.41000000000025 115.22 L 461.24000000000024 115.19 L 462.11000000000024 116 L 462.6300000000002 117.89 L 462.36000000000024 119.12 L 461.3900000000002 119.31 L 460.36000000000024 120.22 L 459.2000000000002 121.71 L 459.2700000000002 122.47999999999999 L 458.1100000000002 124.82999999999998 L 457.4900000000002 128.35 L 457.70000000000016 128.69 L 458.57 128.92 z M 459.09 129.37 L 459.03 128.58 L 459.55999999999995 127.05000000000001 L 459.1499999999999 125.98000000000002 L 459.2799999999999 125.32000000000002 L 460.18999999999994 124.08000000000003 L 460.73999999999995 123.89000000000003 L 460.78999999999996 126.24000000000002 L 460.56999999999994 127.58000000000003 L 459.7699999999999 128.18000000000004 L 459.09 129.37 z M 452.79 103.61 L 452.35 103.15 L 452.27000000000004 102.55000000000001 L 453.07000000000005 101.43 L 453.91 101.4 L 454.59000000000003 101.82000000000001 L 454.69000000000005 102.16000000000001 L 454.50000000000006 102.52000000000001 L 452.79 103.61 z M 456.29 107.79 L 456 107.49000000000001 L 456.06 106.96000000000001 L 457.12 106.07000000000001 L 457.6 106.14 L 458.1 106.99 L 457.96000000000004 107.6 L 457.56000000000006 107.42999999999999 L 456.29 107.79 z M 442.13 102.98 L 441.92 102.93 L 442.87 99.35000000000001 L 443.17 99.44000000000001 L 443.2 99.67000000000002 L 442.78999999999996 102.73000000000002 L 442.13 102.98 z"},{code:"MG",name:"Minas Gerais",gTransform:"matrix(1 0 0 1 139.79 56.66)",pathTransform:"translate(-445.79, -375.93)",d:"M 527.5 365.33 L 526.59 364.78 L 524.05 363.97 L 522.47 364.05 L 521.39 364.37 L 520.55 364.98 L 518.37 365.27 L 517.03 365.14 L 518.7 367.41 L 518.68 368.22 L 517.55 368.11 L 516.5 367.37 L 516.19 367.39 L 514.02 368.7 L 512.85 370.63 L 513.15 371.33 L 514.48 372 L 515 372.66 L 514.97 374.58 L 514.67 376.12 L 514.88 376.53 L 516.19 376.88 L 516.36 378.6 L 516.04 379.02 L 515.09 379.26 L 514.12 379.23 L 513.32 378.88 L 511.84 378.97 L 511.41 379.52 L 511.9 380.23 L 512.66 380.51 L 513.11 380.22 L 513.63 380.31 L 514.73 381.58 L 516 384.39 L 516.29 386.82 L 515.75 389.79 L 514.04 391.88 L 512.8 392.74 L 512.54 393.18 L 512.3 394.9 L 511.42 397.19 L 510.31 398.46 L 509.34 401.7 L 508.79 402.02 L 503.64 401.99 L 501.92 404.05 L 501.76 404.47 L 502.35 407.59 L 501.78 408.89 L 501.34 411.23 L 501.63 411.37 L 501.63 411.37 L 499.1 413.72 L 497.86 413.99 L 497.3 414.49 L 498.04 415.19 L 495.68 421.24 L 493.78 424.95 L 493.69 425.7 L 495.13 425.83 L 495.42 426.44 L 495.21 426.96 L 492.68 427.94 L 483.17 432.47 L 481.8 432.67 L 481.82 432.21 L 481.33 432.04 L 478.8 431.77 L 478.23 431.83 L 476.61 432.77 L 475.36 432.93 L 472.16 433.01 L 471.8 432.69 L 471.29 432.77 L 467.19 434.55 L 466.14 435.32 L 464.43 436.09 L 463.93 435.81 L 461.34 435.98 L 458.43 437.32 L 456.01 438.06 L 455.33 438.55 L 455.33 438.55 L 454.08 439.28 L 451.88 439.5 L 449.95 440.52 L 448.72 441.76 L 446.93 442.43 L 444.55 442.68 L 442.21 442.6 L 442.2 442.11 L 442.55 441.62 L 442.46 441.27 L 441.27 441.6 L 441.09 443.9 L 441.33 444.13 L 441.28 444.97 L 440.53 445.95 L 439.23 446.27 L 438.66 445.84 L 435.05 446.84 L 434.86 446.31 L 432.85 446.55 L 431.73 446.3 L 429.7 442.99 L 430.92 442.28 L 430.4 440.57 L 428.6 439.74 L 426.81 438.51 L 426.1 436.9 L 426.63 435.34 L 426.82 431.89 L 426.56 428.95 L 428.42 426.23 L 429.12 424.05 L 429.17 422.78 L 428.94 422.41 L 425.24 421.09 L 424.24 421.14 L 423.96 421.5 L 423.18 421.81 L 421.57 421.86 L 421.6 421.01 L 420.77 419.02 L 419.47 417.23 L 419.1 415.02 L 418.79 414.4 L 418 413.66 L 418.19 411.72 L 419.71 409.69 L 419.77 409.13 L 419.37 407.58 L 417.49 406.37 L 416.91 405.76 L 417.2 403.39 L 417.77 402.38 L 417.57 401.34 L 414.3 397.99 L 413 398.28 L 412.15 398.92 L 410.5 398.14 L 408.12 398.25 L 407.81 398.86 L 408.01 399.32 L 407.57 400.31 L 404.79 400.99 L 403.68 400.56 L 402.17 399.11 L 401.16 400.36 L 392.98 401.04 L 392.52 401.52 L 392.04 402.71 L 392.31 405.25 L 391.9 405.69 L 390.71 405.17 L 390.7 402.39 L 390.45 401.43 L 390.09 401.04 L 389.53 400.99 L 389.27 401.18 L 388.86 402.31 L 388.19 403.25 L 387.65 403.57 L 387.03 403.55 L 385.82 401.45 L 385.49 400.03 L 385.63 399.12 L 383.95 398.33 L 381.77 396.91 L 379.78 397.5 L 378.16 397.28 L 376.49 397.63 L 372.2 396.67 L 369.65 396.59 L 367.92 395.04 L 367.17 394.9 L 365.67 395.51 L 364.24 397.2 L 362.32 397.57 L 360.17 398.68 L 358.95 399.81 L 358.95 399.81 L 359.26 397.19 L 358.67 393.98 L 359.66 389.8 L 360.24 389.55 L 360.24 389.55 L 361.1 390.01 L 361.46 389.78 L 361.47 389.44 L 360.91 388.83 L 361.48 386.93 L 363.12 384.83 L 364.06 384.09 L 364.51 383.95 L 365.35 384.11 L 366.17 383.83 L 367.01 382.53 L 366.95 381.53 L 368.16 379.07 L 369.57 376.97 L 371.8 376.43 L 374.28 375.47 L 377.99 376.09 L 381.18 374.45 L 382.7 374.75 L 384.01 376.17 L 384.34 376.17 L 387.25 373.25 L 391.38 370.61 L 393.39 371.5 L 397.25 371.34 L 398.73 371.62 L 400.48 371.61 L 401.06 371.52 L 401.61 371.04 L 405.96 372.9 L 406.66 373.67 L 411.55 370.93 L 412.03 369.81 L 412.89 368.91 L 414.05 368.71 L 417.14 366.65 L 415.95 363.19 L 416.46 361.3 L 417.19 360.4 L 417.36 359.69 L 417.18 358.69 L 416.71 358.08 L 415.13 357.51 L 414.23 357.98 L 413.14 356.87 L 413.57 354.73 L 416.81 351.72 L 419.13 349.01 L 419.13 348.41 L 417.48 343.85 L 416.06 342.82 L 415.21 342.48 L 414.36 341.27 L 414.77 339.8 L 415.81 338.55 L 416.49 336.96 L 416.18 335.39 L 416.71 333.87 L 417.98 333.75 L 420.27 332.24 L 423.63 331.34 L 424.16 330.81 L 423.47 326.55 L 422.94 326.36 L 422.52 325.75 L 422.48 323.85 L 423.21 323.15 L 423.78 322.21 L 423.29 321.05 L 422.57 320.95 L 423.29 317.77 L 423.66 317.49 L 424.83 317.26 L 427.61 318.4 L 428.01 318.27 L 428.58 317.73 L 428 313.96 L 429.17 312.47 L 431.59 313.95 L 432.49 315.71 L 435.72 316.05 L 436.72 315.04 L 436.72 315.04 L 437.23 317.45 L 435.8 320.89 L 436.2 321.12 L 437.54 320.21 L 438.24 319.21 L 438.96 319.08 L 441.09 319.46 L 442.13 318.69 L 443.98 316.12 L 444.97 316.27 L 446.4 315.74 L 448.21 314.19 L 449.16 313.02 L 451.18 312.61 L 454.55 310.75 L 455.19 309.64 L 459.46 306.61 L 463.28 305.03 L 465.08 305.12 L 466.28 305.62 L 468.46 305.65 L 470.74 306.18 L 471.59 306.64 L 470.3 309.38 L 470.15 310.27 L 470.41 311.76 L 471.02 312.26 L 476.35 313.72 L 476.99 313.55 L 477.8 312.43 L 479.68 311.54 L 481.45 311.28 L 484.18 312.03 L 485.28 312.57 L 489.63 316.21 L 490.61 316.03 L 492.78 317.65 L 495.31 318.87 L 496.24 319.09 L 496.75 318.88 L 498.28 320.12 L 502.67 318.89 L 503.05 319.07 L 509.57 325.27 L 510.01 329.23 L 510.58 329.02 L 513.19 329.47 L 514.66 328.97 L 515.98 327.98 L 517.97 328.13 L 520.7 328.69 L 522.96 329.77 L 525.15 330.38 L 527.27 330.35 L 530.1 332.82 L 530.83 333.2 L 531.72 333.27 L 532.5 334.29 L 532.92 335.46 L 531.45 338.54 L 526.49 342.76 L 526.34 345.41 L 526.9 346.43 L 526.9 346.85 L 525.88 347.56 L 523.4 347.32 L 522.58 348.2 L 521.76 351.5 L 521.23 355.9 L 521.45 356.15 L 521.8 355.96 L 522 355.51 L 522.64 355.27 L 523.22 356.5 L 523 358.01 L 523.15 358.52 L 527.29 361.58 L 527.82 362.62 L 527.83 363.15 L 527.15 364.5 z"},{code:"MS",name:"Mato Grosso do Sul",gTransform:"matrix(1 0 0 1 -2.22 90.13)",pathTransform:"translate(-303.77, -409.4)",d:"M 358.95 399.81 L 358.55 402.27 L 358.27 402.67 L 356.77 403.45 L 355.45 403.49 L 354.98 403.71 L 353.76 404.74 L 351.77 407.42 L 351.04 408.07 L 350.03 408.37 L 349.41 410.05 L 349.25 412.98 L 346.66 416.62 L 345.7 417.14 L 345.47 417.52 L 345.78 419.45 L 345.7 420.4 L 344.49 422.74 L 342.49 425 L 342.84 425.85 L 342.56 427.06 L 341.12 428.09 L 340.72 429.3 L 338.99 430.99 L 337.73 433.43 L 335.78 435.3 L 328.22 439.83 L 326.96 440.97 L 326.22 442.51 L 325.38 443.59 L 325.38 443.59 L 319.97 445.86 L 318.86 446.68 L 317.93 449.01 L 317.95 450.16 L 316.5 453.72 L 315.83 454.4 L 314.17 455.41 L 313.06 455.73 L 312.73 456.08 L 311.16 464 L 310.8 464.82 L 308.42 466.38 L 308.42 466.38 L 305.87 464.05 L 302.46 462.16 L 298.47 464.13 L 297.79 464.88 L 296.13 465.37 L 293.55 465.8 L 291.19 465.34 L 290.18 464.69 L 289.71 460.42 L 289.39 459.72 L 288.49 458.77 L 288.26 456.3 L 288.77 454.96 L 288.13 454.17 L 288.04 453.73 L 288.04 450.86 L 287.15 448.89 L 286.55 446.15 L 286.5 445.43 L 287.09 444.07 L 287.11 442.46 L 285.54 441.37 L 285.16 440.57 L 285 438.41 L 283.35 436.59 L 281.18 436.33 L 279.67 436.64 L 277.84 436.35 L 275.38 434.39 L 274.82 432.9 L 273.28 433.23 L 271.11 435.97 L 270.11 435.37 L 268.39 436.18 L 267.31 436.34 L 265.57 435.65 L 263.01 435.16 L 259.55 435.39 L 255.89 434.68 L 255.41 433.77 L 253.42 433.64 L 252.53 434.16 L 250.03 433.28 L 250.94 426.01 L 250.51 423.63 L 251.11 422.21 L 252.09 420.75 L 252.69 414.72 L 252.03 412.39 L 251.98 410.66 L 251.22 409.7 L 250.79 409.61 L 250.3 410.26 L 249.66 407 L 248.87 405.13 L 247.66 403.11 L 247.31 401.28 L 251.34 398.98 L 252.1 398.1 L 247.9 394.24 L 253.28 382.82 L 254.4 382.76 L 254.12 380.63 L 253.38 380.5 L 256.61 370.17 L 257.27 369.01 L 254.18 363.16 L 254.21 361.25 L 254.21 361.25 L 254.91 361.45 L 255.93 362.55 L 258.08 364.07 L 263.7 362.1 L 265.75 360.1 L 267.77 357.15 L 267.86 355.98 L 269.26 354.53 L 271.85 354.56 L 273.41 354.34 L 274.18 354.68 L 275.84 354.17 L 277.19 352.92 L 279.21 352.43 L 280.48 352.63 L 281.24 353.78 L 284.03 355.03 L 286.65 355.5 L 287.3 355.85 L 287.57 356.71 L 288.35 357.73 L 291.38 358.89 L 292.64 360 L 293.88 360.57 L 298.4 359.94 L 299.66 359.14 L 300.15 358.29 L 301.58 357.68 L 304.02 357.75 L 305.61 358.79 L 305.91 360.16 L 306.15 360.41 L 307.14 360.45 L 309.27 359.57 L 310.28 359.63 L 315.9 353.62 L 317.24 353.49 L 316.01 360.1 L 314.21 360.8 L 312.55 363.63 L 312.36 364.09 L 312.51 364.62 L 313.81 364.73 L 315.55 366 L 320.17 366.27 L 320.74 365.7 L 323.4 365.62 L 324.27 365.7 L 325.44 366.27 L 326.99 365.96 L 326.99 365.96 L 327.18 367.73 L 326.92 370.31 L 327.15 371.42 L 327.43 371.83 L 328.09 372.02 L 329.23 371.35 L 331.48 372.25 L 331.56 372.67 L 330.25 374.43 L 329.68 375.6 L 329.42 376.44 L 329.55 376.77 L 333.35 377.47 L 336.13 377.31 L 338.83 378.99 L 339.97 379.16 L 341.41 379.87 L 342.08 380.48 L 345.15 382.04 L 345.83 382.89 L 349.18 384.23 L 350.67 384.27 L 352.57 384.7 L 354.19 386.25 L 357.34 386.86 L 360 389.1 L 360.24 389.55 L 360.24 389.55 L 359.66 389.8 L 358.67 393.98 L 359.26 397.19 z"},{code:"MT",name:"Mato Grosso",gTransform:"matrix(1 0 0 1 -23.8 -38.15)",pathTransform:"translate(-282.2, -281.12)",d:"M 206.96 296.05 L 208.43 294.62 L 212.54 292.05 L 213.06 289.6 L 214.49 285.82 L 215.42 284.74 L 217.06 284.21 L 217.49 283.8 L 218.07 282.96 L 218.59 280.71 L 220.25 278.7 L 220.81 276.46 L 220.88 274.75 L 220.3 273.26 L 220.34 271.21 L 218.81 267.87 L 217.91 267.9 L 217.33 267.39 L 216.9 264.14 L 217.04 262.82 L 218.4 261.74 L 219.8 259.99 L 219.97 259.24 L 218.56 255.65 L 217.49 255.22 L 216.38 255.11 L 212.88 255.2 L 211.66 254.09 L 211.9 253.53 L 194.74 253.48 L 195.64 244.48 L 194.14 241.73 L 193.87 239.97 L 193.9 239.17 L 194.9 235.65 L 194.52 233.72 L 195.46 232.05 L 194.63 229.78 L 194.48 228.39 L 194.22 227.78 L 193.44 227.31 L 193.38 226.96 L 194.67 221.97 L 195.43 220.55 L 194.83 219.31 L 193.43 218.34 L 193.43 218.34 L 241.28 218.02 L 242.49 217.29 L 243.67 212.07 L 245.05 207.85 L 244.59 205.91 L 243.93 204.54 L 243.83 203.69 L 244.25 202.84 L 245.11 202.2 L 246.31 200.38 L 246.58 199.37 L 246.24 198.53 L 246.3 197.77 L 246.5 197.16 L 247.68 195.96 L 247.68 195.96 L 248.85 197.04 L 251.3 201.1 L 251.7 202.86 L 253.07 206.82 L 254.39 208.75 L 255.16 210.37 L 254.93 212.81 L 255.41 215.21 L 256.14 217.41 L 257.67 218.52 L 260.67 221.27 L 264.05 222.97 L 264.28 223.91 L 264.24 225.01 L 264.47 225.5 L 265.42 225.9 L 266.24 225.73 L 267.87 226.18 L 268.41 226.9 L 268.61 227.98 L 268.96 228.3 L 270.33 227.85 L 274.02 229.34 L 308.06 231.76 L 371.03 235.24 L 371.03 235.24 L 370.38 236.26 L 369.82 238.15 L 368.72 239.4 L 368.28 242.54 L 367.85 243.39 L 367.48 243.66 L 365.54 248.95 L 365 251.92 L 364.96 254.87 L 363.08 260.86 L 363.14 261.72 L 364.53 263.06 L 364.37 263.93 L 363.55 264.82 L 363.5 265.32 L 364.6 267.57 L 364.13 270.88 L 364.14 272.45 L 364.66 273.03 L 365.1 276.08 L 364.36 278.84 L 365.34 282.18 L 366.3 282.69 L 367.1 282.71 L 367.1 282.71 L 367.18 283.34 L 366.91 284.47 L 365.94 285.33 L 365.59 286.23 L 365.75 288.95 L 365.36 290.02 L 363.36 293.19 L 362.33 295.82 L 361.12 296.6 L 361.24 301.78 L 359.64 304.87 L 359.06 307.61 L 359.54 308.75 L 359.55 309.55 L 358.38 312.42 L 357.54 315.35 L 356.15 316.78 L 354.94 317.51 L 353.71 316.83 L 352.64 317.09 L 350.99 318.1 L 349.07 320.04 L 348.69 320.78 L 348.05 324.88 L 347.34 325.84 L 345.36 330.03 L 345.04 330.31 L 342.32 331.17 L 339.67 331.3 L 338.27 333.92 L 336.52 334.89 L 336.44 336.43 L 335.62 337.86 L 334.34 338.9 L 333.84 339.91 L 333.51 341.86 L 332.26 343.88 L 330.34 345.65 L 328.32 346.49 L 327.62 347.26 L 327.24 350.17 L 324.69 354.02 L 324.29 357.43 L 324.45 358.14 L 325.86 360.33 L 326.04 363.76 L 326.99 365.96 L 326.99 365.96 L 325.44 366.27 L 324.27 365.7 L 323.4 365.62 L 320.74 365.7 L 320.17 366.27 L 315.55 366 L 313.81 364.73 L 312.51 364.62 L 312.36 364.09 L 312.55 363.63 L 314.21 360.8 L 316.01 360.1 L 317.24 353.49 L 315.9 353.62 L 310.28 359.63 L 309.27 359.57 L 307.14 360.45 L 306.15 360.41 L 305.91 360.16 L 305.61 358.79 L 304.02 357.75 L 301.58 357.68 L 300.15 358.29 L 299.66 359.14 L 298.4 359.94 L 293.88 360.57 L 292.64 360 L 291.38 358.89 L 288.35 357.73 L 287.57 356.71 L 287.3 355.85 L 286.65 355.5 L 284.03 355.03 L 281.24 353.78 L 280.48 352.63 L 279.21 352.43 L 277.19 352.92 L 275.84 354.17 L 274.18 354.68 L 273.41 354.34 L 271.85 354.56 L 269.26 354.53 L 267.86 355.98 L 267.77 357.15 L 265.75 360.1 L 263.7 362.1 L 258.08 364.07 L 255.93 362.55 L 254.91 361.45 L 254.21 361.25 L 254.21 361.25 L 253.55 360.58 L 253.23 359.78 L 253.77 359.07 L 251.33 356.92 L 250.05 357.55 L 249.53 357.5 L 248.36 356.82 L 247.91 356.12 L 245.89 354.71 L 244 353.95 L 243.7 353.63 L 243.4 352.51 L 243.17 349.58 L 242.56 347.81 L 242.37 344.15 L 243.25 342.51 L 244.39 341.42 L 244.73 339.64 L 244.68 337.75 L 243.72 337.81 L 243.32 338.41 L 242.94 338.57 L 216.08 337.49 L 215.03 324.84 L 209.66 318.71 L 214.54 318.65 L 214.19 311.1 L 211.55 305.78 L 211.06 303.81 L 211.32 302.75 L 211.93 302.2 L 212.58 300.92 L 211.14 297.99 L 208.03 296.95 z"},{code:"PA",name:"Pará",gTransform:"matrix(1 0 0 1 29.16 -180.48)",pathTransform:"translate(-335.15, -138.78)",d:"M 371.03 235.24 L 308.05999999999995 231.76000000000002 L 274.0199999999999 229.34000000000003 L 270.3299999999999 227.85000000000002 L 268.9599999999999 228.3 L 268.6099999999999 227.99 L 268.4099999999999 226.9 L 267.8599999999999 226.18 L 266.2299999999999 225.73000000000002 L 265.4099999999999 225.9 L 264.4599999999999 225.51000000000002 L 264.2299999999999 225.01000000000002 L 264.2699999999999 223.91000000000003 L 264.0399999999999 222.97000000000003 L 260.6599999999999 221.27000000000004 L 257.6599999999999 218.51000000000005 L 256.1199999999999 217.40000000000003 L 255.3999999999999 215.20000000000005 L 254.9199999999999 212.81000000000006 L 255.1499999999999 210.37000000000006 L 254.37999999999988 208.74000000000007 L 253.04999999999987 206.81000000000006 L 251.67999999999986 202.86000000000007 L 251.28999999999988 201.10000000000008 L 248.8399999999999 197.04000000000008 L 247.65999999999988 195.96000000000006 L 247.65999999999988 195.96000000000006 L 247.0899999999999 195.40000000000006 L 246.93999999999988 193.44000000000005 L 246.2999999999999 192.18000000000006 L 244.7099999999999 190.62000000000006 L 243.6399999999999 190.04000000000005 L 243.2699999999999 189.47000000000006 L 242.43999999999988 187.13000000000005 L 242.46999999999989 186.00000000000006 L 243.0499999999999 185.03000000000006 L 244.4999999999999 183.90000000000006 L 245.2799999999999 182.59000000000006 L 275.1799999999999 118.35000000000007 L 273.3699999999999 116.68000000000006 L 273.4999999999999 115.90000000000006 L 273.3099999999999 115.42000000000006 L 271.9199999999999 115.77000000000005 L 271.0699999999999 116.38000000000005 L 269.1999999999999 115.60000000000005 L 268.09999999999985 113.43000000000005 L 265.40999999999985 111.98000000000005 L 264.1399999999999 110.64000000000004 L 264.0599999999999 110.04000000000005 L 262.7399999999999 109.22000000000006 L 261.3699999999999 109.07000000000005 L 259.1199999999999 108.42000000000004 L 256.7399999999999 107.11000000000004 L 254.8599999999999 106.44000000000004 L 253.5099999999999 105.35000000000004 L 252.8799999999999 104.45000000000003 L 248.2999999999999 101.91000000000003 L 243.6599999999999 98.14000000000003 L 243.3599999999999 97.70000000000003 L 243.3199999999999 96.77000000000002 L 242.7699999999999 94.94000000000003 L 240.9299999999999 93.71000000000002 L 240.2299999999999 93.90000000000002 L 239.8699999999999 93.70000000000002 L 238.03999999999988 91.72000000000001 L 238.0899999999999 89.61000000000001 L 238.43999999999988 88.92000000000002 L 238.25999999999988 88.51000000000002 L 236.56999999999988 87.66000000000003 L 236.32999999999987 86.98000000000002 L 236.14999999999986 84.71000000000002 L 236.57999999999987 83.26000000000002 L 236.17999999999986 78.40000000000002 L 236.17999999999986 78.40000000000002 L 234.58999999999986 61.43000000000002 L 234.58999999999986 61.43000000000002 L 235.33999999999986 61.75000000000002 L 235.76999999999987 62.33000000000002 L 235.74999999999986 62.81000000000002 L 236.19999999999985 63.210000000000015 L 237.11999999999983 63.490000000000016 L 238.48999999999984 62.780000000000015 L 238.95999999999984 61.97000000000001 L 241.66999999999985 62.20000000000001 L 242.47999999999985 61.15000000000001 L 241.93999999999986 59.34000000000001 L 243.72999999999985 58.98000000000001 L 245.13999999999984 57.35000000000001 L 247.77999999999983 58.36000000000001 L 249.65999999999983 58.39000000000001 L 250.19999999999982 56.870000000000005 L 253.52999999999983 55.25000000000001 L 255.49999999999983 55.64000000000001 L 256.65999999999985 55.53000000000001 L 257.14999999999986 55.28000000000001 L 258.34999999999985 53.80000000000001 L 258.74999999999983 52.40000000000001 L 260.2099999999998 51.30000000000001 L 261.0699999999998 51.19000000000001 L 261.7199999999998 51.65000000000001 L 263.8299999999998 50.52000000000001 L 264.23999999999984 50.63000000000001 L 264.60999999999984 51.62000000000001 L 265.33999999999986 52.070000000000014 L 267.36999999999983 52.55000000000001 L 268.97999999999985 52.80000000000001 L 269.53999999999985 52.20000000000001 L 271.20999999999987 51.81000000000001 L 271.98999999999984 52.09000000000001 L 272.80999999999983 52.08000000000001 L 273.66999999999985 51.74000000000001 L 275.90999999999985 52.040000000000006 L 280.57999999999987 53.42000000000001 L 281.53999999999985 53.28000000000001 L 282.53999999999985 52.41000000000001 L 282.5099999999999 50.13000000000001 L 280.4399999999999 47.63000000000001 L 279.1999999999999 47.00000000000001 L 279.6899999999999 45.32000000000001 L 280.9999999999999 43.870000000000005 L 281.27999999999986 42.760000000000005 L 281.58999999999986 42.59 L 282.29999999999984 42.78 L 283.1299999999998 43.54 L 285.47999999999985 44.65 L 297.09999999999985 42.32 L 298.66999999999985 44.01 L 299.6899999999998 44.07 L 300.1299999999998 43.78 L 300.1299999999998 43.78 L 300.74999999999983 44.35 L 301.11999999999983 46.65 L 300.49999999999983 47.949999999999996 L 300.24999999999983 52.489999999999995 L 300.48999999999984 53.92999999999999 L 300.79999999999984 54.46999999999999 L 301.96999999999986 54.489999999999995 L 303.04999999999984 54.199999999999996 L 306.4399999999998 54.56999999999999 L 307.72999999999985 55.059999999999995 L 309.65999999999985 56.10999999999999 L 310.32999999999987 56.90999999999999 L 310.8199999999999 58.18999999999999 L 312.0099999999999 58.30999999999999 L 313.14999999999986 59.14999999999999 L 313.9499999999999 60.12999999999999 L 314.78999999999985 60.39999999999999 L 316.11999999999983 60.25999999999999 L 316.49999999999983 59.83999999999999 L 317.4399999999998 59.69999999999999 L 320.2799999999998 62.359999999999985 L 320.9599999999998 62.329999999999984 L 321.4499999999998 63.509999999999984 L 320.7699999999998 63.73999999999998 L 320.5799999999998 64.45999999999998 L 321.3399999999998 67.28999999999998 L 323.3599999999998 69.54999999999998 L 325.9299999999998 70.27999999999999 L 326.0999999999998 70.60999999999999 L 325.6699999999998 73.74999999999999 L 325.8599999999998 75.85999999999999 L 326.5299999999998 77.36999999999999 L 327.1499999999998 77.92999999999999 L 327.7399999999998 79.74 L 327.6099999999998 81.32 L 329.1099999999998 84.8 L 329.9299999999998 84.99 L 330.70999999999975 84.63 L 333.63999999999976 87.91 L 333.5599999999998 90.34 L 333.9699999999998 91.28 L 334.9199999999998 91.47 L 335.2499999999998 91.94 L 335.5599999999998 93.52 L 335.3499999999998 94.21 L 335.4599999999998 95.50999999999999 L 337.3299999999998 96.89999999999999 L 337.7599999999998 98.39999999999999 L 339.2099999999998 99.42999999999999 L 341.99999999999983 100.11 L 343.29999999999984 99.99 L 344.0699999999998 99.64999999999999 L 345.0099999999998 99.71 L 345.0099999999998 99.71 L 344.47999999999985 100.44999999999999 L 344.76999999999987 102.03999999999999 L 344.59999999999985 102.57 L 343.30999999999983 103.67999999999999 L 341.91999999999985 103.85 L 341.41999999999985 103.66999999999999 L 340.57999999999987 102.87999999999998 L 339.91999999999985 102.72999999999998 L 336.53999999999985 104.30999999999997 L 336.16999999999985 104.84999999999998 L 334.5699999999998 105.56999999999998 L 333.9399999999998 105.54999999999998 L 332.3899999999998 106.13999999999999 L 332.42999999999984 106.71999999999998 L 338.8899999999998 105.65999999999998 L 339.7699999999998 106.31999999999998 L 339.8999999999998 106.77999999999997 L 339.8999999999998 107.43999999999997 L 339.2799999999998 107.93999999999997 L 339.5799999999998 108.29999999999997 L 340.2099999999998 108.09999999999997 L 341.0699999999998 107.09999999999997 L 342.0899999999998 107.08999999999996 L 342.6199999999998 106.81999999999996 L 343.2199999999998 106.93999999999997 L 344.2899999999998 106.51999999999997 L 345.4299999999998 105.94999999999997 L 348.70999999999975 103.60999999999997 L 350.20999999999975 103.25999999999998 L 352.0499999999997 102.44999999999997 L 355.20999999999975 100.60999999999997 L 355.7499999999998 99.60999999999997 L 356.4199999999998 99.08999999999997 L 358.50999999999976 98.07999999999997 L 359.1699999999998 97.35999999999997 L 358.9199999999998 96.68999999999997 L 359.12999999999977 96.27999999999997 L 360.25999999999976 95.99999999999997 L 361.34999999999974 96.05999999999997 L 361.75999999999976 96.26999999999997 L 362.13999999999976 100.06999999999996 L 361.6199999999998 102.64999999999996 L 361.94999999999976 104.26999999999997 L 362.75999999999976 105.86999999999996 L 364.06999999999977 107.21999999999996 L 364.3699999999998 108.85999999999996 L 364.2499999999998 109.32999999999996 L 362.4099999999998 111.16999999999996 L 361.93999999999977 111.29999999999995 L 361.06999999999977 110.77999999999996 L 359.2499999999998 110.25999999999996 L 357.9899999999998 109.94999999999996 L 357.0599999999998 110.08999999999996 L 354.9299999999998 109.04999999999995 L 354.6699999999998 107.92999999999995 L 353.7899999999998 107.39999999999995 L 351.5099999999998 111.21999999999994 L 350.8999999999998 113.58999999999995 L 351.5799999999998 116.55999999999995 L 352.05999999999983 117.19999999999995 L 352.97999999999985 117.81999999999995 L 351.96999999999986 116.67999999999995 L 351.53999999999985 113.98999999999995 L 351.65999999999985 113.46999999999996 L 354.22999999999985 109.24999999999996 L 356.53999999999985 110.42999999999996 L 356.64999999999986 110.87999999999997 L 359.17999999999984 113.32999999999997 L 358.92999999999984 115.34999999999997 L 358.1899999999998 115.89999999999996 L 358.5899999999998 118.22999999999996 L 359.1099999999998 119.35999999999996 L 360.2299999999998 120.10999999999996 L 360.9699999999998 120.25999999999996 L 361.4899999999998 120.74999999999996 L 361.1499999999998 120.10999999999996 L 360.3799999999998 119.86999999999996 L 359.17999999999984 118.82999999999996 L 358.9599999999998 118.14999999999995 L 359.2999999999998 113.94999999999995 L 360.1199999999998 112.75999999999995 L 361.5499999999998 113.48999999999995 L 362.37999999999977 114.68999999999996 L 362.2899999999998 115.47999999999996 L 363.4899999999998 116.33999999999996 L 363.7399999999998 116.04999999999995 L 362.7399999999998 114.78999999999995 L 361.81999999999977 112.68999999999996 L 361.81999999999977 112.24999999999996 L 364.07999999999976 109.92999999999996 L 365.69999999999976 110.01999999999997 L 367.62999999999977 110.65999999999997 L 367.96999999999974 111.21999999999997 L 367.35999999999973 111.80999999999997 L 367.6799999999997 112.08999999999997 L 368.15999999999974 112.11999999999998 L 369.1899999999997 111.94999999999997 L 370.5199999999997 111.04999999999997 L 374.6099999999997 110.08999999999997 L 375.37999999999965 110.28999999999998 L 377.11999999999966 111.34999999999998 L 380.2899999999997 110.92999999999998 L 381.3599999999997 110.51999999999998 L 382.37999999999965 109.50999999999998 L 383.3599999999997 108.91999999999997 L 385.0999999999997 108.40999999999997 L 385.86999999999966 108.47999999999996 L 385.92999999999967 109.22999999999996 L 383.88999999999965 113.24999999999996 L 383.64999999999964 114.74999999999996 L 383.18999999999966 115.81999999999995 L 382.3599999999997 116.84999999999995 L 382.3499999999997 117.72999999999995 L 382.92999999999967 119.14999999999995 L 382.6099999999997 121.61999999999995 L 383.48999999999967 120.42999999999995 L 383.49999999999966 119.02999999999994 L 385.0399999999997 116.02999999999994 L 386.1699999999997 112.83999999999995 L 387.2899999999997 111.27999999999994 L 387.55999999999966 111.00999999999995 L 388.31999999999965 110.95999999999995 L 388.89999999999964 110.60999999999996 L 390.71999999999963 110.37999999999995 L 391.5999999999996 109.02999999999996 L 393.1099999999996 107.33999999999996 L 394.46999999999963 105.07999999999996 L 394.9899999999996 104.61999999999996 L 395.77999999999963 105.10999999999996 L 396.39999999999964 104.64999999999996 L 398.01999999999964 106.98999999999997 L 399.20999999999964 107.57999999999997 L 399.1599999999996 106.83999999999997 L 398.8099999999996 106.08999999999997 L 399.4299999999996 105.07999999999997 L 402.9399999999996 104.56999999999996 L 401.9099999999996 104.24999999999997 L 398.39999999999964 104.70999999999997 L 398.08999999999963 104.49999999999997 L 398.37999999999965 102.06999999999996 L 398.88999999999965 101.77999999999996 L 399.55999999999966 102.15999999999995 L 400.57999999999964 102.26999999999995 L 401.64999999999964 99.16999999999996 L 400.96999999999963 97.77999999999996 L 400.9999999999996 97.09999999999995 L 402.1699999999996 95.28999999999995 L 405.0099999999996 92.80999999999995 L 405.3699999999996 92.72999999999995 L 406.4799999999996 93.86999999999995 L 409.4099999999996 91.77999999999994 L 409.8699999999996 91.70999999999995 L 410.2699999999996 92.15999999999995 L 410.3699999999996 92.72999999999995 L 410.0499999999996 93.39999999999995 L 411.1199999999996 93.23999999999995 L 411.9299999999996 92.65999999999995 L 412.2899999999996 91.87999999999995 L 412.9199999999996 91.68999999999996 L 413.1999999999996 91.83999999999996 L 413.9399999999996 93.22999999999996 L 415.2699999999996 94.42999999999996 L 415.4699999999996 93.86999999999996 L 415.35999999999956 93.48999999999997 L 414.4 93 L 414.26 92.71 L 414.13 91.50999999999999 L 414.3 91.08999999999999 L 414.74 90.89999999999999 L 417.02 91.16 L 418.2 91.81 L 418.82 92.83 L 420.45 93.53999999999999 L 422.09999999999997 92.75999999999999 L 422.62999999999994 94.89999999999999 L 422.12999999999994 95.21 L 422.09999999999997 95.8 L 423.02 95.28 L 424.18 92.93 L 424.56 93.16000000000001 L 424.33 94.49000000000001 L 424.74 94.93 L 427.25 94.67 L 427.7 95.32000000000001 L 428.15999999999997 97.00000000000001 L 427.55999999999995 97.95000000000002 L 428.40999999999997 97.45000000000002 L 428.66999999999996 97.82000000000002 L 430.55999999999995 97.96000000000002 L 434.0899999999999 96.72000000000003 L 433.7799999999999 98.30000000000003 L 433.0299999999999 100.13000000000002 L 434.49999999999994 99.64000000000003 L 435.0899999999999 99.02000000000002 L 435.7199999999999 100.64000000000003 L 435.7199999999999 100.64000000000003 L 434.94999999999993 101.09000000000003 L 434.4799999999999 102.12000000000003 L 434.63999999999993 103.50000000000003 L 433.92999999999995 107.89000000000003 L 433.35999999999996 108.63000000000002 L 432.21999999999997 108.78000000000003 L 432.16999999999996 109.40000000000003 L 432.43999999999994 109.89000000000003 L 433.42999999999995 109.73000000000003 L 433.85999999999996 110.26000000000003 L 433.78 111.87000000000003 L 432.88 114.89000000000003 L 432.52 115.60000000000002 L 430.78 117.17000000000002 L 430.28 119.55000000000001 L 430.40999999999997 121.19000000000001 L 426.72999999999996 124.28000000000002 L 427.77 125.86000000000001 L 426.97999999999996 126.67000000000002 L 427.15999999999997 128.49 L 426.7 129.77 L 425.87 131.22 L 424.39 132.98 L 422.43 134.51999999999998 L 420.83 139.20999999999998 L 420.53999999999996 141.10999999999999 L 420.06999999999994 142.32 L 417.62999999999994 144.64 L 416.50999999999993 145.1 L 415.88999999999993 147.98 L 414.3399999999999 149.14999999999998 L 413.9099999999999 150.29999999999998 L 412.3599999999999 152.46999999999997 L 411.1899999999999 153.38999999999996 L 408.83999999999986 153.15999999999997 L 394.1299999999999 164.98999999999998 L 394.6199999999999 165.07 L 394.6199999999999 165.07 L 396.9099999999999 165.88 L 398.7799999999999 165.64 L 400.06999999999994 165.76 L 401.0899999999999 167.42 L 401.4799999999999 167.73 L 402.3499999999999 167.86999999999998 L 403.6099999999999 169.03999999999996 L 403.5699999999999 169.66999999999996 L 403.1999999999999 170.33999999999995 L 402.47999999999985 170.70999999999995 L 401.5099999999998 170.77999999999994 L 401.2199999999998 171.05999999999995 L 401.3099999999998 172.46999999999994 L 402.31999999999977 173.80999999999995 L 401.39999999999975 176.55999999999995 L 400.75999999999976 177.03999999999994 L 399.2999999999998 177.49999999999994 L 399.0499999999998 177.95999999999995 L 399.3399999999998 179.15999999999994 L 399.1499999999998 180.49999999999994 L 397.8499999999998 180.64999999999995 L 396.3399999999998 181.98999999999995 L 395.4899999999998 183.25999999999996 L 395.63999999999976 184.76999999999995 L 395.39999999999975 185.26999999999995 L 392.89999999999975 186.46999999999994 L 389.4899999999997 187.60999999999993 L 387.0199999999997 189.38999999999993 L 386.8299999999997 189.73999999999992 L 387.2599999999997 191.92999999999992 L 387.3199999999997 194.5999999999999 L 386.03999999999974 196.6999999999999 L 384.6299999999997 198.3799999999999 L 384.47999999999973 198.9499999999999 L 384.64999999999975 199.8299999999999 L 385.2399999999997 200.7899999999999 L 386.90999999999974 202.52999999999992 L 387.65999999999974 202.8499999999999 L 387.8099999999997 203.14999999999992 L 387.1499999999997 207.1899999999999 L 385.3899999999997 212.33999999999992 L 384.3099999999997 213.14999999999992 L 382.60999999999973 216.38999999999993 L 382.4299999999997 217.37999999999994 L 381.4899999999997 218.91999999999993 L 380.7499999999997 219.76999999999992 L 379.6999999999997 219.92999999999992 L 378.3299999999997 220.8499999999999 L 377.2999999999997 222.7699999999999 L 376.08999999999975 224.4499999999999 L 374.90999999999974 225.5399999999999 L 373.75999999999976 227.11999999999992 L 372.62999999999977 231.57999999999993 L 371.03 235.24 z M 392.19 104.93 L 387.67 106.89 L 384.28000000000003 107.41 L 382.26000000000005 107.1 L 381.61000000000007 108.22999999999999 L 379.7700000000001 109.41999999999999 L 379.05000000000007 108.80999999999999 L 378.44000000000005 107.27999999999999 L 378.21000000000004 107.55999999999999 L 378.63000000000005 108.78999999999999 L 378.2900000000001 109.6 L 377.5800000000001 110.00999999999999 L 373.8100000000001 108.36999999999999 L 373.0100000000001 109.08999999999999 L 368.8200000000001 110.35 L 365.6200000000001 109.78 L 364.8100000000001 109.17 L 364.5700000000001 107.32000000000001 L 364.3400000000001 106.91000000000001 L 363.2300000000001 105.89000000000001 L 362.1700000000001 104.29000000000002 L 361.9600000000001 102.51000000000002 L 362.4800000000001 99.76000000000002 L 363.1000000000001 99.38000000000002 L 364.86000000000007 99.74000000000002 L 365.7900000000001 98.99000000000002 L 365.87000000000006 98.43000000000002 L 364.57000000000005 98.86000000000003 L 363.35 98.73000000000003 L 362.41 98.02000000000004 L 362.23 96.97000000000004 L 362.57 91.89000000000004 L 363.3 91.13000000000004 L 363.65000000000003 91.88000000000004 L 365.41 92.48000000000003 L 365.96000000000004 92.42000000000003 L 365.50000000000006 92.00000000000003 L 364.2300000000001 91.78000000000003 L 363.3300000000001 89.62000000000003 L 363.6900000000001 87.94000000000003 L 364.5800000000001 85.97000000000003 L 365.9100000000001 84.64000000000003 L 366.87000000000006 84.07000000000004 L 368.21000000000004 83.58000000000004 L 369.53000000000003 83.45000000000005 L 372.99 83.97000000000004 L 380.2 85.74000000000004 L 383.9 85.28000000000004 L 384.01 84.98000000000005 L 385.15 84.36000000000004 L 387.31 83.99000000000004 L 390.2 84.28000000000004 L 393 85.10000000000004 L 399.48 85.95000000000003 L 400.11 86.42000000000003 L 400.06 87.65000000000003 L 399.36 88.39000000000003 L 398.68 89.89000000000003 L 398.32 92.54000000000003 L 397.46 95.84000000000003 L 396.16999999999996 96.52000000000004 L 395.81999999999994 97.21000000000004 L 396.04999999999995 98.40000000000003 L 394.06999999999994 100.98000000000003 L 392.67999999999995 104.48000000000003 L 392.19 104.93 z M 344.98 104.76 L 344.23 104.25 L 345.33000000000004 102 L 345.24000000000007 100.21 L 345.49000000000007 100 L 347.82000000000005 99.52 L 348.72 98.66 L 348.87 98.16 L 348.67 95.82 L 349.53000000000003 93.24 L 350.79 91.75 L 353.08000000000004 90.28 L 355.95000000000005 90.08 L 356.6700000000001 92.44 L 355.57000000000005 94.63 L 354.72 97.67 L 353.62 98.34 L 352.28000000000003 100.37 L 351.50000000000006 101.09 L 346.56000000000006 104.4 L 344.98 104.76 z M 373.46 81.86 L 372.43 81.61 L 369.98 81.69 L 369.19 81.53 L 368.9 81.27 L 368.52 80.17999999999999 L 368.53 78.94 L 370.03999999999996 78.52 L 371.92999999999995 78.56 L 374.11999999999995 77.27 L 378.92999999999995 76.67 L 379.69999999999993 76.93 L 380.37999999999994 77.61000000000001 L 380.19999999999993 78.63000000000001 L 377.63999999999993 80.02000000000001 L 375.85999999999996 82.50000000000001 L 374.76 83 L 373.46 81.86 z M 378.25 81.86 L 380.11 80.66 L 382.09000000000003 80.69 L 383.74 81.31 L 384.27 82.3 L 384.32 82.92 L 383.44 83.69 L 380.59 83.97 L 379.41999999999996 84.28999999999999 L 377.15999999999997 83.39999999999999 L 376.96 82.86999999999999 L 378.25 81.86 z M 361.27 86.25 L 360.77 85.99 L 360.15999999999997 86.03 L 358.61999999999995 85.34 L 358.8299999999999 84.18 L 359.4699999999999 83.26 L 361.38999999999993 82.86 L 363.74999999999994 81.96 L 365.06999999999994 82.03999999999999 L 365.86999999999995 82.72 L 365.9599999999999 82.85 L 364.0299999999999 84.46 L 362.9599999999999 84.8 L 361.27 86.25 z M 370.69 76.56 L 369.87 76.26 L 369.7 74.60000000000001 L 369.84999999999997 74.00000000000001 L 371.02 72.69000000000001 L 373.46999999999997 71.77000000000001 L 373.71999999999997 71.89000000000001 L 374.24999999999994 72.57000000000002 L 374.28999999999996 73.46000000000002 L 372.34 75.45000000000002 L 370.69 76.56 z M 356.86 96.78 L 356.72 96.37 L 356.91 95.44 L 357.95000000000005 92.63 L 360.54 90.94 L 361.26000000000005 90.66 L 361.95000000000005 90.8 L 361.79 92.59 L 360.23 93.03 L 358.61 95.22 L 356.86 96.78 z M 367.77 79.21 L 366.58 78.89999999999999 L 366.28 78.41999999999999 L 367.15999999999997 77.46 L 367.86999999999995 73.50999999999999 L 368.75999999999993 72.27999999999999 L 369.04999999999995 72.40999999999998 L 369.11999999999995 72.72999999999998 L 369.09999999999997 75.20999999999998 L 369.7 77.07999999999998 L 369.38 77.95999999999998 L 368.35 78.35999999999999 L 367.77 79.21 z M 352.96 89.4 L 352.69 89.21000000000001 L 352.81 88.60000000000001 L 353.36 88.24000000000001 L 354.55 86.53000000000002 L 355.31 84.99000000000001 L 356.04 84.33000000000001 L 357.49 83.79 L 357.29 85.28 L 356.89000000000004 86.28 L 355.17 87.94 L 352.96 89.4 z M 366.83 82.37 L 366.22999999999996 82.22 L 365.39 81.51 L 364.43 79.87 L 364.38 79.49000000000001 L 364.61 79.2 L 365.42 78.62 L 367.27000000000004 79.46000000000001 L 367.56000000000006 79.89000000000001 L 367.80000000000007 81.98000000000002 L 366.83 82.37 z M 361.45 112.93 L 360.8 112.82000000000001 L 359.92 112.30000000000001 L 359.23 112.76 L 358.48 112.48 L 356.8 110.74000000000001 L 356.8 110.13000000000001 L 358.08 110.12 L 361.14 111.44 L 361.45 112.93 z M 340.3 107.39 L 340.34000000000003 106.36 L 340.14000000000004 106.06 L 340.74000000000007 105.07000000000001 L 343.1000000000001 104.19000000000001 L 343.88000000000005 104.57000000000001 L 344.75000000000006 105.43 L 344.46000000000004 105.78 L 343.43000000000006 106.25 L 340.89000000000004 106.66 L 340.3 107.39 z M 353 100.7 L 352.82 100.67 L 352.83 100.32000000000001 L 353.37 99.38000000000001 L 355.16 97.76 L 355.58000000000004 96.52000000000001 L 355.63000000000005 95.22000000000001 L 355.87000000000006 94.92000000000002 L 356.19000000000005 95.36000000000001 L 356.19000000000005 96.87000000000002 L 355.30000000000007 99.60000000000002 L 354.68000000000006 100.25000000000003 L 353 100.7 z M 359.3 90.8 L 360.95 87.84 L 361.83 87.63000000000001 L 362.53999999999996 87.82000000000001 L 362.80999999999995 88.69000000000001 L 362.22999999999996 89.4 L 359.3 90.8 z M 390.72 109.77 L 389.88000000000005 109.42 L 389.5400000000001 108.36 L 390.5800000000001 106.64 L 391.6500000000001 106.31 L 391.8400000000001 106.41 L 391.8200000000001 107.14999999999999 L 391.0800000000001 109.38999999999999 L 390.72 109.77 z M 357.24 90.3 L 356.7 90.1 L 357.02 88.05999999999999 L 358.34999999999997 86.24999999999999 L 358.58 86.28999999999999 L 359.87 87.16999999999999 L 359.86 87.41999999999999 L 358.31 88.05999999999999 L 357.24 90.3 z M 359.47 95.33 L 360.19000000000005 95.36 L 359.7900000000001 95.81 L 358.8500000000001 96.12 L 358.74000000000007 97.24000000000001 L 357.95000000000005 97.95 L 356.26000000000005 98.79 L 356.1 98.61 L 356.37 97.78 L 356.84000000000003 97.15 L 358.57000000000005 95.48 L 359.47 95.33 z M 336.91 105.54 L 336.36 105.35000000000001 L 336.29 105.00000000000001 L 336.72 104.60000000000001 L 340.28000000000003 103.00000000000001 L 340.82000000000005 103.70000000000002 L 340.81000000000006 103.90000000000002 L 339.4100000000001 104.63000000000002 L 336.91 105.54 z M 400.44 100.76 L 399.41 100.57000000000001 L 398.59000000000003 99.78 L 399.46000000000004 98.53 L 400.8 98.52 L 400.99 99.71 L 400.89 100.3 L 400.44 100.76 z M 363.19 81.86 L 360.83 82.56 L 360.24 82.57000000000001 L 360.06 82.36000000000001 L 361.09 81.32000000000001 L 362.13 80.81 L 363.17 80.98 L 363.61 81.32000000000001 L 363.76 81.55000000000001 L 363.61 81.76 L 363.19 81.86 z M 357.92 90.45 L 357.84000000000003 89.69 L 358.09000000000003 89.19 L 360.57000000000005 87.73 L 359.6700000000001 89.73 L 358.86000000000007 90.36 L 357.92 90.45 z M 360.06 94.98 L 359.61 94.86 L 359.54 94.63 L 360.32 93.13 L 361.51 93.14999999999999 L 361.39 94.49999999999999 L 360.06 94.98 z M 388.1 110.81 L 387.82000000000005 110.58 L 388.72 108.98 L 389.40000000000003 108.58 L 389.63000000000005 109.33 L 390.14000000000004 109.7 L 389.88000000000005 110.22 L 389.45000000000005 110.56 L 388.82000000000005 110.38 L 388.1 110.81 z M 361.44 87.49 L 360.55 87.42 L 360.57 87.23 L 362.93 85.39 L 362.97 86.35 L 362.74 86.97999999999999 L 362.49 87.32 L 361.44 87.49 z M 428.9 97.71 L 428.52 97.17999999999999 L 428.71 96.41999999999999 L 429.72999999999996 95.50999999999999 L 429.97999999999996 95.66 L 430.21 97.41 L 428.9 97.71 z"},{code:"PB",name:"Paraíba",gTransform:"matrix(1 0 0 1 275.13 -126.21)",pathTransform:"translate(-581.13, -193.05)",d:"M 610.43 199.15 L 607.93 197.09 L 607.11 196.83 L 604.46 196.62 L 602.15 197.69 L 600.67 198.97 L 600.22 200.77 L 598.32 201.8 L 596.31 202.25 L 595.17 202.23 L 595.17 202.83 L 594.37 203.36 L 592.19 203.65 L 588.31 203.39 L 586.7 204.27 L 586.15 204.91 L 584.33 205.01 L 583.44 205.7 L 582.9 206.46 L 583.29 207.19 L 583.3 207.73 L 582.9 208.21 L 581.12 209.74 L 579.78 209.9 L 578.13 210.74 L 576.53 209.95 L 575.58 209.01 L 575.23 206.77 L 575.47 206.28 L 575.29 205.98 L 574.15 205.66 L 573.71 205.95 L 572.2 206.2 L 572.24 205.75 L 574.77 203.11 L 574.94 202.68 L 574.22 200.81 L 574.18 200.34 L 574.55 199.56 L 577.55 198.49 L 577.66 198.19 L 577.16 196.8 L 573.66 194.88 L 572.18 195.29 L 569.96 196.55 L 569.03 198.06 L 567.55 198.93 L 566.5 199.24 L 563.8 201.12 L 562.28 202.76 L 560.65 202.99 L 558.02 203.96 L 557.25 203.63 L 557.3 202.95 L 556.67 201.71 L 556.29 201.63 L 555.36 202.36 L 553.85 202.68 L 552.86 202.35 L 551.46 200.44 L 551.06 200.35 L 551.06 200.35 L 550.89 200.1 L 552.08 198.98 L 553.69 195.49 L 553.35 194.3 L 552.66 194.22 L 551.42 193.33 L 551.44 191.67 L 551.09 190.95 L 550.51 190.66 L 550.27 190.25 L 550.39 189.32 L 550.56 188.94 L 551.65 188.31 L 552.31 187 L 551.79 185.69 L 552.82 182.69 L 553.66 181.54 L 553.74 181 L 553.74 181 L 554.31 180.54 L 556.24 182.18 L 557.14 182.6 L 560.02 183.21 L 561.18 182.08 L 564.41 180.42 L 565.23 179.71 L 565.33 178.67 L 565.74 177.72 L 568.92 176.51 L 570.35 176.39 L 573.61 175.35 L 574.25 175.43 L 574.78 175.87 L 574.79 177.06 L 571.8 180.27 L 571.36 181.23 L 570.98 182.97 L 570.57 183.35 L 569.72 183.6 L 569.51 183.91 L 569.43 185.63 L 572.96 186.15 L 573.28 186.38 L 573.59 187.76 L 573.88 187.99 L 577.03 186.73 L 578.8 186.65 L 580.75 186.95 L 581.64 188.12 L 581.12 189.66 L 581.95 190.4 L 584.3 189.47 L 584.8 188.73 L 585.35 187.52 L 584.88 186.58 L 584.72 185.16 L 585.2 184.57 L 586.21 184.89 L 585.68 183.36 L 584.96 182.58 L 585.27 181.1 L 587.09 179.75 L 588.47 179.7 L 588.89 180.09 L 588.79 181.09 L 589.41 181.58 L 592.83 181.98 L 593.36 182.33 L 599.19 181.94 L 601.36 182.24 L 603.82 183.34 L 604.86 182.94 L 608.36 183.15 L 609.29 182.91 L 609.29 182.91 L 609.38 185.31 L 610.83 189.7 L 610.89 190.34 L 610.71 191.28 L 610.34 191.73 L 610.31 192.61 L 610.89 191.87 L 611.4 190.37 L 611.41 192.35 L 612 193.36 L 611.73 198.54 L 611.37 199.14 z"},{code:"PE",name:"Pernambuco",gTransform:"matrix(1 0 0 1 254.6 -106.99)",pathTransform:"translate(-560.6, -212.26)",d:"M 558.28 227.19 L 557.06 224.15 L 557.05 223.21 L 554.94 222.35 L 554.44 221.98 L 553.99 221.15 L 554.6 220.26 L 554.58 219.64 L 554.13 219.32 L 553.13 219.33 L 552.7 219.77 L 552.41 221.51 L 551.98 221.66 L 551.59 221.4 L 551.05 219.75 L 549.47 218.6 L 546.48 218.2 L 544.12 217.43 L 542.77 216.62 L 541.94 215.18 L 540.45 214.62 L 539.86 214.73 L 537.33 216.19 L 535.68 216.63 L 534.91 218.68 L 532.68 219.13 L 532.39 219.38 L 532.64 220.74 L 532.47 221.33 L 531.37 222.57 L 528.98 223.6 L 528.34 223.54 L 527.57 223.01 L 526.81 223.18 L 526.31 224.05 L 525.54 227.62 L 522.67 228.5 L 521.85 229.42 L 520.89 229.65 L 519.05 229.03 L 519.97 227.35 L 519.71 225.35 L 517.5 224.44 L 516.78 222.5 L 516.84 219.77 L 516.4 219.26 L 513.59 217.88 L 511.39 217.59 L 510.23 217.85 L 509.33 217.45 L 509.33 217.45 L 511.95 216.18 L 513.92 214.47 L 514.46 213.6 L 516.75 212.27 L 517.72 211.99 L 521.61 208.12 L 522.35 206.36 L 522.41 204.09 L 522.12 203.55 L 520.5 201.97 L 520.57 199.78 L 519.97 198.65 L 519.91 197.7 L 520.02 197.25 L 520.54 196.92 L 522.33 196.76 L 522.33 196.76 L 527.26 196.96 L 528.15 197.2 L 529.78 197.01 L 531.92 196.21 L 533.21 196.11 L 536.29 196.53 L 539.14 198.43 L 540.97 199.26 L 541.43 200.25 L 542.44 201.32 L 543.8 201.8 L 544.58 202.37 L 545.21 204.01 L 546.86 203.96 L 548.4 201.67 L 549.47 200.84 L 551.06 200.35 L 551.06 200.35 L 551.46 200.44 L 552.86 202.35 L 553.85 202.68 L 555.36 202.36 L 556.29 201.63 L 556.67 201.71 L 557.3 202.95 L 557.25 203.63 L 558.02 203.96 L 560.65 202.99 L 562.28 202.76 L 563.8 201.12 L 566.5 199.24 L 567.55 198.93 L 569.03 198.06 L 569.96 196.55 L 572.18 195.29 L 573.66 194.88 L 577.16 196.8 L 577.66 198.19 L 577.55 198.49 L 574.55 199.56 L 574.18 200.34 L 574.22 200.81 L 574.94 202.68 L 574.77 203.11 L 572.24 205.75 L 572.2 206.2 L 573.71 205.95 L 574.15 205.66 L 575.29 205.98 L 575.47 206.28 L 575.23 206.77 L 575.58 209.01 L 576.53 209.95 L 578.13 210.74 L 579.78 209.9 L 581.12 209.74 L 582.9 208.21 L 583.3 207.73 L 583.29 207.19 L 582.9 206.46 L 583.44 205.7 L 584.33 205.01 L 586.15 204.91 L 586.7 204.27 L 588.31 203.39 L 592.19 203.65 L 594.37 203.36 L 595.17 202.83 L 595.17 202.23 L 596.31 202.25 L 598.32 201.8 L 600.22 200.77 L 600.67 198.97 L 602.15 197.69 L 604.46 196.62 L 607.11 196.83 L 607.93 197.09 L 610.43 199.15 L 610.43 199.15 L 611.31 199.38 L 611.86 200.6 L 610.59 202.32 L 610.48 202.87 L 610.49 203.35 L 611.19 203.72 L 611.46 204.22 L 611.65 205.28 L 609.69 211.66 L 606.44 220.61 L 606.44 220.61 L 606.17 220.4 L 603.27 220.13 L 601.35 219.32 L 599.88 219.51 L 597.32 220.8 L 595.08 219.95 L 593.08 220.19 L 591.53 221.43 L 591.41 221.88 L 589.23 224.17 L 587.42 225.28 L 586.26 225.23 L 584.4 226.29 L 583.23 226.4 L 580.09 226.11 L 577.59 226.76 L 575.68 226.28 L 573.9 225.23 L 572 223.11 L 569.45 221.09 L 568.37 221.21 L 566.7 220.91 L 565.7 219.69 L 564.88 220.29 L 564.79 220.98 L 562.41 224.27 L 560.24 225.03 L 559.6 226.12 z"},{code:"PI",name:"Piauí",gTransform:"matrix(1 0 0 1 174.84 -130.97)",pathTransform:"translate(-480.85, -188.29)",d:"M 505.7 126.91 L 507.01 127.03 L 507.7 126.8 L 509.94 127.31 L 510.93 128.16 L 511.25 128.76 L 511.25 128.76 L 511.14 129.56 L 510.05 131.41 L 508.47 133.38 L 508.29 134.84 L 508.58 136.13 L 510.38 140.85 L 513.53 147.27 L 513.97 149 L 515.33 150.59 L 515.31 151.35 L 514.57 152.71 L 515.36 156.58 L 514.88 158.18 L 515.88 160.19 L 516.48 163.18 L 515.89 164.76 L 515.09 165.34 L 516.01 166.03 L 516.12 166.41 L 517.06 174.57 L 516.82 175.02 L 517.58 177.59 L 518.63 182.79 L 519.64 185.46 L 520.95 186.11 L 523.51 186.58 L 524.28 187.74 L 524.27 188.43 L 522.77 190.68 L 521.63 193.79 L 521.71 194.76 L 522.39 195.44 L 522.33 196.76 L 522.33 196.76 L 520.54 196.92 L 520.02 197.25 L 519.91 197.7 L 519.97 198.65 L 520.57 199.78 L 520.5 201.97 L 522.12 203.55 L 522.41 204.09 L 522.35 206.36 L 521.61 208.12 L 517.72 211.99 L 516.75 212.27 L 514.46 213.6 L 513.92 214.47 L 511.95 216.18 L 509.33 217.45 L 509.33 217.45 L 508.88 218.61 L 507.38 220.91 L 506.33 221.58 L 505.54 221.4 L 503.54 221.78 L 503.65 224.18 L 501.79 225.98 L 501.47 225.93 L 500.85 225.31 L 498.69 225.3 L 497.87 226.28 L 497.1 226.64 L 494.37 226.98 L 492.86 228.32 L 492.04 229.54 L 490.34 229.64 L 488.86 230.28 L 485.86 230.39 L 485.04 230.11 L 484.85 229.83 L 484.98 229.17 L 483.27 228.19 L 481.94 227.8 L 480.55 228.35 L 478.42 228.78 L 478.1 228.6 L 477.69 227.67 L 476.19 227.21 L 474.24 227.23 L 471 228.88 L 470.94 229.81 L 473.18 234.25 L 473.3 235.4 L 473.01 237.97 L 472.76 238.88 L 472.04 239.74 L 469.09 244.79 L 466.12 247.21 L 464.77 247.63 L 463.29 247.1 L 461.95 246.93 L 459.75 247.68 L 458.58 248.57 L 457.91 249.44 L 456.77 249.82 L 456.02 251.27 L 455.69 251.48 L 453.58 251.3 L 451.78 251.82 L 447.6 249.97 L 445.83 247.48 L 445.3 245.27 L 444.64 244.23 L 443.2 242.89 L 440.87 242.91 L 440.87 242.91 L 437.93 242.7 L 437.93 242.7 L 437.98 240.78 L 438.24 239.72 L 439.39 237.27 L 439.52 230.91 L 440.28 229.51 L 440.31 229 L 438.58 225.94 L 438.11 222.75 L 437.41 220.81 L 438.14 218.81 L 439.84 217.41 L 441.04 214.93 L 441.17 213.42 L 441.51 212.59 L 441.81 212.38 L 443.25 209.64 L 443.88 207.32 L 444.27 204.35 L 445.25 201.37 L 447.38 199.42 L 450.1 198.66 L 452.71 198.35 L 453.78 197.98 L 455.48 196.45 L 456.53 196.41 L 457.87 195.89 L 460.73 193.32 L 463.07 192.41 L 465.08 190.41 L 465.71 189.54 L 465.71 189.08 L 467.61 187.16 L 468.11 186.94 L 468.95 186.7 L 469.18 187 L 470.3 186.74 L 471.3 186.14 L 472.76 185.95 L 473.77 186.16 L 476.28 187.98 L 477.79 187.88 L 480.23 187.02 L 481.06 186.98 L 481.71 187.26 L 483.99 186.97 L 485.2 185.66 L 485.7 184.2 L 485.82 182.99 L 486.11 182.55 L 486.5 180.35 L 486.37 179.5 L 486.2 179 L 484.59 178.09 L 482.81 176.06 L 482.3 173.76 L 482.19 171.65 L 482.36 169.17 L 486.46 164.74 L 486.67 164.19 L 486.77 161.76 L 486.22 158.78 L 484.64 155.98 L 485.78 153.11 L 486.06 151.64 L 485.68 150.37 L 484.45 149.53 L 484.1 147.61 L 484.87 146.56 L 485.51 146.39 L 486.33 144.41 L 488.22 142.56 L 489.1 140.73 L 489.06 138.94 L 491.98 135.53 L 492.79 135.69 L 496.1 135.23 L 500.23 131.26 L 502.02 128.99 L 502.41 127.46 L 501.77 126.93 L 501.55 126.21 L 502.01 124.77 L 502.01 124.77 L 502.74 124.89 L 504.21 125.76 L 504.72 126.27 L 504.59 126.58 z"},{code:"PR",name:"Paraná",gTransform:"matrix(1 0 0 1 47.59 157)",pathTransform:"translate(-353.59, -476.27)",d:"M 396.75 499.4 L 391.51 499.37 L 391.18 499.81 L 389.44 500.05 L 388.68 499.98 L 388.57 499.59 L 387 500.16 L 385.65 501.59 L 382.3 503.72 L 380.86 503.56 L 379.63 502.94 L 376.5 500.34 L 375.47 499.95 L 374.71 499.94 L 371.87 500.67 L 369.54 500.84 L 368.73 500.81 L 367.31 500.05 L 366.2 500.19 L 364.67 500.84 L 364.08 502.31 L 363.35 503.18 L 361.48 504.16 L 357.91 503.75 L 355.91 504.9 L 355.19 505.67 L 354.5 507.26 L 355.35 510.25 L 354.48 511.11 L 353.56 511.13 L 352.81 511.51 L 352.64 512 L 351.31 510.11 L 347.06 510.24 L 343.3 509.81 L 341.72 508.63 L 341.56 508.22 L 340.53 507.59 L 336.27 507.23 L 330.98 505.55 L 328.64 506.12 L 325.95 506.09 L 323.93 504.68 L 323.61 504.17 L 322.55 503.93 L 322.02 503.92 L 321.31 504.29 L 317.68 504.27 L 317.68 504.27 L 317.46 503.06 L 314.93 498.88 L 314.95 496.29 L 313.96 493.41 L 310.54 491.04 L 309.45 492.17 L 307.33 492.06 L 306.23 492.49 L 305.16 493.39 L 303.7 492.31 L 302.88 492.37 L 302.6 490.17 L 303.26 488.6 L 304.33 487.33 L 305.55 485.15 L 305.61 484.81 L 305.12 484.06 L 305.14 482.82 L 306.04 479.18 L 307.3 476.16 L 307.05 473.86 L 308.33 471.48 L 308.12 470.46 L 307.28 469.58 L 306.97 467.98 L 307.63 466.92 L 308.42 466.38 L 308.42 466.38 L 310.8 464.82 L 311.16 464 L 312.73 456.08 L 313.06 455.73 L 314.17 455.41 L 315.83 454.4 L 316.5 453.72 L 317.95 450.16 L 317.93 449.01 L 318.86 446.68 L 319.97 445.86 L 325.38 443.59 L 325.38 443.59 L 328.64 441.3 L 332.47 441.95 L 336.48 441.84 L 339.75 442.13 L 340.96 441.51 L 341.31 440.91 L 342.04 440.54 L 343.21 440.83 L 344.69 441.61 L 347.21 442.07 L 349.85 443.16 L 351.16 443.29 L 352.23 442.75 L 354.81 442.74 L 355.59 443.74 L 357.34 444.58 L 360.85 445.38 L 361.48 445.89 L 362.19 447.21 L 363.92 447.28 L 364.34 446.94 L 365.99 447.09 L 366.65 447.63 L 371.96 447.76 L 374.93 446.91 L 376.06 448.46 L 379.65 451.29 L 380.54 453.05 L 380.55 455.79 L 380.16 456.37 L 380 457.18 L 380.38 459.02 L 381.68 460.53 L 381.6 462.29 L 381.24 462.85 L 382.73 465.85 L 383.94 467 L 384.61 467.28 L 385.11 467.96 L 385.06 468.85 L 385.98 470.82 L 386.58 471.11 L 386.83 471.55 L 386.58 472.6 L 385.31 474.73 L 385.63 476.77 L 386.23 477.15 L 387.24 477.36 L 389.62 477.24 L 393.04 476.71 L 393.54 477.1 L 395.12 476.91 L 396.71 477.04 L 398.32 478.3 L 398.18 478.71 L 397.29 479.36 L 396.6 482.66 L 396.95 483.44 L 398.02 483.97 L 398.67 483.12 L 399.77 480.36 L 400.53 480.19 L 402.67 480.77 L 402.27 482.72 L 403 486.02 L 404.42 486.6 L 404.58 487.92 L 404.58 487.92 L 403.23 488.94 L 402.62 490.42 L 402.07 490.3 L 402.34 488.36 L 403.78 487.41 L 402.37 487.69 L 401.48 488.18 L 400.61 488.16 L 400.27 487.77 L 399.7 487.6 L 399.16 487.97 L 398.88 488.9 L 399.4 489.7 L 398.67 490.66 L 398.37 490.76 L 395.89 490.23 L 395.1 489.69 L 394.65 489.81 L 394.47 490.71 L 394.81 491.08 L 396.42 491.64 L 397.82 491.39 L 399.95 491.99 L 400.22 492.47 L 399.25 493.15 L 397.71 495.93 L 396.47 496.7 L 394.05 497.27 L 393.85 497.72 L 396.8 497.52 L 396.95 498.71 z"},{code:"RJ",name:"Rio de Janeiro",gTransform:"matrix(1 0 0 1 179.27 113.69)",pathTransform:"translate(-485.28, -432.95)",d:"M 468.35 450.28 L 468.28000000000003 449.5 L 468.66 449.23 L 471.85 449.45000000000005 L 474.44 448.86000000000007 L 471.91 447.31000000000006 L 470.51000000000005 446.81000000000006 L 467.70000000000005 447.49000000000007 L 466.34000000000003 449.0900000000001 L 465.31000000000006 449.4100000000001 L 464.61000000000007 449.36000000000007 L 463.26000000000005 447.2100000000001 L 462.78000000000003 447.2100000000001 L 461.88000000000005 447.6300000000001 L 460.9200000000001 448.6900000000001 L 457.7700000000001 449.4900000000001 L 457.4300000000001 450.40000000000015 L 457.2400000000001 452.3000000000001 L 459.4300000000001 452.4300000000001 L 460.5000000000001 453.4400000000001 L 459.35000000000014 454.5200000000001 L 458.41000000000014 454.3500000000001 L 456.9900000000001 454.5200000000001 L 456.9900000000001 454.5200000000001 L 456.5100000000001 454.2600000000001 L 454.8800000000001 452.5300000000001 L 454.8300000000001 452.12000000000006 L 455.9200000000001 448.62000000000006 L 457.01000000000005 447.4700000000001 L 459.36000000000007 446.4600000000001 L 459.86000000000007 446.61000000000007 L 462.63000000000005 446.25000000000006 L 464.13000000000005 445.5400000000001 L 465.78000000000003 443.3900000000001 L 465.03000000000003 441.7500000000001 L 463.33000000000004 441.7400000000001 L 460.18000000000006 442.2700000000001 L 458.4100000000001 441.8800000000001 L 457.18000000000006 440.29000000000013 L 456.62000000000006 439.1200000000001 L 455.3500000000001 438.5800000000001 L 455.3500000000001 438.5800000000001 L 456.0300000000001 438.0900000000001 L 458.4500000000001 437.3500000000001 L 461.3600000000001 436.0100000000001 L 463.9400000000001 435.8400000000001 L 464.4400000000001 436.11000000000007 L 466.16000000000014 435.3400000000001 L 467.21000000000015 434.5700000000001 L 471.3000000000001 432.7800000000001 L 471.8200000000001 432.7100000000001 L 472.1800000000001 433.0200000000001 L 475.3800000000001 432.9500000000001 L 476.6300000000001 432.7800000000001 L 478.2600000000001 431.8400000000001 L 478.8300000000001 431.7800000000001 L 481.36000000000007 432.05000000000007 L 481.8500000000001 432.2200000000001 L 481.8300000000001 432.6900000000001 L 483.2100000000001 432.4900000000001 L 492.7200000000001 427.96000000000015 L 495.25000000000006 426.97000000000014 L 495.46000000000004 426.45000000000016 L 495.18000000000006 425.84000000000015 L 493.74000000000007 425.71000000000015 L 493.83000000000004 424.96000000000015 L 495.72 421.25000000000017 L 498.08000000000004 415.21000000000015 L 497.35 414.50000000000017 L 497.91 414.01000000000016 L 499.15000000000003 413.7400000000002 L 501.68 411.38000000000017 L 501.68 411.38000000000017 L 503.61 412.14000000000016 L 504.28000000000003 416.85000000000014 L 506.78000000000003 417.98000000000013 L 511.11 418.9900000000001 L 514.1 418.6200000000001 L 515.72 419.6800000000001 L 515.72 419.6800000000001 L 515.64 420.9500000000001 L 514.6999999999999 422.5600000000001 L 514.4799999999999 424.6900000000001 L 515.6199999999999 431.4700000000001 L 515.1199999999999 432.1500000000001 L 512.0399999999998 433.9000000000001 L 506.0699999999998 435.8400000000001 L 503.23999999999984 437.5600000000001 L 499.73999999999984 441.2500000000001 L 499.6299999999998 442.91000000000014 L 499.9399999999998 444.10000000000014 L 499.74999999999983 445.72000000000014 L 499.0199999999998 447.20000000000016 L 497.1999999999998 447.71000000000015 L 490.6499999999998 447.54000000000013 L 484.8599999999998 448.2400000000001 L 482.4699999999998 447.78000000000014 L 481.9799999999998 447.40000000000015 L 481.9199999999998 446.72000000000014 L 482.94999999999976 445.2400000000001 L 483.6199999999998 443.79000000000013 L 483.5299999999998 443.17000000000013 L 482.74999999999983 442.9900000000001 L 479.9599999999998 444.1400000000001 L 479.6999999999998 444.8300000000001 L 480.0099999999998 445.6200000000001 L 481.3899999999998 446.79000000000013 L 481.6399999999998 447.76000000000016 L 481.04999999999984 448.28000000000014 L 479.41999999999985 448.79000000000013 L 477.84999999999985 448.76000000000016 L 469.80999999999983 449.83000000000015 L 468.35 450.28 z M 463.24 452.27 L 462.57 451.29999999999995 L 464.68 449.74999999999994 L 466.54 450.68999999999994 L 466.97 451.38999999999993 L 464.51000000000005 451.88999999999993 L 464.1 451.5399999999999 L 463.63 451.5399999999999 L 463.24 452.27 z"},{code:"RN",name:"Rio Grande do Norte",gTransform:"matrix(1 0 0 1 274.86 -145.63)",pathTransform:"translate(-580.87, -173.63)",d:"M 609.29 182.91 L 608.36 183.15 L 604.86 182.94 L 603.82 183.34 L 601.36 182.24 L 599.19 181.94 L 593.36 182.33 L 592.83 181.98 L 589.41 181.58 L 588.79 181.09 L 588.89 180.09 L 588.47 179.7 L 587.09 179.75 L 585.27 181.1 L 584.96 182.58 L 585.68 183.36 L 586.21 184.89 L 585.2 184.57 L 584.72 185.16 L 584.88 186.58 L 585.35 187.52 L 584.8 188.73 L 584.3 189.47 L 581.95 190.4 L 581.12 189.66 L 581.64 188.12 L 580.75 186.95 L 578.8 186.65 L 577.03 186.73 L 573.88 187.99 L 573.59 187.76 L 573.28 186.38 L 572.96 186.15 L 569.43 185.63 L 569.51 183.91 L 569.72 183.6 L 570.57 183.35 L 570.98 182.97 L 571.36 181.23 L 571.8 180.27 L 574.79 177.06 L 574.78 175.87 L 574.25 175.43 L 573.61 175.35 L 570.35 176.39 L 568.92 176.51 L 565.74 177.72 L 565.33 178.67 L 565.23 179.71 L 564.41 180.42 L 561.18 182.08 L 560.02 183.21 L 557.14 182.6 L 556.24 182.18 L 554.31 180.54 L 553.74 181 L 553.74 181 L 553.08 181.38 L 552.44 181.21 L 552.78 179.24 L 554.19 176.99 L 555.03 176.11 L 555.54 176.04 L 556.32 176.55 L 557.35 176.29 L 557.92 175.19 L 559.38 173.68 L 560.78 171.24 L 560.63 170.5 L 561.28 168.83 L 562.15 168.26 L 562.99 167.14 L 566.29 160.45 L 568.9 158.44 L 573.79 156.85 L 573.79 156.85 L 574.26 157.61 L 575.12 158.36 L 578.25 158.35 L 579.47 158.76 L 581.16 160.51 L 582.48 161.01 L 585.81 160.69 L 588.69 161.21 L 591.23 160.97 L 593.56 160.24 L 598.06 161.16 L 599.33 161.2 L 601.28 162.06 L 602.3 162.88 L 602.94 163.82 L 605.25 168.56 L 605.75 170.35 L 605.71 171.1 L 607.19 176.48 L 607.4 178.16 L 608.12 178.7 L 609.08 181.39 z"},{code:"RO",name:"Rondônia",gTransform:"matrix(1 0 0 1 -139.57 -68.08)",pathTransform:"translate(-166.43, -251.18)",d:"M 187.32 290.95 L 186.03 289.5 L 185.59 287.62 L 184.03 287.1 L 183.17 287.42 L 181.36 287.5 L 177.29 285.69 L 177.28 285.29 L 176.62 284.68 L 175.35 285.27 L 173.37 283.59 L 171.85 282.62 L 170.99 281.16 L 170.71 279.77 L 169.67 279.38 L 167.9 280.5 L 166.68 280.47 L 165.27 279.67 L 164.4 278.34 L 161.27 276.76 L 159.31 276.59 L 158.17 277.13 L 157.27 277.98 L 155.84 277.81 L 155.53 277.51 L 153.39 277 L 150.33 276.72 L 149.57 276.29 L 148.39 275.1 L 148.09 273.13 L 146.51 272.64 L 144.62 271.67 L 143.8 269.95 L 143.51 269.75 L 140.79 269.47 L 140.41 269.12 L 139.57 265.41 L 138.69 264.52 L 138.21 265.68 L 137.55 265.36 L 137.28 264.72 L 137.9 263.19 L 137.06 261.67 L 135.7 261.28 L 134.44 257.81 L 134.27 256.15 L 135.82 253.24 L 135.61 251.58 L 134.45 249.61 L 133.7 247.45 L 133.64 245.16 L 134.26 244.66 L 134.64 243.29 L 135.68 242.24 L 136.04 240.77 L 135.8 239.28 L 135.38 238.39 L 135.29 236.86 L 135.83 235.21 L 134.66 233.03 L 133.64 232.65 L 132.55 233.63 L 132.49 234.14 L 131.65 235.1 L 131.08 235.1 L 128.9 234.08 L 123.72 234.16 L 118.11 235.94 L 116.42 235.93 L 114.94 236.41 L 114.94 236.41 L 111.97 235.15 L 111.97 235.15 L 115.23 232.59 L 117.15 232.01 L 118.7 230.2 L 118.85 229.64 L 118.69 228.35 L 122.65 228.61 L 125.52 228.28 L 126.24 228.65 L 128.55 230.98 L 128.92 230.96 L 130.14 230.17 L 130.27 229.45 L 130.68 228.92 L 131.76 228.42 L 132.53 228.55 L 133.9 228.16 L 135.2 226.95 L 137.04 225.93 L 137.42 226.02 L 138.06 228.28 L 138.74 228.81 L 139.42 228.73 L 141.96 225.57 L 141.7 223.82 L 142.23 222.98 L 143.98 221.72 L 144.44 221.74 L 145.28 222.29 L 147.07 222.39 L 148.27 221.32 L 150.4 220.94 L 154.27 221.4 L 154.03 219.94 L 154.14 218.13 L 156.2 216.92 L 157.01 215.77 L 157.37 214.75 L 157.2 214.3 L 156.3 213.6 L 156.35 212.93 L 157.54 211.34 L 160.02 210.81 L 160.28 210.59 L 160.19 209.42 L 161.91 208.92 L 163.29 206.36 L 174.08 206.3 L 176.23 207.43 L 176.68 207.92 L 177.48 209.83 L 178.81 211.1 L 181.35 212.08 L 182.6 215.35 L 183.06 215.56 L 184.04 215.43 L 184.66 215.63 L 185.34 218.51 L 188.58 219.99 L 189.26 219.8 L 189.8 218.06 L 191.72 216.98 L 193.11 217.26 L 193.47 217.64 L 193.43 218.34 L 193.43 218.34 L 194.83 219.31 L 195.43 220.55 L 194.67 221.97 L 193.38 226.96 L 193.44 227.31 L 194.22 227.78 L 194.48 228.39 L 194.63 229.78 L 195.46 232.05 L 194.52 233.72 L 194.9 235.65 L 193.9 239.17 L 193.87 239.97 L 194.14 241.73 L 195.64 244.48 L 194.74 253.48 L 211.9 253.53 L 211.66 254.09 L 212.88 255.2 L 216.38 255.11 L 217.49 255.22 L 218.56 255.65 L 219.97 259.24 L 219.8 259.99 L 218.4 261.74 L 217.04 262.82 L 216.9 264.14 L 217.33 267.39 L 217.91 267.9 L 218.81 267.87 L 220.34 271.21 L 220.3 273.26 L 220.88 274.75 L 220.81 276.46 L 220.25 278.7 L 218.59 280.71 L 218.07 282.96 L 217.49 283.8 L 217.06 284.21 L 215.42 284.74 L 214.49 285.82 L 213.06 289.6 L 212.54 292.05 L 208.43 294.62 L 206.96 296.05 L 206.96 296.05 L 206.22 296.01 L 203.63 294.46 L 202.36 293.03 L 195.28 293.99 L 193.96 293.56 L 193.71 293.26 L 190.33 293.92 L 189.85 293.76 L 189.33 292.41 z"},{code:"RR",name:"Roraima",gTransform:"matrix(1 0 0 1 -116.08 -267.27)",pathTransform:"translate(-189.92, -51.99)",d:"M 234.61 61.4 L 236.21 78.37 L 236.21 78.37 L 217.72 78.3 L 217.75 78.98 L 215.42 82.24 L 213.76 85.27 L 213.69 86.4 L 212.54 89.04 L 212.43 89.7 L 212.66 90.43 L 213.8 91.84 L 213.78 92.37 L 213.36 92.76 L 211.33 93.31 L 209.92 94.72 L 208.67 95.18 L 206.85 94.95 L 205.93 92.44 L 204.06 90.4 L 201.23 89.47 L 199.63 89.53 L 199.08 90.42 L 196.99 91.13 L 195.71 91.82 L 194.69 93.08 L 193.87 96.05 L 194.24 97.85 L 193.99 99.58 L 193.24 101.87 L 193.68 103.98 L 191.32 102.94 L 189.98 103.36 L 189.45 103.29 L 188.41 101.25 L 186.93 99.6 L 184.97 98.29 L 184.45 98.25 L 179.44 93.83 L 179.58 92.69 L 181.42 93.02 L 182.56 91.7 L 182.62 91.12 L 181.49 86.79 L 180.91 85.89 L 179.69 85.05 L 178.81 82.88 L 178.52 77.9 L 179.09 76.94 L 179.86 73.9 L 179.2 72.32 L 178.84 70.73 L 180.46 69.27 L 180.41 68.82 L 179.54 67.7 L 179.35 65.44 L 177.69 60.68 L 174.96 56.94 L 175.67 55.44 L 176.58 52.12 L 176.09 51.46 L 174.14 50.51 L 172.78 50.4 L 171.9 50.61 L 170.93 50.24 L 169.72 49.07 L 169.66 48.11 L 169.03 48 L 167.9 48.42 L 167.29 48.41 L 166.54 48.07 L 165.82 47.29 L 165.82 47.29 L 166.12 46.83 L 166.35 44.55 L 166.05 44.33 L 162.68 44.1 L 158.93 44.24 L 155.62 43.54 L 155.42 42.94 L 156.22 41.18 L 156.34 39.7 L 155.61 37.93 L 153.67 34.39 L 152.94 32.33 L 152.47 28.61 L 153.26 27.13 L 153.18 26.17 L 151.34 24.17 L 149.18 23.11 L 146.37 20.33 L 145.31 18.52 L 145.02 17.56 L 143.88 16.91 L 143.63 16.52 L 143.66 15.68 L 143.95 15.35 L 144.85 15.42 L 145.97 16.08 L 146.91 17.81 L 147.52 17.9 L 150.91 17.4 L 152.26 17.5 L 154.17 18.09 L 154.78 19.29 L 155.33 21.22 L 155.87 21.57 L 156.83 21.49 L 157.57 20.84 L 158.52 20.44 L 161.7 20.6 L 162.17 20.65 L 163.48 21.86 L 164.08 22.01 L 164.6 21.87 L 165.21 20.31 L 166.52 20.45 L 167.97 21.38 L 171.9 25.95 L 172.95 26.52 L 173.66 26.63 L 175.17 25.95 L 175.91 24.82 L 176.01 23.98 L 175.18 21.22 L 175.54 19.48 L 176 19.2 L 177.93 19.15 L 178.94 18.05 L 180.49 16.96 L 181.24 17.01 L 185.14 18.35 L 185.73 18.18 L 186.53 17.46 L 187.56 17.16 L 188.69 17.51 L 189.72 17.3 L 191.06 16.02 L 192.06 15.77 L 193.21 16 L 194.32 15.93 L 195 15.08 L 195.05 13.73 L 198.08 11.92 L 200.41 12.11 L 203.17 11.72 L 204.06 10.59 L 204.15 9.88 L 204.74 8.76 L 205.49 8.63 L 207.34 7.73 L 208.44 6.69 L 209.55 4.98 L 208.35 1.42 L 207.18 1.06 L 207.82 0.88 L 209.25 0.95 L 210.05 1.27 L 213.62 1.17 L 214.68 0.22 L 215.42 0 L 216.79 0.42 L 217.32 1.73 L 218.36 2.53 L 218.84 3.9 L 218.17 8.8 L 217.45 10.18 L 216.2 10.88 L 216.26 11.71 L 217.87 12.12 L 219.49 11.9 L 221.84 12.71 L 223.66 13.81 L 222.78 15.24 L 222.77 16.39 L 225.11 19.81 L 225.31 21.36 L 223.8 24.28 L 221.92 25.69 L 221.2 27.19 L 221.47 27.58 L 221.53 29.75 L 220.06 32.16 L 219.16 34.93 L 218.85 37.5 L 218.76 40.17 L 219.74 42.04 L 220.25 43.8 L 220.24 45.2 L 221.81 46.23 L 222.71 46.43 L 222.84 47.11 L 222.38 52.26 L 222.5 53 L 224.31 53.29 L 223.65 54.46 L 224.11 54.96 L 226.26 55.7 L 227.72 57.62 L 230.38 60.36 z"},{code:"RS",name:"Rio Grande do Sul",gTransform:"matrix(1 0 0 1 11.62 259.25)",pathTransform:"translate(-317.63, -578.5)",d:"M 321.99 638.52 L 321.63 638.53 L 319.69 637.42 L 319.49 636.96 L 320.01 632.69 L 319.55 628.44 L 319.7 627.37 L 320.33 626.13 L 323.17 623.75 L 324 622.19 L 326.3 619.63 L 324.84 617.98 L 323.77 617.36 L 321.52 616.76 L 319.2 614.51 L 317.99 612.89 L 317.89 611.3 L 317.46 610.12 L 316.23 608.09 L 314.17 605.85 L 313.5 605.26 L 311.11 604.05 L 309.66 604.26 L 307.76 602.75 L 306.24 601.12 L 304.99 600.34 L 304.85 598.64 L 302.95 596.48 L 299.63 596.02 L 298.71 595.55 L 296.98 593.89 L 295.22 594.02 L 293.05 592.64 L 291.14 588.93 L 290.03 587.44 L 287.5 585.32 L 286.8 585.4 L 286.13 587.19 L 283.54 589.43 L 280.87 589.55 L 280.97 586.69 L 281.37 585.41 L 280.98 584.41 L 277.33 580.12 L 274.96 578.35 L 272.78 576.29 L 271.03 574.18 L 268.34 571.97 L 266.44 571.83 L 264.29 572.04 L 263.15 573.4 L 263.09 574.36 L 262.06 575.33 L 260.95 575.35 L 260.37 574.87 L 257.21 575.01 L 256.56 574.53 L 256.4 573.62 L 255.91 573.4 L 256.76 573.18 L 257.8 572.46 L 260.32 569.69 L 260.43 567.85 L 261.03 566.6 L 261.85 566.15 L 263.14 566.08 L 263.78 565.82 L 264.7 564.82 L 270.15 558.34 L 270.78 556.92 L 270.95 555.81 L 271.77 554.74 L 272.97 553.89 L 274.34 553.48 L 276.3 549.26 L 276.4 548.65 L 276.71 548.28 L 278.35 547.42 L 279.98 545.62 L 280.83 544.47 L 281.34 543.18 L 282.68 541.08 L 283.61 540.79 L 285.18 540.97 L 285.73 541.76 L 286.2 540.48 L 285.99 539.9 L 284.64 539.08 L 284.59 538.72 L 284.94 538.39 L 286.02 538.01 L 286.84 537.05 L 289.63 536.1 L 290.68 535.03 L 290.78 534.11 L 291.6 533.2 L 293.81 532.05 L 296.28 531.65 L 298.05 529.84 L 298.2 528.78 L 299.52 526.42 L 299.85 526.38 L 299.9 526.74 L 300.19 526.94 L 301.52 526.77 L 303.96 525.64 L 306.64 525.05 L 307.85 524.48 L 309.95 522.13 L 310.45 522.14 L 311.12 521.75 L 312.13 520.4 L 314.44 519.67 L 314.74 520.05 L 314.74 520.05 L 318.26 520.44 L 321.52 519.29 L 322.08 518.48 L 323.43 519.06 L 323.28 519.98 L 326.36 519.95 L 327.99 520.94 L 330.55 520.57 L 332.47 521.72 L 335.05 521.31 L 336.59 521.49 L 339.39 521.33 L 341.65 522.25 L 344.13 523.65 L 345.13 526.09 L 346.72 526.28 L 346.81 525.8 L 348.62 525.45 L 354.18 528.99 L 355.55 530.54 L 356.26 530.51 L 357.82 531.49 L 360.85 534.98 L 362.49 537.19 L 362.97 538.67 L 365.14 541.33 L 366.31 541.88 L 373 542.94 L 375.11 542.54 L 378.46 542.88 L 379.34 545.22 L 377.26 546.8 L 375.99 547.21 L 375.26 549.07 L 375.48 551.26 L 375.1 552.82 L 374.58 554.12 L 373.4 554.32 L 372.11 556.01 L 372.08 557.42 L 373.88 558.59 L 374.15 558.39 L 373.87 557.42 L 373.88 556.46 L 375.37 555.64 L 376.95 556.28 L 377.68 557.19 L 378.85 558.04 L 379.3 558.01 L 379.3 558.01 L 377.9 559.74 L 374 566.78 L 369.79 578.38 L 363.49 588.86 L 358.05 595.52 L 351.54 601.48 L 345.45 605.16 L 342.35 609.47 L 342.17 609.04 L 342.82 607.46 L 343.16 605.28 L 341.98 603.57 L 342.08 603.15 L 343.01 602.98 L 344.02 603.38 L 344.58 603.96 L 345.6 604 L 348.18 602.59 L 349 601.91 L 351.85 598.2 L 352.6 597.51 L 353.05 597.7 L 354.07 597.51 L 355.12 596.67 L 356.05 595.4 L 356.42 593.92 L 356.6 592.99 L 356.37 590.89 L 356.57 589.52 L 358.14 589.45 L 358.88 589.75 L 359.15 590.58 L 359.5 590.32 L 359.21 588.92 L 359.72 586.85 L 360.2 586.28 L 362.94 584.69 L 363.67 583.61 L 364.14 580.86 L 363.93 578.58 L 364.49 577.9 L 364.99 578.7 L 365.36 578.73 L 365.79 578.31 L 366.26 575.23 L 366.16 574.79 L 365.21 573.57 L 364.54 573.54 L 364.28 574.23 L 364.45 574.62 L 364.31 575.19 L 363.96 575.39 L 362.45 575.37 L 360.44 575.77 L 360.1 577.38 L 359.57 577.43 L 358.76 576.99 L 358.86 575.28 L 358.04 574.39 L 357 574.72 L 356.4 574.24 L 355.67 572.98 L 355.27 571.53 L 355.39 570.96 L 354.75 570.27 L 354.14 572.98 L 354.58 575.23 L 355.83 577.34 L 355.26 578.15 L 354.52 580.69 L 354.9 583.72 L 354.72 584.49 L 354.24 584.12 L 354.5 583.88 L 354.47 583.17 L 354 581.89 L 353.55 581.5 L 353.02 582.16 L 352.99 583.53 L 351.58 586.8 L 351.53 588.69 L 351.75 589.21 L 351.03 589.91 L 349.42 590.55 L 348.81 592.13 L 344.72 593.7 L 344 594.23 L 343.47 595.82 L 343.37 598.09 L 342.4 600.36 L 340.04 601.66 L 339.93 603.42 L 340.41 604.25 L 340.66 605.27 L 339.71 605.83 L 339.46 607.34 L 339.89 607.94 L 340.57 607.8 L 341.87 608.43 L 342.02 609.34 L 339.89 610.99 L 337.57 615.51 L 335.64 622.39 L 333.63 626.88 L 331.95 629.4 L 324.16 636.93 z"},{code:"SC",name:"Santa Catarina",gTransform:"matrix(1 0 0 1 51.41 209.71)",pathTransform:"translate(-357.4, -528.97)",d:"M 379.3 558.01 L 378.85 558.04 L 377.68 557.1899999999999 L 376.95 556.27 L 375.36 555.64 L 373.88 556.46 L 373.87 557.4200000000001 L 374.15 558.3900000000001 L 373.88 558.5900000000001 L 372.08 557.4200000000002 L 372.12 556.0100000000002 L 373.4 554.3200000000002 L 374.58 554.1200000000001 L 375.10999999999996 552.8100000000002 L 375.47999999999996 551.2600000000002 L 375.25999999999993 549.0700000000002 L 375.98999999999995 547.2100000000002 L 377.25999999999993 546.7900000000002 L 379.3399999999999 545.2100000000002 L 378.4599999999999 542.8700000000001 L 375.1099999999999 542.5300000000001 L 372.9999999999999 542.9300000000001 L 366.3099999999999 541.8700000000001 L 365.14999999999986 541.3300000000002 L 362.97999999999985 538.6700000000002 L 362.48999999999984 537.1900000000002 L 360.85999999999984 534.9800000000001 L 357.82999999999987 531.4900000000001 L 356.2599999999999 530.5000000000001 L 355.5499999999999 530.5300000000001 L 354.1799999999999 528.9800000000001 L 348.6199999999999 525.4400000000002 L 346.8099999999999 525.7800000000002 L 346.7199999999999 526.2600000000002 L 345.1199999999999 526.0700000000002 L 344.1199999999999 523.6300000000001 L 341.64999999999986 522.2400000000001 L 339.3799999999999 521.3100000000002 L 336.58999999999986 521.4700000000001 L 335.04999999999984 521.2900000000002 L 332.45999999999987 521.7000000000002 L 330.54999999999984 520.5500000000002 L 327.97999999999985 520.9100000000002 L 326.34999999999985 519.9300000000002 L 323.26999999999987 519.9600000000002 L 323.41999999999985 519.0300000000002 L 322.0699999999998 518.4500000000002 L 321.5099999999998 519.2600000000001 L 318.24999999999983 520.4200000000001 L 314.72999999999985 520.0300000000001 L 314.72999999999985 520.0300000000001 L 316.17999999999984 517.1000000000001 L 316.90999999999985 515.0100000000001 L 316.32999999999987 511.7600000000001 L 316.7399999999999 508.5500000000001 L 316.6999999999999 506.0000000000001 L 317.65999999999985 504.2500000000001 L 317.65999999999985 504.2500000000001 L 321.28999999999985 504.2700000000001 L 321.99999999999983 503.8900000000001 L 322.5299999999998 503.9000000000001 L 323.5899999999998 504.1400000000001 L 323.8999999999998 504.6500000000001 L 325.9299999999998 506.0600000000001 L 328.6099999999998 506.0900000000001 L 330.94999999999976 505.5100000000001 L 336.2399999999998 507.1900000000001 L 340.4999999999998 507.5500000000001 L 341.51999999999975 508.1800000000001 L 341.68999999999977 508.59000000000015 L 343.25999999999976 509.77000000000015 L 347.02999999999975 510.19000000000017 L 351.27999999999975 510.0600000000002 L 352.60999999999973 511.96000000000015 L 352.78999999999974 511.46000000000015 L 353.52999999999975 511.08000000000015 L 354.44999999999976 511.0600000000002 L 355.31999999999977 510.20000000000016 L 354.46999999999974 507.21000000000015 L 355.15999999999974 505.63000000000017 L 355.87999999999977 504.8500000000002 L 357.87999999999977 503.7100000000002 L 361.44999999999976 504.1100000000002 L 363.31999999999977 503.14000000000016 L 364.0499999999998 502.27000000000015 L 364.63999999999976 500.79000000000013 L 366.16999999999973 500.14000000000016 L 367.27999999999975 500.00000000000017 L 368.69999999999976 500.76000000000016 L 369.50999999999976 500.79000000000013 L 371.83999999999975 500.6200000000001 L 374.6799999999997 499.8900000000001 L 375.4299999999997 499.9000000000001 L 376.46999999999974 500.30000000000007 L 379.58999999999975 502.9000000000001 L 380.81999999999977 503.5200000000001 L 382.25999999999976 503.6800000000001 L 385.6099999999998 501.5500000000001 L 386.9599999999998 500.1200000000001 L 388.5199999999998 499.5500000000001 L 388.6399999999998 499.9400000000001 L 389.3999999999998 500.0100000000001 L 391.1399999999998 499.7800000000001 L 391.4699999999998 499.3400000000001 L 396.7099999999998 499.37000000000006 L 396.7099999999998 499.37000000000006 L 396.3199999999998 500.69000000000005 L 396.8299999999998 502.34000000000003 L 396.7599999999998 502.73 L 395.2599999999998 503.87 L 394.2799999999998 503.39 L 393.4599999999998 500.86 L 393.4399999999998 501.98 L 394.0299999999998 504.70000000000005 L 395.7399999999998 506.36000000000007 L 396.2999999999998 507.31000000000006 L 395.2899999999998 509.6000000000001 L 395.12999999999977 511.9200000000001 L 395.2299999999998 512.35 L 395.9899999999998 513.08 L 396.2499999999998 518.94 L 396.5599999999998 519.49 L 396.9899999999998 519.69 L 397.75999999999976 519.1800000000001 L 398.1099999999998 519.9000000000001 L 398.2099999999998 520.7700000000001 L 397.7399999999998 520.83 L 397.3099999999998 520.5500000000001 L 396.1199999999998 521.1800000000001 L 395.7799999999998 525.0200000000001 L 396.3499999999998 527.6100000000001 L 395.7799999999998 528.3600000000001 L 396.0899999999998 530.2900000000001 L 396.99999999999983 532.1700000000001 L 396.1399999999998 534.5100000000001 L 395.61999999999983 538.5200000000001 L 393.90999999999985 543.2 L 393.5699999999999 543.1 L 393.20999999999987 542.34 L 393.41999999999985 541.37 L 392.49999999999983 540.19 L 392.23999999999984 540.5200000000001 L 392.41999999999985 542.95 L 393.57999999999987 543.7800000000001 L 392.65999999999985 545.44 L 391.01999999999987 546.09 L 386.8899999999999 549.13 L 384.08999999999986 551.6899999999999 L 380.33999999999986 556.13 L 379.3 558.01 z M 397.18 531.46 L 397.03000000000003 530.99 L 397.28000000000003 529.24 L 398.04 526.84 L 397.64000000000004 525.6600000000001 L 397.80000000000007 524.6400000000001 L 399.20000000000005 523.8800000000001 L 399.4200000000001 523.94 L 400.0800000000001 524.8800000000001 L 399.5400000000001 527.44 L 398.7200000000001 528.3000000000001 L 398.1300000000001 529.5200000000001 L 398.3300000000001 530.69 L 397.18 531.46 z M 396.73 507.09 L 394.86 505.07 L 397.41 502.63 L 397.66 502.67 L 398.31 503.72 L 397.45 505.04 L 396.73 507.09 z"},{code:"SE",name:"Sergipe",gTransform:"matrix(1 0 0 1 266.49 -72.82)",pathTransform:"translate(-572.49, -246.44)",d:"M 569.94 261.69 L 567.04 262.58 L 565.49 261.94 L 564.95 261.6 L 564.47 260.88 L 562.55 259.96 L 561.95 259.44 L 561.83 259.03 L 562.17 258.64 L 562.3 257.22 L 562.15 256.83 L 560.72 255.32 L 560.2 253.83 L 559.11 253.16 L 558.15 251.56 L 558.13 250.79 L 558.72 249.21 L 559.04 248.91 L 560.74 248.92 L 561.87 249.67 L 564.42 248.68 L 565.11 248.13 L 565.41 247.55 L 564.65 244.8 L 564.73 243.92 L 565.39 242.3 L 565.47 239.19 L 564.72 238.04 L 562.73 236.09 L 561.46 233.59 L 561.24 231.45 L 561.91 230.3 L 561.91 230.3 L 568.37 233.28 L 572.05 234.23 L 577.47 237.3 L 578.77 239.75 L 580.53 241.2 L 582.19 241.99 L 582.65 242.02 L 586.24 244.25 L 586.84 245.56 L 586.84 245.56 L 584.46 246.32 L 579.89 249.26 L 578.92 250.15 L 577.37 252.36 L 577.05 252.34 L 577.16 251.24 L 576.11 249.42 L 575.12 249.58 L 575.46 250.74 L 576.7 250.74 L 576.93 250.98 L 576.41 252.95 L 575.14 255.04 L 574.61 254.69 L 574.24 254.02 L 573.25 253.86 L 573.45 254.54 L 574.58 255.16 L 574.32 256.93 L 573.46 258.08 L 572.53 260.11 L 571.75 260.26 L 571.45 259.8 L 571.93 258.4 L 572.34 258.27 L 572.65 257.84 L 573.02 256.8 L 572.21 256.43 L 572.31 257.11 L 571.86 258.24 L 571.38 258.74 L 571.12 259.83 L 571.4 260.55 L 571.14 261.07 z"},{code:"SP",name:"São Paulo",gTransform:"matrix(1 0 0 1 89.6 122.15)",pathTransform:"translate(-395.6, -441.42)",d:"M 404.58 487.92 L 404.41999999999996 486.59000000000003 L 402.99999999999994 486.02000000000004 L 402.2699999999999 482.72 L 402.6699999999999 480.77000000000004 L 400.5299999999999 480.19000000000005 L 399.7699999999999 480.36000000000007 L 398.6699999999999 483.13000000000005 L 398.0099999999999 483.9800000000001 L 396.9499999999999 483.4500000000001 L 396.59999999999985 482.67000000000013 L 397.28999999999985 479.3700000000001 L 398.17999999999984 478.7100000000001 L 398.3199999999998 478.3100000000001 L 396.7099999999998 477.04000000000013 L 395.11999999999983 476.91000000000014 L 393.53999999999985 477.10000000000014 L 393.03999999999985 476.72000000000014 L 389.6299999999998 477.2500000000001 L 387.24999999999983 477.3700000000001 L 386.23999999999984 477.16000000000014 L 385.6399999999998 476.77000000000015 L 385.30999999999983 474.73000000000013 L 386.5899999999998 472.6100000000001 L 386.8399999999998 471.5600000000001 L 386.5899999999998 471.1200000000001 L 385.9899999999998 470.8200000000001 L 385.06999999999977 468.8500000000001 L 385.12999999999977 467.9600000000001 L 384.62999999999977 467.2800000000001 L 383.95999999999975 466.99000000000007 L 382.7499999999998 465.8500000000001 L 381.25999999999976 462.8400000000001 L 381.6199999999998 462.2900000000001 L 381.69999999999976 460.5300000000001 L 380.39999999999975 459.0100000000001 L 380.01999999999975 457.17000000000013 L 380.18999999999977 456.3600000000001 L 380.57999999999976 455.78000000000014 L 380.5599999999998 453.04000000000013 L 379.6699999999998 451.28000000000014 L 376.0799999999998 448.45000000000016 L 374.9499999999998 446.90000000000015 L 371.9799999999998 447.76000000000016 L 366.6699999999998 447.63000000000017 L 366.00999999999976 447.09000000000015 L 364.3599999999998 446.95000000000016 L 363.93999999999977 447.29000000000013 L 362.21999999999974 447.22000000000014 L 361.4999999999997 445.90000000000015 L 360.8699999999997 445.39000000000016 L 357.35999999999973 444.59000000000015 L 355.60999999999973 443.75000000000017 L 354.82999999999976 442.75000000000017 L 352.2499999999998 442.76000000000016 L 351.1799999999998 443.3000000000002 L 349.8599999999998 443.1700000000002 L 347.2199999999998 442.0800000000002 L 344.6899999999998 441.62000000000023 L 343.2099999999998 440.8300000000002 L 342.0399999999998 440.5400000000002 L 341.3099999999998 440.9100000000002 L 340.9699999999998 441.5100000000002 L 339.7599999999998 442.1300000000002 L 336.47999999999985 441.8400000000002 L 332.46999999999986 441.9500000000002 L 328.6399999999999 441.30000000000024 L 325.3899999999999 443.59000000000026 L 325.3899999999999 443.59000000000026 L 326.22999999999985 442.5100000000003 L 326.95999999999987 440.97000000000025 L 328.21999999999986 439.83000000000027 L 335.77999999999986 435.29000000000025 L 337.72999999999985 433.42000000000024 L 338.98999999999984 430.99000000000024 L 340.71999999999986 429.30000000000024 L 341.11999999999983 428.09000000000026 L 342.55999999999983 427.0600000000003 L 342.8399999999998 425.84000000000026 L 342.4899999999998 425.0000000000003 L 344.4899999999998 422.7400000000003 L 345.69999999999976 420.4000000000003 L 345.76999999999975 419.4600000000003 L 345.45999999999975 417.5300000000003 L 345.68999999999977 417.1400000000003 L 346.64999999999975 416.62000000000035 L 349.2499999999998 412.98000000000036 L 349.4099999999998 410.05000000000035 L 350.0299999999998 408.37000000000035 L 351.0399999999998 408.07000000000033 L 351.7699999999998 407.43000000000035 L 353.7599999999998 404.75000000000034 L 354.97999999999985 403.73000000000036 L 355.4499999999999 403.50000000000034 L 356.7599999999999 403.4600000000003 L 358.2599999999999 402.68000000000035 L 358.53999999999985 402.28000000000037 L 358.9399999999998 399.8200000000004 L 358.9399999999998 399.8200000000004 L 360.15999999999985 398.6900000000004 L 362.30999999999983 397.5800000000004 L 364.22999999999985 397.2100000000004 L 365.65999999999985 395.5200000000004 L 367.15999999999985 394.91000000000037 L 367.90999999999985 395.05000000000035 L 369.6399999999999 396.60000000000036 L 372.1899999999999 396.68000000000035 L 376.4799999999999 397.6400000000003 L 378.1499999999999 397.2800000000003 L 379.7699999999999 397.50000000000034 L 381.7699999999999 396.91000000000037 L 383.94999999999993 398.3300000000004 L 385.61999999999995 399.1200000000004 L 385.48999999999995 400.0400000000004 L 385.81999999999994 401.46000000000043 L 387.0299999999999 403.5500000000004 L 387.6599999999999 403.5800000000004 L 388.19999999999993 403.2600000000004 L 388.86999999999995 402.3200000000004 L 389.28 401.1900000000004 L 389.53999999999996 401.0000000000004 L 390.09 401.0500000000004 L 390.45 401.4400000000004 L 390.7 402.4000000000004 L 390.71 405.18000000000035 L 391.90999999999997 405.7100000000003 L 392.32 405.26000000000033 L 392.05 402.7200000000003 L 392.54 401.5300000000003 L 392.99 401.0500000000003 L 401.17 400.3800000000003 L 402.18 399.1300000000003 L 403.68 400.59000000000026 L 404.8 401.02000000000027 L 407.58 400.33000000000027 L 408.02 399.34000000000026 L 407.82 398.8800000000003 L 408.13 398.27000000000027 L 410.51 398.16000000000025 L 412.17 398.9400000000002 L 413.02000000000004 398.30000000000024 L 414.33000000000004 398.0100000000002 L 417.59000000000003 401.36000000000024 L 417.79 402.40000000000026 L 417.22 403.41000000000025 L 416.93 405.78000000000026 L 417.51 406.39000000000027 L 419.4 407.60000000000025 L 419.79999999999995 409.15000000000026 L 419.73999999999995 409.71000000000026 L 418.21999999999997 411.74000000000024 L 418.03999999999996 413.68000000000023 L 418.83 414.42000000000024 L 419.14 415.03000000000026 L 419.51 417.24000000000024 L 420.81 419.04000000000025 L 421.64 421.03000000000026 L 421.61 421.8800000000003 L 423.22 421.83000000000027 L 424 421.52000000000027 L 424.28 421.16000000000025 L 425.28 421.11000000000024 L 428.97999999999996 422.43000000000023 L 429.21 422.80000000000024 L 429.15999999999997 424.0700000000002 L 428.46 426.2500000000002 L 426.59999999999997 428.97000000000025 L 426.85999999999996 431.91000000000025 L 426.66999999999996 435.36000000000024 L 426.14 436.92000000000024 L 426.86 438.52000000000027 L 428.64 439.7600000000003 L 430.45 440.59000000000026 L 430.96 442.3100000000003 L 429.75 443.0100000000003 L 431.77 446.3200000000003 L 432.9 446.5700000000003 L 434.90999999999997 446.33000000000027 L 435.09 446.86000000000024 L 438.71 445.86000000000024 L 439.27 446.28000000000026 L 440.58 445.96000000000026 L 441.33 444.98000000000025 L 441.38 444.14000000000027 L 441.14 443.90000000000026 L 441.31 441.60000000000025 L 442.5 441.27000000000027 L 442.59 441.6200000000003 L 442.23999999999995 442.1100000000003 L 442.24999999999994 442.5900000000003 L 444.5899999999999 442.6700000000003 L 446.9799999999999 442.4200000000003 L 448.7699999999999 441.7500000000003 L 449.99999999999994 440.5100000000003 L 451.92999999999995 439.4900000000003 L 454.13999999999993 439.27000000000027 L 455.37999999999994 438.54000000000025 L 455.37999999999994 438.54000000000025 L 456.6499999999999 439.08000000000027 L 457.2099999999999 440.2500000000003 L 458.43999999999994 441.84000000000026 L 460.2099999999999 442.23000000000025 L 463.3599999999999 441.7000000000003 L 465.0599999999999 441.71000000000026 L 465.8099999999999 443.35000000000025 L 464.1599999999999 445.5000000000002 L 462.6599999999999 446.2100000000002 L 459.88999999999993 446.5700000000002 L 459.38999999999993 446.42000000000024 L 457.0399999999999 447.43000000000023 L 455.94999999999993 448.5800000000002 L 454.85999999999996 452.0800000000002 L 454.90999999999997 452.49000000000024 L 456.53999999999996 454.22000000000025 L 457.02 454.48000000000025 L 457.02 454.48000000000025 L 456.96 454.68000000000023 L 455.27 455.10000000000025 L 454.21 454.28000000000026 L 452.72999999999996 455.39000000000027 L 452.29999999999995 456.04000000000025 L 452.56999999999994 456.2600000000003 L 451.80999999999995 456.90000000000026 L 448.5899999999999 458.4500000000003 L 446.3399999999999 459.15000000000026 L 446.05999999999995 459.59000000000026 L 446.09999999999997 460.55000000000024 L 446.59999999999997 462.10000000000025 L 446.28 462.52000000000027 L 444.88 462.78000000000026 L 444.18 462.14000000000027 L 442.84000000000003 461.85000000000025 L 439.72 461.35000000000025 L 438.86 461.5000000000002 L 437.54 461.8400000000002 L 435.81 462.6600000000002 L 435.31 463.1700000000002 L 434.1 465.32000000000016 L 432.79 465.89000000000016 L 432.29 465.77000000000015 L 432.87 465.3000000000001 L 432.39 464.0800000000001 L 431.21999999999997 463.2300000000001 L 430.39 464.4600000000001 L 430.65 465.2100000000001 L 430.34999999999997 465.8200000000001 L 422.72999999999996 470.0600000000001 L 421.78 470.8800000000001 L 421.46999999999997 472.04000000000013 L 418.2 475.04000000000013 L 414.95 476.9900000000001 L 413.03 477.5200000000001 L 408.53 480.7300000000001 L 406.2 482.69000000000005 L 405.53 482.77000000000004 L 405.09 483.39000000000004 L 405.98999999999995 483.82000000000005 L 406.65 483.88000000000005 L 407.58 483.52000000000004 L 407.58 484.28000000000003 L 406.96 485.59000000000003 L 405.64 486.44000000000005 L 404.58 487.92 z M 448.89 464.91 L 447.34999999999997 464.26000000000005 L 446.18999999999994 464.44000000000005 L 445.69999999999993 464.06000000000006 L 445.79999999999995 463.2800000000001 L 446.74999999999994 462.6300000000001 L 447.8399999999999 460.7800000000001 L 448.55999999999995 461.0300000000001 L 449.21999999999997 461.68000000000006 L 449.34999999999997 464.5900000000001 L 448.89 464.91 z"},{code:"TO",name:"Tocantins",gTransform:"matrix(1 0 0 1 95.98 -93.17)",pathTransform:"translate(-401.98, -226.09)",d:"M 433.35 281.82 L 427.99 283.24 L 426.25 284.58 L 423.69 285.68 L 422.14 285.68 L 417.61 286.68 L 415.09 288.76 L 413.31 289.66 L 412.85 289.42 L 411.34 286.8 L 410.79 286.77 L 410.28 290.07 L 409.59 290.15 L 406.24 289.47 L 403.11 288 L 403.67 286.44 L 403.45 285.7 L 398.92 286.23 L 396.16 285.89 L 395.6 286.43 L 395.3 287.43 L 394.55 288.18 L 393.41 288.13 L 392.8 285.03 L 391.69 281.32 L 390.65 279.44 L 389.5 278.13 L 388.32 279.1 L 386.85 281.49 L 385.22 287.43 L 384.59 287.66 L 380.52 286.23 L 377.43 284.52 L 373.5 284.12 L 371.3 283.09 L 368.9 282.69 L 369.42 280.35 L 370.64 278.47 L 370.67 276.76 L 370.11 277.06 L 368.3 279.15 L 367.64 280.38 L 367.44 282.26 L 367.1 282.71 L 367.1 282.71 L 366.3 282.69 L 365.34 282.18 L 364.36 278.84 L 365.1 276.08 L 364.66 273.03 L 364.14 272.45 L 364.13 270.88 L 364.6 267.57 L 363.5 265.32 L 363.55 264.82 L 364.37 263.93 L 364.53 263.06 L 363.14 261.72 L 363.08 260.86 L 364.96 254.87 L 365 251.92 L 365.54 248.95 L 367.48 243.66 L 367.85 243.39 L 368.28 242.54 L 368.72 239.4 L 369.82 238.15 L 370.38 236.26 L 371.03 235.24 L 371.03 235.24 L 372.65 231.55 L 373.78 227.1 L 374.93 225.52 L 376.12 224.42 L 377.33 222.74 L 378.36 220.82 L 379.73 219.9 L 380.78 219.74 L 381.51 218.89 L 382.45 217.35 L 382.63 216.36 L 384.33 213.12 L 385.42 212.32 L 387.18 207.17 L 387.84 203.13 L 387.69 202.83 L 386.95 202.51 L 385.28 200.77 L 384.68 199.82 L 384.52 198.94 L 384.66 198.37 L 386.07 196.68 L 387.36 194.58 L 387.3 191.91 L 386.87 189.73 L 387.06 189.38 L 389.53 187.6 L 392.94 186.46 L 395.44 185.25 L 395.68 184.75 L 395.53 183.24 L 396.39 181.97 L 397.9 180.63 L 399.19 180.48 L 399.38 179.14 L 399.09 177.94 L 399.34 177.48 L 400.8 177.02 L 401.44 176.54 L 402.37 173.79 L 401.35 172.45 L 401.26 171.05 L 401.55 170.77 L 402.52 170.69 L 403.24 170.32 L 403.61 169.66 L 403.64 169.02 L 402.38 167.85 L 401.51 167.71 L 401.12 167.4 L 400.1 165.74 L 398.81 165.62 L 396.94 165.87 L 394.65 165.06 L 394.65 165.06 L 395.18 164.42 L 397.8 162.57 L 399.76 162.04 L 400.63 162.09 L 403.41 163.61 L 404.81 163.69 L 405.76 163.17 L 407.5 163.46 L 408.09 164.15 L 408.17 165.18 L 408.45 165.5 L 409.67 165.53 L 413.07 166.96 L 413.91 167.99 L 414.38 171.49 L 415.02 172.99 L 414.81 176.71 L 415.04 177.79 L 415.71 178.92 L 415.7 179.36 L 413.93 185.51 L 413.62 187.88 L 413.9 188.88 L 413.65 190.47 L 411.9 192.51 L 410.14 193.18 L 409.96 193.89 L 411.9 195.21 L 412.32 194.94 L 413.69 195.18 L 413.94 195.53 L 414.05 196.41 L 413.43 197.6 L 414.28 199.04 L 415.16 198.97 L 418.16 203.13 L 419.07 203.98 L 421.35 207 L 423.49 205.66 L 427.76 204.72 L 429.56 205.94 L 429.64 207.69 L 429 210.94 L 429.39 212.29 L 426 212.64 L 424.66 213.18 L 424.09 213.73 L 423.41 215.16 L 422.68 217.84 L 423.05 219.14 L 420.42 221.69 L 420.16 222.39 L 420.36 222.81 L 422.44 223.1 L 423.38 223.79 L 424.12 225.38 L 424.18 227.04 L 424.8 228.08 L 428.68 230.03 L 428.77 230.56 L 427.13 232.37 L 427.26 234.02 L 429.4 235.64 L 430.39 238.51 L 431.73 240.51 L 432.44 240.69 L 434.22 240.48 L 435.22 240.78 L 436.04 241.22 L 436.65 242.04 L 437.93 242.7 L 437.93 242.7 L 440.87 242.91 L 440.87 242.91 L 440.18 243.56 L 439.96 244.54 L 439.4 245.01 L 435.58 247.03 L 432.37 249.65 L 432.18 250.02 L 433.47 251.82 L 433.11 252.21 L 432.1 252.48 L 431.2 253.09 L 429.68 256.58 L 428.67 257.3 L 428.17 258.46 L 428.4 259.38 L 430.26 261.33 L 433.85 262 L 435.72 262.99 L 435.77 263.75 L 435.21 264.2 L 433.17 265.01 L 432.74 265.97 L 432.83 266.47 L 433.18 266.8 L 434.21 266.62 L 435.13 266.91 L 435.71 267.42 L 436 268.06 L 435.04 268.77 L 433.89 269.19 L 431.94 270.86 L 431.75 271.71 L 431.7 274.63 L 432.05 275.88 L 432.99 276.54 L 434.04 276.78 L 434.45 277.03 L 434.62 277.45 L 434.67 278.51 L 433.31 280.89 z"}];function Ure({selected:t,onSelect:e}){const s=re(),[n,i]=P.useState(zre),r=l=>{if(l)try{const a=l.getBBox();if(!a.width||!a.height)return;const c=Math.max(a.width,a.height)*.04,d=`${a.x-c} ${a.y-c} ${a.width+c*2} ${a.height+c*2}`;i(f=>f===d?f:d)}catch{}};return o.jsx("svg",{ref:r,viewBox:n,role:"group","aria-label":s("sectionsEditor.brazilMap.ariaLabel"),className:"h-72 w-full rounded-md border border-border/60 bg-muted/20",children:o.jsx("g",{transform:Fre,children:Nx.map(l=>{const a=l.code===t;return o.jsx("g",{transform:l.gTransform,children:o.jsx("path",{d:l.d,transform:l.pathTransform,role:"button",tabIndex:0,"aria-label":l.name,"aria-pressed":a,onClick:()=>e(l.code),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),e(l.code))},className:ie("cursor-pointer stroke-background outline-none transition-colors [stroke-width:1] [vector-effect:non-scaling-stroke]","hover:fill-primary/50 focus-visible:fill-primary/50",a?"fill-primary":"fill-muted-foreground/40")})},l.code)})})})}const Hre=[{code:"AF",name:"Afghanistan"},{code:"AX",name:"Åland Islands"},{code:"AL",name:"Albania"},{code:"DZ",name:"Algeria"},{code:"AS",name:"American Samoa"},{code:"AD",name:"Andorra"},{code:"AO",name:"Angola"},{code:"AI",name:"Anguilla"},{code:"AQ",name:"Antarctica"},{code:"AG",name:"Antigua & Barbuda"},{code:"AR",name:"Argentina"},{code:"AM",name:"Armenia"},{code:"AW",name:"Aruba"},{code:"AU",name:"Australia"},{code:"AT",name:"Austria"},{code:"AZ",name:"Azerbaijan"},{code:"BS",name:"Bahamas"},{code:"BH",name:"Bahrain"},{code:"BD",name:"Bangladesh"},{code:"BB",name:"Barbados"},{code:"BY",name:"Belarus"},{code:"BE",name:"Belgium"},{code:"BZ",name:"Belize"},{code:"BJ",name:"Benin"},{code:"BM",name:"Bermuda"},{code:"BT",name:"Bhutan"},{code:"BO",name:"Bolivia"},{code:"BA",name:"Bosnia & Herzegovina"},{code:"BW",name:"Botswana"},{code:"BV",name:"Bouvet Island"},{code:"BR",name:"Brazil"},{code:"VG",name:"British Virgin Islands"},{code:"BN",name:"Brunei"},{code:"BG",name:"Bulgaria"},{code:"BF",name:"Burkina Faso"},{code:"BI",name:"Burundi"},{code:"KH",name:"Cambodia"},{code:"CM",name:"Cameroon"},{code:"CA",name:"Canada"},{code:"CV",name:"Cape Verde"},{code:"BQ",name:"Caribbean Netherlands"},{code:"KY",name:"Cayman Islands"},{code:"CF",name:"Central African Republic"},{code:"TD",name:"Chad"},{code:"IO",name:"Chagos Archipelago"},{code:"CL",name:"Chile"},{code:"CN",name:"China mainland"},{code:"CX",name:"Christmas Island"},{code:"CC",name:"Cocos (Keeling) Islands"},{code:"CO",name:"Colombia"},{code:"KM",name:"Comoros"},{code:"CG",name:"Congo - Brazzaville"},{code:"CD",name:"Congo - Kinshasa"},{code:"CK",name:"Cook Islands"},{code:"CR",name:"Costa Rica"},{code:"CI",name:"Côte d’Ivoire"},{code:"HR",name:"Croatia"},{code:"CU",name:"Cuba"},{code:"CW",name:"Curaçao"},{code:"CY",name:"Cyprus"},{code:"CZ",name:"Czechia"},{code:"DK",name:"Denmark"},{code:"DJ",name:"Djibouti"},{code:"DM",name:"Dominica"},{code:"DO",name:"Dominican Republic"},{code:"EC",name:"Ecuador"},{code:"EG",name:"Egypt"},{code:"SV",name:"El Salvador"},{code:"GQ",name:"Equatorial Guinea"},{code:"ER",name:"Eritrea"},{code:"EE",name:"Estonia"},{code:"SZ",name:"Eswatini"},{code:"ET",name:"Ethiopia"},{code:"FK",name:"Falkland Islands"},{code:"FO",name:"Faroe Islands"},{code:"FJ",name:"Fiji"},{code:"FI",name:"Finland"},{code:"FR",name:"France"},{code:"GF",name:"French Guiana"},{code:"PF",name:"French Polynesia"},{code:"TF",name:"French Southern Territories"},{code:"GA",name:"Gabon"},{code:"GM",name:"Gambia"},{code:"GE",name:"Georgia"},{code:"DE",name:"Germany"},{code:"GH",name:"Ghana"},{code:"GI",name:"Gibraltar"},{code:"GR",name:"Greece"},{code:"GL",name:"Greenland"},{code:"GD",name:"Grenada"},{code:"GP",name:"Guadeloupe"},{code:"GU",name:"Guam"},{code:"GT",name:"Guatemala"},{code:"GG",name:"Guernsey"},{code:"GN",name:"Guinea"},{code:"GW",name:"Guinea-Bissau"},{code:"GY",name:"Guyana"},{code:"HT",name:"Haiti"},{code:"HM",name:"Heard & McDonald Islands"},{code:"HN",name:"Honduras"},{code:"HK",name:"Hong Kong"},{code:"HU",name:"Hungary"},{code:"IS",name:"Iceland"},{code:"IN",name:"India"},{code:"ID",name:"Indonesia"},{code:"IR",name:"Iran"},{code:"IQ",name:"Iraq"},{code:"IE",name:"Ireland"},{code:"IM",name:"Isle of Man"},{code:"IL",name:"Israel"},{code:"IT",name:"Italy"},{code:"JM",name:"Jamaica"},{code:"JP",name:"Japan"},{code:"JE",name:"Jersey"},{code:"JO",name:"Jordan"},{code:"KZ",name:"Kazakhstan"},{code:"KE",name:"Kenya"},{code:"KI",name:"Kiribati"},{code:"KW",name:"Kuwait"},{code:"KG",name:"Kyrgyzstan"},{code:"LA",name:"Laos"},{code:"LV",name:"Latvia"},{code:"LB",name:"Lebanon"},{code:"LS",name:"Lesotho"},{code:"LR",name:"Liberia"},{code:"LY",name:"Libya"},{code:"LI",name:"Liechtenstein"},{code:"LT",name:"Lithuania"},{code:"LU",name:"Luxembourg"},{code:"MO",name:"Macao"},{code:"MG",name:"Madagascar"},{code:"MW",name:"Malawi"},{code:"MY",name:"Malaysia"},{code:"MV",name:"Maldives"},{code:"ML",name:"Mali"},{code:"MT",name:"Malta"},{code:"MH",name:"Marshall Islands"},{code:"MQ",name:"Martinique"},{code:"MR",name:"Mauritania"},{code:"MU",name:"Mauritius"},{code:"YT",name:"Mayotte"},{code:"MX",name:"Mexico"},{code:"FM",name:"Micronesia"},{code:"MD",name:"Moldova"},{code:"MC",name:"Monaco"},{code:"MN",name:"Mongolia"},{code:"ME",name:"Montenegro"},{code:"MS",name:"Montserrat"},{code:"MA",name:"Morocco"},{code:"MZ",name:"Mozambique"},{code:"MM",name:"Myanmar (Burma)"},{code:"NA",name:"Namibia"},{code:"NR",name:"Nauru"},{code:"NP",name:"Nepal"},{code:"NL",name:"Netherlands"},{code:"NC",name:"New Caledonia"},{code:"NZ",name:"New Zealand"},{code:"NI",name:"Nicaragua"},{code:"NE",name:"Niger"},{code:"NG",name:"Nigeria"},{code:"NU",name:"Niue"},{code:"NF",name:"Norfolk Island"},{code:"KP",name:"North Korea"},{code:"MK",name:"North Macedonia"},{code:"MP",name:"Northern Mariana Islands"},{code:"NO",name:"Norway"},{code:"OM",name:"Oman"},{code:"PK",name:"Pakistan"},{code:"PW",name:"Palau"},{code:"PS",name:"Palestinian Territories"},{code:"PA",name:"Panama"},{code:"PG",name:"Papua New Guinea"},{code:"PY",name:"Paraguay"},{code:"PE",name:"Peru"},{code:"PH",name:"Philippines"},{code:"PN",name:"Pitcairn Islands"},{code:"PL",name:"Poland"},{code:"PT",name:"Portugal"},{code:"PR",name:"Puerto Rico"},{code:"QA",name:"Qatar"},{code:"RE",name:"Réunion"},{code:"RO",name:"Romania"},{code:"RU",name:"Russia"},{code:"RW",name:"Rwanda"},{code:"WS",name:"Samoa"},{code:"SM",name:"San Marino"},{code:"ST",name:"São Tomé & Príncipe"},{code:"SA",name:"Saudi Arabia"},{code:"SN",name:"Senegal"},{code:"RS",name:"Serbia"},{code:"SC",name:"Seychelles"},{code:"SL",name:"Sierra Leone"},{code:"SG",name:"Singapore"},{code:"SX",name:"Sint Maarten"},{code:"SK",name:"Slovakia"},{code:"SI",name:"Slovenia"},{code:"GS",name:"So. Georgia & So. Sandwich Isl."},{code:"SB",name:"Solomon Islands"},{code:"SO",name:"Somalia"},{code:"ZA",name:"South Africa"},{code:"KR",name:"South Korea"},{code:"SS",name:"South Sudan"},{code:"ES",name:"Spain"},{code:"LK",name:"Sri Lanka"},{code:"BL",name:"St. Barthélemy"},{code:"SH",name:"St. Helena"},{code:"KN",name:"St. Kitts & Nevis"},{code:"LC",name:"St. Lucia"},{code:"MF",name:"St. Martin"},{code:"PM",name:"St. Pierre & Miquelon"},{code:"VC",name:"St. Vincent & Grenadines"},{code:"SD",name:"Sudan"},{code:"SR",name:"Suriname"},{code:"SJ",name:"Svalbard & Jan Mayen"},{code:"SE",name:"Sweden"},{code:"CH",name:"Switzerland"},{code:"SY",name:"Syria"},{code:"TW",name:"Taiwan"},{code:"TJ",name:"Tajikistan"},{code:"TZ",name:"Tanzania"},{code:"TH",name:"Thailand"},{code:"TL",name:"Timor-Leste"},{code:"TG",name:"Togo"},{code:"TK",name:"Tokelau"},{code:"TO",name:"Tonga"},{code:"T1",name:"Tor network (Cloudflare)"},{code:"TT",name:"Trinidad & Tobago"},{code:"TN",name:"Tunisia"},{code:"TR",name:"Türkiye"},{code:"TM",name:"Turkmenistan"},{code:"TC",name:"Turks & Caicos Islands"},{code:"TV",name:"Tuvalu"},{code:"UM",name:"U.S. Outlying Islands"},{code:"VI",name:"U.S. Virgin Islands"},{code:"UG",name:"Uganda"},{code:"UA",name:"Ukraine"},{code:"AE",name:"United Arab Emirates"},{code:"GB",name:"United Kingdom"},{code:"US",name:"United States"},{code:"XX",name:"Unknown (Cloudflare could not determine)"},{code:"UY",name:"Uruguay"},{code:"UZ",name:"Uzbekistan"},{code:"VU",name:"Vanuatu"},{code:"VA",name:"Vatican City"},{code:"VE",name:"Venezuela"},{code:"VN",name:"Vietnam"},{code:"WF",name:"Wallis & Futuna"},{code:"EH",name:"Western Sahara"},{code:"YE",name:"Yemen"},{code:"ZM",name:"Zambia"},{code:"ZW",name:"Zimbabwe"}],Kre="BR";function Wre(t){if(!t)return!1;const e=Object.keys(t).sort();return e.length===3&&e[0]==="city"&&e[1]==="country"&&e[2]==="regionCode"}function qre(t){const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return{city:typeof e.city=="string"?e.city:"",regionCode:typeof e.regionCode=="string"?e.regionCode:"",country:typeof e.country=="string"?e.country:""}}function Gre(t,e){const s={...t,...e},n={};for(const i of["city","regionCode","country"])s[i]&&(n[i]=s[i]);return n}function gv(t){const e=B.c(37),{id:s,options:n,value:i,placeholder:r,emptyMessage:l,onChange:a}=t,[c,d]=P.useState(!1);let f;if(e[0]!==n||e[1]!==i){let S;e[3]!==i?(S=k=>k.value===i,e[3]=i,e[4]=S):S=e[4],f=n.find(S),e[0]=n,e[1]=i,e[2]=f}else f=e[2];const u=f;let h;e[5]!==r||e[6]!==u?(h=u?o.jsx("span",{className:"truncate",children:u.label}):o.jsx("span",{className:"text-muted-foreground",children:r}),e[5]=r,e[6]=u,e[7]=h):h=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(S9,{className:"size-4 shrink-0 opacity-50"}),e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==c||e[11]!==h?(p=o.jsx(ns,{asChild:!0,children:o.jsxs(ue,{id:s,variant:"outline",role:"combobox","aria-expanded":c,className:"h-10 w-full justify-between font-normal",children:[h,m]})}),e[9]=s,e[10]=c,e[11]=h,e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g={width:"var(--radix-popover-trigger-width)"},e[13]=g):g=e[13];let x;e[14]!==r?(x=o.jsx(On,{placeholder:r,className:"h-9"}),e[14]=r,e[15]=x):x=e[15];let b;e[16]!==l?(b=o.jsx(Cn,{children:l}),e[16]=l,e[17]=b):b=e[17];let y;if(e[18]!==a||e[19]!==n||e[20]!==i){let S;e[22]!==a||e[23]!==i?(S=k=>o.jsxs(Wt,{value:`${k.label} ${k.value}`,onSelect:()=>{a(k.value===i?"":k.value),d(!1)},children:[o.jsx("span",{className:"truncate",children:k.label}),o.jsx(Ft,{className:ie("ml-auto size-4 shrink-0",i===k.value?"opacity-100":"opacity-0")})]},k.value),e[22]=a,e[23]=i,e[24]=S):S=e[24],y=n.map(S),e[18]=a,e[19]=n,e[20]=i,e[21]=y}else y=e[21];let L;e[25]!==y?(L=o.jsx(fs,{children:y}),e[25]=y,e[26]=L):L=e[26];let v;e[27]!==b||e[28]!==L?(v=o.jsxs($n,{children:[b,L]}),e[27]=b,e[28]=L,e[29]=v):v=e[29];let _;e[30]!==v||e[31]!==x?(_=o.jsx(is,{className:"p-0",style:g,children:o.jsxs(Yn,{children:[x,v]})}),e[30]=v,e[31]=x,e[32]=_):_=e[32];let w;return e[33]!==c||e[34]!==_||e[35]!==p?(w=o.jsxs(rs,{open:c,onOpenChange:d,children:[p,_]}),e[33]=c,e[34]=_,e[35]=p,e[36]=w):w=e[36],w}const Yre=Hre.map(t=>({value:t.code,label:`${t.name} (${t.code})`})),Jre=Nx.map(t=>({value:t.code,label:`${t.name} (${t.code})`}));function Lj(t){const e=B.c(66),{schema:s,value:n,onChange:i,path:r,sandbox:l}=t,a=re();let c;e[0]!==n?(c=qre(n),e[0]=n,e[1]=c):c=e[1];const d=c,{city:f,regionCode:u,country:h}=d;let m;e[2]!==s.properties?(m=s.properties??{},e[2]=s.properties,e[3]=m):m=e[3];const p=m;let g;e[4]!==p.country?.title||e[5]!==a?(g=p.country?.title??a("sectionsEditor.locationField.countryDefault"),e[4]=p.country?.title,e[5]=a,e[6]=g):g=e[6];const x=g;let b;e[7]!==p.regionCode?.title||e[8]!==a?(b=p.regionCode?.title??a("sectionsEditor.locationField.regionDefault"),e[7]=p.regionCode?.title,e[8]=a,e[9]=b):b=e[9];const y=b;let L;e[10]!==p.city?.title||e[11]!==a?(L=p.city?.title??a("sectionsEditor.locationField.cityDefault"),e[10]=p.city?.title,e[11]=a,e[12]=L):L=e[12];const v=L;let _;e[13]!==d||e[14]!==i?(_=j=>{i(Gre(d,j))},e[13]=d,e[14]=i,e[15]=_):_=e[15];const w=_,S=h===Kre;let k;if(e[16]!==f||e[17]!==v||e[18]!==h||e[19]!==x||e[20]!==w||e[21]!==S||e[22]!==r||e[23]!==u||e[24]!==y||e[25]!==l?.virtualMcpId||e[26]!==s.description||e[27]!==s.title||e[28]!==a){let j;e[30]!==u?(j=U=>U.code===u,e[30]=u,e[31]=j):j=e[31];const C=Nx.find(j),T=`${r}.country`;let N;e[32]!==s.title||e[33]!==a?(N=s.title??a("sectionsEditor.locationField.locationDefault"),e[32]=s.title,e[33]=a,e[34]=N):N=e[34];const V=l?.virtualMcpId;let A;e[35]!==s.description||e[36]!==N||e[37]!==V||e[38]!==T?(A=o.jsx(Hs,{htmlFor:T,label:N,description:s.description,virtualMcpId:V}),e[35]=s.description,e[36]=N,e[37]=V,e[38]=T,e[39]=A):A=e[39];const E=`${r}.country`;let R;e[40]!==x||e[41]!==E?(R=o.jsx(Mt,{htmlFor:E,className:"text-xs",children:x}),e[40]=x,e[41]=E,e[42]=R):R=e[42];const I=`${r}.country`;let D;e[43]!==a?(D=a("sectionsEditor.locationField.selectCountryPlaceholder"),e[43]=a,e[44]=D):D=e[44];let O;e[45]!==a?(O=a("sectionsEditor.locationField.noCountryFound"),e[45]=a,e[46]=O):O=e[46];let z;e[47]!==w?(z=U=>w({country:U,regionCode:"",city:""}),e[47]=w,e[48]=z):z=e[48];let M;e[49]!==h||e[50]!==I||e[51]!==D||e[52]!==O||e[53]!==z?(M=o.jsx(gv,{id:I,options:Yre,value:h,placeholder:D,emptyMessage:O,onChange:z}),e[49]=h,e[50]=I,e[51]=D,e[52]=O,e[53]=z,e[54]=M):M=e[54];let $;e[55]!==R||e[56]!==M?($=o.jsxs("div",{className:"space-y-1.5",children:[R,M]}),e[55]=R,e[56]=M,e[57]=$):$=e[57];let F;e[58]!==h||e[59]!==w||e[60]!==S||e[61]!==r||e[62]!==u||e[63]!==y||e[64]!==a?(F=h&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Mt,{htmlFor:`${r}.regionCode`,className:"text-xs",children:y}),S?o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ure,{selected:u,onSelect:U=>w({regionCode:U===u?"":U,city:""})}),o.jsx(gv,{id:`${r}.regionCode`,options:Jre,value:u,placeholder:a("sectionsEditor.locationField.selectStatePlaceholder"),emptyMessage:a("sectionsEditor.locationField.noStateFound"),onChange:U=>w({regionCode:U,city:""})})]}):o.jsxs(o.Fragment,{children:[o.jsx(mt,{id:`${r}.regionCode`,type:"text",value:u,placeholder:a("sectionsEditor.locationField.regionCodePlaceholder"),onChange:U=>w({regionCode:U.target.value})}),o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.regionCodeHelperText")})]})]}),e[58]=h,e[59]=w,e[60]=S,e[61]=r,e[62]=u,e[63]=y,e[64]=a,e[65]=F):F=e[65],k=o.jsxs("div",{className:"space-y-4",children:[A,$,F,h&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Mt,{htmlFor:`${r}.city`,className:"text-xs",children:v}),o.jsx(mt,{id:`${r}.city`,type:"text",value:f,placeholder:S&&C?a("sectionsEditor.locationField.cityPlaceholderWithState",{state:C.name}):a("sectionsEditor.locationField.cityPlaceholder"),onChange:U=>w({city:U.target.value})}),o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.cityHelperText")})]})]}),e[16]=f,e[17]=v,e[18]=h,e[19]=x,e[20]=w,e[21]=S,e[22]=r,e[23]=u,e[24]=y,e[25]=l?.virtualMcpId,e[26]=s.description,e[27]=s.title,e[28]=a,e[29]=k}else k=e[29];return k}function Qre(t){const e=t.schema;if(!e?.properties)return null;const s=new Set(Object.keys(t.discriminators??{}));if(s.size===0)return e;const n={};for(const[i,r]of Object.entries(e.properties))s.has(i)||(n[i]=r);return Object.keys(n).length===0?null:{...e,properties:n}}function Xre(t){const e=B.c(52),s=re(),{schema:n,value:i,onChange:r,path:l,label:a}=t;let c,d;e[0]!==n.inlineUnionBranches||e[1]!==i?(c=n.inlineUnionBranches??[],d=Jk(i,c.map(Zre)),e[0]=n.inlineUnionBranches,e[1]=i,e[2]=c,e[3]=d):(c=e[2],d=e[3]);const f=d,[u,h]=P.useState(f),[m,p]=P.useState(f);m!==f&&(p(f),h(f));const g=Math.min(u,c.length-1),x=c[g];let b;e[4]!==c||e[5]!==r?(b=D=>{const O=Number(D);h(O),r({...c[O]?.discriminators??{}})},e[4]=c,e[5]=r,e[6]=b):b=e[6];const y=b;if(c.length===0)return null;let L;e[7]!==x?(L=x?Qre(x):null,e[7]=x,e[8]=L):L=e[8];const v=L;let _;if(e[9]!==x?.schema?.properties||e[10]!==i){let D;e[12]!==x?.schema?.properties?(D=x?.schema?.properties??{},e[12]=x?.schema?.properties,e[13]=D):D=e[13],_=lie(i,Object.keys(D)),e[9]=x?.schema?.properties,e[10]=i,e[11]=_}else _=e[11];const w=_;let S;e[14]!==a||e[15]!==l||e[16]!==t.sandbox?.virtualMcpId||e[17]!==n.description?(S=a&&o.jsx(Hs,{htmlFor:l,label:a,description:n.description,virtualMcpId:t.sandbox?.virtualMcpId}),e[14]=a,e[15]=l,e[16]=t.sandbox?.virtualMcpId,e[17]=n.description,e[18]=S):S=e[18];const k=String(g);let j;e[19]!==s?(j=s("sectionsEditor.inlineUnionField.selectPlaceholder"),e[19]=s,e[20]=j):j=e[20];let C;e[21]!==j?(C=o.jsx(Ns,{placeholder:j}),e[21]=j,e[22]=C):C=e[22];let T;e[23]!==l||e[24]!==C?(T=o.jsx(_s,{id:l,className:"w-full min-w-0",children:C}),e[23]=l,e[24]=C,e[25]=T):T=e[25];let N;if(e[26]!==c||e[27]!==s){let D;e[29]!==s?(D=(O,z)=>o.jsx(Rt,{value:String(z),children:hie(O.title)||s("sectionsEditor.inlineUnionField.branchFallback",{index:z+1})},O.title),e[29]=s,e[30]=D):D=e[30],N=c.map(D),e[26]=c,e[27]=s,e[28]=N}else N=e[28];let V;e[31]!==N?(V=o.jsx(Ls,{children:N}),e[31]=N,e[32]=V):V=e[32];let A;e[33]!==y||e[34]!==V||e[35]!==k||e[36]!==T?(A=o.jsxs(ys,{value:k,onValueChange:y,children:[T,V]}),e[33]=y,e[34]=V,e[35]=k,e[36]=T,e[37]=A):A=e[37];let E;e[38]!==A||e[39]!==S?(E=o.jsxs("div",{className:"space-y-1.5",children:[S,A]}),e[38]=A,e[39]=S,e[40]=E):E=e[40];let R;e[41]!==x||e[42]!==v||e[43]!==r||e[44]!==l||e[45]!==w||e[46]!==t||e[47]!==i?(R=x&&(Wre(x.schema?.properties)?o.jsx(Lj,{...t,schema:x.schema,onChange:D=>r({...w,...D,...x.discriminators??{}})}):v?o.jsx(Ii,{schema:v,value:i,onChange:D=>r({...D,...x.discriminators??{}}),basePath:l,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:t.meta,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,sandbox:t.sandbox,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection}):null),e[41]=x,e[42]=v,e[43]=r,e[44]=l,e[45]=w,e[46]=t,e[47]=i,e[48]=R):R=e[48];let I;return e[49]!==E||e[50]!==R?(I=o.jsxs("div",{className:"space-y-3",children:[E,R]}),e[49]=E,e[50]=R,e[51]=I):I=e[51],I}function Zre(t){return{discriminators:t.discriminators,propertyKeys:Object.keys(t.schema?.properties??{})}}const eoe={lat:-21.9,lng:-41.42},Op=1e5;let Lf=null;function toe(t){return Lf||(Lf=new Promise((e,s)=>{if(typeof window>"u"){s(new Error("Google Maps requires a browser environment"));return}const n=window;if(n.google?.maps){e(n.google.maps);return}const i=()=>{const a=window.google?.maps;a?e(a):s(new Error("Google Maps script loaded without google.maps"))},r=document.querySelector("script[data-google-maps-loader]");if(r){r.addEventListener("load",i),r.addEventListener("error",()=>s(new Error("Failed to load Google Maps")));return}const l=document.createElement("script");l.src=`https://maps.googleapis.com/maps/api/js?key=${t}&v=weekly&libraries=maps`,l.async=!0,l.defer=!0,l.dataset.googleMapsLoader="true",l.addEventListener("load",i),l.addEventListener("error",()=>s(new Error("Failed to load Google Maps"))),document.head.appendChild(l)}),Lf)}function soe(t){if(typeof t!="string"||!t)return null;const e=t.split(",").map(Number),[s,n,i]=e;return!Number.isFinite(s)||!Number.isFinite(n)?null:{lat:s,lng:n,radius:Number.isFinite(i)?i:Op}}function noe({schema:t,value:e,onChange:s,path:n,label:i,sandbox:r}){const l=uT().googleMapsApiKey,a=P.useRef(s);a.current=s;const c=P.useRef(soe(e)),[d,f]=P.useState(null),u=P.useRef(null),h=m=>{if(!m||!l)return;const p={disposed:!1,circle:null,listeners:[]};return toe(l).then(g=>{if(p.disposed)return;const x=c.current,b=x?{lat:x.lat,lng:x.lng}:eoe,y=x?.radius??Op,L=new g.Map(m,{center:b,zoom:y?Math.round(Math.log2(768e4/y))+1:4,draggable:!0,streetViewControl:!1,mapTypeControl:!1}),v=new g.Circle({strokeColor:"#2E6ED9",strokeOpacity:.8,strokeWeight:2,fillColor:"#2E6ED9",fillOpacity:.35,editable:!0,draggable:!0,map:L,center:b,radius:y});p.circle=v;const _=()=>{const S=v.getCenter(),k=v.getRadius();S&&a.current(`${S.lat()},${S.lng()},${k}`)},w=S=>{S&&p.listeners.push(S)};w(L.addListener("click",S=>{S.latLng&&(v.setCenter({lat:S.latLng.lat(),lng:S.latLng.lng()}),v.getRadius()||v.setRadius(Op),_())})),w(v.addListener("radius_changed",_)),w(v.addListener("dragend",_))},g=>{p.disposed||f(g instanceof Error?g.message:"Failed to load map")}),()=>{p.disposed=!0;for(const g of p.listeners)try{g?.remove()}catch{}if(p.listeners=[],p.circle){try{p.circle.setMap(null)}catch{}p.circle=null}}};return u.current||(u.current=h),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Hs,{htmlFor:n,label:i,description:t.description,virtualMcpId:r?.virtualMcpId}),l?d?o.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:d}):o.jsx("div",{ref:u.current,id:n,className:"h-72 w-full rounded-md border border-border/60"}):o.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:["The map picker is unavailable — set"," ",o.jsx("code",{className:"font-mono",children:"GOOGLE_MAPS_API_KEY"})," on the server to enable it."]})]})}const ioe="oklch(0.65 0.15 160)",roe="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",wj="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]",k3e="text-[oklch(0.45_0.15_160)] focus:bg-[oklch(0.65_0.15_160/0.12)] focus:text-[oklch(0.45_0.15_160)] dark:text-[oklch(0.78_0.15_160)] dark:focus:bg-[oklch(0.65_0.15_160/0.15)] dark:focus:text-[oklch(0.78_0.15_160)]";function xv(t){return t.map(e=>e.label).join(`
622
- `)}function bv(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function ooe(t,e){const s=new Map;for(const n of t){const i=s.get(n.label);i?i.push(n):s.set(n.label,[n])}return e.map(n=>({id:s.get(n.label)?.shift()?.id??crypto.randomUUID(),index:n.index,label:n.label}))}function loe(t){return t.map((e,s)=>({...e,index:s}))}function Sj(t){const e=B.c(19),{label:s,canDelete:n,dragging:i,onRename:r,onDuplicate:l,onDelete:a}=t,c=re(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let f;e[0]!==d?(f=ie("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=f):f=e[1];let u;e[2]!==f?(u=o.jsx(ld,{className:f}),e[2]=f,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Ko,{className:"h-4 w-4 shrink-0",style:{color:ioe}}),e[4]=h):h=e[4];let m;e[5]!==s?(m=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==r||e[13]!==c?(p=!i&&o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionVariantList.openActionsFor",{label:s}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 data-[state=open]:opacity-100",onClick:coe,onPointerDown:aoe,children:o.jsx(qn,{size:14})})}),o.jsxs(zt,{align:"end",children:[r&&o.jsxs(Xe,{onClick:x=>{x.stopPropagation(),r()},children:[o.jsx(v8,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),o.jsxs(Xe,{onClick:x=>{x.stopPropagation(),l?.()},children:[o.jsx(an,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),o.jsxs(Xe,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[o.jsx(tn,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=a,e[11]=l,e[12]=r,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==u||e[16]!==m||e[17]!==p?(g=o.jsxs(o.Fragment,{children:[u,h,m,p]}),e[15]=u,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function aoe(t){return t.stopPropagation()}function coe(t){return t.stopPropagation()}function doe(t){const e=B.c(27),{entry:s,selected:n,canDelete:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:uoe},e[0]=s.id,e[1]=d):d=e[1];const{attributes:f,listeners:u,setNodeRef:h,transform:m,isDragging:p}=K9(d);let g;e[2]!==m?(g=Ti.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const y=b;let L;e[7]!==r?(L=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),r())},e[7]=r,e[8]=L):L=e[8];const v=p?"cursor-grabbing":"cursor-grab",_=n?wj:roe;let w;e[9]!==v||e[10]!==_?(w=ie("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",v,_),e[9]=v,e[10]=_,e[11]=w):w=e[11];let S;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(S=o.jsx(Sj,{label:s.label,canDelete:i,onRename:l,onDuplicate:a,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=a,e[16]=l,e[17]=S):S=e[17];let k;return e[18]!==f||e[19]!==u||e[20]!==r||e[21]!==h||e[22]!==y||e[23]!==L||e[24]!==w||e[25]!==S?(k=o.jsx("div",{ref:h,style:y,...f,...u,onClick:r,onKeyDown:L,className:w,children:S}),e[18]=f,e[19]=u,e[20]=r,e[21]=h,e[22]=y,e[23]=L,e[24]=w,e[25]=S,e[26]=k):k=e[26],k}function uoe(){return!1}function foe(t){const e=B.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:f,onAdd:u}=t,h=re(),m=n.length>1;let p;e[0]!==n?(p=()=>bv(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=P.useState(p),[b,y]=P.useState(null),[L,v]=P.useState(s),[_,w]=P.useState(n.length);let S;e[2]!==n?(S=()=>xv(n),e[2]=n,e[3]=S):S=e[3];const[k,j]=P.useState(S),C=P.useRef(!1),T=xv(n);L!==s?(v(s),w(n.length),j(T),x(bv(n))):(_!==n.length||k!==T)&&(w(n.length),j(T),x(fe=>ooe(fe,n)));let N;e[4]===Symbol.for("react.memo_cache_sentinel")?(N={activationConstraint:{distance:8}},e[4]=N):N=e[4];let V;e[5]===Symbol.for("react.memo_cache_sentinel")?(V={coordinateGetter:W9},e[5]=V):V=e[5];const A=S0(pr(ba,N),pr(xa,V));let E;e[6]!==g?(E=g.map(hoe),e[6]=g,e[7]=E):E=e[7];const R=E;let I;e[8]!==g?(I=fe=>{const de=String(fe.active.id);y(g.find(pe=>pe.id===de)??null)},e[8]=g,e[9]=I):I=e[9];const D=I;let O;e[10]!==R||e[11]!==f?(O=fe=>{y(null);const{active:de,over:pe}=fe;if(!pe||de.id===pe.id)return;const te=R.indexOf(String(de.id)),ge=R.indexOf(String(pe.id));te===-1||ge===-1||(x(ve=>loe(Ql([...ve],te,ge))),C.current=!0,requestAnimationFrame(()=>{C.current=!1}),f(te,ge))},e[10]=R,e[11]=f,e[12]=O):O=e[12];const z=O;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{y(null)},e[13]=M):M=e[13];const $=M;let F,U,H,q,W,G,Y,J,se,oe,ne,Q,K;if(e[14]!==m||e[15]!==g||e[16]!==R||e[17]!==z||e[18]!==D||e[19]!==u||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==r||e[25]!==i||e[26]!==A||e[27]!==h){const fe=Ze=>{C.current||r(Ze)};ne="space-y-1 border-b p-2";let de;e[41]!==h?(de=h("sectionsEditor.sectionVariantList.title"),e[41]=h,e[42]=de):de=e[42];let pe;e[43]!==de?(pe=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:de}),e[43]=de,e[44]=pe):pe=e[44];let te;e[45]!==h?(te=h("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=h,e[46]=te):te=e[46];let ge;e[47]===Symbol.for("react.memo_cache_sentinel")?(ge=o.jsx(Kt,{size:14}),e[47]=ge):ge=e[47];let ve;e[48]!==u||e[49]!==te?(ve=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":te,className:"size-6",onClick:u,children:ge})}),e[48]=u,e[49]=te,e[50]=ve):ve=e[50];let Se;e[51]!==h?(Se=h("sectionsEditor.sectionVariantList.addVariant"),e[51]=h,e[52]=Se):Se=e[52];let ye;e[53]!==Se?(ye=o.jsx(We,{children:Se}),e[53]=Se,e[54]=ye):ye=e[54];let ke;e[55]!==ve||e[56]!==ye?(ke=o.jsxs(qe,{children:[ve,ye]}),e[55]=ve,e[56]=ye,e[57]=ke):ke=e[57];let we;e[58]!==h?(we=h("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=h,e[59]=we):we=e[59];let je;e[60]===Symbol.for("react.memo_cache_sentinel")?(je=o.jsx(tn,{size:14}),e[60]=je):je=e[60];let me;e[61]!==d||e[62]!==we?(me=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":we,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:je})}),e[61]=d,e[62]=we,e[63]=me):me=e[63];let Ce;e[64]!==h?(Ce=h("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=h,e[65]=Ce):Ce=e[65];let Ne;e[66]!==Ce?(Ne=o.jsx(We,{children:Ce}),e[66]=Ce,e[67]=Ne):Ne=e[67];let Ie;e[68]!==me||e[69]!==Ne?(Ie=o.jsxs(qe,{children:[me,Ne]}),e[68]=me,e[69]=Ne,e[70]=Ie):Ie=e[70];let et;e[71]!==ke||e[72]!==Ie?(et=o.jsxs("div",{className:"flex items-center gap-0.5",children:[ke,Ie]}),e[71]=ke,e[72]=Ie,e[73]=et):et=e[73],e[74]!==pe||e[75]!==et?(Q=o.jsxs("div",{className:"flex items-center justify-between",children:[pe,et]}),e[74]=pe,e[75]=et,e[76]=Q):Q=e[76],U=j0,G=A,Y=T3,J=D,se=z,oe=$,F=H9,q=R,W=U9,K="space-y-0.5",H=g.map(Ze=>o.jsx(doe,{entry:Ze,selected:Ze.index===i,canDelete:m,onSelect:()=>fe(Ze.index),onRename:l?()=>l(Ze.index):void 0,onDuplicate:()=>a(Ze.index),onDelete:()=>c(Ze.index)},Ze.id)),e[14]=m,e[15]=g,e[16]=R,e[17]=z,e[18]=D,e[19]=u,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=r,e[25]=i,e[26]=A,e[27]=h,e[28]=F,e[29]=U,e[30]=H,e[31]=q,e[32]=W,e[33]=G,e[34]=Y,e[35]=J,e[36]=se,e[37]=oe,e[38]=ne,e[39]=Q,e[40]=K}else F=e[28],U=e[29],H=e[30],q=e[31],W=e[32],G=e[33],Y=e[34],J=e[35],se=e[36],oe=e[37],ne=e[38],Q=e[39],K=e[40];let X;e[77]!==H||e[78]!==K?(X=o.jsx("div",{className:K,children:H}),e[77]=H,e[78]=K,e[79]=X):X=e[79];let Z;e[80]!==F||e[81]!==q||e[82]!==W||e[83]!==X?(Z=o.jsx(F,{items:q,strategy:W,children:X}),e[80]=F,e[81]=q,e[82]=W,e[83]=X,e[84]=Z):Z=e[84];let le;e[85]!==b||e[86]!==m?(le=b?o.jsx("div",{className:ie("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",wj),children:o.jsx(Sj,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=le):le=e[87];let ee;e[88]!==le?(ee=_n.createPortal(o.jsx(F9,{dropAnimation:Kk,children:le}),document.body),e[88]=le,e[89]=ee):ee=e[89];let ae;e[90]!==U||e[91]!==G||e[92]!==Y||e[93]!==J||e[94]!==se||e[95]!==oe||e[96]!==Z||e[97]!==ee?(ae=o.jsxs(U,{sensors:G,collisionDetection:Y,onDragStart:J,onDragEnd:se,onDragCancel:oe,children:[Z,ee]}),e[90]=U,e[91]=G,e[92]=Y,e[93]=J,e[94]=se,e[95]=oe,e[96]=Z,e[97]=ee,e[98]=ae):ae=e[98];let ce;return e[99]!==ne||e[100]!==Q||e[101]!==ae?(ce=o.jsxs("div",{className:ne,children:[Q,ae]}),e[99]=ne,e[100]=Q,e[101]=ae,e[102]=ce):ce=e[102],ce}function hoe(t){return t.id}const moe=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],poe={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",gift:"Gift01","user-check":"UserCheck01","user-x":"UserX01",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function im(t){return ha(t)!==void 0}function Tx(t,e){if(e){if(im(e))return e;const s=poe[e];if(s&&im(s))return s}for(const[s,n]of moe)if(s.test(t)&&im(n))return n;return"FilterLines"}function goe(t){return ha(t)??w9}function rm(t){const e=B.c(11),{iconName:s,size:n,className:i}=t,r=n===void 0?"md":n;let l;e[0]!==s?(l=goe(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=r==="sm"?"size-7":"size-9",d=r==="sm"?16:18;let f;e[2]!==c||e[3]!==i?(f=ie("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=f):f=e[4];let u;e[5]!==a||e[6]!==d?(u=o.jsx(a,{size:d,className:"text-muted-foreground"}),e[5]=a,e[6]=d,e[7]=u):u=e[7];let h;return e[8]!==f||e[9]!==u?(h=o.jsx("div",{className:f,children:u}),e[8]=f,e[9]=u,e[10]=h):h=e[10],h}function j3e(t,e){return pte(t,e).map(s=>{const n=e[s.blockKey]??{},i=lk(bte(s.blockKey),e,t);return{blockKey:s.blockKey,title:Jl(s.blockKey,n),description:ed(i),iconName:Tx(s.matcherResolveType)}})}const kj="Users03";function xoe(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function boe(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[i,r]of Object.entries(e))if(i.includes("matchers")&&!i.startsWith("$live/"))for(const l of Object.keys(r)){if(l.toLowerCase().includes("always")||n.has(l))continue;n.add(l);const a=bl(l,t);s.push({resolveType:l,title:a.title??vs(l),description:a.description,iconName:Tx(l,a.icon)})}return s}function voe(t,e){if(!t)return kj;const s=e.find(n=>n.resolveType===t);return s?s.iconName:Tx(t)}function yoe(t){const e=B.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:r,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[f,u]=P.useState(!1),h=re(),p=(i?d.find(Q=>Q.blockKey===i):void 0)?.iconName??voe(s,r),g=ha(p);let x;e[0]!==a||e[1]!==u?(x=Q=>{a(Q),u(!1)},e[0]=a,e[1]=u,e[2]=x):x=e[2];const b=x;let y;e[3]!==c||e[4]!==u?(y=Q=>{c?.(Q),u(!1)},e[3]=c,e[4]=u,e[5]=y):y=e[5];const L=y;let v;e[6]!==u?(v=()=>u(!0),e[6]=u,e[7]=v):v=e[7];let _;e[8]!==g?(_=g&&o.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=_):_=e[9];let w;e[10]!==n?(w=o.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=w):w=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Qt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=S):S=e[12];let k;e[13]!==v||e[14]!==_||e[15]!==w?(k=o.jsxs("button",{type:"button",onClick:v,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[_,w,S]}),e[13]=v,e[14]=_,e[15]=w,e[16]=k):k=e[16];let j;e[17]!==h?(j=h("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=h,e[18]=j):j=e[18];let C;e[19]!==h?(C=h("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=h,e[20]=C):C=e[20];let T;e[21]!==h?(T=h("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=h,e[22]=T):T=e[22];let N;e[23]!==T?(N=o.jsx(On,{placeholder:T}),e[23]=T,e[24]=N):N=e[24];let V;e[25]!==h?(V=h("sectionsEditor.matcherPicker.noRulesFound"),e[25]=h,e[26]=V):V=e[26];let A;e[27]!==V?(A=o.jsx(Cn,{children:V}),e[27]=V,e[28]=A):A=e[28];let E;e[29]!==h?(E=h("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=h,e[30]=E):E=e[30];let R;e[31]!==h?(R=h("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=h,e[32]=R):R=e[32];const I=`${E} ${R}`;let D;e[33]!==b?(D=()=>b(""),e[33]=b,e[34]=D):D=e[34];const O=!s&&!i&&"bg-accent/60";let z;e[35]!==O?(z=ie("gap-2.5",O),e[35]=O,e[36]=z):z=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(rm,{iconName:kj,size:"sm"}),e[37]=M):M=e[37];let $;e[38]!==h?($=h("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=h,e[39]=$):$=e[39];let F;e[40]!==$?(F=o.jsx("span",{className:"text-sm",children:$}),e[40]=$,e[41]=F):F=e[41];let U;e[42]!==h?(U=h("sectionsEditor.matcherPicker.targetAllUsers"),e[42]=h,e[43]=U):U=e[43];let H;e[44]!==U?(H=o.jsx("span",{className:"text-xs text-muted-foreground",children:U}),e[44]=U,e[45]=H):H=e[45];let q;e[46]!==F||e[47]!==H?(q=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[F,H]}),e[46]=F,e[47]=H,e[48]=q):q=e[48];let W;e[49]!==I||e[50]!==D||e[51]!==z||e[52]!==q?(W=o.jsxs(Wt,{value:I,onSelect:D,className:z,children:[M,q]}),e[49]=I,e[50]=D,e[51]=z,e[52]=q,e[53]=W):W=e[53];let G;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==r){let Q;e[59]!==i||e[60]!==s||e[61]!==b?(Q=K=>o.jsxs(Wt,{value:`${K.title} ${K.resolveType} ${K.description??""}`,onSelect:()=>b(K.resolveType),className:ie("gap-2.5",!i&&s===K.resolveType&&"bg-accent/60"),children:[o.jsx(rm,{iconName:K.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm",children:K.title}),K.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:K.description})]})]},K.resolveType),e[59]=i,e[60]=s,e[61]=b,e[62]=Q):Q=e[62],G=r.map(Q),e[54]=i,e[55]=s,e[56]=b,e[57]=r,e[58]=G}else G=e[58];let Y;e[63]!==W||e[64]!==G?(Y=o.jsxs(fs,{children:[W,G]}),e[63]=W,e[64]=G,e[65]=Y):Y=e[65];let J;e[66]!==i||e[67]!==d||e[68]!==L||e[69]!==h?(J=d.length>0&&o.jsx(fs,{heading:h("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(Q=>o.jsxs(Wt,{value:`${Q.title} ${Q.blockKey} ${Q.description??""}`,onSelect:()=>L(Q.blockKey),className:ie("gap-2.5",i===Q.blockKey&&"bg-accent/60"),children:[o.jsx(rm,{iconName:Q.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm",children:Q.title}),Q.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Q.description})]})]},Q.blockKey))}),e[66]=i,e[67]=d,e[68]=L,e[69]=h,e[70]=J):J=e[70];let se;e[71]!==A||e[72]!==Y||e[73]!==J?(se=o.jsxs($n,{children:[A,Y,J]}),e[71]=A,e[72]=Y,e[73]=J,e[74]=se):se=e[74];let oe;e[75]!==f||e[76]!==u||e[77]!==C||e[78]!==N||e[79]!==se||e[80]!==j?(oe=o.jsxs(uE,{open:f,onOpenChange:u,title:j,description:C,className:"sm:max-w-lg",filter:xoe,children:[N,se]}),e[75]=f,e[76]=u,e[77]=C,e[78]=N,e[79]=se,e[80]=j,e[81]=oe):oe=e[81];let ne;return e[82]!==oe||e[83]!==k?(ne=o.jsxs(o.Fragment,{children:[k,oe]}),e[82]=oe,e[83]=k,e[84]=ne):ne=e[84],ne}const _oe="website/sections/Rendering/Lazy.tsx";function Dh(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Vx(t){if(!Dh(t))return!1;const e=t.__resolveType;return typeof e=="string"&&Vs(e)}function Loe(t){return t!=null}function $p(t){if(t==null)return t;if(Vx(t)){const e=t.section;return e==null?null:Dh(e)?e:{}}return Dh(t)?t:void 0}function woe(t,e){return t===null?null:Vx(e)?{...e,section:t}:t}function C3e(t){return{__resolveType:t}}function N3e(t,e){if(!Loe(e))return null;if(t){const s=$p(e)??{};return{__resolveType:_oe,section:s}}return Vx(e)?$p(e)??null:Dh(e)?e:null}const Soe="General";function td(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function jj(t,e){return t===dl?Soe:e}function Cj(t){const e=ah(t),s=new Set,n=[];for(const i of e)td(i.resolveType)&&(li(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:jj(i.resolveType,i.title),description:i.description})));return n}function Ax(t){const e=lh(t),s=In(e,t),n=Cj(s?.properties?.seo);return n.length>0?n:koe(t)}function koe(t){const e=t.manifest?.blocks??{},s=[];for(const[n,i]of Object.entries(e))if(n.includes("sections"))for(const r of Object.keys(i)){if(!td(r))continue;const l=r.split("/").pop()?.replace(/\.tsx?$/,"")??r;s.push({resolveType:r,title:jj(r,l)})}return s}function Nj(t){const e=Ax(t),s=e.find(n=>n.resolveType===dl);return s?s.resolveType:e[0]?.resolveType??dl}function Tj(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=In(s,t),i=Cj(n?.properties?.seo);if(i.length>0)return i}return Ax(t)}function joe(t,e){const s=Tj(t,e),n=s.find(i=>i.resolveType===dl);return n?n.resolveType:s[0]?.resolveType??Nj(t)}function Coe(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:Nj(t)}function Noe(t,e,s){const n=s.__resolveType;return typeof n=="string"&&td(n)?n:joe(t,e)}const Toe=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),dl="website/sections/Seo/SeoV2.tsx",Voe=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function vu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Aoe(t){return typeof t.__resolveType=="string"&&td(t.__resolveType)?!0:Voe.some(e=>e in t)}function Poe(t,e){for(const[s,n]of Object.entries(t)){if(!vu(n))continue;const i=n,r=i.__resolveType;if(typeof r=="string"&&Toe.has(r))continue;const l=i.seo;if(vu(l)){const a=l;if(Aoe(a))return{blockKey:s,kind:"nested",seoData:a,blockData:i,seoResolveType:e?Noe(e,i,a):typeof a.__resolveType=="string"&&td(a.__resolveType)?a.__resolveType:dl}}}for(const[s,n]of Object.entries(t)){if(!vu(n))continue;const i=n;if(typeof i.__resolveType=="string"&&td(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function Eoe(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function T3e(t,e,s){if(e.kind==="site"){const c=Poe(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?Tj(s,c.blockData):void 0,build:d=>Eoe(c,d)}:null}const n=t[e.pageKey];if(!vu(n))return null;const i=n,r=i.seo,l=$p(r),a=l&&vu(l)?l:void 0;return{blockKey:e.pageKey,seoData:a,rawSeoData:r,seoResolveType:s?Coe(s,a):typeof a?.__resolveType=="string"?a.__resolveType:dl,seoTypeOptions:s?Ax(s):void 0,build:c=>({...i,seo:c===null?null:woe(c,r)})}}const Px=["type","title","description","canonical","noIndexing","favicon","image","themeColor"],Roe=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],Doe=["jsonLD","title","description","noIndexing","configJsonLD"];function Vj(t){return t===dl||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function Ioe(t){switch(t){case"general":return Px;case"pdp":return Roe;case"plp":return Doe;default:return null}}function Aj(t,e){const s=Ioe(Vj(e));if(!s||!t.properties)return t;const n={};for(const i of s){const r=t.properties[i];r&&(n[i]=r)}return{...t,properties:n}}function Moe(){return Px.filter(t=>t!=="type")}function Ooe(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function $oe(t,e){return t[e]===void 0}function Boe(t){const e=B.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:r,formResetKey:l}=t,a=re(),d=Aj(s,dl).properties??{},f=Moe();let u;e[0]!==r?(u=!!r&&Object.keys(r).length>0,e[0]=r,e[1]=u):u=e[1];const h=u,[m,p]=P.useState(l);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=P.useState(g);m!==l&&(p(l),b({}));let y;e[3]!==x||e[4]!==n?(y=j=>x[j]!==void 0?x[j]:$oe(n,j),e[3]=x,e[4]=n,e[5]=y):y=e[5];const L=y;let v;e[6]!==i||e[7]!==r||e[8]!==n?(v=(j,C)=>{b(N=>({...N,[j]:C}));const T={...n};if(C)delete T[j];else{const N=r?.[j];T[j]=N??(j==="type"?"website":"")}i(T)},e[6]=i,e[7]=r,e[8]=n,e[9]=v):v=e[9];const _=v,w="min-w-0 space-y-6",S=Px.map(j=>{const C=d[j];if(!C)return null;const T=h&&f.includes(j),N=T&&L(j),V=N?r?.[j]??n[j]:n[j],A=C.title??Ooe(j);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:ie(N&&"pointer-events-none opacity-60"),children:na({schema:C,value:V,onChange:E=>{N||i({...n,[j]:E})},path:j,label:A,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:zoe})}),T&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(hr,{id:`seo-use-default-${j}`,checked:N,onCheckedChange:E=>_(j,E)}),o.jsx(Mt,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:a("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let k;return e[10]!==l||e[11]!==S?(k=o.jsx("div",{className:w,children:S},l),e[10]=l,e[11]=S,e[12]=k):k=e[12],k}function zoe(){}function Foe(t){const e=B.c(18),{schema:s,resolveType:n,value:i,formResetKey:r,onChange:l,onBreadcrumbChange:a,siteDefaultSeo:c}=t;if(Vj(n)==="general"){let g;e[0]!==l?(g=b=>l(b),e[0]=l,e[1]=g):g=e[1];let x;return e[2]!==r||e[3]!==s||e[4]!==c||e[5]!==g||e[6]!==i?(x=o.jsx(Boe,{schema:s,value:i,onChange:g,siteDefaultSeo:c,formResetKey:r}),e[2]=r,e[3]=s,e[4]=c,e[5]=g,e[6]=i,e[7]=x):x=e[7],x}let f;e[8]!==n||e[9]!==s?(f=Aj(s,n),e[8]=n,e[9]=s,e[10]=f):f=e[10];const u=f;let h;e[11]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[11]=h):h=e[11];const m=a??Uoe;let p;return e[12]!==u||e[13]!==r||e[14]!==l||e[15]!==m||e[16]!==i?(p=o.jsx(Ii,{schema:u,value:i,onChange:l,basePath:"",breadcrumbPath:h,onBreadcrumbChange:m},r),e[12]=u,e[13]=r,e[14]=l,e[15]=m,e[16]=i,e[17]=p):p=e[17],p}function Uoe(){}function Hoe(t){const e=B.c(16),{schema:s,value:n,onChange:i,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}=t,d=re();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[0]=f):f=e[0];const[u,h]=P.useState(f);let m;e[1]!==u||e[2]!==d?(m=u.length>0&&o.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[o.jsx("button",{type:"button",onClick:()=>h([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:o.jsx(Bm,{className:"size-3.5"})}),u.map((x,b)=>{const y=b===u.length-1,L=Sn(x);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&o.jsx(en,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>h(u.slice(0,b+1)),title:L,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",y?"font-medium text-foreground":"text-muted-foreground"),children:L})]},`${L}-${b}`)})]}),e[1]=u,e[2]=d,e[3]=m):m=e[3];let p;e[4]!==u||e[5]!==l||e[6]!==r||e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==s||e[11]!==n?(p=o.jsx(Ii,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:u,onBreadcrumbChange:h,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}),e[4]=u,e[5]=l,e[6]=r,e[7]=i,e[8]=a,e[9]=c,e[10]=s,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"space-y-2",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function V3e(t){const e=B.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:r,onBreadcrumbChange:l,breadcrumbPath:a,emptyMessage:c,beforeForm:d,seoResolveType:f,siteDefaultSeo:u,meta:h,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let y;e[0]!==a?(y=a===void 0?[]:a,e[0]=a,e[1]=y):y=e[1];const L=y;let v;e[2]!==s||e[3]!==L||e[4]!==m||e[5]!==i||e[6]!==n||e[7]!==h||e[8]!==l||e[9]!==r||e[10]!==b||e[11]!==p||e[12]!==x||e[13]!==g||e[14]!==f||e[15]!==u?(v=s&&n?f?o.jsx(Foe,{schema:s,resolveType:f,value:n,formResetKey:i,onChange:r,onBreadcrumbChange:l,siteDefaultSeo:u}):o.jsx(Ii,{schema:s,value:n,onChange:r,basePath:"",breadcrumbPath:L,onBreadcrumbChange:l,meta:h,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=L,e[4]=m,e[5]=i,e[6]=n,e[7]=h,e[8]=l,e[9]=r,e[10]=b,e[11]=p,e[12]=x,e[13]=g,e[14]=f,e[15]=u,e[16]=v):v=e[16];const _=v;let w;e[17]!==c||e[18]!==_?(w=_??o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=_,e[19]=w):w=e[19];let S;return e[20]!==d||e[21]!==w?(S=o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[d,w]})}),e[20]=d,e[21]=w,e[22]=S):S=e[22],S}const A3e="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function P3e(t,e){return Qte(t,e,ed)}function E3e(t){const e=B.c(66),{pageKey:s,initialName:n,initialPath:i,onFieldChange:r}=t,l=re(),[a,c]=P.useState(n),[d,f]=P.useState(i),[u,h]=P.useState(s),[m,p]=P.useState(null),g=P.useRef(!1);u!==s&&(h(s),c(n),f(i),p(null));let x;e[0]!==i||e[1]!==d?(x=()=>{if(g.current){g.current=!1;return}const J=d.trim();if(J===i.trim()){f(i);return}p(J)},e[0]=i,e[1]=d,e[2]=x):x=e[2];const b=x;let y;e[3]!==r||e[4]!==m?(y=()=>{m!==null&&(f(m),r("path",m),p(null))},e[3]=r,e[4]=m,e[5]=y):y=e[5];const L=y;let v;e[6]!==i?(v=()=>{f(i),p(null)},e[6]=i,e[7]=v):v=e[7];const _=v;let w;e[8]!==r?(w=J=>{c(J.target.value),r("name",J.target.value)},e[8]=r,e[9]=w):w=e[9];let S;e[10]!==l?(S=l("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=l,e[11]=S):S=e[11];let k;e[12]!==a||e[13]!==w||e[14]!==S?(k=o.jsx("input",{type:"text",value:a,onChange:w,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:S}),e[12]=a,e[13]=w,e[14]=S,e[15]=k):k=e[15];let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j=J=>f(J.target.value),e[16]=j):j=e[16];let C;e[17]!==i?(C=J=>{J.key==="Enter"?(J.preventDefault(),J.currentTarget.blur()):J.key==="Escape"&&(J.preventDefault(),g.current=!0,f(i),J.currentTarget.blur())},e[17]=i,e[18]=C):C=e[18];let T;e[19]!==l?(T=l("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[19]=l,e[20]=T):T=e[20];let N;e[21]!==b||e[22]!==d||e[23]!==C||e[24]!==T?(N=o.jsx("input",{type:"text",value:d,onChange:j,onBlur:b,onKeyDown:C,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:T}),e[21]=b,e[22]=d,e[23]=C,e[24]=T,e[25]=N):N=e[25];const V=m!==null;let A;e[26]!==_?(A=J=>{J||_()},e[26]=_,e[27]=A):A=e[27];let E;e[28]!==l?(E=l("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[28]=l,e[29]=E):E=e[29];let R;e[30]!==E?(R=o.jsx(nl,{children:E}),e[30]=E,e[31]=R):R=e[31];const I=m??"";let D;e[32]!==i||e[33]!==l||e[34]!==I?(D=l("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:i,to:I}),e[32]=i,e[33]=l,e[34]=I,e[35]=D):D=e[35];let O;e[36]!==D?(O=o.jsx(il,{children:D}),e[36]=D,e[37]=O):O=e[37];let z;e[38]!==R||e[39]!==O?(z=o.jsxs(sl,{children:[R,O]}),e[38]=R,e[39]=O,e[40]=z):z=e[40];let M;e[41]!==l?(M=l("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[41]=l,e[42]=M):M=e[42];let $;e[43]!==M?($=o.jsx(ol,{children:M}),e[43]=M,e[44]=$):$=e[44];let F;e[45]!==L?(F=J=>{J.preventDefault(),L()},e[45]=L,e[46]=F):F=e[46];let U;e[47]!==l?(U=l("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[47]=l,e[48]=U):U=e[48];let H;e[49]!==F||e[50]!==U?(H=o.jsx(ll,{onClick:F,children:U}),e[49]=F,e[50]=U,e[51]=H):H=e[51];let q;e[52]!==$||e[53]!==H?(q=o.jsxs(rl,{children:[$,H]}),e[52]=$,e[53]=H,e[54]=q):q=e[54];let W;e[55]!==z||e[56]!==q?(W=o.jsxs(tl,{children:[z,q]}),e[55]=z,e[56]=q,e[57]=W):W=e[57];let G;e[58]!==V||e[59]!==A||e[60]!==W?(G=o.jsx(el,{open:V,onOpenChange:A,children:W}),e[58]=V,e[59]=A,e[60]=W,e[61]=G):G=e[61];let Y;return e[62]!==N||e[63]!==G||e[64]!==k?(Y=o.jsxs("div",{className:"space-y-1",children:[k,N,G]}),e[62]=N,e[63]=G,e[64]=k,e[65]=Y):Y=e[65],Y}function R3e(t){const e=B.c(13),{onClick:s}=t,n=re();let i;e[0]!==n?(i=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=n,e[1]=i):i=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(c0,{size:14}),e[2]=r):r=e[2];let l;e[3]!==s||e[4]!==i?(l=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":i,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:r})}),e[3]=s,e[4]=i,e[5]=l):l=e[5];let a;e[6]!==n?(a=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx(We,{side:"bottom",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=o.jsxs(qe,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}const vv=new WeakMap;function Koe(t,e){let s=vv.get(e);s||(s=new Map,vv.set(e,s));let n=s.get(t);return n===void 0&&(n=In(t,e),s.set(t,n)),n}function Woe(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function qoe(t,e){return{__resolveType:e,variants:[{rule:Jc(),value:structuredClone(t)},{rule:Jc(),value:structuredClone(t)}]}}function Goe(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>hx(n.rule));return s?s.value:e[e.length-1]?.value}function Yoe(t){const e=[...t.variants],s=e[e.length-1],n={rule:Jc(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function Joe(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function Qoe(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function Xoe(t,e,s){return e<t?t-1:Math.min(t,s-1)}function Zoe(t,e,s){const n=[...t.variants];if(e===s||e<0||s<0||e>=n.length||s>=n.length)return t;const[i]=n.splice(e,1);return i?(n.splice(s,0,i),{...t,variants:n}):t}function ele(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function yv(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const _v=new WeakMap;function tle(t){let e=_v.get(t);return e||(e=boe(t),_v.set(t,e)),e}function Pj(t){const e=B.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,r=re(),{value:l,onChange:a,meta:c,path:d}=i,[f,u]=P.useState(0);if(!Woe(l)){let z;e[0]!==r?(z=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=r,e[1]=z):z=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(c0,{size:14}),e[2]=M):M=e[2];let $;e[3]!==r?($=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=r,e[4]=$):$=e[4];let F;return e[5]!==$?(F=o.jsx(We,{children:$}),e[5]=$,e[6]=F):F=e[6],o.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":z,onClick:()=>{a(qoe(l,s)),u(0)},children:M})}),F]}),n(i)]})}const h=l,m=h.variants,p=Math.min(f,m.length-1);let g;e[7]!==r?(g=(z,M)=>({index:M,label:ed(z.rule)||r("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=r,e[8]=g):g=e[8];const x=m.map(g),b=m[p],y=b?.rule??{},L=y.__resolveType??"",v=b?.value,_=c?tle(c):[],w=L&&c?Koe(L,c):null,{__resolveType:S,...k}=y,j=()=>{a(Goe(h)),u(0)},C=()=>{const z=Yoe(h);a(z),u(z.variants.length-1)},T=z=>{const M=Joe(h,z);M&&(a(M),u(Xoe(p,z,M.variants.length)))},N=z=>{const M=Qoe(h,z);a(M),u(z+1)},V=(z,M)=>{const $=Zoe(h,z,M);a($),p===z&&u(M)},A=z=>{const M=z?vte(z,c):{__resolveType:p3};a(yv(h,p,M))},E=z=>{const M=z,$=L?{...M,__resolveType:L}:{...M};a(yv(h,p,$))},R=z=>{a(ele(h,p,z))},I=`${d}-${h.__resolveType}`;let D;e[9]!==r?(D=r("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=r,e[10]=D):D=e[10];let O;return e[11]!==D?(O=o.jsx(Mt,{className:"text-xs text-muted-foreground",children:D}),e[11]=D,e[12]=O):O=e[12],o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[o.jsx(foe,{listKey:I,variants:x,selectedIndex:p,onSelect:u,onDuplicate:N,onDelete:T,onRemoveAll:j,onReorder:V,onAdd:C}),o.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[O,o.jsx(yoe,{currentRt:L,currentLabel:ed(y),matchers:_,onSelect:A}),w&&o.jsx("div",{className:"pt-1",children:o.jsx(Hoe,{schema:w,value:k,onChange:E,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${p}-${L}`)})]}),n({...i,value:v,onChange:R})]})]})}const sle="website/loaders/secret.ts";function yu(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function nle(){return{__resolveType:sle,name:"",encrypted:""}}function ile(t){const{value:e,...s}=t;return s}function om(t){const e=B.c(53),{schema:s,value:n,onChange:i,label:r,path:l,sandbox:a}=t,c=re();if(typeof n=="string"||n==null&&!yu(n)){const C=typeof n=="string"?n:"",T=a?.virtualMcpId;let N;e[0]!==r||e[1]!==l||e[2]!==s.description||e[3]!==T?(N=o.jsx(Hs,{htmlFor:l,label:r,description:s.description,virtualMcpId:T}),e[0]=r,e[1]=l,e[2]=s.description,e[3]=T,e[4]=N):N=e[4];let V;e[5]!==c?(V=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=V):V=e[6];let A;e[7]!==i?(A=I=>i(I.target.value),e[7]=i,e[8]=A):A=e[8];let E;e[9]!==l||e[10]!==C||e[11]!==V||e[12]!==A?(E=o.jsx(mt,{id:l,type:"password",value:C,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:V,onChange:A,className:"h-10"}),e[9]=l,e[10]=C,e[11]=V,e[12]=A,e[13]=E):E=e[13];let R;return e[14]!==N||e[15]!==E?(R=o.jsxs("div",{className:"space-y-2",children:[N,E]}),e[14]=N,e[15]=E,e[16]=R):R=e[16],R}let d;e[17]!==n?(d=yu(n)?n:nle(),e[17]=n,e[18]=d):d=e[18];const f=d,u=typeof f.name=="string"?f.name:"",h=typeof f.encrypted=="string"&&f.encrypted,m=`${l}-name`,p=a?.virtualMcpId;let g;e[19]!==r||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=o.jsx(Hs,{htmlFor:m,label:r,description:s.description,virtualMcpId:p}),e[19]=r,e[20]=s.description,e[21]=m,e[22]=p,e[23]=g):g=e[23];const x=`${l}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let y;e[26]!==f||e[27]!==i?(y=C=>i({...f,name:C.target.value}),e[26]=f,e[27]=i,e[28]=y):y=e[28];let L;e[29]!==u||e[30]!==x||e[31]!==b||e[32]!==y?(L=o.jsx(mt,{id:x,value:u,placeholder:b,onChange:y,className:"h-10"}),e[29]=u,e[30]=x,e[31]=b,e[32]=y,e[33]=L):L=e[33];const v=`${l}-value`;let _;e[34]!==h||e[35]!==c?(_=c(h?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=h,e[35]=c,e[36]=_):_=e[36];let w;e[37]!==f||e[38]!==h||e[39]!==i?(w=C=>{const T=C.target.value;if(!T){i(h?ile(f):f);return}i({...f,value:T})},e[37]=f,e[38]=h,e[39]=i,e[40]=w):w=e[40];let S;e[41]!==_||e[42]!==w||e[43]!==v?(S=o.jsx(mt,{id:v,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:_,onChange:w,className:"h-10"}),e[41]=_,e[42]=w,e[43]=v,e[44]=S):S=e[44];let k;e[45]!==h||e[46]!==c?(k=h&&o.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=h,e[46]=c,e[47]=k):k=e[47];let j;return e[48]!==S||e[49]!==k||e[50]!==g||e[51]!==L?(j=o.jsxs("div",{className:"space-y-2",children:[g,L,S,k]}),e[48]=S,e[49]=k,e[50]=g,e[51]=L,e[52]=j):j=e[52],j}function rle(t,e){const s=t.anyOfRefs;if(!s?.length)return;const n=e.find(d=>d!=null&&typeof d=="object"&&!Array.isArray(d)),i=n?Object.keys(n).filter(d=>!d.startsWith("__")):[],r=[],l=d=>{d?.type==="object"&&d.properties&&r.push(d)};for(const d of s){const f=d.schema;if(f&&(f.type==="array"&&l(f.items),f.properties))for(const u of Object.values(f.properties))u?.type==="array"&&l(u.items)}if(r.length===0)return;if(i.length===0)return r.length===1?r[0]:void 0;let a,c=-1;for(const d of r){const f=d.properties??{},u=i.filter(h=>h in f).length*2+(d.titleBy?1:0);u>c&&(c=u,a=d)}return c>=2?a:void 0}function ole(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const s={};for(const[n,i]of Object.entries(e))n.startsWith("__")||(typeof i=="string"?s[n]={type:"string"}:typeof i=="number"?s[n]={type:"number"}:typeof i=="boolean"&&(s[n]={type:"boolean"}));return Object.keys(s).length>0?{type:"object",properties:s}:void 0}const lle=new Set(["__resolveType","@type"]);function ale(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return!1;const e=t.anyOfRefs[0].schema;return!!(e?.properties?.variants||!e&&t.plainSchema)}function cle(t){if(t1(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function Lv(t){if(t.type==="array"&&t.items)return t;const e=t.items??cle(t);return e?{...t,type:"array",items:e}:null}function dle(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function Ej(t){const{value:e,meta:s}=t;if(e===null||typeof e!="object"||Array.isArray(e))return null;const n=e.__resolveType;if(typeof n!="string"||!s)return null;const i=In(n,s);return i?o.jsx(Ii,{schema:i,value:e,onChange:t.onChange,basePath:t.path,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:s,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection,sandbox:t.sandbox},t.path):null}function na(t){const{schema:e,value:s}=t;if(Nh(s)){const l=Gte(s),a=Lv(e);if(l!==null&&a)return o.jsx(_f,{...t,schema:a,value:l,onChange:c=>t.onChange(Yte(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&t1(e)){const l=Lv(e);if(l)return o.jsx(_f,{...t,schema:l,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!Nh(s)&&e.type==="block-ref"){const l=rle(e,s)??ole(s);if(l){const a={...e,type:"array",items:l};return o.jsx(_f,{...t,schema:a,value:s,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||s!==null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.__resolveType=="string"&&e.anyOfRefs){if(ale(e)){const l=e.anyOfRefs[0],a=l.schema?.properties?.variants?.items?.properties?.value,c=a&&a.type!=="block-ref"?a:e.plainSchema??a?.plainSchema??{type:"string"},d=f=>na({...f,schema:c});return o.jsx(Pj,{...t,multivariateResolveType:l.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?o.jsx(fv,{...t},t.path):null}if(e.type==="inline-union")return o.jsx(Xre,{...t},t.path);if(e.format==="image-uri")return o.jsx($re,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return o.jsx(Ire,{...t},t.path);if(e.format==="map")return o.jsx(noe,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return o.jsx(dre,{...t},t.path);if(e.format==="location")return o.jsx(Lj,{...t},t.path);if(e.enum&&e.enum.length>0)return o.jsx(Gne,{...t},t.path);if(e.type==="anyOf")return o.jsx(fv,{...t},t.path);if(yu(s)||e.format==="password"||s==null&&e.format==="password")return o.jsx(om,{...t},t.path);if(!e.format&&!e.enum){const l=Ej(t);if(l)return l}const n=s??dle(e.type,e.default);if(n==null)return yu(s)?o.jsx(om,{...t},t.path):null;if(yu(n))return o.jsx(om,{...t,value:n},t.path);const i={...t,value:n},r=s==null?e.type??typeof n:Array.isArray(n)?"array":typeof n;if(r==="array"||Array.isArray(n))return o.jsx(_f,{...i},t.path);switch(r){case"boolean":return o.jsx(Une,{...i},t.path);case"number":case"integer":return o.jsx(Fne,{...i},t.path);case"string":{const l=e.format;return l==="color-input"||l==="color"?o.jsx(vf,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?o.jsx(vf,{...i},t.path):o.jsx(vf,{...i},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?o.jsx(Wie,{...i},t.path):null;default:return o.jsx(vf,{...i},t.path)}}function ule(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return na({...t,schema:e});const s=Ej(t);return s||na(e?{...t,schema:e}:t)}function Ii({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:f,onRequestAddSection:u,sandbox:h}){const m=re(),p=t.properties;if(!p)return t.type==="inline-union"?na({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:f,onRequestAddSection:u,sandbox:h}):null;if(qte(e)&&p.variants){const N=p.variants.items?.properties?.value;return o.jsx(Pj,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:f,onRequestAddSection:u,sandbox:h,multivariateResolveType:e.__resolveType,renderInnerField:V=>ule(V,N)},n)}const g=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},x=Object.keys(p).filter(N=>!lle.has(N)&&p[N]?.hidden!==!0),b=new Set(t.required??[]);if(x.length===0)return o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sectionsEditor.sectionsEditor.noEditableFields")});const y=(N,V)=>{if(V===void 0){const{[N]:A,...E}=g;s(E);return}s({...g,[N]:V})},L=typeof g.__resolveType=="string"?g.__resolveType:void 0,v=x.filter(N=>{const V=p[N];return V!=null&&Bc(V,g[N])}).length>1,_=kie(x,p,g),w=i.length>0?Cie(x,p,g,i,a,l):null,S=w?p[w]:null,k=w&&S?[w]:x,j=w&&S?Sie(w,S,i,qu(w,x,p)):i,C=wie(i,j),T=C.length>0&&r?N=>r([...C,...N]):r;return o.jsx("div",{className:"min-w-0 space-y-6",children:k.map(N=>{const V=p[N];if(!V)return null;const A=n?`${n}.${N}`:N,E=qu(N,x,p),R=sa(N,V),O=(C.length===0&&x.some(z=>{const M=p[z];return z!==N&&M!=null&&sa(z,M)===R})||C.length===0&&_.has(N))&&T?V.type==="block-ref"?z=>T(_ie(N,z)):z=>T(yie(E,z)):T;return na({schema:V,value:g[N],onChange:z=>y(N,z),path:A,label:E,required:b.has(N),breadcrumbPath:j,onBreadcrumbChange:O,hasSiblingDrillDownFields:v,focused:w===N,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:L,previewBaseUrl:d,onAddSectionItem:f,onRequestAddSection:u,sandbox:h})})})}function fle(t){const e=B.c(3),{isPending:s,isError:n}=t;if(n){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(pn,{size:13}),"Couldn't save"]}),e[0]=r):r=e[0],r}if(s){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(ot,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=r):r=e[1],r}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[o.jsx(Ft,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const wv=3e4;function hle(t,e,s,n){const i=new URL(`/deco/invoke/${e}`,t);return i.searchParams.set("__cb",n.toString(36)),i.searchParams.set("__decoFBT","0"),i.searchParams.set("__d",`run-${n.toString(36)}`),i.searchParams.set("props",btoa(encodeURIComponent(JSON.stringify(s)))),i.href}async function mle(t,{resolveType:e,props:s}){let n;try{n=await fetch(H_(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(wv)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${wv/1e3}s — the block may be slow or the preview unresponsive.`):a}const i=await n.text();let r=null,l=!1;try{r=i?JSON.parse(i):null,l=!0}catch{}if(!n.ok){const a=l&&r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"?r.error:i||`Run failed (${n.status})`;throw new Error(a)}return l?r:i}function ple(t){const e=B.c(2);let s;return e[0]!==t?(s={mutationFn:n=>mle(t,n)},e[0]=t,e[1]=s):s=e[1],Rs(s)}function Rj({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,kind:l,target:a,initialValue:c,isCreating:d,onCreate:f,onSaveReferencedBlock:u,onBack:h,showRun:m=!0}){const p=As()?.taskId??null,g=re(),x=oo(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,y=In(a.resolveType,i),L=!y&&MB(a.resolveType,i),v=L?OB(c):null,_=y??v,[w,S]=P.useState(c),[k,j]=P.useState([]),[C,T]=P.useState(0),[N,V]=P.useState(!1),[A,E]=P.useState(null),[R,I]=P.useState(!1),[D,O]=P.useState(!1),[z,M]=P.useState(!1),$=A!==null,{save:F,flush:U,isPending:H}=fx({orgSlug:t,virtualMcpId:e,branch:s}),q=ple({orgSlug:t,virtualMcpId:e,branch:s,threadId:p});P.useEffect(()=>()=>{U()},[]);const W=Ak(l),G=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,Y={orgSlug:t,virtualMcpId:e,branch:s,threadId:p,previewUrl:n??void 0,siteSlug:b},J=le=>{S(le),a.mode==="saved"&&F(a.blockKey,{__resolveType:a.resolveType,...le})},se=()=>{$?(E(null),V(!1),T(le=>le+1)):E(JSON.stringify(w,null,2))},oe=le=>{const ee=le??"";try{const ae=JSON.parse(ee);if(ae&&typeof ae=="object"&&!Array.isArray(ae)){V(!1),J(ae);return}V(!0)}catch{V(!0)}},ne=async le=>{const ee=kx(le,r);if(ee){xe.error(ee);return}await f(le,{__resolveType:a.resolveType,...w}),I(!1)},Q=()=>{O(!0),q.mutate({resolveType:a.resolveType,props:w})},K=()=>{n&&window.open(hle(n,a.resolveType,w,Date.now()),"_blank","noopener")},X=[a.title,...k],Z=le=>{j(k.slice(0,le)),T(ee=>ee+1)};return o.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[h&&o.jsx(ue,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:h,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:o.jsx(m9,{size:14})}),o.jsx("nav",{"aria-label":g("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:X.map((le,ee)=>{const ae=ee===X.length-1,ce=Sn(le);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ee>0&&o.jsx(en,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>Z(ee),title:ce,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ae?"font-medium text-foreground":"text-muted-foreground"),children:ce})]},`${ce}-${ee}`)})}),a.mode==="saved"&&o.jsx(fle,{isPending:H,isError:!1}),m&&o.jsxs(ue,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:Q,disabled:q.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:W}),children:[q.isPending?o.jsx(ot,{size:14,className:"animate-spin"}):o.jsx(Kl,{size:14}),g("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>I(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:W}),children:o.jsx(Z2,{size:14})})}),o.jsx(We,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:W})})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:$?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:se,"aria-label":g($?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":$,children:$?o.jsx(Ds,{size:14}):o.jsx(fa,{size:14})})}),o.jsx(We,{side:"bottom",children:g($?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:a.mode==="saved"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:W}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:G,singular:W})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("div",{className:ie("relative min-h-0 flex-1",D&&z&&"hidden"),children:[o.jsx(xl,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[v&&_===v&&o.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:g("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:W})}),_?o.jsx(Ii,{schema:_,value:w,onChange:le=>J(le),basePath:"",breadcrumbPath:k,onBreadcrumbChange:j,meta:i,decofile:r,onSaveReferencedBlock:u,sandbox:Y},C):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:L?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:W}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:W})})]})})}),A!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[N&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:g("sandbox.runnableBlockEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(md,{language:"json",height:"100%",code:A,onChange:oe,onSave:le=>{oe(le),U()}})})]})]}),D&&o.jsx(gle,{singular:W,result:{isPending:q.isPending,error:q.error,data:q.data,hasRun:q.status!=="idle"},expanded:z,onToggleExpand:()=>M(le=>!le),onOpenInNewTab:n?K:void 0,onClose:()=>{O(!1),M(!1)}})]}),o.jsx(jx,{open:R,onOpenChange:I,defaultBlockId:"",isPending:d,onSubmit:ne})]})}function gle(t){const e=B.c(54),{singular:s,result:n,expanded:i,onToggleExpand:r,onOpenInNewTab:l,onClose:a}=t,c=re();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const f=d,u=i?"flex-1":"h-[45%] shrink-0";let h;e[2]!==u?(h=ie("flex min-h-0 flex-col border-t",u),e[2]=u,e[3]=h):h=e[3];let m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:m}),e[6]=m,e[7]=p):p=e[7];let g;e[8]!==l||e[9]!==s||e[10]!==c?(g=l&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:o.jsx(hn,{size:14})})}),o.jsx(We,{side:"bottom",children:c("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:s})})]}),e[8]=l,e[9]=s,e[10]=c,e[11]=g):g=e[11];let x;e[12]!==i||e[13]!==c?(x=c(i?"sandbox.runnableBlockEditor.collapseResult":"sandbox.runnableBlockEditor.expandResult"),e[12]=i,e[13]=c,e[14]=x):x=e[14];let b;e[15]!==i?(b=i?o.jsx(VA,{size:14}):o.jsx(m8,{size:14}),e[15]=i,e[16]=b):b=e[16];let y;e[17]!==i||e[18]!==r||e[19]!==x||e[20]!==b?(y=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon",className:"size-7",onClick:r,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=r,e[19]=x,e[20]=b,e[21]=y):y=e[21];let L;e[22]!==i||e[23]!==c?(L=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=L):L=e[24];let v;e[25]!==L?(v=o.jsx(We,{side:"bottom",children:L}),e[25]=L,e[26]=v):v=e[26];let _;e[27]!==v||e[28]!==y?(_=o.jsxs(qe,{children:[y,v]}),e[27]=v,e[28]=y,e[29]=_):_=e[29];let w;e[30]!==c?(w=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=w):w=e[31];let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Ds,{size:14}),e[32]=S):S=e[32];let k;e[33]!==a||e[34]!==w?(k=o.jsx(ue,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":w,children:S}),e[33]=a,e[34]=w,e[35]=k):k=e[35];let j;e[36]!==_||e[37]!==k||e[38]!==g?(j=o.jsxs("div",{className:"flex items-center gap-0.5",children:[g,_,k]}),e[36]=_,e[37]=k,e[38]=g,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==p?(C=o.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[p,j]}),e[40]=j,e[41]=p,e[42]=C):C=e[42];let T;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==f||e[47]!==s||e[48]!==c?(T=o.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?o.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[o.jsx(ot,{size:16,className:"animate-spin"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?o.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[o.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),o.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?o.jsx(md,{language:"json",height:"100%",code:f,readOnly:!0}):o.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:c("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:s})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=f,e[47]=s,e[48]=c,e[49]=T):T=e[49];let N;return e[50]!==C||e[51]!==T||e[52]!==h?(N=o.jsxs("div",{className:h,children:[C,T]}),e[50]=C,e[51]=T,e[52]=h,e[53]=N):N=e[53],N}function xle(t){const e=B.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,blockKey:c}=t,d=re();let f;e[0]!==i||e[1]!==s||e[2]!==n?(f={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=f):f=e[3];const u=V0(f);let h;e[4]!==u?(h=bx((_,w)=>u.mutate({blockKey:_,data:w})),e[4]=u,e[5]=h):h=e[5];const m=h;let p;e[6]!==c||e[7]!==a?(p=Ik(a,c),e[6]=c,e[7]=a,e[8]=p):p=e[8];const{resolveType:g,props:x,title:b}=p;if(!g){let _;e[9]!==d?(_=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=_):_=e[10];let w;return e[11]!==_?(w=o.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:_}),e[11]=_,e[12]=w):w=e[12],w}const y=`loader:${c}`;let L;e[13]!==c||e[14]!==g||e[15]!==b?(L={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=L):L=e[16];let v;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==r||e[22]!==x||e[23]!==u.isPending||e[24]!==m||e[25]!==y||e[26]!==L||e[27]!==n?(v=o.jsx(Rj,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:"loaders",target:L,initialValue:x,isCreating:u.isPending,onCreate:ble,onSaveReferencedBlock:m,showRun:!1},y),e[17]=i,e[18]=a,e[19]=l,e[20]=s,e[21]=r,e[22]=x,e[23]=u.isPending,e[24]=m,e[25]=y,e[26]=L,e[27]=n,e[28]=v):v=e[28],v}async function ble(){}const vle="https://github.com/decocms/blocks";function yle(){const t=B.c(14),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(AA,{size:48,className:"text-muted-foreground"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("mainPanelTabs.blocksTabStates.emptyStateTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==e?(i=e("mainPanelTabs.blocksTabStates.emptyStateDescription"),t[3]=e,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=r):r=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(hn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==r?(a=o.jsx(ue,{size:"sm",asChild:!0,children:o.jsxs("a",{href:vle,target:"_blank",rel:"noreferrer",children:[r,l]})}),t[8]=r,t[9]=a):a=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==a?(c=o.jsx(Qo,{className:"h-full w-full",image:s,title:n,description:i,actions:a}),t[10]=n,t[11]=i,t[12]=a,t[13]=c):c=t[13],c}function _le(t){const e=B.c(15),{source:s,onRetry:n}=t,i=re();let r;e[0]!==s||e[1]!==i?(r=i(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=i,e[2]=r):r=e[2];const l=r;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(pn,{size:48,className:"text-muted-foreground"}),e[3]=a):a=e[3];let c;e[4]!==i?(c=i("mainPanelTabs.blocksTabStates.errorStateTitle"),e[4]=i,e[5]=c):c=e[5];let d;e[6]!==i?(d=i("mainPanelTabs.blocksTabStates.retry"),e[6]=i,e[7]=d):d=e[7];let f;e[8]!==n||e[9]!==d?(f=o.jsx(ue,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=f):f=e[10];let u;return e[11]!==l||e[12]!==c||e[13]!==f?(u=o.jsx(Qo,{image:a,title:c,description:l,actions:f}),e[11]=l,e[12]=c,e[13]=f,e[14]=u):u=e[14],u}function cr(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:o.jsx(ot,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const Lle=P.lazy(()=>xn(()=>import("./sections-editor-B_M-97ti.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])).then(t=>({default:t.SectionsEditor})));function Sv(t){const e=B.c(48),{virtualMcpId:s,externalSelection:n,onViewJsonFile:i}=t,r=n===void 0?null:n,{org:l}=Fe(),{currentBranch:a,taskId:c}=sn(),d=Jn(),f=vl(),u=$k(),h=d.lifecycle.phase==="running",m=f.previewUrl;let p;e[0]!==a||e[1]!==l||e[2]!==m||e[3]!==c||e[4]!==s?(p=a?{orgSlug:l.slug,virtualMcpId:s,branch:a,threadId:c??null,previewUrl:m}:null,e[0]=a,e[1]=l,e[2]=m,e[3]=c,e[4]=s,e[5]=p):p=e[5];const g=p;let x;e[6]!==h?(x={fetchEnabled:h},e[6]=h,e[7]=x):x=e[7];const b=y0(g,x);let y;e[8]!==h?(y={fetchEnabled:h},e[8]=h,e[9]=y):y=e[9];const L=A9(g,y),v=ck({lifecyclePhase:d.lifecycle.phase,decofile:jh(b),meta:jh(L),hasEditableContent:R9(b.data,L.data),fastPreviewActive:Tn(s).runtime==="cms"});if(v.kind==="loading"){let D;return e[10]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx(cr,{}),e[10]=D):D=e[10],D}if(v.kind==="empty"){let D;return e[11]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx(yle,{}),e[11]=D):D=e[11],D}if(v.kind==="error"){let D;e[12]!==b||e[13]!==f||e[14]!==L||e[15]!==v.source?(D=()=>{if(v.source==="sandbox"){f.retry();return}Promise.all([b.refetch(),L.refetch()])},e[12]=b,e[13]=f,e[14]=L,e[15]=v.source,e[16]=D):D=e[16];const O=D;let z;return e[17]!==O||e[18]!==v.source?(z=o.jsx(_le,{source:v.source,onRetry:O}),e[17]=O,e[18]=v.source,e[19]=z):z=e[19],z}const _=u.state.target;if(_?.kind==="loader"&&b.data&&L.data){const D=a??"",O=m??null;let z;return e[20]!==b.data||e[21]!==L.data||e[22]!==l.slug||e[23]!==D||e[24]!==O||e[25]!==_.key||e[26]!==s?(z=o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:o.jsx(xle,{orgSlug:l.slug,virtualMcpId:s,branch:D,previewUrl:O,meta:L.data,decofile:b.data,blockKey:_.key})}),e[20]=b.data,e[21]=L.data,e[22]=l.slug,e[23]=D,e[24]=O,e[25]=_.key,e[26]=s,e[27]=z):z=e[27],z}let w;e[28]!==a||e[29]!==l.slug||e[30]!==_||e[31]!==s?(w=_||!a?null:px(mx(l.slug,s,a)),e[28]=a,e[29]=l.slug,e[30]=_,e[31]=s,e[32]=w):w=e[32];const S=w;let k="/",j=null,C=null;_?.kind==="page"?(k=_.path,j=_.key):_?.kind==="section"?C=_.key:S&&(k=S.path,j=S.pageKey);const T=j?`page:${j}`:C?`section:${C}`:`path:${k}`;let N;e[33]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(ot,{size:20,className:"animate-spin text-muted-foreground"})}),e[33]=N):N=e[33];const V=a??"",A=m??void 0,E=C?null:r,R=!!j&&u.state.editSeoPageKey===j;let I;return e[34]!==C||e[35]!==j||e[36]!==k||e[37]!==T||e[38]!==i||e[39]!==l.slug||e[40]!==R||e[41]!==V||e[42]!==A||e[43]!==E||e[44]!==s||e[45]!==u.consumeEditSeo||e[46]!==u.setVariantOverride?(I=o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:o.jsx(P.Suspense,{fallback:N,children:o.jsx(Lle,{orgSlug:l.slug,virtualMcpId:s,branch:V,previewReady:!0,previewUrl:A,currentPath:k,activePageBlockKey:j,activeGlobalBlockKey:C,externalSelection:E,initialEditSeo:R,onExitSeo:u.consumeEditSeo,onVariantPreviewOverride:u.setVariantOverride,onViewJsonFile:i},T)})}),e[34]=C,e[35]=j,e[36]=k,e[37]=T,e[38]=i,e[39]=l.slug,e[40]=R,e[41]=V,e[42]=A,e[43]=E,e[44]=s,e[45]=u.consumeEditSeo,e[46]=u.setVariantOverride,e[47]=I):I=e[47],I}function kv(t){const e=B.c(44),{virtualMcpId:s,pageKey:n,onClose:i,ref:r}=t,l=re(),{org:a}=Fe(),{currentBranch:c,taskId:d}=sn(),u=vl().previewUrl;let h;e[0]!==c||e[1]!==a.slug||e[2]!==u||e[3]!==d||e[4]!==s?(h=c?{orgSlug:a.slug,virtualMcpId:s,branch:c,threadId:d??null,previewUrl:u}:null,e[0]=c,e[1]=a.slug,e[2]=u,e[3]=d,e[4]=s,e[5]=h):h=e[5];const p=y0(h),g=c??"";let x;e[6]!==a.slug||e[7]!==g||e[8]!==s?(x={orgSlug:a.slug,virtualMcpId:s,branch:g},e[6]=a.slug,e[7]=g,e[8]=s,e[9]=x):x=e[9];const{save:b,flush:y}=fx(x),L=p.data?.[n],v=p.data===void 0&&p.isLoading,_=p.data!==void 0&&L===void 0,w=!c||_||v;let S;e[10]!==L?(S=L===void 0?"":JSON.stringify(L,null,2),e[10]=L,e[11]=S):S=e[11];const k=S;let j;e[12]!==n||e[13]!==w||e[14]!==b?(j=z=>{if(w)return;let M;try{M=JSON.parse(z)}catch{return}M===null||typeof M!="object"||Array.isArray(M)||b(n,M)},e[12]=n,e[13]=w,e[14]=b,e[15]=j):j=e[15];const C=j;let T;e[16]!==y?(T=()=>({flush:y}),e[16]=y,e[17]=T):T=e[17],P.useImperativeHandle(r,T);let N;e[18]!==l?(N=l("sectionsEditor.pageJsonDialog.titleShort"),e[18]=l,e[19]=N):N=e[19];let V;e[20]!==N?(V=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:N}),e[20]=N,e[21]=V):V=e[21];let A;e[22]!==l?(A=l("sectionsEditor.pageJsonDialog.close"),e[22]=l,e[23]=A):A=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Ds,{size:14}),e[24]=E):E=e[24];let R;e[25]!==i||e[26]!==A?(R=o.jsx(ue,{variant:"ghost",size:"icon",onClick:i,"aria-label":A,className:"size-7 shrink-0",children:E}),e[25]=i,e[26]=A,e[27]=R):R=e[27];let I;e[28]!==R||e[29]!==V?(I=o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[V,R]}),e[28]=R,e[29]=V,e[30]=I):I=e[30];let D;e[31]!==p.data||e[32]!==y||e[33]!==k||e[34]!==v||e[35]!==_||e[36]!==n||e[37]!==w||e[38]!==C||e[39]!==l?(D=v?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(ot,{size:20,className:"animate-spin text-muted-foreground"})}):_?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",l("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(md,{code:k,language:"json",readOnly:w,height:"100%",onChange:z=>C(z??""),onSave:z=>{C(z),y()}},`${n}:${p.data===void 0?"loading":"ready"}`)}),e[31]=p.data,e[32]=y,e[33]=k,e[34]=v,e[35]=_,e[36]=n,e[37]=w,e[38]=C,e[39]=l,e[40]=D):D=e[40];let O;return e[41]!==I||e[42]!==D?(O=o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[I,D]}),e[41]=I,e[42]=D,e[43]=O):O=e[43],O}function wle(t,e){return t===e?"preview":e}function Sle(t){return t.autoOpen&&t.blocksReady&&!t.autoOpenResolved&&t.editingMode==="preview"}const kle=500,jle={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},jv=1,lm=["desktop","mobile","tablet"],Cv={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function Nv(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function Cle(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 wf(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function am(t,e){try{return new URL(t,e).href}catch{return null}}function Nle(t,e,s){const n=t.toLowerCase(),i=e.toLowerCase(),r=i.split("/").filter(Boolean),l=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let f=40;return d===0?f+=30:/[\s/-]/.test(c[d-1]??"")&&(f+=20),f+=Math.round(s.length/c.length*20),f};let a=Math.max(l(n),l(i));return r.at(-1)===s?a=Math.max(a,95):r.includes(s)&&(a=Math.max(a,90)),a}function Tle(t){const{onOpen:e}=t,[s,n]=P.useState(!1);return s||(n(!0),queueMicrotask(e)),null}function Vle(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function Ale({virtualMcpId:t}){const e=re(),s=dd(),n=fl(),i=fte(),{openPanel:r}=hi(),{currentBranch:l,taskId:a}=sn(),c=$k(),d=be=>r(be),[f,u]=P.useState("preview"),[h,m]=P.useState(!1),[p,g]=P.useState("desktop"),[x,b]=P.useState(null),[y,L]=P.useState(null),v=P.useRef(null),_=P.useRef(null),[w,S]=P.useState(!1),k=P.useRef(null),j=()=>{k.current?.flush(),S(!1)},C=()=>S(be=>(be&&k.current?.flush(),!be)),[T,N]=P.useState({width:0,height:0}),[V,A]=P.useState(null),[E,R]=P.useState(!1),[I,D]=P.useState(""),O=P.useRef(null),[z,M]=P.useState(!1),[$,F]=P.useState(),[U,H]=P.useState(null),[q,W]=P.useState(null),[G,Y]=P.useState(null),[J,se]=P.useState("/"),[oe,ne]=P.useState(null),[Q,K]=P.useState({}),[X,Z]=P.useState(!1),le=P.useRef(null),ee=()=>{Z(!0),le.current&&clearTimeout(le.current),le.current=setTimeout(()=>Z(!1),15e3)},ae=()=>{le.current&&(clearTimeout(le.current),le.current=null),Z(!1)},{org:ce}=Fe(),fe=Jn(),de=vl(),pe=de.vmEntry,te=de.previewUrl,ge=fe.lifecycle.phase,ve=ge==="running",Se=s;Mk({orgSlug:ce.slug,virtualMcpId:t??"",branch:l??"",threadId:a??null,enabled:Se});const ye=null,ke=oo(),we=ke?.entity?.id===t?Y2(ke.entity.metadata):null,je=Tn(t),me=ke?.entity?.id===t&&je.runtime==="cms",Ce=je.projectDefault==="cms",Ne=jte({sandboxUrl:te,previewServerUrl:we,fastPreviewActive:me}),Ie=t&&l?{orgSlug:ce.slug,virtualMcpId:t,branch:l,threadId:a??null,previewUrl:te}:null,et=y0(Ie,{fetchEnabled:ve}),Ze=A9(Ie,{fetchEnabled:ve}),Te=et.data,Me=Ze.data,rt=`${t}:${l??""}`,[nt,it]=P.useState(null),ut=ck({lifecyclePhase:ge,decofile:jh(et),meta:jh(Ze),hasEditableContent:R9(Te,Me),fastPreviewActive:me,frameworkKnownMissing:nt===rt});ut.kind==="empty"&&ut.reason==="framework-missing"&&nt!==rt&&it(rt);const Ct=ut.kind==="content",ct=t&&l?{orgSlug:ce.slug,virtualMcpId:t,branch:l}:null,lt=Pte(ct),Oe=Te?dh(Te).sort((be,Pe)=>be.name.localeCompare(Pe.name)):[],vt=Te&&Me?L3(Te,Me):[],_e=Te&&Me?Dk(Me,Te,"loaders"):[],Ue=qo,st=I?(()=>{const be=I.toLowerCase();return Oe.map(Pe=>({page:Pe,score:Nle(Pe.name,Pe.path,be)})).filter(({score:Pe})=>Pe>0).sort((Pe,at)=>at.score-Pe.score||Pe.page.path.length-at.page.path.length).map(({page:Pe})=>Pe)})():Oe,gt=vt.filter(be=>{if(!I)return!0;const Pe=I.toLowerCase();return be.name.toLowerCase().includes(Pe)||be.key.toLowerCase().includes(Pe)||be.resolveType.toLowerCase().includes(Pe)}),pt=_e.filter(be=>{if(!I)return!0;const Pe=I.toLowerCase();return be.title.toLowerCase().includes(Pe)||be.key.toLowerCase().includes(Pe)||be.resolveType.toLowerCase().includes(Pe)}),Vt=q?_e.find(be=>be.key===q)??null:null,bt=U||q?null:rp(Oe,J,oe),_t=U?U.name:Vt?.title??bt?.name,tt=bt?.key??null,ft=bt?.path??null,xt=(tt?Q[tt]:void 0)??{},Ee=Br(J,xt),dt={};if(ve&&te&&Me&&Te){const be=rne(Me,"loaders"),Pe=tt?Te[tt]:void 0,at=Tse(Pe,Te,as=>be.has(as)),yt=Sse(at);for(const as of oh(J)){if(as.type!=="param")continue;const dn=_se(J,as.name,at),qs=Cse(dn,be,yt);qs.length>0&&(dt[as.name]=qs)}}const he=t&&l?{orgSlug:ce.slug,virtualMcpId:t,branch:l,threadId:a??null}:null,Ae=Te&&tt?yk(Te,tt,0):[],He=Te?pk(Ae,Te):[],Le=He.map(be=>be.isSavedBlock?be.label:""),De=He.map(be=>be.isSavedBlock?"global":be.isMultivariate?"variant":"normal"),Qe=Ae.map(be=>Rp(be,Te??{})),Be=P.useRef(null),Lt=P.useRef(null),qt=fe.status.state==="paused",lo=fe.phase,Sa=Sk({claimPhase:lo,lifecycle:fe.lifecycle}),It=de.previewState,ao=de.userStopped,yr=m0(ke?.entity?.id===t?ke.entity.metadata?.ui?.layout??null:null),co=dx(ce.slug,t??"",l??""),{url:cn}=fk(me&&t&&l?{orgSlug:ce.slug,virtualMcpId:t,branch:l,previewServerUrl:we??null,path:Ee}:null),uo=Ce&&je.runtime==="sandbox",wt=ete({previewState:It,progressStatus:Sa.status,previewServerUrl:we,fastPreviewActive:me,fastPreviewReady:!!cn,codingSession:uo}),Qn=wt.mode!=="none",_r=wt.mode==="production"&&wt.iframeBase?wf(wt.iframeBase):null,fo=!s,Xn=wt.mode==="production"?_r:wf(te),ho=ke?.entity?.id===t&&ke.entity.metadata?.fastPreviewInPlace===!0,bn=wt.mode==="production"&&me&&ho&&f==="blocks",Lr=P.useRef(null);bn||(Lr.current=cn);const Mi=Lr.current,mo=bn?Mi??cn:cn,$s=Cle(wt.mode==="sandbox"?hf(Nv(G??am(Ee,wt.iframeBase)??wt.iframeBase,p),c.state.variantOverride??[]):wt.mode==="production"&&fo?hf(Nv(uk(G??mo??am(Ee,wt.iframeBase)??wt.iframeBase,wt.showWakingPill?Ste:null),p),c.state.variantOverride??[]):null);P.useEffect(()=>{},[s,_r,V]);const wr="sandbox.preview.openInNewTab",ka=cn??(wt.iframeBase?am(Ee,wt.iframeBase):null),po=wt.mode==="production"?ka?hf(ka,c.state.variantOverride??[]):null:$s??wt.iframeBase,go=async()=>{const be=po;if(be){window.open(be,"_blank","noopener");return}},Sr=t&&l?mx(ce.slug,t,l):null,pi=be=>{Sr&&bse(Sr,be)},gs=c.state.target;P.useEffect(()=>{if(!(!gs||!Ne||!Me))if(gs.kind==="page"){const be=Q[gs.key]??{};Lt.current=Br(gs.path,be),H(null),W(null),Y(null),ne(gs.key),se(gs.path),pi({path:gs.path,pageKey:gs.key,params:be})}else if(gs.kind==="loader")Lt.current=null,H(null),W(gs.key),Y(null);else{const be=vt.find(Pe=>Pe.key===gs.key);if(be){Lt.current=null;const Pe=lh(Me);W(null),H(be),Y(Kb(Ne,Pe,be.key))}}},[gs,Ne,Me,Q]),P.useEffect(()=>{!tt||ft===null||gs?.kind==="page"&&gs.key===tt&&gs.path===ft||c.selectTarget({kind:"page",key:tt,path:ft})},[tt,ft,gs]);const[ja,xo]=P.useState(null);if(It.kind==="iframe"&&ja!==It.previewUrl){const be=ja!==null;xo(It.previewUrl);const Pe=Sr?px(Sr):null;if(Pe){if(Lt.current=Br(Pe.path,Pe.params),se(Pe.path),ne(Pe.pageKey),Y(null),H(null),W(null),Pe.pageKey&&Object.keys(Pe.params).length>0){const at=Pe.pageKey;K(yt=>({...yt,[at]:Pe.params}))}}else be&&(Lt.current=null,se("/"),Y(null),ne(null),H(null),W(null))}Be.current=$s;const kr=ite({iframeRef:v,src:wt.mode==="sandbox"?$s:null,active:wt.mode==="sandbox"}),jr=P.useRef(null);P.useEffect(()=>{if(!cn||!$s||jr.current===cn)return;jr.current=cn;const be=v.current;be&&be.getAttribute("src")!==$s&&(ee(),be.src=$s)},[cn,$s]);const Cr=()=>{const be=v.current?.contentWindow,Pe=Xn;if(!be||!Pe||!Te||!tt)return;const at=Te[tt];if(!at||typeof at!="object")return;const yt=kte({previewBaseUrl:Pe,pageBlock:at,decofile:Te,path:Ee,pathTemplate:J});if(!yt)return;const as=hf(yt.src,c.state.variantOverride??[]);be.postMessage({type:"cms-editor::render",src:as,body:yt.body},Pe)},gi=P.useRef(null);P.useEffect(()=>{if(!bn||U||q||!tt||!Te){gi.current=null;return}const be=JSON.stringify(Te);if(gi.current===be)return;const Pe=gi.current===null;gi.current=be,!Pe&&Cr()},[Te,bn,U,q,tt,Ee,J]);const Oi=P.useRef(null);P.useEffect(()=>{if(!bn||U||q||!tt||!Te){Oi.current=null;return}const be=JSON.stringify(c.state.variantOverride??null),Pe=Oi.current;Oi.current={page:tt,sig:be},!(!Pe||Pe.page!==tt||Pe.sig===be)&&Cr()},[c.state.variantOverride,bn,U,q,tt]);const bo=!!t&&!!l&&!fe.notFound&&!ao&&!qt&&(lo?.kind==="ready"||ge!=="idle"),vn=wt.mode!=="sandbox"&&f==="visual"?"preview":f;P.useEffect(()=>{const be=Xn;if(!be)return;const Pe=at=>{if(at.origin===be)if(at.data?.type==="visual-editor::element-clicked"){const yt=Dte.safeParse(at.data.payload);yt.success&&b(yt.data)}else if(at.data?.type==="cms-editor::section-clicked"){const yt=Ote.safeParse(at.data.payload);yt.success&&L({index:yt.data.sectionIndex,seq:yt.data.clickSeq})}else at.data?.type==="cms-editor::render-start"?ee():(at.data?.type==="cms-editor::render-end"||at.data?.type==="cms-editor::render-error")&&ae()};return window.addEventListener("message",Pe),()=>window.removeEventListener("message",Pe)},[Xn]),P.useEffect(()=>{if(!E)return;const be=Pe=>{O.current?.contains(Pe.target)||(R(!1),D(""))};return document.addEventListener("pointerdown",be),()=>document.removeEventListener("pointerdown",be)},[E]);const Nr=()=>{const be=v.current?.contentWindow,Pe=wf(te);!be||!Pe||be.postMessage({type:"visual-editor::activate",script:Ite},Pe)},m1=()=>{const be=v.current?.contentWindow,Pe=wf(te);!be||!Pe||be.postMessage({type:"visual-editor::deactivate"},Pe)},$i=()=>{const be=v.current?.contentWindow,Pe=Xn;!be||!Pe||(be.postMessage(wt.mode==="production"?{type:"editor::inject",args:{script:Gb}}:{type:"visual-editor::activate",script:Gb},Pe),be.postMessage({type:"cms-editor::set-labels",labels:Le,kinds:De,keys:Qe},Pe))},Nd=()=>{const be=v.current?.contentWindow,Pe=Xn;!be||!Pe||be.postMessage({type:"cms-editor::deactivate"},Pe)},Zn=be=>{const Pe=f;!n&&be!==Pe&&(be==="blocks"?_.current?.resize("30%"):_.current?.collapse()),be!=="blocks"&&j(),u(be),b(null),L(null),be!=="blocks"&&W(null),Pe==="visual"&&m1(),be==="visual"&&Nr(),Pe==="blocks"&&be!=="blocks"&&Nd(),be==="blocks"&&$i()},Tr=be=>{m(!0),Zn(wle(f,be))},vo=Sle({autoOpen:yr==="auto",blocksReady:Ct,autoOpenResolved:h,editingMode:f}),yo=()=>{m(!0),Zn("blocks")},_o=()=>{if(!v.current||!$s)return;ee();const be=v.current;be.src=$s};cz(()=>{const be=v.current;if(!be)return;ee();const Pe=document.activeElement,at=be.tabIndex;be.tabIndex=-1,be.style.pointerEvents="none",be.blur(),Vle(be,Be.current);let yt;const as=()=>{clearTimeout(yt),be.tabIndex=at,be.style.pointerEvents="";const dn=document.activeElement;(!dn||dn===document.body||dn===be)&&Pe?.focus(),be.removeEventListener("load",as)};be.addEventListener("load",as),yt=setTimeout(as,3e3)});const Lo=()=>{const be=lm.indexOf(p);g(lm[(be+1)%lm.length])},wo=async()=>{let be=null;try{be=v.current?.contentWindow?.location?.href??null}catch{}const Pe=be??$s??te;if(Pe)try{await navigator.clipboard.writeText(Pe),xe.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{xe.error(e("sandbox.preview.failedToCopyUrl"))}},So=rte({iframeBase:wt.iframeBase,resolvedPath:Ee,activeGlobalSectionName:U?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Sl=be=>{const Pe=Q[be.key]??{},at=Br(be.path,Pe);(U||Ue(at)!==Ue(Ee))&&ee(),Lt.current=at,H(null),W(null),Y(null),L(null),ne(be.key),se(be.path),pi({path:be.path,pageKey:be.key,params:Pe}),c.selectTarget({kind:"page",key:be.key,path:be.path})},Bi=(be,Pe)=>{if(!tt)return;const at=tt,yt={...xt,[be]:Pe};Lt.current=Br(J,yt),K(as=>({...as,[at]:yt})),pi({path:J,pageKey:at,params:yt})},Td=be=>{if(!Ne||!Me){xe.error(e("sandbox.preview.previewMetadataNotReady"));return}ee(),Lt.current=null;const Pe=lh(Me),at=Kb(Ne,Pe,be.key);H(be),W(null),Y(at),L(null),c.selectTarget({kind:"section",key:be.key})},Ca=be=>{H(null),W(be.key),Y(null),Zn("blocks"),c.selectTarget({kind:"loader",key:be.key})},Vd=async({name:be,path:Pe,templateKey:at})=>{if(!t||!l)return;const yt=v3(Pe);if(yt){F(yt);return}const as=Pe.trim().startsWith("/")?Pe.trim():`/${Pe.trim()}`;if(Oe.some(qs=>Ue(qs.path)===Ue(as))){F(e("sandbox.preview.pageAlreadyExists",{path:as}));return}let dn;if(at&&(dn=Te?.[at],!dn)){F(e("sandbox.preview.templateNoLongerExists"));return}F(void 0);try{const qs=await lt.mutateAsync({name:be,path:as,template:dn});M(!1),xe.success(e("sandbox.preview.pageCreated",{name:be})),await hd(kle),Sl({key:qs.key,name:qs.name,path:qs.path}),Zn("blocks")}catch(qs){F(qs instanceof Error?qs.message:e("sandbox.preview.failedToCreatePage"))}},zi=Qn&&(bo||wt.mode==="production"),Vr=f==="blocks",Ar=$te({showPreviewToolbar:zi,blocksState:ut}),Fi=Ar&&yr!=="off"?o.jsx(ik,{title:e("sandbox.preview.cms"),tooltip:e(Vr?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),labelCollapse:"sooner",icon:{kind:"component",Component:PA},active:Vr,onClick:()=>Tr("blocks"),testId:"preview-blocks-toggle",dataTour:Go.edit}):null,Pr=zi?o.jsxs(o.Fragment,{children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Bo,{onClick:_o,"aria-label":e("sandbox.preview.refresh"),children:o.jsx(Dn,{size:16})})}),o.jsx(We,{side:"bottom",children:e("sandbox.preview.refresh")})]}),Ar&&o.jsxs("div",{ref:O,className:"relative min-w-0 w-64 shrink",children:[o.jsxs("div",{className:"flex h-7 w-full min-w-0 items-center rounded-md border border-border bg-background transition-colors duration-200 hover:bg-accent",children:[o.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>R(be=>!be),children:[U&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[o.jsx(Hl,{size:11}),"Global"]}),Vt&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[o.jsx(Hc,{size:11}),e("sandbox.preview.loaderBadge")]}),o.jsx("span",{className:ie("text-[13px] font-medium text-foreground",_t==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:_t??So}),!U&&!q&&_t!=null&&J&&o.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:oh(J).map((be,Pe)=>{if(be.type==="text")return o.jsx("span",{className:ie(Pe===0?"min-w-0 truncate":"shrink-0"),children:be.text},`text-${Pe}`);const at=dt[be.name];return at&&he?o.jsx(Hse,{sources:at,template:J,paramName:be.name,value:xt[be.name]??"",sandboxRef:he,onCommit:yt=>Bi(be.name,yt)},`${tt}:${be.name}`):o.jsx(tne,{name:be.name,value:xt[be.name]??"",onCommit:yt=>Bi(be.name,yt)},`${tt}:${be.name}`)})})]}),o.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>R(be=>!be),"aria-label":e("sandbox.preview.choosePage"),children:o.jsx(Qt,{size:12,className:ie("shrink-0 text-muted-foreground transition-transform",E&&"rotate-180")})})]}),E&&o.jsxs("div",{className:"absolute left-1/2 top-full z-50 mt-1.5 w-[500px] max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[o.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[o.jsx(k9,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("input",{type:"text",value:I,onChange:be=>D(be.target.value),onKeyDown:be=>{if(be.key!=="Enter")return;const Pe=I.trim();if(!Pe)return;const at=st.find(yt=>Ue(yt.path)===Ue(Pe));at&&(be.preventDefault(),R(!1),D(""),Sl(at))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),o.jsx("div",{className:"p-1.5 border-b",children:o.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:be=>{be.preventDefault(),R(!1),D(""),F(void 0),M(!0)},children:[o.jsx(Kt,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),st.length===0&&gt.length===0&&pt.length===0?o.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Oe.length===0&&vt.length===0&&_e.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):o.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[st.length>0&&o.jsx("div",{className:"p-1.5",children:st.map(be=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Pe=>{Pe.preventDefault(),R(!1),D(""),Sl(be)},children:[o.jsx(Ko,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.path})]},be.key))}),gt.length>0&&o.jsxs("div",{className:ie("p-1.5",st.length>0&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),gt.map(be=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Pe=>{Pe.preventDefault(),R(!1),D(""),Td(be)},children:[o.jsx(Hl,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},be.key))]}),pt.length>0&&o.jsxs("div",{className:ie("p-1.5",(st.length>0||gt.length>0)&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalLoaders")}),pt.map(be=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Pe=>{Pe.preventDefault(),R(!1),D(""),Ca(be)},children:[o.jsx(Hc,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.title}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},be.key))]})]})]})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Bo,{"aria-label":e(wr),onClick:()=>{go()},children:o.jsx(hn,{size:16})})}),o.jsx(We,{side:"bottom",children:e(wr)})]})]}):null,ko=zi?o.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[Fi,Fi&&o.jsx("div",{className:"mx-0.5 h-5 w-px shrink-0 bg-border"}),Pr]}):null,Ui=zi?o.jsx("div",{className:"flex shrink-0 items-center",children:o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":e("sandbox.preview.moreOptions"),children:o.jsx(qn,{size:14})})}),o.jsxs(zt,{align:"end",className:"w-44",children:[o.jsxs(Xe,{onClick:wo,children:[o.jsx(an,{size:14}),e("sandbox.preview.copyCurrentUrl")]}),Te&&Me&&o.jsxs(o.Fragment,{children:[o.jsx(qr,{}),tt&&o.jsxs(Xe,{onClick:()=>{c.editSeo({kind:"page",key:tt,path:J}),Zn("blocks")},children:[o.jsx(ng,{size:14}),e("sandbox.preview.editSeo")]}),tt&&o.jsxs(Xe,{onClick:()=>{try{d(fT(vB(tt)))}catch{xe.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[o.jsx(fa,{size:14}),e("sandbox.preview.viewJson")]})]}),ye,o.jsx(qr,{}),o.jsxs(Xe,{onClick:()=>Qee(e),children:[o.jsx(EA,{size:14}),e("cmsTour.menuItem")]})]})]})}):null,Ad=wt.mode==="sandbox",jo=jle[p],xi=p==="desktop"&&(T.width===0||T.width>=jo.width+2*jv),Er=xi?1:Math.min(T.width>0?T.width/(jo.width+2*jv):1,1),Co=xi?{width:"100%",height:"100%"}:{width:`${jo.width}px`,height:T.height>0?`${T.height/Er}px`:`${jo.height}px`,transform:`scale(${Er})`,transformOrigin:"top center"},Rr=Qn?o.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:o.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[Ad&&o.jsxs(o.Fragment,{children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Bo,{onClick:()=>Tr("visual"),"aria-pressed":f==="visual","aria-label":e("sandbox.preview.visualEditor"),active:f==="visual",className:"rounded-full","data-tour":Go.visualEditor,children:o.jsx(f4,{size:16})})}),o.jsx(We,{side:"top",children:e("sandbox.preview.visualEditor")})]}),o.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Bo,{onClick:Lo,"aria-label":e(Cv[p]),className:"rounded-full","data-tour":Go.device,children:o.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[p==="mobile"&&o.jsx(RA,{size:16}),p==="tablet"&&o.jsx(DA,{size:16}),p==="desktop"&&o.jsx(IA,{size:16})]},p)})}),o.jsx(We,{side:"top",children:e(Cv[p])})]})]})}):null,No=(n||!!q)&&vn==="blocks";return o.jsxs("div",{className:"flex flex-col w-full h-full",children:[vo&&o.jsx(Tle,{onOpen:yo}),he&&Object.entries(dt).map(([be,Pe])=>(xt[be]??"")===""?o.jsx(Zse,{sources:Pe,template:J,paramName:be,sandboxRef:he,onFill:at=>Bi(be,at)},`${tt}:${be}`):null),i?o.jsxs(o.Fragment,{children:[zi&&o.jsx(dte,{children:ko}),o.jsx(ute,{children:Ui})]}):(zi||Ui)&&o.jsxs("div",{className:"@container/panel-header relative flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3 md:px-4",children:[o.jsx("div",{className:"flex flex-1 items-center justify-start",children:Fi}),o.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:Pr}),o.jsx("div",{className:"flex flex-1 items-center justify-end",children:Ui})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:No?o.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[o.jsx(Sv,{virtualMcpId:t,externalSelection:y,onViewJsonFile:C}),w&&tt&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(kv,{ref:k,virtualMcpId:t,pageKey:tt,onClose:j})}),n&&Rr]}):o.jsxs(ep,{orientation:"horizontal",disabled:vn!=="blocks",children:[o.jsx(Tc,{ref:_,id:"preview-blocks-editor",defaultSize:vn==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:vn==="blocks"&&o.jsx(Sv,{virtualMcpId:t,externalSelection:y,onViewJsonFile:C})}),vn==="blocks"&&o.jsx(tp,{withHandle:!0}),o.jsx(Tc,{id:"preview-canvas",defaultSize:vn==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:o.jsxs(ep,{orientation:"horizontal",disabled:!(w&&tt),children:[w&&tt&&o.jsxs(o.Fragment,{children:[o.jsx(Tc,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:o.jsx(kv,{ref:k,virtualMcpId:t,pageKey:tt,onClose:j})}),o.jsx(tp,{withHandle:!0})]}),o.jsx(Tc,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:o.jsxs("div",{ref:be=>{if(!be)return;const Pe=()=>N(yt=>yt.width===be.clientWidth&&yt.height===be.clientHeight?yt:{width:be.clientWidth,height:be.clientHeight});Pe();const at=new ResizeObserver(Pe);return at.observe(be),()=>at.disconnect()},className:ie("h-full relative overflow-clip flex justify-center",Qn&&!xi&&"bg-muted/30"),children:[(X||co)&&Qn&&o.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:o.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),wt.showBlockingOverlay&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx($c,{kind:"starting",progress:Sa,claimPhase:lo})}),It.kind==="suspended"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx($c,{kind:"suspended",onResume:de.resume})}),It.kind==="errored"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx($c,{kind:"errored",error:It.error,onRetry:de.retry,connectionsHref:`/${ce.slug}/settings/connections`})}),wt.showWakingPill&&o.jsxs("div",{className:"absolute top-4 left-1/2 z-20 flex max-w-md -translate-x-1/2 items-start gap-3 rounded-xl border border-border bg-muted px-4 py-3 shadow-lg pointer-events-none select-none",children:[o.jsx(ot,{size:18,className:"mt-0.5 shrink-0 animate-spin text-muted-foreground"}),o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),vn==="visual"&&!x&&o.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[o.jsx(f4,{size:12}),e("sandbox.preview.clickElementToAsk")]}),vn==="visual"&&x&&o.jsx(sse,{element:x,onDismiss:()=>b(null)}),Rr,Qn&&$s&&o.jsx("div",{className:ie("shrink-0",!xi&&"border-x border-border bg-background shadow-sm"),style:Co,children:o.jsx("iframe",{ref:v,src:$s,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:kr.handleError,onLoad:()=>{if(kr.handleLoad(),ae(),wt.mode!=="sandbox"){wt.mode==="production"&&!wt.showWakingPill&&f==="blocks"&&$i();return}if(Ye("vm_preview_loaded",{view_mode:f,vm_id:pe?.sandboxHandle??null}),!U)try{const be=v.current?.contentWindow?.location?.pathname;if(!be)return;const Pe=Lt.current;if(Pe!==null&&(Lt.current=null,Ue(be)!==Ue(Pe))||Ue(be)===Ue(Ee))return;se(be),pi({path:be,pageKey:oe,params:xt})}catch{}f==="visual"&&Nr(),f==="blocks"&&$i()}},wt.iframeBase)})]})})]})})]})}),o.jsx(Rte,{open:z,onOpenChange:M,isPending:lt.isPending,error:$,templates:Oe,onSubmit:Vd})]})}function Ple(t){const e=B.c(22),{virtualMcpId:s}=t,n=re(),i=Is(s),{activeTask:r,taskId:l,currentBranch:a}=sn(),c=gL(l),[d,f]=P.useState(!1);if(xL({threadId:l,sandboxBranch:r?.branch??a,agentHasRepo:Zs(i?.metadata),threadHasRepo:Zs(c)||Zs(r?.metadata)})==="none"){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(jn,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>f(!0),b=o.jsx(jn,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let y;e[7]!==n?(y=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=y):y=e[8];let L;e[9]!==y?(L=o.jsxs(ue,{onClick:x,children:[b,y]}),e[9]=y,e[10]=L):L=e[10];let v;e[11]!==p||e[12]!==g||e[13]!==L?(v=o.jsx(Qo,{className:"h-full",image:m,title:p,description:g,actions:L}),e[11]=p,e[12]=g,e[13]=L,e[14]=v):v=e[14];let _;e[15]!==d?(_=o.jsx(jg,{open:d,onOpenChange:f,mode:"agent"}),e[15]=d,e[16]=_):_=e[16];let w;return e[17]!==v||e[18]!==_?(w=o.jsxs(o.Fragment,{children:[v,_]}),e[17]=v,e[18]=_,e[19]=w):w=e[19],w}let h;return e[20]!==s?(h=o.jsx(Ale,{virtualMcpId:s}),e[20]=s,e[21]=h):h=e[21],h}const Ele=P.lazy(()=>xn(()=>import("./file-explorer-BH-3KCjE.js"),__vite__mapDeps([164,1,2,28,29,30,31,32,33,34,35,36,37,38,39,40,8,27,41,42,43,44,45,9,46,10,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,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,102,104,95,105,106,79,119,146,99,143,112,85,86,87,88,89,90,91,92,93,94,96,97,98,100,101,103,107,108,109,110,111,82,113,114,115,116,117,118,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,80,144,145,147,148,149,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.FileExplorer})));function Rle(t){const e=B.c(23),{openPath:s}=t,n=re(),i=oo(),{org:r}=Fe(),{currentBranch:l,taskId:a}=sn(),c=i?.entity?.id??null,d=dd(),f=vl(),u=Jn();f.vmEntry,u.lifecycle.phase;const h=d,m=c??"",p=l??"",g=a??null,x=h;let b;e[0]!==r.slug||e[1]!==m||e[2]!==p||e[3]!==g||e[4]!==x?(b={orgSlug:r.slug,virtualMcpId:m,branch:p,threadId:g,enabled:x},e[0]=r.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x,e[5]=b):b=e[5],Mk(b);const y=null;if(!c||!l){let k;e[6]!==n?(k=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[6]=n,e[7]=k):k=e[7];let j;return e[8]!==k?(j=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:k}),e[8]=k,e[9]=j):j=e[9],j}let L;e[10]!==y||e[11]!==n?(L=y,e[10]=y,e[11]=n,e[12]=L):L=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(ot,{size:20,className:"animate-spin text-muted-foreground"})}),e[13]=v):v=e[13];const _=a??null;let w;e[14]!==l||e[15]!==s||e[16]!==r.slug||e[17]!==_||e[18]!==c?(w=o.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:o.jsx(P.Suspense,{fallback:v,children:o.jsx(Ele,{orgSlug:r.slug,virtualMcpId:c,branch:l,threadId:_,openPath:s})})}),e[14]=l,e[15]=s,e[16]=r.slug,e[17]=_,e[18]=c,e[19]=w):w=e[19];let S;return e[20]!==L||e[21]!==w?(S=o.jsxs("div",{className:"flex flex-col w-full h-full",children:[L,w]}),e[20]=L,e[21]=w,e[22]=S):S=e[22],S}function Dle(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([n])=>!e.includes(n)));return Object.keys(s).length>0?{...t,properties:s}:t}function Ile(t,e,s){return typeof t!="string"?null:Dle(In(t,e),s)}function Dj(t,e,s){if(!e||typeof t!="string")return!1;const n=Ile(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function Mle({orgSlug:t,virtualMcpId:e,branch:s}){const n=ps(),i=As()?.taskId??null,r=v0(e),l=Tn(e).runtime==="cms";return Rs({mutationKey:Jg(t,e,s),mutationFn:async({blockKey:a})=>{if(l){const f=await f_({orgSlug:t,virtualMcpId:e,branch:s},{delete:[a]});return Xg(n,{orgSlug:t,virtualMcpId:e,branch:s},f),await n.invalidateQueries({queryKey:T0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=b0(r,Lg(a)),d=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:c})});return d.ok?d.json():N9(d,"Delete")},onMutate:async({blockKey:a})=>{const c=`${t}/${e}/${s}`,d=Je.decofile(c);await n.cancelQueries({queryKey:d});const f=n.getQueryData(d),u=!!f&&a in f,h=f?.[a];return n.setQueryData(d,m=>{if(!m)return m;const{[a]:p,...g}=m;return g}),{queryKey:d,blockKey:a,hadKey:u,previousValue:h}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,f=>d.hadKey?{...f??{},[d.blockKey]:d.previousValue}:f)},onSuccess:()=>{n.invalidateQueries({queryKey:Je.liveMeta(t,e,s)})}})}function vc(t){const e=B.c(6),{hasItems:s,emptyLabel:n,emptyHint:i}=t;let r;e[0]!==i||e[1]!==n||e[2]!==s?(r=s?"No results match your search.":o.jsxs(o.Fragment,{children:[o.jsx("div",{children:n}),o.jsx("div",{className:"mt-1 text-muted-foreground/80",children:i})]}),e[0]=i,e[1]=n,e[2]=s,e[3]=r):r=e[3];let l;return e[4]!==r?(l=o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=l):l=e[5],l}function l1(t,e){return`${t}-${e}`}function Ij(t,e){return`site/apps/${t}/${e}.ts`}function Mj(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function Ole(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function $le(t){return t==="local"?"Custom":"Installed"}function Oj(t,e,s){const n=new Set([l1(t,e),e].map(r=>r.toLowerCase())),i=Ij(t,e);for(const[r,l]of Object.entries(s)){if(r.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=l;if(n.has(r.toLowerCase())||a.__resolveType===i)return r}return null}function Ble(t,e){const s=t.vendor.alias,n=t.name,i=Oj(s,n,e);return{id:l1(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:Ij(s,n),blockKey:i,installed:i!==null}}function zle(t,e,s){if(t===_3)return null;const n=Mj(t);if(!n)return null;const{vendor:i,app:r}=n,l=Oj(i,r,s),a=bl(t,e);return{id:l1(i,r),app:r,vendor:i,title:a.title??r,description:a.description??"",category:"Others",logo:a.logo??a.icon,resolveType:t,blockKey:l,installed:l!==null}}function Fle(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Qc(t,e)||!J_(n))return null;const i=Mj(n)??Ole(t);if(!i)return null;const r=bl(n,s),{vendor:l,app:a}=i;return{id:l1(l,a),app:a,vendor:l,title:r.title??uh(t,e,s),description:r.description??"",category:$le(l),logo:r.logo??r.icon,resolveType:n,blockKey:t,installed:!0}}function Ule(t,e,s){const n=new Map;for(const r of t){const l=Ble(r,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const r of Object.keys(i)){const l=zle(r,e,s);!l||n.has(l.id)||n.set(l.id,l)}for(const[r,l]of Object.entries(s)){if(r.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=Fle(r,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(Hle)}function Hle(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function Kle(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function Wle(t,e,s){const n=B.c(12),i=s?.enabled??!0;let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=Je.decoApps(),n[0]=r):r=n[0];let l;n[1]!==i?(l={queryKey:r,queryFn:Kle,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Tt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?Ule(a.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=a.data,n[6]=c):c=n[6];const d=c,f=a.isLoading&&!a.isError;let u;return n[7]!==d||n[8]!==a.isError||n[9]!==a.refetch||n[10]!==f?(u={catalog:d,isLoading:f,isError:a.isError,refetch:a.refetch},n[7]=d,n[8]=a.isError,n[9]=a.refetch,n[10]=f,n[11]=u):u=n[11],u}function qle(t){const e=B.c(86),{active:s,counts:n,showBlog:i,onSelect:r}=t,l=re();let a;e[0]!==l?(a=l("sandbox.collectionsSidebar.content"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=o.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:o.jsx("span",{className:"text-sm font-medium",children:a})}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==l?(d=l("sandbox.collectionsSidebar.pages"),e[4]=l,e[5]=d):d=e[5];const f=s==="pages";let u;e[6]!==n.pages||e[7]!==r||e[8]!==d||e[9]!==f?(u=o.jsx(Bn,{id:"pages",icon:Ko,label:d,count:n.pages,active:f,onSelect:r}),e[6]=n.pages,e[7]=r,e[8]=d,e[9]=f,e[10]=u):u=e[10];let h;e[11]!==l?(h=l("sandbox.collectionsSidebar.sections"),e[11]=l,e[12]=h):h=e[12];const m=s==="sections";let p;e[13]!==n.sections||e[14]!==r||e[15]!==h||e[16]!==m?(p=o.jsx(Bn,{id:"sections",icon:Hl,label:h,count:n.sections,active:m,onSelect:r}),e[13]=n.sections,e[14]=r,e[15]=h,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==l?(g=l("sandbox.collectionsSidebar.apps"),e[18]=l,e[19]=g):g=e[19];const x=s==="apps";let b;e[20]!==n.apps||e[21]!==r||e[22]!==x||e[23]!==g?(b=o.jsx(Bn,{id:"apps",icon:f7,label:g,count:n.apps,active:x,onSelect:r}),e[20]=n.apps,e[21]=r,e[22]=x,e[23]=g,e[24]=b):b=e[24];let y;e[25]!==l?(y=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=y):y=e[26];const L=s==="redirects";let v;e[27]!==n.redirects||e[28]!==r||e[29]!==y||e[30]!==L?(v=o.jsx(Bn,{id:"redirects",icon:y8,label:y,count:n.redirects,active:L,onSelect:r}),e[27]=n.redirects,e[28]=r,e[29]=y,e[30]=L,e[31]=v):v=e[31];let _;e[32]!==l?(_=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=_):_=e[33];const w=s==="loaders";let S;e[34]!==n.loaders||e[35]!==r||e[36]!==_||e[37]!==w?(S=o.jsx(Bn,{id:"loaders",icon:Hc,label:_,count:n.loaders,active:w,onSelect:r}),e[34]=n.loaders,e[35]=r,e[36]=_,e[37]=w,e[38]=S):S=e[38];let k;e[39]!==l?(k=l("sandbox.collectionsSidebar.actions"),e[39]=l,e[40]=k):k=e[40];const j=s==="actions";let C;e[41]!==n.actions||e[42]!==r||e[43]!==k||e[44]!==j?(C=o.jsx(Bn,{id:"actions",icon:mr,label:k,count:n.actions,active:j,onSelect:r}),e[41]=n.actions,e[42]=r,e[43]=k,e[44]=j,e[45]=C):C=e[45];let T;e[46]!==l?(T=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=T):T=e[47];const N=s==="site";let V;e[48]!==r||e[49]!==T||e[50]!==N?(V=o.jsx(Bn,{id:"site",icon:lg,label:T,active:N,onSelect:r}),e[48]=r,e[49]=T,e[50]=N,e[51]=V):V=e[51];let A;e[52]!==l?(A=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=A):A=e[53];const E=s==="seo";let R;e[54]!==r||e[55]!==A||e[56]!==E?(R=o.jsx(Bn,{id:"seo",icon:ng,label:A,active:E,onSelect:r}),e[54]=r,e[55]=A,e[56]=E,e[57]=R):R=e[57];let I;e[58]!==l?(I=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=I):I=e[59];const D=s==="calendar";let O;e[60]!==r||e[61]!==I||e[62]!==D?(O=o.jsx(Bn,{id:"calendar",icon:lr,label:I,active:D,onSelect:r}),e[60]=r,e[61]=I,e[62]=D,e[63]=O):O=e[63];let z;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==r||e[69]!==i||e[70]!==l?(z=i&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[o.jsx(Uc,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),o.jsx(Bn,{id:"posts",icon:Qr,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:r}),o.jsx(Bn,{id:"authors",icon:Cg,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:r}),o.jsx(Bn,{id:"categories",icon:c9,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:r}),o.jsx(Bn,{id:"post-schedule",icon:MA,label:l("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:r})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=r,e[69]=i,e[70]=l,e[71]=z):z=e[71];let M;e[72]!==b||e[73]!==v||e[74]!==S||e[75]!==C||e[76]!==V||e[77]!==R||e[78]!==O||e[79]!==z||e[80]!==u||e[81]!==p?(M=o.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[u,p,b,v,S,C,V,R,O,z]}),e[72]=b,e[73]=v,e[74]=S,e[75]=C,e[76]=V,e[77]=R,e[78]=O,e[79]=z,e[80]=u,e[81]=p,e[82]=M):M=e[82];let $;return e[83]!==c||e[84]!==M?($=o.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,M]}),e[83]=c,e[84]=M,e[85]=$):$=e[85],$}function Bn(t){const e=B.c(18),{id:s,icon:n,label:i,count:r,active:l,onSelect:a}=t;let c;e[0]!==s||e[1]!==a?(c=()=>a(s),e[0]=s,e[1]=a,e[2]=c):c=e[2];const d=l?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let f;e[3]!==d?(f=ie("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",d),e[3]=d,e[4]=f):f=e[4];let u;e[5]!==n?(u=o.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=u):u=e[6];let h;e[7]!==i?(h=o.jsx("span",{className:"flex-1 truncate",children:i}),e[7]=i,e[8]=h):h=e[8];let m;e[9]!==l||e[10]!==r?(m=r!==void 0&&o.jsx("span",{className:ie("shrink-0 text-xs tabular-nums",l?"text-accent-foreground/70":"text-muted-foreground/70"),children:r}),e[9]=l,e[10]=r,e[11]=m):m=e[11];let p;return e[12]!==c||e[13]!==f||e[14]!==u||e[15]!==h||e[16]!==m?(p=o.jsxs("button",{type:"button",onClick:c,className:f,children:[u,h,m]}),e[12]=c,e[13]=f,e[14]=u,e[15]=h,e[16]=m,e[17]=p):p=e[17],p}function Gle(t){const e=B.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:r,connectionsHref:l}=t;switch(s.kind){case"starting":{let a;e[0]!==n||e[1]!==i?(a=Sk({claimPhase:n,lifecycle:i}),e[0]=n,e[1]=i,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==a?(c=o.jsx($c,{kind:"starting",progress:a,claimPhase:n}),e[3]=n,e[4]=a,e[5]=c):c=e[5],c}case"suspended":{let a;return e[6]!==r?(a=o.jsx($c,{kind:"suspended",onResume:r}),e[6]=r,e[7]=a):a=e[7],a}case"errored":{let a;return e[8]!==l||e[9]!==r||e[10]!==s.error?(a=o.jsx($c,{kind:"errored",error:s.error,onRetry:r,connectionsHref:l}),e[8]=l,e[9]=r,e[10]=s.error,e[11]=a):a=e[11],a}}}const Yle=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Jle(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!Yle.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function Tv(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),n=`${s} (copy)`;if(!t.has(n))return n;for(let i=2;i<1e3;i++){const r=`${s} (copy ${i})`;if(!t.has(r))return r}return`${s} (copy ${Date.now()})`}function Qle(t,e){const s=qo,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let r=2;r<1e3;r++){const l=`${n}-copy-${r}`;if(!t.has(s(l)))return l}return`${n}-copy-${Date.now()}`}function Xle(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),n=`${s}_copy`;if(!Object.hasOwn(t,n))return n;for(let i=2;i<1e3;i++){const r=`${s}_copy_${i}`;if(!Object.hasOwn(t,r))return r}return`${s}_copy_${Date.now()}`}function Zle(t){const e=ux(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function eae(t,e){return hk(t,e)}const tae=1e3;function sae(t,e){for(let s=0;s<tae;s++){const n=ux(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const nae={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},iae={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},rae={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function oae(t){const e=B.c(88),{open:s,mode:n,initialName:i,initialPath:r,isPending:l,error:a,templates:c,validate:d,onSubmit:f,onOpenChange:u}=t,h=l===void 0?!1:l,m=re(),[p,g]=P.useState(i),[x,b]=P.useState(r),[y,L]=P.useState(Yo),[v,_]=P.useState(null),[w,S]=P.useState(s);s!==w&&(S(s),s&&(g(i),b(r),L(Yo),_(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==h||e[1]!==u?(j=ce=>{!ce&&!h&&(_(null),u(!1))},e[0]=h,e[1]=u,e[2]=j):j=e[2];const C=j;let T;e[3]!==h||e[4]!==p||e[5]!==f||e[6]!==x||e[7]!==k||e[8]!==y||e[9]!==d?(T=async ce=>{ce.preventDefault();const fe=p.trim(),de=x.trim();if(!fe||!de||h)return;const pe=v3(de);if(pe){_(pe);return}const te=d?.({name:fe,path:de});if(te){_(te);return}_(null),await f({name:fe,path:de,templateKey:k&&y!==Yo?y:null})},e[3]=h,e[4]=p,e[5]=f,e[6]=x,e[7]=k,e[8]=y,e[9]=d,e[10]=T):T=e[10];const N=T,V=v??a,A=nae[n];let E;e[11]!==m||e[12]!==A?(E=m(A),e[11]=m,e[12]=A,e[13]=E):E=e[13];let R;e[14]!==E?(R=o.jsx(hs,{children:o.jsx(Yt,{children:E})}),e[14]=E,e[15]=R):R=e[15];let I;e[16]!==h||e[17]!==k||e[18]!==m||e[19]!==y||e[20]!==c?(I=k&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:m("sandbox.pageFormDialog.labelTemplate")}),o.jsx(mk,{id:"page-form-template",value:y,onChange:L,templates:c??[],disabled:h})]}),e[16]=h,e[17]=k,e[18]=m,e[19]=y,e[20]=c,e[21]=I):I=e[21];let D;e[22]!==m?(D=m("sandbox.pageFormDialog.labelName"),e[22]=m,e[23]=D):D=e[23];let O;e[24]!==D?(O=o.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:D}),e[24]=D,e[25]=O):O=e[25];let z;e[26]===Symbol.for("react.memo_cache_sentinel")?(z=ce=>g(ce.target.value),e[26]=z):z=e[26];let M;e[27]!==m?(M=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=M):M=e[28];let $;e[29]!==h||e[30]!==p||e[31]!==M?($=o.jsx(mt,{id:"page-form-name",value:p,onChange:z,placeholder:M,autoFocus:!0,disabled:h}),e[29]=h,e[30]=p,e[31]=M,e[32]=$):$=e[32];let F;e[33]!==$||e[34]!==O?(F=o.jsxs("div",{className:"space-y-1.5",children:[O,$]}),e[33]=$,e[34]=O,e[35]=F):F=e[35];let U;e[36]!==m?(U=m("sandbox.pageFormDialog.labelPath"),e[36]=m,e[37]=U):U=e[37];let H;e[38]!==U?(H=o.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:U}),e[38]=U,e[39]=H):H=e[39];let q;e[40]===Symbol.for("react.memo_cache_sentinel")?(q=ce=>b(ce.target.value),e[40]=q):q=e[40];let W;e[41]!==m?(W=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=W):W=e[42];let G;e[43]!==h||e[44]!==x||e[45]!==W?(G=o.jsx(mt,{id:"page-form-path",value:x,onChange:q,placeholder:W,disabled:h}),e[43]=h,e[44]=x,e[45]=W,e[46]=G):G=e[46];let Y;e[47]!==H||e[48]!==G?(Y=o.jsxs("div",{className:"space-y-1.5",children:[H,G]}),e[47]=H,e[48]=G,e[49]=Y):Y=e[49];let J;e[50]!==V?(J=V&&o.jsx("p",{className:"text-xs text-destructive",children:V}),e[50]=V,e[51]=J):J=e[51];let se;e[52]!==F||e[53]!==Y||e[54]!==J||e[55]!==I?(se=o.jsxs("div",{className:"space-y-4 py-4",children:[I,F,Y,J]}),e[52]=F,e[53]=Y,e[54]=J,e[55]=I,e[56]=se):se=e[56];let oe;e[57]!==u?(oe=()=>u(!1),e[57]=u,e[58]=oe):oe=e[58];let ne;e[59]!==m?(ne=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=ne):ne=e[60];let Q;e[61]!==h||e[62]!==oe||e[63]!==ne?(Q=o.jsx(ue,{type:"button",variant:"outline",onClick:oe,disabled:h,children:ne}),e[61]=h,e[62]=oe,e[63]=ne,e[64]=Q):Q=e[64];let K;e[65]!==h||e[66]!==p||e[67]!==x?(K=!p.trim()||!x.trim()||h,e[65]=h,e[66]=p,e[67]=x,e[68]=K):K=e[68];let X;e[69]!==h||e[70]!==n||e[71]!==m?(X=h?o.jsxs(o.Fragment,{children:[o.jsx(ot,{size:14,className:"animate-spin"}),m(rae[n])]}):m(iae[n]),e[69]=h,e[70]=n,e[71]=m,e[72]=X):X=e[72];let Z;e[73]!==K||e[74]!==X?(Z=o.jsx(ue,{type:"submit",disabled:K,children:X}),e[73]=K,e[74]=X,e[75]=Z):Z=e[75];let le;e[76]!==Q||e[77]!==Z?(le=o.jsxs(Wn,{children:[Q,Z]}),e[76]=Q,e[77]=Z,e[78]=le):le=e[78];let ee;e[79]!==N||e[80]!==se||e[81]!==le||e[82]!==R?(ee=o.jsx(Ut,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:N,children:[R,se,le]})}),e[79]=N,e[80]=se,e[81]=le,e[82]=R,e[83]=ee):ee=e[83];let ae;return e[84]!==C||e[85]!==s||e[86]!==ee?(ae=o.jsx(Ht,{open:s,onOpenChange:C,children:ee}),e[84]=C,e[85]=s,e[86]=ee,e[87]=ae):ae=e[87],ae}function lae(t){const e=B.c(70),{open:s,blockKey:n,initialName:i,isPending:r,onSubmit:l,onOpenChange:a}=t,c=r===void 0?!1:r,d=re(),[f,u]=P.useState(i),[h,m]=P.useState(s);s!==h&&(m(s),s&&u(i));let p;e[0]!==c||e[1]!==a?(p=q=>{!q&&!c&&a(!1)},e[0]=c,e[1]=a,e[2]=p):p=e[2];const g=p;let x;e[3]!==c||e[4]!==f||e[5]!==l?(x=async q=>{q.preventDefault();const W=f.trim();!W||c||await l(W)},e[3]=c,e[4]=f,e[5]=l,e[6]=x):x=e[6];const b=x;let y;e[7]!==d?(y=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=y):y=e[8];let L;e[9]!==y?(L=o.jsx(Yt,{children:y}),e[9]=y,e[10]=L):L=e[10];let v;e[11]!==d?(v=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=v):v=e[12];let _;e[13]!==v?(_=o.jsx(kn,{children:v}),e[13]=v,e[14]=_):_=e[14];let w;e[15]!==L||e[16]!==_?(w=o.jsxs(hs,{children:[L,_]}),e[15]=L,e[16]=_,e[17]=w):w=e[17];let S;e[18]!==d?(S=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=S):S=e[19];let k;e[20]!==S?(k=o.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:S}),e[20]=S,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=q=>u(q.target.value),e[22]=j):j=e[22];let C;e[23]!==c||e[24]!==f?(C=o.jsx(mt,{id:"section-rename-name",value:f,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=f,e[25]=C):C=e[25];let T;e[26]!==k||e[27]!==C?(T=o.jsxs("div",{className:"space-y-1.5",children:[k,C]}),e[26]=k,e[27]=C,e[28]=T):T=e[28];let N;e[29]!==d?(N=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=N):N=e[30];let V;e[31]!==N?(V=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:N}),e[31]=N,e[32]=V):V=e[32];let A;e[33]!==n?(A=o.jsx(mt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=A):A=e[34];let E;e[35]!==V||e[36]!==A?(E=o.jsxs("div",{className:"space-y-1.5",children:[V,A]}),e[35]=V,e[36]=A,e[37]=E):E=e[37];let R;e[38]!==T||e[39]!==E?(R=o.jsxs("div",{className:"space-y-4 py-4",children:[T,E]}),e[38]=T,e[39]=E,e[40]=R):R=e[40];let I;e[41]!==a?(I=()=>a(!1),e[41]=a,e[42]=I):I=e[42];let D;e[43]!==d?(D=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=D):D=e[44];let O;e[45]!==c||e[46]!==I||e[47]!==D?(O=o.jsx(ue,{type:"button",variant:"outline",onClick:I,disabled:c,children:D}),e[45]=c,e[46]=I,e[47]=D,e[48]=O):O=e[48];let z;e[49]!==c||e[50]!==f?(z=!f.trim()||c,e[49]=c,e[50]=f,e[51]=z):z=e[51];let M;e[52]!==c||e[53]!==d?(M=c?o.jsxs(o.Fragment,{children:[o.jsx(ot,{size:14,className:"animate-spin"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=M):M=e[54];let $;e[55]!==z||e[56]!==M?($=o.jsx(ue,{type:"submit",disabled:z,children:M}),e[55]=z,e[56]=M,e[57]=$):$=e[57];let F;e[58]!==O||e[59]!==$?(F=o.jsxs(Wn,{children:[O,$]}),e[58]=O,e[59]=$,e[60]=F):F=e[60];let U;e[61]!==b||e[62]!==R||e[63]!==F||e[64]!==w?(U=o.jsx(Ut,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:b,children:[w,R,F]})}),e[61]=b,e[62]=R,e[63]=F,e[64]=w,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=o.jsx(Ht,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function aae(t){const e=B.c(7),{type:s}=t,n=WB[s];let i;e[0]!==n?(i=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:n})}),e[0]=n,e[1]=i):i=e[1];const r=s==="permanent"?"Permanent":"Temporary";let l;e[2]!==r?(l=o.jsx(We,{side:"left",children:r}),e[2]=r,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=o.jsxs(qe,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const cm={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Ex=["posts","authors","categories"],_u={posts:"post",authors:"author",categories:"category"};function Lu(t){return Ex.includes(t)}const Rx={posts:"post",authors:"author",categories:"category"},$j={posts:cm.post,authors:cm.author,categories:cm.category},cae=Object.fromEntries(Object.entries($j).map(([t,e])=>[e,t]));function dae(t){return typeof t=="string"?cae[t]??null:null}function ul(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function us(t){return typeof t=="string"?t:""}function uae(t,e){switch(t){case"posts":return{label:us(e.title)||"Untitled post",subtitle:us(e.slug)};case"authors":return{label:us(e.name)||"Unnamed author",subtitle:us(e.email)};case"categories":return{label:us(e.name)||"Unnamed category",subtitle:us(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Bj(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=ul(n);if(!i)continue;const r=dae(i.__resolveType);if(!r)continue;const l=ul(i[Rx[r]])??{},{label:a,subtitle:c}=uae(r,l);e[r].push({key:s,kind:r,label:a,subtitle:c})}for(const s of Ex)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function fae(t,e){return Bj(t)[e]}function Gu(t,e){return fae(t,e).map(s=>({key:s.key,payload:nu(ul(t[s.key])??void 0,e)}))}const Vv=Object.freeze({});function nu(t,e){return t?ul(t[Rx[e]])??Vv:Vv}function yc(t,e,s){return{name:t,__resolveType:$j[e],[Rx[e]]:s}}function D3e({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],r=h=>typeof h=="string"?h:us(ul(h)?.[s]),l=h=>typeof h=="string"?h:us(ul(h)?.name),a=h=>{const m=r(h),p=m?t.find(({payload:x})=>us(x[s])===m):void 0;if(p)return p;const g=l(h);return g?t.find(({payload:x})=>us(x.name)===g):void 0},c=t.map(({key:h,payload:m})=>({value:h,label:us(m.name)||us(m[s])||h})),d=new Map,f=[];return i.forEach((h,m)=>{const p=a(h);if(p){f.includes(p.key)||f.push(p.key);return}const g=`unresolved:${m}`;d.set(g,h),f.push(g),c.push({value:g,label:l(h)||r(h)||"Unknown"})}),{options:c,selectedValues:f,refsForValues:h=>h.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function ia(t){return Array.isArray(t)?t:[]}function Yr(t){if(typeof t=="string")return t;const e=ul(t);return e?us(e.slug):""}function hae(t){if(typeof t=="string")return t;const e=ul(t);return e?us(e.email):""}function zj(t){const e=[];return us(t.title).trim()||e.push("Title"),us(t.slug).trim()||e.push("Slug"),ia(t.categories).map(Yr).filter(Boolean).length===0&&e.push("Category"),us(t.excerpt).trim()||e.push("Excerpt"),us(t.image).trim()||e.push("Cover image"),e}const Fj=8;function Uj(t){const e=us(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function I3e(t,e){return e!=="published"||Uj(t)==="published"?!1:zj(t).length>0}function mae(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,Fj).toISOString()}function M3e(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=us(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?mae(s):n}}function Hj(t){return Gu(t,"posts").map(({key:e,payload:s})=>({key:e,title:us(s.title)||"Untitled post",slug:us(s.slug),date:us(s.date),scheduledDatetime:us(s.scheduledDatetime),categorySlugs:ia(s.categories).map(Yr).filter(Boolean),authorEmails:ia(s.authors).map(hae).filter(Boolean),missing:zj(s),status:Uj(s)}))}function pae(t,e){const s=ia(t.categories);return s.some(n=>Yr(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function gae(t,e){const s=ia(t.categories);return s.length===1&&Yr(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function O3e(t,e,s){const n=ia(t.categories);if(!n.some(a=>Yr(a)===e))return t;const i=n.map(a=>{const c=Yr(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),r=new Set,l=i.filter(a=>{const c=Yr(a);return c?r.has(c)?!1:(r.add(c),!0):!0});return{...t,categories:l}}function xae(t,e){const s=ia(t.categories);return s.some(n=>Yr(n)===e)?{...t,categories:s.filter(n=>Yr(n)!==e)}:t}function Av(t){return{...t,dateModified:new Date().toISOString()}}function Bp(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function dm(t,e){const s=`collections/blog/${e}/${Bp(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Kj(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Bp(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${Bp(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const bae={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},Pv="Box";function vae(t){return t.startsWith("site/")?"site":"app"}function yae(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function zd(...t){for(const e of t)if(e!==void 0)return e}function $3e(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const r of Object.keys(i)){if(!wae(r)||e.has(r))continue;e.add(r);const l=bl(r,t),a=_ae(r),c=bae[a],d=vae(r),f=(d==="site"?zd(l.title,c?.title):zd(c?.title,l.title))??a,u=d==="site"?zd(l.description,c?.description):zd(c?.description,l.description),h=d==="site"?l.icon:void 0,m=h&&yae(h)?h:void 0,p=m!==void 0?c?.iconName??Pv:zd(h,c?.iconName)??Pv;s.push({resolveType:r,title:f,description:u,iconName:p,iconUrl:m,source:d})}return s.sort((i,r)=>i.title.localeCompare(r.title))}function _ae(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Lae=["blog/sections/blocks/","site/sections/Blog/Post/"];function wae(t){return Lae.some(e=>t.startsWith(e))}const B3e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],z3e=["January","February","March","April","May","June","July","August","September","October","November","December"],Wj=1440*60*1e3;function Bl(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function F3e(t){return new Date(t.getFullYear(),t.getMonth(),1)}function U3e(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Ih(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function zp(t,e){return Math.round((Bl(t).getTime()-Bl(e).getTime())/Wj)}function Sae(t){const e=(t.getTime()-Bl(t).getTime())/Wj;return Math.min(Math.max(e,0),1)}function Ev(t,e){return zp(t,e)+Sae(t)}function H3e(t){const e=Ih(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let r=0;r<7;r++)i.push(Ih(e,n*7+r));s.push(i)}for(;s.length>0&&s[s.length-1].every(n=>n.getMonth()!==t.getMonth());)s.pop();return s}function K3e(t,e){const s=Bl(t[0]),n=Ih(s,7),i=s.getTime(),r=n.getTime(),l=[];for(const d of e){const f=Bl(d.start),u=Bl(d.end);if(u.getTime()<s.getTime()||f.getTime()>=n.getTime())continue;const h=f.getTime()<s.getTime()?s:f,m=u.getTime()>=n.getTime()?Ih(n,-1):u,p=zp(h,s),g=zp(m,h)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),r),y=Ev(new Date(x),s),L=Math.max(Ev(new Date(b),s)-y,0);L<=0||l.push({variant:d,startCol:p,span:g,leftUnits:y,widthUnits:L})}l.sort((d,f)=>d.startCol-f.startCol||f.span-d.span||d.variant.blockKey.localeCompare(f.variant.blockKey));const a=[],c=[];for(const d of l){let f=a.findIndex(u=>u<=d.startCol);f===-1&&(f=a.length,a.push(0)),a[f]=d.startCol+d.span,c.push({...d,lane:f})}return c}function Mh(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const qj=/^(\d{4})-(\d{2})-(\d{2})$/;function Oh(t){const e=t.trim();if(!e)return null;const s=qj.exec(e);if(s){const i=Number(s[1]),r=Number(s[2])-1,l=Number(s[3]),a=new Date(i,r,l);return a.getMonth()===r&&a.getDate()===l?a:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:Bl(n)}function kae(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),Fj);return{...Kj("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:Mh(t)}}function jae(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(qj.test(e))return Oh(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function Cae(t,e){const s=jae(t.scheduledDatetime);if(!s)return null;const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),i={...t,scheduledDatetime:n.toISOString()};return(typeof t.date=="string"?t.date:"")===Mh(s)&&(i.date=Mh(n)),i}function Nae(t){return Oh(t.scheduledDatetime)??Oh(t.date)}function W3e(t){const e=new Map,s=[];for(const i of t){const r={post:i,scheduled:Oh(i.scheduledDatetime)!==null},l=Nae(i);if(!l){s.push(r);continue}const a=Mh(l),c=e.get(a);c?c.push(r):e.set(a,[r])}const n=(i,r)=>Number(r.scheduled)-Number(i.scheduled)||i.post.title.localeCompare(r.post.title);for(const i of e.values())i.sort(n);return s.sort(n),{byDay:e,undated:s}}const Tae="0.161.0",Vae="0.162.0",q3e="deno task update";function Rv(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function Dv(t,e){const s=Rv(t),n=Rv(e);if(!s||!n)return 0;for(let i=0;i<3;i++){const r=s[i]-n[i];if(r!==0)return r}return 0}const Gj=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Aae(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const n=Gj.exec(s)?.[1];if(n)return n}return null}function Pae(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const n=s?.title;if(typeof n!="string")continue;const i=Gj.exec(n)?.[1];if(i)return i}return null}function Eae(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=Aae(t.denoJson)??Pae(t.meta);return!e||Dv(e,Tae)<0?{kind:"outdated",version:e}:Dv(e,Vae)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function G3e(t){return t.kind==="publish-only"||t.kind==="full"}function Y3e(t){return t.kind==="full"}function Rae(t){const e=B.c(16),s=Is(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=v0(t.virtualMcpId),i=As()?.taskId??null;let r;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(r=Je.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=r):r=e[3];let l;e[4]!==n||e[5]!==t||e[6]!==i?(l=async()=>{const h=await u3({...t,threadId:i},b0(n,"deno.json"));return h.kind==="data"?h.data:null},e[4]=n,e[5]=t,e[6]=i,e[7]=l):l=e[7];const a=s==="deno";let c;e[8]!==r||e[9]!==l||e[10]!==a?(c={queryKey:r,queryFn:l,enabled:a,staleTime:3e5},e[8]=r,e[9]=l,e[10]=a,e[11]=c):c=e[11];const{data:d}=Tt(c),f=d??null;let u;return e[12]!==s||e[13]!==t.meta||e[14]!==f?(u=Eae({packageManager:s,denoJson:f,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=f,e[15]=u):u=e[15],u}function Dae({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const r=re(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,f]=P.useState(!1),[u,h]=P.useState(c),[m,p]=P.useState(!1),g=!i||a,x=u!==c,b=()=>{navigator.clipboard.writeText(u).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)})},y=async L=>{if(!i||m)return;let v;try{v=JSON.parse(L)}catch{xe.error(r("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(v),xe.success(r("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(_){xe.error(r("sectionsEditor.pageJsonDialog.saveError",{error:_ instanceof Error?_.message:String(_)}))}finally{p(!1)}};return o.jsx(Ht,{open:t,onOpenChange:e,children:o.jsxs(Ut,{className:"max-w-3xl p-0 gap-0",children:[o.jsxs(hs,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[o.jsx(Yt,{className:"text-sm font-semibold",children:r("sectionsEditor.pageJsonDialog.title")}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs(ue,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?o.jsx(mi,{size:12}):o.jsx(an,{size:12}),r(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&o.jsx(ue,{size:"sm",onClick:()=>y(u),disabled:!x||m,className:"h-7 text-xs",children:r(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),a?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",r("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"h-[70vh]",children:o.jsx(md,{code:c,language:"json",readOnly:g,height:"100%",onChange:L=>h(L??""),onSave:L=>{y(L)}})})]})})}function vi(t){const e=B.c(45),{icon:s,logoUrl:n,title:i,subtitle:r,active:l,accent:a,variantCount:c,trailing:d,selectable:f,selectionActive:u,selected:h,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,y=a==="global";let L;e[0]!==s||e[1]!==l||e[2]!==y||e[3]!==n||e[4]!==c?(L=c&&c>1?o.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(s,{size:16,className:"shrink-0 text-success"})}),o.jsxs(We,{side:"right",children:[c," variants"]})]})}):n?o.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):o.jsx("span",{className:ie("flex size-8 shrink-0 items-center justify-center rounded-lg",y?"bg-global-section/15":"bg-muted"),children:o.jsx(s,{size:16,className:ie("shrink-0",!y&&(l?"text-accent-foreground":"text-muted-foreground")),style:y?{color:m3}:void 0})}),e[0]=s,e[1]=l,e[2]=y,e[3]=n,e[4]=c,e[5]=L):L=e[5];const v=L,_=l?y?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":y?"hover:bg-global-section/10":"hover:bg-muted";let w;e[6]!==_?(w=ie("group relative flex min-w-0 items-center rounded-md transition-colors",_),e[6]=_,e[7]=w):w=e[7];let S;e[8]!==g||e[9]!==f||e[10]!==h||e[11]!==u||e[12]!==i?(S=f&&o.jsx("span",{className:ie("flex shrink-0 items-center pl-2.5 transition-opacity",h||u?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:Iae,children:o.jsx(fd,{checked:h,onCheckedChange:()=>g?.(),"aria-label":`Select ${i}`})}),e[8]=g,e[9]=f,e[10]=h,e[11]=u,e[12]=i,e[13]=S):S=e[13];const k=m&&!l&&"text-destructive";let j;e[14]!==k?(j=ie("block truncate text-sm font-medium",k),e[14]=k,e[15]=j):j=e[15];let C;e[16]!==j||e[17]!==i?(C=o.jsx("span",{className:j,children:i}),e[16]=j,e[17]=i,e[18]=C):C=e[18];const T=l?"text-accent-foreground/70":"text-muted-foreground";let N;e[19]!==T?(N=ie("block truncate text-xs",T),e[19]=T,e[20]=N):N=e[20];let V;e[21]!==r||e[22]!==N?(V=o.jsx("span",{className:N,children:r}),e[21]=r,e[22]=N,e[23]=V):V=e[23];let A;e[24]!==V||e[25]!==C?(A=o.jsxs("span",{className:"min-w-0 flex-1",children:[C,V]}),e[24]=V,e[25]=C,e[26]=A):A=e[26];let E;e[27]!==l||e[28]!==m||e[29]!==p?(E=m&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:ie("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:o.jsx(pn,{size:14})})}),p&&o.jsx(We,{side:"bottom",children:p})]}),e[27]=l,e[28]=m,e[29]=p,e[30]=E):E=e[30];let R;e[31]!==x||e[32]!==v||e[33]!==A||e[34]!==E||e[35]!==d?(R=o.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[v,A,E,d]}),e[31]=x,e[32]=v,e[33]=A,e[34]=E,e[35]=d,e[36]=R):R=e[36];let I;e[37]!==l||e[38]!==b?(I=b&&o.jsx("div",{className:ie("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[37]=l,e[38]=b,e[39]=I):I=e[39];let D;return e[40]!==R||e[41]!==I||e[42]!==w||e[43]!==S?(D=o.jsxs("div",{className:w,children:[S,R,I]}),e[40]=R,e[41]=I,e[42]=w,e[43]=S,e[44]=D):D=e[44],D}function Iae(t){return t.stopPropagation()}function Fo(t){const e=B.c(10),{icon:s,title:n,description:i}=t;let r;e[0]!==s?(r=s&&o.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=r):r=e[1];let l;e[2]!==n?(l=o.jsx("div",{children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==i?(a=i&&o.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:i}),e[4]=i,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==a?(c=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[r,l,a]}),e[6]=r,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}const Mae={loaders:Hc,actions:mr},Oae={loaders:"Loaders",actions:"Actions"},$ae={analytics:WP,blog:Uc,commerce:Ng,site:OA,website:Mn};function Bae(t,e){return e===0?$ae[t.toLowerCase()]??Xo:Xo}function Sf(t,e){return e===0?ane(t):t}function zae(t){const e=B.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c}=t,d=re();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[0]=f):f=e[0];const[u,h]=P.useState(f),[m,p]=P.useState(null),[g,x]=P.useState(""),[b,y]=P.useState(Yae),[L,v]=P.useState(c);L!==c&&(v(c),h([]),p(null),x(""),y(new Set));let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=U=>{y(H=>{const q=new Set(H);return q.has(U)?q.delete(U):q.add(U),q})},e[1]=_):_=e[1];const w=_;let S;e[2]!==i||e[3]!==s||e[4]!==n?(S={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=S):S=e[5];const k=V0(S);let j;e[6]!==k?(j=bx((U,H)=>k.mutate({blockKey:U,data:H})),e[6]=k,e[7]=j):j=e[7];const C=j;let T;e[8]!==c?(T=Ak(c),e[8]=c,e[9]=T):T=e[9];const N=T,V=Mae[c];let A,E,R,I,D,O,z;if(e[10]!==V||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==u||e[18]!==r||e[19]!==k||e[20]!==C||e[21]!==g||e[22]!==m||e[23]!==N||e[24]!==d||e[25]!==n){R=Symbol.for("react.early_return_sentinel");e:{const U=[...Dk(l,a,c).map(Gae),...Ek(l,c).map(qae)],H=g.trim().toLowerCase(),q=H.length>0,W=q?U.filter(me=>me.title.toLowerCase().includes(H)||me.resolveType.toLowerCase().includes(H)):[],G=new Map,Y=[],J=new Map;if(!q){for(const me of U){const Ce=me.folderPath;if(!(Ce.length<u.length)&&u.every((Ne,Ie)=>Ce[Ie]===Ne))if(Ce.length===u.length)if(me.savedKey!==void 0){const Ne=J.get(me.resolveType);Ne?Ne.push(me):J.set(me.resolveType,[me])}else Y.push(me);else{const Ne=Ce[u.length],Ie=G.get(Ne)??{count:0,savedCount:0};me.savedKey!==void 0?Ie.savedCount=Ie.savedCount+1:Ie.count=Ie.count+1,G.set(Ne,Ie)}}Y.sort(Wae);for(const me of J.values())me.sort(Kae)}const se=[...J.entries()].filter(me=>{const[Ce]=me;return!Y.some(Ne=>Ne.resolveType===Ce)}).flatMap(Hae).sort(Uae);let oe;e[33]!==u?(oe=(me,Ce)=>Sf(me.name,u.length).localeCompare(Sf(Ce.name,u.length)),e[33]=u,e[34]=oe):oe=e[34];const ne=[...G.entries()].map(Fae).sort(oe);let Q;e[35]===Symbol.for("react.memo_cache_sentinel")?(Q=me=>{p(me.savedKey!==void 0?{mode:"saved",key:me.savedKey}:{mode:"available",resolveType:me.resolveType,title:me.title})},e[35]=Q):Q=e[35];const K=Q;let X;e[36]!==k||e[37]!==N||e[38]!==d?(X=async(me,Ce)=>{await k.mutateAsync({blockKey:me,data:Ce}),xe.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:N,blockId:me})),p({mode:"saved",key:me})},e[36]=k,e[37]=N,e[38]=d,e[39]=X):X=e[39];const Z=X;let le;e[40]!==a||e[41]!==m?(le=Jae(m,a),e[40]=a,e[41]=m,e[42]=le):le=e[42];const ee=le;if(ee){const me=`${ee.mode}:${ee.mode==="saved"?ee.blockKey:ee.resolveType}`;let Ce;e[43]===Symbol.for("react.memo_cache_sentinel")?(Ce=()=>p(null),e[43]=Ce):Ce=e[43];let Ne;e[44]!==i||e[45]!==a||e[46]!==Z||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==r||e[51]!==k.isPending||e[52]!==C||e[53]!==me||e[54]!==ee.editorTarget||e[55]!==ee.initialValue||e[56]!==n?(Ne=o.jsx(Rj,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c,target:ee.editorTarget,initialValue:ee.initialValue,isCreating:k.isPending,onCreate:Z,onSaveReferencedBlock:C,onBack:Ce},me),e[44]=i,e[45]=a,e[46]=Z,e[47]=c,e[48]=l,e[49]=s,e[50]=r,e[51]=k.isPending,e[52]=C,e[53]=me,e[54]=ee.editorTarget,e[55]=ee.initialValue,e[56]=n,e[57]=Ne):Ne=e[57],R=Ne;break e}z="flex h-full w-full min-w-0 flex-col";let ae;e[58]!==d?(ae=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=ae):ae=e[59];let ce;e[60]===Symbol.for("react.memo_cache_sentinel")?(ce=()=>h([]),e[60]=ce):ce=e[60];const fe=u.length===0?"font-medium text-foreground":"text-muted-foreground";let de;e[61]!==fe?(de=ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",fe),e[61]=fe,e[62]=de):de=e[62];const pe=Oae[c];let te;e[63]!==de||e[64]!==pe?(te=o.jsx("button",{type:"button",onClick:ce,className:de,children:pe}),e[63]=de,e[64]=pe,e[65]=te):te=e[65];let ge;e[66]!==u?(ge=u.map((me,Ce)=>{const Ne=Ce===u.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o.jsx(en,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>h(u.slice(0,Ce+1)),className:ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Ne?"font-medium text-foreground":"text-muted-foreground"),children:Sf(me,Ce)})]},`${me}-${Ce}`)}),e[66]=u,e[67]=ge):ge=e[67];let ve;e[68]!==ae||e[69]!==te||e[70]!==ge?(ve=o.jsxs("nav",{"aria-label":ae,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[te,ge]}),e[68]=ae,e[69]=te,e[70]=ge,e[71]=ve):ve=e[71];let Se;e[72]===Symbol.for("react.memo_cache_sentinel")?(Se=o.jsx(k9,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=Se):Se=e[72];let ye;e[73]===Symbol.for("react.memo_cache_sentinel")?(ye=me=>x(me.target.value),e[73]=ye):ye=e[73];let ke;e[74]!==c||e[75]!==d?(ke=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=ke):ke=e[76];let we;e[77]!==c||e[78]!==d?(we=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=we):we=e[79];let je;e[80]!==g||e[81]!==ke||e[82]!==we?(je=o.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[Se,o.jsx("input",{type:"text",value:g,onChange:ye,placeholder:ke,"aria-label":we,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=ke,e[82]=we,e[83]=je):je=e[83],e[84]!==ve||e[85]!==je?(E=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ve,je]}),e[84]=ve,e[85]=je,e[86]=E):E=e[86],A=xl,O="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",I="mx-auto w-full max-w-4xl px-6 py-5",D=q?W.length===0?o.jsx(Fo,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):o.jsx("div",{className:"flex flex-col gap-1",children:W.map(me=>o.jsx(vi,{icon:V,accent:me.savedKey!==void 0?"global":void 0,title:me.title,subtitle:me.resolveType,active:!1,onClick:()=>K(me)},me.savedKey??me.resolveType))}):ne.length===0&&Y.length===0&&se.length===0?o.jsx(Fo,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:u.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):o.jsxs(o.Fragment,{children:[ne.length>0&&o.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:ne.map(me=>{const Ce=Bae(me.name,u.length);return o.jsxs("button",{type:"button",onClick:()=>h([...u,me.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[o.jsx(Ce,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium",children:Sf(me.name,u.length)}),o.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[me.count," ",me.count===1?N:c,me.savedCount>0&&o.jsxs(o.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:me.savedCount})]})]})]})]},me.name)})}),(Y.length>0||se.length>0)&&o.jsxs("div",{className:ie("flex flex-col gap-1",ne.length>0&&"mt-4"),children:[Y.map(me=>{const Ce=J.get(me.resolveType)??[],Ne=b.has(me.resolveType);return o.jsxs("div",{className:"flex flex-col",children:[o.jsx(vi,{icon:V,title:me.title,subtitle:me.resolveType,active:!1,onClick:()=>K(me)}),Ce.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>w(me.resolveType),"aria-expanded":Ne,className:"flex items-center gap-1 self-start rounded-md px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:m3},children:[Ne?o.jsx(Qt,{size:12,className:"shrink-0"}):o.jsx(en,{size:12,className:"shrink-0"}),d(Ne?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Ce.length,")"]}),Ne&&o.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Ce.map(Ie=>o.jsx(vi,{icon:V,accent:"global",title:Ie.title,subtitle:Ie.resolveType,active:!1,onClick:()=>K(Ie)},Ie.savedKey))})]})]},me.resolveType)}),se.map(me=>o.jsx(vi,{icon:V,accent:"global",title:me.title,subtitle:me.resolveType,active:!1,onClick:()=>K(me)},me.savedKey))]})]})}e[10]=V,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=u,e[18]=r,e[19]=k,e[20]=C,e[21]=g,e[22]=m,e[23]=N,e[24]=d,e[25]=n,e[26]=A,e[27]=E,e[28]=R,e[29]=I,e[30]=D,e[31]=O,e[32]=z}else A=e[26],E=e[27],R=e[28],I=e[29],D=e[30],O=e[31],z=e[32];if(R!==Symbol.for("react.early_return_sentinel"))return R;let M;e[87]!==I||e[88]!==D?(M=o.jsx("div",{className:I,children:D}),e[87]=I,e[88]=D,e[89]=M):M=e[89];let $;e[90]!==A||e[91]!==M||e[92]!==O?($=o.jsx(A,{className:O,children:M}),e[90]=A,e[91]=M,e[92]=O,e[93]=$):$=e[93];let F;return e[94]!==E||e[95]!==$||e[96]!==z?(F=o.jsxs("div",{className:z,children:[E,$]}),e[94]=E,e[95]=$,e[96]=z,e[97]=F):F=e[97],F}function Fae(t){const[e,s]=t;return{name:e,...s}}function Uae(t,e){return t.title.localeCompare(e.title)}function Hae(t){const[,e]=t;return e}function Kae(t,e){return t.title.localeCompare(e.title)}function Wae(t,e){return t.title.localeCompare(e.title)}function qae(t){return{resolveType:t.resolveType,title:t.title,folderPath:Rk(t.resolveType)}}function Gae(t){return{resolveType:t.resolveType,title:t.title,folderPath:Rk(t.resolveType),savedKey:t.key}}function Yae(){return new Set}function Jae(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:n,title:i}=Ik(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function Qae(t){const e=B.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:f,isCreating:u,onCreate:h,onSaveReferencedBlock:m}=t,p=re(),g=oo(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[y,L]=P.useState(b);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=[],e[1]=v):v=e[1];const[_,w]=P.useState(v),[S,k]=P.useState(0),[j,C]=P.useState(!1);let T;e[2]!==l||e[3]!==c?(T=In(c,l),e[2]=l,e[3]=c,e[4]=T):T=e[4];const N=T,V=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,A=As()?.taskId??null,E=r??void 0;let R;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==E||e[9]!==A||e[10]!==n?(R={orgSlug:s,virtualMcpId:n,branch:i,threadId:A,previewUrl:E,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=E,e[9]=A,e[10]=n,e[11]=R):R=e[11];const I=R;let D,O,z,M,$,F,U,H;if(e[12]!==a||e[13]!==_||e[14]!==y||e[15]!==h||e[16]!==p||e[17]!==d){const de=[d,..._],pe=ge=>{w(_.slice(0,ge)),k(Xae)};let te;e[26]!==a||e[27]!==y||e[28]!==h?(te=async ge=>{const ve=kx(ge,a);if(ve){xe.error(ve);return}await h(ge,y),C(!1)},e[26]=a,e[27]=y,e[28]=h,e[29]=te):te=e[29],D=te,M="flex h-full w-full min-w-0",z="flex min-w-0 flex-1 flex-col",O="shrink-0 border-b px-3 py-2.5",H="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==p?($=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=p,e[31]=$):$=e[31],F="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",U=de.map((ge,ve)=>{const Se=ve===de.length-1,ye=Sn(ge);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ve>0&&o.jsx(en,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>pe(ve),title:ye,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",Se?"font-medium text-foreground":"text-muted-foreground"),children:ye})]},`${ye}-${ve}`)}),e[12]=a,e[13]=_,e[14]=y,e[15]=h,e[16]=p,e[17]=d,e[18]=D,e[19]=O,e[20]=z,e[21]=M,e[22]=$,e[23]=F,e[24]=U,e[25]=H}else D=e[18],O=e[19],z=e[20],M=e[21],$=e[22],F=e[23],U=e[24],H=e[25];let q;e[32]!==$||e[33]!==F||e[34]!==U?(q=o.jsx("nav",{"aria-label":$,className:F,children:U}),e[32]=$,e[33]=F,e[34]=U,e[35]=q):q=e[35];let W;e[36]===Symbol.for("react.memo_cache_sentinel")?(W=()=>C(!0),e[36]=W):W=e[36];let G;e[37]!==p?(G=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=p,e[38]=G):G=e[38];let Y;e[39]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(Z2,{size:14}),e[39]=Y):Y=e[39];let J;e[40]!==u||e[41]!==G?(J=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{size:"icon",className:"size-8 shrink-0",disabled:u,onClick:W,"aria-label":G,children:Y})}),e[40]=u,e[41]=G,e[42]=J):J=e[42];let se;e[43]!==p?(se=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=p,e[44]=se):se=e[44];let oe;e[45]!==se?(oe=o.jsx(We,{side:"bottom",children:se}),e[45]=se,e[46]=oe):oe=e[46];let ne;e[47]!==J||e[48]!==oe?(ne=o.jsxs(qe,{children:[J,oe]}),e[47]=J,e[48]=oe,e[49]=ne):ne=e[49];let Q;e[50]!==q||e[51]!==ne||e[52]!==H?(Q=o.jsxs("div",{className:H,children:[q,ne]}),e[50]=q,e[51]=ne,e[52]=H,e[53]=Q):Q=e[53];const K="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",X=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:V});let Z;e[54]!==X?(Z=o.jsx("p",{className:K,children:X}),e[54]=X,e[55]=Z):Z=e[55];let le;e[56]!==O||e[57]!==Q||e[58]!==Z?(le=o.jsxs("div",{className:O,children:[Q,Z]}),e[56]=O,e[57]=Q,e[58]=Z,e[59]=le):le=e[59];let ee;e[60]!==a||e[61]!==_||e[62]!==S||e[63]!==y||e[64]!==l||e[65]!==m||e[66]!==I||e[67]!==N||e[68]!==p?(ee=o.jsx(xl,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:N?o.jsx(Ii,{schema:N,value:y,onChange:de=>L(de),basePath:"",breadcrumbPath:_,onBreadcrumbChange:w,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:I},S):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=a,e[61]=_,e[62]=S,e[63]=y,e[64]=l,e[65]=m,e[66]=I,e[67]=N,e[68]=p,e[69]=ee):ee=e[69];let ae;e[70]!==z||e[71]!==le||e[72]!==ee?(ae=o.jsxs("div",{className:z,children:[le,ee]}),e[70]=z,e[71]=le,e[72]=ee,e[73]=ae):ae=e[73];let ce;e[74]!==f||e[75]!==D||e[76]!==u||e[77]!==j?(ce=o.jsx(jx,{open:j,onOpenChange:C,defaultBlockId:f,isPending:u,onSubmit:D}),e[74]=f,e[75]=D,e[76]=u,e[77]=j,e[78]=ce):ce=e[78];let fe;return e[79]!==M||e[80]!==ae||e[81]!==ce?(fe=o.jsxs("div",{className:M,children:[ae,ce]}),e[79]=M,e[80]=ae,e[81]=ce,e[82]=fe):fe=e[82],fe}function Xae(t){return t+1}var Zae=Object.prototype.toString,kd=Array.isArray||function(e){return Zae.call(e)==="[object Array]"};function Dx(t){return typeof t=="function"}function ece(t){return kd(t)?"array":typeof t}function um(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Iv(t,e){return t!=null&&typeof t=="object"&&e in t}function tce(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var sce=RegExp.prototype.test;function nce(t,e){return sce.call(t,e)}var ice=/\S/;function rce(t){return!nce(ice,t)}var oce={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function lce(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return oce[s]})}var ace=/\s*/,cce=/\s+/,Mv=/\s*=/,dce=/\s*\}/,uce=/#|\^|\/|>|\{|&|=|!/;function fce(t,e){if(!t)return[];var s=!1,n=[],i=[],r=[],l=!1,a=!1,c="",d=0;function f(){if(l&&!a)for(;r.length;)delete i[r.pop()];else r=[];l=!1,a=!1}var u,h,m;function p(k){if(typeof k=="string"&&(k=k.split(cce,2)),!kd(k)||k.length!==2)throw new Error("Invalid tags: "+k);u=new RegExp(um(k[0])+"\\s*"),h=new RegExp("\\s*"+um(k[1])),m=new RegExp("\\s*"+um("}"+k[1]))}p(e||Pi.tags);for(var g=new A0(t),x,b,y,L,v,_;!g.eos();){if(x=g.pos,y=g.scanUntil(u),y)for(var w=0,S=y.length;w<S;++w)L=y.charAt(w),rce(L)?(r.push(i.length),c+=L):(a=!0,s=!0,c+=" "),i.push(["text",L,x,x+1]),x+=1,L===`
622
+ `)}function bv(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function ooe(t,e){const s=new Map;for(const n of t){const i=s.get(n.label);i?i.push(n):s.set(n.label,[n])}return e.map(n=>({id:s.get(n.label)?.shift()?.id??crypto.randomUUID(),index:n.index,label:n.label}))}function loe(t){return t.map((e,s)=>({...e,index:s}))}function Sj(t){const e=B.c(19),{label:s,canDelete:n,dragging:i,onRename:r,onDuplicate:l,onDelete:a}=t,c=re(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let f;e[0]!==d?(f=ie("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=f):f=e[1];let u;e[2]!==f?(u=o.jsx(ld,{className:f}),e[2]=f,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Ko,{className:"h-4 w-4 shrink-0",style:{color:ioe}}),e[4]=h):h=e[4];let m;e[5]!==s?(m=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==r||e[13]!==c?(p=!i&&o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionVariantList.openActionsFor",{label:s}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 data-[state=open]:opacity-100",onClick:coe,onPointerDown:aoe,children:o.jsx(qn,{size:14})})}),o.jsxs(zt,{align:"end",children:[r&&o.jsxs(Xe,{onClick:x=>{x.stopPropagation(),r()},children:[o.jsx(v8,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),o.jsxs(Xe,{onClick:x=>{x.stopPropagation(),l?.()},children:[o.jsx(an,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),o.jsxs(Xe,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[o.jsx(tn,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=a,e[11]=l,e[12]=r,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==u||e[16]!==m||e[17]!==p?(g=o.jsxs(o.Fragment,{children:[u,h,m,p]}),e[15]=u,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function aoe(t){return t.stopPropagation()}function coe(t){return t.stopPropagation()}function doe(t){const e=B.c(27),{entry:s,selected:n,canDelete:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:uoe},e[0]=s.id,e[1]=d):d=e[1];const{attributes:f,listeners:u,setNodeRef:h,transform:m,isDragging:p}=K9(d);let g;e[2]!==m?(g=Ti.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const y=b;let L;e[7]!==r?(L=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),r())},e[7]=r,e[8]=L):L=e[8];const v=p?"cursor-grabbing":"cursor-grab",_=n?wj:roe;let w;e[9]!==v||e[10]!==_?(w=ie("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",v,_),e[9]=v,e[10]=_,e[11]=w):w=e[11];let S;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(S=o.jsx(Sj,{label:s.label,canDelete:i,onRename:l,onDuplicate:a,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=a,e[16]=l,e[17]=S):S=e[17];let k;return e[18]!==f||e[19]!==u||e[20]!==r||e[21]!==h||e[22]!==y||e[23]!==L||e[24]!==w||e[25]!==S?(k=o.jsx("div",{ref:h,style:y,...f,...u,onClick:r,onKeyDown:L,className:w,children:S}),e[18]=f,e[19]=u,e[20]=r,e[21]=h,e[22]=y,e[23]=L,e[24]=w,e[25]=S,e[26]=k):k=e[26],k}function uoe(){return!1}function foe(t){const e=B.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:f,onAdd:u}=t,h=re(),m=n.length>1;let p;e[0]!==n?(p=()=>bv(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=P.useState(p),[b,y]=P.useState(null),[L,v]=P.useState(s),[_,w]=P.useState(n.length);let S;e[2]!==n?(S=()=>xv(n),e[2]=n,e[3]=S):S=e[3];const[k,j]=P.useState(S),C=P.useRef(!1),T=xv(n);L!==s?(v(s),w(n.length),j(T),x(bv(n))):(_!==n.length||k!==T)&&(w(n.length),j(T),x(fe=>ooe(fe,n)));let N;e[4]===Symbol.for("react.memo_cache_sentinel")?(N={activationConstraint:{distance:8}},e[4]=N):N=e[4];let V;e[5]===Symbol.for("react.memo_cache_sentinel")?(V={coordinateGetter:W9},e[5]=V):V=e[5];const A=S0(pr(ba,N),pr(xa,V));let E;e[6]!==g?(E=g.map(hoe),e[6]=g,e[7]=E):E=e[7];const R=E;let I;e[8]!==g?(I=fe=>{const de=String(fe.active.id);y(g.find(pe=>pe.id===de)??null)},e[8]=g,e[9]=I):I=e[9];const D=I;let O;e[10]!==R||e[11]!==f?(O=fe=>{y(null);const{active:de,over:pe}=fe;if(!pe||de.id===pe.id)return;const te=R.indexOf(String(de.id)),ge=R.indexOf(String(pe.id));te===-1||ge===-1||(x(ve=>loe(Ql([...ve],te,ge))),C.current=!0,requestAnimationFrame(()=>{C.current=!1}),f(te,ge))},e[10]=R,e[11]=f,e[12]=O):O=e[12];const z=O;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{y(null)},e[13]=M):M=e[13];const $=M;let F,U,H,q,W,G,Y,J,se,oe,ne,Q,K;if(e[14]!==m||e[15]!==g||e[16]!==R||e[17]!==z||e[18]!==D||e[19]!==u||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==r||e[25]!==i||e[26]!==A||e[27]!==h){const fe=Ze=>{C.current||r(Ze)};ne="space-y-1 border-b p-2";let de;e[41]!==h?(de=h("sectionsEditor.sectionVariantList.title"),e[41]=h,e[42]=de):de=e[42];let pe;e[43]!==de?(pe=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:de}),e[43]=de,e[44]=pe):pe=e[44];let te;e[45]!==h?(te=h("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=h,e[46]=te):te=e[46];let ge;e[47]===Symbol.for("react.memo_cache_sentinel")?(ge=o.jsx(Kt,{size:14}),e[47]=ge):ge=e[47];let ve;e[48]!==u||e[49]!==te?(ve=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":te,className:"size-6",onClick:u,children:ge})}),e[48]=u,e[49]=te,e[50]=ve):ve=e[50];let Se;e[51]!==h?(Se=h("sectionsEditor.sectionVariantList.addVariant"),e[51]=h,e[52]=Se):Se=e[52];let ye;e[53]!==Se?(ye=o.jsx(We,{children:Se}),e[53]=Se,e[54]=ye):ye=e[54];let ke;e[55]!==ve||e[56]!==ye?(ke=o.jsxs(qe,{children:[ve,ye]}),e[55]=ve,e[56]=ye,e[57]=ke):ke=e[57];let we;e[58]!==h?(we=h("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=h,e[59]=we):we=e[59];let je;e[60]===Symbol.for("react.memo_cache_sentinel")?(je=o.jsx(tn,{size:14}),e[60]=je):je=e[60];let me;e[61]!==d||e[62]!==we?(me=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":we,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:je})}),e[61]=d,e[62]=we,e[63]=me):me=e[63];let Ce;e[64]!==h?(Ce=h("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=h,e[65]=Ce):Ce=e[65];let Ne;e[66]!==Ce?(Ne=o.jsx(We,{children:Ce}),e[66]=Ce,e[67]=Ne):Ne=e[67];let Ie;e[68]!==me||e[69]!==Ne?(Ie=o.jsxs(qe,{children:[me,Ne]}),e[68]=me,e[69]=Ne,e[70]=Ie):Ie=e[70];let et;e[71]!==ke||e[72]!==Ie?(et=o.jsxs("div",{className:"flex items-center gap-0.5",children:[ke,Ie]}),e[71]=ke,e[72]=Ie,e[73]=et):et=e[73],e[74]!==pe||e[75]!==et?(Q=o.jsxs("div",{className:"flex items-center justify-between",children:[pe,et]}),e[74]=pe,e[75]=et,e[76]=Q):Q=e[76],U=j0,G=A,Y=T3,J=D,se=z,oe=$,F=H9,q=R,W=U9,K="space-y-0.5",H=g.map(Ze=>o.jsx(doe,{entry:Ze,selected:Ze.index===i,canDelete:m,onSelect:()=>fe(Ze.index),onRename:l?()=>l(Ze.index):void 0,onDuplicate:()=>a(Ze.index),onDelete:()=>c(Ze.index)},Ze.id)),e[14]=m,e[15]=g,e[16]=R,e[17]=z,e[18]=D,e[19]=u,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=r,e[25]=i,e[26]=A,e[27]=h,e[28]=F,e[29]=U,e[30]=H,e[31]=q,e[32]=W,e[33]=G,e[34]=Y,e[35]=J,e[36]=se,e[37]=oe,e[38]=ne,e[39]=Q,e[40]=K}else F=e[28],U=e[29],H=e[30],q=e[31],W=e[32],G=e[33],Y=e[34],J=e[35],se=e[36],oe=e[37],ne=e[38],Q=e[39],K=e[40];let X;e[77]!==H||e[78]!==K?(X=o.jsx("div",{className:K,children:H}),e[77]=H,e[78]=K,e[79]=X):X=e[79];let Z;e[80]!==F||e[81]!==q||e[82]!==W||e[83]!==X?(Z=o.jsx(F,{items:q,strategy:W,children:X}),e[80]=F,e[81]=q,e[82]=W,e[83]=X,e[84]=Z):Z=e[84];let le;e[85]!==b||e[86]!==m?(le=b?o.jsx("div",{className:ie("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",wj),children:o.jsx(Sj,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=le):le=e[87];let ee;e[88]!==le?(ee=_n.createPortal(o.jsx(F9,{dropAnimation:Kk,children:le}),document.body),e[88]=le,e[89]=ee):ee=e[89];let ae;e[90]!==U||e[91]!==G||e[92]!==Y||e[93]!==J||e[94]!==se||e[95]!==oe||e[96]!==Z||e[97]!==ee?(ae=o.jsxs(U,{sensors:G,collisionDetection:Y,onDragStart:J,onDragEnd:se,onDragCancel:oe,children:[Z,ee]}),e[90]=U,e[91]=G,e[92]=Y,e[93]=J,e[94]=se,e[95]=oe,e[96]=Z,e[97]=ee,e[98]=ae):ae=e[98];let ce;return e[99]!==ne||e[100]!==Q||e[101]!==ae?(ce=o.jsxs("div",{className:ne,children:[Q,ae]}),e[99]=ne,e[100]=Q,e[101]=ae,e[102]=ce):ce=e[102],ce}function hoe(t){return t.id}const moe=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],poe={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",gift:"Gift01","user-check":"UserCheck01","user-x":"UserX01",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function im(t){return ha(t)!==void 0}function Tx(t,e){if(e){if(im(e))return e;const s=poe[e];if(s&&im(s))return s}for(const[s,n]of moe)if(s.test(t)&&im(n))return n;return"FilterLines"}function goe(t){return ha(t)??w9}function rm(t){const e=B.c(11),{iconName:s,size:n,className:i}=t,r=n===void 0?"md":n;let l;e[0]!==s?(l=goe(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=r==="sm"?"size-7":"size-9",d=r==="sm"?16:18;let f;e[2]!==c||e[3]!==i?(f=ie("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=f):f=e[4];let u;e[5]!==a||e[6]!==d?(u=o.jsx(a,{size:d,className:"text-muted-foreground"}),e[5]=a,e[6]=d,e[7]=u):u=e[7];let h;return e[8]!==f||e[9]!==u?(h=o.jsx("div",{className:f,children:u}),e[8]=f,e[9]=u,e[10]=h):h=e[10],h}function j3e(t,e){return pte(t,e).map(s=>{const n=e[s.blockKey]??{},i=lk(bte(s.blockKey),e,t);return{blockKey:s.blockKey,title:Jl(s.blockKey,n),description:ed(i),iconName:Tx(s.matcherResolveType)}})}const kj="Users03";function xoe(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function boe(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[i,r]of Object.entries(e))if(i.includes("matchers")&&!i.startsWith("$live/"))for(const l of Object.keys(r)){if(l.toLowerCase().includes("always")||n.has(l))continue;n.add(l);const a=bl(l,t);s.push({resolveType:l,title:a.title??vs(l),description:a.description,iconName:Tx(l,a.icon)})}return s}function voe(t,e){if(!t)return kj;const s=e.find(n=>n.resolveType===t);return s?s.iconName:Tx(t)}function yoe(t){const e=B.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:r,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[f,u]=P.useState(!1),h=re(),p=(i?d.find(Q=>Q.blockKey===i):void 0)?.iconName??voe(s,r),g=ha(p);let x;e[0]!==a||e[1]!==u?(x=Q=>{a(Q),u(!1)},e[0]=a,e[1]=u,e[2]=x):x=e[2];const b=x;let y;e[3]!==c||e[4]!==u?(y=Q=>{c?.(Q),u(!1)},e[3]=c,e[4]=u,e[5]=y):y=e[5];const L=y;let v;e[6]!==u?(v=()=>u(!0),e[6]=u,e[7]=v):v=e[7];let _;e[8]!==g?(_=g&&o.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=_):_=e[9];let w;e[10]!==n?(w=o.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=w):w=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Qt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=S):S=e[12];let k;e[13]!==v||e[14]!==_||e[15]!==w?(k=o.jsxs("button",{type:"button",onClick:v,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[_,w,S]}),e[13]=v,e[14]=_,e[15]=w,e[16]=k):k=e[16];let j;e[17]!==h?(j=h("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=h,e[18]=j):j=e[18];let C;e[19]!==h?(C=h("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=h,e[20]=C):C=e[20];let T;e[21]!==h?(T=h("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=h,e[22]=T):T=e[22];let N;e[23]!==T?(N=o.jsx(On,{placeholder:T}),e[23]=T,e[24]=N):N=e[24];let V;e[25]!==h?(V=h("sectionsEditor.matcherPicker.noRulesFound"),e[25]=h,e[26]=V):V=e[26];let A;e[27]!==V?(A=o.jsx(Cn,{children:V}),e[27]=V,e[28]=A):A=e[28];let E;e[29]!==h?(E=h("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=h,e[30]=E):E=e[30];let R;e[31]!==h?(R=h("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=h,e[32]=R):R=e[32];const I=`${E} ${R}`;let D;e[33]!==b?(D=()=>b(""),e[33]=b,e[34]=D):D=e[34];const O=!s&&!i&&"bg-accent/60";let z;e[35]!==O?(z=ie("gap-2.5",O),e[35]=O,e[36]=z):z=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(rm,{iconName:kj,size:"sm"}),e[37]=M):M=e[37];let $;e[38]!==h?($=h("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=h,e[39]=$):$=e[39];let F;e[40]!==$?(F=o.jsx("span",{className:"text-sm",children:$}),e[40]=$,e[41]=F):F=e[41];let U;e[42]!==h?(U=h("sectionsEditor.matcherPicker.targetAllUsers"),e[42]=h,e[43]=U):U=e[43];let H;e[44]!==U?(H=o.jsx("span",{className:"text-xs text-muted-foreground",children:U}),e[44]=U,e[45]=H):H=e[45];let q;e[46]!==F||e[47]!==H?(q=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[F,H]}),e[46]=F,e[47]=H,e[48]=q):q=e[48];let W;e[49]!==I||e[50]!==D||e[51]!==z||e[52]!==q?(W=o.jsxs(Wt,{value:I,onSelect:D,className:z,children:[M,q]}),e[49]=I,e[50]=D,e[51]=z,e[52]=q,e[53]=W):W=e[53];let G;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==r){let Q;e[59]!==i||e[60]!==s||e[61]!==b?(Q=K=>o.jsxs(Wt,{value:`${K.title} ${K.resolveType} ${K.description??""}`,onSelect:()=>b(K.resolveType),className:ie("gap-2.5",!i&&s===K.resolveType&&"bg-accent/60"),children:[o.jsx(rm,{iconName:K.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm",children:K.title}),K.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:K.description})]})]},K.resolveType),e[59]=i,e[60]=s,e[61]=b,e[62]=Q):Q=e[62],G=r.map(Q),e[54]=i,e[55]=s,e[56]=b,e[57]=r,e[58]=G}else G=e[58];let Y;e[63]!==W||e[64]!==G?(Y=o.jsxs(fs,{children:[W,G]}),e[63]=W,e[64]=G,e[65]=Y):Y=e[65];let J;e[66]!==i||e[67]!==d||e[68]!==L||e[69]!==h?(J=d.length>0&&o.jsx(fs,{heading:h("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(Q=>o.jsxs(Wt,{value:`${Q.title} ${Q.blockKey} ${Q.description??""}`,onSelect:()=>L(Q.blockKey),className:ie("gap-2.5",i===Q.blockKey&&"bg-accent/60"),children:[o.jsx(rm,{iconName:Q.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm",children:Q.title}),Q.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Q.description})]})]},Q.blockKey))}),e[66]=i,e[67]=d,e[68]=L,e[69]=h,e[70]=J):J=e[70];let se;e[71]!==A||e[72]!==Y||e[73]!==J?(se=o.jsxs($n,{children:[A,Y,J]}),e[71]=A,e[72]=Y,e[73]=J,e[74]=se):se=e[74];let oe;e[75]!==f||e[76]!==u||e[77]!==C||e[78]!==N||e[79]!==se||e[80]!==j?(oe=o.jsxs(uE,{open:f,onOpenChange:u,title:j,description:C,className:"sm:max-w-lg",filter:xoe,children:[N,se]}),e[75]=f,e[76]=u,e[77]=C,e[78]=N,e[79]=se,e[80]=j,e[81]=oe):oe=e[81];let ne;return e[82]!==oe||e[83]!==k?(ne=o.jsxs(o.Fragment,{children:[k,oe]}),e[82]=oe,e[83]=k,e[84]=ne):ne=e[84],ne}const _oe="website/sections/Rendering/Lazy.tsx";function Dh(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Vx(t){if(!Dh(t))return!1;const e=t.__resolveType;return typeof e=="string"&&Vs(e)}function Loe(t){return t!=null}function $p(t){if(t==null)return t;if(Vx(t)){const e=t.section;return e==null?null:Dh(e)?e:{}}return Dh(t)?t:void 0}function woe(t,e){return t===null?null:Vx(e)?{...e,section:t}:t}function C3e(t){return{__resolveType:t}}function N3e(t,e){if(!Loe(e))return null;if(t){const s=$p(e)??{};return{__resolveType:_oe,section:s}}return Vx(e)?$p(e)??null:Dh(e)?e:null}const Soe="General";function td(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function jj(t,e){return t===dl?Soe:e}function Cj(t){const e=ah(t),s=new Set,n=[];for(const i of e)td(i.resolveType)&&(li(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:jj(i.resolveType,i.title),description:i.description})));return n}function Ax(t){const e=lh(t),s=In(e,t),n=Cj(s?.properties?.seo);return n.length>0?n:koe(t)}function koe(t){const e=t.manifest?.blocks??{},s=[];for(const[n,i]of Object.entries(e))if(n.includes("sections"))for(const r of Object.keys(i)){if(!td(r))continue;const l=r.split("/").pop()?.replace(/\.tsx?$/,"")??r;s.push({resolveType:r,title:jj(r,l)})}return s}function Nj(t){const e=Ax(t),s=e.find(n=>n.resolveType===dl);return s?s.resolveType:e[0]?.resolveType??dl}function Tj(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=In(s,t),i=Cj(n?.properties?.seo);if(i.length>0)return i}return Ax(t)}function joe(t,e){const s=Tj(t,e),n=s.find(i=>i.resolveType===dl);return n?n.resolveType:s[0]?.resolveType??Nj(t)}function Coe(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:Nj(t)}function Noe(t,e,s){const n=s.__resolveType;return typeof n=="string"&&td(n)?n:joe(t,e)}const Toe=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),dl="website/sections/Seo/SeoV2.tsx",Voe=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function vu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Aoe(t){return typeof t.__resolveType=="string"&&td(t.__resolveType)?!0:Voe.some(e=>e in t)}function Poe(t,e){for(const[s,n]of Object.entries(t)){if(!vu(n))continue;const i=n,r=i.__resolveType;if(typeof r=="string"&&Toe.has(r))continue;const l=i.seo;if(vu(l)){const a=l;if(Aoe(a))return{blockKey:s,kind:"nested",seoData:a,blockData:i,seoResolveType:e?Noe(e,i,a):typeof a.__resolveType=="string"&&td(a.__resolveType)?a.__resolveType:dl}}}for(const[s,n]of Object.entries(t)){if(!vu(n))continue;const i=n;if(typeof i.__resolveType=="string"&&td(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function Eoe(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function T3e(t,e,s){if(e.kind==="site"){const c=Poe(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?Tj(s,c.blockData):void 0,build:d=>Eoe(c,d)}:null}const n=t[e.pageKey];if(!vu(n))return null;const i=n,r=i.seo,l=$p(r),a=l&&vu(l)?l:void 0;return{blockKey:e.pageKey,seoData:a,rawSeoData:r,seoResolveType:s?Coe(s,a):typeof a?.__resolveType=="string"?a.__resolveType:dl,seoTypeOptions:s?Ax(s):void 0,build:c=>({...i,seo:c===null?null:woe(c,r)})}}const Px=["type","title","description","canonical","noIndexing","favicon","image","themeColor"],Roe=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],Doe=["jsonLD","title","description","noIndexing","configJsonLD"];function Vj(t){return t===dl||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function Ioe(t){switch(t){case"general":return Px;case"pdp":return Roe;case"plp":return Doe;default:return null}}function Aj(t,e){const s=Ioe(Vj(e));if(!s||!t.properties)return t;const n={};for(const i of s){const r=t.properties[i];r&&(n[i]=r)}return{...t,properties:n}}function Moe(){return Px.filter(t=>t!=="type")}function Ooe(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function $oe(t,e){return t[e]===void 0}function Boe(t){const e=B.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:r,formResetKey:l}=t,a=re(),d=Aj(s,dl).properties??{},f=Moe();let u;e[0]!==r?(u=!!r&&Object.keys(r).length>0,e[0]=r,e[1]=u):u=e[1];const h=u,[m,p]=P.useState(l);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=P.useState(g);m!==l&&(p(l),b({}));let y;e[3]!==x||e[4]!==n?(y=j=>x[j]!==void 0?x[j]:$oe(n,j),e[3]=x,e[4]=n,e[5]=y):y=e[5];const L=y;let v;e[6]!==i||e[7]!==r||e[8]!==n?(v=(j,C)=>{b(N=>({...N,[j]:C}));const T={...n};if(C)delete T[j];else{const N=r?.[j];T[j]=N??(j==="type"?"website":"")}i(T)},e[6]=i,e[7]=r,e[8]=n,e[9]=v):v=e[9];const _=v,w="min-w-0 space-y-6",S=Px.map(j=>{const C=d[j];if(!C)return null;const T=h&&f.includes(j),N=T&&L(j),V=N?r?.[j]??n[j]:n[j],A=C.title??Ooe(j);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:ie(N&&"pointer-events-none opacity-60"),children:na({schema:C,value:V,onChange:E=>{N||i({...n,[j]:E})},path:j,label:A,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:zoe})}),T&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(hr,{id:`seo-use-default-${j}`,checked:N,onCheckedChange:E=>_(j,E)}),o.jsx(Mt,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:a("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let k;return e[10]!==l||e[11]!==S?(k=o.jsx("div",{className:w,children:S},l),e[10]=l,e[11]=S,e[12]=k):k=e[12],k}function zoe(){}function Foe(t){const e=B.c(18),{schema:s,resolveType:n,value:i,formResetKey:r,onChange:l,onBreadcrumbChange:a,siteDefaultSeo:c}=t;if(Vj(n)==="general"){let g;e[0]!==l?(g=b=>l(b),e[0]=l,e[1]=g):g=e[1];let x;return e[2]!==r||e[3]!==s||e[4]!==c||e[5]!==g||e[6]!==i?(x=o.jsx(Boe,{schema:s,value:i,onChange:g,siteDefaultSeo:c,formResetKey:r}),e[2]=r,e[3]=s,e[4]=c,e[5]=g,e[6]=i,e[7]=x):x=e[7],x}let f;e[8]!==n||e[9]!==s?(f=Aj(s,n),e[8]=n,e[9]=s,e[10]=f):f=e[10];const u=f;let h;e[11]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[11]=h):h=e[11];const m=a??Uoe;let p;return e[12]!==u||e[13]!==r||e[14]!==l||e[15]!==m||e[16]!==i?(p=o.jsx(Ii,{schema:u,value:i,onChange:l,basePath:"",breadcrumbPath:h,onBreadcrumbChange:m},r),e[12]=u,e[13]=r,e[14]=l,e[15]=m,e[16]=i,e[17]=p):p=e[17],p}function Uoe(){}function Hoe(t){const e=B.c(16),{schema:s,value:n,onChange:i,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}=t,d=re();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[0]=f):f=e[0];const[u,h]=P.useState(f);let m;e[1]!==u||e[2]!==d?(m=u.length>0&&o.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[o.jsx("button",{type:"button",onClick:()=>h([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:o.jsx(Bm,{className:"size-3.5"})}),u.map((x,b)=>{const y=b===u.length-1,L=Sn(x);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&o.jsx(en,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>h(u.slice(0,b+1)),title:L,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",y?"font-medium text-foreground":"text-muted-foreground"),children:L})]},`${L}-${b}`)})]}),e[1]=u,e[2]=d,e[3]=m):m=e[3];let p;e[4]!==u||e[5]!==l||e[6]!==r||e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==s||e[11]!==n?(p=o.jsx(Ii,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:u,onBreadcrumbChange:h,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}),e[4]=u,e[5]=l,e[6]=r,e[7]=i,e[8]=a,e[9]=c,e[10]=s,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"space-y-2",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function V3e(t){const e=B.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:r,onBreadcrumbChange:l,breadcrumbPath:a,emptyMessage:c,beforeForm:d,seoResolveType:f,siteDefaultSeo:u,meta:h,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let y;e[0]!==a?(y=a===void 0?[]:a,e[0]=a,e[1]=y):y=e[1];const L=y;let v;e[2]!==s||e[3]!==L||e[4]!==m||e[5]!==i||e[6]!==n||e[7]!==h||e[8]!==l||e[9]!==r||e[10]!==b||e[11]!==p||e[12]!==x||e[13]!==g||e[14]!==f||e[15]!==u?(v=s&&n?f?o.jsx(Foe,{schema:s,resolveType:f,value:n,formResetKey:i,onChange:r,onBreadcrumbChange:l,siteDefaultSeo:u}):o.jsx(Ii,{schema:s,value:n,onChange:r,basePath:"",breadcrumbPath:L,onBreadcrumbChange:l,meta:h,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=L,e[4]=m,e[5]=i,e[6]=n,e[7]=h,e[8]=l,e[9]=r,e[10]=b,e[11]=p,e[12]=x,e[13]=g,e[14]=f,e[15]=u,e[16]=v):v=e[16];const _=v;let w;e[17]!==c||e[18]!==_?(w=_??o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=_,e[19]=w):w=e[19];let S;return e[20]!==d||e[21]!==w?(S=o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[d,w]})}),e[20]=d,e[21]=w,e[22]=S):S=e[22],S}const A3e="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function P3e(t,e){return Qte(t,e,ed)}function E3e(t){const e=B.c(66),{pageKey:s,initialName:n,initialPath:i,onFieldChange:r}=t,l=re(),[a,c]=P.useState(n),[d,f]=P.useState(i),[u,h]=P.useState(s),[m,p]=P.useState(null),g=P.useRef(!1);u!==s&&(h(s),c(n),f(i),p(null));let x;e[0]!==i||e[1]!==d?(x=()=>{if(g.current){g.current=!1;return}const J=d.trim();if(J===i.trim()){f(i);return}p(J)},e[0]=i,e[1]=d,e[2]=x):x=e[2];const b=x;let y;e[3]!==r||e[4]!==m?(y=()=>{m!==null&&(f(m),r("path",m),p(null))},e[3]=r,e[4]=m,e[5]=y):y=e[5];const L=y;let v;e[6]!==i?(v=()=>{f(i),p(null)},e[6]=i,e[7]=v):v=e[7];const _=v;let w;e[8]!==r?(w=J=>{c(J.target.value),r("name",J.target.value)},e[8]=r,e[9]=w):w=e[9];let S;e[10]!==l?(S=l("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=l,e[11]=S):S=e[11];let k;e[12]!==a||e[13]!==w||e[14]!==S?(k=o.jsx("input",{type:"text",value:a,onChange:w,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:S}),e[12]=a,e[13]=w,e[14]=S,e[15]=k):k=e[15];let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j=J=>f(J.target.value),e[16]=j):j=e[16];let C;e[17]!==i?(C=J=>{J.key==="Enter"?(J.preventDefault(),J.currentTarget.blur()):J.key==="Escape"&&(J.preventDefault(),g.current=!0,f(i),J.currentTarget.blur())},e[17]=i,e[18]=C):C=e[18];let T;e[19]!==l?(T=l("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[19]=l,e[20]=T):T=e[20];let N;e[21]!==b||e[22]!==d||e[23]!==C||e[24]!==T?(N=o.jsx("input",{type:"text",value:d,onChange:j,onBlur:b,onKeyDown:C,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:T}),e[21]=b,e[22]=d,e[23]=C,e[24]=T,e[25]=N):N=e[25];const V=m!==null;let A;e[26]!==_?(A=J=>{J||_()},e[26]=_,e[27]=A):A=e[27];let E;e[28]!==l?(E=l("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[28]=l,e[29]=E):E=e[29];let R;e[30]!==E?(R=o.jsx(nl,{children:E}),e[30]=E,e[31]=R):R=e[31];const I=m??"";let D;e[32]!==i||e[33]!==l||e[34]!==I?(D=l("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:i,to:I}),e[32]=i,e[33]=l,e[34]=I,e[35]=D):D=e[35];let O;e[36]!==D?(O=o.jsx(il,{children:D}),e[36]=D,e[37]=O):O=e[37];let z;e[38]!==R||e[39]!==O?(z=o.jsxs(sl,{children:[R,O]}),e[38]=R,e[39]=O,e[40]=z):z=e[40];let M;e[41]!==l?(M=l("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[41]=l,e[42]=M):M=e[42];let $;e[43]!==M?($=o.jsx(ol,{children:M}),e[43]=M,e[44]=$):$=e[44];let F;e[45]!==L?(F=J=>{J.preventDefault(),L()},e[45]=L,e[46]=F):F=e[46];let U;e[47]!==l?(U=l("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[47]=l,e[48]=U):U=e[48];let H;e[49]!==F||e[50]!==U?(H=o.jsx(ll,{onClick:F,children:U}),e[49]=F,e[50]=U,e[51]=H):H=e[51];let q;e[52]!==$||e[53]!==H?(q=o.jsxs(rl,{children:[$,H]}),e[52]=$,e[53]=H,e[54]=q):q=e[54];let W;e[55]!==z||e[56]!==q?(W=o.jsxs(tl,{children:[z,q]}),e[55]=z,e[56]=q,e[57]=W):W=e[57];let G;e[58]!==V||e[59]!==A||e[60]!==W?(G=o.jsx(el,{open:V,onOpenChange:A,children:W}),e[58]=V,e[59]=A,e[60]=W,e[61]=G):G=e[61];let Y;return e[62]!==N||e[63]!==G||e[64]!==k?(Y=o.jsxs("div",{className:"space-y-1",children:[k,N,G]}),e[62]=N,e[63]=G,e[64]=k,e[65]=Y):Y=e[65],Y}function R3e(t){const e=B.c(13),{onClick:s}=t,n=re();let i;e[0]!==n?(i=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=n,e[1]=i):i=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(c0,{size:14}),e[2]=r):r=e[2];let l;e[3]!==s||e[4]!==i?(l=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":i,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:r})}),e[3]=s,e[4]=i,e[5]=l):l=e[5];let a;e[6]!==n?(a=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx(We,{side:"bottom",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=o.jsxs(qe,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}const vv=new WeakMap;function Koe(t,e){let s=vv.get(e);s||(s=new Map,vv.set(e,s));let n=s.get(t);return n===void 0&&(n=In(t,e),s.set(t,n)),n}function Woe(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function qoe(t,e){return{__resolveType:e,variants:[{rule:Jc(),value:structuredClone(t)},{rule:Jc(),value:structuredClone(t)}]}}function Goe(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>hx(n.rule));return s?s.value:e[e.length-1]?.value}function Yoe(t){const e=[...t.variants],s=e[e.length-1],n={rule:Jc(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function Joe(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function Qoe(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function Xoe(t,e,s){return e<t?t-1:Math.min(t,s-1)}function Zoe(t,e,s){const n=[...t.variants];if(e===s||e<0||s<0||e>=n.length||s>=n.length)return t;const[i]=n.splice(e,1);return i?(n.splice(s,0,i),{...t,variants:n}):t}function ele(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function yv(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const _v=new WeakMap;function tle(t){let e=_v.get(t);return e||(e=boe(t),_v.set(t,e)),e}function Pj(t){const e=B.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,r=re(),{value:l,onChange:a,meta:c,path:d}=i,[f,u]=P.useState(0);if(!Woe(l)){let z;e[0]!==r?(z=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=r,e[1]=z):z=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(c0,{size:14}),e[2]=M):M=e[2];let $;e[3]!==r?($=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=r,e[4]=$):$=e[4];let F;return e[5]!==$?(F=o.jsx(We,{children:$}),e[5]=$,e[6]=F):F=e[6],o.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":z,onClick:()=>{a(qoe(l,s)),u(0)},children:M})}),F]}),n(i)]})}const h=l,m=h.variants,p=Math.min(f,m.length-1);let g;e[7]!==r?(g=(z,M)=>({index:M,label:ed(z.rule)||r("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=r,e[8]=g):g=e[8];const x=m.map(g),b=m[p],y=b?.rule??{},L=y.__resolveType??"",v=b?.value,_=c?tle(c):[],w=L&&c?Koe(L,c):null,{__resolveType:S,...k}=y,j=()=>{a(Goe(h)),u(0)},C=()=>{const z=Yoe(h);a(z),u(z.variants.length-1)},T=z=>{const M=Joe(h,z);M&&(a(M),u(Xoe(p,z,M.variants.length)))},N=z=>{const M=Qoe(h,z);a(M),u(z+1)},V=(z,M)=>{const $=Zoe(h,z,M);a($),p===z&&u(M)},A=z=>{const M=z?vte(z,c):{__resolveType:p3};a(yv(h,p,M))},E=z=>{const M=z,$=L?{...M,__resolveType:L}:{...M};a(yv(h,p,$))},R=z=>{a(ele(h,p,z))},I=`${d}-${h.__resolveType}`;let D;e[9]!==r?(D=r("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=r,e[10]=D):D=e[10];let O;return e[11]!==D?(O=o.jsx(Mt,{className:"text-xs text-muted-foreground",children:D}),e[11]=D,e[12]=O):O=e[12],o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[o.jsx(foe,{listKey:I,variants:x,selectedIndex:p,onSelect:u,onDuplicate:N,onDelete:T,onRemoveAll:j,onReorder:V,onAdd:C}),o.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[O,o.jsx(yoe,{currentRt:L,currentLabel:ed(y),matchers:_,onSelect:A}),w&&o.jsx("div",{className:"pt-1",children:o.jsx(Hoe,{schema:w,value:k,onChange:E,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${p}-${L}`)})]}),n({...i,value:v,onChange:R})]})]})}const sle="website/loaders/secret.ts";function yu(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function nle(){return{__resolveType:sle,name:"",encrypted:""}}function ile(t){const{value:e,...s}=t;return s}function om(t){const e=B.c(53),{schema:s,value:n,onChange:i,label:r,path:l,sandbox:a}=t,c=re();if(typeof n=="string"||n==null&&!yu(n)){const C=typeof n=="string"?n:"",T=a?.virtualMcpId;let N;e[0]!==r||e[1]!==l||e[2]!==s.description||e[3]!==T?(N=o.jsx(Hs,{htmlFor:l,label:r,description:s.description,virtualMcpId:T}),e[0]=r,e[1]=l,e[2]=s.description,e[3]=T,e[4]=N):N=e[4];let V;e[5]!==c?(V=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=V):V=e[6];let A;e[7]!==i?(A=I=>i(I.target.value),e[7]=i,e[8]=A):A=e[8];let E;e[9]!==l||e[10]!==C||e[11]!==V||e[12]!==A?(E=o.jsx(mt,{id:l,type:"password",value:C,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:V,onChange:A,className:"h-10"}),e[9]=l,e[10]=C,e[11]=V,e[12]=A,e[13]=E):E=e[13];let R;return e[14]!==N||e[15]!==E?(R=o.jsxs("div",{className:"space-y-2",children:[N,E]}),e[14]=N,e[15]=E,e[16]=R):R=e[16],R}let d;e[17]!==n?(d=yu(n)?n:nle(),e[17]=n,e[18]=d):d=e[18];const f=d,u=typeof f.name=="string"?f.name:"",h=typeof f.encrypted=="string"&&f.encrypted,m=`${l}-name`,p=a?.virtualMcpId;let g;e[19]!==r||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=o.jsx(Hs,{htmlFor:m,label:r,description:s.description,virtualMcpId:p}),e[19]=r,e[20]=s.description,e[21]=m,e[22]=p,e[23]=g):g=e[23];const x=`${l}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let y;e[26]!==f||e[27]!==i?(y=C=>i({...f,name:C.target.value}),e[26]=f,e[27]=i,e[28]=y):y=e[28];let L;e[29]!==u||e[30]!==x||e[31]!==b||e[32]!==y?(L=o.jsx(mt,{id:x,value:u,placeholder:b,onChange:y,className:"h-10"}),e[29]=u,e[30]=x,e[31]=b,e[32]=y,e[33]=L):L=e[33];const v=`${l}-value`;let _;e[34]!==h||e[35]!==c?(_=c(h?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=h,e[35]=c,e[36]=_):_=e[36];let w;e[37]!==f||e[38]!==h||e[39]!==i?(w=C=>{const T=C.target.value;if(!T){i(h?ile(f):f);return}i({...f,value:T})},e[37]=f,e[38]=h,e[39]=i,e[40]=w):w=e[40];let S;e[41]!==_||e[42]!==w||e[43]!==v?(S=o.jsx(mt,{id:v,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:_,onChange:w,className:"h-10"}),e[41]=_,e[42]=w,e[43]=v,e[44]=S):S=e[44];let k;e[45]!==h||e[46]!==c?(k=h&&o.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=h,e[46]=c,e[47]=k):k=e[47];let j;return e[48]!==S||e[49]!==k||e[50]!==g||e[51]!==L?(j=o.jsxs("div",{className:"space-y-2",children:[g,L,S,k]}),e[48]=S,e[49]=k,e[50]=g,e[51]=L,e[52]=j):j=e[52],j}function rle(t,e){const s=t.anyOfRefs;if(!s?.length)return;const n=e.find(d=>d!=null&&typeof d=="object"&&!Array.isArray(d)),i=n?Object.keys(n).filter(d=>!d.startsWith("__")):[],r=[],l=d=>{d?.type==="object"&&d.properties&&r.push(d)};for(const d of s){const f=d.schema;if(f&&(f.type==="array"&&l(f.items),f.properties))for(const u of Object.values(f.properties))u?.type==="array"&&l(u.items)}if(r.length===0)return;if(i.length===0)return r.length===1?r[0]:void 0;let a,c=-1;for(const d of r){const f=d.properties??{},u=i.filter(h=>h in f).length*2+(d.titleBy?1:0);u>c&&(c=u,a=d)}return c>=2?a:void 0}function ole(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const s={};for(const[n,i]of Object.entries(e))n.startsWith("__")||(typeof i=="string"?s[n]={type:"string"}:typeof i=="number"?s[n]={type:"number"}:typeof i=="boolean"&&(s[n]={type:"boolean"}));return Object.keys(s).length>0?{type:"object",properties:s}:void 0}const lle=new Set(["__resolveType","@type"]);function ale(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return!1;const e=t.anyOfRefs[0].schema;return!!(e?.properties?.variants||!e&&t.plainSchema)}function cle(t){if(t1(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function Lv(t){if(t.type==="array"&&t.items)return t;const e=t.items??cle(t);return e?{...t,type:"array",items:e}:null}function dle(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function Ej(t){const{value:e,meta:s}=t;if(e===null||typeof e!="object"||Array.isArray(e))return null;const n=e.__resolveType;if(typeof n!="string"||!s)return null;const i=In(n,s);return i?o.jsx(Ii,{schema:i,value:e,onChange:t.onChange,basePath:t.path,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:s,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection,sandbox:t.sandbox},t.path):null}function na(t){const{schema:e,value:s}=t;if(Nh(s)){const l=Gte(s),a=Lv(e);if(l!==null&&a)return o.jsx(_f,{...t,schema:a,value:l,onChange:c=>t.onChange(Yte(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&t1(e)){const l=Lv(e);if(l)return o.jsx(_f,{...t,schema:l,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!Nh(s)&&e.type==="block-ref"){const l=rle(e,s)??ole(s);if(l){const a={...e,type:"array",items:l};return o.jsx(_f,{...t,schema:a,value:s,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||s!==null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.__resolveType=="string"&&e.anyOfRefs){if(ale(e)){const l=e.anyOfRefs[0],a=l.schema?.properties?.variants?.items?.properties?.value,c=a&&a.type!=="block-ref"?a:e.plainSchema??a?.plainSchema??{type:"string"},d=f=>na({...f,schema:c});return o.jsx(Pj,{...t,multivariateResolveType:l.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?o.jsx(fv,{...t},t.path):null}if(e.type==="inline-union")return o.jsx(Xre,{...t},t.path);if(e.format==="image-uri")return o.jsx($re,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return o.jsx(Ire,{...t},t.path);if(e.format==="map")return o.jsx(noe,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return o.jsx(dre,{...t},t.path);if(e.format==="location")return o.jsx(Lj,{...t},t.path);if(e.enum&&e.enum.length>0)return o.jsx(Gne,{...t},t.path);if(e.type==="anyOf")return o.jsx(fv,{...t},t.path);if(yu(s)||e.format==="password"||s==null&&e.format==="password")return o.jsx(om,{...t},t.path);if(!e.format&&!e.enum){const l=Ej(t);if(l)return l}const n=s??dle(e.type,e.default);if(n==null)return yu(s)?o.jsx(om,{...t},t.path):null;if(yu(n))return o.jsx(om,{...t,value:n},t.path);const i={...t,value:n},r=s==null?e.type??typeof n:Array.isArray(n)?"array":typeof n;if(r==="array"||Array.isArray(n))return o.jsx(_f,{...i},t.path);switch(r){case"boolean":return o.jsx(Une,{...i},t.path);case"number":case"integer":return o.jsx(Fne,{...i},t.path);case"string":{const l=e.format;return l==="color-input"||l==="color"?o.jsx(vf,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?o.jsx(vf,{...i},t.path):o.jsx(vf,{...i},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?o.jsx(Wie,{...i},t.path):null;default:return o.jsx(vf,{...i},t.path)}}function ule(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return na({...t,schema:e});const s=Ej(t);return s||na(e?{...t,schema:e}:t)}function Ii({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:f,onRequestAddSection:u,sandbox:h}){const m=re(),p=t.properties;if(!p)return t.type==="inline-union"?na({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:f,onRequestAddSection:u,sandbox:h}):null;if(qte(e)&&p.variants){const N=p.variants.items?.properties?.value;return o.jsx(Pj,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:f,onRequestAddSection:u,sandbox:h,multivariateResolveType:e.__resolveType,renderInnerField:V=>ule(V,N)},n)}const g=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},x=Object.keys(p).filter(N=>!lle.has(N)&&p[N]?.hidden!==!0),b=new Set(t.required??[]);if(x.length===0)return o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sectionsEditor.sectionsEditor.noEditableFields")});const y=(N,V)=>{if(V===void 0){const{[N]:A,...E}=g;s(E);return}s({...g,[N]:V})},L=typeof g.__resolveType=="string"?g.__resolveType:void 0,v=x.filter(N=>{const V=p[N];return V!=null&&Bc(V,g[N])}).length>1,_=kie(x,p,g),w=i.length>0?Cie(x,p,g,i,a,l):null,S=w?p[w]:null,k=w&&S?[w]:x,j=w&&S?Sie(w,S,i,qu(w,x,p)):i,C=wie(i,j),T=C.length>0&&r?N=>r([...C,...N]):r;return o.jsx("div",{className:"min-w-0 space-y-6",children:k.map(N=>{const V=p[N];if(!V)return null;const A=n?`${n}.${N}`:N,E=qu(N,x,p),R=sa(N,V),O=(C.length===0&&x.some(z=>{const M=p[z];return z!==N&&M!=null&&sa(z,M)===R})||C.length===0&&_.has(N))&&T?V.type==="block-ref"?z=>T(_ie(N,z)):z=>T(yie(E,z)):T;return na({schema:V,value:g[N],onChange:z=>y(N,z),path:A,label:E,required:b.has(N),breadcrumbPath:j,onBreadcrumbChange:O,hasSiblingDrillDownFields:v,focused:w===N,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:L,previewBaseUrl:d,onAddSectionItem:f,onRequestAddSection:u,sandbox:h})})})}function fle(t){const e=B.c(3),{isPending:s,isError:n}=t;if(n){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(pn,{size:13}),"Couldn't save"]}),e[0]=r):r=e[0],r}if(s){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(ot,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=r):r=e[1],r}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[o.jsx(Ft,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const wv=3e4;function hle(t,e,s,n){const i=new URL(`/deco/invoke/${e}`,t);return i.searchParams.set("__cb",n.toString(36)),i.searchParams.set("__decoFBT","0"),i.searchParams.set("__d",`run-${n.toString(36)}`),i.searchParams.set("props",btoa(encodeURIComponent(JSON.stringify(s)))),i.href}async function mle(t,{resolveType:e,props:s}){let n;try{n=await fetch(H_(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(wv)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${wv/1e3}s — the block may be slow or the preview unresponsive.`):a}const i=await n.text();let r=null,l=!1;try{r=i?JSON.parse(i):null,l=!0}catch{}if(!n.ok){const a=l&&r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"?r.error:i||`Run failed (${n.status})`;throw new Error(a)}return l?r:i}function ple(t){const e=B.c(2);let s;return e[0]!==t?(s={mutationFn:n=>mle(t,n)},e[0]=t,e[1]=s):s=e[1],Rs(s)}function Rj({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,kind:l,target:a,initialValue:c,isCreating:d,onCreate:f,onSaveReferencedBlock:u,onBack:h,showRun:m=!0}){const p=As()?.taskId??null,g=re(),x=oo(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,y=In(a.resolveType,i),L=!y&&MB(a.resolveType,i),v=L?OB(c):null,_=y??v,[w,S]=P.useState(c),[k,j]=P.useState([]),[C,T]=P.useState(0),[N,V]=P.useState(!1),[A,E]=P.useState(null),[R,I]=P.useState(!1),[D,O]=P.useState(!1),[z,M]=P.useState(!1),$=A!==null,{save:F,flush:U,isPending:H}=fx({orgSlug:t,virtualMcpId:e,branch:s}),q=ple({orgSlug:t,virtualMcpId:e,branch:s,threadId:p});P.useEffect(()=>()=>{U()},[]);const W=Ak(l),G=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,Y={orgSlug:t,virtualMcpId:e,branch:s,threadId:p,previewUrl:n??void 0,siteSlug:b},J=le=>{S(le),a.mode==="saved"&&F(a.blockKey,{__resolveType:a.resolveType,...le})},se=()=>{$?(E(null),V(!1),T(le=>le+1)):E(JSON.stringify(w,null,2))},oe=le=>{const ee=le??"";try{const ae=JSON.parse(ee);if(ae&&typeof ae=="object"&&!Array.isArray(ae)){V(!1),J(ae);return}V(!0)}catch{V(!0)}},ne=async le=>{const ee=kx(le,r);if(ee){xe.error(ee);return}await f(le,{__resolveType:a.resolveType,...w}),I(!1)},Q=()=>{O(!0),q.mutate({resolveType:a.resolveType,props:w})},K=()=>{n&&window.open(hle(n,a.resolveType,w,Date.now()),"_blank","noopener")},X=[a.title,...k],Z=le=>{j(k.slice(0,le)),T(ee=>ee+1)};return o.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[h&&o.jsx(ue,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:h,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:o.jsx(m9,{size:14})}),o.jsx("nav",{"aria-label":g("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:X.map((le,ee)=>{const ae=ee===X.length-1,ce=Sn(le);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ee>0&&o.jsx(en,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>Z(ee),title:ce,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ae?"font-medium text-foreground":"text-muted-foreground"),children:ce})]},`${ce}-${ee}`)})}),a.mode==="saved"&&o.jsx(fle,{isPending:H,isError:!1}),m&&o.jsxs(ue,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:Q,disabled:q.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:W}),children:[q.isPending?o.jsx(ot,{size:14,className:"animate-spin"}):o.jsx(Kl,{size:14}),g("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>I(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:W}),children:o.jsx(Z2,{size:14})})}),o.jsx(We,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:W})})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:$?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:se,"aria-label":g($?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":$,children:$?o.jsx(Ds,{size:14}):o.jsx(fa,{size:14})})}),o.jsx(We,{side:"bottom",children:g($?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:a.mode==="saved"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:W}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:G,singular:W})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("div",{className:ie("relative min-h-0 flex-1",D&&z&&"hidden"),children:[o.jsx(xl,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[v&&_===v&&o.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:g("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:W})}),_?o.jsx(Ii,{schema:_,value:w,onChange:le=>J(le),basePath:"",breadcrumbPath:k,onBreadcrumbChange:j,meta:i,decofile:r,onSaveReferencedBlock:u,sandbox:Y},C):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:L?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:W}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:W})})]})})}),A!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[N&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:g("sandbox.runnableBlockEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(md,{language:"json",height:"100%",code:A,onChange:oe,onSave:le=>{oe(le),U()}})})]})]}),D&&o.jsx(gle,{singular:W,result:{isPending:q.isPending,error:q.error,data:q.data,hasRun:q.status!=="idle"},expanded:z,onToggleExpand:()=>M(le=>!le),onOpenInNewTab:n?K:void 0,onClose:()=>{O(!1),M(!1)}})]}),o.jsx(jx,{open:R,onOpenChange:I,defaultBlockId:"",isPending:d,onSubmit:ne})]})}function gle(t){const e=B.c(54),{singular:s,result:n,expanded:i,onToggleExpand:r,onOpenInNewTab:l,onClose:a}=t,c=re();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const f=d,u=i?"flex-1":"h-[45%] shrink-0";let h;e[2]!==u?(h=ie("flex min-h-0 flex-col border-t",u),e[2]=u,e[3]=h):h=e[3];let m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:m}),e[6]=m,e[7]=p):p=e[7];let g;e[8]!==l||e[9]!==s||e[10]!==c?(g=l&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:o.jsx(hn,{size:14})})}),o.jsx(We,{side:"bottom",children:c("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:s})})]}),e[8]=l,e[9]=s,e[10]=c,e[11]=g):g=e[11];let x;e[12]!==i||e[13]!==c?(x=c(i?"sandbox.runnableBlockEditor.collapseResult":"sandbox.runnableBlockEditor.expandResult"),e[12]=i,e[13]=c,e[14]=x):x=e[14];let b;e[15]!==i?(b=i?o.jsx(VA,{size:14}):o.jsx(m8,{size:14}),e[15]=i,e[16]=b):b=e[16];let y;e[17]!==i||e[18]!==r||e[19]!==x||e[20]!==b?(y=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon",className:"size-7",onClick:r,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=r,e[19]=x,e[20]=b,e[21]=y):y=e[21];let L;e[22]!==i||e[23]!==c?(L=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=L):L=e[24];let v;e[25]!==L?(v=o.jsx(We,{side:"bottom",children:L}),e[25]=L,e[26]=v):v=e[26];let _;e[27]!==v||e[28]!==y?(_=o.jsxs(qe,{children:[y,v]}),e[27]=v,e[28]=y,e[29]=_):_=e[29];let w;e[30]!==c?(w=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=w):w=e[31];let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Ds,{size:14}),e[32]=S):S=e[32];let k;e[33]!==a||e[34]!==w?(k=o.jsx(ue,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":w,children:S}),e[33]=a,e[34]=w,e[35]=k):k=e[35];let j;e[36]!==_||e[37]!==k||e[38]!==g?(j=o.jsxs("div",{className:"flex items-center gap-0.5",children:[g,_,k]}),e[36]=_,e[37]=k,e[38]=g,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==p?(C=o.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[p,j]}),e[40]=j,e[41]=p,e[42]=C):C=e[42];let T;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==f||e[47]!==s||e[48]!==c?(T=o.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?o.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[o.jsx(ot,{size:16,className:"animate-spin"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?o.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[o.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),o.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?o.jsx(md,{language:"json",height:"100%",code:f,readOnly:!0}):o.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:c("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:s})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=f,e[47]=s,e[48]=c,e[49]=T):T=e[49];let N;return e[50]!==C||e[51]!==T||e[52]!==h?(N=o.jsxs("div",{className:h,children:[C,T]}),e[50]=C,e[51]=T,e[52]=h,e[53]=N):N=e[53],N}function xle(t){const e=B.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,blockKey:c}=t,d=re();let f;e[0]!==i||e[1]!==s||e[2]!==n?(f={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=f):f=e[3];const u=V0(f);let h;e[4]!==u?(h=bx((_,w)=>u.mutate({blockKey:_,data:w})),e[4]=u,e[5]=h):h=e[5];const m=h;let p;e[6]!==c||e[7]!==a?(p=Ik(a,c),e[6]=c,e[7]=a,e[8]=p):p=e[8];const{resolveType:g,props:x,title:b}=p;if(!g){let _;e[9]!==d?(_=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=_):_=e[10];let w;return e[11]!==_?(w=o.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:_}),e[11]=_,e[12]=w):w=e[12],w}const y=`loader:${c}`;let L;e[13]!==c||e[14]!==g||e[15]!==b?(L={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=L):L=e[16];let v;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==r||e[22]!==x||e[23]!==u.isPending||e[24]!==m||e[25]!==y||e[26]!==L||e[27]!==n?(v=o.jsx(Rj,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:"loaders",target:L,initialValue:x,isCreating:u.isPending,onCreate:ble,onSaveReferencedBlock:m,showRun:!1},y),e[17]=i,e[18]=a,e[19]=l,e[20]=s,e[21]=r,e[22]=x,e[23]=u.isPending,e[24]=m,e[25]=y,e[26]=L,e[27]=n,e[28]=v):v=e[28],v}async function ble(){}const vle="https://github.com/decocms/blocks";function yle(){const t=B.c(14),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(AA,{size:48,className:"text-muted-foreground"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("mainPanelTabs.blocksTabStates.emptyStateTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==e?(i=e("mainPanelTabs.blocksTabStates.emptyStateDescription"),t[3]=e,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=r):r=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(hn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==r?(a=o.jsx(ue,{size:"sm",asChild:!0,children:o.jsxs("a",{href:vle,target:"_blank",rel:"noreferrer",children:[r,l]})}),t[8]=r,t[9]=a):a=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==a?(c=o.jsx(Qo,{className:"h-full w-full",image:s,title:n,description:i,actions:a}),t[10]=n,t[11]=i,t[12]=a,t[13]=c):c=t[13],c}function _le(t){const e=B.c(15),{source:s,onRetry:n}=t,i=re();let r;e[0]!==s||e[1]!==i?(r=i(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=i,e[2]=r):r=e[2];const l=r;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(pn,{size:48,className:"text-muted-foreground"}),e[3]=a):a=e[3];let c;e[4]!==i?(c=i("mainPanelTabs.blocksTabStates.errorStateTitle"),e[4]=i,e[5]=c):c=e[5];let d;e[6]!==i?(d=i("mainPanelTabs.blocksTabStates.retry"),e[6]=i,e[7]=d):d=e[7];let f;e[8]!==n||e[9]!==d?(f=o.jsx(ue,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=f):f=e[10];let u;return e[11]!==l||e[12]!==c||e[13]!==f?(u=o.jsx(Qo,{image:a,title:c,description:l,actions:f}),e[11]=l,e[12]=c,e[13]=f,e[14]=u):u=e[14],u}function cr(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:o.jsx(ot,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const Lle=P.lazy(()=>xn(()=>import("./sections-editor-Dp1jPPnU.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])).then(t=>({default:t.SectionsEditor})));function Sv(t){const e=B.c(48),{virtualMcpId:s,externalSelection:n,onViewJsonFile:i}=t,r=n===void 0?null:n,{org:l}=Fe(),{currentBranch:a,taskId:c}=sn(),d=Jn(),f=vl(),u=$k(),h=d.lifecycle.phase==="running",m=f.previewUrl;let p;e[0]!==a||e[1]!==l||e[2]!==m||e[3]!==c||e[4]!==s?(p=a?{orgSlug:l.slug,virtualMcpId:s,branch:a,threadId:c??null,previewUrl:m}:null,e[0]=a,e[1]=l,e[2]=m,e[3]=c,e[4]=s,e[5]=p):p=e[5];const g=p;let x;e[6]!==h?(x={fetchEnabled:h},e[6]=h,e[7]=x):x=e[7];const b=y0(g,x);let y;e[8]!==h?(y={fetchEnabled:h},e[8]=h,e[9]=y):y=e[9];const L=A9(g,y),v=ck({lifecyclePhase:d.lifecycle.phase,decofile:jh(b),meta:jh(L),hasEditableContent:R9(b.data,L.data),fastPreviewActive:Tn(s).runtime==="cms"});if(v.kind==="loading"){let D;return e[10]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx(cr,{}),e[10]=D):D=e[10],D}if(v.kind==="empty"){let D;return e[11]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx(yle,{}),e[11]=D):D=e[11],D}if(v.kind==="error"){let D;e[12]!==b||e[13]!==f||e[14]!==L||e[15]!==v.source?(D=()=>{if(v.source==="sandbox"){f.retry();return}Promise.all([b.refetch(),L.refetch()])},e[12]=b,e[13]=f,e[14]=L,e[15]=v.source,e[16]=D):D=e[16];const O=D;let z;return e[17]!==O||e[18]!==v.source?(z=o.jsx(_le,{source:v.source,onRetry:O}),e[17]=O,e[18]=v.source,e[19]=z):z=e[19],z}const _=u.state.target;if(_?.kind==="loader"&&b.data&&L.data){const D=a??"",O=m??null;let z;return e[20]!==b.data||e[21]!==L.data||e[22]!==l.slug||e[23]!==D||e[24]!==O||e[25]!==_.key||e[26]!==s?(z=o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:o.jsx(xle,{orgSlug:l.slug,virtualMcpId:s,branch:D,previewUrl:O,meta:L.data,decofile:b.data,blockKey:_.key})}),e[20]=b.data,e[21]=L.data,e[22]=l.slug,e[23]=D,e[24]=O,e[25]=_.key,e[26]=s,e[27]=z):z=e[27],z}let w;e[28]!==a||e[29]!==l.slug||e[30]!==_||e[31]!==s?(w=_||!a?null:px(mx(l.slug,s,a)),e[28]=a,e[29]=l.slug,e[30]=_,e[31]=s,e[32]=w):w=e[32];const S=w;let k="/",j=null,C=null;_?.kind==="page"?(k=_.path,j=_.key):_?.kind==="section"?C=_.key:S&&(k=S.path,j=S.pageKey);const T=j?`page:${j}`:C?`section:${C}`:`path:${k}`;let N;e[33]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(ot,{size:20,className:"animate-spin text-muted-foreground"})}),e[33]=N):N=e[33];const V=a??"",A=m??void 0,E=C?null:r,R=!!j&&u.state.editSeoPageKey===j;let I;return e[34]!==C||e[35]!==j||e[36]!==k||e[37]!==T||e[38]!==i||e[39]!==l.slug||e[40]!==R||e[41]!==V||e[42]!==A||e[43]!==E||e[44]!==s||e[45]!==u.consumeEditSeo||e[46]!==u.setVariantOverride?(I=o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:o.jsx(P.Suspense,{fallback:N,children:o.jsx(Lle,{orgSlug:l.slug,virtualMcpId:s,branch:V,previewReady:!0,previewUrl:A,currentPath:k,activePageBlockKey:j,activeGlobalBlockKey:C,externalSelection:E,initialEditSeo:R,onExitSeo:u.consumeEditSeo,onVariantPreviewOverride:u.setVariantOverride,onViewJsonFile:i},T)})}),e[34]=C,e[35]=j,e[36]=k,e[37]=T,e[38]=i,e[39]=l.slug,e[40]=R,e[41]=V,e[42]=A,e[43]=E,e[44]=s,e[45]=u.consumeEditSeo,e[46]=u.setVariantOverride,e[47]=I):I=e[47],I}function kv(t){const e=B.c(44),{virtualMcpId:s,pageKey:n,onClose:i,ref:r}=t,l=re(),{org:a}=Fe(),{currentBranch:c,taskId:d}=sn(),u=vl().previewUrl;let h;e[0]!==c||e[1]!==a.slug||e[2]!==u||e[3]!==d||e[4]!==s?(h=c?{orgSlug:a.slug,virtualMcpId:s,branch:c,threadId:d??null,previewUrl:u}:null,e[0]=c,e[1]=a.slug,e[2]=u,e[3]=d,e[4]=s,e[5]=h):h=e[5];const p=y0(h),g=c??"";let x;e[6]!==a.slug||e[7]!==g||e[8]!==s?(x={orgSlug:a.slug,virtualMcpId:s,branch:g},e[6]=a.slug,e[7]=g,e[8]=s,e[9]=x):x=e[9];const{save:b,flush:y}=fx(x),L=p.data?.[n],v=p.data===void 0&&p.isLoading,_=p.data!==void 0&&L===void 0,w=!c||_||v;let S;e[10]!==L?(S=L===void 0?"":JSON.stringify(L,null,2),e[10]=L,e[11]=S):S=e[11];const k=S;let j;e[12]!==n||e[13]!==w||e[14]!==b?(j=z=>{if(w)return;let M;try{M=JSON.parse(z)}catch{return}M===null||typeof M!="object"||Array.isArray(M)||b(n,M)},e[12]=n,e[13]=w,e[14]=b,e[15]=j):j=e[15];const C=j;let T;e[16]!==y?(T=()=>({flush:y}),e[16]=y,e[17]=T):T=e[17],P.useImperativeHandle(r,T);let N;e[18]!==l?(N=l("sectionsEditor.pageJsonDialog.titleShort"),e[18]=l,e[19]=N):N=e[19];let V;e[20]!==N?(V=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:N}),e[20]=N,e[21]=V):V=e[21];let A;e[22]!==l?(A=l("sectionsEditor.pageJsonDialog.close"),e[22]=l,e[23]=A):A=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Ds,{size:14}),e[24]=E):E=e[24];let R;e[25]!==i||e[26]!==A?(R=o.jsx(ue,{variant:"ghost",size:"icon",onClick:i,"aria-label":A,className:"size-7 shrink-0",children:E}),e[25]=i,e[26]=A,e[27]=R):R=e[27];let I;e[28]!==R||e[29]!==V?(I=o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[V,R]}),e[28]=R,e[29]=V,e[30]=I):I=e[30];let D;e[31]!==p.data||e[32]!==y||e[33]!==k||e[34]!==v||e[35]!==_||e[36]!==n||e[37]!==w||e[38]!==C||e[39]!==l?(D=v?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(ot,{size:20,className:"animate-spin text-muted-foreground"})}):_?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",l("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(md,{code:k,language:"json",readOnly:w,height:"100%",onChange:z=>C(z??""),onSave:z=>{C(z),y()}},`${n}:${p.data===void 0?"loading":"ready"}`)}),e[31]=p.data,e[32]=y,e[33]=k,e[34]=v,e[35]=_,e[36]=n,e[37]=w,e[38]=C,e[39]=l,e[40]=D):D=e[40];let O;return e[41]!==I||e[42]!==D?(O=o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[I,D]}),e[41]=I,e[42]=D,e[43]=O):O=e[43],O}function wle(t,e){return t===e?"preview":e}function Sle(t){return t.autoOpen&&t.blocksReady&&!t.autoOpenResolved&&t.editingMode==="preview"}const kle=500,jle={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},jv=1,lm=["desktop","mobile","tablet"],Cv={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function Nv(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function Cle(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 wf(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function am(t,e){try{return new URL(t,e).href}catch{return null}}function Nle(t,e,s){const n=t.toLowerCase(),i=e.toLowerCase(),r=i.split("/").filter(Boolean),l=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let f=40;return d===0?f+=30:/[\s/-]/.test(c[d-1]??"")&&(f+=20),f+=Math.round(s.length/c.length*20),f};let a=Math.max(l(n),l(i));return r.at(-1)===s?a=Math.max(a,95):r.includes(s)&&(a=Math.max(a,90)),a}function Tle(t){const{onOpen:e}=t,[s,n]=P.useState(!1);return s||(n(!0),queueMicrotask(e)),null}function Vle(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function Ale({virtualMcpId:t}){const e=re(),s=dd(),n=fl(),i=fte(),{openPanel:r}=hi(),{currentBranch:l,taskId:a}=sn(),c=$k(),d=be=>r(be),[f,u]=P.useState("preview"),[h,m]=P.useState(!1),[p,g]=P.useState("desktop"),[x,b]=P.useState(null),[y,L]=P.useState(null),v=P.useRef(null),_=P.useRef(null),[w,S]=P.useState(!1),k=P.useRef(null),j=()=>{k.current?.flush(),S(!1)},C=()=>S(be=>(be&&k.current?.flush(),!be)),[T,N]=P.useState({width:0,height:0}),[V,A]=P.useState(null),[E,R]=P.useState(!1),[I,D]=P.useState(""),O=P.useRef(null),[z,M]=P.useState(!1),[$,F]=P.useState(),[U,H]=P.useState(null),[q,W]=P.useState(null),[G,Y]=P.useState(null),[J,se]=P.useState("/"),[oe,ne]=P.useState(null),[Q,K]=P.useState({}),[X,Z]=P.useState(!1),le=P.useRef(null),ee=()=>{Z(!0),le.current&&clearTimeout(le.current),le.current=setTimeout(()=>Z(!1),15e3)},ae=()=>{le.current&&(clearTimeout(le.current),le.current=null),Z(!1)},{org:ce}=Fe(),fe=Jn(),de=vl(),pe=de.vmEntry,te=de.previewUrl,ge=fe.lifecycle.phase,ve=ge==="running",Se=s;Mk({orgSlug:ce.slug,virtualMcpId:t??"",branch:l??"",threadId:a??null,enabled:Se});const ye=null,ke=oo(),we=ke?.entity?.id===t?Y2(ke.entity.metadata):null,je=Tn(t),me=ke?.entity?.id===t&&je.runtime==="cms",Ce=je.projectDefault==="cms",Ne=jte({sandboxUrl:te,previewServerUrl:we,fastPreviewActive:me}),Ie=t&&l?{orgSlug:ce.slug,virtualMcpId:t,branch:l,threadId:a??null,previewUrl:te}:null,et=y0(Ie,{fetchEnabled:ve}),Ze=A9(Ie,{fetchEnabled:ve}),Te=et.data,Me=Ze.data,rt=`${t}:${l??""}`,[nt,it]=P.useState(null),ut=ck({lifecyclePhase:ge,decofile:jh(et),meta:jh(Ze),hasEditableContent:R9(Te,Me),fastPreviewActive:me,frameworkKnownMissing:nt===rt});ut.kind==="empty"&&ut.reason==="framework-missing"&&nt!==rt&&it(rt);const Ct=ut.kind==="content",ct=t&&l?{orgSlug:ce.slug,virtualMcpId:t,branch:l}:null,lt=Pte(ct),Oe=Te?dh(Te).sort((be,Pe)=>be.name.localeCompare(Pe.name)):[],vt=Te&&Me?L3(Te,Me):[],_e=Te&&Me?Dk(Me,Te,"loaders"):[],Ue=qo,st=I?(()=>{const be=I.toLowerCase();return Oe.map(Pe=>({page:Pe,score:Nle(Pe.name,Pe.path,be)})).filter(({score:Pe})=>Pe>0).sort((Pe,at)=>at.score-Pe.score||Pe.page.path.length-at.page.path.length).map(({page:Pe})=>Pe)})():Oe,gt=vt.filter(be=>{if(!I)return!0;const Pe=I.toLowerCase();return be.name.toLowerCase().includes(Pe)||be.key.toLowerCase().includes(Pe)||be.resolveType.toLowerCase().includes(Pe)}),pt=_e.filter(be=>{if(!I)return!0;const Pe=I.toLowerCase();return be.title.toLowerCase().includes(Pe)||be.key.toLowerCase().includes(Pe)||be.resolveType.toLowerCase().includes(Pe)}),Vt=q?_e.find(be=>be.key===q)??null:null,bt=U||q?null:rp(Oe,J,oe),_t=U?U.name:Vt?.title??bt?.name,tt=bt?.key??null,ft=bt?.path??null,xt=(tt?Q[tt]:void 0)??{},Ee=Br(J,xt),dt={};if(ve&&te&&Me&&Te){const be=rne(Me,"loaders"),Pe=tt?Te[tt]:void 0,at=Tse(Pe,Te,as=>be.has(as)),yt=Sse(at);for(const as of oh(J)){if(as.type!=="param")continue;const dn=_se(J,as.name,at),qs=Cse(dn,be,yt);qs.length>0&&(dt[as.name]=qs)}}const he=t&&l?{orgSlug:ce.slug,virtualMcpId:t,branch:l,threadId:a??null}:null,Ae=Te&&tt?yk(Te,tt,0):[],He=Te?pk(Ae,Te):[],Le=He.map(be=>be.isSavedBlock?be.label:""),De=He.map(be=>be.isSavedBlock?"global":be.isMultivariate?"variant":"normal"),Qe=Ae.map(be=>Rp(be,Te??{})),Be=P.useRef(null),Lt=P.useRef(null),qt=fe.status.state==="paused",lo=fe.phase,Sa=Sk({claimPhase:lo,lifecycle:fe.lifecycle}),It=de.previewState,ao=de.userStopped,yr=m0(ke?.entity?.id===t?ke.entity.metadata?.ui?.layout??null:null),co=dx(ce.slug,t??"",l??""),{url:cn}=fk(me&&t&&l?{orgSlug:ce.slug,virtualMcpId:t,branch:l,previewServerUrl:we??null,path:Ee}:null),uo=Ce&&je.runtime==="sandbox",wt=ete({previewState:It,progressStatus:Sa.status,previewServerUrl:we,fastPreviewActive:me,fastPreviewReady:!!cn,codingSession:uo}),Qn=wt.mode!=="none",_r=wt.mode==="production"&&wt.iframeBase?wf(wt.iframeBase):null,fo=!s,Xn=wt.mode==="production"?_r:wf(te),ho=ke?.entity?.id===t&&ke.entity.metadata?.fastPreviewInPlace===!0,bn=wt.mode==="production"&&me&&ho&&f==="blocks",Lr=P.useRef(null);bn||(Lr.current=cn);const Mi=Lr.current,mo=bn?Mi??cn:cn,$s=Cle(wt.mode==="sandbox"?hf(Nv(G??am(Ee,wt.iframeBase)??wt.iframeBase,p),c.state.variantOverride??[]):wt.mode==="production"&&fo?hf(Nv(uk(G??mo??am(Ee,wt.iframeBase)??wt.iframeBase,wt.showWakingPill?Ste:null),p),c.state.variantOverride??[]):null);P.useEffect(()=>{},[s,_r,V]);const wr="sandbox.preview.openInNewTab",ka=cn??(wt.iframeBase?am(Ee,wt.iframeBase):null),po=wt.mode==="production"?ka?hf(ka,c.state.variantOverride??[]):null:$s??wt.iframeBase,go=async()=>{const be=po;if(be){window.open(be,"_blank","noopener");return}},Sr=t&&l?mx(ce.slug,t,l):null,pi=be=>{Sr&&bse(Sr,be)},gs=c.state.target;P.useEffect(()=>{if(!(!gs||!Ne||!Me))if(gs.kind==="page"){const be=Q[gs.key]??{};Lt.current=Br(gs.path,be),H(null),W(null),Y(null),ne(gs.key),se(gs.path),pi({path:gs.path,pageKey:gs.key,params:be})}else if(gs.kind==="loader")Lt.current=null,H(null),W(gs.key),Y(null);else{const be=vt.find(Pe=>Pe.key===gs.key);if(be){Lt.current=null;const Pe=lh(Me);W(null),H(be),Y(Kb(Ne,Pe,be.key))}}},[gs,Ne,Me,Q]),P.useEffect(()=>{!tt||ft===null||gs?.kind==="page"&&gs.key===tt&&gs.path===ft||c.selectTarget({kind:"page",key:tt,path:ft})},[tt,ft,gs]);const[ja,xo]=P.useState(null);if(It.kind==="iframe"&&ja!==It.previewUrl){const be=ja!==null;xo(It.previewUrl);const Pe=Sr?px(Sr):null;if(Pe){if(Lt.current=Br(Pe.path,Pe.params),se(Pe.path),ne(Pe.pageKey),Y(null),H(null),W(null),Pe.pageKey&&Object.keys(Pe.params).length>0){const at=Pe.pageKey;K(yt=>({...yt,[at]:Pe.params}))}}else be&&(Lt.current=null,se("/"),Y(null),ne(null),H(null),W(null))}Be.current=$s;const kr=ite({iframeRef:v,src:wt.mode==="sandbox"?$s:null,active:wt.mode==="sandbox"}),jr=P.useRef(null);P.useEffect(()=>{if(!cn||!$s||jr.current===cn)return;jr.current=cn;const be=v.current;be&&be.getAttribute("src")!==$s&&(ee(),be.src=$s)},[cn,$s]);const Cr=()=>{const be=v.current?.contentWindow,Pe=Xn;if(!be||!Pe||!Te||!tt)return;const at=Te[tt];if(!at||typeof at!="object")return;const yt=kte({previewBaseUrl:Pe,pageBlock:at,decofile:Te,path:Ee,pathTemplate:J});if(!yt)return;const as=hf(yt.src,c.state.variantOverride??[]);be.postMessage({type:"cms-editor::render",src:as,body:yt.body},Pe)},gi=P.useRef(null);P.useEffect(()=>{if(!bn||U||q||!tt||!Te){gi.current=null;return}const be=JSON.stringify(Te);if(gi.current===be)return;const Pe=gi.current===null;gi.current=be,!Pe&&Cr()},[Te,bn,U,q,tt,Ee,J]);const Oi=P.useRef(null);P.useEffect(()=>{if(!bn||U||q||!tt||!Te){Oi.current=null;return}const be=JSON.stringify(c.state.variantOverride??null),Pe=Oi.current;Oi.current={page:tt,sig:be},!(!Pe||Pe.page!==tt||Pe.sig===be)&&Cr()},[c.state.variantOverride,bn,U,q,tt]);const bo=!!t&&!!l&&!fe.notFound&&!ao&&!qt&&(lo?.kind==="ready"||ge!=="idle"),vn=wt.mode!=="sandbox"&&f==="visual"?"preview":f;P.useEffect(()=>{const be=Xn;if(!be)return;const Pe=at=>{if(at.origin===be)if(at.data?.type==="visual-editor::element-clicked"){const yt=Dte.safeParse(at.data.payload);yt.success&&b(yt.data)}else if(at.data?.type==="cms-editor::section-clicked"){const yt=Ote.safeParse(at.data.payload);yt.success&&L({index:yt.data.sectionIndex,seq:yt.data.clickSeq})}else at.data?.type==="cms-editor::render-start"?ee():(at.data?.type==="cms-editor::render-end"||at.data?.type==="cms-editor::render-error")&&ae()};return window.addEventListener("message",Pe),()=>window.removeEventListener("message",Pe)},[Xn]),P.useEffect(()=>{if(!E)return;const be=Pe=>{O.current?.contains(Pe.target)||(R(!1),D(""))};return document.addEventListener("pointerdown",be),()=>document.removeEventListener("pointerdown",be)},[E]);const Nr=()=>{const be=v.current?.contentWindow,Pe=wf(te);!be||!Pe||be.postMessage({type:"visual-editor::activate",script:Ite},Pe)},m1=()=>{const be=v.current?.contentWindow,Pe=wf(te);!be||!Pe||be.postMessage({type:"visual-editor::deactivate"},Pe)},$i=()=>{const be=v.current?.contentWindow,Pe=Xn;!be||!Pe||(be.postMessage(wt.mode==="production"?{type:"editor::inject",args:{script:Gb}}:{type:"visual-editor::activate",script:Gb},Pe),be.postMessage({type:"cms-editor::set-labels",labels:Le,kinds:De,keys:Qe},Pe))},Nd=()=>{const be=v.current?.contentWindow,Pe=Xn;!be||!Pe||be.postMessage({type:"cms-editor::deactivate"},Pe)},Zn=be=>{const Pe=f;!n&&be!==Pe&&(be==="blocks"?_.current?.resize("30%"):_.current?.collapse()),be!=="blocks"&&j(),u(be),b(null),L(null),be!=="blocks"&&W(null),Pe==="visual"&&m1(),be==="visual"&&Nr(),Pe==="blocks"&&be!=="blocks"&&Nd(),be==="blocks"&&$i()},Tr=be=>{m(!0),Zn(wle(f,be))},vo=Sle({autoOpen:yr==="auto",blocksReady:Ct,autoOpenResolved:h,editingMode:f}),yo=()=>{m(!0),Zn("blocks")},_o=()=>{if(!v.current||!$s)return;ee();const be=v.current;be.src=$s};cz(()=>{const be=v.current;if(!be)return;ee();const Pe=document.activeElement,at=be.tabIndex;be.tabIndex=-1,be.style.pointerEvents="none",be.blur(),Vle(be,Be.current);let yt;const as=()=>{clearTimeout(yt),be.tabIndex=at,be.style.pointerEvents="";const dn=document.activeElement;(!dn||dn===document.body||dn===be)&&Pe?.focus(),be.removeEventListener("load",as)};be.addEventListener("load",as),yt=setTimeout(as,3e3)});const Lo=()=>{const be=lm.indexOf(p);g(lm[(be+1)%lm.length])},wo=async()=>{let be=null;try{be=v.current?.contentWindow?.location?.href??null}catch{}const Pe=be??$s??te;if(Pe)try{await navigator.clipboard.writeText(Pe),xe.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{xe.error(e("sandbox.preview.failedToCopyUrl"))}},So=rte({iframeBase:wt.iframeBase,resolvedPath:Ee,activeGlobalSectionName:U?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Sl=be=>{const Pe=Q[be.key]??{},at=Br(be.path,Pe);(U||Ue(at)!==Ue(Ee))&&ee(),Lt.current=at,H(null),W(null),Y(null),L(null),ne(be.key),se(be.path),pi({path:be.path,pageKey:be.key,params:Pe}),c.selectTarget({kind:"page",key:be.key,path:be.path})},Bi=(be,Pe)=>{if(!tt)return;const at=tt,yt={...xt,[be]:Pe};Lt.current=Br(J,yt),K(as=>({...as,[at]:yt})),pi({path:J,pageKey:at,params:yt})},Td=be=>{if(!Ne||!Me){xe.error(e("sandbox.preview.previewMetadataNotReady"));return}ee(),Lt.current=null;const Pe=lh(Me),at=Kb(Ne,Pe,be.key);H(be),W(null),Y(at),L(null),c.selectTarget({kind:"section",key:be.key})},Ca=be=>{H(null),W(be.key),Y(null),Zn("blocks"),c.selectTarget({kind:"loader",key:be.key})},Vd=async({name:be,path:Pe,templateKey:at})=>{if(!t||!l)return;const yt=v3(Pe);if(yt){F(yt);return}const as=Pe.trim().startsWith("/")?Pe.trim():`/${Pe.trim()}`;if(Oe.some(qs=>Ue(qs.path)===Ue(as))){F(e("sandbox.preview.pageAlreadyExists",{path:as}));return}let dn;if(at&&(dn=Te?.[at],!dn)){F(e("sandbox.preview.templateNoLongerExists"));return}F(void 0);try{const qs=await lt.mutateAsync({name:be,path:as,template:dn});M(!1),xe.success(e("sandbox.preview.pageCreated",{name:be})),await hd(kle),Sl({key:qs.key,name:qs.name,path:qs.path}),Zn("blocks")}catch(qs){F(qs instanceof Error?qs.message:e("sandbox.preview.failedToCreatePage"))}},zi=Qn&&(bo||wt.mode==="production"),Vr=f==="blocks",Ar=$te({showPreviewToolbar:zi,blocksState:ut}),Fi=Ar&&yr!=="off"?o.jsx(ik,{title:e("sandbox.preview.cms"),tooltip:e(Vr?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),labelCollapse:"sooner",icon:{kind:"component",Component:PA},active:Vr,onClick:()=>Tr("blocks"),testId:"preview-blocks-toggle",dataTour:Go.edit}):null,Pr=zi?o.jsxs(o.Fragment,{children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Bo,{onClick:_o,"aria-label":e("sandbox.preview.refresh"),children:o.jsx(Dn,{size:16})})}),o.jsx(We,{side:"bottom",children:e("sandbox.preview.refresh")})]}),Ar&&o.jsxs("div",{ref:O,className:"relative min-w-0 w-64 shrink",children:[o.jsxs("div",{className:"flex h-7 w-full min-w-0 items-center rounded-md border border-border bg-background transition-colors duration-200 hover:bg-accent",children:[o.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>R(be=>!be),children:[U&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[o.jsx(Hl,{size:11}),"Global"]}),Vt&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[o.jsx(Hc,{size:11}),e("sandbox.preview.loaderBadge")]}),o.jsx("span",{className:ie("text-[13px] font-medium text-foreground",_t==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:_t??So}),!U&&!q&&_t!=null&&J&&o.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:oh(J).map((be,Pe)=>{if(be.type==="text")return o.jsx("span",{className:ie(Pe===0?"min-w-0 truncate":"shrink-0"),children:be.text},`text-${Pe}`);const at=dt[be.name];return at&&he?o.jsx(Hse,{sources:at,template:J,paramName:be.name,value:xt[be.name]??"",sandboxRef:he,onCommit:yt=>Bi(be.name,yt)},`${tt}:${be.name}`):o.jsx(tne,{name:be.name,value:xt[be.name]??"",onCommit:yt=>Bi(be.name,yt)},`${tt}:${be.name}`)})})]}),o.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>R(be=>!be),"aria-label":e("sandbox.preview.choosePage"),children:o.jsx(Qt,{size:12,className:ie("shrink-0 text-muted-foreground transition-transform",E&&"rotate-180")})})]}),E&&o.jsxs("div",{className:"absolute left-1/2 top-full z-50 mt-1.5 w-[500px] max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[o.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[o.jsx(k9,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("input",{type:"text",value:I,onChange:be=>D(be.target.value),onKeyDown:be=>{if(be.key!=="Enter")return;const Pe=I.trim();if(!Pe)return;const at=st.find(yt=>Ue(yt.path)===Ue(Pe));at&&(be.preventDefault(),R(!1),D(""),Sl(at))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),o.jsx("div",{className:"p-1.5 border-b",children:o.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:be=>{be.preventDefault(),R(!1),D(""),F(void 0),M(!0)},children:[o.jsx(Kt,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),st.length===0&&gt.length===0&&pt.length===0?o.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Oe.length===0&&vt.length===0&&_e.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):o.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[st.length>0&&o.jsx("div",{className:"p-1.5",children:st.map(be=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Pe=>{Pe.preventDefault(),R(!1),D(""),Sl(be)},children:[o.jsx(Ko,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.path})]},be.key))}),gt.length>0&&o.jsxs("div",{className:ie("p-1.5",st.length>0&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),gt.map(be=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Pe=>{Pe.preventDefault(),R(!1),D(""),Td(be)},children:[o.jsx(Hl,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},be.key))]}),pt.length>0&&o.jsxs("div",{className:ie("p-1.5",(st.length>0||gt.length>0)&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalLoaders")}),pt.map(be=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Pe=>{Pe.preventDefault(),R(!1),D(""),Ca(be)},children:[o.jsx(Hc,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.title}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},be.key))]})]})]})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Bo,{"aria-label":e(wr),onClick:()=>{go()},children:o.jsx(hn,{size:16})})}),o.jsx(We,{side:"bottom",children:e(wr)})]})]}):null,ko=zi?o.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[Fi,Fi&&o.jsx("div",{className:"mx-0.5 h-5 w-px shrink-0 bg-border"}),Pr]}):null,Ui=zi?o.jsx("div",{className:"flex shrink-0 items-center",children:o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":e("sandbox.preview.moreOptions"),children:o.jsx(qn,{size:14})})}),o.jsxs(zt,{align:"end",className:"w-44",children:[o.jsxs(Xe,{onClick:wo,children:[o.jsx(an,{size:14}),e("sandbox.preview.copyCurrentUrl")]}),Te&&Me&&o.jsxs(o.Fragment,{children:[o.jsx(qr,{}),tt&&o.jsxs(Xe,{onClick:()=>{c.editSeo({kind:"page",key:tt,path:J}),Zn("blocks")},children:[o.jsx(ng,{size:14}),e("sandbox.preview.editSeo")]}),tt&&o.jsxs(Xe,{onClick:()=>{try{d(fT(vB(tt)))}catch{xe.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[o.jsx(fa,{size:14}),e("sandbox.preview.viewJson")]})]}),ye,o.jsx(qr,{}),o.jsxs(Xe,{onClick:()=>Qee(e),children:[o.jsx(EA,{size:14}),e("cmsTour.menuItem")]})]})]})}):null,Ad=wt.mode==="sandbox",jo=jle[p],xi=p==="desktop"&&(T.width===0||T.width>=jo.width+2*jv),Er=xi?1:Math.min(T.width>0?T.width/(jo.width+2*jv):1,1),Co=xi?{width:"100%",height:"100%"}:{width:`${jo.width}px`,height:T.height>0?`${T.height/Er}px`:`${jo.height}px`,transform:`scale(${Er})`,transformOrigin:"top center"},Rr=Qn?o.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:o.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[Ad&&o.jsxs(o.Fragment,{children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Bo,{onClick:()=>Tr("visual"),"aria-pressed":f==="visual","aria-label":e("sandbox.preview.visualEditor"),active:f==="visual",className:"rounded-full","data-tour":Go.visualEditor,children:o.jsx(f4,{size:16})})}),o.jsx(We,{side:"top",children:e("sandbox.preview.visualEditor")})]}),o.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Bo,{onClick:Lo,"aria-label":e(Cv[p]),className:"rounded-full","data-tour":Go.device,children:o.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[p==="mobile"&&o.jsx(RA,{size:16}),p==="tablet"&&o.jsx(DA,{size:16}),p==="desktop"&&o.jsx(IA,{size:16})]},p)})}),o.jsx(We,{side:"top",children:e(Cv[p])})]})]})}):null,No=(n||!!q)&&vn==="blocks";return o.jsxs("div",{className:"flex flex-col w-full h-full",children:[vo&&o.jsx(Tle,{onOpen:yo}),he&&Object.entries(dt).map(([be,Pe])=>(xt[be]??"")===""?o.jsx(Zse,{sources:Pe,template:J,paramName:be,sandboxRef:he,onFill:at=>Bi(be,at)},`${tt}:${be}`):null),i?o.jsxs(o.Fragment,{children:[zi&&o.jsx(dte,{children:ko}),o.jsx(ute,{children:Ui})]}):(zi||Ui)&&o.jsxs("div",{className:"@container/panel-header relative flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3 md:px-4",children:[o.jsx("div",{className:"flex flex-1 items-center justify-start",children:Fi}),o.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:Pr}),o.jsx("div",{className:"flex flex-1 items-center justify-end",children:Ui})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:No?o.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[o.jsx(Sv,{virtualMcpId:t,externalSelection:y,onViewJsonFile:C}),w&&tt&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(kv,{ref:k,virtualMcpId:t,pageKey:tt,onClose:j})}),n&&Rr]}):o.jsxs(ep,{orientation:"horizontal",disabled:vn!=="blocks",children:[o.jsx(Tc,{ref:_,id:"preview-blocks-editor",defaultSize:vn==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:vn==="blocks"&&o.jsx(Sv,{virtualMcpId:t,externalSelection:y,onViewJsonFile:C})}),vn==="blocks"&&o.jsx(tp,{withHandle:!0}),o.jsx(Tc,{id:"preview-canvas",defaultSize:vn==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:o.jsxs(ep,{orientation:"horizontal",disabled:!(w&&tt),children:[w&&tt&&o.jsxs(o.Fragment,{children:[o.jsx(Tc,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:o.jsx(kv,{ref:k,virtualMcpId:t,pageKey:tt,onClose:j})}),o.jsx(tp,{withHandle:!0})]}),o.jsx(Tc,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:o.jsxs("div",{ref:be=>{if(!be)return;const Pe=()=>N(yt=>yt.width===be.clientWidth&&yt.height===be.clientHeight?yt:{width:be.clientWidth,height:be.clientHeight});Pe();const at=new ResizeObserver(Pe);return at.observe(be),()=>at.disconnect()},className:ie("h-full relative overflow-clip flex justify-center",Qn&&!xi&&"bg-muted/30"),children:[(X||co)&&Qn&&o.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:o.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),wt.showBlockingOverlay&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx($c,{kind:"starting",progress:Sa,claimPhase:lo})}),It.kind==="suspended"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx($c,{kind:"suspended",onResume:de.resume})}),It.kind==="errored"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx($c,{kind:"errored",error:It.error,onRetry:de.retry,connectionsHref:`/${ce.slug}/settings/connections`})}),wt.showWakingPill&&o.jsxs("div",{className:"absolute top-4 left-1/2 z-20 flex max-w-md -translate-x-1/2 items-start gap-3 rounded-xl border border-border bg-muted px-4 py-3 shadow-lg pointer-events-none select-none",children:[o.jsx(ot,{size:18,className:"mt-0.5 shrink-0 animate-spin text-muted-foreground"}),o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),vn==="visual"&&!x&&o.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[o.jsx(f4,{size:12}),e("sandbox.preview.clickElementToAsk")]}),vn==="visual"&&x&&o.jsx(sse,{element:x,onDismiss:()=>b(null)}),Rr,Qn&&$s&&o.jsx("div",{className:ie("shrink-0",!xi&&"border-x border-border bg-background shadow-sm"),style:Co,children:o.jsx("iframe",{ref:v,src:$s,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:kr.handleError,onLoad:()=>{if(kr.handleLoad(),ae(),wt.mode!=="sandbox"){wt.mode==="production"&&!wt.showWakingPill&&f==="blocks"&&$i();return}if(Ye("vm_preview_loaded",{view_mode:f,vm_id:pe?.sandboxHandle??null}),!U)try{const be=v.current?.contentWindow?.location?.pathname;if(!be)return;const Pe=Lt.current;if(Pe!==null&&(Lt.current=null,Ue(be)!==Ue(Pe))||Ue(be)===Ue(Ee))return;se(be),pi({path:be,pageKey:oe,params:xt})}catch{}f==="visual"&&Nr(),f==="blocks"&&$i()}},wt.iframeBase)})]})})]})})]})}),o.jsx(Rte,{open:z,onOpenChange:M,isPending:lt.isPending,error:$,templates:Oe,onSubmit:Vd})]})}function Ple(t){const e=B.c(22),{virtualMcpId:s}=t,n=re(),i=Is(s),{activeTask:r,taskId:l,currentBranch:a}=sn(),c=gL(l),[d,f]=P.useState(!1);if(xL({threadId:l,sandboxBranch:r?.branch??a,agentHasRepo:Zs(i?.metadata),threadHasRepo:Zs(c)||Zs(r?.metadata)})==="none"){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(jn,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>f(!0),b=o.jsx(jn,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let y;e[7]!==n?(y=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=y):y=e[8];let L;e[9]!==y?(L=o.jsxs(ue,{onClick:x,children:[b,y]}),e[9]=y,e[10]=L):L=e[10];let v;e[11]!==p||e[12]!==g||e[13]!==L?(v=o.jsx(Qo,{className:"h-full",image:m,title:p,description:g,actions:L}),e[11]=p,e[12]=g,e[13]=L,e[14]=v):v=e[14];let _;e[15]!==d?(_=o.jsx(jg,{open:d,onOpenChange:f,mode:"agent"}),e[15]=d,e[16]=_):_=e[16];let w;return e[17]!==v||e[18]!==_?(w=o.jsxs(o.Fragment,{children:[v,_]}),e[17]=v,e[18]=_,e[19]=w):w=e[19],w}let h;return e[20]!==s?(h=o.jsx(Ale,{virtualMcpId:s}),e[20]=s,e[21]=h):h=e[21],h}const Ele=P.lazy(()=>xn(()=>import("./file-explorer-CH3ShuuH.js"),__vite__mapDeps([164,1,2,28,29,30,31,32,33,34,35,36,37,38,39,40,8,27,41,42,43,44,45,9,46,10,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,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,102,104,95,105,106,79,119,146,99,143,112,85,86,87,88,89,90,91,92,93,94,96,97,98,100,101,103,107,108,109,110,111,82,113,114,115,116,117,118,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,80,144,145,147,148,149,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.FileExplorer})));function Rle(t){const e=B.c(23),{openPath:s}=t,n=re(),i=oo(),{org:r}=Fe(),{currentBranch:l,taskId:a}=sn(),c=i?.entity?.id??null,d=dd(),f=vl(),u=Jn();f.vmEntry,u.lifecycle.phase;const h=d,m=c??"",p=l??"",g=a??null,x=h;let b;e[0]!==r.slug||e[1]!==m||e[2]!==p||e[3]!==g||e[4]!==x?(b={orgSlug:r.slug,virtualMcpId:m,branch:p,threadId:g,enabled:x},e[0]=r.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x,e[5]=b):b=e[5],Mk(b);const y=null;if(!c||!l){let k;e[6]!==n?(k=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[6]=n,e[7]=k):k=e[7];let j;return e[8]!==k?(j=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:k}),e[8]=k,e[9]=j):j=e[9],j}let L;e[10]!==y||e[11]!==n?(L=y,e[10]=y,e[11]=n,e[12]=L):L=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(ot,{size:20,className:"animate-spin text-muted-foreground"})}),e[13]=v):v=e[13];const _=a??null;let w;e[14]!==l||e[15]!==s||e[16]!==r.slug||e[17]!==_||e[18]!==c?(w=o.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:o.jsx(P.Suspense,{fallback:v,children:o.jsx(Ele,{orgSlug:r.slug,virtualMcpId:c,branch:l,threadId:_,openPath:s})})}),e[14]=l,e[15]=s,e[16]=r.slug,e[17]=_,e[18]=c,e[19]=w):w=e[19];let S;return e[20]!==L||e[21]!==w?(S=o.jsxs("div",{className:"flex flex-col w-full h-full",children:[L,w]}),e[20]=L,e[21]=w,e[22]=S):S=e[22],S}function Dle(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([n])=>!e.includes(n)));return Object.keys(s).length>0?{...t,properties:s}:t}function Ile(t,e,s){return typeof t!="string"?null:Dle(In(t,e),s)}function Dj(t,e,s){if(!e||typeof t!="string")return!1;const n=Ile(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function Mle({orgSlug:t,virtualMcpId:e,branch:s}){const n=ps(),i=As()?.taskId??null,r=v0(e),l=Tn(e).runtime==="cms";return Rs({mutationKey:Jg(t,e,s),mutationFn:async({blockKey:a})=>{if(l){const f=await f_({orgSlug:t,virtualMcpId:e,branch:s},{delete:[a]});return Xg(n,{orgSlug:t,virtualMcpId:e,branch:s},f),await n.invalidateQueries({queryKey:T0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=b0(r,Lg(a)),d=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:c})});return d.ok?d.json():N9(d,"Delete")},onMutate:async({blockKey:a})=>{const c=`${t}/${e}/${s}`,d=Je.decofile(c);await n.cancelQueries({queryKey:d});const f=n.getQueryData(d),u=!!f&&a in f,h=f?.[a];return n.setQueryData(d,m=>{if(!m)return m;const{[a]:p,...g}=m;return g}),{queryKey:d,blockKey:a,hadKey:u,previousValue:h}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,f=>d.hadKey?{...f??{},[d.blockKey]:d.previousValue}:f)},onSuccess:()=>{n.invalidateQueries({queryKey:Je.liveMeta(t,e,s)})}})}function vc(t){const e=B.c(6),{hasItems:s,emptyLabel:n,emptyHint:i}=t;let r;e[0]!==i||e[1]!==n||e[2]!==s?(r=s?"No results match your search.":o.jsxs(o.Fragment,{children:[o.jsx("div",{children:n}),o.jsx("div",{className:"mt-1 text-muted-foreground/80",children:i})]}),e[0]=i,e[1]=n,e[2]=s,e[3]=r):r=e[3];let l;return e[4]!==r?(l=o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=l):l=e[5],l}function l1(t,e){return`${t}-${e}`}function Ij(t,e){return`site/apps/${t}/${e}.ts`}function Mj(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function Ole(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function $le(t){return t==="local"?"Custom":"Installed"}function Oj(t,e,s){const n=new Set([l1(t,e),e].map(r=>r.toLowerCase())),i=Ij(t,e);for(const[r,l]of Object.entries(s)){if(r.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=l;if(n.has(r.toLowerCase())||a.__resolveType===i)return r}return null}function Ble(t,e){const s=t.vendor.alias,n=t.name,i=Oj(s,n,e);return{id:l1(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:Ij(s,n),blockKey:i,installed:i!==null}}function zle(t,e,s){if(t===_3)return null;const n=Mj(t);if(!n)return null;const{vendor:i,app:r}=n,l=Oj(i,r,s),a=bl(t,e);return{id:l1(i,r),app:r,vendor:i,title:a.title??r,description:a.description??"",category:"Others",logo:a.logo??a.icon,resolveType:t,blockKey:l,installed:l!==null}}function Fle(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Qc(t,e)||!J_(n))return null;const i=Mj(n)??Ole(t);if(!i)return null;const r=bl(n,s),{vendor:l,app:a}=i;return{id:l1(l,a),app:a,vendor:l,title:r.title??uh(t,e,s),description:r.description??"",category:$le(l),logo:r.logo??r.icon,resolveType:n,blockKey:t,installed:!0}}function Ule(t,e,s){const n=new Map;for(const r of t){const l=Ble(r,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const r of Object.keys(i)){const l=zle(r,e,s);!l||n.has(l.id)||n.set(l.id,l)}for(const[r,l]of Object.entries(s)){if(r.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=Fle(r,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(Hle)}function Hle(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function Kle(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function Wle(t,e,s){const n=B.c(12),i=s?.enabled??!0;let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=Je.decoApps(),n[0]=r):r=n[0];let l;n[1]!==i?(l={queryKey:r,queryFn:Kle,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Tt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?Ule(a.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=a.data,n[6]=c):c=n[6];const d=c,f=a.isLoading&&!a.isError;let u;return n[7]!==d||n[8]!==a.isError||n[9]!==a.refetch||n[10]!==f?(u={catalog:d,isLoading:f,isError:a.isError,refetch:a.refetch},n[7]=d,n[8]=a.isError,n[9]=a.refetch,n[10]=f,n[11]=u):u=n[11],u}function qle(t){const e=B.c(86),{active:s,counts:n,showBlog:i,onSelect:r}=t,l=re();let a;e[0]!==l?(a=l("sandbox.collectionsSidebar.content"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=o.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:o.jsx("span",{className:"text-sm font-medium",children:a})}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==l?(d=l("sandbox.collectionsSidebar.pages"),e[4]=l,e[5]=d):d=e[5];const f=s==="pages";let u;e[6]!==n.pages||e[7]!==r||e[8]!==d||e[9]!==f?(u=o.jsx(Bn,{id:"pages",icon:Ko,label:d,count:n.pages,active:f,onSelect:r}),e[6]=n.pages,e[7]=r,e[8]=d,e[9]=f,e[10]=u):u=e[10];let h;e[11]!==l?(h=l("sandbox.collectionsSidebar.sections"),e[11]=l,e[12]=h):h=e[12];const m=s==="sections";let p;e[13]!==n.sections||e[14]!==r||e[15]!==h||e[16]!==m?(p=o.jsx(Bn,{id:"sections",icon:Hl,label:h,count:n.sections,active:m,onSelect:r}),e[13]=n.sections,e[14]=r,e[15]=h,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==l?(g=l("sandbox.collectionsSidebar.apps"),e[18]=l,e[19]=g):g=e[19];const x=s==="apps";let b;e[20]!==n.apps||e[21]!==r||e[22]!==x||e[23]!==g?(b=o.jsx(Bn,{id:"apps",icon:f7,label:g,count:n.apps,active:x,onSelect:r}),e[20]=n.apps,e[21]=r,e[22]=x,e[23]=g,e[24]=b):b=e[24];let y;e[25]!==l?(y=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=y):y=e[26];const L=s==="redirects";let v;e[27]!==n.redirects||e[28]!==r||e[29]!==y||e[30]!==L?(v=o.jsx(Bn,{id:"redirects",icon:y8,label:y,count:n.redirects,active:L,onSelect:r}),e[27]=n.redirects,e[28]=r,e[29]=y,e[30]=L,e[31]=v):v=e[31];let _;e[32]!==l?(_=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=_):_=e[33];const w=s==="loaders";let S;e[34]!==n.loaders||e[35]!==r||e[36]!==_||e[37]!==w?(S=o.jsx(Bn,{id:"loaders",icon:Hc,label:_,count:n.loaders,active:w,onSelect:r}),e[34]=n.loaders,e[35]=r,e[36]=_,e[37]=w,e[38]=S):S=e[38];let k;e[39]!==l?(k=l("sandbox.collectionsSidebar.actions"),e[39]=l,e[40]=k):k=e[40];const j=s==="actions";let C;e[41]!==n.actions||e[42]!==r||e[43]!==k||e[44]!==j?(C=o.jsx(Bn,{id:"actions",icon:mr,label:k,count:n.actions,active:j,onSelect:r}),e[41]=n.actions,e[42]=r,e[43]=k,e[44]=j,e[45]=C):C=e[45];let T;e[46]!==l?(T=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=T):T=e[47];const N=s==="site";let V;e[48]!==r||e[49]!==T||e[50]!==N?(V=o.jsx(Bn,{id:"site",icon:lg,label:T,active:N,onSelect:r}),e[48]=r,e[49]=T,e[50]=N,e[51]=V):V=e[51];let A;e[52]!==l?(A=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=A):A=e[53];const E=s==="seo";let R;e[54]!==r||e[55]!==A||e[56]!==E?(R=o.jsx(Bn,{id:"seo",icon:ng,label:A,active:E,onSelect:r}),e[54]=r,e[55]=A,e[56]=E,e[57]=R):R=e[57];let I;e[58]!==l?(I=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=I):I=e[59];const D=s==="calendar";let O;e[60]!==r||e[61]!==I||e[62]!==D?(O=o.jsx(Bn,{id:"calendar",icon:lr,label:I,active:D,onSelect:r}),e[60]=r,e[61]=I,e[62]=D,e[63]=O):O=e[63];let z;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==r||e[69]!==i||e[70]!==l?(z=i&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[o.jsx(Uc,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),o.jsx(Bn,{id:"posts",icon:Qr,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:r}),o.jsx(Bn,{id:"authors",icon:Cg,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:r}),o.jsx(Bn,{id:"categories",icon:c9,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:r}),o.jsx(Bn,{id:"post-schedule",icon:MA,label:l("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:r})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=r,e[69]=i,e[70]=l,e[71]=z):z=e[71];let M;e[72]!==b||e[73]!==v||e[74]!==S||e[75]!==C||e[76]!==V||e[77]!==R||e[78]!==O||e[79]!==z||e[80]!==u||e[81]!==p?(M=o.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[u,p,b,v,S,C,V,R,O,z]}),e[72]=b,e[73]=v,e[74]=S,e[75]=C,e[76]=V,e[77]=R,e[78]=O,e[79]=z,e[80]=u,e[81]=p,e[82]=M):M=e[82];let $;return e[83]!==c||e[84]!==M?($=o.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,M]}),e[83]=c,e[84]=M,e[85]=$):$=e[85],$}function Bn(t){const e=B.c(18),{id:s,icon:n,label:i,count:r,active:l,onSelect:a}=t;let c;e[0]!==s||e[1]!==a?(c=()=>a(s),e[0]=s,e[1]=a,e[2]=c):c=e[2];const d=l?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let f;e[3]!==d?(f=ie("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",d),e[3]=d,e[4]=f):f=e[4];let u;e[5]!==n?(u=o.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=u):u=e[6];let h;e[7]!==i?(h=o.jsx("span",{className:"flex-1 truncate",children:i}),e[7]=i,e[8]=h):h=e[8];let m;e[9]!==l||e[10]!==r?(m=r!==void 0&&o.jsx("span",{className:ie("shrink-0 text-xs tabular-nums",l?"text-accent-foreground/70":"text-muted-foreground/70"),children:r}),e[9]=l,e[10]=r,e[11]=m):m=e[11];let p;return e[12]!==c||e[13]!==f||e[14]!==u||e[15]!==h||e[16]!==m?(p=o.jsxs("button",{type:"button",onClick:c,className:f,children:[u,h,m]}),e[12]=c,e[13]=f,e[14]=u,e[15]=h,e[16]=m,e[17]=p):p=e[17],p}function Gle(t){const e=B.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:r,connectionsHref:l}=t;switch(s.kind){case"starting":{let a;e[0]!==n||e[1]!==i?(a=Sk({claimPhase:n,lifecycle:i}),e[0]=n,e[1]=i,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==a?(c=o.jsx($c,{kind:"starting",progress:a,claimPhase:n}),e[3]=n,e[4]=a,e[5]=c):c=e[5],c}case"suspended":{let a;return e[6]!==r?(a=o.jsx($c,{kind:"suspended",onResume:r}),e[6]=r,e[7]=a):a=e[7],a}case"errored":{let a;return e[8]!==l||e[9]!==r||e[10]!==s.error?(a=o.jsx($c,{kind:"errored",error:s.error,onRetry:r,connectionsHref:l}),e[8]=l,e[9]=r,e[10]=s.error,e[11]=a):a=e[11],a}}}const Yle=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Jle(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!Yle.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function Tv(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),n=`${s} (copy)`;if(!t.has(n))return n;for(let i=2;i<1e3;i++){const r=`${s} (copy ${i})`;if(!t.has(r))return r}return`${s} (copy ${Date.now()})`}function Qle(t,e){const s=qo,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let r=2;r<1e3;r++){const l=`${n}-copy-${r}`;if(!t.has(s(l)))return l}return`${n}-copy-${Date.now()}`}function Xle(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),n=`${s}_copy`;if(!Object.hasOwn(t,n))return n;for(let i=2;i<1e3;i++){const r=`${s}_copy_${i}`;if(!Object.hasOwn(t,r))return r}return`${s}_copy_${Date.now()}`}function Zle(t){const e=ux(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function eae(t,e){return hk(t,e)}const tae=1e3;function sae(t,e){for(let s=0;s<tae;s++){const n=ux(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const nae={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},iae={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},rae={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function oae(t){const e=B.c(88),{open:s,mode:n,initialName:i,initialPath:r,isPending:l,error:a,templates:c,validate:d,onSubmit:f,onOpenChange:u}=t,h=l===void 0?!1:l,m=re(),[p,g]=P.useState(i),[x,b]=P.useState(r),[y,L]=P.useState(Yo),[v,_]=P.useState(null),[w,S]=P.useState(s);s!==w&&(S(s),s&&(g(i),b(r),L(Yo),_(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==h||e[1]!==u?(j=ce=>{!ce&&!h&&(_(null),u(!1))},e[0]=h,e[1]=u,e[2]=j):j=e[2];const C=j;let T;e[3]!==h||e[4]!==p||e[5]!==f||e[6]!==x||e[7]!==k||e[8]!==y||e[9]!==d?(T=async ce=>{ce.preventDefault();const fe=p.trim(),de=x.trim();if(!fe||!de||h)return;const pe=v3(de);if(pe){_(pe);return}const te=d?.({name:fe,path:de});if(te){_(te);return}_(null),await f({name:fe,path:de,templateKey:k&&y!==Yo?y:null})},e[3]=h,e[4]=p,e[5]=f,e[6]=x,e[7]=k,e[8]=y,e[9]=d,e[10]=T):T=e[10];const N=T,V=v??a,A=nae[n];let E;e[11]!==m||e[12]!==A?(E=m(A),e[11]=m,e[12]=A,e[13]=E):E=e[13];let R;e[14]!==E?(R=o.jsx(hs,{children:o.jsx(Yt,{children:E})}),e[14]=E,e[15]=R):R=e[15];let I;e[16]!==h||e[17]!==k||e[18]!==m||e[19]!==y||e[20]!==c?(I=k&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:m("sandbox.pageFormDialog.labelTemplate")}),o.jsx(mk,{id:"page-form-template",value:y,onChange:L,templates:c??[],disabled:h})]}),e[16]=h,e[17]=k,e[18]=m,e[19]=y,e[20]=c,e[21]=I):I=e[21];let D;e[22]!==m?(D=m("sandbox.pageFormDialog.labelName"),e[22]=m,e[23]=D):D=e[23];let O;e[24]!==D?(O=o.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:D}),e[24]=D,e[25]=O):O=e[25];let z;e[26]===Symbol.for("react.memo_cache_sentinel")?(z=ce=>g(ce.target.value),e[26]=z):z=e[26];let M;e[27]!==m?(M=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=M):M=e[28];let $;e[29]!==h||e[30]!==p||e[31]!==M?($=o.jsx(mt,{id:"page-form-name",value:p,onChange:z,placeholder:M,autoFocus:!0,disabled:h}),e[29]=h,e[30]=p,e[31]=M,e[32]=$):$=e[32];let F;e[33]!==$||e[34]!==O?(F=o.jsxs("div",{className:"space-y-1.5",children:[O,$]}),e[33]=$,e[34]=O,e[35]=F):F=e[35];let U;e[36]!==m?(U=m("sandbox.pageFormDialog.labelPath"),e[36]=m,e[37]=U):U=e[37];let H;e[38]!==U?(H=o.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:U}),e[38]=U,e[39]=H):H=e[39];let q;e[40]===Symbol.for("react.memo_cache_sentinel")?(q=ce=>b(ce.target.value),e[40]=q):q=e[40];let W;e[41]!==m?(W=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=W):W=e[42];let G;e[43]!==h||e[44]!==x||e[45]!==W?(G=o.jsx(mt,{id:"page-form-path",value:x,onChange:q,placeholder:W,disabled:h}),e[43]=h,e[44]=x,e[45]=W,e[46]=G):G=e[46];let Y;e[47]!==H||e[48]!==G?(Y=o.jsxs("div",{className:"space-y-1.5",children:[H,G]}),e[47]=H,e[48]=G,e[49]=Y):Y=e[49];let J;e[50]!==V?(J=V&&o.jsx("p",{className:"text-xs text-destructive",children:V}),e[50]=V,e[51]=J):J=e[51];let se;e[52]!==F||e[53]!==Y||e[54]!==J||e[55]!==I?(se=o.jsxs("div",{className:"space-y-4 py-4",children:[I,F,Y,J]}),e[52]=F,e[53]=Y,e[54]=J,e[55]=I,e[56]=se):se=e[56];let oe;e[57]!==u?(oe=()=>u(!1),e[57]=u,e[58]=oe):oe=e[58];let ne;e[59]!==m?(ne=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=ne):ne=e[60];let Q;e[61]!==h||e[62]!==oe||e[63]!==ne?(Q=o.jsx(ue,{type:"button",variant:"outline",onClick:oe,disabled:h,children:ne}),e[61]=h,e[62]=oe,e[63]=ne,e[64]=Q):Q=e[64];let K;e[65]!==h||e[66]!==p||e[67]!==x?(K=!p.trim()||!x.trim()||h,e[65]=h,e[66]=p,e[67]=x,e[68]=K):K=e[68];let X;e[69]!==h||e[70]!==n||e[71]!==m?(X=h?o.jsxs(o.Fragment,{children:[o.jsx(ot,{size:14,className:"animate-spin"}),m(rae[n])]}):m(iae[n]),e[69]=h,e[70]=n,e[71]=m,e[72]=X):X=e[72];let Z;e[73]!==K||e[74]!==X?(Z=o.jsx(ue,{type:"submit",disabled:K,children:X}),e[73]=K,e[74]=X,e[75]=Z):Z=e[75];let le;e[76]!==Q||e[77]!==Z?(le=o.jsxs(Wn,{children:[Q,Z]}),e[76]=Q,e[77]=Z,e[78]=le):le=e[78];let ee;e[79]!==N||e[80]!==se||e[81]!==le||e[82]!==R?(ee=o.jsx(Ut,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:N,children:[R,se,le]})}),e[79]=N,e[80]=se,e[81]=le,e[82]=R,e[83]=ee):ee=e[83];let ae;return e[84]!==C||e[85]!==s||e[86]!==ee?(ae=o.jsx(Ht,{open:s,onOpenChange:C,children:ee}),e[84]=C,e[85]=s,e[86]=ee,e[87]=ae):ae=e[87],ae}function lae(t){const e=B.c(70),{open:s,blockKey:n,initialName:i,isPending:r,onSubmit:l,onOpenChange:a}=t,c=r===void 0?!1:r,d=re(),[f,u]=P.useState(i),[h,m]=P.useState(s);s!==h&&(m(s),s&&u(i));let p;e[0]!==c||e[1]!==a?(p=q=>{!q&&!c&&a(!1)},e[0]=c,e[1]=a,e[2]=p):p=e[2];const g=p;let x;e[3]!==c||e[4]!==f||e[5]!==l?(x=async q=>{q.preventDefault();const W=f.trim();!W||c||await l(W)},e[3]=c,e[4]=f,e[5]=l,e[6]=x):x=e[6];const b=x;let y;e[7]!==d?(y=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=y):y=e[8];let L;e[9]!==y?(L=o.jsx(Yt,{children:y}),e[9]=y,e[10]=L):L=e[10];let v;e[11]!==d?(v=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=v):v=e[12];let _;e[13]!==v?(_=o.jsx(kn,{children:v}),e[13]=v,e[14]=_):_=e[14];let w;e[15]!==L||e[16]!==_?(w=o.jsxs(hs,{children:[L,_]}),e[15]=L,e[16]=_,e[17]=w):w=e[17];let S;e[18]!==d?(S=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=S):S=e[19];let k;e[20]!==S?(k=o.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:S}),e[20]=S,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=q=>u(q.target.value),e[22]=j):j=e[22];let C;e[23]!==c||e[24]!==f?(C=o.jsx(mt,{id:"section-rename-name",value:f,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=f,e[25]=C):C=e[25];let T;e[26]!==k||e[27]!==C?(T=o.jsxs("div",{className:"space-y-1.5",children:[k,C]}),e[26]=k,e[27]=C,e[28]=T):T=e[28];let N;e[29]!==d?(N=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=N):N=e[30];let V;e[31]!==N?(V=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:N}),e[31]=N,e[32]=V):V=e[32];let A;e[33]!==n?(A=o.jsx(mt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=A):A=e[34];let E;e[35]!==V||e[36]!==A?(E=o.jsxs("div",{className:"space-y-1.5",children:[V,A]}),e[35]=V,e[36]=A,e[37]=E):E=e[37];let R;e[38]!==T||e[39]!==E?(R=o.jsxs("div",{className:"space-y-4 py-4",children:[T,E]}),e[38]=T,e[39]=E,e[40]=R):R=e[40];let I;e[41]!==a?(I=()=>a(!1),e[41]=a,e[42]=I):I=e[42];let D;e[43]!==d?(D=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=D):D=e[44];let O;e[45]!==c||e[46]!==I||e[47]!==D?(O=o.jsx(ue,{type:"button",variant:"outline",onClick:I,disabled:c,children:D}),e[45]=c,e[46]=I,e[47]=D,e[48]=O):O=e[48];let z;e[49]!==c||e[50]!==f?(z=!f.trim()||c,e[49]=c,e[50]=f,e[51]=z):z=e[51];let M;e[52]!==c||e[53]!==d?(M=c?o.jsxs(o.Fragment,{children:[o.jsx(ot,{size:14,className:"animate-spin"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=M):M=e[54];let $;e[55]!==z||e[56]!==M?($=o.jsx(ue,{type:"submit",disabled:z,children:M}),e[55]=z,e[56]=M,e[57]=$):$=e[57];let F;e[58]!==O||e[59]!==$?(F=o.jsxs(Wn,{children:[O,$]}),e[58]=O,e[59]=$,e[60]=F):F=e[60];let U;e[61]!==b||e[62]!==R||e[63]!==F||e[64]!==w?(U=o.jsx(Ut,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:b,children:[w,R,F]})}),e[61]=b,e[62]=R,e[63]=F,e[64]=w,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=o.jsx(Ht,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function aae(t){const e=B.c(7),{type:s}=t,n=WB[s];let i;e[0]!==n?(i=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:n})}),e[0]=n,e[1]=i):i=e[1];const r=s==="permanent"?"Permanent":"Temporary";let l;e[2]!==r?(l=o.jsx(We,{side:"left",children:r}),e[2]=r,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=o.jsxs(qe,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const cm={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Ex=["posts","authors","categories"],_u={posts:"post",authors:"author",categories:"category"};function Lu(t){return Ex.includes(t)}const Rx={posts:"post",authors:"author",categories:"category"},$j={posts:cm.post,authors:cm.author,categories:cm.category},cae=Object.fromEntries(Object.entries($j).map(([t,e])=>[e,t]));function dae(t){return typeof t=="string"?cae[t]??null:null}function ul(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function us(t){return typeof t=="string"?t:""}function uae(t,e){switch(t){case"posts":return{label:us(e.title)||"Untitled post",subtitle:us(e.slug)};case"authors":return{label:us(e.name)||"Unnamed author",subtitle:us(e.email)};case"categories":return{label:us(e.name)||"Unnamed category",subtitle:us(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Bj(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=ul(n);if(!i)continue;const r=dae(i.__resolveType);if(!r)continue;const l=ul(i[Rx[r]])??{},{label:a,subtitle:c}=uae(r,l);e[r].push({key:s,kind:r,label:a,subtitle:c})}for(const s of Ex)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function fae(t,e){return Bj(t)[e]}function Gu(t,e){return fae(t,e).map(s=>({key:s.key,payload:nu(ul(t[s.key])??void 0,e)}))}const Vv=Object.freeze({});function nu(t,e){return t?ul(t[Rx[e]])??Vv:Vv}function yc(t,e,s){return{name:t,__resolveType:$j[e],[Rx[e]]:s}}function D3e({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],r=h=>typeof h=="string"?h:us(ul(h)?.[s]),l=h=>typeof h=="string"?h:us(ul(h)?.name),a=h=>{const m=r(h),p=m?t.find(({payload:x})=>us(x[s])===m):void 0;if(p)return p;const g=l(h);return g?t.find(({payload:x})=>us(x.name)===g):void 0},c=t.map(({key:h,payload:m})=>({value:h,label:us(m.name)||us(m[s])||h})),d=new Map,f=[];return i.forEach((h,m)=>{const p=a(h);if(p){f.includes(p.key)||f.push(p.key);return}const g=`unresolved:${m}`;d.set(g,h),f.push(g),c.push({value:g,label:l(h)||r(h)||"Unknown"})}),{options:c,selectedValues:f,refsForValues:h=>h.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function ia(t){return Array.isArray(t)?t:[]}function Yr(t){if(typeof t=="string")return t;const e=ul(t);return e?us(e.slug):""}function hae(t){if(typeof t=="string")return t;const e=ul(t);return e?us(e.email):""}function zj(t){const e=[];return us(t.title).trim()||e.push("Title"),us(t.slug).trim()||e.push("Slug"),ia(t.categories).map(Yr).filter(Boolean).length===0&&e.push("Category"),us(t.excerpt).trim()||e.push("Excerpt"),us(t.image).trim()||e.push("Cover image"),e}const Fj=8;function Uj(t){const e=us(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function I3e(t,e){return e!=="published"||Uj(t)==="published"?!1:zj(t).length>0}function mae(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,Fj).toISOString()}function M3e(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=us(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?mae(s):n}}function Hj(t){return Gu(t,"posts").map(({key:e,payload:s})=>({key:e,title:us(s.title)||"Untitled post",slug:us(s.slug),date:us(s.date),scheduledDatetime:us(s.scheduledDatetime),categorySlugs:ia(s.categories).map(Yr).filter(Boolean),authorEmails:ia(s.authors).map(hae).filter(Boolean),missing:zj(s),status:Uj(s)}))}function pae(t,e){const s=ia(t.categories);return s.some(n=>Yr(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function gae(t,e){const s=ia(t.categories);return s.length===1&&Yr(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function O3e(t,e,s){const n=ia(t.categories);if(!n.some(a=>Yr(a)===e))return t;const i=n.map(a=>{const c=Yr(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),r=new Set,l=i.filter(a=>{const c=Yr(a);return c?r.has(c)?!1:(r.add(c),!0):!0});return{...t,categories:l}}function xae(t,e){const s=ia(t.categories);return s.some(n=>Yr(n)===e)?{...t,categories:s.filter(n=>Yr(n)!==e)}:t}function Av(t){return{...t,dateModified:new Date().toISOString()}}function Bp(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function dm(t,e){const s=`collections/blog/${e}/${Bp(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Kj(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Bp(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${Bp(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const bae={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},Pv="Box";function vae(t){return t.startsWith("site/")?"site":"app"}function yae(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function zd(...t){for(const e of t)if(e!==void 0)return e}function $3e(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const r of Object.keys(i)){if(!wae(r)||e.has(r))continue;e.add(r);const l=bl(r,t),a=_ae(r),c=bae[a],d=vae(r),f=(d==="site"?zd(l.title,c?.title):zd(c?.title,l.title))??a,u=d==="site"?zd(l.description,c?.description):zd(c?.description,l.description),h=d==="site"?l.icon:void 0,m=h&&yae(h)?h:void 0,p=m!==void 0?c?.iconName??Pv:zd(h,c?.iconName)??Pv;s.push({resolveType:r,title:f,description:u,iconName:p,iconUrl:m,source:d})}return s.sort((i,r)=>i.title.localeCompare(r.title))}function _ae(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Lae=["blog/sections/blocks/","site/sections/Blog/Post/"];function wae(t){return Lae.some(e=>t.startsWith(e))}const B3e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],z3e=["January","February","March","April","May","June","July","August","September","October","November","December"],Wj=1440*60*1e3;function Bl(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function F3e(t){return new Date(t.getFullYear(),t.getMonth(),1)}function U3e(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Ih(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function zp(t,e){return Math.round((Bl(t).getTime()-Bl(e).getTime())/Wj)}function Sae(t){const e=(t.getTime()-Bl(t).getTime())/Wj;return Math.min(Math.max(e,0),1)}function Ev(t,e){return zp(t,e)+Sae(t)}function H3e(t){const e=Ih(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let r=0;r<7;r++)i.push(Ih(e,n*7+r));s.push(i)}for(;s.length>0&&s[s.length-1].every(n=>n.getMonth()!==t.getMonth());)s.pop();return s}function K3e(t,e){const s=Bl(t[0]),n=Ih(s,7),i=s.getTime(),r=n.getTime(),l=[];for(const d of e){const f=Bl(d.start),u=Bl(d.end);if(u.getTime()<s.getTime()||f.getTime()>=n.getTime())continue;const h=f.getTime()<s.getTime()?s:f,m=u.getTime()>=n.getTime()?Ih(n,-1):u,p=zp(h,s),g=zp(m,h)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),r),y=Ev(new Date(x),s),L=Math.max(Ev(new Date(b),s)-y,0);L<=0||l.push({variant:d,startCol:p,span:g,leftUnits:y,widthUnits:L})}l.sort((d,f)=>d.startCol-f.startCol||f.span-d.span||d.variant.blockKey.localeCompare(f.variant.blockKey));const a=[],c=[];for(const d of l){let f=a.findIndex(u=>u<=d.startCol);f===-1&&(f=a.length,a.push(0)),a[f]=d.startCol+d.span,c.push({...d,lane:f})}return c}function Mh(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const qj=/^(\d{4})-(\d{2})-(\d{2})$/;function Oh(t){const e=t.trim();if(!e)return null;const s=qj.exec(e);if(s){const i=Number(s[1]),r=Number(s[2])-1,l=Number(s[3]),a=new Date(i,r,l);return a.getMonth()===r&&a.getDate()===l?a:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:Bl(n)}function kae(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),Fj);return{...Kj("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:Mh(t)}}function jae(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(qj.test(e))return Oh(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function Cae(t,e){const s=jae(t.scheduledDatetime);if(!s)return null;const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),i={...t,scheduledDatetime:n.toISOString()};return(typeof t.date=="string"?t.date:"")===Mh(s)&&(i.date=Mh(n)),i}function Nae(t){return Oh(t.scheduledDatetime)??Oh(t.date)}function W3e(t){const e=new Map,s=[];for(const i of t){const r={post:i,scheduled:Oh(i.scheduledDatetime)!==null},l=Nae(i);if(!l){s.push(r);continue}const a=Mh(l),c=e.get(a);c?c.push(r):e.set(a,[r])}const n=(i,r)=>Number(r.scheduled)-Number(i.scheduled)||i.post.title.localeCompare(r.post.title);for(const i of e.values())i.sort(n);return s.sort(n),{byDay:e,undated:s}}const Tae="0.161.0",Vae="0.162.0",q3e="deno task update";function Rv(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function Dv(t,e){const s=Rv(t),n=Rv(e);if(!s||!n)return 0;for(let i=0;i<3;i++){const r=s[i]-n[i];if(r!==0)return r}return 0}const Gj=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Aae(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const n=Gj.exec(s)?.[1];if(n)return n}return null}function Pae(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const n=s?.title;if(typeof n!="string")continue;const i=Gj.exec(n)?.[1];if(i)return i}return null}function Eae(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=Aae(t.denoJson)??Pae(t.meta);return!e||Dv(e,Tae)<0?{kind:"outdated",version:e}:Dv(e,Vae)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function G3e(t){return t.kind==="publish-only"||t.kind==="full"}function Y3e(t){return t.kind==="full"}function Rae(t){const e=B.c(16),s=Is(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=v0(t.virtualMcpId),i=As()?.taskId??null;let r;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(r=Je.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=r):r=e[3];let l;e[4]!==n||e[5]!==t||e[6]!==i?(l=async()=>{const h=await u3({...t,threadId:i},b0(n,"deno.json"));return h.kind==="data"?h.data:null},e[4]=n,e[5]=t,e[6]=i,e[7]=l):l=e[7];const a=s==="deno";let c;e[8]!==r||e[9]!==l||e[10]!==a?(c={queryKey:r,queryFn:l,enabled:a,staleTime:3e5},e[8]=r,e[9]=l,e[10]=a,e[11]=c):c=e[11];const{data:d}=Tt(c),f=d??null;let u;return e[12]!==s||e[13]!==t.meta||e[14]!==f?(u=Eae({packageManager:s,denoJson:f,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=f,e[15]=u):u=e[15],u}function Dae({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const r=re(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,f]=P.useState(!1),[u,h]=P.useState(c),[m,p]=P.useState(!1),g=!i||a,x=u!==c,b=()=>{navigator.clipboard.writeText(u).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)})},y=async L=>{if(!i||m)return;let v;try{v=JSON.parse(L)}catch{xe.error(r("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(v),xe.success(r("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(_){xe.error(r("sectionsEditor.pageJsonDialog.saveError",{error:_ instanceof Error?_.message:String(_)}))}finally{p(!1)}};return o.jsx(Ht,{open:t,onOpenChange:e,children:o.jsxs(Ut,{className:"max-w-3xl p-0 gap-0",children:[o.jsxs(hs,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[o.jsx(Yt,{className:"text-sm font-semibold",children:r("sectionsEditor.pageJsonDialog.title")}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs(ue,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?o.jsx(mi,{size:12}):o.jsx(an,{size:12}),r(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&o.jsx(ue,{size:"sm",onClick:()=>y(u),disabled:!x||m,className:"h-7 text-xs",children:r(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),a?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",r("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"h-[70vh]",children:o.jsx(md,{code:c,language:"json",readOnly:g,height:"100%",onChange:L=>h(L??""),onSave:L=>{y(L)}})})]})})}function vi(t){const e=B.c(45),{icon:s,logoUrl:n,title:i,subtitle:r,active:l,accent:a,variantCount:c,trailing:d,selectable:f,selectionActive:u,selected:h,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,y=a==="global";let L;e[0]!==s||e[1]!==l||e[2]!==y||e[3]!==n||e[4]!==c?(L=c&&c>1?o.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(s,{size:16,className:"shrink-0 text-success"})}),o.jsxs(We,{side:"right",children:[c," variants"]})]})}):n?o.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):o.jsx("span",{className:ie("flex size-8 shrink-0 items-center justify-center rounded-lg",y?"bg-global-section/15":"bg-muted"),children:o.jsx(s,{size:16,className:ie("shrink-0",!y&&(l?"text-accent-foreground":"text-muted-foreground")),style:y?{color:m3}:void 0})}),e[0]=s,e[1]=l,e[2]=y,e[3]=n,e[4]=c,e[5]=L):L=e[5];const v=L,_=l?y?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":y?"hover:bg-global-section/10":"hover:bg-muted";let w;e[6]!==_?(w=ie("group relative flex min-w-0 items-center rounded-md transition-colors",_),e[6]=_,e[7]=w):w=e[7];let S;e[8]!==g||e[9]!==f||e[10]!==h||e[11]!==u||e[12]!==i?(S=f&&o.jsx("span",{className:ie("flex shrink-0 items-center pl-2.5 transition-opacity",h||u?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:Iae,children:o.jsx(fd,{checked:h,onCheckedChange:()=>g?.(),"aria-label":`Select ${i}`})}),e[8]=g,e[9]=f,e[10]=h,e[11]=u,e[12]=i,e[13]=S):S=e[13];const k=m&&!l&&"text-destructive";let j;e[14]!==k?(j=ie("block truncate text-sm font-medium",k),e[14]=k,e[15]=j):j=e[15];let C;e[16]!==j||e[17]!==i?(C=o.jsx("span",{className:j,children:i}),e[16]=j,e[17]=i,e[18]=C):C=e[18];const T=l?"text-accent-foreground/70":"text-muted-foreground";let N;e[19]!==T?(N=ie("block truncate text-xs",T),e[19]=T,e[20]=N):N=e[20];let V;e[21]!==r||e[22]!==N?(V=o.jsx("span",{className:N,children:r}),e[21]=r,e[22]=N,e[23]=V):V=e[23];let A;e[24]!==V||e[25]!==C?(A=o.jsxs("span",{className:"min-w-0 flex-1",children:[C,V]}),e[24]=V,e[25]=C,e[26]=A):A=e[26];let E;e[27]!==l||e[28]!==m||e[29]!==p?(E=m&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:ie("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:o.jsx(pn,{size:14})})}),p&&o.jsx(We,{side:"bottom",children:p})]}),e[27]=l,e[28]=m,e[29]=p,e[30]=E):E=e[30];let R;e[31]!==x||e[32]!==v||e[33]!==A||e[34]!==E||e[35]!==d?(R=o.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[v,A,E,d]}),e[31]=x,e[32]=v,e[33]=A,e[34]=E,e[35]=d,e[36]=R):R=e[36];let I;e[37]!==l||e[38]!==b?(I=b&&o.jsx("div",{className:ie("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[37]=l,e[38]=b,e[39]=I):I=e[39];let D;return e[40]!==R||e[41]!==I||e[42]!==w||e[43]!==S?(D=o.jsxs("div",{className:w,children:[S,R,I]}),e[40]=R,e[41]=I,e[42]=w,e[43]=S,e[44]=D):D=e[44],D}function Iae(t){return t.stopPropagation()}function Fo(t){const e=B.c(10),{icon:s,title:n,description:i}=t;let r;e[0]!==s?(r=s&&o.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=r):r=e[1];let l;e[2]!==n?(l=o.jsx("div",{children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==i?(a=i&&o.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:i}),e[4]=i,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==a?(c=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[r,l,a]}),e[6]=r,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}const Mae={loaders:Hc,actions:mr},Oae={loaders:"Loaders",actions:"Actions"},$ae={analytics:WP,blog:Uc,commerce:Ng,site:OA,website:Mn};function Bae(t,e){return e===0?$ae[t.toLowerCase()]??Xo:Xo}function Sf(t,e){return e===0?ane(t):t}function zae(t){const e=B.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c}=t,d=re();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[0]=f):f=e[0];const[u,h]=P.useState(f),[m,p]=P.useState(null),[g,x]=P.useState(""),[b,y]=P.useState(Yae),[L,v]=P.useState(c);L!==c&&(v(c),h([]),p(null),x(""),y(new Set));let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=U=>{y(H=>{const q=new Set(H);return q.has(U)?q.delete(U):q.add(U),q})},e[1]=_):_=e[1];const w=_;let S;e[2]!==i||e[3]!==s||e[4]!==n?(S={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=S):S=e[5];const k=V0(S);let j;e[6]!==k?(j=bx((U,H)=>k.mutate({blockKey:U,data:H})),e[6]=k,e[7]=j):j=e[7];const C=j;let T;e[8]!==c?(T=Ak(c),e[8]=c,e[9]=T):T=e[9];const N=T,V=Mae[c];let A,E,R,I,D,O,z;if(e[10]!==V||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==u||e[18]!==r||e[19]!==k||e[20]!==C||e[21]!==g||e[22]!==m||e[23]!==N||e[24]!==d||e[25]!==n){R=Symbol.for("react.early_return_sentinel");e:{const U=[...Dk(l,a,c).map(Gae),...Ek(l,c).map(qae)],H=g.trim().toLowerCase(),q=H.length>0,W=q?U.filter(me=>me.title.toLowerCase().includes(H)||me.resolveType.toLowerCase().includes(H)):[],G=new Map,Y=[],J=new Map;if(!q){for(const me of U){const Ce=me.folderPath;if(!(Ce.length<u.length)&&u.every((Ne,Ie)=>Ce[Ie]===Ne))if(Ce.length===u.length)if(me.savedKey!==void 0){const Ne=J.get(me.resolveType);Ne?Ne.push(me):J.set(me.resolveType,[me])}else Y.push(me);else{const Ne=Ce[u.length],Ie=G.get(Ne)??{count:0,savedCount:0};me.savedKey!==void 0?Ie.savedCount=Ie.savedCount+1:Ie.count=Ie.count+1,G.set(Ne,Ie)}}Y.sort(Wae);for(const me of J.values())me.sort(Kae)}const se=[...J.entries()].filter(me=>{const[Ce]=me;return!Y.some(Ne=>Ne.resolveType===Ce)}).flatMap(Hae).sort(Uae);let oe;e[33]!==u?(oe=(me,Ce)=>Sf(me.name,u.length).localeCompare(Sf(Ce.name,u.length)),e[33]=u,e[34]=oe):oe=e[34];const ne=[...G.entries()].map(Fae).sort(oe);let Q;e[35]===Symbol.for("react.memo_cache_sentinel")?(Q=me=>{p(me.savedKey!==void 0?{mode:"saved",key:me.savedKey}:{mode:"available",resolveType:me.resolveType,title:me.title})},e[35]=Q):Q=e[35];const K=Q;let X;e[36]!==k||e[37]!==N||e[38]!==d?(X=async(me,Ce)=>{await k.mutateAsync({blockKey:me,data:Ce}),xe.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:N,blockId:me})),p({mode:"saved",key:me})},e[36]=k,e[37]=N,e[38]=d,e[39]=X):X=e[39];const Z=X;let le;e[40]!==a||e[41]!==m?(le=Jae(m,a),e[40]=a,e[41]=m,e[42]=le):le=e[42];const ee=le;if(ee){const me=`${ee.mode}:${ee.mode==="saved"?ee.blockKey:ee.resolveType}`;let Ce;e[43]===Symbol.for("react.memo_cache_sentinel")?(Ce=()=>p(null),e[43]=Ce):Ce=e[43];let Ne;e[44]!==i||e[45]!==a||e[46]!==Z||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==r||e[51]!==k.isPending||e[52]!==C||e[53]!==me||e[54]!==ee.editorTarget||e[55]!==ee.initialValue||e[56]!==n?(Ne=o.jsx(Rj,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c,target:ee.editorTarget,initialValue:ee.initialValue,isCreating:k.isPending,onCreate:Z,onSaveReferencedBlock:C,onBack:Ce},me),e[44]=i,e[45]=a,e[46]=Z,e[47]=c,e[48]=l,e[49]=s,e[50]=r,e[51]=k.isPending,e[52]=C,e[53]=me,e[54]=ee.editorTarget,e[55]=ee.initialValue,e[56]=n,e[57]=Ne):Ne=e[57],R=Ne;break e}z="flex h-full w-full min-w-0 flex-col";let ae;e[58]!==d?(ae=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=ae):ae=e[59];let ce;e[60]===Symbol.for("react.memo_cache_sentinel")?(ce=()=>h([]),e[60]=ce):ce=e[60];const fe=u.length===0?"font-medium text-foreground":"text-muted-foreground";let de;e[61]!==fe?(de=ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",fe),e[61]=fe,e[62]=de):de=e[62];const pe=Oae[c];let te;e[63]!==de||e[64]!==pe?(te=o.jsx("button",{type:"button",onClick:ce,className:de,children:pe}),e[63]=de,e[64]=pe,e[65]=te):te=e[65];let ge;e[66]!==u?(ge=u.map((me,Ce)=>{const Ne=Ce===u.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o.jsx(en,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>h(u.slice(0,Ce+1)),className:ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Ne?"font-medium text-foreground":"text-muted-foreground"),children:Sf(me,Ce)})]},`${me}-${Ce}`)}),e[66]=u,e[67]=ge):ge=e[67];let ve;e[68]!==ae||e[69]!==te||e[70]!==ge?(ve=o.jsxs("nav",{"aria-label":ae,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[te,ge]}),e[68]=ae,e[69]=te,e[70]=ge,e[71]=ve):ve=e[71];let Se;e[72]===Symbol.for("react.memo_cache_sentinel")?(Se=o.jsx(k9,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=Se):Se=e[72];let ye;e[73]===Symbol.for("react.memo_cache_sentinel")?(ye=me=>x(me.target.value),e[73]=ye):ye=e[73];let ke;e[74]!==c||e[75]!==d?(ke=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=ke):ke=e[76];let we;e[77]!==c||e[78]!==d?(we=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=we):we=e[79];let je;e[80]!==g||e[81]!==ke||e[82]!==we?(je=o.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[Se,o.jsx("input",{type:"text",value:g,onChange:ye,placeholder:ke,"aria-label":we,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=ke,e[82]=we,e[83]=je):je=e[83],e[84]!==ve||e[85]!==je?(E=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ve,je]}),e[84]=ve,e[85]=je,e[86]=E):E=e[86],A=xl,O="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",I="mx-auto w-full max-w-4xl px-6 py-5",D=q?W.length===0?o.jsx(Fo,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):o.jsx("div",{className:"flex flex-col gap-1",children:W.map(me=>o.jsx(vi,{icon:V,accent:me.savedKey!==void 0?"global":void 0,title:me.title,subtitle:me.resolveType,active:!1,onClick:()=>K(me)},me.savedKey??me.resolveType))}):ne.length===0&&Y.length===0&&se.length===0?o.jsx(Fo,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:u.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):o.jsxs(o.Fragment,{children:[ne.length>0&&o.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:ne.map(me=>{const Ce=Bae(me.name,u.length);return o.jsxs("button",{type:"button",onClick:()=>h([...u,me.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[o.jsx(Ce,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium",children:Sf(me.name,u.length)}),o.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[me.count," ",me.count===1?N:c,me.savedCount>0&&o.jsxs(o.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:me.savedCount})]})]})]})]},me.name)})}),(Y.length>0||se.length>0)&&o.jsxs("div",{className:ie("flex flex-col gap-1",ne.length>0&&"mt-4"),children:[Y.map(me=>{const Ce=J.get(me.resolveType)??[],Ne=b.has(me.resolveType);return o.jsxs("div",{className:"flex flex-col",children:[o.jsx(vi,{icon:V,title:me.title,subtitle:me.resolveType,active:!1,onClick:()=>K(me)}),Ce.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>w(me.resolveType),"aria-expanded":Ne,className:"flex items-center gap-1 self-start rounded-md px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:m3},children:[Ne?o.jsx(Qt,{size:12,className:"shrink-0"}):o.jsx(en,{size:12,className:"shrink-0"}),d(Ne?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Ce.length,")"]}),Ne&&o.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Ce.map(Ie=>o.jsx(vi,{icon:V,accent:"global",title:Ie.title,subtitle:Ie.resolveType,active:!1,onClick:()=>K(Ie)},Ie.savedKey))})]})]},me.resolveType)}),se.map(me=>o.jsx(vi,{icon:V,accent:"global",title:me.title,subtitle:me.resolveType,active:!1,onClick:()=>K(me)},me.savedKey))]})]})}e[10]=V,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=u,e[18]=r,e[19]=k,e[20]=C,e[21]=g,e[22]=m,e[23]=N,e[24]=d,e[25]=n,e[26]=A,e[27]=E,e[28]=R,e[29]=I,e[30]=D,e[31]=O,e[32]=z}else A=e[26],E=e[27],R=e[28],I=e[29],D=e[30],O=e[31],z=e[32];if(R!==Symbol.for("react.early_return_sentinel"))return R;let M;e[87]!==I||e[88]!==D?(M=o.jsx("div",{className:I,children:D}),e[87]=I,e[88]=D,e[89]=M):M=e[89];let $;e[90]!==A||e[91]!==M||e[92]!==O?($=o.jsx(A,{className:O,children:M}),e[90]=A,e[91]=M,e[92]=O,e[93]=$):$=e[93];let F;return e[94]!==E||e[95]!==$||e[96]!==z?(F=o.jsxs("div",{className:z,children:[E,$]}),e[94]=E,e[95]=$,e[96]=z,e[97]=F):F=e[97],F}function Fae(t){const[e,s]=t;return{name:e,...s}}function Uae(t,e){return t.title.localeCompare(e.title)}function Hae(t){const[,e]=t;return e}function Kae(t,e){return t.title.localeCompare(e.title)}function Wae(t,e){return t.title.localeCompare(e.title)}function qae(t){return{resolveType:t.resolveType,title:t.title,folderPath:Rk(t.resolveType)}}function Gae(t){return{resolveType:t.resolveType,title:t.title,folderPath:Rk(t.resolveType),savedKey:t.key}}function Yae(){return new Set}function Jae(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:n,title:i}=Ik(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function Qae(t){const e=B.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:f,isCreating:u,onCreate:h,onSaveReferencedBlock:m}=t,p=re(),g=oo(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[y,L]=P.useState(b);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=[],e[1]=v):v=e[1];const[_,w]=P.useState(v),[S,k]=P.useState(0),[j,C]=P.useState(!1);let T;e[2]!==l||e[3]!==c?(T=In(c,l),e[2]=l,e[3]=c,e[4]=T):T=e[4];const N=T,V=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,A=As()?.taskId??null,E=r??void 0;let R;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==E||e[9]!==A||e[10]!==n?(R={orgSlug:s,virtualMcpId:n,branch:i,threadId:A,previewUrl:E,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=E,e[9]=A,e[10]=n,e[11]=R):R=e[11];const I=R;let D,O,z,M,$,F,U,H;if(e[12]!==a||e[13]!==_||e[14]!==y||e[15]!==h||e[16]!==p||e[17]!==d){const de=[d,..._],pe=ge=>{w(_.slice(0,ge)),k(Xae)};let te;e[26]!==a||e[27]!==y||e[28]!==h?(te=async ge=>{const ve=kx(ge,a);if(ve){xe.error(ve);return}await h(ge,y),C(!1)},e[26]=a,e[27]=y,e[28]=h,e[29]=te):te=e[29],D=te,M="flex h-full w-full min-w-0",z="flex min-w-0 flex-1 flex-col",O="shrink-0 border-b px-3 py-2.5",H="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==p?($=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=p,e[31]=$):$=e[31],F="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",U=de.map((ge,ve)=>{const Se=ve===de.length-1,ye=Sn(ge);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ve>0&&o.jsx(en,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>pe(ve),title:ye,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",Se?"font-medium text-foreground":"text-muted-foreground"),children:ye})]},`${ye}-${ve}`)}),e[12]=a,e[13]=_,e[14]=y,e[15]=h,e[16]=p,e[17]=d,e[18]=D,e[19]=O,e[20]=z,e[21]=M,e[22]=$,e[23]=F,e[24]=U,e[25]=H}else D=e[18],O=e[19],z=e[20],M=e[21],$=e[22],F=e[23],U=e[24],H=e[25];let q;e[32]!==$||e[33]!==F||e[34]!==U?(q=o.jsx("nav",{"aria-label":$,className:F,children:U}),e[32]=$,e[33]=F,e[34]=U,e[35]=q):q=e[35];let W;e[36]===Symbol.for("react.memo_cache_sentinel")?(W=()=>C(!0),e[36]=W):W=e[36];let G;e[37]!==p?(G=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=p,e[38]=G):G=e[38];let Y;e[39]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(Z2,{size:14}),e[39]=Y):Y=e[39];let J;e[40]!==u||e[41]!==G?(J=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{size:"icon",className:"size-8 shrink-0",disabled:u,onClick:W,"aria-label":G,children:Y})}),e[40]=u,e[41]=G,e[42]=J):J=e[42];let se;e[43]!==p?(se=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=p,e[44]=se):se=e[44];let oe;e[45]!==se?(oe=o.jsx(We,{side:"bottom",children:se}),e[45]=se,e[46]=oe):oe=e[46];let ne;e[47]!==J||e[48]!==oe?(ne=o.jsxs(qe,{children:[J,oe]}),e[47]=J,e[48]=oe,e[49]=ne):ne=e[49];let Q;e[50]!==q||e[51]!==ne||e[52]!==H?(Q=o.jsxs("div",{className:H,children:[q,ne]}),e[50]=q,e[51]=ne,e[52]=H,e[53]=Q):Q=e[53];const K="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",X=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:V});let Z;e[54]!==X?(Z=o.jsx("p",{className:K,children:X}),e[54]=X,e[55]=Z):Z=e[55];let le;e[56]!==O||e[57]!==Q||e[58]!==Z?(le=o.jsxs("div",{className:O,children:[Q,Z]}),e[56]=O,e[57]=Q,e[58]=Z,e[59]=le):le=e[59];let ee;e[60]!==a||e[61]!==_||e[62]!==S||e[63]!==y||e[64]!==l||e[65]!==m||e[66]!==I||e[67]!==N||e[68]!==p?(ee=o.jsx(xl,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:N?o.jsx(Ii,{schema:N,value:y,onChange:de=>L(de),basePath:"",breadcrumbPath:_,onBreadcrumbChange:w,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:I},S):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=a,e[61]=_,e[62]=S,e[63]=y,e[64]=l,e[65]=m,e[66]=I,e[67]=N,e[68]=p,e[69]=ee):ee=e[69];let ae;e[70]!==z||e[71]!==le||e[72]!==ee?(ae=o.jsxs("div",{className:z,children:[le,ee]}),e[70]=z,e[71]=le,e[72]=ee,e[73]=ae):ae=e[73];let ce;e[74]!==f||e[75]!==D||e[76]!==u||e[77]!==j?(ce=o.jsx(jx,{open:j,onOpenChange:C,defaultBlockId:f,isPending:u,onSubmit:D}),e[74]=f,e[75]=D,e[76]=u,e[77]=j,e[78]=ce):ce=e[78];let fe;return e[79]!==M||e[80]!==ae||e[81]!==ce?(fe=o.jsxs("div",{className:M,children:[ae,ce]}),e[79]=M,e[80]=ae,e[81]=ce,e[82]=fe):fe=e[82],fe}function Xae(t){return t+1}var Zae=Object.prototype.toString,kd=Array.isArray||function(e){return Zae.call(e)==="[object Array]"};function Dx(t){return typeof t=="function"}function ece(t){return kd(t)?"array":typeof t}function um(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Iv(t,e){return t!=null&&typeof t=="object"&&e in t}function tce(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var sce=RegExp.prototype.test;function nce(t,e){return sce.call(t,e)}var ice=/\S/;function rce(t){return!nce(ice,t)}var oce={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function lce(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return oce[s]})}var ace=/\s*/,cce=/\s+/,Mv=/\s*=/,dce=/\s*\}/,uce=/#|\^|\/|>|\{|&|=|!/;function fce(t,e){if(!t)return[];var s=!1,n=[],i=[],r=[],l=!1,a=!1,c="",d=0;function f(){if(l&&!a)for(;r.length;)delete i[r.pop()];else r=[];l=!1,a=!1}var u,h,m;function p(k){if(typeof k=="string"&&(k=k.split(cce,2)),!kd(k)||k.length!==2)throw new Error("Invalid tags: "+k);u=new RegExp(um(k[0])+"\\s*"),h=new RegExp("\\s*"+um(k[1])),m=new RegExp("\\s*"+um("}"+k[1]))}p(e||Pi.tags);for(var g=new A0(t),x,b,y,L,v,_;!g.eos();){if(x=g.pos,y=g.scanUntil(u),y)for(var w=0,S=y.length;w<S;++w)L=y.charAt(w),rce(L)?(r.push(i.length),c+=L):(a=!0,s=!0,c+=" "),i.push(["text",L,x,x+1]),x+=1,L===`
623
623
  `&&(f(),c="",d=0,s=!1);if(!g.scan(u))break;if(l=!0,b=g.scan(uce)||"name",g.scan(ace),b==="="?(y=g.scanUntil(Mv),g.scan(Mv),g.scanUntil(h)):b==="{"?(y=g.scanUntil(m),g.scan(dce),g.scanUntil(h),b="&"):y=g.scanUntil(h),!g.scan(h))throw new Error("Unclosed tag at "+g.pos);if(b==">"?v=[b,y,x,g.pos,c,d,s]:v=[b,y,x,g.pos],d++,i.push(v),b==="#"||b==="^")n.push(v);else if(b==="/"){if(_=n.pop(),!_)throw new Error('Unopened section "'+y+'" at '+x);if(_[1]!==y)throw new Error('Unclosed section "'+_[1]+'" at '+x)}else b==="name"||b==="{"||b==="&"?a=!0:b==="="&&p(y)}if(f(),_=n.pop(),_)throw new Error('Unclosed section "'+_[1]+'" at '+g.pos);return mce(hce(i))}function hce(t){for(var e=[],s,n,i=0,r=t.length;i<r;++i)s=t[i],s&&(s[0]==="text"&&n&&n[0]==="text"?(n[1]+=s[1],n[3]=s[3]):(e.push(s),n=s));return e}function mce(t){for(var e=[],s=e,n=[],i,r,l=0,a=t.length;l<a;++l)switch(i=t[l],i[0]){case"#":case"^":s.push(i),n.push(i),s=i[4]=[];break;case"/":r=n.pop(),r[5]=i[2],s=n.length>0?n[n.length-1][4]:e;break;default:s.push(i)}return e}function A0(t){this.string=t,this.tail=t,this.pos=0}A0.prototype.eos=function(){return this.tail===""};A0.prototype.scan=function(e){var s=this.tail.match(e);if(!s||s.index!==0)return"";var n=s[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};A0.prototype.scanUntil=function(e){var s=this.tail.search(e),n;switch(s){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,s),this.tail=this.tail.substring(s)}return this.pos+=n.length,n};function sd(t,e){this.view=t,this.cache={".":this.view},this.parent=e}sd.prototype.push=function(e){return new sd(e,this)};sd.prototype.lookup=function(e){var s=this.cache,n;if(s.hasOwnProperty(e))n=s[e];else{for(var i=this,r,l,a,c=!1;i;){if(e.indexOf(".")>0)for(r=i.view,l=e.split("."),a=0;r!=null&&a<l.length;)a===l.length-1&&(c=Iv(r,l[a])||tce(r,l[a])),r=r[l[a++]];else r=i.view[e],c=Iv(i.view,e);if(c){n=r;break}i=i.parent}s[e]=n}return Dx(n)&&(n=n.call(this.view)),n};function An(){this.templateCache={_cache:{},set:function(e,s){this._cache[e]=s},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}An.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};An.prototype.parse=function(e,s){var n=this.templateCache,i=e+":"+(s||Pi.tags).join(":"),r=typeof n<"u",l=r?n.get(i):void 0;return l==null&&(l=fce(e,s),r&&n.set(i,l)),l};An.prototype.render=function(e,s,n,i){var r=this.getConfigTags(i),l=this.parse(e,r),a=s instanceof sd?s:new sd(s,void 0);return this.renderTokens(l,a,n,e,i)};An.prototype.renderTokens=function(e,s,n,i,r){for(var l="",a,c,d,f=0,u=e.length;f<u;++f)d=void 0,a=e[f],c=a[0],c==="#"?d=this.renderSection(a,s,n,i,r):c==="^"?d=this.renderInverted(a,s,n,i,r):c===">"?d=this.renderPartial(a,s,n,r):c==="&"?d=this.unescapedValue(a,s):c==="name"?d=this.escapedValue(a,s,r):c==="text"&&(d=this.rawValue(a)),d!==void 0&&(l+=d);return l};An.prototype.renderSection=function(e,s,n,i,r){var l=this,a="",c=s.lookup(e[1]);function d(h){return l.render(h,s,n,r)}if(c){if(kd(c))for(var f=0,u=c.length;f<u;++f)a+=this.renderTokens(e[4],s.push(c[f]),n,i,r);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")a+=this.renderTokens(e[4],s.push(c),n,i,r);else if(Dx(c)){if(typeof i!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(s.view,i.slice(e[3],e[5]),d),c!=null&&(a+=c)}else a+=this.renderTokens(e[4],s,n,i,r);return a}};An.prototype.renderInverted=function(e,s,n,i,r){var l=s.lookup(e[1]);if(!l||kd(l)&&l.length===0)return this.renderTokens(e[4],s,n,i,r)};An.prototype.indentPartial=function(e,s,n){for(var i=s.replace(/[^ \t]/g,""),r=e.split(`
624
624
  `),l=0;l<r.length;l++)r[l].length&&(l>0||!n)&&(r[l]=i+r[l]);return r.join(`
625
- `)};An.prototype.renderPartial=function(e,s,n,i){if(n){var r=this.getConfigTags(i),l=Dx(n)?n(e[1]):n[e[1]];if(l!=null){var a=e[6],c=e[5],d=e[4],f=l;c==0&&d&&(f=this.indentPartial(l,d,a));var u=this.parse(f,r);return this.renderTokens(u,s,n,f,i)}}};An.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};An.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Pi.escape,r=s.lookup(e[1]);if(r!=null)return typeof r=="number"&&i===Pi.escape?String(r):i(r)};An.prototype.rawValue=function(e){return e[1]};An.prototype.getConfigTags=function(e){return kd(e)?e:e&&typeof e=="object"?e.tags:void 0};An.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!kd(e))return e.escape};var Pi={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Yu.templateCache=t},get templateCache(){return Yu.templateCache}},Yu=new An;Pi.clearCache=function(){return Yu.clearCache()};Pi.parse=function(e,s){return Yu.parse(e,s)};Pi.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+ece(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Yu.render(e,s,n,i)};Pi.escape=lce;Pi.Scanner=A0;Pi.Context=sd;Pi.Writer=An;function pce(t,e){const s={__resolveType:t},n=pk([s],e)[0];return n?xie(s,n,e):null}function gce({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,blockKey:l,onSaveReferencedBlock:a}){const c=re(),d=oo(),f=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[u]=P.useState(()=>pce(l,r)),[h,m]=P.useState(u?.data??{}),[p,g]=P.useState([]),[x,b]=P.useState(0),[y,L]=P.useState(!1),[v,_]=P.useState(null),w=v!==null,{save:S,flush:k}=fx({orgSlug:t,virtualMcpId:e,branch:s}),j=u?.resolveType?In(u.resolveType,i):null,C=r[l],T=C?Jl(l,C):l,N=As()?.taskId??null,V={orgSlug:t,virtualMcpId:e,branch:s,threadId:N,previewUrl:n??void 0,siteSlug:f},A=O=>{m(O),S(l,O)},E=()=>{w?(_(null),L(!1),b(O=>O+1)):_(JSON.stringify(h,null,2))},R=O=>{const z=O??"";try{const M=JSON.parse(z);if(M&&typeof M=="object"&&!Array.isArray(M)){L(!1),A(M);return}L(!0)}catch{L(!0)}},I=[T,...p],D=O=>{g(p.slice(0,O)),b(z=>z+1)};return o.jsx("div",{className:"flex h-full w-full min-w-0",children:o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:m3},"aria-hidden":!0}),o.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:I.map((O,z)=>{const M=z===I.length-1,$=Sn(O);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[z>0&&o.jsx(en,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>D(z),title:$,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",M?"font-medium text-foreground":"text-muted-foreground"),children:$})]},`${$}-${z}`)})}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:w?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:E,"aria-label":c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":w,children:w?o.jsx(Ds,{size:14}):o.jsx(fa,{size:14})})}),o.jsx(We,{side:"bottom",children:c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),o.jsxs("div",{className:"relative min-h-0 flex-1",children:[o.jsx(xl,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:j?o.jsx(Ii,{schema:j,value:h,onChange:O=>A(O),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:r,onSaveReferencedBlock:a,sandbox:V},x):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),v!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[y&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(md,{language:"json",height:"100%",code:v,onChange:R,onSave:O=>{R(O),k()}})})]})]})]})})}function xce(t){const e=B.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:f,onSaveReferencedBlock:u}=t,h=re();if(!s){let g;e[0]!==h?(g=h("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=h,e[1]=g):g=e[1];let x;e[2]!==h?(x=h("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=h,e[3]=x):x=e[3];let b;return e[4]!==g||e[5]!==x?(b=o.jsx(Fo,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=b):b=e[6],b}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,b=s.title;let y;e[7]!==s.title?(y=lj(s.title),e[7]=s.title,e[8]=y):y=e[8];let L;e[9]!==f||e[10]!==s.resolveType?(L=(_,w)=>f(s.resolveType,_,w),e[9]=f,e[10]=s.resolveType,e[11]=L):L=e[11];let v;return e[12]!==r||e[13]!==c||e[14]!==d||e[15]!==a||e[16]!==u||e[17]!==n||e[18]!==l||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==y||e[23]!==L||e[24]!==i?(v=o.jsx(Qae,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:y,isCreating:d,onCreate:L,onSaveReferencedBlock:u},g),e[12]=r,e[13]=c,e[14]=d,e[15]=a,e[16]=u,e[17]=n,e[18]=l,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=y,e[23]=L,e[24]=i,e[25]=v):v=e[25],v}const m=`saved:${s.key}`;let p;return e[26]!==r||e[27]!==c||e[28]!==a||e[29]!==u||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==m||e[34]!==i?(p=o.jsx(gce,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:u},m),e[26]=r,e[27]=c,e[28]=a,e[29]=u,e[30]=n,e[31]=l,e[32]=s.key,e[33]=m,e[34]=i,e[35]=p):p=e[35],p}const Ov="__all__",$v={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},bce={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},zf={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},Bv="status:";function zv(t){if(!t.startsWith(Bv))return null;const e=t.slice(Bv.length);return e in zf?e:null}const Fv=P.forwardRef(function(e,s){const n=B.c(20);let i,r,l,a,c;n[0]!==e?({icon:i,active:r,value:c,className:l,...a}=e,n[0]=e,n[1]=i,n[2]=r,n[3]=l,n[4]=a,n[5]=c):(i=n[1],r=n[2],l=n[3],a=n[4],c=n[5]);const d=r?"text-foreground":"text-muted-foreground";let f;n[6]!==l||n[7]!==d?(f=ie("h-7 gap-1 px-1.5 text-xs",d,l),n[6]=l,n[7]=d,n[8]=f):f=n[8];let u;n[9]!==i?(u=o.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=u):u=n[10];let h;n[11]!==c?(h=c&&o.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=h):h=n[12];let m;n[13]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Qt,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==a||n[15]!==s||n[16]!==f||n[17]!==u||n[18]!==h?(p=o.jsxs(ue,{ref:s,type:"button",variant:"ghost",size:"sm",className:f,...a,children:[u,h,m]}),n[14]=a,n[15]=s,n[16]=f,n[17]=u,n[18]=h,n[19]=p):p=n[19],p});function Ix(t){const e=B.c(2),{count:s}=t;let n;return e[0]!==s?(n=o.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=n):n=e[1],n}function vce(t){const e=B.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:r,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:f,onStatusFilterChange:u,onSortChange:h}=t,m=re();let p;if(e[0]!==s||e[1]!==r){let ee;e[3]!==r?(ee=ae=>ae.slug===r,e[3]=r,e[4]=ee):ee=e[4],p=s.find(ee),e[0]=s,e[1]=r,e[2]=p}else p=e[2];const g=p;let x;if(e[5]!==l||e[6]!==n){let ee;e[8]!==l?(ee=ae=>ae.email===l,e[8]=l,e[9]=ee):ee=e[9],x=n.find(ee),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,y=!!(r||l||a);let L;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==m?(L=g?.name??b?.name??m(a?zf[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=m,e[14]=L):L=e[14];const v=L,_=r?`cat:${r}`:l?`author:${l}`:a?`status:${a}`:Ov;let w;e[15]!==f||e[16]!==d||e[17]!==u?(w=()=>{d(null),f(null),u(null)},e[15]=f,e[16]=d,e[17]=u,e[18]=w):w=e[18];const S=w;let k;e[19]!==S||e[20]!==f||e[21]!==d||e[22]!==u?(k=ee=>{ee.startsWith("cat:")?(f(null),u(null),d(ee.slice(4))):ee.startsWith("author:")?(d(null),u(null),f(ee.slice(7))):zv(ee)?(d(null),f(null),u(zv(ee))):S()},e[19]=S,e[20]=f,e[21]=d,e[22]=u,e[23]=k):k=e[23];const j=k;let C;e[24]!==v||e[25]!==y?(C=o.jsx(Bt,{asChild:!0,children:o.jsx(Fv,{icon:$A,active:y,value:v,className:"min-w-0 shrink"})}),e[24]=v,e[25]=y,e[26]=C):C=e[26];let T;e[27]!==m?(T=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=T):T=e[28];let N;e[29]!==T?(N=o.jsx(Pd,{children:T}),e[29]=T,e[30]=N):N=e[30];let V;e[31]!==m?(V=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=V):V=e[32];let A;e[33]!==V?(A=o.jsx(Kn,{value:Ov,children:V}),e[33]=V,e[34]=A):A=e[34];let E;e[35]!==m?(E=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=E):E=e[36];let R;e[37]!==E?(R=o.jsx(Pd,{className:"text-muted-foreground/70",children:E}),e[37]=E,e[38]=R):R=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=Object.keys(zf),e[39]=I):I=e[39];let D;e[40]!==i||e[41]!==m?(D=I.map(ee=>o.jsxs(Kn,{value:`status:${ee}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(zf[ee])}),o.jsx(Ix,{count:i[ee]})]},`status:${ee}`)),e[40]=i,e[41]=m,e[42]=D):D=e[42];let O;e[43]!==s.length||e[44]!==m?(O=s.length>0&&o.jsx(Pd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=O):O=e[45];let z;e[46]!==s?(z=s.map(_ce),e[46]=s,e[47]=z):z=e[47];let M;e[48]!==n.length||e[49]!==m?(M=n.length>0&&o.jsx(Pd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=M):M=e[50];let $;e[51]!==n?($=n.map(yce),e[51]=n,e[52]=$):$=e[52];let F;e[53]!==_||e[54]!==j||e[55]!==A||e[56]!==R||e[57]!==D||e[58]!==O||e[59]!==z||e[60]!==M||e[61]!==$?(F=o.jsxs(Wc,{value:_,onValueChange:j,children:[A,R,D,O,z,M,$]}),e[53]=_,e[54]=j,e[55]=A,e[56]=R,e[57]=D,e[58]=O,e[59]=z,e[60]=M,e[61]=$,e[62]=F):F=e[62];let U;e[63]!==F||e[64]!==N?(U=o.jsxs(zt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[N,F]}),e[63]=F,e[64]=N,e[65]=U):U=e[65];let H;e[66]!==U||e[67]!==C?(H=o.jsxs($t,{children:[C,U]}),e[66]=U,e[67]=C,e[68]=H):H=e[68];let q;e[69]!==S||e[70]!==y||e[71]!==m?(q=y&&o.jsx(Lce,{label:m("sandbox.postToolbar.clearFilter"),onClick:S}),e[69]=S,e[70]=y,e[71]=m,e[72]=q):q=e[72];const W=bce[c];let G;e[73]!==m||e[74]!==W?(G=m(W),e[73]=m,e[74]=W,e[75]=G):G=e[75];let Y;e[76]!==G?(Y=o.jsx(Bt,{asChild:!0,children:o.jsx(Fv,{icon:BA,active:!0,value:G})}),e[76]=G,e[77]=Y):Y=e[77];let J;e[78]!==m?(J=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=J):J=e[79];let se;e[80]!==J?(se=o.jsx(Pd,{children:J}),e[80]=J,e[81]=se):se=e[81];let oe;e[82]!==h?(oe=ee=>h(ee),e[82]=h,e[83]=oe):oe=e[83];let ne;e[84]===Symbol.for("react.memo_cache_sentinel")?(ne=Object.keys($v),e[84]=ne):ne=e[84];let Q;e[85]!==m?(Q=ne.map(ee=>o.jsx(Kn,{value:ee,children:m($v[ee])},ee)),e[85]=m,e[86]=Q):Q=e[86];let K;e[87]!==c||e[88]!==oe||e[89]!==Q?(K=o.jsx(Wc,{value:c,onValueChange:oe,children:Q}),e[87]=c,e[88]=oe,e[89]=Q,e[90]=K):K=e[90];let X;e[91]!==se||e[92]!==K?(X=o.jsxs(zt,{align:"end",className:"w-44",children:[se,K]}),e[91]=se,e[92]=K,e[93]=X):X=e[93];let Z;e[94]!==Y||e[95]!==X?(Z=o.jsx("div",{className:"ml-auto shrink-0",children:o.jsxs($t,{children:[Y,X]})}),e[94]=Y,e[95]=X,e[96]=Z):Z=e[96];let le;return e[97]!==H||e[98]!==q||e[99]!==Z?(le=o.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[H,q,Z]}),e[97]=H,e[98]=q,e[99]=Z,e[100]=le):le=e[100],le}function yce(t){return o.jsxs(Kn,{value:`author:${t.email}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(Ix,{count:t.count})]},`author:${t.email}`)}function _ce(t){return o.jsxs(Kn,{value:`cat:${t.slug}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(Ix,{count:t.count})]},`cat:${t.slug}`)}function Lce(t){const e=B.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Ds,{size:12}),e[0]=i):i=e[0];let r;return e[1]!==s||e[2]!==n?(r=o.jsx("button",{type:"button","aria-label":s,onClick:n,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:i}),e[1]=s,e[2]=n,e[3]=r):r=e[3],r}function wce(t){const e=B.c(18),{checked:s,disabled:n,onToggle:i}=t,r=re();let l;e[0]!==i?(l=()=>i(),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==r?(a=r(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=r,e[4]=a):a=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==a?(c=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Sce,children:o.jsx(fd,{checked:s,disabled:n,onCheckedChange:l,"aria-label":a})})}),e[5]=s,e[6]=n,e[7]=l,e[8]=a,e[9]=c):c=e[9];let d;e[10]!==s||e[11]!==r?(d=r(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=r,e[12]=d):d=e[12];let f;e[13]!==d?(f=o.jsx(We,{side:"bottom",children:d}),e[13]=d,e[14]=f):f=e[14];let u;return e[15]!==c||e[16]!==f?(u=o.jsxs(qe,{children:[c,f]}),e[15]=c,e[16]=f,e[17]=u):u=e[17],u}function Sce(t){return t.stopPropagation()}function kce(t){const e=B.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:r,onExit:l}=t,a=re();let c;e[0]!==n||e[1]!==i?(c=o.jsx(wce,{checked:n,onToggle:i}),e[0]=n,e[1]=i,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==a?(d=a("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=a,e[5]=d):d=e[5];let f;e[6]!==d?(f=o.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=f):f=e[7];const u=s===0;let h;e[8]!==a?(h=a("sandbox.postToolbar.deleteSelectedPosts"),e[8]=a,e[9]=h):h=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(tn,{size:14}),e[10]=m):m=e[10];let p;e[11]!==r||e[12]!==u||e[13]!==h?(p=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:u,onClick:r,"aria-label":h,children:m})}),e[11]=r,e[12]=u,e[13]=h,e[14]=p):p=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(We,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=o.jsxs(qe,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let y;e[22]!==a?(y=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=y):y=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(Ds,{size:14}),e[24]=L):L=e[24];let v;e[25]!==l||e[26]!==y?(v=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":y,children:L})}),e[25]=l,e[26]=y,e[27]=v):v=e[27];let _;e[28]!==a?(_=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=_):_=e[29];let w;e[30]!==_?(w=o.jsx(We,{side:"bottom",children:_}),e[30]=_,e[31]=w):w=e[31];let S;e[32]!==v||e[33]!==w?(S=o.jsxs(qe,{children:[v,w]}),e[32]=v,e[33]=w,e[34]=S):S=e[34];let k;e[35]!==b||e[36]!==S?(k=o.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,S]}),e[35]=b,e[36]=S,e[37]=k):k=e[37];let j;return e[38]!==c||e[39]!==k||e[40]!==f?(j=o.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,f,k]}),e[38]=c,e[39]=k,e[40]=f,e[41]=j):j=e[41],j}function Fd(t){const e=B.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:r,onViewJson:l,onDelete:a}=t,c=re();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(qn,{size:14}),e[2]=f):f=e[2];let u;e[3]!==d?(u=o.jsx(Bt,{asChild:!0,children:o.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:jce,children:f})}),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n||e[6]!==c?(h=n&&o.jsxs(Xe,{onClick:n,children:[o.jsx(Pg,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=h):h=e[7];let m;e[8]!==s||e[9]!==c?(m=s&&o.jsxs(Xe,{onClick:s,children:[o.jsx(an,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=m):m=e[10];let p;e[11]!==i||e[12]!==c?(p=i&&o.jsxs(o.Fragment,{children:[o.jsx(qr,{}),o.jsxs(Xe,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[o.jsx(c0,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==r||e[15]!==l||e[16]!==c?(g=(r||l)&&o.jsxs(o.Fragment,{children:[o.jsx(qr,{}),r&&o.jsxs(Xe,{onClick:r,children:[o.jsx(ng,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&o.jsxs(Xe,{onClick:l,children:[o.jsx(fa,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=r,e[15]=l,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(qr,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(tn,{size:14}),e[19]=b):b=e[19];let y;e[20]!==c?(y=c("sandbox.itemActions.delete"),e[20]=c,e[21]=y):y=e[21];let L;e[22]!==a||e[23]!==y?(L=o.jsxs(Xe,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,y]}),e[22]=a,e[23]=y,e[24]=L):L=e[24];let v;e[25]!==L||e[26]!==h||e[27]!==m||e[28]!==p||e[29]!==g?(v=o.jsxs(zt,{align:"end",className:"w-44",children:[h,m,p,g,x,L]}),e[25]=L,e[26]=h,e[27]=m,e[28]=p,e[29]=g,e[30]=v):v=e[30];let _;return e[31]!==v||e[32]!==u?(_=o.jsxs($t,{children:[u,v]}),e[31]=v,e[32]=u,e[33]=_):_=e[33],_}function jce(t){return t.stopPropagation()}function Cce(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function Nce(t){const e=new Map;for(const s of t){const n=Cce(s.resolveType),i=e.get(n);i?i.push(s):e.set(n,[s])}return[...e.entries()].map(([s,n])=>({label:s,sections:n})).sort((s,n)=>s.label.localeCompare(n.label))}function Uv(t){const e=B.c(8),{icon:s,label:n,className:i}=t;let r;e[0]!==i?(r=ie("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",i),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==s?(l=o.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==n||e[5]!==r||e[6]!==l?(a=o.jsxs("div",{className:r,children:[l,n]}),e[4]=n,e[5]=r,e[6]=l,e[7]=a):a=e[7],a}const Hv=P.lazy(()=>xn(()=>import("./app-editor-6p_LrTu2.js"),__vite__mapDeps([165,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,41,77,78,27,43,84,28,29,30,31,32,33,34,35,36,37,38,39,40,42,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,79,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,82,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,80,144,145,146,147,148,149,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.AppEditor}))),Tce=P.lazy(()=>xn(()=>import("./post-editor-C_J5WNPs.js"),__vite__mapDeps([166,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,29,58,28,30,31,32,33,34,35,36,37,38,39,40,27,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,79,82,167,139,141,155,156,127,115,83,136,168,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,169,170,113,114,78,116,117,118,119,120,121,122,123,124,125,126,128,129,130,131,132,133,134,135,137,138,140,142,143,80,144,145,146,147,148,149,77,150,151,152,153,154,157,158,159,160,161,162,163])).then(t=>({default:t.PostEditor}))),Vce=P.lazy(()=>xn(()=>import("./record-editor-CAQX4Dhe.js"),__vite__mapDeps([171,1,2,79,82,78,8,27,43,136,169,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,44,45,9,46,10,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,170,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,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,137,138,139,140,141,142,143,80,144,145,146,147,148,149,77,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.RecordEditor}))),Ace=P.lazy(()=>xn(()=>import("./category-editor-CYCrdpS-.js"),__vite__mapDeps([172,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,35,38,58,28,29,30,31,32,33,34,36,37,39,40,27,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,119,79,82,168,155,156,127,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,169,170,113,114,78,115,116,117,118,120,121,122,123,124,125,126,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,80,144,145,146,147,148,149,77,150,151,83,152,153,154,157,158,159,160,161,162,163])).then(t=>({default:t.CategoryEditor}))),Pce=P.lazy(()=>xn(()=>import("./bulk-category-panel-DKVwuCXm.js"),__vite__mapDeps([173,1,2,38,82,174,44,78,8,27,43])).then(t=>({default:t.BulkCategoryPanel}))),Ece=P.lazy(()=>xn(()=>import("./sections-editor-B_M-97ti.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])).then(t=>({default:t.SectionsEditor}))),Rce=P.lazy(()=>xn(()=>import("./seo-editor-DJVpxpW3.js"),__vite__mapDeps([175,1,2,41,28,29,30,31,32,33,34,35,36,37,38,39,40,8,27,42,43,44,45,9,46,10,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,81,82,83,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,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,79,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,80,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.SeoEditor}))),Dce=P.lazy(()=>xn(()=>import("./variant-calendar-DPptfq0B.js"),__vite__mapDeps([176,1,2,28,29,30,31,32,33,34,35,36,37,38,39,40,8,27,41,42,43,44,45,9,46,10,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,82,77,78,83,177,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,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,79,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,80,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.VariantCalendar}))),Ice=P.lazy(()=>xn(()=>import("./post-calendar-DX9-IYRC.js"),__vite__mapDeps([178,1,2,29,28,30,31,32,33,34,35,36,37,38,39,40,8,27,41,42,43,44,45,9,46,10,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,179,77,78,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,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,82,79,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,80,144,145,146,147,148,149,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.PostCalendar}))),Mce=P.lazy(()=>xn(()=>import("./redirect-editor-DJxCUYg3.js"),__vite__mapDeps([180,1,2,141,8,79,82,78,27,43,170,32,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,85,28,29,30,31,33,34,35,36,37,38,39,40,41,42,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,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,142,143,80,144,145,146,147,148,149,77,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.RedirectEditor})));function Oce(t){const e=B.c(20),{deepLinkPage:s}=t,n=oo(),{currentBranch:i}=sn(),{org:r}=Fe(),l=n?.entity?.id??null,a=Jn(),c=vl(),{runtime:d,previewServerUrl:f}=Tn(l),u=d==="cms";let h;e[0]!==u||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(h=Jle({fastPreviewActive:u,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=u,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=h):h=e[3];const m=h;if(m.kind==="sandbox-card"){const x=`/${r.slug}/settings/connections`;let b;return e[4]!==m.state||e[5]!==c.start||e[6]!==x||e[7]!==a.lifecycle||e[8]!==a.phase?(b=o.jsx(Gle,{state:m.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=m.state,e[5]=c.start,e[6]=x,e[7]=a.lifecycle,e[8]=a.phase,e[9]=b):b=e[9],b}if(!l||!i){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Fo,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const p=u?f:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==m.devServerReady||e[14]!==m.sandboxWarming||e[15]!==c.previewUrl||e[16]!==r.slug||e[17]!==p||e[18]!==l?(g=o.jsx(Bce,{orgSlug:r.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:p,deepLinkPage:s,devServerReady:m.devServerReady,sandboxWarming:m.sandboxWarming}),e[11]=i,e[12]=s,e[13]=m.devServerReady,e[14]=m.sandboxWarming,e[15]=c.previewUrl,e[16]=r.slug,e[17]=p,e[18]=l,e[19]=g):g=e[19],g}const Kv=2e3,$ce=15;function Wv(t,e,s,n){return typeof e!="string"||s&&(Dj(e,s,n)||t.state.dataUpdateCount>=$ce)?!1:Kv}function Bce({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:r,devServerReady:l,sandboxWarming:a}){const c=re(),d=As()?.taskId??null,f={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:u,isLoading:h}=y0(f,{fetchEnabled:l}),[m,p]=P.useState("pages"),[g,x]=P.useState(null),[b,y]=P.useState(null),L=!!(r?.pageId||r?.path||r?.pathTemplate),[v,_]=P.useState(!1);if(L&&!v&&g===null&&u){_(!0);const he=XB(dh(u),r??{});he&&(p("pages"),x({collection:"pages",key:he.key,path:he.path}))}const[w,S]=P.useState(""),[k,j]=P.useState(null),[C,T]=P.useState(null),[N,V]=P.useState(null),[A,E]=P.useState("date-desc"),[R,I]=P.useState(()=>new Set),[D,O]=P.useState(null),z=()=>{I(new Set),O(null)},M=he=>{x(he),y(null)},[$,F]=P.useState(m);$!==m&&(F(m),S(""),j(null),T(null),V(null),E("date-desc"),I(new Set),O(null));const{data:U,isLoading:H,isFetching:q}=A9(f,{fetchEnabled:l,refetchInterval:he=>{const Ae=he.state.data;if(m==="apps"&&g&&g.collection==="apps"){const He=u?.[g.key];return Wv(he,typeof He?.__resolveType=="string"?He.__resolveType:void 0,Ae)}if(m==="site"&&u){const He=Ae?op(u,Ae):null,Le=u.site,De=He?.resolveType??(typeof Le?.__resolveType=="string"?Le.__resolveType:void 0);return Wv(he,De,Ae,["seo"])}return!1}}),W=(he,Ae)=>!Dj(he,U,Ae)&&(H||q),{catalog:G,isLoading:Y}=Wle(U??void 0,u??void 0,{enabled:m==="apps"}),J=Rae({orgSlug:t,virtualMcpId:e,branch:s,meta:U}),se=V0(f),oe=Mle(f),[ne,Q]=P.useState(null),[K,X]=P.useState(),[Z,le]=P.useState(null),[ee,ae]=P.useState(null),[ce,fe]=P.useState(null),de=!u||!U;if(h||H||de&&a)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(ot,{size:20,className:"animate-spin text-muted-foreground"})});if(de)return o.jsx(Fo,{title:"Could not load site data."});const pe=dh(u).sort((he,Ae)=>he.name.localeCompare(Ae.name)),te=oL(u).sort((he,Ae)=>he.from.localeCompare(Ae.from)),ge=L3(u,U),ve=m==="sections"?UB(U):[],Se=op(u,U),ye=Bj(u),ke=Ex.some(he=>ye[he].length>0),we=Lu(m)?ye[m]:[],je=(ke?Gu(u,"categories"):[]).map(({key:he,payload:Ae})=>{const He=typeof Ae.slug=="string"?Ae.slug:"",Le=typeof Ae.name=="string"?Ae.name:"";return{slug:He||he,name:Le||He||he}}).filter(he=>he.slug).sort((he,Ae)=>he.name.localeCompare(Ae.name)),me=m==="posts"&&(R.size>0||D!==null),Ce=me?Hj(u).filter(he=>R.has(he.key)):[],Ne=Zb(U,"loaders"),Ie=Zb(U,"actions");if(!R9(u,U)&&!ke&&Ne===0&&Ie===0)return o.jsx(Fo,{icon:pn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const et={pages:pe.length,sections:ge.length,apps:G.length,loaders:Ne,actions:Ie,redirects:te.length,posts:ye.posts.length,authors:ye.authors.length,categories:ye.categories.length},Ze=new Set(pe.map(he=>qo(he.path))),Te=new Set(pe.map(he=>he.name)),Me=new Set(ge.map(he=>he.name)),rt=async he=>{const Ae=u[he.key];if(!Ae)return;const He=vk(u,he.key),Le=yk(u,he.key,Math.max(0,He-1)),De=Xte(Ae.sections,Le);if(De)try{await se.mutateAsync({blockKey:he.key,data:{...Ae,sections:De}}),xe.success(`Variant added to "${he.name}"`),x({collection:"pages",key:he.key,path:he.path})}catch(Qe){xe.error(Qe instanceof Error?Qe.message:"Could not add variant")}},nt=()=>{X(void 0),Q({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},it=he=>{X(void 0),Q({mode:"duplicate",sourceKey:he.key,initialName:Tv(Te,he.name),initialPath:Qle(Ze,he.path)})},ut=he=>{X(void 0),Q({mode:"rename",sourceKey:he.key,initialName:he.name,initialPath:he.path})},Ct=async he=>{if(!ne)return;const{mode:Ae,sourceKey:He}=ne;try{if(Ae==="create"){let Le;if(he.templateKey){const Qe=u[he.templateKey];if(!Qe)throw new Error("Selected template no longer exists.");Le={...Qe,name:he.name,path:he.path}}else Le=eae(he.name,he.path);const De=sae(u,he.name);await se.mutateAsync({blockKey:De,data:Le}),xe.success(`Created "${he.name}"`),x({collection:"pages",key:De,path:he.path})}else if(Ae==="duplicate"&&He){const Le=u[He];if(!Le)throw new Error("Source page not found");const{key:De,data:Qe}=Zle({source:Le,pages:pe,newName:he.name,newPath:he.path});await se.mutateAsync({blockKey:De,data:Qe}),xe.success(`Duplicated as "${he.name}"`),x({collection:"pages",key:De,path:he.path})}else if(Ae==="rename"&&He){const Le=u[He];if(!Le)throw new Error("Page not found");const De={...Le,name:he.name,path:he.path};await se.mutateAsync({blockKey:He,data:De}),xe.success("Page updated"),g?.collection==="pages"&&g.key===He&&x({collection:"pages",key:He,path:he.path})}Q(null)}catch(Le){X(Le instanceof Error?Le.message:"Save failed")}},ct=({path:he})=>{if(!ne)return null;const Ae=qo(he);return(ne.mode==="rename"?qo(ne.initialPath):null)!==Ae&&Ze.has(Ae)?`A page with path "${he}" already exists.`:null},lt=async(he,Ae,He)=>{await se.mutateAsync({blockKey:Ae,data:{...He,name:Ae,__resolveType:he}}),xe.success(c("sandbox.contentBrowser.createdSection",{name:Ae})),x({collection:"sections",key:Ae})},Oe=bx((he,Ae)=>se.mutate({blockKey:he,data:Ae})),vt=async he=>{const Ae=u[he.key];if(!Ae){xe.error(c("sandbox.contentBrowser.sectionNotFound"));return}const He=Xle(u,he.key),Le=Tv(Me,he.name),De={...Ae,name:Le};try{await se.mutateAsync({blockKey:He,data:De}),xe.success(c("sandbox.contentBrowser.duplicatedSection",{name:he.name})),x({collection:"sections",key:He})}catch(Qe){xe.error(Qe instanceof Error?Qe.message:c("sandbox.contentBrowser.duplicateFailed"))}},_e=async he=>{if(!Z)return;const Ae=u[Z];if(!Ae){xe.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await se.mutateAsync({blockKey:Z,data:{...Ae,name:he}}),xe.success(c("sandbox.contentBrowser.sectionRenamed")),le(null)}catch(He){xe.error(He instanceof Error?He.message:c("sandbox.contentBrowser.renameFailed"))}},Ue=async()=>{const he="/redirect-from",Ae=QB(u,he),He=GB({from:he,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await se.mutateAsync({blockKey:Ae,data:He}),xe.success("Created redirect"),x({collection:"redirects",key:Ae})}catch(Le){xe.error(Le instanceof Error?Le.message:"Could not create redirect")}},st=async he=>{const Ae=dm(u,he),He=yc(Ae,he,Kj(he));try{await se.mutateAsync({blockKey:Ae,data:He}),xe.success(`Created ${_u[he]}`),x({collection:he,key:Ae})}catch(Le){xe.error(Le instanceof Error?Le.message:"Could not create")}},gt=async he=>{const Ae=dm(u,"posts"),He=yc(Ae,"posts",kae(he));try{await se.mutateAsync({blockKey:Ae,data:He}),xe.success(c("sandbox.postCalendar.createdScheduledPost")),p("posts"),F("posts"),x({collection:"posts",key:Ae}),y(null)}catch(Le){xe.error(Le instanceof Error?Le.message:c("sandbox.postCalendar.couldNotCreate"))}},pt=async(he,Ae)=>{const He=u[he],Le=He?Cae(nu(He,"posts"),Ae):null;if(!Le){xe.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await se.mutateAsync({blockKey:he,data:yc(he,"posts",Le)})}catch(De){xe.error(De instanceof Error?De.message:c("sandbox.postCalendar.couldNotReschedule"))}},Vt=async he=>{const Ae=u[he.key];if(!Ae){xe.error("Record not found.");return}const He=dm(u,he.kind),Le=he.kind==="posts"?"title":"name",De={...structuredClone(nu(Ae,he.kind)),[Le]:`${he.label} (copy)`};try{await se.mutateAsync({blockKey:He,data:yc(He,he.kind,De)}),xe.success(`Duplicated "${he.label}"`),x({collection:he.kind,key:He})}catch(Qe){xe.error(Qe instanceof Error?Qe.message:"Duplicate failed")}},bt=he=>{I(Ae=>{const He=new Set(Ae);return He.has(he)?He.delete(he):He.add(he),He})},_t=he=>{p("posts"),F("posts"),x(null),y(null),S(""),j(null),T(null),V(null),E("date-desc"),I(new Set),O(he||null)},tt=async(he,Ae)=>{const He=[...R];let Le=0;for(const De of He){const Qe=u[De],Be=nu(Qe,"posts"),Lt=he==="add"?pae(Be,Ae):gae(Be,Ae);Lt!==Be&&(await se.mutateAsync({blockKey:De,data:yc(De,"posts",Av(Lt))}),Le+=1)}return Le},ft=async(he,Ae)=>{const He=R.size;try{const Le=await tt(he,Ae),De=he==="add"?"Added to":"Moved",Qe=He-Le;xe.success(`${De} ${Le} ${Le===1?"post":"posts"}`+(Qe>0?` (${Qe} already set)`:"")),z()}catch(Le){xe.error(Le instanceof Error?Le.message:"Bulk update failed")}},xt=async()=>{if(ee)try{if(ee.kind==="blog-bulk"){for(const Le of ee.keys)await oe.mutateAsync({blockKey:Le});xe.success(`Deleted ${ee.count} ${ee.count===1?"post":"posts"}`),g&&g.collection!=="available-section"&&ee.keys.includes(g.key)&&x(null),z(),ae(null);return}const{kind:he,key:Ae,label:He}=ee;if(he==="blog"){if(ee.blogKind==="categories"){const Le=nu(u[Ae],"categories").slug,De=typeof Le=="string"?Le:"";if(De)for(const{key:Qe,payload:Be}of Gu(u,"posts")){const Lt=xae(Be,De);Lt!==Be&&await se.mutateAsync({blockKey:Qe,data:yc(Qe,"posts",Av(Lt))})}}await oe.mutateAsync({blockKey:Ae})}else await oe.mutateAsync({blockKey:Ae});xe.success(`Deleted "${He}"`),g&&g.collection!=="available-section"&&g.key===Ae&&x(null),ae(null)}catch(he){xe.error(he instanceof Error?he.message:"Delete failed")}},Ee=oe.isPending||se.isPending,dt=ee?.kind==="blog"?_u[ee.blogKind]:ee?.kind==="blog-bulk"?`${ee.count} ${ee.count===1?"post":"posts"}`:ee?.kind??"item";return o.jsxs("div",{className:"flex h-full w-full",children:[o.jsx(qle,{active:m,counts:et,showBlog:ke,onSelect:he=>{p(he),x(null),y(null)}}),m!=="seo"&&m!=="site"&&m!=="calendar"&&m!=="post-schedule"&&m!=="loaders"&&m!=="actions"&&o.jsx(zce,{activeCollection:m,pages:pe,redirects:te,sections:ge,availableSections:ve,appCatalog:G,appCatalogLoading:Y,blogEntries:we,decofile:u,searchQuery:w,onSearchChange:S,postCategoryFilter:k,postAuthorFilter:C,postStatusFilter:N,postSort:A,onPostCategoryFilterChange:he=>{j(he),I(new Set)},onPostAuthorFilterChange:he=>{T(he),I(new Set)},onPostStatusFilterChange:he=>{V(he),I(new Set)},onPostSortChange:E,selectedPostKeys:R,postBulkPanelOpen:me,onTogglePostSelect:bt,onSelectAllPosts:he=>I(new Set(he)),onClearPostSelection:()=>I(new Set),onExitPostSelection:z,onBulkDeletePosts:()=>ae({kind:"blog-bulk",keys:[...R],count:R.size}),selection:g,onSelect:M,onCreate:()=>{m==="pages"?nt():m==="redirects"?Ue():Lu(m)&&st(m)},onDuplicatePage:it,onRenamePage:ut,onAddPageVariant:rt,onDeletePage:he=>ae({kind:"page",key:he.key,label:he.name}),onEditPageSeo:he=>{const Ae={collection:"pages",key:he.key,path:he.path};x(Ae),y(he.key)},onViewPageJson:he=>fe(he.key),onDuplicateSection:vt,onRenameSection:he=>le(he.key),onDeleteSection:he=>ae({kind:"section",key:he.key,label:he.name}),onDeleteRedirect:he=>ae({kind:"redirect",key:he.key,label:he.from||he.key}),onDuplicateBlog:Vt,onDeleteBlog:he=>ae({kind:"blog",blogKind:he.kind,key:he.key,label:he.label})}),o.jsx("div",{className:"flex-1 min-w-0",children:m==="loaders"||m==="actions"?o.jsx(zae,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:U,decofile:u,kind:m}):o.jsx(P.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(ot,{size:20,className:"animate-spin text-muted-foreground"})}),children:m==="calendar"?o.jsx(Dce,{decofile:u}):m==="post-schedule"?o.jsx(Ice,{decofile:u,support:J,isCreating:se.isPending,onCreate:he=>{gt(he)},onReschedule:(he,Ae)=>{pt(he,Ae)},onSelect:he=>{p("posts"),F("posts"),x({collection:"posts",key:he}),y(null)}}):m==="site"?Se?o.jsx(Hv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:Se.key,block:u[Se.key],decofile:u,meta:U,title:"Site",excludeFields:["seo"],schemaPending:W(Se.resolveType,["seo"]),previewBaseUrl:n},`site:${Se.key}`):o.jsx(Fo,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):m==="seo"?o.jsx(Rce,{orgSlug:t,virtualMcpId:e,branch:s,decofile:u,meta:U,target:{kind:"site"},previewBaseUrl:i}):m==="sections"?o.jsx(xce,{selection:g?.collection==="sections"||g?.collection==="available-section"?g:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:U,decofile:u,isCreating:se.isPending,onCreateAvailable:lt,onSaveReferencedBlock:Oe}):me?o.jsx(Pce,{posts:Ce,categories:je,initialSlug:D,isPending:se.isPending,onApply:(he,Ae)=>{ft(he,Ae)},onClose:z},D??"selection"):g&&g.collection!=="available-section"?g.collection==="apps"?o.jsx(Hv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key],decofile:u,meta:U,previewBaseUrl:n,schemaPending:W(typeof u[g.key]?.__resolveType=="string"?String(u[g.key].__resolveType):void 0)},`app:${g.key}`):g.collection==="posts"?o.jsx(Tce,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key],decofile:u,meta:U,previewBaseUrl:i},`post:${g.key}`):g.collection==="categories"?o.jsx(Ace,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key],decofile:u,meta:U,onManagePosts:_t,onOpenPost:he=>{p("posts"),F("posts"),x({collection:"posts",key:he}),y(null)},previewBaseUrl:i},`category:${g.key}`):g.collection==="authors"?o.jsx(Vce,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:g.key,block:u[g.key]},`authors:${g.key}`):g.collection==="redirects"?o.jsx(Mce,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key]},`redirect:${g.key}`):o.jsx(Ece,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:g.collection==="pages"?g.path:"/",activePageBlockKey:g.collection==="pages"?g.key:null,activeGlobalBlockKey:g.collection==="sections"?g.key:null,initialEditSeo:g.collection==="pages"&&b===g.key,onExitSeo:()=>y(null)},g.collection==="pages"?`page:${g.key}`:`section:${g.key}`):o.jsx(Fo,{title:`Select ${Lu(m)?`a ${_u[m]}`:m==="pages"?"a page":m==="apps"?"an app":m==="redirects"?"a redirect":"a section"} to edit`,description:m==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),ne&&o.jsx(oae,{open:!!ne,mode:ne.mode,initialName:ne.initialName,initialPath:ne.initialPath,isPending:se.isPending,error:K,templates:pe,validate:ct,onSubmit:Ct,onOpenChange:he=>{he||(Q(null),X(void 0))}}),Z&&o.jsx(lae,{open:!!Z,blockKey:Z,initialName:ge.find(he=>he.key===Z)?.name??Z,isPending:se.isPending,onSubmit:_e,onOpenChange:he=>{he||le(null)}}),ce&&o.jsx(Dae,{open:!!ce,onOpenChange:he=>{he||fe(null)},pageKey:ce,decofile:u,onSave:he=>se.mutateAsync({blockKey:ce,data:he})}),o.jsx(el,{open:!!ee,onOpenChange:he=>{!he&&!Ee&&ae(null)},children:o.jsxs(tl,{children:[o.jsxs(sl,{children:[o.jsx(nl,{children:`Delete ${dt}?`}),o.jsx(il,{children:ee?.kind==="section"?`"${ee.label}" will be removed. Pages that still reference it will lose this section.`:ee?.kind==="blog-bulk"?`${ee.count} ${ee.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:ee?`"${ee.label}" will be removed permanently. This can't be undone.`:null})]}),o.jsxs(rl,{children:[o.jsx(ol,{disabled:Ee,children:"Cancel"}),o.jsx(ll,{onClick:he=>{he.preventDefault(),xt()},disabled:Ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Ee?o.jsxs(o.Fragment,{children:[o.jsx(ot,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function zce(t){const e=B.c(82),{activeCollection:s,pages:n,redirects:i,sections:r,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:f,searchQuery:u,onSearchChange:h,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:y,onPostStatusFilterChange:L,onPostSortChange:v,selectedPostKeys:_,postBulkPanelOpen:w,onTogglePostSelect:S,onSelectAllPosts:k,onClearPostSelection:j,onExitPostSelection:C,onBulkDeletePosts:T,selection:N,onSelect:V,onCreate:A,onDuplicatePage:E,onRenamePage:R,onAddPageVariant:I,onDeletePage:D,onEditPageSeo:O,onViewPageJson:z,onDuplicateSection:M,onRenameSection:$,onDeleteSection:F,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:q}=t;let W,G,Y,J,se,oe,ne;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==f||e[6]!==I||e[7]!==T||e[8]!==j||e[9]!==A||e[10]!==q||e[11]!==D||e[12]!==U||e[13]!==F||e[14]!==H||e[15]!==E||e[16]!==M||e[17]!==O||e[18]!==C||e[19]!==y||e[20]!==b||e[21]!==v||e[22]!==L||e[23]!==R||e[24]!==$||e[25]!==h||e[26]!==V||e[27]!==k||e[28]!==S||e[29]!==z||e[30]!==n||e[31]!==p||e[32]!==w||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==u||e[38]!==r||e[39]!==_||e[40]!==N){const Z=u.toLowerCase(),le=n.filter(_e=>!Z||_e.name.toLowerCase().includes(Z)||_e.path.toLowerCase().includes(Z)),ee=i.filter(_e=>!Z||_e.from.toLowerCase().includes(Z)||_e.to.toLowerCase().includes(Z)),ae=r.filter(_e=>!Z||_e.name.toLowerCase().includes(Z)||_e.key.toLowerCase().includes(Z)||_e.resolveType.toLowerCase().includes(Z)),ce=l.filter(_e=>!Z||_e.title.toLowerCase().includes(Z)||_e.resolveType.toLowerCase().includes(Z)||(_e.description?.toLowerCase().includes(Z)??!1)),fe=Nce(ae),de=a.filter(_e=>!Z||_e.title.toLowerCase().includes(Z)||_e.app.toLowerCase().includes(Z)||_e.vendor.toLowerCase().includes(Z)||_e.category.toLowerCase().includes(Z)),pe=d.filter(_e=>!Z||_e.label.toLowerCase().includes(Z)||_e.subtitle.toLowerCase().includes(Z)),te=s==="posts",ge=Kce,ve=te?Hj(f):[],Se=new Map,ye=new Map,ke={published:0,scheduled:0,draft:0};for(const _e of ve)ke[_e.status]=ke[_e.status]+1;for(const _e of ve){for(const Ue of _e.categorySlugs)Se.set(Ue,(Se.get(Ue)??0)+1);for(const Ue of _e.authorEmails)ye.set(Ue,(ye.get(Ue)??0)+1)}const we=(te?Gu(f,"categories"):[]).map(_e=>{const{key:Ue,payload:st}=_e,gt=ge(st.slug)||Ue;return{slug:gt,name:ge(st.name)||ge(st.slug)||Ue,count:Se.get(gt)??0}}).filter(Hce),je=(te?Gu(f,"authors"):[]).map(_e=>{const{key:Ue,payload:st}=_e,gt=ge(st.email);return{email:gt,name:ge(st.name)||ge(st.email)||Ue,count:ye.get(gt)??0}}).filter(Uce);let me;e[48]!==m?(me=_e=>!m||_e.categorySlugs.includes(m),e[48]=m,e[49]=me):me=e[49];let Ce;e[50]!==p?(Ce=_e=>!p||_e.authorEmails.includes(p),e[50]=p,e[51]=Ce):Ce=e[51];let Ne;e[52]!==g?(Ne=_e=>!g||_e.status===g,e[52]=g,e[53]=Ne):Ne=e[53];let Ie;e[54]!==x?(Ie=(_e,Ue)=>{if(x==="az")return _e.title.localeCompare(Ue.title);if(x==="za")return Ue.title.localeCompare(_e.title);const st=_e.date.localeCompare(Ue.date);return x==="date-asc"?st:-st},e[54]=x,e[55]=Ie):Ie=e[55];const et=ve.filter(_e=>!Z||_e.title.toLowerCase().includes(Z)||_e.slug.toLowerCase().includes(Z)).filter(me).filter(Ce).filter(Ne).sort(Ie),Ze=_.size,Te=et.map(Fce),Me=Te.length>0&&Te.every(_e=>_.has(_e)),rt=Ze>0||w,nt=()=>{Me?j():k(Te)},it=`Search ${s}…`,ut=Lu(s)?`Create new ${_u[s]}`:s==="redirects"?"Create new redirect":"Create new page",Ct=s!=="apps"&&s!=="sections";se="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let ct;e[56]===Symbol.for("react.memo_cache_sentinel")?(ct=o.jsx(k9,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=ct):ct=e[56];let lt;e[57]!==h?(lt=_e=>h(_e.target.value),e[57]=h,e[58]=lt):lt=e[58];let Oe;e[59]!==it||e[60]!==u||e[61]!==lt?(Oe=o.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[ct,o.jsx("input",{type:"text",value:u,onChange:lt,placeholder:it,"aria-label":it,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=it,e[60]=u,e[61]=lt,e[62]=Oe):Oe=e[62];let vt;e[63]!==ut||e[64]!==A||e[65]!==Ct?(vt=Ct&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon",onClick:A,"aria-label":ut,children:o.jsx(Kt,{size:14})})}),o.jsx(We,{side:"bottom",children:ut})]}),e[63]=ut,e[64]=A,e[65]=Ct,e[66]=vt):vt=e[66],e[67]!==Oe||e[68]!==vt?(oe=o.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[Oe,vt]}),e[67]=Oe,e[68]=vt,e[69]=oe):oe=e[69],ne=te&&(rt?o.jsx(kce,{count:Ze,allSelected:Me,onToggleSelectAll:nt,onDelete:T,onExit:C}):o.jsx(vce,{categories:we,authors:je,categoryFilter:m,statusCounts:ke,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:y,onStatusFilterChange:L,onSortChange:v})),W=xl,J="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",G="flex flex-col gap-1 p-1.5",Y=s==="pages"?le.length===0?o.jsx(vc,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):le.map(_e=>{const Ue=N?.collection==="pages"&&N.key===_e.key,st=vk(f,_e.key);return o.jsx(vi,{icon:Ko,title:_e.name,subtitle:_e.path,active:Ue,variantCount:st,onClick:()=>V({collection:"pages",key:_e.key,path:_e.path}),menu:o.jsx(Fd,{onDuplicate:()=>E(_e),onRename:()=>R(_e),onAddVariant:()=>I(_e),onEditSeo:()=>O(_e),onViewJson:()=>z(_e),onDelete:()=>D(_e)})},_e.key)}):s==="sections"?ae.length===0&&ce.length===0?o.jsx(vc,{hasItems:r.length>0||l.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):o.jsxs(o.Fragment,{children:[fe.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Uv,{icon:Hl,label:"Saved sections"}),fe.map(_e=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:_e.label}),_e.sections.map(Ue=>{const st=N?.collection==="sections"&&N.key===Ue.key;return o.jsx(vi,{icon:Hl,accent:"global",title:Ue.name,subtitle:_e.label,active:st,onClick:()=>V({collection:"sections",key:Ue.key}),menu:o.jsx(Fd,{onDuplicate:()=>M(Ue),onRename:()=>$(Ue),onDelete:()=>F(Ue)})},Ue.key)})]},_e.label))]}),ce.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Uv,{icon:Ko,label:"Available sections",className:ie(fe.length>0&&"mt-3")}),ce.map(_e=>{const Ue=N?.collection==="available-section"&&N.resolveType===_e.resolveType,st=_e.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return o.jsx(vi,{icon:Ko,title:_e.title,subtitle:st??_e.resolveType,active:Ue,onClick:()=>V({collection:"available-section",resolveType:_e.resolveType,title:_e.title})},_e.resolveType)})]})]}):s==="apps"?c?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(ot,{size:18,className:"animate-spin text-muted-foreground"})}):de.length===0?o.jsx(vc,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):de.map(_e=>{const Ue=N?.collection==="apps"&&_e.blockKey!==null&&N.key===_e.blockKey;return o.jsx(vi,{icon:f7,logoUrl:_e.logo,title:_e.title,subtitle:_e.category,active:Ue,trailing:_e.installed?o.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!_e.installed||!_e.blockKey){xe.message(`${_e.title} is not installed on this site.`);return}V({collection:"apps",key:_e.blockKey})}},_e.id)}):s==="redirects"?ee.length===0?o.jsx(vc,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):ee.map(_e=>o.jsx(vi,{icon:y8,title:_e.from||"(no source)",subtitle:`→ ${_e.to||"(no target)"}`,active:N?.collection==="redirects"&&N.key===_e.key,trailing:o.jsx(aae,{type:_e.type}),onClick:()=>V({collection:"redirects",key:_e.key}),menu:o.jsx(Fd,{onDelete:()=>U(_e)})},_e.key)):te?et.length===0?o.jsx(vc,{hasItems:ve.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):et.map(_e=>{const Ue={key:_e.key,kind:"posts",label:_e.title,subtitle:_e.slug};return o.jsx(vi,{icon:Qr,title:_e.title,subtitle:_e.slug||"no slug",invalid:_e.missing.length>0,invalidReason:`Missing: ${_e.missing.join(", ")}`,active:N?.collection==="posts"&&N.key===_e.key,selectable:!0,selectionActive:rt,selected:_.has(_e.key),onToggleSelect:()=>S(_e.key),onClick:()=>rt?S(_e.key):V({collection:"posts",key:_e.key}),menu:o.jsx(Fd,{onDuplicate:()=>H(Ue),onDelete:()=>q(Ue)})},_e.key)}):pe.length===0?o.jsx(vc,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${Lu(s)?_u[s]:"item"}.`}):pe.map(_e=>{const Ue=N?.collection===_e.kind&&N.key===_e.key;return o.jsx(vi,{icon:_e.kind==="posts"?Qr:_e.kind==="authors"?Cg:c9,title:_e.label,subtitle:_e.subtitle,active:Ue,onClick:()=>V({collection:_e.kind,key:_e.key}),menu:o.jsx(Fd,{onDuplicate:()=>H(_e),onDelete:()=>q(_e)})},_e.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=f,e[6]=I,e[7]=T,e[8]=j,e[9]=A,e[10]=q,e[11]=D,e[12]=U,e[13]=F,e[14]=H,e[15]=E,e[16]=M,e[17]=O,e[18]=C,e[19]=y,e[20]=b,e[21]=v,e[22]=L,e[23]=R,e[24]=$,e[25]=h,e[26]=V,e[27]=k,e[28]=S,e[29]=z,e[30]=n,e[31]=p,e[32]=w,e[33]=m,e[34]=x,e[35]=g,e[36]=i,e[37]=u,e[38]=r,e[39]=_,e[40]=N,e[41]=W,e[42]=G,e[43]=Y,e[44]=J,e[45]=se,e[46]=oe,e[47]=ne}else W=e[41],G=e[42],Y=e[43],J=e[44],se=e[45],oe=e[46],ne=e[47];let Q;e[70]!==G||e[71]!==Y?(Q=o.jsx("div",{className:G,children:Y}),e[70]=G,e[71]=Y,e[72]=Q):Q=e[72];let K;e[73]!==W||e[74]!==J||e[75]!==Q?(K=o.jsx(W,{className:J,children:Q}),e[73]=W,e[74]=J,e[75]=Q,e[76]=K):K=e[76];let X;return e[77]!==se||e[78]!==oe||e[79]!==ne||e[80]!==K?(X=o.jsxs("div",{className:se,children:[oe,ne,K]}),e[77]=se,e[78]=oe,e[79]=ne,e[80]=K,e[81]=X):X=e[81],X}function Fce(t){return t.key}function Uce(t){return t.email}function Hce(t){return t.slug}function Kce(t){return typeof t=="string"?t:""}function Wce(t){const e=B.c(17),{virtualMcpId:s}=t,n=re(),i=Is(s),{activeTask:r}=sn();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const a=hl(l);if(!(Zs(i?.metadata)||Zs(r?.metadata))){let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(pn,{size:24,className:"text-muted-foreground/60"}),e[1]=f):f=e[1];let u;e[2]!==n?(u=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=u):u=e[3];let h;e[4]!==u?(h=o.jsx("div",{children:u}),e[4]=u,e[5]=h):h=e[5];let m;e[6]!==n?(m=n("mainPanelTabs.contentTab.connectGithubDescription"),e[6]=n,e[7]=m):m=e[7];let p;e[8]!==m?(p=o.jsx("div",{className:"text-xs text-muted-foreground/80",children:m}),e[8]=m,e[9]=p):p=e[9];let g;return e[10]!==h||e[11]!==p?(g=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[f,h,p]}),e[10]=h,e[11]=p,e[12]=g):g=e[12],g}let d;return e[13]!==a.contentPageId||e[14]!==a.contentPath||e[15]!==a.contentPathTemplate?(d=o.jsx(Oce,{deepLinkPage:{pageId:a.contentPageId,path:a.contentPath,pathTemplate:a.contentPathTemplate}}),e[13]=a.contentPageId,e[14]=a.contentPath,e[15]=a.contentPathTemplate,e[16]=d):d=e[16],d}function qce(t){const e=B.c(6),{virtualMcpId:s}=t,n=Is(s),i=K8();let r;e[0]!==i||e[1]!==n?(r=D9(i,vL(n)),e[0]=i,e[1]=n,e[2]=r):r=e[2];const l=r;if(!l){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Gce,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=o.jsx(Qce,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function Gce(){const t=B.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:o.jsx(wg,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("assets.browser.noBucketTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("assets.browser.noBucketDescription"),t[5]=e,t[6]=r):r=t[6];let l;t[7]!==r?(l=o.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=o.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-3 p-10 text-center",children:[s,o.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function Yce(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function Jce(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function Qce(t){const e=B.c(99),{config:s}=t,n=re(),[i,r]=P.useState(""),l=j9(i,300);let a;e[0]!==s.id||e[1]!==l?(a={configId:s.id,search:l},e[0]=s.id,e[1]=l,e[2]=a):a=e[2];const c=cj(a),d=r1(),[f,u]=P.useState(!1),[h,m]=P.useState(null),p=P.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(M){if(!M)return;const $=Array.from(M);if($.length===0)return;const F=[];for(const U of $)try{await d.mutateAsync({configId:s.id,file:U})}catch(H){const q=H;F.push(`${U.name} (${q instanceof Error?q.message:"upload failed"})`)}await c.refetch(),F.length>0&&xe.error(F.length===$.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:F.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:F.join("; ")}))},e[3]=s.id,e[4]=c,e[5]=n,e[6]=d,e[7]=g):g=e[7];const x=g;let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=function(M){M.preventDefault(),u(!0)},e[8]=b):b=e[8];const y=b;let L;e[9]===Symbol.for("react.memo_cache_sentinel")?(L=function(){u(!1)},e[9]=L):L=e[9];const v=L;let _;e[10]!==x?(_=function(M){M.preventDefault(),M.stopPropagation(),u(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=_):_=e[11];const w=_,[S,k]=sp();let j,C,T,N,V,A;if(e[12]!==s.name||e[13]!==l||e[14]!==k||e[15]!==S||e[16]!==x||e[17]!==f||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==w||e[22]!==i||e[23]!==n||e[24]!==d.isPending){const M=(c.data?.pages??[]).flatMap(Xce),$=Jce(M,Yce(S)),F=l.trim(),U=i!==l||c.isFetching&&!c.isFetchingNextPage;V="flex h-full min-h-0 flex-col gap-3 p-4";let H;e[31]!==n?(H=n("assets.browser.title"),e[31]=n,e[32]=H):H=e[32];let q;e[33]!==H?(q=o.jsx("h2",{className:"text-sm font-semibold",children:H}),e[33]=H,e[34]=q):q=e[34];let W;e[35]!==s.name||e[36]!==n?(W=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=W):W=e[37];let G;e[38]!==W?(G=o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:W}),e[38]=W,e[39]=G):G=e[39];let Y;e[40]!==q||e[41]!==G?(Y=o.jsxs("div",{className:"min-w-0",children:[q,G]}),e[40]=q,e[41]=G,e[42]=Y):Y=e[42];let J;e[43]===Symbol.for("react.memo_cache_sentinel")?(J=()=>p.current?.click(),e[43]=J):J=e[43];let se;e[44]!==d.isPending?(se=d.isPending?o.jsx(ot,{size:14,className:"animate-spin"}):o.jsx(Gn,{size:14}),e[44]=d.isPending,e[45]=se):se=e[45];let oe;e[46]!==n||e[47]!==d.isPending?(oe=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=oe):oe=e[48];let ne;e[49]!==se||e[50]!==oe||e[51]!==d.isPending?(ne=o.jsxs(ue,{type:"button",size:"sm",disabled:d.isPending,onClick:J,children:[se,oe]}),e[49]=se,e[50]=oe,e[51]=d.isPending,e[52]=ne):ne=e[52];let Q;e[53]!==x?(Q=o.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:pe=>{const te=Array.from(pe.target.files??[]);pe.target.value="",x(te)}}),e[53]=x,e[54]=Q):Q=e[54],e[55]!==Y||e[56]!==ne||e[57]!==Q?(A=o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[Y,ne,Q]}),e[55]=Y,e[56]=ne,e[57]=Q,e[58]=A):A=e[58];let K;e[59]!==n?(K=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=K):K=e[60],e[61]!==U||e[62]!==i||e[63]!==K?(j=o.jsx(L9,{value:i,onChange:r,isSearching:U,placeholder:K,className:"shrink-0"}),e[61]=U,e[62]=i,e[63]=K,e[64]=j):j=e[64];let X;e[65]===Symbol.for("react.memo_cache_sentinel")?(X=()=>p.current?.click(),e[65]=X):X=e[65];const Z=f&&"border-primary bg-primary/5",le=d.isPending&&"pointer-events-none opacity-60";let ee;e[66]!==Z||e[67]!==le?(ee=ie("flex shrink-0 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border/60 p-4 text-center transition-colors",Z,le),e[66]=Z,e[67]=le,e[68]=ee):ee=e[68];let ae;e[69]===Symbol.for("react.memo_cache_sentinel")?(ae=o.jsx(Gn,{size:16,className:"text-muted-foreground"}),e[69]=ae):ae=e[69];let ce;e[70]!==n?(ce=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=ce):ce=e[71];let fe;e[72]!==n?(fe=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=fe):fe=e[73];let de;e[74]!==ce||e[75]!==fe?(de=o.jsxs("p",{className:"text-xs text-muted-foreground",children:[ce," ",fe]}),e[74]=ce,e[75]=fe,e[76]=de):de=e[76],e[77]!==w||e[78]!==ee||e[79]!==de?(C=o.jsxs("button",{type:"button",onClick:X,onDragOver:y,onDragLeave:v,onDrop:w,className:ee,children:[ae,de]}),e[77]=w,e[78]=ee,e[79]=de,e[80]=C):C=e[80],T="min-h-0 flex-1 overflow-y-auto pr-1",N=M.length===0?F?o.jsx(qv,{title:n("filePicker.filePickerDialog.noMatches",{query:F}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):o.jsx(qv,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):o.jsx("div",{ref:k,className:"flex items-start gap-3",children:$.map((pe,te)=>o.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:pe.map(ge=>o.jsx(Zce,{item:ge,onDelete:()=>m(ge)},ge.key))},te))}),e[12]=s.name,e[13]=l,e[14]=k,e[15]=S,e[16]=x,e[17]=f,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=w,e[22]=i,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=C,e[27]=T,e[28]=N,e[29]=V,e[30]=A}else j=e[25],C=e[26],T=e[27],N=e[28],V=e[29],A=e[30];let E;e[81]!==c||e[82]!==n?(E=c.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(ue,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(ot,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=E):E=e[83];let R;e[84]!==E||e[85]!==T||e[86]!==N?(R=o.jsxs("div",{className:T,children:[N,E]}),e[84]=E,e[85]=T,e[86]=N,e[87]=R):R=e[87];let I;e[88]===Symbol.for("react.memo_cache_sentinel")?(I=()=>m(null),e[88]=I):I=e[88];let D;e[89]!==s.id||e[90]!==h?(D=o.jsx(sde,{configId:s.id,item:h,onClose:I}),e[89]=s.id,e[90]=h,e[91]=D):D=e[91];let O;return e[92]!==j||e[93]!==C||e[94]!==R||e[95]!==D||e[96]!==V||e[97]!==A?(O=o.jsxs("div",{className:V,children:[A,j,C,R,D]}),e[92]=j,e[93]=C,e[94]=R,e[95]=D,e[96]=V,e[97]=A,e[98]=O):O=e[98],O}function Xce(t){return t.items}function qv(t){const e=B.c(8),{title:s,description:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(fr,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx("p",{className:"text-sm font-medium",children:s}),e[1]=s,e[2]=r):r=e[2];let l;e[3]!==n?(l=o.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==r||e[6]!==l?(a=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,r,l]}),e[5]=r,e[6]=l,e[7]=a):a=e[7],a}function Zce(t){const e=B.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=dj(s.key),e[0]=s.key,e[1]=i):i=e[1];const r=i;let l;e[2]!==s.key?(l=Cx(s.key),e[2]=s.key,e[3]=l):l=e[3];const a=l;let c;e[4]!==a||e[5]!==s.key||e[6]!==s.publicUrl?(c=a?o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:ede}):o.jsx("div",{className:"flex aspect-square items-center justify-center",children:o.jsx(Qr,{size:28,className:"text-muted-foreground"})}),e[4]=a,e[5]=s.key,e[6]=s.publicUrl,e[7]=c):c=e[7];let d;e[8]!==s.key||e[9]!==s.publicUrl||e[10]!==c?(d=o.jsx("a",{href:s.publicUrl,target:"_blank",rel:"noreferrer",title:s.key,className:"block transition hover:ring-2 hover:ring-inset hover:ring-primary",children:c}),e[8]=s.key,e[9]=s.publicUrl,e[10]=c,e[11]=d):d=e[11];const f=s.key;let u;e[12]!==s.key?(u=Rh(s.key),e[12]=s.key,e[13]=u):u=e[13];let h;e[14]!==s.key||e[15]!==u?(h=o.jsx("p",{className:"truncate text-xs font-medium",title:f,children:u}),e[14]=s.key,e[15]=u,e[16]=h):h=e[16];let m;e[17]!==s.size?(m=uj(s.size),e[17]=s.size,e[18]=m):m=e[18];let p;e[19]!==r||e[20]!==m?(p=o.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[r," · ",m]}),e[19]=r,e[20]=m,e[21]=p):p=e[21];let g;e[22]!==h||e[23]!==p?(g=o.jsxs("div",{className:"min-w-0 flex-1",children:[h,p]}),e[22]=h,e[23]=p,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=o.jsx(tde,{item:s,onDelete:n}),e[25]=s,e[26]=n,e[27]=x):x=e[27];let b;e[28]!==g||e[29]!==x?(b=o.jsxs("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background px-2 py-1.5",children:[g,x]}),e[28]=g,e[29]=x,e[30]=b):b=e[30];let y;return e[31]!==b||e[32]!==d?(y=o.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border/60 bg-muted",children:[d,b]}),e[31]=b,e[32]=d,e[33]=y):y=e[33],y}function ede(t){t.target.style.display="none"}function tde(t){const e=B.c(36),{item:s,onDelete:n}=t,i=re(),[r,l]=P.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(){try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{xe.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Rg,{size:14}),e[5]=f):f=e[5];let u;e[6]!==d?(u=o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:f})}),e[6]=d,e[7]=u):u=e[7];let h;e[8]!==r?(h=r?o.jsx(Ft,{size:14}):o.jsx(an,{size:14}),e[8]=r,e[9]=h):h=e[9];let m;e[10]!==r||e[11]!==i?(m=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=r,e[11]=i,e[12]=m):m=e[12];let p;e[13]!==c||e[14]!==h||e[15]!==m?(p=o.jsxs(Xe,{onClick:c,children:[h,m]}),e[13]=c,e[14]=h,e[15]=m,e[16]=p):p=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(hn,{size:14}),e[17]=x):x=e[17];let b;e[18]!==i?(b=i("filePicker.filePickerDialog.openInNewTab"),e[18]=i,e[19]=b):b=e[19];let y;e[20]!==s.publicUrl||e[21]!==b?(y=o.jsx(Xe,{asChild:!0,children:o.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=y):y=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(tn,{size:14}),e[23]=L):L=e[23];let v;e[24]!==i?(v=i("assets.browser.deleteAction"),e[24]=i,e[25]=v):v=e[25];let _;e[26]!==n||e[27]!==v?(_=o.jsxs(Xe,{variant:"destructive",onClick:n,children:[L,v]}),e[26]=n,e[27]=v,e[28]=_):_=e[28];let w;e[29]!==y||e[30]!==_||e[31]!==p?(w=o.jsxs(zt,{align:"end",children:[p,y,_]}),e[29]=y,e[30]=_,e[31]=p,e[32]=w):w=e[32];let S;return e[33]!==w||e[34]!==u?(S=o.jsxs($t,{children:[u,w]}),e[33]=w,e[34]=u,e[35]=S):S=e[35],S}function sde(t){const e=B.c(47),{configId:s,item:n,onClose:i}=t,r=re(),l=mre();let a;e[0]!==s||e[1]!==l||e[2]!==n||e[3]!==i||e[4]!==r?(a=async function(){if(n)try{await l.mutateAsync({configId:s,key:n.key}),xe.success(r("assets.browser.deleted")),i()}catch{xe.error(r("assets.browser.deleteFailed"))}},e[0]=s,e[1]=l,e[2]=n,e[3]=i,e[4]=r,e[5]=a):a=e[5];const c=a,d=!!n;let f;e[6]!==i?(f=N=>!N&&i(),e[6]=i,e[7]=f):f=e[7];let u;e[8]!==r?(u=r("assets.browser.deleteConfirmTitle"),e[8]=r,e[9]=u):u=e[9];let h;e[10]!==u?(h=o.jsx(nl,{children:u}),e[10]=u,e[11]=h):h=e[11];let m;e[12]!==n||e[13]!==r?(m=r("assets.browser.deleteConfirmDescription",{name:n?Rh(n.key):""}),e[12]=n,e[13]=r,e[14]=m):m=e[14];let p;e[15]!==m?(p=o.jsx(il,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==h||e[18]!==p?(g=o.jsxs(sl,{children:[h,p]}),e[17]=h,e[18]=p,e[19]=g):g=e[19];const x=l.isPending;let b;e[20]!==r?(b=r("assets.browser.deleteCancel"),e[20]=r,e[21]=b):b=e[21];let y;e[22]!==l.isPending||e[23]!==b?(y=o.jsx(ol,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=y):y=e[24];let L;e[25]===Symbol.for("react.memo_cache_sentinel")?(L=ie($6({variant:"destructive"})),e[25]=L):L=e[25];const v=l.isPending;let _;e[26]!==c?(_=N=>{N.preventDefault(),c()},e[26]=c,e[27]=_):_=e[27];let w;e[28]!==l.isPending?(w=l.isPending?o.jsx(ot,{size:14,className:"animate-spin"}):null,e[28]=l.isPending,e[29]=w):w=e[29];let S;e[30]!==r?(S=r("assets.browser.deleteConfirm"),e[30]=r,e[31]=S):S=e[31];let k;e[32]!==l.isPending||e[33]!==_||e[34]!==w||e[35]!==S?(k=o.jsxs(ll,{className:L,disabled:v,onClick:_,children:[w,S]}),e[32]=l.isPending,e[33]=_,e[34]=w,e[35]=S,e[36]=k):k=e[36];let j;e[37]!==y||e[38]!==k?(j=o.jsxs(rl,{children:[y,k]}),e[37]=y,e[38]=k,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==g?(C=o.jsxs(tl,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=C):C=e[42];let T;return e[43]!==C||e[44]!==d||e[45]!==f?(T=o.jsx(el,{open:d,onOpenChange:f,children:C}),e[43]=C,e[44]=d,e[45]=f,e[46]=T):T=e[46],T}const fm={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:ua},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Wr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:o8}},nde=["fast","smart","thinking"];function ide(t){const e=B.c(19),{tier:s,onSelect:n}=t,i=re(),[r,l]=P.useState(!1),a=fm[s].icon;let c;e[0]!==a?(c=o.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=c):c=e[1];const d=fm[s];let f;e[2]!==i||e[3]!==d.labelKey?(f=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=f):f=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Qt,{size:14,className:"text-muted-foreground"}),e[5]=u):u=e[5];let h;e[6]!==c||e[7]!==f?(h=o.jsx(ns,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,f,u]})}),e[6]=c,e[7]=f,e[8]=h):h=e[8];let m;e[9]!==n||e[10]!==i||e[11]!==s?(m=nde.map(x=>{const b=fm[x],y=b.icon;return o.jsxs("button",{type:"button",onClick:()=>{n(x),l(!1)},className:ie("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[o.jsx(y,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"text-sm",children:i(b.labelKey)}),o.jsx("div",{className:"text-xs text-muted-foreground",children:i(b.subtitleKey)})]}),x===s&&o.jsx(Ft,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;e[13]!==m?(p=o.jsx(is,{align:"start",className:"p-1 w-64",children:o.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==r||e[16]!==h||e[17]!==p?(g=o.jsxs(rs,{open:r,onOpenChange:l,children:[h,p]}),e[15]=r,e[16]=h,e[17]=p,e[18]=g):g=e[18],g}function rde(t){const e=B.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:r}=t,l=re(),[a,c]=P.useState(i!==null);let d;e[0]!==l?(d=l("automations.automationConfig.modelLabel"),e[0]=l,e[1]=d):d=e[1];let f;e[2]!==d?(f=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=f):f=e[3];let u;e[4]!==r||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(u=a?o.jsx(P.Suspense,{fallback:o.jsx(ue,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:o.jsx(ode,{override:i,onOverrideChange:r})}):o.jsx(ide,{tier:s,onSelect:n}),e[4]=r,e[5]=n,e[6]=i,e[7]=l,e[8]=s,e[9]=a,e[10]=u):u=e[10];let h;e[11]!==r?(h=y=>{c(y),y||r(null)},e[11]=r,e[12]=h):h=e[12];let m;e[13]!==h||e[14]!==a?(m=o.jsx(hr,{checked:a,onCheckedChange:h,className:"cursor-pointer"}),e[13]=h,e[14]=a,e[15]=m):m=e[15];let p;e[16]!==l?(p=l("automations.automationConfig.specificModel"),e[16]=l,e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==p?(g=o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20];let x;e[21]!==u||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u,g]}),e[21]=u,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==f||e[25]!==x?(b=o.jsxs("div",{className:"flex flex-col gap-2",children:[f,x]}),e[24]=f,e[25]=x,e[26]=b):b=e[26],b}function ode(t){const e=B.c(25),{override:s,onOverrideChange:n}=t,i=re(),r=v9(),l=r[0]?.id??null;let a;e[0]!==l||e[1]!==r||e[2]!==s?.credentialId?(a=r.some(b=>b.id===s?.credentialId)?s?.credentialId??null:l,e[0]=l,e[1]=r,e[2]=s?.credentialId,e[3]=a):a=e[3];const[c,d]=P.useState(a);let f;e[4]!==c||e[5]!==l||e[6]!==r?(f=r.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=r,e[7]=f):f=e[7];const u=f;let h;e[8]!==r||e[9]!==s?(h=s&&r.some(b=>b.id===s.credentialId)?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[8]=r,e[9]=s,e[10]=h):h=e[10];const m=h;if(r.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let y;return e[13]!==b?(y=o.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=y):y=e[14],y}let p;e[15]!==i?(p=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=p):p=e[16];let g;e[17]!==u||e[18]!==n?(g=b=>{const y=b.keyId??u??"";d(y),n({modelId:b.modelId,credentialId:y,title:b.title??b.modelId})},e[17]=u,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==u||e[21]!==m||e[22]!==p||e[23]!==g?(x=o.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:o.jsx(dP,{variant:"bordered",placeholder:p,model:m,credentialId:u,onCredentialChange:d,onModelChange:g})}),e[20]=u,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const Yj=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:Eg,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:Mn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:fr},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:Si},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:i0}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Xo,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:u9},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:Pg},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:Q2},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Iu},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Xo},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:zA}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Hc,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Hc},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Uc},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Uc}]}],lde=Yj.flatMap(t=>t.tools.map(e=>e.name));function ade(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function cde(t){const e=B.c(12),{agentId:s,value:n,onChange:i}=t,r=re();let l;e[0]!==r?(l=r("automations.automationConfig.toolsLabel"),e[0]=r,e[1]=l):l=e[1];let a;e[2]!==l?(a=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s||e[5]!==i||e[6]!==r||e[7]!==n?(c=s?o.jsx(P.Suspense,{fallback:o.jsxs(ue,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[o.jsx(Eg,{size:14}),r("automations.automationConfig.loadingTools")]}),children:o.jsx(dde,{agentId:s,value:n,onChange:i})}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:r("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=i,e[6]=r,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==a||e[10]!==c?(d=o.jsxs("div",{className:"flex flex-col gap-2",children:[a,c]}),e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function Gv(t){const e=B.c(17),{value:s,checked:n,onToggle:i,title:r,description:l,leading:a}=t;let c;e[0]!==n?(c=o.jsx(fd,{checked:n,className:"pointer-events-none mt-0.5"}),e[0]=n,e[1]=c):c=e[1];let d;e[2]!==a?(d=a&&o.jsx("span",{className:"mt-px shrink-0",children:a}),e[2]=a,e[3]=d):d=e[3];let f;e[4]!==r?(f=o.jsx("span",{className:"truncate text-sm leading-tight",children:r}),e[4]=r,e[5]=f):f=e[5];let u;e[6]!==l?(u=l&&o.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:l}),e[6]=l,e[7]=u):u=e[7];let h;e[8]!==f||e[9]!==u?(h=o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[f,u]}),e[8]=f,e[9]=u,e[10]=h):h=e[10];let m;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==h||e[15]!==s?(m=o.jsxs(Wt,{value:s,onSelect:i,className:"items-start gap-2.5 py-2",children:[c,d,h]}),e[11]=i,e[12]=c,e[13]=d,e[14]=h,e[15]=s,e[16]=m):m=e[16],m}function Yv(t){const e=B.c(27),{conn:s,label:n,icon:i,on:r,total:l,onToggle:a}=t,c=re(),d=r===l;let f;e[0]!==i||e[1]!==s?(f=s?o.jsx(Ei,{icon:s.icon,name:s.title,size:"2xs"}):i?o.jsx(i,{size:14,className:"text-muted-foreground"}):o.jsx(XA,{size:14,className:"text-muted-foreground"}),e[0]=i,e[1]=s,e[2]=f):f=e[2];let u;e[3]!==s?.title||e[4]!==n||e[5]!==c?(u=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=u):u=e[6];let h;e[7]!==u?(h=o.jsx("span",{className:"truncate",children:u}),e[7]=u,e[8]=h):h=e[8];let m;e[9]!==r||e[10]!==l?(m=o.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[r,"/",l]}),e[9]=r,e[10]=l,e[11]=m):m=e[11];let p;e[12]!==a?(p=L=>{L.stopPropagation(),a()},e[12]=a,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==g?(x=o.jsx("button",{type:"button",onClick:p,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==m||e[21]!==x?(b=o.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=b):b=e[22];let y;return e[23]!==f||e[24]!==h||e[25]!==b?(y=o.jsxs("div",{className:"flex items-center gap-2",children:[f,h,b]}),e[23]=f,e[24]=h,e[25]=b,e[26]=y):y=e[26],y}function dde(t){const e=B.c(83),{agentId:s,value:n,onChange:i}=t,r=re(),{org:l}=Fe(),[a,c]=P.useState(!1);let d;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(d={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=d):d=e[3];const f=Jt(d);let u;e[4]!==f?(u={client:f},e[4]=f,e[5]=u):u=e[5];const{data:h,isLoading:m}=_g(u),p=di();let g,x,b,y,L,v,_,w,S,k,j,C,T;if(e[6]!==p||e[7]!==h?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==r||e[12]!==n){const R=new Map(p.map(pde)),I=new Map;for(const fe of h?.tools??[]){const de=rr(fe._meta)??"__other__",pe=id(fe.name,de==="__other__"?void 0:de),te=fe.title,ge=te&&te!==fe.name?te:ade(pe);I.has(de)||I.set(de,{clientId:de,conn:R.get(de),tools:[]}),I.get(de).tools.push({name:fe.name,display:ge,description:fe.description})}const D=[...I.values()].sort(mde),O=(h?.tools??[]).map(hde),z=[...lde,...O],M=n===null?new Set(z):new Set(n),$=z.every(fe=>M.has(fe)),F=fe=>i(z.every(de=>fe.has(de))?null:[...fe]),U=fe=>{const de=new Set(M);de.has(fe)?de.delete(fe):de.add(fe),F(de)},H=(fe,de)=>{const pe=new Set(M);for(const te of fe)de?pe.add(te):pe.delete(te);F(pe)};y=rs,T=a,L=c;let q;e[26]===Symbol.for("react.memo_cache_sentinel")?(q=o.jsx(Eg,{size:14,className:"text-muted-foreground"}),e[26]=q):q=e[26];let W;e[27]!==$||e[28]!==r?(W=r($?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=$,e[28]=r,e[29]=W):W=e[29];const G=!$&&o.jsxs(VE,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",z.length]});let Y;e[30]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(Qt,{size:14,className:"text-muted-foreground"}),e[30]=Y):Y=e[30],e[31]!==W||e[32]!==G?(v=o.jsx(ns,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[q,W,G,Y]})}),e[31]=W,e[32]=G,e[33]=v):v=e[33],b=is,j="p-0 w-80",C="start",x=Yn;let J;e[34]!==r?(J=r("automations.automationConfig.searchToolsPlaceholder"),e[34]=r,e[35]=J):J=e[35],e[36]!==J?(S=o.jsx(On,{placeholder:J}),e[36]=J,e[37]=S):S=e[37];const se=$?r("automations.automationConfig.allToolsEnabled",{count:z.length}):r("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:z.length});let oe;e[38]!==se?(oe=o.jsx("span",{className:"text-xs text-muted-foreground",children:se}),e[38]=se,e[39]=oe):oe=e[39];let ne;e[40]!==i?(ne=()=>i(null),e[40]=i,e[41]=ne):ne=e[41];let Q;e[42]!==r?(Q=r("automations.automationConfig.selectAll"),e[42]=r,e[43]=Q):Q=e[43];let K;e[44]!==$||e[45]!==ne||e[46]!==Q?(K=o.jsx("button",{type:"button",onClick:ne,disabled:$,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:Q}),e[44]=$,e[45]=ne,e[46]=Q,e[47]=K):K=e[47];let X;e[48]===Symbol.for("react.memo_cache_sentinel")?(X=o.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=X):X=e[48];let Z;e[49]!==i?(Z=()=>i([]),e[49]=i,e[50]=Z):Z=e[50];const le=M.size===0;let ee;e[51]!==r?(ee=r("automations.automationConfig.clear"),e[51]=r,e[52]=ee):ee=e[52];let ae;e[53]!==Z||e[54]!==le||e[55]!==ee?(ae=o.jsx("button",{type:"button",onClick:Z,disabled:le,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:ee}),e[53]=Z,e[54]=le,e[55]=ee,e[56]=ae):ae=e[56];let ce;e[57]!==K||e[58]!==ae?(ce=o.jsxs("div",{className:"flex items-center gap-2",children:[K,X,ae]}),e[57]=K,e[58]=ae,e[59]=ce):ce=e[59],e[60]!==oe||e[61]!==ce?(k=o.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[oe,ce]}),e[60]=oe,e[61]=ce,e[62]=k):k=e[62],g=$n,_="max-h-80",w=m?o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("automations.automationConfig.loadingTools")}):o.jsxs(o.Fragment,{children:[o.jsx(Cn,{children:r("automations.automationConfig.noToolsFound")}),Yj.map(fe=>{const de=fe.tools.map(fde),pe=de.filter(te=>M.has(te)).length;return o.jsx(fs,{heading:o.jsx(Yv,{label:r(fe.headingKey),icon:fe.icon,on:pe,total:de.length,onToggle:()=>H(de,pe!==de.length)}),children:fe.tools.map(te=>o.jsx(Gv,{value:`${r(te.titleKey)} ${te.name}`,checked:M.has(te.name),onToggle:()=>U(te.name),title:r(te.titleKey),description:r(te.descriptionKey),leading:o.jsx(te.icon,{size:16,className:"text-muted-foreground"})},te.name))},fe.key)}),D.map(fe=>{const de=fe.tools.map(ude),pe=de.filter(te=>M.has(te)).length;return o.jsx(fs,{heading:o.jsx(Yv,{conn:fe.conn,on:pe,total:de.length,onToggle:()=>H(de,pe!==de.length)}),children:fe.tools.map(te=>o.jsx(Gv,{value:`${te.display} ${te.name} ${fe.conn?.title??""}`,checked:M.has(te.name),onToggle:()=>U(te.name),title:te.display,description:te.description},te.name))},fe.clientId)})]}),e[6]=p,e[7]=h?.tools,e[8]=m,e[9]=i,e[10]=a,e[11]=r,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=y,e[17]=L,e[18]=v,e[19]=_,e[20]=w,e[21]=S,e[22]=k,e[23]=j,e[24]=C,e[25]=T}else g=e[13],x=e[14],b=e[15],y=e[16],L=e[17],v=e[18],_=e[19],w=e[20],S=e[21],k=e[22],j=e[23],C=e[24],T=e[25];let N;e[63]!==g||e[64]!==_||e[65]!==w?(N=o.jsx(g,{className:_,children:w}),e[63]=g,e[64]=_,e[65]=w,e[66]=N):N=e[66];let V;e[67]!==x||e[68]!==N||e[69]!==S||e[70]!==k?(V=o.jsxs(x,{children:[S,k,N]}),e[67]=x,e[68]=N,e[69]=S,e[70]=k,e[71]=V):V=e[71];let A;e[72]!==b||e[73]!==V||e[74]!==j||e[75]!==C?(A=o.jsx(b,{className:j,align:C,children:V}),e[72]=b,e[73]=V,e[74]=j,e[75]=C,e[76]=A):A=e[76];let E;return e[77]!==y||e[78]!==L||e[79]!==v||e[80]!==A||e[81]!==T?(E=o.jsxs(y,{open:T,onOpenChange:L,children:[v,A]}),e[77]=y,e[78]=L,e[79]=v,e[80]=A,e[81]=T,e[82]=E):E=e[82],E}function ude(t){return t.name}function fde(t){return t.name}function hde(t){return t.name}function mde(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function pde(t){return[t.id,t]}function wu(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function gde(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return`Every ${n[1]} hours`;const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(i){const a=parseInt(i[1]??"1");return a%7===0?`Every ${a/7} weeks`:`Every ${a} days`}const r=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(r){const a=(r[2]??"0").padStart(2,"0"),c=(r[1]??"0").padStart(2,"0");return`Every day at ${a}:${c} UTC`}const l=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(l){const c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(l[3]??"0")]??"day",d=(l[2]??"0").padStart(2,"0"),f=(l[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${f} UTC`}return t}function xde(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function bde(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return{count:parseInt(n[1]),unit:"hours"};const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);return i?{count:parseInt(i[1]),unit:"days"}:null}function vde(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const yde=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function _de({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:r}){const l=re(),{triggerAdd:a}=f0(),[c,d]=P.useState(!1),f=e??c,u=p=>{s?s(p):d(p)},h=async p=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),xe.success(l("automations.addStarterPopover.starterAdded")),u(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");xe.error(x)}},m=async()=>{try{const p=await a.mutateAsync({automation_id:t,type:"webhook"});u(!1),p.webhook?r?.(p.webhook):xe.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:l("automations.addStarterPopover.failedAddWebhookStarter");xe.error(g)}};return o.jsxs($t,{open:f,onOpenChange:u,children:[o.jsx(Bt,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",children:[o.jsx(Kt,{size:14}),l("automations.addStarterPopover.addStarter")]})}),o.jsxs(zt,{align:"end",className:"w-[200px]",children:[o.jsxs(er,{children:[o.jsxs(tr,{className:"gap-2.5",children:[o.jsx(uu,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),o.jsx(sr,{className:"w-[160px]",children:yde.map(p=>o.jsxs(Xe,{className:"gap-2.5",onSelect:()=>h(p.cron),disabled:a.isPending,children:[o.jsx(uu,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),o.jsxs(Xe,{className:"gap-2.5",onSelect:()=>{u(!1),n?.()},children:[o.jsx(uu,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),o.jsxs(Xe,{className:"gap-2.5",onSelect:()=>{u(!1),i?.()},children:[o.jsx(mr,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),o.jsxs(Xe,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[o.jsx(Mn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function Jj(t){const e=B.c(39),{open:s,onOpenChange:n,url:i,token:r,title:l,description:a}=t,c=l===void 0?"Webhook ready":l,d=a===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":a,f=re(),[u,h]=P.useState(null),[m,p]=P.useState("curl"),[g,x]=P.useState("header"),b=P.useId();let y;e[0]!==f?(y=async(D,O)=>{try{await navigator.clipboard.writeText(D),h(O),xe.success(f("automations.webhookSecretDialog.copied")),setTimeout(()=>h(null),1500)}catch{xe.error(f("automations.webhookSecretDialog.failedCopy"))}},e[0]=f,e[1]=y):y=e[1];const L=y;let v;e[2]!==g||e[3]!==r||e[4]!==i?(v=i&&r&&g==="url"?`${i.replace(/\/$/,"")}/${r}`:i??"",e[2]=g,e[3]=r,e[4]=i,e[5]=v):v=e[5];const _=v,w=i&&r?g==="header"?`curl -X POST "${_}" \\
625
+ `)};An.prototype.renderPartial=function(e,s,n,i){if(n){var r=this.getConfigTags(i),l=Dx(n)?n(e[1]):n[e[1]];if(l!=null){var a=e[6],c=e[5],d=e[4],f=l;c==0&&d&&(f=this.indentPartial(l,d,a));var u=this.parse(f,r);return this.renderTokens(u,s,n,f,i)}}};An.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};An.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Pi.escape,r=s.lookup(e[1]);if(r!=null)return typeof r=="number"&&i===Pi.escape?String(r):i(r)};An.prototype.rawValue=function(e){return e[1]};An.prototype.getConfigTags=function(e){return kd(e)?e:e&&typeof e=="object"?e.tags:void 0};An.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!kd(e))return e.escape};var Pi={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Yu.templateCache=t},get templateCache(){return Yu.templateCache}},Yu=new An;Pi.clearCache=function(){return Yu.clearCache()};Pi.parse=function(e,s){return Yu.parse(e,s)};Pi.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+ece(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Yu.render(e,s,n,i)};Pi.escape=lce;Pi.Scanner=A0;Pi.Context=sd;Pi.Writer=An;function pce(t,e){const s={__resolveType:t},n=pk([s],e)[0];return n?xie(s,n,e):null}function gce({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,blockKey:l,onSaveReferencedBlock:a}){const c=re(),d=oo(),f=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[u]=P.useState(()=>pce(l,r)),[h,m]=P.useState(u?.data??{}),[p,g]=P.useState([]),[x,b]=P.useState(0),[y,L]=P.useState(!1),[v,_]=P.useState(null),w=v!==null,{save:S,flush:k}=fx({orgSlug:t,virtualMcpId:e,branch:s}),j=u?.resolveType?In(u.resolveType,i):null,C=r[l],T=C?Jl(l,C):l,N=As()?.taskId??null,V={orgSlug:t,virtualMcpId:e,branch:s,threadId:N,previewUrl:n??void 0,siteSlug:f},A=O=>{m(O),S(l,O)},E=()=>{w?(_(null),L(!1),b(O=>O+1)):_(JSON.stringify(h,null,2))},R=O=>{const z=O??"";try{const M=JSON.parse(z);if(M&&typeof M=="object"&&!Array.isArray(M)){L(!1),A(M);return}L(!0)}catch{L(!0)}},I=[T,...p],D=O=>{g(p.slice(0,O)),b(z=>z+1)};return o.jsx("div",{className:"flex h-full w-full min-w-0",children:o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:m3},"aria-hidden":!0}),o.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:I.map((O,z)=>{const M=z===I.length-1,$=Sn(O);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[z>0&&o.jsx(en,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>D(z),title:$,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",M?"font-medium text-foreground":"text-muted-foreground"),children:$})]},`${$}-${z}`)})}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:w?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:E,"aria-label":c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":w,children:w?o.jsx(Ds,{size:14}):o.jsx(fa,{size:14})})}),o.jsx(We,{side:"bottom",children:c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),o.jsxs("div",{className:"relative min-h-0 flex-1",children:[o.jsx(xl,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:j?o.jsx(Ii,{schema:j,value:h,onChange:O=>A(O),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:r,onSaveReferencedBlock:a,sandbox:V},x):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),v!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[y&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(md,{language:"json",height:"100%",code:v,onChange:R,onSave:O=>{R(O),k()}})})]})]})]})})}function xce(t){const e=B.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:f,onSaveReferencedBlock:u}=t,h=re();if(!s){let g;e[0]!==h?(g=h("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=h,e[1]=g):g=e[1];let x;e[2]!==h?(x=h("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=h,e[3]=x):x=e[3];let b;return e[4]!==g||e[5]!==x?(b=o.jsx(Fo,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=b):b=e[6],b}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,b=s.title;let y;e[7]!==s.title?(y=lj(s.title),e[7]=s.title,e[8]=y):y=e[8];let L;e[9]!==f||e[10]!==s.resolveType?(L=(_,w)=>f(s.resolveType,_,w),e[9]=f,e[10]=s.resolveType,e[11]=L):L=e[11];let v;return e[12]!==r||e[13]!==c||e[14]!==d||e[15]!==a||e[16]!==u||e[17]!==n||e[18]!==l||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==y||e[23]!==L||e[24]!==i?(v=o.jsx(Qae,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:y,isCreating:d,onCreate:L,onSaveReferencedBlock:u},g),e[12]=r,e[13]=c,e[14]=d,e[15]=a,e[16]=u,e[17]=n,e[18]=l,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=y,e[23]=L,e[24]=i,e[25]=v):v=e[25],v}const m=`saved:${s.key}`;let p;return e[26]!==r||e[27]!==c||e[28]!==a||e[29]!==u||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==m||e[34]!==i?(p=o.jsx(gce,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:u},m),e[26]=r,e[27]=c,e[28]=a,e[29]=u,e[30]=n,e[31]=l,e[32]=s.key,e[33]=m,e[34]=i,e[35]=p):p=e[35],p}const Ov="__all__",$v={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},bce={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},zf={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},Bv="status:";function zv(t){if(!t.startsWith(Bv))return null;const e=t.slice(Bv.length);return e in zf?e:null}const Fv=P.forwardRef(function(e,s){const n=B.c(20);let i,r,l,a,c;n[0]!==e?({icon:i,active:r,value:c,className:l,...a}=e,n[0]=e,n[1]=i,n[2]=r,n[3]=l,n[4]=a,n[5]=c):(i=n[1],r=n[2],l=n[3],a=n[4],c=n[5]);const d=r?"text-foreground":"text-muted-foreground";let f;n[6]!==l||n[7]!==d?(f=ie("h-7 gap-1 px-1.5 text-xs",d,l),n[6]=l,n[7]=d,n[8]=f):f=n[8];let u;n[9]!==i?(u=o.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=u):u=n[10];let h;n[11]!==c?(h=c&&o.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=h):h=n[12];let m;n[13]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Qt,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==a||n[15]!==s||n[16]!==f||n[17]!==u||n[18]!==h?(p=o.jsxs(ue,{ref:s,type:"button",variant:"ghost",size:"sm",className:f,...a,children:[u,h,m]}),n[14]=a,n[15]=s,n[16]=f,n[17]=u,n[18]=h,n[19]=p):p=n[19],p});function Ix(t){const e=B.c(2),{count:s}=t;let n;return e[0]!==s?(n=o.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=n):n=e[1],n}function vce(t){const e=B.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:r,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:f,onStatusFilterChange:u,onSortChange:h}=t,m=re();let p;if(e[0]!==s||e[1]!==r){let ee;e[3]!==r?(ee=ae=>ae.slug===r,e[3]=r,e[4]=ee):ee=e[4],p=s.find(ee),e[0]=s,e[1]=r,e[2]=p}else p=e[2];const g=p;let x;if(e[5]!==l||e[6]!==n){let ee;e[8]!==l?(ee=ae=>ae.email===l,e[8]=l,e[9]=ee):ee=e[9],x=n.find(ee),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,y=!!(r||l||a);let L;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==m?(L=g?.name??b?.name??m(a?zf[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=m,e[14]=L):L=e[14];const v=L,_=r?`cat:${r}`:l?`author:${l}`:a?`status:${a}`:Ov;let w;e[15]!==f||e[16]!==d||e[17]!==u?(w=()=>{d(null),f(null),u(null)},e[15]=f,e[16]=d,e[17]=u,e[18]=w):w=e[18];const S=w;let k;e[19]!==S||e[20]!==f||e[21]!==d||e[22]!==u?(k=ee=>{ee.startsWith("cat:")?(f(null),u(null),d(ee.slice(4))):ee.startsWith("author:")?(d(null),u(null),f(ee.slice(7))):zv(ee)?(d(null),f(null),u(zv(ee))):S()},e[19]=S,e[20]=f,e[21]=d,e[22]=u,e[23]=k):k=e[23];const j=k;let C;e[24]!==v||e[25]!==y?(C=o.jsx(Bt,{asChild:!0,children:o.jsx(Fv,{icon:$A,active:y,value:v,className:"min-w-0 shrink"})}),e[24]=v,e[25]=y,e[26]=C):C=e[26];let T;e[27]!==m?(T=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=T):T=e[28];let N;e[29]!==T?(N=o.jsx(Pd,{children:T}),e[29]=T,e[30]=N):N=e[30];let V;e[31]!==m?(V=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=V):V=e[32];let A;e[33]!==V?(A=o.jsx(Kn,{value:Ov,children:V}),e[33]=V,e[34]=A):A=e[34];let E;e[35]!==m?(E=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=E):E=e[36];let R;e[37]!==E?(R=o.jsx(Pd,{className:"text-muted-foreground/70",children:E}),e[37]=E,e[38]=R):R=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=Object.keys(zf),e[39]=I):I=e[39];let D;e[40]!==i||e[41]!==m?(D=I.map(ee=>o.jsxs(Kn,{value:`status:${ee}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(zf[ee])}),o.jsx(Ix,{count:i[ee]})]},`status:${ee}`)),e[40]=i,e[41]=m,e[42]=D):D=e[42];let O;e[43]!==s.length||e[44]!==m?(O=s.length>0&&o.jsx(Pd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=O):O=e[45];let z;e[46]!==s?(z=s.map(_ce),e[46]=s,e[47]=z):z=e[47];let M;e[48]!==n.length||e[49]!==m?(M=n.length>0&&o.jsx(Pd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=M):M=e[50];let $;e[51]!==n?($=n.map(yce),e[51]=n,e[52]=$):$=e[52];let F;e[53]!==_||e[54]!==j||e[55]!==A||e[56]!==R||e[57]!==D||e[58]!==O||e[59]!==z||e[60]!==M||e[61]!==$?(F=o.jsxs(Wc,{value:_,onValueChange:j,children:[A,R,D,O,z,M,$]}),e[53]=_,e[54]=j,e[55]=A,e[56]=R,e[57]=D,e[58]=O,e[59]=z,e[60]=M,e[61]=$,e[62]=F):F=e[62];let U;e[63]!==F||e[64]!==N?(U=o.jsxs(zt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[N,F]}),e[63]=F,e[64]=N,e[65]=U):U=e[65];let H;e[66]!==U||e[67]!==C?(H=o.jsxs($t,{children:[C,U]}),e[66]=U,e[67]=C,e[68]=H):H=e[68];let q;e[69]!==S||e[70]!==y||e[71]!==m?(q=y&&o.jsx(Lce,{label:m("sandbox.postToolbar.clearFilter"),onClick:S}),e[69]=S,e[70]=y,e[71]=m,e[72]=q):q=e[72];const W=bce[c];let G;e[73]!==m||e[74]!==W?(G=m(W),e[73]=m,e[74]=W,e[75]=G):G=e[75];let Y;e[76]!==G?(Y=o.jsx(Bt,{asChild:!0,children:o.jsx(Fv,{icon:BA,active:!0,value:G})}),e[76]=G,e[77]=Y):Y=e[77];let J;e[78]!==m?(J=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=J):J=e[79];let se;e[80]!==J?(se=o.jsx(Pd,{children:J}),e[80]=J,e[81]=se):se=e[81];let oe;e[82]!==h?(oe=ee=>h(ee),e[82]=h,e[83]=oe):oe=e[83];let ne;e[84]===Symbol.for("react.memo_cache_sentinel")?(ne=Object.keys($v),e[84]=ne):ne=e[84];let Q;e[85]!==m?(Q=ne.map(ee=>o.jsx(Kn,{value:ee,children:m($v[ee])},ee)),e[85]=m,e[86]=Q):Q=e[86];let K;e[87]!==c||e[88]!==oe||e[89]!==Q?(K=o.jsx(Wc,{value:c,onValueChange:oe,children:Q}),e[87]=c,e[88]=oe,e[89]=Q,e[90]=K):K=e[90];let X;e[91]!==se||e[92]!==K?(X=o.jsxs(zt,{align:"end",className:"w-44",children:[se,K]}),e[91]=se,e[92]=K,e[93]=X):X=e[93];let Z;e[94]!==Y||e[95]!==X?(Z=o.jsx("div",{className:"ml-auto shrink-0",children:o.jsxs($t,{children:[Y,X]})}),e[94]=Y,e[95]=X,e[96]=Z):Z=e[96];let le;return e[97]!==H||e[98]!==q||e[99]!==Z?(le=o.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[H,q,Z]}),e[97]=H,e[98]=q,e[99]=Z,e[100]=le):le=e[100],le}function yce(t){return o.jsxs(Kn,{value:`author:${t.email}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(Ix,{count:t.count})]},`author:${t.email}`)}function _ce(t){return o.jsxs(Kn,{value:`cat:${t.slug}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(Ix,{count:t.count})]},`cat:${t.slug}`)}function Lce(t){const e=B.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Ds,{size:12}),e[0]=i):i=e[0];let r;return e[1]!==s||e[2]!==n?(r=o.jsx("button",{type:"button","aria-label":s,onClick:n,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:i}),e[1]=s,e[2]=n,e[3]=r):r=e[3],r}function wce(t){const e=B.c(18),{checked:s,disabled:n,onToggle:i}=t,r=re();let l;e[0]!==i?(l=()=>i(),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==r?(a=r(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=r,e[4]=a):a=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==a?(c=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Sce,children:o.jsx(fd,{checked:s,disabled:n,onCheckedChange:l,"aria-label":a})})}),e[5]=s,e[6]=n,e[7]=l,e[8]=a,e[9]=c):c=e[9];let d;e[10]!==s||e[11]!==r?(d=r(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=r,e[12]=d):d=e[12];let f;e[13]!==d?(f=o.jsx(We,{side:"bottom",children:d}),e[13]=d,e[14]=f):f=e[14];let u;return e[15]!==c||e[16]!==f?(u=o.jsxs(qe,{children:[c,f]}),e[15]=c,e[16]=f,e[17]=u):u=e[17],u}function Sce(t){return t.stopPropagation()}function kce(t){const e=B.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:r,onExit:l}=t,a=re();let c;e[0]!==n||e[1]!==i?(c=o.jsx(wce,{checked:n,onToggle:i}),e[0]=n,e[1]=i,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==a?(d=a("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=a,e[5]=d):d=e[5];let f;e[6]!==d?(f=o.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=f):f=e[7];const u=s===0;let h;e[8]!==a?(h=a("sandbox.postToolbar.deleteSelectedPosts"),e[8]=a,e[9]=h):h=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(tn,{size:14}),e[10]=m):m=e[10];let p;e[11]!==r||e[12]!==u||e[13]!==h?(p=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:u,onClick:r,"aria-label":h,children:m})}),e[11]=r,e[12]=u,e[13]=h,e[14]=p):p=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(We,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=o.jsxs(qe,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let y;e[22]!==a?(y=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=y):y=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(Ds,{size:14}),e[24]=L):L=e[24];let v;e[25]!==l||e[26]!==y?(v=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":y,children:L})}),e[25]=l,e[26]=y,e[27]=v):v=e[27];let _;e[28]!==a?(_=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=_):_=e[29];let w;e[30]!==_?(w=o.jsx(We,{side:"bottom",children:_}),e[30]=_,e[31]=w):w=e[31];let S;e[32]!==v||e[33]!==w?(S=o.jsxs(qe,{children:[v,w]}),e[32]=v,e[33]=w,e[34]=S):S=e[34];let k;e[35]!==b||e[36]!==S?(k=o.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,S]}),e[35]=b,e[36]=S,e[37]=k):k=e[37];let j;return e[38]!==c||e[39]!==k||e[40]!==f?(j=o.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,f,k]}),e[38]=c,e[39]=k,e[40]=f,e[41]=j):j=e[41],j}function Fd(t){const e=B.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:r,onViewJson:l,onDelete:a}=t,c=re();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(qn,{size:14}),e[2]=f):f=e[2];let u;e[3]!==d?(u=o.jsx(Bt,{asChild:!0,children:o.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:jce,children:f})}),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n||e[6]!==c?(h=n&&o.jsxs(Xe,{onClick:n,children:[o.jsx(Pg,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=h):h=e[7];let m;e[8]!==s||e[9]!==c?(m=s&&o.jsxs(Xe,{onClick:s,children:[o.jsx(an,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=m):m=e[10];let p;e[11]!==i||e[12]!==c?(p=i&&o.jsxs(o.Fragment,{children:[o.jsx(qr,{}),o.jsxs(Xe,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[o.jsx(c0,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==r||e[15]!==l||e[16]!==c?(g=(r||l)&&o.jsxs(o.Fragment,{children:[o.jsx(qr,{}),r&&o.jsxs(Xe,{onClick:r,children:[o.jsx(ng,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&o.jsxs(Xe,{onClick:l,children:[o.jsx(fa,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=r,e[15]=l,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(qr,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(tn,{size:14}),e[19]=b):b=e[19];let y;e[20]!==c?(y=c("sandbox.itemActions.delete"),e[20]=c,e[21]=y):y=e[21];let L;e[22]!==a||e[23]!==y?(L=o.jsxs(Xe,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,y]}),e[22]=a,e[23]=y,e[24]=L):L=e[24];let v;e[25]!==L||e[26]!==h||e[27]!==m||e[28]!==p||e[29]!==g?(v=o.jsxs(zt,{align:"end",className:"w-44",children:[h,m,p,g,x,L]}),e[25]=L,e[26]=h,e[27]=m,e[28]=p,e[29]=g,e[30]=v):v=e[30];let _;return e[31]!==v||e[32]!==u?(_=o.jsxs($t,{children:[u,v]}),e[31]=v,e[32]=u,e[33]=_):_=e[33],_}function jce(t){return t.stopPropagation()}function Cce(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function Nce(t){const e=new Map;for(const s of t){const n=Cce(s.resolveType),i=e.get(n);i?i.push(s):e.set(n,[s])}return[...e.entries()].map(([s,n])=>({label:s,sections:n})).sort((s,n)=>s.label.localeCompare(n.label))}function Uv(t){const e=B.c(8),{icon:s,label:n,className:i}=t;let r;e[0]!==i?(r=ie("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",i),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==s?(l=o.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==n||e[5]!==r||e[6]!==l?(a=o.jsxs("div",{className:r,children:[l,n]}),e[4]=n,e[5]=r,e[6]=l,e[7]=a):a=e[7],a}const Hv=P.lazy(()=>xn(()=>import("./app-editor-Cg3q49SP.js"),__vite__mapDeps([165,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,41,77,78,27,43,84,28,29,30,31,32,33,34,35,36,37,38,39,40,42,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,79,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,82,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,80,144,145,146,147,148,149,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.AppEditor}))),Tce=P.lazy(()=>xn(()=>import("./post-editor-Dw0XoUW-.js"),__vite__mapDeps([166,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,29,58,28,30,31,32,33,34,35,36,37,38,39,40,27,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,79,82,167,139,141,155,156,127,115,83,136,168,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,169,170,113,114,78,116,117,118,119,120,121,122,123,124,125,126,128,129,130,131,132,133,134,135,137,138,140,142,143,80,144,145,146,147,148,149,77,150,151,152,153,154,157,158,159,160,161,162,163])).then(t=>({default:t.PostEditor}))),Vce=P.lazy(()=>xn(()=>import("./record-editor-D8eYeCmw.js"),__vite__mapDeps([171,1,2,79,82,78,8,27,43,136,169,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,44,45,9,46,10,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,170,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,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,137,138,139,140,141,142,143,80,144,145,146,147,148,149,77,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.RecordEditor}))),Ace=P.lazy(()=>xn(()=>import("./category-editor-mFpEwJXE.js"),__vite__mapDeps([172,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,35,38,58,28,29,30,31,32,33,34,36,37,39,40,27,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,119,79,82,168,155,156,127,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,169,170,113,114,78,115,116,117,118,120,121,122,123,124,125,126,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,80,144,145,146,147,148,149,77,150,151,83,152,153,154,157,158,159,160,161,162,163])).then(t=>({default:t.CategoryEditor}))),Pce=P.lazy(()=>xn(()=>import("./bulk-category-panel-Cla8YbNK.js"),__vite__mapDeps([173,1,2,38,82,174,44,78,8,27,43])).then(t=>({default:t.BulkCategoryPanel}))),Ece=P.lazy(()=>xn(()=>import("./sections-editor-Dp1jPPnU.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])).then(t=>({default:t.SectionsEditor}))),Rce=P.lazy(()=>xn(()=>import("./seo-editor-DesDFA61.js"),__vite__mapDeps([175,1,2,41,28,29,30,31,32,33,34,35,36,37,38,39,40,8,27,42,43,44,45,9,46,10,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,81,82,83,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,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,79,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,80,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.SeoEditor}))),Dce=P.lazy(()=>xn(()=>import("./variant-calendar-CnvdiA98.js"),__vite__mapDeps([176,1,2,28,29,30,31,32,33,34,35,36,37,38,39,40,8,27,41,42,43,44,45,9,46,10,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,82,77,78,83,177,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,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,79,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,80,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.VariantCalendar}))),Ice=P.lazy(()=>xn(()=>import("./post-calendar-V5YkHzT5.js"),__vite__mapDeps([178,1,2,29,28,30,31,32,33,34,35,36,37,38,39,40,8,27,41,42,43,44,45,9,46,10,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,179,77,78,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,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,82,79,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,80,144,145,146,147,148,149,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.PostCalendar}))),Mce=P.lazy(()=>xn(()=>import("./redirect-editor-ZpJCTshJ.js"),__vite__mapDeps([180,1,2,141,8,79,82,78,27,43,170,32,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,85,28,29,30,31,33,34,35,36,37,38,39,40,41,42,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,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,142,143,80,144,145,146,147,148,149,77,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.RedirectEditor})));function Oce(t){const e=B.c(20),{deepLinkPage:s}=t,n=oo(),{currentBranch:i}=sn(),{org:r}=Fe(),l=n?.entity?.id??null,a=Jn(),c=vl(),{runtime:d,previewServerUrl:f}=Tn(l),u=d==="cms";let h;e[0]!==u||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(h=Jle({fastPreviewActive:u,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=u,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=h):h=e[3];const m=h;if(m.kind==="sandbox-card"){const x=`/${r.slug}/settings/connections`;let b;return e[4]!==m.state||e[5]!==c.start||e[6]!==x||e[7]!==a.lifecycle||e[8]!==a.phase?(b=o.jsx(Gle,{state:m.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=m.state,e[5]=c.start,e[6]=x,e[7]=a.lifecycle,e[8]=a.phase,e[9]=b):b=e[9],b}if(!l||!i){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Fo,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const p=u?f:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==m.devServerReady||e[14]!==m.sandboxWarming||e[15]!==c.previewUrl||e[16]!==r.slug||e[17]!==p||e[18]!==l?(g=o.jsx(Bce,{orgSlug:r.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:p,deepLinkPage:s,devServerReady:m.devServerReady,sandboxWarming:m.sandboxWarming}),e[11]=i,e[12]=s,e[13]=m.devServerReady,e[14]=m.sandboxWarming,e[15]=c.previewUrl,e[16]=r.slug,e[17]=p,e[18]=l,e[19]=g):g=e[19],g}const Kv=2e3,$ce=15;function Wv(t,e,s,n){return typeof e!="string"||s&&(Dj(e,s,n)||t.state.dataUpdateCount>=$ce)?!1:Kv}function Bce({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:r,devServerReady:l,sandboxWarming:a}){const c=re(),d=As()?.taskId??null,f={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:u,isLoading:h}=y0(f,{fetchEnabled:l}),[m,p]=P.useState("pages"),[g,x]=P.useState(null),[b,y]=P.useState(null),L=!!(r?.pageId||r?.path||r?.pathTemplate),[v,_]=P.useState(!1);if(L&&!v&&g===null&&u){_(!0);const he=XB(dh(u),r??{});he&&(p("pages"),x({collection:"pages",key:he.key,path:he.path}))}const[w,S]=P.useState(""),[k,j]=P.useState(null),[C,T]=P.useState(null),[N,V]=P.useState(null),[A,E]=P.useState("date-desc"),[R,I]=P.useState(()=>new Set),[D,O]=P.useState(null),z=()=>{I(new Set),O(null)},M=he=>{x(he),y(null)},[$,F]=P.useState(m);$!==m&&(F(m),S(""),j(null),T(null),V(null),E("date-desc"),I(new Set),O(null));const{data:U,isLoading:H,isFetching:q}=A9(f,{fetchEnabled:l,refetchInterval:he=>{const Ae=he.state.data;if(m==="apps"&&g&&g.collection==="apps"){const He=u?.[g.key];return Wv(he,typeof He?.__resolveType=="string"?He.__resolveType:void 0,Ae)}if(m==="site"&&u){const He=Ae?op(u,Ae):null,Le=u.site,De=He?.resolveType??(typeof Le?.__resolveType=="string"?Le.__resolveType:void 0);return Wv(he,De,Ae,["seo"])}return!1}}),W=(he,Ae)=>!Dj(he,U,Ae)&&(H||q),{catalog:G,isLoading:Y}=Wle(U??void 0,u??void 0,{enabled:m==="apps"}),J=Rae({orgSlug:t,virtualMcpId:e,branch:s,meta:U}),se=V0(f),oe=Mle(f),[ne,Q]=P.useState(null),[K,X]=P.useState(),[Z,le]=P.useState(null),[ee,ae]=P.useState(null),[ce,fe]=P.useState(null),de=!u||!U;if(h||H||de&&a)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(ot,{size:20,className:"animate-spin text-muted-foreground"})});if(de)return o.jsx(Fo,{title:"Could not load site data."});const pe=dh(u).sort((he,Ae)=>he.name.localeCompare(Ae.name)),te=oL(u).sort((he,Ae)=>he.from.localeCompare(Ae.from)),ge=L3(u,U),ve=m==="sections"?UB(U):[],Se=op(u,U),ye=Bj(u),ke=Ex.some(he=>ye[he].length>0),we=Lu(m)?ye[m]:[],je=(ke?Gu(u,"categories"):[]).map(({key:he,payload:Ae})=>{const He=typeof Ae.slug=="string"?Ae.slug:"",Le=typeof Ae.name=="string"?Ae.name:"";return{slug:He||he,name:Le||He||he}}).filter(he=>he.slug).sort((he,Ae)=>he.name.localeCompare(Ae.name)),me=m==="posts"&&(R.size>0||D!==null),Ce=me?Hj(u).filter(he=>R.has(he.key)):[],Ne=Zb(U,"loaders"),Ie=Zb(U,"actions");if(!R9(u,U)&&!ke&&Ne===0&&Ie===0)return o.jsx(Fo,{icon:pn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const et={pages:pe.length,sections:ge.length,apps:G.length,loaders:Ne,actions:Ie,redirects:te.length,posts:ye.posts.length,authors:ye.authors.length,categories:ye.categories.length},Ze=new Set(pe.map(he=>qo(he.path))),Te=new Set(pe.map(he=>he.name)),Me=new Set(ge.map(he=>he.name)),rt=async he=>{const Ae=u[he.key];if(!Ae)return;const He=vk(u,he.key),Le=yk(u,he.key,Math.max(0,He-1)),De=Xte(Ae.sections,Le);if(De)try{await se.mutateAsync({blockKey:he.key,data:{...Ae,sections:De}}),xe.success(`Variant added to "${he.name}"`),x({collection:"pages",key:he.key,path:he.path})}catch(Qe){xe.error(Qe instanceof Error?Qe.message:"Could not add variant")}},nt=()=>{X(void 0),Q({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},it=he=>{X(void 0),Q({mode:"duplicate",sourceKey:he.key,initialName:Tv(Te,he.name),initialPath:Qle(Ze,he.path)})},ut=he=>{X(void 0),Q({mode:"rename",sourceKey:he.key,initialName:he.name,initialPath:he.path})},Ct=async he=>{if(!ne)return;const{mode:Ae,sourceKey:He}=ne;try{if(Ae==="create"){let Le;if(he.templateKey){const Qe=u[he.templateKey];if(!Qe)throw new Error("Selected template no longer exists.");Le={...Qe,name:he.name,path:he.path}}else Le=eae(he.name,he.path);const De=sae(u,he.name);await se.mutateAsync({blockKey:De,data:Le}),xe.success(`Created "${he.name}"`),x({collection:"pages",key:De,path:he.path})}else if(Ae==="duplicate"&&He){const Le=u[He];if(!Le)throw new Error("Source page not found");const{key:De,data:Qe}=Zle({source:Le,pages:pe,newName:he.name,newPath:he.path});await se.mutateAsync({blockKey:De,data:Qe}),xe.success(`Duplicated as "${he.name}"`),x({collection:"pages",key:De,path:he.path})}else if(Ae==="rename"&&He){const Le=u[He];if(!Le)throw new Error("Page not found");const De={...Le,name:he.name,path:he.path};await se.mutateAsync({blockKey:He,data:De}),xe.success("Page updated"),g?.collection==="pages"&&g.key===He&&x({collection:"pages",key:He,path:he.path})}Q(null)}catch(Le){X(Le instanceof Error?Le.message:"Save failed")}},ct=({path:he})=>{if(!ne)return null;const Ae=qo(he);return(ne.mode==="rename"?qo(ne.initialPath):null)!==Ae&&Ze.has(Ae)?`A page with path "${he}" already exists.`:null},lt=async(he,Ae,He)=>{await se.mutateAsync({blockKey:Ae,data:{...He,name:Ae,__resolveType:he}}),xe.success(c("sandbox.contentBrowser.createdSection",{name:Ae})),x({collection:"sections",key:Ae})},Oe=bx((he,Ae)=>se.mutate({blockKey:he,data:Ae})),vt=async he=>{const Ae=u[he.key];if(!Ae){xe.error(c("sandbox.contentBrowser.sectionNotFound"));return}const He=Xle(u,he.key),Le=Tv(Me,he.name),De={...Ae,name:Le};try{await se.mutateAsync({blockKey:He,data:De}),xe.success(c("sandbox.contentBrowser.duplicatedSection",{name:he.name})),x({collection:"sections",key:He})}catch(Qe){xe.error(Qe instanceof Error?Qe.message:c("sandbox.contentBrowser.duplicateFailed"))}},_e=async he=>{if(!Z)return;const Ae=u[Z];if(!Ae){xe.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await se.mutateAsync({blockKey:Z,data:{...Ae,name:he}}),xe.success(c("sandbox.contentBrowser.sectionRenamed")),le(null)}catch(He){xe.error(He instanceof Error?He.message:c("sandbox.contentBrowser.renameFailed"))}},Ue=async()=>{const he="/redirect-from",Ae=QB(u,he),He=GB({from:he,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await se.mutateAsync({blockKey:Ae,data:He}),xe.success("Created redirect"),x({collection:"redirects",key:Ae})}catch(Le){xe.error(Le instanceof Error?Le.message:"Could not create redirect")}},st=async he=>{const Ae=dm(u,he),He=yc(Ae,he,Kj(he));try{await se.mutateAsync({blockKey:Ae,data:He}),xe.success(`Created ${_u[he]}`),x({collection:he,key:Ae})}catch(Le){xe.error(Le instanceof Error?Le.message:"Could not create")}},gt=async he=>{const Ae=dm(u,"posts"),He=yc(Ae,"posts",kae(he));try{await se.mutateAsync({blockKey:Ae,data:He}),xe.success(c("sandbox.postCalendar.createdScheduledPost")),p("posts"),F("posts"),x({collection:"posts",key:Ae}),y(null)}catch(Le){xe.error(Le instanceof Error?Le.message:c("sandbox.postCalendar.couldNotCreate"))}},pt=async(he,Ae)=>{const He=u[he],Le=He?Cae(nu(He,"posts"),Ae):null;if(!Le){xe.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await se.mutateAsync({blockKey:he,data:yc(he,"posts",Le)})}catch(De){xe.error(De instanceof Error?De.message:c("sandbox.postCalendar.couldNotReschedule"))}},Vt=async he=>{const Ae=u[he.key];if(!Ae){xe.error("Record not found.");return}const He=dm(u,he.kind),Le=he.kind==="posts"?"title":"name",De={...structuredClone(nu(Ae,he.kind)),[Le]:`${he.label} (copy)`};try{await se.mutateAsync({blockKey:He,data:yc(He,he.kind,De)}),xe.success(`Duplicated "${he.label}"`),x({collection:he.kind,key:He})}catch(Qe){xe.error(Qe instanceof Error?Qe.message:"Duplicate failed")}},bt=he=>{I(Ae=>{const He=new Set(Ae);return He.has(he)?He.delete(he):He.add(he),He})},_t=he=>{p("posts"),F("posts"),x(null),y(null),S(""),j(null),T(null),V(null),E("date-desc"),I(new Set),O(he||null)},tt=async(he,Ae)=>{const He=[...R];let Le=0;for(const De of He){const Qe=u[De],Be=nu(Qe,"posts"),Lt=he==="add"?pae(Be,Ae):gae(Be,Ae);Lt!==Be&&(await se.mutateAsync({blockKey:De,data:yc(De,"posts",Av(Lt))}),Le+=1)}return Le},ft=async(he,Ae)=>{const He=R.size;try{const Le=await tt(he,Ae),De=he==="add"?"Added to":"Moved",Qe=He-Le;xe.success(`${De} ${Le} ${Le===1?"post":"posts"}`+(Qe>0?` (${Qe} already set)`:"")),z()}catch(Le){xe.error(Le instanceof Error?Le.message:"Bulk update failed")}},xt=async()=>{if(ee)try{if(ee.kind==="blog-bulk"){for(const Le of ee.keys)await oe.mutateAsync({blockKey:Le});xe.success(`Deleted ${ee.count} ${ee.count===1?"post":"posts"}`),g&&g.collection!=="available-section"&&ee.keys.includes(g.key)&&x(null),z(),ae(null);return}const{kind:he,key:Ae,label:He}=ee;if(he==="blog"){if(ee.blogKind==="categories"){const Le=nu(u[Ae],"categories").slug,De=typeof Le=="string"?Le:"";if(De)for(const{key:Qe,payload:Be}of Gu(u,"posts")){const Lt=xae(Be,De);Lt!==Be&&await se.mutateAsync({blockKey:Qe,data:yc(Qe,"posts",Av(Lt))})}}await oe.mutateAsync({blockKey:Ae})}else await oe.mutateAsync({blockKey:Ae});xe.success(`Deleted "${He}"`),g&&g.collection!=="available-section"&&g.key===Ae&&x(null),ae(null)}catch(he){xe.error(he instanceof Error?he.message:"Delete failed")}},Ee=oe.isPending||se.isPending,dt=ee?.kind==="blog"?_u[ee.blogKind]:ee?.kind==="blog-bulk"?`${ee.count} ${ee.count===1?"post":"posts"}`:ee?.kind??"item";return o.jsxs("div",{className:"flex h-full w-full",children:[o.jsx(qle,{active:m,counts:et,showBlog:ke,onSelect:he=>{p(he),x(null),y(null)}}),m!=="seo"&&m!=="site"&&m!=="calendar"&&m!=="post-schedule"&&m!=="loaders"&&m!=="actions"&&o.jsx(zce,{activeCollection:m,pages:pe,redirects:te,sections:ge,availableSections:ve,appCatalog:G,appCatalogLoading:Y,blogEntries:we,decofile:u,searchQuery:w,onSearchChange:S,postCategoryFilter:k,postAuthorFilter:C,postStatusFilter:N,postSort:A,onPostCategoryFilterChange:he=>{j(he),I(new Set)},onPostAuthorFilterChange:he=>{T(he),I(new Set)},onPostStatusFilterChange:he=>{V(he),I(new Set)},onPostSortChange:E,selectedPostKeys:R,postBulkPanelOpen:me,onTogglePostSelect:bt,onSelectAllPosts:he=>I(new Set(he)),onClearPostSelection:()=>I(new Set),onExitPostSelection:z,onBulkDeletePosts:()=>ae({kind:"blog-bulk",keys:[...R],count:R.size}),selection:g,onSelect:M,onCreate:()=>{m==="pages"?nt():m==="redirects"?Ue():Lu(m)&&st(m)},onDuplicatePage:it,onRenamePage:ut,onAddPageVariant:rt,onDeletePage:he=>ae({kind:"page",key:he.key,label:he.name}),onEditPageSeo:he=>{const Ae={collection:"pages",key:he.key,path:he.path};x(Ae),y(he.key)},onViewPageJson:he=>fe(he.key),onDuplicateSection:vt,onRenameSection:he=>le(he.key),onDeleteSection:he=>ae({kind:"section",key:he.key,label:he.name}),onDeleteRedirect:he=>ae({kind:"redirect",key:he.key,label:he.from||he.key}),onDuplicateBlog:Vt,onDeleteBlog:he=>ae({kind:"blog",blogKind:he.kind,key:he.key,label:he.label})}),o.jsx("div",{className:"flex-1 min-w-0",children:m==="loaders"||m==="actions"?o.jsx(zae,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:U,decofile:u,kind:m}):o.jsx(P.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(ot,{size:20,className:"animate-spin text-muted-foreground"})}),children:m==="calendar"?o.jsx(Dce,{decofile:u}):m==="post-schedule"?o.jsx(Ice,{decofile:u,support:J,isCreating:se.isPending,onCreate:he=>{gt(he)},onReschedule:(he,Ae)=>{pt(he,Ae)},onSelect:he=>{p("posts"),F("posts"),x({collection:"posts",key:he}),y(null)}}):m==="site"?Se?o.jsx(Hv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:Se.key,block:u[Se.key],decofile:u,meta:U,title:"Site",excludeFields:["seo"],schemaPending:W(Se.resolveType,["seo"]),previewBaseUrl:n},`site:${Se.key}`):o.jsx(Fo,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):m==="seo"?o.jsx(Rce,{orgSlug:t,virtualMcpId:e,branch:s,decofile:u,meta:U,target:{kind:"site"},previewBaseUrl:i}):m==="sections"?o.jsx(xce,{selection:g?.collection==="sections"||g?.collection==="available-section"?g:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:U,decofile:u,isCreating:se.isPending,onCreateAvailable:lt,onSaveReferencedBlock:Oe}):me?o.jsx(Pce,{posts:Ce,categories:je,initialSlug:D,isPending:se.isPending,onApply:(he,Ae)=>{ft(he,Ae)},onClose:z},D??"selection"):g&&g.collection!=="available-section"?g.collection==="apps"?o.jsx(Hv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key],decofile:u,meta:U,previewBaseUrl:n,schemaPending:W(typeof u[g.key]?.__resolveType=="string"?String(u[g.key].__resolveType):void 0)},`app:${g.key}`):g.collection==="posts"?o.jsx(Tce,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key],decofile:u,meta:U,previewBaseUrl:i},`post:${g.key}`):g.collection==="categories"?o.jsx(Ace,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key],decofile:u,meta:U,onManagePosts:_t,onOpenPost:he=>{p("posts"),F("posts"),x({collection:"posts",key:he}),y(null)},previewBaseUrl:i},`category:${g.key}`):g.collection==="authors"?o.jsx(Vce,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:g.key,block:u[g.key]},`authors:${g.key}`):g.collection==="redirects"?o.jsx(Mce,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:u[g.key]},`redirect:${g.key}`):o.jsx(Ece,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:g.collection==="pages"?g.path:"/",activePageBlockKey:g.collection==="pages"?g.key:null,activeGlobalBlockKey:g.collection==="sections"?g.key:null,initialEditSeo:g.collection==="pages"&&b===g.key,onExitSeo:()=>y(null)},g.collection==="pages"?`page:${g.key}`:`section:${g.key}`):o.jsx(Fo,{title:`Select ${Lu(m)?`a ${_u[m]}`:m==="pages"?"a page":m==="apps"?"an app":m==="redirects"?"a redirect":"a section"} to edit`,description:m==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),ne&&o.jsx(oae,{open:!!ne,mode:ne.mode,initialName:ne.initialName,initialPath:ne.initialPath,isPending:se.isPending,error:K,templates:pe,validate:ct,onSubmit:Ct,onOpenChange:he=>{he||(Q(null),X(void 0))}}),Z&&o.jsx(lae,{open:!!Z,blockKey:Z,initialName:ge.find(he=>he.key===Z)?.name??Z,isPending:se.isPending,onSubmit:_e,onOpenChange:he=>{he||le(null)}}),ce&&o.jsx(Dae,{open:!!ce,onOpenChange:he=>{he||fe(null)},pageKey:ce,decofile:u,onSave:he=>se.mutateAsync({blockKey:ce,data:he})}),o.jsx(el,{open:!!ee,onOpenChange:he=>{!he&&!Ee&&ae(null)},children:o.jsxs(tl,{children:[o.jsxs(sl,{children:[o.jsx(nl,{children:`Delete ${dt}?`}),o.jsx(il,{children:ee?.kind==="section"?`"${ee.label}" will be removed. Pages that still reference it will lose this section.`:ee?.kind==="blog-bulk"?`${ee.count} ${ee.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:ee?`"${ee.label}" will be removed permanently. This can't be undone.`:null})]}),o.jsxs(rl,{children:[o.jsx(ol,{disabled:Ee,children:"Cancel"}),o.jsx(ll,{onClick:he=>{he.preventDefault(),xt()},disabled:Ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Ee?o.jsxs(o.Fragment,{children:[o.jsx(ot,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function zce(t){const e=B.c(82),{activeCollection:s,pages:n,redirects:i,sections:r,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:f,searchQuery:u,onSearchChange:h,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:y,onPostStatusFilterChange:L,onPostSortChange:v,selectedPostKeys:_,postBulkPanelOpen:w,onTogglePostSelect:S,onSelectAllPosts:k,onClearPostSelection:j,onExitPostSelection:C,onBulkDeletePosts:T,selection:N,onSelect:V,onCreate:A,onDuplicatePage:E,onRenamePage:R,onAddPageVariant:I,onDeletePage:D,onEditPageSeo:O,onViewPageJson:z,onDuplicateSection:M,onRenameSection:$,onDeleteSection:F,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:q}=t;let W,G,Y,J,se,oe,ne;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==f||e[6]!==I||e[7]!==T||e[8]!==j||e[9]!==A||e[10]!==q||e[11]!==D||e[12]!==U||e[13]!==F||e[14]!==H||e[15]!==E||e[16]!==M||e[17]!==O||e[18]!==C||e[19]!==y||e[20]!==b||e[21]!==v||e[22]!==L||e[23]!==R||e[24]!==$||e[25]!==h||e[26]!==V||e[27]!==k||e[28]!==S||e[29]!==z||e[30]!==n||e[31]!==p||e[32]!==w||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==u||e[38]!==r||e[39]!==_||e[40]!==N){const Z=u.toLowerCase(),le=n.filter(_e=>!Z||_e.name.toLowerCase().includes(Z)||_e.path.toLowerCase().includes(Z)),ee=i.filter(_e=>!Z||_e.from.toLowerCase().includes(Z)||_e.to.toLowerCase().includes(Z)),ae=r.filter(_e=>!Z||_e.name.toLowerCase().includes(Z)||_e.key.toLowerCase().includes(Z)||_e.resolveType.toLowerCase().includes(Z)),ce=l.filter(_e=>!Z||_e.title.toLowerCase().includes(Z)||_e.resolveType.toLowerCase().includes(Z)||(_e.description?.toLowerCase().includes(Z)??!1)),fe=Nce(ae),de=a.filter(_e=>!Z||_e.title.toLowerCase().includes(Z)||_e.app.toLowerCase().includes(Z)||_e.vendor.toLowerCase().includes(Z)||_e.category.toLowerCase().includes(Z)),pe=d.filter(_e=>!Z||_e.label.toLowerCase().includes(Z)||_e.subtitle.toLowerCase().includes(Z)),te=s==="posts",ge=Kce,ve=te?Hj(f):[],Se=new Map,ye=new Map,ke={published:0,scheduled:0,draft:0};for(const _e of ve)ke[_e.status]=ke[_e.status]+1;for(const _e of ve){for(const Ue of _e.categorySlugs)Se.set(Ue,(Se.get(Ue)??0)+1);for(const Ue of _e.authorEmails)ye.set(Ue,(ye.get(Ue)??0)+1)}const we=(te?Gu(f,"categories"):[]).map(_e=>{const{key:Ue,payload:st}=_e,gt=ge(st.slug)||Ue;return{slug:gt,name:ge(st.name)||ge(st.slug)||Ue,count:Se.get(gt)??0}}).filter(Hce),je=(te?Gu(f,"authors"):[]).map(_e=>{const{key:Ue,payload:st}=_e,gt=ge(st.email);return{email:gt,name:ge(st.name)||ge(st.email)||Ue,count:ye.get(gt)??0}}).filter(Uce);let me;e[48]!==m?(me=_e=>!m||_e.categorySlugs.includes(m),e[48]=m,e[49]=me):me=e[49];let Ce;e[50]!==p?(Ce=_e=>!p||_e.authorEmails.includes(p),e[50]=p,e[51]=Ce):Ce=e[51];let Ne;e[52]!==g?(Ne=_e=>!g||_e.status===g,e[52]=g,e[53]=Ne):Ne=e[53];let Ie;e[54]!==x?(Ie=(_e,Ue)=>{if(x==="az")return _e.title.localeCompare(Ue.title);if(x==="za")return Ue.title.localeCompare(_e.title);const st=_e.date.localeCompare(Ue.date);return x==="date-asc"?st:-st},e[54]=x,e[55]=Ie):Ie=e[55];const et=ve.filter(_e=>!Z||_e.title.toLowerCase().includes(Z)||_e.slug.toLowerCase().includes(Z)).filter(me).filter(Ce).filter(Ne).sort(Ie),Ze=_.size,Te=et.map(Fce),Me=Te.length>0&&Te.every(_e=>_.has(_e)),rt=Ze>0||w,nt=()=>{Me?j():k(Te)},it=`Search ${s}…`,ut=Lu(s)?`Create new ${_u[s]}`:s==="redirects"?"Create new redirect":"Create new page",Ct=s!=="apps"&&s!=="sections";se="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let ct;e[56]===Symbol.for("react.memo_cache_sentinel")?(ct=o.jsx(k9,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=ct):ct=e[56];let lt;e[57]!==h?(lt=_e=>h(_e.target.value),e[57]=h,e[58]=lt):lt=e[58];let Oe;e[59]!==it||e[60]!==u||e[61]!==lt?(Oe=o.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[ct,o.jsx("input",{type:"text",value:u,onChange:lt,placeholder:it,"aria-label":it,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=it,e[60]=u,e[61]=lt,e[62]=Oe):Oe=e[62];let vt;e[63]!==ut||e[64]!==A||e[65]!==Ct?(vt=Ct&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon",onClick:A,"aria-label":ut,children:o.jsx(Kt,{size:14})})}),o.jsx(We,{side:"bottom",children:ut})]}),e[63]=ut,e[64]=A,e[65]=Ct,e[66]=vt):vt=e[66],e[67]!==Oe||e[68]!==vt?(oe=o.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[Oe,vt]}),e[67]=Oe,e[68]=vt,e[69]=oe):oe=e[69],ne=te&&(rt?o.jsx(kce,{count:Ze,allSelected:Me,onToggleSelectAll:nt,onDelete:T,onExit:C}):o.jsx(vce,{categories:we,authors:je,categoryFilter:m,statusCounts:ke,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:y,onStatusFilterChange:L,onSortChange:v})),W=xl,J="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",G="flex flex-col gap-1 p-1.5",Y=s==="pages"?le.length===0?o.jsx(vc,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):le.map(_e=>{const Ue=N?.collection==="pages"&&N.key===_e.key,st=vk(f,_e.key);return o.jsx(vi,{icon:Ko,title:_e.name,subtitle:_e.path,active:Ue,variantCount:st,onClick:()=>V({collection:"pages",key:_e.key,path:_e.path}),menu:o.jsx(Fd,{onDuplicate:()=>E(_e),onRename:()=>R(_e),onAddVariant:()=>I(_e),onEditSeo:()=>O(_e),onViewJson:()=>z(_e),onDelete:()=>D(_e)})},_e.key)}):s==="sections"?ae.length===0&&ce.length===0?o.jsx(vc,{hasItems:r.length>0||l.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):o.jsxs(o.Fragment,{children:[fe.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Uv,{icon:Hl,label:"Saved sections"}),fe.map(_e=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:_e.label}),_e.sections.map(Ue=>{const st=N?.collection==="sections"&&N.key===Ue.key;return o.jsx(vi,{icon:Hl,accent:"global",title:Ue.name,subtitle:_e.label,active:st,onClick:()=>V({collection:"sections",key:Ue.key}),menu:o.jsx(Fd,{onDuplicate:()=>M(Ue),onRename:()=>$(Ue),onDelete:()=>F(Ue)})},Ue.key)})]},_e.label))]}),ce.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Uv,{icon:Ko,label:"Available sections",className:ie(fe.length>0&&"mt-3")}),ce.map(_e=>{const Ue=N?.collection==="available-section"&&N.resolveType===_e.resolveType,st=_e.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return o.jsx(vi,{icon:Ko,title:_e.title,subtitle:st??_e.resolveType,active:Ue,onClick:()=>V({collection:"available-section",resolveType:_e.resolveType,title:_e.title})},_e.resolveType)})]})]}):s==="apps"?c?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(ot,{size:18,className:"animate-spin text-muted-foreground"})}):de.length===0?o.jsx(vc,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):de.map(_e=>{const Ue=N?.collection==="apps"&&_e.blockKey!==null&&N.key===_e.blockKey;return o.jsx(vi,{icon:f7,logoUrl:_e.logo,title:_e.title,subtitle:_e.category,active:Ue,trailing:_e.installed?o.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!_e.installed||!_e.blockKey){xe.message(`${_e.title} is not installed on this site.`);return}V({collection:"apps",key:_e.blockKey})}},_e.id)}):s==="redirects"?ee.length===0?o.jsx(vc,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):ee.map(_e=>o.jsx(vi,{icon:y8,title:_e.from||"(no source)",subtitle:`→ ${_e.to||"(no target)"}`,active:N?.collection==="redirects"&&N.key===_e.key,trailing:o.jsx(aae,{type:_e.type}),onClick:()=>V({collection:"redirects",key:_e.key}),menu:o.jsx(Fd,{onDelete:()=>U(_e)})},_e.key)):te?et.length===0?o.jsx(vc,{hasItems:ve.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):et.map(_e=>{const Ue={key:_e.key,kind:"posts",label:_e.title,subtitle:_e.slug};return o.jsx(vi,{icon:Qr,title:_e.title,subtitle:_e.slug||"no slug",invalid:_e.missing.length>0,invalidReason:`Missing: ${_e.missing.join(", ")}`,active:N?.collection==="posts"&&N.key===_e.key,selectable:!0,selectionActive:rt,selected:_.has(_e.key),onToggleSelect:()=>S(_e.key),onClick:()=>rt?S(_e.key):V({collection:"posts",key:_e.key}),menu:o.jsx(Fd,{onDuplicate:()=>H(Ue),onDelete:()=>q(Ue)})},_e.key)}):pe.length===0?o.jsx(vc,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${Lu(s)?_u[s]:"item"}.`}):pe.map(_e=>{const Ue=N?.collection===_e.kind&&N.key===_e.key;return o.jsx(vi,{icon:_e.kind==="posts"?Qr:_e.kind==="authors"?Cg:c9,title:_e.label,subtitle:_e.subtitle,active:Ue,onClick:()=>V({collection:_e.kind,key:_e.key}),menu:o.jsx(Fd,{onDuplicate:()=>H(_e),onDelete:()=>q(_e)})},_e.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=f,e[6]=I,e[7]=T,e[8]=j,e[9]=A,e[10]=q,e[11]=D,e[12]=U,e[13]=F,e[14]=H,e[15]=E,e[16]=M,e[17]=O,e[18]=C,e[19]=y,e[20]=b,e[21]=v,e[22]=L,e[23]=R,e[24]=$,e[25]=h,e[26]=V,e[27]=k,e[28]=S,e[29]=z,e[30]=n,e[31]=p,e[32]=w,e[33]=m,e[34]=x,e[35]=g,e[36]=i,e[37]=u,e[38]=r,e[39]=_,e[40]=N,e[41]=W,e[42]=G,e[43]=Y,e[44]=J,e[45]=se,e[46]=oe,e[47]=ne}else W=e[41],G=e[42],Y=e[43],J=e[44],se=e[45],oe=e[46],ne=e[47];let Q;e[70]!==G||e[71]!==Y?(Q=o.jsx("div",{className:G,children:Y}),e[70]=G,e[71]=Y,e[72]=Q):Q=e[72];let K;e[73]!==W||e[74]!==J||e[75]!==Q?(K=o.jsx(W,{className:J,children:Q}),e[73]=W,e[74]=J,e[75]=Q,e[76]=K):K=e[76];let X;return e[77]!==se||e[78]!==oe||e[79]!==ne||e[80]!==K?(X=o.jsxs("div",{className:se,children:[oe,ne,K]}),e[77]=se,e[78]=oe,e[79]=ne,e[80]=K,e[81]=X):X=e[81],X}function Fce(t){return t.key}function Uce(t){return t.email}function Hce(t){return t.slug}function Kce(t){return typeof t=="string"?t:""}function Wce(t){const e=B.c(17),{virtualMcpId:s}=t,n=re(),i=Is(s),{activeTask:r}=sn();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const a=hl(l);if(!(Zs(i?.metadata)||Zs(r?.metadata))){let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(pn,{size:24,className:"text-muted-foreground/60"}),e[1]=f):f=e[1];let u;e[2]!==n?(u=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=u):u=e[3];let h;e[4]!==u?(h=o.jsx("div",{children:u}),e[4]=u,e[5]=h):h=e[5];let m;e[6]!==n?(m=n("mainPanelTabs.contentTab.connectGithubDescription"),e[6]=n,e[7]=m):m=e[7];let p;e[8]!==m?(p=o.jsx("div",{className:"text-xs text-muted-foreground/80",children:m}),e[8]=m,e[9]=p):p=e[9];let g;return e[10]!==h||e[11]!==p?(g=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[f,h,p]}),e[10]=h,e[11]=p,e[12]=g):g=e[12],g}let d;return e[13]!==a.contentPageId||e[14]!==a.contentPath||e[15]!==a.contentPathTemplate?(d=o.jsx(Oce,{deepLinkPage:{pageId:a.contentPageId,path:a.contentPath,pathTemplate:a.contentPathTemplate}}),e[13]=a.contentPageId,e[14]=a.contentPath,e[15]=a.contentPathTemplate,e[16]=d):d=e[16],d}function qce(t){const e=B.c(6),{virtualMcpId:s}=t,n=Is(s),i=K8();let r;e[0]!==i||e[1]!==n?(r=D9(i,vL(n)),e[0]=i,e[1]=n,e[2]=r):r=e[2];const l=r;if(!l){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Gce,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=o.jsx(Qce,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function Gce(){const t=B.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:o.jsx(wg,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("assets.browser.noBucketTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("assets.browser.noBucketDescription"),t[5]=e,t[6]=r):r=t[6];let l;t[7]!==r?(l=o.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=o.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-3 p-10 text-center",children:[s,o.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function Yce(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function Jce(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function Qce(t){const e=B.c(99),{config:s}=t,n=re(),[i,r]=P.useState(""),l=j9(i,300);let a;e[0]!==s.id||e[1]!==l?(a={configId:s.id,search:l},e[0]=s.id,e[1]=l,e[2]=a):a=e[2];const c=cj(a),d=r1(),[f,u]=P.useState(!1),[h,m]=P.useState(null),p=P.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(M){if(!M)return;const $=Array.from(M);if($.length===0)return;const F=[];for(const U of $)try{await d.mutateAsync({configId:s.id,file:U})}catch(H){const q=H;F.push(`${U.name} (${q instanceof Error?q.message:"upload failed"})`)}await c.refetch(),F.length>0&&xe.error(F.length===$.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:F.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:F.join("; ")}))},e[3]=s.id,e[4]=c,e[5]=n,e[6]=d,e[7]=g):g=e[7];const x=g;let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=function(M){M.preventDefault(),u(!0)},e[8]=b):b=e[8];const y=b;let L;e[9]===Symbol.for("react.memo_cache_sentinel")?(L=function(){u(!1)},e[9]=L):L=e[9];const v=L;let _;e[10]!==x?(_=function(M){M.preventDefault(),M.stopPropagation(),u(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=_):_=e[11];const w=_,[S,k]=sp();let j,C,T,N,V,A;if(e[12]!==s.name||e[13]!==l||e[14]!==k||e[15]!==S||e[16]!==x||e[17]!==f||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==w||e[22]!==i||e[23]!==n||e[24]!==d.isPending){const M=(c.data?.pages??[]).flatMap(Xce),$=Jce(M,Yce(S)),F=l.trim(),U=i!==l||c.isFetching&&!c.isFetchingNextPage;V="flex h-full min-h-0 flex-col gap-3 p-4";let H;e[31]!==n?(H=n("assets.browser.title"),e[31]=n,e[32]=H):H=e[32];let q;e[33]!==H?(q=o.jsx("h2",{className:"text-sm font-semibold",children:H}),e[33]=H,e[34]=q):q=e[34];let W;e[35]!==s.name||e[36]!==n?(W=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=W):W=e[37];let G;e[38]!==W?(G=o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:W}),e[38]=W,e[39]=G):G=e[39];let Y;e[40]!==q||e[41]!==G?(Y=o.jsxs("div",{className:"min-w-0",children:[q,G]}),e[40]=q,e[41]=G,e[42]=Y):Y=e[42];let J;e[43]===Symbol.for("react.memo_cache_sentinel")?(J=()=>p.current?.click(),e[43]=J):J=e[43];let se;e[44]!==d.isPending?(se=d.isPending?o.jsx(ot,{size:14,className:"animate-spin"}):o.jsx(Gn,{size:14}),e[44]=d.isPending,e[45]=se):se=e[45];let oe;e[46]!==n||e[47]!==d.isPending?(oe=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=oe):oe=e[48];let ne;e[49]!==se||e[50]!==oe||e[51]!==d.isPending?(ne=o.jsxs(ue,{type:"button",size:"sm",disabled:d.isPending,onClick:J,children:[se,oe]}),e[49]=se,e[50]=oe,e[51]=d.isPending,e[52]=ne):ne=e[52];let Q;e[53]!==x?(Q=o.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:pe=>{const te=Array.from(pe.target.files??[]);pe.target.value="",x(te)}}),e[53]=x,e[54]=Q):Q=e[54],e[55]!==Y||e[56]!==ne||e[57]!==Q?(A=o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[Y,ne,Q]}),e[55]=Y,e[56]=ne,e[57]=Q,e[58]=A):A=e[58];let K;e[59]!==n?(K=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=K):K=e[60],e[61]!==U||e[62]!==i||e[63]!==K?(j=o.jsx(L9,{value:i,onChange:r,isSearching:U,placeholder:K,className:"shrink-0"}),e[61]=U,e[62]=i,e[63]=K,e[64]=j):j=e[64];let X;e[65]===Symbol.for("react.memo_cache_sentinel")?(X=()=>p.current?.click(),e[65]=X):X=e[65];const Z=f&&"border-primary bg-primary/5",le=d.isPending&&"pointer-events-none opacity-60";let ee;e[66]!==Z||e[67]!==le?(ee=ie("flex shrink-0 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border/60 p-4 text-center transition-colors",Z,le),e[66]=Z,e[67]=le,e[68]=ee):ee=e[68];let ae;e[69]===Symbol.for("react.memo_cache_sentinel")?(ae=o.jsx(Gn,{size:16,className:"text-muted-foreground"}),e[69]=ae):ae=e[69];let ce;e[70]!==n?(ce=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=ce):ce=e[71];let fe;e[72]!==n?(fe=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=fe):fe=e[73];let de;e[74]!==ce||e[75]!==fe?(de=o.jsxs("p",{className:"text-xs text-muted-foreground",children:[ce," ",fe]}),e[74]=ce,e[75]=fe,e[76]=de):de=e[76],e[77]!==w||e[78]!==ee||e[79]!==de?(C=o.jsxs("button",{type:"button",onClick:X,onDragOver:y,onDragLeave:v,onDrop:w,className:ee,children:[ae,de]}),e[77]=w,e[78]=ee,e[79]=de,e[80]=C):C=e[80],T="min-h-0 flex-1 overflow-y-auto pr-1",N=M.length===0?F?o.jsx(qv,{title:n("filePicker.filePickerDialog.noMatches",{query:F}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):o.jsx(qv,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):o.jsx("div",{ref:k,className:"flex items-start gap-3",children:$.map((pe,te)=>o.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:pe.map(ge=>o.jsx(Zce,{item:ge,onDelete:()=>m(ge)},ge.key))},te))}),e[12]=s.name,e[13]=l,e[14]=k,e[15]=S,e[16]=x,e[17]=f,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=w,e[22]=i,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=C,e[27]=T,e[28]=N,e[29]=V,e[30]=A}else j=e[25],C=e[26],T=e[27],N=e[28],V=e[29],A=e[30];let E;e[81]!==c||e[82]!==n?(E=c.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(ue,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(ot,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=E):E=e[83];let R;e[84]!==E||e[85]!==T||e[86]!==N?(R=o.jsxs("div",{className:T,children:[N,E]}),e[84]=E,e[85]=T,e[86]=N,e[87]=R):R=e[87];let I;e[88]===Symbol.for("react.memo_cache_sentinel")?(I=()=>m(null),e[88]=I):I=e[88];let D;e[89]!==s.id||e[90]!==h?(D=o.jsx(sde,{configId:s.id,item:h,onClose:I}),e[89]=s.id,e[90]=h,e[91]=D):D=e[91];let O;return e[92]!==j||e[93]!==C||e[94]!==R||e[95]!==D||e[96]!==V||e[97]!==A?(O=o.jsxs("div",{className:V,children:[A,j,C,R,D]}),e[92]=j,e[93]=C,e[94]=R,e[95]=D,e[96]=V,e[97]=A,e[98]=O):O=e[98],O}function Xce(t){return t.items}function qv(t){const e=B.c(8),{title:s,description:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(fr,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx("p",{className:"text-sm font-medium",children:s}),e[1]=s,e[2]=r):r=e[2];let l;e[3]!==n?(l=o.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==r||e[6]!==l?(a=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,r,l]}),e[5]=r,e[6]=l,e[7]=a):a=e[7],a}function Zce(t){const e=B.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=dj(s.key),e[0]=s.key,e[1]=i):i=e[1];const r=i;let l;e[2]!==s.key?(l=Cx(s.key),e[2]=s.key,e[3]=l):l=e[3];const a=l;let c;e[4]!==a||e[5]!==s.key||e[6]!==s.publicUrl?(c=a?o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:ede}):o.jsx("div",{className:"flex aspect-square items-center justify-center",children:o.jsx(Qr,{size:28,className:"text-muted-foreground"})}),e[4]=a,e[5]=s.key,e[6]=s.publicUrl,e[7]=c):c=e[7];let d;e[8]!==s.key||e[9]!==s.publicUrl||e[10]!==c?(d=o.jsx("a",{href:s.publicUrl,target:"_blank",rel:"noreferrer",title:s.key,className:"block transition hover:ring-2 hover:ring-inset hover:ring-primary",children:c}),e[8]=s.key,e[9]=s.publicUrl,e[10]=c,e[11]=d):d=e[11];const f=s.key;let u;e[12]!==s.key?(u=Rh(s.key),e[12]=s.key,e[13]=u):u=e[13];let h;e[14]!==s.key||e[15]!==u?(h=o.jsx("p",{className:"truncate text-xs font-medium",title:f,children:u}),e[14]=s.key,e[15]=u,e[16]=h):h=e[16];let m;e[17]!==s.size?(m=uj(s.size),e[17]=s.size,e[18]=m):m=e[18];let p;e[19]!==r||e[20]!==m?(p=o.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[r," · ",m]}),e[19]=r,e[20]=m,e[21]=p):p=e[21];let g;e[22]!==h||e[23]!==p?(g=o.jsxs("div",{className:"min-w-0 flex-1",children:[h,p]}),e[22]=h,e[23]=p,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=o.jsx(tde,{item:s,onDelete:n}),e[25]=s,e[26]=n,e[27]=x):x=e[27];let b;e[28]!==g||e[29]!==x?(b=o.jsxs("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background px-2 py-1.5",children:[g,x]}),e[28]=g,e[29]=x,e[30]=b):b=e[30];let y;return e[31]!==b||e[32]!==d?(y=o.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border/60 bg-muted",children:[d,b]}),e[31]=b,e[32]=d,e[33]=y):y=e[33],y}function ede(t){t.target.style.display="none"}function tde(t){const e=B.c(36),{item:s,onDelete:n}=t,i=re(),[r,l]=P.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(){try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{xe.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Rg,{size:14}),e[5]=f):f=e[5];let u;e[6]!==d?(u=o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:f})}),e[6]=d,e[7]=u):u=e[7];let h;e[8]!==r?(h=r?o.jsx(Ft,{size:14}):o.jsx(an,{size:14}),e[8]=r,e[9]=h):h=e[9];let m;e[10]!==r||e[11]!==i?(m=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=r,e[11]=i,e[12]=m):m=e[12];let p;e[13]!==c||e[14]!==h||e[15]!==m?(p=o.jsxs(Xe,{onClick:c,children:[h,m]}),e[13]=c,e[14]=h,e[15]=m,e[16]=p):p=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(hn,{size:14}),e[17]=x):x=e[17];let b;e[18]!==i?(b=i("filePicker.filePickerDialog.openInNewTab"),e[18]=i,e[19]=b):b=e[19];let y;e[20]!==s.publicUrl||e[21]!==b?(y=o.jsx(Xe,{asChild:!0,children:o.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=y):y=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(tn,{size:14}),e[23]=L):L=e[23];let v;e[24]!==i?(v=i("assets.browser.deleteAction"),e[24]=i,e[25]=v):v=e[25];let _;e[26]!==n||e[27]!==v?(_=o.jsxs(Xe,{variant:"destructive",onClick:n,children:[L,v]}),e[26]=n,e[27]=v,e[28]=_):_=e[28];let w;e[29]!==y||e[30]!==_||e[31]!==p?(w=o.jsxs(zt,{align:"end",children:[p,y,_]}),e[29]=y,e[30]=_,e[31]=p,e[32]=w):w=e[32];let S;return e[33]!==w||e[34]!==u?(S=o.jsxs($t,{children:[u,w]}),e[33]=w,e[34]=u,e[35]=S):S=e[35],S}function sde(t){const e=B.c(47),{configId:s,item:n,onClose:i}=t,r=re(),l=mre();let a;e[0]!==s||e[1]!==l||e[2]!==n||e[3]!==i||e[4]!==r?(a=async function(){if(n)try{await l.mutateAsync({configId:s,key:n.key}),xe.success(r("assets.browser.deleted")),i()}catch{xe.error(r("assets.browser.deleteFailed"))}},e[0]=s,e[1]=l,e[2]=n,e[3]=i,e[4]=r,e[5]=a):a=e[5];const c=a,d=!!n;let f;e[6]!==i?(f=N=>!N&&i(),e[6]=i,e[7]=f):f=e[7];let u;e[8]!==r?(u=r("assets.browser.deleteConfirmTitle"),e[8]=r,e[9]=u):u=e[9];let h;e[10]!==u?(h=o.jsx(nl,{children:u}),e[10]=u,e[11]=h):h=e[11];let m;e[12]!==n||e[13]!==r?(m=r("assets.browser.deleteConfirmDescription",{name:n?Rh(n.key):""}),e[12]=n,e[13]=r,e[14]=m):m=e[14];let p;e[15]!==m?(p=o.jsx(il,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==h||e[18]!==p?(g=o.jsxs(sl,{children:[h,p]}),e[17]=h,e[18]=p,e[19]=g):g=e[19];const x=l.isPending;let b;e[20]!==r?(b=r("assets.browser.deleteCancel"),e[20]=r,e[21]=b):b=e[21];let y;e[22]!==l.isPending||e[23]!==b?(y=o.jsx(ol,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=y):y=e[24];let L;e[25]===Symbol.for("react.memo_cache_sentinel")?(L=ie($6({variant:"destructive"})),e[25]=L):L=e[25];const v=l.isPending;let _;e[26]!==c?(_=N=>{N.preventDefault(),c()},e[26]=c,e[27]=_):_=e[27];let w;e[28]!==l.isPending?(w=l.isPending?o.jsx(ot,{size:14,className:"animate-spin"}):null,e[28]=l.isPending,e[29]=w):w=e[29];let S;e[30]!==r?(S=r("assets.browser.deleteConfirm"),e[30]=r,e[31]=S):S=e[31];let k;e[32]!==l.isPending||e[33]!==_||e[34]!==w||e[35]!==S?(k=o.jsxs(ll,{className:L,disabled:v,onClick:_,children:[w,S]}),e[32]=l.isPending,e[33]=_,e[34]=w,e[35]=S,e[36]=k):k=e[36];let j;e[37]!==y||e[38]!==k?(j=o.jsxs(rl,{children:[y,k]}),e[37]=y,e[38]=k,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==g?(C=o.jsxs(tl,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=C):C=e[42];let T;return e[43]!==C||e[44]!==d||e[45]!==f?(T=o.jsx(el,{open:d,onOpenChange:f,children:C}),e[43]=C,e[44]=d,e[45]=f,e[46]=T):T=e[46],T}const fm={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:ua},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Wr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:o8}},nde=["fast","smart","thinking"];function ide(t){const e=B.c(19),{tier:s,onSelect:n}=t,i=re(),[r,l]=P.useState(!1),a=fm[s].icon;let c;e[0]!==a?(c=o.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=c):c=e[1];const d=fm[s];let f;e[2]!==i||e[3]!==d.labelKey?(f=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=f):f=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Qt,{size:14,className:"text-muted-foreground"}),e[5]=u):u=e[5];let h;e[6]!==c||e[7]!==f?(h=o.jsx(ns,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,f,u]})}),e[6]=c,e[7]=f,e[8]=h):h=e[8];let m;e[9]!==n||e[10]!==i||e[11]!==s?(m=nde.map(x=>{const b=fm[x],y=b.icon;return o.jsxs("button",{type:"button",onClick:()=>{n(x),l(!1)},className:ie("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[o.jsx(y,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"text-sm",children:i(b.labelKey)}),o.jsx("div",{className:"text-xs text-muted-foreground",children:i(b.subtitleKey)})]}),x===s&&o.jsx(Ft,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;e[13]!==m?(p=o.jsx(is,{align:"start",className:"p-1 w-64",children:o.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==r||e[16]!==h||e[17]!==p?(g=o.jsxs(rs,{open:r,onOpenChange:l,children:[h,p]}),e[15]=r,e[16]=h,e[17]=p,e[18]=g):g=e[18],g}function rde(t){const e=B.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:r}=t,l=re(),[a,c]=P.useState(i!==null);let d;e[0]!==l?(d=l("automations.automationConfig.modelLabel"),e[0]=l,e[1]=d):d=e[1];let f;e[2]!==d?(f=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=f):f=e[3];let u;e[4]!==r||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(u=a?o.jsx(P.Suspense,{fallback:o.jsx(ue,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:o.jsx(ode,{override:i,onOverrideChange:r})}):o.jsx(ide,{tier:s,onSelect:n}),e[4]=r,e[5]=n,e[6]=i,e[7]=l,e[8]=s,e[9]=a,e[10]=u):u=e[10];let h;e[11]!==r?(h=y=>{c(y),y||r(null)},e[11]=r,e[12]=h):h=e[12];let m;e[13]!==h||e[14]!==a?(m=o.jsx(hr,{checked:a,onCheckedChange:h,className:"cursor-pointer"}),e[13]=h,e[14]=a,e[15]=m):m=e[15];let p;e[16]!==l?(p=l("automations.automationConfig.specificModel"),e[16]=l,e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==p?(g=o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20];let x;e[21]!==u||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u,g]}),e[21]=u,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==f||e[25]!==x?(b=o.jsxs("div",{className:"flex flex-col gap-2",children:[f,x]}),e[24]=f,e[25]=x,e[26]=b):b=e[26],b}function ode(t){const e=B.c(25),{override:s,onOverrideChange:n}=t,i=re(),r=v9(),l=r[0]?.id??null;let a;e[0]!==l||e[1]!==r||e[2]!==s?.credentialId?(a=r.some(b=>b.id===s?.credentialId)?s?.credentialId??null:l,e[0]=l,e[1]=r,e[2]=s?.credentialId,e[3]=a):a=e[3];const[c,d]=P.useState(a);let f;e[4]!==c||e[5]!==l||e[6]!==r?(f=r.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=r,e[7]=f):f=e[7];const u=f;let h;e[8]!==r||e[9]!==s?(h=s&&r.some(b=>b.id===s.credentialId)?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[8]=r,e[9]=s,e[10]=h):h=e[10];const m=h;if(r.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let y;return e[13]!==b?(y=o.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=y):y=e[14],y}let p;e[15]!==i?(p=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=p):p=e[16];let g;e[17]!==u||e[18]!==n?(g=b=>{const y=b.keyId??u??"";d(y),n({modelId:b.modelId,credentialId:y,title:b.title??b.modelId})},e[17]=u,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==u||e[21]!==m||e[22]!==p||e[23]!==g?(x=o.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:o.jsx(dP,{variant:"bordered",placeholder:p,model:m,credentialId:u,onCredentialChange:d,onModelChange:g})}),e[20]=u,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const Yj=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:Eg,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:Mn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:fr},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:Si},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:i0}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Xo,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:u9},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:Pg},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:Q2},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Iu},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Xo},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:zA}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Hc,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Hc},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Uc},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Uc}]}],lde=Yj.flatMap(t=>t.tools.map(e=>e.name));function ade(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function cde(t){const e=B.c(12),{agentId:s,value:n,onChange:i}=t,r=re();let l;e[0]!==r?(l=r("automations.automationConfig.toolsLabel"),e[0]=r,e[1]=l):l=e[1];let a;e[2]!==l?(a=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s||e[5]!==i||e[6]!==r||e[7]!==n?(c=s?o.jsx(P.Suspense,{fallback:o.jsxs(ue,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[o.jsx(Eg,{size:14}),r("automations.automationConfig.loadingTools")]}),children:o.jsx(dde,{agentId:s,value:n,onChange:i})}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:r("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=i,e[6]=r,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==a||e[10]!==c?(d=o.jsxs("div",{className:"flex flex-col gap-2",children:[a,c]}),e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function Gv(t){const e=B.c(17),{value:s,checked:n,onToggle:i,title:r,description:l,leading:a}=t;let c;e[0]!==n?(c=o.jsx(fd,{checked:n,className:"pointer-events-none mt-0.5"}),e[0]=n,e[1]=c):c=e[1];let d;e[2]!==a?(d=a&&o.jsx("span",{className:"mt-px shrink-0",children:a}),e[2]=a,e[3]=d):d=e[3];let f;e[4]!==r?(f=o.jsx("span",{className:"truncate text-sm leading-tight",children:r}),e[4]=r,e[5]=f):f=e[5];let u;e[6]!==l?(u=l&&o.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:l}),e[6]=l,e[7]=u):u=e[7];let h;e[8]!==f||e[9]!==u?(h=o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[f,u]}),e[8]=f,e[9]=u,e[10]=h):h=e[10];let m;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==h||e[15]!==s?(m=o.jsxs(Wt,{value:s,onSelect:i,className:"items-start gap-2.5 py-2",children:[c,d,h]}),e[11]=i,e[12]=c,e[13]=d,e[14]=h,e[15]=s,e[16]=m):m=e[16],m}function Yv(t){const e=B.c(27),{conn:s,label:n,icon:i,on:r,total:l,onToggle:a}=t,c=re(),d=r===l;let f;e[0]!==i||e[1]!==s?(f=s?o.jsx(Ei,{icon:s.icon,name:s.title,size:"2xs"}):i?o.jsx(i,{size:14,className:"text-muted-foreground"}):o.jsx(XA,{size:14,className:"text-muted-foreground"}),e[0]=i,e[1]=s,e[2]=f):f=e[2];let u;e[3]!==s?.title||e[4]!==n||e[5]!==c?(u=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=u):u=e[6];let h;e[7]!==u?(h=o.jsx("span",{className:"truncate",children:u}),e[7]=u,e[8]=h):h=e[8];let m;e[9]!==r||e[10]!==l?(m=o.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[r,"/",l]}),e[9]=r,e[10]=l,e[11]=m):m=e[11];let p;e[12]!==a?(p=L=>{L.stopPropagation(),a()},e[12]=a,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==g?(x=o.jsx("button",{type:"button",onClick:p,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==m||e[21]!==x?(b=o.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=b):b=e[22];let y;return e[23]!==f||e[24]!==h||e[25]!==b?(y=o.jsxs("div",{className:"flex items-center gap-2",children:[f,h,b]}),e[23]=f,e[24]=h,e[25]=b,e[26]=y):y=e[26],y}function dde(t){const e=B.c(83),{agentId:s,value:n,onChange:i}=t,r=re(),{org:l}=Fe(),[a,c]=P.useState(!1);let d;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(d={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=d):d=e[3];const f=Jt(d);let u;e[4]!==f?(u={client:f},e[4]=f,e[5]=u):u=e[5];const{data:h,isLoading:m}=_g(u),p=di();let g,x,b,y,L,v,_,w,S,k,j,C,T;if(e[6]!==p||e[7]!==h?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==r||e[12]!==n){const R=new Map(p.map(pde)),I=new Map;for(const fe of h?.tools??[]){const de=rr(fe._meta)??"__other__",pe=id(fe.name,de==="__other__"?void 0:de),te=fe.title,ge=te&&te!==fe.name?te:ade(pe);I.has(de)||I.set(de,{clientId:de,conn:R.get(de),tools:[]}),I.get(de).tools.push({name:fe.name,display:ge,description:fe.description})}const D=[...I.values()].sort(mde),O=(h?.tools??[]).map(hde),z=[...lde,...O],M=n===null?new Set(z):new Set(n),$=z.every(fe=>M.has(fe)),F=fe=>i(z.every(de=>fe.has(de))?null:[...fe]),U=fe=>{const de=new Set(M);de.has(fe)?de.delete(fe):de.add(fe),F(de)},H=(fe,de)=>{const pe=new Set(M);for(const te of fe)de?pe.add(te):pe.delete(te);F(pe)};y=rs,T=a,L=c;let q;e[26]===Symbol.for("react.memo_cache_sentinel")?(q=o.jsx(Eg,{size:14,className:"text-muted-foreground"}),e[26]=q):q=e[26];let W;e[27]!==$||e[28]!==r?(W=r($?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=$,e[28]=r,e[29]=W):W=e[29];const G=!$&&o.jsxs(VE,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",z.length]});let Y;e[30]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(Qt,{size:14,className:"text-muted-foreground"}),e[30]=Y):Y=e[30],e[31]!==W||e[32]!==G?(v=o.jsx(ns,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[q,W,G,Y]})}),e[31]=W,e[32]=G,e[33]=v):v=e[33],b=is,j="p-0 w-80",C="start",x=Yn;let J;e[34]!==r?(J=r("automations.automationConfig.searchToolsPlaceholder"),e[34]=r,e[35]=J):J=e[35],e[36]!==J?(S=o.jsx(On,{placeholder:J}),e[36]=J,e[37]=S):S=e[37];const se=$?r("automations.automationConfig.allToolsEnabled",{count:z.length}):r("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:z.length});let oe;e[38]!==se?(oe=o.jsx("span",{className:"text-xs text-muted-foreground",children:se}),e[38]=se,e[39]=oe):oe=e[39];let ne;e[40]!==i?(ne=()=>i(null),e[40]=i,e[41]=ne):ne=e[41];let Q;e[42]!==r?(Q=r("automations.automationConfig.selectAll"),e[42]=r,e[43]=Q):Q=e[43];let K;e[44]!==$||e[45]!==ne||e[46]!==Q?(K=o.jsx("button",{type:"button",onClick:ne,disabled:$,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:Q}),e[44]=$,e[45]=ne,e[46]=Q,e[47]=K):K=e[47];let X;e[48]===Symbol.for("react.memo_cache_sentinel")?(X=o.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=X):X=e[48];let Z;e[49]!==i?(Z=()=>i([]),e[49]=i,e[50]=Z):Z=e[50];const le=M.size===0;let ee;e[51]!==r?(ee=r("automations.automationConfig.clear"),e[51]=r,e[52]=ee):ee=e[52];let ae;e[53]!==Z||e[54]!==le||e[55]!==ee?(ae=o.jsx("button",{type:"button",onClick:Z,disabled:le,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:ee}),e[53]=Z,e[54]=le,e[55]=ee,e[56]=ae):ae=e[56];let ce;e[57]!==K||e[58]!==ae?(ce=o.jsxs("div",{className:"flex items-center gap-2",children:[K,X,ae]}),e[57]=K,e[58]=ae,e[59]=ce):ce=e[59],e[60]!==oe||e[61]!==ce?(k=o.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[oe,ce]}),e[60]=oe,e[61]=ce,e[62]=k):k=e[62],g=$n,_="max-h-80",w=m?o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("automations.automationConfig.loadingTools")}):o.jsxs(o.Fragment,{children:[o.jsx(Cn,{children:r("automations.automationConfig.noToolsFound")}),Yj.map(fe=>{const de=fe.tools.map(fde),pe=de.filter(te=>M.has(te)).length;return o.jsx(fs,{heading:o.jsx(Yv,{label:r(fe.headingKey),icon:fe.icon,on:pe,total:de.length,onToggle:()=>H(de,pe!==de.length)}),children:fe.tools.map(te=>o.jsx(Gv,{value:`${r(te.titleKey)} ${te.name}`,checked:M.has(te.name),onToggle:()=>U(te.name),title:r(te.titleKey),description:r(te.descriptionKey),leading:o.jsx(te.icon,{size:16,className:"text-muted-foreground"})},te.name))},fe.key)}),D.map(fe=>{const de=fe.tools.map(ude),pe=de.filter(te=>M.has(te)).length;return o.jsx(fs,{heading:o.jsx(Yv,{conn:fe.conn,on:pe,total:de.length,onToggle:()=>H(de,pe!==de.length)}),children:fe.tools.map(te=>o.jsx(Gv,{value:`${te.display} ${te.name} ${fe.conn?.title??""}`,checked:M.has(te.name),onToggle:()=>U(te.name),title:te.display,description:te.description},te.name))},fe.clientId)})]}),e[6]=p,e[7]=h?.tools,e[8]=m,e[9]=i,e[10]=a,e[11]=r,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=y,e[17]=L,e[18]=v,e[19]=_,e[20]=w,e[21]=S,e[22]=k,e[23]=j,e[24]=C,e[25]=T}else g=e[13],x=e[14],b=e[15],y=e[16],L=e[17],v=e[18],_=e[19],w=e[20],S=e[21],k=e[22],j=e[23],C=e[24],T=e[25];let N;e[63]!==g||e[64]!==_||e[65]!==w?(N=o.jsx(g,{className:_,children:w}),e[63]=g,e[64]=_,e[65]=w,e[66]=N):N=e[66];let V;e[67]!==x||e[68]!==N||e[69]!==S||e[70]!==k?(V=o.jsxs(x,{children:[S,k,N]}),e[67]=x,e[68]=N,e[69]=S,e[70]=k,e[71]=V):V=e[71];let A;e[72]!==b||e[73]!==V||e[74]!==j||e[75]!==C?(A=o.jsx(b,{className:j,align:C,children:V}),e[72]=b,e[73]=V,e[74]=j,e[75]=C,e[76]=A):A=e[76];let E;return e[77]!==y||e[78]!==L||e[79]!==v||e[80]!==A||e[81]!==T?(E=o.jsxs(y,{open:T,onOpenChange:L,children:[v,A]}),e[77]=y,e[78]=L,e[79]=v,e[80]=A,e[81]=T,e[82]=E):E=e[82],E}function ude(t){return t.name}function fde(t){return t.name}function hde(t){return t.name}function mde(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function pde(t){return[t.id,t]}function wu(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function gde(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return`Every ${n[1]} hours`;const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(i){const a=parseInt(i[1]??"1");return a%7===0?`Every ${a/7} weeks`:`Every ${a} days`}const r=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(r){const a=(r[2]??"0").padStart(2,"0"),c=(r[1]??"0").padStart(2,"0");return`Every day at ${a}:${c} UTC`}const l=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(l){const c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(l[3]??"0")]??"day",d=(l[2]??"0").padStart(2,"0"),f=(l[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${f} UTC`}return t}function xde(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function bde(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return{count:parseInt(n[1]),unit:"hours"};const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);return i?{count:parseInt(i[1]),unit:"days"}:null}function vde(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const yde=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function _de({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:r}){const l=re(),{triggerAdd:a}=f0(),[c,d]=P.useState(!1),f=e??c,u=p=>{s?s(p):d(p)},h=async p=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),xe.success(l("automations.addStarterPopover.starterAdded")),u(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");xe.error(x)}},m=async()=>{try{const p=await a.mutateAsync({automation_id:t,type:"webhook"});u(!1),p.webhook?r?.(p.webhook):xe.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:l("automations.addStarterPopover.failedAddWebhookStarter");xe.error(g)}};return o.jsxs($t,{open:f,onOpenChange:u,children:[o.jsx(Bt,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",children:[o.jsx(Kt,{size:14}),l("automations.addStarterPopover.addStarter")]})}),o.jsxs(zt,{align:"end",className:"w-[200px]",children:[o.jsxs(er,{children:[o.jsxs(tr,{className:"gap-2.5",children:[o.jsx(uu,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),o.jsx(sr,{className:"w-[160px]",children:yde.map(p=>o.jsxs(Xe,{className:"gap-2.5",onSelect:()=>h(p.cron),disabled:a.isPending,children:[o.jsx(uu,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),o.jsxs(Xe,{className:"gap-2.5",onSelect:()=>{u(!1),n?.()},children:[o.jsx(uu,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),o.jsxs(Xe,{className:"gap-2.5",onSelect:()=>{u(!1),i?.()},children:[o.jsx(mr,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),o.jsxs(Xe,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[o.jsx(Mn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function Jj(t){const e=B.c(39),{open:s,onOpenChange:n,url:i,token:r,title:l,description:a}=t,c=l===void 0?"Webhook ready":l,d=a===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":a,f=re(),[u,h]=P.useState(null),[m,p]=P.useState("curl"),[g,x]=P.useState("header"),b=P.useId();let y;e[0]!==f?(y=async(D,O)=>{try{await navigator.clipboard.writeText(D),h(O),xe.success(f("automations.webhookSecretDialog.copied")),setTimeout(()=>h(null),1500)}catch{xe.error(f("automations.webhookSecretDialog.failedCopy"))}},e[0]=f,e[1]=y):y=e[1];const L=y;let v;e[2]!==g||e[3]!==r||e[4]!==i?(v=i&&r&&g==="url"?`${i.replace(/\/$/,"")}/${r}`:i??"",e[2]=g,e[3]=r,e[4]=i,e[5]=v):v=e[5];const _=v,w=i&&r?g==="header"?`curl -X POST "${_}" \\
626
626
  -H "Authorization: Bearer ${r}" \\
627
627
  -H "Content-Type: application/json" \\
628
628
  -d '{"hello":"world"}'`:`curl -X POST "${_}" \\
@@ -641,7 +641,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
641
641
  },
642
642
  body: JSON.stringify({ hello: "world" }),
643
643
  });`:"",k=m==="curl"?w:S;let j;e[6]!==c?(j=o.jsx(Yt,{children:c}),e[6]=c,e[7]=j):j=e[7];let C;e[8]!==d?(C=o.jsx(kn,{children:d}),e[8]=d,e[9]=C):C=e[9];let T;e[10]!==j||e[11]!==C?(T=o.jsxs(hs,{children:[j,C]}),e[10]=j,e[11]=C,e[12]=T):T=e[12];let N;e[13]!==g||e[14]!==u||e[15]!==L||e[16]!==_||e[17]!==m||e[18]!==k||e[19]!==f||e[20]!==r||e[21]!==b||e[22]!==i?(N=i&&r?o.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:f("automations.webhookSecretDialog.url")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:_}),o.jsxs(ue,{size:"sm",variant:"outline",onClick:()=>L(_,"url"),children:[o.jsx(an,{size:13}),f(u==="url"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]})]}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:f("automations.webhookSecretDialog.tokenLabel")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:r}),o.jsxs(ue,{size:"sm",variant:"outline",onClick:()=>L(r,"token"),children:[o.jsx(an,{size:13}),f(u==="token"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:f("automations.webhookSecretDialog.snippet")}),o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(ad,{value:m,onValueChange:D=>p(D),children:o.jsxs(r0,{className:"h-8 p-[2px]",children:[o.jsx(ar,{value:"curl",className:"h-7 px-2.5 text-xs",children:"curl"}),o.jsx(ar,{value:"fetch",className:"h-7 px-2.5 text-xs",children:"fetch"})]})}),o.jsxs("label",{htmlFor:b,className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer select-none",children:[o.jsx(fd,{id:b,checked:g==="url",onCheckedChange:D=>x(D?"url":"header")}),f("automations.webhookSecretDialog.tokenInUrl")]})]}),o.jsxs(ue,{size:"sm",variant:"outline",onClick:()=>L(k,"example"),children:[o.jsx(an,{size:13}),f(u==="example"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]}),o.jsx("div",{className:"rounded-md border overflow-hidden min-w-0",children:o.jsx(md,{code:k,language:m==="curl"?"shell":"typescript",readOnly:!0,disableDiagnostics:!0,height:180})})]})]}):null,e[13]=g,e[14]=u,e[15]=L,e[16]=_,e[17]=m,e[18]=k,e[19]=f,e[20]=r,e[21]=b,e[22]=i,e[23]=N):N=e[23];let V;e[24]!==n?(V=()=>n(!1),e[24]=n,e[25]=V):V=e[25];let A;e[26]!==f?(A=f("automations.webhookSecretDialog.done"),e[26]=f,e[27]=A):A=e[27];let E;e[28]!==A||e[29]!==V?(E=o.jsx(Wn,{children:o.jsx(ue,{onClick:V,children:A})}),e[28]=A,e[29]=V,e[30]=E):E=e[30];let R;e[31]!==E||e[32]!==T||e[33]!==N?(R=o.jsxs(Ut,{className:"max-w-lg",children:[T,N,E]}),e[31]=E,e[32]=T,e[33]=N,e[34]=R):R=e[34];let I;return e[35]!==n||e[36]!==s||e[37]!==R?(I=o.jsx(Ht,{open:s,onOpenChange:n,children:R}),e[35]=n,e[36]=s,e[37]=R,e[38]=I):I=e[38],I}function Lde(t){const e=B.c(137),{trigger:s,automationId:n,connectionName:i}=t,r=re(),{triggerAdd:l,triggerRemove:a,triggerRotateToken:c}=f0(),[d,f]=P.useState(!1),[u,h]=P.useState(!1),[m,p]=P.useState(null);let g;e[0]!==s.cron_expression?(g=s.cron_expression?bde(s.cron_expression):null,e[0]=s.cron_expression,e[1]=g):g=e[1];const x=g,[b,y]=P.useState(x?.count??1),[L,v]=P.useState(!1),[_,w]=P.useState(s.cron_expression??""),S=a.isPending||l.isPending||c.isPending,k=s.type==="cron",j=s.type==="webhook";let C;e[2]!==n||e[3]!==a||e[4]!==r||e[5]!==s.id?(C=async()=>{try{await a.mutateAsync({trigger_id:s.id,automation_id:n}),xe.success(r("automations.triggerCard.starterRemoved"))}catch{xe.error(r("automations.triggerCard.failedToRemoveStarter"))}f(!1)},e[2]=n,e[3]=a,e[4]=r,e[5]=s.id,e[6]=C):C=e[6];const T=C;let N;e[7]!==l||e[8]!==n||e[9]!==a||e[10]!==s.id?(N=async Me=>{await l.mutateAsync({automation_id:n,type:"cron",cron_expression:Me}),await a.mutateAsync({trigger_id:s.id,automation_id:n})},e[7]=l,e[8]=n,e[9]=a,e[10]=s.id,e[11]=N):N=e[11];const V=N;let A;e[12]!==_||e[13]!==V||e[14]!==r||e[15]!==s.cron_expression?(A=async()=>{const Me=_.trim();if(!Me||!wu(Me)||Me===s.cron_expression){v(!1),w(s.cron_expression??"");return}try{await V(Me),v(!1)}catch{xe.error(r("automations.triggerCard.failedToUpdateStarter")),w(s.cron_expression??""),v(!1)}},e[12]=_,e[13]=V,e[14]=r,e[15]=s.cron_expression,e[16]=A):A=e[16];const E=A;let R;e[17]!==n||e[18]!==c||e[19]!==s.id?(R=async()=>{h(!1);try{const Me=await c.mutateAsync({trigger_id:s.id,automation_id:n});p({url:Me.url,token:Me.token})}catch(Me){const rt=Me,nt=rt instanceof Error?rt.message:"Failed to rotate token";xe.error(nt)}},e[17]=n,e[18]=c,e[19]=s.id,e[20]=R):R=e[20];const I=R;let D;e[21]!==x||e[22]!==V||e[23]!==r||e[24]!==s.cron_expression?(D=async Me=>{if(!x)return;const rt=x.unit==="minutes"?5:1,nt=Math.max(rt,Me);nt!==Me&&y(nt);const it=xde(nt,x.unit);if(it!==s.cron_expression)try{await V(it)}catch{xe.error(r("automations.triggerCard.failedToUpdateStarter")),y(x.count)}},e[21]=x,e[22]=V,e[23]=r,e[24]=s.cron_expression,e[25]=D):D=e[25];const O=D;let z;e[26]!==k||e[27]!==j?(z=k?o.jsx(uu,{size:14,className:"text-muted-foreground shrink-0"}):j?o.jsx(Mn,{size:14,className:"text-muted-foreground shrink-0"}):o.jsx(mr,{size:14,className:"text-muted-foreground shrink-0"}),e[26]=k,e[27]=j,e[28]=z):z=e[28];let M;e[29]!==i||e[30]!==b||e[31]!==_||e[32]!==O||e[33]!==E||e[34]!==x||e[35]!==k||e[36]!==L||e[37]!==S||e[38]!==j||e[39]!==r||e[40]!==s.cron_expression||e[41]!==s.event_type||e[42]!==s.params?(M=x&&k?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:r("automations.triggerCard.every")}),o.jsx("input",{type:"number",min:x.unit==="minutes"?5:1,value:b,onChange:Me=>y(parseInt(Me.target.value)||1),onBlur:()=>O(b),onKeyDown:Me=>{Me.key==="Enter"&&Me.target.blur(),Me.key==="Escape"&&y(x.count)},disabled:S,className:"w-12 text-center text-sm h-7 border border-border rounded-md bg-background px-1 focus:outline-none focus:ring-1 focus:ring-ring"}),o.jsx("span",{className:"text-sm",children:vde(x.unit,b)})]}):k&&L?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"text",value:_,onChange:Me=>w(Me.target.value),onBlur:E,onKeyDown:Me=>{Me.key==="Enter"&&Me.target.blur(),Me.key==="Escape"&&(v(!1),w(s.cron_expression??""))},className:"flex-1 text-sm font-mono bg-transparent outline-none",autoFocus:!0}),_&&!wu(_)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:r("automations.triggerCard.invalid")})]}):o.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-mono text-xs text-muted-foreground truncate",children:k?gde(s.cron_expression??""):j?r("automations.triggerCard.webhookPostToFire"):`${s.event_type}${i?` · ${i}`:""}`}),!k&&!j&&s.params&&Object.keys(s.params).length>0&&o.jsx("span",{className:"text-xs text-muted-foreground/60 truncate",children:Object.entries(s.params).map(wde).join(", ")})]}),e[29]=i,e[30]=b,e[31]=_,e[32]=O,e[33]=E,e[34]=x,e[35]=k,e[36]=L,e[37]=S,e[38]=j,e[39]=r,e[40]=s.cron_expression,e[41]=s.event_type,e[42]=s.params,e[43]=M):M=e[43];let $;e[44]!==S?($=S&&o.jsx(ot,{size:13,className:"animate-spin text-muted-foreground"}),e[44]=S,e[45]=$):$=e[45];let F;e[46]!==x||e[47]!==k||e[48]!==L||e[49]!==s.cron_expression?(F=k&&!x&&!L&&o.jsx(ue,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{w(s.cron_expression??""),v(!0)},children:o.jsx(Pg,{size:13,className:"text-muted-foreground"})}),e[46]=x,e[47]=k,e[48]=L,e[49]=s.cron_expression,e[50]=F):F=e[50];let U;e[51]!==j||e[52]!==r?(U=j&&o.jsx(ue,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",title:r("automations.triggerCard.rotateToken"),onClick:()=>h(!0),children:o.jsx(Dn,{size:13,className:"text-muted-foreground"})}),e[51]=j,e[52]=r,e[53]=U):U=e[53];let H;e[54]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(ue,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>f(!0),children:o.jsx(Ci,{size:13,className:"text-muted-foreground"})}),e[54]=H):H=e[54];let q;e[55]!==F||e[56]!==U||e[57]!==$?(q=o.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[$,F,U,H]}),e[55]=F,e[56]=U,e[57]=$,e[58]=q):q=e[58];let W;e[59]!==q||e[60]!==z||e[61]!==M?(W=o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[z,M,q]}),e[59]=q,e[60]=z,e[61]=M,e[62]=W):W=e[62];let G;e[63]!==r?(G=r("automations.triggerCard.removeStarter"),e[63]=r,e[64]=G):G=e[64];let Y;e[65]!==G?(Y=o.jsx(nl,{children:G}),e[65]=G,e[66]=Y):Y=e[66];let J;e[67]!==r?(J=r("automations.triggerCard.confirmRemoveStarter"),e[67]=r,e[68]=J):J=e[68];let se;e[69]!==J?(se=o.jsx(il,{children:J}),e[69]=J,e[70]=se):se=e[70];let oe;e[71]!==Y||e[72]!==se?(oe=o.jsxs(sl,{children:[Y,se]}),e[71]=Y,e[72]=se,e[73]=oe):oe=e[73];let ne;e[74]!==r?(ne=r("automations.triggerCard.cancel"),e[74]=r,e[75]=ne):ne=e[75];let Q;e[76]!==ne?(Q=o.jsx(ol,{children:ne}),e[76]=ne,e[77]=Q):Q=e[77];let K;e[78]!==r?(K=r("automations.triggerCard.remove"),e[78]=r,e[79]=K):K=e[79];let X;e[80]!==T||e[81]!==K?(X=o.jsx(ll,{onClick:T,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:K}),e[80]=T,e[81]=K,e[82]=X):X=e[82];let Z;e[83]!==Q||e[84]!==X?(Z=o.jsxs(rl,{children:[Q,X]}),e[83]=Q,e[84]=X,e[85]=Z):Z=e[85];let le;e[86]!==oe||e[87]!==Z?(le=o.jsxs(tl,{children:[oe,Z]}),e[86]=oe,e[87]=Z,e[88]=le):le=e[88];let ee;e[89]!==d||e[90]!==le?(ee=o.jsx(el,{open:d,onOpenChange:f,children:le}),e[89]=d,e[90]=le,e[91]=ee):ee=e[91];let ae;e[92]!==r?(ae=r("automations.triggerCard.rotateWebhookToken"),e[92]=r,e[93]=ae):ae=e[93];let ce;e[94]!==ae?(ce=o.jsx(nl,{children:ae}),e[94]=ae,e[95]=ce):ce=e[95];let fe;e[96]!==r?(fe=r("automations.triggerCard.rotateWebhookTokenDescription"),e[96]=r,e[97]=fe):fe=e[97];let de;e[98]!==fe?(de=o.jsx(il,{children:fe}),e[98]=fe,e[99]=de):de=e[99];let pe;e[100]!==ce||e[101]!==de?(pe=o.jsxs(sl,{children:[ce,de]}),e[100]=ce,e[101]=de,e[102]=pe):pe=e[102];let te;e[103]!==r?(te=r("automations.triggerCard.cancel"),e[103]=r,e[104]=te):te=e[104];let ge;e[105]!==te?(ge=o.jsx(ol,{children:te}),e[105]=te,e[106]=ge):ge=e[106];let ve;e[107]!==r?(ve=r("automations.triggerCard.rotate"),e[107]=r,e[108]=ve):ve=e[108];let Se;e[109]!==I||e[110]!==ve?(Se=o.jsx(ll,{onClick:I,children:ve}),e[109]=I,e[110]=ve,e[111]=Se):Se=e[111];let ye;e[112]!==ge||e[113]!==Se?(ye=o.jsxs(rl,{children:[ge,Se]}),e[112]=ge,e[113]=Se,e[114]=ye):ye=e[114];let ke;e[115]!==pe||e[116]!==ye?(ke=o.jsxs(tl,{children:[pe,ye]}),e[115]=pe,e[116]=ye,e[117]=ke):ke=e[117];let we;e[118]!==u||e[119]!==ke?(we=o.jsx(el,{open:u,onOpenChange:h,children:ke}),e[118]=u,e[119]=ke,e[120]=we):we=e[120];const je=m!==null;let me;e[121]===Symbol.for("react.memo_cache_sentinel")?(me=Me=>{Me||p(null)},e[121]=me):me=e[121];const Ce=m?.url??null,Ne=m?.token??null;let Ie;e[122]!==r?(Ie=r("automations.triggerCard.newWebhookToken"),e[122]=r,e[123]=Ie):Ie=e[123];let et;e[124]!==r?(et=r("automations.triggerCard.newWebhookTokenDescription"),e[124]=r,e[125]=et):et=e[125];let Ze;e[126]!==je||e[127]!==Ce||e[128]!==Ne||e[129]!==Ie||e[130]!==et?(Ze=o.jsx(Jj,{open:je,onOpenChange:me,url:Ce,token:Ne,title:Ie,description:et}),e[126]=je,e[127]=Ce,e[128]=Ne,e[129]=Ie,e[130]=et,e[131]=Ze):Ze=e[131];let Te;return e[132]!==W||e[133]!==ee||e[134]!==we||e[135]!==Ze?(Te=o.jsxs(o.Fragment,{children:[W,ee,we,Ze]}),e[132]=W,e[133]=ee,e[134]=we,e[135]=Ze,e[136]=Te):Te=e[136],Te}function wde(t){const[e,s]=t;return`${e}: ${s}`}function Sde(t){const e=B.c(70),{automationId:s,onDone:n}=t,i=re();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={binding:"TRIGGER"},e[0]=r):r=e[0];const l=di(r),[a,c]=P.useState(),[d,f]=P.useState();let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u={},e[1]=u):u=e[1];const[h,m]=P.useState(u),{triggerAdd:p}=f0(),{data:g,isLoading:x}=AE(a);let b,y,L,v,_,w;if(e[2]!==p||e[3]!==s||e[4]!==a||e[5]!==d||e[6]!==x||e[7]!==n||e[8]!==h||e[9]!==i||e[10]!==l||e[11]!==g){const j=g?.find($=>$.type===d);let C;e[18]!==p||e[19]!==s||e[20]!==a||e[21]!==d||e[22]!==n||e[23]!==h||e[24]!==i?(C=async()=>{if(!(!a||!d))try{await p.mutateAsync({automation_id:s,type:"event",event_type:d,connection_id:a,params:h}),Ye("automation_trigger_added",{automation_id:s,trigger_type:"event",connection_id:a,event_type:d}),xe.success(i("automations.eventTriggerForm.successAdded")),n()}catch{xe.error(i("automations.eventTriggerForm.errorFailed"))}},e[18]=p,e[19]=s,e[20]=a,e[21]=d,e[22]=n,e[23]=h,e[24]=i,e[25]=C):C=e[25],b=C,y="flex flex-col gap-3 px-3 py-3 rounded-lg border border-border bg-background";let T;e[26]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(mr,{size:14,className:"text-muted-foreground shrink-0"}),e[26]=T):T=e[26];let N;e[27]!==i?(N=i("automations.eventTriggerForm.title"),e[27]=i,e[28]=N):N=e[28];let V;e[29]!==N?(V=o.jsx("span",{className:"text-sm font-medium",children:N}),e[29]=N,e[30]=V):V=e[30];let A;e[31]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(Ci,{size:13}),e[31]=A):A=e[31];let E;e[32]!==n?(E=o.jsx("button",{type:"button",className:"ml-auto shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground",onClick:n,children:A}),e[32]=n,e[33]=E):E=e[33],e[34]!==V||e[35]!==E?(L=o.jsxs("div",{className:"flex items-center gap-2",children:[T,V,E]}),e[34]=V,e[35]=E,e[36]=L):L=e[36];const R=a??"";let I;e[37]===Symbol.for("react.memo_cache_sentinel")?(I=$=>{c($),f(void 0),m({})},e[37]=I):I=e[37];let D;e[38]!==i?(D=i("automations.eventTriggerForm.selectConnectionPlaceholder"),e[38]=i,e[39]=D):D=e[39];let O;e[40]!==D?(O=o.jsx(_s,{className:"w-full",children:o.jsx(Ns,{placeholder:D})}),e[40]=D,e[41]=O):O=e[41];let z;e[42]!==i||e[43]!==l?(z=l.length===0?o.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:i("automations.eventTriggerForm.noConnectionsWithTrigger")}):l.map(Cde),e[42]=i,e[43]=l,e[44]=z):z=e[44];let M;e[45]!==z?(M=o.jsx(Ls,{children:z}),e[45]=z,e[46]=M):M=e[46],e[47]!==R||e[48]!==O||e[49]!==M?(v=o.jsxs(ys,{value:R,onValueChange:I,children:[O,M]}),e[47]=R,e[48]=O,e[49]=M,e[50]=v):v=e[50],e[51]!==a||e[52]!==d||e[53]!==x||e[54]!==i||e[55]!==g?(_=a&&o.jsxs(ys,{value:d??"",onValueChange:$=>{f($),m({})},children:[o.jsx(_s,{className:"w-full",children:x?o.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(ot,{size:13,className:"animate-spin"}),i("automations.eventTriggerForm.loadingEvents")]}):o.jsx(Ns,{placeholder:i("automations.eventTriggerForm.selectEventTypePlaceholder"),children:d??i("automations.eventTriggerForm.selectEventTypePlaceholder")})}),o.jsx(Ls,{children:g?.map(jde)})]}),e[51]=a,e[52]=d,e[53]=x,e[54]=i,e[55]=g,e[56]=_):_=e[56],w=j?.paramsSchema&&Object.keys(j.paramsSchema).length>0&&o.jsx("div",{className:"flex flex-col gap-2",children:Object.entries(j.paramsSchema).map($=>{const[F,U]=$;return o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("label",{className:"text-xs text-muted-foreground",children:[F,U.description&&o.jsxs("span",{className:"text-muted-foreground/60",children:[" ","— ",U.description]})]}),U.enum?o.jsxs(ys,{value:h[F]??"",onValueChange:H=>m(q=>({...q,[F]:H})),children:[o.jsx(_s,{className:"w-full",children:o.jsx(Ns,{placeholder:i("automations.eventTriggerForm.selectParamPlaceholder",{key:F})})}),o.jsx(Ls,{children:U.enum.map(kde)})]}):o.jsx("input",{type:"text",value:h[F]??"",onChange:H=>m(q=>({...q,[F]:H.target.value})),placeholder:U.description??F,className:"text-sm border border-border rounded-md bg-background px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-ring"})]},F)})}),e[2]=p,e[3]=s,e[4]=a,e[5]=d,e[6]=x,e[7]=n,e[8]=h,e[9]=i,e[10]=l,e[11]=g,e[12]=b,e[13]=y,e[14]=L,e[15]=v,e[16]=_,e[17]=w}else b=e[12],y=e[13],L=e[14],v=e[15],_=e[16],w=e[17];let S;e[57]!==p||e[58]!==a||e[59]!==d||e[60]!==b||e[61]!==i?(S=a&&d&&o.jsx(ue,{size:"sm",onClick:b,disabled:p.isPending,children:p.isPending?o.jsx(ot,{size:13,className:"animate-spin"}):i("automations.eventTriggerForm.addTriggerButton")}),e[57]=p,e[58]=a,e[59]=d,e[60]=b,e[61]=i,e[62]=S):S=e[62];let k;return e[63]!==y||e[64]!==L||e[65]!==v||e[66]!==_||e[67]!==w||e[68]!==S?(k=o.jsxs("div",{className:y,children:[L,v,_,w,S]}),e[63]=y,e[64]=L,e[65]=v,e[66]=_,e[67]=w,e[68]=S,e[69]=k):k=e[69],k}function kde(t){return o.jsx(Rt,{value:t,children:t},t)}function jde(t){return o.jsx(Rt,{value:t.type,children:o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{children:t.type}),o.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]})},t.type)}function Cde(t){return o.jsx(Rt,{value:t.id,children:t.title},t.id)}const Nde=30;function Tde(t,e){switch(e.type){case"accumulate":{const s=t??{start:e.now,fields:new Set,saveCount:0},n=new Set(s.fields);for(const i of e.fields)n.add(i);return{...s,fields:n,saveCount:s.saveCount+1}}case"reset":return null}}function Vde({automationId:t,automation:e,onBack:s,onDelete:n}){const i=re(),r=e.virtual_mcp_id,{org:l}=Fe(),{update:a,triggerAdd:c,run:d}=f0(),f=di(),u=new Map(f.map(K=>[K.id,K.title])),{openTask:h}=sn(),{openSidePanel:m}=pl(),{sendMessage:p}=ui(),g=e.messages?.[0]?.metadata?.tiptapDoc??void 0,[x,b]=P.useState(g),[y,L]=P.useState(!1),[v,_]=P.useState(!1),[w,S]=P.useState(!1),[k,j]=P.useState(""),[C,T]=P.useState(!1),[N,V]=P.useState(null),[A,E]=P.useState(!1),[R,I]=P.useState(!1),[D,O]=P.useState(!1),z=async()=>{if(A)return;const X=$T(x).filter(Z=>Z.type==="text").map(Z=>Z.text).join(`
644
- `);if(X.trim()){E(!0);try{oe(),Ye("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:X.length}),m(),await p({tiptapDoc:yL({managerAgentId:Z6.AUTOMATION_MANAGER(l.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:X})})}finally{E(!1)}}},M=e.models?.tier??"smart",$=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,F=I2({defaultValues:{name:e.name,active:e.active,tier:M,modelOverride:$,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),U=F.watch("active"),[H,q]=P.useReducer(Tde,null),W=()=>{H!==null&&(Ye("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(H.fields),save_count:H.saveCount,edit_duration_ms:Date.now()-H.start}),q({type:"reset"}))},G=async()=>{const K=F.control._formState.dirtyFields,X=Object.keys(K);if(X.length===0&&!D)return!0;const Z=F.getValues(),le=F.control._defaultValues;F.reset(Z,{keepValues:!0});const ee=D;O(!1);const ae={tier:Z.tier,...Z.modelOverride?{modelId:Z.modelOverride.modelId,credentialId:Z.modelOverride.credentialId,modelTitle:Z.modelOverride.title}:{}},ce={id:t,name:Z.name,active:Z.active,models:ae,tools:Z.tools,maxAgentSteps:Z.maxAgentSteps,messages:OT(x),temperature:0};try{await a.mutateAsync(ce)}catch{return F.reset(le,{keepValues:!0}),ee&&O(!0),!1}const fe=[...X];return ee&&fe.push("messages"),q({type:"accumulate",now:Date.now(),fields:fe}),se(),!0},{schedule:Y,flush:J}=eh({save:G}),{schedule:se,flush:oe}=eh({delayMs:3e4,save:async()=>W()});P.useEffect(()=>{const K=F.watch(()=>Y());return()=>K.unsubscribe()},[]);const ne=K=>{if(b(K),!R){I(!0);return}O(!0),Y()},Q=async()=>{Ye("automation_test_clicked",{automation_id:t,agent_id:r});const K=await J();if(oe(),!!K){if(!x){xe.error(i("automations.automationDetail.noInstructionsConfigured"));return}try{const X=await d.mutateAsync(t);X.threadId&&(m(),h(X.threadId))}catch{}}};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(ue,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(m9,{size:14}),i("automations.automationDetail.backToList")]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(js,{control:F.control,name:"name",render:({field:K})=>o.jsx(mt,{...K,placeholder:i("automations.automationDetail.automationNamePlaceholder"),className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),n&&o.jsx(ue,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:o.jsx(tn,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(js,{control:F.control,name:"active",render:({field:K})=>o.jsx(hr,{checked:K.value,onCheckedChange:X=>{K.onChange(X),J()},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i(U?"automations.automationDetail.active":"automations.automationDetail.inactive")}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(_L,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.starter")}),o.jsx(_de,{automationId:t,open:y,onOpenChange:L,onCustomSelect:()=>{S(!0),T(!1),j("")},onEventSelect:()=>{T(!0),S(!1)},onWebhookCreated:K=>{Ye("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),V(K)}})]}),e.triggers.length===0&&!w?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[i("automations.automationDetail.whenShouldRun")," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>L(!0),children:i("automations.automationDetail.addStarter")})," ",i("automations.automationDetail.toGetGoing")]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(K=>o.jsx(Lde,{trigger:K,automationId:t,connectionName:K.connection_id?u.get(K.connection_id):void 0},K.id))}),w&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(uu,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:k,onChange:K=>j(K.target.value),onBlur:async()=>{const K=k.trim();if(!(!K||!wu(K)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:K}),Ye("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),xe.success(i("automations.automationDetail.starterAdded")),S(!1),j("")}catch{xe.error(i("automations.automationDetail.failedToAddStarter"))}},onKeyDown:async K=>{const X=k.trim();K.key==="Enter"&&X&&wu(X)&&K.target.blur(),K.key==="Escape"&&(S(!1),j(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),k&&!wu(k)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:i("automations.automationDetail.invalid")}),c.isPending&&o.jsx(ot,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{S(!1),j("")},children:o.jsx(Ci,{size:13})})]}),C&&o.jsx(P.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(ot,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i("automations.automationDetail.loadingConnections")})]}),children:o.jsx(Sde,{automationId:t,onDone:()=>T(!1)})}),o.jsx(Jj,{open:N!==null,onOpenChange:K=>{K||V(null)},url:N?.url??null,token:N?.token??null})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.instructions")}),o.jsxs(ue,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:A||!x,onClick:z,children:[o.jsx(Wr,{size:13}),i("automations.automationDetail.improve")]})]}),o.jsx(a_,{tiptapDoc:x,setTiptapDoc:ne,placeholder:i("automations.automationDetail.instructionsPlaceholder"),children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(c_,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(ue,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:Q,disabled:!r,children:[o.jsx(Jh,{size:16}),i("automations.automationDetail.test")]})}),o.jsx(We,{children:i("automations.automationDetail.testAutomation")})]})})]})})]}),o.jsxs(J6,{open:v,onOpenChange:_,className:"flex flex-col gap-2.5",children:[o.jsxs(G6,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.advanced")}),o.jsx(Qt,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),o.jsxs(Y6,{className:"flex flex-col gap-5 pt-0.5",children:[o.jsx(rde,{tier:F.watch("tier"),onTierChange:K=>F.setValue("tier",K,{shouldDirty:!0}),override:F.watch("modelOverride"),onOverrideChange:K=>F.setValue("modelOverride",K,{shouldDirty:!0})}),o.jsx(cde,{agentId:r||null,value:F.watch("tools"),onChange:K=>F.setValue("tools",K,{shouldDirty:!0})}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.maxSteps")}),o.jsx(mt,{type:"number",min:1,max:100,className:"w-40",placeholder:i("automations.automationDetail.maxStepsPlaceholder",{default:Nde}),value:F.watch("maxAgentSteps")??"",onChange:K=>{const X=K.target.value.trim(),Z=X===""?null:Number(X);F.setValue("maxAgentSteps",Z===null||Number.isNaN(Z)?null:Z,{shouldDirty:!0})}})]})]})]})]})]})}const Qj=[{key:"24h",labelKey:"mainPanelTabs.automationTab.last24hours",ms:1440*60*1e3},{key:"7d",labelKey:"mainPanelTabs.automationTab.last7days",ms:10080*60*1e3},{key:"30d",labelKey:"mainPanelTabs.automationTab.last30days",ms:720*60*60*1e3}];function Xj(t){const e=Qj.find(n=>n.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function Ade(t){const e=B.c(16),{automationId:s,triggerIds:n}=t,i=re(),[r,l]=P.useState("30d"),[a,c]=P.useState(Pde);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=x=>{const b=x;l(b),c(Xj(b))},e[0]=d):d=e[0];let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(_s,{className:"w-44",children:o.jsx(Ns,{})}),e[1]=f):f=e[1];let u;e[2]!==i?(u=Qj.map(x=>o.jsx(Rt,{value:x.key,children:i(x.labelKey)},x.key)),e[2]=i,e[3]=u):u=e[3];let h;e[4]!==u?(h=o.jsx(Ls,{children:u}),e[4]=u,e[5]=h):h=e[5];let m;e[6]!==h||e[7]!==r?(m=o.jsx("div",{className:"flex items-center justify-end",children:o.jsxs(ys,{value:r,onValueChange:d,children:[f,h]})}),e[6]=h,e[7]=r,e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==a||e[11]!==n?(p=o.jsx(TV,{automationId:s,triggerIds:n,range:a}),e[9]=s,e[10]=a,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"flex flex-col gap-5",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function Pde(){return Xj("30d")}function Ede(t){const e=B.c(5),{tabId:s}=t;let n;e[0]!==s?(n=b6(s),e[0]=s,e[1]=n):n=e[1];const i=n;if(!i)return null;let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(cr,{}),e[2]=r):r=e[2];let l;return e[3]!==i.id?(l=o.jsx(P.Suspense,{fallback:r,children:o.jsx(Rde,{id:i.id})}),e[3]=i.id,e[4]=l):l=e[4],l}function Rde(t){const e=B.c(41),{id:s}=t,n=re(),{openPanel:i}=hi(),{data:r,isLoading:l}=PE(s),[a,c]=P.useState("settings");let d;e[0]!==i?(d=()=>i("automations"),e[0]=i,e[1]=d):d=e[1];const f=d;if(l){let C;return e[2]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(cr,{}),e[2]=C):C=e[2],C}if(!r){let C;e[3]!==n?(C=n("mainPanelTabs.automationTab.automationNotFound"),e[3]=n,e[4]=C):C=e[4];let T;return e[5]!==C?(T=o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:C}),e[5]=C,e[6]=T):T=e[6],T}let u;e[7]!==r.triggers?(u=r.triggers.map(Dde),e[7]=r.triggers,e[8]=u):u=e[8];const h=u;let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(m9,{size:14}),e[9]=m):m=e[9];let p;e[10]!==n?(p=n("mainPanelTabs.automationTab.backToList"),e[10]=n,e[11]=p):p=e[11];let g;e[12]!==f||e[13]!==p?(g=o.jsxs(ue,{variant:"ghost",size:"sm",onClick:f,children:[m,p]}),e[12]=f,e[13]=p,e[14]=g):g=e[14];let x;e[15]!==n?(x=n("mainPanelTabs.automationTab.settings"),e[15]=n,e[16]=x):x=e[16];let b;e[17]!==x?(b={id:"settings",label:x},e[17]=x,e[18]=b):b=e[18];let y;e[19]!==n?(y=n("mainPanelTabs.automationTab.runs"),e[19]=n,e[20]=y):y=e[20];let L;e[21]!==y?(L={id:"runs",label:y},e[21]=y,e[22]=L):L=e[22];let v;e[23]!==b||e[24]!==L?(v=[b,L],e[23]=b,e[24]=L,e[25]=v):v=e[25];let _;e[26]===Symbol.for("react.memo_cache_sentinel")?(_=C=>c(C),e[26]=_):_=e[26];let w;e[27]!==v||e[28]!==a?(w=o.jsx(G8,{tabs:v,activeTab:a,onTabChange:_}),e[27]=v,e[28]=a,e[29]=w):w=e[29];let S;e[30]!==w||e[31]!==g?(S=o.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[g,w]}),e[30]=w,e[31]=g,e[32]=S):S=e[32];let k;e[33]!==r||e[34]!==s||e[35]!==a||e[36]!==h?(k=a==="settings"?o.jsx(Vde,{automationId:s,automation:r}):o.jsx(Ade,{automationId:s,triggerIds:h}),e[33]=r,e[34]=s,e[35]=a,e[36]=h,e[37]=k):k=e[37];let j;return e[38]!==S||e[39]!==k?(j=o.jsx(wi,{children:o.jsx(wi.Content,{children:o.jsxs(wi.Body,{children:[S,k]})})}),e[38]=S,e[39]=k,e[40]=j):j=e[40],j}function Dde(t){return t.id}function Ide(t){const e=B.c(29),{virtualMcpId:s}=t,n=re(),{openPanel:i}=hi(),{data:r}=EE(s),l=r===void 0?[]:r,{create:a}=f0(),[c,d]=P.useState(""),f=c.toLowerCase(),u=l.filter(R=>R.name.toLowerCase().includes(f));let h;e[0]!==i?(h=R=>i(`automation:${R}`),e[0]=i,e[1]=h):h=e[1];const m=h,p=async()=>{if(a.isPending)return;Ye("automation_new_clicked",{virtual_mcp_id:s,existing_count:l.length});const R=await a.mutateAsync(RE(s));m(R.id)},g=a.isPending;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Kt,{size:14}),e[2]=x):x=e[2];let b;e[3]!==n?(b=n("automations.automationsList.newAutomation"),e[3]=n,e[4]=b):b=e[4];let y;e[5]!==a.isPending||e[6]!==p||e[7]!==b?(y=o.jsxs(ue,{size:"sm",onClick:p,disabled:g,children:[x,b]}),e[5]=a.isPending,e[6]=p,e[7]=b,e[8]=y):y=e[8];const L=y,v=wi,_=wi,w=wi;let S;e[9]!==n?(S=n("automations.automationsList.title"),e[9]=n,e[10]=S):S=e[10];let k;e[11]!==S?(k=o.jsx(wi.Title,{children:S}),e[11]=S,e[12]=k):k=e[12];const j=l.length>0&&o.jsx(L9,{value:c,onChange:d,placeholder:n("automations.automationsList.searchPlaceholder"),className:"w-full md:w-[375px]"});let C;e[13]!==L||e[14]!==j?(C=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[j,L]}),e[13]=L,e[14]=j,e[15]=C):C=e[15];let T;e[16]!==k||e[17]!==C?(T=o.jsxs("div",{className:"flex flex-col gap-6",children:[k,C]}),e[16]=k,e[17]=C,e[18]=T):T=e[18];const N=l.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Qo,{image:o.jsx(mr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.emptyTitle"),description:n("automations.automationsList.emptyDescription"),actions:L})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Qo,{image:o.jsx(mr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.noResultsTitle"),description:n("automations.automationsList.noResultsDescription",{search:c})})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(R=>o.jsx(IE,{automation:R,onClick:()=>m(R.id)},R.id))});let V;e[19]!==T||e[20]!==N||e[21]!==w.Body?(V=o.jsxs(w.Body,{children:[T,N]}),e[19]=T,e[20]=N,e[21]=w.Body,e[22]=V):V=e[22];let A;e[23]!==V||e[24]!==_.Content?(A=o.jsx(_.Content,{children:V}),e[23]=V,e[24]=_.Content,e[25]=A):A=e[25];let E;return e[26]!==v||e[27]!==A?(E=o.jsx(v,{children:A}),e[26]=v,e[27]=A,e[28]=E):E=e[28],E}function Mde(t){const e=B.c(3),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(cr,{}),e[0]=n):n=e[0];let i;return e[1]!==s?(i=o.jsx(P.Suspense,{fallback:n,children:o.jsx(Ide,{virtualMcpId:s})}),e[1]=s,e[2]=i):i=e[2],i}function Ode(t){const e=B.c(60),{file:s,onClose:n}=t,i=re();let r,l;e[0]!==s.filename?(r=o.jsx(Zo,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),l=o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=l):(r=e[1],l=e[2]);let a;e[3]!==s.size?(a=U8(s.size),e[3]=s.size,e[4]=a):a=e[4];let c;e[5]!==a?(c=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:a}),e[5]=a,e[6]=c):c=e[6];let d;e[7]!==r||e[8]!==l||e[9]!==c?(d=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,l,c]}),e[7]=r,e[8]=l,e[9]=c,e[10]=d):d=e[10];let f;e[11]!==i?(f=i("mainPanelTabs.fileTab.download"),e[11]=i,e[12]=f):f=e[12];let u;e[13]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Eu,{size:14}),e[13]=u):u=e[13];let h;e[14]!==s.downloadUrl||e[15]!==s.filename?(h=o.jsx("a",{href:s.downloadUrl,download:s.filename,children:u}),e[14]=s.downloadUrl,e[15]=s.filename,e[16]=h):h=e[16];let m;e[17]!==f||e[18]!==h?(m=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":f,asChild:!0,children:h})}),e[17]=f,e[18]=h,e[19]=m):m=e[19];let p;e[20]!==i?(p=i("mainPanelTabs.fileTab.download"),e[20]=i,e[21]=p):p=e[21];let g;e[22]!==p?(g=o.jsx(We,{side:"bottom",children:p}),e[22]=p,e[23]=g):g=e[23];let x;e[24]!==g||e[25]!==m?(x=o.jsxs(qe,{children:[m,g]}),e[24]=g,e[25]=m,e[26]=x):x=e[26];let b;e[27]!==i?(b=i("mainPanelTabs.fileTab.openInNewTab"),e[27]=i,e[28]=b):b=e[28];let y;e[29]!==s.downloadUrl?(y=()=>window.open(s.downloadUrl,"_blank","noopener"),e[29]=s.downloadUrl,e[30]=y):y=e[30];let L;e[31]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(hn,{size:14}),e[31]=L):L=e[31];let v;e[32]!==b||e[33]!==y?(v=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":b,onClick:y,children:L})}),e[32]=b,e[33]=y,e[34]=v):v=e[34];let _;e[35]!==i?(_=i("mainPanelTabs.fileTab.openInNewTab"),e[35]=i,e[36]=_):_=e[36];let w;e[37]!==_?(w=o.jsx(We,{side:"bottom",children:_}),e[37]=_,e[38]=w):w=e[38];let S;e[39]!==v||e[40]!==w?(S=o.jsxs(qe,{children:[v,w]}),e[39]=v,e[40]=w,e[41]=S):S=e[41];let k;e[42]!==i?(k=i("mainPanelTabs.fileTab.close"),e[42]=i,e[43]=k):k=e[43];let j;e[44]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(Ci,{size:14}),e[44]=j):j=e[44];let C;e[45]!==n||e[46]!==k?(C=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":k,onClick:n,children:j})}),e[45]=n,e[46]=k,e[47]=C):C=e[47];let T;e[48]!==i?(T=i("mainPanelTabs.fileTab.close"),e[48]=i,e[49]=T):T=e[49];let N;e[50]!==T?(N=o.jsx(We,{side:"bottom",children:T}),e[50]=T,e[51]=N):N=e[51];let V;e[52]!==C||e[53]!==N?(V=o.jsxs(qe,{children:[C,N]}),e[52]=C,e[53]=N,e[54]=V):V=e[54];let A;return e[55]!==x||e[56]!==S||e[57]!==V||e[58]!==d?(A=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,x,S,V]}),e[55]=x,e[56]=S,e[57]=V,e[58]=d,e[59]=A):A=e[59],A}function $de(t){const e=B.c(31),{fileKey:s,taskId:n}=t,i=re(),{closePanel:r}=hi(),{data:l,isPending:a}=U6(n);let c;e[0]!==s||e[1]!==l?(c=l?.find(g=>g.key===s)??null,e[0]=s,e[1]=l,e[2]=c):c=e[2];const d=c;let f;e[3]!==r?(f=()=>r(),e[3]=r,e[4]=f):f=e[4];const u=f;if(!d){if(a){let w;return e[5]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("div",{className:"h-full w-full bg-background",children:o.jsx(z8,{})}),e[5]=w):w=e[5],w}let g;e[6]!==s?(g=s.split("/").pop()??s,e[6]=s,e[7]=g):g=e[7];let x;e[8]!==g?(x=o.jsx(Zo,{filename:g,className:"h-7.5 w-6"}),e[8]=g,e[9]=x):x=e[9];let b;e[10]!==i?(b=i("mainPanelTabs.fileTab.fileNotAvailable"),e[10]=i,e[11]=b):b=e[11];let y;e[12]!==b?(y=o.jsx("span",{className:"text-sm text-muted-foreground",children:b}),e[12]=b,e[13]=y):y=e[13];let L;e[14]!==i?(L=i("mainPanelTabs.fileTab.close"),e[14]=i,e[15]=L):L=e[15];let v;e[16]!==u||e[17]!==L?(v=o.jsx(ue,{variant:"ghost",size:"sm",onClick:u,children:L}),e[16]=u,e[17]=L,e[18]=v):v=e[18];let _;return e[19]!==x||e[20]!==y||e[21]!==v?(_=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[x,y,v]}),e[19]=x,e[20]=y,e[21]=v,e[22]=_):_=e[22],_}let h;e[23]!==d||e[24]!==u?(h=o.jsx(Ode,{file:d,onClose:u}),e[23]=d,e[24]=u,e[25]=h):h=e[25];let m;e[26]!==d?(m=o.jsx("div",{className:"relative min-h-0 flex-1",children:o.jsx(F8,{file:d})}),e[26]=d,e[27]=m):m=e[27];let p;return e[28]!==h||e[29]!==m?(p=o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[h,m]}),e[28]=h,e[29]=m,e[30]=p):p=e[30],p}function Bde(t){const e=B.c(7),{onClose:s}=t,n=re();let i;e[0]!==n?(i=n("routes.commerceOnboarding.connectModal.loadError"),e[0]=n,e[1]=i):i=e[1];let r;e[2]!==i?(r=o.jsx("p",{className:"text-sm text-muted-foreground",children:i}),e[2]=i,e[3]=r):r=e[3];let l;return e[4]!==s||e[5]!==r?(l=o.jsx(fg,{onClose:s,footer:null,children:r}),e[4]=s,e[5]=r,e[6]=l):l=e[6],l}function zde(){const t=B.c(10),{closePanel:e}=hi();let s;t[0]!==e?(s=()=>e(),t[0]=e,t[1]=s):s=t[1];const n=s;let i;t[2]!==n?(i=()=>o.jsx(Bde,{onClose:n}),t[2]=n,t[3]=i):i=t[3];let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(kE,{}),t[4]=r):r=t[4];let l;t[5]!==n?(l=o.jsx(P.Suspense,{fallback:o.jsx(fg,{onClose:n,footer:null,children:r}),children:o.jsx(Fde,{onDone:n,onClose:n})}),t[5]=n,t[6]=l):l=t[6];let a;return t[7]!==i||t[8]!==l?(a=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(Us,{fallback:i,children:l})}),t[7]=i,t[8]=l,t[9]=a):a=t[9],a}function Fde(t){const e=B.c(46),{onDone:s,onClose:n}=t,i=re(),{org:r}=Fe();let l;e[0]!==r.id?(l=UV.COMMERCE_DISCOVERY(r.id),e[0]=r.id,e[1]=l):l=e[1];const a=l;let c;e[2]!==r.id||e[3]!==r.slug?(c={connectionId:ml,orgId:r.id,orgSlug:r.slug},e[2]=r.id,e[3]=r.slug,e[4]=c):c=e[4];const d=Jt(c);let f;e[5]!==a||e[6]!==r||e[7]!==d?(f={selfClient:d,org:r,cdConnectionId:a},e[5]=a,e[6]=r,e[7]=d,e[8]=f):f=e[8];const u=jE(f),[h,m]=P.useState(!1),[p,g]=P.useState(null);let x;e[9]!==d?(x={mutationFn:async A=>h7(await d.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:A}})),retry:!1},e[9]=d,e[10]=x):x=e[10];const b=Rs(x);let y;e[11]!==s||e[12]!==b||e[13]!==u||e[14]!==i?(y=async()=>{if(g(null),u)try{await b.mutateAsync(u)}catch{g(i("routes.commerceOnboarding.connectModal.somethingWentWrong"));return}s()},e[11]=s,e[12]=b,e[13]=u,e[14]=i,e[15]=y):y=e[15];const L=y;let v;e[16]!==p?(v=p?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:p}):null,e[16]=p,e[17]=v):v=e[17];let _;e[18]!==b.isPending||e[19]!==i?(_=b.isPending?i("routes.commerceOnboarding.connectSourcesTab.refreshing"):i("routes.commerceOnboarding.connectSourcesTab.refresh"),e[18]=b.isPending,e[19]=i,e[20]=_):_=e[20];let w;e[21]!==L?(w=()=>{L()},e[21]=L,e[22]=w):w=e[22];let S;e[23]!==h||e[24]!==b.isPending||e[25]!==_||e[26]!==w?(S=o.jsx(sP,{ready:h,pending:b.isPending,label:_,onClick:w}),e[23]=h,e[24]=b.isPending,e[25]=_,e[26]=w,e[27]=S):S=e[27];let k;e[28]!==v||e[29]!==S?(k=o.jsxs(o.Fragment,{children:[v,S]}),e[28]=v,e[29]=S,e[30]=k):k=e[30];let j;e[31]!==i?(j=i("routes.commerceOnboarding.connectSourcesTab.title"),e[31]=i,e[32]=j):j=e[32];let C;e[33]!==j?(C=o.jsx("h2",{className:"text-xl font-medium leading-tight text-foreground",children:j}),e[33]=j,e[34]=C):C=e[34];let T;e[35]!==a||e[36]!==r||e[37]!==u?(T=o.jsx(CE,{org:r,cdConnectionId:a,siteUrl:u,onReadinessChange:m}),e[35]=a,e[36]=r,e[37]=u,e[38]=T):T=e[38];let N;e[39]!==C||e[40]!==T?(N=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto",children:[C,T]}),e[39]=C,e[40]=T,e[41]=N):N=e[41];let V;return e[42]!==n||e[43]!==k||e[44]!==N?(V=o.jsx(fg,{onClose:n,footer:k,children:N}),e[42]=n,e[43]=k,e[44]=N,e[45]=V):V=e[45],V}const Ude=P.lazy(()=>xn(()=>import("./project-app-view-B27k8y98.js"),__vite__mapDeps([181,1,2,85,28,29,30,31,32,33,34,35,36,37,38,39,40,8,27,41,42,43,44,45,9,46,10,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,86,87,88,15,11,16,22,89,90,91,92,93,94,95,96,97,98,99,7,4,5,14,17,18,19,20,3,6,12,13,21,23,24,25,26,100,101,102,103,104,105,106,107,108,109,110,111,82,79,112,130,118,119,120,121,122,123,124,125,126,113,114,78,115,116,117,127,128,129,131,132,133,134,135,136,137,138,139,140,141,142,143,80,144,145,146,147,148,149,77,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.AppViewContent})));function Hde(){const t=B.c(12),{diagnostic:e,isLoading:s,siteUrl:n,connectionId:i}=S8();if(s){let d;return t[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(cr,{}),t[0]=d):d=t[0],d}if(e){let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(cr,{}),t[1]=d):d=t[1];let f;return t[2]!==i?(f=o.jsx(P.Suspense,{fallback:d,children:o.jsx(Ude,{connectionId:i,toolName:HV})}),t[2]=i,t[3]=f):f=t[3],f}let r;t[4]!==n?(r=()=>o.jsx(Zj,{claimedSiteUrl:n}),t[4]=n,t[5]=r):r=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(cr,{}),t[6]=l):l=t[6];let a;t[7]!==n?(a=o.jsx(P.Suspense,{fallback:l,children:o.jsx(Wde,{claimedSiteUrl:n})}),t[7]=n,t[8]=a):a=t[8];let c;return t[9]!==r||t[10]!==a?(c=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsx(Us,{fallback:r,children:a})}),t[9]=r,t[10]=a,t[11]=c):c=t[11],c}const Kde=["reports.emptyState.checkPerformance","reports.emptyState.checkSeo","reports.emptyState.checkFunnel","reports.emptyState.checkTracking"];function Zj(t){const e=B.c(27),{claimedSiteUrl:s,children:n}=t,i=re(),r=s??void 0;let l;e[0]!==r?(l=Wm(r),e[0]=r,e[1]=l):l=e[1];const a=l;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsxs("div",{className:"relative flex items-end justify-center pt-4",children:[o.jsx("div",{"aria-hidden":!0,className:"absolute -bottom-6 size-56 rounded-full bg-success/10 blur-3xl"}),o.jsx(cp,{className:"relative h-52 w-40 -rotate-6"}),o.jsx(cp,{className:"relative -ml-14 h-56 w-44 rotate-3"})]}),e[2]=c):c=e[2];let d;e[3]!==i?(d=i("reports.emptyState.title"),e[3]=i,e[4]=d):d=e[4];let f;e[5]!==d?(f=o.jsx("h2",{className:"text-lg font-medium leading-7 text-foreground",children:d}),e[5]=d,e[6]=f):f=e[6];let u;e[7]!==i?(u=i("reports.emptyState.description"),e[7]=i,e[8]=u):u=e[8];let h;e[9]!==u?(h=o.jsx("p",{className:"max-w-sm text-sm leading-5 text-muted-foreground",children:u}),e[9]=u,e[10]=h):h=e[10];let m;e[11]!==f||e[12]!==h?(m=o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[f,h]}),e[11]=f,e[12]=h,e[13]=m):m=e[13];let p;e[14]!==n||e[15]!==a?(p=n??(a?o.jsx("p",{className:"text-sm text-muted-foreground",children:a}):null),e[14]=n,e[15]=a,e[16]=p):p=e[16];let g;e[17]!==i?(g=Kde.map(L=>o.jsx("li",{className:"rounded-full border border-border bg-card px-3 py-1 text-xs text-muted-foreground",children:i(L)},L)),e[17]=i,e[18]=g):g=e[18];let x;e[19]!==g?(x=o.jsx("ul",{className:"flex flex-wrap items-center justify-center gap-2",children:g}),e[19]=g,e[20]=x):x=e[20];let b;e[21]!==x||e[22]!==p?(b=o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4",children:[p,x]}),e[21]=x,e[22]=p,e[23]=b):b=e[23];let y;return e[24]!==b||e[25]!==m?(y=o.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-8 p-6",children:[c,m,b]}),e[24]=b,e[25]=m,e[26]=y):y=e[26],y}function Wde(t){const e=B.c(46),{claimedSiteUrl:s}=t,n=re(),i=Ws(),{org:r}=Fe();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:ml,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=l):l=e[2];const a=Jt(l);let c;e[3]!==s?(c=Wm(s??void 0)??"",e[3]=s,e[4]=c):c=e[4];const[d,f]=P.useState(c),[u,h]=P.useState(null);let m;e[5]!==a?(m={mutationFn:async E=>h7(await a.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:E}})),retry:!1},e[5]=a,e[6]=m):m=e[6];const p=Rs(m);let g;e[7]!==i||e[8]!==r.id||e[9]!==r.slug||e[10]!==p?(g=async E=>{const R=NE(E);if(!R.ok){h(R.error);return}h(null);const I=Wm(R.value)??void 0;Ye("reports_start_diagnostic_submitted",{organization_id:r.id,domain:I});try{await p.mutateAsync(R.value)}catch(D){const O=D;Ye("reports_start_diagnostic_failed",{organization_id:r.id,domain:I,error:O instanceof Error?O.message:String(O)}),h(O instanceof Error?O.message:"__configurationFailed");return}i({to:Cc.agents,params:{org:r.slug,project:ca(r.id).id,panel:void 0},search:{connect:"1",siteUrl:R.value}})},e[7]=i,e[8]=r.id,e[9]=r.slug,e[10]=p,e[11]=g):g=e[11];const x=g;let b;e[12]!==d||e[13]!==x?(b=E=>{E.preventDefault(),x(d)},e[12]=d,e[13]=x,e[14]=b):b=e[14];const y=b;let L;e[15]!==n?(L=n("reports.emptyState.siteUrlLabel"),e[15]=n,e[16]=L):L=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=E=>f(E.target.value),e[17]=v):v=e[17];let _;e[18]!==n?(_=n("reports.emptyState.siteUrlPlaceholder"),e[18]=n,e[19]=_):_=e[19];const w=!!u;let S;e[20]!==p.isPending||e[21]!==d||e[22]!==L||e[23]!==_||e[24]!==w?(S=o.jsx(mt,{"aria-label":L,type:"text",inputMode:"url",className:"min-w-0 flex-1",value:d,onChange:v,placeholder:_,"aria-invalid":w,disabled:p.isPending}),e[20]=p.isPending,e[21]=d,e[22]=L,e[23]=_,e[24]=w,e[25]=S):S=e[25];let k;e[26]!==p.isPending||e[27]!==n?(k=p.isPending?n("reports.emptyState.starting"):n("reports.emptyState.start"),e[26]=p.isPending,e[27]=n,e[28]=k):k=e[28];let j;e[29]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(gl,{size:16}),e[29]=j):j=e[29];let C;e[30]!==p.isPending||e[31]!==k?(C=o.jsxs(ue,{type:"submit",className:"shrink-0",disabled:p.isPending,children:[k,j]}),e[30]=p.isPending,e[31]=k,e[32]=C):C=e[32];let T;e[33]!==S||e[34]!==C?(T=o.jsxs("div",{className:"flex flex-col items-stretch gap-2 sm:flex-row sm:items-center",children:[S,C]}),e[33]=S,e[34]=C,e[35]=T):T=e[35];let N;e[36]!==u||e[37]!==n?(N=u?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:ME(n,u)}):null,e[36]=u,e[37]=n,e[38]=N):N=e[38];let V;e[39]!==y||e[40]!==T||e[41]!==N?(V=o.jsxs("form",{className:"flex w-full flex-col gap-2",onSubmit:y,children:[T,N]}),e[39]=y,e[40]=T,e[41]=N,e[42]=V):V=e[42];let A;return e[43]!==s||e[44]!==V?(A=o.jsx(Zj,{claimedSiteUrl:s,children:V}),e[43]=s,e[44]=V,e[45]=A):A=e[45],A}function qde(t){const e=B.c(52),{readUrl:s,editor:n,downloadName:i,trailing:r}=t,l=re();let a;e[0]!==s?(a=new URL(s,window.location.origin).toString(),e[0]=s,e[1]=a):a=e[1];const c=a;let d;e[2]!==n||e[3]!==l?(d=n.deckDetected&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:n.railOpen?"secondary":"ghost",size:"icon","aria-label":n.railOpen?l("deck.deckToolbar.hideSlideList"):l("deck.deckToolbar.showSlideList"),onClick:()=>n.setRailOpen(!n.railOpen),children:o.jsx(L6,{size:14})})}),o.jsx(We,{side:"bottom",children:n.railOpen?l("deck.deckToolbar.hideSlideList"):l("deck.deckToolbar.showSlideList")})]}),e[2]=n,e[3]=l,e[4]=d):d=e[4];let f;e[5]!==c?(f=()=>window.open(c,"_blank","noopener"),e[5]=c,e[6]=f):f=e[6];let u;e[7]!==c?(u=o.jsx("span",{className:"truncate",children:c}),e[7]=c,e[8]=u):u=e[8];let h;e[9]!==c||e[10]!==f||e[11]!==u?(h=o.jsx("button",{type:"button",onClick:f,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:c,children:u}),e[9]=c,e[10]=f,e[11]=u,e[12]=h):h=e[12];let m;e[13]!==n.agentUpdated||e[14]!==n.reload||e[15]!==l?(m=n.agentUpdated&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx(Dn,{size:12}),l("deck.deckToolbar.agentUpdatedReload")]})}),o.jsx(We,{side:"bottom",children:l("deck.deckToolbar.agentRewriteWarning")})]}),e[13]=n.agentUpdated,e[14]=n.reload,e[15]=l,e[16]=m):m=e[16];let p;e[17]!==n.saving||e[18]!==l?(p=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:l("deck.deckToolbar.saving")}),e[17]=n.saving,e[18]=l,e[19]=p):p=e[19];let g;e[20]!==n||e[21]!==l?(g=n.deckDetected&&n.writable&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInline"),className:ie(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(v8,{size:14})})}),o.jsx(We,{side:"bottom",children:n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInlineTooltip")})]}),e[20]=n,e[21]=l,e[22]=g):g=e[22];let x;e[23]!==c||e[24]!==i||e[25]!==n.deckDetected||e[26]!==l?(x=n.deckDetected?o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),children:o.jsx(Eu,{size:14})})}),o.jsxs(zt,{align:"end",children:[o.jsxs(Xe,{onClick:()=>window.open(`${c}#print`,"_blank","noopener"),children:[o.jsx(FA,{size:14}),l("deck.deckToolbar.exportAsPdf")]}),o.jsx(Xe,{asChild:!0,children:o.jsxs("a",{href:c,download:i,children:[o.jsx(u9,{size:14}),l("deck.deckToolbar.downloadHtml")]})})]})]}):o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),asChild:!0,children:o.jsx("a",{href:c,download:i,children:o.jsx(Eu,{size:14})})})}),o.jsx(We,{side:"bottom",children:l("deck.deckToolbar.download")})]}),e[23]=c,e[24]=i,e[25]=n.deckDetected,e[26]=l,e[27]=x):x=e[27];let b;e[28]!==l?(b=l("deck.deckToolbar.openInNewTab"),e[28]=l,e[29]=b):b=e[29];let y;e[30]!==c?(y=()=>window.open(c,"_blank","noopener"),e[30]=c,e[31]=y):y=e[31];let L;e[32]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(hn,{size:14}),e[32]=L):L=e[32];let v;e[33]!==b||e[34]!==y?(v=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":b,onClick:y,children:L})}),e[33]=b,e[34]=y,e[35]=v):v=e[35];let _;e[36]!==l?(_=l("deck.deckToolbar.openInNewTab"),e[36]=l,e[37]=_):_=e[37];let w;e[38]!==_?(w=o.jsx(We,{side:"bottom",children:_}),e[38]=_,e[39]=w):w=e[39];let S;e[40]!==v||e[41]!==w?(S=o.jsxs(qe,{children:[v,w]}),e[40]=v,e[41]=w,e[42]=S):S=e[42];let k;return e[43]!==S||e[44]!==d||e[45]!==h||e[46]!==m||e[47]!==p||e[48]!==g||e[49]!==x||e[50]!==r?(k=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,h,m,p,g,x,S,r]}),e[43]=S,e[44]=d,e[45]=h,e[46]=m,e[47]=p,e[48]=g,e[49]=x,e[50]=r,e[51]=k):k=e[51],k}const kc=1;function Gde(t){if(typeof t!="object"||t===null||t.v!==kc||t.source!=="deck-viewer")return null;const e=t;return e.type==="ready"||e.type==="state"||e.type==="op"&&typeof e.opId=="string"&&e.op?e:null}class Ro extends Error{constructor(e,s){super(e),this.code=s,this.name="DeckOpError"}code}function eC(t){return[...t.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function Yde(t){const s=new DOMParser().parseFromString(t,"text/html").querySelector("deck-viewer");return s?eC(s).length:null}function Jde(t,e){const s=new DOMParser().parseFromString(t,"text/html"),n=s.querySelector("deck-viewer");if(!n)throw new Ro("no <deck-viewer> element in source","no-viewer");const i=eC(n),r=e.kind==="move"?e.from:e.at,l=i[r];if(!l)throw new Ro(`slide index ${r} out of range (${i.length})`,"stale-index");switch(e.kind){case"remove":{if(i.length<=1)throw new Ro("cannot remove the last slide","bad-op");l.remove();break}case"duplicate":{const c=l.cloneNode(!0);c.removeAttribute("id");for(const d of c.querySelectorAll("[id]"))d.removeAttribute("id");l.after(c);break}case"move":{if(e.to<0||e.to>=i.length)throw new Ro(`move target ${e.to} out of range`,"stale-index");if(e.to!==e.from){const c=e.to<e.from?i[e.to]:i[e.to].nextSibling;n.insertBefore(l,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new Ro(`invalid attribute name: ${e.name}`,"bad-op");l.setAttribute(e.name,e.value);break}case"remove-attr":{l.removeAttribute(e.name);break}case"replace":{const d=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!d)throw new Ro("replace html has no root element","bad-op");l.replaceWith(s.importNode(d,!0));break}default:throw new Ro(`unknown op kind: ${e.kind}`,"bad-op")}return`${t.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
644
+ `);if(X.trim()){E(!0);try{oe(),Ye("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:X.length}),m(),await p({tiptapDoc:yL({managerAgentId:Z6.AUTOMATION_MANAGER(l.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:X})})}finally{E(!1)}}},M=e.models?.tier??"smart",$=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,F=I2({defaultValues:{name:e.name,active:e.active,tier:M,modelOverride:$,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),U=F.watch("active"),[H,q]=P.useReducer(Tde,null),W=()=>{H!==null&&(Ye("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(H.fields),save_count:H.saveCount,edit_duration_ms:Date.now()-H.start}),q({type:"reset"}))},G=async()=>{const K=F.control._formState.dirtyFields,X=Object.keys(K);if(X.length===0&&!D)return!0;const Z=F.getValues(),le=F.control._defaultValues;F.reset(Z,{keepValues:!0});const ee=D;O(!1);const ae={tier:Z.tier,...Z.modelOverride?{modelId:Z.modelOverride.modelId,credentialId:Z.modelOverride.credentialId,modelTitle:Z.modelOverride.title}:{}},ce={id:t,name:Z.name,active:Z.active,models:ae,tools:Z.tools,maxAgentSteps:Z.maxAgentSteps,messages:OT(x),temperature:0};try{await a.mutateAsync(ce)}catch{return F.reset(le,{keepValues:!0}),ee&&O(!0),!1}const fe=[...X];return ee&&fe.push("messages"),q({type:"accumulate",now:Date.now(),fields:fe}),se(),!0},{schedule:Y,flush:J}=eh({save:G}),{schedule:se,flush:oe}=eh({delayMs:3e4,save:async()=>W()});P.useEffect(()=>{const K=F.watch(()=>Y());return()=>K.unsubscribe()},[]);const ne=K=>{if(b(K),!R){I(!0);return}O(!0),Y()},Q=async()=>{Ye("automation_test_clicked",{automation_id:t,agent_id:r});const K=await J();if(oe(),!!K){if(!x){xe.error(i("automations.automationDetail.noInstructionsConfigured"));return}try{const X=await d.mutateAsync(t);X.threadId&&(m(),h(X.threadId))}catch{}}};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(ue,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(m9,{size:14}),i("automations.automationDetail.backToList")]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(js,{control:F.control,name:"name",render:({field:K})=>o.jsx(mt,{...K,placeholder:i("automations.automationDetail.automationNamePlaceholder"),className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),n&&o.jsx(ue,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:o.jsx(tn,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(js,{control:F.control,name:"active",render:({field:K})=>o.jsx(hr,{checked:K.value,onCheckedChange:X=>{K.onChange(X),J()},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i(U?"automations.automationDetail.active":"automations.automationDetail.inactive")}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(_L,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.starter")}),o.jsx(_de,{automationId:t,open:y,onOpenChange:L,onCustomSelect:()=>{S(!0),T(!1),j("")},onEventSelect:()=>{T(!0),S(!1)},onWebhookCreated:K=>{Ye("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),V(K)}})]}),e.triggers.length===0&&!w?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[i("automations.automationDetail.whenShouldRun")," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>L(!0),children:i("automations.automationDetail.addStarter")})," ",i("automations.automationDetail.toGetGoing")]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(K=>o.jsx(Lde,{trigger:K,automationId:t,connectionName:K.connection_id?u.get(K.connection_id):void 0},K.id))}),w&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(uu,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:k,onChange:K=>j(K.target.value),onBlur:async()=>{const K=k.trim();if(!(!K||!wu(K)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:K}),Ye("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),xe.success(i("automations.automationDetail.starterAdded")),S(!1),j("")}catch{xe.error(i("automations.automationDetail.failedToAddStarter"))}},onKeyDown:async K=>{const X=k.trim();K.key==="Enter"&&X&&wu(X)&&K.target.blur(),K.key==="Escape"&&(S(!1),j(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),k&&!wu(k)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:i("automations.automationDetail.invalid")}),c.isPending&&o.jsx(ot,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{S(!1),j("")},children:o.jsx(Ci,{size:13})})]}),C&&o.jsx(P.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(ot,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i("automations.automationDetail.loadingConnections")})]}),children:o.jsx(Sde,{automationId:t,onDone:()=>T(!1)})}),o.jsx(Jj,{open:N!==null,onOpenChange:K=>{K||V(null)},url:N?.url??null,token:N?.token??null})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.instructions")}),o.jsxs(ue,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:A||!x,onClick:z,children:[o.jsx(Wr,{size:13}),i("automations.automationDetail.improve")]})]}),o.jsx(a_,{tiptapDoc:x,setTiptapDoc:ne,placeholder:i("automations.automationDetail.instructionsPlaceholder"),children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(c_,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(ue,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:Q,disabled:!r,children:[o.jsx(Jh,{size:16}),i("automations.automationDetail.test")]})}),o.jsx(We,{children:i("automations.automationDetail.testAutomation")})]})})]})})]}),o.jsxs(J6,{open:v,onOpenChange:_,className:"flex flex-col gap-2.5",children:[o.jsxs(G6,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.advanced")}),o.jsx(Qt,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),o.jsxs(Y6,{className:"flex flex-col gap-5 pt-0.5",children:[o.jsx(rde,{tier:F.watch("tier"),onTierChange:K=>F.setValue("tier",K,{shouldDirty:!0}),override:F.watch("modelOverride"),onOverrideChange:K=>F.setValue("modelOverride",K,{shouldDirty:!0})}),o.jsx(cde,{agentId:r||null,value:F.watch("tools"),onChange:K=>F.setValue("tools",K,{shouldDirty:!0})}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.maxSteps")}),o.jsx(mt,{type:"number",min:1,max:100,className:"w-40",placeholder:i("automations.automationDetail.maxStepsPlaceholder",{default:Nde}),value:F.watch("maxAgentSteps")??"",onChange:K=>{const X=K.target.value.trim(),Z=X===""?null:Number(X);F.setValue("maxAgentSteps",Z===null||Number.isNaN(Z)?null:Z,{shouldDirty:!0})}})]})]})]})]})]})}const Qj=[{key:"24h",labelKey:"mainPanelTabs.automationTab.last24hours",ms:1440*60*1e3},{key:"7d",labelKey:"mainPanelTabs.automationTab.last7days",ms:10080*60*1e3},{key:"30d",labelKey:"mainPanelTabs.automationTab.last30days",ms:720*60*60*1e3}];function Xj(t){const e=Qj.find(n=>n.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function Ade(t){const e=B.c(16),{automationId:s,triggerIds:n}=t,i=re(),[r,l]=P.useState("30d"),[a,c]=P.useState(Pde);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=x=>{const b=x;l(b),c(Xj(b))},e[0]=d):d=e[0];let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(_s,{className:"w-44",children:o.jsx(Ns,{})}),e[1]=f):f=e[1];let u;e[2]!==i?(u=Qj.map(x=>o.jsx(Rt,{value:x.key,children:i(x.labelKey)},x.key)),e[2]=i,e[3]=u):u=e[3];let h;e[4]!==u?(h=o.jsx(Ls,{children:u}),e[4]=u,e[5]=h):h=e[5];let m;e[6]!==h||e[7]!==r?(m=o.jsx("div",{className:"flex items-center justify-end",children:o.jsxs(ys,{value:r,onValueChange:d,children:[f,h]})}),e[6]=h,e[7]=r,e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==a||e[11]!==n?(p=o.jsx(TV,{automationId:s,triggerIds:n,range:a}),e[9]=s,e[10]=a,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"flex flex-col gap-5",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function Pde(){return Xj("30d")}function Ede(t){const e=B.c(5),{tabId:s}=t;let n;e[0]!==s?(n=b6(s),e[0]=s,e[1]=n):n=e[1];const i=n;if(!i)return null;let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(cr,{}),e[2]=r):r=e[2];let l;return e[3]!==i.id?(l=o.jsx(P.Suspense,{fallback:r,children:o.jsx(Rde,{id:i.id})}),e[3]=i.id,e[4]=l):l=e[4],l}function Rde(t){const e=B.c(41),{id:s}=t,n=re(),{openPanel:i}=hi(),{data:r,isLoading:l}=PE(s),[a,c]=P.useState("settings");let d;e[0]!==i?(d=()=>i("automations"),e[0]=i,e[1]=d):d=e[1];const f=d;if(l){let C;return e[2]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(cr,{}),e[2]=C):C=e[2],C}if(!r){let C;e[3]!==n?(C=n("mainPanelTabs.automationTab.automationNotFound"),e[3]=n,e[4]=C):C=e[4];let T;return e[5]!==C?(T=o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:C}),e[5]=C,e[6]=T):T=e[6],T}let u;e[7]!==r.triggers?(u=r.triggers.map(Dde),e[7]=r.triggers,e[8]=u):u=e[8];const h=u;let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(m9,{size:14}),e[9]=m):m=e[9];let p;e[10]!==n?(p=n("mainPanelTabs.automationTab.backToList"),e[10]=n,e[11]=p):p=e[11];let g;e[12]!==f||e[13]!==p?(g=o.jsxs(ue,{variant:"ghost",size:"sm",onClick:f,children:[m,p]}),e[12]=f,e[13]=p,e[14]=g):g=e[14];let x;e[15]!==n?(x=n("mainPanelTabs.automationTab.settings"),e[15]=n,e[16]=x):x=e[16];let b;e[17]!==x?(b={id:"settings",label:x},e[17]=x,e[18]=b):b=e[18];let y;e[19]!==n?(y=n("mainPanelTabs.automationTab.runs"),e[19]=n,e[20]=y):y=e[20];let L;e[21]!==y?(L={id:"runs",label:y},e[21]=y,e[22]=L):L=e[22];let v;e[23]!==b||e[24]!==L?(v=[b,L],e[23]=b,e[24]=L,e[25]=v):v=e[25];let _;e[26]===Symbol.for("react.memo_cache_sentinel")?(_=C=>c(C),e[26]=_):_=e[26];let w;e[27]!==v||e[28]!==a?(w=o.jsx(G8,{tabs:v,activeTab:a,onTabChange:_}),e[27]=v,e[28]=a,e[29]=w):w=e[29];let S;e[30]!==w||e[31]!==g?(S=o.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[g,w]}),e[30]=w,e[31]=g,e[32]=S):S=e[32];let k;e[33]!==r||e[34]!==s||e[35]!==a||e[36]!==h?(k=a==="settings"?o.jsx(Vde,{automationId:s,automation:r}):o.jsx(Ade,{automationId:s,triggerIds:h}),e[33]=r,e[34]=s,e[35]=a,e[36]=h,e[37]=k):k=e[37];let j;return e[38]!==S||e[39]!==k?(j=o.jsx(wi,{children:o.jsx(wi.Content,{children:o.jsxs(wi.Body,{children:[S,k]})})}),e[38]=S,e[39]=k,e[40]=j):j=e[40],j}function Dde(t){return t.id}function Ide(t){const e=B.c(29),{virtualMcpId:s}=t,n=re(),{openPanel:i}=hi(),{data:r}=EE(s),l=r===void 0?[]:r,{create:a}=f0(),[c,d]=P.useState(""),f=c.toLowerCase(),u=l.filter(R=>R.name.toLowerCase().includes(f));let h;e[0]!==i?(h=R=>i(`automation:${R}`),e[0]=i,e[1]=h):h=e[1];const m=h,p=async()=>{if(a.isPending)return;Ye("automation_new_clicked",{virtual_mcp_id:s,existing_count:l.length});const R=await a.mutateAsync(RE(s));m(R.id)},g=a.isPending;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Kt,{size:14}),e[2]=x):x=e[2];let b;e[3]!==n?(b=n("automations.automationsList.newAutomation"),e[3]=n,e[4]=b):b=e[4];let y;e[5]!==a.isPending||e[6]!==p||e[7]!==b?(y=o.jsxs(ue,{size:"sm",onClick:p,disabled:g,children:[x,b]}),e[5]=a.isPending,e[6]=p,e[7]=b,e[8]=y):y=e[8];const L=y,v=wi,_=wi,w=wi;let S;e[9]!==n?(S=n("automations.automationsList.title"),e[9]=n,e[10]=S):S=e[10];let k;e[11]!==S?(k=o.jsx(wi.Title,{children:S}),e[11]=S,e[12]=k):k=e[12];const j=l.length>0&&o.jsx(L9,{value:c,onChange:d,placeholder:n("automations.automationsList.searchPlaceholder"),className:"w-full md:w-[375px]"});let C;e[13]!==L||e[14]!==j?(C=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[j,L]}),e[13]=L,e[14]=j,e[15]=C):C=e[15];let T;e[16]!==k||e[17]!==C?(T=o.jsxs("div",{className:"flex flex-col gap-6",children:[k,C]}),e[16]=k,e[17]=C,e[18]=T):T=e[18];const N=l.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Qo,{image:o.jsx(mr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.emptyTitle"),description:n("automations.automationsList.emptyDescription"),actions:L})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Qo,{image:o.jsx(mr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.noResultsTitle"),description:n("automations.automationsList.noResultsDescription",{search:c})})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(R=>o.jsx(IE,{automation:R,onClick:()=>m(R.id)},R.id))});let V;e[19]!==T||e[20]!==N||e[21]!==w.Body?(V=o.jsxs(w.Body,{children:[T,N]}),e[19]=T,e[20]=N,e[21]=w.Body,e[22]=V):V=e[22];let A;e[23]!==V||e[24]!==_.Content?(A=o.jsx(_.Content,{children:V}),e[23]=V,e[24]=_.Content,e[25]=A):A=e[25];let E;return e[26]!==v||e[27]!==A?(E=o.jsx(v,{children:A}),e[26]=v,e[27]=A,e[28]=E):E=e[28],E}function Mde(t){const e=B.c(3),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(cr,{}),e[0]=n):n=e[0];let i;return e[1]!==s?(i=o.jsx(P.Suspense,{fallback:n,children:o.jsx(Ide,{virtualMcpId:s})}),e[1]=s,e[2]=i):i=e[2],i}function Ode(t){const e=B.c(60),{file:s,onClose:n}=t,i=re();let r,l;e[0]!==s.filename?(r=o.jsx(Zo,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),l=o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=l):(r=e[1],l=e[2]);let a;e[3]!==s.size?(a=U8(s.size),e[3]=s.size,e[4]=a):a=e[4];let c;e[5]!==a?(c=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:a}),e[5]=a,e[6]=c):c=e[6];let d;e[7]!==r||e[8]!==l||e[9]!==c?(d=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,l,c]}),e[7]=r,e[8]=l,e[9]=c,e[10]=d):d=e[10];let f;e[11]!==i?(f=i("mainPanelTabs.fileTab.download"),e[11]=i,e[12]=f):f=e[12];let u;e[13]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Eu,{size:14}),e[13]=u):u=e[13];let h;e[14]!==s.downloadUrl||e[15]!==s.filename?(h=o.jsx("a",{href:s.downloadUrl,download:s.filename,children:u}),e[14]=s.downloadUrl,e[15]=s.filename,e[16]=h):h=e[16];let m;e[17]!==f||e[18]!==h?(m=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":f,asChild:!0,children:h})}),e[17]=f,e[18]=h,e[19]=m):m=e[19];let p;e[20]!==i?(p=i("mainPanelTabs.fileTab.download"),e[20]=i,e[21]=p):p=e[21];let g;e[22]!==p?(g=o.jsx(We,{side:"bottom",children:p}),e[22]=p,e[23]=g):g=e[23];let x;e[24]!==g||e[25]!==m?(x=o.jsxs(qe,{children:[m,g]}),e[24]=g,e[25]=m,e[26]=x):x=e[26];let b;e[27]!==i?(b=i("mainPanelTabs.fileTab.openInNewTab"),e[27]=i,e[28]=b):b=e[28];let y;e[29]!==s.downloadUrl?(y=()=>window.open(s.downloadUrl,"_blank","noopener"),e[29]=s.downloadUrl,e[30]=y):y=e[30];let L;e[31]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(hn,{size:14}),e[31]=L):L=e[31];let v;e[32]!==b||e[33]!==y?(v=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":b,onClick:y,children:L})}),e[32]=b,e[33]=y,e[34]=v):v=e[34];let _;e[35]!==i?(_=i("mainPanelTabs.fileTab.openInNewTab"),e[35]=i,e[36]=_):_=e[36];let w;e[37]!==_?(w=o.jsx(We,{side:"bottom",children:_}),e[37]=_,e[38]=w):w=e[38];let S;e[39]!==v||e[40]!==w?(S=o.jsxs(qe,{children:[v,w]}),e[39]=v,e[40]=w,e[41]=S):S=e[41];let k;e[42]!==i?(k=i("mainPanelTabs.fileTab.close"),e[42]=i,e[43]=k):k=e[43];let j;e[44]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(Ci,{size:14}),e[44]=j):j=e[44];let C;e[45]!==n||e[46]!==k?(C=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":k,onClick:n,children:j})}),e[45]=n,e[46]=k,e[47]=C):C=e[47];let T;e[48]!==i?(T=i("mainPanelTabs.fileTab.close"),e[48]=i,e[49]=T):T=e[49];let N;e[50]!==T?(N=o.jsx(We,{side:"bottom",children:T}),e[50]=T,e[51]=N):N=e[51];let V;e[52]!==C||e[53]!==N?(V=o.jsxs(qe,{children:[C,N]}),e[52]=C,e[53]=N,e[54]=V):V=e[54];let A;return e[55]!==x||e[56]!==S||e[57]!==V||e[58]!==d?(A=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,x,S,V]}),e[55]=x,e[56]=S,e[57]=V,e[58]=d,e[59]=A):A=e[59],A}function $de(t){const e=B.c(31),{fileKey:s,taskId:n}=t,i=re(),{closePanel:r}=hi(),{data:l,isPending:a}=U6(n);let c;e[0]!==s||e[1]!==l?(c=l?.find(g=>g.key===s)??null,e[0]=s,e[1]=l,e[2]=c):c=e[2];const d=c;let f;e[3]!==r?(f=()=>r(),e[3]=r,e[4]=f):f=e[4];const u=f;if(!d){if(a){let w;return e[5]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("div",{className:"h-full w-full bg-background",children:o.jsx(z8,{})}),e[5]=w):w=e[5],w}let g;e[6]!==s?(g=s.split("/").pop()??s,e[6]=s,e[7]=g):g=e[7];let x;e[8]!==g?(x=o.jsx(Zo,{filename:g,className:"h-7.5 w-6"}),e[8]=g,e[9]=x):x=e[9];let b;e[10]!==i?(b=i("mainPanelTabs.fileTab.fileNotAvailable"),e[10]=i,e[11]=b):b=e[11];let y;e[12]!==b?(y=o.jsx("span",{className:"text-sm text-muted-foreground",children:b}),e[12]=b,e[13]=y):y=e[13];let L;e[14]!==i?(L=i("mainPanelTabs.fileTab.close"),e[14]=i,e[15]=L):L=e[15];let v;e[16]!==u||e[17]!==L?(v=o.jsx(ue,{variant:"ghost",size:"sm",onClick:u,children:L}),e[16]=u,e[17]=L,e[18]=v):v=e[18];let _;return e[19]!==x||e[20]!==y||e[21]!==v?(_=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[x,y,v]}),e[19]=x,e[20]=y,e[21]=v,e[22]=_):_=e[22],_}let h;e[23]!==d||e[24]!==u?(h=o.jsx(Ode,{file:d,onClose:u}),e[23]=d,e[24]=u,e[25]=h):h=e[25];let m;e[26]!==d?(m=o.jsx("div",{className:"relative min-h-0 flex-1",children:o.jsx(F8,{file:d})}),e[26]=d,e[27]=m):m=e[27];let p;return e[28]!==h||e[29]!==m?(p=o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[h,m]}),e[28]=h,e[29]=m,e[30]=p):p=e[30],p}function Bde(t){const e=B.c(7),{onClose:s}=t,n=re();let i;e[0]!==n?(i=n("routes.commerceOnboarding.connectModal.loadError"),e[0]=n,e[1]=i):i=e[1];let r;e[2]!==i?(r=o.jsx("p",{className:"text-sm text-muted-foreground",children:i}),e[2]=i,e[3]=r):r=e[3];let l;return e[4]!==s||e[5]!==r?(l=o.jsx(fg,{onClose:s,footer:null,children:r}),e[4]=s,e[5]=r,e[6]=l):l=e[6],l}function zde(){const t=B.c(10),{closePanel:e}=hi();let s;t[0]!==e?(s=()=>e(),t[0]=e,t[1]=s):s=t[1];const n=s;let i;t[2]!==n?(i=()=>o.jsx(Bde,{onClose:n}),t[2]=n,t[3]=i):i=t[3];let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(kE,{}),t[4]=r):r=t[4];let l;t[5]!==n?(l=o.jsx(P.Suspense,{fallback:o.jsx(fg,{onClose:n,footer:null,children:r}),children:o.jsx(Fde,{onDone:n,onClose:n})}),t[5]=n,t[6]=l):l=t[6];let a;return t[7]!==i||t[8]!==l?(a=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(Us,{fallback:i,children:l})}),t[7]=i,t[8]=l,t[9]=a):a=t[9],a}function Fde(t){const e=B.c(46),{onDone:s,onClose:n}=t,i=re(),{org:r}=Fe();let l;e[0]!==r.id?(l=UV.COMMERCE_DISCOVERY(r.id),e[0]=r.id,e[1]=l):l=e[1];const a=l;let c;e[2]!==r.id||e[3]!==r.slug?(c={connectionId:ml,orgId:r.id,orgSlug:r.slug},e[2]=r.id,e[3]=r.slug,e[4]=c):c=e[4];const d=Jt(c);let f;e[5]!==a||e[6]!==r||e[7]!==d?(f={selfClient:d,org:r,cdConnectionId:a},e[5]=a,e[6]=r,e[7]=d,e[8]=f):f=e[8];const u=jE(f),[h,m]=P.useState(!1),[p,g]=P.useState(null);let x;e[9]!==d?(x={mutationFn:async A=>h7(await d.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:A}})),retry:!1},e[9]=d,e[10]=x):x=e[10];const b=Rs(x);let y;e[11]!==s||e[12]!==b||e[13]!==u||e[14]!==i?(y=async()=>{if(g(null),u)try{await b.mutateAsync(u)}catch{g(i("routes.commerceOnboarding.connectModal.somethingWentWrong"));return}s()},e[11]=s,e[12]=b,e[13]=u,e[14]=i,e[15]=y):y=e[15];const L=y;let v;e[16]!==p?(v=p?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:p}):null,e[16]=p,e[17]=v):v=e[17];let _;e[18]!==b.isPending||e[19]!==i?(_=b.isPending?i("routes.commerceOnboarding.connectSourcesTab.refreshing"):i("routes.commerceOnboarding.connectSourcesTab.refresh"),e[18]=b.isPending,e[19]=i,e[20]=_):_=e[20];let w;e[21]!==L?(w=()=>{L()},e[21]=L,e[22]=w):w=e[22];let S;e[23]!==h||e[24]!==b.isPending||e[25]!==_||e[26]!==w?(S=o.jsx(sP,{ready:h,pending:b.isPending,label:_,onClick:w}),e[23]=h,e[24]=b.isPending,e[25]=_,e[26]=w,e[27]=S):S=e[27];let k;e[28]!==v||e[29]!==S?(k=o.jsxs(o.Fragment,{children:[v,S]}),e[28]=v,e[29]=S,e[30]=k):k=e[30];let j;e[31]!==i?(j=i("routes.commerceOnboarding.connectSourcesTab.title"),e[31]=i,e[32]=j):j=e[32];let C;e[33]!==j?(C=o.jsx("h2",{className:"text-xl font-medium leading-tight text-foreground",children:j}),e[33]=j,e[34]=C):C=e[34];let T;e[35]!==a||e[36]!==r||e[37]!==u?(T=o.jsx(CE,{org:r,cdConnectionId:a,siteUrl:u,onReadinessChange:m}),e[35]=a,e[36]=r,e[37]=u,e[38]=T):T=e[38];let N;e[39]!==C||e[40]!==T?(N=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto",children:[C,T]}),e[39]=C,e[40]=T,e[41]=N):N=e[41];let V;return e[42]!==n||e[43]!==k||e[44]!==N?(V=o.jsx(fg,{onClose:n,footer:k,children:N}),e[42]=n,e[43]=k,e[44]=N,e[45]=V):V=e[45],V}const Ude=P.lazy(()=>xn(()=>import("./project-app-view-CMOtQWit.js"),__vite__mapDeps([181,1,2,85,28,29,30,31,32,33,34,35,36,37,38,39,40,8,27,41,42,43,44,45,9,46,10,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,86,87,88,15,11,16,22,89,90,91,92,93,94,95,96,97,98,99,7,4,5,14,17,18,19,20,3,6,12,13,21,23,24,25,26,100,101,102,103,104,105,106,107,108,109,110,111,82,79,112,130,118,119,120,121,122,123,124,125,126,113,114,78,115,116,117,127,128,129,131,132,133,134,135,136,137,138,139,140,141,142,143,80,144,145,146,147,148,149,77,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.AppViewContent})));function Hde(){const t=B.c(12),{diagnostic:e,isLoading:s,siteUrl:n,connectionId:i}=S8();if(s){let d;return t[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(cr,{}),t[0]=d):d=t[0],d}if(e){let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(cr,{}),t[1]=d):d=t[1];let f;return t[2]!==i?(f=o.jsx(P.Suspense,{fallback:d,children:o.jsx(Ude,{connectionId:i,toolName:HV})}),t[2]=i,t[3]=f):f=t[3],f}let r;t[4]!==n?(r=()=>o.jsx(Zj,{claimedSiteUrl:n}),t[4]=n,t[5]=r):r=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(cr,{}),t[6]=l):l=t[6];let a;t[7]!==n?(a=o.jsx(P.Suspense,{fallback:l,children:o.jsx(Wde,{claimedSiteUrl:n})}),t[7]=n,t[8]=a):a=t[8];let c;return t[9]!==r||t[10]!==a?(c=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsx(Us,{fallback:r,children:a})}),t[9]=r,t[10]=a,t[11]=c):c=t[11],c}const Kde=["reports.emptyState.checkPerformance","reports.emptyState.checkSeo","reports.emptyState.checkFunnel","reports.emptyState.checkTracking"];function Zj(t){const e=B.c(27),{claimedSiteUrl:s,children:n}=t,i=re(),r=s??void 0;let l;e[0]!==r?(l=Wm(r),e[0]=r,e[1]=l):l=e[1];const a=l;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsxs("div",{className:"relative flex items-end justify-center pt-4",children:[o.jsx("div",{"aria-hidden":!0,className:"absolute -bottom-6 size-56 rounded-full bg-success/10 blur-3xl"}),o.jsx(cp,{className:"relative h-52 w-40 -rotate-6"}),o.jsx(cp,{className:"relative -ml-14 h-56 w-44 rotate-3"})]}),e[2]=c):c=e[2];let d;e[3]!==i?(d=i("reports.emptyState.title"),e[3]=i,e[4]=d):d=e[4];let f;e[5]!==d?(f=o.jsx("h2",{className:"text-lg font-medium leading-7 text-foreground",children:d}),e[5]=d,e[6]=f):f=e[6];let u;e[7]!==i?(u=i("reports.emptyState.description"),e[7]=i,e[8]=u):u=e[8];let h;e[9]!==u?(h=o.jsx("p",{className:"max-w-sm text-sm leading-5 text-muted-foreground",children:u}),e[9]=u,e[10]=h):h=e[10];let m;e[11]!==f||e[12]!==h?(m=o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[f,h]}),e[11]=f,e[12]=h,e[13]=m):m=e[13];let p;e[14]!==n||e[15]!==a?(p=n??(a?o.jsx("p",{className:"text-sm text-muted-foreground",children:a}):null),e[14]=n,e[15]=a,e[16]=p):p=e[16];let g;e[17]!==i?(g=Kde.map(L=>o.jsx("li",{className:"rounded-full border border-border bg-card px-3 py-1 text-xs text-muted-foreground",children:i(L)},L)),e[17]=i,e[18]=g):g=e[18];let x;e[19]!==g?(x=o.jsx("ul",{className:"flex flex-wrap items-center justify-center gap-2",children:g}),e[19]=g,e[20]=x):x=e[20];let b;e[21]!==x||e[22]!==p?(b=o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4",children:[p,x]}),e[21]=x,e[22]=p,e[23]=b):b=e[23];let y;return e[24]!==b||e[25]!==m?(y=o.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-8 p-6",children:[c,m,b]}),e[24]=b,e[25]=m,e[26]=y):y=e[26],y}function Wde(t){const e=B.c(46),{claimedSiteUrl:s}=t,n=re(),i=Ws(),{org:r}=Fe();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:ml,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=l):l=e[2];const a=Jt(l);let c;e[3]!==s?(c=Wm(s??void 0)??"",e[3]=s,e[4]=c):c=e[4];const[d,f]=P.useState(c),[u,h]=P.useState(null);let m;e[5]!==a?(m={mutationFn:async E=>h7(await a.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:E}})),retry:!1},e[5]=a,e[6]=m):m=e[6];const p=Rs(m);let g;e[7]!==i||e[8]!==r.id||e[9]!==r.slug||e[10]!==p?(g=async E=>{const R=NE(E);if(!R.ok){h(R.error);return}h(null);const I=Wm(R.value)??void 0;Ye("reports_start_diagnostic_submitted",{organization_id:r.id,domain:I});try{await p.mutateAsync(R.value)}catch(D){const O=D;Ye("reports_start_diagnostic_failed",{organization_id:r.id,domain:I,error:O instanceof Error?O.message:String(O)}),h(O instanceof Error?O.message:"__configurationFailed");return}i({to:Cc.agents,params:{org:r.slug,project:ca(r.id).id,panel:void 0},search:{connect:"1",siteUrl:R.value}})},e[7]=i,e[8]=r.id,e[9]=r.slug,e[10]=p,e[11]=g):g=e[11];const x=g;let b;e[12]!==d||e[13]!==x?(b=E=>{E.preventDefault(),x(d)},e[12]=d,e[13]=x,e[14]=b):b=e[14];const y=b;let L;e[15]!==n?(L=n("reports.emptyState.siteUrlLabel"),e[15]=n,e[16]=L):L=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=E=>f(E.target.value),e[17]=v):v=e[17];let _;e[18]!==n?(_=n("reports.emptyState.siteUrlPlaceholder"),e[18]=n,e[19]=_):_=e[19];const w=!!u;let S;e[20]!==p.isPending||e[21]!==d||e[22]!==L||e[23]!==_||e[24]!==w?(S=o.jsx(mt,{"aria-label":L,type:"text",inputMode:"url",className:"min-w-0 flex-1",value:d,onChange:v,placeholder:_,"aria-invalid":w,disabled:p.isPending}),e[20]=p.isPending,e[21]=d,e[22]=L,e[23]=_,e[24]=w,e[25]=S):S=e[25];let k;e[26]!==p.isPending||e[27]!==n?(k=p.isPending?n("reports.emptyState.starting"):n("reports.emptyState.start"),e[26]=p.isPending,e[27]=n,e[28]=k):k=e[28];let j;e[29]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(gl,{size:16}),e[29]=j):j=e[29];let C;e[30]!==p.isPending||e[31]!==k?(C=o.jsxs(ue,{type:"submit",className:"shrink-0",disabled:p.isPending,children:[k,j]}),e[30]=p.isPending,e[31]=k,e[32]=C):C=e[32];let T;e[33]!==S||e[34]!==C?(T=o.jsxs("div",{className:"flex flex-col items-stretch gap-2 sm:flex-row sm:items-center",children:[S,C]}),e[33]=S,e[34]=C,e[35]=T):T=e[35];let N;e[36]!==u||e[37]!==n?(N=u?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:ME(n,u)}):null,e[36]=u,e[37]=n,e[38]=N):N=e[38];let V;e[39]!==y||e[40]!==T||e[41]!==N?(V=o.jsxs("form",{className:"flex w-full flex-col gap-2",onSubmit:y,children:[T,N]}),e[39]=y,e[40]=T,e[41]=N,e[42]=V):V=e[42];let A;return e[43]!==s||e[44]!==V?(A=o.jsx(Zj,{claimedSiteUrl:s,children:V}),e[43]=s,e[44]=V,e[45]=A):A=e[45],A}function qde(t){const e=B.c(52),{readUrl:s,editor:n,downloadName:i,trailing:r}=t,l=re();let a;e[0]!==s?(a=new URL(s,window.location.origin).toString(),e[0]=s,e[1]=a):a=e[1];const c=a;let d;e[2]!==n||e[3]!==l?(d=n.deckDetected&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:n.railOpen?"secondary":"ghost",size:"icon","aria-label":n.railOpen?l("deck.deckToolbar.hideSlideList"):l("deck.deckToolbar.showSlideList"),onClick:()=>n.setRailOpen(!n.railOpen),children:o.jsx(L6,{size:14})})}),o.jsx(We,{side:"bottom",children:n.railOpen?l("deck.deckToolbar.hideSlideList"):l("deck.deckToolbar.showSlideList")})]}),e[2]=n,e[3]=l,e[4]=d):d=e[4];let f;e[5]!==c?(f=()=>window.open(c,"_blank","noopener"),e[5]=c,e[6]=f):f=e[6];let u;e[7]!==c?(u=o.jsx("span",{className:"truncate",children:c}),e[7]=c,e[8]=u):u=e[8];let h;e[9]!==c||e[10]!==f||e[11]!==u?(h=o.jsx("button",{type:"button",onClick:f,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:c,children:u}),e[9]=c,e[10]=f,e[11]=u,e[12]=h):h=e[12];let m;e[13]!==n.agentUpdated||e[14]!==n.reload||e[15]!==l?(m=n.agentUpdated&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx(Dn,{size:12}),l("deck.deckToolbar.agentUpdatedReload")]})}),o.jsx(We,{side:"bottom",children:l("deck.deckToolbar.agentRewriteWarning")})]}),e[13]=n.agentUpdated,e[14]=n.reload,e[15]=l,e[16]=m):m=e[16];let p;e[17]!==n.saving||e[18]!==l?(p=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:l("deck.deckToolbar.saving")}),e[17]=n.saving,e[18]=l,e[19]=p):p=e[19];let g;e[20]!==n||e[21]!==l?(g=n.deckDetected&&n.writable&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInline"),className:ie(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(v8,{size:14})})}),o.jsx(We,{side:"bottom",children:n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInlineTooltip")})]}),e[20]=n,e[21]=l,e[22]=g):g=e[22];let x;e[23]!==c||e[24]!==i||e[25]!==n.deckDetected||e[26]!==l?(x=n.deckDetected?o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),children:o.jsx(Eu,{size:14})})}),o.jsxs(zt,{align:"end",children:[o.jsxs(Xe,{onClick:()=>window.open(`${c}#print`,"_blank","noopener"),children:[o.jsx(FA,{size:14}),l("deck.deckToolbar.exportAsPdf")]}),o.jsx(Xe,{asChild:!0,children:o.jsxs("a",{href:c,download:i,children:[o.jsx(u9,{size:14}),l("deck.deckToolbar.downloadHtml")]})})]})]}):o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),asChild:!0,children:o.jsx("a",{href:c,download:i,children:o.jsx(Eu,{size:14})})})}),o.jsx(We,{side:"bottom",children:l("deck.deckToolbar.download")})]}),e[23]=c,e[24]=i,e[25]=n.deckDetected,e[26]=l,e[27]=x):x=e[27];let b;e[28]!==l?(b=l("deck.deckToolbar.openInNewTab"),e[28]=l,e[29]=b):b=e[29];let y;e[30]!==c?(y=()=>window.open(c,"_blank","noopener"),e[30]=c,e[31]=y):y=e[31];let L;e[32]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(hn,{size:14}),e[32]=L):L=e[32];let v;e[33]!==b||e[34]!==y?(v=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":b,onClick:y,children:L})}),e[33]=b,e[34]=y,e[35]=v):v=e[35];let _;e[36]!==l?(_=l("deck.deckToolbar.openInNewTab"),e[36]=l,e[37]=_):_=e[37];let w;e[38]!==_?(w=o.jsx(We,{side:"bottom",children:_}),e[38]=_,e[39]=w):w=e[39];let S;e[40]!==v||e[41]!==w?(S=o.jsxs(qe,{children:[v,w]}),e[40]=v,e[41]=w,e[42]=S):S=e[42];let k;return e[43]!==S||e[44]!==d||e[45]!==h||e[46]!==m||e[47]!==p||e[48]!==g||e[49]!==x||e[50]!==r?(k=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,h,m,p,g,x,S,r]}),e[43]=S,e[44]=d,e[45]=h,e[46]=m,e[47]=p,e[48]=g,e[49]=x,e[50]=r,e[51]=k):k=e[51],k}const kc=1;function Gde(t){if(typeof t!="object"||t===null||t.v!==kc||t.source!=="deck-viewer")return null;const e=t;return e.type==="ready"||e.type==="state"||e.type==="op"&&typeof e.opId=="string"&&e.op?e:null}class Ro extends Error{constructor(e,s){super(e),this.code=s,this.name="DeckOpError"}code}function eC(t){return[...t.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function Yde(t){const s=new DOMParser().parseFromString(t,"text/html").querySelector("deck-viewer");return s?eC(s).length:null}function Jde(t,e){const s=new DOMParser().parseFromString(t,"text/html"),n=s.querySelector("deck-viewer");if(!n)throw new Ro("no <deck-viewer> element in source","no-viewer");const i=eC(n),r=e.kind==="move"?e.from:e.at,l=i[r];if(!l)throw new Ro(`slide index ${r} out of range (${i.length})`,"stale-index");switch(e.kind){case"remove":{if(i.length<=1)throw new Ro("cannot remove the last slide","bad-op");l.remove();break}case"duplicate":{const c=l.cloneNode(!0);c.removeAttribute("id");for(const d of c.querySelectorAll("[id]"))d.removeAttribute("id");l.after(c);break}case"move":{if(e.to<0||e.to>=i.length)throw new Ro(`move target ${e.to} out of range`,"stale-index");if(e.to!==e.from){const c=e.to<e.from?i[e.to]:i[e.to].nextSibling;n.insertBefore(l,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new Ro(`invalid attribute name: ${e.name}`,"bad-op");l.setAttribute(e.name,e.value);break}case"remove-attr":{l.removeAttribute(e.name);break}case"replace":{const d=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!d)throw new Ro("replace html has no root element","bad-op");l.replaceWith(s.importNode(d,!0));break}default:throw new Ro(`unknown op kind: ${e.kind}`,"bad-op")}return`${t.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
645
645
  `:""}${s.documentElement.outerHTML}
646
646
  `}const Jv="home",Qde=400,Xde=800;function Zde(t){const e=t.savePath!==void 0,{org:s}=Fe(),n=ps(),i=P8(Jv),[r,l]=P.useState(!1),[a,c]=P.useState(!1),[d,f]=P.useState(!1),[u,h]=P.useState(!1),[m,p]=P.useState(!1),[g,x]=P.useState(!1),[b,y]=P.useState(null),[L,v]=P.useState(null),[_,w]=P.useState(0),[S]=P.useState(()=>({iframe:null,source:null,queue:Promise.resolve(),saveTimer:null,selfMarkers:new Set})),k=r||g||m,j=()=>{t.savePath!==void 0&&(n.invalidateQueries({queryKey:Je.orgFsStat(s.id,Jv,t.savePath)}),n.invalidateQueries({queryKey:Je.orgFsRecent(s.id)}))},C=M=>{S.iframe?.contentWindow?.postMessage(M,"*")},T=()=>{S.source=null,h(!1),L&&y(L),w(M=>M+1),j()};t.statMarker!==L&&(v(t.statMarker),t.statMarker!==null&&(b===null?y(t.statMarker):S.selfMarkers.has(t.statMarker)||t.statMarker!==b&&(k?h(!0):(S.source=null,y(t.statMarker)))));const N=async()=>{S.saveTimer=null;const M=S.source;if(M===null){x(!1);return}p(!0);try{const $=await i.mutateAsync({path:t.savePath,body:M});S.selfMarkers.add(gg($)),j()}catch($){console.error("[deck-editor] save failed",$),xe.error("Couldn't save deck edits — reloading the preview."),I.current.reload()}finally{p(!1),x(!1)}},V=M=>{x(!0),S.saveTimer&&clearTimeout(S.saveTimer),S.saveTimer=setTimeout(()=>{I.current.flushSave()},M)},A=(M,$,F)=>{C({v:kc,type:"ack",opId:M,ok:$,error:F})},E=async M=>{if(!e){A(M.opId,!1,"read-only preview");return}try{if(S.source===null){const F=await fetch(t.readUrl,{credentials:"include"});if(!F.ok)throw new Error(`HTTP ${F.status}`);S.source=await F.text()}const $=Yde(S.source);if($===null||$!==M.witness.childCount)throw new Ro(`slide count drifted (source ${$}, iframe ${M.witness.childCount})`,"stale-index");S.source=Jde(S.source,M.op),A(M.opId,!0),V(M.op.kind==="replace"?Xde:Qde)}catch($){console.error("[deck-editor] op failed",M.op,$),A(M.opId,!1,$ instanceof Error?$.message:String($)),xe.error("That edit couldn't be saved — reloading the preview."),I.current.reload()}},R=M=>{if(!S.iframe||M.source!==S.iframe.contentWindow)return;const $=Gde(M.data);if($){if($.type==="ready"){c(!0),I.current.editMode?C({v:kc,type:"set-edit-mode",enabled:!0}):I.current.railOpen&&C({v:kc,type:"set-rail",open:!0});return}$.type==="op"&&(S.queue=S.queue.then(()=>I.current.handleOp($)).catch(()=>{}))}},I=P.useRef({onMessage:R,handleOp:E,flushSave:N,reload:T,editMode:r,railOpen:d});I.current={onMessage:R,handleOp:E,flushSave:N,reload:T,editMode:r,railOpen:d};const[D]=P.useState(()=>{let M=null;return $=>{if($){S.iframe=$;const F=U=>I.current.onMessage(U);window.addEventListener("message",F),M=()=>window.removeEventListener("message",F)}else M?.(),M=null,S.iframe=null}}),O=M=>{f(M),C({v:kc,type:"set-rail",open:M})},z=M=>{l(M),C({v:kc,type:"set-edit-mode",enabled:M}),M&&f(!0),!M&&u&&!g&&!m&&T()};return{iframeRef:D,deckDetected:a,writable:e,displayedMarker:b===null?null:`${b}.${_}`,editMode:r,setEditMode:z,railOpen:d,setRailOpen:O,saving:m,agentUpdated:u,reload:T,postToIframe:C}}const eue=300;function tC({readUrl:t,marker:e,title:s,savePath:n,trailing:i}){const r=Zde({readUrl:t,statMarker:e,savePath:n}),[l,a]=P.useState(null);if(r.displayedMarker===null)return null;const c=t.includes("?")?"&":"?",d=`${t}${c}v=${encodeURIComponent(r.displayedMarker)}`,f=l===d;return o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[o.jsx(qde,{readUrl:t,editor:r,downloadName:s.split("/").pop()??s,trailing:i}),o.jsx("div",{className:"relative flex-1",children:o.jsx("iframe",{ref:r.iframeRef,src:d,onLoad:()=>a(d),sandbox:"allow-scripts allow-downloads",className:ie("absolute inset-0 block h-full w-full bg-white","transition-opacity ease-out",f?"opacity-100":"opacity-0"),style:{transitionDuration:`${eue}ms`},title:s},d)})]})}const tue=[{mode:"private",labelKey:"library.fileShareButton.modeOrgOnly",Icon:Zu},{mode:"public",labelKey:"library.fileShareButton.modePublic",Icon:Mn},{mode:"password",labelKey:"library.fileShareButton.modePassword",Icon:_9}];function sC(t){const e=B.c(56),{volume:s,path:n,kind:i,shareMode:r,effectivePublic:l,url:a}=t,c=re(),d=vP(s),{data:f}=xg(s,n),u=f?.shareMode??r,m=(f?.effectivePublic??l)&&u==="private",p=i==="dir",g=p?"folder":"file",[x,b]=P.useState(!1),[y,L]=P.useState(""),[v,_]=P.useState(!1);let w;e[0]!==n||e[1]!==d||e[2]!==g||e[3]!==c?(w=(M,$)=>{d.mutate({path:n,mode:M,password:$},{onSuccess:()=>{b(!1),L(""),xe.success(M==="private"?c("library.fileShareButton.toastOrgOnly",{subject:g}):M==="public"?c("library.fileShareButton.toastPublic",{subject:g}):c("library.fileShareButton.toastPassword",{subject:g}))},onError:F=>xe.error(F instanceof Error?F.message:c("library.fileShareButton.failedUpdateSharing"))})},e[0]=n,e[1]=d,e[2]=g,e[3]=c,e[4]=w):w=e[4];const S=w;let k;e[5]!==S?(k=M=>{if(M==="password"){b(!0);return}b(!1),S(M)},e[5]=S,e[6]=k):k=e[6];const j=k,C=x?"password":u;let T;e[7]!==c||e[8]!==a?(T=async()=>{a&&(await navigator.clipboard.writeText(a),_(!0),xe.success(c("library.fileShareButton.linkCopied")),setTimeout(()=>_(!1),2e3))},e[7]=c,e[8]=a,e[9]=T):T=e[9];const N=T;let V;e[10]!==v||e[11]!==N||e[12]!==c||e[13]!==a?(V=a?o.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-input bg-muted/50 px-2 py-1.5",children:[o.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:a}),o.jsx(ue,{variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:N,"aria-label":c("library.fileShareButton.copyLink"),children:v?o.jsx(Ft,{size:12,className:"text-success"}):o.jsx(an,{size:12})})]}):null,e[10]=v,e[11]=N,e[12]=c,e[13]=a,e[14]=V):V=e[14];const A=V;if(m){let M;e[15]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx("div",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:o.jsx(Mn,{size:16})}),e[15]=M):M=e[15];let $;e[16]!==c?($=c("library.fileShareButton.sharedViaParent"),e[16]=c,e[17]=$):$=e[17];let F;e[18]!==$?(F=o.jsx("span",{className:"text-sm font-medium text-foreground",children:$}),e[18]=$,e[19]=F):F=e[19];const U=p?"files in this folder":"this file";let H;e[20]!==c||e[21]!==U?(H=c("library.fileShareButton.inheritedDescription",{target:U}),e[20]=c,e[21]=U,e[22]=H):H=e[22];let q;e[23]!==H?(q=o.jsx("span",{className:"text-xs text-muted-foreground",children:H}),e[23]=H,e[24]=q):q=e[24];let W;e[25]!==q||e[26]!==F?(W=o.jsxs("div",{className:"flex items-start gap-3",children:[M,o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[F,q]})]}),e[25]=q,e[26]=F,e[27]=W):W=e[27];let G;return e[28]!==A||e[29]!==W?(G=o.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[W,A]}),e[28]=A,e[29]=W,e[30]=G):G=e[30],G}let E;e[31]!==C||e[32]!==j||e[33]!==d.isPending||e[34]!==c?(E=tue.map(M=>{const{mode:$,labelKey:F,Icon:U}=M;return o.jsxs("button",{type:"button",disabled:d.isPending,onClick:()=>j($),className:ie("flex flex-col items-center gap-1 rounded-md px-2 py-2 text-xs font-medium transition-colors disabled:opacity-60",C===$?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(U,{size:15}),c(F)]},$)}),e[31]=C,e[32]=j,e[33]=d.isPending,e[34]=c,e[35]=E):E=e[35];let R;e[36]!==E?(R=o.jsx("div",{className:"grid grid-cols-3 gap-1 rounded-lg bg-muted p-1",children:E}),e[36]=E,e[37]=R):R=e[37];let I;e[38]!==C||e[39]!==p||e[40]!==c?(I=C==="private"?c("library.fileShareButton.privateDescription",{target:p?"these files":"this link"}):C==="public"?c(p?"library.fileShareButton.publicFolderDescription":"library.fileShareButton.publicFileDescription"):c("library.fileShareButton.passwordDescription",{target:p?"files in this folder":"this file"}),e[38]=C,e[39]=p,e[40]=c,e[41]=I):I=e[41];let D;e[42]!==I?(D=o.jsx("p",{className:"text-xs text-muted-foreground",children:I}),e[42]=I,e[43]=D):D=e[43];let O;e[44]!==C||e[45]!==S||e[46]!==u||e[47]!==y||e[48]!==d.isPending||e[49]!==c?(O=C==="password"&&o.jsxs("form",{className:"flex items-center gap-2",onSubmit:M=>{M.preventDefault(),y&&S("password",y)},children:[o.jsx(mt,{type:"password",value:y,onChange:M=>L(M.target.value),placeholder:c(u==="password"?"library.fileShareButton.newPasswordPlaceholder":"library.fileShareButton.passwordPlaceholder"),autoComplete:"new-password",className:"h-8 text-xs"}),o.jsx(ue,{type:"submit",size:"sm",className:"shrink-0",disabled:!y||d.isPending,children:c(u==="password"?"library.fileShareButton.buttonUpdate":"library.fileShareButton.buttonSet")})]}),e[44]=C,e[45]=S,e[46]=u,e[47]=y,e[48]=d.isPending,e[49]=c,e[50]=O):O=e[50];let z;return e[51]!==A||e[52]!==R||e[53]!==D||e[54]!==O?(z=o.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[R,D,O,A]}),e[51]=A,e[52]=R,e[53]=D,e[54]=O,e[55]=z):z=e[55],z}function Fp(t){const e=B.c(21),{volume:s,path:n,shareMode:i,effectivePublic:r,url:l}=t,a=re();let c;e[0]!==a?(c=a("library.fileShareButton.share"),e[0]=a,e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(jP,{size:14}),e[2]=d):d=e[2];let f;e[3]!==c?(f=o.jsx(Ke,{asChild:!0,children:o.jsx(ns,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon","aria-label":c,children:d})})}),e[3]=c,e[4]=f):f=e[4];let u;e[5]!==a?(u=a("library.fileShareButton.share"),e[5]=a,e[6]=u):u=e[6];let h;e[7]!==u?(h=o.jsx(We,{side:"bottom",children:u}),e[7]=u,e[8]=h):h=e[8];let m;e[9]!==f||e[10]!==h?(m=o.jsxs(qe,{children:[f,h]}),e[9]=f,e[10]=h,e[11]=m):m=e[11];let p;e[12]!==r||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==s?(p=o.jsx(is,{align:"end",className:"w-80 p-3",children:o.jsx(sC,{volume:s,path:n,kind:"file",shareMode:i,effectivePublic:r,url:l})}),e[12]=r,e[13]=n,e[14]=i,e[15]=l,e[16]=s,e[17]=p):p=e[17];let g;return e[18]!==m||e[19]!==p?(g=o.jsxs(rs,{children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20],g}function sue(t){const e=B.c(14),{target:s,onOpenChange:n}=t,i=re(),r=!!s,l=s?.kind==="dir"?"folder":"file";let a;e[0]!==i||e[1]!==l?(a=i("library.fileShareButton.shareDialogTitle",{type:l}),e[0]=i,e[1]=l,e[2]=a):a=e[2];let c;e[3]!==a?(c=o.jsx(hs,{children:o.jsx(Yt,{children:a})}),e[3]=a,e[4]=c):c=e[4];let d;e[5]!==s?(d=s&&o.jsx(sC,{...s}),e[5]=s,e[6]=d):d=e[6];let f;e[7]!==c||e[8]!==d?(f=o.jsxs(Ut,{className:"sm:max-w-md",children:[c,d]}),e[7]=c,e[8]=d,e[9]=f):f=e[9];let u;return e[10]!==n||e[11]!==r||e[12]!==f?(u=o.jsx(Ht,{open:r,onOpenChange:n,children:f}),e[10]=n,e[11]=r,e[12]=f,e[13]=u):u=e[13],u}const hm="home";function nue(t){const e=B.c(5),{label:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(At,{className:"aspect-video w-2/3 max-w-xl"}),e[0]=n):n=e[0];let i;e[1]!==s?(i=s&&o.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e[1]=s,e[2]=i):i=e[2];let r;return e[3]!==i?(r=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-background",children:[n,i]}),e[3]=i,e[4]=r):r=e[4],r}function iue(t){const e=B.c(15),{path:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={refetchIntervalWhenAbsent:2e3},e[0]=n):n=e[0];const i=xg(hm,s,n),r=pg(hm)(s);if(i.isPending||!i.data){const h=!i.isPending&&!i.data?"Waiting for the deck to sync…":void 0;let m;return e[1]!==h?(m=o.jsx(nue,{label:h}),e[1]=h,e[2]=m):m=e[2],m}let l;e[3]!==i.data?(l=gg(i.data),e[3]=i.data,e[4]=l):l=e[4];const a=i.data.shareMode??"private",c=i.data.effectivePublic??!1,d=window.location.origin+r;let f;e[5]!==s||e[6]!==a||e[7]!==c||e[8]!==d?(f=o.jsx(Fp,{volume:hm,path:s,shareMode:a,effectivePublic:c,url:d}),e[5]=s,e[6]=a,e[7]=c,e[8]=d,e[9]=f):f=e[9];let u;return e[10]!==s||e[11]!==r||e[12]!==l||e[13]!==f?(u=o.jsx(tC,{readUrl:r,marker:l,title:s,savePath:s,trailing:f}),e[10]=s,e[11]=r,e[12]=l,e[13]=f,e[14]=u):u=e[14],u}function rue(t){const e=B.c(13),{previewPath:s}=t,n=re(),i=Ws(),r=no({strict:!1}).org??"";let l;e[0]!==s?(l=s.split("/").slice(0,-1).join("/"),e[0]=s,e[1]=l):l=e[1];const a=l;let c;e[2]!==i||e[3]!==r||e[4]!==a||e[5]!==s?(c=()=>{i({to:Cc.library,params:{org:r},search:{path:a||void 0,preview:s}})},e[2]=i,e[3]=r,e[4]=a,e[5]=s,e[6]=c):c=e[6];const d=c;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Xo,{size:14}),e[7]=f):f=e[7];let u;e[8]!==n?(u=n("library.seeInLibrary.label"),e[8]=n,e[9]=u):u=e[9];let h;return e[10]!==d||e[11]!==u?(h=o.jsxs(ue,{variant:"ghost",size:"sm",onClick:d,className:"shrink-0 gap-1.5 text-xs text-muted-foreground",children:[f,u]}),e[10]=d,e[11]=u,e[12]=h):h=e[12],h}const oue=t=>/\.html?$/i.test(t);function Qv(t){const e=B.c(10),{onClose:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Ci,{size:14}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon",onClick:s,children:i})}),e[1]=s,e[2]=r):r=e[2];let l;e[3]!==n?(l=n("library.previewContent.close"),e[3]=n,e[4]=l):l=e[4];let a;e[5]!==l?(a=o.jsx(We,{side:"bottom",children:l}),e[5]=l,e[6]=a):a=e[6];let c;return e[7]!==r||e[8]!==a?(c=o.jsxs(qe,{children:[r,a]}),e[7]=r,e[8]=a,e[9]=c):c=e[9],c}function nC(t){const e=B.c(67),{previewPath:s,onClose:n,showSeeInLibrary:i,variant:r}=t,l=i===void 0?!1:i,a=re();let c;e[0]!==s?(c=kg(s),e[0]=s,e[1]=c):c=e[1];const d=c,{volume:f,dirPath:u}=d,{data:h,isPending:m}=xg(f,u),p=pg(f??"");let g,x,b,y,L,v,_,w,S;if(e[2]!==p||e[3]!==h||e[4]!==u||e[5]!==n||e[6]!==s||e[7]!==l||e[8]!==r||e[9]!==f){S=Symbol.for("react.early_return_sentinel");e:{x=rn(u),b=r==="dialog";let A;e[19]!==s||e[20]!==l?(A=l?o.jsx(rue,{previewPath:s}):null,e[19]=s,e[20]=l,e[21]=A):A=e[21];const E=A;if(g=h&&h.kind==="file"?{key:s,filename:x,size:h.size,downloadUrl:p(h.path)}:null,g&&h&&oue(x)){const I=g.downloadUrl;let D;e[22]!==h?(D=gg(h),e[22]=h,e[23]=D):D=e[23];const O=f??"",z=h.shareMode??"private",M=h.effectivePublic??!1,$=window.location.origin+g.downloadUrl;let F;e[24]!==u||e[25]!==O||e[26]!==z||e[27]!==M||e[28]!==$?(F=o.jsx(Fp,{volume:O,path:u,shareMode:z,effectivePublic:M,url:$}),e[24]=u,e[25]=O,e[26]=z,e[27]=M,e[28]=$,e[29]=F):F=e[29];let U;e[30]!==b||e[31]!==n?(U=b?o.jsx("div",{className:"w-8 shrink-0"}):o.jsx(Qv,{onClose:n}),e[30]=b,e[31]=n,e[32]=U):U=e[32];let H;e[33]!==E||e[34]!==F||e[35]!==U?(H=o.jsxs(o.Fragment,{children:[F,E,U]}),e[33]=E,e[34]=F,e[35]=U,e[36]=H):H=e[36],S=o.jsxs(o.Fragment,{children:[b&&o.jsx(Yt,{className:"sr-only",children:x}),o.jsx(tC,{readUrl:I,marker:D,title:x,savePath:f==="home"?u:void 0,trailing:H},s)]});break e}const R=b?"h-11 py-1 pr-12 pl-2":"h-9 px-2";e[37]!==R?(w=ie("flex shrink-0 items-center gap-1 border-b border-border/60",R),e[37]=R,e[38]=w):w=e[38],y="flex min-w-0 flex-1 items-center gap-2 px-2",L=o.jsx(Zo,{filename:x,className:"h-4.5 w-3.5 shrink-0"}),v=b?o.jsx(Yt,{className:"truncate text-xs font-medium text-foreground",children:x}):o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:x}),_=g&&o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:U8(g.size)})}e[2]=p,e[3]=h,e[4]=u,e[5]=n,e[6]=s,e[7]=l,e[8]=r,e[9]=f,e[10]=g,e[11]=x,e[12]=b,e[13]=y,e[14]=L,e[15]=v,e[16]=_,e[17]=w,e[18]=S}else g=e[10],x=e[11],b=e[12],y=e[13],L=e[14],v=e[15],_=e[16],w=e[17],S=e[18];if(S!==Symbol.for("react.early_return_sentinel"))return S;let k;e[39]!==y||e[40]!==L||e[41]!==v||e[42]!==_?(k=o.jsxs("div",{className:y,children:[L,v,_]}),e[39]=y,e[40]=L,e[41]=v,e[42]=_,e[43]=k):k=e[43];let j;e[44]!==h?.effectivePublic||e[45]!==h?.shareMode||e[46]!==g||e[47]!==u||e[48]!==a||e[49]!==f?(j=g&&o.jsxs(o.Fragment,{children:[o.jsx(Fp,{volume:f??"",path:u,shareMode:h?.shareMode??"private",effectivePublic:h?.effectivePublic??!1,url:window.location.origin+g.downloadUrl}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon",asChild:!0,children:o.jsx("a",{href:g.downloadUrl,download:g.filename,children:o.jsx(Eu,{size:14})})})}),o.jsx(We,{side:"bottom",children:a("library.previewContent.download")})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>window.open(g.downloadUrl,"_blank","noopener"),children:o.jsx(hn,{size:14})})}),o.jsx(We,{side:"bottom",children:a("library.previewContent.openInNewTab")})]})]}),e[44]=h?.effectivePublic,e[45]=h?.shareMode,e[46]=g,e[47]=u,e[48]=a,e[49]=f,e[50]=j):j=e[50];let C;e[51]!==b||e[52]!==n?(C=!b&&o.jsx(Qv,{onClose:n}),e[51]=b,e[52]=n,e[53]=C):C=e[53];let T;e[54]!==j||e[55]!==C||e[56]!==w||e[57]!==k?(T=o.jsxs("div",{className:w,children:[k,j,C]}),e[54]=j,e[55]=C,e[56]=w,e[57]=k,e[58]=T):T=e[58];let N;e[59]!==g||e[60]!==x||e[61]!==m||e[62]!==a?(N=o.jsx("div",{className:"relative min-h-0 flex-1 bg-background",children:g?o.jsx(F8,{file:g}):m?o.jsx(z8,{}):o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[o.jsx(Zo,{filename:x,className:"h-7.5 w-6"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:a("library.previewContent.fileNotAvailable")})]})}),e[59]=g,e[60]=x,e[61]=m,e[62]=a,e[63]=N):N=e[63];let V;return e[64]!==T||e[65]!==N?(V=o.jsxs(o.Fragment,{children:[T,N]}),e[64]=T,e[65]=N,e[66]=V):V=e[66],V}function lue(t){const e=B.c(4),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,r=i===void 0?!1:i;let l;return e[0]!==n||e[1]!==s||e[2]!==r?(l=o.jsx("div",{className:"flex h-full w-full flex-col bg-background",children:o.jsx(nC,{previewPath:s,onClose:n,showSeeInLibrary:r,variant:"panel"})}),e[0]=n,e[1]=s,e[2]=r,e[3]=l):l=e[3],l}function aue(t){const e=B.c(5),{path:s}=t,{closePanel:n}=hi();let i;e[0]!==n?(i=()=>n(),e[0]=n,e[1]=i):i=e[1];const r=i;let l;return e[2]!==r||e[3]!==s?(l=o.jsx(lue,{previewPath:s,onClose:r,showSeeInLibrary:!0}),e[2]=r,e[3]=s,e[4]=l):l=e[4],l}function cue(t){const e=t("library.brandComponentsPreview.title"),s=t("library.brandComponentsPreview.subtitle"),n=t("library.brandComponentsPreview.monthlySavingsLabel"),i=t("library.brandComponentsPreview.primaryButton"),r=t("library.brandComponentsPreview.secondaryButton"),l=t("library.brandComponentsPreview.ghostButton"),a=t("library.brandComponentsPreview.successBadge"),c=t("library.brandComponentsPreview.warningBadge"),d=t("library.brandComponentsPreview.errorBadge"),f=t("library.brandComponentsPreview.infoBadge"),u=t("library.brandComponentsPreview.allChip"),h=t("library.brandComponentsPreview.incomeChip"),m=t("library.brandComponentsPreview.spendingChip"),p=t("library.brandComponentsPreview.emailPlaceholder");return`
647
647
  <div class="stack">
@@ -803,7 +803,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
803
803
  <p class="cta">slides-create --theme &hellip;</p>
804
804
  </section>`].join(`
805
805
 
806
- `);function pue(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",mue).replaceAll("{{title}}",hue).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function gue(t){const e=B.c(8),{readUrl:s,title:n,tokensUrl:i}=t,r=Pu(s),l=Pu(i??"");if(r.isPending||i&&l.isPending){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:o.jsx(At,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=f):f=e[0],f}if(r.isError||!r.data){let f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[1]=f):f=e[1],f}const a=l.data??null;let c;e[2]!==a||e[3]!==r.data?(c=pue(r.data,a),e[2]=a,e[3]=r.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=o.jsx("iframe",{title:n,srcDoc:c,sandbox:"allow-scripts",className:"block h-full w-full border-0 bg-white"}),e[5]=c,e[6]=n,e[7]=d):d=e[7],d}function iu(t){const e=B.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function xue(t){const e=B.c(16),{family:s,tokens:n,editing:i,valueOf:r,onEdit:l}=t;let a;e[0]!==s?(a=o.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==r){let u;e[7]!==i||e[8]!==l||e[9]!==r?(u=h=>{const m=r(h),p=`${h.name.replace(/^--brand-/,"")}: ${m}`;return i&&/^#/.test(m)?o.jsx("input",{type:"color","aria-label":h.name,title:p,value:HE(m),onChange:g=>l(h.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},h.name):o.jsx("span",{title:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},h.name)},e[7]=i,e[8]=l,e[9]=r,e[10]=u):u=e[10],c=n.map(u),e[2]=i,e[3]=l,e[4]=n,e[5]=r,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-wrap gap-1",children:c}),e[11]=c,e[12]=d):d=e[12];let f;return e[13]!==a||e[14]!==d?(f=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=f):f=e[15],f}function bue(t){const e=B.c(9),{token:s,value:n}=t;if(s.kind==="space"){let r;return e[0]!==n?(r=o.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:o.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=r):r=e[1],r}if(s.kind==="radius"){let r;return e[2]!==n?(r=o.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=r):r=e[3],r}if(s.kind==="shadow"){let r;return e[4]!==n?(r=o.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=r):r=e[5],r}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const r=`min(${n}, 22px)`;let l;return e[6]!==r?(l=o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:r},children:"Ag"}),e[6]=r,e[7]=l):l=e[7],l}let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("span",{className:"size-7 shrink-0"}),e[8]=i):i=e[8],i}function iC(t){const e=B.c(17),{token:s,value:n,editing:i,onEdit:r}=t;let l;e[0]!==s||e[1]!==n?(l=o.jsx(bue,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=l):l=e[2];let a;if(e[3]!==s.name){let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=/^--brand-/,e[5]=u):u=e[5],a=s.name.replace(u,""),e[3]=s.name,e[4]=a}else a=e[4];let c;e[6]!==a?(c=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:a}),e[6]=a,e[7]=c):c=e[7];let d;e[8]!==i||e[9]!==r||e[10]!==s.name||e[11]!==n?(d=i?o.jsx(mt,{value:n,onChange:u=>r(s.name,u.target.value),className:"h-8 w-40 font-mono text-xs"}):o.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=r,e[10]=s.name,e[11]=n,e[12]=d):d=e[12];let f;return e[13]!==l||e[14]!==c||e[15]!==d?(f=o.jsxs("div",{className:"flex items-center gap-3",children:[l,c,d]}),e[13]=l,e[14]=c,e[15]=d,e[16]=f):f=e[16],f}function Ud(t){const e=B.c(16),{label:s,tokens:n,editing:i,valueOf:r,onEdit:l}=t;if(n.length===0)return null;let a;e[0]!==s?(a=o.jsx(iu,{children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==r){let u;e[7]!==i||e[8]!==l||e[9]!==r?(u=h=>o.jsx(iC,{token:h,value:r(h),editing:i,onEdit:l},h.name),e[7]=i,e[8]=l,e[9]=r,e[10]=u):u=e[10],c=n.map(u),e[2]=i,e[3]=l,e[4]=n,e[5]=r,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-col gap-2.5",children:c}),e[11]=c,e[12]=d):d=e[12];let f;return e[13]!==a||e[14]!==d?(f=o.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=f):f=e[15],f}function vue({brandPath:t,onClose:e,variant:s}){const n=re(),{org:i}=Fe(),r=kg(t),l=r.volume??"",a=r.dirPath,c=rn(a),d=r.readOnly,f=ps(),u=o0(),h=P8(l),{upload:m,remove:p}=Au(l),g=P.useRef(null),x=E8(l,a),b=x.data??[],y=te=>b.some(ge=>ge.kind==="file"&&rn(ge.path)===te),L=y("tokens.css"),v=y("brand.md"),_=y("slides-theme.html"),w=BE(b),S=u(l,`${a}/tokens.css`),k=u(l,`${a}/brand.md`),j=u(l,`${a}/slides-theme.html`),C=Pu(S,{enabled:L}),T=Pu(k,{enabled:v}),[N,V]=P.useState(!1),[A,E]=P.useState({}),[R,I]=P.useState(null),[D,O]=P.useState(!1),[z,M]=P.useState(!1),[$,F]=P.useState("deck"),U=C.data?zE(C.data):[],H=te=>U.find(ge=>ge.name===te)?.value,q=te=>A[te.name]??te.value,W=FE(U),G=U.filter(te=>te.kind==="font"),Y=U.filter(te=>te.kind==="type"),J=U.filter(te=>te.kind==="space"),se=U.filter(te=>te.kind==="radius"),oe=U.filter(te=>te.kind==="shadow"),ne=U.filter(te=>te.kind==="motion"),Q=U.filter(te=>te.kind==="other"),K=(te,ge)=>E(ve=>({...ve,[te]:ge})),X=_&&$==="deck",Z=R??T.data??"",le=Object.entries(A).filter(([te,ge])=>H(te)!==ge),ee=R!==null&&R!==(T.data??""),ae=le.length>0||ee;function ce(){E({}),I(null),V(!1)}async function fe(){O(!0);try{if(le.length>0){let te=C.data??"";for(const[ge,ve]of le)te=UE(te,ge,ve);await h.mutateAsync({path:`${a}/tokens.css`,body:te,contentType:"text/css; charset=utf-8"}),f.invalidateQueries({queryKey:Je.fileText(S)})}ee&&R!==null&&(await h.mutateAsync({path:`${a}/brand.md`,body:R,contentType:"text/markdown; charset=utf-8"}),f.invalidateQueries({queryKey:Je.fileText(k)})),f.invalidateQueries({queryKey:Je.orgFsVolume(i.id,l)}),f.invalidateQueries({queryKey:Je.orgFsRecent(i.id)}),E({}),I(null),V(!1),xe.success(n("library.brandPreview.brandSaved"))}catch(te){xe.error(te instanceof Error?te.message:n("library.brandPreview.failedSaveBrand"))}finally{O(!1)}}async function de(te){const ge=te?.[0];if(!ge)return;const Se=`logo.${(ge.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([ge],Se,{type:ge.type})]}),w&&rn(w)!==Se&&await p.mutateAsync(w),xe.success(n("library.brandPreview.logoUpdated"))}catch(ye){xe.error(ye instanceof Error?ye.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const pe=!x.isPending&&!L&&!v&&!w;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:o.jsx(qm,{size:18})}),s==="dialog"?o.jsx(Yt,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):o.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(N?o.jsxs(o.Fragment,{children:[o.jsx(ue,{variant:"ghost",size:"sm",onClick:ce,disabled:D,children:n("library.brandPreview.cancel")}),o.jsx(ue,{size:"sm",disabled:!ae||D,onClick:()=>{fe()},children:n(D?"library.brandPreview.saving":"library.brandPreview.save")})]}):o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>V(!0),children:[o.jsx(UA,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?o.jsx(EV,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:o.jsx(Ds,{size:16})})}):o.jsx(ue,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:o.jsx(Ds,{size:16})})]}),o.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?o.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[o.jsx(At,{className:"h-40 w-full rounded-xl"}),o.jsx(At,{className:"h-4 w-1/3"}),o.jsx(At,{className:"h-4 w-2/3"})]}):pe?o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):o.jsxs(o.Fragment,{children:[(_||L)&&o.jsxs("div",{className:"shrink-0 border-b border-border",children:[o.jsxs("div",{role:"button",tabIndex:0,"aria-label":n(z?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(te=>!te),onKeyDown:te=>{(te.key==="Enter"||te.key===" ")&&(te.preventDefault(),M(ge=>!ge))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:te=>te.stopPropagation(),children:[_&&o.jsx("button",{type:"button",onClick:()=>{F("deck"),M(!1)},className:ie("rounded-md px-2.5 py-1",X?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),o.jsx("button",{type:"button",onClick:()=>{F("components"),M(!1)},className:ie("rounded-md px-2.5 py-1",X?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),z?o.jsx(Qt,{size:16,className:"shrink-0 text-muted-foreground"}):o.jsx(p7,{size:16,className:"shrink-0 text-muted-foreground"})]}),!z&&o.jsx("div",{className:"px-4 pb-4",children:o.jsx("div",{className:ie("w-full overflow-hidden rounded-xl border border-border bg-muted/30",X?"aspect-[16/9]":"h-96"),children:X?o.jsx(gue,{readUrl:j,title:`${c} deck theme`,tokensUrl:S}):o.jsx(fue,{tokensUrl:S})})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(iu,{children:n("library.brandPreview.logo")}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:w?o.jsx("img",{src:u(l,w),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):o.jsx(qm,{size:28,className:"text-muted-foreground/50"})}),N&&o.jsxs("div",{children:[o.jsxs(ue,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[o.jsx(Gn,{size:14}),n(w?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),o.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:te=>{de(te.target.files)}})]})]})]}),W.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(iu,{children:n("library.brandPreview.colors")}),W.map(te=>o.jsx(xue,{family:te.family,tokens:te.tokens,editing:N,valueOf:q,onEdit:K},te.family))]}),(G.length>0||Y.length>0)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(iu,{children:n("library.brandPreview.typography")}),G.map(te=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:te.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),N?o.jsx(mt,{value:q(te),onChange:ge=>K(te.name,ge.target.value),className:"h-9"}):o.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:q(te)},children:q(te)})]},te.name)),Y.map(te=>o.jsx(iC,{token:te,value:q(te),editing:N,onEdit:K},te.name))]}),o.jsx(Ud,{label:n("library.brandPreview.spacing"),tokens:J,editing:N,valueOf:q,onEdit:K}),o.jsx(Ud,{label:n("library.brandPreview.radius"),tokens:se,editing:N,valueOf:q,onEdit:K}),o.jsx(Ud,{label:n("library.brandPreview.shadows"),tokens:oe,editing:N,valueOf:q,onEdit:K}),o.jsx(Ud,{label:n("library.brandPreview.motion"),tokens:ne,editing:N,valueOf:q,onEdit:K}),o.jsx(Ud,{label:n("library.brandPreview.tokens"),tokens:Q,editing:N,valueOf:q,onEdit:K}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(iu,{children:n("library.brandPreview.voiceGuidelines")}),N?o.jsx(Xr,{value:Z,onChange:te=>I(te.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):T.isPending&&v?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(At,{className:"h-3 w-full"}),o.jsx(At,{className:"h-3 w-5/6"})]}):Z.trim()?o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:o.jsx(ud,{id:`brand-preview-${t}`,text:Z})}):o.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function rC(t){const e=B.c(8),{brandPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let r;e[2]!==s||e[3]!==n?(r=o.jsx(Ut,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:o.jsx(vue,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=r):r=e[4];let l;return e[5]!==i||e[6]!==r?(l=o.jsx(Ht,{open:!0,onOpenChange:i,children:r}),e[5]=i,e[6]=r,e[7]=l):l=e[7],l}function oC(t){const e=B.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,r=i===void 0?!1:i;let l;e[0]!==n?(l=d=>{d||n()},e[0]=n,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==s||e[4]!==r?(a=o.jsx(Ut,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:o.jsx(nC,{previewPath:s,onClose:n,showSeeInLibrary:r,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=r,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=o.jsx(Ht,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function yue(t){const e=B.c(11),{onOpenDir:s}=t,n=re(),i=OE();let r;e[0]!==i.data?(r=i.data??[],e[0]=i.data,e[1]=r):r=e[1];let l;if(e[2]!==s||e[3]!==n||e[4]!==r){let c;e[6]!==s||e[7]!==n?(c=d=>o.jsx(h0,{name:d.volume,glyph:jn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:g7(d.lastSyncedAt)}):n("library.syncedRepos.waitingFirstSync"),onOpen:()=>s(d.volume)},d.id),e[6]=s,e[7]=n,e[8]=c):c=e[8],l=r.map(c),e[2]=s,e[3]=n,e[4]=r,e[5]=l}else l=e[5];let a;return e[9]!==l?(a=o.jsx(o.Fragment,{children:l}),e[9]=l,e[10]=a):a=e[10],a}function Mx(t){return`${window.location.origin}${t}`}function Su(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const _ue=[Ru,"uploads","outputs"],lC=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Gn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Wr}],Up=new Set([...lC.map(t=>t.volume),qc("public")]),Lue=6;function aC(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=W8(t),r=i?`public/${i}`:t==="home"?Du(s):t;return n?`${r}/${n}`:r}function kf(t,e,s){return{onDragStart:n=>{s.onDragStart?.(t),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("application/x-studio-library-path",t)},onContextMenu:n=>{n.preventDefault(),s.onContextMenu?.(t,e)},onDrop:s.onDrop?n=>{n.preventDefault();const i=n.dataTransfer.getData("application/x-studio-library-path");i&&i!==t&&!t.startsWith(i+"/")&&s.onDrop(i,t)}:void 0}}function Oo(t){const e=B.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Fr(t){const e=B.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"@container",children:o.jsx("div",{className:"grid grid-cols-1 gap-3 @[440px]:grid-cols-2 @[660px]:grid-cols-3",children:s})}),e[0]=s,e[1]=n):n=e[1],n}function a1(t){const e=B.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=o.jsx(Fr,{children:Array.from({length:n*3},wue)}),e[0]=n,e[1]=i):i=e[1],i}function wue(t,e){return o.jsx(At,{className:"h-16 rounded-2xl"},e)}function Ox(t){const e=B.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Sue(t){const e=B.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:r}=t,l=re(),a=_P(s);let c;e[0]!==l||e[1]!==a.data?(c=a.data?l("library.libraryViews.filesCount",{count:a.data.files}):void 0,e[0]=l,e[1]=a.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==l?(d=l(n),e[3]=n,e[4]=l,e[5]=d):d=e[5];let f;return e[6]!==i||e[7]!==r||e[8]!==c||e[9]!==d||e[10]!==s?(f=o.jsx(h0,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:r}),e[6]=i,e[7]=r,e[8]=c,e[9]=d,e[10]=s,e[11]=f):f=e[11],f}function kue(t){const e=B.c(12),{onOpenDir:s}=t,n=re(),r=R8().data?.length??0;let l;e[0]!==s?(l=lC.map(f=>o.jsx(Sue,{volume:f.volume,descriptionKey:f.descriptionKey,glyph:f.glyph,onOpen:()=>s(f.volume)},f.volume)),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==r||e[4]!==n?(a=r>0&&o.jsx(h0,{name:qc("public"),meta:n("library.libraryViews.skillSetsCount",{count:r}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:mr,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=r,e[4]=n,e[5]=a):a=e[5];let c;e[6]!==s?(c=o.jsx(yue,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d=o.jsxs(o.Fragment,{children:[l,a,c]}),e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function jue(t){const e=B.c(19),{segments:s,onNavigate:n}=t,{org:i}=Fe();let r;e[0]!==s?(r=s[0]===Ru?s.slice(1):s,e[0]=s,e[1]=r):r=e[1];const l=r,a=s.length-l.length,c=l.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==i.slug?(d=c?o.jsx("span",{className:"truncate font-medium text-foreground",children:Du(i.slug)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(Ru),children:Du(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let f;if(e[6]!==a||e[7]!==n||e[8]!==l||e[9]!==s){let h;e[11]!==a||e[12]!==n||e[13]!==l.length||e[14]!==s?(h=(m,p)=>{const g=s.slice(0,a+p+1).join("/"),x=p===l.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx(en,{size:12,className:"shrink-0 text-muted-foreground"}),x?o.jsx("span",{className:"truncate font-medium text-foreground",children:qc(m)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:qc(m)})]},g)},e[11]=a,e[12]=n,e[13]=l.length,e[14]=s,e[15]=h):h=e[15],f=l.map(h),e[6]=a,e[7]=n,e[8]=l,e[9]=s,e[10]=f}else f=e[10];let u;return e[16]!==d||e[17]!==f?(u=o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,f]}),e[16]=d,e[17]=f,e[18]=u):u=e[18],u}function Cue(t){const e=B.c(43),{query:s,scope:n,stale:i,onOpenFile:r,onShare:l,onDelete:a}=t,c=re(),{org:d}=Fe(),f=o0(),u=yP(s,n);let h;e[0]!==f||e[1]!==l?(h=S=>l({volume:S.volume,path:S.path,kind:"file",shareMode:S.shareMode??"private",effectivePublic:S.effectivePublic??!1,url:Mx(f(S.volume,S.path))}),e[0]=f,e[1]=l,e[2]=h):h=e[2];const m=h;if(u.isPending){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(a1,{rows:2}),e[3]=S):S=e[3],S}let p,g,x,b,y;if(e[4]!==s||e[5]!==u.data||e[6]!==u.isPlaceholderData||e[7]!==i||e[8]!==c){y=Symbol.for("react.early_return_sentinel");e:{if(g=u.data??[],g.length===0){let k;e[14]!==s||e[15]!==c?(k=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=k):k=e[16];let j;e[17]!==k?(j=o.jsx(Ox,{children:k}),e[17]=k,e[18]=j):j=e[18],y=j;break e}const S=(i||u.isPlaceholderData)&&"opacity-50";e[19]!==S?(b=ie("flex flex-col gap-3",S),e[19]=S,e[20]=b):b=e[20],p=Oo,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=u.data,e[6]=u.isPlaceholderData,e[7]=i,e[8]=c,e[9]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=y}else p=e[9],g=e[10],x=e[11],b=e[12],y=e[13];if(y!==Symbol.for("react.early_return_sentinel"))return y;let L;e[21]!==p||e[22]!==x?(L=o.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=L):L=e[23];let v;if(e[24]!==f||e[25]!==a||e[26]!==r||e[27]!==d||e[28]!==g||e[29]!==m){let S;e[31]!==f||e[32]!==a||e[33]!==r||e[34]!==d||e[35]!==m?(S=k=>{const j=W8(k.volume)!==null;return o.jsx(x7,{filename:rn(k.path),updatedAt:k.updatedAt,downloadUrl:f(k.volume,k.path),subtitle:aC(k.volume,k.path,d.slug),publicState:Su(k),onOpen:()=>r(q8(k.volume,k.path)),onShare:j?void 0:()=>m(k),onDelete:j?void 0:()=>a({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[31]=f,e[32]=a,e[33]=r,e[34]=d,e[35]=m,e[36]=S):S=e[36],v=g.map(S),e[24]=f,e[25]=a,e[26]=r,e[27]=d,e[28]=g,e[29]=m,e[30]=v}else v=e[30];let _;e[37]!==v?(_=o.jsx(Fr,{children:v}),e[37]=v,e[38]=_):_=e[38];let w;return e[39]!==b||e[40]!==L||e[41]!==_?(w=o.jsxs("div",{className:b,children:[L,_]}),e[39]=b,e[40]=L,e[41]=_,e[42]=w):w=e[42],w}function Nue(t){const e=B.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,r=re(),{org:l}=Fe(),a=A8(),c=o0();let d;e[0]!==c||e[1]!==n?(d=y=>n({volume:y.volume,path:y.path,kind:"file",shareMode:y.shareMode??"private",effectivePublic:y.effectivePublic??!1,url:Mx(c(y.volume,y.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const f=d;if(a.isPending){let y;e[3]!==r?(y=r("library.libraryViews.recentlyAdded"),e[3]=r,e[4]=y):y=e[4];let L;e[5]!==y?(L=o.jsx(Oo,{children:y}),e[5]=y,e[6]=L):L=e[6];let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(a1,{}),e[7]=v):v=e[7];let _;return e[8]!==L?(_=o.jsxs("div",{className:"flex flex-col gap-3",children:[L,v]}),e[8]=L,e[9]=_):_=e[9],_}let u,h,m,p,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==f||e[16]!==r){g=Symbol.for("react.early_return_sentinel");e:{const y=(a.data??[]).slice(0,Lue);if(y.length===0){g=null;break e}m="flex flex-col gap-3";let L;e[22]!==r?(L=r("library.libraryViews.recentlyAdded"),e[22]=r,e[23]=L):L=e[23],e[24]!==L?(p=o.jsx(Oo,{children:L}),e[24]=L,e[25]=p):p=e[25],u=Fr;let v;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==f?(v=_=>o.jsx(qE,{filename:rn(_.path),updatedAt:_.updatedAt,size:_.size,downloadUrl:c(_.volume,_.path),subtitle:aC(_.volume,_.path,l.slug),publicState:Su(_),onOpen:()=>s(q8(_.volume,_.path)),onShare:()=>f(_),onDelete:()=>i({volume:_.volume,path:_.path,kind:"file"})},`${_.volume}/${_.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=f,e[31]=v):v=e[31],h=y.map(v)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=f,e[16]=r,e[17]=u,e[18]=h,e[19]=m,e[20]=p,e[21]=g}else u=e[17],h=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==u||e[33]!==h?(x=o.jsx(u,{children:h}),e[32]=u,e[33]=h,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=o.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function Tue(t){const e=B.c(16),{onOpenDir:s}=t,n=re(),i=R8();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(a1,{}),e[0]=d):d=e[0],d}let r;e[1]!==i.data?(r=i.data??[],e[1]=i.data,e[2]=r):r=e[2];const l=r;if(l.length===0){let d;e[3]!==n?(d=n("library.libraryViews.noPublicSkillSetsConfigured"),e[3]=n,e[4]=d):d=e[4];let f;return e[5]!==d?(f=o.jsx(Ox,{children:d}),e[5]=d,e[6]=f):f=e[6],f}let a;if(e[7]!==s||e[8]!==l||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=f=>o.jsx(h0,{name:f,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${f}`)},f),e[11]=s,e[12]=n,e[13]=d):d=e[13],a=l.map(d),e[7]=s,e[8]=l,e[9]=n,e[10]=a}else a=e[10];let c;return e[14]!==a?(c=o.jsx(Fr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function Vue(t){const e=B.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:r,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:f,onMove:u}=t,h=re(),{org:m}=Fe(),p=s.volume??"",g=E8(p,s.dirPath),x=o0();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=N=>s.isHomeRoot&&Up.has(N.toLowerCase())?`${Du(m.slug)}/${N}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const y=b;let L;e[3]!==s.isHomeRoot||e[4]!==n?(L=s.isHomeRoot?o.jsx(kue,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=L):L=e[5];const v=L;if(g.isPending){let N;e[6]!==v||e[7]!==h?(N=v&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Oo,{children:h("library.libraryViews.folders")}),o.jsx(Fr,{children:v})]}),e[6]=v,e[7]=h,e[8]=N):N=e[8];let V;e[9]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(a1,{rows:2}),e[9]=V):V=e[9];let A;return e[10]!==N?(A=o.jsxs(o.Fragment,{children:[N,V]}),e[10]=N,e[11]=A):A=e[11],A}if(g.isError){let N;e[12]!==g.error||e[13]!==h?(N=g.error instanceof Error?g.error.message:h("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=h,e[14]=N):N=e[14];let V;return e[15]!==N?(V=o.jsx("p",{className:"text-sm text-destructive",children:N}),e[15]=N,e[16]=V):V=e[16],V}let _,w,S,k,j;if(e[17]!==y||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==f||e[22]!==c||e[23]!==d||e[24]!==u||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==r||e[29]!==a||e[30]!==v||e[31]!==h||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const N=g.data??[],V=N.filter(Rue),A=N.filter(Eue),E=N.filter(Pue),R=N.filter(Aue);if(N.length===0&&!s.isHomeRoot){let M;e[38]!==s.readOnly||e[39]!==h?(M=s.readOnly?h("library.libraryViews.emptyReadOnlySet"):h("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=h,e[40]=M):M=e[40];let $;e[41]!==M?($=o.jsx(Ox,{children:M}),e[41]=M,e[42]=$):$=e[42],j=$;break e}let I;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(I=M=>s.readOnly?void 0:()=>c({volume:p,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=I):I=e[46];const D=I;let O;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?(O=M=>s.readOnly?void 0:()=>a({volume:p,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?Mx(x(p,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=O):O=e[51];const z=O;_=V.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Oo,{children:h("library.libraryViews.skills")}),o.jsx(Fr,{children:V.map(M=>o.jsx(KE,{dirName:rn(M.path),updatedAt:M.updatedAt,skillMdUrl:x(p,`${M.path}/SKILL.md`),publicState:Su(M),onOpen:()=>r(mc(s,M.path)),onBrowse:()=>n(mc(s,M.path)),onShare:z(M),onDelete:D(M),draggable:!s.readOnly,...kf(M.path,"dir",{onDragStart:d,onContextMenu:f})},M.path))})]}),w=A.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Oo,{children:h("library.libraryViews.brands")}),o.jsx(Fr,{children:A.map(M=>o.jsx(WE,{dirName:rn(M.path),updatedAt:M.updatedAt,tokensUrl:x(p,`${M.path}/tokens.css`),onOpen:()=>l(mc(s,M.path)),onBrowse:()=>n(mc(s,M.path)),onDelete:D(M),draggable:!s.readOnly,...kf(M.path,"dir",{onDragStart:d,onContextMenu:f})},M.path))})]}),S=(E.length>0||v)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Oo,{children:h("library.libraryViews.folders")}),o.jsxs(Fr,{children:[v,E.map(M=>o.jsx(h0,{name:rn(M.path),meta:g7(M.updatedAt),subtitle:y(rn(M.path)),readOnly:s.readOnly,publicState:Su(M),onOpen:()=>n(mc(s,M.path)),onShare:z(M),onDelete:D(M),draggable:!s.readOnly,...kf(M.path,"dir",{onDragStart:d,onContextMenu:f,onDrop:u})},M.path))]})]}),k=R.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Oo,{children:h("library.libraryViews.files")}),o.jsx(Fr,{children:R.map(M=>o.jsx(x7,{filename:rn(M.path),updatedAt:M.updatedAt,downloadUrl:x(p,M.path),publicState:Su(M),onOpen:()=>i(mc(s,M.path)),onShare:z(M),onDelete:D(M),draggable:!s.readOnly,...kf(M.path,"file",{onDragStart:d,onContextMenu:f})},M.path))})]})}e[17]=y,e[18]=x,e[19]=g.data,e[20]=s,e[21]=f,e[22]=c,e[23]=d,e[24]=u,e[25]=l,e[26]=n,e[27]=i,e[28]=r,e[29]=a,e[30]=v,e[31]=h,e[32]=p,e[33]=_,e[34]=w,e[35]=S,e[36]=k,e[37]=j}else _=e[33],w=e[34],S=e[35],k=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let C;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==a?(C=s.isHomeRoot&&o.jsx(Nue,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=C):C=e[56];let T;return e[57]!==_||e[58]!==w||e[59]!==S||e[60]!==k||e[61]!==C?(T=o.jsxs(o.Fragment,{children:[_,w,S,k,C]}),e[57]=_,e[58]=w,e[59]=S,e[60]=k,e[61]=C,e[62]=T):T=e[62],T}function Aue(t){return t.kind==="file"}function Pue(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function Eue(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function Rue(t){return t.kind==="dir"&&t.hasSkill}function Due({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=re(),{org:i}=Fe(),r=ps(),l=Ws(),a=fl(),c=hl({strict:!1}),d=c.path||Ru,f=kg(d),u=$E(),h=f.volume!==null&&u.has(f.volume)?{...f,readOnly:!0}:f,m=(te,ge)=>l({to:".",search:ve=>({...ve,[te]:ge||void 0})}),p=te=>m("path",te),g=(te,ge)=>l({to:".",search:ve=>({...ve,preview:void 0,skill:void 0,brand:void 0,[te]:ge})}),x=t??(te=>g("preview",te)),b=e??(te=>g("skill",te)),y=s??(te=>g("brand",te)),[L,v]=P.useState(""),_=j9(L.trim(),300),w=!h.isHomeRoot&&h.volume!==null?{volume:h.volume,prefix:h.dirPath}:void 0,S=w?n("library.library.searchInPlaceholder",{folder:qc(h.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),k=h.isHomeRoot?Du(i.slug):qc(h.segments.at(-1)??""),[j,C]=P.useState(null),[T,N]=P.useState(null),[V,A]=P.useState(!1),[E,R]=P.useState(""),[I,D]=P.useState(!1),[O,z]=P.useState(null),[M,$]=P.useState(""),F=P.useRef(null),[U,H]=P.useState(!1),q=P.useRef(0),W=h.readOnly?null:h.volume,{upload:G,mkdir:Y,move:J}=Au(W??Ru),{remove:se}=Au(j?.volume??"uploads");async function oe(te){if(!(!W||!te||te.length===0))try{await G.mutateAsync({dir:h.dirPath,files:[...te]}),xe.success(te.length===1?n("library.library.uploadedSingle",{filename:te[0]?.name??""}):n("library.library.uploadedMultiple",{count:te.length}))}catch(ge){xe.error(ge instanceof Error?ge.message:n("library.library.uploadFailed"))}finally{F.current&&(F.current.value="")}}const ne=W!==null;function Q(te){return te.dataTransfer.types.includes("Files")}function K(te){!ne||!Q(te)||(te.preventDefault(),q.current+=1,H(!0))}function X(te){!ne||!Q(te)||te.preventDefault()}function Z(){ne&&(q.current=Math.max(0,q.current-1),q.current===0&&H(!1))}function le(te){ne&&(te.preventDefault(),te.stopPropagation(),q.current=0,H(!1),te.dataTransfer.files.length>0&&oe(te.dataTransfer.files))}async function ee(){const te=E.trim();if(!(!W||!te)){if(h.isHomeRoot&&Up.has(te.toLowerCase())){xe.error(n("library.library.folderNameReserved",{name:te}));return}try{const ge=h.dirPath;await Y.mutateAsync(ge?`${ge}/${te}`:te),xe.success(n("library.library.folderCreated",{name:te})),A(!1),R("")}catch(ge){xe.error(ge instanceof Error?ge.message:n("library.library.folderCreateFailed"))}}}async function ae(){if(!j)return;const te=j;try{await se.mutateAsync(te.path),xe.success(n("library.library.deleted",{name:rn(te.path)}))}catch(ge){xe.error(ge instanceof Error?ge.message:n("library.library.deleteFailed"))}finally{C(null)}}async function ce(){if(!O)return;const te=M.trim();if(!te||te.includes("/")||te.includes("..")||te===rn(O.path)){D(!1),z(null),$("");return}if(O.kind==="dir"&&h.isHomeRoot&&Up.has(te.toLowerCase())){xe.error(n("library.library.folderNameReserved",{name:te}));return}try{const ge=O.path.includes("/")?O.path.slice(0,O.path.lastIndexOf("/")):"",ve=ge?`${ge}/${te}`:te;await J.mutateAsync({from:O.path,to:ve});const Se=te.replace(/[<>]/g,"");xe.success(n("library.library.renamed",{name:Se}))}catch(ge){xe.error(ge instanceof Error?ge.message:n("library.library.renameFailed"))}finally{D(!1),z(null),$("")}}async function fe(te,ge){try{const ve=rn(te),Se=ge?`${ge}/${ve}`:ve;await J.mutateAsync({from:te,to:Se}),xe.success(n("library.library.moved",{name:ve,destination:ge||n("library.library.theLibrary")}))}catch(ve){xe.error(ve instanceof Error?ve.message:n("library.library.moveFailed"))}}function de(){for(const te of _ue)r.invalidateQueries({queryKey:Je.orgFsVolume(i.id,te)});h.volume&&r.invalidateQueries({queryKey:Je.orgFsVolume(i.id,h.volume)}),r.invalidateQueries({queryKey:Je.orgFsRecent(i.id)}),r.invalidateQueries({queryKey:Je.orgFsSearchRoot(i.id)}),r.invalidateQueries({queryKey:Je.orgFsPublicSets(i.id)})}function pe(te){te.defaultPrevented||!W||te.target.closest("input, textarea, button, a, [role='button']")||(te.preventDefault(),A(!0))}return o.jsxs("div",{className:"relative h-full",onDragEnter:K,onDragOver:X,onDragLeave:Z,onDrop:le,onContextMenu:pe,children:[U&&o.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/80 p-6 backdrop-blur-sm",children:o.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-primary px-10 py-8 text-center",children:[o.jsx(Gn,{size:28,className:"text-primary"}),o.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:k})})]})}),o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:o.jsx(jue,{segments:h.segments,onNavigate:p})}),o.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[o.jsx(k9,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),o.jsx(mt,{value:L,onChange:te=>v(te.target.value),onKeyDown:te=>{te.key==="Escape"&&v("")},placeholder:S,className:"h-9 rounded-xl pr-9 pl-9"}),L&&o.jsx(ue,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>v(""),"aria-label":n("library.library.clearSearch"),children:o.jsx(Ci,{size:14})})]}),o.jsx(ue,{variant:"ghost",size:"icon",onClick:de,"aria-label":n("library.library.refresh"),children:o.jsx(Dn,{size:14})}),W&&o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>A(!0),children:[o.jsx(Kt,{size:14}),n("library.library.newFolder")]}),h.readOnly?o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(u0,{size:12}),n("library.library.readOnly")]}):o.jsxs(ue,{size:"sm",disabled:G.isPending,onClick:()=>F.current?.click(),children:[o.jsx(Gn,{size:14}),G.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),o.jsx("input",{ref:F,type:"file",multiple:!0,className:"hidden",onChange:te=>{oe(te.target.files)}})]}),_?o.jsx(Cue,{query:_,scope:w,stale:L.trim()!==_,onOpenFile:x,onShare:N,onDelete:C}):h.volume===null?o.jsx(Tue,{onOpenDir:p}):o.jsx(Vue,{location:h,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:y,onShare:N,onDelete:C,onContextMenu:(te,ge)=>{z({path:te,kind:ge}),$(rn(te)),D(!0)},onMove:fe},h.volume)]})}),a&&(c.preview?o.jsx(oC,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?o.jsx(H8,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?o.jsx(rC,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),o.jsx(Ht,{open:V,onOpenChange:A,children:o.jsxs(Ut,{children:[o.jsxs(hs,{children:[o.jsx(Yt,{children:n("library.library.newFolderTitle")}),o.jsx(kn,{children:n("library.library.newFolderDescription",{path:k||n("library.library.theLibrary")})})]}),o.jsx(mt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:E,onChange:te=>R(te.target.value),onKeyDown:te=>{te.key==="Enter"&&ee()}}),o.jsxs(Wn,{children:[o.jsx(ue,{variant:"outline",onClick:()=>A(!1),children:n("library.library.cancel")}),o.jsx(ue,{disabled:!E.trim()||Y.isPending,onClick:()=>{ee()},children:n("library.library.create")})]})]})}),o.jsx(Ht,{open:I,onOpenChange:te=>{D(te),te||(z(null),$(""))},children:o.jsxs(Ut,{children:[o.jsxs(hs,{children:[o.jsx(Yt,{children:O&&n("library.library.renameTitle",{name:rn(O.path)})}),o.jsx(kn,{children:n("library.library.renameDescription")})]}),o.jsx(mt,{autoFocus:!0,value:M,onChange:te=>$(te.target.value),onKeyDown:te=>{te.key==="Enter"&&ce()}}),o.jsxs(Wn,{children:[o.jsx(ue,{variant:"outline",onClick:()=>D(!1),children:n("library.library.cancel")}),o.jsx(ue,{disabled:!M.trim()||J.isPending,onClick:()=>{ce()},children:n("library.library.rename")})]})]})}),o.jsx(sue,{target:T,onOpenChange:te=>{te||N(null)}}),o.jsx(el,{open:j!==null,onOpenChange:te=>{te||C(null)},children:o.jsxs(tl,{children:[o.jsxs(sl,{children:[o.jsx(nl,{children:n("library.library.deleteTitle",{name:j?rn(j.path):""})}),o.jsx(il,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),o.jsxs(rl,{children:[o.jsx(ol,{children:n("library.library.cancel")}),o.jsx(ll,{onClick:()=>{ae()},children:n("library.library.delete")})]})]})})]})}function Iue(){const t=B.c(10),{openPanel:e}=hi(),[s,n]=P.useState(null),[i,r]=P.useState(null);let l;t[0]!==e?(l=o.jsx(Due,{onOpenFile:f=>e(hT(f)),onOpenSkill:n,onOpenBrand:r}),t[0]=e,t[1]=l):l=t[1];let a;t[2]!==s?(a=s&&o.jsx(H8,{skillPath:s,onClose:()=>n(null)},s),t[2]=s,t[3]=a):a=t[3];let c;t[4]!==i?(c=i&&o.jsx(rC,{brandPath:i,onClose:()=>r(null)},i),t[4]=i,t[5]=c):c=t[5];let d;return t[6]!==l||t[7]!==a||t[8]!==c?(d=o.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[l,a,c]}),t[6]=l,t[7]=a,t[8]=c,t[9]=d):d=t[9],d}const Xv=P.lazy(()=>xn(()=>import("./project-app-view-B27k8y98.js"),__vite__mapDeps([181,1,2,85,28,29,30,31,32,33,34,35,36,37,38,39,40,8,27,41,42,43,44,45,9,46,10,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,86,87,88,15,11,16,22,89,90,91,92,93,94,95,96,97,98,99,7,4,5,14,17,18,19,20,3,6,12,13,21,23,24,25,26,100,101,102,103,104,105,106,107,108,109,110,111,82,79,112,130,118,119,120,121,122,123,124,125,126,113,114,78,115,116,117,127,128,129,131,132,133,134,135,136,137,138,139,140,141,142,143,80,144,145,146,147,148,149,77,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.AppViewContent})));function Mue(t){const e=B.c(64),{activeTab:s,virtualMcpId:n,taskId:i,layoutTabs:r,expandedTools:l,automationTabParsed:a}=t;if(s==="overview"){let _;return e[0]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(bX,{}),e[0]=_):_=e[0],_}if(s==="board"){let _;return e[1]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(sZ,{})}),e[1]=_):_=e[1],_}if(mT(s)){let _;return e[2]!==n?(_=o.jsx(j5,{virtualMcpId:n}),e[2]=n,e[3]=_):_=e[3],_}if(s==="git"){let _;return e[4]!==n?(_=o.jsx(Fee,{virtualMcpId:n}),e[4]=n,e[5]=_):_=e[5],_}if(s==="automations"){let _;return e[6]!==n?(_=o.jsx(Mde,{virtualMcpId:n}),e[6]=n,e[7]=_):_=e[7],_}if(s==="preview"){let _;return e[8]!==n?(_=o.jsx(Ple,{virtualMcpId:n}),e[8]=n,e[9]=_):_=e[9],_}let c;e[10]!==s?(c=pT(s),e[10]=s,e[11]=c):c=e[11];const d=c;if(d){let _;return e[12]!==d.path?(_=o.jsx(Rle,{openPath:d.path}),e[12]=d.path,e[13]=_):_=e[13],_}if(s==="content"){let _;return e[14]!==n?(_=o.jsx(Wce,{virtualMcpId:n}),e[14]=n,e[15]=_):_=e[15],_}if(s==="assets"){let _;return e[16]!==n?(_=o.jsx(qce,{virtualMcpId:n}),e[16]=n,e[17]=_):_=e[17],_}if(s==="files"){let _;return e[18]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Iue,{}),e[18]=_):_=e[18],_}if(s==="reports"){let _;return e[19]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Hde,{}),e[19]=_):_=e[19],_}if(s==="connect-sources"){let _;return e[20]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(zde,{}),e[20]=_):_=e[20],_}if(a){let _;return e[21]!==s?(_=o.jsx(Ede,{tabId:s}),e[21]=s,e[22]=_):_=e[22],_}let f;e[23]!==s?(f=y6(s),e[23]=s,e[24]=f):f=e[24];const u=f;if(u){let _;return e[25]!==u.path?(_=o.jsx(iue,{path:u.path},u.path),e[25]=u.path,e[26]=_):_=e[26],_}let h;e[27]!==s?(h=v6(s),e[27]=s,e[28]=h):h=e[28];const m=h;if(m){let _;return e[29]!==m.key||e[30]!==i?(_=o.jsx($de,{fileKey:m.key,taskId:i}),e[29]=m.key,e[30]=i,e[31]=_):_=e[31],_}let p;e[32]!==s?(p=_6(s),e[32]=s,e[33]=p):p=e[33];const g=p;if(g){let _;return e[34]!==g.path?(_=o.jsx(aue,{path:g.path},g.path),e[34]=g.path,e[35]=_):_=e[35],_}let x;e[36]!==s?(x=gT(s),e[36]=s,e[37]=x):x=e[37];const b=x;if(b){let _;if(e[38]!==l||e[39]!==b.connectionId||e[40]!==b.toolName){let C;e[42]!==b.connectionId||e[43]!==b.toolName?(C=T=>T.appId===b.connectionId&&T.toolName===b.toolName,e[42]=b.connectionId,e[43]=b.toolName,e[44]=C):C=e[44],_=l.find(C),e[38]=l,e[39]=b.connectionId,e[40]=b.toolName,e[41]=_}else _=e[41];const w=_;let S;e[45]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(cr,{}),e[45]=S):S=e[45];const k=w?.args;let j;return e[46]!==s||e[47]!==b.connectionId||e[48]!==b.toolName||e[49]!==k?(j=o.jsx(P.Suspense,{fallback:S,children:o.jsx(Xv,{connectionId:b.connectionId,toolName:b.toolName,args:k},s)}),e[46]=s,e[47]=b.connectionId,e[48]=b.toolName,e[49]=k,e[50]=j):j=e[50],j}let y;if(e[51]!==s||e[52]!==r){let _;e[54]!==s?(_=w=>w.id===s,e[54]=s,e[55]=_):_=e[55],y=r.find(_),e[51]=s,e[52]=r,e[53]=y}else y=e[53];const L=y;if(L){let _;e[56]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(cr,{}),e[56]=_):_=e[56];let w;return e[57]!==s||e[58]!==L.id||e[59]!==L.view.appId||e[60]!==L.view.args?(w=o.jsx(P.Suspense,{fallback:_,children:o.jsx(Xv,{connectionId:L.view.appId,toolName:L.id,args:L.view.args},s)}),e[57]=s,e[58]=L.id,e[59]=L.view.appId,e[60]=L.view.args,e[61]=w):w=e[61],w}let v;return e[62]!==n?(v=o.jsx(j5,{virtualMcpId:n}),e[62]=n,e[63]=v):v=e[63],v}function Oue(t){const e=B.c(14),{taskId:s,virtualMcpId:n}=t;let i;e[0]!==s||e[1]!==n?(i={virtualMcpId:n,taskId:s},e[0]=s,e[1]=n,e[2]=i):i=e[2];const{activeTab:r,layoutTabs:l,expandedTools:a,automationTabParsed:c}=w3(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(cr,{}),e[3]=d):d=e[3];let f;e[4]!==r||e[5]!==c||e[6]!==a||e[7]!==l||e[8]!==s||e[9]!==n?(f=o.jsx(P.Suspense,{fallback:d,children:o.jsx(Mue,{activeTab:r,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[4]=r,e[5]=c,e[6]=a,e[7]=l,e[8]=s,e[9]=n,e[10]=f):f=e[10];let u;return e[11]!==r||e[12]!==f?(u=o.jsx(Us,{children:f},r),e[11]=r,e[12]=f,e[13]=u):u=e[13],u}function $ue(t){return t.hasClonableSource&&!t.fastPreviewActive&&!(t.mainTab!==null&&xT.has(t.mainTab))}const zl="setup";function Bue(t){const e=B.c(57),s=re();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let v;e[3]!==t.scriptTabs?(v=_=>!t.scriptTabs.includes(_),e[3]=t.scriptTabs,e[4]=v):v=e[4],n=t.scripts.filter(v),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const i=n;let r;e[5]!==t?(r=()=>{t.active===zl?t.onToggle():t.onSelectTab(zl)},e[5]=t,e[6]=r):r=e[6];const l=r;let a;e[7]!==t.open||e[8]!==s?(a=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=a):a=e[9];let c;e[10]!==t.open?(c=t.open?o.jsx(Qt,{className:"size-4"}):o.jsx(p7,{className:"size-4"}),e[10]=t.open,e[11]=c):c=e[11];let d;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==a||e[15]!==c?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=c,e[16]=d):d=e[16];let f;e[17]!==t.open||e[18]!==s?(f=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=f):f=e[19];let u;e[20]!==f?(u=o.jsx(We,{children:f}),e[20]=f,e[21]=u):u=e[21];let h;e[22]!==d||e[23]!==u?(h=o.jsxs(qe,{children:[d,u]}),e[22]=d,e[23]=u,e[24]=h):h=e[24];const m=t.active===zl;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=o.jsx(zue,{active:m,open:t.open,onClick:l,t:s}),e[25]=l,e[26]=t.open,e[27]=s,e[28]=m,e[29]=p):p=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(v=>o.jsx(Uue,{active:t.active===v,onClick:()=>{t.active===v?t.onToggle():t.onSelectTab(v)},onClose:()=>t.onCloseScript(v),t:s,children:v},v)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=o.jsx(Hue,{scripts:i,onRun:t.onAddScript}),e[33]=i,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==p?(b=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,g,x]}),e[36]=g,e[37]=x,e[38]=p,e[39]=b):b=e[39];let y;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(y=t.showScriptControls?o.jsx(Kue,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):o.jsx(Fue,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=y):y=e[52];let L;return e[53]!==b||e[54]!==y||e[55]!==h?(L=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[h,b,y]}),e[53]=b,e[54]=y,e[55]=h,e[56]=L):L=e[56],L}function zue(t){const e=B.c(11),{active:s,open:n,onClick:i,t:r}=t,l=s&&n,a=s&&n,c=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let d;e[0]!==c?(d=ie("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(ZA,{className:"size-4"}),e[2]=f):f=e[2];let u;e[3]!==r?(u=r("sandbox.toolbar.setupTab"),e[3]=r,e[4]=u):u=e[4];let h;return e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==d||e[9]!==u?(h=o.jsxs("button",{type:"button","aria-pressed":l,"aria-expanded":a,onClick:i,className:d,children:[f,u]}),e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=u,e[10]=h):h=e[10],h}function Fue(t){const e=B.c(40),{status:s,onStart:n,onStop:i,onRestart:r,onResume:l,onRetry:a,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Kl,{className:"size-3.5"}),e[0]=d):d=e[0];let f;e[1]!==c?(f=c("sandbox.toolbar.start"),e[1]=c,e[2]=f):f=e[2];let u;return e[3]!==n||e[4]!==f?(u=o.jsxs(ue,{variant:"outline",size:"xs",onClick:n,children:[d," ",f]}),e[3]=n,e[4]=f,e[5]=u):u=e[5],u}if(s==="suspended"&&l){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Kl,{className:"size-3.5"}),e[6]=d):d=e[6];let f;e[7]!==c?(f=c("sandbox.toolbar.resume"),e[7]=c,e[8]=f):f=e[8];let u;return e[9]!==l||e[10]!==f?(u=o.jsxs(ue,{variant:"outline",size:"xs",onClick:l,children:[d," ",f]}),e[9]=l,e[10]=f,e[11]=u):u=e[11],u}if(s==="errored"&&a){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Dn,{className:"size-3.5"}),e[12]=d):d=e[12];let f;e[13]!==c?(f=c("sandbox.toolbar.retry"),e[13]=c,e[14]=f):f=e[14];let u;return e[15]!==a||e[16]!==f?(u=o.jsxs(ue,{variant:"outline",size:"xs",onClick:a,children:[d," ",f]}),e[15]=a,e[16]=f,e[17]=u):u=e[17],u}if(s==="starting"||s==="running"){const d=s==="running"&&!!r,f=d?"rounded-r-none border-r-0":void 0;let u;e[18]!==f?(u=ie(f),e[18]=f,e[19]=u):u=e[19];let h;e[20]!==c?(h=c("sandbox.toolbar.stop"),e[20]=c,e[21]=h):h=e[21];let m;e[22]!==i||e[23]!==u||e[24]!==h?(m=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"outline",size:"xs",onClick:i,className:u,children:h})}),e[22]=i,e[23]=u,e[24]=h,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=o.jsx(We,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=o.jsxs(qe,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==r||e[34]!==d||e[35]!==c?(b=d&&o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{variant:"outline",size:"xs",className:"rounded-l-none px-1",children:o.jsx(Qt,{className:"size-3"})})}),o.jsx(zt,{align:"end",children:o.jsxs(Xe,{onClick:r,children:[o.jsx(Dn,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=r,e[34]=d,e[35]=c,e[36]=b):b=e[36];let y;return e[37]!==x||e[38]!==b?(y=o.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=y):y=e[39],y}return null}function Uue(t){const e=B.c(17),{active:s,onClick:n,onClose:i,children:r,t:l}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==a?(c=ie("flex h-6 items-center rounded-md border text-xs",a),e[0]=a,e[1]=c):c=e[1];const d=i?"pl-2 pr-1":"px-2",f=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let u;e[2]!==d||e[3]!==f?(u=ie("flex h-full items-center",d,f),e[2]=d,e[3]=f,e[4]=u):u=e[4];let h;e[5]!==r||e[6]!==n||e[7]!==u?(h=o.jsx("button",{type:"button",onClick:n,className:u,children:r}),e[5]=r,e[6]=n,e[7]=u,e[8]=h):h=e[8];let m;e[9]!==r||e[10]!==i||e[11]!==l?(m=i&&o.jsx("button",{type:"button","aria-label":l("sandbox.toolbar.closeTab",{tab:String(r)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:o.jsx(Ds,{className:"size-3.5"})}),e[9]=r,e[10]=i,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==h||e[15]!==m?(p=o.jsxs("div",{className:c,children:[h,m]}),e[13]=c,e[14]=h,e[15]=m,e[16]=p):p=e[16],p}function Hue(t){const e=B.c(27),{scripts:s,onRun:n}=t,i=re(),[r,l]=P.useState(!1);let a;e[0]!==i?(a=i("sandbox.toolbar.runScript"),e[0]=i,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Kt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(ns,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=d):d=e[4];let f;e[5]!==i?(f=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=f):f=e[6];let u;e[7]!==f?(u=o.jsx(We,{children:f}),e[7]=f,e[8]=u):u=e[8];let h;e[9]!==d||e[10]!==u?(h=o.jsxs(qe,{children:[d,u]}),e[9]=d,e[10]=u,e[11]=h):h=e[11];let m;e[12]!==i?(m=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=m):m=e[13];let p;e[14]!==m?(p=o.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:m}),e[14]=m,e[15]=p):p=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==i?(g=s.length===0?o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(y=>o.jsxs("button",{type:"button",onClick:()=>{l(!1),n(y)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",y]},y)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==p||e[21]!==g?(x=o.jsxs(is,{align:"start",className:"p-1 w-56",children:[p,g]}),e[20]=p,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==r||e[24]!==x||e[25]!==h?(b=o.jsxs(rs,{open:r,onOpenChange:l,children:[h,x]}),e[23]=r,e[24]=x,e[25]=h,e[26]=b):b=e[26],b}function Kue(t){const e=B.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:r,t:l}=t;if(n){let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(ot,{className:"size-3.5 animate-spin"}),e[0]=h):h=e[0];let m;e[1]!==l?(m=l("sandbox.toolbar.stopping"),e[1]=l,e[2]=m):m=e[2];let p;return e[3]!==m?(p=o.jsxs(ue,{variant:"outline",size:"xs",disabled:!0,children:[h," ",m]}),e[3]=m,e[4]=p):p=e[4],p}if(!s){let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Kl,{className:"size-3.5"}),e[5]=h):h=e[5];let m;e[6]!==l?(m=l("sandbox.toolbar.run"),e[6]=l,e[7]=m):m=e[7];let p;e[8]!==i||e[9]!==m?(p=o.jsx(Ke,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"xs",onClick:i,children:[h," ",m]})}),e[8]=i,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==l?(g=l("sandbox.toolbar.startProcess"),e[11]=l,e[12]=g):g=e[12];let x;e[13]!==g?(x=o.jsx(We,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=o.jsxs(qe,{children:[p,x]}),e[15]=p,e[16]=x,e[17]=b):b=e[17],b}let a;e[18]!==l?(a=l("sandbox.toolbar.stop"),e[18]=l,e[19]=a):a=e[19];let c;e[20]!==r||e[21]!==a?(c=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"outline",size:"xs",onClick:r,children:a})}),e[20]=r,e[21]=a,e[22]=c):c=e[22];let d;e[23]!==l?(d=l("sandbox.toolbar.stopProcess"),e[23]=l,e[24]=d):d=e[24];let f;e[25]!==d?(f=o.jsx(We,{children:d}),e[25]=d,e[26]=f):f=e[26];let u;return e[27]!==c||e[28]!==f?(u=o.jsxs(qe,{children:[c,f]}),e[27]=c,e[28]=f,e[29]=u):u=e[29],u}var cC=Object.defineProperty,Wue=Object.getOwnPropertyDescriptor,que=(t,e)=>{for(var s in e)cC(t,s,{get:e[s],enumerable:!0})},Ps=(t,e,s,n)=>{for(var i=n>1?void 0:n?Wue(e,s):e,r=t.length-1,l;r>=0;r--)(l=t[r])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&cC(e,s,i),i},Ge=(t,e)=>(s,n)=>e(s,n,t),Zv="Terminal input",Hp={get:()=>Zv,set:t=>Zv=t},ey="Too much output to announce, navigate to rows manually to read",Kp={get:()=>ey,set:t=>ey=t};function Gue(t){return t.replace(/\r?\n/g,"\r")}function Yue(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function Jue(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function Que(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");dC(i,e,s,n)}}function dC(t,e,s,n){t=Gue(t),t=Yue(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function uC(t,e,s){let n=s.getBoundingClientRect(),i=t.clientX-n.left-10,r=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${i}px`,e.style.top=`${r}px`,e.style.zIndex="1000",e.focus()}function ty(t,e,s,n,i){uC(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Io(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function c1(t,e=0,s=t.length){let n="";for(let i=e;i<s;++i){let r=t[i];r>65535?(r-=65536,n+=String.fromCharCode((r>>10)+55296)+String.fromCharCode(r%1024+56320)):n+=String.fromCharCode(r)}return n}var Xue=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i=0;if(this._interim){let r=t.charCodeAt(i++);56320<=r&&r<=57343?e[n++]=(this._interim-55296)*1024+r-56320+65536:(e[n++]=this._interim,e[n++]=r),this._interim=0}for(let r=i;r<s;++r){let l=t.charCodeAt(r);if(55296<=l&&l<=56319){if(++r>=s)return this._interim=l,n;let a=t.charCodeAt(r);56320<=a&&a<=57343?e[n++]=(l-55296)*1024+a-56320+65536:(e[n++]=l,e[n++]=a);continue}l!==65279&&(e[n++]=l)}return n}},Zue=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i,r,l,a,c=0,d=0;if(this.interim[0]){let h=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-p;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,h=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}h||(x===2?m<128?d--:e[n++]=m:x===3?m<2048||m>=55296&&m<=57343||m===65279||(e[n++]=m):m<65536||m>1114111||(e[n++]=m)),this.interim.fill(0)}let f=s-4,u=d;for(;u<s;){for(;u<f&&!((i=t[u])&128)&&!((r=t[u+1])&128)&&!((l=t[u+2])&128)&&!((a=t[u+3])&128);)e[n++]=i,e[n++]=r,e[n++]=l,e[n++]=a,u+=4;if(i=t[u++],i<128)e[n++]=i;else if((i&224)===192){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(c=(i&31)<<6|r&63,c<128){u--;continue}e[n++]=c}else if((i&240)===224){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[u++],(l&192)!==128){u--;continue}if(c=(i&15)<<12|(r&63)<<6|l&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[n++]=c}else if((i&248)===240){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[u++],(l&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,this.interim[2]=l,n;if(a=t[u++],(a&192)!==128){u--;continue}if(c=(i&7)<<18|(r&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},fC="",Uo=" ",P0=class hC{constructor(){this.fg=0,this.bg=0,this.extended=new $h}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new hC;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},$h=class mC{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new mC(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ai=class pC extends P0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new $h,this.combinedData=""}static fromCharData(e){let s=new pC;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Io(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=e[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},sy="di$target",Wp="di$dependencies",mm=new Map;function e0e(t){return t[Wp]||[]}function nn(t){if(mm.has(t))return mm.get(t);let e=function(s,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");t0e(e,s,i)};return e._id=t,mm.set(t,e),e}function t0e(t,e,s){e[sy]===e?e[Wp].push({id:t,index:s}):(e[Wp]=[{id:t,index:s}],e[sy]=e)}var Pn=nn("BufferService"),gC=nn("CoreMouseService"),wa=nn("CoreService"),s0e=nn("CharsetService"),$x=nn("InstantiationService"),xC=nn("LogService"),En=nn("OptionsService"),bC=nn("OscLinkService"),n0e=nn("UnicodeService"),E0=nn("DecorationService"),qp=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,r=new ai,l=s.getTrimmedLength(),a=-1,c=-1,d=!1;for(let f=0;f<l;f++)if(!(c===-1&&!s.hasContent(f))){if(s.loadCell(f,r),r.hasExtendedAttrs()&&r.extended.urlId)if(c===-1){c=f,a=r.extended.urlId;continue}else d=r.extended.urlId!==a;else c!==-1&&(d=!0);if(d||c!==-1&&f===l-1){let u=this._oscLinkService.getLinkData(a)?.uri;if(u){let h={start:{x:c+1,y:t},end:{x:f+(!d&&f===l-1?1:0),y:t}},m=!1;if(!i?.allowNonHttpProtocols)try{let p=new URL(u);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:u,range:h,activate:(p,g)=>i?i.activate(p,g,h):i0e(p,g),hover:(p,g)=>i?.hover?.(p,g,h),leave:(p,g)=>i?.leave?.(p,g,h)})}d=!1,r.hasExtendedAttrs()&&r.extended.urlId?(c=f,a=r.extended.urlId):(c=-1,a=-1)}}e(n)}};qp=Ps([Ge(0,Pn),Ge(1,En),Ge(2,bC)],qp);function i0e(t,e){if(confirm(`Do you want to navigate to ${e}?
806
+ `);function pue(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",mue).replaceAll("{{title}}",hue).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function gue(t){const e=B.c(8),{readUrl:s,title:n,tokensUrl:i}=t,r=Pu(s),l=Pu(i??"");if(r.isPending||i&&l.isPending){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:o.jsx(At,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=f):f=e[0],f}if(r.isError||!r.data){let f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[1]=f):f=e[1],f}const a=l.data??null;let c;e[2]!==a||e[3]!==r.data?(c=pue(r.data,a),e[2]=a,e[3]=r.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=o.jsx("iframe",{title:n,srcDoc:c,sandbox:"allow-scripts",className:"block h-full w-full border-0 bg-white"}),e[5]=c,e[6]=n,e[7]=d):d=e[7],d}function iu(t){const e=B.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function xue(t){const e=B.c(16),{family:s,tokens:n,editing:i,valueOf:r,onEdit:l}=t;let a;e[0]!==s?(a=o.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==r){let u;e[7]!==i||e[8]!==l||e[9]!==r?(u=h=>{const m=r(h),p=`${h.name.replace(/^--brand-/,"")}: ${m}`;return i&&/^#/.test(m)?o.jsx("input",{type:"color","aria-label":h.name,title:p,value:HE(m),onChange:g=>l(h.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},h.name):o.jsx("span",{title:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},h.name)},e[7]=i,e[8]=l,e[9]=r,e[10]=u):u=e[10],c=n.map(u),e[2]=i,e[3]=l,e[4]=n,e[5]=r,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-wrap gap-1",children:c}),e[11]=c,e[12]=d):d=e[12];let f;return e[13]!==a||e[14]!==d?(f=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=f):f=e[15],f}function bue(t){const e=B.c(9),{token:s,value:n}=t;if(s.kind==="space"){let r;return e[0]!==n?(r=o.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:o.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=r):r=e[1],r}if(s.kind==="radius"){let r;return e[2]!==n?(r=o.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=r):r=e[3],r}if(s.kind==="shadow"){let r;return e[4]!==n?(r=o.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=r):r=e[5],r}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const r=`min(${n}, 22px)`;let l;return e[6]!==r?(l=o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:r},children:"Ag"}),e[6]=r,e[7]=l):l=e[7],l}let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("span",{className:"size-7 shrink-0"}),e[8]=i):i=e[8],i}function iC(t){const e=B.c(17),{token:s,value:n,editing:i,onEdit:r}=t;let l;e[0]!==s||e[1]!==n?(l=o.jsx(bue,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=l):l=e[2];let a;if(e[3]!==s.name){let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=/^--brand-/,e[5]=u):u=e[5],a=s.name.replace(u,""),e[3]=s.name,e[4]=a}else a=e[4];let c;e[6]!==a?(c=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:a}),e[6]=a,e[7]=c):c=e[7];let d;e[8]!==i||e[9]!==r||e[10]!==s.name||e[11]!==n?(d=i?o.jsx(mt,{value:n,onChange:u=>r(s.name,u.target.value),className:"h-8 w-40 font-mono text-xs"}):o.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=r,e[10]=s.name,e[11]=n,e[12]=d):d=e[12];let f;return e[13]!==l||e[14]!==c||e[15]!==d?(f=o.jsxs("div",{className:"flex items-center gap-3",children:[l,c,d]}),e[13]=l,e[14]=c,e[15]=d,e[16]=f):f=e[16],f}function Ud(t){const e=B.c(16),{label:s,tokens:n,editing:i,valueOf:r,onEdit:l}=t;if(n.length===0)return null;let a;e[0]!==s?(a=o.jsx(iu,{children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==r){let u;e[7]!==i||e[8]!==l||e[9]!==r?(u=h=>o.jsx(iC,{token:h,value:r(h),editing:i,onEdit:l},h.name),e[7]=i,e[8]=l,e[9]=r,e[10]=u):u=e[10],c=n.map(u),e[2]=i,e[3]=l,e[4]=n,e[5]=r,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-col gap-2.5",children:c}),e[11]=c,e[12]=d):d=e[12];let f;return e[13]!==a||e[14]!==d?(f=o.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=f):f=e[15],f}function vue({brandPath:t,onClose:e,variant:s}){const n=re(),{org:i}=Fe(),r=kg(t),l=r.volume??"",a=r.dirPath,c=rn(a),d=r.readOnly,f=ps(),u=o0(),h=P8(l),{upload:m,remove:p}=Au(l),g=P.useRef(null),x=E8(l,a),b=x.data??[],y=te=>b.some(ge=>ge.kind==="file"&&rn(ge.path)===te),L=y("tokens.css"),v=y("brand.md"),_=y("slides-theme.html"),w=BE(b),S=u(l,`${a}/tokens.css`),k=u(l,`${a}/brand.md`),j=u(l,`${a}/slides-theme.html`),C=Pu(S,{enabled:L}),T=Pu(k,{enabled:v}),[N,V]=P.useState(!1),[A,E]=P.useState({}),[R,I]=P.useState(null),[D,O]=P.useState(!1),[z,M]=P.useState(!1),[$,F]=P.useState("deck"),U=C.data?zE(C.data):[],H=te=>U.find(ge=>ge.name===te)?.value,q=te=>A[te.name]??te.value,W=FE(U),G=U.filter(te=>te.kind==="font"),Y=U.filter(te=>te.kind==="type"),J=U.filter(te=>te.kind==="space"),se=U.filter(te=>te.kind==="radius"),oe=U.filter(te=>te.kind==="shadow"),ne=U.filter(te=>te.kind==="motion"),Q=U.filter(te=>te.kind==="other"),K=(te,ge)=>E(ve=>({...ve,[te]:ge})),X=_&&$==="deck",Z=R??T.data??"",le=Object.entries(A).filter(([te,ge])=>H(te)!==ge),ee=R!==null&&R!==(T.data??""),ae=le.length>0||ee;function ce(){E({}),I(null),V(!1)}async function fe(){O(!0);try{if(le.length>0){let te=C.data??"";for(const[ge,ve]of le)te=UE(te,ge,ve);await h.mutateAsync({path:`${a}/tokens.css`,body:te,contentType:"text/css; charset=utf-8"}),f.invalidateQueries({queryKey:Je.fileText(S)})}ee&&R!==null&&(await h.mutateAsync({path:`${a}/brand.md`,body:R,contentType:"text/markdown; charset=utf-8"}),f.invalidateQueries({queryKey:Je.fileText(k)})),f.invalidateQueries({queryKey:Je.orgFsVolume(i.id,l)}),f.invalidateQueries({queryKey:Je.orgFsRecent(i.id)}),E({}),I(null),V(!1),xe.success(n("library.brandPreview.brandSaved"))}catch(te){xe.error(te instanceof Error?te.message:n("library.brandPreview.failedSaveBrand"))}finally{O(!1)}}async function de(te){const ge=te?.[0];if(!ge)return;const Se=`logo.${(ge.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([ge],Se,{type:ge.type})]}),w&&rn(w)!==Se&&await p.mutateAsync(w),xe.success(n("library.brandPreview.logoUpdated"))}catch(ye){xe.error(ye instanceof Error?ye.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const pe=!x.isPending&&!L&&!v&&!w;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:o.jsx(qm,{size:18})}),s==="dialog"?o.jsx(Yt,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):o.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(N?o.jsxs(o.Fragment,{children:[o.jsx(ue,{variant:"ghost",size:"sm",onClick:ce,disabled:D,children:n("library.brandPreview.cancel")}),o.jsx(ue,{size:"sm",disabled:!ae||D,onClick:()=>{fe()},children:n(D?"library.brandPreview.saving":"library.brandPreview.save")})]}):o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>V(!0),children:[o.jsx(UA,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?o.jsx(EV,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:o.jsx(Ds,{size:16})})}):o.jsx(ue,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:o.jsx(Ds,{size:16})})]}),o.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?o.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[o.jsx(At,{className:"h-40 w-full rounded-xl"}),o.jsx(At,{className:"h-4 w-1/3"}),o.jsx(At,{className:"h-4 w-2/3"})]}):pe?o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):o.jsxs(o.Fragment,{children:[(_||L)&&o.jsxs("div",{className:"shrink-0 border-b border-border",children:[o.jsxs("div",{role:"button",tabIndex:0,"aria-label":n(z?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(te=>!te),onKeyDown:te=>{(te.key==="Enter"||te.key===" ")&&(te.preventDefault(),M(ge=>!ge))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:te=>te.stopPropagation(),children:[_&&o.jsx("button",{type:"button",onClick:()=>{F("deck"),M(!1)},className:ie("rounded-md px-2.5 py-1",X?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),o.jsx("button",{type:"button",onClick:()=>{F("components"),M(!1)},className:ie("rounded-md px-2.5 py-1",X?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),z?o.jsx(Qt,{size:16,className:"shrink-0 text-muted-foreground"}):o.jsx(p7,{size:16,className:"shrink-0 text-muted-foreground"})]}),!z&&o.jsx("div",{className:"px-4 pb-4",children:o.jsx("div",{className:ie("w-full overflow-hidden rounded-xl border border-border bg-muted/30",X?"aspect-[16/9]":"h-96"),children:X?o.jsx(gue,{readUrl:j,title:`${c} deck theme`,tokensUrl:S}):o.jsx(fue,{tokensUrl:S})})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(iu,{children:n("library.brandPreview.logo")}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:w?o.jsx("img",{src:u(l,w),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):o.jsx(qm,{size:28,className:"text-muted-foreground/50"})}),N&&o.jsxs("div",{children:[o.jsxs(ue,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[o.jsx(Gn,{size:14}),n(w?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),o.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:te=>{de(te.target.files)}})]})]})]}),W.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(iu,{children:n("library.brandPreview.colors")}),W.map(te=>o.jsx(xue,{family:te.family,tokens:te.tokens,editing:N,valueOf:q,onEdit:K},te.family))]}),(G.length>0||Y.length>0)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(iu,{children:n("library.brandPreview.typography")}),G.map(te=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:te.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),N?o.jsx(mt,{value:q(te),onChange:ge=>K(te.name,ge.target.value),className:"h-9"}):o.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:q(te)},children:q(te)})]},te.name)),Y.map(te=>o.jsx(iC,{token:te,value:q(te),editing:N,onEdit:K},te.name))]}),o.jsx(Ud,{label:n("library.brandPreview.spacing"),tokens:J,editing:N,valueOf:q,onEdit:K}),o.jsx(Ud,{label:n("library.brandPreview.radius"),tokens:se,editing:N,valueOf:q,onEdit:K}),o.jsx(Ud,{label:n("library.brandPreview.shadows"),tokens:oe,editing:N,valueOf:q,onEdit:K}),o.jsx(Ud,{label:n("library.brandPreview.motion"),tokens:ne,editing:N,valueOf:q,onEdit:K}),o.jsx(Ud,{label:n("library.brandPreview.tokens"),tokens:Q,editing:N,valueOf:q,onEdit:K}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(iu,{children:n("library.brandPreview.voiceGuidelines")}),N?o.jsx(Xr,{value:Z,onChange:te=>I(te.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):T.isPending&&v?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(At,{className:"h-3 w-full"}),o.jsx(At,{className:"h-3 w-5/6"})]}):Z.trim()?o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:o.jsx(ud,{id:`brand-preview-${t}`,text:Z})}):o.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function rC(t){const e=B.c(8),{brandPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let r;e[2]!==s||e[3]!==n?(r=o.jsx(Ut,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:o.jsx(vue,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=r):r=e[4];let l;return e[5]!==i||e[6]!==r?(l=o.jsx(Ht,{open:!0,onOpenChange:i,children:r}),e[5]=i,e[6]=r,e[7]=l):l=e[7],l}function oC(t){const e=B.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,r=i===void 0?!1:i;let l;e[0]!==n?(l=d=>{d||n()},e[0]=n,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==s||e[4]!==r?(a=o.jsx(Ut,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:o.jsx(nC,{previewPath:s,onClose:n,showSeeInLibrary:r,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=r,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=o.jsx(Ht,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function yue(t){const e=B.c(11),{onOpenDir:s}=t,n=re(),i=OE();let r;e[0]!==i.data?(r=i.data??[],e[0]=i.data,e[1]=r):r=e[1];let l;if(e[2]!==s||e[3]!==n||e[4]!==r){let c;e[6]!==s||e[7]!==n?(c=d=>o.jsx(h0,{name:d.volume,glyph:jn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:g7(d.lastSyncedAt)}):n("library.syncedRepos.waitingFirstSync"),onOpen:()=>s(d.volume)},d.id),e[6]=s,e[7]=n,e[8]=c):c=e[8],l=r.map(c),e[2]=s,e[3]=n,e[4]=r,e[5]=l}else l=e[5];let a;return e[9]!==l?(a=o.jsx(o.Fragment,{children:l}),e[9]=l,e[10]=a):a=e[10],a}function Mx(t){return`${window.location.origin}${t}`}function Su(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const _ue=[Ru,"uploads","outputs"],lC=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Gn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Wr}],Up=new Set([...lC.map(t=>t.volume),qc("public")]),Lue=6;function aC(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=W8(t),r=i?`public/${i}`:t==="home"?Du(s):t;return n?`${r}/${n}`:r}function kf(t,e,s){return{onDragStart:n=>{s.onDragStart?.(t),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("application/x-studio-library-path",t)},onContextMenu:n=>{n.preventDefault(),s.onContextMenu?.(t,e)},onDrop:s.onDrop?n=>{n.preventDefault();const i=n.dataTransfer.getData("application/x-studio-library-path");i&&i!==t&&!t.startsWith(i+"/")&&s.onDrop(i,t)}:void 0}}function Oo(t){const e=B.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Fr(t){const e=B.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"@container",children:o.jsx("div",{className:"grid grid-cols-1 gap-3 @[440px]:grid-cols-2 @[660px]:grid-cols-3",children:s})}),e[0]=s,e[1]=n):n=e[1],n}function a1(t){const e=B.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=o.jsx(Fr,{children:Array.from({length:n*3},wue)}),e[0]=n,e[1]=i):i=e[1],i}function wue(t,e){return o.jsx(At,{className:"h-16 rounded-2xl"},e)}function Ox(t){const e=B.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Sue(t){const e=B.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:r}=t,l=re(),a=_P(s);let c;e[0]!==l||e[1]!==a.data?(c=a.data?l("library.libraryViews.filesCount",{count:a.data.files}):void 0,e[0]=l,e[1]=a.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==l?(d=l(n),e[3]=n,e[4]=l,e[5]=d):d=e[5];let f;return e[6]!==i||e[7]!==r||e[8]!==c||e[9]!==d||e[10]!==s?(f=o.jsx(h0,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:r}),e[6]=i,e[7]=r,e[8]=c,e[9]=d,e[10]=s,e[11]=f):f=e[11],f}function kue(t){const e=B.c(12),{onOpenDir:s}=t,n=re(),r=R8().data?.length??0;let l;e[0]!==s?(l=lC.map(f=>o.jsx(Sue,{volume:f.volume,descriptionKey:f.descriptionKey,glyph:f.glyph,onOpen:()=>s(f.volume)},f.volume)),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==r||e[4]!==n?(a=r>0&&o.jsx(h0,{name:qc("public"),meta:n("library.libraryViews.skillSetsCount",{count:r}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:mr,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=r,e[4]=n,e[5]=a):a=e[5];let c;e[6]!==s?(c=o.jsx(yue,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d=o.jsxs(o.Fragment,{children:[l,a,c]}),e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function jue(t){const e=B.c(19),{segments:s,onNavigate:n}=t,{org:i}=Fe();let r;e[0]!==s?(r=s[0]===Ru?s.slice(1):s,e[0]=s,e[1]=r):r=e[1];const l=r,a=s.length-l.length,c=l.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==i.slug?(d=c?o.jsx("span",{className:"truncate font-medium text-foreground",children:Du(i.slug)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(Ru),children:Du(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let f;if(e[6]!==a||e[7]!==n||e[8]!==l||e[9]!==s){let h;e[11]!==a||e[12]!==n||e[13]!==l.length||e[14]!==s?(h=(m,p)=>{const g=s.slice(0,a+p+1).join("/"),x=p===l.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx(en,{size:12,className:"shrink-0 text-muted-foreground"}),x?o.jsx("span",{className:"truncate font-medium text-foreground",children:qc(m)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:qc(m)})]},g)},e[11]=a,e[12]=n,e[13]=l.length,e[14]=s,e[15]=h):h=e[15],f=l.map(h),e[6]=a,e[7]=n,e[8]=l,e[9]=s,e[10]=f}else f=e[10];let u;return e[16]!==d||e[17]!==f?(u=o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,f]}),e[16]=d,e[17]=f,e[18]=u):u=e[18],u}function Cue(t){const e=B.c(43),{query:s,scope:n,stale:i,onOpenFile:r,onShare:l,onDelete:a}=t,c=re(),{org:d}=Fe(),f=o0(),u=yP(s,n);let h;e[0]!==f||e[1]!==l?(h=S=>l({volume:S.volume,path:S.path,kind:"file",shareMode:S.shareMode??"private",effectivePublic:S.effectivePublic??!1,url:Mx(f(S.volume,S.path))}),e[0]=f,e[1]=l,e[2]=h):h=e[2];const m=h;if(u.isPending){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(a1,{rows:2}),e[3]=S):S=e[3],S}let p,g,x,b,y;if(e[4]!==s||e[5]!==u.data||e[6]!==u.isPlaceholderData||e[7]!==i||e[8]!==c){y=Symbol.for("react.early_return_sentinel");e:{if(g=u.data??[],g.length===0){let k;e[14]!==s||e[15]!==c?(k=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=k):k=e[16];let j;e[17]!==k?(j=o.jsx(Ox,{children:k}),e[17]=k,e[18]=j):j=e[18],y=j;break e}const S=(i||u.isPlaceholderData)&&"opacity-50";e[19]!==S?(b=ie("flex flex-col gap-3",S),e[19]=S,e[20]=b):b=e[20],p=Oo,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=u.data,e[6]=u.isPlaceholderData,e[7]=i,e[8]=c,e[9]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=y}else p=e[9],g=e[10],x=e[11],b=e[12],y=e[13];if(y!==Symbol.for("react.early_return_sentinel"))return y;let L;e[21]!==p||e[22]!==x?(L=o.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=L):L=e[23];let v;if(e[24]!==f||e[25]!==a||e[26]!==r||e[27]!==d||e[28]!==g||e[29]!==m){let S;e[31]!==f||e[32]!==a||e[33]!==r||e[34]!==d||e[35]!==m?(S=k=>{const j=W8(k.volume)!==null;return o.jsx(x7,{filename:rn(k.path),updatedAt:k.updatedAt,downloadUrl:f(k.volume,k.path),subtitle:aC(k.volume,k.path,d.slug),publicState:Su(k),onOpen:()=>r(q8(k.volume,k.path)),onShare:j?void 0:()=>m(k),onDelete:j?void 0:()=>a({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[31]=f,e[32]=a,e[33]=r,e[34]=d,e[35]=m,e[36]=S):S=e[36],v=g.map(S),e[24]=f,e[25]=a,e[26]=r,e[27]=d,e[28]=g,e[29]=m,e[30]=v}else v=e[30];let _;e[37]!==v?(_=o.jsx(Fr,{children:v}),e[37]=v,e[38]=_):_=e[38];let w;return e[39]!==b||e[40]!==L||e[41]!==_?(w=o.jsxs("div",{className:b,children:[L,_]}),e[39]=b,e[40]=L,e[41]=_,e[42]=w):w=e[42],w}function Nue(t){const e=B.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,r=re(),{org:l}=Fe(),a=A8(),c=o0();let d;e[0]!==c||e[1]!==n?(d=y=>n({volume:y.volume,path:y.path,kind:"file",shareMode:y.shareMode??"private",effectivePublic:y.effectivePublic??!1,url:Mx(c(y.volume,y.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const f=d;if(a.isPending){let y;e[3]!==r?(y=r("library.libraryViews.recentlyAdded"),e[3]=r,e[4]=y):y=e[4];let L;e[5]!==y?(L=o.jsx(Oo,{children:y}),e[5]=y,e[6]=L):L=e[6];let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(a1,{}),e[7]=v):v=e[7];let _;return e[8]!==L?(_=o.jsxs("div",{className:"flex flex-col gap-3",children:[L,v]}),e[8]=L,e[9]=_):_=e[9],_}let u,h,m,p,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==f||e[16]!==r){g=Symbol.for("react.early_return_sentinel");e:{const y=(a.data??[]).slice(0,Lue);if(y.length===0){g=null;break e}m="flex flex-col gap-3";let L;e[22]!==r?(L=r("library.libraryViews.recentlyAdded"),e[22]=r,e[23]=L):L=e[23],e[24]!==L?(p=o.jsx(Oo,{children:L}),e[24]=L,e[25]=p):p=e[25],u=Fr;let v;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==f?(v=_=>o.jsx(qE,{filename:rn(_.path),updatedAt:_.updatedAt,size:_.size,downloadUrl:c(_.volume,_.path),subtitle:aC(_.volume,_.path,l.slug),publicState:Su(_),onOpen:()=>s(q8(_.volume,_.path)),onShare:()=>f(_),onDelete:()=>i({volume:_.volume,path:_.path,kind:"file"})},`${_.volume}/${_.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=f,e[31]=v):v=e[31],h=y.map(v)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=f,e[16]=r,e[17]=u,e[18]=h,e[19]=m,e[20]=p,e[21]=g}else u=e[17],h=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==u||e[33]!==h?(x=o.jsx(u,{children:h}),e[32]=u,e[33]=h,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=o.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function Tue(t){const e=B.c(16),{onOpenDir:s}=t,n=re(),i=R8();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(a1,{}),e[0]=d):d=e[0],d}let r;e[1]!==i.data?(r=i.data??[],e[1]=i.data,e[2]=r):r=e[2];const l=r;if(l.length===0){let d;e[3]!==n?(d=n("library.libraryViews.noPublicSkillSetsConfigured"),e[3]=n,e[4]=d):d=e[4];let f;return e[5]!==d?(f=o.jsx(Ox,{children:d}),e[5]=d,e[6]=f):f=e[6],f}let a;if(e[7]!==s||e[8]!==l||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=f=>o.jsx(h0,{name:f,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${f}`)},f),e[11]=s,e[12]=n,e[13]=d):d=e[13],a=l.map(d),e[7]=s,e[8]=l,e[9]=n,e[10]=a}else a=e[10];let c;return e[14]!==a?(c=o.jsx(Fr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function Vue(t){const e=B.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:r,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:f,onMove:u}=t,h=re(),{org:m}=Fe(),p=s.volume??"",g=E8(p,s.dirPath),x=o0();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=N=>s.isHomeRoot&&Up.has(N.toLowerCase())?`${Du(m.slug)}/${N}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const y=b;let L;e[3]!==s.isHomeRoot||e[4]!==n?(L=s.isHomeRoot?o.jsx(kue,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=L):L=e[5];const v=L;if(g.isPending){let N;e[6]!==v||e[7]!==h?(N=v&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Oo,{children:h("library.libraryViews.folders")}),o.jsx(Fr,{children:v})]}),e[6]=v,e[7]=h,e[8]=N):N=e[8];let V;e[9]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(a1,{rows:2}),e[9]=V):V=e[9];let A;return e[10]!==N?(A=o.jsxs(o.Fragment,{children:[N,V]}),e[10]=N,e[11]=A):A=e[11],A}if(g.isError){let N;e[12]!==g.error||e[13]!==h?(N=g.error instanceof Error?g.error.message:h("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=h,e[14]=N):N=e[14];let V;return e[15]!==N?(V=o.jsx("p",{className:"text-sm text-destructive",children:N}),e[15]=N,e[16]=V):V=e[16],V}let _,w,S,k,j;if(e[17]!==y||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==f||e[22]!==c||e[23]!==d||e[24]!==u||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==r||e[29]!==a||e[30]!==v||e[31]!==h||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const N=g.data??[],V=N.filter(Rue),A=N.filter(Eue),E=N.filter(Pue),R=N.filter(Aue);if(N.length===0&&!s.isHomeRoot){let M;e[38]!==s.readOnly||e[39]!==h?(M=s.readOnly?h("library.libraryViews.emptyReadOnlySet"):h("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=h,e[40]=M):M=e[40];let $;e[41]!==M?($=o.jsx(Ox,{children:M}),e[41]=M,e[42]=$):$=e[42],j=$;break e}let I;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(I=M=>s.readOnly?void 0:()=>c({volume:p,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=I):I=e[46];const D=I;let O;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?(O=M=>s.readOnly?void 0:()=>a({volume:p,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?Mx(x(p,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=O):O=e[51];const z=O;_=V.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Oo,{children:h("library.libraryViews.skills")}),o.jsx(Fr,{children:V.map(M=>o.jsx(KE,{dirName:rn(M.path),updatedAt:M.updatedAt,skillMdUrl:x(p,`${M.path}/SKILL.md`),publicState:Su(M),onOpen:()=>r(mc(s,M.path)),onBrowse:()=>n(mc(s,M.path)),onShare:z(M),onDelete:D(M),draggable:!s.readOnly,...kf(M.path,"dir",{onDragStart:d,onContextMenu:f})},M.path))})]}),w=A.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Oo,{children:h("library.libraryViews.brands")}),o.jsx(Fr,{children:A.map(M=>o.jsx(WE,{dirName:rn(M.path),updatedAt:M.updatedAt,tokensUrl:x(p,`${M.path}/tokens.css`),onOpen:()=>l(mc(s,M.path)),onBrowse:()=>n(mc(s,M.path)),onDelete:D(M),draggable:!s.readOnly,...kf(M.path,"dir",{onDragStart:d,onContextMenu:f})},M.path))})]}),S=(E.length>0||v)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Oo,{children:h("library.libraryViews.folders")}),o.jsxs(Fr,{children:[v,E.map(M=>o.jsx(h0,{name:rn(M.path),meta:g7(M.updatedAt),subtitle:y(rn(M.path)),readOnly:s.readOnly,publicState:Su(M),onOpen:()=>n(mc(s,M.path)),onShare:z(M),onDelete:D(M),draggable:!s.readOnly,...kf(M.path,"dir",{onDragStart:d,onContextMenu:f,onDrop:u})},M.path))]})]}),k=R.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Oo,{children:h("library.libraryViews.files")}),o.jsx(Fr,{children:R.map(M=>o.jsx(x7,{filename:rn(M.path),updatedAt:M.updatedAt,downloadUrl:x(p,M.path),publicState:Su(M),onOpen:()=>i(mc(s,M.path)),onShare:z(M),onDelete:D(M),draggable:!s.readOnly,...kf(M.path,"file",{onDragStart:d,onContextMenu:f})},M.path))})]})}e[17]=y,e[18]=x,e[19]=g.data,e[20]=s,e[21]=f,e[22]=c,e[23]=d,e[24]=u,e[25]=l,e[26]=n,e[27]=i,e[28]=r,e[29]=a,e[30]=v,e[31]=h,e[32]=p,e[33]=_,e[34]=w,e[35]=S,e[36]=k,e[37]=j}else _=e[33],w=e[34],S=e[35],k=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let C;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==a?(C=s.isHomeRoot&&o.jsx(Nue,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=C):C=e[56];let T;return e[57]!==_||e[58]!==w||e[59]!==S||e[60]!==k||e[61]!==C?(T=o.jsxs(o.Fragment,{children:[_,w,S,k,C]}),e[57]=_,e[58]=w,e[59]=S,e[60]=k,e[61]=C,e[62]=T):T=e[62],T}function Aue(t){return t.kind==="file"}function Pue(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function Eue(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function Rue(t){return t.kind==="dir"&&t.hasSkill}function Due({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=re(),{org:i}=Fe(),r=ps(),l=Ws(),a=fl(),c=hl({strict:!1}),d=c.path||Ru,f=kg(d),u=$E(),h=f.volume!==null&&u.has(f.volume)?{...f,readOnly:!0}:f,m=(te,ge)=>l({to:".",search:ve=>({...ve,[te]:ge||void 0})}),p=te=>m("path",te),g=(te,ge)=>l({to:".",search:ve=>({...ve,preview:void 0,skill:void 0,brand:void 0,[te]:ge})}),x=t??(te=>g("preview",te)),b=e??(te=>g("skill",te)),y=s??(te=>g("brand",te)),[L,v]=P.useState(""),_=j9(L.trim(),300),w=!h.isHomeRoot&&h.volume!==null?{volume:h.volume,prefix:h.dirPath}:void 0,S=w?n("library.library.searchInPlaceholder",{folder:qc(h.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),k=h.isHomeRoot?Du(i.slug):qc(h.segments.at(-1)??""),[j,C]=P.useState(null),[T,N]=P.useState(null),[V,A]=P.useState(!1),[E,R]=P.useState(""),[I,D]=P.useState(!1),[O,z]=P.useState(null),[M,$]=P.useState(""),F=P.useRef(null),[U,H]=P.useState(!1),q=P.useRef(0),W=h.readOnly?null:h.volume,{upload:G,mkdir:Y,move:J}=Au(W??Ru),{remove:se}=Au(j?.volume??"uploads");async function oe(te){if(!(!W||!te||te.length===0))try{await G.mutateAsync({dir:h.dirPath,files:[...te]}),xe.success(te.length===1?n("library.library.uploadedSingle",{filename:te[0]?.name??""}):n("library.library.uploadedMultiple",{count:te.length}))}catch(ge){xe.error(ge instanceof Error?ge.message:n("library.library.uploadFailed"))}finally{F.current&&(F.current.value="")}}const ne=W!==null;function Q(te){return te.dataTransfer.types.includes("Files")}function K(te){!ne||!Q(te)||(te.preventDefault(),q.current+=1,H(!0))}function X(te){!ne||!Q(te)||te.preventDefault()}function Z(){ne&&(q.current=Math.max(0,q.current-1),q.current===0&&H(!1))}function le(te){ne&&(te.preventDefault(),te.stopPropagation(),q.current=0,H(!1),te.dataTransfer.files.length>0&&oe(te.dataTransfer.files))}async function ee(){const te=E.trim();if(!(!W||!te)){if(h.isHomeRoot&&Up.has(te.toLowerCase())){xe.error(n("library.library.folderNameReserved",{name:te}));return}try{const ge=h.dirPath;await Y.mutateAsync(ge?`${ge}/${te}`:te),xe.success(n("library.library.folderCreated",{name:te})),A(!1),R("")}catch(ge){xe.error(ge instanceof Error?ge.message:n("library.library.folderCreateFailed"))}}}async function ae(){if(!j)return;const te=j;try{await se.mutateAsync(te.path),xe.success(n("library.library.deleted",{name:rn(te.path)}))}catch(ge){xe.error(ge instanceof Error?ge.message:n("library.library.deleteFailed"))}finally{C(null)}}async function ce(){if(!O)return;const te=M.trim();if(!te||te.includes("/")||te.includes("..")||te===rn(O.path)){D(!1),z(null),$("");return}if(O.kind==="dir"&&h.isHomeRoot&&Up.has(te.toLowerCase())){xe.error(n("library.library.folderNameReserved",{name:te}));return}try{const ge=O.path.includes("/")?O.path.slice(0,O.path.lastIndexOf("/")):"",ve=ge?`${ge}/${te}`:te;await J.mutateAsync({from:O.path,to:ve});const Se=te.replace(/[<>]/g,"");xe.success(n("library.library.renamed",{name:Se}))}catch(ge){xe.error(ge instanceof Error?ge.message:n("library.library.renameFailed"))}finally{D(!1),z(null),$("")}}async function fe(te,ge){try{const ve=rn(te),Se=ge?`${ge}/${ve}`:ve;await J.mutateAsync({from:te,to:Se}),xe.success(n("library.library.moved",{name:ve,destination:ge||n("library.library.theLibrary")}))}catch(ve){xe.error(ve instanceof Error?ve.message:n("library.library.moveFailed"))}}function de(){for(const te of _ue)r.invalidateQueries({queryKey:Je.orgFsVolume(i.id,te)});h.volume&&r.invalidateQueries({queryKey:Je.orgFsVolume(i.id,h.volume)}),r.invalidateQueries({queryKey:Je.orgFsRecent(i.id)}),r.invalidateQueries({queryKey:Je.orgFsSearchRoot(i.id)}),r.invalidateQueries({queryKey:Je.orgFsPublicSets(i.id)})}function pe(te){te.defaultPrevented||!W||te.target.closest("input, textarea, button, a, [role='button']")||(te.preventDefault(),A(!0))}return o.jsxs("div",{className:"relative h-full",onDragEnter:K,onDragOver:X,onDragLeave:Z,onDrop:le,onContextMenu:pe,children:[U&&o.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/80 p-6 backdrop-blur-sm",children:o.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-primary px-10 py-8 text-center",children:[o.jsx(Gn,{size:28,className:"text-primary"}),o.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:k})})]})}),o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:o.jsx(jue,{segments:h.segments,onNavigate:p})}),o.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[o.jsx(k9,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),o.jsx(mt,{value:L,onChange:te=>v(te.target.value),onKeyDown:te=>{te.key==="Escape"&&v("")},placeholder:S,className:"h-9 rounded-xl pr-9 pl-9"}),L&&o.jsx(ue,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>v(""),"aria-label":n("library.library.clearSearch"),children:o.jsx(Ci,{size:14})})]}),o.jsx(ue,{variant:"ghost",size:"icon",onClick:de,"aria-label":n("library.library.refresh"),children:o.jsx(Dn,{size:14})}),W&&o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>A(!0),children:[o.jsx(Kt,{size:14}),n("library.library.newFolder")]}),h.readOnly?o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(u0,{size:12}),n("library.library.readOnly")]}):o.jsxs(ue,{size:"sm",disabled:G.isPending,onClick:()=>F.current?.click(),children:[o.jsx(Gn,{size:14}),G.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),o.jsx("input",{ref:F,type:"file",multiple:!0,className:"hidden",onChange:te=>{oe(te.target.files)}})]}),_?o.jsx(Cue,{query:_,scope:w,stale:L.trim()!==_,onOpenFile:x,onShare:N,onDelete:C}):h.volume===null?o.jsx(Tue,{onOpenDir:p}):o.jsx(Vue,{location:h,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:y,onShare:N,onDelete:C,onContextMenu:(te,ge)=>{z({path:te,kind:ge}),$(rn(te)),D(!0)},onMove:fe},h.volume)]})}),a&&(c.preview?o.jsx(oC,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?o.jsx(H8,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?o.jsx(rC,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),o.jsx(Ht,{open:V,onOpenChange:A,children:o.jsxs(Ut,{children:[o.jsxs(hs,{children:[o.jsx(Yt,{children:n("library.library.newFolderTitle")}),o.jsx(kn,{children:n("library.library.newFolderDescription",{path:k||n("library.library.theLibrary")})})]}),o.jsx(mt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:E,onChange:te=>R(te.target.value),onKeyDown:te=>{te.key==="Enter"&&ee()}}),o.jsxs(Wn,{children:[o.jsx(ue,{variant:"outline",onClick:()=>A(!1),children:n("library.library.cancel")}),o.jsx(ue,{disabled:!E.trim()||Y.isPending,onClick:()=>{ee()},children:n("library.library.create")})]})]})}),o.jsx(Ht,{open:I,onOpenChange:te=>{D(te),te||(z(null),$(""))},children:o.jsxs(Ut,{children:[o.jsxs(hs,{children:[o.jsx(Yt,{children:O&&n("library.library.renameTitle",{name:rn(O.path)})}),o.jsx(kn,{children:n("library.library.renameDescription")})]}),o.jsx(mt,{autoFocus:!0,value:M,onChange:te=>$(te.target.value),onKeyDown:te=>{te.key==="Enter"&&ce()}}),o.jsxs(Wn,{children:[o.jsx(ue,{variant:"outline",onClick:()=>D(!1),children:n("library.library.cancel")}),o.jsx(ue,{disabled:!M.trim()||J.isPending,onClick:()=>{ce()},children:n("library.library.rename")})]})]})}),o.jsx(sue,{target:T,onOpenChange:te=>{te||N(null)}}),o.jsx(el,{open:j!==null,onOpenChange:te=>{te||C(null)},children:o.jsxs(tl,{children:[o.jsxs(sl,{children:[o.jsx(nl,{children:n("library.library.deleteTitle",{name:j?rn(j.path):""})}),o.jsx(il,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),o.jsxs(rl,{children:[o.jsx(ol,{children:n("library.library.cancel")}),o.jsx(ll,{onClick:()=>{ae()},children:n("library.library.delete")})]})]})})]})}function Iue(){const t=B.c(10),{openPanel:e}=hi(),[s,n]=P.useState(null),[i,r]=P.useState(null);let l;t[0]!==e?(l=o.jsx(Due,{onOpenFile:f=>e(hT(f)),onOpenSkill:n,onOpenBrand:r}),t[0]=e,t[1]=l):l=t[1];let a;t[2]!==s?(a=s&&o.jsx(H8,{skillPath:s,onClose:()=>n(null)},s),t[2]=s,t[3]=a):a=t[3];let c;t[4]!==i?(c=i&&o.jsx(rC,{brandPath:i,onClose:()=>r(null)},i),t[4]=i,t[5]=c):c=t[5];let d;return t[6]!==l||t[7]!==a||t[8]!==c?(d=o.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[l,a,c]}),t[6]=l,t[7]=a,t[8]=c,t[9]=d):d=t[9],d}const Xv=P.lazy(()=>xn(()=>import("./project-app-view-CMOtQWit.js"),__vite__mapDeps([181,1,2,85,28,29,30,31,32,33,34,35,36,37,38,39,40,8,27,41,42,43,44,45,9,46,10,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,86,87,88,15,11,16,22,89,90,91,92,93,94,95,96,97,98,99,7,4,5,14,17,18,19,20,3,6,12,13,21,23,24,25,26,100,101,102,103,104,105,106,107,108,109,110,111,82,79,112,130,118,119,120,121,122,123,124,125,126,113,114,78,115,116,117,127,128,129,131,132,133,134,135,136,137,138,139,140,141,142,143,80,144,145,146,147,148,149,77,150,151,83,152,153,154,155,156,157,158,159,160,161,162,163])).then(t=>({default:t.AppViewContent})));function Mue(t){const e=B.c(64),{activeTab:s,virtualMcpId:n,taskId:i,layoutTabs:r,expandedTools:l,automationTabParsed:a}=t;if(s==="overview"){let _;return e[0]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(bX,{}),e[0]=_):_=e[0],_}if(s==="board"){let _;return e[1]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(sZ,{})}),e[1]=_):_=e[1],_}if(mT(s)){let _;return e[2]!==n?(_=o.jsx(j5,{virtualMcpId:n}),e[2]=n,e[3]=_):_=e[3],_}if(s==="git"){let _;return e[4]!==n?(_=o.jsx(Fee,{virtualMcpId:n}),e[4]=n,e[5]=_):_=e[5],_}if(s==="automations"){let _;return e[6]!==n?(_=o.jsx(Mde,{virtualMcpId:n}),e[6]=n,e[7]=_):_=e[7],_}if(s==="preview"){let _;return e[8]!==n?(_=o.jsx(Ple,{virtualMcpId:n}),e[8]=n,e[9]=_):_=e[9],_}let c;e[10]!==s?(c=pT(s),e[10]=s,e[11]=c):c=e[11];const d=c;if(d){let _;return e[12]!==d.path?(_=o.jsx(Rle,{openPath:d.path}),e[12]=d.path,e[13]=_):_=e[13],_}if(s==="content"){let _;return e[14]!==n?(_=o.jsx(Wce,{virtualMcpId:n}),e[14]=n,e[15]=_):_=e[15],_}if(s==="assets"){let _;return e[16]!==n?(_=o.jsx(qce,{virtualMcpId:n}),e[16]=n,e[17]=_):_=e[17],_}if(s==="files"){let _;return e[18]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Iue,{}),e[18]=_):_=e[18],_}if(s==="reports"){let _;return e[19]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Hde,{}),e[19]=_):_=e[19],_}if(s==="connect-sources"){let _;return e[20]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(zde,{}),e[20]=_):_=e[20],_}if(a){let _;return e[21]!==s?(_=o.jsx(Ede,{tabId:s}),e[21]=s,e[22]=_):_=e[22],_}let f;e[23]!==s?(f=y6(s),e[23]=s,e[24]=f):f=e[24];const u=f;if(u){let _;return e[25]!==u.path?(_=o.jsx(iue,{path:u.path},u.path),e[25]=u.path,e[26]=_):_=e[26],_}let h;e[27]!==s?(h=v6(s),e[27]=s,e[28]=h):h=e[28];const m=h;if(m){let _;return e[29]!==m.key||e[30]!==i?(_=o.jsx($de,{fileKey:m.key,taskId:i}),e[29]=m.key,e[30]=i,e[31]=_):_=e[31],_}let p;e[32]!==s?(p=_6(s),e[32]=s,e[33]=p):p=e[33];const g=p;if(g){let _;return e[34]!==g.path?(_=o.jsx(aue,{path:g.path},g.path),e[34]=g.path,e[35]=_):_=e[35],_}let x;e[36]!==s?(x=gT(s),e[36]=s,e[37]=x):x=e[37];const b=x;if(b){let _;if(e[38]!==l||e[39]!==b.connectionId||e[40]!==b.toolName){let C;e[42]!==b.connectionId||e[43]!==b.toolName?(C=T=>T.appId===b.connectionId&&T.toolName===b.toolName,e[42]=b.connectionId,e[43]=b.toolName,e[44]=C):C=e[44],_=l.find(C),e[38]=l,e[39]=b.connectionId,e[40]=b.toolName,e[41]=_}else _=e[41];const w=_;let S;e[45]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(cr,{}),e[45]=S):S=e[45];const k=w?.args;let j;return e[46]!==s||e[47]!==b.connectionId||e[48]!==b.toolName||e[49]!==k?(j=o.jsx(P.Suspense,{fallback:S,children:o.jsx(Xv,{connectionId:b.connectionId,toolName:b.toolName,args:k},s)}),e[46]=s,e[47]=b.connectionId,e[48]=b.toolName,e[49]=k,e[50]=j):j=e[50],j}let y;if(e[51]!==s||e[52]!==r){let _;e[54]!==s?(_=w=>w.id===s,e[54]=s,e[55]=_):_=e[55],y=r.find(_),e[51]=s,e[52]=r,e[53]=y}else y=e[53];const L=y;if(L){let _;e[56]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(cr,{}),e[56]=_):_=e[56];let w;return e[57]!==s||e[58]!==L.id||e[59]!==L.view.appId||e[60]!==L.view.args?(w=o.jsx(P.Suspense,{fallback:_,children:o.jsx(Xv,{connectionId:L.view.appId,toolName:L.id,args:L.view.args},s)}),e[57]=s,e[58]=L.id,e[59]=L.view.appId,e[60]=L.view.args,e[61]=w):w=e[61],w}let v;return e[62]!==n?(v=o.jsx(j5,{virtualMcpId:n}),e[62]=n,e[63]=v):v=e[63],v}function Oue(t){const e=B.c(14),{taskId:s,virtualMcpId:n}=t;let i;e[0]!==s||e[1]!==n?(i={virtualMcpId:n,taskId:s},e[0]=s,e[1]=n,e[2]=i):i=e[2];const{activeTab:r,layoutTabs:l,expandedTools:a,automationTabParsed:c}=w3(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(cr,{}),e[3]=d):d=e[3];let f;e[4]!==r||e[5]!==c||e[6]!==a||e[7]!==l||e[8]!==s||e[9]!==n?(f=o.jsx(P.Suspense,{fallback:d,children:o.jsx(Mue,{activeTab:r,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[4]=r,e[5]=c,e[6]=a,e[7]=l,e[8]=s,e[9]=n,e[10]=f):f=e[10];let u;return e[11]!==r||e[12]!==f?(u=o.jsx(Us,{children:f},r),e[11]=r,e[12]=f,e[13]=u):u=e[13],u}function $ue(t){return t.hasClonableSource&&!t.fastPreviewActive&&!(t.mainTab!==null&&xT.has(t.mainTab))}const zl="setup";function Bue(t){const e=B.c(57),s=re();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let v;e[3]!==t.scriptTabs?(v=_=>!t.scriptTabs.includes(_),e[3]=t.scriptTabs,e[4]=v):v=e[4],n=t.scripts.filter(v),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const i=n;let r;e[5]!==t?(r=()=>{t.active===zl?t.onToggle():t.onSelectTab(zl)},e[5]=t,e[6]=r):r=e[6];const l=r;let a;e[7]!==t.open||e[8]!==s?(a=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=a):a=e[9];let c;e[10]!==t.open?(c=t.open?o.jsx(Qt,{className:"size-4"}):o.jsx(p7,{className:"size-4"}),e[10]=t.open,e[11]=c):c=e[11];let d;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==a||e[15]!==c?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=c,e[16]=d):d=e[16];let f;e[17]!==t.open||e[18]!==s?(f=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=f):f=e[19];let u;e[20]!==f?(u=o.jsx(We,{children:f}),e[20]=f,e[21]=u):u=e[21];let h;e[22]!==d||e[23]!==u?(h=o.jsxs(qe,{children:[d,u]}),e[22]=d,e[23]=u,e[24]=h):h=e[24];const m=t.active===zl;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=o.jsx(zue,{active:m,open:t.open,onClick:l,t:s}),e[25]=l,e[26]=t.open,e[27]=s,e[28]=m,e[29]=p):p=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(v=>o.jsx(Uue,{active:t.active===v,onClick:()=>{t.active===v?t.onToggle():t.onSelectTab(v)},onClose:()=>t.onCloseScript(v),t:s,children:v},v)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=o.jsx(Hue,{scripts:i,onRun:t.onAddScript}),e[33]=i,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==p?(b=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,g,x]}),e[36]=g,e[37]=x,e[38]=p,e[39]=b):b=e[39];let y;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(y=t.showScriptControls?o.jsx(Kue,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):o.jsx(Fue,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=y):y=e[52];let L;return e[53]!==b||e[54]!==y||e[55]!==h?(L=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[h,b,y]}),e[53]=b,e[54]=y,e[55]=h,e[56]=L):L=e[56],L}function zue(t){const e=B.c(11),{active:s,open:n,onClick:i,t:r}=t,l=s&&n,a=s&&n,c=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let d;e[0]!==c?(d=ie("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(ZA,{className:"size-4"}),e[2]=f):f=e[2];let u;e[3]!==r?(u=r("sandbox.toolbar.setupTab"),e[3]=r,e[4]=u):u=e[4];let h;return e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==d||e[9]!==u?(h=o.jsxs("button",{type:"button","aria-pressed":l,"aria-expanded":a,onClick:i,className:d,children:[f,u]}),e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=u,e[10]=h):h=e[10],h}function Fue(t){const e=B.c(40),{status:s,onStart:n,onStop:i,onRestart:r,onResume:l,onRetry:a,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Kl,{className:"size-3.5"}),e[0]=d):d=e[0];let f;e[1]!==c?(f=c("sandbox.toolbar.start"),e[1]=c,e[2]=f):f=e[2];let u;return e[3]!==n||e[4]!==f?(u=o.jsxs(ue,{variant:"outline",size:"xs",onClick:n,children:[d," ",f]}),e[3]=n,e[4]=f,e[5]=u):u=e[5],u}if(s==="suspended"&&l){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Kl,{className:"size-3.5"}),e[6]=d):d=e[6];let f;e[7]!==c?(f=c("sandbox.toolbar.resume"),e[7]=c,e[8]=f):f=e[8];let u;return e[9]!==l||e[10]!==f?(u=o.jsxs(ue,{variant:"outline",size:"xs",onClick:l,children:[d," ",f]}),e[9]=l,e[10]=f,e[11]=u):u=e[11],u}if(s==="errored"&&a){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Dn,{className:"size-3.5"}),e[12]=d):d=e[12];let f;e[13]!==c?(f=c("sandbox.toolbar.retry"),e[13]=c,e[14]=f):f=e[14];let u;return e[15]!==a||e[16]!==f?(u=o.jsxs(ue,{variant:"outline",size:"xs",onClick:a,children:[d," ",f]}),e[15]=a,e[16]=f,e[17]=u):u=e[17],u}if(s==="starting"||s==="running"){const d=s==="running"&&!!r,f=d?"rounded-r-none border-r-0":void 0;let u;e[18]!==f?(u=ie(f),e[18]=f,e[19]=u):u=e[19];let h;e[20]!==c?(h=c("sandbox.toolbar.stop"),e[20]=c,e[21]=h):h=e[21];let m;e[22]!==i||e[23]!==u||e[24]!==h?(m=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"outline",size:"xs",onClick:i,className:u,children:h})}),e[22]=i,e[23]=u,e[24]=h,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=o.jsx(We,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=o.jsxs(qe,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==r||e[34]!==d||e[35]!==c?(b=d&&o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(ue,{variant:"outline",size:"xs",className:"rounded-l-none px-1",children:o.jsx(Qt,{className:"size-3"})})}),o.jsx(zt,{align:"end",children:o.jsxs(Xe,{onClick:r,children:[o.jsx(Dn,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=r,e[34]=d,e[35]=c,e[36]=b):b=e[36];let y;return e[37]!==x||e[38]!==b?(y=o.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=y):y=e[39],y}return null}function Uue(t){const e=B.c(17),{active:s,onClick:n,onClose:i,children:r,t:l}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==a?(c=ie("flex h-6 items-center rounded-md border text-xs",a),e[0]=a,e[1]=c):c=e[1];const d=i?"pl-2 pr-1":"px-2",f=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let u;e[2]!==d||e[3]!==f?(u=ie("flex h-full items-center",d,f),e[2]=d,e[3]=f,e[4]=u):u=e[4];let h;e[5]!==r||e[6]!==n||e[7]!==u?(h=o.jsx("button",{type:"button",onClick:n,className:u,children:r}),e[5]=r,e[6]=n,e[7]=u,e[8]=h):h=e[8];let m;e[9]!==r||e[10]!==i||e[11]!==l?(m=i&&o.jsx("button",{type:"button","aria-label":l("sandbox.toolbar.closeTab",{tab:String(r)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:o.jsx(Ds,{className:"size-3.5"})}),e[9]=r,e[10]=i,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==h||e[15]!==m?(p=o.jsxs("div",{className:c,children:[h,m]}),e[13]=c,e[14]=h,e[15]=m,e[16]=p):p=e[16],p}function Hue(t){const e=B.c(27),{scripts:s,onRun:n}=t,i=re(),[r,l]=P.useState(!1);let a;e[0]!==i?(a=i("sandbox.toolbar.runScript"),e[0]=i,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Kt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(ns,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=d):d=e[4];let f;e[5]!==i?(f=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=f):f=e[6];let u;e[7]!==f?(u=o.jsx(We,{children:f}),e[7]=f,e[8]=u):u=e[8];let h;e[9]!==d||e[10]!==u?(h=o.jsxs(qe,{children:[d,u]}),e[9]=d,e[10]=u,e[11]=h):h=e[11];let m;e[12]!==i?(m=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=m):m=e[13];let p;e[14]!==m?(p=o.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:m}),e[14]=m,e[15]=p):p=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==i?(g=s.length===0?o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(y=>o.jsxs("button",{type:"button",onClick:()=>{l(!1),n(y)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",y]},y)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==p||e[21]!==g?(x=o.jsxs(is,{align:"start",className:"p-1 w-56",children:[p,g]}),e[20]=p,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==r||e[24]!==x||e[25]!==h?(b=o.jsxs(rs,{open:r,onOpenChange:l,children:[h,x]}),e[23]=r,e[24]=x,e[25]=h,e[26]=b):b=e[26],b}function Kue(t){const e=B.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:r,t:l}=t;if(n){let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(ot,{className:"size-3.5 animate-spin"}),e[0]=h):h=e[0];let m;e[1]!==l?(m=l("sandbox.toolbar.stopping"),e[1]=l,e[2]=m):m=e[2];let p;return e[3]!==m?(p=o.jsxs(ue,{variant:"outline",size:"xs",disabled:!0,children:[h," ",m]}),e[3]=m,e[4]=p):p=e[4],p}if(!s){let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Kl,{className:"size-3.5"}),e[5]=h):h=e[5];let m;e[6]!==l?(m=l("sandbox.toolbar.run"),e[6]=l,e[7]=m):m=e[7];let p;e[8]!==i||e[9]!==m?(p=o.jsx(Ke,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"xs",onClick:i,children:[h," ",m]})}),e[8]=i,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==l?(g=l("sandbox.toolbar.startProcess"),e[11]=l,e[12]=g):g=e[12];let x;e[13]!==g?(x=o.jsx(We,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=o.jsxs(qe,{children:[p,x]}),e[15]=p,e[16]=x,e[17]=b):b=e[17],b}let a;e[18]!==l?(a=l("sandbox.toolbar.stop"),e[18]=l,e[19]=a):a=e[19];let c;e[20]!==r||e[21]!==a?(c=o.jsx(Ke,{asChild:!0,children:o.jsx(ue,{variant:"outline",size:"xs",onClick:r,children:a})}),e[20]=r,e[21]=a,e[22]=c):c=e[22];let d;e[23]!==l?(d=l("sandbox.toolbar.stopProcess"),e[23]=l,e[24]=d):d=e[24];let f;e[25]!==d?(f=o.jsx(We,{children:d}),e[25]=d,e[26]=f):f=e[26];let u;return e[27]!==c||e[28]!==f?(u=o.jsxs(qe,{children:[c,f]}),e[27]=c,e[28]=f,e[29]=u):u=e[29],u}var cC=Object.defineProperty,Wue=Object.getOwnPropertyDescriptor,que=(t,e)=>{for(var s in e)cC(t,s,{get:e[s],enumerable:!0})},Ps=(t,e,s,n)=>{for(var i=n>1?void 0:n?Wue(e,s):e,r=t.length-1,l;r>=0;r--)(l=t[r])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&cC(e,s,i),i},Ge=(t,e)=>(s,n)=>e(s,n,t),Zv="Terminal input",Hp={get:()=>Zv,set:t=>Zv=t},ey="Too much output to announce, navigate to rows manually to read",Kp={get:()=>ey,set:t=>ey=t};function Gue(t){return t.replace(/\r?\n/g,"\r")}function Yue(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function Jue(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function Que(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");dC(i,e,s,n)}}function dC(t,e,s,n){t=Gue(t),t=Yue(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function uC(t,e,s){let n=s.getBoundingClientRect(),i=t.clientX-n.left-10,r=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${i}px`,e.style.top=`${r}px`,e.style.zIndex="1000",e.focus()}function ty(t,e,s,n,i){uC(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Io(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function c1(t,e=0,s=t.length){let n="";for(let i=e;i<s;++i){let r=t[i];r>65535?(r-=65536,n+=String.fromCharCode((r>>10)+55296)+String.fromCharCode(r%1024+56320)):n+=String.fromCharCode(r)}return n}var Xue=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i=0;if(this._interim){let r=t.charCodeAt(i++);56320<=r&&r<=57343?e[n++]=(this._interim-55296)*1024+r-56320+65536:(e[n++]=this._interim,e[n++]=r),this._interim=0}for(let r=i;r<s;++r){let l=t.charCodeAt(r);if(55296<=l&&l<=56319){if(++r>=s)return this._interim=l,n;let a=t.charCodeAt(r);56320<=a&&a<=57343?e[n++]=(l-55296)*1024+a-56320+65536:(e[n++]=l,e[n++]=a);continue}l!==65279&&(e[n++]=l)}return n}},Zue=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i,r,l,a,c=0,d=0;if(this.interim[0]){let h=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-p;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,h=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}h||(x===2?m<128?d--:e[n++]=m:x===3?m<2048||m>=55296&&m<=57343||m===65279||(e[n++]=m):m<65536||m>1114111||(e[n++]=m)),this.interim.fill(0)}let f=s-4,u=d;for(;u<s;){for(;u<f&&!((i=t[u])&128)&&!((r=t[u+1])&128)&&!((l=t[u+2])&128)&&!((a=t[u+3])&128);)e[n++]=i,e[n++]=r,e[n++]=l,e[n++]=a,u+=4;if(i=t[u++],i<128)e[n++]=i;else if((i&224)===192){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(c=(i&31)<<6|r&63,c<128){u--;continue}e[n++]=c}else if((i&240)===224){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[u++],(l&192)!==128){u--;continue}if(c=(i&15)<<12|(r&63)<<6|l&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[n++]=c}else if((i&248)===240){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[u++],(l&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,this.interim[2]=l,n;if(a=t[u++],(a&192)!==128){u--;continue}if(c=(i&7)<<18|(r&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},fC="",Uo=" ",P0=class hC{constructor(){this.fg=0,this.bg=0,this.extended=new $h}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new hC;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},$h=class mC{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new mC(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ai=class pC extends P0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new $h,this.combinedData=""}static fromCharData(e){let s=new pC;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Io(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=e[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},sy="di$target",Wp="di$dependencies",mm=new Map;function e0e(t){return t[Wp]||[]}function nn(t){if(mm.has(t))return mm.get(t);let e=function(s,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");t0e(e,s,i)};return e._id=t,mm.set(t,e),e}function t0e(t,e,s){e[sy]===e?e[Wp].push({id:t,index:s}):(e[Wp]=[{id:t,index:s}],e[sy]=e)}var Pn=nn("BufferService"),gC=nn("CoreMouseService"),wa=nn("CoreService"),s0e=nn("CharsetService"),$x=nn("InstantiationService"),xC=nn("LogService"),En=nn("OptionsService"),bC=nn("OscLinkService"),n0e=nn("UnicodeService"),E0=nn("DecorationService"),qp=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,r=new ai,l=s.getTrimmedLength(),a=-1,c=-1,d=!1;for(let f=0;f<l;f++)if(!(c===-1&&!s.hasContent(f))){if(s.loadCell(f,r),r.hasExtendedAttrs()&&r.extended.urlId)if(c===-1){c=f,a=r.extended.urlId;continue}else d=r.extended.urlId!==a;else c!==-1&&(d=!0);if(d||c!==-1&&f===l-1){let u=this._oscLinkService.getLinkData(a)?.uri;if(u){let h={start:{x:c+1,y:t},end:{x:f+(!d&&f===l-1?1:0),y:t}},m=!1;if(!i?.allowNonHttpProtocols)try{let p=new URL(u);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:u,range:h,activate:(p,g)=>i?i.activate(p,g,h):i0e(p,g),hover:(p,g)=>i?.hover?.(p,g,h),leave:(p,g)=>i?.leave?.(p,g,h)})}d=!1,r.hasExtendedAttrs()&&r.extended.urlId?(c=f,a=r.extended.urlId):(c=-1,a=-1)}}e(n)}};qp=Ps([Ge(0,Pn),Ge(1,En),Ge(2,bC)],qp);function i0e(t,e){if(confirm(`Do you want to navigate to ${e}?
807
807
 
808
808
  WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var d1=nn("CharSizeService"),io=nn("CoreBrowserService"),Bx=nn("MouseService"),ro=nn("RenderService"),r0e=nn("SelectionService"),vC=nn("CharacterJoinerService"),jd=nn("ThemeService"),yC=nn("LinkProviderService"),o0e=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?ny.isErrorNoTelemetry(t)?new ny(t.message+`
809
809