@lobu/runtime-server 22.0.0 → 23.0.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 (218) hide show
  1. package/dist/catalogs/connectors.json +1353 -181
  2. package/dist/catalogs/skills.json +1 -1
  3. package/dist/component.json +1 -1
  4. package/dist/connectors/README.md +14 -1
  5. package/dist/connectors/google_gmail.ts +1 -0
  6. package/dist/connectors/jira-helpers.ts +313 -0
  7. package/dist/connectors/jira.ts +29 -221
  8. package/dist/connectors/linkedin-browser-script.ts +13 -0
  9. package/dist/connectors/linkedin-draft-page.js +104 -0
  10. package/dist/connectors/linkedin-drafts.ts +73 -0
  11. package/dist/connectors/linkedin-identity.ts +32 -0
  12. package/dist/connectors/linkedin-inbox-adapter.js +1185 -0
  13. package/dist/connectors/linkedin-inbox.ts +156 -0
  14. package/dist/connectors/linkedin-like.ts +114 -0
  15. package/dist/connectors/linkedin-takeout.ts +577 -0
  16. package/dist/connectors/linkedin.ts +3998 -0
  17. package/dist/connectors/takeout-utils.ts +240 -0
  18. package/dist/connectors/tiktok-inbox-page.js +9 -9
  19. package/dist/connectors/tiktok-web-page.js +21 -15
  20. package/dist/connectors/tiktok_web.ts +63 -30
  21. package/dist/connectors/whatsapp-web-adapter.js +64 -564
  22. package/dist/connectors/whatsapp-web-helpers.ts +30 -444
  23. package/dist/connectors/whatsapp-web-identity.ts +20 -6
  24. package/dist/connectors/whatsapp_web.ts +45 -645
  25. package/dist/connectors/x-dm-adapter.js +556 -0
  26. package/dist/connectors/x-identity.ts +31 -2
  27. package/dist/connectors/x.ts +266 -120
  28. package/dist/db/migrations/20261017120000_drop_feeds_kind_virtual.sql +26 -0
  29. package/dist/db/migrations/20261017130000_drop_retired_dead_code_columns.sql +46 -0
  30. package/dist/dependencies.bun.lock +41 -41
  31. package/dist/guest.bundle.js +288 -148
  32. package/dist/owletto/dist/assets/_-3J-IrxWk.js +2 -0
  33. package/dist/owletto/dist/assets/{_-CEPl6gU4.js → _-DYUE3ix4.js} +3 -3
  34. package/dist/owletto/dist/assets/_agentId-Bn2IAjIy.js +2 -0
  35. package/dist/owletto/dist/assets/{_agentId-CBC_SadO.js → _agentId-Cam7Z0N7.js} +2 -2
  36. package/dist/owletto/dist/assets/{_automationId-YTTNksw6.js → _automationId-CXEiKVZJ.js} +2 -2
  37. package/dist/owletto/dist/assets/{_connectorKey._connectionId-fK0h7RAp.js → _connectorKey._connectionId-CS85l61t.js} +2 -2
  38. package/dist/owletto/dist/assets/{_connectorKey.index-C7TPS598.js → _connectorKey.index-clVDIyW0.js} +2 -2
  39. package/dist/owletto/dist/assets/{_conversationId-CEhxlTIo.js → _conversationId-Ci2k-BuN.js} +2 -2
  40. package/dist/owletto/dist/assets/{_deploymentId-BQfYN1U2.js → _deploymentId-BuUzGtVL.js} +2 -2
  41. package/dist/owletto/dist/assets/{_eventId-Cl8GSdjg.js → _eventId-B0662F8h.js} +2 -2
  42. package/dist/owletto/dist/assets/_name-CwWePlOl.js +2 -0
  43. package/dist/owletto/dist/assets/{_owner-cUtGHqSw.js → _owner-dTWkrKsK.js} +3 -3
  44. package/dist/owletto/dist/assets/_shape-BtS3y4M9.js +2 -0
  45. package/dist/owletto/dist/assets/_skillKey-Dc9m-nlR.js +2 -0
  46. package/dist/owletto/dist/assets/{_slug-CU1PuHB9.js → _slug-DQHutM41.js} +2 -2
  47. package/dist/owletto/dist/assets/_viewKey-B30ik8ma.js +2 -0
  48. package/dist/owletto/dist/assets/_viewKey-CUHypQnF.js +2 -0
  49. package/dist/owletto/dist/assets/{accept-invitation-D3OgJG4i.js → accept-invitation-w17IFTtf.js} +2 -2
  50. package/dist/owletto/dist/assets/{activity-route-view-DQglkhXU.js → activity-route-view-CMqYiiKM.js} +2 -2
  51. package/dist/owletto/dist/assets/{agent-card-controls-DzRs4Ix9.js → agent-card-controls-mnTN2AZt.js} +2 -2
  52. package/dist/owletto/dist/assets/{agent-client-setup-list-B2SvH7xD.js → agent-client-setup-list-Bg3hBfUV.js} +2 -2
  53. package/dist/owletto/dist/assets/{agent-connect-pages-B6uKvT_X.js → agent-connect-pages-B_vrqLVc.js} +2 -2
  54. package/dist/owletto/dist/assets/{agent-editor-form-oUnIYHd7.js → agent-editor-form-hTs7eO_U.js} +2 -2
  55. package/dist/owletto/dist/assets/{agent-guardrails-route-BaV1VpDh.js → agent-guardrails-route-BOrCXcAl.js} +2 -2
  56. package/dist/owletto/dist/assets/{agent-loading-shells-CtZJM2Gc.js → agent-loading-shells-Dqcvky-k.js} +2 -2
  57. package/dist/owletto/dist/assets/{agent-permissions-matrix-Ds48KFK9.js → agent-permissions-matrix-BOo_4r_4.js} +2 -2
  58. package/dist/owletto/dist/assets/{agent-skill-context-DPk5r08w.js → agent-skill-context-CCdvtlmH.js} +2 -2
  59. package/dist/owletto/dist/assets/{agent-skills-route-DYpB5H1J.js → agent-skills-route-BUxIswuq.js} +2 -2
  60. package/dist/owletto/dist/assets/{agent-subpage-shell-B3K_jPYR.js → agent-subpage-shell-D92imvSt.js} +2 -2
  61. package/dist/owletto/dist/assets/agent-thread-BJOijbT0.js +6 -0
  62. package/dist/owletto/dist/assets/agents-9XjpDj_S.js +2 -0
  63. package/dist/owletto/dist/assets/{agents-workbench-CMyk4PI7.js → agents-workbench-Bt5QCYQ7.js} +2 -2
  64. package/dist/owletto/dist/assets/{app._appId-DH1Qutz6.js → app._appId-CKv7_squ.js} +2 -2
  65. package/dist/owletto/dist/assets/{automation-detail-content-CEDNboId.js → automation-detail-content-vUwVumXf.js} +2 -2
  66. package/dist/owletto/dist/assets/automations-9XjpDj_S.js +2 -0
  67. package/dist/owletto/dist/assets/{callback-CU-hb8JB.js → callback-BRgcL8gz.js} +2 -2
  68. package/dist/owletto/dist/assets/{card-DIF8SF9b.js → card-Djgp00r_.js} +2 -2
  69. package/dist/owletto/dist/assets/{claim-DELEa-gH.js → claim-BYUZnyMp.js} +2 -2
  70. package/dist/owletto/dist/assets/{clients-CpG676mg.js → clients-D3Zbjxin.js} +2 -2
  71. package/dist/owletto/dist/assets/{code-editor-V27Z4o3P.js → code-editor-DHeyRGZI.js} +2 -2
  72. package/dist/owletto/dist/assets/connect-CfsFsy9P.js +2 -0
  73. package/dist/owletto/dist/assets/connect._clientId-DkiC8xos.js +2 -0
  74. package/dist/owletto/dist/assets/connected._clientId-CIXrGOsT.js +2 -0
  75. package/dist/owletto/dist/assets/{connected._clientId.activity-DQWcUqKM.js → connected._clientId.activity-Ckdz6I0y.js} +2 -2
  76. package/dist/owletto/dist/assets/{connected._clientId.index-BC3R303A.js → connected._clientId.index-CNxafNeo.js} +2 -2
  77. package/dist/owletto/dist/assets/{connection-DySpRE9x.js → connection-C3XXFEqh.js} +2 -2
  78. package/dist/owletto/dist/assets/{connection-feed-detail-C_D68j6d.js → connection-feed-detail-CIJJLDP8.js} +2 -2
  79. package/dist/owletto/dist/assets/{connections-browser-Cnv2iBbZ.js → connections-browser-CKZjzRz6.js} +2 -2
  80. package/dist/owletto/dist/assets/{connector-provenance-CNXtzYg5.js → connector-provenance-8-d8hl10.js} +2 -2
  81. package/dist/owletto/dist/assets/{connector-scope-lists-BKDetNDc.js → connector-scope-lists-CadPVsI3.js} +2 -2
  82. package/dist/owletto/dist/assets/{connectors-BJnk1z_2.js → connectors-lvLJ30lo.js} +2 -2
  83. package/dist/owletto/dist/assets/{consent-BVzxrAO9.js → consent-CdSvVCgx.js} +2 -2
  84. package/dist/owletto/dist/assets/{conversations-table-DfZGICl7.js → conversations-table-BdXoZAfc.js} +2 -2
  85. package/dist/owletto/dist/assets/{core.esm-DiTpULFl.js → core.esm-CYvgWCuv.js} +2 -2
  86. package/dist/owletto/dist/assets/create-0xW9eXxG.js +2 -0
  87. package/dist/owletto/dist/assets/{create-JRFM8mMf.js → create-B0qhrrX4.js} +2 -2
  88. package/dist/owletto/dist/assets/create-CAfF-yI1.js +2 -0
  89. package/dist/owletto/dist/assets/create-automation-form-CtSSeYj3.js +3 -0
  90. package/dist/owletto/dist/assets/create._connectorKey-i6xxkWKV.js +2 -0
  91. package/dist/owletto/dist/assets/{cronstrue-DPXl0qA2.js → cronstrue-n4qGUraE.js} +2 -2
  92. package/dist/owletto/dist/assets/deployments-4Itm35Xc.js +2 -0
  93. package/dist/owletto/dist/assets/{deployments-DCQdFdwG.js → deployments-RvUdVkj3.js} +2 -2
  94. package/dist/owletto/dist/assets/{deployments-body-D6TAWs_6.js → deployments-body-BMp7UsMo.js} +2 -2
  95. package/dist/owletto/dist/assets/{device-CntqYW65.js → device-CPU6CjkJ.js} +2 -2
  96. package/dist/owletto/dist/assets/{device-pin-tombstone-Bz4JHHMK.js → device-pin-tombstone-CrjG7gPo.js} +2 -2
  97. package/dist/owletto/dist/assets/{device._deviceId-D4plO3GM.js → device._deviceId-Cs3ZmXWo.js} +2 -2
  98. package/dist/owletto/dist/assets/{entity-options-UJs64GdQ.js → entity-options-uXjgT7y9.js} +2 -2
  99. package/dist/owletto/dist/assets/{entity-page-Djz6T50J.js → entity-page-Dc0LGr5U.js} +2 -2
  100. package/dist/owletto/dist/assets/{entity-type-page-OznRag6A.js → entity-type-page-CwZxa0BR.js} +2 -2
  101. package/dist/owletto/dist/assets/{event-detail-04qOUGIP.js → event-detail-ve2d6Gbb.js} +2 -2
  102. package/dist/owletto/dist/assets/{events-feed-fucGZSJR.js → events-feed-BtvhZF1f.js} +2 -2
  103. package/dist/owletto/dist/assets/{filter-editors-DCQgGLyR.js → filter-editors-Cj-v6NtH.js} +2 -2
  104. package/dist/owletto/dist/assets/{full-page-spinner-KpV2FS2u.js → full-page-spinner-DqpH99np.js} +2 -2
  105. package/dist/owletto/dist/assets/guardrails-HFo2Ut8B.js +2 -0
  106. package/dist/owletto/dist/assets/identity-BigVSBCl.js +2 -0
  107. package/dist/owletto/dist/assets/{index-BEvyBdOU.js → index-B9uPN6FC.js} +2 -2
  108. package/dist/owletto/dist/assets/{index-BNh2cidi.js → index-BQVliQW1.js} +2 -2
  109. package/dist/owletto/dist/assets/index-BfedB4Rc.js +2 -0
  110. package/dist/owletto/dist/assets/index-CUw3aKBI.js +2 -0
  111. package/dist/owletto/dist/assets/index-CXhxUkv3.js +2 -0
  112. package/dist/owletto/dist/assets/{index-_oPeVpL_.js → index-Cr5hwh-C.js} +66 -66
  113. package/dist/owletto/dist/assets/index-CzkTV4ZQ.js +2 -0
  114. package/dist/owletto/dist/assets/index-DKSx8JN_.js +2 -0
  115. package/dist/owletto/dist/assets/{index-D3s8rhG9.js → index-DVk7Ug0d.js} +2 -2
  116. package/dist/owletto/dist/assets/index-DmZuKGf8.js +2 -0
  117. package/dist/owletto/dist/assets/{index-DCdkwg9H.js → index-Hio-HRfo.js} +2 -2
  118. package/dist/owletto/dist/assets/{index-BJXkc60S.js → index-ICgKp3YK.js} +2 -2
  119. package/dist/owletto/dist/assets/index-cPcroOH0.js +2 -0
  120. package/dist/owletto/dist/assets/{index-BOzuAbvi.js → index-n7sTbNv4.js} +2 -2
  121. package/dist/owletto/dist/assets/index-xiFpcWKv.js +2 -0
  122. package/dist/owletto/dist/assets/{json-diff-D_Ym3Uku.js → json-diff-DBoag_OS.js} +2 -2
  123. package/dist/owletto/dist/assets/{list-skeleton-Bl0OS39L.js → list-skeleton-C_GuoxAH.js} +2 -2
  124. package/dist/owletto/dist/assets/{login-QHdxqX-4.js → login-Ci6ixHuL.js} +2 -2
  125. package/dist/owletto/dist/assets/{logout-DUccApuZ.js → logout-CLGgeZB7.js} +2 -2
  126. package/dist/owletto/dist/assets/{member-scope-gate-CFbrq1by.js → member-scope-gate-B44INDPY.js} +2 -2
  127. package/dist/owletto/dist/assets/{memory-browse-page-IrIXuZTF.js → memory-browse-page-DyQiRvzl.js} +2 -2
  128. package/dist/owletto/dist/assets/{model-selector-CB1BDvlW.js → model-selector-dAbDgJvx.js} +2 -2
  129. package/dist/owletto/dist/assets/models-DpVP7ZwX.js +2 -0
  130. package/dist/owletto/dist/assets/{new-BWo8_Pms.js → new-BUb7AnEW.js} +2 -2
  131. package/dist/owletto/dist/assets/{new-B5UsLiy6.js → new-BkdULx2r.js} +2 -2
  132. package/dist/owletto/dist/assets/{new-DpmDXmFI.js → new-CHOr-EcI.js} +2 -2
  133. package/dist/owletto/dist/assets/{oauth-workspace-access-PGyTnW2K.js → oauth-workspace-access-BxsjwgdH.js} +2 -2
  134. package/dist/owletto/dist/assets/{organization-BH8PYlVu.js → organization-gxGeDjIV.js} +2 -2
  135. package/dist/owletto/dist/assets/{peek-pane-content-B2AFNTzP.js → peek-pane-content-CHoQHe2H.js} +2 -2
  136. package/dist/owletto/dist/assets/{permissions-CwN_YP3u.js → permissions-aPHaKLec.js} +2 -2
  137. package/dist/owletto/dist/assets/{proposal-review-shell-DKKGu4Ww.js → proposal-review-shell-UcZr87_Q.js} +2 -2
  138. package/dist/owletto/dist/assets/public-shell-ready-DcnlADmj.js +2 -0
  139. package/dist/owletto/dist/assets/{recent-DqdZE_TI.js → recent-D-65Pgu-.js} +2 -2
  140. package/dist/owletto/dist/assets/{record-activity-CvgZyCmw.js → record-activity-CBXH6v1d.js} +2 -2
  141. package/dist/owletto/dist/assets/{renderer-BL6VcwQH.js → renderer-mEDnVW0O.js} +2 -2
  142. package/dist/owletto/dist/assets/{reset-password-DAvBYkiI.js → reset-password-uX_V6bip.js} +2 -2
  143. package/dist/owletto/dist/assets/{runs-BWtc5rmc.js → runs-C0rCgGwX.js} +2 -2
  144. package/dist/owletto/dist/assets/runs-panel-Du1JMjg5.js +2 -0
  145. package/dist/owletto/dist/assets/{runs-table-DxIiqrSk.js → runs-table-syPJ6r6T.js} +2 -2
  146. package/dist/owletto/dist/assets/{settings-Crxlwps-.js → settings-9NkNA1G1.js} +2 -2
  147. package/dist/owletto/dist/assets/settings-E-10sLQX.js +2 -0
  148. package/dist/owletto/dist/assets/skills-D2Ri9b4f.js +2 -0
  149. package/dist/owletto/dist/assets/{source-record-panels-CRIPMWfN.js → source-record-panels-CPyzlfD1.js} +2 -2
  150. package/dist/owletto/dist/assets/{status-dot-C5KDvvm9.js → status-dot-B-EWMgq6.js} +2 -2
  151. package/dist/owletto/dist/assets/{tabs-B4Er9hJj.js → tabs-DqIIkCX-.js} +2 -2
  152. package/dist/owletto/dist/assets/{use-mention-search-DqEykWl_.js → use-mention-search-By8RZyKW.js} +2 -2
  153. package/dist/owletto/dist/assets/{view-param-filters-Cylutoy1.js → view-param-filters-CqLZQrnO.js} +2 -2
  154. package/dist/owletto/dist/index.html +1 -1
  155. package/dist/server-main.bundle.mjs +11447 -10762
  156. package/npm-shrinkwrap.json +160 -160
  157. package/package.json +1 -1
  158. package/vendor/connector-sdk/dist/browser-handoff-banner.d.ts +39 -0
  159. package/vendor/connector-sdk/dist/browser-handoff-banner.js +175 -0
  160. package/vendor/connector-sdk/dist/browser-source-read.d.ts +52 -0
  161. package/vendor/connector-sdk/dist/browser-source-read.js +107 -0
  162. package/vendor/connector-sdk/dist/connector-types.d.ts +10 -0
  163. package/vendor/connector-sdk/dist/index.d.ts +3 -0
  164. package/vendor/connector-sdk/dist/index.js +2 -0
  165. package/vendor/connector-sdk/package.json +9 -1
  166. package/vendor/core/dist/capabilities.d.ts +1 -1
  167. package/vendor/core/dist/capabilities.js +0 -1
  168. package/vendor/core/dist/connector-query-errors.d.ts +32 -0
  169. package/vendor/core/dist/connector-query-errors.js +41 -1
  170. package/vendor/core/dist/contracts/tools/manage-conversations.js +2 -2
  171. package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +14 -0
  172. package/vendor/core/dist/contracts/tools/manage-feeds.js +17 -0
  173. package/vendor/core/dist/contracts/worker/protocol.d.ts +8 -131
  174. package/vendor/core/dist/contracts/worker/protocol.js +9 -61
  175. package/vendor/core/dist/device-pin-tombstones.d.ts +44 -0
  176. package/vendor/core/dist/device-pin-tombstones.js +57 -0
  177. package/vendor/core/dist/index.d.ts +2 -1
  178. package/vendor/core/dist/index.js +1 -0
  179. package/vendor/core/dist/logger.js +10 -25
  180. package/vendor/core/dist/utils/diagnostic-scrubber.js +258 -21
  181. package/vendor/core/dist/worker/wire.d.ts +0 -10
  182. package/vendor/core/package.json +6 -6
  183. package/vendor/views/package.json +1 -1
  184. package/dist/owletto/dist/assets/_-C_zNZben.js +0 -2
  185. package/dist/owletto/dist/assets/_agentId-QQW91cHX.js +0 -2
  186. package/dist/owletto/dist/assets/_name-t3oBJ6Zf.js +0 -2
  187. package/dist/owletto/dist/assets/_shape-bo2lMVCu.js +0 -2
  188. package/dist/owletto/dist/assets/_skillKey-Dwm4Q4wI.js +0 -2
  189. package/dist/owletto/dist/assets/_viewKey-Bh6E_NxA.js +0 -2
  190. package/dist/owletto/dist/assets/_viewKey-D4jKl-Zf.js +0 -2
  191. package/dist/owletto/dist/assets/agent-thread-C8UaUTWc.js +0 -6
  192. package/dist/owletto/dist/assets/agents-F4mGI2oF.js +0 -2
  193. package/dist/owletto/dist/assets/automations-F4mGI2oF.js +0 -2
  194. package/dist/owletto/dist/assets/connect-B2YL6qIK.js +0 -2
  195. package/dist/owletto/dist/assets/connect._clientId-B6LDmDRV.js +0 -2
  196. package/dist/owletto/dist/assets/connected._clientId-D_HaKoI1.js +0 -2
  197. package/dist/owletto/dist/assets/create-CUqO6Kfk.js +0 -2
  198. package/dist/owletto/dist/assets/create-automation-form-_4vUkrls.js +0 -3
  199. package/dist/owletto/dist/assets/create-iHcxV0xd.js +0 -2
  200. package/dist/owletto/dist/assets/create._connectorKey-CCYLEicg.js +0 -2
  201. package/dist/owletto/dist/assets/deployments-ihkhK1zV.js +0 -2
  202. package/dist/owletto/dist/assets/guardrails-molekzAF.js +0 -2
  203. package/dist/owletto/dist/assets/identity-BJcaG66g.js +0 -2
  204. package/dist/owletto/dist/assets/index-B04ON9Jv.js +0 -2
  205. package/dist/owletto/dist/assets/index-BOsK-K-2.js +0 -2
  206. package/dist/owletto/dist/assets/index-Bk1x7A67.js +0 -2
  207. package/dist/owletto/dist/assets/index-CFnx5huL.js +0 -2
  208. package/dist/owletto/dist/assets/index-Dbd1jusf.js +0 -2
  209. package/dist/owletto/dist/assets/index-DqZuqC08.js +0 -2
  210. package/dist/owletto/dist/assets/index-Dr-Xg_xO.js +0 -2
  211. package/dist/owletto/dist/assets/index-KPOvMVa-.js +0 -2
  212. package/dist/owletto/dist/assets/models-DnMb3n-Z.js +0 -2
  213. package/dist/owletto/dist/assets/public-shell-ready-7KYnww6e.js +0 -2
  214. package/dist/owletto/dist/assets/runs-panel-BO3h5RkS.js +0 -2
  215. package/dist/owletto/dist/assets/settings-4Ev-0iNL.js +0 -2
  216. package/dist/owletto/dist/assets/skills-D0X430X8.js +0 -2
  217. package/vendor/core/dist/contracts/worker/device-chat.d.ts +0 -4
  218. package/vendor/core/dist/contracts/worker/device-chat.js +0 -26
