decocms 3.35.2 → 3.35.3

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 (237) hide show
  1. package/dist/client/assets/{AlertCircle-DkwUf9y1.js → AlertCircle-DjOU_aot.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-BUkBkD3O.js → ArrowUpRight-BXJMGk9i.js} +1 -1
  3. package/dist/client/assets/{Check-C_31_MJb.js → Check-D7HZW6oZ.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-Cpbk7Z8F.js → CheckCircle-XS4dmEOs.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-ciuU2nWp.js → ChevronDown-CxTVikeq.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-ZCv3UA1e.js → ChevronLeft-BEmN2X52.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-CFv-fKpX.js → ChevronRight-3jD7TdJZ.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-C64rGI06.js → ChevronUp-Dbc77Gwp.js} +1 -1
  9. package/dist/client/assets/{Container-BNV-9MJ8.js → Container-Hfp9SJFa.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-Cv0q4Ifl.js → DotsVertical-Cz5MZln-.js} +1 -1
  11. package/dist/client/assets/{Eye-BWJG0owY.js → Eye-BIZqMr-y.js} +1 -1
  12. package/dist/client/assets/{FilterLines-B1BriWf_.js → FilterLines-iroXgkwP.js} +1 -1
  13. package/dist/client/assets/{Globe01-BOlA5Q_4.js → Globe01-CiCGKTg3.js} +1 -1
  14. package/dist/client/assets/{HardDrive-DHZcIBpx.js → HardDrive-B26C8dI3.js} +1 -1
  15. package/dist/client/assets/{Key01-5jFctNvh.js → Key01-DZeJDklU.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-DbIVXyve.js → LayoutLeft-CY1OP6dH.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-CqMwbx5t.js → LinkExternal01-DwxMIV-o.js} +1 -1
  18. package/dist/client/assets/{Monitor01-gHJrCrOh.js → Monitor01-_FIjo4ge.js} +1 -1
  19. package/dist/client/assets/{Palette-DqVojGBm.js → Palette-BDd6wxPD.js} +1 -1
  20. package/dist/client/assets/{Play-BXDltgp7.js → Play-C933mY5z.js} +1 -1
  21. package/dist/client/assets/{Plus-CW5uSNYz.js → Plus-aXWGGcSy.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-CWaUwErM.js → RefreshCcw01-DS1vtLKW.js} +1 -1
  23. package/dist/client/assets/{SearchMd-Bz4Ykghd.js → SearchMd-Cr6CluRw.js} +1 -1
  24. package/dist/client/assets/{Settings02-DLDnTjHy.js → Settings02-DeH66RiM.js} +1 -1
  25. package/dist/client/assets/{Shield01-BIILGcyJ.js → Shield01-0kTDalL_.js} +1 -1
  26. package/dist/client/assets/{Star01-Dw_jqiQj.js → Star01-pwvCfpNJ.js} +1 -1
  27. package/dist/client/assets/{Stars01-EGK20_72.js → Stars01-Bw7_Rdwp.js} +1 -1
  28. package/dist/client/assets/{Stars02-CyyQqj9H.js → Stars02-vcxNwhIa.js} +1 -1
  29. package/dist/client/assets/{Sun-DjmglJiH.js → Sun-De2vWRC7.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-a-r60L2U.js → SwitchHorizontal01-Blia-yUi.js} +1 -1
  31. package/dist/client/assets/{Tool01-B8aRmzPo.js → Tool01-DC4THSlP.js} +1 -1
  32. package/dist/client/assets/{Trash01-D5mmvxxB.js → Trash01-DBSukaq0.js} +1 -1
  33. package/dist/client/assets/{Upload01-CYVliRf6.js → Upload01-DruP7_KV.js} +1 -1
  34. package/dist/client/assets/{User01-igKL-FIP.js → User01-Bweqikx-.js} +1 -1
  35. package/dist/client/assets/{Users01-DGPeGDAl.js → Users01-N436STOJ.js} +1 -1
  36. package/dist/client/assets/{Users03-59Bl-ju-.js → Users03-DiilXFZ6.js} +1 -1
  37. package/dist/client/assets/{X-Zx6WnCka.js → X-B1W1F4mo.js} +1 -1
  38. package/dist/client/assets/{XCircle-BI7HvisP.js → XCircle-BtUzMyFW.js} +1 -1
  39. package/dist/client/assets/{XClose-knQz_HAN.js → XClose-r0gXvFlp.js} +1 -1
  40. package/dist/client/assets/{Zap-CCChCiD-.js → Zap-Dvtyg5Ik.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-BlkUA5sB.js → ZapSquare-BQX2HOTP.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-C-DjvL5K.js → ZoomOut-DC46Ewts.js} +1 -1
  43. package/dist/client/assets/{access-gate-DXAe84jj.js → access-gate-CVMVVI4n.js} +1 -1
  44. package/dist/client/assets/{accordion-BlkUK2b8.js → accordion-DBJsIIHl.js} +1 -1
  45. package/dist/client/assets/{add-section-modal-CeJkvxLi.js → add-section-modal-v1Vhtks6.js} +1 -1
  46. package/dist/client/assets/{agent-capabilities-DbrB1URH.js → agent-capabilities-n5Q1YbJ5.js} +1 -1
  47. package/dist/client/assets/{agent-icon-C4vLfyZT.js → agent-icon-CCGqC-bl.js} +1 -1
  48. package/dist/client/assets/{agent-icons-BaxWTu1S.js → agent-icons-CDVkEkIq.js} +2 -2
  49. package/dist/client/assets/{agents-list-CmTUYZJS.js → agents-list-DDPJUJaX.js} +1 -1
  50. package/dist/client/assets/{ai-providers-DHoxdiMk.js → ai-providers-48DFDYIz.js} +1 -1
  51. package/dist/client/assets/{alert-Bw1ORE7l.js → alert-ZcglsRSH.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-DmwO1wKa.js → alert-dialog-B2k_N3ZX.js} +1 -1
  53. package/dist/client/assets/app-editor-DmCxU5-w.js +1 -0
  54. package/dist/client/assets/{auth-jf8Ueqtd.js → auth-ClbRbdVv.js} +1 -1
  55. package/dist/client/assets/{auth-catchall-BKWUHHRQ.js → auth-catchall-BQd5LNUx.js} +1 -1
  56. package/dist/client/assets/{auth-split-layout-DRwMHkyX.js → auth-split-layout-jRGUFWwU.js} +1 -1
  57. package/dist/client/assets/{automation-list-row-DjCxfkOO.js → automation-list-row-CXD-x28t.js} +1 -1
  58. package/dist/client/assets/{automation-runs-CW_yJDML.js → automation-runs-BIJek_K_.js} +1 -1
  59. package/dist/client/assets/{automations-cjNb_nRD.js → automations-D53YpHbQ.js} +1 -1
  60. package/dist/client/assets/{avatar-DdLkUzB6.js → avatar-BG2RlqaT.js} +1 -1
  61. package/dist/client/assets/{badge-CKyeE-oo.js → badge-DIN7Nq6a.js} +1 -1
  62. package/dist/client/assets/{brand-context-Dbw-HLYi.js → brand-context--o_ht-A-.js} +1 -1
  63. package/dist/client/assets/{buckets-Bu7h0_Hd.js → buckets-DD6OfmjS.js} +1 -1
  64. package/dist/client/assets/{calendar-0t1uXfLL.js → calendar-RJSiIOON.js} +1 -1
  65. package/dist/client/assets/{capability-load-error-DY55FeJ6.js → capability-load-error-BfCjxOlU.js} +1 -1
  66. package/dist/client/assets/{card-DP32GBOf.js → card-ykuj7mlf.js} +1 -1
  67. package/dist/client/assets/{chat-context-DK-AWUQz.js → chat-context-CEWm5eLB.js} +1 -1
  68. package/dist/client/assets/{checkbox-DUa9wb8T.js → checkbox-BKpSRHdU.js} +1 -1
  69. package/dist/client/assets/{cli-auth-success-Daqunv5H.js → cli-auth-success-qAM068ao.js} +1 -1
  70. package/dist/client/assets/{collection-detail-5UYGpD4U.js → collection-detail-BaAVQGsi.js} +1 -1
  71. package/dist/client/assets/{collection-display-button-D6VmVMvk.js → collection-display-button-ve31YRQs.js} +1 -1
  72. package/dist/client/assets/{collection-search-jOlxOkeZ.js → collection-search-C5MSFdhR.js} +1 -1
  73. package/dist/client/assets/{collection-table-wrapper-CM2GZd4j.js → collection-table-wrapper-Wi0b7UJz.js} +1 -1
  74. package/dist/client/assets/{collection-tabs-DvXat67P.js → collection-tabs-CAVXo49Z.js} +1 -1
  75. package/dist/client/assets/{collections-xWz9Ka4y.js → collections-Cs_tB6Xp.js} +1 -1
  76. package/dist/client/assets/{command-14UC_LgG.js → command-ClPkeFT9.js} +1 -1
  77. package/dist/client/assets/connect-desktop-dialog-DrC4f6Q3.js +1 -0
  78. package/dist/client/assets/{connection-card-W6kS50Xm.js → connection-card-aeOBPbSz.js} +1 -1
  79. package/dist/client/assets/{connection-detail-BbS7VfwB.js → connection-detail-p5zHxWJQ.js} +1 -1
  80. package/dist/client/assets/{connection-form-helpers-jyOtcSIt.js → connection-form-helpers-C2pw-OdH.js} +1 -1
  81. package/dist/client/assets/{connections-DmawYjy9.js → connections-DtVPIESl.js} +1 -1
  82. package/dist/client/assets/decopilot-sse-pool-BZ8GwOYU.js +1 -0
  83. package/dist/client/assets/{dialog-DPVJEPrK.js → dialog-BwBYyWWk.js} +1 -1
  84. package/dist/client/assets/{domain-settings-BdF9eKHz.js → domain-settings-p2x5w3J1.js} +1 -1
  85. package/dist/client/assets/{drawer-BXyUyCQL.js → drawer-QIeXv6B7.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-DOlfrN75.js → dropdown-menu-CL4WEQRf.js} +1 -1
  87. package/dist/client/assets/{dynamic-plugin-layout-DIyMBeV4.js → dynamic-plugin-layout-cQR6S4X8.js} +1 -1
  88. package/dist/client/assets/{empty-state-xh_20twO.js → empty-state-BKLgisam.js} +1 -1
  89. package/dist/client/assets/{empty-state-CmddJMwD.js → empty-state-C4JeGg4X.js} +1 -1
  90. package/dist/client/assets/{extract-connection-data-DqaTmzNL.js → extract-connection-data-Dz_jOB39.js} +1 -1
  91. package/dist/client/assets/{features-DnOEdSHo.js → features-lNOjZ0fU.js} +1 -1
  92. package/dist/client/assets/{file-explorer-C657nvDI.js → file-explorer-MIJepCP_.js} +1 -1
  93. package/dist/client/assets/{file-type-icon-D93vAYh4.js → file-type-icon-B6AnVMPu.js} +1 -1
  94. package/dist/client/assets/{files-B8jmDdpO.js → files-C6_93qT5.js} +1 -1
  95. package/dist/client/assets/{form-EYtxKS6a.js → form-Z86e6etr.js} +1 -1
  96. package/dist/client/assets/{general-B2htYYmc.js → general-CBaQO14X.js} +1 -1
  97. package/dist/client/assets/{generate-id-BlA-3dpa.js → generate-id-C7CxZwCs.js} +1 -1
  98. package/dist/client/assets/{github-repo-picker-CN9VGWSw.js → github-repo-picker-BlgfXLdP.js} +1 -1
  99. package/dist/client/assets/{header-tab-button-zGw57zar.js → header-tab-button-BOZYRinC.js} +1 -1
  100. package/dist/client/assets/{hover-card-CyNrGP46.js → hover-card-DCrCVVSt.js} +1 -1
  101. package/dist/client/assets/{image-field-CRg7FKDt.js → image-field-CnaeZ7Cq.js} +1 -1
  102. package/dist/client/assets/{index-o7c8QKYO.js → index--1Ng2vB4.js} +4 -4
  103. package/dist/client/assets/{index-LekHmrTG.js → index-1vLRIaGM.js} +1 -1
  104. package/dist/client/assets/{index-tWFPBDUb.js → index-BdZLvIUs.js} +1 -1
  105. package/dist/client/assets/{index-Q2jKm_ff.js → index-Cf5_qS_K.js} +1 -1
  106. package/dist/client/assets/{index-COo7MQNq.js → index-CiRwseKn.js} +1 -1
  107. package/dist/client/assets/{index-C7fNNl96.js → index-CmVsJNWn.js} +1 -1
  108. package/dist/client/assets/{index-BFzXRFgv.js → index-D36v7D1U.js} +1 -1
  109. package/dist/client/assets/{index-DFboBiZx.js → index-DvG0T2G3.js} +1 -1
  110. package/dist/client/assets/{index-NebhiVVQ.js → index-DxJD6aw-.js} +1 -1
  111. package/dist/client/assets/{index-Bql2Wqwg.js → index-F-DdQVig.js} +1 -1
  112. package/dist/client/assets/{index-RgwViKsx.js → index-Jt8pUNdF.js} +1 -1
  113. package/dist/client/assets/{index-D2JLfz42.js → index-Nc3tqGu_.js} +1 -1
  114. package/dist/client/assets/{index-DxTO1Vau.js → index-YE7XuOF9.js} +1 -1
  115. package/dist/client/assets/{index-ltKXKiQ2.js → index-qk7utkhC.js} +1 -1
  116. package/dist/client/assets/{index-redirect-C7lzzPeT.js → index-redirect-Bga8SUq5.js} +1 -1
  117. package/dist/client/assets/{index-DnIoj8fl.js → index-uVHAmIsb.js} +3 -3
  118. package/dist/client/assets/{input-kFc4cqln.js → input-BYcDxHNs.js} +1 -1
  119. package/dist/client/assets/{integration-icon-D3EQp4Fu.js → integration-icon-YIddy6rU.js} +1 -1
  120. package/dist/client/assets/{label-Bvw0Ied9.js → label-6YORzGJ9.js} +1 -1
  121. package/dist/client/assets/{layout-Ca-s_wnC.js → layout-BqzITPb8.js} +1 -1
  122. package/dist/client/assets/{login-CX7-TkZm.js → login-OD0e1zDV.js} +1 -1
  123. package/dist/client/assets/{mcp-oauth-jiIVtUUC.js → mcp-oauth-Bqzn0Dif.js} +1 -1
  124. package/dist/client/assets/{members-BLERW5ar.js → members-DS-tdh70.js} +1 -1
  125. package/dist/client/assets/{monaco-editor-MWSSoG2S.js → monaco-editor-BUU4dfTp.js} +1 -1
  126. package/dist/client/assets/{monitoring-stats-row-EcWn-b5L.js → monitoring-stats-row-W1kG1QMr.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-DErfvA_e.js → oauth-callback-TPVFfDa1.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-ai-provider-B2CeVkps.js → oauth-callback-ai-provider-BSrRnpyk.js} +1 -1
  129. package/dist/client/assets/{onboarding-D1OquzOs.js → onboarding-K3muUGna.js} +1 -1
  130. package/dist/client/assets/{org-install-CP6GafaT.js → org-install-B_NKJRUX.js} +1 -1
  131. package/dist/client/assets/{org-layout-BKiOkIR9.js → org-layout-DS11FDyh.js} +1 -1
  132. package/dist/client/assets/{org-plugin-layout-aVdWNCe2.js → org-plugin-layout-Ds4SKE20.js} +1 -1
  133. package/dist/client/assets/{page-seo-form-63_BP4Z5.js → page-seo-form-CUXHyT3k.js} +1 -1
  134. package/dist/client/assets/page-seo-sheet-DWN_jrpV.js +1 -0
  135. package/dist/client/assets/{pair-CC2q5WhY.js → pair-DguDTLaz.js} +1 -1
  136. package/dist/client/assets/{plugin-empty-state-C8J8IuVQ.js → plugin-empty-state-BsOWqXT4.js} +1 -1
  137. package/dist/client/assets/{plugin-header-CQ-0B9QL.js → plugin-header-CVnVRSWb.js} +1 -1
  138. package/dist/client/assets/{plugin-layout-1OlgHiyb.js → plugin-layout-B-eexJrb.js} +1 -1
  139. package/dist/client/assets/{popover-DFBV-kft.js → popover-OWTo-ttg.js} +1 -1
  140. package/dist/client/assets/{post-editor-RC0nSinu.js → post-editor-9P0wvqVY.js} +1 -1
  141. package/dist/client/assets/{primitives-Dj8whdvu.js → primitives-BKz7PoD1.js} +1 -1
  142. package/dist/client/assets/{profile-C1y0Wzbe.js → profile-DKgH58jm.js} +1 -1
  143. package/dist/client/assets/project-app-view-aiPHbBMn.js +1 -0
  144. package/dist/client/assets/record-editor-CEd3Nq-X.js +1 -0
  145. package/dist/client/assets/registry-BJIUp0yq.js +2 -0
  146. package/dist/client/assets/{registry-layout-CRdtAXEl.js → registry-layout-BVyz_YyX.js} +1 -1
  147. package/dist/client/assets/{require-capability-CJqD_sNw.js → require-capability-BNXWgOaA.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-DVQqpR9U.js → required-auth-layout-CgveTWoj.js} +1 -1
  149. package/dist/client/assets/{reset-password-6kMSCjoE.js → reset-password-B5XJrRXo.js} +1 -1
  150. package/dist/client/assets/{resizable-BCts7Hoe.js → resizable-ZwB_SgdO.js} +1 -1
  151. package/dist/client/assets/{roles-Tffk7a5z.js → roles-B3qZ9FQm.js} +1 -1
  152. package/dist/client/assets/save-referenced-block-BWbuYBb2.js +1 -0
  153. package/dist/client/assets/{save-status-CgWmFzXD.js → save-status-BAgQweyK.js} +1 -1
  154. package/dist/client/assets/{schema-form-WouwDdYp.js → schema-form-CD60zPdr.js} +1 -1
  155. package/dist/client/assets/{scroll-area-DXdZCfi_.js → scroll-area-CixG0pJh.js} +1 -1
  156. package/dist/client/assets/{search-input-B3XYdfeF.js → search-input-BfizHALq.js} +1 -1
  157. package/dist/client/assets/{secrets-CbDoNw3q.js → secrets-hkT-vkWO.js} +1 -1
  158. package/dist/client/assets/{sections-editor-BmHJWIlu.js → sections-editor-C7wGHkLQ.js} +1 -1
  159. package/dist/client/assets/{select-B_xVBVbm.js → select-DpIv2m7o.js} +1 -1
  160. package/dist/client/assets/{select-model-DkF6uTkV.js → select-model-DHqBdvUI.js} +1 -1
  161. package/dist/client/assets/{seo-editor-CSzOD8a1.js → seo-editor-X4tutsUS.js} +1 -1
  162. package/dist/client/assets/{settings-layout-CmjQb7Ht.js → settings-layout-BPos4Lfi.js} +1 -1
  163. package/dist/client/assets/{settings-section-BTddWHA-.js → settings-section-nvSL8mUn.js} +1 -1
  164. package/dist/client/assets/{sheet-B3GYGLhe.js → sheet-J3PJeFDK.js} +1 -1
  165. package/dist/client/assets/{shell-controls-CD1e_u6K.js → shell-controls-CV-_zqGg.js} +1 -1
  166. package/dist/client/assets/{shell-layout-Cgwg5QF3.js → shell-layout-tEjGEg5-.js} +1 -1
  167. package/dist/client/assets/{shell-route-loading-COeh_aex.js → shell-route-loading-CZqCIakz.js} +1 -1
  168. package/dist/client/assets/{sidebar-kyVuWucL.js → sidebar-DawbXHdj.js} +1 -1
  169. package/dist/client/assets/{skeleton-CyRCN25X.js → skeleton-BCgq4Xy6.js} +1 -1
  170. package/dist/client/assets/{sortable.esm-C7P-vU6-.js → sortable.esm-DsSid7Zp.js} +1 -1
  171. package/dist/client/assets/{spinner-B62HtwxP.js → spinner-BQT6CDh-.js} +1 -1
  172. package/dist/client/assets/{sso-CFgdcP4X.js → sso-B1HWtZMn.js} +1 -1
  173. package/dist/client/assets/{store-DD3q7khp.js → store-BfFFxnM0.js} +1 -1
  174. package/dist/client/assets/store-registry-DspBhmXB.js +2 -0
  175. package/dist/client/assets/{studio-tools-CYvl10tJ.js → studio-tools-Bsqb-6Fx.js} +1 -1
  176. package/dist/client/assets/{switch-9AraHuPG.js → switch-Cu-9OUl1.js} +1 -1
  177. package/dist/client/assets/{tab-id-DiaWi79N.js → tab-id-DxwgE0jf.js} +1 -1
  178. package/dist/client/assets/{table-D-eZ2Wly.js → table-XS_vYE_1.js} +1 -1
  179. package/dist/client/assets/{tabs-DNIUI4W6.js → tabs-B4F5NKqf.js} +1 -1
  180. package/dist/client/assets/{task-status-CDkG-N6p.js → task-status-OfocbInI.js} +1 -1
  181. package/dist/client/assets/{textarea-BuPx5SDQ.js → textarea-pwpin7Xo.js} +1 -1
  182. package/dist/client/assets/{toggle-group-BgDlmAc0.js → toggle-group-BTyEkyOV.js} +1 -1
  183. package/dist/client/assets/{toolbar-WIS1-2Sy.js → toolbar-ZyghcYDs.js} +1 -1
  184. package/dist/client/assets/{tools-list-D6uq4MrN.js → tools-list-Dm-oDLPn.js} +1 -1
  185. package/dist/client/assets/{tooltip-DG-C65pd.js → tooltip-C_pZvUmA.js} +1 -1
  186. package/dist/client/assets/{types-7_L4W6Tu.js → types-CVQ_neIF.js} +1 -1
  187. package/dist/client/assets/{use-ai-providers-C3HTrKhd.js → use-ai-providers-CGgTldnc.js} +1 -1
  188. package/dist/client/assets/{use-automations-QDhIwpIJ.js → use-automations-C3tUJiXy.js} +1 -1
  189. package/dist/client/assets/{use-capability-DQgRY6_x.js → use-capability-BcwY0Lf1.js} +1 -1
  190. package/dist/client/assets/{use-clock-tick-CwR4C3CJ.js → use-clock-tick-Bsu4JpY1.js} +1 -1
  191. package/dist/client/assets/{use-collections-DjJTRpo_.js → use-collections-CNY4Rigp.js} +1 -1
  192. package/dist/client/assets/{use-connection-DUYQMDLQ.js → use-connection-Cd3-MJT5.js} +1 -1
  193. package/dist/client/assets/{use-copy-9rW5ZwZw.js → use-copy-C62Opw3r.js} +1 -1
  194. package/dist/client/assets/{use-create-virtual-mcp-DZIq-rHQ.js → use-create-virtual-mcp-JNvxHXlx.js} +1 -1
  195. package/dist/client/assets/{use-debounced-autosave-4TUEEtao.js → use-debounced-autosave-CmpKlipe.js} +1 -1
  196. package/dist/client/assets/{use-delete-connection-BSxNsHg_.js → use-delete-connection-DOqJ3DYp.js} +1 -1
  197. package/dist/client/assets/{use-file-configs-CiOc-9XG.js → use-file-configs-OSUx89xj.js} +1 -1
  198. package/dist/client/assets/{use-infinite-scroll-HMRo8z7S.js → use-infinite-scroll-Ce2zTY3i.js} +1 -1
  199. package/dist/client/assets/{use-list-state-D5-adRnk.js → use-list-state-B6GtGz_i.js} +1 -1
  200. package/dist/client/assets/{use-mcp-client-DAanazcB.js → use-mcp-client-Bqv2ciYo.js} +1 -1
  201. package/dist/client/assets/{use-mcp-prompts-BJhG10VU.js → use-mcp-prompts-B2fIh5W5.js} +1 -1
  202. package/dist/client/assets/{use-mcp-tools-BZ5C7mX8.js → use-mcp-tools-DNa7v9SS.js} +1 -1
  203. package/dist/client/assets/{use-members-oxzMf6HC.js → use-members-BBAnZQ_N.js} +1 -1
  204. package/dist/client/assets/{use-navigate-to-agent-Cvb4b2dj.js → use-navigate-to-agent-CDxi6d1t.js} +1 -1
  205. package/dist/client/assets/{use-org-auth-client-4XCuGX_0.js → use-org-auth-client-BvIrqhMj.js} +1 -1
  206. package/dist/client/assets/{use-org-sso-C3JjHGLM.js → use-org-sso-DvInKERU.js} +1 -1
  207. package/dist/client/assets/{use-organization-roles-CE1F99xu.js → use-organization-roles-CrylSy9-.js} +1 -1
  208. package/dist/client/assets/{use-organization-settings-BDQcymx3.js → use-organization-settings-CdYVljPu.js} +1 -1
  209. package/dist/client/assets/{use-registry-connections-Btr8vraI.js → use-registry-connections-Bdnyk0np.js} +1 -1
  210. package/dist/client/assets/{use-secrets-aNG7boBI.js → use-secrets-5xq_sQR4.js} +1 -1
  211. package/dist/client/assets/{use-status-sounds-CRlMq1Od.js → use-status-sounds-CugYppDe.js} +1 -1
  212. package/dist/client/assets/{use-view-mode-DaIWDL_S.js → use-view-mode-BmgcQL7Y.js} +1 -1
  213. package/dist/client/assets/{use-virtual-mcp-B4MbUdTW.js → use-virtual-mcp-Clsr41cX.js} +1 -1
  214. package/dist/client/assets/useInfiniteQuery-CL1ZPxL1.js +1 -0
  215. package/dist/client/assets/{useRouterState-DuGUZA7B.js → useRouterState-BCoEdLHo.js} +1 -1
  216. package/dist/client/assets/useSuspenseInfiniteQuery-B0dXZKGJ.js +1 -0
  217. package/dist/client/assets/{user-BWs1Xtr6.js → user-DNJpS6qb.js} +1 -1
  218. package/dist/client/assets/{view-mode-toggle-G-KCK_xv.js → view-mode-toggle-CnJNM_yP.js} +1 -1
  219. package/dist/client/assets/{watch-sse-pool-BVVVT94i.js → watch-sse-pool-DiiHGFSQ.js} +1 -1
  220. package/dist/client/assets/{workflow-CQ33bXoz.js → workflow-DTPliqqz.js} +1 -1
  221. package/dist/client/assets/workflow-detail-DmBVM3K8.js +1 -0
  222. package/dist/client/index.html +1 -1
  223. package/dist/server/cli.js +2 -2
  224. package/dist/server/server.js +1 -1
  225. package/package.json +1 -1
  226. package/dist/client/assets/app-editor-DZU371gg.js +0 -1
  227. package/dist/client/assets/connect-desktop-dialog-DVqHifor.js +0 -1
  228. package/dist/client/assets/decopilot-sse-pool-CwSrVgbm.js +0 -1
  229. package/dist/client/assets/page-seo-sheet-CgQ_3iup.js +0 -1
  230. package/dist/client/assets/project-app-view-CDg0Ipzu.js +0 -1
  231. package/dist/client/assets/record-editor-C8D-bch6.js +0 -1
  232. package/dist/client/assets/registry-DwqBhaO7.js +0 -2
  233. package/dist/client/assets/save-referenced-block-BPZ9GwRm.js +0 -1
  234. package/dist/client/assets/store-registry-DmaUBXDq.js +0 -2
  235. package/dist/client/assets/useInfiniteQuery-Dal3RT3l.js +0 -1
  236. package/dist/client/assets/useSuspenseInfiniteQuery-CqnU8D2I.js +0 -1
  237. package/dist/client/assets/workflow-detail-Di_0eyvg.js +0 -1
