decocms 4.345.4 → 4.345.5

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 (256) hide show
  1. package/dist/client/assets/{AlertCircle-CMlBVqcJ.js → AlertCircle-BLN57WMf.js} +1 -1
  2. package/dist/client/assets/{AreaChart-B95rOF1_.js → AreaChart-Kx34w2o0.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-DapVDMlF.js → ArrowLeft-BHwfW5cf.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-wYc8wnD3.js → ArrowRight-Cv4L_aFI.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-Hxxn_gNq.js → ArrowUp-yRf4ugCP.js} +1 -1
  6. package/dist/client/assets/{Check-BMboHHSR.js → Check-BxuFlA_Q.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-DYoqValH.js → CheckCircle-Btc606Cr.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-Dc6YgNL3.js → ChevronRight-kI7jYbzz.js} +1 -1
  9. package/dist/client/assets/{ChevronSelectorVertical-DEQF3ahU.js → ChevronSelectorVertical-DtIJci2m.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-I74YujLg.js → ChevronUp-DeObbE8r.js} +1 -1
  11. package/dist/client/assets/{Copy01-BO31ooEB.js → Copy01-Bl1-Jt0L.js} +1 -1
  12. package/dist/client/assets/{CreditCard01-D-7eziGk.js → CreditCard01-CZZBngaR.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-Cj5CBUT_.js → DotsVertical-Cnz97pqO.js} +1 -1
  14. package/dist/client/assets/{Download01-t0mQxm01.js → Download01-BDjLiili.js} +1 -1
  15. package/dist/client/assets/{ErrorBarContext-COUpsLtn.js → ErrorBarContext-_0qWHukG.js} +1 -1
  16. package/dist/client/assets/{Eye-j-Wp3Gab.js → Eye-hIqh4Fwi.js} +1 -1
  17. package/dist/client/assets/{GitBranch01-BED6jHfy.js → GitBranch01-D4UNFmf8.js} +1 -1
  18. package/dist/client/assets/{Globe01-x_8Bz_lj.js → Globe01-DF4cknZV.js} +1 -1
  19. package/dist/client/assets/{HardDrive-DKPODti_.js → HardDrive-D3Eec79P.js} +1 -1
  20. package/dist/client/assets/{Image01-CyO6q_ld.js → Image01-Bz13pb-k.js} +1 -1
  21. package/dist/client/assets/{Key01-Su7Ri3QM.js → Key01-DRprtLXT.js} +1 -1
  22. package/dist/client/assets/{Link01-DbtGaIty.js → Link01-CuR_KaaP.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-CyMe6NsT.js → LinkExternal01-BGHNAijI.js} +1 -1
  24. package/dist/client/assets/{Monitor01-QzeWQOup.js → Monitor01-BRIx8sMl.js} +1 -1
  25. package/dist/client/assets/{Package-CM-zPJz2.js → Package-Bds89GCt.js} +1 -1
  26. package/dist/client/assets/{Palette-DzeyvT1z.js → Palette-BI-WPMTe.js} +1 -1
  27. package/dist/client/assets/{Play-06q3U8bS.js → Play-BxoD9uoG.js} +1 -1
  28. package/dist/client/assets/{Plus-BP_hMMjf.js → Plus-D85zMk5T.js} +1 -1
  29. package/dist/client/assets/{SearchMd-C1nQWOES.js → SearchMd-g9_sGeM-.js} +1 -1
  30. package/dist/client/assets/{Sector-EzuBb7Yf.js → Sector-C1zrRhby.js} +1 -1
  31. package/dist/client/assets/{Settings02-BvQ_eSu2.js → Settings02-Bc36uad8.js} +1 -1
  32. package/dist/client/assets/{Share07-CGVCYIcJ.js → Share07-CpaOVPYW.js} +1 -1
  33. package/dist/client/assets/{Shield01-C27u_sVK.js → Shield01-CvCIp4oN.js} +1 -1
  34. package/dist/client/assets/{Stars01-Bj8unbS8.js → Stars01-KRoJkXtX.js} +1 -1
  35. package/dist/client/assets/{Sun-CEKPZOZy.js → Sun-CAygsGP9.js} +1 -1
  36. package/dist/client/assets/{Tool01-DoPMT_Jz.js → Tool01-CNcRCczc.js} +1 -1
  37. package/dist/client/assets/{Tool02-D1kLUGWs.js → Tool02-CBw9jYXj.js} +1 -1
  38. package/dist/client/assets/{Trash01-C85aXkdB.js → Trash01-BbEEu8vB.js} +1 -1
  39. package/dist/client/assets/{TrendUp01-CTPMh1nW.js → TrendUp01-CoIIKE0c.js} +1 -1
  40. package/dist/client/assets/{Upload01-JKbQTOia.js → Upload01-DNMjyOCM.js} +1 -1
  41. package/dist/client/assets/{User01-C_BK5940.js → User01-0ZsI8BBV.js} +1 -1
  42. package/dist/client/assets/{UserSquare-CycktxVs.js → UserSquare-CC7tfaSx.js} +1 -1
  43. package/dist/client/assets/{Users01-B8FKuHjf.js → Users01-By1WbcHu.js} +1 -1
  44. package/dist/client/assets/{Users03-CPP-su_A.js → Users03-BByoY1nk.js} +1 -1
  45. package/dist/client/assets/{XCircle-Bj7SY_Yc.js → XCircle-O30STHCd.js} +1 -1
  46. package/dist/client/assets/{XClose-eXLFYw0x.js → XClose-B63Vcvss.js} +1 -1
  47. package/dist/client/assets/{Zap-ChNkw2SH.js → Zap-BeT-45fk.js} +1 -1
  48. package/dist/client/assets/{ZoomOut-CFLZpFe_.js → ZoomOut-BG_vYjwH.js} +1 -1
  49. package/dist/client/assets/{access-gate-C8LrS4v4.js → access-gate-D8oWwZV5.js} +1 -1
  50. package/dist/client/assets/{agent-icon-BKwygYD1.js → agent-icon-hcpEbbNv.js} +1 -1
  51. package/dist/client/assets/{agents-list-CSCLsirL.js → agents-list-CJs0zU0z.js} +1 -1
  52. package/dist/client/assets/{ai-providers-BO-tMr1-.js → ai-providers-DD4X7mHF.js} +1 -1
  53. package/dist/client/assets/{alert-CF4aKofR.js → alert-B-DoA1RR.js} +1 -1
  54. package/dist/client/assets/{alert-dialog-CNjxr2Ue.js → alert-dialog-Bk0ht2Rf.js} +1 -1
  55. package/dist/client/assets/{analytics-tab-BwstA1Zo.js → analytics-tab-AUz83YN8.js} +1 -1
  56. package/dist/client/assets/api-keys-CCTHkFvL.js +1 -0
  57. package/dist/client/assets/{api-keys-BlHAMj5o.js → api-keys-Ctj9MxZo.js} +1 -1
  58. package/dist/client/assets/app-editor-eHV-HKvZ.js +1 -0
  59. package/dist/client/assets/{auth-CgIs2aHa.js → auth-BvtBAwBN.js} +1 -1
  60. package/dist/client/assets/{auth-catchall-BS9MUPjF.js → auth-catchall-eDE-SfHO.js} +1 -1
  61. package/dist/client/assets/{auth-entry-aURvuiE6.js → auth-entry-DF_n0Xr_.js} +1 -1
  62. package/dist/client/assets/{auth-split-layout-CR3ppfks.js → auth-split-layout-COHegct2.js} +1 -1
  63. package/dist/client/assets/{authenticate-and-persist-oauth-DkmP0aTL.js → authenticate-and-persist-oauth-RsYPB2es.js} +1 -1
  64. package/dist/client/assets/{automation-list-row-Bguqk0Mp.js → automation-list-row-DgVFeIX_.js} +1 -1
  65. package/dist/client/assets/{automation-runs-BtiDbmM6.js → automation-runs-B8GJqNuW.js} +1 -1
  66. package/dist/client/assets/{automations-CuSVn9ZA.js → automations-jbVplX-Z.js} +1 -1
  67. package/dist/client/assets/{autosend-BLp3CESh.js → autosend-BkKan2uo.js} +1 -1
  68. package/dist/client/assets/{avatar-CYcyP0Bi.js → avatar-DAPjgS7A.js} +1 -1
  69. package/dist/client/assets/{badge-CRaNa5OF.js → badge-C_sysrVg.js} +1 -1
  70. package/dist/client/assets/{block-document-CXq7oVbD.js → block-document-CJ5c8fVZ.js} +1 -1
  71. package/dist/client/assets/{breadcrumb-COJItmkK.js → breadcrumb-ydmIlMOP.js} +1 -1
  72. package/dist/client/assets/{buckets-s_9STbxu.js → buckets-Cag7YXL1.js} +1 -1
  73. package/dist/client/assets/{bulk-category-panel-Dhigkjoq.js → bulk-category-panel-DqoTVd6C.js} +1 -1
  74. package/dist/client/assets/{capability-load-error-CsYIJl6t.js → capability-load-error-CxCY57yJ.js} +1 -1
  75. package/dist/client/assets/{cards-CBElk-vL.js → cards-DCP9h3Hq.js} +1 -1
  76. package/dist/client/assets/{category-editor-Cf09XU4q.js → category-editor-DfnKRsgU.js} +1 -1
  77. package/dist/client/assets/{cdn-tab-CyybzHmR.js → cdn-tab-CM5IZWtm.js} +1 -1
  78. package/dist/client/assets/{chart-DmVntBkh.js → chart-CFmkeBn7.js} +1 -1
  79. package/dist/client/assets/{chat-context-DSLAO8uW.js → chat-context-D8T0rW9d.js} +1 -1
  80. package/dist/client/assets/{checkbox-BTII6vZ1.js → checkbox-DSgzJ8_Q.js} +1 -1
  81. package/dist/client/assets/{choose-editor-C20Y-e94.js → choose-editor-bNmp3q20.js} +1 -1
  82. package/dist/client/assets/{cli-auth-success-C9Wuwo3t.js → cli-auth-success-BzIkJfDf.js} +1 -1
  83. package/dist/client/assets/{client-icons-B8xa00l8.js → client-icons-vFnljhqW.js} +1 -1
  84. package/dist/client/assets/{collection-detail-BI8NGeLo.js → collection-detail-xSNeOmDy.js} +1 -1
  85. package/dist/client/assets/{collection-display-button-DOctdv0F.js → collection-display-button-C_G8wwpV.js} +1 -1
  86. package/dist/client/assets/{collection-search-Opid-xUt.js → collection-search-DoxCoxes.js} +1 -1
  87. package/dist/client/assets/{collection-table-wrapper-C5XPP1Jr.js → collection-table-wrapper-BYa55fTK.js} +1 -1
  88. package/dist/client/assets/{collection-tabs-D34VwwHL.js → collection-tabs-DixeboF_.js} +1 -1
  89. package/dist/client/assets/{command-qVEBzno_.js → command-CMVtjwGY.js} +1 -1
  90. package/dist/client/assets/{commerce-onboarding-CKZyLCqC.js → commerce-onboarding-ZWYRte4z.js} +1 -1
  91. package/dist/client/assets/{connect-DE2PK8b9.js → connect-Dzreh380.js} +1 -1
  92. package/dist/client/assets/{connect-layout-DLiwnMgi.js → connect-layout-CeG0mfxq.js} +1 -1
  93. package/dist/client/assets/{connection-BygNLUX8.js → connection-D_VdPrtW.js} +1 -1
  94. package/dist/client/assets/{connection-card-27uyXFp8.js → connection-card-AE6EFRJA.js} +1 -1
  95. package/dist/client/assets/{connection-detail-DthHiIeC.js → connection-detail-WqdY_g-H.js} +1 -1
  96. package/dist/client/assets/{connection-form-helpers-CBjERN71.js → connection-form-helpers-DQ80_kCR.js} +1 -1
  97. package/dist/client/assets/{connections-DLFxStKn.js → connections-CyOsMfRT.js} +1 -1
  98. package/dist/client/assets/{create-organization-dialog-LoBu0lTT.js → create-organization-dialog-1eOlmyjo.js} +1 -1
  99. package/dist/client/assets/{decopilot-sse-pool-Kmf6dc9g.js → decopilot-sse-pool-D8v7VDC-.js} +1 -1
  100. package/dist/client/assets/{dialog-BlB1oPAX.js → dialog-BA4FD5Sq.js} +1 -1
  101. package/dist/client/assets/{domain-settings-CECWQFjy.js → domain-settings-BHaCjP4r.js} +1 -1
  102. package/dist/client/assets/{drawer-B2Flggz5.js → drawer-DX1BxggI.js} +1 -1
  103. package/dist/client/assets/{dropdown-menu-DpAcb5j4.js → dropdown-menu-B-E_CVh1.js} +1 -1
  104. package/dist/client/assets/{e2e-tab-BJB8VLai.js → e2e-tab-DGRDq_DR.js} +1 -1
  105. package/dist/client/assets/{editor-DglAwE0G.js → editor-Di7brQFo.js} +1 -1
  106. package/dist/client/assets/{empty-state-CLjUqZCp.js → empty-state-CCtx5MnG.js} +1 -1
  107. package/dist/client/assets/{empty-state-CI0tO9vX.js → empty-state-db-lnj3C.js} +1 -1
  108. package/dist/client/assets/{extract-connection-data-iqddM02J.js → extract-connection-data-BXJygigU.js} +1 -1
  109. package/dist/client/assets/{file-explorer-fm7fZujh.js → file-explorer-DvFT0XOk.js} +1 -1
  110. package/dist/client/assets/{file-type-icon-Br3VLW-H.js → file-type-icon-DW4fPEmX.js} +1 -1
  111. package/dist/client/assets/{folder-icon-DWkXImOH.js → folder-icon-CwHXOz_m.js} +1 -1
  112. package/dist/client/assets/{form-UhkhDewu.js → form-DoOF5038.js} +1 -1
  113. package/dist/client/assets/{general-1C8gBQ4B.js → general-BZbDNKxH.js} +1 -1
  114. package/dist/client/assets/{github-icon-DBC3N56k.js → github-icon-HvrxK059.js} +1 -1
  115. package/dist/client/assets/{hooks-CR7AnUgw.js → hooks-CcQWT_hr.js} +1 -1
  116. package/dist/client/assets/{hosting-tab-Dkko0Gn0.js → hosting-tab-Bf1BSlo5.js} +1 -1
  117. package/dist/client/assets/{index-C7u2w8im.js → index-B0enqYLp.js} +2 -2
  118. package/dist/client/assets/{index-CemePIqb.js → index-BJ7pAJ2Q.js} +6 -6
  119. package/dist/client/assets/{index-plKNftgd.js → index-BMNtI_8y.js} +1 -1
  120. package/dist/client/assets/{index-iCaXRfA8.js → index-BO3mMJ9-.js} +1 -1
  121. package/dist/client/assets/{index-DE8Tkxbg.js → index-BghhV04m.js} +1 -1
  122. package/dist/client/assets/{index-Z5gPZcYS.js → index-Bq_fz4Ff.js} +1 -1
  123. package/dist/client/assets/{index-AcEBrA3k.js → index-C8VfPxSh.js} +1 -1
  124. package/dist/client/assets/{index-DEPyT1rP.js → index-CPnG9qeP.js} +1 -1
  125. package/dist/client/assets/{index-sg2D-BQ8.js → index-Cg6UUNz9.js} +1 -1
  126. package/dist/client/assets/{index-RfHLLhj2.js → index-DeqVj3R2.js} +1 -1
  127. package/dist/client/assets/{index-redirect-Cx13gt2-.js → index-redirect-B6jJQvcK.js} +1 -1
  128. package/dist/client/assets/{infiniteQueryObserver-C11ZI34-.js → infiniteQueryObserver-D-z8u5tM.js} +1 -1
  129. package/dist/client/assets/{infra-billing-CgUdzC5y.js → infra-billing-0ATKKkJV.js} +1 -1
  130. package/dist/client/assets/{input-2HCKYLBl.js → input-B7-ag8lD.js} +1 -1
  131. package/dist/client/assets/{integration-icon-Bd_xNdeE.js → integration-icon-BDTrSXBR.js} +1 -1
  132. package/dist/client/assets/{invite-member-dialog-oqb4Sk71.js → invite-member-dialog-Dcg26SzZ.js} +1 -1
  133. package/dist/client/assets/{label-BGx5Lf7H.js → label-cJTlaxJL.js} +1 -1
  134. package/dist/client/assets/{layout-C17gebpD.js → layout-CrkKVLhA.js} +1 -1
  135. package/dist/client/assets/{login-D3TMR9xS.js → login-pvEaEy89.js} +1 -1
  136. package/dist/client/assets/{markdown-Cla7CqhA.js → markdown-DxVooRxl.js} +1 -1
  137. package/dist/client/assets/{mcp-app-renderer-BlE0FRH7.js → mcp-app-renderer-D_KU02DX.js} +1 -1
  138. package/dist/client/assets/{mcp-oauth-DsUhSW4J.js → mcp-oauth-BXJYkRmC.js} +1 -1
  139. package/dist/client/assets/{members-BG7hadJ7.js → members-BFxaLyL_.js} +1 -1
  140. package/dist/client/assets/{monaco-editor-DhB_3iiu.js → monaco-editor-8eAHVz_f.js} +1 -1
  141. package/dist/client/assets/{monitoring-stats-row-hscaDwbP.js → monitoring-stats-row-Cglw4rqL.js} +1 -1
  142. package/dist/client/assets/{multi-select-CM9MjqAx.js → multi-select-BpP1Usn4.js} +1 -1
  143. package/dist/client/assets/{oauth-callback-qbLen0go.js → oauth-callback-2RWB-Xcy.js} +1 -1
  144. package/dist/client/assets/{oauth-callback-ai-provider-4OhCljT1.js → oauth-callback-ai-provider-BZ5xem-W.js} +1 -1
  145. package/dist/client/assets/{onboarding-DCzCyPb4.js → onboarding-BkBpav8f.js} +1 -1
  146. package/dist/client/assets/{org-layout-4xUzWuzX.js → org-layout-qhy4I9fV.js} +1 -1
  147. package/dist/client/assets/{organization-choice-1g-8pzIn.js → organization-choice-BjG6IVvh.js} +1 -1
  148. package/dist/client/assets/{orgs-BEIRAbPX.js → orgs-D5FVo6mL.js} +1 -1
  149. package/dist/client/assets/{page-seo-form-Belel6H6.js → page-seo-form-Be8Eyt4z.js} +1 -1
  150. package/dist/client/assets/{popover-f6qDTepI.js → popover-SuxlV_wa.js} +1 -1
  151. package/dist/client/assets/{post-calendar-BAfxYx-r.js → post-calendar-CNz4eRa1.js} +1 -1
  152. package/dist/client/assets/{post-editor-D_HjqNZk.js → post-editor-DAM6RRkK.js} +1 -1
  153. package/dist/client/assets/{primitives-XEhUiD39.js → primitives-CZF_JJLb.js} +1 -1
  154. package/dist/client/assets/{profile-BOULZPWb.js → profile-BsJjst5i.js} +1 -1
  155. package/dist/client/assets/{project-app-view-B9Nf_h0d.js → project-app-view-a5iXz15V.js} +1 -1
  156. package/dist/client/assets/{project-icon-C8C1ccQU.js → project-icon-De_F8pQT.js} +1 -1
  157. package/dist/client/assets/{prompts-BecxIfQP.js → prompts-B53KZ2qa.js} +1 -1
  158. package/dist/client/assets/record-editor-hQchbpZN.js +1 -0
  159. package/dist/client/assets/redirect-editor-Jli1a798.js +1 -0
  160. package/dist/client/assets/registry-BbYeVCrz.js +2 -0
  161. package/dist/client/assets/{registry-layout-CE3mJiaT.js → registry-layout-KZVt0Xfz.js} +1 -1
  162. package/dist/client/assets/{reports-i8tE2vwq.js → reports-BLwEaU9g.js} +1 -1
  163. package/dist/client/assets/{repositories-tySboQ9a.js → repositories-BfenxLgW.js} +1 -1
  164. package/dist/client/assets/{repository-import-picker-Bdm2VPT0.js → repository-import-picker-DMiUIfck.js} +1 -1
  165. package/dist/client/assets/{repository-picker-C1Wgx2GD.js → repository-picker-D2Y-LhIr.js} +1 -1
  166. package/dist/client/assets/{require-capability-DFFY6cAy.js → require-capability-BgM4cyFw.js} +1 -1
  167. package/dist/client/assets/{required-auth-layout-vxa4iF_M.js → required-auth-layout-C-5OwpZQ.js} +1 -1
  168. package/dist/client/assets/{reset-password-70HRTHk0.js → reset-password-BxKg-E4e.js} +1 -1
  169. package/dist/client/assets/{review-settings-yeJA6GUg.js → review-settings-DV7JEbeN.js} +1 -1
  170. package/dist/client/assets/{roles-DX-yNpgA.js → roles-_UKlhi6r.js} +1 -1
  171. package/dist/client/assets/{schema-DgnJs5tv.js → schema-D8cqsCar.js} +1 -1
  172. package/dist/client/assets/{scroll-area-CUdyJCPQ.js → scroll-area-C-l_1Ezz.js} +1 -1
  173. package/dist/client/assets/{search-input-DH7y9xLM.js → search-input-CCU8WEuT.js} +1 -1
  174. package/dist/client/assets/{secrets-BlQ3u_0Q.js → secrets-DW6SNoWD.js} +1 -1
  175. package/dist/client/assets/{sections-editor-CoaQ-0gW.js → sections-editor-CfQL3MUY.js} +1 -1
  176. package/dist/client/assets/{select-model-DYwK3m_1.js → select-model-DfJBqCQz.js} +1 -1
  177. package/dist/client/assets/{select-DY4qFYM1.js → select-thbOXdV2.js} +1 -1
  178. package/dist/client/assets/{self-tool-result-CiYzkAVh.js → self-tool-result-B69Fg0Me.js} +1 -1
  179. package/dist/client/assets/{seo-editor-D4HIs3vv.js → seo-editor-tr-TrTTi.js} +1 -1
  180. package/dist/client/assets/settings-layout-D16Mbpyl.js +1 -0
  181. package/dist/client/assets/{settings-sidebar-Bw1fMsEt.js → settings-sidebar-DBK2dIFf.js} +1 -1
  182. package/dist/client/assets/{shell-controls-va78F-yP.js → shell-controls-BWi5yumk.js} +1 -1
  183. package/dist/client/assets/{shell-layout-D2nUn4AQ.js → shell-layout-CxIvl0T0.js} +1 -1
  184. package/dist/client/assets/{skill-preview-C8W_8drb.js → skill-preview--5iB-S45.js} +1 -1
  185. package/dist/client/assets/{skills-D24vNosq.js → skills-B0gEqrlg.js} +1 -1
  186. package/dist/client/assets/{sso-Ca1N65LO.js → sso-C_IHKxSb.js} +1 -1
  187. package/dist/client/assets/{store-BqttgMpQ.js → store-ifn3tpPJ.js} +1 -1
  188. package/dist/client/assets/store-registry-C-PhgFka.js +2 -0
  189. package/dist/client/assets/{switch-BxEGxMQd.js → switch-B89kKeZ6.js} +1 -1
  190. package/dist/client/assets/{synced-repos-DKfgLB3W.js → synced-repos-CUeyNn1S.js} +1 -1
  191. package/dist/client/assets/{table-DgpG2evu.js → table-oFUxypAM.js} +1 -1
  192. package/dist/client/assets/{tabs-C6MY4i3n.js → tabs-DDZbjuGx.js} +1 -1
  193. package/dist/client/assets/{task-board-DkcPek9U.js → task-board-CZ9S2F2j.js} +1 -1
  194. package/dist/client/assets/{task-route-eKmbIjxu.js → task-route-BOTh-0rJ.js} +1 -1
  195. package/dist/client/assets/{tasks-Hg15WJ9X.js → tasks-FZsv2dON.js} +1 -1
  196. package/dist/client/assets/{textarea-Dl2uUej0.js → textarea-PlnFdxfd.js} +1 -1
  197. package/dist/client/assets/{thread-intent-BY_8nNq6.js → thread-intent-D9GBi8HS.js} +1 -1
  198. package/dist/client/assets/{thread-route-CmMSB6Sw.js → thread-route-BZeJeEya.js} +1 -1
  199. package/dist/client/assets/{toggle-group-CsRZ8tvO.js → toggle-group-CkwAtV4A.js} +1 -1
  200. package/dist/client/assets/{toolbar-D1_Ol3zR.js → toolbar--RiFj6U5.js} +1 -1
  201. package/dist/client/assets/{toolbar-icon-button-CSBJ88rQ.js → toolbar-icon-button-CNRNPs--.js} +1 -1
  202. package/dist/client/assets/{track-CPcjy9uR.js → track-DuOgcKo0.js} +1 -1
  203. package/dist/client/assets/{types-DqUGV9qa.js → types-D_kAUeg-.js} +1 -1
  204. package/dist/client/assets/{use-ai-providers-BdmZTHBo.js → use-ai-providers-DIlvL3Di.js} +1 -1
  205. package/dist/client/assets/{use-automations-DqN-Eedg.js → use-automations-BAB0_C81.js} +1 -1
  206. package/dist/client/assets/{use-autosave-Bqb4zdBu.js → use-autosave-CQZQzTQz.js} +1 -1
  207. package/dist/client/assets/{use-connection-S_UvCg2B.js → use-connection-BeNNDm3V.js} +1 -1
  208. package/dist/client/assets/{use-copy-Bmx7qaZy.js → use-copy-BRZsbDzU.js} +1 -1
  209. package/dist/client/assets/{use-create-virtual-mcp-scf3c09z.js → use-create-virtual-mcp-mYL08KWG.js} +1 -1
  210. package/dist/client/assets/{use-date-fns-locale-CwknJ-Cc.js → use-date-fns-locale-DbE_B7rr.js} +1 -1
  211. package/dist/client/assets/{use-debounced-autosave-CYJNQwMO.js → use-debounced-autosave-DS4yfX6Q.js} +1 -1
  212. package/dist/client/assets/{use-debounced-value-BSt4svyT.js → use-debounced-value-COWEzqDq.js} +1 -1
  213. package/dist/client/assets/{use-decopilot-events-n3s012bJ.js → use-decopilot-events-BKT-F5xw.js} +1 -1
  214. package/dist/client/assets/{use-delete-connection-vGbd-GSR.js → use-delete-connection-OE9v2zvB.js} +1 -1
  215. package/dist/client/assets/{use-deployment-admin-Bauq2VTF.js → use-deployment-admin-jSSuCkxH.js} +1 -1
  216. package/dist/client/assets/{use-destination-route-wG8TuHlG.js → use-destination-route-Cpl4rVTn.js} +1 -1
  217. package/dist/client/assets/{use-file-configs-BXhAF_E9.js → use-file-configs-s2xEn9sQ.js} +1 -1
  218. package/dist/client/assets/{use-infinite-scroll-Dt8yeLy4.js → use-infinite-scroll-BHOerZe9.js} +1 -1
  219. package/dist/client/assets/{use-join-requests-Mn6RZVGi.js → use-join-requests-f7TU_Hhz.js} +1 -1
  220. package/dist/client/assets/{use-mcp-auth-status-BtVmaZMH.js → use-mcp-auth-status-WQX2ok1B.js} +1 -1
  221. package/dist/client/assets/{use-mcp-client-DbduTvpX.js → use-mcp-client-DfwAnhyT.js} +1 -1
  222. package/dist/client/assets/{use-mcp-prompts-BnRE-abE.js → use-mcp-prompts-CUbiNC7k.js} +1 -1
  223. package/dist/client/assets/{use-mcp-tools-BM4yWujw.js → use-mcp-tools-D2yMxBPz.js} +1 -1
  224. package/dist/client/assets/{use-members-e-6-u5oI.js → use-members-CO4s355i.js} +1 -1
  225. package/dist/client/assets/{use-navigate-to-agent-CBpA76If.js → use-navigate-to-agent-TU4yREEV.js} +1 -1
  226. package/dist/client/assets/{use-org-auth-client-Db82Liaw.js → use-org-auth-client-BF2Qgiv7.js} +1 -1
  227. package/dist/client/assets/{use-org-notice-VFnJxh4q.js → use-org-notice-BSi-UHne.js} +1 -1
  228. package/dist/client/assets/{use-org-sso-DGnN9BuZ.js → use-org-sso-DAXj9sIm.js} +1 -1
  229. package/dist/client/assets/{use-organization-roles-ICgbANgx.js → use-organization-roles-B35krlDo.js} +1 -1
  230. package/dist/client/assets/{use-organization-settings-CuGzexP8.js → use-organization-settings-B4ey2hrV.js} +1 -1
  231. package/dist/client/assets/{use-panel-navigate-CFwYR_Qp.js → use-panel-navigate-gsZcsgT1.js} +1 -1
  232. package/dist/client/assets/{use-registry-connections-D6nF_9Z8.js → use-registry-connections-D4RQvk8r.js} +1 -1
  233. package/dist/client/assets/{use-secrets-Dp3ow04h.js → use-secrets-Ca2pRToZ.js} +1 -1
  234. package/dist/client/assets/{use-section-preview-base-RPCEgm4d.js → use-section-preview-base-Cyk8BCRp.js} +1 -1
  235. package/dist/client/assets/{use-status-sounds-DYLIbHVD.js → use-status-sounds-Bdd8dQaz.js} +1 -1
  236. package/dist/client/assets/{use-tags-ubLB0plg.js → use-tags-DMkyxAYH.js} +1 -1
  237. package/dist/client/assets/{use-view-mode-CGTeiLzV.js → use-view-mode-DxUfBOPs.js} +1 -1
  238. package/dist/client/assets/{use-virtual-mcp-C7tfg5oZ.js → use-virtual-mcp-BTSwCmDL.js} +1 -1
  239. package/dist/client/assets/useInfiniteQuery-D3QkJoqk.js +1 -0
  240. package/dist/client/assets/useSuspenseInfiniteQuery-CvbCG4hr.js +1 -0
  241. package/dist/client/assets/{users-DyqobxFn.js → users-BH5ODlj6.js} +1 -1
  242. package/dist/client/assets/{variant-calendar-DdeJN8qC.js → variant-calendar-D2FXgu4q.js} +1 -1
  243. package/dist/client/assets/{view-mode-toggle-ZzUey5-R.js → view-mode-toggle-Dj1BA4Ou.js} +1 -1
  244. package/dist/client/index.html +1 -1
  245. package/dist/server/cli.js +454 -456
  246. package/dist/server/server.js +315 -317
  247. package/package.json +1 -1
  248. package/dist/client/assets/api-keys-DTP6Yz60.js +0 -1
  249. package/dist/client/assets/app-editor-Bld6Ied4.js +0 -1
  250. package/dist/client/assets/record-editor-D9Y3dn1H.js +0 -1
  251. package/dist/client/assets/redirect-editor-Dqa7HYMs.js +0 -1
  252. package/dist/client/assets/registry-B-56Z2Ji.js +0 -2
  253. package/dist/client/assets/settings-layout-hiPwF7_Z.js +0 -1
  254. package/dist/client/assets/store-registry-B7tGyeh8.js +0 -2
  255. package/dist/client/assets/useInfiniteQuery-C4-LKIlR.js +0 -1
  256. package/dist/client/assets/useSuspenseInfiniteQuery-UYGIJ28b.js +0 -1
