decocms 4.91.13 → 4.91.15

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 (231) hide show
  1. package/dist/client/assets/{AlertCircle-bnM-AHGO.js → AlertCircle-BAVOz-2x.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CGniEng_.js → AreaChart-BBlsfTvH.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-E_r50_2m.js → ArrowUp-CdomKn6E.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-CTGmCwuB.js → ArrowUpRight-DzplOzc9.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-BFjklaOK.js → CheckCircle-BUmTwNEw.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-CKv359F0.js → ChevronDown-BwIAM8yJ.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-CfjLE0HN.js → ChevronRight-CR81Jb7f.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-BXnZQZ3H.js → ChevronUp-CHwBY_gQ.js} +1 -1
  9. package/dist/client/assets/{Copy01-DKZgR_7b.js → Copy01-fXkAnRle.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-C4_fm4pn.js → DotsVertical-CTvul5Hx.js} +1 -1
  11. package/dist/client/assets/{Eye-CAFwHWrY.js → Eye-C56Rqkt8.js} +1 -1
  12. package/dist/client/assets/{FilterLines-BDXLhdvw.js → FilterLines-lTq6Ij1i.js} +1 -1
  13. package/dist/client/assets/{Globe01-BQUa9MmI.js → Globe01-CBAdJxff.js} +1 -1
  14. package/dist/client/assets/{Globe04-CiV5sfOt.js → Globe04-Cf9zDTCT.js} +1 -1
  15. package/dist/client/assets/{HardDrive-CZUPAV8x.js → HardDrive-DvuSdXbu.js} +1 -1
  16. package/dist/client/assets/{Image01-CKQwIs-X.js → Image01-ffA98M16.js} +1 -1
  17. package/dist/client/assets/{Key01-6U7RTmt2.js → Key01-BoS606T3.js} +1 -1
  18. package/dist/client/assets/{LayoutLeft-Dk_UeFQQ.js → LayoutLeft-CaPhxBpK.js} +1 -1
  19. package/dist/client/assets/{LinkExternal01-cD5Jzz7-.js → LinkExternal01-4NcYsJN5.js} +1 -1
  20. package/dist/client/assets/{Monitor01-BgKfGb_C.js → Monitor01-Bf_ipmVo.js} +1 -1
  21. package/dist/client/assets/{Package-BF9Ikoon.js → Package-C6m5hlJG.js} +1 -1
  22. package/dist/client/assets/{Palette-CwbAfJE1.js → Palette-Bog-hkDH.js} +1 -1
  23. package/dist/client/assets/{Play-CcnUngDU.js → Play-CAJLxQxl.js} +1 -1
  24. package/dist/client/assets/{Plus-Da7EO9JW.js → Plus-B5eO3bTy.js} +1 -1
  25. package/dist/client/assets/{SearchLg-BU9kkayS.js → SearchLg-C9KqXDtT.js} +1 -1
  26. package/dist/client/assets/{SearchMd-DvFCXO2G.js → SearchMd-Byn-coVH.js} +1 -1
  27. package/dist/client/assets/{Settings02-DKg6N4zo.js → Settings02-CuWmowxn.js} +1 -1
  28. package/dist/client/assets/{Shield01-Cvfb7wza.js → Shield01-Bca-So8r.js} +1 -1
  29. package/dist/client/assets/{Star01-BaOZVkLR.js → Star01-BeXsAFXb.js} +1 -1
  30. package/dist/client/assets/{Stars01-BCzbdnTA.js → Stars01-hjCPYLmR.js} +1 -1
  31. package/dist/client/assets/{Stars02-DC2mUh1c.js → Stars02-Bvdy1G8F.js} +1 -1
  32. package/dist/client/assets/{Sun-D9Vmvb3x.js → Sun-DaMMLO5r.js} +1 -1
  33. package/dist/client/assets/{SwitchHorizontal01-CIB6pEiS.js → SwitchHorizontal01-D3Ov4m9E.js} +1 -1
  34. package/dist/client/assets/{Tool01-FIiY7fJ0.js → Tool01-BsvXLKqb.js} +1 -1
  35. package/dist/client/assets/{Tool02-B5Nxme6Y.js → Tool02-CSuiCYgo.js} +1 -1
  36. package/dist/client/assets/{Trash01-DgMONZbo.js → Trash01-BNstTg_1.js} +1 -1
  37. package/dist/client/assets/{TrendUp01-AEVL9FCI.js → TrendUp01--z14cIxf.js} +1 -1
  38. package/dist/client/assets/{Upload01-txM4Ed1z.js → Upload01-8kBCAzuF.js} +1 -1
  39. package/dist/client/assets/{User01-CB_k4B4C.js → User01-B6A0_PQ7.js} +1 -1
  40. package/dist/client/assets/{Users01-BBF6f3lO.js → Users01-ovBEB8pw.js} +1 -1
  41. package/dist/client/assets/{Users03-DlrfEd_j.js → Users03-DNyqpf8B.js} +1 -1
  42. package/dist/client/assets/{X-0zKy4PV1.js → X-BLBVAPOy.js} +1 -1
  43. package/dist/client/assets/{XCircle-DjghKaHD.js → XCircle-ZFeyu-0s.js} +1 -1
  44. package/dist/client/assets/{XClose-BG6EvGbU.js → XClose-BOxmZ42j.js} +1 -1
  45. package/dist/client/assets/{Zap-B5UqaMnU.js → Zap-C_1cs5r0.js} +1 -1
  46. package/dist/client/assets/{ZapSquare-zQFlsNS9.js → ZapSquare-Cv314uE4.js} +1 -1
  47. package/dist/client/assets/{ZoomOut-D9TWERka.js → ZoomOut-CQAHgoiD.js} +1 -1
  48. package/dist/client/assets/{access-gate-DNm2pSsB.js → access-gate-ChNZThLC.js} +1 -1
  49. package/dist/client/assets/{add-section-modal-C6oyMnRD.js → add-section-modal-qIs8pZh0.js} +1 -1
  50. package/dist/client/assets/{agent-icon-ChVtquyW.js → agent-icon-CtX3hx5F.js} +1 -1
  51. package/dist/client/assets/{agents-list-n8Ok0pCB.js → agents-list-CDvubk7n.js} +1 -1
  52. package/dist/client/assets/{ai-providers-u4zyABCa.js → ai-providers-Dw4Ws7aR.js} +1 -1
  53. package/dist/client/assets/{alert-Ctnn2jSu.js → alert-C9VZr1JG.js} +1 -1
  54. package/dist/client/assets/{alert-dialog-rb3D-dE0.js → alert-dialog-Q_BwIUfu.js} +1 -1
  55. package/dist/client/assets/{app-editor-C-RUfofU.js → app-editor-Bm6bgVYS.js} +1 -1
  56. package/dist/client/assets/{auth-luIK0osn.js → auth-DWmoiFT3.js} +1 -1
  57. package/dist/client/assets/{auth-catchall-5fvS4lvO.js → auth-catchall-DAPsIyhK.js} +1 -1
  58. package/dist/client/assets/{auth-entry-DEUjBQ6l.js → auth-entry-SHYS_Z04.js} +1 -1
  59. package/dist/client/assets/{auth-split-layout-Bo0-zDty.js → auth-split-layout-BbYX_D2I.js} +1 -1
  60. package/dist/client/assets/{authenticate-and-persist-oauth-D7ClJY6z.js → authenticate-and-persist-oauth-mIivMus1.js} +1 -1
  61. package/dist/client/assets/{automation-list-row-B5YVrOQp.js → automation-list-row-BL6OIn6v.js} +1 -1
  62. package/dist/client/assets/{automation-runs-97vVniQB.js → automation-runs-D4MCi19D.js} +1 -1
  63. package/dist/client/assets/{automations-Bm2fQrjW.js → automations-DCkMyKx3.js} +1 -1
  64. package/dist/client/assets/{autosend-DdGcTLBu.js → autosend-nTHzHKVV.js} +1 -1
  65. package/dist/client/assets/{avatar-BaV7IKOZ.js → avatar-B7H5YfAv.js} +1 -1
  66. package/dist/client/assets/{badge-9gxuzEJo.js → badge-RF6m1wb5.js} +1 -1
  67. package/dist/client/assets/{block-document-BchBm-h5.js → block-document-CLwYPOrS.js} +1 -1
  68. package/dist/client/assets/{brand-context-UEw9ESFM.js → brand-context-BiFVu3Nt.js} +1 -1
  69. package/dist/client/assets/{buckets-FeAEzHbt.js → buckets-Cu-mDC9K.js} +1 -1
  70. package/dist/client/assets/{bulk-category-panel-B45xJdB8.js → bulk-category-panel-CIroraGq.js} +1 -1
  71. package/dist/client/assets/{calendar-CYKpLEK4.js → calendar-EgEumd4K.js} +1 -1
  72. package/dist/client/assets/{capability-load-error-BWNm8Vlx.js → capability-load-error-DpDC2nXy.js} +1 -1
  73. package/dist/client/assets/{card-DzAexHYy.js → card-nbi0jwXg.js} +1 -1
  74. package/dist/client/assets/{category-editor-CocYKaDk.js → category-editor-C7BOhWVs.js} +1 -1
  75. package/dist/client/assets/{chat-context-c0BhAQmo.js → chat-context-CxcCOIx-.js} +1 -1
  76. package/dist/client/assets/{checkbox-_NM5O-zb.js → checkbox-0S0p1Qa5.js} +1 -1
  77. package/dist/client/assets/{cli-auth-success-CORojAqv.js → cli-auth-success-Dl9_nPdl.js} +1 -1
  78. package/dist/client/assets/{collection-detail-DLEcUL_1.js → collection-detail-CnA6DONP.js} +1 -1
  79. package/dist/client/assets/{collection-display-button-K4BxMYlM.js → collection-display-button-B2ZdPE0w.js} +1 -1
  80. package/dist/client/assets/{collection-search-Dt7NiO4g.js → collection-search-BuhzlZH8.js} +1 -1
  81. package/dist/client/assets/{collection-table-wrapper-BCkvrjfu.js → collection-table-wrapper-p2pYSSH6.js} +1 -1
  82. package/dist/client/assets/{collection-tabs-BwZkgBbZ.js → collection-tabs-D-3Qpy7-.js} +1 -1
  83. package/dist/client/assets/{command-Bqg8EvQe.js → command-CepxnYO9.js} +1 -1
  84. package/dist/client/assets/{commerce-onboarding-Dr2cXHZ5.js → commerce-onboarding-Djots0jm.js} +1 -1
  85. package/dist/client/assets/{companions-core-B0Eh3Zr_.js → companions-core-Dg3HSBf0.js} +1 -1
  86. package/dist/client/assets/{connect-desktop-dialog-BOIK_vOw.js → connect-desktop-dialog-CthnsqOM.js} +1 -1
  87. package/dist/client/assets/{connection-card-BUL5tgWk.js → connection-card-rdd2ujA7.js} +1 -1
  88. package/dist/client/assets/{connection-detail-B9bFwLTL.js → connection-detail-DEag1MpP.js} +1 -1
  89. package/dist/client/assets/{connection-form-helpers-Du1LFZ4M.js → connection-form-helpers-Y52B043-.js} +1 -1
  90. package/dist/client/assets/{connections-C2EGW46B.js → connections-ClpkSDn9.js} +1 -1
  91. package/dist/client/assets/{decopilot-sse-pool-BVHOHmrO.js → decopilot-sse-pool-DPMHbwbb.js} +1 -1
  92. package/dist/client/assets/{dialog-DxYV-693.js → dialog-Ccu5eFvd.js} +1 -1
  93. package/dist/client/assets/{domain-settings-DEC2NMgK.js → domain-settings-vAp84nto.js} +1 -1
  94. package/dist/client/assets/{drawer-qstCMw0Q.js → drawer-CTLHO_Po.js} +1 -1
  95. package/dist/client/assets/{dropdown-menu-BQ-1kZyc.js → dropdown-menu-Dq9H83GM.js} +1 -1
  96. package/dist/client/assets/{empty-state-lR_3kEW4.js → empty-state-Bh6MA1Jh.js} +1 -1
  97. package/dist/client/assets/{extract-connection-data-DardgW4l.js → extract-connection-data-CKuJH2zH.js} +1 -1
  98. package/dist/client/assets/{file-explorer-ClqxSbDP.js → file-explorer-CKhmYdvk.js} +1 -1
  99. package/dist/client/assets/{file-type-icon-AZuZgEJR.js → file-type-icon-Bd0oHMYV.js} +1 -1
  100. package/dist/client/assets/{files-DwiZbIlf.js → files-TZe07ele.js} +1 -1
  101. package/dist/client/assets/{form-B5_Adu-q.js → form-B-B5R1Pb.js} +1 -1
  102. package/dist/client/assets/{general-DNgnDbjf.js → general-Bg-yEnP2.js} +1 -1
  103. package/dist/client/assets/{github-repo-picker-Cwo2CoXO.js → github-repo-picker-DCuRF_Em.js} +1 -1
  104. package/dist/client/assets/{hooks-BQfoSwJf.js → hooks-DJCvo0yZ.js} +1 -1
  105. package/dist/client/assets/{index-D6ohfUq5.js → index-BeK7AkFE.js} +1 -1
  106. package/dist/client/assets/{index-Cfp3S5Yv.js → index-Bebyksc0.js} +1 -1
  107. package/dist/client/assets/{index-ClyjgNfZ.js → index-CDjUOYZq.js} +1 -1
  108. package/dist/client/assets/{index-DYw7vW9h.js → index-ChdRNOZ8.js} +1 -1
  109. package/dist/client/assets/{index-bi_pNNOI.js → index-CoFMILd0.js} +1 -1
  110. package/dist/client/assets/{index-c2qA4sKG.js → index-DPFEIozt.js} +1 -1
  111. package/dist/client/assets/{index-6l6Vg_pR.js → index-DfdgvH7q.js} +2 -2
  112. package/dist/client/assets/{index-CJFz8vjp.js → index-Dipox1KZ.js} +1 -1
  113. package/dist/client/assets/{index-DT2lJEWW.js → index-DmzZXnCd.js} +1 -1
  114. package/dist/client/assets/{index-BMMnZ_kU.js → index-K9nNk4ZL.js} +3 -3
  115. package/dist/client/assets/{index-jM9Hlwh7.js → index-ZdLpvqVL.js} +1 -1
  116. package/dist/client/assets/{index--7Dl1ohP.js → index-i_Hm96VD.js} +1 -1
  117. package/dist/client/assets/{index-B2bEP20q.js → index-ow4G_Vs4.js} +1 -1
  118. package/dist/client/assets/{index-redirect-C4H2Dlej.js → index-redirect-De5ze_dU.js} +1 -1
  119. package/dist/client/assets/{index-CihUyKVR.js → index-wvAyIVBW.js} +26 -26
  120. package/dist/client/assets/{input-DO3omnvV.js → input-BTvFP-rc.js} +1 -1
  121. package/dist/client/assets/{integration-icon-CWW8IWzL.js → integration-icon-Dzl5JPvz.js} +1 -1
  122. package/dist/client/assets/{invite-member-dialog-sm_KAm4G.js → invite-member-dialog-CbVVcyGO.js} +1 -1
  123. package/dist/client/assets/{label-mmWPkvpb.js → label-BDx_uIBr.js} +1 -1
  124. package/dist/client/assets/{layout-C13m1wsi.js → layout-CWn7ui_e.js} +1 -1
  125. package/dist/client/assets/{login-LUR3adNp.js → login-C6gf611D.js} +1 -1
  126. package/dist/client/assets/{mcp-oauth-D9VV6Aqh.js → mcp-oauth-CrR55Ybi.js} +1 -1
  127. package/dist/client/assets/{members-DKAWzcSX.js → members-BJw8-N8M.js} +1 -1
  128. package/dist/client/assets/{monaco-editor-B_E5AYPW.js → monaco-editor-B7VLGKpm.js} +1 -1
  129. package/dist/client/assets/{monitoring-stats-row-BQYwpxkV.js → monitoring-stats-row-DcAwFFou.js} +1 -1
  130. package/dist/client/assets/{multi-select-C7fvK2JO.js → multi-select-CEexxbo5.js} +1 -1
  131. package/dist/client/assets/{oauth-callback-Ca0dVhMs.js → oauth-callback-Dtqc-rQz.js} +1 -1
  132. package/dist/client/assets/{oauth-callback-ai-provider-gF8yTd3P.js → oauth-callback-ai-provider-Sc0GBjWy.js} +1 -1
  133. package/dist/client/assets/{onboarding-D-7ZuKQ1.js → onboarding-DbU17zoX.js} +1 -1
  134. package/dist/client/assets/{org-install-BFIHP6cl.js → org-install-C2XcXxC-.js} +1 -1
  135. package/dist/client/assets/{org-layout-CqSGObQ4.js → org-layout-BFL_5bbc.js} +1 -1
  136. package/dist/client/assets/{organization-choice-DImju8iJ.js → organization-choice-BhekRQjj.js} +1 -1
  137. package/dist/client/assets/{orgs-DdB2tyjf.js → orgs-BmpGutsn.js} +1 -1
  138. package/dist/client/assets/{page-seo-form-EY2163Cy.js → page-seo-form-CPW4OXzd.js} +1 -1
  139. package/dist/client/assets/page-seo-sheet-Cylnmhwd.js +1 -0
  140. package/dist/client/assets/{popover-C0PapJhm.js → popover-BUeC8H1A.js} +1 -1
  141. package/dist/client/assets/{post-editor-B-mGeKuB.js → post-editor-BJK7yBbp.js} +1 -1
  142. package/dist/client/assets/{primitives-DGrpSRc_.js → primitives-9MFmR8mW.js} +1 -1
  143. package/dist/client/assets/{profile-D_8r6z9t.js → profile-3ljBANnT.js} +1 -1
  144. package/dist/client/assets/project-app-view-De_35RVp.js +1 -0
  145. package/dist/client/assets/record-editor-XEUZVot7.js +1 -0
  146. package/dist/client/assets/redirect-editor-DnC56ZKk.js +1 -0
  147. package/dist/client/assets/registry-BlWHx3OB.js +2 -0
  148. package/dist/client/assets/{registry-layout-hZdz6-kf.js → registry-layout-PsD4tT-R.js} +2 -2
  149. package/dist/client/assets/{reports-DH7IjchR.js → reports-BigCFVBW.js} +1 -1
  150. package/dist/client/assets/{require-capability-ujl9whCj.js → require-capability-B9yFZhPk.js} +1 -1
  151. package/dist/client/assets/{required-auth-layout-Gxfgdr_y.js → required-auth-layout-Ct_86Yn8.js} +1 -1
  152. package/dist/client/assets/{reset-password-BGTbATLO.js → reset-password-BzoVTsWC.js} +1 -1
  153. package/dist/client/assets/{roles-CWdkMWX4.js → roles-KQJNUpsW.js} +1 -1
  154. package/dist/client/assets/{search-input-B7BOe7-Z.js → search-input-D8Brj2tl.js} +1 -1
  155. package/dist/client/assets/{secrets-BOQDu26Y.js → secrets-DkNysD5B.js} +1 -1
  156. package/dist/client/assets/{sections-editor-D8ChFJlB.js → sections-editor-9QqW6QOK.js} +1 -1
  157. package/dist/client/assets/{select-CEjAa51v.js → select-DkFTH4pS.js} +1 -1
  158. package/dist/client/assets/{select-model-D4cfbFuD.js → select-model-BklSsqwO.js} +1 -1
  159. package/dist/client/assets/{self-tool-result-Cstm1W5n.js → self-tool-result-CGrwaOqB.js} +1 -1
  160. package/dist/client/assets/{seo-editor-CO_OqtSk.js → seo-editor-Bidhz1dJ.js} +1 -1
  161. package/dist/client/assets/{settings-layout-B2-ZFvIt.js → settings-layout-BvnNqnL2.js} +1 -1
  162. package/dist/client/assets/{settings-section-DgtumuNO.js → settings-section-BPiTjvGZ.js} +1 -1
  163. package/dist/client/assets/{shell-controls-DwnH84JX.js → shell-controls-Bk0h78Di.js} +1 -1
  164. package/dist/client/assets/{shell-layout-DKSoLsMT.js → shell-layout-C_fz-LWa.js} +1 -1
  165. package/dist/client/assets/{sidebar-BKJHes1N.js → sidebar-DmkMTXRm.js} +1 -1
  166. package/dist/client/assets/{skeleton-DRYlvCM9.js → skeleton-C31Wi2HR.js} +1 -1
  167. package/dist/client/assets/{sso-TrdYZ9Fq.js → sso-CwKUs7w6.js} +1 -1
  168. package/dist/client/assets/{store-B4jbgj1-.js → store-BtSOklMo.js} +1 -1
  169. package/dist/client/assets/store-registry-CTDSTGMA.js +2 -0
  170. package/dist/client/assets/{studio-tools-B-Eij61m.js → studio-tools-DEV89u5s.js} +1 -1
  171. package/dist/client/assets/{switch-Cu3VZitj.js → switch-Dqu0JsB4.js} +1 -1
  172. package/dist/client/assets/{table-Cms01M2Z.js → table-mM2UZh4-.js} +1 -1
  173. package/dist/client/assets/{tabs-C49u88u9.js → tabs-BmtGU6P3.js} +1 -1
  174. package/dist/client/assets/{textarea-B35vZ5jN.js → textarea-gE88LOd4.js} +1 -1
  175. package/dist/client/assets/{toggle-group-CNog9xMD.js → toggle-group-DZ-PwSy9.js} +1 -1
  176. package/dist/client/assets/{toolbar-BjEknNG8.js → toolbar-BnQrua_4.js} +1 -1
  177. package/dist/client/assets/{toolbar-icon-button-BzzPGdXN.js → toolbar-icon-button-C3nLPKdQ.js} +1 -1
  178. package/dist/client/assets/{tooltip-DGjRuZi1.js → tooltip-QIj4MYXF.js} +1 -1
  179. package/dist/client/assets/{use-ai-providers-CCC_yTQZ.js → use-ai-providers-CvkcDt8z.js} +1 -1
  180. package/dist/client/assets/{use-automations-Dph6FubM.js → use-automations-DA_A7ea0.js} +1 -1
  181. package/dist/client/assets/{use-autosave-CKvDGvgJ.js → use-autosave-TB5vrAcP.js} +1 -1
  182. package/dist/client/assets/{use-capability-CXQN2i28.js → use-capability-B5gueICr.js} +1 -1
  183. package/dist/client/assets/{use-clock-tick-qyYcZOnR.js → use-clock-tick-2Z9dljx4.js} +1 -1
  184. package/dist/client/assets/{use-collections-DfM_LEkP.js → use-collections-BXT57saO.js} +1 -1
  185. package/dist/client/assets/{use-connection-Dtoxwk_v.js → use-connection-B1oTCIml.js} +1 -1
  186. package/dist/client/assets/{use-copy-BVQGJ-sy.js → use-copy-XS6PbPfg.js} +1 -1
  187. package/dist/client/assets/{use-create-virtual-mcp-B0P7lyB0.js → use-create-virtual-mcp-C5vASeGE.js} +1 -1
  188. package/dist/client/assets/{use-debounced-autosave-DDMvbPZQ.js → use-debounced-autosave-CeSRLFvn.js} +1 -1
  189. package/dist/client/assets/{use-debounced-value-CraLUb40.js → use-debounced-value-OYErywlB.js} +1 -1
  190. package/dist/client/assets/{use-deco-credits-NTd3RI-N.js → use-deco-credits-DLdCNMTW.js} +1 -1
  191. package/dist/client/assets/{use-decopilot-events-DATU1apS.js → use-decopilot-events-CW6CBoVI.js} +1 -1
  192. package/dist/client/assets/{use-delete-connection-B6u81CNj.js → use-delete-connection-CyRF8DCa.js} +1 -1
  193. package/dist/client/assets/{use-deployment-admin-Crqnw_bw.js → use-deployment-admin-DBuKyz73.js} +1 -1
  194. package/dist/client/assets/{use-file-configs-wYzg3Q9h.js → use-file-configs-DySKbq7G.js} +1 -1
  195. package/dist/client/assets/{use-infinite-scroll-BQKuGeZW.js → use-infinite-scroll-COEiXKgN.js} +1 -1
  196. package/dist/client/assets/{use-join-requests-BvTFETm1.js → use-join-requests-DJFK9mdy.js} +1 -1
  197. package/dist/client/assets/{use-mcp-auth-status-C9F7z-xG.js → use-mcp-auth-status-CeS-sSG9.js} +1 -1
  198. package/dist/client/assets/{use-mcp-client-BdvBykSl.js → use-mcp-client-E4o51i36.js} +1 -1
  199. package/dist/client/assets/{use-mcp-tools-DwILy75s.js → use-mcp-tools-BmVUrIvT.js} +1 -1
  200. package/dist/client/assets/{use-members-D4YLs-Jc.js → use-members-C_PqWVC0.js} +1 -1
  201. package/dist/client/assets/{use-mobile-Bef-oAkh.js → use-mobile-CDLFoW5F.js} +1 -1
  202. package/dist/client/assets/{use-navigate-to-agent-DC4DOTvY.js → use-navigate-to-agent-DO3W8rHR.js} +1 -1
  203. package/dist/client/assets/{use-org-auth-client-BzbwdJQH.js → use-org-auth-client-D55gdzx_.js} +1 -1
  204. package/dist/client/assets/{use-org-sso-CAvXAkMi.js → use-org-sso-B-C09oWZ.js} +1 -1
  205. package/dist/client/assets/{use-organization-roles-B-rkna0z.js → use-organization-roles-DI1I-ujJ.js} +1 -1
  206. package/dist/client/assets/{use-organization-settings-DR8jU_IF.js → use-organization-settings-CwwJujO2.js} +1 -1
  207. package/dist/client/assets/{use-registry-app-S0Rojzrq.js → use-registry-app-Bg-hKxMQ.js} +1 -1
  208. package/dist/client/assets/{use-registry-connections-BtFws4Kn.js → use-registry-connections-riJqDo6-.js} +1 -1
  209. package/dist/client/assets/{use-secrets-CnOAKTMF.js → use-secrets-DA17vJTD.js} +1 -1
  210. package/dist/client/assets/{use-status-sounds-SizlMvIJ.js → use-status-sounds-CQm_T5_1.js} +1 -1
  211. package/dist/client/assets/{use-t-BPFwceba.js → use-t-BYEA0NnF.js} +1 -1
  212. package/dist/client/assets/{use-view-mode-r4kmYloh.js → use-view-mode-BYYmEzlE.js} +1 -1
  213. package/dist/client/assets/{use-virtual-mcp-CLPxduRS.js → use-virtual-mcp-DWXqRlLT.js} +1 -1
  214. package/dist/client/assets/useInfiniteQuery-Bz26qvcU.js +1 -0
  215. package/dist/client/assets/{useRouterState-_1Yy5uzx.js → useRouterState-BPuzDu75.js} +1 -1
  216. package/dist/client/assets/useSuspenseInfiniteQuery-Vqts_kWq.js +1 -0
  217. package/dist/client/assets/{users-Cv8m_7pY.js → users-BR8qEd2z.js} +1 -1
  218. package/dist/client/assets/{variant-calendar-nyB4vBQj.js → variant-calendar-D08Ns1Fj.js} +1 -1
  219. package/dist/client/assets/{view-mode-toggle-D5W0l3in.js → view-mode-toggle-DGwLr-Wi.js} +1 -1
  220. package/dist/client/index.html +1 -1
  221. package/dist/server/cli.js +1 -1
  222. package/dist/server/server.js +1 -1
  223. package/package.json +1 -1
  224. package/dist/client/assets/page-seo-sheet-B4HcV4Jn.js +0 -1
  225. package/dist/client/assets/project-app-view-Cn_d_3a6.js +0 -1
  226. package/dist/client/assets/record-editor-BNzZA8dM.js +0 -1
  227. package/dist/client/assets/redirect-editor-u8-hgrCH.js +0 -1
  228. package/dist/client/assets/registry-A1ZQQvEy.js +0 -2
  229. package/dist/client/assets/store-registry-DQ7yErTg.js +0 -2
  230. package/dist/client/assets/useInfiniteQuery-CTHi40J6.js +0 -1
  231. package/dist/client/assets/useSuspenseInfiniteQuery-7sOHoy9i.js +0 -1
