@tickernelz/wardmote-ui 2026.1114.1 → 2026.1114.3
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/assets/{ActiveAgentsPanel-CKzCe8AC.js → ActiveAgentsPanel-CF0fwsze.js} +1 -1
- package/dist/assets/{AdapterManager-DFPaPUUr.js → AdapterManager-DUXWwNxv.js} +1 -1
- package/dist/assets/{AdvancedToolsRoute-CN5fWS4T.js → AdvancedToolsRoute-BamlkE3p.js} +1 -1
- package/dist/assets/{AgentActionButtons-a9LacJPP.js → AgentActionButtons-CPIhsP04.js} +1 -1
- package/dist/assets/{AgentBubbleActionRow-DIr3TdR9.js → AgentBubbleActionRow-BUAUmJKa.js} +1 -1
- package/dist/assets/{AgentChat-D5FDUYuV.js → AgentChat-BAn_ghsu.js} +1 -1
- package/dist/assets/{AgentChats-TN5SE_gN.js → AgentChats-f73hodzr.js} +1 -1
- package/dist/assets/{AgentDefaults-CiVVS_pQ.js → AgentDefaults-BL1XYvEo.js} +1 -1
- package/dist/assets/{AgentDetail-bCAmWRXs.js → AgentDetail-DthxFfuB.js} +1 -1
- package/dist/assets/{AgentTodoCard-BpmvHEsm.js → AgentTodoCard-BvgkWD0T.js} +1 -1
- package/dist/assets/{Agents-CToMMxGu.js → Agents-D5qI6yZZ.js} +3 -3
- package/dist/assets/{AppDetail-P807ou0a.js → AppDetail-B6PtMl8J.js} +1 -1
- package/dist/assets/{AppNotConnected-DuA4PukX.js → AppNotConnected-C_tGn786.js} +1 -1
- package/dist/assets/{ApprovalCard-BDdZDBMj.js → ApprovalCard-DrfZAdGQ.js} +1 -1
- package/dist/assets/{ApprovalDetail-CVgy1uNi.js → ApprovalDetail-sfPpfdXc.js} +1 -1
- package/dist/assets/{ApprovalPayload-H5zW6yQ4.js → ApprovalPayload-C4F3ItGH.js} +1 -1
- package/dist/assets/{Approvals-DL6kx45P.js → Approvals-DZoMl7_m.js} +1 -1
- package/dist/assets/{AppsConnect-DH7aSjtS.js → AppsConnect-D8Gu187f.js} +1 -1
- package/dist/assets/{AppsReview-Bf7oB0ES.js → AppsReview-DokFETm0.js} +1 -1
- package/dist/assets/{ArtifactCard-Cp4KPgZl.js → ArtifactCard-BTf2-JIV.js} +1 -1
- package/dist/assets/{Artifacts-Dz3eHCaQ.js → Artifacts-CK8FaygC.js} +1 -1
- package/dist/assets/{AssistantConnection-5Y4fBVXq.js → AssistantConnection-BlKC7jk0.js} +1 -1
- package/dist/assets/{AttentionInteractionResolver-DlP6a6AG.js → AttentionInteractionResolver-C2iz6oqT.js} +1 -1
- package/dist/assets/{AuditHub-Dz2UXl0c.js → AuditHub-DMhunMn8.js} +1 -1
- package/dist/assets/{BoardChat-DsMVXf5M.js → BoardChat-C4W8JLKB.js} +1 -1
- package/dist/assets/{BootstrapSetupUxLab-CWWisaHp.js → BootstrapSetupUxLab-D58OwniR.js} +1 -1
- package/dist/assets/{Browse-Be6aSv-F.js → Browse-BDjohBak.js} +1 -1
- package/dist/assets/{BudgetPolicyCard-Dka022-Z.js → BudgetPolicyCard-DfAAgk9Z.js} +1 -1
- package/dist/assets/{CaseDetail-DdJrlm0m.js → CaseDetail-CL0FC5sG.js} +1 -1
- package/dist/assets/{Cases-Da1szfrr.js → Cases-C-7dXrEt.js} +1 -1
- package/dist/assets/{ChatEndpointDetail-DSOH-zfs.js → ChatEndpointDetail-C-IYAYG8.js} +1 -1
- package/dist/assets/{ChatEndpointSetup-J23lq-xi.js → ChatEndpointSetup-CM3QixMj.js} +1 -1
- package/dist/assets/{ChoiceControls-B9yrYshK.js → ChoiceControls-3Qpci4yE.js} +1 -1
- package/dist/assets/{Companies-BkHWSxdB.js → Companies-97toQ8Cw.js} +1 -1
- package/dist/assets/{CompanyAccess-BaiGlxY1.js → CompanyAccess-CKhS1BaS.js} +1 -1
- package/dist/assets/{CompanyActivity-CMBXXwCw.js → CompanyActivity-DzNrAyAb.js} +1 -1
- package/dist/assets/{CompanyConnections-CVzsivTW.js → CompanyConnections-ORCH4i3U.js} +1 -1
- package/dist/assets/{CompanyEnvironments-K7piWRrx.js → CompanyEnvironments-DphURbtb.js} +1 -1
- package/dist/assets/{CompanyExport-Bo8tUPaY.js → CompanyExport-XeVCUcK3.js} +1 -1
- package/dist/assets/{CompanyImport-CBVjSXPA.js → CompanyImport-DPKpUaRa.js} +1 -1
- package/dist/assets/{CompanySettings-CuU9qSp5.js → CompanySettings-4JQpzuS1.js} +1 -1
- package/dist/assets/{CompanySettingsPluginPage-59_bMQQ3.js → CompanySettingsPluginPage-cVvXh0_G.js} +1 -1
- package/dist/assets/{CompanySkills-GBJMThWx.js → CompanySkills-BA_9Ztwj.js} +1 -1
- package/dist/assets/{ComposerAddMenu-D9z2INup.js → ComposerAddMenu-DNp4ecG8.js} +1 -1
- package/dist/assets/{ConfigureBuiltInAgentModal-D8Xnl51H.js → ConfigureBuiltInAgentModal-CQCHDkl4.js} +1 -1
- package/dist/assets/{ConnectionSetupFlow-DKjP5RBZ.js → ConnectionSetupFlow-BaarToKu.js} +1 -1
- package/dist/assets/{CopyableGatewayUrl-GuvA-DoQ.js → CopyableGatewayUrl-DxQsV7Hr.js} +1 -1
- package/dist/assets/{Dashboard-Cgj9BeTt.js → Dashboard--iaPJqJp.js} +1 -1
- package/dist/assets/{DashboardLive-Ku1cHAj9.js → DashboardLive-4rGeotay.js} +1 -1
- package/dist/assets/{DecisionDateChips-Z97mgInq.js → DecisionDateChips-CJOLtNrJ.js} +1 -1
- package/dist/assets/{DecisionModelSettings-NrNERkaW.js → DecisionModelSettings-D-OxKIGP.js} +1 -1
- package/dist/assets/{DecisionQueuePage-D8cyKm4V.js → DecisionQueuePage-D-kNFav_.js} +1 -1
- package/dist/assets/{DesignGuide-DvO3NaE-.js → DesignGuide-D7486q4b.js} +1 -1
- package/dist/assets/{DocumentFrameHeader-DTSqcw4Q.js → DocumentFrameHeader-B61HhahB.js} +1 -1
- package/dist/assets/{EmailEndpointSetup-Cm_KKjjw.js → EmailEndpointSetup-6OHb9B4q.js} +1 -1
- package/dist/assets/{ExecutionWorkspaceDetail-CVB4ZY8I.js → ExecutionWorkspaceDetail-BGV-9D5Y.js} +1 -1
- package/dist/assets/{FolderControls-B7TWghGc.js → FolderControls-L2RzbfdQ.js} +1 -1
- package/dist/assets/{GatewayDetail-DB1J44bF.js → GatewayDetail-CdXNQ9gD.js} +1 -1
- package/dist/assets/{GatewaysList-CKSwMmOi.js → GatewaysList-B0Jq1IRC.js} +1 -1
- package/dist/assets/{GoalDetail-Bscma2qU.js → GoalDetail-D2VhPtvw.js} +1 -1
- package/dist/assets/{GoalTree-jEFB788p.js → GoalTree-kFpgH4dA.js} +1 -1
- package/dist/assets/{Goals-jLNZ4UKT.js → Goals-B-_gq_Qu.js} +1 -1
- package/dist/assets/{ImageGalleryModal-CghUxjQC.js → ImageGalleryModal-DzKBMOnu.js} +1 -1
- package/dist/assets/{Inbox-DHwNNh-Z.js → Inbox-zllmqRcB.js} +1 -1
- package/dist/assets/{InstanceAdvanced-C5IIPBwh.js → InstanceAdvanced-B7tDfjwG.js} +1 -1
- package/dist/assets/{InviteLanding-BHmCRaWY.js → InviteLanding-brwa_8NC.js} +1 -1
- package/dist/assets/{IssueChatLongThreadPerf-JH8rtLk0.js → IssueChatLongThreadPerf-D0HJe6IV.js} +1 -1
- package/dist/assets/{IssueChatThread-ByTyrsxz.js → IssueChatThread-CMXzuvrF.js} +1 -1
- package/dist/assets/{IssueDetail-BIif8Swu.js → IssueDetail-DGdg-mB8.js} +1 -1
- package/dist/assets/{IssueDocumentAnnotations-BVdH4RTa.js → IssueDocumentAnnotations-BK-LgExc.js} +1 -1
- package/dist/assets/{IssueOutputSection-CFE6aU9L.js → IssueOutputSection-aSyiE1pg.js} +1 -1
- package/dist/assets/{IssueRecoveryActionCard-DBgE7aMm.js → IssueRecoveryActionCard-vAuL_OEC.js} +1 -1
- package/dist/assets/{IssueThreadInteractionCard-C3LFe8cu.js → IssueThreadInteractionCard-wFidFTIh.js} +1 -1
- package/dist/assets/{Issues-B5QG33RC.js → Issues-CsmM33z_.js} +1 -1
- package/dist/assets/{LiveNowTodoLine-D52WDE8-.js → LiveNowTodoLine-CP32NNp_.js} +1 -1
- package/dist/assets/{ManagedAiConnectionDetails-C9nV0oIT.js → ManagedAiConnectionDetails-Ba0awZ-O.js} +1 -1
- package/dist/assets/{McpConnect-Bk8Qskqw.js → McpConnect-CYLP1yLX.js} +1 -1
- package/dist/assets/{MembershipAction-DjdBY6Bk.js → MembershipAction-CKs7Ua9x.js} +1 -1
- package/dist/assets/{ModelsAndProviders-BtbhNxf_.js → ModelsAndProviders-gaR7HDQm.js} +1 -1
- package/dist/assets/{NewAgent-C4JqnMkp.js → NewAgent-DBQzvxIr.js} +1 -1
- package/dist/assets/{OmpAllSettings-aHENTYf5.js → OmpAllSettings-B_Knr51Z.js} +1 -1
- package/dist/assets/{PipelineSettings-CCoxV9Es.js → PipelineSettings-Dl-94FB5.js} +1 -1
- package/dist/assets/{Pipelines-DaQPh688.js → Pipelines-CY9hGe0h.js} +1 -1
- package/dist/assets/{PixelsOffice-D1X7mdpk.js → PixelsOffice-BgyGZsiV.js} +1 -1
- package/dist/assets/{PluginPage-B4kdPADI.js → PluginPage-CMA4Ei50.js} +1 -1
- package/dist/assets/{PluginSettings-yP8NX-sM.js → PluginSettings-Cm4H1JRT.js} +1 -1
- package/dist/assets/{ProfileDetailRoute-DMdAvFmb.js → ProfileDetailRoute-BEBctbC6.js} +1 -1
- package/dist/assets/{ProfileSettings-DVm3Tqzs.js → ProfileSettings-Djo7BLIj.js} +1 -1
- package/dist/assets/{ProfileWizardRoute-CijS7-aN.js → ProfileWizardRoute-DxLujEtD.js} +1 -1
- package/dist/assets/{ProjectDetail-DeLSGbmz.js → ProjectDetail-CmmdvUHn.js} +1 -1
- package/dist/assets/{ProjectWorkspaceDetail-DPajDjA-.js → ProjectWorkspaceDetail-BsA0hJ-k.js} +1 -1
- package/dist/assets/{ProjectWorkspacesContent-BCATCcZI.js → ProjectWorkspacesContent-BNNI_WAk.js} +1 -1
- package/dist/assets/{Projects-DPmo6PFV.js → Projects-BTAauZr0.js} +1 -1
- package/dist/assets/{PublicIssueSharePage-B_W1Qpy_.js → PublicIssueSharePage-DdPjfmD9.js} +1 -1
- package/dist/assets/{ReviewQueueCard-DhfCjwYP.js → ReviewQueueCard-BC6VY8Bc.js} +1 -1
- package/dist/assets/{RichWorkProductCard-rJC8tWnB.js → RichWorkProductCard-ClpMt_Bh.js} +1 -1
- package/dist/assets/{RoutineDetail-Cb0oYk5B.js → RoutineDetail-BT6_GKnC.js} +1 -1
- package/dist/assets/{RoutineRunVariablesDialog-CWNUGmiH.js → RoutineRunVariablesDialog-D_Mls1sV.js} +1 -1
- package/dist/assets/{Routines-Ct6W3Ht-.js → Routines-4LevOfvV.js} +1 -1
- package/dist/assets/{ScrollToBottom-BvL4b3BQ.js → ScrollToBottom-jItsgDR8.js} +1 -1
- package/dist/assets/{Search-CXiBakEC.js → Search-bmcm0_m_.js} +1 -1
- package/dist/assets/{Secrets-XUpMCMhK.js → Secrets-DfR1fBAZ.js} +1 -1
- package/dist/assets/{SkillSourceTree-Brg47aIX.js → SkillSourceTree--FWKWyF3.js} +1 -1
- package/dist/assets/{SkillSources-C3kuN9Hz.js → SkillSources-jUDjqy5i.js} +1 -1
- package/dist/assets/{SkillStudio-DVVVKjdn.js → SkillStudio-BsqtUnzF.js} +1 -1
- package/dist/assets/{SourceTrustBadge-D-MXuX_l.js → SourceTrustBadge-CfBrvKL3.js} +1 -1
- package/dist/assets/{StatusCards-BmNOGr1d.js → StatusCards-Dt3zorUZ.js} +1 -1
- package/dist/assets/{SummarySlotCard-DiTaQ4km.js → SummarySlotCard-D1C0qH2L.js} +1 -1
- package/dist/assets/{TaskChatLab-fOJfHKjI.js → TaskChatLab-B0coUvdp.js} +1 -1
- package/dist/assets/{TaskChatMarker-Cgyrmeab.js → TaskChatMarker-C40twVjh.js} +1 -1
- package/dist/assets/{TaskChatProtocolCard-DrIe_IYV.js → TaskChatProtocolCard--bi_tc6i.js} +1 -1
- package/dist/assets/{TaskChatThreadView-DKqNA1fZ.js → TaskChatThreadView-DkzFDrLW.js} +1 -1
- package/dist/assets/{TaskDetailRelationsPanel-C9mJfMvL.js → TaskDetailRelationsPanel-DZGkinoJ.js} +1 -1
- package/dist/assets/{TaskTreeControls-B1CSnDVK.js → TaskTreeControls-DznugVpi.js} +1 -1
- package/dist/assets/Terminal-NjEb5-2b.js +1 -0
- package/dist/assets/TerminalView-DZxK2Ei5.js +58 -0
- package/dist/assets/{TrustPresetSection-D4qB_VZo.js → TrustPresetSection-CjNwNBo3.js} +1 -1
- package/dist/assets/{UserProfile-Cavc3nhB.js → UserProfile-Dujv3qdz.js} +1 -1
- package/dist/assets/{WhatNeedsMe-B7BSt_wb.js → WhatNeedsMe-C9P2EsqQ.js} +1 -1
- package/dist/assets/{Workspaces-CDTiwIHd.js → Workspaces-BTgSx9nA.js} +1 -1
- package/dist/assets/{connection-owner-Cx9obLlP.js → connection-owner-DL4yKhSt.js} +1 -1
- package/dist/assets/dist-ypeTPGg_.js +1 -0
- package/dist/assets/dropdown-menu-DEO3mF_E.js +1 -0
- package/dist/assets/{environment-variables-editor-CCxeFKKk.js → environment-variables-editor-0qgSPgNN.js} +1 -1
- package/dist/assets/{index-B7mmhFG7.js → index-3AxqhPET.js} +4 -4
- package/dist/assets/index-B5bd7Tk6.css +2 -0
- package/dist/assets/{issue-properties-C_y5-tny.js → issue-properties-B1cYnBDU.js} +1 -1
- package/dist/assets/{issue-workspace-selection-ChtddJZC.js → issue-workspace-selection-S8UgGgK1.js} +1 -1
- package/dist/assets/{pipeline-stage-presentation-jxAxpF6f.js → pipeline-stage-presentation-5UBw7nsb.js} +1 -1
- package/dist/assets/{shared-hwt7Xn4W.js → shared-4LF6wQ38.js} +1 -1
- package/dist/assets/{tool-taxonomy-6170LibQ.js → tool-taxonomy-B5zpbkHA.js} +1 -1
- package/dist/assets/{transcript-adapter-C9uEslxp.js → transcript-adapter-C29ZJiU2.js} +1 -1
- package/dist/assets/{useSummaryDraftStream-BulT3Wwh.js → useSummaryDraftStream-R2Y2bAUU.js} +1 -1
- package/dist/index.html +7 -6
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/Terminal-CGmILZtz.js +0 -1
- package/dist/assets/TerminalView-BqCU9Vc3.js +0 -58
- package/dist/assets/dropdown-menu-CqRAF7Oj.js +0 -1
- package/dist/assets/index-KZ2bEg2H.css +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var ze=Object.defineProperty;var t=(s,a)=>ze(s,"name",{value:a,configurable:!0});import{i as fe}from"./rolldown-runtime-ZpX3ckPj.js";import{l as Q,na as Me,t as qe,ta as $e}from"./createLucideIcon-DJi9suAC.js";import{v as Oe}from"./star-BZgQbzhV.js";import{X as V,_ as B,t as R,v as G}from"./queryKeys-DYV5MhM_.js";import{t as Fe}from"./useInfiniteQuery-B28xptxn.js";import{n as Ge}from"./CompanyContext-CSrVsSze.js";import{o as je,r as Re,t as J}from"./router-2UfGeejU.js";import{n as Le,r as Ke,t as Qe}from"./collapsible-CqjPlqOa.js";import{t as Be}from"./bot-C9arfJWx.js";import{t as Ue}from"./braces-BEVhwPeU.js";import{t as He}from"./check-Ctsrlfa-.js";import{t as ge}from"./chevron-down-BCvxsWfI.js";import{t as We}from"./chevron-left-DP4zwC0G.js";import{t as be}from"./chevron-right-s7L6hXXq.js";import{t as Je}from"./chevron-up-rFDQGA-7.js";import{t as Ve}from"./SearchableSelect-CIJ5K8ih.js";import{t as Ze}from"./circle-question-mark-B1jR2is9.js";import{t as Xe}from"./code-xml-BWc3OvMt.js";import{t as F}from"./copy-_wvZOjTe.js";import{t as Ye}from"./key-round-0RqEOB_C.js";import{t as es}from"./link-BITB8yRp.js";import{t as x}from"./button-CMwV3L1P.js";import{t as ss}from"./plus-C6fnr28l.js";import{t as ts}from"./send-mNwfi_F1.js";import{i as as,n as ns,t as is}from"./tooltip-B5WQ3lq5.js";import{i as H}from"./ToastContext-DMdt9oTd.js";import{t as ls}from"./agents-DmlgUVso.js";import{t as rs}from"./projects-mixWrT5q.js";import{a as ye,i as Ne,n as ve,r as ke,s as we,t as Ce}from"./dialog-CKUblzlR.js";import{t as L}from"./input-DobnTAyB.js";import{t as K}from"./skeleton-Bv_lQagE.js";import{t as A}from"./tools-B-L_sU_9.js";import{n as os}from"./BreadcrumbContext-BVZDZoC0.js";import{t as cs}from"./toggle-switch-BHxNtSq9.js";import{t as Y}from"./clipboard-CTLKYvRL.js";import{Ea as ds,pn as ms,ya as xs}from"./index-B7mmhFG7.js";import{a as $,r as Te}from"./shared-hwt7Xn4W.js";import{_ as us,a as hs,b as oe,c as ps,d as fs,f as Se,g as js,h as O,i as gs,l as bs,o as le,p as Ae,r as U,s as Pe,t as ys,u as ce,v as ie,x as Ns,y as vs}from"./CopyableGatewayUrl-GuvA-DoQ.js";var _e={name:"mouse-pointer-2",size:24,node:[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]};_e.node;var ks=qe(_e),o=fe(Me(),1),e=fe($e(),1),ws={cursor:ks,claude_desktop:Be,vscode:Xe,claude_code:xs,opencode:Ue};function Cs({gateway:s,open:a,onOpenChange:i,createdTokens:p,onTokenCreated:c}){const r=V(),{pushToast:y}=H(),u=(0,o.useMemo)(()=>js(s.clientSnippets??[]),[s.clientSnippets]),N=(0,o.useMemo)(()=>`${typeof window<"u"?window.location.origin:""}${s.endpointPath}`,[s.endpointPath]),f=(0,o.useMemo)(()=>p.filter(l=>{const C=s.tokens.find(M=>M.id===l.id),S=ie(C??l);return S==="active"||S==="expiring"}),[p,s.tokens]),k=(0,o.useMemo)(()=>[{id:"tokens",label:"Available this session",options:f.map(l=>({key:l.id,value:l.id,label:l.name,title:l.clientLabel,searchText:`${l.name} ${l.clientLabel} ${l.tokenPrefix}`,token:l}))}],[f]),[j,w]=(0,o.useState)(u[0]?.client??"raw_url"),[h,v]=(0,o.useState)(""),g=f.find(l=>l.id===h)??null;(0,o.useEffect)(()=>{a&&(w(u[0]?.client??"raw_url"),v(l=>f.some(C=>C.id===l)?l:f[0]?.id??""))},[f,a,u]);const d=B({mutationFn:t(()=>{const l=Pe(s);return A.createGatewayToken(s.companyId,s.id,{name:l,clientLabel:l,ownerNote:"",allowedActions:["tools/list","tools/call"],expiresAt:new Date(Date.now()+7776e6).toISOString()})},"mutationFn"),onSuccess:t(async l=>{c(l),v(l.id),y({title:"Token issued",body:"The copy buttons now include its full Authorization header.",tone:"success"}),await r.invalidateQueries({queryKey:U(s.companyId)})},"onSuccess"),onError:t(l=>y({title:"Token was not issued",body:l instanceof Error?l.message:String(l),tone:"error"}),"onError")});async function D(l,C){try{await Y(l),y({title:"Copied",body:C,tone:"success"})}catch(S){y({title:"Copy failed",body:S instanceof Error?S.message:"Clipboard access is unavailable.",tone:"error"})}}t(D,"copyText");const T=u.find(l=>l.client===j)??null,P=T?ce(T.config,{endpointPath:s.endpointPath,endpoint:N,token:g?O(g):"pcgw_•••"}):"",b=T&&g?ce(T.config,{endpointPath:s.endpointPath,endpoint:N,token:g.token}):null;function _(){d.isPending||d.mutate()}return t(_,"issueToken"),(0,e.jsx)(Ce,{open:a,onOpenChange:i,children:(0,e.jsxs)(ve,{className:"sm:max-w-2xl",children:[(0,e.jsxs)(ye,{children:[(0,e.jsxs)(we,{className:"flex items-center gap-2",children:["Client snippets",(0,e.jsxs)(is,{children:[(0,e.jsx)(as,{asChild:!0,children:(0,e.jsx)("button",{type:"button","aria-label":"About client snippets",className:"text-ink-3 hover:text-ink",children:(0,e.jsx)(Ze,{className:"h-4 w-4"})})}),(0,e.jsx)(ns,{className:"max-w-xs text-xs",children:"Give this MCP gateway configuration to your tool. It does not give it access to Wardmote or skills; it only gateways calls between the client and the tools exposed here."})]})]}),(0,e.jsx)(ke,{children:"Choose a client and copy a complete, authenticated configuration."})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line pb-3",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Authorization"}),f.length>0?(0,e.jsx)(Ve,{value:h,groups:k,onValueChange:v,placeholder:"Issue a token",searchPlaceholder:"Search tokens…",emptyMessage:"No copyable tokens.",contentWidth:"auto",triggerClassName:"h-8 w-auto max-w-xs rounded-full px-3",renderValue:t(l=>l?`${l.label} · ${O(l.token)}`:"Issue a token","renderValue"),renderOption:t(l=>(0,e.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,e.jsx)("span",{className:"truncate",children:l.label}),(0,e.jsx)("span",{className:"truncate font-mono text-(length:--text-micro) text-ink-3",children:O(l.token)})]}),"renderOption"),createItem:{render:t(()=>(0,e.jsx)("span",{children:"+ Issue a new token"}),"render"),onSelect:_}}):(0,e.jsx)(x,{type:"button",variant:"secondary",size:"sm",className:"rounded-full",disabled:d.isPending,onClick:_,children:d.isPending?"Issuing…":"Issue a token"}),g?(0,e.jsxs)(x,{type:"button",variant:"ghost",size:"sm",onClick:t(()=>{D(`Authorization: Bearer ${g.token}`,"Authorization header")},"onClick"),children:[(0,e.jsx)(F,{className:"mr-1 h-3.5 w-3.5"}),"Copy header"]}):null]}),g?null:(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:["Issue a token before copying a snippet; the full ",(0,e.jsx)("code",{children:"Authorization: Bearer …"})," header is required. Existing token secrets cannot be retrieved again, so only tokens issued in this page session can fill a snippet."]}),(0,e.jsxs)("div",{className:"grid gap-4 sm:grid-cols-(--gtc-10)",children:[(0,e.jsxs)("nav",{className:"flex gap-1 overflow-x-auto sm:flex-col","aria-label":"Clients",children:[u.map(l=>{const C=ws[l.client];return(0,e.jsxs)("button",{type:"button",onClick:t(()=>w(l.client),"onClick"),className:Q("flex shrink-0 items-center gap-2 rounded-md px-3 py-1.5 text-left text-sm transition-colors",j===l.client?"bg-bg-3 font-medium text-ink":"text-ink-3 hover:bg-bg-3/60"),children:[(0,e.jsx)(C,{className:"h-4 w-4 shrink-0"}),l.label]},l.client)}),(0,e.jsxs)("button",{type:"button",onClick:t(()=>w("raw_url"),"onClick"),className:Q("flex shrink-0 items-center gap-2 rounded-md px-3 py-1.5 text-left text-sm transition-colors",j==="raw_url"?"bg-bg-3 font-medium text-ink":"text-ink-3 hover:bg-bg-3/60"),children:[(0,e.jsx)(es,{className:"h-4 w-4 shrink-0"}),"Raw URL"]})]}),(0,e.jsxs)("div",{className:"min-w-0 space-y-3",children:[j==="raw_url"?(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-ink",children:"Endpoint URL"}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("code",{className:"min-w-0 flex-1 truncate rounded-md bg-bg-3 px-3 py-2 font-mono text-xs text-ink-3",children:N}),(0,e.jsxs)(x,{variant:"secondary",size:"sm",onClick:t(()=>{D(N,"Endpoint URL")},"onClick"),children:[(0,e.jsx)(F,{className:"mr-1 h-3.5 w-3.5"}),"Copy"]})]})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-ink",children:"Authorization header"}),(0,e.jsx)("code",{className:"block truncate rounded-md bg-bg-3 px-3 py-2 font-mono text-xs text-ink-3",children:g?`Authorization: Bearer ${O(g)}`:"Authorization: Bearer pcgw_•••"})]})]}):T?(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-ink",children:T.label}),(0,e.jsxs)(x,{variant:"secondary",size:"sm",disabled:!b,onClick:t(()=>b&&void D(b,`${T.label} config`),"onClick"),children:[(0,e.jsx)(F,{className:"mr-1 h-3.5 w-3.5"}),"Copy"]})]}),(0,e.jsx)("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md bg-bg-3 p-3 font-mono text-xs text-ink-3",children:P}),T.notes.length>0?(0,e.jsx)("ul",{className:"space-y-1 text-xs text-ink-3",children:T.notes.map(l=>(0,e.jsx)("li",{children:l},l))}):null]}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No client snippets available for this gateway."}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Treat the token like a password. Anyone holding it can call the tools this gateway allows. Revoke it if it leaks."})]})]}),(0,e.jsx)(Ne,{children:(0,e.jsxs)(x,{onClick:t(()=>i(!1),"onClick"),children:[(0,e.jsx)(He,{className:"mr-1.5 h-4 w-4"}),"Done"]})})]})})}t(Cs,"ConnectClientDialog");function Ts({companyId:s,gateway:a,profiles:i,open:p,onOpenChange:c}){const r=V(),{pushToast:y}=H(),[u,N]=(0,o.useState)(a.name),[f,k]=(0,o.useState)(a.description??""),[j,w]=(0,o.useState)(a.profileId);(0,o.useEffect)(()=>{p&&(N(a.name),k(a.description??""),w(a.profileId))},[a,p]);const h=i.filter(d=>d.status!=="archived"),v=B({mutationFn:t(()=>A.updateGateway(s,a.id,{name:u.trim(),description:f.trim()||null,profileId:j}),"mutationFn"),onSuccess:t(async d=>{y({title:"Gateway updated",body:d.name,tone:"success"}),await r.invalidateQueries({queryKey:U(s)}),c(!1)},"onSuccess"),onError:t(d=>{y({title:"Gateway was not updated",body:d instanceof Error?d.message:String(d),tone:"error"})},"onError")});function g(d){d.preventDefault(),!(!u.trim()||!j)&&v.mutate()}return t(g,"submit"),(0,e.jsx)(Ce,{open:p,onOpenChange:c,children:(0,e.jsxs)(ve,{className:"sm:max-w-lg",children:[(0,e.jsxs)(ye,{children:[(0,e.jsx)(we,{children:"Edit gateway"}),(0,e.jsx)(ke,{children:"Change the label or the access profile that controls which tools this endpoint exposes."})]}),(0,e.jsxs)("form",{className:"space-y-4",onSubmit:g,children:[(0,e.jsxs)("label",{className:"block space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Name"}),(0,e.jsx)(L,{value:u,onChange:t(d=>N(d.target.value),"onChange"),required:!0,autoFocus:!0})]}),(0,e.jsxs)("label",{className:"block space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Access profile"}),(0,e.jsx)("select",{className:"w-full rounded-md border border-line-strong bg-bg px-3 py-2 text-sm",value:j,onChange:t(d=>w(d.target.value),"onChange"),required:!0,children:h.map(d=>(0,e.jsxs)("option",{value:d.id,children:[d.name," — ",le(d)]},d.id))})]}),(0,e.jsxs)("label",{className:"block space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Description (optional)"}),(0,e.jsx)("textarea",{className:"min-h-16 w-full rounded-md border border-line-strong bg-bg px-3 py-2 text-sm",value:f,onChange:t(d=>k(d.target.value),"onChange"),placeholder:"Who this endpoint is for."})]}),(0,e.jsxs)(Ne,{children:[(0,e.jsx)(x,{type:"button",variant:"ghost",onClick:t(()=>c(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(x,{type:"submit",disabled:v.isPending||!u.trim()||!j,children:v.isPending?"Saving…":"Save changes"})]})]})]})})}t(Ts,"EditGatewayDialog");function Ss({gateway:s,profile:a,apps:i,agentNames:p,projectNames:c,toggleDisabled:r,onToggle:y}){const{pushToast:u}=H(),N=`${typeof window<"u"?window.location.origin:""}${s.endpointPath}`,f=hs(s),k=bs(s),j=i.filter(g=>g.needsAttention),w=Ae(s),h=["{",' "mcpServers": {',` "wardmote-${s.displaySlug}": {`,` "url": "${N}",`,' "headers": { "Authorization": "Bearer pcgw_•••_TOKEN" }'," }"," }","}"].join(`
|
|
1
|
+
var ze=Object.defineProperty;var t=(s,a)=>ze(s,"name",{value:a,configurable:!0});import{i as fe}from"./rolldown-runtime-ZpX3ckPj.js";import{l as Q,na as Me,t as qe,ta as $e}from"./createLucideIcon-DJi9suAC.js";import{v as Oe}from"./star-BZgQbzhV.js";import{X as V,_ as B,t as R,v as G}from"./queryKeys-DYV5MhM_.js";import{t as Fe}from"./useInfiniteQuery-B28xptxn.js";import{n as Ge}from"./CompanyContext-CSrVsSze.js";import{o as je,r as Re,t as J}from"./router-2UfGeejU.js";import{n as Le,r as Ke,t as Qe}from"./collapsible-CqjPlqOa.js";import{t as Be}from"./bot-C9arfJWx.js";import{t as Ue}from"./braces-BEVhwPeU.js";import{t as He}from"./check-Ctsrlfa-.js";import{t as ge}from"./chevron-down-BCvxsWfI.js";import{t as We}from"./chevron-left-DP4zwC0G.js";import{t as be}from"./chevron-right-s7L6hXXq.js";import{t as Je}from"./chevron-up-rFDQGA-7.js";import{t as Ve}from"./SearchableSelect-CIJ5K8ih.js";import{t as Ze}from"./circle-question-mark-B1jR2is9.js";import{t as Xe}from"./code-xml-BWc3OvMt.js";import{t as F}from"./copy-_wvZOjTe.js";import{t as Ye}from"./key-round-0RqEOB_C.js";import{t as es}from"./link-BITB8yRp.js";import{t as x}from"./button-CMwV3L1P.js";import{t as ss}from"./plus-C6fnr28l.js";import{t as ts}from"./send-mNwfi_F1.js";import{i as as,n as ns,t as is}from"./tooltip-B5WQ3lq5.js";import{i as H}from"./ToastContext-DMdt9oTd.js";import{t as ls}from"./agents-DmlgUVso.js";import{t as rs}from"./projects-mixWrT5q.js";import{a as ye,i as Ne,n as ve,r as ke,s as we,t as Ce}from"./dialog-CKUblzlR.js";import{t as L}from"./input-DobnTAyB.js";import{t as K}from"./skeleton-Bv_lQagE.js";import{t as A}from"./tools-B-L_sU_9.js";import{n as os}from"./BreadcrumbContext-BVZDZoC0.js";import{t as cs}from"./toggle-switch-BHxNtSq9.js";import{t as Y}from"./clipboard-CTLKYvRL.js";import{Ea as ds,pn as ms,ya as xs}from"./index-3AxqhPET.js";import{a as $,r as Te}from"./shared-4LF6wQ38.js";import{_ as us,a as hs,b as oe,c as ps,d as fs,f as Se,g as js,h as O,i as gs,l as bs,o as le,p as Ae,r as U,s as Pe,t as ys,u as ce,v as ie,x as Ns,y as vs}from"./CopyableGatewayUrl-DxQsV7Hr.js";var _e={name:"mouse-pointer-2",size:24,node:[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]};_e.node;var ks=qe(_e),o=fe(Me(),1),e=fe($e(),1),ws={cursor:ks,claude_desktop:Be,vscode:Xe,claude_code:xs,opencode:Ue};function Cs({gateway:s,open:a,onOpenChange:i,createdTokens:p,onTokenCreated:c}){const r=V(),{pushToast:y}=H(),u=(0,o.useMemo)(()=>js(s.clientSnippets??[]),[s.clientSnippets]),N=(0,o.useMemo)(()=>`${typeof window<"u"?window.location.origin:""}${s.endpointPath}`,[s.endpointPath]),f=(0,o.useMemo)(()=>p.filter(l=>{const C=s.tokens.find(M=>M.id===l.id),S=ie(C??l);return S==="active"||S==="expiring"}),[p,s.tokens]),k=(0,o.useMemo)(()=>[{id:"tokens",label:"Available this session",options:f.map(l=>({key:l.id,value:l.id,label:l.name,title:l.clientLabel,searchText:`${l.name} ${l.clientLabel} ${l.tokenPrefix}`,token:l}))}],[f]),[j,w]=(0,o.useState)(u[0]?.client??"raw_url"),[h,v]=(0,o.useState)(""),g=f.find(l=>l.id===h)??null;(0,o.useEffect)(()=>{a&&(w(u[0]?.client??"raw_url"),v(l=>f.some(C=>C.id===l)?l:f[0]?.id??""))},[f,a,u]);const d=B({mutationFn:t(()=>{const l=Pe(s);return A.createGatewayToken(s.companyId,s.id,{name:l,clientLabel:l,ownerNote:"",allowedActions:["tools/list","tools/call"],expiresAt:new Date(Date.now()+7776e6).toISOString()})},"mutationFn"),onSuccess:t(async l=>{c(l),v(l.id),y({title:"Token issued",body:"The copy buttons now include its full Authorization header.",tone:"success"}),await r.invalidateQueries({queryKey:U(s.companyId)})},"onSuccess"),onError:t(l=>y({title:"Token was not issued",body:l instanceof Error?l.message:String(l),tone:"error"}),"onError")});async function D(l,C){try{await Y(l),y({title:"Copied",body:C,tone:"success"})}catch(S){y({title:"Copy failed",body:S instanceof Error?S.message:"Clipboard access is unavailable.",tone:"error"})}}t(D,"copyText");const T=u.find(l=>l.client===j)??null,P=T?ce(T.config,{endpointPath:s.endpointPath,endpoint:N,token:g?O(g):"pcgw_•••"}):"",b=T&&g?ce(T.config,{endpointPath:s.endpointPath,endpoint:N,token:g.token}):null;function _(){d.isPending||d.mutate()}return t(_,"issueToken"),(0,e.jsx)(Ce,{open:a,onOpenChange:i,children:(0,e.jsxs)(ve,{className:"sm:max-w-2xl",children:[(0,e.jsxs)(ye,{children:[(0,e.jsxs)(we,{className:"flex items-center gap-2",children:["Client snippets",(0,e.jsxs)(is,{children:[(0,e.jsx)(as,{asChild:!0,children:(0,e.jsx)("button",{type:"button","aria-label":"About client snippets",className:"text-ink-3 hover:text-ink",children:(0,e.jsx)(Ze,{className:"h-4 w-4"})})}),(0,e.jsx)(ns,{className:"max-w-xs text-xs",children:"Give this MCP gateway configuration to your tool. It does not give it access to Wardmote or skills; it only gateways calls between the client and the tools exposed here."})]})]}),(0,e.jsx)(ke,{children:"Choose a client and copy a complete, authenticated configuration."})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line pb-3",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Authorization"}),f.length>0?(0,e.jsx)(Ve,{value:h,groups:k,onValueChange:v,placeholder:"Issue a token",searchPlaceholder:"Search tokens…",emptyMessage:"No copyable tokens.",contentWidth:"auto",triggerClassName:"h-8 w-auto max-w-xs rounded-full px-3",renderValue:t(l=>l?`${l.label} · ${O(l.token)}`:"Issue a token","renderValue"),renderOption:t(l=>(0,e.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,e.jsx)("span",{className:"truncate",children:l.label}),(0,e.jsx)("span",{className:"truncate font-mono text-(length:--text-micro) text-ink-3",children:O(l.token)})]}),"renderOption"),createItem:{render:t(()=>(0,e.jsx)("span",{children:"+ Issue a new token"}),"render"),onSelect:_}}):(0,e.jsx)(x,{type:"button",variant:"secondary",size:"sm",className:"rounded-full",disabled:d.isPending,onClick:_,children:d.isPending?"Issuing…":"Issue a token"}),g?(0,e.jsxs)(x,{type:"button",variant:"ghost",size:"sm",onClick:t(()=>{D(`Authorization: Bearer ${g.token}`,"Authorization header")},"onClick"),children:[(0,e.jsx)(F,{className:"mr-1 h-3.5 w-3.5"}),"Copy header"]}):null]}),g?null:(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:["Issue a token before copying a snippet; the full ",(0,e.jsx)("code",{children:"Authorization: Bearer …"})," header is required. Existing token secrets cannot be retrieved again, so only tokens issued in this page session can fill a snippet."]}),(0,e.jsxs)("div",{className:"grid gap-4 sm:grid-cols-(--gtc-10)",children:[(0,e.jsxs)("nav",{className:"flex gap-1 overflow-x-auto sm:flex-col","aria-label":"Clients",children:[u.map(l=>{const C=ws[l.client];return(0,e.jsxs)("button",{type:"button",onClick:t(()=>w(l.client),"onClick"),className:Q("flex shrink-0 items-center gap-2 rounded-md px-3 py-1.5 text-left text-sm transition-colors",j===l.client?"bg-bg-3 font-medium text-ink":"text-ink-3 hover:bg-bg-3/60"),children:[(0,e.jsx)(C,{className:"h-4 w-4 shrink-0"}),l.label]},l.client)}),(0,e.jsxs)("button",{type:"button",onClick:t(()=>w("raw_url"),"onClick"),className:Q("flex shrink-0 items-center gap-2 rounded-md px-3 py-1.5 text-left text-sm transition-colors",j==="raw_url"?"bg-bg-3 font-medium text-ink":"text-ink-3 hover:bg-bg-3/60"),children:[(0,e.jsx)(es,{className:"h-4 w-4 shrink-0"}),"Raw URL"]})]}),(0,e.jsxs)("div",{className:"min-w-0 space-y-3",children:[j==="raw_url"?(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-ink",children:"Endpoint URL"}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("code",{className:"min-w-0 flex-1 truncate rounded-md bg-bg-3 px-3 py-2 font-mono text-xs text-ink-3",children:N}),(0,e.jsxs)(x,{variant:"secondary",size:"sm",onClick:t(()=>{D(N,"Endpoint URL")},"onClick"),children:[(0,e.jsx)(F,{className:"mr-1 h-3.5 w-3.5"}),"Copy"]})]})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-ink",children:"Authorization header"}),(0,e.jsx)("code",{className:"block truncate rounded-md bg-bg-3 px-3 py-2 font-mono text-xs text-ink-3",children:g?`Authorization: Bearer ${O(g)}`:"Authorization: Bearer pcgw_•••"})]})]}):T?(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-ink",children:T.label}),(0,e.jsxs)(x,{variant:"secondary",size:"sm",disabled:!b,onClick:t(()=>b&&void D(b,`${T.label} config`),"onClick"),children:[(0,e.jsx)(F,{className:"mr-1 h-3.5 w-3.5"}),"Copy"]})]}),(0,e.jsx)("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md bg-bg-3 p-3 font-mono text-xs text-ink-3",children:P}),T.notes.length>0?(0,e.jsx)("ul",{className:"space-y-1 text-xs text-ink-3",children:T.notes.map(l=>(0,e.jsx)("li",{children:l},l))}):null]}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No client snippets available for this gateway."}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Treat the token like a password. Anyone holding it can call the tools this gateway allows. Revoke it if it leaks."})]})]}),(0,e.jsx)(Ne,{children:(0,e.jsxs)(x,{onClick:t(()=>i(!1),"onClick"),children:[(0,e.jsx)(He,{className:"mr-1.5 h-4 w-4"}),"Done"]})})]})})}t(Cs,"ConnectClientDialog");function Ts({companyId:s,gateway:a,profiles:i,open:p,onOpenChange:c}){const r=V(),{pushToast:y}=H(),[u,N]=(0,o.useState)(a.name),[f,k]=(0,o.useState)(a.description??""),[j,w]=(0,o.useState)(a.profileId);(0,o.useEffect)(()=>{p&&(N(a.name),k(a.description??""),w(a.profileId))},[a,p]);const h=i.filter(d=>d.status!=="archived"),v=B({mutationFn:t(()=>A.updateGateway(s,a.id,{name:u.trim(),description:f.trim()||null,profileId:j}),"mutationFn"),onSuccess:t(async d=>{y({title:"Gateway updated",body:d.name,tone:"success"}),await r.invalidateQueries({queryKey:U(s)}),c(!1)},"onSuccess"),onError:t(d=>{y({title:"Gateway was not updated",body:d instanceof Error?d.message:String(d),tone:"error"})},"onError")});function g(d){d.preventDefault(),!(!u.trim()||!j)&&v.mutate()}return t(g,"submit"),(0,e.jsx)(Ce,{open:p,onOpenChange:c,children:(0,e.jsxs)(ve,{className:"sm:max-w-lg",children:[(0,e.jsxs)(ye,{children:[(0,e.jsx)(we,{children:"Edit gateway"}),(0,e.jsx)(ke,{children:"Change the label or the access profile that controls which tools this endpoint exposes."})]}),(0,e.jsxs)("form",{className:"space-y-4",onSubmit:g,children:[(0,e.jsxs)("label",{className:"block space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Name"}),(0,e.jsx)(L,{value:u,onChange:t(d=>N(d.target.value),"onChange"),required:!0,autoFocus:!0})]}),(0,e.jsxs)("label",{className:"block space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Access profile"}),(0,e.jsx)("select",{className:"w-full rounded-md border border-line-strong bg-bg px-3 py-2 text-sm",value:j,onChange:t(d=>w(d.target.value),"onChange"),required:!0,children:h.map(d=>(0,e.jsxs)("option",{value:d.id,children:[d.name," — ",le(d)]},d.id))})]}),(0,e.jsxs)("label",{className:"block space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Description (optional)"}),(0,e.jsx)("textarea",{className:"min-h-16 w-full rounded-md border border-line-strong bg-bg px-3 py-2 text-sm",value:f,onChange:t(d=>k(d.target.value),"onChange"),placeholder:"Who this endpoint is for."})]}),(0,e.jsxs)(Ne,{children:[(0,e.jsx)(x,{type:"button",variant:"ghost",onClick:t(()=>c(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(x,{type:"submit",disabled:v.isPending||!u.trim()||!j,children:v.isPending?"Saving…":"Save changes"})]})]})]})})}t(Ts,"EditGatewayDialog");function Ss({gateway:s,profile:a,apps:i,agentNames:p,projectNames:c,toggleDisabled:r,onToggle:y}){const{pushToast:u}=H(),N=`${typeof window<"u"?window.location.origin:""}${s.endpointPath}`,f=hs(s),k=bs(s),j=i.filter(g=>g.needsAttention),w=Ae(s),h=["{",' "mcpServers": {',` "wardmote-${s.displaySlug}": {`,` "url": "${N}",`,' "headers": { "Authorization": "Bearer pcgw_•••_TOKEN" }'," }"," }","}"].join(`
|
|
2
2
|
`);async function v(g,d){try{await Y(g),u({title:"Copied",body:d,tone:"success"})}catch{u({title:"Copy failed",body:"Clipboard access is unavailable.",tone:"error"})}}return t(v,"copy"),(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[(0,e.jsxs)("div",{className:"rounded-lg border border-line p-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-ink-3",children:w?"On":"Off"}),(0,e.jsx)("div",{className:"mt-2",children:(0,e.jsx)(cs,{checked:w,disabled:r,onCheckedChange:y,"aria-label":"Toggle gateway"})}),(0,e.jsx)("p",{className:"mt-2 text-xs text-ink-3",children:"Toggle the whole gateway off here."})]}),(0,e.jsxs)(se,{label:"Apps",children:[i.length," ",i.length===1?"app":"apps",a?` · ${le(a)}`:""]}),(0,e.jsxs)(se,{label:"Tokens",children:[f," active",k>0?` · ${k} expiring`:""]}),(0,e.jsx)(se,{label:"Health",children:j.length===0?"All green":`${j.length} needs attention`})]}),(0,e.jsxs)("section",{className:"rounded-lg border border-line p-4",children:[(0,e.jsx)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"Who can use it"}),(0,e.jsx)("p",{className:"mt-1 text-sm text-ink-3",children:"Anyone holding an active token below, restricted by the rules in the bound profile."})]})}),(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,e.jsxs)(te,{children:["Scope · ",fs(s,c,p)]}),(0,e.jsxs)(te,{children:["Profile · ",a?.name??"Unavailable"]}),(0,e.jsxs)(te,{children:[f," active ",f===1?"token":"tokens"]})]})]}),(0,e.jsxs)("section",{className:"rounded-lg border border-line p-4",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"Apps in this gateway"}),i.length===0?(0,e.jsx)("p",{className:"mt-2 text-sm text-ink-3",children:"This gateway’s profile doesn’t include any apps yet."}):(0,e.jsx)("ul",{className:"mt-3 divide-y divide-line",children:i.map(g=>(0,e.jsx)(As,{app:g},g.application.id))})]}),(0,e.jsxs)("section",{className:"rounded-lg border border-line bg-bg-3/30 p-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"How clients connect"}),(0,e.jsxs)(x,{variant:"secondary",size:"sm",onClick:t(()=>{v(h,"Client config")},"onClick"),children:[(0,e.jsx)(F,{className:"mr-1 h-3.5 w-3.5"}),"Copy"]})]}),(0,e.jsx)("pre",{className:"mt-3 overflow-auto whitespace-pre-wrap break-words rounded bg-bg p-3 font-mono text-xs text-ink-3",children:h})]})]})}t(Ss,"OverviewPanel");function se({label:s,children:a}){return(0,e.jsxs)("div",{className:"rounded-lg border border-line p-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-ink-3",children:s}),(0,e.jsx)("div",{className:"mt-2 text-sm font-semibold text-ink",children:a})]})}t(se,"StatCard");function te({children:s}){return(0,e.jsx)("span",{className:"inline-flex items-center rounded-full border border-line px-3 py-1 text-xs font-medium text-ink",children:s})}t(te,"Chip");function As({app:s}){const a=s.connection?`/apps/${s.connection.id}/permissions`:`/apps/app/${s.application.id}/permissions`;return(0,e.jsxs)("li",{className:"flex items-center justify-between gap-3 py-2.5",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)(J,{to:a,className:"font-medium text-ink hover:underline",children:Se(s)}),(0,e.jsxs)("div",{className:"text-xs text-ink-3",children:[s.toolCount," ",s.toolCount===1?"tool":"tools",s.needsAttention&&s.attentionReason?` · ${s.attentionReason}`:""]})]}),(0,e.jsx)("span",{className:Q("shrink-0 rounded-full border px-2 py-0.5 text-xs font-medium",s.needsAttention?"border-ink bg-ink text-bg":"border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:s.needsAttention?"Needs attention":"Healthy"})]})}t(As,"AppRow");function Ps({apps:s,profile:a}){return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:["These apps go through this gateway. The bound profile",a?` (${a.name})`:""," decides which tools are allowed",a?` — ${le(a)}.`:"."," Change the profile under Advanced."]}),s.length===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-line p-6 text-center text-sm text-ink-3",children:"No apps are assigned to this gateway’s profile yet."}):(0,e.jsx)("div",{className:"overflow-x-auto rounded-lg border border-line",children:(0,e.jsxs)("table",{className:"w-full min-w-(--sz-32rem) text-sm",children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{className:"border-b border-line bg-bg-3/40 text-left text-(length:--text-micro) font-semibold uppercase tracking-wide text-ink-3",children:[(0,e.jsx)("th",{className:"px-4 py-2.5",children:"App"}),(0,e.jsx)("th",{className:"px-4 py-2.5",children:"Tools"}),(0,e.jsx)("th",{className:"px-4 py-2.5",children:"Status"}),(0,e.jsx)("th",{className:"px-4 py-2.5 text-right"})]})}),(0,e.jsx)("tbody",{children:s.map(i=>{const p=i.connection?`/apps/${i.connection.id}/permissions`:`/apps/app/${i.application.id}/permissions`;return(0,e.jsxs)("tr",{className:"border-b border-line last:border-0",children:[(0,e.jsxs)("td",{className:"px-4 py-3",children:[(0,e.jsx)(J,{to:p,className:"font-medium text-ink hover:underline",children:Se(i)}),i.needsAttention&&i.attentionReason?(0,e.jsx)("div",{className:"text-xs text-ink-3",children:i.attentionReason}):null]}),(0,e.jsxs)("td",{className:"px-4 py-3 text-ink-3",children:[i.toolCount," ",i.toolCount===1?"tool":"tools"]}),(0,e.jsx)("td",{className:"px-4 py-3",children:(0,e.jsx)("span",{className:Q("inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium",i.needsAttention?"border-ink bg-ink text-bg":"border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:i.needsAttention?"Needs attention":"Healthy"})}),(0,e.jsx)("td",{className:"px-4 py-3 text-right",children:(0,e.jsx)(J,{to:p,className:"text-xs font-medium text-accent hover:underline",children:"Open →"})})]},i.application.id)})})]})})]})}t(Ps,"AppsToolsPanel");var _s=["tools/list","tools/call"],ae=10;function de(){return new Date(Date.now()+7776e6).toISOString().slice(0,10)}t(de,"defaultExpiry");var Es={active:"border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",expiring:"border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-300",expired:"border-line bg-bg-3 text-ink-3",revoked:"border-ink bg-ink text-bg"};function me({status:s}){return(0,e.jsx)("span",{className:Q("inline-flex shrink-0 items-center rounded-full border px-2 py-0.5 text-xs font-medium",Es[s]),children:gs[s]})}t(me,"StatusBadge");function Z({label:s,value:a}){return(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("dt",{className:"text-(length:--text-micro) font-semibold uppercase tracking-wide text-ink-3",children:s}),(0,e.jsx)("dd",{className:"mt-0.5 truncate text-ink",children:a})]})}t(Z,"TokenField");function xe({token:s}){const a=us(s.expiresAt);return a?a.getTime()<=Date.now()?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"font-medium text-ink",children:"Expired"})," ",(0,e.jsx)($,{value:s.expiresAt})]}):(0,e.jsxs)(e.Fragment,{children:["Expires ",(0,e.jsx)($,{value:s.expiresAt})]}):(0,e.jsx)(e.Fragment,{children:"No expiry"})}t(xe,"ExpiryValue");function Ds({companyId:s,gateway:a,onTokenCreated:i}){const p=V(),{pushToast:c}=H(),[r,y]=(0,o.useState)(!1),[u,N]=(0,o.useState)(""),[f,k]=(0,o.useState)(""),[j,w]=(0,o.useState)(de()),[h,v]=(0,o.useState)(null),[g,d]=(0,o.useState)(!1),[D,T]=(0,o.useState)(!1),[P,b]=(0,o.useState)(1),[_,l]=(0,o.useState)(""),[C,S]=(0,o.useState)(null),M=t(()=>p.invalidateQueries({queryKey:U(s)}),"invalidate"),I=(0,o.useMemo)(()=>[...a.tokens].sort((n,E)=>new Date(E.createdAt).getTime()-new Date(n.createdAt).getTime()),[a.tokens]),m=Math.max(1,Math.ceil(I.length/ae)),q=I.slice((P-1)*ae,P*ae);(0,o.useEffect)(()=>{b(n=>Math.min(n,m))},[m]);const W=B({mutationFn:t(()=>A.createGatewayToken(s,a.id,{name:u.trim(),clientLabel:u.trim(),ownerNote:f.trim(),allowedActions:_s,expiresAt:j?`${j}T23:59:59.000Z`:null}),"mutationFn"),onSuccess:t(async n=>{v(n),d(!0),y(!1),N(""),k(""),w(de()),c({title:"Token issued",body:"Copy it now — you won’t see the full value again after leaving this page.",tone:"success"}),i?.(n),await M()},"onSuccess"),onError:t(n=>c({title:"Token was not issued",body:n instanceof Error?n.message:String(n),tone:"error"}),"onError")}),ee=B({mutationFn:t(n=>A.revokeGatewayToken(s,n),"mutationFn"),onSuccess:t(async n=>{S(null),l(""),c({title:"Token revoked",body:`${n.name} can no longer connect.`,tone:"success"}),await M()},"onSuccess"),onError:t(n=>c({title:"Token was not revoked",body:n instanceof Error?n.message:String(n),tone:"error"}),"onError")});async function Ee(n){try{await Y(n),c({title:"Copied",body:"Access token",tone:"success"})}catch(E){c({title:"Copy failed",body:E instanceof Error?E.message:"Clipboard access is unavailable.",tone:"error"})}}t(Ee,"copyToken");function De(){!r&&!u.trim()&&N(Pe(a)),y(n=>!n)}t(De,"startIssuing");function Ie(n){n.preventDefault(),u.trim()&&W.mutate()}t(Ie,"submit");function re(n){S({id:n.id,name:n.name}),l("")}return t(re,"startRevoke"),(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"max-w-2xl space-y-1",children:[(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Issue a reusable token for an external client. Its name is also used as the client label."}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Wardmote creates a fresh one-hour runtime token when an agent run starts, then revokes it when the run ends. Codex can receive the same gateway through both an app connection and the managed-gateway path, so one run may leave two revoked rows. These are audit history, not repeated manual tokens."})]}),(0,e.jsxs)(x,{size:"sm",onClick:De,children:[(0,e.jsx)(ss,{className:"mr-1.5 h-3.5 w-3.5"}),"Issue token"]})]}),r?(0,e.jsxs)("form",{className:"space-y-3",onSubmit:Ie,children:[(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-[1fr_auto]",children:[(0,e.jsxs)("label",{className:"space-y-1.5 text-sm",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Token name"}),(0,e.jsx)(L,{value:u,onChange:t(n=>N(n.target.value),"onChange"),required:!0,autoFocus:!0}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"Also used as the client label."})]}),(0,e.jsxs)("label",{className:"space-y-1.5 text-sm",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Expires"}),(0,e.jsx)(L,{type:"date",value:j,onChange:t(n=>w(n.target.value),"onChange"),required:!0})]})]}),(0,e.jsxs)("label",{className:"block space-y-1.5 text-sm",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Owner note (optional)"}),(0,e.jsx)(L,{value:f,onChange:t(n=>k(n.target.value),"onChange"),placeholder:"Who uses this token or why it exists"})]}),(0,e.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,e.jsx)(x,{type:"button",variant:"ghost",size:"sm",onClick:t(()=>y(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(x,{type:"submit",size:"sm",disabled:W.isPending||!u.trim(),children:W.isPending?"Issuing…":"Issue token"})]})]}):null,h?(0,e.jsxs)("div",{className:"space-y-2 border-y border-line py-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-sm font-semibold text-ink",children:"New token — copy now"}),(0,e.jsx)("div",{className:"text-xs text-ink-3",children:"It is now available in Client snippets for a copy-ready configuration."})]}),(0,e.jsx)(x,{variant:"ghost",size:"sm",onClick:t(()=>v(null),"onClick"),"aria-label":"Dismiss new token",children:"Dismiss"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("code",{className:"min-w-0 flex-1 truncate rounded bg-bg-3 px-3 py-2 font-mono text-xs text-ink",children:g?h.token:O(h)}),g?(0,e.jsxs)(x,{variant:"secondary",size:"sm",onClick:t(()=>{Ee(h.token)},"onClick"),children:[(0,e.jsx)(F,{className:"mr-1 h-3.5 w-3.5"}),"Copy"]}):(0,e.jsx)(x,{variant:"secondary",size:"sm",onClick:t(()=>d(!0),"onClick"),children:"Show"})]})]}):null,(0,e.jsxs)(Qe,{open:D,onOpenChange:T,children:[(0,e.jsx)(Ke,{asChild:!0,children:(0,e.jsxs)(x,{variant:"ghost",className:"h-auto w-full justify-between px-0 py-1 hover:bg-transparent",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-semibold text-ink",children:[(0,e.jsx)(Ye,{className:"h-4 w-4 text-ink-3"}),"Token history",(0,e.jsx)("span",{className:"font-normal text-ink-3",children:I.length})]}),D?(0,e.jsx)(Je,{className:"h-4 w-4"}):(0,e.jsx)(ge,{className:"h-4 w-4"})]})}),(0,e.jsx)(Le,{className:"space-y-3 pt-3",children:I.length===0?(0,e.jsx)("p",{className:"py-4 text-sm text-ink-3",children:"No tokens have been issued for this gateway."}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"hidden overflow-x-auto rounded-lg border border-line sm:block",children:(0,e.jsxs)("table",{className:"w-full min-w-(--sz-44rem) text-sm",children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{className:"border-b border-line bg-bg-3/40 text-left text-(length:--text-micro) font-semibold uppercase tracking-wide text-ink-3",children:[(0,e.jsx)("th",{className:"px-4 py-2.5",children:"Token"}),(0,e.jsx)("th",{className:"px-4 py-2.5",children:"Owner"}),(0,e.jsx)("th",{className:"px-4 py-2.5",children:"Created"}),(0,e.jsx)("th",{className:"px-4 py-2.5",children:"Last used"}),(0,e.jsx)("th",{className:"px-4 py-2.5",children:"Expiry"}),(0,e.jsx)("th",{className:"px-4 py-2.5",children:"Status"}),(0,e.jsx)("th",{className:"px-4 py-2.5 text-right"})]})}),(0,e.jsx)("tbody",{children:q.map(n=>{const E=ie(n);return(0,e.jsxs)("tr",{className:"border-b border-line last:border-0",children:[(0,e.jsxs)("td",{className:"px-4 py-3",children:[(0,e.jsx)("div",{className:"font-medium text-ink",children:n.name}),(0,e.jsx)("div",{className:"font-mono text-xs text-ink-3",children:O(n)})]}),(0,e.jsx)("td",{className:"px-4 py-3 text-ink-3",children:n.clientLabel||n.ownerNote||"—"}),(0,e.jsx)("td",{className:"px-4 py-3 text-ink-3",children:(0,e.jsx)($,{value:n.createdAt})}),(0,e.jsx)("td",{className:"px-4 py-3 text-ink-3",children:n.lastUsedAt?(0,e.jsx)($,{value:n.lastUsedAt}):"—"}),(0,e.jsx)("td",{className:"px-4 py-3 text-ink-3",children:(0,e.jsx)(xe,{token:n})}),(0,e.jsx)("td",{className:"px-4 py-3",children:(0,e.jsx)(me,{status:E})}),(0,e.jsx)("td",{className:"px-4 py-3 text-right",children:E!=="revoked"?(0,e.jsx)(x,{variant:"danger",size:"sm",className:"h-7 px-2 text-xs",onClick:t(()=>re(n),"onClick"),children:"Revoke"}):null})]},n.id)})})]})}),(0,e.jsx)("div",{className:"space-y-3 sm:hidden",children:q.map(n=>{const E=ie(n);return(0,e.jsxs)("div",{className:"border-b border-line py-3 last:border-0",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"font-medium text-ink",children:n.name}),(0,e.jsx)("div",{className:"font-mono text-xs text-ink-3",children:O(n)})]}),(0,e.jsx)(me,{status:E})]}),(0,e.jsxs)("dl",{className:"mt-3 grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[(0,e.jsx)(Z,{label:"Owner",value:n.clientLabel||n.ownerNote||"—"}),(0,e.jsx)(Z,{label:"Created",value:(0,e.jsx)($,{value:n.createdAt})}),(0,e.jsx)(Z,{label:"Last used",value:n.lastUsedAt?(0,e.jsx)($,{value:n.lastUsedAt}):"—"}),(0,e.jsx)(Z,{label:"Expiry",value:(0,e.jsx)(xe,{token:n})})]}),E!=="revoked"?(0,e.jsx)(x,{variant:"danger",size:"sm",className:"mt-3 w-full text-xs",onClick:t(()=>re(n),"onClick"),children:"Revoke"}):null]},n.id)})}),m>1?(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:["Page ",P," of ",m," · ",I.length," tokens"]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(x,{variant:"ghost",size:"sm",disabled:P===1,onClick:t(()=>b(n=>Math.max(1,n-1)),"onClick"),"aria-label":"Previous token page",children:(0,e.jsx)(We,{className:"h-4 w-4"})}),(0,e.jsx)(x,{variant:"ghost",size:"sm",disabled:P===m,onClick:t(()=>b(n=>Math.min(m,n+1)),"onClick"),"aria-label":"Next token page",children:(0,e.jsx)(be,{className:"h-4 w-4"})})]})]}):null]})})]}),C?(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",role:"dialog","aria-modal":"true",children:(0,e.jsxs)("div",{className:"w-full max-w-md space-y-3 rounded-lg border border-line bg-bg-2 p-5 shadow-lg",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"Revoke this token?"}),(0,e.jsxs)("p",{className:"mt-1 text-sm text-ink-3",children:["Any client using ",(0,e.jsx)("span",{className:"font-medium text-ink",children:C.name})," goes silent immediately. This can’t be undone. Type the token name to confirm."]})]}),(0,e.jsx)(L,{value:_,onChange:t(n=>l(n.target.value),"onChange"),placeholder:C.name,"aria-label":"Type the token name to confirm",autoFocus:!0}),(0,e.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,e.jsx)(x,{variant:"ghost",size:"sm",onClick:t(()=>{S(null),l("")},"onClick"),children:"Cancel"}),(0,e.jsx)(x,{variant:"danger",size:"sm",disabled:_.trim()!==C.name||ee.isPending,onClick:t(()=>ee.mutate(C.id),"onClick"),children:ee.isPending?"Revoking…":"Revoke token"})]})]})}):null]})}t(Ds,"TokensPanel");var Is=25,ue={allowed:{label:"Allowed",status:"allowed"},blocked:{label:"Blocked",status:"denied"},asked_first:{label:"Asked first",status:"require-approval"},waiting:{label:"Waiting",status:"deferred"},failed:{label:"Failed",status:"failed"},unknown:{label:"Recorded",status:"unchecked"}};function ne(s,a){const i=s?.[a];return typeof i=="string"&&i.trim().length>0?i:null}t(ne,"detailString");function he(s){if(!s?.summary)return null;try{return JSON.stringify(JSON.parse(s.summary),null,2)}catch{return s.summary}}t(he,"formatSummary");function pe(s,a){const i=s?.[a];if(!i||typeof i!="object"||Array.isArray(i))return null;const p=i.summary;return typeof p=="string"?{summary:p}:null}t(pe,"summaryFromDetails");function zs(s){const a=s.invocation?.startedAt?new Date(s.invocation.startedAt).getTime():NaN,i=s.invocation?.completedAt?new Date(s.invocation.completedAt).getTime():NaN;return!Number.isFinite(a)||!Number.isFinite(i)||i<a?null:`${i-a} ms`}t(zs,"durationLabel");function z({label:s,value:a,mono:i=!1}){return(0,e.jsxs)("div",{className:"flex gap-3 py-1",children:[(0,e.jsx)("dt",{className:"w-28 shrink-0 text-ink-3",children:s}),(0,e.jsx)("dd",{className:i?"min-w-0 break-all font-mono text-(length:--text-micro) text-ink":"min-w-0 text-ink",children:a})]})}t(z,"Fact");function Ms({event:s}){const[a,i]=(0,o.useState)(!1),p=ue[s.normalizedOutcome]??ue.unknown,c=s.agentDisplayName??"Client",r=s.appDisplayName??s.connectionDisplayName??s.applicationDisplayName??"App",y=s.toolDisplayName??s.invocation?.toolName??"Tool call",u=s.invocation?.toolName??ne(s.details,"tool")??ne(s.details,"toolName"),N=ne(s.details,"reasonCode"),f=he(s.invocation?.argumentsSummary??pe(s.details,"argumentsSummary")),k=he(s.invocation?.resultSummary??pe(s.details,"resultSummary")),j=zs(s);return(0,e.jsxs)("li",{className:"text-sm",children:[(0,e.jsxs)("button",{type:"button",onClick:t(()=>i(w=>!w),"onClick"),className:"flex w-full items-start gap-2.5 px-4 py-3 text-left hover:bg-bg-3/50","aria-expanded":a,children:[a?(0,e.jsx)(ge,{className:"mt-0.5 h-4 w-4 shrink-0 text-ink-3"}):(0,e.jsx)(be,{className:"mt-0.5 h-4 w-4 shrink-0 text-ink-3"}),(0,e.jsx)("span",{className:"min-w-0 flex-1",children:(0,e.jsxs)("span",{className:"block text-ink",children:[(0,e.jsx)("span",{className:"font-medium",children:c})," used ",(0,e.jsx)("span",{className:"font-medium",children:y})," in ",r]})}),(0,e.jsxs)("span",{className:"flex shrink-0 items-center gap-2 whitespace-nowrap",children:[(0,e.jsx)(ms,{status:p.status,label:p.label}),(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:["· ",(0,e.jsx)($,{value:s.createdAt})]})]})]}),a?(0,e.jsxs)("div",{className:"border-t border-line bg-bg-3/30 px-4 py-3 pl-10 text-xs",children:[(0,e.jsxs)("dl",{children:[u?(0,e.jsx)(z,{label:"Tool",value:u,mono:!0}):null,s.invocation?.status?(0,e.jsx)(z,{label:"Call status",value:s.invocation.status}):null,s.invocation?.policyDecision?(0,e.jsx)(z,{label:"Decision",value:s.invocation.policyDecision}):null,N?(0,e.jsx)(z,{label:"Reason",value:N,mono:!0}):null,j?(0,e.jsx)(z,{label:"Duration",value:j}):null,s.invocation?.id?(0,e.jsx)(z,{label:"Invocation ID",value:s.invocation.id,mono:!0}):null,s.invocation?.errorCode?(0,e.jsx)(z,{label:"Error code",value:s.invocation.errorCode,mono:!0}):null,s.invocation?.errorMessage?(0,e.jsx)(z,{label:"Error",value:s.invocation.errorMessage}):null]}),f?(0,e.jsxs)("div",{className:"mt-2 space-y-1",children:[(0,e.jsx)("div",{className:"text-ink-3",children:"Arguments (redacted)"}),(0,e.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words rounded-md border border-line bg-bg p-3 font-mono text-xs text-ink",children:f})]}):null,k?(0,e.jsxs)("div",{className:"mt-3 space-y-1",children:[(0,e.jsx)("div",{className:"text-ink-3",children:"Result (redacted)"}),(0,e.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words rounded-md border border-line bg-bg p-3 font-mono text-xs text-ink",children:k})]}):null]}):null]})}t(Ms,"ActivityRow");function qs({companyId:s,gateway:a}){const i=Fe({queryKey:R.tools.activity(s,{gateway:a.id,window:"30d"}),queryFn:t(({pageParam:c})=>A.listActivity(s,{gateway:a.id,window:"30d",limit:Is,cursor:c??void 0}),"queryFn"),initialPageParam:null,getNextPageParam:t(c=>c.nextCursor??void 0,"getNextPageParam")}),p=(0,o.useMemo)(()=>i.data?.pages.flatMap(c=>c.events)??[],[i.data]);return i.isLoading?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(K,{className:"h-12 w-full"}),(0,e.jsx)(K,{className:"h-12 w-full"}),(0,e.jsx)(K,{className:"h-12 w-full"})]}):i.isError?(0,e.jsx)(Te,{error:i.error,onRetry:t(()=>i.refetch(),"onRetry")}):(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Calls through this gateway from the last 30 days. Open a row to inspect its tool, redacted arguments, result, and decision."}),p.length===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-line p-6 text-center text-sm text-ink-3",children:"No calls have gone through this gateway yet."}):(0,e.jsx)("ul",{className:"divide-y divide-line rounded-lg border border-line",children:p.map(c=>(0,e.jsx)(Ms,{event:c},c.id))}),i.hasNextPage?(0,e.jsx)("div",{className:"flex justify-center",children:(0,e.jsx)(x,{variant:"secondary",size:"sm",onClick:t(()=>i.fetchNextPage(),"onClick"),disabled:i.isFetchingNextPage,children:i.isFetchingNextPage?"Loading…":"Load more"})}):null]})}t(qs,"GatewayActivityPanel");function $s({companyId:s,gateway:a}){const i=V(),p=je(),{pushToast:c}=H(),[r,y]=(0,o.useState)(!1),[u,N]=(0,o.useState)(""),f=`${typeof window<"u"?window.location.origin:""}${a.endpointPath}`,k=JSON.stringify({gatewayPublicId:a.gatewayPublicId,displaySlug:a.displaySlug,status:a.status,profileId:a.profileId,defaultProfileMode:a.defaultProfileMode,contextScopeType:a.contextScopeType,contextScopeId:a.contextScopeId,endpointPath:a.endpointPath,authConfig:a.authConfig,headerPolicy:a.headerPolicy,metadataPolicy:a.metadataPolicy,onDemandToolsConfig:a.onDemandToolsConfig},null,2),j=B({mutationFn:t(()=>A.updateGateway(s,a.id,{status:"archived"}),"mutationFn"),onSuccess:t(async()=>{c({title:"Gateway archived",body:`${a.name} is no longer reachable.`,tone:"success"}),await i.invalidateQueries({queryKey:U(s)}),p("/apps/gateways")},"onSuccess"),onError:t(h=>c({title:"Couldn't archive the gateway",body:h instanceof Error?h.message:String(h),tone:"error"}),"onError")});async function w(h,v){try{await Y(h),c({title:"Copied",body:v,tone:"success"})}catch{c({title:"Copy failed",body:"Clipboard access is unavailable.",tone:"error"})}}return t(w,"copy"),(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"Transport"}),(0,e.jsxs)("dl",{className:"grid gap-x-6 gap-y-2 text-sm sm:grid-cols-2",children:[(0,e.jsx)(X,{label:"Transport",value:"streamable_http"}),(0,e.jsx)(X,{label:"Authentication",value:"bearer"}),(0,e.jsx)(X,{label:"Protocol version",value:"2025-03-26"}),(0,e.jsx)(X,{label:"Public ID",value:a.gatewayPublicId,mono:!0})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("code",{className:"min-w-0 flex-1 truncate rounded-md bg-bg-3 px-3 py-2 font-mono text-xs text-ink-3",children:f}),(0,e.jsxs)(x,{variant:"secondary",size:"sm",onClick:t(()=>{w(f,"Endpoint URL")},"onClick"),children:[(0,e.jsx)(F,{className:"mr-1 h-3.5 w-3.5"}),"Copy"]})]})]}),(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"Raw configuration"}),(0,e.jsxs)(x,{variant:"secondary",size:"sm",onClick:t(()=>{w(k,"Gateway config JSON")},"onClick"),children:[(0,e.jsx)(F,{className:"mr-1 h-3.5 w-3.5"}),"Copy JSON"]})]}),(0,e.jsx)("pre",{className:"max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md bg-bg-3 p-3 font-mono text-xs text-ink-3",children:k})]}),(0,e.jsxs)("section",{className:"space-y-2 rounded-lg border border-bad/40 p-4",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-bad",children:"Danger zone"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Archiving takes the gateway offline for every client. Existing tokens stop working. Type the gateway name to confirm."}),r?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(L,{value:u,onChange:t(h=>N(h.target.value),"onChange"),placeholder:a.name,"aria-label":"Type the gateway name to confirm archive"}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(x,{variant:"danger",size:"sm",disabled:u.trim()!==a.name||j.isPending,onClick:t(()=>j.mutate(),"onClick"),children:j.isPending?"Archiving…":"Archive gateway"}),(0,e.jsx)(x,{variant:"ghost",size:"sm",onClick:t(()=>{y(!1),N("")},"onClick"),children:"Cancel"})]})]}):(0,e.jsx)(x,{variant:"danger",size:"sm",onClick:t(()=>y(!0),"onClick"),children:"Archive gateway"})]})]})}t($s,"GatewayAdvancedPanel");function X({label:s,value:a,mono:i}){return(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-xs font-medium text-ink-3",children:s}),(0,e.jsx)("dd",{className:i?"mt-0.5 font-mono text-ink":"mt-0.5 text-ink",children:a})]})}t(X,"Row");function kt(){const{gatewayId:s="",tab:a}=Oe(),i=je(),p=V(),{pushToast:c}=H(),{selectedCompanyId:r}=Ge(),{setBreadcrumbs:y}=os(),[u,N]=(0,o.useState)(!1),[f,k]=(0,o.useState)(!1),[j,w]=(0,o.useState)([]),h=Ns(a)?a:null,v=G({queryKey:U(r??"__none__"),queryFn:t(()=>A.listGateways(r),"queryFn"),enabled:!!r}),g=G({queryKey:R.tools.profiles(r??"__none__"),queryFn:t(()=>A.listProfiles(r),"queryFn"),enabled:!!r}),d=G({queryKey:R.tools.connections(r??"__none__"),queryFn:t(()=>A.listConnections(r),"queryFn"),enabled:!!r}),D=G({queryKey:R.tools.applications(r??"__none__"),queryFn:t(()=>A.listApplications(r),"queryFn"),enabled:!!r}),T=G({queryKey:R.agents.list(r??"__none__"),queryFn:t(()=>ls.list(r),"queryFn"),enabled:!!r}),P=G({queryKey:R.projects.list(r??"__none__",{includeArchived:!0}),queryFn:t(()=>rs.list(r,{includeArchived:!0}),"queryFn"),enabled:!!r}),b=(0,o.useMemo)(()=>(v.data?.gateways??[]).find(m=>m.id===s),[v.data,s]),_=(0,o.useMemo)(()=>(g.data?.profiles??[]).find(m=>m.id===b?.profileId),[g.data,b?.profileId]),l=(0,o.useMemo)(()=>ps(_,D.data?.applications??[],d.data?.connections??[]),[_,D.data,d.data]),C=(0,o.useMemo)(()=>new Map((T.data??[]).map(m=>[m.id,m.name])),[T.data]),S=(0,o.useMemo)(()=>new Map((P.data??[]).map(m=>[m.id,m.name])),[P.data]);function M(m){w(q=>[m,...q.filter(W=>W.id!==m.id)])}t(M,"rememberCreatedToken"),(0,o.useEffect)(()=>{if(b)return y([{label:"Connectors",href:"/apps"},{label:"Gateways",href:"/apps/gateways"},{label:b.name}]),()=>y([])},[y,b]);const I=B({mutationFn:t(()=>A.updateGateway(r,s,{status:b&&Ae(b)?"disabled":"active"}),"mutationFn"),onSuccess:t(async m=>{c({title:m.status==="active"?"Gateway on":"Gateway off",body:m.status==="active"?`${m.name} is exposing its tools again.`:`${m.name} is off — every client goes silent.`,tone:"success"}),await p.invalidateQueries({queryKey:U(r)})},"onSuccess"),onError:t(m=>c({title:"Couldn't update the gateway",body:m instanceof Error?m.message:String(m),tone:"error"}),"onError")});return r?h?v.isLoading?(0,e.jsxs)("div",{className:"max-w-4xl space-y-4",children:[(0,e.jsx)(K,{className:"h-10 w-64"}),(0,e.jsx)(K,{className:"h-9 w-full max-w-lg"}),(0,e.jsx)(K,{className:"h-64 w-full"})]}):v.isError?(0,e.jsx)(Te,{error:v.error,onRetry:t(()=>v.refetch(),"onRetry")}):b?(0,e.jsxs)("div",{className:"max-w-4xl space-y-5 pb-12",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-xs text-ink-3",children:(0,e.jsx)(J,{to:"/apps/gateways",className:"hover:underline",children:"Apps · Gateways"})}),(0,e.jsx)("h1",{className:"mt-1 text-2xl font-bold tracking-tight",children:b.name}),(0,e.jsx)(ys,{endpointPath:b.endpointPath,className:"mt-1 max-w-xl"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)(x,{variant:"secondary",onClick:t(()=>k(!0),"onClick"),children:[(0,e.jsx)(ds,{className:"mr-1.5 h-4 w-4"}),"Edit"]}),(0,e.jsxs)(x,{onClick:t(()=>N(!0),"onClick"),children:[(0,e.jsx)(ts,{className:"mr-1.5 h-4 w-4"}),"Client snippets"]})]})]}),(0,e.jsx)("nav",{className:"flex items-center gap-6 overflow-x-auto border-b border-line text-sm","aria-label":"Gateway tabs",children:vs.map(m=>{const q=m.key===h;return(0,e.jsx)(J,{to:oe(s,m.key),className:Q("-mb-px shrink-0 border-b-2 pb-2.5 pt-1 font-medium transition-colors",q?"border-ink text-ink":"border-transparent text-ink-3 hover:text-ink"),"aria-current":q?"page":void 0,children:m.label},m.key)})}),h==="overview"&&(0,e.jsx)(Ss,{gateway:b,profile:_,apps:l,agentNames:C,projectNames:S,toggleDisabled:I.isPending,onToggle:t(()=>I.mutate(),"onToggle")}),h==="apps"&&(0,e.jsx)(Ps,{apps:l,profile:_}),h==="tokens"&&(0,e.jsx)(Ds,{companyId:r,gateway:b,onTokenCreated:M}),h==="activity"&&(0,e.jsx)(qs,{companyId:r,gateway:b}),h==="advanced"&&(0,e.jsx)($s,{companyId:r,gateway:b}),(0,e.jsx)(Cs,{gateway:b,open:u,onOpenChange:N,createdTokens:j,onTokenCreated:M}),(0,e.jsx)(Ts,{companyId:r,gateway:b,profiles:g.data?.profiles??[],open:f,onOpenChange:k})]}):(0,e.jsxs)("div",{className:"max-w-3xl p-6",children:[(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"We couldn’t find that gateway."}),(0,e.jsx)(x,{className:"mt-4",variant:"secondary",onClick:t(()=>i("/apps/gateways"),"onClick"),children:"Back to gateways"})]}):(0,e.jsx)(Re,{replace:!0,to:oe(s,"overview")}):(0,e.jsx)("div",{className:"p-6 text-sm text-ink-3",children:"Select an organization to manage gateways."})}t(kt,"GatewayDetail");export{kt as GatewayDetail};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var Y=Object.defineProperty;var t=(o,d)=>Y(o,"name",{value:d,configurable:!0});import{i as I}from"./rolldown-runtime-ZpX3ckPj.js";import{na as J,ta as U}from"./createLucideIcon-DJi9suAC.js";import{X as V,_ as Z,t as h,v as l}from"./queryKeys-DYV5MhM_.js";import{n as ee}from"./CompanyContext-CSrVsSze.js";import{o as se}from"./router-2UfGeejU.js";import{t as B}from"./button-CMwV3L1P.js";import{t as O}from"./plus-C6fnr28l.js";import{t as te}from"./search-04O7m-IF.js";import{i as ae}from"./ToastContext-DMdt9oTd.js";import{t as ne}from"./agents-DmlgUVso.js";import{t as re}from"./projects-mixWrT5q.js";import{t as oe}from"./input-DobnTAyB.js";import{t as L}from"./skeleton-Bv_lQagE.js";import{t as u}from"./tools-B-L_sU_9.js";import{n as ie}from"./BreadcrumbContext-BVZDZoC0.js";import{t as le}from"./toggle-switch-BHxNtSq9.js";import{a as Q,r as ce}from"./shared-
|
|
1
|
+
var Y=Object.defineProperty;var t=(o,d)=>Y(o,"name",{value:d,configurable:!0});import{i as I}from"./rolldown-runtime-ZpX3ckPj.js";import{na as J,ta as U}from"./createLucideIcon-DJi9suAC.js";import{X as V,_ as Z,t as h,v as l}from"./queryKeys-DYV5MhM_.js";import{n as ee}from"./CompanyContext-CSrVsSze.js";import{o as se}from"./router-2UfGeejU.js";import{t as B}from"./button-CMwV3L1P.js";import{t as O}from"./plus-C6fnr28l.js";import{t as te}from"./search-04O7m-IF.js";import{i as ae}from"./ToastContext-DMdt9oTd.js";import{t as ne}from"./agents-DmlgUVso.js";import{t as re}from"./projects-mixWrT5q.js";import{t as oe}from"./input-DobnTAyB.js";import{t as L}from"./skeleton-Bv_lQagE.js";import{t as u}from"./tools-B-L_sU_9.js";import{n as ie}from"./BreadcrumbContext-BVZDZoC0.js";import{t as le}from"./toggle-switch-BHxNtSq9.js";import{a as Q,r as ce}from"./shared-4LF6wQ38.js";import{a as de,b as F,c as pe,d as K,l as me,m as xe,n as he,o as ue,p as _,r as P,t as E}from"./CopyableGatewayUrl-DxQsV7Hr.js";var c=I(J(),1),e=I(U(),1);function Fe(){const o=se(),d=V(),{pushToast:C}=ae(),{selectedCompanyId:a}=ee(),{setBreadcrumbs:f}=ie(),[b,R]=(0,c.useState)(""),[z,g]=(0,c.useState)(!1);(0,c.useEffect)(()=>(f([{label:"Connectors",href:"/apps"},{label:"Gateways"}]),()=>f([])),[f]);const p=l({queryKey:P(a??"__none__"),queryFn:t(()=>u.listGateways(a),"queryFn"),enabled:!!a}),S=l({queryKey:h.tools.profiles(a??"__none__"),queryFn:t(()=>u.listProfiles(a),"queryFn"),enabled:!!a}),D=l({queryKey:h.tools.connections(a??"__none__"),queryFn:t(()=>u.listConnections(a),"queryFn"),enabled:!!a}),H=l({queryKey:h.tools.applications(a??"__none__"),queryFn:t(()=>u.listApplications(a),"queryFn"),enabled:!!a}),q=l({queryKey:h.agents.list(a??"__none__"),queryFn:t(()=>ne.list(a),"queryFn"),enabled:!!a}),G=l({queryKey:h.projects.list(a??"__none__"),queryFn:t(()=>re.list(a),"queryFn"),enabled:!!a}),W=(0,c.useMemo)(()=>new Map((S.data?.profiles??[]).map(s=>[s.id,s])),[S.data]),T=(0,c.useMemo)(()=>new Map((q.data??[]).map(s=>[s.id,s.name])),[q.data]),$=(0,c.useMemo)(()=>new Map((G.data??[]).map(s=>[s.id,s.name])),[G.data]),M=Z({mutationFn:t(({gateway:s})=>u.updateGateway(a,s.id,{status:_(s)?"disabled":"active"}),"mutationFn"),onSuccess:t(async s=>{C({title:s.status==="active"?"Gateway on":"Gateway off",body:s.status==="active"?`${s.name} is exposing its tools again.`:`${s.name} is off — every client goes silent.`,tone:"success"}),await d.invalidateQueries({queryKey:P(a)})},"onSuccess"),onError:t(s=>C({title:"Couldn't update the gateway",body:s instanceof Error?s.message:String(s),tone:"error"}),"onError")});if(!a)return(0,e.jsx)("div",{className:"p-6 text-sm text-ink-3",children:"Select an organization to manage gateways."});const N=p.data?.gateways??[],y=b.trim().toLowerCase(),X=y?N.filter(s=>{const j=K(s,$,T).toLowerCase();return s.name.toLowerCase().includes(y)||s.displaySlug.toLowerCase().includes(y)||j.includes(y)}):N;return(0,e.jsxs)("div",{className:"max-w-5xl space-y-5",children:[(0,e.jsxs)("header",{className:"space-y-1",children:[(0,e.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:"Apps"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"A gateway is one safe MCP endpoint that exposes only the apps you assign. Hand it to a client like Cursor or Claude Desktop."})]}),p.isLoading?(0,e.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,e.jsx)(L,{className:"h-9 w-full max-w-sm"}),(0,e.jsx)(L,{className:"h-52 w-full"})]}):p.isError?(0,e.jsx)(ce,{error:p.error,onRetry:t(()=>p.refetch(),"onRetry")}):N.length===0?(0,e.jsx)(ye,{onCreate:t(()=>g(!0),"onCreate")}):(0,e.jsxs)("div",{className:"space-y-4 pt-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"relative w-full max-w-sm",children:[(0,e.jsx)(te,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-ink-3"}),(0,e.jsx)(oe,{value:b,onChange:t(s=>R(s.target.value),"onChange"),placeholder:"Search by name, app, or owner",className:"pl-9","aria-label":"Search gateways"})]}),(0,e.jsxs)(B,{onClick:t(()=>g(!0),"onClick"),children:[(0,e.jsx)(O,{className:"mr-1.5 h-4 w-4"}),"New gateway"]})]}),(()=>{const s=X.map(n=>{const r=W.get(n.profileId),i=pe(r,H.data?.applications??[],D.data?.connections??[]);return{gateway:n,profile:r,scope:K(n,$,T),appsLabel:`${i.length} ${i.length===1?"app":"apps"}${r?` · ${ue(r)}`:""}`,active:de(n),expiring:me(n),lastUsed:xe(n),href:F(n.id,"overview")}}),j=t(n=>(0,e.jsx)(le,{checked:_(n),disabled:M.isPending,onClick:t(r=>r.stopPropagation(),"onClick"),onCheckedChange:t(()=>M.mutate({gateway:n}),"onCheckedChange"),"aria-label":`Turn ${n.name} ${_(n)?"off":"on"}`}),"toggle"),A=(0,e.jsxs)("div",{className:"px-4 py-8 text-center text-sm text-ink-3",children:["No gateways match “",b.trim(),"”."]});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"hidden overflow-x-auto rounded-lg border border-line sm:block",children:(0,e.jsxs)("table",{className:"w-full min-w-(--sz-40rem) text-sm",children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{className:"border-b border-line bg-bg-3/40 text-left text-(length:--text-micro) font-semibold uppercase tracking-wide text-ink-3",children:[(0,e.jsx)("th",{className:"whitespace-nowrap px-4 py-2.5",children:"Gateway"}),(0,e.jsx)("th",{className:"whitespace-nowrap px-4 py-2.5",children:"Scope"}),(0,e.jsx)("th",{className:"whitespace-nowrap px-4 py-2.5",children:"Apps"}),(0,e.jsx)("th",{className:"whitespace-nowrap px-4 py-2.5",children:"Tokens"}),(0,e.jsx)("th",{className:"whitespace-nowrap px-4 py-2.5",children:"Last used"}),(0,e.jsx)("th",{className:"whitespace-nowrap px-4 py-2.5 text-right",children:"On"})]})}),(0,e.jsxs)("tbody",{children:[s.map(({gateway:n,scope:r,appsLabel:i,active:v,expiring:m,lastUsed:x,href:k})=>(0,e.jsxs)("tr",{onClick:t(()=>o(k),"onClick"),className:"cursor-pointer border-b border-line transition-colors last:border-0 hover:bg-bg-3/30",children:[(0,e.jsxs)("td",{className:"w-64 max-w-64 whitespace-nowrap px-4 py-3",children:[(0,e.jsx)("div",{className:"font-medium text-ink",children:n.name}),(0,e.jsx)(E,{endpointPath:n.endpointPath})]}),(0,e.jsx)("td",{className:"whitespace-nowrap px-4 py-3 text-ink-3",children:r}),(0,e.jsx)("td",{className:"whitespace-nowrap px-4 py-3 text-ink-3",children:i}),(0,e.jsxs)("td",{className:"whitespace-nowrap px-4 py-3 text-ink-3",children:[v," active",m>0?` · ${m} expiring`:""]}),(0,e.jsx)("td",{className:"whitespace-nowrap px-4 py-3 text-ink-3",children:x?(0,e.jsx)(Q,{value:x}):"—"}),(0,e.jsx)("td",{className:"px-4 py-3",children:(0,e.jsx)("div",{className:"flex justify-end",children:j(n)})})]},n.id)),s.length===0?(0,e.jsx)("tr",{children:(0,e.jsx)("td",{colSpan:6,children:A})}):null]})]})}),(0,e.jsxs)("div",{className:"space-y-3 sm:hidden",children:[s.map(({gateway:n,scope:r,appsLabel:i,active:v,expiring:m,lastUsed:x,href:k})=>(0,e.jsxs)("div",{onClick:t(()=>o(k),"onClick"),className:"cursor-pointer rounded-lg border border-line p-4 transition-colors hover:bg-bg-3/30",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"font-medium text-ink",children:n.name}),(0,e.jsx)(E,{endpointPath:n.endpointPath})]}),(0,e.jsx)("div",{className:"shrink-0",children:j(n)})]}),(0,e.jsxs)("dl",{className:"mt-3 grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[(0,e.jsx)(w,{label:"Scope",value:r}),(0,e.jsx)(w,{label:"Apps",value:i}),(0,e.jsx)(w,{label:"Tokens",value:`${v} active${m>0?` · ${m} expiring`:""}`}),(0,e.jsx)(w,{label:"Last used",value:x?(0,e.jsx)(Q,{value:x}):"—"})]})]},n.id)),s.length===0?(0,e.jsx)("div",{className:"rounded-lg border border-line",children:A}):null]})]})})(),(0,e.jsxs)("div",{className:"rounded-lg border border-line bg-bg-3/30 px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm font-semibold text-ink",children:"Why a gateway?"}),(0,e.jsx)("p",{className:"mt-1 text-sm text-ink-3",children:"You pick which apps go through it, who can use it, and how. Revoke the token, the whole gateway goes silent — no app-by-app cleanup."})]})]}),(0,e.jsx)(he,{companyId:a,open:z,onOpenChange:g,onCreated:t(s=>o(F(s,"overview")),"onCreated")})]})}t(Fe,"GatewaysList");function w({label:o,value:d}){return(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("dt",{className:"text-(length:--text-micro) font-semibold uppercase tracking-wide text-ink-3",children:o}),(0,e.jsx)("dd",{className:"mt-0.5 truncate text-ink",children:d})]})}t(w,"MobileField");function ye({onCreate:o}){return(0,e.jsxs)("div",{className:"rounded-2xl border border-dashed border-line p-12 text-center",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold text-ink",children:"No gateways yet"}),(0,e.jsx)("p",{className:"mx-auto mt-2 max-w-sm text-sm text-ink-3",children:"Group your connected apps into one safe endpoint you can hand to a client, then revoke it in one move."}),(0,e.jsxs)(B,{className:"mt-5",onClick:o,children:[(0,e.jsx)(O,{className:"mr-1.5 h-4 w-4"}),"New gateway"]})]})}t(ye,"EmptyGateways");export{Fe as GatewaysList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var Q=Object.defineProperty;var a=(s,n)=>Q(s,"name",{value:n,configurable:!0});import{i as E}from"./rolldown-runtime-ZpX3ckPj.js";import{Ei as U,Ti as V,i as D,l as T,m as S,na as $,ta as H,w as M}from"./createLucideIcon-DJi9suAC.js";import{v as R}from"./star-BZgQbzhV.js";import{X,_ as C,t as m,v as h}from"./queryKeys-DYV5MhM_.js";import{n as L}from"./CompanyContext-CSrVsSze.js";import{t as k}from"./router-2UfGeejU.js";import{i as A,n as G,r as J,t as W}from"./tabs-B2Os_leL.js";import{o as Y,r as Z,t as ee}from"./popover-BhYHYj7q.js";import{t as b}from"./button-CMwV3L1P.js";import{t as se}from"./plus-C6fnr28l.js";import{t as te}from"./agents-DmlgUVso.js";import{t as ae}from"./projects-mixWrT5q.js";import{n as ne}from"./BreadcrumbContext-BVZDZoC0.js";import{t as re}from"./assets-TRDkBfss.js";import{Or as ie,_ as le,ca as oe,mn as j,pn as y,xa as ce}from"./index-
|
|
1
|
+
var Q=Object.defineProperty;var a=(s,n)=>Q(s,"name",{value:n,configurable:!0});import{i as E}from"./rolldown-runtime-ZpX3ckPj.js";import{Ei as U,Ti as V,i as D,l as T,m as S,na as $,ta as H,w as M}from"./createLucideIcon-DJi9suAC.js";import{v as R}from"./star-BZgQbzhV.js";import{X,_ as C,t as m,v as h}from"./queryKeys-DYV5MhM_.js";import{n as L}from"./CompanyContext-CSrVsSze.js";import{t as k}from"./router-2UfGeejU.js";import{i as A,n as G,r as J,t as W}from"./tabs-B2Os_leL.js";import{o as Y,r as Z,t as ee}from"./popover-BhYHYj7q.js";import{t as b}from"./button-CMwV3L1P.js";import{t as se}from"./plus-C6fnr28l.js";import{t as te}from"./agents-DmlgUVso.js";import{t as ae}from"./projects-mixWrT5q.js";import{n as ne}from"./BreadcrumbContext-BVZDZoC0.js";import{t as re}from"./assets-TRDkBfss.js";import{Or as ie,_ as le,ca as oe,mn as j,pn as y,xa as ce}from"./index-3AxqhPET.js";import{t as q}from"./InlineEditor-BKBqNA21.js";import{t as de}from"./separator-B2LFqBpM.js";import{t as me}from"./EntityRow-BIfupmlZ.js";import{t as ue}from"./GoalTree-kFpgH4dA.js";var f=E($(),1),e=E(H(),1);function u({label:s,children:n}){return(0,e.jsxs)("div",{className:"flex items-start gap-3 py-1.5",children:[(0,e.jsx)("span",{className:"text-xs text-ink-3 shrink-0 w-20 mt-0.5",children:s}),(0,e.jsx)("div",{className:"flex items-center gap-1.5 min-w-0 flex-1 flex-wrap",children:n})]})}a(u,"PropertyRow");function pe(s){return s.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}a(pe,"label");function _({current:s,options:n,onChange:i,children:p}){const[x,c]=(0,f.useState)(!1);return(0,e.jsxs)(ee,{open:x,onOpenChange:c,children:[(0,e.jsx)(Y,{asChild:!0,children:(0,e.jsx)("button",{className:"cursor-pointer hover:opacity-80 transition-opacity",children:p})}),(0,e.jsx)(Z,{className:"w-40 p-1",align:"end",children:n.map(d=>(0,e.jsx)(b,{active:d===s,variant:"ghost",size:"sm",className:T("w-full justify-start text-xs"),onClick:a(()=>{i(d),c(!1)},"onClick"),children:pe(d)},d))})]})}a(_,"PickerButton");function xe({goal:s,onUpdate:n}){const{selectedCompanyId:i}=L(),{data:p}=h({queryKey:m.agents.list(i),queryFn:a(()=>te.list(i),"queryFn"),enabled:!!i}),{data:x}=h({queryKey:m.goals.list(i),queryFn:a(()=>j.list(i),"queryFn"),enabled:!!i}),c=s.ownerAgentId?p?.find(o=>o.id===s.ownerAgentId):null,d=s.parentId?x?.find(o=>o.id===s.parentId):null;return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(u,{label:"Status",children:n?(0,e.jsx)(_,{current:s.status,options:U,onChange:a(o=>n({status:o}),"onChange"),children:(0,e.jsx)(y,{status:s.status})}):(0,e.jsx)(y,{status:s.status})}),(0,e.jsx)(u,{label:"Level",children:n?(0,e.jsx)(_,{current:s.level,options:V,onChange:a(o=>n({level:o}),"onChange"),children:(0,e.jsx)("span",{className:"text-sm capitalize",children:s.level})}):(0,e.jsx)("span",{className:"text-sm capitalize",children:s.level})}),(0,e.jsx)(u,{label:"Owner",children:c?(0,e.jsx)(k,{to:D(c),className:"text-sm hover:underline",children:c.name}):(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"None"})}),s.parentId&&(0,e.jsx)(u,{label:"Parent Goal",children:(0,e.jsx)(k,{to:`/goals/${s.parentId}`,className:"text-sm hover:underline",children:d?.title??s.parentId.slice(0,8)})})]}),(0,e.jsx)(de,{}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(u,{label:"Created",children:(0,e.jsx)("span",{className:"text-sm",children:S(s.createdAt)})}),(0,e.jsx)(u,{label:"Updated",children:(0,e.jsx)("span",{className:"text-sm",children:S(s.updatedAt)})})]})]})}a(xe,"GoalProperties");function he({panelVisible:s,onShowProperties:n}){return(0,e.jsx)(b,{variant:"ghost",size:"icon-xs",className:T("hidden md:inline-flex shrink-0 transition-opacity duration-200",s?"opacity-0 pointer-events-none w-0 overflow-hidden":"opacity-100"),onClick:n,title:"Show properties",children:(0,e.jsx)(ce,{className:"h-4 w-4"})})}a(he,"GoalPropertiesToggleButton");function Ke(){const{goalId:s}=R(),{selectedCompanyId:n,setSelectedCompanyId:i}=L(),{openNewGoal:p}=oe(),{openPanel:x,closePanel:c,panelVisible:d,setPanelVisible:o}=ie(),{setBreadcrumbs:I}=ne(),w=X(),{data:r,isLoading:K,error:P}=h({queryKey:m.goals.detail(s),queryFn:a(()=>j.get(s),"queryFn"),enabled:!!s}),l=r?.companyId??n,{data:z}=h({queryKey:m.goals.list(l),queryFn:a(()=>j.list(l),"queryFn"),enabled:!!l}),{data:F}=h({queryKey:m.projects.list(l,{includeArchived:!0}),queryFn:a(()=>ae.list(l,{includeArchived:!0}),"queryFn"),enabled:!!l});(0,f.useEffect)(()=>{!r?.companyId||r.companyId===n||i(r.companyId,{source:"route_sync"})},[r?.companyId,n,i]);const v=C({mutationFn:a(t=>j.update(s,t),"mutationFn"),onSuccess:a(()=>{w.invalidateQueries({queryKey:m.goals.detail(s)}),l&&w.invalidateQueries({queryKey:m.goals.list(l)})},"onSuccess")}),B=C({mutationFn:a(async t=>{if(!l)throw new Error("No organization selected");return re.uploadImage(l,t,`goals/${s??"draft"}`)},"mutationFn")}),g=(z??[]).filter(t=>t.parentId===s),N=(F??[]).filter(t=>s?t.goalIds.includes(s)||t.goals.some(O=>O.id===s)?!0:t.goalId===s:!1);return(0,f.useEffect)(()=>{I([{label:"Goals",href:"/goals"},{label:r?.title??s??"Goal"}])},[I,r,s]),(0,f.useEffect)(()=>(r&&x((0,e.jsx)(xe,{goal:r,onUpdate:a(t=>v.mutate(t),"onUpdate")})),()=>c()),[r]),K?(0,e.jsx)(le,{variant:"detail"}):P?(0,e.jsx)("p",{className:"text-sm text-bad",children:P.message}):r?(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs uppercase text-ink-3",children:r.level}),(0,e.jsx)(y,{status:r.status}),(0,e.jsx)("div",{className:"ml-auto",children:(0,e.jsx)(he,{panelVisible:d,onShowProperties:a(()=>o(!0),"onShowProperties")})})]}),(0,e.jsx)(q,{value:r.title,onSave:a(t=>v.mutate({title:t}),"onSave"),as:"h2",className:"text-xl font-bold"}),(0,e.jsx)(q,{value:r.description??"",onSave:a(t=>v.mutate({description:t}),"onSave"),as:"p",className:"text-sm text-ink-3",placeholder:"Add a description...",multiline:!0,imageUploadHandler:a(async t=>(await B.mutateAsync(t)).contentPath,"imageUploadHandler")})]}),(0,e.jsxs)(W,{defaultValue:"children",children:[(0,e.jsxs)(J,{children:[(0,e.jsxs)(A,{value:"children",children:["Sub-Goals (",g.length,")"]}),(0,e.jsxs)(A,{value:"projects",children:["Projects (",N.length,")"]})]}),(0,e.jsxs)(G,{value:"children",className:"mt-4 space-y-3",children:[(0,e.jsx)("div",{className:"flex items-center justify-start",children:(0,e.jsxs)(b,{size:"sm",variant:"secondary",onClick:a(()=>p({parentId:s}),"onClick"),children:[(0,e.jsx)(se,{className:"h-3.5 w-3.5 mr-1.5"}),"Sub Goal"]})}),g.length===0?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No sub-goals."}):(0,e.jsx)(ue,{goals:g,goalLink:a(t=>`/goals/${t.id}`,"goalLink")})]}),(0,e.jsx)(G,{value:"projects",className:"mt-4",children:N.length===0?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No linked projects."}):(0,e.jsx)("div",{className:"border border-line",children:N.map(t=>(0,e.jsx)(me,{title:t.name,subtitle:t.description??void 0,to:M(t),trailing:(0,e.jsx)(y,{status:t.status})},t.id))})})]})]}):null}a(Ke,"GoalDetail");export{Ke as GoalDetail};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var v=Object.defineProperty;var d=(t,r)=>v(t,"name",{value:r,configurable:!0});import{i as h}from"./rolldown-runtime-ZpX3ckPj.js";import{l as p,na as _,ta as b}from"./createLucideIcon-DJi9suAC.js";import{t as k}from"./router-2UfGeejU.js";import{t as I}from"./chevron-right-s7L6hXXq.js";import{pn as y}from"./index-
|
|
1
|
+
var v=Object.defineProperty;var d=(t,r)=>v(t,"name",{value:r,configurable:!0});import{i as h}from"./rolldown-runtime-ZpX3ckPj.js";import{l as p,na as _,ta as b}from"./createLucideIcon-DJi9suAC.js";import{t as k}from"./router-2UfGeejU.js";import{t as I}from"./chevron-right-s7L6hXXq.js";import{pn as y}from"./index-3AxqhPET.js";var C=h(_(),1),e=h(b(),1);function f({goal:t,children:r,allGoals:o,depth:i,goalLink:c,onSelect:s}){const[n,j]=(0,C.useState)(!0),l=r.length>0,x=c?.(t),m=(0,e.jsxs)(e.Fragment,{children:[l?(0,e.jsx)("button",{className:"p-0.5",onClick:d(a=>{a.preventDefault(),a.stopPropagation(),j(!n)},"onClick"),"aria-label":`${t.title} subtree`,"aria-expanded":n,children:(0,e.jsx)(I,{className:p("h-3 w-3 transition-transform",n&&"rotate-90")})}):(0,e.jsx)("span",{className:"w-4"}),(0,e.jsx)("span",{className:"text-xs text-ink-3 capitalize",children:t.level}),(0,e.jsx)("span",{className:"flex-1 truncate",children:t.title}),(0,e.jsx)(y,{status:t.status})]}),u=p("flex items-center gap-2 px-3 py-1.5 text-sm transition-colors cursor-pointer hover:bg-bg-3/50");return(0,e.jsxs)("div",{children:[x?(0,e.jsx)(k,{to:x,className:p(u,"no-underline text-inherit"),style:{paddingLeft:`${i*16+12}px`},children:m}):(0,e.jsx)("div",{className:u,style:{paddingLeft:`${i*16+12}px`},onClick:d(()=>s?.(t),"onClick"),children:m}),l&&n&&(0,e.jsx)("div",{children:r.map(a=>(0,e.jsx)(f,{goal:a,children:o.filter(N=>N.parentId===a.id),allGoals:o,depth:i+1,goalLink:c,onSelect:s},a.id))})]})}d(f,"GoalNode");function L({goals:t,goalLink:r,onSelect:o}){const i=new Set(t.map(s=>s.id)),c=t.filter(s=>!s.parentId||!i.has(s.parentId));return t.length===0?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No goals."}):(0,e.jsx)("div",{className:"border border-line py-1",children:c.map(s=>(0,e.jsx)(f,{goal:s,children:t.filter(n=>n.parentId===s.id),allGoals:t,depth:0,goalLink:r,onSelect:o},s.id))})}d(L,"GoalTree");export{L as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var p=Object.defineProperty;var a=(e,r)=>p(e,"name",{value:r,configurable:!0});import{i as l}from"./rolldown-runtime-ZpX3ckPj.js";import{na as d,ta as g}from"./createLucideIcon-DJi9suAC.js";import{t as f,v as x}from"./queryKeys-DYV5MhM_.js";import{n as j}from"./CompanyContext-CSrVsSze.js";import{q as n}from"./router-2UfGeejU.js";import{t as y}from"./button-CMwV3L1P.js";import{t as _}from"./plus-C6fnr28l.js";import{n as h}from"./BreadcrumbContext-BVZDZoC0.js";import{T as m,_ as v,ca as N,mn as q}from"./index-
|
|
1
|
+
var p=Object.defineProperty;var a=(e,r)=>p(e,"name",{value:r,configurable:!0});import{i as l}from"./rolldown-runtime-ZpX3ckPj.js";import{na as d,ta as g}from"./createLucideIcon-DJi9suAC.js";import{t as f,v as x}from"./queryKeys-DYV5MhM_.js";import{n as j}from"./CompanyContext-CSrVsSze.js";import{q as n}from"./router-2UfGeejU.js";import{t as y}from"./button-CMwV3L1P.js";import{t as _}from"./plus-C6fnr28l.js";import{n as h}from"./BreadcrumbContext-BVZDZoC0.js";import{T as m,_ as v,ca as N,mn as q}from"./index-3AxqhPET.js";import{t as G}from"./GoalTree-kFpgH4dA.js";var b=l(d(),1),s=l(g(),1);function L(){const{selectedCompanyId:e}=j(),{openNewGoal:r}=N(),{setBreadcrumbs:o}=h();(0,b.useEffect)(()=>{o([{label:"Goals"}])},[o]);const{data:t,isLoading:c,error:i}=x({queryKey:f.goals.list(e),queryFn:a(()=>q.list(e),"queryFn"),enabled:!!e});return e?c?(0,s.jsx)(v,{variant:"list"}):(0,s.jsxs)("div",{className:"space-y-4",children:[i&&(0,s.jsx)("p",{className:"text-sm text-bad",children:i.message}),t&&t.length===0&&(0,s.jsx)(m,{icon:n,message:"No goals yet.",action:"Add Goal",onAction:a(()=>r(),"onAction")}),t&&t.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex items-center justify-start",children:(0,s.jsxs)(y,{size:"sm",variant:"secondary",onClick:a(()=>r(),"onClick"),children:[(0,s.jsx)(_,{className:"h-3.5 w-3.5 mr-1.5"}),"New Goal"]})}),(0,s.jsx)(G,{goals:t,goalLink:a(u=>`/goals/${u.id}`,"goalLink")})]})]}):(0,s.jsx)(m,{icon:n,message:"Select an organization to view goals."})}a(L,"Goals");export{L as Goals};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var b=Object.defineProperty;var a=(t,n)=>b(t,"name",{value:n,configurable:!0});import{i as w}from"./rolldown-runtime-ZpX3ckPj.js";import{na as k,ta as N,vi as g}from"./createLucideIcon-DJi9suAC.js";import{a as C,o as P,r as L,t as _}from"./dist-DC4EOH0g.js";import{t as D}from"./chevron-left-DP4zwC0G.js";import{t as E}from"./chevron-right-s7L6hXXq.js";import{t as A}from"./x-DRDFdlYE.js";import{Ra as T}from"./index-
|
|
1
|
+
var b=Object.defineProperty;var a=(t,n)=>b(t,"name",{value:n,configurable:!0});import{i as w}from"./rolldown-runtime-ZpX3ckPj.js";import{na as k,ta as N,vi as g}from"./createLucideIcon-DJi9suAC.js";import{a as C,o as P,r as L,t as _}from"./dist-DC4EOH0g.js";import{t as D}from"./chevron-left-DP4zwC0G.js";import{t as E}from"./chevron-right-s7L6hXXq.js";import{t as A}from"./x-DRDFdlYE.js";import{Ra as T}from"./index-3AxqhPET.js";import{o as $,s as j}from"./issue-output-CU3gasZ1.js";var i=w(k(),1),K=(0,i.createContext)(null);function F(t,n){const r=t?.toLowerCase().split(";")[0].trim();return r==="text/html"||r==="application/xhtml+xml"||/\.html?$/i.test(n??"")}a(F,"isHtmlPreview");var R=["default-src 'none'","script-src 'unsafe-inline'","style-src 'unsafe-inline'","img-src data:","font-src data:","media-src data:","connect-src 'none'","frame-src 'none'","object-src 'none'","base-uri 'none'","form-action 'none'"].join("; ");function Q(t){return`<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${R}"><meta name="referrer" content="no-referrer"></head><body>${t}</body></html>`}a(Q,"htmlPreviewDocument");function M(t){return t.contentType.toLowerCase().split(";")[0]?.trim()??""}a(M,"normalizedContentType");function I(t){return t.originalFilename??t.id}a(I,"attachmentFilename");function U(t){return t.openPath??t.contentPath}a(U,"attachmentOpenPath");function q(t){return t.downloadPath??`${t.contentPath}?download=1`}a(q,"attachmentDownloadPath");function Y(t){const n=M(t);return $(n,t.originalFilename)&&!/^image\/hei[cf](?:-sequence)?$/.test(n)}a(Y,"isImageAttachment");function Z(t){return j(t.contentType,t.originalFilename)}a(Z,"isVideoAttachment");function O(t){return g(t)}a(O,"isMarkdownAttachment");function tt(t){const n=t.contentType.toLowerCase().split(";")[0].trim();return g(t)||F(n,t.originalFilename)||n.startsWith("text/")||/^(application\/(json|xml|javascript|x-yaml|yaml)|application\/[\w.-]+\+json)$/.test(n)||["","application/octet-stream"].includes(n)&&/\.(txt|log|csv|json|yaml|yml|toml|ini|sh|ts|tsx|js|jsx|py|css|html)$/i.test(t.originalFilename??"")}a(tt,"isTextAttachment");var e=w(N(),1);function et({items:t,initialIndex:n,open:r,onOpenChange:c}){const[m,d]=(0,i.useState)(n),x=(0,i.useRef)(null),p=(0,i.useCallback)(s=>{x.current=s},[]);(0,i.useEffect)(()=>{r&&d(n)},[r,n]);const h=(0,i.useCallback)(()=>{d(s=>(s+1)%t.length)},[t.length]),f=(0,i.useCallback)(()=>{d(s=>(s-1+t.length)%t.length)},[t.length]);(0,i.useEffect)(()=>{m<t.length||d(0)},[m,t.length]),(0,i.useEffect)(()=>{if(!r)return;const s=a(l=>{l.key==="ArrowRight"?h():l.key==="ArrowLeft"?f():l.key==="Escape"&&c(!1)},"handler");return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[r,h,f,c]);const y=(0,i.useCallback)(s=>{const l=s.target;l.closest("button")||l.closest("a")||l===x.current||c(!1)},[c]);if(t.length===0)return null;const o=t[m];if(!o)return null;const u=I(o),v=j(o.contentType,o.originalFilename);return(0,e.jsx)(_,{open:r,onOpenChange:c,children:(0,e.jsxs)(P,{children:[(0,e.jsx)(C,{className:"fixed inset-0 z-50 bg-black/90 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-200"}),(0,e.jsxs)(L,{className:"fixed inset-0 z-50 flex flex-col outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-200",onClick:y,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 text-white/80 text-sm shrink-0",children:[(0,e.jsx)("span",{className:"truncate max-w-(--pct-50) font-medium",title:u,children:u}),(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsxs)("span",{className:"text-white/40 tabular-nums text-xs",children:[m+1," / ",t.length]}),(0,e.jsx)("a",{href:q(o),download:u,className:"text-white/50 hover:text-white transition-colors",title:"Download","aria-label":`Download ${u}`,onClick:a(s=>s.stopPropagation(),"onClick"),children:(0,e.jsx)(T,{className:"h-4.5 w-4.5"})}),(0,e.jsx)("button",{type:"button",onClick:a(()=>c(!1),"onClick"),className:"text-white/50 hover:text-white transition-colors",title:"Close",children:(0,e.jsx)(A,{className:"h-5 w-5"})})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex items-center min-h-0",children:[(0,e.jsx)("div",{className:"w-16 md:w-24 shrink-0 flex items-center justify-center h-full",children:t.length>1&&(0,e.jsx)("button",{type:"button",onClick:f,className:"rounded-full bg-white/10 p-3 text-white/60 hover:text-white hover:bg-white/20 transition-colors",title:"Previous",children:(0,e.jsx)(D,{className:"h-7 w-7"})})}),(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center min-w-0 min-h-0 h-full px-2",children:v?(0,e.jsx)("video",{ref:p,src:o.contentPath,className:"max-w-full max-h-full rounded-lg",controls:!0,playsInline:!0}):(0,e.jsx)("img",{ref:p,src:o.contentPath,alt:u,className:"max-w-full max-h-full object-contain select-none rounded-lg",draggable:!1})}),(0,e.jsx)("div",{className:"w-16 md:w-24 shrink-0 flex items-center justify-center h-full",children:t.length>1&&(0,e.jsx)("button",{type:"button",onClick:h,className:"rounded-full bg-white/10 p-3 text-white/60 hover:text-white hover:bg-white/20 transition-colors",title:"Next",children:(0,e.jsx)(E,{className:"h-7 w-7"})})})]}),(0,e.jsx)("div",{className:"h-6 shrink-0"})]})]})})}a(et,"ImageGalleryModal");export{Y as a,Z as c,K as d,U as i,Q as l,q as n,O as o,I as r,tt as s,et as t,F as u};
|