@@ -1,2 +1,2 @@
1
- import{c as st,b as Vt,r as R,l as Ue,j as n,aB as es,B as tt,a4 as wt,a1 as kt,a2 as Tt,h as ts,n as Ma,t as q,K as Ka}from"./index-C7u2w8im.js";import{b as La}from"./chat-context-DSLAO8uW.js";import{a7 as ns,a8 as Ba,a9 as Ia,aa as Oa,N as ss,O as Zt,ab as as,ac as os,P as is,Q as rs,ad as ls,ae as Fa,_ as cs,$ as us,af as $a,ag as za,ah as ds,G as Ha,U as ms,V as Lt,Y as fs,Z as ps,W as gs,a4 as hs,ai as Ua,aj as Bt,ak as vs,al as Ga,am as qa,an as Wa,ao as Ya,ap as Ja,d as Qa,e as Za,aq as Xa,ar as eo,as as to,at as no,au as In,av as so,aw as ao,ax as oo,a2 as qt,ay as io,az as ro,aA as Wt,aB as lo,aC as bt,aD as Ct,aE as co,aF as uo,aG as nt,aH as On,aI as mo,g as fo,aJ as Fn,aK as po,aL as go,aM as Mt,aN as Yt,aO as $n,aP as ho,aQ as hn,aR as vo,aS as ht,aT as Et,aU as zn,aV as So,aW as bo,aX as yo,aY as xo,aZ as _o,a_ as yt,a$ as jo,b0 as Eo,b1 as Ro,i as wo,b2 as Hn,b3 as Kt,b4 as Un,b5 as Gn,b6 as ko,b7 as To,b8 as Vo,b9 as Do,ba as vn,bb as qn,bc as Wn,bd as Rt,be as Jt,bf as No,bg as Sn,bh as Ao,bi as Po,bj as Co,bk as Mo,bl as Ko,bm as Lo}from"./index-CemePIqb.js";import{n as Bo,t as Io}from"./ChevronUp-I74YujLg.js";import{ai as yn,B as Oo,a0 as Ss,F as Fo,z as $o,au as zo,w as Ho}from"./agent-icon-BKwygYD1.js";import{i as Uo}from"./ChevronRight-Dc6YgNL3.js";import{i as Go}from"./Globe01-x_8Bz_lj.js";import{S as Qt}from"./scroll-area-CUdyJCPQ.js";import{d as qo,h as Wo,c as Yo,e as Jo,b as Qo,D as Zo}from"./dialog-BlB1oPAX.js";import{I as Xo}from"./input-2HCKYLBl.js";import{a as bs}from"./Copy01-BO31ooEB.js";import{i as ei}from"./Settings02-BvQ_eSu2.js";import{s as ti}from"./Eye-j-Wp3Gab.js";import{s as ni}from"./TrendUp01-CTPMh1nW.js";import{s as xn}from"./Plus-BP_hMMjf.js";import{s as ys}from"./Trash01-C85aXkdB.js";import{i as si}from"./Zap-ChNkw2SH.js";import{D as xs,a as vt,c as _s,b as js,i as ai}from"./dropdown-menu-DpAcb5j4.js";import{s as oi}from"./safe-image-url-D5z803Ot.js";import{a as ii,P as ri,b as li}from"./page-seo-form-Belel6H6.js";import{a as ci}from"./Tool01-DoPMT_Jz.js";import{u as ui,A as di}from"./use-section-preview-base-RPCEgm4d.js";import"./use-panel-navigate-CFwYR_Qp.js";import"./use-destination-route-wG8TuHlG.js";import"./autosend-BLp3CESh.js";import"./thread-intent-BY_8nNq6.js";import"./slugify-CEUa2lfQ.js";import"./hooks-CR7AnUgw.js";import"./use-mcp-client-DbduTvpX.js";import"./constants-Daqiz8AS.js";import"./auth-CgIs2aHa.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-Kmf6dc9g.js";import"./task-board-DkcPek9U.js";import"./schema-DgnJs5tv.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-C7tfg5oZ.js";import"./use-ai-providers-BdmZTHBo.js";import"./location-oTTXFrSF.js";import"./use-decopilot-events-n3s012bJ.js";import"./thread-route-CmMSB6Sw.js";import"./Check-BMboHHSR.js";import"./Download01-t0mQxm01.js";import"./use-organization-settings-CuGzexP8.js";import"./ArrowUp-Hxxn_gNq.js";import"./automation-runs-BtiDbmM6.js";import"./useInfiniteQuery-C4-LKIlR.js";import"./infiniteQueryObserver-C11ZI34-.js";import"./use-connection-S_UvCg2B.js";import"./table-DgpG2evu.js";import"./empty-state-CI0tO9vX.js";import"./use-infinite-scroll-Dt8yeLy4.js";import"./use-members-e-6-u5oI.js";import"./use-org-auth-client-Db82Liaw.js";import"./AlertCircle-CMlBVqcJ.js";import"./CheckCircle-DYoqValH.js";import"./DotsVertical-Cj5CBUT_.js";import"./XCircle-Bj7SY_Yc.js";import"./use-automations-DqN-Eedg.js";import"./useSuspenseInfiniteQuery-UYGIJ28b.js";import"./avatar-CYcyP0Bi.js";import"./User01-C_BK5940.js";import"./Tool02-D1kLUGWs.js";import"./Stars01-Bj8unbS8.js";import"./ArrowRight-wYc8wnD3.js";import"./format-time-BtXRrtv4.js";import"./differenceInSeconds-C3x8sHUj.js";import"./use-copy-Bmx7qaZy.js";import"./markdown-Cla7CqhA.js";import"./ZoomOut-CFLZpFe_.js";import"./monaco-editor-DhB_3iiu.js";import"./editor-DglAwE0G.js";import"./mcp-app-renderer-BlE0FRH7.js";import"./types-DqUGV9qa.js";import"./XClose-eXLFYw0x.js";import"./Share07-CGVCYIcJ.js";import"./SearchMd-C1nQWOES.js";import"./shell-layout-D2nUn4AQ.js";import"./Users03-CPP-su_A.js";import"./project-icon-C8C1ccQU.js";import"./github-repo-CTPv5ZM2.js";import"./source-system-tabs-CnEGUb4r.js";import"./Monitor01-QzeWQOup.js";import"./command-qVEBzno_.js";import"./index-RfHLLhj2.js";import"./required-auth-layout-vxa4iF_M.js";import"./use-org-sso-DGnN9BuZ.js";import"./use-org-notice-VFnJxh4q.js";import"./Image01-CyO6q_ld.js";import"./LinkExternal01-CyMe6NsT.js";import"./integration-icon-Bd_xNdeE.js";import"./Palette-DzeyvT1z.js";import"./use-navigate-to-agent-CBpA76If.js";import"./Link01-DbtGaIty.js";import"./use-mcp-prompts-BnRE-abE.js";import"./form-UhkhDewu.js";import"./label-BGx5Lf7H.js";import"./file-type-icon-Br3VLW-H.js";import"./drawer-B2Flggz5.js";import"./collection-search-Opid-xUt.js";import"./Upload01-JKbQTOia.js";import"./select-DY4qFYM1.js";import"./ArrowLeft-DapVDMlF.js";import"./tabs-C6MY4i3n.js";import"./toggle-group-CsRZ8tvO.js";import"./task-route-eKmbIjxu.js";import"./extract-connection-data-iqddM02J.js";import"./metadata-dUsYcpuu.js";import"./connection-BygNLUX8.js";import"./connection-card-27uyXFp8.js";import"./use-registry-connections-D6nF_9Z8.js";import"./retry-CErkP7V6.js";import"./connection-slug-CITJ0kGN.js";import"./textarea-Dl2uUej0.js";import"./UserSquare-CycktxVs.js";import"./connection-form-helpers-CBjERN71.js";import"./authenticate-and-persist-oauth-DkmP0aTL.js";import"./mcp-oauth-DsUhSW4J.js";import"./collection-tabs-D34VwwHL.js";import"./badge-CRaNa5OF.js";import"./use-file-configs-BXhAF_E9.js";import"./site-slug-uya6Wp4-.js";import"./popover-f6qDTepI.js";import"./github-icon-DBC3N56k.js";import"./get-initials-D-f_fDFw.js";import"./Shield01-C27u_sVK.js";import"./select-model-DYwK3m_1.js";import"./checkbox-BTII6vZ1.js";import"./ChevronSelectorVertical-DEQF3ahU.js";import"./Key01-Su7Ri3QM.js";import"./ai-providers-logos-DD3qZ33J.js";import"./folder-icon-DWkXImOH.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-DYLIbHVD.js";import"./toolbar-D1_Ol3zR.js";import"./use-mcp-tools-BM4yWujw.js";import"./GitBranch01-BED6jHfy.js";import"./Package-CM-zPJz2.js";import"./skill-preview-C8W_8drb.js";import"./use-date-fns-locale-CwknJ-Cc.js";import"./alert-dialog-CNjxr2Ue.js";import"./Play-06q3U8bS.js";import"./use-debounced-autosave-CYJNQwMO.js";import"./search-input-DH7y9xLM.js";import"./use-mcp-auth-status-BtVmaZMH.js";import"./switch-BxEGxMQd.js";import"./repository-import-picker-Bdm2VPT0.js";import"./repository-picker-C1Wgx2GD.js";import"./use-debounced-value-BSt4svyT.js";import"./Users01-B8FKuHjf.js";import"./use-secrets-Dp3ow04h.js";import"./client-icons-B8xa00l8.js";import"./connect-layout-DLiwnMgi.js";import"./self-tool-result-CiYzkAVh.js";import"./provision-repo-scoped-github-connection-WQFARyHG.js";import"./track-CPcjy9uR.js";import"./use-tags-ubLB0plg.js";import"./breadcrumb-COJItmkK.js";import"./toolbar-icon-button-CSBJ88rQ.js";import"./automation-list-row-Bguqk0Mp.js";import"./site-error--i37Vnuw.js";import"./cards-CBElk-vL.js";import"./CreditCard01-D-7eziGk.js";import"./HardDrive-DKPODti_.js";import"./Sun-CEKPZOZy.js";function mi(d){return d.schema?.definitions??d.schema?.$defs??{}}function Es(d,e){const o=mi(e),u=o[btoa(d)];if(!u)return[];const p=[u];if(Array.isArray(u.allOf)){const x=u.allOf.find(j=>typeof j.$ref=="string")?.$ref;if(typeof x=="string"){const j=o[x.replace("#/definitions/","")];j&&p.push(j)}}return p}function fi(d,e){for(const o of Es(d,e)){const u=typeof o.image=="string"?o.image:void 0;if(u?.includes("{{{"))return u}}function pi(d,e){if(!e)return;const o=ns(d);if(!o)return;const u=fi(o.resolveType,e);if(!u)return;const p=Ba(u,o.data);if(p)return oi(p)}const gi={escape:Oa};function hi(d,e){for(const o of Es(d,e)){const u=typeof o.title=="string"?o.title:void 0;if(u?.includes("{{"))return u}}function vi(d,e){if(!e)return;const o=ns(d);if(o)try{const u=hi(o.resolveType,e);return u&&Ia.render(u,o.data,{},gi).trim()||void 0}catch{return}}const Si="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",bi="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 Yn(d){return Array.from({length:d},(e,o)=>({id:crypto.randomUUID(),index:o}))}function Rs(d){return d.map((e,o)=>({...e,index:o}))}function yi(d,e){if(e===d.length)return d;if(e<d.length)return Rs(d.slice(0,e));const o=Array.from({length:e-d.length},(u,p)=>({id:crypto.randomUUID(),index:d.length+p}));return[...d,...o]}function ws(d){const e=st.c(25),{section:o,raw:u,meta:p}=d,x=o.isSavedBlock===!0,j=o.isMultivariate===!0;let v;e[0]!==p||e[1]!==u?(v=u&&p?pi(u,p):void 0,e[0]=p,e[1]=u,e[2]=v):v=e[2];const y=v;let g;e[3]!==p||e[4]!==j||e[5]!==u||e[6]!==x?(g=u&&p&&!x&&!j?vi(u,p):void 0,e[3]=p,e[4]=j,e[5]=u,e[6]=x,e[7]=g):g=e[7];const k=g;let L;e[8]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx(Oo,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[8]=L):L=e[8];let M;e[9]!==y?(M=y&&n.jsx("img",{src:y,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[9]=y,e[10]=M):M=e[10];let V;e[11]!==j||e[12]!==x?(V=x?{color:Ha}:j?{color:"oklch(0.65 0.15 160)"}:void 0,e[11]=j,e[12]=x,e[13]=V):V=e[13];let c;e[14]!==V?(c=n.jsx(yn,{className:"h-4 w-4 shrink-0",style:V}),e[14]=V,e[15]=c):c=e[15];const b=o.isHidden&&"line-through opacity-50";let w;e[16]!==b?(w=Ue("min-w-0 flex-1 truncate text-sm font-medium",b),e[16]=b,e[17]=w):w=e[17];const l=k??o.label;let D;e[18]!==w||e[19]!==l?(D=n.jsx("span",{className:w,children:l}),e[18]=w,e[19]=l,e[20]=D):D=e[20];let i;return e[21]!==D||e[22]!==M||e[23]!==c?(i=n.jsxs(n.Fragment,{children:[L,M,c,D]}),e[21]=D,e[22]=M,e[23]=c,e[24]=i):i=e[24],i}const xi="w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",_i="w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",ji="w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100";function bn(d,e){return Ue("h-7 shrink-0 overflow-hidden",e?xi:d?ji:_i)}function ks(d,e){const o=d.isSavedBlock===!0,u=d.isMultivariate===!0;return Ue("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":o?Si:u?ds:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Ei(d){const e=st.c(82),{section:o,raw:u,meta:p,sortableId:x,selected:j,onSelect:v,onDelete:y,onDuplicate:g,onMakeReusable:k,onToggleHidden:L,onToggleLazy:M,onAddVariant:V,onDetach:c}=d,b=Vt(),w=u?ls(u.__resolveType??""):!1,l=o.isHidden===!0,D=w||l;let i;e[0]!==o?(i=Fa(o),e[0]=o,e[1]=i):i=e[1];const W=i;let U;e[2]!==x?(U={id:x,animateLayoutChanges:Vi},e[2]=x,e[3]=U):U=e[3];const{attributes:Ke,listeners:J,setNodeRef:m,transform:C,isDragging:we}=cs(U);let N;e[4]!==C?(N=us.Transform.toString(C?{...C,x:0}:null),e[4]=C,e[5]=N):N=e[5];const X=we?0:void 0;let T;e[6]!==N||e[7]!==X?(T={transform:N,opacity:X},e[6]=N,e[7]=X,e[8]=T):T=e[8];const oe=T;let B;e[9]!==o?(B=$a(o),e[9]=o,e[10]=B):B=e[10];const Pe=B;let ee;e[11]!==v?(ee=_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),v())},e[11]=v,e[12]=ee):ee=e[12];const de=we?"cursor-grabbing":"cursor-pointer";let Q;e[13]!==o||e[14]!==j||e[15]!==de?(Q=Ue("touch-none transition-colors",de,ks(o,j)),e[13]=o,e[14]=j,e[15]=de,e[16]=Q):Q=e[16];let ie;e[17]!==p||e[18]!==u||e[19]!==o?(ie=n.jsx(ws,{section:o,raw:u,meta:p}),e[17]=p,e[18]=u,e[19]=o,e[20]=ie):ie=e[20];let ye;e[21]!==l||e[22]!==b?(ye=b(l?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),e[21]=l,e[22]=b,e[23]=ye):ye=e[23];let re;e[24]!==L?(re=_=>{_.stopPropagation(),L()},e[24]=L,e[25]=re):re=e[25];let K;e[26]!==l?(K=l?n.jsx(ei,{className:"h-3.5 w-3.5"}):n.jsx(ti,{className:"h-3.5 w-3.5"}),e[26]=l,e[27]=K):K=e[27];let qe;e[28]!==l||e[29]!==b?(qe=b(l?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),e[28]=l,e[29]=b,e[30]=qe):qe=e[30];let Le;e[31]!==qe?(Le=n.jsx(Tt,{side:"bottom",children:qe}),e[31]=qe,e[32]=Le):Le=e[32];const Oe=_s,ke=xs,F=!0,te=tt,Fe="button",Ce="ghost",xe="icon";let ne;e[33]!==b?(ne=b("sectionsEditor.sectionList.sectionActionsMenu"),e[33]=b,e[34]=ne):ne=e[34];const me=Ue(bn(D,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let _e;e[35]===Symbol.for("react.memo_cache_sentinel")?(_e=n.jsx(Ss,{className:"h-3.5 w-3.5"}),e[35]=_e):_e=e[35];let fe;e[36]!==te||e[37]!==ne||e[38]!==me?(fe=n.jsx(te,{type:Fe,variant:Ce,size:xe,"aria-label":ne,className:me,onClick:wi,onPointerDown:Ri,children:_e}),e[36]=te,e[37]=ne,e[38]=me,e[39]=fe):fe=e[39];let pe;e[40]!==ke||e[41]!==fe?(pe=n.jsx(ke,{asChild:F,children:fe}),e[40]=ke,e[41]=fe,e[42]=pe):pe=e[42];let se;e[43]!==g?(se=_=>{_.stopPropagation(),g()},e[43]=g,e[44]=se):se=e[44];let Me;e[45]===Symbol.for("react.memo_cache_sentinel")?(Me=n.jsx(bs,{className:"h-4 w-4"}),e[45]=Me):Me=e[45];let je;e[46]!==b?(je=b("sectionsEditor.sectionList.duplicateMenuItem"),e[46]=b,e[47]=je):je=e[47];let le;e[48]!==se||e[49]!==je?(le=n.jsxs(vt,{onClick:se,children:[Me,je]}),e[48]=se,e[49]=je,e[50]=le):le=e[50];let I;e[51]!==W||e[52]!==V||e[53]!==b?(I=W&&n.jsxs(vt,{className:za,onClick:_=>{_.stopPropagation(),V()},children:[n.jsx(ni,{className:"h-4 w-4"}),b("sectionsEditor.sectionList.addVariantMenuItem")]}),e[51]=W,e[52]=V,e[53]=b,e[54]=I):I=e[54];let Ee;e[55]!==Pe||e[56]!==k||e[57]!==b?(Ee=Pe&&n.jsxs(vt,{className:bi,onClick:_=>{_.stopPropagation(),k()},children:[n.jsx(yn,{className:"h-4 w-4"}),b("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[55]=Pe,e[56]=k,e[57]=b,e[58]=Ee):Ee=e[58];let ge;e[59]!==c||e[60]!==o.isMultivariate||e[61]!==o.isSavedBlock||e[62]!==b?(ge=o.isSavedBlock===!0&&!o.isMultivariate&&n.jsxs(vt,{onClick:_=>{_.stopPropagation(),c()},children:[n.jsx(yn,{className:"h-4 w-4"}),b("sectionsEditor.sectionList.detachMenuItem")]}),e[59]=c,e[60]=o.isMultivariate,e[61]=o.isSavedBlock,e[62]=b,e[63]=ge):ge=e[63];let ce;e[64]!==y?(ce=_=>{_.stopPropagation(),y()},e[64]=y,e[65]=ce):ce=e[65];let he;e[66]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(ys,{className:"h-4 w-4"}),e[66]=he):he=e[66];let Z;e[67]!==b?(Z=b("sectionsEditor.sectionList.deleteMenuItem"),e[67]=b,e[68]=Z):Z=e[68];let ue;e[69]!==ce||e[70]!==Z?(ue=n.jsxs(vt,{className:"text-destructive focus:text-destructive",onClick:ce,children:[he,Z]}),e[69]=ce,e[70]=Z,e[71]=ue):ue=e[71];let ve;e[72]!==le||e[73]!==I||e[74]!==Ee||e[75]!==ge||e[76]!==ue?(ve=n.jsxs(js,{align:"end",className:"w-44",children:[le,I,Ee,ge,ue]}),e[72]=le,e[73]=I,e[74]=Ee,e[75]=ge,e[76]=ue,e[77]=ve):ve=e[77];let Te;return e[78]!==Oe||e[79]!==pe||e[80]!==ve?(Te=n.jsxs(Oe,{children:[pe,ve]}),e[78]=Oe,e[79]=pe,e[80]=ve,e[81]=Te):Te=e[81],n.jsxs("div",{ref:m,style:oe,...Ke,...J,role:"button",tabIndex:0,onClick:v,onKeyDown:ee,className:Q,children:[ie,!o.isMultivariate&&n.jsxs(wt,{children:[n.jsx(kt,{asChild:!0,children:n.jsx(tt,{type:"button",variant:"ghost",size:"icon","aria-label":b(w?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:Ue(bn(D,w)),onClick:_=>{_.stopPropagation(),M()},onPointerDown:Ti,children:n.jsx(si,{className:Ue("h-3.5 w-3.5",w&&"text-yellow-500")})})}),n.jsx(Tt,{side:"bottom",children:b(w?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),n.jsxs(wt,{children:[n.jsx(kt,{asChild:!0,children:n.jsx(tt,{type:"button",variant:"ghost",size:"icon","aria-label":ye,className:Ue(bn(D,l)),onClick:re,onPointerDown:ki,children:K})}),Le]}),Te]})}function Ri(d){return d.stopPropagation()}function wi(d){return d.stopPropagation()}function ki(d){return d.stopPropagation()}function Ti(d){return d.stopPropagation()}function Vi(){return!1}function Di(d){const e=st.c(104),{listKey:o,rawSections:u,sections:p,meta:x,selectedIndex:j,onSelect:v,onReorder:y,onDelete:g,onDuplicate:k,onMakeReusable:L,onToggleHidden:M,onToggleLazy:V,onAddVariant:c,onDetach:b,onAddSection:w,canAddSection:l}=d,D=l===void 0?!0:l,i=Vt();let W;e[0]!==p.length?(W=()=>Yn(p.length),e[0]=p.length,e[1]=W):W=e[1];const[U,Ke]=R.useState(W),[J,m]=R.useState(null),[C,we]=R.useState(o),[N,X]=R.useState(p.length),T=R.useRef(!1);C!==o?(we(o),X(p.length),Ke(Yn(p.length))):N!==p.length&&(X(p.length),Ke(Te=>yi(Te,p.length)));let oe;e[2]===Symbol.for("react.memo_cache_sentinel")?(oe={activationConstraint:{distance:8}},e[2]=oe):oe=e[2];let B;e[3]===Symbol.for("react.memo_cache_sentinel")?(B={coordinateGetter:ms},e[3]=B):B=e[3];const Pe=ss(Zt(rs,oe),Zt(is,B));let ee;e[4]!==U?(ee=U.map(Ni),e[4]=U,e[5]=ee):ee=e[5];const de=ee;let Q;e[6]===Symbol.for("react.memo_cache_sentinel")?(Q=Te=>{m(String(Te.active.id))},e[6]=Q):Q=e[6];const ie=Q;let ye;e[7]!==de||e[8]!==y?(ye=Te=>{m(null);const{active:_,over:Se}=Te;if(!Se||_.id===Se.id)return;const ae=de.indexOf(String(_.id)),Ve=de.indexOf(String(Se.id));ae===-1||Ve===-1||(Ke($e=>Rs(Lt([...$e],ae,Ve))),T.current=!0,requestAnimationFrame(()=>{T.current=!1}),y?.(ae,Ve))},e[7]=de,e[8]=y,e[9]=ye):ye=e[9];const re=ye;let K;e[10]===Symbol.for("react.memo_cache_sentinel")?(K=()=>{m(null)},e[10]=K):K=e[10];const qe=K;let Le,Oe,ke,F,te,Fe,Ce,xe,ne,me,_e,fe,pe,se,Me;if(e[11]!==J||e[12]!==D||e[13]!==U||e[14]!==de||e[15]!==re||e[16]!==x||e[17]!==w||e[18]!==c||e[19]!==g||e[20]!==b||e[21]!==k||e[22]!==L||e[23]!==v||e[24]!==M||e[25]!==V||e[26]!==u||e[27]!==p||e[28]!==j||e[29]!==Pe||e[30]!==i){se=Symbol.for("react.early_return_sentinel");e:{const Te=_=>{T.current||v(_)};if(e[46]!==J||e[47]!==D||e[48]!==U||e[49]!==w||e[50]!==u||e[51]!==p||e[52]!==i){const _=J?U.find(Se=>Se.id===J):null;if(F=_!=null?p[_.index]:null,ke=_!=null?u[_.index]:void 0,U.length===0){let Se;e[56]!==i?(Se=i("sectionsEditor.sectionList.noSections"),e[56]=i,e[57]=Se):Se=e[57];let ae;e[58]!==Se?(ae=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:Se}),e[58]=Se,e[59]=ae):ae=e[59];const Ve=!D;let $e;e[60]===Symbol.for("react.memo_cache_sentinel")?($e=n.jsx(xn,{size:14}),e[60]=$e):$e=e[60];let ct;e[61]!==i?(ct=i("sectionsEditor.sectionList.addSectionButton"),e[61]=i,e[62]=ct):ct=e[62];let De;e[63]!==w||e[64]!==Ve||e[65]!==ct?(De=n.jsxs(tt,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ve,onClick:w,children:[$e,ct]}),e[63]=w,e[64]=Ve,e[65]=ct,e[66]=De):De=e[66];let Ze;e[67]!==ae||e[68]!==De?(Ze=n.jsxs("div",{className:"space-y-2",children:[ae,De]}),e[67]=ae,e[68]=De,e[69]=Ze):Ze=e[69],se=Ze;break e}pe=Ue(_&&"cursor-grabbing"),e[46]=J,e[47]=D,e[48]=U,e[49]=w,e[50]=u,e[51]=p,e[52]=i,e[53]=ke,e[54]=F,e[55]=pe}else ke=e[53],F=e[54],pe=e[55];Oe=fs,xe=Pe,ne=ps,me=ie,_e=re,fe=qe,Le=gs,Fe=de,Ce=hs,Me="space-y-1",te=U.map(_=>{const Se=p[_.index];return Se?n.jsx(Ei,{sortableId:_.id,section:Se,raw:u[_.index],meta:x,selected:j===_.index,onSelect:()=>Te(_.index),onDelete:()=>g(_.index),onDuplicate:()=>k(_.index),onMakeReusable:()=>L(_.index),onToggleHidden:()=>M(_.index),onToggleLazy:()=>V(_.index),onAddVariant:()=>c(_.index),onDetach:()=>b(_.index)},_.id):null})}e[11]=J,e[12]=D,e[13]=U,e[14]=de,e[15]=re,e[16]=x,e[17]=w,e[18]=c,e[19]=g,e[20]=b,e[21]=k,e[22]=L,e[23]=v,e[24]=M,e[25]=V,e[26]=u,e[27]=p,e[28]=j,e[29]=Pe,e[30]=i,e[31]=Le,e[32]=Oe,e[33]=ke,e[34]=F,e[35]=te,e[36]=Fe,e[37]=Ce,e[38]=xe,e[39]=ne,e[40]=me,e[41]=_e,e[42]=fe,e[43]=pe,e[44]=se,e[45]=Me}else Le=e[31],Oe=e[32],ke=e[33],F=e[34],te=e[35],Fe=e[36],Ce=e[37],xe=e[38],ne=e[39],me=e[40],_e=e[41],fe=e[42],pe=e[43],se=e[44],Me=e[45];if(se!==Symbol.for("react.early_return_sentinel"))return se;let je;e[70]!==te||e[71]!==Me?(je=n.jsx("div",{className:Me,children:te}),e[70]=te,e[71]=Me,e[72]=je):je=e[72];let le;e[73]!==Le||e[74]!==Fe||e[75]!==Ce||e[76]!==je?(le=n.jsx(Le,{items:Fe,strategy:Ce,children:je}),e[73]=Le,e[74]=Fe,e[75]=Ce,e[76]=je,e[77]=le):le=e[77];let I;e[78]!==ke||e[79]!==F||e[80]!==x?(I=F?n.jsx("div",{className:Ue("cursor-grabbing shadow-lg ring-1 ring-border/60",ks(F,!1)),children:n.jsx(ws,{section:F,raw:ke,meta:x})}):null,e[78]=ke,e[79]=F,e[80]=x,e[81]=I):I=e[81];let Ee;e[82]!==I?(Ee=es.createPortal(n.jsx(as,{dropAnimation:os,children:I}),document.body),e[82]=I,e[83]=Ee):Ee=e[83];let ge;e[84]!==Oe||e[85]!==xe||e[86]!==ne||e[87]!==me||e[88]!==_e||e[89]!==fe||e[90]!==le||e[91]!==Ee?(ge=n.jsxs(Oe,{sensors:xe,collisionDetection:ne,onDragStart:me,onDragEnd:_e,onDragCancel:fe,children:[le,Ee]}),e[84]=Oe,e[85]=xe,e[86]=ne,e[87]=me,e[88]=_e,e[89]=fe,e[90]=le,e[91]=Ee,e[92]=ge):ge=e[92];const ce=!D;let he;e[93]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(xn,{size:14}),e[93]=he):he=e[93];let Z;e[94]!==i?(Z=i("sectionsEditor.sectionList.addSectionButton"),e[94]=i,e[95]=Z):Z=e[95];let ue;e[96]!==w||e[97]!==ce||e[98]!==Z?(ue=n.jsxs(tt,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:ce,onClick:w,children:[he,Z]}),e[96]=w,e[97]=ce,e[98]=Z,e[99]=ue):ue=e[99];let ve;return e[100]!==pe||e[101]!==ge||e[102]!==ue?(ve=n.jsxs("div",{className:pe,children:[ge,ue]}),e[100]=pe,e[101]=ge,e[102]=ue,e[103]=ve):ve=e[103],ve}function Ni(d){return d.id}function Jn(d){const e=st.c(57),{open:o,initialName:u,autoLabel:p,isPending:x,onSubmit:j,onOpenChange:v}=d,y=x===void 0?!1:x,g=Vt(),[k,L]=R.useState(u),[M,V]=R.useState(o);o!==M&&(V(o),o&&L(u));let c;e[0]!==y||e[1]!==v?(c=ie=>{!ie&&!y&&v(!1)},e[0]=y,e[1]=v,e[2]=c):c=e[2];const b=c;let w;e[3]!==y||e[4]!==k||e[5]!==j?(w=async ie=>{ie.preventDefault(),!y&&await j(k.trim())},e[3]=y,e[4]=k,e[5]=j,e[6]=w):w=e[6];const l=w;let D;e[7]!==g?(D=g("sectionsEditor.variantRenameDialog.title"),e[7]=g,e[8]=D):D=e[8];let i;e[9]!==D?(i=n.jsx(qo,{children:D}),e[9]=D,e[10]=i):i=e[10];let W;e[11]!==p||e[12]!==g?(W=g("sectionsEditor.variantRenameDialog.description",{fallback:p||g("sectionsEditor.variantRenameDialog.defaultFallback")}),e[11]=p,e[12]=g,e[13]=W):W=e[13];let U;e[14]!==W?(U=n.jsx(Wo,{children:W}),e[14]=W,e[15]=U):U=e[15];let Ke;e[16]!==i||e[17]!==U?(Ke=n.jsxs(Yo,{children:[i,U]}),e[16]=i,e[17]=U,e[18]=Ke):Ke=e[18];let J;e[19]!==g?(J=g("sectionsEditor.variantRenameDialog.nameLabel"),e[19]=g,e[20]=J):J=e[20];let m;e[21]!==J?(m=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:J}),e[21]=J,e[22]=m):m=e[22];let C;e[23]===Symbol.for("react.memo_cache_sentinel")?(C=ie=>L(ie.target.value),e[23]=C):C=e[23];let we;e[24]!==p||e[25]!==y||e[26]!==k?(we=n.jsx(Xo,{id:"variant-rename-name",value:k,onChange:C,placeholder:p,autoFocus:!0,disabled:y}),e[24]=p,e[25]=y,e[26]=k,e[27]=we):we=e[27];let N;e[28]!==m||e[29]!==we?(N=n.jsxs("div",{className:"space-y-1.5 py-4",children:[m,we]}),e[28]=m,e[29]=we,e[30]=N):N=e[30];let X;e[31]!==v?(X=()=>v(!1),e[31]=v,e[32]=X):X=e[32];let T;e[33]!==g?(T=g("sectionsEditor.variantRenameDialog.cancel"),e[33]=g,e[34]=T):T=e[34];let oe;e[35]!==y||e[36]!==X||e[37]!==T?(oe=n.jsx(tt,{type:"button",variant:"outline",onClick:X,disabled:y,children:T}),e[35]=y,e[36]=X,e[37]=T,e[38]=oe):oe=e[38];let B;e[39]!==y||e[40]!==g?(B=y?n.jsxs(n.Fragment,{children:[n.jsx(ts,{className:"size-3.5"}),g("sectionsEditor.variantRenameDialog.saving")]}):g("sectionsEditor.variantRenameDialog.save"),e[39]=y,e[40]=g,e[41]=B):B=e[41];let Pe;e[42]!==y||e[43]!==B?(Pe=n.jsx(tt,{type:"submit",disabled:y,children:B}),e[42]=y,e[43]=B,e[44]=Pe):Pe=e[44];let ee;e[45]!==oe||e[46]!==Pe?(ee=n.jsxs(Jo,{children:[oe,Pe]}),e[45]=oe,e[46]=Pe,e[47]=ee):ee=e[47];let de;e[48]!==l||e[49]!==N||e[50]!==ee||e[51]!==Ke?(de=n.jsx(Qo,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:l,children:[Ke,N,ee]})}),e[48]=l,e[49]=N,e[50]=ee,e[51]=Ke,e[52]=de):de=e[52];let Q;return e[53]!==b||e[54]!==o||e[55]!==de?(Q=n.jsx(Zo,{open:o,onOpenChange:b,children:de}),e[53]=b,e[54]=o,e[55]=de,e[56]=Q):Q=e[56],Q}function Ts(d){const e=st.c(5),{rule:o,matchers:u}=d,p=o?.__resolveType??"";let x;if(e[0]!==u||e[1]!==p){const g=u.find(k=>k.resolveType===p)?.iconName??Ua(p);x=Fo(g),e[0]=u,e[1]=p,e[2]=x}else x=e[2];const j=x;if(!j)return null;let v;return e[3]!==j?(v=n.jsx(j,{size:14,className:"shrink-0"}),e[3]=j,e[4]=v):v=e[4],v}function Qn(d){return d.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
1
+ import{c as st,b as Vt,r as R,l as Ue,j as n,aB as es,B as tt,a4 as wt,a1 as kt,a2 as Tt,h as ts,n as Ma,t as q,K as Ka}from"./index-B0enqYLp.js";import{b as La}from"./chat-context-D8T0rW9d.js";import{a7 as ns,a8 as Ba,a9 as Ia,aa as Oa,N as ss,O as Zt,ab as as,ac as os,P as is,Q as rs,ad as ls,ae as Fa,_ as cs,$ as us,af as $a,ag as za,ah as ds,G as Ha,U as ms,V as Lt,Y as fs,Z as ps,W as gs,a4 as hs,ai as Ua,aj as Bt,ak as vs,al as Ga,am as qa,an as Wa,ao as Ya,ap as Ja,d as Qa,e as Za,aq as Xa,ar as eo,as as to,at as no,au as In,av as so,aw as ao,ax as oo,a2 as qt,ay as io,az as ro,aA as Wt,aB as lo,aC as bt,aD as Ct,aE as co,aF as uo,aG as nt,aH as On,aI as mo,g as fo,aJ as Fn,aK as po,aL as go,aM as Mt,aN as Yt,aO as $n,aP as ho,aQ as hn,aR as vo,aS as ht,aT as Et,aU as zn,aV as So,aW as bo,aX as yo,aY as xo,aZ as _o,a_ as yt,a$ as jo,b0 as Eo,b1 as Ro,i as wo,b2 as Hn,b3 as Kt,b4 as Un,b5 as Gn,b6 as ko,b7 as To,b8 as Vo,b9 as Do,ba as vn,bb as qn,bc as Wn,bd as Rt,be as Jt,bf as No,bg as Sn,bh as Ao,bi as Po,bj as Co,bk as Mo,bl as Ko,bm as Lo}from"./index-BJ7pAJ2Q.js";import{n as Bo,t as Io}from"./ChevronUp-DeObbE8r.js";import{ai as yn,B as Oo,a0 as Ss,F as Fo,z as $o,au as zo,w as Ho}from"./agent-icon-hcpEbbNv.js";import{i as Uo}from"./ChevronRight-kI7jYbzz.js";import{i as Go}from"./Globe01-DF4cknZV.js";import{S as Qt}from"./scroll-area-C-l_1Ezz.js";import{d as qo,h as Wo,c as Yo,e as Jo,b as Qo,D as Zo}from"./dialog-BA4FD5Sq.js";import{I as Xo}from"./input-B7-ag8lD.js";import{a as bs}from"./Copy01-Bl1-Jt0L.js";import{i as ei}from"./Settings02-Bc36uad8.js";import{s as ti}from"./Eye-hIqh4Fwi.js";import{s as ni}from"./TrendUp01-CoIIKE0c.js";import{s as xn}from"./Plus-D85zMk5T.js";import{s as ys}from"./Trash01-BbEEu8vB.js";import{i as si}from"./Zap-BeT-45fk.js";import{D as xs,a as vt,c as _s,b as js,i as ai}from"./dropdown-menu-B-E_CVh1.js";import{s as oi}from"./safe-image-url-D5z803Ot.js";import{a as ii,P as ri,b as li}from"./page-seo-form-Be8Eyt4z.js";import{a as ci}from"./Tool01-CNcRCczc.js";import{u as ui,A as di}from"./use-section-preview-base-Cyk8BCRp.js";import"./use-panel-navigate-gsZcsgT1.js";import"./use-destination-route-Cpl4rVTn.js";import"./autosend-BkKan2uo.js";import"./thread-intent-D9GBi8HS.js";import"./slugify-CEUa2lfQ.js";import"./hooks-CcQWT_hr.js";import"./use-mcp-client-DfwAnhyT.js";import"./constants-Daqiz8AS.js";import"./auth-BvtBAwBN.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-D8v7VDC-.js";import"./task-board-CZ9S2F2j.js";import"./schema-D8cqsCar.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-BTSwCmDL.js";import"./use-ai-providers-DIlvL3Di.js";import"./location-oTTXFrSF.js";import"./use-decopilot-events-BKT-F5xw.js";import"./thread-route-BZeJeEya.js";import"./Check-BxuFlA_Q.js";import"./Download01-BDjLiili.js";import"./use-organization-settings-B4ey2hrV.js";import"./ArrowUp-yRf4ugCP.js";import"./automation-runs-B8GJqNuW.js";import"./useInfiniteQuery-D3QkJoqk.js";import"./infiniteQueryObserver-D-z8u5tM.js";import"./use-connection-BeNNDm3V.js";import"./table-oFUxypAM.js";import"./empty-state-db-lnj3C.js";import"./use-infinite-scroll-BHOerZe9.js";import"./use-members-CO4s355i.js";import"./use-org-auth-client-BF2Qgiv7.js";import"./AlertCircle-BLN57WMf.js";import"./CheckCircle-Btc606Cr.js";import"./DotsVertical-Cnz97pqO.js";import"./XCircle-O30STHCd.js";import"./use-automations-BAB0_C81.js";import"./useSuspenseInfiniteQuery-CvbCG4hr.js";import"./avatar-DAPjgS7A.js";import"./User01-0ZsI8BBV.js";import"./Tool02-CBw9jYXj.js";import"./Stars01-KRoJkXtX.js";import"./ArrowRight-Cv4L_aFI.js";import"./format-time-BtXRrtv4.js";import"./differenceInSeconds-C3x8sHUj.js";import"./use-copy-BRZsbDzU.js";import"./markdown-DxVooRxl.js";import"./ZoomOut-BG_vYjwH.js";import"./monaco-editor-8eAHVz_f.js";import"./editor-Di7brQFo.js";import"./mcp-app-renderer-D_KU02DX.js";import"./types-D_kAUeg-.js";import"./XClose-B63Vcvss.js";import"./Share07-CpaOVPYW.js";import"./SearchMd-g9_sGeM-.js";import"./shell-layout-CxIvl0T0.js";import"./Users03-BByoY1nk.js";import"./project-icon-De_F8pQT.js";import"./github-repo-CTPv5ZM2.js";import"./source-system-tabs-CnEGUb4r.js";import"./Monitor01-BRIx8sMl.js";import"./command-CMVtjwGY.js";import"./index-DeqVj3R2.js";import"./required-auth-layout-C-5OwpZQ.js";import"./use-org-sso-DAXj9sIm.js";import"./use-org-notice-BSi-UHne.js";import"./Image01-Bz13pb-k.js";import"./LinkExternal01-BGHNAijI.js";import"./integration-icon-BDTrSXBR.js";import"./Palette-BI-WPMTe.js";import"./use-navigate-to-agent-TU4yREEV.js";import"./Link01-CuR_KaaP.js";import"./use-mcp-prompts-CUbiNC7k.js";import"./form-DoOF5038.js";import"./label-cJTlaxJL.js";import"./file-type-icon-DW4fPEmX.js";import"./drawer-DX1BxggI.js";import"./collection-search-DoxCoxes.js";import"./Upload01-DNMjyOCM.js";import"./select-thbOXdV2.js";import"./ArrowLeft-BHwfW5cf.js";import"./tabs-DDZbjuGx.js";import"./toggle-group-CkwAtV4A.js";import"./task-route-BOTh-0rJ.js";import"./extract-connection-data-BXJygigU.js";import"./metadata-dUsYcpuu.js";import"./connection-D_VdPrtW.js";import"./connection-card-AE6EFRJA.js";import"./use-registry-connections-D4RQvk8r.js";import"./retry-CErkP7V6.js";import"./connection-slug-CITJ0kGN.js";import"./textarea-PlnFdxfd.js";import"./UserSquare-CC7tfaSx.js";import"./connection-form-helpers-DQ80_kCR.js";import"./authenticate-and-persist-oauth-RsYPB2es.js";import"./mcp-oauth-BXJYkRmC.js";import"./collection-tabs-DixeboF_.js";import"./badge-C_sysrVg.js";import"./use-file-configs-s2xEn9sQ.js";import"./site-slug-uya6Wp4-.js";import"./popover-SuxlV_wa.js";import"./github-icon-HvrxK059.js";import"./get-initials-D-f_fDFw.js";import"./Shield01-CvCIp4oN.js";import"./select-model-DfJBqCQz.js";import"./checkbox-DSgzJ8_Q.js";import"./ChevronSelectorVertical-DtIJci2m.js";import"./Key01-DRprtLXT.js";import"./ai-providers-logos-DD3qZ33J.js";import"./folder-icon-CwHXOz_m.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-Bdd8dQaz.js";import"./toolbar--RiFj6U5.js";import"./use-mcp-tools-D2yMxBPz.js";import"./GitBranch01-D4UNFmf8.js";import"./Package-Bds89GCt.js";import"./skill-preview--5iB-S45.js";import"./use-date-fns-locale-DbE_B7rr.js";import"./alert-dialog-Bk0ht2Rf.js";import"./Play-BxoD9uoG.js";import"./use-debounced-autosave-DS4yfX6Q.js";import"./search-input-CCU8WEuT.js";import"./use-mcp-auth-status-WQX2ok1B.js";import"./switch-B89kKeZ6.js";import"./repository-import-picker-DMiUIfck.js";import"./repository-picker-D2Y-LhIr.js";import"./use-debounced-value-COWEzqDq.js";import"./Users01-By1WbcHu.js";import"./use-secrets-Ca2pRToZ.js";import"./client-icons-vFnljhqW.js";import"./connect-layout-CeG0mfxq.js";import"./self-tool-result-B69Fg0Me.js";import"./provision-repo-scoped-github-connection-WQFARyHG.js";import"./track-DuOgcKo0.js";import"./use-tags-DMkyxAYH.js";import"./breadcrumb-ydmIlMOP.js";import"./toolbar-icon-button-CNRNPs--.js";import"./automation-list-row-DgVFeIX_.js";import"./site-error--i37Vnuw.js";import"./cards-DCP9h3Hq.js";import"./CreditCard01-CZZBngaR.js";import"./HardDrive-D3Eec79P.js";import"./Sun-CAygsGP9.js";function mi(d){return d.schema?.definitions??d.schema?.$defs??{}}function Es(d,e){const o=mi(e),u=o[btoa(d)];if(!u)return[];const p=[u];if(Array.isArray(u.allOf)){const x=u.allOf.find(j=>typeof j.$ref=="string")?.$ref;if(typeof x=="string"){const j=o[x.replace("#/definitions/","")];j&&p.push(j)}}return p}function fi(d,e){for(const o of Es(d,e)){const u=typeof o.image=="string"?o.image:void 0;if(u?.includes("{{{"))return u}}function pi(d,e){if(!e)return;const o=ns(d);if(!o)return;const u=fi(o.resolveType,e);if(!u)return;const p=Ba(u,o.data);if(p)return oi(p)}const gi={escape:Oa};function hi(d,e){for(const o of Es(d,e)){const u=typeof o.title=="string"?o.title:void 0;if(u?.includes("{{"))return u}}function vi(d,e){if(!e)return;const o=ns(d);if(o)try{const u=hi(o.resolveType,e);return u&&Ia.render(u,o.data,{},gi).trim()||void 0}catch{return}}const Si="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",bi="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 Yn(d){return Array.from({length:d},(e,o)=>({id:crypto.randomUUID(),index:o}))}function Rs(d){return d.map((e,o)=>({...e,index:o}))}function yi(d,e){if(e===d.length)return d;if(e<d.length)return Rs(d.slice(0,e));const o=Array.from({length:e-d.length},(u,p)=>({id:crypto.randomUUID(),index:d.length+p}));return[...d,...o]}function ws(d){const e=st.c(25),{section:o,raw:u,meta:p}=d,x=o.isSavedBlock===!0,j=o.isMultivariate===!0;let v;e[0]!==p||e[1]!==u?(v=u&&p?pi(u,p):void 0,e[0]=p,e[1]=u,e[2]=v):v=e[2];const y=v;let g;e[3]!==p||e[4]!==j||e[5]!==u||e[6]!==x?(g=u&&p&&!x&&!j?vi(u,p):void 0,e[3]=p,e[4]=j,e[5]=u,e[6]=x,e[7]=g):g=e[7];const k=g;let L;e[8]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx(Oo,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[8]=L):L=e[8];let M;e[9]!==y?(M=y&&n.jsx("img",{src:y,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[9]=y,e[10]=M):M=e[10];let V;e[11]!==j||e[12]!==x?(V=x?{color:Ha}:j?{color:"oklch(0.65 0.15 160)"}:void 0,e[11]=j,e[12]=x,e[13]=V):V=e[13];let c;e[14]!==V?(c=n.jsx(yn,{className:"h-4 w-4 shrink-0",style:V}),e[14]=V,e[15]=c):c=e[15];const b=o.isHidden&&"line-through opacity-50";let w;e[16]!==b?(w=Ue("min-w-0 flex-1 truncate text-sm font-medium",b),e[16]=b,e[17]=w):w=e[17];const l=k??o.label;let D;e[18]!==w||e[19]!==l?(D=n.jsx("span",{className:w,children:l}),e[18]=w,e[19]=l,e[20]=D):D=e[20];let i;return e[21]!==D||e[22]!==M||e[23]!==c?(i=n.jsxs(n.Fragment,{children:[L,M,c,D]}),e[21]=D,e[22]=M,e[23]=c,e[24]=i):i=e[24],i}const xi="w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",_i="w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",ji="w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100";function bn(d,e){return Ue("h-7 shrink-0 overflow-hidden",e?xi:d?ji:_i)}function ks(d,e){const o=d.isSavedBlock===!0,u=d.isMultivariate===!0;return Ue("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":o?Si:u?ds:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Ei(d){const e=st.c(82),{section:o,raw:u,meta:p,sortableId:x,selected:j,onSelect:v,onDelete:y,onDuplicate:g,onMakeReusable:k,onToggleHidden:L,onToggleLazy:M,onAddVariant:V,onDetach:c}=d,b=Vt(),w=u?ls(u.__resolveType??""):!1,l=o.isHidden===!0,D=w||l;let i;e[0]!==o?(i=Fa(o),e[0]=o,e[1]=i):i=e[1];const W=i;let U;e[2]!==x?(U={id:x,animateLayoutChanges:Vi},e[2]=x,e[3]=U):U=e[3];const{attributes:Ke,listeners:J,setNodeRef:m,transform:C,isDragging:we}=cs(U);let N;e[4]!==C?(N=us.Transform.toString(C?{...C,x:0}:null),e[4]=C,e[5]=N):N=e[5];const X=we?0:void 0;let T;e[6]!==N||e[7]!==X?(T={transform:N,opacity:X},e[6]=N,e[7]=X,e[8]=T):T=e[8];const oe=T;let B;e[9]!==o?(B=$a(o),e[9]=o,e[10]=B):B=e[10];const Pe=B;let ee;e[11]!==v?(ee=_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),v())},e[11]=v,e[12]=ee):ee=e[12];const de=we?"cursor-grabbing":"cursor-pointer";let Q;e[13]!==o||e[14]!==j||e[15]!==de?(Q=Ue("touch-none transition-colors",de,ks(o,j)),e[13]=o,e[14]=j,e[15]=de,e[16]=Q):Q=e[16];let ie;e[17]!==p||e[18]!==u||e[19]!==o?(ie=n.jsx(ws,{section:o,raw:u,meta:p}),e[17]=p,e[18]=u,e[19]=o,e[20]=ie):ie=e[20];let ye;e[21]!==l||e[22]!==b?(ye=b(l?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),e[21]=l,e[22]=b,e[23]=ye):ye=e[23];let re;e[24]!==L?(re=_=>{_.stopPropagation(),L()},e[24]=L,e[25]=re):re=e[25];let K;e[26]!==l?(K=l?n.jsx(ei,{className:"h-3.5 w-3.5"}):n.jsx(ti,{className:"h-3.5 w-3.5"}),e[26]=l,e[27]=K):K=e[27];let qe;e[28]!==l||e[29]!==b?(qe=b(l?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),e[28]=l,e[29]=b,e[30]=qe):qe=e[30];let Le;e[31]!==qe?(Le=n.jsx(Tt,{side:"bottom",children:qe}),e[31]=qe,e[32]=Le):Le=e[32];const Oe=_s,ke=xs,F=!0,te=tt,Fe="button",Ce="ghost",xe="icon";let ne;e[33]!==b?(ne=b("sectionsEditor.sectionList.sectionActionsMenu"),e[33]=b,e[34]=ne):ne=e[34];const me=Ue(bn(D,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let _e;e[35]===Symbol.for("react.memo_cache_sentinel")?(_e=n.jsx(Ss,{className:"h-3.5 w-3.5"}),e[35]=_e):_e=e[35];let fe;e[36]!==te||e[37]!==ne||e[38]!==me?(fe=n.jsx(te,{type:Fe,variant:Ce,size:xe,"aria-label":ne,className:me,onClick:wi,onPointerDown:Ri,children:_e}),e[36]=te,e[37]=ne,e[38]=me,e[39]=fe):fe=e[39];let pe;e[40]!==ke||e[41]!==fe?(pe=n.jsx(ke,{asChild:F,children:fe}),e[40]=ke,e[41]=fe,e[42]=pe):pe=e[42];let se;e[43]!==g?(se=_=>{_.stopPropagation(),g()},e[43]=g,e[44]=se):se=e[44];let Me;e[45]===Symbol.for("react.memo_cache_sentinel")?(Me=n.jsx(bs,{className:"h-4 w-4"}),e[45]=Me):Me=e[45];let je;e[46]!==b?(je=b("sectionsEditor.sectionList.duplicateMenuItem"),e[46]=b,e[47]=je):je=e[47];let le;e[48]!==se||e[49]!==je?(le=n.jsxs(vt,{onClick:se,children:[Me,je]}),e[48]=se,e[49]=je,e[50]=le):le=e[50];let I;e[51]!==W||e[52]!==V||e[53]!==b?(I=W&&n.jsxs(vt,{className:za,onClick:_=>{_.stopPropagation(),V()},children:[n.jsx(ni,{className:"h-4 w-4"}),b("sectionsEditor.sectionList.addVariantMenuItem")]}),e[51]=W,e[52]=V,e[53]=b,e[54]=I):I=e[54];let Ee;e[55]!==Pe||e[56]!==k||e[57]!==b?(Ee=Pe&&n.jsxs(vt,{className:bi,onClick:_=>{_.stopPropagation(),k()},children:[n.jsx(yn,{className:"h-4 w-4"}),b("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[55]=Pe,e[56]=k,e[57]=b,e[58]=Ee):Ee=e[58];let ge;e[59]!==c||e[60]!==o.isMultivariate||e[61]!==o.isSavedBlock||e[62]!==b?(ge=o.isSavedBlock===!0&&!o.isMultivariate&&n.jsxs(vt,{onClick:_=>{_.stopPropagation(),c()},children:[n.jsx(yn,{className:"h-4 w-4"}),b("sectionsEditor.sectionList.detachMenuItem")]}),e[59]=c,e[60]=o.isMultivariate,e[61]=o.isSavedBlock,e[62]=b,e[63]=ge):ge=e[63];let ce;e[64]!==y?(ce=_=>{_.stopPropagation(),y()},e[64]=y,e[65]=ce):ce=e[65];let he;e[66]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(ys,{className:"h-4 w-4"}),e[66]=he):he=e[66];let Z;e[67]!==b?(Z=b("sectionsEditor.sectionList.deleteMenuItem"),e[67]=b,e[68]=Z):Z=e[68];let ue;e[69]!==ce||e[70]!==Z?(ue=n.jsxs(vt,{className:"text-destructive focus:text-destructive",onClick:ce,children:[he,Z]}),e[69]=ce,e[70]=Z,e[71]=ue):ue=e[71];let ve;e[72]!==le||e[73]!==I||e[74]!==Ee||e[75]!==ge||e[76]!==ue?(ve=n.jsxs(js,{align:"end",className:"w-44",children:[le,I,Ee,ge,ue]}),e[72]=le,e[73]=I,e[74]=Ee,e[75]=ge,e[76]=ue,e[77]=ve):ve=e[77];let Te;return e[78]!==Oe||e[79]!==pe||e[80]!==ve?(Te=n.jsxs(Oe,{children:[pe,ve]}),e[78]=Oe,e[79]=pe,e[80]=ve,e[81]=Te):Te=e[81],n.jsxs("div",{ref:m,style:oe,...Ke,...J,role:"button",tabIndex:0,onClick:v,onKeyDown:ee,className:Q,children:[ie,!o.isMultivariate&&n.jsxs(wt,{children:[n.jsx(kt,{asChild:!0,children:n.jsx(tt,{type:"button",variant:"ghost",size:"icon","aria-label":b(w?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:Ue(bn(D,w)),onClick:_=>{_.stopPropagation(),M()},onPointerDown:Ti,children:n.jsx(si,{className:Ue("h-3.5 w-3.5",w&&"text-yellow-500")})})}),n.jsx(Tt,{side:"bottom",children:b(w?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),n.jsxs(wt,{children:[n.jsx(kt,{asChild:!0,children:n.jsx(tt,{type:"button",variant:"ghost",size:"icon","aria-label":ye,className:Ue(bn(D,l)),onClick:re,onPointerDown:ki,children:K})}),Le]}),Te]})}function Ri(d){return d.stopPropagation()}function wi(d){return d.stopPropagation()}function ki(d){return d.stopPropagation()}function Ti(d){return d.stopPropagation()}function Vi(){return!1}function Di(d){const e=st.c(104),{listKey:o,rawSections:u,sections:p,meta:x,selectedIndex:j,onSelect:v,onReorder:y,onDelete:g,onDuplicate:k,onMakeReusable:L,onToggleHidden:M,onToggleLazy:V,onAddVariant:c,onDetach:b,onAddSection:w,canAddSection:l}=d,D=l===void 0?!0:l,i=Vt();let W;e[0]!==p.length?(W=()=>Yn(p.length),e[0]=p.length,e[1]=W):W=e[1];const[U,Ke]=R.useState(W),[J,m]=R.useState(null),[C,we]=R.useState(o),[N,X]=R.useState(p.length),T=R.useRef(!1);C!==o?(we(o),X(p.length),Ke(Yn(p.length))):N!==p.length&&(X(p.length),Ke(Te=>yi(Te,p.length)));let oe;e[2]===Symbol.for("react.memo_cache_sentinel")?(oe={activationConstraint:{distance:8}},e[2]=oe):oe=e[2];let B;e[3]===Symbol.for("react.memo_cache_sentinel")?(B={coordinateGetter:ms},e[3]=B):B=e[3];const Pe=ss(Zt(rs,oe),Zt(is,B));let ee;e[4]!==U?(ee=U.map(Ni),e[4]=U,e[5]=ee):ee=e[5];const de=ee;let Q;e[6]===Symbol.for("react.memo_cache_sentinel")?(Q=Te=>{m(String(Te.active.id))},e[6]=Q):Q=e[6];const ie=Q;let ye;e[7]!==de||e[8]!==y?(ye=Te=>{m(null);const{active:_,over:Se}=Te;if(!Se||_.id===Se.id)return;const ae=de.indexOf(String(_.id)),Ve=de.indexOf(String(Se.id));ae===-1||Ve===-1||(Ke($e=>Rs(Lt([...$e],ae,Ve))),T.current=!0,requestAnimationFrame(()=>{T.current=!1}),y?.(ae,Ve))},e[7]=de,e[8]=y,e[9]=ye):ye=e[9];const re=ye;let K;e[10]===Symbol.for("react.memo_cache_sentinel")?(K=()=>{m(null)},e[10]=K):K=e[10];const qe=K;let Le,Oe,ke,F,te,Fe,Ce,xe,ne,me,_e,fe,pe,se,Me;if(e[11]!==J||e[12]!==D||e[13]!==U||e[14]!==de||e[15]!==re||e[16]!==x||e[17]!==w||e[18]!==c||e[19]!==g||e[20]!==b||e[21]!==k||e[22]!==L||e[23]!==v||e[24]!==M||e[25]!==V||e[26]!==u||e[27]!==p||e[28]!==j||e[29]!==Pe||e[30]!==i){se=Symbol.for("react.early_return_sentinel");e:{const Te=_=>{T.current||v(_)};if(e[46]!==J||e[47]!==D||e[48]!==U||e[49]!==w||e[50]!==u||e[51]!==p||e[52]!==i){const _=J?U.find(Se=>Se.id===J):null;if(F=_!=null?p[_.index]:null,ke=_!=null?u[_.index]:void 0,U.length===0){let Se;e[56]!==i?(Se=i("sectionsEditor.sectionList.noSections"),e[56]=i,e[57]=Se):Se=e[57];let ae;e[58]!==Se?(ae=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:Se}),e[58]=Se,e[59]=ae):ae=e[59];const Ve=!D;let $e;e[60]===Symbol.for("react.memo_cache_sentinel")?($e=n.jsx(xn,{size:14}),e[60]=$e):$e=e[60];let ct;e[61]!==i?(ct=i("sectionsEditor.sectionList.addSectionButton"),e[61]=i,e[62]=ct):ct=e[62];let De;e[63]!==w||e[64]!==Ve||e[65]!==ct?(De=n.jsxs(tt,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ve,onClick:w,children:[$e,ct]}),e[63]=w,e[64]=Ve,e[65]=ct,e[66]=De):De=e[66];let Ze;e[67]!==ae||e[68]!==De?(Ze=n.jsxs("div",{className:"space-y-2",children:[ae,De]}),e[67]=ae,e[68]=De,e[69]=Ze):Ze=e[69],se=Ze;break e}pe=Ue(_&&"cursor-grabbing"),e[46]=J,e[47]=D,e[48]=U,e[49]=w,e[50]=u,e[51]=p,e[52]=i,e[53]=ke,e[54]=F,e[55]=pe}else ke=e[53],F=e[54],pe=e[55];Oe=fs,xe=Pe,ne=ps,me=ie,_e=re,fe=qe,Le=gs,Fe=de,Ce=hs,Me="space-y-1",te=U.map(_=>{const Se=p[_.index];return Se?n.jsx(Ei,{sortableId:_.id,section:Se,raw:u[_.index],meta:x,selected:j===_.index,onSelect:()=>Te(_.index),onDelete:()=>g(_.index),onDuplicate:()=>k(_.index),onMakeReusable:()=>L(_.index),onToggleHidden:()=>M(_.index),onToggleLazy:()=>V(_.index),onAddVariant:()=>c(_.index),onDetach:()=>b(_.index)},_.id):null})}e[11]=J,e[12]=D,e[13]=U,e[14]=de,e[15]=re,e[16]=x,e[17]=w,e[18]=c,e[19]=g,e[20]=b,e[21]=k,e[22]=L,e[23]=v,e[24]=M,e[25]=V,e[26]=u,e[27]=p,e[28]=j,e[29]=Pe,e[30]=i,e[31]=Le,e[32]=Oe,e[33]=ke,e[34]=F,e[35]=te,e[36]=Fe,e[37]=Ce,e[38]=xe,e[39]=ne,e[40]=me,e[41]=_e,e[42]=fe,e[43]=pe,e[44]=se,e[45]=Me}else Le=e[31],Oe=e[32],ke=e[33],F=e[34],te=e[35],Fe=e[36],Ce=e[37],xe=e[38],ne=e[39],me=e[40],_e=e[41],fe=e[42],pe=e[43],se=e[44],Me=e[45];if(se!==Symbol.for("react.early_return_sentinel"))return se;let je;e[70]!==te||e[71]!==Me?(je=n.jsx("div",{className:Me,children:te}),e[70]=te,e[71]=Me,e[72]=je):je=e[72];let le;e[73]!==Le||e[74]!==Fe||e[75]!==Ce||e[76]!==je?(le=n.jsx(Le,{items:Fe,strategy:Ce,children:je}),e[73]=Le,e[74]=Fe,e[75]=Ce,e[76]=je,e[77]=le):le=e[77];let I;e[78]!==ke||e[79]!==F||e[80]!==x?(I=F?n.jsx("div",{className:Ue("cursor-grabbing shadow-lg ring-1 ring-border/60",ks(F,!1)),children:n.jsx(ws,{section:F,raw:ke,meta:x})}):null,e[78]=ke,e[79]=F,e[80]=x,e[81]=I):I=e[81];let Ee;e[82]!==I?(Ee=es.createPortal(n.jsx(as,{dropAnimation:os,children:I}),document.body),e[82]=I,e[83]=Ee):Ee=e[83];let ge;e[84]!==Oe||e[85]!==xe||e[86]!==ne||e[87]!==me||e[88]!==_e||e[89]!==fe||e[90]!==le||e[91]!==Ee?(ge=n.jsxs(Oe,{sensors:xe,collisionDetection:ne,onDragStart:me,onDragEnd:_e,onDragCancel:fe,children:[le,Ee]}),e[84]=Oe,e[85]=xe,e[86]=ne,e[87]=me,e[88]=_e,e[89]=fe,e[90]=le,e[91]=Ee,e[92]=ge):ge=e[92];const ce=!D;let he;e[93]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(xn,{size:14}),e[93]=he):he=e[93];let Z;e[94]!==i?(Z=i("sectionsEditor.sectionList.addSectionButton"),e[94]=i,e[95]=Z):Z=e[95];let ue;e[96]!==w||e[97]!==ce||e[98]!==Z?(ue=n.jsxs(tt,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:ce,onClick:w,children:[he,Z]}),e[96]=w,e[97]=ce,e[98]=Z,e[99]=ue):ue=e[99];let ve;return e[100]!==pe||e[101]!==ge||e[102]!==ue?(ve=n.jsxs("div",{className:pe,children:[ge,ue]}),e[100]=pe,e[101]=ge,e[102]=ue,e[103]=ve):ve=e[103],ve}function Ni(d){return d.id}function Jn(d){const e=st.c(57),{open:o,initialName:u,autoLabel:p,isPending:x,onSubmit:j,onOpenChange:v}=d,y=x===void 0?!1:x,g=Vt(),[k,L]=R.useState(u),[M,V]=R.useState(o);o!==M&&(V(o),o&&L(u));let c;e[0]!==y||e[1]!==v?(c=ie=>{!ie&&!y&&v(!1)},e[0]=y,e[1]=v,e[2]=c):c=e[2];const b=c;let w;e[3]!==y||e[4]!==k||e[5]!==j?(w=async ie=>{ie.preventDefault(),!y&&await j(k.trim())},e[3]=y,e[4]=k,e[5]=j,e[6]=w):w=e[6];const l=w;let D;e[7]!==g?(D=g("sectionsEditor.variantRenameDialog.title"),e[7]=g,e[8]=D):D=e[8];let i;e[9]!==D?(i=n.jsx(qo,{children:D}),e[9]=D,e[10]=i):i=e[10];let W;e[11]!==p||e[12]!==g?(W=g("sectionsEditor.variantRenameDialog.description",{fallback:p||g("sectionsEditor.variantRenameDialog.defaultFallback")}),e[11]=p,e[12]=g,e[13]=W):W=e[13];let U;e[14]!==W?(U=n.jsx(Wo,{children:W}),e[14]=W,e[15]=U):U=e[15];let Ke;e[16]!==i||e[17]!==U?(Ke=n.jsxs(Yo,{children:[i,U]}),e[16]=i,e[17]=U,e[18]=Ke):Ke=e[18];let J;e[19]!==g?(J=g("sectionsEditor.variantRenameDialog.nameLabel"),e[19]=g,e[20]=J):J=e[20];let m;e[21]!==J?(m=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:J}),e[21]=J,e[22]=m):m=e[22];let C;e[23]===Symbol.for("react.memo_cache_sentinel")?(C=ie=>L(ie.target.value),e[23]=C):C=e[23];let we;e[24]!==p||e[25]!==y||e[26]!==k?(we=n.jsx(Xo,{id:"variant-rename-name",value:k,onChange:C,placeholder:p,autoFocus:!0,disabled:y}),e[24]=p,e[25]=y,e[26]=k,e[27]=we):we=e[27];let N;e[28]!==m||e[29]!==we?(N=n.jsxs("div",{className:"space-y-1.5 py-4",children:[m,we]}),e[28]=m,e[29]=we,e[30]=N):N=e[30];let X;e[31]!==v?(X=()=>v(!1),e[31]=v,e[32]=X):X=e[32];let T;e[33]!==g?(T=g("sectionsEditor.variantRenameDialog.cancel"),e[33]=g,e[34]=T):T=e[34];let oe;e[35]!==y||e[36]!==X||e[37]!==T?(oe=n.jsx(tt,{type:"button",variant:"outline",onClick:X,disabled:y,children:T}),e[35]=y,e[36]=X,e[37]=T,e[38]=oe):oe=e[38];let B;e[39]!==y||e[40]!==g?(B=y?n.jsxs(n.Fragment,{children:[n.jsx(ts,{className:"size-3.5"}),g("sectionsEditor.variantRenameDialog.saving")]}):g("sectionsEditor.variantRenameDialog.save"),e[39]=y,e[40]=g,e[41]=B):B=e[41];let Pe;e[42]!==y||e[43]!==B?(Pe=n.jsx(tt,{type:"submit",disabled:y,children:B}),e[42]=y,e[43]=B,e[44]=Pe):Pe=e[44];let ee;e[45]!==oe||e[46]!==Pe?(ee=n.jsxs(Jo,{children:[oe,Pe]}),e[45]=oe,e[46]=Pe,e[47]=ee):ee=e[47];let de;e[48]!==l||e[49]!==N||e[50]!==ee||e[51]!==Ke?(de=n.jsx(Qo,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:l,children:[Ke,N,ee]})}),e[48]=l,e[49]=N,e[50]=ee,e[51]=Ke,e[52]=de):de=e[52];let Q;return e[53]!==b||e[54]!==o||e[55]!==de?(Q=n.jsx(Zo,{open:o,onOpenChange:b,children:de}),e[53]=b,e[54]=o,e[55]=de,e[56]=Q):Q=e[56],Q}function Ts(d){const e=st.c(5),{rule:o,matchers:u}=d,p=o?.__resolveType??"";let x;if(e[0]!==u||e[1]!==p){const g=u.find(k=>k.resolveType===p)?.iconName??Ua(p);x=Fo(g),e[0]=u,e[1]=p,e[2]=x}else x=e[2];const j=x;if(!j)return null;let v;return e[3]!==j?(v=n.jsx(j,{size:14,className:"shrink-0"}),e[3]=j,e[4]=v):v=e[4],v}function Qn(d){return d.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
2
2
  `)}function Zn(d){return d.map((e,o)=>({id:crypto.randomUUID(),index:o,variant:e}))}function Ai(d,e){const o=new Map;for(const u of d){const p=o.get(u.variant.label);p?p.push(u):o.set(u.variant.label,[u])}return e.map((u,p)=>({id:o.get(u.label)?.shift()?.id??crypto.randomUUID(),index:p,variant:u}))}function Pi(d){return d.map((e,o)=>({...e,index:o}))}function Vs(d){const e=st.c(17),{label:o,effectiveRule:u,matchers:p,canDelete:x,dragging:j,onRename:v,onDuplicate:y,onDelete:g}=d,k=Vt();let L;e[0]!==u||e[1]!==p?(L=n.jsx(Ts,{rule:u,matchers:p}),e[0]=u,e[1]=p,e[2]=L):L=e[2];let M;e[3]!==o?(M=n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:o}),e[3]=o,e[4]=M):M=e[4];let V;e[5]!==x||e[6]!==j||e[7]!==o||e[8]!==g||e[9]!==y||e[10]!==v||e[11]!==k?(V=!j&&n.jsxs(_s,{children:[n.jsx(xs,{asChild:!0,children:n.jsx(tt,{type:"button",variant:"ghost",size:"icon","aria-label":k("sectionsEditor.pageVariantTabs.actionsAriaLabel",{label:o}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:Mi,onPointerDown:Ci,children:n.jsx(Ss,{size:14})})}),n.jsxs(js,{align:"end",className:"w-36",children:[n.jsxs(vt,{onClick:b=>{b.stopPropagation(),v?.()},children:[n.jsx(ci,{size:14}),k("sectionsEditor.pageVariantTabs.renameAction")]}),n.jsxs(vt,{onClick:b=>{b.stopPropagation(),y?.()},children:[n.jsx(bs,{size:14}),k("sectionsEditor.pageVariantTabs.duplicateAction")]}),n.jsx(ai,{}),n.jsxs(vt,{variant:"destructive",disabled:!x,onClick:b=>{b.stopPropagation(),g?.()},children:[n.jsx(ys,{size:14}),k("sectionsEditor.pageVariantTabs.deleteAction")]})]})]}),e[5]=x,e[6]=j,e[7]=o,e[8]=g,e[9]=y,e[10]=v,e[11]=k,e[12]=V):V=e[12];let c;return e[13]!==L||e[14]!==M||e[15]!==V?(c=n.jsxs(n.Fragment,{children:[L,M,V]}),e[13]=L,e[14]=M,e[15]=V,e[16]=c):c=e[16],c}function Ci(d){return d.stopPropagation()}function Mi(d){return d.stopPropagation()}function Ki(d){const e=st.c(33),{entry:o,isActive:u,canDelete:p,decofile:x,meta:j,matchers:v,onSelect:y,onRename:g,onDuplicate:k,onDelete:L}=d;let M;e[0]!==o.id?(M={id:o.id,animateLayoutChanges:Li},e[0]=o.id,e[1]=M):M=e[1];const{attributes:V,listeners:c,setNodeRef:b,transform:w,isDragging:l}=cs(M);let D;e[2]!==w?(D=us.Transform.toString(w?{...w,x:0}:null),e[2]=w,e[3]=D):D=e[3];const i=l?0:void 0;let W;e[4]!==D||e[5]!==i?(W={transform:D,opacity:i},e[4]=D,e[5]=i,e[6]=W):W=e[6];const U=W,Ke=j??void 0;let J;e[7]!==x||e[8]!==o.variant.rule||e[9]!==Ke?(J=Bt(o.variant.rule,x,Ke),e[7]=x,e[8]=o.variant.rule,e[9]=Ke,e[10]=J):J=e[10];const m=J;let C;e[11]!==y?(C=B=>{B.target===B.currentTarget&&(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),y())},e[11]=y,e[12]=C):C=e[12];const we=l?"cursor-grabbing":"cursor-pointer active:cursor-grabbing",N=u?vs:ds;let X;e[13]!==we||e[14]!==N?(X=Ue("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",we,N),e[13]=we,e[14]=N,e[15]=X):X=e[15];let T;e[16]!==p||e[17]!==m||e[18]!==o.variant.label||e[19]!==v||e[20]!==L||e[21]!==k||e[22]!==g?(T=n.jsx(Vs,{label:o.variant.label,effectiveRule:m,matchers:v,canDelete:p,onRename:g,onDuplicate:k,onDelete:L}),e[16]=p,e[17]=m,e[18]=o.variant.label,e[19]=v,e[20]=L,e[21]=k,e[22]=g,e[23]=T):T=e[23];let oe;return e[24]!==V||e[25]!==c||e[26]!==y||e[27]!==b||e[28]!==U||e[29]!==X||e[30]!==T||e[31]!==C?(oe=n.jsx("div",{ref:b,style:U,...V,...c,onClick:y,onKeyDown:C,className:X,children:T}),e[24]=V,e[25]=c,e[26]=y,e[27]=b,e[28]=U,e[29]=X,e[30]=T,e[31]=C,e[32]=oe):oe=e[32],oe}function Li(){return!1}function Bi(d){const e=st.c(9),{variant:o,decofile:u,meta:p,matchers:x}=d,j=p??void 0;let v;e[0]!==u||e[1]!==j||e[2]!==o.rule?(v=Bt(o.rule,u,j),e[0]=u,e[1]=j,e[2]=o.rule,e[3]=v):v=e[3];const y=v;let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=Ue("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",vs),e[4]=g):g=e[4];let k;return e[5]!==y||e[6]!==x||e[7]!==o.label?(k=n.jsx("div",{className:g,children:n.jsx(Vs,{label:o.label,effectiveRule:y,matchers:x,canDelete:!1,dragging:!0})}),e[5]=y,e[6]=x,e[7]=o.label,e[8]=k):k=e[8],k}function Ii(d){const e=st.c(91),{listKey:o,variants:u,activeIndex:p,decofile:x,meta:j,matchers:v,onSelect:y,onReorder:g,onRename:k,onDuplicate:L,onDelete:M,onAdd:V}=d,c=Vt();let b;e[0]!==u?(b=()=>Zn(u),e[0]=u,e[1]=b):b=e[1];const[w,l]=R.useState(b),[D,i]=R.useState(null),[W,U]=R.useState(o),[Ke,J]=R.useState(u.length);let m;e[2]!==u?(m=()=>Qn(u),e[2]=u,e[3]=m):m=e[3];const[C,we]=R.useState(m),N=R.useRef(!1),X=Qn(u);W!==o?(U(o),J(u.length),we(X),l(Zn(u))):(Ke!==u.length||C!==X)&&(J(u.length),we(X),l(ge=>Ai(ge,u)));let T;e[4]===Symbol.for("react.memo_cache_sentinel")?(T={activationConstraint:{distance:8}},e[4]=T):T=e[4];let oe;e[5]===Symbol.for("react.memo_cache_sentinel")?(oe={coordinateGetter:ms},e[5]=oe):oe=e[5];const B=ss(Zt(rs,T),Zt(is,oe));let Pe;e[6]!==w?(Pe=w.map(Oi),e[6]=w,e[7]=Pe):Pe=e[7];const ee=Pe,de=u.length>1;let Q;e[8]!==w?(Q=ge=>{const ce=String(ge.active.id);i(w.find(he=>he.id===ce)??null)},e[8]=w,e[9]=Q):Q=e[9];const ie=Q;let ye;e[10]!==ee||e[11]!==g?(ye=ge=>{i(null);const{active:ce,over:he}=ge;if(!he||ce.id===he.id)return;const Z=ee.indexOf(String(ce.id)),ue=ee.indexOf(String(he.id));Z===-1||ue===-1||(l(ve=>Pi(Lt([...ve],Z,ue))),N.current=!0,requestAnimationFrame(()=>{N.current=!1}),g(Z,ue))},e[10]=ee,e[11]=g,e[12]=ye):ye=e[12];const re=ye;let K;e[13]===Symbol.for("react.memo_cache_sentinel")?(K=()=>{i(null)},e[13]=K):K=e[13];const qe=K;let Le,Oe,ke,F,te,Fe,Ce,xe,ne,me,_e,fe,pe;if(e[14]!==p||e[15]!==de||e[16]!==x||e[17]!==w||e[18]!==ee||e[19]!==re||e[20]!==ie||e[21]!==v||e[22]!==j||e[23]!==V||e[24]!==M||e[25]!==L||e[26]!==k||e[27]!==y||e[28]!==B||e[29]!==c){const ge=ae=>{N.current||y(ae)};_e="space-y-1 border-b p-2";let ce;e[43]!==c?(ce=c("sectionsEditor.pageVariantTabs.variantsLabel"),e[43]=c,e[44]=ce):ce=e[44];let he;e[45]!==ce?(he=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ce}),e[45]=ce,e[46]=he):he=e[46];let Z;e[47]!==c?(Z=c("sectionsEditor.pageVariantTabs.addVariantAriaLabel"),e[47]=c,e[48]=Z):Z=e[48];let ue;e[49]===Symbol.for("react.memo_cache_sentinel")?(ue=n.jsx(xn,{size:14}),e[49]=ue):ue=e[49];let ve;e[50]!==V||e[51]!==Z?(ve=n.jsx(kt,{asChild:!0,children:n.jsx(tt,{type:"button",variant:"ghost",size:"icon","aria-label":Z,className:"size-6",onClick:V,children:ue})}),e[50]=V,e[51]=Z,e[52]=ve):ve=e[52];let Te;e[53]!==c?(Te=c("sectionsEditor.pageVariantTabs.addVariantTooltip"),e[53]=c,e[54]=Te):Te=e[54];let _;e[55]!==Te?(_=n.jsx(Tt,{children:Te}),e[55]=Te,e[56]=_):_=e[56];let Se;e[57]!==ve||e[58]!==_?(Se=n.jsxs(wt,{children:[ve,_]}),e[57]=ve,e[58]=_,e[59]=Se):Se=e[59],e[60]!==he||e[61]!==Se?(fe=n.jsxs("div",{className:"flex items-center justify-between",children:[he,Se]}),e[60]=he,e[61]=Se,e[62]=fe):fe=e[62],Oe=fs,Fe=B,Ce=ps,xe=ie,ne=re,me=qe,Le=gs,F=ee,te=hs,pe="space-y-0.5",ke=w.map(ae=>n.jsx(Ki,{entry:ae,isActive:ae.index===p,canDelete:de,decofile:x,meta:j,matchers:v,onSelect:()=>ge(ae.index),onRename:()=>k(ae.index),onDuplicate:()=>L(ae.index),onDelete:()=>M(ae.index)},ae.id)),e[14]=p,e[15]=de,e[16]=x,e[17]=w,e[18]=ee,e[19]=re,e[20]=ie,e[21]=v,e[22]=j,e[23]=V,e[24]=M,e[25]=L,e[26]=k,e[27]=y,e[28]=B,e[29]=c,e[30]=Le,e[31]=Oe,e[32]=ke,e[33]=F,e[34]=te,e[35]=Fe,e[36]=Ce,e[37]=xe,e[38]=ne,e[39]=me,e[40]=_e,e[41]=fe,e[42]=pe}else Le=e[30],Oe=e[31],ke=e[32],F=e[33],te=e[34],Fe=e[35],Ce=e[36],xe=e[37],ne=e[38],me=e[39],_e=e[40],fe=e[41],pe=e[42];let se;e[63]!==ke||e[64]!==pe?(se=n.jsx("div",{className:pe,children:ke}),e[63]=ke,e[64]=pe,e[65]=se):se=e[65];let Me;e[66]!==Le||e[67]!==F||e[68]!==te||e[69]!==se?(Me=n.jsx(Le,{items:F,strategy:te,children:se}),e[66]=Le,e[67]=F,e[68]=te,e[69]=se,e[70]=Me):Me=e[70];let je;e[71]!==D||e[72]!==x||e[73]!==v||e[74]!==j?(je=D?n.jsx(Bi,{variant:D.variant,decofile:x,meta:j,matchers:v}):null,e[71]=D,e[72]=x,e[73]=v,e[74]=j,e[75]=je):je=e[75];let le;e[76]!==je?(le=es.createPortal(n.jsx(as,{dropAnimation:os,children:je}),document.body),e[76]=je,e[77]=le):le=e[77];let I;e[78]!==Oe||e[79]!==Fe||e[80]!==Ce||e[81]!==xe||e[82]!==ne||e[83]!==me||e[84]!==Me||e[85]!==le?(I=n.jsxs(Oe,{sensors:Fe,collisionDetection:Ce,onDragStart:xe,onDragEnd:ne,onDragCancel:me,children:[Me,le]}),e[78]=Oe,e[79]=Fe,e[80]=Ce,e[81]=xe,e[82]=ne,e[83]=me,e[84]=Me,e[85]=le,e[86]=I):I=e[86];let Ee;return e[87]!==_e||e[88]!==fe||e[89]!==I?(Ee=n.jsxs("div",{className:_e,children:[fe,I]}),e[87]=_e,e[88]=fe,e[89]=I,e[90]=Ee):Ee=e[90],Ee}function Oi(d){return d.id}function Xn(d){const e=st.c(21),{currentRt:o,currentLabel:u,currentGlobalKey:p,matchers:x,globals:j,onSelect:v,onSelectGlobal:y,schema:g,formValue:k,onChange:L,formKey:M,formWrapperClassName:V,meta:c,decofile:b,onSaveReferencedBlock:w,sandbox:l}=d;let D;e[0]!==p||e[1]!==u||e[2]!==o||e[3]!==j||e[4]!==x||e[5]!==v||e[6]!==y?(D=n.jsx(Ga,{currentRt:o,currentLabel:u,currentGlobalKey:p,matchers:x,globals:j,onSelect:v,onSelectGlobal:y}),e[0]=p,e[1]=u,e[2]=o,e[3]=j,e[4]=x,e[5]=v,e[6]=y,e[7]=D):D=e[7];let i;e[8]!==b||e[9]!==M||e[10]!==k||e[11]!==V||e[12]!==c||e[13]!==L||e[14]!==w||e[15]!==l||e[16]!==g?(i=g&&k&&n.jsx("div",{className:V,children:n.jsx(qa,{schema:g,value:k,onChange:L,meta:c,decofile:b,onSaveReferencedBlock:w,sandbox:l},M)}),e[8]=b,e[9]=M,e[10]=k,e[11]=V,e[12]=c,e[13]=L,e[14]=w,e[15]=l,e[16]=g,e[17]=i):i=e[17];let W;return e[18]!==D||e[19]!==i?(W=n.jsxs(n.Fragment,{children:[D,i]}),e[18]=D,e[19]=i,e[20]=W):W=e[20],W}function Uc({orgSlug:d,virtualMcpId:e,branch:o,previewReady:u=!0,previewUrl:p,currentPath:x,activePageBlockKey:j=null,activeGlobalBlockKey:v=null,externalSelection:y,onSaved:g,initialEditSeo:k=!1,onExitSeo:L,onViewJsonFile:M,onVariantPreviewOverride:V}){const c=Vt(),b=La()?.taskId??null,w=u?{orgSlug:d,virtualMcpId:e,branch:o,threadId:b,previewUrl:p}:null,{data:l,isLoading:D}=Wa(w),{data:i,isLoading:W}=Ya(w),U=Ja(),Ke=U?.entity?.id===e?U.entity.metadata?.siteSlug??null:null,J=ui({virtualMcpId:e,sandboxUrl:p}),[m,C]=R.useState(null),[we,N]=R.useState(null),[X,T]=R.useState(null),[oe,B]=R.useState(0),[Pe,ee]=R.useState(void 0),[de,Q]=R.useState(null),[ie,ye]=R.useState(null),[re,K]=R.useState([]),qe=R.useRef(null),[Le,Oe]=R.useState(re.length);Le!==re.length&&(Oe(re.length),requestAnimationFrame(()=>{qe.current&&(qe.current.scrollTop=0)}));const[ke,F]=R.useState(0),[te,Fe]=R.useState(null),[Ce,xe]=R.useState(null),[ne,me]=R.useState(null),[_e,fe]=R.useState(!0),[pe,se]=R.useState(!1),[Me,je]=R.useState(!1),le=R.useRef(null),[I,Ee]=R.useState(k),[ge,ce]=R.useState(k);k&&!ge&&(ce(!0),Ee(!0),C(null),N(null),T(null),K([])),!k&&ge&&ce(!1);const[he,Z]=R.useState(null),[ue,ve]=R.useState(void 0),[Te,_]=R.useState([]),[Se,ae]=R.useState(0),[Ve,$e]=R.useState(0),[ct,De]=R.useState(null),[Ze,We]=R.useState(null),[_n,jn]=R.useState(null),Ds=Ma(),Ns=`${d}/${e}/${o}`,Xt=Qa({orgSlug:d,virtualMcpId:e,branch:o}),[As,Ps]=R.useState(x),[Cs,Ms]=R.useState(j),[Ks,Ls]=R.useState(v);(As!==x||Cs!==j||Ks!==v)&&(queueMicrotask(()=>Xt.flush()),Ps(x),Ms(j),Ls(v),C(null),N(null),T(null),B(0),Q(null),ye(null),$e(0),De(null),We(null),K([]),F(t=>t+1),Ee(!1),Z(null),ve(void 0),_([]),ae(t=>t+1));const Ne=Za({orgSlug:d,virtualMcpId:e,branch:o}),It=wo((t,s)=>{Ne.mutate({blockKey:t,data:s},{onSuccess:()=>g?.(),onError:a=>q.error(c("sectionsEditor.sectionsEditor.saveFailed",{error:a.message}))})}),en=Xa({orgSlug:d,virtualMcpId:e,branch:o}),[Dt,Ot]=R.useState(!1),ze=R.useRef(null),at=R.useRef(null),ot=R.useRef(null),tn=R.useRef({}),Xe=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!u||D||W)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(ts,{className:"size-5 text-muted-foreground"})});if(!l||!i)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:c("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const Bs=eo(l),Ae=!!v,Ye=Ae?null:to(Bs,x,j),E=Ae?v:Ye?.key??null,nn=Ae&&v?l[v]:void 0,En=Ae&&v&&nn?no(v,nn):Ae&&v?v:"",Ft=!Ae&&E&&l[E]?l[E]:null,sn=I&&l&&i&&E&&Ye?In(l,{kind:"page",pageKey:E,pageName:String(Ye.name??""),path:String(Ye.path??"")},i):null,Is=I?Ft?.seo:void 0,an=ue!==void 0?ue:Is,Os=I?so(an):void 0,Fs=sn?.seoTypeOptions??[],$s=I&&i?ao(i):"",Rn=he??Os??{},on=I&&sn?ii(Rn,sn):null,zs=I&&on&&oo(an)?qt(on,i):null,Hs=I?io(l,i)?.seoData:void 0,Ge=Ae?[{label:"Default",sections:[{__resolveType:v}]}]:ro(Ft?.sections,l??{}),Nt=Ge.length>1,Be=Math.min(oe,Ge.length-1),ut=Ge[Be],H=ut?.sections??[],He=Wt(H,l),rn=!Ae&&lo(Ft?.sections);if(Ae&&v&&_n!==v){jn(v);const t=H[0],s=He[0];if(t&&s){C(0),$e(0),K([]);const a=bt(t,s,l);a&&(N(a.data),T(a.resolveType),We(null),De(null))}}!Ae&&_n!==null&&jn(null),Xe.current={rawSections:H,parsedSections:He,decofile:l??{},activePageKey:E,pageVariants:Ge,variantIndex:Be,sectionVariantIndex:Ve,selectedSectionIndex:m};const Us=()=>({multivariate:rn,index:Be,variants:Ge.map(t=>({rule:t.rule}))}),ln=(t,s)=>{if(!V)return;if(!E||!rn||t.length<=1){V(null);return}const a=zn(E,{multivariate:!0,index:s,variants:t},l,i);V(a.length>0?a:null)},cn=V&&E&&rn&&Nt&&!D&&!W?E:null,[Gs,qs]=R.useState(null);if(cn!==Gs&&(qs(cn),cn)){const t=Ge.map(a=>({rule:a.rule})),s=Be;queueMicrotask(()=>ln(t,s))}const xt=(t,s,a)=>{if(!V)return;if(!E){V(null);return}const r=Us(),f=zn(E,r,l,i);if(!t||s<0){V(f.length>0?f:null);return}const S=No({pageKey:E,page:r,sectionIndex:s,sectionLazy:He[s]?.isLazy??!1,mvObj:t,selectedVariantIndex:a,decofile:l,meta:i}),h=[...f,...S];V(h.length>0?h:null)},dt=(t,s,a,r=m??-1,f=!1)=>{const S=nt(t,s);if(!S){N(null),T(null),We(null),De(null),f&&xt(null,r,a);return}const A=On(S,ht)[a];if(!A){N(null),T(null),We(null),De(null),f&&xt(null,r,a);return}const Y=So(A.value,l);N(Y?.data??null),T(Y?.resolveType??null);const{resolveType:P,formValue:O}=Ct(A.rule,l,i??void 0);We(P),De(O),f&&xt(S,r,a)},At=y?.index;if(y!==void 0&&(y?.seq??null)!==Pe&&(ee(y?.seq??null),typeof At=="number")){const t=H[At],s=He[At];if(t&&s)if(C(At),$e(0),K([]),F(a=>a+1),s.isMultivariate)dt(t,s,0,At);else{const a=bt(t,s,l);a?(N(a.data),T(a.resolveType)):(N(null),T(null)),We(null),De(null)}}const $t={orgSlug:d,virtualMcpId:e,branch:o,threadId:b,previewUrl:p??void 0,siteSlug:Ke},un=X&&i?qt(X,i):null,Je=(t,s)=>{if(!E)return;ze.current&&(clearTimeout(ze.current),ze.current=null),ot.current&&(clearTimeout(ot.current),ot.current=null),at.current&&(clearTimeout(at.current),at.current=null);const a=Kt(l,E,t,Be,Ge);Ne.mutate({blockKey:E,data:a},{onSuccess:()=>s?.onSuccess?.()??g?.(),onError:r=>q.error(c("sectionsEditor.sectionsEditor.saveFailed",{error:r.message}))})},_t=()=>{C(null),N(null),T(null),$e(0),De(null),We(null),K([]),F(t=>t+1)},Ws=(t,s)=>{ze.current&&clearTimeout(ze.current);const a=Xe.current.sectionVariantIndex;ze.current=setTimeout(()=>{const{rawSections:r,parsedSections:f,decofile:S,activePageKey:h,pageVariants:A,variantIndex:Y}=Xe.current,P=r[s];if(!P)return;const O=f[s];if(!O)return;if(O.isSavedBlock){const z=Po(P,O);if(!z)return;Ne.mutate({blockKey:z,data:t},{onSuccess:()=>g?.(),onError:G=>q.error(c("sectionsEditor.sectionsEditor.saveFailed",{error:G.message}))});return}if(!h)return;const $={...S[h]},Re=[...r];if(O.isMultivariate){const z=nt(P,O);if(!z||!h)return;const G=Co(z,a,t);Re[s]=yt(P,O,G)}else if(O.isHidden){const z=ls(P.__resolveType),G=z?{...P.section}:{...P},Ie=Array.isArray(G.variants)?[...G.variants]:[];Ie[0]&&(Ie[0]={...Ie[0],value:t}),G.variants=Ie,z?Re[s]={...P,section:G}:Re[s]=G}else O.isLazy?Re[s]={...P,section:t}:Re[s]=t;if(A.length>1){const z=$.sections,G=[...z?.variants??[]];G[Y]&&(G[Y]={...G[Y],value:Re}),$.sections={...z,variants:G}}else $.sections=Re;Ne.mutate({blockKey:h,data:$},{onSuccess:()=>g?.(),onError:z=>q.error(c("sectionsEditor.sectionsEditor.saveFailed",{error:z.message}))})},Sn)},Ys=t=>{C(t),$e(0),K([]),F(f=>f+1);const s=H[t],a=He[t];if(!s||!a)return;if(a.isMultivariate){dt(s,a,0,t);return}const r=bt(s,a,l);if(!r){N(null),T(null),We(null),De(null),xt(null,t,0);return}N(r.data),T(r.resolveType),We(null),De(null),xt(null,t,0)},wn=t=>{const s=t;N(s),m!==null&&Ws(s,m)},dn=t=>{if(!E||!l||!i||!Ye)return;const s={kind:"page",pageKey:E,pageName:String(Ye.name??""),path:String(Ye.path??"")},a=In(l,s,i);a&&Xt.save(E,()=>{const r=Ds.getQueryData(Ka.decofile(Ns))?.[E];if(!r||typeof r!="object"||r===null||Array.isArray(r))return null;const f={...r,...tn.current};return tn.current={},t?.raw!==void 0?{...f,seo:t.raw}:t?.inner!==void 0?li(s,a,f,t.inner):f})},Js=(t,s)=>{E&&(tn.current[t]=s,dn())},Qs=(t,s)=>{if(!E)return;const a=Lt([...H],t,s);m!==null&&(m===t?C(s):t<m&&s>=m?C(m-1):t>m&&s<=m&&C(m+1)),Je(a)},Zs=t=>{if(!E)return;const s=H.filter((a,r)=>r!==t);m===t?_t():m!==null&&m>t&&C(m-1),Je(s)},Xs=t=>{if(!E)return;const s=H[t];if(!s)return;const a=[...H];a.splice(t+1,0,Do(s)),m!==null&&m>t&&C(m+1),Je(a)},ea=t=>{if(!E)return;const s=H[t],a=He[t];if(!s||!a)return;const r=a.isHidden?To(s):Vo(s);if(!r)return;const f=[...H];f[t]=r,m===t&&_t(),Je(f)},ta=t=>{if(!E)return;const s=H[t],a=He[t];if(!s||!a||a.isMultivariate)return;const r=ko(s);if(!r)return;const f=[...H];f[t]=r,m===t&&_t(),Je(f)},na=t=>{if(!E)return;const s=H[t],a=He[t];if(!s||!a?.isSavedBlock)return;const r=bt(s,a,l);if(!r?.data)return;const{name:f,...S}=r.data,h=[...H];a.isLazy?h[t]={...s,section:S}:h[t]=S,m===t&&_t(),Je(h)},sa=t=>{if(!E)return;const s=[...H,{__resolveType:t.resolveType}],a=s.length-1;Je(s,{onSuccess:()=>{se(!1),C(a),$e(0),K([]),F(h=>h+1);const r=s[a],f=Wt(s,l)[a];if(!r||!f)return;if(f.isMultivariate){dt(r,f,0);return}const S=bt(r,f,l);if(!S){N(null),T(null),We(null),De(null);return}N(S.data),T(S.resolveType),We(null),De(null)}})},kn=t=>{le.current=t.append,se(!0)},aa=t=>{const s=le.current;if(!s){sa(t);return}s({__resolveType:t.resolveType}),se(!1),le.current=null},oa=t=>{if(m===null)return;const s=H[m],a=He[m];!s||!a?.isMultivariate||($e(t),K([]),F(r=>r+1),dt(s,a,t,m,!0))},ia=t=>{if(m===null||!E)return;const s=H[m],a=He[m];if(!s||!a?.isMultivariate)return;const r=nt(s,a);if(!r)return;const f=Eo(r,t);if(!f){q.error(c("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const S=[...H];S[m]=yt(s,a,f);const h=f.variants;let A=Ve;t===Ve?A=Math.min(t,h.length-1):t<Ve&&(A=Ve-1),$e(A),K([]),F(Y=>Y+1),dt(S[m],a,A),Je(S)},ra=t=>{if(m===null||!E)return;const s=H[m],a=He[m];if(!s||!a?.isMultivariate)return;const r=nt(s,a);if(!r)return;const f=Ro(r,t),S=[...H];S[m]=yt(s,a,f);const h=t+1;$e(h),K([]),F(A=>A+1),dt(S[m],a,h),Je(S)},la=(t,s)=>{if(m===null||!E||t===s)return;const a=H[m],r=He[m];if(!a||!r?.isMultivariate)return;const f=nt(a,r);if(!f)return;const S=_o(f,t,s),h=[...H];h[m]=yt(a,r,S);let A=Ve;Ve===t?A=s:t<Ve&&s>=Ve?A=Ve-1:t>Ve&&s<=Ve&&(A=Ve+1),$e(A),dt(h[m],r,A),Je(h)},mn=t=>{const s=t??m;if(s===null||!E)return;const a=H[s],r=He[s];if(!a||!r)return;const f=bo(a,r);if(!f){q.error(c("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const S=[...H];S[s]=f.section;const h=Wt(S,l)[s];if(!h?.isMultivariate){q.error(c("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}C(s),$e(f.newVariantIndex),K([]),F(A=>A+1),dt(f.section,h,f.newVariantIndex,s),Je(S)},ca=()=>{if(m===null||!E)return;const t=H[m],s=He[m];if(!t||!s?.isMultivariate)return;const a=nt(t,s);if(!a)return;const r=jo(t,s,a);if(!r){q.error(c("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const f=[...H];f[m]=r;const S=Wt(f,l)[m];if(!S)return;$e(0),We(null),De(null),K([]),F(A=>A+1);const h=bt(r,S,l);h?(N(h.data),T(h.resolveType)):(N(null),T(null)),xt(null,m,0),Je(f)},ua=async t=>{if(te===null||!E)return;const s=vn(t,l);if(s){q.error(s);return}const a=H[te],r=He[te];if(!a||!r)return;const f=bt(a,r,l);if(!f){q.error(c("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const S={...f.data,name:t};try{await Ne.mutateAsync({blockKey:t,data:S});const h=[...H];h[te]={__resolveType:t},await Ne.mutateAsync({blockKey:E,data:Kt(l,E,h,Be,Ge)}),m===te&&_t(),Fe(null),q.success(c("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),g?.()}catch(h){q.error(h instanceof Error?h.message:c("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"))}},Tn=ut?.rule;if(Nt&&m===null&&ie===null&&Tn){const{resolveType:t,formValue:s}=Ct(Tn,l??{},i??void 0);ye(t),Q(s)}const zt=i?co(i):[],Vn=i&&l?uo(i,l):[],da=!Ae&&!!(J&&i&&l),ma=ie&&i?qt(ie,i):null,jt=()=>{at.current&&(clearTimeout(at.current),at.current=null),ot.current&&(clearTimeout(ot.current),ot.current=null)},Pt=async(t,s)=>{if(!(Ao(s,t,i)>0))try{await en.mutateAsync({blockKey:t})}catch(a){q.error(a instanceof Error?a.message:c("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"))}},Dn=t=>{at.current&&clearTimeout(at.current),at.current=setTimeout(()=>{const{activePageKey:s,decofile:a,variantIndex:r}=Xe.current;if(!s)return;const f={...a[s]},S={...f.sections},h=[...S.variants??[]],A=h[r],Y=A?.rule;if(Et(Y,a,i)){const P=Y?.__resolveType??"",O=a[P],$=typeof O?.name=="string"?O.name:P,{__resolveType:Re,...z}=t;Ne.mutate({blockKey:P,data:Rt(Re??"",z,$)},{onSuccess:()=>g?.(),onError:G=>q.error(c("sectionsEditor.sectionsEditor.saveFailed",{error:G.message}))});return}A&&(h[r]={...A,rule:t}),f.sections={...S,variants:h},Ne.mutate({blockKey:s,data:f},{onSuccess:()=>g?.(),onError:P=>q.error(c("sectionsEditor.sectionsEditor.saveFailed",{error:P.message}))})},Sn)},fa=t=>{ye(t);const s=t?Un(t,i):{__resolveType:Gn};Q(t?s:{}),Dn(s)},pa=t=>{const s=t;Q(s);const a=ie?{__resolveType:ie,...s}:{...s};Dn(a)},ga=async t=>{jt();const{activePageKey:s,decofile:a,variantIndex:r}=Xe.current;if(!s)return;const f=a[s],S=f?.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const h=S;if(!Array.isArray(h.variants))return;const A=[...h.variants],Y=A[r];if(!Y)return;const P=Mt(Y.rule,a,i),O=Jt(t);A[r]={...Y,rule:O};const $={...a,[s]:{...f,sections:{...h,variants:A}}},{resolveType:Re,formValue:z}=Ct(O,$,i??void 0);ye(Re),Q(z);try{await Ne.mutateAsync({blockKey:s,data:$[s]}),P&&P!==t&&await Pt(P,$),g?.()}catch(G){q.error(G instanceof Error?G.message:c("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}},Nn=t=>{ot.current&&clearTimeout(ot.current);const{selectedSectionIndex:s,sectionVariantIndex:a}=Xe.current;s!==null&&(ot.current=setTimeout(()=>{const{rawSections:r,parsedSections:f,decofile:S,activePageKey:h,pageVariants:A,variantIndex:Y}=Xe.current;if(!h)return;const P=r[s],O=f[s];if(!P||!O?.isMultivariate)return;const $=nt(P,O);if(!$)return;const z=($.variants??[])[a]?.rule;if(Et(z,S,i)){const be=z?.__resolveType??"",Qe=S[be],rt=typeof Qe?.name=="string"?Qe.name:be,{__resolveType:pt,...lt}=t;Ne.mutate({blockKey:be,data:Rt(pt??"",lt,rt)},{onSuccess:()=>g?.(),onError:gt=>q.error(c("sectionsEditor.sectionsEditor.saveFailed",{error:gt.message}))});return}const G=Hn($,a,t),Ie=[...r];Ie[s]=yt(P,O,G);const et=Kt(S,h,Ie,Y,A);Ne.mutate({blockKey:h,data:et},{onSuccess:()=>g?.(),onError:be=>q.error(c("sectionsEditor.sectionsEditor.saveFailed",{error:be.message}))})},Sn))},ha=t=>{We(t);const s=t?Un(t,i):{__resolveType:Gn};De(t?s:{}),Nn(s)},va=t=>{const s=t;De(s);const a=Ze?{__resolveType:Ze,...s}:{...s};Nn(a)},Sa=async t=>{jt();const{selectedSectionIndex:s,sectionVariantIndex:a,rawSections:r,parsedSections:f,decofile:S,activePageKey:h,pageVariants:A,variantIndex:Y}=Xe.current;if(s===null||!h)return;const P=r[s],O=f[s];if(!P||!O?.isMultivariate)return;const $=nt(P,O);if(!$)return;const Re=$.variants??[],z=Mt(Re[a]?.rule,S,i),G=Jt(t),Ie=Hn($,a,G),et=[...r];et[s]=yt(P,O,Ie);const be=Kt(S,h,et,Y,A),Qe={...S,[h]:be},{resolveType:rt,formValue:pt}=Ct(G,Qe,i??void 0);We(rt),De(pt);try{await Ne.mutateAsync({blockKey:h,data:be}),z&&z!==t&&await Pt(z,Qe),g?.()}catch(lt){q.error(lt instanceof Error?lt.message:c("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}};if(!Ae&&!Ye)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:c("sectionsEditor.sectionsEditor.noPageFound",{currentPath:x})});if(Ae&&!nn)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:c("sectionsEditor.sectionsEditor.globalBlockNotFound")});const mt=m!==null?He[m]??null:null,An=m!==null?H[m]:null,Pn=An&&mt?.isMultivariate?nt(An,mt):null,St=Pn?On(Pn,ht):[],fn=Math.min(Ve,Math.max(St.length-1,0)),Ht=St[fn]??null,ft=mt?.isMultivariate===!0,Cn=m!==null&&mt!==null,Ut=Cn&&(ft||!!(un&&we)),ba=Ut&&!Ae&&mt?.isSavedBlock===!0,it=Ae||ba,ya=Ae?En:mt?.label??"",xa=Ze&&i?qt(Ze,i):null,pn=Ut&&(!Ae||re.length>0)?Ae?[En,...re]:[Ye.name,mt.label,...ft&&Ht?[Ht.label]:[],...re]:[],_a=I&&Ye?[Ye.name,"SEO",...Te]:[],Gt=I?_a:it?pn.length>0?pn:[ya]:pn,ja=!I&&!Ae&&ft&&re.length===0,Mn=()=>{if(!E)return;jt(),ze.current&&(clearTimeout(ze.current),ze.current=null);const t=l[E],s=yo(t.sections,H);if(!s)return;const a=xo(s);Ne.mutate({blockKey:E,data:{...t,sections:s}},{onSuccess:()=>{B(a),C(null),N(null),T(null),K([]),Q(null),ye(null)},onError:r=>q.error(c("sectionsEditor.sectionsEditor.saveFailed",{error:r.message}))})},gn=(t,s,a)=>{if(!E)return;jt(),ze.current&&(clearTimeout(ze.current),ze.current=null);const r=l[E],f=r.sections;if(!f||typeof f!="object"||Array.isArray(f))return;const S=f;if(!Array.isArray(S.variants))return;const h=t([...S.variants]);if(!h)return;const A=Mo(S,h),Y={...l,[E]:{...r,sections:A}};Ne.mutate({blockKey:E,data:Y[E]},{onSuccess:()=>{s?.(),a&&Pt(a,Y)},onError:P=>q.error(c("sectionsEditor.sectionsEditor.saveFailed",{error:P.message}))})},Ea=t=>{xe(null),B(t),C(null),N(null),T(null),K([]);const s=Ge[t]?.rule,{resolveType:a,formValue:r}=Ct(s,l??{},i??void 0);ye(a),Q(r),ln(Ge.map(f=>({rule:f.rule})),t)},Ra=(t,s)=>{if(t===s)return;let a=Be;Be===t?a=s:t<Be&&s>=Be?a=Be-1:t>Be&&s<=Be&&(a=Be+1),B(a);const r=Lt(Ge.map(f=>({rule:f.rule})),t,s);ln(r,a),gn(f=>Lt(f,t,s))},wa=t=>{const s=Ge[t]?.rule,a=Mt(s,l??{},i??void 0);gn(r=>r.length<=1?null:(r.splice(t,1),r),()=>{Ge.length-1===1?B(0):t<Be?B(Be-1):t===Be&&B(Math.max(0,t-1)),C(null),N(null),T(null),K([]),Q(null),ye(null)},a)},ka=t=>{gn(s=>Ko(s,t),()=>{B(t+1),C(null),N(null),T(null),K([]),Q(null),ye(null)})},Ta=async(t,s)=>{jt(),ze.current&&(clearTimeout(ze.current),ze.current=null);const a=Xe.current.activePageKey,r=Xe.current.decofile;if(!a)return;const f=r[a],S=f.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const h=S;if(!Array.isArray(h.variants))return;const A=[...h.variants],Y=A[t];if(!Y?.rule||typeof Y.rule!="object"){q.error(c("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const P=Y.rule,O=s.trim();Ot(!0);try{if(!O){if(!Et(P,r,i)){xe(null);return}const et=P.__resolveType??"";A[t]={...Y,rule:qn(P,r,i)};const be={...r,[a]:{...f,sections:{...h,variants:A}}};await Ne.mutateAsync({blockKey:a,data:be[a]}),await Pt(et,be),xe(null),g?.();return}const $=Wn(P,r,i);if(!$){q.error(c("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if($.blockKey){await Ne.mutateAsync({blockKey:$.blockKey,data:Rt($.resolveType,$.data,O)}),xe(null),g?.();return}const Re=hn(O),z=vn(Re,r);if(z){q.error(z);return}const G=Rt($.resolveType,$.data,O);let Ie=null;try{await Ne.mutateAsync({blockKey:Re,data:G}),Ie=Re,A[t]={...Y,rule:Jt(Re)},await Ne.mutateAsync({blockKey:a,data:{...f,sections:{...h,variants:A}}}),Ie=null}catch(et){throw Ie&&await en.mutateAsync({blockKey:Ie}).catch(()=>{}),et}xe(null),q.success(c("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:O})),g?.()}catch($){q.error($ instanceof Error?$.message:c("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Ot(!1)}},Va=async(t,s)=>{jt(),ze.current&&(clearTimeout(ze.current),ze.current=null);const{selectedSectionIndex:a,rawSections:r,parsedSections:f,decofile:S,activePageKey:h,pageVariants:A,variantIndex:Y}=Xe.current;if(a===null||!h)return;const P=r[a],O=f[a];if(!P||!O?.isMultivariate)return;const $=nt(P,O);if(!$)return;const Re=$.variants??[],z=Re[t];if(!z?.rule||typeof z.rule!="object"){q.error(c("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const G=z.rule,Ie=s.trim();Ot(!0);const et=async be=>{const Qe={...$,variants:be},rt=[...r];rt[a]=yt(P,O,Qe);const pt=Kt(S,h,rt,Y,A);return await Ne.mutateAsync({blockKey:h,data:pt}),{...S,[h]:pt}};try{if(!Ie){if(!Et(G,S,i)){me(null);return}const gt=G.__resolveType??"",Bn=[...Re];Bn[t]={...z,rule:qn(G,S,i)};const Ca=await et(Bn);await Pt(gt,Ca),me(null),g?.();return}const be=Wn(G,S,i);if(!be){q.error(c("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(be.blockKey){await Ne.mutateAsync({blockKey:be.blockKey,data:Rt(be.resolveType,be.data,Ie)}),me(null),g?.();return}const Qe=hn(Ie),rt=vn(Qe,S);if(rt){q.error(rt);return}const pt=Rt(be.resolveType,be.data,Ie);let lt=null;try{await Ne.mutateAsync({blockKey:Qe,data:pt}),lt=Qe;const gt=[...Re];gt[t]={...z,rule:Jt(Qe)},await et(gt),lt=null}catch(gt){throw lt&&await en.mutateAsync({blockKey:lt}).catch(()=>{}),gt}me(null),q.success(c("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:Ie})),g?.()}catch(be){q.error(be instanceof Error?be.message:c("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Ot(!1)}},Kn=()=>{_t()},Da=t=>{Z(t),dn({inner:t})},Na=t=>{ve(t),dn({raw:t})},Aa=()=>{Z(null),_([])},Pa=()=>ae(t=>t+1),Ln=t=>{if(I){if(t===0){Xt.flush(),Ee(!1),Z(null),ve(void 0),_([]),ae(a=>a+1),L?.();return}if(t===1){_([]),ae(a=>a+1);return}_(Te.slice(0,t-1)),ae(a=>a+1);return}if(Ae){K(re.slice(0,t)),F(a=>a+1);return}if(t===0){Kn();return}if(t===1){K([]),F(a=>a+1);return}if(ft&&t===2){K([]),F(a=>a+1);return}const s=ft?2:1;K(re.slice(0,t-s))};return n.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[n.jsx("div",{className:"shrink-0",children:it||Ut||I?n.jsxs("div",{className:Ue("border-b px-3 py-2.5",it&&"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:[Gt.length>1&&n.jsx("button",{type:"button",onClick:()=>Ln(Lo(Gt.length,{isMultivariateSectionTop:ja})),title:c("sectionsEditor.sectionsEditor.back"),"aria-label":c("sectionsEditor.sectionsEditor.back"),className:Ue("shrink-0 inline-flex size-6 items-center justify-center rounded-md transition-colors",it?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:n.jsx($o,{className:"size-4"})}),!Ae&&Nt&&ut&&n.jsxs("button",{type:"button",onClick:Kn,title:c("sectionsEditor.sectionsEditor.editingInVariant",{variant:ut.label}),className:Ue("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",mo),children:[n.jsx(Ts,{rule:Bt(ut.rule,l??{},i??void 0),matchers:zt}),n.jsx("span",{className:"max-w-[160px] truncate",children:ut.label})]}),n.jsx("nav",{"aria-label":c("sectionsEditor.sectionsEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:Gt.map((t,s)=>{const a=s===Gt.length-1,r=fo(t);return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[s>0&&n.jsx(Uo,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>Ln(s),title:r,className:Ue("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",a?it?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":it?"text-foreground/80":"text-muted-foreground",it?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:r})]},`${r}-${s}`)})}),it&&n.jsxs(wt,{children:[n.jsx(kt,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(Go,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(Tt,{side:"bottom",className:"max-w-[260px]",children:c("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),Cn&&!ft&&!mt?.isHidden&&E&&n.jsx(Fn,{onClick:()=>mn()})]}),it&&n.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:c("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):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(po,{pageKey:E,initialName:Ye.name,initialPath:Ye.path,onFieldChange:Js})}),n.jsxs(wt,{children:[n.jsx(kt,{asChild:!0,children:n.jsx(tt,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>Ee(!0),children:n.jsx(zo,{size:14})})}),n.jsx(Tt,{side:"bottom",children:c("sectionsEditor.sectionsEditor.editSeo")})]}),n.jsxs(wt,{children:[n.jsx(kt,{asChild:!0,children:n.jsx(tt,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>M&&E?M():je(!0),children:n.jsx(Ho,{size:14})})}),n.jsx(Tt,{side:"bottom",children:c("sectionsEditor.sectionsEditor.viewJson")})]}),n.jsx(Fn,{onClick:Mn})]})}),I?n.jsx(Qt,{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:Ft&&E?n.jsx(ri,{rawSeo:an,innerSeo:Rn,defaultResolveType:$s,seoSchema:zs,activeResolveType:on,seoTypeOptions:Fs,formResetKey:Se,siteDefaultSeo:Hs,onBreadcrumbChange:_,onPersistRaw:Na,onInnerChange:Da,onClearForm:Aa,onBumpFormKey:Pa}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"):Ut?n.jsxs(Qt,{viewportRef:qe,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ft&&St.length>0&&re.length===0&&n.jsxs(n.Fragment,{children:[n.jsx(go,{listKey:`${E??""}:${m??""}`,variants:St.map((t,s)=>({index:s,label:t.label})),selectedIndex:fn,onSelect:oa,onRename:me,onDuplicate:ra,onDelete:ia,onRemoveAll:ca,onReorder:la,onAdd:()=>mn()}),ft&&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:c("sectionsEditor.sectionsEditor.variantRule")}),n.jsx(Xn,{currentRt:Ze??"",currentLabel:Yt(Ht?.rule,l??{},ht,i??void 0),currentGlobalKey:Mt(Ht?.rule,l??{},i??void 0)??void 0,matchers:zt,globals:Vn,onSelect:ha,onSelectGlobal:Sa,schema:xa,formValue:ct,onChange:va,formKey:`${m??"none"}:${fn}:${Ze??""}`,formWrapperClassName:"pt-1",meta:i??void 0,decofile:l,onSaveReferencedBlock:It,sandbox:$t})]})]}),n.jsx($n,{activeSchema:un,formValue:we,formResetKey:ke,onFormChange:wn,onBreadcrumbChange:K,breadcrumbPath:re,emptyMessage:c("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:i,decofile:l,onSaveReferencedBlock:It,sandbox:$t,previewBaseUrl:J,onRequestAddSection:kn})]},"editor-section-form"):Ae?n.jsx(Qt,{viewportRef:qe,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx($n,{activeSchema:un,formValue:we,formResetKey:ke,onFormChange:wn,onBreadcrumbChange:K,breadcrumbPath:re,emptyMessage:c("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:i,decofile:l,onSaveReferencedBlock:It,sandbox:$t,previewBaseUrl:J,onRequestAddSection:kn})},"editor-global-block"):n.jsxs(Qt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[Nt&&E&&n.jsx(Ii,{listKey:E,variants:Ge,activeIndex:Be,decofile:l??{},meta:i,matchers:zt,onSelect:Ea,onReorder:Ra,onRename:xe,onDuplicate:ka,onDelete:wa,onAdd:Mn}),Nt&&ie!==null&&n.jsxs("div",{className:Ue("px-3 border-b",_e?"pt-3 pb-5 space-y-3":"py-2"),children:[n.jsxs("button",{type:"button",onClick:()=>fe(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":_e,children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:c("sectionsEditor.sectionsEditor.variantRule")}),_e?n.jsx(Bo,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(Io,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),_e&&n.jsx("div",{className:Ue("space-y-3",Dt&&"pointer-events-none opacity-50"),children:n.jsx(Xn,{currentRt:ie,currentLabel:Yt(ut?.rule,l??{},ht,i??void 0),currentGlobalKey:Mt(ut?.rule,l??{},i??void 0)??void 0,matchers:zt,globals:Vn,onSelect:fa,onSelectGlobal:ga,schema:ma,formValue:de,onChange:pa,formKey:`${Be}:${ie??""}`,formWrapperClassName:"space-y-3",meta:i??void 0,decofile:l,onSaveReferencedBlock:It,sandbox:$t})})]}),n.jsx("div",{className:"p-2 pt-3",children:n.jsx(Di,{listKey:`${E??""}-${Be}`,rawSections:H,sections:He,meta:i,selectedIndex:m,onSelect:Ys,onReorder:Qs,onDelete:Zs,onDuplicate:Xs,onMakeReusable:Fe,onToggleHidden:ea,onToggleLazy:ta,onAddVariant:mn,onDetach:na,onAddSection:()=>se(!0),canAddSection:da})})]},"editor-section-list"),n.jsx(ho,{open:te!==null,onOpenChange:t=>{t||Fe(null)},defaultBlockId:te!==null?hn(He[te]?.label??""):"",isPending:Ne.isPending,onSubmit:ua}),J&&n.jsx(di,{open:pe,onOpenChange:t=>{se(t),t||(le.current=null)},meta:i,decofile:l,previewBaseUrl:J,onSelect:aa}),Me&&E&&l&&n.jsx(vo,{open:Me,onOpenChange:je,pageKey:E,decofile:l}),Ce!==null&&n.jsx(Jn,{open:!0,initialName:Et(Ge[Ce]?.rule,l??{},i??void 0)?Yt(Ge[Ce]?.rule,l??{},ht,i??void 0):"",autoLabel:ht(Bt(Ge[Ce]?.rule,l??{},i??void 0)),isPending:Dt,onSubmit:async t=>{await Ta(Ce,t)},onOpenChange:t=>{!t&&!Dt&&xe(null)}}),ne!==null&&n.jsx(Jn,{open:!0,initialName:Et(St[ne]?.rule,l??{},i??void 0)?Yt(St[ne]?.rule,l??{},ht,i??void 0):"",autoLabel:ht(Bt(St[ne]?.rule,l??{},i??void 0)),isPending:Dt,onSubmit:async t=>{await Va(ne,t)},onOpenChange:t=>{!t&&!Dt&&me(null)}})]})}export{Uc as SectionsEditor};
@@ -1,4 +1,4 @@
1
- import{r as B,aB as mt,c as Y,b as ie,j as s,dp as Ee,dq as Oe,dr as We,G as ge,a7 as we,n as ke,ar as Ve,aq as He,e as Se,ae as qe,ag as be,K as ce,t as le,B as oe,o as ne,h as Ae,l as re,m as ft,b4 as ee,d as pt,E as xt,C as gt,J as vt}from"./index-C7u2w8im.js";import{e as Ge,D as Ye,b as Xe,c as bt,d as Qe,h as yt,a as jt}from"./dialog-BlB1oPAX.js";import{d as St,b as Nt,a as wt,D as kt}from"./drawer-B2Flggz5.js";import{u as Je}from"./chat-context-DSLAO8uW.js";import{C as _t}from"./checkbox-BTII6vZ1.js";import{I as xe}from"./input-2HCKYLBl.js";import{S as Ct,b as It,a as Mt,d as Et,c as Ot}from"./select-DY4qFYM1.js";import{i as Ze}from"./ArrowLeft-DapVDMlF.js";import{i as At}from"./ChevronSelectorVertical-DEQF3ahU.js";import{i as Pt}from"./Key01-Su7Ri3QM.js";import{i as et,b as Tt,a as Lt,s as zt}from"./Settings02-BvQ_eSu2.js";import{i as tt}from"./SearchMd-C1nQWOES.js";import{f as _e,u as Ft,b as Rt}from"./use-ai-providers-BdmZTHBo.js";import{g as Ce}from"./ai-providers-logos-DD3qZ33J.js";import{i as Pe}from"./Monitor01-QzeWQOup.js";import{i as Kt}from"./AlertCircle-CMlBVqcJ.js";import{i as Dt}from"./ChevronRight-Dc6YgNL3.js";import{A as $t}from"./avatar-CYcyP0Bi.js";import{s as st}from"./Eye-j-Wp3Gab.js";import{i as Ut,a as Bt,D as Wt}from"./thread-route-CmMSB6Sw.js";import{u as Vt}from"./use-is-desktop-app-BNujXJc_.js";import{b as Ht,i as qt}from"./Tool01-DoPMT_Jz.js";import{t as Te}from"./ChevronUp-I74YujLg.js";import{a as Gt}from"./Image01-CyO6q_ld.js";import{t as Yt}from"./Stars01-Bj8unbS8.js";function pe(n,e,t){let i=t.initialDeps??[],o,l=!0;function c(){var r,h,d;let a;t.key&&((r=t.debug)!=null&&r.call(t))&&(a=Date.now());const f=n();if(!(f.length!==i.length||f.some((m,b)=>i[b]!==m)))return o;i=f;let u;if(t.key&&((h=t.debug)!=null&&h.call(t))&&(u=Date.now()),o=e(...f),t.key&&((d=t.debug)!=null&&d.call(t))){const m=Math.round((Date.now()-a)*100)/100,b=Math.round((Date.now()-u)*100)/100,w=b/16,N=(j,_)=>{for(j=String(j);j.length<_;)j=" "+j;return j};console.info(`%c⏱ ${N(b,5)} /${N(m,5)} ms`,`
1
+ import{r as B,aB as mt,c as Y,b as ie,j as s,dp as Ee,dq as Oe,dr as We,G as ge,a7 as we,n as ke,ar as Ve,aq as He,e as Se,ae as qe,ag as be,K as ce,t as le,B as oe,o as ne,h as Ae,l as re,m as ft,b4 as ee,d as pt,E as xt,C as gt,J as vt}from"./index-B0enqYLp.js";import{e as Ge,D as Ye,b as Xe,c as bt,d as Qe,h as yt,a as jt}from"./dialog-BA4FD5Sq.js";import{d as St,b as Nt,a as wt,D as kt}from"./drawer-DX1BxggI.js";import{u as Je}from"./chat-context-D8T0rW9d.js";import{C as _t}from"./checkbox-DSgzJ8_Q.js";import{I as xe}from"./input-B7-ag8lD.js";import{S as Ct,b as It,a as Mt,d as Et,c as Ot}from"./select-thbOXdV2.js";import{i as Ze}from"./ArrowLeft-BHwfW5cf.js";import{i as At}from"./ChevronSelectorVertical-DtIJci2m.js";import{i as Pt}from"./Key01-DRprtLXT.js";import{i as et,b as Tt,a as Lt,s as zt}from"./Settings02-Bc36uad8.js";import{i as tt}from"./SearchMd-g9_sGeM-.js";import{f as _e,u as Ft,b as Rt}from"./use-ai-providers-DIlvL3Di.js";import{g as Ce}from"./ai-providers-logos-DD3qZ33J.js";import{i as Pe}from"./Monitor01-BRIx8sMl.js";import{i as Kt}from"./AlertCircle-BLN57WMf.js";import{i as Dt}from"./ChevronRight-kI7jYbzz.js";import{A as $t}from"./avatar-DAPjgS7A.js";import{s as st}from"./Eye-hIqh4Fwi.js";import{i as Ut,a as Bt,D as Wt}from"./thread-route-BZeJeEya.js";import{u as Vt}from"./use-is-desktop-app-BNujXJc_.js";import{b as Ht,i as qt}from"./Tool01-CNcRCczc.js";import{t as Te}from"./ChevronUp-DeObbE8r.js";import{a as Gt}from"./Image01-Bz13pb-k.js";import{t as Yt}from"./Stars01-KRoJkXtX.js";function pe(n,e,t){let i=t.initialDeps??[],o,l=!0;function c(){var r,h,d;let a;t.key&&((r=t.debug)!=null&&r.call(t))&&(a=Date.now());const f=n();if(!(f.length!==i.length||f.some((m,b)=>i[b]!==m)))return o;i=f;let u;if(t.key&&((h=t.debug)!=null&&h.call(t))&&(u=Date.now()),o=e(...f),t.key&&((d=t.debug)!=null&&d.call(t))){const m=Math.round((Date.now()-a)*100)/100,b=Math.round((Date.now()-u)*100)/100,w=b/16,N=(j,_)=>{for(j=String(j);j.length<_;)j=" "+j;return j};console.info(`%c⏱ ${N(b,5)} /${N(m,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*w,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(l&&t.skipInitialOnChange)&&t.onChange(o),l=!1,o}return c.updateDeps=r=>{i=r},c}function Le(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const Xt=(n,e)=>Math.abs(n-e)<1.01,Qt=(n,e,t)=>{let i;return function(...o){n.clearTimeout(i),i=n.setTimeout(()=>e.apply(this,o),t)}},ze=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},Jt=n=>n,Zt=n=>{const e=Math.max(n.startIndex-n.overscan,0),t=Math.min(n.endIndex+n.overscan,n.count-1),i=[];for(let o=e;o<=t;o++)i.push(o);return i},es=(n,e)=>{const t=n.scrollElement;if(!t)return;const i=n.targetWindow;if(!i)return;const o=c=>{const{width:r,height:h}=c;e({width:Math.round(r),height:Math.round(h)})};if(o(ze(t)),!i.ResizeObserver)return()=>{};const l=new i.ResizeObserver(c=>{const r=()=>{const h=c[0];if(h?.borderBoxSize){const d=h.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(ze(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return l.observe(t,{box:"border-box"}),()=>{l.unobserve(t)}},Fe={passive:!0},Re=typeof window>"u"?!0:"onscrollend"in window,ts=(n,e)=>{const t=n.scrollElement;if(!t)return;const i=n.targetWindow;if(!i)return;let o=0;const l=n.options.useScrollendEvent&&Re?()=>{}:Qt(i,()=>{e(o,!1)},n.options.isScrollingResetDelay),c=a=>()=>{const{horizontal:f,isRtl:p}=n.options;o=f?t.scrollLeft*(p&&-1||1):t.scrollTop,l(),e(o,a)},r=c(!0),h=c(!1);t.addEventListener("scroll",r,Fe);const d=n.options.useScrollendEvent&&Re;return d&&t.addEventListener("scrollend",h,Fe),()=>{t.removeEventListener("scroll",r),d&&t.removeEventListener("scrollend",h)}},ss=(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"]},is=(n,{adjustments:e=0,behavior:t},i)=>{var o,l;const c=n+e;(l=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||l.call(o,{[i.options.horizontal?"left":"top"]:c,behavior:t})};class ns{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,o;return((o=(i=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let t=null;const i=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(o=>{o.forEach(l=>{const c=()=>{const r=l.target,h=this.indexFromElement(r);if(!r.isConnected){this.observer.unobserve(r);return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(r,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),t=null},observe:o=>{var l;return(l=i())==null?void 0:l.observe(o,{box:"border-box"})},unobserve:o=>{var l;return(l=i())==null?void 0:l.unobserve(o)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([i,o])=>{typeof o>"u"&&delete t[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Jt,rangeExtractor:Zt,onChange:()=>{},measureElement:ss,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,o;(o=(i=this.options).onChange)==null||o.call(i,this,t)},this.maybeNotify=pe(()=>(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(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,l)=>{this.scrollAdjustments=0,this.scrollDirection=l?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=l,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 o=new Map,l=new Map;for(let c=i-1;c>=0;c--){const r=t[c];if(o.has(r.lane))continue;const h=l.get(r.lane);if(h==null||r.end>h.end?l.set(r.lane,r):r.end<h.end&&o.set(r.lane,!0),o.size===this.options.lanes)break}return l.size===this.options.lanes?Array.from(l.values()).sort((c,r)=>c.end===r.end?c.index-r.index:c.end-r.end)[0]:void 0},this.getMeasurementOptions=pe(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,i,o,l,c,r,h)=>(this.prevLanes!==void 0&&this.prevLanes!==r&&(this.lanesChangedFlag=!0),this.prevLanes=r,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:c,lanes:r,laneAssignmentMode:h}),{key:!1}),this.getMeasurements=pe(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:c,lanes:r,laneAssignmentMode:h},d)=>{if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const u of this.laneAssignments.keys())u>=t&&this.laneAssignments.delete(u);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(u=>{this.itemSizeCache.set(u.key,u.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 f=this.measurementsCache.slice(0,a),p=new Array(r).fill(void 0);for(let u=0;u<a;u++){const m=f[u];m&&(p[m.lane]=u)}for(let u=a;u<t;u++){const m=l(u),b=this.laneAssignments.get(u);let w,N;const j=h==="estimate"||d.has(m);if(b!==void 0&&this.options.lanes>1){w=b;const k=p[w],x=k!==void 0?f[k]:void 0;N=x?x.end+this.options.gap:i+o}else{const k=this.options.lanes===1?f[u-1]:this.getFurthestMeasurement(f,u);N=k?k.end+this.options.gap:i+o,w=k?k.lane:u%this.options.lanes,this.options.lanes>1&&j&&this.laneAssignments.set(u,w)}const _=d.get(m),I=typeof _=="number"?_:this.options.estimateSize(u),A=N+I;f[u]={index:u,start:N,size:I,end:A,key:m,lane:w},p[w]=u}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=pe(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,i,o,l)=>this.range=t.length>0&&i>0?ls({measurements:t,outerSize:i,scrollOffset:o,lanes:l}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=pe(()=>{let t=null,i=null;const o=this.calculateRange();return o&&(t=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,i]},(t,i,o,l,c)=>l===null||c===null?[]:t({startIndex:l,endIndex:c,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const i=this.options.indexAttribute,o=t.getAttribute(i);return o?parseInt(o,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 o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,o-l),r=Math.min(this.options.count-1,o+l);return t>=c&&t<=r}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((c,r)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(r))});return}const i=this.indexFromElement(t),o=this.options.getItemKey(i),l=this.elementsCache.get(o);l!==t&&(l&&this.observer.unobserve(l),this.observer.observe(t),this.elementsCache.set(o,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,i)=>{var o;const l=this.measurementsCache[t];if(!l)return;const c=this.itemSizeCache.get(l.key)??l.size,r=i-c;r!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(l,r,this):l.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(l.index),this.itemSizeCache=new Map(this.itemSizeCache.set(l.key,i)),this.notify(!1))},this.getVirtualItems=pe(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,i)=>{const o=[];for(let l=0,c=t.length;l<c;l++){const r=t[l],h=i[r];o.push(h)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const i=this.getMeasurements();if(i.length!==0)return Le(i[it(0,i.length-1,o=>Le(i[o]).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,o=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),c=this.getScrollOffset();i==="auto"&&(i=t>=c+l?"end":"start"),i==="center"?t+=(o-l)/2:i==="end"&&(t-=l);const r=this.getMaxScrollOffset();return Math.max(Math.min(r,t),0)},this.getOffsetForIndex=(t,i="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getSize(),l=this.getScrollOffset(),c=this.measurementsCache[t];if(!c)return;if(i==="auto")if(c.end>=l+o-this.options.scrollPaddingEnd)i="end";else if(c.start<=l+this.options.scrollPaddingStart)i="start";else return[l,i];if(i==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),i];const r=i==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(r,i,c.size),i]},this.scrollToOffset=(t,{align:i="start",behavior:o="auto"}={})=>{const l=this.getOffsetForAlignment(t,i),c=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:c,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:i="auto",behavior:o="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const l=this.getOffsetForIndex(t,i);if(!l)return;const[c,r]=l,h=this.now();this.scrollState={index:t,align:r,behavior:o,startedAt:h,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+t,l=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((t=i[i.length-1])==null?void 0:t.end)??0;else{const l=Array(this.options.lanes).fill(null);let c=i.length-1;for(;c>=0&&l.some(r=>r===null);){const r=i[c];l[r.lane]===null&&(l[r.lane]=r.end),c--}o=Math.max(...l.filter(r=>r!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:i,behavior:o})=>{this.options.scrollToFn(t,{behavior:o,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,o=i?i[0]:this.scrollState.lastTargetOffset,l=1,c=o!==this.scrollState.lastTargetOffset;if(!c&&Xt(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.scrollState=null;return}}else this.scrollState.stableFrames=0,c&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const it=(n,e,t,i)=>{for(;n<=e;){const o=(n+e)/2|0,l=t(o);if(l<i)n=o+1;else if(l>i)e=o-1;else return o}return n>0?n-1:0};function ls({measurements:n,outerSize:e,scrollOffset:t,lanes:i}){const o=n.length-1,l=h=>n[h].start;if(n.length<=i)return{startIndex:0,endIndex:o};let c=it(0,o,l,t),r=c;if(i===1)for(;r<o&&n[r].end<t+e;)r++;else if(i>1){const h=Array(i).fill(0);for(;r<o&&h.some(a=>a<t+e);){const a=n[r];h[a.lane]=a.end,r++}const d=Array(i).fill(t+e);for(;c>=0&&d.some(a=>a>=t);){const a=n[c];d[a.lane]=a.start,c--}c=Math.max(0,c-c%i),r=Math.min(o,r+(i-1-r%i))}return{startIndex:c,endIndex:r}}const Ke=typeof document<"u"?B.useLayoutEffect:B.useEffect;function os({useFlushSync:n=!0,...e}){const t=B.useReducer(()=>({}),{})[1],i={...e,onChange:(l,c)=>{var r;n&&c?mt.flushSync(t):t(),(r=e.onChange)==null||r.call(e,l,c)}},[o]=B.useState(()=>new ns(i));return o.setOptions(i),Ke(()=>o._didMount(),[]),Ke(()=>o._willUpdate()),o}function rs(n){return os({observeElementRect:es,observeElementOffset:ts,scrollToFn:is,...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 ye(n){if(n)return nt.find(e=>e.id===n)}const De=4;function ve(n){const e=Y.c(8),{logo:t,name:i,description:o,onClick:l}=n;let c;e[0]!==t||e[1]!==i?(c=t?s.jsx("img",{src:t,alt:i,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx($t,{fallback:i.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=i,e[2]=c):c=e[2];let r;return e[3]!==o||e[4]!==i||e[5]!==l||e[6]!==c?(r=s.jsx(We,{onClick:l,icon:c,title:i,description:o}),e[3]=o,e[4]=i,e[5]=l,e[6]=c,e[7]=r):r=e[7],r}function lt(n){const e=Y.c(38),{providers:t,onSelect:i,onShowAll:o}=n,l=ie();let c;e[0]!==t?(c=t.find(hs),e[0]=t,e[1]=c):c=e[1];const r=c;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={openrouter:0,llmapi:1,anthropic:2,google:3},e[2]=h):h=e[2];const d=h;let a;if(e[3]!==i||e[4]!==t||e[5]!==l){let I;e[7]===Symbol.for("react.memo_cache_sentinel")?(I=(y,E)=>{const z=d[y.id]??Number.MAX_SAFE_INTEGER,P=d[E.id]??Number.MAX_SAFE_INTEGER;return z-P},e[7]=I):I=e[7];const A=t.filter(ds).sort(I);let k;e[8]!==t?(k=t.find(cs),e[8]=t,e[9]=k):k=e[9];const x=k;let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=ye("openai"),e[10]=S):S=e[10];const C=S;let M;e[11]!==i?(M=y=>s.jsx(ve,{logo:y.logo,name:y.name,description:y.description,onClick:()=>i({kind:"provider",provider:y})},y.id),e[11]=i,e[12]=M):M=e[12];let g;e[13]!==i||e[14]!==x?(g=x&&C?[s.jsx(ve,{logo:C.logo,name:C.name,description:C.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:C})},C.id)]:[],e[13]=i,e[14]=x,e[15]=g):g=e[15];let v;e[16]!==i||e[17]!==x||e[18]!==l?(v=x?[...nt.filter(as).map(y=>s.jsx(ve,{logo:y.logo,name:y.name,description:y.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:y})},y.id)),s.jsx(ve,{logo:x.logo,name:l("settings.aiProviders.customOpenAiCompatible"),description:l("settings.aiProviders.customOpenAiDescription"),onClick:()=>i({kind:"openai-compatible",provider:x,preset:null})},"custom")]:[],e[16]=i,e[17]=x,e[18]=l,e[19]=v):v=e[19],a=[...A.map(M),...g,...v],e[3]=i,e[4]=t,e[5]=l,e[6]=a}else a=e[6];const f=a,p=f.length-De,u=!!o&&p>0;let m;e[20]!==f||e[21]!==u?(m=u?f.slice(0,De):f,e[20]=f,e[21]=u,e[22]=m):m=e[22];const b=m;let w;e[23]!==r||e[24]!==i||e[25]!==l?(w=r&&s.jsx(Ee,{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:l("settings.aiProviders.recommended")}),s.jsx(Oe,{className:"relative",children:s.jsx(ve,{logo:r.logo,name:r.name,description:r.description,onClick:()=>i({kind:"provider",provider:r})})})]})}),e[23]=r,e[24]=i,e[25]=l,e[26]=w):w=e[26];let N;e[27]!==p||e[28]!==o||e[29]!==u||e[30]!==l?(N=u&&s.jsx(We,{onClick:o,title:l(p===1?"settings.aiProviders.moreProvidersSingular":"settings.aiProviders.moreProvidersPlural",{count:p}),action:s.jsx(Dt,{size:16,className:"text-muted-foreground"})}),e[27]=p,e[28]=o,e[29]=u,e[30]=l,e[31]=N):N=e[31];let j;e[32]!==N||e[33]!==b?(j=s.jsx(Ee,{children:s.jsxs(Oe,{children:[b,N]})}),e[32]=N,e[33]=b,e[34]=j):j=e[34];let _;return e[35]!==w||e[36]!==j?(_=s.jsxs("div",{className:"flex flex-col gap-6",children:[w,j]}),e[35]=w,e[36]=j,e[37]=_):_=e[37],_}function as(n){return n.id!=="openai"}function cs(n){return n.id==="openai-compatible"}function ds(n){return n.id!=="deco"&&n.id!=="openai-compatible"}function hs(n){return n.id==="deco"}function us(n){return qe({label:be().optional(),apiKey:be().min(1,n)})}function ms(n){const e=Y.c(91),{providerId:t,onCancel:i,onSuccess:o}=n,{org:l}=ge(),c=we(),r=ke(),[h,d]=B.useState(!1),a=ie();let f;e[0]!==a?(f=Ve(us(a("settings.connectForms.apiKeyRequired"))),e[0]=a,e[1]=f):f=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p={label:"",apiKey:""},e[2]=p):p=e[2];let u;e[3]!==f?(u={resolver:f,defaultValues:p},e[3]=f,e[4]=u):u=e[4];const{register:m,handleSubmit:b,formState:w}=He(u),{errors:N}=w;let j;e[5]!==t||e[6]!==c||e[7]!==a?(j=async se=>{await c.call("AI_PROVIDER_KEY_CREATE",{providerId:t,label:se.label||a("settings.connectForms.defaultKeyLabel"),apiKey:se.apiKey})},e[5]=t,e[6]=c,e[7]=a,e[8]=j):j=e[8];let _;e[9]!==o||e[10]!==l||e[11]!==r||e[12]!==a?(_=()=>{r.invalidateQueries({queryKey:ce.aiProviderKeys(l.id)}),r.invalidateQueries({queryKey:ce.aiProviders(l.id)}),le.success(a("settings.connectForms.keySavedSuccess")),o()},e[9]=o,e[10]=l,e[11]=r,e[12]=a,e[13]=_):_=e[13];let I;e[14]!==a?(I=se=>{le.error(a("settings.connectForms.failedSaveKey",{error:se.message}))},e[14]=a,e[15]=I):I=e[15];let A;e[16]!==j||e[17]!==_||e[18]!==I?(A={mutationFn:j,onSuccess:_,onError:I},e[16]=j,e[17]=_,e[18]=I,e[19]=A):A=e[19];const{mutate:k,isPending:x,error:S}=Se(A);let C;e[20]!==k?(C=se=>k(se),e[20]=k,e[21]=C):C=e[21];let M;e[22]!==b||e[23]!==C?(M=b(C),e[22]=b,e[23]=C,e[24]=M):M=e[24];let g;e[25]!==a?(g=a("settings.connectForms.labelField"),e[25]=a,e[26]=g):g=e[26];let v;e[27]!==g?(v=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:g}),e[27]=g,e[28]=v):v=e[28];let y;e[29]!==a?(y=a("settings.connectForms.labelPlaceholder"),e[29]=a,e[30]=y):y=e[30];let E;e[31]!==m?(E=m("label"),e[31]=m,e[32]=E):E=e[32];let z;e[33]!==y||e[34]!==E?(z=s.jsx(xe,{placeholder:y,...E,className:"h-8 text-sm"}),e[33]=y,e[34]=E,e[35]=z):z=e[35];let P;e[36]!==v||e[37]!==z?(P=s.jsxs("div",{className:"space-y-1",children:[v,z]}),e[36]=v,e[37]=z,e[38]=P):P=e[38];let O;e[39]!==a?(O=a("settings.connectForms.apiKeyField"),e[39]=a,e[40]=O):O=e[40];let T;e[41]!==O?(T=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:O}),e[41]=O,e[42]=T):T=e[42];const R=h?"text":"password";let F;e[43]!==m?(F=m("apiKey"),e[43]=m,e[44]=F):F=e[44];let K;e[45]!==R||e[46]!==F?(K=s.jsx(xe,{type:R,placeholder:"sk-...",...F,className:"ph-no-capture h-8 text-sm pr-8"}),e[45]=R,e[46]=F,e[47]=K):K=e[47];let Q;e[48]!==h?(Q=()=>d(!h),e[48]=h,e[49]=Q):Q=e[49];let V;e[50]!==h||e[51]!==a?(V=a(h?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[50]=h,e[51]=a,e[52]=V):V=e[52];let q;e[53]!==h?(q=h?s.jsx(et,{size:14}):s.jsx(st,{size:14}),e[53]=h,e[54]=q):q=e[54];let H;e[55]!==Q||e[56]!==V||e[57]!==q?(H=s.jsx("button",{type:"button",onClick:Q,"aria-label":V,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:q}),e[55]=Q,e[56]=V,e[57]=q,e[58]=H):H=e[58];let J;e[59]!==K||e[60]!==H?(J=s.jsxs("div",{className:"relative",children:[K,H]}),e[59]=K,e[60]=H,e[61]=J):J=e[61];let $;e[62]!==N.apiKey?($=N.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:N.apiKey.message}),e[62]=N.apiKey,e[63]=$):$=e[63];let U;e[64]!==T||e[65]!==J||e[66]!==$?(U=s.jsxs("div",{className:"space-y-1",children:[T,J,$]}),e[64]=T,e[65]=J,e[66]=$,e[67]=U):U=e[67];let X;e[68]!==S?(X=S&&s.jsx("p",{className:"text-xs text-destructive",children:S.message}),e[68]=S,e[69]=X):X=e[69];let L;e[70]!==a?(L=a("settings.connectForms.cancel"),e[70]=a,e[71]=L):L=e[71];let D;e[72]!==x||e[73]!==i||e[74]!==L?(D=s.jsx(oe,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:x,children:L}),e[72]=x,e[73]=i,e[74]=L,e[75]=D):D=e[75];let W;e[76]!==x||e[77]!==a?(W=a(x?"settings.connectForms.saving":"settings.connectForms.saveKey"),e[76]=x,e[77]=a,e[78]=W):W=e[78];let G;e[79]!==x||e[80]!==W?(G=s.jsx(oe,{type:"submit",size:"sm",disabled:x,children:W}),e[79]=x,e[80]=W,e[81]=G):G=e[81];let Z;e[82]!==D||e[83]!==G?(Z=s.jsxs(Ge,{children:[D,G]}),e[82]=D,e[83]=G,e[84]=Z):Z=e[84];let te;return e[85]!==M||e[86]!==P||e[87]!==U||e[88]!==X||e[89]!==Z?(te=s.jsxs("form",{onSubmit:M,className:"space-y-3",children:[P,U,X,Z]}),e[85]=M,e[86]=P,e[87]=U,e[88]=X,e[89]=Z,e[90]=te):te=e[90],te}function fs(n){return qe({label:be().optional(),baseUrl:be().min(1,n),apiKey:be().optional()})}function ps(n){const e=Y.c(109),{preset:t,onCancel:i,onSuccess:o}=n,{org:l}=ge(),c=we(),r=ke(),[h,d]=B.useState(!1),a=ie();let f;e[0]!==a?(f=Ve(fs(a("settings.connectForms.baseUrlRequired"))),e[0]=a,e[1]=f):f=e[1];const p=t?.defaultBaseUrl??"";let u;e[2]!==p?(u={label:"",baseUrl:p,apiKey:""},e[2]=p,e[3]=u):u=e[3];let m;e[4]!==f||e[5]!==u?(m={resolver:f,defaultValues:u},e[4]=f,e[5]=u,e[6]=m):m=e[6];const{register:b,handleSubmit:w,formState:N}=He(m),{errors:j}=N;let _;e[7]!==t||e[8]!==c?(_=async ae=>{const ut=JSON.stringify({baseUrl:ae.baseUrl,apiKey:ae.apiKey||""});await c.call("AI_PROVIDER_KEY_CREATE",{providerId:"openai-compatible",label:ae.label||t?.name||ae.baseUrl,apiKey:ut,...t?{presetId:t.id}:{}})},e[7]=t,e[8]=c,e[9]=_):_=e[9];let I;e[10]!==o||e[11]!==l||e[12]!==r||e[13]!==a?(I=()=>{r.invalidateQueries({queryKey:ce.aiProviderKeys(l.id)}),r.invalidateQueries({queryKey:ce.aiProviders(l.id)}),le.success(a("settings.connectForms.connectionSavedSuccess")),o()},e[10]=o,e[11]=l,e[12]=r,e[13]=a,e[14]=I):I=e[14];let A;e[15]!==a?(A=ae=>{le.error(a("settings.connectForms.failedSaveConnection",{error:ae.message}))},e[15]=a,e[16]=A):A=e[16];let k;e[17]!==_||e[18]!==I||e[19]!==A?(k={mutationFn:_,onSuccess:I,onError:A},e[17]=_,e[18]=I,e[19]=A,e[20]=k):k=e[20];const{mutate:x,isPending:S,error:C}=Se(k);let M;e[21]!==t||e[22]!==a?(M=t?a("settings.connectForms.labelPlaceholderPreset",{name:t.name}):a("settings.connectForms.labelPlaceholderOpenAiCompatible"),e[21]=t,e[22]=a,e[23]=M):M=e[23];const g=M;let v;e[24]!==t?.baseUrlPlaceholder||e[25]!==a?(v=t?.baseUrlPlaceholder??a("settings.connectForms.baseUrlPlaceholder"),e[24]=t?.baseUrlPlaceholder,e[25]=a,e[26]=v):v=e[26];const y=v;let E;e[27]!==x?(E=ae=>x(ae),e[27]=x,e[28]=E):E=e[28];let z;e[29]!==w||e[30]!==E?(z=w(E),e[29]=w,e[30]=E,e[31]=z):z=e[31];let P;e[32]!==a?(P=a("settings.connectForms.labelField"),e[32]=a,e[33]=P):P=e[33];let O;e[34]!==P?(O=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:P}),e[34]=P,e[35]=O):O=e[35];let T;e[36]!==b?(T=b("label"),e[36]=b,e[37]=T):T=e[37];let R;e[38]!==g||e[39]!==T?(R=s.jsx(xe,{placeholder:g,...T,className:"h-8 text-sm"}),e[38]=g,e[39]=T,e[40]=R):R=e[40];let F;e[41]!==O||e[42]!==R?(F=s.jsxs("div",{className:"space-y-1",children:[O,R]}),e[41]=O,e[42]=R,e[43]=F):F=e[43];let K;e[44]!==y||e[45]!==j||e[46]!==t?.defaultBaseUrl||e[47]!==b||e[48]!==a?(K=t?.defaultBaseUrl?s.jsx("input",{type:"hidden",...b("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(xe,{type:"url",placeholder:y,...b("baseUrl"),className:"h-8 text-sm"}),j.baseUrl&&s.jsx("p",{className:"text-xs text-destructive",children:j.baseUrl.message})]}),e[44]=y,e[45]=j,e[46]=t?.defaultBaseUrl,e[47]=b,e[48]=a,e[49]=K):K=e[49];let Q;e[50]!==a?(Q=a("settings.connectForms.apiKeyField"),e[50]=a,e[51]=Q):Q=e[51];let V;e[52]!==t?.apiKeyRecommended||e[53]!==a?(V=t?.apiKeyRecommended?a("settings.connectForms.recommended"):a("settings.connectForms.optional"),e[52]=t?.apiKeyRecommended,e[53]=a,e[54]=V):V=e[54];let q;e[55]!==V?(q=s.jsxs("span",{className:"text-muted-foreground/60",children:["(",V,")"]}),e[55]=V,e[56]=q):q=e[56];let H;e[57]!==Q||e[58]!==q?(H=s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[Q," ",q]}),e[57]=Q,e[58]=q,e[59]=H):H=e[59];const J=h?"text":"password";let $;e[60]!==b?($=b("apiKey"),e[60]=b,e[61]=$):$=e[61];let U;e[62]!==J||e[63]!==$?(U=s.jsx(xe,{type:J,placeholder:"sk-...",...$,className:"ph-no-capture h-8 text-sm pr-8"}),e[62]=J,e[63]=$,e[64]=U):U=e[64];let X;e[65]!==h?(X=()=>d(!h),e[65]=h,e[66]=X):X=e[66];let L;e[67]!==h||e[68]!==a?(L=a(h?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[67]=h,e[68]=a,e[69]=L):L=e[69];let D;e[70]!==h?(D=h?s.jsx(et,{size:14}):s.jsx(st,{size:14}),e[70]=h,e[71]=D):D=e[71];let W;e[72]!==X||e[73]!==L||e[74]!==D?(W=s.jsx("button",{type:"button",onClick:X,"aria-label":L,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:D}),e[72]=X,e[73]=L,e[74]=D,e[75]=W):W=e[75];let G;e[76]!==U||e[77]!==W?(G=s.jsxs("div",{className:"relative",children:[U,W]}),e[76]=U,e[77]=W,e[78]=G):G=e[78];let Z;e[79]!==H||e[80]!==G?(Z=s.jsxs("div",{className:"space-y-1",children:[H,G]}),e[79]=H,e[80]=G,e[81]=Z):Z=e[81];let te;e[82]!==t?(te=t?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:t.helpText}),e[82]=t,e[83]=te):te=e[83];let se;e[84]!==C?(se=C&&s.jsx("p",{className:"text-xs text-destructive",children:C.message}),e[84]=C,e[85]=se):se=e[85];let de;e[86]!==a?(de=a("settings.connectForms.cancel"),e[86]=a,e[87]=de):de=e[87];let he;e[88]!==S||e[89]!==i||e[90]!==de?(he=s.jsx(oe,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:S,children:de}),e[88]=S,e[89]=i,e[90]=de,e[91]=he):he=e[91];let ue;e[92]!==S||e[93]!==a?(ue=a(S?"settings.connectForms.saving":"settings.connectForms.saveConnection"),e[92]=S,e[93]=a,e[94]=ue):ue=e[94];let me;e[95]!==S||e[96]!==ue?(me=s.jsx(oe,{type:"submit",size:"sm",disabled:S,children:ue}),e[95]=S,e[96]=ue,e[97]=me):me=e[97];let fe;e[98]!==he||e[99]!==me?(fe=s.jsxs(Ge,{children:[he,me]}),e[98]=he,e[99]=me,e[100]=fe):fe=e[100];let je;return e[101]!==z||e[102]!==F||e[103]!==K||e[104]!==Z||e[105]!==te||e[106]!==se||e[107]!==fe?(je=s.jsxs("form",{onSubmit:z,className:"space-y-3",children:[F,K,Z,te,se,fe]}),e[101]=z,e[102]=F,e[103]=K,e[104]=Z,e[105]=te,e[106]=se,e[107]=fe,e[108]=je):je=e[108],je}const xs={kind:"closed"};function gs(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 vs(n){switch(n.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return n.providerId;default:return null}}function bs({open:n,onOpenChange:e,initialProvider:t}){const i=ie(),l=_e()?.providers??[],{org:c}=ge(),r=we(),h=ke(),[d,a]=B.useReducer(gs,xs),f=B.useRef(!1);B.useEffect(()=>{n&&d.kind==="closed"?a({type:"open"}):!n&&d.kind!=="closed"&&a({type:"close"})},[n,d.kind]);const p=()=>{f.current=!1,a({type:"close"}),e(!1)},u=()=>{h.invalidateQueries({queryKey:ce.aiProviderKeys(c.id)}),h.invalidateQueries({queryKey:ce.aiProviders(c.id)})},{mutate:m}=Se({mutationFn:async({providerId:g,code:v,stateToken:y,label:E})=>(await r.call("AI_PROVIDER_OAUTH_EXCHANGE",{providerId:g,code:v,stateToken:y,label:E}),g),onSuccess:g=>{ne("ai_provider_oauth_succeeded",{provider_id:g}),u();const v=l.find(y=>y.id===g);le.success(i("settings.connectProviderDialog.oauthSuccessMessage",{provider:v?.name??i("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(g,v)=>{ne("ai_provider_oauth_failed",{provider_id:v.providerId,error:g.message}),le.error(i("settings.connectProviderDialog.oauthFailedMessage",{error:g.message})),a({type:"oauth-failed"})}}),{mutate:b}=Se({mutationFn:async g=>(await r.call("AI_PROVIDER_PROVISION_KEY",{providerId:g}),g),onSuccess:g=>{ne("ai_provider_provision_succeeded",{provider_id:g}),u();const v=l.find(y=>y.id===g);le.success(i("settings.connectProviderDialog.provisionSuccessMessage",{provider:v?.name??i("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(g,v)=>{ne("ai_provider_provision_failed",{provider_id:v,error:g.message}),a({type:"provision-error",error:g.message})}}),w=async g=>{const{provider:v}=g,y=g.kind==="openai-compatible"?g.preset?.id??null:null,E=v.supportedMethods.includes("oauth-pkce"),z=v.supportedMethods.includes("api-key");if(v.supportsProvision===!0){ne("ai_provider_connect_clicked",{provider_id:v.id,method:"provision"}),a({type:"select-provision",providerId:v.id}),b(v.id);return}if(E){ne("ai_provider_connect_clicked",{provider_id:v.id,method:"oauth-pkce"});try{const O=await r.call("AI_PROVIDER_OAUTH_URL",{providerId:v.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`});if(!O?.url)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");a({type:"select-oauth",providerId:v.id,stateToken:O.stateToken}),window.open(O.url,"AiProviderOAuth","width=600,height=700")}catch(O){le.error(i("settings.connectProviderDialog.startOAuthFailedMessage",{error:O instanceof Error?O.message:String(O)}))}return}z&&(ne("ai_provider_connect_clicked",{provider_id:v.id,...y!==null?{preset_id:y}:{},method:"api-key"}),a({type:"select-form",providerId:v.id,presetId:y}))},N=B.useRef(w);N.current=w;const j=B.useRef(t);j.current=t,B.useEffect(()=>{!j.current||d.kind!=="grid"||f.current||(f.current=!0,N.current(j.current))},[d.kind]);const _=d.kind==="oauth-pending"?d.stateToken:null,I=d.kind==="oauth-pending"?d.providerId:null;B.useEffect(()=>{if(d.kind!=="oauth-pending")return;let g=!1;const v=d.stateToken,y=d.providerId,E=P=>{if(P.origin!==window.location.origin||P.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:O,stateToken:T}=P.data;if(T!==v){le.error(i("settings.connectProviderDialog.securityCheckFailedMessage")),a({type:"oauth-failed"});return}g=!0;const R=l.find(F=>F.id===y);m({providerId:y,code:O,stateToken:v,label:R?.name??y})};window.addEventListener("message",E);const z=setTimeout(()=>{g||(ne("ai_provider_oauth_timeout",{provider_id:y}),a({type:"oauth-failed"}),le.error(i("settings.connectProviderDialog.connectionTimedOutMessage")))},12e4);return()=>{window.removeEventListener("message",E),clearTimeout(z)}},[d.kind,_,I,m]);const A=vs(d),k=A?l.find(g=>g.id===A):null,S=(d.kind==="form"&&d.presetId?ye(d.presetId):null)?.name??k?.name??i("settings.connectProviderDialog.defaultTitle"),C=d.kind!=="grid"&&d.kind!=="closed",M=()=>{t?p():a({type:"back"})};return s.jsx(Ye,{open:d.kind!=="closed",onOpenChange:g=>!g&&p(),children:s.jsxs(Xe,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[s.jsxs(bt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[C&&s.jsx(oe,{variant:"ghost",size:"icon","aria-label":i("settings.connectProviderDialog.backButtonLabel"),className:"h-7 w-7",onClick:M,children:s.jsx(Ze,{size:16})}),s.jsx(Qe,{children:S})]}),d.kind==="grid"&&!t&&s.jsx(yt,{children:i("settings.connectProviderDialog.gridDescription")})]}),d.kind==="grid"&&!t&&s.jsx(lt,{providers:l,onSelect:w}),d.kind==="form"&&(d.providerId==="openai-compatible"?s.jsx(ps,{preset:d.presetId?ye(d.presetId):void 0,onCancel:()=>a({type:"back"}),onSuccess:()=>{u(),p()}}):s.jsx(ms,{providerId:d.providerId,onCancel:()=>a({type:"back"}),onSuccess:()=>{u(),p()}})),d.kind==="oauth-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Ae,{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(Ae,{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(Kt,{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(oe,{variant:"outline",size:"sm",onClick:()=>a({type:"back"}),children:i("settings.connectProviderDialog.backButton")}),s.jsx(oe,{size:"sm",onClick:()=>{a({type:"retry-provision"}),b(d.providerId)},children:i("settings.connectProviderDialog.retryButton")})]})]})]})})}function ys(){const n=Y.c(7),{org:e}=ge(),t=we();let i;n[0]!==e.id?(i=ce.defaultBrand(e.id),n[0]=e.id,n[1]=i):i=n[1];let o;n[2]!==t?(o=async()=>{const{items:r}=await t.call("BRAND_CONTEXT_LIST",{});return(Array.isArray(r)?r:[]).find(js)??null},n[2]=t,n[3]=o):o=n[3];let l;n[4]!==i||n[5]!==o?(l={queryKey:i,queryFn:o},n[4]=i,n[5]=o,n[6]=l):l=n[6];const{data:c}=ft(l);return c??null}function js(n){return n.isDefault&&!n.archivedAt}function Ss(n){const e=n.colors;if(!e)return null;if(Array.isArray(e)){const t=e.find(o=>typeof o=="object"&&o!==null&&"label"in o&&/primary|brand|main/i.test(o.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 Ns(n){const e=Y.c(49);let t;e[0]!==n?(t=n===void 0?{}:n,e[0]=n,e[1]=t):t=e[1];const{title:i,description:o}=t,l=ie(),{org:c}=ge(),r=ys(),[h,d]=B.useState(null),[a,f]=B.useState(!1),[p,u]=B.useState(!1),m=Vt();let b;e[2]!==m?(b=(Ut()||Bt())&&!m,e[2]=m,e[3]=b):b=e[3];const w=b,N=_e();let j;e[4]!==N?.providers?(j=N?.providers??[],e[4]=N?.providers,e[5]=j):j=e[5];const _=j,I=c.name;let A;e[6]!==r?(A=r?Ss(r):null,e[6]=r,e[7]=A):A=e[7];const k=A,x=r?.favicon??r?.logo??null;let S;e[8]!==I||e[9]!==l||e[10]!==i?(S=i??(I?l("chat.noAiProviderEmptyState.headingWithOrg",{org:I}):l("chat.noAiProviderEmptyState.headingDefault")),e[8]=I,e[9]=l,e[10]=i,e[11]=S):S=e[11];const C=S;let M;e[12]!==o||e[13]!==l?(M=o??l("chat.noAiProviderEmptyState.subtitleDefault"),e[12]=o,e[13]=l,e[14]=M):M=e[14];const g=M,v=!!(x||k);let y;e[15]!==k?(y=k?{backgroundColor:`${k}18`,borderColor:`${k}30`}:void 0,e[15]=k,e[16]=y):y=e[16];const E=y,z=v?"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 P;e[17]!==z||e[18]!==E||e[19]!==x||e[20]!==w||e[21]!==k||e[22]!==l?(P=x?s.jsx("div",{className:z,style:E,children:s.jsx("img",{src:x,alt:"",className:"size-7 rounded object-contain"})}):w?s.jsx("button",{type:"button",onClick:()=>u(!0),"aria-label":l("downloadApp.openLabel"),className:re(z,"cursor-pointer transition-colors hover:bg-accent"),style:E,children:s.jsx(Pe,{size:24,style:k?{color:k}:void 0,className:re(!k&&"text-muted-foreground")})}):s.jsx("div",{className:z,style:E,children:s.jsx(Pe,{size:24,style:k?{color:k}:void 0,className:re(!k&&"text-muted-foreground")})}),e[17]=z,e[18]=E,e[19]=x,e[20]=w,e[21]=k,e[22]=l,e[23]=P):P=e[23];let O;e[24]!==C?(O=s.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:C}),e[24]=C,e[25]=O):O=e[25];let T;e[26]!==g?(T=s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:g}),e[26]=g,e[27]=T):T=e[27];let R;e[28]!==T||e[29]!==O?(R=s.jsxs("div",{className:"space-y-2",children:[O,T]}),e[28]=T,e[29]=O,e[30]=R):R=e[30];let F;e[31]!==R||e[32]!==P?(F=s.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[P,R]}),e[31]=R,e[32]=P,e[33]=F):F=e[33];let K,Q;e[34]===Symbol.for("react.memo_cache_sentinel")?(K=L=>d(L),Q=()=>f(!0),e[34]=K,e[35]=Q):(K=e[34],Q=e[35]);let V;e[36]!==_?(V=s.jsx("div",{className:"w-full",children:s.jsx(lt,{providers:_,onSelect:K,onShowAll:Q})}),e[36]=_,e[37]=V):V=e[37];const q=h!==null||a;let H;e[38]===Symbol.for("react.memo_cache_sentinel")?(H=L=>{L||(d(null),f(!1))},e[38]=H):H=e[38];const J=h??void 0;let $;e[39]!==q||e[40]!==J?($=s.jsx(bs,{open:q,onOpenChange:H,initialProvider:J}),e[39]=q,e[40]=J,e[41]=$):$=e[41];let U;e[42]!==p?(U=s.jsx(Wt,{open:p,onOpenChange:u}),e[42]=p,e[43]=U):U=e[43];let X;return e[44]!==F||e[45]!==V||e[46]!==$||e[47]!==U?(X=s.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-3xl px-4",children:[F,V,$,U]}),e[44]=F,e[45]=V,e[46]=$,e[47]=U,e[48]=X):X=e[48],X}function Ie(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 ws(n){return n<32e3?{level:1,labelKey:"chat.shared.contextLevelSmall",descriptionKey:"chat.shared.contextLevelSmallDesc"}:n<2e5?{level:2,labelKey:"chat.shared.contextLevelMedium",descriptionKey:"chat.shared.contextLevelMediumDesc"}:n<5e5?{level:3,labelKey:"chat.shared.contextLevelLarge",descriptionKey:"chat.shared.contextLevelLargeDesc"}:{level:4,labelKey:"chat.shared.contextLevelVeryLarge",descriptionKey:"chat.shared.contextLevelVeryLargeDesc"}}const ks=["bg-destructive","bg-warning","bg-success","bg-success"],_s=["text-success","text-warning","text-warning","text-destructive"];function Cs(n,e){const t=Math.round(n*.75/1e3),i=t>=1?`${t}K`:`${Math.round(n*.75)}`;return e("chat.shared.approxWords",{wordCount:i})}function Is(n){return n<1?{level:1,labelKey:"chat.shared.costLevelCheap"}:n<5?{level:2,labelKey:"chat.shared.costLevelModerate"}:n<15?{level:3,labelKey:"chat.shared.costLevelHigh"}:{level:4,labelKey:"chat.shared.costLevelExpensive"}}const Ms={text:{icon:s.jsx(qt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityText"},vision:{icon:s.jsx(Gt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityVision"},image:{icon:s.jsx(Tt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityImage"},tools:{icon:s.jsx(Ht,{className:"size-3.5"}),labelKey:"chat.shared.capabilityTools"},reasoning:{icon:s.jsx(Yt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityReasoning"},"web-search":{icon:s.jsx(tt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityWebSearch"}};function Es(n){const e=Y.c(10),{capability:t}=n,i=ie(),o=Ms[t];if(o){const h=o.icon;let d;e[0]!==o.labelKey||e[1]!==i?(d=i(o.labelKey),e[0]=o.labelKey,e[1]=i,e[2]=d):d=e[2];let a;return e[3]!==o.icon||e[4]!==d?(a=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:[h,d]}),e[3]=o.icon,e[4]=d,e[5]=a):a=e[5],a}let l;e[6]!==t?(l=t.charAt(0).toUpperCase(),e[6]=t,e[7]=l):l=e[7];const c=l+t.slice(1);let r;return e[8]!==c?(r=s.jsx("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:c}),e[8]=c,e[9]=r):r=e[9],r}function Os(n){const e=Y.c(59),{model:t,compact:i}=n,o=i===void 0?!1:i,l=ie();if(!t){let x;e[0]!==l?(x=l("chat.shared.hoverToPreview"),e[0]=l,e[1]=x):x=e[1];let S;return e[2]!==x?(S=s.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:x}),e[2]=x,e[3]=S):S=e[3],S}const c=t.costs?.input!=null?t.costs.input*1e6:null,r=t.costs?.output!=null?t.costs.output*1e6:null;let h;e[4]!==t?(h=Ie(t),e[4]=t,e[5]=h):h=e[5];const{provider:d,displayName:a}=h;if(o){let x;e[6]!==t.limits||e[7]!==l?(x=t.limits?.contextWindow&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.context")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," ",l("chat.shared.tokens")]})]}),e[6]=t.limits,e[7]=l,e[8]=x):x=e[8];let S;e[9]!==c||e[10]!==l?(S=c!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.input")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",c.toFixed(2)," / 1M"]})]}),e[9]=c,e[10]=l,e[11]=S):S=e[11];let C;e[12]!==r||e[13]!==l?(C=r!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.output")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[12]=r,e[13]=l,e[14]=C):C=e[14];let M;e[15]!==t.limits||e[16]!==l?(M=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.outputLimit")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," ",l("chat.shared.tokens")]})]}),e[15]=t.limits,e[16]=l,e[17]=M):M=e[17];let g;return e[18]!==x||e[19]!==S||e[20]!==C||e[21]!==M?(g=s.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[x,S,C,M]}),e[18]=x,e[19]=S,e[20]=C,e[21]=M,e[22]=g):g=e[22],g}let f;e[23]!==d?(f=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e[23]=d,e[24]=f):f=e[24];let p;e[25]!==t.logo||e[26]!==t.title?(p=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[25]=t.logo,e[26]=t.title,e[27]=p):p=e[27];let u;e[28]!==a?(u=s.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:a}),e[28]=a,e[29]=u):u=e[29];let m;e[30]!==p||e[31]!==u?(m=s.jsxs("div",{className:"flex items-center gap-2.5",children:[p,u]}),e[30]=p,e[31]=u,e[32]=m):m=e[32];let b;e[33]!==t.modelId?(b=s.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[33]=t.modelId,e[34]=b):b=e[34];let w;e[35]!==f||e[36]!==m||e[37]!==b?(w=s.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[f,m,b]}),e[35]=f,e[36]=m,e[37]=b,e[38]=w):w=e[38];let N;e[39]!==t.capabilities?(N=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(As)}),e[39]=t.capabilities,e[40]=N):N=e[40];let j;e[41]!==t.limits||e[42]!==l?(j=t.limits?.contextWindow&&(()=>{const{level:x,labelKey:S,descriptionKey:C}=ws(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:l("chat.shared.contextWindow")}),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(M=>s.jsx("div",{className:re("w-2 h-2 rounded-full",M<=x?ks[x-1]:"bg-muted")},M))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:l(S)}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",l(C)]})]}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," ",l("chat.shared.tokens")]})]})})(),e[41]=t.limits,e[42]=l,e[43]=j):j=e[43];let _;e[44]!==t.limits||e[45]!==l?(_=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:l("chat.shared.outputLimit")}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-sm text-foreground",children:[t.limits.maxOutputTokens.toLocaleString()," ",l("chat.shared.tokens")]}),s.jsx("span",{className:"text-sm text-muted-foreground",children:Cs(t.limits.maxOutputTokens,l)})]})]}),e[44]=t.limits,e[45]=l,e[46]=_):_=e[46];let I;e[47]!==c||e[48]!==r||e[49]!==l?(I=(c!=null||r!=null)&&(()=>{const{level:x,labelKey:S}=c!=null?Is(c):{level:0,labelKey:null};return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.pricing")}),c!=null&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(C=>s.jsx("span",{className:re("text-sm font-bold leading-none",C<=x?_s[x-1]:"text-muted-foreground/20"),children:"$"},C))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:S?l(S):""})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[c!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:l("chat.shared.input")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",c.toFixed(2)," / 1M"," ",l("chat.shared.tokens")]})]}),r!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:l("chat.shared.output")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M"," ",l("chat.shared.tokens")]})]})]})]})})(),e[47]=c,e[48]=r,e[49]=l,e[50]=I):I=e[50];let A;e[51]!==j||e[52]!==_||e[53]!==I?(A=s.jsxs("div",{className:"flex flex-col gap-6",children:[j,_,I]}),e[51]=j,e[52]=_,e[53]=I,e[54]=A):A=e[54];let k;return e[55]!==A||e[56]!==w||e[57]!==N?(k=s.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[w,N,A]}),e[55]=A,e[56]=w,e[57]=N,e[58]=k):k=e[58],k}function As(n){return s.jsx(Es,{capability:n},n)}function ot(n){const e=Y.c(22),{model:t,placeholder:i,isLoading:o}=n,l=o===void 0?!1:o,c=ie();let r;e[0]!==i||e[1]!==c?(r=i??c("chat.shared.selectModel"),e[0]=i,e[1]=c,e[2]=r):r=e[2];const h=r;if(l){let N;return e[3]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(ee,{className:"w-5 h-5 rounded-sm shrink-0"}),s.jsx(ee,{className:"w-16 h-3 hidden md:block"})]}),e[3]=N):N=e[3],N}if(!t){let N;e[4]!==h?(N=s.jsx("span",{className:"text-sm text-muted-foreground",children:h}),e[4]=h,e[5]=N):N=e[5];let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Te,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[6]=j):j=e[6];let _;return e[7]!==N?(_=s.jsxs("div",{className:"flex items-center gap-1.5",children:[N,j]}),e[7]=N,e[8]=_):_=e[8],_}let d;e[9]!==t?(d=Ie(t),e[9]=t,e[10]=d):d=e[10];const{displayName:a}=d;let f;e[11]!==t?(f=Ce(t),e[11]=t,e[12]=f):f=e[12];const p=f;let u;e[13]!==t.title||e[14]!==p?(u=s.jsx("img",{src:p,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[13]=t.title,e[14]=p,e[15]=u):u=e[15];let m;e[16]!==a?(m=s.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:a}),e[16]=a,e[17]=m):m=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(Te,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[18]=b):b=e[18];let w;return e[19]!==u||e[20]!==m?(w=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[u,m,b]}),e[19]=u,e[20]=m,e[21]=w):w=e[21],w}const Ps=["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 Me(n){const e=n?.capabilities;return e?Ps.some(t=>e.includes(t)):!1}function Li(n,e){if(!n)return!1;if(n.startsWith("text/"))return!0;const t=e?.capabilities??[],i=t.includes("vision")||t.includes("image"),o=t.includes("file"),l=t.includes("audio"),c=t.includes("video");return!!(i&&rt.includes(n)||o&&n==="application/pdf"||l&&n.startsWith("audio/")||c&&n.startsWith("video/")||Me(e)&&at.includes(n))}function zi(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/*"),Me(n)&&t.push(...at),t.join(",")}function Fi(n){const e=n?.capabilities??[],t=[];return(e.includes("vision")||e.includes("image"))&&t.push("chat.shared.fileTypeImages"),e.includes("file")&&t.push("chat.shared.fileTypePdfs"),e.includes("audio")&&t.push("chat.shared.fileTypeAudio"),e.includes("video")&&t.push("chat.shared.fileTypeVideo"),Me(n)&&t.push("chat.shared.fileTypeOffice"),{parts:t,count:t.length}}const ct=["smarter","faster","cheaper"],Ts={smarter:"chat.decopilot.tierSmarter",faster:"chat.decopilot.tierFaster",cheaper:"chat.decopilot.tierCheaper"},Ls=[{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"]}],zs=Ls.flatMap(({tier:n,prefixes:e})=>e.map(t=>({tier:n,prefix:t}))).sort((n,e)=>e.prefix.length-n.prefix.length),Fs="google/gemini-2.5-pro",$e=new Map;function Rs(n){const e=$e.get(n);if(e!==void 0)return e;let t=null;if(n.endsWith(":free"))t="cheaper";else for(const{tier:i,prefix:o}of zs)if(n.startsWith(o)){if(o===Fs&&n.length>o.length&&n[o.length]==="-"){const c=n[o.length+1];if(!c||!/\d/.test(c))continue}t=i;break}return $e.set(n,t),t}function Ue(n){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of n){const i=Rs(t.modelId);e[i??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((i,o)=>i.title.localeCompare(o.title));return e}const dt="studio:model-shortlist:",Ks=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 Ds(n){try{const e=localStorage.getItem(dt+n);return e?new Set(JSON.parse(e)):null}catch{return null}}function $s(n,e){localStorage.setItem(dt+n,JSON.stringify([...e]))}function Us(n){const e=Y.c(21),{model:t,onHover:i}=n;let o;e[0]!==t?(o=Ie(t),e[0]=t,e[1]=o):o=e[1];const{displayName:l,provider:c}=o;let r;e[2]!==t?(r=Ce(t),e[2]=t,e[3]=r):r=e[3];const h=r;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]!==h?(a=s.jsx("img",{src:h,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]=h,e[9]=a):a=e[9];let f;e[10]!==l?(f=s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:l}),e[10]=l,e[11]=f):f=e[11];let p;e[12]!==c?(p=s.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:c}),e[12]=c,e[13]=p):p=e[13];let u;e[14]!==f||e[15]!==p?(u=s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[f,p]}),e[14]=f,e[15]=p,e[16]=u):u=e[16];let m;return e[17]!==d||e[18]!==a||e[19]!==u?(m=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,u]}),e[17]=d,e[18]=a,e[19]=u,e[20]=m):m=e[20],m}function Bs(n){const e=Y.c(16),{error:t,onRetry:i}=n,o=ie();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(gt,{className:"size-5 text-destructive"})}),e[0]=l):l=e[0];const c=o("chat.decopilot.failedToLoadModels");let r;e[1]!==c?(r=s.jsx("p",{className:"text-sm font-medium text-foreground",children:c}),e[1]=c,e[2]=r):r=e[2];const h=t?.message||o("chat.decopilot.couldNotFetchModels"),d=" "+o("chat.decopilot.tryAnotherProviderOrRetry");let a;e[3]!==h||e[4]!==d?(a=s.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[h,d]}),e[3]=h,e[4]=d,e[5]=a):a=e[5];let f;e[6]!==r||e[7]!==a?(f=s.jsxs("div",{className:"flex flex-col gap-1",children:[r,a]}),e[6]=r,e[7]=a,e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(zt,{className:"size-3.5"}),e[9]=p):p=e[9];const u=o("chat.decopilot.retry");let m;e[10]!==i||e[11]!==u?(m=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(oe,{variant:"outline",size:"sm",onClick:i,className:"gap-1.5",children:[p,u]})}),e[10]=i,e[11]=u,e[12]=m):m=e[12];let b;return e[13]!==m||e[14]!==f?(b=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[l,f,m]}),e[13]=m,e[14]=f,e[15]=b):b=e[15],b}function Ws(){const n=Y.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(Vs)}),n[0]=e):e=n[0],e}function Vs(n,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(ee,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(ee,{className:"flex-1 h-4"}),s.jsx(ee,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Be(n){const e=Y.c(12),{label:t,models:i,onSelect:o,onHover:l}=n;if(i.length===0)return null;let c;e[0]!==t?(c=s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=c):c=e[1];let r;if(e[2]!==i||e[3]!==l||e[4]!==o){let d;e[6]!==l||e[7]!==o?(d=a=>s.jsx("button",{type:"button",onClick:()=>o(a),onFocus:()=>l(a),className:"w-full text-left cursor-pointer",children:s.jsx(Us,{model:a,onHover:l})},a.modelId),e[6]=l,e[7]=o,e[8]=d):d=e[8],r=i.map(d),e[2]=i,e[3]=l,e[4]=o,e[5]=r}else r=e[5];let h;return e[9]!==c||e[10]!==r?(h=s.jsxs("div",{children:[c,r]}),e[9]=c,e[10]=r,e[11]=h):h=e[11],h}function Ne(n,e){return e(n==="other"?"chat.decopilot.tierOther":Ts[n])}function Hs(n){const e=Y.c(21),{model:t,isChecked:i,onToggle:o,onHover:l}=n,[c,r]=B.useState(i);c!==i&&r(i);let h;e[0]!==t?(h=Ce(t),e[0]=t,e[1]=h):h=e[1];const d=h;let a;e[2]!==t||e[3]!==l?(a=()=>l(t),e[2]=t,e[3]=l,e[4]=a):a=e[4];let f;e[5]!==t.modelId||e[6]!==o?(f=()=>{r(qs),o(t.modelId)},e[5]=t.modelId,e[6]=o,e[7]=f):f=e[7];let p;e[8]!==c||e[9]!==f?(p=s.jsx(_t,{checked:c,onCheckedChange:f}),e[8]=c,e[9]=f,e[10]=p):p=e[10];let u;e[11]!==d||e[12]!==t.title?(u=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]=u):u=e[13];let m;e[14]!==t.title?(m=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]=m):m=e[15];let b;return e[16]!==a||e[17]!==p||e[18]!==u||e[19]!==m?(b=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:[p,u,m]}),e[16]=a,e[17]=p,e[18]=u,e[19]=m,e[20]=b):b=e[20],b}function qs(n){return!n}function Gs(n,e){const t=[];for(const i of ct)if(n[i].length>0){t.push({type:"header",label:Ne(i,e)});for(const o of n[i])t.push({type:"model",model:o})}if(n.other.length>0){t.push({type:"header",label:Ne("other",e)});for(const i of n.other)t.push({type:"model",model:i})}return t}function Ys({items:n,shortlistSet:e,onToggle:t,onHover:i}){const o=B.useRef(null),l=rs({count:n.length,getScrollElement:()=>o.current,estimateSize:c=>n[c]?.type==="header"?36:44,overscan:6});return s.jsx("div",{ref:o,className:"flex-1 overflow-y-auto",children:s.jsx("div",{className:"relative",style:{height:l.getTotalSize()},children:l.getVirtualItems().map(c=>{const r=n[c.index];return r?s.jsx("div",{"data-index":c.index,ref:l.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${c.start}px)`},children:r.type==="header"?s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:r.label}):s.jsx(Hs,{model:r.model,isChecked:e.has(r.model.modelId),onToggle:t,onHover:i})},c.key):null})})})}function Xs(n){const e=Y.c(30),{keyId:t,searchTerm:i,onHover:o,onModelSelect:l,managing:c,onToggleManage:r,filterModels:h}=n,d=ie(),{models:a}=Rt(t),f=h?a.filter(h):a.filter(Qs);let p;e[0]!==t?(p=()=>(t?Ds(t):null)??Ks,e[0]=t,e[1]=p):p=e[1];const[u,m]=B.useState(p),[,b]=B.useTransition();let w;e[2]!==t||e[3]!==b?(w=v=>{t&&b(()=>{m(y=>{const E=new Set(y);return E.has(v)?E.delete(v):E.add(v),$s(t,E),E})})},e[2]=t,e[3]=b,e[4]=w):w=e[4];const N=w,j=i.toLowerCase().trim(),_=v=>j?v.filter(y=>y.title.toLowerCase().includes(j)||y.modelId.toLowerCase().includes(j)):v;if(c){const v=Ue(_(f)),y=Gs(v,d);let E;e[5]!==u?(E=R=>u.has(R.modelId),e[5]=u,e[6]=E):E=e[6];const z=f.filter(E).length;let P;e[7]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Ze,{size:14}),e[7]=P):P=e[7];let O;e[8]!==d?(O=d("chat.decopilot.back"),e[8]=d,e[9]=O):O=e[9];let T;return e[10]!==r||e[11]!==O?(T=s.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[P,O]}),e[10]=r,e[11]=O,e[12]=T):T=e[12],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.jsx("span",{className:"text-xs text-muted-foreground",children:d("chat.decopilot.selectedCount",{count:z})})]}),s.jsx(Ys,{items:y,shortlistSet:u,onToggle:N,onHover:o})]})}let I;e[13]!==u?(I=v=>u.has(v.modelId),e[13]=u,e[14]=I):I=e[14];const A=f.filter(I),k=A.length>0?A:f,x=Ue(_(k));let S;e[15]!==x||e[16]!==o||e[17]!==l||e[18]!==d?(S=ct.map(v=>s.jsx(Be,{label:Ne(v,d),models:x[v],onSelect:l,onHover:o},v)),e[15]=x,e[16]=o,e[17]=l,e[18]=d,e[19]=S):S=e[19];let C;e[20]!==d?(C=Ne("other",d),e[20]=d,e[21]=C):C=e[21];let M;e[22]!==x.other||e[23]!==o||e[24]!==l||e[25]!==C?(M=s.jsx(Be,{label:C,models:x.other,onSelect:l,onHover:o}),e[22]=x.other,e[23]=o,e[24]=l,e[25]=C,e[26]=M):M=e[26];let g;return e[27]!==S||e[28]!==M?(g=s.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[S,M]}),e[27]=S,e[28]=M,e[29]=g):g=e[29],g}function Qs(n){return n.asyncResearch!==!0}function Js(){const n=Y.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(ee,{className:"size-4 shrink-0"}),s.jsx(ee,{className:"flex-1 h-6"}),s.jsx(ee,{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(Zs)})]}),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(ee,{className:"size-6 shrink-0"}),s.jsx(ee,{className:"h-6 w-32"})]}),n[2]=i):i=n[2];let o;n[3]===Symbol.for("react.memo_cache_sentinel")?(o=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(ee,{className:"h-6 w-20 rounded-md"}),s.jsx(ee,{className:"h-6 w-24 rounded-md"})]})]}),n[3]=o):o=n[3];let l;n[4]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(ee,{className:"h-4 w-24"}),s.jsx(ee,{className:"h-4 w-32"})]}),n[4]=l):l=n[4];let c;return n[5]===Symbol.for("react.memo_cache_sentinel")?(c=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:[o,s.jsxs("div",{className:"flex flex-col gap-4",children:[l,s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(ee,{className:"h-4 w-16"}),s.jsx(ee,{className:"h-4 w-40"})]})]})]})})]}),n[5]=c):c=n[5],c}function Zs(n,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(ee,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(ee,{className:"flex-1 h-4"}),s.jsx(ee,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function ht(n){const e=Y.c(66),{onClose:t,credentialId:i,onCredentialChange:o,selectedModel:l,onModelChange:c,filterModels:r,compact:h}=n,d=ie(),[a,f]=B.useState(null),[p,u]=B.useState(""),[m,b]=B.useState(!1),w=_e(),N=Ft();let j;e[0]!==w?.providers?(j=Object.fromEntries((w?.providers??[]).map(si)),e[0]=w?.providers,e[1]=j):j=e[1];const _=j,I=pt(),{org:A}=ge();let k;e[2]!==o?(k=L=>{o(L),f(null)},e[2]=o,e[3]=k):k=e[3];const x=k;let S;e[4]!==i||e[5]!==t||e[6]!==c?(S=L=>{i&&(c(L),u(""),t())},e[4]=i,e[5]=t,e[6]=c,e[7]=S):S=e[7];const C=S;if(N.length===0){const L=!h&&"sm:w-[740px]";let D;e[8]!==L?(D=re("flex items-center justify-center p-8 w-full",L),e[8]=L,e[9]=D):D=e[9];let W;e[10]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(Ns,{}),e[10]=W):W=e[10];let G;return e[11]!==D?(G=s.jsx("div",{className:D,children:W}),e[11]=D,e[12]=G):G=e[12],G}const M=h?"sm:h-[420px]":"sm:h-[460px]";let g;e[13]!==M?(g=re("flex flex-col md:flex-row h-full min-h-0",M),e[13]=M,e[14]=g):g=e[14];const v=h?"w-full":"md:border-r md:w-[420px] md:min-w-[420px]";let y;e[15]!==v?(y=re("flex-1 flex flex-col min-h-0 overflow-hidden",v),e[15]=v,e[16]=y):y=e[16];let E;e[17]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(tt,{size:16,className:"text-muted-foreground shrink-0"}),e[17]=E):E=e[17];let z;e[18]!==m||e[19]!==d?(z=d(m?"chat.decopilot.searchAllModels":"chat.decopilot.searchForModel"),e[18]=m,e[19]=d,e[20]=z):z=e[20];let P;e[21]===Symbol.for("react.memo_cache_sentinel")?(P=L=>u(L.target.value),e[21]=P):P=e[21];let O;e[22]!==p||e[23]!==z?(O=s.jsx(xe,{autoFocus:!0,type:"text",placeholder:z,value:p,onChange:P,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[22]=p,e[23]=z,e[24]=O):O=e[24];let T;e[25]!==i||e[26]!==x||e[27]!==N||e[28]!==_||e[29]!==d?(T=N.length>0&&s.jsxs(Ct,{value:i??"",onValueChange:x,children:[s.jsxs(It,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:ti,children:[s.jsx(Mt,{placeholder:d("chat.decopilot.key"),children:(()=>{const L=N.find(te=>te.id===i),D=L?_[L.providerId]:void 0,W=ye(L?.presetId),G=W?.logo??D?.logo,Z=W?.name??D?.name??L?.providerId??"Key";return s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[G?s.jsx("img",{src:G,alt:Z,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:Z.slice(0,1).toUpperCase()}),s.jsx("span",{className:"text-xs truncate",children:Z})]})})()}),s.jsx(At,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),s.jsx(Et,{children:N.map(L=>{const D=_[L.providerId],W=ye(L.presetId),G=W?.logo??D?.logo,Z=W?.name??D?.name??L.providerId;return s.jsx(Ot,{value:L.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[G?s.jsx("img",{src:G,alt:Z,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:Z.slice(0,1).toUpperCase()}),s.jsxs("span",{children:[Z," — ",L.label]})]})},L.id)})})]}),e[25]=i,e[26]=x,e[27]=N,e[28]=_,e[29]=d,e[30]=T):T=e[30];let R;e[31]!==O||e[32]!==T?(R=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:[E,O,T]})}),e[31]=O,e[32]=T,e[33]=R):R=e[33];let F;e[34]!==i?(F=L=>{const{error:D,resetError:W}=L;return s.jsx(Bs,{error:D,onRetry:W,credentialId:i??void 0})},e[34]=i,e[35]=F):F=e[35];let K;e[36]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Ws,{}),e[36]=K):K=e[36];const Q=i??void 0;let V;e[37]===Symbol.for("react.memo_cache_sentinel")?(V=()=>b(ei),e[37]=V):V=e[37];let q;e[38]!==r||e[39]!==C||e[40]!==m||e[41]!==p||e[42]!==Q?(q=s.jsx(B.Suspense,{fallback:K,children:s.jsx(Xs,{keyId:Q,searchTerm:p,onHover:f,onModelSelect:C,managing:m,onToggleManage:V,filterModels:r})}),e[38]=r,e[39]=C,e[40]=m,e[41]=p,e[42]=Q,e[43]=q):q=e[43];let H;e[44]!==i||e[45]!==F||e[46]!==q?(H=s.jsx(xt,{fallback:F,children:q},i),e[44]=i,e[45]=F,e[46]=q,e[47]=H):H=e[47];let J;e[48]!==m||e[49]!==I||e[50]!==A||e[51]!==d?(J=!m&&s.jsxs("div",{className:"border-t border-border flex",children:[s.jsxs("button",{type:"button",onClick:()=>B.startTransition(()=>b(!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(Lt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageModels")]}),s.jsx("div",{className:"w-px bg-border shrink-0"}),s.jsxs("button",{type:"button",onClick:()=>I({to:"/$org/settings/ai-providers",params:{org:A.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(Pt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageApiKeys")]})]}),e[48]=m,e[49]=I,e[50]=A,e[51]=d,e[52]=J):J=e[52];let $;e[53]!==R||e[54]!==H||e[55]!==J||e[56]!==y?($=s.jsxs("div",{className:y,children:[R,H,J]}),e[53]=R,e[54]=H,e[55]=J,e[56]=y,e[57]=$):$=e[57];let U;e[58]!==h||e[59]!==a||e[60]!==l?(U=!h&&s.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:s.jsx(Os,{model:a??l??null})}),e[58]=h,e[59]=a,e[60]=l,e[61]=U):U=e[61];let X;return e[62]!==$||e[63]!==U||e[64]!==g?(X=s.jsxs("div",{className:g,children:[$,U]}),e[62]=$,e[63]=U,e[64]=g,e[65]=X):X=e[65],X}function ei(n){return!n}function ti(n){return n.stopPropagation()}function si(n){return[n.id,n]}function ii(n){const e=Y.c(12),{onClose:t}=n,{credentialId:i,setCredentialId:o,selectedModel:l,setModel:c}=Je();let r;e[0]!==o?(r=a=>{ne("chat_credential_changed",{credential_id:a}),o(a)},e[0]=o,e[1]=r):r=e[1];let h;e[2]!==i||e[3]!==l?.modelId||e[4]!==c?(h=a=>{i&&(ne("chat_model_changed",{from_model_id:l?.modelId??null,to_model_id:a.modelId,to_model_provider:a.providerId??null,credential_id:i}),c({...a,keyId:i}))},e[2]=i,e[3]=l?.modelId,e[4]=c,e[5]=h):h=e[5];let d;return e[6]!==i||e[7]!==t||e[8]!==l||e[9]!==r||e[10]!==h?(d=s.jsx(ht,{onClose:t,credentialId:i,onCredentialChange:r,selectedModel:l,onModelChange:h}),e[6]=i,e[7]=t,e[8]=l,e[9]=r,e[10]=h,e[11]=d):d=e[11],d}function ni(n){const e=Y.c(2),{onClose:t}=n;let i;return e[0]!==t?(i=s.jsx(ii,{onClose:t}),e[0]=t,e[1]=i):i=e[1],i}function li(n){const e=Y.c(2);let t;return e[0]!==n?(t=s.jsx(ht,{...n}),e[0]=n,e[1]=t):t=e[1],t}function oi(n){const e=Y.c(2),{onClose:t}=n;let i;return e[0]!==t?(i=s.jsx(ni,{onClose:t}),e[0]=t,e[1]=i):i=e[1],i}function ri(n){const e=Y.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let i;return e[2]!==t?(i=s.jsx(li,{...t}),e[2]=t,e[3]=i):i=e[3],i}function Ri(n){const e=Y.c(48),{variant:t,className:i,placeholder:o,model:l,isLoading:c,credentialId:r,onCredentialChange:h,onModelChange:d,filterModels:a}=n,f=t===void 0?"borderless":t,p=o===void 0?"Select model":o,u=ie(),[m,b]=B.useState(!1),w=d!==void 0,N=vt(),j=f==="borderless"?"ghost":"outline",_=f==="borderless"&&"md:border-none";let I;e[0]!==i||e[1]!==_?(I=re("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",_,i),e[0]=i,e[1]=_,e[2]=I):I=e[2];let A;e[3]!==c||e[4]!==l||e[5]!==p||e[6]!==w?(A=w?s.jsx(ot,{model:l??null,placeholder:p,isLoading:c}):s.jsx(ci,{placeholder:p}),e[3]=c,e[4]=l,e[5]=p,e[6]=w,e[7]=A):A=e[7];let k;e[8]!==j||e[9]!==I||e[10]!==A?(k=s.jsx(oe,{variant:j,size:"sm",className:I,children:A}),e[8]=j,e[9]=I,e[10]=A,e[11]=k):k=e[11];const x=k;let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Js,{}),e[12]=S):S=e[12];let C;e[13]!==r||e[14]!==a||e[15]!==l||e[16]!==h||e[17]!==d||e[18]!==w?(C=s.jsx(B.Suspense,{fallback:S,children:w?s.jsx(ri,{onClose:()=>b(!1),credentialId:r??null,onCredentialChange:h??ai,selectedModel:l??null,onModelChange:d,filterModels:a}):s.jsx(oi,{onClose:()=>b(!1)})}),e[13]=r,e[14]=a,e[15]=l,e[16]=h,e[17]=d,e[18]=w,e[19]=C):C=e[19];const M=C;if(N){let P;e[20]!==x?(P=s.jsx(St,{asChild:!0,children:x}),e[20]=x,e[21]=P):P=e[21];let O;e[22]!==u?(O=u("chat.selectModel.selectModel"),e[22]=u,e[23]=O):O=e[23];let T;e[24]!==O?(T=s.jsx(Nt,{className:"sr-only",children:O}),e[24]=O,e[25]=T):T=e[25];let R;e[26]!==M?(R=s.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:M}),e[26]=M,e[27]=R):R=e[27];let F;e[28]!==T||e[29]!==R?(F=s.jsxs(wt,{className:"p-0 flex flex-col max-h-[95vh]",children:[T,R]}),e[28]=T,e[29]=R,e[30]=F):F=e[30];let K;return e[31]!==m||e[32]!==P||e[33]!==F?(K=s.jsxs(kt,{open:m,onOpenChange:b,children:[P,F]}),e[31]=m,e[32]=P,e[33]=F,e[34]=K):K=e[34],K}let g;e[35]!==x?(g=s.jsx(jt,{asChild:!0,children:x}),e[35]=x,e[36]=g):g=e[36];let v;e[37]!==u?(v=u("chat.selectModel.selectModel"),e[37]=u,e[38]=v):v=e[38];let y;e[39]!==v?(y=s.jsx(Qe,{className:"sr-only",children:v}),e[39]=v,e[40]=y):y=e[40];let E;e[41]!==M||e[42]!==y?(E=s.jsxs(Xe,{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:[y,M]}),e[41]=M,e[42]=y,e[43]=E):E=e[43];let z;return e[44]!==m||e[45]!==g||e[46]!==E?(z=s.jsxs(Ye,{open:m,onOpenChange:b,children:[g,E]}),e[44]=m,e[45]=g,e[46]=E,e[47]=z):z=e[47],z}function ai(){}function ci(n){const e=Y.c(4),{placeholder:t}=n,{selectedModel:i,isModelsLoading:o}=Je();let l;return e[0]!==o||e[1]!==i||e[2]!==t?(l=s.jsx(ot,{model:i,placeholder:t,isLoading:o}),e[0]=o,e[1]=i,e[2]=t,e[3]=l):l=e[3],l}export{bs as C,ri as M,Ns as N,lt as P,Js as a,zi as b,Ri as c,ye as d,Fi as g,Li as i,Me as m};
@@ -1 +1 @@
1
- import{r as d,br as st,bp as Ne,j as i,e1 as rt,bt as Ie,bq as k,e2 as lt,bm as j,bs as P,cH as $,e3 as at,aB as Ee,e4 as Re,bn as ct,cC as it,e5 as dt,cL as ut,e6 as pt,e7 as ft,e8 as mt,e9 as ht,ea as gt,bo as vt,eb as xt,ec as St,ed as wt,c as ee,l as oe}from"./index-C7u2w8im.js";import{i as Ct}from"./Check-BMboHHSR.js";import{t as je,n as yt}from"./ChevronUp-I74YujLg.js";function Pe(s,[e,t]){return Math.min(t,Math.max(e,s))}var bt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,Tt]=ct(J),[ne]=vt(J,[Tt,Re]),pe=Re(),[Nt,G]=ne(J),[Pt,_t]=ne(J),Me=s=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:a,value:r,defaultValue:l,onValueChange:c,dir:u,name:m,autoComplete:v,disabled:w,required:C,form:S}=s,p=pe(e),[g,y]=d.useState(null),[h,x]=d.useState(null),[F,M]=d.useState(!1),se=st(u),[_,O]=Ne({prop:o,defaultProp:n??!1,onChange:a,caller:J}),[U,q]=Ne({prop:r,defaultProp:l,onChange:c,caller:J}),L=d.useRef(null),B=g?S||!!g.closest("form"):!0,[W,V]=d.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return i.jsx(rt,{...p,children:i.jsxs(Nt,{required:C,scope:e,trigger:g,onTriggerChange:y,valueNode:h,onValueNodeChange:x,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:Ie(),value:U,onValueChange:q,open:_,onOpenChange:O,dir:se,triggerPointerDownPosRef:L,disabled:w,children:[i.jsx(de.Provider,{scope:e,children:i.jsx(Pt,{scope:s.__scopeSelect,onNativeOptionAdd:d.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:d.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?i.jsxs(et,{"aria-hidden":!0,required:C,tabIndex:-1,name:m,autoComplete:v,value:U,onChange:E=>q(E.target.value),disabled:w,form:S,children:[U===void 0?i.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};Me.displayName=J;var Ae="SelectTrigger",Oe=d.forwardRef((s,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=s,a=pe(t),r=G(Ae,t),l=r.disabled||o,c=k(e,r.onTriggerChange),u=ue(t),m=d.useRef("touch"),[v,w,C]=ot(p=>{const g=u().filter(x=>!x.disabled),y=g.find(x=>x.value===r.value),h=nt(g,p,y);h!==void 0&&r.onValueChange(h.value)}),S=p=>{l||(r.onOpenChange(!0),C()),p&&(r.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return i.jsx(lt,{asChild:!0,...a,children:i.jsx(j.button,{type:"button",role:"combobox","aria-controls":r.contentId,"aria-expanded":r.open,"aria-required":r.required,"aria-autocomplete":"none",dir:r.dir,"data-state":r.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":tt(r.value)?"":void 0,...n,ref:c,onClick:P(n.onClick,p=>{p.currentTarget.focus(),m.current!=="mouse"&&S(p)}),onPointerDown:P(n.onPointerDown,p=>{m.current=p.pointerType;const g=p.target;g.hasPointerCapture(p.pointerId)&&g.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:P(n.onKeyDown,p=>{const g=v.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&w(p.key),!(g&&p.key===" ")&&bt.includes(p.key)&&(S(),p.preventDefault())})})})});Oe.displayName=Ae;var De="SelectValue",ke=d.forwardRef((s,e)=>{const{__scopeSelect:t,className:o,style:n,children:a,placeholder:r="",...l}=s,c=G(De,t),{onValueNodeHasChildrenChange:u}=c,m=a!==void 0,v=k(e,c.onValueNodeChange);return $(()=>{u(m)},[u,m]),i.jsx(j.span,{...l,ref:v,style:{pointerEvents:"none"},children:tt(c.value)?i.jsx(i.Fragment,{children:r}):a})});ke.displayName=De;var Et="SelectIcon",Le=d.forwardRef((s,e)=>{const{__scopeSelect:t,children:o,...n}=s;return i.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});Le.displayName=Et;var Rt="SelectPortal",Be=s=>i.jsx(at,{asChild:!0,...s});Be.displayName=Rt;var Q="SelectContent",Ve=d.forwardRef((s,e)=>{const t=G(Q,s.__scopeSelect),[o,n]=d.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const a=o;return a?Ee.createPortal(i.jsx(He,{scope:s.__scopeSelect,children:i.jsx(de.Slot,{scope:s.__scopeSelect,children:i.jsx("div",{children:s.children})})}),a):null}return i.jsx(ze,{...s,ref:e})});Ve.displayName=Q;var A=10,[He,Y]=ne(Q),jt="SelectContentImpl",Mt=xt("SelectContent.RemoveScroll"),ze=d.forwardRef((s,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:a,onPointerDownOutside:r,side:l,sideOffset:c,align:u,alignOffset:m,arrowPadding:v,collisionBoundary:w,collisionPadding:C,sticky:S,hideWhenDetached:p,avoidCollisions:g,...y}=s,h=G(Q,t),[x,F]=d.useState(null),[M,se]=d.useState(null),_=k(e,f=>F(f)),[O,U]=d.useState(null),[q,L]=d.useState(null),B=ue(t),[W,V]=d.useState(!1),H=d.useRef(!1);d.useEffect(()=>{if(x)return pt(x)},[x]),ft();const E=d.useCallback(f=>{const[T,...R]=B().map(N=>N.ref.current),[b]=R.slice(-1),I=document.activeElement;for(const N of f)if(N===I||(N?.scrollIntoView({block:"nearest"}),N===T&&M&&(M.scrollTop=0),N===b&&M&&(M.scrollTop=M.scrollHeight),N?.focus(),document.activeElement!==I))return},[B,M]),D=d.useCallback(()=>E([O,x]),[E,O,x]);d.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=h;d.useEffect(()=>{if(x){let f={x:0,y:0};const T=b=>{f={x:Math.abs(Math.round(b.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(b.pageY)-(K.current?.y??0))}},R=b=>{f.x<=10&&f.y<=10?b.preventDefault():x.contains(b.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]),d.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]=ot(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),b=nt(T,f,R);b&&setTimeout(()=>b.ref.current.focus())}),me=d.useCallback((f,T,R)=>{const b=!H.current&&!R;(h.value!==void 0&&h.value===T||b)&&(U(f),b&&(H.current=!0))},[h.value]),he=d.useCallback(()=>x?.focus(),[x]),te=d.useCallback((f,T,R)=>{const b=!H.current&&!R;(h.value!==void 0&&h.value===T||b)&&L(f)},[h.value]),ce=o==="popper"?Se:Fe,re=ce===Se?{side:l,sideOffset:c,align:u,alignOffset:m,arrowPadding:v,collisionBoundary:w,collisionPadding:C,sticky:S,hideWhenDetached:p,avoidCollisions:g}:{};return i.jsx(He,{scope:t,content:x,viewport:M,onViewportChange:se,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:i.jsx(mt,{as:Mt,allowPinchZoom:!0,children:i.jsx(ht,{asChild:!0,trapped:h.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(n,f=>{h.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:i.jsx(gt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:r,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:i.jsx(ce,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:f=>f.preventDefault(),...y,...re,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:P(y.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 b=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(b=b.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,N=b.indexOf(I);b=b.slice(N+1)}setTimeout(()=>E(b)),f.preventDefault()}})})})})})})});ze.displayName=jt;var At="SelectItemAlignedPosition",Fe=d.forwardRef((s,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=s,a=G(Q,t),r=Y(Q,t),[l,c]=d.useState(null),[u,m]=d.useState(null),v=k(e,_=>m(_)),w=ue(t),C=d.useRef(!1),S=d.useRef(!0),{viewport:p,selectedItem:g,selectedItemText:y,focusSelectedItem:h}=r,x=d.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&u&&p&&g&&y){const _=a.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),U=a.valueNode.getBoundingClientRect(),q=y.getBoundingClientRect();if(a.dir!=="rtl"){const I=q.left-O.left,N=U.left-I,X=_.left-N,Z=_.width+X,ge=Math.max(Z,O.width),ve=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ve-ge)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-U.right-I,X=window.innerWidth-_.right-N,Z=_.width+X,ge=Math.max(Z,O.width),ve=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ve-ge)]);l.style.minWidth=Z+"px",l.style.right=xe+"px"}const L=w(),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(g.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ce=B-te,re=g.offsetHeight/2,f=g.offsetTop+re,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&g===L[L.length-1].ref.current;l.style.bottom="0px";const N=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ce,re+(I?he:0)+N+D),Z=T+X;l.style.height=Z+"px"}else{const I=L.length>0&&g===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(I?me:0)+re)+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(()=>C.current=!0)}},[w,a.trigger,a.valueNode,l,u,p,g,y,a.dir,o]);$(()=>x(),[x]);const[F,M]=d.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const se=d.useCallback(_=>{_&&S.current===!0&&(x(),h?.(),S.current=!1)},[x,h]);return i.jsx(Dt,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:C,onScrollButtonChange:se,children:i.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:i.jsx(j.div,{...n,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});Fe.displayName=At;var Ot="SelectPopperPosition",Se=d.forwardRef((s,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...a}=s,r=pe(t);return i.jsx(St,{...r,...a,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...a.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=Ot;var[Dt,Te]=ne(Q,{}),we="SelectViewport",Ue=d.forwardRef((s,e)=>{const{__scopeSelect:t,nonce:o,...n}=s,a=Y(we,t),r=Te(we,t),l=k(e,a.onViewportChange),c=d.useRef(0);return i.jsxs(i.Fragment,{children:[i.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}),i.jsx(de.Slot,{scope:t,children:i.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:P(n.onScroll,u=>{const m=u.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:w}=r;if(w?.current&&v){const C=Math.abs(c.current-m.scrollTop);if(C>0){const S=window.innerHeight-A*2,p=parseFloat(v.style.minHeight),g=parseFloat(v.style.height),y=Math.max(p,g);if(y<S){const h=y+C,x=Math.min(S,h),F=h-x;v.style.height=x+"px",v.style.bottom==="0px"&&(m.scrollTop=F>0?F:0,v.style.justifyContent="flex-end")}}}c.current=m.scrollTop})})})]})});Ue.displayName=we;var We="SelectGroup",[kt,Lt]=ne(We),Bt=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s,n=Ie();return i.jsx(kt,{scope:t,id:n,children:i.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Bt.displayName=We;var Ke="SelectLabel",Vt=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s,n=Lt(Ke,t);return i.jsx(j.div,{id:n.id,...o,ref:e})});Vt.displayName=Ke;var ie="SelectItem",[Ht,$e]=ne(ie),Ge=d.forwardRef((s,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:a,...r}=s,l=G(ie,t),c=Y(ie,t),u=l.value===o,[m,v]=d.useState(a??""),[w,C]=d.useState(!1),S=k(e,h=>c.itemRefCallback?.(h,o,n)),p=Ie(),g=d.useRef("touch"),y=()=>{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 i.jsx(Ht,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:d.useCallback(h=>{v(x=>x||(h?.textContent??"").trim())},[]),children:i.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:m,children:i.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":w?"":void 0,"aria-selected":u&&w,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...r,ref:S,onFocus:P(r.onFocus,()=>C(!0)),onBlur:P(r.onBlur,()=>C(!1)),onClick:P(r.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:P(r.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:P(r.onPointerDown,h=>{g.current=h.pointerType}),onPointerMove:P(r.onPointerMove,h=>{g.current=h.pointerType,n?c.onItemLeave?.():g.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(r.onPointerLeave,h=>{h.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:P(r.onKeyDown,h=>{c.searchRef?.current!==""&&h.key===" "||(It.includes(h.key)&&y(),h.key===" "&&h.preventDefault())})})})})});Ge.displayName=ie;var le="SelectItemText",Ye=d.forwardRef((s,e)=>{const{__scopeSelect:t,className:o,style:n,...a}=s,r=G(le,t),l=Y(le,t),c=$e(le,t),u=_t(le,t),[m,v]=d.useState(null),w=k(e,y=>v(y),c.onItemTextChange,y=>l.itemTextRefCallback?.(y,c.value,c.disabled)),C=m?.textContent,S=d.useMemo(()=>i.jsx("option",{value:c.value,disabled:c.disabled,children:C},c.value),[c.disabled,c.value,C]),{onNativeOptionAdd:p,onNativeOptionRemove:g}=u;return $(()=>(p(S),()=>g(S)),[p,g,S]),i.jsxs(i.Fragment,{children:[i.jsx(j.span,{id:c.textId,...a,ref:w}),c.isSelected&&r.valueNode&&!r.valueNodeHasChildren?Ee.createPortal(a.children,r.valueNode):null]})});Ye.displayName=le;var qe="SelectItemIndicator",Xe=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s;return $e(qe,t).isSelected?i.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});Xe.displayName=qe;var Ce="SelectScrollUpButton",Ze=d.forwardRef((s,e)=>{const t=Y(Ce,s.__scopeSelect),o=Te(Ce,s.__scopeSelect),[n,a]=d.useState(!1),r=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=c.scrollTop>0;a(u)};const c=t.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?i.jsx(Qe,{...s,ref:r,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=t;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Ze.displayName=Ce;var ye="SelectScrollDownButton",Je=d.forwardRef((s,e)=>{const t=Y(ye,s.__scopeSelect),o=Te(ye,s.__scopeSelect),[n,a]=d.useState(!1),r=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,m=Math.ceil(c.scrollTop)<u;a(m)};const c=t.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?i.jsx(Qe,{...s,ref:r,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=t;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Je.displayName=ye;var Qe=d.forwardRef((s,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=s,a=Y("SelectScrollButton",t),r=d.useRef(null),l=ue(t),c=d.useCallback(()=>{r.current!==null&&(window.clearInterval(r.current),r.current=null)},[]);return d.useEffect(()=>()=>c(),[c]),$(()=>{l().find(m=>m.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),i.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:P(n.onPointerDown,()=>{r.current===null&&(r.current=window.setInterval(o,50))}),onPointerMove:P(n.onPointerMove,()=>{a.onItemLeave?.(),r.current===null&&(r.current=window.setInterval(o,50))}),onPointerLeave:P(n.onPointerLeave,()=>{c()})})}),zt="SelectSeparator",Ft=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s;return i.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});Ft.displayName=zt;var be="SelectArrow",Ut=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s,n=pe(t),a=G(be,t),r=Y(be,t);return a.open&&r.position==="popper"?i.jsx(wt,{...n,...o,ref:e}):null});Ut.displayName=be;var Wt="SelectBubbleInput",et=d.forwardRef(({__scopeSelect:s,value:e,...t},o)=>{const n=d.useRef(null),a=k(o,n),r=it(e);return d.useEffect(()=>{const l=n.current;if(!l)return;const c=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(c,"value").set;if(r!==e&&m){const v=new Event("change",{bubbles:!0});m.call(l,e),l.dispatchEvent(v)}},[r,e]),i.jsx(j.select,{...t,style:{...dt,...t.style},ref:a,defaultValue:e})});et.displayName=Wt;function tt(s){return s===""||s===void 0}function ot(s){const e=ut(s),t=d.useRef(""),o=d.useRef(0),n=d.useCallback(r=>{const l=t.current+r;e(l),(function c(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>c(""),1e3))})(l)},[e]),a=d.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return d.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,a]}function nt(s,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,a=t?s.indexOf(t):-1;let r=Kt(s,Math.max(a,0));n.length===1&&(r=r.filter(u=>u!==t));const c=r.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return c!==t?c:void 0}function Kt(s,e){return s.map((t,o)=>s[(e+o)%s.length])}var $t=Me,Gt=Oe,Yt=ke,qt=Le,Xt=Be,Zt=Ve,Jt=Ue,Qt=Ge,_e=Ye,eo=Xe,to=Ze,oo=Je;function co(s){const e=ee.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx($t,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function io(s){const e=ee.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx(Yt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function uo(s){const e=ee.c(13);let t,o,n,a;e[0]!==s?({className:o,size:a,children:t,...n}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=n,e[4]=a):(t=e[1],o=e[2],n=e[3],a=e[4]);const r=a===void 0?"default":a;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 c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(qt,{asChild:!0,children:i.jsx(je,{className:"size-4 opacity-50"})}),e[7]=c):c=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==r||e[11]!==l?(u=i.jsxs(Gt,{"data-slot":"select-trigger","data-size":r,className:l,...n,children:[t,c]}),e[8]=t,e[9]=n,e[10]=r,e[11]=l,e[12]=u):u=e[12],u}function po(s){const e=ee.c(25);let t,o,n,a,r;e[0]!==s?({className:o,children:t,position:a,hideScrollButtons:r,...n}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=n,e[4]=a,e[5]=r):(t=e[1],o=e[2],n=e[3],a=e[4],r=e[5]);const l=a===void 0?"popper":a,c=r===void 0?!1:r,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 m;e[6]!==o||e[7]!==u?(m=oe("notranslate 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]=m):m=e[8];let v;e[9]!==c?(v=!c&&i.jsx(no,{}),e[9]=c,e[10]=v):v=e[10];const w=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let C;e[11]!==w?(C=oe("p-1",w),e[11]=w,e[12]=C):C=e[12];let S;e[13]!==t||e[14]!==C?(S=i.jsx(Jt,{className:C,children:t}),e[13]=t,e[14]=C,e[15]=S):S=e[15];let p;e[16]!==c?(p=!c&&i.jsx(so,{}),e[16]=c,e[17]=p):p=e[17];let g;return e[18]!==l||e[19]!==n||e[20]!==m||e[21]!==v||e[22]!==S||e[23]!==p?(g=i.jsx(Xt,{children:i.jsxs(Zt,{"data-slot":"select-content",translate:"no",className:m,position:l,...n,children:[v,S,p]})}),e[18]=l,e[19]=n,e[20]=m,e[21]=v,e[22]=S,e[23]=p,e[24]=g):g=e[24],g}function fo(s){const e=ee.c(19);let t,o,n,a,r;e[0]!==s?({className:o,children:t,description:n,hideCheck:r,...a}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=n,e[4]=a,e[5]=r):(t=e[1],o=e[2],n=e[3],a=e[4],r=e[5]);const l=r===void 0?!1:r,c=n&&"items-start py-2";let u;e[6]!==o||e[7]!==c?(u=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",c,o),e[6]=o,e[7]=c,e[8]=u):u=e[8];let m;e[9]!==l?(m=!l&&i.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:i.jsx(eo,{children:i.jsx(Ct,{className:"size-4"})})}),e[9]=l,e[10]=m):m=e[10];let v;e[11]!==t||e[12]!==n?(v=n?i.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[i.jsx(_e,{children:t}),i.jsx("span",{className:"text-xs text-muted-foreground whitespace-normal",children:n})]}):i.jsx(_e,{children:t}),e[11]=t,e[12]=n,e[13]=v):v=e[13];let w;return e[14]!==a||e[15]!==u||e[16]!==m||e[17]!==v?(w=i.jsxs(Qt,{"data-slot":"select-item",className:u,...a,children:[m,v]}),e[14]=a,e[15]=u,e[16]=m,e[17]=v,e[18]=w):w=e[18],w}function no(s){const e=ee.c(9);let t,o;e[0]!==s?({className:t,...o}=s,e[0]=s,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 a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(yt,{className:"size-4"}),e[5]=a):a=e[5];let r;return e[6]!==o||e[7]!==n?(r=i.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:a}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r}function so(s){const e=ee.c(9);let t,o;e[0]!==s?({className:t,...o}=s,e[0]=s,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 a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(je,{className:"size-4"}),e[5]=a):a=e[5];let r;return e[6]!==o||e[7]!==n?(r=i.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:a}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r}export{co as S,io as a,uo as b,fo as c,po as d,Pe as e};
1
+ import{r as d,br as st,bp as Ne,j as i,e1 as rt,bt as Ie,bq as k,e2 as lt,bm as j,bs as P,cH as $,e3 as at,aB as Ee,e4 as Re,bn as ct,cC as it,e5 as dt,cL as ut,e6 as pt,e7 as ft,e8 as mt,e9 as ht,ea as gt,bo as vt,eb as xt,ec as St,ed as wt,c as ee,l as oe}from"./index-B0enqYLp.js";import{i as Ct}from"./Check-BxuFlA_Q.js";import{t as je,n as yt}from"./ChevronUp-DeObbE8r.js";function Pe(s,[e,t]){return Math.min(t,Math.max(e,s))}var bt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,Tt]=ct(J),[ne]=vt(J,[Tt,Re]),pe=Re(),[Nt,G]=ne(J),[Pt,_t]=ne(J),Me=s=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:a,value:r,defaultValue:l,onValueChange:c,dir:u,name:m,autoComplete:v,disabled:w,required:C,form:S}=s,p=pe(e),[g,y]=d.useState(null),[h,x]=d.useState(null),[F,M]=d.useState(!1),se=st(u),[_,O]=Ne({prop:o,defaultProp:n??!1,onChange:a,caller:J}),[U,q]=Ne({prop:r,defaultProp:l,onChange:c,caller:J}),L=d.useRef(null),B=g?S||!!g.closest("form"):!0,[W,V]=d.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return i.jsx(rt,{...p,children:i.jsxs(Nt,{required:C,scope:e,trigger:g,onTriggerChange:y,valueNode:h,onValueNodeChange:x,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:Ie(),value:U,onValueChange:q,open:_,onOpenChange:O,dir:se,triggerPointerDownPosRef:L,disabled:w,children:[i.jsx(de.Provider,{scope:e,children:i.jsx(Pt,{scope:s.__scopeSelect,onNativeOptionAdd:d.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:d.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?i.jsxs(et,{"aria-hidden":!0,required:C,tabIndex:-1,name:m,autoComplete:v,value:U,onChange:E=>q(E.target.value),disabled:w,form:S,children:[U===void 0?i.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};Me.displayName=J;var Ae="SelectTrigger",Oe=d.forwardRef((s,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=s,a=pe(t),r=G(Ae,t),l=r.disabled||o,c=k(e,r.onTriggerChange),u=ue(t),m=d.useRef("touch"),[v,w,C]=ot(p=>{const g=u().filter(x=>!x.disabled),y=g.find(x=>x.value===r.value),h=nt(g,p,y);h!==void 0&&r.onValueChange(h.value)}),S=p=>{l||(r.onOpenChange(!0),C()),p&&(r.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return i.jsx(lt,{asChild:!0,...a,children:i.jsx(j.button,{type:"button",role:"combobox","aria-controls":r.contentId,"aria-expanded":r.open,"aria-required":r.required,"aria-autocomplete":"none",dir:r.dir,"data-state":r.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":tt(r.value)?"":void 0,...n,ref:c,onClick:P(n.onClick,p=>{p.currentTarget.focus(),m.current!=="mouse"&&S(p)}),onPointerDown:P(n.onPointerDown,p=>{m.current=p.pointerType;const g=p.target;g.hasPointerCapture(p.pointerId)&&g.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:P(n.onKeyDown,p=>{const g=v.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&w(p.key),!(g&&p.key===" ")&&bt.includes(p.key)&&(S(),p.preventDefault())})})})});Oe.displayName=Ae;var De="SelectValue",ke=d.forwardRef((s,e)=>{const{__scopeSelect:t,className:o,style:n,children:a,placeholder:r="",...l}=s,c=G(De,t),{onValueNodeHasChildrenChange:u}=c,m=a!==void 0,v=k(e,c.onValueNodeChange);return $(()=>{u(m)},[u,m]),i.jsx(j.span,{...l,ref:v,style:{pointerEvents:"none"},children:tt(c.value)?i.jsx(i.Fragment,{children:r}):a})});ke.displayName=De;var Et="SelectIcon",Le=d.forwardRef((s,e)=>{const{__scopeSelect:t,children:o,...n}=s;return i.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});Le.displayName=Et;var Rt="SelectPortal",Be=s=>i.jsx(at,{asChild:!0,...s});Be.displayName=Rt;var Q="SelectContent",Ve=d.forwardRef((s,e)=>{const t=G(Q,s.__scopeSelect),[o,n]=d.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const a=o;return a?Ee.createPortal(i.jsx(He,{scope:s.__scopeSelect,children:i.jsx(de.Slot,{scope:s.__scopeSelect,children:i.jsx("div",{children:s.children})})}),a):null}return i.jsx(ze,{...s,ref:e})});Ve.displayName=Q;var A=10,[He,Y]=ne(Q),jt="SelectContentImpl",Mt=xt("SelectContent.RemoveScroll"),ze=d.forwardRef((s,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:a,onPointerDownOutside:r,side:l,sideOffset:c,align:u,alignOffset:m,arrowPadding:v,collisionBoundary:w,collisionPadding:C,sticky:S,hideWhenDetached:p,avoidCollisions:g,...y}=s,h=G(Q,t),[x,F]=d.useState(null),[M,se]=d.useState(null),_=k(e,f=>F(f)),[O,U]=d.useState(null),[q,L]=d.useState(null),B=ue(t),[W,V]=d.useState(!1),H=d.useRef(!1);d.useEffect(()=>{if(x)return pt(x)},[x]),ft();const E=d.useCallback(f=>{const[T,...R]=B().map(N=>N.ref.current),[b]=R.slice(-1),I=document.activeElement;for(const N of f)if(N===I||(N?.scrollIntoView({block:"nearest"}),N===T&&M&&(M.scrollTop=0),N===b&&M&&(M.scrollTop=M.scrollHeight),N?.focus(),document.activeElement!==I))return},[B,M]),D=d.useCallback(()=>E([O,x]),[E,O,x]);d.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=h;d.useEffect(()=>{if(x){let f={x:0,y:0};const T=b=>{f={x:Math.abs(Math.round(b.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(b.pageY)-(K.current?.y??0))}},R=b=>{f.x<=10&&f.y<=10?b.preventDefault():x.contains(b.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]),d.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]=ot(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),b=nt(T,f,R);b&&setTimeout(()=>b.ref.current.focus())}),me=d.useCallback((f,T,R)=>{const b=!H.current&&!R;(h.value!==void 0&&h.value===T||b)&&(U(f),b&&(H.current=!0))},[h.value]),he=d.useCallback(()=>x?.focus(),[x]),te=d.useCallback((f,T,R)=>{const b=!H.current&&!R;(h.value!==void 0&&h.value===T||b)&&L(f)},[h.value]),ce=o==="popper"?Se:Fe,re=ce===Se?{side:l,sideOffset:c,align:u,alignOffset:m,arrowPadding:v,collisionBoundary:w,collisionPadding:C,sticky:S,hideWhenDetached:p,avoidCollisions:g}:{};return i.jsx(He,{scope:t,content:x,viewport:M,onViewportChange:se,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:i.jsx(mt,{as:Mt,allowPinchZoom:!0,children:i.jsx(ht,{asChild:!0,trapped:h.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(n,f=>{h.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:i.jsx(gt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:r,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:i.jsx(ce,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:f=>f.preventDefault(),...y,...re,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:P(y.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 b=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(b=b.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,N=b.indexOf(I);b=b.slice(N+1)}setTimeout(()=>E(b)),f.preventDefault()}})})})})})})});ze.displayName=jt;var At="SelectItemAlignedPosition",Fe=d.forwardRef((s,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=s,a=G(Q,t),r=Y(Q,t),[l,c]=d.useState(null),[u,m]=d.useState(null),v=k(e,_=>m(_)),w=ue(t),C=d.useRef(!1),S=d.useRef(!0),{viewport:p,selectedItem:g,selectedItemText:y,focusSelectedItem:h}=r,x=d.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&u&&p&&g&&y){const _=a.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),U=a.valueNode.getBoundingClientRect(),q=y.getBoundingClientRect();if(a.dir!=="rtl"){const I=q.left-O.left,N=U.left-I,X=_.left-N,Z=_.width+X,ge=Math.max(Z,O.width),ve=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ve-ge)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-U.right-I,X=window.innerWidth-_.right-N,Z=_.width+X,ge=Math.max(Z,O.width),ve=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ve-ge)]);l.style.minWidth=Z+"px",l.style.right=xe+"px"}const L=w(),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(g.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ce=B-te,re=g.offsetHeight/2,f=g.offsetTop+re,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&g===L[L.length-1].ref.current;l.style.bottom="0px";const N=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ce,re+(I?he:0)+N+D),Z=T+X;l.style.height=Z+"px"}else{const I=L.length>0&&g===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(I?me:0)+re)+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(()=>C.current=!0)}},[w,a.trigger,a.valueNode,l,u,p,g,y,a.dir,o]);$(()=>x(),[x]);const[F,M]=d.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const se=d.useCallback(_=>{_&&S.current===!0&&(x(),h?.(),S.current=!1)},[x,h]);return i.jsx(Dt,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:C,onScrollButtonChange:se,children:i.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:i.jsx(j.div,{...n,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});Fe.displayName=At;var Ot="SelectPopperPosition",Se=d.forwardRef((s,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...a}=s,r=pe(t);return i.jsx(St,{...r,...a,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...a.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=Ot;var[Dt,Te]=ne(Q,{}),we="SelectViewport",Ue=d.forwardRef((s,e)=>{const{__scopeSelect:t,nonce:o,...n}=s,a=Y(we,t),r=Te(we,t),l=k(e,a.onViewportChange),c=d.useRef(0);return i.jsxs(i.Fragment,{children:[i.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}),i.jsx(de.Slot,{scope:t,children:i.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:P(n.onScroll,u=>{const m=u.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:w}=r;if(w?.current&&v){const C=Math.abs(c.current-m.scrollTop);if(C>0){const S=window.innerHeight-A*2,p=parseFloat(v.style.minHeight),g=parseFloat(v.style.height),y=Math.max(p,g);if(y<S){const h=y+C,x=Math.min(S,h),F=h-x;v.style.height=x+"px",v.style.bottom==="0px"&&(m.scrollTop=F>0?F:0,v.style.justifyContent="flex-end")}}}c.current=m.scrollTop})})})]})});Ue.displayName=we;var We="SelectGroup",[kt,Lt]=ne(We),Bt=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s,n=Ie();return i.jsx(kt,{scope:t,id:n,children:i.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Bt.displayName=We;var Ke="SelectLabel",Vt=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s,n=Lt(Ke,t);return i.jsx(j.div,{id:n.id,...o,ref:e})});Vt.displayName=Ke;var ie="SelectItem",[Ht,$e]=ne(ie),Ge=d.forwardRef((s,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:a,...r}=s,l=G(ie,t),c=Y(ie,t),u=l.value===o,[m,v]=d.useState(a??""),[w,C]=d.useState(!1),S=k(e,h=>c.itemRefCallback?.(h,o,n)),p=Ie(),g=d.useRef("touch"),y=()=>{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 i.jsx(Ht,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:d.useCallback(h=>{v(x=>x||(h?.textContent??"").trim())},[]),children:i.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:m,children:i.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":w?"":void 0,"aria-selected":u&&w,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...r,ref:S,onFocus:P(r.onFocus,()=>C(!0)),onBlur:P(r.onBlur,()=>C(!1)),onClick:P(r.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:P(r.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:P(r.onPointerDown,h=>{g.current=h.pointerType}),onPointerMove:P(r.onPointerMove,h=>{g.current=h.pointerType,n?c.onItemLeave?.():g.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(r.onPointerLeave,h=>{h.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:P(r.onKeyDown,h=>{c.searchRef?.current!==""&&h.key===" "||(It.includes(h.key)&&y(),h.key===" "&&h.preventDefault())})})})})});Ge.displayName=ie;var le="SelectItemText",Ye=d.forwardRef((s,e)=>{const{__scopeSelect:t,className:o,style:n,...a}=s,r=G(le,t),l=Y(le,t),c=$e(le,t),u=_t(le,t),[m,v]=d.useState(null),w=k(e,y=>v(y),c.onItemTextChange,y=>l.itemTextRefCallback?.(y,c.value,c.disabled)),C=m?.textContent,S=d.useMemo(()=>i.jsx("option",{value:c.value,disabled:c.disabled,children:C},c.value),[c.disabled,c.value,C]),{onNativeOptionAdd:p,onNativeOptionRemove:g}=u;return $(()=>(p(S),()=>g(S)),[p,g,S]),i.jsxs(i.Fragment,{children:[i.jsx(j.span,{id:c.textId,...a,ref:w}),c.isSelected&&r.valueNode&&!r.valueNodeHasChildren?Ee.createPortal(a.children,r.valueNode):null]})});Ye.displayName=le;var qe="SelectItemIndicator",Xe=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s;return $e(qe,t).isSelected?i.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});Xe.displayName=qe;var Ce="SelectScrollUpButton",Ze=d.forwardRef((s,e)=>{const t=Y(Ce,s.__scopeSelect),o=Te(Ce,s.__scopeSelect),[n,a]=d.useState(!1),r=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=c.scrollTop>0;a(u)};const c=t.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?i.jsx(Qe,{...s,ref:r,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=t;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Ze.displayName=Ce;var ye="SelectScrollDownButton",Je=d.forwardRef((s,e)=>{const t=Y(ye,s.__scopeSelect),o=Te(ye,s.__scopeSelect),[n,a]=d.useState(!1),r=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,m=Math.ceil(c.scrollTop)<u;a(m)};const c=t.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?i.jsx(Qe,{...s,ref:r,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=t;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Je.displayName=ye;var Qe=d.forwardRef((s,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=s,a=Y("SelectScrollButton",t),r=d.useRef(null),l=ue(t),c=d.useCallback(()=>{r.current!==null&&(window.clearInterval(r.current),r.current=null)},[]);return d.useEffect(()=>()=>c(),[c]),$(()=>{l().find(m=>m.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),i.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:P(n.onPointerDown,()=>{r.current===null&&(r.current=window.setInterval(o,50))}),onPointerMove:P(n.onPointerMove,()=>{a.onItemLeave?.(),r.current===null&&(r.current=window.setInterval(o,50))}),onPointerLeave:P(n.onPointerLeave,()=>{c()})})}),zt="SelectSeparator",Ft=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s;return i.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});Ft.displayName=zt;var be="SelectArrow",Ut=d.forwardRef((s,e)=>{const{__scopeSelect:t,...o}=s,n=pe(t),a=G(be,t),r=Y(be,t);return a.open&&r.position==="popper"?i.jsx(wt,{...n,...o,ref:e}):null});Ut.displayName=be;var Wt="SelectBubbleInput",et=d.forwardRef(({__scopeSelect:s,value:e,...t},o)=>{const n=d.useRef(null),a=k(o,n),r=it(e);return d.useEffect(()=>{const l=n.current;if(!l)return;const c=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(c,"value").set;if(r!==e&&m){const v=new Event("change",{bubbles:!0});m.call(l,e),l.dispatchEvent(v)}},[r,e]),i.jsx(j.select,{...t,style:{...dt,...t.style},ref:a,defaultValue:e})});et.displayName=Wt;function tt(s){return s===""||s===void 0}function ot(s){const e=ut(s),t=d.useRef(""),o=d.useRef(0),n=d.useCallback(r=>{const l=t.current+r;e(l),(function c(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>c(""),1e3))})(l)},[e]),a=d.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return d.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,a]}function nt(s,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,a=t?s.indexOf(t):-1;let r=Kt(s,Math.max(a,0));n.length===1&&(r=r.filter(u=>u!==t));const c=r.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return c!==t?c:void 0}function Kt(s,e){return s.map((t,o)=>s[(e+o)%s.length])}var $t=Me,Gt=Oe,Yt=ke,qt=Le,Xt=Be,Zt=Ve,Jt=Ue,Qt=Ge,_e=Ye,eo=Xe,to=Ze,oo=Je;function co(s){const e=ee.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx($t,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function io(s){const e=ee.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx(Yt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function uo(s){const e=ee.c(13);let t,o,n,a;e[0]!==s?({className:o,size:a,children:t,...n}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=n,e[4]=a):(t=e[1],o=e[2],n=e[3],a=e[4]);const r=a===void 0?"default":a;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 c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(qt,{asChild:!0,children:i.jsx(je,{className:"size-4 opacity-50"})}),e[7]=c):c=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==r||e[11]!==l?(u=i.jsxs(Gt,{"data-slot":"select-trigger","data-size":r,className:l,...n,children:[t,c]}),e[8]=t,e[9]=n,e[10]=r,e[11]=l,e[12]=u):u=e[12],u}function po(s){const e=ee.c(25);let t,o,n,a,r;e[0]!==s?({className:o,children:t,position:a,hideScrollButtons:r,...n}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=n,e[4]=a,e[5]=r):(t=e[1],o=e[2],n=e[3],a=e[4],r=e[5]);const l=a===void 0?"popper":a,c=r===void 0?!1:r,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 m;e[6]!==o||e[7]!==u?(m=oe("notranslate 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]=m):m=e[8];let v;e[9]!==c?(v=!c&&i.jsx(no,{}),e[9]=c,e[10]=v):v=e[10];const w=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let C;e[11]!==w?(C=oe("p-1",w),e[11]=w,e[12]=C):C=e[12];let S;e[13]!==t||e[14]!==C?(S=i.jsx(Jt,{className:C,children:t}),e[13]=t,e[14]=C,e[15]=S):S=e[15];let p;e[16]!==c?(p=!c&&i.jsx(so,{}),e[16]=c,e[17]=p):p=e[17];let g;return e[18]!==l||e[19]!==n||e[20]!==m||e[21]!==v||e[22]!==S||e[23]!==p?(g=i.jsx(Xt,{children:i.jsxs(Zt,{"data-slot":"select-content",translate:"no",className:m,position:l,...n,children:[v,S,p]})}),e[18]=l,e[19]=n,e[20]=m,e[21]=v,e[22]=S,e[23]=p,e[24]=g):g=e[24],g}function fo(s){const e=ee.c(19);let t,o,n,a,r;e[0]!==s?({className:o,children:t,description:n,hideCheck:r,...a}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=n,e[4]=a,e[5]=r):(t=e[1],o=e[2],n=e[3],a=e[4],r=e[5]);const l=r===void 0?!1:r,c=n&&"items-start py-2";let u;e[6]!==o||e[7]!==c?(u=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",c,o),e[6]=o,e[7]=c,e[8]=u):u=e[8];let m;e[9]!==l?(m=!l&&i.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:i.jsx(eo,{children:i.jsx(Ct,{className:"size-4"})})}),e[9]=l,e[10]=m):m=e[10];let v;e[11]!==t||e[12]!==n?(v=n?i.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[i.jsx(_e,{children:t}),i.jsx("span",{className:"text-xs text-muted-foreground whitespace-normal",children:n})]}):i.jsx(_e,{children:t}),e[11]=t,e[12]=n,e[13]=v):v=e[13];let w;return e[14]!==a||e[15]!==u||e[16]!==m||e[17]!==v?(w=i.jsxs(Qt,{"data-slot":"select-item",className:u,...a,children:[m,v]}),e[14]=a,e[15]=u,e[16]=m,e[17]=v,e[18]=w):w=e[18],w}function no(s){const e=ee.c(9);let t,o;e[0]!==s?({className:t,...o}=s,e[0]=s,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 a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(yt,{className:"size-4"}),e[5]=a):a=e[5];let r;return e[6]!==o||e[7]!==n?(r=i.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:a}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r}function so(s){const e=ee.c(9);let t,o;e[0]!==s?({className:t,...o}=s,e[0]=s,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 a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(je,{className:"size-4"}),e[5]=a):a=e[5];let r;return e[6]!==o||e[7]!==n?(r=i.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:a}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r}export{co as S,io as a,uo as b,fo as c,po as d,Pe as e};