decocms 3.78.0 → 3.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/dist/client/assets/{AlertCircle-Caru_t3W.js → AlertCircle-CKei65yQ.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-B2Dt0814.js → ArrowUpRight-BygwtcZ2.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-CpjuZYS5.js → CheckCircle-BZlFJbF8.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-DeW1WG4N.js → ChevronDown-DXOZkIso.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-DhtKqfYa.js → ChevronLeft-DPLHregZ.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-DSC2aiCG.js → ChevronRight-BkBgwZxs.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-CiZNoBS5.js → ChevronUp-BCwumcyZ.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-CAFbny0A.js → DotsVertical-DQDEDjEX.js} +1 -1
  9. package/dist/client/assets/{Eye-BSAOg3tU.js → Eye-IocHlobo.js} +1 -1
  10. package/dist/client/assets/{FilterLines-BWsEA6cc.js → FilterLines-dauCx8Za.js} +1 -1
  11. package/dist/client/assets/{Globe01-B8cJAk0V.js → Globe01-CQy0Cxa-.js} +1 -1
  12. package/dist/client/assets/{Globe04-BHoeDf9U.js → Globe04-CBuYvlRn.js} +1 -1
  13. package/dist/client/assets/{HardDrive-Ca-rpUZp.js → HardDrive-DSj8WeP3.js} +1 -1
  14. package/dist/client/assets/{Key01-hqliL23I.js → Key01-ktWRCkRP.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-DfLCxQJZ.js → LayoutLeft-TAhoC2xE.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-C-uuQSHY.js → LinkExternal01-BenQb5F0.js} +1 -1
  17. package/dist/client/assets/{Monitor01-C4mUj5DO.js → Monitor01-CF5y8J9X.js} +1 -1
  18. package/dist/client/assets/{Palette-BqPdnSvn.js → Palette-ZSzAttfE.js} +1 -1
  19. package/dist/client/assets/{Play-u3Xpo-3H.js → Play-BrJBHlm8.js} +1 -1
  20. package/dist/client/assets/{Plus-e8vsh1yI.js → Plus-DptVePQj.js} +1 -1
  21. package/dist/client/assets/{SearchMd-pbTyIZQ0.js → SearchMd-DmrRiPsU.js} +1 -1
  22. package/dist/client/assets/{Settings02-1OASYAA8.js → Settings02-BynaGT2l.js} +1 -1
  23. package/dist/client/assets/{Shield01-BZP4Q_Vm.js → Shield01-CGOi4o3B.js} +1 -1
  24. package/dist/client/assets/{Star01-BokvC0Yc.js → Star01-G7bzpuzw.js} +1 -1
  25. package/dist/client/assets/{Stars01-CM7BslwP.js → Stars01-BxW6Ze_W.js} +1 -1
  26. package/dist/client/assets/{Stars02-DTDItJ62.js → Stars02-CJJhFv2L.js} +1 -1
  27. package/dist/client/assets/{Sun-CO5Z2lcQ.js → Sun-CUZqy0kq.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-DCwdrg-O.js → SwitchHorizontal01-D04vL0_f.js} +1 -1
  29. package/dist/client/assets/{Tool01-BDvWQGEc.js → Tool01-hkwqrr6Q.js} +1 -1
  30. package/dist/client/assets/{Trash01-C3khOwsb.js → Trash01-Ds3jbDQE.js} +1 -1
  31. package/dist/client/assets/{Upload01-BWq8M5mQ.js → Upload01-Cuswrale.js} +1 -1
  32. package/dist/client/assets/{User01-B5NDreK2.js → User01-DJhz4tmk.js} +1 -1
  33. package/dist/client/assets/{Users01-BM4ZmEbl.js → Users01-D1GekRvz.js} +1 -1
  34. package/dist/client/assets/{Users03-DPSOJZh_.js → Users03-CjtA3d84.js} +1 -1
  35. package/dist/client/assets/{X-CdcmL6WW.js → X-CvnlrpyG.js} +1 -1
  36. package/dist/client/assets/{XCircle-YOrPaSTA.js → XCircle-CTJX6MKF.js} +1 -1
  37. package/dist/client/assets/{XClose-B1WSb9MQ.js → XClose-BbKrO-bh.js} +1 -1
  38. package/dist/client/assets/{Zap-CJ80I152.js → Zap-B-ccy6C4.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-CgWRLEJy.js → ZapSquare-bUJqwnW3.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-OytsIYD1.js → ZoomOut-DRnFWZo9.js} +1 -1
  41. package/dist/client/assets/{access-gate-DqzudH0L.js → access-gate-CAr_jPZ4.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-kp6f6erO.js → add-section-modal-DpjAnzTC.js} +1 -1
  43. package/dist/client/assets/{agent-icon-DY5w59uF.js → agent-icon-BB2_1lHd.js} +1 -1
  44. package/dist/client/assets/{agents-list-DDHbeg5p.js → agents-list-DhbMkPNU.js} +1 -1
  45. package/dist/client/assets/{ai-providers-P8q844Dm.js → ai-providers-B6285-0G.js} +1 -1
  46. package/dist/client/assets/{alert-FbljLOaQ.js → alert-B39DYg6q.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-BO7X_BMw.js → alert-dialog-gK63ktIU.js} +1 -1
  48. package/dist/client/assets/{app-editor-C4YX8u15.js → app-editor-CB02ERjc.js} +1 -1
  49. package/dist/client/assets/{auth-DpDDb6PJ.js → auth-DxKMCtEO.js} +1 -1
  50. package/dist/client/assets/{auth-catchall-BwEPZ9sp.js → auth-catchall-DAcTzerO.js} +1 -1
  51. package/dist/client/assets/auth-entry-Bu3ut1b9.js +1 -0
  52. package/dist/client/assets/{auth-split-layout-6kbG-q9M.js → auth-split-layout-Bo7x5X53.js} +1 -1
  53. package/dist/client/assets/{authenticate-and-persist-oauth-SkR5Q2kF.js → authenticate-and-persist-oauth-CXYJ_57C.js} +1 -1
  54. package/dist/client/assets/{automation-list-row-BZROLPDh.js → automation-list-row-BYfl9414.js} +1 -1
  55. package/dist/client/assets/{automation-runs-VqVE_yW9.js → automation-runs-DiHYOI-G.js} +1 -1
  56. package/dist/client/assets/{automations-1DiKFOBq.js → automations-Bqn5XkdY.js} +1 -1
  57. package/dist/client/assets/{avatar-C7RfbSV0.js → avatar-CfKY2_hs.js} +1 -1
  58. package/dist/client/assets/{badge-S-QCOrNN.js → badge-tlnu_6T3.js} +1 -1
  59. package/dist/client/assets/{block-document-CLeG1P-N.js → block-document-D35IO4X3.js} +1 -1
  60. package/dist/client/assets/{brand-context-GZiNd5v6.js → brand-context-CkTeGoic.js} +1 -1
  61. package/dist/client/assets/{buckets-DTeRBDWJ.js → buckets-CDBAN8NB.js} +1 -1
  62. package/dist/client/assets/{calendar-katBc34c.js → calendar-CaxcRF1k.js} +1 -1
  63. package/dist/client/assets/{capability-load-error-D72JLeT1.js → capability-load-error-Bab-5zvo.js} +1 -1
  64. package/dist/client/assets/{card-B0EjU25K.js → card-DU2I8eHH.js} +1 -1
  65. package/dist/client/assets/category-editor-CL_UxJoz.js +1 -0
  66. package/dist/client/assets/{chat-context-DdkEgZ9_.js → chat-context-CdOsOHQ0.js} +1 -1
  67. package/dist/client/assets/{checkbox-DbzbLYfL.js → checkbox-H7xxQ3iC.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-C9MRaugF.js → cli-auth-success-K-z0R_Ah.js} +1 -1
  69. package/dist/client/assets/{collection-detail-DU1VM1YR.js → collection-detail-C5Wn5oY4.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-BNnw7G4D.js → collection-display-button-DTs9IB7s.js} +1 -1
  71. package/dist/client/assets/{collection-search-hESxl20y.js → collection-search-ClGGT1KV.js} +1 -1
  72. package/dist/client/assets/{collection-tabs-99Rq6QsS.js → collection-tabs-xD0Ry7Iv.js} +1 -1
  73. package/dist/client/assets/{command-DJiJXkzC.js → command-CLZq7t6J.js} +1 -1
  74. package/dist/client/assets/commerce-onboarding-3oBhw9NK.js +1 -0
  75. package/dist/client/assets/{connect-desktop-dialog-DR4-xhbf.js → connect-desktop-dialog-BCsFp2qg.js} +1 -1
  76. package/dist/client/assets/{connection-card-CJjprKft.js → connection-card-CrUjfVJB.js} +1 -1
  77. package/dist/client/assets/{connection-detail-DZAfgvu2.js → connection-detail-BaKSwWVH.js} +1 -1
  78. package/dist/client/assets/{connection-form-helpers-DT5c99yt.js → connection-form-helpers-BqpyRjgd.js} +1 -1
  79. package/dist/client/assets/{connections-B3yso__h.js → connections-W9DsG8aw.js} +1 -1
  80. package/dist/client/assets/{context-menu-B3oZHh4c.js → context-menu-CqLno4KJ.js} +1 -1
  81. package/dist/client/assets/{decopilot-KvFscv5D.js → decopilot-B2PnahSO.js} +1 -1
  82. package/dist/client/assets/{decopilot-sse-pool-C9VeVJ93.js → decopilot-sse-pool-D8ZetksK.js} +1 -1
  83. package/dist/client/assets/{dialog-jX6bYdqO.js → dialog-9Dal6l7D.js} +1 -1
  84. package/dist/client/assets/{domain-settings-DSTf_XC1.js → domain-settings-L_Aj9ndM.js} +1 -1
  85. package/dist/client/assets/{drawer-EgN8HzIq.js → drawer-DW4IYbB1.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-BOrPFviJ.js → dropdown-menu-DveShRRm.js} +1 -1
  87. package/dist/client/assets/{empty-state-BZIY4ETU.js → empty-state-b7tnb7q2.js} +1 -1
  88. package/dist/client/assets/{extract-connection-data-Dz1SJTDF.js → extract-connection-data-BL81V9PY.js} +1 -1
  89. package/dist/client/assets/{file-explorer-CtIkaECZ.js → file-explorer-0kznGCON.js} +1 -1
  90. package/dist/client/assets/{file-type-icon-CiTHpOyi.js → file-type-icon-hjib5alc.js} +1 -1
  91. package/dist/client/assets/{files-D4cQybZ3.js → files-x3Ne7hb6.js} +1 -1
  92. package/dist/client/assets/{form-D-Lg2Vno.js → form-6Nre8f-k.js} +1 -1
  93. package/dist/client/assets/{general-BLLTGXVC.js → general-BuYCdj0r.js} +1 -1
  94. package/dist/client/assets/{github-repo-picker-BtGY0bTC.js → github-repo-picker-CdGt5INt.js} +1 -1
  95. package/dist/client/assets/{hooks-Bq2gpnHq.js → hooks-Gm6nJHH5.js} +1 -1
  96. package/dist/client/assets/{image-field-CopsGD8K.js → image-field-CfVmwwEw.js} +1 -1
  97. package/dist/client/assets/{import-from-deco-dialog-DTeSs8zZ.js → import-from-deco-dialog-COzfTmtE.js} +1 -1
  98. package/dist/client/assets/{index-OWX18MdF.js → index-ARPJar1Z.js} +1 -1
  99. package/dist/client/assets/{index-an-q9BoC.js → index-BsTDFmrB.js} +1 -1
  100. package/dist/client/assets/{index-B_T2Tm_n.js → index-C5uKx36f.js} +1 -1
  101. package/dist/client/assets/{index-D9cso_OE.js → index-C6QaS0Zh.js} +3 -3
  102. package/dist/client/assets/{index-DjsYubVL.js → index-CaL7muMy.js} +1 -1
  103. package/dist/client/assets/{index-DsuFa3M3.js → index-DB4Y8lPy.js} +1 -1
  104. package/dist/client/assets/{index-TfVSao84.js → index-DXWbUTbb.js} +1 -1
  105. package/dist/client/assets/index-DYNdZRHD.css +1 -0
  106. package/dist/client/assets/{index-CwCkKeIW.js → index-DcLVAN0f.js} +1 -1
  107. package/dist/client/assets/{index-CApC7A2-.js → index-DllFGtwL.js} +1 -1
  108. package/dist/client/assets/{index-BIlZxD1s.js → index-SIbEiNOY.js} +1 -1
  109. package/dist/client/assets/{index-FMQJTdgj.js → index-_NByWM-i.js} +1 -1
  110. package/dist/client/assets/{index-CpN1_PlS.js → index-gAhVY6Qu.js} +1 -1
  111. package/dist/client/assets/{index-DJ0Ge3cT.js → index-ki8HSB2c.js} +4 -4
  112. package/dist/client/assets/{index-redirect-B5cnslmT.js → index-redirect-ChQQXx0A.js} +1 -1
  113. package/dist/client/assets/{index-BMuKOY-R.js → index-royGCF58.js} +1 -1
  114. package/dist/client/assets/{input-aftZq0qp.js → input-szhd6Snj.js} +1 -1
  115. package/dist/client/assets/integration-icon-XSMgSpds.js +1 -0
  116. package/dist/client/assets/{label-BlTB1rsr.js → label-Bjb_vEVQ.js} +1 -1
  117. package/dist/client/assets/{login-DwqD6H9f.js → login-C6SDd68X.js} +1 -1
  118. package/dist/client/assets/{mcp-oauth-DYo7_iWt.js → mcp-oauth-8Oqz2kjD.js} +1 -1
  119. package/dist/client/assets/{members-BAmGZs_l.js → members-BZMsTuPj.js} +1 -1
  120. package/dist/client/assets/{monaco-editor-dFjmNtXr.js → monaco-editor-Bzp2tCW_.js} +1 -1
  121. package/dist/client/assets/{monitoring-stats-row-DXzyXSPo.js → monitoring-stats-row-Q-gDhXN7.js} +1 -1
  122. package/dist/client/assets/{oauth-callback-BnUvVOzM.js → oauth-callback-C41rH1zN.js} +1 -1
  123. package/dist/client/assets/{oauth-callback-ai-provider-CtGpymDw.js → oauth-callback-ai-provider-L9Z7KnVB.js} +1 -1
  124. package/dist/client/assets/{onboarding-tHyZv_uW.js → onboarding-sxFOChym.js} +1 -1
  125. package/dist/client/assets/{org-install-BJnctrXU.js → org-install-DjUJMgS3.js} +1 -1
  126. package/dist/client/assets/{org-layout-DgadVfYy.js → org-layout-C4CQO9nz.js} +1 -1
  127. package/dist/client/assets/{organization-choice-HfpQcKxS.js → organization-choice-CPVuyoim.js} +1 -1
  128. package/dist/client/assets/{page-seo-form-j7a8Z1BY.js → page-seo-form--ih05Y7N.js} +1 -1
  129. package/dist/client/assets/page-seo-sheet-BGthAy6g.js +1 -0
  130. package/dist/client/assets/{popover-D43tJ8in.js → popover-CJ-idfVW.js} +1 -1
  131. package/dist/client/assets/{post-editor-XU3B2wmV.js → post-editor-BhGUUjQx.js} +1 -1
  132. package/dist/client/assets/{preview-dialog-BrHmAwG0.js → preview-dialog-WfNb4k8L.js} +1 -1
  133. package/dist/client/assets/{primitives-BRyBxVlk.js → primitives-BmQhQ3Bl.js} +1 -1
  134. package/dist/client/assets/{profile-CLM3LuOb.js → profile-C2hbZXR_.js} +1 -1
  135. package/dist/client/assets/project-app-view-QWISlKTP.js +1 -0
  136. package/dist/client/assets/record-editor-D9nFQqRP.js +1 -0
  137. package/dist/client/assets/registry-C4EXobcg.js +2 -0
  138. package/dist/client/assets/{registry-layout-pqx5X3wF.js → registry-layout-BSbINHnj.js} +1 -1
  139. package/dist/client/assets/{require-capability-BQ22Wt23.js → require-capability-D2kIyw8V.js} +1 -1
  140. package/dist/client/assets/{required-auth-layout-wApn6jVI.js → required-auth-layout-BbLd1LMa.js} +1 -1
  141. package/dist/client/assets/{reset-password-deaGgEkO.js → reset-password-lidTRlgJ.js} +1 -1
  142. package/dist/client/assets/{roles-RG2bRHsu.js → roles-7cj_C6tf.js} +1 -1
  143. package/dist/client/assets/save-referenced-block-Dw7QM0hK.js +1 -0
  144. package/dist/client/assets/{save-status-BiRx7JAD.js → save-status-BkW3fzUs.js} +1 -1
  145. package/dist/client/assets/{schema-form-sBBUMk07.js → schema-form-Cg7Lxy8-.js} +1 -1
  146. package/dist/client/assets/{scroll-area-BSGl-_zx.js → scroll-area-Dz-FqKWj.js} +1 -1
  147. package/dist/client/assets/{search-input-Cn14rzZS.js → search-input-DjVPTtCb.js} +1 -1
  148. package/dist/client/assets/{secrets-D-nSpmHI.js → secrets-BJZgSFDD.js} +1 -1
  149. package/dist/client/assets/{sections-editor-NjvzZlHu.js → sections-editor-ez2BbDtS.js} +1 -1
  150. package/dist/client/assets/{select-BGb-ZPds.js → select-FwtHY18v.js} +1 -1
  151. package/dist/client/assets/{select-model-C_rVNd_q.js → select-model-Bf7O5MiJ.js} +1 -1
  152. package/dist/client/assets/{seo-editor-Bvd2538m.js → seo-editor-BtQCMu5l.js} +1 -1
  153. package/dist/client/assets/{settings-layout-CrGAcHuU.js → settings-layout-DDlBA-ta.js} +1 -1
  154. package/dist/client/assets/{settings-section-Bc3yjWcB.js → settings-section-PIk2gDH0.js} +1 -1
  155. package/dist/client/assets/{sheet-HFHR_AuU.js → sheet-BvSpiY2r.js} +1 -1
  156. package/dist/client/assets/{shell-controls-HLzK4I7E.js → shell-controls-C08RpHmT.js} +1 -1
  157. package/dist/client/assets/{shell-layout-LI1vyNzj.js → shell-layout-BWQLmjyW.js} +1 -1
  158. package/dist/client/assets/{shell-route-loading-BDOpNoYP.js → shell-route-loading-Cf96p6By.js} +1 -1
  159. package/dist/client/assets/{sidebar-BGJoJ5IQ.js → sidebar-LVNues-1.js} +1 -1
  160. package/dist/client/assets/{skeleton-hFHnIcZ0.js → skeleton-B8_-zyKb.js} +1 -1
  161. package/dist/client/assets/{sortable.esm-DIVJmvz6.js → sortable.esm-DHMK7_tT.js} +1 -1
  162. package/dist/client/assets/{sso-Bn468zRH.js → sso-CRuWYtBt.js} +1 -1
  163. package/dist/client/assets/{store-DytIJvdt.js → store-73nRfAHP.js} +1 -1
  164. package/dist/client/assets/store-registry-Dj2QFrh5.js +2 -0
  165. package/dist/client/assets/{studio-tools-eP_o-Bzq.js → studio-tools-CJMVZA0W.js} +1 -1
  166. package/dist/client/assets/{switch-DalcHZ66.js → switch-YOR9drgK.js} +1 -1
  167. package/dist/client/assets/{table-CnWjZkvw.js → table-COWO-rWc.js} +1 -1
  168. package/dist/client/assets/{tabs-BhJfCfA3.js → tabs-CsXXbMGG.js} +1 -1
  169. package/dist/client/assets/{task-status-BwSSlnug.js → task-status-D4qDcTy4.js} +1 -1
  170. package/dist/client/assets/{textarea-DTW1SKGc.js → textarea-BTbunR8j.js} +1 -1
  171. package/dist/client/assets/{toggle-group-CRnMovNn.js → toggle-group-CSMS4HAA.js} +1 -1
  172. package/dist/client/assets/{toolbar-BVgga9fW.js → toolbar-CvxN3T7P.js} +1 -1
  173. package/dist/client/assets/{tooltip-DVHwyu-W.js → tooltip-BdbfQCYl.js} +1 -1
  174. package/dist/client/assets/{types-B1E3Ybp7.js → types-D18PqArI.js} +1 -1
  175. package/dist/client/assets/{use-ai-providers-DP8qFD8W.js → use-ai-providers-CiBlqHeC.js} +1 -1
  176. package/dist/client/assets/{use-automations-QBk1wzKE.js → use-automations-44dHfXzj.js} +1 -1
  177. package/dist/client/assets/{use-capability-D3mzXNBE.js → use-capability-DH5i0nun.js} +1 -1
  178. package/dist/client/assets/{use-clock-tick-YCiBQpNz.js → use-clock-tick-bD6VBNNM.js} +1 -1
  179. package/dist/client/assets/{use-collections-sgcijgPQ.js → use-collections-DaAI2dS_.js} +1 -1
  180. package/dist/client/assets/{use-connection-CFC8WumP.js → use-connection-z93iohVP.js} +1 -1
  181. package/dist/client/assets/{use-copy-BVyzmTt4.js → use-copy-_XYMvM2G.js} +1 -1
  182. package/dist/client/assets/{use-create-virtual-mcp-40n1TbuY.js → use-create-virtual-mcp-BA4rAHKP.js} +1 -1
  183. package/dist/client/assets/{use-debounced-autosave-tiHawAIR.js → use-debounced-autosave-CaWQv8Ap.js} +1 -1
  184. package/dist/client/assets/{use-deco-credits-C1ftH3If.js → use-deco-credits-C3sjfJyT.js} +1 -1
  185. package/dist/client/assets/{use-delete-connection-CUd76KVl.js → use-delete-connection-ftKt28t_.js} +1 -1
  186. package/dist/client/assets/{use-file-configs-C2ceyi4L.js → use-file-configs-CS1kf1Mx.js} +1 -1
  187. package/dist/client/assets/{use-infinite-scroll-CvmJXJdB.js → use-infinite-scroll-CUe3Elw1.js} +1 -1
  188. package/dist/client/assets/{use-join-requests-CRlCmWm0.js → use-join-requests-iCFOb_l5.js} +1 -1
  189. package/dist/client/assets/{use-mcp-client-DFe1X8lW.js → use-mcp-client-DZQbnef-.js} +1 -1
  190. package/dist/client/assets/{use-mcp-prompts-4cCmLVZX.js → use-mcp-prompts-CDHTi3et.js} +1 -1
  191. package/dist/client/assets/{use-mcp-tools-DI9Jj-_Y.js → use-mcp-tools-DOD2Zkcv.js} +1 -1
  192. package/dist/client/assets/{use-members-KDk_htTJ.js → use-members-Cgp-qtNm.js} +1 -1
  193. package/dist/client/assets/{use-navigate-to-agent-D9iFw7Zt.js → use-navigate-to-agent-DUbEZuBm.js} +1 -1
  194. package/dist/client/assets/{use-org-auth-client-SaCcE0Qc.js → use-org-auth-client-TLh9Nsd6.js} +1 -1
  195. package/dist/client/assets/{use-org-sso-4n2o97PC.js → use-org-sso-BhXMb9mL.js} +1 -1
  196. package/dist/client/assets/{use-organization-roles-BXjlJlvC.js → use-organization-roles-Dua0G_kp.js} +1 -1
  197. package/dist/client/assets/{use-organization-settings-CJJ_tXSe.js → use-organization-settings-Bjk_kH1I.js} +1 -1
  198. package/dist/client/assets/{use-registry-connections-DGZtDiY8.js → use-registry-connections-DfipPXqa.js} +1 -1
  199. package/dist/client/assets/{use-secrets-DOmnFlDE.js → use-secrets-DCPSjnYq.js} +1 -1
  200. package/dist/client/assets/{use-status-sounds-C7IKQ0M3.js → use-status-sounds-DFtMiuOm.js} +1 -1
  201. package/dist/client/assets/{use-view-mode-5sHRttq3.js → use-view-mode-tunDtZ1F.js} +1 -1
  202. package/dist/client/assets/{use-virtual-mcp-Dt17nZX7.js → use-virtual-mcp-BCkbHrLW.js} +1 -1
  203. package/dist/client/assets/useInfiniteQuery-CX9x55X-.js +1 -0
  204. package/dist/client/assets/useSuspenseInfiniteQuery-C_SaQkGF.js +1 -0
  205. package/dist/client/assets/{variant-calendar-DBaInJsx.js → variant-calendar-hE6C_kQd.js} +1 -1
  206. package/dist/client/assets/{view-mode-toggle-dVNz8sR0.js → view-mode-toggle-B1Thrh1l.js} +1 -1
  207. package/dist/client/index.html +2 -2
  208. package/dist/server/cli.js +1 -1
  209. package/package.json +1 -1
  210. package/dist/client/assets/auth-entry-9rxagxJL.js +0 -1
  211. package/dist/client/assets/category-editor-C-xyYK6m.js +0 -1
  212. package/dist/client/assets/commerce-onboarding-YO2BywhJ.js +0 -1
  213. package/dist/client/assets/index-BITgxoqa.css +0 -1
  214. package/dist/client/assets/integration-icon-Dn8UgHow.js +0 -1
  215. package/dist/client/assets/page-seo-sheet-C5rR31Cs.js +0 -1
  216. package/dist/client/assets/project-app-view-Bojee27q.js +0 -1
  217. package/dist/client/assets/record-editor-Cb2nxa0o.js +0 -1
  218. package/dist/client/assets/registry-DJ2WJB-k.js +0 -2
  219. package/dist/client/assets/save-referenced-block-B0RkutY2.js +0 -1
  220. package/dist/client/assets/store-registry-C32JZ3Yi.js +0 -2
  221. package/dist/client/assets/useInfiniteQuery-LattvRM6.js +0 -1
  222. package/dist/client/assets/useSuspenseInfiniteQuery-JNoud7Ca.js +0 -1