@@ -1,2 +1,2 @@
1
- import{c as ze,r as N,l as Ee,j as n,B as Ge,i as Fn,n as vs,t as G,K as Ss}from"./index-BMMnZ_kU.js";import{a0 as xs,a1 as bs,a2 as ys,F as In,H as zt,K as zn,P as Hn,i as Un,a3 as _s,U as Wn,V as Gn,a4 as js,G as ks,a5 as ws,J as Yn,L as Rt,O as qn,Q as Jn,M as Qn,Z as Zn,a6 as Xn,a7 as Rs,a8 as Nt,a9 as Ns,S as ea,aa as tt,ab as Ds,ac as Vs,ad as Cs,ae as Ps,e as Ts,k as As,af as Ms,ag as Es,ah as Ks,ai as $s,r as Ot,aj as Bt,ak as Os,al as ut,am as jt,an as Bs,ao as Ls,ap as Je,aq as Dn,ar as Fs,as as kt,at as Lt,au as Is,av as sn,aw as zs,ax as xt,ay as Hs,az as Us,aA as Ws,aB as Gs,aC as Ys,aD as dt,aE as qs,aF as Js,aG as Qs,m as Zs,aH as Vn,aI as wt,aJ as Xs,aK as er,aL as tr,aM as nr,aN as rn,aO as Cn,aP as Pn,aQ as bt,aR as Ft,aS as Tn,aT as ar,aU as on,aV as sr,aW as rr,aX as or,aY as An,aZ as ir}from"./index-CihUyKVR.js";import{t as lr}from"./ChevronDown-CKv359F0.js";import{Y as cn,R as ta,C as cr,w as na,Z as ur,_ as dr}from"./agent-icon-ChVtquyW.js";import{i as aa}from"./ChevronRight-CfjLE0HN.js";import{n as mr}from"./ChevronUp-BXnZQZ3H.js";import{i as fr}from"./Globe01-BQUa9MmI.js";import{m as It}from"./automation-runs-97vVniQB.js";import{b as mt,T as ft,a as pt}from"./tooltip-DGjRuZi1.js";import{a as pr,D as hr,h as gr,c as vr,d as Sr,e as xr}from"./dialog-DxYV-693.js";import{I as br}from"./input-DO3omnvV.js";import{a as sa}from"./Copy01-DKZgR_7b.js";import{b as yr}from"./ZoomOut-D9TWERka.js";import{i as _r}from"./Settings02-DKg6N4zo.js";import{s as jr}from"./Eye-CAFwHWrY.js";import{s as ra}from"./TrendUp01-AEVL9FCI.js";import{s as un}from"./Plus-Da7EO9JW.js";import{s as oa}from"./Trash01-DgMONZbo.js";import{i as kr}from"./Zap-B5UqaMnU.js";import{d as it,a as ia,D as la,c as ca,j as wr}from"./dropdown-menu-BQ-1kZyc.js";import{S as Rr,r as Mn,a as Nr,d as Dr,b as Vr,i as Cr,f as Pr,P as Tr,c as Ar}from"./page-seo-form-EY2163Cy.js";import{b as Mr}from"./Tool01-FIiY7fJ0.js";import{A as Er}from"./add-section-modal-C6oyMnRD.js";import"./ArrowUp-E_r50_2m.js";import"./chat-context-c0BhAQmo.js";import"./autosend-DdGcTLBu.js";import"./hooks-BQfoSwJf.js";import"./use-mcp-client-BdvBykSl.js";import"./auth-luIK0osn.js";import"./decopilot-sse-pool-BVHOHmrO.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./studio-tools-B-Eij61m.js";import"./use-virtual-mcp-CLPxduRS.js";import"./use-collections-DfM_LEkP.js";import"./use-ai-providers-CCC_yTQZ.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-DATU1apS.js";import"./use-organization-settings-DR8jU_IF.js";import"./drawer-qstCMw0Q.js";import"./collection-search-Dt7NiO4g.js";import"./SearchMd-DvFCXO2G.js";import"./use-mobile-Bef-oAkh.js";import"./AreaChart-CGniEng_.js";import"./index-D6ohfUq5.js";import"./calendar-CYKpLEK4.js";import"./X-0zKy4PV1.js";import"./shell-layout-DKSoLsMT.js";import"./avatar-BaV7IKOZ.js";import"./User01-CB_k4B4C.js";import"./Users03-DlrfEd_j.js";import"./SearchLg-BU9kkayS.js";import"./Stars02-DC2mUh1c.js";import"./XClose-BG6EvGbU.js";import"./CheckCircle-BFjklaOK.js";import"./FilterLines-BDXLhdvw.js";import"./use-t-BPFwceba.js";import"./required-auth-layout-Gxfgdr_y.js";import"./use-org-sso-CAvXAkMi.js";import"./index-6l6Vg_pR.js";import"./get-initials-D-f_fDFw.js";import"./SwitchHorizontal01-CIB6pEiS.js";import"./use-registry-app-S0Rojzrq.js";import"./use-mcp-tools-DwILy75s.js";import"./use-connection-Dtoxwk_v.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-D7ClJY6z.js";import"./mcp-oauth-D9VV6Aqh.js";import"./extract-connection-data-DardgW4l.js";import"./use-members-D4YLs-Jc.js";import"./use-org-auth-client-BzbwdJQH.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./AlertCircle-bnM-AHGO.js";import"./DotsVertical-C4_fm4pn.js";import"./popover-C0PapJhm.js";import"./command-Bqg8EvQe.js";import"./index--7Dl1ohP.js";import"./use-copy-BVQGJ-sy.js";import"./LinkExternal01-cD5Jzz7-.js";import"./XCircle-DjghKaHD.js";import"./companions-core-B0Eh3Zr_.js";import"./ZapSquare-zQFlsNS9.js";import"./Star01-BaOZVkLR.js";import"./Image01-CKQwIs-X.js";import"./Upload01-txM4Ed1z.js";import"./form-B5_Adu-q.js";import"./label-mmWPkvpb.js";import"./select-CEjAa51v.js";import"./tabs-C49u88u9.js";import"./Tool02-B5Nxme6Y.js";import"./toggle-group-CNog9xMD.js";import"./use-deco-credits-NTd3RI-N.js";import"./connection-card-BUL5tgWk.js";import"./use-registry-connections-BtFws4Kn.js";import"./useInfiniteQuery-CTHi40J6.js";import"./use-infinite-scroll-BQKuGeZW.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-DzAexHYy.js";import"./integration-icon-CWW8IWzL.js";import"./textarea-B35vZ5jN.js";import"./connection-form-helpers-Du1LFZ4M.js";import"./collection-tabs-BwZkgBbZ.js";import"./badge-9gxuzEJo.js";import"./useSuspenseInfiniteQuery-7sOHoy9i.js";import"./Monitor01-BgKfGb_C.js";import"./connect-desktop-dialog-BOIK_vOw.js";import"./select-model-D4cfbFuD.js";import"./checkbox-_NM5O-zb.js";import"./skeleton-DRYlvCM9.js";import"./Key01-6U7RTmt2.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-DgtumuNO.js";import"./ArrowUpRight-CTGmCwuB.js";import"./Stars01-BCzbdnTA.js";import"./index-jM9Hlwh7.js";import"./Palette-CwbAfJE1.js";import"./alert-dialog-rb3D-dE0.js";import"./file-type-icon-AZuZgEJR.js";import"./toolbar-BjEknNG8.js";import"./Package-BF9Ikoon.js";import"./use-debounced-value-CraLUb40.js";import"./index-Cfp3S5Yv.js";import"./LayoutLeft-Dk_UeFQQ.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-SizlMvIJ.js";import"./empty-state-lR_3kEW4.js";import"./use-capability-CXQN2i28.js";import"./toolbar-icon-button-BzzPGdXN.js";import"./Play-CcnUngDU.js";import"./use-debounced-autosave-DDMvbPZQ.js";import"./index-c2qA4sKG.js";import"./sidebar-BKJHes1N.js";import"./search-input-B7BOe7-Z.js";import"./use-mcp-auth-status-C9F7z-xG.js";import"./switch-Cu3VZitj.js";import"./github-repo-picker-Cwo2CoXO.js";import"./use-navigate-to-agent-DC4DOTvY.js";import"./reusable-new-chat-CouMjkYR.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./Users01-BBF6f3lO.js";import"./use-secrets-CnOAKTMF.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./monaco-editor-B_E5AYPW.js";import"./use-file-configs-wYzg3Q9h.js";import"./use-automations-Dph6FubM.js";import"./automation-list-row-B5YVrOQp.js";import"./Globe04-CiV5sfOt.js";import"./HardDrive-CZUPAV8x.js";import"./Sun-D9Vmvb3x.js";import"./Shield01-Cvfb7wza.js";import"./table-Cms01M2Z.js";import"./use-clock-tick-qyYcZOnR.js";function Kr(m){return m.schema?.definitions??m.schema?.$defs??{}}function $r(m,e){const r=Kr(e),c=r[btoa(m)];if(!c)return;let u=typeof c.image=="string"?c.image:void 0;if(!u&&Array.isArray(c.allOf)){const g=c.allOf.find(S=>typeof S.$ref=="string")?.$ref;if(typeof g=="string"){const S=g.replace("#/definitions/",""),f=r[S];u=typeof f?.image=="string"?f.image:void 0}}if(u?.includes("{{{"))return u}function Or(m,e){if(!e)return;const r=xs(m);if(!r)return;const c=$r(r.resolveType,e);if(!c)return;const u=bs(c,r.data);if(u)return ys(u)}const Br="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Lr="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function En(m){return Array.from({length:m},(e,r)=>({id:crypto.randomUUID(),index:r}))}function ua(m){return m.map((e,r)=>({...e,index:r}))}function Fr(m,e){if(e===m.length)return m;if(e<m.length)return ua(m.slice(0,e));const r=Array.from({length:e-m.length},(c,u)=>({id:crypto.randomUUID(),index:m.length+u}));return[...m,...r]}function da(m){const e=ze.c(20),{section:r,raw:c,meta:u}=m,g=r.isSavedBlock===!0,S=r.isMultivariate===!0;let f;e[0]!==u||e[1]!==c?(f=c&&u?Or(c,u):void 0,e[0]=u,e[1]=c,e[2]=f):f=e[2];const v=f;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(yr,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=h):h=e[3];let x;e[4]!==v?(x=v&&n.jsx("img",{src:v,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=v,e[5]=x):x=e[5];let D;e[6]!==S||e[7]!==g?(D=g?{color:ks}:S?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=S,e[7]=g,e[8]=D):D=e[8];let k;e[9]!==D?(k=n.jsx(cn,{className:"h-4 w-4 shrink-0",style:D}),e[9]=D,e[10]=k):k=e[10];const _=r.isHidden&&"line-through opacity-50";let j;e[11]!==_?(j=Ee("min-w-0 flex-1 truncate text-sm font-medium",_),e[11]=_,e[12]=j):j=e[12];let o;e[13]!==r.label||e[14]!==j?(o=n.jsx("span",{className:j,children:r.label}),e[13]=r.label,e[14]=j,e[15]=o):o=e[15];let w;return e[16]!==x||e[17]!==k||e[18]!==o?(w=n.jsxs(n.Fragment,{children:[h,x,k,o]}),e[16]=x,e[17]=k,e[18]=o,e[19]=w):w=e[19],w}function ma(m,e){const r=m.isSavedBlock===!0,c=m.isMultivariate===!0;return Ee("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?Br:c?"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)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Ir(m){const e=ze.c(64),{section:r,raw:c,meta:u,sortableId:g,selected:S,onSelect:f,onDelete:v,onDuplicate:h,onMakeReusable:x,onToggleHidden:D,onToggleLazy:k,onAddVariant:_,onDetach:j}=m,o=c?Un(c.__resolveType??""):!1;let w;e[0]!==r?(w=_s(r),e[0]=r,e[1]=w):w=e[1];const i=w;let K;e[2]!==g?(K={id:g,animateLayoutChanges:Gr},e[2]=g,e[3]=K):K=e[3];const{attributes:E,listeners:M,setNodeRef:d,transform:P,isDragging:ae}=Wn(K);let T;e[4]!==P?(T=Gn.Transform.toString(P?{...P,x:0}:null),e[4]=P,e[5]=T):T=e[5];const pe=ae?0:void 0;let V;e[6]!==T||e[7]!==pe?(V={transform:T,opacity:pe},e[6]=T,e[7]=pe,e[8]=V):V=e[8];const ce=V;let F;e[9]!==r?(F=js(r),e[9]=r,e[10]=F):F=e[10];const te=F,oe="button",Te=0;let O;e[11]!==f?(O=B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),f())},e[11]=f,e[12]=O):O=e[12];const ue=ae?"cursor-grabbing":"cursor-pointer";let ie;e[13]!==r||e[14]!==S||e[15]!==ue?(ie=Ee("touch-none transition-colors",ue,ma(r,S)),e[13]=r,e[14]=S,e[15]=ue,e[16]=ie):ie=e[16];let je;e[17]!==u||e[18]!==c||e[19]!==r?(je=n.jsx(da,{section:r,raw:c,meta:u}),e[17]=u,e[18]=c,e[19]=r,e[20]=je):je=e[20];const $=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Ee("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:B=>{B.stopPropagation(),k()},onPointerDown:Wr,children:n.jsx(kr,{className:Ee("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(pt,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let Ae;e[21]!==D||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(Ae=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Ee("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:B=>{B.stopPropagation(),D()},onPointerDown:Ur,children:r.isHidden?n.jsx(_r,{className:"h-3.5 w-3.5"}):n.jsx(jr,{className:"h-3.5 w-3.5"})})}),n.jsx(pt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=D,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=Ae):Ae=e[24];let Z;e[25]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx(ia,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Hr,onPointerDown:zr,children:n.jsx(ta,{className:"h-3.5 w-3.5"})})}),e[25]=Z):Z=e[25];let De;e[26]!==h?(De=B=>{B.stopPropagation(),h()},e[26]=h,e[27]=De):De=e[27];let ve;e[28]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx(sa,{className:"h-4 w-4"}),e[28]=ve):ve=e[28];let se;e[29]!==De?(se=n.jsxs(it,{onClick:De,children:[ve,"Duplicate"]}),e[29]=De,e[30]=se):se=e[30];let Y;e[31]!==i||e[32]!==_?(Y=i&&n.jsxs(it,{className:ws,onClick:B=>{B.stopPropagation(),_()},children:[n.jsx(ra,{className:"h-4 w-4"}),"Add variant"]}),e[31]=i,e[32]=_,e[33]=Y):Y=e[33];let q;e[34]!==te||e[35]!==x?(q=te&&n.jsxs(it,{className:Lr,onClick:B=>{B.stopPropagation(),x()},children:[n.jsx(cn,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=te,e[35]=x,e[36]=q):q=e[36];let ne;e[37]!==j||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(ne=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(it,{onClick:B=>{B.stopPropagation(),j()},children:[n.jsx(cn,{className:"h-4 w-4"}),"Detach"]}),e[37]=j,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=ne):ne=e[40];let le;e[41]!==v?(le=B=>{B.stopPropagation(),v()},e[41]=v,e[42]=le):le=e[42];let ke;e[43]===Symbol.for("react.memo_cache_sentinel")?(ke=n.jsx(oa,{className:"h-4 w-4"}),e[43]=ke):ke=e[43];let Se;e[44]!==le?(Se=n.jsxs(it,{className:"text-destructive focus:text-destructive",onClick:le,children:[ke,"Delete"]}),e[44]=le,e[45]=Se):Se=e[45];let de;e[46]!==se||e[47]!==Y||e[48]!==q||e[49]!==ne||e[50]!==Se?(de=n.jsxs(la,{children:[Z,n.jsxs(ca,{align:"end",className:"w-44",children:[se,Y,q,ne,Se]})]}),e[46]=se,e[47]=Y,e[48]=q,e[49]=ne,e[50]=Se,e[51]=de):de=e[51];let ye;return e[52]!==E||e[53]!==M||e[54]!==f||e[55]!==d||e[56]!==ce||e[57]!==ie||e[58]!==je||e[59]!==$||e[60]!==Ae||e[61]!==de||e[62]!==O?(ye=n.jsxs("div",{ref:d,style:ce,...E,...M,role:oe,tabIndex:Te,onClick:f,onKeyDown:O,className:ie,children:[je,$,Ae,de]}),e[52]=E,e[53]=M,e[54]=f,e[55]=d,e[56]=ce,e[57]=ie,e[58]=je,e[59]=$,e[60]=Ae,e[61]=de,e[62]=O,e[63]=ye):ye=e[63],ye}function zr(m){return m.stopPropagation()}function Hr(m){return m.stopPropagation()}function Ur(m){return m.stopPropagation()}function Wr(m){return m.stopPropagation()}function Gr(){return!1}function Yr(m){const e=ze.c(90),{listKey:r,rawSections:c,sections:u,meta:g,selectedIndex:S,onSelect:f,onReorder:v,onDelete:h,onDuplicate:x,onMakeReusable:D,onToggleHidden:k,onToggleLazy:_,onAddVariant:j,onDetach:o,onAddSection:w,canAddSection:i}=m,K=i===void 0?!0:i;let E;e[0]!==u.length?(E=()=>En(u.length),e[0]=u.length,e[1]=E):E=e[1];const[M,d]=N.useState(E),[P,ae]=N.useState(null),[T,pe]=N.useState(r),[V,ce]=N.useState(u.length),F=N.useRef(!1);T!==r?(pe(r),ce(u.length),d(En(u.length))):V!==u.length&&(ce(u.length),d(I=>Fr(I,u.length)));let te;e[2]===Symbol.for("react.memo_cache_sentinel")?(te={activationConstraint:{distance:8}},e[2]=te):te=e[2];let oe;e[3]===Symbol.for("react.memo_cache_sentinel")?(oe={coordinateGetter:Yn},e[3]=oe):oe=e[3];const Te=In(zt(Hn,te),zt(zn,oe));let O;e[4]!==M?(O=M.map(qr),e[4]=M,e[5]=O):O=e[5];const ue=O;let ie;e[6]===Symbol.for("react.memo_cache_sentinel")?(ie=I=>{ae(String(I.active.id))},e[6]=ie):ie=e[6];const je=ie;let $;e[7]!==ue||e[8]!==v?($=I=>{ae(null);const{active:re,over:Q}=I;if(!Q||re.id===Q.id)return;const Ie=ue.indexOf(String(re.id)),he=ue.indexOf(String(Q.id));Ie===-1||he===-1||(d(Qe=>ua(Rt([...Qe],Ie,he))),F.current=!0,requestAnimationFrame(()=>{F.current=!1}),v?.(Ie,he))},e[7]=ue,e[8]=v,e[9]=$):$=e[9];const Ae=$;let Z;e[10]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>{ae(null)},e[10]=Z):Z=e[10];const De=Z;let ve,se,Y,q,ne,le,ke,Se,de,ye,B,X,we,Ke,$e;if(e[11]!==P||e[12]!==K||e[13]!==M||e[14]!==ue||e[15]!==Ae||e[16]!==g||e[17]!==w||e[18]!==j||e[19]!==h||e[20]!==o||e[21]!==x||e[22]!==D||e[23]!==f||e[24]!==k||e[25]!==_||e[26]!==c||e[27]!==u||e[28]!==S||e[29]!==Te){Ke=Symbol.for("react.early_return_sentinel");e:{const I=re=>{F.current||f(re)};if(e[45]!==P||e[46]!==K||e[47]!==M||e[48]!==w||e[49]!==c||e[50]!==u){const re=P?M.find(Q=>Q.id===P):null;if(q=re!=null?u[re.index]:null,Y=re!=null?c[re.index]:void 0,M.length===0){let Q;e[54]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=Q):Q=e[54];const Ie=!K;let he;e[55]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(un,{size:14}),e[55]=he):he=e[55];let Qe;e[56]!==w||e[57]!==Ie?(Qe=n.jsxs("div",{className:"space-y-2",children:[Q,n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ie,onClick:w,children:[he,"Add section"]})]}),e[56]=w,e[57]=Ie,e[58]=Qe):Qe=e[58],Ke=Qe;break e}we=Ee(re&&"cursor-grabbing"),e[45]=P,e[46]=K,e[47]=M,e[48]=w,e[49]=c,e[50]=u,e[51]=Y,e[52]=q,e[53]=we}else Y=e[51],q=e[52],we=e[53];se=qn,Se=Te,de=Jn,ye=je,B=Ae,X=De,ve=Qn,le=ue,ke=Zn,$e="space-y-1",ne=M.map(re=>{const Q=u[re.index];return Q?n.jsx(Ir,{sortableId:re.id,section:Q,raw:c[re.index],meta:g,selected:S===re.index,onSelect:()=>I(re.index),onDelete:()=>h(re.index),onDuplicate:()=>x(re.index),onMakeReusable:()=>D(re.index),onToggleHidden:()=>k(re.index),onToggleLazy:()=>_(re.index),onAddVariant:()=>j(re.index),onDetach:()=>o(re.index)},re.id):null})}e[11]=P,e[12]=K,e[13]=M,e[14]=ue,e[15]=Ae,e[16]=g,e[17]=w,e[18]=j,e[19]=h,e[20]=o,e[21]=x,e[22]=D,e[23]=f,e[24]=k,e[25]=_,e[26]=c,e[27]=u,e[28]=S,e[29]=Te,e[30]=ve,e[31]=se,e[32]=Y,e[33]=q,e[34]=ne,e[35]=le,e[36]=ke,e[37]=Se,e[38]=de,e[39]=ye,e[40]=B,e[41]=X,e[42]=we,e[43]=Ke,e[44]=$e}else ve=e[30],se=e[31],Y=e[32],q=e[33],ne=e[34],le=e[35],ke=e[36],Se=e[37],de=e[38],ye=e[39],B=e[40],X=e[41],we=e[42],Ke=e[43],$e=e[44];if(Ke!==Symbol.for("react.early_return_sentinel"))return Ke;let Le;e[59]!==ne||e[60]!==$e?(Le=n.jsx("div",{className:$e,children:ne}),e[59]=ne,e[60]=$e,e[61]=Le):Le=e[61];let Ce;e[62]!==ve||e[63]!==le||e[64]!==ke||e[65]!==Le?(Ce=n.jsx(ve,{items:le,strategy:ke,children:Le}),e[62]=ve,e[63]=le,e[64]=ke,e[65]=Le,e[66]=Ce):Ce=e[66];let Oe;e[67]!==Y||e[68]!==q||e[69]!==g?(Oe=q?n.jsx("div",{className:Ee("cursor-grabbing shadow-lg ring-1 ring-border/60",ma(q,!1)),children:n.jsx(da,{section:q,raw:Y,meta:g})}):null,e[67]=Y,e[68]=q,e[69]=g,e[70]=Oe):Oe=e[70];let Fe;e[71]!==Oe?(Fe=n.jsx(Xn,{dropAnimation:null,children:Oe}),e[71]=Oe,e[72]=Fe):Fe=e[72];let Me;e[73]!==se||e[74]!==Se||e[75]!==de||e[76]!==ye||e[77]!==B||e[78]!==X||e[79]!==Ce||e[80]!==Fe?(Me=n.jsxs(se,{sensors:Se,collisionDetection:de,onDragStart:ye,onDragEnd:B,onDragCancel:X,children:[Ce,Fe]}),e[73]=se,e[74]=Se,e[75]=de,e[76]=ye,e[77]=B,e[78]=X,e[79]=Ce,e[80]=Fe,e[81]=Me):Me=e[81];const xe=!K;let Re;e[82]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(un,{size:14}),e[82]=Re):Re=e[82];let me;e[83]!==w||e[84]!==xe?(me=n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:xe,onClick:w,children:[Re,"Add section"]}),e[83]=w,e[84]=xe,e[85]=me):me=e[85];let ee;return e[86]!==we||e[87]!==Me||e[88]!==me?(ee=n.jsxs("div",{className:we,children:[Me,me]}),e[86]=we,e[87]=Me,e[88]=me,e[89]=ee):ee=e[89],ee}function qr(m){return m.id}function Kn(m){const e=ze.c(38),{open:r,initialName:c,autoLabel:u,isPending:g,onSubmit:S,onOpenChange:f}=m,v=g===void 0?!1:g,[h,x]=N.useState(c),[D,k]=N.useState(r);r!==D&&(k(r),r&&x(c));let _;e[0]!==v||e[1]!==f?(_=oe=>{!oe&&!v&&f(!1)},e[0]=v,e[1]=f,e[2]=_):_=e[2];const j=_;let o;e[3]!==v||e[4]!==h||e[5]!==S?(o=async oe=>{oe.preventDefault(),!v&&await S(h.trim())},e[3]=v,e[4]=h,e[5]=S,e[6]=o):o=e[6];const w=o;let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(pr,{children:"Rename variant"}),e[7]=i):i=e[7];const K=u||"the rule";let E;e[8]!==K?(E=n.jsxs(hr,{children:[i,n.jsxs(gr,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",n.jsx("span",{className:"font-medium",children:K}),"."]})]}),e[8]=K,e[9]=E):E=e[9];let M;e[10]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=M):M=e[10];let d;e[11]===Symbol.for("react.memo_cache_sentinel")?(d=oe=>x(oe.target.value),e[11]=d):d=e[11];let P;e[12]!==u||e[13]!==v||e[14]!==h?(P=n.jsxs("div",{className:"space-y-1.5 py-4",children:[M,n.jsx(br,{id:"variant-rename-name",value:h,onChange:d,placeholder:u,autoFocus:!0,disabled:v})]}),e[12]=u,e[13]=v,e[14]=h,e[15]=P):P=e[15];let ae;e[16]!==f?(ae=()=>f(!1),e[16]=f,e[17]=ae):ae=e[17];let T;e[18]!==v||e[19]!==ae?(T=n.jsx(Ge,{type:"button",variant:"outline",onClick:ae,disabled:v,children:"Cancel"}),e[18]=v,e[19]=ae,e[20]=T):T=e[20];let pe;e[21]!==v?(pe=v?n.jsxs(n.Fragment,{children:[n.jsx(Fn,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=v,e[22]=pe):pe=e[22];let V;e[23]!==v||e[24]!==pe?(V=n.jsx(Ge,{type:"submit",disabled:v,children:pe}),e[23]=v,e[24]=pe,e[25]=V):V=e[25];let ce;e[26]!==T||e[27]!==V?(ce=n.jsxs(vr,{children:[T,V]}),e[26]=T,e[27]=V,e[28]=ce):ce=e[28];let F;e[29]!==w||e[30]!==ce||e[31]!==E||e[32]!==P?(F=n.jsx(Sr,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:w,children:[E,P,ce]})}),e[29]=w,e[30]=ce,e[31]=E,e[32]=P,e[33]=F):F=e[33];let te;return e[34]!==j||e[35]!==r||e[36]!==F?(te=n.jsx(xr,{open:r,onOpenChange:j,children:F}),e[34]=j,e[35]=r,e[36]=F,e[37]=te):te=e[37],te}const Jr="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)]",fa="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)]";function pa(m){const e=ze.c(5),{rule:r,matchers:c}=m,u=r?.__resolveType??"";let g;if(e[0]!==c||e[1]!==u){const h=c.find(x=>x.resolveType===u)?.iconName??Rs(u);g=cr(h),e[0]=c,e[1]=u,e[2]=g}else g=e[2];const S=g;if(!S)return null;let f;return e[3]!==S?(f=n.jsx(S,{size:14,className:"shrink-0"}),e[3]=S,e[4]=f):f=e[4],f}function $n(m){return m.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
1
+ import{c as ze,r as N,l as Ee,j as n,B as Ge,i as Fn,n as vs,t as G,K as Ss}from"./index-K9nNk4ZL.js";import{a0 as xs,a1 as bs,a2 as ys,F as In,H as zt,K as zn,P as Hn,i as Un,a3 as _s,U as Wn,V as Gn,a4 as js,G as ks,a5 as ws,J as Yn,L as Rt,O as qn,Q as Jn,M as Qn,Z as Zn,a6 as Xn,a7 as Rs,a8 as Nt,a9 as Ns,S as ea,aa as tt,ab as Ds,ac as Vs,ad as Cs,ae as Ps,e as Ts,k as As,af as Ms,ag as Es,ah as Ks,ai as $s,r as Ot,aj as Bt,ak as Os,al as ut,am as jt,an as Bs,ao as Ls,ap as Je,aq as Dn,ar as Fs,as as kt,at as Lt,au as Is,av as sn,aw as zs,ax as xt,ay as Hs,az as Us,aA as Ws,aB as Gs,aC as Ys,aD as dt,aE as qs,aF as Js,aG as Qs,m as Zs,aH as Vn,aI as wt,aJ as Xs,aK as er,aL as tr,aM as nr,aN as rn,aO as Cn,aP as Pn,aQ as bt,aR as Ft,aS as Tn,aT as ar,aU as on,aV as sr,aW as rr,aX as or,aY as An,aZ as ir}from"./index-wvAyIVBW.js";import{t as lr}from"./ChevronDown-BwIAM8yJ.js";import{Y as cn,R as ta,C as cr,w as na,Z as ur,_ as dr}from"./agent-icon-CtX3hx5F.js";import{i as aa}from"./ChevronRight-CR81Jb7f.js";import{n as mr}from"./ChevronUp-CHwBY_gQ.js";import{i as fr}from"./Globe01-CBAdJxff.js";import{m as It}from"./automation-runs-D4MCi19D.js";import{b as mt,T as ft,a as pt}from"./tooltip-QIj4MYXF.js";import{a as pr,D as hr,h as gr,c as vr,d as Sr,e as xr}from"./dialog-Ccu5eFvd.js";import{I as br}from"./input-BTvFP-rc.js";import{a as sa}from"./Copy01-fXkAnRle.js";import{b as yr}from"./ZoomOut-CQAHgoiD.js";import{i as _r}from"./Settings02-CuWmowxn.js";import{s as jr}from"./Eye-C56Rqkt8.js";import{s as ra}from"./TrendUp01--z14cIxf.js";import{s as un}from"./Plus-B5eO3bTy.js";import{s as oa}from"./Trash01-BNstTg_1.js";import{i as kr}from"./Zap-C_1cs5r0.js";import{d as it,a as ia,D as la,c as ca,j as wr}from"./dropdown-menu-Dq9H83GM.js";import{S as Rr,r as Mn,a as Nr,d as Dr,b as Vr,i as Cr,f as Pr,P as Tr,c as Ar}from"./page-seo-form-CPW4OXzd.js";import{b as Mr}from"./Tool01-BsvXLKqb.js";import{A as Er}from"./add-section-modal-qIs8pZh0.js";import"./ArrowUp-CdomKn6E.js";import"./chat-context-CxcCOIx-.js";import"./autosend-nTHzHKVV.js";import"./hooks-DJCvo0yZ.js";import"./use-mcp-client-E4o51i36.js";import"./auth-DWmoiFT3.js";import"./decopilot-sse-pool-DPMHbwbb.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./studio-tools-DEV89u5s.js";import"./use-virtual-mcp-DWXqRlLT.js";import"./use-collections-BXT57saO.js";import"./use-ai-providers-CvkcDt8z.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-CW6CBoVI.js";import"./use-organization-settings-CwwJujO2.js";import"./drawer-CTLHO_Po.js";import"./collection-search-BuhzlZH8.js";import"./SearchMd-Byn-coVH.js";import"./use-mobile-CDLFoW5F.js";import"./AreaChart-BBlsfTvH.js";import"./index-BeK7AkFE.js";import"./calendar-EgEumd4K.js";import"./X-BLBVAPOy.js";import"./shell-layout-C_fz-LWa.js";import"./avatar-B7H5YfAv.js";import"./User01-B6A0_PQ7.js";import"./Users03-DNyqpf8B.js";import"./SearchLg-C9KqXDtT.js";import"./Stars02-Bvdy1G8F.js";import"./XClose-BOxmZ42j.js";import"./CheckCircle-BUmTwNEw.js";import"./FilterLines-lTq6Ij1i.js";import"./use-t-BYEA0NnF.js";import"./required-auth-layout-Ct_86Yn8.js";import"./use-org-sso-B-C09oWZ.js";import"./index-DfdgvH7q.js";import"./get-initials-D-f_fDFw.js";import"./SwitchHorizontal01-D3Ov4m9E.js";import"./use-registry-app-Bg-hKxMQ.js";import"./use-mcp-tools-BmVUrIvT.js";import"./use-connection-B1oTCIml.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-mIivMus1.js";import"./mcp-oauth-CrR55Ybi.js";import"./extract-connection-data-CKuJH2zH.js";import"./use-members-C_PqWVC0.js";import"./use-org-auth-client-D55gdzx_.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./AlertCircle-BAVOz-2x.js";import"./DotsVertical-CTvul5Hx.js";import"./popover-BUeC8H1A.js";import"./command-CepxnYO9.js";import"./index-i_Hm96VD.js";import"./use-copy-XS6PbPfg.js";import"./LinkExternal01-4NcYsJN5.js";import"./XCircle-ZFeyu-0s.js";import"./companions-core-Dg3HSBf0.js";import"./ZapSquare-Cv314uE4.js";import"./Star01-BeXsAFXb.js";import"./Image01-ffA98M16.js";import"./Upload01-8kBCAzuF.js";import"./form-B-B5R1Pb.js";import"./label-BDx_uIBr.js";import"./select-DkFTH4pS.js";import"./tabs-BmtGU6P3.js";import"./Tool02-CSuiCYgo.js";import"./toggle-group-DZ-PwSy9.js";import"./use-deco-credits-DLdCNMTW.js";import"./connection-card-rdd2ujA7.js";import"./use-registry-connections-riJqDo6-.js";import"./useInfiniteQuery-Bz26qvcU.js";import"./use-infinite-scroll-COEiXKgN.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-nbi0jwXg.js";import"./integration-icon-Dzl5JPvz.js";import"./textarea-gE88LOd4.js";import"./connection-form-helpers-Y52B043-.js";import"./collection-tabs-D-3Qpy7-.js";import"./badge-RF6m1wb5.js";import"./useSuspenseInfiniteQuery-Vqts_kWq.js";import"./Monitor01-Bf_ipmVo.js";import"./connect-desktop-dialog-CthnsqOM.js";import"./select-model-BklSsqwO.js";import"./checkbox-0S0p1Qa5.js";import"./skeleton-C31Wi2HR.js";import"./Key01-BoS606T3.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BPiTjvGZ.js";import"./ArrowUpRight-DzplOzc9.js";import"./Stars01-hjCPYLmR.js";import"./index-ZdLpvqVL.js";import"./Palette-Bog-hkDH.js";import"./alert-dialog-Q_BwIUfu.js";import"./file-type-icon-Bd0oHMYV.js";import"./toolbar-BnQrua_4.js";import"./Package-C6m5hlJG.js";import"./use-debounced-value-OYErywlB.js";import"./index-Bebyksc0.js";import"./LayoutLeft-CaPhxBpK.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-CQm_T5_1.js";import"./empty-state-Bh6MA1Jh.js";import"./use-capability-B5gueICr.js";import"./toolbar-icon-button-C3nLPKdQ.js";import"./Play-CAJLxQxl.js";import"./use-debounced-autosave-CeSRLFvn.js";import"./index-DPFEIozt.js";import"./sidebar-DmkMTXRm.js";import"./search-input-D8Brj2tl.js";import"./use-mcp-auth-status-CeS-sSG9.js";import"./switch-Dqu0JsB4.js";import"./github-repo-picker-DCuRF_Em.js";import"./use-navigate-to-agent-DO3W8rHR.js";import"./reusable-new-chat-CouMjkYR.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./Users01-ovBEB8pw.js";import"./use-secrets-DA17vJTD.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./monaco-editor-B7VLGKpm.js";import"./use-file-configs-DySKbq7G.js";import"./use-automations-DA_A7ea0.js";import"./automation-list-row-BL6OIn6v.js";import"./Globe04-Cf9zDTCT.js";import"./HardDrive-DvuSdXbu.js";import"./Sun-DaMMLO5r.js";import"./Shield01-Bca-So8r.js";import"./table-mM2UZh4-.js";import"./use-clock-tick-2Z9dljx4.js";function Kr(m){return m.schema?.definitions??m.schema?.$defs??{}}function $r(m,e){const r=Kr(e),c=r[btoa(m)];if(!c)return;let u=typeof c.image=="string"?c.image:void 0;if(!u&&Array.isArray(c.allOf)){const g=c.allOf.find(S=>typeof S.$ref=="string")?.$ref;if(typeof g=="string"){const S=g.replace("#/definitions/",""),f=r[S];u=typeof f?.image=="string"?f.image:void 0}}if(u?.includes("{{{"))return u}function Or(m,e){if(!e)return;const r=xs(m);if(!r)return;const c=$r(r.resolveType,e);if(!c)return;const u=bs(c,r.data);if(u)return ys(u)}const Br="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Lr="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function En(m){return Array.from({length:m},(e,r)=>({id:crypto.randomUUID(),index:r}))}function ua(m){return m.map((e,r)=>({...e,index:r}))}function Fr(m,e){if(e===m.length)return m;if(e<m.length)return ua(m.slice(0,e));const r=Array.from({length:e-m.length},(c,u)=>({id:crypto.randomUUID(),index:m.length+u}));return[...m,...r]}function da(m){const e=ze.c(20),{section:r,raw:c,meta:u}=m,g=r.isSavedBlock===!0,S=r.isMultivariate===!0;let f;e[0]!==u||e[1]!==c?(f=c&&u?Or(c,u):void 0,e[0]=u,e[1]=c,e[2]=f):f=e[2];const v=f;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(yr,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=h):h=e[3];let x;e[4]!==v?(x=v&&n.jsx("img",{src:v,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=v,e[5]=x):x=e[5];let D;e[6]!==S||e[7]!==g?(D=g?{color:ks}:S?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=S,e[7]=g,e[8]=D):D=e[8];let k;e[9]!==D?(k=n.jsx(cn,{className:"h-4 w-4 shrink-0",style:D}),e[9]=D,e[10]=k):k=e[10];const _=r.isHidden&&"line-through opacity-50";let j;e[11]!==_?(j=Ee("min-w-0 flex-1 truncate text-sm font-medium",_),e[11]=_,e[12]=j):j=e[12];let o;e[13]!==r.label||e[14]!==j?(o=n.jsx("span",{className:j,children:r.label}),e[13]=r.label,e[14]=j,e[15]=o):o=e[15];let w;return e[16]!==x||e[17]!==k||e[18]!==o?(w=n.jsxs(n.Fragment,{children:[h,x,k,o]}),e[16]=x,e[17]=k,e[18]=o,e[19]=w):w=e[19],w}function ma(m,e){const r=m.isSavedBlock===!0,c=m.isMultivariate===!0;return Ee("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?Br:c?"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)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Ir(m){const e=ze.c(64),{section:r,raw:c,meta:u,sortableId:g,selected:S,onSelect:f,onDelete:v,onDuplicate:h,onMakeReusable:x,onToggleHidden:D,onToggleLazy:k,onAddVariant:_,onDetach:j}=m,o=c?Un(c.__resolveType??""):!1;let w;e[0]!==r?(w=_s(r),e[0]=r,e[1]=w):w=e[1];const i=w;let K;e[2]!==g?(K={id:g,animateLayoutChanges:Gr},e[2]=g,e[3]=K):K=e[3];const{attributes:E,listeners:M,setNodeRef:d,transform:P,isDragging:ae}=Wn(K);let T;e[4]!==P?(T=Gn.Transform.toString(P?{...P,x:0}:null),e[4]=P,e[5]=T):T=e[5];const pe=ae?0:void 0;let V;e[6]!==T||e[7]!==pe?(V={transform:T,opacity:pe},e[6]=T,e[7]=pe,e[8]=V):V=e[8];const ce=V;let F;e[9]!==r?(F=js(r),e[9]=r,e[10]=F):F=e[10];const te=F,oe="button",Te=0;let O;e[11]!==f?(O=B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),f())},e[11]=f,e[12]=O):O=e[12];const ue=ae?"cursor-grabbing":"cursor-pointer";let ie;e[13]!==r||e[14]!==S||e[15]!==ue?(ie=Ee("touch-none transition-colors",ue,ma(r,S)),e[13]=r,e[14]=S,e[15]=ue,e[16]=ie):ie=e[16];let je;e[17]!==u||e[18]!==c||e[19]!==r?(je=n.jsx(da,{section:r,raw:c,meta:u}),e[17]=u,e[18]=c,e[19]=r,e[20]=je):je=e[20];const $=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Ee("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:B=>{B.stopPropagation(),k()},onPointerDown:Wr,children:n.jsx(kr,{className:Ee("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(pt,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let Ae;e[21]!==D||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(Ae=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Ee("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:B=>{B.stopPropagation(),D()},onPointerDown:Ur,children:r.isHidden?n.jsx(_r,{className:"h-3.5 w-3.5"}):n.jsx(jr,{className:"h-3.5 w-3.5"})})}),n.jsx(pt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=D,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=Ae):Ae=e[24];let Z;e[25]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx(ia,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Hr,onPointerDown:zr,children:n.jsx(ta,{className:"h-3.5 w-3.5"})})}),e[25]=Z):Z=e[25];let De;e[26]!==h?(De=B=>{B.stopPropagation(),h()},e[26]=h,e[27]=De):De=e[27];let ve;e[28]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx(sa,{className:"h-4 w-4"}),e[28]=ve):ve=e[28];let se;e[29]!==De?(se=n.jsxs(it,{onClick:De,children:[ve,"Duplicate"]}),e[29]=De,e[30]=se):se=e[30];let Y;e[31]!==i||e[32]!==_?(Y=i&&n.jsxs(it,{className:ws,onClick:B=>{B.stopPropagation(),_()},children:[n.jsx(ra,{className:"h-4 w-4"}),"Add variant"]}),e[31]=i,e[32]=_,e[33]=Y):Y=e[33];let q;e[34]!==te||e[35]!==x?(q=te&&n.jsxs(it,{className:Lr,onClick:B=>{B.stopPropagation(),x()},children:[n.jsx(cn,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=te,e[35]=x,e[36]=q):q=e[36];let ne;e[37]!==j||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(ne=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(it,{onClick:B=>{B.stopPropagation(),j()},children:[n.jsx(cn,{className:"h-4 w-4"}),"Detach"]}),e[37]=j,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=ne):ne=e[40];let le;e[41]!==v?(le=B=>{B.stopPropagation(),v()},e[41]=v,e[42]=le):le=e[42];let ke;e[43]===Symbol.for("react.memo_cache_sentinel")?(ke=n.jsx(oa,{className:"h-4 w-4"}),e[43]=ke):ke=e[43];let Se;e[44]!==le?(Se=n.jsxs(it,{className:"text-destructive focus:text-destructive",onClick:le,children:[ke,"Delete"]}),e[44]=le,e[45]=Se):Se=e[45];let de;e[46]!==se||e[47]!==Y||e[48]!==q||e[49]!==ne||e[50]!==Se?(de=n.jsxs(la,{children:[Z,n.jsxs(ca,{align:"end",className:"w-44",children:[se,Y,q,ne,Se]})]}),e[46]=se,e[47]=Y,e[48]=q,e[49]=ne,e[50]=Se,e[51]=de):de=e[51];let ye;return e[52]!==E||e[53]!==M||e[54]!==f||e[55]!==d||e[56]!==ce||e[57]!==ie||e[58]!==je||e[59]!==$||e[60]!==Ae||e[61]!==de||e[62]!==O?(ye=n.jsxs("div",{ref:d,style:ce,...E,...M,role:oe,tabIndex:Te,onClick:f,onKeyDown:O,className:ie,children:[je,$,Ae,de]}),e[52]=E,e[53]=M,e[54]=f,e[55]=d,e[56]=ce,e[57]=ie,e[58]=je,e[59]=$,e[60]=Ae,e[61]=de,e[62]=O,e[63]=ye):ye=e[63],ye}function zr(m){return m.stopPropagation()}function Hr(m){return m.stopPropagation()}function Ur(m){return m.stopPropagation()}function Wr(m){return m.stopPropagation()}function Gr(){return!1}function Yr(m){const e=ze.c(90),{listKey:r,rawSections:c,sections:u,meta:g,selectedIndex:S,onSelect:f,onReorder:v,onDelete:h,onDuplicate:x,onMakeReusable:D,onToggleHidden:k,onToggleLazy:_,onAddVariant:j,onDetach:o,onAddSection:w,canAddSection:i}=m,K=i===void 0?!0:i;let E;e[0]!==u.length?(E=()=>En(u.length),e[0]=u.length,e[1]=E):E=e[1];const[M,d]=N.useState(E),[P,ae]=N.useState(null),[T,pe]=N.useState(r),[V,ce]=N.useState(u.length),F=N.useRef(!1);T!==r?(pe(r),ce(u.length),d(En(u.length))):V!==u.length&&(ce(u.length),d(I=>Fr(I,u.length)));let te;e[2]===Symbol.for("react.memo_cache_sentinel")?(te={activationConstraint:{distance:8}},e[2]=te):te=e[2];let oe;e[3]===Symbol.for("react.memo_cache_sentinel")?(oe={coordinateGetter:Yn},e[3]=oe):oe=e[3];const Te=In(zt(Hn,te),zt(zn,oe));let O;e[4]!==M?(O=M.map(qr),e[4]=M,e[5]=O):O=e[5];const ue=O;let ie;e[6]===Symbol.for("react.memo_cache_sentinel")?(ie=I=>{ae(String(I.active.id))},e[6]=ie):ie=e[6];const je=ie;let $;e[7]!==ue||e[8]!==v?($=I=>{ae(null);const{active:re,over:Q}=I;if(!Q||re.id===Q.id)return;const Ie=ue.indexOf(String(re.id)),he=ue.indexOf(String(Q.id));Ie===-1||he===-1||(d(Qe=>ua(Rt([...Qe],Ie,he))),F.current=!0,requestAnimationFrame(()=>{F.current=!1}),v?.(Ie,he))},e[7]=ue,e[8]=v,e[9]=$):$=e[9];const Ae=$;let Z;e[10]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>{ae(null)},e[10]=Z):Z=e[10];const De=Z;let ve,se,Y,q,ne,le,ke,Se,de,ye,B,X,we,Ke,$e;if(e[11]!==P||e[12]!==K||e[13]!==M||e[14]!==ue||e[15]!==Ae||e[16]!==g||e[17]!==w||e[18]!==j||e[19]!==h||e[20]!==o||e[21]!==x||e[22]!==D||e[23]!==f||e[24]!==k||e[25]!==_||e[26]!==c||e[27]!==u||e[28]!==S||e[29]!==Te){Ke=Symbol.for("react.early_return_sentinel");e:{const I=re=>{F.current||f(re)};if(e[45]!==P||e[46]!==K||e[47]!==M||e[48]!==w||e[49]!==c||e[50]!==u){const re=P?M.find(Q=>Q.id===P):null;if(q=re!=null?u[re.index]:null,Y=re!=null?c[re.index]:void 0,M.length===0){let Q;e[54]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=Q):Q=e[54];const Ie=!K;let he;e[55]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(un,{size:14}),e[55]=he):he=e[55];let Qe;e[56]!==w||e[57]!==Ie?(Qe=n.jsxs("div",{className:"space-y-2",children:[Q,n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ie,onClick:w,children:[he,"Add section"]})]}),e[56]=w,e[57]=Ie,e[58]=Qe):Qe=e[58],Ke=Qe;break e}we=Ee(re&&"cursor-grabbing"),e[45]=P,e[46]=K,e[47]=M,e[48]=w,e[49]=c,e[50]=u,e[51]=Y,e[52]=q,e[53]=we}else Y=e[51],q=e[52],we=e[53];se=qn,Se=Te,de=Jn,ye=je,B=Ae,X=De,ve=Qn,le=ue,ke=Zn,$e="space-y-1",ne=M.map(re=>{const Q=u[re.index];return Q?n.jsx(Ir,{sortableId:re.id,section:Q,raw:c[re.index],meta:g,selected:S===re.index,onSelect:()=>I(re.index),onDelete:()=>h(re.index),onDuplicate:()=>x(re.index),onMakeReusable:()=>D(re.index),onToggleHidden:()=>k(re.index),onToggleLazy:()=>_(re.index),onAddVariant:()=>j(re.index),onDetach:()=>o(re.index)},re.id):null})}e[11]=P,e[12]=K,e[13]=M,e[14]=ue,e[15]=Ae,e[16]=g,e[17]=w,e[18]=j,e[19]=h,e[20]=o,e[21]=x,e[22]=D,e[23]=f,e[24]=k,e[25]=_,e[26]=c,e[27]=u,e[28]=S,e[29]=Te,e[30]=ve,e[31]=se,e[32]=Y,e[33]=q,e[34]=ne,e[35]=le,e[36]=ke,e[37]=Se,e[38]=de,e[39]=ye,e[40]=B,e[41]=X,e[42]=we,e[43]=Ke,e[44]=$e}else ve=e[30],se=e[31],Y=e[32],q=e[33],ne=e[34],le=e[35],ke=e[36],Se=e[37],de=e[38],ye=e[39],B=e[40],X=e[41],we=e[42],Ke=e[43],$e=e[44];if(Ke!==Symbol.for("react.early_return_sentinel"))return Ke;let Le;e[59]!==ne||e[60]!==$e?(Le=n.jsx("div",{className:$e,children:ne}),e[59]=ne,e[60]=$e,e[61]=Le):Le=e[61];let Ce;e[62]!==ve||e[63]!==le||e[64]!==ke||e[65]!==Le?(Ce=n.jsx(ve,{items:le,strategy:ke,children:Le}),e[62]=ve,e[63]=le,e[64]=ke,e[65]=Le,e[66]=Ce):Ce=e[66];let Oe;e[67]!==Y||e[68]!==q||e[69]!==g?(Oe=q?n.jsx("div",{className:Ee("cursor-grabbing shadow-lg ring-1 ring-border/60",ma(q,!1)),children:n.jsx(da,{section:q,raw:Y,meta:g})}):null,e[67]=Y,e[68]=q,e[69]=g,e[70]=Oe):Oe=e[70];let Fe;e[71]!==Oe?(Fe=n.jsx(Xn,{dropAnimation:null,children:Oe}),e[71]=Oe,e[72]=Fe):Fe=e[72];let Me;e[73]!==se||e[74]!==Se||e[75]!==de||e[76]!==ye||e[77]!==B||e[78]!==X||e[79]!==Ce||e[80]!==Fe?(Me=n.jsxs(se,{sensors:Se,collisionDetection:de,onDragStart:ye,onDragEnd:B,onDragCancel:X,children:[Ce,Fe]}),e[73]=se,e[74]=Se,e[75]=de,e[76]=ye,e[77]=B,e[78]=X,e[79]=Ce,e[80]=Fe,e[81]=Me):Me=e[81];const xe=!K;let Re;e[82]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(un,{size:14}),e[82]=Re):Re=e[82];let me;e[83]!==w||e[84]!==xe?(me=n.jsxs(Ge,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:xe,onClick:w,children:[Re,"Add section"]}),e[83]=w,e[84]=xe,e[85]=me):me=e[85];let ee;return e[86]!==we||e[87]!==Me||e[88]!==me?(ee=n.jsxs("div",{className:we,children:[Me,me]}),e[86]=we,e[87]=Me,e[88]=me,e[89]=ee):ee=e[89],ee}function qr(m){return m.id}function Kn(m){const e=ze.c(38),{open:r,initialName:c,autoLabel:u,isPending:g,onSubmit:S,onOpenChange:f}=m,v=g===void 0?!1:g,[h,x]=N.useState(c),[D,k]=N.useState(r);r!==D&&(k(r),r&&x(c));let _;e[0]!==v||e[1]!==f?(_=oe=>{!oe&&!v&&f(!1)},e[0]=v,e[1]=f,e[2]=_):_=e[2];const j=_;let o;e[3]!==v||e[4]!==h||e[5]!==S?(o=async oe=>{oe.preventDefault(),!v&&await S(h.trim())},e[3]=v,e[4]=h,e[5]=S,e[6]=o):o=e[6];const w=o;let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(pr,{children:"Rename variant"}),e[7]=i):i=e[7];const K=u||"the rule";let E;e[8]!==K?(E=n.jsxs(hr,{children:[i,n.jsxs(gr,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",n.jsx("span",{className:"font-medium",children:K}),"."]})]}),e[8]=K,e[9]=E):E=e[9];let M;e[10]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=M):M=e[10];let d;e[11]===Symbol.for("react.memo_cache_sentinel")?(d=oe=>x(oe.target.value),e[11]=d):d=e[11];let P;e[12]!==u||e[13]!==v||e[14]!==h?(P=n.jsxs("div",{className:"space-y-1.5 py-4",children:[M,n.jsx(br,{id:"variant-rename-name",value:h,onChange:d,placeholder:u,autoFocus:!0,disabled:v})]}),e[12]=u,e[13]=v,e[14]=h,e[15]=P):P=e[15];let ae;e[16]!==f?(ae=()=>f(!1),e[16]=f,e[17]=ae):ae=e[17];let T;e[18]!==v||e[19]!==ae?(T=n.jsx(Ge,{type:"button",variant:"outline",onClick:ae,disabled:v,children:"Cancel"}),e[18]=v,e[19]=ae,e[20]=T):T=e[20];let pe;e[21]!==v?(pe=v?n.jsxs(n.Fragment,{children:[n.jsx(Fn,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=v,e[22]=pe):pe=e[22];let V;e[23]!==v||e[24]!==pe?(V=n.jsx(Ge,{type:"submit",disabled:v,children:pe}),e[23]=v,e[24]=pe,e[25]=V):V=e[25];let ce;e[26]!==T||e[27]!==V?(ce=n.jsxs(vr,{children:[T,V]}),e[26]=T,e[27]=V,e[28]=ce):ce=e[28];let F;e[29]!==w||e[30]!==ce||e[31]!==E||e[32]!==P?(F=n.jsx(Sr,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:w,children:[E,P,ce]})}),e[29]=w,e[30]=ce,e[31]=E,e[32]=P,e[33]=F):F=e[33];let te;return e[34]!==j||e[35]!==r||e[36]!==F?(te=n.jsx(xr,{open:r,onOpenChange:j,children:F}),e[34]=j,e[35]=r,e[36]=F,e[37]=te):te=e[37],te}const Jr="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)]",fa="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)]";function pa(m){const e=ze.c(5),{rule:r,matchers:c}=m,u=r?.__resolveType??"";let g;if(e[0]!==c||e[1]!==u){const h=c.find(x=>x.resolveType===u)?.iconName??Rs(u);g=cr(h),e[0]=c,e[1]=u,e[2]=g}else g=e[2];const S=g;if(!S)return null;let f;return e[3]!==S?(f=n.jsx(S,{size:14,className:"shrink-0"}),e[3]=S,e[4]=f):f=e[4],f}function $n(m){return m.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
2
2
  `)}function ln(m){return m.map((e,r)=>({id:crypto.randomUUID(),index:r,variant:e}))}function Qr(m){return m.map((e,r)=>({...e,index:r}))}function ha(m){const e=ze.c(16),{label:r,effectiveRule:c,matchers:u,canDelete:g,dragging:S,onRename:f,onDuplicate:v,onDelete:h}=m;let x;e[0]!==c||e[1]!==u?(x=n.jsx(pa,{rule:c,matchers:u}),e[0]=c,e[1]=u,e[2]=x):x=e[2];let D;e[3]!==r?(D=n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r}),e[3]=r,e[4]=D):D=e[4];let k;e[5]!==g||e[6]!==S||e[7]!==r||e[8]!==h||e[9]!==v||e[10]!==f?(k=!S&&n.jsxs(la,{children:[n.jsx(ia,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":`Actions for ${r}`,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:Xr,onPointerDown:Zr,children:n.jsx(ta,{size:14})})}),n.jsxs(ca,{align:"end",className:"w-36",children:[n.jsxs(it,{onClick:j=>{j.stopPropagation(),f?.()},children:[n.jsx(Mr,{size:14}),"Rename"]}),n.jsxs(it,{onClick:j=>{j.stopPropagation(),v?.()},children:[n.jsx(sa,{size:14}),"Duplicate"]}),n.jsx(wr,{}),n.jsxs(it,{variant:"destructive",disabled:!g,onClick:j=>{j.stopPropagation(),h?.()},children:[n.jsx(oa,{size:14}),"Delete"]})]})]}),e[5]=g,e[6]=S,e[7]=r,e[8]=h,e[9]=v,e[10]=f,e[11]=k):k=e[11];let _;return e[12]!==x||e[13]!==D||e[14]!==k?(_=n.jsxs(n.Fragment,{children:[x,D,k]}),e[12]=x,e[13]=D,e[14]=k,e[15]=_):_=e[15],_}function Zr(m){return m.stopPropagation()}function Xr(m){return m.stopPropagation()}function eo(m){const e=ze.c(33),{entry:r,sortableId:c,isActive:u,canDelete:g,decofile:S,meta:f,matchers:v,onSelect:h,onRename:x,onDuplicate:D,onDelete:k}=m;let _;e[0]!==c?(_={id:c,animateLayoutChanges:to},e[0]=c,e[1]=_):_=e[1];const{attributes:j,listeners:o,setNodeRef:w,transform:i,isDragging:K}=Wn(_);let E;e[2]!==i?(E=Gn.Transform.toString(i?{...i,x:0}:null),e[2]=i,e[3]=E):E=e[3];const M=K?0:void 0;let d;e[4]!==E||e[5]!==M?(d={transform:E,opacity:M},e[4]=E,e[5]=M,e[6]=d):d=e[6];const P=d,ae=f??void 0;let T;e[7]!==S||e[8]!==r.variant.rule||e[9]!==ae?(T=Nt(r.variant.rule,S,ae),e[7]=S,e[8]=r.variant.rule,e[9]=ae,e[10]=T):T=e[10];const pe=T;let V;e[11]!==h?(V=O=>{O.target===O.currentTarget&&(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),h())},e[11]=h,e[12]=V):V=e[12];const ce=K?"cursor-grabbing":"cursor-pointer active:cursor-grabbing",F=u?fa:Jr;let te;e[13]!==ce||e[14]!==F?(te=Ee("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",ce,F),e[13]=ce,e[14]=F,e[15]=te):te=e[15];let oe;e[16]!==g||e[17]!==pe||e[18]!==r.variant.label||e[19]!==v||e[20]!==k||e[21]!==D||e[22]!==x?(oe=n.jsx(ha,{label:r.variant.label,effectiveRule:pe,matchers:v,canDelete:g,onRename:x,onDuplicate:D,onDelete:k}),e[16]=g,e[17]=pe,e[18]=r.variant.label,e[19]=v,e[20]=k,e[21]=D,e[22]=x,e[23]=oe):oe=e[23];let Te;return e[24]!==j||e[25]!==o||e[26]!==h||e[27]!==w||e[28]!==P||e[29]!==te||e[30]!==oe||e[31]!==V?(Te=n.jsx("div",{ref:w,style:P,...j,...o,onClick:h,onKeyDown:V,className:te,children:oe}),e[24]=j,e[25]=o,e[26]=h,e[27]=w,e[28]=P,e[29]=te,e[30]=oe,e[31]=V,e[32]=Te):Te=e[32],Te}function to(){return!1}function no(m){const e=ze.c(9),{variant:r,decofile:c,meta:u,matchers:g}=m,S=u??void 0;let f;e[0]!==c||e[1]!==S||e[2]!==r.rule?(f=Nt(r.rule,c,S),e[0]=c,e[1]=S,e[2]=r.rule,e[3]=f):f=e[3];const v=f;let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=Ee("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",fa),e[4]=h):h=e[4];let x;return e[5]!==v||e[6]!==g||e[7]!==r.label?(x=n.jsx("div",{className:h,children:n.jsx(ha,{label:r.label,effectiveRule:v,matchers:g,canDelete:!1,dragging:!0})}),e[5]=v,e[6]=g,e[7]=r.label,e[8]=x):x=e[8],x}function ao(m){const e=ze.c(77),{listKey:r,variants:c,activeIndex:u,decofile:g,meta:S,matchers:f,onSelect:v,onReorder:h,onRename:x,onDuplicate:D,onDelete:k,onAdd:_}=m;let j;e[0]!==c?(j=()=>ln(c),e[0]=c,e[1]=j):j=e[1];const[o,w]=N.useState(j),[i,K]=N.useState(null),[E,M]=N.useState(r),[d,P]=N.useState(c.length);let ae;e[2]!==c?(ae=()=>$n(c),e[2]=c,e[3]=ae):ae=e[3];const[T,pe]=N.useState(ae),V=N.useRef(!1),ce=$n(c);E!==r?(M(r),P(c.length),pe(ce),w(ln(c))):d!==c.length?(P(c.length),pe(ce),w(ln(c))):T!==ce&&(pe(ce),w(Me=>c.map((xe,Re)=>({id:Me[Re]?.id??crypto.randomUUID(),index:Re,variant:xe}))));let F;e[4]===Symbol.for("react.memo_cache_sentinel")?(F={activationConstraint:{distance:8}},e[4]=F):F=e[4];let te;e[5]===Symbol.for("react.memo_cache_sentinel")?(te={coordinateGetter:Yn},e[5]=te):te=e[5];const oe=In(zt(Hn,F),zt(zn,te));let Te;e[6]!==o?(Te=o.map(so),e[6]=o,e[7]=Te):Te=e[7];const O=Te,ue=c.length>1;let ie;e[8]!==o?(ie=Me=>{const xe=String(Me.active.id);K(o.find(Re=>Re.id===xe)??null)},e[8]=o,e[9]=ie):ie=e[9];const je=ie;let $;e[10]!==O||e[11]!==h?($=Me=>{K(null);const{active:xe,over:Re}=Me;if(!Re||xe.id===Re.id)return;const me=O.indexOf(String(xe.id)),ee=O.indexOf(String(Re.id));me===-1||ee===-1||(w(I=>Qr(Rt([...I],me,ee))),V.current=!0,requestAnimationFrame(()=>{V.current=!1}),h(me,ee))},e[10]=O,e[11]=h,e[12]=$):$=e[12];const Ae=$;let Z;e[13]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>{K(null)},e[13]=Z):Z=e[13];const De=Z;let ve,se,Y,q,ne,le,ke,Se,de,ye,B,X,we;if(e[14]!==u||e[15]!==ue||e[16]!==g||e[17]!==o||e[18]!==O||e[19]!==Ae||e[20]!==je||e[21]!==f||e[22]!==S||e[23]!==_||e[24]!==k||e[25]!==D||e[26]!==x||e[27]!==v||e[28]!==oe){const Me=I=>{V.current||v(I)};B="space-y-1 border-b p-2";let xe;e[42]===Symbol.for("react.memo_cache_sentinel")?(xe=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variants"}),e[42]=xe):xe=e[42];let Re;e[43]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(un,{size:14}),e[43]=Re):Re=e[43];let me;e[44]!==_?(me=n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-6",onClick:_,children:Re})}),e[44]=_,e[45]=me):me=e[45];let ee;e[46]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx(pt,{children:"Add variant"}),e[46]=ee):ee=e[46],e[47]!==me?(X=n.jsxs("div",{className:"flex items-center justify-between",children:[xe,n.jsxs(mt,{children:[me,ee]})]}),e[47]=me,e[48]=X):X=e[48],se=qn,le=oe,ke=Jn,Se=je,de=Ae,ye=De,ve=Qn,q=O,ne=Zn,we="space-y-0.5",Y=o.map(I=>n.jsx(eo,{sortableId:I.id,entry:I,isActive:I.index===u,canDelete:ue,decofile:g,meta:S,matchers:f,onSelect:()=>Me(I.index),onRename:()=>x(I.index),onDuplicate:()=>D(I.index),onDelete:()=>k(I.index)},I.id)),e[14]=u,e[15]=ue,e[16]=g,e[17]=o,e[18]=O,e[19]=Ae,e[20]=je,e[21]=f,e[22]=S,e[23]=_,e[24]=k,e[25]=D,e[26]=x,e[27]=v,e[28]=oe,e[29]=ve,e[30]=se,e[31]=Y,e[32]=q,e[33]=ne,e[34]=le,e[35]=ke,e[36]=Se,e[37]=de,e[38]=ye,e[39]=B,e[40]=X,e[41]=we}else ve=e[29],se=e[30],Y=e[31],q=e[32],ne=e[33],le=e[34],ke=e[35],Se=e[36],de=e[37],ye=e[38],B=e[39],X=e[40],we=e[41];let Ke;e[49]!==Y||e[50]!==we?(Ke=n.jsx("div",{className:we,children:Y}),e[49]=Y,e[50]=we,e[51]=Ke):Ke=e[51];let $e;e[52]!==ve||e[53]!==q||e[54]!==ne||e[55]!==Ke?($e=n.jsx(ve,{items:q,strategy:ne,children:Ke}),e[52]=ve,e[53]=q,e[54]=ne,e[55]=Ke,e[56]=$e):$e=e[56];let Le;e[57]!==i||e[58]!==g||e[59]!==f||e[60]!==S?(Le=i?n.jsx(no,{variant:i.variant,decofile:g,meta:S,matchers:f}):null,e[57]=i,e[58]=g,e[59]=f,e[60]=S,e[61]=Le):Le=e[61];let Ce;e[62]!==Le?(Ce=n.jsx(Xn,{dropAnimation:null,children:Le}),e[62]=Le,e[63]=Ce):Ce=e[63];let Oe;e[64]!==se||e[65]!==le||e[66]!==ke||e[67]!==Se||e[68]!==de||e[69]!==ye||e[70]!==$e||e[71]!==Ce?(Oe=n.jsxs(se,{sensors:le,collisionDetection:ke,onDragStart:Se,onDragEnd:de,onDragCancel:ye,children:[$e,Ce]}),e[64]=se,e[65]=le,e[66]=ke,e[67]=Se,e[68]=de,e[69]=ye,e[70]=$e,e[71]=Ce,e[72]=Oe):Oe=e[72];let Fe;return e[73]!==B||e[74]!==X||e[75]!==Oe?(Fe=n.jsxs("div",{className:B,children:[X,Oe]}),e[73]=B,e[74]=X,e[75]=Oe,e[76]=Fe):Fe=e[76],Fe}function so(m){return m.id}function ro(m){const e=ze.c(15),{schema:r,value:c,onChange:u,meta:g,decofile:S,onSaveReferencedBlock:f,sandbox:v}=m;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[x,D]=N.useState(h);let k;e[1]!==x?(k=x.length>0&&n.jsxs("nav",{"aria-label":"Variant rule breadcrumb",className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[n.jsx("button",{type:"button",onClick:()=>D([]),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:"Back to rule",children:n.jsx(na,{className:"size-3.5"})}),x.map((o,w)=>{const i=w===x.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[w>0&&n.jsx(aa,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>D(x.slice(0,w+1)),title:o,className:Ee("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",i?"font-medium text-foreground":"text-muted-foreground"),children:o})]},`${o}-${w}`)})]}),e[1]=x,e[2]=k):k=e[2];let _;e[3]!==x||e[4]!==S||e[5]!==g||e[6]!==u||e[7]!==f||e[8]!==v||e[9]!==r||e[10]!==c?(_=n.jsx(ea,{schema:r,value:c,onChange:u,basePath:"",breadcrumbPath:x,onBreadcrumbChange:D,meta:g,decofile:S,onSaveReferencedBlock:f,sandbox:v}),e[3]=x,e[4]=S,e[5]=g,e[6]=u,e[7]=f,e[8]=v,e[9]=r,e[10]=c,e[11]=_):_=e[11];let j;return e[12]!==k||e[13]!==_?(j=n.jsxs("div",{className:"space-y-2",children:[k,_]}),e[12]=k,e[13]=_,e[14]=j):j=e[14],j}function On(m){const e=ze.c(21),{activeSchema:r,formValue:c,formResetKey:u,onFormChange:g,onBreadcrumbChange:S,breadcrumbPath:f,emptyMessage:v,beforeForm:h,seoResolveType:x,siteDefaultSeo:D,meta:k,decofile:_,onSaveReferencedBlock:j,sandbox:o}=m;let w;e[0]!==f?(w=f===void 0?[]:f,e[0]=f,e[1]=w):w=e[1];const i=w;let K;e[2]!==r||e[3]!==i||e[4]!==_||e[5]!==u||e[6]!==c||e[7]!==k||e[8]!==S||e[9]!==g||e[10]!==j||e[11]!==o||e[12]!==x||e[13]!==D?(K=r&&c?x?n.jsx(Rr,{schema:r,resolveType:x,value:c,formResetKey:u,onChange:g,onBreadcrumbChange:S,siteDefaultSeo:D}):n.jsx(ea,{schema:r,value:c,onChange:g,basePath:"",breadcrumbPath:i,onBreadcrumbChange:S,meta:k,decofile:_,onSaveReferencedBlock:j,sandbox:o},u):null,e[2]=r,e[3]=i,e[4]=_,e[5]=u,e[6]=c,e[7]=k,e[8]=S,e[9]=g,e[10]=j,e[11]=o,e[12]=x,e[13]=D,e[14]=K):K=e[14];const E=K;let M;e[15]!==v||e[16]!==E?(M=E??n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:v}),e[15]=v,e[16]=E,e[17]=M):M=e[17];let d;return e[18]!==h||e[19]!==M?(d=n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsxs("div",{className:"mx-auto max-w-2xl",children:[h,M]})}),e[18]=h,e[19]=M,e[20]=d):d=e[20],d}const oo="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 io(m,e){return Ns(m,e,tt)}function lo(m){const e=ze.c(13),{pageKey:r,initialName:c,initialPath:u,onFieldChange:g}=m,[S,f]=N.useState(c),[v,h]=N.useState(u),[x,D]=N.useState(r);x!==r&&(D(r),f(c),h(u));let k;e[0]!==g?(k=i=>{f(i.target.value),g("name",i.target.value)},e[0]=g,e[1]=k):k=e[1];let _;e[2]!==S||e[3]!==k?(_=n.jsx("input",{type:"text",value:S,onChange:k,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"Page name"}),e[2]=S,e[3]=k,e[4]=_):_=e[4];let j;e[5]!==g?(j=i=>{h(i.target.value),g("path",i.target.value)},e[5]=g,e[6]=j):j=e[6];let o;e[7]!==v||e[8]!==j?(o=n.jsx("input",{type:"text",value:v,onChange:j,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:"/path"}),e[7]=v,e[8]=j,e[9]=o):o=e[9];let w;return e[10]!==_||e[11]!==o?(w=n.jsxs("div",{className:"space-y-1",children:[_,o]}),e[10]=_,e[11]=o,e[12]=w):w=e[12],w}function Bn(m){const e=ze.c(6),{onClick:r}=m;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ra,{size:14}),e[0]=c):c=e[0];let u;e[1]!==r?(u=n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:r,children:c})}),e[1]=r,e[2]=u):u=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(pt,{side:"bottom",children:"Add variant"}),e[3]=g):g=e[3];let S;return e[4]!==u?(S=n.jsxs(mt,{children:[u,g]}),e[4]=u,e[5]=S):S=e[5],S}function Ln(m){const e=ze.c(21),{currentRt:r,currentLabel:c,currentGlobalKey:u,matchers:g,globals:S,onSelect:f,onSelectGlobal:v,schema:h,formValue:x,onChange:D,formKey:k,formWrapperClassName:_,meta:j,decofile:o,onSaveReferencedBlock:w,sandbox:i}=m;let K;e[0]!==u||e[1]!==c||e[2]!==r||e[3]!==S||e[4]!==g||e[5]!==f||e[6]!==v?(K=n.jsx(Ds,{currentRt:r,currentLabel:c,currentGlobalKey:u,matchers:g,globals:S,onSelect:f,onSelectGlobal:v}),e[0]=u,e[1]=c,e[2]=r,e[3]=S,e[4]=g,e[5]=f,e[6]=v,e[7]=K):K=e[7];let E;e[8]!==o||e[9]!==k||e[10]!==x||e[11]!==_||e[12]!==j||e[13]!==D||e[14]!==w||e[15]!==i||e[16]!==h?(E=h&&x&&n.jsx("div",{className:_,children:n.jsx(ro,{schema:h,value:x,onChange:D,meta:j,decofile:o,onSaveReferencedBlock:w,sandbox:i},k)}),e[8]=o,e[9]=k,e[10]=x,e[11]=_,e[12]=j,e[13]=D,e[14]=w,e[15]=i,e[16]=h,e[17]=E):E=e[17];let M;return e[18]!==K||e[19]!==E?(M=n.jsxs(n.Fragment,{children:[K,E]}),e[18]=K,e[19]=E,e[20]=M):M=e[20],M}function ac({orgSlug:m,virtualMcpId:e,branch:r,previewReady:c=!0,previewUrl:u,currentPath:g,activePageBlockKey:S=null,activeGlobalBlockKey:f=null,externalSelectedIndex:v,onSaved:h,initialEditSeo:x=!1,onExitSeo:D,onViewJsonFile:k,onVariantPreviewOverride:_}){const j=c?{orgSlug:m,virtualMcpId:e,branch:r,previewUrl:u}:null,{data:o,isLoading:w}=Vs(j),{data:i,isLoading:K}=Cs(j),E=Ps(),M=E?.entity?.id===e?E.entity.metadata?.siteSlug??null:null,[d,P]=N.useState(null),[ae,T]=N.useState(null),[pe,V]=N.useState(null),[ce,F]=N.useState(0),[te,oe]=N.useState(void 0),[Te,O]=N.useState(null),[ue,ie]=N.useState(null),[je,$]=N.useState([]),[Ae,Z]=N.useState(0),[De,ve]=N.useState(null),[se,Y]=N.useState(null),[q,ne]=N.useState(null),[le,ke]=N.useState(!0),[Se,de]=N.useState(!1),[ye,B]=N.useState(!1),[X,we]=N.useState(x),[Ke,$e]=N.useState(x);x&&!Ke&&($e(!0),we(!0),P(null),T(null),V(null),$([])),!x&&Ke&&$e(!1);const[Le,Ce]=N.useState(null),[Oe,Fe]=N.useState(void 0),[Me,xe]=N.useState([]),[Re,me]=N.useState(0),[ee,I]=N.useState(0),[re,Q]=N.useState(null),[Ie,he]=N.useState(null),[Qe,dn]=N.useState(null),ga=vs(),va=`${m}/${e}/${r}`,Ht=Ts({orgSlug:m,virtualMcpId:e,branch:r}),[Sa,xa]=N.useState(g),[ba,ya]=N.useState(S),[_a,ja]=N.useState(f);(Sa!==g||ba!==S||_a!==f)&&(queueMicrotask(()=>Ht.flush()),xa(g),ya(S),ja(f),P(null),T(null),V(null),F(0),O(null),ie(null),I(0),Q(null),he(null),$([]),Z(t=>t+1),we(!1),Ce(null),Fe(void 0),xe([]),me(t=>t+1));const be=As({orgSlug:m,virtualMcpId:e,branch:r}),Dt=Zs((t,a)=>{be.mutate({blockKey:t,data:a},{onSuccess:()=>h?.(),onError:s=>G.error(`Save failed: ${s.message}`)})}),Ut=Ms({orgSlug:m,virtualMcpId:e,branch:r}),[yt,Vt]=N.useState(!1),Wt=N.useRef(null),ht=N.useRef(null),gt=N.useRef(null),Gt=N.useRef({}),Ye=N.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!c||w||K)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(Fn,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!i)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Could not load site data."});const ka=Es(o),_e=!!f,He=_e?null:Ks(ka,g,S),R=_e?f:He?.key??null,Yt=_e&&f?o[f]:void 0,mn=_e&&f&&Yt?$s(f,Yt):_e&&f?f:"",Ct=!_e&&R&&o[R]?o[R]:null,qt=X&&o&&i&&R&&He?Mn(o,{kind:"page",pageKey:R,pageName:String(He.name??""),path:String(He.path??"")},i):null,wa=X?Ct?.seo:void 0,Jt=Oe!==void 0?Oe:wa,Ra=X?Nr(Jt):void 0,Na=qt?.seoTypeOptions??[],Da=X&&i?Dr(i):"",fn=Le??Ra??{},Qt=X&&qt?Vr(fn,qt):null,Va=X&&Qt&&Cr(Jt)?Ot(Qt,i):null,Ca=X?Pr(o,i)?.seoData:void 0,Be=_e?[{label:"Default",sections:[{__resolveType:f}]}]:io(Ct?.sections,o??{}),Pt=Be.length>1,Ve=Math.min(ce,Be.length-1),nt=Be[Ve],H=nt?.sections??[],Pe=Bt(H,o),pn=!_e&&Os(Ct?.sections);if(_e&&f&&Qe!==f){dn(f);const t=H[0],a=Pe[0];if(t&&a){P(0),I(0),$([]);const s=ut(t,a,o);s&&(T(s.data),V(s.resolveType),he(null),Q(null))}}!_e&&Qe!==null&&dn(null),Ye.current={rawSections:H,parsedSections:Pe,decofile:o??{},activePageKey:R,pageVariants:Be,variantIndex:Ve,sectionVariantIndex:ee,selectedSectionIndex:d};const Pa=()=>({multivariate:pn,index:Ve,variants:Be.map(t=>({rule:t.rule}))}),hn=(t,a)=>{if(!_)return;if(!R||!pn||t.length<=1){_(null);return}const s=Tn(R,{multivariate:!0,index:a,variants:t},o,i);_(s.length>0?s:null)},vt=(t,a,s)=>{if(!_)return;if(!R){_(null);return}const l=Pa(),p=Tn(R,l,o,i);if(!t||a<0){_(p.length>0?p:null);return}const y=ar({pageKey:R,page:l,sectionIndex:a,sectionLazy:Pe[a]?.isLazy??!1,mvObj:t,selectedVariantIndex:s,decofile:o,meta:i}),b=[...p,...y];_(b.length>0?b:null)},at=(t,a,s,l=d??-1,p=!1)=>{const y=Je(t,a);if(!y){T(null),V(null),he(null),Q(null),p&&vt(null,l,s);return}const C=Dn(y,tt)[s];if(!C){T(null),V(null),he(null),Q(null),p&&vt(null,l,s);return}const J=Hs(C.value,o);T(J?.data??null),V(J?.resolveType??null);const{resolveType:A,formValue:L}=jt(C.rule,o,i??void 0);he(A),Q(L),p&&vt(y,l,s)};if(v!==void 0&&v!==te&&(oe(v??null),typeof v=="number")){const t=H[v],a=Pe[v];if(t&&a)if(P(v),I(0),$([]),Z(s=>s+1),a.isMultivariate)at(t,a,0,v);else{const s=ut(t,a,o);s?(T(s.data),V(s.resolveType)):(T(null),V(null)),he(null),Q(null)}}const Tt={orgSlug:m,virtualMcpId:e,branch:r,previewUrl:u??void 0,siteSlug:M},Zt=pe&&i?Ot(pe,i):null,Ue=(t,a)=>{if(!R)return;const s=wt(o,R,t,Ve,Be);be.mutate({blockKey:R,data:s},{onSuccess:()=>a?.onSuccess?.()??h?.(),onError:l=>G.error(`Save failed: ${l.message}`)})},St=()=>{P(null),T(null),V(null),I(0),Q(null),he(null),$([]),Z(t=>t+1)},Ta=(t,a)=>{Wt.current&&clearTimeout(Wt.current);const s=Ye.current.sectionVariantIndex;Wt.current=setTimeout(()=>{const{rawSections:l,parsedSections:p,decofile:y,activePageKey:b,pageVariants:C,variantIndex:J}=Ye.current,A=l[a];if(!A)return;const L=p[a];if(!L)return;if(L.isSavedBlock){const U=L.isLazy?A.section?.__resolveType??A.__resolveType:A.__resolveType;be.mutate({blockKey:U,data:t},{onSuccess:()=>h?.(),onError:W=>G.error(`Save failed: ${W.message}`)});return}if(!b)return;const z={...y[b]},ge=[...l];if(L.isMultivariate){const U=Je(A,L);if(!U||!b)return;const W=rr(U,s,t);ge[a]=dt(A,L,W)}else if(L.isHidden){const U=Un(A.__resolveType),W=U?{...A.section}:{...A},Ne=Array.isArray(W.variants)?[...W.variants]:[];Ne[0]&&(Ne[0]={...Ne[0],value:t}),W.variants=Ne,U?ge[a]={...A,section:W}:ge[a]=W}else L.isLazy?ge[a]={...A,section:t}:ge[a]=t;if(C.length>1){const U=z.sections,W=[...U?.variants??[]];W[J]&&(W[J]={...W[J],value:ge}),z.sections={...U,variants:W}}else z.sections=ge;be.mutate({blockKey:b,data:z},{onSuccess:()=>h?.(),onError:U=>G.error(`Save failed: ${U.message}`)})},on)},Aa=t=>{P(t),I(0),$([]),Z(p=>p+1);const a=H[t],s=Pe[t];if(!a||!s)return;if(s.isMultivariate){at(a,s,0,t);return}const l=ut(a,s,o);if(!l){T(null),V(null),he(null),Q(null),vt(null,t,0);return}T(l.data),V(l.resolveType),he(null),Q(null),vt(null,t,0)},gn=t=>{const a=t;T(a),d!==null&&Ta(a,d)},Xt=t=>{if(!R||!o||!i||!He)return;const a={kind:"page",pageKey:R,pageName:String(He.name??""),path:String(He.path??"")},s=Mn(o,a,i);s&&Ht.save(R,()=>{const l=ga.getQueryData(Ss.decofile(va))?.[R];if(!l||typeof l!="object"||l===null||Array.isArray(l))return null;const p={...l,...Gt.current};return Gt.current={},t?.raw!==void 0?{...p,seo:t.raw}:t?.inner!==void 0?Ar(a,s,p,t.inner):p})},Ma=(t,a)=>{R&&(Gt.current[t]=a,Xt())},Ea=(t,a)=>{if(!R)return;const s=Rt([...H],t,a);d!==null&&(d===t?P(a):t<d&&a>=d?P(d-1):t>d&&a<=d&&P(d+1)),Ue(s)},Ka=t=>{if(!R)return;const a=H.filter((s,l)=>l!==t);d===t?St():d!==null&&d>t&&P(d-1),Ue(a)},$a=t=>{if(!R)return;const a=H[t];if(!a)return;const s=[...H];s.splice(t+1,0,nr(a)),d!==null&&d>t&&P(d+1),Ue(s)},Oa=t=>{if(!R)return;const a=H[t],s=Pe[t];if(!a||!s||s.isMultivariate)return;const l=s.isHidden?er(a):tr(a);if(!l)return;const p=[...H];p[t]=l,d===t&&St(),Ue(p)},Ba=t=>{if(!R)return;const a=H[t],s=Pe[t];if(!a||!s||s.isMultivariate)return;const l=Xs(a);if(!l)return;const p=[...H];p[t]=l,d===t&&St(),Ue(p)},La=t=>{if(!R)return;const a=H[t],s=Pe[t];if(!a||!s?.isSavedBlock)return;const l=ut(a,s,o);if(!l?.data)return;const{name:p,...y}=l.data,b=[...H];s.isLazy?b[t]={...a,section:y}:b[t]=y,d===t&&St(),Ue(b)},Fa=t=>{if(!R)return;const a=[...H,{__resolveType:t.resolveType}],s=a.length-1;Ue(a,{onSuccess:()=>{de(!1),P(s),I(0),$([]),Z(b=>b+1);const l=a[s],p=Bt(a,o)[s];if(!l||!p)return;if(p.isMultivariate){at(l,p,0);return}const y=ut(l,p,o);if(!y){T(null),V(null),he(null),Q(null);return}T(y.data),V(y.resolveType),he(null),Q(null)}})},Ia=t=>{if(d===null)return;const a=H[d],s=Pe[d];!a||!s?.isMultivariate||(I(t),$([]),Z(l=>l+1),at(a,s,t,d,!0))},za=t=>{if(d===null||!R)return;const a=H[d],s=Pe[d];if(!a||!s?.isMultivariate)return;const l=Je(a,s);if(!l)return;const p=Js(l,t);if(!p){G.error("Cannot delete the only variant.");return}const y=[...H];y[d]=dt(a,s,p);const b=p.variants;let C=ee;t===ee?C=Math.min(t,b.length-1):t<ee&&(C=ee-1),I(C),$([]),Z(J=>J+1),at(y[d],s,C),Ue(y)},Ha=t=>{if(d===null||!R)return;const a=H[d],s=Pe[d];if(!a||!s?.isMultivariate)return;const l=Je(a,s);if(!l)return;const p=Qs(l,t),y=[...H];y[d]=dt(a,s,p);const b=t+1;I(b),$([]),Z(C=>C+1),at(y[d],s,b),Ue(y)},Ua=(t,a)=>{if(d===null||!R||t===a)return;const s=H[d],l=Pe[d];if(!s||!l?.isMultivariate)return;const p=Je(s,l);if(!p)return;const y=Ys(p,t,a),b=[...H];b[d]=dt(s,l,y);let C=ee;ee===t?C=a:t<ee&&a>=ee?C=ee-1:t>ee&&a<=ee&&(C=ee+1),I(C),at(b[d],l,C),Ue(b)},en=t=>{const a=t??d;if(a===null||!R)return;const s=H[a],l=Pe[a];if(!s||!l)return;const p=Us(s,l);if(!p){G.error("This section cannot have variants.");return}const y=[...H];y[a]=p.section;const b=Bt(y,o)[a];if(!b?.isMultivariate){G.error("Could not add variant.");return}P(a),I(p.newVariantIndex),$([]),Z(C=>C+1),at(p.section,b,p.newVariantIndex,a),Ue(y)},Wa=()=>{if(d===null||!R)return;const t=H[d],a=Pe[d];if(!t||!a?.isMultivariate)return;const s=Je(t,a);if(!s)return;const l=qs(t,a,s);if(!l){G.error("Could not remove variants.");return}const p=[...H];p[d]=l;const y=Bt(p,o)[d];if(!y)return;I(0),he(null),Q(null),$([]),Z(C=>C+1);const b=ut(l,y,o);b?(T(b.data),V(b.resolveType)):(T(null),V(null)),vt(null,d,0),Ue(p)},Ga=async t=>{if(De===null||!R)return;const a=rn(t,o);if(a){G.error(a);return}const s=H[De],l=Pe[De];if(!s||!l)return;const p=ut(s,l,o);if(!p){G.error("This section cannot be saved as global.");return}const y={...p.data,name:t};try{await be.mutateAsync({blockKey:t,data:y});const b=[...H];b[De]={__resolveType:t},await be.mutateAsync({blockKey:R,data:wt(o,R,b,Ve,Be)}),d===De&&St(),ve(null),G.success(`Saved global block "${t}"`),h?.()}catch(b){G.error(b instanceof Error?b.message:"Failed to save global block")}},vn=nt?.rule;if(Pt&&d===null&&ue===null&&vn){const{resolveType:t,formValue:a}=jt(vn,o??{},i??void 0);ie(t),O(a)}const At=i?Bs(i):[],Sn=i&&o?Ls(i,o):[],Ya=!_e&&!!(u&&i&&o),qa=ue&&i?Ot(ue,i):null,Mt=()=>{ht.current&&(clearTimeout(ht.current),ht.current=null),gt.current&&(clearTimeout(gt.current),gt.current=null)},_t=async(t,a)=>{if(!(sr(a,t,i)>0))try{await Ut.mutateAsync({blockKey:t})}catch(s){G.error(s instanceof Error?s.message:"Could not delete matcher block")}},xn=t=>{ht.current&&clearTimeout(ht.current),ht.current=setTimeout(()=>{const{activePageKey:a,decofile:s,variantIndex:l}=Ye.current;if(!a)return;const p={...s[a]},y={...p.sections},b=[...y.variants??[]],C=b[l],J=C?.rule;if(xt(J,s,i)){const A=J?.__resolveType??"",L=s[A],z=typeof L?.name=="string"?L.name:A,{__resolveType:ge,...U}=t;be.mutate({blockKey:A,data:bt(ge??"",U,z)},{onSuccess:()=>h?.(),onError:W=>G.error(`Save failed: ${W.message}`)});return}C&&(b[l]={...C,rule:t}),p.sections={...y,variants:b},be.mutate({blockKey:a,data:p},{onSuccess:()=>h?.(),onError:A=>G.error(`Save failed: ${A.message}`)})},on)},Ja=t=>{ie(t);const a=t?{__resolveType:t}:{__resolveType:An};O({}),xn(a)},Qa=t=>{const a=t;O(a);const s=ue?{__resolveType:ue,...a}:{...a};xn(s)},Za=async t=>{Mt();const{activePageKey:a,decofile:s,variantIndex:l}=Ye.current;if(!a)return;const p=s[a],y=p?.sections;if(!y||typeof y!="object"||Array.isArray(y))return;const b=y;if(!Array.isArray(b.variants))return;const C=[...b.variants],J=C[l];if(!J)return;const A=kt(J.rule,s,i),L=Ft(t);C[l]={...J,rule:L};const z={...s,[a]:{...p,sections:{...b,variants:C}}},{resolveType:ge,formValue:U}=jt(L,z,i??void 0);ie(ge),O(U);try{await be.mutateAsync({blockKey:a,data:z[a]}),A&&A!==t&&await _t(A,z),h?.()}catch(W){G.error(W instanceof Error?W.message:"Could not apply saved rule")}},bn=t=>{gt.current&&clearTimeout(gt.current);const{selectedSectionIndex:a,sectionVariantIndex:s}=Ye.current;a!==null&&(gt.current=setTimeout(()=>{const{rawSections:l,parsedSections:p,decofile:y,activePageKey:b,pageVariants:C,variantIndex:J}=Ye.current;if(!b)return;const A=l[a],L=p[a];if(!A||!L?.isMultivariate)return;const z=Je(A,L);if(!z)return;const U=(z.variants??[])[s]?.rule;if(xt(U,y,i)){const fe=U?.__resolveType??"",We=y[fe],Xe=typeof We?.name=="string"?We.name:fe,{__resolveType:rt,...et}=t;be.mutate({blockKey:fe,data:bt(rt??"",et,Xe)},{onSuccess:()=>h?.(),onError:ot=>G.error(`Save failed: ${ot.message}`)});return}const W=Vn(z,s,t),Ne=[...l];Ne[a]=dt(A,L,W);const qe=wt(y,b,Ne,J,C);be.mutate({blockKey:b,data:qe},{onSuccess:()=>h?.(),onError:fe=>G.error(`Save failed: ${fe.message}`)})},on))},Xa=t=>{he(t),Q({}),bn(t?{__resolveType:t}:{__resolveType:An})},es=t=>{const a=t;Q(a);const s=Ie?{__resolveType:Ie,...a}:{...a};bn(s)},ts=async t=>{Mt();const{selectedSectionIndex:a,sectionVariantIndex:s,rawSections:l,parsedSections:p,decofile:y,activePageKey:b,pageVariants:C,variantIndex:J}=Ye.current;if(a===null||!b)return;const A=l[a],L=p[a];if(!A||!L?.isMultivariate)return;const z=Je(A,L);if(!z)return;const ge=z.variants??[],U=kt(ge[s]?.rule,y,i),W=Ft(t),Ne=Vn(z,s,W),qe=[...l];qe[a]=dt(A,L,Ne);const fe=wt(y,b,qe,J,C),We={...y,[b]:fe},{resolveType:Xe,formValue:rt}=jt(W,We,i??void 0);he(Xe),Q(rt);try{await be.mutateAsync({blockKey:b,data:fe}),U&&U!==t&&await _t(U,We),h?.()}catch(et){G.error(et instanceof Error?et.message:"Could not apply saved rule")}};if(!_e&&!He)return n.jsxs("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:["No page found for ",g]});if(_e&&!Yt)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Global block not found"});const st=d!==null?Pe[d]??null:null,yn=d!==null?H[d]:null,_n=yn&&st?.isMultivariate?Je(yn,st):null,lt=_n?Dn(_n,tt):[],tn=Math.min(ee,Math.max(lt.length-1,0)),Et=lt[tn]??null,ct=st?.isMultivariate===!0,jn=d!==null&&st!==null,Kt=jn&&(ct||!!(Zt&&ae)),ns=Kt&&!_e&&st?.isSavedBlock===!0,Ze=_e||ns,as=_e?mn:st?.label??"",ss=Ie&&i?Ot(Ie,i):null,nn=Kt&&(!_e||je.length>0)?_e?[mn,...je]:[He.name,st.label,...ct&&Et?[Et.label]:[],...je]:[],rs=X&&He?[He.name,"SEO",...Me]:[],$t=X?rs:Ze?nn.length>0?nn:[as]:nn,kn=()=>{if(!R)return;const t=o[R],a=Ws(t.sections,H);if(!a)return;const s=Gs(a);be.mutate({blockKey:R,data:{...t,sections:a}},{onSuccess:()=>{F(s),P(null),T(null),V(null),$([]),O(null),ie(null)},onError:l=>G.error(`Save failed: ${l.message}`)})},an=(t,a,s)=>{if(!R)return;const l=o[R],p=l.sections;if(!p||typeof p!="object"||Array.isArray(p))return;const y=p;if(!Array.isArray(y.variants))return;const b=t([...y.variants]);if(!b)return;const C=or(y,b),J={...o,[R]:{...l,sections:C}};be.mutate({blockKey:R,data:J[R]},{onSuccess:()=>{a?.(),s&&_t(s,J)},onError:A=>G.error(`Save failed: ${A.message}`)})},os=t=>{Y(null),F(t),P(null),T(null),V(null),$([]);const a=Be[t]?.rule,{resolveType:s,formValue:l}=jt(a,o??{},i??void 0);ie(s),O(l),hn(Be.map(p=>({rule:p.rule})),t)},is=(t,a)=>{if(t===a)return;let s=Ve;Ve===t?s=a:t<Ve&&a>=Ve?s=Ve-1:t>Ve&&a<=Ve&&(s=Ve+1),F(s);const l=Rt(Be.map(p=>({rule:p.rule})),t,a);hn(l,s),an(p=>Rt(p,t,a))},ls=t=>{const a=Be[t]?.rule,s=kt(a,o??{},i??void 0);an(l=>l.length<=1?null:(l.splice(t,1),l),()=>{Be.length-1===1?F(0):t<Ve?F(Ve-1):t===Ve&&F(Math.max(0,t-1)),P(null),T(null),V(null),$([]),O(null),ie(null)},s)},cs=t=>{an(a=>ir(a,t),()=>{F(t+1),P(null),T(null),V(null),$([]),O(null),ie(null)})},us=async(t,a)=>{Mt();const s=Ye.current.activePageKey,l=Ye.current.decofile;if(!s)return;const p=l[s],y=p.sections;if(!y||typeof y!="object"||Array.isArray(y))return;const b=y;if(!Array.isArray(b.variants))return;const C=[...b.variants],J=C[t];if(!J?.rule||typeof J.rule!="object"){G.error("This variant has no matcher rule to rename.");return}const A=J.rule,L=a.trim();Vt(!0);try{if(!L){if(!xt(A,l,i)){Y(null);return}const qe=A.__resolveType??"";C[t]={...J,rule:Cn(A,l,i)};const fe={...l,[s]:{...p,sections:{...b,variants:C}}};await be.mutateAsync({blockKey:s,data:fe[s]}),await _t(qe,fe),Y(null),h?.();return}const z=Pn(A,l,i);if(!z){G.error("Could not read this variant's matcher rule.");return}if(z.blockKey){await be.mutateAsync({blockKey:z.blockKey,data:bt(z.resolveType,z.data,L)}),Y(null),h?.();return}const ge=sn(L),U=rn(ge,l);if(U){G.error(U);return}const W=bt(z.resolveType,z.data,L);let Ne=null;try{await be.mutateAsync({blockKey:ge,data:W}),Ne=ge,C[t]={...J,rule:Ft(ge)},await be.mutateAsync({blockKey:s,data:{...p,sections:{...b,variants:C}}}),Ne=null}catch(qe){throw Ne&&await Ut.mutateAsync({blockKey:Ne}).catch(()=>{}),qe}Y(null),G.success(`Saved matcher as global block "${L}"`),h?.()}catch(z){G.error(z instanceof Error?z.message:"Failed to rename variant")}finally{Vt(!1)}},ds=async(t,a)=>{Mt();const{selectedSectionIndex:s,rawSections:l,parsedSections:p,decofile:y,activePageKey:b,pageVariants:C,variantIndex:J}=Ye.current;if(s===null||!b)return;const A=l[s],L=p[s];if(!A||!L?.isMultivariate)return;const z=Je(A,L);if(!z)return;const ge=z.variants??[],U=ge[t];if(!U?.rule||typeof U.rule!="object"){G.error("This variant has no matcher rule to rename.");return}const W=U.rule,Ne=a.trim();Vt(!0);const qe=async fe=>{const We={...z,variants:fe},Xe=[...l];Xe[s]=dt(A,L,We);const rt=wt(y,b,Xe,J,C);return await be.mutateAsync({blockKey:b,data:rt}),{...y,[b]:rt}};try{if(!Ne){if(!xt(W,y,i)){ne(null);return}const ot=W.__resolveType??"",Nn=[...ge];Nn[t]={...U,rule:Cn(W,y,i)};const gs=await qe(Nn);await _t(ot,gs),ne(null),h?.();return}const fe=Pn(W,y,i);if(!fe){G.error("Could not read this variant's matcher rule.");return}if(fe.blockKey){await be.mutateAsync({blockKey:fe.blockKey,data:bt(fe.resolveType,fe.data,Ne)}),ne(null),h?.();return}const We=sn(Ne),Xe=rn(We,y);if(Xe){G.error(Xe);return}const rt=bt(fe.resolveType,fe.data,Ne);let et=null;try{await be.mutateAsync({blockKey:We,data:rt}),et=We;const ot=[...ge];ot[t]={...U,rule:Ft(We)},await qe(ot),et=null}catch(ot){throw et&&await Ut.mutateAsync({blockKey:et}).catch(()=>{}),ot}ne(null),G.success(`Saved matcher as global block "${Ne}"`),h?.()}catch(fe){G.error(fe instanceof Error?fe.message:"Failed to rename variant")}finally{Vt(!1)}},wn=()=>{St()},ms=t=>{Ce(t),Xt({inner:t})},fs=t=>{Fe(t),Xt({raw:t})},ps=()=>{Ce(null),xe([])},hs=()=>me(t=>t+1),Rn=t=>{if(X){if(t===0){Ht.flush(),we(!1),Ce(null),Fe(void 0),xe([]),me(s=>s+1),D?.();return}if(t===1){xe([]),me(s=>s+1);return}xe(Me.slice(0,t-1)),me(s=>s+1);return}if(_e){$(je.slice(0,t)),Z(s=>s+1);return}if(t===0){wn();return}if(t===1){$([]),Z(s=>s+1);return}if(ct&&t===2){$([]),Z(s=>s+1);return}const a=ct?2:1;$(je.slice(0,t-a))};return n.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[n.jsx("div",{className:"shrink-0",children:Ze||Kt||X?n.jsxs("div",{className:Ee("border-b px-3 py-2.5",Ze&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[$t.length>1&&n.jsx("button",{type:"button",onClick:()=>Rn($t.length-2),title:"Back","aria-label":"Back",className:Ee("shrink-0 inline-flex size-6 items-center justify-center rounded-md transition-colors",Ze?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:n.jsx(na,{className:"size-4"})}),!_e&&Pt&&nt&&n.jsxs("button",{type:"button",onClick:wn,title:`Editing in variant: ${nt.label}`,className:Ee("shrink-0 inline-flex items-center gap-1 rounded-md h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",oo),children:[n.jsx(pa,{rule:Nt(nt.rule,o??{},i??void 0),matchers:At}),n.jsx("span",{className:"max-w-[160px] truncate",children:nt.label})]}),n.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:$t.map((t,a)=>{const s=a===$t.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[a>0&&n.jsx(aa,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>Rn(a),title:t,className:Ee("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",s?Ze?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":Ze?"text-foreground/80":"text-muted-foreground",Ze?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${a}`)})}),Ze&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(fr,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(pt,{side:"bottom",className:"max-w-[260px]",children:"A global section is a reusable block shared across your site. Editing it here updates it everywhere it's used."})]}),jn&&!ct&&!st?.isHidden&&R&&n.jsx(Bn,{onClick:()=>en()})]}),Ze&&n.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:"This is a global section. Changes apply everywhere this section is used across your site."})]}):n.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(lo,{pageKey:R,initialName:He.name,initialPath:He.path,onFieldChange:Ma})}),n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"Edit SEO",className:"size-7 shrink-0",onClick:()=>we(!0),children:n.jsx(ur,{size:14})})}),n.jsx(pt,{side:"bottom",children:"Edit SEO"})]}),n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ge,{type:"button",variant:"ghost",size:"icon","aria-label":"View JSON",className:"size-7 shrink-0",onClick:()=>k&&R?k(R):B(!0),children:n.jsx(dr,{size:14})})}),n.jsx(pt,{side:"bottom",children:"View JSON"})]}),n.jsx(Bn,{onClick:kn})]})}),X?n.jsx(It,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:Ct&&R?n.jsx(Tr,{rawSeo:Jt,innerSeo:fn,defaultResolveType:Da,seoSchema:Va,activeResolveType:Qt,seoTypeOptions:Na,formResetKey:Re,siteDefaultSeo:Ca,onBreadcrumbChange:xe,onPersistRaw:fs,onInnerChange:ms,onClearForm:ps,onBumpFormKey:hs}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"SEO schema not found for this site."})})})}):Kt?n.jsxs(It,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ct&&lt.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(Fs,{listKey:`${R??""}:${d??""}`,variants:lt.map((t,a)=>({index:a,label:t.label})),selectedIndex:tn,onSelect:Ia,onRename:ne,onDuplicate:Ha,onDelete:za,onRemoveAll:Wa,onReorder:Ua,onAdd:()=>en()}),ct&&n.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),n.jsx(Ln,{currentRt:Ie??"",currentLabel:Lt(Et?.rule,o??{},tt,i??void 0),currentGlobalKey:kt(Et?.rule,o??{},i??void 0)??void 0,matchers:At,globals:Sn,onSelect:Xa,onSelectGlobal:ts,schema:ss,formValue:re,onChange:es,formKey:`${d??"none"}:${tn}:${Ie??""}`,formWrapperClassName:"pt-1",meta:i??void 0,decofile:o,onSaveReferencedBlock:Dt,sandbox:Tt})]})]}),n.jsx(On,{activeSchema:Zt,formValue:ae,formResetKey:Ae,onFormChange:gn,onBreadcrumbChange:$,breadcrumbPath:je,emptyMessage:"No editable fields for this variant.",meta:i,decofile:o,onSaveReferencedBlock:Dt,sandbox:Tt})]}):_e?n.jsx(It,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx(On,{activeSchema:Zt,formValue:ae,formResetKey:Ae,onFormChange:gn,onBreadcrumbChange:$,breadcrumbPath:je,emptyMessage:"No editable fields for this global block.",meta:i,decofile:o,onSaveReferencedBlock:Dt,sandbox:Tt})}):n.jsxs(It,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[Pt&&R&&n.jsx(ao,{listKey:R,variants:Be,activeIndex:Ve,decofile:o??{},meta:i,matchers:At,onSelect:os,onReorder:is,onRename:Y,onDuplicate:cs,onDelete:ls,onAdd:kn}),Pt&&ue!==null&&n.jsxs("div",{className:Ee("px-3 border-b",le?"pt-3 pb-5 space-y-3":"py-2"),children:[n.jsxs("button",{type:"button",onClick:()=>ke(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-sm py-0.5 hover:bg-muted/40","aria-expanded":le,children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),le?n.jsx(mr,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(lr,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),le&&n.jsx("div",{className:Ee("space-y-3",yt&&"pointer-events-none opacity-50"),children:n.jsx(Ln,{currentRt:ue,currentLabel:Lt(nt?.rule,o??{},tt,i??void 0),currentGlobalKey:kt(nt?.rule,o??{},i??void 0)??void 0,matchers:At,globals:Sn,onSelect:Ja,onSelectGlobal:Za,schema:qa,formValue:Te,onChange:Qa,formKey:`${Ve}:${ue??""}`,formWrapperClassName:"space-y-3",meta:i??void 0,decofile:o,onSaveReferencedBlock:Dt,sandbox:Tt})})]}),n.jsx("div",{className:"p-2 pt-3",children:n.jsx(Yr,{listKey:`${R??""}-${Ve}`,rawSections:H,sections:Pe,meta:i,selectedIndex:d,onSelect:Aa,onReorder:Ea,onDelete:Ka,onDuplicate:$a,onMakeReusable:ve,onToggleHidden:Oa,onToggleLazy:Ba,onAddVariant:en,onDetach:La,onAddSection:()=>de(!0),canAddSection:Ya})})]}),n.jsx(Is,{open:De!==null,onOpenChange:t=>{t||ve(null)},defaultBlockId:De!==null?sn(Pe[De]?.label??""):"",isPending:be.isPending,onSubmit:Ga}),u&&n.jsx(Er,{open:Se,onOpenChange:de,meta:i,decofile:o,previewBaseUrl:u,onSelect:Fa}),ye&&R&&o&&n.jsx(zs,{open:ye,onOpenChange:B,pageKey:R,decofile:o}),se!==null&&n.jsx(Kn,{open:!0,initialName:xt(Be[se]?.rule,o??{},i??void 0)?Lt(Be[se]?.rule,o??{},tt,i??void 0):"",autoLabel:tt(Nt(Be[se]?.rule,o??{},i??void 0)),isPending:yt,onSubmit:async t=>{await us(se,t)},onOpenChange:t=>{!t&&!yt&&Y(null)}}),q!==null&&n.jsx(Kn,{open:!0,initialName:xt(lt[q]?.rule,o??{},i??void 0)?Lt(lt[q]?.rule,o??{},tt,i??void 0):"",autoLabel:tt(Nt(lt[q]?.rule,o??{},i??void 0)),isPending:yt,onSubmit:async t=>{await ds(q,t)},onOpenChange:t=>{!t&&!yt&&ne(null)}})]})}export{ac as SectionsEditor};
@@ -1 +1 @@
1
- import{r as i,aT as nt,aR as Pe,j as d,cR as rt,aV as be,aS as k,cS as st,aO as j,aU as _,bJ as $,cT as lt,at as Ne,cU as Ee,aP as at,bI as ct,bL as it,c_ as dt,c$ as ut,d0 as pt,d1 as ft,cV as mt,aQ as ht,d2 as vt,cW as gt,cY as xt,c as ee,l as oe}from"./index-BMMnZ_kU.js";import{V as St}from"./tooltip-DGjRuZi1.js";import{i as wt,n as Ct}from"./ChevronUp-BXnZQZ3H.js";import{t as Re}from"./ChevronDown-CKv359F0.js";function _e(r,[e,t]){return Math.min(t,Math.max(e,r))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=at(J),[ne]=ht(J,[bt,Ee]),pe=Ee(),[Tt,G]=ne(J),[Pt,_t]=ne(J),je=r=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:c,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=r,p=pe(e),[v,C]=i.useState(null),[m,x]=i.useState(null),[U,M]=i.useState(!1),re=nt(u),[N,O]=Pe({prop:o,defaultProp:n??!1,onChange:c,caller:J}),[F,q]=Pe({prop:s,defaultProp:l,onChange:a,caller:J}),L=i.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=i.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(rt,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:U,onValueNodeHasChildrenChange:M,contentId:be(),value:F,onValueChange:q,open:N,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Pt,{scope:r.__scopeSelect,onNativeOptionAdd:i.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:i.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:F,onChange:E=>q(E.target.value),disabled:b,form:S,children:[F===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=i.forwardRef((r,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=r,c=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=i.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(st,{asChild:!0,...c,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...n,ref:a,onClick:_(n.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:_(n.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:_(n.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,children:c,placeholder:s="",...l}=r,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=c!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):c})});De.displayName=Oe;var Nt="SelectIcon",ke=i.forwardRef((r,e)=>{const{__scopeSelect:t,children:o,...n}=r;return d.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});ke.displayName=Nt;var Et="SelectPortal",Le=r=>d.jsx(lt,{asChild:!0,...r});Le.displayName=Et;var Q="SelectContent",Be=i.forwardRef((r,e)=>{const t=G(Q,r.__scopeSelect),[o,n]=i.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const c=o;return c?Ne.createPortal(d.jsx(Ve,{scope:r.__scopeSelect,children:d.jsx(de.Slot,{scope:r.__scopeSelect,children:d.jsx("div",{children:r.children})})}),c):null}return d.jsx(He,{...r,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=vt("SelectContent.RemoveScroll"),He=i.forwardRef((r,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:c,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=r,m=G(Q,t),[x,U]=i.useState(null),[M,re]=i.useState(null),N=k(e,f=>U(f)),[O,F]=i.useState(null),[q,L]=i.useState(null),B=ue(t),[W,V]=i.useState(!1),H=i.useRef(!1);i.useEffect(()=>{if(x)return dt(x)},[x]),ut();const E=i.useCallback(f=>{const[T,...R]=B().map(P=>P.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const P of f)if(P===I||(P?.scrollIntoView({block:"nearest"}),P===T&&M&&(M.scrollTop=0),P===y&&M&&(M.scrollTop=M.scrollHeight),P?.focus(),document.activeElement!==I))return},[B,M]),D=i.useCallback(()=>E([O,x]),[E,O,x]);i.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;i.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),i.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(F(f),y&&(H.current=!0))},[m.value]),he=i.useCallback(()=>x?.focus(),[x]),te=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ce=o==="popper"?Se:ze,se=ce===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(pt,{as:jt,allowPinchZoom:!0,children:d.jsx(ft,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:_(n,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:_(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,P=y.indexOf(I);y=y.slice(P+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=i.forwardRef((r,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=r,c=G(Q,t),s=Y(Q,t),[l,a]=i.useState(null),[u,h]=i.useState(null),g=k(e,N=>h(N)),b=ue(t),w=i.useRef(!1),S=i.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=i.useCallback(()=>{if(c.trigger&&c.valueNode&&l&&u&&p&&v&&C){const N=c.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),F=c.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(c.dir!=="rtl"){const I=q.left-O.left,P=F.left-I,X=N.left-P,Z=N.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=_e(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,P=window.innerWidth-F.right-I,X=window.innerWidth-N.right-P,Z=N.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=_e(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=N.top+N.height/2-A,ce=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const P=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ce,se+(I?he:0)+P+D),Z=T+X;l.style.height=Z+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=X+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,c.trigger,c.valueNode,l,u,p,v,C,c.dir,o]);$(()=>x(),[x]);const[U,M]=i.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=i.useCallback(N=>{N&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:U},children:d.jsx(j.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=i.forwardRef((r,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...c}=r,s=pe(t);return d.jsx(gt,{...s,...c,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Ue=i.forwardRef((r,e)=>{const{__scopeSelect:t,nonce:o,...n}=r,c=Y(we,t),s=Te(we,t),l=k(e,c.onViewportChange),a=i.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:_(n.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),U=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=U>0?U:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Ue.displayName=we;var Fe="SelectGroup",[Dt,kt]=ne(Fe),Lt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=be();return d.jsx(Dt,{scope:t,id:n,children:d.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Lt.displayName=Fe;var We="SelectLabel",Bt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=kt(We,t);return d.jsx(j.div,{id:n.id,...o,ref:e})});Bt.displayName=We;var ie="SelectItem",[Vt,Ke]=ne(ie),$e=i.forwardRef((r,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:c,...s}=r,l=G(ie,t),a=Y(ie,t),u=l.value===o,[h,g]=i.useState(c??""),[b,w]=i.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,n)),p=be(),v=i.useRef("touch"),C=()=>{n||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:i.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...s,ref:S,onFocus:_(s.onFocus,()=>w(!0)),onBlur:_(s.onBlur,()=>w(!1)),onClick:_(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:_(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:_(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:_(s.onPointerMove,m=>{v.current=m.pointerType,n?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:_(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:_(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ie;var le="SelectItemText",Ge=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,...c}=r,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=_t(le,t),[h,g]=i.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=i.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...c,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Ne.createPortal(c.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Xe=i.forwardRef((r,e)=>{const t=Y(Ce,r.__scopeSelect),o=Te(Ce,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;c(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Xe.displayName=Ce;var ye="SelectScrollDownButton",Ze=i.forwardRef((r,e)=>{const t=Y(ye,r.__scopeSelect),o=Te(ye,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;c(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Ze.displayName=ye;var Je=i.forwardRef((r,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=r,c=Y("SelectScrollButton",t),s=i.useRef(null),l=ue(t),a=i.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return i.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:_(n.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:_(n.onPointerMove,()=>{c.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:_(n.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ut=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=pe(t),c=G(Ie,t),s=Y(Ie,t);return c.open&&s.position==="popper"?d.jsx(xt,{...n,...o,ref:e}):null});Ut.displayName=Ie;var Ft="SelectBubbleInput",Qe=i.forwardRef(({__scopeSelect:r,value:e,...t},o)=>{const n=i.useRef(null),c=k(o,n),s=ct(e);return i.useEffect(()=>{const l=n.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...St,...t.style},ref:c,defaultValue:e})});Qe.displayName=Ft;function et(r){return r===""||r===void 0}function tt(r){const e=it(r),t=i.useRef(""),o=i.useRef(0),n=i.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),c=i.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,c]}function ot(r,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,c=t?r.indexOf(t):-1;let s=Wt(r,Math.max(c,0));n.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return a!==t?a:void 0}function Wt(r,e){return r.map((t,o)=>r[(e+o)%r.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Xt=Be,Zt=Ue,Jt=$e,Qt=Ge,eo=qe,to=Xe,oo=Ze;function io(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function uo(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(r){const e=ee.c(13);let t,o,n,c;e[0]!==r?({className:o,size:c,children:t,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?"default":c;let l;e[5]!==o?(l=oe("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg bg-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=xs]:h-6 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...n,children:[t,a]}),e[8]=t,e[9]=n,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function fo(r){const e=ee.c(25);let t,o,n,c,s;e[0]!==r?({className:o,children:t,position:c,hideScrollButtons:s,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c,e[5]=s):(t=e[1],o=e[2],n=e[3],c=e[4],s=e[5]);const l=c===void 0?"popper":c,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Zt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==n||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Xt,{"data-slot":"select-content",className:h,position:l,...n,children:[g,S,p]})}),e[18]=l,e[19]=n,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function mo(r){const e=ee.c(16);let t,o,n,c;e[0]!==r?({className:o,children:t,hideCheck:c,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?!1:c;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(wt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==n||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...n,children:[a,u]}),e[11]=n,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Ct,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}function ro(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Re,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}export{io as S,po as a,uo as b,fo as c,mo as d,_e as e};
1
+ import{r as i,aT as nt,aR as Pe,j as d,cR as rt,aV as be,aS as k,cS as st,aO as j,aU as _,bJ as $,cT as lt,at as Ne,cU as Ee,aP as at,bI as ct,bL as it,c_ as dt,c$ as ut,d0 as pt,d1 as ft,cV as mt,aQ as ht,d2 as vt,cW as gt,cY as xt,c as ee,l as oe}from"./index-K9nNk4ZL.js";import{V as St}from"./tooltip-QIj4MYXF.js";import{i as wt,n as Ct}from"./ChevronUp-CHwBY_gQ.js";import{t as Re}from"./ChevronDown-BwIAM8yJ.js";function _e(r,[e,t]){return Math.min(t,Math.max(e,r))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=at(J),[ne]=ht(J,[bt,Ee]),pe=Ee(),[Tt,G]=ne(J),[Pt,_t]=ne(J),je=r=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:c,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=r,p=pe(e),[v,C]=i.useState(null),[m,x]=i.useState(null),[U,M]=i.useState(!1),re=nt(u),[N,O]=Pe({prop:o,defaultProp:n??!1,onChange:c,caller:J}),[F,q]=Pe({prop:s,defaultProp:l,onChange:a,caller:J}),L=i.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=i.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(rt,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:U,onValueNodeHasChildrenChange:M,contentId:be(),value:F,onValueChange:q,open:N,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Pt,{scope:r.__scopeSelect,onNativeOptionAdd:i.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:i.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:F,onChange:E=>q(E.target.value),disabled:b,form:S,children:[F===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=i.forwardRef((r,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=r,c=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=i.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(st,{asChild:!0,...c,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...n,ref:a,onClick:_(n.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:_(n.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:_(n.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,children:c,placeholder:s="",...l}=r,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=c!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):c})});De.displayName=Oe;var Nt="SelectIcon",ke=i.forwardRef((r,e)=>{const{__scopeSelect:t,children:o,...n}=r;return d.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});ke.displayName=Nt;var Et="SelectPortal",Le=r=>d.jsx(lt,{asChild:!0,...r});Le.displayName=Et;var Q="SelectContent",Be=i.forwardRef((r,e)=>{const t=G(Q,r.__scopeSelect),[o,n]=i.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const c=o;return c?Ne.createPortal(d.jsx(Ve,{scope:r.__scopeSelect,children:d.jsx(de.Slot,{scope:r.__scopeSelect,children:d.jsx("div",{children:r.children})})}),c):null}return d.jsx(He,{...r,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=vt("SelectContent.RemoveScroll"),He=i.forwardRef((r,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:c,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=r,m=G(Q,t),[x,U]=i.useState(null),[M,re]=i.useState(null),N=k(e,f=>U(f)),[O,F]=i.useState(null),[q,L]=i.useState(null),B=ue(t),[W,V]=i.useState(!1),H=i.useRef(!1);i.useEffect(()=>{if(x)return dt(x)},[x]),ut();const E=i.useCallback(f=>{const[T,...R]=B().map(P=>P.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const P of f)if(P===I||(P?.scrollIntoView({block:"nearest"}),P===T&&M&&(M.scrollTop=0),P===y&&M&&(M.scrollTop=M.scrollHeight),P?.focus(),document.activeElement!==I))return},[B,M]),D=i.useCallback(()=>E([O,x]),[E,O,x]);i.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;i.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),i.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(F(f),y&&(H.current=!0))},[m.value]),he=i.useCallback(()=>x?.focus(),[x]),te=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ce=o==="popper"?Se:ze,se=ce===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(pt,{as:jt,allowPinchZoom:!0,children:d.jsx(ft,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:_(n,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:_(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,P=y.indexOf(I);y=y.slice(P+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=i.forwardRef((r,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=r,c=G(Q,t),s=Y(Q,t),[l,a]=i.useState(null),[u,h]=i.useState(null),g=k(e,N=>h(N)),b=ue(t),w=i.useRef(!1),S=i.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=i.useCallback(()=>{if(c.trigger&&c.valueNode&&l&&u&&p&&v&&C){const N=c.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),F=c.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(c.dir!=="rtl"){const I=q.left-O.left,P=F.left-I,X=N.left-P,Z=N.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=_e(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,P=window.innerWidth-F.right-I,X=window.innerWidth-N.right-P,Z=N.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=_e(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=N.top+N.height/2-A,ce=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const P=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ce,se+(I?he:0)+P+D),Z=T+X;l.style.height=Z+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=X+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,c.trigger,c.valueNode,l,u,p,v,C,c.dir,o]);$(()=>x(),[x]);const[U,M]=i.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=i.useCallback(N=>{N&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:U},children:d.jsx(j.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=i.forwardRef((r,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...c}=r,s=pe(t);return d.jsx(gt,{...s,...c,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Ue=i.forwardRef((r,e)=>{const{__scopeSelect:t,nonce:o,...n}=r,c=Y(we,t),s=Te(we,t),l=k(e,c.onViewportChange),a=i.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:_(n.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),U=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=U>0?U:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Ue.displayName=we;var Fe="SelectGroup",[Dt,kt]=ne(Fe),Lt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=be();return d.jsx(Dt,{scope:t,id:n,children:d.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Lt.displayName=Fe;var We="SelectLabel",Bt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=kt(We,t);return d.jsx(j.div,{id:n.id,...o,ref:e})});Bt.displayName=We;var ie="SelectItem",[Vt,Ke]=ne(ie),$e=i.forwardRef((r,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:c,...s}=r,l=G(ie,t),a=Y(ie,t),u=l.value===o,[h,g]=i.useState(c??""),[b,w]=i.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,n)),p=be(),v=i.useRef("touch"),C=()=>{n||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:i.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...s,ref:S,onFocus:_(s.onFocus,()=>w(!0)),onBlur:_(s.onBlur,()=>w(!1)),onClick:_(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:_(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:_(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:_(s.onPointerMove,m=>{v.current=m.pointerType,n?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:_(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:_(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ie;var le="SelectItemText",Ge=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,...c}=r,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=_t(le,t),[h,g]=i.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=i.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...c,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Ne.createPortal(c.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Xe=i.forwardRef((r,e)=>{const t=Y(Ce,r.__scopeSelect),o=Te(Ce,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;c(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Xe.displayName=Ce;var ye="SelectScrollDownButton",Ze=i.forwardRef((r,e)=>{const t=Y(ye,r.__scopeSelect),o=Te(ye,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;c(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Ze.displayName=ye;var Je=i.forwardRef((r,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=r,c=Y("SelectScrollButton",t),s=i.useRef(null),l=ue(t),a=i.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return i.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:_(n.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:_(n.onPointerMove,()=>{c.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:_(n.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ut=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=pe(t),c=G(Ie,t),s=Y(Ie,t);return c.open&&s.position==="popper"?d.jsx(xt,{...n,...o,ref:e}):null});Ut.displayName=Ie;var Ft="SelectBubbleInput",Qe=i.forwardRef(({__scopeSelect:r,value:e,...t},o)=>{const n=i.useRef(null),c=k(o,n),s=ct(e);return i.useEffect(()=>{const l=n.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...St,...t.style},ref:c,defaultValue:e})});Qe.displayName=Ft;function et(r){return r===""||r===void 0}function tt(r){const e=it(r),t=i.useRef(""),o=i.useRef(0),n=i.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),c=i.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,c]}function ot(r,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,c=t?r.indexOf(t):-1;let s=Wt(r,Math.max(c,0));n.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return a!==t?a:void 0}function Wt(r,e){return r.map((t,o)=>r[(e+o)%r.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Xt=Be,Zt=Ue,Jt=$e,Qt=Ge,eo=qe,to=Xe,oo=Ze;function io(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function uo(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(r){const e=ee.c(13);let t,o,n,c;e[0]!==r?({className:o,size:c,children:t,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?"default":c;let l;e[5]!==o?(l=oe("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg bg-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=xs]:h-6 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...n,children:[t,a]}),e[8]=t,e[9]=n,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function fo(r){const e=ee.c(25);let t,o,n,c,s;e[0]!==r?({className:o,children:t,position:c,hideScrollButtons:s,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c,e[5]=s):(t=e[1],o=e[2],n=e[3],c=e[4],s=e[5]);const l=c===void 0?"popper":c,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Zt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==n||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Xt,{"data-slot":"select-content",className:h,position:l,...n,children:[g,S,p]})}),e[18]=l,e[19]=n,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function mo(r){const e=ee.c(16);let t,o,n,c;e[0]!==r?({className:o,children:t,hideCheck:c,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?!1:c;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(wt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==n||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...n,children:[a,u]}),e[11]=n,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Ct,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}function ro(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Re,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}export{io as S,po as a,uo as b,fo as c,mo as d,_e as e};
@@ -1,4 +1,4 @@
1
- import{r as K,at as xt,c as G,j as s,H as He,I as ge,C as pe,n as Ce,J as Ve,M as qe,d as Ne,K as le,t as se,B as ie,p as te,z as gt,l as he,m as vt,b as bt,E as jt,x as yt}from"./index-BMMnZ_kU.js";import{c as Ge,e as Xe,d as Ye,D as St,a as Qe,h as Nt,b as kt}from"./dialog-DxYV-693.js";import{g as Ct,b as wt,a as It,D as _t}from"./drawer-qstCMw0Q.js";import{u as Mt}from"./use-mobile-Bef-oAkh.js";import{S as Te,u as Et,m as Ot,a as we}from"./chat-context-c0BhAQmo.js";import{C as Tt}from"./checkbox-_NM5O-zb.js";import{I as fe}from"./input-DO3omnvV.js";import{S as Pt,a as At,b as zt,c as Rt,d as Lt}from"./select-CEjAa51v.js";import{S as Q}from"./skeleton-DRYlvCM9.js";import{i as Je,b as Ze,c as Ft,a as Dt,s as $t}from"./Settings02-DKg6N4zo.js";import{c as Kt,a as Ut,i as Bt}from"./Tool01-FIiY7fJ0.js";import{i as Wt}from"./Key01-6U7RTmt2.js";import{i as et}from"./SearchMd-DvFCXO2G.js";import{b as Ie,u as Ht,a as Vt}from"./use-ai-providers-CCC_yTQZ.js";import{g as _e}from"./ai-providers-logos-DD3qZ33J.js";import{i as qt}from"./Monitor01-BgKfGb_C.js";import{i as Gt}from"./AlertCircle-bnM-AHGO.js";import{u as ke}from"./studio-tools-B-Eij61m.js";import{u as Me}from"./use-t-BPFwceba.js";import{i as Xt}from"./ChevronRight-CfjLE0HN.js";import{A as Yt}from"./avatar-BaV7IKOZ.js";import{S as Pe,a as Ae,b as tt}from"./settings-section-DgtumuNO.js";import{s as st}from"./Eye-CAFwHWrY.js";import{a as ye,b as Se,C as Qt}from"./connect-desktop-dialog-BOIK_vOw.js";import{t as ze}from"./ChevronDown-CKv359F0.js";import{a as Jt}from"./Image01-CKQwIs-X.js";import{t as Zt}from"./Stars01-BCzbdnTA.js";function me(n,e,t){let i=t.initialDeps??[],l,o=!0;function r(){var c,u,d;let a;t.key&&((c=t.debug)!=null&&c.call(t))&&(a=Date.now());const m=n();if(!(m.length!==i.length||m.some((x,g)=>i[g]!==x)))return l;i=m;let h;if(t.key&&((u=t.debug)!=null&&u.call(t))&&(h=Date.now()),l=e(...m),t.key&&((d=t.debug)!=null&&d.call(t))){const x=Math.round((Date.now()-a)*100)/100,g=Math.round((Date.now()-h)*100)/100,S=g/16,N=(k,E)=>{for(k=String(k);k.length<E;)k=" "+k;return k};console.info(`%c⏱ ${N(g,5)} /${N(x,5)} ms`,`
1
+ import{r as K,at as xt,c as G,j as s,H as He,I as ge,C as pe,n as Ce,J as Ve,M as qe,d as Ne,K as le,t as se,B as ie,p as te,z as gt,l as he,m as vt,b as bt,E as jt,x as yt}from"./index-K9nNk4ZL.js";import{c as Ge,e as Xe,d as Ye,D as St,a as Qe,h as Nt,b as kt}from"./dialog-Ccu5eFvd.js";import{g as Ct,b as wt,a as It,D as _t}from"./drawer-CTLHO_Po.js";import{u as Mt}from"./use-mobile-CDLFoW5F.js";import{S as Te,u as Et,m as Ot,a as we}from"./chat-context-CxcCOIx-.js";import{C as Tt}from"./checkbox-0S0p1Qa5.js";import{I as fe}from"./input-BTvFP-rc.js";import{S as Pt,a as At,b as zt,c as Rt,d as Lt}from"./select-DkFTH4pS.js";import{S as Q}from"./skeleton-C31Wi2HR.js";import{i as Je,b as Ze,c as Ft,a as Dt,s as $t}from"./Settings02-CuWmowxn.js";import{c as Kt,a as Ut,i as Bt}from"./Tool01-BsvXLKqb.js";import{i as Wt}from"./Key01-BoS606T3.js";import{i as et}from"./SearchMd-Byn-coVH.js";import{b as Ie,u as Ht,a as Vt}from"./use-ai-providers-CvkcDt8z.js";import{g as _e}from"./ai-providers-logos-DD3qZ33J.js";import{i as qt}from"./Monitor01-Bf_ipmVo.js";import{i as Gt}from"./AlertCircle-BAVOz-2x.js";import{u as ke}from"./studio-tools-DEV89u5s.js";import{u as Me}from"./use-t-BYEA0NnF.js";import{i as Xt}from"./ChevronRight-CR81Jb7f.js";import{A as Yt}from"./avatar-B7H5YfAv.js";import{S as Pe,a as Ae,b as tt}from"./settings-section-BPiTjvGZ.js";import{s as st}from"./Eye-C56Rqkt8.js";import{a as ye,b as Se,C as Qt}from"./connect-desktop-dialog-CthnsqOM.js";import{t as ze}from"./ChevronDown-BwIAM8yJ.js";import{a as Jt}from"./Image01-ffA98M16.js";import{t as Zt}from"./Stars01-hjCPYLmR.js";function me(n,e,t){let i=t.initialDeps??[],l,o=!0;function r(){var c,u,d;let a;t.key&&((c=t.debug)!=null&&c.call(t))&&(a=Date.now());const m=n();if(!(m.length!==i.length||m.some((x,g)=>i[g]!==x)))return l;i=m;let h;if(t.key&&((u=t.debug)!=null&&u.call(t))&&(h=Date.now()),l=e(...m),t.key&&((d=t.debug)!=null&&d.call(t))){const x=Math.round((Date.now()-a)*100)/100,g=Math.round((Date.now()-h)*100)/100,S=g/16,N=(k,E)=>{for(k=String(k);k.length<E;)k=" "+k;return k};console.info(`%c⏱ ${N(g,5)} /${N(x,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(o&&t.skipInitialOnChange)&&t.onChange(l),o=!1,l}return r.updateDeps=c=>{i=c},r}function Re(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const es=(n,e)=>Math.abs(n-e)<1.01,ts=(n,e,t)=>{let i;return function(...l){n.clearTimeout(i),i=n.setTimeout(()=>e.apply(this,l),t)}},Le=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},ss=n=>n,is=n=>{const e=Math.max(n.startIndex-n.overscan,0),t=Math.min(n.endIndex+n.overscan,n.count-1),i=[];for(let l=e;l<=t;l++)i.push(l);return i},ns=(n,e)=>{const t=n.scrollElement;if(!t)return;const i=n.targetWindow;if(!i)return;const l=r=>{const{width:c,height:u}=r;e({width:Math.round(c),height:Math.round(u)})};if(l(Le(t)),!i.ResizeObserver)return()=>{};const o=new i.ResizeObserver(r=>{const c=()=>{const u=r[0];if(u?.borderBoxSize){const d=u.borderBoxSize[0];if(d){l({width:d.inlineSize,height:d.blockSize});return}}l(Le(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},Fe={passive:!0},De=typeof window>"u"?!0:"onscrollend"in window,ls=(n,e)=>{const t=n.scrollElement;if(!t)return;const i=n.targetWindow;if(!i)return;let l=0;const o=n.options.useScrollendEvent&&De?()=>{}:ts(i,()=>{e(l,!1)},n.options.isScrollingResetDelay),r=a=>()=>{const{horizontal:m,isRtl:f}=n.options;l=m?t.scrollLeft*(f&&-1||1):t.scrollTop,o(),e(l,a)},c=r(!0),u=r(!1);t.addEventListener("scroll",c,Fe);const d=n.options.useScrollendEvent&&De;return d&&t.addEventListener("scrollend",u,Fe),()=>{t.removeEventListener("scroll",c),d&&t.removeEventListener("scrollend",u)}},os=(n,e,t)=>{if(e?.borderBoxSize){const i=e.borderBoxSize[0];if(i)return Math.round(i[t.options.horizontal?"inlineSize":"blockSize"])}return n[t.options.horizontal?"offsetWidth":"offsetHeight"]},rs=(n,{adjustments:e=0,behavior:t},i)=>{var l,o;const r=n+e;(o=(l=i.scrollElement)==null?void 0:l.scrollTo)==null||o.call(l,{[i.options.horizontal?"left":"top"]:r,behavior:t})};class as{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,i,l;return((l=(i=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:i.now)==null?void 0:l.call(i))??Date.now()},this.observer=(()=>{let t=null;const i=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(l=>{l.forEach(o=>{const r=()=>{const c=o.target,u=this.indexFromElement(c);if(!c.isConnected){this.observer.unobserve(c);return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(c,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var l;(l=i())==null||l.disconnect(),t=null},observe:l=>{var o;return(o=i())==null?void 0:o.observe(l,{box:"border-box"})},unobserve:l=>{var o;return(o=i())==null?void 0:o.unobserve(l)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([i,l])=>{typeof l>"u"&&delete t[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ss,rangeExtractor:is,onChange:()=>{},measureElement:os,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var i,l;(l=(i=this.options).onChange)==null||l.call(i,this,t)},this.maybeNotify=me(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<l?"forward":"backward":null,this.scrollOffset=l,this.isScrolling=o,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,i)=>{const l=new Map,o=new Map;for(let r=i-1;r>=0;r--){const c=t[r];if(l.has(c.lane))continue;const u=o.get(c.lane);if(u==null||c.end>u.end?o.set(c.lane,c):c.end<u.end&&l.set(c.lane,!0),l.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((r,c)=>r.end===c.end?r.index-c.index:r.end-c.end)[0]:void 0},this.getMeasurementOptions=me(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,i,l,o,r,c,u)=>(this.prevLanes!==void 0&&this.prevLanes!==c&&(this.lanesChangedFlag=!0),this.prevLanes=c,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:i,scrollMargin:l,getItemKey:o,enabled:r,lanes:c,laneAssignmentMode:u}),{key:!1}),this.getMeasurements=me(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:i,scrollMargin:l,getItemKey:o,enabled:r,lanes:c,laneAssignmentMode:u},d)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const h of this.laneAssignments.keys())h>=t&&this.laneAssignments.delete(h);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const a=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const m=this.measurementsCache.slice(0,a),f=new Array(c).fill(void 0);for(let h=0;h<a;h++){const x=m[h];x&&(f[x.lane]=h)}for(let h=a;h<t;h++){const x=o(h),g=this.laneAssignments.get(h);let S,N;const k=u==="estimate"||d.has(x);if(g!==void 0&&this.options.lanes>1){S=g;const b=f[S],j=b!==void 0?m[b]:void 0;N=j?j.end+this.options.gap:i+l}else{const b=this.options.lanes===1?m[h-1]:this.getFurthestMeasurement(m,h);N=b?b.end+this.options.gap:i+l,S=b?b.lane:h%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(h,S)}const E=d.get(x),_=typeof E=="number"?E:this.options.estimateSize(h),M=N+_;m[h]={index:h,start:N,size:_,end:M,key:x,lane:S},f[S]=h}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=me(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,i,l,o)=>this.range=t.length>0&&i>0?cs({measurements:t,outerSize:i,scrollOffset:l,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=me(()=>{let t=null,i=null;const l=this.calculateRange();return l&&(t=l.startIndex,i=l.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,i]},(t,i,l,o,r)=>o===null||r===null?[]:t({startIndex:o,endIndex:r,overscan:i,count:l}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const i=this.options.indexAttribute,l=t.getAttribute(i);return l?parseInt(l,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const l=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(l!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,l-o),c=Math.min(this.options.count-1,l+o);return t>=r&&t<=c}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,c)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(c))});return}const i=this.indexFromElement(t),l=this.options.getItemKey(i),o=this.elementsCache.get(l);o!==t&&(o&&this.observer.unobserve(o),this.observer.observe(t),this.elementsCache.set(l,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,i)=>{var l;const o=this.measurementsCache[t];if(!o)return;const r=this.itemSizeCache.get(o.key)??o.size,c=i-r;c!==0&&(((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,c,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=c,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,i)),this.notify(!1))},this.getVirtualItems=me(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,i)=>{const l=[];for(let o=0,r=t.length;o<r;o++){const c=t[o],u=i[c];l.push(u)}return l},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const i=this.getMeasurements();if(i.length!==0)return Re(i[it(0,i.length-1,l=>Re(i[l]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,i,l=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),r=this.getScrollOffset();i==="auto"&&(i=t>=r+o?"end":"start"),i==="center"?t+=(l-o)/2:i==="end"&&(t-=o);const c=this.getMaxScrollOffset();return Math.max(Math.min(c,t),0)},this.getOffsetForIndex=(t,i="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const l=this.getSize(),o=this.getScrollOffset(),r=this.measurementsCache[t];if(!r)return;if(i==="auto")if(r.end>=o+l-this.options.scrollPaddingEnd)i="end";else if(r.start<=o+this.options.scrollPaddingStart)i="start";else return[o,i];if(i==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),i];const c=i==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,i,r.size),i]},this.scrollToOffset=(t,{align:i="start",behavior:l="auto"}={})=>{const o=this.getOffsetForAlignment(t,i),r=this.now();this.scrollState={index:null,align:i,behavior:l,startedAt:r,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:i="auto",behavior:l="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getOffsetForIndex(t,i);if(!o)return;const[r,c]=o,u=this.now();this.scrollState={index:t,align:c,behavior:l,startedAt:u,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:i="auto"}={})=>{const l=this.getScrollOffset()+t,o=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:o,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const i=this.getMeasurements();let l;if(i.length===0)l=this.options.paddingStart;else if(this.options.lanes===1)l=((t=i[i.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let r=i.length-1;for(;r>=0&&o.some(c=>c===null);){const c=i[r];o[c.lane]===null&&(o[c.lane]=c.end),r--}l=Math.max(...o.filter(c=>c!==null))}return Math.max(l-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:i,behavior:l})=>{this.options.scrollToFn(t,{behavior:l,adjustments:i},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,l=i?i[0]:this.scrollState.lastTargetOffset,o=1,r=l!==this.scrollState.lastTargetOffset;if(!r&&es(l,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=l,this.scrollState.behavior="auto",this._scrollToOffset(l,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const it=(n,e,t,i)=>{for(;n<=e;){const l=(n+e)/2|0,o=t(l);if(o<i)n=l+1;else if(o>i)e=l-1;else return l}return n>0?n-1:0};function cs({measurements:n,outerSize:e,scrollOffset:t,lanes:i}){const l=n.length-1,o=u=>n[u].start;if(n.length<=i)return{startIndex:0,endIndex:l};let r=it(0,l,o,t),c=r;if(i===1)for(;c<l&&n[c].end<t+e;)c++;else if(i>1){const u=Array(i).fill(0);for(;c<l&&u.some(a=>a<t+e);){const a=n[c];u[a.lane]=a.end,c++}const d=Array(i).fill(t+e);for(;r>=0&&d.some(a=>a>=t);){const a=n[r];d[a.lane]=a.start,r--}r=Math.max(0,r-r%i),c=Math.min(l,c+(i-1-c%i))}return{startIndex:r,endIndex:c}}const $e=typeof document<"u"?K.useLayoutEffect:K.useEffect;function ds({useFlushSync:n=!0,...e}){const t=K.useReducer(()=>({}),{})[1],i={...e,onChange:(o,r)=>{var c;n&&r?xt.flushSync(t):t(),(c=e.onChange)==null||c.call(e,o,r)}},[l]=K.useState(()=>new as(i));return l.setOptions(i),$e(()=>l._didMount(),[]),$e(()=>l._willUpdate()),l}function us(n){return ds({observeElementRect:ns,observeElementOffset:ls,scrollToFn:rs,...n})}const nt=[{id:"openai",name:"OpenAI",description:"GPT-4, GPT-5, and other OpenAI models",logo:"https://decoims.com/decocms/b51001ef-ae58-4db4-8a75-9e6d2df2dd8e/openai.png",baseUrlPlaceholder:"https://api.openai.com/v1",defaultBaseUrl:"https://api.openai.com/v1",apiKeyRecommended:!0,helpText:"Use your OpenAI API key (starts with sk-)."},{id:"litellm",name:"LiteLLM",description:"Connect to a LiteLLM gateway your team manages",logo:"https://decoims.com/decocms/e974ae05-ad64-4b4a-8444-d9705f019b85/litellm.png",baseUrlPlaceholder:"http://localhost:4000",apiKeyRecommended:!0,helpText:"Point at your LiteLLM proxy. The base URL should be the root of the proxy (we'll append /v1)."},{id:"ollama",name:"Ollama",description:"Run open-source models on your own computer",logo:"https://decoims.com/decocms/2bb2f822-5288-4b7c-a541-dcbef76525a0/ollama.png",baseUrlPlaceholder:"http://localhost:11434",apiKeyRecommended:!1,helpText:"Ollama exposes /v1 by default — no API key required for local use."},{id:"lm-studio",name:"LM Studio",description:"Open models running through LM Studio",logo:"https://decoims.com/decocms/9f0ab1a9-d2d5-4f3e-9de0-aadd4926428d/lmstudio.webp",baseUrlPlaceholder:"http://localhost:1234",apiKeyRecommended:!1,helpText:"Start the local server in LM Studio, then paste its base URL here."},{id:"vllm",name:"vLLM",description:"Connect to your team's self-hosted vLLM server",logo:"https://decoims.com/decocms/b6c60e4f-a4aa-443c-981f-ad0f31640e22/vllm.png",baseUrlPlaceholder:"http://localhost:8000",apiKeyRecommended:!1}];function ve(n){if(n)return nt.find(e=>e.id===n)}const Ke=4;function xe(n){const e=G.c(8),{logo:t,name:i,description:l,onClick:o}=n;let r;e[0]!==t||e[1]!==i?(r=t?s.jsx("img",{src:t,alt:i,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Yt,{fallback:i.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=i,e[2]=r):r=e[2];let c;return e[3]!==l||e[4]!==i||e[5]!==o||e[6]!==r?(c=s.jsx(tt,{onClick:o,icon:r,title:i,description:l}),e[3]=l,e[4]=i,e[5]=o,e[6]=r,e[7]=c):c=e[7],c}function lt(n){const e=G.c(32),{providers:t,onSelect:i,onShowAll:l}=n;let o;e[0]!==t?(o=t.find(ps),e[0]=t,e[1]=o):o=e[1];const r=o;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={openrouter:0,llmapi:1,anthropic:2,google:3},e[2]=c):c=e[2];const u=c;let d;if(e[3]!==i||e[4]!==t){let E;e[6]===Symbol.for("react.memo_cache_sentinel")?(E=(p,w)=>{const O=u[p.id]??Number.MAX_SAFE_INTEGER,T=u[w.id]??Number.MAX_SAFE_INTEGER;return O-T},e[6]=E):E=e[6];const _=t.filter(hs).sort(E);let M;e[7]!==t?(M=t.find(fs),e[7]=t,e[8]=M):M=e[8];const b=M;let j;e[9]===Symbol.for("react.memo_cache_sentinel")?(j=ve("openai"),e[9]=j):j=e[9];const y=j;let I;e[10]!==i?(I=p=>s.jsx(xe,{logo:p.logo,name:p.name,description:p.description,onClick:()=>i({kind:"provider",provider:p})},p.id),e[10]=i,e[11]=I):I=e[11];let C,v;e[12]!==i||e[13]!==b?(C=b&&y?[s.jsx(xe,{logo:y.logo,name:y.name,description:y.description,onClick:()=>i({kind:"openai-compatible",provider:b,preset:y})},y.id)]:[],v=b?[...nt.filter(ms).map(p=>s.jsx(xe,{logo:p.logo,name:p.name,description:p.description,onClick:()=>i({kind:"openai-compatible",provider:b,preset:p})},p.id)),s.jsx(xe,{logo:b.logo,name:"Custom OpenAI-compatible",description:"Bring your own model server (advanced)",onClick:()=>i({kind:"openai-compatible",provider:b,preset:null})},"custom")]:[],e[12]=i,e[13]=b,e[14]=C,e[15]=v):(C=e[14],v=e[15]),d=[..._.map(I),...C,...v],e[3]=i,e[4]=t,e[5]=d}else d=e[5];const a=d,m=a.length-Ke,f=!!l&&m>0;let h;e[16]!==a||e[17]!==f?(h=f?a.slice(0,Ke):a,e[16]=a,e[17]=f,e[18]=h):h=e[18];const x=h;let g;e[19]!==r||e[20]!==i?(g=r&&s.jsx(Pe,{children:s.jsxs("div",{className:"relative rounded-xl border border-violet-400/30 bg-gradient-to-br from-violet-50/50 via-transparent to-lime-50/30 dark:from-violet-950/20 dark:to-lime-950/10 p-1.5",children:[s.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-violet-400/5 to-lime-400/5 pointer-events-none"}),s.jsx("p",{className:"text-xs font-medium text-violet-700 dark:text-violet-400 mb-1.5 px-2 pt-2 relative",children:"Recommended — 100+ models, pay as you go"}),s.jsx(Ae,{className:"relative",children:s.jsx(xe,{logo:r.logo,name:r.name,description:r.description,onClick:()=>i({kind:"provider",provider:r})})})]})}),e[19]=r,e[20]=i,e[21]=g):g=e[21];let S;e[22]!==m||e[23]!==l||e[24]!==f?(S=f&&s.jsx(tt,{onClick:l,title:`${m} more provider${m===1?"":"s"}`,action:s.jsx(Xt,{size:16,className:"text-muted-foreground"})}),e[22]=m,e[23]=l,e[24]=f,e[25]=S):S=e[25];let N;e[26]!==S||e[27]!==x?(N=s.jsx(Pe,{children:s.jsxs(Ae,{children:[x,S]})}),e[26]=S,e[27]=x,e[28]=N):N=e[28];let k;return e[29]!==g||e[30]!==N?(k=s.jsxs("div",{className:"flex flex-col gap-6",children:[g,N]}),e[29]=g,e[30]=N,e[31]=k):k=e[31],k}function ms(n){return n.id!=="openai"}function fs(n){return n.id==="openai-compatible"}function hs(n){return n.id!=="deco"&&n.id!=="openai-compatible"}function ps(n){return n.id==="deco"}const xs=He({label:ge().optional(),apiKey:ge().min(1,"API key is required")});function gs(n){const e=G.c(87),{providerId:t,onCancel:i,onSuccess:l}=n,{org:o}=pe(),r=ke(),c=Ce(),[u,d]=K.useState(!1),a=Me();let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={resolver:Ve(xs),defaultValues:{label:"",apiKey:""}},e[0]=m):m=e[0];const{register:f,handleSubmit:h,formState:x}=qe(m),{errors:g}=x;let S;e[1]!==t||e[2]!==r||e[3]!==a?(S=async Z=>{await r.call("AI_PROVIDER_KEY_CREATE",{providerId:t,label:Z.label||a("settings.connectForms.defaultKeyLabel"),apiKey:Z.apiKey})},e[1]=t,e[2]=r,e[3]=a,e[4]=S):S=e[4];let N;e[5]!==l||e[6]!==o||e[7]!==c||e[8]!==a?(N=()=>{c.invalidateQueries({queryKey:le.aiProviderKeys(o.id)}),c.invalidateQueries({queryKey:le.aiProviders(o.id)}),se.success(a("settings.connectForms.keySavedSuccess")),l()},e[5]=l,e[6]=o,e[7]=c,e[8]=a,e[9]=N):N=e[9];let k;e[10]!==a?(k=Z=>{se.error(a("settings.connectForms.failedSaveKey",{error:Z.message}))},e[10]=a,e[11]=k):k=e[11];let E;e[12]!==S||e[13]!==N||e[14]!==k?(E={mutationFn:S,onSuccess:N,onError:k},e[12]=S,e[13]=N,e[14]=k,e[15]=E):E=e[15];const{mutate:_,isPending:M,error:b}=Ne(E);let j;e[16]!==_?(j=Z=>_(Z),e[16]=_,e[17]=j):j=e[17];let y;e[18]!==h||e[19]!==j?(y=h(j),e[18]=h,e[19]=j,e[20]=y):y=e[20];let I;e[21]!==a?(I=a("settings.connectForms.labelField"),e[21]=a,e[22]=I):I=e[22];let C;e[23]!==I?(C=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:I}),e[23]=I,e[24]=C):C=e[24];let v;e[25]!==a?(v=a("settings.connectForms.labelPlaceholder"),e[25]=a,e[26]=v):v=e[26];let p;e[27]!==f?(p=f("label"),e[27]=f,e[28]=p):p=e[28];let w;e[29]!==v||e[30]!==p?(w=s.jsx(fe,{placeholder:v,...p,className:"h-8 text-sm"}),e[29]=v,e[30]=p,e[31]=w):w=e[31];let O;e[32]!==C||e[33]!==w?(O=s.jsxs("div",{className:"space-y-1",children:[C,w]}),e[32]=C,e[33]=w,e[34]=O):O=e[34];let T;e[35]!==a?(T=a("settings.connectForms.apiKeyField"),e[35]=a,e[36]=T):T=e[36];let z;e[37]!==T?(z=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:T}),e[37]=T,e[38]=z):z=e[38];const A=u?"text":"password";let L;e[39]!==f?(L=f("apiKey"),e[39]=f,e[40]=L):L=e[40];let F;e[41]!==A||e[42]!==L?(F=s.jsx(fe,{type:A,placeholder:"sk-...",...L,className:"ph-no-capture h-8 text-sm pr-8"}),e[41]=A,e[42]=L,e[43]=F):F=e[43];let D;e[44]!==u?(D=()=>d(!u),e[44]=u,e[45]=D):D=e[45];let U;e[46]!==u||e[47]!==a?(U=a(u?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[46]=u,e[47]=a,e[48]=U):U=e[48];let V;e[49]!==u?(V=u?s.jsx(Je,{size:14}):s.jsx(st,{size:14}),e[49]=u,e[50]=V):V=e[50];let X;e[51]!==D||e[52]!==U||e[53]!==V?(X=s.jsx("button",{type:"button",onClick:D,"aria-label":U,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:V}),e[51]=D,e[52]=U,e[53]=V,e[54]=X):X=e[54];let B;e[55]!==F||e[56]!==X?(B=s.jsxs("div",{className:"relative",children:[F,X]}),e[55]=F,e[56]=X,e[57]=B):B=e[57];let Y;e[58]!==g.apiKey?(Y=g.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:g.apiKey.message}),e[58]=g.apiKey,e[59]=Y):Y=e[59];let P;e[60]!==z||e[61]!==B||e[62]!==Y?(P=s.jsxs("div",{className:"space-y-1",children:[z,B,Y]}),e[60]=z,e[61]=B,e[62]=Y,e[63]=P):P=e[63];let q;e[64]!==b?(q=b&&s.jsx("p",{className:"text-xs text-destructive",children:b.message}),e[64]=b,e[65]=q):q=e[65];let $;e[66]!==a?($=a("settings.connectForms.cancel"),e[66]=a,e[67]=$):$=e[67];let W;e[68]!==M||e[69]!==i||e[70]!==$?(W=s.jsx(ie,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:M,children:$}),e[68]=M,e[69]=i,e[70]=$,e[71]=W):W=e[71];let H;e[72]!==M||e[73]!==a?(H=a(M?"settings.connectForms.saving":"settings.connectForms.saveKey"),e[72]=M,e[73]=a,e[74]=H):H=e[74];let R;e[75]!==M||e[76]!==H?(R=s.jsx(ie,{type:"submit",size:"sm",disabled:M,children:H}),e[75]=M,e[76]=H,e[77]=R):R=e[77];let J;e[78]!==W||e[79]!==R?(J=s.jsxs(Ge,{children:[W,R]}),e[78]=W,e[79]=R,e[80]=J):J=e[80];let ee;return e[81]!==O||e[82]!==P||e[83]!==q||e[84]!==J||e[85]!==y?(ee=s.jsxs("form",{onSubmit:y,className:"space-y-3",children:[O,P,q,J]}),e[81]=O,e[82]=P,e[83]=q,e[84]=J,e[85]=y,e[86]=ee):ee=e[86],ee}const vs=He({label:ge().optional(),baseUrl:ge().min(1,"Base URL is required"),apiKey:ge().optional()});function bs(n){const e=G.c(105),{preset:t,onCancel:i,onSuccess:l}=n,{org:o}=pe(),r=ke(),c=Ce(),[u,d]=K.useState(!1),a=Me();let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=Ve(vs),e[0]=m):m=e[0];const f=t?.defaultBaseUrl??"";let h;e[1]!==f?(h={resolver:m,defaultValues:{label:"",baseUrl:f,apiKey:""}},e[1]=f,e[2]=h):h=e[2];const{register:x,handleSubmit:g,formState:S}=qe(h),{errors:N}=S;let k;e[3]!==t||e[4]!==r?(k=async ne=>{const pt=JSON.stringify({baseUrl:ne.baseUrl,apiKey:ne.apiKey||""});await r.call("AI_PROVIDER_KEY_CREATE",{providerId:"openai-compatible",label:ne.label||t?.name||ne.baseUrl,apiKey:pt,...t?{presetId:t.id}:{}})},e[3]=t,e[4]=r,e[5]=k):k=e[5];let E;e[6]!==l||e[7]!==o||e[8]!==c||e[9]!==a?(E=()=>{c.invalidateQueries({queryKey:le.aiProviderKeys(o.id)}),c.invalidateQueries({queryKey:le.aiProviders(o.id)}),se.success(a("settings.connectForms.connectionSavedSuccess")),l()},e[6]=l,e[7]=o,e[8]=c,e[9]=a,e[10]=E):E=e[10];let _;e[11]!==a?(_=ne=>{se.error(a("settings.connectForms.failedSaveConnection",{error:ne.message}))},e[11]=a,e[12]=_):_=e[12];let M;e[13]!==k||e[14]!==E||e[15]!==_?(M={mutationFn:k,onSuccess:E,onError:_},e[13]=k,e[14]=E,e[15]=_,e[16]=M):M=e[16];const{mutate:b,isPending:j,error:y}=Ne(M);let I;e[17]!==t||e[18]!==a?(I=t?a("settings.connectForms.labelPlaceholderPreset",{name:t.name}):a("settings.connectForms.labelPlaceholderOpenAiCompatible"),e[17]=t,e[18]=a,e[19]=I):I=e[19];const C=I;let v;e[20]!==t?.baseUrlPlaceholder||e[21]!==a?(v=t?.baseUrlPlaceholder??a("settings.connectForms.baseUrlPlaceholder"),e[20]=t?.baseUrlPlaceholder,e[21]=a,e[22]=v):v=e[22];const p=v;let w;e[23]!==b?(w=ne=>b(ne),e[23]=b,e[24]=w):w=e[24];let O;e[25]!==g||e[26]!==w?(O=g(w),e[25]=g,e[26]=w,e[27]=O):O=e[27];let T;e[28]!==a?(T=a("settings.connectForms.labelField"),e[28]=a,e[29]=T):T=e[29];let z;e[30]!==T?(z=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:T}),e[30]=T,e[31]=z):z=e[31];let A;e[32]!==x?(A=x("label"),e[32]=x,e[33]=A):A=e[33];let L;e[34]!==C||e[35]!==A?(L=s.jsx(fe,{placeholder:C,...A,className:"h-8 text-sm"}),e[34]=C,e[35]=A,e[36]=L):L=e[36];let F;e[37]!==z||e[38]!==L?(F=s.jsxs("div",{className:"space-y-1",children:[z,L]}),e[37]=z,e[38]=L,e[39]=F):F=e[39];let D;e[40]!==p||e[41]!==N||e[42]!==t?.defaultBaseUrl||e[43]!==x||e[44]!==a?(D=t?.defaultBaseUrl?s.jsx("input",{type:"hidden",...x("baseUrl")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:a("settings.connectForms.baseUrlField")}),s.jsx(fe,{type:"url",placeholder:p,...x("baseUrl"),className:"h-8 text-sm"}),N.baseUrl&&s.jsx("p",{className:"text-xs text-destructive",children:N.baseUrl.message})]}),e[40]=p,e[41]=N,e[42]=t?.defaultBaseUrl,e[43]=x,e[44]=a,e[45]=D):D=e[45];let U;e[46]!==a?(U=a("settings.connectForms.apiKeyField"),e[46]=a,e[47]=U):U=e[47];let V;e[48]!==t?.apiKeyRecommended||e[49]!==a?(V=t?.apiKeyRecommended?a("settings.connectForms.recommended"):a("settings.connectForms.optional"),e[48]=t?.apiKeyRecommended,e[49]=a,e[50]=V):V=e[50];let X;e[51]!==V?(X=s.jsxs("span",{className:"text-muted-foreground/60",children:["(",V,")"]}),e[51]=V,e[52]=X):X=e[52];let B;e[53]!==U||e[54]!==X?(B=s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[U," ",X]}),e[53]=U,e[54]=X,e[55]=B):B=e[55];const Y=u?"text":"password";let P;e[56]!==x?(P=x("apiKey"),e[56]=x,e[57]=P):P=e[57];let q;e[58]!==Y||e[59]!==P?(q=s.jsx(fe,{type:Y,placeholder:"sk-...",...P,className:"ph-no-capture h-8 text-sm pr-8"}),e[58]=Y,e[59]=P,e[60]=q):q=e[60];let $;e[61]!==u?($=()=>d(!u),e[61]=u,e[62]=$):$=e[62];let W;e[63]!==u||e[64]!==a?(W=a(u?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[63]=u,e[64]=a,e[65]=W):W=e[65];let H;e[66]!==u?(H=u?s.jsx(Je,{size:14}):s.jsx(st,{size:14}),e[66]=u,e[67]=H):H=e[67];let R;e[68]!==$||e[69]!==W||e[70]!==H?(R=s.jsx("button",{type:"button",onClick:$,"aria-label":W,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:H}),e[68]=$,e[69]=W,e[70]=H,e[71]=R):R=e[71];let J;e[72]!==q||e[73]!==R?(J=s.jsxs("div",{className:"relative",children:[q,R]}),e[72]=q,e[73]=R,e[74]=J):J=e[74];let ee;e[75]!==B||e[76]!==J?(ee=s.jsxs("div",{className:"space-y-1",children:[B,J]}),e[75]=B,e[76]=J,e[77]=ee):ee=e[77];let Z;e[78]!==t?(Z=t?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:t.helpText}),e[78]=t,e[79]=Z):Z=e[79];let oe;e[80]!==y?(oe=y&&s.jsx("p",{className:"text-xs text-destructive",children:y.message}),e[80]=y,e[81]=oe):oe=e[81];let re;e[82]!==a?(re=a("settings.connectForms.cancel"),e[82]=a,e[83]=re):re=e[83];let ae;e[84]!==j||e[85]!==i||e[86]!==re?(ae=s.jsx(ie,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:j,children:re}),e[84]=j,e[85]=i,e[86]=re,e[87]=ae):ae=e[87];let ce;e[88]!==j||e[89]!==a?(ce=a(j?"settings.connectForms.saving":"settings.connectForms.saveConnection"),e[88]=j,e[89]=a,e[90]=ce):ce=e[90];let de;e[91]!==j||e[92]!==ce?(de=s.jsx(ie,{type:"submit",size:"sm",disabled:j,children:ce}),e[91]=j,e[92]=ce,e[93]=de):de=e[93];let ue;e[94]!==ae||e[95]!==de?(ue=s.jsxs(Ge,{children:[ae,de]}),e[94]=ae,e[95]=de,e[96]=ue):ue=e[96];let be;return e[97]!==O||e[98]!==F||e[99]!==D||e[100]!==ee||e[101]!==Z||e[102]!==oe||e[103]!==ue?(be=s.jsxs("form",{onSubmit:O,className:"space-y-3",children:[F,D,ee,Z,oe,ue]}),e[97]=O,e[98]=F,e[99]=D,e[100]=ee,e[101]=Z,e[102]=oe,e[103]=ue,e[104]=be):be=e[104],be}const js={kind:"closed"};function ys(n,e){switch(e.type){case"open":return n.kind==="closed"?{kind:"grid"}:n;case"close":return{kind:"closed"};case"back":switch(n.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return{kind:"grid"};default:return n}case"select-form":return n.kind!=="grid"?n:{kind:"form",providerId:e.providerId,presetId:e.presetId};case"select-oauth":return n.kind!=="grid"?n:{kind:"oauth-pending",providerId:e.providerId,stateToken:e.stateToken};case"oauth-failed":return n.kind==="oauth-pending"?{kind:"grid"}:n;case"select-provision":return n.kind!=="grid"?n:{kind:"provision-pending",providerId:e.providerId};case"provision-error":return n.kind!=="provision-pending"?n:{kind:"provision-error",providerId:n.providerId,error:e.error};case"retry-provision":return n.kind!=="provision-error"?n:{kind:"provision-pending",providerId:n.providerId}}}function Ss(n){switch(n.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return n.providerId;default:return null}}function Ns({open:n,onOpenChange:e,initialProvider:t}){const i=Me(),o=Ie()?.providers??[],{org:r}=pe(),c=ke(),u=Ce(),[d,a]=K.useReducer(ys,js),m=K.useRef(!1);K.useEffect(()=>{n&&d.kind==="closed"?a({type:"open"}):!n&&d.kind!=="closed"&&a({type:"close"})},[n,d.kind]);const f=()=>{m.current=!1,a({type:"close"}),e(!1)},h=()=>{u.invalidateQueries({queryKey:le.aiProviderKeys(r.id)}),u.invalidateQueries({queryKey:le.aiProviders(r.id)})},{mutate:x}=Ne({mutationFn:async({providerId:v,code:p,stateToken:w,label:O})=>(await c.call("AI_PROVIDER_OAUTH_EXCHANGE",{providerId:v,code:p,stateToken:w,label:O}),v),onSuccess:v=>{te("ai_provider_oauth_succeeded",{provider_id:v}),h();const p=o.find(w=>w.id===v);se.success(i("settings.connectProviderDialog.oauthSuccessMessage",{provider:p?.name??i("settings.connectProviderDialog.defaultProviderName")})),f()},onError:(v,p)=>{te("ai_provider_oauth_failed",{provider_id:p.providerId,error:v.message}),se.error(i("settings.connectProviderDialog.oauthFailedMessage",{error:v.message})),a({type:"oauth-failed"})}}),{mutate:g}=Ne({mutationFn:async v=>(await c.call("AI_PROVIDER_PROVISION_KEY",{providerId:v}),v),onSuccess:v=>{te("ai_provider_provision_succeeded",{provider_id:v}),h();const p=o.find(w=>w.id===v);se.success(i("settings.connectProviderDialog.provisionSuccessMessage",{provider:p?.name??i("settings.connectProviderDialog.defaultProviderName")})),f()},onError:(v,p)=>{te("ai_provider_provision_failed",{provider_id:p,error:v.message}),a({type:"provision-error",error:v.message})}}),S=async v=>{const{provider:p}=v,w=v.kind==="openai-compatible"?v.preset?.id??null:null,O=p.supportedMethods.includes("oauth-pkce"),T=p.supportedMethods.includes("api-key");if(p.supportsProvision===!0){te("ai_provider_connect_clicked",{provider_id:p.id,method:"provision"}),a({type:"select-provision",providerId:p.id}),g(p.id);return}if(O){te("ai_provider_connect_clicked",{provider_id:p.id,method:"oauth-pkce"});try{const A=await c.call("AI_PROVIDER_OAUTH_URL",{providerId:p.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`});if(!A?.url)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");a({type:"select-oauth",providerId:p.id,stateToken:A.stateToken}),window.open(A.url,"AiProviderOAuth","width=600,height=700")}catch(A){se.error(i("settings.connectProviderDialog.startOAuthFailedMessage",{error:A instanceof Error?A.message:String(A)}))}return}T&&(te("ai_provider_connect_clicked",{provider_id:p.id,...w!==null?{preset_id:w}:{},method:"api-key"}),a({type:"select-form",providerId:p.id,presetId:w}))},N=K.useRef(S);N.current=S;const k=K.useRef(t);k.current=t,K.useEffect(()=>{!k.current||d.kind!=="grid"||m.current||(m.current=!0,N.current(k.current))},[d.kind]);const E=d.kind==="oauth-pending"?d.stateToken:null,_=d.kind==="oauth-pending"?d.providerId:null;K.useEffect(()=>{if(d.kind!=="oauth-pending")return;let v=!1;const p=d.stateToken,w=d.providerId,O=z=>{if(z.origin!==window.location.origin||z.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:A,stateToken:L}=z.data;if(L!==p){se.error(i("settings.connectProviderDialog.securityCheckFailedMessage")),a({type:"oauth-failed"});return}v=!0;const F=o.find(D=>D.id===w);x({providerId:w,code:A,stateToken:p,label:F?.name??w})};window.addEventListener("message",O);const T=setTimeout(()=>{v||(te("ai_provider_oauth_timeout",{provider_id:w}),a({type:"oauth-failed"}),se.error(i("settings.connectProviderDialog.connectionTimedOutMessage")))},12e4);return()=>{window.removeEventListener("message",O),clearTimeout(T)}},[d.kind,E,_,x]);const M=Ss(d),b=M?o.find(v=>v.id===M):null,y=(d.kind==="form"&&d.presetId?ve(d.presetId):null)?.name??b?.name??i("settings.connectProviderDialog.defaultTitle"),I=d.kind!=="grid"&&d.kind!=="closed",C=()=>{t?f():a({type:"back"})};return s.jsx(Xe,{open:d.kind!=="closed",onOpenChange:v=>!v&&f(),children:s.jsxs(Ye,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[s.jsxs(St,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[I&&s.jsx(ie,{variant:"ghost",size:"icon","aria-label":i("settings.connectProviderDialog.backButtonLabel"),className:"h-7 w-7",onClick:C,children:s.jsx(Ze,{size:16})}),s.jsx(Qe,{children:y})]}),d.kind==="grid"&&!t&&s.jsx(Nt,{children:i("settings.connectProviderDialog.gridDescription")})]}),d.kind==="grid"&&!t&&s.jsx(lt,{providers:o,onSelect:S}),d.kind==="form"&&(d.providerId==="openai-compatible"?s.jsx(bs,{preset:d.presetId?ve(d.presetId):void 0,onCancel:()=>a({type:"back"}),onSuccess:()=>{h(),f()}}):s.jsx(gs,{providerId:d.providerId,onCancel:()=>a({type:"back"}),onSuccess:()=>{h(),f()}})),d.kind==="oauth-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Te,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:i("settings.connectProviderDialog.oauthPendingMessage")})]}),d.kind==="provision-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Te,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:i("settings.connectProviderDialog.provisionPendingMessage")})]}),d.kind==="provision-error"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-6",children:[s.jsx(Gt,{size:28,className:"text-destructive"}),s.jsx("p",{className:"text-sm text-foreground text-center",children:d.error}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>a({type:"back"}),children:i("settings.connectProviderDialog.backButton")}),s.jsx(ie,{size:"sm",onClick:()=>{a({type:"retry-provision"}),g(d.providerId)},children:i("settings.connectProviderDialog.retryButton")})]})]})]})})}function ks(){const n=G.c(7),{org:e}=pe(),t=ke();let i;n[0]!==e.id?(i=le.defaultBrand(e.id),n[0]=e.id,n[1]=i):i=n[1];let l;n[2]!==t?(l=async()=>{const{items:c}=await t.call("BRAND_CONTEXT_LIST",{});return(Array.isArray(c)?c:[]).find(Cs)??null},n[2]=t,n[3]=l):l=n[3];let o;n[4]!==i||n[5]!==l?(o={queryKey:i,queryFn:l},n[4]=i,n[5]=l,n[6]=o):o=n[6];const{data:r}=vt(o);return r??null}function Cs(n){return n.isDefault&&!n.archivedAt}function ws(n){const e=n.colors;if(!e)return null;if(Array.isArray(e)){const t=e.find(l=>typeof l=="object"&&l!==null&&"label"in l&&/primary|brand|main/i.test(l.label)),i=t?t.value:e[0]?.value;return typeof i=="string"?i:null}if(typeof e=="object"){const t=e;return t.primary??Object.values(t)[0]??null}return null}function Is(n){const e=G.c(50);let t;e[0]!==n?(t=n===void 0?{}:n,e[0]=n,e[1]=t):t=e[1];const{title:i,description:l,onLocalRuntimePicked:o}=t,{org:r}=pe(),{localMode:c}=gt(),u=ks(),d=Et(),a=Ot(),[m,f]=K.useState(null),[h,x]=K.useState(!1),[g,S]=K.useState(!1),N=Ie();let k;e[2]!==N?.providers?(k=N?.providers??[],e[2]=N?.providers,e[3]=k):k=e[3];const E=k;let _;if(e[4]!==d.capabilities||e[5]!==d.online){if(_=[],d.online){if(d.capabilities.includes("claude-code")){let R;e[7]===Symbol.for("react.memo_cache_sentinel")?(R={option:"claude-code-desktop",label:"Claude Code",icon:s.jsx(ye,{size:16})},e[7]=R):R=e[7],_.push(R)}if(d.capabilities.includes("codex")){let R;e[8]===Symbol.for("react.memo_cache_sentinel")?(R={option:"codex-desktop",label:"Codex",icon:s.jsx(Se,{size:16})},e[8]=R):R=e[8],_.push(R)}}e[4]=d.capabilities,e[5]=d.online,e[6]=_}else _=e[6];const M=_.length>0&&a!==null,b=r.name;let j;e[9]!==u?(j=u?ws(u):null,e[9]=u,e[10]=j):j=e[10];const y=j,I=u?.favicon??u?.logo??null,C=i??(b?`${b} is ready for agents`:"Your agents are almost ready"),v=l??(M?"Your desktop is linked — start now with a local coding agent, or connect a cloud provider for hosted models.":c?"Connect a provider, or run `bunx decocms@latest link` on your desktop for Claude Code, Codex, and local files.":"Connect a provider — or run `bunx decocms@latest link` on your desktop to use Claude Code, Codex, or your local files."),p=!!(I||y);let w;e[11]!==y?(w=y?{backgroundColor:`${y}18`,borderColor:`${y}30`}:void 0,e[11]=y,e[12]=w):w=e[12];const O=w,T=p?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-muted border border-border";let z;e[13]!==T||e[14]!==O||e[15]!==I||e[16]!==d.online||e[17]!==y?(z=I?s.jsx("div",{className:T,style:O,children:s.jsx("img",{src:I,alt:"",className:"size-7 rounded object-contain"})}):s.jsx("button",{type:"button",onClick:()=>S(!0),"aria-label":d.online?"Desktop linked":"Connect your desktop",className:he(T,"cursor-pointer transition-colors hover:bg-accent"),style:O,children:s.jsxs("span",{className:"relative inline-flex items-center justify-center",children:[s.jsx(qt,{size:24,style:y?{color:y}:void 0,className:he(!y&&"text-muted-foreground")}),d.online&&s.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2.5 rounded-full bg-success ring-2 ring-background animate-pulse"})]})}),e[13]=T,e[14]=O,e[15]=I,e[16]=d.online,e[17]=y,e[18]=z):z=e[18];let A;e[19]!==C?(A=s.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:C}),e[19]=C,e[20]=A):A=e[20];let L;e[21]!==v?(L=s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:v}),e[21]=v,e[22]=L):L=e[22];let F;e[23]!==A||e[24]!==L?(F=s.jsxs("div",{className:"space-y-2",children:[A,L]}),e[23]=A,e[24]=L,e[25]=F):F=e[25];let D;e[26]!==z||e[27]!==F?(D=s.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[z,F]}),e[26]=z,e[27]=F,e[28]=D):D=e[28];let U;e[29]!==a||e[30]!==M||e[31]!==_||e[32]!==o?(U=M&&s.jsxs("div",{className:"flex flex-col items-center gap-3 w-full",children:[s.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2",children:_.map(R=>s.jsxs(ie,{variant:"default",className:"gap-2",onClick:()=>{a?.setPendingAgentOption(R.option),o?.(R.option)},children:[R.icon,"Use ",R.label]},R.option))}),s.jsxs("div",{className:"flex items-center gap-3 w-full max-w-xs text-xs text-muted-foreground",children:[s.jsx("span",{className:"h-px flex-1 bg-border"}),"or connect a cloud provider",s.jsx("span",{className:"h-px flex-1 bg-border"})]})]}),e[29]=a,e[30]=M,e[31]=_,e[32]=o,e[33]=U):U=e[33];let V,X;e[34]===Symbol.for("react.memo_cache_sentinel")?(V=R=>f(R),X=()=>x(!0),e[34]=V,e[35]=X):(V=e[34],X=e[35]);let B;e[36]!==E?(B=s.jsx("div",{className:"w-full",children:s.jsx(lt,{providers:E,onSelect:V,onShowAll:X})}),e[36]=E,e[37]=B):B=e[37];const Y=m!==null||h;let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=R=>{R||(f(null),x(!1))},e[38]=P):P=e[38];const q=m??void 0;let $;e[39]!==Y||e[40]!==q?($=s.jsx(Ns,{open:Y,onOpenChange:P,initialProvider:q}),e[39]=Y,e[40]=q,e[41]=$):$=e[41];let W;e[42]!==g?(W=s.jsx(Qt,{open:g,onOpenChange:S}),e[42]=g,e[43]=W):W=e[43];let H;return e[44]!==U||e[45]!==B||e[46]!==$||e[47]!==W||e[48]!==D?(H=s.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-3xl px-4",children:[D,U,B,$,W]}),e[44]=U,e[45]=B,e[46]=$,e[47]=W,e[48]=D,e[49]=H):H=e[49],H}function Ee(n){const e=n.title.includes(": ");return{provider:e?n.title.split(": ")[0]??"":n.modelId.split("/")[0]??"",displayName:e?n.title.split(": ").slice(1).join(": "):n.title}}function _s(n){return n<32e3?{level:1,label:"Small",description:"Short conversations"}:n<2e5?{level:2,label:"Medium",description:"Good for most tasks"}:n<5e5?{level:3,label:"Large",description:"Long projects & research"}:{level:4,label:"Very large",description:"Massive files & data"}}const Ms=["bg-destructive","bg-warning","bg-success","bg-success"],Es=["text-success","text-warning","text-warning","text-destructive"];function Os(n){const e=Math.round(n*.75/1e3);return e>=1?`~${e}K words`:`~${Math.round(n*.75)} words`}function Ts(n){return n<1?{level:1,label:"Cheap"}:n<5?{level:2,label:"Moderate"}:n<15?{level:3,label:"High"}:{level:4,label:"Expensive"}}const Ps={text:{icon:s.jsx(Ut,{className:"size-3.5"}),label:"Text"},vision:{icon:s.jsx(Jt,{className:"size-3.5"}),label:"Vision"},image:{icon:s.jsx(Ft,{className:"size-3.5"}),label:"Image"},tools:{icon:s.jsx(Kt,{className:"size-3.5"}),label:"Tools"},reasoning:{icon:s.jsx(Zt,{className:"size-3.5"}),label:"Reasoning"},"web-search":{icon:s.jsx(et,{className:"size-3.5"}),label:"Web search"}};function As(n){const e=G.c(5),{capability:t}=n;let i;e[0]!==t?(i=Ps[t]??{icon:null,label:t.charAt(0).toUpperCase()+t.slice(1)},e[0]=t,e[1]=i):i=e[1];const l=i;let o;return e[2]!==l.icon||e[3]!==l.label?(o=s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[l.icon,l.label]}),e[2]=l.icon,e[3]=l.label,e[4]=o):o=e[4],o}function zs(n){const e=G.c(49),{model:t,compact:i}=n,l=i===void 0?!1:i;if(!t){let b;return e[0]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=b):b=e[0],b}const o=t.costs?.input!=null?t.costs.input*1e6:null,r=t.costs?.output!=null?t.costs.output*1e6:null;let c;e[1]!==t?(c=Ee(t),e[1]=t,e[2]=c):c=e[2];const{provider:u,displayName:d}=c;if(l){let b;e[3]!==t.limits?(b=t.limits?.contextWindow&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Context"}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," tokens"]})]}),e[3]=t.limits,e[4]=b):b=e[4];let j;e[5]!==o?(j=o!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Input"}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",o.toFixed(2)," / 1M"]})]}),e[5]=o,e[6]=j):j=e[6];let y;e[7]!==r?(y=r!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Output"}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[7]=r,e[8]=y):y=e[8];let I;e[9]!==t.limits?(I=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," tokens"]})]}),e[9]=t.limits,e[10]=I):I=e[10];let C;return e[11]!==b||e[12]!==j||e[13]!==y||e[14]!==I?(C=s.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[b,j,y,I]}),e[11]=b,e[12]=j,e[13]=y,e[14]=I,e[15]=C):C=e[15],C}let a;e[16]!==u?(a=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:u}),e[16]=u,e[17]=a):a=e[17];let m;e[18]!==t.logo||e[19]!==t.title?(m=t.logo&&s.jsx("img",{src:t.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[18]=t.logo,e[19]=t.title,e[20]=m):m=e[20];let f;e[21]!==d?(f=s.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:d}),e[21]=d,e[22]=f):f=e[22];let h;e[23]!==m||e[24]!==f?(h=s.jsxs("div",{className:"flex items-center gap-2.5",children:[m,f]}),e[23]=m,e[24]=f,e[25]=h):h=e[25];let x;e[26]!==t.modelId?(x=s.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[26]=t.modelId,e[27]=x):x=e[27];let g;e[28]!==a||e[29]!==h||e[30]!==x?(g=s.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[a,h,x]}),e[28]=a,e[29]=h,e[30]=x,e[31]=g):g=e[31];let S;e[32]!==t.capabilities?(S=t.capabilities&&t.capabilities.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(t.capabilities)].map(Rs)}),e[32]=t.capabilities,e[33]=S):S=e[33];let N;e[34]!==t.limits?(N=t.limits?.contextWindow&&(()=>{const{level:b,label:j,description:y}=_s(t.limits.contextWindow);return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Context window"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(I=>s.jsx("div",{className:he("w-2 h-2 rounded-full",I<=b?Ms[b-1]:"bg-muted")},I))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:j}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",y]})]}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," tokens"]})]})})(),e[34]=t.limits,e[35]=N):N=e[35];let k;e[36]!==t.limits?(k=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Output limit"}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-sm text-foreground",children:[t.limits.maxOutputTokens.toLocaleString()," tokens"]}),s.jsx("span",{className:"text-sm text-muted-foreground",children:Os(t.limits.maxOutputTokens)})]})]}),e[36]=t.limits,e[37]=k):k=e[37];let E;e[38]!==o||e[39]!==r?(E=(o!=null||r!=null)&&(()=>{const{level:b,label:j}=o!=null?Ts(o):{level:0,label:""};return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Pricing"}),o!=null&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(y=>s.jsx("span",{className:he("text-sm font-bold leading-none",y<=b?Es[b-1]:"text-muted-foreground/20"),children:"$"},y))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:j})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[o!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Input"}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",o.toFixed(2)," / 1M tokens"]})]}),r!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Output"}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M tokens"]})]})]})]})})(),e[38]=o,e[39]=r,e[40]=E):E=e[40];let _;e[41]!==N||e[42]!==k||e[43]!==E?(_=s.jsxs("div",{className:"flex flex-col gap-6",children:[N,k,E]}),e[41]=N,e[42]=k,e[43]=E,e[44]=_):_=e[44];let M;return e[45]!==_||e[46]!==g||e[47]!==S?(M=s.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[g,S,_]}),e[45]=_,e[46]=g,e[47]=S,e[48]=M):M=e[48],M}function Rs(n){return s.jsx(As,{capability:n},n)}function ot(n){const e=G.c(19),{model:t,placeholder:i,isLoading:l}=n,o=i===void 0?"Select model":i;if(l===void 0?!1:l){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Q,{className:"w-5 h-5 rounded-sm shrink-0"}),s.jsx(Q,{className:"w-16 h-3 hidden md:block"})]}),e[0]=g):g=e[0],g}if(!t){let g;e[1]!==o?(g=s.jsx("span",{className:"text-sm text-muted-foreground",children:o}),e[1]=o,e[2]=g):g=e[2];let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(ze,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[3]=S):S=e[3];let N;return e[4]!==g?(N=s.jsxs("div",{className:"flex items-center gap-1.5",children:[g,S]}),e[4]=g,e[5]=N):N=e[5],N}let c;e[6]!==t?(c=Ee(t),e[6]=t,e[7]=c):c=e[7];const{displayName:u}=c;let d;e[8]!==t?(d=_e(t),e[8]=t,e[9]=d):d=e[9];const a=d;let m;e[10]!==t.title||e[11]!==a?(m=s.jsx("img",{src:a,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[10]=t.title,e[11]=a,e[12]=m):m=e[12];let f;e[13]!==u?(f=s.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:u}),e[13]=u,e[14]=f):f=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(ze,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[15]=h):h=e[15];let x;return e[16]!==m||e[17]!==f?(x=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[m,f,h]}),e[16]=m,e[17]=f,e[18]=x):x=e[18],x}const Ls=["vision","image","file","audio","video"],rt=["image/png","image/jpeg","image/gif","image/webp"],at=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function Oe(n){const e=n?.capabilities;return e?Ls.some(t=>e.includes(t)):!1}function Gi(n,e){if(!n)return!1;if(n.startsWith("text/"))return!0;const t=e?.capabilities??[],i=t.includes("vision")||t.includes("image"),l=t.includes("file"),o=t.includes("audio"),r=t.includes("video");return!!(i&&rt.includes(n)||l&&n==="application/pdf"||o&&n.startsWith("audio/")||r&&n.startsWith("video/")||Oe(e)&&at.includes(n))}function Xi(n){const e=n?.capabilities??[],t=["text/*"];return(e.includes("vision")||e.includes("image"))&&t.push(...rt),e.includes("file")&&t.push("application/pdf"),e.includes("audio")&&t.push("audio/*"),e.includes("video")&&t.push("video/*"),Oe(n)&&t.push(...at),t.join(",")}function Yi(n){const e=n?.capabilities??[],t=[];return(e.includes("vision")||e.includes("image"))&&t.push("images"),e.includes("file")&&t.push("PDFs"),e.includes("audio")&&t.push("audio"),e.includes("video")&&t.push("video"),Oe(n)&&t.push("Office files"),t.length===0?"text only":t.length===1?t[0]:t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t.at(-1)}`}const ct=["smarter","faster","cheaper"],dt={smarter:"Smarter",faster:"Faster",cheaper:"Cheaper"},Fs=[{tier:"smarter",prefixes:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],Ds=Fs.flatMap(({tier:n,prefixes:e})=>e.map(t=>({tier:n,prefix:t}))).sort((n,e)=>e.prefix.length-n.prefix.length),$s="google/gemini-2.5-pro",Ue=new Map;function Ks(n){const e=Ue.get(n);if(e!==void 0)return e;let t=null;if(n.endsWith(":free"))t="cheaper";else for(const{tier:i,prefix:l}of Ds)if(n.startsWith(l)){if(l===$s&&n.length>l.length&&n[l.length]==="-"){const r=n[l.length+1];if(!r||!/\d/.test(r))continue}t=i;break}return Ue.set(n,t),t}function Be(n){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of n){const i=Ks(t.modelId);e[i??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((i,l)=>i.title.localeCompare(l.title));return e}const ut="mesh:model-shortlist:",Us=new Set(["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Bs(n){try{const e=localStorage.getItem(ut+n);return e?new Set(JSON.parse(e)):null}catch{return null}}function Ws(n,e){localStorage.setItem(ut+n,JSON.stringify([...e]))}function Hs(n){const e=G.c(21),{model:t,onHover:i}=n;let l;e[0]!==t?(l=Ee(t),e[0]=t,e[1]=l):l=e[1];const{displayName:o,provider:r}=l;let c;e[2]!==t?(c=_e(t),e[2]=t,e[3]=c):c=e[3];const u=c;let d;e[4]!==t||e[5]!==i?(d=()=>i(t),e[4]=t,e[5]=i,e[6]=d):d=e[6];let a;e[7]!==t.title||e[8]!==u?(a=s.jsx("img",{src:u,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[7]=t.title,e[8]=u,e[9]=a):a=e[9];let m;e[10]!==o?(m=s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:o}),e[10]=o,e[11]=m):m=e[11];let f;e[12]!==r?(f=s.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=f):f=e[13];let h;e[14]!==m||e[15]!==f?(h=s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[m,f]}),e[14]=m,e[15]=f,e[16]=h):h=e[16];let x;return e[17]!==d||e[18]!==a||e[19]!==h?(x=s.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:d,children:[a,h]}),e[17]=d,e[18]=a,e[19]=h,e[20]=x):x=e[20],x}function Vs(n){const e=G.c(10),{error:t,onRetry:i}=n;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:s.jsx(yt,{className:"size-5 text-destructive"})}),e[0]=l):l=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[1]=o):o=e[1];const r=t?.message||"Could not fetch models from this provider.";let c;e[2]!==r?(c=s.jsxs("div",{className:"flex flex-col gap-1",children:[o,s.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[r," Try another provider or retry."]})]}),e[2]=r,e[3]=c):c=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx($t,{className:"size-3.5"}),e[4]=u):u=e[4];let d;e[5]!==i?(d=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(ie,{variant:"outline",size:"sm",onClick:i,className:"gap-1.5",children:[u,"Retry"]})}),e[5]=i,e[6]=d):d=e[6];let a;return e[7]!==c||e[8]!==d?(a=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[l,c,d]}),e[7]=c,e[8]=d,e[9]=a):a=e[9],a}function qs(){const n=G.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(Gs)}),n[0]=e):e=n[0],e}function Gs(n,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(Q,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(Q,{className:"flex-1 h-4"}),s.jsx(Q,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function We(n){const e=G.c(12),{label:t,models:i,onSelect:l,onHover:o}=n;if(i.length===0)return null;let r;e[0]!==t?(r=s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=r):r=e[1];let c;if(e[2]!==i||e[3]!==o||e[4]!==l){let d;e[6]!==o||e[7]!==l?(d=a=>s.jsx("div",{onClick:()=>l(a),className:"cursor-pointer",children:s.jsx(Hs,{model:a,onHover:o})},a.modelId),e[6]=o,e[7]=l,e[8]=d):d=e[8],c=i.map(d),e[2]=i,e[3]=o,e[4]=l,e[5]=c}else c=e[5];let u;return e[9]!==r||e[10]!==c?(u=s.jsxs("div",{children:[r,c]}),e[9]=r,e[10]=c,e[11]=u):u=e[11],u}function Xs(n){const e=G.c(21),{model:t,isChecked:i,onToggle:l,onHover:o}=n,[r,c]=K.useState(i);r!==i&&c(i);let u;e[0]!==t?(u=_e(t),e[0]=t,e[1]=u):u=e[1];const d=u;let a;e[2]!==t||e[3]!==o?(a=()=>o(t),e[2]=t,e[3]=o,e[4]=a):a=e[4];let m;e[5]!==t.modelId||e[6]!==l?(m=()=>{c(Ys),l(t.modelId)},e[5]=t.modelId,e[6]=l,e[7]=m):m=e[7];let f;e[8]!==r||e[9]!==m?(f=s.jsx(Tt,{checked:r,onCheckedChange:m}),e[8]=r,e[9]=m,e[10]=f):f=e[10];let h;e[11]!==d||e[12]!==t.title?(h=s.jsx("img",{src:d,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[11]=d,e[12]=t.title,e[13]=h):h=e[13];let x;e[14]!==t.title?(x=s.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:t.title}),e[14]=t.title,e[15]=x):x=e[15];let g;return e[16]!==a||e[17]!==f||e[18]!==h||e[19]!==x?(g=s.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:a,children:[f,h,x]}),e[16]=a,e[17]=f,e[18]=h,e[19]=x,e[20]=g):g=e[20],g}function Ys(n){return!n}function Qs(n){const e=[];for(const t of ct)if(n[t].length>0){e.push({type:"header",label:dt[t]});for(const i of n[t])e.push({type:"model",model:i})}if(n.other.length>0){e.push({type:"header",label:"Other"});for(const t of n.other)e.push({type:"model",model:t})}return e}function Js({items:n,shortlistSet:e,onToggle:t,onHover:i}){const l=K.useRef(null),o=us({count:n.length,getScrollElement:()=>l.current,estimateSize:r=>n[r]?.type==="header"?36:44,overscan:6});return s.jsx("div",{ref:l,className:"flex-1 overflow-y-auto",children:s.jsx("div",{className:"relative",style:{height:o.getTotalSize()},children:o.getVirtualItems().map(r=>{const c=n[r.index];return c?s.jsx("div",{"data-index":r.index,ref:o.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${r.start}px)`},children:c.type==="header"?s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:c.label}):s.jsx(Xs,{model:c.model,isChecked:e.has(c.model.modelId),onToggle:t,onHover:i})},r.key):null})})})}function Zs(n){const e=G.c(23),{keyId:t,searchTerm:i,onHover:l,onModelSelect:o,managing:r,onToggleManage:c,filterModels:u}=n,{models:d}=Vt(t),a=u?d.filter(u):d.filter(ei);let m;e[0]!==t?(m=()=>(t?Bs(t):null)??Us,e[0]=t,e[1]=m):m=e[1];const[f,h]=K.useState(m),[,x]=K.useTransition();let g;e[2]!==t||e[3]!==x?(g=C=>{t&&x(()=>{h(v=>{const p=new Set(v);return p.has(C)?p.delete(C):p.add(C),Ws(t,p),p})})},e[2]=t,e[3]=x,e[4]=g):g=e[4];const S=g,N=i.toLowerCase().trim(),k=C=>N?C.filter(v=>v.title.toLowerCase().includes(N)||v.modelId.toLowerCase().includes(N)):C;if(r){const C=Be(k(a)),v=Qs(C);let p;e[5]!==f?(p=z=>f.has(z.modelId),e[5]=f,e[6]=p):p=e[6];const w=a.filter(p).length;let O;e[7]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Ze,{size:14}),e[7]=O):O=e[7];let T;return e[8]!==c?(T=s.jsxs("button",{type:"button",onClick:c,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[O,"Back"]}),e[8]=c,e[9]=T):T=e[9],s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[T,s.jsxs("span",{className:"text-xs text-muted-foreground",children:[w," selected"]})]}),s.jsx(Js,{items:v,shortlistSet:f,onToggle:S,onHover:l})]})}let E;e[10]!==f?(E=C=>f.has(C.modelId),e[10]=f,e[11]=E):E=e[11];const _=a.filter(E),M=_.length>0?_:a,b=Be(k(M));let j;e[12]!==b||e[13]!==l||e[14]!==o?(j=ct.map(C=>s.jsx(We,{label:dt[C],models:b[C],onSelect:o,onHover:l},C)),e[12]=b,e[13]=l,e[14]=o,e[15]=j):j=e[15];let y;e[16]!==b.other||e[17]!==l||e[18]!==o?(y=s.jsx(We,{label:"Other",models:b.other,onSelect:o,onHover:l}),e[16]=b.other,e[17]=l,e[18]=o,e[19]=y):y=e[19];let I;return e[20]!==j||e[21]!==y?(I=s.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[j,y]}),e[20]=j,e[21]=y,e[22]=I):I=e[22],I}function ei(n){return n.asyncResearch!==!0}function ti(){const n=G.c(6);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[s.jsx(Q,{className:"size-4 shrink-0"}),s.jsx(Q,{className:"flex-1 h-6"}),s.jsx(Q,{className:"w-[140px] h-8 shrink-0"})]})}),n[0]=e):e=n[0];let t;n[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(si)})]}),n[1]=t):t=n[1];let i;n[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(Q,{className:"size-6 shrink-0"}),s.jsx(Q,{className:"h-6 w-32"})]}),n[2]=i):i=n[2];let l;n[3]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[i,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Q,{className:"h-6 w-20 rounded-md"}),s.jsx(Q,{className:"h-6 w-24 rounded-md"})]})]}),n[3]=l):l=n[3];let o;n[4]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Q,{className:"h-4 w-24"}),s.jsx(Q,{className:"h-4 w-32"})]}),n[4]=o):o=n[4];let r;return n[5]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[t,s.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:s.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[l,s.jsxs("div",{className:"flex flex-col gap-4",children:[o,s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Q,{className:"h-4 w-16"}),s.jsx(Q,{className:"h-4 w-40"})]})]})]})})]}),n[5]=r):r=n[5],r}function si(n,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(Q,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(Q,{className:"flex-1 h-4"}),s.jsx(Q,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function mt(n){const e=G.c(49),{onClose:t,credentialId:i,onCredentialChange:l,selectedModel:o,onModelChange:r,filterModels:c}=n,[u,d]=K.useState(null),[a,m]=K.useState(""),[f,h]=K.useState(!1),x=K.useRef(null),g=Ie(),S=Ht();let N;e[0]!==g?.providers?(N=Object.fromEntries((g?.providers??[]).map(li)),e[0]=g?.providers,e[1]=N):N=e[1];const k=N,E=bt(),{org:_}=pe();let M;e[2]!==l?(M=P=>{l(P),d(null)},e[2]=l,e[3]=M):M=e[3];const b=M;let j;e[4]!==i||e[5]!==t||e[6]!==r?(j=P=>{i&&(r(P),m(""),t())},e[4]=i,e[5]=t,e[6]=r,e[7]=j):j=e[7];const y=j;if(S.length===0){let P;return e[8]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx("div",{className:"flex items-center justify-center p-8 w-full sm:w-[740px]",children:s.jsx(Is,{})}),e[8]=P):P=e[8],P}let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(et,{size:16,className:"text-muted-foreground shrink-0"}),e[9]=I):I=e[9];const C=f?"Search all models...":"Search for a model...";let v;e[10]===Symbol.for("react.memo_cache_sentinel")?(v=P=>m(P.target.value),e[10]=v):v=e[10];let p;e[11]!==a||e[12]!==C?(p=s.jsx(fe,{ref:x,type:"text",placeholder:C,value:a,onChange:v,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[11]=a,e[12]=C,e[13]=p):p=e[13];let w;e[14]!==i||e[15]!==b||e[16]!==S||e[17]!==k?(w=S.length>0&&s.jsxs(Pt,{value:i??"",onValueChange:b,children:[s.jsxs(At,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:ni,children:[s.jsx(zt,{placeholder:"Key",children:(()=>{const P=S.find(R=>R.id===i),q=P?k[P.providerId]:void 0,$=ve(P?.presetId),W=$?.logo??q?.logo,H=$?.name??q?.name??P?.providerId??"Key";return s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[W?s.jsx("img",{src:W,alt:H,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:H.slice(0,1).toUpperCase()}),s.jsx("span",{className:"text-xs truncate",children:H})]})})()}),s.jsx(Bt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),s.jsx(Rt,{children:S.map(P=>{const q=k[P.providerId],$=ve(P.presetId),W=$?.logo??q?.logo,H=$?.name??q?.name??P.providerId;return s.jsx(Lt,{value:P.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[W?s.jsx("img",{src:W,alt:H,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:H.slice(0,1).toUpperCase()}),s.jsxs("span",{children:[H," — ",P.label]})]})},P.id)})})]}),e[14]=i,e[15]=b,e[16]=S,e[17]=k,e[18]=w):w=e[18];let O;e[19]!==p||e[20]!==w?(O=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text",children:[I,p,w]})}),e[19]=p,e[20]=w,e[21]=O):O=e[21];let T;e[22]!==i?(T=P=>{const{error:q,resetError:$}=P;return s.jsx(Vs,{error:q,onRetry:$,credentialId:i??void 0})},e[22]=i,e[23]=T):T=e[23];let z;e[24]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(qs,{}),e[24]=z):z=e[24];const A=i??void 0;let L;e[25]===Symbol.for("react.memo_cache_sentinel")?(L=()=>h(ii),e[25]=L):L=e[25];let F;e[26]!==c||e[27]!==y||e[28]!==f||e[29]!==a||e[30]!==A?(F=s.jsx(K.Suspense,{fallback:z,children:s.jsx(Zs,{keyId:A,searchTerm:a,onHover:d,onModelSelect:y,managing:f,onToggleManage:L,filterModels:c})}),e[26]=c,e[27]=y,e[28]=f,e[29]=a,e[30]=A,e[31]=F):F=e[31];let D;e[32]!==i||e[33]!==T||e[34]!==F?(D=s.jsx(jt,{fallback:T,children:F},i),e[32]=i,e[33]=T,e[34]=F,e[35]=D):D=e[35];let U;e[36]!==f||e[37]!==E||e[38]!==_?(U=!f&&s.jsxs("div",{className:"border-t border-border flex",children:[s.jsxs("button",{type:"button",onClick:()=>K.startTransition(()=>h(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Dt,{className:"size-3.5 shrink-0"}),"Manage models"]}),s.jsx("div",{className:"w-px bg-border shrink-0"}),s.jsxs("button",{type:"button",onClick:()=>E({to:"/$org/settings/ai-providers",params:{org:_.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Wt,{className:"size-3.5 shrink-0"}),"Manage API keys"]})]}),e[36]=f,e[37]=E,e[38]=_,e[39]=U):U=e[39];let V;e[40]!==D||e[41]!==U||e[42]!==O?(V=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[O,D,U]}),e[40]=D,e[41]=U,e[42]=O,e[43]=V):V=e[43];const X=u??o??null;let B;e[44]!==X?(B=s.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:s.jsx(zs,{model:X})}),e[44]=X,e[45]=B):B=e[45];let Y;return e[46]!==V||e[47]!==B?(Y=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[V,B]}),e[46]=V,e[47]=B,e[48]=Y):Y=e[48],Y}function ii(n){return!n}function ni(n){return n.stopPropagation()}function li(n){return[n.id,n]}function oi(n){const e=G.c(12),{onClose:t}=n,{credentialId:i,setCredentialId:l,selectedModel:o,setModel:r}=we();let c;e[0]!==l?(c=a=>{te("chat_credential_changed",{credential_id:a}),l(a)},e[0]=l,e[1]=c):c=e[1];let u;e[2]!==i||e[3]!==o?.modelId||e[4]!==r?(u=a=>{i&&(te("chat_model_changed",{from_model_id:o?.modelId??null,to_model_id:a.modelId,to_model_provider:a.providerId??null,credential_id:i}),r({...a,keyId:i}))},e[2]=i,e[3]=o?.modelId,e[4]=r,e[5]=u):u=e[5];let d;return e[6]!==i||e[7]!==t||e[8]!==o||e[9]!==c||e[10]!==u?(d=s.jsx(mt,{onClose:t,credentialId:i,onCredentialChange:c,selectedModel:o,onModelChange:u}),e[6]=i,e[7]=t,e[8]=o,e[9]=c,e[10]=u,e[11]=d):d=e[11],d}function ri(n){const e=G.c(2),{onClose:t}=n;let i;return e[0]!==t?(i=s.jsx(oi,{onClose:t}),e[0]=t,e[1]=i):i=e[1],i}function ai(n){const e=G.c(2);let t;return e[0]!==n?(t=s.jsx(mt,{...n}),e[0]=n,e[1]=t):t=e[1],t}const ci=[{tier:"fast",description:"Quicker responses"},{tier:"smart",description:"Balanced quality"},{tier:"thinking",description:"Deeper reasoning"}];function ft(n){const e=G.c(10),{modelSet:t,selectedModelId:i,onSelect:l}=n;let o,r;if(e[0]!==t.logo||e[1]!==t.models||e[2]!==t.tiers||e[3]!==l||e[4]!==i){const u=Object.fromEntries(t.models.map(di));o="flex flex-col p-2 w-[320px]",r=ci.map(d=>{const{tier:a,description:m}=d,f=t.tiers[a];if(!f.modelId)return null;const h=u[f.modelId];if(!h)return null;const x=i===f.modelId;return s.jsxs("button",{type:"button",onClick:()=>l(h),className:he("flex items-center gap-3 px-3 py-2.5 rounded-lg text-left hover:bg-accent",x&&"bg-accent/50"),children:[s.jsx("img",{src:t.logo,alt:f.label,className:"size-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:f.label}),s.jsx("span",{className:"text-xs text-muted-foreground leading-tight",children:m})]})]},a)}),e[0]=t.logo,e[1]=t.models,e[2]=t.tiers,e[3]=l,e[4]=i,e[5]=o,e[6]=r}else o=e[5],r=e[6];let c;return e[7]!==o||e[8]!==r?(c=s.jsx("div",{className:o,children:r}),e[7]=o,e[8]=r,e[9]=c):c=e[9],c}function di(n){return[n.modelId,n]}const ui=[{providerId:"claude-code",modelId:"claude-code:haiku",title:"Claude Code Haiku",description:"Fast and lightweight",capabilities:["text"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:sonnet",title:"Claude Code Sonnet 5",description:"Balanced performance",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus",title:"Claude Code Opus",description:"Most capable",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus-1m",title:"Claude Code Opus 4.8 1M",description:"Most capable, 1M context window",capabilities:["text","reasoning"],limits:{contextWindow:1e6,maxOutputTokens:null},costs:null}],je="https://assets.decocache.com/decocms/6ac44f1c-c0cf-4480-84b5-2ae6fe742d0b/codex-app.png.png",mi=[{providerId:"codex",modelId:"codex:gpt-5.6-sol",title:"GPT-5.6 Sol",description:"Frontier Codex model for deep reasoning, complex coding, and real-world work",capabilities:["text","reasoning"],logo:je,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.6-terra",title:"GPT-5.6 Terra",description:"Balanced Codex model for everyday coding and agent work",capabilities:["text","reasoning"],logo:je,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.6-luna",title:"GPT-5.6 Luna",description:"Fast Codex model for lightweight coding tasks and titles",capabilities:["text","reasoning"],logo:je,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.3-codex-spark",title:"GPT-5.3 Codex Spark",description:"Ultra-fast coding model",capabilities:["text","reasoning"],logo:je,limits:null,costs:null}],fi="https://decoims.com/decocms/93e4059c-e598-412b-87eb-54d72a946ec8/claude-stroke-rounded.svg",hi="https://decoims.com/decocms/9170ffd4-b9cc-4661-ad8f-ae2eea019e00/codex.svg",pi={fast:{modelId:"claude-code:haiku",label:"Haiku 4.5",description:"Quicker responses",iconNode:s.jsx(ye,{size:16})},smart:{modelId:"claude-code:sonnet",label:"Sonnet 5",description:"Balanced quality",iconNode:s.jsx(ye,{size:16})},thinking:{modelId:"claude-code:opus-1m",label:"Opus 4.8 1M",description:"Deeper reasoning",iconNode:s.jsx(ye,{size:16})}},xi={fast:{modelId:"codex:gpt-5.6-luna",label:"GPT-5.6 Luna",description:"Quicker responses",iconNode:s.jsx(Se,{size:16})},smart:{modelId:"codex:gpt-5.6-terra",label:"GPT-5.6 Terra",description:"Balanced quality",iconNode:s.jsx(Se,{size:16})},thinking:{modelId:"codex:gpt-5.6-sol",label:"GPT-5.6 Sol",description:"Deeper reasoning",iconNode:s.jsx(Se,{size:16})}};function ht(n){return n==="claude-code"?{logo:fi,tiers:pi,models:ui}:n==="codex"?{logo:hi,tiers:xi,models:mi}:null}function gi(n){const e=G.c(11),{onClose:t,agent:i}=n,l=we(),o=i??l.pendingHarnessId??"decopilot";let r;e[0]!==o?(r=ht(o),e[0]=o,e[1]=r):r=e[1];const c=r;if(!c){let m;return e[2]!==t?(m=s.jsx(ri,{onClose:t}),e[2]=t,e[3]=m):m=e[3],m}const u=l.selectedModel?.modelId??c.tiers[l.simpleModeTier].modelId;let d;e[4]!==t||e[5]!==l?(d=m=>{l.setModel({...m,keyId:void 0}),t()},e[4]=t,e[5]=l,e[6]=d):d=e[6];let a;return e[7]!==c||e[8]!==u||e[9]!==d?(a=s.jsx(ft,{modelSet:c,selectedModelId:u,onSelect:d}),e[7]=c,e[8]=u,e[9]=d,e[10]=a):a=e[10],a}function vi(n){const e=G.c(13);let t,i;e[0]!==n?({agent:t,...i}=n,e[0]=n,e[1]=t,e[2]=i):(t=e[1],i=e[2]);let l;e[3]!==t?(l=t?ht(t):null,e[3]=t,e[4]=l):l=e[4];const o=l;if(!o){let d;return e[5]!==i?(d=s.jsx(ai,{...i}),e[5]=i,e[6]=d):d=e[6],d}const r=i.selectedModel?.modelId??o.tiers.smart.modelId;let c;e[7]!==i?(c=d=>{i.onModelChange(d),i.onClose()},e[7]=i,e[8]=c):c=e[8];let u;return e[9]!==o||e[10]!==r||e[11]!==c?(u=s.jsx(ft,{modelSet:o,selectedModelId:r,onSelect:c}),e[9]=o,e[10]=r,e[11]=c,e[12]=u):u=e[12],u}function Qi(n){const e=G.c(39),{variant:t,className:i,placeholder:l,model:o,isLoading:r,credentialId:c,onCredentialChange:u,onModelChange:d,filterModels:a,agent:m}=n,f=t===void 0?"borderless":t,h=l===void 0?"Select model":l,[x,g]=K.useState(!1),S=d!==void 0,N=Mt(),k=f==="borderless"?"ghost":"outline",E=f==="borderless"&&"md:border-none";let _;e[0]!==i||e[1]!==E?(_=he("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",E,i),e[0]=i,e[1]=E,e[2]=_):_=e[2];let M;e[3]!==r||e[4]!==o||e[5]!==h||e[6]!==S?(M=S?s.jsx(ot,{model:o??null,placeholder:h,isLoading:r}):s.jsx(ji,{placeholder:h}),e[3]=r,e[4]=o,e[5]=h,e[6]=S,e[7]=M):M=e[7];let b;e[8]!==k||e[9]!==_||e[10]!==M?(b=s.jsx(ie,{variant:k,size:"sm",className:_,children:M}),e[8]=k,e[9]=_,e[10]=M,e[11]=b):b=e[11];const j=b;let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(ti,{}),e[12]=y):y=e[12];let I;e[13]!==m||e[14]!==c||e[15]!==a||e[16]!==o||e[17]!==u||e[18]!==d||e[19]!==S?(I=s.jsx(K.Suspense,{fallback:y,children:S?s.jsx(vi,{onClose:()=>g(!1),agent:m,credentialId:c??null,onCredentialChange:u??bi,selectedModel:o??null,onModelChange:d,filterModels:a}):s.jsx(gi,{onClose:()=>g(!1),agent:m})}),e[13]=m,e[14]=c,e[15]=a,e[16]=o,e[17]=u,e[18]=d,e[19]=S,e[20]=I):I=e[20];const C=I;if(N){let T;e[21]!==j?(T=s.jsx(Ct,{asChild:!0,children:j}),e[21]=j,e[22]=T):T=e[22];let z;e[23]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(wt,{className:"sr-only",children:"Select model"}),e[23]=z):z=e[23];let A;e[24]!==C?(A=s.jsxs(It,{className:"p-0 flex flex-col max-h-[95vh]",children:[z,s.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:C})]}),e[24]=C,e[25]=A):A=e[25];let L;return e[26]!==x||e[27]!==T||e[28]!==A?(L=s.jsxs(_t,{open:x,onOpenChange:g,children:[T,A]}),e[26]=x,e[27]=T,e[28]=A,e[29]=L):L=e[29],L}let v;e[30]!==j?(v=s.jsx(kt,{asChild:!0,children:j}),e[30]=j,e[31]=v):v=e[31];let p;e[32]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Qe,{className:"sr-only",children:"Select model"}),e[32]=p):p=e[32];let w;e[33]!==C?(w=s.jsxs(Ye,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden h-[100dvh] sm:h-auto max-h-[100dvh] sm:max-h-[85vh] w-full max-w-full sm:max-w-fit rounded-none sm:rounded-xl border-0 sm:border",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[p,C]}),e[33]=C,e[34]=w):w=e[34];let O;return e[35]!==x||e[36]!==v||e[37]!==w?(O=s.jsxs(Xe,{open:x,onOpenChange:g,children:[v,w]}),e[35]=x,e[36]=v,e[37]=w,e[38]=O):O=e[38],O}function bi(){}function ji(n){const e=G.c(4),{placeholder:t}=n,{selectedModel:i,isModelsLoading:l}=we();let o;return e[0]!==l||e[1]!==i||e[2]!==t?(o=s.jsx(ot,{model:i,placeholder:t,isLoading:l}),e[0]=l,e[1]=i,e[2]=t,e[3]=o):o=e[3],o}export{Ns as C,Qi as M,Is as N,lt as P,Xi as a,ve as b,Yi as g,Gi as i,Oe as m};