decocms 2.288.0 → 2.289.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/dist/client/assets/{AlertCircle--Y_xi7pz.js → AlertCircle-BCfEJcld.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-adl7K_Ob.js → ArrowNarrowLeft-dDBZy2uy.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-DrcSZgbj.js → ArrowUpRight-DR20SS60.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-DeN4Arf9.js → CheckCircle-C29ChaU6.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-aTqoLskN.js → ChevronDown-CAze57fI.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-D_eqesT2.js → ChevronRight-Df7bIxwE.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-BJsJc2K_.js → ChevronUp-CTU6V7Q0.js} +1 -1
  8. package/dist/client/assets/{Container-RTpXHcc_.js → Container-Ckr-D4x-.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-DU62Ovco.js → DotsVertical-BooYL5-r.js} +1 -1
  10. package/dist/client/assets/{LinkExternal01-CZ54w6Ys.js → LinkExternal01-BF4nSmdO.js} +1 -1
  11. package/dist/client/assets/{Lock01-C1fACGdb.js → Lock01-D_RqxNIk.js} +1 -1
  12. package/dist/client/assets/{Palette-CSi1xvBX.js → Palette-Du_aKlJW.js} +1 -1
  13. package/dist/client/assets/{Play-ZwqBA0Gj.js → Play-hp4nCWPw.js} +1 -1
  14. package/dist/client/assets/{Plus-DgDw4N5v.js → Plus-C-OJiAlg.js} +1 -1
  15. package/dist/client/assets/{RefreshCcw01-BQD-u-1H.js → RefreshCcw01-Bw_4FSKr.js} +1 -1
  16. package/dist/client/assets/{SearchMd-DIPAhwlI.js → SearchMd-DRU7KH2R.js} +1 -1
  17. package/dist/client/assets/{Settings02-NWpe6nkq.js → Settings02-tDR0R-7r.js} +1 -1
  18. package/dist/client/assets/{Shield01-yW6P30XX.js → Shield01-CyMbm-kt.js} +1 -1
  19. package/dist/client/assets/{Star01-BNCw32N6.js → Star01-BSV4P3zw.js} +1 -1
  20. package/dist/client/assets/{Sun-BIhz6_CP.js → Sun-NTsERAnx.js} +1 -1
  21. package/dist/client/assets/{Tool01-DK8Fhe6_.js → Tool01-JkKJ-VBh.js} +1 -1
  22. package/dist/client/assets/{Trash01-CLPACLPe.js → Trash01-5isrbkO6.js} +1 -1
  23. package/dist/client/assets/{User01-C_p7EKq6.js → User01-CtVgwrxn.js} +1 -1
  24. package/dist/client/assets/{Users03-C5Wav_Yh.js → Users03-kskEQmar.js} +1 -1
  25. package/dist/client/assets/{X-BI3qXgCM.js → X-KZf37p0i.js} +1 -1
  26. package/dist/client/assets/{XCircle-C15LvzjS.js → XCircle-0jhuLEi-.js} +1 -1
  27. package/dist/client/assets/{XClose-xaUxE8BL.js → XClose-DmXYRRRU.js} +1 -1
  28. package/dist/client/assets/{Zap-DUrCsyVy.js → Zap-CjGMKfBw.js} +1 -1
  29. package/dist/client/assets/{ZapSquare-CzhlLfPR.js → ZapSquare-Q_j-wpZU.js} +1 -1
  30. package/dist/client/assets/{accordion-PgILOgmD.js → accordion-LhYuXsvn.js} +1 -1
  31. package/dist/client/assets/{agent-icon-Dwc2UhoB.js → agent-icon-CJBSrXXa.js} +1 -1
  32. package/dist/client/assets/{agents-list-DtDkfiBL.js → agents-list-Bj1ZEySf.js} +1 -1
  33. package/dist/client/assets/ai-providers-NZdL0YY1.js +1 -0
  34. package/dist/client/assets/{alert-dialog-P1MELuo2.js → alert-dialog-DGf6p6RH.js} +2 -2
  35. package/dist/client/assets/{auth-catchall-DXBvhnpI.js → auth-catchall-mJXjaGjq.js} +1 -1
  36. package/dist/client/assets/{automation-list-row-ZhJERDs5.js → automation-list-row-i7idsf84.js} +1 -1
  37. package/dist/client/assets/{automations-BKo3NXeb.js → automations-D5L5OUmd.js} +1 -1
  38. package/dist/client/assets/{avatar-C4Xk2I9Z.js → avatar-BiQlJs5k.js} +1 -1
  39. package/dist/client/assets/{badge-LkPgBUqp.js → badge-BiDYflRu.js} +1 -1
  40. package/dist/client/assets/{brand-context-B0xNT0Kl.js → brand-context-1aiu9Hp5.js} +1 -1
  41. package/dist/client/assets/{card-oTGN-YLV.js → card-kpHhMcOo.js} +1 -1
  42. package/dist/client/assets/{chat-context-yRGYHam2.js → chat-context-C5B4JHNW.js} +1 -1
  43. package/dist/client/assets/{checkbox-COiFtX5D.js → checkbox-DVSlEbBg.js} +1 -1
  44. package/dist/client/assets/{collection-detail-D7_Iw3uk.js → collection-detail-8OxmAVZx.js} +1 -1
  45. package/dist/client/assets/{collection-display-button-cYrSfrMz.js → collection-display-button-DJUi1nr2.js} +1 -1
  46. package/dist/client/assets/{collection-search-Biy5fWyC.js → collection-search-Cauf3WLX.js} +1 -1
  47. package/dist/client/assets/{collection-search-D8Ek-RA1.js → collection-search-G428te1f.js} +1 -1
  48. package/dist/client/assets/{collection-table-wrapper-D7Avuad7.js → collection-table-wrapper-CgJ-IWGp.js} +1 -1
  49. package/dist/client/assets/{collection-tabs-Ez6xggyp.js → collection-tabs-ImMH44oz.js} +1 -1
  50. package/dist/client/assets/{collections-h5KZ86rd.js → collections-CgvQVGim.js} +1 -1
  51. package/dist/client/assets/{command-BcjbHr_r.js → command-DUlueOVl.js} +1 -1
  52. package/dist/client/assets/{connection-card-Tvf09fuE.js → connection-card-CfcNRXjD.js} +1 -1
  53. package/dist/client/assets/{connection-detail-BOee_bXK.js → connection-detail-ZbjzvLjZ.js} +1 -1
  54. package/dist/client/assets/{connection-form-helpers-BML8fV-T.js → connection-form-helpers-CLdsDsnf.js} +1 -1
  55. package/dist/client/assets/{connections-BE48nDv7.js → connections-Db7XXBzz.js} +1 -1
  56. package/dist/client/assets/{constants-n9yTcILK.js → constants-D21LrFJ4.js} +1 -1
  57. package/dist/client/assets/{constants-Dsh71ijv.js → constants-DV1Uc_8Q.js} +2 -2
  58. package/dist/client/assets/{dialog-Dv_lEigV.js → dialog-eYBbNtPx.js} +1 -1
  59. package/dist/client/assets/{domain-settings-BcSGKzwX.js → domain-settings-5yGQjw4b.js} +1 -1
  60. package/dist/client/assets/{drawer-WXY2u6pv.js → drawer-BnROsLEL.js} +1 -1
  61. package/dist/client/assets/{dropdown-menu-B9QIvjxH.js → dropdown-menu-BeTlEYH5.js} +1 -1
  62. package/dist/client/assets/{dynamic-plugin-layout-CjDWcYO9.js → dynamic-plugin-layout-BvdykXHY.js} +1 -1
  63. package/dist/client/assets/{empty-state-DIMeCEjD.js → empty-state-B2VGunPR.js} +1 -1
  64. package/dist/client/assets/{empty-state-JxMlNoaR.js → empty-state-Dyal5Xfo.js} +1 -1
  65. package/dist/client/assets/{extract-connection-data-Cvlutde4.js → extract-connection-data-CSJgZrtD.js} +1 -1
  66. package/dist/client/assets/{features-YbryDu0n.js → features-B-66Obp6.js} +1 -1
  67. package/dist/client/assets/{form-BNoUlod_.js → form-CIMdOf9q.js} +1 -1
  68. package/dist/client/assets/{general-b6CUcDdB.js → general-D6CyCDN-.js} +1 -1
  69. package/dist/client/assets/{github-repo-picker-CP7-EChX.js → github-repo-picker-CvkiRKr8.js} +1 -1
  70. package/dist/client/assets/{index-Dig_TVyF.js → index-B07jP2sp.js} +1 -1
  71. package/dist/client/assets/{index-BVkdH26T.js → index-B0qIbTFl.js} +1 -1
  72. package/dist/client/assets/{index-Cw8cSB3k.js → index-CKiHh8tq.js} +1 -1
  73. package/dist/client/assets/{index-FXohrF1g.js → index-CQ6k5P_g.js} +1 -1
  74. package/dist/client/assets/{index-C-fdRcaZ.js → index-CQJ0POFk.js} +4 -4
  75. package/dist/client/assets/{index-CdjpBOmP.js → index-Ciwyai62.js} +1 -1
  76. package/dist/client/assets/{index-BZtydI_4.js → index-Cqh-Pw0g.js} +1 -1
  77. package/dist/client/assets/{index-CVUETRIB.js → index-D3dcRy4-.js} +28 -28
  78. package/dist/client/assets/{index-B0_K5fYx.js → index-DdZX0aDg.js} +1 -1
  79. package/dist/client/assets/{index-CjZGXiUn.js → index-Duvlh7HC.js} +1 -1
  80. package/dist/client/assets/{infiniteQueryObserver-BYD3scla.js → infiniteQueryObserver-DNXrDhz0.js} +1 -1
  81. package/dist/client/assets/{input-CL-LUIlC.js → input-BTdB8RPC.js} +1 -1
  82. package/dist/client/assets/{integration-icon-BXMU-Z0-.js → integration-icon-DJHy4-lT.js} +1 -1
  83. package/dist/client/assets/{label-Do_qw_q4.js → label-HfwUkinD.js} +1 -1
  84. package/dist/client/assets/{layout-DrFXNrUJ.js → layout-Blu93q33.js} +1 -1
  85. package/dist/client/assets/{login-B6O4fD8Q.js → login-YFb2t01p.js} +1 -1
  86. package/dist/client/assets/{members-L61ME1MY.js → members-qoLnAp5E.js} +1 -1
  87. package/dist/client/assets/{monaco-editor-BRexmFrU.js → monaco-editor-BFeXzORV.js} +1 -1
  88. package/dist/client/assets/{monitoring-stats-row-DpDZn9jY.js → monitoring-stats-row-B8LpUgZ3.js} +1 -1
  89. package/dist/client/assets/{oauth-callback-_ywR3sFa.js → oauth-callback-CXbpsVJh.js} +1 -1
  90. package/dist/client/assets/{oauth-callback-ai-provider-CpjecUsU.js → oauth-callback-ai-provider-CHi0ZwiA.js} +1 -1
  91. package/dist/client/assets/{onboarding-BHrMLfDa.js → onboarding-CS_9vzjQ.js} +1 -1
  92. package/dist/client/assets/{org-layout-BkXZ1gvy.js → org-layout-DzWFCFrp.js} +1 -1
  93. package/dist/client/assets/{org-plugin-layout-DQZ2g3kO.js → org-plugin-layout-C1udHyJg.js} +1 -1
  94. package/dist/client/assets/{plugin-empty-state-vwtahL68.js → plugin-empty-state-uSy8H1wz.js} +1 -1
  95. package/dist/client/assets/{plugin-header-BsB_du51.js → plugin-header-Y9KGqpf-.js} +1 -1
  96. package/dist/client/assets/{plugin-layout-Buej05e7.js → plugin-layout-BMUI6aZk.js} +1 -1
  97. package/dist/client/assets/{popover-C4684neQ.js → popover-0rGXbfVv.js} +1 -1
  98. package/dist/client/assets/{profile-DDmHWY6_.js → profile-Dxc4PLoS.js} +1 -1
  99. package/dist/client/assets/{project-app-view-BNwkzuii.js → project-app-view-rhNtxAKM.js} +1 -1
  100. package/dist/client/assets/registry-3CD149WE.js +2 -0
  101. package/dist/client/assets/{registry-layout-CZd2B4C7.js → registry-layout-20jGjbo6.js} +1 -1
  102. package/dist/client/assets/{required-auth-layout-SaQW2h7l.js → required-auth-layout-BrXS6Et-.js} +1 -1
  103. package/dist/client/assets/{reset-password-DDLCghhj.js → reset-password-KHQpUmrP.js} +1 -1
  104. package/dist/client/assets/{roles-DmqW3xZU.js → roles-QJpAwLWN.js} +1 -1
  105. package/dist/client/assets/{scroll-area-BmiP98pu.js → scroll-area-Cmb2U-GX.js} +1 -1
  106. package/dist/client/assets/{search-input-DQ1Xzm_b.js → search-input-Cxdo8FJH.js} +1 -1
  107. package/dist/client/assets/{select-model-CX8VF4-p.js → select-model-CepjGove.js} +1 -1
  108. package/dist/client/assets/{select-DaM3TY5t.js → select-pbe1Tw3i.js} +1 -1
  109. package/dist/client/assets/{settings-layout-DNFV8Oix.js → settings-layout-C_jpXJmC.js} +1 -1
  110. package/dist/client/assets/{settings-section-BS3Z4RWi.js → settings-section-zap-Boy4.js} +1 -1
  111. package/dist/client/assets/shell-layout-YcfNni5N.js +1 -0
  112. package/dist/client/assets/{skeleton-C8RqYCI9.js → skeleton-cT9-y8hq.js} +1 -1
  113. package/dist/client/assets/{sso-CZDbiXIw.js → sso-Bbte0m6W.js} +1 -1
  114. package/dist/client/assets/{store-CeeuB26r.js → store-CdJMoZz8.js} +1 -1
  115. package/dist/client/assets/store-registry-BT7eie06.js +2 -0
  116. package/dist/client/assets/{switch-DGYFt_K8.js → switch-CrRugnBx.js} +1 -1
  117. package/dist/client/assets/{table-BJ_I6wc6.js → table-Chd-IJRh.js} +1 -1
  118. package/dist/client/assets/{tabs-O35WvzjF.js → tabs-DvsJVzb1.js} +1 -1
  119. package/dist/client/assets/{task-status-BKkJIb6H.js → task-status-KWWNTm4M.js} +1 -1
  120. package/dist/client/assets/{textarea-CjtgfBdH.js → textarea-CWhJ3Xwe.js} +1 -1
  121. package/dist/client/assets/{toggle-group-ComSgZAp.js → toggle-group-B06Rml5A.js} +1 -1
  122. package/dist/client/assets/{tools-list-CurMUG9t.js → tools-list-DT1hnay8.js} +1 -1
  123. package/dist/client/assets/{types-DlC_80GR.js → types-DsDrkXAr.js} +1 -1
  124. package/dist/client/assets/{use-ai-providers-C3mVVuRV.js → use-ai-providers-oEGyGWt1.js} +1 -1
  125. package/dist/client/assets/{use-collections-DcKD6Qxv.js → use-collections-D8VuBtQu.js} +1 -1
  126. package/dist/client/assets/{use-connection-PZAuCSXO.js → use-connection-DATDvleR.js} +1 -1
  127. package/dist/client/assets/{use-copy-Bj-MTwaa.js → use-copy-C4JHTA85.js} +1 -1
  128. package/dist/client/assets/{use-create-virtual-mcp-B_irsl9D.js → use-create-virtual-mcp-CPp3t7Vk.js} +1 -1
  129. package/dist/client/assets/{use-decopilot-events-CDeh99iZ.js → use-decopilot-events-BmJPvHjL.js} +1 -1
  130. package/dist/client/assets/{use-delete-connection-BR9ISSGY.js → use-delete-connection-Cs_pBxVJ.js} +1 -1
  131. package/dist/client/assets/{use-infinite-scroll-D-2l__Cz.js → use-infinite-scroll-42GyaTNJ.js} +1 -1
  132. package/dist/client/assets/{use-list-state-BV21WFDK.js → use-list-state-B_acXswQ.js} +1 -1
  133. package/dist/client/assets/{use-mcp-tools-Bv5yUcCZ.js → use-mcp-tools-Bp4N36ES.js} +1 -1
  134. package/dist/client/assets/{use-members-BAhIl5n0.js → use-members-egBMdDNQ.js} +1 -1
  135. package/dist/client/assets/{use-mobile-BpBXbl16.js → use-mobile-BwJlvmat.js} +1 -1
  136. package/dist/client/assets/{use-navigate-to-agent-CG7-kp4S.js → use-navigate-to-agent-CeIX1obd.js} +1 -1
  137. package/dist/client/assets/{use-org-sso-4JoNv6HV.js → use-org-sso-D35VQct2.js} +1 -1
  138. package/dist/client/assets/{use-organization-roles-Bpj16cC4.js → use-organization-roles-DewFhO3_.js} +1 -1
  139. package/dist/client/assets/{use-organization-settings-axiNM6Y6.js → use-organization-settings-DlzwYRHw.js} +1 -1
  140. package/dist/client/assets/{use-registry-connections-fdW_5JrJ.js → use-registry-connections-BMDx5SL4.js} +1 -1
  141. package/dist/client/assets/{use-status-sounds-BYcGwXOW.js → use-status-sounds-CnYkx9X0.js} +1 -1
  142. package/dist/client/assets/{use-tasks-CEbKlK-w.js → use-tasks-BtgjavUX.js} +1 -1
  143. package/dist/client/assets/{use-view-mode-DXGS7T6x.js → use-view-mode-ni8MVEBL.js} +1 -1
  144. package/dist/client/assets/{use-virtual-mcp-C8FeHhCA.js → use-virtual-mcp-CLK92_-L.js} +1 -1
  145. package/dist/client/assets/useInfiniteQuery-NxzX8_KV.js +1 -0
  146. package/dist/client/assets/useSuspenseInfiniteQuery-BTse9xwX.js +1 -0
  147. package/dist/client/assets/{user-1OxcID9o.js → user-K40phdtq.js} +1 -1
  148. package/dist/client/assets/{view-mode-toggle-BiIaP24A.js → view-mode-toggle-Co7HEZDI.js} +1 -1
  149. package/dist/client/assets/{workflow-Dx23L5rN.js → workflow-CuFWe7ID.js} +1 -1
  150. package/dist/client/assets/workflow-detail-CoSxU_nR.js +1 -0
  151. package/dist/client/index.html +1 -1
  152. package/dist/server/cli.js +1 -1
  153. package/dist/server/node_modules/{xtend → pg}/LICENSE +7 -6
  154. package/dist/server/node_modules/pg/README.md +95 -0
  155. package/dist/server/node_modules/pg/esm/index.mjs +20 -0
  156. package/dist/server/node_modules/pg/lib/client.js +743 -0
  157. package/dist/server/node_modules/pg/lib/connection-parameters.js +171 -0
  158. package/dist/server/node_modules/pg/lib/connection.js +221 -0
  159. package/dist/server/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
  160. package/dist/server/node_modules/pg/lib/crypto/sasl.js +212 -0
  161. package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +43 -0
  162. package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +89 -0
  163. package/dist/server/node_modules/pg/lib/crypto/utils.js +9 -0
  164. package/dist/server/node_modules/pg/lib/defaults.js +91 -0
  165. package/dist/server/node_modules/pg/lib/index.js +73 -0
  166. package/dist/server/node_modules/pg/lib/native/client.js +323 -0
  167. package/dist/server/node_modules/pg/lib/native/index.js +2 -0
  168. package/dist/server/node_modules/pg/lib/native/query.js +165 -0
  169. package/dist/server/node_modules/pg/lib/query.js +252 -0
  170. package/dist/server/node_modules/pg/lib/result.js +109 -0
  171. package/dist/server/node_modules/pg/lib/stream.js +83 -0
  172. package/dist/server/node_modules/pg/lib/type-overrides.js +35 -0
  173. package/dist/server/node_modules/pg/lib/utils.js +217 -0
  174. package/dist/server/node_modules/pg/package.json +76 -0
  175. package/package.json +1 -1
  176. package/dist/client/assets/ai-providers-dl8LgpRM.js +0 -1
  177. package/dist/client/assets/registry-B2nAdztj.js +0 -2
  178. package/dist/client/assets/shell-layout-DifA2CaM.js +0 -1
  179. package/dist/client/assets/store-registry-Db_sa3Jy.js +0 -2
  180. package/dist/client/assets/useInfiniteQuery-D8Ti3aNB.js +0 -1
  181. package/dist/client/assets/useSuspenseInfiniteQuery-BOcz1SDi.js +0 -1
  182. package/dist/client/assets/workflow-detail-BMaclVeL.js +0 -1
  183. package/dist/server/node_modules/ansi-styles/index.d.ts +0 -236
  184. package/dist/server/node_modules/ansi-styles/index.js +0 -223
  185. package/dist/server/node_modules/ansi-styles/license +0 -9
  186. package/dist/server/node_modules/ansi-styles/package.json +0 -54
  187. package/dist/server/node_modules/ansi-styles/readme.md +0 -173
  188. package/dist/server/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
  189. package/dist/server/node_modules/is-fullwidth-code-point/index.js +0 -12
  190. package/dist/server/node_modules/is-fullwidth-code-point/license +0 -9
  191. package/dist/server/node_modules/is-fullwidth-code-point/package.json +0 -53
  192. package/dist/server/node_modules/is-fullwidth-code-point/readme.md +0 -31
  193. package/dist/server/node_modules/xtend/.jshintrc +0 -30
  194. package/dist/server/node_modules/xtend/README.md +0 -32
  195. package/dist/server/node_modules/xtend/immutable.js +0 -19
  196. package/dist/server/node_modules/xtend/mutable.js +0 -17
  197. package/dist/server/node_modules/xtend/package.json +0 -55
  198. package/dist/server/node_modules/xtend/test.js +0 -103
