@lobu/runtime-server 24.7.0 → 24.8.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 (229) hide show
  1. package/dist/catalogs/connectors.json +199 -316
  2. package/dist/component.json +1 -1
  3. package/dist/connectors/imessage.ts +953 -0
  4. package/dist/connectors/linkedin.ts +20 -377
  5. package/dist/dependencies.bun.lock +124 -92
  6. package/dist/embeddings-server.mjs +14 -2
  7. package/dist/owletto/dist/assets/_-B0tmXZ86.js +2 -0
  8. package/dist/owletto/dist/assets/_-DwXULq4r.js +3 -0
  9. package/dist/owletto/dist/assets/_agentId-B1dNkhnr.js +2 -0
  10. package/dist/owletto/dist/assets/_agentId-sYjvnBaB.js +2 -0
  11. package/dist/owletto/dist/assets/_automationId-Bnw_CnT_.js +2 -0
  12. package/dist/owletto/dist/assets/_connectorKey._connectionId-D7Z8DQ-B.js +2 -0
  13. package/dist/owletto/dist/assets/_connectorKey.index-DM5MTO8c.js +2 -0
  14. package/dist/owletto/dist/assets/_conversationId-OJrZjd0o.js +2 -0
  15. package/dist/owletto/dist/assets/_eventId-CfB0_2zK.js +2 -0
  16. package/dist/owletto/dist/assets/_owner-BDvTUY0a.js +3 -0
  17. package/dist/owletto/dist/assets/_shape-BZidoJMB.js +2 -0
  18. package/dist/owletto/dist/assets/_slug-R989vOiM.js +2 -0
  19. package/dist/owletto/dist/assets/_viewKey-BDUSrpe5.js +2 -0
  20. package/dist/owletto/dist/assets/_viewKey-BnFqh5-t.js +2 -0
  21. package/dist/owletto/dist/assets/{accept-invitation-CX7Egv-p.js → accept-invitation-BC-ZIsrf.js} +2 -2
  22. package/dist/owletto/dist/assets/activity-route-view-CN2dOiCD.js +2 -0
  23. package/dist/owletto/dist/assets/agent-connect-pages-CdDjrHjn.js +4 -0
  24. package/dist/owletto/dist/assets/agent-editor-form-CDAHRNWl.js +2 -0
  25. package/dist/owletto/dist/assets/{agent-loading-shells-DHvKiEUB.js → agent-loading-shells-BupiSjR-.js} +2 -2
  26. package/dist/owletto/dist/assets/agent-permissions-matrix-ju7L2M0l.js +2 -0
  27. package/dist/owletto/dist/assets/{agent-skill-context-DF5q0Dfr.js → agent-skill-context-B0ZYVE3n.js} +2 -2
  28. package/dist/owletto/dist/assets/{agent-subpage-shell-Pi5cECga.js → agent-subpage-shell-ByU0xhXn.js} +2 -2
  29. package/dist/owletto/dist/assets/{agent-thread-B1ZepGZc.js → agent-thread-DiVKn1WX.js} +4 -4
  30. package/dist/owletto/dist/assets/agent-thread-storage-Bx2-WBHQ.js +2 -0
  31. package/dist/owletto/dist/assets/app._appId-BQWElSoP.js +2 -0
  32. package/dist/owletto/dist/assets/assist-composer-igTXq3DL.js +2 -0
  33. package/dist/owletto/dist/assets/automation-detail-content-BJwRU6qT.js +2 -0
  34. package/dist/owletto/dist/assets/{callback-Ckrxv0eo.js → callback-Dmaio9CX.js} +2 -2
  35. package/dist/owletto/dist/assets/{card-DT9mSjSp.js → card-rE4Ctuy6.js} +2 -2
  36. package/dist/owletto/dist/assets/{claim-Bzby28tT.js → claim-BN17CPYh.js} +2 -2
  37. package/dist/owletto/dist/assets/{client-activity-scopes-DoIErdUy.js → client-activity-scopes-B7xVaUA-.js} +2 -2
  38. package/dist/owletto/dist/assets/{client-rows-BbVQy5Ti.js → client-rows-B3LULJxW.js} +2 -2
  39. package/dist/owletto/dist/assets/clients-CydgUHrc.js +2 -0
  40. package/dist/owletto/dist/assets/code-editor-UppEMWpt.js +26 -0
  41. package/dist/owletto/dist/assets/connect-OdHpIVV9.js +2 -0
  42. package/dist/owletto/dist/assets/connect-menu-B9u86bb2.js +2 -0
  43. package/dist/owletto/dist/assets/connect._clientId-EI1tcdSE.js +2 -0
  44. package/dist/owletto/dist/assets/connected._clientId-CaF-ZWlZ.js +2 -0
  45. package/dist/owletto/dist/assets/{connection-BOaMa324.js → connection-D8ZAMHBT.js} +2 -2
  46. package/dist/owletto/dist/assets/connection-feed-detail-CJYqryAV.js +2 -0
  47. package/dist/owletto/dist/assets/connector-boxes-BWPXijAk.js +2 -0
  48. package/dist/owletto/dist/assets/connector-page-shell-C23dWdKz.js +2 -0
  49. package/dist/owletto/dist/assets/connector-provenance-CW4CXtCz.js +2 -0
  50. package/dist/owletto/dist/assets/{connectors-D5F5rHxX.js → connectors-Bp08_KPq.js} +2 -2
  51. package/dist/owletto/dist/assets/consent-_PpYI1cT.js +2 -0
  52. package/dist/owletto/dist/assets/copy-button-1ALlvZU1.js +2 -0
  53. package/dist/owletto/dist/assets/{core.esm-BIE97rfo.js → core.esm-6koO33th.js} +2 -2
  54. package/dist/owletto/dist/assets/create-DULVO0HS.js +2 -0
  55. package/dist/owletto/dist/assets/create-Drx9tcnG.js +2 -0
  56. package/dist/owletto/dist/assets/{create-automation-form-B12yTrmj.js → create-automation-form-BhujNbRr.js} +3 -3
  57. package/dist/owletto/dist/assets/{create-BPxsKwk7.js → create-kUevP9Xx.js} +2 -2
  58. package/dist/owletto/dist/assets/create._connectorKey-N6fhcIPy.js +2 -0
  59. package/dist/owletto/dist/assets/{custom-guardrail-edits-B9plaLBN.js → custom-guardrail-edits-B_aCgvoZ.js} +2 -2
  60. package/dist/owletto/dist/assets/definition-comparison-3zKUSTt8.js +2 -0
  61. package/dist/owletto/dist/assets/{detail-page-skeleton-I5_7FkKx.js → detail-page-skeleton-BmxqqIsH.js} +2 -2
  62. package/dist/owletto/dist/assets/{device-CadaiNF4.js → device-D2eUt_nr.js} +2 -2
  63. package/dist/owletto/dist/assets/device-pin-tombstone-BFPbTM_o.js +2 -0
  64. package/dist/owletto/dist/assets/device._deviceId-Dqtmb1Xp.js +2 -0
  65. package/dist/owletto/dist/assets/dynamic-schema-form-D3KnzCsW.js +2 -0
  66. package/dist/owletto/dist/assets/entity-options-IUdQ-64R.js +2 -0
  67. package/dist/owletto/dist/assets/entity-page-B3Im65EI.js +2 -0
  68. package/dist/owletto/dist/assets/entity-pages-DJNSQrfB.js +2 -0
  69. package/dist/owletto/dist/assets/entity-type-page-CouHZbc9.js +2 -0
  70. package/dist/owletto/dist/assets/event-detail-CvaRN1qB.js +2 -0
  71. package/dist/owletto/dist/assets/event-kind-options-fHAIXu24.js +2 -0
  72. package/dist/owletto/dist/assets/events-feed-DwOkLk6A.js +2 -0
  73. package/dist/owletto/dist/assets/filter-editors-DQ5V4Cvh.js +2 -0
  74. package/dist/owletto/dist/assets/{full-page-spinner-CCU4PkRv.js → full-page-spinner-B7A6Ycyi.js} +2 -2
  75. package/dist/owletto/dist/assets/home-stream-Bg97PUBJ.js +2 -0
  76. package/dist/owletto/dist/assets/home-toolbar-CpCcHA6z.js +2 -0
  77. package/dist/owletto/dist/assets/index-9PGnv4-5.js +2 -0
  78. package/dist/owletto/dist/assets/{index-pmr1WUoG.js → index-B-dZruj6.js} +2 -2
  79. package/dist/owletto/dist/assets/index-BztXeLBN.js +2 -0
  80. package/dist/owletto/dist/assets/{index-B-Ab8srM.js → index-C2TCKJDP.js} +1599 -1597
  81. package/dist/owletto/dist/assets/index-C7QM3aqU.js +2 -0
  82. package/dist/owletto/dist/assets/index-CWn46a4y.js +2 -0
  83. package/dist/owletto/dist/assets/index-CxJONizf.js +2 -0
  84. package/dist/owletto/dist/assets/index-DJhb3li3.js +2 -0
  85. package/dist/owletto/dist/assets/{index-B72KYdN1.js → index-DXfYVs5m.js} +2 -2
  86. package/dist/owletto/dist/assets/{index-BYFDMIQC.js → index-DY-YGnCe.js} +2 -2
  87. package/dist/owletto/dist/assets/index-j3v7ITPb.js +2 -0
  88. package/dist/owletto/dist/assets/index-oiy6ygaI.js +2 -0
  89. package/dist/owletto/dist/assets/index-pEgtAY1t.js +2 -0
  90. package/dist/owletto/dist/assets/index-xAvK3IyQ.css +1 -0
  91. package/dist/owletto/dist/assets/json-diff-CJK-gzCt.js +4 -0
  92. package/dist/owletto/dist/assets/{list-skeleton-BAqT0vxo.js → list-skeleton-bQAZ0hQp.js} +2 -2
  93. package/dist/owletto/dist/assets/{login-D5bIjMtf.js → login-DLqL54Rk.js} +2 -2
  94. package/dist/owletto/dist/assets/{logout-JYZvxz8v.js → logout-H0F3IfiO.js} +2 -2
  95. package/dist/owletto/dist/assets/member-scope-gate-Doic_6qX.js +2 -0
  96. package/dist/owletto/dist/assets/memory-browse-page-CUea2Llz.js +74 -0
  97. package/dist/owletto/dist/assets/model-selector-BrfaDwIg.js +2 -0
  98. package/dist/owletto/dist/assets/new-5GkxlOuQ.js +2 -0
  99. package/dist/owletto/dist/assets/{new-B-Jd-vBl.js → new-BiA4DGoN.js} +2 -2
  100. package/dist/owletto/dist/assets/new-M-MX_T5C.js +2 -0
  101. package/dist/owletto/dist/assets/organization-CLrcmgNK.js +2 -0
  102. package/dist/owletto/dist/assets/peek-pane-content-B29OcHwm.js +2 -0
  103. package/dist/owletto/dist/assets/{pending-seed-CoFPQ835.js → pending-seed-DYYOoCvj.js} +2 -2
  104. package/dist/owletto/dist/assets/proposal-review-shell-BVwOMoq9.js +2 -0
  105. package/dist/owletto/dist/assets/public-shell-ready-BbjPgh3k.js +2 -0
  106. package/dist/owletto/dist/assets/record-activity-BCpNKaUo.js +2 -0
  107. package/dist/owletto/dist/assets/{record-session-Bpx4_LGk.js → record-session-KuEDuF3S.js} +2 -2
  108. package/dist/owletto/dist/assets/{renderer-CgaQKMoG.js → renderer-ucwCQmBk.js} +2 -2
  109. package/dist/owletto/dist/assets/{reset-password-C-4Jnuqk.js → reset-password-BkiAmXZW.js} +2 -2
  110. package/dist/owletto/dist/assets/run-initiator-8vdkq-3o.js +2 -0
  111. package/dist/owletto/dist/assets/{runs-BMzp7j7j.js → runs-B_iywKWb.js} +2 -2
  112. package/dist/owletto/dist/assets/runs-list-CJJFRhTl.js +2 -0
  113. package/dist/owletto/dist/assets/schema-type-editor-panel-C4e8pq1A.js +2 -0
  114. package/dist/owletto/dist/assets/{schema-value-BUgC0Ro8.js → schema-value-CefbtPIY.js} +3 -3
  115. package/dist/owletto/dist/assets/scoped-feed-bar-CapleZvS.js +2 -0
  116. package/dist/owletto/dist/assets/{settings-DYYvrrZ4.js → settings-DvzkRYQy.js} +2 -2
  117. package/dist/owletto/dist/assets/source-record-panels-LJIWGtHb.js +2 -0
  118. package/dist/owletto/dist/assets/{status-variants-DT61YfsU.js → status-variants-BxHtpMOj.js} +2 -2
  119. package/dist/owletto/dist/assets/subDays-DwIOMzYC.js +2 -0
  120. package/dist/owletto/dist/assets/{table-B6yimlsZ.js → table-1O-ik4_O.js} +2 -2
  121. package/dist/owletto/dist/assets/{use-automations-II_YJWtN.js → use-automations-lV8PuE8L.js} +2 -2
  122. package/dist/owletto/dist/assets/use-login-redirect-CfCbEeJR.js +2 -0
  123. package/dist/owletto/dist/assets/use-mention-search-CA-evCDf.js +91 -0
  124. package/dist/owletto/dist/assets/{view-param-filters-DYlqBocg.js → view-param-filters-Bp84PUMd.js} +2 -2
  125. package/dist/owletto/dist/assets/{views-access-required-BVtMfgLh.js → views-access-required-BerT4Z1d.js} +2 -2
  126. package/dist/owletto/dist/index.html +2 -2
  127. package/dist/server-main.bundle.mjs +274 -136
  128. package/npm-shrinkwrap.json +540 -447
  129. package/package.json +4 -2
  130. package/vendor/connector-sdk/package.json +1 -1
  131. package/vendor/core/dist/connector-query-errors.d.ts +6 -0
  132. package/vendor/core/dist/connector-query-errors.js +4 -0
  133. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +2 -0
  134. package/vendor/core/dist/contracts/tools/manage-entity.js +7 -0
  135. package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +2 -0
  136. package/vendor/core/dist/contracts/tools/manage-feeds.js +3 -0
  137. package/vendor/core/dist/contracts/tools/view-host.js +2 -0
  138. package/vendor/core/dist/error-report.js +1 -0
  139. package/vendor/core/package.json +1 -1
  140. package/vendor/views/package.json +1 -1
  141. package/dist/connectors/linkedin-takeout.ts +0 -577
  142. package/dist/connectors/takeout-utils.ts +0 -240
  143. package/dist/owletto/dist/assets/_-CZgmjLR9.js +0 -2
  144. package/dist/owletto/dist/assets/_-Cm5OgtYD.js +0 -3
  145. package/dist/owletto/dist/assets/_-DtqBFgK5.js +0 -2
  146. package/dist/owletto/dist/assets/_agentId-Cci6NFc1.js +0 -2
  147. package/dist/owletto/dist/assets/_agentId-GhWTlPO2.js +0 -2
  148. package/dist/owletto/dist/assets/_automationId-KUlxSTK2.js +0 -2
  149. package/dist/owletto/dist/assets/_connectorKey._connectionId-Zpy7Hvml.js +0 -2
  150. package/dist/owletto/dist/assets/_connectorKey.index-CYDRp9UX.js +0 -2
  151. package/dist/owletto/dist/assets/_conversationId-NNqDdije.js +0 -2
  152. package/dist/owletto/dist/assets/_eventId-0BSX6VHj.js +0 -2
  153. package/dist/owletto/dist/assets/_owner-C-CD22NB.js +0 -3
  154. package/dist/owletto/dist/assets/_shape-CvXp4omb.js +0 -2
  155. package/dist/owletto/dist/assets/_slug-DgK7zpKA.js +0 -2
  156. package/dist/owletto/dist/assets/_viewKey-cH54P0zY.js +0 -2
  157. package/dist/owletto/dist/assets/_viewKey-m0B5j7L9.js +0 -2
  158. package/dist/owletto/dist/assets/activity-link-rXNpmppV.js +0 -2
  159. package/dist/owletto/dist/assets/activity-route-view-B0m7_g9q.js +0 -2
  160. package/dist/owletto/dist/assets/agent-client-setup-list-BmD3-_Ox.js +0 -4
  161. package/dist/owletto/dist/assets/agent-connect-pages-BtOTCsTU.js +0 -2
  162. package/dist/owletto/dist/assets/agent-editor-form-CirqCpcM.js +0 -2
  163. package/dist/owletto/dist/assets/agent-list-row-SyACVYX7.js +0 -2
  164. package/dist/owletto/dist/assets/agent-permissions-matrix-Dsc26dyW.js +0 -2
  165. package/dist/owletto/dist/assets/agent-thread-storage-U6htL3ad.js +0 -2
  166. package/dist/owletto/dist/assets/agents-D1FHZ0jR.js +0 -2
  167. package/dist/owletto/dist/assets/app._appId-01I0CJal.js +0 -2
  168. package/dist/owletto/dist/assets/assist-composer-BD9msDk3.js +0 -2
  169. package/dist/owletto/dist/assets/automation-detail-content-BFv1TglZ.js +0 -2
  170. package/dist/owletto/dist/assets/automation-row-CmTpAD4r.js +0 -2
  171. package/dist/owletto/dist/assets/automation-source-list-D8ZSavQU.js +0 -2
  172. package/dist/owletto/dist/assets/automations-D1FHZ0jR.js +0 -2
  173. package/dist/owletto/dist/assets/change-summary-CGrKEJ04.js +0 -2
  174. package/dist/owletto/dist/assets/clients-6aJvabvS.js +0 -2
  175. package/dist/owletto/dist/assets/connect-BmDziBzI.js +0 -2
  176. package/dist/owletto/dist/assets/connect-menu-Bs8mxsga.js +0 -2
  177. package/dist/owletto/dist/assets/connect._clientId-t5aKu3aa.js +0 -2
  178. package/dist/owletto/dist/assets/connected._clientId-DswMAw8l.js +0 -2
  179. package/dist/owletto/dist/assets/connection-feed-detail-BLCjhP-H.js +0 -2
  180. package/dist/owletto/dist/assets/connector-boxes-BAP_f77M.js +0 -2
  181. package/dist/owletto/dist/assets/connector-page-shell-ClOmVPJr.js +0 -2
  182. package/dist/owletto/dist/assets/connector-provenance-wmYu5jwO.js +0 -2
  183. package/dist/owletto/dist/assets/consent-RqHNkmm8.js +0 -2
  184. package/dist/owletto/dist/assets/copy-button-D6zpsZLi.js +0 -2
  185. package/dist/owletto/dist/assets/create-GT8_yF0R.js +0 -2
  186. package/dist/owletto/dist/assets/create-Yx2qBMBy.js +0 -2
  187. package/dist/owletto/dist/assets/create._connectorKey-CzXqSkuI.js +0 -2
  188. package/dist/owletto/dist/assets/definition-comparison-C3k6Wa9B.js +0 -2
  189. package/dist/owletto/dist/assets/device-pin-tombstone-U7Bx05P6.js +0 -2
  190. package/dist/owletto/dist/assets/device._deviceId-DTZqj1HS.js +0 -2
  191. package/dist/owletto/dist/assets/dynamic-schema-form-DyT_9iVE.js +0 -2
  192. package/dist/owletto/dist/assets/entity-options-CGTjLlcS.js +0 -2
  193. package/dist/owletto/dist/assets/entity-page-DHHMmA8V.js +0 -2
  194. package/dist/owletto/dist/assets/entity-pages-eYbG2FDT.js +0 -2
  195. package/dist/owletto/dist/assets/entity-type-page-CjFqxSdL.js +0 -2
  196. package/dist/owletto/dist/assets/event-card-BtTUuf2q.js +0 -2
  197. package/dist/owletto/dist/assets/event-detail-8xHiplt_.js +0 -2
  198. package/dist/owletto/dist/assets/events-feed-zFnTSE27.js +0 -2
  199. package/dist/owletto/dist/assets/filter-editors-Dd5R2Etd.js +0 -2
  200. package/dist/owletto/dist/assets/home-stream-IVsNEkwp.js +0 -2
  201. package/dist/owletto/dist/assets/index-2oaMOFKe.js +0 -2
  202. package/dist/owletto/dist/assets/index-B4RZgvvI.js +0 -2
  203. package/dist/owletto/dist/assets/index-BBZM53p8.js +0 -2
  204. package/dist/owletto/dist/assets/index-BOb0a5f9.js +0 -2
  205. package/dist/owletto/dist/assets/index-BwnFQcMe.js +0 -2
  206. package/dist/owletto/dist/assets/index-CvYsWYlF.js +0 -2
  207. package/dist/owletto/dist/assets/index-DIXIvtnM.js +0 -2
  208. package/dist/owletto/dist/assets/index-DLwokXHW.js +0 -2
  209. package/dist/owletto/dist/assets/index-_nlPHus1.js +0 -2
  210. package/dist/owletto/dist/assets/index-cwOgj4-i.js +0 -2
  211. package/dist/owletto/dist/assets/index-pp4qmhkA.js +0 -2
  212. package/dist/owletto/dist/assets/index-tTbno-PX.css +0 -1
  213. package/dist/owletto/dist/assets/json-diff-B-1Swv_y.js +0 -28
  214. package/dist/owletto/dist/assets/member-scope-gate-Lj9m4RL2.js +0 -2
  215. package/dist/owletto/dist/assets/memory-browse-page-rAKfVdQ_.js +0 -74
  216. package/dist/owletto/dist/assets/model-selector-onvGA9Ww.js +0 -2
  217. package/dist/owletto/dist/assets/new-BmehH1uR.js +0 -2
  218. package/dist/owletto/dist/assets/new-KDi15LWZ.js +0 -2
  219. package/dist/owletto/dist/assets/organization-B9bh20Xo.js +0 -2
  220. package/dist/owletto/dist/assets/peek-pane-content-Bqus80Mq.js +0 -2
  221. package/dist/owletto/dist/assets/proposal-review-shell-CnACXCUg.js +0 -2
  222. package/dist/owletto/dist/assets/public-shell-ready-Dlh-eWz0.js +0 -2
  223. package/dist/owletto/dist/assets/record-activity-6CfR95Ul.js +0 -2
  224. package/dist/owletto/dist/assets/run-initiator-BvruBM5H.js +0 -2
  225. package/dist/owletto/dist/assets/runs-list-DVhrTr3v.js +0 -2
  226. package/dist/owletto/dist/assets/schema-type-editor-panel-Bdeumkux.js +0 -2
  227. package/dist/owletto/dist/assets/source-record-panels-CBV9tsR3.js +0 -2
  228. package/dist/owletto/dist/assets/use-login-redirect-BqtEilid.js +0 -2
  229. package/dist/owletto/dist/assets/use-mention-search-Bxlpd6Dp.js +0 -96
