@lobu/runtime-server 24.9.0 → 24.10.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.
- package/dist/catalogs/automations.json +2 -2
- package/dist/catalogs/connectors.json +16 -4
- package/dist/catalogs/skills.json +1 -1
- package/dist/component.json +1 -1
- package/dist/connectors/postgres.ts +39 -24
- package/dist/connectors/whatsapp-web-adapter.js +41 -10
- package/dist/connectors/whatsapp-web-helpers.ts +12 -2
- package/dist/connectors/whatsapp_web.ts +18 -2
- package/dist/db/migrations/20261112210000_instance_identity.sql +18 -0
- package/dist/dependencies.bun.lock +62 -60
- package/dist/embeddings-server.mjs +38 -5
- package/dist/owletto/dist/assets/_-CYvj1y65.js +3 -0
- package/dist/owletto/dist/assets/_-CeLTSYYY.js +2 -0
- package/dist/owletto/dist/assets/_agentId-BB5E-L6T.js +2 -0
- package/dist/owletto/dist/assets/{_agentId-bna2tPsW.js → _agentId-DN0EwMAC.js} +2 -2
- package/dist/owletto/dist/assets/_automationId-DvUl9CSd.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-CVKfL9AG.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-Cv6FzK1v.js +2 -0
- package/dist/owletto/dist/assets/{_conversationId-zcs-S3dY.js → _conversationId-CPpNySjO.js} +2 -2
- package/dist/owletto/dist/assets/_eventId-DZKicuq6.js +2 -0
- package/dist/owletto/dist/assets/_owner-Dauk3YuD.js +3 -0
- package/dist/owletto/dist/assets/_shape-cKrEID3T.js +2 -0
- package/dist/owletto/dist/assets/_slug-DJx_8fsV.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-CPVzVKEf.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-CW8gexOQ.js +2 -0
- package/dist/owletto/dist/assets/accept-invitation-Dwq1GAnG.js +2 -0
- package/dist/owletto/dist/assets/activity-route-location-C1jcXC7v.js +2 -0
- package/dist/owletto/dist/assets/activity-route-view-D78Wj0RH.js +2 -0
- package/dist/owletto/dist/assets/agent-connect-pages-DoI9UR0a.js +4 -0
- package/dist/owletto/dist/assets/{agent-editor-form-Bnc_q5WD.js → agent-editor-form-DlavYg2q.js} +2 -2
- package/dist/owletto/dist/assets/{agent-loading-shells-xteN-pyK.js → agent-loading-shells-DYqQphN7.js} +2 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-C1L8IcYR.js +2 -0
- package/dist/owletto/dist/assets/{agent-skill-context-r0O0BVOu.js → agent-skill-context-D1nMrVod.js} +2 -2
- package/dist/owletto/dist/assets/{agent-subpage-shell-C2KpYdu3.js → agent-subpage-shell-2w7vTeXw.js} +2 -2
- package/dist/owletto/dist/assets/{agent-thread-Bv_chdPy.js → agent-thread-BopD-2k1.js} +3 -3
- package/dist/owletto/dist/assets/{app._appId-BUcNaSMS.js → app._appId-BXeFXW1w.js} +2 -2
- package/dist/owletto/dist/assets/{assist-composer-B1LykXpD.js → assist-composer-CL5x8pNt.js} +2 -2
- package/dist/owletto/dist/assets/automation-run-now-MtxUTfzd.js +2 -0
- package/dist/owletto/dist/assets/{callback-kSLa4n5s.js → callback-BgfwP1Eo.js} +2 -2
- package/dist/owletto/dist/assets/{card-C01y1O-W.js → card-DtLIFq7D.js} +2 -2
- package/dist/owletto/dist/assets/{claim-Dnux9Lqf.js → claim-CT3hYVMF.js} +2 -2
- package/dist/owletto/dist/assets/{client-activity-scopes-BBIq16tG.js → client-activity-scopes-BPbRX-Pe.js} +2 -2
- package/dist/owletto/dist/assets/{client-rows-DGh1O-Fu.js → client-rows-vrNA6FLs.js} +2 -2
- package/dist/owletto/dist/assets/clients-xnzZeEdZ.js +2 -0
- package/dist/owletto/dist/assets/{code-editor-BdRMYojw.js → code-editor-mrKkAfcE.js} +2 -2
- package/dist/owletto/dist/assets/connect-NUCSay8X.js +2 -0
- package/dist/owletto/dist/assets/{connect-menu-D4w-JhJW.js → connect-menu-C6iVtuSo.js} +2 -2
- package/dist/owletto/dist/assets/connect._clientId-Cp-d9Q5b.js +2 -0
- package/dist/owletto/dist/assets/{connected._clientId-BsDzltNz.js → connected._clientId-ROfVgp9h.js} +2 -2
- package/dist/owletto/dist/assets/connection-BMz740Wi.js +2 -0
- package/dist/owletto/dist/assets/{connection-feed-detail-CJju0qiw.js → connection-feed-detail-0VAJiZTP.js} +2 -2
- package/dist/owletto/dist/assets/connector-page-shell-BFv21yuv.js +2 -0
- package/dist/owletto/dist/assets/{connector-provenance-B2C2cjBg.js → connector-provenance-b59RfBtk.js} +2 -2
- package/dist/owletto/dist/assets/connectors-nYS31lO2.js +2 -0
- package/dist/owletto/dist/assets/consent-cPRF9JQv.js +2 -0
- package/dist/owletto/dist/assets/{copy-button-BhXeXLIm.js → copy-button-C3wMMv63.js} +2 -2
- package/dist/owletto/dist/assets/{core.esm-CJUp2aNZ.js → core.esm-C9QlSrgK.js} +3 -3
- package/dist/owletto/dist/assets/{create-DUlRsFNn.js → create-ASRN3Obq.js} +2 -2
- package/dist/owletto/dist/assets/create-CBcodaSO.js +2 -0
- package/dist/owletto/dist/assets/create-CGOWfMk4.js +2 -0
- package/dist/owletto/dist/assets/{create-automation-form-D141prEG.js → create-automation-form-CLicoPH5.js} +3 -3
- package/dist/owletto/dist/assets/create._connectorKey-s4xkktTC.js +2 -0
- package/dist/owletto/dist/assets/{custom-guardrail-edits-DuQ28xv3.js → custom-guardrail-edits-BUL7nmuO.js} +2 -2
- package/dist/owletto/dist/assets/{definition-comparison-BUDNuAN_.js → definition-comparison-4UYMI6BK.js} +2 -2
- package/dist/owletto/dist/assets/{detail-page-skeleton-BRHaq5Sj.js → detail-page-skeleton-C8v3rJXK.js} +2 -2
- package/dist/owletto/dist/assets/device-BBwsOi7q.js +2 -0
- package/dist/owletto/dist/assets/{device-pin-tombstone-BIM-ziCH.js → device-pin-tombstone-Bcpe7nAA.js} +2 -2
- package/dist/owletto/dist/assets/{device._deviceId-BnPqTgK1.js → device._deviceId-DLT4jh0Z.js} +2 -2
- package/dist/owletto/dist/assets/{dynamic-schema-form-OkIZImgp.js → dynamic-schema-form-BDT8x0Vg.js} +2 -2
- package/dist/owletto/dist/assets/{entity-options-CpeX7iiX.js → entity-options-B9hm9V87.js} +2 -2
- package/dist/owletto/dist/assets/entity-page-DZjzQ2V4.js +2 -0
- package/dist/owletto/dist/assets/entity-pages-BWBpttz3.js +2 -0
- package/dist/owletto/dist/assets/entity-schema-graph-lMMx3HhR.js +2 -0
- package/dist/owletto/dist/assets/{entity-type-page-MgZ7_0oh.js → entity-type-page-CkQm0yEu.js} +2 -2
- package/dist/owletto/dist/assets/{event-detail-D6AH6a2C.js → event-detail-CkzfakTK.js} +2 -2
- package/dist/owletto/dist/assets/events-feed-DmRzikZW.js +2 -0
- package/dist/owletto/dist/assets/{filter-editors-DDTwyYt0.js → filter-editors-CQoSj-20.js} +3 -3
- package/dist/owletto/dist/assets/{full-page-spinner-DWo519BU.js → full-page-spinner-CYyCnKve.js} +2 -2
- package/dist/owletto/dist/assets/index-BE7eb2kE.js +2 -0
- package/dist/owletto/dist/assets/index-BFR0uiKY.js +2 -0
- package/dist/owletto/dist/assets/{index-Cd8jMsz8.js → index-BS5Ty3tf.js} +2 -2
- package/dist/owletto/dist/assets/index-C38OzBpB.js +2 -0
- package/dist/owletto/dist/assets/{index-D1UCJQl1.js → index-C3hz9tzx.js} +2 -2
- package/dist/owletto/dist/assets/index-CDyFQ32o.js +2 -0
- package/dist/owletto/dist/assets/{index-BW7IFKXC.js → index-CUndAH6o.js} +2 -2
- package/dist/owletto/dist/assets/index-CiKysEhV.js +2 -0
- package/dist/owletto/dist/assets/{index-CdDNNAx2.js → index-DByaMzsG.js} +274 -274
- package/dist/owletto/dist/assets/index-DfdinB7B.js +2 -0
- package/dist/owletto/dist/assets/index-DgMM4Zt5.css +1 -0
- package/dist/owletto/dist/assets/index-Xk711gVC.js +2 -0
- package/dist/owletto/dist/assets/{index-DmqnKGqW.js → index-ittfA0k8.js} +2 -2
- package/dist/owletto/dist/assets/{json-diff-C-WQqyIf.js → json-diff-mcDgyct_.js} +2 -2
- package/dist/owletto/dist/assets/{list-skeleton-0B1bTrAK.js → list-skeleton-DsYGUHxi.js} +2 -2
- package/dist/owletto/dist/assets/login-EoLq136v.js +2 -0
- package/dist/owletto/dist/assets/{logout-D474YsYQ.js → logout-gLgEQOiX.js} +2 -2
- package/dist/owletto/dist/assets/{member-scope-gate-CH_0jHiM.js → member-scope-gate-vvkgSAb2.js} +2 -2
- package/dist/owletto/dist/assets/memory-browse-page-DvDtwrEI.js +74 -0
- package/dist/owletto/dist/assets/{model-selector-XYmk7Iru.js → model-selector-D3vSMLO2.js} +2 -2
- package/dist/owletto/dist/assets/{needs-you-list-Bd4iiiqm.js → needs-you-list-B5Bgd05M.js} +2 -2
- package/dist/owletto/dist/assets/{new-CJ6TF3Vc.js → new-BPW3V0Y1.js} +2 -2
- package/dist/owletto/dist/assets/new-Bk_flKQO.js +2 -0
- package/dist/owletto/dist/assets/new-C5HtQdM_.js +2 -0
- package/dist/owletto/dist/assets/new-dLXsCHBd.js +2 -0
- package/dist/owletto/dist/assets/organization-DBfgBkzq.js +2 -0
- package/dist/owletto/dist/assets/{peek-pane-content-Cc8YX1oy.js → peek-pane-content-c2PG3TEX.js} +2 -2
- package/dist/owletto/dist/assets/{pending-seed-D7-ld7as.js → pending-seed-CBhx2Ql-.js} +2 -2
- package/dist/owletto/dist/assets/{proposal-review-shell-BWRJidwb.js → proposal-review-shell-B-jYcKfB.js} +2 -2
- package/dist/owletto/dist/assets/public-shell-ready-D8TijlRY.js +2 -0
- package/dist/owletto/dist/assets/record-activity-DnRVOrG2.js +2 -0
- package/dist/owletto/dist/assets/{record-session-ClKBr1_C.js → record-session-CAmGHMyM.js} +2 -2
- package/dist/owletto/dist/assets/{renderer-DZ0w2k2r.js → renderer-olRv_HMI.js} +3 -3
- package/dist/owletto/dist/assets/reset-password-B9_xi8Pq.js +2 -0
- package/dist/owletto/dist/assets/{run-initiator-B8IRlRd-.js → run-initiator-DhE5v4z0.js} +2 -2
- package/dist/owletto/dist/assets/runs-C8sZQr4o.js +2 -0
- package/dist/owletto/dist/assets/{runs-list-8gUPWjP4.js → runs-list-CwtH-wmk.js} +2 -2
- package/dist/owletto/dist/assets/{schema-value-k19Ata7u.js → schema-value-zTJGE4eh.js} +3 -3
- package/dist/owletto/dist/assets/{scoped-feed-bar-L7h-Ca4u.js → scoped-feed-bar-BKyJSa3_.js} +2 -2
- package/dist/owletto/dist/assets/{settings-BZqntV3E.js → settings-z02cvVS3.js} +2 -2
- package/dist/owletto/dist/assets/source-record-panels-CGmKIJdN.js +2 -0
- package/dist/owletto/dist/assets/{status-variants-BR_iGWN5.js → status-variants-DyRCXBzM.js} +2 -2
- package/dist/owletto/dist/assets/subDays-D8nHthaS.js +2 -0
- package/dist/owletto/dist/assets/{table-C3DMoL4K.js → table-C637cQxG.js} +2 -2
- package/dist/owletto/dist/assets/use-automations-CgWNoYio.js +2 -0
- package/dist/owletto/dist/assets/use-login-redirect-tDdhXTpt.js +2 -0
- package/dist/owletto/dist/assets/{use-mention-search-CtbixPEE.js → use-mention-search-D-kIKchD.js} +2 -2
- package/dist/owletto/dist/assets/view-param-filters-CUCj9Df-.js +2 -0
- package/dist/owletto/dist/assets/{views-access-required-CvIIxdS_.js → views-access-required-C35Dyt91.js} +2 -2
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +2733 -1795
- package/npm-shrinkwrap.json +238 -221
- package/package.json +1 -1
- package/vendor/connector-sdk/dist/connector-types.d.ts +6 -0
- package/vendor/connector-sdk/dist/index.d.ts +1 -0
- package/vendor/connector-sdk/dist/index.js +1 -0
- package/vendor/connector-sdk/dist/ip-reachability.d.ts +1 -1
- package/vendor/connector-sdk/dist/ip-reachability.js +1 -1
- package/vendor/connector-sdk/dist/logger.d.ts +1 -1
- package/vendor/connector-sdk/dist/logger.js +1 -1
- package/vendor/connector-sdk/dist/reaction-client-types.d.ts +3 -1
- package/vendor/connector-sdk/dist/retry.d.ts +1 -1
- package/vendor/connector-sdk/dist/retry.js +1 -1
- package/vendor/connector-sdk/dist/source-withheld-error.d.ts +16 -0
- package/vendor/connector-sdk/dist/source-withheld-error.js +19 -0
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/classify-error.d.ts +1 -1
- package/vendor/core/dist/classify-error.js +2 -2
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +28 -3
- package/vendor/core/dist/contracts/tools/manage-automations.js +27 -8
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +8 -0
- package/vendor/core/dist/contracts/tools/manage-entity.js +11 -3
- package/vendor/core/dist/contracts/tools/save-memory.d.ts +11 -1
- package/vendor/core/dist/contracts/tools/save-memory.js +25 -3
- package/vendor/core/dist/contracts/tools/search-memory.js +1 -1
- package/vendor/core/dist/credentials.d.ts +12 -0
- package/vendor/core/dist/credentials.js +1 -0
- package/vendor/core/dist/errors.js +2 -2
- package/vendor/core/dist/worker/auth.d.ts +5 -0
- package/vendor/core/dist/worker/auth.js +15 -4
- package/vendor/core/package.json +1 -1
- package/vendor/postgres/cf/src/connection.js +7 -2
- package/vendor/postgres/cjs/src/connection.js +7 -2
- package/vendor/postgres/src/connection.js +7 -2
- package/vendor/views/dist/native.d.ts +33 -1
- package/vendor/views/dist/native.js +3 -0
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-B2C9B2RM.js +0 -2
- package/dist/owletto/dist/assets/_-CjyiGzwB.js +0 -3
- package/dist/owletto/dist/assets/_agentId-DKHXGvS2.js +0 -2
- package/dist/owletto/dist/assets/_automationId-CowRFD4E.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-dE6im18z.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-DqwSv8Zs.js +0 -2
- package/dist/owletto/dist/assets/_eventId-BVOVizs4.js +0 -2
- package/dist/owletto/dist/assets/_owner-DsvIC94q.js +0 -3
- package/dist/owletto/dist/assets/_shape-CWjpzcvv.js +0 -2
- package/dist/owletto/dist/assets/_slug-DuCxYsJk.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-BqVeHB6Z.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-DzyOCG5U.js +0 -2
- package/dist/owletto/dist/assets/accept-invitation-k1u3zBcn.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-jTBMW7a9.js +0 -2
- package/dist/owletto/dist/assets/agent-connect-pages-D3mVM_q4.js +0 -4
- package/dist/owletto/dist/assets/agent-permissions-matrix-C_ayr0pd.js +0 -2
- package/dist/owletto/dist/assets/automation-run-now-CjkJIkaZ.js +0 -2
- package/dist/owletto/dist/assets/clients-BCvjAJDT.js +0 -2
- package/dist/owletto/dist/assets/connect-DZeFSGIH.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-IZEMQJ64.js +0 -2
- package/dist/owletto/dist/assets/connection-C7glVpPE.js +0 -2
- package/dist/owletto/dist/assets/connector-page-shell-BeuyjiB2.js +0 -2
- package/dist/owletto/dist/assets/connectors-DSQ5AWPf.js +0 -2
- package/dist/owletto/dist/assets/consent-B6Aw_89N.js +0 -2
- package/dist/owletto/dist/assets/create-CWcza8NT.js +0 -2
- package/dist/owletto/dist/assets/create-bGOYifof.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-Ds4tpwHP.js +0 -2
- package/dist/owletto/dist/assets/device-D3fzoIrM.js +0 -2
- package/dist/owletto/dist/assets/entity-page-Cjc8oXA2.js +0 -2
- package/dist/owletto/dist/assets/entity-pages-18xSANrS.js +0 -2
- package/dist/owletto/dist/assets/entity-schema-graph-uwZ-P0t8.js +0 -2
- package/dist/owletto/dist/assets/events-feed-BI7wNRUY.js +0 -2
- package/dist/owletto/dist/assets/index-9tTjJo_J.css +0 -1
- package/dist/owletto/dist/assets/index-BYcFrinP.js +0 -2
- package/dist/owletto/dist/assets/index-BhJsTy-C.js +0 -2
- package/dist/owletto/dist/assets/index-CEcsgXDj.js +0 -2
- package/dist/owletto/dist/assets/index-CPscKk2u.js +0 -2
- package/dist/owletto/dist/assets/index-CfJ2-EpK.js +0 -2
- package/dist/owletto/dist/assets/index-D5DM4g2w.js +0 -2
- package/dist/owletto/dist/assets/index-DznAbTOF.js +0 -2
- package/dist/owletto/dist/assets/login-CH7P2AyR.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-Ba4aYavw.js +0 -74
- package/dist/owletto/dist/assets/new-BOsrRqp8.js +0 -2
- package/dist/owletto/dist/assets/new-DGPOjak2.js +0 -2
- package/dist/owletto/dist/assets/new-Q0XqiZq2.js +0 -2
- package/dist/owletto/dist/assets/organization-hD_Z6TSd.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-CRyAZATw.js +0 -2
- package/dist/owletto/dist/assets/record-activity-9ux6SfCd.js +0 -2
- package/dist/owletto/dist/assets/reset-password-D2RfrEVZ.js +0 -2
- package/dist/owletto/dist/assets/runs-CuC7WMtd.js +0 -2
- package/dist/owletto/dist/assets/source-record-panels-C4UItfdk.js +0 -2
- package/dist/owletto/dist/assets/subDays-hOwerOLo.js +0 -2
- package/dist/owletto/dist/assets/use-automations-CdtiVLCv.js +0 -2
- package/dist/owletto/dist/assets/use-login-redirect-CYlVkAhE.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-BdN8OU35.js +0 -2
- /package/vendor/postgres/{.bun-tag-c81dacd34e959a7a → .bun-tag-652f2580b8090d71} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=proposal-review-shell-
|
|
1
|
+
import{hX as f,ht as w,hu as y,r as C,j as e,a8 as N,B as d,Z as P,f3 as k}from"./index-DByaMzsG.js";import{b as A}from"./runs-C8sZQr4o.js";function B({resource:g,runId:r,children:h,onDone:l}){const c=!!r,{data:a,isLoading:E,isError:u,refetch:v}=A(g,c?r:void 0),s=f({isReview:c,isError:u,status:a?.status}),m=a?.status==="pending"?a.proposal:null,n=w(),i=y(),[p,x]=C.useState(""),o=n.isPending||i.isPending,j=s==="active"||s==="loading"||s==="error",b=()=>{r&&n.mutate({run_id:r},{onSuccess:()=>l?.()})},R=()=>{if(!r)return;const t=p.trim();i.mutate({run_id:r,...t?{reason:t}:{}},{onSuccess:()=>l?.()})};return e.jsxs("div",{className:"grid content-start gap-4",children:[s==="active"?e.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(N,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("p",{children:["Review the change the builder agent proposed. Compare Current and Proposed, then ",e.jsx("strong",{children:"Approve"})," to apply, or"," ",e.jsx("strong",{children:"Reject"}),"."]})]})}):null,s==="gone"?e.jsx("div",{className:"rounded-lg border bg-muted/30 p-3 text-sm text-muted-foreground",children:"This change is no longer pending (it may have been approved or rejected already)."}):null,s==="error"?e.jsx("div",{className:"rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("p",{className:"text-destructive",children:"Couldn't load the proposed change to review. Editing is disabled until it loads — retry, or reopen the link."}),e.jsx(d,{type:"button",variant:"outline",size:"sm",onClick:()=>void v(),children:"Retry"})]})}):null,h({reviewMode:s,proposal:m,controlsDisabled:j}),s==="active"?e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"review-reject-reason",children:"Reason (optional)"}),e.jsx(k,{id:"review-reject-reason",rows:2,value:p,onChange:t=>x(t.target.value),placeholder:"Why you're rejecting — shared back to the requester.",disabled:o})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-end",children:[e.jsx(d,{type:"button",variant:"outline",onClick:R,disabled:o,children:i.isPending?"Rejecting...":"Reject"}),e.jsx(d,{type:"button",onClick:b,disabled:o,children:n.isPending?"Approving...":"Approve"})]})]}):null]})}export{B as P};
|
|
2
|
+
//# sourceMappingURL=proposal-review-shell-B-jYcKfB.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{aT as us,j as e,r as j,c as K,P as $e,dJ as ms,z as bt,dI as jt,L as je,ac as fs,dL as ps,S as kt,dM as hs,d5 as vs,aM as Ct,aO as A,bo as rt,dN as ys,dO as gs,dP as xs,dQ as bs,dR as js,c_ as ks,dS as ee,cr as Cs,dT as St,dU as Ss,aw as Ns,dV as _s,s as Is,dj as Es,aB as ye,dW as As,dX as Ts,n as Nt,cL as _t,dY as Fs,cx as ct,dZ as Rs,cP as Ps,dg as It,d_ as Ms,d$ as ws,cu as Ls,aP as $s,d9 as Os,$ as Ds,i as ge,X as Bs,e0 as Ks,e1 as Gs,bS as Vs,e2 as Qs,e3 as Us,e4 as Et,bq as Ws,br as Hs,bs as zs,bt as qs,bu as Ys,e5 as Zs,e6 as At,e7 as lt,H as Xs,e8 as Js,e9 as Fe,ea as dt,cM as en,eb as tn,x as sn,cK as nn,ec as on,ed as an,t as rn,ee as cn,ef as ln,eg as dn,b$ as un,eh as mn,ei as fn,dA as pn,bc as ut,ej as mt,ek as Tt,el as Re,dl as Ft,B as Rt,em as hn,en as Pe}from"./index-DByaMzsG.js";import{S as D,F as ft,o as X,d as vn,r as yn,f as gn,a as xn}from"./filter-editors-CQoSj-20.js";import{u as bn}from"./runs-C8sZQr4o.js";import{u as Pt}from"./activity-route-location-C1jcXC7v.js";import{e as jn,f as Ae,C as Mt,c as kn}from"./event-kind-options-fHAIXu24.js";import{S as Cn}from"./source-record-panels-CGmKIJdN.js";import{u as Sn}from"./clients-xnzZeEdZ.js";import{u as Nn}from"./client-activity-scopes-BPbRX-Pe.js";import{g as _n}from"./client-rows-vrNA6FLs.js";import{E as In}from"./events-feed-DmRzikZW.js";import{E as En}from"./run-initiator-DhE5v4z0.js";import{L as An,u as Tn}from"./renderer-olRv_HMI.js";import{E as Fn}from"./agent-loading-shells-DYqQphN7.js";import{M as Rn}from"./member-scope-gate-vvkgSAb2.js";const Oe=j.createContext(null);function Pn({organizationId:t,isWorkspaceLoading:s,children:a}){const{data:n=[],isLoading:o}=us(t);return e.jsx(Oe.Provider,{value:{groups:n,isLoading:!!s||o},children:a})}function Mn(){const t=j.useContext(Oe);if(!t)throw new Error("useMemoryConnectorGroups must be used within MemoryConnectorGroupsProvider");return t}function wn(){return j.useContext(Oe)}function wt(t){const{parse:s,serialize:a,filterKeys:n,clearClassifications:o=!0,replace:i=!0,merge:l}=t,y=K(),d=$e(),r=j.useMemo(()=>{const u=new URLSearchParams;for(const[f,p]of Object.entries(d.search||{}))p!=null&&u.set(f,typeof p=="object"&&!Array.isArray(p)?JSON.stringify(p):String(p));return s(u)},[d.search,s]),c=j.useCallback((u,f)=>{const p=l?l(r,u):{...r,...u},v=a(p),k={};for(const[x,S]of Object.entries(d.search||{}))S!=null&&(k[x]=S);for(const x of n)delete k[x];if(o)for(const x of Object.keys(k))x.startsWith("clf_")&&delete k[x];for(const[x,S]of Object.entries(v))S!==void 0&&(k[x]=S);y({to:d.pathname,search:k,replace:f?.replace??i})},[r,a,n,o,l,y,d,i]),g=j.useCallback(()=>{const u={};for(const[f,p]of Object.entries(d.search||{}))p!=null&&(n.includes(f)||o&&f.startsWith("clf_")||(u[f]=p));y({to:d.pathname,search:u,replace:i})},[y,d.pathname,d.search,n,o,i]);return{filters:r,updateFilters:c,clearFilters:g}}function Ln(t){const{slug:s}=ms();return bt({queryKey:["schedules",s,t],queryFn:async()=>((await jt("manage_schedules",{action:"list",action_type:"wake_agent",include_paused:!0})).schedules??[]).filter(n=>n.action_args?.agent_id===t),enabled:!!s&&!!t,staleTime:3e4})}function $n(t,s){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:t,connectorKey:s.connector_key,connectionId:String(s.connection_id)},search:{feedId:s.id}}}function On(t,s){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:t,connectorKey:s.connector_key,connectionId:String(s.id)}}}function Dn(t,s){return{to:"/$owner/agents/connected/$clientId",params:{owner:t,clientId:s}}}function Bn(t,s){return{to:"/$owner/automations/$automationId",params:{owner:t,automationId:s}}}function Kn(t,s,a){return{to:"/$owner/events",params:{owner:t},search:{agent:s,schedule:a}}}function me({id:t,label:s,value:a,sourceLink:n,details:o,onRemove:i}){return{id:t,label:s,op:"is",value:a,onRemove:i,editor:n||o?{kind:"custom",className:"w-80",render:()=>e.jsxs("div",{className:"flex flex-col gap-2 p-3 text-sm",children:[n?e.jsxs(je,{to:n.to,params:n.params,search:n.search,className:"inline-flex min-w-0 items-center gap-1.5 font-medium text-foreground hover:underline",children:[e.jsx("span",{className:"truncate",children:a}),e.jsx(fs,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}):e.jsx("span",{className:"font-medium",children:a}),o]})}:void 0}}function Gn({ownerSlug:t,clientIds:s,linkedUser:a,linkedUserEntitySlug:n}){const o=t&&n?ps(t,[{entity_type:"$member",slug:n}]):null;return e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:s.length===1?"Client ID":"Client IDs"}),s.map(i=>e.jsx("code",{className:"break-all text-foreground",children:i},i))]}),a?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:["Granted by",o?e.jsx(je,{to:o,className:"font-medium text-foreground hover:underline",children:a}):e.jsx("span",{className:"font-medium text-foreground",children:a})]}):null]})}function Vn(t,s=!0){return bt({queryKey:["automations-list","activity",t],queryFn:async()=>{const a=await Promise.all(["active","archived"].map(n=>jt("manage_automations",{action:"list",status:n,include_details:!1},{slug:t})));return[...new Map(a.flatMap(n=>n.automations).map(n=>[Number(n.automation_id),n])).values()].sort((n,o)=>n.name.localeCompare(o.name))},enabled:s&&!!t,staleTime:3e4})}function J({to:t,params:s,search:a,label:n}){return e.jsx(je,{to:t,params:s,search:a,onClick:o=>o.stopPropagation(),onPointerDown:o=>o.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 ${n}`,children:e.jsx(kt,{className:"h-3.5 w-3.5"})})}const Me=["produced","analyzed"],xe=t=>t==="produced"?"Produced by":"Analyzed by";function Qn({enabled:t,...s}){const a=Un(s,t);if(!t)return{fields:[],chips:[]};const n=Wn(s);return{fields:[a.field,n.field],chips:[...a.chips,...n.chips]}}function Un({ownerSlug:t,filters:s,onFiltersChange:a},n){const o=Vn(t,n),i=o.data??[],l=c=>c==="produced"?s.producedByAutomationId:s.automationId,y=c=>i.find(g=>Number(g.automation_id)===c)?.name??`#${c}`,d=Me.flatMap(c=>{const g=l(c);return g==null?[]:[{id:`automation-${c}`,field:"automation",label:xe(c),value:y(g),onRemove:()=>a(c==="produced"?{producedByAutomationId:null}:{automationId:null})}]}),r={kind:"list",className:"w-80",searchPlaceholder:"Search Automations...",emptyText:o.isLoading?"Loading Automations...":"No Automations found",items:c=>e.jsxs(e.Fragment,{children:[Me.map(g=>{const u=l(g),f=i.map(v=>({id:Number(v.automation_id),label:`${v.name}${v.status==="archived"?" (archived)":""}`}));u!=null&&!f.some(v=>v.id===u)&&f.unshift({id:u,label:`Automation #${u} (selected)`});const p=v=>{a(g==="produced"?{producedByAutomationId:v}:{automationId:v}),c()};return e.jsx(Ct,{heading:xe(g),children:f.map(v=>e.jsxs(A,{"aria-label":v.label,value:`${g} ${v.label} ${v.id}`,onSelect:()=>p(v.id),className:"group",children:[e.jsx(D,{selected:u===v.id}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:v.label}),e.jsx(J,{...Bn(t,String(v.id)),label:v.label})]},v.id))},g)}),o.isError?e.jsx(A,{forceMount:!0,onSelect:()=>void o.refetch(),children:"Could not load Automations. Retry"}):null]})};return{chips:d,field:{key:"automation",label:"Automation",group:"Scope",icon:e.jsx(hs,{className:"h-4 w-4"}),editor:r}}}function Wn(t){const{filters:s,onFiltersChange:a}=t,n=[];s.runIds?.length&&n.push({id:"run-produced",field:"run",label:"Produced by run",value:s.runIds.map(i=>`#${i}`).join(", "),onRemove:()=>a({runIds:null})}),s.runId!=null&&n.push({id:"run-analyzed",field:"run",label:"Analyzed by run",value:`#${s.runId}`,onRemove:()=>a({runId:null})});const o={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:(i,l)=>Me.map(y=>e.jsx(Hn,{...t,mode:y,query:l,close:i},y))};return{chips:n,field:{key:"run",label:"Run",group:"Scope",icon:e.jsx(vs,{className:"h-4 w-4"}),editor:o}}}function Hn({ownerSlug:t,filters:s,onFiltersChange:a,mode:n,query:o,close:i}){const l=n==="produced"?s.producedByAutomationId:s.automationId,y=bn({workspace:!0},{automationIds:l==null?void 0:[l],runTypes:n==="analyzed"?["automation"]:void 0,connectionIds:n==="produced"?s.connectionIds??void 0:void 0,feedIds:n==="produced"?s.feedIds??void 0:void 0},t),d=n==="produced"?s.runIds??[]:s.runId==null?[]:[s.runId],r=y.data?.pages.flatMap(f=>f.runs)??[],c=[...new Map(r.map(f=>[f.id,{id:f.id,label:`Run #${f.id} · ${f.feed_display_name??f.operation_key??f.run_type} · ${f.status}`}])).values()];for(const f of d)c.some(p=>p.id===f)||c.unshift({id:f,label:`Run #${f} (selected)`});const g=f=>{if(n==="produced"){const p=d.includes(f)?d.filter(v=>v!==f):[...d,f];a({runIds:p.length?p:null})}else a({runId:f}),i()},u=/^\d+$/.test(o.trim())?Number(o.trim()):0;return e.jsxs(Ct,{heading:xe(n),children:[c.map(f=>e.jsxs(A,{value:`${n} ${f.label}`,onSelect:()=>g(f.id),children:[e.jsx(D,{selected:d.includes(f.id)}),e.jsx("span",{className:"truncate",children:f.label})]},f.id)),Number.isSafeInteger(u)&&u>0&&!c.some(f=>f.id===u)?e.jsxs(A,{value:`${n} ${u}`,onSelect:()=>g(u),children:[xe(n)," run #",u]}):null,y.isLoading?e.jsx(A,{disabled:!0,forceMount:!0,children:"Loading runs..."}):null,y.isError?e.jsx(A,{forceMount:!0,onSelect:()=>void(y.isFetchNextPageError?y.fetchNextPage():y.refetch()),children:"Could not load runs. Retry"}):null,!y.isLoading&&!y.isError&&!c.length?e.jsx(A,{disabled:!0,forceMount:!0,children:"No runs found"}):null,y.hasNextPage?e.jsx(A,{forceMount:!0,disabled:y.isFetching,onSelect:()=>void y.fetchNextPage(),children:y.isFetchingNextPage?"Loading more runs...":"Load more runs"}):null]})}const De="Scope",Te="Source",Q="h-4 w-4";function te(){return Pt().search??{}}function Lt(t){const{pathname:s}=Pt(),a=s.startsWith(`/${t}/events/`),n=xs(s,a?1:0),o=!!(n&&!a&&!bs(n.split("/")[0]));return{pathname:s,embedded:o,recordPath:o?js(n)?.entityPath:a?n:void 0}}function $t(t){const s=te(),{recordPath:a,pathname:n,embedded:o}=Lt(t);return i=>{const l=ee(t,s,i,a);return o?{to:n,search:l.search}:l}}const pt=t=>new Set((t??"").split(",").map(s=>s.trim()).filter(Boolean));function zn({ownerSlug:t,sourceRead:s=!1,filters:a,onFiltersChange:n}){const o=te(),{recordPath:i,embedded:l}=Lt(t),y=i?i.split("/").at(-2):void 0,d=typeof o.type=="string"&&o.type.trim()?o.type.trim():void 0,r=(y?rt(y):void 0)??(d?rt(d):void 0),c=ys(o),g=gs(o),u=typeof o.feed_ids=="string"?o.feed_ids:typeof o.feed_ids=="number"?String(o.feed_ids):void 0,f=qn(t,r,!l),p=Yn(t,r,i,l),v=Zn(t,c,!s),k=Qn({ownerSlug:t,filters:a,onFiltersChange:n,enabled:!s}),x=Xn(t,g,u);return[f,p,v,k,x].reduce((S,w)=>({fields:[...S.fields,...w.fields],chips:[...S.chips,...w.chips]}),{fields:[],chips:[]})}function qn(t,s,a){const n=K(),o=te(),{visible:i}=ks(t);if(!a)return{fields:[],chips:[]};const l=i.find(d=>d.slug===s),y={kind:"list",searchPlaceholder:"Search types...",emptyText:"No entity types",items:d=>e.jsxs(e.Fragment,{children:[i.map(r=>e.jsxs(A,{onSelect:()=>{n(ee(t,o,{entity:void 0,create:void 0,type:r.slug})),d()},className:"group gap-2",children:[e.jsx(D,{selected:r.slug===s}),e.jsx(Ps,{icon:r.icon,className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:r.name}),typeof r.entity_count=="number"?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:r.entity_count}):null,e.jsx(J,{to:"/$owner/entity-types/$slug",params:{owner:t,slug:r.slug},label:r.name})]},r.id)),e.jsxs(A,{onSelect:()=>{n(Ms(t)),d()},className:"text-muted-foreground",children:[e.jsx(It,{className:"h-4 w-4 shrink-0"}),"Add entity type"]})]})};return{fields:[{key:"type",label:"Entity type",group:De,icon:e.jsx(Cs,{className:Q}),editor:y}],chips:s?[{id:"type",label:"Entity type",op:"is",value:l?.name??s,onRemove:()=>void n(ee(t,o,{type:void 0}))}]:[]}}function Yn(t,s,a,n){const o=K(),i=te(),[l,y]=j.useState(""),[d,r]=j.useState(0),c=St(l,250),g={slug:t},{data:u,isLoading:f,isError:p,refetch:v}=Ss(s??"",g,{search:c,offset:d,limit:30,enabled:!n&&!!s}),{data:k}=Ns(a?`/${t}/${a}`:"",g),x=a?k?.entity:void 0,S=x?.name??(a?a.split("/").at(-1):void 0);if(n)return{fields:[],chips:S?[{id:"entity",label:"Entity",op:"is",value:S}]:[]};if(!s)return{fields:[],chips:[]};const w={kind:"list",searchPlaceholder:"Search entities...",emptyText:f?"Loading entities...":"No matching entities",className:"w-80",onQueryChange:F=>{y(F),r(0)},items:F=>e.jsxs(e.Fragment,{children:[p?e.jsx(A,{onSelect:()=>void v(),children:"Could not load entities. Retry"}):u?.entities.map(I=>e.jsxs(A,{value:I.slug,onSelect:()=>{const R=ws([...I.parent_slug&&I.parent_entity_type?[{entity_type:I.parent_entity_type,slug:I.parent_slug}]:[],{entity_type:I.entity_type,slug:I.slug}]);o(ee(t,i,{type:s},R)),F()},children:[e.jsx(D,{selected:x?.slug===I.slug}),I.name]},I.slug)),d>0&&e.jsx(A,{onSelect:()=>r(Math.max(0,d-30)),children:"Previous entities"}),u?.metadata.has_more&&e.jsx(A,{disabled:f,onSelect:()=>r(d+30),children:"More entities"})]})};return{fields:[{key:"entity",label:"Entity",group:De,icon:e.jsx(_s,{className:Q}),editor:w}],chips:S?[{id:"entity",label:"Entity",op:"is",value:S,onRemove:()=>void o(ee(t,i,{type:s}))}]:[]}}function Zn(t,s,a){const n=K(),o=$t(t),{data:i=[]}=Is(),l=j.useMemo(()=>[...i].sort((r,c)=>r.name.localeCompare(c.name)),[i]);if(!a)return{fields:[],chips:[]};const y=l.find(r=>r.agentId===s),d={kind:"list",searchPlaceholder:"Search agents...",emptyText:"No agents",items:r=>l.map(c=>e.jsxs(A,{onSelect:()=>{n(o({agent:c.agentId,schedule:void 0})),r()},className:"gap-2",children:[e.jsx(D,{selected:c.agentId===s}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-muted text-[10px] font-medium",children:c.name.trim().charAt(0).toUpperCase()||"?"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:c.name})]},c.agentId))};return{fields:[{key:"agent",label:"Agent",group:De,icon:e.jsx(Es,{className:Q}),editor:d}],chips:s?[{id:"agent",label:"Agent",op:"is",value:y?.name??s,onRemove:()=>void n(o({agent:void 0,schedule:void 0}))}]:[]}}function Xn(t,s,a){const n=K(),o=$t(t),{groups:i}=Mn(),l=te(),y=ye({platforms:String(l.platforms??l.platform??"")}).platforms??[],d=j.useMemo(()=>pt(s),[s]),r=j.useMemo(()=>pt(a),[a]),c=y.length===1?y[0]:As(i,d),g=i.find(E=>E.connector_key===c),u=d.size===1?Number([...d][0]):void 0,f=Ts(u),{org:p}=Nt(),v=_t(p?.id,{feedIds:[...r].map(Number),enabled:u==null&&r.size>0}),k=u==null?v:f,x=k.data??[],S={platforms:void 0,platform:void 0,connection_ids:void 0,feed_ids:void 0},w={kind:"list",searchPlaceholder:"Search connectors...",emptyText:"No connectors",items:E=>e.jsxs(e.Fragment,{children:[i.map(N=>{const T=N.connector_name??N.connector_key;return e.jsxs(A,{disabled:N.connections.length===0,onSelect:()=>{n(o({...S,platforms:N.connector_key})),E()},className:"group gap-2",children:[e.jsx(D,{selected:N.connector_key===g?.connector_key}),e.jsx($s,{plain:!0,name:T,faviconDomain:N.favicon_domain,className:"h-5 w-5 shrink-0 rounded-md text-[10px]"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:T}),N.connection_count>0?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:N.connection_count}):null,e.jsx(J,{to:"/$owner/connectors/$connectorKey",params:{owner:t,connectorKey:N.connector_key},label:T})]},N.connector_key)}),e.jsx(A,{asChild:!0,onSelect:E,className:"text-muted-foreground",children:e.jsxs(je,{to:"/$owner/connectors/create",params:{owner:t},className:"flex items-center gap-2",children:[e.jsx(It,{className:"h-4 w-4 shrink-0"}),"Add connector"]})})]})},F=[{key:"connector",label:"Connector",group:Te,icon:e.jsx(Ls,{className:Q}),editor:w}],I=[],R=g?.connector_name??g?.connector_key??(y.join(", ")||(d.size?`Connections ${[...d].join(", ")}`:void 0));if(R&&I.push({id:"connector",label:"Connector",op:"is",value:R,onRemove:()=>void n(o(S))}),g){F.push({key:"connection",label:"Connection",group:Te,icon:e.jsx(Fs,{className:Q}),editor:U(g)});const E=d.size===1?g.connections.find(N=>d.has(String(N.id))):void 0;E&&I.push({id:"connection",label:"Connection",op:"is",value:ct({display_name:E.display_name,connector_name:g.connector_name,connector_key:g.connector_key}),onRemove:()=>void n(o({...S,platforms:g.connector_key}))})}if((u||a)&&F.push({key:"feed",label:"Feed",group:Te,icon:e.jsx(Rs,{className:Q}),editor:G()}),r.size>0){const E=r.size===1?x.find(N=>r.has(String(N.id))):void 0;I.push({id:"feed",label:"Feed",op:"is",value:E?fe(E):`#${a}`,onRemove:()=>void n(o({...u!=null?{connection_ids:String(u)}:{},feed_ids:void 0}))})}return{fields:F,chips:I};function U(E){return{kind:"list",searchPlaceholder:"Search connections...",emptyText:"No connections",items:N=>E.connections.map(T=>{const b=ct({display_name:T.display_name,connector_name:E.connector_name,connector_key:E.connector_key});return e.jsxs(A,{onSelect:()=>{n(o({connection_ids:String(T.id),feed_ids:void 0})),N()},className:"group gap-2",children:[e.jsx(D,{selected:d.has(String(T.id))}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:b}),T.feed_count>0?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:T.feed_count}):null,e.jsx(J,{...On(t,{id:T.id,connector_key:E.connector_key}),label:b})]},T.id)})}}function G(){return{kind:"list",searchPlaceholder:"Search feeds...",emptyText:k.isLoading?"Loading feeds...":"No feeds",items:E=>x.map(N=>e.jsxs(A,{"aria-label":fe(N),onSelect:()=>{n(o({...u!=null?{connection_ids:String(u)}:{},feed_ids:String(N.id)})),E()},className:"group gap-2",children:[e.jsx(D,{selected:r.has(String(N.id))}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:fe(N)}),e.jsx(J,{...$n(t,N),label:fe(N)})]},N.id))}}}function fe(t){return t.display_name?.trim()||t.feed_key}const be=[{value:"date-desc",label:"Newest first"},{value:"date-asc",label:"Oldest first"},{value:"score-desc",label:"Highest score"},{value:"score-asc",label:"Lowest score"}];function Jn({value:t,onChange:s}){const a=be.find(n=>n.value===t)?.label??"Newest first";return e.jsxs(Ws,{value:t,onValueChange:s,children:[e.jsxs(Hs,{"aria-label":"Sort",className:"h-8 w-auto shrink-0 gap-2 bg-muted px-2.5",children:[e.jsx(Et,{"aria-hidden":"true",className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx(zs,{children:a})]}),e.jsx(qs,{align:"end",className:"min-w-40",children:be.map(n=>e.jsx(Ys,{value:n.value,children:n.label},n.value))})]})}const ht=[{value:"user",label:"Manual review"},{value:"system",label:"Auto-classified"},{value:"llm",label:"LLM-classified"}],vt=[{value:"pending",label:"Pending approval"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}],pe=0,he=100,Z="Event",V="h-4 w-4";function eo(t,s,a){const n=t.engagementRange??[pe,he],o=t.reviewStatus,i=t.interactionStatus,l=t.semanticTypes??[],y=[{key:"kind",label:"Event kind",group:Z,icon:e.jsx(Ks,{className:V}),editor:X({searchPlaceholder:"Search event kinds...",emptyText:"No event kinds found",options:jn(a,l).map(c=>({value:c,label:Ae(c)})),selected:l,multiple:!0,onSelect:c=>{const g=l.includes(c)?l.filter(u=>u!==c):[...l,c];s({semanticTypes:g.length>0?g:void 0})}})},{key:"date",label:"Date",group:Z,icon:e.jsx(Gs,{className:V}),editor:vn({value:t.dateRange??void 0,onApply:c=>s({dateRange:c})})},{key:"approval",label:"Approval",group:Z,icon:e.jsx(Vs,{className:V}),editor:X({searchPlaceholder:"Search statuses...",options:[...vt],selected:i?[i]:[],onSelect:c=>s({interactionStatus:c})})},{key:"review",label:"Reviewed by",group:Z,icon:e.jsx(Qs,{className:V}),editor:X({searchPlaceholder:"Search reviewers...",options:[...ht],selected:o&&o!=="all"?[o]:[],onSelect:c=>s({reviewStatus:c})})},{key:"score",label:"Engagement score",group:Z,icon:e.jsx(Us,{className:V}),editor:yn({value:n,min:pe,max:he,onApply:c=>s({engagementRange:c})})}],d=[],r=t.eventCategory!=null&&l.length===1&&l[0]===Mt;return l.length&&!r&&d.push({id:"kind",label:"Kind",value:l.length<=2?l.map(Ae).join(", "):`${l.length} kinds`,title:l.map(Ae).join(", "),onRemove:()=>s({semanticTypes:void 0})}),t.dateRange&&d.push({id:"date",label:"Date",op:"is",value:gn(t.dateRange),onRemove:()=>s({dateRange:null})}),i&&d.push({id:"approval",label:"Approval",op:"is",value:vt.find(c=>c.value===i)?.label??i,onRemove:()=>s({interactionStatus:null})}),o&&o!=="all"&&d.push({id:"review",label:"Reviewed by",op:"is",value:ht.find(c=>c.value===o)?.label??o,onRemove:()=>s({reviewStatus:void 0})}),(n[0]!==pe||n[1]!==he)&&d.push({id:"score",label:"Engagement score",value:xn(n,pe,he),onRemove:()=>s({engagementRange:void 0})}),{fields:y,chips:d}}function Ot({filters:t,onFiltersChange:s,eventKinds:a=[],searchQuery:n,onSearchChange:o,scope:i,extraFields:l=[],drillChips:y=[],sourceRead:d=!1,filterTrailing:r,filterActions:c,quickFilters:g,toolbar:u=!1,onClearFilters:f}){const p=n.trim().length>0,v=d?{fields:[],chips:[]}:eo(t,s,a),k=`${t.sortBy??"date"}-${t.sortOrder??"desc"}`,x=R=>{const[U,G]=R.split("-");s({sortBy:U,sortOrder:G})},S=u&&!d?{fields:[{key:"sort",label:"Order",group:"Order",icon:e.jsx(Et,{className:V}),editor:X({searchPlaceholder:"Search orders...",options:[...be],selected:[k],onSelect:x})}],chips:k==="date-desc"?[]:[{id:"sort",label:"Order",value:be.find(R=>R.value===k)?.label??k,onRemove:()=>s({sortBy:"date",sortOrder:"desc"})}]}:{fields:[],chips:[]},w=[...g?.fields??[],...v.fields,...i?.fields??[],...l,...S.fields],F=[...g?.chips??[],...i?.chips??[],...y,...v.chips,...S.chips],I=d?null:e.jsxs("div",{className:ge("relative min-w-0",u?"w-64 max-w-full":"flex-1"),children:[e.jsx(Os,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(Ds,{type:"search","aria-label":"Search events",placeholder:"Search events...",value:n,onChange:R=>o(R.target.value),className:ge("h-8 pl-9",p&&"pr-9")}),p&&e.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>o(""),className:"absolute right-0.5 top-1/2 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:e.jsx(Bs,{className:"h-3.5 w-3.5"})})]});return u?e.jsx(ft,{label:"Event filters",clearAllMin:2,fields:w,chips:F,actions:c,trailing:e.jsxs(e.Fragment,{children:[r,I]}),onClearAll:f,hasClearableState:p,className:"w-full"}):e.jsxs("div",{className:"w-full space-y-2.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[I,!d&&e.jsx(Jn,{value:k,onChange:x})]}),e.jsx(ft,{label:"Event filters",fields:w,chips:F,actions:c,trailing:r,onClearAll:f,hasClearableState:p})]})}function Dt({ownerSlug:t,...s}){const a=zn({ownerSlug:t,sourceRead:s.sourceRead,filters:s.filters,onFiltersChange:s.onFiltersChange});return e.jsx(Ot,{...s,scope:a})}const we=3600*1e3,yt=24*we;function gt(t){const s=t instanceof Date?t:new Date(String(t));return Number.isNaN(s.getTime())?null:s}function xt(t){return t.toISOString().split("T")[0]}function Le(t){return t.toLocaleDateString(void 0,{timeZone:"UTC",month:"short",day:"numeric"})}function to(t){const a=t[t.length-1].date.getTime()-t[0].date.getTime()>180*yt,n=new Map;for(const o of t){const i=new Date(o.date);a&&i.setUTCDate(i.getUTCDate()-i.getUTCDay()),n.set(i.getTime(),(n.get(i.getTime())??0)+o.count)}return[...n.entries()].sort(([o],[i])=>o-i).map(([o,i])=>{const l=new Date(o);return{start:l,end:new Date(o+(a?7:1)*yt),count:i,label:`${l.getUTCMonth()+1}/${l.getUTCDate()}`,tooltip:a?`Week of ${Le(l)}`:Le(l)}})}function so(t){const s=l=>{const y=new Date(l);return y.setMinutes(0,0,0),y.getTime()},a=new Map;for(const l of t)a.set(s(l),(a.get(s(l))??0)+1);const n=Math.min(...a.keys()),o=Math.max(...a.keys()),i=[];for(let l=n;l<=o;l+=we){const y=new Date(l);i.push({start:y,end:new Date(l+we),count:a.get(l)??0,label:lt(y,"HH:mm"),tooltip:lt(y,"MMM d, HH:mm")})}return i}function no({entityId:t,organizationId:s,ownerSlug:a,eventTimes:n,selectedRange:o,onSelectRange:i}){const{data:l,isLoading:y,error:d}=Zs(s,{entityId:t},{slug:a}),r=j.useMemo(()=>(l??[]).map(p=>{const v=gt(p.date);return v?{date:v,count:p.count}:null}).filter(p=>p!==null).sort((p,v)=>p.date.getTime()-v.date.getTime()),[l]),c=j.useMemo(()=>{if(r.length===0)return[];if(r.length>1)return to(r);const[p]=r,v=xt(p.date),k=(n??[]).map(gt).filter(x=>x!==null&&xt(x)===v);return k.length===p.count?so(k):[]},[r,n]),g=j.useCallback(p=>{const v=c[p.dataIndex];v&&i&&i(v.start,v.end)},[c,i]),u=j.useCallback(p=>{if(i&&p.startValue!==void 0&&p.endValue!==void 0){const v=new Date(p.startValue),k=new Date(p.endValue);i(v,k)}},[i]),f=j.useMemo(()=>{if(c.length<2)return null;let p;if(o){const[v,k]=o,x=c.filter(S=>S.start<k&&S.end>v);x.length>0&&(p=[[{xAxis:x[0].label},{xAxis:x[x.length-1].label}]])}return{tooltip:{trigger:"axis",axisPointer:{type:"line"},formatter:v=>{const k=v[0];return`${c[k.dataIndex]?.tooltip}: ${k.value} items`}},grid:{left:50,right:20,top:20,bottom:60},xAxis:{type:"category",boundaryGap:!1,data:c.map(v=>v.label)},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 An(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:c.map(v=>v.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:p?{silent:!0,itemStyle:{color:"rgba(99, 102, 241, 0.1)"},data:p}:void 0}]}},[c,o]);if(y||d)return e.jsx("div",{className:ge(At,"p-4"),children:e.jsx("div",{className:"flex h-48 w-full items-center justify-center",children:y?e.jsx(Fn,{}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load timeline"})})});if(r.length===0)return null;if(!f){const[p]=r;return e.jsxs("p",{className:"text-xs text-muted-foreground",children:[p.count===1?"1 event":`All ${p.count} events`," on"," ",Le(p.date),"."]})}return e.jsx(oo,{option:f,onClick:g,onDataZoom:u})}function oo({option:t,onClick:s,onDataZoom:a}){const{chartRef:n,setOption:o}=Tn({onClick:s,onDataZoom:a});return j.useEffect(()=>{o(t,!0)},[t,o]),e.jsx("div",{"data-testid":"events-timeline",className:ge(At,"p-4 relative"),children:e.jsx("div",{ref:n,className:"h-48 w-full"})})}const ve={config:"Configuration",deployment:"Applies"};function ao({organizationId:t,ownerSlug:s,entityId:a,hideSourceFilter:n=!1,scopedEntityTypes:o,pinned:i,emptyState:l,toolbar:y=!1}){const{isAuthenticated:d,isReady:r}=Xs(),{isMember:c,isLoading:g}=Nt(),u=r&&d&&c,f=r&&(!d||!g&&!c),p=K(),v=$e(),k=Js(),{filters:x,updateFilters:S,clearFilters:w}=wt({parse:ye,serialize:Re,filterKeys:Ft,replace:!1,merge:Tt}),[F,I]=j.useState(x.searchQuery||""),[R,U]=j.useState(Fe(x)||n&&(a!=null||!!o?.length)),G=F.trim(),E=G.length>=3?G:void 0,N=St(E,1e3),T=j.useRef(!1);j.useEffect(()=>k.history.subscribe(({location:m,action:h})=>{const C=ye(new URLSearchParams(m.search)).searchQuery??"";!(h.type==="BACK"||h.type==="FORWARD"||h.type==="GO")&&T.current&&(C===(x.searchQuery??"")||C===(E??""))||(T.current=!1,I(C))}),[k.history,E,x.searchQuery]);const b=j.useMemo(()=>{const{afterOccurredAt:m,afterId:h,...C}=x;return dt({...C,...o?.length?{entityTypes:o}:{}})},[x,o]),P=S;j.useEffect(()=>{T.current&&(x.searchQuery||void 0)!==N&&S({searchQuery:N})},[N,S,x.searchQuery]);const Be=()=>{T.current=!1,I(""),n&&s?p({...Pe(s,v.search??{}),...a!==void 0&&!v.pathname.startsWith(`/${s}/events/`)?{to:v.pathname}:{}}):w()},se=Fe(dt(x)),ke=a===void 0,{data:Bt=[]}=en(r&&u?t:null),{data:Kt=[]}=tn(f?s:null),Ke=u?Bt:Kt,{data:Ge=[]}=sn(u&&t?{organizationId:t}:void 0),ne=wn(),oe=b.connectionIds,Ce=(oe?.length??0)>0,{data:Ve=[]}=nn(r&&u?t??"":"",{connectionIds:oe??void 0,enabled:!ne&&r&&u&&Ce}),Qe=b.feedIds,Se=(Qe?.length??0)>0,{data:Ue=[]}=_t(r&&u?t:null,{feedIds:Qe??void 0,enabled:r&&u&&Se}),We=j.useMemo(()=>ne?ne.groups.flatMap(m=>m.connections.map(h=>({id:h.id,display_name:h.display_name,connector_name:m.connector_name,connector_key:m.connector_key}))):Ve,[Ve,ne]),Ne=j.useMemo(()=>{const m=new Set(oe??[]);return[...new Set([...b.platforms??[],...We.filter(h=>m.has(h.id)).map(h=>h.connector_key)])]},[oe,We,b.platforms]),_e=j.useMemo(()=>Ue.map(m=>({connectorKey:m.connector_key,feedKey:m.feed_key})),[Ue]),Gt=j.useMemo(()=>Ce&&Ne.length===0||Se&&_e.length===0?[]:kn({connectors:Ke,entityTypes:Ge,selectedPlatforms:Ne,selectedFeeds:_e,selectedEntityTypes:b.entityTypes}),[Ke,b.entityTypes,Ce,Se,Ne,_e,Ge]),M=b.clientIds,ae=(M?.length??0)>0,{data:He=[]}=Sn(null,{enabled:r&&u&&ae}),ie=j.useMemo(()=>{if(!M)return[];const m=new Set(M);return _n(He).filter(h=>h.clientIds.some(C=>m.has(C)))},[M,He]),ze=j.useMemo(()=>{if(!ae||!M)return null;const m=ie.map(h=>h.title);return m.length>0?m.join(", "):M.length>1?`${M.length} client registrations`:"Client registration"},[ie,M,ae]),re=ie.length===1?ie[0]:null,Vt=s&&re?Dn(s,re.clientId):void 0,ce=b.mcpActivityId??null,{data:qe=[]}=Nn({enabled:r&&u&&ae&&!!ce,clientIds:M??[],limit:100}),Ye=j.useMemo(()=>{if(!ce)return null;const m=qe.find(C=>C.activityId===ce);if(!m)return"Selected conversation";const h=m.title?.trim();return h||(m.activityKind==="session"?"MCP session":m.clientId)},[ce,qe]),W=b.agentId,H=b.schedule,{data:Ze=[]}=Ln(W??void 0),Xe=j.useMemo(()=>!H||!W?null:Ze.find(h=>h.id===H)?.description?.trim()||"Scheduled task",[W,H,Ze]),{data:Qt}=on(r&&u?t:null,a),{data:Ut}=an(f&&!ke?s:null,a),Je=u?Qt:Ut,le=j.useMemo(()=>{const m=new Map;for(const h of Je||[]){const C=h.automation_name??"__global__";let _=m.get(C);_||(_={automationName:h.automation_name??null,classifiers:[]},m.set(C,_));const $=h.attribute_values||{},L=Object.keys($);let ue=null;const z={};for(const[q,B]of Object.entries($))if(B.parent)for(const[Ee,Y]of Object.entries(B.parent))ue=Ee,z[Y]||(z[Y]=[]),z[Y].push(q);const O=_.classifiers.find(q=>q.slug===h.slug);if(O){const q=new Set([...O.values,...L]);O.values=[...q];for(const[B,Ee]of Object.entries(z)){O.valuesByParentValue[B]||(O.valuesByParentValue[B]=[]);const Y=new Set([...O.valuesByParentValue[B],...Ee]);O.valuesByParentValue[B]=[...Y]}ue&&(O.parentSlug=ue)}else _.classifiers.push({slug:h.slug,name:h.name,values:L,parentSlug:ue,valuesByParentValue:z})}for(const h of m.values())h.classifiers.sort((C,_)=>C.parentSlug===null&&_.parentSlug!==null?-1:C.parentSlug!==null&&_.parentSlug===null?1:0);return[...m.values()]},[Je]),Wt=rn(r&&u?t:null,a,b,s),Ht=cn(f?s:null,a,b),zt=f?Ht:Wt,{data:Ie,isLoading:qt,error:Yt}=zt,Zt=j.useMemo(()=>Ie?.pages.flatMap(m=>m.content.map(h=>h.occurred_at)),[Ie]),et=Ie?.pages[0],Xt=(et?.content.length??0)>0,tt=le.some(m=>m.classifiers.length>0),Jt=ln(r&&u&&tt?t:null,a,b,s),es=dn(f&&tt?s:null,a,b),ts=(f?es:Jt).data?.classification_stats,ss=j.useCallback(()=>{P({beforeOccurredAt:void 0,beforeId:void 0,afterOccurredAt:void 0,afterId:void 0}),window.scrollTo({top:0,behavior:"smooth"})},[P]),ns=(m,h)=>{P({dateRange:[m,h]})},st=(m,h)=>{const C={...b.classificationFilters||{}};if(h.length>0)C[m]=h;else{delete C[m];for(const _ of le)for(const $ of _.classifiers)$.parentSlug===m&&delete C[$.slug]}P({classificationFilters:C})},os=(m,h)=>{const C=b.classificationFilters?.[m]||[];st(m,C.includes(h)?C.filter(_=>_!==h):[...C,h])},as=m=>st(m,[]);if(Yt)return e.jsx(un,{label:"knowledge"});const nt=!r||d&&g||u&&!t||qt,de={fields:[],chips:[]};for(const m of le)for(const h of m.classifiers){const C=b.classificationFilters?.[h.slug]??[],_=h.parentSlug?b.classificationFilters?.[h.parentSlug]??[]:void 0,$=_?[...new Set(_.flatMap(L=>h.valuesByParentValue[L]??[]))]:h.values;$.length>0&&de.fields.push({key:`clf:${h.slug}`,label:h.name,group:m.automationName??"Classifiers",icon:e.jsx(mn,{className:"h-4 w-4"}),editor:X({searchPlaceholder:`Search ${h.name.toLowerCase()}...`,options:$.map(L=>({value:L,label:L,count:ts?.[h.slug]?.[L]})),selected:C,multiple:!0,onSelect:L=>os(h.slug,L)})})}for(const[m,h]of Object.entries(b.classificationFilters??{})){if(h.length===0)continue;const C=le.flatMap(_=>_.classifiers).find(_=>_.slug===m);de.chips.push({id:`clf:${m}`,field:`clf:${m}`,label:C?.name??m,op:h.length>1?"is any of":"is",value:h.join(", "),onRemove:()=>as(m)})}const is=[b.contentIds?.length?me({id:"contentIds",label:b.contentIds.length>1?"Events":"Event",value:`#${b.contentIds.join(", #")}`,onRemove:()=>P({contentIds:void 0})}):null,Ye?me({id:"mcpActivityId",label:"Conversation",value:Ye,onRemove:()=>P({mcpActivityId:void 0})}):null,ze?me({id:"clientIds",label:"Connected app",value:ze,sourceLink:Vt,details:M&&M.length>0?e.jsx(Gn,{ownerSlug:s,clientIds:M,linkedUser:re?.linkedUser,linkedUserEntitySlug:re?.linkedUserEntitySlug}):void 0,onRemove:()=>P({clientIds:void 0})}):null,Xe?me({id:"schedule",label:"Schedule",value:Xe,sourceLink:s&&W&&H?Kn(s,W,H):void 0,onRemove:()=>P({schedule:void 0,runIds:void 0})}):null,...b.eventCategory?[ve[b.eventCategory]?{id:"event-category",label:ve[b.eventCategory],value:"",onRemove:()=>P({eventCategory:void 0,semanticTypes:void 0})}:{id:"event-category",label:"Category",op:"is",value:b.eventCategory,onRemove:()=>P({eventCategory:void 0})}]:[],...b.resourceKind||b.resourceId?[{id:"resource",label:"Resource",op:"is",value:`${b.resourceKind}: ${b.resourceId}`,onRemove:()=>P({resourceKind:void 0,resourceId:void 0})}]:[],...de.chips].filter(m=>m!=null),rs=!!(u&&a&&t),cs=se?null:i?.rows,ot={fields:[],chips:[]};if(ke&&u)for(const[m,h,C]of[["config",ve.config,kt],["deployment",ve.deployment,fn]]){const _=x.eventCategory===m;ot.fields.push({key:`category:${m}`,label:h,icon:e.jsx(C,{className:"h-4 w-4"}),editor:{kind:"toggle",checked:_,onToggle:()=>P({eventCategory:_?void 0:m,semanticTypes:_?void 0:[Mt],resourceKind:void 0,resourceId:void 0})}})}const at={quickFilters:ot,toolbar:y,filterTrailing:rs?e.jsxs(Rt,{variant:"ghost",size:"sm",className:"h-8 text-muted-foreground","aria-pressed":R,onClick:()=>U(m=>!m),children:[e.jsx(hn,{className:"mr-1.5 h-3.5 w-3.5"}),"Timeline"]}):void 0,onClearFilters:Be,filters:b,onFiltersChange:P,eventKinds:Gt,searchQuery:F,onSearchChange:m=>{T.current=!0,I(m)},extraFields:de.fields,drillChips:is},ls=!nt&&!!et&&!Xt&&!se,ds=d?u?"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=!!(u&&s);return e.jsx(pn,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:n?"sticky top-0 z-10 -mx-4 bg-background px-4 pb-2 lg:-mx-6 lg:px-6":void 0,children:n&&s?e.jsx(Dt,{...at,ownerSlug:s}):e.jsx(Ot,{...at})}),R&&u&&a&&t&&e.jsx(no,{entityId:a,organizationId:t,ownerSlug:s||"",eventTimes:Zt,selectedRange:b.dateRange||void 0,onSelectRange:ns}),i?.needsYou,cs,nt?e.jsx(En,{}):ls?l??e.jsx(ut,{icon:mt,title:"No activity yet",description:ds,actionLabel:it?"Add a connector":void 0,onAction:it&&s?()=>void p({to:"/$owner/connectors/create",params:{owner:s}}):void 0}):e.jsx(In,{organizationId:t,ownerSlug:s,entityId:a,filters:b,showEntityLinks:ke,groupStretches:!0,onGoToLatest:b.beforeOccurredAt?ss:void 0,hiddenPinned:i?.hidden,emptyState:e.jsx(ut,{icon:mt,title:"No results found",description:"Try adjusting your filters to find what you are looking for",actionLabel:se?"Clear filters":void 0,onAction:se?Be:void 0})})]})})}function io({record:t,ownerSlug:s}){const a=$e(),n=K(),{filters:o,updateFilters:i}=wt({parse:ye,serialize:Re,filterKeys:Ft,replace:!1,merge:Tt}),l=Fe({...o,platforms:void 0,connectionIds:void 0,feedIds:void 0})||o.sortBy!=null&&o.sortBy!=="date"||o.sortOrder!=null&&o.sortOrder!=="desc",y=()=>{n({...Pe(s,a.search??{}),...a.pathname.startsWith(`/${s}/events/`)?{}:{to:a.pathname}})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Dt,{ownerSlug:s,sourceRead:!0,filters:o,onFiltersChange:i,searchQuery:o.searchQuery??"",onSearchChange:d=>i({searchQuery:d}),onClearFilters:y}),e.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."}),l?e.jsxs("div",{role:"alert",className:"space-y-2 rounded-md border p-3 text-sm",children:[e.jsx("p",{children:"Some selected filters aren't supported for live activity. Clear them to see results."}),e.jsx(Rt,{variant:"outline",size:"sm",onClick:()=>{const d=Re({platforms:o.platforms,connectionIds:o.connectionIds,feedIds:o.feedIds}),r={...Pe(s,a.search??{}).search,...d};n({to:a.pathname,search:r})},children:"Clear unsupported filters"})]}):e.jsx(Cn,{record:t,orgContext:{slug:s},filters:o})]})}function So({entity:t,organizationId:s,ownerSlug:a}){const n=t.is_derived?e.jsx(io,{ownerSlug:a,record:{type:t.entity_type,key:t.slug}}):e.jsx(ao,{organizationId:s,ownerSlug:a,entityId:typeof t.id=="number"?t.id:void 0,hideSourceFilter:!0});return e.jsx(Pn,{organizationId:s,children:t.entity_type==="$member"?e.jsx(Rn,{children:n}):n})}export{ao as E,Pn as M,So as R};
|
|
2
|
+
//# sourceMappingURL=record-activity-DnRVOrG2.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as s,j as c}from"./index-
|
|
2
|
-
//# sourceMappingURL=record-session-
|
|
1
|
+
import{r as s,j as c}from"./index-DByaMzsG.js";function u(){const o=new Map,e=new Set,n=()=>{for(const t of e)t()};return{get:t=>o.get(t),set:t=>{o.get(t.entity.id)!==t&&(o.set(t.entity.id,t),n())},remove:t=>{o.delete(t)&&n()},subscribe:t=>(e.add(t),()=>e.delete(t))}}const r=s.createContext(null);function d({children:o}){const[e]=s.useState(u);return c.jsx(r.Provider,{value:e,children:o})}function f(o){const e=s.useContext(r);s.useLayoutEffect(()=>{e?.set(o)});const n=o.entity.id;s.useEffect(()=>()=>e?.remove(n),[e,n])}const i=()=>()=>{};function S(o){const e=s.useContext(r);return s.useSyncExternalStore(e?.subscribe??i,()=>e?.get(o),()=>e?.get(o))}export{d as R,f as a,S as u};
|
|
2
|
+
//# sourceMappingURL=record-session-CAmGHMyM.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{fb as iB,ev as oB,j as V,dB as kI,dC as OI,bS as sB,dD as NI,fG as F_,dA as lB,i as pd,fH as uB,r as ze,dU as fB,fI as vB,fJ as cB,dL as hB,fe as vm,aw as BI,L as dB,c as pB,u as gB,eF as yB,eG as mB,m as pp,B as Wu,A as _B,fK as SB,ac as VI,fz as xB,fL as wB,fM as bB,k as CB,C as TB,e6 as AB,eU as MB,bG as DB}from"./index-DByaMzsG.js";import{S as cm,i as hm,t as dm,f as IB}from"./schema-value-zTJGE4eh.js";import{c as LB,d as PB,b as RB,a as EB,C as kB}from"./card-DtLIFq7D.js";import{T as OB,a as NB,b as gp,c as BB,d as VB,e as Rx}from"./table-C637cQxG.js";function zB(r){return String(r??"").split(/[_-]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function FB(r,e){return e.title||e.description||zB(r)}function GB(r){return r.title&&r.description&&r.description!==r.title?r.description:void 0}function HB({control:r}){const e=[r.set_by,r.set_at?oB(r.set_at):null].filter(Boolean).join(" · ");return V.jsxs(kI,{children:[V.jsx(OI,{asChild:!0,children:V.jsx("button",{type:"button",className:"shrink-0 text-emerald-600 hover:text-emerald-500 dark:text-emerald-400","aria-label":"Set by a person",children:V.jsx(sB,{className:"h-3 w-3"})})}),V.jsxs(NI,{className:"max-w-xs space-y-1",children:[V.jsx("div",{className:"text-xs font-medium",children:"Set by a person"}),V.jsx("div",{className:"text-[11px] text-primary-foreground/70",children:"Automations ask for approval before changing it."}),r.note?V.jsx("div",{className:"text-xs text-primary-foreground/90",children:r.note}):null,e?V.jsx("div",{className:"text-[11px] text-primary-foreground/70",children:e}):null]})]})}function UB(r){const e=iB(r);return e===null||e===""?void 0:e}function WB(r){return r.parent_id&&r.parent_slug&&r.parent_entity_type?[{entity_type:r.parent_entity_type,slug:r.parent_slug},{entity_type:r.entity_type,slug:r.slug}]:[{entity_type:r.entity_type,slug:r.slug}]}function Une(r){return typeof r=="string"?JSON.parse(r):r??{}}function $B(r){return r.type==="array"&&!!r.items&&(r.items?.type==="object"||!!r.items?.properties)}function zI(r){return(r.type==="object"||!!r.properties)&&Object.keys(r.properties??{}).length>0}function YB(r){const e=r?.properties;return F_(e).filter(([,t])=>!("x-measure"in t)&&!("x-dimension"in t)).map(([t,n])=>({key:t,prop:n}))}function pm(r){return r.label??r.prop["x-table-label"]??FB(r.key,r.prop)}function FI(r){try{return UB(r)}catch{return r instanceof uB?r.text:r}}function gm(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function ym(r,e){const t=FI(e);return t==null?!1:typeof t=="string"?t.trim().length>0:Array.isArray(t)?t.length>0:gm(t)?zI(r.prop)?F_(r.prop.properties).some(([n,a])=>ym({prop:a},t[n])):Object.entries(t).some(([n,a])=>ym({prop:{}},a)):!0}function GI(r,e){return r.filter(t=>ym(t,e[t.key]))}function XB({value:r,prop:e,ownerSlug:t,orgContext:n}){const a=e["x-link-entity-type"],i=e["x-link-lookup-field"]||"slug",{data:o}=fB(a,n,{limit:vB}),s=c=>{const h=o?.entities.find(d=>{const p=i==="slug"?d.slug:d.metadata?.[i];return p!=null&&String(p)===c});return h?{label:h.name,to:hB(t,WB(h))}:void 0},l=Array.isArray(r)?r:[r],u=c=>i==="slug"&&o!==void 0&&ZB(c)&&!s(String(c));if(!l.some(u))return V.jsx(cm,{value:r,prop:e,resolveLink:s});const f=[...new Set(l.map(String))],v=new Map(l.map(c=>[String(c),c]));return V.jsx("span",{className:"inline-flex flex-wrap gap-x-2 gap-y-1",children:f.map(c=>v.get(c)).map(c=>u(c)?V.jsx(jB,{entityType:a,recordKey:String(c),ownerSlug:t},String(c)):V.jsx(cm,{value:c,prop:Array.isArray(r)?e.items??e:e,resolveLink:s},String(c)))})}function ZB(r){const e=typeof r=="number"?String(r):r;return typeof e=="string"&&e.trim()!==""&&!/[/?#]/.test(e)}function jB({entityType:r,recordKey:e,ownerSlug:t}){const n=vm(t,[{entity_type:r,slug:e}]),{data:a,isError:i}=BI(n,{slug:t}),o=a?.entity,s=o&&o.entity_type===r&&o.slug===e;return i||a&&!s?V.jsx("span",{className:"text-muted-foreground",title:"This record is not available",children:e}):V.jsx(dB,{to:n,className:"text-primary hover:underline",onClick:l=>l.stopPropagation(),children:s?o.name:e})}function qB({field:r,value:e,context:t}){if($B(r.prop)&&(e==null||Array.isArray(e))){const n=Array.isArray(e)?e.length:0,a=`${n} ${n===1?"item":"items"}`,i=t.dirtyKeys?.includes(r.key)??!1,o="inline-flex items-center gap-1 rounded-md bg-muted px-1.5 py-0.5 text-xs tabular-nums";if(!t.openField)return V.jsx("span",{className:o,children:a});const s=t.openFieldKey===r.key;return V.jsxs("button",{type:"button","aria-pressed":s,"aria-label":`${pm(r)}: ${a}${i?", unsaved changes":""}`,className:pd(o,"hover:bg-muted/70 hover:text-foreground",s&&"ring-1 ring-primary"),onClick:()=>t.openField?.(r),children:[a,i?V.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"· edited"}):null]})}return r.prop["x-link-entity-type"]&&t.orgContext&&e!=null?V.jsx(XB,{value:e,prop:r.prop,ownerSlug:t.ownerSlug,orgContext:t.orgContext}):V.jsx(cm,{value:e,prop:r.prop})}function Ex({field:r,control:e,labelId:t}){const n=GB(r.prop);return V.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-1 gap-y-0.5",children:[V.jsx("span",{id:t,className:"min-w-0 break-words",children:pm(r)}),n?V.jsxs(kI,{children:[V.jsx(OI,{asChild:!0,children:V.jsx("button",{type:"button",className:"shrink-0 text-muted-foreground/70 hover:text-foreground","aria-label":`About ${pm(r)}: ${n}`,children:V.jsx(cB,{className:"h-3 w-3"})})}),V.jsx(NI,{className:"max-w-xs",children:n})]}):null,e?V.jsx(HB,{control:e}):null]})}function HI({field:r,value:e,context:t,nested:n}){const a=ze.useId(),i=n?void 0:t.controls?.[r.key],o=FI(e);if(zI(r.prop)&&(o==null||gm(o))){const s=gm(o)?o:{},l=GI(F_(r.prop.properties).map(([u,f])=>({key:u,prop:f})),s);return V.jsxs("fieldset",{"aria-labelledby":a,className:"m-0 min-w-0 space-y-2 border-0 p-0",children:[V.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:V.jsx(Ex,{field:r,control:i,labelId:a})}),V.jsx("dl",{className:"space-y-2 border-l border-border pl-3",children:l.map(u=>V.jsx(HI,{field:u,value:s[u.key],context:t,nested:!0},u.key))})]})}return V.jsxs("div",{className:"grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)] items-baseline gap-x-3",children:[V.jsx("dt",{className:"text-muted-foreground",children:V.jsx(Ex,{field:r,control:i,labelId:a})}),V.jsx("dd",{"aria-labelledby":a,className:pd("min-w-0 [overflow-wrap:anywhere]",r.numeric&&"tabular-nums"),children:V.jsx(qB,{field:r,value:o,context:t})})]})}function KB({fields:r,values:e,context:t,fieldLimit:n}){const a=GI(r,e);return a.length===0?V.jsx("p",{className:"text-sm text-muted-foreground",children:r.length===0?"This type declares no fields.":"No details have been added yet."}):V.jsx(lB,{delayDuration:200,children:V.jsx("dl",{className:"space-y-2.5 text-sm leading-5",children:(n===void 0?a:a.slice(0,n)).map(i=>V.jsx(HI,{field:i,value:e[i.key],context:t,nested:!1},i.key))})})}function JB(r,e){if(typeof r!="string"||!e||e.length===0)return r;const t=r.trim();if(e.includes(t))return t;try{const n=JSON.parse(t);if(typeof n=="string"&&e.includes(n))return n}catch{}return r}function QB(r,e){if(!r)return{};const t=e?.properties;return t?Object.fromEntries(Object.entries(r).map(([n,a])=>[n,JB(a,t[n]?.enum)])):{...r}}function Wne(r){return{href:"",key:`record-peer:${r.record?JSON.stringify([r.record.type,r.record.key]):r.entityId}`,title:r.name?.trim()||"Record",recordPeer:{...r.record?{record:r.record}:{entityId:r.entityId},ownerSlug:r.ownerSlug,orgContext:r.orgContext}}}function $ne({target:r}){const e=pB(),t=gB(),n=yB(r.entityId,r.orgContext),a=r.record?vm(r.ownerSlug,[{entity_type:r.record.type,slug:r.record.key}]):"",i=BI(a,r.orgContext),o=r.record?i.data?.entity:n.data,{isLoading:s,isError:l}=r.record?i:n,{data:u}=mB(o?.entity_type??"",r.orgContext),[f,v]=ze.useState(!1),[c,h]=ze.useState(!1);if(s)return V.jsxs("div",{className:"space-y-3 px-5 py-5",children:[V.jsx(pp,{className:"h-5 w-2/3"}),V.jsx(pp,{className:"h-4 w-full"}),V.jsx(pp,{className:"h-4 w-full"})]});if(l||!o)return V.jsx("p",{className:"px-5 py-5 text-sm text-muted-foreground",children:"This record is not available. It may have been deleted, or you may not have access to it."});const d=u?.metadata_schema,p=async()=>{v(!0),h(!1);try{const g=r.record?[{entity_type:r.record.type,slug:r.record.key}]:await SB(r.entityId,r.orgContext);t?.close(),await e({to:vm(r.ownerSlug,g)})}catch{h(!0)}finally{v(!1)}};return V.jsxs("article",{className:"space-y-4 px-5 py-4",children:[V.jsxs("div",{className:"flex items-start justify-between gap-3",children:[V.jsxs("div",{className:"min-w-0",children:[V.jsx("p",{className:"truncate text-sm font-medium",children:o.name}),V.jsx("p",{className:"text-xs text-muted-foreground",children:u?.name??o.entity_type})]}),V.jsxs(Wu,{type:"button",variant:"ghost",size:"sm",className:"h-7 shrink-0 gap-1 px-2 text-muted-foreground hover:text-foreground",disabled:f,"aria-busy":f,onClick:()=>void p(),children:["Open record",V.jsx(_B,{className:"h-3.5 w-3.5"})]})]}),c?V.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Could not open this record. Try again."}):null,V.jsx(KB,{fields:YB(d),values:QB(o.metadata??{},d),context:{ownerSlug:r.ownerSlug,orgContext:r.orgContext}})]})}const eV=r=>r!=null;function tV(r,e,t=eV){let n=r;for(const a of e.replace(/\[(\d+)\]/g,".$1").split(".")){if(!t(n))return;n=n[a]}return n}function rV(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 nV=new Set(["type","children","props","path","fallback","key"]);function aV(r,e){const t={};for(const[n,a]of Object.entries(r))nV.has(n)||(t[n]=a);return Object.assign(t,e)}/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -92,5 +92,5 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
92
92
|
*
|
|
93
93
|
* @license MIT
|
|
94
94
|
*/function sm(r,e){return r?Tne(r)?ze.createElement(r,e):r:null}function Tne(r){return Ane(r)||typeof r=="function"||Mne(r)}function Ane(r){return typeof r=="function"&&(()=>{const e=Object.getPrototypeOf(r);return e.prototype&&e.prototype.isReactComponent})()}function Mne(r){return typeof r=="object"&&typeof r.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(r.$$typeof.description)}function Dne(r){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...r},[t]=ze.useState(()=>({current:Sne(e)})),[n,a]=ze.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 PI=12;function lm(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function um(r){return r.replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function Ine(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):Ine(r)}const RI=({value:r,openLink:e})=>{if(!hm(r))return V.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 V.jsxs(Wu,{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:[V.jsx(VI,{className:"mr-1 h-3 w-3 shrink-0"}),V.jsx("span",{className:"truncate",children:t})]})};function Lne({page:r,pageCount:e,onChange:t}){return V.jsxs("div",{className:"mt-2 flex items-center justify-end gap-1.5",children:[V.jsxs(Wu,{type:"button",size:"sm",variant:"outline",disabled:r===0,onClick:()=>t(r-1),children:[V.jsx(CB,{className:"h-3.5 w-3.5"}),V.jsx("span",{className:"sr-only",children:"Previous page"})]}),V.jsxs("span",{className:"text-muted-foreground text-xs",children:[r+1," / ",e]}),V.jsxs(Wu,{type:"button",size:"sm",variant:"outline",disabled:r+1>=e,onClick:()=>t(r+1),children:[V.jsx(TB,{className:"h-3.5 w-3.5"}),V.jsx("span",{className:"sr-only",children:"Next page"})]})]})}function Pne({rows:r,columns:e,openLink:t,stateKey:n="table",viewState:a,onViewStateChange:i,renderCell:o,renderStructuredValue:s,pageSize:l}){const u=ze.useMemo(()=>e?null:[...new Set(r.flatMap(L=>Object.keys(L)))],[e,r]),f=ze.useMemo(()=>e?.map(L=>L.name)??(u??[]).slice(0,PI),[e,u]),v=u?u.slice(PI):[],c=a?.[`${n}.sort.column`],h=a?.[`${n}.sort.desc`],d=typeof c=="string"&&c?[{id:c,desc:h===!0}]:[],[p,g]=ze.useState(d),[y,m]=ze.useState(null);ze.useEffect(()=>{g(d)},[c,h]);function _(L){const I=new Set(f);return Object.keys(L).filter(P=>!I.has(P))}const S=ze.useMemo(()=>f.map(L=>({id:L,accessorFn:I=>I[L],header:um(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(lm(R)||Array.isArray(R))return E?V.jsx("div",{className:"max-w-md break-words",children:s?s(R,t):$i(R)}):V.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 V.jsxs(Wu,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:z=>{z.stopPropagation(),t(R)},children:[V.jsx(VI,{className:"mr-1 h-3.5 w-3.5"}),"Open"]});if(typeof R=="string"&&hm(R))return V.jsx(RI,{value:R,openLink:t});if(E)return V.jsx("span",{className:"break-words whitespace-pre-wrap",children:$i(R)});const k=$i(R);return V.jsx("span",{className:"block max-w-80 truncate",title:k,children:k})}})),[f,t,y,o,s]),x=a?.[`${n}.page`],[w,b]=ze.useState(typeof x=="number"?Math.max(0,x):0);ze.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=Dne({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:xne(),getSortedRowModel:Cne(),...l?{getPaginationRowModel:bne(),onPaginationChange:L=>{const I=typeof L=="function"?L({pageIndex:A,pageSize:l}):L;b(I.pageIndex),i?.(`${n}.page`,I.pageIndex)}}:{}});return V.jsxs("div",{children:[V.jsx("div",{className:"overflow-hidden rounded-md border border-border/70",children:V.jsxs(OB,{className:"text-xs",children:[V.jsx(NB,{className:"bg-muted/50",children:D.getHeaderGroups().map(L=>V.jsx(gp,{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 V.jsx(BB,{"aria-sort":E?P==="asc"?"ascending":P==="desc"?"descending":"none":void 0,className:"h-8 whitespace-nowrap px-2",children:E?V.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:[sm(I.column.columnDef.header,I.getContext()),P==="asc"?V.jsx(xB,{className:"h-3 w-3"}):P==="desc"?V.jsx(wB,{className:"h-3 w-3"}):V.jsx(bB,{className:"h-3 w-3 opacity-45"})]}):sm(I.column.columnDef.header,I.getContext())},I.id)})},L.id))}),V.jsx(VB,{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 lm(O)||Array.isArray(O)});return V.jsxs(ze.Fragment,{children:[V.jsx(gp,{className:pd("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=>V.jsx(Rx,{className:"p-2 align-top",children:sm(E.column.columnDef.cell,E.getContext())},E.id))}),I&&P.length>0?V.jsx(gp,{className:"border-b last:border-b-0 bg-muted/10",children:V.jsx(Rx,{colSpan:L.getVisibleCells().length,className:"p-2",children:V.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1",children:P.map(E=>{const O=L.original[E];return V.jsxs("div",{children:[V.jsxs("span",{className:"text-muted-foreground capitalize",children:[um(E),":"]})," ",lm(O)||Array.isArray(O)?s?s(O,t):V.jsx("span",{className:"break-words whitespace-pre-wrap",children:$i(O)}):(()=>{const k=o?.(O,E);return k??(typeof O=="string"&&hm(O)?V.jsx(RI,{value:O,openLink:t}):V.jsx("span",{className:"break-words whitespace-pre-wrap",children:$i(O)}))})()]},E)})})})}):null]},L.id)})})]})}),v.length>0?V.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(um).join(", "),v.length>4?`, +${v.length-4} more`:""]}):null,l&&T>1?V.jsx(Lne,{page:A,pageCount:T,onChange:L=>D.setPageIndex(L)}):null]})}function Rne(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 dm(r,a)}function fm(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 Ene(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 EI={div:({children:r,...e})=>V.jsx("div",{...e,children:r}),span:({children:r,...e})=>V.jsx("span",{...e,children:r}),p:({children:r,...e})=>V.jsx("p",{...e,children:r}),h1:({children:r,...e})=>V.jsx("h1",{...e,children:r}),h2:({children:r,...e})=>V.jsx("h2",{...e,children:r}),h3:({children:r,...e})=>V.jsx("h3",{...e,children:r}),h4:({children:r,...e})=>V.jsx("h4",{...e,children:r}),ul:({children:r,...e})=>V.jsx("ul",{...e,children:r}),ol:({children:r,...e})=>V.jsx("ol",{...e,children:r}),li:({children:r,...e})=>V.jsx("li",{...e,children:r}),table:({children:r,...e})=>V.jsx("table",{...e,children:r}),thead:({children:r,...e})=>V.jsx("thead",{...e,children:r}),tbody:({children:r,...e})=>V.jsx("tbody",{...e,children:r}),tr:({children:r,...e})=>V.jsx("tr",{...e,children:r}),th:({children:r,...e})=>V.jsx("th",{...e,children:r}),td:({children:r,...e})=>V.jsx("td",{...e,children:r}),card:({children:r,className:e,...t})=>V.jsx(kB,{className:e,...t,children:r}),"card-header":({children:r,className:e,...t})=>V.jsx(EB,{className:e,...t,children:r}),"card-title":({children:r,className:e,...t})=>V.jsx(RB,{asChild:!0,className:e,children:V.jsx("h3",{...t,children:r})}),"card-description":({children:r,className:e,...t})=>V.jsx(PB,{className:e,...t,children:r}),"card-content":({children:r,className:e,...t})=>V.jsx(LB,{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||DB.isValidElement(s)?s:Array.isArray(s)?s.map(i):String(s),o=i(r);return V.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 V.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})=>V.jsxs("label",{className:`flex flex-col gap-1 text-sm ${r||""}`,children:[e?V.jsx("span",{className:"font-medium",children:String(e)}):null,V.jsxs("select",{className:"h-10 rounded-md border border-input bg-background px-3",onChange:a??i,defaultValue:"",...o,children:[t?V.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 V.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 V.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})=>V.jsx("h5",{className:`mb-1 font-medium leading-none tracking-tight ${e||""}`,...t,children:r}),"alert-description":({children:r,className:e,...t})=>V.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 V.jsxs("div",{className:`flex items-center gap-2 ${r||""}`,...n,children:[V.jsx("div",{className:"relative h-4 flex-1 overflow-hidden rounded-full bg-secondary",children:V.jsx("div",{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-a}%)`}})}),V.jsx("span",{className:"text-xs font-medium tabular-nums text-muted-foreground shrink-0",children:t?String(t):`${a}%`})]})},strong:({children:r,...e})=>V.jsx("strong",{...e,children:r}),b:({children:r,...e})=>V.jsx("strong",{...e,children:r}),em:({children:r,...e})=>V.jsx("em",{...e,children:r}),link:({children:r,className:e,href:t,...n})=>{const a=String(t??""),i=/^https?:\/\//i.test(a);return V.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})=>V.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})=>V.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})=>V.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})=>V.jsxs("div",{className:`flex flex-col gap-0.5 ${e||""}`,...a,children:[V.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:String(t??"")}),V.jsx("span",{className:"text-sm break-words",children:r??(n==null?"—":String(n))})]}),separator:({className:r,...e})=>V.jsx("div",{className:`shrink-0 bg-border h-[1px] w-full ${r||""}`,...e}),markdown:({content:r,className:e})=>V.jsx("div",{className:`max-w-none text-sm space-y-2 ${e||""}`,children:V.jsx(MB,{text:String(r??"")})}),layout:({children:r,className:e,direction:t="vertical"})=>V.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 V.jsx("div",{className:`grid gap-4 ${e||""}`,style:{gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`},children:r})},metric:({label:r,value:e,className:t})=>V.jsxs("div",{className:pd(AB,"p-4",t),children:[V.jsx("p",{className:"text-sm text-muted-foreground",children:String(r??"")}),V.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})=>V.jsx(Lre,{data:fm(r,a,i),height:e,xLabel:t,yLabel:n}),"line-chart":({data:r,height:e,xLabel:t,yLabel:n,labelField:a,valueField:i})=>V.jsx(Pre,{data:fm(r,a,i),height:e,xLabel:t,yLabel:n}),"area-chart":({data:r,height:e,xLabel:t,yLabel:n,labelField:a,valueField:i})=>V.jsx(Ire,{data:fm(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})=>V.jsx(Rre,{data:Ene(r,o,s),height:e,showLabel:t,showLegend:n,radius:a,highlightName:i}),sparkline:({data:r,height:e,width:t,color:n,trend:a})=>V.jsx(Ere,{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})=>V.jsx(kre,{data:r,series:e,height:t,xLabel:n,yLabel:a,onSeriesClick:i,onDateRangeSelect:o})},kne=new Set(["urgency","severity","sentiment","trend","status","priority"]),One={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 Nne(r,e){if(r==null)return V.jsx("span",{className:"text-muted-foreground",children:"–"});const t=String(r);if(t.startsWith("http://")||t.startsWith("https://"))return V.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 V.jsxs("a",{href:`https://reddit.com/r/${r}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:["r/",r]});if(kne.has(e)&&typeof r=="string"){const n=One[r.toLowerCase()]??"bg-secondary text-secondary-foreground border-border",a=r.replace(/[_-]/g," ").replace(/\b\w/g,i=>i.toUpperCase());return V.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"?V.jsx("span",{className:"font-mono tabular-nums",children:r}):typeof r=="boolean"?V.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"}):V.jsx("span",{className:"whitespace-pre-wrap",children:t})}function Bne({rows:r,columns:e,title:t}){return V.jsxs("div",{className:"space-y-2",children:[t&&V.jsx("h4",{className:"text-sm font-semibold",children:t}),V.jsx(Pne,{rows:r,columns:e.map(n=>({name:n})),openLink:()=>{},renderCell:(n,a)=>Nne(n,a)})]})}const wc=tV;function Du(r,e,t){if(r.type==="text")return r.content;if(r.type==="data"){const u=r,f=wc(e.data,u.path),v=f!==void 0?f:u.fallback,c=IB(v,u.format);if(c.length>100&&(c.includes(`
|
|
95
|
-
`)||/[#*-]/.test(c))){const h=EI.markdown;return h?V.jsx(h,{content:c}):c}return c}if(r.type==="if"){const u=r;return wc(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=wc(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]??EI[n.type];if(!a)return console.warn(`Unknown component type: ${n.type}`),null;const i=u=>rV(u,e.actions,f=>wc(e.data,f)),o=aV(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;if(e.actionsDisabled){s.disabled=!0;continue}let v=i(f);if(typeof v!="function"&&e.onAction){const c=dm(f,s.value);c&&e.interactions?.[c.action]&&(v=(...h)=>e.onAction?.(Rne(f,h,s.value)??c))}if(typeof v!="function"){dm(f,s.value)&&(s.disabled=!0),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 V.jsx(Bne,{rows:u,columns:f,title:v},t)}const l=n.children?.map((u,f)=>Du(u,e,f));return V.jsx(a,{...s,children:l},t)}function Vne(r,e,t,n,a,i,o){const s={data:e,actions:t,onAction:n,interactions:a,components:i,actionsDisabled:o};return Du(r.root,s)}function Yne({template:r,data:e,actions:t,onAction:n,interactions:a,components:i,actionsDisabled:o}){return V.jsx(V.Fragment,{children:Vne(r,e,t,n,a,i,o)})}export{HB as F,Yne as J,bl as L,KB as R,Ere as S,Pre as a,Dne as b,YB as c,
|
|
96
|
-
//# sourceMappingURL=renderer-
|
|
95
|
+
`)||/[#*-]/.test(c))){const h=EI.markdown;return h?V.jsx(h,{content:c}):c}return c}if(r.type==="if"){const u=r;return wc(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=wc(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]??EI[n.type];if(!a)return console.warn(`Unknown component type: ${n.type}`),null;const i=u=>rV(u,e.actions,f=>wc(e.data,f)),o=aV(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;if(e.actionsDisabled){s.disabled=!0;continue}let v=i(f);if(typeof v!="function"&&e.onAction){const c=dm(f,s.value);c&&e.interactions?.[c.action]&&(v=(...h)=>e.onAction?.(Rne(f,h,s.value)??c))}if(typeof v!="function"){dm(f,s.value)&&(s.disabled=!0),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 V.jsx(Bne,{rows:u,columns:f,title:v},t)}const l=n.children?.map((u,f)=>Du(u,e,f));return V.jsx(a,{...s,children:l},t)}function Vne(r,e,t,n,a,i,o){const s={data:e,actions:t,onAction:n,interactions:a,components:i,actionsDisabled:o};return Du(r.root,s)}function Yne({template:r,data:e,actions:t,onAction:n,interactions:a,components:i,actionsDisabled:o}){return V.jsx(V.Fragment,{children:Vne(r,e,t,n,a,i,o)})}export{HB as F,Yne as J,bl as L,KB as R,Ere as S,Pre as a,Dne as b,YB as c,qB as d,WB as e,sm as f,xne as g,FB as h,GB as i,zB as j,UB as k,Wne as l,$ne as m,JB as n,QB as o,Une as p,GI as q,$B as r,pm as s,Mx as u};
|
|
96
|
+
//# sourceMappingURL=renderer-olRv_HMI.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ae as v,r as a,j as e,L as h,af as j,a4 as y,ag as N}from"./index-DByaMzsG.js";import{C as k,a as C,b as S,c as L}from"./card-DtLIFq7D.js";function R(){const{token:n,error:x}=v.useSearch(),[o,p]=a.useState(""),[i,f]=a.useState(""),[d,s]=a.useState(null),[l,c]=a.useState(!1),[u,g]=a.useState(!1),w=async t=>{if(t.preventDefault(),!n){s("This reset link is invalid or expired.");return}if(o.length<8){s("Password must be at least 8 characters.");return}if(o!==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:o})});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:o,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-B9_xi8Pq.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=run-initiator-
|
|
1
|
+
import{fA as R,fB as w,fC as k,fo as L,r as h,j as n,m as j,bc as A,ej as S,al as C,B as I,e7 as M,M as D,cJ as E,L as _,eI as T}from"./index-DByaMzsG.js";import{a as B}from"./list-skeleton-DsYGUHxi.js";import{s as F}from"./subDays-D8nHthaS.js";import{u as O}from"./use-automations-CgWNoYio.js";import{u as Y}from"./clients-xnzZeEdZ.js";function z(e,s){return R(k(e,e),w(e))}function V(e,s){return L(k(e,e),w(e))}function q(e,s){return L(k(e,e),F(w(e),1))}function J({onIntersect:e,onLeave:s,enabled:t,rootMargin:r="400px"}){const a=h.useRef(null),o=h.useRef(e);o.current=e;const u=h.useRef(s);return u.current=s,h.useEffect(()=>{const c=a.current;if(!c||!t)return;const f=new IntersectionObserver(l=>{l[0]?.isIntersecting?o.current():u.current?.()},{rootMargin:r});return f.observe(c),()=>f.disconnect()},[t,r]),a}function U({groupByDate:e=!0}){return n.jsx("div",{role:"status","aria-label":"Loading activity","aria-busy":"true",children:n.jsxs("div",{"aria-hidden":"true",children:[e?n.jsx("div",{className:"px-3 pb-2",children:n.jsx(j,{className:"h-4 w-28 rounded-none"})}):null,["first","second","third","fourth","fifth"].map(s=>n.jsxs("div",{className:"flex items-start gap-3 px-3 py-3",children:[n.jsx(j,{className:"h-8 w-8 shrink-0 rounded-none"}),n.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[n.jsx(j,{className:"h-4 w-3/5 max-w-sm rounded-none"}),n.jsxs("div",{className:"flex gap-3",children:[n.jsx(j,{className:"h-3 w-20 rounded-none"}),n.jsx(j,{className:"h-3 w-12 rounded-none"})]})]})]},s))]})})}function $(e){if(e==null||e==="")return null;const s=new Date(e);return Number.isNaN(s.getTime())?null:M(s,"d MMMM yyyy")}function W(e){if(e==null||e==="")return null;const s=new Date(e);return Number.isNaN(s.getTime())?null:V(s)?"Today":q(s)?"Yesterday":M(s,z(s)?"d MMM":"d MMM yyyy")}function X({items:e}){const s=[];for(const t of e){const r=W(t.occurredAt)??"Undated",a=s.at(-1);a?.day===r?a.items.push(t):s.push({day:r,items:[t]})}return n.jsx(n.Fragment,{children:s.map(({day:t,items:r},a)=>n.jsxs("section",{"aria-label":t,className:"min-w-0",children:[n.jsx("div",{className:a===0?"px-1 pb-1.5":"px-1 pt-4 pb-1.5",children:n.jsx("h2",{className:"text-sm font-semibold",children:t})}),n.jsx("ul",{className:"divide-y overflow-hidden rounded-lg border",children:r.map(o=>n.jsx("li",{children:o.content},o.key))})]},`${t}:${a}`))})}const G=3;function se({items:e,isLoading:s,emptyState:t,hasNextPage:r,isFetching:a,isFetchingNextPage:o,onLoadMore:u,autoLoadMore:c=!0,groupByDate:f=!0,rows:l=!1}){const[y,x]=h.useState(0),g=y>=G,b=J({onIntersect:()=>{x(i=>i+1),u()},onLeave:()=>x(0),enabled:c&&r&&!a&&!g}),N=()=>{x(0),u()};return s&&e.length===0?l?n.jsx("div",{role:"status","aria-label":"Loading activity",className:"divide-y overflow-hidden rounded-lg border",children:[0,1,2,3].map(i=>n.jsx(B,{},i))}):n.jsx(U,{groupByDate:f}):n.jsxs("div",{children:[e.length===0?r?null:t!==void 0?t:n.jsx(A,{icon:S,title:"Nothing here yet",description:"No events match this view."}):l?n.jsx(X,{items:e}):e.map((i,m)=>{const p=$(i.occurredAt),v=m>0?$(e[m-1].occurredAt):null;return n.jsxs(h.Fragment,{children:[f&&p&&p!==v&&n.jsx("p",{className:"px-3 pb-2 pt-4 text-xs text-muted-foreground first:pt-0",children:p}),n.jsx("div",{className:"mb-1",children:i.content})]},i.key)}),n.jsx("div",{ref:b,className:"h-1"}),o?n.jsx("div",{role:"status","aria-label":"Loading earlier activity",className:"flex justify-center py-3",children:n.jsx(C,{className:"text-muted-foreground"})}):r?c?g?n.jsx("div",{className:"flex justify-center py-3",children:n.jsx(I,{variant:"link",size:"sm",className:"h-auto p-0 text-xs font-normal text-muted-foreground",disabled:a,onClick:N,children:"Show earlier activity"})}):null:n.jsx(I,{size:"sm",variant:"outline",className:l?"mt-3":void 0,disabled:a,onClick:N,children:"Load more"}):null]})}function H(e,s,t){return e?.kind==="agent_session"&&e.agent_id?e.client_id?`${e.agent_id} via ${e.client_id}`:e.agent_id:e?.kind==="user"?"a person":s==="agent"?"an agent":t?`Automation ${t}`:"an Automation"}function ne({ownerSlug:e,initiator:s,clientName:t,fallback:r}){const a=s?.client_id??t,{allOrgs:o,isAuthenticated:u}=D(),c=u&&o?.some(d=>d.slug===e),l=Y(void 0,{ownerSlug:e,enabled:!!(a&&c)}).data?.find(d=>d.id===a)?.title,y=c?o.find(d=>d.slug===e)?.id:void 0,x=s?.kind==="automation"&&s.automation_id?String(s.automation_id):void 0,b=O(x?y:void 0,void 0,{includeDetails:!1}).data?.find(d=>d.automation_id===x)?.name,{members:N}=E(s?.kind==="user"&&s.user_id?y:void 0),i=N.find(d=>d.userId===s?.user_id)?.user.name,m=s&&s.kind!=="user"?b??H(s,void 0,s.automation_id===void 0?void 0:String(s.automation_id)):i??r,p="font-medium text-foreground",v=`${p} underline-offset-4 hover:underline`;return s?.kind==="automation"&&s.automation_id?n.jsx(_,{to:"/$owner/automations/$automationId",params:{owner:e,automationId:String(s.automation_id)},search:{view:"definition",run_id:void 0},className:v,children:m}):s?.kind==="agent_session"&&s.agent_id?n.jsx(_,{to:"/$owner/agents/$agentId",params:{owner:e,agentId:String(s.agent_id)},className:v,children:m}):a?n.jsxs(_,{to:"/$owner/agents/connected/$clientId",params:{owner:e,clientId:a},className:`${v} inline-flex items-center gap-1 align-middle`,children:[n.jsx(T,{name:l??t??a}),l??m]}):n.jsx("span",{className:p,children:m})}export{U as E,ne as R,se as a,z as b,V as i,H as p};
|
|
2
|
+
//# sourceMappingURL=run-initiator-DhE5v4z0.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{f_ as l,dI as r,z as d,dJ as f,af as g,f$ as I}from"./index-DByaMzsG.js";const m=30,s=new Set(["running","pending","claimed"]);function _(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 T(n,e,t){return l({queryKey:["runs-infinite",t??null,n?_(n):null,e.runTypes??null,e.status??null,e.automationIds??null,e.connectionIds??null,e.feedIds??null],queryFn:async({pageParam:a})=>{const i=a;return r("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}:{},...i?{before_id:i.before_id,before_created_at:i.before_created_at}:{},limit:m},t?{slug:t}:void 0)},initialPageParam:null,getNextPageParam:a=>{if(!a.has_more)return;const i=a.runs[a.runs.length-1];if(i)return{before_id:i.id,before_created_at:i.created_at}},refetchInterval:a=>(a.state.data?.pages??[]).some(u=>u.runs.some(c=>s.has(c.status)))?5e3:!1,enabled:!!n,staleTime:15e3})}function h(n){return s.has(n??"")}function b(n,e){return d({queryKey:["run-outcome",n,e],queryFn:async()=>{const t=await r("manage_operations",{action:"get_run",run_id:e},{slug:n});if(!t.run)throw new Error(t.error||"Run not found");return t.run},enabled:n!=="me",staleTime:15e3,refetchInterval:t=>h(t.state.data?.status)?5e3:!1})}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 K(n,e){const{slug:t}=f(),a=e!=null?p(n,e):null,i=n.kind==="agent"?["agent",n.agentId]:["automation",n.agentId,n.automationId];return d({queryKey:["pending-proposal",t,...i,e],queryFn:async()=>{const o=await g(I(t,a),{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:!!t&&!!a&&!!e,staleTime:0,retry:!1})}export{b as a,K as b,h as i,T as u};
|
|
2
|
+
//# sourceMappingURL=runs-C8sZQr4o.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as t,B as k,L as v,
|
|
2
|
-
//# sourceMappingURL=runs-list-
|
|
1
|
+
import{j as t,B as k,L as v,d9 as T,i as h,dB as D,dC as F,dD as M,hY as A,hZ as E,u as I,h_ as p,h$ as K,bf as y,bk as w,eW as P,r as x,aE as b,aF as N,aH as C,e_ as V,as as z,al as O,i0 as U,i1 as J,i2 as _,bg as W,C as Y,e7 as q}from"./index-DByaMzsG.js";import{R as G,a as H}from"./run-initiator-DhE5v4z0.js";function Q(e,s){switch(s.kind){case"connection":return E(e,s.id);case"feed":return A(e,s.id);case"run":return{to:"/$owner/events",params:{owner:e},search:{run_ids:String(s.id)}}}}function X({ownerSlug:e,scope:s,variant:i="outline",iconOnly:a=!1,label:o,className:c,title:n}){const l=Q(e,s),r=n??o??"View in memory",u=t.jsx(k,{asChild:!0,variant:i,size:a?"icon":"sm",className:h(a&&"h-7 w-7",c),children:t.jsxs(v,{to:l.to,params:l.params,search:l.search,children:[t.jsx(T,{className:h("h-3.5 w-3.5",!a&&"mr-1.5")}),!a&&(o??"View in memory")]})});return a?t.jsxs(D,{children:[t.jsx(F,{asChild:!0,children:u}),t.jsx(M,{children:r})]}):u}function Z({status:e}){return e==="completed"?t.jsx(V,{className:"h-4 w-4 text-green-500"}):e==="failed"?t.jsx(z,{className:"h-4 w-4 text-destructive"}):e==="running"?t.jsx(O,{className:"text-blue-500"}):t.jsx(U,{className:"h-4 w-4 text-muted-foreground"})}const ee={completed:"Completed",failed:"Failed",running:"Running",pending:"Queued",claimed:"Starting",timeout:"Timed out",cancelled:"Cancelled"};function $(e){const s=e.split("_").join(" ");return s.charAt(0).toUpperCase()+s.slice(1)}function te({error:e}){const[s,i]=x.useState(!1);return e.length<=80?t.jsx("span",{className:"text-destructive",children:e}):t.jsxs(b,{open:s,onOpenChange:i,children:[t.jsx(N,{asChild:!0,children:t.jsx("button",{type:"button",className:"text-left text-destructive hover:underline",children:e})}),t.jsx(C,{className:"max-h-64 w-96 overflow-auto",children:t.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs text-destructive",children:e})})]})}function se({checkpoint:e}){return t.jsxs(b,{children:[t.jsx(N,{asChild:!0,children:t.jsx(k,{variant:"ghost",size:"icon",title:"Checkpoint","aria-label":"Checkpoint",className:"size-8 shrink-0 text-muted-foreground hover:text-foreground",children:t.jsx(J,{className:"h-4 w-4","aria-hidden":"true"})})}),t.jsx(C,{className:"max-h-64 w-80 overflow-auto",children:t.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs",children:JSON.stringify(e,null,2)})})]})}function R(e){if(e.initiator_kind)return{kind:e.initiator_kind,...e.initiator_ref};if(e.automation_id)return{kind:"automation",automation_id:e.automation_id};if(e.created_by_user_id)return{kind:"user",user_id:e.created_by_user_id}}function ie({run:e,ownerSlug:s}){const i=R(e);return i?i.kind==="system"?t.jsx(t.Fragment,{children:"by the system"}):t.jsxs(t.Fragment,{children:["by"," ",t.jsx(G,{ownerSlug:s,initiator:i,clientName:void 0,fallback:"a person"})]}):null}function ne({parts:e}){return t.jsx(t.Fragment,{children:e.map(([s,i],a)=>t.jsxs(x.Fragment,{children:[a>0?" · ":"",i]},s))})}function j(e,s){return[e.run_type?$(e.run_type):"Run",s.connection?e.connection_display_name:null,s.feed?e.feed_display_name??e.feed_key:null].filter(Boolean).join(" · ")}const ae=3;function g(e,s){const i=p(e.created_at);return e.status==="completed"&&i!=null?`${j(e,s)}|${q(i,"yyyy-MM-dd")}`:null}function re(e,s){const i=new Map;for(const c of e){const n=g(c,s);n&&i.set(n,[...i.get(n)??[],c])}const a=[],o=new Set;for(const c of e){const n=g(c,s),l=n?i.get(n):void 0;!n||!l||l.length<ae?a.push({kind:"run",run:c}):o.has(n)||(o.add(n),a.push({kind:"group",name:j(c,s),runs:l}))}return a}function oe({name:e,runs:s,ownerSlug:i,columns:a}){const[o,c]=x.useState(!1),n=p(s[0].created_at),l=p(s[s.length-1].created_at),r=Date.now(),u=s.reduce((m,S)=>m+(S.items_collected??0),0),d=l!=null?_(l,r):null,f=n!=null?_(n,r):null,B=d&&f&&d!==f?`${d}–${f}`:f;return t.jsxs("div",{children:[t.jsx("button",{type:"button","aria-expanded":o,onClick:()=>c(m=>!m),className:h(w,"rounded-lg transition-colors hover:bg-accent/40"),children:t.jsx(y,{mark:t.jsx(Y,{"aria-hidden":"true",className:h("h-4 w-4 text-muted-foreground transition-transform",o&&"rotate-90")}),name:e,details:t.jsx(W,{parts:[`${s.length} runs`,B,"all completed",u>0?`${u} ${u===1?"item":"items"}`:null]}),at:n})}),o?t.jsx("div",{className:"ml-6 border-l pl-2",children:s.map(m=>t.jsx("div",{className:"mb-1",children:t.jsx(L,{run:m,ownerSlug:i,columns:a})},m.id))}):null]})}function L({run:e,ownerSlug:s,columns:i={}}){const a=I(),o=p(e.created_at),c=p(e.completed_at),n=o!=null&&c!=null?Math.round((c-o)/1e3):null,l=j(e,i),r=i.startedBy&&R(e)?t.jsx(ie,{run:e,ownerSlug:s}):null,u=[["status",ee[e.status]??$(e.status)],e.error_message?["error",t.jsx(te,{error:e.error_message},"error")]:null,e.items_collected!=null&&(e.run_type==="sync"||e.items_collected>0)?["items",`${e.items_collected} ${e.items_collected===1?"item":"items"}`]:null,n!=null?["duration",K(n)]:null,r?["by",r]:null,e.connector_version?["version",`v${e.connector_version}`]:null,["id",`#${e.id}`]].filter(d=>d!==null);return t.jsxs("article",{"aria-label":`Run #${e.id}`,title:P(e.created_at),className:"group relative flex items-center rounded-lg transition-colors hover:bg-accent/40",children:[t.jsx("div",{className:h(w,"min-w-0 flex-1"),children:t.jsx(y,{mark:t.jsx(Z,{status:e.status}),name:t.jsx(v,{to:"/$owner/events",params:{owner:s},search:{run_ids:String(e.id)},"aria-label":`${l} · Run #${e.id}`,className:"hover:underline",onClick:d=>{!a||d.button!==0||d.metaKey||d.ctrlKey||d.shiftKey||d.altKey||(d.preventDefault(),a.open({href:e.run_type==="automation"&&e.automation_id!=null?`/${s}/automations/${e.automation_id}?view=activity&run_id=${e.id}`:`/${s}/events?run_ids=${e.id}`,title:`Run #${e.id}`,runId:e.id}))},children:l}),tone:e.status==="failed"||e.status==="timeout"?"destructive":null,details:t.jsx(ne,{parts:u}),at:o,atClassName:"group-hover:invisible group-focus-within:invisible"})}),t.jsxs("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 items-center gap-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",children:[e.checkpoint?t.jsx(se,{checkpoint:e.checkpoint}):null,t.jsx(X,{ownerSlug:s,scope:{kind:"run",id:e.id},variant:"ghost",iconOnly:!0,title:"View events from this run"})]})]})}function de({runs:e,ownerSlug:s,columns:i={},emptyState:a,hasNextPage:o=!1,isFetching:c=!1,isFetchingNextPage:n=!1,onLoadMore:l=()=>{}}){return t.jsx(H,{items:re(e,i).map(r=>r.kind==="run"?{key:String(r.run.id),occurredAt:r.run.created_at,content:t.jsx(L,{run:r.run,ownerSlug:s,columns:i})}:{key:`group:${r.runs[0].id}`,occurredAt:r.runs[0].created_at,content:t.jsx(oe,{name:r.name,runs:r.runs,ownerSlug:s,columns:i})}),isLoading:!1,emptyState:a,hasNextPage:o,isFetching:c,isFetchingNextPage:n,onLoadMore:l})}export{L as R,X as V,de as a};
|
|
2
|
+
//# sourceMappingURL=runs-list-CwtH-wmk.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as i,
|
|
2
|
-
`):JSON.stringify(t):typeof t=="object"?Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,e])=>`${N(n)}: ${m(e)}`).join("; "):JSON.stringify(t)}function d(t,r){if(t==null)return"";if(typeof t=="boolean")return t?"Yes":"No";if(typeof t=="number")return r==="currency"?p(t):r===void 0||r==="text"?String(t):h(t);if(typeof t!="string")return m(t);switch(r){case"currency":return p(Number(t));case"date":return b(t);case"url":return g(t);case"enum":return N(t);case"number":return h(Number(t));case"auto":return S(t)?g(t):T(t)?b(t):t;default:return t}}function E(t){return t==null?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?String(t):null}function
|
|
3
|
-
//# sourceMappingURL=schema-value-
|
|
1
|
+
import{j as i,e7 as w,i as L,L as A,fX as D,fY as $}from"./index-DByaMzsG.js";const U=/^\d{4}-\d{2}-\d{2}(?:[tT ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,O=/^\d{4}-\d{2}-\d{2}$/;function T(t){return U.test(t)}function S(t){if(!/^https?:\/\//i.test(t))return!1;try{const r=new URL(t);return r.protocol==="http:"||r.protocol==="https:"}catch{return!1}}function N(t){return t.replace(/[-_]/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,r=>r.toUpperCase())}function p(t){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:t>=1e3?"compact":"standard",maximumFractionDigits:t>=1e9?1:0}).format(t)}function h(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:Number.isInteger(t)?0:2}).format(t)}function b(t){const r=new Date(O.test(t)?`${t}T00:00:00`:t);return Number.isNaN(r.getTime())?t:r.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function g(t){try{const r=new URL(t),n=r.hostname.replace(/^www\./i,""),e=r.pathname&&r.pathname!=="/"?r.pathname.replace(/\/$/,""):"";return`${n}${e}`}catch{return t}}function m(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(d(t)):Array.isArray(t)?t.some(r=>typeof r=="object"&&r!==null)?t.map((r,n)=>`${n+1}. ${m(r)}`).join(`
|
|
2
|
+
`):JSON.stringify(t):typeof t=="object"?Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,e])=>`${N(n)}: ${m(e)}`).join("; "):JSON.stringify(t)}function d(t,r){if(t==null)return"";if(typeof t=="boolean")return t?"Yes":"No";if(typeof t=="number")return r==="currency"?p(t):r===void 0||r==="text"?String(t):h(t);if(typeof t!="string")return m(t);switch(r){case"currency":return p(Number(t));case"date":return b(t);case"url":return g(t);case"enum":return N(t);case"number":return h(Number(t));case"auto":return S(t)?g(t):T(t)?b(t):t;default:return t}}function E(t){return t==null?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?String(t):null}function P(t,r){return typeof t!="string"||!t.startsWith("@")||t.length===1?null:{action:t.slice(1),value:E(r)}}function k(t){return i.jsx("a",{...t})}const F=/^\d{4}-\d{2}-\d{2}$/;function I(t){if(F.test(t)){const[r,n,e]=t.split("-").map(Number),s=new Date(0);return s.setHours(0,0,0,0),s.setFullYear(r,n-1,e),s}return new Date(t)}function C(t,r){const n=I(t);return Number.isNaN(n.getTime())?t:r?n.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):w(n,"LLL dd, y")}function x(t){return t?t["x-currency"]||t.format==="currency"?"currency":t.format==="uri"||t.format==="url"?"url":t.enum?.length?"enum":t.type==="number"||t.type==="integer"?"number":t.type==="boolean"?"boolean":"auto":"auto"}function j(t){return t==null||t===""||Array.isArray(t)&&t.length===0}function V(t){return Array.isArray(t)&&t.some(r=>typeof r=="object"&&r!==null)}function Y(t,r,n){const e=$(r,t);return e!==void 0?e:typeof t=="string"&&(r?.format==="date"||r?.format==="date-time")?C(t,r.format==="date-time"):d(t,n)}function y(t,r){return!r||t===null||typeof t!="object"?t:Array.isArray(t)?t.map(n=>y(n,r.items)):Object.fromEntries(Object.entries(t).filter(([n])=>!D(r.properties?.[n])).map(([n,e])=>[n,y(e,r.properties?.[n])]))}function l({value:t,prop:r,format:n,resolveLink:e,className:s}){const c=String(t),o=e?.(c);if(o)return i.jsx(A,{to:o.to,className:"text-primary hover:underline",onClick:a=>a.stopPropagation(),children:o.label});const u=typeof t=="string"&&S(t),f=n==="url"&&!u?c:Y(t,r,n);return u?i.jsx(k,{href:t,target:"_blank",rel:"noreferrer",className:"text-primary hover:underline [overflow-wrap:anywhere]",onClick:a=>a.stopPropagation(),children:f}):i.jsx("span",{className:s,children:f})}function R({value:t,prop:r,format:n,resolveLink:e,empty:s="-",className:c}){if(j(t))return i.jsx("span",{className:"text-muted-foreground",children:s});if(V(t)){const o=t.length;return i.jsxs("span",{className:c,children:[o," ",o===1?"item":"items"]})}if(Array.isArray(t)){const o=t.filter(f=>!j(f)),u=r?.items??r;return i.jsx("span",{className:L("inline-flex flex-wrap gap-x-1",c),children:o.map((f,a)=>i.jsxs("span",{children:[i.jsx(l,{value:f,prop:u,format:n??x(u),resolveLink:e}),a<o.length-1&&","]},`${a}:${String(f)}`))})}return typeof t=="object"?i.jsx("span",{className:c,children:d(y(t,r))}):i.jsx(l,{value:t,prop:r,format:n??x(r),resolveLink:e,className:c})}export{R as S,C as a,d as f,S as i,I as p,P as t};
|
|
3
|
+
//# sourceMappingURL=schema-value-zTJGE4eh.js.map
|
package/dist/owletto/dist/assets/{scoped-feed-bar-L7h-Ca4u.js → scoped-feed-bar-BKyJSa3_.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as t,L as m,A as u,n as p,
|
|
2
|
-
//# sourceMappingURL=scoped-feed-bar-
|
|
1
|
+
import{j as t,L as m,A as u,n as p,cM as x,x as f,r as h,e0 as v}from"./index-DByaMzsG.js";import{e as g,f as c,c as j}from"./event-kind-options-fHAIXu24.js";import{o as b,F as N,b as y}from"./filter-editors-CQoSj-20.js";const F="h-8 rounded-md border border-input bg-muted text-sm";function E(i,{platforms:e}={}){const{isMember:o}=p(),n=o?i:null,{data:r=[]}=x(n),{data:a=[]}=f(n?{organizationId:n}:void 0);return h.useMemo(()=>j({connectors:r,entityTypes:a,selectedPlatforms:e}),[r,a,e])}function L({owner:i,organizationId:e,activitySearch:o,kinds:n,onKindsChange:r,platforms:a}){const l=n??[],s=l.length>0?{semantic_types:l.join(",")}:{};return t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[r?t.jsx(O,{organizationId:e,kinds:l,onKindsChange:r,platforms:a}):t.jsx("span",{className:"flex-1"}),t.jsxs(m,{to:"/$owner/events",params:{owner:i},search:{...o,...s},className:"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:["Open in Activity",t.jsx(u,{"aria-hidden":"true",className:"h-3.5 w-3.5"})]})]})}function O({organizationId:i,kinds:e,onKindsChange:o,platforms:n}){const r=E(i,{platforms:n}),a={key:"kind",label:"Event kind",icon:t.jsx(v,{className:"h-4 w-4"}),editor:b({searchPlaceholder:"Search event kinds...",emptyText:"No event kinds found",options:g(r,e).map(s=>({value:s,label:c(s)})),selected:e,multiple:!0,onSelect:s=>o(e.includes(s)?e.filter(d=>d!==s):[...e,s])})},l=e.length>0?[{id:"kind",label:"Kind",value:e.length<=2?e.map(c).join(", "):`${e.length} kinds`,title:e.map(c).join(", "),onRemove:()=>o([])}]:[];return t.jsxs(t.Fragment,{children:[t.jsx(N,{label:"Feed filters",menu:!1,fields:[a],chips:l,className:"flex-1"}),t.jsx(y,{fields:[a],triggerClassName:F})]})}export{L as S};
|
|
2
|
+
//# sourceMappingURL=scoped-feed-bar-BKyJSa3_.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=settings-
|
|
1
|
+
import{H as l,j as e,B as t,L as i,T as c,at as o,au as d}from"./index-DByaMzsG.js";import{F as m}from"./full-page-spinner-CYyCnKve.js";function h(){const{session:a,isReady:n}=l();if(!n)return e.jsx(m,{});if(!a?.user)return e.jsxs("div",{className:"mx-auto w-full max-w-md space-y-4 px-4 py-8 text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Account settings"}),e.jsx("p",{className:"text-muted-foreground",children:"Sign in to view your profile and account details."}),e.jsx(t,{asChild:!0,children:e.jsx(i,{to:"/auth/login",search:c({intent:"sign-in",callbackUrl:"/account/settings"}),children:"Sign in"})})]});const{user:s}=a,r=s.name?.trim()||"User";return e.jsx(o,{className:"py-8",children:e.jsxs(d,{className:"space-y-8",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h1",{className:"text-3xl font-semibold leading-tight",children:"Account settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your personal profile and sign-in details."})]}),e.jsxs("section",{"aria-labelledby":"account-profile-heading",className:"space-y-5 border-b border-border pb-8",children:[e.jsx("h2",{id:"account-profile-heading",className:"text-sm font-medium",children:"Profile"}),e.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[s.image?e.jsx("img",{src:s.image,alt:"",referrerPolicy:"no-referrer",className:"h-12 w-12 shrink-0 rounded-full object-cover"}):e.jsx("div",{"aria-hidden":"true",className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-muted text-lg font-medium",children:(s.name?.trim()||s.email||"U").charAt(0).toUpperCase()}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"break-words font-medium",children:r}),e.jsx("p",{className:"break-all text-sm text-muted-foreground",children:s.email})]})]}),e.jsxs("details",{className:"space-y-3",children:[e.jsx("summary",{className:"w-fit cursor-pointer rounded-sm text-sm text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Account details"}),e.jsxs("dl",{className:"space-y-1 text-sm",children:[e.jsx("dt",{className:"text-muted-foreground",children:"User ID"}),e.jsx("dd",{className:"break-all font-mono text-xs",children:s.id})]})]})]}),e.jsxs("section",{"aria-labelledby":"account-session-heading",className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{id:"account-session-heading",className:"text-sm font-medium",children:"Session"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sign out of your account on this device."})]}),e.jsx(t,{variant:"outline",asChild:!0,children:e.jsx(i,{to:"/auth/logout",children:"Sign out"})})]})]})})}export{h as component};
|
|
2
|
+
//# sourceMappingURL=settings-z02cvVS3.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{M as j,z as _,fN as C,j as e,B as N,fO as F,m as L,K as E,L as w,fe as S,Q as $}from"./index-DByaMzsG.js";import{a as P,R as A,b as M}from"./events-feed-DmRzikZW.js";import{a as k}from"./run-initiator-DhE5v4z0.js";function b(r){return{failed:r.filter(i=>i.code!=="withheld"),withheld:[...new Set(r.filter(i=>i.code==="withheld").map(i=>i.error))]}}function v({reasons:r}){return r.length===0?null:e.jsx("div",{className:"space-y-1",children:r.map(i=>e.jsx("p",{className:"text-xs text-muted-foreground",children:i},i))})}function y({failures:r,onRetry:i,isError:c=!1,isFetching:d=!1}){return r.length===0&&!c?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:[r.length<=1?"A source":`${r.length} sources`," could not be read, so some items may be missing."]}),e.jsx(N,{size:"sm",variant:"outline",className:"h-7",onClick:i,disabled:d,children:"Retry"})]})}function O({record:r,orgContext:i,filters:c}){const{orgContext:d}=j(),s=i??d,{data:m}=_({queryKey:["connector-definitions","source-record",s.organizationId,s.slug],queryFn:()=>$(s),enabled:!!(s.organizationId||s.slug),staleTime:6e4}),{data:n,isLoading:h,isError:a,refetch:g,fetchNextPage:l,hasNextPage:p,isFetching:x,isFetchingNextPage:u}=C(r,s,c),f=n?.pages.flatMap(o=>o.events)??[],{failed:t,withheld:R}=b(n?.pages.flatMap(o=>o.failures)??[]);return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(y,{failures:t,isError:a,isFetching:x,onRetry:()=>void g()}),e.jsx(v,{reasons:R}),e.jsx(k,{isLoading:h,hasNextPage:!!p&&!a,autoLoadMore:t.length===0,isFetching:x,isFetchingNextPage:u,onLoadMore:()=>void l(),emptyState:a||t.length>0||p?null:e.jsx("p",{className:"text-xs text-muted-foreground",children:"No activity for this record in its connected sources."}),items:f.map(o=>({key:`${o.feed_id}:${o.origin_id}`,occurredAt:o.occurred_at,content:e.jsx("div",{className:"p-3",children:e.jsx(P,{ownerSlug:s.slug,connectorDefinitions:m,content:{...o,title:o.title||o.origin_type||o.origin_id,text_content:o.payload_text??""}})})}))})]})}function q({record:r,ownerSlug:i,orgContext:c}){const{orgContext:d}=j(),{data:s,isLoading:m,isError:n,refetch:h,hasNextPage:a,fetchNextPage:g,isFetching:l,isFetchNextPageError:p,error:x}=F(r,c??d);if(m)return e.jsx(L,{className:"h-12 w-full rounded-lg"});if(!s)return e.jsx(y,{failures:[],isError:!0,isFetching:l,onRetry:()=>void h()});const{failed:u,withheld:f}=b(s.failures);return e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{count:s.relationshipFailures?.length??0,onRetry:()=>void h()}),e.jsx(y,{failures:u,isError:n,isFetching:l,onRetry:()=>{if(l)return;const t=x instanceof E&&x.status===400;p&&!t||!n&&a?g():h()}}),e.jsx(v,{reasons:f}),s.links.length===0&&(s.relationships?.length??0)===0&&u.length===0&&(s.relationshipFailures?.length??0)===0&&!a&&!n&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"No relationships for this record in its connected sources."}),s.links.length===0&&(s.relationships?.length??0)===0&&a&&!n&&u.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"More source records remain to check for relationships."}),e.jsxs("ul",{className:"space-y-1",children:[(s.relationships??[]).map(t=>e.jsx("li",{className:"rounded-lg border px-3 py-2",children:e.jsx(M,{row:t,entityId:r.key,entityType:r.type,ownerSlug:i,orgContext:c??d})},`authored:${t.id}`)),s.links.map(t=>e.jsx("li",{children:e.jsx(w,{to:S(i,[{entity_type:t.entity_type,slug:t.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:[t.relationship_type.replaceAll("_"," "),t.direction==="incoming"?" (from)":""," ·"," ",t.entity_type," ·"," "]}),t.name]})})},`${t.relationship_type}:${t.direction}:${t.entity_type}:${t.key}`))]}),a&&!n&&u.length===0&&e.jsx(N,{variant:"outline",size:"sm",disabled:l,onClick:()=>void g(),children:l?"Loading…":"Load more"})]})}export{O as S,q as a};
|
|
2
|
+
//# sourceMappingURL=source-record-panels-CGmKIJdN.js.map
|
package/dist/owletto/dist/assets/{status-variants-BR_iGWN5.js → status-variants-DyRCXBzM.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as t,i as s,
|
|
2
|
-
//# sourceMappingURL=status-variants-
|
|
1
|
+
import{j as t,i as s,bL as a}from"./index-DByaMzsG.js";const u=a("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"}}),i=a("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 b({className:e,status:r,showDot:n=!0,children:d,...g}){return t.jsxs("span",{className:s(u({status:r}),e),...g,children:[n&&t.jsx("span",{className:i({status:r})}),d]})}const l=new Set(["error","failed","revoked"]);function x(e){return e==="active"?"active":e==="paused"?"paused":e==="pending"||e==="pending_auth"?"pending":l.has(e)?"error":"default"}export{b as S,x as g};
|
|
2
|
+
//# sourceMappingURL=status-variants-DyRCXBzM.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t,j as l,i as o}from"./index-
|
|
2
|
-
//# sourceMappingURL=table-
|
|
1
|
+
import{r as t,j as l,i as o}from"./index-DByaMzsG.js";const r=t.forwardRef(({className:e,...a},s)=>l.jsx("div",{className:"relative w-full overflow-auto",children:l.jsx("table",{ref:s,className:o("w-full caption-bottom text-sm",e),...a})}));r.displayName="Table";const d=t.forwardRef(({className:e,...a},s)=>l.jsx("thead",{ref:s,className:o("[&_tr]:border-b",e),...a}));d.displayName="TableHeader";const c=t.forwardRef(({className:e,...a},s)=>l.jsx("tbody",{ref:s,className:o("[&_tr:last-child]:border-0",e),...a}));c.displayName="TableBody";const b=t.forwardRef(({className:e,...a},s)=>l.jsx("tr",{ref:s,className:o("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...a}));b.displayName="TableRow";const m=t.forwardRef(({className:e,...a},s)=>l.jsx("th",{ref:s,className:o("h-10 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...a}));m.displayName="TableHead";const i=t.forwardRef(({className:e,...a},s)=>l.jsx("td",{ref:s,className:o("p-4 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...a}));i.displayName="TableCell";export{r as T,d as a,b,m as c,c as d,i as e};
|
|
2
|
+
//# sourceMappingURL=table-C637cQxG.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{z as u,dG as c,dH as s,y as r,E as l,dI as o}from"./index-DByaMzsG.js";function y(){return u({queryKey:["automation-catalog"],queryFn:async()=>(await o("manage_catalog",{action:"list_catalog",kinds:["automations"]})).catalogs?.automations?.entries??[],staleTime:6e4})}function g(t,e,i){return u({queryKey:["automations-list",t,e,i?.includeDetails??!0],queryFn:async()=>(await o("manage_automations",{action:"list",entity_id:e,status:"active",include_details:i?.includeDetails??!0})).automations||[],enabled:!!t,staleTime:3e4})}function _(t,e,i,a={}){const n=c(a.ownerSlug);return u({queryKey:["automation-detail",n,t,e,a.includeVersions??!1],queryFn:async()=>await o("get_automation",{automation_id:t,entity_id:e,page_size:1,include_versions:a.includeVersions??!1},{slug:n},{timeoutMs:3e4}),enabled:!!n&&!!t&&!!(a.ownerSlug||i),staleTime:3e4})}const A=s({tool:"manage_automations",body:t=>({action:"update",...t}),invalidateKeys:["automations-list","automation-detail","automations"],checkError:!1,successMessage:"Automation updated",errorMessage:"Failed to update Automation"}),q=s({tool:"manage_automations",body:t=>({action:"trigger",automation_id:t}),invalidateKeys:["automations-list","automation-detail","automations","runs-infinite"],errorMessage:"Failed to run Automation"}),v=s({tool:"manage_automations",body:t=>({action:"delete",automation_ids:[t]}),invalidateKeys:["automations-list","automation-detail","automations","agent-threads"],checkError:!1,successMessage:"Automation deleted",errorMessage:"Failed to delete Automation"}),K=s({tool:"manage_automations",body:t=>({action:"create",...t}),invalidateKeys:["automations-list","automations"],successMessage:"Automation created",errorMessage:"Failed to create Automation"});function f(){const t=r();return l({mutationFn:async e=>o("manage_automations",{action:"create_version",...e}),onSuccess:()=>{t.invalidateQueries({queryKey:["automations-list"]}),t.invalidateQueries({queryKey:["automation-detail"]}),t.invalidateQueries({queryKey:["automations"]})}})}function M(){const t=r();return l({mutationFn:async e=>o("manage_automations",{action:"set_reaction_script",...e}),onSuccess:()=>{t.invalidateQueries({queryKey:["automations-list"]}),t.invalidateQueries({queryKey:["automation-detail"]}),t.invalidateQueries({queryKey:["automations"]})}})}export{_ as a,v as b,K as c,f as d,M as e,A as f,y as g,q as h,g as u};
|
|
2
|
+
//# sourceMappingURL=use-automations-CgWNoYio.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as d,j as e,a7 as U,i as R,a8 as D,B as W,a9 as B,aa as I,ab as T,ac as V,a1 as q,ad as G}from"./index-DByaMzsG.js";import{C as K,a as J,b as Q,d as X,c as Y}from"./card-DtLIFq7D.js";function z(s){if(!s)return null;try{const t=new URL(s);return t.protocol==="https:"&&t.hostname?t.toString():null}catch{return null}}function _(s){const t=z(s);if(!t)return null;const a=new URL(t).hostname.toLowerCase();return a.length>0&&a.length<=253&&/^[a-z0-9.-]+$/.test(a)?a:null}function Z({clientName:s,logoUri:t=null,clientUri:a=null}){const[r,i]=d.useState(!1),[o,p]=d.useState(!1),g=r?null:z(t),j=o?null:_(a)??_(t);return g?e.jsx("img",{src:g,alt:"",referrerPolicy:"no-referrer",onError:()=>i(!0),className:"h-10 w-10 shrink-0 rounded-md object-contain"}):j?e.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${encodeURIComponent(j)}&sz=64`,alt:"",referrerPolicy:"no-referrer",onError:()=>p(!0),className:"h-10 w-10 shrink-0 rounded-md bg-secondary object-contain"}):e.jsx("div",{"aria-hidden":"true",className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-secondary text-base font-bold text-secondary-foreground",children:(s??"?").charAt(0).toUpperCase()||"?"})}const H=["mcp:read","mcp:write","mcp:admin"],ee=[{value:"read",title:"Read only",description:"Search and view authorized workspace data."},{value:"write",title:"Read and make changes",description:"Includes read access. Create and update authorized workspace data."},{value:"admin",title:"Administer workspaces",description:"Includes read and write access. Manage administrator-only settings.",risk:"high"}],L={read:0,write:1,admin:2};function F(s){return s.includes("mcp:admin")?"admin":s.includes("mcp:write")?"write":s.includes("mcp:read")?"read":null}function se(s,t){const a=s.filter(i=>!H.includes(i));if(!t)return a;const r=F(s);return!r||L[t]>L[r]?a:["mcp:read",...t==="write"||t==="admin"?["mcp:write"]:[],...t==="admin"?["mcp:admin"]:[],...a]}function ie({idPrefix:s,clientName:t,clientNote:a,requestedScopes:r,accessLevel:i,onAccessLevelChange:o,allowNoAccess:p=!1,disabled:g=!1,resource:j=null,logoUri:w=null,clientUri:h=null}){const y=F(r),x=r.includes("profile:read"),m=r.filter(c=>!H.includes(c)&&c!=="profile:read"&&c!=="device_worker:run"&&c!=="connections:token");return e.jsxs("div",{className:"space-y-5",children:[e.jsx("section",{"aria-label":"Application",className:"space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Z,{clientName:t,logoUri:w,clientUri:h}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:t||"Unnamed application"}),a?e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:a}):null,j&&e.jsxs("div",{className:"mt-2 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1.5",children:[e.jsx("p",{children:"Requesting access to"}),r.length>0&&e.jsx("p",{className:"flex flex-wrap gap-1.5",children:r.map(c=>e.jsx("span",{className:"px-1 py-0.5 font-mono text-[11px] text-foreground",children:c},c))})]}),e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:e.jsxs("p",{children:["on"," ",e.jsx("code",{className:"break-all rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground",children:j})]})})]})]})]})}),x&&e.jsxs("section",{"aria-labelledby":`${s}-profile`,className:"space-y-2",children:[e.jsx("p",{id:`${s}-profile`,className:"text-sm font-medium",children:"Account information"}),e.jsxs("div",{className:"rounded-md border p-3",children:[e.jsxs("p",{className:"flex flex-wrap items-center gap-2 text-sm font-medium text-foreground",children:["Basic profile",e.jsx(U,{variant:"secondary",children:"Always included"})]}),e.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"See your basic Lobu identity and the names and slugs of workspaces you belong to. This is separate from the workspace data access below."})]})]}),y&&e.jsxs("fieldset",{className:"space-y-2",disabled:g,children:[e.jsx("legend",{className:"text-sm font-medium",children:"What should this client have access to?"}),e.jsxs("div",{className:"space-y-2",children:[p?e.jsxs("label",{htmlFor:`${s}-access-none`,className:R("flex cursor-pointer items-start gap-3 rounded-md border p-3 transition-colors",i===null&&"border-primary bg-primary/5"),children:[e.jsx("input",{id:`${s}-access-none`,type:"radio",name:`${s}-access-level`,value:"none",checked:i===null,onChange:()=>o(null),className:"mt-1 h-4 w-4 accent-primary"}),e.jsxs("span",{className:"min-w-0 space-y-0.5",children:[e.jsx("span",{className:"block text-sm font-medium text-foreground",children:"No workspace data access"}),e.jsx("span",{className:"block text-sm text-muted-foreground",children:"Pair the device only. It won't read or write workspace data."})]})]}):null,ee.filter(c=>L[c.value]<=L[y]).map(c=>{const f=`${s}-access-${c.value}`,b=i===c.value;return e.jsxs("label",{htmlFor:f,className:R("flex cursor-pointer items-start gap-3 rounded-md border p-3 transition-colors",b&&"border-primary bg-primary/5"),children:[e.jsx("input",{id:f,type:"radio",name:`${s}-access-level`,value:c.value,checked:b,onChange:()=>o(c.value),className:"mt-1 h-4 w-4 accent-primary"}),e.jsxs("span",{className:"min-w-0 space-y-0.5",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium text-foreground",children:[c.title,c.risk==="high"&&e.jsx(D,{"aria-label":"High risk",className:"h-3.5 w-3.5 shrink-0 text-destructive",children:e.jsx("title",{children:"High risk"})})]}),e.jsx("span",{className:"block text-sm text-muted-foreground",children:c.description})]})]},c.value)})]})]}),m.length>0&&e.jsxs("section",{"aria-labelledby":`${s}-additional`,className:"space-y-2",children:[e.jsx("p",{id:`${s}-additional`,className:"text-sm font-medium",children:"Additional permissions"}),e.jsx("ul",{className:"space-y-2",children:m.map(c=>e.jsx("li",{className:"rounded-md border p-3 font-mono text-xs text-foreground",children:c},c))})]})]})}function oe({summary:s,children:t,className:a}){return e.jsxs("div",{className:R("flex flex-wrap items-center gap-3 border-t pt-4",s?"justify-between":"justify-end",a),children:[s?e.jsx("p",{className:"text-sm text-muted-foreground",children:s}):null,e.jsx("div",{className:"ml-auto flex items-center gap-3",children:t})]})}function de({busy:s,approveLabel:t="Approve",approveDisabled:a=!1,denyDisabled:r=!1,onApprove:i,onDeny:o}){return e.jsxs(e.Fragment,{children:[e.jsx(W,{type:"button",variant:"outline",onClick:o,disabled:r,children:s==="deny"?"Denying...":"Deny"}),e.jsx(W,{type:"button",onClick:i,disabled:a,children:s==="approve"?"Approving...":t})]})}function me({title:s,description:t,busy:a=!1,error:r=null,review:i,aside:o,below:p,notice:g,footer:j,live:w=!1}){return e.jsx("main",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs(K,{className:R("w-full",o?"max-w-4xl":"max-w-lg"),role:w?"status":void 0,"aria-live":w?"polite":void 0,children:[e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx("h1",{children:s})}),t?e.jsx(X,{children:t}):null]}),e.jsxs(Y,{className:"space-y-5","aria-busy":a,children:[o?e.jsxs("div",{className:"grid gap-6 md:grid-cols-[minmax(0,1fr)_300px]",children:[e.jsx("div",{className:"min-w-0",children:i}),e.jsx("div",{className:"min-w-0",children:o})]}):i,p,g,r?e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:r}):null,j]})]})})}function ue({resourceOrg:s,accessLevel:t}){return e.jsxs("section",{className:"rounded-md border border-primary/20 bg-primary/5 p-3 text-sm space-y-2",children:[e.jsxs("p",{className:"font-medium text-foreground",children:["Workspace access: only ",s]}),e.jsxs("ul",{className:"space-y-1 text-muted-foreground",children:[e.jsx("li",{children:"If this workspace is public, the app can read public data immediately after approval."}),t==="write"?e.jsx("li",{children:"If you are not already a member, this connection will stay read-only. Ask an organization admin to grant write access, then reconnect the MCP client."}):null,t==="admin"?e.jsx("li",{children:"If you are not already an admin or owner, elevated actions will stay blocked. Ask an organization owner to grant the required role, then reconnect the MCP client."}):null,t==="read"?e.jsx("li",{children:"Public read access does not require membership."}):null]})]})}function te(s){const t=q(s);return t.kind==="cross-host"?t.href:t.to}function pe({idPrefix:s,heading:t,orgList:a,selectedOrgIds:r,onWorkspaceAccessChange:i,onSelectedOrgChange:o,orgsLoading:p,orgsError:g,onRetry:j,disabled:w=!1,includedOrgId:h=null,allowMultiple:y}){const x=`${s}-workspace-access-legend`,m=`${s}-workspace-search`,[c,f]=d.useState(""),b=t??"Workspace access",N=h?a.find(n=>n.id===h)??null:null,k=a.filter(n=>n.id!==h),$=r.filter(n=>n!==h).length,A=h?$:r.length,E=k.length>0&&k.every(n=>r.includes(n.id));if(p)return e.jsxs("section",{"aria-labelledby":x,className:"space-y-2",children:[e.jsx("p",{id:x,className:"text-sm font-medium",children:b}),e.jsx("p",{role:"status","aria-live":"polite",className:"text-sm text-muted-foreground",children:"Loading your workspaces..."})]});if(g)return e.jsxs("section",{"aria-labelledby":x,className:"space-y-2",children:[e.jsx("p",{id:x,className:"text-sm font-medium",children:b}),e.jsxs("div",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[e.jsx("p",{children:"Workspaces could not be loaded. Approval is unavailable until they load."}),e.jsx(W,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:j,children:"Retry"})]})]});if(a.length===0)return e.jsxs("section",{"aria-labelledby":x,className:"space-y-2",children:[e.jsx("p",{id:x,className:"text-sm font-medium",children:b}),e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:"No member workspaces are available for this connection."})]});const M=()=>{if(E)for(const n of k)o(n.id,!1);else i("all_current")},S=c.trim().toLowerCase(),l=S?k.filter(n=>n.name.toLowerCase().includes(S)||n.slug.toLowerCase().includes(S)):k;return e.jsxs("fieldset",{className:"min-w-0 space-y-3",disabled:w,children:[e.jsx("legend",{id:x,className:"sr-only",children:b}),e.jsxs("p",{className:"text-sm font-medium",children:[b," ",e.jsxs("span",{className:"font-normal text-muted-foreground",children:["· ",A," selected"]})]}),e.jsxs("div",{className:"flex min-w-0 flex-col overflow-hidden rounded-md border bg-card",children:[e.jsxs("div",{className:"border-b bg-card p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Workspaces"}),y&&k.length>0&&e.jsx("button",{type:"button",onClick:M,className:"shrink-0 cursor-pointer bg-none p-0 text-xs font-semibold text-foreground underline underline-offset-4",children:E?"Clear all":`Select all ${k.length}`})]}),!h&&e.jsx("p",{className:"mt-0.5 whitespace-nowrap text-sm text-muted-foreground",children:y?"Choose workspaces for this app.":"Choose one workspace this application can access."}),e.jsx("input",{id:m,type:"search",value:c,onChange:n=>f(n.target.value),placeholder:"Filter workspaces…","aria-label":"Filter workspaces",className:"mt-2 flex h-9 w-full rounded-md border border-input bg-background px-3 text-sm focus:outline-none focus:ring-1 focus:ring-ring"})]}),e.jsxs("div",{className:"max-h-80 space-y-1.5 overflow-auto p-2",children:[N?e.jsxs("div",{className:"flex items-center gap-2.5 rounded-md bg-muted px-2.5 py-2",children:[e.jsx(B,{"aria-hidden":"true",className:"h-4 w-4 shrink-0 text-primary"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"min-w-0 truncate",children:N.name}),N.isPersonal&&e.jsx(I,{"aria-label":"Personal workspace",className:"h-3.5 w-3.5 shrink-0 text-muted-foreground",children:e.jsx("title",{children:"Personal workspace"})}),e.jsx(U,{variant:"secondary",className:"shrink-0",children:"Device home"})]})}),e.jsx("span",{className:"sr-only",children:"Included"})]}):null,l.map(n=>{const u=`${s}-workspace-${n.id}`,v=r.includes(n.id);return e.jsxs("div",{className:R("flex items-center gap-2.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted/60",v&&"bg-primary/5 hover:bg-primary/5"),children:[e.jsx(T,{id:u,checked:v,disabled:w,onCheckedChange:C=>o(n.id,C===!0)}),e.jsx("label",{htmlFor:u,className:"min-w-0 flex-1 cursor-pointer truncate text-sm font-medium text-foreground",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"min-w-0 truncate",children:n.name}),n.isPersonal&&e.jsx(I,{"aria-label":"Personal workspace",className:"h-3.5 w-3.5 shrink-0 text-muted-foreground",children:e.jsx("title",{children:"Personal workspace"})})]})}),e.jsx("a",{href:te(n.slug),target:"_blank",rel:"noopener noreferrer",onClick:C=>C.stopPropagation(),"aria-label":`Open ${n.name} workspace`,title:`Open ${n.name} workspace`,className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(V,{className:"h-3.5 w-3.5"})})]},n.id)}),l.length===0&&!N&&e.jsx("p",{className:"px-2 py-3 text-[13px] text-muted-foreground",children:"No workspaces match."})]}),e.jsx("div",{className:"border-t bg-card px-3 py-2 text-xs text-muted-foreground",children:e.jsx("p",{"aria-live":"polite",children:h?`${$} additional workspace${$===1?"":"s"} selected.`:`${r.length} of ${a.length} workspaces selected.`})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Workspaces you join later are not added automatically."}),r.length===0&&e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Choose at least one workspace."})]})}function ne(s,t){return s.length===t.length&&s.every((a,r)=>a===t[r])}function re(s={}){const{requireDeviceHome:t=!1,deviceHomeOrgId:a=null,allowMultiple:r=!0}=s,{data:i,error:o,isPending:p,refetch:g}=G(),[j,w]=d.useState("selected"),[h,y]=d.useState([]),x=d.useRef(!1),m=d.useMemo(()=>i?i.filter(l=>l.is_member).map(l=>({id:l.id,name:l.name,slug:l.slug,isPersonal:l.is_personal===!0})):[],[i]),c=m.find(l=>l.isPersonal)?.id??null,f=t?a&&m.some(l=>l.id===a)?a:c:null,b=d.useRef(m);b.current=m;const N=o instanceof Error?o.message:o?"Unable to load workspaces":null;d.useEffect(()=>{if(p||N)return;const l=m.map(u=>u.id),n=new Set(l);y(u=>{const v=x.current?u.filter(C=>n.has(C)):[c??l[0]].filter(C=>!!C);return x.current=!0,ne(u,v)?u:v})},[m,N,p,c]);const k=d.useCallback(l=>{if(l==="all_current"){if(!r)return;y(b.current.map(n=>n.id))}w(l)},[r]),$=d.useCallback((l,n)=>{b.current.some(u=>u.id===l)&&(t&&(l===f||!r)||(w("selected"),y(u=>n?r?u.includes(l)?u:[...u,l]:[l]:u.filter(v=>v!==l))))},[r,f,t]),A=d.useMemo(()=>{if(t&&f&&!r)return[f];const l=new Set(h);return t&&f&&l.add(f),m.filter(n=>l.has(n.id)).map(n=>n.id)},[r,h,f,m,t]),E=d.useCallback(()=>{const l=b.current,n=l.find(u=>u.isPersonal)?.id??l[0]?.id;x.current=l.length>0,w("selected"),y(n?[n]:[])},[]),M=!p&&!N&&m.length>0&&A.length>0&&(r||A.length===1)&&(!t||f!==null&&A.includes(f)),S=d.useCallback(()=>{g()},[g]);return{orgList:m,workspaceAccess:j,setWorkspaceAccess:k,selectedOrgIds:A,toggleSelectedOrgId:$,resetWorkspaceSelection:E,personalOrgId:c,deviceHomeOrgId:f,orgsLoading:p,orgsError:N,retryOrgs:S,workspaceSelectionReady:M}}function ae(s){if(!s)return null;try{return new URL(s).pathname.match(/^\/mcp\/([^/]+)$/)?.[1]?.trim()||null}catch{return null}}function he({requestedScopes:s,resource:t=null,allowMultiple:a,requireDeviceHome:r=!1,deviceHomeOrgId:i=null}){const o=F(s),[p,g]=d.useState(o);d.useEffect(()=>{g(F(s))},[s]);const j=d.useMemo(()=>se(s,p),[s,p]),w=d.useMemo(()=>ae(t),[t]),h=j.some(m=>m.startsWith("mcp:")),y=h&&!w,x=re({allowMultiple:a,requireDeviceHome:r,deviceHomeOrgId:i});return{accessLevel:p,setAccessLevel:g,selectedScopes:j,resourceOrg:w,hasMcpScopes:h,requiresWorkspaceAccess:y,...x}}function P(s){return typeof s=="string"&&s.length>0?s:null}function xe(s,t){return P(s?.error_description)??P(s?.message)??P(s?.error)??t}function O(s=window.location.href){const t=new URL("/auth/login",window.location.origin);return t.searchParams.set("callbackUrl",s),t.toString()}function fe(){window.location.href=O()}function ge(s,t){d.useEffect(()=>{t||s||(window.location.href=O())},[s,t])}export{ie as A,me as C,ue as R,pe as W,ge as a,oe as b,de as c,F as g,xe as o,fe as r,he as u};
|
|
2
|
+
//# sourceMappingURL=use-login-redirect-tDdhXTpt.js.map
|