@@ -1,4 +1,4 @@
1
- import{co as Fe,bm as Os,y as oe,aC as ge,a_ as ti,bR as _i,aK as Ie,bk as mt,a$ as qe,_ as mr,cp as rn,v as _e,cq as Ii,cr as ws,cs as ec,bP as tc,ct as ia,cu as nc,cv as rc,cw as ic,cx as fn,cy as Tr,cz as xs,bK as sa,bC as sc,aJ as ze,bQ as oc,aI as On,bb as Ci,cA as ac,r as N,j as w,cB as oa,cC as lc}from"./index-CVUETRIB.js";import{e as cc,f as uc,n as fc,h as dc,C as hc,A as pc}from"./constants-Dsh71ijv.js";import{B as Ti,c as Pi}from"./collections-h5KZ86rd.js";import{R as Es}from"./index-Cw8cSB3k.js";var mc=class{apply(e,t){if(!t.type)return;const n=Array.isArray(t.type)?t.type:[t.type],r=new Set(n);if(r.has("string")||(e.string=!1),!r.has("number")&&!r.has("integer")&&(e.number=!1),r.has("boolean")||(e.boolean=!1),r.has("null")||(e.null=!1),r.has("array")||(e.array=!1),r.has("object")||(e.object=!1),r.has("integer")&&e.number!==!1){const i=e.number||ge();i instanceof rn&&(e.number=i.int())}}},yc=class{apply(e,t){if(t.const===void 0)return;const n=t.const;e.string=!1,e.number=!1,e.boolean=!1,e.null=!1,e.array=!1,e.object=!1,typeof n=="string"?e.string=qe(n):typeof n=="number"?e.number=qe(n):typeof n=="boolean"?e.boolean=qe(n):n===null?e.null=_i():Array.isArray(n)?e.array=void 0:typeof n=="object"&&(e.object=void 0)}},gc=class{apply(e,t){if(!t.enum)return;if(t.enum.length===0){t.type||(e.string=!1,e.number=!1,e.boolean=!1,e.null=!1,e.array=!1,e.object=!1);return}const n={string:t.enum.filter(r=>typeof r=="string"),number:t.enum.filter(r=>typeof r=="number"),boolean:t.enum.filter(r=>typeof r=="boolean"),null:t.enum.filter(r=>r===null),array:t.enum.filter(r=>Array.isArray(r)),object:t.enum.filter(r=>typeof r=="object"&&r!==null&&!Array.isArray(r))};e.string=this.createTypeSchema(n.string,"string"),e.number=this.createTypeSchema(n.number,"number"),e.boolean=this.createTypeSchema(n.boolean,"boolean"),e.null=n.null.length>0?_i():!1,e.array=n.array.length>0?void 0:!1,e.object=n.object.length>0?void 0:!1}createTypeSchema(e,t){if(e.length===0)return!1;if(e.length===1)return qe(e[0]);if(t==="string")return mr(e);if(t==="number"){const[n,r,...i]=e;return mt([qe(n),qe(r),...i.map(s=>qe(s))])}return t==="boolean"?mt([qe(!0),qe(!1)]):!1}},bc=class{apply(e,t){const n=t;if(n.type==="string"&&n.format==="binary"&&n.contentEncoding==="binary"){let r=ic();n.minLength!==void 0&&(r=r.min(n.minLength)),n.maxLength!==void 0&&(r=r.max(n.maxLength)),n.contentMediaType!==void 0&&(r=r.mime(n.contentMediaType)),e.file=r,e.string=!1}}},Sc=class{apply(e,t){const n=t;t.type===void 0&&(n.minLength!==void 0||n.maxLength!==void 0||n.pattern!==void 0)&&e.string===void 0&&(e.string=oe())}},vc=class{apply(e,t){const n=t;if(n.minLength!==void 0&&e.string!==!1){const r=e.string||oe();r instanceof Ii&&(e.string=r.refine(i=>Array.from(i).length>=n.minLength,{message:`String must be at least ${n.minLength} characters long`}))}}},Oc=class{apply(e,t){const n=t;if(n.maxLength!==void 0&&e.string!==!1){const r=e.string||oe();r instanceof Ii&&(e.string=r.refine(i=>Array.from(i).length<=n.maxLength,{message:`String must be at most ${n.maxLength} characters long`}))}}},wc=class{apply(e,t){const n=t;if(n.pattern&&e.string!==!1){const r=e.string||oe();if(r instanceof Ii){const i=new RegExp(n.pattern);e.string=r.regex(i)}}}},xc=class{apply(e,t){const n=t;if(n.minimum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.min(n.minimum))}}},Ec=class{apply(e,t){const n=t;if(n.maximum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.max(n.maximum))}}},Ac=class{apply(e,t){const n=t;if(n.exclusiveMinimum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(typeof n.exclusiveMinimum=="number"?e.number=r.gt(n.exclusiveMinimum):e.number=!1)}}},_c=class{apply(e,t){const n=t;if(n.exclusiveMaximum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(typeof n.exclusiveMaximum=="number"?e.number=r.lt(n.exclusiveMaximum):e.number=!1)}}},Ic=class{apply(e,t){const n=t;if(n.multipleOf!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.refine(i=>{if(n.multipleOf===0)return!1;const s=i/n.multipleOf,o=Math.round(s),a=Math.min(Math.abs(i)*Number.EPSILON*10,Math.abs(n.multipleOf)*Number.EPSILON*10);return Math.abs(s-o)<=a/Math.abs(n.multipleOf)},{message:`Must be a multiple of ${n.multipleOf}`}))}}},Cc=class{apply(e,t){const n=t;t.type===void 0&&(n.minItems!==void 0||n.maxItems!==void 0||n.items!==void 0||n.prefixItems!==void 0)&&e.array===void 0&&(e.array=Ie(Fe()))}},Tc=class{apply(e,t){const n=t;n.minItems!==void 0&&e.array!==!1&&(e.array=(e.array||Ie(Fe())).min(n.minItems))}},Pc=class{apply(e,t){const n=t;n.maxItems!==void 0&&e.array!==!1&&(e.array=(e.array||Ie(Fe())).max(n.maxItems))}},Fc=class{apply(e,t){const n=t;if(e.array!==!1)if(Array.isArray(n.items))e.array=e.array||Ie(Fe());else if(n.items&&typeof n.items!="boolean"&&!n.prefixItems){const r=Ae(n.items);let i=Ie(r);if(e.array&&e.array instanceof ec){const s=e.array._def;s.checks&&s.checks.forEach(o=>{if(o._zod&&o._zod.def){const a=o._zod.def;a.check==="min_length"&&a.minimum!==void 0?i=i.min(a.minimum):a.check==="max_length"&&a.maximum!==void 0&&(i=i.max(a.maximum))}})}e.array=i}else typeof n.items=="boolean"&&n.items===!1?n.prefixItems?e.array=e.array||Ie(Fe()):e.array=Ie(Fe()).max(0):typeof n.items=="boolean"&&n.items===!0?e.array=e.array||Ie(Fe()):n.prefixItems&&(e.array=e.array||Ie(Fe()))}},jc=class{apply(e,t){if(t.type!=="array")return;const n=t;if(!Array.isArray(n.items)||e.array===!1)return;const r=n.items.map(s=>Ae(s));let i;r.length===0?i=ws([]):i=ws(r),n.minItems!==void 0&&n.minItems>r.length&&(i=!1),n.maxItems!==void 0&&n.maxItems<r.length&&(i=!1),e.tuple=i,e.array=!1}},$c=class{apply(e,t){const n=t;e.object!==!1&&(n.properties||n.required||n.additionalProperties!==void 0)&&(e.object=e.object||_e({}).passthrough())}},Dc=class{apply(e,t){const n=t;t.type===void 0&&(n.maxProperties!==void 0||n.minProperties!==void 0)&&e.object===void 0&&(e.object=_e({}).passthrough())}},Nc=class{apply(e,t){const n=t;if(n.maxProperties!==void 0&&e.object!==!1){const r=e.object||_e({}).passthrough();e.object=r.refine(i=>Object.keys(i).length<=n.maxProperties,{message:`Object must have at most ${n.maxProperties} properties`})}}},Rc=class{apply(e,t){const n=t;if(n.minProperties!==void 0&&e.object!==!1){const r=e.object||_e({}).passthrough();e.object=r.refine(i=>Object.keys(i).length>=n.minProperties,{message:`Object must have at least ${n.minProperties} properties`})}}};function Tn(e,t){if(e===t)return!0;if(e==null||t==null)return e===t;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((n,r)=>Tn(n,t[r]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(i=>r.includes(i)&&Tn(e[i],t[i]))}return!1}function Mc(){return e=>{if(!Array.isArray(e))return!0;const t=[];return e.every(n=>t.some(i=>Tn(n,i))?!1:(t.push(n),!0))}}function cr(e,t){return e.safeParse(t).success}var Uc=class{apply(e,t){if(!t.not)return e;const n=Ae(t.not);return e.refine(r=>!cr(n,r),{message:"Value must not match the 'not' schema"})}},kc=class{apply(e,t){return t.uniqueItems!==!0?e:e.refine(Mc(),{message:"Array items must be unique"})}},Lc=class{apply(e,t){return!t.allOf||t.allOf.length===0?e:t.allOf.map(r=>Ae(r)).reduce((r,i)=>ia(r,i),e)}},Bc=class{apply(e,t){if(!t.anyOf||t.anyOf.length===0)return e;const n=t.anyOf.length===1?Ae(t.anyOf[0]):mt([Ae(t.anyOf[0]),Ae(t.anyOf[1]),...t.anyOf.slice(2).map(r=>Ae(r))]);return ia(e,n)}},Wc=class{apply(e,t){if(!t.oneOf||t.oneOf.length===0)return e;const n=t.oneOf.map(r=>Ae(r));return e.refine(r=>{let i=0;for(const s of n)if(s.safeParse(r).success&&(i++,i>1))return!1;return i===1},{message:"Value must match exactly one of the oneOf schemas"})}},qc=class{apply(e,t){const n=t;if(n.prefixItems&&Array.isArray(n.prefixItems)){const i=n.prefixItems.map(s=>Ae(s));return e.refine(s=>{if(!Array.isArray(s))return!0;for(let o=0;o<Math.min(s.length,i.length);o++)if(!cr(i[o],s[o]))return!1;if(s.length>i.length){if(typeof n.items=="boolean"&&n.items===!1)return!1;if(n.items&&typeof n.items=="object"&&!Array.isArray(n.items)){const o=Ae(n.items);for(let a=i.length;a<s.length;a++)if(!cr(o,s[a]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return e}},Vc=class{apply(e,t){const n=t;if(!n.properties&&!n.required&&n.additionalProperties!==!1)return e;if(e instanceof nc||e instanceof rc){const r={};if(n.properties)for(const[i,s]of Object.entries(n.properties))s!==void 0&&(r[i]=Ae(s));if(n.required&&Array.isArray(n.required)){const i=new Set(n.required);for(const s of Object.keys(r))i.has(s)||(r[s]=r[s].optional())}else for(const i of Object.keys(r))r[i]=r[i].optional();return n.additionalProperties===!1?_e(r):_e(r).passthrough()}return e.refine(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return!0;if(n.properties){for(const[i,s]of Object.entries(n.properties))if(s!==void 0&&Object.getOwnPropertyDescriptor(r,i)!==void 0&&!Ae(s).safeParse(r[i]).success)return!1}if(n.required&&Array.isArray(n.required)){for(const i of n.required)if(!(Object.getOwnPropertyDescriptor(r,i)!==void 0))return!1}if(n.additionalProperties===!1&&n.properties){const i=new Set(Object.keys(n.properties));for(const s in r)if(!i.has(s))return!1}return!0},{message:"Object constraints validation failed"})}},Hc=class{apply(e,t){if(!t.enum||t.enum.length===0)return e;const n=t.enum.filter(r=>Array.isArray(r)||typeof r=="object"&&r!==null);return n.length===0?e:e.refine(r=>typeof r!="object"||r===null?!0:n.some(i=>Tn(r,i)),{message:"Value must match one of the enum values"})}},Kc=class{apply(e,t){if(t.const===void 0)return e;const n=t.const;return typeof n!="object"||n===null?e:e.refine(r=>Tn(r,n),{message:"Value must equal the const value"})}},Gc=class{apply(e,t){return t.description&&(e=e.describe(t.description)),e}},zc=class{apply(e,t){var n;const r=t;return!((n=r.required)!=null&&n.includes("__proto__"))||t.type!==void 0?e:Fe().refine(i=>this.validateRequired(i,r.required),{message:"Missing required properties"})}validateRequired(e,t){return typeof e!="object"||e===null||Array.isArray(e)?!0:t.every(n=>Object.prototype.hasOwnProperty.call(e,n))}},Yc=class{apply(e,t){var n;const r=t;if(r.contains===void 0)return e;const i=Ae(r.contains),s=(n=r.minContains)!=null?n:1,o=r.maxContains;return e.refine(a=>{if(!Array.isArray(a))return!0;let l=0;for(const c of a)cr(i,c)&&l++;return!(l<s||o!==void 0&&l>o)},{message:"Array must contain required items matching the schema"})}},Jc=class{apply(e,t){const{default:n}=t;return n===void 0||!e.safeParse(n).success?e:e.default(n)}},Zc=[new yc,new gc,new mc,new bc,new Sc,new Cc,new Dc,new vc,new Oc,new wc,new xc,new Ec,new Ac,new _c,new Ic,new jc,new Tc,new Pc,new Fc,new Nc,new Rc,new $c],Xc=[new zc,new Hc,new Kc,new Lc,new Bc,new Wc,new qc,new Vc,new Yc,new Uc,new kc,new Jc,new Gc];function Ae(e){if(typeof e=="boolean")return e?Fe():Os();const t={};for(const i of Zc)i.apply(t,e);const n=[];if(t.string!==!1&&n.push(t.string||oe()),t.number!==!1&&n.push(t.number||ge()),t.boolean!==!1&&n.push(t.boolean||ti()),t.null!==!1&&n.push(t.null||_i()),t.array!==!1&&n.push(t.array||Ie(Fe())),t.tuple!==!1&&t.tuple!==void 0&&n.push(t.tuple),t.object!==!1)if(t.object)n.push(t.object);else{const i=tc(s=>typeof s=="object"&&s!==null&&!Array.isArray(s),"Must be an object, not an array");n.push(i)}t.file!==!1&&t.file!==void 0&&n.push(t.file);let r;n.length===0?r=Os():n.length===1?r=n[0]:Object.keys(e).some(s=>s!=="$schema"&&s!=="title"&&s!=="description")?r=mt(n):r=Fe();for(const i of Xc)r=i.apply(r,e);return r}class As extends Event{constructor(t,n){var r,i;super(t),this.code=(r=n?.code)!=null?r:void 0,this.message=(i=n?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,r){return r(_s(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(_s(this),n)}}function Qc(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function ni(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ni).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${ni(e.cause)}`:e.message:`${e}`}function _s(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var aa=e=>{throw TypeError(e)},Fi=(e,t,n)=>t.has(e)||aa("Cannot "+n),G=(e,t,n)=>(Fi(e,t,"read from private field"),n?n.call(e):t.get(e)),Se=(e,t,n)=>t.has(e)?aa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),he=(e,t,n,r)=>(Fi(e,t,"write to private field"),t.set(e,n),n),Qe=(e,t,n)=>(Fi(e,t,"access private method"),n),Ce,Et,kt,Qn,ur,wn,qt,xn,ct,Lt,Gt,Bt,mn,Re,ri,ii,si,Is,oi,ai,yn,li,ci;class er extends EventTarget{constructor(t,n){var r,i;super(),Se(this,Re),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Se(this,Ce),Se(this,Et),Se(this,kt),Se(this,Qn),Se(this,ur),Se(this,wn),Se(this,qt),Se(this,xn,null),Se(this,ct),Se(this,Lt),Se(this,Gt,null),Se(this,Bt,null),Se(this,mn,null),Se(this,ii,async s=>{var o;G(this,Lt).reset();const{body:a,redirected:l,status:c,headers:u}=s;if(c===204){Qe(this,Re,yn).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?he(this,kt,new URL(s.url)):he(this,kt,void 0),c!==200){Qe(this,Re,yn).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Qe(this,Re,yn).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(G(this,Ce)===this.CLOSED)return;he(this,Ce,this.OPEN);const f=new Event("open");if((o=G(this,mn))==null||o.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){Qe(this,Re,yn).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const h=new TextDecoder,m=a.getReader();let d=!0;do{const{done:p,value:y}=await m.read();y&&G(this,Lt).feed(h.decode(y,{stream:!p})),p&&(d=!1,G(this,Lt).reset(),Qe(this,Re,li).call(this))}while(d)}),Se(this,si,s=>{he(this,ct,void 0),!(s.name==="AbortError"||s.type==="aborted")&&Qe(this,Re,li).call(this,ni(s))}),Se(this,oi,s=>{typeof s.id=="string"&&he(this,xn,s.id);const o=new MessageEvent(s.event||"message",{data:s.data,origin:G(this,kt)?G(this,kt).origin:G(this,Et).origin,lastEventId:s.id||""});G(this,Bt)&&(!s.event||s.event==="message")&&G(this,Bt).call(this,o),this.dispatchEvent(o)}),Se(this,ai,s=>{he(this,wn,s)}),Se(this,ci,()=>{he(this,qt,void 0),G(this,Ce)===this.CONNECTING&&Qe(this,Re,ri).call(this)});try{if(t instanceof URL)he(this,Et,t);else if(typeof t=="string")he(this,Et,new URL(t,eu()));else throw new Error("Invalid URL")}catch{throw Qc("An invalid or illegal string was specified")}he(this,Lt,cc({onEvent:G(this,oi),onRetry:G(this,ai)})),he(this,Ce,this.CONNECTING),he(this,wn,3e3),he(this,ur,(r=n?.fetch)!=null?r:globalThis.fetch),he(this,Qn,(i=n?.withCredentials)!=null?i:!1),Qe(this,Re,ri).call(this)}get readyState(){return G(this,Ce)}get url(){return G(this,Et).href}get withCredentials(){return G(this,Qn)}get onerror(){return G(this,Gt)}set onerror(t){he(this,Gt,t)}get onmessage(){return G(this,Bt)}set onmessage(t){he(this,Bt,t)}get onopen(){return G(this,mn)}set onopen(t){he(this,mn,t)}addEventListener(t,n,r){const i=n;super.addEventListener(t,i,r)}removeEventListener(t,n,r){const i=n;super.removeEventListener(t,i,r)}close(){G(this,qt)&&clearTimeout(G(this,qt)),G(this,Ce)!==this.CLOSED&&(G(this,ct)&&G(this,ct).abort(),he(this,Ce,this.CLOSED),he(this,ct,void 0))}}Ce=new WeakMap,Et=new WeakMap,kt=new WeakMap,Qn=new WeakMap,ur=new WeakMap,wn=new WeakMap,qt=new WeakMap,xn=new WeakMap,ct=new WeakMap,Lt=new WeakMap,Gt=new WeakMap,Bt=new WeakMap,mn=new WeakMap,Re=new WeakSet,ri=function(){he(this,Ce,this.CONNECTING),he(this,ct,new AbortController),G(this,ur)(G(this,Et),Qe(this,Re,Is).call(this)).then(G(this,ii)).catch(G(this,si))},ii=new WeakMap,si=new WeakMap,Is=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...G(this,xn)?{"Last-Event-ID":G(this,xn)}:void 0},cache:"no-store",signal:(e=G(this,ct))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},oi=new WeakMap,ai=new WeakMap,yn=function(e,t){var n;G(this,Ce)!==this.CLOSED&&he(this,Ce,this.CLOSED);const r=new As("error",{code:t,message:e});(n=G(this,Gt))==null||n.call(this,r),this.dispatchEvent(r)},li=function(e,t){var n;if(G(this,Ce)===this.CLOSED)return;he(this,Ce,this.CONNECTING);const r=new As("error",{code:t,message:e});(n=G(this,Gt))==null||n.call(this,r),this.dispatchEvent(r),he(this,qt,setTimeout(G(this,ci),G(this,wn)))},ci=new WeakMap,er.CONNECTING=0,er.OPEN=1,er.CLOSED=2;function eu(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}class tu extends Error{constructor(t,n,r){super(`SSE error: ${n}`),this.code=t,this.event=r}}class nu{constructor(t,n){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=n?.eventSourceInit,this._requestInit=n?.requestInit,this._authProvider=n?.authProvider,this._fetch=n?.fetch,this._fetchWithInit=uc(n?.fetch,n?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new fn("No auth provider");let t;try{t=await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw this.onerror?.(n),n}if(t!=="AUTHORIZED")throw new fn;return await this._startOrAuth()}async _commonHeaders(){const t={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(t.Authorization=`Bearer ${r.access_token}`)}this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const n=fc(this._requestInit?.headers);return new Headers({...t,...n})}_startOrAuth(){const t=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((n,r)=>{this._eventSource=new er(this._url.href,{...this._eventSourceInit,fetch:async(i,s)=>{const o=await this._commonHeaders();o.set("Accept","text/event-stream");const a=await t(i,{...s,headers:o});if(a.status===401&&a.headers.has("www-authenticate")){const{resourceMetadataUrl:l,scope:c}=xs(a);this._resourceMetadataUrl=l,this._scope=c}return a}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{if(i.code===401&&this._authProvider){this._authThenStart().then(n,r);return}const s=new tu(i.code,i.message,i);r(s),this.onerror?.(s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",i=>{const s=i;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(o){r(o),this.onerror?.(o),this.close();return}n()}),this._eventSource.onmessage=i=>{const s=i;let o;try{o=sa.parse(JSON.parse(s.data))}catch(a){this.onerror?.(a);return}this.onmessage?.(o)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(t){if(!this._authProvider)throw new fn("No auth provider");if(await Tr(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fn("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(t){if(!this._endpoint)throw new Error("Not connected");try{const n=await this._commonHeaders();n.set("content-type","application/json");const r={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(t),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._endpoint,r);if(!i.ok){const s=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){const{resourceMetadataUrl:o,scope:a}=xs(i);if(this._resourceMetadataUrl=o,this._scope=a,await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fn;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${i.status}): ${s}`)}await i.body?.cancel()}catch(n){throw this.onerror?.(n),n}}setProtocolVersion(t){this._protocolVersion=t}}const ru="mcp";class iu{constructor(t){this._url=t}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,n)=>{this._socket=new WebSocket(this._url,ru),this._socket.onerror=r=>{const i="error"in r?r.error:new Error(`WebSocket error: ${JSON.stringify(r)}`);n(i),this.onerror?.(i)},this._socket.onopen=()=>{t()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=r=>{let i;try{i=sa.parse(JSON.parse(r.data))}catch(s){this.onerror?.(s);return}this.onmessage?.(i)}})}async close(){this._socket?.close()}send(t){return new Promise((n,r)=>{if(!this._socket){r(new Error("Not connected"));return}this._socket?.send(JSON.stringify(t)),n()})}}class su extends dc{constructor(t,n){super(t,n)}send(t,n){const r=ou(t);return r?.type==="emit"?(this.onmessage?.(r.message),Promise.resolve()):r?.type==="suppress"?Promise.resolve():super.send(t,n)}}function ou(e){const t=e;if(!t||typeof t!="object"||!("method"in t))return null;switch(t.method){case"initialize":{const n=t?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:t.jsonrpc??"2.0",id:t.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}class au extends hc{constructor(t,n){super(t,n)}async listTools(t,n){return await this.request({method:"tools/list",params:t},sc,n)}}const lu=async(e,t,n)=>{const r=cu(e.connection,t,n);if(!r)throw new Error("Unknown MCP connection type");const i=new au({name:e?.name??"MCP Client",version:"1.0.0"});return await i.connect(r),{client:i}},cu=(e,t,n)=>{if(e.type==="Websocket")return new iu(new URL(e.url));if(e.type!=="SSE"&&e.type!=="HTTP")return null;const i={...e.token?{authorization:`Bearer ${e.token}`}:{},...n??{},..."headers"in e?e.headers||{}:{}};if(e.type==="SSE"){const s={requestInit:{headers:i,signal:t}};return e.token&&(s.eventSourceInit={fetch:(o,a)=>fetch(o,{...a,headers:{...i,Accept:"text/event-stream"},signal:t})}),new nu(new URL(e.url),s)}return new su(new URL(e.url),{requestInit:{headers:i,signal:t,credentials:"include"}})},Cs=e=>{try{return JSON.parse(e)}catch{return e}},zn=new Map,Ts=(e,t)=>({...e,id:e.name,inputSchema:e.inputSchema?Ae(e.inputSchema):void 0,outputSchema:e.outputSchema?Ae(e.outputSchema):void 0,execute:n=>t(n.context,e.name)});function uu(e){const t=n=>"connection"in e?lu({connection:e.connection},void 0,n):e.client;return new Proxy({},{get(n,r){if(r==="toJSON")return null;if(typeof r!="string")throw new Error("Name must be a string");if(r==="listTools")return a;async function i(l,c=r){const u=e?.debugId?.(),f=u?{"x-trace-debug-id":u}:void 0,{client:h}=await t(f),{structuredContent:m,isError:d,content:p}=await h.callTool({name:String(c),arguments:l});if(d){const S=p?.[0]?.text,O=typeof S=="string"?Cs(S):null,E=O?.code&&typeof e?.getErrorByStatusCode=="function"?e.getErrorByStatusCode(O.code,O.message,O.traceId):null;throw E||new Error(`Tool ${String(c)} returned an error: ${JSON.stringify(m??p)}`)}if(m!==void 0)return m;const y=p?.[0]?.text;return typeof y=="string"?Cs(y):void 0}async function s(){const{client:l}=await t(),{tools:c}=await l.listTools();return c}async function o(){if(!("connection"in e))return s();const l=e.connection,c=JSON.stringify(l);try{return zn.has(c)||zn.set(c,s()),await zn.get(c)}catch(u){console.error("Failed to list tools",u),zn.delete(c);return}}async function a(){return(await o()??[]).map(c=>Ts(c,i))}return i.asTool=async()=>{const c=(await o()??[]).find(u=>u.name===r);if(!c)throw new Error(`Tool ${r} not found`);return Ts(c,i)},i}})}new Proxy({},{get(e,t){return t==="toJSON"?null:t==="forConnection"?n=>fu({connection:n}):global[t]}});function fu(e){return uu(e)}const du=_e({toolName:oe().describe("Name of the tool to invoke on that connection"),transformCode:oe().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(stepInput): Output { ... }`\n The stepInput will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output.\n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),hu=_e({code:oe().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(stepInput): Output { ... }\`
1
+ import{cp as Fe,bn as Os,y as oe,aC as ge,a_ as ti,bS as _i,aK as Ie,bl as mt,a$ as qe,_ as mr,cq as rn,v as _e,cr as Ii,cs as ws,ct as ec,bQ as tc,cu as ia,cv as nc,cw as rc,cx as ic,cy as fn,cz as Tr,cA as xs,bL as sa,bD as sc,aJ as ze,bR as oc,aI as On,bb as Ci,cB as ac,r as N,j as w,cC as oa,cD as lc}from"./index-D3dcRy4-.js";import{e as cc,f as uc,n as fc,h as dc,C as hc,A as pc}from"./constants-DV1Uc_8Q.js";import{B as Ti,c as Pi}from"./collections-CgvQVGim.js";import{R as Es}from"./index-CKiHh8tq.js";var mc=class{apply(e,t){if(!t.type)return;const n=Array.isArray(t.type)?t.type:[t.type],r=new Set(n);if(r.has("string")||(e.string=!1),!r.has("number")&&!r.has("integer")&&(e.number=!1),r.has("boolean")||(e.boolean=!1),r.has("null")||(e.null=!1),r.has("array")||(e.array=!1),r.has("object")||(e.object=!1),r.has("integer")&&e.number!==!1){const i=e.number||ge();i instanceof rn&&(e.number=i.int())}}},yc=class{apply(e,t){if(t.const===void 0)return;const n=t.const;e.string=!1,e.number=!1,e.boolean=!1,e.null=!1,e.array=!1,e.object=!1,typeof n=="string"?e.string=qe(n):typeof n=="number"?e.number=qe(n):typeof n=="boolean"?e.boolean=qe(n):n===null?e.null=_i():Array.isArray(n)?e.array=void 0:typeof n=="object"&&(e.object=void 0)}},gc=class{apply(e,t){if(!t.enum)return;if(t.enum.length===0){t.type||(e.string=!1,e.number=!1,e.boolean=!1,e.null=!1,e.array=!1,e.object=!1);return}const n={string:t.enum.filter(r=>typeof r=="string"),number:t.enum.filter(r=>typeof r=="number"),boolean:t.enum.filter(r=>typeof r=="boolean"),null:t.enum.filter(r=>r===null),array:t.enum.filter(r=>Array.isArray(r)),object:t.enum.filter(r=>typeof r=="object"&&r!==null&&!Array.isArray(r))};e.string=this.createTypeSchema(n.string,"string"),e.number=this.createTypeSchema(n.number,"number"),e.boolean=this.createTypeSchema(n.boolean,"boolean"),e.null=n.null.length>0?_i():!1,e.array=n.array.length>0?void 0:!1,e.object=n.object.length>0?void 0:!1}createTypeSchema(e,t){if(e.length===0)return!1;if(e.length===1)return qe(e[0]);if(t==="string")return mr(e);if(t==="number"){const[n,r,...i]=e;return mt([qe(n),qe(r),...i.map(s=>qe(s))])}return t==="boolean"?mt([qe(!0),qe(!1)]):!1}},bc=class{apply(e,t){const n=t;if(n.type==="string"&&n.format==="binary"&&n.contentEncoding==="binary"){let r=ic();n.minLength!==void 0&&(r=r.min(n.minLength)),n.maxLength!==void 0&&(r=r.max(n.maxLength)),n.contentMediaType!==void 0&&(r=r.mime(n.contentMediaType)),e.file=r,e.string=!1}}},Sc=class{apply(e,t){const n=t;t.type===void 0&&(n.minLength!==void 0||n.maxLength!==void 0||n.pattern!==void 0)&&e.string===void 0&&(e.string=oe())}},vc=class{apply(e,t){const n=t;if(n.minLength!==void 0&&e.string!==!1){const r=e.string||oe();r instanceof Ii&&(e.string=r.refine(i=>Array.from(i).length>=n.minLength,{message:`String must be at least ${n.minLength} characters long`}))}}},Oc=class{apply(e,t){const n=t;if(n.maxLength!==void 0&&e.string!==!1){const r=e.string||oe();r instanceof Ii&&(e.string=r.refine(i=>Array.from(i).length<=n.maxLength,{message:`String must be at most ${n.maxLength} characters long`}))}}},wc=class{apply(e,t){const n=t;if(n.pattern&&e.string!==!1){const r=e.string||oe();if(r instanceof Ii){const i=new RegExp(n.pattern);e.string=r.regex(i)}}}},xc=class{apply(e,t){const n=t;if(n.minimum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.min(n.minimum))}}},Ec=class{apply(e,t){const n=t;if(n.maximum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.max(n.maximum))}}},Ac=class{apply(e,t){const n=t;if(n.exclusiveMinimum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(typeof n.exclusiveMinimum=="number"?e.number=r.gt(n.exclusiveMinimum):e.number=!1)}}},_c=class{apply(e,t){const n=t;if(n.exclusiveMaximum!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(typeof n.exclusiveMaximum=="number"?e.number=r.lt(n.exclusiveMaximum):e.number=!1)}}},Ic=class{apply(e,t){const n=t;if(n.multipleOf!==void 0&&e.number!==!1){const r=e.number||ge();r instanceof rn&&(e.number=r.refine(i=>{if(n.multipleOf===0)return!1;const s=i/n.multipleOf,o=Math.round(s),a=Math.min(Math.abs(i)*Number.EPSILON*10,Math.abs(n.multipleOf)*Number.EPSILON*10);return Math.abs(s-o)<=a/Math.abs(n.multipleOf)},{message:`Must be a multiple of ${n.multipleOf}`}))}}},Cc=class{apply(e,t){const n=t;t.type===void 0&&(n.minItems!==void 0||n.maxItems!==void 0||n.items!==void 0||n.prefixItems!==void 0)&&e.array===void 0&&(e.array=Ie(Fe()))}},Tc=class{apply(e,t){const n=t;n.minItems!==void 0&&e.array!==!1&&(e.array=(e.array||Ie(Fe())).min(n.minItems))}},Pc=class{apply(e,t){const n=t;n.maxItems!==void 0&&e.array!==!1&&(e.array=(e.array||Ie(Fe())).max(n.maxItems))}},Fc=class{apply(e,t){const n=t;if(e.array!==!1)if(Array.isArray(n.items))e.array=e.array||Ie(Fe());else if(n.items&&typeof n.items!="boolean"&&!n.prefixItems){const r=Ae(n.items);let i=Ie(r);if(e.array&&e.array instanceof ec){const s=e.array._def;s.checks&&s.checks.forEach(o=>{if(o._zod&&o._zod.def){const a=o._zod.def;a.check==="min_length"&&a.minimum!==void 0?i=i.min(a.minimum):a.check==="max_length"&&a.maximum!==void 0&&(i=i.max(a.maximum))}})}e.array=i}else typeof n.items=="boolean"&&n.items===!1?n.prefixItems?e.array=e.array||Ie(Fe()):e.array=Ie(Fe()).max(0):typeof n.items=="boolean"&&n.items===!0?e.array=e.array||Ie(Fe()):n.prefixItems&&(e.array=e.array||Ie(Fe()))}},jc=class{apply(e,t){if(t.type!=="array")return;const n=t;if(!Array.isArray(n.items)||e.array===!1)return;const r=n.items.map(s=>Ae(s));let i;r.length===0?i=ws([]):i=ws(r),n.minItems!==void 0&&n.minItems>r.length&&(i=!1),n.maxItems!==void 0&&n.maxItems<r.length&&(i=!1),e.tuple=i,e.array=!1}},$c=class{apply(e,t){const n=t;e.object!==!1&&(n.properties||n.required||n.additionalProperties!==void 0)&&(e.object=e.object||_e({}).passthrough())}},Dc=class{apply(e,t){const n=t;t.type===void 0&&(n.maxProperties!==void 0||n.minProperties!==void 0)&&e.object===void 0&&(e.object=_e({}).passthrough())}},Nc=class{apply(e,t){const n=t;if(n.maxProperties!==void 0&&e.object!==!1){const r=e.object||_e({}).passthrough();e.object=r.refine(i=>Object.keys(i).length<=n.maxProperties,{message:`Object must have at most ${n.maxProperties} properties`})}}},Rc=class{apply(e,t){const n=t;if(n.minProperties!==void 0&&e.object!==!1){const r=e.object||_e({}).passthrough();e.object=r.refine(i=>Object.keys(i).length>=n.minProperties,{message:`Object must have at least ${n.minProperties} properties`})}}};function Tn(e,t){if(e===t)return!0;if(e==null||t==null)return e===t;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((n,r)=>Tn(n,t[r]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(i=>r.includes(i)&&Tn(e[i],t[i]))}return!1}function Mc(){return e=>{if(!Array.isArray(e))return!0;const t=[];return e.every(n=>t.some(i=>Tn(n,i))?!1:(t.push(n),!0))}}function cr(e,t){return e.safeParse(t).success}var Uc=class{apply(e,t){if(!t.not)return e;const n=Ae(t.not);return e.refine(r=>!cr(n,r),{message:"Value must not match the 'not' schema"})}},kc=class{apply(e,t){return t.uniqueItems!==!0?e:e.refine(Mc(),{message:"Array items must be unique"})}},Lc=class{apply(e,t){return!t.allOf||t.allOf.length===0?e:t.allOf.map(r=>Ae(r)).reduce((r,i)=>ia(r,i),e)}},Bc=class{apply(e,t){if(!t.anyOf||t.anyOf.length===0)return e;const n=t.anyOf.length===1?Ae(t.anyOf[0]):mt([Ae(t.anyOf[0]),Ae(t.anyOf[1]),...t.anyOf.slice(2).map(r=>Ae(r))]);return ia(e,n)}},Wc=class{apply(e,t){if(!t.oneOf||t.oneOf.length===0)return e;const n=t.oneOf.map(r=>Ae(r));return e.refine(r=>{let i=0;for(const s of n)if(s.safeParse(r).success&&(i++,i>1))return!1;return i===1},{message:"Value must match exactly one of the oneOf schemas"})}},qc=class{apply(e,t){const n=t;if(n.prefixItems&&Array.isArray(n.prefixItems)){const i=n.prefixItems.map(s=>Ae(s));return e.refine(s=>{if(!Array.isArray(s))return!0;for(let o=0;o<Math.min(s.length,i.length);o++)if(!cr(i[o],s[o]))return!1;if(s.length>i.length){if(typeof n.items=="boolean"&&n.items===!1)return!1;if(n.items&&typeof n.items=="object"&&!Array.isArray(n.items)){const o=Ae(n.items);for(let a=i.length;a<s.length;a++)if(!cr(o,s[a]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return e}},Vc=class{apply(e,t){const n=t;if(!n.properties&&!n.required&&n.additionalProperties!==!1)return e;if(e instanceof nc||e instanceof rc){const r={};if(n.properties)for(const[i,s]of Object.entries(n.properties))s!==void 0&&(r[i]=Ae(s));if(n.required&&Array.isArray(n.required)){const i=new Set(n.required);for(const s of Object.keys(r))i.has(s)||(r[s]=r[s].optional())}else for(const i of Object.keys(r))r[i]=r[i].optional();return n.additionalProperties===!1?_e(r):_e(r).passthrough()}return e.refine(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return!0;if(n.properties){for(const[i,s]of Object.entries(n.properties))if(s!==void 0&&Object.getOwnPropertyDescriptor(r,i)!==void 0&&!Ae(s).safeParse(r[i]).success)return!1}if(n.required&&Array.isArray(n.required)){for(const i of n.required)if(!(Object.getOwnPropertyDescriptor(r,i)!==void 0))return!1}if(n.additionalProperties===!1&&n.properties){const i=new Set(Object.keys(n.properties));for(const s in r)if(!i.has(s))return!1}return!0},{message:"Object constraints validation failed"})}},Hc=class{apply(e,t){if(!t.enum||t.enum.length===0)return e;const n=t.enum.filter(r=>Array.isArray(r)||typeof r=="object"&&r!==null);return n.length===0?e:e.refine(r=>typeof r!="object"||r===null?!0:n.some(i=>Tn(r,i)),{message:"Value must match one of the enum values"})}},Kc=class{apply(e,t){if(t.const===void 0)return e;const n=t.const;return typeof n!="object"||n===null?e:e.refine(r=>Tn(r,n),{message:"Value must equal the const value"})}},Gc=class{apply(e,t){return t.description&&(e=e.describe(t.description)),e}},zc=class{apply(e,t){var n;const r=t;return!((n=r.required)!=null&&n.includes("__proto__"))||t.type!==void 0?e:Fe().refine(i=>this.validateRequired(i,r.required),{message:"Missing required properties"})}validateRequired(e,t){return typeof e!="object"||e===null||Array.isArray(e)?!0:t.every(n=>Object.prototype.hasOwnProperty.call(e,n))}},Yc=class{apply(e,t){var n;const r=t;if(r.contains===void 0)return e;const i=Ae(r.contains),s=(n=r.minContains)!=null?n:1,o=r.maxContains;return e.refine(a=>{if(!Array.isArray(a))return!0;let l=0;for(const c of a)cr(i,c)&&l++;return!(l<s||o!==void 0&&l>o)},{message:"Array must contain required items matching the schema"})}},Jc=class{apply(e,t){const{default:n}=t;return n===void 0||!e.safeParse(n).success?e:e.default(n)}},Zc=[new yc,new gc,new mc,new bc,new Sc,new Cc,new Dc,new vc,new Oc,new wc,new xc,new Ec,new Ac,new _c,new Ic,new jc,new Tc,new Pc,new Fc,new Nc,new Rc,new $c],Xc=[new zc,new Hc,new Kc,new Lc,new Bc,new Wc,new qc,new Vc,new Yc,new Uc,new kc,new Jc,new Gc];function Ae(e){if(typeof e=="boolean")return e?Fe():Os();const t={};for(const i of Zc)i.apply(t,e);const n=[];if(t.string!==!1&&n.push(t.string||oe()),t.number!==!1&&n.push(t.number||ge()),t.boolean!==!1&&n.push(t.boolean||ti()),t.null!==!1&&n.push(t.null||_i()),t.array!==!1&&n.push(t.array||Ie(Fe())),t.tuple!==!1&&t.tuple!==void 0&&n.push(t.tuple),t.object!==!1)if(t.object)n.push(t.object);else{const i=tc(s=>typeof s=="object"&&s!==null&&!Array.isArray(s),"Must be an object, not an array");n.push(i)}t.file!==!1&&t.file!==void 0&&n.push(t.file);let r;n.length===0?r=Os():n.length===1?r=n[0]:Object.keys(e).some(s=>s!=="$schema"&&s!=="title"&&s!=="description")?r=mt(n):r=Fe();for(const i of Xc)r=i.apply(r,e);return r}class As extends Event{constructor(t,n){var r,i;super(t),this.code=(r=n?.code)!=null?r:void 0,this.message=(i=n?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,r){return r(_s(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(_s(this),n)}}function Qc(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function ni(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ni).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${ni(e.cause)}`:e.message:`${e}`}function _s(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var aa=e=>{throw TypeError(e)},Fi=(e,t,n)=>t.has(e)||aa("Cannot "+n),G=(e,t,n)=>(Fi(e,t,"read from private field"),n?n.call(e):t.get(e)),Se=(e,t,n)=>t.has(e)?aa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),he=(e,t,n,r)=>(Fi(e,t,"write to private field"),t.set(e,n),n),Qe=(e,t,n)=>(Fi(e,t,"access private method"),n),Ce,Et,kt,Qn,ur,wn,qt,xn,ct,Lt,Gt,Bt,mn,Re,ri,ii,si,Is,oi,ai,yn,li,ci;class er extends EventTarget{constructor(t,n){var r,i;super(),Se(this,Re),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Se(this,Ce),Se(this,Et),Se(this,kt),Se(this,Qn),Se(this,ur),Se(this,wn),Se(this,qt),Se(this,xn,null),Se(this,ct),Se(this,Lt),Se(this,Gt,null),Se(this,Bt,null),Se(this,mn,null),Se(this,ii,async s=>{var o;G(this,Lt).reset();const{body:a,redirected:l,status:c,headers:u}=s;if(c===204){Qe(this,Re,yn).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?he(this,kt,new URL(s.url)):he(this,kt,void 0),c!==200){Qe(this,Re,yn).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Qe(this,Re,yn).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(G(this,Ce)===this.CLOSED)return;he(this,Ce,this.OPEN);const f=new Event("open");if((o=G(this,mn))==null||o.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){Qe(this,Re,yn).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const h=new TextDecoder,m=a.getReader();let d=!0;do{const{done:p,value:y}=await m.read();y&&G(this,Lt).feed(h.decode(y,{stream:!p})),p&&(d=!1,G(this,Lt).reset(),Qe(this,Re,li).call(this))}while(d)}),Se(this,si,s=>{he(this,ct,void 0),!(s.name==="AbortError"||s.type==="aborted")&&Qe(this,Re,li).call(this,ni(s))}),Se(this,oi,s=>{typeof s.id=="string"&&he(this,xn,s.id);const o=new MessageEvent(s.event||"message",{data:s.data,origin:G(this,kt)?G(this,kt).origin:G(this,Et).origin,lastEventId:s.id||""});G(this,Bt)&&(!s.event||s.event==="message")&&G(this,Bt).call(this,o),this.dispatchEvent(o)}),Se(this,ai,s=>{he(this,wn,s)}),Se(this,ci,()=>{he(this,qt,void 0),G(this,Ce)===this.CONNECTING&&Qe(this,Re,ri).call(this)});try{if(t instanceof URL)he(this,Et,t);else if(typeof t=="string")he(this,Et,new URL(t,eu()));else throw new Error("Invalid URL")}catch{throw Qc("An invalid or illegal string was specified")}he(this,Lt,cc({onEvent:G(this,oi),onRetry:G(this,ai)})),he(this,Ce,this.CONNECTING),he(this,wn,3e3),he(this,ur,(r=n?.fetch)!=null?r:globalThis.fetch),he(this,Qn,(i=n?.withCredentials)!=null?i:!1),Qe(this,Re,ri).call(this)}get readyState(){return G(this,Ce)}get url(){return G(this,Et).href}get withCredentials(){return G(this,Qn)}get onerror(){return G(this,Gt)}set onerror(t){he(this,Gt,t)}get onmessage(){return G(this,Bt)}set onmessage(t){he(this,Bt,t)}get onopen(){return G(this,mn)}set onopen(t){he(this,mn,t)}addEventListener(t,n,r){const i=n;super.addEventListener(t,i,r)}removeEventListener(t,n,r){const i=n;super.removeEventListener(t,i,r)}close(){G(this,qt)&&clearTimeout(G(this,qt)),G(this,Ce)!==this.CLOSED&&(G(this,ct)&&G(this,ct).abort(),he(this,Ce,this.CLOSED),he(this,ct,void 0))}}Ce=new WeakMap,Et=new WeakMap,kt=new WeakMap,Qn=new WeakMap,ur=new WeakMap,wn=new WeakMap,qt=new WeakMap,xn=new WeakMap,ct=new WeakMap,Lt=new WeakMap,Gt=new WeakMap,Bt=new WeakMap,mn=new WeakMap,Re=new WeakSet,ri=function(){he(this,Ce,this.CONNECTING),he(this,ct,new AbortController),G(this,ur)(G(this,Et),Qe(this,Re,Is).call(this)).then(G(this,ii)).catch(G(this,si))},ii=new WeakMap,si=new WeakMap,Is=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...G(this,xn)?{"Last-Event-ID":G(this,xn)}:void 0},cache:"no-store",signal:(e=G(this,ct))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},oi=new WeakMap,ai=new WeakMap,yn=function(e,t){var n;G(this,Ce)!==this.CLOSED&&he(this,Ce,this.CLOSED);const r=new As("error",{code:t,message:e});(n=G(this,Gt))==null||n.call(this,r),this.dispatchEvent(r)},li=function(e,t){var n;if(G(this,Ce)===this.CLOSED)return;he(this,Ce,this.CONNECTING);const r=new As("error",{code:t,message:e});(n=G(this,Gt))==null||n.call(this,r),this.dispatchEvent(r),he(this,qt,setTimeout(G(this,ci),G(this,wn)))},ci=new WeakMap,er.CONNECTING=0,er.OPEN=1,er.CLOSED=2;function eu(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}class tu extends Error{constructor(t,n,r){super(`SSE error: ${n}`),this.code=t,this.event=r}}class nu{constructor(t,n){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=n?.eventSourceInit,this._requestInit=n?.requestInit,this._authProvider=n?.authProvider,this._fetch=n?.fetch,this._fetchWithInit=uc(n?.fetch,n?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new fn("No auth provider");let t;try{t=await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw this.onerror?.(n),n}if(t!=="AUTHORIZED")throw new fn;return await this._startOrAuth()}async _commonHeaders(){const t={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(t.Authorization=`Bearer ${r.access_token}`)}this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const n=fc(this._requestInit?.headers);return new Headers({...t,...n})}_startOrAuth(){const t=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((n,r)=>{this._eventSource=new er(this._url.href,{...this._eventSourceInit,fetch:async(i,s)=>{const o=await this._commonHeaders();o.set("Accept","text/event-stream");const a=await t(i,{...s,headers:o});if(a.status===401&&a.headers.has("www-authenticate")){const{resourceMetadataUrl:l,scope:c}=xs(a);this._resourceMetadataUrl=l,this._scope=c}return a}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{if(i.code===401&&this._authProvider){this._authThenStart().then(n,r);return}const s=new tu(i.code,i.message,i);r(s),this.onerror?.(s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",i=>{const s=i;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(o){r(o),this.onerror?.(o),this.close();return}n()}),this._eventSource.onmessage=i=>{const s=i;let o;try{o=sa.parse(JSON.parse(s.data))}catch(a){this.onerror?.(a);return}this.onmessage?.(o)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(t){if(!this._authProvider)throw new fn("No auth provider");if(await Tr(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fn("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(t){if(!this._endpoint)throw new Error("Not connected");try{const n=await this._commonHeaders();n.set("content-type","application/json");const r={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(t),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._endpoint,r);if(!i.ok){const s=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){const{resourceMetadataUrl:o,scope:a}=xs(i);if(this._resourceMetadataUrl=o,this._scope=a,await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new fn;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${i.status}): ${s}`)}await i.body?.cancel()}catch(n){throw this.onerror?.(n),n}}setProtocolVersion(t){this._protocolVersion=t}}const ru="mcp";class iu{constructor(t){this._url=t}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,n)=>{this._socket=new WebSocket(this._url,ru),this._socket.onerror=r=>{const i="error"in r?r.error:new Error(`WebSocket error: ${JSON.stringify(r)}`);n(i),this.onerror?.(i)},this._socket.onopen=()=>{t()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=r=>{let i;try{i=sa.parse(JSON.parse(r.data))}catch(s){this.onerror?.(s);return}this.onmessage?.(i)}})}async close(){this._socket?.close()}send(t){return new Promise((n,r)=>{if(!this._socket){r(new Error("Not connected"));return}this._socket?.send(JSON.stringify(t)),n()})}}class su extends dc{constructor(t,n){super(t,n)}send(t,n){const r=ou(t);return r?.type==="emit"?(this.onmessage?.(r.message),Promise.resolve()):r?.type==="suppress"?Promise.resolve():super.send(t,n)}}function ou(e){const t=e;if(!t||typeof t!="object"||!("method"in t))return null;switch(t.method){case"initialize":{const n=t?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:t.jsonrpc??"2.0",id:t.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}class au extends hc{constructor(t,n){super(t,n)}async listTools(t,n){return await this.request({method:"tools/list",params:t},sc,n)}}const lu=async(e,t,n)=>{const r=cu(e.connection,t,n);if(!r)throw new Error("Unknown MCP connection type");const i=new au({name:e?.name??"MCP Client",version:"1.0.0"});return await i.connect(r),{client:i}},cu=(e,t,n)=>{if(e.type==="Websocket")return new iu(new URL(e.url));if(e.type!=="SSE"&&e.type!=="HTTP")return null;const i={...e.token?{authorization:`Bearer ${e.token}`}:{},...n??{},..."headers"in e?e.headers||{}:{}};if(e.type==="SSE"){const s={requestInit:{headers:i,signal:t}};return e.token&&(s.eventSourceInit={fetch:(o,a)=>fetch(o,{...a,headers:{...i,Accept:"text/event-stream"},signal:t})}),new nu(new URL(e.url),s)}return new su(new URL(e.url),{requestInit:{headers:i,signal:t,credentials:"include"}})},Cs=e=>{try{return JSON.parse(e)}catch{return e}},zn=new Map,Ts=(e,t)=>({...e,id:e.name,inputSchema:e.inputSchema?Ae(e.inputSchema):void 0,outputSchema:e.outputSchema?Ae(e.outputSchema):void 0,execute:n=>t(n.context,e.name)});function uu(e){const t=n=>"connection"in e?lu({connection:e.connection},void 0,n):e.client;return new Proxy({},{get(n,r){if(r==="toJSON")return null;if(typeof r!="string")throw new Error("Name must be a string");if(r==="listTools")return a;async function i(l,c=r){const u=e?.debugId?.(),f=u?{"x-trace-debug-id":u}:void 0,{client:h}=await t(f),{structuredContent:m,isError:d,content:p}=await h.callTool({name:String(c),arguments:l});if(d){const S=p?.[0]?.text,O=typeof S=="string"?Cs(S):null,E=O?.code&&typeof e?.getErrorByStatusCode=="function"?e.getErrorByStatusCode(O.code,O.message,O.traceId):null;throw E||new Error(`Tool ${String(c)} returned an error: ${JSON.stringify(m??p)}`)}if(m!==void 0)return m;const y=p?.[0]?.text;return typeof y=="string"?Cs(y):void 0}async function s(){const{client:l}=await t(),{tools:c}=await l.listTools();return c}async function o(){if(!("connection"in e))return s();const l=e.connection,c=JSON.stringify(l);try{return zn.has(c)||zn.set(c,s()),await zn.get(c)}catch(u){console.error("Failed to list tools",u),zn.delete(c);return}}async function a(){return(await o()??[]).map(c=>Ts(c,i))}return i.asTool=async()=>{const c=(await o()??[]).find(u=>u.name===r);if(!c)throw new Error(`Tool ${r} not found`);return Ts(c,i)},i}})}new Proxy({},{get(e,t){return t==="toJSON"?null:t==="forConnection"?n=>fu({connection:n}):global[t]}});function fu(e){return uu(e)}const du=_e({toolName:oe().describe("Name of the tool to invoke on that connection"),transformCode:oe().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(stepInput): Output { ... }`\n The stepInput will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output.\n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),hu=_e({code:oe().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(stepInput): Output { ... }\`
2
2
  The stepInput is the resolved value of the references in the input field. Example:
3
3
  {
4
4
  "input": {
@@ -1 +1 @@
1
- import{r as n,aU as q,bY as R,bZ as Ee,b_ as ke,b$ as Se,be as xe,c0 as j}from"./index-CVUETRIB.js";var de=1,Ie=.9,Ce=.8,Re=.17,Z=.1,Q=.999,Ae=.9999,Me=.99,$e=/[\\\/_+.#"@\[\(\{&]/,De=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ve=/[\s-]/g;function ee(t,l,r,f,u,c,d){if(c===l.length)return u===t.length?de:Me;var v=`${u},${c}`;if(d[v]!==void 0)return d[v];for(var b=f.charAt(c),i=r.indexOf(b,u),p=0,h,x,E,I;i>=0;)h=ee(t,l,r,f,i+1,c+1,d),h>p&&(i===u?h*=de:$e.test(t.charAt(i-1))?(h*=Ce,E=t.slice(u,i-1).match(De),E&&u>0&&(h*=Math.pow(Q,E.length))):Fe.test(t.charAt(i-1))?(h*=Ie,I=t.slice(u,i-1).match(ve),I&&u>0&&(h*=Math.pow(Q,I.length))):(h*=Re,u>0&&(h*=Math.pow(Q,i-u))),t.charAt(i)!==l.charAt(c)&&(h*=Ae)),(h<Z&&r.charAt(i-1)===f.charAt(c+1)||f.charAt(c+1)===f.charAt(c)&&r.charAt(i-1)!==f.charAt(c))&&(x=ee(t,l,r,f,i+1,c+2,d),x*Z>h&&(h=x*Z)),h>p&&(p=h),i=r.indexOf(b,i+1);return d[v]=p,p}function se(t){return t.toLowerCase().replace(ve," ")}function Ke(t,l,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ee(t,l,se(t),se(l),0,0,{})}var V='[cmdk-group=""]',_='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',me='[cmdk-item=""]',fe=`${me}:not([aria-disabled="true"])`,te="cmdk-item-select",F="data-value",Pe=(t,l,r)=>Ke(t,l,r),pe=n.createContext(void 0),L=()=>n.useContext(pe),he=n.createContext(void 0),re=()=>n.useContext(he),ge=n.createContext(void 0),be=n.forwardRef((t,l)=>{let r=K(()=>{var e,o;return{search:"",value:(o=(e=t.value)!=null?e:t.defaultValue)!=null?o:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),f=K(()=>new Set),u=K(()=>new Map),c=K(()=>new Map),d=K(()=>new Set),v=we(t),{label:b,children:i,value:p,onValueChange:h,filter:x,shouldFilter:E,loop:I,disablePointerSelection:z=!1,vimBindings:A=!0,...O}=t,H=q(),ne=q(),N=q(),M=n.useRef(null),w=We();$(()=>{if(p!==void 0){let e=p.trim();r.current.value=e,k.emit()}},[p]),$(()=>{w(6,ae)},[]);let k=n.useMemo(()=>({subscribe:e=>(d.current.add(e),()=>d.current.delete(e)),snapshot:()=>r.current,setState:(e,o,s)=>{var a,m,g,S;if(!Object.is(r.current[e],o)){if(r.current[e]=o,e==="search")G(),W(),w(1,Y);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(N);y?y.focus():(a=document.getElementById(H))==null||a.focus()}if(w(7,()=>{var y;r.current.selectedItemId=(y=D())==null?void 0:y.id,k.emit()}),s||w(5,ae),((m=v.current)==null?void 0:m.value)!==void 0){let y=o??"";(S=(g=v.current).onValueChange)==null||S.call(g,y);return}}k.emit()}},emit:()=>{d.current.forEach(e=>e())}}),[]),T=n.useMemo(()=>({value:(e,o,s)=>{var a;o!==((a=c.current.get(e))==null?void 0:a.value)&&(c.current.set(e,{value:o,keywords:s}),r.current.filtered.items.set(e,le(o,s)),w(2,()=>{W(),k.emit()}))},item:(e,o)=>(f.current.add(e),o&&(u.current.has(o)?u.current.get(o).add(e):u.current.set(o,new Set([e]))),w(3,()=>{G(),W(),r.current.value||Y(),k.emit()}),()=>{c.current.delete(e),f.current.delete(e),r.current.filtered.items.delete(e);let s=D();w(4,()=>{G(),s?.getAttribute("id")===e&&Y(),k.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{c.current.delete(e),u.current.delete(e)}),filter:()=>v.current.shouldFilter,label:b||t["aria-label"],getDisablePointerSelection:()=>v.current.disablePointerSelection,listId:H,inputId:N,labelId:ne,listInnerRef:M}),[]);function le(e,o){var s,a;let m=(a=(s=v.current)==null?void 0:s.filter)!=null?a:Pe;return e?m(e,r.current.search,o):0}function W(){if(!r.current.search||v.current.shouldFilter===!1)return;let e=r.current.filtered.items,o=[];r.current.filtered.groups.forEach(a=>{let m=u.current.get(a),g=0;m.forEach(S=>{let y=e.get(S);g=Math.max(y,g)}),o.push([a,g])});let s=M.current;P().sort((a,m)=>{var g,S;let y=a.getAttribute("id"),B=m.getAttribute("id");return((g=e.get(B))!=null?g:0)-((S=e.get(y))!=null?S:0)}).forEach(a=>{let m=a.closest(_);m?m.appendChild(a.parentElement===m?a:a.closest(`${_} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${_} > *`))}),o.sort((a,m)=>m[1]-a[1]).forEach(a=>{var m;let g=(m=M.current)==null?void 0:m.querySelector(`${V}[${F}="${encodeURIComponent(a[0])}"]`);g?.parentElement.appendChild(g)})}function Y(){let e=P().find(s=>s.getAttribute("aria-disabled")!=="true"),o=e?.getAttribute(F);k.setState("value",o||void 0)}function G(){var e,o,s,a;if(!r.current.search||v.current.shouldFilter===!1){r.current.filtered.count=f.current.size;return}r.current.filtered.groups=new Set;let m=0;for(let g of f.current){let S=(o=(e=c.current.get(g))==null?void 0:e.value)!=null?o:"",y=(a=(s=c.current.get(g))==null?void 0:s.keywords)!=null?a:[],B=le(S,y);r.current.filtered.items.set(g,B),B>0&&m++}for(let[g,S]of u.current)for(let y of S)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(g);break}r.current.filtered.count=m}function ae(){var e,o,s;let a=D();a&&(((e=a.parentElement)==null?void 0:e.firstChild)===a&&((s=(o=a.closest(V))==null?void 0:o.querySelector(qe))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function D(){var e;return(e=M.current)==null?void 0:e.querySelector(`${me}[aria-selected="true"]`)}function P(){var e;return Array.from(((e=M.current)==null?void 0:e.querySelectorAll(fe))||[])}function J(e){let o=P()[e];o&&k.setState("value",o.getAttribute(F))}function X(e){var o;let s=D(),a=P(),m=a.findIndex(S=>S===s),g=a[m+e];(o=v.current)!=null&&o.loop&&(g=m+e<0?a[a.length-1]:m+e===a.length?a[0]:a[m+e]),g&&k.setState("value",g.getAttribute(F))}function ue(e){let o=D(),s=o?.closest(V),a;for(;s&&!a;)s=e>0?Ne(s,V):Te(s,V),a=s?.querySelector(fe);a?k.setState("value",a.getAttribute(F)):X(e)}let ie=()=>J(P().length-1),oe=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?ue(1):X(1)},ce=e=>{e.preventDefault(),e.metaKey?J(0):e.altKey?ue(-1):X(-1)};return n.createElement(R.div,{ref:l,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:e=>{var o;(o=O.onKeyDown)==null||o.call(O,e);let s=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":{A&&e.ctrlKey&&oe(e);break}case"ArrowDown":{oe(e);break}case"p":case"k":{A&&e.ctrlKey&&ce(e);break}case"ArrowUp":{ce(e);break}case"Home":{e.preventDefault(),J(0);break}case"End":{e.preventDefault(),ie();break}case"Enter":{e.preventDefault();let a=D();if(a){let m=new Event(te);a.dispatchEvent(m)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Ge},b),U(t,e=>n.createElement(he.Provider,{value:k},n.createElement(pe.Provider,{value:T},e))))}),Ve=n.forwardRef((t,l)=>{var r,f;let u=q(),c=n.useRef(null),d=n.useContext(ge),v=L(),b=we(t),i=(f=(r=b.current)==null?void 0:r.forceMount)!=null?f:d?.forceMount;$(()=>{if(!i)return v.item(u,d?.id)},[i]);let p=ye(u,c,[t.value,t.children,c],t.keywords),h=re(),x=C(w=>w.value&&w.value===p.current),E=C(w=>i||v.filter()===!1?!0:w.search?w.filtered.items.get(u)>0:!0);n.useEffect(()=>{let w=c.current;if(!(!w||t.disabled))return w.addEventListener(te,I),()=>w.removeEventListener(te,I)},[E,t.onSelect,t.disabled]);function I(){var w,k;z(),(k=(w=b.current).onSelect)==null||k.call(w,p.current)}function z(){h.setState("value",p.current,!0)}if(!E)return null;let{disabled:A,value:O,onSelect:H,forceMount:ne,keywords:N,...M}=t;return n.createElement(R.div,{ref:j(c,l),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!x,"data-disabled":!!A,"data-selected":!!x,onPointerMove:A||v.getDisablePointerSelection()?void 0:z,onClick:A?void 0:I},t.children)}),je=n.forwardRef((t,l)=>{let{heading:r,children:f,forceMount:u,...c}=t,d=q(),v=n.useRef(null),b=n.useRef(null),i=q(),p=L(),h=C(E=>u||p.filter()===!1?!0:E.search?E.filtered.groups.has(d):!0);$(()=>p.group(d),[]),ye(d,v,[t.value,t.heading,b]);let x=n.useMemo(()=>({id:d,forceMount:u}),[u]);return n.createElement(R.div,{ref:j(v,l),...c,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&n.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),U(t,E=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},n.createElement(ge.Provider,{value:x},E))))}),Le=n.forwardRef((t,l)=>{let{alwaysRender:r,...f}=t,u=n.useRef(null),c=C(d=>!d.search);return!r&&!c?null:n.createElement(R.div,{ref:j(u,l),...f,"cmdk-separator":"",role:"separator"})}),Oe=n.forwardRef((t,l)=>{let{onValueChange:r,...f}=t,u=t.value!=null,c=re(),d=C(i=>i.search),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),n.createElement(R.input,{ref:l,...f,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":v,id:b.inputId,type:"text",value:u?t.value:d,onChange:i=>{u||c.setState("search",i.target.value),r?.(i.target.value)}})}),Be=n.forwardRef((t,l)=>{let{children:r,label:f="Suggestions",...u}=t,c=n.useRef(null),d=n.useRef(null),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{if(d.current&&c.current){let i=d.current,p=c.current,h,x=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let E=i.offsetHeight;p.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return x.observe(i),()=>{cancelAnimationFrame(h),x.unobserve(i)}}},[]),n.createElement(R.div,{ref:j(c,l),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":v,"aria-label":f,id:b.listId},U(t,i=>n.createElement("div",{ref:j(d,b.listInnerRef),"cmdk-list-sizer":""},i)))}),Ue=n.forwardRef((t,l)=>{let{open:r,onOpenChange:f,overlayClassName:u,contentClassName:c,container:d,...v}=t;return n.createElement(Ee,{open:r,onOpenChange:f},n.createElement(ke,{container:d},n.createElement(Se,{"cmdk-overlay":"",className:u}),n.createElement(xe,{"aria-label":t.label,"cmdk-dialog":"",className:c},n.createElement(be,{ref:l,...v}))))}),ze=n.forwardRef((t,l)=>C(r=>r.filtered.count===0)?n.createElement(R.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),He=n.forwardRef((t,l)=>{let{progress:r,children:f,label:u="Loading...",...c}=t;return n.createElement(R.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},U(t,d=>n.createElement("div",{"aria-hidden":!0},d)))}),Xe=Object.assign(be,{List:Be,Item:Ve,Input:Oe,Group:je,Separator:Le,Dialog:Ue,Empty:ze,Loading:He});function Ne(t,l){let r=t.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function Te(t,l){let r=t.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function we(t){let l=n.useRef(t);return $(()=>{l.current=t}),l}var $=typeof window>"u"?n.useEffect:n.useLayoutEffect;function K(t){let l=n.useRef();return l.current===void 0&&(l.current=t()),l}function C(t){let l=re(),r=()=>t(l.snapshot());return n.useSyncExternalStore(l.subscribe,r,r)}function ye(t,l,r,f=[]){let u=n.useRef(),c=L();return $(()=>{var d;let v=(()=>{var i;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(i=p.current.textContent)==null?void 0:i.trim():u.current}})(),b=f.map(i=>i.trim());c.value(t,v,b),(d=l.current)==null||d.setAttribute(F,v),u.current=v}),u}var We=()=>{let[t,l]=n.useState(),r=K(()=>new Map);return $(()=>{r.current.forEach(f=>f()),r.current=new Map},[t]),(f,u)=>{r.current.set(f,u),l({})}};function Ye(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function U({asChild:t,children:l},r){return t&&n.isValidElement(l)?n.cloneElement(Ye(l),{ref:l.ref},r(l.props.children)):r(l)}var Ge={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};export{Xe as _};
1
+ import{r as n,aU as q,bZ as R,b_ as Ee,b$ as ke,c0 as Se,be as xe,c1 as j}from"./index-D3dcRy4-.js";var de=1,Ie=.9,Ce=.8,Re=.17,Z=.1,Q=.999,Ae=.9999,Me=.99,$e=/[\\\/_+.#"@\[\(\{&]/,De=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ve=/[\s-]/g;function ee(t,l,r,f,u,c,d){if(c===l.length)return u===t.length?de:Me;var v=`${u},${c}`;if(d[v]!==void 0)return d[v];for(var b=f.charAt(c),i=r.indexOf(b,u),p=0,h,x,E,I;i>=0;)h=ee(t,l,r,f,i+1,c+1,d),h>p&&(i===u?h*=de:$e.test(t.charAt(i-1))?(h*=Ce,E=t.slice(u,i-1).match(De),E&&u>0&&(h*=Math.pow(Q,E.length))):Fe.test(t.charAt(i-1))?(h*=Ie,I=t.slice(u,i-1).match(ve),I&&u>0&&(h*=Math.pow(Q,I.length))):(h*=Re,u>0&&(h*=Math.pow(Q,i-u))),t.charAt(i)!==l.charAt(c)&&(h*=Ae)),(h<Z&&r.charAt(i-1)===f.charAt(c+1)||f.charAt(c+1)===f.charAt(c)&&r.charAt(i-1)!==f.charAt(c))&&(x=ee(t,l,r,f,i+1,c+2,d),x*Z>h&&(h=x*Z)),h>p&&(p=h),i=r.indexOf(b,i+1);return d[v]=p,p}function se(t){return t.toLowerCase().replace(ve," ")}function Ke(t,l,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ee(t,l,se(t),se(l),0,0,{})}var V='[cmdk-group=""]',_='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',me='[cmdk-item=""]',fe=`${me}:not([aria-disabled="true"])`,te="cmdk-item-select",F="data-value",Pe=(t,l,r)=>Ke(t,l,r),pe=n.createContext(void 0),L=()=>n.useContext(pe),he=n.createContext(void 0),re=()=>n.useContext(he),ge=n.createContext(void 0),be=n.forwardRef((t,l)=>{let r=K(()=>{var e,o;return{search:"",value:(o=(e=t.value)!=null?e:t.defaultValue)!=null?o:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),f=K(()=>new Set),u=K(()=>new Map),c=K(()=>new Map),d=K(()=>new Set),v=we(t),{label:b,children:i,value:p,onValueChange:h,filter:x,shouldFilter:E,loop:I,disablePointerSelection:z=!1,vimBindings:A=!0,...O}=t,H=q(),ne=q(),N=q(),M=n.useRef(null),w=We();$(()=>{if(p!==void 0){let e=p.trim();r.current.value=e,k.emit()}},[p]),$(()=>{w(6,ae)},[]);let k=n.useMemo(()=>({subscribe:e=>(d.current.add(e),()=>d.current.delete(e)),snapshot:()=>r.current,setState:(e,o,s)=>{var a,m,g,S;if(!Object.is(r.current[e],o)){if(r.current[e]=o,e==="search")J(),W(),w(1,G);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(N);y?y.focus():(a=document.getElementById(H))==null||a.focus()}if(w(7,()=>{var y;r.current.selectedItemId=(y=D())==null?void 0:y.id,k.emit()}),s||w(5,ae),((m=v.current)==null?void 0:m.value)!==void 0){let y=o??"";(S=(g=v.current).onValueChange)==null||S.call(g,y);return}}k.emit()}},emit:()=>{d.current.forEach(e=>e())}}),[]),T=n.useMemo(()=>({value:(e,o,s)=>{var a;o!==((a=c.current.get(e))==null?void 0:a.value)&&(c.current.set(e,{value:o,keywords:s}),r.current.filtered.items.set(e,le(o,s)),w(2,()=>{W(),k.emit()}))},item:(e,o)=>(f.current.add(e),o&&(u.current.has(o)?u.current.get(o).add(e):u.current.set(o,new Set([e]))),w(3,()=>{J(),W(),r.current.value||G(),k.emit()}),()=>{c.current.delete(e),f.current.delete(e),r.current.filtered.items.delete(e);let s=D();w(4,()=>{J(),s?.getAttribute("id")===e&&G(),k.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{c.current.delete(e),u.current.delete(e)}),filter:()=>v.current.shouldFilter,label:b||t["aria-label"],getDisablePointerSelection:()=>v.current.disablePointerSelection,listId:H,inputId:N,labelId:ne,listInnerRef:M}),[]);function le(e,o){var s,a;let m=(a=(s=v.current)==null?void 0:s.filter)!=null?a:Pe;return e?m(e,r.current.search,o):0}function W(){if(!r.current.search||v.current.shouldFilter===!1)return;let e=r.current.filtered.items,o=[];r.current.filtered.groups.forEach(a=>{let m=u.current.get(a),g=0;m.forEach(S=>{let y=e.get(S);g=Math.max(y,g)}),o.push([a,g])});let s=M.current;P().sort((a,m)=>{var g,S;let y=a.getAttribute("id"),B=m.getAttribute("id");return((g=e.get(B))!=null?g:0)-((S=e.get(y))!=null?S:0)}).forEach(a=>{let m=a.closest(_);m?m.appendChild(a.parentElement===m?a:a.closest(`${_} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${_} > *`))}),o.sort((a,m)=>m[1]-a[1]).forEach(a=>{var m;let g=(m=M.current)==null?void 0:m.querySelector(`${V}[${F}="${encodeURIComponent(a[0])}"]`);g?.parentElement.appendChild(g)})}function G(){let e=P().find(s=>s.getAttribute("aria-disabled")!=="true"),o=e?.getAttribute(F);k.setState("value",o||void 0)}function J(){var e,o,s,a;if(!r.current.search||v.current.shouldFilter===!1){r.current.filtered.count=f.current.size;return}r.current.filtered.groups=new Set;let m=0;for(let g of f.current){let S=(o=(e=c.current.get(g))==null?void 0:e.value)!=null?o:"",y=(a=(s=c.current.get(g))==null?void 0:s.keywords)!=null?a:[],B=le(S,y);r.current.filtered.items.set(g,B),B>0&&m++}for(let[g,S]of u.current)for(let y of S)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(g);break}r.current.filtered.count=m}function ae(){var e,o,s;let a=D();a&&(((e=a.parentElement)==null?void 0:e.firstChild)===a&&((s=(o=a.closest(V))==null?void 0:o.querySelector(qe))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function D(){var e;return(e=M.current)==null?void 0:e.querySelector(`${me}[aria-selected="true"]`)}function P(){var e;return Array.from(((e=M.current)==null?void 0:e.querySelectorAll(fe))||[])}function X(e){let o=P()[e];o&&k.setState("value",o.getAttribute(F))}function Y(e){var o;let s=D(),a=P(),m=a.findIndex(S=>S===s),g=a[m+e];(o=v.current)!=null&&o.loop&&(g=m+e<0?a[a.length-1]:m+e===a.length?a[0]:a[m+e]),g&&k.setState("value",g.getAttribute(F))}function ue(e){let o=D(),s=o?.closest(V),a;for(;s&&!a;)s=e>0?Ne(s,V):Te(s,V),a=s?.querySelector(fe);a?k.setState("value",a.getAttribute(F)):Y(e)}let ie=()=>X(P().length-1),oe=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?ue(1):Y(1)},ce=e=>{e.preventDefault(),e.metaKey?X(0):e.altKey?ue(-1):Y(-1)};return n.createElement(R.div,{ref:l,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:e=>{var o;(o=O.onKeyDown)==null||o.call(O,e);let s=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":{A&&e.ctrlKey&&oe(e);break}case"ArrowDown":{oe(e);break}case"p":case"k":{A&&e.ctrlKey&&ce(e);break}case"ArrowUp":{ce(e);break}case"Home":{e.preventDefault(),X(0);break}case"End":{e.preventDefault(),ie();break}case"Enter":{e.preventDefault();let a=D();if(a){let m=new Event(te);a.dispatchEvent(m)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Je},b),U(t,e=>n.createElement(he.Provider,{value:k},n.createElement(pe.Provider,{value:T},e))))}),Ve=n.forwardRef((t,l)=>{var r,f;let u=q(),c=n.useRef(null),d=n.useContext(ge),v=L(),b=we(t),i=(f=(r=b.current)==null?void 0:r.forceMount)!=null?f:d?.forceMount;$(()=>{if(!i)return v.item(u,d?.id)},[i]);let p=ye(u,c,[t.value,t.children,c],t.keywords),h=re(),x=C(w=>w.value&&w.value===p.current),E=C(w=>i||v.filter()===!1?!0:w.search?w.filtered.items.get(u)>0:!0);n.useEffect(()=>{let w=c.current;if(!(!w||t.disabled))return w.addEventListener(te,I),()=>w.removeEventListener(te,I)},[E,t.onSelect,t.disabled]);function I(){var w,k;z(),(k=(w=b.current).onSelect)==null||k.call(w,p.current)}function z(){h.setState("value",p.current,!0)}if(!E)return null;let{disabled:A,value:O,onSelect:H,forceMount:ne,keywords:N,...M}=t;return n.createElement(R.div,{ref:j(c,l),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!x,"data-disabled":!!A,"data-selected":!!x,onPointerMove:A||v.getDisablePointerSelection()?void 0:z,onClick:A?void 0:I},t.children)}),je=n.forwardRef((t,l)=>{let{heading:r,children:f,forceMount:u,...c}=t,d=q(),v=n.useRef(null),b=n.useRef(null),i=q(),p=L(),h=C(E=>u||p.filter()===!1?!0:E.search?E.filtered.groups.has(d):!0);$(()=>p.group(d),[]),ye(d,v,[t.value,t.heading,b]);let x=n.useMemo(()=>({id:d,forceMount:u}),[u]);return n.createElement(R.div,{ref:j(v,l),...c,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&n.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),U(t,E=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},n.createElement(ge.Provider,{value:x},E))))}),Le=n.forwardRef((t,l)=>{let{alwaysRender:r,...f}=t,u=n.useRef(null),c=C(d=>!d.search);return!r&&!c?null:n.createElement(R.div,{ref:j(u,l),...f,"cmdk-separator":"",role:"separator"})}),Oe=n.forwardRef((t,l)=>{let{onValueChange:r,...f}=t,u=t.value!=null,c=re(),d=C(i=>i.search),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),n.createElement(R.input,{ref:l,...f,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":v,id:b.inputId,type:"text",value:u?t.value:d,onChange:i=>{u||c.setState("search",i.target.value),r?.(i.target.value)}})}),Be=n.forwardRef((t,l)=>{let{children:r,label:f="Suggestions",...u}=t,c=n.useRef(null),d=n.useRef(null),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{if(d.current&&c.current){let i=d.current,p=c.current,h,x=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let E=i.offsetHeight;p.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return x.observe(i),()=>{cancelAnimationFrame(h),x.unobserve(i)}}},[]),n.createElement(R.div,{ref:j(c,l),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":v,"aria-label":f,id:b.listId},U(t,i=>n.createElement("div",{ref:j(d,b.listInnerRef),"cmdk-list-sizer":""},i)))}),Ue=n.forwardRef((t,l)=>{let{open:r,onOpenChange:f,overlayClassName:u,contentClassName:c,container:d,...v}=t;return n.createElement(Ee,{open:r,onOpenChange:f},n.createElement(ke,{container:d},n.createElement(Se,{"cmdk-overlay":"",className:u}),n.createElement(xe,{"aria-label":t.label,"cmdk-dialog":"",className:c},n.createElement(be,{ref:l,...v}))))}),ze=n.forwardRef((t,l)=>C(r=>r.filtered.count===0)?n.createElement(R.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),He=n.forwardRef((t,l)=>{let{progress:r,children:f,label:u="Loading...",...c}=t;return n.createElement(R.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},U(t,d=>n.createElement("div",{"aria-hidden":!0},d)))}),Ye=Object.assign(be,{List:Be,Item:Ve,Input:Oe,Group:je,Separator:Le,Dialog:Ue,Empty:ze,Loading:He});function Ne(t,l){let r=t.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function Te(t,l){let r=t.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function we(t){let l=n.useRef(t);return $(()=>{l.current=t}),l}var $=typeof window>"u"?n.useEffect:n.useLayoutEffect;function K(t){let l=n.useRef();return l.current===void 0&&(l.current=t()),l}function C(t){let l=re(),r=()=>t(l.snapshot());return n.useSyncExternalStore(l.subscribe,r,r)}function ye(t,l,r,f=[]){let u=n.useRef(),c=L();return $(()=>{var d;let v=(()=>{var i;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(i=p.current.textContent)==null?void 0:i.trim():u.current}})(),b=f.map(i=>i.trim());c.value(t,v,b),(d=l.current)==null||d.setAttribute(F,v),u.current=v}),u}var We=()=>{let[t,l]=n.useState(),r=K(()=>new Map);return $(()=>{r.current.forEach(f=>f()),r.current=new Map},[t]),(f,u)=>{r.current.set(f,u),l({})}};function Ge(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function U({asChild:t,children:l},r){return t&&n.isValidElement(l)?n.cloneElement(Ge(l),{ref:l.ref},r(l.props.children)):r(l)}var Je={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};export{Ye as _};
@@ -1 +1 @@
1
- import{dv as d,dw as f,dx as v,dy as x}from"./index-CVUETRIB.js";var N=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:f()})}getOptimisticResult(e){return e.behavior=f(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:P,isError:c,isRefetchError:g}=i,r=s.fetchMeta?.fetchMore?.direction,h=c&&r==="forward",o=a&&r==="forward",n=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:x(t,s.data),hasPreviousPage:v(t,s.data),isFetchNextPageError:h,isFetchingNextPage:o,isFetchPreviousPageError:n,isFetchingPreviousPage:u,isRefetchError:g&&!h&&!n,isRefetching:P&&!o&&!u}}};export{N as I};
1
+ import{dw as d,dx as f,dy as v,dz as x}from"./index-D3dcRy4-.js";var N=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:f()})}getOptimisticResult(e){return e.behavior=f(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:P,isError:c,isRefetchError:g}=i,r=s.fetchMeta?.fetchMore?.direction,h=c&&r==="forward",o=a&&r==="forward",n=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:x(t,s.data),hasPreviousPage:v(t,s.data),isFetchNextPageError:h,isFetchingNextPage:o,isFetchPreviousPageError:n,isFetchingPreviousPage:u,isRefetchError:g&&!h&&!n,isRefetching:P&&!o&&!u}}};export{N as I};
@@ -1 +1 @@
1
- import{e as s,c as a,j as d}from"./index-CVUETRIB.js";function f(l){const e=s.c(10);let i,t,r;e[0]!==l?({className:i,type:r,...t}=l,e[0]=l,e[1]=i,e[2]=t,e[3]=r):(i=e[1],t=e[2],r=e[3]);let n;e[4]!==i?(n=a("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-lg bg-background dark:bg-input/30 px-3 py-1 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:opacity-50 card-shadow","focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==r?(o=d.jsx("input",{type:r,"data-slot":"input",className:n,...t}),e[6]=t,e[7]=n,e[8]=r,e[9]=o):o=e[9],o}export{f as I};
1
+ import{e as s,c as a,j as d}from"./index-D3dcRy4-.js";function f(l){const e=s.c(10);let i,t,r;e[0]!==l?({className:i,type:r,...t}=l,e[0]=l,e[1]=i,e[2]=t,e[3]=r):(i=e[1],t=e[2],r=e[3]);let n;e[4]!==i?(n=a("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-lg bg-background dark:bg-input/30 px-3 py-1 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:opacity-50 card-shadow","focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==r?(o=d.jsx("input",{type:r,"data-slot":"input",className:n,...t}),e[6]=t,e[7]=n,e[8]=r,e[9]=o):o=e[9],o}export{f as I};
@@ -1 +1 @@
1
- import{e as A,j as h,r as z,c as _}from"./index-CVUETRIB.js";import{n as L}from"./Container-RTpXHcc_.js";import{A as k}from"./agent-icon-Dwc2UhoB.js";const C={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-9 w-9",md:"h-12 w-12",lg:"h-16 w-16",xl:"h-14 w-14"},Z={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-9",md:"min-w-12",lg:"min-w-16",xl:"min-w-14"},y={"2xs":8,xs:12,sm:16,md:24,lg:32,xl:28},M={"2xs":"xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"lg"};function q(E){const e=A.c(12),{icon:t,name:s,size:w,className:o,fallbackIcon:c}=E,n=w===void 0?"md":w;if(t?.startsWith("icon://")||t?.includes("#agentcolor=")){const r=M[n];let l;return e[0]!==o||e[1]!==t||e[2]!==s||e[3]!==r?(l=h.jsx(k,{icon:t,name:s,size:r,className:o}),e[0]=o,e[1]=t,e[2]=s,e[3]=r,e[4]=l):l=e[4],l}const g=t??"no-icon";let i;return e[5]!==o||e[6]!==c||e[7]!==t||e[8]!==s||e[9]!==n||e[10]!==g?(i=h.jsx(R,{icon:t,name:s,size:n,className:o,fallbackIcon:c},g),e[5]=o,e[6]=c,e[7]=t,e[8]=s,e[9]=n,e[10]=g,e[11]=i):i=e[11],i}function R(E){const e=A.c(24),{icon:t,name:s,size:w,className:o,fallbackIcon:c}=E,n=w===void 0?"md":w,[g,i]=z.useState(!1),r=!!t&&g,l=C[n],b=Z[n];let a;e[0]!==o||e[1]!==l||e[2]!==b?(a=_("rounded-lg border border-border shrink-0 overflow-hidden aspect-square bg-white",l,b,o),e[0]=o,e[1]=l,e[2]=b,e[3]=a):a=e[3];const p=t||void 0,N=!r&&"hidden";let m;e[4]!==N?(m=_("h-full w-full object-cover",N),e[4]=N,e[5]=m):m=e[5];let I,S;e[6]===Symbol.for("react.memo_cache_sentinel")?(I=()=>i(!1),S=()=>i(!0),e[6]=I,e[7]=S):(I=e[6],S=e[7]);let d;e[8]!==s||e[9]!==p||e[10]!==m?(d=h.jsx("img",{src:p,alt:s,className:m,onError:I,onLoad:S}),e[8]=s,e[9]=p,e[10]=m,e[11]=d):d=e[11];const v=r&&"hidden";let f;e[12]!==v?(f=_("h-full w-full flex items-center justify-center bg-muted/20",v),e[12]=v,e[13]=f):f=e[13];let x;e[14]!==c||e[15]!==n?(x=c??h.jsx(L,{size:y[n],className:"text-muted-foreground"}),e[14]=c,e[15]=n,e[16]=x):x=e[16];let u;e[17]!==f||e[18]!==x?(u=h.jsx("div",{className:f,children:x}),e[17]=f,e[18]=x,e[19]=u):u=e[19];let j;return e[20]!==d||e[21]!==u||e[22]!==a?(j=h.jsxs("div",{className:a,children:[d,u]}),e[20]=d,e[21]=u,e[22]=a,e[23]=j):j=e[23],j}export{q as I};
1
+ import{e as A,j as h,r as z,c as _}from"./index-D3dcRy4-.js";import{n as L}from"./Container-Ckr-D4x-.js";import{A as k}from"./agent-icon-CJBSrXXa.js";const C={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-9 w-9",md:"h-12 w-12",lg:"h-16 w-16",xl:"h-14 w-14"},Z={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-9",md:"min-w-12",lg:"min-w-16",xl:"min-w-14"},y={"2xs":8,xs:12,sm:16,md:24,lg:32,xl:28},M={"2xs":"xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"lg"};function q(E){const e=A.c(12),{icon:t,name:s,size:w,className:o,fallbackIcon:c}=E,n=w===void 0?"md":w;if(t?.startsWith("icon://")||t?.includes("#agentcolor=")){const r=M[n];let l;return e[0]!==o||e[1]!==t||e[2]!==s||e[3]!==r?(l=h.jsx(k,{icon:t,name:s,size:r,className:o}),e[0]=o,e[1]=t,e[2]=s,e[3]=r,e[4]=l):l=e[4],l}const g=t??"no-icon";let i;return e[5]!==o||e[6]!==c||e[7]!==t||e[8]!==s||e[9]!==n||e[10]!==g?(i=h.jsx(R,{icon:t,name:s,size:n,className:o,fallbackIcon:c},g),e[5]=o,e[6]=c,e[7]=t,e[8]=s,e[9]=n,e[10]=g,e[11]=i):i=e[11],i}function R(E){const e=A.c(24),{icon:t,name:s,size:w,className:o,fallbackIcon:c}=E,n=w===void 0?"md":w,[g,i]=z.useState(!1),r=!!t&&g,l=C[n],b=Z[n];let a;e[0]!==o||e[1]!==l||e[2]!==b?(a=_("rounded-lg border border-border shrink-0 overflow-hidden aspect-square bg-white",l,b,o),e[0]=o,e[1]=l,e[2]=b,e[3]=a):a=e[3];const p=t||void 0,N=!r&&"hidden";let m;e[4]!==N?(m=_("h-full w-full object-cover",N),e[4]=N,e[5]=m):m=e[5];let I,S;e[6]===Symbol.for("react.memo_cache_sentinel")?(I=()=>i(!1),S=()=>i(!0),e[6]=I,e[7]=S):(I=e[6],S=e[7]);let d;e[8]!==s||e[9]!==p||e[10]!==m?(d=h.jsx("img",{src:p,alt:s,className:m,onError:I,onLoad:S}),e[8]=s,e[9]=p,e[10]=m,e[11]=d):d=e[11];const v=r&&"hidden";let f;e[12]!==v?(f=_("h-full w-full flex items-center justify-center bg-muted/20",v),e[12]=v,e[13]=f):f=e[13];let x;e[14]!==c||e[15]!==n?(x=c??h.jsx(L,{size:y[n],className:"text-muted-foreground"}),e[14]=c,e[15]=n,e[16]=x):x=e[16];let u;e[17]!==f||e[18]!==x?(u=h.jsx("div",{className:f,children:x}),e[17]=f,e[18]=x,e[19]=u):u=e[19];let j;return e[20]!==d||e[21]!==u||e[22]!==a?(j=h.jsxs("div",{className:a,children:[d,u]}),e[20]=d,e[21]=u,e[22]=a,e[23]=j):j=e[23],j}export{q as I};
@@ -1 +1 @@
1
- import{e as n,c as r,j as i,b5 as p}from"./index-CVUETRIB.js";function c(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=r("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(p,{"data-slot":"label",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{c as L};
1
+ import{e as n,c as r,j as i,b5 as p}from"./index-D3dcRy4-.js";function c(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=r("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(p,{"data-slot":"label",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{c as L};
@@ -1 +1 @@
1
- import{e as C,r as i,c as A,j as a,J as V}from"./index-CVUETRIB.js";import{P as E}from"./index-Dig_TVyF.js";const H=i.createContext(null);function q(x){const e=C.c(3),{children:l}=x,s=i.useContext(H);if(!s?.tabsEl)return null;let c;return e[0]!==l||e[1]!==s.tabsEl?(c=V.createPortal(l,s.tabsEl),e[0]=l,e[1]=s.tabsEl,e[2]=c):c=e[2],c}function D(x){const e=C.c(3),{children:l}=x,s=i.useContext(H);if(!s?.actionsEl)return null;let c;return e[0]!==l||e[1]!==s.actionsEl?(c=V.createPortal(l,s.actionsEl),e[0]=l,e[1]=s.actionsEl,e[2]=c):c=e[2],c}const z=D;function B(x){const e=C.c(21),{children:l,breadcrumb:s,hideHeader:c}=x;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={leftEl:null,tabsEl:null,actionsEl:null},e[0]=b):b=e[0];const[w,g]=i.useState(b),N=i.useRef(null),P=i.useRef(null),L=i.useRef(null);let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=t=>{N.current=t,t&&g(n=>n.leftEl===t?n:{...n,leftEl:t})},e[1]=h):h=e[1];const $=h;let R;e[2]===Symbol.for("react.memo_cache_sentinel")?(R=t=>{P.current=t,t&&g(n=>n.tabsEl===t?n:{...n,tabsEl:t})},e[2]=R):R=e[2];const _=R;let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t=>{L.current=t,t&&g(n=>n.actionsEl===t?n:{...n,actionsEl:t})},e[3]=d):d=e[3];const k=d,p=c&&"hidden";let o;e[4]!==p?(o=A(p),e[4]=p,e[5]=o):o=e[5];let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx("div",{ref:$,className:"flex items-center gap-2 min-w-0"}),e[6]=j):j=e[6];let r;e[7]!==s?(r=a.jsxs(E.Header.Left,{children:[s,j]}),e[7]=s,e[8]=r):r=e[8];let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=a.jsxs(E.Header.Right,{children:[a.jsx("div",{ref:_,className:"flex items-center gap-2 overflow-x-auto min-w-0"}),a.jsx("div",{ref:k,className:"flex items-center gap-2 shrink-0"})]}),e[9]=y):y=e[9];let f;e[10]!==o||e[11]!==r?(f=a.jsxs(E.Header,{className:o,children:[r,y]}),e[10]=o,e[11]=r,e[12]=f):f=e[12];let m;e[13]!==l?(m=a.jsx(E.Content,{children:l}),e[13]=l,e[14]=m):m=e[14];let u;e[15]!==f||e[16]!==m?(u=a.jsxs(E,{children:[f,m]}),e[15]=f,e[16]=m,e[17]=u):u=e[17];let S;return e[18]!==w||e[19]!==u?(S=a.jsx(H,{value:w,children:u}),e[18]=w,e[19]=u,e[20]=S):S=e[20],S}export{B as V,z as a,q as b};
1
+ import{e as C,r as i,c as A,j as a,J as V}from"./index-D3dcRy4-.js";import{P as E}from"./index-B07jP2sp.js";const H=i.createContext(null);function q(x){const e=C.c(3),{children:l}=x,s=i.useContext(H);if(!s?.tabsEl)return null;let c;return e[0]!==l||e[1]!==s.tabsEl?(c=V.createPortal(l,s.tabsEl),e[0]=l,e[1]=s.tabsEl,e[2]=c):c=e[2],c}function D(x){const e=C.c(3),{children:l}=x,s=i.useContext(H);if(!s?.actionsEl)return null;let c;return e[0]!==l||e[1]!==s.actionsEl?(c=V.createPortal(l,s.actionsEl),e[0]=l,e[1]=s.actionsEl,e[2]=c):c=e[2],c}const z=D;function B(x){const e=C.c(21),{children:l,breadcrumb:s,hideHeader:c}=x;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={leftEl:null,tabsEl:null,actionsEl:null},e[0]=b):b=e[0];const[w,g]=i.useState(b),N=i.useRef(null),P=i.useRef(null),L=i.useRef(null);let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=t=>{N.current=t,t&&g(n=>n.leftEl===t?n:{...n,leftEl:t})},e[1]=h):h=e[1];const $=h;let R;e[2]===Symbol.for("react.memo_cache_sentinel")?(R=t=>{P.current=t,t&&g(n=>n.tabsEl===t?n:{...n,tabsEl:t})},e[2]=R):R=e[2];const _=R;let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t=>{L.current=t,t&&g(n=>n.actionsEl===t?n:{...n,actionsEl:t})},e[3]=d):d=e[3];const k=d,p=c&&"hidden";let o;e[4]!==p?(o=A(p),e[4]=p,e[5]=o):o=e[5];let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx("div",{ref:$,className:"flex items-center gap-2 min-w-0"}),e[6]=j):j=e[6];let r;e[7]!==s?(r=a.jsxs(E.Header.Left,{children:[s,j]}),e[7]=s,e[8]=r):r=e[8];let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=a.jsxs(E.Header.Right,{children:[a.jsx("div",{ref:_,className:"flex items-center gap-2 overflow-x-auto min-w-0"}),a.jsx("div",{ref:k,className:"flex items-center gap-2 shrink-0"})]}),e[9]=y):y=e[9];let f;e[10]!==o||e[11]!==r?(f=a.jsxs(E.Header,{className:o,children:[r,y]}),e[10]=o,e[11]=r,e[12]=f):f=e[12];let m;e[13]!==l?(m=a.jsx(E.Content,{children:l}),e[13]=l,e[14]=m):m=e[14];let u;e[15]!==f||e[16]!==m?(u=a.jsxs(E,{children:[f,m]}),e[15]=f,e[16]=m,e[17]=u):u=e[17];let S;return e[18]!==w||e[19]!==u?(S=a.jsx(H,{value:w,children:u}),e[18]=w,e[19]=u,e[20]=S):S=e[20],S}export{B as V,z as a,q as b};
@@ -1 +1 @@
1
- import{u as X,r as x,a as V,t as P,b as p,j as e,B as f,c as T,d as ae,S as $,N as ie,e as oe}from"./index-CVUETRIB.js";import{I}from"./input-CL-LUIlC.js";function le({redirectUrl:s,callbackUrl:r="/"}){const{emailAndPassword:l,resetPassword:u,emailOtp:i,socialProviders:d}=X(),[n,j]=x.useState(""),[y,D]=x.useState(""),[b,C]=x.useState(""),[O,A]=x.useState(""),[L,R]=x.useState(!1),[z,N]=x.useState(()=>!l.enabled&&i.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[c,S]=x.useState(""),[Y,G]=x.useState(!1),m=z==="signUp",h=z==="forgotPassword",w=z==="emailOtp",F=V({mutationFn:async({email:t,password:a,name:q})=>{try{if(m){const g=await p.signUp.email({email:t,password:a,name:q||""});if(g.error)throw new Error(g.error.message||"Sign up failed");return g}else{const g=await p.signIn.email({email:t,password:a});if(g.error)throw new Error(g.error.message||"Sign in failed");return g}}catch(g){throw g instanceof Error?g:new Error("Authentication failed")}},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P(m?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),U=V({mutationFn:async({email:t})=>{const a=await p.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(a.error)throw new Error(a.error.message||"Failed to send reset email");return a},onSuccess:()=>{P("password_reset_requested"),G(!0)},onError:t=>{P("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),E=V({mutationFn:async({email:t})=>{const a=await p.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(a.error)throw new Error(a.error.message||"Failed to send code");return a},onSuccess:()=>{P("email_otp_sent"),R(!0)},onError:t=>{P("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),_=V({mutationFn:async({email:t,otp:a})=>{const q=await p.signIn.emailOtp({email:t,otp:a});if(q.error)throw new Error(q.error.message||"Invalid code");return q},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),B=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),W=()=>{n.trim()&&!B(n)&&S("Invalid email address")},Z=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}F.mutate({email:n,password:y,name:b})},ee=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}U.mutate({email:n})},te=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}E.mutate({email:n})},se=t=>{t.preventDefault(),_.mutate({email:n,otp:O})},k=t=>a=>{t(a.target.value),H&&F.reset(),J&&U.reset(),K&&(E.reset(),_.reset()),t===j&&c&&S("")},M=t=>{N(t),C(""),A(""),R(!1),S(""),G(!1),F.reset(),U.reset(),E.reset(),_.reset()},o=F.isPending||U.isPending||E.isPending||_.isPending,H=F.error,J=U.error,K=E.error||_.error,v=m?n.trim()&&y.trim()&&b.trim():h?n.trim():w?L?O.trim():n.trim():n.trim()&&y.trim(),re=t=>{if(!t)return null;const a=t.message.toLowerCase();return a.includes("unauthorized")||a.includes("401")?"Invalid email or password. Please try again.":a.includes("already exists")||a.includes("409")?"An account with this email already exists. Try signing in instead.":a.includes("network")||a.includes("fetch")?"Network error. Please check your connection and try again.":a.includes("rate limit")||a.includes("429")?"Too many attempts. Please wait a moment and try again.":a.includes("invalid")&&a.includes("otp")?"Invalid or expired code. Please try again.":t.message||"An error occurred. Please try again."},Q=H||J||K,ne=h?"Reset your password":w?L?"Enter verification code":"Sign in with email code":m?"Create your account":"Login or signup below";return e.jsxs("div",{className:"mx-auto w-full min-h-full md:min-h-0 md:min-w-[400px] max-w-md grid gap-6 content-center bg-card p-6 md:p-10 border border-primary-foreground/20",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e.jsx("div",{className:"text-center space-y-1",children:e.jsx("p",{className:"text-sm text-foreground/70",children:ne})}),Q&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:re(Q)}),Y&&e.jsx("div",{className:"rounded-xl bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400 text-center",children:"Check your email for a password reset link."}),!h&&d.enabled&&e.jsx("div",{className:"grid gap-3",children:d.providers.map(t=>e.jsxs(f,{type:"button",variant:"outline",size:"lg",className:"w-full font-medium",disabled:o,onClick:()=>{p.signIn.social({provider:t.name,callbackURL:s??r})},children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:"h-5 w-5","aria-hidden":"true"}),"Continue with"," ",t.name.charAt(0).toUpperCase()+t.name.slice(1)]},t.name))}),!h&&d.enabled&&(l.enabled||i.enabled)&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),w&&i.enabled&&e.jsx(e.Fragment,{children:L?e.jsxs("form",{onSubmit:se,className:"grid gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-muted/50 p-3 text-sm text-muted-foreground text-center",children:["Code sent to ",n]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Verification code"}),e.jsx(I,{type:"text",placeholder:"Enter code",value:O,onChange:k(A),required:!0,disabled:o,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code"})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Verifying...":"Verify"}),e.jsx(f,{type:"button",variant:"ghost",onClick:()=>{R(!1),A(""),E.reset(),_.reset()},disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Use a different email"})]}):e.jsxs("form",{onSubmit:te,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send code"})]})}),h&&l.enabled&&!Y&&e.jsxs("form",{onSubmit:ee,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send reset link"})]}),!h&&!w&&l.enabled&&e.jsxs("form",{onSubmit:Z,className:"grid gap-4",children:[e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",m?"max-h-[200px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsxs("div",{className:T("p-1",!m&&"pointer-events-none"),children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Name"}),e.jsx(I,{type:"text",placeholder:"Your name",value:b,onChange:k(C),required:!0,disabled:o||!m,"aria-hidden":!m})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Password"}),!m&&u.enabled&&e.jsx("button",{type:"button",onClick:()=>M("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Forgot password?"})]}),e.jsx(I,{type:"password",placeholder:"••••••••",value:y,onChange:k(D),required:!0,disabled:o})]}),e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",v?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:T("p-1",!v&&"pointer-events-none"),children:e.jsx(f,{type:"submit",disabled:o||!v,className:T("w-full font-semibold"),size:"lg","aria-hidden":!v,children:o?m?"Creating account...":"Signing in...":"Continue"})})})]}),!h&&i.enabled&&l.enabled&&!w&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("emailOtp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with email code instead"})}),w&&l.enabled&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with password instead"})}),e.jsx("div",{className:"text-center",children:h?e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Back to sign in"}):!w&&l.enabled?e.jsx(f,{type:"button",variant:"link",onClick:()=>M(m?"signIn":"signUp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:m?"Already have an account? Sign in":"Don't have an account? Sign up"}):null}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground pt-4",children:[e.jsx("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),e.jsx("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})}function de({redirectTo:s}){const[r,l]=x.useState(null);return x.useEffect(()=>{let u=!1;return(async()=>{try{let i;for(let d=0;d<5&&(i=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"}),!(i.ok||i.status<500));d++)await new Promise(n=>setTimeout(n,Math.min(1e3*2**d,1e4)));if(!i?.ok){const d=await i?.json().catch(()=>({}));throw new Error(d?.error||"Auto-login failed")}if(!u){const d=s.startsWith("/")&&!s.startsWith("//")?s:"/";window.location.href=d}}catch(i){u||l(i instanceof Error?i.message:"Auto-login failed")}})(),()=>{u=!0}},[s]),r?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-destructive mb-2",children:["Auto-login failed: ",r]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try restarting the server."})]})}):e.jsx($,{})}function ce(s){if(!s.client_id||s.response_type!=="code")return null;const r=new URLSearchParams;return s.client_id&&r.set("client_id",s.client_id),s.redirect_uri&&r.set("redirect_uri",s.redirect_uri),s.response_type&&r.set("response_type",s.response_type),s.state&&r.set("state",s.state),s.scope&&r.set("scope",s.scope),s.code_challenge&&r.set("code_challenge",s.code_challenge),s.code_challenge_method&&r.set("code_challenge_method",s.code_challenge_method),`/api/auth/mcp/authorize?${r.toString()}`}function ue(s){const r=oe.c(5),{callbackURL:l,providerId:u}=s;let i,d;r[0]!==l||r[1]!==u?(i=()=>{(async()=>await p.signIn.sso({providerId:u,callbackURL:l}))()},d=[u,l],r[0]=l,r[1]=u,r[2]=i,r[3]=d):(i=r[2],d=r[3]),x.useEffect(i,d);let n;return r[4]===Symbol.for("react.memo_cache_sentinel")?(n=e.jsx($,{}),r[4]=n):n=r[4],n}function ge(){const s=p.useSession(),r=ae({from:"/login"}),{next:l="/",client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}=r,b=l.startsWith("/")&&!l.startsWith("//")?l:"/",{sso:C,emailAndPassword:O,magicLink:A,emailOtp:L,socialProviders:R,localMode:z}=X(),N=ce({client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}),c=N||b;return s.data?N?(window.location.href=N,e.jsx($,{})):e.jsx(ie,{to:b}):z?e.jsx(de,{redirectTo:c}):C.enabled?e.jsx(ue,{callbackURL:c,providerId:C.providerId}):O.enabled||A.enabled||L.enabled||R.enabled?e.jsxs("main",{className:"relative flex min-h-screen items-stretch md:items-center justify-center bg-gradient-to-br from-brand to-brand/75 p-1 md:p-4",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--brand-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e.jsxs("div",{className:"relative z-10 w-full md:w-auto",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx(le,{redirectUrl:N,callbackUrl:b})]})]}):e.jsx("div",{children:"No login options available"})}export{ge as default};
1
+ import{u as X,r as x,a as V,t as P,b as p,j as e,B as f,c as T,d as ae,S as $,N as ie,e as oe}from"./index-D3dcRy4-.js";import{I}from"./input-BTdB8RPC.js";function le({redirectUrl:s,callbackUrl:r="/"}){const{emailAndPassword:l,resetPassword:u,emailOtp:i,socialProviders:d}=X(),[n,j]=x.useState(""),[y,D]=x.useState(""),[b,C]=x.useState(""),[O,A]=x.useState(""),[L,R]=x.useState(!1),[z,N]=x.useState(()=>!l.enabled&&i.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[c,S]=x.useState(""),[Y,G]=x.useState(!1),m=z==="signUp",h=z==="forgotPassword",w=z==="emailOtp",F=V({mutationFn:async({email:t,password:a,name:q})=>{try{if(m){const g=await p.signUp.email({email:t,password:a,name:q||""});if(g.error)throw new Error(g.error.message||"Sign up failed");return g}else{const g=await p.signIn.email({email:t,password:a});if(g.error)throw new Error(g.error.message||"Sign in failed");return g}}catch(g){throw g instanceof Error?g:new Error("Authentication failed")}},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P(m?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),U=V({mutationFn:async({email:t})=>{const a=await p.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(a.error)throw new Error(a.error.message||"Failed to send reset email");return a},onSuccess:()=>{P("password_reset_requested"),G(!0)},onError:t=>{P("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),E=V({mutationFn:async({email:t})=>{const a=await p.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(a.error)throw new Error(a.error.message||"Failed to send code");return a},onSuccess:()=>{P("email_otp_sent"),R(!0)},onError:t=>{P("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),_=V({mutationFn:async({email:t,otp:a})=>{const q=await p.signIn.emailOtp({email:t,otp:a});if(q.error)throw new Error(q.error.message||"Invalid code");return q},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),B=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),W=()=>{n.trim()&&!B(n)&&S("Invalid email address")},Z=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}F.mutate({email:n,password:y,name:b})},ee=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}U.mutate({email:n})},te=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}E.mutate({email:n})},se=t=>{t.preventDefault(),_.mutate({email:n,otp:O})},k=t=>a=>{t(a.target.value),H&&F.reset(),J&&U.reset(),K&&(E.reset(),_.reset()),t===j&&c&&S("")},M=t=>{N(t),C(""),A(""),R(!1),S(""),G(!1),F.reset(),U.reset(),E.reset(),_.reset()},o=F.isPending||U.isPending||E.isPending||_.isPending,H=F.error,J=U.error,K=E.error||_.error,v=m?n.trim()&&y.trim()&&b.trim():h?n.trim():w?L?O.trim():n.trim():n.trim()&&y.trim(),re=t=>{if(!t)return null;const a=t.message.toLowerCase();return a.includes("unauthorized")||a.includes("401")?"Invalid email or password. Please try again.":a.includes("already exists")||a.includes("409")?"An account with this email already exists. Try signing in instead.":a.includes("network")||a.includes("fetch")?"Network error. Please check your connection and try again.":a.includes("rate limit")||a.includes("429")?"Too many attempts. Please wait a moment and try again.":a.includes("invalid")&&a.includes("otp")?"Invalid or expired code. Please try again.":t.message||"An error occurred. Please try again."},Q=H||J||K,ne=h?"Reset your password":w?L?"Enter verification code":"Sign in with email code":m?"Create your account":"Login or signup below";return e.jsxs("div",{className:"mx-auto w-full min-h-full md:min-h-0 md:min-w-[400px] max-w-md grid gap-6 content-center bg-card p-6 md:p-10 border border-primary-foreground/20",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e.jsx("div",{className:"text-center space-y-1",children:e.jsx("p",{className:"text-sm text-foreground/70",children:ne})}),Q&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:re(Q)}),Y&&e.jsx("div",{className:"rounded-xl bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400 text-center",children:"Check your email for a password reset link."}),!h&&d.enabled&&e.jsx("div",{className:"grid gap-3",children:d.providers.map(t=>e.jsxs(f,{type:"button",variant:"outline",size:"lg",className:"w-full font-medium",disabled:o,onClick:()=>{p.signIn.social({provider:t.name,callbackURL:s??r})},children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:"h-5 w-5","aria-hidden":"true"}),"Continue with"," ",t.name.charAt(0).toUpperCase()+t.name.slice(1)]},t.name))}),!h&&d.enabled&&(l.enabled||i.enabled)&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),w&&i.enabled&&e.jsx(e.Fragment,{children:L?e.jsxs("form",{onSubmit:se,className:"grid gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-muted/50 p-3 text-sm text-muted-foreground text-center",children:["Code sent to ",n]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Verification code"}),e.jsx(I,{type:"text",placeholder:"Enter code",value:O,onChange:k(A),required:!0,disabled:o,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code"})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Verifying...":"Verify"}),e.jsx(f,{type:"button",variant:"ghost",onClick:()=>{R(!1),A(""),E.reset(),_.reset()},disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Use a different email"})]}):e.jsxs("form",{onSubmit:te,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send code"})]})}),h&&l.enabled&&!Y&&e.jsxs("form",{onSubmit:ee,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send reset link"})]}),!h&&!w&&l.enabled&&e.jsxs("form",{onSubmit:Z,className:"grid gap-4",children:[e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",m?"max-h-[200px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsxs("div",{className:T("p-1",!m&&"pointer-events-none"),children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Name"}),e.jsx(I,{type:"text",placeholder:"Your name",value:b,onChange:k(C),required:!0,disabled:o||!m,"aria-hidden":!m})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Password"}),!m&&u.enabled&&e.jsx("button",{type:"button",onClick:()=>M("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Forgot password?"})]}),e.jsx(I,{type:"password",placeholder:"••••••••",value:y,onChange:k(D),required:!0,disabled:o})]}),e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",v?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:T("p-1",!v&&"pointer-events-none"),children:e.jsx(f,{type:"submit",disabled:o||!v,className:T("w-full font-semibold"),size:"lg","aria-hidden":!v,children:o?m?"Creating account...":"Signing in...":"Continue"})})})]}),!h&&i.enabled&&l.enabled&&!w&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("emailOtp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with email code instead"})}),w&&l.enabled&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with password instead"})}),e.jsx("div",{className:"text-center",children:h?e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Back to sign in"}):!w&&l.enabled?e.jsx(f,{type:"button",variant:"link",onClick:()=>M(m?"signIn":"signUp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:m?"Already have an account? Sign in":"Don't have an account? Sign up"}):null}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground pt-4",children:[e.jsx("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),e.jsx("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})}function de({redirectTo:s}){const[r,l]=x.useState(null);return x.useEffect(()=>{let u=!1;return(async()=>{try{let i;for(let d=0;d<5&&(i=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"}),!(i.ok||i.status<500));d++)await new Promise(n=>setTimeout(n,Math.min(1e3*2**d,1e4)));if(!i?.ok){const d=await i?.json().catch(()=>({}));throw new Error(d?.error||"Auto-login failed")}if(!u){const d=s.startsWith("/")&&!s.startsWith("//")?s:"/";window.location.href=d}}catch(i){u||l(i instanceof Error?i.message:"Auto-login failed")}})(),()=>{u=!0}},[s]),r?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-destructive mb-2",children:["Auto-login failed: ",r]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try restarting the server."})]})}):e.jsx($,{})}function ce(s){if(!s.client_id||s.response_type!=="code")return null;const r=new URLSearchParams;return s.client_id&&r.set("client_id",s.client_id),s.redirect_uri&&r.set("redirect_uri",s.redirect_uri),s.response_type&&r.set("response_type",s.response_type),s.state&&r.set("state",s.state),s.scope&&r.set("scope",s.scope),s.code_challenge&&r.set("code_challenge",s.code_challenge),s.code_challenge_method&&r.set("code_challenge_method",s.code_challenge_method),`/api/auth/mcp/authorize?${r.toString()}`}function ue(s){const r=oe.c(5),{callbackURL:l,providerId:u}=s;let i,d;r[0]!==l||r[1]!==u?(i=()=>{(async()=>await p.signIn.sso({providerId:u,callbackURL:l}))()},d=[u,l],r[0]=l,r[1]=u,r[2]=i,r[3]=d):(i=r[2],d=r[3]),x.useEffect(i,d);let n;return r[4]===Symbol.for("react.memo_cache_sentinel")?(n=e.jsx($,{}),r[4]=n):n=r[4],n}function ge(){const s=p.useSession(),r=ae({from:"/login"}),{next:l="/",client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}=r,b=l.startsWith("/")&&!l.startsWith("//")?l:"/",{sso:C,emailAndPassword:O,magicLink:A,emailOtp:L,socialProviders:R,localMode:z}=X(),N=ce({client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}),c=N||b;return s.data?N?(window.location.href=N,e.jsx($,{})):e.jsx(ie,{to:b}):z?e.jsx(de,{redirectTo:c}):C.enabled?e.jsx(ue,{callbackURL:c,providerId:C.providerId}):O.enabled||A.enabled||L.enabled||R.enabled?e.jsxs("main",{className:"relative flex min-h-screen items-stretch md:items-center justify-center bg-gradient-to-br from-brand to-brand/75 p-1 md:p-4",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--brand-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e.jsxs("div",{className:"relative z-10 w-full md:w-auto",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx(le,{redirectUrl:N,callbackUrl:b})]})]}):e.jsx("div",{children:"No login options available"})}export{ge as default};
@@ -1,3 +1,3 @@
1
- import{y as It,r as re,s as fe,o as Re,b as xe,x as Mt,a as pe,t as ue,z as U,K as ne,j as s,B as Ie,e as W,V as At,n as bt,c as Pe,l as Ge,E as _t}from"./index-CVUETRIB.js";import{C as Et}from"./collection-display-button-cYrSfrMz.js";import{S as Pt}from"./search-input-DQ1Xzm_b.js";import{P as Te}from"./index-Dig_TVyF.js";import{C as Rt}from"./collection-table-wrapper-D7Avuad7.js";import{E as Ve}from"./empty-state-JxMlNoaR.js";import{d as zt,h as $t,c as Dt,a as kt,D as Ft,b as Lt}from"./dialog-Dv_lEigV.js";import{F as Ot,a as et,b as tt,c as qt,d as st,e as nt}from"./form-BNoUlod_.js";import{a as Je,c as He,d as We,S as Ye,b as Ze}from"./select-DaM3TY5t.js";import{T as Bt}from"./textarea-CjtgfBdH.js";import{u as jt}from"./use-organization-roles-Bpj16cC4.js";import{u as Kt}from"./use-members-BAhIl5n0.js";import{S as ze,u as $e}from"./constants-Dsh71ijv.js";import{a as Vt,b as Qt,T as Ut,c as Gt}from"./use-mobile-BpBXbl16.js";import{a as it,e as at,g as lt,b as ot,c as rt,d as ct,A as mt,f as dt}from"./alert-dialog-P1MELuo2.js";import{A as Oe}from"./avatar-C4Xk2I9Z.js";import{B as Be}from"./badge-LkPgBUqp.js";import{C as ut}from"./card-oTGN-YLV.js";import{c as vt,d as Ct,e as yt,a as Jt,f as Ht,b as Wt,D as Xe,i as Yt}from"./dropdown-menu-B9QIvjxH.js";import{i as St}from"./DotsVertical-DU62Ovco.js";import{a as Zt}from"./SearchMd-DIPAhwlI.js";import{i as Xt}from"./Shield01-yW6P30XX.js";import{s as wt,a as es}from"./XClose-xaUxE8BL.js";import{s as ts}from"./Trash01-CLPACLPe.js";import{C as ft}from"./checkbox-COiFtX5D.js";import{a as Qe,b as Ue,c as ht,C as ss,e as ns,f as is,d as as}from"./command-BcjbHr_r.js";import{a as ls,b as os,P as rs}from"./popover-C4684neQ.js";import{t as cs}from"./ChevronDown-aTqoLskN.js";import{s as ms}from"./Plus-DgDw4N5v.js";import"./view-mode-toggle-BiIaP24A.js";import"./X-BI3qXgCM.js";import"./table-BJ_I6wc6.js";import"./label-Do_qw_q4.js";import"./ChevronUp-BJsJc2K_.js";import"./User01-C_p7EKq6.js";import"./ChevronRight-D_eqesT2.js";import"./index-CjZGXiUn.js";const ds=It().email("Invalid email address");function us(t){if(!t.trim())return[];const e=t.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function fs({trigger:t}){const[e,n]=re.useState(!1),{locator:i}=fe(),r=Re(),{data:a}=xe.useSession(),o=a?.user?.email,{roles:l,isLoading:u}=jt(),f=l.filter(p=>p.role!=="owner"),m=Mt({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),S=m.watch("emailsText"),g=m.watch("role"),b=us(S).filter(p=>{const c=ds.safeParse(p).success,x=!o||p!==o.toLowerCase();return c&&x}),T=pe({mutationFn:async({emails:p,role:c})=>{if(!c)throw new Error("Please select a role");const x=await Promise.allSettled(p.map(async E=>{const w=await xe.organization.inviteMember({email:E,role:c});if(w.error)throw new Error(w.error.message);return w.data})),C=x.filter(E=>E.status==="rejected");if(C.length>0)throw new Error(`Failed to invite ${C.length} member${C.length>1?"s":""}`);return x},onSuccess:(p,{emails:c,role:x})=>{ue("member_invited",{count:c.length,role:x}),r.invalidateQueries({queryKey:ne.members(i)}),r.invalidateQueries({queryKey:ne.invitations(i)}),U.success(c.length===1?"Member invited successfully!":`${c.length} members invited successfully!`),m.reset({emailsText:"",role:"user"}),n(!1)},onError:(p,{emails:c,role:x})=>{ue("member_invite_failed",{count:c.length,role:x,error:p instanceof Error?p.message:String(p)}),U.error(p instanceof Error?p.message:"Failed to invite members")}}),y=p=>{if(b.length===0){U.error("Please enter at least one valid email address");return}if(!p.role){U.error("Please select a role");return}T.mutate({emails:b,role:p.role})},M=b.length>0&&!!g;return s.jsxs(zt,{open:e,onOpenChange:n,children:[s.jsx($t,{asChild:!0,children:t}),s.jsxs(Dt,{className:"sm:max-w-lg",children:[s.jsx(kt,{children:s.jsx(Ft,{children:"Invite members"})}),s.jsx(Ot,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(y),className:"space-y-4",children:[s.jsx(et,{control:m.control,name:"emailsText",render:({field:p})=>s.jsxs(tt,{children:[s.jsx(qt,{children:"Email addresses"}),s.jsx(st,{children:s.jsx(Bt,{...p,disabled:T.isPending,placeholder:`Enter email addresses separated by commas or new lines
1
+ import{y as It,r as re,s as fe,o as Re,b as xe,x as Mt,a as pe,t as ue,z as U,K as ne,j as s,B as Ie,e as W,V as At,n as bt,c as Pe,l as Ge,E as _t}from"./index-D3dcRy4-.js";import{C as Et}from"./collection-display-button-DJUi1nr2.js";import{S as Pt}from"./search-input-Cxdo8FJH.js";import{P as Te}from"./index-B07jP2sp.js";import{C as Rt}from"./collection-table-wrapper-CgJ-IWGp.js";import{E as Ve}from"./empty-state-Dyal5Xfo.js";import{d as zt,h as $t,c as Dt,a as kt,D as Ft,b as Lt}from"./dialog-eYBbNtPx.js";import{F as Ot,a as et,b as tt,c as qt,d as st,e as nt}from"./form-CIMdOf9q.js";import{a as Je,c as He,d as We,S as Ye,b as Ze}from"./select-pbe1Tw3i.js";import{T as Bt}from"./textarea-CWhJ3Xwe.js";import{u as jt}from"./use-organization-roles-DewFhO3_.js";import{u as Kt}from"./use-members-egBMdDNQ.js";import{S as ze,u as $e}from"./constants-DV1Uc_8Q.js";import{a as Vt,b as Qt,T as Ut,c as Gt}from"./use-mobile-BwJlvmat.js";import{a as it,e as at,g as lt,b as ot,c as rt,d as ct,A as mt,f as dt}from"./alert-dialog-DGf6p6RH.js";import{A as Oe}from"./avatar-BiQlJs5k.js";import{B as Be}from"./badge-BiDYflRu.js";import{C as ut}from"./card-kpHhMcOo.js";import{c as vt,d as Ct,e as yt,a as Jt,f as Ht,b as Wt,D as Xe,i as Yt}from"./dropdown-menu-BeTlEYH5.js";import{i as St}from"./DotsVertical-BooYL5-r.js";import{a as Zt}from"./SearchMd-DRU7KH2R.js";import{i as Xt}from"./Shield01-CyMbm-kt.js";import{s as wt,a as es}from"./XClose-DmXYRRRU.js";import{s as ts}from"./Trash01-5isrbkO6.js";import{C as ft}from"./checkbox-DVSlEbBg.js";import{a as Qe,b as Ue,c as ht,C as ss,e as ns,f as is,d as as}from"./command-DUlueOVl.js";import{a as ls,b as os,P as rs}from"./popover-0rGXbfVv.js";import{t as cs}from"./ChevronDown-CAze57fI.js";import{s as ms}from"./Plus-C-OJiAlg.js";import"./view-mode-toggle-Co7HEZDI.js";import"./X-KZf37p0i.js";import"./table-Chd-IJRh.js";import"./label-HfwUkinD.js";import"./ChevronUp-CTU6V7Q0.js";import"./User01-CtVgwrxn.js";import"./ChevronRight-Df7bIxwE.js";import"./index-Duvlh7HC.js";const ds=It().email("Invalid email address");function us(t){if(!t.trim())return[];const e=t.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function fs({trigger:t}){const[e,n]=re.useState(!1),{locator:i}=fe(),r=Re(),{data:a}=xe.useSession(),o=a?.user?.email,{roles:l,isLoading:u}=jt(),f=l.filter(p=>p.role!=="owner"),m=Mt({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),S=m.watch("emailsText"),g=m.watch("role"),b=us(S).filter(p=>{const c=ds.safeParse(p).success,x=!o||p!==o.toLowerCase();return c&&x}),T=pe({mutationFn:async({emails:p,role:c})=>{if(!c)throw new Error("Please select a role");const x=await Promise.allSettled(p.map(async E=>{const w=await xe.organization.inviteMember({email:E,role:c});if(w.error)throw new Error(w.error.message);return w.data})),C=x.filter(E=>E.status==="rejected");if(C.length>0)throw new Error(`Failed to invite ${C.length} member${C.length>1?"s":""}`);return x},onSuccess:(p,{emails:c,role:x})=>{ue("member_invited",{count:c.length,role:x}),r.invalidateQueries({queryKey:ne.members(i)}),r.invalidateQueries({queryKey:ne.invitations(i)}),U.success(c.length===1?"Member invited successfully!":`${c.length} members invited successfully!`),m.reset({emailsText:"",role:"user"}),n(!1)},onError:(p,{emails:c,role:x})=>{ue("member_invite_failed",{count:c.length,role:x,error:p instanceof Error?p.message:String(p)}),U.error(p instanceof Error?p.message:"Failed to invite members")}}),y=p=>{if(b.length===0){U.error("Please enter at least one valid email address");return}if(!p.role){U.error("Please select a role");return}T.mutate({emails:b,role:p.role})},M=b.length>0&&!!g;return s.jsxs(zt,{open:e,onOpenChange:n,children:[s.jsx($t,{asChild:!0,children:t}),s.jsxs(Dt,{className:"sm:max-w-lg",children:[s.jsx(kt,{children:s.jsx(Ft,{children:"Invite members"})}),s.jsx(Ot,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(y),className:"space-y-4",children:[s.jsx(et,{control:m.control,name:"emailsText",render:({field:p})=>s.jsxs(tt,{children:[s.jsx(qt,{children:"Email addresses"}),s.jsx(st,{children:s.jsx(Bt,{...p,disabled:T.isPending,placeholder:`Enter email addresses separated by commas or new lines
2
2
  e.g. user1@example.com, user2@example.com
3
3
  or one per line`,className:"min-h-[120px] resize-none"})}),s.jsx(nt,{})]})}),s.jsx(et,{control:m.control,name:"role",render:({field:p})=>s.jsxs(tt,{children:[s.jsx(st,{children:s.jsxs(Je,{value:p.value,onValueChange:p.onChange,disabled:T.isPending||u,children:[s.jsx(He,{className:"w-full",children:s.jsx(We,{placeholder:"Select a role"})}),s.jsx(Ye,{children:f.map(c=>{const x=[];return c.isBuiltin||(c.allowsAllStaticPermissions?x.push("Full org access"):c.staticPermissionCount&&c.staticPermissionCount>0&&x.push(`${c.staticPermissionCount} org perm${c.staticPermissionCount!==1?"s":""}`),c.allowsAllConnections?x.push("All connections"):c.connectionCount&&c.connectionCount>0&&x.push(`${c.connectionCount} connection${c.connectionCount!==1?"s":""}`),(c.connectionCount!==0||c.allowsAllConnections)&&(c.allowsAllTools?x.push("all tools"):c.toolCount&&c.toolCount>0&&x.push(`${c.toolCount} tool${c.toolCount!==1?"s":""}`))),s.jsx(Ze,{value:c.role,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:c.label}),!c.isBuiltin&&x.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:x.join(", ")})]})},c.role)})})]})}),s.jsx(nt,{})]})}),s.jsxs(Lt,{children:[s.jsx(Ie,{variant:"outline",onClick:()=>{m.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:T.isPending,children:"Cancel"}),s.jsx(Ie,{type:"submit",disabled:T.isPending||!M,children:T.isPending?"Inviting...":`Invite ${b.length||0} Member${b.length!==1?"s":""}`})]})]})})]})]})}function hs(){const t=W.c(9),{org:e,locator:n}=fe();let i;t[0]!==e.id?(i={connectionId:ze,orgId:e.id},t[0]=e.id,t[1]=i):i=t[1];const r=$e(i);let a;t[2]!==n?(a=ne.invitations(n),t[2]=n,t[3]=a):a=t[3];let o;t[4]!==r?(o=async()=>{const u=await r.callTool({name:"ORGANIZATION_GET",arguments:{}});return(u.structuredContent??u)?.invitations??[]},t[4]=r,t[5]=o):o=t[5];let l;return t[6]!==a||t[7]!==o?(l={queryKey:a,queryFn:o},t[6]=a,t[7]=o,t[8]=l):l=t[8],At(l)}function gs(){const t=W.c(5),{locator:e}=fe(),n=Re();let i;t[0]!==e||t[1]!==n?(i={mutationFn:xs,onSuccess:()=>{n.invalidateQueries({queryKey:ne.invitations(e)}),U.success("Invitation cancelled")},onError:ps},t[0]=e,t[1]=n,t[2]=i):i=t[2];const r=pe(i);let a;return t[3]!==r?(a={cancel:r},t[3]=r,t[4]=a):a=t[4],a}function ps(t){U.error(t instanceof Error?t.message:"Failed to cancel invitation")}async function xs(t){const e=await xe.organization.cancelInvitation({invitationId:t});if(e?.error)throw new Error(e.error.message);return e.data}function bs(){const t=W.c(9),{org:e,locator:n}=fe();let i;t[0]!==e.id?(i={connectionId:ze,orgId:e.id},t[0]=e.id,t[1]=i):i=t[1];const r=$e(i);let a;t[2]!==n?(a=ne.tags(n),t[2]=n,t[3]=a):a=t[3];let o;t[4]!==r?(o=async()=>{const u=await r.callTool({name:"TAGS_LIST",arguments:{}});return(u.structuredContent??u).tags},t[4]=r,t[5]=o):o=t[5];let l;return t[6]!==a||t[7]!==o?(l={queryKey:a,queryFn:o,staleTime:3e4},t[6]=a,t[7]=o,t[8]=l):l=t[8],bt(l)}function js(){const t=W.c(10),e=Re(),{org:n,locator:i}=fe();let r;t[0]!==n.id?(r={connectionId:ze,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const a=$e(r);let o;t[2]!==a?(o=async f=>{const m=await a.callTool({name:"TAGS_CREATE",arguments:{name:f}});return(m.structuredContent??m).tag},t[2]=a,t[3]=o):o=t[3];let l;t[4]!==i||t[5]!==e?(l=()=>{e.invalidateQueries({queryKey:ne.tags(i)})},t[4]=i,t[5]=e,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u={mutationFn:o,onSuccess:l,onError:vs},t[7]=o,t[8]=l,t[9]=u):u=t[9],pe(u)}function vs(t){U.error(t instanceof Error?t.message:"Failed to create tag")}function Cs(t){const e=W.c(12),{org:n,locator:i}=fe();let r;e[0]!==n.id?(r={connectionId:ze,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const a=$e(r);let o;e[2]!==i||e[3]!==t?(o=ne.memberTags(i,t),e[2]=i,e[3]=t,e[4]=o):o=e[4];let l;e[5]!==a||e[6]!==t?(l=async()=>{const m=await a.callTool({name:"MEMBER_TAGS_GET",arguments:{memberId:t}});return(m.structuredContent??m).tags},e[5]=a,e[6]=t,e[7]=l):l=e[7];const u=!!t;let f;return e[8]!==o||e[9]!==l||e[10]!==u?(f={queryKey:o,queryFn:l,staleTime:3e4,enabled:u},e[8]=o,e[9]=l,e[10]=u,e[11]=f):f=e[11],bt(f)}function ys(){const t=W.c(10),e=Re(),{org:n,locator:i}=fe();let r;t[0]!==n.id?(r={connectionId:ze,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const a=$e(r);let o;t[2]!==a?(o=async f=>{const{memberId:m,tagIds:S}=f,g=await a.callTool({name:"MEMBER_TAGS_SET",arguments:{memberId:m,tagIds:S}});return g.structuredContent??g},t[2]=a,t[3]=o):o=t[3];let l;t[4]!==i||t[5]!==e?(l=(f,m)=>{e.invalidateQueries({queryKey:ne.memberTags(i,m.memberId)})},t[4]=i,t[5]=e,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u={mutationFn:o,onSuccess:l,onError:Ss},t[7]=o,t[8]=l,t[9]=u):u=t[9],pe(u)}function Ss(t){U.error(t instanceof Error?t.message:"Failed to update member tags")}function Nt(t){const e=W.c(44),{memberId:n,className:i,disabled:r,placeholder:a,maxDisplay:o}=t,l=r===void 0?!1:r,u=a===void 0?"Add tags...":a,f=o===void 0?2:o,[m,S]=re.useState(!1),[g,$]=re.useState(""),{data:b,isLoading:T}=bs(),y=b===void 0?[]:b,{data:M,isLoading:p}=Cs(n),c=M===void 0?[]:M,x=js(),C=ys(),E=T||p,w=c.map(Ns);let A;e[0]!==g?(A=v=>v.name.toLowerCase().includes(g.toLowerCase()),e[0]=g,e[1]=A):A=e[1];const P=y.filter(A);let _;e[2]!==g?(_=v=>v.name.toLowerCase()===g.toLowerCase(),e[2]=g,e[3]=_):_=e[3];const R=y.find(_),z=g.trim()&&!R,L=async v=>{const ge=w.includes(v.id)?w.filter(_e=>_e!==v.id):[...w,v.id];await C.mutateAsync({memberId:n,tagIds:ge})},I=async()=>{if(!g.trim())return;const v=await x.mutateAsync(g.trim());await C.mutateAsync({memberId:n,tagIds:[...w,v.id]}),$("")},d=async v=>{const te=w.filter(ge=>ge!==v);await C.mutateAsync({memberId:n,tagIds:te})},N=x.isPending||C.isPending,q=os;let k;e[4]!==m?(k=()=>S(!m),e[4]=m,e[5]=k):k=e[5];let D;e[6]!==i?(D=Pe("h-auto min-h-8 px-2 py-1 justify-start font-normal","hover:bg-accent/50",i),e[6]=i,e[7]=D):D=e[7];const V=l||E,O=E?s.jsx(Ge,{size:14,className:"animate-spin text-muted-foreground"}):c.length>0?s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[c.slice(0,f).map(ws),c.length>f&&s.jsxs(Be,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:["+",c.length-f]})]}):s.jsx("span",{className:"text-muted-foreground text-xs",children:u});let B;e[8]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(cs,{size:14,className:"ml-1 shrink-0 opacity-50"}),e[8]=B):B=e[8];let K;e[9]!==V||e[10]!==O||e[11]!==k||e[12]!==D?(K=s.jsx(rs,{asChild:!0,children:s.jsxs(Ie,{variant:"ghost",size:"sm",onClick:k,className:D,disabled:V,children:[O,B]})}),e[9]=V,e[10]=O,e[11]=k,e[12]=D,e[13]=K):K=e[13];const Q=ls,G="w-56 p-0",ce="start";let J;e[14]===Symbol.for("react.memo_cache_sentinel")?(J=()=>S(!1),e[14]=J):J=e[14];const Me=is,Ae=!1;let ie;e[15]!==g?(ie=s.jsx(as,{placeholder:"Search or create...",value:g,onValueChange:$,className:"h-9"}),e[15]=g,e[16]=ie):ie=e[16];const he=ns,me=c.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Qe,{heading:"Selected",children:c.map(v=>s.jsx(Ue,{onSelect:()=>L(v),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ft,{checked:!0,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:v.name})]}),s.jsx("button",{onClick:te=>{te.stopPropagation(),d(v.id)},className:"opacity-50 hover:opacity-100",disabled:N,children:s.jsx(wt,{size:14})})]})},v.id))}),s.jsx(ht,{})]}),de=Qe,be="Available",ae=P.length===0&&!z&&s.jsx(ss,{children:"No tags found."}),le=P.filter(v=>!w.includes(v.id)).map(v=>s.jsx(Ue,{onSelect:()=>L(v),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ft,{checked:!1,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:v.name})]})},v.id));let H;e[17]!==de||e[18]!==ae||e[19]!==le?(H=s.jsxs(de,{heading:be,children:[ae,le]}),e[17]=de,e[18]=ae,e[19]=le,e[20]=H):H=e[20];let oe;e[21]!==I||e[22]!==N||e[23]!==g||e[24]!==z?(oe=z&&s.jsxs(s.Fragment,{children:[s.jsx(ht,{}),s.jsx(Qe,{children:s.jsx(Ue,{onSelect:I,className:"cursor-pointer",disabled:N,children:s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[N?s.jsx(Ge,{size:14,className:"animate-spin"}):s.jsx(ms,{size:14}),s.jsxs("span",{children:['Create "',g.trim(),'"']})]})})})]}),e[21]=I,e[22]=N,e[23]=g,e[24]=z,e[25]=oe):oe=e[25];let Y;e[26]!==he||e[27]!==me||e[28]!==H||e[29]!==oe?(Y=s.jsxs(he,{children:[me,H,oe]}),e[26]=he,e[27]=me,e[28]=H,e[29]=oe,e[30]=Y):Y=e[30];let Z;e[31]!==Me||e[32]!==ie||e[33]!==Y?(Z=s.jsxs(Me,{shouldFilter:Ae,children:[ie,Y]}),e[31]=Me,e[32]=ie,e[33]=Y,e[34]=Z):Z=e[34];let X;e[35]!==Q||e[36]!==J||e[37]!==Z?(X=s.jsx(Q,{className:G,align:ce,onEscapeKeyDown:J,children:Z}),e[35]=Q,e[36]=J,e[37]=Z,e[38]=X):X=e[38];let ee;return e[39]!==q||e[40]!==m||e[41]!==K||e[42]!==X?(ee=s.jsxs(q,{open:m,onOpenChange:S,children:[K,X]}),e[39]=q,e[40]=m,e[41]=K,e[42]=X,e[43]=ee):ee=e[43],ee}function ws(t){return s.jsx(Be,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:t.name},t.id)}function Ns(t){return t.id}const gt=["bg-neutral-400","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","bg-slate-500"],Ts={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function qe(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Is(t){const e=new Map;for(const[n,i]of Object.entries(Ts))e.set(n,i);for(let n=0;n<t.length;n++){const i=t[n];i&&!e.has(i.role)&&e.set(i.role,gt[n%gt.length]??"bg-neutral-400")}return e}function Ms(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function Le(t){const e=W.c(79),{role:n,memberId:i,isOwner:r,roleColorMap:a,selectableRoles:o,onRoleChange:l,size:u,className:f}=t,m=u===void 0?"xs":u;let S,g,$,b,T,y,M,p,c,x,C;if(e[0]!==f||e[1]!==r||e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==a||e[6]!==o||e[7]!==m){C=Symbol.for("react.early_return_sentinel");e:{const I=a.get(n)??"bg-neutral-400";if(r){let d;e[19]!==i||e[20]!==l?(d=G=>l(i,G),e[19]=i,e[20]=l,e[21]=d):d=e[21];let N;e[22]!==n?(N=s.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=N):N=e[23];const q=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:Pe("size-2 rounded-full shrink-0",I)}),N]});let k;e[24]!==q?(k=s.jsx(We,{children:q}),e[24]=q,e[25]=k):k=e[25];let D;e[26]!==f||e[27]!==m||e[28]!==k?(D=s.jsx(He,{size:m,className:f,children:k}),e[26]=f,e[27]=m,e[28]=k,e[29]=D):D=e[29];let V;if(e[30]!==a||e[31]!==o){let G;e[33]!==a?(G=ce=>{const J=a.get(ce.role)??"bg-neutral-400";return s.jsx(Ze,{value:ce.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:Pe("size-3 rounded-full",J)}),s.jsx("span",{className:"capitalize",children:ce.label})]})},ce.role)},e[33]=a,e[34]=G):G=e[34],V=o.map(G),e[30]=a,e[31]=o,e[32]=V}else V=e[32];let O;e[35]!==V?(O=s.jsx(Ye,{children:V}),e[35]=V,e[36]=O):O=e[36];let B;e[37]!==r||e[38]!==n||e[39]!==d||e[40]!==D||e[41]!==O?(B=s.jsx(Vt,{asChild:!0,children:s.jsx("div",{className:"w-fit",children:s.jsxs(Je,{value:n,onValueChange:d,disabled:r,children:[D,O]})})}),e[37]=r,e[38]=n,e[39]=d,e[40]=D,e[41]=O,e[42]=B):B=e[42];let K;e[43]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Qt,{children:s.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=K):K=e[43];let Q;e[44]!==B?(Q=s.jsx(Ut,{children:s.jsxs(Gt,{children:[B,K]})}),e[44]=B,e[45]=Q):Q=e[45],C=Q;break e}$=Je,p=n,e[46]!==i||e[47]!==l?(c=d=>l(i,d),e[46]=i,e[47]=l,e[48]=c):c=e[48],x=r,g=He,y=m,M=f,S=We,T="flex items-center gap-2 min-w-0",b=Pe("size-2 rounded-full shrink-0",I)}e[0]=f,e[1]=r,e[2]=i,e[3]=l,e[4]=n,e[5]=a,e[6]=o,e[7]=m,e[8]=S,e[9]=g,e[10]=$,e[11]=b,e[12]=T,e[13]=y,e[14]=M,e[15]=p,e[16]=c,e[17]=x,e[18]=C}else S=e[8],g=e[9],$=e[10],b=e[11],T=e[12],y=e[13],M=e[14],p=e[15],c=e[16],x=e[17],C=e[18];if(C!==Symbol.for("react.early_return_sentinel"))return C;let E;e[49]!==b?(E=s.jsx("div",{className:b}),e[49]=b,e[50]=E):E=e[50];let w;e[51]!==n?(w=s.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=w):w=e[52];let A;e[53]!==E||e[54]!==w||e[55]!==T?(A=s.jsxs("div",{className:T,children:[E,w]}),e[53]=E,e[54]=w,e[55]=T,e[56]=A):A=e[56];let P;e[57]!==S||e[58]!==A?(P=s.jsx(S,{children:A}),e[57]=S,e[58]=A,e[59]=P):P=e[59];let _;e[60]!==g||e[61]!==P||e[62]!==y||e[63]!==M?(_=s.jsx(g,{size:y,className:M,children:P}),e[60]=g,e[61]=P,e[62]=y,e[63]=M,e[64]=_):_=e[64];let R;if(e[65]!==a||e[66]!==o){let I;e[68]!==a?(I=d=>{const N=a.get(d.role)??"bg-neutral-400";return s.jsx(Ze,{value:d.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:Pe("size-3 rounded-full",N)}),s.jsx("span",{className:"capitalize",children:d.label})]})},d.role)},e[68]=a,e[69]=I):I=e[69],R=o.map(I),e[65]=a,e[66]=o,e[67]=R}else R=e[67];let z;e[70]!==R?(z=s.jsx(Ye,{children:R}),e[70]=R,e[71]=z):z=e[71];let L;return e[72]!==$||e[73]!==_||e[74]!==z||e[75]!==p||e[76]!==c||e[77]!==x?(L=s.jsxs($,{value:p,onValueChange:c,disabled:x,children:[_,z]}),e[72]=$,e[73]=_,e[74]=z,e[75]=p,e[76]=c,e[77]=x,e[78]=L):L=e[78],L}function pt(t){const e=W.c(51),{member:n,roles:i,onChangeRole:r,onRemove:a,isUpdating:o}=t,l=o===void 0?!1:o,u=n.role==="owner";let f,m,S,g,$,b,T,y,M;if(e[0]!==u||e[1]!==l||e[2]!==n.id||e[3]!==n.role||e[4]!==r||e[5]!==i){let _;e[15]!==n.role?(_=d=>d.role!==n.role&&d.role!=="owner",e[15]=n.role,e[16]=_):_=e[16];const R=i.filter(_);g=vt;let z;e[17]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(St,{size:20}),e[17]=z):z=e[17],e[18]!==u?(M=s.jsx(Ct,{asChild:!0,children:s.jsx(Ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:u,onClick:_s,children:z})}),e[18]=u,e[19]=M):M=e[19],S=yt,T="end",y=As,m=Jt;let L;e[20]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(es,{size:16}),e[20]=L):L=e[20],e[21]!==l?(b=s.jsxs(Ht,{disabled:l,children:[L,"Change Role"]}),e[21]=l,e[22]=b):b=e[22],f=Wt;let I;e[23]!==l||e[24]!==n.id||e[25]!==r?(I=d=>{const N=[];return d.isBuiltin||(d.allowsAllStaticPermissions?N.push("Full org access"):d.staticPermissionCount&&d.staticPermissionCount>0&&N.push(`${d.staticPermissionCount} org perm${d.staticPermissionCount!==1?"s":""}`),d.allowsAllConnections?N.push("All connections"):d.connectionCount&&d.connectionCount>0&&N.push(`${d.connectionCount} connection${d.connectionCount!==1?"s":""}`),(d.connectionCount!==0||d.allowsAllConnections)&&(d.allowsAllTools?N.push("all tools"):d.toolCount&&d.toolCount>0&&N.push(`${d.toolCount} tool${d.toolCount!==1?"s":""}`))),s.jsxs(Xe,{onClick:q=>{q.stopPropagation(),r(n.id,d.role)},disabled:l,children:[d.isBuiltin?s.jsx(Xt,{size:16}):s.jsx(Zt,{size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:d.label}),!d.isBuiltin&&N.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:N.join(", ")})]})]},d.role)},e[23]=l,e[24]=n.id,e[25]=r,e[26]=I):I=e[26],$=R.map(I),e[0]=u,e[1]=l,e[2]=n.id,e[3]=n.role,e[4]=r,e[5]=i,e[6]=f,e[7]=m,e[8]=S,e[9]=g,e[10]=$,e[11]=b,e[12]=T,e[13]=y,e[14]=M}else f=e[6],m=e[7],S=e[8],g=e[9],$=e[10],b=e[11],T=e[12],y=e[13],M=e[14];let p;e[27]!==f||e[28]!==$?(p=s.jsx(f,{children:$}),e[27]=f,e[28]=$,e[29]=p):p=e[29];let c;e[30]!==m||e[31]!==b||e[32]!==p?(c=s.jsxs(m,{children:[b,p]}),e[30]=m,e[31]=b,e[32]=p,e[33]=c):c=e[33];let x;e[34]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Yt,{}),e[34]=x):x=e[34];let C;e[35]!==n.id||e[36]!==a?(C=_=>{_.stopPropagation(),a(n.id)},e[35]=n.id,e[36]=a,e[37]=C):C=e[37];let E;e[38]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(ts,{size:16}),e[38]=E):E=e[38];let w;e[39]!==C?(w=s.jsxs(Xe,{variant:"destructive",onClick:C,children:[E,"Remove Member"]}),e[39]=C,e[40]=w):w=e[40];let A;e[41]!==S||e[42]!==w||e[43]!==T||e[44]!==y||e[45]!==c?(A=s.jsxs(S,{align:T,onClick:y,children:[c,x,w]}),e[41]=S,e[42]=w,e[43]=T,e[44]=y,e[45]=c,e[46]=A):A=e[46];let P;return e[47]!==g||e[48]!==A||e[49]!==M?(P=s.jsxs(g,{children:[M,A]}),e[47]=g,e[48]=A,e[49]=M,e[50]=P):P=e[50],P}function As(t){return t.stopPropagation()}function _s(t){return t.stopPropagation()}function xt(t){const e=W.c(8),{invitationId:n,onCancel:i,isCancelling:r}=t,a=r===void 0?!1:r;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Ct,{asChild:!0,children:s.jsx(Ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ps,children:s.jsx(St,{size:20})})}),e[0]=o):o=e[0];let l;e[1]!==n||e[2]!==i?(l=m=>{m.stopPropagation(),i(n)},e[1]=n,e[2]=i,e[3]=l):l=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(wt,{size:16}),e[4]=u):u=e[4];let f;return e[5]!==a||e[6]!==l?(f=s.jsxs(vt,{children:[o,s.jsx(yt,{align:"end",onClick:Es,children:s.jsxs(Xe,{variant:"destructive",onClick:l,disabled:a,children:[u,"Cancel Invitation"]})})]}),e[5]=a,e[6]=l,e[7]=f):f=e[7],f}function Es(t){return t.stopPropagation()}function Ps(t){return t.stopPropagation()}function Rs(){const t=W.c(86),{data:e}=Kt(),{data:n}=hs(),i=gs(),r=Re(),{locator:a}=fe(),[o,l]=re.useState(null),[u,f]=re.useState(null),[m,S]=re.useState(""),[g,$]=re.useState("table"),[b,T]=re.useState("member"),[y,M]=re.useState("asc"),p=e?.data?.members;let c;t[0]!==b?(c=h=>{b===h?M(Gs):(T(h),M("asc"))},t[0]=b,t[1]=c):c=t[1];const x=c;let C=p??[],E=n??[];if(m){const h=m.toLowerCase();C=C.filter(j=>j.user?.name?.toLowerCase().includes(h)||j.user?.email?.toLowerCase().includes(h)||j.role?.toLowerCase().includes(h)),E=E.filter(j=>j.email?.toLowerCase().includes(h)||j.role?.toLowerCase().includes(h))}if(b&&y){let h;t[2]!==y||t[3]!==b?(h=(j,F)=>{let se,Ee;e:switch(b){case"member":{se=j.user?.name||"",Ee=F.user?.name||"";break e}case"role":{se=j.role||"",Ee=F.role||"";break e}case"joined":{se=j.createdAt?typeof j.createdAt=="string"?j.createdAt:j.createdAt.toISOString():"",Ee=F.createdAt?typeof F.createdAt=="string"?F.createdAt:F.createdAt.toISOString():"";break e}default:return 0}return y==="asc"?se.localeCompare(Ee):Ee.localeCompare(se)},t[2]=y,t[3]=b,t[4]=h):h=t[4],C=[...C].sort(h)}const w=C;let A;t[5]!==a||t[6]!==r?(A={mutationFn:Us,onSuccess:()=>{ue("member_removed"),r.invalidateQueries({queryKey:ne.members(a)}),U.success("Member has been removed from the organization"),l(null)},onError:Qs},t[5]=a,t[6]=r,t[7]=A):A=t[7];const P=pe(A);let _;t[8]!==a||t[9]!==r?(_={mutationFn:Vs,onSuccess:(h,j)=>{ue("member_role_updated",{new_role:j.role}),r.invalidateQueries({queryKey:ne.members(a)}),U.success("Member's role has been updated")},onError:Ks},t[8]=a,t[9]=r,t[10]=_):_=t[10];const R=pe(_);let z;t[11]!==a||t[12]!==r?(z={mutationFn:Bs,onSuccess:(h,j)=>{ue("invitation_role_updated",{new_role:j.role}),r.invalidateQueries({queryKey:ne.invitations(a)}),U.success("Invitation role has been updated")},onError:qs},t[11]=a,t[12]=r,t[13]=z):z=t[13];const L=pe(z),{roles:I,customRoles:d}=jt();let N;t[14]!==d?(N=Is(d),t[14]=d,t[15]=N):N=t[15];const q=N;let k;t[16]!==I?(k=I.filter(Os),t[16]=I,t[17]=k):k=t[17];const D=k;let V;t[18]===Symbol.for("react.memo_cache_sentinel")?(V={id:"member",header:"Member",render:Ls,cellClassName:"flex-1 min-w-0",sortable:!0},t[18]=V):V=t[18];let O;t[19]!==q||t[20]!==D||t[21]!==L||t[22]!==R?(O={id:"role",header:"Role",render:h=>h.type==="member"?s.jsx(Le,{role:h.data.role,memberId:h.data.id,isOwner:h.data.role==="owner",roleColorMap:q,selectableRoles:D,onRoleChange:(j,F)=>R.mutate({memberId:j,role:F}),className:"w-36"}):s.jsx(Le,{role:h.data.role,memberId:h.data.id,isOwner:!1,roleColorMap:q,selectableRoles:D,onRoleChange:(j,F)=>L.mutate({invitationId:j,role:F,email:h.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},t[19]=q,t[20]=D,t[21]=L,t[22]=R,t[23]=O):O=t[23];let B,K;t[24]===Symbol.for("react.memo_cache_sentinel")?(B={id:"tags",header:"Tags",render:Fs,cellClassName:"w-40 shrink-0"},K={id:"joined",header:"Joined",render:ks,cellClassName:"w-48 shrink-0",sortable:!0},t[24]=B,t[25]=K):(B=t[24],K=t[25]);let Q;t[26]!==i.cancel.isPending||t[27]!==I||t[28]!==R?(Q={id:"actions",header:"",render:h=>h.type==="member"?s.jsx(pt,{member:h.data,roles:I,onChangeRole:(j,F)=>R.mutate({memberId:j,role:F}),onRemove:l,isUpdating:R.isPending}):s.jsx(xt,{invitationId:h.data.id,onCancel:f,isCancelling:i.cancel.isPending}),cellClassName:"w-12 shrink-0"},t[26]=i.cancel.isPending,t[27]=I,t[28]=R,t[29]=Q):Q=t[29];let G;t[30]!==Q||t[31]!==O?(G=[V,O,B,K,Q],t[30]=Q,t[31]=O,t[32]=G):G=t[32];const ce=G;let J;t[33]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(fs,{trigger:s.jsx(Ie,{children:"Invite Member"})})}),t[33]=J):J=t[33];const Me=J,Ae=[...w.map(Ds),...E.filter($s).map(zs)],ie=Te,he=!!u;let me;t[34]===Symbol.for("react.memo_cache_sentinel")?(me=()=>f(null),t[34]=me):me=t[34];let de;t[35]===Symbol.for("react.memo_cache_sentinel")?(de=s.jsxs(ot,{children:[s.jsx(rt,{children:"Cancel Invitation"}),s.jsx(ct,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),t[35]=de):de=t[35];let be;t[36]===Symbol.for("react.memo_cache_sentinel")?(be=s.jsx(mt,{children:"Keep Invitation"}),t[36]=be):be=t[36];let ae;t[37]!==i.cancel||t[38]!==u?(ae=()=>{u&&(i.cancel.mutate(u),f(null))},t[37]=i.cancel,t[38]=u,t[39]=ae):ae=t[39];let le;t[40]!==i.cancel.isPending||t[41]!==ae?(le=s.jsxs(it,{children:[de,s.jsxs(at,{children:[be,s.jsx(lt,{onClick:ae,disabled:i.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),t[40]=i.cancel.isPending,t[41]=ae,t[42]=le):le=t[42];let H;t[43]!==he||t[44]!==le?(H=s.jsx(dt,{open:he,onOpenChange:me,children:le}),t[43]=he,t[44]=le,t[45]=H):H=t[45];const oe=!!o;let Y;t[46]===Symbol.for("react.memo_cache_sentinel")?(Y=()=>l(null),t[46]=Y):Y=t[46];let Z;t[47]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsxs(ot,{children:[s.jsx(rt,{children:"Remove Member"}),s.jsx(ct,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),t[47]=Z):Z=t[47];let X;t[48]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx(mt,{children:"Cancel"}),t[48]=X):X=t[48];let ee;t[49]!==o||t[50]!==P?(ee=()=>o&&P.mutate(o),t[49]=o,t[50]=P,t[51]=ee):ee=t[51];let v;t[52]!==P.isPending||t[53]!==ee?(v=s.jsxs(it,{children:[Z,s.jsxs(at,{children:[X,s.jsx(lt,{onClick:ee,disabled:P.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),t[52]=P.isPending,t[53]=ee,t[54]=v):v=t[54];let te;t[55]!==oe||t[56]!==v?(te=s.jsx(dt,{open:oe,onOpenChange:Y,children:v}),t[55]=oe,t[56]=v,t[57]=te):te=t[57];const ge=Te,_e=Te,Tt="flex flex-col gap-6";let je;t[58]===Symbol.for("react.memo_cache_sentinel")?(je=s.jsx(Te.Title,{children:"Members"}),t[58]=je):je=t[58];let De;t[59]===Symbol.for("react.memo_cache_sentinel")?(De=h=>{h.key==="Escape"&&(S(""),h.target.blur())},t[59]=De):De=t[59];let ve;t[60]!==m?(ve=s.jsx(Pt,{value:m,onChange:S,placeholder:"Search members...",className:"w-full md:w-[375px]",onKeyDown:De}),t[60]=m,t[61]=ve):ve=t[61];let ke;t[62]===Symbol.for("react.memo_cache_sentinel")?(ke=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],t[62]=ke):ke=t[62];let Ce;t[63]!==x||t[64]!==y||t[65]!==b||t[66]!==g?(Ce=s.jsx(Et,{viewMode:g,onViewModeChange:$,sortKey:b,sortDirection:y,onSort:x,sortOptions:ke}),t[63]=x,t[64]=y,t[65]=b,t[66]=g,t[67]=Ce):Ce=t[67];let ye;t[68]!==ve||t[69]!==Ce?(ye=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[ve,Ce]}),Me]}),t[68]=ve,t[69]=Ce,t[70]=ye):ye=t[70];const Ke=g==="cards"?s.jsx("div",{children:Ae.length===0?s.jsx(Ve,{title:"No members found",description:m?`No members match "${m}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:Ae.map(h=>{if(h.type==="invitation")return s.jsxs(ut,{className:"transition-colors relative opacity-75",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(xt,{invitationId:h.data.id,onCancel:f,isCancelling:i.cancel.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Oe,{fallback:qe(h.data.email),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:h.data.email}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Be,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),s.jsx(Le,{role:h.data.role,memberId:h.data.id,isOwner:!1,roleColorMap:q,selectableRoles:D,onRoleChange:(F,se)=>L.mutate({invitationId:F,role:se,email:h.data.email}),className:"w-fit"})]})]})]},`inv-${h.data.id}`);const j=h.data;return s.jsxs(ut,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(pt,{member:j,roles:I,onChangeRole:(F,se)=>R.mutate({memberId:F,role:se}),onRemove:l,isUpdating:R.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Oe,{url:j.user?.image??void 0,fallback:qe(j.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:j.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:j.user?.email}),s.jsx(Le,{role:j.role,memberId:j.id,isOwner:j.role==="owner",roleColorMap:q,selectableRoles:D,onRoleChange:(F,se)=>R.mutate({memberId:F,role:se}),className:"w-fit"}),s.jsx(Nt,{memberId:j.id,maxDisplay:3})]})]})]},j.id)})})}):s.jsx(Rt,{columns:ce,data:Ae,isLoading:!1,sortKey:b,sortDirection:y,onSort:x,emptyState:m?s.jsx(Ve,{title:"No members found",description:`No members match "${m}"`}):s.jsx(Ve,{title:"No members found",description:"Invite members to get started."})});let Se;t[71]!==je||t[72]!==ye||t[73]!==Ke?(Se=s.jsxs("div",{className:Tt,children:[je,ye,Ke]}),t[71]=je,t[72]=ye,t[73]=Ke,t[74]=Se):Se=t[74];let we;t[75]!==_e.Body||t[76]!==Se?(we=s.jsx(_e.Body,{children:Se}),t[75]=_e.Body,t[76]=Se,t[77]=we):we=t[77];let Ne;t[78]!==ge.Content||t[79]!==we?(Ne=s.jsx(ge.Content,{children:we}),t[78]=ge.Content,t[79]=we,t[80]=Ne):Ne=t[80];let Fe;return t[81]!==ie||t[82]!==H||t[83]!==te||t[84]!==Ne?(Fe=s.jsxs(ie,{children:[H,te,Ne]}),t[81]=ie,t[82]=H,t[83]=te,t[84]=Ne,t[85]=Fe):Fe=t[85],Fe}function zs(t){return{type:"invitation",data:t}}function $s(t){return t.status==="pending"}function Ds(t){return{type:"member",data:t}}function ks(t){return t.type==="member"?s.jsx("span",{className:"text-sm text-foreground",children:t.data.createdAt?Ms(t.data.createdAt):"N/A"}):s.jsx(Be,{variant:"outline",children:"Pending"})}function Fs(t){return t.type==="member"?s.jsx(Nt,{memberId:t.data.id,maxDisplay:2}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function Ls(t){return t.type==="member"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Oe,{url:t.data.user?.image??void 0,fallback:qe(t.data.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.data.user?.email})]})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Oe,{fallback:qe(t.data.email),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.email}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function Os(t){return t.role!=="owner"}function qs(t,e){ue("invitation_role_update_failed",{new_role:e.role,error:t instanceof Error?t.message:String(t)}),U.error(t instanceof Error?t.message:"Failed to update invitation role")}async function Bs(t){const{invitationId:e,role:n,email:i}=t,r=await xe.organization.cancelInvitation({invitationId:e});if(r?.error)throw new Error(r.error.message);const a=await xe.organization.inviteMember({email:i,role:n});if(a?.error)throw new Error(a.error.message)}function Ks(t,e){ue("member_role_update_failed",{new_role:e.role,error:t instanceof Error?t.message:String(t)}),U.error(t instanceof Error?t.message:"Failed to update role")}async function Vs(t){const{memberId:e,role:n}=t,i=await xe.organization.updateMemberRole({memberId:e,role:[n]});if(i?.error)throw new Error(i.error.message)}function Qs(t){ue("member_remove_failed",{error:t instanceof Error?t.message:String(t)}),U.error(t instanceof Error?t.message:"Failed to remove member")}async function Us(t){const e=await xe.organization.removeMember({memberIdOrEmail:t});if(e?.error)throw new Error(e.error.message)}function Gs(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Pn(){const t=W.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 members"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(_t,{fallback:e,children:s.jsx(re.Suspense,{fallback:s.jsx(Te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(Ge,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Rs,{})})}),t[1]=n):n=t[1],n}export{Pn as default};
@@ -1,4 +1,4 @@
1
- import{r as a,bc as D,e as Me,j as _,aE as te}from"./index-CVUETRIB.js";import{S as me}from"./scroll-area-BmiP98pu.js";function ue(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Pe(e){if(Array.isArray(e))return e}function Re(e,t,r){return(t=Le(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Se(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,u,l=[],c=!0,g=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(O){g=!0,o=O}finally{try{if(!c&&r.return!=null&&(u=r.return(),Object(u)!==u))return}finally{if(g)throw o}}return l}}function xe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as a,bc as D,e as Me,j as _,aE as te}from"./index-D3dcRy4-.js";import{S as me}from"./scroll-area-Cmb2U-GX.js";function ue(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Pe(e){if(Array.isArray(e))return e}function Re(e,t,r){return(t=Le(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Se(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,u,l=[],c=!0,g=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(O){g=!0,o=O}finally{try{if(!c&&r.return!=null&&(u=r.return(),Object(u)!==u))return}finally{if(g)throw o}}return l}}function xe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function se(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ce(Object(r),!0).forEach(function(n){Re(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ce(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Te(e,t){if(e==null)return{};var r,n,o=_e(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function _e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Ce(e,t){return Pe(e)||Se(e,t)||Ve(e,t)||xe()}function Ie(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Le(e){var t=Ie(e,"string");return typeof t=="symbol"?t:t+""}function Ve(e,t){if(e){if(typeof e=="string")return ue(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ue(e,t):void 0}}function Ae(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function le(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function fe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?le(Object(r),!0).forEach(function(n){Ae(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):le(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $e(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function K(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var u=arguments.length,l=new Array(u),c=0;c<u;c++)l[c]=arguments[c];return t.apply(r,[].concat(o,l))}}}function Q(e){return{}.toString.call(e).includes("Object")}function De(e){return!Object.keys(e).length}function q(e){return typeof e=="function"}function Ne(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ze(e,t){return Q(t)||T("changeType"),Object.keys(t).some(function(r){return!Ne(e,r)})&&T("changeField"),t}function Ke(e){q(e)||T("selectorType")}function ke(e){q(e)||Q(e)||T("handlerType"),Q(e)&&Object.values(e).some(function(t){return!q(t)})&&T("handlersType")}function qe(e){e||T("initialIsRequired"),Q(e)||T("initialType"),De(e)&&T("initialContent")}function We(e,t){throw new Error(e[t]||e.default)}var Fe={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},T=K(We)(Fe),J={changes:ze,selector:Ke,handler:ke,initial:qe};function Ue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};J.initial(e),J.handler(t);var r={current:e},n=K(He)(r,t),o=K(Be)(r),i=K(J.changes)(e),u=K(Je)(r);function l(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(O){return O};return J.selector(g),g(r.current)}function c(g){$e(n,o,i,u)(g)}return[l,c]}function Je(e,t){return q(t)?t(e.current):t}function Be(e,t){return e.current=fe(fe({},e.current),t),t}function He(e,t,r){return q(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var Qe={create:Ue},Ge={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Ye(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var u=arguments.length,l=new Array(u),c=0;c<u;c++)l[c]=arguments[c];return t.apply(r,[].concat(o,l))}}}function Xe(e){return{}.toString.call(e).includes("Object")}function Ze(e){return e||de("configIsRequired"),Xe(e)||de("configType"),e.urls?(et(),{paths:{vs:e.urls.monacoBase}}):e}function et(){console.warn(he.deprecation)}function tt(e,t){throw new Error(e[t]||e.default)}var he={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
3
  You are using deprecated way of configuration.
4
4