@@ -1 +1 @@
1
- import{r as $,p as Se,K as re,b8 as dt,m as Re,j as s,c as K,l as fe,B as ne,e as H,P as Pe,aE as Ie,R as se,aG as De,aH as ke,F as $e,G as mt,H as ut,a as Fe,n as he,t as Oe,D as Ke,s as ft,E as ht,f as gt,d as xt}from"./index-DnIoj8fl.js";import{u as pt}from"./use-organization-roles-CE1F99xu.js";import{u as je}from"./use-org-auth-client-4XCuGX_0.js";import{B as ge}from"./badge-CKyeE-oo.js";import{A as Qe,a as He,b as qe,c as Ze,d as Xe,f as Je,e as We,g as et}from"./alert-dialog-DmwO1wKa.js";import{D as bt,a as Et,b as Tt,c as _t}from"./dropdown-menu-DOlfrN75.js";import{i as It}from"./DotsVertical-Cv0q4Ifl.js";import{s as Ae}from"./Plus-CW5uSNYz.js";import{s as St}from"./Trash01-D5mmvxxB.js";import{C as Nt}from"./collection-table-wrapper-CM2GZd4j.js";import{P as te}from"./index-NebhiVVQ.js";import{E as Ge}from"./empty-state-xh_20twO.js";import{S as ve}from"./search-input-B3XYdfeF.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-D3EQp4Fu.js";import{u as Ct}from"./use-infinite-scroll-HMRo8z7S.js";import{C as we}from"./checkbox-DUa9wb8T.js";import{i as At}from"./RefreshCcw01-CWaUwErM.js";import{u as Rt}from"./useSuspenseInfiniteQuery-CqnU8D2I.js";import{u as Ot,a as jt}from"./use-mcp-client-DAanazcB.js";import{C as vt}from"./collection-search-jOlxOkeZ.js";import{u as nt}from"./use-members-oxzMf6HC.js";import{u as yt}from"./use-connection-DUYQMDLQ.js";import{u as wt,d as Lt}from"./use-ai-providers-C3HTrKhd.js";import{A as lt}from"./avatar-DdLkUzB6.js";import{S as xe}from"./switch-9AraHuPG.js";import{c as pe,b as be,T as Ee,a as Te}from"./tooltip-DG-C65pd.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-BTddWHA-.js";import{t as Mt}from"./ChevronDown-ciuU2nWp.js";import{i as Pt}from"./ChevronRight-CFv-fKpX.js";import{i as ze}from"./X-Zx6WnCka.js";import{a as Dt}from"./use-capability-DQgRY6_x.js";import{A as kt}from"./access-gate-DXAe84jj.js";import"./Check-C_31_MJb.js";import"./table-D-eZ2Wly.js";import"./SwitchHorizontal01-a-r60L2U.js";import"./sidebar-kyVuWucL.js";import"./LayoutLeft-DbIVXyve.js";import"./sheet-B3GYGLhe.js";import"./SearchMd-Bz4Ykghd.js";import"./Container-BNV-9MJ8.js";import"./agent-icon-C4vLfyZT.js";import"./AlertCircle-DkwUf9y1.js";import"./Tool01-B8aRmzPo.js";import"./XCircle-BI7HvisP.js";import"./ArrowUpRight-BUkBkD3O.js";import"./ZapSquare-BlkUA5sB.js";import"./Users03-59Bl-ju-.js";import"./CheckCircle-Cpbk7Z8F.js";import"./ChevronLeft-ZCv3UA1e.js";import"./ChevronUp-C64rGI06.js";import"./Eye-BWJG0owY.js";import"./ZoomOut-C-DjvL5K.js";import"./Globe01-BOlA5Q_4.js";import"./FilterLines-B1BriWf_.js";import"./Star01-Dw_jqiQj.js";import"./Palette-DqVojGBm.js";import"./HardDrive-DHZcIBpx.js";import"./Stars02-CyyQqj9H.js";import"./Key01-5jFctNvh.js";import"./LinkExternal01-CqMwbx5t.js";import"./Monitor01-gHJrCrOh.js";import"./Sun-DjmglJiH.js";import"./Play-BXDltgp7.js";import"./Settings02-DLDnTjHy.js";import"./Shield01-BIILGcyJ.js";import"./Stars01-EGK20_72.js";import"./Upload01-CYVliRf6.js";import"./User01-igKL-FIP.js";import"./Users01-DGPeGDAl.js";import"./XClose-knQz_HAN.js";import"./Zap-CCChCiD-.js";import"./auth-jf8Ueqtd.js";import"./use-collections-DjJTRpo_.js";import"./card-DP32GBOf.js";import"./capability-load-error-DY55FeJ6.js";const Le="basic-usage",Me=[{id:Le,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"]},{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_GET","ORGANIZATION_DOMAIN_SET","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_CLEAR"]},{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"],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"],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","REGISTRY_MONITOR_SCHEDULE_SET","REGISTRY_MONITOR_SCHEDULE_CANCEL"]},{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:"event-bus:use",label:"Use event bus",description:"Publish events and manage subscriptions",section:"Developer",tools:["EVENT_PUBLISH","EVENT_SUBSCRIBE","EVENT_UNSUBSCRIBE","EVENT_CANCEL","EVENT_ACK","EVENT_SUBSCRIPTION_LIST","EVENT_SYNC_SUBSCRIPTIONS"]},{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}];[...Me.find(t=>t.id===Le)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Me.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Me){if(e.id===Le)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=H.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 S;return e[17]!==f||e[18]!==o||e[19]!==m?(S=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=S):S=e[20],S}function Yt(t){return t.stopPropagation()}function $t(t){const e=H.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}=Se(),m=Ot({connectionId:jt,orgId:o.id,orgSlug:o.slug}),S=100,T=h.trim(),E=T?{operator:"or",conditions:[{field:["title"],operator:"contains",value:T},{field:["description"],operator:"contains",value:T}]}:void 0,N=!!n,C={...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:0,...N&&{include_virtual:!0}},v=JSON.stringify(C),{data:_,fetchNextPage:R,hasNextPage:p,isFetchingNextPage:O}=Rt({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:b,...N&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,q)=>Q+(q?.items?.length??0),0)},staleTime:3e4}),I=_?.pages.flatMap(b=>b?.items??[])??[],j=Ct(R,p??!1,O),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}),[L,z]=$.useState(G[0]?.id??null),y=L?G.find(b=>b.id===L)??null:null,{data:M,isFetching:Y}=Re({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",L??""),queryFn:async()=>L?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:L}})).structuredContent?.item??null:null,enabled:!!L,staleTime:3e4}),F=M?.tools??[],X=(b,D)=>t[b]?.includes(D)??!1,J=(b,D)=>{const Q=t[b]??[],q=Q.includes(D),W={...t};if(q){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===L?F:[];if(!D.length)return;const Q=t[b]??[],q=D.map(ee=>ee.name),W=Q.length>0&&q.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=q,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=L===b.id,Q=D?F.length:0,q=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:q,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),O&&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 Ne=["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 Ht(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)%Ne.length;return Ne[n]??Ne[0]}function qt(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(Ee,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Xt(t){const e=H.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 R=x.flatMap(es).flatMap(Wt);i(!1),r(R.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!_))}};let m;e[10]!==f?(m=v=>{const{section:_,capabilities:R}=v;return{section:_,capabilities:R.filter(p=>!f||p.label.toLowerCase().includes(f)||p.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const S=x.map(m).filter(Jt);let T;e[12]!==n||e[13]!==i||e[14]!==r?(T=()=>{i(!n),r([])},e[12]=n,e[13]=i,e[14]=r,e[15]=T):T=e[15];let E;e[16]!==n||e[17]!==c||e[18]!==T?(E=Ye(n,c,T),e[16]=n,e[17]=c,e[18]=T,e[19]=E):E=e[19];let N;e[20]!==n||e[21]!==i||e[22]!==r||e[23]!==c?(N=c?void 0:()=>{i(!n),r([])},e[20]=n,e[21]=i,e[22]=r,e[23]=c,e[24]=N):N=e[24];let C;e[25]!==E||e[26]!==N?(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:E,onClick:N})})}),e[25]=E,e[26]=N,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,S.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):S.map(v=>{const{section:_,capabilities:R}=v;return s.jsx(Ue,{title:_,children:s.jsx(Be,{children:R.map(p=>{const O=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(O,c,()=>o(p,O)),onClick:c?void 0:()=>o(p,O)},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=H.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,[S,T]=$.useState(m),E=m||S,N=T,[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 R=_;let p;if(e[4]!==R||e[5]!==d){let j;e[7]!==R?(j=u=>R(u.id),e[7]=R,e[8]=j):j=e[8],p=d.filter(j),e[4]=R,e[5]=d,e[6]=p}else p=e[6];const O=p.length;let I;if(e[9]!==h||e[10]!==g||e[11]!==n||e[12]!==O||e[13]!==E||e[14]!==r||e[15]!==R||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=()=>N(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]!==O||e[34]!==d.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[O,"/",d.length," enabled"]}),e[33]=O,e[34]=d.length,e[35]=B):B=e[35];let L;e[36]!==E?(L=E?s.jsx(Mt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=E,e[37]=L):L=e[37];let z;e[38]!==L||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,L]}),e[38]=L,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,E&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(M=>{const Y=R(M.id),F=()=>{if(!o){if(g){x(n,h,M.id);return}a(n,M.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:M.title})}),s.jsx("div",{onClick:as,children:o?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:Y,disabled:!0,onCheckedChange:rs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:Y,onCheckedChange:F})})]},M.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]=O,e[13]=E,e[14]=r,e[15]=R,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=H.c(33),{connection:n,selectedModels:l,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:g}=t,f=Lt(n.id);let a,x,o,m,S;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){S=Symbol.for("react.early_return_sentinel");e:{let N;e[16]!==n.label?(N=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=N):N=e[17];const C=f.filter(hs).map(N),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){S=null;break e}const R=new Map;for(const A of _){const k=ss(A.id,n.providerId),G=R.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),R.set(k,G)}const p=Array.from(R.entries()).map(fs).sort(us),O=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:O},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]=S}else a=e[11],x=e[12],o=e[13],m=e[14],S=e[15];if(S!==Symbol.for("react.early_return_sentinel"))return S;let T;e[26]!==a||e[27]!==x?(T=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=T):T=e[28];let E;return e[29]!==o||e[30]!==m||e[31]!==T?(E=s.jsxs("div",{className:o,children:[m,T]}),e[29]=o,e[30]=m,e[31]=T,e[32]=E):E=e[32],E}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=H.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,O)=>{const I=l[p]??[],j={...l};if(I.includes(O)){const u=I.filter(w=>w!==O);u.length===0?delete j[p]:j[p]=u}else j[p]=[...I,O];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,O,I)=>{i(!1),r({...l,[p]:O.filter(j=>j!==I)})},e[3]=l,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,S=!c&&"hover:bg-muted/50 cursor-pointer";let T;e[7]!==S?(T=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",S),e[7]=S,e[8]=T):T=e[8];let E;e[9]!==n||e[10]!==i||e[11]!==r||e[12]!==c?(E=()=>{if(c)return;const p=!n;i(p),p&&r({})},e[9]=n,e[10]=i,e[11]=r,e[12]=c,e[13]=E):E=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=N):N=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(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Te,{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]!==T||e[21]!==E||e[22]!==C?(v=s.jsxs("div",{className:T,onClick:E,children:[N,C]}),e[20]=T,e[21]=E,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 R;return e[32]!==_||e[33]!==v?(R=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,_]}),e[32]=_,e[33]=v,e[34]=R):R=e[34],R}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=H.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,S,T,E,N,C,v,_,R,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 M=c.toLowerCase();return y.user?.name?.toLowerCase().includes(M)||y.user?.email?.toLowerCase().includes(M)},e[20]=c,e[21]=B):B=e[21];const L=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],S=z,m=Qe,R=n,p=l,o=He,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{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],N="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],T="flex-1 overflow-auto",E=L.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:L.map(y=>{const M=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",!M||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:F||Y,onCheckedChange:()=>{!M||Y||a(X=>X.includes(y.id)?X.filter(J=>J!==y.id):[...X,y.id])},disabled:!M||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})]}),!M&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&M&&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]=S,e[12]=T,e[13]=E,e[14]=N,e[15]=C,e[16]=v,e[17]=_,e[18]=R,e[19]=p}else o=e[9],m=e[10],S=e[11],T=e[12],E=e[13],N=e[14],C=e[15],v=e[16],_=e[17],R=e[18],p=e[19];let O;e[29]!==T||e[30]!==E?(O=s.jsx("div",{className:T,children:E}),e[29]=T,e[30]=E,e[31]=O):O=e[31];let I;e[32]!==O||e[33]!==N||e[34]!==C?(I=s.jsxs("div",{className:N,children:[C,O]}),e[32]=O,e[33]=N,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]!==S||e[38]!==u||e[39]!==w?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:S,disabled:u,children:["Add ",w]})]}),e[37]=S,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]!==R||e[50]!==p?(G=s.jsx(m,{open:R,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=R,e[50]=p,e[51]=G):G=e[51],G}function Es(t){const e=H.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,S;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 R=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 O=R.filter(p);S="flex flex-col h-full",o="flex-1 overflow-auto",m=R.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."})]})}):O.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:O.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(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Te,{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]=S}else o=e[7],m=e[8],S=e[9];let T;e[14]!==o||e[15]!==m?(T=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=T):T=e[16];let E;e[17]!==n||e[18]!==l?(E=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=E):E=e[19];let N;e[20]!==h||e[21]!==n||e[22]!==c||e[23]!==E?(N=s.jsx(bs,{open:h,onOpenChange:c,selectedMemberIds:n,onAddMembers:E}),e[20]=h,e[21]=n,e[22]=c,e[23]=E,e[24]=N):N=e[24];let C;return e[25]!==S||e[26]!==T||e[27]!==N?(C=s.jsxs("div",{className:S,children:[T,N]}),e[25]=S,e[26]=T,e[27]=N,e[28]=C):C=e[28],C}function Ts(t){const e=H.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(Es,{...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 Ss(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 Ns(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"?Ss(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=H.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(Ee,{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(Te,{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 Rs(t){const e=H.c(14),{locator:n}=Se(),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}=Re(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(Os,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Os({target:t,onBack:e,onSaved:n,members:l,connections:i}){const{locator:r}=Se(),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,S=o.formState.isDirty,T=Fe({mutationFn:async u=>{const w=Ns(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 L=l.filter(M=>M.role===(B??U)).map(M=>M.id),z=u.memberIds.filter(M=>!L.includes(M)),y=L.filter(M=>!u.memberIds.includes(M));for(const M of z){const Y=await d.organization.updateMemberRole({memberId:M,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const M of y){const Y=await d.organization.updateMemberRole({memberId:M,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,L=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:w,...L?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(L?U:B,L?B:void 0),L?{...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 L=await d.organization.updateMemberRole({memberId:B,role:[A]});if(L?.error)throw new Error(L.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;Oe(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")}}),E=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}T.mutate(u)}),N=!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"}],[_,R]=$.useState(""),[p,O]=$.useState(!1),I=u=>{x(u),R("")},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:N&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:T.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:E,disabled:T.isPending||!m||!S,children:T.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"?qt(t.role):Ht(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:R,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>O(!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(Ts,{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:O})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=H.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 Ls={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ms(t,e){return e?Ls[t]??"bg-neutral-400":ws(t)}function Ps(){const t=H.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}=Se(),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 S;e:{if(!h){S=null;break e}if(h==="new"){S={kind:"new"};break e}if(h.startsWith("builtin-")){S={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);S=V?{kind:"custom",role:V}:null}const T=S;let E;t[5]!==c?(E=re.members(c),t[5]=c,t[6]=E):E=t[6];let N;t[7]!==g?(N=()=>g.organization.listMembers(),t[7]=g,t[8]=N):N=t[8];let C;t[9]!==E||t[10]!==N?(C={queryKey:E,queryFn:N},t[9]=E,t[10]=N,t[11]=C):C=t[11];const{data:v}=Re(C);let _;t[12]!==v?.data?.members?(_=v?.data?.members??[],t[12]=v?.data?.members,t[13]=_):_=t[13];const R=_;let p;t[14]!==R?(p=P=>R.filter(V=>V.role===P).length,t[14]=R,t[15]=p):p=t[15];const O=p;let I;if(t[16]!==a||t[17]!==O||t[18]!==e){let P;t[20]!==O?(P=ce=>({kind:"builtin",role:{...ce,memberCount:O(ce.role)}}),t[20]=O,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==O?(ae=ce=>({kind:"custom",role:{...ce,memberCount:O(ce.role)}}),t[22]=O,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]=O,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)=>{Oe("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),x(),T?.kind==="custom"&&T.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(bt,{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(It,{size:16})})}),s.jsx(Tt,{align:"end",onClick:Ds,children:s.jsxs(_t,{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 L;t[31]!==m?(L=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=L):L=t[32];const z=L;if(T){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(Rs,{target:T,onBack:P,onSaved:V},js(T))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let M;t[39]===Symbol.for("react.memo_cache_sentinel")?(M=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=M):M=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:M}),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(Nt,{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 q;t[61]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Ze,{children:"Delete Role"}),t[61]=q):q=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(qe,{children:[q,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(He,{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",Ms(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){Oe("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=H.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 fl(){const t=H.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{fl as default};
1
+ import{r as $,p as Se,K as re,b8 as dt,m as Re,j as s,c as K,l as fe,B as ne,e as H,P as Pe,aE as Ie,R as se,aG as De,aH as ke,F as $e,G as mt,H as ut,a as Fe,n as he,t as Oe,D as Ke,s as ft,E as ht,f as gt,d as xt}from"./index-uVHAmIsb.js";import{u as pt}from"./use-organization-roles-CrylSy9-.js";import{u as je}from"./use-org-auth-client-BvIrqhMj.js";import{B as ge}from"./badge-DIN7Nq6a.js";import{A as Qe,a as He,b as qe,c as Ze,d as Xe,f as Je,e as We,g as et}from"./alert-dialog-B2k_N3ZX.js";import{D as bt,a as Et,b as Tt,c as _t}from"./dropdown-menu-CL4WEQRf.js";import{i as It}from"./DotsVertical-Cz5MZln-.js";import{s as Ae}from"./Plus-aXWGGcSy.js";import{s as St}from"./Trash01-DBSukaq0.js";import{C as Nt}from"./collection-table-wrapper-Wi0b7UJz.js";import{P as te}from"./index-DxJD6aw-.js";import{E as Ge}from"./empty-state-BKLgisam.js";import{S as ve}from"./search-input-BfizHALq.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-YIddy6rU.js";import{u as Ct}from"./use-infinite-scroll-Ce2zTY3i.js";import{C as we}from"./checkbox-BKpSRHdU.js";import{i as At}from"./RefreshCcw01-DS1vtLKW.js";import{u as Rt}from"./useSuspenseInfiniteQuery-B0dXZKGJ.js";import{u as Ot,a as jt}from"./use-mcp-client-Bqv2ciYo.js";import{C as vt}from"./collection-search-C5MSFdhR.js";import{u as nt}from"./use-members-BBAnZQ_N.js";import{u as yt}from"./use-connection-Cd3-MJT5.js";import{u as wt,d as Lt}from"./use-ai-providers-CGgTldnc.js";import{A as lt}from"./avatar-BG2RlqaT.js";import{S as xe}from"./switch-Cu-9OUl1.js";import{c as pe,b as be,T as Ee,a as Te}from"./tooltip-C_pZvUmA.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-nvSL8mUn.js";import{t as Mt}from"./ChevronDown-CxTVikeq.js";import{i as Pt}from"./ChevronRight-3jD7TdJZ.js";import{i as ze}from"./X-B1W1F4mo.js";import{a as Dt}from"./use-capability-BcwY0Lf1.js";import{A as kt}from"./access-gate-CVMVVI4n.js";import"./Check-D7HZW6oZ.js";import"./table-XS_vYE_1.js";import"./SwitchHorizontal01-Blia-yUi.js";import"./sidebar-DawbXHdj.js";import"./LayoutLeft-CY1OP6dH.js";import"./sheet-J3PJeFDK.js";import"./SearchMd-Cr6CluRw.js";import"./Container-Hfp9SJFa.js";import"./agent-icon-CCGqC-bl.js";import"./AlertCircle-DjOU_aot.js";import"./Tool01-DC4THSlP.js";import"./XCircle-BtUzMyFW.js";import"./ArrowUpRight-BXJMGk9i.js";import"./ZapSquare-BQX2HOTP.js";import"./Users03-DiilXFZ6.js";import"./CheckCircle-XS4dmEOs.js";import"./ChevronLeft-BEmN2X52.js";import"./ChevronUp-Dbc77Gwp.js";import"./Eye-BIZqMr-y.js";import"./ZoomOut-DC46Ewts.js";import"./Globe01-CiCGKTg3.js";import"./FilterLines-iroXgkwP.js";import"./Star01-pwvCfpNJ.js";import"./Palette-BDd6wxPD.js";import"./HardDrive-B26C8dI3.js";import"./Stars02-vcxNwhIa.js";import"./Key01-DZeJDklU.js";import"./LinkExternal01-DwxMIV-o.js";import"./Monitor01-_FIjo4ge.js";import"./Sun-De2vWRC7.js";import"./Play-C933mY5z.js";import"./Settings02-DeH66RiM.js";import"./Shield01-0kTDalL_.js";import"./Stars01-Bw7_Rdwp.js";import"./Upload01-DruP7_KV.js";import"./User01-Bweqikx-.js";import"./Users01-N436STOJ.js";import"./XClose-r0gXvFlp.js";import"./Zap-Dvtyg5Ik.js";import"./auth-ClbRbdVv.js";import"./use-collections-CNY4Rigp.js";import"./card-ykuj7mlf.js";import"./capability-load-error-BfCjxOlU.js";const Le="basic-usage",Me=[{id:Le,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"]},{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_GET","ORGANIZATION_DOMAIN_SET","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_CLEAR"]},{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"],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"],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","REGISTRY_MONITOR_SCHEDULE_SET","REGISTRY_MONITOR_SCHEDULE_CANCEL"]},{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:"event-bus:use",label:"Use event bus",description:"Publish events and manage subscriptions",section:"Developer",tools:["EVENT_PUBLISH","EVENT_SUBSCRIBE","EVENT_UNSUBSCRIBE","EVENT_CANCEL","EVENT_ACK","EVENT_SUBSCRIPTION_LIST","EVENT_SYNC_SUBSCRIPTIONS"]},{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}];[...Me.find(t=>t.id===Le)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Me.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Me){if(e.id===Le)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=H.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 S;return e[17]!==f||e[18]!==o||e[19]!==m?(S=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=S):S=e[20],S}function Yt(t){return t.stopPropagation()}function $t(t){const e=H.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}=Se(),m=Ot({connectionId:jt,orgId:o.id,orgSlug:o.slug}),S=100,T=h.trim(),E=T?{operator:"or",conditions:[{field:["title"],operator:"contains",value:T},{field:["description"],operator:"contains",value:T}]}:void 0,N=!!n,C={...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:0,...N&&{include_virtual:!0}},v=JSON.stringify(C),{data:_,fetchNextPage:R,hasNextPage:p,isFetchingNextPage:O}=Rt({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:b,...N&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,q)=>Q+(q?.items?.length??0),0)},staleTime:3e4}),I=_?.pages.flatMap(b=>b?.items??[])??[],j=Ct(R,p??!1,O),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}),[L,z]=$.useState(G[0]?.id??null),y=L?G.find(b=>b.id===L)??null:null,{data:M,isFetching:Y}=Re({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",L??""),queryFn:async()=>L?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:L}})).structuredContent?.item??null:null,enabled:!!L,staleTime:3e4}),F=M?.tools??[],X=(b,D)=>t[b]?.includes(D)??!1,J=(b,D)=>{const Q=t[b]??[],q=Q.includes(D),W={...t};if(q){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===L?F:[];if(!D.length)return;const Q=t[b]??[],q=D.map(ee=>ee.name),W=Q.length>0&&q.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=q,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=L===b.id,Q=D?F.length:0,q=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:q,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),O&&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 Ne=["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 Ht(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)%Ne.length;return Ne[n]??Ne[0]}function qt(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(Ee,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Xt(t){const e=H.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 R=x.flatMap(es).flatMap(Wt);i(!1),r(R.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!_))}};let m;e[10]!==f?(m=v=>{const{section:_,capabilities:R}=v;return{section:_,capabilities:R.filter(p=>!f||p.label.toLowerCase().includes(f)||p.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const S=x.map(m).filter(Jt);let T;e[12]!==n||e[13]!==i||e[14]!==r?(T=()=>{i(!n),r([])},e[12]=n,e[13]=i,e[14]=r,e[15]=T):T=e[15];let E;e[16]!==n||e[17]!==c||e[18]!==T?(E=Ye(n,c,T),e[16]=n,e[17]=c,e[18]=T,e[19]=E):E=e[19];let N;e[20]!==n||e[21]!==i||e[22]!==r||e[23]!==c?(N=c?void 0:()=>{i(!n),r([])},e[20]=n,e[21]=i,e[22]=r,e[23]=c,e[24]=N):N=e[24];let C;e[25]!==E||e[26]!==N?(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:E,onClick:N})})}),e[25]=E,e[26]=N,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,S.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):S.map(v=>{const{section:_,capabilities:R}=v;return s.jsx(Ue,{title:_,children:s.jsx(Be,{children:R.map(p=>{const O=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(O,c,()=>o(p,O)),onClick:c?void 0:()=>o(p,O)},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=H.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,[S,T]=$.useState(m),E=m||S,N=T,[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 R=_;let p;if(e[4]!==R||e[5]!==d){let j;e[7]!==R?(j=u=>R(u.id),e[7]=R,e[8]=j):j=e[8],p=d.filter(j),e[4]=R,e[5]=d,e[6]=p}else p=e[6];const O=p.length;let I;if(e[9]!==h||e[10]!==g||e[11]!==n||e[12]!==O||e[13]!==E||e[14]!==r||e[15]!==R||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=()=>N(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]!==O||e[34]!==d.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[O,"/",d.length," enabled"]}),e[33]=O,e[34]=d.length,e[35]=B):B=e[35];let L;e[36]!==E?(L=E?s.jsx(Mt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=E,e[37]=L):L=e[37];let z;e[38]!==L||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,L]}),e[38]=L,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,E&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(M=>{const Y=R(M.id),F=()=>{if(!o){if(g){x(n,h,M.id);return}a(n,M.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:M.title})}),s.jsx("div",{onClick:as,children:o?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:Y,disabled:!0,onCheckedChange:rs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:Y,onCheckedChange:F})})]},M.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]=O,e[13]=E,e[14]=r,e[15]=R,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=H.c(33),{connection:n,selectedModels:l,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:g}=t,f=Lt(n.id);let a,x,o,m,S;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){S=Symbol.for("react.early_return_sentinel");e:{let N;e[16]!==n.label?(N=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=N):N=e[17];const C=f.filter(hs).map(N),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){S=null;break e}const R=new Map;for(const A of _){const k=ss(A.id,n.providerId),G=R.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),R.set(k,G)}const p=Array.from(R.entries()).map(fs).sort(us),O=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:O},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]=S}else a=e[11],x=e[12],o=e[13],m=e[14],S=e[15];if(S!==Symbol.for("react.early_return_sentinel"))return S;let T;e[26]!==a||e[27]!==x?(T=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=T):T=e[28];let E;return e[29]!==o||e[30]!==m||e[31]!==T?(E=s.jsxs("div",{className:o,children:[m,T]}),e[29]=o,e[30]=m,e[31]=T,e[32]=E):E=e[32],E}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=H.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,O)=>{const I=l[p]??[],j={...l};if(I.includes(O)){const u=I.filter(w=>w!==O);u.length===0?delete j[p]:j[p]=u}else j[p]=[...I,O];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,O,I)=>{i(!1),r({...l,[p]:O.filter(j=>j!==I)})},e[3]=l,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,S=!c&&"hover:bg-muted/50 cursor-pointer";let T;e[7]!==S?(T=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",S),e[7]=S,e[8]=T):T=e[8];let E;e[9]!==n||e[10]!==i||e[11]!==r||e[12]!==c?(E=()=>{if(c)return;const p=!n;i(p),p&&r({})},e[9]=n,e[10]=i,e[11]=r,e[12]=c,e[13]=E):E=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=N):N=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(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Te,{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]!==T||e[21]!==E||e[22]!==C?(v=s.jsxs("div",{className:T,onClick:E,children:[N,C]}),e[20]=T,e[21]=E,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 R;return e[32]!==_||e[33]!==v?(R=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,_]}),e[32]=_,e[33]=v,e[34]=R):R=e[34],R}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=H.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,S,T,E,N,C,v,_,R,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 M=c.toLowerCase();return y.user?.name?.toLowerCase().includes(M)||y.user?.email?.toLowerCase().includes(M)},e[20]=c,e[21]=B):B=e[21];const L=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],S=z,m=Qe,R=n,p=l,o=He,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{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],N="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],T="flex-1 overflow-auto",E=L.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:L.map(y=>{const M=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",!M||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:F||Y,onCheckedChange:()=>{!M||Y||a(X=>X.includes(y.id)?X.filter(J=>J!==y.id):[...X,y.id])},disabled:!M||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})]}),!M&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&M&&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]=S,e[12]=T,e[13]=E,e[14]=N,e[15]=C,e[16]=v,e[17]=_,e[18]=R,e[19]=p}else o=e[9],m=e[10],S=e[11],T=e[12],E=e[13],N=e[14],C=e[15],v=e[16],_=e[17],R=e[18],p=e[19];let O;e[29]!==T||e[30]!==E?(O=s.jsx("div",{className:T,children:E}),e[29]=T,e[30]=E,e[31]=O):O=e[31];let I;e[32]!==O||e[33]!==N||e[34]!==C?(I=s.jsxs("div",{className:N,children:[C,O]}),e[32]=O,e[33]=N,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]!==S||e[38]!==u||e[39]!==w?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:S,disabled:u,children:["Add ",w]})]}),e[37]=S,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]!==R||e[50]!==p?(G=s.jsx(m,{open:R,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=R,e[50]=p,e[51]=G):G=e[51],G}function Es(t){const e=H.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,S;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 R=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 O=R.filter(p);S="flex flex-col h-full",o="flex-1 overflow-auto",m=R.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."})]})}):O.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:O.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(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Te,{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]=S}else o=e[7],m=e[8],S=e[9];let T;e[14]!==o||e[15]!==m?(T=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=T):T=e[16];let E;e[17]!==n||e[18]!==l?(E=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=E):E=e[19];let N;e[20]!==h||e[21]!==n||e[22]!==c||e[23]!==E?(N=s.jsx(bs,{open:h,onOpenChange:c,selectedMemberIds:n,onAddMembers:E}),e[20]=h,e[21]=n,e[22]=c,e[23]=E,e[24]=N):N=e[24];let C;return e[25]!==S||e[26]!==T||e[27]!==N?(C=s.jsxs("div",{className:S,children:[T,N]}),e[25]=S,e[26]=T,e[27]=N,e[28]=C):C=e[28],C}function Ts(t){const e=H.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(Es,{...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 Ss(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 Ns(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"?Ss(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=H.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(Ee,{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(Te,{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 Rs(t){const e=H.c(14),{locator:n}=Se(),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}=Re(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(Os,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Os({target:t,onBack:e,onSaved:n,members:l,connections:i}){const{locator:r}=Se(),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,S=o.formState.isDirty,T=Fe({mutationFn:async u=>{const w=Ns(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 L=l.filter(M=>M.role===(B??U)).map(M=>M.id),z=u.memberIds.filter(M=>!L.includes(M)),y=L.filter(M=>!u.memberIds.includes(M));for(const M of z){const Y=await d.organization.updateMemberRole({memberId:M,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const M of y){const Y=await d.organization.updateMemberRole({memberId:M,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,L=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:w,...L?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(L?U:B,L?B:void 0),L?{...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 L=await d.organization.updateMemberRole({memberId:B,role:[A]});if(L?.error)throw new Error(L.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;Oe(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")}}),E=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}T.mutate(u)}),N=!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"}],[_,R]=$.useState(""),[p,O]=$.useState(!1),I=u=>{x(u),R("")},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:N&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:T.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:E,disabled:T.isPending||!m||!S,children:T.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"?qt(t.role):Ht(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:R,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>O(!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(Ts,{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:O})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=H.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 Ls={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ms(t,e){return e?Ls[t]??"bg-neutral-400":ws(t)}function Ps(){const t=H.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}=Se(),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 S;e:{if(!h){S=null;break e}if(h==="new"){S={kind:"new"};break e}if(h.startsWith("builtin-")){S={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);S=V?{kind:"custom",role:V}:null}const T=S;let E;t[5]!==c?(E=re.members(c),t[5]=c,t[6]=E):E=t[6];let N;t[7]!==g?(N=()=>g.organization.listMembers(),t[7]=g,t[8]=N):N=t[8];let C;t[9]!==E||t[10]!==N?(C={queryKey:E,queryFn:N},t[9]=E,t[10]=N,t[11]=C):C=t[11];const{data:v}=Re(C);let _;t[12]!==v?.data?.members?(_=v?.data?.members??[],t[12]=v?.data?.members,t[13]=_):_=t[13];const R=_;let p;t[14]!==R?(p=P=>R.filter(V=>V.role===P).length,t[14]=R,t[15]=p):p=t[15];const O=p;let I;if(t[16]!==a||t[17]!==O||t[18]!==e){let P;t[20]!==O?(P=ce=>({kind:"builtin",role:{...ce,memberCount:O(ce.role)}}),t[20]=O,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==O?(ae=ce=>({kind:"custom",role:{...ce,memberCount:O(ce.role)}}),t[22]=O,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]=O,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)=>{Oe("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),x(),T?.kind==="custom"&&T.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(bt,{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(It,{size:16})})}),s.jsx(Tt,{align:"end",onClick:Ds,children:s.jsxs(_t,{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 L;t[31]!==m?(L=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=L):L=t[32];const z=L;if(T){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(Rs,{target:T,onBack:P,onSaved:V},js(T))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let M;t[39]===Symbol.for("react.memo_cache_sentinel")?(M=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=M):M=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:M}),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(Nt,{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 q;t[61]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Ze,{children:"Delete Role"}),t[61]=q):q=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(qe,{children:[q,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(He,{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",Ms(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){Oe("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=H.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 fl(){const t=H.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{fl as default};
@@ -0,0 +1 @@
1
+ import{p as c}from"./header-tab-button-BOZYRinC.js";function t(r){return(e,a)=>{c(e),r(e,a)}}export{t as c};
@@ -1 +1 @@
1
- import{e as m,j as s,l as o}from"./index-DnIoj8fl.js";import{i as c}from"./AlertCircle-DkwUf9y1.js";import{i as l}from"./Check-C_31_MJb.js";function u(i){const e=m.c(3),{isPending:a,isError:n}=i;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 r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=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]=r):r=e[2],r}export{u as S};
1
+ import{e as m,j as s,l as o}from"./index-uVHAmIsb.js";import{i as c}from"./AlertCircle-DjOU_aot.js";import{i as l}from"./Check-D7HZW6oZ.js";function u(i){const e=m.c(3),{isPending:a,isError:n}=i;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 r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=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]=r):r=e[2],r}export{u as S};
@@ -1 +1 @@
1
- import{e as z,j as i,r as Q,B as ue,c as De,n as ge}from"./index-DnIoj8fl.js";import{aa as et,v as tt,aq as we,H as Se}from"./agent-icon-C4vLfyZT.js";import{C as nt}from"./calendar-0t1uXfLL.js";import{I as re}from"./input-kFc4cqln.js";import{L as q}from"./label-Bvw0Ied9.js";import{a as rt,b as st,P as it}from"./popover-DFBV-kft.js";import{T as lt}from"./textarea-BuPx5SDQ.js";import{S as ot}from"./switch-9AraHuPG.js";import{c as Le,S as Ee,a as Pe,b as Ve,d as Me}from"./select-B_xVBVbm.js";import{d as at}from"./ZoomOut-C-DjvL5K.js";import{s as ct}from"./Plus-CW5uSNYz.js";import{s as ze}from"./Trash01-D5mmvxxB.js";import{D as ut,a as ft,b as dt,c as pt}from"./dropdown-menu-DOlfrN75.js";import{e as Ue,u as mt,L as ht,F as yt,I as Ae}from"./image-field-CRg7FKDt.js";import{l as Ke,i as fe,a as me,S as gt,P as xt,X as be,Y as de,Z as Ce,n as vt,_ as bt,$ as jt,a0 as Nt,a1 as Tt}from"./index-o7c8QKYO.js";import{t as He}from"./ChevronDown-ciuU2nWp.js";import{i as We}from"./ChevronRight-CFv-fKpX.js";import{i as kt}from"./Globe01-BOlA5Q_4.js";import{T as _t,b as wt,a as St}from"./tooltip-DG-C65pd.js";import{i as At}from"./Upload01-CYVliRf6.js";import{c as Ct}from"./use-file-configs-CiOc-9XG.js";function It(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function Ot(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(l=>l.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const r=e.find(l=>typeof l.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 Ye(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Ye);const e=t;return e.__resolveType?Ot(e)??t:Ge(e)}function Ge(t){const e={};for(const[n,r]of Object.entries(t))e[n]=Ye(r);return e}function Rt(t,e){return e.split(".").reduce((n,r)=>{if(!(n==null||typeof n!="object"))return n[r]},t)}function Xe(t){return t==null?"":Array.isArray(t)?t.map(Xe).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function je(t,e){if(!t.includes("{"))return;const n=Ge(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(l,s,o)=>{const c=(s??o??"").trim();return Xe(Rt(n,c))}).trim()||void 0}function $t(t,e){if(e.includes("{"))return je(e,t);const n=t[e];if(typeof n=="string"&&n)return n;if(Array.isArray(n)){const r=n.map(l=>l==null?"":String(l)).filter(Boolean).join(",");if(r)return r}}function se(t,e,n){if(typeof t=="string")return t||`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){const r=t;if(n?.titleBy){const s=$t(r,n.titleBy);if(s)return s}for(const s of["name","label","title","alt","text","href","id"]){const o=r[s];if(typeof o=="string"&&o)return o;if(Array.isArray(o)){const c=o.map(a=>a==null?"":String(a)).filter(Boolean).join(",");if(c)return c}}const l=r.__resolveType;if(typeof l=="string"&&l)return Ke(l);if(n?.title){const s=je(n.title,r);if(s)return s;if(!n.title.includes("{"))return n.title}}return`Item ${e+1}`}function Ft(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 Bt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const n=Ft(e);if(!n)return;const r=je(n,t);if(!r)return;const l=Ue(r)||r;return It(l)}function Ze(t){return t===gt||t===xt}function he(t,e){if(!Object.hasOwn(e,t))return null;const n=e[t]??{},r=n.__resolveType??t;return{data:{...n},resolveType:r}}function pe(t,e){const n=t.__resolveType??"";if(!n)return null;if(fe(n)){const r=t.section??{};return Qe(r,e)}if(Ze(n)){const r=t.variants?.[0]?.value;return r?pe(r,e):null}return!me(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:he(n,e)}function Qe(t,e){const n=t.__resolveType??"";if(!n)return null;if(Ze(n)){const r=t.variants?.[0]?.value;return r?pe(r,e):null}return!me(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:he(n,e)}function Dt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const r=t.__resolveType;if(typeof r!="string"||!me(r)||!Object.hasOwn(e,r))return null;const l=he(r,e);return l?{blockKey:r,...l}:null}function Gn(t,e,n){if(e.isMultivariate)return null;if(e.isSavedBlock){const r=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return he(r,n)}if(e.isHidden){const s=(fe(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return pe(s,n)}if(e.isLazy||fe(t.__resolveType)){const r=t.section??{};return Qe(r,n)}return pe(t,n)}const ee=t=>String(t).padStart(2,"0"),Lt="1900-01-01",Et="2099-12-31",Pt="1900-01-01T00:00",Vt="2099-12-31T23:59";function Mt(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()}-${ee(n.getUTCMonth()+1)}-${ee(n.getUTCDate())}`}function zt(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function Ut(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${ee(e.getMonth()+1)}-${ee(e.getDate())}T${ee(e.getHours())}:${ee(e.getMinutes())}`}function Kt(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function Ht(t){const e=z.c(29),{id:n,withTime:r,value:l,onChange:s}=t,[o,c]=Q.useState(!1);let a;e[0]!==l||e[1]!==r?(a=r?Ut(l):Mt(l),e[0]=l,e[1]=r,e[2]=a):a=e[2];const d=a;let y;e[3]!==s||e[4]!==r?(y=k=>{s(r?Kt(k.target.value):zt(k.target.value))},e[3]=s,e[4]=r,e[5]=y):y=e[5];const m=y;let f;if(e[6]!==l){const k=l?new Date(l):null;f=k&&!Number.isNaN(k.getTime())?k:null,e[6]=l,e[7]=f}else f=e[7];const p=f;let h;e[8]!==s||e[9]!==p||e[10]!==r?(h=k=>{k&&(r&&p?k.setHours(p.getHours(),p.getMinutes(),0,0):k.setHours(0,0,0,0),s(k.toISOString()),c(!1))},e[8]=s,e[9]=p,e[10]=r,e[11]=h):h=e[11];const u=h,g=r?"datetime-local":"date",x=r?Pt:Lt,v=r?Vt:Et;let b;e[12]!==m||e[13]!==n||e[14]!==d||e[15]!==g||e[16]!==x||e[17]!==v?(b=i.jsx(re,{id:n,type:g,min:x,max:v,value:d,onChange:m,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[12]=m,e[13]=n,e[14]=d,e[15]=g,e[16]=x,e[17]=v,e[18]=b):b=e[18];let A;e[19]===Symbol.for("react.memo_cache_sentinel")?(A=i.jsx(rt,{asChild:!0,children:i.jsx(ue,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":"Open calendar",children:i.jsx(et,{className:"h-4 w-4"})})}),e[19]=A):A=e[19];const j=p??void 0;let N;e[20]!==u||e[21]!==j?(N=i.jsx(st,{className:"w-auto p-0",align:"end",children:i.jsx(nt,{mode:"single",selected:j,onSelect:u,initialFocus:!0})}),e[20]=u,e[21]=j,e[22]=N):N=e[22];let T;e[23]!==o||e[24]!==N?(T=i.jsxs(it,{open:o,onOpenChange:c,children:[A,N]}),e[23]=o,e[24]=N,e[25]=T):T=e[25];let R;return e[26]!==T||e[27]!==b?(R=i.jsxs("div",{className:"flex gap-1",children:[b,T]}),e[26]=T,e[27]=b,e[28]=R):R=e[28],R}function ae(t){const e=z.c(8),{htmlFor:n,label:r,description:l}=t;let s;e[0]!==n||e[1]!==r?(s=i.jsx(q,{htmlFor:n,children:r}),e[0]=n,e[1]=r,e[2]=s):s=e[2];let o;e[3]!==l?(o=l&&i.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:l}),e[3]=l,e[4]=o):o=e[4];let c;return e[5]!==s||e[6]!==o?(c=i.jsxs("div",{className:"space-y-0.5",children:[s,o]}),e[5]=s,e[6]=o,e[7]=c):c=e[7],c}function ce(t){const e=z.c(61),{schema:n,value:r,onChange:l,path:s,label:o}=t,c=typeof r=="string"?r:"",a=n.format;if(a==="textarea"||a==="rich-text"||a==="rich-text-inline"||a==="markdown"){let u;e[0]!==o||e[1]!==s||e[2]!==n.description?(u=i.jsx(ae,{htmlFor:s,label:o,description:n.description}),e[0]=o,e[1]=s,e[2]=n.description,e[3]=u):u=e[3];let g;e[4]!==l?(g=b=>l(b.target.value),e[4]=l,e[5]=g):g=e[5];let x;e[6]!==s||e[7]!==c||e[8]!==g?(x=i.jsx(lt,{id:s,value:c,onChange:g,rows:4}),e[6]=s,e[7]=c,e[8]=g,e[9]=x):x=e[9];let v;return e[10]!==u||e[11]!==x?(v=i.jsxs("div",{className:"space-y-2",children:[u,x]}),e[10]=u,e[11]=x,e[12]=v):v=e[12],v}if(a==="date"||a==="date-time"){let u;e[13]!==o||e[14]!==s||e[15]!==n.description?(u=i.jsx(ae,{htmlFor:s,label:o,description:n.description}),e[13]=o,e[14]=s,e[15]=n.description,e[16]=u):u=e[16];const g=a==="date-time";let x;e[17]!==l||e[18]!==s||e[19]!==c||e[20]!==g?(x=i.jsx(Ht,{id:s,withTime:g,value:c,onChange:l}),e[17]=l,e[18]=s,e[19]=c,e[20]=g,e[21]=x):x=e[21];let v;return e[22]!==u||e[23]!==x?(v=i.jsxs("div",{className:"space-y-2",children:[u,x]}),e[22]=u,e[23]=x,e[24]=v):v=e[24],v}if(a==="color-input"){let u;e[25]!==o||e[26]!==s||e[27]!==n.description?(u=i.jsx(ae,{htmlFor:s,label:o,description:n.description}),e[25]=o,e[26]=s,e[27]=n.description,e[28]=u):u=e[28];const g=c||"#000000";let x;e[29]!==l?(x=T=>l(T.target.value),e[29]=l,e[30]=x):x=e[30];let v;e[31]!==g||e[32]!==x?(v=i.jsx("input",{type:"color",value:g,onChange:x,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[31]=g,e[32]=x,e[33]=v):v=e[33];let b;e[34]!==l?(b=T=>l(T.target.value),e[34]=l,e[35]=b):b=e[35];let A;e[36]!==s||e[37]!==c||e[38]!==b?(A=i.jsx(re,{id:s,value:c,onChange:b,placeholder:"#000000",className:"h-10 flex-1"}),e[36]=s,e[37]=c,e[38]=b,e[39]=A):A=e[39];let j;e[40]!==v||e[41]!==A?(j=i.jsxs("div",{className:"flex items-center gap-2",children:[v,A]}),e[40]=v,e[41]=A,e[42]=j):j=e[42];let N;return e[43]!==u||e[44]!==j?(N=i.jsxs("div",{className:"space-y-2",children:[u,j]}),e[43]=u,e[44]=j,e[45]=N):N=e[45],N}let d;e[46]!==o||e[47]!==s||e[48]!==n.description?(d=i.jsx(ae,{htmlFor:s,label:o,description:n.description}),e[46]=o,e[47]=s,e[48]=n.description,e[49]=d):d=e[49];const y=a==="url"?"url":"text";let m;e[50]!==l?(m=u=>l(u.target.value),e[50]=l,e[51]=m):m=e[51];const f=n.default!=null?String(n.default):void 0;let p;e[52]!==s||e[53]!==c||e[54]!==y||e[55]!==m||e[56]!==f?(p=i.jsx(re,{id:s,type:y,value:c,onChange:m,placeholder:f,className:"h-10"}),e[52]=s,e[53]=c,e[54]=y,e[55]=m,e[56]=f,e[57]=p):p=e[57];let h;return e[58]!==d||e[59]!==p?(h=i.jsxs("div",{className:"space-y-2",children:[d,p]}),e[58]=d,e[59]=p,e[60]=h):h=e[60],h}function Wt(t){const e=z.c(17),{schema:n,value:r,onChange:l,path:s,label:o}=t,c=typeof r=="number"?r:"";let a;e[0]!==o||e[1]!==s?(a=i.jsx(q,{htmlFor:s,children:o}),e[0]=o,e[1]=s,e[2]=a):a=e[2];let d;e[3]!==n.description?(d=n.description&&i.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=d):d=e[4];let y;e[5]!==a||e[6]!==d?(y=i.jsxs("div",{className:"space-y-0.5",children:[a,d]}),e[5]=a,e[6]=d,e[7]=y):y=e[7];let m;e[8]!==l?(m=h=>{const u=h.target.value;l(u===""?void 0:Number(u))},e[8]=l,e[9]=m):m=e[9];let f;e[10]!==c||e[11]!==s||e[12]!==m?(f=i.jsx(re,{id:s,type:"number",value:c,onChange:m,className:"h-10"}),e[10]=c,e[11]=s,e[12]=m,e[13]=f):f=e[13];let p;return e[14]!==y||e[15]!==f?(p=i.jsxs("div",{className:"space-y-2",children:[y,f]}),e[14]=y,e[15]=f,e[16]=p):p=e[16],p}function Yt(t){const e=z.c(17),{value:n,onChange:r,path:l,label:s,schema:o}=t,c=typeof n=="boolean"?n:!1;let a;e[0]!==s||e[1]!==l?(a=i.jsx(q,{htmlFor:l,children:s}),e[0]=s,e[1]=l,e[2]=a):a=e[2];let d;e[3]!==o.description?(d=o.description&&i.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:o.description}),e[3]=o.description,e[4]=d):d=e[4];let y;e[5]!==a||e[6]!==d?(y=i.jsxs("div",{className:"space-y-0.5",children:[a,d]}),e[5]=a,e[6]=d,e[7]=y):y=e[7];let m;e[8]!==r?(m=h=>r(h),e[8]=r,e[9]=m):m=e[9];let f;e[10]!==c||e[11]!==l||e[12]!==m?(f=i.jsx(ot,{id:l,checked:c,onCheckedChange:m}),e[10]=c,e[11]=l,e[12]=m,e[13]=f):f=e[13];let p;return e[14]!==y||e[15]!==f?(p=i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[y,f]}),e[14]=y,e[15]=f,e[16]=p):p=e[16],p}const Ne="__enum_empty__";function Te(t){return t===""?Ne:String(t)}function Gt(t,e){if(t===Ne)return"";const n=e.find(r=>Te(r)===t);return n!==void 0?n:t}function Xt(t,e){return t==null?e.some(n=>n==="")?Ne:void 0:Te(t)}function Zt(t){return t===""?"":String(t)}function Qt(t){const e=z.c(28),{schema:n,value:r,onChange:l,path:s,label:o}=t;let c;e[0]!==n.enum?(c=n.enum??[],e[0]=n.enum,e[1]=c):c=e[1];const a=c;let d;e[2]!==a||e[3]!==r?(d=Xt(r,a),e[2]=a,e[3]=r,e[4]=d):d=e[4];const y=d;let m;e[5]!==o||e[6]!==s?(m=i.jsx(q,{htmlFor:s,children:o}),e[5]=o,e[6]=s,e[7]=m):m=e[7];let f;e[8]!==n.description?(f=n.description&&i.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=f):f=e[9];let p;e[10]!==m||e[11]!==f?(p=i.jsxs("div",{className:"space-y-0.5",children:[m,f]}),e[10]=m,e[11]=f,e[12]=p):p=e[12];let h;e[13]!==l||e[14]!==a?(h=A=>l(Gt(A,a)),e[13]=l,e[14]=a,e[15]=h):h=e[15];let u;e[16]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(Ee,{className:"h-10",children:i.jsx(Pe,{placeholder:"Select..."})}),e[16]=u):u=e[16];let g;e[17]!==a?(g=a.map(qt),e[17]=a,e[18]=g):g=e[18];let x;e[19]!==g?(x=i.jsx(Ve,{children:g}),e[19]=g,e[20]=x):x=e[20];let v;e[21]!==y||e[22]!==h||e[23]!==x?(v=i.jsxs(Me,{value:y,onValueChange:h,children:[u,x]}),e[21]=y,e[22]=h,e[23]=x,e[24]=v):v=e[24];let b;return e[25]!==v||e[26]!==p?(b=i.jsxs("div",{className:"space-y-2",children:[p,v]}),e[25]=v,e[26]=p,e[27]=b):b=e[27],b}function qt(t){const e=Te(t);return i.jsx(Le,{value:e,children:Zt(t)},e)}function Jt(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function ve(t,e){return e.title??Jt(t)}function Ie(t){return t.type==="array"&&t.items?!0:be(t)}function en(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function ie(t,e,n,r){if(r.length===0)return null;const l=r[0];for(const s of t){const o=e[s];if(!o||!Ie(o))continue;const c=ve(s,o);if(l===c||l===s)return s}for(const s of t){const o=e[s];if(!o||!Ie(o))continue;const c=n[s];if(!Array.isArray(c))continue;const a=o.items;for(let d=0;d<c.length;d++)if(se(c[d],d,a)===l)return s}for(const s of t){const o=e[s];if(o?.type!=="object"||!o.properties)continue;const c=Object.keys(o.properties),a=en(n[s]),d=ve(s,o);if(ie(c,o.properties,a,r)||(l===d||l===s)&&ie(c,o.properties,a,r.slice(1)))return s}return null}function tn(t,e,n,r){return ie(t,e,n,r)}function nn(t,e,n,r,l){if(l.length===0||!n.properties)return!1;const s=Object.keys(n.properties);if(ie(s,n.properties,r,l))return!0;const o=l[0];return o!==e&&o!==t?!1:l.length>1||ie(s,n.properties,r,l.slice(1))!==null}function rn(t,e,n,r){if(e.length===0)return null;for(let s=0;s<e.length;s++){const o=e[s],c=n.findIndex((a,d)=>se(a,d,r)===o);if(c>=0)return{index:c,innerPath:e.slice(s+1)}}const l=e.indexOf(t);if(l>=0&&e.length>l+1){const s=e[l+1],o=n.findIndex((c,a)=>se(c,a,r)===s);if(o>=0)return{index:o,innerPath:e.slice(l+2)}}return null}function xe(t){const e=z.c(47),{schema:n,value:r,onChange:l,path:s,label:o,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:y,onSaveReferencedBlock:m}=t;let f,p,h,u,g,x,v;if(e[0]!==y||e[1]!==o||e[2]!==d||e[3]!==a||e[4]!==l||e[5]!==m||e[6]!==s||e[7]!==n.items||e[8]!==c||e[9]!==r){v=Symbol.for("react.early_return_sentinel");e:{const _=c===void 0?[]:c;u=Array.isArray(r)?r:[],h=n.items;const C=rn(o,_,u,h),S=C?.index??null;let V;e[17]!==h?(V=(w,F)=>se(w,F,h),e[17]=h,e[18]=V):V=e[18],p=V,g=w=>{const F=p(u[w],w);a?.([..._,F])},f=()=>{const w=h?.type,F=h?.default!==void 0?h.default:w==="object"?{}:w==="block-ref"?(()=>{const E=h?.anyOfRefs?.[0]?.resolveType;return typeof E!="string"||de(E)?{}:{__resolveType:E}})():w==="number"||w==="integer"?0:w==="boolean"?!1:w==="array"?[]:"",I=[...u,F];l(I);const P=I.length-1,O=se(F,P,h);a?.([..._,O])},x=w=>{if(l(u.filter((F,I)=>I!==w)),S===w){const F=p(u[w],w),I=_.indexOf(F);a?.(I>=0?_.slice(0,I):[])}};const U=(w,F)=>{const I=[...u];if(I[w]=F,l(I),S===w){const P=p(u[w],w),O=p(F,w),E=_.indexOf(P);if(E>=0){const K=[..._];K[E]=O,a?.(K);return}a?.([..._,O])}};if(S!==null&&S<u.length){const w=u[S],F=()=>{const O=p(w,S),E=_.indexOf(O);return E>=0?_.slice(0,E+1):[..._,O]},I=h?.type==="object"&&h.properties?i.jsx(_e,{schema:h,value:w,onChange:O=>U(S,O),basePath:`${s}.${S}`,breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:O=>{a?.([...F(),...O])},meta:d,decofile:y,onSaveReferencedBlock:m}):h?qe({schema:h,value:w,onChange:O=>U(S,O),path:`${s}.${S}`,label:h.title??`Item ${S+1}`,breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:O=>{a?.([...F(),...O])},meta:d,decofile:y,onSaveReferencedBlock:m}):null;let P;e[19]!==I?(P=i.jsx("div",{className:"min-w-0",children:I}),e[19]=I,e[20]=P):P=e[20],v=P;break e}}e[0]=y,e[1]=o,e[2]=d,e[3]=a,e[4]=l,e[5]=m,e[6]=s,e[7]=n.items,e[8]=c,e[9]=r,e[10]=f,e[11]=p,e[12]=h,e[13]=u,e[14]=g,e[15]=x,e[16]=v}else f=e[10],p=e[11],h=e[12],u=e[13],g=e[14],x=e[15],v=e[16];if(v!==Symbol.for("react.early_return_sentinel"))return v;let b;e[21]!==o?(b=i.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[21]=o,e[22]=b):b=e[22];let A;e[23]!==u.length?(A=u.length>0&&i.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:u.length}),e[23]=u.length,e[24]=A):A=e[24];let j;e[25]!==b||e[26]!==A?(j=i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[b,A]}),e[25]=b,e[26]=A,e[27]=j):j=e[27];let N;e[28]!==n.description?(N=n.description&&i.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:n.description}),e[28]=n.description,e[29]=N):N=e[29];let T;e[30]!==j||e[31]!==N?(T=i.jsxs("div",{className:"min-w-0 space-y-0.5",children:[j,N]}),e[30]=j,e[31]=N,e[32]=T):T=e[32];let R;e[33]!==p||e[34]!==h||e[35]!==u||e[36]!==g||e[37]!==s||e[38]!==x?(R=u.length>0&&i.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:u.map((_,C)=>{const S=p(_,C),V=Bt(_,h);return i.jsxs("div",{className:"group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground",children:[i.jsx(at,{className:"size-3.5 shrink-0 cursor-grab text-muted-foreground/40"}),i.jsxs("button",{type:"button",onClick:()=>g(C),className:"flex min-w-0 flex-1 items-center gap-2.5 text-left text-sm",title:S,children:[V&&i.jsx("img",{src:V,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),i.jsx("span",{className:"min-w-0 truncate",children:S})]}),i.jsxs(ut,{children:[i.jsx(ft,{asChild:!0,children:i.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":`Open actions for ${S}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:sn,children:i.jsx(tt,{size:14})})}),i.jsx(dt,{align:"end",children:i.jsxs(pt,{className:"text-destructive focus:text-destructive",onClick:()=>x(C),children:[i.jsx(ze,{size:14}),"Delete"]})})]})]},`${s}.${C}`)})}),e[33]=p,e[34]=h,e[35]=u,e[36]=g,e[37]=s,e[38]=x,e[39]=R):R=e[39];let k;e[40]===Symbol.for("react.memo_cache_sentinel")?(k=i.jsx(ct,{size:14}),e[40]=k):k=e[40];let L;e[41]!==f?(L=i.jsxs("button",{type:"button",onClick:f,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:[k,"Add item"]}),e[41]=f,e[42]=L):L=e[42];let $;return e[43]!==L||e[44]!==T||e[45]!==R?($=i.jsxs("div",{className:"space-y-2",children:[T,R,L]}),e[43]=L,e[44]=T,e[45]=R,e[46]=$):$=e[46],$}function sn(t){return t.stopPropagation()}function ln(t){const e=z.c(40),{schema:n,value:r,onChange:l,path:s,label:o,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:y,onSaveReferencedBlock:m}=t;let f;e[0]!==c?(f=c===void 0?[]:c,e[0]=c,e[1]=f):f=e[1];const p=f,[h,u]=Q.useState(!1);let g;e[2]!==r?(g=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},e[2]=r,e[3]=g):g=e[3];const x=g;if(!n.properties)return null;let v;e[4]!==s?(v=s.split(".").pop()??s,e[4]=s,e[5]=v):v=e[5];const b=v;let A;e[6]!==p||e[7]!==b||e[8]!==o||e[9]!==x||e[10]!==n?(A=nn(b,o,n,x,p),e[6]=p,e[7]=b,e[8]=o,e[9]=x,e[10]=n,e[11]=A):A=e[11];const N=h||A,T=`${s}-fields`;let R;e[12]===Symbol.for("react.memo_cache_sentinel")?(R=()=>u(on),e[12]=R):R=e[12];let k;e[13]!==N?(k=i.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:N?i.jsx(He,{size:16}):i.jsx(We,{size:16})}),e[13]=N,e[14]=k):k=e[14];let L;e[15]!==o?(L=i.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[15]=o,e[16]=L):L=e[16];let $;e[17]!==T||e[18]!==N||e[19]!==k||e[20]!==L?($=i.jsxs("button",{type:"button","aria-expanded":N,"aria-controls":T,onClick:R,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[k,L]}),e[17]=T,e[18]=N,e[19]=k,e[20]=L,e[21]=$):$=e[21];let _;e[22]!==n.description?(_=n.description&&i.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:n.description}),e[22]=n.description,e[23]=_):_=e[23];let C;e[24]!==p||e[25]!==T||e[26]!==y||e[27]!==N||e[28]!==d||e[29]!==x||e[30]!==a||e[31]!==l||e[32]!==m||e[33]!==s||e[34]!==n?(C=N&&i.jsx("div",{id:T,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:i.jsx(_e,{schema:n,value:x,onChange:l,basePath:s,breadcrumbPath:p,onBreadcrumbChange:a,meta:d,decofile:y,onSaveReferencedBlock:m})}),e[24]=p,e[25]=T,e[26]=y,e[27]=N,e[28]=d,e[29]=x,e[30]=a,e[31]=l,e[32]=m,e[33]=s,e[34]=n,e[35]=C):C=e[35];let S;return e[36]!==_||e[37]!==C||e[38]!==$?(S=i.jsxs("div",{className:"min-w-0 space-y-2",children:[$,_,C]}),e[36]=_,e[37]=C,e[38]=$,e[39]=S):S=e[39],S}function on(t){return!t}function ke(t){const e=t.__resolveType;if(typeof e!="string")return null;if(fe(e)){const r=t.section?.__resolveType;return typeof r=="string"?r:e}return e}function an(t){return t.includes("flags/multivariate")}function cn(t){return Ke(t)}function un(t,e){const n=[...t],r=new Set(n.map(s=>s.resolveType)),l=(s,o)=>{!s||r.has(s)||(r.add(s),n.push({resolveType:s,title:o??cn(s)}))};if(e.savedBlockKey&&l(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const s=ke(e.editorValue);s?.includes("/")&&l(s)}return n}function fn(t,e,n){const r=e[0]?.resolveType??"";if(n)return n;if(!t||typeof t!="object"||Array.isArray(t))return r;const l=t,s=l.__resolveType;if(typeof s=="string"){if(me(s)){const m=e.find(f=>f.resolveType===s);return m?m.resolveType:s}const d=e.find(m=>Ce(m.resolveType,s));if(d)return d.resolveType;const y=e.find(m=>m.resolveType===s);if(y)return y.resolveType;if(s.includes("/"))return s}const o=typeof l.type=="string"?l.type:void 0;if(o){const d=e.find(y=>y.discriminatorValue===o||y.resolveType===o||Ce(y.resolveType,o));if(d)return d.resolveType}let c=r,a=-1;for(const d of e){if(!d.schema?.properties)continue;const m=Object.keys(d.schema.properties).filter(f=>!f.startsWith("__")&&f!=="@type"&&f!=="action"&&f!=="alt").filter(f=>l[f]!==void 0).length;m>0&&m>a&&(a=m,c=d.resolveType)}return a>0,c}function Oe(t,e,n){if(!t||typeof t!="object"||Array.isArray(t))return n??null;const r=ke(t);if(!r)return n??null;if(!e)return r.includes("/")?null:n??null;const l=vt(r,e);return l||(r.includes("/")?null:n??null)}function dn(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 pn(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const n=t,r=ke(n);return r&&an(r)?Array.isArray(n.variants)&&n.variants.length>0:Object.keys(n).some(l=>!l.startsWith("__")&&l!=="@type")}function mn(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 hn(t){const e=z.c(3),{blockKey:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(_t,{asChild:!0,children:i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[i.jsx(kt,{size:11}),"Global"]})}),e[0]=r):r=e[0];let l;return e[1]!==n?(l=i.jsxs(wt,{children:[r,i.jsxs(St,{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]=l):l=e[2],l}function yn(t){const e=z.c(28),{path:n,open:r,onOpenChange:l,title:s,nested:o,nestedBlockRef:c,globalBlockKey:a}=t,d=`${n}-loader-config`,y=c&&"ml-1";let m;e[0]!==y?(m=De("rounded-lg border border-border/80 bg-muted/30",y),e[0]=y,e[1]=m):m=e[1];let f;e[2]!==l||e[3]!==r?(f=()=>l(!r),e[2]=l,e[3]=r,e[4]=f):f=e[4];let p;e[5]!==r?(p=i.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:r?i.jsx(He,{size:16}):i.jsx(We,{size:16})}),e[5]=r,e[6]=p):p=e[6];let h;e[7]!==s?(h=i.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:s}),e[7]=s,e[8]=h):h=e[8];let u;e[9]!==a?(u=a&&i.jsx(hn,{blockKey:a}),e[9]=a,e[10]=u):u=e[10];let g;e[11]!==h||e[12]!==u?(g=i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[h,u]}),e[11]=h,e[12]=u,e[13]=g):g=e[13];let x;e[14]!==d||e[15]!==r||e[16]!==f||e[17]!==p||e[18]!==g?(x=i.jsxs("button",{type:"button","aria-expanded":r,"aria-controls":d,onClick:f,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,g]}),e[14]=d,e[15]=r,e[16]=f,e[17]=p,e[18]=g,e[19]=x):x=e[19];let v;e[20]!==d||e[21]!==o||e[22]!==r?(v=r&&i.jsx("div",{id:d,className:"border-t border-border/60 px-4 pb-4 pt-3",children:i.jsx("div",{className:"border-l border-border/80 pl-4",children:o})}),e[20]=d,e[21]=o,e[22]=r,e[23]=v):v=e[23];let b;return e[24]!==m||e[25]!==x||e[26]!==v?(b=i.jsxs("div",{className:m,children:[x,v]}),e[24]=m,e[25]=x,e[26]=v,e[27]=b):b=e[27],b}function Re(t){const e=z.c(30),{schema:n,value:r,onChange:l,path:s,label:o,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:y,onSaveReferencedBlock:m}=t,f=(n.anyOfRefs??[]).filter(vn),p=y&&r?Dt(r,y):null,h=p?.data??r,u=un(f,{savedBlockKey:p?.blockKey,editorValue:h}),g=u.length>0?fn(h,u,p?.blockKey):u[0]?.resolveType??"",[x,v]=Q.useState(g),[b,A]=Q.useState(g);b!==g&&(A(g),v(g));const[j,N]=Q.useState(()=>pn(h,p?.blockKey));if(u.length>0){const S=x||g;let V;e[0]!==S?(V=B=>B.resolveType===S,e[0]=S,e[1]=V):V=e[1];const U=u.find(V),w=Oe(h,d,U?.schema),F=dn(w??U?.schema??null,n.discriminatorKey),I=n.discriminatorKey,P=B=>{v(B);const D=u.find(ne=>ne.resolveType===B),M=Oe(h,d,D?.schema),J=new Set(Object.keys((M??D?.schema)?.properties??{})),te=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:{},oe=Object.fromEntries(Object.entries(te).filter(ne=>{const[Je]=ne;return J.has(Je)})),ye={...mn(D?.schema),...oe};if(I){const ne=D?.discriminatorValue??B;l({...ye,[I]:ne});return}if(de(B)){l(ye);return}l({...ye,__resolveType:B})};let O;e[2]!==S||e[3]!==I||e[4]!==l?(O=B=>{if(I||!de(S)||B===null||typeof B!="object"||Array.isArray(B)){l(B);return}const{__resolveType:D,...M}=B;l(M)},e[2]=S,e[3]=I,e[4]=l,e[5]=O):O=e[5];const E=O,K=F?.properties?i.jsx(_e,{schema:F,value:h,onChange:B=>{if(p&&m){m(p.blockKey,B);return}E(B)},basePath:s,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:y,onSaveReferencedBlock:m}):null,Z=n.type==="block-ref"&&u.some(xn);let H;e[6]!==s?(H=s.includes("."),e[6]=s,e[7]=H):H=e[7];const G=H;let W;e[8]!==o||e[9]!==s?(W=i.jsx(q,{htmlFor:s,children:o}),e[8]=o,e[9]=s,e[10]=W):W=e[10];let Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=i.jsx(Ee,{children:i.jsx(Pe,{placeholder:"Select..."})}),e[11]=Y):Y=e[11];let X;return e[12]!==n.description?(X=n.description&&i.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[12]=n.description,e[13]=X):X=e[13],i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"space-y-1.5",children:[W,i.jsxs(Me,{value:S||void 0,onValueChange:P,children:[Y,i.jsx(Ve,{children:u.map(gn)})]}),X]}),K&&(Z?i.jsx(yn,{path:s,open:j,onOpenChange:N,title:G?"Configuration":"Loader configuration",nested:K,nestedBlockRef:G,globalBlockKey:p?.blockKey}):K)]})}if(n.anyOfRefs&&n.anyOfRefs.length>0)return null;let T;e[14]!==o||e[15]!==s?(T=i.jsx(q,{htmlFor:s,children:o}),e[14]=o,e[15]=s,e[16]=T):T=e[16];const R=r!=null?String(r):"";let k;e[17]!==l?(k=S=>l(S.target.value),e[17]=l,e[18]=k):k=e[18];const L=n.description??"";let $;e[19]!==s||e[20]!==R||e[21]!==k||e[22]!==L?($=i.jsx("input",{id:s,type:"text",value:R,onChange:k,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:L}),e[19]=s,e[20]=R,e[21]=k,e[22]=L,e[23]=$):$=e[23];let _;e[24]!==n.description?(_=n.description&&i.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[24]=n.description,e[25]=_):_=e[25];let C;return e[26]!==T||e[27]!==$||e[28]!==_?(C=i.jsxs("div",{className:"space-y-1.5",children:[T,$,_]}),e[26]=T,e[27]=$,e[28]=_,e[29]=C):C=e[29],C}function gn(t){return i.jsx(Le,{value:t.resolveType,children:t.title??bt(t.resolveType)??t.resolveType},t.resolveType)}function xn(t){return t.resolveType.includes("/")&&!de(t.resolveType)}function vn(t){return t.resolveType!==""}function $e(t){const e=z.c(2),{ext:n}=t;if(!n)return null;let r;return e[0]!==n?(r=i.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 bn(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function jn(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function Fe(t){const e=z.c(72),{schema:n,value:r,onChange:l,path:s,label:o}=t,c=n.format==="video-uri",a=Ue(r),[d,y]=Q.useState(!1),[m,f]=Q.useState(!1),p=a?bn(a):"",h=p?jn(p):"",u=Ct(),g=mt();let x;e[0]!==u.data?.configs?(x=function(){const D=u.data?.configs??[];if(D.length===1)return D[0].id;if(D.length===0)return null;const M=typeof window<"u"?window.localStorage.getItem(ht):null;return D.some(J=>J.id===M)?M:null},e[0]=u.data?.configs,e[1]=x):x=e[1];const v=x;let b;e[2]!==c||e[3]!==l||e[4]!==v||e[5]!==y||e[6]!==g?(b=async function(D){if(!D)return;let M=Array.from(D);if(M.length===0)return;if(c&&(M=M.filter(Nn),M.length===0)){ge.error("Please drop a video file (mp4, webm, …).");return}const J=v();if(!J){y(!0);return}try{const te=await g.mutateAsync({configId:J,file:M[0]});l(te.publicUrl),M.length>1&&ge.info(`Uploaded ${M[0].name}; extra files were ignored (single-select field).`)}catch(te){const oe=te;ge.error(oe instanceof Error?oe.message:"Upload failed")}},e[2]=c,e[3]=l,e[4]=v,e[5]=y,e[6]=g,e[7]=b):b=e[7];const A=b;let j;e[8]!==f?(j=function(D){D.preventDefault(),D.dataTransfer.types.includes("Files")&&f(!0)},e[8]=f,e[9]=j):j=e[9];const N=j;let T;e[10]!==f?(T=function(D){D.currentTarget===D.target&&f(!1)},e[10]=f,e[11]=T):T=e[11];const R=T;let k;e[12]!==A||e[13]!==f?(k=function(D){D.preventDefault(),f(!1),A(D.dataTransfer.files)},e[12]=A,e[13]=f,e[14]=k):k=e[14];const L=k;let $;e[15]!==o||e[16]!==s?($=i.jsx(q,{htmlFor:s,className:"text-muted-foreground",children:o}),e[15]=o,e[16]=s,e[17]=$):$=e[17];let _;e[18]!==n.description?(_=n.description&&i.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=_):_=e[19];let C;e[20]!==$||e[21]!==_?(C=i.jsxs("div",{className:"min-w-0 space-y-0.5",children:[$,_]}),e[20]=$,e[21]=_,e[22]=C):C=e[22];const S=m&&"border-primary ring-2 ring-primary/30",V=g.isPending&&"pointer-events-none opacity-60";let U;e[23]!==V||e[24]!==S?(U=De("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",S,V),e[23]=V,e[24]=S,e[25]=U):U=e[25];let w;e[26]!==h||e[27]!==p||e[28]!==c||e[29]!==y||e[30]!==a||e[31]!==g.isPending?(w=a?c?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-black",children:i.jsx("video",{src:a,preload:"metadata",className:"h-full w-full object-contain"},a)}),i.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[i.jsx(we,{size:14,className:"shrink-0 text-muted-foreground"}),i.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:p}),i.jsx($e,{ext:h})]})]}):i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[i.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:i.jsx(Se,{size:18,className:"text-muted-foreground"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate text-sm font-medium",children:p}),i.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a})]}),i.jsx($e,{ext:h})]}):i.jsxs("button",{type:"button",onClick:()=>y(!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?i.jsx(we,{size:20}):i.jsx(Se,{size:20}),i.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"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"Up to 100 MB"})]}),e[26]=h,e[27]=p,e[28]=c,e[29]=y,e[30]=a,e[31]=g.isPending,e[32]=w):w=e[32];let F;e[33]!==m?(F=m&&i.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:i.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[33]=m,e[34]=F):F=e[34];let I;e[35]!==R||e[36]!==N||e[37]!==L||e[38]!==U||e[39]!==w||e[40]!==F?(I=i.jsxs("div",{onDragOver:N,onDragLeave:R,onDrop:L,className:U,children:[w,F]}),e[35]=R,e[36]=N,e[37]=L,e[38]=U,e[39]=w,e[40]=F,e[41]=I):I=e[41];let P;e[42]!==l?(P=B=>l(B.target.value),e[42]=l,e[43]=P):P=e[43];let O;e[44]!==s||e[45]!==a||e[46]!==P?(O=i.jsx(re,{id:s,type:"url",value:a,onChange:P,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[44]=s,e[45]=a,e[46]=P,e[47]=O):O=e[47];let E;e[48]!==y?(E=()=>y(!0),e[48]=y,e[49]=E):E=e[49];let K;e[50]===Symbol.for("react.memo_cache_sentinel")?(K=i.jsx(At,{size:14}),e[50]=K):K=e[50];const le=a?"Replace":"Browse";let Z;e[51]!==E||e[52]!==le?(Z=i.jsxs(ue,{type:"button",variant:"outline",size:"sm",onClick:E,className:"h-9 shrink-0",children:[K,le]}),e[51]=E,e[52]=le,e[53]=Z):Z=e[53];let H;e[54]!==l||e[55]!==a?(H=a&&i.jsx(ue,{type:"button",variant:"ghost",size:"sm",onClick:()=>l(""),className:"h-9 shrink-0","aria-label":"Remove file",children:i.jsx(ze,{size:14})}),e[54]=l,e[55]=a,e[56]=H):H=e[56];let G;e[57]!==O||e[58]!==Z||e[59]!==H?(G=i.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[O,Z,H]}),e[57]=O,e[58]=Z,e[59]=H,e[60]=G):G=e[60];let W;e[61]!==l?(W=B=>l(B),e[61]=l,e[62]=W):W=e[62];let Y;e[63]!==d||e[64]!==y||e[65]!==W?(Y=i.jsx(yt,{open:d,onOpenChange:y,mode:"any",onSelect:W}),e[63]=d,e[64]=y,e[65]=W,e[66]=Y):Y=e[66];let X;return e[67]!==I||e[68]!==G||e[69]!==Y||e[70]!==C?(X=i.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[C,I,G,Y]}),e[67]=I,e[68]=G,e[69]=Y,e[70]=C,e[71]=X):X=e[71],X}function Nn(t){return t.type.startsWith("video/")}const Tn=new Set(["__resolveType","@type"]);function kn(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return null;const e=t.anyOfRefs[0].resolveType;return e.endsWith("/multivariate/image.ts")?"image":e.endsWith("/multivariate/video.ts")||e.endsWith("/multivariate/file.ts")?"file":null}function _n(t){if(be(t))for(const e of t.anyOfRefs??[]){const l=e.schema?.properties?.variants?.items?.properties?.value;if(l?.type==="array"&&l.items)return l.items}}function Be(t){if(t.type==="array"&&t.items)return t;const e=t.items??_n(t);return e?{...t,type:"array",items:e}:null}function wn(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 qe(t){const{schema:e,value:n}=t;if(jt(n)){const o=Nt(n),c=Be(e);if(o!==null&&c)return i.jsx(xe,{...t,schema:c,value:o,onChange:a=>t.onChange(Tt(n,a))},t.path)}if(Array.isArray(n)&&e.type==="block-ref"&&be(e)){const o=Be(e);if(o)return i.jsx(xe,{...t,schema:o,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){const o=kn(e);return o==="image"?i.jsx(Ae,{...t},t.path):o==="file"?i.jsx(Fe,{...t},t.path):e.anyOfRefs?i.jsx(Re,{...t},t.path):null}if(e.format==="image-uri")return i.jsx(Ae,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return i.jsx(Fe,{...t},t.path);if(e.enum&&e.enum.length>0)return i.jsx(Qt,{...t},t.path);if(e.type==="anyOf")return i.jsx(Re,{...t},t.path);const r=n??wn(e.type,e.default);if(r==null)return null;const l={...t,value:r},s=n==null?e.type??typeof r:Array.isArray(r)?"array":typeof r;if(s==="array"||Array.isArray(r))return i.jsx(xe,{...l},t.path);switch(s){case"boolean":return i.jsx(Yt,{...l},t.path);case"number":case"integer":return i.jsx(Wt,{...l},t.path);case"string":{const o=e.format;return o==="color-input"?i.jsx(ce,{...l},t.path):o==="textarea"||o==="rich-text"||o==="html"?i.jsx(ce,{...l},t.path):i.jsx(ce,{...l},t.path)}case"object":return r!==null&&typeof r=="object"&&!Array.isArray(r)?i.jsx(ln,{...l},t.path):null;default:return i.jsx(ce,{...l},t.path)}}function _e(t){const e=z.c(12),{schema:n,value:r,onChange:l,basePath:s,breadcrumbPath:o,onBreadcrumbChange:c,meta:a,decofile:d,onSaveReferencedBlock:y}=t;let m,f;if(e[0]!==s||e[1]!==d||e[2]!==a||e[3]!==c||e[4]!==l||e[5]!==y||e[6]!==n.properties||e[7]!==o||e[8]!==r){f=Symbol.for("react.early_return_sentinel");e:{const p=o===void 0?[]:o,h=n.properties;if(!h){f=null;break e}const u=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},g=Object.keys(h).filter(j=>!Tn.has(j)&&h[j]?.hidden!==!0);if(g.length===0){let j;e[11]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No editable fields on this section."}),e[11]=j):j=e[11],f=j;break e}const x=(j,N)=>{l({...u,[j]:N})},v=p.length>0?tn(g,h,u,p):null,b=v?h[v]:null,A=v&&b?[v]:g;m=i.jsx("div",{className:"min-w-0 space-y-6",children:A.map(j=>{const N=h[j];if(!N)return null;const T=s?`${s}.${j}`:j,R=ve(j,N);return qe({schema:N,value:u[j],onChange:k=>x(j,k),path:T,label:R,breadcrumbPath:p,onBreadcrumbChange:c,meta:a,decofile:d,onSaveReferencedBlock:y})})})}e[0]=s,e[1]=d,e[2]=a,e[3]=c,e[4]=l,e[5]=y,e[6]=n.properties,e[7]=o,e[8]=r,e[9]=m,e[10]=f}else m=e[9],f=e[10];return f!==Symbol.for("react.early_return_sentinel")?f:m}export{_e as S,qe as a,ce as b,je as r,It as s,Gn as u};
1
+ import{e as z,j as i,r as Q,B as ue,c as De,n as ge}from"./index-uVHAmIsb.js";import{aa as et,v as tt,aq as we,H as Se}from"./agent-icon-CCGqC-bl.js";import{C as nt}from"./calendar-RJSiIOON.js";import{I as re}from"./input-BYcDxHNs.js";import{L as q}from"./label-6YORzGJ9.js";import{a as rt,b as st,P as it}from"./popover-OWTo-ttg.js";import{T as lt}from"./textarea-pwpin7Xo.js";import{S as ot}from"./switch-Cu-9OUl1.js";import{c as Le,S as Ee,a as Pe,b as Ve,d as Me}from"./select-DpIv2m7o.js";import{d as at}from"./ZoomOut-DC46Ewts.js";import{s as ct}from"./Plus-aXWGGcSy.js";import{s as ze}from"./Trash01-DBSukaq0.js";import{D as ut,a as ft,b as dt,c as pt}from"./dropdown-menu-CL4WEQRf.js";import{e as Ue,u as mt,L as ht,F as yt,I as Ae}from"./image-field-CnaeZ7Cq.js";import{l as Ke,i as fe,a as me,S as gt,P as xt,X as be,Y as de,Z as Ce,n as vt,_ as bt,$ as jt,a0 as Nt,a1 as Tt}from"./index--1Ng2vB4.js";import{t as He}from"./ChevronDown-CxTVikeq.js";import{i as We}from"./ChevronRight-3jD7TdJZ.js";import{i as kt}from"./Globe01-CiCGKTg3.js";import{T as _t,b as wt,a as St}from"./tooltip-C_pZvUmA.js";import{i as At}from"./Upload01-DruP7_KV.js";import{c as Ct}from"./use-file-configs-OSUx89xj.js";function It(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function Ot(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(l=>l.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const r=e.find(l=>typeof l.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 Ye(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Ye);const e=t;return e.__resolveType?Ot(e)??t:Ge(e)}function Ge(t){const e={};for(const[n,r]of Object.entries(t))e[n]=Ye(r);return e}function Rt(t,e){return e.split(".").reduce((n,r)=>{if(!(n==null||typeof n!="object"))return n[r]},t)}function Xe(t){return t==null?"":Array.isArray(t)?t.map(Xe).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function je(t,e){if(!t.includes("{"))return;const n=Ge(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(l,s,o)=>{const c=(s??o??"").trim();return Xe(Rt(n,c))}).trim()||void 0}function $t(t,e){if(e.includes("{"))return je(e,t);const n=t[e];if(typeof n=="string"&&n)return n;if(Array.isArray(n)){const r=n.map(l=>l==null?"":String(l)).filter(Boolean).join(",");if(r)return r}}function se(t,e,n){if(typeof t=="string")return t||`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){const r=t;if(n?.titleBy){const s=$t(r,n.titleBy);if(s)return s}for(const s of["name","label","title","alt","text","href","id"]){const o=r[s];if(typeof o=="string"&&o)return o;if(Array.isArray(o)){const c=o.map(a=>a==null?"":String(a)).filter(Boolean).join(",");if(c)return c}}const l=r.__resolveType;if(typeof l=="string"&&l)return Ke(l);if(n?.title){const s=je(n.title,r);if(s)return s;if(!n.title.includes("{"))return n.title}}return`Item ${e+1}`}function Ft(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 Bt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const n=Ft(e);if(!n)return;const r=je(n,t);if(!r)return;const l=Ue(r)||r;return It(l)}function Ze(t){return t===gt||t===xt}function he(t,e){if(!Object.hasOwn(e,t))return null;const n=e[t]??{},r=n.__resolveType??t;return{data:{...n},resolveType:r}}function pe(t,e){const n=t.__resolveType??"";if(!n)return null;if(fe(n)){const r=t.section??{};return Qe(r,e)}if(Ze(n)){const r=t.variants?.[0]?.value;return r?pe(r,e):null}return!me(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:he(n,e)}function Qe(t,e){const n=t.__resolveType??"";if(!n)return null;if(Ze(n)){const r=t.variants?.[0]?.value;return r?pe(r,e):null}return!me(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:he(n,e)}function Dt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const r=t.__resolveType;if(typeof r!="string"||!me(r)||!Object.hasOwn(e,r))return null;const l=he(r,e);return l?{blockKey:r,...l}:null}function Gn(t,e,n){if(e.isMultivariate)return null;if(e.isSavedBlock){const r=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return he(r,n)}if(e.isHidden){const s=(fe(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return pe(s,n)}if(e.isLazy||fe(t.__resolveType)){const r=t.section??{};return Qe(r,n)}return pe(t,n)}const ee=t=>String(t).padStart(2,"0"),Lt="1900-01-01",Et="2099-12-31",Pt="1900-01-01T00:00",Vt="2099-12-31T23:59";function Mt(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()}-${ee(n.getUTCMonth()+1)}-${ee(n.getUTCDate())}`}function zt(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function Ut(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${ee(e.getMonth()+1)}-${ee(e.getDate())}T${ee(e.getHours())}:${ee(e.getMinutes())}`}function Kt(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function Ht(t){const e=z.c(29),{id:n,withTime:r,value:l,onChange:s}=t,[o,c]=Q.useState(!1);let a;e[0]!==l||e[1]!==r?(a=r?Ut(l):Mt(l),e[0]=l,e[1]=r,e[2]=a):a=e[2];const d=a;let y;e[3]!==s||e[4]!==r?(y=k=>{s(r?Kt(k.target.value):zt(k.target.value))},e[3]=s,e[4]=r,e[5]=y):y=e[5];const m=y;let f;if(e[6]!==l){const k=l?new Date(l):null;f=k&&!Number.isNaN(k.getTime())?k:null,e[6]=l,e[7]=f}else f=e[7];const p=f;let h;e[8]!==s||e[9]!==p||e[10]!==r?(h=k=>{k&&(r&&p?k.setHours(p.getHours(),p.getMinutes(),0,0):k.setHours(0,0,0,0),s(k.toISOString()),c(!1))},e[8]=s,e[9]=p,e[10]=r,e[11]=h):h=e[11];const u=h,g=r?"datetime-local":"date",x=r?Pt:Lt,v=r?Vt:Et;let b;e[12]!==m||e[13]!==n||e[14]!==d||e[15]!==g||e[16]!==x||e[17]!==v?(b=i.jsx(re,{id:n,type:g,min:x,max:v,value:d,onChange:m,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[12]=m,e[13]=n,e[14]=d,e[15]=g,e[16]=x,e[17]=v,e[18]=b):b=e[18];let A;e[19]===Symbol.for("react.memo_cache_sentinel")?(A=i.jsx(rt,{asChild:!0,children:i.jsx(ue,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":"Open calendar",children:i.jsx(et,{className:"h-4 w-4"})})}),e[19]=A):A=e[19];const j=p??void 0;let N;e[20]!==u||e[21]!==j?(N=i.jsx(st,{className:"w-auto p-0",align:"end",children:i.jsx(nt,{mode:"single",selected:j,onSelect:u,initialFocus:!0})}),e[20]=u,e[21]=j,e[22]=N):N=e[22];let T;e[23]!==o||e[24]!==N?(T=i.jsxs(it,{open:o,onOpenChange:c,children:[A,N]}),e[23]=o,e[24]=N,e[25]=T):T=e[25];let R;return e[26]!==T||e[27]!==b?(R=i.jsxs("div",{className:"flex gap-1",children:[b,T]}),e[26]=T,e[27]=b,e[28]=R):R=e[28],R}function ae(t){const e=z.c(8),{htmlFor:n,label:r,description:l}=t;let s;e[0]!==n||e[1]!==r?(s=i.jsx(q,{htmlFor:n,children:r}),e[0]=n,e[1]=r,e[2]=s):s=e[2];let o;e[3]!==l?(o=l&&i.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:l}),e[3]=l,e[4]=o):o=e[4];let c;return e[5]!==s||e[6]!==o?(c=i.jsxs("div",{className:"space-y-0.5",children:[s,o]}),e[5]=s,e[6]=o,e[7]=c):c=e[7],c}function ce(t){const e=z.c(61),{schema:n,value:r,onChange:l,path:s,label:o}=t,c=typeof r=="string"?r:"",a=n.format;if(a==="textarea"||a==="rich-text"||a==="rich-text-inline"||a==="markdown"){let u;e[0]!==o||e[1]!==s||e[2]!==n.description?(u=i.jsx(ae,{htmlFor:s,label:o,description:n.description}),e[0]=o,e[1]=s,e[2]=n.description,e[3]=u):u=e[3];let g;e[4]!==l?(g=b=>l(b.target.value),e[4]=l,e[5]=g):g=e[5];let x;e[6]!==s||e[7]!==c||e[8]!==g?(x=i.jsx(lt,{id:s,value:c,onChange:g,rows:4}),e[6]=s,e[7]=c,e[8]=g,e[9]=x):x=e[9];let v;return e[10]!==u||e[11]!==x?(v=i.jsxs("div",{className:"space-y-2",children:[u,x]}),e[10]=u,e[11]=x,e[12]=v):v=e[12],v}if(a==="date"||a==="date-time"){let u;e[13]!==o||e[14]!==s||e[15]!==n.description?(u=i.jsx(ae,{htmlFor:s,label:o,description:n.description}),e[13]=o,e[14]=s,e[15]=n.description,e[16]=u):u=e[16];const g=a==="date-time";let x;e[17]!==l||e[18]!==s||e[19]!==c||e[20]!==g?(x=i.jsx(Ht,{id:s,withTime:g,value:c,onChange:l}),e[17]=l,e[18]=s,e[19]=c,e[20]=g,e[21]=x):x=e[21];let v;return e[22]!==u||e[23]!==x?(v=i.jsxs("div",{className:"space-y-2",children:[u,x]}),e[22]=u,e[23]=x,e[24]=v):v=e[24],v}if(a==="color-input"){let u;e[25]!==o||e[26]!==s||e[27]!==n.description?(u=i.jsx(ae,{htmlFor:s,label:o,description:n.description}),e[25]=o,e[26]=s,e[27]=n.description,e[28]=u):u=e[28];const g=c||"#000000";let x;e[29]!==l?(x=T=>l(T.target.value),e[29]=l,e[30]=x):x=e[30];let v;e[31]!==g||e[32]!==x?(v=i.jsx("input",{type:"color",value:g,onChange:x,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[31]=g,e[32]=x,e[33]=v):v=e[33];let b;e[34]!==l?(b=T=>l(T.target.value),e[34]=l,e[35]=b):b=e[35];let A;e[36]!==s||e[37]!==c||e[38]!==b?(A=i.jsx(re,{id:s,value:c,onChange:b,placeholder:"#000000",className:"h-10 flex-1"}),e[36]=s,e[37]=c,e[38]=b,e[39]=A):A=e[39];let j;e[40]!==v||e[41]!==A?(j=i.jsxs("div",{className:"flex items-center gap-2",children:[v,A]}),e[40]=v,e[41]=A,e[42]=j):j=e[42];let N;return e[43]!==u||e[44]!==j?(N=i.jsxs("div",{className:"space-y-2",children:[u,j]}),e[43]=u,e[44]=j,e[45]=N):N=e[45],N}let d;e[46]!==o||e[47]!==s||e[48]!==n.description?(d=i.jsx(ae,{htmlFor:s,label:o,description:n.description}),e[46]=o,e[47]=s,e[48]=n.description,e[49]=d):d=e[49];const y=a==="url"?"url":"text";let m;e[50]!==l?(m=u=>l(u.target.value),e[50]=l,e[51]=m):m=e[51];const f=n.default!=null?String(n.default):void 0;let p;e[52]!==s||e[53]!==c||e[54]!==y||e[55]!==m||e[56]!==f?(p=i.jsx(re,{id:s,type:y,value:c,onChange:m,placeholder:f,className:"h-10"}),e[52]=s,e[53]=c,e[54]=y,e[55]=m,e[56]=f,e[57]=p):p=e[57];let h;return e[58]!==d||e[59]!==p?(h=i.jsxs("div",{className:"space-y-2",children:[d,p]}),e[58]=d,e[59]=p,e[60]=h):h=e[60],h}function Wt(t){const e=z.c(17),{schema:n,value:r,onChange:l,path:s,label:o}=t,c=typeof r=="number"?r:"";let a;e[0]!==o||e[1]!==s?(a=i.jsx(q,{htmlFor:s,children:o}),e[0]=o,e[1]=s,e[2]=a):a=e[2];let d;e[3]!==n.description?(d=n.description&&i.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=d):d=e[4];let y;e[5]!==a||e[6]!==d?(y=i.jsxs("div",{className:"space-y-0.5",children:[a,d]}),e[5]=a,e[6]=d,e[7]=y):y=e[7];let m;e[8]!==l?(m=h=>{const u=h.target.value;l(u===""?void 0:Number(u))},e[8]=l,e[9]=m):m=e[9];let f;e[10]!==c||e[11]!==s||e[12]!==m?(f=i.jsx(re,{id:s,type:"number",value:c,onChange:m,className:"h-10"}),e[10]=c,e[11]=s,e[12]=m,e[13]=f):f=e[13];let p;return e[14]!==y||e[15]!==f?(p=i.jsxs("div",{className:"space-y-2",children:[y,f]}),e[14]=y,e[15]=f,e[16]=p):p=e[16],p}function Yt(t){const e=z.c(17),{value:n,onChange:r,path:l,label:s,schema:o}=t,c=typeof n=="boolean"?n:!1;let a;e[0]!==s||e[1]!==l?(a=i.jsx(q,{htmlFor:l,children:s}),e[0]=s,e[1]=l,e[2]=a):a=e[2];let d;e[3]!==o.description?(d=o.description&&i.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:o.description}),e[3]=o.description,e[4]=d):d=e[4];let y;e[5]!==a||e[6]!==d?(y=i.jsxs("div",{className:"space-y-0.5",children:[a,d]}),e[5]=a,e[6]=d,e[7]=y):y=e[7];let m;e[8]!==r?(m=h=>r(h),e[8]=r,e[9]=m):m=e[9];let f;e[10]!==c||e[11]!==l||e[12]!==m?(f=i.jsx(ot,{id:l,checked:c,onCheckedChange:m}),e[10]=c,e[11]=l,e[12]=m,e[13]=f):f=e[13];let p;return e[14]!==y||e[15]!==f?(p=i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[y,f]}),e[14]=y,e[15]=f,e[16]=p):p=e[16],p}const Ne="__enum_empty__";function Te(t){return t===""?Ne:String(t)}function Gt(t,e){if(t===Ne)return"";const n=e.find(r=>Te(r)===t);return n!==void 0?n:t}function Xt(t,e){return t==null?e.some(n=>n==="")?Ne:void 0:Te(t)}function Zt(t){return t===""?"":String(t)}function Qt(t){const e=z.c(28),{schema:n,value:r,onChange:l,path:s,label:o}=t;let c;e[0]!==n.enum?(c=n.enum??[],e[0]=n.enum,e[1]=c):c=e[1];const a=c;let d;e[2]!==a||e[3]!==r?(d=Xt(r,a),e[2]=a,e[3]=r,e[4]=d):d=e[4];const y=d;let m;e[5]!==o||e[6]!==s?(m=i.jsx(q,{htmlFor:s,children:o}),e[5]=o,e[6]=s,e[7]=m):m=e[7];let f;e[8]!==n.description?(f=n.description&&i.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=f):f=e[9];let p;e[10]!==m||e[11]!==f?(p=i.jsxs("div",{className:"space-y-0.5",children:[m,f]}),e[10]=m,e[11]=f,e[12]=p):p=e[12];let h;e[13]!==l||e[14]!==a?(h=A=>l(Gt(A,a)),e[13]=l,e[14]=a,e[15]=h):h=e[15];let u;e[16]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(Ee,{className:"h-10",children:i.jsx(Pe,{placeholder:"Select..."})}),e[16]=u):u=e[16];let g;e[17]!==a?(g=a.map(qt),e[17]=a,e[18]=g):g=e[18];let x;e[19]!==g?(x=i.jsx(Ve,{children:g}),e[19]=g,e[20]=x):x=e[20];let v;e[21]!==y||e[22]!==h||e[23]!==x?(v=i.jsxs(Me,{value:y,onValueChange:h,children:[u,x]}),e[21]=y,e[22]=h,e[23]=x,e[24]=v):v=e[24];let b;return e[25]!==v||e[26]!==p?(b=i.jsxs("div",{className:"space-y-2",children:[p,v]}),e[25]=v,e[26]=p,e[27]=b):b=e[27],b}function qt(t){const e=Te(t);return i.jsx(Le,{value:e,children:Zt(t)},e)}function Jt(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function ve(t,e){return e.title??Jt(t)}function Ie(t){return t.type==="array"&&t.items?!0:be(t)}function en(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function ie(t,e,n,r){if(r.length===0)return null;const l=r[0];for(const s of t){const o=e[s];if(!o||!Ie(o))continue;const c=ve(s,o);if(l===c||l===s)return s}for(const s of t){const o=e[s];if(!o||!Ie(o))continue;const c=n[s];if(!Array.isArray(c))continue;const a=o.items;for(let d=0;d<c.length;d++)if(se(c[d],d,a)===l)return s}for(const s of t){const o=e[s];if(o?.type!=="object"||!o.properties)continue;const c=Object.keys(o.properties),a=en(n[s]),d=ve(s,o);if(ie(c,o.properties,a,r)||(l===d||l===s)&&ie(c,o.properties,a,r.slice(1)))return s}return null}function tn(t,e,n,r){return ie(t,e,n,r)}function nn(t,e,n,r,l){if(l.length===0||!n.properties)return!1;const s=Object.keys(n.properties);if(ie(s,n.properties,r,l))return!0;const o=l[0];return o!==e&&o!==t?!1:l.length>1||ie(s,n.properties,r,l.slice(1))!==null}function rn(t,e,n,r){if(e.length===0)return null;for(let s=0;s<e.length;s++){const o=e[s],c=n.findIndex((a,d)=>se(a,d,r)===o);if(c>=0)return{index:c,innerPath:e.slice(s+1)}}const l=e.indexOf(t);if(l>=0&&e.length>l+1){const s=e[l+1],o=n.findIndex((c,a)=>se(c,a,r)===s);if(o>=0)return{index:o,innerPath:e.slice(l+2)}}return null}function xe(t){const e=z.c(47),{schema:n,value:r,onChange:l,path:s,label:o,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:y,onSaveReferencedBlock:m}=t;let f,p,h,u,g,x,v;if(e[0]!==y||e[1]!==o||e[2]!==d||e[3]!==a||e[4]!==l||e[5]!==m||e[6]!==s||e[7]!==n.items||e[8]!==c||e[9]!==r){v=Symbol.for("react.early_return_sentinel");e:{const _=c===void 0?[]:c;u=Array.isArray(r)?r:[],h=n.items;const C=rn(o,_,u,h),S=C?.index??null;let V;e[17]!==h?(V=(w,F)=>se(w,F,h),e[17]=h,e[18]=V):V=e[18],p=V,g=w=>{const F=p(u[w],w);a?.([..._,F])},f=()=>{const w=h?.type,F=h?.default!==void 0?h.default:w==="object"?{}:w==="block-ref"?(()=>{const E=h?.anyOfRefs?.[0]?.resolveType;return typeof E!="string"||de(E)?{}:{__resolveType:E}})():w==="number"||w==="integer"?0:w==="boolean"?!1:w==="array"?[]:"",I=[...u,F];l(I);const P=I.length-1,O=se(F,P,h);a?.([..._,O])},x=w=>{if(l(u.filter((F,I)=>I!==w)),S===w){const F=p(u[w],w),I=_.indexOf(F);a?.(I>=0?_.slice(0,I):[])}};const U=(w,F)=>{const I=[...u];if(I[w]=F,l(I),S===w){const P=p(u[w],w),O=p(F,w),E=_.indexOf(P);if(E>=0){const K=[..._];K[E]=O,a?.(K);return}a?.([..._,O])}};if(S!==null&&S<u.length){const w=u[S],F=()=>{const O=p(w,S),E=_.indexOf(O);return E>=0?_.slice(0,E+1):[..._,O]},I=h?.type==="object"&&h.properties?i.jsx(_e,{schema:h,value:w,onChange:O=>U(S,O),basePath:`${s}.${S}`,breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:O=>{a?.([...F(),...O])},meta:d,decofile:y,onSaveReferencedBlock:m}):h?qe({schema:h,value:w,onChange:O=>U(S,O),path:`${s}.${S}`,label:h.title??`Item ${S+1}`,breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:O=>{a?.([...F(),...O])},meta:d,decofile:y,onSaveReferencedBlock:m}):null;let P;e[19]!==I?(P=i.jsx("div",{className:"min-w-0",children:I}),e[19]=I,e[20]=P):P=e[20],v=P;break e}}e[0]=y,e[1]=o,e[2]=d,e[3]=a,e[4]=l,e[5]=m,e[6]=s,e[7]=n.items,e[8]=c,e[9]=r,e[10]=f,e[11]=p,e[12]=h,e[13]=u,e[14]=g,e[15]=x,e[16]=v}else f=e[10],p=e[11],h=e[12],u=e[13],g=e[14],x=e[15],v=e[16];if(v!==Symbol.for("react.early_return_sentinel"))return v;let b;e[21]!==o?(b=i.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[21]=o,e[22]=b):b=e[22];let A;e[23]!==u.length?(A=u.length>0&&i.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:u.length}),e[23]=u.length,e[24]=A):A=e[24];let j;e[25]!==b||e[26]!==A?(j=i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[b,A]}),e[25]=b,e[26]=A,e[27]=j):j=e[27];let N;e[28]!==n.description?(N=n.description&&i.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:n.description}),e[28]=n.description,e[29]=N):N=e[29];let T;e[30]!==j||e[31]!==N?(T=i.jsxs("div",{className:"min-w-0 space-y-0.5",children:[j,N]}),e[30]=j,e[31]=N,e[32]=T):T=e[32];let R;e[33]!==p||e[34]!==h||e[35]!==u||e[36]!==g||e[37]!==s||e[38]!==x?(R=u.length>0&&i.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:u.map((_,C)=>{const S=p(_,C),V=Bt(_,h);return i.jsxs("div",{className:"group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground",children:[i.jsx(at,{className:"size-3.5 shrink-0 cursor-grab text-muted-foreground/40"}),i.jsxs("button",{type:"button",onClick:()=>g(C),className:"flex min-w-0 flex-1 items-center gap-2.5 text-left text-sm",title:S,children:[V&&i.jsx("img",{src:V,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),i.jsx("span",{className:"min-w-0 truncate",children:S})]}),i.jsxs(ut,{children:[i.jsx(ft,{asChild:!0,children:i.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":`Open actions for ${S}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:sn,children:i.jsx(tt,{size:14})})}),i.jsx(dt,{align:"end",children:i.jsxs(pt,{className:"text-destructive focus:text-destructive",onClick:()=>x(C),children:[i.jsx(ze,{size:14}),"Delete"]})})]})]},`${s}.${C}`)})}),e[33]=p,e[34]=h,e[35]=u,e[36]=g,e[37]=s,e[38]=x,e[39]=R):R=e[39];let k;e[40]===Symbol.for("react.memo_cache_sentinel")?(k=i.jsx(ct,{size:14}),e[40]=k):k=e[40];let L;e[41]!==f?(L=i.jsxs("button",{type:"button",onClick:f,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:[k,"Add item"]}),e[41]=f,e[42]=L):L=e[42];let $;return e[43]!==L||e[44]!==T||e[45]!==R?($=i.jsxs("div",{className:"space-y-2",children:[T,R,L]}),e[43]=L,e[44]=T,e[45]=R,e[46]=$):$=e[46],$}function sn(t){return t.stopPropagation()}function ln(t){const e=z.c(40),{schema:n,value:r,onChange:l,path:s,label:o,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:y,onSaveReferencedBlock:m}=t;let f;e[0]!==c?(f=c===void 0?[]:c,e[0]=c,e[1]=f):f=e[1];const p=f,[h,u]=Q.useState(!1);let g;e[2]!==r?(g=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},e[2]=r,e[3]=g):g=e[3];const x=g;if(!n.properties)return null;let v;e[4]!==s?(v=s.split(".").pop()??s,e[4]=s,e[5]=v):v=e[5];const b=v;let A;e[6]!==p||e[7]!==b||e[8]!==o||e[9]!==x||e[10]!==n?(A=nn(b,o,n,x,p),e[6]=p,e[7]=b,e[8]=o,e[9]=x,e[10]=n,e[11]=A):A=e[11];const N=h||A,T=`${s}-fields`;let R;e[12]===Symbol.for("react.memo_cache_sentinel")?(R=()=>u(on),e[12]=R):R=e[12];let k;e[13]!==N?(k=i.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:N?i.jsx(He,{size:16}):i.jsx(We,{size:16})}),e[13]=N,e[14]=k):k=e[14];let L;e[15]!==o?(L=i.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[15]=o,e[16]=L):L=e[16];let $;e[17]!==T||e[18]!==N||e[19]!==k||e[20]!==L?($=i.jsxs("button",{type:"button","aria-expanded":N,"aria-controls":T,onClick:R,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[k,L]}),e[17]=T,e[18]=N,e[19]=k,e[20]=L,e[21]=$):$=e[21];let _;e[22]!==n.description?(_=n.description&&i.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:n.description}),e[22]=n.description,e[23]=_):_=e[23];let C;e[24]!==p||e[25]!==T||e[26]!==y||e[27]!==N||e[28]!==d||e[29]!==x||e[30]!==a||e[31]!==l||e[32]!==m||e[33]!==s||e[34]!==n?(C=N&&i.jsx("div",{id:T,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:i.jsx(_e,{schema:n,value:x,onChange:l,basePath:s,breadcrumbPath:p,onBreadcrumbChange:a,meta:d,decofile:y,onSaveReferencedBlock:m})}),e[24]=p,e[25]=T,e[26]=y,e[27]=N,e[28]=d,e[29]=x,e[30]=a,e[31]=l,e[32]=m,e[33]=s,e[34]=n,e[35]=C):C=e[35];let S;return e[36]!==_||e[37]!==C||e[38]!==$?(S=i.jsxs("div",{className:"min-w-0 space-y-2",children:[$,_,C]}),e[36]=_,e[37]=C,e[38]=$,e[39]=S):S=e[39],S}function on(t){return!t}function ke(t){const e=t.__resolveType;if(typeof e!="string")return null;if(fe(e)){const r=t.section?.__resolveType;return typeof r=="string"?r:e}return e}function an(t){return t.includes("flags/multivariate")}function cn(t){return Ke(t)}function un(t,e){const n=[...t],r=new Set(n.map(s=>s.resolveType)),l=(s,o)=>{!s||r.has(s)||(r.add(s),n.push({resolveType:s,title:o??cn(s)}))};if(e.savedBlockKey&&l(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const s=ke(e.editorValue);s?.includes("/")&&l(s)}return n}function fn(t,e,n){const r=e[0]?.resolveType??"";if(n)return n;if(!t||typeof t!="object"||Array.isArray(t))return r;const l=t,s=l.__resolveType;if(typeof s=="string"){if(me(s)){const m=e.find(f=>f.resolveType===s);return m?m.resolveType:s}const d=e.find(m=>Ce(m.resolveType,s));if(d)return d.resolveType;const y=e.find(m=>m.resolveType===s);if(y)return y.resolveType;if(s.includes("/"))return s}const o=typeof l.type=="string"?l.type:void 0;if(o){const d=e.find(y=>y.discriminatorValue===o||y.resolveType===o||Ce(y.resolveType,o));if(d)return d.resolveType}let c=r,a=-1;for(const d of e){if(!d.schema?.properties)continue;const m=Object.keys(d.schema.properties).filter(f=>!f.startsWith("__")&&f!=="@type"&&f!=="action"&&f!=="alt").filter(f=>l[f]!==void 0).length;m>0&&m>a&&(a=m,c=d.resolveType)}return a>0,c}function Oe(t,e,n){if(!t||typeof t!="object"||Array.isArray(t))return n??null;const r=ke(t);if(!r)return n??null;if(!e)return r.includes("/")?null:n??null;const l=vt(r,e);return l||(r.includes("/")?null:n??null)}function dn(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 pn(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const n=t,r=ke(n);return r&&an(r)?Array.isArray(n.variants)&&n.variants.length>0:Object.keys(n).some(l=>!l.startsWith("__")&&l!=="@type")}function mn(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 hn(t){const e=z.c(3),{blockKey:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(_t,{asChild:!0,children:i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[i.jsx(kt,{size:11}),"Global"]})}),e[0]=r):r=e[0];let l;return e[1]!==n?(l=i.jsxs(wt,{children:[r,i.jsxs(St,{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]=l):l=e[2],l}function yn(t){const e=z.c(28),{path:n,open:r,onOpenChange:l,title:s,nested:o,nestedBlockRef:c,globalBlockKey:a}=t,d=`${n}-loader-config`,y=c&&"ml-1";let m;e[0]!==y?(m=De("rounded-lg border border-border/80 bg-muted/30",y),e[0]=y,e[1]=m):m=e[1];let f;e[2]!==l||e[3]!==r?(f=()=>l(!r),e[2]=l,e[3]=r,e[4]=f):f=e[4];let p;e[5]!==r?(p=i.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:r?i.jsx(He,{size:16}):i.jsx(We,{size:16})}),e[5]=r,e[6]=p):p=e[6];let h;e[7]!==s?(h=i.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:s}),e[7]=s,e[8]=h):h=e[8];let u;e[9]!==a?(u=a&&i.jsx(hn,{blockKey:a}),e[9]=a,e[10]=u):u=e[10];let g;e[11]!==h||e[12]!==u?(g=i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[h,u]}),e[11]=h,e[12]=u,e[13]=g):g=e[13];let x;e[14]!==d||e[15]!==r||e[16]!==f||e[17]!==p||e[18]!==g?(x=i.jsxs("button",{type:"button","aria-expanded":r,"aria-controls":d,onClick:f,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,g]}),e[14]=d,e[15]=r,e[16]=f,e[17]=p,e[18]=g,e[19]=x):x=e[19];let v;e[20]!==d||e[21]!==o||e[22]!==r?(v=r&&i.jsx("div",{id:d,className:"border-t border-border/60 px-4 pb-4 pt-3",children:i.jsx("div",{className:"border-l border-border/80 pl-4",children:o})}),e[20]=d,e[21]=o,e[22]=r,e[23]=v):v=e[23];let b;return e[24]!==m||e[25]!==x||e[26]!==v?(b=i.jsxs("div",{className:m,children:[x,v]}),e[24]=m,e[25]=x,e[26]=v,e[27]=b):b=e[27],b}function Re(t){const e=z.c(30),{schema:n,value:r,onChange:l,path:s,label:o,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:y,onSaveReferencedBlock:m}=t,f=(n.anyOfRefs??[]).filter(vn),p=y&&r?Dt(r,y):null,h=p?.data??r,u=un(f,{savedBlockKey:p?.blockKey,editorValue:h}),g=u.length>0?fn(h,u,p?.blockKey):u[0]?.resolveType??"",[x,v]=Q.useState(g),[b,A]=Q.useState(g);b!==g&&(A(g),v(g));const[j,N]=Q.useState(()=>pn(h,p?.blockKey));if(u.length>0){const S=x||g;let V;e[0]!==S?(V=B=>B.resolveType===S,e[0]=S,e[1]=V):V=e[1];const U=u.find(V),w=Oe(h,d,U?.schema),F=dn(w??U?.schema??null,n.discriminatorKey),I=n.discriminatorKey,P=B=>{v(B);const D=u.find(ne=>ne.resolveType===B),M=Oe(h,d,D?.schema),J=new Set(Object.keys((M??D?.schema)?.properties??{})),te=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:{},oe=Object.fromEntries(Object.entries(te).filter(ne=>{const[Je]=ne;return J.has(Je)})),ye={...mn(D?.schema),...oe};if(I){const ne=D?.discriminatorValue??B;l({...ye,[I]:ne});return}if(de(B)){l(ye);return}l({...ye,__resolveType:B})};let O;e[2]!==S||e[3]!==I||e[4]!==l?(O=B=>{if(I||!de(S)||B===null||typeof B!="object"||Array.isArray(B)){l(B);return}const{__resolveType:D,...M}=B;l(M)},e[2]=S,e[3]=I,e[4]=l,e[5]=O):O=e[5];const E=O,K=F?.properties?i.jsx(_e,{schema:F,value:h,onChange:B=>{if(p&&m){m(p.blockKey,B);return}E(B)},basePath:s,breadcrumbPath:c,onBreadcrumbChange:a,meta:d,decofile:y,onSaveReferencedBlock:m}):null,Z=n.type==="block-ref"&&u.some(xn);let H;e[6]!==s?(H=s.includes("."),e[6]=s,e[7]=H):H=e[7];const G=H;let W;e[8]!==o||e[9]!==s?(W=i.jsx(q,{htmlFor:s,children:o}),e[8]=o,e[9]=s,e[10]=W):W=e[10];let Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=i.jsx(Ee,{children:i.jsx(Pe,{placeholder:"Select..."})}),e[11]=Y):Y=e[11];let X;return e[12]!==n.description?(X=n.description&&i.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[12]=n.description,e[13]=X):X=e[13],i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"space-y-1.5",children:[W,i.jsxs(Me,{value:S||void 0,onValueChange:P,children:[Y,i.jsx(Ve,{children:u.map(gn)})]}),X]}),K&&(Z?i.jsx(yn,{path:s,open:j,onOpenChange:N,title:G?"Configuration":"Loader configuration",nested:K,nestedBlockRef:G,globalBlockKey:p?.blockKey}):K)]})}if(n.anyOfRefs&&n.anyOfRefs.length>0)return null;let T;e[14]!==o||e[15]!==s?(T=i.jsx(q,{htmlFor:s,children:o}),e[14]=o,e[15]=s,e[16]=T):T=e[16];const R=r!=null?String(r):"";let k;e[17]!==l?(k=S=>l(S.target.value),e[17]=l,e[18]=k):k=e[18];const L=n.description??"";let $;e[19]!==s||e[20]!==R||e[21]!==k||e[22]!==L?($=i.jsx("input",{id:s,type:"text",value:R,onChange:k,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:L}),e[19]=s,e[20]=R,e[21]=k,e[22]=L,e[23]=$):$=e[23];let _;e[24]!==n.description?(_=n.description&&i.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[24]=n.description,e[25]=_):_=e[25];let C;return e[26]!==T||e[27]!==$||e[28]!==_?(C=i.jsxs("div",{className:"space-y-1.5",children:[T,$,_]}),e[26]=T,e[27]=$,e[28]=_,e[29]=C):C=e[29],C}function gn(t){return i.jsx(Le,{value:t.resolveType,children:t.title??bt(t.resolveType)??t.resolveType},t.resolveType)}function xn(t){return t.resolveType.includes("/")&&!de(t.resolveType)}function vn(t){return t.resolveType!==""}function $e(t){const e=z.c(2),{ext:n}=t;if(!n)return null;let r;return e[0]!==n?(r=i.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 bn(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function jn(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function Fe(t){const e=z.c(72),{schema:n,value:r,onChange:l,path:s,label:o}=t,c=n.format==="video-uri",a=Ue(r),[d,y]=Q.useState(!1),[m,f]=Q.useState(!1),p=a?bn(a):"",h=p?jn(p):"",u=Ct(),g=mt();let x;e[0]!==u.data?.configs?(x=function(){const D=u.data?.configs??[];if(D.length===1)return D[0].id;if(D.length===0)return null;const M=typeof window<"u"?window.localStorage.getItem(ht):null;return D.some(J=>J.id===M)?M:null},e[0]=u.data?.configs,e[1]=x):x=e[1];const v=x;let b;e[2]!==c||e[3]!==l||e[4]!==v||e[5]!==y||e[6]!==g?(b=async function(D){if(!D)return;let M=Array.from(D);if(M.length===0)return;if(c&&(M=M.filter(Nn),M.length===0)){ge.error("Please drop a video file (mp4, webm, …).");return}const J=v();if(!J){y(!0);return}try{const te=await g.mutateAsync({configId:J,file:M[0]});l(te.publicUrl),M.length>1&&ge.info(`Uploaded ${M[0].name}; extra files were ignored (single-select field).`)}catch(te){const oe=te;ge.error(oe instanceof Error?oe.message:"Upload failed")}},e[2]=c,e[3]=l,e[4]=v,e[5]=y,e[6]=g,e[7]=b):b=e[7];const A=b;let j;e[8]!==f?(j=function(D){D.preventDefault(),D.dataTransfer.types.includes("Files")&&f(!0)},e[8]=f,e[9]=j):j=e[9];const N=j;let T;e[10]!==f?(T=function(D){D.currentTarget===D.target&&f(!1)},e[10]=f,e[11]=T):T=e[11];const R=T;let k;e[12]!==A||e[13]!==f?(k=function(D){D.preventDefault(),f(!1),A(D.dataTransfer.files)},e[12]=A,e[13]=f,e[14]=k):k=e[14];const L=k;let $;e[15]!==o||e[16]!==s?($=i.jsx(q,{htmlFor:s,className:"text-muted-foreground",children:o}),e[15]=o,e[16]=s,e[17]=$):$=e[17];let _;e[18]!==n.description?(_=n.description&&i.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=_):_=e[19];let C;e[20]!==$||e[21]!==_?(C=i.jsxs("div",{className:"min-w-0 space-y-0.5",children:[$,_]}),e[20]=$,e[21]=_,e[22]=C):C=e[22];const S=m&&"border-primary ring-2 ring-primary/30",V=g.isPending&&"pointer-events-none opacity-60";let U;e[23]!==V||e[24]!==S?(U=De("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",S,V),e[23]=V,e[24]=S,e[25]=U):U=e[25];let w;e[26]!==h||e[27]!==p||e[28]!==c||e[29]!==y||e[30]!==a||e[31]!==g.isPending?(w=a?c?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-black",children:i.jsx("video",{src:a,preload:"metadata",className:"h-full w-full object-contain"},a)}),i.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[i.jsx(we,{size:14,className:"shrink-0 text-muted-foreground"}),i.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:p}),i.jsx($e,{ext:h})]})]}):i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[i.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:i.jsx(Se,{size:18,className:"text-muted-foreground"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate text-sm font-medium",children:p}),i.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a})]}),i.jsx($e,{ext:h})]}):i.jsxs("button",{type:"button",onClick:()=>y(!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?i.jsx(we,{size:20}):i.jsx(Se,{size:20}),i.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"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"Up to 100 MB"})]}),e[26]=h,e[27]=p,e[28]=c,e[29]=y,e[30]=a,e[31]=g.isPending,e[32]=w):w=e[32];let F;e[33]!==m?(F=m&&i.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:i.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[33]=m,e[34]=F):F=e[34];let I;e[35]!==R||e[36]!==N||e[37]!==L||e[38]!==U||e[39]!==w||e[40]!==F?(I=i.jsxs("div",{onDragOver:N,onDragLeave:R,onDrop:L,className:U,children:[w,F]}),e[35]=R,e[36]=N,e[37]=L,e[38]=U,e[39]=w,e[40]=F,e[41]=I):I=e[41];let P;e[42]!==l?(P=B=>l(B.target.value),e[42]=l,e[43]=P):P=e[43];let O;e[44]!==s||e[45]!==a||e[46]!==P?(O=i.jsx(re,{id:s,type:"url",value:a,onChange:P,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[44]=s,e[45]=a,e[46]=P,e[47]=O):O=e[47];let E;e[48]!==y?(E=()=>y(!0),e[48]=y,e[49]=E):E=e[49];let K;e[50]===Symbol.for("react.memo_cache_sentinel")?(K=i.jsx(At,{size:14}),e[50]=K):K=e[50];const le=a?"Replace":"Browse";let Z;e[51]!==E||e[52]!==le?(Z=i.jsxs(ue,{type:"button",variant:"outline",size:"sm",onClick:E,className:"h-9 shrink-0",children:[K,le]}),e[51]=E,e[52]=le,e[53]=Z):Z=e[53];let H;e[54]!==l||e[55]!==a?(H=a&&i.jsx(ue,{type:"button",variant:"ghost",size:"sm",onClick:()=>l(""),className:"h-9 shrink-0","aria-label":"Remove file",children:i.jsx(ze,{size:14})}),e[54]=l,e[55]=a,e[56]=H):H=e[56];let G;e[57]!==O||e[58]!==Z||e[59]!==H?(G=i.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[O,Z,H]}),e[57]=O,e[58]=Z,e[59]=H,e[60]=G):G=e[60];let W;e[61]!==l?(W=B=>l(B),e[61]=l,e[62]=W):W=e[62];let Y;e[63]!==d||e[64]!==y||e[65]!==W?(Y=i.jsx(yt,{open:d,onOpenChange:y,mode:"any",onSelect:W}),e[63]=d,e[64]=y,e[65]=W,e[66]=Y):Y=e[66];let X;return e[67]!==I||e[68]!==G||e[69]!==Y||e[70]!==C?(X=i.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[C,I,G,Y]}),e[67]=I,e[68]=G,e[69]=Y,e[70]=C,e[71]=X):X=e[71],X}function Nn(t){return t.type.startsWith("video/")}const Tn=new Set(["__resolveType","@type"]);function kn(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return null;const e=t.anyOfRefs[0].resolveType;return e.endsWith("/multivariate/image.ts")?"image":e.endsWith("/multivariate/video.ts")||e.endsWith("/multivariate/file.ts")?"file":null}function _n(t){if(be(t))for(const e of t.anyOfRefs??[]){const l=e.schema?.properties?.variants?.items?.properties?.value;if(l?.type==="array"&&l.items)return l.items}}function Be(t){if(t.type==="array"&&t.items)return t;const e=t.items??_n(t);return e?{...t,type:"array",items:e}:null}function wn(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 qe(t){const{schema:e,value:n}=t;if(jt(n)){const o=Nt(n),c=Be(e);if(o!==null&&c)return i.jsx(xe,{...t,schema:c,value:o,onChange:a=>t.onChange(Tt(n,a))},t.path)}if(Array.isArray(n)&&e.type==="block-ref"&&be(e)){const o=Be(e);if(o)return i.jsx(xe,{...t,schema:o,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){const o=kn(e);return o==="image"?i.jsx(Ae,{...t},t.path):o==="file"?i.jsx(Fe,{...t},t.path):e.anyOfRefs?i.jsx(Re,{...t},t.path):null}if(e.format==="image-uri")return i.jsx(Ae,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return i.jsx(Fe,{...t},t.path);if(e.enum&&e.enum.length>0)return i.jsx(Qt,{...t},t.path);if(e.type==="anyOf")return i.jsx(Re,{...t},t.path);const r=n??wn(e.type,e.default);if(r==null)return null;const l={...t,value:r},s=n==null?e.type??typeof r:Array.isArray(r)?"array":typeof r;if(s==="array"||Array.isArray(r))return i.jsx(xe,{...l},t.path);switch(s){case"boolean":return i.jsx(Yt,{...l},t.path);case"number":case"integer":return i.jsx(Wt,{...l},t.path);case"string":{const o=e.format;return o==="color-input"?i.jsx(ce,{...l},t.path):o==="textarea"||o==="rich-text"||o==="html"?i.jsx(ce,{...l},t.path):i.jsx(ce,{...l},t.path)}case"object":return r!==null&&typeof r=="object"&&!Array.isArray(r)?i.jsx(ln,{...l},t.path):null;default:return i.jsx(ce,{...l},t.path)}}function _e(t){const e=z.c(12),{schema:n,value:r,onChange:l,basePath:s,breadcrumbPath:o,onBreadcrumbChange:c,meta:a,decofile:d,onSaveReferencedBlock:y}=t;let m,f;if(e[0]!==s||e[1]!==d||e[2]!==a||e[3]!==c||e[4]!==l||e[5]!==y||e[6]!==n.properties||e[7]!==o||e[8]!==r){f=Symbol.for("react.early_return_sentinel");e:{const p=o===void 0?[]:o,h=n.properties;if(!h){f=null;break e}const u=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},g=Object.keys(h).filter(j=>!Tn.has(j)&&h[j]?.hidden!==!0);if(g.length===0){let j;e[11]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No editable fields on this section."}),e[11]=j):j=e[11],f=j;break e}const x=(j,N)=>{l({...u,[j]:N})},v=p.length>0?tn(g,h,u,p):null,b=v?h[v]:null,A=v&&b?[v]:g;m=i.jsx("div",{className:"min-w-0 space-y-6",children:A.map(j=>{const N=h[j];if(!N)return null;const T=s?`${s}.${j}`:j,R=ve(j,N);return qe({schema:N,value:u[j],onChange:k=>x(j,k),path:T,label:R,breadcrumbPath:p,onBreadcrumbChange:c,meta:a,decofile:d,onSaveReferencedBlock:y})})})}e[0]=s,e[1]=d,e[2]=a,e[3]=c,e[4]=l,e[5]=y,e[6]=n.properties,e[7]=o,e[8]=r,e[9]=m,e[10]=f}else m=e[9],f=e[10];return f!==Symbol.for("react.early_return_sentinel")?f:m}export{_e as S,qe as a,ce as b,je as r,It as s,Gn as u};