@@ -1,2 +0,0 @@
1
- import{j as e,bX as B,i as A,a$ as D,b0 as R,b1 as K,go as Y,a6 as Z,bQ as G,bP as J,c0 as V,gp as ee,c1 as P,bB as F,c2 as se,bY as ne,c3 as te,bZ as re,r as k,gq as ae,gr as ie,bU as le,c4 as oe,L as T,gs as ce,gt as de,db as q,gu as ue,gv as me,gw as ge,gx as S,cY as L,X as fe,gy as z,gz as W,gk as xe,dc as he,gA as ye,gB as pe,c7 as be,gC as je}from"./index-B-Ab8srM.js";const ve={auto:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",approval:"bg-amber-500/15 text-amber-600 dark:text-amber-400",deny:"bg-red-500/15 text-red-600 dark:text-red-400"};function Ne({options:n,value:t,floor:o,onChange:a,disabled:i,ariaLabel:m,compact:u}){return e.jsx("div",{role:"radiogroup","aria-label":m,className:A("inline-flex shrink-0 items-stretch gap-0.5 rounded-lg border border-border bg-muted/40 p-0.5"),children:n.map(l=>{const y=Y({option:l,floor:o}),h=l===t,g=y.disabled&&!h,p=B[l],f=e.jsx("button",{type:"button",role:"radio","aria-checked":h,disabled:i||g,onClick:()=>{!h&&!g&&!i&&a(l)},className:A("inline-flex shrink-0 items-center justify-center whitespace-nowrap font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",u?"min-w-[3rem] rounded-md px-2.5 py-1.5 text-xs leading-none":"min-w-[3.25rem] rounded-md px-3 py-1.5 text-sm leading-none",h?A(ve[l],""):"text-muted-foreground hover:bg-background/60 hover:text-foreground",g&&"cursor-not-allowed opacity-40",i&&!g&&"cursor-not-allowed opacity-60"),children:p},l);return g&&y.reason?e.jsxs(D,{children:[e.jsx(R,{asChild:!0,children:e.jsx("span",{className:"inline-flex shrink-0",children:f})}),e.jsx(K,{children:y.reason})]},l):f})})}function Q({children:n,controls:t}){return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-3 py-2",children:[e.jsx("div",{className:"min-w-40 flex-1 text-sm",children:n}),e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:t})]})}const _e=[{resourceClass:"entity",title:"Entities",sub:"Defaults for every entity type."},{resourceClass:"agent_config",title:"Agents",sub:"Defaults for reading and managing agents."}];function ke(n,t,o,a,i=null){const m=z(n.floor,t,o,a,i),u=W(n.floor,t,o,a,i)?m:"auto";return(a!==null||i!==null)&&ye(n.agent,t,o)?pe(u,S(n,t,o,null)):u}function Ae({label:n,response:t,resourceClass:o,action:a,entityTypeSlug:i,targetAgentId:m=null,dimmed:u,pending:l,onSave:y}){const h=z(t.floor,o,a,i,m),g=W(t.floor,o,a,i,m),p=S(t,o,a,i,m),f=ke(t,o,a,i,m),j=be(o,a),b=e.jsx("div",{className:A("inline-flex shrink-0",u&&"opacity-45"),children:e.jsx(Ne,{options:j,value:p,floor:f,disabled:l,compact:!0,ariaLabel:n,onChange:y})});return g?e.jsxs(D,{children:[e.jsx(R,{asChild:!0,children:e.jsx("span",{className:"inline-flex shrink-0",children:b})}),e.jsxs(K,{children:["Org floor ",B[h]," — can only go stricter"]})]}):b}function Se(n,t){const o=i=>i.resource_class===t.resource_class&&(i.entity_type_slug??null)===(t.entity_type_slug??null)&&(i.operation_key??null)===(t.operation_key??null)&&(i.target_agent_id??null)===(t.target_agent_id??null),a=n.map(i=>o(i)?t:i);return a.some(o)?a:[...a,t]}function Ce(n,t,o,a,i,m){const u=je(n,t,o,a);return u[i]=m,u}const $="font-medium text-foreground hover:text-primary hover:underline";function Ee({type:n}){return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(q,{icon:n.icon,className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"font-medium",children:n.name}),e.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:n.slug})]})}function M({label:n,disabled:t,hint:o,searchPlaceholder:a,emptyText:i,children:m}){return t?e.jsxs("div",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:[n,o?` ${o}`:""]}):e.jsx(xe,{contentClassName:"w-[min(100vw-2rem,22rem)]",searchPlaceholder:a,emptyText:i,trigger:u=>e.jsxs("button",{type:"button","aria-expanded":u,className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-xs text-primary hover:bg-muted/50",children:[e.jsx(he,{className:"h-3 w-3"}),n]}),children:u=>m(u)})}function we({pending:n,onClick:t,label:o}){return e.jsx("button",{type:"button",disabled:n,onClick:t,"aria-label":o,className:"rounded p-0.5 text-muted-foreground hover:bg-red-500/10 hover:text-red-600 disabled:opacity-50 dark:hover:text-red-400",children:e.jsx(fe,{className:"h-3 w-3"})})}function $e({owner:n,agentId:t,variant:o="agent"}){const a=o==="org-floor",i=Z(),m=G(n,t??"",{enabled:!a&&!!t}),u=J(n,{enabled:a}),{data:l,isLoading:y,isError:h,error:g}=a?u:m,p=a?V(n):ee(n,t??""),f=P({mutationFn:r=>a?se(n,r):ne(n,t??"",r),onSuccess:r=>{i.setQueryData(p,d=>d&&{...d,agent:Se(d.agent,r)}),i.invalidateQueries({queryKey:p}),a&&i.invalidateQueries({queryKey:["agent-permissions"]})},onError:r=>{F.error(r instanceof Error?r.message:"Failed to save permission")}}),j=P({mutationFn:r=>a?te(n,r):re(n,t??"",r),onSuccess:()=>{i.invalidateQueries({queryKey:p}),a&&i.invalidateQueries({queryKey:["agent-permissions"]})},onError:r=>{F.error(r instanceof Error?r.message:"Failed to remove override")}}),b=f.isPending||j.isPending,C=k.useMemo(()=>l?ae(l):[],[l]),E=k.useMemo(()=>{if(!l)return[];const r=new Set(C.map(d=>d.slug));return l.entity_types.filter(d=>!r.has(d.slug))},[l,C]),v=k.useMemo(()=>l?ie(l):[],[l]),N=k.useMemo(()=>{if(!l)return[];const r=new Set(v.map(d=>d.id));return l.agents.filter(d=>(a||d.id!==t)&&!r.has(d.id))},[l,v,t,a]);if(y)return e.jsx(le,{label:"permissions",variant:"cards",cards:2});if(h||!l)return e.jsx(oe,{label:g instanceof Error?g.message:"permissions"});const x=l,H=(r,d,w,_,s=null)=>{const c=Ce(x,r,d,s,w,_);f.mutate({resource_class:r,effects:c,entity_type_slug:d,target_agent_id:s})},I=x.entity_types.length===0?"— none yet":E.length===0?"— all covered":null,U=N.length===0&&v.length===0?"— no other agents":N.length===0?"— all covered":null;return e.jsxs("div",{className:"space-y-4",children:[a?null:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Manage connector rules and agent restrictions in"," ",e.jsx(T,{to:"/$owner/settings/organization",params:{owner:n},search:{agent:t},hash:"policies",className:$,children:"Organization policies"}),"."]}),_e.map(r=>{const d=r.resourceClass==="entity",w=r.resourceClass==="agent_config",_=[{key:"default",label:"Default",name:"Default",entityTypeSlug:null,targetAgentId:null,owned:!1,diffs:0},...d?C.map(s=>({key:`entity:${s.slug}`,name:s.name,label:e.jsx(T,{to:"/$owner/entity-types/$slug",params:{owner:n,slug:s.slug},className:$,title:`Open ${s.name}`,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(q,{icon:s.icon,className:"h-3.5 w-3.5 shrink-0"}),s.name]})}),entityTypeSlug:s.slug,targetAgentId:null,owned:de(x,s.slug),diffs:ce(x,s.slug)})):v.map(s=>({key:`agent:${s.id}`,name:s.name,label:e.jsx(T,{to:"/$owner/agents/$agentId",params:{owner:n,agentId:s.id},className:$,title:`Open ${s.name}`,children:s.name}),entityTypeSlug:null,targetAgentId:s.id,owned:me(x,s.id),diffs:ue(x,s.id)}))];return e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-medium",children:r.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r.sub})]}),e.jsxs("div",{className:"divide-y overflow-hidden rounded-lg border",children:[_.map(s=>e.jsxs("div",{className:"divide-y",children:[_.length>1&&e.jsx("div",{className:"bg-muted/30",children:e.jsx(Q,{controls:s.owned?e.jsx(we,{pending:b,label:`Remove ${s.name} exception`,onClick:()=>j.mutate({resource_class:r.resourceClass,entity_type_slug:s.entityTypeSlug,target_agent_id:s.targetAgentId})}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.label,s.key!=="default"&&!s.owned?e.jsx("span",{className:"text-xs text-muted-foreground",children:"Organization minimum"}):s.diffs>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.diffs," ",s.diffs===1?"change":"changes"]}):null]})})}),e.jsx("div",{className:"divide-y",children:ge[r.resourceClass].filter(c=>!s.targetAgentId||c!=="create").map(c=>{const O=`${c.charAt(0).toUpperCase()+c.slice(1)} ${d?"entities":"agents"}`;return e.jsx(Q,{controls:e.jsx(Ae,{label:`${s.name}: ${O}`,response:x,resourceClass:r.resourceClass,action:c,entityTypeSlug:s.entityTypeSlug,targetAgentId:s.targetAgentId,dimmed:s.key!=="default"&&S(x,r.resourceClass,c,s.entityTypeSlug,s.targetAgentId)===S(x,r.resourceClass,c,null),pending:b,onSave:X=>H(r.resourceClass,s.entityTypeSlug,c,X,s.targetAgentId)}),children:O},c)})})]},s.key)),e.jsxs("div",{className:"border-t",children:[d?e.jsx(M,{label:"Add type",disabled:b||E.length===0,hint:I,searchPlaceholder:"Search types…",emptyText:"No matching types.",children:s=>E.map(c=>e.jsx(L,{value:`${c.name} ${c.slug}`,onSelect:()=>{f.mutate({resource_class:"entity",effects:{},entity_type_slug:c.slug}),s()},className:"cursor-pointer",children:e.jsx(Ee,{type:c})},c.slug))}):null,w?e.jsx(M,{label:"Add agent",disabled:b||N.length===0,hint:U,searchPlaceholder:"Search agents…",emptyText:"No matching agents.",children:s=>N.map(c=>e.jsxs(L,{value:`${c.name} ${c.id}`,onSelect:()=>{f.mutate({resource_class:"agent_config",effects:{},target_agent_id:c.id}),s()},className:"cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:c.name}),e.jsx("span",{className:"ml-1.5 font-mono text-[10px] text-muted-foreground",children:c.id})]},c.id))}):null]})]})]},r.resourceClass)})]})}export{$e as A,Ne as P,Q as a};
2
- //# sourceMappingURL=agent-permissions-matrix-Dsc26dyW.js.map
@@ -1,2 +0,0 @@
1
- function r(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().replace(/-/g,"").slice(0,12):Math.random().toString(36).slice(2,14)}export{r as n};
2
- //# sourceMappingURL=agent-thread-storage-U6htL3ad.js.map
@@ -1,2 +0,0 @@
1
- import{j as t,O as o}from"./index-B-Ab8srM.js";const n=()=>t.jsx(o,{});export{n as component};
2
- //# sourceMappingURL=agents-D1FHZ0jR.js.map
@@ -1,2 +0,0 @@
1
- import{r as c,iN as b,aW as y,aG as w,ba as C,aJ as u,j as e,al as k,L as i,hy as j,hE as A,B as g,hD as P,i$ as D,g7 as v,gF as B,gG as R,gH as $,A as E,Y as I,f5 as L,j0 as M,az as z}from"./index-B-Ab8srM.js";import{C as O}from"./connector-page-shell-ClOmVPJr.js";function _({ownerSlug:s,appId:a}){const n=c.useMemo(()=>b(s,a,y()),[s,a]),{data:r=[],isLoading:l,isError:d,refetch:N}=w(),[m,x]=c.useMemo(()=>{const t=n?.devicePlatforms;if(!t?.length)return[[],[]];const p=r.filter(o=>{const f=C(o);return f!=null&&t.includes(f)});return[p.filter(o=>u(o,s)),p.filter(o=>!u(o,s))]},[n,r,s]);if(!n)return e.jsxs(k,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"There is no app by that name."}),e.jsx(i,{to:"/$owner/connectors",params:{owner:s},search:{},className:"text-sm text-primary hover:underline",children:"Back to connectors"})]});const h=(n.devicePlatforms?.length??0)>0;return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(O,{header:e.jsx(B,{breadcrumb:e.jsx(R,{crumbs:[e.jsx(i,{to:"/$owner/connectors",params:{owner:s},search:{},className:$,children:"Connectors"},"connectors")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-muted-foreground",children:n.icon}),title:n.name,caption:n.description}),children:[e.jsx("div",{id:"setup",className:"scroll-mt-40",children:e.jsx(j,{title:m.length>0?a==="owletto-chrome"?"Connect another profile":"Connect another device":"Set up",children:e.jsx("div",{className:"space-y-3",children:n.steps.map(t=>e.jsx(G,{step:t},t.label))})})}),h?e.jsx(A,{entries:m.map(t=>({id:t.id,name:v(t),description:D(t,s),tone:t.online?null:"muted",link:P({to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id}})})),isLoading:l,isError:d,onRetry:()=>void N(),action:e.jsx(g,{asChild:!0,variant:"outline",size:"sm",children:e.jsx("a",{href:"#setup",children:"Add connection"})})}):null,h&&!l&&!d&&x.length>0?e.jsxs(j,{title:"Your devices in other workspaces",children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Open a device to connect its capabilities here. Moving it is confirmed first and pauses its connections where it is now."}),e.jsx("ul",{className:"divide-y border-y",children:x.map(t=>e.jsx("li",{children:e.jsxs(i,{to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id},className:"flex items-center justify-between gap-3 py-2.5 text-sm hover:text-primary",children:[e.jsx("span",{className:"font-medium",children:v(t)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Attached to"," ",t.organization_name??"another workspace"]})]})},t.id))})]}):null]})})}function G({step:s}){const[a,n]=c.useState(!1);if(s.href)return e.jsxs("a",{href:s.href,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs font-medium text-primary hover:bg-accent/50",children:[s.label,e.jsx(E,{className:"h-3 w-3"})]});const r=s.command??"";return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.label}),e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-muted/40 p-2.5",children:[e.jsx("pre",{className:"min-w-0 flex-1 overflow-x-auto font-mono text-xs leading-relaxed",children:r}),e.jsxs(g,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-1.5 text-xs",onClick:()=>{typeof navigator>"u"||!navigator.clipboard||navigator.clipboard.writeText(r).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},children:[a?e.jsx(I,{className:"h-3.5 w-3.5"}):e.jsx(L,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"sr-only",children:"Copy"})]})]})]})}function H(){const{owner:s,appId:a}=M.useParams();return e.jsx(z,{owner:s,children:({ownerSlug:n})=>e.jsx(_,{ownerSlug:n,appId:a})})}export{H as component};
2
- //# sourceMappingURL=app._appId-01I0CJal.js.map
@@ -1,2 +0,0 @@
1
- import{c as b,bf as k,r as o,jo as v,j as e,L as f,B as M,jp as P,gK as S}from"./index-B-Ab8srM.js";import{u as y,a as R,M as C}from"./use-mention-search-Bxlpd6Dp.js";import{P as I,s as A}from"./pending-seed-CoFPQ835.js";import{n as E}from"./agent-thread-storage-U6htL3ad.js";import"./index-Vcq4gwWv.js";import"./use-automations-II_YJWtN.js";function $({ownerSlug:i,starters:m,preferredMentionKinds:u,onSent:g}){const x=b(),{data:j=[]}=k(),l=y(C),n=o.useMemo(()=>new Set(u??[]),[u]),N=o.useCallback(async d=>{const t=await l(d);return n.size===0?t:[...t].sort((a,w)=>Number(n.has(w.kind))-Number(n.has(a.kind)))},[n,l]),r=v(j),[s,h]=o.useState(""),p=o.useRef(s);p.current=s;const c=d=>{const t=d.trim();if(!t||!r)return;const a=E();A(a,t),h(""),x(S(i,r.agentId,a)),g?.()};return e.jsxs("div",{className:"rounded-lg border bg-background p-4 transition-colors focus-within:ring-1 focus-within:ring-ring",children:[r?e.jsx(R,{value:s,onChange:h,onSubmit:()=>c(p.current),searchRefs:N,placeholder:"Ask Lobu…",className:"[&_.ProseMirror]:max-h-40 [&_.ProseMirror]:min-h-24 [&_.ProseMirror]:overflow-y-auto"}):e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Bring your"," ",e.jsx(f,{to:"/$owner/agents/connect",params:{owner:i},className:"text-foreground hover:underline",children:"agent"})," ","or"," ",e.jsx(f,{to:"/$owner/agents/new",params:{owner:i},search:{},className:"text-foreground hover:underline",children:"create a new agent"})," ","to get started."]}),e.jsxs("div",{className:"flex items-end justify-between gap-3 pt-2",children:[r&&m&&!s.trim()?e.jsx(I,{prompts:m,onPick:c}):e.jsx("span",{}),e.jsxs(M,{type:"button",size:"icon",className:"h-10 w-10 shrink-0 rounded-full",disabled:!r||!s.trim(),onClick:()=>c(s),children:[e.jsx(P,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Send message"})]})]})]})}export{$ as AssistComposer};
2
- //# sourceMappingURL=assist-composer-BD9msDk3.js.map
@@ -1,2 +0,0 @@
1
- import{v as A,j as e,L as R,cx as $,u as L,W as F,ec as T,e5 as O,r as N,B as M,aq as K,q as I,at as q,cT as H,S as D,cs as B,hr as J,cH as W,cN as V,cU as U,bT as G}from"./index-B-Ab8srM.js";import{E as Q}from"./event-detail-8xHiplt_.js";import{M as X}from"./home-stream-IVsNEkwp.js";import{C as Y,A as z}from"./create-automation-form-B12yTrmj.js";import{P as Z}from"./proposal-review-shell-CnACXCUg.js";import{u as b}from"./runs-BMzp7j7j.js";import{E as ee}from"./events-feed-zFnTSE27.js";import{D as te,a as se}from"./definition-comparison-C3k6Wa9B.js";import{b as k}from"./use-automations-II_YJWtN.js";function C({automationId:t}){const{currentOwner:s}=A();return s?e.jsx(R,{to:"/$owner/events",params:{owner:s},search:$({semanticTypes:["change"],eventCategory:"config",resourceKind:"automation",resourceId:t}),className:"text-sm text-primary underline underline-offset-4",children:"View definition history in Events"}):null}const w={workspace:!0};function ne(t,s){const n=Date.parse(s.created_at)-Date.parse(t.created_at);return n!==0?n:s.id-t.id}function ie(t){const s=t.filter(n=>n.status==="timeout").length;return s===0?"failed":s===t.length?"timed out":"failed or timed out"}function re({owner:t,automationId:s,automationName:n,since:a}){const i=L(),r=[b(w,{runTypes:["automation"],automationIds:[s],status:"failed"},t),b(w,{runTypes:["automation"],automationIds:[s],status:"timeout"},t)],o=a==null?null:Date.parse(a),f=c=>o==null||Date.parse(c.created_at)>o,l=r.map(c=>c.data?.pages[0]?.runs??[]),d=l.flat().filter(f).sort(ne),m=d[0];if(!m)return null;const g=r.some((c,p)=>c.hasNextPage&&l[p]?.every(f)),u=`${d.length}${g?"+":""} ${d.length===1&&!g?"run":"runs"}`,x=m.completed_at??m.created_at,j=m.error_message?.trim();return e.jsxs(R,{to:"/$owner/events",params:{owner:t},search:{run_ids:String(m.id)},className:"flex items-start gap-2 rounded-lg border px-3 py-2 text-xs hover:bg-muted/40",onClick:c=>{!i||c.button!==0||c.metaKey||c.ctrlKey||c.shiftKey||c.altKey||(c.preventDefault(),i.open({href:`/${t}/automations/${s}?view=activity&run_id=${m.id}`,title:n!=null?`${n} · Run #${m.id}`:`Automation run #${m.id}`,runId:m.id}))},children:[e.jsx(F,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-destructive","aria-hidden":!0}),e.jsxs("span",{className:"min-w-0 break-words",children:[e.jsxs("span",{className:"font-medium text-foreground",children:[u,a!=null?" since this result":""," ",ie(d)]}),e.jsxs("span",{className:"text-muted-foreground",children:[j?` · ${j}`:""," ·"," ",e.jsx("time",{dateTime:new Date(x).toISOString(),title:O(x),children:T(x)})]})]})]})}const ae={workspace:!0},oe=6,le=["name","title"],S=10;function y(t){return t==null?!1:typeof t=="string"?t.trim().length>0:Array.isArray(t)?t.some(y):typeof t=="object"?Object.values(t).some(y):!0}function ce(t){const s=t.split("_").join(" ").trim();return s.charAt(0).toUpperCase()+s.slice(1)}function _({value:t,depth:s=0}){if(!y(t))return null;if(typeof t!="object"||t==null)return e.jsx("span",{className:"break-words",children:String(t)});if(s>=oe)return e.jsx("span",{className:"break-words text-muted-foreground",children:JSON.stringify(t).slice(0,200)});if(Array.isArray(t))return e.jsx("ul",{className:"space-y-1.5",children:t.filter(y).map((r,o)=>e.jsx("li",{className:"border-l-2 border-border pl-2",children:e.jsx(_,{value:r,depth:s+1})},o))});const n=t,a=le.find(r=>typeof n[r]=="string"&&y(n[r])),i=Object.entries(n).filter(([r,o])=>r!==a&&y(o));return e.jsxs("div",{className:"space-y-1",children:[a?e.jsx("p",{className:"font-medium text-foreground",children:String(n[a])}):null,i.length>0?e.jsx("dl",{className:"space-y-1",children:i.map(([r,o])=>e.jsxs("div",{children:[e.jsxs("dt",{className:"inline text-muted-foreground",children:[ce(r),":"," "]}),e.jsx("dd",{className:"inline",children:typeof o=="object"?e.jsx("div",{className:"mt-1",children:e.jsx(_,{value:o,depth:s+1})}):e.jsx(_,{value:o,depth:s+1})})]},r))}):null]})}function E({run:t}){const s=t.completed_at??t.created_at;return e.jsx("time",{dateTime:new Date(s).toISOString(),title:O(s),className:"text-xs text-muted-foreground",children:T(s)})}function de({owner:t,automationId:s,failedSince:n}){const a=N.useId(),i=b(ae,{runTypes:["automation"],automationIds:[s],status:"completed"},t),r=i.data?.pages.flatMap(c=>c.runs)??[],o=r.filter(c=>y(c.output)),f=r.length-o.length,[l,...d]=o,m=i.data?.pages.length??0,{hasNextPage:g,isFetching:u,fetchNextPage:x}=i;N.useEffect(()=>{!l&&g&&!u&&m<S&&x()},[l,g,u,m,x]);const j=i.hasNextPage?e.jsx(M,{size:"sm",variant:"outline",disabled:i.isFetching,onClick:()=>void i.fetchNextPage(),children:"Load earlier runs"}):null;return i.isError?e.jsxs("div",{className:"space-y-6 py-6",children:[e.jsx("p",{role:"alert",className:"text-sm text-muted-foreground",children:"Couldn't load this Automation's runs."}),n(null)]}):i.isLoading||!l&&g&&m<S?null:l?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{"aria-label":"Latest result",className:"space-y-2",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("h2",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Latest result"}),e.jsx(E,{run:l})]}),e.jsx("div",{className:"text-sm",children:e.jsx(_,{value:l.output})})]}),n(l.completed_at??l.created_at),d.length>0?e.jsxs("section",{"aria-labelledby":a,className:"space-y-2",children:[e.jsx("h2",{id:a,className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Earlier results"}),e.jsx("ul",{className:"divide-y rounded-lg border",children:d.map(c=>e.jsxs("li",{className:"space-y-1 px-3 py-2 text-xs",children:[e.jsx(E,{run:c}),e.jsx(_,{value:c.output})]},c.id))})]}):null,f>0?e.jsxs("p",{className:"text-xs text-muted-foreground",children:[f," other ",f===1?"run":"runs"," found nothing new."]}):null,j]}):e.jsxs("div",{className:"space-y-6 py-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:r.length===0?"This Automation hasn't run yet. Its results appear here, newest first.":`It ran ${r.length}${i.hasNextPage?"+":""} times without returning a result.`}),n(null),j]})}function P(t){const{orgContext:s,hasOrgContext:n}=A(),{data:a,isLoading:i}=K(`/${t}`,s),{isAuthenticated:r}=I(),{isMember:o,isLoading:f}=q(),l=r&&o,d=a?.workspace,m=l?!n||i||f:i||f;return{organizationId:d?.id??"",isLoading:m}}function be(t){return P(t)}function ue({owner:t,automationId:s}){const n=B(t),a=N.useMemo(()=>J(n.attentionCards.filter(i=>i.automation_id===s).map(i=>{const r=W(i);return{card:i,item:r,repeats:1,unreadIds:r.unread&&r.notificationId!=null?[r.notificationId]:[]}}).sort((i,r)=>r.item.at-i.item.at)),[n.attentionCards,s]);return n.session?n.isLoading?e.jsx(D,{"aria-label":"Loading notifications",className:"mb-6 h-16 w-full"}):n.isError?e.jsx("p",{role:"alert",className:"mb-6 text-sm text-destructive",children:"Could not load notifications. Refresh to try again."}):a.length===0?null:e.jsxs("section",{"aria-label":"Needs you",className:"mb-6 space-y-2",children:[e.jsxs("div",{className:"flex items-baseline gap-2 px-1",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Needs you"}),e.jsx(X,{entries:a,disabled:n.markManyRead.isPending,onMarkRead:i=>void n.markManyRead.mutateAsync(i)})]}),e.jsx("ul",{className:"divide-y overflow-hidden rounded-lg border",children:a.map(({item:i,repeats:r})=>e.jsx("li",{children:e.jsx(V,{owner:t,item:i,variant:"row",tag:r>1?`${r}×`:void 0})},i.id))}),n.markManyRead.data?.failed?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Some notifications could not be marked read. Try again."}):null]}):null}function me({owner:t,automationId:s,organizationId:n}){const a=Number(s),i=N.useMemo(()=>({producedByAutomationId:a}),[a]),o=k(s,void 0,n).data?.automation?.automation_name?.trim()||null;if(!Number.isFinite(a))return null;const f=l=>e.jsx(re,{owner:t,automationId:a,automationName:o,since:l});return e.jsxs(e.Fragment,{children:[e.jsx(ue,{owner:t,automationId:a}),e.jsx(ee,{organizationId:n,ownerSlug:t,filters:i,foldRunSatellites:!1,renderLead:(l,{hasEarlier:d})=>e.jsxs("div",{className:"mb-4 space-y-6",children:[e.jsxs("section",{"aria-label":"Latest result",className:"space-y-2",children:[e.jsx("h2",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Latest result"}),e.jsx(Q,{owner:t,organizationId:n,eventId:l.id})]}),f(l.created_at),d?e.jsx("h2",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Earlier results"}):null]}),emptyState:e.jsx(de,{owner:t,automationId:a,failedSince:f})})]})}function fe({agentId:t,automationId:s,runId:n,organizationId:a,onDone:i}){const[r,o]=N.useState({ready:!1,triggers:[]}),f=N.useCallback(p=>{o(h=>JSON.stringify(h)===JSON.stringify(p)?h:p)},[]),l=k(s,void 0,a,{includeVersions:!0}),d=l.data?.automation,{currentOwner:m}=A(),g=H({queryKey:["automations-list",m,"editor",s,d?.status],enabled:!!m&&!!a&&!!d,queryFn:async()=>{const h=(await U("manage_automations",{action:"list",automation_id:s,status:d?.status,include_details:!0,limit:1},{slug:m})).automations.find(v=>v.automation_id===s);if(!h)throw new G("Automation not found",404);return h},staleTime:3e4}),u=g.data,x=N.useMemo(()=>d&&u?{automation_id:d.automation_id,name:u.name,slug:u.slug,description:u.description,prompt:u.prompt,sources:u.sources,reaction_script:d.reaction_script,managed_agent_id:u.managed_agent_id,device_worker_id:u.device_worker_id,agent_kind:u.agent_kind,delivery_target:u.delivery_target??void 0,execution_config:u.execution_config??void 0,model_config:u.model_config,tags:u.tags,keying_config:d.keying_config,reactions_guidance:u.reactions_guidance,triggers:u.triggers}:void 0,[d,u]),j=e.jsx("div",{className:"flex flex-col gap-4",children:[0,1,2].map(p=>e.jsx(D,{className:"h-16 w-full rounded-lg"},p))}),c=g.isError?e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Could not load the saved Automation definition."}),e.jsx("button",{type:"button",className:"text-primary underline underline-offset-4",onClick:()=>void g.refetch(),children:"Retry"})]}):l.isLoading||d&&g.isPending?j:x?e.jsx(Y,{organizationId:a,prefillAgentId:t??void 0,editingAutomation:x,createFields:{triggers:r.triggers},triggerFields:e.jsx(z,{organizationId:a,initialTriggers:x.triggers??[],onChange:f},JSON.stringify(x.triggers??[])),hideHeader:!0,hideCancel:!0,submitDisabled:!r.ready,onClose:i}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Automation not found. It may have been removed."});return t?e.jsxs("div",{className:"space-y-6",children:[e.jsx(Z,{resource:{kind:"automation",agentId:t,automationId:s},runId:n,onDone:i,children:({reviewMode:p,proposal:h})=>p==="active"?e.jsx(te,{current:h?.current??null,proposed:{...h?.current??{},...h?.proposedAfter??{}},render:v=>e.jsx(se,{value:v})}):p==="loading"?j:p==="error"?null:c}),e.jsx(C,{automationId:s})]}):e.jsxs("div",{className:"space-y-6",children:[c,e.jsx(C,{automationId:s})]})}function Ae({owner:t,agentId:s,automationId:n,view:a,runId:i,onDone:r}){const{organizationId:o}=P(t),f=k(n,void 0,o),l=s??f.data?.automation?.managed_agent_id??null;return i||a==="definition"?e.jsx(fe,{agentId:l,automationId:n,runId:i,organizationId:o,onDone:r},`${t}/${n}`):e.jsx(me,{owner:t,automationId:n,organizationId:o})}export{Ae as A,be as u};
2
- //# sourceMappingURL=automation-detail-content-BFv1TglZ.js.map
@@ -1,2 +0,0 @@
1
- import{f6 as _,f7 as g,cP as j,j as n,L as m,V as x,f8 as w,b6 as b,b7 as A,bb as k,f9 as N}from"./index-B-Ab8srM.js";import{A as h}from"./device-automation-Dp3faMvp.js";const $={event:{label:"Event",icon:j},schedule:{label:"Schedule",icon:g},manual:{label:"Manual",icon:_}};function E(e,i,o){switch(N(e)){case"script":return["Script"];case"external":case"manual":return["Outside client"];case"device":{const t=e.agent_kind,s=t&&t in h?h[t]:t;return[i,o,s].filter(c=>!!c)}case"agent":return[i??"Agent","Hosted"]}}function L(e){const i=e.startsWith("When ")?e.slice(5):e;return i.charAt(0).toUpperCase()+i.slice(1)}function I({automation:e,agentName:i,deviceLabel:o,connectorDisplay:t,owner:s,actions:c,rowClass:f,appearance:p="row"}){const a=e.automation,d=a.automation_id,u=$[e.kind];if(p==="inline")return n.jsxs(m,{to:"/$owner/automations/$automationId",params:{owner:s,automationId:d},search:{view:"definition",run_id:void 0},className:"inline-flex items-center gap-1.5 rounded-md bg-accent px-1.5 py-0.5 text-sm font-medium",children:[n.jsx(u.icon,{className:"h-3.5 w-3.5 shrink-0"}),e.does,a.status==="archived"?n.jsx(x,{variant:"outline",children:"Archived"}):null]});const r=w(e,Date.now()),l=a.processing_client_count??0,v=a.entity_name&&a.entity_type?`${a.entity_name} · ${a.entity_type}`:null;return n.jsxs("div",{className:f,children:[n.jsx(m,{to:"/$owner/automations/$automationId",params:{owner:s,automationId:d},search:{view:"definition",run_id:void 0},className:"flex min-w-0 flex-1 items-center gap-3",children:n.jsx(b,{mark:t?n.jsx(k,{icon:t.icon,iconUrl:t.iconUrl,name:t.name,faviconDomain:t.faviconDomain,className:"h-7 w-7 text-[10px]"}):n.jsx(u.icon,{className:"h-4 w-4 text-muted-foreground"}),name:e.does,badge:a.status==="archived"?n.jsx(x,{variant:"outline",children:"Archived"}):null,tone:r.problem?"destructive":null,details:n.jsx(A,{parts:[r.text,...E(a,i,o),l>0?`${l} ${l===1?"client":"clients"}`:null,L(e.when),v]}),at:r.at})}),c]})}export{I as A};
2
- //# sourceMappingURL=automation-row-CmTpAD4r.js.map
@@ -1,2 +0,0 @@
1
- import{j as e,B as l,X as i}from"./index-B-Ab8srM.js";function x({sources:a,onRemove:s,disabled:n,wrap:r=!1}){return e.jsx(e.Fragment,{children:a.length>0?e.jsx("ul",{className:"space-y-2",children:a.map(t=>e.jsxs("li",{className:"flex items-start gap-2 rounded-lg border bg-background p-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-mono text-xs font-medium",children:t.name}),e.jsx("div",{className:r?"whitespace-pre-wrap break-words text-xs text-muted-foreground":"truncate text-xs text-muted-foreground",children:t.query})]}),s?e.jsx(l,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0","aria-label":`Remove source ${t.name}`,disabled:n,onClick:()=>s?.(t),children:e.jsx(i,{className:"h-3.5 w-3.5"})}):null]},t.query))}):null})}export{x as A};
2
- //# sourceMappingURL=automation-source-list-D8ZSavQU.js.map
@@ -1,2 +0,0 @@
1
- import{j as t,O as o}from"./index-B-Ab8srM.js";const n=()=>t.jsx(o,{});export{n as component};
2
- //# sourceMappingURL=automations-D1FHZ0jR.js.map
@@ -1,2 +0,0 @@
1
- import{j as e,ec as c,V as t}from"./index-B-Ab8srM.js";function i({operation:a}){switch(a){case"create":case"created":return e.jsx(t,{variant:"default",children:"Created"});case"update":case"updated":return e.jsx(t,{variant:"secondary",children:"Updated"});case"delete":case"deleted":return e.jsx(t,{variant:"destructive",children:"Deleted"});default:return e.jsx(t,{variant:"outline",children:a||"Change"})}}function x({operation:a,actor:l,createdAt:s,resource:r,changedFields:n,showAttribution:d=!0}){return e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r?e.jsx("span",{className:"break-words text-sm font-medium",children:r}):null,e.jsx(i,{operation:a}),d?e.jsx("time",{dateTime:s,title:s,className:"ml-auto text-xs text-muted-foreground",children:c(s)}):null]}),d?e.jsxs("p",{className:"break-words text-xs text-muted-foreground",children:["by ",l||"unknown"]}):null,n?.length?e.jsxs("p",{className:"break-words text-xs text-muted-foreground",children:["Changed: ",n.join(", ")]}):null]})}export{x as C};
2
- //# sourceMappingURL=change-summary-CGrKEJ04.js.map
@@ -1,2 +0,0 @@
1
- import{cS as c,cT as u,a6 as d,c1 as p,bB as r,a3 as o,dJ as i,Q as w}from"./index-B-Ab8srM.js";function l(t,s="",e){const n=`${w}/api/${t}/clients${s}`,a=e?.toString();return a?`${n}?${a}`:n}function h(t,s){const e=s?.ownerSlug??c().slug;return u({queryKey:["connected-clients",e,t??null],queryFn:async()=>{if(!e)throw new Error("Workspace required");const n=new URLSearchParams;t&&n.set("agentId",t);const a=await o(l(e,"",n),{credentials:"include"});return await i(a,"Failed to load connected clients"),(await a.json()).clients??[]},enabled:!!e&&(s?.enabled??!0),staleTime:15e3,refetchInterval:s?.refetchInterval})}function y(){const{slug:t}=c(),s=d();return p({mutationFn:async e=>{if(!t)throw new Error("Workspace required");const n=new URLSearchParams;e.scope==="all"&&n.set("scope","all");const a=await o(l(t,`/mcp/${encodeURIComponent(e.clientId)}`,n),{method:"DELETE",credentials:"include"});return await i(a,"Failed to revoke client"),await a.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["connected-clients",t]}),r.success("App access revoked")},onError:e=>{r.error(e.message||"Failed to revoke app access")}})}export{y as a,h as u};
2
- //# sourceMappingURL=clients-6aJvabvS.js.map
@@ -1,2 +0,0 @@
1
- import{j as t,O as o}from"./index-B-Ab8srM.js";const n=()=>t.jsx(o,{});export{n as component};
2
- //# sourceMappingURL=connect-BmDziBzI.js.map
@@ -1,2 +0,0 @@
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
@@ -1,2 +0,0 @@
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
@@ -1,2 +0,0 @@
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 +0,0 @@
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
@@ -1,2 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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,2 +0,0 @@
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
@@ -1,2 +0,0 @@
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
@@ -1,2 +0,0 @@
1
- import{i_ as e,j as t,hB as r}from"./index-B-Ab8srM.js";function a(){const{owner:n,connectorKey:o}=e.useParams();return t.jsx(r,{owner:n,initialConnectorKey:o})}export{a as component};
2
- //# sourceMappingURL=create._connectorKey-CzXqSkuI.js.map
@@ -1,2 +0,0 @@
1
- import{r as y,j as e,eW as fe,H as h,eA as v,I as w,$ as je,bt as be,bu as ye,bv as Ne,bw as ve,bx as L,eX as we,bC as M,eY as Te,eZ as F,e_ as Ce,e$ as Me,f0 as Ie,f1 as Se,f2 as G,bF as Ae,B as _e}from"./index-B-Ab8srM.js";import{A as $e}from"./automation-source-list-D8ZSavQU.js";import{S as Fe}from"./schema-value-BUgC0Ro8.js";import{C as De,J as Re}from"./json-diff-B-1Swv_y.js";const Ee=72,Oe=2e3;function Pe({value:s,onChange:t,section:a="all",create:r=!1,disabled:l=!1,loading:m=!1,modelsEditor:d,sandboxes:x=[],includedFields:g}){const o=y.useId(),i=n=>!g||g.includes(n),{name:c,description:f,identityMd:te,soulMd:ne,userMd:ae,models:re,showToolCalls:ie,sandboxId:S,starters:A}=s,j=(n,b)=>t?.({...s,[n]:b}),oe=n=>j("name",n),de=n=>j("description",n),le=n=>j("identityMd",n),ce=n=>j("soulMd",n),ue=n=>j("userMd",n),me=n=>j("showToolCalls",n),xe=n=>j("sandboxId",n),E=n=>j("starters",n),O=r,p=l||!t,he=m,pe=r||a==="settings"||a==="all",ge=!r&&(a==="identity"||a==="settings"||a==="all"),P=!r&&(a==="settings"||a==="all"),k=!r&&(a==="models"||a==="all");return e.jsxs("div",{className:"grid content-start gap-4 py-2",children:[ge?he?e.jsx(fe,{rows:4}):e.jsxs(e.Fragment,{children:[i("identityMd")?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:`${o}-identity-md`,children:"Identity"}),e.jsx(v,{id:`${o}-identity-md`,rows:6,value:te,onChange:n=>le(n.target.value),readOnly:p,placeholder:"You are a market intelligence agent. Track competitors, analyze launches and signals, and surface concise, decision-ready insights."})]}):null,i("soulMd")?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:`${o}-soul-md`,children:"Soul"}),e.jsx(v,{id:`${o}-soul-md`,rows:6,value:ne,onChange:n=>ce(n.target.value),readOnly:p,placeholder:"Be rigorous, skeptical of weak signals, and calm under ambiguity. Prefer crisp summaries, explicit evidence, and clear confidence levels."})]}):null,i("userMd")?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:`${o}-user-md`,children:"User prompt"}),e.jsx(v,{id:`${o}-user-md`,rows:6,value:ae,onChange:n=>ue(n.target.value),readOnly:p,placeholder:"Monitor the market for notable competitor moves, pricing changes, launches, partnerships, and customer sentiment shifts. Summarize what changed, why it matters, and what to watch next."})]}):null]}):null,pe?e.jsxs(e.Fragment,{children:[i("name")?e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(h,{htmlFor:`${o}-agent-name`,children:["Name ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(w,{id:`${o}-agent-name`,placeholder:"Support Bot",value:c,onChange:n=>oe(n.target.value),readOnly:p,required:!0}),O?e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"The agent ID will be generated automatically from the name."}):null]}):null,O||!i("description")?null:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:`${o}-agent-description`,children:"Description"}),e.jsx(v,{id:`${o}-agent-description`,placeholder:"Handles customer support and triage across channels.",value:f,onChange:n=>de(n.target.value),readOnly:p,rows:3})]})]}):null,P&&i("showToolCalls")?e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border bg-muted/20 p-3",children:[e.jsx(je,{id:`${o}-show-tool-calls`,checked:ie,onCheckedChange:n=>me(n===!0),disabled:p,className:"mt-0.5"}),e.jsxs("div",{className:"grid gap-0.5",children:[e.jsx(h,{htmlFor:`${o}-show-tool-calls`,className:"cursor-pointer",children:"Show tool calls in chat"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Render the agent's tool invocations (name, arguments, and result) as cards in the web chat. Off by default."})]})]}):null,P&&i("starters")?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{children:"Conversation starters"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to three prompts offered on a new chat, on the web and in Slack. The message is sent as the user when tapped."}),A.map((n,b)=>e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[12rem_1fr]",children:[e.jsx(w,{"aria-label":`Starter ${b+1} title`,placeholder:"Plan this week",maxLength:Ee,value:n.title,onChange:_=>E(A.map((N,$)=>$===b?{...N,title:_.target.value}:N)),readOnly:p}),e.jsx(w,{"aria-label":`Starter ${b+1} message`,placeholder:"Plan this week's posts from what's trending",maxLength:Oe,value:n.message,onChange:_=>E(A.map((N,$)=>$===b?{...N,message:_.target.value}:N)),readOnly:p})]},b))]}):null,k&&i("models")?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{children:"Models"}),d??e.jsx("ol",{className:"grid gap-2",children:re.map(n=>e.jsx("li",{className:"rounded-lg border px-3 py-2 text-sm",children:n},n))}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Ordered list; the first is the default. Only these models may be used — a request for anything else falls back to the first available one. Leave empty to use the org default."})]}):null,k&&i("sandboxId")?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:`${o}-agent-sandbox`,children:"Run in sandbox"}),t?e.jsxs(be,{value:S,onValueChange:xe,disabled:p,children:[e.jsx(ye,{id:`${o}-agent-sandbox`,className:"w-full",children:e.jsx(Ne,{placeholder:"Built-in"})}),e.jsxs(ve,{children:[e.jsx(L,{value:"builtin",children:"Built-in (default)"}),x.map(n=>e.jsxs(L,{value:n.id,children:[n.name," (",n.providerKind,")",n.connected?"":" — no credential"]},n.id))]})]}):e.jsx(w,{"aria-label":"Run in sandbox",value:S==="builtin"?"Built-in (default)":S,readOnly:!0}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Where this agent's commands execute. Built-in runs in-process; sandboxes run on a connected provider. Manage sandboxes under Connect › Runtime."})]}):null]})}function q(s){return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}function u(s){return typeof s=="string"?s:""}function z(s){return Array.isArray(s)?s.map(q):[]}function ke(s){return Array.isArray(s)?s.filter(t=>typeof t=="string"):[]}function T({label:s,children:t}){return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:s}),t]})}function D({label:s,value:t,multiline:a=!1}){return e.jsxs(h,{className:"grid gap-2",children:[e.jsx("span",{children:s}),t===void 0?e.jsx("span",{className:"text-sm text-muted-foreground",children:"Not included in snapshot"}):t===null?e.jsx("span",{className:"text-sm text-muted-foreground",children:"Not set"}):a?e.jsx(v,{value:u(t),readOnly:!0,rows:6}):e.jsx(w,{value:u(t),readOnly:!0})]})}function C({value:s}){return s===null?e.jsx("span",{className:"text-muted-foreground",children:"Not set"}):Array.isArray(s)?s.length?e.jsx("ol",{className:"grid gap-3",children:s.map((t,a)=>e.jsx("li",{className:"min-w-0 rounded-lg border p-3",children:e.jsx(C,{value:t})},a))}):e.jsx("span",{className:"text-muted-foreground",children:"Empty list"}):s&&typeof s=="object"?e.jsx("dl",{className:"grid gap-3",children:Object.entries(s).map(([t,a])=>e.jsxs("div",{className:"grid min-w-0 gap-1",children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:t.replaceAll("_"," ")}),e.jsx("dd",{className:"min-w-0 whitespace-pre-wrap text-sm",children:e.jsx(C,{value:a})})]},t))}):s===""?e.jsx("span",{className:"text-muted-foreground",children:"Empty text"}):e.jsx(Fe,{value:s})}function K({value:s,omit:t}){const a=Object.entries(s).filter(([r])=>!t.includes(r));return a.length?e.jsx(T,{label:"Settings",children:e.jsx("dl",{className:"grid gap-4",children:a.map(([r,l])=>e.jsxs("div",{className:"grid min-w-0 gap-1",children:[e.jsx("dt",{className:"text-sm text-muted-foreground",children:r.replaceAll("_"," ")}),e.jsx("dd",{className:"min-w-0 text-sm",children:e.jsx(C,{value:l})})]},r))})}):null}function Ye({value:s}){const t=z(s.sources).map(a=>({name:u(a.name),query:u(a.query)}));return e.jsxs("div",{className:"grid gap-6 py-2 [&_.cm-content_span]:text-inherit",children:[e.jsx(D,{label:"Name",value:s.name}),e.jsx(D,{label:"Description",value:s.description}),e.jsx(D,{label:"Instructions",value:s.prompt,multiline:!0}),e.jsx(T,{label:"Sources",children:s.sources===void 0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Not included in snapshot"}):t.length?e.jsx($e,{sources:t,wrap:!0}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No sources."})}),e.jsx(T,{label:"When",children:s.triggers===void 0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Not included in snapshot"}):Array.isArray(s.triggers)&&s.triggers.length?e.jsx(C,{value:s.triggers}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manual only."})}),s.outputs!==void 0?e.jsx(T,{label:"Outputs",children:e.jsx(C,{value:s.outputs})}):null,typeof s.reaction_script=="string"?e.jsx(T,{label:"Code",children:e.jsx(De,{value:s.reaction_script,language:"typescript",readonly:!0})}):null,e.jsx(K,{value:s,omit:["name","description","prompt","sources","triggers","outputs","reaction_script"]})]})}function Ze({value:s}){const t=q(s.settings);return e.jsxs("div",{className:"grid gap-6",children:[e.jsx(Pe,{includedFields:[...s.name!==void 0?["name"]:[],...s.description!==void 0?["description"]:[],...s.identity_md!==void 0||s.identityMd!==void 0?["identityMd"]:[],...s.soul_md!==void 0||s.soulMd!==void 0?["soulMd"]:[],...s.user_md!==void 0||s.userMd!==void 0?["userMd"]:[],...s.models!==void 0||t.models!==void 0?["models"]:[],...s.showToolCalls!==void 0||t.showToolCalls!==void 0?["showToolCalls"]:[],...s.sandboxId!==void 0||t.sandboxId!==void 0?["sandboxId"]:[],...s.starters!==void 0?["starters"]:[]],value:{name:u(s.name),description:u(s.description),identityMd:u(s.identity_md??s.identityMd),soulMd:u(s.soul_md??s.soulMd),userMd:u(s.user_md??s.userMd),models:ke(s.models??t.models),showToolCalls:(s.showToolCalls??t.showToolCalls)===!0,sandboxId:u(s.sandboxId??t.sandboxId)||"builtin",starters:z(s.starters).map(a=>({title:u(a.title),message:u(a.message)}))}}),e.jsx(K,{value:s,omit:["name","description","identity_md","identityMd","soul_md","soulMd","user_md","userMd","models","showToolCalls","sandboxId","starters"]})]})}var I="Tabs",[Le]=Ae(I,[G]),H=G(),[Ve,R]=Le(I),U=y.forwardRef((s,t)=>{const{__scopeTabs:a,value:r,onValueChange:l,defaultValue:m,orientation:d="horizontal",dir:x,activationMode:g="automatic",...o}=s,i=Me(x),[c,f]=Ie({prop:r,onChange:l,defaultProp:m??"",caller:I});return e.jsx(Ve,{scope:a,baseId:Se(),value:c,onValueChange:f,orientation:d,dir:i,activationMode:g,children:e.jsx(M.div,{dir:i,"data-orientation":d,...o,ref:t})})});U.displayName=I;var W="TabsList",X=y.forwardRef((s,t)=>{const{__scopeTabs:a,loop:r=!0,...l}=s,m=R(W,a),d=H(a);return e.jsx(Ce,{asChild:!0,...d,orientation:m.orientation,dir:m.dir,loop:r,children:e.jsx(M.div,{role:"tablist","aria-orientation":m.orientation,...l,ref:t})})});X.displayName=W;var J="TabsTrigger",Y=y.forwardRef((s,t)=>{const{__scopeTabs:a,value:r,disabled:l=!1,...m}=s,d=R(J,a),x=H(a),g=ee(d.baseId,r),o=se(d.baseId,r),i=r===d.value;return e.jsx(Te,{asChild:!0,...x,focusable:!l,active:i,children:e.jsx(M.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":o,"data-state":i?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:g,...m,ref:t,onMouseDown:F(s.onMouseDown,c=>{!l&&c.button===0&&c.ctrlKey===!1?d.onValueChange(r):c.preventDefault()}),onKeyDown:F(s.onKeyDown,c=>{[" ","Enter"].includes(c.key)&&d.onValueChange(r)}),onFocus:F(s.onFocus,()=>{const c=d.activationMode!=="manual";!i&&!l&&c&&d.onValueChange(r)})})})});Y.displayName=J;var Z="TabsContent",Q=y.forwardRef((s,t)=>{const{__scopeTabs:a,value:r,forceMount:l,children:m,...d}=s,x=R(Z,a),g=ee(x.baseId,r),o=se(x.baseId,r),i=r===x.value,c=y.useRef(i);return y.useEffect(()=>{const f=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(f)},[]),e.jsx(we,{present:l||i,children:({present:f})=>e.jsx(M.div,{"data-state":i?"active":"inactive","data-orientation":x.orientation,role:"tabpanel","aria-labelledby":g,hidden:!f,id:o,tabIndex:0,...d,ref:t,style:{...s.style,animationDuration:c.current?"0s":void 0},children:f&&m})})});Q.displayName=Z;function ee(s,t){return`${s}-trigger-${t}`}function se(s,t){return`${s}-content-${t}`}var Be=U,Ge=X,qe=Y,ze=Q;function Ke({defaultValue:s,children:t}){return e.jsx(Be,{defaultValue:s,className:"space-y-4",children:t})}function He({label:s="Views",children:t}){return e.jsx(Ge,{"aria-label":s,className:"flex flex-wrap gap-1 border-b pb-2",children:t})}function V({value:s,children:t}){return e.jsx(qe,{value:s,asChild:!0,children:e.jsx(_e,{type:"button",variant:"ghost",size:"sm",className:"data-[state=active]:bg-secondary data-[state=active]:text-secondary-foreground",children:t})})}function B({value:s,children:t}){return e.jsx(ze,{value:s,children:t})}function Qe({current:s,proposed:t,render:a}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(Ke,{defaultValue:"proposed",children:[e.jsxs(He,{label:"Definition version",children:[e.jsx(V,{value:"current",children:"Current"}),e.jsx(V,{value:"proposed",children:"Proposed"})]}),e.jsx(B,{value:"current",children:s?a(s):e.jsx("p",{className:"py-4 text-sm text-muted-foreground",children:"No current definition."})}),e.jsx(B,{value:"proposed",children:t?a(t):e.jsx("p",{className:"py-4 text-sm text-muted-foreground",children:"This definition will be removed."})})]}),e.jsxs("details",{className:"text-sm",children:[e.jsx("summary",{className:"cursor-pointer rounded-sm py-2 text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Show technical diff"}),e.jsx(Re,{before:s,after:t})]})]})}export{Ze as A,Qe as D,B as T,Ye as a,V as b,He as c,Ke as d,Pe as e};
2
- //# sourceMappingURL=definition-comparison-C3k6Wa9B.js.map
@@ -1,2 +0,0 @@
1
- import{r as j,iR as v,j as e,iS as f,iT as g,hy as C,iU as k,B as A,L as E,dc as I,iV as P,iW as N,iX as O,iY as w,u as F,iZ as $,h_ as L}from"./index-B-Ab8srM.js";import{R}from"./detail-page-skeleton-I5_7FkKx.js";function z({connection:s,connectorDef:t,ownerSlug:i,openSettings:n=!1,authResult:o,showActivity:r=!0,embedded:a=!1,showShare:c=!0}){const[l,d]=j.useState(n);j.useEffect(()=>{n&&d(!0)},[n]);const u=s.id,m=s.connector_key,p=s.facets?.chat??!1,h=p?"Channels":"Feeds",_=s.has_operations===!0,x=s.feed_count>0||v(t),y=e.jsx(w,{connection:s,connectorDef:t,ownerSlug:i,showShare:c});return e.jsxs("div",{className:"space-y-6",children:[o&&e.jsx(f,{result:o}),s.auth_profile_kind==="oauth_account"&&e.jsx(g,{connection:s,connectorDef:t,onReview:()=>{d(!0),requestAnimationFrame(()=>document.getElementById("connection-auth")?.scrollIntoView({block:"nearest"}))}}),(x||_)&&e.jsxs("div",{className:a?"space-y-6":"grid grid-cols-1 items-start gap-3 sm:grid-cols-2",children:[x&&(a?e.jsx(C,{title:h,count:s.feed_count===1?"1 source":`${s.feed_count} sources`,action:v(t)?e.jsx(A,{asChild:!0,size:"sm",variant:"outline",children:e.jsxs(E,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:i,connectorKey:m,connectionId:String(u)},search:{addFeed:!0},children:[e.jsx(I,{className:"h-3.5 w-3.5"}),p?"Add channel":"Add source"]})}):null,children:e.jsx(k,{connection:s,ownerSlug:i,connectorKey:m,connectorDef:t})}):e.jsx(P,{connection:s,ownerSlug:i,title:h})),_&&(a?e.jsx(N,{connection:s,ownerSlug:i}):e.jsx(S,{connection:s,ownerSlug:i}))]}),a?e.jsx(O,{title:"Connection settings",summary:"name, visibility, credentials, remove",open:l,onOpenChange:d,children:y}):y,r&&e.jsx(C,{title:"Runs",children:e.jsx(R,{scope:{connectionId:u},ownerSlug:i})})]})}function S({connection:s,ownerSlug:t}){const i=F(),{data:n=[],isLoading:o,isError:r}=$(s.id),a=n.filter(l=>l.readiness==="scope_upgrade_required").length,c=o?"Loading actions…":r?"Could not load actions — open to retry":`${n.length} actions${a?` · ${a} need additional provider access`:" · permissions and approval policy"}`;return e.jsx(L,{title:"Actions",summary:c,onOpen:()=>i?.open({href:"",title:"Actions",connectorPanel:{section:"actions",connectionId:s.id,connectorKey:s.connector_key,organizationId:s.organization_id,ownerSlug:t}})})}const b=new Set(["Device was removed","Device was moved to another workspace"]);function K(s){const t=s.error_message??null;return!t||!b.has(t)?t:!!s.device_worker_id&&(s.device_last_seen_at!=null||s.device_worker_handle!=null||s.device_label!=null)?null:t}export{z as C,K as c};
2
- //# sourceMappingURL=device-pin-tombstone-U7Bx05P6.js.map
@@ -1,2 +0,0 @@
1
- import{aQ as F,iF as ne,iG as G,r as j,j as e,iH as P,B as b,ab as L,g7 as C,aH as J,aB as te,hy as z,S as Q,ba as M,dZ as ae,d$ as ie,C as ce,e4 as oe,d9 as re,iI as le,a1 as de,c as me,aG as ue,iJ as xe,iK as he,iL as pe,aJ as ge,aC as fe,al as A,b9 as T,L as E,iM as ve,iN as je,aW as ye,iO as be,iP as Ne,W as ke,gF as _e,iA as q,I as we,bg as Ce,eI as Se,gG as $e,gH as H,ec as De,iQ as K,az as Pe}from"./index-B-Ab8srM.js";import{C as Le}from"./connector-page-shell-ClOmVPJr.js";import{D as ze,R as Ie}from"./detail-page-skeleton-I5_7FkKx.js";import{S as Ae,g as Ee}from"./status-variants-DT61YfsU.js";import{c as U,C as Re}from"./device-pin-tombstone-U7Bx05P6.js";import{w as R}from"./workspace-label-o_QfBuCM.js";import"./list-skeleton-BAqT0vxo.js";import"./runs-BMzp7j7j.js";import"./filter-editors-Dd5R2Etd.js";import"./runs-list-DVhrTr3v.js";import"./run-initiator-BvruBM5H.js";import"./use-automations-II_YJWtN.js";import"./clients-6aJvabvS.js";function Me(s,n,o){const h=new Set(s.capabilities??[]),m=new Set(s.connectors.filter(t=>t.organization_slug===o).map(t=>t.connector_key)),r=new Set(V(s,o).map(t=>t.connector_key));return n.filter(t=>F(t)&&!!t.required_capability&&h.has(t.required_capability)&&!m.has(t.key)&&!r.has(t.key))}function V(s,n){return s.organization_slug===n?s.update_required:[]}function Be(s,n,o){const h=s.organization_slug;if(!h||h===o)return[];const m=new Set(n.map(t=>t.key)),r=new Set(s.connectors.filter(t=>t.organization_slug===o).map(t=>t.connector_key));return s.connectors.filter(t=>t.organization_slug!==h||m.has(t.connector_key)||r.has(t.connector_key)?!1:(r.add(t.connector_key),!0))}function Te({device:s,organizationId:n,ownerSlug:o,connectable:h,unavailable:m}){const r=ne(),t=G(),[u,p]=j.useState(null),[f,a]=j.useState(null),[g,N]=j.useState(null),[v,d]=j.useState([]),x=s.organization_id===n,y=async i=>{p(null),N(null),a(i.key);try{x||await t.mutateAsync({deviceWorkerId:s.id,organizationId:n});const w=await r.mutateAsync({connector_key:i.key,device_worker_id:s.id}),S=w.connection_id??w.connection?.id;if(S===void 0)throw new Error(w.instructions??"The connection was not created.");d($=>[...$.filter(D=>D.connectorKey!==i.key),{connectorKey:i.key,name:i.name,connectionId:S,instructions:w.status==="setup_required"?w.instructions:void 0}])}catch(w){N({key:i.key,message:w instanceof Error?w.message:"Could not connect."})}finally{a(null)}},k=new Set(v.map(i=>i.connectorKey)),l=V(s,o),c=h.filter(i=>!k.has(i.key));return e.jsxs("div",{className:"mt-4 space-y-3",children:[v.map(i=>e.jsx(qe,{outcome:i,device:s,organizationId:n},i.connectorKey)),c.length>0?e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium",children:"Supported by this device"}),e.jsxs("p",{className:"mb-2 text-xs text-muted-foreground",children:["Not connected in this workspace yet.",x?null:" Connecting one moves the device here; you will be asked to confirm first."]}),e.jsx("div",{className:"divide-y border-y",children:c.map(i=>e.jsxs("div",{className:"space-y-2 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"min-w-0 flex-1 text-sm font-medium",children:[i.name,i.required_capability&&P[i.required_capability]&&P[i.required_capability]!==i.name?e.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:P[i.required_capability]}):null]}),e.jsxs(b,{size:"sm",variant:"outline","aria-label":`Connect ${i.name}`,disabled:f!==null,onClick:()=>x?void y(i):p(i.key),children:[f===i.key?e.jsx(L,{className:"mr-1.5"}):null,"Connect"]})]}),u===i.key?e.jsx(Y,{device:s,ownerSlug:o,title:"Move device to this workspace",intro:`${C(s)} lives in ${s.organization_name??"another workspace"}. A device serves one workspace at a time, so it has to move here before it can be connected.`,confirmLabel:"Move here and connect",onConfirm:()=>void y(i),onCancel:()=>p(null)}):null,g?.key===i.key?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:g.message}):null]},i.key))})]}):null,l.length>0?e.jsxs("div",{role:"status",children:[e.jsx("p",{className:"text-xs font-medium",children:"Update Lobu on this device"}),e.jsx("ul",{className:"mt-1 space-y-1 text-xs text-muted-foreground",children:l.map(i=>e.jsx("li",{children:`${i.display_name} — this device has ${i.device_version}, this workspace uses ${i.workspace_version}`},i.connector_key))})]}):null,m.length>0?e.jsx("ul",{className:"space-y-1 text-xs text-muted-foreground",children:m.map(i=>e.jsx("li",{children:`${i.display_name} — set up on this device in ${s.organization_name??"its home workspace"}, not available in this workspace yet`},i.connector_key))}):null]})}function Y({device:s,ownerSlug:n,title:o,intro:h,aftermath:m,confirmLabel:r,pending:t=!1,onConfirm:u,onCancel:p}){const f=s.connector_count,a=s.connectors.filter(g=>g.organization_slug===n).length;return e.jsxs("div",{role:"alertdialog","aria-label":o,className:"space-y-2 rounded-lg bg-amber-500/10 px-3 py-2 text-xs",children:[e.jsx("p",{children:h}),e.jsxs("p",{className:"text-muted-foreground",children:[f>0?`Moving pauses and unpins all ${f} connection${f===1?"":"s"} pinned to it${a>0?`, including ${a} in this workspace`:""}. They stay paused until you reconnect them.`:"It has no pinned connections, so nothing is paused.",m?` ${m}`:null]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(b,{size:"sm",disabled:t,onClick:u,children:[t?e.jsx(L,{className:"mr-1.5"}):null,r]}),e.jsx(b,{size:"sm",variant:"ghost",disabled:t,onClick:p,children:"Cancel"})]})]})}function qe({outcome:s,device:n,organizationId:o}){const{data:h=[],isLoading:m}=J(o,{connectionIds:[s.connectionId]}),r=h.find(p=>p.id===s.connectionId),t=C(n);if(m)return e.jsxs("p",{role:"status",className:"text-sm text-muted-foreground",children:["Checking ",s.name,"…"]});const u=[];if(!r)u.push(`${s.name} was created but could not be loaded yet.`);else if(r.status!=="active"){const p=U(r);u.push(`${s.name} is ${r.status}${p?`: ${p}`:"."}`)}return s.instructions&&u.push(s.instructions),n.online||u.push(`${t} is offline. ${s.name} runs once it reconnects.`),e.jsx("div",{role:"status",className:"rounded-lg border px-3 py-2 text-sm",children:u.length===0?e.jsxs("p",{children:[s.name," is ready on ",t,"."]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"font-medium",children:[s.name," connected, not ready yet"]}),e.jsx("ul",{className:"mt-1 list-disc pl-4 text-xs text-muted-foreground",children:u.map(p=>e.jsx("li",{children:p},p))})]})})}function O({device:s,organizationId:n,ownerSlug:o,selectedConnection:h,openSettings:m}){const{data:r=[],isLoading:t,isError:u,refetch:p}=te(n),f=new Map(r.map(d=>[d.key,d])),a=new Map,g=[];for(const d of s.connectors){if(d.organization_slug!==o)continue;const x=f.get(d.connector_key);if(!x||!F(x)){g.push(d);continue}const y=x.required_capability??`connector:${x.key}`,k=a.get(y)??{key:y,name:x.name,connections:[]};k.name=P[y]??x.name,k.connections.push(d),a.set(y,k)}const N=Me(s,r,o),v=Be(s,r,o);return e.jsxs(e.Fragment,{children:[e.jsxs(z,{title:"Capabilities",children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Manage the native connections available to this workspace."}),s.online?null:e.jsx("p",{className:"mb-3 text-sm text-muted-foreground",children:"This device is offline. You can edit its settings; actions and sync need it to reconnect."}),!n||t?e.jsx(Q,{className:"h-24 w-full"}):u?e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Could not load capability settings."}),e.jsx(b,{variant:"outline",size:"sm",onClick:()=>void p(),children:"Retry"})]}):a.size===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No native connections on this device in this workspace."}):e.jsx("div",{className:"divide-y border-y",children:[...a.values()].map(d=>e.jsx(W,{group:d,deviceId:s.id,organizationId:n,ownerSlug:o,definitionsByKey:f,selectedConnection:h,openSettings:m},d.key))}),n&&!t&&!u?e.jsx(Te,{device:s,organizationId:n,ownerSlug:o,connectable:N,unavailable:v}):null,M(s)==="macos"?e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Manage macOS permissions in the Lobu app on this device."}):null]}),n&&g.length>0&&!t&&!u?e.jsxs(z,{title:"Apps and sources",count:String(g.length),children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Apps and sources that use this device."}),e.jsx("div",{className:"divide-y border-y",children:[...new Set(g.map(d=>d.connector_key))].map(d=>e.jsx(W,{group:{key:d,name:f.get(d)?.name??d,connections:g.filter(x=>x.connector_key===d)},deviceId:s.id,organizationId:n,ownerSlug:o,definitionsByKey:f,selectedConnection:h,openSettings:m},d))})]}):null]})}function W({group:s,deviceId:n,organizationId:o,ownerSlug:h,definitionsByKey:m,selectedConnection:r,openSettings:t}){const u=s.connections.some(a=>a.connection_id===r),[p,f]=j.useState(u);return j.useEffect(()=>{u&&r!==void 0&&f(!0)},[u,r]),e.jsxs(ae,{open:p,onOpenChange:f,children:[e.jsxs(ie,{className:"group flex w-full items-center gap-3 py-3 text-left",children:[e.jsx(ce,{className:"size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90"}),e.jsx("span",{className:"min-w-0 flex-1 text-sm font-medium",children:s.name}),e.jsx("span",{className:"text-right text-xs text-muted-foreground",children:s.connections.some(a=>a.status==="error"||a.status==="revoked")?"Needs attention":s.connections.length>1?`${s.connections.length} connections`:"Configured"})]}),e.jsx(oe,{className:"pb-4 pl-6",children:e.jsx("div",{className:"space-y-5",children:s.connections.map(a=>e.jsx(He,{summary:a,deviceId:n,organizationId:o,ownerSlug:h,connectorDef:m.get(a.connector_key),openSettings:a.connection_id===r&&t},a.connection_id))})})]})}function He({summary:s,deviceId:n,organizationId:o,ownerSlug:h,connectorDef:m,openSettings:r}){const{data:t=[],isLoading:u,isError:p,refetch:f}=J(o,{connectionIds:[s.connection_id]}),a=t.find(v=>v.id===s.connection_id&&v.device_worker_id===n),g=m?.name??s.connector_key,N=a?U(a):null;return e.jsxs("section",{id:`connection-${s.connection_id}`,"aria-label":g,className:"scroll-mt-24",children:[a?e.jsxs("div",{className:"mb-3 flex items-baseline justify-between gap-3 text-xs text-muted-foreground",children:[e.jsx("span",{children:re(a)}),e.jsx("span",{children:a.status})]}):null,u||!o?e.jsx(Q,{className:"h-24 w-full"}):p?e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Could not load this connection."}),e.jsx(b,{variant:"outline",size:"sm",onClick:()=>void f(),children:"Retry"})]}):a?e.jsxs(e.Fragment,{children:[N?e.jsx("p",{role:"alert",className:"mb-4 text-sm text-destructive",children:N}):null,e.jsx("div",{className:"mb-4",children:e.jsx(le,{connection:a})}),e.jsx(Re,{connection:a,connectorDef:m,ownerSlug:h,openSettings:r,showActivity:!1,showShare:!1,embedded:!0})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection is no longer available on this device."})]})}function Ke({device:s,ownerSlug:n}){const o=j.useId(),{data:h=[]}=de(),m=G(),[r,t]=j.useState(!1),[u,p]=j.useState(null),[f,a]=j.useState(null),g=h.filter(l=>l.is_member).map(l=>({id:l.id,name:l.name,isPersonal:l.is_personal===!0})),N=g.find(l=>l.id===s.organization_id),v=N?R(N):s.organization_name??"No workspace",d=g.filter(l=>l.id!==s.organization_id),x=d.find(l=>l.id===u)??null,y=()=>{t(!1),p(null)},k=async l=>{a(null);try{await m.mutateAsync({deviceWorkerId:s.id,organizationId:l}),y()}catch(c){a(c instanceof Error?c.message:"Could not move the device.")}};return e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Workspace: "}),v]}),!r&&d.length>0?e.jsx(b,{size:"sm",variant:"outline",onClick:()=>{a(null),t(!0)},children:"Change workspace"}):null]}),r?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("label",{htmlFor:o,className:"text-xs text-muted-foreground",children:"Move to"}),e.jsxs("select",{id:o,value:u??"",disabled:m.isPending,onChange:l=>p(l.target.value||null),className:"h-8 rounded-md border border-input bg-background px-2 text-sm",children:[e.jsx("option",{value:"",children:"Choose a workspace"}),d.map(l=>e.jsx("option",{value:l.id,children:R(l)},l.id))]}),x?null:e.jsx(b,{size:"sm",variant:"ghost",onClick:y,children:"Cancel"})]}):null,x?e.jsx(Y,{device:s,ownerSlug:n,title:`Move device to ${x.name}`,intro:`Move ${C(s)} from ${v} to ${R(x)}?`,aftermath:`It is set up fresh in ${x.name}, with its connections there private to you until you share them.`,confirmLabel:"Move device",pending:m.isPending,onConfirm:()=>void k(x.id),onCancel:y}):null,f?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:f}):null]})}function Oe({ownerSlug:s,deviceId:n,organizationId:o,selectedConnection:h,openSettings:m}){const r=me(),{data:t=[],isLoading:u,isError:p,refetch:f}=ue(),a=xe(),g=he(),[N,v]=j.useState(!1),[d,x]=j.useState(!1),[y,k]=j.useState(""),l=pe(t,n),c=l&&ge(l,s)?l:void 0,i=c?.id??n,{data:w=[]}=fe(o,{profileKind:"browser_session"}),S=j.useMemo(()=>w.filter(_=>_.device_worker_id===i&&_.status!=="revoked"),[w,i]),$=c?.label?.trim()??"";if(j.useEffect(()=>{d||k($)},[$,d]),u)return e.jsx(ze,{label:"Loading device"});if(p)return e.jsx(A,{children:e.jsxs("div",{role:"alert",className:"space-y-2",children:[e.jsx("p",{children:"Could not load this device."}),e.jsx(b,{variant:"outline",size:"sm",onClick:()=>void f(),children:"Retry"})]})});if(!c&&l&&o)return e.jsxs(A,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{platform:M(l),className:"h-5 w-5"}),e.jsx("h1",{className:"text-base font-semibold",children:C(l)})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This device lives in"," ",l.organization_name??"another workspace",", not this workspace."]}),e.jsx(O,{device:l,organizationId:o,ownerSlug:s})]});if(!c)return e.jsxs(A,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"This device isn't in this workspace, so its details aren't available."}),e.jsx(E,{to:"/$owner/connectors",params:{owner:s},search:{},className:"text-sm text-primary hover:underline",children:"Back to connectors"})]});const D=ve(c),I=D?je(s,D,ye()):void 0,Z=M(c),X=be(c.app_version),ee=Ne(c,X),B=()=>{const _=y.trim(),se=c.label?.trim()??"";if(_===se){x(!1);return}g.mutate({deviceWorkerId:c.id,label:_.length===0?null:_},{onSuccess:()=>x(!1)})};return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(Le,{header:e.jsx(_e,{breadcrumb:e.jsx($e,{crumbs:[e.jsx(E,{to:"/$owner/connectors",params:{owner:s},search:{},className:H,children:"Connectors"},"connectors"),...I?[e.jsx(E,{to:"/$owner/connectors/app/$appId",params:{owner:s,appId:I.id},className:H,children:I.name},"app")]:[]]}),icon:e.jsx(T,{platform:Z,className:"h-5 w-5"}),title:d?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(we,{"aria-label":"Device name",value:y,onChange:_=>k(_.target.value),placeholder:C({...c,label:null}),maxLength:80,className:"h-9 max-w-sm text-base font-semibold",autoFocus:!0,onKeyDown:_=>{_.key==="Enter"?(_.preventDefault(),N||B()):_.key==="Escape"&&(v(!1),k(c.label?.trim()??""),x(!1))}}),N?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg bg-destructive/10 px-3 py-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Forgets this device"," ",c.connector_count>0?`and un-pins ${c.connector_count} connector${c.connector_count===1?"":"s"} across every workspace, not just this one.`:"with no pinned connections."]}),e.jsxs(b,{variant:"destructive",size:"sm",disabled:a.isPending,onClick:()=>a.mutate(c.id,{onSuccess:()=>{v(!1),r({to:"/$owner/connectors",params:{owner:s},search:{}})}}),children:[a.isPending?e.jsx(L,{className:"mr-1.5"}):null,a.isPending?"Removing...":"Confirm remove"]}),e.jsx(b,{size:"sm",variant:"ghost",disabled:a.isPending,onClick:()=>v(!1),children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(b,{size:"sm",onClick:B,disabled:g.isPending,children:[g.isPending?e.jsx(L,{className:"mr-1.5"}):null,g.isPending?"Saving...":"Save"]}),e.jsx(b,{size:"sm",variant:"ghost",disabled:g.isPending,onClick:()=>{k(c.label?.trim()??""),x(!1)},children:"Cancel"}),e.jsxs(b,{size:"sm",variant:"ghost",className:"text-destructive hover:text-destructive",disabled:g.isPending||a.isPending,onClick:()=>v(!0),children:[e.jsx(Ce,{className:"mr-1.5 h-3.5 w-3.5"}),"Remove device"]})]})]}):e.jsxs("span",{className:"flex items-center gap-1.5",children:[C(c),e.jsx(b,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground","aria-label":"Edit device",onClick:()=>{v(!1),k(c.label?.trim()??""),x(!0)},children:e.jsx(Se,{className:"h-3.5 w-3.5"})})]}),badge:e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{className:`size-1.5 rounded-full ${c.online?"bg-emerald-500":"bg-muted-foreground/50"}`}),c.online?c.connector_error_count>0?"Needs attention":"Online":"Offline"]}),meta:ee||void 0,caption:`Last seen ${q(new Date(c.last_seen_at),{addSuffix:!0})}${c.last_sync_at?` · Last sync ${q(new Date(c.last_sync_at),{addSuffix:!0})}`:""}`}),children:[e.jsx(Ke,{device:c,ownerSlug:s}),c.connector_error_count>0?e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-amber-600",children:[e.jsx(ke,{className:"h-3.5 w-3.5 shrink-0"}),c.connector_error_count," connector",c.connector_error_count===1?"":"s"," pinned to this device ",c.connector_error_count===1?"is":"are"," erroring."]}):null,e.jsx(O,{device:c,organizationId:o,ownerSlug:s,selectedConnection:h,openSettings:m}),S.length>0?e.jsx(z,{title:"Browser auth profiles",children:e.jsx(We,{profiles:S})}):null,e.jsx(z,{title:"Runs",children:e.jsx(Ie,{scope:{deviceId:i},ownerSlug:s})})]})})}function We({profiles:s}){return s.length===0?null:e.jsx("div",{className:"rounded-lg border",children:e.jsx("ul",{className:"divide-y",children:s.map(n=>e.jsxs("li",{className:"space-y-2 px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-medium",children:n.display_name}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:n.connector_key??"Any connector"}),n.browser_kind?e.jsxs("span",{children:["· ",n.browser_kind]}):null,n.captured_at?e.jsxs("span",{title:n.captured_at,children:["· captured ",De(n.captured_at)]}):null,typeof n.cookie_count=="number"?e.jsxs("span",{children:["· ",n.cookie_count," cookie",n.cookie_count===1?"":"s"]}):null]})]}),e.jsx(Ae,{status:n.is_expired?"error":Ee(n.status),showDot:!0,children:n.is_expired?"expired":n.status})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Refresh the session using the connector’s authorization instructions."})]},n.id))})})}function as(){const{owner:s,deviceId:n}=K.useParams(),{connection:o,settings:h}=K.useSearch();return e.jsx(Pe,{owner:s,children:({ownerSlug:m,organizationId:r})=>e.jsx(Oe,{ownerSlug:m,deviceId:n,organizationId:r,selectedConnection:o,openSettings:h})})}export{as as component};
2
- //# sourceMappingURL=device._deviceId-DTZqj1HS.js.map
@@ -1,2 +0,0 @@
1
- import{j as e,eL as V,H as L,$ as ae,bt as ie,bu as re,bv as ne,bw as le,bx as ce,f4 as de,ge as me,gf as E,gg as H,gh as oe,gi as k,gj as ue,B as O,bg as U,dc as G,I as J,d3 as xe,eN as be,gk as je,cY as Q,gl as fe,Y as ye,i as q,gm as he,r as Y,dM as Ne,dO as ge,gn as we,dN as $e,dU as Se,dn as R}from"./index-B-Ab8srM.js";import{d as A,h as ve,F as Oe,i as z,j as Te}from"./renderer-CgaQKMoG.js";import{T as Be,a as De,b as C,c as Z,d as Ee,e as M}from"./table-B6yimlsZ.js";import{p as K,a as Ie}from"./schema-value-BUgC0Ro8.js";function ee(l){return l.replace(/[^a-zA-Z0-9_-]/g,"-")}function Ae(l,r=!1){return l?Ie(l,r):r?"Pick a date and time":"Pick a date"}function P(l){if(!l)return"";const r=K(l);if(Number.isNaN(r.getTime()))return"";const s=r.getTimezoneOffset()*6e4;return new Date(r.getTime()-s).toISOString().slice(0,16)}function X(l){if(!l)return;const r=new Date(l);if(!Number.isNaN(r.getTime()))return r.toISOString()}function I(l,r){const s=r==="slug"?l.slug:l.metadata?.[r];return s==null?"":String(s)}function W({id:l,value:r,onChange:s,readonly:a,ariaLabel:c,ariaDescribedBy:w,includeTime:N=!1,clearable:j}){const d=r?K(r):void 0,[m,u]=Y.useState(()=>P(r).slice(11));return Y.useEffect(()=>{u(P(r).slice(11))},[r]),e.jsx("div",{className:"relative",children:e.jsxs(Ne,{children:[e.jsx(ge,{asChild:!0,children:e.jsxs(O,{id:l,"aria-label":c,"aria-describedby":w,type:"button",variant:"outline",disabled:a,className:q("w-full justify-start rounded-md bg-muted px-3 text-left font-normal",!r&&"text-muted-foreground"),children:[e.jsx(we,{className:"mr-2 h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:Ae(r,N)})]})}),e.jsxs($e,{className:"w-auto space-y-3 p-0",align:"start",children:[e.jsx(Se,{mode:"single",selected:d,defaultMonth:d,onSelect:i=>{if(!i)return;if(!N){s(R(i,"yyyy-MM-dd"));return}const t=m||"00:00";s(X(`${R(i,"yyyy-MM-dd")}T${t}`))},initialFocus:!0}),N?e.jsxs("div",{className:"border-t p-3 pt-0",children:[e.jsx(L,{htmlFor:`${l}-time`,className:"text-xs text-muted-foreground",children:"Time"}),e.jsx(J,{id:`${l}-time`,type:"time",value:m,onChange:i=>{u(i.target.value);const t=r?P(r).slice(0,10):d?R(d,"yyyy-MM-dd"):"";t&&s(X(`${t}T${i.target.value}`))},disabled:a})]}):null,j&&r?e.jsx("div",{className:"border-t p-2",children:e.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"w-full",onClick:()=>s(void 0),children:"Clear"})}):null]})]})})}function Fe({id:l,value:r,onChange:s,readonly:a,ariaLabel:c,ariaDescribedBy:w,entityType:N,lookupField:j,numeric:d=!1,orgContext:m}){const u=o=>{if(o===void 0||o==="")return s(void 0);if(!d)return s(o);const x=Number(o);s(Number.isFinite(x)?x:o)},{data:i}=xe(N,m,{limit:be}),t=(i?.entities??[]).filter(o=>I(o,j)!==""),$=r==null?"":String(r),v=t.find(o=>I(o,j)===$);return m?a?e.jsx("div",{className:"flex h-9 items-center rounded-md border border-input bg-muted px-3 text-sm",children:v?.name||$||"-"}):e.jsx(je,{contentClassName:"w-[320px]",searchPlaceholder:`Search ${z(N).toLowerCase()}...`,emptyText:`No ${N} found.`,trigger:o=>e.jsxs(O,{id:l,"aria-label":c,"aria-describedby":w,type:"button",variant:"outline",role:"combobox","aria-expanded":o,className:"w-full justify-between",children:[e.jsx("span",{className:q("truncate",!$&&"text-muted-foreground"),children:v?.name||$||`Select ${z(N).toLowerCase()}`}),e.jsx(he,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:(o,x)=>{const n=x.trim(),f=n.length>0&&!t.some(y=>I(y,j)===n);return e.jsxs(e.Fragment,{children:[f?e.jsxs(Q,{value:`use ${n}`,onSelect:()=>{u(n),o()},children:[e.jsx(fe,{className:"mr-2 h-3.5 w-3.5 opacity-60"}),e.jsxs("span",{className:"truncate",children:["Use ",e.jsx("span",{className:"font-medium",children:n})]})]}):null,t.map(y=>{const h=I(y,j),T=h===$;return e.jsxs(Q,{value:`${y.name} ${y.slug} ${y.entity_type} ${h}`,onSelect:()=>{u(h||void 0),o()},children:[e.jsx(ye,{className:q("mr-2 h-4 w-4",T?"opacity-100":"opacity-0")}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate",children:y.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:y.slug})]})]},`${y.id}-${h}`)})]})}}):e.jsx(J,{id:l,"aria-label":c,"aria-describedby":w,type:d?"number":"text",value:$,onChange:o=>u(o.target.value||void 0),disabled:a})}function se({fieldPath:l,fieldKey:r,prop:s,value:a,onChange:c,isRequired:w,readonly:N,orgContext:j,ariaLabel:d,helpId:m}){const u=A(r,s),i=ee(l),t=N||s.readOnly===!0,$=s.type==="object"||!!s.properties,v=s.type==="array"&&!!s.items&&(s.items?.type==="object"||!!s.items?.properties),o=s.type==="array"&&!!s.items&&(s.items?.type==="string"||s.items?.type==="number"||s.items?.type==="integer"||s.items?.type==="boolean");if(s.type==="boolean")return e.jsx(ae,{id:i,"aria-label":d,"aria-describedby":m,checked:a??!1,onCheckedChange:n=>c(n),disabled:t});let x;if(s.enum&&Array.isArray(s.enum))x=e.jsxs(ie,{value:a==null?"":String(a),onValueChange:n=>c(n===""?void 0:s.type==="number"||s.type==="integer"?Number(n):n),disabled:t,children:[e.jsx(re,{id:i,"aria-label":d,"aria-describedby":m,children:e.jsx(ne,{placeholder:`Select ${u.toLowerCase()}`})}),e.jsx(le,{children:s.enum.map(n=>{const f=String(n);return e.jsx(ce,{value:f,children:de(s,n)??z(f)},f)})})]});else if(s["x-link-entity-type"])x=e.jsx(Fe,{id:i,value:a,onChange:c,readonly:t,ariaLabel:d,ariaDescribedBy:m,entityType:s["x-link-entity-type"],lookupField:s["x-link-lookup-field"]||"slug",numeric:s.type==="number"||s.type==="integer",orgContext:j});else if(s.type==="number"||s.type==="integer")x=e.jsx(me,{id:i,ariaLabel:d,ariaDescribedBy:m,value:a,onChange:c,integer:s.type==="integer",placeholder:`Enter ${u.toLowerCase()}`,readOnly:t});else if($){const n=V(s.properties),f=new Set(s.required??[]),y=E(a)?a:{};x=Object.keys(s.properties??{}).length===0||!E(a)&&a!==void 0&&a!==null?e.jsx(H,{id:i,value:a,ariaLabel:`${u} JSON object`,ariaDescribedBy:m,readOnly:t,onChange:c}):e.jsx("fieldset",{"aria-label":d,"aria-labelledby":d?void 0:`${i}-label`,"aria-describedby":m,className:"space-y-3 rounded-md border p-3",children:n.map(([h,T])=>e.jsx(te,{fieldPath:`${l}.${h}`,fieldKey:h,prop:T,value:y[h],onChange:S=>{const b={...y};S===void 0?delete b[h]:b[h]=S,c(b)},isRequired:f.has(h),readonly:t,orgContext:j},h))})}else if(o)x=a!=null&&!oe(a)?e.jsx(k,{id:i,value:a,ariaLabel:`${u} JSON array`,ariaDescribedBy:m,readOnly:t,itemType:s.items?.type,itemEnum:s.items?.enum,minItems:s.minItems,maxItems:s.maxItems,onChange:c}):e.jsx(ue,{id:i,value:a,itemType:s.items?.type,itemEnum:s.items?.enum,minItems:s.minItems,maxItems:s.maxItems,ariaLabel:d,ariaDescribedBy:m,readOnly:t,showHelp:!d,onChange:c});else if(v&&s.items){const n=Array.isArray(a)?a:[],f=V(s.items.properties),y=new Set(s.items.required??[]),h=s.maxItems===void 0||n.length<s.maxItems,T=s.minItems===void 0||n.length>s.minItems;x=!Array.isArray(a)&&a!==void 0&&a!==null||Object.keys(s.items.properties??{}).length>0&&n.some(S=>!E(S))?e.jsx(k,{id:i,value:a,ariaLabel:`${u} JSON array`,ariaDescribedBy:m,readOnly:t,itemType:"object",minItems:s.minItems,maxItems:s.maxItems,onChange:c}):Object.keys(s.items.properties??{}).length===0?e.jsxs("fieldset",{"aria-label":d,"aria-labelledby":d?void 0:`${i}-label`,"aria-describedby":m,className:"space-y-3",children:[n.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No rows"}):n.map((S,b)=>e.jsxs("fieldset",{className:"space-y-2 rounded-md border p-3",children:[e.jsxs("legend",{className:"px-1 text-xs font-medium text-muted-foreground",children:["Row ",b+1]}),e.jsx(H,{id:`${i}-${b}-json`,value:S,ariaLabel:`${u} row ${b+1} JSON object`,readOnly:t,onChange:B=>{const g=[...n];g[b]=B,c(g)}}),t?null:e.jsxs(O,{type:"button",variant:"ghost",size:"sm","aria-label":`Remove row ${b+1}`,disabled:!T,onClick:()=>c(n.filter((B,g)=>g!==b)),children:[e.jsx(U,{className:"mr-1.5 h-4 w-4"}),"Remove row"]})]},`${l}.${b}`)),t?null:e.jsxs(O,{type:"button",variant:"outline",size:"sm",disabled:!h,onClick:()=>c([...n,{}]),children:[e.jsx(G,{className:"mr-1.5 h-4 w-4"}),"Add row"]})]}):e.jsxs("fieldset",{"aria-label":d,"aria-labelledby":d?void 0:`${i}-label`,"aria-describedby":m,className:"space-y-3",children:[e.jsx("div",{className:"rounded-md border",children:e.jsxs(Be,{children:[e.jsx(De,{children:e.jsxs(C,{children:[f.map(([S,b])=>e.jsxs(Z,{children:[A(S,b),y.has(S)?e.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]},S)),t?null:e.jsx(Z,{className:"w-12"})]})}),e.jsx(Ee,{children:n.length===0?e.jsx(C,{children:e.jsx(M,{colSpan:f.length+(t?0:1),className:"text-sm text-muted-foreground",children:"No rows"})}):n.map((S,b)=>{const B=E(S)?S:{};return e.jsxs(C,{children:[f.map(([g,D])=>e.jsx(M,{className:"align-top",children:e.jsx(se,{fieldPath:`${l}.${b}.${g}`,fieldKey:g,prop:D,ariaLabel:A(g,D),value:B[g],onChange:_=>{const p=[...n],F={...B};_===void 0?delete F[g]:F[g]=_,p[b]=F,c(p)},isRequired:y.has(g),readonly:t,orgContext:j})},g)),t?null:e.jsx(M,{className:"align-top",children:e.jsx(O,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove row ${b+1}`,disabled:!T,onClick:()=>c(n.filter((g,D)=>D!==b)),children:e.jsx(U,{className:"h-4 w-4"})})})]},`${l}.${b}`)})})]})}),t?null:e.jsxs(O,{type:"button",variant:"outline",size:"sm",disabled:!h,onClick:()=>c([...n,{}]),children:[e.jsx(G,{className:"mr-1.5 h-4 w-4"}),"Add row"]})]})}else if(s.type==="array")x=e.jsx(k,{id:i,value:a,ariaLabel:`${u} JSON array`,ariaDescribedBy:m,readOnly:t,itemType:s.items?.type,itemEnum:s.items?.enum,minItems:s.minItems,maxItems:s.maxItems,onChange:c});else if(s.format==="date")x=e.jsx(W,{id:i,value:typeof a=="string"?a:void 0,onChange:c,readonly:t,ariaLabel:d,ariaDescribedBy:m,clearable:!w});else if(s.format==="date-time")x=e.jsx(W,{id:i,value:typeof a=="string"?a:void 0,onChange:c,readonly:t,ariaLabel:d,ariaDescribedBy:m,includeTime:!0,clearable:!w});else{const n=s.format==="uri"||s.format==="url";x=e.jsx(J,{id:i,"aria-label":d,"aria-describedby":m,type:n?"url":"text",value:a??"",onChange:f=>c(f.target.value||void 0),placeholder:n?"https://example.com":`Enter ${u.toLowerCase()}`,disabled:t})}return x}function te({fieldPath:l,fieldKey:r,prop:s,value:a,onChange:c,isRequired:w,readonly:N,control:j,orgContext:d,customControl:m}){const u=A(r,s),i=ve(s),t=ee(l),$=i?`${t}-description`:void 0,v=i?e.jsx("p",{id:$,className:"text-xs text-muted-foreground",children:i}):null,o=j?e.jsx(Oe,{control:j}):null,x=m??e.jsx(se,{fieldPath:l,fieldKey:r,prop:s,value:a,onChange:c,isRequired:w,readonly:N,orgContext:d,helpId:$});if(s.type==="boolean"){const f=e.jsxs("div",{className:"flex items-center space-x-2 py-1",children:[x,e.jsxs(L,{htmlFor:t,className:"flex items-center gap-1.5 font-normal",children:[u,o]})]});return v?e.jsxs("div",{className:"space-y-1",children:[f,v]}):f}const n=s.type==="object"||!!s.properties||s.type==="array"&&!!s.items&&(s.items?.type==="object"||!!s.items?.properties);return e.jsxs("div",{className:"space-y-1.5",children:[n?e.jsxs("p",{id:`${t}-label`,className:"flex items-center gap-1.5 text-sm font-medium",children:[e.jsxs("span",{children:[u,w?e.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]}),o]}):e.jsxs(L,{htmlFor:t,className:"flex items-center gap-1.5",children:[e.jsxs("span",{children:[u,w?e.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]}),o]}),x,v]})}function Pe(l){const r={};for(const[s,a]of Object.entries(l)){const c=Te(a);c!==void 0&&(r[s]=c)}return r}function Ve({schema:l,values:r,onValuesChange:s,readonly:a=!1,fieldControls:c,orgContext:w,renderControl:N}){const j=l,d=j?.properties,m=new Set(j?.required??[]),u=(i,t)=>{s({...r,[i]:t})};return!d||Object.keys(d).length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-2",children:"No additional fields required for this entity type."}):e.jsx("div",{className:"space-y-4",children:V(d).map(([i,t])=>"x-measure"in t||"x-dimension"in t?null:e.jsx(te,{fieldPath:i,fieldKey:i,prop:t,value:r[i],onChange:$=>u(i,$),isRequired:m.has(i),readonly:a,control:c?.[i],orgContext:w,customControl:N?.(i,t,r[i])},i))})}export{Ve as D,se as S,Pe as c};
2
- //# sourceMappingURL=dynamic-schema-form-DyT_9iVE.js.map
@@ -1,2 +0,0 @@
1
- import{c as j,at as C,j as e,bt as _,bu as m,bv as S,bw as b,bx as c,fi as u,d9 as w}from"./index-B-Ab8srM.js";const h="__connection_picker_create_new__";function k({connections:s,value:r,onValueChange:n,connectorKey:a,disabled:d,placeholder:g="Choose a connection",includeWorkspaceEvents:o=!1,ariaLabel:p="Connection"}){const f=j(),l=C().org?.slug,i=a?s.filter(t=>t.connector_key===a):s,x=t=>{if(t===h){if(!l)return;f({to:"/$owner/connectors/create",params:{owner:l},search:a?{connector:a}:{}});return}n(t)};return e.jsxs(_,{value:r,onValueChange:x,disabled:d,children:[e.jsx(m,{"aria-label":p,children:e.jsx(S,{placeholder:g})}),e.jsxs(b,{children:[o?e.jsxs(e.Fragment,{children:[e.jsx(c,{value:"workspace",children:"Current workspace"}),i.length>0?e.jsx(u,{}):null]}):null,i.map(t=>e.jsx(c,{value:String(t.id),children:w(t)},t.id)),l?e.jsxs(e.Fragment,{children:[i.length>0||o?e.jsx(u,{}):null,e.jsx(c,{value:h,children:"Connect an app…"})]}):null]})]})}function v(s){const r=[];for(const n of s)typeof n.id=="number"&&r.push({id:n.id,name:n.name,entityType:n.entity_type}),n.children&&n.children.length>0&&r.push(...v(n.children));return r}export{k as C,v as f};
2
- //# sourceMappingURL=entity-options-CGTjLlcS.js.map
@@ -1,2 +0,0 @@
1
- import{dp as we,r as E,c8 as Se,jH as S,fJ as Re,ej as te,j as e,B as N,u as J,jB as Ee,S as se,fT as me,jI as Fe,E as De,c as he,b as Ce,c9 as B,at as Le,k as Be,el as X,ed as Pe,jC as Te,jJ as Ie,eI as Oe,cn as ae,f3 as Ve,fO as $e,eW as Me,hh as Ae,hi as ze,hj as He,hk as Ue,hl as Ke,jK as We,cd as qe,H as K,I as ne,eA as Ge,W as Xe,fH as ie,dY as W,gG as Ye,L as q,gH as G}from"./index-B-Ab8srM.js";import{N as Je,d as Qe,f as Ze,g as et,S as tt,h as st}from"./entity-pages-eYbG2FDT.js";import{R as at}from"./record-activity-6CfR95Ul.js";import{D as nt}from"./dynamic-schema-form-DyT_9iVE.js";import{r as it,V as ot}from"./views-access-required-BVtMfgLh.js";import{a as pe,V as oe,M as rt,b as lt}from"./view-param-filters-DYlqBocg.js";import{m as ct,j as Y,d as dt,o as re,c as fe,R as xe,q as ut,r as mt}from"./renderer-CgaQKMoG.js";import"./table-B6yimlsZ.js";import{a as ht}from"./source-record-panels-CBV9tsR3.js";import{r as pt,R as le,b as ft}from"./event-card-BtTUuf2q.js";import{a as xt}from"./record-session-Bpx4_LGk.js";import"./schema-value-BUgC0Ro8.js";import"./filter-editors-Dd5R2Etd.js";import"./runs-BMzp7j7j.js";import"./clients-6aJvabvS.js";import"./client-activity-scopes-DoIErdUy.js";import"./client-rows-BbVQy5Ti.js";import"./events-feed-zFnTSE27.js";import"./run-initiator-BvruBM5H.js";import"./use-automations-II_YJWtN.js";import"./agent-loading-shells-DHvKiEUB.js";import"./member-scope-gate-Lj9m4RL2.js";import"./app-bridge-C4nPtae3.js";import"./card-DT9mSjSp.js";import"./definition-comparison-C3k6Wa9B.js";import"./automation-source-list-D8ZSavQU.js";import"./json-diff-B-1Swv_y.js";import"./index-Vcq4gwWv.js";import"./change-summary-CGrKEJ04.js";import"./copy-button-D6zpsZLi.js";import"./agent-list-row-SyACVYX7.js";import"./automation-row-CmTpAD4r.js";import"./device-automation-Dp3faMvp.js";function gt(t,s){if(t===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in t)return t;if(typeof t=="function")return{shouldBlockFn:async()=>await t(),enableBeforeUnload:!0,withResolver:!1};const i=!!(t.condition??!0),n=t.blockerFn;return{shouldBlockFn:async()=>i&&n!==void 0?await n():i,enableBeforeUnload:i,withResolver:n===void 0}}function vt(t,s){const{shouldBlockFn:i,enableBeforeUnload:n=!0,disabled:a=!1,withResolver:c=!1}=gt(t),o=we(),{history:r}=o,[u,x]=E.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return E.useEffect(()=>{const p=async f=>{function l(j){const b=o.parseLocation(j),v=o.getMatchedRoutes(b.pathname);return v.foundRoute===void 0?{routeId:"__notFound__",fullPath:b.pathname,pathname:b.pathname,params:v.routeParams,search:o.options.parseSearch(j.search)}:{routeId:v.foundRoute.id,fullPath:v.foundRoute.fullPath,pathname:b.pathname,params:v.routeParams,search:o.options.parseSearch(j.search)}}const m=l(f.currentLocation),d=l(f.nextLocation);if(m.routeId==="__notFound__"&&d.routeId!=="__notFound__")return!1;const h=await i({action:f.action,current:m,next:d});if(!c)return h;if(!h)return!1;const k=await new Promise(j=>{x({status:"blocked",current:m,next:d,action:f.action,proceed:()=>j(!1),reset:()=>j(!0)})});return x({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),k};return a?void 0:r.block({blockerFn:p,enableBeforeUnload:n})},[i,n,a,c,r,o]),u}function H(t,s){return te(Y(t))===te(Y(s))}function jt(t,s){const i={};for(const n of new Set([...Object.keys(t),...Object.keys(s)]))H(t[n],s[n])||(i[n]=Y(t[n])??null);return Object.keys(i).length>0?i:void 0}function yt(t,s){return[...new Set([...Object.keys(t),...Object.keys(s)])].filter(i=>{try{return!H(t[i],s[i])}catch{return!0}})}function ce(t,s){return{name:t.name,slug:t.slug,metadata:ct(t.metadata??{},s)}}function bt(t,s,i){const n=new Set(i),a={},c={},o=new Set([...Object.keys(t.values.metadata),...Object.keys(t.baseline.metadata),...Object.keys(s.metadata)]);for(const r of o){const u=n.has(r),x=u?t.values.metadata[r]:t.baseline.metadata[r],p=H(x,s.metadata[r])?x:s.metadata[r];p!==void 0&&(a[r]=p);let f=!1;if(!u)try{f=!H(t.values.metadata[r],t.baseline.metadata[r])}catch{f=!0}const l=f?t.values.metadata[r]:p;l!==void 0&&(c[r]=l)}return{baseline:{name:s.name,slug:s.slug,metadata:a},values:{name:s.name,slug:s.slug,metadata:c}}}function kt({entity:t,schema:s,orgContext:i}){const n=E.useMemo(()=>ce(t,s),[t,s]),a=Se(S(t),n,s),c=Re(i),{values:o,baseline:r,commit:u}=a,x=E.useMemo(()=>yt(o.metadata,r.metadata),[o.metadata,r.metadata]),p=o.name!==r.name||o.slug!==r.slug,f=E.useCallback((m,d)=>a.setValues(h=>({...h,metadata:{...h.metadata,[m]:d}})),[a.setValues]),l=async({note:m}={})=>{if(typeof t.id!="number")throw new Error("Source records are read-only");if(!a.canSubmit)return null;const d=jt(o.metadata,r.metadata),h=o.name.trim()!==r.name.trim();if(!d&&!p)return null;const k=await c.mutateAsync({entityId:t.id,name:h?o.name.trim():void 0,slug:o.slug,metadata:d,field_note:d&&m?.trim()||void 0}),j=ce(k.entity,s);return u(b=>bt(b,j,Object.keys(d??{})),j),{held:k.blocked_fields??[],approvalUrl:k.approval_url}};return{values:o,baseline:r,revision:a.revision,setValues:a.setValues,setMetadataField:f,reset:a.reset,save:l,saving:c.isPending,dirtyKeys:x,identityDirty:p,isDirty:p||x.length>0,canSubmit:a.canSubmit,hasConflict:a.hasConflict,hasInvalidInput:a.hasInvalidInput}}const _t=3,Nt=50;function ge(t){const s=E.useRef(null);return E.useEffect(()=>{t&&(s.current?.scrollIntoView?.({block:"start"}),s.current?.focus())},[t]),s}function T({headingRef:t,children:s}){return e.jsx("h3",{ref:t,tabIndex:-1,className:"text-xs font-medium uppercase tracking-wide text-muted-foreground outline-none",children:s})}function wt({entityId:t,entityName:s,ownerSlug:i,orgContext:n,focus:a,collapsed:c=!1}){const o=J(),r=ge(a),{data:u,isLoading:x,isError:p,refetch:f}=Ee(t,n,{limit:Nt});if(t===void 0)return null;if(x)return e.jsxs("section",{className:"space-y-2","aria-busy":"true",children:[e.jsx(T,{headingRef:r,children:"Linked"}),e.jsx(se,{className:"h-4 w-24"}),e.jsx(se,{className:"h-6 w-full rounded-md"})]});if(p||!u)return e.jsxs("section",{className:"space-y-2",children:[e.jsx(T,{headingRef:r,children:"Linked"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Could not load this record's links."," ",e.jsx("button",{type:"button",className:"underline",onClick:()=>void f(),children:"Retry"})]})]});if(u.countsByType.length===0&&!u.hasMore&&!u.failures?.length)return a?e.jsxs("section",{className:"space-y-2",children:[e.jsx(T,{headingRef:r,children:"Linked"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"No links to other records yet."})]}):null;if(c){const l=u.countsByType.flatMap(m=>{const d=m.count===1?u.rows.find(h=>h.relationship_type_slug===m.relationship_type_slug):void 0;return d?[pt(d,m.relationship_type_name)]:[m.relationship_type_name,String(m.count)]});return e.jsxs("section",{className:"space-y-1","aria-label":"Linked records",children:[e.jsx(T,{headingRef:r,children:"Linked"}),e.jsx(le,{count:u.failures?.length??0,onRetry:()=>void f()}),e.jsx("p",{"data-testid":"linked-summary",className:"truncate text-sm text-muted-foreground",children:l.join(" · ")})]})}return e.jsxs("section",{className:"space-y-3","aria-label":"Linked records",children:[e.jsx(T,{headingRef:r,children:"Linked"}),e.jsx(le,{count:u.failures?.length??0,onRetry:()=>void f()}),u.hasMore&&o?e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:()=>o.open({href:"",key:`record-links:${t}`,title:"Linked records",recordLinks:{entityId:t,entityName:s,ownerSlug:i,orgContext:n,label:"Linked records"}}),children:"Browse linked records"}):null,u.countsByType.map(l=>{const m=u.rows.filter(h=>h.relationship_type_slug===l.relationship_type_slug).slice(0,_t),d=l.count>m.length;return e.jsxs("div",{className:"space-y-1 text-sm",children:[d||m.length===0?e.jsxs("p",{className:"text-muted-foreground",children:[l.relationship_type_name,d?e.jsxs("span",{className:"tabular-nums text-muted-foreground/70",children:[" ","· ",l.count,u.countsScope==="page"?" shown":""]}):null]}):null,e.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[m.map(h=>e.jsx(ft,{row:h,label:l.relationship_type_name,entityId:t,ownerSlug:i,orgContext:n},h.id)),d&&o?e.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-primary hover:text-primary",onClick:()=>o.open({href:"",key:`record-links:${t}:${l.relationship_type_slug}`,title:`${l.relationship_type_name} · ${l.count}`,recordLinks:{entityId:t,entityName:s,ownerSlug:i,orgContext:n,relationshipType:l.relationship_type_slug,label:l.relationship_type_name}}),children:["Show all ",l.count]}):null]})]},l.relationship_type_slug)})]})}function St({record:t,ownerSlug:s,orgContext:i,focus:n}){const[a,c]=E.useState(n),o=ge(n);return e.jsxs("section",{className:"space-y-2",children:[e.jsx(T,{headingRef:o,children:"Linked"}),a?e.jsx(ht,{record:t,ownerSlug:s,orgContext:i}):e.jsx(N,{type:"button",variant:"outline",size:"sm",className:"h-7",onClick:()=>c(!0),children:"Find linked records"})]})}const Rt="$name";function ve({outcome:t,schema:s}){if(!t||t.held.length===0)return null;const i=s?.properties??{},n=t.held.map(a=>a===Rt?"Name":dt(a,i[a]??{}));return e.jsxs("div",{role:"status",className:"rounded-md bg-amber-500/10 px-3 py-2 text-sm text-amber-700 dark:text-amber-300",children:[n.join(", ")," ",n.length===1?"needs":"need"," approval before ",n.length===1?"it changes":"they change",".",t.approvalUrl?e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:t.approvalUrl,className:"underline",children:"Review"})]}):null]})}const Et=320,Ft={},Dt=()=>{};function Ct({view:t,orgSlug:s,recordUrl:i,scope:n}){const a=J(),c=`${i}${me(t.key)}`,o=a?()=>a.open({href:c,title:t.name}):void 0;return e.jsxs("section",{className:"min-w-0 rounded-lg border","data-testid":"view-card","data-view":t.key,children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 px-4 pt-3 pb-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"truncate text-sm font-medium",children:t.name}),t.description?e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:t.description}):null]}),o?e.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:"h-7 shrink-0 gap-1.5 px-2 text-muted-foreground hover:text-foreground",onClick:o,"aria-label":`Open ${t.name}`,children:[e.jsx(Fe,{className:"h-3.5 w-3.5"}),"Open"]}):null]}),e.jsx("div",{className:"px-4 pb-3",children:e.jsx(pe,{orgSlug:s,viewKey:t.key,scope:n,params:Ft,onParamsChange:Dt,contentHash:t.content_hash,title:t.name,minHeight:64,displayMode:"inline",maxHeight:Et,onRequestDisplayMode:o?r=>{r==="fullscreen"&&o()}:void 0})})]})}function Lt({recordUrl:t,dirty:s,onDiscard:i}){const n=vt({disabled:!s,enableBeforeUnload:s,withResolver:!0,shouldBlockFn:({next:c})=>c.pathname!==t&&!c.pathname.startsWith(`${t}${me("")}`)}),a=n.status==="blocked";return e.jsx(Ae,{open:a,onOpenChange:c=>{!c&&a&&n.reset()},children:e.jsxs(ze,{className:"max-w-sm",children:[e.jsxs(He,{children:[e.jsx(Ue,{children:"Discard unsaved changes?"}),e.jsx(Ke,{children:"This record has edits that are not saved. Leaving discards them."})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{type:"button",variant:"ghost",onClick:()=>a&&n.reset(),children:"Keep editing"}),e.jsx(N,{type:"button",variant:"destructive",onClick:()=>{a&&(i(),n.proceed())},children:"Discard"})]})]})})}const de=6;function Bt({entity:t,ownerSlug:s,orgContext:i,recordUrl:n,schema:a,entityTypeName:c,isTypeLoading:o,record:r,canEdit:u,editing:x,onEditingChange:p,outcome:f,onSaved:l,formId:m,fieldLimit:d,onDeleted:h}){const k=x&&u,j=J(),b={entity:{id:S(t),name:t.name,entity_type:t.entity_type},ownerSlug:s,orgContext:i,schema:a,record:r,editing:k};xt(b);const v=j?.item?.recordField,D={ownerSlug:s,orgContext:i,controls:t.field_controls,dirtyKeys:r.dirtyKeys,openField:j?L=>j.open(it(b,L.key)):void 0,openFieldKey:v?.entityId===S(t)?v.field:void 0},C=e.jsx(Lt,{recordUrl:n,dirty:k&&r.isDirty,onDiscard:()=>{r.reset(),p(!1)}});if(o)return e.jsx(Me,{rows:6});if(k)return e.jsxs(e.Fragment,{children:[C,e.jsx(Pt,{formId:m,entity:t,entityTypeName:c,schema:a,record:r,orgContext:i,renderControl:(L,P,F)=>ut(P)?e.jsx(mt,{field:{key:L,prop:P},value:F,context:D}):void 0,onSaved:l,onDeleted:h,onDone:()=>p(!1)})]});const R=fe(r.revision);return e.jsxs("div",{className:"space-y-3",children:[e.jsx(ve,{outcome:f,schema:a}),e.jsx(xe,{fields:R,fieldLimit:d,values:r.values.metadata,context:D})]})}function Pt({formId:t,entity:s,entityTypeName:i,schema:n,record:a,orgContext:c,renderControl:o,onSaved:r,onDeleted:u,onDone:x}){const p=We(),f=s.field_controls,{name:l,slug:m,metadata:d}=a.values,h=g=>a.setValues(y=>({...y,name:g})),k=g=>a.setValues(y=>({...y,slug:g})),j=g=>a.setValues(y=>({...y,metadata:g})),[b,v]=B(S(s),""),[D,C]=B(S(s),null),[R,L]=B(S(s),null),[P,F]=B(S(s),!1),[w,I]=B(S(s),null),O=a.dirtyKeys.length>0,M=async g=>{if(g.preventDefault(),!!a.canSubmit){if(C(null),!l.trim()){C("Name is required");return}try{const y=await a.save({note:b});L(y),r(y),v(""),y?.held.length||x()}catch(y){C(y instanceof Error?y.message:"Failed to update entity")}}},U=async()=>{I(null);try{if(typeof s.id!="number")throw new Error("Source records are read-only");await p.mutateAsync({entityId:s.id}),F(!1),u?.()}catch(g){I(g instanceof Error?g.message:"Failed to delete entity")}},A=[s.total_content>0&&`${s.total_content} content item${s.total_content===1?"":"s"}`,s.automations_count>0&&`${s.automations_count} Automation${s.automations_count===1?"":"s"}`,s.active_connections>0&&`${s.active_connections} connector${s.active_connections===1?"":"s"}`].filter(Boolean).join(", ");return e.jsxs("form",{id:t,onSubmit:M,className:"space-y-4",children:[e.jsx(qe,{visible:a.hasConflict,onReload:a.reset}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(K,{htmlFor:"sidebar-name",children:["Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"sidebar-name",value:l,onChange:g=>h(g.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(K,{htmlFor:"sidebar-slug",children:"URL Slug"}),e.jsx(ne,{id:"sidebar-slug",value:m,onChange:g=>k(g.target.value.toLowerCase().replace(/[^a-z0-9-]/g,""))})]}),a.revision&&Object.keys(a.revision).length>0&&e.jsxs(e.Fragment,{children:[e.jsx(tt,{}),e.jsx(nt,{schema:a.revision,values:d,onValuesChange:j,fieldControls:f,orgContext:c,renderControl:o})]}),O&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(K,{htmlFor:"sidebar-correction-note",children:"Correction note (optional)"}),e.jsx(Ge,{id:"sidebar-correction-note",value:b,onChange:g=>v(g.target.value),placeholder:"Why are you changing these fields? Helps Automations respect the correction.",rows:2})]}),D&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:D}),e.jsx(ve,{outcome:R,schema:n}),P?e.jsxs("div",{className:"space-y-3 rounded-lg border border-destructive/40 bg-destructive/5 p-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5 text-sm",children:[e.jsx(Xe,{className:"h-4 w-4 shrink-0 text-destructive mt-0.5"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"font-medium text-foreground",children:['Delete "',s.name,'"?']}),A&&e.jsxs("p",{className:"text-muted-foreground",children:["Removes ",A,". This cannot be easily undone."]})]})]}),w&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-2.5 py-1.5 text-sm text-destructive",children:w}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:()=>{F(!1),I(null)},children:"Cancel"}),e.jsx(N,{type:"button",variant:"destructive",size:"sm",onClick:U,disabled:p.isPending,children:p.isPending?"Deleting...":`Delete ${i||"entity"}`})]})]}):e.jsx("div",{className:"pt-2",children:e.jsx(N,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>F(!0),children:"Delete"})})]})}function je(t,s){const i=new Set(t.measure_columns??[]),n=s?.properties??{};return Object.keys(t.metadata??{}).filter(a=>a!=="id"&&a!=="slug"&&a!=="name"&&!Ve(n[a])&&n[a]?.const===void 0).map(a=>({key:a,prop:n[a]??{},label:n[a]?.["x-table-label"]??(i.has(a)?a:$e(a.replace(/_/g," "))),numeric:i.has(a)}))}function Tt({entity:t,schema:s,ownerSlug:i,fieldLimit:n}){const a=je(t,s);return e.jsxs("div",{children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Managed by the source"}),e.jsx(xe,{fields:a,fieldLimit:n,values:t.metadata??{},context:{ownerSlug:i}})]})}const ue="owletto:record-details-expanded";function It(){const[t,s]=E.useState(()=>{try{return window.localStorage.getItem(ue)==="1"}catch{return!1}});return[t,n=>{s(n);try{window.localStorage.setItem(ue,n?"1":"0")}catch{}}]}function Ot({namespace:t,entity:s,recordUrl:i,viewKey:n,title:a,onDeleted:c}){const o=De({strict:!1}),r=he(),u=E.useRef(null),x=Ce(u,Je),[p,f]=It(),[l,m]=B(S(s),!1),d={slug:t.slug,organizationId:t.id},{isMember:h,isPublic:k,isLoading:j}=Le(t.slug),b=h||k,v=Be({...d,organizationId:h?t.id:null}),{data:D,isLoading:C}=X(s.entity_type,d),R=D?.metadata_schema,{isAdmin:L,isLoading:P}=Pe(h?d.organizationId:void 0),F=h&&L&&!P&&!s.is_derived,w=kt({entity:s,schema:R,orgContext:d}),[I,O]=B(S(s),null),M=`record-form-${s.id}`,U=l&&F,A=b?v.data??[]:[],g=Te(A,{type:s.entity_type,id:S(s)}),y=Ie(g,n),z=!n&&o.tab==="relationships",ye=_=>void r({to:".",search:_,replace:!0}),Q={type:s.entity_type,entity:s.is_derived?s.slug:s.id??s.slug},V=x&&!p&&!l&&!z,Z=s.is_derived?re(je(s,R),s.metadata??{}).length:re(fe(w.revision),w.values.metadata).length,ee=V?de:void 0,be=e.jsxs("div",{className:"space-y-6",children:[s.is_derived?e.jsxs(e.Fragment,{children:[e.jsx(Tt,{entity:s,schema:R,ownerSlug:t.slug,fieldLimit:ee}),e.jsx(St,{record:{type:s.entity_type,key:s.slug},ownerSlug:t.slug,orgContext:d,focus:z})]}):e.jsxs(e.Fragment,{children:[e.jsx(Bt,{entity:s,ownerSlug:t.slug,orgContext:d,recordUrl:i,schema:R,entityTypeName:D?.name,isTypeLoading:C,record:w,canEdit:F,editing:l,onEditingChange:m,outcome:I,onSaved:O,formId:M,fieldLimit:ee,onDeleted:c}),e.jsx(wt,{entityId:typeof s.id=="number"?s.id:void 0,entityName:s.name,ownerSlug:t.slug,orgContext:d,focus:z,collapsed:V})]}),x&&!l&&!z?e.jsx(N,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-primary hover:text-primary","aria-expanded":!V,onClick:()=>f(V),children:V?Z>de?`Show all ${Z} fields`:"Show all details":"Show fewer"}):null]}),ke=_=>e.jsx(Ze,{rootRef:u,narrow:x,details:be,summary:e.jsx(et,{entity:s,schema:R}),children:_}),_e=U?e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:()=>{w.reset(),O(null),m(!1)},children:"Cancel"}),e.jsx(N,{type:"submit",form:M,size:"sm",disabled:!w.canSubmit||!w.isDirty||w.saving||!w.values.name.trim(),children:w.saving?"Saving...":"Save"})]}):F&&!C?e.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:"h-8 shrink-0 gap-1.5 px-2 text-muted-foreground hover:text-foreground",onClick:()=>{O(null),m(!0)},children:[e.jsx(Oe,{className:"h-3.5 w-3.5"}),"Edit"]}):null,$=_=>e.jsx(Qe,{entity:s,owner:t.slug,schema:R,title:a??null,actions:_e,layout:"content",children:_});if(n&&!b)return $(j?null:e.jsx(ot,{}));if(n&&v.data===void 0)return $(v.isError?e.jsx(oe,{onRetry:()=>void v.refetch()}):null);if(y.kind==="missing")return $(e.jsx(rt,{viewKey:y.key,backTo:i,backLabel:`Back to ${s.name}`}));if(y.kind==="view"){const{view:_}=y;return $(e.jsxs("div",{className:"min-w-0 space-y-3",children:[e.jsx(lt,{decls:_.params,params:ae(o),onParamsChange:Ne=>void r({to:".",search:Ne})}),e.jsx(pe,{orgSlug:t.slug,viewKey:_.key,scope:Q,params:ae(o),onParamsChange:ye,contentHash:_.content_hash,title:_.name,minHeight:320})]}))}return $(ke(e.jsxs("div",{className:"min-w-0 space-y-4",children:[b&&v.isError&&e.jsx(oe,{onRetry:()=>void v.refetch()}),g.map(_=>e.jsx(Ct,{view:_,orgSlug:t.slug,recordUrl:i,scope:Q},_.key)),e.jsxs("section",{"aria-labelledby":"record-activity-heading",className:"min-w-0",children:[e.jsx("h2",{id:"record-activity-heading",className:"mb-2 text-sm font-medium text-muted-foreground",children:"Activity"}),e.jsx(at,{entity:s,organizationId:t.id,ownerSlug:t.slug})]})]})))}function Vt(t){return t?.trim()?t:void 0}function vs({namespace:t,path:s,entity:i,viewKey:n}){const a=he(),{data:c}=X(i.entity_type,{slug:t.slug}),o=s[0]?.entity_type??i.entity_type,{data:r}=X(o,{slug:t.slug}),u=Vt(c?.icon),x=s.map(l=>({entity_type:l.entity_type,slug:l.slug})),p=`/${t.slug}/${ie(i.entity_type)}`,f=W(t.slug,x);return e.jsxs("div",{className:"mx-auto flex min-h-0 w-full max-w-7xl flex-1 flex-col gap-4 px-4 pt-2.5 pb-8 lg:px-6",children:[e.jsx(Ye,{crumbs:[...o==="$member"?[]:[e.jsx(q,{to:"/$owner/data",params:{owner:t.slug},className:G,children:"Memory"},"memory")],e.jsx(q,{to:`/${t.slug}/${ie(o)}`,className:G,children:o==="$member"?"Team":r?.name??o},"type"),...s.slice(0,-1).map((l,m)=>e.jsx(q,{to:W(t.slug,x.slice(0,m+1)),className:G,children:l.name},l.id))],current:i.name}),e.jsx(Ot,{namespace:t,entity:i,recordUrl:f,viewKey:n,title:e.jsx(st,{entity:i,schema:c?.metadata_schema,icon:u}),onDeleted:()=>{const l=s.slice(0,-1);l.length>0?a({to:W(t.slug,l)}):a({to:p})}})]})}export{vs as EntityPage};
2
- //# sourceMappingURL=entity-page-DHHMmA8V.js.map
@@ -1,2 +0,0 @@
1
- import{r as x,j as e,bC as ue,i as V,dM as me,dO as xe,B as P,fQ as he,dN as pe,db as ge,eL as ne,fO as T,f3 as fe,cV as O,V as Z,L as A,dY as je,b as ve,S as E}from"./index-B-Ab8srM.js";import{p as S,n as be,e as re,b as ye,g as Ne,f as q,R as we,c as _e}from"./renderer-CgaQKMoG.js";import{S as H}from"./schema-value-BUgC0Ro8.js";import{T as Se,a as ke,b as B,c as J,d as Ce,e as K}from"./table-B6yimlsZ.js";var Ee="Separator",ee="horizontal",Le=["horizontal","vertical"],ae=x.forwardRef((t,s)=>{const{decorative:n,orientation:a=ee,...l}=t,o=Re(a)?a:ee,h=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return e.jsx(ue.div,{"data-orientation":o,...h,...l,ref:s})});ae.displayName=Ee;function Re(t){return Le.includes(t)}var oe=ae;const Me=x.forwardRef(({className:t,orientation:s="horizontal",decorative:n=!0,...a},l)=>e.jsx(oe,{ref:l,decorative:n,orientation:s,className:V("shrink-0 bg-border",s==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...a}));Me.displayName=oe.displayName;function Ae({choices:t,visible:s,onChange:n}){return e.jsxs(me,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(P,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground hover:text-foreground","aria-label":"Choose columns",title:"Choose columns",children:e.jsx(he,{className:"h-4 w-4"})})}),e.jsxs(pe,{align:"end",className:"max-h-80 overflow-y-auto p-3",children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:"Visible columns"}),t.map(a=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 py-1.5 text-sm",children:[e.jsx("input",{type:"checkbox",checked:!s||s.includes(a.field),onChange:l=>{const o=s??t.map(c=>c.field);n(l.target.checked?[...o,a.field]:o.filter(c=>c!==a.field))}}),a.label]},a.field))]})]})}function Oe({direction:t}){return t?e.jsxs("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("title",{children:t==="asc"?"Sort ascending":"Sort descending"}),t==="asc"?e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"}):e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})]}):e.jsxs("svg",{className:"h-4 w-4 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("title",{children:"Sort"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})]})}function te(t,s){const n=t?.properties;if(n)return Object.entries(n).find(([,a])=>a[s])?.[0]}function Pe(t){const s=t.trim(),n=s.split(/[\s._@/-]+/).filter(Boolean),a=n.length>=2?`${n[0][0]}${n[1][0]}`:(n[0]??s).slice(0,2);let l=0;for(let o=0;o<s.length;o++)l=l*31+s.charCodeAt(o)>>>0;return{initials:a.toUpperCase()||"?",hue:l%360}}function Te(t){const[s,n]=x.useState();return x.useEffect(()=>{if(!t||!globalThis.crypto?.subtle){n(void 0);return}let a=!1;const l=t.trim().toLowerCase();return crypto.subtle.digest("SHA-256",new TextEncoder().encode(l)).then(o=>{a||n(Array.from(new Uint8Array(o)).map(c=>c.toString(16).padStart(2,"0")).join(""))}),()=>{a=!0}},[t]),s?`https://www.gravatar.com/avatar/${s}?d=identicon&s=80`:void 0}function le({metadata:t,metadataSchema:s,name:n,typeIcon:a,className:l="h-6 w-6",iconClassName:o="h-5 w-5",initialsFallback:c=!1}){const h=te(s,"x-image"),j=te(s,"x-email"),y=h&&t?.[h]||void 0,v=j&&t?.[j]||void 0,N=Te(y?void 0:v),w=y||N,[k,L]=x.useState(!1);if(x.useEffect(()=>{L(!1)},[w]),w&&!k)return e.jsx("img",{src:w,alt:n,referrerPolicy:"no-referrer",onError:()=>L(!0),className:V("rounded-full object-cover border border-border",l)});if(c){const R=n.trim()||v||Fe(t,s)||n,{initials:F,hue:z}=Pe(R);return e.jsx("span",{role:"img","aria-label":n,className:V("inline-grid place-items-center rounded-full border border-border font-semibold text-white select-none",l),style:{background:`oklch(0.55 0.13 ${z})`,fontSize:"0.85em"},children:F})}return e.jsx(ge,{icon:a,className:o})}function Fe(t,s){if(!t)return;const n=s?.properties,a=["email","handle","username","login","github","x_handle","slug"],l=Object.keys(n||t);for(const o of l)if(a.includes(o.toLowerCase())){const c=t[o];if(typeof c=="string"&&c.trim())return c}}function _({column:t,children:s,alignRight:n=!1}){return e.jsxs("button",{type:"button",className:`flex items-center gap-1.5 whitespace-nowrap text-left transition-colors hover:text-foreground [&>svg]:shrink-0${n?" ml-auto":""}`,onClick:()=>t.toggleSorting(t.getIsSorted()==="asc"),children:[s,e.jsx(Oe,{direction:t.getIsSorted()})]})}function se(t,s,n){const a=ne(t?.properties).filter(([o,c])=>(!s||o!=="name")&&!c["x-image"]&&c["x-table-column"]===!0);if(a.length)return a.map(([o,c])=>({field:o,label:c["x-table-label"]??T(o.replaceAll("_"," "))}));if(!s)return[];const l=n.find(o=>Object.keys(S(o.metadata)).length>0);return Object.keys(S(l?.metadata)).filter(o=>o!=="id"&&o!=="slug"&&o!=="name"&&!fe(t?.properties?.[o])).map(o=>({field:o,label:T(o.replaceAll("_"," "))}))}function ze(t){return t.some(s=>Object.hasOwn(S(s.metadata),"name"))}function Ie(t,s){return O(t,re(s))}function $e(t){return`${t.entityType}:${t.lookupField}`}const Be=new Set(["stage","category","round_type","investor_type"]);function Ke(t,s){const n=t.toLowerCase();return n==="mrr"||n==="arr"||n==="revenue"||n==="valuation"||n==="funding_raised"||n==="fund_size"||n.endsWith("_usd")||s.description?.toLowerCase().includes("usd")===!0}function Ve(t,s){if(Ke(t,s))return"currency";if(Be.has(t)||t.endsWith("_slug"))return"enum"}function He({entities:t,owner:s,schema:n,entityTypeIcon:a,isDerived:l,measureColumns:o,linkedEntityLookups:c,hasAnyParents:h,sorting:j,onSortingChange:y,visibleColumns:v,columnChoices:N,onVisibleColumnsChange:w,page:k,pageSize:L,totalCount:R,hasMore:F,pageTitle:z,onPrevPage:ie,onNextPage:ce}){const M=N?.length&&w?e.jsx(Ae,{choices:N,visible:v,onChange:w}):null,f=n?.properties,U=!l||ze(t),W=x.useMemo(()=>f?Object.fromEntries(Object.entries(f).flatMap(([i,r])=>r["x-link-entity-type"]?[[i,{entityType:r["x-link-entity-type"],lookupField:r["x-link-lookup-field"]||"slug"}]]:[])):{},[f]),C=x.useMemo(()=>f?se({properties:f},l,[]).map(({field:r})=>[r,f[r]]).map(([r,u])=>{const m=W[r],d=m?c[$e(m)]:void 0;return{id:l?r:`meta_${r}`,accessorFn:p=>{const g=S(p.metadata);return be(g[r],u.enum)},header:({column:p})=>{const g=u["x-table-label"]||u.title||u.description||T(r.replace(/_/g," "));return l?e.jsx(_,{column:p,children:g}):g},cell:({getValue:p})=>e.jsx(H,{value:p(),prop:u,format:Ve(r,u),className:"text-muted-foreground",resolveLink:d?g=>{const b=d[g];return b?{label:b.name,to:O(s,[{entity_type:b.entity_type,slug:b.slug}])}:void 0}:void 0})}}):[],[l,W,c,s,f]),D=x.useMemo(()=>new Set(o),[o]),I=x.useMemo(()=>!l||C.length>0?[]:se({properties:f},!0,t).map(({field:r})=>r).map(r=>{const u=D.has(r);return{id:r,accessorFn:m=>S(m.metadata)[r],header:({column:m})=>e.jsxs(_,{column:m,children:[u?r:T(r.replace(/_/g," ")),u&&e.jsx(Z,{variant:"secondary",className:"font-normal lowercase",children:"measure"})]}),cell:({getValue:m})=>e.jsx(H,{value:m(),prop:f?.[r],className:u?"tabular-nums":"text-muted-foreground"}),meta:u?{align:"right"}:void 0}}),[l,C,t,D,f]),Q=x.useMemo(()=>{const i=n?.["x-table-relationships"];return!i||i.length===0?[]:i.map(r=>({id:`rel_${r.relationship_type}`,accessorFn:u=>u.relationships?.[r.relationship_type]??[],header:r.label,cell:({getValue:u})=>{const m=u();return!m||m.length===0?e.jsx("span",{className:"text-muted-foreground",children:"-"}):e.jsx("div",{className:"flex flex-wrap gap-1",children:m.map((d,p)=>{const g=O(s,[{entity_type:d.entity_type,slug:d.slug}]);return e.jsxs("span",{children:[e.jsx(A,{to:g,className:"text-primary hover:underline",onClick:b=>b.stopPropagation(),children:d.name}),p<m.length-1&&","]},d.id)})})}}))},[s,n]),G=x.useMemo(()=>h||t.some(r=>r.parent_name&&r.parent_slug&&r.parent_entity_type)?[{id:"parent",accessorFn:r=>r.parent_name,header:"Parent",cell:({row:r})=>{if(!r.original.parent_name||!r.original.parent_slug||!r.original.parent_entity_type)return e.jsx("span",{className:"text-muted-foreground",children:"-"});const u=O(s,[{entity_type:r.original.parent_entity_type,slug:r.original.parent_slug}]);return e.jsx(A,{to:u,className:"text-primary hover:underline",children:r.original.parent_name})}}]:[],[t,h,s]),X=x.useMemo(()=>{const i=[],r=t.some(d=>(d.total_content??0)>0),u=t.some(d=>(d.active_connections??0)>0),m=t.some(d=>(d.automations_count??0)>0);return r&&i.push({accessorKey:"total_content",header:({column:d})=>e.jsx(_,{column:d,alignRight:!0,children:"Activity"}),cell:({row:d,getValue:p})=>{const g=p()??0;if(g===0)return e.jsx("span",{className:"tabular-nums",children:"0"});const b=re(d.original);return e.jsx(A,{to:je(s,b),className:"tabular-nums hover:underline",children:g})},meta:{align:"right"}}),u&&i.push({accessorKey:"active_connections",header:"Connectors",cell:({getValue:d})=>{const p=d();return p&&p>0?e.jsxs(Z,{variant:"outline",className:"text-green-600 dark:text-green-400",children:[p," active"]}):e.jsx("span",{className:"text-muted-foreground",children:"-"})},meta:{align:"right"}}),m&&i.push({accessorKey:"automations_count",header:({column:d})=>e.jsx(_,{column:d,alignRight:!0,children:"Automations"}),cell:({getValue:d})=>e.jsx("span",{className:"tabular-nums",children:d()??0}),meta:{align:"right"}}),i},[t,s]),Y=x.useMemo(()=>[{accessorKey:"name",header:({column:i})=>U?e.jsx(_,{column:i,children:"Name"}):"Name",cell:({row:i})=>{const r=S(i.original.metadata);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{metadata:r,metadataSchema:n,name:i.original.name,typeIcon:a,className:"h-6 w-6 shrink-0"}),e.jsx("div",{className:"min-w-0",children:(()=>{const u=Ie(s,i.original);return e.jsx(A,{to:u,className:"block max-w-56 truncate font-medium hover:underline",title:i.original.name,children:i.original.name})})()})]})}},...G,...C,...I,...Q,...X,...l?[]:[{accessorKey:"created_at",header:({column:i})=>e.jsx(_,{column:i,children:"Created"}),cell:({getValue:i})=>e.jsx("span",{className:"whitespace-nowrap text-muted-foreground",children:new Date(i()).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})}]],[s,G,C,I,Q,X,n,a,l,U]),$=ye({data:t,columns:Y,state:{sorting:j,columnVisibility:Object.fromEntries([...C,...I].flatMap(i=>i.id?[[i.id,!v||v.includes(l?i.id:i.id.replace(/^meta_/,""))]]:[]))},onSortingChange:y,getCoreRowModel:Ne(),manualSorting:!0,enableSortingRemoval:!1}),de=t.length>0||k>0;return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-lg border",children:e.jsxs(Se,{className:"min-w-[48rem]",children:[e.jsx(ke,{children:$.getHeaderGroups().map(i=>e.jsxs(B,{children:[i.headers.map(r=>e.jsx(J,{"aria-sort":r.column.getIsSorted()==="asc"?"ascending":r.column.getIsSorted()==="desc"?"descending":void 0,className:r.column.columnDef.meta?.align==="right"?"text-right":"",children:r.isPlaceholder?null:q(r.column.columnDef.header,r.getContext())},r.id)),M?e.jsx(J,{className:"w-10 pr-2 text-right",children:M}):null]},i.id))}),e.jsx(Ce,{children:$.getRowModel().rows.length?$.getRowModel().rows.map(i=>e.jsxs(B,{children:[i.getVisibleCells().map(r=>e.jsx(K,{className:r.column.columnDef.meta?.align==="right"?"whitespace-nowrap text-right":"",children:q(r.column.columnDef.cell,r.getContext())},r.id)),M?e.jsx(K,{}):null]},i.id)):e.jsx(B,{children:e.jsx(K,{colSpan:Y.length+(M?1:0),className:"h-24 text-center",children:"No results found."})})})]})}),de&&e.jsxs("div",{className:"mt-4 flex flex-col gap-2 text-sm text-muted-foreground sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:["Showing ",t.length," of ",R," ",z.toLowerCase()]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{children:["Page ",k+1," of ",Math.max(1,Math.ceil(R/L))]}),e.jsx(P,{variant:"outline",size:"sm",onClick:ie,disabled:k===0,children:"Previous"}),e.jsx(P,{variant:"outline",size:"sm",onClick:ce,disabled:!F,children:"Next"})]})]})]})}const Ue=720;function We(){return e.jsxs("div",{className:"space-y-4","aria-label":"Loading entities",role:"status",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(E,{className:"h-9 max-w-sm flex-1"}),e.jsx(E,{className:"h-9 w-28"})]}),e.jsxs("div",{className:"overflow-hidden rounded-lg border",children:[e.jsx("div",{className:"border-b px-4 py-3",children:e.jsx(E,{className:"h-3 w-1/3"})}),e.jsx("div",{className:"divide-y",children:Array.from({length:5},(t,s)=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e.jsx(E,{className:"h-3 flex-1"}),e.jsx(E,{className:"h-3 w-16 shrink-0"})]},s))})]})]})}function et({title:t,actions:s,controls:n,table:a,children:l,loading:o=!1,error:c=null,onRetry:h,empty:j=e.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:"No records."})}){return e.jsxs("div",{className:"@container space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[typeof t=="string"?e.jsx("h2",{className:"text-lg font-semibold",children:t}):t,s]}),e.jsxs("div",{children:[n,o?e.jsx(We,{}):c!==null?e.jsxs("div",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-6 text-sm text-destructive",children:[c,h?e.jsx(P,{className:"ml-3",variant:"outline",size:"sm",onClick:h,children:"Retry"}):null]}):l!==void 0?l:a?e.jsx(He,{...a}):j]})]})}function De(t,s){return s?.properties?ne(s.properties).map(([n,a])=>({key:n,prop:a})):Object.keys(t.metadata??{}).map(n=>({key:n,prop:{}}))}function Qe({entity:t,schema:s,icon:n}){return e.jsxs(e.Fragment,{children:[e.jsx(le,{metadata:t.metadata,metadataSchema:s?{...s}:void 0,name:t.name,typeIcon:n,className:"h-6 w-6 shrink-0"}),e.jsx("h2",{className:"truncate text-lg font-semibold leading-tight",children:t.name})]})}function Ge({entity:t,schema:s}){const n=_e(s?{...s}:void 0).filter(({key:a,prop:l})=>l["x-table-column"]===!0&&!l["x-image"]&&t.metadata?.[a]!==void 0&&t.metadata[a]!==null&&t.metadata[a]!=="");return n.length?e.jsx("p",{"data-testid":"record-summary",className:"-mt-2 truncate text-sm text-muted-foreground tabular-nums",children:n.map(({key:a,prop:l},o)=>e.jsxs("span",{children:[o>0?" · ":null,e.jsx(H,{value:t.metadata?.[a],prop:l})]},a))}):null}function Xe({details:t,summary:s,children:n,rootRef:a,narrow:l}){return e.jsx("div",{ref:a,className:"min-w-0 space-y-4",children:l?e.jsxs(e.Fragment,{children:[s,e.jsx("section",{"aria-label":"Details","data-testid":"record-details",children:t}),n]}):e.jsxs("div",{className:"grid grid-cols-[18rem_minmax(0,1fr)] gap-6",children:[e.jsx("aside",{className:"sticky top-12 max-h-[calc(100dvh-7rem)] min-w-0 self-start overflow-y-auto overscroll-contain pr-2 pb-16",children:t}),n]})})}function tt({entity:t,owner:s,schema:n,title:a,actions:l,details:o,summary:c,children:h,layout:j="record"}){const y=x.useRef(null),v=ve(y,Ue),N=e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"record-header",className:"sticky top-0 z-30 -mx-4 flex h-12 items-center justify-between gap-3 bg-background px-4 lg:-mx-6 lg:px-6",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-2",children:a===void 0?e.jsx(Qe,{entity:t,schema:n}):a}),l]}),j==="content"?h:e.jsx(Xe,{rootRef:y,narrow:v,details:o===void 0?e.jsx(we,{fields:De(t,n),values:t.metadata??{},context:{ownerSlug:s}}):o,summary:c===void 0?e.jsx(Ge,{entity:t,schema:n}):c,children:h})]});return j==="content"?N:e.jsx("div",{className:"mx-auto flex min-h-0 w-full max-w-7xl flex-1 flex-col gap-4 px-4 pt-2.5 pb-8 lg:px-6",children:N})}export{le as E,Ue as N,Me as S,He as a,et as b,We as c,tt as d,se as e,Xe as f,Ge as g,Qe as h};
2
- //# sourceMappingURL=entity-pages-eYbG2FDT.js.map