@@ -1 +1 @@
1
- import{r as $,v as Ne,K as re,b6 as dt,k as Oe,j as s,l as K,i as fe,B as ne,c as q,y as Pe,aB as Ie,z as se,aD as De,aE as ke,m as $e,E as mt,C as ut,d as Fe,t as he,q as Re,ae as Ke,a6 as ft,a2 as ht,b as gt,u as xt}from"./index-D9cso_OE.js";import{u as pt,C as bt}from"./use-organization-roles-BXjlJlvC.js";import{u as je}from"./use-org-auth-client-SaCcE0Qc.js";import{B as ge}from"./badge-S-QCOrNN.js";import{f as Qe,a as qe,b as He,c as Ze,d as Xe,A as Je,e as We,g as et}from"./alert-dialog-BO7X_BMw.js";import{D as Tt,a as Et,b as _t,c as It}from"./dropdown-menu-BOrPFviJ.js";import{a as Nt}from"./DotsVertical-CAFbny0A.js";import{s as Ae}from"./Plus-e8vsh1yI.js";import{s as St}from"./Trash01-C3khOwsb.js";import{P as te}from"./index-DsuFa3M3.js";import{E as Ge}from"./empty-state-BZIY4ETU.js";import{S as ve}from"./search-input-Cn14rzZS.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-Dn8UgHow.js";import{u as Ct}from"./use-infinite-scroll-CvmJXJdB.js";import{C as we}from"./checkbox-DbzbLYfL.js";import{i as At}from"./Settings02-1OASYAA8.js";import{u as Ot}from"./useSuspenseInfiniteQuery-JNoud7Ca.js";import{u as Rt,S as jt}from"./use-mcp-client-DFe1X8lW.js";import{C as vt}from"./collection-search-hESxl20y.js";import{u as nt}from"./use-members-KDk_htTJ.js";import{u as yt}from"./use-connection-CFC8WumP.js";import{u as wt,d as Mt}from"./use-ai-providers-DP8qFD8W.js";import{A as lt}from"./avatar-C7RfbSV0.js";import{S as xe}from"./switch-DalcHZ66.js";import{c as pe,b as be,T as Te,a as Ee}from"./tooltip-DVHwyu-W.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-Bc3yjWcB.js";import{t as Lt}from"./ChevronDown-DeW1WG4N.js";import{i as Pt}from"./ChevronRight-DSC2aiCG.js";import{i as ze}from"./X-CdcmL6WW.js";import{a as Dt}from"./use-capability-D3mzXNBE.js";import{A as kt}from"./access-gate-DqzudH0L.js";import"./table-CnWjZkvw.js";import"./SwitchHorizontal01-DCwdrg-O.js";import"./ChevronUp-CiZNoBS5.js";import"./sidebar-BGJoJ5IQ.js";import"./LayoutLeft-DfLCxQJZ.js";import"./sheet-HFHR_AuU.js";import"./SearchMd-pbTyIZQ0.js";import"./XCircle-YOrPaSTA.js";import"./agent-icon-DY5w59uF.js";import"./AlertCircle-Caru_t3W.js";import"./Tool01-BDvWQGEc.js";import"./ArrowUpRight-B2Dt0814.js";import"./ZapSquare-CgWRLEJy.js";import"./Users03-DPSOJZh_.js";import"./CheckCircle-CpjuZYS5.js";import"./ChevronLeft-DhtKqfYa.js";import"./Stars02-DTDItJ62.js";import"./Eye-BSAOg3tU.js";import"./ZoomOut-OytsIYD1.js";import"./Globe01-B8cJAk0V.js";import"./FilterLines-BWsEA6cc.js";import"./Star01-BokvC0Yc.js";import"./Globe04-BHoeDf9U.js";import"./HardDrive-Ca-rpUZp.js";import"./Key01-hqliL23I.js";import"./LinkExternal01-C-uuQSHY.js";import"./Monitor01-C4mUj5DO.js";import"./Sun-CO5Z2lcQ.js";import"./Palette-BqPdnSvn.js";import"./Play-u3Xpo-3H.js";import"./Shield01-BZP4Q_Vm.js";import"./Stars01-CM7BslwP.js";import"./Upload01-BWq8M5mQ.js";import"./User01-B5NDreK2.js";import"./Users01-BM4ZmEbl.js";import"./XClose-B1WSb9MQ.js";import"./Zap-CJ80I152.js";import"./auth-DpDDb6PJ.js";import"./use-collections-sgcijgPQ.js";import"./studio-tools-eP_o-Bzq.js";import"./card-B0EjU25K.js";import"./capability-load-error-D72JLeT1.js";const Me="basic-usage",Le=[{id:Me,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","VIRTUAL_MCP_LAST_USED_LIST","AUTOMATION_GET","AUTOMATION_LIST","AUTOMATION_RUN_STATS","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_CREDITS","AI_PROVIDER_TOPUP_URL","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","FILE_OBJECTS_LIST","SANDBOX_START","SANDBOX_DELETE","GLOBAL_SEARCH","ORGANIZATION_SETTINGS_GET","USER_GET","LINK_CURRENT_GET","LINK_DISCONNECT","BRAND_CONTEXT_LIST","COLLECTION_THREADS_CREATE","COLLECTION_THREADS_LIST","COLLECTION_THREADS_GET","COLLECTION_THREADS_UPDATE","COLLECTION_THREADS_DELETE","COLLECTION_THREAD_MESSAGES_LIST","THREAD_BACKGROUND_TOOL_START","THREAD_SUBTASK_DELIVER"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_LIST","ORGANIZATION_DOMAIN_ADD","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_VERIFY","ORGANIZATION_DOMAIN_REMOVE"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE","ORGANIZATION_JOIN_REQUEST_LIST","ORGANIZATION_JOIN_REQUEST_APPROVE","ORGANIZATION_JOIN_REQUEST_DENY"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE","COMMERCE_DISCOVERY_SETUP"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_TRIGGER_ROTATE_TOKEN","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS","MONITORING_THREAD_USAGE"]},{id:"secrets:manage",label:"Manage secrets",description:"Create and list secrets stored in the credential vault",section:"Organization",tools:["SECRET_CREATE","SECRET_LIST"]},{id:"file-configs:manage",label:"Manage file configs",description:"Create, list, update and delete S3 bucket configurations",section:"Organization",tools:["FILE_CONFIG_CREATE","FILE_CONFIG_LIST","FILE_CONFIG_UPDATE","FILE_CONFIG_DELETE","FILE_OBJECTS_LIST"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_KEY_UPDATE","AI_PROVIDER_KEY_PREVIEW","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}];[...Le.find(t=>t.id===Me)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Le.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Le){if(e.id===Me)continue;const n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Bt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function Vt(t,e,n){if(n){const i=new Set(e);for(const r of t.tools)i.add(r);return Array.from(i)}const l=new Set(e);for(const i of t.tools)l.delete(i);return Array.from(l)}function zt(t){const e=q.c(21),{connection:n,isSelected:l,hasToolsEnabled:i,activeToolsCount:r,totalToolsCount:d,onSelect:h,onToggle:c}=t,g=l?"bg-accent/50":"hover:bg-muted/50";let f;e[0]!==g?(f=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",g),e[0]=g,e[1]=f):f=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx(ye,{icon:n.icon,name:n.title,size:"xs"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let x;e[5]!==n.title?(x=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),e[5]=n.title,e[6]=x):x=e[6];let o;e[7]!==h||e[8]!==a||e[9]!==x?(o=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:h,children:[a,x]}),e[7]=h,e[8]=a,e[9]=x,e[10]=o):o=e[10];let m;e[11]!==r||e[12]!==n.tools||e[13]!==i||e[14]!==c||e[15]!==d?(m=n.tools&&n.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[r,"/",d]}),s.jsx(we,{checked:i,onCheckedChange:c,onClick:Yt})]}),e[11]=r,e[12]=n.tools,e[13]=i,e[14]=c,e[15]=d,e[16]=m):m=e[16];let N;return e[17]!==f||e[18]!==o||e[19]!==m?(N=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=N):N=e[20],N}function Yt(t){return t.stopPropagation()}function $t(t){const e=q.c(18),{connectionId:n,tool:l,isSelected:i,onToggle:r}=t,d=`tool-${n}-${l.name}`,h=i?"text-foreground":"text-muted-foreground";let c;e[0]!==h?(c=K("text-sm font-medium",h),e[0]=h,e[1]=c):c=e[1];let g;e[2]!==c||e[3]!==l.name?(g=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:c,children:l.name})}),e[2]=c,e[3]=l.name,e[4]=g):g=e[4];let f;e[5]!==l.description?(f=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),e[5]=l.description,e[6]=f):f=e[6];let a;e[7]!==g||e[8]!==f?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[g,f]}),e[7]=g,e[8]=f,e[9]=a):a=e[9];const x=`tool-${n}-${l.name}`;let o;e[10]!==i||e[11]!==r||e[12]!==x?(o=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:x,checked:i,onCheckedChange:r,onClick:Ft})}),e[10]=i,e[11]=r,e[12]=x,e[13]=o):o=e[13];let m;return e[14]!==d||e[15]!==a||e[16]!==o?(m=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:d,children:[a,o]}),e[14]=d,e[15]=a,e[16]=o,e[17]=m):m=e[17],m}function Ft(t){return t.stopPropagation()}function Kt({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[i,r]=$.useState(""),d=l!==void 0?l:i,h=$.useDeferredValue(d),[c,g]=$.useState("all"),[f,a]=$.useState(!1),x=$.useRef(new Set(Object.keys(t))),{org:o}=Ne(),m=Rt({connectionId:jt,orgId:o.id,orgSlug:o.slug}),N=100,E=h.trim(),T=E?{operator:"or",conditions:[{field:["title"],operator:"contains",value:E},{field:["description"],operator:"contains",value:E}]}:void 0,S=!!n,C={...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:0,...S&&{include_virtual:!0}},v=JSON.stringify(C),{data:_,fetchNextPage:O,hasNextPage:p,isFetchingNextPage:R}=Ot({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:b,...S&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,H)=>Q+(H?.items?.length??0),0)},staleTime:3e4}),I=_?.pages.flatMap(b=>b?.items??[])??[],j=Ct(O,p??!1,R),u=n?I.filter(b=>b.connection_type!=="VIRTUAL"?!0:dt(b.connection_url)!==n):I,w=x.current,A=[...w.values()].map(b=>u.find(D=>D.id===b)).filter(b=>b!==void 0),k=u.filter(b=>!w.has(b.id)),G=[...A,...k],U=b=>{const D=t[b];return D!==void 0&&D.length>0},B=G.filter(b=>{if(c==="all")return!0;const D=U(b.id);return c==="selected"?D:c==="unselected"?!D:!0}),[M,z]=$.useState(G[0]?.id??null),y=M?G.find(b=>b.id===M)??null:null,{data:L,isFetching:Y}=Oe({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",M??""),queryFn:async()=>M?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:M}})).structuredContent?.item??null:null,enabled:!!M,staleTime:3e4}),F=L?.tools??[],X=(b,D)=>t[b]?.includes(D)??!1,J=(b,D)=>{const Q=t[b]??[],H=Q.includes(D),W={...t};if(H){const Z=Q.filter(ee=>ee!==D);Z.length===0?delete W[b]:W[b]=Z}else W[b]=[...Q,D];e(W)},le=b=>{const D=b===M?F:[];if(!D.length)return;const Q=t[b]??[],H=D.map(ee=>ee.name),W=Q.length>0&&H.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=H,z(b)),e(Z)},oe=b=>{z(b),a(!0)},ie=()=>{a(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",f&&"hidden md:flex"),children:[l===void 0&&s.jsx(vt,{value:i,onChange:r,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:B.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[B.map(b=>{const D=M===b.id,Q=D?F.length:0,H=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:H,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),R&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:K("flex-1 flex-col",f?"flex":"hidden md:flex"),children:y?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:ie,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(At,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ye,{icon:y.icon,name:y.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:y.title}),y.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:Y?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})}):F.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:F.map(b=>s.jsx($t,{connectionId:y.id,tool:b,isSelected:X(y.id,b.name),onToggle:()=>J(y.id,b.name)},b.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}const Se=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],Qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function qt(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Se.length;return Se[n]??Se[0]}function Ht(t,e){return Qt[t]??"bg-neutral-400"}const Zt=Pe({role:Pe({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:ke(),staticPermissions:Ie(se()),toolSet:De(se(),Ie(se())),allowAllModels:ke(),modelSet:De(se(),Ie(se())),memberIds:Ie(se())});function ot(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Ye(t,e,n){const l=s.jsx(xe,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Xt(t){const e=q.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:i,onPermissionsChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d;let g;e[0]!==h?(g=h.trim().toLowerCase(),e[0]=h,e[1]=g):g=e[1];const f=$.useDeferredValue(g);let a;if(e[2]!==n||e[3]!==f||e[4]!==i||e[5]!==r||e[6]!==c||e[7]!==h||e[8]!==l){const x=Ut(),o=(v,_)=>{if(!c){if(n&&_){const O=x.flatMap(es).flatMap(Wt);i(!1),r(O.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!_))}};let m;e[10]!==f?(m=v=>{const{section:_,capabilities:O}=v;return{section:_,capabilities:O.filter(p=>!f||p.label.toLowerCase().includes(f)||p.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const N=x.map(m).filter(Jt);let E;e[12]!==n||e[13]!==i||e[14]!==r?(E=()=>{i(!n),r([])},e[12]=n,e[13]=i,e[14]=r,e[15]=E):E=e[15];let T;e[16]!==n||e[17]!==c||e[18]!==E?(T=Ye(n,c,E),e[16]=n,e[17]=c,e[18]=E,e[19]=T):T=e[19];let S;e[20]!==n||e[21]!==i||e[22]!==r||e[23]!==c?(S=c?void 0:()=>{i(!n),r([])},e[20]=n,e[21]=i,e[22]=r,e[23]=c,e[24]=S):S=e[24];let C;e[25]!==T||e[26]!==S?(C=s.jsx(Ue,{title:"General",children:s.jsx(Be,{children:s.jsx(Ve,{title:"All organization permissions",description:"Grant full access to all features below",action:T,onClick:S})})}),e[25]=T,e[26]=S,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,N.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):N.map(v=>{const{section:_,capabilities:O}=v;return s.jsx(Ue,{title:_,children:s.jsx(Be,{children:O.map(p=>{const R=Bt(p,l,n);return s.jsx(Ve,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[p.label,p.dangerous&&s.jsx(ft,{size:12,className:"text-amber-500 shrink-0"})]}),description:p.description,action:Ye(R,c,()=>o(p,R)),onClick:c?void 0:()=>o(p,R)},p.id)})})},_)})]})}),e[2]=n,e[3]=f,e[4]=i,e[5]=r,e[6]=c,e[7]=h,e[8]=l,e[9]=a}else a=e[9];return a}function Jt(t){return t.capabilities.length>0}function Wt(t){return t.tools}function es(t){return t.capabilities}const it={anthropic:"Anthropic",openrouter:"OpenRouter"},ts={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ss(t,e){const n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ns(t){return ts[t]??it[t]??t}function ls(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const rt=30;function os(t){const e=q.c(44),{connectionId:n,subProviderId:l,subProviderName:i,groupLogo:r,models:d,allConnectionModelIds:h,selectedModels:c,allowAllModels:g,allConnectionModelsSelected:f,onToggleModel:a,onExitAllowAll:x,readOnly:o,defaultExpanded:m}=t,[N,E]=$.useState(m),T=m||N,S=E,[C,v]=$.useState(rt);let _;e[0]!==f||e[1]!==g||e[2]!==c?(_=j=>g||f||c.includes("*")||c.includes(j),e[0]=f,e[1]=g,e[2]=c,e[3]=_):_=e[3];const O=_;let p;if(e[4]!==O||e[5]!==d){let j;e[7]!==O?(j=u=>O(u.id),e[7]=O,e[8]=j):j=e[8],p=d.filter(j),e[4]=O,e[5]=d,e[6]=p}else p=e[6];const R=p.length;let I;if(e[9]!==h||e[10]!==g||e[11]!==n||e[12]!==R||e[13]!==T||e[14]!==r||e[15]!==O||e[16]!==d||e[17]!==x||e[18]!==a||e[19]!==o||e[20]!==l||e[21]!==i||e[22]!==C){const j=d.slice(0,C),u=d.length>C;let w;e[24]===Symbol.for("react.memo_cache_sentinel")?(w=()=>S(cs),e[24]=w):w=e[24];const A=r??tt[l]??st;let k;e[25]!==i||e[26]!==A?(k=s.jsx(ye,{icon:A,name:i,size:"sm"}),e[25]=i,e[26]=A,e[27]=k):k=e[27];let G;e[28]!==i?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:i}),e[28]=i,e[29]=G):G=e[29];let U;e[30]!==k||e[31]!==G?(U=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[k,G]}),e[30]=k,e[31]=G,e[32]=U):U=e[32];let B;e[33]!==R||e[34]!==d.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[R,"/",d.length," enabled"]}),e[33]=R,e[34]=d.length,e[35]=B):B=e[35];let M;e[36]!==T?(M=T?s.jsx(Lt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=T,e[37]=M):M=e[37];let z;e[38]!==M||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,M]}),e[38]=M,e[39]=B,e[40]=z):z=e[40];let y;e[41]!==z||e[42]!==U?(y=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:w,children:[U,z]}),e[41]=z,e[42]=U,e[43]=y):y=e[43],I=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[y,T&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(L=>{const Y=O(L.id),F=()=>{if(!o){if(g){x(n,h,L.id);return}a(n,L.id)}};return s.jsxs("div",{className:K("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!o&&"hover:bg-muted/50 cursor-pointer"),onClick:F,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:L.title})}),s.jsx("div",{onClick:as,children:o?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:Y,disabled:!0,onCheckedChange:rs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:Y,onCheckedChange:F})})]},L.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>v(is),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=g,e[11]=n,e[12]=R,e[13]=T,e[14]=r,e[15]=O,e[16]=d,e[17]=x,e[18]=a,e[19]=o,e[20]=l,e[21]=i,e[22]=C,e[23]=I}else I=e[23];return I}function is(t){return t+rt}function rs(){}function as(t){return t.stopPropagation()}function cs(t){return!t}function ds(t){const e=q.c(33),{connection:n,selectedModels:l,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:g}=t,f=Mt(n.id);let a,x,o,m,N;if(e[0]!==h||e[1]!==i||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==d||e[6]!==r||e[7]!==f||e[8]!==g||e[9]!==c||e[10]!==l){N=Symbol.for("react.early_return_sentinel");e:{let S;e[16]!==n.label?(S=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=S):S=e[17];const C=f.filter(hs).map(S),v=c.trim().toLowerCase(),_=v?C.filter(A=>A.title.toLowerCase().includes(v)||A.id.toLowerCase().includes(v)||A.provider?.toLowerCase().includes(v)):C;if(_.length===0){N=null;break e}const O=new Map;for(const A of _){const k=ss(A.id,n.providerId),G=O.get(k)??{models:[],logo:null};G.models.push({id:A.id,title:ls(A.title),logo:A.logo}),!G.logo&&A.logo&&(G.logo=A.logo),O.set(k,G)}const p=Array.from(O.entries()).map(fs).sort(us),R=p.length===1||v.length>0;o="flex flex-col gap-3";const I=tt[n.providerId]??st;let j;e[18]!==n.providerId||e[19]!==I?(j=s.jsx("img",{src:I,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=I,e[20]=j):j=e[20];const u=it[n.providerId]??n.providerId;let w;e[21]!==u?(w=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=w):w=e[22],e[23]!==w||e[24]!==j?(m=s.jsxs("div",{className:"flex items-center gap-2",children:[j,w]}),e[23]=w,e[24]=j,e[25]=m):m=e[25],a="flex flex-col gap-3",x=p.map(A=>s.jsx(os,{connectionId:n.id,subProviderId:A.id,subProviderName:A.name,groupLogo:A.logo,models:A.models,allConnectionModelIds:C.map(ms),selectedModels:l,allowAllModels:i,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:d,readOnly:g,defaultExpanded:R},A.id))}e[0]=h,e[1]=i,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=d,e[6]=r,e[7]=f,e[8]=g,e[9]=c,e[10]=l,e[11]=a,e[12]=x,e[13]=o,e[14]=m,e[15]=N}else a=e[11],x=e[12],o=e[13],m=e[14],N=e[15];if(N!==Symbol.for("react.early_return_sentinel"))return N;let E;e[26]!==a||e[27]!==x?(E=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=E):E=e[28];let T;return e[29]!==o||e[30]!==m||e[31]!==E?(T=s.jsxs("div",{className:o,children:[m,E]}),e[29]=o,e[30]=m,e[31]=E,e[32]=T):T=e[32],T}function ms(t){return t.id}function us(t,e){return t.name.localeCompare(e.name)}function fs(t){const[e,n]=t;return{id:e,name:ns(e),logo:n.logo,models:n.models}}function hs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function gs(t){const e=q.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:i,onModelSetChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d,g=$.useDeferredValue(h),f=wt();let a;e[0]!==l||e[1]!==r?(a=(p,R)=>{const I=l[p]??[],j={...l};if(I.includes(R)){const u=I.filter(w=>w!==R);u.length===0?delete j[p]:j[p]=u}else j[p]=[...I,R];r(j)},e[0]=l,e[1]=r,e[2]=a):a=e[2];const x=a;let o;e[3]!==l||e[4]!==i||e[5]!==r?(o=(p,R,I)=>{i(!1),r({...l,[p]:R.filter(j=>j!==I)})},e[3]=l,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,N=!c&&"hover:bg-muted/50 cursor-pointer";let E;e[7]!==N?(E=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",N),e[7]=N,e[8]=E):E=e[8];let T;e[9]!==n||e[10]!==i||e[11]!==r||e[12]!==c?(T=()=>{if(c)return;const p=!n;i(p),p&&r({})},e[9]=n,e[10]=i,e[11]=r,e[12]=c,e[13]=T):T=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=S):S=e[14];let C;e[15]!==n||e[16]!==i||e[17]!==r||e[18]!==c?(C=s.jsx("div",{onClick:ps,children:c?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:n,onCheckedChange:p=>{i(p),p&&r({})}})}),e[15]=n,e[16]=i,e[17]=r,e[18]=c,e[19]=C):C=e[19];let v;e[20]!==E||e[21]!==T||e[22]!==C?(v=s.jsxs("div",{className:E,onClick:T,children:[S,C]}),e[20]=E,e[21]=T,e[22]=C,e[23]=v):v=e[23];let _;e[24]!==f||e[25]!==n||e[26]!==g||e[27]!==m||e[28]!==l||e[29]!==c||e[30]!==x?(_=f.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):f.map(p=>s.jsx($.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(fe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(ds,{connection:p,selectedModels:l[p.id]??[],allowAllModels:n,onToggleModel:x,onExitAllowAll:m,allConnectionModelsSelected:(l[p.id]??[]).includes("*"),searchQuery:g,readOnly:c})},p.id)),e[24]=f,e[25]=n,e[26]=g,e[27]=m,e[28]=l,e[29]=c,e[30]=x,e[31]=_):_=e[31];let O;return e[32]!==_||e[33]!==v?(O=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,_]}),e[32]=_,e[33]=v,e[34]=O):O=e[34],O}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=q.c(52),{open:n,onOpenChange:l,selectedMemberIds:i,onAddMembers:r}=t,[d,h]=$.useState(""),c=$.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[f,a]=$.useState(g),{data:x}=nt();let o,m,N,E,T,S,C,v,_,O,p;if(e[1]!==x?.data?.members||e[2]!==c||e[3]!==r||e[4]!==l||e[5]!==n||e[6]!==f||e[7]!==d||e[8]!==i){const U=x?.data?.members??[];let B;e[20]!==c?(B=y=>{const L=c.toLowerCase();return y.user?.name?.toLowerCase().includes(L)||y.user?.email?.toLowerCase().includes(L)},e[20]=c,e[21]=B):B=e[21];const M=U.filter(B);let z;e[22]!==r||e[23]!==l||e[24]!==f?(z=()=>{r(f),a([]),l(!1)},e[22]=r,e[23]=l,e[24]=f,e[25]=z):z=e[25],N=z,m=Qe,O=n,p=l,o=qe,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(He,{className:"px-6 pt-6",children:[s.jsx(Ze,{children:"Add Members to Role"}),s.jsx(Xe,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],S="flex flex-col h-80",e[27]!==d?(C=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(ve,{value:d,onChange:h,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=C):C=e[28],E="flex-1 overflow-auto",T=M.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:M.map(y=>{const L=y.role!=="owner",Y=i.includes(y.id),F=f.includes(y.id);return s.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!L||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:F||Y,onCheckedChange:()=>{!L||Y||a(X=>X.includes(y.id)?X.filter(J=>J!==y.id):[...X,y.id])},disabled:!L||Y}),s.jsx(lt,{url:y.user?.image??void 0,fallback:ot(y.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:y.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.user?.email})]}),!L&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&L&&s.jsx(ge,{variant:"outline",className:"shrink-0",children:"Added"})]},y.id)})}),e[1]=x?.data?.members,e[2]=c,e[3]=r,e[4]=l,e[5]=n,e[6]=f,e[7]=d,e[8]=i,e[9]=o,e[10]=m,e[11]=N,e[12]=E,e[13]=T,e[14]=S,e[15]=C,e[16]=v,e[17]=_,e[18]=O,e[19]=p}else o=e[9],m=e[10],N=e[11],E=e[12],T=e[13],S=e[14],C=e[15],v=e[16],_=e[17],O=e[18],p=e[19];let R;e[29]!==E||e[30]!==T?(R=s.jsx("div",{className:E,children:T}),e[29]=E,e[30]=T,e[31]=R):R=e[31];let I;e[32]!==R||e[33]!==S||e[34]!==C?(I=s.jsxs("div",{className:S,children:[C,R]}),e[32]=R,e[33]=S,e[34]=C,e[35]=I):I=e[35];let j;e[36]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Je,{children:"Cancel"}),e[36]=j):j=e[36];const u=f.length===0,w=f.length>0&&`(${f.length})`;let A;e[37]!==N||e[38]!==u||e[39]!==w?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:N,disabled:u,children:["Add ",w]})]}),e[37]=N,e[38]=u,e[39]=w,e[40]=A):A=e[40];let k;e[41]!==o||e[42]!==I||e[43]!==A||e[44]!==v||e[45]!==_?(k=s.jsxs(o,{className:v,children:[_,I,A]}),e[41]=o,e[42]=I,e[43]=A,e[44]=v,e[45]=_,e[46]=k):k=e[46];let G;return e[47]!==m||e[48]!==k||e[49]!==O||e[50]!==p?(G=s.jsx(m,{open:O,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=O,e[50]=p,e[51]=G):G=e[51],G}function Ts(t){const e=q.c(29),{memberIds:n,onMemberIdsChange:l,readOnly:i,readOnlyMessage:r,searchQuery:d,addMemberDialogOpen:h,onAddMemberDialogOpenChange:c}=t,g=i===void 0?!1:i,f=r===void 0?"Owner membership cannot be changed":r,a=$.useDeferredValue(d),{data:x}=nt();let o,m,N;if(e[0]!==x?.data?.members||e[1]!==a||e[2]!==n||e[3]!==l||e[4]!==g||e[5]!==f||e[6]!==d){const v=x?.data?.members??[];let _;e[10]!==n?(_=I=>n.includes(I.id),e[10]=n,e[11]=_):_=e[11];const O=v.filter(_);let p;e[12]!==a?(p=I=>{const j=a.toLowerCase();return I.user?.name?.toLowerCase().includes(j)||I.user?.email?.toLowerCase().includes(j)},e[12]=a,e[13]=p):p=e[13];const R=O.filter(p);N="flex flex-col h-full",o="flex-1 overflow-auto",m=O.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',d,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:R.map(I=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(lt,{url:I.user?.image??void 0,fallback:ot(I.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:I.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:I.user?.email})]}),g?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Ee,{children:s.jsx("p",{children:f})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(j=>j!==I.id)),children:s.jsx(ze,{size:16})})]},I.id))}),e[0]=x?.data?.members,e[1]=a,e[2]=n,e[3]=l,e[4]=g,e[5]=f,e[6]=d,e[7]=o,e[8]=m,e[9]=N}else o=e[7],m=e[8],N=e[9];let E;e[14]!==o||e[15]!==m?(E=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=E):E=e[16];let T;e[17]!==n||e[18]!==l?(T=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=T):T=e[19];let S;e[20]!==h||e[21]!==n||e[22]!==c||e[23]!==T?(S=s.jsx(bs,{open:h,onOpenChange:c,selectedMemberIds:n,onAddMembers:T}),e[20]=h,e[21]=n,e[22]=c,e[23]=T,e[24]=S):S=e[24];let C;return e[25]!==N||e[26]!==E||e[27]!==S?(C=s.jsxs("div",{className:N,children:[E,S]}),e[25]=N,e[26]=E,e[27]=S,e[28]=C):C=e[28],C}function Es(t){const e=q.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx($.Suspense,{fallback:n,children:s.jsx(Ts,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const _s={owner:[],admin:[],user:[]};function Is(t,e,n,l){const i=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:i,staticPermissions:_s[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(r=>r.role===t).map(r=>r.id)}}function Ns(t,e,n){const l=t.permission||{},i=l.self||[],r=i.includes("*"),d=r?[]:i.filter(a=>a!=="*"),h={};for(const[a,x]of Object.entries(l))if(!(a==="self"||a==="models"))if(a==="*")for(const o of n)h[o.id]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x;else{const o=n.find(m=>m.id===a);o&&(h[a]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x)}const c=l.models||[],g=c.length===0||c.includes("*:*"),f={};if(!g)for(const a of c){const x=a.indexOf(":");if(x===-1)continue;const o=a.slice(0,x),m=a.slice(x+1);f[o]||(f[o]=[]),f[o].push(m)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:r,staticPermissions:d,toolSet:h,allowAllModels:g,modelSet:f,memberIds:e.filter(a=>a.role===t.role).map(a=>a.id)}}function Ss(t,e){const n={};t.allowAllStaticPermissions?n.self=["*"]:t.staticPermissions.length>0&&(n.self=t.staticPermissions);for(const[l,i]of Object.entries(t.toolSet))if(i.length>0){const d=e.find(h=>h.id===l)?.tools?.map(h=>h.name)??[];n[l]=d.length>0&&d.every(h=>i.includes(h))?["*"]:i}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[i,r]of Object.entries(t.modelSet))for(const d of r)l.push(`${i}:${d}`);l.length>0&&(n.models=l)}return n}function Cs(t,e,n){return t.kind==="builtin"?Is(t.role,e,void 0):t.kind==="custom"?Ns(t.role,e,n):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function As(t){const e=q.c(6),{readOnly:n,readOnlyMessage:l,onOpen:i}=t,r=l===void 0?"Owner membership cannot be changed":l;if(n){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Ae,{size:16}),"Add Member"]})})}),e[0]=c):c=e[0];let g;return e[1]!==r?(g=s.jsx(pe,{children:s.jsxs(be,{children:[c,s.jsx(Ee,{children:s.jsx("p",{children:r})})]})}),e[1]=r,e[2]=g):g=e[2],g}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ae,{size:16}),e[3]=d):d=e[3];let h;return e[4]!==i?(h=s.jsxs(ne,{variant:"outline",size:"sm",onClick:i,children:[d,"Add Member"]}),e[4]=i,e[5]=h):h=e[5],h}function Os(t){const e=q.c(14),{locator:n}=Ne(),l=je(),i=yt();let r;e[0]!==n?(r=re.members(n),e[0]=n,e[1]=r):r=e[1];let d;e[2]!==l?(d=()=>l.organization.listMembers(),e[2]=l,e[3]=d):d=e[3];let h;e[4]!==r||e[5]!==d?(h={queryKey:r,queryFn:d},e[4]=r,e[5]=d,e[6]=h):h=e[6];const{data:c,isPending:g}=Oe(h);if(g||!i){let o;return e[7]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=o):o=e[7],o}let f;e[8]!==c?.data?.members?(f=c?.data?.members??[],e[8]=c?.data?.members,e[9]=f):f=e[9];const a=f;let x;return e[10]!==i||e[11]!==a||e[12]!==t?(x=s.jsx(Rs,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Rs({target:t,onBack:e,onSaved:n,members:l,connections:i}){const{locator:r}=Ne(),d=je(),h=$e(),c=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",f=t.kind==="new",[a,x]=$.useState(c?"org":"mcp"),o=mt({resolver:ut(Zt),defaultValues:Cs(t,l,i)}),m=o.formState.isValid,N=o.formState.isDirty,E=Fe({mutationFn:async u=>{const w=Ss(u,i),A=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),k=(u.role.slug==="owner"||u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,G=async(U,B)=>{const M=l.filter(L=>L.role===(B??U)).map(L=>L.id),z=u.memberIds.filter(L=>!M.includes(L)),y=M.filter(L=>!u.memberIds.includes(L));for(const L of z){const Y=await d.organization.updateMemberRole({memberId:L,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const L of y){const Y=await d.organization.updateMemberRole({memberId:L,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(k)return await G(u.role.slug),u;if(u.role.id){const U=u.role.label.toLowerCase().replace(/\s+/g,"-"),B=u.role.slug,M=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:w,...M?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(M?U:B,M?B:void 0),M?{...u,role:{...u.role,slug:U}}:u}else{const U=await d.organization.createRole({role:A,permission:w});if(U?.error)throw new Error(U.error.message??"Something went wrong");for(const B of u.memberIds){const M=await d.organization.updateMemberRole({memberId:B,role:[A]});if(M?.error)throw new Error(M.error.message)}return{...u,role:{...u.role,id:U.data?.roleData?.id,slug:A}}}},onSuccess:(u,w)=>{h.invalidateQueries({queryKey:re.members(r)}),h.invalidateQueries({queryKey:re.organizationRoles(r)});const A=!w.role.id&&!w.role.slug,k=w.role.slug==="owner"&&!w.role.id;Re(k?"role_members_updated":A?"role_created":"role_updated",{role_slug:w.role.slug??null}),he.success(k?"Members updated successfully!":A?"Role created successfully!":"Role updated successfully!"),o.reset(u),n(u.role.id)},onError:u=>{he.error(u instanceof Error?u.message:"Failed to save role")}}),T=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}E.mutate(u)}),S=!g,C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,O]=$.useState(""),[p,R]=$.useState(!1),I=u=>{x(u),O("")},j={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:K("flex flex-col",a!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:S&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:E.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:T,disabled:E.isPending||!m||!N,children:E.isPending?"Saving...":f?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",t.kind==="builtin"?Ht(t.role):qt(o.watch("role.label")))}),g&&s.jsx(Ke,{size:16,className:"text-muted-foreground shrink-0"}),f||t.kind==="custom"?s.jsx("input",{...o.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:f}):s.jsx("span",{className:"truncate",children:C})]})}),s.jsx("div",{className:"flex items-center gap-2",children:v.map(u=>s.jsx("button",{type:"button",onClick:()=>I(u.id),className:K("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",a===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(ve,{value:_,onChange:O,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>R(!0)})]})]})}),s.jsx("div",{className:K("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",a!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:K(a!=="org"&&"h-full overflow-hidden",a!=="models"&&a!=="org"&&"border border-border rounded-xl bg-card"),children:[a==="mcp"&&!g&&s.jsx(Kt,{toolSet:o.watch("toolSet"),onToolSetChange:u=>o.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),a==="org"&&s.jsx(Xt,{allowAllStaticPermissions:o.watch("allowAllStaticPermissions"),staticPermissions:o.watch("staticPermissions"),onAllowAllChange:u=>o.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>o.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="models"&&s.jsx(gs,{allowAllModels:o.watch("allowAllModels"),modelSet:o.watch("modelSet"),onAllowAllChange:u=>o.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>o.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="members"&&s.jsx(Es,{memberIds:o.watch("memberIds"),onMemberIdsChange:u=>o.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&(t.role==="owner"||t.role==="user"),readOnlyMessage:t.kind==="builtin"&&t.role==="user"?"User is the default role — members can't be removed from it; assign another role to change their access":"Owner membership cannot be changed",searchQuery:_,addMemberDialogOpen:p,onAddMemberDialogOpenChange:R})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=q.c(6),{area:n,children:l}=t,{isPrivileged:i,loading:r,error:d}=Dt();let h;return e[0]!==n||e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==r?(h=s.jsx(kt,{granted:i,loading:r,error:d,area:n,children:l}),e[0]=n,e[1]=l,e[2]=d,e[3]=i,e[4]=r,e[5]=h):h=e[5],h}const ys=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function ws(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??Ce[0]}const Ms={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ls(t,e){return e?Ms[t]??"bg-neutral-400":ws(t)}function Ps(){const t=q.c(77),[e,n]=$.useState(""),[l,i]=$.useState(null),r=gt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:h}=xt(d),{locator:c}=Ne(),g=je(),f=$e(),{customRoles:a,refetch:x}=pt();let o;t[1]!==r?(o=P=>r({to:".",search:V=>({...V,role:P})}),t[1]=r,t[2]=o):o=t[2];const m=o;let N;e:{if(!h){N=null;break e}if(h==="new"){N={kind:"new"};break e}if(h.startsWith("builtin-")){N={kind:"builtin",role:h.slice(8)};break e}let P;t[3]!==h?(P=ae=>ae.id===h,t[3]=h,t[4]=P):P=t[4];const V=a.find(P);N=V?{kind:"custom",role:V}:null}const E=N;let T;t[5]!==c?(T=re.members(c),t[5]=c,t[6]=T):T=t[6];let S;t[7]!==g?(S=()=>g.organization.listMembers(),t[7]=g,t[8]=S):S=t[8];let C;t[9]!==T||t[10]!==S?(C={queryKey:T,queryFn:S},t[9]=T,t[10]=S,t[11]=C):C=t[11];const{data:v}=Oe(C);let _;t[12]!==v?.data?.members?(_=v?.data?.members??[],t[12]=v?.data?.members,t[13]=_):_=t[13];const O=_;let p;t[14]!==O?(p=P=>O.filter(V=>V.role===P).length,t[14]=O,t[15]=p):p=t[15];const R=p;let I;if(t[16]!==a||t[17]!==R||t[18]!==e){let P;t[20]!==R?(P=ce=>({kind:"builtin",role:{...ce,memberCount:R(ce.role)}}),t[20]=R,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==R?(ae=ce=>({kind:"custom",role:{...ce,memberCount:R(ce.role)}}),t[22]=R,t[23]=ae):ae=t[23];const at=a.map(ae);if(I=[...V,...at],e){const ce=e.toLowerCase();I=I.filter(ct=>ct.role.label.toLowerCase().includes(ce))}t[16]=a,t[17]=R,t[18]=e,t[19]=I}else I=t[19];let j;t[24]!==g?(j=async P=>{const V=await g.organization.deleteRole({roleId:P});if(V?.error)throw new Error(V.error.message);return V?.data},t[24]=g,t[25]=j):j=t[25];const u=Fe({mutationFn:j,onSuccess:(P,V)=>{Re("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),x(),E?.kind==="custom"&&E.role.id===V&&m(void 0)},onError:zs});let w,A,k,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Vs,cellClassName:"flex-1 min-w-0",sortable:!0},w={id:"type",header:"Type",render:Bs,cellClassName:"w-28 shrink-0"},A={id:"permissions",header:"Permissions",render:Us,cellClassName:"flex-1 min-w-0"},k={id:"members",header:"Members",render:Gs,cellClassName:"w-24 shrink-0"},t[26]=w,t[27]=A,t[28]=k,t[29]=G):(w=t[26],A=t[27],k=t[28],G=t[29]);let U;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=[G,w,A,k,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(Tt,{children:[s.jsx(Et,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ks,children:s.jsx(Nt,{size:16})})}),s.jsx(_t,{align:"end",onClick:Ds,children:s.jsxs(It,{variant:"destructive",onClick:()=>{const V=P.role;V.id&&i({id:V.id,label:V.label})},children:[s.jsx(St,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=U):U=t[30];const B=U;let M;t[31]!==m?(M=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=M):M=t[32];const z=M;if(E){let P;t[33]!==m?(P=()=>m(void 0),t[33]=m,t[34]=P):P=t[34];let V;return t[35]!==x||t[36]!==m?(V=()=>{x(),m(void 0)},t[35]=x,t[36]=m,t[37]=V):V=t[37],s.jsx(Os,{target:E,onBack:P,onSaved:V},js(E))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let L;t[39]===Symbol.for("react.memo_cache_sentinel")?(L=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=L):L=t[39];let Y;t[40]!==e?(Y=s.jsx(ve,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:L}),t[40]=e,t[41]=Y):Y=t[41];let F;t[42]!==m?(F=()=>m("new"),t[42]=m,t[43]=F):F=t[43];let X;t[44]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx(Ae,{size:16}),t[44]=X):X=t[44];let J;t[45]!==F?(J=s.jsxs(ne,{onClick:F,children:[X,"Create Role"]}),t[45]=F,t[46]=J):J=t[46];let le;t[47]!==Y||t[48]!==J?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,J]}),t[47]=Y,t[48]=J,t[49]=le):le=t[49];let oe;t[50]!==e?(oe=e?s.jsx(Ge,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(Ge,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=oe):oe=t[51];let ie;t[52]!==I||t[53]!==B||t[54]!==z||t[55]!==oe?(ie=s.jsx(bt,{columns:B,data:I,isLoading:!1,onRowClick:z,emptyState:oe}),t[52]=I,t[53]=B,t[54]=z,t[55]=oe,t[56]=ie):ie=t[56];let b;t[57]!==le||t[58]!==ie?(b=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[y,le,ie]})})}),t[57]=le,t[58]=ie,t[59]=b):b=t[59];const D=l!==null;let Q;t[60]===Symbol.for("react.memo_cache_sentinel")?(Q=P=>!P&&i(null),t[60]=Q):Q=t[60];let H;t[61]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx(Ze,{children:"Delete Role"}),t[61]=H):H=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(He,{children:[H,s.jsxs(Xe,{children:['Are you sure you want to delete the "',W,'" role? This action cannot be undone.']})]}),t[62]=W,t[63]=Z):Z=t[63];let ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(Je,{children:"Cancel"}),t[64]=ee):ee=t[64];let de;t[65]!==u||t[66]!==l?(de=s.jsxs(We,{children:[ee,s.jsx(et,{onClick:()=>{l?.id&&u.mutate(l.id),i(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,t[67]=de):de=t[67];let me;t[68]!==Z||t[69]!==de?(me=s.jsxs(qe,{children:[Z,de]}),t[68]=Z,t[69]=de,t[70]=me):me=t[70];let ue;t[71]!==D||t[72]!==me?(ue=s.jsx(Qe,{open:D,onOpenChange:Q,children:me}),t[71]=D,t[72]=me,t[73]=ue):ue=t[73];let _e;return t[74]!==b||t[75]!==ue?(_e=s.jsxs(te,{children:[b,ue]}),t[74]=b,t[75]=ue,t[76]=_e):_e=t[76],_e}function Ds(t){return t.stopPropagation()}function ks(t){return t.stopPropagation()}function Gs(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function Us(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.join(", "):"No permissions"})}function Bs(t){return t.kind==="builtin"?s.jsx(ge,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(ge,{variant:"outline",className:"text-xs",children:"Custom"})}function Vs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",Ls(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(Ke,{size:12,className:"text-muted-foreground shrink-0"})]})}function zs(t,e){Re("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),he.error(t instanceof Error?t.message:"Failed to delete role")}function Ys(){const t=q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load roles"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ht,{fallback:e,children:s.jsx($.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Ps,{})})}),t[1]=n):n=t[1],n}function ml(){const t=q.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(vs,{area:"roles",children:s.jsx(Ys,{})}),t[0]=e):e=t[0],e}export{ml as default};
1
+ import{r as $,v as Ne,K as re,b6 as dt,k as Oe,j as s,l as K,i as fe,B as ne,c as q,y as Pe,aB as Ie,z as se,aD as De,aE as ke,m as $e,E as mt,C as ut,d as Fe,t as he,q as Re,ae as Ke,a6 as ft,a2 as ht,b as gt,u as xt}from"./index-C6QaS0Zh.js";import{u as pt,C as bt}from"./use-organization-roles-Dua0G_kp.js";import{u as je}from"./use-org-auth-client-TLh9Nsd6.js";import{B as ge}from"./badge-tlnu_6T3.js";import{f as Qe,a as qe,b as He,c as Ze,d as Xe,A as Je,e as We,g as et}from"./alert-dialog-gK63ktIU.js";import{D as Tt,a as Et,b as _t,c as It}from"./dropdown-menu-DveShRRm.js";import{a as Nt}from"./DotsVertical-DQDEDjEX.js";import{s as Ae}from"./Plus-DptVePQj.js";import{s as St}from"./Trash01-Ds3jbDQE.js";import{P as te}from"./index-DB4Y8lPy.js";import{E as Ge}from"./empty-state-b7tnb7q2.js";import{S as ve}from"./search-input-DjVPTtCb.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-XSMgSpds.js";import{u as Ct}from"./use-infinite-scroll-CUe3Elw1.js";import{C as we}from"./checkbox-H7xxQ3iC.js";import{i as At}from"./Settings02-BynaGT2l.js";import{u as Ot}from"./useSuspenseInfiniteQuery-C_SaQkGF.js";import{u as Rt,S as jt}from"./use-mcp-client-DZQbnef-.js";import{C as vt}from"./collection-search-ClGGT1KV.js";import{u as nt}from"./use-members-Cgp-qtNm.js";import{u as yt}from"./use-connection-z93iohVP.js";import{u as wt,d as Mt}from"./use-ai-providers-CiBlqHeC.js";import{A as lt}from"./avatar-CfKY2_hs.js";import{S as xe}from"./switch-YOR9drgK.js";import{c as pe,b as be,T as Te,a as Ee}from"./tooltip-BdbfQCYl.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-PIk2gDH0.js";import{t as Lt}from"./ChevronDown-DXOZkIso.js";import{i as Pt}from"./ChevronRight-BkBgwZxs.js";import{i as ze}from"./X-CvnlrpyG.js";import{a as Dt}from"./use-capability-DH5i0nun.js";import{A as kt}from"./access-gate-CAr_jPZ4.js";import"./table-COWO-rWc.js";import"./SwitchHorizontal01-D04vL0_f.js";import"./ChevronUp-BCwumcyZ.js";import"./sidebar-LVNues-1.js";import"./LayoutLeft-TAhoC2xE.js";import"./sheet-BvSpiY2r.js";import"./SearchMd-DmrRiPsU.js";import"./XCircle-CTJX6MKF.js";import"./agent-icon-BB2_1lHd.js";import"./AlertCircle-CKei65yQ.js";import"./Tool01-hkwqrr6Q.js";import"./ArrowUpRight-BygwtcZ2.js";import"./ZapSquare-bUJqwnW3.js";import"./Users03-CjtA3d84.js";import"./CheckCircle-BZlFJbF8.js";import"./ChevronLeft-DPLHregZ.js";import"./Stars02-CJJhFv2L.js";import"./Eye-IocHlobo.js";import"./ZoomOut-DRnFWZo9.js";import"./Globe01-CQy0Cxa-.js";import"./FilterLines-dauCx8Za.js";import"./Star01-G7bzpuzw.js";import"./Globe04-CBuYvlRn.js";import"./HardDrive-DSj8WeP3.js";import"./Key01-ktWRCkRP.js";import"./LinkExternal01-BenQb5F0.js";import"./Monitor01-CF5y8J9X.js";import"./Sun-CUZqy0kq.js";import"./Palette-ZSzAttfE.js";import"./Play-BrJBHlm8.js";import"./Shield01-CGOi4o3B.js";import"./Stars01-BxW6Ze_W.js";import"./Upload01-Cuswrale.js";import"./User01-DJhz4tmk.js";import"./Users01-D1GekRvz.js";import"./XClose-BbKrO-bh.js";import"./Zap-B-ccy6C4.js";import"./auth-DxKMCtEO.js";import"./use-collections-DaAI2dS_.js";import"./studio-tools-CJMVZA0W.js";import"./card-DU2I8eHH.js";import"./capability-load-error-Bab-5zvo.js";const Me="basic-usage",Le=[{id:Me,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","VIRTUAL_MCP_LAST_USED_LIST","AUTOMATION_GET","AUTOMATION_LIST","AUTOMATION_RUN_STATS","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_CREDITS","AI_PROVIDER_TOPUP_URL","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","FILE_OBJECTS_LIST","SANDBOX_START","SANDBOX_DELETE","GLOBAL_SEARCH","ORGANIZATION_SETTINGS_GET","USER_GET","LINK_CURRENT_GET","LINK_DISCONNECT","BRAND_CONTEXT_LIST","COLLECTION_THREADS_CREATE","COLLECTION_THREADS_LIST","COLLECTION_THREADS_GET","COLLECTION_THREADS_UPDATE","COLLECTION_THREADS_DELETE","COLLECTION_THREAD_MESSAGES_LIST","THREAD_BACKGROUND_TOOL_START","THREAD_SUBTASK_DELIVER"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_LIST","ORGANIZATION_DOMAIN_ADD","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_VERIFY","ORGANIZATION_DOMAIN_REMOVE"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE","ORGANIZATION_JOIN_REQUEST_LIST","ORGANIZATION_JOIN_REQUEST_APPROVE","ORGANIZATION_JOIN_REQUEST_DENY"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE","COMMERCE_DISCOVERY_SETUP"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_TRIGGER_ROTATE_TOKEN","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS","MONITORING_THREAD_USAGE"]},{id:"secrets:manage",label:"Manage secrets",description:"Create and list secrets stored in the credential vault",section:"Organization",tools:["SECRET_CREATE","SECRET_LIST"]},{id:"file-configs:manage",label:"Manage file configs",description:"Create, list, update and delete S3 bucket configurations",section:"Organization",tools:["FILE_CONFIG_CREATE","FILE_CONFIG_LIST","FILE_CONFIG_UPDATE","FILE_CONFIG_DELETE","FILE_OBJECTS_LIST"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_KEY_UPDATE","AI_PROVIDER_KEY_PREVIEW","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}];[...Le.find(t=>t.id===Me)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Le.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Le){if(e.id===Me)continue;const n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Bt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function Vt(t,e,n){if(n){const i=new Set(e);for(const r of t.tools)i.add(r);return Array.from(i)}const l=new Set(e);for(const i of t.tools)l.delete(i);return Array.from(l)}function zt(t){const e=q.c(21),{connection:n,isSelected:l,hasToolsEnabled:i,activeToolsCount:r,totalToolsCount:d,onSelect:h,onToggle:c}=t,g=l?"bg-accent/50":"hover:bg-muted/50";let f;e[0]!==g?(f=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",g),e[0]=g,e[1]=f):f=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx(ye,{icon:n.icon,name:n.title,size:"xs"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let x;e[5]!==n.title?(x=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),e[5]=n.title,e[6]=x):x=e[6];let o;e[7]!==h||e[8]!==a||e[9]!==x?(o=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:h,children:[a,x]}),e[7]=h,e[8]=a,e[9]=x,e[10]=o):o=e[10];let m;e[11]!==r||e[12]!==n.tools||e[13]!==i||e[14]!==c||e[15]!==d?(m=n.tools&&n.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[r,"/",d]}),s.jsx(we,{checked:i,onCheckedChange:c,onClick:Yt})]}),e[11]=r,e[12]=n.tools,e[13]=i,e[14]=c,e[15]=d,e[16]=m):m=e[16];let N;return e[17]!==f||e[18]!==o||e[19]!==m?(N=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=N):N=e[20],N}function Yt(t){return t.stopPropagation()}function $t(t){const e=q.c(18),{connectionId:n,tool:l,isSelected:i,onToggle:r}=t,d=`tool-${n}-${l.name}`,h=i?"text-foreground":"text-muted-foreground";let c;e[0]!==h?(c=K("text-sm font-medium",h),e[0]=h,e[1]=c):c=e[1];let g;e[2]!==c||e[3]!==l.name?(g=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:c,children:l.name})}),e[2]=c,e[3]=l.name,e[4]=g):g=e[4];let f;e[5]!==l.description?(f=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),e[5]=l.description,e[6]=f):f=e[6];let a;e[7]!==g||e[8]!==f?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[g,f]}),e[7]=g,e[8]=f,e[9]=a):a=e[9];const x=`tool-${n}-${l.name}`;let o;e[10]!==i||e[11]!==r||e[12]!==x?(o=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:x,checked:i,onCheckedChange:r,onClick:Ft})}),e[10]=i,e[11]=r,e[12]=x,e[13]=o):o=e[13];let m;return e[14]!==d||e[15]!==a||e[16]!==o?(m=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:d,children:[a,o]}),e[14]=d,e[15]=a,e[16]=o,e[17]=m):m=e[17],m}function Ft(t){return t.stopPropagation()}function Kt({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[i,r]=$.useState(""),d=l!==void 0?l:i,h=$.useDeferredValue(d),[c,g]=$.useState("all"),[f,a]=$.useState(!1),x=$.useRef(new Set(Object.keys(t))),{org:o}=Ne(),m=Rt({connectionId:jt,orgId:o.id,orgSlug:o.slug}),N=100,E=h.trim(),T=E?{operator:"or",conditions:[{field:["title"],operator:"contains",value:E},{field:["description"],operator:"contains",value:E}]}:void 0,S=!!n,C={...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:0,...S&&{include_virtual:!0}},v=JSON.stringify(C),{data:_,fetchNextPage:O,hasNextPage:p,isFetchingNextPage:R}=Ot({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:N,offset:b,...S&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,H)=>Q+(H?.items?.length??0),0)},staleTime:3e4}),I=_?.pages.flatMap(b=>b?.items??[])??[],j=Ct(O,p??!1,R),u=n?I.filter(b=>b.connection_type!=="VIRTUAL"?!0:dt(b.connection_url)!==n):I,w=x.current,A=[...w.values()].map(b=>u.find(D=>D.id===b)).filter(b=>b!==void 0),k=u.filter(b=>!w.has(b.id)),G=[...A,...k],U=b=>{const D=t[b];return D!==void 0&&D.length>0},B=G.filter(b=>{if(c==="all")return!0;const D=U(b.id);return c==="selected"?D:c==="unselected"?!D:!0}),[M,z]=$.useState(G[0]?.id??null),y=M?G.find(b=>b.id===M)??null:null,{data:L,isFetching:Y}=Oe({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",M??""),queryFn:async()=>M?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:M}})).structuredContent?.item??null:null,enabled:!!M,staleTime:3e4}),F=L?.tools??[],X=(b,D)=>t[b]?.includes(D)??!1,J=(b,D)=>{const Q=t[b]??[],H=Q.includes(D),W={...t};if(H){const Z=Q.filter(ee=>ee!==D);Z.length===0?delete W[b]:W[b]=Z}else W[b]=[...Q,D];e(W)},le=b=>{const D=b===M?F:[];if(!D.length)return;const Q=t[b]??[],H=D.map(ee=>ee.name),W=Q.length>0&&H.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=H,z(b)),e(Z)},oe=b=>{z(b),a(!0)},ie=()=>{a(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",f&&"hidden md:flex"),children:[l===void 0&&s.jsx(vt,{value:i,onChange:r,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:B.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[B.map(b=>{const D=M===b.id,Q=D?F.length:0,H=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:H,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),R&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:K("flex-1 flex-col",f?"flex":"hidden md:flex"),children:y?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:ie,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(At,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ye,{icon:y.icon,name:y.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:y.title}),y.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:Y?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})}):F.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:F.map(b=>s.jsx($t,{connectionId:y.id,tool:b,isSelected:X(y.id,b.name),onToggle:()=>J(y.id,b.name)},b.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}const Se=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],Qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function qt(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Se.length;return Se[n]??Se[0]}function Ht(t,e){return Qt[t]??"bg-neutral-400"}const Zt=Pe({role:Pe({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:ke(),staticPermissions:Ie(se()),toolSet:De(se(),Ie(se())),allowAllModels:ke(),modelSet:De(se(),Ie(se())),memberIds:Ie(se())});function ot(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Ye(t,e,n){const l=s.jsx(xe,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Xt(t){const e=q.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:i,onPermissionsChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d;let g;e[0]!==h?(g=h.trim().toLowerCase(),e[0]=h,e[1]=g):g=e[1];const f=$.useDeferredValue(g);let a;if(e[2]!==n||e[3]!==f||e[4]!==i||e[5]!==r||e[6]!==c||e[7]!==h||e[8]!==l){const x=Ut(),o=(v,_)=>{if(!c){if(n&&_){const O=x.flatMap(es).flatMap(Wt);i(!1),r(O.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!_))}};let m;e[10]!==f?(m=v=>{const{section:_,capabilities:O}=v;return{section:_,capabilities:O.filter(p=>!f||p.label.toLowerCase().includes(f)||p.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const N=x.map(m).filter(Jt);let E;e[12]!==n||e[13]!==i||e[14]!==r?(E=()=>{i(!n),r([])},e[12]=n,e[13]=i,e[14]=r,e[15]=E):E=e[15];let T;e[16]!==n||e[17]!==c||e[18]!==E?(T=Ye(n,c,E),e[16]=n,e[17]=c,e[18]=E,e[19]=T):T=e[19];let S;e[20]!==n||e[21]!==i||e[22]!==r||e[23]!==c?(S=c?void 0:()=>{i(!n),r([])},e[20]=n,e[21]=i,e[22]=r,e[23]=c,e[24]=S):S=e[24];let C;e[25]!==T||e[26]!==S?(C=s.jsx(Ue,{title:"General",children:s.jsx(Be,{children:s.jsx(Ve,{title:"All organization permissions",description:"Grant full access to all features below",action:T,onClick:S})})}),e[25]=T,e[26]=S,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,N.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):N.map(v=>{const{section:_,capabilities:O}=v;return s.jsx(Ue,{title:_,children:s.jsx(Be,{children:O.map(p=>{const R=Bt(p,l,n);return s.jsx(Ve,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[p.label,p.dangerous&&s.jsx(ft,{size:12,className:"text-amber-500 shrink-0"})]}),description:p.description,action:Ye(R,c,()=>o(p,R)),onClick:c?void 0:()=>o(p,R)},p.id)})})},_)})]})}),e[2]=n,e[3]=f,e[4]=i,e[5]=r,e[6]=c,e[7]=h,e[8]=l,e[9]=a}else a=e[9];return a}function Jt(t){return t.capabilities.length>0}function Wt(t){return t.tools}function es(t){return t.capabilities}const it={anthropic:"Anthropic",openrouter:"OpenRouter"},ts={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ss(t,e){const n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ns(t){return ts[t]??it[t]??t}function ls(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const rt=30;function os(t){const e=q.c(44),{connectionId:n,subProviderId:l,subProviderName:i,groupLogo:r,models:d,allConnectionModelIds:h,selectedModels:c,allowAllModels:g,allConnectionModelsSelected:f,onToggleModel:a,onExitAllowAll:x,readOnly:o,defaultExpanded:m}=t,[N,E]=$.useState(m),T=m||N,S=E,[C,v]=$.useState(rt);let _;e[0]!==f||e[1]!==g||e[2]!==c?(_=j=>g||f||c.includes("*")||c.includes(j),e[0]=f,e[1]=g,e[2]=c,e[3]=_):_=e[3];const O=_;let p;if(e[4]!==O||e[5]!==d){let j;e[7]!==O?(j=u=>O(u.id),e[7]=O,e[8]=j):j=e[8],p=d.filter(j),e[4]=O,e[5]=d,e[6]=p}else p=e[6];const R=p.length;let I;if(e[9]!==h||e[10]!==g||e[11]!==n||e[12]!==R||e[13]!==T||e[14]!==r||e[15]!==O||e[16]!==d||e[17]!==x||e[18]!==a||e[19]!==o||e[20]!==l||e[21]!==i||e[22]!==C){const j=d.slice(0,C),u=d.length>C;let w;e[24]===Symbol.for("react.memo_cache_sentinel")?(w=()=>S(cs),e[24]=w):w=e[24];const A=r??tt[l]??st;let k;e[25]!==i||e[26]!==A?(k=s.jsx(ye,{icon:A,name:i,size:"sm"}),e[25]=i,e[26]=A,e[27]=k):k=e[27];let G;e[28]!==i?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:i}),e[28]=i,e[29]=G):G=e[29];let U;e[30]!==k||e[31]!==G?(U=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[k,G]}),e[30]=k,e[31]=G,e[32]=U):U=e[32];let B;e[33]!==R||e[34]!==d.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[R,"/",d.length," enabled"]}),e[33]=R,e[34]=d.length,e[35]=B):B=e[35];let M;e[36]!==T?(M=T?s.jsx(Lt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=T,e[37]=M):M=e[37];let z;e[38]!==M||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,M]}),e[38]=M,e[39]=B,e[40]=z):z=e[40];let y;e[41]!==z||e[42]!==U?(y=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:w,children:[U,z]}),e[41]=z,e[42]=U,e[43]=y):y=e[43],I=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[y,T&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(L=>{const Y=O(L.id),F=()=>{if(!o){if(g){x(n,h,L.id);return}a(n,L.id)}};return s.jsxs("div",{className:K("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!o&&"hover:bg-muted/50 cursor-pointer"),onClick:F,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:L.title})}),s.jsx("div",{onClick:as,children:o?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:Y,disabled:!0,onCheckedChange:rs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:Y,onCheckedChange:F})})]},L.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>v(is),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=g,e[11]=n,e[12]=R,e[13]=T,e[14]=r,e[15]=O,e[16]=d,e[17]=x,e[18]=a,e[19]=o,e[20]=l,e[21]=i,e[22]=C,e[23]=I}else I=e[23];return I}function is(t){return t+rt}function rs(){}function as(t){return t.stopPropagation()}function cs(t){return!t}function ds(t){const e=q.c(33),{connection:n,selectedModels:l,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:g}=t,f=Mt(n.id);let a,x,o,m,N;if(e[0]!==h||e[1]!==i||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==d||e[6]!==r||e[7]!==f||e[8]!==g||e[9]!==c||e[10]!==l){N=Symbol.for("react.early_return_sentinel");e:{let S;e[16]!==n.label?(S=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=S):S=e[17];const C=f.filter(hs).map(S),v=c.trim().toLowerCase(),_=v?C.filter(A=>A.title.toLowerCase().includes(v)||A.id.toLowerCase().includes(v)||A.provider?.toLowerCase().includes(v)):C;if(_.length===0){N=null;break e}const O=new Map;for(const A of _){const k=ss(A.id,n.providerId),G=O.get(k)??{models:[],logo:null};G.models.push({id:A.id,title:ls(A.title),logo:A.logo}),!G.logo&&A.logo&&(G.logo=A.logo),O.set(k,G)}const p=Array.from(O.entries()).map(fs).sort(us),R=p.length===1||v.length>0;o="flex flex-col gap-3";const I=tt[n.providerId]??st;let j;e[18]!==n.providerId||e[19]!==I?(j=s.jsx("img",{src:I,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=I,e[20]=j):j=e[20];const u=it[n.providerId]??n.providerId;let w;e[21]!==u?(w=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=w):w=e[22],e[23]!==w||e[24]!==j?(m=s.jsxs("div",{className:"flex items-center gap-2",children:[j,w]}),e[23]=w,e[24]=j,e[25]=m):m=e[25],a="flex flex-col gap-3",x=p.map(A=>s.jsx(os,{connectionId:n.id,subProviderId:A.id,subProviderName:A.name,groupLogo:A.logo,models:A.models,allConnectionModelIds:C.map(ms),selectedModels:l,allowAllModels:i,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:d,readOnly:g,defaultExpanded:R},A.id))}e[0]=h,e[1]=i,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=d,e[6]=r,e[7]=f,e[8]=g,e[9]=c,e[10]=l,e[11]=a,e[12]=x,e[13]=o,e[14]=m,e[15]=N}else a=e[11],x=e[12],o=e[13],m=e[14],N=e[15];if(N!==Symbol.for("react.early_return_sentinel"))return N;let E;e[26]!==a||e[27]!==x?(E=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=E):E=e[28];let T;return e[29]!==o||e[30]!==m||e[31]!==E?(T=s.jsxs("div",{className:o,children:[m,E]}),e[29]=o,e[30]=m,e[31]=E,e[32]=T):T=e[32],T}function ms(t){return t.id}function us(t,e){return t.name.localeCompare(e.name)}function fs(t){const[e,n]=t;return{id:e,name:ns(e),logo:n.logo,models:n.models}}function hs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function gs(t){const e=q.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:i,onModelSetChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d,g=$.useDeferredValue(h),f=wt();let a;e[0]!==l||e[1]!==r?(a=(p,R)=>{const I=l[p]??[],j={...l};if(I.includes(R)){const u=I.filter(w=>w!==R);u.length===0?delete j[p]:j[p]=u}else j[p]=[...I,R];r(j)},e[0]=l,e[1]=r,e[2]=a):a=e[2];const x=a;let o;e[3]!==l||e[4]!==i||e[5]!==r?(o=(p,R,I)=>{i(!1),r({...l,[p]:R.filter(j=>j!==I)})},e[3]=l,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,N=!c&&"hover:bg-muted/50 cursor-pointer";let E;e[7]!==N?(E=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",N),e[7]=N,e[8]=E):E=e[8];let T;e[9]!==n||e[10]!==i||e[11]!==r||e[12]!==c?(T=()=>{if(c)return;const p=!n;i(p),p&&r({})},e[9]=n,e[10]=i,e[11]=r,e[12]=c,e[13]=T):T=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=S):S=e[14];let C;e[15]!==n||e[16]!==i||e[17]!==r||e[18]!==c?(C=s.jsx("div",{onClick:ps,children:c?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:n,onCheckedChange:p=>{i(p),p&&r({})}})}),e[15]=n,e[16]=i,e[17]=r,e[18]=c,e[19]=C):C=e[19];let v;e[20]!==E||e[21]!==T||e[22]!==C?(v=s.jsxs("div",{className:E,onClick:T,children:[S,C]}),e[20]=E,e[21]=T,e[22]=C,e[23]=v):v=e[23];let _;e[24]!==f||e[25]!==n||e[26]!==g||e[27]!==m||e[28]!==l||e[29]!==c||e[30]!==x?(_=f.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):f.map(p=>s.jsx($.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(fe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(ds,{connection:p,selectedModels:l[p.id]??[],allowAllModels:n,onToggleModel:x,onExitAllowAll:m,allConnectionModelsSelected:(l[p.id]??[]).includes("*"),searchQuery:g,readOnly:c})},p.id)),e[24]=f,e[25]=n,e[26]=g,e[27]=m,e[28]=l,e[29]=c,e[30]=x,e[31]=_):_=e[31];let O;return e[32]!==_||e[33]!==v?(O=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,_]}),e[32]=_,e[33]=v,e[34]=O):O=e[34],O}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=q.c(52),{open:n,onOpenChange:l,selectedMemberIds:i,onAddMembers:r}=t,[d,h]=$.useState(""),c=$.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[f,a]=$.useState(g),{data:x}=nt();let o,m,N,E,T,S,C,v,_,O,p;if(e[1]!==x?.data?.members||e[2]!==c||e[3]!==r||e[4]!==l||e[5]!==n||e[6]!==f||e[7]!==d||e[8]!==i){const U=x?.data?.members??[];let B;e[20]!==c?(B=y=>{const L=c.toLowerCase();return y.user?.name?.toLowerCase().includes(L)||y.user?.email?.toLowerCase().includes(L)},e[20]=c,e[21]=B):B=e[21];const M=U.filter(B);let z;e[22]!==r||e[23]!==l||e[24]!==f?(z=()=>{r(f),a([]),l(!1)},e[22]=r,e[23]=l,e[24]=f,e[25]=z):z=e[25],N=z,m=Qe,O=n,p=l,o=qe,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(He,{className:"px-6 pt-6",children:[s.jsx(Ze,{children:"Add Members to Role"}),s.jsx(Xe,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],S="flex flex-col h-80",e[27]!==d?(C=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(ve,{value:d,onChange:h,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=C):C=e[28],E="flex-1 overflow-auto",T=M.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:M.map(y=>{const L=y.role!=="owner",Y=i.includes(y.id),F=f.includes(y.id);return s.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!L||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:F||Y,onCheckedChange:()=>{!L||Y||a(X=>X.includes(y.id)?X.filter(J=>J!==y.id):[...X,y.id])},disabled:!L||Y}),s.jsx(lt,{url:y.user?.image??void 0,fallback:ot(y.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:y.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.user?.email})]}),!L&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&L&&s.jsx(ge,{variant:"outline",className:"shrink-0",children:"Added"})]},y.id)})}),e[1]=x?.data?.members,e[2]=c,e[3]=r,e[4]=l,e[5]=n,e[6]=f,e[7]=d,e[8]=i,e[9]=o,e[10]=m,e[11]=N,e[12]=E,e[13]=T,e[14]=S,e[15]=C,e[16]=v,e[17]=_,e[18]=O,e[19]=p}else o=e[9],m=e[10],N=e[11],E=e[12],T=e[13],S=e[14],C=e[15],v=e[16],_=e[17],O=e[18],p=e[19];let R;e[29]!==E||e[30]!==T?(R=s.jsx("div",{className:E,children:T}),e[29]=E,e[30]=T,e[31]=R):R=e[31];let I;e[32]!==R||e[33]!==S||e[34]!==C?(I=s.jsxs("div",{className:S,children:[C,R]}),e[32]=R,e[33]=S,e[34]=C,e[35]=I):I=e[35];let j;e[36]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Je,{children:"Cancel"}),e[36]=j):j=e[36];const u=f.length===0,w=f.length>0&&`(${f.length})`;let A;e[37]!==N||e[38]!==u||e[39]!==w?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:N,disabled:u,children:["Add ",w]})]}),e[37]=N,e[38]=u,e[39]=w,e[40]=A):A=e[40];let k;e[41]!==o||e[42]!==I||e[43]!==A||e[44]!==v||e[45]!==_?(k=s.jsxs(o,{className:v,children:[_,I,A]}),e[41]=o,e[42]=I,e[43]=A,e[44]=v,e[45]=_,e[46]=k):k=e[46];let G;return e[47]!==m||e[48]!==k||e[49]!==O||e[50]!==p?(G=s.jsx(m,{open:O,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=O,e[50]=p,e[51]=G):G=e[51],G}function Ts(t){const e=q.c(29),{memberIds:n,onMemberIdsChange:l,readOnly:i,readOnlyMessage:r,searchQuery:d,addMemberDialogOpen:h,onAddMemberDialogOpenChange:c}=t,g=i===void 0?!1:i,f=r===void 0?"Owner membership cannot be changed":r,a=$.useDeferredValue(d),{data:x}=nt();let o,m,N;if(e[0]!==x?.data?.members||e[1]!==a||e[2]!==n||e[3]!==l||e[4]!==g||e[5]!==f||e[6]!==d){const v=x?.data?.members??[];let _;e[10]!==n?(_=I=>n.includes(I.id),e[10]=n,e[11]=_):_=e[11];const O=v.filter(_);let p;e[12]!==a?(p=I=>{const j=a.toLowerCase();return I.user?.name?.toLowerCase().includes(j)||I.user?.email?.toLowerCase().includes(j)},e[12]=a,e[13]=p):p=e[13];const R=O.filter(p);N="flex flex-col h-full",o="flex-1 overflow-auto",m=O.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',d,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:R.map(I=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(lt,{url:I.user?.image??void 0,fallback:ot(I.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:I.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:I.user?.email})]}),g?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Ee,{children:s.jsx("p",{children:f})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(j=>j!==I.id)),children:s.jsx(ze,{size:16})})]},I.id))}),e[0]=x?.data?.members,e[1]=a,e[2]=n,e[3]=l,e[4]=g,e[5]=f,e[6]=d,e[7]=o,e[8]=m,e[9]=N}else o=e[7],m=e[8],N=e[9];let E;e[14]!==o||e[15]!==m?(E=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=E):E=e[16];let T;e[17]!==n||e[18]!==l?(T=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=T):T=e[19];let S;e[20]!==h||e[21]!==n||e[22]!==c||e[23]!==T?(S=s.jsx(bs,{open:h,onOpenChange:c,selectedMemberIds:n,onAddMembers:T}),e[20]=h,e[21]=n,e[22]=c,e[23]=T,e[24]=S):S=e[24];let C;return e[25]!==N||e[26]!==E||e[27]!==S?(C=s.jsxs("div",{className:N,children:[E,S]}),e[25]=N,e[26]=E,e[27]=S,e[28]=C):C=e[28],C}function Es(t){const e=q.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx($.Suspense,{fallback:n,children:s.jsx(Ts,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const _s={owner:[],admin:[],user:[]};function Is(t,e,n,l){const i=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:i,staticPermissions:_s[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(r=>r.role===t).map(r=>r.id)}}function Ns(t,e,n){const l=t.permission||{},i=l.self||[],r=i.includes("*"),d=r?[]:i.filter(a=>a!=="*"),h={};for(const[a,x]of Object.entries(l))if(!(a==="self"||a==="models"))if(a==="*")for(const o of n)h[o.id]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x;else{const o=n.find(m=>m.id===a);o&&(h[a]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x)}const c=l.models||[],g=c.length===0||c.includes("*:*"),f={};if(!g)for(const a of c){const x=a.indexOf(":");if(x===-1)continue;const o=a.slice(0,x),m=a.slice(x+1);f[o]||(f[o]=[]),f[o].push(m)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:r,staticPermissions:d,toolSet:h,allowAllModels:g,modelSet:f,memberIds:e.filter(a=>a.role===t.role).map(a=>a.id)}}function Ss(t,e){const n={};t.allowAllStaticPermissions?n.self=["*"]:t.staticPermissions.length>0&&(n.self=t.staticPermissions);for(const[l,i]of Object.entries(t.toolSet))if(i.length>0){const d=e.find(h=>h.id===l)?.tools?.map(h=>h.name)??[];n[l]=d.length>0&&d.every(h=>i.includes(h))?["*"]:i}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[i,r]of Object.entries(t.modelSet))for(const d of r)l.push(`${i}:${d}`);l.length>0&&(n.models=l)}return n}function Cs(t,e,n){return t.kind==="builtin"?Is(t.role,e,void 0):t.kind==="custom"?Ns(t.role,e,n):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function As(t){const e=q.c(6),{readOnly:n,readOnlyMessage:l,onOpen:i}=t,r=l===void 0?"Owner membership cannot be changed":l;if(n){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Te,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Ae,{size:16}),"Add Member"]})})}),e[0]=c):c=e[0];let g;return e[1]!==r?(g=s.jsx(pe,{children:s.jsxs(be,{children:[c,s.jsx(Ee,{children:s.jsx("p",{children:r})})]})}),e[1]=r,e[2]=g):g=e[2],g}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ae,{size:16}),e[3]=d):d=e[3];let h;return e[4]!==i?(h=s.jsxs(ne,{variant:"outline",size:"sm",onClick:i,children:[d,"Add Member"]}),e[4]=i,e[5]=h):h=e[5],h}function Os(t){const e=q.c(14),{locator:n}=Ne(),l=je(),i=yt();let r;e[0]!==n?(r=re.members(n),e[0]=n,e[1]=r):r=e[1];let d;e[2]!==l?(d=()=>l.organization.listMembers(),e[2]=l,e[3]=d):d=e[3];let h;e[4]!==r||e[5]!==d?(h={queryKey:r,queryFn:d},e[4]=r,e[5]=d,e[6]=h):h=e[6];const{data:c,isPending:g}=Oe(h);if(g||!i){let o;return e[7]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=o):o=e[7],o}let f;e[8]!==c?.data?.members?(f=c?.data?.members??[],e[8]=c?.data?.members,e[9]=f):f=e[9];const a=f;let x;return e[10]!==i||e[11]!==a||e[12]!==t?(x=s.jsx(Rs,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Rs({target:t,onBack:e,onSaved:n,members:l,connections:i}){const{locator:r}=Ne(),d=je(),h=$e(),c=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",f=t.kind==="new",[a,x]=$.useState(c?"org":"mcp"),o=mt({resolver:ut(Zt),defaultValues:Cs(t,l,i)}),m=o.formState.isValid,N=o.formState.isDirty,E=Fe({mutationFn:async u=>{const w=Ss(u,i),A=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),k=(u.role.slug==="owner"||u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,G=async(U,B)=>{const M=l.filter(L=>L.role===(B??U)).map(L=>L.id),z=u.memberIds.filter(L=>!M.includes(L)),y=M.filter(L=>!u.memberIds.includes(L));for(const L of z){const Y=await d.organization.updateMemberRole({memberId:L,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const L of y){const Y=await d.organization.updateMemberRole({memberId:L,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(k)return await G(u.role.slug),u;if(u.role.id){const U=u.role.label.toLowerCase().replace(/\s+/g,"-"),B=u.role.slug,M=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:w,...M?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(M?U:B,M?B:void 0),M?{...u,role:{...u.role,slug:U}}:u}else{const U=await d.organization.createRole({role:A,permission:w});if(U?.error)throw new Error(U.error.message??"Something went wrong");for(const B of u.memberIds){const M=await d.organization.updateMemberRole({memberId:B,role:[A]});if(M?.error)throw new Error(M.error.message)}return{...u,role:{...u.role,id:U.data?.roleData?.id,slug:A}}}},onSuccess:(u,w)=>{h.invalidateQueries({queryKey:re.members(r)}),h.invalidateQueries({queryKey:re.organizationRoles(r)});const A=!w.role.id&&!w.role.slug,k=w.role.slug==="owner"&&!w.role.id;Re(k?"role_members_updated":A?"role_created":"role_updated",{role_slug:w.role.slug??null}),he.success(k?"Members updated successfully!":A?"Role created successfully!":"Role updated successfully!"),o.reset(u),n(u.role.id)},onError:u=>{he.error(u instanceof Error?u.message:"Failed to save role")}}),T=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}E.mutate(u)}),S=!g,C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,O]=$.useState(""),[p,R]=$.useState(!1),I=u=>{x(u),O("")},j={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:K("flex flex-col",a!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:S&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:E.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:T,disabled:E.isPending||!m||!N,children:E.isPending?"Saving...":f?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",t.kind==="builtin"?Ht(t.role):qt(o.watch("role.label")))}),g&&s.jsx(Ke,{size:16,className:"text-muted-foreground shrink-0"}),f||t.kind==="custom"?s.jsx("input",{...o.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:f}):s.jsx("span",{className:"truncate",children:C})]})}),s.jsx("div",{className:"flex items-center gap-2",children:v.map(u=>s.jsx("button",{type:"button",onClick:()=>I(u.id),className:K("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",a===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(ve,{value:_,onChange:O,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>R(!0)})]})]})}),s.jsx("div",{className:K("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",a!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:K(a!=="org"&&"h-full overflow-hidden",a!=="models"&&a!=="org"&&"border border-border rounded-xl bg-card"),children:[a==="mcp"&&!g&&s.jsx(Kt,{toolSet:o.watch("toolSet"),onToolSetChange:u=>o.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),a==="org"&&s.jsx(Xt,{allowAllStaticPermissions:o.watch("allowAllStaticPermissions"),staticPermissions:o.watch("staticPermissions"),onAllowAllChange:u=>o.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>o.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="models"&&s.jsx(gs,{allowAllModels:o.watch("allowAllModels"),modelSet:o.watch("modelSet"),onAllowAllChange:u=>o.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>o.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="members"&&s.jsx(Es,{memberIds:o.watch("memberIds"),onMemberIdsChange:u=>o.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&(t.role==="owner"||t.role==="user"),readOnlyMessage:t.kind==="builtin"&&t.role==="user"?"User is the default role — members can't be removed from it; assign another role to change their access":"Owner membership cannot be changed",searchQuery:_,addMemberDialogOpen:p,onAddMemberDialogOpenChange:R})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=q.c(6),{area:n,children:l}=t,{isPrivileged:i,loading:r,error:d}=Dt();let h;return e[0]!==n||e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==r?(h=s.jsx(kt,{granted:i,loading:r,error:d,area:n,children:l}),e[0]=n,e[1]=l,e[2]=d,e[3]=i,e[4]=r,e[5]=h):h=e[5],h}const ys=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function ws(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??Ce[0]}const Ms={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ls(t,e){return e?Ms[t]??"bg-neutral-400":ws(t)}function Ps(){const t=q.c(77),[e,n]=$.useState(""),[l,i]=$.useState(null),r=gt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:h}=xt(d),{locator:c}=Ne(),g=je(),f=$e(),{customRoles:a,refetch:x}=pt();let o;t[1]!==r?(o=P=>r({to:".",search:V=>({...V,role:P})}),t[1]=r,t[2]=o):o=t[2];const m=o;let N;e:{if(!h){N=null;break e}if(h==="new"){N={kind:"new"};break e}if(h.startsWith("builtin-")){N={kind:"builtin",role:h.slice(8)};break e}let P;t[3]!==h?(P=ae=>ae.id===h,t[3]=h,t[4]=P):P=t[4];const V=a.find(P);N=V?{kind:"custom",role:V}:null}const E=N;let T;t[5]!==c?(T=re.members(c),t[5]=c,t[6]=T):T=t[6];let S;t[7]!==g?(S=()=>g.organization.listMembers(),t[7]=g,t[8]=S):S=t[8];let C;t[9]!==T||t[10]!==S?(C={queryKey:T,queryFn:S},t[9]=T,t[10]=S,t[11]=C):C=t[11];const{data:v}=Oe(C);let _;t[12]!==v?.data?.members?(_=v?.data?.members??[],t[12]=v?.data?.members,t[13]=_):_=t[13];const O=_;let p;t[14]!==O?(p=P=>O.filter(V=>V.role===P).length,t[14]=O,t[15]=p):p=t[15];const R=p;let I;if(t[16]!==a||t[17]!==R||t[18]!==e){let P;t[20]!==R?(P=ce=>({kind:"builtin",role:{...ce,memberCount:R(ce.role)}}),t[20]=R,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==R?(ae=ce=>({kind:"custom",role:{...ce,memberCount:R(ce.role)}}),t[22]=R,t[23]=ae):ae=t[23];const at=a.map(ae);if(I=[...V,...at],e){const ce=e.toLowerCase();I=I.filter(ct=>ct.role.label.toLowerCase().includes(ce))}t[16]=a,t[17]=R,t[18]=e,t[19]=I}else I=t[19];let j;t[24]!==g?(j=async P=>{const V=await g.organization.deleteRole({roleId:P});if(V?.error)throw new Error(V.error.message);return V?.data},t[24]=g,t[25]=j):j=t[25];const u=Fe({mutationFn:j,onSuccess:(P,V)=>{Re("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),x(),E?.kind==="custom"&&E.role.id===V&&m(void 0)},onError:zs});let w,A,k,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Vs,cellClassName:"flex-1 min-w-0",sortable:!0},w={id:"type",header:"Type",render:Bs,cellClassName:"w-28 shrink-0"},A={id:"permissions",header:"Permissions",render:Us,cellClassName:"flex-1 min-w-0"},k={id:"members",header:"Members",render:Gs,cellClassName:"w-24 shrink-0"},t[26]=w,t[27]=A,t[28]=k,t[29]=G):(w=t[26],A=t[27],k=t[28],G=t[29]);let U;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=[G,w,A,k,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(Tt,{children:[s.jsx(Et,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ks,children:s.jsx(Nt,{size:16})})}),s.jsx(_t,{align:"end",onClick:Ds,children:s.jsxs(It,{variant:"destructive",onClick:()=>{const V=P.role;V.id&&i({id:V.id,label:V.label})},children:[s.jsx(St,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=U):U=t[30];const B=U;let M;t[31]!==m?(M=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=M):M=t[32];const z=M;if(E){let P;t[33]!==m?(P=()=>m(void 0),t[33]=m,t[34]=P):P=t[34];let V;return t[35]!==x||t[36]!==m?(V=()=>{x(),m(void 0)},t[35]=x,t[36]=m,t[37]=V):V=t[37],s.jsx(Os,{target:E,onBack:P,onSaved:V},js(E))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let L;t[39]===Symbol.for("react.memo_cache_sentinel")?(L=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=L):L=t[39];let Y;t[40]!==e?(Y=s.jsx(ve,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:L}),t[40]=e,t[41]=Y):Y=t[41];let F;t[42]!==m?(F=()=>m("new"),t[42]=m,t[43]=F):F=t[43];let X;t[44]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx(Ae,{size:16}),t[44]=X):X=t[44];let J;t[45]!==F?(J=s.jsxs(ne,{onClick:F,children:[X,"Create Role"]}),t[45]=F,t[46]=J):J=t[46];let le;t[47]!==Y||t[48]!==J?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,J]}),t[47]=Y,t[48]=J,t[49]=le):le=t[49];let oe;t[50]!==e?(oe=e?s.jsx(Ge,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(Ge,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=oe):oe=t[51];let ie;t[52]!==I||t[53]!==B||t[54]!==z||t[55]!==oe?(ie=s.jsx(bt,{columns:B,data:I,isLoading:!1,onRowClick:z,emptyState:oe}),t[52]=I,t[53]=B,t[54]=z,t[55]=oe,t[56]=ie):ie=t[56];let b;t[57]!==le||t[58]!==ie?(b=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[y,le,ie]})})}),t[57]=le,t[58]=ie,t[59]=b):b=t[59];const D=l!==null;let Q;t[60]===Symbol.for("react.memo_cache_sentinel")?(Q=P=>!P&&i(null),t[60]=Q):Q=t[60];let H;t[61]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx(Ze,{children:"Delete Role"}),t[61]=H):H=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(He,{children:[H,s.jsxs(Xe,{children:['Are you sure you want to delete the "',W,'" role? This action cannot be undone.']})]}),t[62]=W,t[63]=Z):Z=t[63];let ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(Je,{children:"Cancel"}),t[64]=ee):ee=t[64];let de;t[65]!==u||t[66]!==l?(de=s.jsxs(We,{children:[ee,s.jsx(et,{onClick:()=>{l?.id&&u.mutate(l.id),i(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,t[67]=de):de=t[67];let me;t[68]!==Z||t[69]!==de?(me=s.jsxs(qe,{children:[Z,de]}),t[68]=Z,t[69]=de,t[70]=me):me=t[70];let ue;t[71]!==D||t[72]!==me?(ue=s.jsx(Qe,{open:D,onOpenChange:Q,children:me}),t[71]=D,t[72]=me,t[73]=ue):ue=t[73];let _e;return t[74]!==b||t[75]!==ue?(_e=s.jsxs(te,{children:[b,ue]}),t[74]=b,t[75]=ue,t[76]=_e):_e=t[76],_e}function Ds(t){return t.stopPropagation()}function ks(t){return t.stopPropagation()}function Gs(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function Us(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.join(", "):"No permissions"})}function Bs(t){return t.kind==="builtin"?s.jsx(ge,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(ge,{variant:"outline",className:"text-xs",children:"Custom"})}function Vs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",Ls(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(Ke,{size:12,className:"text-muted-foreground shrink-0"})]})}function zs(t,e){Re("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),he.error(t instanceof Error?t.message:"Failed to delete role")}function Ys(){const t=q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load roles"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ht,{fallback:e,children:s.jsx($.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Ps,{})})}),t[1]=n):n=t[1],n}function ml(){const t=q.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(vs,{area:"roles",children:s.jsx(Ys,{})}),t[0]=e):e=t[0],e}export{ml as default};
@@ -0,0 +1 @@
1
+ import{y as c}from"./preview-dialog-WfNb4k8L.js";function t(r){return(e,a)=>{c(e),r(e,a)}}export{t as c};
@@ -1 +1 @@
1
- import{c as m,j as s,i as o}from"./index-D9cso_OE.js";import{i as c}from"./AlertCircle-Caru_t3W.js";import{i as l}from"./ChevronUp-CiZNoBS5.js";function u(r){const e=m.c(3),{isPending:a,isError:n}=r;if(n){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[s.jsx(c,{size:13}),"Couldn't save"]}),e[0]=t):t=e[0],t}if(a){let t;return e[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(o,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=t):t=e[1],t}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[s.jsx(l,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}export{u as S};
1
+ import{c as m,j as s,i as o}from"./index-C6QaS0Zh.js";import{i as c}from"./AlertCircle-CKei65yQ.js";import{i as l}from"./ChevronUp-BCwumcyZ.js";function u(r){const e=m.c(3),{isPending:a,isError:n}=r;if(n){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[s.jsx(c,{size:13}),"Couldn't save"]}),e[0]=t):t=e[0],t}if(a){let t;return e[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(o,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=t):t=e[1],t}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[s.jsx(l,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}export{u as S};
@@ -1,2 +1,2 @@
1
- import{c as J,r as te,j as s,l as ge,B as Ce,t as Re,k as kn,K as Cn}from"./index-D9cso_OE.js";import{K as Tn,D as Lt,am as An,an as wn,ao as Rn,ap as In,aq as $n,ar as On,P as Dn,as as xt,N as gt,l as lt,S as Ln}from"./agent-icon-DY5w59uF.js";import{C as Fn}from"./calendar-katBc34c.js";import{I as ke}from"./input-aftZq0qp.js";import{L as be}from"./label-BlTB1rsr.js";import{a as Ft,b as Et,P as Mt}from"./popover-D43tJ8in.js";import{T as En}from"./textarea-DTW1SKGc.js";import{b as Mn}from"./XCircle-YOrPaSTA.js";import{d as Bn}from"./SwitchHorizontal01-DCwdrg-O.js";import{v as zn,y as Pn,z as Vn}from"./scroll-area-BSGl-_zx.js";import{S as Un}from"./switch-DalcHZ66.js";import{a as Bt,b as zt,c as Pt,S as Vt,d as Ut}from"./select-BGb-ZPds.js";import{u as Kt,a as Be,K as Ht,P as Wt,b as Yt,C as qt,s as Gt,d as nt,D as Xt,c as Qt,S as Zt,v as Jt,e as en}from"./sortable.esm-DIVJmvz6.js";import{c as ot}from"./ZoomOut-OytsIYD1.js";import{s as tn}from"./Plus-e8vsh1yI.js";import{s as We}from"./Trash01-C3khOwsb.js";import{D as nn,a as sn,b as rn,c as st}from"./dropdown-menu-BOrPFviJ.js";import{i as Oe,Y as Ye,Z as yt,m as ze,_ as Se,$ as ln,a0 as Kn,a1 as qe,a2 as Pe,a3 as Hn,a4 as Wn,a5 as rt,a6 as Yn,X as qn,n as vt,a7 as Gn,a8 as Xn}from"./index-DJ0Ge3cT.js";import{e as on,u as Qn,m as Zn,L as Jn,F as es,I as ts}from"./image-field-CopsGD8K.js";import{t as at}from"./ChevronDown-DeW1WG4N.js";import{i as an}from"./ChevronRight-DSC2aiCG.js";import{i as ns}from"./Globe01-B8cJAk0V.js";import{T as Ve,a as Ue,b as Ke}from"./tooltip-DVHwyu-W.js";import{i as ss}from"./ChevronUp-CiZNoBS5.js";import{d as rs}from"./Tool01-BDvWQGEc.js";import{b as cn,C as un,a as it,e as fn,c as dn,d as is,g as ls}from"./command-DJiJXkzC.js";import{i as os}from"./Upload01-BWq8M5mQ.js";import{c as as}from"./use-file-configs-C2ceyi4L.js";import{a as cs}from"./Eye-BSAOg3tU.js";import{i as us}from"./FilterLines-BWsEA6cc.js";const fs="oklch(0.65 0.15 160)",ds="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",mn="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]",Li="text-[oklch(0.45_0.15_160)] focus:bg-[oklch(0.65_0.15_160/0.12)] focus:text-[oklch(0.45_0.15_160)] dark:text-[oklch(0.78_0.15_160)] dark:focus:bg-[oklch(0.65_0.15_160/0.15)] dark:focus:text-[oklch(0.78_0.15_160)]";function bt(t){return t.map(e=>e.label).join(`
1
+ import{c as J,r as te,j as s,l as ge,B as Ce,t as Re,k as kn,K as Cn}from"./index-C6QaS0Zh.js";import{K as Tn,D as Lt,am as An,an as wn,ao as Rn,ap as In,aq as $n,ar as On,P as Dn,as as xt,N as gt,l as lt,S as Ln}from"./agent-icon-BB2_1lHd.js";import{C as Fn}from"./calendar-CaxcRF1k.js";import{I as ke}from"./input-szhd6Snj.js";import{L as be}from"./label-Bjb_vEVQ.js";import{a as Ft,b as Et,P as Mt}from"./popover-CJ-idfVW.js";import{T as En}from"./textarea-BTbunR8j.js";import{b as Mn}from"./XCircle-CTJX6MKF.js";import{d as Bn}from"./SwitchHorizontal01-D04vL0_f.js";import{v as zn,y as Pn,z as Vn}from"./scroll-area-Dz-FqKWj.js";import{S as Un}from"./switch-YOR9drgK.js";import{a as Bt,b as zt,c as Pt,S as Vt,d as Ut}from"./select-FwtHY18v.js";import{u as Kt,a as Be,K as Ht,P as Wt,b as Yt,C as qt,s as Gt,d as nt,D as Xt,c as Qt,S as Zt,v as Jt,e as en}from"./sortable.esm-DHMK7_tT.js";import{c as ot}from"./ZoomOut-DRnFWZo9.js";import{s as tn}from"./Plus-DptVePQj.js";import{s as We}from"./Trash01-Ds3jbDQE.js";import{D as nn,a as sn,b as rn,c as st}from"./dropdown-menu-DveShRRm.js";import{i as Oe,Y as Ye,Z as yt,m as ze,_ as Se,$ as ln,a0 as Kn,a1 as qe,a2 as Pe,a3 as Hn,a4 as Wn,a5 as rt,a6 as Yn,X as qn,n as vt,a7 as Gn,a8 as Xn}from"./index-ki8HSB2c.js";import{e as on,u as Qn,m as Zn,L as Jn,F as es,I as ts}from"./image-field-CfVmwwEw.js";import{t as at}from"./ChevronDown-DXOZkIso.js";import{i as an}from"./ChevronRight-BkBgwZxs.js";import{i as ns}from"./Globe01-CQy0Cxa-.js";import{T as Ve,a as Ue,b as Ke}from"./tooltip-BdbfQCYl.js";import{i as ss}from"./ChevronUp-BCwumcyZ.js";import{d as rs}from"./Tool01-hkwqrr6Q.js";import{b as cn,C as un,a as it,e as fn,c as dn,d as is,g as ls}from"./command-CLZq7t6J.js";import{i as os}from"./Upload01-Cuswrale.js";import{c as as}from"./use-file-configs-CS1kf1Mx.js";import{a as cs}from"./Eye-IocHlobo.js";import{i as us}from"./FilterLines-dauCx8Za.js";const fs="oklch(0.65 0.15 160)",ds="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",mn="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]",Li="text-[oklch(0.45_0.15_160)] focus:bg-[oklch(0.65_0.15_160/0.12)] focus:text-[oklch(0.45_0.15_160)] dark:text-[oklch(0.78_0.15_160)] dark:focus:bg-[oklch(0.65_0.15_160/0.15)] dark:focus:text-[oklch(0.78_0.15_160)]";function bt(t){return t.map(e=>e.label).join(`
2
2
  `)}function Qe(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function ms(t){return t.map((e,n)=>({...e,index:n}))}function pn(t){const e=J.c(17),{label:n,canDelete:r,dragging:i,onDuplicate:o,onDelete:l}=t,a=i?"opacity-100":"opacity-0 group-hover:opacity-100";let c;e[0]!==a?(c=ge("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",a),e[0]=a,e[1]=c):c=e[1];let u;e[2]!==c?(u=s.jsx(ot,{className:c}),e[2]=c,e[3]=u):u=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Tn,{className:"h-4 w-4 shrink-0",style:{color:fs}}),e[4]=d):d=e[4];let f;e[5]!==n?(f=s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:n}),e[5]=n,e[6]=f):f=e[6];let m;e[7]!==r||e[8]!==i||e[9]!==n||e[10]!==l||e[11]!==o?(m=!i&&s.jsxs(nn,{children:[s.jsx(sn,{asChild:!0,children:s.jsx(Ce,{type:"button",variant:"ghost",size:"icon","aria-label":`Open actions for ${n}`,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:hs,onPointerDown:ps,children:s.jsx(Lt,{size:14})})}),s.jsxs(rn,{align:"end",children:[s.jsxs(st,{onClick:y=>{y.stopPropagation(),o?.()},children:[s.jsx(cs,{size:14}),"Duplicate"]}),s.jsxs(st,{variant:"destructive",disabled:!r,onClick:y=>{y.stopPropagation(),l?.()},children:[s.jsx(We,{size:14}),"Delete"]})]})]}),e[7]=r,e[8]=i,e[9]=n,e[10]=l,e[11]=o,e[12]=m):m=e[12];let p;return e[13]!==u||e[14]!==f||e[15]!==m?(p=s.jsxs(s.Fragment,{children:[u,d,f,m]}),e[13]=u,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function ps(t){return t.stopPropagation()}function hs(t){return t.stopPropagation()}function xs(t){const e=J.c(26),{entry:n,selected:r,canDelete:i,onSelect:o,onDuplicate:l,onDelete:a}=t;let c;e[0]!==n.id?(c={id:n.id,animateLayoutChanges:gs},e[0]=n.id,e[1]=c):c=e[1];const{attributes:u,listeners:d,setNodeRef:f,transform:m,isDragging:p}=Yt(c);let y;e[2]!==m?(y=qt.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=y):y=e[3];const x=p?0:void 0;let v;e[4]!==y||e[5]!==x?(v={transform:y,opacity:x},e[4]=y,e[5]=x,e[6]=v):v=e[6];const g=v;let h;e[7]!==o?(h=N=>{N.target===N.currentTarget&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),o())},e[7]=o,e[8]=h):h=e[8];const b=p?"cursor-grabbing":"cursor-grab",k=r?mn:ds;let S;e[9]!==b||e[10]!==k?(S=ge("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",b,k),e[9]=b,e[10]=k,e[11]=S):S=e[11];let C;e[12]!==i||e[13]!==n.label||e[14]!==a||e[15]!==l?(C=s.jsx(pn,{label:n.label,canDelete:i,onDuplicate:l,onDelete:a}),e[12]=i,e[13]=n.label,e[14]=a,e[15]=l,e[16]=C):C=e[16];let _;return e[17]!==u||e[18]!==d||e[19]!==o||e[20]!==f||e[21]!==g||e[22]!==h||e[23]!==S||e[24]!==C?(_=s.jsx("div",{ref:f,style:g,...u,...d,onClick:o,onKeyDown:h,className:S,children:C}),e[17]=u,e[18]=d,e[19]=o,e[20]=f,e[21]=g,e[22]=h,e[23]=S,e[24]=C,e[25]=_):_=e[25],_}function gs(){return!1}function ys(t){const e=J.c(81),{listKey:n,variants:r,selectedIndex:i,onSelect:o,onDuplicate:l,onDelete:a,onRemoveAll:c,onReorder:u,onAdd:d}=t,f=r.length>1;let m;e[0]!==r?(m=()=>Qe(r),e[0]=r,e[1]=m):m=e[1];const[p,y]=te.useState(m),[x,v]=te.useState(null),[g,h]=te.useState(n),[b,k]=te.useState(r.length);let S;e[2]!==r?(S=()=>bt(r),e[2]=r,e[3]=S):S=e[3];const[C,_]=te.useState(S),N=te.useRef(!1),T=bt(r);g!==n?(h(n),k(r.length),_(T),y(Qe(r))):b!==r.length?(k(r.length),_(T),y(Qe(r))):C!==T&&(_(T),y(B=>r.map((W,Z)=>({id:B[Z]?.id??crypto.randomUUID(),index:W.index,label:W.label}))));let A;e[4]===Symbol.for("react.memo_cache_sentinel")?(A={activationConstraint:{distance:8}},e[4]=A):A=e[4];let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j={coordinateGetter:Gt},e[5]=j):j=e[5];const D=Kt(Be(Wt,A),Be(Ht,j));let O;e[6]!==p?(O=p.map(vs),e[6]=p,e[7]=O):O=e[7];const $=O;let P;e[8]!==p?(P=B=>{const W=String(B.active.id);v(p.find(Z=>Z.id===W)??null)},e[8]=p,e[9]=P):P=e[9];const z=P;let w;e[10]!==$||e[11]!==u?(w=B=>{v(null);const{active:W,over:Z}=B;if(!Z||W.id===Z.id)return;const ce=$.indexOf(String(W.id)),xe=$.indexOf(String(Z.id));ce===-1||xe===-1||(y(he=>ms(nt([...he],ce,xe))),N.current=!0,requestAnimationFrame(()=>{N.current=!1}),u(ce,xe))},e[10]=$,e[11]=u,e[12]=w):w=e[12];const R=w;let ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=()=>{v(null)},e[13]=ee):ee=e[13];const fe=ee;let Q,V,H,Y,F,U,ne,E,M,q,ie,G,de;if(e[14]!==f||e[15]!==p||e[16]!==$||e[17]!==R||e[18]!==z||e[19]!==d||e[20]!==a||e[21]!==l||e[22]!==c||e[23]!==o||e[24]!==i||e[25]!==D){const B=L=>{N.current||o(L)};ie="space-y-1 border-b p-2";let W;e[39]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variants"}),e[39]=W):W=e[39];let Z;e[40]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(tn,{size:14}),e[40]=Z):Z=e[40];let ce;e[41]!==d?(ce=s.jsx(Ve,{asChild:!0,children:s.jsx(Ce,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-6",onClick:d,children:Z})}),e[41]=d,e[42]=ce):ce=e[42];let xe;e[43]===Symbol.for("react.memo_cache_sentinel")?(xe=s.jsx(Ue,{children:"Add variant"}),e[43]=xe):xe=e[43];let he;e[44]!==ce?(he=s.jsxs(Ke,{children:[ce,xe]}),e[44]=ce,e[45]=he):he=e[45];let ye;e[46]===Symbol.for("react.memo_cache_sentinel")?(ye=s.jsx(We,{size:14}),e[46]=ye):ye=e[46];let ue;e[47]!==c?(ue=s.jsx(Ve,{asChild:!0,children:s.jsx(Ce,{type:"button",variant:"ghost",size:"icon","aria-label":"Remove all variants",className:"size-6 text-muted-foreground hover:text-destructive",onClick:c,children:ye})}),e[47]=c,e[48]=ue):ue=e[48];let je;e[49]===Symbol.for("react.memo_cache_sentinel")?(je=s.jsx(Ue,{children:"Remove all variants"}),e[49]=je):je=e[49];let I;e[50]!==ue?(I=s.jsxs(Ke,{children:[ue,je]}),e[50]=ue,e[51]=I):I=e[51],e[52]!==he||e[53]!==I?(G=s.jsxs("div",{className:"flex items-center justify-between",children:[W,s.jsxs("div",{className:"flex items-center gap-0.5",children:[he,I]})]}),e[52]=he,e[53]=I,e[54]=G):G=e[54],V=Xt,U=D,ne=Qt,E=z,M=R,q=fe,Q=Zt,Y=$,F=Jt,de="space-y-0.5",H=p.map(L=>s.jsx(xs,{entry:L,selected:L.index===i,canDelete:f,onSelect:()=>B(L.index),onDuplicate:()=>l(L.index),onDelete:()=>a(L.index)},L.id)),e[14]=f,e[15]=p,e[16]=$,e[17]=R,e[18]=z,e[19]=d,e[20]=a,e[21]=l,e[22]=c,e[23]=o,e[24]=i,e[25]=D,e[26]=Q,e[27]=V,e[28]=H,e[29]=Y,e[30]=F,e[31]=U,e[32]=ne,e[33]=E,e[34]=M,e[35]=q,e[36]=ie,e[37]=G,e[38]=de}else Q=e[26],V=e[27],H=e[28],Y=e[29],F=e[30],U=e[31],ne=e[32],E=e[33],M=e[34],q=e[35],ie=e[36],G=e[37],de=e[38];let ae;e[55]!==H||e[56]!==de?(ae=s.jsx("div",{className:de,children:H}),e[55]=H,e[56]=de,e[57]=ae):ae=e[57];let se;e[58]!==Q||e[59]!==Y||e[60]!==F||e[61]!==ae?(se=s.jsx(Q,{items:Y,strategy:F,children:ae}),e[58]=Q,e[59]=Y,e[60]=F,e[61]=ae,e[62]=se):se=e[62];let me;e[63]!==x||e[64]!==f?(me=x?s.jsx("div",{className:ge("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",mn),children:s.jsx(pn,{label:x.label,canDelete:f,dragging:!0})}):null,e[63]=x,e[64]=f,e[65]=me):me=e[65];let le;e[66]!==me?(le=s.jsx(en,{dropAnimation:null,children:me}),e[66]=me,e[67]=le):le=e[67];let K;e[68]!==V||e[69]!==U||e[70]!==ne||e[71]!==E||e[72]!==M||e[73]!==q||e[74]!==se||e[75]!==le?(K=s.jsxs(V,{sensors:U,collisionDetection:ne,onDragStart:E,onDragEnd:M,onDragCancel:q,children:[se,le]}),e[68]=V,e[69]=U,e[70]=ne,e[71]=E,e[72]=M,e[73]=q,e[74]=se,e[75]=le,e[76]=K):K=e[76];let X;return e[77]!==ie||e[78]!==G||e[79]!==K?(X=s.jsxs("div",{className:ie,children:[G,K]}),e[77]=ie,e[78]=G,e[79]=K,e[80]=X):X=e[80],X}function vs(t){return t.id}function ct(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Oe(e)){const r=t.section?.__resolveType;return typeof r=="string"?r:e}return e}function bs(t){return t.includes("flags/multivariate")}function js(t){return Se(t)}function _s(t,e){const n=[...t],r=new Set(n.map(o=>o.resolveType)),i=(o,l)=>{!o||r.has(o)||(r.add(o),n.push({resolveType:o,title:l??js(o)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const o=ct(e.editorValue);o?.includes("/")&&i(o)}return n}function Ss(t,e,n){const r=e[0]?.resolveType??"";if(n)return n;if(!t||typeof t!="object"||Array.isArray(t))return r;const i=t,o=i.__resolveType;if(typeof o=="string"){if(Ye(o)){const f=e.find(m=>m.resolveType===o);return f?f.resolveType:o}const u=e.find(f=>yt(f.resolveType,o));if(u)return u.resolveType;const d=e.find(f=>f.resolveType===o);if(d)return d.resolveType;if(o.includes("/"))return o}const l=typeof i.type=="string"?i.type:void 0;if(l){const u=e.find(d=>d.discriminatorValue===l||d.resolveType===l||yt(d.resolveType,l));if(u)return u.resolveType}let a=r,c=-1;for(const u of e){if(!u.schema?.properties)continue;const f=Object.keys(u.schema.properties).filter(m=>!m.startsWith("__")&&m!=="@type"&&m!=="action"&&m!=="alt").filter(m=>i[m]!==void 0).length;f>0&&f>c&&(c=f,a=u.resolveType)}return c>0,a}function jt(t,e,n){if(!t||typeof t!="object"||Array.isArray(t))return n??null;const r=ct(t);if(!r)return n??null;if(!e)return r.includes("/")?null:n??null;const i=ze(r,e);return i||(r.includes("/")?null:n??null)}function Ns(t,e){if(!t?.properties||!e)return t??null;if(!(e in t.properties))return t;const n={...t.properties};return delete n[e],{...t,properties:n}}function hn(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!Oe(e.__resolveType))return null;const n=e.section;return!n||typeof n!="object"||Array.isArray(n)?null:n}function ks(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const n=t,r=ct(n);return r&&bs(r)?Array.isArray(n.variants)&&n.variants.length>0:Object.keys(n).some(i=>!i.startsWith("__")&&i!=="@type")}function Cs(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function Ts(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const r=e.find(i=>typeof i.value=="string");if(r)return r.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function xn(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(xn);const e=t;return e.__resolveType?Ts(e)??t:gn(e)}function gn(t){const e={};for(const[n,r]of Object.entries(t))e[n]=xn(r);return e}function As(t,e){return e.split(".").reduce((n,r)=>{if(!(n==null||typeof n!="object"))return n[r]},t)}function yn(t){return t==null?"":Array.isArray(t)?t.map(yn).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function ut(t,e){if(!t.includes("{"))return;const n=gn(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,o,l)=>{const a=(o??l??"").trim();return yn(As(n,a))}).trim()||void 0}function ws(t){return t.replace(/<[^>]*>/g,"").trim()}function Rs(t,e){if(e.includes("{"))return ut(e,t);const n=t[e];if(typeof n=="string"&&n)return n;if(Array.isArray(n)){const r=n.map(i=>i==null?"":String(i)).filter(Boolean).join(",");if(r)return r}}function Te(t,e,n){if(typeof t=="string")return t.trim()?t:`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){let r=t;const i=hn(r);if(i&&(r=i),n?.titleBy){const l=Rs(r,n.titleBy);if(l)return l}for(const l of["name","label","title","alt","text","href","id","key"]){const a=r[l];if(typeof a=="string"&&a.trim()){const c=n?.properties?.[l]?.format;if(c==="rich-text"||c==="html"){const u=ws(a);if(u)return u;continue}return a}if(Array.isArray(a)){const c=a.map(u=>u==null?"":String(u)).filter(Boolean).join(",");if(c)return c}}const o=r.__resolveType;if(typeof o=="string"&&o)return Se(o);if(n?.title){const l=ut(n.title,r);if(l)return l;if(!n.title.includes("{"))return n.title}}return`Item ${e+1}`}function Is(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const n=e.properties;return n?.mobile?"{{{image.mobile}}}":n?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function _t(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const n=Is(e);if(!n)return;const r=ut(n,t);if(!r)return;const i=on(r)||r;return Cs(i)}function vn(t){return t===ln||t===Kn}function Ge(t,e){if(!Object.hasOwn(e,t))return null;const n=e[t]??{},r=n.__resolveType??t;return{data:{...n},resolveType:r}}function He(t,e){const n=t.__resolveType??"";if(!n)return null;if(Oe(n)){const r=t.section??{};return bn(r,e)}if(vn(n)){const r=t.variants?.[0]?.value;return r?He(r,e):null}return!Ye(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ge(n,e)}function bn(t,e){const n=t.__resolveType??"";if(!n)return null;if(vn(n)){const r=t.variants?.[0]?.value;return r?He(r,e):null}return!Ye(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ge(n,e)}function $s(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const r=t.__resolveType;if(typeof r!="string"||!Ye(r)||!Object.hasOwn(e,r))return null;const i=Ge(r,e);return i?{blockKey:r,...i}:null}function Fi(t,e,n){if(e.isMultivariate)return null;if(e.isSavedBlock){const r=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return Ge(r,n)}if(e.isHidden){const o=(Oe(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return He(o,n)}if(e.isLazy||Oe(t.__resolveType)){const r=t.section??{};return bn(r,n)}return He(t,n)}const Os=new Set(["http:","https:","mailto:","tel:","ftp:"]);function Ds(t){if(t.startsWith("/")||t.startsWith(".")||t.startsWith("#"))return!0;try{const e=new URL(t,"https://placeholder.invalid");return Os.has(e.protocol)}catch{return!1}}function Ne(t){const e=J.c(8),{active:n,label:r,onClick:i,children:o}=t,l=n?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let a;e[0]!==l?(a=ge("flex h-7 w-7 items-center justify-center rounded transition-colors cursor-pointer",l),e[0]=l,e[1]=a):a=e[1];let c;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==i||e[6]!==a?(c=s.jsx("button",{type:"button","aria-label":r,"aria-pressed":n,onMouseDown:Ls,onClick:i,className:a,children:o}),e[2]=n,e[3]=o,e[4]=r,e[5]=i,e[6]=a,e[7]=c):c=e[7],c}function Ls(t){return t.preventDefault()}function Fs({schema:t,value:e,onChange:n,path:r,label:i}){const o=typeof e=="string"?e:"",l=te.useRef(n);l.current=n;const a=zn({extensions:[Pn.configure({heading:{levels:[1,2,3]}})],content:o||"",editorProps:{attributes:{class:ge("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:c})=>{const u=c.getHTML();l.current(u==="<p></p>"?"":u)}});return a?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(be,{htmlFor:r,children:i}),t.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:t.description})]}),s.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-border/60 bg-muted/30 px-1.5 py-1",children:[s.jsx(Ne,{active:a.isActive("bold"),label:"Bold",onClick:()=>a.chain().focus().toggleBold().run(),children:s.jsx(An,{size:14})}),s.jsx(Ne,{active:a.isActive("italic"),label:"Italic",onClick:()=>a.chain().focus().toggleItalic().run(),children:s.jsx(wn,{size:14})}),s.jsx(Ne,{active:a.isActive("underline"),label:"Underline",onClick:()=>a.chain().focus().toggleUnderline().run(),children:s.jsx(Rn,{size:14})}),s.jsx(Ne,{active:a.isActive("strike"),label:"Strikethrough",onClick:()=>a.chain().focus().toggleStrike().run(),children:s.jsx(In,{size:14})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(Ne,{active:a.isActive("heading",{level:1}),label:"Heading 1",onClick:()=>a.chain().focus().toggleHeading({level:1}).run(),children:s.jsx($n,{size:14})}),s.jsx(Ne,{active:a.isActive("heading",{level:2}),label:"Heading 2",onClick:()=>a.chain().focus().toggleHeading({level:2}).run(),children:s.jsx(On,{size:14})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(Ne,{active:a.isActive("bulletList"),label:"Bullet list",onClick:()=>a.chain().focus().toggleBulletList().run(),children:s.jsx(Bn,{size:14})}),s.jsx(Ne,{active:a.isActive("orderedList"),label:"Ordered list",onClick:()=>a.chain().focus().toggleOrderedList().run(),children:s.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(Ne,{active:a.isActive("link"),label:"Link",onClick:()=>{const c=a.getAttributes("link").href,u=window.prompt("Link URL",c??"https://");u!==null&&(u===""?a.chain().focus().unsetLink().run():Ds(u)&&a.chain().focus().setLink({href:u}).run())},children:s.jsx(Mn,{size:14})})]}),s.jsx(Vn,{editor:a})]})]}):null}const we=t=>String(t).padStart(2,"0"),Es="1900-01-01",Ms="2099-12-31",Bs="1900-01-01T00:00",zs="2099-12-31T23:59";function Ps(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const n=new Date(t);return Number.isNaN(n.getTime())?"":`${n.getUTCFullYear()}-${we(n.getUTCMonth()+1)}-${we(n.getUTCDate())}`}function Vs(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function Us(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${we(e.getMonth()+1)}-${we(e.getDate())}T${we(e.getHours())}:${we(e.getMinutes())}`}function Ks(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function Hs(t){const e=J.c(29),{id:n,withTime:r,value:i,onChange:o}=t,[l,a]=te.useState(!1);let c;e[0]!==i||e[1]!==r?(c=r?Us(i):Ps(i),e[0]=i,e[1]=r,e[2]=c):c=e[2];const u=c;let d;e[3]!==o||e[4]!==r?(d=T=>{o(r?Ks(T.target.value):Vs(T.target.value))},e[3]=o,e[4]=r,e[5]=d):d=e[5];const f=d;let m;if(e[6]!==i){const T=i?new Date(i):null;m=T&&!Number.isNaN(T.getTime())?T:null,e[6]=i,e[7]=m}else m=e[7];const p=m;let y;e[8]!==o||e[9]!==p||e[10]!==r?(y=T=>{T&&(r&&p?T.setHours(p.getHours(),p.getMinutes(),0,0):T.setHours(0,0,0,0),o(T.toISOString()),a(!1))},e[8]=o,e[9]=p,e[10]=r,e[11]=y):y=e[11];const x=y,v=r?"datetime-local":"date",g=r?Bs:Es,h=r?zs:Ms;let b;e[12]!==f||e[13]!==n||e[14]!==u||e[15]!==v||e[16]!==g||e[17]!==h?(b=s.jsx(ke,{id:n,type:v,min:g,max:h,value:u,onChange:f,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[12]=f,e[13]=n,e[14]=u,e[15]=v,e[16]=g,e[17]=h,e[18]=b):b=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Ft,{asChild:!0,children:s.jsx(Ce,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":"Open calendar",children:s.jsx(Dn,{className:"h-4 w-4"})})}),e[19]=k):k=e[19];const S=p??void 0;let C;e[20]!==x||e[21]!==S?(C=s.jsx(Et,{className:"w-auto p-0",align:"end",children:s.jsx(Fn,{mode:"single",selected:S,onSelect:x,initialFocus:!0})}),e[20]=x,e[21]=S,e[22]=C):C=e[22];let _;e[23]!==l||e[24]!==C?(_=s.jsxs(Mt,{open:l,onOpenChange:a,children:[k,C]}),e[23]=l,e[24]=C,e[25]=_):_=e[25];let N;return e[26]!==_||e[27]!==b?(N=s.jsxs("div",{className:"flex gap-1",children:[b,_]}),e[26]=_,e[27]=b,e[28]=N):N=e[28],N}function Le(t){const e=J.c(8),{htmlFor:n,label:r,description:i}=t;let o;e[0]!==n||e[1]!==r?(o=s.jsx(be,{htmlFor:n,children:r}),e[0]=n,e[1]=r,e[2]=o):o=e[2];let l;e[3]!==i?(l=i&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=s.jsxs("div",{className:"space-y-0.5",children:[o,l]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function Fe(t){const e=J.c(67),{schema:n,value:r,onChange:i,path:o,label:l}=t,a=typeof r=="string"?r:"",c=n.format;if(c==="rich-text"||c==="rich-text-inline"||c==="html"){let x;return e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==n||e[4]!==r?(x=s.jsx(Fs,{schema:n,value:r,onChange:i,path:o,label:l}),e[0]=l,e[1]=i,e[2]=o,e[3]=n,e[4]=r,e[5]=x):x=e[5],x}if(c==="textarea"||c==="markdown"){let x;e[6]!==l||e[7]!==o||e[8]!==n.description?(x=s.jsx(Le,{htmlFor:o,label:l,description:n.description}),e[6]=l,e[7]=o,e[8]=n.description,e[9]=x):x=e[9];let v;e[10]!==i?(v=b=>i(b.target.value),e[10]=i,e[11]=v):v=e[11];let g;e[12]!==o||e[13]!==a||e[14]!==v?(g=s.jsx(En,{id:o,value:a,onChange:v,rows:4}),e[12]=o,e[13]=a,e[14]=v,e[15]=g):g=e[15];let h;return e[16]!==x||e[17]!==g?(h=s.jsxs("div",{className:"space-y-2",children:[x,g]}),e[16]=x,e[17]=g,e[18]=h):h=e[18],h}if(c==="date"||c==="date-time"){let x;e[19]!==l||e[20]!==o||e[21]!==n.description?(x=s.jsx(Le,{htmlFor:o,label:l,description:n.description}),e[19]=l,e[20]=o,e[21]=n.description,e[22]=x):x=e[22];const v=c==="date-time";let g;e[23]!==i||e[24]!==o||e[25]!==a||e[26]!==v?(g=s.jsx(Hs,{id:o,withTime:v,value:a,onChange:i}),e[23]=i,e[24]=o,e[25]=a,e[26]=v,e[27]=g):g=e[27];let h;return e[28]!==x||e[29]!==g?(h=s.jsxs("div",{className:"space-y-2",children:[x,g]}),e[28]=x,e[29]=g,e[30]=h):h=e[30],h}if(c==="color-input"){let x;e[31]!==l||e[32]!==o||e[33]!==n.description?(x=s.jsx(Le,{htmlFor:o,label:l,description:n.description}),e[31]=l,e[32]=o,e[33]=n.description,e[34]=x):x=e[34];const v=a||"#000000";let g;e[35]!==i?(g=_=>i(_.target.value),e[35]=i,e[36]=g):g=e[36];let h;e[37]!==v||e[38]!==g?(h=s.jsx("input",{type:"color",value:v,onChange:g,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[37]=v,e[38]=g,e[39]=h):h=e[39];let b;e[40]!==i?(b=_=>i(_.target.value),e[40]=i,e[41]=b):b=e[41];let k;e[42]!==o||e[43]!==a||e[44]!==b?(k=s.jsx(ke,{id:o,value:a,onChange:b,placeholder:"#000000",className:"h-10 flex-1"}),e[42]=o,e[43]=a,e[44]=b,e[45]=k):k=e[45];let S;e[46]!==h||e[47]!==k?(S=s.jsxs("div",{className:"flex items-center gap-2",children:[h,k]}),e[46]=h,e[47]=k,e[48]=S):S=e[48];let C;return e[49]!==x||e[50]!==S?(C=s.jsxs("div",{className:"space-y-2",children:[x,S]}),e[49]=x,e[50]=S,e[51]=C):C=e[51],C}let u;e[52]!==l||e[53]!==o||e[54]!==n.description?(u=s.jsx(Le,{htmlFor:o,label:l,description:n.description}),e[52]=l,e[53]=o,e[54]=n.description,e[55]=u):u=e[55];const d=c==="url"?"url":"text";let f;e[56]!==i?(f=x=>i(x.target.value),e[56]=i,e[57]=f):f=e[57];const m=n.default!=null?String(n.default):void 0;let p;e[58]!==o||e[59]!==a||e[60]!==d||e[61]!==f||e[62]!==m?(p=s.jsx(ke,{id:o,type:d,value:a,onChange:f,placeholder:m,className:"h-10"}),e[58]=o,e[59]=a,e[60]=d,e[61]=f,e[62]=m,e[63]=p):p=e[63];let y;return e[64]!==u||e[65]!==p?(y=s.jsxs("div",{className:"space-y-2",children:[u,p]}),e[64]=u,e[65]=p,e[66]=y):y=e[66],y}function Ws(t){const e=J.c(17),{schema:n,value:r,onChange:i,path:o,label:l}=t,a=typeof r=="number"?r:"";let c;e[0]!==l||e[1]!==o?(c=s.jsx(be,{htmlFor:o,children:l}),e[0]=l,e[1]=o,e[2]=c):c=e[2];let u;e[3]!==n.description?(u=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d=s.jsxs("div",{className:"space-y-0.5",children:[c,u]}),e[5]=c,e[6]=u,e[7]=d):d=e[7];let f;e[8]!==i?(f=y=>{const x=y.target.value;i(x===""?void 0:Number(x))},e[8]=i,e[9]=f):f=e[9];let m;e[10]!==a||e[11]!==o||e[12]!==f?(m=s.jsx(ke,{id:o,type:"number",value:a,onChange:f,className:"h-10"}),e[10]=a,e[11]=o,e[12]=f,e[13]=m):m=e[13];let p;return e[14]!==d||e[15]!==m?(p=s.jsxs("div",{className:"space-y-2",children:[d,m]}),e[14]=d,e[15]=m,e[16]=p):p=e[16],p}function Ys(t){const e=J.c(17),{value:n,onChange:r,path:i,label:o,schema:l}=t,a=typeof n=="boolean"?n:!1;let c;e[0]!==o||e[1]!==i?(c=s.jsx(be,{htmlFor:i,children:o}),e[0]=o,e[1]=i,e[2]=c):c=e[2];let u;e[3]!==l.description?(u=l.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:l.description}),e[3]=l.description,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d=s.jsxs("div",{className:"space-y-0.5",children:[c,u]}),e[5]=c,e[6]=u,e[7]=d):d=e[7];let f;e[8]!==r?(f=y=>r(y),e[8]=r,e[9]=f):f=e[9];let m;e[10]!==a||e[11]!==i||e[12]!==f?(m=s.jsx(Un,{id:i,checked:a,onCheckedChange:f}),e[10]=a,e[11]=i,e[12]=f,e[13]=m):m=e[13];let p;return e[14]!==d||e[15]!==m?(p=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[d,m]}),e[14]=d,e[15]=m,e[16]=p):p=e[16],p}const ft="__enum_empty__";function dt(t){return t===""?ft:String(t)}function qs(t,e){if(t===ft)return"";const n=e.find(r=>dt(r)===t);return n!==void 0?n:t}function Gs(t,e){return t==null?e.some(n=>n==="")?ft:void 0:dt(t)}function Xs(t){return t===""?"":String(t)}function Qs(t){const e=J.c(28),{schema:n,value:r,onChange:i,path:o,label:l}=t;let a;e[0]!==n.enum?(a=n.enum??[],e[0]=n.enum,e[1]=a):a=e[1];const c=a;let u;e[2]!==c||e[3]!==r?(u=Gs(r,c),e[2]=c,e[3]=r,e[4]=u):u=e[4];const d=u;let f;e[5]!==l||e[6]!==o?(f=s.jsx(be,{htmlFor:o,children:l}),e[5]=l,e[6]=o,e[7]=f):f=e[7];let m;e[8]!==n.description?(m=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=m):m=e[9];let p;e[10]!==f||e[11]!==m?(p=s.jsxs("div",{className:"space-y-0.5",children:[f,m]}),e[10]=f,e[11]=m,e[12]=p):p=e[12];let y;e[13]!==i||e[14]!==c?(y=k=>i(qs(k,c)),e[13]=i,e[14]=c,e[15]=y):y=e[15];let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(zt,{className:"h-10",children:s.jsx(Pt,{placeholder:"Select..."})}),e[16]=x):x=e[16];let v;e[17]!==c?(v=c.map(Zs),e[17]=c,e[18]=v):v=e[18];let g;e[19]!==v?(g=s.jsx(Vt,{children:v}),e[19]=v,e[20]=g):g=e[20];let h;e[21]!==d||e[22]!==y||e[23]!==g?(h=s.jsxs(Ut,{value:d,onValueChange:y,children:[x,g]}),e[21]=d,e[22]=y,e[23]=g,e[24]=h):h=e[24];let b;return e[25]!==h||e[26]!==p?(b=s.jsxs("div",{className:"space-y-2",children:[p,h]}),e[25]=h,e[26]=p,e[27]=b):b=e[27],b}function Zs(t){const e=dt(t);return s.jsx(Bt,{value:e,children:Xs(t)},e)}function jn(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Ae(t){return t.normalize("NFC").trim()}function pe(t,e){return Ae(t)===Ae(e)}function St(t,e){return Ae(t).replace(/\s+/g,"").toLowerCase()===Ae(e).replace(/\s+/g,"").toLowerCase()}function Ee(t,e,n){const r=Ae(n);if(t.some(l=>pe(l,r)||pe(l,n)))return t;const i=[...t];return i.some(l=>pe(l,e))||i.push(e),i.push(n),i}function Js(t,e,n){if(n.length===0)return n;const r=Ie(t,e),i=n[0];return pe(i,r)||pe(i,t)?n.slice(1):n}function Ie(t,e){return e.title??jn(t)}function Ei(t,e){return e<=0?[]:t.slice(0,e)}function Ze(t,e){const n=Ae(e);return t.findIndex(r=>Ae(r)===n)}function Nt(t,e){return t.type==="array"&&t.items||qe(t)?!0:Array.isArray(e)}function er(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function De(t,e,n,r){if(r.length===0)return null;const i=r[0];for(const l of t){const a=e[l];if(!a||!Nt(a,n[l]))continue;const c=Ie(l,a);if(pe(i,c)||pe(i,l)||r.some(u=>pe(u,c)||pe(u,l)))return l}for(const l of t){const a=e[l];if(!a||!Nt(a,n[l]))continue;const c=n[l];if(!Array.isArray(c))continue;const u=a.items;for(let d=0;d<c.length;d++){const f=Te(c[d],d,u);if(pe(f,i))return l}}for(const l of t){const a=e[l];if(a?.type!=="object"||!a.properties)continue;const c=Object.keys(a.properties),u=er(n[l]),d=Ie(l,a);if(De(c,a.properties,u,r)||(pe(i,d)||pe(i,l))&&De(c,a.properties,u,r.slice(1)))return l}let o=null;for(const l of t){const a=e[l];if(a?.type!=="block-ref")continue;const c=Ie(l,a);if(!(i!==c&&i!==l)){if(r.length>1){const u=n[l];if(u&&typeof u=="object"&&!Array.isArray(u)){const d=r[1];if(Object.keys(u).some(m=>!m.startsWith("__")&&(St(jn(m),d)||St(m,d))))return l}}o||(o=l)}}return o||null}function tr(t,e,n,r){return De(t,e,n,r)}function nr(t,e,n,r,i){if(i.length===0||!n.properties)return!1;const o=Object.keys(n.properties);if(De(o,n.properties,r,i))return!0;const l=i[0];return!pe(l,e)&&!pe(l,t)?!1:i.length>1||De(o,n.properties,r,i.slice(1))!==null}function sr(t,e,n,r){if(e.length===0)return null;for(let o=0;o<e.length;o++){const l=e[o],a=n.findIndex((c,u)=>pe(Te(c,u,r),l));if(a>=0)return{index:a,innerPath:e.slice(o+1)}}const i=e.findIndex(o=>pe(o,t));if(i>=0&&e.length>i+1){const o=e[i+1],l=n.findIndex((a,c)=>pe(Te(a,c,r),o));if(l>=0)return{index:l,innerPath:e.slice(i+2)}}return null}function Je(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===ln}function rr(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(n=>Je(n.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(n=>Je(n.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(n=>Je(n.resolveType)):!1}function ir(t,e){if(e==="global"||e==="sections"||qe(t))return!0;const n=t.type==="array"?t.items:void 0;return n?rr(n):!1}function kt(t){return Array.from({length:t},(e,n)=>({id:crypto.randomUUID(),index:n}))}function lr(t,e,n,r,i){if(e?.type==="object"&&e.properties&&Object.keys(e.properties).length>0||e?.type==="block-ref"&&e.anyOfRefs?.length)return e;if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const o=t.__resolveType;if(typeof o=="string"&&n){const l=ze(o,n);if(l?.properties&&Object.keys(l.properties).length>0)return l}}if(n&&r&&i){const l=ze(r,n)?.properties?.[i]?.items;if(l?.properties&&Object.keys(l.properties).length>0)return{...l,titleBy:l.titleBy??e?.titleBy}}return e}function or(t){const e=t.split(".").filter(n=>!/^\d+$/.test(n));return e[e.length-1]??t}function _n(t){return t.map((e,n)=>({...e,index:n}))}function ar(t,e){if(e===t.length)return t;if(e<t.length)return _n(t.slice(0,e));const n=Array.from({length:e-t.length},(r,i)=>({id:crypto.randomUUID(),index:t.length+i}));return[...t,...n]}function cr(t){const e=J.c(8),{labelText:n,imageSrc:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(ot,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let o;e[1]!==r?(o=r&&s.jsx("img",{src:r,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=r,e[2]=o):o=e[2];let l;e[3]!==n?(l=s.jsx("span",{className:"min-w-0 truncate",children:n}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=s.jsxs(s.Fragment,{children:[i,s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[o,l]})]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function ur(t){const e=J.c(37),{sortableId:n,labelText:r,imageSrc:i,onOpen:o,onRemove:l}=t;let a;e[0]!==n?(a={id:n,animateLayoutChanges:mr},e[0]=n,e[1]=a):a=e[1];const{attributes:c,listeners:u,setNodeRef:d,transform:f,isDragging:m}=Yt(a);let p;e[2]!==f?(p=qt.Transform.toString(f?{...f,x:0}:null),e[2]=f,e[3]=p):p=e[3];const y=m?0:void 0;let x;e[4]!==p||e[5]!==y?(x={transform:p,opacity:y},e[4]=p,e[5]=y,e[6]=x):x=e[6];const v=x;let g;e[7]!==o?(g=$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),o())},e[7]=o,e[8]=g):g=e[8];const h=m?"cursor-grabbing":"cursor-pointer";let b;e[9]!==h?(b=ge("group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground touch-none",h),e[9]=h,e[10]=b):b=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(ot,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=k):k=e[11];let S;e[12]!==i?(S=i&&s.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=S):S=e[13];let C;e[14]!==r?(C=s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:r}),e[14]=r,e[15]=C):C=e[15];const _=`Open actions for ${r}`;let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(Lt,{size:14}),e[16]=N):N=e[16];let T;e[17]!==_?(T=s.jsx(sn,{asChild:!0,children:s.jsx(Ce,{type:"button",variant:"ghost",size:"icon","aria-label":_,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:dr,onPointerDown:fr,children:N})}),e[17]=_,e[18]=T):T=e[18];let A;e[19]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(We,{size:14}),e[19]=A):A=e[19];let j;e[20]!==l?(j=s.jsx(rn,{align:"end",children:s.jsxs(st,{className:"text-destructive focus:text-destructive",onClick:l,children:[A,"Delete"]})}),e[20]=l,e[21]=j):j=e[21];let D;e[22]!==T||e[23]!==j?(D=s.jsxs(nn,{children:[T,j]}),e[22]=T,e[23]=j,e[24]=D):D=e[24];let O;return e[25]!==c||e[26]!==r||e[27]!==u||e[28]!==o||e[29]!==d||e[30]!==v||e[31]!==C||e[32]!==D||e[33]!==g||e[34]!==b||e[35]!==S?(O=s.jsxs("div",{ref:d,style:v,...c,...u,role:"button",tabIndex:0,onClick:o,onKeyDown:g,className:b,title:r,children:[k,S,C,D]}),e[25]=c,e[26]=r,e[27]=u,e[28]=o,e[29]=d,e[30]=v,e[31]=C,e[32]=D,e[33]=g,e[34]=b,e[35]=S,e[36]=O):O=e[36],O}function fr(t){return t.stopPropagation()}function dr(t){return t.stopPropagation()}function mr(){return!1}function Me(t){const e=J.c(24),{schema:n,value:r,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:d,onSaveReferencedBlock:f,containerResolveType:m,previewBaseUrl:p,onAddSectionItem:y,onRequestAddSection:x,sandbox:v}=t,g=a===void 0?[]:a,h=Array.isArray(r)?r:[],b=n.items,k=or(o),S=ir(n,k),C=sr(l,g,h,b),_=C?.index??null,[N,T]=te.useState(()=>kt(h.length)),[A,j]=te.useState(null),[D,O]=te.useState(o),[$,P]=te.useState(h.length),z=te.useRef(!1);D!==o?(O(o),P(h.length),T(kt(h.length))):$!==h.length&&(P(h.length),T(I=>ar(I,h.length)));let w;e[0]!==b?(w=(I,L)=>Te(I,L,b),e[0]=b,e[1]=w):w=e[1];const R=w,ee=I=>{if(z.current)return;const L=R(h[I],I);c?.(Ee(g,l,L))},fe=I=>{const L=[...h,I];i(L);const oe=L.length-1,re=Te(I,oe,b);c?.(Ee(g,l,re))},Q=()=>{const I=b?.type,L=b?.default!==void 0?b.default:I==="object"?{}:I==="block-ref"?(()=>{const _e=b?.anyOfRefs?.[0]?.resolveType;return typeof _e!="string"||Pe(_e)?{}:{__resolveType:_e}})():I==="number"||I==="integer"?0:I==="boolean"?!1:I==="array"?[]:"",oe=[...h,L];i(oe);const re=oe.length-1,ve=Te(L,re,b);c?.(Ee(g,l,ve))},V=()=>{if(S){if(!p){Re.error("Start the preview dev server to add sections.");return}if(x){x({append:fe});return}Re.error("Section picker is not available in this editor.");return}Q()},H=I=>{if(i(h.filter((L,oe)=>oe!==I)),_===I){const L=R(h[I],I),oe=Ze(g,L);c?.(oe>=0?g.slice(0,oe):[])}},Y=(I,L)=>{const oe=[...h];if(oe[I]=L,i(oe),I===_&&_!==null){const re=R(h[I],I),ve=Te(L,I,b);if(re!==ve){const _e=Ze(g,re);if(_e>=0){const ht=[...g];ht[_e]=ve,c?.(ht)}}}};let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F={activationConstraint:{distance:8}},e[2]=F):F=e[2];let U;e[3]===Symbol.for("react.memo_cache_sentinel")?(U={coordinateGetter:Gt},e[3]=U):U=e[3];const ne=Kt(Be(Wt,F),Be(Ht,U)),E=N.map(pr);let M;e[4]===Symbol.for("react.memo_cache_sentinel")?(M=I=>{j(String(I.active.id))},e[4]=M):M=e[4];const q=M,ie=I=>{j(null);const{active:L,over:oe}=I;if(!oe||L.id===oe.id)return;const re=E.indexOf(String(L.id)),ve=E.indexOf(String(oe.id));re===-1||ve===-1||(T(_e=>_n(nt([..._e],re,ve))),i(nt([...h],re,ve)),z.current=!0,requestAnimationFrame(()=>{z.current=!1}))};let G;e[5]===Symbol.for("react.memo_cache_sentinel")?(G=()=>{j(null)},e[5]=G):G=e[5];const de=G,ae=A?N.find(I=>I.id===A):null,se=ae!=null?h[ae.index]:void 0,me=ae!=null&&se!==void 0?R(se,ae.index):null,le=ae!=null&&se!==void 0?_t(se,b):void 0;if(_!==null&&_<h.length){const I=h[_],L=lr(I,b,u,m,k),oe=()=>{const re=R(I,_),ve=Ee(g,l,re),_e=Ze(ve,re);return _e>=0?ve.slice(0,_e+1):ve};return s.jsx("div",{className:"min-w-0",children:L?.type==="object"&&L.properties?s.jsx(Xe,{schema:L,value:I,onChange:re=>Y(_,re),basePath:`${o}.${_}`,breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:re=>{c?.([...oe(),...re])},meta:u,decofile:d,onSaveReferencedBlock:f,previewBaseUrl:p,onAddSectionItem:y,onRequestAddSection:x,sandbox:v}):L?pt({schema:L,value:I,onChange:re=>Y(_,re),path:`${o}.${_}`,label:L.title??`Item ${_+1}`,breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:re=>{c?.([...oe(),...re])},meta:u,decofile:d,onSaveReferencedBlock:f,previewBaseUrl:p,onAddSectionItem:y,onRequestAddSection:x,sandbox:v}):null})}const K="space-y-2";let X;e[6]!==l?(X=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[6]=l,e[7]=X):X=e[7];const B=h.length>0&&s.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:h.length});let W;e[8]!==X||e[9]!==B?(W=s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[X,B]}),e[8]=X,e[9]=B,e[10]=W):W=e[10];let Z;e[11]!==n.description?(Z=n.description&&s.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:n.description}),e[11]=n.description,e[12]=Z):Z=e[12];let ce;e[13]!==W||e[14]!==Z?(ce=s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[W,Z]}),e[13]=W,e[14]=Z,e[15]=ce):ce=e[15];const xe=h.length>0&&s.jsx("div",{className:ge(A&&"cursor-grabbing"),children:s.jsxs(Xt,{sensors:ne,collisionDetection:Qt,onDragStart:q,onDragEnd:ie,onDragCancel:de,children:[s.jsx(Zt,{items:E,strategy:Jt,children:s.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:N.map(I=>{const L=h[I.index];if(L===void 0)return null;const oe=R(L,I.index),re=_t(L,b);return s.jsx(ur,{sortableId:I.id,labelText:oe,imageSrc:re,onOpen:()=>ee(I.index),onRemove:()=>H(I.index)},I.id)})})}),s.jsx(en,{dropAnimation:null,children:me?s.jsx("div",{className:"flex min-w-0 items-center gap-2.5 rounded-lg border border-border/60 bg-background px-2 py-2.5 shadow-lg ring-1 ring-border/60",children:s.jsx(cr,{labelText:me,imageSrc:le})}):null})]})});let he;e[16]===Symbol.for("react.memo_cache_sentinel")?(he=s.jsx(tn,{size:14}),e[16]=he):he=e[16];const ye=S?"Add section":"Add item";let ue;e[17]!==V||e[18]!==ye?(ue=s.jsxs("button",{type:"button",onClick:V,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30",children:[he,ye]}),e[17]=V,e[18]=ye,e[19]=ue):ue=e[19];let je;return e[20]!==ce||e[21]!==xe||e[22]!==ue?(je=s.jsxs("div",{className:K,children:[ce,xe,ue]}),e[20]=ce,e[21]=xe,e[22]=ue,e[23]=je):je=e[23],je}function pr(t){return t.id}function hr(t){const e=J.c(44),{schema:n,value:r,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:d,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:y,sandbox:x}=t;let v;e[0]!==a?(v=a===void 0?[]:a,e[0]=a,e[1]=v):v=e[1];const g=v,[h,b]=te.useState(!1);let k;e[2]!==r?(k=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},e[2]=r,e[3]=k):k=e[3];const S=k;if(!n.properties)return null;let C;e[4]!==o?(C=o.split(".").pop()??o,e[4]=o,e[5]=C):C=e[5];const _=C;let N;e[6]!==g||e[7]!==_||e[8]!==l||e[9]!==S||e[10]!==n?(N=nr(_,l,n,S,g),e[6]=g,e[7]=_,e[8]=l,e[9]=S,e[10]=n,e[11]=N):N=e[11];const A=h||N,j=`${o}-fields`;let D;e[12]===Symbol.for("react.memo_cache_sentinel")?(D=()=>b(xr),e[12]=D):D=e[12];let O;e[13]!==A?(O=s.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:A?s.jsx(at,{size:16}):s.jsx(an,{size:16})}),e[13]=A,e[14]=O):O=e[14];let $;e[15]!==l?($=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[15]=l,e[16]=$):$=e[16];let P;e[17]!==j||e[18]!==A||e[19]!==O||e[20]!==$?(P=s.jsxs("button",{type:"button","aria-expanded":A,"aria-controls":j,onClick:D,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[O,$]}),e[17]=j,e[18]=A,e[19]=O,e[20]=$,e[21]=P):P=e[21];let z;e[22]!==n.description?(z=n.description&&s.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:n.description}),e[22]=n.description,e[23]=z):z=e[23];let w;e[24]!==g||e[25]!==j||e[26]!==d||e[27]!==A||e[28]!==u||e[29]!==S||e[30]!==p||e[31]!==c||e[32]!==i||e[33]!==y||e[34]!==f||e[35]!==o||e[36]!==m||e[37]!==x||e[38]!==n?(w=A&&s.jsx("div",{id:j,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:s.jsx(Xe,{schema:n,value:S,onChange:i,basePath:o,breadcrumbPath:g,onBreadcrumbChange:c,meta:u,decofile:d,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:y,sandbox:x})}),e[24]=g,e[25]=j,e[26]=d,e[27]=A,e[28]=u,e[29]=S,e[30]=p,e[31]=c,e[32]=i,e[33]=y,e[34]=f,e[35]=o,e[36]=m,e[37]=x,e[38]=n,e[39]=w):w=e[39];let R;return e[40]!==z||e[41]!==w||e[42]!==P?(R=s.jsxs("div",{className:"min-w-0 space-y-2",children:[P,z,w]}),e[40]=z,e[41]=w,e[42]=P,e[43]=R):R=e[43],R}function xr(t){return!t}function gr(t){if(!t?.properties)return{};const e={};for(const[n,r]of Object.entries(t.properties))n.startsWith("__")||n==="@type"||(r.default!==void 0?e[n]=r.default:r.type==="boolean"?e[n]=!1:r.type==="string"?e[n]="":r.type==="number"||r.type==="integer"?e[n]=0:r.type==="object"&&(e[n]={}));return e}function yr(t){const e=J.c(3),{blockKey:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Ve,{asChild:!0,children:s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[s.jsx(ns,{size:11}),"Global"]})}),e[0]=r):r=e[0];let i;return e[1]!==n?(i=s.jsxs(Ke,{children:[r,s.jsxs(Ue,{side:"top",className:"max-w-[260px]",children:["Edits the saved block “",n,"”. Changes apply everywhere this loader is referenced on your site."]})]}),e[1]=n,e[2]=i):i=e[2],i}function vr(t){const e=J.c(28),{path:n,open:r,onOpenChange:i,title:o,nested:l,nestedBlockRef:a,globalBlockKey:c}=t,u=`${n}-loader-config`,d=a&&"ml-1";let f;e[0]!==d?(f=ge("rounded-lg border border-border/80 bg-muted/30",d),e[0]=d,e[1]=f):f=e[1];let m;e[2]!==i||e[3]!==r?(m=()=>i(!r),e[2]=i,e[3]=r,e[4]=m):m=e[4];let p;e[5]!==r?(p=s.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:r?s.jsx(at,{size:16}):s.jsx(an,{size:16})}),e[5]=r,e[6]=p):p=e[6];let y;e[7]!==o?(y=s.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:o}),e[7]=o,e[8]=y):y=e[8];let x;e[9]!==c?(x=c&&s.jsx(yr,{blockKey:c}),e[9]=c,e[10]=x):x=e[10];let v;e[11]!==y||e[12]!==x?(v=s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[y,x]}),e[11]=y,e[12]=x,e[13]=v):v=e[13];let g;e[14]!==u||e[15]!==r||e[16]!==m||e[17]!==p||e[18]!==v?(g=s.jsxs("button",{type:"button","aria-expanded":r,"aria-controls":u,onClick:m,className:"group flex w-full min-w-0 items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors hover:bg-accent/50",children:[p,v]}),e[14]=u,e[15]=r,e[16]=m,e[17]=p,e[18]=v,e[19]=g):g=e[19];let h;e[20]!==u||e[21]!==l||e[22]!==r?(h=r&&s.jsx("div",{id:u,className:"border-t border-border/60 px-4 pb-4 pt-3",children:s.jsx("div",{className:"border-l border-border/80 pl-4",children:l})}),e[20]=u,e[21]=l,e[22]=r,e[23]=h):h=e[23];let b;return e[24]!==f||e[25]!==g||e[26]!==h?(b=s.jsxs("div",{className:f,children:[g,h]}),e[24]=f,e[25]=g,e[26]=h,e[27]=b):b=e[27],b}function Ct(t){const e=J.c(35),{schema:n,value:r,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:d,onSaveReferencedBlock:f,sandbox:m}=t,p=(n.anyOfRefs??[]).filter(_r),y=d&&r?$s(r,d):null,x=y?.data??r,v=y?null:hn(x),g=v??x,h=_s(p,{savedBlockKey:y?.blockKey,editorValue:x}),b=h.length>0?Ss(x,h,y?.blockKey):h[0]?.resolveType??"",S=n.type==="block-ref"&&h.some(jr);let C;e[0]!==l||e[1]!==o?(C=l??(o.includes(".")?o.split(".")[0]:o),e[0]=l,e[1]=o,e[2]=C):C=e[2];const _=C;let N;e[3]!==a?(N=a??[],e[3]=a,e[4]=N):N=e[4];const T=N,A=S&&T[0]===_?T.slice(1):T,j=S?F=>{c?.([_,...F])}:c,[D,O]=te.useState(b),[$,P]=te.useState(b);$!==b&&(P(b),O(b));const[z,w]=te.useState(()=>ks(x,y?.blockKey));if(h.length>0){const F=D||b;let U;e[5]!==F?(U=B=>B.resolveType===F,e[5]=F,e[6]=U):U=e[6];const ne=h.find(U),E=jt(x,u,ne?.schema),M=Ns(E??ne?.schema??null,n.discriminatorKey),q=n.discriminatorKey,ie=B=>{O(B);const W=h.find(ue=>ue.resolveType===B),Z=jt(x,u,W?.schema),ce=new Set(Object.keys((Z??W?.schema)?.properties??{})),xe=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:{},he=Object.fromEntries(Object.entries(xe).filter(ue=>{const[je]=ue;return ce.has(je)})),ye={...gr(W?.schema),...he};if(q){const ue=W?.discriminatorValue??B;i({...ye,[q]:ue});return}if(Pe(B)){i(ye);return}i({...ye,__resolveType:B})};let G;e[7]!==F||e[8]!==q||e[9]!==i?(G=B=>{if(q||!Pe(F)||B===null||typeof B!="object"||Array.isArray(B)){i(B);return}const{__resolveType:W,...Z}=B;i(Z)},e[7]=F,e[8]=q,e[9]=i,e[10]=G):G=e[10];const de=G,ae=M?.properties?s.jsx(Xe,{schema:M,value:g,onChange:B=>{if(y&&f){f(y.blockKey,B);return}if(v){i({...x,section:B});return}de(B)},basePath:o,breadcrumbPath:A,onBreadcrumbChange:j,meta:u,decofile:d,onSaveReferencedBlock:f,sandbox:m}):null;let se;e[11]!==o?(se=o.includes("."),e[11]=o,e[12]=se):se=e[12];const me=se;let le;e[13]!==l||e[14]!==o?(le=s.jsx(be,{htmlFor:o,children:l}),e[13]=l,e[14]=o,e[15]=le):le=e[15];let K;e[16]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(zt,{children:s.jsx(Pt,{placeholder:"Select..."})}),e[16]=K):K=e[16];let X;return e[17]!==n.description?(X=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[17]=n.description,e[18]=X):X=e[18],s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[le,s.jsxs(Ut,{value:F||void 0,onValueChange:ie,children:[K,s.jsx(Vt,{children:h.map(br)})]}),X]}),ae&&(S?s.jsx(vr,{path:o,open:z,onOpenChange:w,title:me?"Configuration":"Loader configuration",nested:ae,nestedBlockRef:me,globalBlockKey:y?.blockKey}):ae)]})}if(n.anyOfRefs&&n.anyOfRefs.length>0)return null;let R;e[19]!==l||e[20]!==o?(R=s.jsx(be,{htmlFor:o,children:l}),e[19]=l,e[20]=o,e[21]=R):R=e[21];const ee=r!=null?String(r):"";let fe;e[22]!==i?(fe=F=>i(F.target.value),e[22]=i,e[23]=fe):fe=e[23];const Q=n.description??"";let V;e[24]!==o||e[25]!==ee||e[26]!==fe||e[27]!==Q?(V=s.jsx("input",{id:o,type:"text",value:ee,onChange:fe,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:Q}),e[24]=o,e[25]=ee,e[26]=fe,e[27]=Q,e[28]=V):V=e[28];let H;e[29]!==n.description?(H=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[29]=n.description,e[30]=H):H=e[30];let Y;return e[31]!==R||e[32]!==V||e[33]!==H?(Y=s.jsxs("div",{className:"space-y-1.5",children:[R,V,H]}),e[31]=R,e[32]=V,e[33]=H,e[34]=Y):Y=e[34],Y}function br(t){const e=t.title&&!t.title.includes("/")?t.title:Hn(t.resolveType)??Se(t.resolveType);return s.jsx(Bt,{value:t.resolveType,children:e},t.resolveType)}function jr(t){return t.resolveType.includes("/")&&!Pe(t.resolveType)}function _r(t){return t.resolveType!==""}function Sr(t){if(!Array.isArray(t))return[];const e=[];for(const n of t)if(typeof n=="string")e.push({value:n,label:n});else if(n&&typeof n=="object"&&"value"in n){const r=n;e.push({value:String(r.value),label:typeof r.label=="string"?r.label:String(r.value),image:typeof r.image=="string"?r.image:void 0})}return e}async function Nr(t,e,n){const r={};n&&(r.term=n);const o=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,l=await fetch(o,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r)});if(!l.ok)throw new Error(`Failed to fetch dynamic options: ${l.status}`);const a=await l.json();return Sr(a)}function Tt(t){const e=J.c(8),{path:n,label:r,description:i}=t;let o;e[0]!==r||e[1]!==n?(o=s.jsx(be,{htmlFor:n,children:r}),e[0]=r,e[1]=n,e[2]=o):o=e[2];let l;e[3]!==i?(l=i&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=s.jsxs("div",{className:"space-y-0.5",children:[o,l]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function kr(t){const e=J.c(71),{schema:n,value:r,onChange:i,path:o,label:l,sandbox:a}=t,c=n.options,u=a?.previewUrl,[d,f]=te.useState(!1),[m,p]=te.useState(""),[y,x]=te.useState(""),v=te.useRef(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=E=>{p(E),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{x(E)},300)},e[0]=g):g=e[0];const h=g,b=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"";let k;e[1]!==y||e[2]!==c||e[3]!==b?(k=Cn.sandboxInvoke(b,`dynamic-options:${c??""}:${y}`),e[1]=y,e[2]=c,e[3]=b,e[4]=k):k=e[4];let S;e[5]!==y||e[6]!==c||e[7]!==u?(S=()=>Nr(u,c,y||void 0),e[5]=y,e[6]=c,e[7]=u,e[8]=S):S=e[8];const C=!!u&&!!c&&d;let _;e[9]!==k||e[10]!==S||e[11]!==C?(_={queryKey:k,queryFn:S,enabled:C,staleTime:6e4,retry:1},e[9]=k,e[10]=S,e[11]=C,e[12]=_):_=e[12];const N=kn(_);let T;e[13]!==N.data?(T=N.data??[],e[13]=N.data,e[14]=T):T=e[14];const A=T,j=typeof r=="string"?r:"";let D;if(e[15]!==j||e[16]!==A){let E;e[18]!==j?(E=M=>M.value===j,e[18]=j,e[19]=E):E=e[19],D=A.find(E),e[15]=j,e[16]=A,e[17]=D}else D=e[17];const O=D;if(!u||!c){let E;e[20]!==l||e[21]!==o||e[22]!==n.description?(E=s.jsx(Tt,{path:o,label:l,description:n.description}),e[20]=l,e[21]=o,e[22]=n.description,e[23]=E):E=e[23];let M;e[24]!==i?(M=G=>i(G.target.value),e[24]=i,e[25]=M):M=e[25];let q;e[26]!==j||e[27]!==o||e[28]!==M?(q=s.jsx(ke,{id:o,type:"text",value:j,onChange:M}),e[26]=j,e[27]=o,e[28]=M,e[29]=q):q=e[29];let ie;return e[30]!==q||e[31]!==E?(ie=s.jsxs("div",{className:"space-y-2",children:[E,q]}),e[30]=q,e[31]=E,e[32]=ie):ie=e[32],ie}let $;e[33]!==l||e[34]!==o||e[35]!==n.description?($=s.jsx(Tt,{path:o,label:l,description:n.description}),e[33]=l,e[34]=o,e[35]=n.description,e[36]=$):$=e[36];let P;e[37]!==j||e[38]!==O?(P=O?s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[O.image&&s.jsx("img",{src:O.image,alt:"",referrerPolicy:"no-referrer",className:"h-6 w-6 shrink-0 rounded object-cover"}),s.jsx("span",{className:"truncate",children:O.label??O.value})]}):j?s.jsx("span",{className:"truncate",children:j}):s.jsx("span",{className:"text-muted-foreground",children:"Select..."}),e[37]=j,e[38]=O,e[39]=P):P=e[39];let z;e[40]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(rs,{className:"size-4 shrink-0 opacity-50"}),e[40]=z):z=e[40];let w;e[41]!==d||e[42]!==P?(w=s.jsx(Ft,{asChild:!0,children:s.jsxs(Ce,{variant:"outline",role:"combobox","aria-expanded":d,className:"h-10 w-full justify-between font-normal",children:[P,z]})}),e[41]=d,e[42]=P,e[43]=w):w=e[43];let R;e[44]===Symbol.for("react.memo_cache_sentinel")?(R={width:"var(--radix-popover-trigger-width)"},e[44]=R):R=e[44];let ee;e[45]!==m?(ee=s.jsx(cn,{placeholder:"Search...",className:"h-9",value:m,onValueChange:h}),e[45]=m,e[46]=ee):ee=e[46];const fe=N.isLoading?"Loading...":"No results found.";let Q;e[47]!==fe?(Q=s.jsx(un,{children:fe}),e[47]=fe,e[48]=Q):Q=e[48];let V;if(e[49]!==j||e[50]!==i||e[51]!==A){let E;e[53]!==j||e[54]!==i?(E=M=>s.jsxs(it,{value:M.value,onSelect:()=>{i(M.value===j?"":M.value),f(!1)},children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[M.image&&s.jsx("img",{src:M.image,alt:"",referrerPolicy:"no-referrer",className:"h-9 w-9 shrink-0 rounded object-cover"}),s.jsx("span",{className:"truncate",children:M.label??M.value})]}),s.jsx(ss,{className:ge("ml-auto size-4 shrink-0",j===M.value?"opacity-100":"opacity-0")})]},M.value),e[53]=j,e[54]=i,e[55]=E):E=e[55],V=A.map(E),e[49]=j,e[50]=i,e[51]=A,e[52]=V}else V=e[52];let H;e[56]!==V?(H=s.jsx(fn,{children:V}),e[56]=V,e[57]=H):H=e[57];let Y;e[58]!==Q||e[59]!==H?(Y=s.jsxs(dn,{children:[Q,H]}),e[58]=Q,e[59]=H,e[60]=Y):Y=e[60];let F;e[61]!==ee||e[62]!==Y?(F=s.jsx(Et,{className:"p-0",style:R,children:s.jsxs(is,{shouldFilter:!1,children:[ee,Y]})}),e[61]=ee,e[62]=Y,e[63]=F):F=e[63];let U;e[64]!==d||e[65]!==w||e[66]!==F?(U=s.jsxs(Mt,{open:d,onOpenChange:f,children:[w,F]}),e[64]=d,e[65]=w,e[66]=F,e[67]=U):U=e[67];let ne;return e[68]!==U||e[69]!==$?(ne=s.jsxs("div",{className:"space-y-2",children:[$,U]}),e[68]=U,e[69]=$,e[70]=ne):ne=e[70],ne}function At(t){const e=J.c(2),{ext:n}=t;if(!n)return null;let r;return e[0]!==n?(r=s.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Cr(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function Tr(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function Ar(t){const e=J.c(79),{schema:n,value:r,onChange:i,path:o,label:l,sandbox:a}=t,c=n.format==="video-uri",u=on(r),[d,f]=te.useState(!1),[m,p]=te.useState(!1),y=u?Cr(u):"",x=y?Tr(y):"",v=as(),g=Qn();let h;e[0]!==v.data?.configs?(h=v.data?.configs??[],e[0]=v.data?.configs,e[1]=h):h=e[1];const b=a?.siteSlug;let k;e[2]!==h||e[3]!==b?(k=Zn(h,b),e[2]=h,e[3]=b,e[4]=k):k=e[4];const S=k;let C;e[5]!==v.data?.configs||e[6]!==S?(C=function(){if(S)return S.id;const K=v.data?.configs??[];if(K.length===1)return K[0].id;if(K.length===0)return null;const X=typeof window<"u"?window.localStorage.getItem(Jn):null;return K.some(B=>B.id===X)?X:null},e[5]=v.data?.configs,e[6]=S,e[7]=C):C=e[7];const _=C;let N;e[8]!==c||e[9]!==i||e[10]!==_||e[11]!==f||e[12]!==g?(N=async function(K){if(!K)return;let X=Array.from(K);if(X.length===0)return;if(c&&(X=X.filter(wr),X.length===0)){Re.error("Please drop a video file (mp4, webm, …).");return}const B=_();if(!B){f(!0);return}try{const W=await g.mutateAsync({configId:B,file:X[0]});i(W.publicUrl),X.length>1&&Re.info(`Uploaded ${X[0].name}; extra files were ignored (single-select field).`)}catch(W){const Z=W;Re.error(Z instanceof Error?Z.message:"Upload failed")}},e[8]=c,e[9]=i,e[10]=_,e[11]=f,e[12]=g,e[13]=N):N=e[13];const T=N;let A;e[14]!==p?(A=function(K){K.preventDefault(),K.dataTransfer.types.includes("Files")&&p(!0)},e[14]=p,e[15]=A):A=e[15];const j=A;let D;e[16]!==p?(D=function(K){K.currentTarget===K.target&&p(!1)},e[16]=p,e[17]=D):D=e[17];const O=D;let $;e[18]!==T||e[19]!==p?($=function(K){K.preventDefault(),p(!1),T(K.dataTransfer.files)},e[18]=T,e[19]=p,e[20]=$):$=e[20];const P=$;let z;e[21]!==l||e[22]!==o?(z=s.jsx(be,{htmlFor:o,className:"text-muted-foreground",children:l}),e[21]=l,e[22]=o,e[23]=z):z=e[23];let w;e[24]!==n.description?(w=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[24]=n.description,e[25]=w):w=e[25];let R;e[26]!==w||e[27]!==z?(R=s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[z,w]}),e[26]=w,e[27]=z,e[28]=R):R=e[28];const ee=m&&"border-primary ring-2 ring-primary/30",fe=g.isPending&&"pointer-events-none opacity-60";let Q;e[29]!==ee||e[30]!==fe?(Q=ge("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",ee,fe),e[29]=ee,e[30]=fe,e[31]=Q):Q=e[31];let V;e[32]!==x||e[33]!==y||e[34]!==c||e[35]!==f||e[36]!==u||e[37]!==g.isPending?(V=u?c?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-black",children:s.jsx("video",{src:u,preload:"metadata",className:"h-full w-full object-contain"},u)}),s.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[s.jsx(xt,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:y}),s.jsx(At,{ext:x})]})]}):s.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[s.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:s.jsx(gt,{size:18,className:"text-muted-foreground"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:y}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u})]}),s.jsx(At,{ext:x})]}):s.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[c?s.jsx(xt,{size:20}):s.jsx(gt,{size:20}),s.jsx("span",{className:"text-sm font-medium",children:g.isPending?"Uploading…":c?"Drop a video here or click to browse":"Drop a file or click to browse"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Up to 100 MB"})]}),e[32]=x,e[33]=y,e[34]=c,e[35]=f,e[36]=u,e[37]=g.isPending,e[38]=V):V=e[38];let H;e[39]!==m?(H=m&&s.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:s.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[39]=m,e[40]=H):H=e[40];let Y;e[41]!==O||e[42]!==j||e[43]!==P||e[44]!==Q||e[45]!==V||e[46]!==H?(Y=s.jsxs("div",{onDragOver:j,onDragLeave:O,onDrop:P,className:Q,children:[V,H]}),e[41]=O,e[42]=j,e[43]=P,e[44]=Q,e[45]=V,e[46]=H,e[47]=Y):Y=e[47];let F;e[48]!==i?(F=le=>i(le.target.value),e[48]=i,e[49]=F):F=e[49];let U;e[50]!==o||e[51]!==u||e[52]!==F?(U=s.jsx(ke,{id:o,type:"url",value:u,onChange:F,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[50]=o,e[51]=u,e[52]=F,e[53]=U):U=e[53];let ne;e[54]!==f?(ne=()=>f(!0),e[54]=f,e[55]=ne):ne=e[55];let E;e[56]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(os,{size:14}),e[56]=E):E=e[56];const M=u?"Replace":"Browse";let q;e[57]!==ne||e[58]!==M?(q=s.jsxs(Ce,{type:"button",variant:"outline",size:"sm",onClick:ne,className:"h-9 shrink-0",children:[E,M]}),e[57]=ne,e[58]=M,e[59]=q):q=e[59];let ie;e[60]!==i||e[61]!==u?(ie=u&&s.jsx(Ce,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":"Remove file",children:s.jsx(We,{size:14})}),e[60]=i,e[61]=u,e[62]=ie):ie=e[62];let G;e[63]!==U||e[64]!==q||e[65]!==ie?(G=s.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[U,q,ie]}),e[63]=U,e[64]=q,e[65]=ie,e[66]=G):G=e[66];let de;e[67]!==i?(de=le=>i(le),e[67]=i,e[68]=de):de=e[68];const ae=S?.id??null;let se;e[69]!==d||e[70]!==f||e[71]!==de||e[72]!==ae?(se=s.jsx(es,{open:d,onOpenChange:f,mode:"any",onSelect:de,lockedConfigId:ae}),e[69]=d,e[70]=f,e[71]=de,e[72]=ae,e[73]=se):se=e[73];let me;return e[74]!==R||e[75]!==Y||e[76]!==G||e[77]!==se?(me=s.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[R,Y,G,se]}),e[74]=R,e[75]=Y,e[76]=G,e[77]=se,e[78]=me):me=e[78],me}function wr(t){return t.type.startsWith("video/")}const Rr=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],Ir={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function et(t){return lt(t)!==void 0}function Sn(t,e){if(e){if(et(e))return e;const n=Ir[e];if(n&&et(n))return n}for(const[n,r]of Rr)if(n.test(t)&&et(r))return r;return"FilterLines"}function $r(t){return lt(t)??us}function wt(t){const e=J.c(11),{iconName:n,size:r,className:i}=t,o=r===void 0?"md":r;let l;e[0]!==n?(l=$r(n),e[0]=n,e[1]=l):l=e[1];const a=l,c=o==="sm"?"size-7":"size-9",u=o==="sm"?16:18;let d;e[2]!==c||e[3]!==i?(d=ge("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=d):d=e[4];let f;e[5]!==a||e[6]!==u?(f=s.jsx(a,{size:u,className:"text-muted-foreground"}),e[5]=a,e[6]=u,e[7]=f):f=e[7];let m;return e[8]!==d||e[9]!==f?(m=s.jsx("div",{className:d,children:f}),e[8]=d,e[9]=f,e[10]=m):m=e[10],m}const Nn="Users03";function Or(t){const e=t.manifest?.blocks??{},n=[];for(const[r,i]of Object.entries(e))if(r.includes("matchers"))for(const o of Object.keys(i)){if(o.includes("always"))continue;const l=Wn(o,t);n.push({resolveType:o,title:l.title??Se(o),description:l.description,iconName:Sn(o,l.icon)})}return n}function Dr(t,e){if(!t)return Nn;const n=e.find(r=>r.resolveType===t);return n?n.iconName:Sn(t)}function Lr(t){const e=J.c(41),{currentRt:n,currentLabel:r,matchers:i,onSelect:o}=t,[l,a]=te.useState(!1);let c;if(e[0]!==n||e[1]!==i){const O=Dr(n,i);c=lt(O),e[0]=n,e[1]=i,e[2]=c}else c=e[2];const u=c;let d;e[3]!==o?(d=O=>{o(O),a(!1)},e[3]=o,e[4]=d):d=e[4];const f=d;let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=()=>a(!0),e[5]=m):m=e[5];let p;e[6]!==u?(p=u&&s.jsx(u,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[6]=u,e[7]=p):p=e[7];let y;e[8]!==r?(y=s.jsx("span",{className:"flex-1 truncate",children:r}),e[8]=r,e[9]=y):y=e[9];let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(at,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[10]=x):x=e[10];let v;e[11]!==p||e[12]!==y?(v=s.jsxs("button",{type:"button",onClick:m,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[p,y,x]}),e[11]=p,e[12]=y,e[13]=v):v=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(cn,{placeholder:"Search rules..."}),e[14]=g):g=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(un,{children:"No rules found."}),e[15]=h):h=e[15];let b;e[16]!==f?(b=()=>f(""),e[16]=f,e[17]=b):b=e[17];const k=!n&&"bg-accent/60";let S;e[18]!==k?(S=ge("gap-2.5",k),e[18]=k,e[19]=S):S=e[19];let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(wt,{iconName:Nn,size:"sm"}),e[20]=C):C=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsx("span",{className:"text-sm",children:"Always"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Target all users"})]}),e[21]=_):_=e[21];let N;e[22]!==b||e[23]!==S?(N=s.jsxs(it,{value:"always Target all users",onSelect:b,className:S,children:[C,_]}),e[22]=b,e[23]=S,e[24]=N):N=e[24];let T;if(e[25]!==n||e[26]!==f||e[27]!==i){let O;e[29]!==n||e[30]!==f?(O=$=>s.jsxs(it,{value:`${$.title} ${$.resolveType} ${$.description??""}`,onSelect:()=>f($.resolveType),className:ge("gap-2.5",n===$.resolveType&&"bg-accent/60"),children:[s.jsx(wt,{iconName:$.iconName,size:"sm"}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsx("span",{className:"text-sm",children:$.title}),$.description&&s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:$.description})]})]},$.resolveType),e[29]=n,e[30]=f,e[31]=O):O=e[31],T=i.map(O),e[25]=n,e[26]=f,e[27]=i,e[28]=T}else T=e[28];let A;e[32]!==N||e[33]!==T?(A=s.jsxs(dn,{children:[h,s.jsxs(fn,{children:[N,T]})]}),e[32]=N,e[33]=T,e[34]=A):A=e[34];let j;e[35]!==l||e[36]!==A?(j=s.jsxs(ls,{open:l,onOpenChange:a,title:"Choose a rule",description:"Pick how to target users for this variant",className:"sm:max-w-lg",children:[g,A]}),e[35]=l,e[36]=A,e[37]=j):j=e[37];let D;return e[38]!==j||e[39]!==v?(D=s.jsxs(s.Fragment,{children:[v,j]}),e[38]=j,e[39]=v,e[40]=D):D=e[40],D}const Fr=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Er=5,Mr=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function Rt(t){const{start:e,end:n}=t,r=typeof e=="string"?e:"",i=typeof n=="string"?n:"";if(!r&&!i)return null;const o=c=>{if(!c)return null;const u=new Date(c);return Number.isNaN(u.getTime())?null:Mr.format(u)},l=o(r),a=o(i);return l&&a?`${l} → ${a}`:l?`From ${l}`:a?`Until ${a}`:null}function mt(t,e=0){if(!t)return"Default";if(e>Er)return"...";const n=t.__resolveType??"";if(["website/matchers/always.ts","$live/matchers/MatchAlways.ts"].includes(n)||n==="")return"Default";switch(n){case"website/matchers/never.ts":return"Hidden";case"website/matchers/device.ts":case"$live/matchers/MatchDevice.ts":{const{mobile:i,tablet:o,desktop:l,devices:a=[]}=t,c=[...a];return i&&c.push("Mobile"),o&&c.push("Tablet"),l&&c.push("Desktop"),c.length>0?c.map(Fr).join(" & "):Se(n)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return Rt(t)??Se(n);case"website/matchers/random.ts":case"$live/matchers/MatchRandom.ts":{const{traffic:i}=t;return typeof i=="number"?`${Math.ceil(i*100)}% of sessions`:Se(n)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:i,match:o}=t,l=[];return i&&l.push(i),o&&l.push(o),l.length>0?l.join(" - "):Se(n)}case"website/matchers/pathname.ts":{const i=t.case,{type:o,pathname:l}=i??{};return o&&l?`Pathname ${o} ${l}`:Se(n)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:i,excludeLocations:o}=t,l=u=>[u.city,u.regionCode,u.country].filter(Boolean).join(" - "),a=i?.[0];if(a){const u=(i?.length??0)-1;return`${l(a)}${u>0?` +${u}`:""}`}const c=o?.[0];if(c){const u=(o?.length??0)-1;return`Except ${l(c)}${u>0?` +${u}`:""}`}return"Any location"}case"website/matchers/multi.ts":case"$live/matchers/MatchMulti.ts":{const{matchers:i,op:o="AND"}=t;if(i&&i.length>0){const l=o==="OR"?"OR":"AND";return i.map(a=>mt(a,e+1)).join(` ${l} `)}return Se(n)}default:{const i=Rt(t);return i||Se(n)||"Default"}}}function Br(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function zr(t,e){return{__resolveType:e,variants:[{rule:rt(),value:structuredClone(t)},{rule:rt(),value:structuredClone(t)}]}}function Pr(t){const e=t.variants;if(e.length===0)return;const n=e.find(r=>Yn(r.rule));return n?n.value:e[e.length-1]?.value}function Vr(t){const e=[...t.variants],n=e[e.length-1],r={rule:rt(),value:n?structuredClone(n.value):void 0};return{...t,variants:[...e,r]}}function Ur(t,e){if(t.variants.length<=1)return null;const n=[...t.variants];return n.splice(e,1),{...t,variants:n}}function Kr(t,e){const n=[...t.variants],r=n[e];return r?(n.splice(e+1,0,structuredClone(r)),{...t,variants:n}):t}function Hr(t,e,n){const r=[...t.variants];if(e===n||e<0||n<0||e>=r.length||n>=r.length)return t;const[i]=r.splice(e,1);return i?(r.splice(n,0,i),{...t,variants:r}):t}function Wr(t,e,n){const r=[...t.variants],i=r[e];return i?(r[e]={...i,value:n},{...t,variants:r}):t}function It(t,e,n){const r=[...t.variants],i=r[e];return i?(r[e]={...i,rule:n},{...t,variants:r}):t}const $t=new WeakMap,Ot=new Map;function Yr(t){let e=$t.get(t);return e||(e=Or(t),$t.set(t,e)),e}function qr(t,e){let n=Ot.get(t);return n===void 0&&(n=ze(t,e),Ot.set(t,n)),n}function Gr(t){const e=J.c(3),{multivariateResolveType:n,renderInnerField:r,...i}=t,{value:o,onChange:l,meta:a,path:c}=i,[u,d]=te.useState(0);if(!Br(o)){let w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Ln,{size:14}),e[0]=w):w=e[0];let R;return e[1]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Ue,{children:"Add variant"}),e[1]=R):R=e[1],s.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[s.jsxs(Ke,{children:[s.jsx(Ve,{asChild:!0,children:s.jsx(Ce,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":"Add variant",onClick:()=>{l(zr(o,n)),d(0)},children:w})}),R]}),r(i)]})}const f=o,m=f.variants,p=Math.min(u,m.length-1),y=m.map(Xr),x=m[p],v=x?.rule??{},g=v.__resolveType??"",h=x?.value,b=a?Yr(a):[],k=g&&a?qr(g,a):null,{__resolveType:S,...C}=v,_=()=>{l(Pr(f)),d(0)},N=()=>{const w=Vr(f);l(w),d(w.variants.length-1)},T=w=>{const R=Ur(f,w);R&&(l(R),p>=R.variants.length&&d(R.variants.length-1))},A=w=>{const R=Kr(f,w);l(R),d(w+1)},j=(w,R)=>{const ee=Hr(f,w,R);l(ee),p===w&&d(R)},D=w=>{l(It(f,p,w?{__resolveType:w}:{__resolveType:qn}))},O=w=>{const R=w,ee=g?{...R,__resolveType:g}:{...R};l(It(f,p,ee))},$=w=>{l(Wr(f,p,w))},P=`${c}-${f.__resolveType}`;let z;return e[2]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(be,{className:"text-xs text-muted-foreground",children:"Rule"}),e[2]=z):z=e[2],s.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[s.jsx(ys,{listKey:P,variants:y,selectedIndex:p,onSelect:d,onDuplicate:A,onDelete:T,onRemoveAll:_,onReorder:j,onAdd:N}),s.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[z,s.jsx(Lr,{currentRt:g,currentLabel:mt(v),matchers:b,onSelect:D}),k&&s.jsx("div",{className:"pt-1",children:s.jsx(Xe,{schema:k,value:C,onChange:O,basePath:""})})]}),r({...i,value:h,onChange:$})]})]})}function Xr(t,e){return{index:e,label:mt(t.rule)||`Variant ${e+1}`}}const Qr="website/loaders/secret.ts";function $e(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function Zr(){return{__resolveType:Qr,name:"",encrypted:""}}function Jr(t){const{value:e,...n}=t;return n}function tt(t){const e=J.c(45),{schema:n,value:r,onChange:i,label:o,path:l}=t;if(typeof r=="string"||r==null&&!$e(r)){const _=typeof r=="string"?r:"";let N;e[0]!==o||e[1]!==l?(N=s.jsx(be,{htmlFor:l,className:"text-sm font-medium",children:o}),e[0]=o,e[1]=l,e[2]=N):N=e[2];let T;e[3]!==n.description?(T=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=T):T=e[4];let A;e[5]!==i?(A=O=>i(O.target.value),e[5]=i,e[6]=A):A=e[6];let j;e[7]!==l||e[8]!==_||e[9]!==A?(j=s.jsx(ke,{id:l,type:"password",value:_,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:"Secret value",onChange:A,className:"h-10"}),e[7]=l,e[8]=_,e[9]=A,e[10]=j):j=e[10];let D;return e[11]!==N||e[12]!==T||e[13]!==j?(D=s.jsxs("div",{className:"space-y-2",children:[N,T,j]}),e[11]=N,e[12]=T,e[13]=j,e[14]=D):D=e[14],D}let a;e[15]!==r?(a=$e(r)?r:Zr(),e[15]=r,e[16]=a):a=e[16];const c=a,u=typeof c.name=="string"?c.name:"",d=typeof c.encrypted=="string"&&c.encrypted,f=`${l}-name`;let m;e[17]!==o||e[18]!==f?(m=s.jsx(be,{htmlFor:f,className:"text-sm font-medium",children:o}),e[17]=o,e[18]=f,e[19]=m):m=e[19];let p;e[20]!==n.description?(p=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[20]=n.description,e[21]=p):p=e[21];const y=`${l}-name`;let x;e[22]!==c||e[23]!==i?(x=_=>i({...c,name:_.target.value}),e[22]=c,e[23]=i,e[24]=x):x=e[24];let v;e[25]!==u||e[26]!==y||e[27]!==x?(v=s.jsx(ke,{id:y,value:u,placeholder:"Secret name",onChange:x,className:"h-10"}),e[25]=u,e[26]=y,e[27]=x,e[28]=v):v=e[28];const g=`${l}-value`,h=d?"Leave blank to keep current value":"Secret value";let b;e[29]!==c||e[30]!==d||e[31]!==i?(b=_=>{const N=_.target.value;if(!N){i(d?Jr(c):c);return}i({...c,value:N})},e[29]=c,e[30]=d,e[31]=i,e[32]=b):b=e[32];let k;e[33]!==b||e[34]!==g||e[35]!==h?(k=s.jsx(ke,{id:g,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:h,onChange:b,className:"h-10"}),e[33]=b,e[34]=g,e[35]=h,e[36]=k):k=e[36];let S;e[37]!==d?(S=d&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"A secret value is stored."}),e[37]=d,e[38]=S):S=e[38];let C;return e[39]!==k||e[40]!==S||e[41]!==m||e[42]!==p||e[43]!==v?(C=s.jsxs("div",{className:"space-y-2",children:[m,p,v,k,S]}),e[39]=k,e[40]=S,e[41]=m,e[42]=p,e[43]=v,e[44]=C):C=e[44],C}function ei(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const n={};for(const[r,i]of Object.entries(e))r.startsWith("__")||(typeof i=="string"?n[r]={type:"string"}:typeof i=="number"?n[r]={type:"number"}:typeof i=="boolean"&&(n[r]={type:"boolean"}));return Object.keys(n).length>0?{type:"object",properties:n}:void 0}const ti=new Set(["__resolveType","@type"]);function ni(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return!1;const e=t.anyOfRefs[0].schema;return!!(e?.properties?.variants||!e&&t.plainSchema)}function si(t){if(qe(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function Dt(t){if(t.type==="array"&&t.items)return t;const e=t.items??si(t);return e?{...t,type:"array",items:e}:null}function ri(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function pt(t){const{schema:e,value:n}=t;if(vt(n)){const l=Gn(n),a=Dt(e);if(l!==null&&a)return s.jsx(Me,{...t,schema:a,value:l,onChange:c=>t.onChange(Xn(n,c))},t.path)}if(Array.isArray(n)&&e.type==="block-ref"&&qe(e)){const l=Dt(e);if(l)return s.jsx(Me,{...t,schema:l,value:n,onChange:t.onChange},t.path)}if(Array.isArray(n)&&!vt(n)&&e.type==="block-ref"){const l=ei(n);if(l){const a={...e,type:"array",items:l};return s.jsx(Me,{...t,schema:a,value:n,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||n!==null&&typeof n=="object"&&!Array.isArray(n)&&typeof n.__resolveType=="string"&&e.anyOfRefs){if(ni(e)){const l=e.anyOfRefs[0],a=l.schema?.properties?.variants?.items?.properties?.value,c=a&&a.type!=="block-ref"?a:e.plainSchema??a?.plainSchema??{type:"string"},u=d=>pt({...d,schema:c});return s.jsx(Gr,{...t,multivariateResolveType:l.resolveType,renderInnerField:u},t.path)}return e.anyOfRefs?s.jsx(Ct,{...t},t.path):null}if(e.format==="image-uri")return s.jsx(ts,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return s.jsx(Ar,{...t},t.path);if(e.format==="dynamic-options"&&e.options)return s.jsx(kr,{...t},t.path);if(e.enum&&e.enum.length>0)return s.jsx(Qs,{...t},t.path);if(e.type==="anyOf")return s.jsx(Ct,{...t},t.path);if($e(n)||e.format==="password"||n==null&&e.format==="password")return s.jsx(tt,{...t},t.path);const r=n??ri(e.type,e.default);if(r==null)return $e(n)?s.jsx(tt,{...t},t.path):null;if($e(r))return s.jsx(tt,{...t,value:r},t.path);const i={...t,value:r},o=n==null?e.type??typeof r:Array.isArray(r)?"array":typeof r;if(o==="array"||Array.isArray(r))return s.jsx(Me,{...i},t.path);switch(o){case"boolean":return s.jsx(Ys,{...i},t.path);case"number":case"integer":return s.jsx(Ws,{...i},t.path);case"string":{const l=e.format;return l==="color-input"?s.jsx(Fe,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?s.jsx(Fe,{...i},t.path):s.jsx(Fe,{...i},t.path)}case"object":return r!==null&&typeof r=="object"&&!Array.isArray(r)?s.jsx(hr,{...i},t.path):null;default:return s.jsx(Fe,{...i},t.path)}}function Xe(t){const e=J.c(16),{schema:n,value:r,onChange:i,basePath:o,breadcrumbPath:l,onBreadcrumbChange:a,meta:c,decofile:u,onSaveReferencedBlock:d,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:y}=t;let x,v;if(e[0]!==o||e[1]!==u||e[2]!==c||e[3]!==m||e[4]!==a||e[5]!==i||e[6]!==p||e[7]!==d||e[8]!==f||e[9]!==y||e[10]!==n.properties||e[11]!==l||e[12]!==r){v=Symbol.for("react.early_return_sentinel");e:{const g=l===void 0?[]:l,h=n.properties;if(!h){v=null;break e}const b=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},k=Object.keys(h).filter(j=>!ti.has(j)&&h[j]?.hidden!==!0);if(k.length===0){let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No editable fields on this section."}),e[15]=j):j=e[15],v=j;break e}const S=(j,D)=>{i({...b,[j]:D})},C=typeof b.__resolveType=="string"?b.__resolveType:void 0,_=g.length>0?tr(k,h,b,g):null,N=_?h[_]:null,T=_&&N?[_]:k,A=_&&N?Js(_,N,g):g;x=s.jsx("div",{className:"min-w-0 space-y-6",children:T.map(j=>{const D=h[j];if(!D)return null;const O=o?`${o}.${j}`:j,$=Ie(j,D);return pt({schema:D,value:b[j],onChange:P=>S(j,P),path:O,label:$,breadcrumbPath:A,onBreadcrumbChange:a,meta:c,decofile:u,onSaveReferencedBlock:d,containerResolveType:C,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:y})})})}e[0]=o,e[1]=u,e[2]=c,e[3]=m,e[4]=a,e[5]=i,e[6]=p,e[7]=d,e[8]=f,e[9]=y,e[10]=n.properties,e[11]=l,e[12]=r,e[13]=x,e[14]=v}else x=e[13],v=e[14];return v!==Symbol.for("react.early_return_sentinel")?v:x}export{Lr as M,ys as S,Li as V,Sn as a,Xe as b,pt as c,Ei as d,Or as e,mt as f,Fe as g,ut as r,Cs as s,Fi as u};