@lobu/runtime-server 24.6.0 → 24.7.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 (226) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/owletto/dist/assets/_-CZgmjLR9.js +2 -0
  3. package/dist/owletto/dist/assets/_-Cm5OgtYD.js +3 -0
  4. package/dist/owletto/dist/assets/_agentId-Cci6NFc1.js +2 -0
  5. package/dist/owletto/dist/assets/_agentId-GhWTlPO2.js +2 -0
  6. package/dist/owletto/dist/assets/_automationId-KUlxSTK2.js +2 -0
  7. package/dist/owletto/dist/assets/_connectorKey._connectionId-Zpy7Hvml.js +2 -0
  8. package/dist/owletto/dist/assets/_connectorKey.index-CYDRp9UX.js +2 -0
  9. package/dist/owletto/dist/assets/_conversationId-NNqDdije.js +2 -0
  10. package/dist/owletto/dist/assets/_eventId-0BSX6VHj.js +2 -0
  11. package/dist/owletto/dist/assets/_owner-C-CD22NB.js +3 -0
  12. package/dist/owletto/dist/assets/_shape-CvXp4omb.js +2 -0
  13. package/dist/owletto/dist/assets/_slug-DgK7zpKA.js +2 -0
  14. package/dist/owletto/dist/assets/_viewKey-cH54P0zY.js +2 -0
  15. package/dist/owletto/dist/assets/_viewKey-m0B5j7L9.js +2 -0
  16. package/dist/owletto/dist/assets/{accept-invitation-CQZQ0wwC.js → accept-invitation-CX7Egv-p.js} +2 -2
  17. package/dist/owletto/dist/assets/activity-link-rXNpmppV.js +2 -0
  18. package/dist/owletto/dist/assets/activity-route-view-B0m7_g9q.js +2 -0
  19. package/dist/owletto/dist/assets/{agent-client-setup-list-CpUTAjXf.js → agent-client-setup-list-BmD3-_Ox.js} +2 -2
  20. package/dist/owletto/dist/assets/{agent-connect-pages-Br_ycC0z.js → agent-connect-pages-BtOTCsTU.js} +2 -2
  21. package/dist/owletto/dist/assets/agent-editor-form-CirqCpcM.js +2 -0
  22. package/dist/owletto/dist/assets/agent-list-row-SyACVYX7.js +2 -0
  23. package/dist/owletto/dist/assets/{agent-loading-shells-_18OREnx.js → agent-loading-shells-DHvKiEUB.js} +2 -2
  24. package/dist/owletto/dist/assets/agent-permissions-matrix-Dsc26dyW.js +2 -0
  25. package/dist/owletto/dist/assets/{agent-skill-context-1DBn7Xc_.js → agent-skill-context-DF5q0Dfr.js} +2 -2
  26. package/dist/owletto/dist/assets/agent-subpage-shell-Pi5cECga.js +2 -0
  27. package/dist/owletto/dist/assets/{agent-thread-FyEO-y44.js → agent-thread-B1ZepGZc.js} +4 -4
  28. package/dist/owletto/dist/assets/agents-D1FHZ0jR.js +2 -0
  29. package/dist/owletto/dist/assets/app._appId-01I0CJal.js +2 -0
  30. package/dist/owletto/dist/assets/{assist-composer-Mn9EfX4X.js → assist-composer-BD9msDk3.js} +2 -2
  31. package/dist/owletto/dist/assets/automation-detail-content-BFv1TglZ.js +2 -0
  32. package/dist/owletto/dist/assets/automation-row-CmTpAD4r.js +2 -0
  33. package/dist/owletto/dist/assets/{automation-source-list-Dhucq1sI.js → automation-source-list-D8ZSavQU.js} +2 -2
  34. package/dist/owletto/dist/assets/automations-D1FHZ0jR.js +2 -0
  35. package/dist/owletto/dist/assets/{callback-9xSHyA12.js → callback-Ckrxv0eo.js} +2 -2
  36. package/dist/owletto/dist/assets/{card-g4yxo4Hr.js → card-DT9mSjSp.js} +2 -2
  37. package/dist/owletto/dist/assets/{change-summary-DeuXQEpb.js → change-summary-CGrKEJ04.js} +2 -2
  38. package/dist/owletto/dist/assets/{claim-B98IhDra.js → claim-Bzby28tT.js} +2 -2
  39. package/dist/owletto/dist/assets/{client-activity-scopes-BD2HBo-_.js → client-activity-scopes-DoIErdUy.js} +2 -2
  40. package/dist/owletto/dist/assets/{client-rows-x_CxeWkP.js → client-rows-BbVQy5Ti.js} +2 -2
  41. package/dist/owletto/dist/assets/{clients-Cmp0LmOp.js → clients-6aJvabvS.js} +2 -2
  42. package/dist/owletto/dist/assets/connect-BmDziBzI.js +2 -0
  43. package/dist/owletto/dist/assets/{connect-menu-CezOH3s7.js → connect-menu-Bs8mxsga.js} +2 -2
  44. package/dist/owletto/dist/assets/connect._clientId-t5aKu3aa.js +2 -0
  45. package/dist/owletto/dist/assets/connected._clientId-DswMAw8l.js +2 -0
  46. package/dist/owletto/dist/assets/{connection-B6fM2KHN.js → connection-BOaMa324.js} +2 -2
  47. package/dist/owletto/dist/assets/connection-feed-detail-BLCjhP-H.js +2 -0
  48. package/dist/owletto/dist/assets/connector-boxes-BAP_f77M.js +2 -0
  49. package/dist/owletto/dist/assets/{connector-page-shell-Di6XzkVo.js → connector-page-shell-ClOmVPJr.js} +2 -2
  50. package/dist/owletto/dist/assets/{connector-provenance-BrnasBW4.js → connector-provenance-wmYu5jwO.js} +2 -2
  51. package/dist/owletto/dist/assets/{connectors-DnOUxX_U.js → connectors-D5F5rHxX.js} +2 -2
  52. package/dist/owletto/dist/assets/{consent-Byli4yMs.js → consent-RqHNkmm8.js} +2 -2
  53. package/dist/owletto/dist/assets/{copy-button-Ddf7lBjZ.js → copy-button-D6zpsZLi.js} +2 -2
  54. package/dist/owletto/dist/assets/{core.esm-BsXtvNoI.js → core.esm-BIE97rfo.js} +3 -3
  55. package/dist/owletto/dist/assets/create-BPxsKwk7.js +2 -0
  56. package/dist/owletto/dist/assets/{create-YdAnh3ml.js → create-GT8_yF0R.js} +2 -2
  57. package/dist/owletto/dist/assets/create-Yx2qBMBy.js +2 -0
  58. package/dist/owletto/dist/assets/create-automation-form-B12yTrmj.js +3 -0
  59. package/dist/owletto/dist/assets/create._connectorKey-CzXqSkuI.js +2 -0
  60. package/dist/owletto/dist/assets/custom-guardrail-edits-B9plaLBN.js +2 -0
  61. package/dist/owletto/dist/assets/{definition-comparison-B5WgZILB.js → definition-comparison-C3k6Wa9B.js} +2 -2
  62. package/dist/owletto/dist/assets/detail-page-skeleton-I5_7FkKx.js +2 -0
  63. package/dist/owletto/dist/assets/{device-DdCoCj-Q.js → device-CadaiNF4.js} +2 -2
  64. package/dist/owletto/dist/assets/device-automation-Dp3faMvp.js +2 -0
  65. package/dist/owletto/dist/assets/device-pin-tombstone-U7Bx05P6.js +2 -0
  66. package/dist/owletto/dist/assets/device._deviceId-DTZqj1HS.js +2 -0
  67. package/dist/owletto/dist/assets/dynamic-schema-form-DyT_9iVE.js +2 -0
  68. package/dist/owletto/dist/assets/entity-options-CGTjLlcS.js +2 -0
  69. package/dist/owletto/dist/assets/entity-page-DHHMmA8V.js +2 -0
  70. package/dist/owletto/dist/assets/entity-pages-eYbG2FDT.js +2 -0
  71. package/dist/owletto/dist/assets/{entity-type-page-D0ghgRgq.js → entity-type-page-CjFqxSdL.js} +2 -2
  72. package/dist/owletto/dist/assets/event-card-BtTUuf2q.js +2 -0
  73. package/dist/owletto/dist/assets/event-detail-8xHiplt_.js +2 -0
  74. package/dist/owletto/dist/assets/events-feed-zFnTSE27.js +2 -0
  75. package/dist/owletto/dist/assets/filter-editors-Dd5R2Etd.js +2 -0
  76. package/dist/owletto/dist/assets/{full-page-spinner-B5xXnKtV.js → full-page-spinner-CCU4PkRv.js} +2 -2
  77. package/dist/owletto/dist/assets/home-stream-IVsNEkwp.js +2 -0
  78. package/dist/owletto/dist/assets/index-2oaMOFKe.js +2 -0
  79. package/dist/owletto/dist/assets/index-B-Ab8srM.js +7899 -0
  80. package/dist/owletto/dist/assets/index-B4RZgvvI.js +2 -0
  81. package/dist/owletto/dist/assets/{index-BDl1_w6U.js → index-B72KYdN1.js} +2 -2
  82. package/dist/owletto/dist/assets/index-BBZM53p8.js +2 -0
  83. package/dist/owletto/dist/assets/index-BOb0a5f9.js +2 -0
  84. package/dist/owletto/dist/assets/{index-BdNR51Ua.js → index-BYFDMIQC.js} +2 -2
  85. package/dist/owletto/dist/assets/index-BwnFQcMe.js +2 -0
  86. package/dist/owletto/dist/assets/index-CvYsWYlF.js +2 -0
  87. package/dist/owletto/dist/assets/{index-CkiyxW4w.js → index-DIXIvtnM.js} +2 -2
  88. package/dist/owletto/dist/assets/index-DLwokXHW.js +2 -0
  89. package/dist/owletto/dist/assets/index-_nlPHus1.js +2 -0
  90. package/dist/owletto/dist/assets/index-cwOgj4-i.js +2 -0
  91. package/dist/owletto/dist/assets/{index-TkPy_P_u.js → index-pmr1WUoG.js} +2 -2
  92. package/dist/owletto/dist/assets/index-pp4qmhkA.js +2 -0
  93. package/dist/owletto/dist/assets/index-tTbno-PX.css +1 -0
  94. package/dist/owletto/dist/assets/{json-diff-DtZtra_g.js → json-diff-B-1Swv_y.js} +2 -2
  95. package/dist/owletto/dist/assets/list-skeleton-BAqT0vxo.js +2 -0
  96. package/dist/owletto/dist/assets/{login-TWR0vF4_.js → login-D5bIjMtf.js} +2 -2
  97. package/dist/owletto/dist/assets/{logout-BA5kojS0.js → logout-JYZvxz8v.js} +2 -2
  98. package/dist/owletto/dist/assets/{member-scope-gate-BQiRAqtx.js → member-scope-gate-Lj9m4RL2.js} +2 -2
  99. package/dist/owletto/dist/assets/memory-browse-page-rAKfVdQ_.js +74 -0
  100. package/dist/owletto/dist/assets/{model-selector-B2cjCn0V.js → model-selector-onvGA9Ww.js} +2 -2
  101. package/dist/owletto/dist/assets/{new-Dc5Bbotb.js → new-B-Jd-vBl.js} +2 -2
  102. package/dist/owletto/dist/assets/new-BmehH1uR.js +2 -0
  103. package/dist/owletto/dist/assets/new-KDi15LWZ.js +2 -0
  104. package/dist/owletto/dist/assets/{organization-B9U1L-56.js → organization-B9bh20Xo.js} +2 -2
  105. package/dist/owletto/dist/assets/peek-pane-content-Bqus80Mq.js +2 -0
  106. package/dist/owletto/dist/assets/{pending-seed-BP3xHM2d.js → pending-seed-CoFPQ835.js} +2 -2
  107. package/dist/owletto/dist/assets/{proposal-review-shell-BED-DO9C.js → proposal-review-shell-CnACXCUg.js} +2 -2
  108. package/dist/owletto/dist/assets/public-shell-ready-Dlh-eWz0.js +2 -0
  109. package/dist/owletto/dist/assets/record-activity-6CfR95Ul.js +2 -0
  110. package/dist/owletto/dist/assets/{record-session-DOFgdd43.js → record-session-Bpx4_LGk.js} +2 -2
  111. package/dist/owletto/dist/assets/{renderer-CHPS-1vD.js → renderer-CgaQKMoG.js} +26 -26
  112. package/dist/owletto/dist/assets/{reset-password-BmNM-apc.js → reset-password-C-4Jnuqk.js} +2 -2
  113. package/dist/owletto/dist/assets/run-initiator-BvruBM5H.js +2 -0
  114. package/dist/owletto/dist/assets/{runs-BntGAKQG.js → runs-BMzp7j7j.js} +2 -2
  115. package/dist/owletto/dist/assets/runs-list-DVhrTr3v.js +2 -0
  116. package/dist/owletto/dist/assets/{schema-type-editor-panel-v3nR2Oa2.js → schema-type-editor-panel-Bdeumkux.js} +2 -2
  117. package/dist/owletto/dist/assets/{schema-value-BFb7jCBo.js → schema-value-BUgC0Ro8.js} +2 -2
  118. package/dist/owletto/dist/assets/{settings-DubSpJfg.js → settings-DYYvrrZ4.js} +2 -2
  119. package/dist/owletto/dist/assets/skill-route-key-sF006xiz.js +2 -0
  120. package/dist/owletto/dist/assets/source-record-panels-CBV9tsR3.js +2 -0
  121. package/dist/owletto/dist/assets/status-variants-DT61YfsU.js +2 -0
  122. package/dist/owletto/dist/assets/{table-DALHuXPE.js → table-B6yimlsZ.js} +2 -2
  123. package/dist/owletto/dist/assets/{use-automations-D9hKpufo.js → use-automations-II_YJWtN.js} +2 -2
  124. package/dist/owletto/dist/assets/{use-login-redirect-ciwfc-7A.js → use-login-redirect-BqtEilid.js} +2 -2
  125. package/dist/owletto/dist/assets/{use-mention-search-CJGCatFS.js → use-mention-search-Bxlpd6Dp.js} +3 -3
  126. package/dist/owletto/dist/assets/view-param-filters-DYlqBocg.js +2 -0
  127. package/dist/owletto/dist/assets/{views-access-required-CZ1fvAks.js → views-access-required-BVtMfgLh.js} +2 -2
  128. package/dist/owletto/dist/index.html +2 -2
  129. package/dist/server-main.bundle.mjs +84 -5
  130. package/npm-shrinkwrap.json +5 -5
  131. package/package.json +1 -1
  132. package/vendor/connector-sdk/package.json +1 -1
  133. package/vendor/core/package.json +1 -1
  134. package/vendor/views/package.json +1 -1
  135. package/dist/owletto/dist/assets/_-DT3E3BmS.js +0 -3
  136. package/dist/owletto/dist/assets/_-c1xy7bLu.js +0 -2
  137. package/dist/owletto/dist/assets/_agentId-CTfoi0-7.js +0 -2
  138. package/dist/owletto/dist/assets/_agentId-DV8utajn.js +0 -2
  139. package/dist/owletto/dist/assets/_automationId-DvP3qyYL.js +0 -2
  140. package/dist/owletto/dist/assets/_connectorKey._connectionId-CL5SivCn.js +0 -2
  141. package/dist/owletto/dist/assets/_connectorKey.index-tnMwC67b.js +0 -2
  142. package/dist/owletto/dist/assets/_conversationId-DXN_8m88.js +0 -2
  143. package/dist/owletto/dist/assets/_eventId-SdpFT7jB.js +0 -2
  144. package/dist/owletto/dist/assets/_name-CM1AMywz.js +0 -2
  145. package/dist/owletto/dist/assets/_owner-CaGsXXBW.js +0 -3
  146. package/dist/owletto/dist/assets/_shape-DGAkETDp.js +0 -2
  147. package/dist/owletto/dist/assets/_skillKey-Dd4ZHPY8.js +0 -2
  148. package/dist/owletto/dist/assets/_slug-cRvJQtNo.js +0 -2
  149. package/dist/owletto/dist/assets/_view-B5I7mmkl.js +0 -2
  150. package/dist/owletto/dist/assets/_viewKey-Bwn0dyLo.js +0 -2
  151. package/dist/owletto/dist/assets/_viewKey-YjSYD0wc.js +0 -2
  152. package/dist/owletto/dist/assets/activity-route-view-CZykJXQp.js +0 -2
  153. package/dist/owletto/dist/assets/agent-card-controls-DuQJhtqp.js +0 -2
  154. package/dist/owletto/dist/assets/agent-editor-form-BXQBFHSv.js +0 -2
  155. package/dist/owletto/dist/assets/agent-guardrails-route-CN7vpC0X.js +0 -2
  156. package/dist/owletto/dist/assets/agent-list-row-BnP6r4pm.js +0 -2
  157. package/dist/owletto/dist/assets/agent-permissions-matrix-DSjidWHL.js +0 -2
  158. package/dist/owletto/dist/assets/agent-skills-route-d5jh3oBR.js +0 -2
  159. package/dist/owletto/dist/assets/agent-tab-intro-DKrC3SQt.js +0 -2
  160. package/dist/owletto/dist/assets/agents-kXojozTU.js +0 -2
  161. package/dist/owletto/dist/assets/agents-workbench-CDpJmUVN.js +0 -2
  162. package/dist/owletto/dist/assets/app._appId-DwNeXRJp.js +0 -2
  163. package/dist/owletto/dist/assets/automation-detail-content-Bs3vwAPd.js +0 -2
  164. package/dist/owletto/dist/assets/automation-row-B5Q1B10y.js +0 -2
  165. package/dist/owletto/dist/assets/automations-kXojozTU.js +0 -2
  166. package/dist/owletto/dist/assets/connect-zUot_0kG.js +0 -2
  167. package/dist/owletto/dist/assets/connect._clientId-nsGxe6yO.js +0 -2
  168. package/dist/owletto/dist/assets/connected._clientId-DnclRRXk.js +0 -2
  169. package/dist/owletto/dist/assets/connected._clientId.activity-CDB8atTX.js +0 -2
  170. package/dist/owletto/dist/assets/connected._clientId.index-DBNP2mZo.js +0 -2
  171. package/dist/owletto/dist/assets/connection-feed-detail-Ckq-qEbD.js +0 -2
  172. package/dist/owletto/dist/assets/connection-label-BobuYiAG.js +0 -2
  173. package/dist/owletto/dist/assets/connections-browser-BXsJqieG.js +0 -2
  174. package/dist/owletto/dist/assets/connector-boxes-CbqSFeVm.js +0 -2
  175. package/dist/owletto/dist/assets/connector-scope-lists-dQnZARCD.js +0 -2
  176. package/dist/owletto/dist/assets/create-B34eskZ_.js +0 -2
  177. package/dist/owletto/dist/assets/create-DLB9sXgU.js +0 -2
  178. package/dist/owletto/dist/assets/create-automation-form-C9PMX7N8.js +0 -3
  179. package/dist/owletto/dist/assets/create._connectorKey-Bz4OYRiC.js +0 -2
  180. package/dist/owletto/dist/assets/device-pin-tombstone-B06J7Af1.js +0 -2
  181. package/dist/owletto/dist/assets/device._deviceId-Bh9S4bFp.js +0 -2
  182. package/dist/owletto/dist/assets/dynamic-schema-form-qWSRtOAv.js +0 -2
  183. package/dist/owletto/dist/assets/entity-options-BkU_En_f.js +0 -2
  184. package/dist/owletto/dist/assets/entity-page-BPFDHY8q.js +0 -2
  185. package/dist/owletto/dist/assets/entity-pages-DxgbjLMt.js +0 -2
  186. package/dist/owletto/dist/assets/event-card-CjA_dLzq.js +0 -2
  187. package/dist/owletto/dist/assets/event-detail-CmC-DVrK.js +0 -2
  188. package/dist/owletto/dist/assets/events-feed-CGzA1w3R.js +0 -2
  189. package/dist/owletto/dist/assets/filter-bar-CQ_oE7a9.js +0 -2
  190. package/dist/owletto/dist/assets/guardrails-DkXatmea.js +0 -2
  191. package/dist/owletto/dist/assets/identity-BwJy3ixB.js +0 -2
  192. package/dist/owletto/dist/assets/index-35ehGReZ.js +0 -2
  193. package/dist/owletto/dist/assets/index-B9hYiwBw.js +0 -2
  194. package/dist/owletto/dist/assets/index-BjcZVe7n.js +0 -7899
  195. package/dist/owletto/dist/assets/index-BqAVebvY.js +0 -2
  196. package/dist/owletto/dist/assets/index-BvK1fS1J.js +0 -2
  197. package/dist/owletto/dist/assets/index-CNEpTkgw.css +0 -1
  198. package/dist/owletto/dist/assets/index-CRc73k1t.js +0 -2
  199. package/dist/owletto/dist/assets/index-CYGaSD3y.js +0 -2
  200. package/dist/owletto/dist/assets/index-CfZGe-zn.js +0 -2
  201. package/dist/owletto/dist/assets/index-CzLDNB2E.js +0 -2
  202. package/dist/owletto/dist/assets/index-D-o5iOVd.js +0 -2
  203. package/dist/owletto/dist/assets/index-DjYVV1Ml.js +0 -2
  204. package/dist/owletto/dist/assets/index-VyAX-asP.js +0 -2
  205. package/dist/owletto/dist/assets/list-skeleton-CIHWCi2a.js +0 -2
  206. package/dist/owletto/dist/assets/manage-gear-C-0BAMbC.js +0 -2
  207. package/dist/owletto/dist/assets/memory-browse-page-Ba32-vVL.js +0 -74
  208. package/dist/owletto/dist/assets/model-C2q7WDcS.js +0 -2
  209. package/dist/owletto/dist/assets/models-CZkH5gtj.js +0 -2
  210. package/dist/owletto/dist/assets/nav-pill-Bam6s3jj.js +0 -2
  211. package/dist/owletto/dist/assets/new-BJst6K0b.js +0 -2
  212. package/dist/owletto/dist/assets/new-DgbivfDe.js +0 -2
  213. package/dist/owletto/dist/assets/peek-pane-content-Cq8P38s3.js +0 -2
  214. package/dist/owletto/dist/assets/permissions-BVlbeY4u.js +0 -2
  215. package/dist/owletto/dist/assets/public-shell-ready-Diq15_QW.js +0 -2
  216. package/dist/owletto/dist/assets/record-activity-CTLwq8s1.js +0 -2
  217. package/dist/owletto/dist/assets/run-activity-link-Dh1YyCfk.js +0 -2
  218. package/dist/owletto/dist/assets/run-initiator-CCxNv0rK.js +0 -2
  219. package/dist/owletto/dist/assets/runs-panel-BwTVaRsE.js +0 -2
  220. package/dist/owletto/dist/assets/runs-table-CYS1jDdL.js +0 -2
  221. package/dist/owletto/dist/assets/settings-DBgT60nY.js +0 -2
  222. package/dist/owletto/dist/assets/skills-DDoeRGhJ.js +0 -2
  223. package/dist/owletto/dist/assets/source-record-panels-m8gECt82.js +0 -2
  224. package/dist/owletto/dist/assets/status-dot-BnQPFrcU.js +0 -2
  225. package/dist/owletto/dist/assets/use-scroll-sentinel-BWCrmNIB.js +0 -2
  226. package/dist/owletto/dist/assets/view-param-filters-CDvwie_f.js +0 -2