@@ -1,2 +1,2 @@
1
- import{at as sn,j as n,r as k,m as V,n as se,cb as on,cc as vt,cd as yt,L as je,ce as an,cf as cn,k as rn,cg as gt,ch as ln,bY as dn,ci as un,ai as mn,cj as xt,ck as A,bl as fn,cl as pn,cm as hn,bm as vn,cn as yn,co as ne,c9 as gn,cp as bt,cq as xn,an as bn,cr as jn,aZ as kn,ba as Sn,aq as xe,cs as Nn,ct as Cn,t as jt,cu as kt,cv as _n,cw as In,cx as En,cy as St,cz as An,c6 as Fn,cA as Tn,be as wn,aV as Rn,S as Nt,cB as Pn,I as Ln,P as Oe,X as On,B as $e,cC as $n,bn as Mn,bo as Dn,bp as Kn,bq as Bn,br as Vn,cD as Gn,cE as Qn,bz as Un,cF as Wn,cG as zn,cH as qn,ae as Ct,g as Yn,cI as Zn,cJ as we,cK as ct,cL as Hn,cM as Xn,cN as Jn,cO as es,cP as ts,cQ as ns,cR as ss,cS as os,cT as as,cU as is,cV as cs,bK as rs,cW as ls,cX as ds,aQ as rt,cY as lt,cZ as _t,c_ as Re,c$ as It,d0 as us,d1 as Pe}from"./index-_oPeVpL_.js";import{S as $,F as ms,d as fs,o as ge,r as ps,f as hs,a as vs}from"./filter-editors-DCQgGLyR.js";import{c as dt}from"./connection-label-BobuYiAG.js";import{u as ys}from"./runs-BWtc5rmc.js";import{S as gs}from"./source-record-panels-CRIPMWfN.js";import{u as xs}from"./clients-CpG676mg.js";import{g as bs}from"./client-rows-EJSKR6z1.js";import{E as js}from"./events-feed-fucGZSJR.js";import{L as ks,u as Ss}from"./renderer-BL6VcwQH.js";import{E as Ns}from"./agent-loading-shells-CtZJM2Gc.js";import{M as Cs}from"./member-scope-gate-CFbrq1by.js";const Me=k.createContext(null);function _s({organizationId:e,isWorkspaceLoading:t,children:o}){const{data:s=[],isLoading:i}=sn(e);return n.jsx(Me.Provider,{value:{groups:s,isLoading:!!t||i},children:o})}function Is(){const e=k.useContext(Me);if(!e)throw new Error("useMemoryConnectorGroups must be used within MemoryConnectorGroupsProvider");return e}function Es(){return k.useContext(Me)}function Et(e){const{parse:t,serialize:o,filterKeys:s,clearClassifications:i=!0,replace:l=!0,merge:y}=e,m=V(),d=se(),r=k.useMemo(()=>{const f=new URLSearchParams;for(const[u,g]of Object.entries(d.search||{}))g!=null&&f.set(u,typeof g=="object"&&!Array.isArray(g)?JSON.stringify(g):String(g));return t(f)},[d.search,t]),a=k.useCallback((f,u)=>{const g=y?y(r,f):{...r,...f},x=o(g),_={};for(const[j,b]of Object.entries(d.search||{}))b!=null&&(_[j]=b);for(const j of s)delete _[j];if(i)for(const j of Object.keys(_))j.startsWith("clf_")&&delete _[j];for(const[j,b]of Object.entries(x))b!==void 0&&(_[j]=b);m({to:d.pathname,search:_,replace:u?.replace??l})},[r,o,s,i,y,m,d,l]),c=k.useCallback(()=>{const f={};for(const[u,g]of Object.entries(d.search||{}))g!=null&&(s.includes(u)||i&&u.startsWith("clf_")||(f[u]=g));m({to:d.pathname,search:f,replace:l})},[m,d.pathname,d.search,s,i,l]);return{filters:r,updateFilters:a,clearFilters:c}}function As(e){const{slug:t}=on();return vt({queryKey:["schedules",t,e],queryFn:async()=>((await yt("manage_schedules",{action:"list",action_type:"wake_agent",include_paused:!0})).schedules??[]).filter(s=>s.action_args?.agent_id===e),enabled:!!t&&!!e,staleTime:3e4})}function Fs(e,t){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:e,connectorKey:t.connector_key,connectionId:String(t.connection_id)},search:{feedId:t.id}}}function Ts(e,t){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:e,connectorKey:t.connector_key,connectionId:String(t.id)}}}function ws(e,t){return{to:"/$owner/agents/connected/$clientId",params:{owner:e,clientId:t}}}function Rs(e,t){return{to:"/$owner/automations/$automationId",params:{owner:e,automationId:t}}}function Ps(e,t,o){return{to:"/$owner/events",params:{owner:e},search:{agent:t,schedule:o}}}function fe({id:e,label:t,value:o,sourceLink:s,details:i,onRemove:l}){return{id:e,label:t,op:"is",value:o,onRemove:l,editor:s||i?{kind:"custom",className:"w-80",render:()=>n.jsxs("div",{className:"flex flex-col gap-2 p-3 text-sm",children:[s?n.jsxs(je,{to:s.to,params:s.params,search:s.search,className:"inline-flex min-w-0 items-center gap-1.5 font-medium text-foreground hover:underline",children:[n.jsx("span",{className:"truncate",children:o}),n.jsx(an,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}):n.jsx("span",{className:"font-medium",children:o}),i]})}:void 0}}function Ls({ownerSlug:e,clientIds:t,linkedUser:o,linkedUserEntitySlug:s}){const i=e&&s?cn(e,[{entity_type:"$member",slug:s}]):null;return n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"inline-flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[n.jsx("span",{children:t.length===1?"Client ID":"Client IDs"}),t.map(l=>n.jsx("code",{className:"break-all text-foreground",children:l},l))]}),o?n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:["Granted by",i?n.jsx(je,{to:i,className:"font-medium text-foreground hover:underline",children:o}):n.jsx("span",{className:"font-medium text-foreground",children:o})]}):null]})}function H(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function pe(e,t,o){const s=new Set;for(const[i,l]of Object.entries(e.feeds_schema??{})){if(o&&!o.has(i))continue;const y=H(H(l)?.eventKinds);if(y)for(const[m,d]of Object.entries(y)){if(!t){s.add(m);continue}const r=H(d)?.attributions;Array.isArray(r)&&r.some(a=>{const c=H(H(a)?.target);return typeof c?.entityType=="string"&&t.has(c.entityType)})&&s.add(m)}}return s}function Os({connectors:e,entityTypes:t,selectedPlatforms:o=[],selectedFeeds:s=[],selectedEntityTypes:i=[]}){const l=new Set,y=new Set(o),m=new Set(i),d=new Map;for(const r of s){const a=d.get(r.connectorKey)??new Set;a.add(r.feedKey),d.set(r.connectorKey,a)}if(d.size>0)for(const r of e){const a=d.get(r.key);if(a)for(const c of pe(r,void 0,a))l.add(c)}else if(y.size>0){for(const r of e)if(y.has(r.key))for(const a of pe(r))l.add(a)}else if(m.size>0){for(const r of t)if(m.has(r.slug))for(const a of Object.keys(r.event_kinds??{}))l.add(a);for(const r of e)for(const a of pe(r,m))l.add(a)}else{for(const r of t)for(const a of Object.keys(r.event_kinds??{}))l.add(a);for(const r of e)for(const a of pe(r))l.add(a)}return[...l].sort((r,a)=>r.localeCompare(a))}function $s(e){const{orgContext:t}=rn(),{data:o=[],isLoading:s}=gt(t);return{visible:k.useMemo(()=>o.filter(l=>!ln(l)&&(!l.organization_slug||l.organization_slug===e)),[o,e]),isTypesLoading:s}}function te({to:e,params:t,search:o,label:s}){return n.jsx(je,{to:e,params:t,search:o,onClick:i=>i.stopPropagation(),onPointerDown:i=>i.stopPropagation(),className:"shrink-0 rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100","aria-label":`Manage ${s}`,children:n.jsx(dn,{className:"h-3.5 w-3.5"})})}const Le=["produced","analyzed"],be=e=>e==="produced"?"Produced by":"Analyzed by";function Ms({enabled:e,...t}){const o=Ds(t,e);if(!e)return{fields:[],chips:[]};const s=Ks(t);return{fields:[o.field,s.field],chips:[...o.chips,...s.chips]}}function Ds({ownerSlug:e,filters:t,onFiltersChange:o},s){const i=vt({queryKey:["automations-list","activity",e],queryFn:async()=>{const a=await Promise.all(["active","archived"].map(c=>yt("manage_automations",{action:"list",status:c,include_details:!1},{slug:e})));return[...new Map(a.flatMap(c=>c.automations).map(c=>[Number(c.automation_id),c])).values()].sort((c,f)=>c.name.localeCompare(f.name))},enabled:s&&!!e,staleTime:3e4}),l=i.data??[],y=a=>a==="produced"?t.producedByAutomationId:t.automationId,m=a=>l.find(c=>Number(c.automation_id)===a)?.name??`#${a}`,d=Le.flatMap(a=>{const c=y(a);return c==null?[]:[{id:`automation-${a}`,field:"automation",label:be(a),value:m(c),onRemove:()=>o(a==="produced"?{producedByAutomationId:null}:{automationId:null})}]}),r={kind:"list",className:"w-80",searchPlaceholder:"Search Automations...",emptyText:i.isLoading?"Loading Automations...":"No Automations found",items:a=>n.jsxs(n.Fragment,{children:[Le.map(c=>{const f=y(c),u=l.map(x=>({id:Number(x.automation_id),label:`${x.name}${x.status==="archived"?" (archived)":""}`}));f!=null&&!u.some(x=>x.id===f)&&u.unshift({id:f,label:`Automation #${f} (selected)`});const g=x=>{o(c==="produced"?{producedByAutomationId:x}:{automationId:x}),a()};return n.jsx(xt,{heading:be(c),children:u.map(x=>n.jsxs(A,{"aria-label":x.label,value:`${c} ${x.label} ${x.id}`,onSelect:()=>g(x.id),className:"group",children:[n.jsx($,{selected:f===x.id}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.label}),n.jsx(te,{...Rs(e,String(x.id)),label:x.label})]},x.id))},c)}),i.isError?n.jsx(A,{forceMount:!0,onSelect:()=>void i.refetch(),children:"Could not load Automations. Retry"}):null]})};return{chips:d,field:{key:"automation",label:"Automation",group:"Scope",icon:n.jsx(un,{className:"h-4 w-4"}),editor:r}}}function Ks(e){const{filters:t,onFiltersChange:o}=e,s=[];t.runIds?.length&&s.push({id:"run-produced",field:"run",label:"Produced by run",value:t.runIds.map(l=>`#${l}`).join(", "),onRemove:()=>o({runIds:null})}),t.runId!=null&&s.push({id:"run-analyzed",field:"run",label:"Analyzed by run",value:`#${t.runId}`,onRemove:()=>o({runId:null})});const i={kind:"list",className:"w-96",searchPlaceholder:"Search runs or enter a run ID...",emptyText:"No matching runs. Enter an exact run ID or load more.",items:(l,y)=>Le.map(m=>n.jsx(Bs,{...e,mode:m,query:y,close:l},m))};return{chips:s,field:{key:"run",label:"Run",group:"Scope",icon:n.jsx(mn,{className:"h-4 w-4"}),editor:i}}}function Bs({ownerSlug:e,filters:t,onFiltersChange:o,mode:s,query:i,close:l}){const y=s==="produced"?t.producedByAutomationId:t.automationId,m=ys({workspace:!0},{automationIds:y==null?void 0:[y],runTypes:s==="analyzed"?["automation"]:void 0,connectionIds:s==="produced"?t.connectionIds??void 0:void 0,feedIds:s==="produced"?t.feedIds??void 0:void 0},e),d=s==="produced"?t.runIds??[]:t.runId==null?[]:[t.runId],r=m.data?.pages.flatMap(u=>u.runs)??[],a=[...new Map(r.map(u=>[u.id,{id:u.id,label:`Run #${u.id} · ${u.feed_display_name??u.operation_key??u.run_type} · ${u.status}`}])).values()];for(const u of d)a.some(g=>g.id===u)||a.unshift({id:u,label:`Run #${u} (selected)`});const c=u=>{if(s==="produced"){const g=d.includes(u)?d.filter(x=>x!==u):[...d,u];o({runIds:g.length?g:null})}else o({runId:u}),l()},f=/^\d+$/.test(i.trim())?Number(i.trim()):0;return n.jsxs(xt,{heading:be(s),children:[a.map(u=>n.jsxs(A,{value:`${s} ${u.label}`,onSelect:()=>c(u.id),children:[n.jsx($,{selected:d.includes(u.id)}),n.jsx("span",{className:"truncate",children:u.label})]},u.id)),Number.isSafeInteger(f)&&f>0&&!a.some(u=>u.id===f)?n.jsxs(A,{value:`${s} ${f}`,onSelect:()=>c(f),children:[be(s)," run #",f]}):null,m.isLoading?n.jsx(A,{disabled:!0,forceMount:!0,children:"Loading runs..."}):null,m.isError?n.jsx(A,{forceMount:!0,onSelect:()=>void(m.isFetchNextPageError?m.fetchNextPage():m.refetch()),children:"Could not load runs. Retry"}):null,!m.isLoading&&!m.isError&&!a.length?n.jsx(A,{disabled:!0,forceMount:!0,children:"No runs found"}):null,m.hasNextPage?n.jsx(A,{forceMount:!0,disabled:m.isFetching,onSelect:()=>void m.fetchNextPage(),children:m.isFetchingNextPage?"Loading more runs...":"Load more runs"}):null]})}const De="Scope",Te="Source",G="h-4 w-4";function oe(){return se().search??{}}function At(e){const{pathname:t}=se(),{_splat:o}=vn({strict:!1}),s=!!(o&&!yn(o.split("/")[0])&&!t.startsWith(`/${e}/events/`));return{pathname:t,embedded:s,recordPath:s||t.startsWith(`/${e}/events/`)?o:void 0}}function Ft(e){const t=oe(),{recordPath:o,pathname:s,embedded:i}=At(e);return l=>{const y=ne(e,t,l,o);return i?{to:s,search:y.search}:y}}const ut=e=>new Set((e??"").split(",").map(t=>t.trim()).filter(Boolean));function Vs({ownerSlug:e,sourceRead:t=!1,filters:o,onFiltersChange:s}){const i=oe(),{recordPath:l,embedded:y}=At(e),m=l?l.split("/").at(-2):void 0,d=typeof i.type=="string"&&i.type.trim()?i.type.trim():void 0,r=m??(d?fn(d):void 0),a=pn(i),c=hn(i),f=typeof i.feed_ids=="string"?i.feed_ids:typeof i.feed_ids=="number"?String(i.feed_ids):void 0,u=Gs(e,r,!y),g=Qs(e,r,l,y),x=Us(e,a,!t),_=Ms({ownerSlug:e,filters:o,onFiltersChange:s,enabled:!t}),j=Ws(e,c,f);return[u,g,x,_,j].reduce((b,I)=>({fields:[...b.fields,...I.fields],chips:[...b.chips,...I.chips]}),{fields:[],chips:[]})}function Gs(e,t,o){const s=V(),i=oe(),{visible:l}=$s(e);if(!o)return{fields:[],chips:[]};const y=l.find(d=>d.slug===t),m={kind:"list",searchPlaceholder:"Search types...",emptyText:"No entity types",items:d=>n.jsxs(n.Fragment,{children:[l.map(r=>n.jsxs(A,{onSelect:()=>{s(ne(e,i,{entity:void 0,create:void 0,type:r.slug})),d()},className:"group gap-2",children:[n.jsx($,{selected:r.slug===t}),n.jsx(En,{icon:r.icon,className:"h-4 w-4 shrink-0"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:r.name}),typeof r.entity_count=="number"?n.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:r.entity_count}):null,n.jsx(te,{to:"/$owner/entity-types/$slug",params:{owner:e,slug:r.slug},label:r.name})]},r.id)),n.jsxs(A,{onSelect:()=>{s(An(e)),d()},className:"text-muted-foreground",children:[n.jsx(St,{className:"h-4 w-4 shrink-0"}),"Add entity type"]})]})};return{fields:[{key:"type",label:"Entity type",group:De,icon:n.jsx(gn,{className:G}),editor:m}],chips:t?[{id:"type",label:"Entity type",op:"is",value:y?.name??t,onRemove:()=>void s(ne(e,i,{type:void 0}))}]:[]}}function Qs(e,t,o,s){const i=V(),l=oe(),[y,m]=k.useState(""),[d,r]=k.useState(0),a=bt(y,250),c={slug:e},{data:f,isLoading:u,isError:g,refetch:x}=xn(t??"",c,{search:a,offset:d,limit:30,enabled:!s&&!!t}),{data:_}=bn(o?`/${e}/${o}`:"",c),j=o?_?.entity:void 0,b=j?.name??(o?o.split("/").at(-1):void 0);if(s)return{fields:[],chips:b?[{id:"entity",label:"Entity",op:"is",value:b}]:[]};if(!t)return{fields:[],chips:[]};const I={kind:"list",searchPlaceholder:"Search entities...",emptyText:u?"Loading entities...":"No matching entities",className:"w-80",onQueryChange:T=>{m(T),r(0)},items:T=>n.jsxs(n.Fragment,{children:[g?n.jsx(A,{onSelect:()=>void x(),children:"Could not load entities. Retry"}):f?.entities.map(E=>n.jsxs(A,{value:E.slug,onSelect:()=>{const R=Fn(Tn([...E.parent_slug&&E.parent_entity_type?[{entity_type:E.parent_entity_type,slug:E.parent_slug}]:[],{entity_type:E.entity_type,slug:E.slug}]));i(ne(e,l,{type:t},R)),T()},children:[n.jsx($,{selected:j?.slug===E.slug}),E.name]},E.slug)),d>0&&n.jsx(A,{onSelect:()=>r(Math.max(0,d-30)),children:"Previous entities"}),f?.metadata.has_more&&n.jsx(A,{disabled:u,onSelect:()=>r(d+30),children:"More entities"})]})};return{fields:[{key:"entity",label:"Entity",group:De,icon:n.jsx(jn,{className:G}),editor:I}],chips:b?[{id:"entity",label:"Entity",op:"is",value:b,onRemove:()=>void i(ne(e,l,{type:t}))}]:[]}}function Us(e,t,o){const s=V(),i=Ft(e),{data:l=[]}=kn(),y=k.useMemo(()=>[...l].sort((r,a)=>r.name.localeCompare(a.name)),[l]);if(!o)return{fields:[],chips:[]};const m=y.find(r=>r.agentId===t),d={kind:"list",searchPlaceholder:"Search agents...",emptyText:"No agents",items:r=>y.map(a=>n.jsxs(A,{onSelect:()=>{s(i({agent:a.agentId,schedule:void 0})),r()},className:"gap-2",children:[n.jsx($,{selected:a.agentId===t}),n.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-muted text-[10px] font-medium",children:a.name.trim().charAt(0).toUpperCase()||"?"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.name})]},a.agentId))};return{fields:[{key:"agent",label:"Agent",group:De,icon:n.jsx(Sn,{className:G}),editor:d}],chips:t?[{id:"agent",label:"Agent",op:"is",value:m?.name??t,onRemove:()=>void s(i({agent:void 0,schedule:void 0}))}]:[]}}function Ws(e,t,o){const s=V(),i=Ft(e),{groups:l}=Is(),y=oe(),m=xe({platforms:String(y.platforms??y.platform??"")}).platforms??[],d=k.useMemo(()=>ut(t),[t]),r=k.useMemo(()=>ut(o),[o]),a=m.length===1?m[0]:Nn(l,d),c=l.find(S=>S.connector_key===a),f=d.size===1?Number([...d][0]):void 0,u=Cn(f),{org:g}=jt(),x=kt(g?.id,{feedIds:[...r].map(Number),enabled:f==null&&r.size>0}),_=f==null?x:u,j=_.data??[],b={platforms:void 0,platform:void 0,connection_ids:void 0,feed_ids:void 0},I={kind:"list",searchPlaceholder:"Search connectors...",emptyText:"No connectors",items:S=>n.jsxs(n.Fragment,{children:[l.map(p=>{const C=p.connector_name??p.connector_key;return n.jsxs(A,{disabled:p.connections.length===0,onSelect:()=>{s(i({...b,platforms:p.connector_key})),S()},className:"group gap-2",children:[n.jsx($,{selected:p.connector_key===c?.connector_key}),n.jsx(Rn,{plain:!0,name:C,faviconDomain:p.favicon_domain,className:"h-5 w-5 shrink-0 rounded-md text-[10px]"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:C}),p.connection_count>0?n.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:p.connection_count}):null,n.jsx(te,{to:"/$owner/connectors/$connectorKey",params:{owner:e,connectorKey:p.connector_key},label:C})]},p.connector_key)}),n.jsx(A,{asChild:!0,onSelect:S,className:"text-muted-foreground",children:n.jsxs(je,{to:"/$owner/connectors/create",params:{owner:e},className:"flex items-center gap-2",children:[n.jsx(St,{className:"h-4 w-4 shrink-0"}),"Add connector"]})})]})},T=[{key:"connector",label:"Connector",group:Te,icon:n.jsx(wn,{className:G}),editor:I}],E=[],R=c?.connector_name??c?.connector_key??(m.join(", ")||(d.size?`Connections ${[...d].join(", ")}`:void 0));if(R&&E.push({id:"connector",label:"Connector",op:"is",value:R,onRemove:()=>void s(i(b))}),c){T.push({key:"connection",label:"Connection",group:Te,icon:n.jsx(_n,{className:G}),editor:M(c)});const S=d.size===1?c.connections.find(p=>d.has(String(p.id))):void 0;S&&E.push({id:"connection",label:"Connection",op:"is",value:dt({display_name:S.display_name,connector_name:c.connector_name,connector_key:c.connector_key}),onRemove:()=>void s(i({...b,platforms:c.connector_key}))})}if((f||o)&&T.push({key:"feed",label:"Feed",group:Te,icon:n.jsx(In,{className:G}),editor:D()}),r.size>0){const S=r.size===1?j.find(p=>r.has(String(p.id))):void 0;E.push({id:"feed",label:"Feed",op:"is",value:S?he(S):`#${o}`,onRemove:()=>void s(i({...f!=null?{connection_ids:String(f)}:{},feed_ids:void 0}))})}return{fields:T,chips:E};function M(S){return{kind:"list",searchPlaceholder:"Search connections...",emptyText:"No connections",items:p=>S.connections.map(C=>{const Q=dt({display_name:C.display_name,connector_name:S.connector_name,connector_key:S.connector_key});return n.jsxs(A,{onSelect:()=>{s(i({connection_ids:String(C.id),feed_ids:void 0})),p()},className:"group gap-2",children:[n.jsx($,{selected:d.has(String(C.id))}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:Q}),C.feed_count>0?n.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:C.feed_count}):null,n.jsx(te,{...Ts(e,{id:C.id,connector_key:S.connector_key}),label:Q})]},C.id)})}}function D(){return{kind:"list",searchPlaceholder:"Search feeds...",emptyText:_.isLoading?"Loading feeds...":"No feeds",items:S=>j.map(p=>n.jsxs(A,{"aria-label":he(p),onSelect:()=>{s(i({...f!=null?{connection_ids:String(f)}:{},feed_ids:String(p.id)})),S()},className:"group gap-2",children:[n.jsx($,{selected:r.has(String(p.id))}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:he(p)}),n.jsx(te,{...Fs(e,p),label:he(p)})]},p.id))}}}function he(e){return e.display_name?.trim()||e.feed_key}const zs=["notification"],qs=["note","summary","decision","observation","fact","change","preference","identity"],Ys=[...zs,...qs],mt=[{value:"date-desc",label:"Newest first"},{value:"date-asc",label:"Oldest first"},{value:"score-desc",label:"Highest score"},{value:"score-asc",label:"Lowest score"}],ft=[{value:"user",label:"Manual review"},{value:"system",label:"Auto-classified"},{value:"llm",label:"LLM-classified"}],pt=[{value:"pending",label:"Pending approval"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}],ve=0,ye=100,X="Event",J="h-4 w-4";function ee(e){const t=e.replace(/[_-]+/g," ").trim();return t.length>0?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:e}function Zs(e,t,o){const s=e.semanticTypes??[],i=o.length>0?o:Ys,l=[...new Set([...i,...s])].sort((c,f)=>ee(c).localeCompare(ee(f))).map(c=>({value:c,label:ee(c)})),y=e.engagementRange??[ve,ye],m=e.reviewStatus,d=e.interactionStatus,r=[{key:"date",label:"Date",group:X,icon:n.jsx(Gn,{className:J}),editor:fs({value:e.dateRange??void 0,onApply:c=>t({dateRange:c})})},{key:"kind",label:"Event kind",group:X,icon:n.jsx(Qn,{className:J}),editor:ge({searchPlaceholder:"Search event kinds...",emptyText:"No event kinds found",options:l,selected:s,multiple:!0,onSelect:c=>{const f=s.includes(c)?s.filter(u=>u!==c):[...s,c];t({semanticTypes:f.length>0?f:void 0})}})},{key:"approval",label:"Approval",group:X,icon:n.jsx(Un,{className:J}),editor:ge({searchPlaceholder:"Search statuses...",options:[...pt],selected:d?[d]:[],onSelect:c=>t({interactionStatus:c})})},{key:"review",label:"Reviewed by",group:X,icon:n.jsx(Wn,{className:J}),editor:ge({searchPlaceholder:"Search reviewers...",options:[...ft],selected:m&&m!=="all"?[m]:[],onSelect:c=>t({reviewStatus:c})})},{key:"score",label:"Engagement score",group:X,icon:n.jsx(zn,{className:J}),editor:ps({value:y,min:ve,max:ye,onApply:c=>t({engagementRange:c})})}],a=[];return e.dateRange&&a.push({id:"date",label:"Date",op:"is",value:hs(e.dateRange),onRemove:()=>t({dateRange:null})}),s.length&&a.push({id:"kind",label:"Event kind",op:s.length>1?"is any of":"is",value:s.length<=2?s.map(ee).join(", "):`${s.length} kinds`,title:s.map(ee).join(", "),onRemove:()=>t({semanticTypes:void 0})}),d&&a.push({id:"approval",label:"Approval",op:"is",value:pt.find(c=>c.value===d)?.label??d,onRemove:()=>t({interactionStatus:null})}),m&&m!=="all"&&a.push({id:"review",label:"Reviewed by",op:"is",value:ft.find(c=>c.value===m)?.label??m,onRemove:()=>t({reviewStatus:void 0})}),(y[0]!==ve||y[1]!==ye)&&a.push({id:"score",label:"Engagement score",value:vs(y,ve,ye),onRemove:()=>t({engagementRange:void 0})}),{fields:r,chips:a}}function Tt({filters:e,onFiltersChange:t,eventKinds:o=[],searchQuery:s,onSearchChange:i,scope:l,extraFields:y=[],drillChips:m=[],total:d,isListLoading:r=!1,isTotalLoading:a=!1,hasCursorInUrl:c=!1,onGoToLatest:f,leading:u,sourceRead:g=!1,filterTrailing:x,onClearFilters:_}){const j=s.trim().length>0,b=g?{fields:[],chips:[]}:Zs(e,t,o),I=[...l?.fields??[],...b.fields,...y],T=[...l?.chips??[],...m,...b.chips],E=T.length>0||j,R=`${e.sortBy??"date"}-${e.sortOrder??"desc"}`,M=mt.find(S=>S.value===R)?.label??"Newest first",D=r||a?n.jsx(Nt,{className:"h-4 w-20"}):d==null?null:E?`${d.toLocaleString()} ${d===1?"match":"matches"}`:`${d.toLocaleString()} ${d===1?"item":"items"}`;return n.jsxs("div",{className:"w-full space-y-2.5",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[u,!g&&n.jsxs("div",{className:"relative w-full min-w-48 flex-1 sm:max-w-xs",children:[n.jsx(Pn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),n.jsx(Ln,{type:"search","aria-label":"Search events",placeholder:"Search events...",value:s,onChange:S=>i(S.target.value),className:Oe("pl-9",j&&"pr-8")}),j&&n.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>i(""),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground transition-colors hover:text-foreground",children:n.jsx(On,{className:"h-3.5 w-3.5"})})]}),n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[!r&&c&&f&&n.jsxs($e,{variant:"ghost",size:"sm",className:"h-8 gap-1",onClick:f,children:[n.jsx($n,{className:"h-3.5 w-3.5"}),"Back to latest"]}),!g&&n.jsxs(Mn,{value:R,onValueChange:S=>{const[p,C]=S.split("-");t({sortBy:p,sortOrder:C})},children:[n.jsx(Dn,{"aria-label":"Sort",className:"h-9 w-[168px] px-2.5",children:n.jsx(Kn,{children:n.jsxs("span",{className:"truncate",children:[n.jsx("span",{className:"text-muted-foreground",children:"Sort: "}),M]})})}),n.jsx(Bn,{children:mt.map(S=>n.jsx(Vn,{value:S.value,children:S.label},S.value))})]})]})]}),n.jsx(ms,{label:"Event filters",fields:I,chips:T,meta:D,trailing:x,onClearAll:_,hasClearableState:j})]})}function wt({ownerSlug:e,...t}){const o=Vs({ownerSlug:e,sourceRead:t.sourceRead,filters:t.filters,onFiltersChange:t.onFiltersChange});return n.jsx(Tt,{...t,scope:o})}function Hs(e){const t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?null:t}function ht(e){return e.toISOString().split("T")[0]}function Xs({entityId:e,organizationId:t,ownerSlug:o,selectedRange:s,onSelectRange:i}){const{data:l,isLoading:y,error:m}=qn(t,{entityId:e},{slug:o}),d=k.useMemo(()=>{if(!l||l.length===0)return[];const f=l.map(j=>{const b=Hs(j.date);return b?{date:b,count:j.count}:null}).filter(j=>j!==null).sort((j,b)=>j.date.getTime()-b.date.getTime());if(f.length===0)return[];const u=f[0].date;if((f[f.length-1].date.getTime()-u.getTime())/(1e3*60*60*24)>180){const j=new Map;for(const b of f){const I=new Date(b.date);I.setDate(b.date.getDate()-b.date.getDay());const T=ht(I);j.set(T,(j.get(T)||0)+b.count)}return Array.from(j.entries()).map(([b,I])=>({date:b,count:I})).sort((b,I)=>new Date(b.date).getTime()-new Date(I.date).getTime())}return f.map(j=>({date:ht(j.date),count:j.count}))},[l]),r=k.useCallback(f=>{if(f.name&&i){const u=new Date(f.name),g=new Date(u);g.setDate(g.getDate()+1),i(u,g)}},[i]),a=k.useCallback(f=>{if(i&&f.startValue!==void 0&&f.endValue!==void 0){const u=new Date(f.startValue),g=new Date(f.endValue);i(u,g)}},[i]),c=k.useMemo(()=>{if(d.length===0)return null;let f;if(s){const u=s[0].toISOString().split("T")[0],g=s[1].toISOString().split("T")[0];f=[[{xAxis:u},{xAxis:g}]]}return{tooltip:{trigger:"axis",axisPointer:{type:"line"},formatter:u=>{const g=u[0];return`${new Date(g.name).toLocaleDateString()}: ${g.value} items`}},grid:{left:50,right:20,top:20,bottom:60},xAxis:{type:"category",boundaryGap:!1,data:d.map(u=>u.date),axisLabel:{formatter:u=>{const g=new Date(u);return`${g.getMonth()+1}/${g.getDate()}`}}},yAxis:{type:"value",minInterval:1,splitLine:{lineStyle:{color:"rgba(0,0,0,0.05)"}}},dataZoom:[{type:"slider",start:0,end:100,height:20,bottom:10,borderColor:"transparent",backgroundColor:"rgba(0,0,0,0.02)",fillerColor:"rgba(99, 102, 241, 0.1)",handleStyle:{color:"#6366f1"}}],series:[{type:"line",smooth:!0,areaStyle:{opacity:.3,color:new ks(0,0,0,1,[{offset:0,color:"rgba(99, 102, 241, 0.5)"},{offset:1,color:"rgba(99, 102, 241, 0.05)"}])},lineStyle:{width:2,color:"#6366f1"},itemStyle:{color:"#6366f1"},showSymbol:!1,data:d.map(u=>u.count),markLine:{silent:!0,symbol:"none",label:{position:"insideEndTop",formatter:"avg: {c}",fontSize:10,color:"#9ca3af"},lineStyle:{color:"#d1d5db",type:"dashed",width:1},data:[{type:"average",name:"Average"}]},markArea:f?{silent:!0,itemStyle:{color:"rgba(99, 102, 241, 0.1)"},data:f}:void 0}]}},[d,s]);return y||m?n.jsx("div",{className:Oe(Ct,"p-4"),children:n.jsx("div",{className:"flex h-48 w-full items-center justify-center",children:y?n.jsx(Ns,{}):n.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load timeline"})})}):!c||d.length<2?null:n.jsx(Js,{option:c,onClick:r,onDataZoom:a})}function Js({option:e,onClick:t,onDataZoom:o}){const{chartRef:s,setOption:i}=Ss({onClick:t,onDataZoom:o});return k.useEffect(()=>{i(e,!0)},[e,i]),n.jsx("div",{"data-testid":"events-timeline",className:Oe(Ct,"p-4 relative"),children:n.jsx("div",{ref:s,className:"h-48 w-full"})})}function eo({organizationId:e,ownerSlug:t,entityId:o,hideSourceFilter:s=!1,scopedEntityTypes:i,filterBarLeading:l}){const{isAuthenticated:y,isReady:m}=Yn(),{isMember:d,isLoading:r}=jt(),a=m&&y&&d,c=m&&(!y||!r&&!d),f=V(),u=se(),g=Zn(),{filters:x,updateFilters:_,clearFilters:j}=Et({parse:xe,serialize:Re,filterKeys:It,replace:!1,merge:_t}),[b,I]=k.useState(x.searchQuery||""),[T,E]=k.useState(we(x)||s&&(o!=null||!!i?.length)),R=b.trim(),M=R.length>=3?R:void 0,D=bt(M,1e3),S=k.useRef(!1);k.useEffect(()=>g.history.subscribe(({location:h,action:v})=>{const N=xe(new URLSearchParams(h.search)).searchQuery??"";!(v.type==="BACK"||v.type==="FORWARD"||v.type==="GO")&&S.current&&(N===(x.searchQuery??"")||N===(M??""))||(S.current=!1,I(N))}),[g.history,M,x.searchQuery]);const p=k.useMemo(()=>ct({...x,...i?.length?{entityTypes:i}:{}}),[x,i]),C=_;k.useEffect(()=>{S.current&&(x.searchQuery||void 0)!==D&&_({searchQuery:D})},[D,_,x.searchQuery]);const Q=()=>{S.current=!1,I(""),s&&t?f({...Pe(t,u.search??{}),...o!==void 0&&!u.pathname.startsWith(`/${t}/events/`)?{to:u.pathname}:{}}):j()},ke=we(ct(x)),Ke=o===void 0,{data:Rt=[]}=Hn(m&&a?e:null),{data:Pt=[]}=Xn(c?t:null),Be=a?Rt:Pt,{data:Ve=[]}=gt(a&&e?{organizationId:e}:void 0),ae=Es(),ie=p.connectionIds,Se=(ie?.length??0)>0,{data:Ge=[]}=Jn(m&&a?e??"":"",{connectionIds:ie??void 0,enabled:!ae&&m&&a&&Se}),Qe=p.feedIds,Ne=(Qe?.length??0)>0,{data:Ue=[]}=kt(m&&a?e:null,{feedIds:Qe??void 0,enabled:m&&a&&Ne}),We=k.useMemo(()=>ae?ae.groups.flatMap(h=>h.connections.map(v=>({id:v.id,display_name:v.display_name,connector_name:h.connector_name,connector_key:h.connector_key}))):Ge,[Ge,ae]),Ce=k.useMemo(()=>{const h=new Set(ie??[]);return[...new Set([...p.platforms??[],...We.filter(v=>h.has(v.id)).map(v=>v.connector_key)])]},[ie,We,p.platforms]),_e=k.useMemo(()=>Ue.map(h=>({connectorKey:h.connector_key,feedKey:h.feed_key})),[Ue]),Lt=k.useMemo(()=>Se&&Ce.length===0||Ne&&_e.length===0?[]:Os({connectors:Be,entityTypes:Ve,selectedPlatforms:Ce,selectedFeeds:_e,selectedEntityTypes:p.entityTypes}),[Be,p.entityTypes,Se,Ne,Ce,_e,Ve]),w=p.clientIds,ce=(w?.length??0)>0,{data:ze=[]}=xs(null,{enabled:m&&a&&ce}),re=k.useMemo(()=>{if(!w)return[];const h=new Set(w);return bs(ze).filter(v=>v.clientIds.some(N=>h.has(N)))},[w,ze]),qe=k.useMemo(()=>{if(!ce||!w)return null;const h=re.map(v=>v.title);return h.length>0?h.join(", "):w.length>1?`${w.length} client registrations`:"Client registration"},[re,w,ce]),le=re.length===1?re[0]:null,Ot=t&&le?ws(t,le.clientId):void 0,de=p.mcpActivityId??null,{data:Ye=[]}=es({enabled:m&&a&&ce&&!!de,clientIds:w??[],limit:100}),Ze=k.useMemo(()=>{if(!de)return null;const h=Ye.find(N=>N.activityId===de);if(!h)return"Selected conversation";const v=h.title?.trim();return v||(h.activityKind==="session"?"MCP session":h.clientId)},[de,Ye]),U=p.agentId,W=p.schedule,{data:He=[]}=As(U??void 0),Xe=k.useMemo(()=>!W||!U?null:He.find(v=>v.id===W)?.description?.trim()||"Scheduled task",[U,W,He]),{data:$t}=ts(m&&a?e:null,o),{data:Mt}=ns(c&&!Ke?t:null,o),Je=a?$t:Mt,Ie=k.useMemo(()=>{const h=new Map;for(const v of Je||[]){const N=v.automation_name??"__global__";h.has(N)||h.set(N,{automationName:v.automation_name??null,classifiers:[]});const F=h.get(N),L=v.attribute_values||{},P=Object.keys(L);let me=null;const q={};for(const[Y,B]of Object.entries(L))if(B.parent)for(const[Fe,Z]of Object.entries(B.parent))me=Fe,q[Z]||(q[Z]=[]),q[Z].push(Y);const O=F.classifiers.find(Y=>Y.slug===v.slug);if(O){const Y=new Set([...O.values,...P]);O.values=[...Y];for(const[B,Fe]of Object.entries(q)){O.valuesByParentValue[B]||(O.valuesByParentValue[B]=[]);const Z=new Set([...O.valuesByParentValue[B],...Fe]);O.valuesByParentValue[B]=[...Z]}me&&(O.parentSlug=me)}else F.classifiers.push({slug:v.slug,name:v.name,values:P,parentSlug:me,valuesByParentValue:q})}for(const v of h.values())v.classifiers.sort((N,F)=>N.parentSlug===null&&F.parentSlug!==null?-1:N.parentSlug!==null&&F.parentSlug===null?1:0);return[...h.values()]},[Je]),Dt=ss(m&&a?e:null,o,p,t),Kt=os(c?t:null,o,p),Bt=c?Kt:Dt,{data:z,isLoading:Vt,error:Gt}=Bt,et=z?.pages[0],tt=(et?.content.length??0)>0,Qt=as(m&&a?e:null,o,p,t),Ut=is(c?t:null,o,p),Ee=c?Ut:Qt,Wt=Ee.data?.total??void 0,zt=Ee.data?.classification_stats,qt=Ee.isLoading,Yt=!!(p.beforeOccurredAt||p.afterOccurredAt),nt=cs(p),st=z?.pages[z.pages.length-1],K=st?.content[st.content.length-1];k.useEffect(()=>{!nt||!K||z?.pages.length===1||x.beforeOccurredAt===K.occurred_at&&x.beforeId===K.id||_({beforeOccurredAt:K.occurred_at,beforeId:K.id},{replace:!0})},[K?.id,nt,_,z?.pages.length,K,x.beforeOccurredAt,x.beforeId]);const Zt=k.useCallback(()=>{C({beforeOccurredAt:void 0,beforeId:void 0,afterOccurredAt:void 0,afterId:void 0}),window.scrollTo({top:0,behavior:"smooth"})},[C]),Ht=(h,v)=>{C({dateRange:[h,v]})},ot=(h,v)=>{const N={...p.classificationFilters||{}};if(v.length>0)N[h]=v;else{delete N[h];for(const F of Ie)for(const L of F.classifiers)L.parentSlug===h&&delete N[L.slug]}C({classificationFilters:N})},Xt=(h,v)=>{const N=p.classificationFilters?.[h]||[];ot(h,N.includes(v)?N.filter(F=>F!==v):[...N,v])},Jt=h=>ot(h,[]);if(Gt)return n.jsx(rs,{label:"knowledge"});const Ae=!m||y&&r||a&&!e||Vt,ue={fields:[],chips:[]};for(const h of Ie)for(const v of h.classifiers){const N=p.classificationFilters?.[v.slug]??[],F=v.parentSlug?p.classificationFilters?.[v.parentSlug]??[]:void 0,L=F?[...new Set(F.flatMap(P=>v.valuesByParentValue[P]??[]))]:v.values;L.length>0&&ue.fields.push({key:`clf:${v.slug}`,label:v.name,group:h.automationName??"Classifiers",icon:n.jsx(ls,{className:"h-4 w-4"}),editor:ge({searchPlaceholder:`Search ${v.name.toLowerCase()}...`,options:L.map(P=>({value:P,label:P,count:zt?.[v.slug]?.[P]})),selected:N,multiple:!0,onSelect:P=>Xt(v.slug,P)})})}for(const[h,v]of Object.entries(p.classificationFilters??{})){if(v.length===0)continue;const N=Ie.flatMap(F=>F.classifiers).find(F=>F.slug===h);ue.chips.push({id:`clf:${h}`,field:`clf:${h}`,label:N?.name??h,op:v.length>1?"is any of":"is",value:v.join(", "),onRemove:()=>Jt(h)})}const en=[p.contentIds?.length?fe({id:"contentIds",label:p.contentIds.length>1?"Events":"Event",value:`#${p.contentIds.join(", #")}`,onRemove:()=>C({contentIds:void 0})}):null,Ze?fe({id:"mcpActivityId",label:"Conversation",value:Ze,onRemove:()=>C({mcpActivityId:void 0})}):null,qe?fe({id:"clientIds",label:"Connected app",value:qe,sourceLink:Ot,details:w&&w.length>0?n.jsx(Ls,{ownerSlug:t,clientIds:w,linkedUser:le?.linkedUser,linkedUserEntitySlug:le?.linkedUserEntitySlug}):void 0,onRemove:()=>C({clientIds:void 0})}):null,Xe?fe({id:"schedule",label:"Schedule",value:Xe,sourceLink:t&&U&&W?Ps(t,U,W):void 0,onRemove:()=>C({schedule:void 0,runIds:void 0})}):null,...ue.chips].filter(h=>h!=null),at={filterTrailing:!!(a&&o&&e)?n.jsxs($e,{variant:"ghost",size:"sm",className:"h-8 text-muted-foreground","aria-pressed":T,onClick:()=>E(h=>!h),children:[n.jsx(us,{className:"mr-1.5 h-3.5 w-3.5"}),"Timeline"]}):void 0,onClearFilters:Q,leading:l,filters:p,onFiltersChange:C,eventKinds:Lt,searchQuery:b,onSearchChange:h=>{S.current=!0,I(h)},extraFields:ue.fields,drillChips:en,total:Wt,isListLoading:Ae,isTotalLoading:qt,hasCursorInUrl:Yt&&tt,onGoToLatest:Zt},tn=!Ae&&!!et&&!tt&&!ke,nn=y?a?"Activity is the workspace's live feed — every message, email, file, and record a connector pulls in lands here as an event. Connect your data to start collecting.":"Activity is the workspace's live feed of connector events. Join this workspace to add connectors and collect knowledge here.":"No public knowledge items are available yet",it=!!(a&&t);return n.jsx(ds,{children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:s?"sticky top-0 z-10 -mx-4 bg-background px-4 pb-3 lg:-mx-6 lg:px-6":void 0,children:s&&t?n.jsx(wt,{...at,ownerSlug:t}):n.jsx(Tt,{...at})}),T&&a&&o&&e&&n.jsx(Xs,{entityId:o,organizationId:e,ownerSlug:t||"",selectedRange:p.dateRange||void 0,onSelectRange:Ht}),Ae?n.jsx("div",{className:"space-y-4",children:["skeleton-1","skeleton-2","skeleton-3","skeleton-4","skeleton-5"].map(h=>n.jsx(Nt,{className:"h-32 rounded-lg"},h))}):tn?n.jsx(rt,{icon:lt,title:"No activity yet",description:nn,actionLabel:it?"Add a connector":void 0,onAction:it&&t?()=>void f({to:"/$owner/connectors/create",params:{owner:t}}):void 0}):n.jsx(js,{onFiltersChange:C,organizationId:e,ownerSlug:t,entityId:o,filters:p,showEntityLinks:Ke,foldConsecutiveCalls:!0,groupByConversation:!0,emptyState:n.jsx(rt,{icon:lt,title:"No results found",description:"Try adjusting your filters to find what you are looking for",actionLabel:ke?"Clear filters":void 0,onAction:ke?Q:void 0})})]})})}function to({record:e,ownerSlug:t,filterBarLeading:o}){const s=se(),i=V(),{filters:l,updateFilters:y}=Et({parse:xe,serialize:Re,filterKeys:It,replace:!1,merge:_t}),m=we({...l,platforms:void 0,connectionIds:void 0,feedIds:void 0})||l.sortBy!=null&&l.sortBy!=="date"||l.sortOrder!=null&&l.sortOrder!=="desc",d=()=>{i({...Pe(t,s.search??{}),...s.pathname.startsWith(`/${t}/events/`)?{}:{to:s.pathname}})};return n.jsxs("div",{className:"space-y-4",children:[n.jsx(wt,{ownerSlug:t,sourceRead:!0,leading:o,filters:l,onFiltersChange:y,searchQuery:l.searchQuery??"",onSearchChange:r=>y({searchQuery:r}),onClearFilters:d}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Live activity supports connector, connection and feed filters. Search and other event filters are available for saved activity."}),m?n.jsxs("div",{role:"alert",className:"space-y-2 rounded-md border p-3 text-sm",children:[n.jsx("p",{children:"Some selected filters aren't supported for live activity. Clear them to see results."}),n.jsx($e,{variant:"outline",size:"sm",onClick:()=>{const r=Re({platforms:l.platforms,connectionIds:l.connectionIds,feedIds:l.feedIds}),a={...Pe(t,s.search??{}).search,...r};i({to:s.pathname,search:a})},children:"Clear unsupported filters"})]}):n.jsx(gs,{record:e,orgContext:{slug:t},filters:l})]})}function vo({entity:e,organizationId:t,ownerSlug:o,filterBarLeading:s}){const i=e.is_derived?n.jsx(to,{ownerSlug:o,record:{type:e.entity_type,key:e.slug},filterBarLeading:s}):n.jsx(eo,{organizationId:t,ownerSlug:o,entityId:e.id,hideSourceFilter:!0,filterBarLeading:s});return n.jsx(_s,{organizationId:t,children:e.entity_type==="$member"?n.jsx(Cs,{children:i}):i})}export{eo as E,_s as M,vo as R};
2
- //# sourceMappingURL=record-activity-CvgZyCmw.js.map
1
+ import{at as sn,j as n,r as k,m as V,n as se,cb as on,cc as vt,cd as yt,L as je,ce as an,cf as cn,k as rn,cg as gt,ch as ln,bY as dn,ci as un,ai as mn,cj as xt,ck as A,bl as fn,cl as pn,cm as hn,bm as vn,cn as yn,co as ne,c9 as gn,cp as bt,cq as xn,an as bn,cr as jn,aZ as kn,ba as Sn,aq as xe,cs as Nn,ct as Cn,t as jt,cu as kt,cv as _n,cw as In,cx as En,cy as St,cz as An,c6 as Fn,cA as Tn,be as wn,aV as Rn,S as Nt,cB as Pn,I as Ln,P as Oe,X as On,B as $e,cC as $n,bn as Mn,bo as Dn,bp as Kn,bq as Bn,br as Vn,cD as Gn,cE as Qn,bz as Un,cF as Wn,cG as zn,cH as qn,ae as Ct,g as Yn,cI as Zn,cJ as we,cK as ct,cL as Hn,cM as Xn,cN as Jn,cO as es,cP as ts,cQ as ns,cR as ss,cS as os,cT as as,cU as is,cV as cs,bK as rs,cW as ls,cX as ds,aQ as rt,cY as lt,cZ as _t,c_ as Re,c$ as It,d0 as us,d1 as Pe}from"./index-Cr5hwh-C.js";import{S as $,F as ms,d as fs,o as ge,r as ps,f as hs,a as vs}from"./filter-editors-Cj-v6NtH.js";import{c as dt}from"./connection-label-BobuYiAG.js";import{u as ys}from"./runs-C0rCgGwX.js";import{S as gs}from"./source-record-panels-CPyzlfD1.js";import{u as xs}from"./clients-D3Zbjxin.js";import{g as bs}from"./client-rows-EJSKR6z1.js";import{E as js}from"./events-feed-BtvhZF1f.js";import{L as ks,u as Ss}from"./renderer-mEDnVW0O.js";import{E as Ns}from"./agent-loading-shells-Dqcvky-k.js";import{M as Cs}from"./member-scope-gate-B44INDPY.js";const Me=k.createContext(null);function _s({organizationId:e,isWorkspaceLoading:t,children:o}){const{data:s=[],isLoading:i}=sn(e);return n.jsx(Me.Provider,{value:{groups:s,isLoading:!!t||i},children:o})}function Is(){const e=k.useContext(Me);if(!e)throw new Error("useMemoryConnectorGroups must be used within MemoryConnectorGroupsProvider");return e}function Es(){return k.useContext(Me)}function Et(e){const{parse:t,serialize:o,filterKeys:s,clearClassifications:i=!0,replace:l=!0,merge:y}=e,m=V(),d=se(),r=k.useMemo(()=>{const f=new URLSearchParams;for(const[u,g]of Object.entries(d.search||{}))g!=null&&f.set(u,typeof g=="object"&&!Array.isArray(g)?JSON.stringify(g):String(g));return t(f)},[d.search,t]),a=k.useCallback((f,u)=>{const g=y?y(r,f):{...r,...f},x=o(g),_={};for(const[j,b]of Object.entries(d.search||{}))b!=null&&(_[j]=b);for(const j of s)delete _[j];if(i)for(const j of Object.keys(_))j.startsWith("clf_")&&delete _[j];for(const[j,b]of Object.entries(x))b!==void 0&&(_[j]=b);m({to:d.pathname,search:_,replace:u?.replace??l})},[r,o,s,i,y,m,d,l]),c=k.useCallback(()=>{const f={};for(const[u,g]of Object.entries(d.search||{}))g!=null&&(s.includes(u)||i&&u.startsWith("clf_")||(f[u]=g));m({to:d.pathname,search:f,replace:l})},[m,d.pathname,d.search,s,i,l]);return{filters:r,updateFilters:a,clearFilters:c}}function As(e){const{slug:t}=on();return vt({queryKey:["schedules",t,e],queryFn:async()=>((await yt("manage_schedules",{action:"list",action_type:"wake_agent",include_paused:!0})).schedules??[]).filter(s=>s.action_args?.agent_id===e),enabled:!!t&&!!e,staleTime:3e4})}function Fs(e,t){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:e,connectorKey:t.connector_key,connectionId:String(t.connection_id)},search:{feedId:t.id}}}function Ts(e,t){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:e,connectorKey:t.connector_key,connectionId:String(t.id)}}}function ws(e,t){return{to:"/$owner/agents/connected/$clientId",params:{owner:e,clientId:t}}}function Rs(e,t){return{to:"/$owner/automations/$automationId",params:{owner:e,automationId:t}}}function Ps(e,t,o){return{to:"/$owner/events",params:{owner:e},search:{agent:t,schedule:o}}}function fe({id:e,label:t,value:o,sourceLink:s,details:i,onRemove:l}){return{id:e,label:t,op:"is",value:o,onRemove:l,editor:s||i?{kind:"custom",className:"w-80",render:()=>n.jsxs("div",{className:"flex flex-col gap-2 p-3 text-sm",children:[s?n.jsxs(je,{to:s.to,params:s.params,search:s.search,className:"inline-flex min-w-0 items-center gap-1.5 font-medium text-foreground hover:underline",children:[n.jsx("span",{className:"truncate",children:o}),n.jsx(an,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}):n.jsx("span",{className:"font-medium",children:o}),i]})}:void 0}}function Ls({ownerSlug:e,clientIds:t,linkedUser:o,linkedUserEntitySlug:s}){const i=e&&s?cn(e,[{entity_type:"$member",slug:s}]):null;return n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"inline-flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[n.jsx("span",{children:t.length===1?"Client ID":"Client IDs"}),t.map(l=>n.jsx("code",{className:"break-all text-foreground",children:l},l))]}),o?n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:["Granted by",i?n.jsx(je,{to:i,className:"font-medium text-foreground hover:underline",children:o}):n.jsx("span",{className:"font-medium text-foreground",children:o})]}):null]})}function H(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function pe(e,t,o){const s=new Set;for(const[i,l]of Object.entries(e.feeds_schema??{})){if(o&&!o.has(i))continue;const y=H(H(l)?.eventKinds);if(y)for(const[m,d]of Object.entries(y)){if(!t){s.add(m);continue}const r=H(d)?.attributions;Array.isArray(r)&&r.some(a=>{const c=H(H(a)?.target);return typeof c?.entityType=="string"&&t.has(c.entityType)})&&s.add(m)}}return s}function Os({connectors:e,entityTypes:t,selectedPlatforms:o=[],selectedFeeds:s=[],selectedEntityTypes:i=[]}){const l=new Set,y=new Set(o),m=new Set(i),d=new Map;for(const r of s){const a=d.get(r.connectorKey)??new Set;a.add(r.feedKey),d.set(r.connectorKey,a)}if(d.size>0)for(const r of e){const a=d.get(r.key);if(a)for(const c of pe(r,void 0,a))l.add(c)}else if(y.size>0){for(const r of e)if(y.has(r.key))for(const a of pe(r))l.add(a)}else if(m.size>0){for(const r of t)if(m.has(r.slug))for(const a of Object.keys(r.event_kinds??{}))l.add(a);for(const r of e)for(const a of pe(r,m))l.add(a)}else{for(const r of t)for(const a of Object.keys(r.event_kinds??{}))l.add(a);for(const r of e)for(const a of pe(r))l.add(a)}return[...l].sort((r,a)=>r.localeCompare(a))}function $s(e){const{orgContext:t}=rn(),{data:o=[],isLoading:s}=gt(t);return{visible:k.useMemo(()=>o.filter(l=>!ln(l)&&(!l.organization_slug||l.organization_slug===e)),[o,e]),isTypesLoading:s}}function te({to:e,params:t,search:o,label:s}){return n.jsx(je,{to:e,params:t,search:o,onClick:i=>i.stopPropagation(),onPointerDown:i=>i.stopPropagation(),className:"shrink-0 rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100","aria-label":`Manage ${s}`,children:n.jsx(dn,{className:"h-3.5 w-3.5"})})}const Le=["produced","analyzed"],be=e=>e==="produced"?"Produced by":"Analyzed by";function Ms({enabled:e,...t}){const o=Ds(t,e);if(!e)return{fields:[],chips:[]};const s=Ks(t);return{fields:[o.field,s.field],chips:[...o.chips,...s.chips]}}function Ds({ownerSlug:e,filters:t,onFiltersChange:o},s){const i=vt({queryKey:["automations-list","activity",e],queryFn:async()=>{const a=await Promise.all(["active","archived"].map(c=>yt("manage_automations",{action:"list",status:c,include_details:!1},{slug:e})));return[...new Map(a.flatMap(c=>c.automations).map(c=>[Number(c.automation_id),c])).values()].sort((c,f)=>c.name.localeCompare(f.name))},enabled:s&&!!e,staleTime:3e4}),l=i.data??[],y=a=>a==="produced"?t.producedByAutomationId:t.automationId,m=a=>l.find(c=>Number(c.automation_id)===a)?.name??`#${a}`,d=Le.flatMap(a=>{const c=y(a);return c==null?[]:[{id:`automation-${a}`,field:"automation",label:be(a),value:m(c),onRemove:()=>o(a==="produced"?{producedByAutomationId:null}:{automationId:null})}]}),r={kind:"list",className:"w-80",searchPlaceholder:"Search Automations...",emptyText:i.isLoading?"Loading Automations...":"No Automations found",items:a=>n.jsxs(n.Fragment,{children:[Le.map(c=>{const f=y(c),u=l.map(x=>({id:Number(x.automation_id),label:`${x.name}${x.status==="archived"?" (archived)":""}`}));f!=null&&!u.some(x=>x.id===f)&&u.unshift({id:f,label:`Automation #${f} (selected)`});const g=x=>{o(c==="produced"?{producedByAutomationId:x}:{automationId:x}),a()};return n.jsx(xt,{heading:be(c),children:u.map(x=>n.jsxs(A,{"aria-label":x.label,value:`${c} ${x.label} ${x.id}`,onSelect:()=>g(x.id),className:"group",children:[n.jsx($,{selected:f===x.id}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.label}),n.jsx(te,{...Rs(e,String(x.id)),label:x.label})]},x.id))},c)}),i.isError?n.jsx(A,{forceMount:!0,onSelect:()=>void i.refetch(),children:"Could not load Automations. Retry"}):null]})};return{chips:d,field:{key:"automation",label:"Automation",group:"Scope",icon:n.jsx(un,{className:"h-4 w-4"}),editor:r}}}function Ks(e){const{filters:t,onFiltersChange:o}=e,s=[];t.runIds?.length&&s.push({id:"run-produced",field:"run",label:"Produced by run",value:t.runIds.map(l=>`#${l}`).join(", "),onRemove:()=>o({runIds:null})}),t.runId!=null&&s.push({id:"run-analyzed",field:"run",label:"Analyzed by run",value:`#${t.runId}`,onRemove:()=>o({runId:null})});const i={kind:"list",className:"w-96",searchPlaceholder:"Search runs or enter a run ID...",emptyText:"No matching runs. Enter an exact run ID or load more.",items:(l,y)=>Le.map(m=>n.jsx(Bs,{...e,mode:m,query:y,close:l},m))};return{chips:s,field:{key:"run",label:"Run",group:"Scope",icon:n.jsx(mn,{className:"h-4 w-4"}),editor:i}}}function Bs({ownerSlug:e,filters:t,onFiltersChange:o,mode:s,query:i,close:l}){const y=s==="produced"?t.producedByAutomationId:t.automationId,m=ys({workspace:!0},{automationIds:y==null?void 0:[y],runTypes:s==="analyzed"?["automation"]:void 0,connectionIds:s==="produced"?t.connectionIds??void 0:void 0,feedIds:s==="produced"?t.feedIds??void 0:void 0},e),d=s==="produced"?t.runIds??[]:t.runId==null?[]:[t.runId],r=m.data?.pages.flatMap(u=>u.runs)??[],a=[...new Map(r.map(u=>[u.id,{id:u.id,label:`Run #${u.id} · ${u.feed_display_name??u.operation_key??u.run_type} · ${u.status}`}])).values()];for(const u of d)a.some(g=>g.id===u)||a.unshift({id:u,label:`Run #${u} (selected)`});const c=u=>{if(s==="produced"){const g=d.includes(u)?d.filter(x=>x!==u):[...d,u];o({runIds:g.length?g:null})}else o({runId:u}),l()},f=/^\d+$/.test(i.trim())?Number(i.trim()):0;return n.jsxs(xt,{heading:be(s),children:[a.map(u=>n.jsxs(A,{value:`${s} ${u.label}`,onSelect:()=>c(u.id),children:[n.jsx($,{selected:d.includes(u.id)}),n.jsx("span",{className:"truncate",children:u.label})]},u.id)),Number.isSafeInteger(f)&&f>0&&!a.some(u=>u.id===f)?n.jsxs(A,{value:`${s} ${f}`,onSelect:()=>c(f),children:[be(s)," run #",f]}):null,m.isLoading?n.jsx(A,{disabled:!0,forceMount:!0,children:"Loading runs..."}):null,m.isError?n.jsx(A,{forceMount:!0,onSelect:()=>void(m.isFetchNextPageError?m.fetchNextPage():m.refetch()),children:"Could not load runs. Retry"}):null,!m.isLoading&&!m.isError&&!a.length?n.jsx(A,{disabled:!0,forceMount:!0,children:"No runs found"}):null,m.hasNextPage?n.jsx(A,{forceMount:!0,disabled:m.isFetching,onSelect:()=>void m.fetchNextPage(),children:m.isFetchingNextPage?"Loading more runs...":"Load more runs"}):null]})}const De="Scope",Te="Source",G="h-4 w-4";function oe(){return se().search??{}}function At(e){const{pathname:t}=se(),{_splat:o}=vn({strict:!1}),s=!!(o&&!yn(o.split("/")[0])&&!t.startsWith(`/${e}/events/`));return{pathname:t,embedded:s,recordPath:s||t.startsWith(`/${e}/events/`)?o:void 0}}function Ft(e){const t=oe(),{recordPath:o,pathname:s,embedded:i}=At(e);return l=>{const y=ne(e,t,l,o);return i?{to:s,search:y.search}:y}}const ut=e=>new Set((e??"").split(",").map(t=>t.trim()).filter(Boolean));function Vs({ownerSlug:e,sourceRead:t=!1,filters:o,onFiltersChange:s}){const i=oe(),{recordPath:l,embedded:y}=At(e),m=l?l.split("/").at(-2):void 0,d=typeof i.type=="string"&&i.type.trim()?i.type.trim():void 0,r=m??(d?fn(d):void 0),a=pn(i),c=hn(i),f=typeof i.feed_ids=="string"?i.feed_ids:typeof i.feed_ids=="number"?String(i.feed_ids):void 0,u=Gs(e,r,!y),g=Qs(e,r,l,y),x=Us(e,a,!t),_=Ms({ownerSlug:e,filters:o,onFiltersChange:s,enabled:!t}),j=Ws(e,c,f);return[u,g,x,_,j].reduce((b,I)=>({fields:[...b.fields,...I.fields],chips:[...b.chips,...I.chips]}),{fields:[],chips:[]})}function Gs(e,t,o){const s=V(),i=oe(),{visible:l}=$s(e);if(!o)return{fields:[],chips:[]};const y=l.find(d=>d.slug===t),m={kind:"list",searchPlaceholder:"Search types...",emptyText:"No entity types",items:d=>n.jsxs(n.Fragment,{children:[l.map(r=>n.jsxs(A,{onSelect:()=>{s(ne(e,i,{entity:void 0,create:void 0,type:r.slug})),d()},className:"group gap-2",children:[n.jsx($,{selected:r.slug===t}),n.jsx(En,{icon:r.icon,className:"h-4 w-4 shrink-0"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:r.name}),typeof r.entity_count=="number"?n.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:r.entity_count}):null,n.jsx(te,{to:"/$owner/entity-types/$slug",params:{owner:e,slug:r.slug},label:r.name})]},r.id)),n.jsxs(A,{onSelect:()=>{s(An(e)),d()},className:"text-muted-foreground",children:[n.jsx(St,{className:"h-4 w-4 shrink-0"}),"Add entity type"]})]})};return{fields:[{key:"type",label:"Entity type",group:De,icon:n.jsx(gn,{className:G}),editor:m}],chips:t?[{id:"type",label:"Entity type",op:"is",value:y?.name??t,onRemove:()=>void s(ne(e,i,{type:void 0}))}]:[]}}function Qs(e,t,o,s){const i=V(),l=oe(),[y,m]=k.useState(""),[d,r]=k.useState(0),a=bt(y,250),c={slug:e},{data:f,isLoading:u,isError:g,refetch:x}=xn(t??"",c,{search:a,offset:d,limit:30,enabled:!s&&!!t}),{data:_}=bn(o?`/${e}/${o}`:"",c),j=o?_?.entity:void 0,b=j?.name??(o?o.split("/").at(-1):void 0);if(s)return{fields:[],chips:b?[{id:"entity",label:"Entity",op:"is",value:b}]:[]};if(!t)return{fields:[],chips:[]};const I={kind:"list",searchPlaceholder:"Search entities...",emptyText:u?"Loading entities...":"No matching entities",className:"w-80",onQueryChange:T=>{m(T),r(0)},items:T=>n.jsxs(n.Fragment,{children:[g?n.jsx(A,{onSelect:()=>void x(),children:"Could not load entities. Retry"}):f?.entities.map(E=>n.jsxs(A,{value:E.slug,onSelect:()=>{const R=Fn(Tn([...E.parent_slug&&E.parent_entity_type?[{entity_type:E.parent_entity_type,slug:E.parent_slug}]:[],{entity_type:E.entity_type,slug:E.slug}]));i(ne(e,l,{type:t},R)),T()},children:[n.jsx($,{selected:j?.slug===E.slug}),E.name]},E.slug)),d>0&&n.jsx(A,{onSelect:()=>r(Math.max(0,d-30)),children:"Previous entities"}),f?.metadata.has_more&&n.jsx(A,{disabled:u,onSelect:()=>r(d+30),children:"More entities"})]})};return{fields:[{key:"entity",label:"Entity",group:De,icon:n.jsx(jn,{className:G}),editor:I}],chips:b?[{id:"entity",label:"Entity",op:"is",value:b,onRemove:()=>void i(ne(e,l,{type:t}))}]:[]}}function Us(e,t,o){const s=V(),i=Ft(e),{data:l=[]}=kn(),y=k.useMemo(()=>[...l].sort((r,a)=>r.name.localeCompare(a.name)),[l]);if(!o)return{fields:[],chips:[]};const m=y.find(r=>r.agentId===t),d={kind:"list",searchPlaceholder:"Search agents...",emptyText:"No agents",items:r=>y.map(a=>n.jsxs(A,{onSelect:()=>{s(i({agent:a.agentId,schedule:void 0})),r()},className:"gap-2",children:[n.jsx($,{selected:a.agentId===t}),n.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-muted text-[10px] font-medium",children:a.name.trim().charAt(0).toUpperCase()||"?"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.name})]},a.agentId))};return{fields:[{key:"agent",label:"Agent",group:De,icon:n.jsx(Sn,{className:G}),editor:d}],chips:t?[{id:"agent",label:"Agent",op:"is",value:m?.name??t,onRemove:()=>void s(i({agent:void 0,schedule:void 0}))}]:[]}}function Ws(e,t,o){const s=V(),i=Ft(e),{groups:l}=Is(),y=oe(),m=xe({platforms:String(y.platforms??y.platform??"")}).platforms??[],d=k.useMemo(()=>ut(t),[t]),r=k.useMemo(()=>ut(o),[o]),a=m.length===1?m[0]:Nn(l,d),c=l.find(S=>S.connector_key===a),f=d.size===1?Number([...d][0]):void 0,u=Cn(f),{org:g}=jt(),x=kt(g?.id,{feedIds:[...r].map(Number),enabled:f==null&&r.size>0}),_=f==null?x:u,j=_.data??[],b={platforms:void 0,platform:void 0,connection_ids:void 0,feed_ids:void 0},I={kind:"list",searchPlaceholder:"Search connectors...",emptyText:"No connectors",items:S=>n.jsxs(n.Fragment,{children:[l.map(p=>{const C=p.connector_name??p.connector_key;return n.jsxs(A,{disabled:p.connections.length===0,onSelect:()=>{s(i({...b,platforms:p.connector_key})),S()},className:"group gap-2",children:[n.jsx($,{selected:p.connector_key===c?.connector_key}),n.jsx(Rn,{plain:!0,name:C,faviconDomain:p.favicon_domain,className:"h-5 w-5 shrink-0 rounded-md text-[10px]"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:C}),p.connection_count>0?n.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:p.connection_count}):null,n.jsx(te,{to:"/$owner/connectors/$connectorKey",params:{owner:e,connectorKey:p.connector_key},label:C})]},p.connector_key)}),n.jsx(A,{asChild:!0,onSelect:S,className:"text-muted-foreground",children:n.jsxs(je,{to:"/$owner/connectors/create",params:{owner:e},className:"flex items-center gap-2",children:[n.jsx(St,{className:"h-4 w-4 shrink-0"}),"Add connector"]})})]})},T=[{key:"connector",label:"Connector",group:Te,icon:n.jsx(wn,{className:G}),editor:I}],E=[],R=c?.connector_name??c?.connector_key??(m.join(", ")||(d.size?`Connections ${[...d].join(", ")}`:void 0));if(R&&E.push({id:"connector",label:"Connector",op:"is",value:R,onRemove:()=>void s(i(b))}),c){T.push({key:"connection",label:"Connection",group:Te,icon:n.jsx(_n,{className:G}),editor:M(c)});const S=d.size===1?c.connections.find(p=>d.has(String(p.id))):void 0;S&&E.push({id:"connection",label:"Connection",op:"is",value:dt({display_name:S.display_name,connector_name:c.connector_name,connector_key:c.connector_key}),onRemove:()=>void s(i({...b,platforms:c.connector_key}))})}if((f||o)&&T.push({key:"feed",label:"Feed",group:Te,icon:n.jsx(In,{className:G}),editor:D()}),r.size>0){const S=r.size===1?j.find(p=>r.has(String(p.id))):void 0;E.push({id:"feed",label:"Feed",op:"is",value:S?he(S):`#${o}`,onRemove:()=>void s(i({...f!=null?{connection_ids:String(f)}:{},feed_ids:void 0}))})}return{fields:T,chips:E};function M(S){return{kind:"list",searchPlaceholder:"Search connections...",emptyText:"No connections",items:p=>S.connections.map(C=>{const Q=dt({display_name:C.display_name,connector_name:S.connector_name,connector_key:S.connector_key});return n.jsxs(A,{onSelect:()=>{s(i({connection_ids:String(C.id),feed_ids:void 0})),p()},className:"group gap-2",children:[n.jsx($,{selected:d.has(String(C.id))}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:Q}),C.feed_count>0?n.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:C.feed_count}):null,n.jsx(te,{...Ts(e,{id:C.id,connector_key:S.connector_key}),label:Q})]},C.id)})}}function D(){return{kind:"list",searchPlaceholder:"Search feeds...",emptyText:_.isLoading?"Loading feeds...":"No feeds",items:S=>j.map(p=>n.jsxs(A,{"aria-label":he(p),onSelect:()=>{s(i({...f!=null?{connection_ids:String(f)}:{},feed_ids:String(p.id)})),S()},className:"group gap-2",children:[n.jsx($,{selected:r.has(String(p.id))}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:he(p)}),n.jsx(te,{...Fs(e,p),label:he(p)})]},p.id))}}}function he(e){return e.display_name?.trim()||e.feed_key}const zs=["notification"],qs=["note","summary","decision","observation","fact","change","preference","identity"],Ys=[...zs,...qs],mt=[{value:"date-desc",label:"Newest first"},{value:"date-asc",label:"Oldest first"},{value:"score-desc",label:"Highest score"},{value:"score-asc",label:"Lowest score"}],ft=[{value:"user",label:"Manual review"},{value:"system",label:"Auto-classified"},{value:"llm",label:"LLM-classified"}],pt=[{value:"pending",label:"Pending approval"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}],ve=0,ye=100,X="Event",J="h-4 w-4";function ee(e){const t=e.replace(/[_-]+/g," ").trim();return t.length>0?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:e}function Zs(e,t,o){const s=e.semanticTypes??[],i=o.length>0?o:Ys,l=[...new Set([...i,...s])].sort((c,f)=>ee(c).localeCompare(ee(f))).map(c=>({value:c,label:ee(c)})),y=e.engagementRange??[ve,ye],m=e.reviewStatus,d=e.interactionStatus,r=[{key:"date",label:"Date",group:X,icon:n.jsx(Gn,{className:J}),editor:fs({value:e.dateRange??void 0,onApply:c=>t({dateRange:c})})},{key:"kind",label:"Event kind",group:X,icon:n.jsx(Qn,{className:J}),editor:ge({searchPlaceholder:"Search event kinds...",emptyText:"No event kinds found",options:l,selected:s,multiple:!0,onSelect:c=>{const f=s.includes(c)?s.filter(u=>u!==c):[...s,c];t({semanticTypes:f.length>0?f:void 0})}})},{key:"approval",label:"Approval",group:X,icon:n.jsx(Un,{className:J}),editor:ge({searchPlaceholder:"Search statuses...",options:[...pt],selected:d?[d]:[],onSelect:c=>t({interactionStatus:c})})},{key:"review",label:"Reviewed by",group:X,icon:n.jsx(Wn,{className:J}),editor:ge({searchPlaceholder:"Search reviewers...",options:[...ft],selected:m&&m!=="all"?[m]:[],onSelect:c=>t({reviewStatus:c})})},{key:"score",label:"Engagement score",group:X,icon:n.jsx(zn,{className:J}),editor:ps({value:y,min:ve,max:ye,onApply:c=>t({engagementRange:c})})}],a=[];return e.dateRange&&a.push({id:"date",label:"Date",op:"is",value:hs(e.dateRange),onRemove:()=>t({dateRange:null})}),s.length&&a.push({id:"kind",label:"Event kind",op:s.length>1?"is any of":"is",value:s.length<=2?s.map(ee).join(", "):`${s.length} kinds`,title:s.map(ee).join(", "),onRemove:()=>t({semanticTypes:void 0})}),d&&a.push({id:"approval",label:"Approval",op:"is",value:pt.find(c=>c.value===d)?.label??d,onRemove:()=>t({interactionStatus:null})}),m&&m!=="all"&&a.push({id:"review",label:"Reviewed by",op:"is",value:ft.find(c=>c.value===m)?.label??m,onRemove:()=>t({reviewStatus:void 0})}),(y[0]!==ve||y[1]!==ye)&&a.push({id:"score",label:"Engagement score",value:vs(y,ve,ye),onRemove:()=>t({engagementRange:void 0})}),{fields:r,chips:a}}function Tt({filters:e,onFiltersChange:t,eventKinds:o=[],searchQuery:s,onSearchChange:i,scope:l,extraFields:y=[],drillChips:m=[],total:d,isListLoading:r=!1,isTotalLoading:a=!1,hasCursorInUrl:c=!1,onGoToLatest:f,leading:u,sourceRead:g=!1,filterTrailing:x,onClearFilters:_}){const j=s.trim().length>0,b=g?{fields:[],chips:[]}:Zs(e,t,o),I=[...l?.fields??[],...b.fields,...y],T=[...l?.chips??[],...m,...b.chips],E=T.length>0||j,R=`${e.sortBy??"date"}-${e.sortOrder??"desc"}`,M=mt.find(S=>S.value===R)?.label??"Newest first",D=r||a?n.jsx(Nt,{className:"h-4 w-20"}):d==null?null:E?`${d.toLocaleString()} ${d===1?"match":"matches"}`:`${d.toLocaleString()} ${d===1?"item":"items"}`;return n.jsxs("div",{className:"w-full space-y-2.5",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[u,!g&&n.jsxs("div",{className:"relative w-full min-w-48 flex-1 sm:max-w-xs",children:[n.jsx(Pn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),n.jsx(Ln,{type:"search","aria-label":"Search events",placeholder:"Search events...",value:s,onChange:S=>i(S.target.value),className:Oe("pl-9",j&&"pr-8")}),j&&n.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>i(""),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground transition-colors hover:text-foreground",children:n.jsx(On,{className:"h-3.5 w-3.5"})})]}),n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[!r&&c&&f&&n.jsxs($e,{variant:"ghost",size:"sm",className:"h-8 gap-1",onClick:f,children:[n.jsx($n,{className:"h-3.5 w-3.5"}),"Back to latest"]}),!g&&n.jsxs(Mn,{value:R,onValueChange:S=>{const[p,C]=S.split("-");t({sortBy:p,sortOrder:C})},children:[n.jsx(Dn,{"aria-label":"Sort",className:"h-9 w-[168px] px-2.5",children:n.jsx(Kn,{children:n.jsxs("span",{className:"truncate",children:[n.jsx("span",{className:"text-muted-foreground",children:"Sort: "}),M]})})}),n.jsx(Bn,{children:mt.map(S=>n.jsx(Vn,{value:S.value,children:S.label},S.value))})]})]})]}),n.jsx(ms,{label:"Event filters",fields:I,chips:T,meta:D,trailing:x,onClearAll:_,hasClearableState:j})]})}function wt({ownerSlug:e,...t}){const o=Vs({ownerSlug:e,sourceRead:t.sourceRead,filters:t.filters,onFiltersChange:t.onFiltersChange});return n.jsx(Tt,{...t,scope:o})}function Hs(e){const t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?null:t}function ht(e){return e.toISOString().split("T")[0]}function Xs({entityId:e,organizationId:t,ownerSlug:o,selectedRange:s,onSelectRange:i}){const{data:l,isLoading:y,error:m}=qn(t,{entityId:e},{slug:o}),d=k.useMemo(()=>{if(!l||l.length===0)return[];const f=l.map(j=>{const b=Hs(j.date);return b?{date:b,count:j.count}:null}).filter(j=>j!==null).sort((j,b)=>j.date.getTime()-b.date.getTime());if(f.length===0)return[];const u=f[0].date;if((f[f.length-1].date.getTime()-u.getTime())/(1e3*60*60*24)>180){const j=new Map;for(const b of f){const I=new Date(b.date);I.setDate(b.date.getDate()-b.date.getDay());const T=ht(I);j.set(T,(j.get(T)||0)+b.count)}return Array.from(j.entries()).map(([b,I])=>({date:b,count:I})).sort((b,I)=>new Date(b.date).getTime()-new Date(I.date).getTime())}return f.map(j=>({date:ht(j.date),count:j.count}))},[l]),r=k.useCallback(f=>{if(f.name&&i){const u=new Date(f.name),g=new Date(u);g.setDate(g.getDate()+1),i(u,g)}},[i]),a=k.useCallback(f=>{if(i&&f.startValue!==void 0&&f.endValue!==void 0){const u=new Date(f.startValue),g=new Date(f.endValue);i(u,g)}},[i]),c=k.useMemo(()=>{if(d.length===0)return null;let f;if(s){const u=s[0].toISOString().split("T")[0],g=s[1].toISOString().split("T")[0];f=[[{xAxis:u},{xAxis:g}]]}return{tooltip:{trigger:"axis",axisPointer:{type:"line"},formatter:u=>{const g=u[0];return`${new Date(g.name).toLocaleDateString()}: ${g.value} items`}},grid:{left:50,right:20,top:20,bottom:60},xAxis:{type:"category",boundaryGap:!1,data:d.map(u=>u.date),axisLabel:{formatter:u=>{const g=new Date(u);return`${g.getMonth()+1}/${g.getDate()}`}}},yAxis:{type:"value",minInterval:1,splitLine:{lineStyle:{color:"rgba(0,0,0,0.05)"}}},dataZoom:[{type:"slider",start:0,end:100,height:20,bottom:10,borderColor:"transparent",backgroundColor:"rgba(0,0,0,0.02)",fillerColor:"rgba(99, 102, 241, 0.1)",handleStyle:{color:"#6366f1"}}],series:[{type:"line",smooth:!0,areaStyle:{opacity:.3,color:new ks(0,0,0,1,[{offset:0,color:"rgba(99, 102, 241, 0.5)"},{offset:1,color:"rgba(99, 102, 241, 0.05)"}])},lineStyle:{width:2,color:"#6366f1"},itemStyle:{color:"#6366f1"},showSymbol:!1,data:d.map(u=>u.count),markLine:{silent:!0,symbol:"none",label:{position:"insideEndTop",formatter:"avg: {c}",fontSize:10,color:"#9ca3af"},lineStyle:{color:"#d1d5db",type:"dashed",width:1},data:[{type:"average",name:"Average"}]},markArea:f?{silent:!0,itemStyle:{color:"rgba(99, 102, 241, 0.1)"},data:f}:void 0}]}},[d,s]);return y||m?n.jsx("div",{className:Oe(Ct,"p-4"),children:n.jsx("div",{className:"flex h-48 w-full items-center justify-center",children:y?n.jsx(Ns,{}):n.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load timeline"})})}):!c||d.length<2?null:n.jsx(Js,{option:c,onClick:r,onDataZoom:a})}function Js({option:e,onClick:t,onDataZoom:o}){const{chartRef:s,setOption:i}=Ss({onClick:t,onDataZoom:o});return k.useEffect(()=>{i(e,!0)},[e,i]),n.jsx("div",{"data-testid":"events-timeline",className:Oe(Ct,"p-4 relative"),children:n.jsx("div",{ref:s,className:"h-48 w-full"})})}function eo({organizationId:e,ownerSlug:t,entityId:o,hideSourceFilter:s=!1,scopedEntityTypes:i,filterBarLeading:l}){const{isAuthenticated:y,isReady:m}=Yn(),{isMember:d,isLoading:r}=jt(),a=m&&y&&d,c=m&&(!y||!r&&!d),f=V(),u=se(),g=Zn(),{filters:x,updateFilters:_,clearFilters:j}=Et({parse:xe,serialize:Re,filterKeys:It,replace:!1,merge:_t}),[b,I]=k.useState(x.searchQuery||""),[T,E]=k.useState(we(x)||s&&(o!=null||!!i?.length)),R=b.trim(),M=R.length>=3?R:void 0,D=bt(M,1e3),S=k.useRef(!1);k.useEffect(()=>g.history.subscribe(({location:h,action:v})=>{const N=xe(new URLSearchParams(h.search)).searchQuery??"";!(v.type==="BACK"||v.type==="FORWARD"||v.type==="GO")&&S.current&&(N===(x.searchQuery??"")||N===(M??""))||(S.current=!1,I(N))}),[g.history,M,x.searchQuery]);const p=k.useMemo(()=>ct({...x,...i?.length?{entityTypes:i}:{}}),[x,i]),C=_;k.useEffect(()=>{S.current&&(x.searchQuery||void 0)!==D&&_({searchQuery:D})},[D,_,x.searchQuery]);const Q=()=>{S.current=!1,I(""),s&&t?f({...Pe(t,u.search??{}),...o!==void 0&&!u.pathname.startsWith(`/${t}/events/`)?{to:u.pathname}:{}}):j()},ke=we(ct(x)),Ke=o===void 0,{data:Rt=[]}=Hn(m&&a?e:null),{data:Pt=[]}=Xn(c?t:null),Be=a?Rt:Pt,{data:Ve=[]}=gt(a&&e?{organizationId:e}:void 0),ae=Es(),ie=p.connectionIds,Se=(ie?.length??0)>0,{data:Ge=[]}=Jn(m&&a?e??"":"",{connectionIds:ie??void 0,enabled:!ae&&m&&a&&Se}),Qe=p.feedIds,Ne=(Qe?.length??0)>0,{data:Ue=[]}=kt(m&&a?e:null,{feedIds:Qe??void 0,enabled:m&&a&&Ne}),We=k.useMemo(()=>ae?ae.groups.flatMap(h=>h.connections.map(v=>({id:v.id,display_name:v.display_name,connector_name:h.connector_name,connector_key:h.connector_key}))):Ge,[Ge,ae]),Ce=k.useMemo(()=>{const h=new Set(ie??[]);return[...new Set([...p.platforms??[],...We.filter(v=>h.has(v.id)).map(v=>v.connector_key)])]},[ie,We,p.platforms]),_e=k.useMemo(()=>Ue.map(h=>({connectorKey:h.connector_key,feedKey:h.feed_key})),[Ue]),Lt=k.useMemo(()=>Se&&Ce.length===0||Ne&&_e.length===0?[]:Os({connectors:Be,entityTypes:Ve,selectedPlatforms:Ce,selectedFeeds:_e,selectedEntityTypes:p.entityTypes}),[Be,p.entityTypes,Se,Ne,Ce,_e,Ve]),w=p.clientIds,ce=(w?.length??0)>0,{data:ze=[]}=xs(null,{enabled:m&&a&&ce}),re=k.useMemo(()=>{if(!w)return[];const h=new Set(w);return bs(ze).filter(v=>v.clientIds.some(N=>h.has(N)))},[w,ze]),qe=k.useMemo(()=>{if(!ce||!w)return null;const h=re.map(v=>v.title);return h.length>0?h.join(", "):w.length>1?`${w.length} client registrations`:"Client registration"},[re,w,ce]),le=re.length===1?re[0]:null,Ot=t&&le?ws(t,le.clientId):void 0,de=p.mcpActivityId??null,{data:Ye=[]}=es({enabled:m&&a&&ce&&!!de,clientIds:w??[],limit:100}),Ze=k.useMemo(()=>{if(!de)return null;const h=Ye.find(N=>N.activityId===de);if(!h)return"Selected conversation";const v=h.title?.trim();return v||(h.activityKind==="session"?"MCP session":h.clientId)},[de,Ye]),U=p.agentId,W=p.schedule,{data:He=[]}=As(U??void 0),Xe=k.useMemo(()=>!W||!U?null:He.find(v=>v.id===W)?.description?.trim()||"Scheduled task",[U,W,He]),{data:$t}=ts(m&&a?e:null,o),{data:Mt}=ns(c&&!Ke?t:null,o),Je=a?$t:Mt,Ie=k.useMemo(()=>{const h=new Map;for(const v of Je||[]){const N=v.automation_name??"__global__";h.has(N)||h.set(N,{automationName:v.automation_name??null,classifiers:[]});const F=h.get(N),L=v.attribute_values||{},P=Object.keys(L);let me=null;const q={};for(const[Y,B]of Object.entries(L))if(B.parent)for(const[Fe,Z]of Object.entries(B.parent))me=Fe,q[Z]||(q[Z]=[]),q[Z].push(Y);const O=F.classifiers.find(Y=>Y.slug===v.slug);if(O){const Y=new Set([...O.values,...P]);O.values=[...Y];for(const[B,Fe]of Object.entries(q)){O.valuesByParentValue[B]||(O.valuesByParentValue[B]=[]);const Z=new Set([...O.valuesByParentValue[B],...Fe]);O.valuesByParentValue[B]=[...Z]}me&&(O.parentSlug=me)}else F.classifiers.push({slug:v.slug,name:v.name,values:P,parentSlug:me,valuesByParentValue:q})}for(const v of h.values())v.classifiers.sort((N,F)=>N.parentSlug===null&&F.parentSlug!==null?-1:N.parentSlug!==null&&F.parentSlug===null?1:0);return[...h.values()]},[Je]),Dt=ss(m&&a?e:null,o,p,t),Kt=os(c?t:null,o,p),Bt=c?Kt:Dt,{data:z,isLoading:Vt,error:Gt}=Bt,et=z?.pages[0],tt=(et?.content.length??0)>0,Qt=as(m&&a?e:null,o,p,t),Ut=is(c?t:null,o,p),Ee=c?Ut:Qt,Wt=Ee.data?.total??void 0,zt=Ee.data?.classification_stats,qt=Ee.isLoading,Yt=!!(p.beforeOccurredAt||p.afterOccurredAt),nt=cs(p),st=z?.pages[z.pages.length-1],K=st?.content[st.content.length-1];k.useEffect(()=>{!nt||!K||z?.pages.length===1||x.beforeOccurredAt===K.occurred_at&&x.beforeId===K.id||_({beforeOccurredAt:K.occurred_at,beforeId:K.id},{replace:!0})},[K?.id,nt,_,z?.pages.length,K,x.beforeOccurredAt,x.beforeId]);const Zt=k.useCallback(()=>{C({beforeOccurredAt:void 0,beforeId:void 0,afterOccurredAt:void 0,afterId:void 0}),window.scrollTo({top:0,behavior:"smooth"})},[C]),Ht=(h,v)=>{C({dateRange:[h,v]})},ot=(h,v)=>{const N={...p.classificationFilters||{}};if(v.length>0)N[h]=v;else{delete N[h];for(const F of Ie)for(const L of F.classifiers)L.parentSlug===h&&delete N[L.slug]}C({classificationFilters:N})},Xt=(h,v)=>{const N=p.classificationFilters?.[h]||[];ot(h,N.includes(v)?N.filter(F=>F!==v):[...N,v])},Jt=h=>ot(h,[]);if(Gt)return n.jsx(rs,{label:"knowledge"});const Ae=!m||y&&r||a&&!e||Vt,ue={fields:[],chips:[]};for(const h of Ie)for(const v of h.classifiers){const N=p.classificationFilters?.[v.slug]??[],F=v.parentSlug?p.classificationFilters?.[v.parentSlug]??[]:void 0,L=F?[...new Set(F.flatMap(P=>v.valuesByParentValue[P]??[]))]:v.values;L.length>0&&ue.fields.push({key:`clf:${v.slug}`,label:v.name,group:h.automationName??"Classifiers",icon:n.jsx(ls,{className:"h-4 w-4"}),editor:ge({searchPlaceholder:`Search ${v.name.toLowerCase()}...`,options:L.map(P=>({value:P,label:P,count:zt?.[v.slug]?.[P]})),selected:N,multiple:!0,onSelect:P=>Xt(v.slug,P)})})}for(const[h,v]of Object.entries(p.classificationFilters??{})){if(v.length===0)continue;const N=Ie.flatMap(F=>F.classifiers).find(F=>F.slug===h);ue.chips.push({id:`clf:${h}`,field:`clf:${h}`,label:N?.name??h,op:v.length>1?"is any of":"is",value:v.join(", "),onRemove:()=>Jt(h)})}const en=[p.contentIds?.length?fe({id:"contentIds",label:p.contentIds.length>1?"Events":"Event",value:`#${p.contentIds.join(", #")}`,onRemove:()=>C({contentIds:void 0})}):null,Ze?fe({id:"mcpActivityId",label:"Conversation",value:Ze,onRemove:()=>C({mcpActivityId:void 0})}):null,qe?fe({id:"clientIds",label:"Connected app",value:qe,sourceLink:Ot,details:w&&w.length>0?n.jsx(Ls,{ownerSlug:t,clientIds:w,linkedUser:le?.linkedUser,linkedUserEntitySlug:le?.linkedUserEntitySlug}):void 0,onRemove:()=>C({clientIds:void 0})}):null,Xe?fe({id:"schedule",label:"Schedule",value:Xe,sourceLink:t&&U&&W?Ps(t,U,W):void 0,onRemove:()=>C({schedule:void 0,runIds:void 0})}):null,...ue.chips].filter(h=>h!=null),at={filterTrailing:!!(a&&o&&e)?n.jsxs($e,{variant:"ghost",size:"sm",className:"h-8 text-muted-foreground","aria-pressed":T,onClick:()=>E(h=>!h),children:[n.jsx(us,{className:"mr-1.5 h-3.5 w-3.5"}),"Timeline"]}):void 0,onClearFilters:Q,leading:l,filters:p,onFiltersChange:C,eventKinds:Lt,searchQuery:b,onSearchChange:h=>{S.current=!0,I(h)},extraFields:ue.fields,drillChips:en,total:Wt,isListLoading:Ae,isTotalLoading:qt,hasCursorInUrl:Yt&&tt,onGoToLatest:Zt},tn=!Ae&&!!et&&!tt&&!ke,nn=y?a?"Activity is the workspace's live feed — every message, email, file, and record a connector pulls in lands here as an event. Connect your data to start collecting.":"Activity is the workspace's live feed of connector events. Join this workspace to add connectors and collect knowledge here.":"No public knowledge items are available yet",it=!!(a&&t);return n.jsx(ds,{children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:s?"sticky top-0 z-10 -mx-4 bg-background px-4 pb-3 lg:-mx-6 lg:px-6":void 0,children:s&&t?n.jsx(wt,{...at,ownerSlug:t}):n.jsx(Tt,{...at})}),T&&a&&o&&e&&n.jsx(Xs,{entityId:o,organizationId:e,ownerSlug:t||"",selectedRange:p.dateRange||void 0,onSelectRange:Ht}),Ae?n.jsx("div",{className:"space-y-4",children:["skeleton-1","skeleton-2","skeleton-3","skeleton-4","skeleton-5"].map(h=>n.jsx(Nt,{className:"h-32 rounded-lg"},h))}):tn?n.jsx(rt,{icon:lt,title:"No activity yet",description:nn,actionLabel:it?"Add a connector":void 0,onAction:it&&t?()=>void f({to:"/$owner/connectors/create",params:{owner:t}}):void 0}):n.jsx(js,{onFiltersChange:C,organizationId:e,ownerSlug:t,entityId:o,filters:p,showEntityLinks:Ke,foldConsecutiveCalls:!0,groupByConversation:!0,emptyState:n.jsx(rt,{icon:lt,title:"No results found",description:"Try adjusting your filters to find what you are looking for",actionLabel:ke?"Clear filters":void 0,onAction:ke?Q:void 0})})]})})}function to({record:e,ownerSlug:t,filterBarLeading:o}){const s=se(),i=V(),{filters:l,updateFilters:y}=Et({parse:xe,serialize:Re,filterKeys:It,replace:!1,merge:_t}),m=we({...l,platforms:void 0,connectionIds:void 0,feedIds:void 0})||l.sortBy!=null&&l.sortBy!=="date"||l.sortOrder!=null&&l.sortOrder!=="desc",d=()=>{i({...Pe(t,s.search??{}),...s.pathname.startsWith(`/${t}/events/`)?{}:{to:s.pathname}})};return n.jsxs("div",{className:"space-y-4",children:[n.jsx(wt,{ownerSlug:t,sourceRead:!0,leading:o,filters:l,onFiltersChange:y,searchQuery:l.searchQuery??"",onSearchChange:r=>y({searchQuery:r}),onClearFilters:d}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Live activity supports connector, connection and feed filters. Search and other event filters are available for saved activity."}),m?n.jsxs("div",{role:"alert",className:"space-y-2 rounded-md border p-3 text-sm",children:[n.jsx("p",{children:"Some selected filters aren't supported for live activity. Clear them to see results."}),n.jsx($e,{variant:"outline",size:"sm",onClick:()=>{const r=Re({platforms:l.platforms,connectionIds:l.connectionIds,feedIds:l.feedIds}),a={...Pe(t,s.search??{}).search,...r};i({to:s.pathname,search:a})},children:"Clear unsupported filters"})]}):n.jsx(gs,{record:e,orgContext:{slug:t},filters:l})]})}function vo({entity:e,organizationId:t,ownerSlug:o,filterBarLeading:s}){const i=e.is_derived?n.jsx(to,{ownerSlug:o,record:{type:e.entity_type,key:e.slug},filterBarLeading:s}):n.jsx(eo,{organizationId:t,ownerSlug:o,entityId:e.id,hideSourceFilter:!0,filterBarLeading:s});return n.jsx(_s,{organizationId:t,children:e.entity_type==="$member"?n.jsx(Cs,{children:i}):i})}export{eo as E,_s as M,vo as R};
2
+ //# sourceMappingURL=record-activity-CBXH6v1d.js.map
@@ -1,4 +1,4 @@
1
- import{dX as jN,dY as KN,r as Ge,j as $,B as qc,ce as II,dZ as JN,d_ as QN,d$ as pp,e0 as eB,cC as tB,e1 as rB,e2 as nB,e3 as aB,e4 as Cx,P as LI,C as iB,dj as oB,ae as sB,ds as lB,e5 as uB}from"./index-_oPeVpL_.js";import{c as fB,d as vB,b as cB,a as hB,C as dB}from"./card-DIF8SF9b.js";const one=jN({orgContext:r=>({slug:r.slug??null}),queryKey:r=>["views",r.slug],tool:"manage_views",body:()=>({action:"list"}),transform:r=>(Array.isArray(r.views)?r.views:[]).flatMap(e=>!e||typeof e.key!="string"||typeof e.name!="string"?[]:[{key:e.key,name:e.name===e.key?KN(e.key.replaceAll("-"," ")):e.name,attach:Array.isArray(e.attach)?e.attach:[],params:e.params&&typeof e.params=="object"&&!Array.isArray(e.params)?e.params:void 0,content_hash:typeof e.content_hash=="string"?e.content_hash:null}]),enabled:(r,e)=>!!r.slug&&!!e.organizationId,staleTime:1e4}),pB=r=>r!=null;function gB(r,e,t=pB){let n=r;for(const a of e.replace(/\[(\d+)\]/g,".$1").split(".")){if(!t(n))return;n=n[a]}return n}function yB(r,e,t){return typeof r!="string"?r:r.startsWith("@")?e?.[r.slice(1)]:r.startsWith("{{")&&r.endsWith("}}")&&r.indexOf("}}")===r.length-2?t(r.slice(2,-2).trim()):r.replace(/\{\{(.+?)\}\}/g,(n,a)=>{const i=t(a.trim());return i===void 0?"":String(i)})}const mB=new Set(["type","children","props","path","fallback","key"]);function _B(r,e){const t={};for(const[n,a]of Object.entries(r))mB.has(n)||(t[n]=a);return Object.assign(t,e)}const SB=/^\d{4}-\d{2}-\d{2}(?:[tT ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,xB=/^\d{4}-\d{2}-\d{2}$/;function wB(r){return SB.test(r)}function jc(r){if(!/^https?:\/\//i.test(r))return!1;try{const e=new URL(r);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function PI(r){return r.replace(/[-_]/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())}function Tx(r){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:r>=1e3?"compact":"standard",maximumFractionDigits:r>=1e9?1:0}).format(r)}function Ax(r){return new Intl.NumberFormat("en-US",{maximumFractionDigits:Number.isInteger(r)?0:2}).format(r)}function Mx(r){const e=new Date(xB.test(r)?`${r}T00:00:00`:r);return Number.isNaN(e.getTime())?r:e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function Dx(r){try{const e=new URL(r),t=e.hostname.replace(/^www\./i,""),n=e.pathname&&e.pathname!=="/"?e.pathname.replace(/\/$/,""):"";return`${t}${n}`}catch{return r}}function fm(r){return r==null?"":typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(RI(r)):Array.isArray(r)?r.some(e=>typeof e=="object"&&e!==null)?r.map((e,t)=>`${t+1}. ${fm(e)}`).join(`
1
+ import{dX as jN,dY as KN,r as Ge,j as $,B as qc,ce as II,dZ as JN,d_ as QN,d$ as pp,e0 as eB,cC as tB,e1 as rB,e2 as nB,e3 as aB,e4 as Cx,P as LI,C as iB,dj as oB,ae as sB,ds as lB,e5 as uB}from"./index-Cr5hwh-C.js";import{c as fB,d as vB,b as cB,a as hB,C as dB}from"./card-Djgp00r_.js";const one=jN({orgContext:r=>({slug:r.slug??null}),queryKey:r=>["views",r.slug],tool:"manage_views",body:()=>({action:"list"}),transform:r=>(Array.isArray(r.views)?r.views:[]).flatMap(e=>!e||typeof e.key!="string"||typeof e.name!="string"?[]:[{key:e.key,name:e.name===e.key?KN(e.key.replaceAll("-"," ")):e.name,attach:Array.isArray(e.attach)?e.attach:[],params:e.params&&typeof e.params=="object"&&!Array.isArray(e.params)?e.params:void 0,content_hash:typeof e.content_hash=="string"?e.content_hash:null}]),enabled:(r,e)=>!!r.slug&&!!e.organizationId,staleTime:1e4}),pB=r=>r!=null;function gB(r,e,t=pB){let n=r;for(const a of e.replace(/\[(\d+)\]/g,".$1").split(".")){if(!t(n))return;n=n[a]}return n}function yB(r,e,t){return typeof r!="string"?r:r.startsWith("@")?e?.[r.slice(1)]:r.startsWith("{{")&&r.endsWith("}}")&&r.indexOf("}}")===r.length-2?t(r.slice(2,-2).trim()):r.replace(/\{\{(.+?)\}\}/g,(n,a)=>{const i=t(a.trim());return i===void 0?"":String(i)})}const mB=new Set(["type","children","props","path","fallback","key"]);function _B(r,e){const t={};for(const[n,a]of Object.entries(r))mB.has(n)||(t[n]=a);return Object.assign(t,e)}const SB=/^\d{4}-\d{2}-\d{2}(?:[tT ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,xB=/^\d{4}-\d{2}-\d{2}$/;function wB(r){return SB.test(r)}function jc(r){if(!/^https?:\/\//i.test(r))return!1;try{const e=new URL(r);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function PI(r){return r.replace(/[-_]/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())}function Tx(r){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:r>=1e3?"compact":"standard",maximumFractionDigits:r>=1e9?1:0}).format(r)}function Ax(r){return new Intl.NumberFormat("en-US",{maximumFractionDigits:Number.isInteger(r)?0:2}).format(r)}function Mx(r){const e=new Date(xB.test(r)?`${r}T00:00:00`:r);return Number.isNaN(e.getTime())?r:e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function Dx(r){try{const e=new URL(r),t=e.hostname.replace(/^www\./i,""),n=e.pathname&&e.pathname!=="/"?e.pathname.replace(/\/$/,""):"";return`${t}${n}`}catch{return r}}function fm(r){return r==null?"":typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(RI(r)):Array.isArray(r)?r.some(e=>typeof e=="object"&&e!==null)?r.map((e,t)=>`${t+1}. ${fm(e)}`).join(`
2
2
  `):JSON.stringify(r):typeof r=="object"?Object.entries(r).filter(([,t])=>t!=null&&t!=="").map(([t,n])=>`${PI(t)}: ${fm(n)}`).join("; "):JSON.stringify(r)}function RI(r,e){if(r==null)return"";if(typeof r=="boolean")return r?"Yes":"No";if(typeof r=="number")return e==="currency"?Tx(r):e===void 0||e==="text"?String(r):Ax(r);if(typeof r!="string")return fm(r);switch(e){case"currency":return Tx(Number(r));case"date":return Mx(r);case"url":return Dx(r);case"enum":return PI(r);case"number":return Ax(Number(r));case"auto":return jc(r)?Dx(r):wB(r)?Mx(r):r;default:return r}}function bB(r){return r==null?null:typeof r=="string"||typeof r=="number"||typeof r=="boolean"?String(r):null}function EI(r,e){return typeof r!="string"||!r.startsWith("@")||r.length===1?null:{action:r.slice(1),value:bB(e)}}/*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -94,4 +94,4 @@ PERFORMANCE OF THIS SOFTWARE.
94
94
  * @license MIT
95
95
  */function om(r,e){return r?Wre(r)?Ge.createElement(r,e):r:null}function Wre(r){return $re(r)||typeof r=="function"||Yre(r)}function $re(r){return typeof r=="function"&&(()=>{const e=Object.getPrototypeOf(r);return e.prototype&&e.prototype.isReactComponent})()}function Yre(r){return typeof r=="object"&&typeof r.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(r.$$typeof.description)}function Xre(r){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...r},[t]=Ge.useState(()=>({current:zre(e)})),[n,a]=Ge.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...r,state:{...n,...r.state},onStateChange:o=>{a(o),r.onStateChange==null||r.onStateChange(o)}})),t.current}const AI=12;function sm(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function lm(r){return r.replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function Zre(r){try{return JSON.stringify(r,null,2)}catch{return String(r)}}function $i(r){return r===null?"null":r===void 0?"—":typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):Zre(r)}const MI=({value:r,openLink:e})=>{if(!jc(r))return $.jsx("span",{className:"break-words",children:r});let t=r;try{const n=new URL(r);t=`${n.host}${n.pathname==="/"?"":n.pathname}`}catch{}return $.jsxs(qc,{type:"button",variant:"ghost",size:"sm",className:"h-auto max-w-full justify-start px-1 py-0 text-left font-normal text-xs",onClick:()=>e(r),children:[$.jsx(II,{className:"mr-1 h-3 w-3 shrink-0"}),$.jsx("span",{className:"truncate",children:t})]})};function qre({page:r,pageCount:e,onChange:t}){return $.jsxs("div",{className:"mt-2 flex items-center justify-end gap-1.5",children:[$.jsxs(qc,{type:"button",size:"sm",variant:"outline",disabled:r===0,onClick:()=>t(r-1),children:[$.jsx(iB,{className:"h-3.5 w-3.5"}),$.jsx("span",{className:"sr-only",children:"Previous page"})]}),$.jsxs("span",{className:"text-muted-foreground text-xs",children:[r+1," / ",e]}),$.jsxs(qc,{type:"button",size:"sm",variant:"outline",disabled:r+1>=e,onClick:()=>t(r+1),children:[$.jsx(oB,{className:"h-3.5 w-3.5"}),$.jsx("span",{className:"sr-only",children:"Next page"})]})]})}function jre({rows:r,columns:e,openLink:t,stateKey:n="table",viewState:a,onViewStateChange:i,renderCell:o,renderStructuredValue:s,pageSize:l}){const u=Ge.useMemo(()=>e?null:[...new Set(r.flatMap(L=>Object.keys(L)))],[e,r]),f=Ge.useMemo(()=>e?.map(L=>L.name)??(u??[]).slice(0,AI),[e,u]),v=u?u.slice(AI):[],c=a?.[`${n}.sort.column`],h=a?.[`${n}.sort.desc`],d=typeof c=="string"&&c?[{id:c,desc:h===!0}]:[],[p,g]=Ge.useState(d),[y,m]=Ge.useState(null);Ge.useEffect(()=>{g(d)},[c,h]);function _(L){const I=new Set(f);return Object.keys(L).filter(P=>!I.has(P))}const S=Ge.useMemo(()=>f.map(L=>({id:L,accessorFn:I=>I[L],header:lm(L),enableSorting:L!=="open",sortDescFirst:!1,sortingFn:(I,P,R)=>{const E=I.getValue(R),O=P.getValue(R);return typeof E=="number"&&typeof O=="number"?E-O:$i(E).localeCompare($i(O),void 0,{numeric:!0,sensitivity:"base"})},cell:({getValue:I,row:P})=>{const R=I(),E=P.index===y;if(sm(R)||Array.isArray(R))return E?$.jsx("div",{className:"max-w-md break-words",children:s?s(R,t):$i(R)}):$.jsx("span",{className:"text-muted-foreground",children:Array.isArray(R)?"[…]":"{…}"});const O=o?.(R,L);if(O!=null)return O;if(L==="open"&&typeof R=="string")return $.jsxs(qc,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:V=>{V.stopPropagation(),t(R)},children:[$.jsx(II,{className:"mr-1 h-3.5 w-3.5"}),"Open"]});if(typeof R=="string"&&jc(R))return $.jsx(MI,{value:R,openLink:t});if(E)return $.jsx("span",{className:"break-words whitespace-pre-wrap",children:$i(R)});const k=$i(R);return $.jsx("span",{className:"block max-w-80 truncate",title:k,children:k})}})),[f,t,y,o,s]),x=a?.[`${n}.page`],[w,b]=Ge.useState(typeof x=="number"?Math.max(0,x):0);Ge.useEffect(()=>{b(typeof x=="number"?Math.max(0,x):0)},[x]);const T=l?Math.max(1,Math.ceil(r.length/l)):1,C=typeof x=="number"?Math.max(0,x):w,A=Math.min(C,T-1),D=Xre({data:r,columns:S,state:{sorting:p,...l?{pagination:{pageIndex:A,pageSize:l}}:{}},onSortingChange:L=>{const I=typeof L=="function"?L(p):L;g(I),i?.(`${n}.sort.column`,I[0]?.id??""),i?.(`${n}.sort.desc`,I[0]?.desc??!1)},getCoreRowModel:Fre(),getSortedRowModel:Ure(),...l?{getPaginationRowModel:Hre(),onPaginationChange:L=>{const I=typeof L=="function"?L({pageIndex:A,pageSize:l}):L;b(I.pageIndex),i?.(`${n}.page`,I.pageIndex)}}:{}});return $.jsxs("div",{children:[$.jsx("div",{className:"overflow-hidden rounded-md border border-border/70",children:$.jsxs(JN,{className:"text-xs",children:[$.jsx(QN,{className:"bg-muted/50",children:D.getHeaderGroups().map(L=>$.jsx(pp,{className:"hover:bg-transparent",children:L.headers.map(I=>{const P=I.column.getIsSorted(),R=String(I.column.columnDef.header),E=I.column.getCanSort();return $.jsx(eB,{"aria-sort":E?P==="asc"?"ascending":P==="desc"?"descending":"none":void 0,className:"h-8 whitespace-nowrap px-2",children:E?$.jsxs("button",{type:"button","aria-label":`Sort by ${R}`,className:"flex w-full items-center gap-1.5 text-left",onClick:I.column.getToggleSortingHandler(),children:[om(I.column.columnDef.header,I.getContext()),P==="asc"?$.jsx(tB,{className:"h-3 w-3"}):P==="desc"?$.jsx(rB,{className:"h-3 w-3"}):$.jsx(nB,{className:"h-3 w-3 opacity-45"})]}):om(I.column.columnDef.header,I.getContext())},I.id)})},L.id))}),$.jsx(aB,{children:D.getRowModel().rows.map(L=>{const I=L.index===y,P=_(L.original),R=P.length>0||f.some(E=>{const O=L.original[E];return sm(O)||Array.isArray(O)});return $.jsxs(Ge.Fragment,{children:[$.jsx(pp,{className:LI("transition-colors",R&&"cursor-pointer",I?"bg-muted/20":R&&"hover:bg-muted/30"),onClick:R?()=>m(I?null:L.index):void 0,children:L.getVisibleCells().map(E=>$.jsx(Cx,{className:"p-2 align-top",children:om(E.column.columnDef.cell,E.getContext())},E.id))}),I&&P.length>0?$.jsx(pp,{className:"border-b last:border-b-0 bg-muted/10",children:$.jsx(Cx,{colSpan:L.getVisibleCells().length,className:"p-2",children:$.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1",children:P.map(E=>{const O=L.original[E];return $.jsxs("div",{children:[$.jsxs("span",{className:"text-muted-foreground capitalize",children:[lm(E),":"]})," ",sm(O)||Array.isArray(O)?s?s(O,t):$.jsx("span",{className:"break-words whitespace-pre-wrap",children:$i(O)}):(()=>{const k=o?.(O,E);return k??(typeof O=="string"&&jc(O)?$.jsx(MI,{value:O,openLink:t}):$.jsx("span",{className:"break-words whitespace-pre-wrap",children:$i(O)}))})()]},E)})})})}):null]},L.id)})})]})}),v.length>0?$.jsxs("p",{className:"mt-2 text-muted-foreground text-xs",children:[v.length," additional"," ",v.length===1?"column":"columns"," available in expanded rows:"," ",v.slice(0,4).map(lm).join(", "),v.length>4?`, +${v.length-4} more`:""]}):null,l&&T>1?$.jsx(qre,{page:A,pageCount:T,onChange:L=>D.setPageIndex(L)}):null]})}function Kre(r,e,t){const n=e[0];let a=t;if(n&&typeof n=="object"&&!Array.isArray(n)){const i=n,o=i.currentTarget&&typeof i.currentTarget=="object"?i.currentTarget:i.target&&typeof i.target=="object"?i.target:null;o&&o.value!==void 0&&(o.value!==""||t==null)&&(a=o.value)}else(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&(a=n);return EI(r,a)}function um(r,e,t){const n=r;return Array.isArray(n)?!e&&!t?n:n.map(a=>({label:String(a[e??"label"]??""),value:Number(a[t??"value"]??0)})):[]}function Jre(r,e,t){const n=r;return Array.isArray(n)?!e&&!t?n:n.map(a=>({name:String(a[e??"name"]??""),value:Number(a[t??"value"]??0)})):[]}const DI={div:({children:r,...e})=>$.jsx("div",{...e,children:r}),span:({children:r,...e})=>$.jsx("span",{...e,children:r}),p:({children:r,...e})=>$.jsx("p",{...e,children:r}),h1:({children:r,...e})=>$.jsx("h1",{...e,children:r}),h2:({children:r,...e})=>$.jsx("h2",{...e,children:r}),h3:({children:r,...e})=>$.jsx("h3",{...e,children:r}),h4:({children:r,...e})=>$.jsx("h4",{...e,children:r}),ul:({children:r,...e})=>$.jsx("ul",{...e,children:r}),ol:({children:r,...e})=>$.jsx("ol",{...e,children:r}),li:({children:r,...e})=>$.jsx("li",{...e,children:r}),table:({children:r,...e})=>$.jsx("table",{...e,children:r}),thead:({children:r,...e})=>$.jsx("thead",{...e,children:r}),tbody:({children:r,...e})=>$.jsx("tbody",{...e,children:r}),tr:({children:r,...e})=>$.jsx("tr",{...e,children:r}),th:({children:r,...e})=>$.jsx("th",{...e,children:r}),td:({children:r,...e})=>$.jsx("td",{...e,children:r}),card:({children:r,className:e,...t})=>$.jsx(dB,{className:e,...t,children:r}),"card-header":({children:r,className:e,...t})=>$.jsx(hB,{className:e,...t,children:r}),"card-title":({children:r,className:e,...t})=>$.jsx(cB,{asChild:!0,className:e,children:$.jsx("h3",{...t,children:r})}),"card-description":({children:r,className:e,...t})=>$.jsx(vB,{className:e,...t,children:r}),"card-content":({children:r,className:e,...t})=>$.jsx(fB,{className:e,...t,children:r}),badge:({children:r,className:e,variant:t="default",...n})=>{const a={default:"bg-primary text-primary-foreground",secondary:"bg-secondary text-secondary-foreground",destructive:"bg-destructive text-destructive-foreground",outline:"border border-input bg-background"},i=s=>typeof s=="string"?s.replace(/[_-]/g," ").replace(/\b\w/g,l=>l.toUpperCase()):typeof s=="number"||typeof s=="boolean"||s==null||uB.isValidElement(s)?s:Array.isArray(s)?s.map(i):String(s),o=i(r);return $.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold ${a[t]||a.default} ${e||""}`,...n,children:o})},button:({children:r,className:e,variant:t="default",type:n="button",label:a,...i})=>{const o={default:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground"};return $.jsx("button",{type:n,className:`inline-flex items-center justify-center rounded-md text-sm font-medium h-10 px-4 py-2 ${o[t]||o.default} ${e||""}`,...i,children:r??String(a??"")})},select:({className:r,label:e,placeholder:t,options:n,onChange:a,onSelect:i,...o})=>$.jsxs("label",{className:`flex flex-col gap-1 text-sm ${r||""}`,children:[e?$.jsx("span",{className:"font-medium",children:String(e)}):null,$.jsxs("select",{className:"h-10 rounded-md border border-input bg-background px-3",onChange:a??i,defaultValue:"",...o,children:[t?$.jsx("option",{value:"",disabled:!0,children:String(t)}):null,Array.isArray(n)?n.map(s=>{const l=s,u=String(l.value??l.label??"");return $.jsx("option",{value:u,children:String(l.label??u)},JSON.stringify(l))}):null]})]}),alert:({children:r,className:e,variant:t="default",...n})=>{const a={default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive"};return $.jsx("div",{role:"alert",className:`relative w-full rounded-lg border p-4 ${a[t]||a.default} ${e||""}`,...n,children:r})},"alert-title":({children:r,className:e,...t})=>$.jsx("h5",{className:`mb-1 font-medium leading-none tracking-tight ${e||""}`,...t,children:r}),"alert-description":({children:r,className:e,...t})=>$.jsx("div",{className:`text-sm [&_p]:leading-relaxed ${e||""}`,...t,children:r}),progress:({className:r,value:e=0,label:t,...n})=>{const a=Math.round(e);return $.jsxs("div",{className:`flex items-center gap-2 ${r||""}`,...n,children:[$.jsx("div",{className:"relative h-4 flex-1 overflow-hidden rounded-full bg-secondary",children:$.jsx("div",{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-a}%)`}})}),$.jsx("span",{className:"text-xs font-medium tabular-nums text-muted-foreground shrink-0",children:t?String(t):`${a}%`})]})},strong:({children:r,...e})=>$.jsx("strong",{...e,children:r}),b:({children:r,...e})=>$.jsx("strong",{...e,children:r}),em:({children:r,...e})=>$.jsx("em",{...e,children:r}),link:({children:r,className:e,href:t,...n})=>{const a=String(t??""),i=/^https?:\/\//i.test(a);return $.jsx("a",{href:a,className:`text-primary underline underline-offset-2 hover:no-underline ${e||""}`,...i?{target:"_blank",rel:"noreferrer"}:{},...n,children:r})},a:({children:r,className:e,href:t,...n})=>$.jsx("a",{href:String(t??""),className:`text-primary underline underline-offset-2 hover:no-underline ${e||""}`,...n,children:r}),context:({children:r,className:e,...t})=>$.jsx("div",{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground ${e||""}`,...t,children:r}),fields:({children:r,className:e,...t})=>$.jsx("div",{className:`grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2 ${e||""}`,...t,children:r}),field:({children:r,className:e,label:t,value:n,...a})=>$.jsxs("div",{className:`flex flex-col gap-0.5 ${e||""}`,...a,children:[$.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:String(t??"")}),$.jsx("span",{className:"text-sm break-words",children:r??(n==null?"—":String(n))})]}),separator:({className:r,...e})=>$.jsx("div",{className:`shrink-0 bg-border h-[1px] w-full ${r||""}`,...e}),markdown:({content:r,className:e})=>$.jsx("div",{className:`max-w-none text-sm space-y-2 ${e||""}`,children:$.jsx(lB,{text:String(r??"")})}),layout:({children:r,className:e,direction:t="vertical"})=>$.jsx("div",{className:`flex ${t==="horizontal"?"flex-row":"flex-col"} gap-4 ${e||""}`,children:r}),columns:({children:r,className:e})=>{const t=Array.isArray(r)?r.filter(n=>n!=null).length:r?1:0;return $.jsx("div",{className:`grid gap-4 ${e||""}`,style:{gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`},children:r})},metric:({label:r,value:e,className:t})=>$.jsxs("div",{className:LI(sB,"p-4",t),children:[$.jsx("p",{className:"text-sm text-muted-foreground",children:String(r??"")}),$.jsx("p",{className:"mt-1 text-2xl font-bold",children:String(e??"")})]}),"bar-chart":({data:r,height:e,xLabel:t,yLabel:n,labelField:a,valueField:i})=>$.jsx(qte,{data:um(r,a,i),height:e,xLabel:t,yLabel:n}),"line-chart":({data:r,height:e,xLabel:t,yLabel:n,labelField:a,valueField:i})=>$.jsx(jte,{data:um(r,a,i),height:e,xLabel:t,yLabel:n}),"area-chart":({data:r,height:e,xLabel:t,yLabel:n,labelField:a,valueField:i})=>$.jsx(Zte,{data:um(r,a,i),height:e,xLabel:t,yLabel:n}),"pie-chart":({data:r,height:e,showLabel:t,showLegend:n,radius:a,highlightName:i,nameField:o,valueField:s})=>$.jsx(Kte,{data:Jre(r,o,s),height:e,showLabel:t,showLegend:n,radius:a,highlightName:i}),sparkline:({data:r,height:e,width:t,color:n,trend:a})=>$.jsx(Jte,{data:r,height:e,width:t,color:n,trend:a}),"stacked-area-chart":({data:r,series:e,height:t,xLabel:n,yLabel:a,onSeriesClick:i,onDateRangeSelect:o})=>$.jsx(Qte,{data:r,series:e,height:t,xLabel:n,yLabel:a,onSeriesClick:i,onDateRangeSelect:o})},Qre=new Set(["urgency","severity","sentiment","trend","status","priority"]),ene={critical:"bg-red-500/15 text-red-400 border-red-500/30",high:"bg-orange-500/15 text-orange-400 border-orange-500/30",medium:"bg-yellow-500/15 text-yellow-400 border-yellow-500/30",low:"bg-green-500/15 text-green-400 border-green-500/30"};function tne(r,e){if(r==null)return $.jsx("span",{className:"text-muted-foreground",children:"–"});const t=String(r);if(t.startsWith("http://")||t.startsWith("https://"))return $.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e==="url"?"↗ Link":t});if(e==="subreddit"&&typeof r=="string")return $.jsxs("a",{href:`https://reddit.com/r/${r}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:["r/",r]});if(Qre.has(e)&&typeof r=="string"){const n=ene[r.toLowerCase()]??"bg-secondary text-secondary-foreground border-border",a=r.replace(/[_-]/g," ").replace(/\b\w/g,i=>i.toUpperCase());return $.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium ${n}`,children:a})}return typeof r=="number"?$.jsx("span",{className:"font-mono tabular-nums",children:r}):typeof r=="boolean"?$.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium ${r?"bg-green-500/15 text-green-400 border-green-500/30":"bg-secondary text-secondary-foreground border-border"}`,children:r?"Yes":"No"}):$.jsx("span",{className:"whitespace-pre-wrap",children:t})}function rne({rows:r,columns:e,title:t}){return $.jsxs("div",{className:"space-y-2",children:[t&&$.jsx("h4",{className:"text-sm font-semibold",children:t}),$.jsx(jre,{rows:r,columns:e.map(n=>({name:n})),openLink:()=>{},renderCell:(n,a)=>tne(n,a)})]})}const xc=gB;function Du(r,e,t){if(r.type==="text")return r.content;if(r.type==="data"){const u=r,f=xc(e.data,u.path),v=f!==void 0?f:u.fallback,c=RI(v,u.format);if(c.length>100&&(c.includes(`
96
96
  `)||/[#*-]/.test(c))){const h=DI.markdown;return h?$.jsx(h,{content:c}):c}return c}if(r.type==="if"){const u=r;return xc(e.data,u.condition)?Du(u.then,e,t):u.else?Du(u.else,e,t):null}if(r.type==="each"){const u=r,f=xc(e.data,u.items);return Array.isArray(f)?f.map((v,c)=>{const h=u.as,d={...e,data:{...e.data,[h]:v,[`${h}Index`]:c}};if(typeof u.render=="string"){const p=`{{${h}}}`,g=typeof v=="string"?v:JSON.stringify(v);return u.render.split(p).join(g)}return Du(u.render,d,c)}):null}const n=r,a=e.components?.[n.type]??DI[n.type];if(!a)return console.warn(`Unknown component type: ${n.type}`),null;const i=u=>yB(u,e.actions,f=>xc(e.data,f)),o=_B(r,n.props),s={};for(const[u,f]of Object.entries(o)){if(/^on[A-Z]/.test(u))continue;const v=i(f);s[u]=v}for(const[u,f]of Object.entries(o)){if(!/^on[A-Z]/.test(u))continue;let v=i(f);if(typeof v!="function"&&e.onAction){const c=EI(f,s.value);c&&e.interactions?.[c.action]&&(v=(...h)=>e.onAction?.(Kre(f,h,s.value)??c))}if(typeof v!="function"){f!==void 0&&console.warn(`Ignoring non-function handler for "${u}" (got ${typeof v}). Bind actions as "@actionName".`);continue}s[u]=v}if(n.type==="table"&&Array.isArray(s.data)&&Array.isArray(s.columns)){const u=s.data,f=s.columns,v=s.title;return $.jsx(rne,{rows:u,columns:f,title:v},t)}const l=n.children?.map((u,f)=>Du(u,e,f));return $.jsx(a,{...s,children:l},t)}function nne(r,e,t,n,a,i){const o={data:e,actions:t,onAction:n,interactions:a,components:i};return Du(r.root,o)}function sne({template:r,data:e,actions:t,onAction:n,interactions:a,components:i}){return $.jsx($.Fragment,{children:nne(r,e,t,n,a,i)})}export{sne as J,bl as L,Jte as S,one as a,Xre as b,RI as c,jte as d,om as f,Fre as g,jc as i,mx as u};
97
- //# sourceMappingURL=renderer-BL6VcwQH.js.map
97
+ //# sourceMappingURL=renderer-mEDnVW0O.js.map
@@ -1,2 +1,2 @@
1
- import{U as v,r as o,j as e,L as h,V as j,H as y,W as N}from"./index-_oPeVpL_.js";import{C as k,a as C,b as S,c as L}from"./card-DIF8SF9b.js";function R(){const{token:n,error:x}=v.useSearch(),[a,p]=o.useState(""),[i,f]=o.useState(""),[d,s]=o.useState(null),[l,c]=o.useState(!1),[u,g]=o.useState(!1),w=async t=>{if(t.preventDefault(),!n){s("This reset link is invalid or expired.");return}if(a.length<8){s("Password must be at least 8 characters.");return}if(a!==i){s("Passwords do not match.");return}c(!0),s(null);try{const r=await j(`${y}/api/auth/reset-password`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:n,newPassword:a})});if(!r.ok)throw await N(r);g(!0)}catch(r){s(r instanceof Error?r.message:"Failed to reset password")}finally{c(!1)}},b=!n||x==="INVALID_TOKEN",m={callbackUrl:void 0,mode:void 0,error:void 0,errorDescription:void 0,loginHint:void 0,invitationOrg:void 0,intent:void 0};return e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:e.jsxs("div",{className:"w-full max-w-md p-8",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"mx-auto mb-6 h-8 w-auto"}),e.jsxs(k,{children:[e.jsx(C,{children:e.jsx(S,{asChild:!0,children:e.jsx("h1",{className:"text-center text-2xl",children:"Reset your password"})})}),e.jsx(L,{children:b&&!u?e.jsxs("div",{className:"mt-6 space-y-4 text-center",children:[e.jsx("p",{className:"text-sm text-destructive",children:"This reset link is invalid or expired."}),e.jsx(h,{to:"/auth/login",search:m,className:"text-sm text-primary hover:underline",children:"Back to sign in"})]}):u?e.jsxs("div",{className:"mt-6 space-y-4 text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your password has been reset successfully."}),e.jsx(h,{to:"/auth/login",search:m,className:"text-sm text-primary hover:underline",children:"Continue to sign in"})]}):e.jsxs("form",{onSubmit:w,className:"mt-6 space-y-4",children:[d&&e.jsx("div",{className:"p-3 text-sm text-destructive bg-destructive/10 rounded-lg",children:d}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"new-password",className:"block text-sm font-medium",children:"New password"}),e.jsx("input",{id:"new-password",type:"password",value:a,onChange:t=>p(t.target.value),minLength:8,required:!0,className:"mt-1 block h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirm-password",className:"block text-sm font-medium",children:"Confirm new password"}),e.jsx("input",{id:"confirm-password",type:"password",value:i,onChange:t=>f(t.target.value),minLength:8,required:!0,className:"mt-1 block h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsx("button",{type:"submit",disabled:l,className:"flex h-10 w-full items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50",children:l?"Resetting password...":"Reset password"})]})})]})]})})}export{R as component};
2
- //# sourceMappingURL=reset-password-DAvBYkiI.js.map
1
+ import{U as v,r as o,j as e,L as h,V as j,H as y,W as N}from"./index-Cr5hwh-C.js";import{C as k,a as C,b as S,c as L}from"./card-Djgp00r_.js";function R(){const{token:n,error:x}=v.useSearch(),[a,p]=o.useState(""),[i,f]=o.useState(""),[d,s]=o.useState(null),[l,c]=o.useState(!1),[u,g]=o.useState(!1),w=async t=>{if(t.preventDefault(),!n){s("This reset link is invalid or expired.");return}if(a.length<8){s("Password must be at least 8 characters.");return}if(a!==i){s("Passwords do not match.");return}c(!0),s(null);try{const r=await j(`${y}/api/auth/reset-password`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:n,newPassword:a})});if(!r.ok)throw await N(r);g(!0)}catch(r){s(r instanceof Error?r.message:"Failed to reset password")}finally{c(!1)}},b=!n||x==="INVALID_TOKEN",m={callbackUrl:void 0,mode:void 0,error:void 0,errorDescription:void 0,loginHint:void 0,invitationOrg:void 0,intent:void 0};return e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:e.jsxs("div",{className:"w-full max-w-md p-8",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"mx-auto mb-6 h-8 w-auto"}),e.jsxs(k,{children:[e.jsx(C,{children:e.jsx(S,{asChild:!0,children:e.jsx("h1",{className:"text-center text-2xl",children:"Reset your password"})})}),e.jsx(L,{children:b&&!u?e.jsxs("div",{className:"mt-6 space-y-4 text-center",children:[e.jsx("p",{className:"text-sm text-destructive",children:"This reset link is invalid or expired."}),e.jsx(h,{to:"/auth/login",search:m,className:"text-sm text-primary hover:underline",children:"Back to sign in"})]}):u?e.jsxs("div",{className:"mt-6 space-y-4 text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your password has been reset successfully."}),e.jsx(h,{to:"/auth/login",search:m,className:"text-sm text-primary hover:underline",children:"Continue to sign in"})]}):e.jsxs("form",{onSubmit:w,className:"mt-6 space-y-4",children:[d&&e.jsx("div",{className:"p-3 text-sm text-destructive bg-destructive/10 rounded-lg",children:d}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"new-password",className:"block text-sm font-medium",children:"New password"}),e.jsx("input",{id:"new-password",type:"password",value:a,onChange:t=>p(t.target.value),minLength:8,required:!0,className:"mt-1 block h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirm-password",className:"block text-sm font-medium",children:"Confirm new password"}),e.jsx("input",{id:"confirm-password",type:"password",value:i,onChange:t=>f(t.target.value),minLength:8,required:!0,className:"mt-1 block h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsx("button",{type:"submit",disabled:l,className:"flex h-10 w-full items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50",children:l?"Resetting password...":"Reset password"})]})})]})]})})}export{R as component};
2
+ //# sourceMappingURL=reset-password-uX_V6bip.js.map
@@ -1,2 +1,2 @@
1
- import{e8 as r,cd as s,cb as c,cc as l,V as g,e9 as I}from"./index-_oPeVpL_.js";const f=30,_=new Set(["running","pending","claimed"]);function m(n){return"workspace"in n?["workspace"]:"connectionId"in n?["connection",n.connectionId]:"deviceId"in n?["device",n.deviceId]:"connectorKey"in n?["connector",n.connectorKey]:["feed",n.feedId]}function y(n){return"workspace"in n?{}:"connectionId"in n?{connection_ids:[n.connectionId]}:"deviceId"in n?{device_worker_id:n.deviceId}:"connectorKey"in n?{connector_key:n.connectorKey}:{feed_ids:[n.feedId]}}function v(n,e,i){return r({queryKey:["runs-infinite",i??null,n?m(n):null,e.runTypes??null,e.status??null,e.automationIds??null,e.connectionIds??null,e.feedIds??null],queryFn:async({pageParam:t})=>{const a=t;return s("manage_operations",{action:"list_runs",...y(n),...e.runTypes&&e.runTypes.length>0?{run_types:e.runTypes}:{},...e.status?{status:e.status}:{},...e.automationIds?.length?{automation_ids:e.automationIds}:{},...e.connectionIds?.length?{connection_ids:e.connectionIds}:{},...e.feedIds?.length?{feed_ids:e.feedIds}:{},...a?{before_id:a.before_id,before_created_at:a.before_created_at}:{},limit:f},i?{slug:i}:void 0)},initialPageParam:null,getNextPageParam:t=>{if(!t.has_more)return;const a=t.runs[t.runs.length-1];if(a)return{before_id:a.id,before_created_at:a.created_at}},refetchInterval:t=>(t.state.data?.pages??[]).some(d=>d.runs.some(u=>_.has(u.status)))?5e3:!1,enabled:!!n,staleTime:15e3})}function p(n,e){return n.kind==="agent"?n.agentId?`/${n.agentId}/config/pending/${e}`:null:n.agentId&&n.automationId?`/${n.agentId}/automations/${n.automationId}/pending/${e}`:null}function T(n,e){const{slug:i}=c(),t=e!=null?p(n,e):null,a=n.kind==="agent"?["agent",n.agentId]:["automation",n.agentId,n.automationId];return l({queryKey:["pending-proposal",i,...a,e],queryFn:async()=>{const o=await g(I(i,t),{credentials:"include"});if(o.status===404)return{status:"gone"};if(!o.ok)throw new Error(`Failed to fetch pending proposal: ${o.status}`);return{status:"pending",proposal:await o.json()}},enabled:!!i&&!!t&&!!e,staleTime:0,retry:!1})}export{T as a,v as u};
2
- //# sourceMappingURL=runs-BWtc5rmc.js.map
1
+ import{e8 as r,cd as s,cb as c,cc as l,V as g,e9 as I}from"./index-Cr5hwh-C.js";const f=30,_=new Set(["running","pending","claimed"]);function m(n){return"workspace"in n?["workspace"]:"connectionId"in n?["connection",n.connectionId]:"deviceId"in n?["device",n.deviceId]:"connectorKey"in n?["connector",n.connectorKey]:["feed",n.feedId]}function y(n){return"workspace"in n?{}:"connectionId"in n?{connection_ids:[n.connectionId]}:"deviceId"in n?{device_worker_id:n.deviceId}:"connectorKey"in n?{connector_key:n.connectorKey}:{feed_ids:[n.feedId]}}function v(n,e,i){return r({queryKey:["runs-infinite",i??null,n?m(n):null,e.runTypes??null,e.status??null,e.automationIds??null,e.connectionIds??null,e.feedIds??null],queryFn:async({pageParam:t})=>{const a=t;return s("manage_operations",{action:"list_runs",...y(n),...e.runTypes&&e.runTypes.length>0?{run_types:e.runTypes}:{},...e.status?{status:e.status}:{},...e.automationIds?.length?{automation_ids:e.automationIds}:{},...e.connectionIds?.length?{connection_ids:e.connectionIds}:{},...e.feedIds?.length?{feed_ids:e.feedIds}:{},...a?{before_id:a.before_id,before_created_at:a.before_created_at}:{},limit:f},i?{slug:i}:void 0)},initialPageParam:null,getNextPageParam:t=>{if(!t.has_more)return;const a=t.runs[t.runs.length-1];if(a)return{before_id:a.id,before_created_at:a.created_at}},refetchInterval:t=>(t.state.data?.pages??[]).some(d=>d.runs.some(u=>_.has(u.status)))?5e3:!1,enabled:!!n,staleTime:15e3})}function p(n,e){return n.kind==="agent"?n.agentId?`/${n.agentId}/config/pending/${e}`:null:n.agentId&&n.automationId?`/${n.agentId}/automations/${n.automationId}/pending/${e}`:null}function T(n,e){const{slug:i}=c(),t=e!=null?p(n,e):null,a=n.kind==="agent"?["agent",n.agentId]:["automation",n.agentId,n.automationId];return l({queryKey:["pending-proposal",i,...a,e],queryFn:async()=>{const o=await g(I(i,t),{credentials:"include"});if(o.status===404)return{status:"gone"};if(!o.ok)throw new Error(`Failed to fetch pending proposal: ${o.status}`);return{status:"pending",proposal:await o.json()}},enabled:!!i&&!!t&&!!e,staleTime:0,retry:!1})}export{T as a,v as u};
2
+ //# sourceMappingURL=runs-C0rCgGwX.js.map
@@ -0,0 +1,2 @@
1
+ import{j as e,P as g,hF as T,S as r,r as o,a1 as w}from"./index-Cr5hwh-C.js";import{u as A}from"./runs-C0rCgGwX.js";import{F,o as P}from"./filter-editors-Cj-v6NtH.js";import{R as E}from"./runs-table-syPJ6r6T.js";const v=[{value:"all",label:"All"},{value:"sync",label:"Sync",runTypes:["sync"]},{value:"action",label:"Action",runTypes:["action"]},{value:"auth",label:"Auth",runTypes:["auth"]}];function B(s){return v.find(n=>n.value===s)?.runTypes}const h=[{value:"running",label:"Running"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"pending",label:"Pending"}];function I({bucket:s,status:n,onBucketChange:t,onStatusChange:l}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"inline-flex rounded-md border bg-muted/30 p-0.5 text-sm",children:v.map(a=>e.jsx("button",{type:"button",onClick:()=>t(a.value),className:g("rounded px-3 py-1 transition-colors",s===a.value?"bg-background text-foreground ":"text-muted-foreground hover:text-foreground"),children:a.label},a.value))}),e.jsx(F,{label:"Run filters",className:"flex-1",fields:[{key:"status",label:"Status",icon:e.jsx(T,{className:"h-4 w-4"}),editor:P({searchPlaceholder:"Search statuses...",options:h,selected:n==="all"?[]:[n],onSelect:l})}],chips:n==="all"?[]:[{id:"status",label:"Status",op:"is",value:h.find(a=>a.value===n)?.label??n,onRemove:()=>l("all")}]})]})}function C({labels:s,className:n}){return e.jsx("div",{className:g("inline-flex rounded-md border bg-muted/30 p-0.5 text-sm",n),children:s.map((t,l)=>e.jsx("span",{className:l===0?"rounded bg-background px-3 py-1 text-foreground ":"px-3 py-1 text-muted-foreground",children:t},t))})}function b({rows:s=6}){return e.jsxs("div",{className:"rounded-lg border",role:"status","aria-label":"Loading runs",children:[e.jsx("div",{className:"border-b px-3 py-2",children:e.jsx(r,{className:"h-3 w-1/4"})}),e.jsx("div",{className:"divide-y",children:Array.from({length:s}).map((n,t)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[e.jsx(r,{className:"h-3.5 w-3.5 rounded-full shrink-0"}),e.jsx(r,{className:"h-3 w-20"}),e.jsx(r,{className:"h-3 w-16"}),e.jsx(r,{className:"ml-auto h-3 w-12 shrink-0"}),e.jsx(r,{className:"h-7 w-7 rounded-md shrink-0"})]},t))})]})}function _({rows:s=6}){return e.jsxs("div",{className:"space-y-4",role:"status","aria-label":"Loading runs",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(C,{labels:["All","Sync","Action","Auth"]}),e.jsx("div",{className:"h-9 w-[150px] rounded-md border border-input"})]}),e.jsx(b,{rows:s})]})}function K({scope:s,ownerSlug:n}){const[t,l]=o.useState("all"),[a,j]=o.useState("all"),N=o.useMemo(()=>({runTypes:B(t),status:a==="all"?void 0:a}),[t,a]),{data:c,isLoading:y,isError:S,hasNextPage:d,isFetchingNextPage:u,fetchNextPage:x}=A(s,N,n),m=o.useMemo(()=>c?.pages.flatMap(i=>i.runs)??[],[c]),R={runType:t==="all",feed:!0,connection:"deviceId"in s||"connectorKey"in s},p=o.useRef(null);return o.useEffect(()=>{const i=p.current;if(!i||!d)return;const f=new IntersectionObserver(k=>{k[0]?.isIntersecting&&!u&&x()},{rootMargin:"200px"});return f.observe(i),()=>f.disconnect()},[d,u,x]),e.jsxs("div",{className:"space-y-3",children:[e.jsx(I,{bucket:t,status:a,onBucketChange:l,onStatusChange:j}),y?e.jsx(b,{}):S?e.jsx("p",{className:"rounded-lg border bg-destructive/5 px-3 py-6 text-center text-xs text-destructive",children:"Failed to load runs."}):m.length===0?e.jsx("p",{className:"rounded-lg border bg-muted/20 px-3 py-6 text-center text-xs text-muted-foreground",children:t==="all"&&a==="all"?"No runs yet.":"No runs match these filters."}):e.jsxs(e.Fragment,{children:[e.jsx(E,{runs:m,ownerSlug:n,columns:R}),e.jsx("div",{ref:p,className:"h-1"}),u&&e.jsx("div",{className:"flex justify-center py-3",children:e.jsx(w,{size:"lg",className:"text-muted-foreground"})})]})]})}export{K as R,_ as a};
2
+ //# sourceMappingURL=runs-panel-Du1JMjg5.js.map
@@ -1,2 +1,2 @@
1
- import{j as e,P as l,hJ as u,B as N,L as b,cB as w,dz as k,dA as v,dB as T,hK as C,hL as _,dZ as S,d_ as V,d$ as p,e0 as n,e3 as R,e4 as x,bc as L,dt as B,M as D,hM as E,dx as M,aa as P,a1 as A,bd as I,r as h,d5 as m,d7 as g,d6 as j}from"./index-_oPeVpL_.js";const O=u("inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors",{variants:{status:{active:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",paused:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",error:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",pending:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",rejected:"bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",default:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"}},defaultVariants:{status:"default"}}),z=u("h-1.5 w-1.5 rounded-full",{variants:{status:{active:"bg-green-500",paused:"bg-yellow-500",error:"bg-red-500",pending:"bg-blue-500",rejected:"bg-gray-500",default:"bg-gray-500"}},defaultVariants:{status:"default"}});function F({className:t,status:a,showDot:r=!0,children:i,...s}){return e.jsxs("span",{className:l(O({status:a}),t),...s,children:[r&&e.jsx("span",{className:z({status:a})}),i]})}function H(t,a){switch(a.kind){case"connection":return _(t,a.id);case"feed":return C(t,a.id);case"run":return{to:"/$owner/events",params:{owner:t},search:{run_ids:String(a.id)}}}}function J({ownerSlug:t,scope:a,variant:r="outline",iconOnly:i=!1,label:s,className:d,title:f}){const c=H(t,a),y=f??s??"View in memory",o=e.jsx(N,{asChild:!0,variant:r,size:i?"icon":"sm",className:l(i&&"h-7 w-7",d),children:e.jsxs(b,{to:c.to,params:c.params,search:c.search,children:[e.jsx(w,{className:l("h-3.5 w-3.5",!i&&"mr-1.5")}),!i&&(s??"View in memory")]})});return i?e.jsxs(k,{children:[e.jsx(v,{asChild:!0,children:o}),e.jsx(T,{children:y})]}):o}const $=new Set(["error","failed","revoked"]);function K(t){return t==="active"?"active":t==="paused"?"paused":t==="pending"||t==="pending_auth"?"pending":$.has(t)?"error":"default"}function U({status:t}){return t==="completed"?e.jsx(M,{className:"h-3.5 w-3.5 text-green-500"}):t==="failed"?e.jsx(P,{className:"h-3.5 w-3.5 text-destructive"}):t==="running"?e.jsx(A,{className:"text-blue-500"}):e.jsx(I,{className:"h-3.5 w-3.5 text-muted-foreground"})}function W({error:t}){const[a,r]=h.useState(!1);return t.length>80?e.jsxs(m,{open:a,onOpenChange:r,children:[e.jsx(g,{asChild:!0,children:e.jsx("button",{type:"button",className:"text-left text-destructive truncate max-w-[200px] hover:underline",children:t})}),e.jsx(j,{className:"w-96 max-h-64 overflow-auto",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words text-destructive",children:t})})]}):e.jsx("span",{className:"text-destructive",children:t})}function X({checkpoint:t}){const[a,r]=h.useState(!1);return e.jsxs(m,{open:a,onOpenChange:r,children:[e.jsx(g,{asChild:!0,children:e.jsx("button",{type:"button",className:"text-left text-muted-foreground hover:underline",children:"view"})}),e.jsx(j,{className:"w-80 max-h-64 overflow-auto",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:JSON.stringify(t,null,2)})})]})}function Z(t){return t.feed_display_name??t.feed_key??"—"}function G({runs:t,ownerSlug:a,columns:r={}}){const i=t.some(s=>s.checkpoint);return e.jsx("div",{className:"rounded-lg border",children:e.jsxs(S,{children:[e.jsx(V,{children:e.jsxs(p,{children:[e.jsx(n,{className:"text-xs py-1.5 px-3 w-8"}),e.jsx(n,{className:"text-xs py-1.5 px-3",children:"When"}),r.runType&&e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Type"}),r.connection&&e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Connection"}),r.feed&&e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Feed"}),e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Status"}),e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Items"}),e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Duration"}),e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Version"}),i&&e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Checkpoint"}),e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Error"}),e.jsx(n,{className:"text-xs py-1.5 px-3 w-8"})]})}),e.jsx(R,{children:t.map(s=>{const d=s.completed_at?Math.round((new Date(s.completed_at).getTime()-new Date(s.created_at).getTime())/1e3):null;return e.jsxs(p,{children:[e.jsx(x,{className:"py-1.5 px-3",children:e.jsx(U,{status:s.status})}),e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",title:B(s.created_at),children:L(s.created_at)}),r.runType&&e.jsx(x,{className:"py-1.5 px-3 text-xs",children:e.jsx(D,{variant:"secondary",className:"font-mono text-[10px]",children:s.run_type??"—"})}),r.connection&&e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",children:s.connection_display_name??"—"}),r.feed&&e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",children:Z(s)}),e.jsx(x,{className:"py-1.5 px-3 text-xs",children:e.jsx(F,{status:K(s.status),children:s.status})}),e.jsx(x,{className:"py-1.5 px-3 text-xs font-mono text-muted-foreground",children:s.items_collected??"—"}),e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",children:d!=null?E(d):"—"}),e.jsx(x,{className:"py-1.5 px-3 text-xs font-mono text-muted-foreground",children:s.connector_version??"—"}),i&&e.jsx(x,{className:"py-1.5 px-3 text-xs",children:s.checkpoint?e.jsx(X,{checkpoint:s.checkpoint}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx(x,{className:"py-1.5 px-3 text-xs",children:s.error_message?e.jsx(W,{error:s.error_message}):""}),e.jsx(x,{className:"py-1.5 px-3 text-right",children:e.jsx(J,{ownerSlug:a,scope:{kind:"run",id:s.id},variant:"ghost",iconOnly:!0,title:"View events from this run"})})]},s.id)})})]})})}export{G as R,F as S,J as V,K as g};
2
- //# sourceMappingURL=runs-table-DxIiqrSk.js.map
1
+ import{j as e,P as l,hG as u,B as N,L as b,cB as w,dz as k,dA as v,dB as T,hH as C,hI as _,dZ as S,d_ as V,d$ as p,e0 as n,e3 as R,e4 as x,bc as B,dt as D,M as L,hJ as E,dx as I,aa as M,a1 as P,bd as A,r as h,d5 as m,d7 as g,d6 as j}from"./index-Cr5hwh-C.js";const H=u("inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors",{variants:{status:{active:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",paused:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",error:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",pending:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",rejected:"bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",default:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"}},defaultVariants:{status:"default"}}),O=u("h-1.5 w-1.5 rounded-full",{variants:{status:{active:"bg-green-500",paused:"bg-yellow-500",error:"bg-red-500",pending:"bg-blue-500",rejected:"bg-gray-500",default:"bg-gray-500"}},defaultVariants:{status:"default"}});function z({className:t,status:a,showDot:r=!0,children:i,...s}){return e.jsxs("span",{className:l(H({status:a}),t),...s,children:[r&&e.jsx("span",{className:O({status:a})}),i]})}function F(t,a){switch(a.kind){case"connection":return _(t,a.id);case"feed":return C(t,a.id);case"run":return{to:"/$owner/events",params:{owner:t},search:{run_ids:String(a.id)}}}}function J({ownerSlug:t,scope:a,variant:r="outline",iconOnly:i=!1,label:s,className:d,title:f}){const c=F(t,a),y=f??s??"View in memory",o=e.jsx(N,{asChild:!0,variant:r,size:i?"icon":"sm",className:l(i&&"h-7 w-7",d),children:e.jsxs(b,{to:c.to,params:c.params,search:c.search,children:[e.jsx(w,{className:l("h-3.5 w-3.5",!i&&"mr-1.5")}),!i&&(s??"View in memory")]})});return i?e.jsxs(k,{children:[e.jsx(v,{asChild:!0,children:o}),e.jsx(T,{children:y})]}):o}const $=new Set(["error","failed","revoked"]);function G(t){return t==="active"?"active":t==="paused"?"paused":t==="pending"||t==="pending_auth"?"pending":$.has(t)?"error":"default"}function U({status:t}){return t==="completed"?e.jsx(I,{className:"h-3.5 w-3.5 text-green-500"}):t==="failed"?e.jsx(M,{className:"h-3.5 w-3.5 text-destructive"}):t==="running"?e.jsx(P,{className:"text-blue-500"}):e.jsx(A,{className:"h-3.5 w-3.5 text-muted-foreground"})}function W({error:t}){const[a,r]=h.useState(!1);return t.length>80?e.jsxs(m,{open:a,onOpenChange:r,children:[e.jsx(g,{asChild:!0,children:e.jsx("button",{type:"button",className:"text-left text-destructive truncate max-w-[200px] hover:underline",children:t})}),e.jsx(j,{className:"w-96 max-h-64 overflow-auto",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words text-destructive",children:t})})]}):e.jsx("span",{className:"text-destructive",children:t})}function X({checkpoint:t}){const[a,r]=h.useState(!1);return e.jsxs(m,{open:a,onOpenChange:r,children:[e.jsx(g,{asChild:!0,children:e.jsx("button",{type:"button",className:"text-left text-muted-foreground hover:underline",children:"view"})}),e.jsx(j,{className:"w-80 max-h-64 overflow-auto",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:JSON.stringify(t,null,2)})})]})}function Z(t){return t.feed_display_name??t.feed_key??"—"}function K({runs:t,ownerSlug:a,columns:r={}}){const i=t.some(s=>s.checkpoint);return e.jsx("div",{className:"rounded-lg border",children:e.jsxs(S,{children:[e.jsx(V,{children:e.jsxs(p,{children:[e.jsx(n,{className:"text-xs py-1.5 px-3 w-8"}),e.jsx(n,{className:"text-xs py-1.5 px-3",children:"When"}),r.runType&&e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Type"}),r.connection&&e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Connection"}),r.feed&&e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Feed"}),e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Status"}),e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Items"}),e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Duration"}),e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Version"}),i&&e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Checkpoint"}),e.jsx(n,{className:"text-xs py-1.5 px-3",children:"Error"}),e.jsx(n,{className:"text-xs py-1.5 px-3 w-8"})]})}),e.jsx(R,{children:t.map(s=>{const d=s.completed_at?Math.round((new Date(s.completed_at).getTime()-new Date(s.created_at).getTime())/1e3):null;return e.jsxs(p,{children:[e.jsx(x,{className:"py-1.5 px-3",children:e.jsx(U,{status:s.status})}),e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",title:D(s.created_at),children:B(s.created_at)}),r.runType&&e.jsx(x,{className:"py-1.5 px-3 text-xs",children:e.jsx(L,{variant:"secondary",className:"font-mono text-[10px]",children:s.run_type??"—"})}),r.connection&&e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",children:s.connection_display_name??"—"}),r.feed&&e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",children:Z(s)}),e.jsx(x,{className:"py-1.5 px-3 text-xs",children:e.jsx(z,{status:G(s.status),children:s.status})}),e.jsx(x,{className:"py-1.5 px-3 text-xs font-mono text-muted-foreground",children:s.items_collected??"—"}),e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",children:d!=null?E(d):"—"}),e.jsx(x,{className:"py-1.5 px-3 text-xs font-mono text-muted-foreground",children:s.connector_version??"—"}),i&&e.jsx(x,{className:"py-1.5 px-3 text-xs",children:s.checkpoint?e.jsx(X,{checkpoint:s.checkpoint}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx(x,{className:"py-1.5 px-3 text-xs",children:s.error_message?e.jsx(W,{error:s.error_message}):""}),e.jsx(x,{className:"py-1.5 px-3 text-right",children:e.jsx(J,{ownerSlug:a,scope:{kind:"run",id:s.id},variant:"ghost",iconOnly:!0,title:"View events from this run"})})]},s.id)})})]})})}export{K as R,z as S,J as V,G as g};
2
+ //# sourceMappingURL=runs-table-syPJ6r6T.js.map
@@ -1,2 +1,2 @@
1
- import{g as i,j as e,L as c,s as m,P as t,ae as n,B as l,Y as d}from"./index-_oPeVpL_.js";import{F as o}from"./full-page-spinner-KpV2FS2u.js";function h(){const{session:s,isReady:r}=i();if(!r)return e.jsx(o,{});if(!s||!s.user)return e.jsx("div",{className:"container mx-auto py-8 px-4",children:e.jsxs("div",{className:"max-w-md mx-auto text-center space-y-4",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Not signed in"}),e.jsx("p",{className:"text-muted-foreground",children:"Please sign in to view your settings."}),e.jsx(c,{to:"/auth/login",search:m({intent:"sign-in"}),className:"inline-block px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Sign In"})]})});const a=async()=>{await d(),window.location.href="/"};return e.jsx("div",{className:"container mx-auto py-8 px-4",children:e.jsxs("div",{className:"max-w-2xl mx-auto space-y-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Settings"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage your account settings"})]}),e.jsxs("div",{className:t(n,"p-6 space-y-6"),children:[e.jsx("h2",{className:"text-lg font-medium",children:"Profile"}),e.jsxs("div",{className:"flex items-center gap-4",children:[s.user.image?e.jsx("img",{src:s.user.image,alt:s.user.name||"User",referrerPolicy:"no-referrer",className:"h-16 w-16 rounded-full object-cover"}):e.jsx("div",{className:"h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-xl font-medium text-primary",children:(s.user.name||s.user.email||"U")[0].toUpperCase()})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s.user.name||"User"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.user.email})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),e.jsx("p",{className:"mt-1",children:s.user.name||"Not set"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Email"}),e.jsx("p",{className:"mt-1",children:s.user.email})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"User ID"}),e.jsx("p",{className:"mt-1 text-xs font-mono text-muted-foreground",children:s.user.id})]})]})]}),e.jsxs("div",{className:t(n,"p-6 space-y-4"),children:[e.jsx("h2",{className:"text-lg font-medium",children:"Account"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sign out of your account on this device."}),e.jsx(l,{variant:"destructive",onClick:a,children:"Sign Out"})]})]})})}export{h as component};
2
- //# sourceMappingURL=settings-Crxlwps-.js.map
1
+ import{g as i,j as e,L as c,s as m,P as t,ae as n,B as l,Y as d}from"./index-Cr5hwh-C.js";import{F as o}from"./full-page-spinner-DqpH99np.js";function h(){const{session:s,isReady:r}=i();if(!r)return e.jsx(o,{});if(!s||!s.user)return e.jsx("div",{className:"container mx-auto py-8 px-4",children:e.jsxs("div",{className:"max-w-md mx-auto text-center space-y-4",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Not signed in"}),e.jsx("p",{className:"text-muted-foreground",children:"Please sign in to view your settings."}),e.jsx(c,{to:"/auth/login",search:m({intent:"sign-in"}),className:"inline-block px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Sign In"})]})});const a=async()=>{await d(),window.location.href="/"};return e.jsx("div",{className:"container mx-auto py-8 px-4",children:e.jsxs("div",{className:"max-w-2xl mx-auto space-y-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Settings"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage your account settings"})]}),e.jsxs("div",{className:t(n,"p-6 space-y-6"),children:[e.jsx("h2",{className:"text-lg font-medium",children:"Profile"}),e.jsxs("div",{className:"flex items-center gap-4",children:[s.user.image?e.jsx("img",{src:s.user.image,alt:s.user.name||"User",referrerPolicy:"no-referrer",className:"h-16 w-16 rounded-full object-cover"}):e.jsx("div",{className:"h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-xl font-medium text-primary",children:(s.user.name||s.user.email||"U")[0].toUpperCase()})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s.user.name||"User"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.user.email})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),e.jsx("p",{className:"mt-1",children:s.user.name||"Not set"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Email"}),e.jsx("p",{className:"mt-1",children:s.user.email})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"User ID"}),e.jsx("p",{className:"mt-1 text-xs font-mono text-muted-foreground",children:s.user.id})]})]})]}),e.jsxs("div",{className:t(n,"p-6 space-y-4"),children:[e.jsx("h2",{className:"text-lg font-medium",children:"Account"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sign out of your account on this device."}),e.jsx(l,{variant:"destructive",onClick:a,children:"Sign Out"})]})]})})}export{h as component};
2
+ //# sourceMappingURL=settings-9NkNA1G1.js.map
@@ -0,0 +1,2 @@
1
+ import{ii as t,j as n}from"./index-Cr5hwh-C.js";import{a as s}from"./agents-workbench-Bt5QCYQ7.js";import"./agent-editor-form-hTs7eO_U.js";import"./model-selector-dAbDgJvx.js";import"./proposal-review-shell-UcZr87_Q.js";import"./runs-C0rCgGwX.js";function c(){const{owner:o,agentId:r}=t.useParams(),e=t.useSearch();return n.jsx(s,{owner:o,agentId:r,tab:"settings",runId:e.run_id})}export{c as component};
2
+ //# sourceMappingURL=settings-E-10sLQX.js.map
@@ -0,0 +1,2 @@
1
+ import{ih as r,j as t,O as s}from"./index-Cr5hwh-C.js";import{A as e}from"./agent-skill-context-CCdvtlmH.js";import"./core.esm-CYvgWCuv.js";import"./skill-editor-D_W3QlRz.js";function p(){const{agentId:o}=r.useParams();return t.jsx(e,{agentId:o,children:t.jsx(s,{})})}export{p as component};
2
+ //# sourceMappingURL=skills-D2Ri9b4f.js.map
@@ -1,2 +1,2 @@
1
- import{k as y,cc as b,e6 as _,j as e,B as j,e7 as v,S as L,bw as C,L as R,dk as E,o as S}from"./index-_oPeVpL_.js";import{a as F,b as P}from"./events-feed-fucGZSJR.js";function f({failures:i,onRetry:c,isError:d=!1,isFetching:l=!1}){return i.length===0&&!d?null:e.jsxs("div",{role:"alert",className:"flex items-center justify-between gap-3 rounded-md border border-destructive/40 px-3 py-2 text-xs",children:[e.jsxs("span",{children:[i.length<=1?"A source":`${i.length} sources`," could not be read, so some items may be missing."]}),e.jsx(j,{size:"sm",variant:"outline",className:"h-7",onClick:c,disabled:l,children:"Retry"})]})}function A({record:i,orgContext:c,filters:d}){const{orgContext:l}=y(),t=c??l,{data:p}=b({queryKey:["connector-definitions","source-record",t.organizationId,t.slug],queryFn:()=>S(t),enabled:!!(t.organizationId||t.slug),staleTime:6e4}),{data:o,isLoading:x,isError:n,refetch:g,fetchNextPage:a,hasNextPage:h,isFetching:u,isFetchingNextPage:s}=_(i,t,d),N=o?.pages.flatMap(r=>r.events)??[],m=o?.pages.flatMap(r=>r.failures)??[];return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(f,{failures:m,isError:n,isFetching:u,onRetry:()=>void g()}),e.jsx(F,{isLoading:x,hasNextPage:!!h&&!n,autoLoadMore:m.length===0,isFetching:u,isFetchingNextPage:s,onLoadMore:()=>void a(),emptyState:n||m.length>0||h?null:e.jsx("p",{className:"text-xs text-muted-foreground",children:"No activity for this record in its connected sources."}),items:N.map(r=>({key:`${r.feed_id}:${r.origin_id}`,occurredAt:r.occurred_at,content:e.jsx("div",{className:"p-3",children:e.jsx(P,{ownerSlug:t.slug,connectorDefinitions:p,content:{...r,title:r.title||r.origin_type||r.origin_id,text_content:r.payload_text??""}})})}))})]})}function w({record:i,ownerSlug:c,orgContext:d}){const{orgContext:l}=y(),{data:t,isLoading:p,isError:o,refetch:x,hasNextPage:n,fetchNextPage:g,isFetching:a,isFetchNextPageError:h,error:u}=v(i,d??l);return p?e.jsx(L,{className:"h-12 w-full rounded-lg"}):t?e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{failures:t.failures,isError:o,isFetching:a,onRetry:()=>{if(a)return;const s=u instanceof C&&u.status===400;h&&!s||!o&&n?g():x()}}),t.links.length===0&&t.failures.length===0&&!n&&!o&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"No relationships for this record in its connected sources."}),t.links.length===0&&n&&!o&&t.failures.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"More source records remain to check for relationships."}),e.jsx("ul",{className:"space-y-1",children:t.links.map(s=>e.jsx("li",{children:e.jsx(R,{to:E(c,[{entity_type:s.entity_type,slug:s.key}]),className:"flex items-center justify-between rounded-lg border px-3 py-2 text-sm hover:bg-muted/50",children:e.jsxs("span",{children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.relationship_type.replaceAll("_"," "),s.direction==="incoming"?" (from)":""," ·"," ",s.entity_type," ·"," "]}),s.name]})})},`${s.relationship_type}:${s.direction}:${s.entity_type}:${s.key}`))}),n&&!o&&t.failures.length===0&&e.jsx(j,{variant:"outline",size:"sm",disabled:a,onClick:()=>void g(),children:a?"Loading…":"Load more"})]}):e.jsx(f,{failures:[],isError:!0,isFetching:a,onRetry:()=>void x()})}export{A as S,w as a};
2
- //# sourceMappingURL=source-record-panels-CRIPMWfN.js.map
1
+ import{k as y,cc as b,e6 as _,j as e,B as j,e7 as v,S as L,bw as C,L as R,dk as E,o as S}from"./index-Cr5hwh-C.js";import{a as F,b as P}from"./events-feed-BtvhZF1f.js";function f({failures:i,onRetry:c,isError:d=!1,isFetching:l=!1}){return i.length===0&&!d?null:e.jsxs("div",{role:"alert",className:"flex items-center justify-between gap-3 rounded-md border border-destructive/40 px-3 py-2 text-xs",children:[e.jsxs("span",{children:[i.length<=1?"A source":`${i.length} sources`," could not be read, so some items may be missing."]}),e.jsx(j,{size:"sm",variant:"outline",className:"h-7",onClick:c,disabled:l,children:"Retry"})]})}function A({record:i,orgContext:c,filters:d}){const{orgContext:l}=y(),t=c??l,{data:p}=b({queryKey:["connector-definitions","source-record",t.organizationId,t.slug],queryFn:()=>S(t),enabled:!!(t.organizationId||t.slug),staleTime:6e4}),{data:o,isLoading:x,isError:n,refetch:g,fetchNextPage:a,hasNextPage:h,isFetching:u,isFetchingNextPage:s}=_(i,t,d),N=o?.pages.flatMap(r=>r.events)??[],m=o?.pages.flatMap(r=>r.failures)??[];return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(f,{failures:m,isError:n,isFetching:u,onRetry:()=>void g()}),e.jsx(F,{isLoading:x,hasNextPage:!!h&&!n,autoLoadMore:m.length===0,isFetching:u,isFetchingNextPage:s,onLoadMore:()=>void a(),emptyState:n||m.length>0||h?null:e.jsx("p",{className:"text-xs text-muted-foreground",children:"No activity for this record in its connected sources."}),items:N.map(r=>({key:`${r.feed_id}:${r.origin_id}`,occurredAt:r.occurred_at,content:e.jsx("div",{className:"p-3",children:e.jsx(P,{ownerSlug:t.slug,connectorDefinitions:p,content:{...r,title:r.title||r.origin_type||r.origin_id,text_content:r.payload_text??""}})})}))})]})}function w({record:i,ownerSlug:c,orgContext:d}){const{orgContext:l}=y(),{data:t,isLoading:p,isError:o,refetch:x,hasNextPage:n,fetchNextPage:g,isFetching:a,isFetchNextPageError:h,error:u}=v(i,d??l);return p?e.jsx(L,{className:"h-12 w-full rounded-lg"}):t?e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{failures:t.failures,isError:o,isFetching:a,onRetry:()=>{if(a)return;const s=u instanceof C&&u.status===400;h&&!s||!o&&n?g():x()}}),t.links.length===0&&t.failures.length===0&&!n&&!o&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"No relationships for this record in its connected sources."}),t.links.length===0&&n&&!o&&t.failures.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"More source records remain to check for relationships."}),e.jsx("ul",{className:"space-y-1",children:t.links.map(s=>e.jsx("li",{children:e.jsx(R,{to:E(c,[{entity_type:s.entity_type,slug:s.key}]),className:"flex items-center justify-between rounded-lg border px-3 py-2 text-sm hover:bg-muted/50",children:e.jsxs("span",{children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.relationship_type.replaceAll("_"," "),s.direction==="incoming"?" (from)":""," ·"," ",s.entity_type," ·"," "]}),s.name]})})},`${s.relationship_type}:${s.direction}:${s.entity_type}:${s.key}`))}),n&&!o&&t.failures.length===0&&e.jsx(j,{variant:"outline",size:"sm",disabled:a,onClick:()=>void g(),children:a?"Loading…":"Load more"})]}):e.jsx(f,{failures:[],isError:!0,isFetching:a,onRetry:()=>void x()})}export{A as S,w as a};
2
+ //# sourceMappingURL=source-record-panels-CPyzlfD1.js.map
@@ -1,2 +1,2 @@
1
- import{j as t,P as s}from"./index-_oPeVpL_.js";const e={amber:"bg-amber-500",muted:"bg-muted-foreground/40",destructive:"bg-destructive"};function n({tone:r}){return t.jsx("span",{"aria-hidden":r===null,className:s("h-1.5 w-1.5 shrink-0 rounded-full",r===null?"bg-transparent":e[r])})}export{n as S};
2
- //# sourceMappingURL=status-dot-C5KDvvm9.js.map
1
+ import{j as t,P as s}from"./index-Cr5hwh-C.js";const e={amber:"bg-amber-500",muted:"bg-muted-foreground/40",destructive:"bg-destructive"};function n({tone:r}){return t.jsx("span",{"aria-hidden":r===null,className:s("h-1.5 w-1.5 shrink-0 rounded-full",r===null?"bg-transparent":e[r])})}export{n as S};
2
+ //# sourceMappingURL=status-dot-B-EWMgq6.js.map
@@ -1,2 +1,2 @@
1
- import{r as j,j as t,f6 as R,dN as we,Q as Te,y as G,bn as Se,bo as $e,bp as Ie,bq as Oe,br as Ae,f7 as Ee,f8 as _,f9 as W,fa as Le,fb as V,fc as Re,B as O,a_ as K,cy as ee,dZ as Ce,d_ as _e,d$ as z,e0 as te,e3 as Pe,e4 as B,I as J,cq as Fe,fd as ke,fe as De,ck as se,ff as Me,dd as Ve,P as $,fg as ze,bc as Be,dz as qe,dA as Ue,M as Ge,bz as He,dB as Je,d5 as Qe,d7 as Ye,fh as Ze,d6 as Xe,de as We,dc as F,cx as Ke,fi as et,fj as tt,fk as st,fl as rt,fm as at,fn as q,fo as it,fp as oe,fq as nt}from"./index-_oPeVpL_.js";var ot="Separator",re="horizontal",lt=["horizontal","vertical"],le=j.forwardRef((s,r)=>{const{decorative:e,orientation:a=re,...i}=s,d=dt(a)?a:re,f=e?{role:"none"}:{"aria-orientation":d==="vertical"?d:void 0,role:"separator"};return t.jsx(R.div,{"data-orientation":d,...f,...i,ref:r})});le.displayName=ot;function dt(s){return lt.includes(s)}var de=le;function L(s){return String(s??"").split(/[_-]/).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}function ct(s){return s.replace(/[^a-zA-Z0-9_-]/g,"-")}const mt=/^\d{4}-\d{2}-\d{2}$/;function Q(s){if(mt.test(s)){const[r,e,a]=s.split("-").map(Number),i=new Date(0);return i.setHours(0,0,0,0),i.setFullYear(r,e-1,a),i}return new Date(s)}function ut(s,r=!1){if(!s)return r?"Pick a date and time":"Pick a date";const e=Q(s);return Number.isNaN(e.getTime())?s:r?e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):F(e,"LLL dd, y")}function U(s){if(!s)return"";const r=Q(s);if(Number.isNaN(r.getTime()))return"";const e=r.getTimezoneOffset()*6e4;return new Date(r.getTime()-e).toISOString().slice(0,16)}function ae(s){if(!s)return;const r=new Date(s);if(!Number.isNaN(r.getTime()))return r.toISOString()}function P(s,r){const e=r==="slug"?s.slug:s.metadata?.[r];return e==null?"":String(e)}function ft({control:s}){const r=[s.set_by,s.set_at?Be(s.set_at):null].filter(Boolean).join(" · ");return t.jsxs(qe,{children:[t.jsx(Ue,{asChild:!0,children:t.jsxs(Ge,{variant:"outline",className:"gap-1 border-emerald-500/30 bg-emerald-500/10 text-[10px] uppercase tracking-wide text-emerald-600 dark:text-emerald-400",children:[t.jsx(He,{className:"h-3 w-3"}),"You"]})}),t.jsxs(Je,{className:"max-w-xs space-y-1",children:[t.jsx("div",{className:"text-xs font-medium",children:"Human-owned field"}),s.note?t.jsx("div",{className:"text-xs text-primary-foreground/90",children:s.note}):null,r?t.jsx("div",{className:"text-[11px] text-primary-foreground/70",children:r}):null]})]})}function ie({id:s,value:r,onChange:e,readonly:a,ariaLabel:i,includeTime:d=!1}){const c=r?Q(r):void 0,[f,m]=j.useState(()=>U(r).slice(11));return j.useEffect(()=>{m(U(r).slice(11))},[r]),t.jsx("div",{className:"relative",children:t.jsxs(Qe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsxs(O,{id:s,"aria-label":i,type:"button",variant:"outline",disabled:a,className:$("w-full justify-start rounded-md bg-muted px-3 text-left font-normal",!r&&"text-muted-foreground"),children:[t.jsx(Ze,{className:"mr-2 h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate",children:ut(r,d)})]})}),t.jsxs(Xe,{className:"w-auto space-y-3 p-0",align:"start",children:[t.jsx(We,{mode:"single",selected:c,defaultMonth:c,onSelect:b=>{if(!b)return;if(!d){e(F(b,"yyyy-MM-dd"));return}const n=f||"00:00";e(ae(`${F(b,"yyyy-MM-dd")}T${n}`))},initialFocus:!0}),d?t.jsxs("div",{className:"border-t p-3 pt-0",children:[t.jsx(G,{htmlFor:`${s}-time`,className:"text-xs text-muted-foreground",children:"Time"}),t.jsx(J,{id:`${s}-time`,type:"time",value:f,onChange:b=>{m(b.target.value);const n=r?U(r).slice(0,10):c?F(c,"yyyy-MM-dd"):"";n&&e(ae(`${n}T${b.target.value}`))},disabled:a})]}):null]})]})})}function bt({id:s,value:r,onChange:e,readonly:a,ariaLabel:i,entityType:d,lookupField:c,numeric:f=!1,orgContext:m}){const b=x=>{if(x===void 0||x==="")return e(void 0);if(!f)return e(x);const T=Number(x);e(Number.isFinite(T)?T:x)},{data:n}=Fe(d,m,{limit:ke}),o=(n?.entities??[]).filter(x=>P(x,c)!==""),l=r==null?"":String(r),I=o.find(x=>P(x,c)===l);return m?a?t.jsx("div",{className:"flex h-9 items-center rounded-md border border-input bg-muted px-3 text-sm",children:I?.name||l||"-"}):t.jsx(De,{contentClassName:"w-[320px]",searchPlaceholder:`Search ${L(d).toLowerCase()}...`,emptyText:`No ${d} found.`,trigger:x=>t.jsxs(O,{id:s,"aria-label":i,type:"button",variant:"outline",role:"combobox","aria-expanded":x,className:"w-full justify-between",children:[t.jsx("span",{className:$("truncate",!l&&"text-muted-foreground"),children:I?.name||l||`Select ${L(d).toLowerCase()}`}),t.jsx(ze,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:(x,T)=>{const S=T.trim(),y=S.length>0&&!o.some(p=>P(p,c)===S);return t.jsxs(t.Fragment,{children:[y?t.jsxs(se,{value:`use ${S}`,onSelect:()=>{b(S),x()},children:[t.jsx(Me,{className:"mr-2 h-3.5 w-3.5 opacity-60"}),t.jsxs("span",{className:"truncate",children:["Use ",t.jsx("span",{className:"font-medium",children:S})]})]}):null,o.map(p=>{const u=P(p,c),g=u===l;return t.jsxs(se,{value:`${p.name} ${p.slug} ${p.entity_type} ${u}`,onSelect:()=>{b(u||void 0),x()},children:[t.jsx(Ve,{className:$("mr-2 h-4 w-4",g?"opacity-100":"opacity-0")}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"truncate",children:p.name}),t.jsx("div",{className:"text-xs text-muted-foreground",children:p.slug})]})]},`${p.id}-${u}`)})]})}}):t.jsx(J,{id:s,"aria-label":i,type:f?"number":"text",value:l,onChange:x=>b(x.target.value||void 0),disabled:a})}function H({fieldPath:s,fieldKey:r,prop:e,value:a,onChange:i,isRequired:d,readonly:c,control:f,compact:m=!1,orgContext:b}){const n=e.description||L(r),o=ct(s),l=c||e.readOnly===!0,I=!m&&f?t.jsx(ft,{control:f}):null,x=e.type==="object"||!!e.properties,T=e.type==="array"&&!!e.items&&(e.items?.type==="object"||!!e.items?.properties),S=e.type==="array"&&!!e.items&&(e.items?.type==="string"||e.items?.type==="number"||e.items?.type==="integer"||e.items?.type==="boolean");if(e.type==="boolean")return t.jsxs("div",{className:m?"flex items-center":"flex items-center space-x-2 py-1",children:[t.jsx(Te,{id:o,"aria-label":m?n:void 0,checked:a??!1,onCheckedChange:u=>i(u),disabled:l}),m?null:t.jsxs(G,{htmlFor:o,className:"flex items-center gap-1.5 font-normal",children:[n,I]})]});let y;if(e.enum&&Array.isArray(e.enum))y=t.jsxs(Se,{value:a==null?"":String(a),onValueChange:u=>i(u===""?void 0:e.type==="number"||e.type==="integer"?Number(u):u),disabled:l,children:[t.jsx($e,{id:o,"aria-label":m?n:void 0,children:t.jsx(Ie,{placeholder:`Select ${n.toLowerCase()}`})}),t.jsx(Oe,{children:e.enum.map(u=>{const g=String(u);return t.jsx(Ae,{value:g,children:L(g)},g)})})]});else if(e["x-link-entity-type"])y=t.jsx(bt,{id:o,value:a,onChange:i,readonly:l,ariaLabel:m?n:void 0,entityType:e["x-link-entity-type"],lookupField:e["x-link-lookup-field"]||"slug",numeric:e.type==="number"||e.type==="integer",orgContext:b});else if(e.type==="number"||e.type==="integer")y=t.jsx(Ee,{id:o,ariaLabel:m?n:void 0,value:a,onChange:i,integer:e.type==="integer",placeholder:`Enter ${n.toLowerCase()}`,readOnly:l});else if(x){const u=Object.entries(e.properties??{}),g=new Set(e.required??[]),A=_(a)?a:{};y=u.length===0||!_(a)&&a!==void 0&&a!==null?t.jsx(W,{id:o,value:a,ariaLabel:`${n} JSON object`,readOnly:l,onChange:i}):t.jsx("fieldset",{"aria-label":m?n:void 0,"aria-labelledby":m?void 0:`${o}-label`,className:"space-y-3 rounded-md border p-3",children:u.map(([w,C])=>t.jsx(H,{fieldPath:`${s}.${w}`,fieldKey:w,prop:C,value:A[w],onChange:v=>{const h={...A};v===void 0?delete h[w]:h[w]=v,i(h)},isRequired:g.has(w),readonly:l,orgContext:b},w))})}else if(S)y=a!=null&&!Le(a)?t.jsx(V,{id:o,value:a,ariaLabel:`${n} JSON array`,readOnly:l,itemType:e.items?.type,itemEnum:e.items?.enum,minItems:e.minItems,maxItems:e.maxItems,onChange:i}):t.jsx(Re,{id:o,value:a,itemType:e.items?.type,itemEnum:e.items?.enum,minItems:e.minItems,maxItems:e.maxItems,ariaLabel:m?n:void 0,readOnly:l,showHelp:!m,onChange:i});else if(T&&e.items){const u=Array.isArray(a)?a:[],g=Object.entries(e.items.properties??{}),A=new Set(e.items.required??[]),w=e.maxItems===void 0||u.length<e.maxItems,C=e.minItems===void 0||u.length>e.minItems;y=!Array.isArray(a)&&a!==void 0&&a!==null||g.length>0&&u.some(v=>!_(v))?t.jsx(V,{id:o,value:a,ariaLabel:`${n} JSON array`,readOnly:l,itemType:"object",minItems:e.minItems,maxItems:e.maxItems,onChange:i}):g.length===0?t.jsxs("fieldset",{"aria-label":m?n:void 0,"aria-labelledby":m?void 0:`${o}-label`,className:"space-y-3",children:[u.length===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No rows"}):u.map((v,h)=>t.jsxs("fieldset",{className:"space-y-2 rounded-md border p-3",children:[t.jsxs("legend",{className:"px-1 text-xs font-medium text-muted-foreground",children:["Row ",h+1]}),t.jsx(W,{id:`${o}-${h}-json`,value:v,ariaLabel:`${n} row ${h+1} JSON object`,readOnly:l,onChange:E=>{const N=[...u];N[h]=E,i(N)}}),l?null:t.jsxs(O,{type:"button",variant:"ghost",size:"sm","aria-label":`Remove row ${h+1}`,disabled:!C,onClick:()=>i(u.filter((E,N)=>N!==h)),children:[t.jsx(K,{className:"mr-1.5 h-4 w-4"}),"Remove row"]})]},`${s}.${h}`)),l?null:t.jsxs(O,{type:"button",variant:"outline",size:"sm",disabled:!w,onClick:()=>i([...u,{}]),children:[t.jsx(ee,{className:"mr-1.5 h-4 w-4"}),"Add row"]})]}):t.jsxs("fieldset",{"aria-label":m?n:void 0,"aria-labelledby":m?void 0:`${o}-label`,className:"space-y-3",children:[t.jsx("div",{className:"rounded-md border",children:t.jsxs(Ce,{children:[t.jsx(_e,{children:t.jsxs(z,{children:[g.map(([v,h])=>t.jsxs(te,{children:[h.description||L(v),A.has(v)?t.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]},v)),l?null:t.jsx(te,{className:"w-12"})]})}),t.jsx(Pe,{children:u.length===0?t.jsx(z,{children:t.jsx(B,{colSpan:g.length+(l?0:1),className:"text-sm text-muted-foreground",children:"No rows"})}):u.map((v,h)=>{const E=_(v)?v:{};return t.jsxs(z,{children:[g.map(([N,D])=>t.jsx(B,{className:"align-top",children:t.jsx(H,{fieldPath:`${s}.${h}.${N}`,fieldKey:N,prop:D,value:E[N],onChange:Z=>{const X=[...u],M={...E};Z===void 0?delete M[N]:M[N]=Z,X[h]=M,i(X)},isRequired:A.has(N),readonly:l,compact:!0,orgContext:b})},N)),l?null:t.jsx(B,{className:"align-top",children:t.jsx(O,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove row ${h+1}`,disabled:!C,onClick:()=>i(u.filter((N,D)=>D!==h)),children:t.jsx(K,{className:"h-4 w-4"})})})]},`${s}.${h}`)})})]})}),l?null:t.jsxs(O,{type:"button",variant:"outline",size:"sm",disabled:!w,onClick:()=>i([...u,{}]),children:[t.jsx(ee,{className:"mr-1.5 h-4 w-4"}),"Add row"]})]})}else if(e.type==="array")y=t.jsx(V,{id:o,value:a,ariaLabel:`${n} JSON array`,readOnly:l,itemType:e.items?.type,itemEnum:e.items?.enum,minItems:e.minItems,maxItems:e.maxItems,onChange:i});else if(e.format==="date")y=t.jsx(ie,{id:o,value:typeof a=="string"?a:void 0,onChange:i,readonly:l,ariaLabel:m?n:void 0});else if(e.format==="date-time")y=t.jsx(ie,{id:o,value:typeof a=="string"?a:void 0,onChange:i,readonly:l,ariaLabel:m?n:void 0,includeTime:!0});else{const u=e.format==="uri"||e.format==="url";y=t.jsx(J,{id:o,"aria-label":m?n:void 0,type:u?"url":"text",value:a??"",onChange:g=>i(g.target.value||void 0),placeholder:u?"https://example.com":`Enter ${n.toLowerCase()}`,disabled:l})}if(m)return y;const p=x||T;return t.jsxs("div",{className:"space-y-1.5",children:[p?t.jsxs("p",{id:`${o}-label`,className:"flex items-center gap-1.5 text-sm font-medium",children:[t.jsxs("span",{children:[n,d?t.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]}),I]}):t.jsxs(G,{htmlFor:o,className:"flex items-center gap-1.5",children:[t.jsxs("span",{children:[n,d?t.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]}),I]}),y]})}function It(s){const r={};for(const[e,a]of Object.entries(s)){const i=we(a);i==null||i===""||(r[e]=i)}return r}function Ot({schema:s,values:r,onValuesChange:e,readonly:a=!1,fieldControls:i,orgContext:d}){const c=s,f=c?.properties,m=new Set(c?.required??[]),b=(n,o)=>{e({...r,[n]:o})};return!f||Object.keys(f).length===0?t.jsx("p",{className:"text-sm text-muted-foreground py-2",children:"No additional fields required for this entity type."}):t.jsx("div",{className:"space-y-4",children:Object.entries(f).map(([n,o])=>"x-measure"in o||"x-dimension"in o?null:t.jsx(H,{fieldPath:n,fieldKey:n,prop:o,value:r[n],onChange:l=>b(n,l),isRequired:m.has(n),readonly:a,control:i?.[n],orgContext:d},n))})}const xt=j.forwardRef(({className:s,orientation:r="horizontal",decorative:e=!0,...a},i)=>t.jsx(de,{ref:i,decorative:e,orientation:r,className:$("shrink-0 bg-border",r==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...a}));xt.displayName=de.displayName;function ne(s,r){const e=s?.properties;if(e)return Object.entries(e).find(([,a])=>a[r])?.[0]}function ht(s){const r=s.trim(),e=r.split(/[\s._@/-]+/).filter(Boolean),a=e.length>=2?`${e[0][0]}${e[1][0]}`:(e[0]??r).slice(0,2);let i=0;for(let d=0;d<r.length;d++)i=i*31+r.charCodeAt(d)>>>0;return{initials:a.toUpperCase()||"?",hue:i%360}}function jt(s){const[r,e]=j.useState();return j.useEffect(()=>{if(!s){e(void 0);return}let a=!1;const i=s.trim().toLowerCase();return crypto.subtle.digest("SHA-256",new TextEncoder().encode(i)).then(d=>{a||e(Array.from(new Uint8Array(d)).map(c=>c.toString(16).padStart(2,"0")).join(""))}),()=>{a=!0}},[s]),r?`https://www.gravatar.com/avatar/${r}?d=identicon&s=80`:void 0}function At({metadata:s,metadataSchema:r,name:e,typeIcon:a,className:i="h-6 w-6",iconClassName:d="h-5 w-5",initialsFallback:c=!1}){const f=ne(r,"x-image"),m=ne(r,"x-email"),b=f&&s?.[f]||void 0,n=m&&s?.[m]||void 0,o=jt(b?void 0:n),l=b||o,[I,x]=j.useState(!1);if(j.useEffect(()=>{x(!1)},[l]),l&&!I)return t.jsx("img",{src:l,alt:e,referrerPolicy:"no-referrer",onError:()=>x(!0),className:$("rounded-full object-cover border border-border",i)});if(c){const T=e.trim()||n||yt(s,r)||e,{initials:S,hue:y}=ht(T);return t.jsx("span",{role:"img","aria-label":e,className:$("inline-grid place-items-center rounded-full border border-border font-semibold text-white select-none",i),style:{background:`oklch(0.55 0.13 ${y})`,fontSize:"0.85em"},children:S})}return t.jsx(Ke,{icon:a,className:d})}function yt(s,r){if(!s)return;const e=r?.properties,a=["email","handle","username","login","github","x_handle","slug"],i=Object.keys(e||s);for(const d of i)if(a.includes(d.toLowerCase())){const c=s[d];if(typeof c=="string"&&c.trim())return c}}function gt(s,r){if(typeof s!="string"||!r||r.length===0)return s;const e=s.trim();if(r.includes(e))return e;try{const a=JSON.parse(e);if(typeof a=="string"&&r.includes(a))return a}catch{}return s}function Et(s,r){if(!s)return{};const e=r?.properties;return e?Object.fromEntries(Object.entries(s).map(([a,i])=>[a,gt(i,e[a]?.enum)])):{...s}}var k="Tabs",[vt]=it(k,[oe]),ce=oe(),[Nt,Y]=vt(k),me=j.forwardRef((s,r)=>{const{__scopeTabs:e,value:a,onValueChange:i,defaultValue:d,orientation:c="horizontal",dir:f,activationMode:m="automatic",...b}=s,n=et(f),[o,l]=tt({prop:a,onChange:i,defaultProp:d??"",caller:k});return t.jsx(Nt,{scope:e,baseId:st(),value:o,onValueChange:l,orientation:c,dir:n,activationMode:m,children:t.jsx(R.div,{dir:n,"data-orientation":c,...b,ref:r})})});me.displayName=k;var ue="TabsList",fe=j.forwardRef((s,r)=>{const{__scopeTabs:e,loop:a=!0,...i}=s,d=Y(ue,e),c=ce(e);return t.jsx(rt,{asChild:!0,...c,orientation:d.orientation,dir:d.dir,loop:a,children:t.jsx(R.div,{role:"tablist","aria-orientation":d.orientation,...i,ref:r})})});fe.displayName=ue;var be="TabsTrigger",xe=j.forwardRef((s,r)=>{const{__scopeTabs:e,value:a,disabled:i=!1,...d}=s,c=Y(be,e),f=ce(e),m=ye(c.baseId,a),b=ge(c.baseId,a),n=a===c.value;return t.jsx(at,{asChild:!0,...f,focusable:!i,active:n,children:t.jsx(R.button,{type:"button",role:"tab","aria-selected":n,"aria-controls":b,"data-state":n?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:m,...d,ref:r,onMouseDown:q(s.onMouseDown,o=>{!i&&o.button===0&&o.ctrlKey===!1?c.onValueChange(a):o.preventDefault()}),onKeyDown:q(s.onKeyDown,o=>{[" ","Enter"].includes(o.key)&&c.onValueChange(a)}),onFocus:q(s.onFocus,()=>{const o=c.activationMode!=="manual";!n&&!i&&o&&c.onValueChange(a)})})})});xe.displayName=be;var he="TabsContent",je=j.forwardRef((s,r)=>{const{__scopeTabs:e,value:a,forceMount:i,children:d,...c}=s,f=Y(he,e),m=ye(f.baseId,a),b=ge(f.baseId,a),n=a===f.value,o=j.useRef(n);return j.useEffect(()=>{const l=requestAnimationFrame(()=>o.current=!1);return()=>cancelAnimationFrame(l)},[]),t.jsx(nt,{present:i||n,children:({present:l})=>t.jsx(R.div,{"data-state":n?"active":"inactive","data-orientation":f.orientation,role:"tabpanel","aria-labelledby":m,hidden:!l,id:b,tabIndex:0,...c,ref:r,style:{...s.style,animationDuration:o.current?"0s":void 0},children:l&&d})})});je.displayName=he;function ye(s,r){return`${s}-trigger-${r}`}function ge(s,r){return`${s}-content-${r}`}var pt=me,ve=fe,Ne=xe,pe=je;const Lt=pt,wt=j.forwardRef(({className:s,...r},e)=>t.jsx(ve,{ref:e,className:$("inline-flex h-9 items-center justify-start gap-1 border-b border-border bg-transparent p-0",s),...r}));wt.displayName=ve.displayName;const Tt=j.forwardRef(({className:s,...r},e)=>t.jsx(Ne,{ref:e,className:$("inline-flex items-center justify-center whitespace-nowrap px-3 pb-2 pt-1 text-sm font-medium text-muted-foreground transition-all","border-b-2 border-transparent","hover:text-foreground","data-[state=active]:border-foreground data-[state=active]:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50",s),...r}));Tt.displayName=Ne.displayName;const St=j.forwardRef(({className:s,...r},e)=>t.jsx(pe,{ref:e,className:$("mt-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",s),...r}));St.displayName=pe.displayName;export{Ot as D,At as E,xt as S,Lt as T,wt as a,Tt as b,It as c,St as d,Et as e,gt as n};
2
- //# sourceMappingURL=tabs-B4Er9hJj.js.map
1
+ import{r as j,j as t,f6 as R,dN as we,Q as Te,y as G,bn as Se,bo as $e,bp as Ie,bq as Oe,br as Ae,f7 as Ee,f8 as _,f9 as W,fa as Le,fb as V,fc as Re,B as O,a_ as K,cy as ee,dZ as Ce,d_ as _e,d$ as z,e0 as te,e3 as Pe,e4 as B,I as J,cq as Fe,fd as ke,fe as De,ck as se,ff as Me,dd as Ve,P as $,fg as ze,bc as Be,dz as qe,dA as Ue,M as Ge,bz as He,dB as Je,d5 as Qe,d7 as Ye,fh as Ze,d6 as Xe,de as We,dc as F,cx as Ke,fi as et,fj as tt,fk as st,fl as rt,fm as at,fn as q,fo as it,fp as oe,fq as nt}from"./index-Cr5hwh-C.js";var ot="Separator",re="horizontal",lt=["horizontal","vertical"],le=j.forwardRef((s,r)=>{const{decorative:e,orientation:a=re,...i}=s,d=dt(a)?a:re,f=e?{role:"none"}:{"aria-orientation":d==="vertical"?d:void 0,role:"separator"};return t.jsx(R.div,{"data-orientation":d,...f,...i,ref:r})});le.displayName=ot;function dt(s){return lt.includes(s)}var de=le;function L(s){return String(s??"").split(/[_-]/).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}function ct(s){return s.replace(/[^a-zA-Z0-9_-]/g,"-")}const mt=/^\d{4}-\d{2}-\d{2}$/;function Q(s){if(mt.test(s)){const[r,e,a]=s.split("-").map(Number),i=new Date(0);return i.setHours(0,0,0,0),i.setFullYear(r,e-1,a),i}return new Date(s)}function ut(s,r=!1){if(!s)return r?"Pick a date and time":"Pick a date";const e=Q(s);return Number.isNaN(e.getTime())?s:r?e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):F(e,"LLL dd, y")}function U(s){if(!s)return"";const r=Q(s);if(Number.isNaN(r.getTime()))return"";const e=r.getTimezoneOffset()*6e4;return new Date(r.getTime()-e).toISOString().slice(0,16)}function ae(s){if(!s)return;const r=new Date(s);if(!Number.isNaN(r.getTime()))return r.toISOString()}function P(s,r){const e=r==="slug"?s.slug:s.metadata?.[r];return e==null?"":String(e)}function ft({control:s}){const r=[s.set_by,s.set_at?Be(s.set_at):null].filter(Boolean).join(" · ");return t.jsxs(qe,{children:[t.jsx(Ue,{asChild:!0,children:t.jsxs(Ge,{variant:"outline",className:"gap-1 border-emerald-500/30 bg-emerald-500/10 text-[10px] uppercase tracking-wide text-emerald-600 dark:text-emerald-400",children:[t.jsx(He,{className:"h-3 w-3"}),"You"]})}),t.jsxs(Je,{className:"max-w-xs space-y-1",children:[t.jsx("div",{className:"text-xs font-medium",children:"Human-owned field"}),s.note?t.jsx("div",{className:"text-xs text-primary-foreground/90",children:s.note}):null,r?t.jsx("div",{className:"text-[11px] text-primary-foreground/70",children:r}):null]})]})}function ie({id:s,value:r,onChange:e,readonly:a,ariaLabel:i,includeTime:d=!1}){const c=r?Q(r):void 0,[f,m]=j.useState(()=>U(r).slice(11));return j.useEffect(()=>{m(U(r).slice(11))},[r]),t.jsx("div",{className:"relative",children:t.jsxs(Qe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsxs(O,{id:s,"aria-label":i,type:"button",variant:"outline",disabled:a,className:$("w-full justify-start rounded-md bg-muted px-3 text-left font-normal",!r&&"text-muted-foreground"),children:[t.jsx(Ze,{className:"mr-2 h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate",children:ut(r,d)})]})}),t.jsxs(Xe,{className:"w-auto space-y-3 p-0",align:"start",children:[t.jsx(We,{mode:"single",selected:c,defaultMonth:c,onSelect:b=>{if(!b)return;if(!d){e(F(b,"yyyy-MM-dd"));return}const n=f||"00:00";e(ae(`${F(b,"yyyy-MM-dd")}T${n}`))},initialFocus:!0}),d?t.jsxs("div",{className:"border-t p-3 pt-0",children:[t.jsx(G,{htmlFor:`${s}-time`,className:"text-xs text-muted-foreground",children:"Time"}),t.jsx(J,{id:`${s}-time`,type:"time",value:f,onChange:b=>{m(b.target.value);const n=r?U(r).slice(0,10):c?F(c,"yyyy-MM-dd"):"";n&&e(ae(`${n}T${b.target.value}`))},disabled:a})]}):null]})]})})}function bt({id:s,value:r,onChange:e,readonly:a,ariaLabel:i,entityType:d,lookupField:c,numeric:f=!1,orgContext:m}){const b=x=>{if(x===void 0||x==="")return e(void 0);if(!f)return e(x);const T=Number(x);e(Number.isFinite(T)?T:x)},{data:n}=Fe(d,m,{limit:ke}),o=(n?.entities??[]).filter(x=>P(x,c)!==""),l=r==null?"":String(r),I=o.find(x=>P(x,c)===l);return m?a?t.jsx("div",{className:"flex h-9 items-center rounded-md border border-input bg-muted px-3 text-sm",children:I?.name||l||"-"}):t.jsx(De,{contentClassName:"w-[320px]",searchPlaceholder:`Search ${L(d).toLowerCase()}...`,emptyText:`No ${d} found.`,trigger:x=>t.jsxs(O,{id:s,"aria-label":i,type:"button",variant:"outline",role:"combobox","aria-expanded":x,className:"w-full justify-between",children:[t.jsx("span",{className:$("truncate",!l&&"text-muted-foreground"),children:I?.name||l||`Select ${L(d).toLowerCase()}`}),t.jsx(ze,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:(x,T)=>{const S=T.trim(),y=S.length>0&&!o.some(p=>P(p,c)===S);return t.jsxs(t.Fragment,{children:[y?t.jsxs(se,{value:`use ${S}`,onSelect:()=>{b(S),x()},children:[t.jsx(Me,{className:"mr-2 h-3.5 w-3.5 opacity-60"}),t.jsxs("span",{className:"truncate",children:["Use ",t.jsx("span",{className:"font-medium",children:S})]})]}):null,o.map(p=>{const u=P(p,c),g=u===l;return t.jsxs(se,{value:`${p.name} ${p.slug} ${p.entity_type} ${u}`,onSelect:()=>{b(u||void 0),x()},children:[t.jsx(Ve,{className:$("mr-2 h-4 w-4",g?"opacity-100":"opacity-0")}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"truncate",children:p.name}),t.jsx("div",{className:"text-xs text-muted-foreground",children:p.slug})]})]},`${p.id}-${u}`)})]})}}):t.jsx(J,{id:s,"aria-label":i,type:f?"number":"text",value:l,onChange:x=>b(x.target.value||void 0),disabled:a})}function H({fieldPath:s,fieldKey:r,prop:e,value:a,onChange:i,isRequired:d,readonly:c,control:f,compact:m=!1,orgContext:b}){const n=e.description||L(r),o=ct(s),l=c||e.readOnly===!0,I=!m&&f?t.jsx(ft,{control:f}):null,x=e.type==="object"||!!e.properties,T=e.type==="array"&&!!e.items&&(e.items?.type==="object"||!!e.items?.properties),S=e.type==="array"&&!!e.items&&(e.items?.type==="string"||e.items?.type==="number"||e.items?.type==="integer"||e.items?.type==="boolean");if(e.type==="boolean")return t.jsxs("div",{className:m?"flex items-center":"flex items-center space-x-2 py-1",children:[t.jsx(Te,{id:o,"aria-label":m?n:void 0,checked:a??!1,onCheckedChange:u=>i(u),disabled:l}),m?null:t.jsxs(G,{htmlFor:o,className:"flex items-center gap-1.5 font-normal",children:[n,I]})]});let y;if(e.enum&&Array.isArray(e.enum))y=t.jsxs(Se,{value:a==null?"":String(a),onValueChange:u=>i(u===""?void 0:e.type==="number"||e.type==="integer"?Number(u):u),disabled:l,children:[t.jsx($e,{id:o,"aria-label":m?n:void 0,children:t.jsx(Ie,{placeholder:`Select ${n.toLowerCase()}`})}),t.jsx(Oe,{children:e.enum.map(u=>{const g=String(u);return t.jsx(Ae,{value:g,children:L(g)},g)})})]});else if(e["x-link-entity-type"])y=t.jsx(bt,{id:o,value:a,onChange:i,readonly:l,ariaLabel:m?n:void 0,entityType:e["x-link-entity-type"],lookupField:e["x-link-lookup-field"]||"slug",numeric:e.type==="number"||e.type==="integer",orgContext:b});else if(e.type==="number"||e.type==="integer")y=t.jsx(Ee,{id:o,ariaLabel:m?n:void 0,value:a,onChange:i,integer:e.type==="integer",placeholder:`Enter ${n.toLowerCase()}`,readOnly:l});else if(x){const u=Object.entries(e.properties??{}),g=new Set(e.required??[]),A=_(a)?a:{};y=u.length===0||!_(a)&&a!==void 0&&a!==null?t.jsx(W,{id:o,value:a,ariaLabel:`${n} JSON object`,readOnly:l,onChange:i}):t.jsx("fieldset",{"aria-label":m?n:void 0,"aria-labelledby":m?void 0:`${o}-label`,className:"space-y-3 rounded-md border p-3",children:u.map(([w,C])=>t.jsx(H,{fieldPath:`${s}.${w}`,fieldKey:w,prop:C,value:A[w],onChange:v=>{const h={...A};v===void 0?delete h[w]:h[w]=v,i(h)},isRequired:g.has(w),readonly:l,orgContext:b},w))})}else if(S)y=a!=null&&!Le(a)?t.jsx(V,{id:o,value:a,ariaLabel:`${n} JSON array`,readOnly:l,itemType:e.items?.type,itemEnum:e.items?.enum,minItems:e.minItems,maxItems:e.maxItems,onChange:i}):t.jsx(Re,{id:o,value:a,itemType:e.items?.type,itemEnum:e.items?.enum,minItems:e.minItems,maxItems:e.maxItems,ariaLabel:m?n:void 0,readOnly:l,showHelp:!m,onChange:i});else if(T&&e.items){const u=Array.isArray(a)?a:[],g=Object.entries(e.items.properties??{}),A=new Set(e.items.required??[]),w=e.maxItems===void 0||u.length<e.maxItems,C=e.minItems===void 0||u.length>e.minItems;y=!Array.isArray(a)&&a!==void 0&&a!==null||g.length>0&&u.some(v=>!_(v))?t.jsx(V,{id:o,value:a,ariaLabel:`${n} JSON array`,readOnly:l,itemType:"object",minItems:e.minItems,maxItems:e.maxItems,onChange:i}):g.length===0?t.jsxs("fieldset",{"aria-label":m?n:void 0,"aria-labelledby":m?void 0:`${o}-label`,className:"space-y-3",children:[u.length===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No rows"}):u.map((v,h)=>t.jsxs("fieldset",{className:"space-y-2 rounded-md border p-3",children:[t.jsxs("legend",{className:"px-1 text-xs font-medium text-muted-foreground",children:["Row ",h+1]}),t.jsx(W,{id:`${o}-${h}-json`,value:v,ariaLabel:`${n} row ${h+1} JSON object`,readOnly:l,onChange:E=>{const N=[...u];N[h]=E,i(N)}}),l?null:t.jsxs(O,{type:"button",variant:"ghost",size:"sm","aria-label":`Remove row ${h+1}`,disabled:!C,onClick:()=>i(u.filter((E,N)=>N!==h)),children:[t.jsx(K,{className:"mr-1.5 h-4 w-4"}),"Remove row"]})]},`${s}.${h}`)),l?null:t.jsxs(O,{type:"button",variant:"outline",size:"sm",disabled:!w,onClick:()=>i([...u,{}]),children:[t.jsx(ee,{className:"mr-1.5 h-4 w-4"}),"Add row"]})]}):t.jsxs("fieldset",{"aria-label":m?n:void 0,"aria-labelledby":m?void 0:`${o}-label`,className:"space-y-3",children:[t.jsx("div",{className:"rounded-md border",children:t.jsxs(Ce,{children:[t.jsx(_e,{children:t.jsxs(z,{children:[g.map(([v,h])=>t.jsxs(te,{children:[h.description||L(v),A.has(v)?t.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]},v)),l?null:t.jsx(te,{className:"w-12"})]})}),t.jsx(Pe,{children:u.length===0?t.jsx(z,{children:t.jsx(B,{colSpan:g.length+(l?0:1),className:"text-sm text-muted-foreground",children:"No rows"})}):u.map((v,h)=>{const E=_(v)?v:{};return t.jsxs(z,{children:[g.map(([N,D])=>t.jsx(B,{className:"align-top",children:t.jsx(H,{fieldPath:`${s}.${h}.${N}`,fieldKey:N,prop:D,value:E[N],onChange:Z=>{const X=[...u],M={...E};Z===void 0?delete M[N]:M[N]=Z,X[h]=M,i(X)},isRequired:A.has(N),readonly:l,compact:!0,orgContext:b})},N)),l?null:t.jsx(B,{className:"align-top",children:t.jsx(O,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove row ${h+1}`,disabled:!C,onClick:()=>i(u.filter((N,D)=>D!==h)),children:t.jsx(K,{className:"h-4 w-4"})})})]},`${s}.${h}`)})})]})}),l?null:t.jsxs(O,{type:"button",variant:"outline",size:"sm",disabled:!w,onClick:()=>i([...u,{}]),children:[t.jsx(ee,{className:"mr-1.5 h-4 w-4"}),"Add row"]})]})}else if(e.type==="array")y=t.jsx(V,{id:o,value:a,ariaLabel:`${n} JSON array`,readOnly:l,itemType:e.items?.type,itemEnum:e.items?.enum,minItems:e.minItems,maxItems:e.maxItems,onChange:i});else if(e.format==="date")y=t.jsx(ie,{id:o,value:typeof a=="string"?a:void 0,onChange:i,readonly:l,ariaLabel:m?n:void 0});else if(e.format==="date-time")y=t.jsx(ie,{id:o,value:typeof a=="string"?a:void 0,onChange:i,readonly:l,ariaLabel:m?n:void 0,includeTime:!0});else{const u=e.format==="uri"||e.format==="url";y=t.jsx(J,{id:o,"aria-label":m?n:void 0,type:u?"url":"text",value:a??"",onChange:g=>i(g.target.value||void 0),placeholder:u?"https://example.com":`Enter ${n.toLowerCase()}`,disabled:l})}if(m)return y;const p=x||T;return t.jsxs("div",{className:"space-y-1.5",children:[p?t.jsxs("p",{id:`${o}-label`,className:"flex items-center gap-1.5 text-sm font-medium",children:[t.jsxs("span",{children:[n,d?t.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]}),I]}):t.jsxs(G,{htmlFor:o,className:"flex items-center gap-1.5",children:[t.jsxs("span",{children:[n,d?t.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]}),I]}),y]})}function It(s){const r={};for(const[e,a]of Object.entries(s)){const i=we(a);i==null||i===""||(r[e]=i)}return r}function Ot({schema:s,values:r,onValuesChange:e,readonly:a=!1,fieldControls:i,orgContext:d}){const c=s,f=c?.properties,m=new Set(c?.required??[]),b=(n,o)=>{e({...r,[n]:o})};return!f||Object.keys(f).length===0?t.jsx("p",{className:"text-sm text-muted-foreground py-2",children:"No additional fields required for this entity type."}):t.jsx("div",{className:"space-y-4",children:Object.entries(f).map(([n,o])=>"x-measure"in o||"x-dimension"in o?null:t.jsx(H,{fieldPath:n,fieldKey:n,prop:o,value:r[n],onChange:l=>b(n,l),isRequired:m.has(n),readonly:a,control:i?.[n],orgContext:d},n))})}const xt=j.forwardRef(({className:s,orientation:r="horizontal",decorative:e=!0,...a},i)=>t.jsx(de,{ref:i,decorative:e,orientation:r,className:$("shrink-0 bg-border",r==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...a}));xt.displayName=de.displayName;function ne(s,r){const e=s?.properties;if(e)return Object.entries(e).find(([,a])=>a[r])?.[0]}function ht(s){const r=s.trim(),e=r.split(/[\s._@/-]+/).filter(Boolean),a=e.length>=2?`${e[0][0]}${e[1][0]}`:(e[0]??r).slice(0,2);let i=0;for(let d=0;d<r.length;d++)i=i*31+r.charCodeAt(d)>>>0;return{initials:a.toUpperCase()||"?",hue:i%360}}function jt(s){const[r,e]=j.useState();return j.useEffect(()=>{if(!s){e(void 0);return}let a=!1;const i=s.trim().toLowerCase();return crypto.subtle.digest("SHA-256",new TextEncoder().encode(i)).then(d=>{a||e(Array.from(new Uint8Array(d)).map(c=>c.toString(16).padStart(2,"0")).join(""))}),()=>{a=!0}},[s]),r?`https://www.gravatar.com/avatar/${r}?d=identicon&s=80`:void 0}function At({metadata:s,metadataSchema:r,name:e,typeIcon:a,className:i="h-6 w-6",iconClassName:d="h-5 w-5",initialsFallback:c=!1}){const f=ne(r,"x-image"),m=ne(r,"x-email"),b=f&&s?.[f]||void 0,n=m&&s?.[m]||void 0,o=jt(b?void 0:n),l=b||o,[I,x]=j.useState(!1);if(j.useEffect(()=>{x(!1)},[l]),l&&!I)return t.jsx("img",{src:l,alt:e,referrerPolicy:"no-referrer",onError:()=>x(!0),className:$("rounded-full object-cover border border-border",i)});if(c){const T=e.trim()||n||yt(s,r)||e,{initials:S,hue:y}=ht(T);return t.jsx("span",{role:"img","aria-label":e,className:$("inline-grid place-items-center rounded-full border border-border font-semibold text-white select-none",i),style:{background:`oklch(0.55 0.13 ${y})`,fontSize:"0.85em"},children:S})}return t.jsx(Ke,{icon:a,className:d})}function yt(s,r){if(!s)return;const e=r?.properties,a=["email","handle","username","login","github","x_handle","slug"],i=Object.keys(e||s);for(const d of i)if(a.includes(d.toLowerCase())){const c=s[d];if(typeof c=="string"&&c.trim())return c}}function gt(s,r){if(typeof s!="string"||!r||r.length===0)return s;const e=s.trim();if(r.includes(e))return e;try{const a=JSON.parse(e);if(typeof a=="string"&&r.includes(a))return a}catch{}return s}function Et(s,r){if(!s)return{};const e=r?.properties;return e?Object.fromEntries(Object.entries(s).map(([a,i])=>[a,gt(i,e[a]?.enum)])):{...s}}var k="Tabs",[vt]=it(k,[oe]),ce=oe(),[Nt,Y]=vt(k),me=j.forwardRef((s,r)=>{const{__scopeTabs:e,value:a,onValueChange:i,defaultValue:d,orientation:c="horizontal",dir:f,activationMode:m="automatic",...b}=s,n=et(f),[o,l]=tt({prop:a,onChange:i,defaultProp:d??"",caller:k});return t.jsx(Nt,{scope:e,baseId:st(),value:o,onValueChange:l,orientation:c,dir:n,activationMode:m,children:t.jsx(R.div,{dir:n,"data-orientation":c,...b,ref:r})})});me.displayName=k;var ue="TabsList",fe=j.forwardRef((s,r)=>{const{__scopeTabs:e,loop:a=!0,...i}=s,d=Y(ue,e),c=ce(e);return t.jsx(rt,{asChild:!0,...c,orientation:d.orientation,dir:d.dir,loop:a,children:t.jsx(R.div,{role:"tablist","aria-orientation":d.orientation,...i,ref:r})})});fe.displayName=ue;var be="TabsTrigger",xe=j.forwardRef((s,r)=>{const{__scopeTabs:e,value:a,disabled:i=!1,...d}=s,c=Y(be,e),f=ce(e),m=ye(c.baseId,a),b=ge(c.baseId,a),n=a===c.value;return t.jsx(at,{asChild:!0,...f,focusable:!i,active:n,children:t.jsx(R.button,{type:"button",role:"tab","aria-selected":n,"aria-controls":b,"data-state":n?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:m,...d,ref:r,onMouseDown:q(s.onMouseDown,o=>{!i&&o.button===0&&o.ctrlKey===!1?c.onValueChange(a):o.preventDefault()}),onKeyDown:q(s.onKeyDown,o=>{[" ","Enter"].includes(o.key)&&c.onValueChange(a)}),onFocus:q(s.onFocus,()=>{const o=c.activationMode!=="manual";!n&&!i&&o&&c.onValueChange(a)})})})});xe.displayName=be;var he="TabsContent",je=j.forwardRef((s,r)=>{const{__scopeTabs:e,value:a,forceMount:i,children:d,...c}=s,f=Y(he,e),m=ye(f.baseId,a),b=ge(f.baseId,a),n=a===f.value,o=j.useRef(n);return j.useEffect(()=>{const l=requestAnimationFrame(()=>o.current=!1);return()=>cancelAnimationFrame(l)},[]),t.jsx(nt,{present:i||n,children:({present:l})=>t.jsx(R.div,{"data-state":n?"active":"inactive","data-orientation":f.orientation,role:"tabpanel","aria-labelledby":m,hidden:!l,id:b,tabIndex:0,...c,ref:r,style:{...s.style,animationDuration:o.current?"0s":void 0},children:l&&d})})});je.displayName=he;function ye(s,r){return`${s}-trigger-${r}`}function ge(s,r){return`${s}-content-${r}`}var pt=me,ve=fe,Ne=xe,pe=je;const Lt=pt,wt=j.forwardRef(({className:s,...r},e)=>t.jsx(ve,{ref:e,className:$("inline-flex h-9 items-center justify-start gap-1 border-b border-border bg-transparent p-0",s),...r}));wt.displayName=ve.displayName;const Tt=j.forwardRef(({className:s,...r},e)=>t.jsx(Ne,{ref:e,className:$("inline-flex items-center justify-center whitespace-nowrap px-3 pb-2 pt-1 text-sm font-medium text-muted-foreground transition-all","border-b-2 border-transparent","hover:text-foreground","data-[state=active]:border-foreground data-[state=active]:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50",s),...r}));Tt.displayName=Ne.displayName;const St=j.forwardRef(({className:s,...r},e)=>t.jsx(pe,{ref:e,className:$("mt-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",s),...r}));St.displayName=pe.displayName;export{Ot as D,At as E,xt as S,Lt as T,wt as a,Tt as b,It as c,St as d,Et as e,gt as n};
2
+ //# sourceMappingURL=tabs-DqIIkCX-.js.map