@@ -1,2 +1,2 @@
1
- import{q as fe,eI as ie,i8 as ge,i9 as oe,ia as ke,aC as ce,ib as je,ic as ve,id as be,ie as ye,r as j,u as re,ig as Ae,j as s,ih as Ce,ii as _e,V as ue,ij as w,ik as Ne,d6 as X,il as Se,B as f,cI as Oe,i as E,im as ne,hq as De,hr as Le,hs as we,ht as Me,hu as Pe,io as Fe,ip as ae,iq as $e,L as Re,ir as Ue,is as ze,it as Ie,c3 as I,iu as Be,iv as Ee,c2 as qe,eQ as Ke,H as W,fg as Te,dh as Ve,I as le,eR as He,c7 as Qe,ab as We,eS as Xe}from"./index-BjcZVe7n.js";function es({connector:t,organizationId:l,ownerSlug:n,connections:r,openNewApp:g=!1,onNewAppHandled:c}){const{session:v}=fe(),{isAdmin:u,isLoading:C}=ie(l),M=ge(t.auth_schema),o=oe(t.auth_schema),_=ke(t.auth_schema),N=ce(l,{connectorKey:t.key,provider:o?.provider}),m=je(l,t.key),S=ve(),P=be(),p=ye(),[O,D]=j.useState(null),[b,y]=j.useState(null),[x,F]=j.useState([]),$=re(),k=j.useCallback(e=>$?.open({href:"",key:`oauth-apps:${t.key}`,title:"OAuth apps",connectorPanel:{section:"oauth-apps",connectorKey:t.key,organizationId:l,ownerSlug:n,newApp:e}}),[$,t.key,l,n]);j.useEffect(()=>{!g||!u||(k(!0),c?.())},[g,u,k,c]);const R=v?.user?.id;if(!R||C||N.isLoading||m.isPending)return null;const a=(N.data??[]).filter(e=>e.profile_kind==="oauth_app"),A=a.filter(e=>e.status==="active"),Y=e=>B(e,t.key),U=A.find(Y),de=new Set(r.map(e=>e.auth_profile_slug)),pe=(N.data??[]).filter(e=>e.profile_kind==="oauth_account"&&e.created_by===R&&!de.has(e.slug)),he=(m.data?.options??[]).filter(e=>e.kind!=="local"&&e.configured&&!!e.url),q=m.data?.options.find(e=>e.kind==="local"),K=m.isError||m.data?.cloud_status==="unavailable",d=[],G=e=>({key:`app:${e.slug}`,kind:"app",slug:e.slug,button:"Connect account",label:e.display_name,hint:"Your OAuth app",badge:Y(e)?"Default":void 0,canLead:!!U||A.length===1}),T=u?A:U?[U]:[],V=U??(T.length===1?T[0]:void 0);V&&d.push(G(V));for(const e of he)d.push({key:`offer:${e.kind}:${e.managed_by_org??e.url}`,kind:"link",href:e.url,external:!0,note:e.instructions,button:e.label,label:e.label,hint:e.execution==="cloud"?"Runs in Lobu Cloud":"The cloud holds the grant; data syncs here",canLead:!0});_&&q?.configured&&q.url&&d.push({key:"install",kind:"link",href:Ae(q.url,{installShape:_.installShape}),external:!1,button:`Install ${t.name} app`,label:`Install ${t.name} app`,hint:"Installs on your provider account",canLead:!0});for(const e of T)e!==V&&d.push(G(e));for(const e of pe){const i=e.status==="active";d.push({key:`account:${e.slug}`,kind:"account",profile:e,button:i?"Use this account":"Reconnect",label:`${i?"Use":"Reconnect"} ${e.display_name}`,canLead:!1})}(!o||M.some(e=>e.type!=="oauth"))&&d.push({key:"create",kind:"create",button:"Add connection",label:_?"Use your own app":"Add connection",canLead:!0});const me=u&&o?{key:"new-app",kind:"new-app",button:"New OAuth app",label:"New OAuth app…",canLead:!0}:void 0,h=d.find(e=>e.canLead)??(d.length?void 0:me),J=e=>p.begin(()=>S.mutateAsync({connector_key:t.key,app_auth_profile_slug:e,requested_scopes:o?Ue(o,x):[]})),H=e=>{if(D(null),e.kind==="app")o&&ae(o).length?y(e.slug):J(e.slug);else if(e.kind==="account"){const{profile:i}=e;p.begin(()=>i.status==="active"?S.mutateAsync({connector_key:t.key,auth_profile_slug:i.slug}):P.mutateAsync({auth_profile_slug:i.slug}))}else e.kind==="new-app"?k(!0):e.kind==="link"&&D(e.note??null)},Z=(e,i)=>e.kind==="link"?s.jsx("a",{href:e.href,...e.external?{target:"_blank",rel:"noopener noreferrer"}:{},onClick:()=>H(e),children:i}):e.kind==="create"?s.jsx(Re,{to:"/$owner/connectors/create/$connectorKey",params:{owner:n,connectorKey:t.key},children:i}):null,z=d.length===1&&d[0]===h?[]:d,ee=!!(u&&o),Q=z.length>0||K||ee&&(d.length>0||a.length>0),se=s.jsxs(Ce,{align:"end",className:"w-72",children:[z.length?s.jsx(_e,{children:"Connect with"}):null,z.map(e=>{const i=s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate",children:e.label}),e.hint?s.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:e.hint}):null]}),e.badge?s.jsx(ue,{variant:"secondary",className:"text-[10px]",children:e.badge}):null]}),L=Z(e,i);return L?s.jsx(w,{asChild:!0,children:L},e.key):s.jsx(w,{onSelect:()=>H(e),children:i},e.key)}),K?s.jsx(w,{onSelect:e=>{e.preventDefault(),m.refetch()},children:s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block",children:"Retry cloud options"}),s.jsx("span",{className:"block text-xs text-muted-foreground",children:"Cloud connection options could not be checked"})]})}):null,ee?s.jsxs(s.Fragment,{children:[z.length||K?s.jsx(Ne,{}):null,s.jsxs(w,{onSelect:()=>k(!0),children:[s.jsx(X,{}),"New OAuth app…"]}),a.length?s.jsx(w,{onSelect:()=>k(!1),children:"Manage OAuth apps…"}):null]}):null]}),te=s.jsx(Se,{asChild:!0,children:s.jsxs(f,{size:"sm",variant:h?"default":"outline",className:E(h&&"rounded-l-none border-l border-primary-foreground/25 px-2"),"aria-label":h?"More ways to connect":void 0,children:[h?null:"Connect",s.jsx(Oe,{className:"size-3.5"})]})});return s.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1.5",children:[h?s.jsxs(ne,{children:[s.jsxs("div",{className:"inline-flex",children:[(()=>{const e=s.jsxs(s.Fragment,{children:[h.kind==="new-app"||h.kind==="create"?s.jsx(X,{className:"size-3.5"}):null,h.button]}),i=Z(h,e);return s.jsx(f,{size:"sm",disabled:p.pending,className:E(Q&&"rounded-r-none"),asChild:!!i,onClick:i?void 0:()=>H(h),children:i??e})})(),Q?te:null]}),se]}):Q?s.jsxs(ne,{children:[te,se]}):s.jsxs(s.Fragment,{children:[s.jsx(f,{size:"sm",disabled:!0,children:"Connect account"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask an administrator to set the workspace-default OAuth app."})]}),O?s.jsx("p",{className:"max-w-sm text-xs text-muted-foreground",children:O}):null,p.error?s.jsx("p",{role:"alert",className:"max-w-sm text-xs text-destructive",children:p.error}):null,p.continueUrl?s.jsx("a",{href:p.continueUrl,target:"_blank",rel:"noreferrer",className:"text-xs underline",children:"Continue authorization in your browser"}):null,o?s.jsx(De,{open:b!==null,onOpenChange:e=>!e&&y(null),children:s.jsxs(Le,{className:"max-w-md",children:[s.jsxs(we,{children:[s.jsx(Me,{children:"Permissions"}),s.jsxs(Pe,{children:["Choose what ",t.name," may access."]})]}),s.jsx(Fe,{requiredScopes:$e(o),optionalScopes:ae(o),selectedOptionalScopes:x,onToggleOptionalScope:(e,i)=>F(L=>i?[...new Set([...L,e])]:L.filter(xe=>xe!==e))}),s.jsx("div",{className:"flex justify-end",children:s.jsx(f,{size:"sm",disabled:p.pending,onClick:()=>{const e=b;y(null),e&&J(e)},children:"Continue"})})]})}):null]})}function ss({connector:t,organizationId:l,newApp:n}){const r=re(),{isAdmin:g}=ie(l),c=oe(t.auth_schema),v=ce(l,{connectorKey:t.key,provider:c?.provider});return c?s.jsx(Ye,{connector:t,oauthMethod:c,appProfiles:(v.data??[]).filter(u=>u.profile_kind==="oauth_app"),isAdmin:g,initialOpen:n,onClose:n?()=>r?.close():void 0,refetchProfiles:()=>void v.refetch()}):null}function Ye({initialOpen:t=!1,onClose:l,connector:n,oauthMethod:r,appProfiles:g,isAdmin:c,refetchProfiles:v}){const u=ze(),C=Ie(),[M,o]=I(n.key,t&&c),[_,N]=j.useState(!1);j.useEffect(()=>{t&&c&&o(!0)},[t,c,o]);const m=`${Be()}/connect/oauth/callback`,[S,P]=I(n.key,`${n.name} OAuth App`),[p,O]=I(n.key,""),[D,b]=I(n.key,null),y=Ee(r),x=qe(`${n.key}:${M}`,Ke(y),y),{values:F,setValues:$}=x,k=g.find(a=>B(a,n.key)),R=()=>{x.canSubmit&&(b(null),u.mutate({connector_key:n.key,profile_kind:"oauth_app",display_name:S.trim()||`${n.name} OAuth App`,slug:p.trim()||void 0,credentials:Je(Xe(F))},{onSuccess:a=>{const A=a.auth_profile?.slug;A&&!k&&C.mutate({connector_key:n.key,auth_profile_slug:A}),o(!1),l?.(),P(`${n.name} OAuth App`),O(""),v()},onError:a=>{b(a instanceof Error?a.message:"Failed to add OAuth app")}}))};return s.jsxs("div",{className:"min-w-0 space-y-4",children:[c&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(W,{children:"OAuth callback URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 break-all text-xs",children:m}),s.jsxs(f,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(m).then(()=>N(!0)).catch(()=>b("Could not copy the callback URL. Select and copy it above."))},children:[s.jsx(Te,{className:"mr-1.5 h-3.5 w-3.5"}),_?"Copied":"Copy callback URL"]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Register this exact URL in your provider’s app settings before saving the client configuration."})]}),g.length>0?s.jsx("div",{className:"space-y-2",children:g.map(a=>s.jsxs("div",{className:E(Ve,"flex flex-wrap items-center gap-3 p-3"),children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:a.display_name}),B(a,n.key)?s.jsx(ue,{variant:"secondary",className:"text-[10px]",children:"Default"}):null,s.jsx(Ge,{status:a.status})]}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),c&&!B(a,n.key)&&a.connector_key===n.key&&a.status==="active"?s.jsx(f,{variant:"outline",size:"sm",disabled:C.isPending,onClick:()=>C.mutate({connector_key:n.key,auth_profile_slug:a.slug}),children:"Set default"}):null]},a.slug))}):null,c?M?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(W,{htmlFor:"oauth-app-name",children:"Display name"}),s.jsx(le,{id:"oauth-app-name",value:S,onChange:a=>P(a.target.value)})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(W,{htmlFor:"oauth-app-slug",children:"Slug"}),s.jsx(le,{id:"oauth-app-slug",placeholder:"optional",value:p,onChange:a=>O(a.target.value)})]}),s.jsx(He,{schema:x.revision??void 0,values:F,onValuesChange:$,fieldIdPrefix:"oauth-app-"}),s.jsx(Qe,{visible:x.hasConflict,onReload:x.reset}),D?s.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:D}):null,s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(f,{variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>{o(!1),l?.()},children:"Cancel"}),s.jsxs(f,{size:"sm",disabled:u.isPending||!x.canSubmit,onClick:R,children:[u.isPending?s.jsx(We,{size:"md",className:"mr-1.5"}):null,"Save OAuth app"]})]})]}):s.jsxs(f,{variant:"outline",size:"sm",onClick:()=>o(!0),children:[s.jsx(X,{className:"size-3.5"}),"Add OAuth app"]}):null]})}function B(t,l){return!!t.is_default_for_connector&&t.connector_key===l}function Ge({status:t}){const l=t==="active"?"text-green-500":t==="error"||t==="revoked"?"text-destructive":"text-amber-500";return s.jsxs("span",{className:E("text-xs",l),children:["· ",t]})}function Je(t){const l={};for(const[n,r]of Object.entries(t))typeof r=="string"&&r.trim()?l[n]=r.trim():(typeof r=="number"||typeof r=="boolean")&&(l[n]=String(r));return l}export{Ge as A,es as C,ss as O};
2
- //# sourceMappingURL=connect-menu-CezOH3s7.js.map
1
+ import{q as fe,ed as ie,h$ as ge,i0 as oe,i1 as ke,aC as ce,i5 as je,i6 as be,i7 as ve,i8 as ye,r as j,u as re,i9 as Ae,j as s,ia as Ce,ib as _e,V as ue,ic as w,id as Ne,dc as X,ie as Se,B as f,e1 as Oe,i as I,ig as ne,hh as De,hi as Le,hj as we,hk as Fe,hl as Me,ih as Pe,ii as ae,ij as $e,L as Re,ik as Ue,il as ze,im as Be,c9 as B,io as Ee,ip as Ie,c8 as qe,eF as Ke,H as W,f5 as Te,dm as Ve,I as le,eG as He,cd as Ge,ab as We,eH as Xe}from"./index-B-Ab8srM.js";function es({connector:t,organizationId:l,ownerSlug:n,connections:r,openNewApp:g=!1,onNewAppHandled:c}){const{session:b}=fe(),{isAdmin:u,isLoading:C}=ie(l),F=ge(t.auth_schema),o=oe(t.auth_schema),_=ke(t.auth_schema),N=ce(l,{connectorKey:t.key,provider:o?.provider}),m=je(l,t.key),S=be(),M=ve(),h=ye(),[O,D]=j.useState(null),[v,y]=j.useState(null),[x,P]=j.useState([]),$=re(),k=j.useCallback(e=>$?.open({href:"",key:`oauth-apps:${t.key}`,title:"OAuth apps",connectorPanel:{section:"oauth-apps",connectorKey:t.key,organizationId:l,ownerSlug:n,newApp:e}}),[$,t.key,l,n]);j.useEffect(()=>{!g||!u||(k(!0),c?.())},[g,u,k,c]);const R=b?.user?.id;if(!R||C||N.isLoading||m.isPending)return null;const a=(N.data??[]).filter(e=>e.profile_kind==="oauth_app"),A=a.filter(e=>e.status==="active"),Y=e=>E(e,t.key),U=A.find(Y),de=new Set(r.map(e=>e.auth_profile_slug)),he=(N.data??[]).filter(e=>e.profile_kind==="oauth_account"&&e.created_by===R&&!de.has(e.slug)),pe=(m.data?.options??[]).filter(e=>e.kind!=="local"&&e.configured&&!!e.url),q=m.data?.options.find(e=>e.kind==="local"),K=m.isError||m.data?.cloud_status==="unavailable",d=[],J=e=>({key:`app:${e.slug}`,kind:"app",slug:e.slug,button:"Connect account",label:e.display_name,hint:"Your OAuth app",badge:Y(e)?"Default":void 0,canLead:!!U||A.length===1}),T=u?A:U?[U]:[],V=U??(T.length===1?T[0]:void 0);V&&d.push(J(V));for(const e of pe)d.push({key:`offer:${e.kind}:${e.managed_by_org??e.url}`,kind:"link",href:e.url,external:!0,note:e.instructions,button:e.label,label:e.label,hint:e.execution==="cloud"?"Runs in Lobu Cloud":"The cloud holds the grant; data syncs here",canLead:!0});_&&q?.configured&&q.url&&d.push({key:"install",kind:"link",href:Ae(q.url,{installShape:_.installShape}),external:!1,button:`Install ${t.name} app`,label:`Install ${t.name} app`,hint:"Installs on your provider account",canLead:!0});for(const e of T)e!==V&&d.push(J(e));for(const e of he){const i=e.status==="active";d.push({key:`account:${e.slug}`,kind:"account",profile:e,button:i?"Use this account":"Reconnect",label:`${i?"Use":"Reconnect"} ${e.display_name}`,canLead:!1})}(!o||F.some(e=>e.type!=="oauth"))&&d.push({key:"create",kind:"create",button:"Add connection",label:_?"Use your own app":"Add connection",canLead:!0});const me=u&&o?{key:"new-app",kind:"new-app",button:"New OAuth app",label:"New OAuth app…",canLead:!0}:void 0,p=d.find(e=>e.canLead)??(d.length?void 0:me),Q=e=>h.begin(()=>S.mutateAsync({connector_key:t.key,app_auth_profile_slug:e,requested_scopes:o?Ue(o,x):[]})),H=e=>{if(D(null),e.kind==="app")o&&ae(o).length?y(e.slug):Q(e.slug);else if(e.kind==="account"){const{profile:i}=e;h.begin(()=>i.status==="active"?S.mutateAsync({connector_key:t.key,auth_profile_slug:i.slug}):M.mutateAsync({auth_profile_slug:i.slug}))}else e.kind==="new-app"?k(!0):e.kind==="link"&&D(e.note??null)},Z=(e,i)=>e.kind==="link"?s.jsx("a",{href:e.href,...e.external?{target:"_blank",rel:"noopener noreferrer"}:{},onClick:()=>H(e),children:i}):e.kind==="create"?s.jsx(Re,{to:"/$owner/connectors/create/$connectorKey",params:{owner:n,connectorKey:t.key},children:i}):null,z=d.length===1&&d[0]===p?[]:d,ee=!!(u&&o),G=z.length>0||K||ee&&(d.length>0||a.length>0),se=s.jsxs(Ce,{align:"end",className:"w-72",children:[z.length?s.jsx(_e,{children:"Connect with"}):null,z.map(e=>{const i=s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate",children:e.label}),e.hint?s.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:e.hint}):null]}),e.badge?s.jsx(ue,{variant:"secondary",className:"text-[10px]",children:e.badge}):null]}),L=Z(e,i);return L?s.jsx(w,{asChild:!0,children:L},e.key):s.jsx(w,{onSelect:()=>H(e),children:i},e.key)}),K?s.jsx(w,{onSelect:e=>{e.preventDefault(),m.refetch()},children:s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block",children:"Retry cloud options"}),s.jsx("span",{className:"block text-xs text-muted-foreground",children:"Cloud connection options could not be checked"})]})}):null,ee?s.jsxs(s.Fragment,{children:[z.length||K?s.jsx(Ne,{}):null,s.jsxs(w,{onSelect:()=>k(!0),children:[s.jsx(X,{}),"New OAuth app…"]}),a.length?s.jsx(w,{onSelect:()=>k(!1),children:"Manage OAuth apps…"}):null]}):null]}),te=s.jsx(Se,{asChild:!0,children:s.jsxs(f,{size:"sm",variant:p?"default":"outline",className:I(p&&"rounded-l-none border-l border-primary-foreground/25 px-2"),"aria-label":p?"More ways to connect":void 0,children:[p?null:"Connect",s.jsx(Oe,{className:"size-3.5"})]})});return s.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1.5",children:[p?s.jsxs(ne,{children:[s.jsxs("div",{className:"inline-flex",children:[(()=>{const e=s.jsxs(s.Fragment,{children:[p.kind==="new-app"||p.kind==="create"?s.jsx(X,{className:"size-3.5"}):null,p.button]}),i=Z(p,e);return s.jsx(f,{size:"sm",disabled:h.pending,className:I(G&&"rounded-r-none"),asChild:!!i,onClick:i?void 0:()=>H(p),children:i??e})})(),G?te:null]}),se]}):G?s.jsxs(ne,{children:[te,se]}):s.jsxs(s.Fragment,{children:[s.jsx(f,{size:"sm",disabled:!0,children:"Connect account"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask an administrator to set the workspace-default OAuth app."})]}),O?s.jsx("p",{className:"max-w-sm text-xs text-muted-foreground",children:O}):null,h.error?s.jsx("p",{role:"alert",className:"max-w-sm text-xs text-destructive",children:h.error}):null,h.continueUrl?s.jsx("a",{href:h.continueUrl,target:"_blank",rel:"noreferrer",className:"text-xs underline",children:"Continue authorization in your browser"}):null,o?s.jsx(De,{open:v!==null,onOpenChange:e=>!e&&y(null),children:s.jsxs(Le,{className:"max-w-md",children:[s.jsxs(we,{children:[s.jsx(Fe,{children:"Permissions"}),s.jsxs(Me,{children:["Choose what ",t.name," may access."]})]}),s.jsx(Pe,{requiredScopes:$e(o),optionalScopes:ae(o),selectedOptionalScopes:x,onToggleOptionalScope:(e,i)=>P(L=>i?[...new Set([...L,e])]:L.filter(xe=>xe!==e))}),s.jsx("div",{className:"flex justify-end",children:s.jsx(f,{size:"sm",disabled:h.pending,onClick:()=>{const e=v;y(null),e&&Q(e)},children:"Continue"})})]})}):null]})}function ss({connector:t,organizationId:l,newApp:n}){const r=re(),{isAdmin:g}=ie(l),c=oe(t.auth_schema),b=ce(l,{connectorKey:t.key,provider:c?.provider});return c?s.jsx(Ye,{connector:t,oauthMethod:c,appProfiles:(b.data??[]).filter(u=>u.profile_kind==="oauth_app"),isAdmin:g,initialOpen:n,onClose:n?()=>r?.close():void 0,refetchProfiles:()=>void b.refetch()}):null}function Ye({initialOpen:t=!1,onClose:l,connector:n,oauthMethod:r,appProfiles:g,isAdmin:c,refetchProfiles:b}){const u=ze(),C=Be(),[F,o]=B(n.key,t&&c),[_,N]=j.useState(!1);j.useEffect(()=>{t&&c&&o(!0)},[t,c,o]);const m=`${Ee()}/connect/oauth/callback`,[S,M]=B(n.key,`${n.name} OAuth App`),[h,O]=B(n.key,""),[D,v]=B(n.key,null),y=Ie(r),x=qe(`${n.key}:${F}`,Ke(y),y),{values:P,setValues:$}=x,k=g.find(a=>E(a,n.key)),R=()=>{x.canSubmit&&(v(null),u.mutate({connector_key:n.key,profile_kind:"oauth_app",display_name:S.trim()||`${n.name} OAuth App`,slug:h.trim()||void 0,credentials:Qe(Xe(P))},{onSuccess:a=>{const A=a.auth_profile?.slug;A&&!k&&C.mutate({connector_key:n.key,auth_profile_slug:A}),o(!1),l?.(),M(`${n.name} OAuth App`),O(""),b()},onError:a=>{v(a instanceof Error?a.message:"Failed to add OAuth app")}}))};return s.jsxs("div",{className:"min-w-0 space-y-4",children:[c&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(W,{children:"OAuth callback URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 break-all text-xs",children:m}),s.jsxs(f,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(m).then(()=>N(!0)).catch(()=>v("Could not copy the callback URL. Select and copy it above."))},children:[s.jsx(Te,{className:"mr-1.5 h-3.5 w-3.5"}),_?"Copied":"Copy callback URL"]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Register this exact URL in your provider’s app settings before saving the client configuration."})]}),g.length>0?s.jsx("div",{className:"space-y-2",children:g.map(a=>s.jsxs("div",{className:I(Ve,"flex flex-wrap items-center gap-3 p-3"),children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:a.display_name}),E(a,n.key)?s.jsx(ue,{variant:"secondary",className:"text-[10px]",children:"Default"}):null,s.jsx(Je,{status:a.status})]}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),c&&!E(a,n.key)&&a.connector_key===n.key&&a.status==="active"?s.jsx(f,{variant:"outline",size:"sm",disabled:C.isPending,onClick:()=>C.mutate({connector_key:n.key,auth_profile_slug:a.slug}),children:"Set default"}):null]},a.slug))}):null,c?F?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(W,{htmlFor:"oauth-app-name",children:"Display name"}),s.jsx(le,{id:"oauth-app-name",value:S,onChange:a=>M(a.target.value)})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(W,{htmlFor:"oauth-app-slug",children:"Slug"}),s.jsx(le,{id:"oauth-app-slug",placeholder:"optional",value:h,onChange:a=>O(a.target.value)})]}),s.jsx(He,{schema:x.revision??void 0,values:P,onValuesChange:$,fieldIdPrefix:"oauth-app-"}),s.jsx(Ge,{visible:x.hasConflict,onReload:x.reset}),D?s.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:D}):null,s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(f,{variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>{o(!1),l?.()},children:"Cancel"}),s.jsxs(f,{size:"sm",disabled:u.isPending||!x.canSubmit,onClick:R,children:[u.isPending?s.jsx(We,{size:"md",className:"mr-1.5"}):null,"Save OAuth app"]})]})]}):s.jsxs(f,{variant:"outline",size:"sm",onClick:()=>o(!0),children:[s.jsx(X,{className:"size-3.5"}),"Add OAuth app"]}):null]})}function E(t,l){return!!t.is_default_for_connector&&t.connector_key===l}function Je({status:t}){const l=t==="active"?"text-green-500":t==="error"||t==="revoked"?"text-destructive":"text-amber-500";return s.jsxs("span",{className:I("text-xs",l),children:["· ",t]})}function Qe(t){const l={};for(const[n,r]of Object.entries(t))typeof r=="string"&&r.trim()?l[n]=r.trim():(typeof r=="number"||typeof r=="boolean")&&(l[n]=String(r));return l}export{Je as A,es as C,ss as O};
2
+ //# sourceMappingURL=connect-menu-Bs8mxsga.js.map
@@ -0,0 +1,2 @@
1
+ import{jc as n,j as t,az as a}from"./index-B-Ab8srM.js";import{a as i}from"./agent-connect-pages-BtOTCsTU.js";import"./agent-client-setup-list-BmD3-_Ox.js";import"./connector-page-shell-ClOmVPJr.js";import"./copy-button-D6zpsZLi.js";import"./clients-6aJvabvS.js";import"./client-rows-BbVQy5Ti.js";function l(){const{owner:o,clientId:e}=n.useParams();return t.jsx(a,{owner:o,children:({ownerSlug:r})=>t.jsx(i,{owner:r,clientId:e})})}export{l as component};
2
+ //# sourceMappingURL=connect._clientId-t5aKu3aa.js.map
@@ -0,0 +1,2 @@
1
+ import{j as e,V as R,c as E,L as b,ec as M,A as $,v as D,ed as _,r as u,S as I,cV as K,dK as H,hy as f,B as y,ab as G,ak as V,gF as O,e6 as Q,gG as F,gH as W,jb as q,az as J}from"./index-B-Ab8srM.js";import{T as X,a as Y,b as S,c as d,d as Z,e as x}from"./table-B6yimlsZ.js";import{c as w,g as P}from"./client-rows-BbVQy5Ti.js";import{u as A}from"./client-activity-scopes-DoIErdUy.js";import{u as z,a as ee}from"./clients-6aJvabvS.js";import{C as se}from"./connector-page-shell-ClOmVPJr.js";function te({isLive:n}){return e.jsx(R,{variant:n?"default":"secondary",className:`shrink-0 text-[10px] ${n?"":"text-muted-foreground"}`,title:n?"Live MCP transport":"No live MCP transport; activity history is retained",children:n?"Active":"Ended"})}function L({scopes:n,ownerSlug:i}){const l=E(),c=t=>({to:"/$owner/events",params:{owner:t.organizationId===null?"me":i},search:{client_ids:t.clientId,mcp_activity_id:t.activityId}}),r=t=>{l(c(t))};return e.jsx("div",{className:"rounded-lg border",children:e.jsxs(X,{children:[e.jsx(Y,{children:e.jsxs(S,{children:[e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Conversation"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Calls"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Last action"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Last active"}),e.jsx(d,{className:"w-8 px-3 py-1.5"})]})}),e.jsx(Z,{children:n.map(t=>e.jsxs(S,{className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>r(t),children:[e.jsx(x,{className:"max-w-0 px-3 py-2 text-xs font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{...c(t),onClick:o=>o.stopPropagation(),className:"truncate hover:underline",children:w(t)}),t.activityKind==="session"?e.jsx(te,{isLive:t.isLive}):null,t.unreadNotificationCount>0?e.jsxs(R,{variant:"secondary",className:"shrink-0 text-[10px]",children:[t.unreadNotificationCount," unread"]}):null]})}),e.jsx(x,{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:t.callCount}),e.jsx(x,{className:"max-w-0 truncate px-3 py-2 text-xs text-muted-foreground",children:t.lastAction||"—"}),e.jsx(x,{className:"px-3 py-2 text-xs text-muted-foreground",children:M(t.lastCallAt)}),e.jsx(x,{className:"px-3 py-2 text-right",children:e.jsx("button",{type:"button","aria-label":`View ${w(t)} activity`,className:"text-muted-foreground hover:text-foreground",tabIndex:-1,children:e.jsx($,{className:"h-3.5 w-3.5"})})})]},`${t.clientId}:${t.activityId}`))})]})})}function ne({ownerSlug:n,clientId:i}){const{orgContext:l}=D(),{isAdmin:c}=_(l.organizationId),{data:r=[],isLoading:t}=z(null),o=ee(),[B,h]=u.useState(!1),s=u.useMemo(()=>P(r),[r]).find(a=>a.clientIds.includes(i)),N=s?.clientIds??[],g=A({enabled:!!s,limit:100,clientIds:N,activityKind:"conversation",organizationId:l?.organizationId??null}),p=A({enabled:!!s,limit:100,clientIds:N,activityKind:"session",organizationId:l?.organizationId??null,refetchInterval:a=>a?5e3:!1}),m=g.data??[],v=p.data??[],T=u.useMemo(()=>r.filter(a=>s?.clientIds.includes(a.id)),[r,s]);if(t)return e.jsxs("div",{className:"space-y-4",children:[e.jsx(I,{className:"h-16 w-full rounded-lg"}),e.jsx(I,{className:"h-24 w-full rounded-lg"})]});if(!s)return e.jsx("p",{className:"text-sm text-muted-foreground",children:"This app isn't connected to this workspace, so its details aren't available."});const j=T[0],C=j?.details?.redirectUris??[],k=s.linkedUserEntitySlug?K(n,[{entity_type:"$member",slug:s.linkedUserEntitySlug}]):null,U=[{label:"Registered",value:s.title},{label:s.clientIds.length===1?"Client ID":"Client IDs",value:e.jsx("div",{className:"space-y-1",children:s.clientIds.map(a=>e.jsx("code",{className:"block break-all",children:a},a))})},...s.drivenBy&&s.drivenBy!==s.title?[{label:"Driven by",value:s.drivenBy}]:[],...j?.platform?[{label:"Software",value:j.platform}]:[],...C.length>0?[{label:"Redirects",value:C.join(", ")}]:[],{label:"Granted by",value:k&&s.linkedUser?e.jsx(b,{to:k,className:"font-medium text-primary hover:underline",children:s.linkedUser}):s.linkedUser??"—"},{label:"Last active",value:s.connected?H(s.lastSeenAt):"disconnected"},{label:"Registrations",value:String(s.clientIds.length)}];return e.jsxs("div",{className:"space-y-7",children:[e.jsx(f,{title:"Settings",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"overflow-hidden rounded-lg border text-xs",children:e.jsx("dl",{className:"divide-y",children:U.map(a=>e.jsxs("div",{className:"flex gap-3 px-3 py-2",children:[e.jsx("dt",{className:"w-28 shrink-0 text-muted-foreground",children:a.label}),e.jsx("dd",{className:"min-w-0 flex-1 break-words",children:a.value})]},a.label))})}),c&&s.connected?e.jsxs("div",{className:"space-y-2 rounded-lg border p-3",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Revoking disconnects every registration this app holds",s.clientIds.length>1?` (${s.clientIds.length} of them)`:""," ","and kills its live sessions. It can reconnect by authorizing again."]}),B?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",disabled:o.isPending,onClick:()=>o.mutate({clientId:s.clientIds[0],scope:"all"},{onSettled:()=>h(!1)}),children:o.isPending?"Revoking…":"Confirm revoke"}),e.jsx(y,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",disabled:o.isPending,onClick:()=>h(!1),children:"Cancel"})]}):e.jsx(y,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>h(!0),children:"Revoke"})]}):null]})}),e.jsx(f,{title:"Conversations",count:m.length>0?String(m.length):void 0,children:g.isLoading||p.isLoading?e.jsxs("div",{className:"flex items-center py-4 text-xs text-muted-foreground",children:[e.jsx(G,{className:"mr-2"})," Loading client activity…"]}):g.isError||p.isError?e.jsx("p",{className:"py-3 text-xs text-destructive",children:"Could not load this app's activity."}):m.length===0?e.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"No recent conversations."}):e.jsx(L,{scopes:m,ownerSlug:n})}),v.length>0?e.jsx(f,{title:"Sessions",count:String(v.length),children:e.jsx(L,{scopes:v,ownerSlug:n})}):null]})}function ae({owner:n,clientId:i}){const{data:l=[]}=z(null),r=u.useMemo(()=>P(l).find(t=>t.clientIds.includes(i)),[i,l])?.title??"Connected agent";return e.jsx(V,{className:"gap-3 pt-2.5 pb-8",children:e.jsx(se,{header:e.jsx(O,{breadcrumb:e.jsx(F,{crumbs:[e.jsx(b,{to:"/$owner/agents",params:{owner:n},className:W,children:"Agents"},"agents")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(Q,{name:r})}),title:r,caption:"An external agent connected to this workspace through Lobu. Review its Lobu conversations, activity, and access."}),children:e.jsx(ne,{ownerSlug:n,clientId:i},i)})})}function me(){const{owner:n,clientId:i}=q.useParams();return e.jsx(J,{owner:n,children:({ownerSlug:l})=>e.jsx(ae,{owner:l,clientId:i})})}export{me as component};
2
+ //# sourceMappingURL=connected._clientId-DswMAw8l.js.map
@@ -1,2 +1,2 @@
1
- import{bk as W,E as F,r as l,a3 as z,Q as R,j as e,ab as N,B as f,bl as V,bm as q,bn as M,bo as Y,bp as E,I as B,x as D,ag as G,a5 as J,ad as K,J as H}from"./index-BjcZVe7n.js";import{s as Q}from"./index-BDl1_w6U.js";import{C as X,a as Z,b as ee,c as ne}from"./card-g4yxo4Hr.js";const C="__new_org__";function te(r){return r.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function w(r){return Q.find(i=>i.provider===r)?.name??r}function re(r,i){return`${window.location.origin}/connector/${encodeURIComponent(r)}/connection?${new URLSearchParams({ref:i})}`}function ie(r,i){return r==="account_already_linked_to_different_user"?`This ${i} account belongs to a different Lobu account than the one you are signed in to. Sign out, then continue with ${i} to finish setup as that account.`:`We couldn’t verify your ${i} account for this setup. Sign out, then continue with ${i} to try again.`}function oe(r,i){const[s,n]=l.useState({}),o=i?`${i}:${r}`:null;return l.useEffect(()=>{if(!o||!i||o in s)return;let c=!1;return D(i).then(h=>h.find(g=>g.key===r)?.name??null).catch(()=>null).then(h=>{c||n(g=>({...g,[o]:h}))}),()=>{c=!0}},[o,r,s,i]),o?s[o]??null:null}function I(r,i,s){if(!r)return"/";const n=`/${encodeURIComponent(r)}/`;if(s?.startsWith(n)){const o=new URL(s,window.location.origin);if(o.origin===window.location.origin&&o.pathname.startsWith(n))return o.pathname+o.search}return`${n}connectors/${encodeURIComponent(i)}?connected=1`}function se(r,i){return r==="not_admin"?`You must be an admin or owner to connect ${i} to Lobu.`:`You don't have permission to connect ${i} to Lobu.`}function T(r,i,s){switch(r){case"not_authorized":return se(i,s);case"no_pending":return`No Lobu install was found for ${s}. Add Lobu from the marketplace to get started.`;case"no_org":return`Your account has no Lobu organization to connect ${s} to.`;default:return`Something went wrong while connecting ${s}. Please try again.`}}function de(){const{name:r}=W({from:"/connector/$name/connection"}),{ref:i,error:s}=F({from:"/connector/$name/connection"}),[n,o]=l.useState({kind:"loading"}),[c,h]=l.useState(""),[g,O]=l.useState(""),[x,_]=l.useState(!1),[$,p]=l.useState(null),[j,k]=l.useState(null),u=oe(r,n.kind==="confirm"?n.orgs[0]?.slug??null:n.kind==="already_connected"?n.orgSlug:null),m=n.kind==="confirm"&&n.subjectKind||"connection",S=n.kind==="confirm"&&n.subjectName?n.subjectName:u?`this ${u} ${m}`:`this ${m}`,P=l.useCallback(async()=>{if(!i){o({kind:"error",message:"This connection link is missing its reference."});return}o({kind:"loading"});try{const t=await(await z(`${R}/api/connector/${encodeURIComponent(r)}/connection/claim-context?ref=${encodeURIComponent(i)}`,{credentials:"include"})).json();if("error"in t){if(t.error==="unauthenticated"){o({kind:"signin",signinProvider:t.signinProvider??r,linkAccount:!1});return}if(t.error==="signin_required"){o(s?{kind:"link_failed",signinProvider:t.signinProvider??r,error:s}:{kind:"signin",signinProvider:t.signinProvider??r,linkAccount:!0});return}o({kind:"error",message:T(t.error,t.code,"this connection")});return}if("alreadyConnected"in t){o({kind:"already_connected",orgSlug:t.orgSlug,nextUrl:t.nextUrl});return}h(t.orgs[0]?.slug??""),o({kind:"confirm",subjectKind:t.subjectKind,subjectName:t.subjectName,orgs:t.orgs})}catch{o({kind:"error",message:"We couldn’t load this connection link. Please try again."})}},[r,i,s]);l.useEffect(()=>{P()},[P]);const L=async d=>{if(!i)return;const t=re(r,i);if(n.kind==="signin"&&n.linkAccount){const b=await G.linkSocial({provider:d,callbackURL:t,errorCallbackURL:t});b.error&&o({kind:"error",message:b.error.message??"Couldn’t verify this account."});return}n.kind==="link_failed"&&await J(),await K.social({provider:d,callbackURL:t,errorCallbackURL:t})},U=async(d=!1)=>{if(!(!i||!c)){_(!0),p(null),k(null);try{let t=c;if(c===C){const y=g.trim();if(!y){p("Enter a name for the new organization.");return}const v=await H.create({name:y,slug:te(y)});if(v.error||!v.data){p(v.error?.message??"Couldn’t create the organization.");return}t=v.data.slug}const a=await(await z(`${R}/api/connector/${encodeURIComponent(r)}/connection/claim`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({ref:i,org:t,confirmMove:d})})).json();if("error"in a){if(a.error==="signin_required"||a.error==="unauthenticated"){o({kind:"signin",signinProvider:a.signinProvider??r,linkAccount:a.error==="signin_required"});return}if((a.error==="already_connected_elsewhere"||a.error==="enterprise_scope_overlap")&&a.existing){k({kind:a.error,existing:a.existing});return}p(T(a.error,a.code,S));return}window.location.href=I(a.orgSlug,r,a.nextUrl)}catch{p(`Something went wrong while connecting this ${m}. Please try again.`)}finally{_(!1)}}},A=n.kind==="signin"?"Sign in to continue":n.kind==="link_failed"?"Use a different account":n.kind==="error"?`Can’t connect this ${m}`:n.kind==="already_connected"?"Already connected":u?`Connect ${u} to Lobu`:"Connect to Lobu";return e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:e.jsx("div",{className:"w-full max-w-md p-8",children:e.jsxs(X,{children:[e.jsx(Z,{children:e.jsx(ee,{asChild:!0,children:e.jsx("h1",{children:A})})}),e.jsxs(ne,{children:[n.kind==="loading"&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground",children:[e.jsx(N,{size:"lg"}),e.jsx("span",{children:"Checking this connection link…"})]}),n.kind==="error"&&e.jsx("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:n.message}),n.kind==="already_connected"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This ",u?`${u} `:"",m," is already connected to Lobu."]}),e.jsx(f,{className:"w-full",asChild:!0,children:e.jsx("a",{href:I(n.orgSlug,r,n.nextUrl),children:n.nextUrl?"Choose an agent":"Open Lobu"})})]}),n.kind==="signin"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Sign in with ",w(n.signinProvider)," to verify you can connect this ",m,"."]}),e.jsxs(f,{className:"w-full",onClick:()=>L(n.signinProvider),children:["Sign in with ",w(n.signinProvider)]})]}),n.kind==="link_failed"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{role:"alert",className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:ie(n.error,w(n.signinProvider))}),e.jsxs(f,{className:"w-full",onClick:()=>L(n.signinProvider),children:["Sign out and continue with"," ",w(n.signinProvider)]})]}),n.kind==="confirm"&&(()=>{const d=n.subjectName||S;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Connecting"," ",e.jsx("strong",{className:"font-medium text-foreground",children:d}),". Choose the organization to connect it to:"]}),e.jsxs(V,{value:c,onValueChange:t=>{k(null),h(t)},children:[e.jsx(q,{children:e.jsx(M,{placeholder:"Select an organization"})}),e.jsxs(Y,{children:[n.orgs.map(t=>e.jsxs(E,{value:t.slug,children:[t.name,t.isPersonal&&e.jsx("span",{className:"ml-1 text-muted-foreground",children:"(personal)"})]},t.id)),e.jsx(E,{value:C,children:"+ New organization"})]})]}),c===C&&e.jsx(B,{autoFocus:!0,value:g,onChange:t=>O(t.target.value),placeholder:"New organization name","aria-label":"New organization name"}),$&&e.jsx("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:$}),j&&(()=>{const t=j.existing.orgName??j.existing.orgSlug??"another organization";return j.kind==="already_connected_elsewhere"?e.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-muted/40 px-3 py-3",children:[e.jsxs("p",{className:"text-sm text-foreground",children:[d," is already connected in"," ",e.jsx("strong",{className:"font-medium",children:t}),". Move it here?"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{className:"flex-1",onClick:()=>U(!0),disabled:x,children:x?e.jsxs(e.Fragment,{children:[e.jsx(N,{size:"lg"}),e.jsx("span",{className:"ml-2",children:"Moving…"})]}):"Move it here"}),e.jsx(f,{className:"flex-1",variant:"outline",onClick:()=>k(null),disabled:x,children:"Cancel"})]})]}):e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:["This ",u?`${u} `:"","Enterprise Grid is already connected in"," ",e.jsx("strong",{className:"font-medium",children:t}),"; ","connecting this ",m," here may change how its messages route. Contact support to move it."]})})(),e.jsx(f,{className:"w-full",onClick:()=>U(),disabled:x||j!==null||!c||c===C&&!g.trim(),children:x?e.jsxs(e.Fragment,{children:[e.jsx(N,{size:"lg"}),e.jsx("span",{className:"ml-2",children:"Connecting…"})]}):`Connect ${d}`})]})})()]})]})})})}export{de as component};
2
- //# sourceMappingURL=connection-B6fM2KHN.js.map
1
+ import{bs as W,E as F,r as l,a3 as z,Q as R,j as e,ab as N,B as f,bt as V,bu as q,bv as M,bw as Y,bx as E,I as B,x as D,ag as G,a5 as J,ad as K,J as H}from"./index-B-Ab8srM.js";import{s as Q}from"./index-B72KYdN1.js";import{C as X,a as Z,b as ee,c as ne}from"./card-DT9mSjSp.js";const w="__new_org__";function te(r){return r.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function C(r){return Q.find(i=>i.provider===r)?.name??r}function re(r,i){return`${window.location.origin}/connector/${encodeURIComponent(r)}/connection?${new URLSearchParams({ref:i})}`}function ie(r,i){return r==="account_already_linked_to_different_user"?`This ${i} account belongs to a different Lobu account than the one you are signed in to. Sign out, then continue with ${i} to finish setup as that account.`:`We couldn’t verify your ${i} account for this setup. Sign out, then continue with ${i} to try again.`}function oe(r,i){const[s,n]=l.useState({}),o=i?`${i}:${r}`:null;return l.useEffect(()=>{if(!o||!i||o in s)return;let c=!1;return D(i).then(h=>h.find(g=>g.key===r)?.name??null).catch(()=>null).then(h=>{c||n(g=>({...g,[o]:h}))}),()=>{c=!0}},[o,r,s,i]),o?s[o]??null:null}function I(r,i,s){if(!r)return"/";const n=`/${encodeURIComponent(r)}/`;if(s?.startsWith(n)){const o=new URL(s,window.location.origin);if(o.origin===window.location.origin&&o.pathname.startsWith(n))return o.pathname+o.search}return`${n}connectors/${encodeURIComponent(i)}?connected=1`}function se(r,i){return r==="not_admin"?`You must be an admin or owner to connect ${i} to Lobu.`:`You don't have permission to connect ${i} to Lobu.`}function T(r,i,s){switch(r){case"not_authorized":return se(i,s);case"no_pending":return`No Lobu install was found for ${s}. Add Lobu from the marketplace to get started.`;case"no_org":return`Your account has no Lobu organization to connect ${s} to.`;default:return`Something went wrong while connecting ${s}. Please try again.`}}function de(){const{name:r}=W({from:"/connector/$name/connection"}),{ref:i,error:s}=F({from:"/connector/$name/connection"}),[n,o]=l.useState({kind:"loading"}),[c,h]=l.useState(""),[g,O]=l.useState(""),[x,_]=l.useState(!1),[$,p]=l.useState(null),[j,k]=l.useState(null),u=oe(r,n.kind==="confirm"?n.orgs[0]?.slug??null:n.kind==="already_connected"?n.orgSlug:null),m=n.kind==="confirm"&&n.subjectKind||"connection",S=n.kind==="confirm"&&n.subjectName?n.subjectName:u?`this ${u} ${m}`:`this ${m}`,P=l.useCallback(async()=>{if(!i){o({kind:"error",message:"This connection link is missing its reference."});return}o({kind:"loading"});try{const t=await(await z(`${R}/api/connector/${encodeURIComponent(r)}/connection/claim-context?ref=${encodeURIComponent(i)}`,{credentials:"include"})).json();if("error"in t){if(t.error==="unauthenticated"){o({kind:"signin",signinProvider:t.signinProvider??r,linkAccount:!1});return}if(t.error==="signin_required"){o(s?{kind:"link_failed",signinProvider:t.signinProvider??r,error:s}:{kind:"signin",signinProvider:t.signinProvider??r,linkAccount:!0});return}o({kind:"error",message:T(t.error,t.code,"this connection")});return}if("alreadyConnected"in t){o({kind:"already_connected",orgSlug:t.orgSlug,nextUrl:t.nextUrl});return}h(t.orgs[0]?.slug??""),o({kind:"confirm",subjectKind:t.subjectKind,subjectName:t.subjectName,orgs:t.orgs})}catch{o({kind:"error",message:"We couldn’t load this connection link. Please try again."})}},[r,i,s]);l.useEffect(()=>{P()},[P]);const L=async d=>{if(!i)return;const t=re(r,i);if(n.kind==="signin"&&n.linkAccount){const b=await G.linkSocial({provider:d,callbackURL:t,errorCallbackURL:t});b.error&&o({kind:"error",message:b.error.message??"Couldn’t verify this account."});return}n.kind==="link_failed"&&await J(),await K.social({provider:d,callbackURL:t,errorCallbackURL:t})},U=async(d=!1)=>{if(!(!i||!c)){_(!0),p(null),k(null);try{let t=c;if(c===w){const y=g.trim();if(!y){p("Enter a name for the new organization.");return}const v=await H.create({name:y,slug:te(y)});if(v.error||!v.data){p(v.error?.message??"Couldn’t create the organization.");return}t=v.data.slug}const a=await(await z(`${R}/api/connector/${encodeURIComponent(r)}/connection/claim`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({ref:i,org:t,confirmMove:d})})).json();if("error"in a){if(a.error==="signin_required"||a.error==="unauthenticated"){o({kind:"signin",signinProvider:a.signinProvider??r,linkAccount:a.error==="signin_required"});return}if((a.error==="already_connected_elsewhere"||a.error==="enterprise_scope_overlap")&&a.existing){k({kind:a.error,existing:a.existing});return}p(T(a.error,a.code,S));return}window.location.href=I(a.orgSlug,r,a.nextUrl)}catch{p(`Something went wrong while connecting this ${m}. Please try again.`)}finally{_(!1)}}},A=n.kind==="signin"?"Sign in to continue":n.kind==="link_failed"?"Use a different account":n.kind==="error"?`Can’t connect this ${m}`:n.kind==="already_connected"?"Already connected":u?`Connect ${u} to Lobu`:"Connect to Lobu";return e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:e.jsx("div",{className:"w-full max-w-md p-8",children:e.jsxs(X,{children:[e.jsx(Z,{children:e.jsx(ee,{asChild:!0,children:e.jsx("h1",{children:A})})}),e.jsxs(ne,{children:[n.kind==="loading"&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground",children:[e.jsx(N,{size:"lg"}),e.jsx("span",{children:"Checking this connection link…"})]}),n.kind==="error"&&e.jsx("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:n.message}),n.kind==="already_connected"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This ",u?`${u} `:"",m," is already connected to Lobu."]}),e.jsx(f,{className:"w-full",asChild:!0,children:e.jsx("a",{href:I(n.orgSlug,r,n.nextUrl),children:n.nextUrl?"Choose an agent":"Open Lobu"})})]}),n.kind==="signin"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Sign in with ",C(n.signinProvider)," to verify you can connect this ",m,"."]}),e.jsxs(f,{className:"w-full",onClick:()=>L(n.signinProvider),children:["Sign in with ",C(n.signinProvider)]})]}),n.kind==="link_failed"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{role:"alert",className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:ie(n.error,C(n.signinProvider))}),e.jsxs(f,{className:"w-full",onClick:()=>L(n.signinProvider),children:["Sign out and continue with"," ",C(n.signinProvider)]})]}),n.kind==="confirm"&&(()=>{const d=n.subjectName||S;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Connecting"," ",e.jsx("strong",{className:"font-medium text-foreground",children:d}),". Choose the organization to connect it to:"]}),e.jsxs(V,{value:c,onValueChange:t=>{k(null),h(t)},children:[e.jsx(q,{children:e.jsx(M,{placeholder:"Select an organization"})}),e.jsxs(Y,{children:[n.orgs.map(t=>e.jsxs(E,{value:t.slug,children:[t.name,t.isPersonal&&e.jsx("span",{className:"ml-1 text-muted-foreground",children:"(personal)"})]},t.id)),e.jsx(E,{value:w,children:"+ New organization"})]})]}),c===w&&e.jsx(B,{autoFocus:!0,value:g,onChange:t=>O(t.target.value),placeholder:"New organization name","aria-label":"New organization name"}),$&&e.jsx("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:$}),j&&(()=>{const t=j.existing.orgName??j.existing.orgSlug??"another organization";return j.kind==="already_connected_elsewhere"?e.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-muted/40 px-3 py-3",children:[e.jsxs("p",{className:"text-sm text-foreground",children:[d," is already connected in"," ",e.jsx("strong",{className:"font-medium",children:t}),". Move it here?"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{className:"flex-1",onClick:()=>U(!0),disabled:x,children:x?e.jsxs(e.Fragment,{children:[e.jsx(N,{size:"lg"}),e.jsx("span",{className:"ml-2",children:"Moving…"})]}):"Move it here"}),e.jsx(f,{className:"flex-1",variant:"outline",onClick:()=>k(null),disabled:x,children:"Cancel"})]})]}):e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:["This ",u?`${u} `:"","Enterprise Grid is already connected in"," ",e.jsx("strong",{className:"font-medium",children:t}),"; ","connecting this ",m," here may change how its messages route. Contact support to move it."]})})(),e.jsx(f,{className:"w-full",onClick:()=>U(),disabled:x||j!==null||!c||c===w&&!g.trim(),children:x?e.jsxs(e.Fragment,{children:[e.jsx(N,{size:"lg"}),e.jsx("span",{className:"ml-2",children:"Connecting…"})]}):`Connect ${d}`})]})})()]})]})})})}export{de as component};
2
+ //# sourceMappingURL=connection-BOaMa324.js.map
@@ -0,0 +1,2 @@
1
+ import{ha as H,r,j as e,gk as Y,cY as G,Y as X,i as E,B as N,gm as J,j2 as Q,c8 as R,eF as V,hg as $,bt as Z,bu as ee,bv as se,bw as te,bx as ne,eG as B,cd as z,bV as ae,ab as D,j3 as ce,cO as le,a0 as ie,j4 as re,dm as oe,j5 as de,j6 as me,j7 as ue,j8 as xe,j9 as he,ja as pe,ew as ge,L as K,hy as A,V as U,ec as M}from"./index-B-Ab8srM.js";import{f as je,C as fe}from"./entity-options-CGTjLlcS.js";import{s as T}from"./event-card-BtTUuf2q.js";import{V as ve,R as ye}from"./runs-list-DVhrTr3v.js";import{S as I,g as O}from"./status-variants-DT61YfsU.js";import{f as Ne}from"./feed-event-kinds-BYuZCoU4.js";function be({organizationId:s,value:t,onChange:a,entities:n,className:m}){const{data:o=[]}=H(n?void 0:s),l=r.useMemo(()=>n??je(o),[n,o]),x=new Set(t),d=l.filter(c=>x.has(c.id)),v=c=>{const i=new Set(x);i.has(c)?i.delete(c):i.add(c),a(Array.from(i).sort((p,y)=>p-y))},j=d.length===0?"All entities":d.length===1?d[0].name:`${d.length} entities selected`;return e.jsx(Y,{contentClassName:"w-[320px]",searchPlaceholder:"Filter entities...",emptyText:"No entities found.",trigger:c=>e.jsxs(N,{variant:"outline",role:"combobox","aria-expanded":c,className:E("justify-between",m),children:[j,e.jsx(J,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:()=>l.map(c=>{const i=x.has(c.id);return e.jsxs(G,{value:`${c.name} ${c.entityType}`,onSelect:()=>v(c.id),className:"cursor-pointer",children:[e.jsx(X,{className:E("mr-2 h-4 w-4",i?"opacity-100":"opacity-0")}),e.jsxs("span",{children:[c.name," ",e.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",c.entityType,")"]})]})]},c.id)})})}function _e(s){return s?.feeds_schema?Object.entries(s.feeds_schema).map(([t,a])=>({key:t,name:a.name??t,description:a.description,configSchema:a.configSchema})):[]}const De="Feeds are optional scheduled sync targets for an existing connection.";function Ae({organizationId:s,connections:t,connectorDefinitions:a,entityId:n,onClose:m}){const o=t.length===1,[l,x]=r.useState(o?String(t[0].id):""),[d,v]=r.useState(""),[j,c]=r.useState(n?[n]:[]),[i,p]=r.useState(null),y=Q(),C=r.useMemo(()=>new Map(a.map(u=>[u.key,u])),[a]),f=r.useMemo(()=>t.find(u=>String(u.id)===l),[t,l]),b=r.useMemo(()=>f?_e(C.get(f.connector_key)):[],[f,C]),k=r.useMemo(()=>b.find(u=>u.key===d)??null,[b,d]),g=R(`${l}:${d}`,V(k?.configSchema),k?.configSchema),{values:_,setValues:w}=g,S=r.useCallback(()=>{x(o?String(t[0].id):""),v(""),c(n?[n]:[]),p(null)},[n,o,t]),h=r.useCallback(()=>{S(),m()},[m,S]),F=r.useCallback(async()=>{if(!g.canSubmit||!f||!d)return;p(null);const u=$(_);try{await y.mutateAsync({connection_id:f.id,feed_key:d,config:Object.keys(u).length>0?u:void 0,entity_ids:n?[n]:j.length>0?j:void 0}),h()}catch(L){p(L instanceof Error?L.message:"Failed to create feed")}},[_,g.canSubmit,y,n,h,f,j,d]),W=e.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto py-6 pr-1",children:[!o&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Connection"}),e.jsx(fe,{connections:t,value:l,onValueChange:u=>{x(u),v(""),p(null)},placeholder:"Select a connection"})]}),f&&b.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Feed Type"}),e.jsxs(Z,{value:d,onValueChange:v,children:[e.jsx(ee,{children:e.jsx(se,{placeholder:"Select feed type"})}),e.jsx(te,{children:b.map(u=>e.jsx(ne,{value:u.key,children:e.jsxs("div",{children:[e.jsx("span",{children:u.name}),u.description&&e.jsxs("span",{className:"text-muted-foreground ml-1 text-xs",children:["— ",u.description]})]})},u.key))})]})]}),n?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Target Entity"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This feed will be attached to the current entity."})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Target Entities"}),e.jsx(be,{organizationId:s,value:j,onChange:c,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Leave empty to create an unscoped feed."})]}),g.revision&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Feed Configuration"}),e.jsx(B,{schema:g.revision,values:_,onValuesChange:w})]}),f&&b.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connector has no configurable feed types."}),e.jsx(z,{visible:g.hasConflict,onReload:g.reset}),i&&e.jsx("p",{className:"text-sm text-destructive",children:i})]}),q=e.jsx(ae,{onCancel:h,className:"mt-2",children:e.jsxs(N,{disabled:!g.canSubmit||!d||y.isPending,onClick:()=>void F(),children:[y.isPending&&e.jsx(D,{size:"lg",className:"mr-2"}),"Create Feed"]})});return e.jsxs("div",{className:"flex flex-col",children:[W,q]})}function Le({feed:s,onClose:t,hideHeader:a=!1}){const n=s.display_name?.trim()||s.feed_key,m=s.feed_key.includes(":")?s.feed_key.slice(s.feed_key.indexOf(":")+1):s.feed_key,o=s.external_tenant_id,l=s.connector_key==="slack"&&o?`https://app.slack.com/client/${o}/${m}`:void 0;return e.jsxs("div",{className:"flex max-w-xl flex-col gap-4",children:[a?null:e.jsxs(e.Fragment,{children:[t?e.jsxs("button",{type:"button",onClick:t,className:"inline-flex w-fit items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(ce,{className:"h-3 w-3"}),"Back to connection"]}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h2",{className:"text-lg font-semibold leading-tight",children:n}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"chat channel"})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Messages captured for this channel are available to Lobu Automations. Open Slack to read the channel history."}),l?e.jsx(N,{asChild:!0,variant:"outline",className:"w-full justify-center",children:e.jsxs("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ie,{className:"mr-2 h-4 w-4"}),"Open in Slack"]})}):null,e.jsxs("div",{className:E(oe,"flex flex-col gap-3 p-4"),children:[e.jsx("div",{className:"text-xs font-medium uppercase text-muted-foreground",children:"Channel"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"break-all",children:n})]}),o?e.jsxs("div",{className:"flex items-baseline justify-between gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),e.jsx("span",{className:"break-all font-mono text-xs",children:o})]}):null,e.jsx("p",{className:"text-xs text-muted-foreground",children:"Messages the bot sees here are captured as they arrive. Open the channel in Slack to read the full history."})]})]})}function Me(s,t){return s.display_name?s.display_name:t?.feeds_schema?.[s.feed_key]?.name??s.feed_key}function Se(s,t){const a=s?.feeds_schema;if(!a)return;if(a[t])return a[t];const n=Object.values(a);return n.find(m=>m?.key===t)??(n.length===1?n[0]:void 0)}const P=8;function Ce({kinds:s}){const[t,a]=r.useState(!1),n=t?s:s.slice(0,P);return e.jsxs(A,{title:"Event types",count:`${s.length} ${s.length===1?"kind":"kinds"}`,children:[e.jsx("ul",{className:"divide-y",children:n.map(({kind:m,description:o,targets:l})=>e.jsxs("li",{className:"flex flex-col gap-1 py-2 sm:flex-row sm:items-start sm:gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:T(m)}),e.jsx("code",{className:"truncate font-mono text-[11px] text-muted-foreground",children:m})]}),o?e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",title:o,children:o}):null]}),l.length>0?e.jsx("div",{className:"flex flex-wrap gap-1 sm:max-w-[40%] sm:justify-end",children:l.map(({entityType:x,creates:d})=>e.jsx(U,{variant:"secondary",className:"font-normal",title:d?`Creates ${x} records`:`Links to existing ${x} records`,children:T(x)},x))}):null]},m))}),s.length>P?e.jsx(N,{variant:"ghost",size:"sm",className:"mt-1 h-7 px-2 text-xs text-muted-foreground",onClick:()=>a(m=>!m),children:t?"Show fewer":`Show all ${s.length}`}):null]})}function Te({feed:s,ownerSlug:t}){return e.jsxs(e.Fragment,{children:[e.jsx(I,{status:O(s.status),showDot:!0,children:s.status}),s.connection_status&&s.connection_status!==s.status&&e.jsxs(I,{status:O(s.connection_status),showDot:!0,children:["Connection: ",s.connection_status]}),s.device_worker_id?e.jsx(K,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:s.device_worker_id},children:e.jsx(U,{variant:s.device_status==="offline"?"secondary":"outline",className:"text-xs hover:bg-accent",children:s.device_status==="offline"?`Waiting for ${s.device_label||s.device_platform||"device"}`:`On ${s.device_label||s.device_platform||"device"}`})}):null]})}function Ie({feed:s}){return s.operations.includes("sync")?e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["Last sync: ",s.last_sync_at?M(s.last_sync_at):"—"]}),e.jsxs("span",{children:["Next: ",s.next_run_at?M(s.next_run_at):"—"]}),e.jsxs("span",{className:"font-mono",children:[(s.event_count??0).toLocaleString()," events"]})]}):e.jsx("span",{children:"Read live when queried"})}function Oe({feed:s,connectorDef:t,ownerSlug:a}){const{data:n,refetch:m}=de(s.id),o=r.useMemo(()=>(n?.recent_runs??[]).map(h=>({...h,run_type:"sync"})),[n?.recent_runs]),l=me(),x=ue(),d=n?.recent_runs?.some(h=>["running","pending","claimed"].includes(h.status));r.useEffect(()=>{if(!d)return;const h=setInterval(()=>m(),5e3);return()=>clearInterval(h)},[d,m]);const v=r.useMemo(()=>Se(t,s.feed_key),[t,s.feed_key]),j=v?.configSchema,c=r.useMemo(()=>Ne(v).sort((h,F)=>h.kind.localeCompare(F.kind)),[v]),i=R(s.id,V(j,s.config??{}),j),{values:p,setValues:y,dirty:C}=i,f=r.useCallback(async()=>{i.canSubmit&&(await l.mutateAsync({feed_id:s.id,config:$(p)}),i.accept(p,V(j,$(p))))},[l,s.id,p,j,i.canSubmit,i.accept]),b=r.useCallback(async()=>{const h=s.status==="active"?"paused":"active";await l.mutateAsync({feed_id:s.id,status:h})},[l,s.id,s.status]),k=r.useCallback(async()=>{await x.mutateAsync(s.id)},[x,s.id]),g=s.status==="active",_=s.operations.includes("sync"),w=s.auth_profile_status&&s.auth_profile_status!=="active",S=l.isPending||x.isPending;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(N,{variant:"outline",size:"sm",disabled:S,onClick:()=>void b(),children:[g?e.jsx(xe,{className:"h-3.5 w-3.5 mr-1.5"}):e.jsx(he,{className:"h-3.5 w-3.5 mr-1.5"}),g?"Pause":"Resume"]}),_?e.jsxs(N,{variant:"outline",size:"sm",disabled:S||!g,onClick:()=>void k(),children:[x.isPending?e.jsx(D,{size:"md",className:"mr-1.5"}):e.jsx(pe,{className:"h-3.5 w-3.5 mr-1.5"}),"Sync now"]}):null,e.jsx(ve,{ownerSlug:a,scope:{kind:"feed",id:s.id},variant:"ghost",label:"View in memory"})]}),w&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-50 dark:bg-amber-950/20 px-3 py-2 text-sm",children:[e.jsx(ge,{className:"h-4 w-4 text-amber-500 shrink-0"}),e.jsxs("span",{className:"text-amber-700 dark:text-amber-400",children:["Authentication issue: ",s.auth_profile_status]}),e.jsx(N,{asChild:!0,variant:"outline",size:"sm",className:"ml-auto h-7 text-xs",children:e.jsx(K,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:a,connectorKey:s.connector_key,connectionId:String(s.connection_id)},search:{settings:!0},children:"Fix auth"})})]}),i.revision?e.jsx(A,{title:"Settings",children:e.jsxs("div",{className:"max-w-xl space-y-4",children:[e.jsx(B,{schema:i.revision,values:p,onValuesChange:y}),e.jsx(z,{visible:i.hasConflict,onReload:i.reset}),C&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(N,{size:"sm",disabled:S||!i.canSubmit,onClick:()=>void f(),children:[l.isPending?e.jsx(D,{size:"md",className:"mr-1.5"}):null,"Save"]})})]})}):null,c.length>0?e.jsx(Ce,{kinds:c}):null,_?e.jsx(A,{title:"Recent syncs",children:e.jsx(ye,{runs:o,ownerSlug:a,emptyState:e.jsx("p",{className:"rounded-lg border bg-muted/20 px-3 py-6 text-center text-xs text-muted-foreground",children:"No syncs yet."})})}):null]})}export{Ae as A,Le as C,Te as F,Ie as a,Oe as b,De as c,Me as f};
2
+ //# sourceMappingURL=connection-feed-detail-BLCjhP-H.js.map
@@ -0,0 +1,2 @@
1
+ import{c as T,r as f,aQ as O,j as e,dM as D,dO as B,B as M,aZ as R,dN as P,dQ as E,dR as F,dS as K,dT as U,cX as _,b4 as b,cY as w,bb as C,fF as z,g7 as N,L as x,bc as $,b6 as k,g8 as q,b7 as A,b9 as Q,ba as W,i as j,g9 as I,d9 as v,ga as S,C as Y,dc as Z,gb as G,gc as H,gd as V,ec as X,cP as J}from"./index-B-Ab8srM.js";const ee={trigger:"runs on arrival",delivery:"delivers here"};function ce(n){const s=new Map,o=(r,t,i,c)=>{const d=Number(r);if(!Number.isInteger(d)||d<=0)return;const m=s.get(d)??[],a=m.find(l=>l.automation.automation_id===t.automation_id);if(a){if(a.reason===i)for(const l of c)a.eventTypes.includes(l)||a.eventTypes.push(l);return}m.push({automation:t,reason:i,eventTypes:[...c]}),s.set(d,m)};for(const r of n){for(const t of r.triggers??[]){const i=Array.isArray(t.event_types)?t.event_types.map(String):[];o(t.connection_id,r,"trigger",i)}o(r.delivery_target?.connection_id,r,"delivery",[])}return s}function le(n){const s=new Map;for(const o of n){const r=s.get(o.connection_id)??[];r.push(o),s.set(o.connection_id,r)}return s}function de(n){const s=(o,r,t)=>`${o} ${o===1?r:t}`;return[s(n.feeds,"feed","feeds"),n.actions>0?s(n.actions,"action","actions"):null,n.automations>0?s(n.automations,"Automation","Automations"):null].filter(Boolean).join(" · ")}const ne="overflow-hidden rounded-lg border divide-y";function te({header:n,action:s,children:o}){return e.jsxs("section",{children:[e.jsxs("div",{className:j("flex items-center",I),children:[e.jsx("div",{className:"min-w-0 flex-1",children:n}),s?e.jsx("div",{className:"shrink-0 pr-3",children:s}):null]}),o]})}function se(n){const s=f.useMemo(()=>{const t=Date.now(),i=c=>S(c,n.feeds.get(c.id)??[],n.connectorDefs.get(c.connector_key),t).problem;return[...n.connections].sort((c,d)=>Number(i(d))-Number(i(c))||v(c).localeCompare(v(d)))},[n.connections,n.connectorDefs,n.feeds]),[o,r]=f.useState(()=>new Set);return s.length===0?null:e.jsx("ul",{className:"divide-y border-t",children:s.map(t=>e.jsx("li",{children:e.jsx(ae,{...n,connection:t,open:o.has(t.id),onToggle:()=>r(i=>{const c=new Set(i);return c.delete(t.id)||c.add(t.id),c})})},t.id))})}function ae({connection:n,connectorDefs:s,feeds:o,automations:r,ownerSlug:t,showConnector:i,open:c,onToggle:d}){const m=s.get(n.connector_key),a=o.get(n.id)??[],l=S(n,a,m,Date.now()),p=r.get(n.id)??[],u=n.operations_summary?.total??0,y={owner:t,connectorKey:n.connector_key,connectionId:String(n.id)},h=b(n.connector_key,s,{name:n.connector_name??n.connector_key}),L=n.device_worker_id?`${n.device_label||n.device_platform||"Device"}${n.device_online===!1?" · offline":""}`:null;return e.jsxs("div",{children:[e.jsxs("div",{className:j("flex items-center gap-3 pl-3",I),children:[e.jsx("button",{type:"button",onClick:d,"aria-expanded":c,"aria-label":`${c?"Collapse":"Expand"} ${v(n)}`,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground",children:e.jsx(Y,{className:j("size-4 transition-transform",c&&"rotate-90")})}),e.jsx(x,{to:"/$owner/connectors/$connectorKey/$connectionId",params:y,search:{},className:j($,"pl-0"),children:e.jsx(k,{mark:i?e.jsx(C,{icon:h.icon,iconUrl:h.iconUrl,name:h.name,faviconDomain:h.faviconDomain,className:"h-7 w-7 text-[10px]"}):null,name:v(n),tone:l.problem?"destructive":null,details:e.jsx(A,{parts:[l.text,i?h.name:L,u>0?`${u} ${u===1?"action":"actions"}`:null,p.length>0?`${p.length} ${p.length===1?"Automation":"Automations"}`:null]}),at:l.at})})]}),c?e.jsxs("div",{className:"grid grid-cols-[4.5rem_1fr] items-start gap-x-2 gap-y-2 pr-3 pb-3 pl-13 text-xs",children:[e.jsx("span",{className:"pt-1 text-[10.5px] tracking-wide text-muted-foreground uppercase",children:"Feeds"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.map(g=>e.jsx(re,{feed:g,params:y},g.id)),a.length===0&&n.feed_count>0?e.jsx("span",{className:"text-muted-foreground",children:"Loading feeds…"}):null,e.jsxs(x,{to:"/$owner/connectors/$connectorKey/$connectionId",params:y,search:{addFeed:!0},className:"inline-flex items-center gap-1 rounded-full border border-dashed px-2 py-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:[e.jsx(Z,{className:"size-3"}),"Feed"]})]}),u>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"pt-1 text-[10.5px] tracking-wide text-muted-foreground uppercase",children:"Actions"}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pt-0.5",children:e.jsxs(x,{to:"/$owner/connectors/$connectorKey",params:{owner:t,connectorKey:n.connector_key},className:"text-muted-foreground hover:text-foreground hover:underline",children:[u," ",u===1?"action":"actions",n.operations_summary?` · ${n.operations_summary.reads} read, ${n.operations_summary.writes} write`:""]})})]}):null,e.jsx("span",{className:"pt-1 text-[10.5px] tracking-wide text-muted-foreground uppercase",children:"Automations"}),e.jsxs("div",{className:"flex flex-col gap-1 pt-0.5",children:[p.map(g=>e.jsx(oe,{link:g,ownerSlug:t},g.automation.automation_id)),p.length===0?e.jsx("span",{className:"text-muted-foreground",children:"No Automation is triggered by or delivers to this connection."}):null]})]}):null]})}function oe({link:n,ownerSlug:s}){const{automation:o,reason:r,eventTypes:t}=n;return e.jsxs(x,{to:"/$owner/automations/$automationId",params:{owner:s,automationId:o.automation_id},search:{view:"definition",run_id:void 0},title:t.length>0?`On ${t.join(", ")}`:void 0,className:"flex min-w-0 items-center gap-1.5 hover:underline",children:[e.jsx(J,{className:"size-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate",children:o.name}),e.jsx("span",{className:"shrink-0 text-muted-foreground",children:ee[r]})]})}function re({feed:n,params:s}){const o=G(n),r=H(n),t=n.display_name?.trim()||n.feed_key;return e.jsxs(x,{to:"/$owner/connectors/$connectorKey/$connectionId",params:s,search:{feedId:n.id},title:o??void 0,className:"inline-flex max-w-full items-center gap-1.5 rounded-full border bg-background px-2 py-0.5 hover:bg-accent",children:[e.jsx(V,{tone:r}),e.jsx("span",{className:"truncate",children:t}),n.last_sync_at?e.jsx("span",{className:"shrink-0 text-muted-foreground",children:X(n.last_sync_at)}):null]})}function me({devices:n,connections:s,...o}){const r=[...n].sort((t,i)=>Number(i.online)-Number(t.online)||N(t).localeCompare(N(i)));return e.jsx("div",{className:ne,children:r.map(t=>{const i=s.filter(c=>c.device_worker_id===t.id);return e.jsx(te,{header:e.jsx(x,{to:"/$owner/connectors/device/$deviceId",params:{owner:o.ownerSlug,deviceId:t.id},className:$,children:e.jsx(k,{mark:e.jsx(Q,{platform:W(t)}),name:N(t),tone:t.update_required.length>0?"amber":null,details:e.jsx(A,{parts:[t.update_required.length>0?"Update needed":null,t.online?"Online":"Offline",t.app_version?`v${t.app_version}`:null,i.length===0?"nothing runs here yet":`${i.length} ${i.length===1?"connection":"connections"}`]}),at:q(t.last_seen_at)})}),children:e.jsx(se,{...o,connections:i,showConnector:!0})},t.id)})})}function ue({ownerSlug:n,catalog:s,trigger:o}){const r=T(),[t,i]=f.useState(!1),c=f.useMemo(()=>new Map(s.map(a=>[a.key,a])),[s]),d=f.useMemo(()=>s.filter(a=>!O(a)).sort((a,l)=>a.name.localeCompare(l.name)),[s]),m=a=>{i(!1),r(a?{to:"/$owner/connectors/create/$connectorKey",params:{owner:n,connectorKey:a}}:{to:"/$owner/connectors/create",params:{owner:n}})};return e.jsxs(D,{open:t,onOpenChange:i,children:[e.jsx(B,{asChild:!0,children:o??e.jsxs(M,{size:"sm",className:"h-8 shrink-0 justify-start text-xs",children:[e.jsx(R,{className:"mr-1.5 h-3.5 w-3.5"}),"Add connector"]})}),e.jsx(P,{align:"end",className:"w-72 p-0",children:e.jsxs(E,{children:[e.jsx(F,{placeholder:"Search connectors…"}),e.jsxs(K,{children:[e.jsx(U,{children:"No connector matches."}),e.jsx(_,{children:d.map(a=>{const l=b(a.key,c,{name:a.name});return e.jsxs(w,{value:`${a.name} ${a.key}`,onSelect:()=>m(a.key),className:"gap-2",children:[e.jsx(C,{icon:l.icon,iconUrl:l.iconUrl,name:l.name,faviconDomain:l.faviconDomain,className:"h-5 w-5 shrink-0 rounded text-[9px]"}),e.jsx("span",{className:"truncate",children:a.name}),a.installed?e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"Added"}):null]},a.key)})}),e.jsx(z,{}),e.jsx(_,{children:e.jsx(w,{value:"browse all connectors",onSelect:()=>m(),children:"Browse all connectors…"})})]})]})})]})}export{ue as A,ne as C,me as D,ce as a,te as b,se as c,ee as d,de as e,le as f};
2
+ //# sourceMappingURL=connector-boxes-BAP_f77M.js.map
@@ -1,2 +1,2 @@
1
- import{j as e,al as l}from"./index-BjcZVe7n.js";function c({header:s,children:a}){return e.jsxs(l,{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"sticky top-0 z-10 space-y-4 bg-background pb-1",children:s}),e.jsx("div",{className:"mt-4 min-w-0 flex-1 space-y-7",children:a})]})}export{c as C};
2
- //# sourceMappingURL=connector-page-shell-Di6XzkVo.js.map
1
+ import{j as e,al as l}from"./index-B-Ab8srM.js";function c({header:s,children:a}){return e.jsxs(l,{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"sticky top-0 z-10 space-y-4 bg-background pb-1",children:s}),e.jsx("div",{className:"mt-4 min-w-0 flex-1 space-y-7",children:a})]})}export{c as C};
2
+ //# sourceMappingURL=connector-page-shell-ClOmVPJr.js.map
@@ -1,2 +1,2 @@
1
- import{j as e,dT as m,dV as u,dU as h,a0 as v,V as x,L as c}from"./index-BjcZVe7n.js";function N({connectorDef:s,connectorKey:t,ownerSlug:n,deviceWorkerId:i,deviceLabel:o}){return s?e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1.5 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{children:"Runs on"}),e.jsx(c,{to:"/$owner/connectors/$connectorKey",params:{owner:n,connectorKey:t},className:"underline underline-offset-2 hover:text-foreground",children:s.name}),e.jsx(f,{deviceWorkerId:i,deviceLabel:o,connectorDef:s,ownerSlug:n})]}):null}function f({connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i}){return e.jsxs(m,{children:[e.jsxs(u,{className:"rounded border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground transition-colors hover:border-muted-foreground hover:text-foreground",children:["v",s.version||"unknown"]}),e.jsx(h,{align:"start",className:"w-80 p-0",children:e.jsx(j,{connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i})})]})}function j({connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i}){const o=s.runtime?.platforms??[],d=s.runtime?.scopes??[],r=s.source_uri?.trim()||null,p=!!r&&(r.startsWith("http://")||r.startsWith("https://")),l=[{label:"Key",value:e.jsx("span",{className:"font-mono",children:s.key})},{label:"Version",value:e.jsx("span",{className:"font-mono",children:s.version?`v${s.version}`:"unknown"})}];return s.catalog_origin&&l.push({label:"Origin",value:s.catalog_origin==="org"?e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:"Built in this workspace"}):e.jsx("span",{children:"Lobu catalog"})}),r&&l.push({label:"Source",value:p?e.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",className:"inline-flex max-w-full items-start gap-1 break-all font-mono text-primary hover:underline",children:[r,e.jsx(v,{className:"mt-0.5 h-3 w-3 shrink-0"})]}):e.jsx("span",{className:"break-all font-mono",children:r})}),o.length>0&&l.push({label:"Platforms",value:e.jsx("span",{className:"flex flex-wrap gap-1",children:o.map(a=>e.jsx(x,{variant:"secondary",className:"h-4 px-1 py-0 font-mono text-[10px]",children:a},a))})}),s.required_capability&&l.push({label:"Capability",value:e.jsx("span",{className:"font-mono",children:s.required_capability})}),d.length>0&&l.push({label:"Scopes",value:e.jsx("span",{className:"flex flex-wrap gap-1",children:d.map(a=>e.jsx(x,{variant:"secondary",className:"h-4 px-1 py-0 font-mono text-[10px]",children:a},a))})}),e.jsxs("div",{className:"text-xs",children:[e.jsx("dl",{className:"divide-y",children:l.map(a=>e.jsxs("div",{className:"flex gap-3 px-3 py-2",children:[e.jsx("dt",{className:"w-20 shrink-0 text-muted-foreground",children:a.label}),e.jsx("dd",{className:"min-w-0 flex-1",children:a.value})]},a.label))}),o.length>0?e.jsx("div",{className:"border-t px-3 py-2 text-muted-foreground",children:n?e.jsxs(e.Fragment,{children:["Runs on"," ",e.jsx(c,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:n},className:"text-primary hover:underline",children:i||"this device"}),"."]}):"Runs on a linked device."}):null]})}export{f as C,N as a};
2
- //# sourceMappingURL=connector-provenance-BrnasBW4.js.map
1
+ import{j as e,dM as m,dO as u,dN as h,a0 as v,V as x,L as c}from"./index-B-Ab8srM.js";function N({connectorDef:s,connectorKey:t,ownerSlug:n,deviceWorkerId:i,deviceLabel:o}){return s?e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1.5 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{children:"Runs on"}),e.jsx(c,{to:"/$owner/connectors/$connectorKey",params:{owner:n,connectorKey:t},className:"underline underline-offset-2 hover:text-foreground",children:s.name}),e.jsx(f,{deviceWorkerId:i,deviceLabel:o,connectorDef:s,ownerSlug:n})]}):null}function f({connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i}){return e.jsxs(m,{children:[e.jsxs(u,{className:"rounded border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground transition-colors hover:border-muted-foreground hover:text-foreground",children:["v",s.version||"unknown"]}),e.jsx(h,{align:"start",className:"w-80 p-0",children:e.jsx(j,{connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i})})]})}function j({connectorDef:s,ownerSlug:t,deviceWorkerId:n,deviceLabel:i}){const o=s.runtime?.platforms??[],d=s.runtime?.scopes??[],r=s.source_uri?.trim()||null,p=!!r&&(r.startsWith("http://")||r.startsWith("https://")),l=[{label:"Key",value:e.jsx("span",{className:"font-mono",children:s.key})},{label:"Version",value:e.jsx("span",{className:"font-mono",children:s.version?`v${s.version}`:"unknown"})}];return s.catalog_origin&&l.push({label:"Origin",value:s.catalog_origin==="org"?e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:"Built in this workspace"}):e.jsx("span",{children:"Lobu catalog"})}),r&&l.push({label:"Source",value:p?e.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",className:"inline-flex max-w-full items-start gap-1 break-all font-mono text-primary hover:underline",children:[r,e.jsx(v,{className:"mt-0.5 h-3 w-3 shrink-0"})]}):e.jsx("span",{className:"break-all font-mono",children:r})}),o.length>0&&l.push({label:"Platforms",value:e.jsx("span",{className:"flex flex-wrap gap-1",children:o.map(a=>e.jsx(x,{variant:"secondary",className:"h-4 px-1 py-0 font-mono text-[10px]",children:a},a))})}),s.required_capability&&l.push({label:"Capability",value:e.jsx("span",{className:"font-mono",children:s.required_capability})}),d.length>0&&l.push({label:"Scopes",value:e.jsx("span",{className:"flex flex-wrap gap-1",children:d.map(a=>e.jsx(x,{variant:"secondary",className:"h-4 px-1 py-0 font-mono text-[10px]",children:a},a))})}),e.jsxs("div",{className:"text-xs",children:[e.jsx("dl",{className:"divide-y",children:l.map(a=>e.jsxs("div",{className:"flex gap-3 px-3 py-2",children:[e.jsx("dt",{className:"w-20 shrink-0 text-muted-foreground",children:a.label}),e.jsx("dd",{className:"min-w-0 flex-1",children:a.value})]},a.label))}),o.length>0?e.jsx("div",{className:"border-t px-3 py-2 text-muted-foreground",children:n?e.jsxs(e.Fragment,{children:["Runs on"," ",e.jsx(c,{to:"/$owner/connectors/device/$deviceId",params:{owner:t,deviceId:n},className:"text-primary hover:underline",children:i||"this device"}),"."]}):"Runs on a linked device."}):null]})}export{f as C,N as a};
2
+ //# sourceMappingURL=connector-provenance-wmYu5jwO.js.map
@@ -1,2 +1,2 @@
1
- import{j as e,ak as s,O as a}from"./index-BjcZVe7n.js";function t(){return e.jsx(s,{className:"gap-3 pt-2.5 pb-8",children:e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:e.jsx(a,{})})})}export{t as component};
2
- //# sourceMappingURL=connectors-DnOUxX_U.js.map
1
+ import{j as e,ak as s,O as a}from"./index-B-Ab8srM.js";function t(){return e.jsx(s,{className:"gap-3 pt-2.5 pb-8",children:e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:e.jsx(a,{})})})}export{t as component};
2
+ //# sourceMappingURL=connectors-D5F5rHxX.js.map
@@ -1,2 +1,2 @@
1
- import{T as $,q as z,r as i,j as t,Q as D,U as F}from"./index-BjcZVe7n.js";import{a as I,u as T,C as G,b as Q,c as B,R as J,W as H,A as K,r as V,o as X}from"./use-login-redirect-ciwfc-7A.js";import{F as Y}from"./full-page-spinner-B5xXnKtV.js";import"./card-g4yxo4Hr.js";const Z=["client_id","redirect_uri","scope","code_challenge","code_challenge_method"];function re(){const e=$.useSearch(),d=e.workspace_grants==="1",{session:g,isReady:k}=z(),m=!k,[r,_]=i.useState(null),[v,l]=i.useState(null);I(!!g,m);const p=i.useMemo(()=>Z.filter(s=>!e[s]||e[s]?.length===0),[e]),a=p.length===0,C=e.client_name?.trim()||null,f=i.useMemo(()=>Array.from(new Set((e.scope||"").split(" ").map(s=>s.trim()).filter(Boolean))),[e.scope]),{accessLevel:w,setAccessLevel:O,selectedScopes:A,resourceOrg:S,hasMcpScopes:E,requiresWorkspaceAccess:n,orgList:h,workspaceAccess:L,setWorkspaceAccess:M,selectedOrgIds:o,toggleSelectedOrgId:P,orgsLoading:q,orgsError:b,retryOrgs:N,workspaceSelectionReady:y}=T({requestedScopes:f,resource:e.resource,allowMultiple:d}),u=i.useMemo(()=>h.filter(s=>o.includes(s.id)).map(s=>s.name),[h,o]),U=n?u.length===0?"Nothing will be granted access.":`${u.length<=2?u.join(", "):`${u.length} workspaces`} will be granted access.`:null,W=n&&d&&o.length>0?`Approve ${o.length} ${o.length===1?"workspace":"workspaces"}`:"Approve",R=async s=>{if(!a){l(`Missing required query params: ${p.join(", ")}`);return}if(s&&n&&!y){l(b?"Workspaces could not be loaded. Retry before approving.":"Choose at least one workspace before approving.");return}_(s?"approve":"deny"),l(null);try{const c=await fetch(`${D}/oauth/authorize/consent`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({client_id:e.client_id,redirect_uri:e.redirect_uri,scope:s?A.join(" "):e.scope,state:e.state??"",code_challenge:e.code_challenge,code_challenge_method:e.code_challenge_method,client_name:e.client_name,resource:e.resource,authorization_intent:e.authorization_intent,approved:s,...s&&n?{workspace_access:L,organization_ids:o}:{}})}),x=await c.json().catch(()=>null);if(c.status===401){V();return}if(!c.ok)throw new Error(X(x,`Failed to ${s?"approve":"deny"} OAuth consent`));const j=F(x?.redirect_url);if(!j)throw new Error("Consent response did not include a valid redirect URL");window.location.href=j}catch(c){_(null),l(c instanceof Error?c.message:"Unexpected error while submitting consent")}};return m||!g?t.jsx(Y,{className:"min-h-[calc(100vh-3.5rem)]"}):t.jsx(G,{title:"Authorize application",busy:r!==null,error:v,review:t.jsx(K,{idPrefix:"oauth-consent",clientName:C,requestedScopes:f,accessLevel:w,onAccessLevelChange:O,disabled:r!==null,resource:e.resource,logoUri:e.logo_uri,clientUri:e.client_uri}),aside:n?t.jsx(H,{idPrefix:"oauth-consent",allowMultiple:d,orgList:h,selectedOrgIds:o,onWorkspaceAccessChange:M,onSelectedOrgChange:P,orgsLoading:q,orgsError:b,onRetry:N,disabled:r!==null||!a}):void 0,below:E&&S?t.jsx(J,{resourceOrg:S,accessLevel:w}):null,notice:a?null:t.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Missing required query params: ",p.join(", ")]}),footer:t.jsx(Q,{summary:U,children:t.jsx(B,{busy:r,approveLabel:W,approveDisabled:r!==null||!a||A.length===0||n&&!y,denyDisabled:r!==null||!a,onApprove:()=>R(!0),onDeny:()=>R(!1)})})})}export{re as component};
2
- //# sourceMappingURL=consent-Byli4yMs.js.map
1
+ import{T as $,q as z,r as i,j as t,Q as D,U as F}from"./index-B-Ab8srM.js";import{a as I,u as T,C as G,b as Q,c as B,R as J,W as H,A as K,r as V,o as X}from"./use-login-redirect-BqtEilid.js";import{F as Y}from"./full-page-spinner-CCU4PkRv.js";import"./card-DT9mSjSp.js";const Z=["client_id","redirect_uri","scope","code_challenge","code_challenge_method"];function re(){const e=$.useSearch(),d=e.workspace_grants==="1",{session:g,isReady:k}=z(),m=!k,[r,_]=i.useState(null),[v,l]=i.useState(null);I(!!g,m);const p=i.useMemo(()=>Z.filter(s=>!e[s]||e[s]?.length===0),[e]),a=p.length===0,C=e.client_name?.trim()||null,f=i.useMemo(()=>Array.from(new Set((e.scope||"").split(" ").map(s=>s.trim()).filter(Boolean))),[e.scope]),{accessLevel:w,setAccessLevel:O,selectedScopes:A,resourceOrg:S,hasMcpScopes:E,requiresWorkspaceAccess:n,orgList:h,workspaceAccess:L,setWorkspaceAccess:M,selectedOrgIds:o,toggleSelectedOrgId:P,orgsLoading:q,orgsError:b,retryOrgs:N,workspaceSelectionReady:y}=T({requestedScopes:f,resource:e.resource,allowMultiple:d}),u=i.useMemo(()=>h.filter(s=>o.includes(s.id)).map(s=>s.name),[h,o]),U=n?u.length===0?"Nothing will be granted access.":`${u.length<=2?u.join(", "):`${u.length} workspaces`} will be granted access.`:null,W=n&&d&&o.length>0?`Approve ${o.length} ${o.length===1?"workspace":"workspaces"}`:"Approve",R=async s=>{if(!a){l(`Missing required query params: ${p.join(", ")}`);return}if(s&&n&&!y){l(b?"Workspaces could not be loaded. Retry before approving.":"Choose at least one workspace before approving.");return}_(s?"approve":"deny"),l(null);try{const c=await fetch(`${D}/oauth/authorize/consent`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({client_id:e.client_id,redirect_uri:e.redirect_uri,scope:s?A.join(" "):e.scope,state:e.state??"",code_challenge:e.code_challenge,code_challenge_method:e.code_challenge_method,client_name:e.client_name,resource:e.resource,authorization_intent:e.authorization_intent,approved:s,...s&&n?{workspace_access:L,organization_ids:o}:{}})}),x=await c.json().catch(()=>null);if(c.status===401){V();return}if(!c.ok)throw new Error(X(x,`Failed to ${s?"approve":"deny"} OAuth consent`));const j=F(x?.redirect_url);if(!j)throw new Error("Consent response did not include a valid redirect URL");window.location.href=j}catch(c){_(null),l(c instanceof Error?c.message:"Unexpected error while submitting consent")}};return m||!g?t.jsx(Y,{className:"min-h-[calc(100vh-3.5rem)]"}):t.jsx(G,{title:"Authorize application",busy:r!==null,error:v,review:t.jsx(K,{idPrefix:"oauth-consent",clientName:C,requestedScopes:f,accessLevel:w,onAccessLevelChange:O,disabled:r!==null,resource:e.resource,logoUri:e.logo_uri,clientUri:e.client_uri}),aside:n?t.jsx(H,{idPrefix:"oauth-consent",allowMultiple:d,orgList:h,selectedOrgIds:o,onWorkspaceAccessChange:M,onSelectedOrgChange:P,orgsLoading:q,orgsError:b,onRetry:N,disabled:r!==null||!a}):void 0,below:E&&S?t.jsx(J,{resourceOrg:S,accessLevel:w}):null,notice:a?null:t.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Missing required query params: ",p.join(", ")]}),footer:t.jsx(Q,{summary:U,children:t.jsx(B,{busy:r,approveLabel:W,approveDisabled:r!==null||!a||A.length===0||n&&!y,denyDisabled:r!==null||!a,onApprove:()=>R(!0),onDeny:()=>R(!1)})})})}export{re as component};
2
+ //# sourceMappingURL=consent-RqHNkmm8.js.map
@@ -1,2 +1,2 @@
1
- import{r as s,j as a,B as p,Y as n,fg as l,bt as i}from"./index-BjcZVe7n.js";function m({text:u,label:o,iconOnly:t=!1}){const[r,c]=s.useState(!1),e=s.useRef(void 0);return s.useEffect(()=>()=>clearTimeout(e.current),[]),a.jsxs(p,{type:"button",variant:t?"ghost":"outline",size:t?"icon":"sm",className:t?"h-6 w-6 shrink-0":"h-8 text-xs","aria-label":t?`Copy ${o}`:void 0,onClick:async()=>{try{await navigator.clipboard.writeText(u),c(!0),i.success("Copied to clipboard"),clearTimeout(e.current),e.current=setTimeout(()=>c(!1),1500)}catch{i.error("Could not copy. Please select and copy the text.")}},children:[r?a.jsx(n,{className:"h-3.5 w-3.5"}):a.jsx(l,{className:"h-3.5 w-3.5"}),!t&&(r?"Copied":o)]})}export{m as C};
2
- //# sourceMappingURL=copy-button-Ddf7lBjZ.js.map
1
+ import{r as s,j as a,B as p,Y as n,f5 as l,bB as i}from"./index-B-Ab8srM.js";function m({text:u,label:o,iconOnly:t=!1}){const[r,c]=s.useState(!1),e=s.useRef(void 0);return s.useEffect(()=>()=>clearTimeout(e.current),[]),a.jsxs(p,{type:"button",variant:t?"ghost":"outline",size:t?"icon":"sm",className:t?"h-6 w-6 shrink-0":"h-8 text-xs","aria-label":t?`Copy ${o}`:void 0,onClick:async()=>{try{await navigator.clipboard.writeText(u),c(!0),i.success("Copied to clipboard"),clearTimeout(e.current),e.current=setTimeout(()=>c(!1),1500)}catch{i.error("Could not copy. Please select and copy the text.")}},children:[r?a.jsx(n,{className:"h-3.5 w-3.5"}):a.jsx(l,{className:"h-3.5 w-3.5"}),!t&&(r?"Copied":o)]})}export{m as C};
2
+ //# sourceMappingURL=copy-button-D6zpsZLi.js.map
@@ -1,6 +1,6 @@
1
- import{r as s,bB as X,by as me}from"./index-BjcZVe7n.js";function Lr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Fe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ge(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function nt(e){return"nodeType"in e}function k(e){var t,n;return e?ge(e)?e:nt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function rt(e){const{Document:t}=k(e);return e instanceof t}function Ee(e){return ge(e)?!1:e instanceof k(e).HTMLElement}function $t(e){return e instanceof k(e).SVGElement}function ve(e){return e?ge(e)?e.document:nt(e)?rt(e)?e:Ee(e)||$t(e)?e.ownerDocument:document:document:document}const re=Fe?s.useLayoutEffect:s.useEffect;function ot(e){const t=s.useRef(e);return re(()=>{t.current=e}),s.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function gn(){const e=s.useRef(null),t=s.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=s.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Se(e,t){t===void 0&&(t=[e]);const n=s.useRef(e);return re(()=>{n.current!==e&&(n.current=e)},t),n}function Me(e,t){const n=s.useRef();return s.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function ke(e){const t=ot(e),n=s.useRef(null),r=s.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Qe(e){const t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}let Ve={};function $e(e,t){return s.useMemo(()=>{if(t)return t;const n=Ve[e]==null?0:Ve[e]+1;return Ve[e]=n,e+"-"+n},[e,t])}function Xt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,l)=>{const a=Object.entries(l);for(const[c,u]of a){const f=i[c];f!=null&&(i[c]=f+e*u)}return i},{...t})}}const he=Xt(1),ze=Xt(-1);function vn(e){return"clientX"in e&&"clientY"in e}function jt(e){if(!e)return!1;const{KeyboardEvent:t}=k(e.target);return t&&e instanceof t}function pn(e){if(!e)return!1;const{TouchEvent:t}=k(e.target);return t&&e instanceof t}function Ze(e){if(pn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return vn(e)?{x:e.clientX,y:e.clientY}:null}const Rt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Rt.Translate.toString(e),Rt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Et="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function bn(e){return e.matches(Et)?e:e.querySelector(Et)}const wn={display:"none"};function yn(e){let{id:t,value:n}=e;return X.createElement("div",{id:t,style:wn},n)}function mn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return X.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function xn(){const[e,t]=s.useState("");return{announce:s.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Ut=s.createContext(null);function Dn(e){const t=s.useContext(Ut);s.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Cn(){const[e]=s.useState(()=>new Set),t=s.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[s.useCallback(r=>{let{type:o,event:i}=r;e.forEach(l=>{var a;return(a=l[o])==null?void 0:a.call(l,i)})},[e]),t]}const Sn={draggable:`
1
+ import{r as s,bJ as X,bG as me}from"./index-B-Ab8srM.js";function Lr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Fe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ge(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function nt(e){return"nodeType"in e}function k(e){var t,n;return e?ge(e)?e:nt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function rt(e){const{Document:t}=k(e);return e instanceof t}function Ee(e){return ge(e)?!1:e instanceof k(e).HTMLElement}function $t(e){return e instanceof k(e).SVGElement}function ve(e){return e?ge(e)?e.document:nt(e)?rt(e)?e:Ee(e)||$t(e)?e.ownerDocument:document:document:document}const re=Fe?s.useLayoutEffect:s.useEffect;function ot(e){const t=s.useRef(e);return re(()=>{t.current=e}),s.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function gn(){const e=s.useRef(null),t=s.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=s.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Se(e,t){t===void 0&&(t=[e]);const n=s.useRef(e);return re(()=>{n.current!==e&&(n.current=e)},t),n}function Me(e,t){const n=s.useRef();return s.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function ke(e){const t=ot(e),n=s.useRef(null),r=s.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Qe(e){const t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}let Ve={};function $e(e,t){return s.useMemo(()=>{if(t)return t;const n=Ve[e]==null?0:Ve[e]+1;return Ve[e]=n,e+"-"+n},[e,t])}function Xt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,l)=>{const a=Object.entries(l);for(const[c,u]of a){const f=i[c];f!=null&&(i[c]=f+e*u)}return i},{...t})}}const he=Xt(1),ze=Xt(-1);function vn(e){return"clientX"in e&&"clientY"in e}function jt(e){if(!e)return!1;const{KeyboardEvent:t}=k(e.target);return t&&e instanceof t}function pn(e){if(!e)return!1;const{TouchEvent:t}=k(e.target);return t&&e instanceof t}function Ze(e){if(pn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return vn(e)?{x:e.clientX,y:e.clientY}:null}const Rt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Rt.Translate.toString(e),Rt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Et="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function bn(e){return e.matches(Et)?e:e.querySelector(Et)}const wn={display:"none"};function yn(e){let{id:t,value:n}=e;return X.createElement("div",{id:t,style:wn},n)}function mn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return X.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function xn(){const[e,t]=s.useState("");return{announce:s.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Ut=s.createContext(null);function Dn(e){const t=s.useContext(Ut);s.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Cn(){const[e]=s.useState(()=>new Set),t=s.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[s.useCallback(r=>{let{type:o,event:i}=r;e.forEach(l=>{var a;return(a=l[o])==null?void 0:a.call(l,i)})},[e]),t]}const Sn={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.
5
- `},Rn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function En(e){let{announcements:t=Rn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Sn}=e;const{announce:i,announcement:l}=xn(),a=$e("DndLiveRegion"),[c,u]=s.useState(!1);if(s.useEffect(()=>{u(!0)},[]),Dn(s.useMemo(()=>({onDragStart(d){let{active:v}=d;i(t.onDragStart({active:v}))},onDragMove(d){let{active:v,over:h}=d;t.onDragMove&&i(t.onDragMove({active:v,over:h}))},onDragOver(d){let{active:v,over:h}=d;i(t.onDragOver({active:v,over:h}))},onDragEnd(d){let{active:v,over:h}=d;i(t.onDragEnd({active:v,over:h}))},onDragCancel(d){let{active:v,over:h}=d;i(t.onDragCancel({active:v,over:h}))}}),[i,t])),!c)return null;const f=X.createElement(X.Fragment,null,X.createElement(yn,{id:r,value:o.draggable}),X.createElement(mn,{id:a,announcement:l}));return n?me.createPortal(f,n):f}var E;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(E||(E={}));function Be(){}function Ir(e,t){return s.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function kr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const W=Object.freeze({x:0,y:0});function Wt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Yt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Mn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Mt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function An(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function At(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const zr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=At(t,t.left,t.top),i=[];for(const l of r){const{id:a}=l,c=n.get(a);if(c){const u=Wt(At(c),o);i.push({id:a,data:{droppableContainer:l,value:u}})}}return i.sort(Yt)},Br=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Mt(t),i=[];for(const l of r){const{id:a}=l,c=n.get(a);if(c){const u=Mt(c),f=o.reduce((v,h,C)=>v+Wt(u[C],h),0),d=Number((f/4).toFixed(4));i.push({id:a,data:{droppableContainer:l,value:d}})}}return i.sort(Yt)};function On(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),l=o-r,a=i-n;if(r<o&&n<i){const c=t.width*t.height,u=e.width*e.height,f=l*a,d=f/(c+u-f);return Number(d.toFixed(4))}return 0}const Tn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:l}=i,a=n.get(l);if(a){const c=On(a,t);c>0&&o.push({id:l,data:{droppableContainer:i,value:c}})}}return o.sort(Mn)};function Nn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Kt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:W}function Ln(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((l,a)=>({...l,top:l.top+e*a.y,bottom:l.bottom+e*a.y,left:l.left+e*a.x,right:l.right+e*a.x}),{...n})}}const In=Ln(1);function kn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function zn(e,t,n){const r=kn(t);if(!r)return e;const{scaleX:o,scaleY:i,x:l,y:a}=r,c=e.left-l-(1-o)*parseFloat(n),u=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:f,height:d,top:u,right:c+f,bottom:u+d,left:c}}const Bn={ignoreTransform:!1};function Ae(e,t){t===void 0&&(t=Bn);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=k(e).getComputedStyle(e);u&&(n=zn(n,u,f))}const{top:r,left:o,width:i,height:l,bottom:a,right:c}=n;return{top:r,left:o,width:i,height:l,bottom:a,right:c}}function Ot(e){return Ae(e,{ignoreTransform:!0})}function Pn(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Fn(e,t){return t===void 0&&(t=k(e).getComputedStyle(e)),t.position==="fixed"}function $n(e,t){t===void 0&&(t=k(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function it(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(rt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ee(o)||$t(o)||n.includes(o))return n;const i=k(e).getComputedStyle(o);return o!==e&&$n(o,i)&&n.push(o),Fn(o,i)?n:r(o.parentNode)}return e?r(e):n}function Ht(e){const[t]=it(e,1);return t??null}function qe(e){return!Fe||!e?null:ge(e)?e:nt(e)?rt(e)||e===ve(e).scrollingElement?window:Ee(e)?e:null:null}function Vt(e){return ge(e)?e.scrollX:e.scrollLeft}function qt(e){return ge(e)?e.scrollY:e.scrollTop}function _e(e){return{x:Vt(e),y:qt(e)}}var O;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(O||(O={}));function Jt(e){return!Fe||!e?!1:e===document.scrollingElement}function Gt(e){const t={x:0,y:0},n=Jt(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,l=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:l,isRight:a,maxScroll:r,minScroll:t}}const Xn={x:.2,y:.2};function jn(e,t,n,r,o){let{top:i,left:l,right:a,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=Xn);const{isTop:u,isBottom:f,isLeft:d,isRight:v}=Gt(e),h={x:0,y:0},C={x:0,y:0},g={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+g.height?(h.y=O.Backward,C.y=r*Math.abs((t.top+g.height-i)/g.height)):!f&&c>=t.bottom-g.height&&(h.y=O.Forward,C.y=r*Math.abs((t.bottom-g.height-c)/g.height)),!v&&a>=t.right-g.width?(h.x=O.Forward,C.x=r*Math.abs((t.right-g.width-a)/g.width)):!d&&l<=t.left+g.width&&(h.x=O.Backward,C.x=r*Math.abs((t.left+g.width-l)/g.width)),{direction:h,speed:C}}function Un(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:l}=window;return{top:0,left:0,right:i,bottom:l,width:i,height:l}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Qt(e){return e.reduce((t,n)=>he(t,_e(n)),W)}function Wn(e){return e.reduce((t,n)=>t+Vt(n),0)}function Yn(e){return e.reduce((t,n)=>t+qt(n),0)}function Kn(e,t){if(t===void 0&&(t=Ae),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Ht(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Hn=[["x",["left","right"],Wn],["y",["top","bottom"],Yn]];class st{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=it(n),o=Qt(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,l,a]of Hn)for(const c of l)Object.defineProperty(this,c,{get:()=>{const u=a(r),f=o[i]-u;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class xe{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Vn(e){const{EventTarget:t}=k(e);return e instanceof t?e:ve(e)}function Je(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var $;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})($||($={}));function Tt(e){e.preventDefault()}function qn(e){e.stopPropagation()}var x;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(x||(x={}));const Zt={start:[x.Space,x.Enter],cancel:[x.Esc],end:[x.Space,x.Enter,x.Tab]},Jn=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case x.Right:return{...n,x:n.x+25};case x.Left:return{...n,x:n.x-25};case x.Down:return{...n,y:n.y+25};case x.Up:return{...n,y:n.y-25}}};class _t{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new xe(ve(n)),this.windowListeners=new xe(k(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add($.Resize,this.handleCancel),this.windowListeners.add($.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add($.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Kn(r),n(W)}handleKeyDown(t){if(jt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=Zt,coordinateGetter:l=Jn,scrollBehavior:a="smooth"}=o,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,f=u?{x:u.left,y:u.top}:W;this.referenceCoordinates||(this.referenceCoordinates=f);const d=l(t,{active:n,context:r.current,currentCoordinates:f});if(d){const v=ze(d,f),h={x:0,y:0},{scrollableAncestors:C}=r.current;for(const g of C){const p=t.code,{isTop:m,isRight:D,isLeft:y,isBottom:N,maxScroll:S,minScroll:R}=Gt(g),w=Un(g),b={x:Math.min(p===x.Right?w.right-w.width/2:w.right,Math.max(p===x.Right?w.left:w.left+w.width/2,d.x)),y:Math.min(p===x.Down?w.bottom-w.height/2:w.bottom,Math.max(p===x.Down?w.top:w.top+w.height/2,d.y))},M=p===x.Right&&!D||p===x.Left&&!y,I=p===x.Down&&!N||p===x.Up&&!m;if(M&&b.x!==d.x){const A=g.scrollLeft+v.x,H=p===x.Right&&A<=S.x||p===x.Left&&A>=R.x;if(H&&!v.y){g.scrollTo({left:A,behavior:a});return}H?h.x=g.scrollLeft-A:h.x=p===x.Right?g.scrollLeft-S.x:g.scrollLeft-R.x,h.x&&g.scrollBy({left:-h.x,behavior:a});break}else if(I&&b.y!==d.y){const A=g.scrollTop+v.y,H=p===x.Down&&A<=S.y||p===x.Up&&A>=R.y;if(H&&!v.x){g.scrollTo({top:A,behavior:a});return}H?h.y=g.scrollTop-A:h.y=p===x.Down?g.scrollTop-S.y:g.scrollTop-R.y,h.y&&g.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,he(ze(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}_t.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Zt,onActivation:o}=t,{active:i}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Nt(e){return!!(e&&"distance"in e)}function Lt(e){return!!(e&&"delay"in e)}class at{constructor(t,n,r){var o;r===void 0&&(r=Vn(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:l}=i;this.props=t,this.events=n,this.document=ve(l),this.documentListeners=new xe(this.document),this.listeners=new xe(r),this.windowListeners=new xe(k(l)),this.initialCoordinates=(o=Ze(i))!=null?o:W,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add($.Resize,this.handleCancel),this.windowListeners.add($.DragStart,Tt),this.windowListeners.add($.VisibilityChange,this.handleCancel),this.windowListeners.add($.ContextMenu,Tt),this.documentListeners.add($.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Lt(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Nt(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add($.Click,qn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add($.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:l,options:{activationConstraint:a}}=i;if(!o)return;const c=(n=Ze(t))!=null?n:W,u=ze(o,c);if(!r&&a){if(Nt(a)){if(a.tolerance!=null&&Je(u,a.tolerance))return this.handleCancel();if(Je(u,a.distance))return this.handleStart()}if(Lt(a)&&Je(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);return}t.cancelable&&t.preventDefault(),l(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===x.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Gn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class en extends at{constructor(t){const{event:n}=t,r=ve(n.target);super(t,Gn,r)}}en.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Qn={move:{name:"mousemove"},end:{name:"mouseup"}};var et;(function(e){e[e.RightClick=2]="RightClick"})(et||(et={}));class Zn extends at{constructor(t){super(t,Qn,ve(t.event.target))}}Zn.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===et.RightClick?!1:(r?.({event:n}),!0)}}];const Ge={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class _n extends at{constructor(t){super(t,Ge)}static setup(){return window.addEventListener(Ge.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ge.move.name,t)};function t(){}}}_n.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var De;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(De||(De={}));var Pe;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Pe||(Pe={}));function er(e){let{acceleration:t,activator:n=De.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:l=5,order:a=Pe.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:v}=e;const h=nr({delta:d,disabled:!i}),[C,g]=gn(),p=s.useRef({x:0,y:0}),m=s.useRef({x:0,y:0}),D=s.useMemo(()=>{switch(n){case De.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case De.DraggableRect:return o}},[n,o,c]),y=s.useRef(null),N=s.useCallback(()=>{const R=y.current;if(!R)return;const w=p.current.x*m.current.x,b=p.current.y*m.current.y;R.scrollBy(w,b)},[]),S=s.useMemo(()=>a===Pe.TreeOrder?[...u].reverse():u,[a,u]);s.useEffect(()=>{if(!i||!u.length||!D){g();return}for(const R of S){if(r?.(R)===!1)continue;const w=u.indexOf(R),b=f[w];if(!b)continue;const{direction:M,speed:I}=jn(R,b,D,t,v);for(const A of["x","y"])h[A][M[A]]||(I[A]=0,M[A]=0);if(I.x>0||I.y>0){g(),y.current=R,C(N,l),p.current=I,m.current=M;return}}p.current={x:0,y:0},m.current={x:0,y:0},g()},[t,N,r,g,i,l,JSON.stringify(D),JSON.stringify(h),C,u,S,f,JSON.stringify(v)])}const tr={x:{[O.Backward]:!1,[O.Forward]:!1},y:{[O.Backward]:!1,[O.Forward]:!1}};function nr(e){let{delta:t,disabled:n}=e;const r=Qe(t);return Me(o=>{if(n||!r||!o)return tr;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[O.Backward]:o.x[O.Backward]||i.x===-1,[O.Forward]:o.x[O.Forward]||i.x===1},y:{[O.Backward]:o.y[O.Backward]||i.y===-1,[O.Forward]:o.y[O.Forward]||i.y===1}}},[n,t,r])}function rr(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Me(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function or(e,t){return s.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,r)}));return[...n,...i]},[]),[e,t])}var Re;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Re||(Re={}));var tt;(function(e){e.Optimized="optimized"})(tt||(tt={}));const It=new Map;function ir(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,l]=s.useState(null),{frequency:a,measure:c,strategy:u}=o,f=s.useRef(e),d=p(),v=Se(d),h=s.useCallback(function(m){m===void 0&&(m=[]),!v.current&&l(D=>D===null?m:D.concat(m.filter(y=>!D.includes(y))))},[v]),C=s.useRef(null),g=Me(m=>{if(d&&!n)return It;if(!m||m===It||f.current!==e||i!=null){const D=new Map;for(let y of e){if(!y)continue;if(i&&i.length>0&&!i.includes(y.id)&&y.rect.current){D.set(y.id,y.rect.current);continue}const N=y.node.current,S=N?new st(c(N),N):null;y.rect.current=S,S&&D.set(y.id,S)}return D}return m},[e,i,n,d,c]);return s.useEffect(()=>{f.current=e},[e]),s.useEffect(()=>{d||h()},[n,d]),s.useEffect(()=>{i&&i.length>0&&l(null)},[JSON.stringify(i)]),s.useEffect(()=>{d||typeof a!="number"||C.current!==null||(C.current=setTimeout(()=>{h(),C.current=null},a))},[a,d,h,...r]),{droppableRects:g,measureDroppableContainers:h,measuringScheduled:i!=null};function p(){switch(u){case Re.Always:return!1;case Re.BeforeDragging:return n;default:return!n}}}function tn(e,t){return Me(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function sr(e,t){return tn(e,t)}function ar(e){let{callback:t,disabled:n}=e;const r=ot(t),o=s.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function Xe(e){let{callback:t,disabled:n}=e;const r=ot(t),o=s.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function lr(e){return new st(Ae(e),e)}function kt(e,t,n){t===void 0&&(t=lr);const[r,o]=s.useState(null);function i(){o(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const f=t(e);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const l=ar({callback(c){if(e)for(const u of c){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=Xe({callback:i});return re(()=>{i(),e?(a?.observe(e),l?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),l?.disconnect())},[e]),r}function cr(e){const t=tn(e);return Kt(e,t)}const zt=[];function ur(e){const t=s.useRef(e),n=Me(r=>e?r&&r!==zt&&e&&t.current&&e.parentNode===t.current.parentNode?r:it(e):zt,[e]);return s.useEffect(()=>{t.current=e},[e]),n}function dr(e){const[t,n]=s.useState(null),r=s.useRef(e),o=s.useCallback(i=>{const l=qe(i.target);l&&n(a=>a?(a.set(l,_e(l)),new Map(a)):null)},[]);return s.useEffect(()=>{const i=r.current;if(e!==i){l(i);const a=e.map(c=>{const u=qe(c);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,_e(u)]):null}).filter(c=>c!=null);n(a.length?new Map(a):null),r.current=e}return()=>{l(e),l(i)};function l(a){a.forEach(c=>{const u=qe(c);u?.removeEventListener("scroll",o)})}},[o,e]),s.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,l)=>he(i,l),W):Qt(e):W,[e,t])}function Bt(e,t){t===void 0&&(t=[]);const n=s.useRef(null);return s.useEffect(()=>{n.current=null},t),s.useEffect(()=>{const r=e!==W;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ze(e,n.current):W}function fr(e){s.useEffect(()=>{if(!Fe)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function hr(e,t){return s.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=l=>{i(l,t)},n},{}),[e,t])}function nn(e){return s.useMemo(()=>e?Pn(e):null,[e])}const Pt=[];function gr(e,t){t===void 0&&(t=Ae);const[n]=e,r=nn(n?k(n):null),[o,i]=s.useState(Pt);function l(){i(()=>e.length?e.map(c=>Jt(c)?r:new st(t(c),c)):Pt)}const a=Xe({callback:l});return re(()=>{a?.disconnect(),l(),e.forEach(c=>a?.observe(c))},[e]),o}function vr(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ee(t)?t:e}function pr(e){let{measure:t}=e;const[n,r]=s.useState(null),o=s.useCallback(u=>{for(const{target:f}of u)if(Ee(f)){r(d=>{const v=t(f);return d?{...d,width:v.width,height:v.height}:v});break}},[t]),i=Xe({callback:o}),l=s.useCallback(u=>{const f=vr(u);i?.disconnect(),f&&i?.observe(f),r(f?t(f):null)},[t,i]),[a,c]=ke(l);return s.useMemo(()=>({nodeRef:a,rect:n,setRef:c}),[n,a,c])}const br=[{sensor:en,options:{}},{sensor:_t,options:{}}],wr={current:{}},Ie={draggable:{measure:Ot},droppable:{measure:Ot,strategy:Re.WhileDragging,frequency:tt.Optimized},dragOverlay:{measure:Ae}};class Ce extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const yr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ce,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Be},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ie,measureDroppableContainers:Be,windowRect:null,measuringScheduled:!1},mr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Be,draggableNodes:new Map,over:null,measureDroppableContainers:Be},je=s.createContext(mr),rn=s.createContext(yr);function xr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ce}}}function Dr(e,t){switch(t.type){case E.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case E.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case E.DragEnd:case E.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case E.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ce(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case E.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const l=new Ce(e.droppable.containers);return l.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:l}}}case E.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ce(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Cr(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=s.useContext(je),i=Qe(r),l=Qe(n?.id);return s.useEffect(()=>{if(!t&&!r&&i&&l!=null){if(!jt(i)||document.activeElement===i.target)return;const a=o.get(l);if(!a)return;const{activatorNode:c,node:u}=a;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[c.current,u.current]){if(!f)continue;const d=bn(f);if(d){d.focus();break}}})}},[r,t,o,l,i]),null}function Sr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function Rr(e){return s.useMemo(()=>({draggable:{...Ie.draggable,...e?.draggable},droppable:{...Ie.droppable,...e?.droppable},dragOverlay:{...Ie.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Er(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=s.useRef(!1),{x:l,y:a}=typeof o=="boolean"?{x:o,y:o}:o;re(()=>{if(!l&&!a||!t){i.current=!1;return}if(i.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),d=Kt(f,r);if(l||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const v=Ht(u);v&&v.scrollBy({top:d.y,left:d.x})}},[t,l,a,r,n])}const on=s.createContext({...W,scaleX:1,scaleY:1});var ne;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ne||(ne={}));const Pr=s.memo(function(t){var n,r,o,i;let{id:l,accessibility:a,autoScroll:c=!0,children:u,sensors:f=br,collisionDetection:d=Tn,measuring:v,modifiers:h,...C}=t;const g=s.useReducer(Dr,void 0,xr),[p,m]=g,[D,y]=Cn(),[N,S]=s.useState(ne.Uninitialized),R=N===ne.Initialized,{draggable:{active:w,nodes:b,translate:M},droppable:{containers:I}}=p,A=w!=null?b.get(w):null,H=s.useRef({initial:null,translated:null}),V=s.useMemo(()=>{var L;return w!=null?{id:w,data:(L=A?.data)!=null?L:wr,rect:H}:null},[w,A]),G=s.useRef(null),[lt,ct]=s.useState(null),[q,ut]=s.useState(null),oe=Se(C,Object.values(C)),Ue=$e("DndDescribedBy",l),dt=s.useMemo(()=>I.getEnabled(),[I]),ie=Rr(v),{droppableRects:le,measureDroppableContainers:Oe,measuringScheduled:ft}=ir(dt,{dragging:R,dependencies:[M.x,M.y],config:ie.droppable}),j=rr(b,w),ht=s.useMemo(()=>q?Ze(q):null,[q]),gt=hn(),vt=sr(j,ie.draggable.measure);Er({activeNode:w!=null?b.get(w):null,config:gt.layoutShiftCompensation,initialRect:vt,measure:ie.draggable.measure});const U=kt(j,ie.draggable.measure,vt),We=kt(j?j.parentElement:null),se=s.useRef({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:le,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pt=I.getNodeFor((n=se.current.over)==null?void 0:n.id),ae=pr({measure:ie.dragOverlay.measure}),Te=(r=ae.nodeRef.current)!=null?r:j,ce=R?(o=ae.rect)!=null?o:U:null,bt=!!(ae.nodeRef.current&&ae.rect),wt=cr(bt?null:U),Ye=nn(Te?k(Te):null),Q=ur(R?pt??j:null),Ne=gr(Q),Le=Sr(h,{transform:{x:M.x-wt.x,y:M.y-wt.y,scaleX:1,scaleY:1},activatorEvent:q,active:V,activeNodeRect:U,containerNodeRect:We,draggingNodeRect:ce,over:se.current.over,overlayNodeRect:ae.rect,scrollableAncestors:Q,scrollableAncestorRects:Ne,windowRect:Ye}),yt=ht?he(ht,M):null,mt=dr(Q),sn=Bt(mt),an=Bt(mt,[U]),ue=he(Le,sn),de=ce?In(ce,Le):null,pe=V&&de?d({active:V,collisionRect:de,droppableRects:le,droppableContainers:dt,pointerCoordinates:yt}):null,xt=An(pe,"id"),[Z,Dt]=s.useState(null),ln=bt?Le:he(Le,an),cn=Nn(ln,(i=Z?.rect)!=null?i:null,U),Ke=s.useRef(null),Ct=s.useCallback((L,z)=>{let{sensor:B,options:_}=z;if(G.current==null)return;const F=b.get(G.current);if(!F)return;const P=L.nativeEvent,Y=new B({active:G.current,activeNode:F,event:P,options:_,context:se,onAbort(T){if(!b.get(T))return;const{onDragAbort:K}=oe.current,J={id:T};K?.(J),D({type:"onDragAbort",event:J})},onPending(T,ee,K,J){if(!b.get(T))return;const{onDragPending:we}=oe.current,te={id:T,constraint:ee,initialCoordinates:K,offset:J};we?.(te),D({type:"onDragPending",event:te})},onStart(T){const ee=G.current;if(ee==null)return;const K=b.get(ee);if(!K)return;const{onDragStart:J}=oe.current,be={activatorEvent:P,active:{id:ee,data:K.data,rect:H}};me.unstable_batchedUpdates(()=>{J?.(be),S(ne.Initializing),m({type:E.DragStart,initialCoordinates:T,active:ee}),D({type:"onDragStart",event:be}),ct(Ke.current),ut(P)})},onMove(T){m({type:E.DragMove,coordinates:T})},onEnd:fe(E.DragEnd),onCancel:fe(E.DragCancel)});Ke.current=Y;function fe(T){return async function(){const{active:K,collisions:J,over:be,scrollAdjustedTranslate:we}=se.current;let te=null;if(K&&we){const{cancelDrop:ye}=oe.current;te={activatorEvent:P,active:K,collisions:J,delta:we,over:be},T===E.DragEnd&&typeof ye=="function"&&await Promise.resolve(ye(te))&&(T=E.DragCancel)}G.current=null,me.unstable_batchedUpdates(()=>{m({type:T}),S(ne.Uninitialized),Dt(null),ct(null),ut(null),Ke.current=null;const ye=T===E.DragEnd?"onDragEnd":"onDragCancel";if(te){const He=oe.current[ye];He?.(te),D({type:ye,event:te})}})}}},[b]),un=s.useCallback((L,z)=>(B,_)=>{const F=B.nativeEvent,P=b.get(_);if(G.current!==null||!P||F.dndKit||F.defaultPrevented)return;const Y={active:P};L(B,z.options,Y)===!0&&(F.dndKit={capturedBy:z.sensor},G.current=_,Ct(B,z))},[b,Ct]),St=or(f,un);fr(f),re(()=>{U&&N===ne.Initializing&&S(ne.Initialized)},[U,N]),s.useEffect(()=>{const{onDragMove:L}=oe.current,{active:z,activatorEvent:B,collisions:_,over:F}=se.current;if(!z||!B)return;const P={active:z,activatorEvent:B,collisions:_,delta:{x:ue.x,y:ue.y},over:F};me.unstable_batchedUpdates(()=>{L?.(P),D({type:"onDragMove",event:P})})},[ue.x,ue.y]),s.useEffect(()=>{const{active:L,activatorEvent:z,collisions:B,droppableContainers:_,scrollAdjustedTranslate:F}=se.current;if(!L||G.current==null||!z||!F)return;const{onDragOver:P}=oe.current,Y=_.get(xt),fe=Y&&Y.rect.current?{id:Y.id,rect:Y.rect.current,data:Y.data,disabled:Y.disabled}:null,T={active:L,activatorEvent:z,collisions:B,delta:{x:F.x,y:F.y},over:fe};me.unstable_batchedUpdates(()=>{Dt(fe),P?.(T),D({type:"onDragOver",event:T})})},[xt]),re(()=>{se.current={activatorEvent:q,active:V,activeNode:j,collisionRect:de,collisions:pe,droppableRects:le,draggableNodes:b,draggingNode:Te,draggingNodeRect:ce,droppableContainers:I,over:Z,scrollableAncestors:Q,scrollAdjustedTranslate:ue},H.current={initial:ce,translated:de}},[V,j,pe,de,b,Te,ce,le,I,Z,Q,ue]),er({...gt,delta:M,draggingRect:de,pointerCoordinates:yt,scrollableAncestors:Q,scrollableAncestorRects:Ne});const dn=s.useMemo(()=>({active:V,activeNode:j,activeNodeRect:U,activatorEvent:q,collisions:pe,containerNodeRect:We,dragOverlay:ae,draggableNodes:b,droppableContainers:I,droppableRects:le,over:Z,measureDroppableContainers:Oe,scrollableAncestors:Q,scrollableAncestorRects:Ne,measuringConfiguration:ie,measuringScheduled:ft,windowRect:Ye}),[V,j,U,q,pe,We,ae,b,I,le,Z,Oe,Q,Ne,ie,ft,Ye]),fn=s.useMemo(()=>({activatorEvent:q,activators:St,active:V,activeNodeRect:U,ariaDescribedById:{draggable:Ue},dispatch:m,draggableNodes:b,over:Z,measureDroppableContainers:Oe}),[q,St,V,U,m,Ue,b,Z,Oe]);return X.createElement(Ut.Provider,{value:y},X.createElement(je.Provider,{value:fn},X.createElement(rn.Provider,{value:dn},X.createElement(on.Provider,{value:cn},u)),X.createElement(Cr,{disabled:a?.restoreFocus===!1})),X.createElement(En,{...a,hiddenTextDescribedById:Ue}));function hn(){const L=lt?.autoScrollEnabled===!1,z=typeof c=="object"?c.enabled===!1:c===!1,B=R&&!L&&!z;return typeof c=="object"?{...c,enabled:B}:{enabled:B}}}),Mr=s.createContext(null),Ft="button",Ar="Draggable";function Fr(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=$e(Ar),{activators:l,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:v}=s.useContext(je),{role:h=Ft,roleDescription:C="draggable",tabIndex:g=0}=o??{},p=c?.id===t,m=s.useContext(p?on:Mr),[D,y]=ke(),[N,S]=ke(),R=hr(l,t),w=Se(n);re(()=>(d.set(t,{id:t,key:i,node:D,activatorNode:N,data:w}),()=>{const M=d.get(t);M&&M.key===i&&d.delete(t)}),[d,t]);const b=s.useMemo(()=>({role:h,tabIndex:g,"aria-disabled":r,"aria-pressed":p&&h===Ft?!0:void 0,"aria-roledescription":C,"aria-describedby":f.draggable}),[r,h,g,p,C,f.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:b,isDragging:p,listeners:r?void 0:R,node:D,over:v,setNodeRef:y,setActivatorNodeRef:S,transform:m}}function $r(){return s.useContext(rn)}const Or="Droppable",Tr={timeout:25};function Xr(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=$e(Or),{active:l,dispatch:a,over:c,measureDroppableContainers:u}=s.useContext(je),f=s.useRef({disabled:n}),d=s.useRef(!1),v=s.useRef(null),h=s.useRef(null),{disabled:C,updateMeasurementsFor:g,timeout:p}={...Tr,...o},m=Se(g??r),D=s.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(m.current)?m.current:[m.current]),h.current=null},p)},[p]),y=Xe({callback:D,disabled:C||!l}),N=s.useCallback((b,M)=>{y&&(M&&(y.unobserve(M),d.current=!1),b&&y.observe(b))},[y]),[S,R]=ke(N),w=Se(t);return s.useEffect(()=>{!y||!S.current||(y.disconnect(),d.current=!1,y.observe(S.current))},[S,y]),s.useEffect(()=>(a({type:E.RegisterDroppable,element:{id:r,key:i,disabled:n,node:S,rect:v,data:w}}),()=>a({type:E.UnregisterDroppable,key:i,id:r})),[r]),s.useEffect(()=>{n!==f.current.disabled&&(a({type:E.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,a]),{active:l,rect:v,isOver:c?.id===r,node:S,over:c,setNodeRef:R}}export{Rt as C,Pr as D,x as K,en as P,Ir as a,Xr as b,Fr as c,Br as d,it as e,$r as f,An as g,$e as h,re as i,Lr as j,jt as k,Ae as l,_t as m,zr as n,ze as s,kr as u};
6
- //# sourceMappingURL=core.esm-BsXtvNoI.js.map
5
+ `},Rn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function En(e){let{announcements:t=Rn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Sn}=e;const{announce:i,announcement:l}=xn(),a=$e("DndLiveRegion"),[c,u]=s.useState(!1);if(s.useEffect(()=>{u(!0)},[]),Dn(s.useMemo(()=>({onDragStart(d){let{active:v}=d;i(t.onDragStart({active:v}))},onDragMove(d){let{active:v,over:h}=d;t.onDragMove&&i(t.onDragMove({active:v,over:h}))},onDragOver(d){let{active:v,over:h}=d;i(t.onDragOver({active:v,over:h}))},onDragEnd(d){let{active:v,over:h}=d;i(t.onDragEnd({active:v,over:h}))},onDragCancel(d){let{active:v,over:h}=d;i(t.onDragCancel({active:v,over:h}))}}),[i,t])),!c)return null;const f=X.createElement(X.Fragment,null,X.createElement(yn,{id:r,value:o.draggable}),X.createElement(mn,{id:a,announcement:l}));return n?me.createPortal(f,n):f}var E;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(E||(E={}));function Pe(){}function Ir(e,t){return s.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function kr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const W=Object.freeze({x:0,y:0});function Wt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Yt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Mn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Mt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function An(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function At(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const zr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=At(t,t.left,t.top),i=[];for(const l of r){const{id:a}=l,c=n.get(a);if(c){const u=Wt(At(c),o);i.push({id:a,data:{droppableContainer:l,value:u}})}}return i.sort(Yt)},Pr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Mt(t),i=[];for(const l of r){const{id:a}=l,c=n.get(a);if(c){const u=Mt(c),f=o.reduce((v,h,C)=>v+Wt(u[C],h),0),d=Number((f/4).toFixed(4));i.push({id:a,data:{droppableContainer:l,value:d}})}}return i.sort(Yt)};function On(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),l=o-r,a=i-n;if(r<o&&n<i){const c=t.width*t.height,u=e.width*e.height,f=l*a,d=f/(c+u-f);return Number(d.toFixed(4))}return 0}const Tn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:l}=i,a=n.get(l);if(a){const c=On(a,t);c>0&&o.push({id:l,data:{droppableContainer:i,value:c}})}}return o.sort(Mn)};function Nn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Kt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:W}function Ln(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((l,a)=>({...l,top:l.top+e*a.y,bottom:l.bottom+e*a.y,left:l.left+e*a.x,right:l.right+e*a.x}),{...n})}}const In=Ln(1);function kn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function zn(e,t,n){const r=kn(t);if(!r)return e;const{scaleX:o,scaleY:i,x:l,y:a}=r,c=e.left-l-(1-o)*parseFloat(n),u=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:f,height:d,top:u,right:c+f,bottom:u+d,left:c}}const Pn={ignoreTransform:!1};function Ae(e,t){t===void 0&&(t=Pn);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=k(e).getComputedStyle(e);u&&(n=zn(n,u,f))}const{top:r,left:o,width:i,height:l,bottom:a,right:c}=n;return{top:r,left:o,width:i,height:l,bottom:a,right:c}}function Ot(e){return Ae(e,{ignoreTransform:!0})}function Bn(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Fn(e,t){return t===void 0&&(t=k(e).getComputedStyle(e)),t.position==="fixed"}function $n(e,t){t===void 0&&(t=k(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function it(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(rt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ee(o)||$t(o)||n.includes(o))return n;const i=k(e).getComputedStyle(o);return o!==e&&$n(o,i)&&n.push(o),Fn(o,i)?n:r(o.parentNode)}return e?r(e):n}function Ht(e){const[t]=it(e,1);return t??null}function qe(e){return!Fe||!e?null:ge(e)?e:nt(e)?rt(e)||e===ve(e).scrollingElement?window:Ee(e)?e:null:null}function Vt(e){return ge(e)?e.scrollX:e.scrollLeft}function qt(e){return ge(e)?e.scrollY:e.scrollTop}function _e(e){return{x:Vt(e),y:qt(e)}}var O;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(O||(O={}));function Jt(e){return!Fe||!e?!1:e===document.scrollingElement}function Gt(e){const t={x:0,y:0},n=Jt(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,l=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:l,isRight:a,maxScroll:r,minScroll:t}}const Xn={x:.2,y:.2};function jn(e,t,n,r,o){let{top:i,left:l,right:a,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=Xn);const{isTop:u,isBottom:f,isLeft:d,isRight:v}=Gt(e),h={x:0,y:0},C={x:0,y:0},g={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+g.height?(h.y=O.Backward,C.y=r*Math.abs((t.top+g.height-i)/g.height)):!f&&c>=t.bottom-g.height&&(h.y=O.Forward,C.y=r*Math.abs((t.bottom-g.height-c)/g.height)),!v&&a>=t.right-g.width?(h.x=O.Forward,C.x=r*Math.abs((t.right-g.width-a)/g.width)):!d&&l<=t.left+g.width&&(h.x=O.Backward,C.x=r*Math.abs((t.left+g.width-l)/g.width)),{direction:h,speed:C}}function Un(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:l}=window;return{top:0,left:0,right:i,bottom:l,width:i,height:l}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Qt(e){return e.reduce((t,n)=>he(t,_e(n)),W)}function Wn(e){return e.reduce((t,n)=>t+Vt(n),0)}function Yn(e){return e.reduce((t,n)=>t+qt(n),0)}function Kn(e,t){if(t===void 0&&(t=Ae),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Ht(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Hn=[["x",["left","right"],Wn],["y",["top","bottom"],Yn]];class st{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=it(n),o=Qt(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,l,a]of Hn)for(const c of l)Object.defineProperty(this,c,{get:()=>{const u=a(r),f=o[i]-u;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class xe{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Vn(e){const{EventTarget:t}=k(e);return e instanceof t?e:ve(e)}function Je(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var $;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})($||($={}));function Tt(e){e.preventDefault()}function qn(e){e.stopPropagation()}var x;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(x||(x={}));const Zt={start:[x.Space,x.Enter],cancel:[x.Esc],end:[x.Space,x.Enter,x.Tab]},Jn=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case x.Right:return{...n,x:n.x+25};case x.Left:return{...n,x:n.x-25};case x.Down:return{...n,y:n.y+25};case x.Up:return{...n,y:n.y-25}}};class _t{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new xe(ve(n)),this.windowListeners=new xe(k(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add($.Resize,this.handleCancel),this.windowListeners.add($.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add($.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Kn(r),n(W)}handleKeyDown(t){if(jt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=Zt,coordinateGetter:l=Jn,scrollBehavior:a="smooth"}=o,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,f=u?{x:u.left,y:u.top}:W;this.referenceCoordinates||(this.referenceCoordinates=f);const d=l(t,{active:n,context:r.current,currentCoordinates:f});if(d){const v=ze(d,f),h={x:0,y:0},{scrollableAncestors:C}=r.current;for(const g of C){const p=t.code,{isTop:m,isRight:D,isLeft:y,isBottom:N,maxScroll:S,minScroll:R}=Gt(g),w=Un(g),b={x:Math.min(p===x.Right?w.right-w.width/2:w.right,Math.max(p===x.Right?w.left:w.left+w.width/2,d.x)),y:Math.min(p===x.Down?w.bottom-w.height/2:w.bottom,Math.max(p===x.Down?w.top:w.top+w.height/2,d.y))},M=p===x.Right&&!D||p===x.Left&&!y,I=p===x.Down&&!N||p===x.Up&&!m;if(M&&b.x!==d.x){const A=g.scrollLeft+v.x,H=p===x.Right&&A<=S.x||p===x.Left&&A>=R.x;if(H&&!v.y){g.scrollTo({left:A,behavior:a});return}H?h.x=g.scrollLeft-A:h.x=p===x.Right?g.scrollLeft-S.x:g.scrollLeft-R.x,h.x&&g.scrollBy({left:-h.x,behavior:a});break}else if(I&&b.y!==d.y){const A=g.scrollTop+v.y,H=p===x.Down&&A<=S.y||p===x.Up&&A>=R.y;if(H&&!v.x){g.scrollTo({top:A,behavior:a});return}H?h.y=g.scrollTop-A:h.y=p===x.Down?g.scrollTop-S.y:g.scrollTop-R.y,h.y&&g.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,he(ze(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}_t.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Zt,onActivation:o}=t,{active:i}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Nt(e){return!!(e&&"distance"in e)}function Lt(e){return!!(e&&"delay"in e)}class at{constructor(t,n,r){var o;r===void 0&&(r=Vn(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:l}=i;this.props=t,this.events=n,this.document=ve(l),this.documentListeners=new xe(this.document),this.listeners=new xe(r),this.windowListeners=new xe(k(l)),this.initialCoordinates=(o=Ze(i))!=null?o:W,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add($.Resize,this.handleCancel),this.windowListeners.add($.DragStart,Tt),this.windowListeners.add($.VisibilityChange,this.handleCancel),this.windowListeners.add($.ContextMenu,Tt),this.documentListeners.add($.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Lt(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Nt(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add($.Click,qn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add($.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:l,options:{activationConstraint:a}}=i;if(!o)return;const c=(n=Ze(t))!=null?n:W,u=ze(o,c);if(!r&&a){if(Nt(a)){if(a.tolerance!=null&&Je(u,a.tolerance))return this.handleCancel();if(Je(u,a.distance))return this.handleStart()}if(Lt(a)&&Je(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);return}t.cancelable&&t.preventDefault(),l(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===x.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Gn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class en extends at{constructor(t){const{event:n}=t,r=ve(n.target);super(t,Gn,r)}}en.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Qn={move:{name:"mousemove"},end:{name:"mouseup"}};var et;(function(e){e[e.RightClick=2]="RightClick"})(et||(et={}));class Zn extends at{constructor(t){super(t,Qn,ve(t.event.target))}}Zn.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===et.RightClick?!1:(r?.({event:n}),!0)}}];const Ge={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class _n extends at{constructor(t){super(t,Ge)}static setup(){return window.addEventListener(Ge.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ge.move.name,t)};function t(){}}}_n.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var De;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(De||(De={}));var Be;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Be||(Be={}));function er(e){let{acceleration:t,activator:n=De.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:l=5,order:a=Be.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:v}=e;const h=nr({delta:d,disabled:!i}),[C,g]=gn(),p=s.useRef({x:0,y:0}),m=s.useRef({x:0,y:0}),D=s.useMemo(()=>{switch(n){case De.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case De.DraggableRect:return o}},[n,o,c]),y=s.useRef(null),N=s.useCallback(()=>{const R=y.current;if(!R)return;const w=p.current.x*m.current.x,b=p.current.y*m.current.y;R.scrollBy(w,b)},[]),S=s.useMemo(()=>a===Be.TreeOrder?[...u].reverse():u,[a,u]);s.useEffect(()=>{if(!i||!u.length||!D){g();return}for(const R of S){if(r?.(R)===!1)continue;const w=u.indexOf(R),b=f[w];if(!b)continue;const{direction:M,speed:I}=jn(R,b,D,t,v);for(const A of["x","y"])h[A][M[A]]||(I[A]=0,M[A]=0);if(I.x>0||I.y>0){g(),y.current=R,C(N,l),p.current=I,m.current=M;return}}p.current={x:0,y:0},m.current={x:0,y:0},g()},[t,N,r,g,i,l,JSON.stringify(D),JSON.stringify(h),C,u,S,f,JSON.stringify(v)])}const tr={x:{[O.Backward]:!1,[O.Forward]:!1},y:{[O.Backward]:!1,[O.Forward]:!1}};function nr(e){let{delta:t,disabled:n}=e;const r=Qe(t);return Me(o=>{if(n||!r||!o)return tr;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[O.Backward]:o.x[O.Backward]||i.x===-1,[O.Forward]:o.x[O.Forward]||i.x===1},y:{[O.Backward]:o.y[O.Backward]||i.y===-1,[O.Forward]:o.y[O.Forward]||i.y===1}}},[n,t,r])}function rr(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Me(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function or(e,t){return s.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,r)}));return[...n,...i]},[]),[e,t])}var Re;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Re||(Re={}));var tt;(function(e){e.Optimized="optimized"})(tt||(tt={}));const It=new Map;function ir(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,l]=s.useState(null),{frequency:a,measure:c,strategy:u}=o,f=s.useRef(e),d=p(),v=Se(d),h=s.useCallback(function(m){m===void 0&&(m=[]),!v.current&&l(D=>D===null?m:D.concat(m.filter(y=>!D.includes(y))))},[v]),C=s.useRef(null),g=Me(m=>{if(d&&!n)return It;if(!m||m===It||f.current!==e||i!=null){const D=new Map;for(let y of e){if(!y)continue;if(i&&i.length>0&&!i.includes(y.id)&&y.rect.current){D.set(y.id,y.rect.current);continue}const N=y.node.current,S=N?new st(c(N),N):null;y.rect.current=S,S&&D.set(y.id,S)}return D}return m},[e,i,n,d,c]);return s.useEffect(()=>{f.current=e},[e]),s.useEffect(()=>{d||h()},[n,d]),s.useEffect(()=>{i&&i.length>0&&l(null)},[JSON.stringify(i)]),s.useEffect(()=>{d||typeof a!="number"||C.current!==null||(C.current=setTimeout(()=>{h(),C.current=null},a))},[a,d,h,...r]),{droppableRects:g,measureDroppableContainers:h,measuringScheduled:i!=null};function p(){switch(u){case Re.Always:return!1;case Re.BeforeDragging:return n;default:return!n}}}function tn(e,t){return Me(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function sr(e,t){return tn(e,t)}function ar(e){let{callback:t,disabled:n}=e;const r=ot(t),o=s.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function Xe(e){let{callback:t,disabled:n}=e;const r=ot(t),o=s.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function lr(e){return new st(Ae(e),e)}function kt(e,t,n){t===void 0&&(t=lr);const[r,o]=s.useState(null);function i(){o(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const f=t(e);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const l=ar({callback(c){if(e)for(const u of c){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=Xe({callback:i});return re(()=>{i(),e?(a?.observe(e),l?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),l?.disconnect())},[e]),r}function cr(e){const t=tn(e);return Kt(e,t)}const zt=[];function ur(e){const t=s.useRef(e),n=Me(r=>e?r&&r!==zt&&e&&t.current&&e.parentNode===t.current.parentNode?r:it(e):zt,[e]);return s.useEffect(()=>{t.current=e},[e]),n}function dr(e){const[t,n]=s.useState(null),r=s.useRef(e),o=s.useCallback(i=>{const l=qe(i.target);l&&n(a=>a?(a.set(l,_e(l)),new Map(a)):null)},[]);return s.useEffect(()=>{const i=r.current;if(e!==i){l(i);const a=e.map(c=>{const u=qe(c);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,_e(u)]):null}).filter(c=>c!=null);n(a.length?new Map(a):null),r.current=e}return()=>{l(e),l(i)};function l(a){a.forEach(c=>{const u=qe(c);u?.removeEventListener("scroll",o)})}},[o,e]),s.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,l)=>he(i,l),W):Qt(e):W,[e,t])}function Pt(e,t){t===void 0&&(t=[]);const n=s.useRef(null);return s.useEffect(()=>{n.current=null},t),s.useEffect(()=>{const r=e!==W;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ze(e,n.current):W}function fr(e){s.useEffect(()=>{if(!Fe)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function hr(e,t){return s.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=l=>{i(l,t)},n},{}),[e,t])}function nn(e){return s.useMemo(()=>e?Bn(e):null,[e])}const Bt=[];function gr(e,t){t===void 0&&(t=Ae);const[n]=e,r=nn(n?k(n):null),[o,i]=s.useState(Bt);function l(){i(()=>e.length?e.map(c=>Jt(c)?r:new st(t(c),c)):Bt)}const a=Xe({callback:l});return re(()=>{a?.disconnect(),l(),e.forEach(c=>a?.observe(c))},[e]),o}function vr(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ee(t)?t:e}function pr(e){let{measure:t}=e;const[n,r]=s.useState(null),o=s.useCallback(u=>{for(const{target:f}of u)if(Ee(f)){r(d=>{const v=t(f);return d?{...d,width:v.width,height:v.height}:v});break}},[t]),i=Xe({callback:o}),l=s.useCallback(u=>{const f=vr(u);i?.disconnect(),f&&i?.observe(f),r(f?t(f):null)},[t,i]),[a,c]=ke(l);return s.useMemo(()=>({nodeRef:a,rect:n,setRef:c}),[n,a,c])}const br=[{sensor:en,options:{}},{sensor:_t,options:{}}],wr={current:{}},Ie={draggable:{measure:Ot},droppable:{measure:Ot,strategy:Re.WhileDragging,frequency:tt.Optimized},dragOverlay:{measure:Ae}};class Ce extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const yr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ce,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Pe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ie,measureDroppableContainers:Pe,windowRect:null,measuringScheduled:!1},mr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Pe,draggableNodes:new Map,over:null,measureDroppableContainers:Pe},je=s.createContext(mr),rn=s.createContext(yr);function xr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ce}}}function Dr(e,t){switch(t.type){case E.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case E.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case E.DragEnd:case E.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case E.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ce(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case E.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const l=new Ce(e.droppable.containers);return l.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:l}}}case E.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ce(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Cr(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=s.useContext(je),i=Qe(r),l=Qe(n?.id);return s.useEffect(()=>{if(!t&&!r&&i&&l!=null){if(!jt(i)||document.activeElement===i.target)return;const a=o.get(l);if(!a)return;const{activatorNode:c,node:u}=a;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[c.current,u.current]){if(!f)continue;const d=bn(f);if(d){d.focus();break}}})}},[r,t,o,l,i]),null}function Sr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function Rr(e){return s.useMemo(()=>({draggable:{...Ie.draggable,...e?.draggable},droppable:{...Ie.droppable,...e?.droppable},dragOverlay:{...Ie.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Er(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=s.useRef(!1),{x:l,y:a}=typeof o=="boolean"?{x:o,y:o}:o;re(()=>{if(!l&&!a||!t){i.current=!1;return}if(i.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),d=Kt(f,r);if(l||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const v=Ht(u);v&&v.scrollBy({top:d.y,left:d.x})}},[t,l,a,r,n])}const on=s.createContext({...W,scaleX:1,scaleY:1});var ne;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ne||(ne={}));const Br=s.memo(function(t){var n,r,o,i;let{id:l,accessibility:a,autoScroll:c=!0,children:u,sensors:f=br,collisionDetection:d=Tn,measuring:v,modifiers:h,...C}=t;const g=s.useReducer(Dr,void 0,xr),[p,m]=g,[D,y]=Cn(),[N,S]=s.useState(ne.Uninitialized),R=N===ne.Initialized,{draggable:{active:w,nodes:b,translate:M},droppable:{containers:I}}=p,A=w!=null?b.get(w):null,H=s.useRef({initial:null,translated:null}),V=s.useMemo(()=>{var L;return w!=null?{id:w,data:(L=A?.data)!=null?L:wr,rect:H}:null},[w,A]),G=s.useRef(null),[lt,ct]=s.useState(null),[q,ut]=s.useState(null),oe=Se(C,Object.values(C)),Ue=$e("DndDescribedBy",l),dt=s.useMemo(()=>I.getEnabled(),[I]),ie=Rr(v),{droppableRects:le,measureDroppableContainers:Oe,measuringScheduled:ft}=ir(dt,{dragging:R,dependencies:[M.x,M.y],config:ie.droppable}),j=rr(b,w),ht=s.useMemo(()=>q?Ze(q):null,[q]),gt=hn(),vt=sr(j,ie.draggable.measure);Er({activeNode:w!=null?b.get(w):null,config:gt.layoutShiftCompensation,initialRect:vt,measure:ie.draggable.measure});const U=kt(j,ie.draggable.measure,vt),We=kt(j?j.parentElement:null),se=s.useRef({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:le,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pt=I.getNodeFor((n=se.current.over)==null?void 0:n.id),ae=pr({measure:ie.dragOverlay.measure}),Te=(r=ae.nodeRef.current)!=null?r:j,ce=R?(o=ae.rect)!=null?o:U:null,bt=!!(ae.nodeRef.current&&ae.rect),wt=cr(bt?null:U),Ye=nn(Te?k(Te):null),Q=ur(R?pt??j:null),Ne=gr(Q),Le=Sr(h,{transform:{x:M.x-wt.x,y:M.y-wt.y,scaleX:1,scaleY:1},activatorEvent:q,active:V,activeNodeRect:U,containerNodeRect:We,draggingNodeRect:ce,over:se.current.over,overlayNodeRect:ae.rect,scrollableAncestors:Q,scrollableAncestorRects:Ne,windowRect:Ye}),yt=ht?he(ht,M):null,mt=dr(Q),sn=Pt(mt),an=Pt(mt,[U]),ue=he(Le,sn),de=ce?In(ce,Le):null,pe=V&&de?d({active:V,collisionRect:de,droppableRects:le,droppableContainers:dt,pointerCoordinates:yt}):null,xt=An(pe,"id"),[Z,Dt]=s.useState(null),ln=bt?Le:he(Le,an),cn=Nn(ln,(i=Z?.rect)!=null?i:null,U),Ke=s.useRef(null),Ct=s.useCallback((L,z)=>{let{sensor:P,options:_}=z;if(G.current==null)return;const F=b.get(G.current);if(!F)return;const B=L.nativeEvent,Y=new P({active:G.current,activeNode:F,event:B,options:_,context:se,onAbort(T){if(!b.get(T))return;const{onDragAbort:K}=oe.current,J={id:T};K?.(J),D({type:"onDragAbort",event:J})},onPending(T,ee,K,J){if(!b.get(T))return;const{onDragPending:we}=oe.current,te={id:T,constraint:ee,initialCoordinates:K,offset:J};we?.(te),D({type:"onDragPending",event:te})},onStart(T){const ee=G.current;if(ee==null)return;const K=b.get(ee);if(!K)return;const{onDragStart:J}=oe.current,be={activatorEvent:B,active:{id:ee,data:K.data,rect:H}};me.unstable_batchedUpdates(()=>{J?.(be),S(ne.Initializing),m({type:E.DragStart,initialCoordinates:T,active:ee}),D({type:"onDragStart",event:be}),ct(Ke.current),ut(B)})},onMove(T){m({type:E.DragMove,coordinates:T})},onEnd:fe(E.DragEnd),onCancel:fe(E.DragCancel)});Ke.current=Y;function fe(T){return async function(){const{active:K,collisions:J,over:be,scrollAdjustedTranslate:we}=se.current;let te=null;if(K&&we){const{cancelDrop:ye}=oe.current;te={activatorEvent:B,active:K,collisions:J,delta:we,over:be},T===E.DragEnd&&typeof ye=="function"&&await Promise.resolve(ye(te))&&(T=E.DragCancel)}G.current=null,me.unstable_batchedUpdates(()=>{m({type:T}),S(ne.Uninitialized),Dt(null),ct(null),ut(null),Ke.current=null;const ye=T===E.DragEnd?"onDragEnd":"onDragCancel";if(te){const He=oe.current[ye];He?.(te),D({type:ye,event:te})}})}}},[b]),un=s.useCallback((L,z)=>(P,_)=>{const F=P.nativeEvent,B=b.get(_);if(G.current!==null||!B||F.dndKit||F.defaultPrevented)return;const Y={active:B};L(P,z.options,Y)===!0&&(F.dndKit={capturedBy:z.sensor},G.current=_,Ct(P,z))},[b,Ct]),St=or(f,un);fr(f),re(()=>{U&&N===ne.Initializing&&S(ne.Initialized)},[U,N]),s.useEffect(()=>{const{onDragMove:L}=oe.current,{active:z,activatorEvent:P,collisions:_,over:F}=se.current;if(!z||!P)return;const B={active:z,activatorEvent:P,collisions:_,delta:{x:ue.x,y:ue.y},over:F};me.unstable_batchedUpdates(()=>{L?.(B),D({type:"onDragMove",event:B})})},[ue.x,ue.y]),s.useEffect(()=>{const{active:L,activatorEvent:z,collisions:P,droppableContainers:_,scrollAdjustedTranslate:F}=se.current;if(!L||G.current==null||!z||!F)return;const{onDragOver:B}=oe.current,Y=_.get(xt),fe=Y&&Y.rect.current?{id:Y.id,rect:Y.rect.current,data:Y.data,disabled:Y.disabled}:null,T={active:L,activatorEvent:z,collisions:P,delta:{x:F.x,y:F.y},over:fe};me.unstable_batchedUpdates(()=>{Dt(fe),B?.(T),D({type:"onDragOver",event:T})})},[xt]),re(()=>{se.current={activatorEvent:q,active:V,activeNode:j,collisionRect:de,collisions:pe,droppableRects:le,draggableNodes:b,draggingNode:Te,draggingNodeRect:ce,droppableContainers:I,over:Z,scrollableAncestors:Q,scrollAdjustedTranslate:ue},H.current={initial:ce,translated:de}},[V,j,pe,de,b,Te,ce,le,I,Z,Q,ue]),er({...gt,delta:M,draggingRect:de,pointerCoordinates:yt,scrollableAncestors:Q,scrollableAncestorRects:Ne});const dn=s.useMemo(()=>({active:V,activeNode:j,activeNodeRect:U,activatorEvent:q,collisions:pe,containerNodeRect:We,dragOverlay:ae,draggableNodes:b,droppableContainers:I,droppableRects:le,over:Z,measureDroppableContainers:Oe,scrollableAncestors:Q,scrollableAncestorRects:Ne,measuringConfiguration:ie,measuringScheduled:ft,windowRect:Ye}),[V,j,U,q,pe,We,ae,b,I,le,Z,Oe,Q,Ne,ie,ft,Ye]),fn=s.useMemo(()=>({activatorEvent:q,activators:St,active:V,activeNodeRect:U,ariaDescribedById:{draggable:Ue},dispatch:m,draggableNodes:b,over:Z,measureDroppableContainers:Oe}),[q,St,V,U,m,Ue,b,Z,Oe]);return X.createElement(Ut.Provider,{value:y},X.createElement(je.Provider,{value:fn},X.createElement(rn.Provider,{value:dn},X.createElement(on.Provider,{value:cn},u)),X.createElement(Cr,{disabled:a?.restoreFocus===!1})),X.createElement(En,{...a,hiddenTextDescribedById:Ue}));function hn(){const L=lt?.autoScrollEnabled===!1,z=typeof c=="object"?c.enabled===!1:c===!1,P=R&&!L&&!z;return typeof c=="object"?{...c,enabled:P}:{enabled:P}}}),Mr=s.createContext(null),Ft="button",Ar="Draggable";function Fr(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=$e(Ar),{activators:l,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:v}=s.useContext(je),{role:h=Ft,roleDescription:C="draggable",tabIndex:g=0}=o??{},p=c?.id===t,m=s.useContext(p?on:Mr),[D,y]=ke(),[N,S]=ke(),R=hr(l,t),w=Se(n);re(()=>(d.set(t,{id:t,key:i,node:D,activatorNode:N,data:w}),()=>{const M=d.get(t);M&&M.key===i&&d.delete(t)}),[d,t]);const b=s.useMemo(()=>({role:h,tabIndex:g,"aria-disabled":r,"aria-pressed":p&&h===Ft?!0:void 0,"aria-roledescription":C,"aria-describedby":f.draggable}),[r,h,g,p,C,f.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:b,isDragging:p,listeners:r?void 0:R,node:D,over:v,setNodeRef:y,setActivatorNodeRef:S,transform:m}}function $r(){return s.useContext(rn)}const Or="Droppable",Tr={timeout:25};function Xr(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=$e(Or),{active:l,dispatch:a,over:c,measureDroppableContainers:u}=s.useContext(je),f=s.useRef({disabled:n}),d=s.useRef(!1),v=s.useRef(null),h=s.useRef(null),{disabled:C,updateMeasurementsFor:g,timeout:p}={...Tr,...o},m=Se(g??r),D=s.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(m.current)?m.current:[m.current]),h.current=null},p)},[p]),y=Xe({callback:D,disabled:C||!l}),N=s.useCallback((b,M)=>{y&&(M&&(y.unobserve(M),d.current=!1),b&&y.observe(b))},[y]),[S,R]=ke(N),w=Se(t);return s.useEffect(()=>{!y||!S.current||(y.disconnect(),d.current=!1,y.observe(S.current))},[S,y]),s.useEffect(()=>(a({type:E.RegisterDroppable,element:{id:r,key:i,disabled:n,node:S,rect:v,data:w}}),()=>a({type:E.UnregisterDroppable,key:i,id:r})),[r]),s.useEffect(()=>{n!==f.current.disabled&&(a({type:E.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,a]),{active:l,rect:v,isOver:c?.id===r,node:S,over:c,setNodeRef:R}}export{Rt as C,Br as D,x as K,en as P,Ir as a,Xr as b,Fr as c,Pr as d,it as e,$r as f,An as g,$e as h,re as i,Lr as j,jt as k,Ae as l,_t as m,zr as n,ze as s,kr as u};
6
+ //# sourceMappingURL=core.esm-BIE97rfo.js.map
@@ -0,0 +1,2 @@
1
+ import{c as b,r as t,j as e,dc as I,H as g,I as F,eA as P,bV as R,B as L,i as $,dm as E,ho as M,hp as B,jf as D}from"./index-B-Ab8srM.js";import{u as H,c as T,f as Q}from"./agent-skill-context-DF5q0Dfr.js";import{A as z,a as K}from"./agent-subpage-shell-Pi5cECga.js";import{a as k}from"./skill-route-key-sF006xiz.js";import"./core.esm-BIE97rfo.js";import"./skill-editor-D_W3QlRz.js";function O({owner:a,agentId:l}){const r=b(),[o,x]=t.useState(""),[p,c]=t.useState(!1),[n,f]=t.useState(""),[m,j]=t.useState(""),{skillRows:u,catalog:d,isLoading:S,addSkillFromCatalog:C,addCustomSkill:v}=H(),h=t.useMemo(()=>new Set(u.map(s=>s.repo)),[u]),i=t.useMemo(()=>T(d?.catalog??[],h),[d?.catalog,h]),N=t.useMemo(()=>Q(i,o),[i,o]),w=s=>{C(s),r({to:"/$owner/agents/$agentId",params:{owner:a,agentId:l},search:{skill:k(s)},hash:"skills"})},y=()=>{const s=v({name:n,instructions:m});s&&r({to:"/$owner/agents/$agentId",params:{owner:a,agentId:l},search:{skill:k(s)},hash:"skills"})},A=e.jsx(z,{title:"Add a skill",description:"Skills bundle instructions, tools, and knowledge an agent can reuse. Pick one from the catalog or create your own."});return e.jsxs("div",{className:"space-y-6",children:[A,e.jsx("div",{className:$(E,"w-full"),children:p?e.jsxs("div",{className:"space-y-3 p-3",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(g,{htmlFor:"custom-skill-name",children:"Name"}),e.jsx(F,{id:"custom-skill-name",value:n,onChange:s=>f(s.target.value),placeholder:"my-skill"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(g,{htmlFor:"custom-skill-instructions",children:"Instructions"}),e.jsx(P,{id:"custom-skill-instructions",value:m,onChange:s=>j(s.target.value),placeholder:"Instructions for the agent when this skill is active...",rows:3})]})]}),e.jsx(R,{onCancel:()=>c(!1),children:e.jsx(L,{type:"button",size:"sm",onClick:y,disabled:!n.trim(),children:"Add custom skill"})})]}):e.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 p-3 text-left text-muted-foreground transition-colors hover:text-foreground",onClick:()=>c(!0),children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted",children:e.jsx(I,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Create custom skill"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define instructions and packages"})]})]})}),S?e.jsx(M,{}):e.jsx(B,{items:N,searchQuery:o,onSearchChange:x,onSelect:s=>w(s.key),searchPlaceholder:"Search skills...",searchAriaLabel:"Search skills",emptyMessage:o.trim()?`No skills match "${o}"`:i.length===0?"All catalog skills are already configured":"No skills available"})]})}function V({owner:a,agentId:l}){return e.jsx(K,{children:e.jsx(O,{owner:a,agentId:l})})}function W(){const{owner:a,agentId:l}=D.useParams();return e.jsx(V,{owner:a,agentId:l})}export{W as component};
2
+ //# sourceMappingURL=create-BPxsKwk7.js.map
@@ -1,2 +1,2 @@
1
- import{j as n,az as t,O as c,aH as r,al as i,gS as l,b3 as m,gT as x,L as d,gU as u,gV as C,f5 as j}from"./index-BjcZVe7n.js";function p({owner:o,initialConnectorKey:e}){return n.jsx(t,{owner:o,children:a=>n.jsx(g,{ownerSlug:a.ownerSlug,organizationId:a.organizationId,initialConnectorKey:e})})}function g({ownerSlug:o,organizationId:e,initialConnectorKey:a}){const{data:s=[]}=r(e??"");return n.jsxs(i,{className:"flex flex-1 flex-col gap-6",children:[n.jsx(l,{breadcrumb:n.jsx(x,{crumbs:[n.jsx(d,{to:"/$owner/connectors",params:{owner:o},search:{},className:u,children:"Connectors"},"connectors")]}),icon:n.jsx(m.connectors.icon,{className:"h-6 w-6"}),title:"Add a connection",caption:"Pick a connector from the catalog or drop in an MCP URL — Lobu handles auth and brings the data into memory."}),e?n.jsx(C,{ownerSlug:o,organizationId:e,connections:s,initialConnectorKey:a},a??"catalog"):n.jsx("div",{className:"max-w-3xl",children:n.jsx(j,{rows:4})})]})}const f=()=>n.jsx(c,{});export{p as ConnectionsCreateRouteContent,f as component};
2
- //# sourceMappingURL=create-YdAnh3ml.js.map
1
+ import{j as n,az as t,O as c,aH as r,al as i,gF as l,b3 as m,gG as x,L as d,gH as u,gI as C,eW as j}from"./index-B-Ab8srM.js";function p({owner:o,initialConnectorKey:e}){return n.jsx(t,{owner:o,children:a=>n.jsx(g,{ownerSlug:a.ownerSlug,organizationId:a.organizationId,initialConnectorKey:e})})}function g({ownerSlug:o,organizationId:e,initialConnectorKey:a}){const{data:s=[]}=r(e??"");return n.jsxs(i,{className:"flex flex-1 flex-col gap-6",children:[n.jsx(l,{breadcrumb:n.jsx(x,{crumbs:[n.jsx(d,{to:"/$owner/connectors",params:{owner:o},search:{},className:u,children:"Connectors"},"connectors")]}),icon:n.jsx(m.connectors.icon,{className:"h-6 w-6"}),title:"Add a connection",caption:"Pick a connector from the catalog or drop in an MCP URL — Lobu handles auth and brings the data into memory."}),e?n.jsx(C,{ownerSlug:o,organizationId:e,connections:s,initialConnectorKey:a},a??"catalog"):n.jsx("div",{className:"max-w-3xl",children:n.jsx(j,{rows:4})})]})}const b=()=>n.jsx(c,{});export{p as ConnectionsCreateRouteContent,b as component};
2
+ //# sourceMappingURL=create-GT8_yF0R.js.map
@@ -0,0 +1,2 @@
1
+ import{c as h,gO as G,iy as b,iz as L,hw as y,j as e,eW as v,bB as r,jg as w}from"./index-B-Ab8srM.js";import{A as S,v as N,a as P}from"./custom-guardrail-edits-B9plaLBN.js";import{A as $,a as F}from"./agent-subpage-shell-Pi5cECga.js";import"./model-selector-onvGA9Ww.js";function R({owner:t,agentId:a}){const i=h(),{data:n,isLoading:c}=G(a),{data:m,isLoading:p}=b(a),{data:o=null,isLoading:f}=L(a),C=c||p||f,u=y(a),g=n?.guardrailsInline??[],A=(m??[]).map(s=>s.name),j=async s=>{if(!n){r.error("Still loading agent settings — try again in a moment");return}const d=N(s,g,A,o);if(d){r.error(d);return}try{await u.mutateAsync({guardrailsInline:P(g,s)}),r.success("Guardrail created"),i({to:"/$owner/agents/$agentId",params:{owner:t,agentId:a},hash:"guardrails"})}catch(l){r.error(l instanceof Error?l.message:"Failed to create guardrail")}},x=()=>void i({to:"/$owner/agents/$agentId",params:{owner:t,agentId:a},hash:"guardrails"});return e.jsxs("div",{className:"space-y-6",children:[e.jsx($,{title:"New custom guardrail",description:"A custom guardrail judges text at one stage against a policy you write."}),C?e.jsx(v,{rows:4}):e.jsx(S,{judgeModelDefault:o,submitLabel:"Create guardrail",submitting:u.isPending,onSubmit:j,onCancel:x})]})}function D({owner:t,agentId:a}){return e.jsx(F,{children:e.jsx(R,{owner:t,agentId:a})})}function B(){const{owner:t,agentId:a}=w.useParams();return e.jsx(D,{owner:t,agentId:a})}export{B as component};
2
+ //# sourceMappingURL=create-Yx2qBMBy.js.map