@tickernelz/wardmote-ui 2026.1114.2 → 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-Budj8e9v.js → ActiveAgentsPanel-CF0fwsze.js} +1 -1
- package/dist/assets/{AdapterManager-DhiW44Eo.js → AdapterManager-DUXWwNxv.js} +1 -1
- package/dist/assets/{AdvancedToolsRoute-CICI1XRd.js → AdvancedToolsRoute-BamlkE3p.js} +1 -1
- package/dist/assets/{AgentActionButtons-DIhpv51Y.js → AgentActionButtons-CPIhsP04.js} +1 -1
- package/dist/assets/{AgentBubbleActionRow-DIr3TdR9.js → AgentBubbleActionRow-BUAUmJKa.js} +1 -1
- package/dist/assets/{AgentChat-CeuGtMXr.js → AgentChat-BAn_ghsu.js} +1 -1
- package/dist/assets/{AgentChats-CmDtTrMa.js → AgentChats-f73hodzr.js} +1 -1
- package/dist/assets/{AgentDefaults-DpYaMGkf.js → AgentDefaults-BL1XYvEo.js} +1 -1
- package/dist/assets/{AgentDetail-DFTeFc4-.js → AgentDetail-DthxFfuB.js} +1 -1
- package/dist/assets/{AgentTodoCard-DRXZ7hmU.js → AgentTodoCard-BvgkWD0T.js} +1 -1
- package/dist/assets/{Agents-CClUUMUq.js → Agents-D5qI6yZZ.js} +3 -3
- package/dist/assets/{AppDetail-DfHLFOtj.js → AppDetail-B6PtMl8J.js} +1 -1
- package/dist/assets/{AppNotConnected-CcmXbFtD.js → AppNotConnected-C_tGn786.js} +1 -1
- package/dist/assets/{ApprovalCard-uT_9D_uH.js → ApprovalCard-DrfZAdGQ.js} +1 -1
- package/dist/assets/{ApprovalDetail-CE41WFbd.js → ApprovalDetail-sfPpfdXc.js} +1 -1
- package/dist/assets/{ApprovalPayload-_zU9bukt.js → ApprovalPayload-C4F3ItGH.js} +1 -1
- package/dist/assets/{Approvals-BXrjqpKc.js → Approvals-DZoMl7_m.js} +1 -1
- package/dist/assets/{AppsConnect-DH7aSjtS.js → AppsConnect-D8Gu187f.js} +1 -1
- package/dist/assets/{AppsReview-C0Y3SxmZ.js → AppsReview-DokFETm0.js} +1 -1
- package/dist/assets/{ArtifactCard-DKUUBZ0K.js → ArtifactCard-BTf2-JIV.js} +1 -1
- package/dist/assets/{Artifacts-Bsv5m0aU.js → Artifacts-CK8FaygC.js} +1 -1
- package/dist/assets/{AssistantConnection-Dm2PaSeU.js → AssistantConnection-BlKC7jk0.js} +1 -1
- package/dist/assets/{AttentionInteractionResolver-CBjNuhYo.js → AttentionInteractionResolver-C2iz6oqT.js} +1 -1
- package/dist/assets/{AuditHub-DbUni0O_.js → AuditHub-DMhunMn8.js} +1 -1
- package/dist/assets/{BoardChat-CgzCuFIL.js → BoardChat-C4W8JLKB.js} +1 -1
- package/dist/assets/{BootstrapSetupUxLab-D-niQCV5.js → BootstrapSetupUxLab-D58OwniR.js} +1 -1
- package/dist/assets/{Browse-0bmB5mqw.js → Browse-BDjohBak.js} +1 -1
- package/dist/assets/{BudgetPolicyCard-CqFUHqOj.js → BudgetPolicyCard-DfAAgk9Z.js} +1 -1
- package/dist/assets/{CaseDetail-DakrB2jI.js → CaseDetail-CL0FC5sG.js} +1 -1
- package/dist/assets/{Cases-DXbr4HJt.js → Cases-C-7dXrEt.js} +1 -1
- package/dist/assets/{ChatEndpointDetail-BdDKo-Gq.js → ChatEndpointDetail-C-IYAYG8.js} +1 -1
- package/dist/assets/{ChatEndpointSetup-BX3iDH7N.js → ChatEndpointSetup-CM3QixMj.js} +1 -1
- package/dist/assets/{ChoiceControls-Bu-fd6qI.js → ChoiceControls-3Qpci4yE.js} +1 -1
- package/dist/assets/{Companies-FcUNLIkt.js → Companies-97toQ8Cw.js} +1 -1
- package/dist/assets/{CompanyAccess-BUcTNg7_.js → CompanyAccess-CKhS1BaS.js} +1 -1
- package/dist/assets/{CompanyActivity-ScpRBz1G.js → CompanyActivity-DzNrAyAb.js} +1 -1
- package/dist/assets/{CompanyConnections-DMEwbZv7.js → CompanyConnections-ORCH4i3U.js} +1 -1
- package/dist/assets/{CompanyEnvironments-EqXhVruZ.js → CompanyEnvironments-DphURbtb.js} +1 -1
- package/dist/assets/{CompanyExport-DQ9ffuua.js → CompanyExport-XeVCUcK3.js} +1 -1
- package/dist/assets/{CompanyImport-BhuZu4oc.js → CompanyImport-DPKpUaRa.js} +1 -1
- package/dist/assets/{CompanySettings-BSkg4ahA.js → CompanySettings-4JQpzuS1.js} +1 -1
- package/dist/assets/{CompanySettingsPluginPage-BzZkZqh-.js → CompanySettingsPluginPage-cVvXh0_G.js} +1 -1
- package/dist/assets/{CompanySkills-BbA4RKIw.js → CompanySkills-BA_9Ztwj.js} +1 -1
- package/dist/assets/{ComposerAddMenu-D9z2INup.js → ComposerAddMenu-DNp4ecG8.js} +1 -1
- package/dist/assets/{ConfigureBuiltInAgentModal-BUJPbmWc.js → ConfigureBuiltInAgentModal-CQCHDkl4.js} +1 -1
- package/dist/assets/{ConnectionSetupFlow-DKjP5RBZ.js → ConnectionSetupFlow-BaarToKu.js} +1 -1
- package/dist/assets/{CopyableGatewayUrl-BZyE_jT9.js → CopyableGatewayUrl-DxQsV7Hr.js} +1 -1
- package/dist/assets/{Dashboard--lTwxjV-.js → Dashboard--iaPJqJp.js} +1 -1
- package/dist/assets/{DashboardLive-BYyTgF5d.js → DashboardLive-4rGeotay.js} +1 -1
- package/dist/assets/{DecisionDateChips-vXwAFdua.js → DecisionDateChips-CJOLtNrJ.js} +1 -1
- package/dist/assets/{DecisionModelSettings-NrNERkaW.js → DecisionModelSettings-D-OxKIGP.js} +1 -1
- package/dist/assets/{DecisionQueuePage-BaaKuZBi.js → DecisionQueuePage-D-kNFav_.js} +1 -1
- package/dist/assets/{DesignGuide-DS6MuXWY.js → DesignGuide-D7486q4b.js} +1 -1
- package/dist/assets/{DocumentFrameHeader-DTSqcw4Q.js → DocumentFrameHeader-B61HhahB.js} +1 -1
- package/dist/assets/{EmailEndpointSetup-CJFYu2G0.js → EmailEndpointSetup-6OHb9B4q.js} +1 -1
- package/dist/assets/{ExecutionWorkspaceDetail-CuD5xWOB.js → ExecutionWorkspaceDetail-BGV-9D5Y.js} +1 -1
- package/dist/assets/{FolderControls-B7TWghGc.js → FolderControls-L2RzbfdQ.js} +1 -1
- package/dist/assets/{GatewayDetail-xNVOxSIs.js → GatewayDetail-CdXNQ9gD.js} +1 -1
- package/dist/assets/{GatewaysList-DsSKLm1h.js → GatewaysList-B0Jq1IRC.js} +1 -1
- package/dist/assets/{GoalDetail-oN5pyUUY.js → GoalDetail-D2VhPtvw.js} +1 -1
- package/dist/assets/{GoalTree-DaFizciF.js → GoalTree-kFpgH4dA.js} +1 -1
- package/dist/assets/{Goals-xgGKfQZi.js → Goals-B-_gq_Qu.js} +1 -1
- package/dist/assets/{ImageGalleryModal-CjHED0Lb.js → ImageGalleryModal-DzKBMOnu.js} +1 -1
- package/dist/assets/{Inbox-wHhHozfr.js → Inbox-zllmqRcB.js} +1 -1
- package/dist/assets/{InstanceAdvanced-Bdf2a4c_.js → InstanceAdvanced-B7tDfjwG.js} +1 -1
- package/dist/assets/{InviteLanding-McBYpNeW.js → InviteLanding-brwa_8NC.js} +1 -1
- package/dist/assets/{IssueChatLongThreadPerf-DD3RLbBo.js → IssueChatLongThreadPerf-D0HJe6IV.js} +1 -1
- package/dist/assets/{IssueChatThread-BN-_8hT8.js → IssueChatThread-CMXzuvrF.js} +1 -1
- package/dist/assets/{IssueDetail-CsaD311l.js → IssueDetail-DGdg-mB8.js} +1 -1
- package/dist/assets/{IssueDocumentAnnotations-BVdH4RTa.js → IssueDocumentAnnotations-BK-LgExc.js} +1 -1
- package/dist/assets/{IssueOutputSection-CDIMRaF0.js → IssueOutputSection-aSyiE1pg.js} +1 -1
- package/dist/assets/{IssueRecoveryActionCard-C9qJAHes.js → IssueRecoveryActionCard-vAuL_OEC.js} +1 -1
- package/dist/assets/{IssueThreadInteractionCard-BbigJB2U.js → IssueThreadInteractionCard-wFidFTIh.js} +1 -1
- package/dist/assets/{Issues-BWoc80Y9.js → Issues-CsmM33z_.js} +1 -1
- package/dist/assets/{LiveNowTodoLine-B9oTH2L0.js → LiveNowTodoLine-CP32NNp_.js} +1 -1
- package/dist/assets/{ManagedAiConnectionDetails-B0aWUPkf.js → ManagedAiConnectionDetails-Ba0awZ-O.js} +1 -1
- package/dist/assets/{McpConnect-Dzf7W2K6.js → McpConnect-CYLP1yLX.js} +1 -1
- package/dist/assets/{MembershipAction-oiLtxQm3.js → MembershipAction-CKs7Ua9x.js} +1 -1
- package/dist/assets/{ModelsAndProviders-BEb4Z38S.js → ModelsAndProviders-gaR7HDQm.js} +1 -1
- package/dist/assets/{NewAgent-C3MxIRJj.js → NewAgent-DBQzvxIr.js} +1 -1
- package/dist/assets/{OmpAllSettings-DBtL1qDL.js → OmpAllSettings-B_Knr51Z.js} +1 -1
- package/dist/assets/{PipelineSettings-BcAtsehE.js → PipelineSettings-Dl-94FB5.js} +1 -1
- package/dist/assets/{Pipelines-CkiYUQS-.js → Pipelines-CY9hGe0h.js} +1 -1
- package/dist/assets/{PixelsOffice-BSlctoug.js → PixelsOffice-BgyGZsiV.js} +1 -1
- package/dist/assets/{PluginPage-C6Qnf9ka.js → PluginPage-CMA4Ei50.js} +1 -1
- package/dist/assets/{PluginSettings-Do37r6Zu.js → PluginSettings-Cm4H1JRT.js} +1 -1
- package/dist/assets/{ProfileDetailRoute-DRFQNId6.js → ProfileDetailRoute-BEBctbC6.js} +1 -1
- package/dist/assets/{ProfileSettings-BMwLBQDB.js → ProfileSettings-Djo7BLIj.js} +1 -1
- package/dist/assets/{ProfileWizardRoute-XnnvzH9S.js → ProfileWizardRoute-DxLujEtD.js} +1 -1
- package/dist/assets/{ProjectDetail-BW6Lr4Iq.js → ProjectDetail-CmmdvUHn.js} +1 -1
- package/dist/assets/{ProjectWorkspaceDetail-DR4JCa1b.js → ProjectWorkspaceDetail-BsA0hJ-k.js} +1 -1
- package/dist/assets/{ProjectWorkspacesContent-CadPZn0k.js → ProjectWorkspacesContent-BNNI_WAk.js} +1 -1
- package/dist/assets/{Projects-DLBFbxcj.js → Projects-BTAauZr0.js} +1 -1
- package/dist/assets/{PublicIssueSharePage-C9yRZOdP.js → PublicIssueSharePage-DdPjfmD9.js} +1 -1
- package/dist/assets/{ReviewQueueCard-CIkiY-Lm.js → ReviewQueueCard-BC6VY8Bc.js} +1 -1
- package/dist/assets/{RichWorkProductCard-JGHGU_RI.js → RichWorkProductCard-ClpMt_Bh.js} +1 -1
- package/dist/assets/{RoutineDetail-izWzADvA.js → RoutineDetail-BT6_GKnC.js} +1 -1
- package/dist/assets/{RoutineRunVariablesDialog-DiT_o5Dm.js → RoutineRunVariablesDialog-D_Mls1sV.js} +1 -1
- package/dist/assets/{Routines-CHtabiYj.js → Routines-4LevOfvV.js} +1 -1
- package/dist/assets/{ScrollToBottom-pyHLjOjY.js → ScrollToBottom-jItsgDR8.js} +1 -1
- package/dist/assets/{Search-yNNB6kys.js → Search-bmcm0_m_.js} +1 -1
- package/dist/assets/{Secrets-BOyOk5BF.js → Secrets-DfR1fBAZ.js} +1 -1
- package/dist/assets/{SkillSourceTree-M58QwBFF.js → SkillSourceTree--FWKWyF3.js} +1 -1
- package/dist/assets/{SkillSources-Cw4PU-Bz.js → SkillSources-jUDjqy5i.js} +1 -1
- package/dist/assets/{SkillStudio-Cj_M3ZJa.js → SkillStudio-BsqtUnzF.js} +1 -1
- package/dist/assets/{SourceTrustBadge-BZBQe5No.js → SourceTrustBadge-CfBrvKL3.js} +1 -1
- package/dist/assets/{StatusCards-DaJdQUN5.js → StatusCards-Dt3zorUZ.js} +1 -1
- package/dist/assets/{SummarySlotCard-DlSmN6PL.js → SummarySlotCard-D1C0qH2L.js} +1 -1
- package/dist/assets/{TaskChatLab-CU5eA7nX.js → TaskChatLab-B0coUvdp.js} +1 -1
- package/dist/assets/{TaskChatMarker-wBVUFL3u.js → TaskChatMarker-C40twVjh.js} +1 -1
- package/dist/assets/{TaskChatProtocolCard-D-Dwy2EL.js → TaskChatProtocolCard--bi_tc6i.js} +1 -1
- package/dist/assets/{TaskChatThreadView-Crlf9I05.js → TaskChatThreadView-DkzFDrLW.js} +1 -1
- package/dist/assets/{TaskDetailRelationsPanel-CkktN1EC.js → TaskDetailRelationsPanel-DZGkinoJ.js} +1 -1
- package/dist/assets/{TaskTreeControls-B_ulMOi1.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-DTc1Rj4q.js → TrustPresetSection-CjNwNBo3.js} +1 -1
- package/dist/assets/{UserProfile-C6q55R0Q.js → UserProfile-Dujv3qdz.js} +1 -1
- package/dist/assets/{WhatNeedsMe-1igJA4gL.js → WhatNeedsMe-C9P2EsqQ.js} +1 -1
- package/dist/assets/{Workspaces-rtQKliW0.js → Workspaces-BTgSx9nA.js} +1 -1
- package/dist/assets/{connection-owner-CZwxTEuM.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-DDoARkPG.js → index-3AxqhPET.js} +4 -4
- package/dist/assets/index-B5bd7Tk6.css +2 -0
- package/dist/assets/{issue-properties-lmRBaUTG.js → issue-properties-B1cYnBDU.js} +1 -1
- package/dist/assets/{issue-workspace-selection-4JI2Uh9p.js → issue-workspace-selection-S8UgGgK1.js} +1 -1
- package/dist/assets/{pipeline-stage-presentation-BSuBql6K.js → pipeline-stage-presentation-5UBw7nsb.js} +1 -1
- package/dist/assets/{shared-DDwmHbeD.js → shared-4LF6wQ38.js} +1 -1
- package/dist/assets/{tool-taxonomy-DR7Q8sVs.js → tool-taxonomy-B5zpbkHA.js} +1 -1
- package/dist/assets/{transcript-adapter-wiFIjKfq.js → transcript-adapter-C29ZJiU2.js} +1 -1
- package/dist/assets/{useSummaryDraftStream-CWOQt25o.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-Bo-WuezO.js +0 -1
- package/dist/assets/TerminalView-AkFY5bLC.js +0 -58
- package/dist/assets/dropdown-menu-CqRAF7Oj.js +0 -1
- package/dist/assets/index-KZ2bEg2H.css +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
var z=Object.defineProperty;var r=(s,n)=>z(s,"name",{value:n,configurable:!0});import{i as f}from"./rolldown-runtime-ZpX3ckPj.js";import{l as T,na as q,ta as M}from"./createLucideIcon-DJi9suAC.js";import{n as U}from"./star-BZgQbzhV.js";import{t as $}from"./button-CMwV3L1P.js";import{t as D}from"./shield-alert-Be9GuMrS.js";import{a as j,t as F}from"./agent-config-primitives-BsZUnbf2.js";import{Cn as V,En as G,On as H,Sn as Q,Tn as W,_n as Y,bn as J,vn as y,wn as K,xn as X,yn as w}from"./index-
|
|
1
|
+
var z=Object.defineProperty;var r=(s,n)=>z(s,"name",{value:n,configurable:!0});import{i as f}from"./rolldown-runtime-ZpX3ckPj.js";import{l as T,na as q,ta as M}from"./createLucideIcon-DJi9suAC.js";import{n as U}from"./star-BZgQbzhV.js";import{t as $}from"./button-CMwV3L1P.js";import{t as D}from"./shield-alert-Be9GuMrS.js";import{a as j,t as F}from"./agent-config-primitives-BsZUnbf2.js";import{Cn as V,En as G,On as H,Sn as Q,Tn as W,_n as Y,bn as J,vn as y,wn as K,xn as X,yn as w}from"./index-3AxqhPET.js";var m=f(q(),1),e=f(M(),1),b="w-full rounded-md border border-line px-2.5 py-1.5 bg-transparent outline-none text-sm font-mono placeholder:text-ink-3/40";function p(s,n,d){const i=s?.length??0;return i===0?"-":`${i} ${i===1?n:d}`}r(p,"formatCount");function o({label:s,value:n}){return(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3 py-1.5 text-sm",children:[(0,e.jsx)("span",{className:"shrink-0 text-xs text-ink-3",children:s}),(0,e.jsx)("span",{className:T("min-w-0 text-right",n==="-"&&"text-ink-3"),children:n})]})}r(o,"PolicyRow");var Z={project:"Project",root_issue:"Root issue",issue:"Issue"};function le({permissions:s,onChange:n,disabled:d,companyId:i,projectCandidates:N=[],issueCandidates:_=[],candidatesLoading:g,allowSingleIssue:P=!0}){const[S,C]=(0,m.useState)(!1),c=V(s),a=X(s),l=Q(a),[u,v]=(0,m.useState)(l?.type??"project"),k=c==="low_trust_review",x=W(a),E=K(a),B=s?.authorizationPolicy??null,L=(0,m.useMemo)(()=>w(s,c),[s,c]);(0,m.useEffect)(()=>{l&&v(l.type)},[l?.type]);function R(t){n(w(s,t==="low_trust_review"?"low_trust_review":"standard"))}r(R,"handlePresetChange");function A(t){!i||!t||n(G(s,i,{type:u,id:t}))}r(A,"handleBoundaryTargetChange");function I(){n(J(s))}r(I,"handleClearBoundary");const h=u==="project"?N:_,O=l?.type===u?l.id:"";return(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"mb-3 text-sm font-medium",children:"Trust"}),(0,e.jsxs)("div",{className:"rounded-lg border border-line p-4 space-y-3",children:[(0,e.jsx)(j,{label:"Trust preset",hint:"Choose how broadly this agent can read and act on Wardmote work objects.",children:(0,e.jsxs)("select",{className:b,value:c,onChange:r(t=>R(t.target.value),"onChange"),disabled:d,children:[(0,e.jsx)("option",{value:"standard",children:y.standard}),(0,e.jsx)("option",{value:"low_trust_review",children:y.low_trust_review})]})}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:Y[c]}),k?(0,e.jsxs)("div",{role:x?"status":"alert","aria-live":"polite",className:T("rounded-md border px-3 py-2.5 text-sm flex gap-2",x?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-100":"border-bad/30 bg-bad/10 text-bad"),children:[x?(0,e.jsx)(D,{className:"mt-0.5 h-4 w-4 shrink-0"}):(0,e.jsx)(U,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,e.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"font-medium",children:x?"Containment active":"Containment not configured"}),(0,e.jsx)("p",{className:"mt-1 text-xs leading-5",children:x?"This agent can only read and mutate work inside its assigned review boundary. Raw output is quarantined from higher-trust agents until a trusted reviewer promotes it.":"This agent is set to low-trust review, but no project, root issue, or issue scope is set in the core policy. Add a scope before this agent can run without denial."})]}),E?(0,e.jsxs)("div",{className:"rounded-md border border-line/70 bg-bg/70 p-3 text-ink space-y-3",children:[(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-(--gtc-12)",children:[(0,e.jsx)(j,{label:"Boundary type",children:(0,e.jsxs)("select",{className:b,value:u,onChange:r(t=>v(t.target.value),"onChange"),disabled:d,children:[(0,e.jsx)("option",{value:"project",children:"Project"}),(0,e.jsx)("option",{value:"root_issue",children:"Root issue"}),P&&(0,e.jsx)("option",{value:"issue",children:"Issue"})]})}),(0,e.jsx)(j,{label:Z[u],children:(0,e.jsxs)("select",{className:b,value:O,onChange:r(t=>A(t.target.value),"onChange"),disabled:d||!i||g||h.length===0,children:[(0,e.jsx)("option",{value:"",children:g?"Loading…":h.length===0?`No ${u==="project"?"projects":"issues"} available`:"Select boundary"}),h.map(t=>(0,e.jsx)("option",{value:t.id,children:t.label},t.id))]})})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"CE saves one containment boundary at a time. Saved policies include this organization id."}),l?(0,e.jsx)($,{type:"button",size:"sm",variant:"secondary",className:"h-7 px-2.5 text-xs",onClick:I,disabled:d,children:"Clear boundary"}):null]})]}):(0,e.jsxs)("div",{className:"rounded-md border border-line/70 bg-bg/70 p-3 text-ink",children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:"Managed by API"}),(0,e.jsxs)("p",{className:"mt-1 text-xs leading-5 text-ink-3",children:["This policy has ",H(a).toLowerCase()," and cannot be edited by the single-boundary editor."]})]}),(0,e.jsx)(F,{title:"View policy",open:S,onToggle:r(()=>C(t=>!t),"onToggle"),children:(0,e.jsxs)("div",{className:"divide-y divide-line/60 text-ink",children:[(0,e.jsx)(o,{label:"Preset",value:"Low-trust review v1"}),(0,e.jsx)(o,{label:"Raw output",value:"Quarantined from higher-trust agents"}),(0,e.jsx)(o,{label:"Projects",value:p(a?.projectIds,"project","projects")}),(0,e.jsx)(o,{label:"Root issue",value:a?.rootIssueId?a.rootIssueId.slice(0,8):"-"}),(0,e.jsx)(o,{label:"Explicit issues",value:p(a?.issueIds,"issue","issues")}),(0,e.jsx)(o,{label:"Allowed agents",value:p(a?.allowedAgentIds,"agent","agents")}),(0,e.jsx)(o,{label:"Allowed tools",value:a?.allowedToolClasses?.join(" · ")||"-"}),(0,e.jsx)(o,{label:"Allowed secrets",value:p(a?.allowedSecretBindingIds,"binding","bindings")}),(0,e.jsx)(o,{label:"Promotion target",value:a?.outputPromotionTarget?.issueId?.slice(0,8)??"-"}),(0,e.jsx)(o,{label:"EE fields",value:Object.keys(B??{}).some(t=>!["trustPreset","reviewPreset","trustBoundary"].includes(t))?"Custom advanced policy fields preserved":"-"})]})})]})]}):null,L.authorizationPolicy?.reviewPreset?null:(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Advanced permissions remain editable through the EE permissions extension when installed."})]})]})}r(le,"TrustPresetSection");export{le as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var O=Object.defineProperty;var r=(s,n)=>O(s,"name",{value:n,configurable:!0});import{i as S}from"./rolldown-runtime-ZpX3ckPj.js";import{E as k,O as y,S as q,Vt as B,b as I,f as N,m as z,na as L,ta as F,v as d,x}from"./createLucideIcon-DJi9suAC.js";import{v as H}from"./star-BZgQbzhV.js";import{r as D,t as T,v as C}from"./queryKeys-DYV5MhM_.js";import{o as K}from"./companies-query-D9PxIiMT.js";import{n as W}from"./CompanyContext-CSrVsSze.js";import{t as A}from"./router-2UfGeejU.js";import{a as G,n as Q,t as V}from"./avatar-UO226cef.js";import{t as Y}from"./circle-alert-C-L4OsHh.js";import{t as J}from"./button-CMwV3L1P.js";import{t as X}from"./user-round-CGxsJ0K8.js";import{t as Z}from"./useHiddenSettings-CcaZfHLD.js";import{n as ee}from"./BreadcrumbContext-BVZDZoC0.js";import{T as $,_ as se,fn as te,ma as ae}from"./index-DDoARkPG.js";var b=S(L(),1),ne={get:r((s,n)=>D.get(`/companies/${s}/users/${encodeURIComponent(n)}/profile`),"get")},e=S(F(),1),ie="__none__",le="/company/settings/instance/profile";function re(s){const n=s?.trim()||"User",l=n.split(/\s+/).filter(Boolean);return l.length>1?`${l[0]?.[0]??""}${l[l.length-1]?.[0]??""}`.toUpperCase():n.slice(0,2).toUpperCase()}r(re,"initials");function u(s){return s.inputTokens+s.cachedInputTokens+s.outputTokens}r(u,"totalTokens");function _(s){return s.touchedIssues===0?"0%":`${Math.round(s.completedIssues/s.touchedIssues*100)}%`}r(_,"completionRate");function h({label:s,value:n,hint:l}){return(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-2xl font-semibold tabular-nums sm:text-3xl",children:n}),(0,e.jsx)("div",{className:"mt-1 text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:s}),l?(0,e.jsx)("div",{className:"mt-0.5 text-xs text-ink-3/70",children:l}):null]})}r(h,"HeroStat");function ce({stats:s}){const n=u(s);return(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-4 border-l border-line pl-5 first:border-l-0 first:pl-0",children:[(0,e.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,e.jsx)("h2",{className:"text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:s.label}),(0,e.jsxs)("span",{className:"text-(length:--text-micro) text-ink-3 tabular-nums",children:[_(s)," done"]})]}),(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-x-5 gap-y-3",children:[(0,e.jsx)(g,{value:d(s.touchedIssues),label:"Touched"}),(0,e.jsx)(g,{value:d(s.completedIssues),label:"Completed"}),(0,e.jsx)(g,{value:d(s.commentCount),label:"Comments"}),(0,e.jsx)(g,{value:d(s.activityCount),label:"Actions"})]}),(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-x-5 gap-y-1.5 pt-3 text-xs tabular-nums text-ink-3",children:[(0,e.jsx)("span",{children:"Tokens"}),(0,e.jsx)("span",{className:"text-right text-ink",children:x(n)}),(0,e.jsx)("span",{children:"Spend"}),(0,e.jsx)("span",{className:"text-right text-ink",children:N(s.costCents)}),(0,e.jsx)("span",{children:"Created"}),(0,e.jsx)("span",{className:"text-right text-ink",children:d(s.createdIssues)}),(0,e.jsx)("span",{children:"Open"}),(0,e.jsx)("span",{className:"text-right text-ink",children:d(s.assignedOpenIssues)})]})]})}r(ce,"WindowColumn");function g({value:s,label:n}){return(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"truncate text-xl font-semibold tabular-nums",children:s}),(0,e.jsx)("div",{className:"mt-0.5 text-(length:--text-micro) text-ink-3",children:n})]})}r(g,"Metric");function de({points:s}){const n=s.map(i=>u(i)),l=Math.max(1,...n),m=Math.max(1,...s.map(i=>i.completedIssues)),a=n.reduce((i,c)=>i+c,0);return(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-3 border-b border-line pb-3",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Last 14 days"}),(0,e.jsxs)("div",{className:"flex items-baseline gap-4 text-xs text-ink-3",children:[(0,e.jsx)("span",{className:"tabular-nums text-ink",children:x(a)}),(0,e.jsx)("span",{children:"tokens total"})]})]}),(0,e.jsx)("div",{className:"mt-6 grid grid-cols-(--gtc-57) items-end gap-1.5 sm:gap-2",children:s.map(i=>{const c=u(i),j=c===0?0:Math.max(2,Math.round(c/l*100)),p=i.completedIssues===0?0:Math.max(8,Math.round(i.completedIssues/m*36));return(0,e.jsxs)("div",{className:"group flex h-36 flex-col justify-end",children:[(0,e.jsx)("div",{className:"w-full bg-ink/80 transition-opacity group-hover:bg-ink",style:{height:`${j}%`,minHeight:c===0?1:void 0},title:`${I(i.date)}: ${x(c)} tokens, ${i.completedIssues} completed`}),p>0?(0,e.jsx)("div",{className:"mt-1 w-full rounded-full bg-emerald-500/80",style:{height:2,opacity:Math.min(1,.35+p/100)}}):null]},i.date)})}),(0,e.jsx)("div",{className:"mt-2 grid grid-cols-(--gtc-57) gap-1.5 text-(length:--text-nano) tabular-nums text-ink-3 sm:gap-2",children:s.map((i,c)=>(0,e.jsx)("div",{className:"text-center",children:c===0||c===6||c===13?I(i.date):null},i.date))}),(0,e.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-4 text-(length:--text-nano) uppercase tracking-wide text-ink-3",children:[(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,e.jsx)("span",{className:"h-2 w-2 bg-ink/80"})," tokens / day"]}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,e.jsx)("span",{className:"h-(--sz-3px) w-4 rounded-full bg-emerald-500/80"})," completions"]})]})]})}r(de,"UsageChart");function P({title:s,empty:n,rows:l}){return(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"flex items-baseline justify-between gap-3 border-b border-line pb-3",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:s}),(0,e.jsx)("span",{className:"text-xs text-ink-3 tabular-nums",children:l.length})]}),l.length===0?(0,e.jsx)("div",{className:"pt-4 text-sm text-ink-3",children:n}):(0,e.jsx)("ul",{className:"divide-y divide-line",children:l.map(m=>(0,e.jsxs)("li",{className:"grid gap-2 py-2.5 sm:grid-cols-(--gtc-17) sm:items-center",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"truncate text-sm font-medium",children:m.label}),(0,e.jsx)("div",{className:"truncate text-xs text-ink-3",children:m.sublabel})]}),(0,e.jsxs)("div",{className:"flex items-baseline gap-4 text-xs tabular-nums sm:justify-end",children:[(0,e.jsx)("span",{className:"text-ink-3",children:x(u(m))}),(0,e.jsx)("span",{className:"font-medium",children:N(m.costCents)})]})]},m.key))})]})}r(P,"UsageList");function Te(){const{userSlug:s=""}=H(),{selectedCompanyId:n}=W(),{setBreadcrumbs:l}=ee(),m=n??ie,{data:a,isLoading:i,error:c}=C({queryKey:T.userProfile(m,s),queryFn:r(()=>ne.get(m,s),"queryFn"),enabled:!!n&&!!s}),{data:j}=C({queryKey:T.auth.session,queryFn:r(()=>K.getSession(),"queryFn"),retry:!1}),{hidden:p}=Z(),U=!!a?.user.id&&a?.user.id===j?.user.id&&!B(p,"instance.profile");(0,b.useEffect)(()=>{l([{label:"Users"},{label:a?.user.name??s}])},[a?.user.name,l,s]);const o=a?.stats.find(t=>t.key==="all"),v=a?.stats.find(t=>t.key==="last7"),f=a?.user.name?.trim()||a?.user.email?.split("@")[0]||"User",M=(0,b.useMemo)(()=>(a?.topAgents??[]).map(t=>({key:t.agentId??"unknown",label:t.agentName??(t.agentId?t.agentId.slice(0,8):"Wardmote services"),sublabel:"Task-linked usage",costCents:t.costCents,inputTokens:t.inputTokens,cachedInputTokens:t.cachedInputTokens,outputTokens:t.outputTokens})),[a?.topAgents]),R=(0,b.useMemo)(()=>(a?.topProviders??[]).map(t=>({key:`${t.provider}:${t.biller}:${t.model}`,label:`${k(t.provider)} / ${t.model}`,sublabel:`Billed through ${k(t.biller)}`,costCents:t.costCents,inputTokens:t.inputTokens,cachedInputTokens:t.cachedInputTokens,outputTokens:t.outputTokens})),[a?.topProviders]);if(!n)return(0,e.jsx)($,{icon:X,message:"Select an organization to view user profiles."});if(i)return(0,e.jsx)(se,{variant:"dashboard"});if(c||!a)return(0,e.jsx)($,{icon:Y,message:"User profile not found for this organization."});const w=o?u(o):0,E=[a.user.membershipRole??"member",a.user.membershipStatus,`joined ${z(a.user.joinedAt)}`];return(0,e.jsxs)("div",{className:"space-y-10 pb-10",children:[(0,e.jsxs)("section",{className:"flex flex-col gap-7 border-b border-line pb-8",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-5",children:[(0,e.jsxs)(V,{className:"size-16 border border-line",size:"lg",children:[a.user.image?(0,e.jsx)(G,{src:a.user.image,alt:f}):null,(0,e.jsx)(Q,{className:"text-lg font-semibold",children:re(f)})]}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[(0,e.jsx)("h1",{className:"truncate text-2xl font-semibold",children:f}),(0,e.jsxs)("span",{className:"text-sm text-ink-3",children:["@",a.user.slug]})]}),(0,e.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-ink-3",children:[a.user.email?(0,e.jsx)("span",{className:"truncate",children:a.user.email}):null,a.user.email?(0,e.jsx)("span",{"aria-hidden":!0,children:"·"}):null,(0,e.jsx)("span",{children:E.join(" · ")})]})]}),U?(0,e.jsx)(J,{asChild:!0,variant:"secondary",size:"sm",children:(0,e.jsxs)(A,{to:le,children:[(0,e.jsx)(ae,{}),"Edit profile"]})}):null]}),(0,e.jsxs)("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-4",children:[(0,e.jsx)(h,{label:"All-time tokens",value:x(w),hint:N(o?.costCents??0)+" spent"}),(0,e.jsx)(h,{label:"Completed",value:d(o?.completedIssues??0),hint:o?`${_(o)} rate`:void 0}),(0,e.jsx)(h,{label:"Open assigned",value:d(o?.assignedOpenIssues??0),hint:`${d(o?.createdIssues??0)} created`}),(0,e.jsx)(h,{label:"7-day actions",value:d(v?.activityCount??0),hint:`${d(v?.commentCount??0)} comments`})]})]}),(0,e.jsx)("section",{className:"grid gap-8 border-b border-line pb-8 lg:grid-cols-3",children:a.stats.map(t=>(0,e.jsx)(ce,{stats:t},t.key))}),(0,e.jsx)(de,{points:a.daily}),(0,e.jsxs)("div",{className:"grid gap-10 pt-2 xl:grid-cols-2",children:[(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"flex items-baseline justify-between gap-3 border-b border-line pb-3",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Recent tasks"}),(0,e.jsx)("span",{className:"text-xs text-ink-3 tabular-nums",children:a.recentIssues.length})]}),a.recentIssues.length===0?(0,e.jsx)("div",{className:"pt-4 text-sm text-ink-3",children:"No touched tasks yet."}):(0,e.jsx)("ul",{className:"divide-y divide-line",children:a.recentIssues.map(t=>(0,e.jsx)("li",{children:(0,e.jsxs)(A,{to:q(t),className:"grid gap-2 py-2.5 transition-colors hover:bg-bg-3/40 sm:grid-cols-(--gtc-58) sm:items-center",children:[(0,e.jsx)("span",{className:"font-mono text-xs text-ink-3",children:t.identifier??t.id.slice(0,8)}),(0,e.jsx)("span",{className:"truncate text-sm",children:t.title}),(0,e.jsxs)("span",{className:"flex items-center gap-3 sm:justify-end",children:[(0,e.jsx)(te,{status:t.status}),(0,e.jsx)("span",{className:"text-xs tabular-nums text-ink-3",children:y(t.updatedAt)})]})]})},t.id))})]}),(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"flex items-baseline justify-between gap-3 border-b border-line pb-3",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Recent activity"}),(0,e.jsx)("span",{className:"text-xs text-ink-3 tabular-nums",children:a.recentActivity.length})]}),a.recentActivity.length===0?(0,e.jsx)("div",{className:"pt-4 text-sm text-ink-3",children:"No direct user actions recorded yet."}):(0,e.jsx)("ul",{className:"divide-y divide-line",children:a.recentActivity.map(t=>(0,e.jsxs)("li",{className:"grid gap-2 py-2.5 sm:grid-cols-(--gtc-17) sm:items-center",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"truncate text-sm",children:t.action.replaceAll("_"," ")}),(0,e.jsxs)("div",{className:"truncate text-xs text-ink-3",children:[t.entityType," · ",t.entityId.slice(0,12)]})]}),(0,e.jsx)("span",{className:"text-xs tabular-nums text-ink-3 sm:justify-self-end",children:y(t.createdAt)})]},t.id))})]})]}),(0,e.jsxs)("div",{className:"grid gap-10 xl:grid-cols-2",children:[(0,e.jsx)(P,{title:"Agent attribution",empty:"No issue-linked token usage yet.",rows:M}),(0,e.jsx)(P,{title:"Provider mix",empty:"No provider usage attributed yet.",rows:R})]})]})}r(Te,"UserProfile");export{Te as UserProfile};
|
|
1
|
+
var O=Object.defineProperty;var r=(s,n)=>O(s,"name",{value:n,configurable:!0});import{i as S}from"./rolldown-runtime-ZpX3ckPj.js";import{E as k,O as y,S as q,Vt as B,b as I,f as N,m as z,na as L,ta as F,v as d,x}from"./createLucideIcon-DJi9suAC.js";import{v as H}from"./star-BZgQbzhV.js";import{r as D,t as T,v as C}from"./queryKeys-DYV5MhM_.js";import{o as K}from"./companies-query-D9PxIiMT.js";import{n as W}from"./CompanyContext-CSrVsSze.js";import{t as A}from"./router-2UfGeejU.js";import{a as G,n as Q,t as V}from"./avatar-UO226cef.js";import{t as Y}from"./circle-alert-C-L4OsHh.js";import{t as J}from"./button-CMwV3L1P.js";import{t as X}from"./user-round-CGxsJ0K8.js";import{t as Z}from"./useHiddenSettings-CcaZfHLD.js";import{n as ee}from"./BreadcrumbContext-BVZDZoC0.js";import{T as $,_ as se,fn as te,ma as ae}from"./index-3AxqhPET.js";var b=S(L(),1),ne={get:r((s,n)=>D.get(`/companies/${s}/users/${encodeURIComponent(n)}/profile`),"get")},e=S(F(),1),ie="__none__",le="/company/settings/instance/profile";function re(s){const n=s?.trim()||"User",l=n.split(/\s+/).filter(Boolean);return l.length>1?`${l[0]?.[0]??""}${l[l.length-1]?.[0]??""}`.toUpperCase():n.slice(0,2).toUpperCase()}r(re,"initials");function u(s){return s.inputTokens+s.cachedInputTokens+s.outputTokens}r(u,"totalTokens");function _(s){return s.touchedIssues===0?"0%":`${Math.round(s.completedIssues/s.touchedIssues*100)}%`}r(_,"completionRate");function h({label:s,value:n,hint:l}){return(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-2xl font-semibold tabular-nums sm:text-3xl",children:n}),(0,e.jsx)("div",{className:"mt-1 text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:s}),l?(0,e.jsx)("div",{className:"mt-0.5 text-xs text-ink-3/70",children:l}):null]})}r(h,"HeroStat");function ce({stats:s}){const n=u(s);return(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-4 border-l border-line pl-5 first:border-l-0 first:pl-0",children:[(0,e.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,e.jsx)("h2",{className:"text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:s.label}),(0,e.jsxs)("span",{className:"text-(length:--text-micro) text-ink-3 tabular-nums",children:[_(s)," done"]})]}),(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-x-5 gap-y-3",children:[(0,e.jsx)(g,{value:d(s.touchedIssues),label:"Touched"}),(0,e.jsx)(g,{value:d(s.completedIssues),label:"Completed"}),(0,e.jsx)(g,{value:d(s.commentCount),label:"Comments"}),(0,e.jsx)(g,{value:d(s.activityCount),label:"Actions"})]}),(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-x-5 gap-y-1.5 pt-3 text-xs tabular-nums text-ink-3",children:[(0,e.jsx)("span",{children:"Tokens"}),(0,e.jsx)("span",{className:"text-right text-ink",children:x(n)}),(0,e.jsx)("span",{children:"Spend"}),(0,e.jsx)("span",{className:"text-right text-ink",children:N(s.costCents)}),(0,e.jsx)("span",{children:"Created"}),(0,e.jsx)("span",{className:"text-right text-ink",children:d(s.createdIssues)}),(0,e.jsx)("span",{children:"Open"}),(0,e.jsx)("span",{className:"text-right text-ink",children:d(s.assignedOpenIssues)})]})]})}r(ce,"WindowColumn");function g({value:s,label:n}){return(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"truncate text-xl font-semibold tabular-nums",children:s}),(0,e.jsx)("div",{className:"mt-0.5 text-(length:--text-micro) text-ink-3",children:n})]})}r(g,"Metric");function de({points:s}){const n=s.map(i=>u(i)),l=Math.max(1,...n),m=Math.max(1,...s.map(i=>i.completedIssues)),a=n.reduce((i,c)=>i+c,0);return(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-3 border-b border-line pb-3",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Last 14 days"}),(0,e.jsxs)("div",{className:"flex items-baseline gap-4 text-xs text-ink-3",children:[(0,e.jsx)("span",{className:"tabular-nums text-ink",children:x(a)}),(0,e.jsx)("span",{children:"tokens total"})]})]}),(0,e.jsx)("div",{className:"mt-6 grid grid-cols-(--gtc-57) items-end gap-1.5 sm:gap-2",children:s.map(i=>{const c=u(i),j=c===0?0:Math.max(2,Math.round(c/l*100)),p=i.completedIssues===0?0:Math.max(8,Math.round(i.completedIssues/m*36));return(0,e.jsxs)("div",{className:"group flex h-36 flex-col justify-end",children:[(0,e.jsx)("div",{className:"w-full bg-ink/80 transition-opacity group-hover:bg-ink",style:{height:`${j}%`,minHeight:c===0?1:void 0},title:`${I(i.date)}: ${x(c)} tokens, ${i.completedIssues} completed`}),p>0?(0,e.jsx)("div",{className:"mt-1 w-full rounded-full bg-emerald-500/80",style:{height:2,opacity:Math.min(1,.35+p/100)}}):null]},i.date)})}),(0,e.jsx)("div",{className:"mt-2 grid grid-cols-(--gtc-57) gap-1.5 text-(length:--text-nano) tabular-nums text-ink-3 sm:gap-2",children:s.map((i,c)=>(0,e.jsx)("div",{className:"text-center",children:c===0||c===6||c===13?I(i.date):null},i.date))}),(0,e.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-4 text-(length:--text-nano) uppercase tracking-wide text-ink-3",children:[(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,e.jsx)("span",{className:"h-2 w-2 bg-ink/80"})," tokens / day"]}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,e.jsx)("span",{className:"h-(--sz-3px) w-4 rounded-full bg-emerald-500/80"})," completions"]})]})]})}r(de,"UsageChart");function P({title:s,empty:n,rows:l}){return(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"flex items-baseline justify-between gap-3 border-b border-line pb-3",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:s}),(0,e.jsx)("span",{className:"text-xs text-ink-3 tabular-nums",children:l.length})]}),l.length===0?(0,e.jsx)("div",{className:"pt-4 text-sm text-ink-3",children:n}):(0,e.jsx)("ul",{className:"divide-y divide-line",children:l.map(m=>(0,e.jsxs)("li",{className:"grid gap-2 py-2.5 sm:grid-cols-(--gtc-17) sm:items-center",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"truncate text-sm font-medium",children:m.label}),(0,e.jsx)("div",{className:"truncate text-xs text-ink-3",children:m.sublabel})]}),(0,e.jsxs)("div",{className:"flex items-baseline gap-4 text-xs tabular-nums sm:justify-end",children:[(0,e.jsx)("span",{className:"text-ink-3",children:x(u(m))}),(0,e.jsx)("span",{className:"font-medium",children:N(m.costCents)})]})]},m.key))})]})}r(P,"UsageList");function Te(){const{userSlug:s=""}=H(),{selectedCompanyId:n}=W(),{setBreadcrumbs:l}=ee(),m=n??ie,{data:a,isLoading:i,error:c}=C({queryKey:T.userProfile(m,s),queryFn:r(()=>ne.get(m,s),"queryFn"),enabled:!!n&&!!s}),{data:j}=C({queryKey:T.auth.session,queryFn:r(()=>K.getSession(),"queryFn"),retry:!1}),{hidden:p}=Z(),U=!!a?.user.id&&a?.user.id===j?.user.id&&!B(p,"instance.profile");(0,b.useEffect)(()=>{l([{label:"Users"},{label:a?.user.name??s}])},[a?.user.name,l,s]);const o=a?.stats.find(t=>t.key==="all"),v=a?.stats.find(t=>t.key==="last7"),f=a?.user.name?.trim()||a?.user.email?.split("@")[0]||"User",M=(0,b.useMemo)(()=>(a?.topAgents??[]).map(t=>({key:t.agentId??"unknown",label:t.agentName??(t.agentId?t.agentId.slice(0,8):"Wardmote services"),sublabel:"Task-linked usage",costCents:t.costCents,inputTokens:t.inputTokens,cachedInputTokens:t.cachedInputTokens,outputTokens:t.outputTokens})),[a?.topAgents]),R=(0,b.useMemo)(()=>(a?.topProviders??[]).map(t=>({key:`${t.provider}:${t.biller}:${t.model}`,label:`${k(t.provider)} / ${t.model}`,sublabel:`Billed through ${k(t.biller)}`,costCents:t.costCents,inputTokens:t.inputTokens,cachedInputTokens:t.cachedInputTokens,outputTokens:t.outputTokens})),[a?.topProviders]);if(!n)return(0,e.jsx)($,{icon:X,message:"Select an organization to view user profiles."});if(i)return(0,e.jsx)(se,{variant:"dashboard"});if(c||!a)return(0,e.jsx)($,{icon:Y,message:"User profile not found for this organization."});const w=o?u(o):0,E=[a.user.membershipRole??"member",a.user.membershipStatus,`joined ${z(a.user.joinedAt)}`];return(0,e.jsxs)("div",{className:"space-y-10 pb-10",children:[(0,e.jsxs)("section",{className:"flex flex-col gap-7 border-b border-line pb-8",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-5",children:[(0,e.jsxs)(V,{className:"size-16 border border-line",size:"lg",children:[a.user.image?(0,e.jsx)(G,{src:a.user.image,alt:f}):null,(0,e.jsx)(Q,{className:"text-lg font-semibold",children:re(f)})]}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[(0,e.jsx)("h1",{className:"truncate text-2xl font-semibold",children:f}),(0,e.jsxs)("span",{className:"text-sm text-ink-3",children:["@",a.user.slug]})]}),(0,e.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-ink-3",children:[a.user.email?(0,e.jsx)("span",{className:"truncate",children:a.user.email}):null,a.user.email?(0,e.jsx)("span",{"aria-hidden":!0,children:"·"}):null,(0,e.jsx)("span",{children:E.join(" · ")})]})]}),U?(0,e.jsx)(J,{asChild:!0,variant:"secondary",size:"sm",children:(0,e.jsxs)(A,{to:le,children:[(0,e.jsx)(ae,{}),"Edit profile"]})}):null]}),(0,e.jsxs)("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-4",children:[(0,e.jsx)(h,{label:"All-time tokens",value:x(w),hint:N(o?.costCents??0)+" spent"}),(0,e.jsx)(h,{label:"Completed",value:d(o?.completedIssues??0),hint:o?`${_(o)} rate`:void 0}),(0,e.jsx)(h,{label:"Open assigned",value:d(o?.assignedOpenIssues??0),hint:`${d(o?.createdIssues??0)} created`}),(0,e.jsx)(h,{label:"7-day actions",value:d(v?.activityCount??0),hint:`${d(v?.commentCount??0)} comments`})]})]}),(0,e.jsx)("section",{className:"grid gap-8 border-b border-line pb-8 lg:grid-cols-3",children:a.stats.map(t=>(0,e.jsx)(ce,{stats:t},t.key))}),(0,e.jsx)(de,{points:a.daily}),(0,e.jsxs)("div",{className:"grid gap-10 pt-2 xl:grid-cols-2",children:[(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"flex items-baseline justify-between gap-3 border-b border-line pb-3",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Recent tasks"}),(0,e.jsx)("span",{className:"text-xs text-ink-3 tabular-nums",children:a.recentIssues.length})]}),a.recentIssues.length===0?(0,e.jsx)("div",{className:"pt-4 text-sm text-ink-3",children:"No touched tasks yet."}):(0,e.jsx)("ul",{className:"divide-y divide-line",children:a.recentIssues.map(t=>(0,e.jsx)("li",{children:(0,e.jsxs)(A,{to:q(t),className:"grid gap-2 py-2.5 transition-colors hover:bg-bg-3/40 sm:grid-cols-(--gtc-58) sm:items-center",children:[(0,e.jsx)("span",{className:"font-mono text-xs text-ink-3",children:t.identifier??t.id.slice(0,8)}),(0,e.jsx)("span",{className:"truncate text-sm",children:t.title}),(0,e.jsxs)("span",{className:"flex items-center gap-3 sm:justify-end",children:[(0,e.jsx)(te,{status:t.status}),(0,e.jsx)("span",{className:"text-xs tabular-nums text-ink-3",children:y(t.updatedAt)})]})]})},t.id))})]}),(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"flex items-baseline justify-between gap-3 border-b border-line pb-3",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Recent activity"}),(0,e.jsx)("span",{className:"text-xs text-ink-3 tabular-nums",children:a.recentActivity.length})]}),a.recentActivity.length===0?(0,e.jsx)("div",{className:"pt-4 text-sm text-ink-3",children:"No direct user actions recorded yet."}):(0,e.jsx)("ul",{className:"divide-y divide-line",children:a.recentActivity.map(t=>(0,e.jsxs)("li",{className:"grid gap-2 py-2.5 sm:grid-cols-(--gtc-17) sm:items-center",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"truncate text-sm",children:t.action.replaceAll("_"," ")}),(0,e.jsxs)("div",{className:"truncate text-xs text-ink-3",children:[t.entityType," · ",t.entityId.slice(0,12)]})]}),(0,e.jsx)("span",{className:"text-xs tabular-nums text-ink-3 sm:justify-self-end",children:y(t.createdAt)})]},t.id))})]})]}),(0,e.jsxs)("div",{className:"grid gap-10 xl:grid-cols-2",children:[(0,e.jsx)(P,{title:"Agent attribution",empty:"No issue-linked token usage yet.",rows:M}),(0,e.jsx)(P,{title:"Provider mix",empty:"No provider usage attributed yet.",rows:R})]})]})}r(Te,"UserProfile");export{Te as UserProfile};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var ns=Object.defineProperty;var i=(o,d)=>ns(o,"name",{value:d,configurable:!0});import{i as Ke}from"./rolldown-runtime-ZpX3ckPj.js";import{na as os,ta as as}from"./createLucideIcon-DJi9suAC.js";import{a as is,y as ls}from"./star-BZgQbzhV.js";import{t as F,v as H}from"./queryKeys-DYV5MhM_.js";import{o as rs}from"./companies-query-D9PxIiMT.js";import{C as ds,D as Re,E as cs,S as us,T as ms,_ as ps,a as fs,b as hs,c as Z,d as gs,f as xs,g as Ee,h as ys,i as vs,l as bs,m as ws,n as Ss,o as X,p as js,r as Is,s as As,t as Rs,u as Ne,v as Es,w as Ns,x as Ds,y as ks}from"./DecisionDateChips-vXwAFdua.js";import{n as Ts}from"./CompanyContext-CSrVsSze.js";import{o as Ks}from"./router-2UfGeejU.js";import{t as Cs}from"./inbox-C08arfF_.js";import{a as Os}from"./ToastContext-DMdt9oTd.js";import{t as _s}from"./agents-DmlgUVso.js";import{t as Ms}from"./heartbeats-DOyojsaN.js";import{n as Ls,t as Fs}from"./useSharedPolling-D4Xn8mY2.js";import{n as Hs}from"./BreadcrumbContext-BVZDZoC0.js";import{Qi as zs,Vt as Bs,_ as Ps,pi as qs,w as Gs,zt as Qs}from"./index-DDoARkPG.js";var t=Ke(os(),1),n=Ke(as(),1),De=i(()=>{},"noopToggleExpand"),ke=50,Us=100,Ys=480;function Te(o){return o.sourceKind==="failed_run"||o.sourceKind==="recovery_action"}i(Te,"offersRetry");function Ws(o){if(!o||typeof window>"u")return null;let d=o.parentElement;for(;d&&d!==document.body&&d!==document.documentElement;){const l=window.getComputedStyle(d).overflowY;if(l==="auto"||l==="scroll"||l==="overlay")return d;d=d.parentElement}return null}i(Ws,"findScrollContainer");function ft(){const{selectedCompanyId:o}=Ts(),{setBreadcrumbs:d}=Hs(),[l,p]=(0,t.useState)(null),[c,k]=(0,t.useState)(null),[Ce,T]=(0,t.useState)(!1),[J,ee]=(0,t.useState)(!1),[K,Oe]=(0,t.useState)(()=>Es()),[j,_e]=(0,t.useState)(()=>ks()),[C,se]=(0,t.useState)(()=>js),[I,te]=(0,t.useState)(()=>new Set),[z,Me]=(0,t.useState)(!1),[B,Le]=(0,t.useState)(!1),[Fe,He]=(0,t.useState)(!1),[ze,Be]=(0,t.useState)(!1),[Pe,qe]=(0,t.useState)(!1),[P,Ge]=(0,t.useState)("all"),[q,Qe]=(0,t.useState)({from:null,to:null}),[Ue,ne]=ls(),G=Ue.get("decisionId"),[oe,Ye]=(0,t.useState)(!1),[ae,A]=(0,t.useState)(()=>new Set),[v,ie]=(0,t.useState)(()=>new Set),{dismiss:le,snooze:re,restore:O}=qs(o),{pushToast:de}=Os(),ce=Ks(),_=(0,t.useMemo)(()=>us(P,Date.now(),q),[P,q]);(0,t.useEffect)(()=>{d([{label:"Decisions"}])},[d]),(0,t.useEffect)(()=>{se(ps(o)),te(hs(o))},[o]);const{data:b,isLoading:We,error:ue}=H({queryKey:[...F.attention(o),"with-dismissed",_.activitySince??null,_.activityUntil??null],queryFn:i(()=>zs.list(o,{includeDismissed:!0,all:!0,..._}),"queryFn"),enabled:!!o,staleTime:bs,refetchOnWindowFocus:!1}),{data:M}=H({queryKey:F.agents.list(o),queryFn:i(()=>_s.list(o),"queryFn"),enabled:!!o}),me=F.liveRuns(o),Q=Ls({companyId:o,resourceKey:"live-runs",queryKey:me,enabled:!!o,refetchInterval:!1,leaderOnly:!0}),{data:U,dataUpdatedAt:$e}=H({queryKey:me,queryFn:i(()=>Ms.liveRunsForCompany(o),"queryFn"),enabled:Q.enabled,refetchInterval:Q.refetchInterval});Fs(Q,U,$e);const{data:pe}=H({queryKey:F.auth.session,queryFn:i(()=>rs.getSession(),"queryFn")}),L=pe?.user?.id??pe?.session?.userId??null,w=(0,t.useMemo)(()=>{const e=new Map;for(const s of M??[])e.set(s.id,s);return e},[M]);(0,t.useEffect)(()=>{A(new Set),ie(new Set)},[b?.generatedAt]);const f=(0,t.useMemo)(()=>b?.items??[],[b]),Ve=i(e=>e.dismissal!=null&&e.dismissal.isActive,"isServerHidden"),R=(0,t.useMemo)(()=>f.filter(e=>(!Ve(e)||v.has(e.id))&&!ae.has(e.id)),[f,ae,v]),Y=(0,t.useMemo)(()=>b?.generatedAt?new Date(b.generatedAt).getTime():Date.now(),[b?.generatedAt]),W=(0,t.useMemo)(()=>R.filter(Ne),[R]),g=(0,t.useMemo)(()=>R.filter(e=>!Ne(e)),[R]),E=(0,t.useMemo)(()=>f.filter(e=>e.dismissal?.kind==="snooze"&&e.dismissal.isActive&&!v.has(e.id)),[f,v]),N=(0,t.useMemo)(()=>f.filter(e=>e.dismissal?.kind==="dismiss"&&e.dismissal.isActive&&!v.has(e.id)),[f,v]),Ze=(0,t.useMemo)(()=>vs(gs(g)),[g]),x=(0,t.useMemo)(()=>{const e=ws(g,C);if(K==="none")return xs(e,Y);const s=Re(e,j);return ys(s,K)},[g,C,j,K,Y]),fe=(0,t.useMemo)(()=>x.reduce((e,s)=>e+s.items.length,0),[x]),u=(0,t.useMemo)(()=>x.filter(e=>e.label===null||!I.has(e.key)).flatMap(e=>e.items),[I,x]),[$,he]=(0,t.useState)(ke),ge=(0,t.useRef)(null);(0,t.useEffect)(()=>{he(ke)},[o]);const D=(0,t.useMemo)(()=>{const e=c?u.findIndex(s=>s.id===c):-1;return Ds({groups:x,collapsedGroupKeys:I,snoozedItems:E,snoozedOpen:z,dismissedItems:N,dismissedOpen:B,limit:Math.max($,e+1)})},[I,N,B,x,u,$,c,E,z]),xe=(0,t.useCallback)(()=>{he(e=>e+Us)},[]);(0,t.useEffect)(()=>{if(!D.hasMoreRows)return;let e=null;const s=Ws(ge.current),a=s??window,r=i(()=>{e===null&&(e=window.requestAnimationFrame(()=>{e=null;const m=s?.scrollHeight??document.documentElement.scrollHeight;m!==0&&(s?s.scrollTop+s.clientHeight:window.scrollY+window.innerHeight)>=m-Ys&&xe()}))},"checkScrollPosition");return a.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),r(),()=>{a.removeEventListener("scroll",r),window.removeEventListener("resize",r),e!==null&&window.cancelAnimationFrame(e)}},[xe,D.hasMoreRows,$]),(0,t.useEffect)(()=>{c&&!u.some(e=>e.id===c)&&(k(null),T(!1))},[u,c]),(0,t.useEffect)(()=>{c&&document.getElementById(`attention-row-${c}`)?.scrollIntoView({block:"nearest"})},[c]),(0,t.useEffect)(()=>{if(oe||!G||f.length===0)return;const e=f.find(s=>s.sourceKind==="decision"&&s.subject.id===G);Ye(!0),ee(!0),e&&(p(e.id),k(e.id),T(!0),ne(s=>{const a=new URLSearchParams(s);return a.delete("decisionId"),a},{replace:!0}))},[f,oe,G,ne]),(0,t.useEffect)(()=>{if(J||g.length===0)return;const e=Re(g,j).find(s=>Ee(s));e&&p(e.id),ee(!0)},[g,J,j]);const Xe=i(e=>{Oe(e),Ns(e)},"updateGroupBy"),Je=i(e=>{_e(e),ms(e)},"updateSortOrder"),es=i(e=>{se(e),ds(o,e)},"updateFilters"),ss=i(e=>{te(s=>{const a=new Set(s);return a.has(e)?a.delete(e):a.add(e),cs(o,a),a})},"toggleGroupCollapse"),ye=(0,t.useCallback)(e=>{A(s=>{const a=new Set(s);return a.delete(e.id),a}),O(e.dismissalKey)},[O]),S=(0,t.useCallback)(e=>{A(s=>new Set(s).add(e.id)),le(e.dismissalKey),p(s=>s===e.id?null:s),de({id:`attention-dismiss-${e.id}`,dedupeKey:`attention-dismiss-${e.dismissalKey}`,title:"Dismissed",body:e.subject.title??void 0,tone:"info",ttlMs:8e3,action:{label:"Undo",onClick:i(()=>ye(e),"onClick")}})},[le,ye,de]),ve=(0,t.useCallback)((e,s)=>{A(a=>new Set(a).add(e.id)),re(e.dismissalKey,s),p(a=>a===e.id?null:a)},[re]),be=(0,t.useCallback)(e=>{A(s=>new Set(s).add(e.id)),p(s=>s===e.id?null:s)},[]),we=(0,t.useCallback)(e=>{ie(s=>new Set(s).add(e.id)),O(e.dismissalKey)},[O]),Se=(0,t.useCallback)(e=>{k(e.id),T(!1),p(s=>s===e.id?null:e.id)},[]);if((0,t.useEffect)(()=>{const e=i(s=>{const a=Bs({defaultPrevented:s.defaultPrevented,key:s.key,metaKey:s.metaKey,ctrlKey:s.ctrlKey,altKey:s.altKey,target:s.target,hasOpenDialog:Qs(document),hasSelection:c!==null});if(a==="ignore"||u.length===0)return;if(a==="next"||a==="previous"){s.preventDefault();const m=c?u.findIndex(y=>y.id===c):-1,h=m<0?a==="next"?0:u.length-1:(m+(a==="next"?1:-1)+u.length)%u.length;k(u[h]?.id??null),T(!0);return}const r=u.find(m=>m.id===c);r&&(s.preventDefault(),a==="dismiss"?S(r):Ee(r)?p(m=>m===r.id?null:r.id):r.subject.href&&ce(r.subject.href))},"handleKeyDown");return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[S,u,ce,c]),!o)return(0,n.jsx)("p",{className:"text-sm text-ink-3",children:"Select an organization first."});if(We)return(0,n.jsx)(Ps,{variant:"approvals"});const ts=R.length>0||E.length>0||N.length>0;return(0,n.jsxs)("div",{ref:ge,className:"max-w-3xl space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("h1",{className:"text-xl font-bold",children:"Decisions"}),(0,n.jsx)(As,{visibleCount:fe,filterOptions:Ze,filters:C,onFiltersChange:es,groupBy:K,onGroupByChange:Xe,sortOrder:j,onSortOrderChange:Je})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(Ss,{companyId:o,activeQueueKey:null}),(0,n.jsx)(Rs,{value:P,custom:q,onChange:i((e,s)=>{Ge(e),Qe(s)},"onChange")})]}),ue&&(0,n.jsx)("p",{className:"text-sm text-bad",children:ue.message}),ts?(0,n.jsxs)("div",{className:"space-y-4",children:[fe===0?(0,n.jsx)(Vs,{filtered:g.length>0}):(0,n.jsx)(n.Fragment,{children:x.map(e=>{const s=e.label,a=s!==null&&I.has(e.key);return(0,n.jsxs)("section",{className:"space-y-2",children:[s!==null&&(0,n.jsx)(Gs,{label:s,collapsible:!0,collapsed:a,onToggle:i(()=>ss(e.key),"onToggle"),trailing:(0,n.jsx)("span",{className:"text-xs tabular-nums text-ink-3",children:e.items.length})}),!a&&(0,n.jsx)("div",{className:"space-y-4",children:(()=>{const r=D.groupRows.get(e.key)??[],m=new Set;return r.map(h=>{const y=h.sourceKind==="decision"?h.subject.metadata?.bundleId??null:null;let je=null;if(y&&!m.has(y)){m.add(y);const Ie=r.filter(Ae=>Ae.sourceKind==="decision"&&(Ae.subject.metadata?.bundleId??null)===y),V=Ie[0];je=(0,n.jsx)($s,{agentName:w.get(V?.subject.metadata?.originAgentId)?.name??null,title:V?.subject.metadata?.bundleTitle??null,originIssue:V?.relatedIssue??null,count:Ie.length})}return(0,n.jsxs)(t.Fragment,{children:[je,(0,n.jsx)("div",{className:y?"border-l-2 border-violet-500/40 pl-3":void 0,children:(0,n.jsx)(Z,{item:h,companyId:o,expanded:l===h.id,onToggleExpand:Se,onDismiss:S,onSnooze:ve,agentMap:w,agents:M,showTriage:!0,currentUserId:L,selected:Ce&&c===h.id,liveRuns:Te(h)?U:void 0,onRetried:be})})]},h.id)})})()})]},e.key)})}),E.length>0&&(0,n.jsx)(X,{label:"Snoozed",count:E.length,open:z,onToggle:i(()=>Me(e=>!e),"onToggle"),children:D.snoozedRows.map(e=>(0,n.jsx)(Z,{item:e,companyId:o,variant:"hidden",expanded:!1,onToggleExpand:De,onDismiss:S,onRestore:we,agentMap:w,currentUserId:L},e.id))}),N.length>0&&(0,n.jsx)(X,{label:"Dismissed",count:N.length,open:B,onToggle:i(()=>Le(e=>!e),"onToggle"),children:D.dismissedRows.map(e=>(0,n.jsx)(Z,{item:e,companyId:o,variant:"hidden",expanded:!1,onToggleExpand:De,onDismiss:S,onRestore:we,agentMap:w,currentUserId:L},e.id))}),W.length>0&&(0,n.jsxs)(X,{label:"Aging",count:W.length,open:Fe,onToggle:i(()=>He(e=>!e),"onToggle"),children:[(0,n.jsxs)("p",{className:"text-xs text-ink-3",children:["Idle past ",30," days — kept off the desk. Keep any you still want surfaced."]}),W.map(e=>(0,n.jsx)(fs,{item:e,companyId:o,now:Y,agentMap:w,agents:M,currentUserId:L,expanded:l===e.id,onToggleExpand:Se,onDismiss:S,onSnooze:ve,liveRuns:Te(e)?U:void 0,onRetried:be},e.id))]})]}):(0,n.jsx)(Zs,{}),(0,n.jsx)(Is,{companyId:o,selectedSourceKinds:C.sourceKinds,bounds:_,agentMap:w,decidedOpen:ze,expiredOpen:Pe,onToggleDecided:i(()=>Be(e=>!e),"onToggleDecided"),onToggleExpired:i(()=>qe(e=>!e),"onToggleExpired")})]})}i(ft,"WhatNeedsMe");function $s({agentName:o,title:d,originIssue:l,count:p}){return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 rounded-sm border-l-2 border-violet-500/60 bg-violet-500/5 px-3 py-1.5 text-xs",children:[(0,n.jsxs)("span",{className:"font-semibold text-violet-800 dark:text-violet-200",children:[o??"An agent"," proposed ",p," ",p===1?"decision":"decisions"]}),l&&(l.identifier||l.title)&&(0,n.jsxs)("span",{className:"text-ink-3",children:["· from ",l.href?(0,n.jsx)("a",{href:l.href,className:"hover:underline",children:l.identifier??l.title}):l.identifier??l.title]}),d&&(0,n.jsxs)("span",{className:"text-ink-3",children:["· ",d]}),(0,n.jsxs)("span",{className:"text-ink-3",children:["· ",p," pending"]})]})}i($s,"DecisionBundleHeader");function Vs({filtered:o}){return(0,n.jsxs)("div",{className:"rounded-xl border border-dashed border-line py-10 text-center",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-ink",children:o?"No decisions match your filters.":"You're all caught up."}),o&&(0,n.jsx)("p",{className:"mt-1 text-xs text-ink-3",children:"Adjust or clear the filters to see the rest."})]})}i(Vs,"CaughtUpNote");function Zs(){return(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-xl border border-dashed border-line py-20 text-center",children:[(0,n.jsx)("div",{className:"mb-4 rounded-full bg-green-500/10 p-4",children:(0,n.jsx)(is,{className:"h-10 w-10 text-green-500"})}),(0,n.jsx)("p",{className:"text-lg font-semibold text-ink",children:"You're all caught up"}),(0,n.jsxs)("p",{className:"mt-1 flex items-center gap-1.5 text-sm text-ink-3",children:[(0,n.jsx)(Cs,{className:"h-4 w-4"}),"Nothing needs a decision from you right now."]})]})}i(Zs,"ZeroState");export{ft as WhatNeedsMe};
|
|
1
|
+
var ns=Object.defineProperty;var i=(o,d)=>ns(o,"name",{value:d,configurable:!0});import{i as Ke}from"./rolldown-runtime-ZpX3ckPj.js";import{na as os,ta as as}from"./createLucideIcon-DJi9suAC.js";import{a as is,y as ls}from"./star-BZgQbzhV.js";import{t as F,v as H}from"./queryKeys-DYV5MhM_.js";import{o as rs}from"./companies-query-D9PxIiMT.js";import{C as ds,D as Re,E as cs,S as us,T as ms,_ as ps,a as fs,b as hs,c as Z,d as gs,f as xs,g as Ee,h as ys,i as vs,l as bs,m as ws,n as Ss,o as X,p as js,r as Is,s as As,t as Rs,u as Ne,v as Es,w as Ns,x as Ds,y as ks}from"./DecisionDateChips-CJOLtNrJ.js";import{n as Ts}from"./CompanyContext-CSrVsSze.js";import{o as Ks}from"./router-2UfGeejU.js";import{t as Cs}from"./inbox-C08arfF_.js";import{a as Os}from"./ToastContext-DMdt9oTd.js";import{t as _s}from"./agents-DmlgUVso.js";import{t as Ms}from"./heartbeats-DOyojsaN.js";import{n as Ls,t as Fs}from"./useSharedPolling-D4Xn8mY2.js";import{n as Hs}from"./BreadcrumbContext-BVZDZoC0.js";import{Qi as zs,Vt as Bs,_ as Ps,pi as qs,w as Gs,zt as Qs}from"./index-3AxqhPET.js";var t=Ke(os(),1),n=Ke(as(),1),De=i(()=>{},"noopToggleExpand"),ke=50,Us=100,Ys=480;function Te(o){return o.sourceKind==="failed_run"||o.sourceKind==="recovery_action"}i(Te,"offersRetry");function Ws(o){if(!o||typeof window>"u")return null;let d=o.parentElement;for(;d&&d!==document.body&&d!==document.documentElement;){const l=window.getComputedStyle(d).overflowY;if(l==="auto"||l==="scroll"||l==="overlay")return d;d=d.parentElement}return null}i(Ws,"findScrollContainer");function ft(){const{selectedCompanyId:o}=Ts(),{setBreadcrumbs:d}=Hs(),[l,p]=(0,t.useState)(null),[c,k]=(0,t.useState)(null),[Ce,T]=(0,t.useState)(!1),[J,ee]=(0,t.useState)(!1),[K,Oe]=(0,t.useState)(()=>Es()),[j,_e]=(0,t.useState)(()=>ks()),[C,se]=(0,t.useState)(()=>js),[I,te]=(0,t.useState)(()=>new Set),[z,Me]=(0,t.useState)(!1),[B,Le]=(0,t.useState)(!1),[Fe,He]=(0,t.useState)(!1),[ze,Be]=(0,t.useState)(!1),[Pe,qe]=(0,t.useState)(!1),[P,Ge]=(0,t.useState)("all"),[q,Qe]=(0,t.useState)({from:null,to:null}),[Ue,ne]=ls(),G=Ue.get("decisionId"),[oe,Ye]=(0,t.useState)(!1),[ae,A]=(0,t.useState)(()=>new Set),[v,ie]=(0,t.useState)(()=>new Set),{dismiss:le,snooze:re,restore:O}=qs(o),{pushToast:de}=Os(),ce=Ks(),_=(0,t.useMemo)(()=>us(P,Date.now(),q),[P,q]);(0,t.useEffect)(()=>{d([{label:"Decisions"}])},[d]),(0,t.useEffect)(()=>{se(ps(o)),te(hs(o))},[o]);const{data:b,isLoading:We,error:ue}=H({queryKey:[...F.attention(o),"with-dismissed",_.activitySince??null,_.activityUntil??null],queryFn:i(()=>zs.list(o,{includeDismissed:!0,all:!0,..._}),"queryFn"),enabled:!!o,staleTime:bs,refetchOnWindowFocus:!1}),{data:M}=H({queryKey:F.agents.list(o),queryFn:i(()=>_s.list(o),"queryFn"),enabled:!!o}),me=F.liveRuns(o),Q=Ls({companyId:o,resourceKey:"live-runs",queryKey:me,enabled:!!o,refetchInterval:!1,leaderOnly:!0}),{data:U,dataUpdatedAt:$e}=H({queryKey:me,queryFn:i(()=>Ms.liveRunsForCompany(o),"queryFn"),enabled:Q.enabled,refetchInterval:Q.refetchInterval});Fs(Q,U,$e);const{data:pe}=H({queryKey:F.auth.session,queryFn:i(()=>rs.getSession(),"queryFn")}),L=pe?.user?.id??pe?.session?.userId??null,w=(0,t.useMemo)(()=>{const e=new Map;for(const s of M??[])e.set(s.id,s);return e},[M]);(0,t.useEffect)(()=>{A(new Set),ie(new Set)},[b?.generatedAt]);const f=(0,t.useMemo)(()=>b?.items??[],[b]),Ve=i(e=>e.dismissal!=null&&e.dismissal.isActive,"isServerHidden"),R=(0,t.useMemo)(()=>f.filter(e=>(!Ve(e)||v.has(e.id))&&!ae.has(e.id)),[f,ae,v]),Y=(0,t.useMemo)(()=>b?.generatedAt?new Date(b.generatedAt).getTime():Date.now(),[b?.generatedAt]),W=(0,t.useMemo)(()=>R.filter(Ne),[R]),g=(0,t.useMemo)(()=>R.filter(e=>!Ne(e)),[R]),E=(0,t.useMemo)(()=>f.filter(e=>e.dismissal?.kind==="snooze"&&e.dismissal.isActive&&!v.has(e.id)),[f,v]),N=(0,t.useMemo)(()=>f.filter(e=>e.dismissal?.kind==="dismiss"&&e.dismissal.isActive&&!v.has(e.id)),[f,v]),Ze=(0,t.useMemo)(()=>vs(gs(g)),[g]),x=(0,t.useMemo)(()=>{const e=ws(g,C);if(K==="none")return xs(e,Y);const s=Re(e,j);return ys(s,K)},[g,C,j,K,Y]),fe=(0,t.useMemo)(()=>x.reduce((e,s)=>e+s.items.length,0),[x]),u=(0,t.useMemo)(()=>x.filter(e=>e.label===null||!I.has(e.key)).flatMap(e=>e.items),[I,x]),[$,he]=(0,t.useState)(ke),ge=(0,t.useRef)(null);(0,t.useEffect)(()=>{he(ke)},[o]);const D=(0,t.useMemo)(()=>{const e=c?u.findIndex(s=>s.id===c):-1;return Ds({groups:x,collapsedGroupKeys:I,snoozedItems:E,snoozedOpen:z,dismissedItems:N,dismissedOpen:B,limit:Math.max($,e+1)})},[I,N,B,x,u,$,c,E,z]),xe=(0,t.useCallback)(()=>{he(e=>e+Us)},[]);(0,t.useEffect)(()=>{if(!D.hasMoreRows)return;let e=null;const s=Ws(ge.current),a=s??window,r=i(()=>{e===null&&(e=window.requestAnimationFrame(()=>{e=null;const m=s?.scrollHeight??document.documentElement.scrollHeight;m!==0&&(s?s.scrollTop+s.clientHeight:window.scrollY+window.innerHeight)>=m-Ys&&xe()}))},"checkScrollPosition");return a.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),r(),()=>{a.removeEventListener("scroll",r),window.removeEventListener("resize",r),e!==null&&window.cancelAnimationFrame(e)}},[xe,D.hasMoreRows,$]),(0,t.useEffect)(()=>{c&&!u.some(e=>e.id===c)&&(k(null),T(!1))},[u,c]),(0,t.useEffect)(()=>{c&&document.getElementById(`attention-row-${c}`)?.scrollIntoView({block:"nearest"})},[c]),(0,t.useEffect)(()=>{if(oe||!G||f.length===0)return;const e=f.find(s=>s.sourceKind==="decision"&&s.subject.id===G);Ye(!0),ee(!0),e&&(p(e.id),k(e.id),T(!0),ne(s=>{const a=new URLSearchParams(s);return a.delete("decisionId"),a},{replace:!0}))},[f,oe,G,ne]),(0,t.useEffect)(()=>{if(J||g.length===0)return;const e=Re(g,j).find(s=>Ee(s));e&&p(e.id),ee(!0)},[g,J,j]);const Xe=i(e=>{Oe(e),Ns(e)},"updateGroupBy"),Je=i(e=>{_e(e),ms(e)},"updateSortOrder"),es=i(e=>{se(e),ds(o,e)},"updateFilters"),ss=i(e=>{te(s=>{const a=new Set(s);return a.has(e)?a.delete(e):a.add(e),cs(o,a),a})},"toggleGroupCollapse"),ye=(0,t.useCallback)(e=>{A(s=>{const a=new Set(s);return a.delete(e.id),a}),O(e.dismissalKey)},[O]),S=(0,t.useCallback)(e=>{A(s=>new Set(s).add(e.id)),le(e.dismissalKey),p(s=>s===e.id?null:s),de({id:`attention-dismiss-${e.id}`,dedupeKey:`attention-dismiss-${e.dismissalKey}`,title:"Dismissed",body:e.subject.title??void 0,tone:"info",ttlMs:8e3,action:{label:"Undo",onClick:i(()=>ye(e),"onClick")}})},[le,ye,de]),ve=(0,t.useCallback)((e,s)=>{A(a=>new Set(a).add(e.id)),re(e.dismissalKey,s),p(a=>a===e.id?null:a)},[re]),be=(0,t.useCallback)(e=>{A(s=>new Set(s).add(e.id)),p(s=>s===e.id?null:s)},[]),we=(0,t.useCallback)(e=>{ie(s=>new Set(s).add(e.id)),O(e.dismissalKey)},[O]),Se=(0,t.useCallback)(e=>{k(e.id),T(!1),p(s=>s===e.id?null:e.id)},[]);if((0,t.useEffect)(()=>{const e=i(s=>{const a=Bs({defaultPrevented:s.defaultPrevented,key:s.key,metaKey:s.metaKey,ctrlKey:s.ctrlKey,altKey:s.altKey,target:s.target,hasOpenDialog:Qs(document),hasSelection:c!==null});if(a==="ignore"||u.length===0)return;if(a==="next"||a==="previous"){s.preventDefault();const m=c?u.findIndex(y=>y.id===c):-1,h=m<0?a==="next"?0:u.length-1:(m+(a==="next"?1:-1)+u.length)%u.length;k(u[h]?.id??null),T(!0);return}const r=u.find(m=>m.id===c);r&&(s.preventDefault(),a==="dismiss"?S(r):Ee(r)?p(m=>m===r.id?null:r.id):r.subject.href&&ce(r.subject.href))},"handleKeyDown");return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[S,u,ce,c]),!o)return(0,n.jsx)("p",{className:"text-sm text-ink-3",children:"Select an organization first."});if(We)return(0,n.jsx)(Ps,{variant:"approvals"});const ts=R.length>0||E.length>0||N.length>0;return(0,n.jsxs)("div",{ref:ge,className:"max-w-3xl space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("h1",{className:"text-xl font-bold",children:"Decisions"}),(0,n.jsx)(As,{visibleCount:fe,filterOptions:Ze,filters:C,onFiltersChange:es,groupBy:K,onGroupByChange:Xe,sortOrder:j,onSortOrderChange:Je})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(Ss,{companyId:o,activeQueueKey:null}),(0,n.jsx)(Rs,{value:P,custom:q,onChange:i((e,s)=>{Ge(e),Qe(s)},"onChange")})]}),ue&&(0,n.jsx)("p",{className:"text-sm text-bad",children:ue.message}),ts?(0,n.jsxs)("div",{className:"space-y-4",children:[fe===0?(0,n.jsx)(Vs,{filtered:g.length>0}):(0,n.jsx)(n.Fragment,{children:x.map(e=>{const s=e.label,a=s!==null&&I.has(e.key);return(0,n.jsxs)("section",{className:"space-y-2",children:[s!==null&&(0,n.jsx)(Gs,{label:s,collapsible:!0,collapsed:a,onToggle:i(()=>ss(e.key),"onToggle"),trailing:(0,n.jsx)("span",{className:"text-xs tabular-nums text-ink-3",children:e.items.length})}),!a&&(0,n.jsx)("div",{className:"space-y-4",children:(()=>{const r=D.groupRows.get(e.key)??[],m=new Set;return r.map(h=>{const y=h.sourceKind==="decision"?h.subject.metadata?.bundleId??null:null;let je=null;if(y&&!m.has(y)){m.add(y);const Ie=r.filter(Ae=>Ae.sourceKind==="decision"&&(Ae.subject.metadata?.bundleId??null)===y),V=Ie[0];je=(0,n.jsx)($s,{agentName:w.get(V?.subject.metadata?.originAgentId)?.name??null,title:V?.subject.metadata?.bundleTitle??null,originIssue:V?.relatedIssue??null,count:Ie.length})}return(0,n.jsxs)(t.Fragment,{children:[je,(0,n.jsx)("div",{className:y?"border-l-2 border-violet-500/40 pl-3":void 0,children:(0,n.jsx)(Z,{item:h,companyId:o,expanded:l===h.id,onToggleExpand:Se,onDismiss:S,onSnooze:ve,agentMap:w,agents:M,showTriage:!0,currentUserId:L,selected:Ce&&c===h.id,liveRuns:Te(h)?U:void 0,onRetried:be})})]},h.id)})})()})]},e.key)})}),E.length>0&&(0,n.jsx)(X,{label:"Snoozed",count:E.length,open:z,onToggle:i(()=>Me(e=>!e),"onToggle"),children:D.snoozedRows.map(e=>(0,n.jsx)(Z,{item:e,companyId:o,variant:"hidden",expanded:!1,onToggleExpand:De,onDismiss:S,onRestore:we,agentMap:w,currentUserId:L},e.id))}),N.length>0&&(0,n.jsx)(X,{label:"Dismissed",count:N.length,open:B,onToggle:i(()=>Le(e=>!e),"onToggle"),children:D.dismissedRows.map(e=>(0,n.jsx)(Z,{item:e,companyId:o,variant:"hidden",expanded:!1,onToggleExpand:De,onDismiss:S,onRestore:we,agentMap:w,currentUserId:L},e.id))}),W.length>0&&(0,n.jsxs)(X,{label:"Aging",count:W.length,open:Fe,onToggle:i(()=>He(e=>!e),"onToggle"),children:[(0,n.jsxs)("p",{className:"text-xs text-ink-3",children:["Idle past ",30," days — kept off the desk. Keep any you still want surfaced."]}),W.map(e=>(0,n.jsx)(fs,{item:e,companyId:o,now:Y,agentMap:w,agents:M,currentUserId:L,expanded:l===e.id,onToggleExpand:Se,onDismiss:S,onSnooze:ve,liveRuns:Te(e)?U:void 0,onRetried:be},e.id))]})]}):(0,n.jsx)(Zs,{}),(0,n.jsx)(Is,{companyId:o,selectedSourceKinds:C.sourceKinds,bounds:_,agentMap:w,decidedOpen:ze,expiredOpen:Pe,onToggleDecided:i(()=>Be(e=>!e),"onToggleDecided"),onToggleExpired:i(()=>qe(e=>!e),"onToggleExpired")})]})}i(ft,"WhatNeedsMe");function $s({agentName:o,title:d,originIssue:l,count:p}){return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 rounded-sm border-l-2 border-violet-500/60 bg-violet-500/5 px-3 py-1.5 text-xs",children:[(0,n.jsxs)("span",{className:"font-semibold text-violet-800 dark:text-violet-200",children:[o??"An agent"," proposed ",p," ",p===1?"decision":"decisions"]}),l&&(l.identifier||l.title)&&(0,n.jsxs)("span",{className:"text-ink-3",children:["· from ",l.href?(0,n.jsx)("a",{href:l.href,className:"hover:underline",children:l.identifier??l.title}):l.identifier??l.title]}),d&&(0,n.jsxs)("span",{className:"text-ink-3",children:["· ",d]}),(0,n.jsxs)("span",{className:"text-ink-3",children:["· ",p," pending"]})]})}i($s,"DecisionBundleHeader");function Vs({filtered:o}){return(0,n.jsxs)("div",{className:"rounded-xl border border-dashed border-line py-10 text-center",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-ink",children:o?"No decisions match your filters.":"You're all caught up."}),o&&(0,n.jsx)("p",{className:"mt-1 text-xs text-ink-3",children:"Adjust or clear the filters to see the rest."})]})}i(Vs,"CaughtUpNote");function Zs(){return(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-xl border border-dashed border-line py-20 text-center",children:[(0,n.jsx)("div",{className:"mb-4 rounded-full bg-green-500/10 p-4",children:(0,n.jsx)(is,{className:"h-10 w-10 text-green-500"})}),(0,n.jsx)("p",{className:"text-lg font-semibold text-ink",children:"You're all caught up"}),(0,n.jsxs)("p",{className:"mt-1 flex items-center gap-1.5 text-sm text-ink-3",children:[(0,n.jsx)(Cs,{className:"h-4 w-4"}),"Nothing needs a decision from you right now."]})]})}i(Zs,"ZeroState");export{ft as WhatNeedsMe};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var g=Object.defineProperty;var i=(e,o)=>g(e,"name",{value:o,configurable:!0});import{i as f}from"./rolldown-runtime-ZpX3ckPj.js";import{C as k,na as y,ta as h}from"./createLucideIcon-DJi9suAC.js";import{t as m,v as w}from"./queryKeys-DYV5MhM_.js";import{t as N}from"./useInfiniteQuery-B28xptxn.js";import{n as I}from"./CompanyContext-CSrVsSze.js";import{r as S,t as C}from"./router-2UfGeejU.js";import{t as b}from"./button-CMwV3L1P.js";import{t as W}from"./instanceSettings-D8g_QlS-.js";import{n as U}from"./BreadcrumbContext-BVZDZoC0.js";import{_ as x,tr as _}from"./index-
|
|
1
|
+
var g=Object.defineProperty;var i=(e,o)=>g(e,"name",{value:o,configurable:!0});import{i as f}from"./rolldown-runtime-ZpX3ckPj.js";import{C as k,na as y,ta as h}from"./createLucideIcon-DJi9suAC.js";import{t as m,v as w}from"./queryKeys-DYV5MhM_.js";import{t as N}from"./useInfiniteQuery-B28xptxn.js";import{n as I}from"./CompanyContext-CSrVsSze.js";import{r as S,t as C}from"./router-2UfGeejU.js";import{t as b}from"./button-CMwV3L1P.js";import{t as W}from"./instanceSettings-D8g_QlS-.js";import{n as U}from"./BreadcrumbContext-BVZDZoC0.js";import{_ as x,tr as _}from"./index-3AxqhPET.js";import{t as A}from"./SummarySlotCard-D1C0qH2L.js";import{t as P}from"./ProjectWorkspacesContent-BNNI_WAk.js";var d=f(y(),1),s=f(h(),1);function R(e){return{key:e.key,kind:e.kind,workspaceId:e.workspaceId,workspaceName:e.workspaceName,cwd:e.cwd,branchName:e.branchName,lastUpdatedAt:e.lastUpdatedAt,projectWorkspaceId:e.projectWorkspaceId,executionWorkspaceId:e.executionWorkspaceId,executionWorkspaceStatus:e.executionWorkspaceStatus,serviceCount:e.serviceCount,runningServiceCount:e.runningServiceCount,primaryServiceUrl:e.primaryServiceUrl,primaryServiceUrlRunning:e.primaryServiceUrlRunning,hasRuntimeConfig:e.hasRuntimeConfig,linkedIssueCount:e.linkedIssueCount,issues:e.linkedIssues}}i(R,"overviewItemToSummary");function q(e){const o=new Map;for(const r of e){const n=o.get(r.projectId),t=R(r);if(n){n.summaries.push(t),t.lastUpdatedAt.getTime()>n.lastUpdatedAt.getTime()&&(n.lastUpdatedAt=t.lastUpdatedAt),n.runningServiceCount+=t.runningServiceCount;continue}o.set(r.projectId,{projectId:r.projectId,projectName:r.projectName,projectRef:k({id:r.projectId,name:r.projectName,urlKey:r.projectUrlKey}),summaries:[t],lastUpdatedAt:t.lastUpdatedAt,runningServiceCount:t.runningServiceCount})}return[...o.values()].sort((r,n)=>{const t=n.runningServiceCount-r.runningServiceCount;if(t!==0)return t;const c=n.lastUpdatedAt.getTime()-r.lastUpdatedAt.getTime();return c!==0?c:r.projectName.localeCompare(n.projectName)})}i(q,"buildProjectWorkspaceGroups");function H(){const{selectedCompanyId:e}=I(),{setBreadcrumbs:o}=U(),r=w({queryKey:m.instance.experimentalSettings,queryFn:i(()=>W.getExperimental(),"queryFn")}),n=r.data?.enableIsolatedWorkspaces===!0,t=N({queryKey:e?m.executionWorkspaces.overview(e):["execution-workspaces","__workspaces-overview__","disabled"],queryFn:i(({pageParam:a})=>_.listOverview(e,{offset:a}),"queryFn"),initialPageParam:0,getNextPageParam:i(a=>a.nextOffset??void 0,"getNextPageParam"),enabled:!!(e&&n)});(0,d.useEffect)(()=>{o([{label:"Workspaces"}])},[o]);const c=t.data?.pages??[],p=(0,d.useMemo)(()=>c.flatMap(a=>a.items),[c]),u=(0,d.useMemo)(()=>q(p),[p]),v=(c[0]??null)?.total??p.length,j=t.isLoading,l=t.error;return r.isLoading?(0,s.jsx)(x,{variant:"detail"}):n?j?(0,s.jsx)(x,{variant:"list"}):l?(0,s.jsx)("p",{className:"text-sm text-bad",children:l.message}):(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)("div",{children:(0,s.jsx)("h2",{className:"text-xl font-bold",children:"Workspaces"})}),(0,s.jsx)(A,{companyId:e,scopeKind:"workspaces_overview",title:"Workspace summary",description:"Summarizer tracks workspace activity, live services, and follow-up needs across projects."}),u.length===0?(0,s.jsx)("p",{className:"text-sm text-ink-3",children:"No workspace activity yet."}):(0,s.jsxs)("div",{className:"space-y-8",children:[u.map(a=>(0,s.jsxs)("section",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-2",children:[(0,s.jsx)("div",{className:"min-w-0",children:(0,s.jsx)(C,{to:`/projects/${a.projectRef}/workspaces`,className:"text-base font-semibold hover:underline",children:a.projectName})}),(0,s.jsxs)("span",{className:"text-xs text-ink-3",children:[a.summaries.length," workspace",a.summaries.length===1?"":"s"]})]}),(0,s.jsx)(P,{companyId:e,projectId:a.projectId,projectRef:a.projectRef,summaries:a.summaries})]},a.projectId)),t.hasNextPage?(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-line pt-4",children:[(0,s.jsxs)("p",{className:"text-sm text-ink-3",children:["Showing ",p.length," of ",v," workspaces."]}),(0,s.jsx)(b,{type:"button",variant:"secondary",size:"sm",onClick:i(()=>{t.fetchNextPage()},"onClick"),disabled:t.isFetchingNextPage,children:t.isFetchingNextPage?"Loading...":"Load more"})]}):null]})]}):(0,s.jsx)(S,{to:"/issues",replace:!0})}i(H,"Workspaces");export{H as Workspaces};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var u=Object.defineProperty;var r=(e,t)=>u(e,"name",{value:t,configurable:!0});import{i as c}from"./rolldown-runtime-ZpX3ckPj.js";import{ta as l}from"./createLucideIcon-DJi9suAC.js";import{t as d}from"./Identity-Cv_2a9qJ.js";import{qa as f}from"./index-
|
|
1
|
+
var u=Object.defineProperty;var r=(e,t)=>u(e,"name",{value:t,configurable:!0});import{i as c}from"./rolldown-runtime-ZpX3ckPj.js";import{ta as l}from"./createLucideIcon-DJi9suAC.js";import{t as d}from"./Identity-Cv_2a9qJ.js";import{qa as f}from"./index-3AxqhPET.js";var i=c(l(),1);function B(e,t){return e.createdByUserId?t.get(e.createdByUserId)??{label:e.createdByUserId==="local-board"?"Board":"Board member",image:null}:null}r(B,"connectionOwnerProfile");function o(e){const t=e.trim();if(!t)return"Board";const n=t.split(/\s+/)[0]??t;return n.includes("@")?n.split("@")[0]||"Board":n}r(o,"ownerGivenName");function m(e){return e.toLowerCase().endsWith("s")?`${e}’`:`${e}’s`}r(m,"possessive");function w(e,t,n){const s=e.name.trim(),a=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)||/^(?:[a-z0-9-]+\.)+[a-z]{2,}$/i.test(s)?s:f(e);return!n||a.trim().toLocaleLowerCase()!==t.trim().toLocaleLowerCase()?a:`${m(o(n.label))} ${t}`}r(w,"connectionDisplayNameForOwner");function C(e){const t=e.clientName.trim();return`${e.user?`${m(o(e.user.name))} `:""}${t} connection`}r(C,"assistantConnectionDisplayName");function _({owner:e}){return e?(0,i.jsx)(d,{name:e.label,avatarUrl:e.image,size:"sm",className:"text-ink-3"}):(0,i.jsx)("span",{className:"text-xs text-ink-3",children:"Unknown"})}r(_,"ConnectionOwnerIdentity");export{B as i,C as n,w as r,_ as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Ge=Object.defineProperty;var p=(r,e)=>Ge(r,"name",{value:e,configurable:!0});import{i as fe}from"./rolldown-runtime-ZpX3ckPj.js";import{na as Ne,ta as Ue}from"./createLucideIcon-DJi9suAC.js";import{a as v,c as Ve,n as H,o as Be,s as A}from"./dist-SzpVz8Pd.js";import{i as D,n as Ye}from"./dist-BuHnL0GV.js";import{n as Xe,t as He}from"./dist-DTFX_1D6.js";import{a as pe,i as me,l as ne,o as We,r as qe,s as ze,t as Ze,u as le}from"./dist-CClcSLHe.js";import{a as $e,i as Je,n as Qe,t as en}from"./es2015-C3hhXnTu.js";import{n as nn,r as Me,t as tn}from"./dist-DOIzg2vq.js";var o=fe(Ne(),1),u=fe(Ue(),1),on=Object.defineProperty,d=p((r,e)=>on(r,"name",{value:e,configurable:!0}),"__name"),Q=["Enter"," "],rn=["ArrowDown","PageUp","Home"],he=["ArrowUp","PageDown","End"],cn=[...rn,...he],an={ltr:[...Q,"ArrowRight"],rtl:[...Q,"ArrowLeft"]},un={ltr:["ArrowLeft"],rtl:["ArrowRight"]},W="Menu",[F,sn,ln]=Xe(W),[b,Xn]=Be(W,[ln,pe,Me]),q=pe(),Ce=Me(),[ge,R]=b(W),[dn,K]=b(W),fn=d(r=>{const{__scopeMenu:e,open:t=!1,children:n,dir:c,onOpenChange:s,modal:a=!0}=r,m=q(e),[h,g]=o.useState(null),C=o.useRef(!1),M=ne(s),l=He(c);return o.useEffect(()=>{const f=d(()=>{C.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},"handleKeyDown"),x=d(()=>C.current=!1,"handlePointer");return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),o.useEffect(()=>{if(!t)return;const f=d(()=>M(!1),"handleBlur");return window.addEventListener("blur",f),()=>window.removeEventListener("blur",f)},[t,M]),(0,u.jsx)(me,{...m,children:(0,u.jsx)(ge,{scope:e,open:t,onOpenChange:M,content:h,onContentChange:g,children:(0,u.jsx)(dn,{scope:e,onClose:o.useCallback(()=>M(!1),[M]),isUsingKeyboardRef:C,dir:l,modal:a,children:n})})})},"Menu"),ve=o.forwardRef(d(p(function(e,t){const{__scopeMenu:n,...c}=e,s=q(n);return(0,u.jsx)(Ze,{...s,...c,ref:t})},"MenuAnchor2"),"MenuAnchor")),xe="MenuPortal",[pn,_e]=b(xe,{forceMount:void 0}),mn=d(r=>{const{__scopeMenu:e,forceMount:t,children:n,container:c}=r,s=R(xe,e);return(0,u.jsx)(pn,{scope:e,forceMount:t,children:(0,u.jsx)(H,{present:t||s.open,children:(0,u.jsx)(We,{asChild:!0,container:c,children:n})})})},"MenuPortal"),S="MenuContent",[Mn,te]=b(S),hn=o.forwardRef(d(p(function(e,t){const n=_e(S,e.__scopeMenu),{forceMount:c=n.forceMount,...s}=e,a=R(S,e.__scopeMenu),m=K(S,e.__scopeMenu);return(0,u.jsx)(F.Provider,{scope:e.__scopeMenu,children:(0,u.jsx)(H,{present:c||a.open,children:(0,u.jsx)(F.Slot,{scope:e.__scopeMenu,children:m.modal?(0,u.jsx)(Cn,{...s,ref:t}):(0,u.jsx)(gn,{...s,ref:t})})})})},"MenuContent2"),"MenuContent")),Cn=o.forwardRef(d(p(function(e,t){const n=R(S,e.__scopeMenu),c=o.useRef(null),s=D(t,c);return o.useEffect(()=>{const a=c.current;if(a)return en(a)},[]),(0,u.jsx)(oe,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:v(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:p(()=>n.onOpenChange(!1),"onDismiss")})},"MenuRootContentModal2"),"MenuRootContentModal")),gn=o.forwardRef(d(p(function(e,t){const n=R(S,e.__scopeMenu);return(0,u.jsx)(oe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:p(()=>n.onOpenChange(!1),"onDismiss")})},"MenuRootContentNonModal2"),"MenuRootContentNonModal")),vn=Ye("MenuContent.ScrollLock"),oe=o.forwardRef(d(p(function(e,t){const{__scopeMenu:n,loop:c=!1,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:m,disableOutsidePointerEvents:h,onEntryFocus:g,onEscapeKeyDown:C,onPointerDownOutside:M,onFocusOutside:l,onInteractOutside:f,onDismiss:x,disableOutsideScroll:_,...P}=e,G=R(S,n),E=K(S,n),N=q(n),ke=Ce(n),ae=sn(n),[De,ue]=o.useState(null),U=o.useRef(null),Oe=D(t,U,G.onContentChange),V=o.useRef(0),B=o.useRef(""),Fe=o.useRef(0),Z=o.useRef(null),se=o.useRef("right"),$=o.useRef(0),Le=_?Qe:o.Fragment,Ae=_?{as:vn,allowPinchZoom:!0}:void 0,Ke=d(i=>{const y=B.current+i,w=ae().filter(I=>!I.disabled),O=document.activeElement,J=w.find(I=>I.ref.current===O)?.textValue,Y=Te(w.map(I=>I.textValue),y,J),j=w.find(I=>I.textValue===Y)?.ref.current;d(p((function I(ie){B.current=ie,window.clearTimeout(V.current),ie!==""&&(V.current=window.setTimeout(()=>I(""),1e3))}),"updateSearch"),"updateSearch")(y),j&&setTimeout(()=>j.focus())},"handleTypeaheadSearch");o.useEffect(()=>()=>window.clearTimeout(V.current),[]),Je();const T=o.useCallback(i=>se.current===Z.current?.side&&je(i,Z.current?.area),[]);return(0,u.jsx)(Mn,{scope:n,searchRef:B,onItemEnter:o.useCallback(i=>{T(i)&&i.preventDefault()},[T]),onItemLeave:o.useCallback(i=>{T(i)||(U.current?.focus(),ue(null))},[T]),onTriggerLeave:o.useCallback(i=>{T(i)&&i.preventDefault()},[T]),pointerGraceTimerRef:Fe,onPointerGraceIntentChange:o.useCallback(i=>{Z.current=i},[]),children:(0,u.jsx)(Le,{...Ae,children:(0,u.jsx)($e,{asChild:!0,trapped:s,onMountAutoFocus:v(a,i=>{i.preventDefault(),U.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:m,children:(0,u.jsx)(ze,{asChild:!0,disableOutsidePointerEvents:h,onEscapeKeyDown:C,onPointerDownOutside:M,onFocusOutside:l,onInteractOutside:f,onDismiss:x,children:(0,u.jsx)(nn,{asChild:!0,...ke,dir:E.dir,orientation:"vertical",loop:c,currentTabStopId:De,onCurrentTabStopIdChange:ue,onEntryFocus:v(g,i=>{E.isUsingKeyboardRef.current||i.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,u.jsx)(qe,{role:"menu","aria-orientation":"vertical","data-state":ce(G.open),"data-radix-menu-content":"",dir:E.dir,...N,...P,ref:Oe,style:{outline:"none",...P.style},onKeyDown:v(P.onKeyDown,i=>{const y=i.target.closest("[data-radix-menu-content]")===i.currentTarget,w=i.ctrlKey||i.altKey||i.metaKey,O=i.key.length===1;y&&(i.key==="Tab"&&i.preventDefault(),!w&&O&&Ke(i.key));const J=U.current;if(i.target!==J||!cn.includes(i.key))return;i.preventDefault();const Y=ae().filter(j=>!j.disabled).map(j=>j.ref.current);he.includes(i.key)&&Y.reverse(),be(Y)}),onBlur:v(e.onBlur,i=>{i.currentTarget.contains(i.target)||(window.clearTimeout(V.current),B.current="")}),onPointerMove:v(e.onPointerMove,k(i=>{const y=i.target,w=$.current!==i.clientX;if(i.currentTarget.contains(y)&&w){const O=i.clientX>$.current?"right":"left";se.current=O,$.current=i.clientX}}))})})})})})})},"MenuContentImpl2"),"MenuContentImpl")),xn=o.forwardRef(d(p(function(e,t){const{__scopeMenu:n,...c}=e;return(0,u.jsx)(A.div,{role:"group",...c,ref:t})},"MenuGroup2"),"MenuGroup")),_n=o.forwardRef(d(p(function(e,t){const{__scopeMenu:n,...c}=e;return(0,u.jsx)(A.div,{...c,ref:t})},"MenuLabel2"),"MenuLabel")),ee="MenuItem",de="menu.itemSelect",re=o.forwardRef(d(p(function(e,t){const{disabled:n=!1,onSelect:c,...s}=e,a=o.useRef(null),m=K(ee,e.__scopeMenu),h=te(ee,e.__scopeMenu),g=D(t,a),C=o.useRef(!1),M=d(()=>{const l=a.current;if(!n&&l){const f=new CustomEvent(de,{bubbles:!0,cancelable:!0});l.addEventListener(de,x=>c?.(x),{once:!0}),Ve(l,f),f.defaultPrevented?C.current=!1:m.onClose()}},"handleSelect");return(0,u.jsx)(Se,{...s,ref:g,disabled:n,onClick:v(e.onClick,M),onPointerDown:p(l=>{e.onPointerDown?.(l),C.current=!0},"onPointerDown"),onPointerUp:v(e.onPointerUp,l=>{C.current||l.currentTarget?.click()}),onKeyDown:v(e.onKeyDown,l=>{n||l.target!==l.currentTarget||h.searchRef.current!==""&&l.key===" "||Q.includes(l.key)&&(l.currentTarget.click(),l.preventDefault())})})},"MenuItem2"),"MenuItem")),Se=o.forwardRef(d(p(function(e,t){const{__scopeMenu:n,disabled:c=!1,textValue:s,...a}=e,m=te(ee,n),h=Ce(n),g=o.useRef(null),C=D(t,g),[M,l]=o.useState(!1),[f,x]=o.useState("");return o.useEffect(()=>{const _=g.current;_&&x((_.textContent??"").trim())},[a.children]),(0,u.jsx)(F.ItemSlot,{scope:n,disabled:c,textValue:s??f,children:(0,u.jsx)(tn,{asChild:!0,...h,focusable:!c,children:(0,u.jsx)(A.div,{role:"menuitem","data-highlighted":M?"":void 0,"aria-disabled":c||void 0,"data-disabled":c?"":void 0,...a,ref:C,onPointerMove:v(e.onPointerMove,k(_=>{c?m.onItemLeave(_):(m.onItemEnter(_),_.defaultPrevented||_.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:v(e.onPointerLeave,k(_=>m.onItemLeave(_))),onFocus:v(e.onFocus,()=>l(!0)),onBlur:v(e.onBlur,()=>l(!1))})})})},"MenuItemImpl2"),"MenuItemImpl")),Sn=o.forwardRef(d(p(function(e,t){const{checked:n=!1,onCheckedChange:c,...s}=e;return(0,u.jsx)(Re,{scope:e.__scopeMenu,checked:n,children:(0,u.jsx)(re,{role:"menuitemcheckbox","aria-checked":L(n)?"mixed":n,...s,ref:t,"data-state":z(n),onSelect:v(s.onSelect,()=>c?.(L(n)?!0:!n),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem2"),"MenuCheckboxItem")),[In,Rn]=b("MenuRadioGroup",{value:void 0,onValueChange:d(()=>{},"onValueChange")}),Pn=o.forwardRef(d(p(function(e,t){const{value:n,onValueChange:c,...s}=e,a=ne(c);return(0,u.jsx)(In,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,u.jsx)(xn,{...s,ref:t})})},"MenuRadioGroup2"),"MenuRadioGroup")),wn="MenuRadioItem",bn=o.forwardRef(d(p(function(e,t){const{value:n,...c}=e,s=Rn(wn,e.__scopeMenu),a=n===s.value;return(0,u.jsx)(Re,{scope:e.__scopeMenu,checked:a,children:(0,u.jsx)(re,{role:"menuitemradio","aria-checked":a,...c,ref:t,"data-state":z(a),onSelect:v(c.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},"MenuRadioItem2"),"MenuRadioItem")),Ie="MenuItemIndicator",[Re,En]=b(Ie,{checked:!1}),Tn=o.forwardRef(d(p(function(e,t){const{__scopeMenu:n,forceMount:c,...s}=e,a=En(Ie,n);return(0,u.jsx)(H,{present:c||L(a.checked)||a.checked===!0,children:(0,u.jsx)(A.span,{...s,ref:t,"data-state":z(a.checked)})})},"MenuItemIndicator2"),"MenuItemIndicator")),yn=o.forwardRef(d(p(function(e,t){const{__scopeMenu:n,...c}=e;return(0,u.jsx)(A.div,{role:"separator","aria-orientation":"horizontal",...c,ref:t})},"MenuSeparator2"),"MenuSeparator")),Pe="MenuSub",[jn,we]=b(Pe),kn=d(r=>{const{__scopeMenu:e,children:t,open:n=!1,onOpenChange:c}=r,s=R(Pe,e),a=q(e),[m,h]=o.useState(null),[g,C]=o.useState(null),M=ne(c);return o.useEffect(()=>(s.open===!1&&M(!1),()=>M(!1)),[s.open,M]),(0,u.jsx)(me,{...a,children:(0,u.jsx)(ge,{scope:e,open:n,onOpenChange:M,content:g,onContentChange:C,children:(0,u.jsx)(jn,{scope:e,contentId:le(),triggerId:le(),trigger:m,onTriggerChange:h,children:t})})})},"MenuSub"),X="MenuSubTrigger",Dn=o.forwardRef(d(p(function(e,t){const n=R(X,e.__scopeMenu),c=K(X,e.__scopeMenu),s=we(X,e.__scopeMenu),a=te(X,e.__scopeMenu),m=o.useRef(null),{pointerGraceTimerRef:h,onPointerGraceIntentChange:g}=a,C={__scopeMenu:e.__scopeMenu},M=o.useCallback(()=>{m.current&&window.clearTimeout(m.current),m.current=null},[]);o.useEffect(()=>M,[M]),o.useEffect(()=>{const f=h.current;return()=>{window.clearTimeout(f),g(null)}},[h,g]);const l=D(t,s.onTriggerChange);return(0,u.jsx)(ve,{asChild:!0,...C,children:(0,u.jsx)(Se,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.open?s.contentId:void 0,"data-state":ce(n.open),...e,ref:l,onClick:p(f=>{e.onClick?.(f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},"onClick"),onPointerMove:v(e.onPointerMove,k(f=>{a.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!m.current&&(a.onPointerGraceIntentChange(null),m.current=window.setTimeout(()=>{n.onOpenChange(!0),M()},100))})),onPointerLeave:v(e.onPointerLeave,k(f=>{M();const x=n.content?.getBoundingClientRect();if(x){const _=n.content?.dataset.side,P=_==="right",G=P?-5:5,E=x[P?"left":"right"],N=x[P?"right":"left"];a.onPointerGraceIntentChange({area:[{x:f.clientX+G,y:f.clientY},{x:E,y:x.top},{x:N,y:x.top},{x:N,y:x.bottom},{x:E,y:x.bottom}],side:_}),window.clearTimeout(h.current),h.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(f),f.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:v(e.onKeyDown,f=>{e.disabled||f.target!==f.currentTarget||a.searchRef.current!==""&&f.key===" "||an[c.dir].includes(f.key)&&(n.onOpenChange(!0),n.content?.focus(),f.preventDefault())})})})},"MenuSubTrigger2"),"MenuSubTrigger")),On="MenuSubContent",Fn=o.forwardRef(d(p(function(e,t){const n=_e(S,e.__scopeMenu),{forceMount:c=n.forceMount,align:s="start",...a}=e,m=R(S,e.__scopeMenu),h=K(S,e.__scopeMenu),g=we(On,e.__scopeMenu),C=o.useRef(null),M=D(t,C);return(0,u.jsx)(F.Provider,{scope:e.__scopeMenu,children:(0,u.jsx)(H,{present:c||m.open,children:(0,u.jsx)(F.Slot,{scope:e.__scopeMenu,children:(0,u.jsx)(oe,{id:g.contentId,"aria-labelledby":g.triggerId,...a,ref:M,align:s,side:h.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p(l=>{h.isUsingKeyboardRef.current&&C.current?.focus(),l.preventDefault()},"onOpenAutoFocus"),onCloseAutoFocus:p(l=>l.preventDefault(),"onCloseAutoFocus"),onFocusOutside:v(e.onFocusOutside,l=>{l.target!==g.trigger&&m.onOpenChange(!1)}),onEscapeKeyDown:v(e.onEscapeKeyDown,l=>{h.onClose(),l.preventDefault()}),onKeyDown:v(e.onKeyDown,l=>{const f=l.currentTarget.contains(l.target),x=un[h.dir].includes(l.key);f&&x&&(m.onOpenChange(!1),g.trigger?.focus(),l.preventDefault())})})})})})},"MenuSubContent2"),"MenuSubContent"));function ce(r){return r?"open":"closed"}p(ce,"getOpenState");d(ce,"getOpenState");function L(r){return r==="indeterminate"}p(L,"isIndeterminate");d(L,"isIndeterminate");function z(r){return L(r)?"indeterminate":r?"checked":"unchecked"}p(z,"getCheckedState");d(z,"getCheckedState");function be(r){const e=document.activeElement;for(const t of r)if(t===e||(t.focus(),document.activeElement!==e))return}p(be,"focusFirst");d(be,"focusFirst");function Ee(r,e){return r.map((t,n)=>r[(e+n)%r.length])}p(Ee,"wrapArray");d(Ee,"wrapArray");function Te(r,e,t){const n=e.length>1&&Array.from(e).every(m=>m===e[0])?e[0]:e,c=t?r.indexOf(t):-1;let s=Ee(r,Math.max(c,0));n.length===1&&(s=s.filter(m=>m!==t));const a=s.find(m=>m.toLowerCase().startsWith(n.toLowerCase()));return a!==t?a:void 0}p(Te,"getNextMatch");d(Te,"getNextMatch");function ye(r,e){const{x:t,y:n}=r;let c=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const m=e[s],h=e[a],g=m.x,C=m.y,M=h.x,l=h.y;C>n!=l>n&&t<(M-g)*(n-C)/(l-C)+g&&(c=!c)}return c}p(ye,"isPointInPolygon");d(ye,"isPointInPolygon");function je(r,e){return e?ye({x:r.clientX,y:r.clientY},e):!1}p(je,"isPointerInGraceArea");d(je,"isPointerInGraceArea");function k(r){return e=>e.pointerType==="mouse"?r(e):void 0}p(k,"whenMouse");d(k,"whenMouse");var Hn=fn,Wn=ve,qn=mn,zn=hn,Zn=_n,$n=re,Jn=Sn,Qn=Pn,et=bn,nt=Tn,tt=yn,ot=kn,rt=Dn,ct=Fn;export{nt as a,Qn as c,tt as d,ot as f,Xn as h,$n as i,et as l,rt as m,Jn as n,Zn as o,ct as p,zn as r,qn as s,Wn as t,Hn as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var I=Object.defineProperty;var d=(o,e)=>I(o,"name",{value:e,configurable:!0});import{i as D}from"./rolldown-runtime-ZpX3ckPj.js";import{l as w,na as R,ta as k}from"./createLucideIcon-DJi9suAC.js";import{a as v,o as P,r as M,s as y}from"./dist-SzpVz8Pd.js";import{i as z}from"./dist-BuHnL0GV.js";import{u as h}from"./dist-CClcSLHe.js";import{a as N,c as O,d as T,f as $,h as _,i as E,l as G,m as A,n as L,o as K,p as q,r as F,s as H,t as U,u as W}from"./dist-ypeTPGg_.js";import{t as B}from"./check-Ctsrlfa-.js";import{t as J}from"./chevron-right-s7L6hXXq.js";import{t as Q}from"./circle-IAHLDvLO.js";var p=D(R(),1),t=D(k(),1),V=Object.defineProperty,c=d((o,e)=>V(o,"name",{value:e,configurable:!0}),"__name"),b="DropdownMenu",[X,Ge]=P(b,[_]),l=_(),[Y,S]=X(b),Z=c(o=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:a,defaultOpen:s,onOpenChange:i,modal:m=!0}=o,f=l(e),u=p.useRef(null),[x,g]=M({prop:a,defaultProp:s??!1,onChange:i,caller:b});return(0,t.jsx)(Y,{scope:e,triggerId:h(),triggerRef:u,contentId:h(),open:x,onOpenChange:g,onOpenToggle:p.useCallback(()=>g(j=>!j),[g]),modal:m,children:(0,t.jsx)(W,{...f,open:x,onOpenChange:g,dir:r,modal:m,children:n})})},"DropdownMenu"),ee="DropdownMenuTrigger",oe=p.forwardRef(c(d(function(e,n){const{__scopeDropdownMenu:r,disabled:a=!1,...s}=e,i=S(ee,r),m=l(r),f=z(n,i.triggerRef);return(0,t.jsx)(U,{asChild:!0,...m,children:(0,t.jsx)(y.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...s,ref:f,onPointerDown:v(e.onPointerDown,u=>{!a&&u.button===0&&u.ctrlKey===!1&&(i.onOpenToggle(),i.open||u.preventDefault())}),onKeyDown:v(e.onKeyDown,u=>{a||(["Enter"," "].includes(u.key)&&i.onOpenToggle(),u.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})},"DropdownMenuTrigger2"),"DropdownMenuTrigger")),ne=c(o=>{const{__scopeDropdownMenu:e,...n}=o,r=l(e);return(0,t.jsx)(H,{...r,...n})},"DropdownMenuPortal"),te="DropdownMenuContent",re=p.forwardRef(c(d(function(e,n){const{__scopeDropdownMenu:r,...a}=e,s=S(te,r),i=l(r),m=p.useRef(!1);return(0,t.jsx)(F,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...a,ref:n,onCloseAutoFocus:v(e.onCloseAutoFocus,f=>{m.current||s.triggerRef.current?.focus(),m.current=!1,f.preventDefault()}),onInteractOutside:v(e.onInteractOutside,f=>{const u=f.detail.originalEvent,x=u.button===0&&u.ctrlKey===!0,g=u.button===2||x;(!s.modal||g)&&(m.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent2"),"DropdownMenuContent")),ae=p.forwardRef(c(d(function(e,n){const{__scopeDropdownMenu:r,...a}=e,s=l(r);return(0,t.jsx)(K,{...s,...a,ref:n})},"DropdownMenuLabel2"),"DropdownMenuLabel")),se=p.forwardRef(c(d(function(e,n){const{__scopeDropdownMenu:r,...a}=e,s=l(r);return(0,t.jsx)(E,{...s,...a,ref:n})},"DropdownMenuItem2"),"DropdownMenuItem")),de=p.forwardRef(c(d(function(e,n){const{__scopeDropdownMenu:r,...a}=e,s=l(r);return(0,t.jsx)(L,{...s,...a,ref:n})},"DropdownMenuCheckboxItem2"),"DropdownMenuCheckboxItem")),ie=p.forwardRef(c(d(function(e,n){const{__scopeDropdownMenu:r,...a}=e,s=l(r);return(0,t.jsx)(O,{...s,...a,ref:n})},"DropdownMenuRadioGroup2"),"DropdownMenuRadioGroup")),ue=p.forwardRef(c(d(function(e,n){const{__scopeDropdownMenu:r,...a}=e,s=l(r);return(0,t.jsx)(G,{...s,...a,ref:n})},"DropdownMenuRadioItem2"),"DropdownMenuRadioItem")),pe=p.forwardRef(c(d(function(e,n){const{__scopeDropdownMenu:r,...a}=e,s=l(r);return(0,t.jsx)(N,{...s,...a,ref:n})},"DropdownMenuItemIndicator2"),"DropdownMenuItemIndicator")),ce=p.forwardRef(c(d(function(e,n){const{__scopeDropdownMenu:r,...a}=e,s=l(r);return(0,t.jsx)(T,{...s,...a,ref:n})},"DropdownMenuSeparator2"),"DropdownMenuSeparator")),le=c(o=>{const{__scopeDropdownMenu:e,children:n,open:r,onOpenChange:a,defaultOpen:s}=o,i=l(e),[m,f]=M({prop:r,defaultProp:s??!1,onChange:a,caller:"DropdownMenuSub"});return(0,t.jsx)($,{...i,open:m,onOpenChange:f,children:n})},"DropdownMenuSub"),me=p.forwardRef(c(d(function(e,n){const{__scopeDropdownMenu:r,...a}=e,s=l(r);return(0,t.jsx)(A,{...s,...a,ref:n})},"DropdownMenuSubTrigger2"),"DropdownMenuSubTrigger")),fe=p.forwardRef(c(d(function(e,n){const{__scopeDropdownMenu:r,...a}=e,s=l(r);return(0,t.jsx)(q,{...s,...a,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuSubContent2"),"DropdownMenuSubContent")),we=Z,ge=oe,xe=ne,ve=re,be=ae,he=se,De=de,Me=ie,_e=ue,C=pe,Se=ce,Ce=le,je=me,Ie=fe;function Ae({...o}){return(0,t.jsx)(we,{"data-slot":"dropdown-menu",...o})}d(Ae,"DropdownMenu");function Le({...o}){return(0,t.jsx)(ge,{"data-slot":"dropdown-menu-trigger",...o})}d(Le,"DropdownMenuTrigger");function Ke({className:o,sideOffset:e=4,...n}){return(0,t.jsx)(xe,{children:(0,t.jsx)(ve,{"data-slot":"dropdown-menu-content",sideOffset:e,className:w("bg-bg-2 text-ink data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-(--sz-8rem) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",o),...n})})}d(Ke,"DropdownMenuContent");function qe({className:o,inset:e,variant:n="default",...r}){return(0,t.jsx)(he,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:w("focus:bg-bg-3 focus:text-ink data-[variant=destructive]:text-bad data-[variant=destructive]:focus:bg-bad/10 dark:data-[variant=destructive]:focus:bg-bad/20 data-[variant=destructive]:focus:text-bad data-[variant=destructive]:*:[svg]:!text-bad [&_svg:not([class*='text-'])]:text-ink-3 relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),...r})}d(qe,"DropdownMenuItem");function Fe({className:o,children:e,checked:n,...r}){return(0,t.jsxs)(De,{"data-slot":"dropdown-menu-checkbox-item",className:w("focus:bg-bg-3 focus:text-ink relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),checked:n,...r,children:[(0,t.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,t.jsx)(C,{children:(0,t.jsx)(B,{className:"size-4"})})}),e]})}d(Fe,"DropdownMenuCheckboxItem");function He({...o}){return(0,t.jsx)(Me,{"data-slot":"dropdown-menu-radio-group",...o})}d(He,"DropdownMenuRadioGroup");function Ue({className:o,children:e,...n}){return(0,t.jsxs)(_e,{"data-slot":"dropdown-menu-radio-item",className:w("focus:bg-bg-3 focus:text-ink relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),...n,children:[(0,t.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,t.jsx)(C,{children:(0,t.jsx)(Q,{className:"size-2 fill-current"})})}),e]})}d(Ue,"DropdownMenuRadioItem");function We({className:o,inset:e,...n}){return(0,t.jsx)(be,{"data-slot":"dropdown-menu-label","data-inset":e,className:w("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",o),...n})}d(We,"DropdownMenuLabel");function Be({className:o,...e}){return(0,t.jsx)(Se,{"data-slot":"dropdown-menu-separator",className:w("bg-line -mx-1 my-1 h-px",o),...e})}d(Be,"DropdownMenuSeparator");function Je({className:o,...e}){return(0,t.jsx)("span",{"data-slot":"dropdown-menu-shortcut",className:w("text-ink-3 ml-auto text-xs tracking-widest",o),...e})}d(Je,"DropdownMenuShortcut");function Qe({...o}){return(0,t.jsx)(Ce,{"data-slot":"dropdown-menu-sub",...o})}d(Qe,"DropdownMenuSub");function Ve({className:o,inset:e,children:n,...r}){return(0,t.jsxs)(je,{"data-slot":"dropdown-menu-sub-trigger","data-inset":e,className:w("focus:bg-bg-3 focus:text-ink data-[state=open]:bg-bg-3 data-[state=open]:text-ink [&_svg:not([class*='text-'])]:text-ink-3 flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),...r,children:[n,(0,t.jsx)(J,{className:"ml-auto size-4"})]})}d(Ve,"DropdownMenuSubTrigger");function Xe({className:o,...e}){return(0,t.jsx)(Ie,{"data-slot":"dropdown-menu-sub-content",className:w("bg-bg-2 text-ink data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-(--sz-8rem) origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",o),...e})}d(Xe,"DropdownMenuSubContent");export{We as a,Be as c,Xe as d,Ve as f,qe as i,Je as l,Fe as n,He as o,Le as p,Ke as r,Ue as s,Ae as t,Qe as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var He=Object.defineProperty;var s=(t,r)=>He(t,"name",{value:r,configurable:!0});import{i as fe}from"./rolldown-runtime-ZpX3ckPj.js";import{l as R,na as Ze,t as ze,ta as Ge}from"./createLucideIcon-DJi9suAC.js";import{l as Ye}from"./dist-SzpVz8Pd.js";import{r as Je}from"./star-BZgQbzhV.js";import{i as re,p as be,r as ge,t as ye}from"./dropdown-menu-CqRAF7Oj.js";import{a as We,i as Xe,n as je,r as Ne,t as ke}from"./popover-BhYHYj7q.js";import{t as Qe}from"./chevron-down-BCvxsWfI.js";import{t as et}from"./SearchableSelect-CIJ5K8ih.js";import{t as tt}from"./circle-alert-C-L4OsHh.js";import{t as st}from"./ellipsis-BTiLRUn4.js";import{t as nt}from"./eye-off-CVVA-EWh.js";import{t as rt}from"./eye-DRS7RbEp.js";import{t as se}from"./key-round-0RqEOB_C.js";import{r as at,t as ie}from"./button-CMwV3L1P.js";import{t as Ve}from"./plus-C6fnr28l.js";import{t as it}from"./rotate-ccw-CQEJ4ewP.js";import{t as lt}from"./save-CJ1Iqyew.js";import{t as ot}from"./shield-alert-Be9GuMrS.js";import{t as Te}from"./user-round-CGxsJ0K8.js";import{t as Se}from"./x-DRDFdlYE.js";import{i as ct,n as ut,r as mt,t as dt}from"./tooltip-B5WQ3lq5.js";import{t as xt}from"./badge-DuA2EgZC.js";import{n as ft}from"./ToastContext-DMdt9oTd.js";import{n as pt}from"./searchable-select-fvMNMcqm.js";import{t as ht}from"./chip-DsDe6yck.js";import{a as $e,c as vt,d as bt,f as oe,i as Me,l as ce,o as ue,r as gt,s as yt,u as Ee}from"./model-DidtFy-U.js";var Ae={name:"corner-up-left",size:24,node:[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]]};Ae.node;var jt=ze(Ae),Ke={name:"type",size:24,node:[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]]};Ke.node;var Nt=ze(Ke),kt=fe(Ye(),1),o=fe(Ze(),1),e=fe(Ge(),1),St="__secret_folder__:";function Et(t){return!t||t==="active"?null:(0,e.jsx)(xt,{variant:"outline",className:"ml-auto text-(length:--text-nano) font-normal text-ink-3",children:t})}s(Et,"statusBadge");function De(t){return t.split("/").filter(r=>r.length>0)}s(De,"splitSecretPath");function ae(t){return t.join("/")}s(ae,"pathKey");function ee(t){return t.length>0?`/${t.join("/")}`:"/"}s(ee,"pathLabel");function Ct(t,r){return t.length<r.length?!1:r.every((h,c)=>t[c]===h)}s(Ct,"pathStartsWith");function Ce(t){return`${St}${ae(t)}`}s(Ce,"folderValue");function wt(t,r,h){const c=r.length,y=new Map,f=[];for(const m of t){const N=De(m.name);if(Ct(N,r)){if(N.length>c+1){const p=N.slice(0,c+1),C=ae(p);if(!y.has(C)){const $=p[p.length-1]??"/",z=ee(p);y.set(C,{key:`folder-${C||"root"}`,value:Ce(p),label:$,title:z,searchText:z,kind:"folder",folderPath:C,pathHint:z})}continue}if(N.length===c+1||c===0&&N.length===0){const p=N.at(-1)??m.name;f.push({key:`browse-${m.id}`,value:m.id,label:p,title:m.name,searchText:`${m.key} ${m.name}`,secret:m,status:m.status,kind:"secret",pathHint:m.name,disabled:m.status!=="active"&&m.id!==h})}}}const j=[];if(r.length>0){const m=r.slice(0,-1);j.push({key:`folder-up-${ae(r)}`,value:Ce(m),label:"Up one folder",title:ee(m),searchText:ee(m),kind:"back",folderPath:ae(m),pathHint:ee(m)})}return j.push(...y.values(),...f),{id:"browse-secrets",label:r.length>0?ee(r):"Browse secrets",options:j}}s(wt,"buildFolderGroup");function _t({secretId:t,secrets:r,recentlyUsedSecrets:h,disabled:c,onSelect:y,onCreateNew:f,triggerClassName:j,disablePortal:m}){const[N,p]=(0,o.useState)(""),C=(0,o.useMemo)(()=>r.find(i=>i.id===t)??null,[r,t]),$=!!t&&!C,z=(0,o.useMemo)(()=>N?N.split("/"):[],[N]),K=(0,o.useMemo)(()=>r.some(i=>De(i.name).length>1),[r]),D=(0,o.useMemo)(()=>{const i=[];$&&i.push({id:"current-missing",label:"Current",options:[{key:`missing-${t}`,value:t,label:`Missing secret (${t.slice(0,8)}…)`,title:`Missing secret (${t})`,missing:!0,disabled:!0}]});const b=(h??[]).filter(u=>u.status==="active"&&u.id!==t);return b.length>0&&i.push({id:"recently-used",label:"Recently used",options:b.map(u=>({key:`recent-${u.id}`,value:u.id,label:u.name,title:u.name,searchText:`${u.key} ${u.name}`,secret:u,status:u.status,kind:"secret"}))}),i.push({id:"all-secrets",label:b.length>0?"All secrets":void 0,options:r.map(u=>({key:`all-${u.id}`,value:u.id,label:u.name,title:u.name,searchText:`${u.key} ${u.name}`,secret:u,status:u.status,kind:"secret",disabled:u.status!=="active"&&u.id!==t}))}),i},[$,h,t,r]),v=(0,o.useCallback)((i,b)=>{if(!K||pt(i))return b;const u=wt(r,z,t),w=b.filter(E=>E.id==="current-missing"||E.id==="recently-used");return u.options.length>0?[...w,u]:w},[z,K,t,r]);return(0,e.jsx)(et,{value:t||"",groups:D,onValueChange:s((i,b)=>{if(b.folderPath!==void 0)return p(b.folderPath),!1;p(""),y(i)},"onValueChange"),deriveGroups:v,disabled:c,disablePortal:m,placeholder:"Select secret…",searchPlaceholder:"Search secrets…",emptyMessage:"No matching secrets",triggerClassName:R("h-(--sz-34px) min-h-(--sz-34px) font-mono text-sm",$&&"border-bad text-bad",C&&C.status!=="active"&&"border-amber-500/60",j),renderValue:s(i=>{if(!i)return(0,e.jsx)("span",{className:"text-ink-3",children:"Select secret…"});if(i.missing)return(0,e.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5 text-bad",children:[(0,e.jsx)(se,{className:"size-3.5 shrink-0"}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:i.label})]});const b=i.status&&i.status!=="active";return(0,e.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",title:i.title,children:[(0,e.jsx)(se,{className:R("size-3.5 shrink-0",b?"text-amber-600":"text-ink-3")}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:i.label}),b?(0,e.jsxs)("span",{className:"text-amber-600",children:["(",i.status,")"]}):null]})},"renderValue"),renderOption:s((i,{selected:b})=>{if(i.kind==="folder"||i.kind==="back"){const u=i.kind==="back"?jt:Je;return(0,e.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",title:i.title??i.label,children:[(0,e.jsx)(u,{className:"size-3.5 shrink-0 text-ink-3"}),(0,e.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,e.jsx)("span",{className:R("truncate text-sm",b&&"font-medium"),children:i.label}),i.pathHint?(0,e.jsx)("span",{className:"truncate font-mono text-(length:--text-micro) text-ink-3",children:i.pathHint}):null]})]})}return(0,e.jsxs)("span",{className:R("flex min-w-0 flex-1 items-center gap-1.5",i.disabled&&"opacity-60"),title:i.title??i.label,children:[(0,e.jsx)(se,{className:"size-3.5 shrink-0 text-ink-3"}),(0,e.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,e.jsx)("span",{className:R("min-w-0 truncate font-mono text-sm",b&&"font-medium"),children:i.label}),i.pathHint&&i.pathHint!==i.label?(0,e.jsx)("span",{className:"truncate font-mono text-(length:--text-micro) text-ink-3",children:i.pathHint}):null]}),Et(i.status)]})},"renderOption"),createItem:f?{render:s(i=>(0,e.jsxs)("span",{className:"flex items-center gap-1.5 text-sm",children:[(0,e.jsx)(Ve,{className:"size-3.5 shrink-0"}),i.trim()?(0,e.jsxs)("span",{children:["Create secret ",(0,e.jsxs)("span",{className:"font-mono",children:["“",i.trim(),"”"]}),"…"]}):(0,e.jsx)("span",{children:"Create new secret…"})]}),"render"),onSelect:s(i=>f(i),"onSelect")}:void 0})}s(_t,"SecretPicker");var Rt=/^[a-z][a-z0-9_]*$/,we="w-full rounded-md border border-line px-2.5 py-1.5 bg-transparent outline-none text-sm font-mono placeholder:text-ink-3/40 focus-visible:ring-2 focus-visible:ring-focus/40";function Ie({mode:t,initialName:r,initialValue:h,existingSecretNames:c,onCancel:y,onSubmit:f}){const[j,m]=(0,o.useState)(r),[N,p]=(0,o.useState)(h),[C,$]=(0,o.useState)(!1),[z,K]=(0,o.useState)(!1),[D,v]=(0,o.useState)(null),[i,b]=(0,o.useState)(!1),u=j.trim(),w=u?Rt.test(u)?c?.some(S=>S.toLowerCase()===u)?"A secret with this name already exists":null:"Use lowercase letters, digits and _":i?"Name is required":null,E=N.length===0&&i?"Value is required":null,T=!z&&u.length>0&&N.length>0&&!w;async function _(){if(b(!0),!!T){K(!0),v(null);try{await f(u,N)}catch(S){v(S instanceof Error?S.message:"Failed to create secret"),K(!1)}}}s(_,"handleSubmit");const q=t==="create"?"Create & bind":"Store & bind";return(0,e.jsxs)("div",{className:"w-72 space-y-3",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(We,{className:"text-sm font-medium",children:t==="create"?"Create secret":"Store value as secret"}),t==="store"?(0,e.jsxs)(Xe,{className:"text-(length:--text-micro) text-ink-3",children:["Moves the typed value into an encrypted organization secret and binds"," ",(0,e.jsx)("span",{className:"font-mono",children:r||"this variable"})," to it."]}):null]}),(0,e.jsxs)("label",{className:"block space-y-1",children:[(0,e.jsx)("span",{className:"text-(length:--text-micro) font-medium text-ink-3",children:"Name"}),(0,e.jsx)("input",{className:R(we,w&&"border-bad focus-visible:ring-bad/40"),value:j,autoFocus:!0,spellCheck:!1,placeholder:"secret_name","aria-label":"Secret name","aria-invalid":w?!0:void 0,onChange:s(S=>m(S.target.value),"onChange"),onBlur:s(()=>b(!0),"onBlur"),onKeyDown:s(S=>{S.key==="Enter"&&(S.preventDefault(),_())},"onKeyDown")}),w?(0,e.jsx)("span",{className:"block text-(length:--text-micro) text-bad",children:w}):null]}),(0,e.jsxs)("label",{className:"block space-y-1",children:[(0,e.jsx)("span",{className:"text-(length:--text-micro) font-medium text-ink-3",children:"Value"}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("input",{className:R(we,"pr-8",E&&"border-bad focus-visible:ring-bad/40"),type:C?"text":"password",value:N,readOnly:t==="store",spellCheck:!1,placeholder:t==="create"?"value":void 0,"aria-label":"Secret value","aria-invalid":E?!0:void 0,onChange:t==="create"?S=>p(S.target.value):void 0}),(0,e.jsx)("button",{type:"button",className:"absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-1 text-ink-3 hover:text-ink","aria-label":C?"Hide value":"Show value",onClick:s(()=>$(S=>!S),"onClick"),children:C?(0,e.jsx)(nt,{className:"h-3.5 w-3.5"}):(0,e.jsx)(rt,{className:"h-3.5 w-3.5"})})]}),E?(0,e.jsx)("span",{className:"block text-(length:--text-micro) text-bad",children:E}):null]}),D?(0,e.jsx)("p",{className:"text-(length:--text-micro) text-bad",children:D}):null,(0,e.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-0.5",children:[(0,e.jsx)(ie,{type:"button",variant:"ghost",size:"sm",onClick:y,disabled:z,children:"Cancel"}),(0,e.jsxs)(ie,{type:"button",size:"sm",onClick:s(()=>{_()},"onClick"),disabled:!T,children:[z?(0,e.jsx)(at,{className:"h-3.5 w-3.5 animate-spin"}):null,q]})]})]})}s(Ie,"SecretPopoverForm");function zt(t){return(0,e.jsx)(Ie,{mode:"create",...t})}s(zt,"CreateSecretPopover");function Vt(t){return(0,e.jsx)(Ie,{mode:"store",...t})}s(Vt,"ConvertToSecretPopover");var Tt=/(api[-_]?key|access[-_]?token|auth(?:_?token)?|authorization|bearer|secret|passwd|password|credential|jwt|private[-_]?key|cookie|connectionstring)/i,$t=[/^sk-[A-Za-z0-9-_]{16,}$/,/^gh[pousr]_[A-Za-z0-9]{20,}$/,/^github_pat_[A-Za-z0-9_]{20,}$/,/^xox[baprs]-[A-Za-z0-9-]{10,}$/,/^AKIA[0-9A-Z]{16}$/,/^AIza[0-9A-Za-z\-_]{20,}$/,/-----BEGIN (?:[A-Z ]+ )?PRIVATE KEY-----/,/^eyJ[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+$/];function Mt(t){return t.length<24||/\s/.test(t)||!/^[A-Za-z0-9+/=_\-.]+$/.test(t)?!1:[/[a-z]/.test(t),/[A-Z]/.test(t),/[0-9]/.test(t)].filter(Boolean).length>=2}s(Mt,"looksHighEntropy");function At(t,r){return r?Tt.test(t)||$t.some(h=>h.test(r))?!0:Mt(r):!1}s(At,"isSensitiveEnv");var Kt="w-full rounded-md border border-line px-2.5 py-1.5 bg-transparent outline-none text-sm font-mono placeholder:text-ink-3/40 focus-visible:ring-2 focus-visible:ring-focus/40",_e="min-w-0 flex-1 bg-transparent px-2 py-1.5 text-sm font-mono outline-none placeholder:text-ink-3/40";function Dt({row:t,isLast:r,secrets:h,userSecretDefinitions:c,recentlyUsedSecrets:y,disabled:f,nameIssue:j,showNameIssue:m,dirtyFields:N,onPatch:p,onRemove:C,onNameBlur:$,onNamePaste:z,onEnterInValueLast:K,onCreateSecret:D,onToast:v,focusRequest:i,onFocusConsumed:b}){const u=(0,o.useRef)(null),w=(0,o.useRef)(null),E=(0,o.useRef)(null),[T,_]=(0,o.useState)(null),[q,S]=(0,o.useState)(!1),[U,J]=(0,o.useState)(null),H=Me(t,h)??$e(t,c),L=t.source==="secret"?h.find(a=>a.id===t.secretId)??null:null,ne=(c?.length??0)>0,B=t.source==="text"&&!t.sensitiveDismissed&&At(t.name,t.textValue);(0,o.useEffect)(()=>{i&&(i==="name"?u.current?.focus():t.source==="text"?w.current?.focus():t.source==="secret"?E.current?.querySelector("[role=combobox]")?.focus():E.current?.querySelector("select,input")?.focus(),b())},[i,b,t.source]),(0,o.useEffect)(()=>{if(!U)return;const a=window.setTimeout(()=>J(null),5e3);return()=>window.clearTimeout(a)},[U]);function Z(a){if(a==="user_secret"){if(t.source==="user_secret")return;p({source:"user_secret",secretId:"",version:"latest"}),window.setTimeout(()=>E.current?.querySelector("select,input")?.focus(),0);return}const k=vt(t,a);switch(k.kind){case"noop":return;case"open-store":{const{name:F,value:Q}=k;window.setTimeout(()=>_({mode:"store",name:F,value:Q}),0);return}case"to-secret":p({source:"secret",userSecretKey:"",required:!0}),window.setTimeout(()=>{E.current?.querySelector("[role=combobox]")?.focus()},0);return;case"to-text":k.undoFrom&&J(k.undoFrom),p({source:"text",secretId:"",userSecretKey:"",required:!0,version:"latest"}),window.setTimeout(()=>w.current?.focus(),0);return}}s(Z,"switchSource");async function W(a,k){const F=await D(a,k);p({source:"secret",secretId:F.id,userSecretKey:"",required:!0,version:"latest",textValue:""}),v(`Secret ${F.name} created`),_(null)}s(W,"submitSecretPopover");function M(){const a=Ee(t.name)||"secret",{textValue:k}=t;window.setTimeout(()=>_({mode:"store",name:a,value:k}),0)}s(M,"openStoreAsSecret");const G=t.source==="text"?"Text value":t.source==="secret"?"Organization secret reference":"User secret reference",A=`${t.id}-name-error`,P=`${t.id}-health`,X=N.name||N.value,O=L?Math.max(0,L.latestVersion):0,Y=t.version==="latest"?"latest":`v${t.version}`,le=t.version!=="latest";return(0,e.jsxs)("div",{className:R("group/row grid grid-cols-(--gtc-13) items-start gap-x-1.5 gap-y-1 rounded-md px-1 py-1","@[40rem]/env:grid-cols-(--gtc-14) @[40rem]/env:items-center",X&&"bg-amber-500/[0.06] ring-1 ring-amber-500/20"),children:[(0,e.jsx)("div",{className:"col-start-1 row-start-1 min-w-0 @[40rem]/env:row-start-1 @[40rem]/env:self-start",children:(0,e.jsx)("input",{ref:u,className:R(Kt,N.name&&"border-amber-500/70 bg-amber-500/10 focus-visible:ring-amber-500/40",m&&j?.level==="error"&&"border-bad focus-visible:ring-bad/40",m&&j?.level==="warn"&&"border-amber-500 focus-visible:ring-amber-500/40"),placeholder:"KEY",value:t.name,spellCheck:!1,disabled:f,"aria-label":"Variable name","aria-invalid":m&&j?.level==="error"?!0:void 0,"aria-describedby":m&&j?A:void 0,onChange:s(a=>p({name:a.target.value}),"onChange"),onBlur:$,onPaste:s(a=>{t.name||z(a.clipboardData.getData("text"))&&a.preventDefault()},"onPaste"),onKeyDown:s(a=>{a.key==="Enter"&&(a.preventDefault(),t.source==="text"?w.current?.focus():E.current?.querySelector("[role=combobox],select,input")?.focus())},"onKeyDown")})}),(0,e.jsxs)("div",{className:"col-span-2 col-start-1 row-start-2 min-w-0 @[40rem]/env:col-span-1 @[40rem]/env:col-start-2 @[40rem]/env:row-start-1",children:[(0,e.jsxs)(ke,{open:T!==null,onOpenChange:s(a=>{a||_(null)},"onOpenChange"),children:[(0,e.jsx)(je,{asChild:!0,children:(0,e.jsxs)("div",{ref:E,className:R("relative flex items-stretch overflow-hidden rounded-md border border-line bg-transparent focus-within:ring-2 focus-within:ring-focus/40",N.value&&"border-amber-500/70 bg-amber-500/10 focus-within:ring-amber-500/40",f&&"opacity-60"),children:[(0,e.jsxs)(ye,{children:[(0,e.jsxs)(dt,{children:[(0,e.jsx)(ct,{asChild:!0,children:(0,e.jsx)(be,{asChild:!0,disabled:f,children:(0,e.jsxs)("button",{type:"button","aria-label":"Value source",className:"flex shrink-0 items-center gap-0.5 border-r border-line px-2 text-ink-3 hover:bg-bg-3/50 disabled:pointer-events-none",children:[t.source==="text"?(0,e.jsx)(Nt,{className:"size-3.5"}):t.source==="secret"?(0,e.jsx)(se,{className:"size-3.5"}):(0,e.jsx)(Te,{className:"size-3.5"}),(0,e.jsx)(Qe,{className:"size-3 opacity-60"})]})})}),(0,e.jsx)(ut,{side:"top",children:G})]}),(0,e.jsxs)(ge,{align:"start",className:"w-56",children:[(0,e.jsxs)(re,{className:"flex-col items-start gap-0.5",onSelect:s(()=>Z("text"),"onSelect"),children:[(0,e.jsx)("span",{className:"text-sm",children:"Text value"}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-ink-3",children:"Store the value inline as plain text."})]}),(0,e.jsxs)(re,{className:"flex-col items-start gap-0.5",onSelect:s(()=>Z("secret"),"onSelect"),children:[(0,e.jsx)("span",{className:"text-sm",children:"Organization secret"}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-ink-3",children:"Resolve a stored organization secret at run start."})]}),(0,e.jsxs)(re,{className:"flex-col items-start gap-0.5",onSelect:s(()=>Z("user_secret"),"onSelect"),children:[(0,e.jsx)("span",{className:"text-sm",children:"User secret"}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-ink-3",children:"Resolve the responsible user's own value at run start."})]})]})]}),t.source==="text"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("input",{ref:w,className:_e,placeholder:"value",value:t.textValue,type:B?"password":"text",spellCheck:!1,disabled:f,"aria-label":"Variable value",onChange:s(a=>p({textValue:a.target.value}),"onChange"),onKeyDown:s(a=>{a.key==="Enter"&&r&&(a.preventDefault(),K())},"onKeyDown")}),B?(0,e.jsxs)("div",{className:"flex shrink-0 items-stretch border-l border-line",children:[(0,e.jsxs)("button",{type:"button",onClick:M,disabled:f,className:"flex items-center gap-1 px-2 text-(length:--text-micro) text-amber-700 hover:bg-amber-500/10 dark:text-amber-400",title:"This value looks sensitive — store it as a secret",children:[(0,e.jsx)(ot,{className:"size-3.5"}),(0,e.jsx)("span",{className:"hidden @[30rem]/env:inline",children:"Store as secret"})]}),(0,e.jsx)("button",{type:"button",onClick:s(()=>p({sensitiveDismissed:!0}),"onClick"),disabled:f,"aria-label":"Dismiss sensitive-value suggestion",title:"Dismiss — keep this value as plain text",className:"flex items-center px-1.5 text-amber-700/60 hover:bg-amber-500/10 hover:text-amber-700 dark:text-amber-400/60 dark:hover:text-amber-400",children:(0,e.jsx)(Se,{className:"size-3"})})]}):null]}):t.source==="secret"?(0,e.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,e.jsx)(_t,{secretId:t.secretId,secrets:h,recentlyUsedSecrets:y,disabled:f,onSelect:s(a=>p({secretId:a,version:"latest"}),"onSelect"),onCreateNew:s(a=>_({mode:"create",name:Ee(a)||a.trim(),value:""}),"onCreateNew"),triggerClassName:R("rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0",L&&L.status==="active"&&"pr-24 has-[>svg]:!pr-24")}),L&&L.status==="active"?(0,e.jsxs)(ke,{open:q,onOpenChange:S,children:[(0,e.jsx)(je,{asChild:!0,children:(0,e.jsx)(ht,{selected:le,className:"absolute right-8 top-1/2 z-10 h-5 -translate-y-1/2 px-1.5",disabled:f,onClick:s(a=>{a.preventDefault(),a.stopPropagation(),S(k=>!k)},"onClick"),"aria-label":"Version",children:Y})}),(0,e.jsxs)(Ne,{align:"end",className:"w-44 p-1",role:"radiogroup","aria-label":"Secret version",children:[(0,e.jsxs)("button",{type:"button",role:"radio","aria-checked":t.version==="latest",onClick:s(()=>{p({version:"latest"}),S(!1)},"onClick"),className:R("flex w-full items-center justify-between rounded px-2 py-1.5 text-sm hover:bg-bg-3",t.version==="latest"&&"font-medium"),children:["latest ",(0,e.jsx)("span",{className:"text-(length:--text-micro) text-ink-3",children:"(recommended)"})]}),Array.from({length:O},(a,k)=>O-k).filter(a=>a>0).map(a=>(0,e.jsxs)("button",{type:"button",role:"radio","aria-checked":t.version===a,onClick:s(()=>{p({version:a}),S(!1)},"onClick"),className:R("flex w-full items-center rounded px-2 py-1.5 text-sm hover:bg-bg-3",t.version===a&&"font-medium text-amber-700 dark:text-amber-400"),children:["v",a]},a))]})]}):null]}):(0,e.jsxs)("div",{className:"grid min-w-0 flex-1 grid-cols-(--gtc-13)",children:[ne?(0,e.jsxs)("select",{"aria-label":"User secret",value:t.userSecretKey,disabled:f,onChange:s(a=>{const k=a.target.value,F=c?.find(Q=>Q.key===k);p({userSecretKey:k,...F&&!t.name.trim()?{name:F.key.toUpperCase()}:{}})},"onChange"),className:"min-w-0 bg-transparent px-2 py-1.5 text-sm font-mono outline-none disabled:pointer-events-none",children:[(0,e.jsx)("option",{value:"",children:"Select user secret..."}),t.userSecretKey&&!c?.some(a=>a.key===t.userSecretKey)?(0,e.jsxs)("option",{value:t.userSecretKey,children:["Unknown (",t.userSecretKey,")"]}):null,(c??[]).map(a=>(0,e.jsxs)("option",{value:a.key,children:[a.name,a.status!=="active"?` (${a.status})`:""]},a.id))]}):(0,e.jsx)("input",{className:_e,placeholder:"user-secret key",value:t.userSecretKey,spellCheck:!1,disabled:f,"aria-label":"User secret key",onChange:s(a=>p({userSecretKey:a.target.value}),"onChange")}),(0,e.jsxs)("select",{"aria-label":"Requirement",value:t.required?"required":"optional",disabled:f,onChange:s(a=>p({required:a.target.value==="required"}),"onChange"),className:"border-l border-line bg-transparent px-2 py-1.5 text-xs font-medium text-ink-3 outline-none disabled:pointer-events-none",children:[(0,e.jsx)("option",{value:"required",children:"Required"}),(0,e.jsx)("option",{value:"optional",children:"Optional"})]})]})]})}),(0,e.jsx)(Ne,{align:"start",className:"w-auto p-3",onInteractOutside:s(a=>{const k=a.detail.originalEvent.target;k&&E.current?.contains(k)&&a.preventDefault()},"onInteractOutside"),children:T?.mode==="store"?(0,e.jsx)(Vt,{initialName:T.name,initialValue:T.value,existingSecretNames:h.map(a=>a.name),onCancel:s(()=>_(null),"onCancel"),onSubmit:W}):T?.mode==="create"?(0,e.jsx)(zt,{initialName:T.name,initialValue:T.value,existingSecretNames:h.map(a=>a.name),onCancel:s(()=>_(null),"onCancel"),onSubmit:W}):null})]}),H?(0,e.jsx)("p",{id:P,role:"status",className:R("mt-0.5 text-(length:--text-micro)",H.level==="error"?"text-bad":"text-amber-600 dark:text-amber-400"),children:H.message}):null,U?(0,e.jsxs)("p",{className:"mt-0.5 inline-flex items-center gap-2 text-(length:--text-micro) text-ink-3",children:["Reverted to text —"," ",(0,e.jsx)("button",{type:"button",className:"font-medium text-ink underline underline-offset-2 hover:text-accent",onClick:s(()=>{p({source:"secret",secretId:U.secretId,version:U.version,textValue:""}),J(null)},"onClick"),children:"Undo"})]}):null]}),m&&j?(0,e.jsx)("p",{id:A,className:R("col-span-2 col-start-1 row-start-3 min-w-0 text-(length:--text-micro) @[40rem]/env:col-span-2 @[40rem]/env:row-start-2",j.level==="error"?"text-bad":"text-amber-600 dark:text-amber-400"),children:j.message}):null,(0,e.jsxs)("div",{className:"col-start-2 row-start-1 flex items-center justify-end gap-0.5 self-start @[40rem]/env:col-start-3 @[40rem]/env:self-center",children:[t.source==="text"&&!B&&(t.name.trim()||t.textValue)?(0,e.jsxs)(ye,{children:[(0,e.jsx)(be,{asChild:!0,disabled:f,children:(0,e.jsx)("button",{type:"button","aria-label":"More actions",className:"rounded p-1 text-ink-3 opacity-100 hover:bg-bg-3 hover:text-ink @[40rem]/env:opacity-0 @[40rem]/env:group-hover/row:opacity-100 @[40rem]/env:group-focus-within/row:opacity-100",children:(0,e.jsx)(st,{className:"size-4"})})}),(0,e.jsx)(ge,{align:"end",children:(0,e.jsx)(re,{onSelect:s(()=>{window.setTimeout(M,0)},"onSelect"),children:"Store as secret…"})})]}):null,(0,e.jsx)("button",{type:"button",onClick:C,disabled:f,"aria-label":`Remove ${t.name.trim()||"variable"}`,className:"rounded p-1 text-ink-3 opacity-100 hover:bg-bad/10 hover:text-bad @[40rem]/env:opacity-0 @[40rem]/env:group-hover/row:opacity-100 @[40rem]/env:group-focus-within/row:opacity-100",children:(0,e.jsx)(Se,{className:"size-4"})})]})]})}s(Dt,"EnvironmentVariableRow");var It=/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=(.*)$/;function qt(t){const r=t.indexOf(" #");return r>=0?t.slice(0,r):t}s(qt,"stripInlineComment");function Lt(t){const r=t.trim();if(r.length>=2){const h=r[0],c=r[r.length-1];if(h==='"'&&c==='"'||h==="'"&&c==="'")return r.slice(1,-1)}return qt(r).trim()}s(Lt,"unquote");function Pt(t){const r=[];for(const h of t.split(/\r?\n/)){const c=h.trim();if(!c||c.startsWith("#"))continue;const y=It.exec(c);if(!y)continue;const f=y[1],j=Lt(y[2]);r.push({key:f,value:j})}return r}s(Pt,"parseDotenv");var Ot=["WARDMOTE_"],Ft="Set the KEY to the env var name the process expects, for example GH_TOKEN. Choose a secret to resolve a stored value at run start. WARDMOTE_* variables are injected automatically.";function xe(t){if(!t||typeof t!="object")return[];const r=new Map;for(const[h,c]of Object.entries(t)){const y=h.trim();if(y)if(typeof c=="string")r.set(y,{type:"plain",value:c});else if(c?.type==="secret_ref"){const f=typeof c.secretId=="string"?c.secretId:"";if(!f)continue;r.set(y,{type:"secret_ref",secretId:f,version:typeof c.version=="number"?c.version:"latest"})}else if(c?.type==="user_secret_ref"){const f=typeof c.key=="string"?c.key.trim():"";if(!f)continue;r.set(y,{type:"user_secret_ref",key:f,version:typeof c.version=="number"?c.version:"latest",required:c.required!==!1})}else c?.type==="plain"?r.set(y,{type:"plain",value:typeof c.value=="string"?c.value:""}):r.set(y,{type:"plain",value:""})}return[...r.entries()].sort(([h],[c])=>h.localeCompare(c))}s(xe,"normalizedEnvEntries");function te(t){return JSON.stringify(xe(t))}s(te,"normalizedEnvKey");var me=3;function de(t){const r=t.slice(0,me).join(", ");return t.length>me?`${r} +${t.length-me} more`:r}s(de,"formatChangedNames");function Re(t){return t.map(r=>({...r}))}s(Re,"cloneRows");function Ut(t,r){return r?{name:t.name.trim()!==r.name.trim(),value:t.source!==r.source||t.textValue!==r.textValue||t.secretId!==r.secretId||t.userSecretKey!==r.userSecretKey||t.required!==r.required||t.version!==r.version}:{name:!!t.name.trim(),value:t.source!=="text"||!!t.textValue||!!t.secretId||t.version!=="latest"}}s(Ut,"rowDirtyFields");var bs=(0,o.forwardRef)(s(function({value:r,onChange:h,secrets:c,userSecretDefinitions:y,onCreateSecret:f,recentlyUsedSecrets:j,disabled:m,reservedPrefixes:N=Ot,footerHint:p,onDirtyChange:C,hideDraftActions:$=!1},z){const K=ft(),D=(0,o.useRef)(null),[v,i]=(0,o.useState)(()=>ce(r)),b=(0,o.useRef)(v),[u,w]=(0,o.useState)(()=>Re(v)),E=(0,o.useMemo)(()=>te(r),[]),T=(0,o.useRef)(E),_=(0,o.useRef)(E),q=(0,o.useRef)(null),[S,U]=(0,o.useState)(E),[J,H]=(0,o.useState)(()=>new Set(ce(r).map(n=>n.name.trim()).filter(Boolean))),[L,ne]=(0,o.useState)(null);(0,o.useEffect)(()=>{b.current=v},[v]);function B(n,l=b.current){T.current=n,U(n),w(Re(l))}s(B,"markCommitted");function Z(n){H(l=>{const d=new Set(l);for(const g of n){const x=g.name.trim();x&&d.add(x)}return d})}s(Z,"touchCommittedNames");function W(n){const l=ce(n);return i(l),Z(l),l}s(W,"adoptExternalValue"),(0,o.useEffect)(()=>{const n=te(r);if(n===_.current)return;_.current=n;const l=te(oe(b.current)),d=l!==T.current,g=q.current===n;if(g&&(q.current=null),!d){B(n,W(r));return}(g||l===n)&&(Z(b.current),B(n))},[r]);const M=(0,o.useMemo)(()=>oe(v),[v]),G=(0,o.useMemo)(()=>te(M),[M]),A=G!==S;(0,o.useEffect)(()=>{C?.(!m&&A)},[m,A,C]);const P=(0,o.useMemo)(()=>{const n=new Map(xe(oe(u)).map(([x,V])=>[x,JSON.stringify(V)])),l=new Map(xe(M).map(([x,V])=>[x,JSON.stringify(V)])),d=[],g=[];for(const[x,V]of l)n.has(x)?n.get(x)!==V&&g.push(x):d.push(x);return{added:d,changed:g,removed:[...n.keys()].filter(x=>!l.has(x))}},[u,M]),X=(0,o.useMemo)(()=>{const n=[];return P.added.length>0&&n.push(`New: ${de(P.added)}`),P.changed.length>0&&n.push(`Edited: ${de(P.changed)}`),P.removed.length>0&&n.push(`Removed: ${de(P.removed)}`),n.join(" · ")},[P]);(0,o.useEffect)(()=>{if(m||!A)return;function n(l){l.preventDefault(),l.returnValue=""}return s(n,"handleBeforeUnload"),window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[m,A]);const O=(0,o.useCallback)(()=>m||!A?null:(q.current=G,(0,kt.flushSync)(()=>{h(M)}),M??{}),[m,M,G,A,h]);(0,o.useImperativeHandle)(z,()=>({flushPendingDraft:O}),[O]),(0,o.useEffect)(()=>{const n=D.current?.closest("form");if(!n)return;function l(){O()}return s(l,"handleSubmit"),n.addEventListener("submit",l,!0),()=>n.removeEventListener("submit",l,!0)},[O]),(0,o.useEffect)(()=>{const n=D.current;if(!n)return;const l=n;function d(g){const x=g.target;if(!(x instanceof Element)||l.contains(x))return;const V=x.closest("button");if(!V||V.disabled)return;const I=`${V.getAttribute("aria-label")??""} ${V.textContent??""}`;(V.type==="submit"||/\b(save|create|update|test|import)\b/i.test(I))&&O()}return s(d,"handleDocumentClick"),document.addEventListener("click",d,!0),()=>document.removeEventListener("click",d,!0)},[O]);function Y(n){i(n)}s(Y,"updateDraft");function le(n,l){Y(v.map(d=>d.id===n?{...d,...l}:d))}s(le,"patchRow");function a(n){Y(v.filter(l=>l.id!==n))}s(a,"removeRow");function k(){const n=ue();i([...v,n]),ne({rowId:n.id,field:"name"})}s(k,"addRow");function F(n){const l=v.find(d=>d.id===n)?.name.trim();l&&H(d=>{if(d.has(l))return d;const g=new Set(d);return g.add(l),g})}s(F,"markTouched");function Q(n,l){const d=Pt(n);if(d.length===0)return!1;const g=v.filter(x=>x.id!==l).map(x=>({...x}));for(const{key:x,value:V}of d){const I=g.find(Be=>Be.name.trim()===x);I?(I.name=x,I.source="text",I.textValue=V,I.secretId="",I.sensitiveDismissed=!1,I.userSecretKey="",I.required=!0):g.push({...ue(),name:x,textValue:V})}return Y(g),K?.pushToast({title:`Imported ${d.length} variable${d.length===1?"":"s"}`,tone:"success"}),!0}s(Q,"bulkImport");function qe(n){const l=v.map(x=>({...x})),d=l[l.length-1];let g;d&&!d.name&&!d.textValue&&!d.secretId&&!d.userSecretKey?g=d:(g=ue(),l.push(g)),g.source="secret",g.secretId=n.id,g.version="latest",g.name||(g.name=yt(n.name)),Y(l)}s(qe,"bindRecentSecret");function Le(){A&&(q.current=G,h(M))}s(Le,"saveDraft");function Pe(){q.current=null,_.current=te(r);const n=W(r);B(_.current,n)}s(Pe,"revertDraft");const Oe=(0,o.useMemo)(()=>gt(v),[v]),pe=(0,o.useMemo)(()=>v.reduce((n,l)=>Me(l,c)||$e(l,y)?n+1:n,0),[v,c,y]),he=(0,o.useMemo)(()=>{const n=new Set(v.filter(l=>l.source==="secret"&&l.secretId).map(l=>l.secretId));return(j??[]).filter(l=>l.status==="active"&&!n.has(l.id)).slice(0,8)},[j,v]),Fe=v.length>0,ve=p===void 0?Ft:p,Ue=(0,o.useMemo)(()=>new Map(u.map(n=>[n.id,n])),[u]);return(0,e.jsx)(mt,{children:(0,e.jsxs)("div",{ref:D,className:"@container/env space-y-2",children:[pe>1?(0,e.jsxs)("p",{className:"inline-flex items-center gap-1.5 text-(length:--text-micro) font-medium text-amber-700 dark:text-amber-400",children:[(0,e.jsx)(tt,{className:"size-3.5"}),pe," bindings need attention"]}):null,Fe?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"hidden gap-x-1.5 @[40rem]/env:grid @[40rem]/env:grid-cols-(--gtc-14)",children:[(0,e.jsx)("span",{className:"text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"Name"}),(0,e.jsx)("span",{className:"text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"Value"}),(0,e.jsx)("span",{})]}),v.map((n,l)=>{const d=bt(n.name,Oe,N),g=J.has(n.name.trim());return(0,e.jsx)(Dt,{row:n,isLast:l===v.length-1,secrets:c,userSecretDefinitions:y,recentlyUsedSecrets:j,disabled:m,nameIssue:d,showNameIssue:g,dirtyFields:Ut(n,Ue.get(n.id)),onPatch:s(x=>le(n.id,x),"onPatch"),onRemove:s(()=>a(n.id),"onRemove"),onNameBlur:s(()=>F(n.id),"onNameBlur"),onNamePaste:s(x=>Q(x,n.id),"onNamePaste"),onEnterInValueLast:k,onCreateSecret:f,onToast:s(x=>K?.pushToast({title:x,tone:"success"}),"onToast"),focusRequest:L?.rowId===n.id?L.field:null,onFocusConsumed:s(()=>ne(null),"onFocusConsumed")},n.id)})]}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No environment variables"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-1",children:[(0,e.jsxs)("button",{type:"button",onClick:k,disabled:m,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-ink-3 transition-colors hover:bg-bg-3 hover:text-ink disabled:pointer-events-none disabled:opacity-50",children:[(0,e.jsx)(Ve,{className:"size-3.5"}),"Add variable"]}),he.length>0&&!m?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 text-(length:--text-micro) text-ink-3/70",children:[(0,e.jsx)(se,{className:"size-3"}),"Recently used:"]}),he.map(n=>(0,e.jsxs)("button",{type:"button",onClick:s(()=>qe(n),"onClick"),className:"inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 font-mono text-(length:--text-micro) text-ink-3 transition-colors hover:bg-bg-3/50 hover:text-ink",title:`Bind ${n.name}`,children:["+ ",n.name]},n.id))]}):null]}),A&&!m&&!$?(0,e.jsxs)("div",{role:"status",className:"mt-3 flex w-full flex-col gap-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-3 text-amber-950 shadow-sm dark:bg-amber-500/15 dark:text-amber-100 @[34rem]/env:flex-row @[34rem]/env:items-center @[34rem]/env:justify-between",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,e.jsx)("span",{className:"size-2 rounded-full bg-amber-500 shadow-(--shadow-extract-13)"}),(0,e.jsx)("span",{children:"Unsaved changes"})]}),X?(0,e.jsx)("p",{className:"min-w-0 truncate pl-4 text-xs text-amber-950/80 dark:text-amber-100/80",title:X,children:X}):null]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)(ie,{variant:"secondary",size:"sm",className:"h-9",type:"button",onClick:Pe,children:[(0,e.jsx)(it,{className:"size-4"}),"Revert"]}),(0,e.jsxs)(ie,{variant:"primary",size:"sm",className:"h-9",type:"button",onClick:Le,children:[(0,e.jsx)(lt,{className:"size-4"}),"Save"]})]})]}):null,ve?(0,e.jsx)("p",{className:"text-(length:--text-micro) text-ink-3/70",children:ve}):null,v.some(n=>n.source==="user_secret"&&n.userSecretKey)?(0,e.jsxs)("p",{className:"inline-flex items-start gap-1 text-(length:--text-micro) text-ink-3/70",children:[(0,e.jsx)(Te,{className:"mt-0.5 size-3 shrink-0"}),(0,e.jsx)("span",{children:"User secrets resolve from the user responsible for the run. Required bindings fail until that user sets their value under Secrets → My secrets."})]}):null]})})},"EnvironmentVariablesEditor"));export{zt as n,_t as r,bs as t};
|
|
1
|
+
var He=Object.defineProperty;var s=(t,r)=>He(t,"name",{value:r,configurable:!0});import{i as fe}from"./rolldown-runtime-ZpX3ckPj.js";import{l as R,na as Ze,t as ze,ta as Ge}from"./createLucideIcon-DJi9suAC.js";import{l as Ye}from"./dist-SzpVz8Pd.js";import{r as Je}from"./star-BZgQbzhV.js";import{i as re,p as be,r as ge,t as ye}from"./dropdown-menu-DEO3mF_E.js";import{a as We,i as Xe,n as je,r as Ne,t as ke}from"./popover-BhYHYj7q.js";import{t as Qe}from"./chevron-down-BCvxsWfI.js";import{t as et}from"./SearchableSelect-CIJ5K8ih.js";import{t as tt}from"./circle-alert-C-L4OsHh.js";import{t as st}from"./ellipsis-BTiLRUn4.js";import{t as nt}from"./eye-off-CVVA-EWh.js";import{t as rt}from"./eye-DRS7RbEp.js";import{t as se}from"./key-round-0RqEOB_C.js";import{r as at,t as ie}from"./button-CMwV3L1P.js";import{t as Ve}from"./plus-C6fnr28l.js";import{t as it}from"./rotate-ccw-CQEJ4ewP.js";import{t as lt}from"./save-CJ1Iqyew.js";import{t as ot}from"./shield-alert-Be9GuMrS.js";import{t as Te}from"./user-round-CGxsJ0K8.js";import{t as Se}from"./x-DRDFdlYE.js";import{i as ct,n as ut,r as mt,t as dt}from"./tooltip-B5WQ3lq5.js";import{t as xt}from"./badge-DuA2EgZC.js";import{n as ft}from"./ToastContext-DMdt9oTd.js";import{n as pt}from"./searchable-select-fvMNMcqm.js";import{t as ht}from"./chip-DsDe6yck.js";import{a as $e,c as vt,d as bt,f as oe,i as Me,l as ce,o as ue,r as gt,s as yt,u as Ee}from"./model-DidtFy-U.js";var Ae={name:"corner-up-left",size:24,node:[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]]};Ae.node;var jt=ze(Ae),Ke={name:"type",size:24,node:[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]]};Ke.node;var Nt=ze(Ke),kt=fe(Ye(),1),o=fe(Ze(),1),e=fe(Ge(),1),St="__secret_folder__:";function Et(t){return!t||t==="active"?null:(0,e.jsx)(xt,{variant:"outline",className:"ml-auto text-(length:--text-nano) font-normal text-ink-3",children:t})}s(Et,"statusBadge");function De(t){return t.split("/").filter(r=>r.length>0)}s(De,"splitSecretPath");function ae(t){return t.join("/")}s(ae,"pathKey");function ee(t){return t.length>0?`/${t.join("/")}`:"/"}s(ee,"pathLabel");function Ct(t,r){return t.length<r.length?!1:r.every((h,c)=>t[c]===h)}s(Ct,"pathStartsWith");function Ce(t){return`${St}${ae(t)}`}s(Ce,"folderValue");function wt(t,r,h){const c=r.length,y=new Map,f=[];for(const m of t){const N=De(m.name);if(Ct(N,r)){if(N.length>c+1){const p=N.slice(0,c+1),C=ae(p);if(!y.has(C)){const $=p[p.length-1]??"/",z=ee(p);y.set(C,{key:`folder-${C||"root"}`,value:Ce(p),label:$,title:z,searchText:z,kind:"folder",folderPath:C,pathHint:z})}continue}if(N.length===c+1||c===0&&N.length===0){const p=N.at(-1)??m.name;f.push({key:`browse-${m.id}`,value:m.id,label:p,title:m.name,searchText:`${m.key} ${m.name}`,secret:m,status:m.status,kind:"secret",pathHint:m.name,disabled:m.status!=="active"&&m.id!==h})}}}const j=[];if(r.length>0){const m=r.slice(0,-1);j.push({key:`folder-up-${ae(r)}`,value:Ce(m),label:"Up one folder",title:ee(m),searchText:ee(m),kind:"back",folderPath:ae(m),pathHint:ee(m)})}return j.push(...y.values(),...f),{id:"browse-secrets",label:r.length>0?ee(r):"Browse secrets",options:j}}s(wt,"buildFolderGroup");function _t({secretId:t,secrets:r,recentlyUsedSecrets:h,disabled:c,onSelect:y,onCreateNew:f,triggerClassName:j,disablePortal:m}){const[N,p]=(0,o.useState)(""),C=(0,o.useMemo)(()=>r.find(i=>i.id===t)??null,[r,t]),$=!!t&&!C,z=(0,o.useMemo)(()=>N?N.split("/"):[],[N]),K=(0,o.useMemo)(()=>r.some(i=>De(i.name).length>1),[r]),D=(0,o.useMemo)(()=>{const i=[];$&&i.push({id:"current-missing",label:"Current",options:[{key:`missing-${t}`,value:t,label:`Missing secret (${t.slice(0,8)}…)`,title:`Missing secret (${t})`,missing:!0,disabled:!0}]});const b=(h??[]).filter(u=>u.status==="active"&&u.id!==t);return b.length>0&&i.push({id:"recently-used",label:"Recently used",options:b.map(u=>({key:`recent-${u.id}`,value:u.id,label:u.name,title:u.name,searchText:`${u.key} ${u.name}`,secret:u,status:u.status,kind:"secret"}))}),i.push({id:"all-secrets",label:b.length>0?"All secrets":void 0,options:r.map(u=>({key:`all-${u.id}`,value:u.id,label:u.name,title:u.name,searchText:`${u.key} ${u.name}`,secret:u,status:u.status,kind:"secret",disabled:u.status!=="active"&&u.id!==t}))}),i},[$,h,t,r]),v=(0,o.useCallback)((i,b)=>{if(!K||pt(i))return b;const u=wt(r,z,t),w=b.filter(E=>E.id==="current-missing"||E.id==="recently-used");return u.options.length>0?[...w,u]:w},[z,K,t,r]);return(0,e.jsx)(et,{value:t||"",groups:D,onValueChange:s((i,b)=>{if(b.folderPath!==void 0)return p(b.folderPath),!1;p(""),y(i)},"onValueChange"),deriveGroups:v,disabled:c,disablePortal:m,placeholder:"Select secret…",searchPlaceholder:"Search secrets…",emptyMessage:"No matching secrets",triggerClassName:R("h-(--sz-34px) min-h-(--sz-34px) font-mono text-sm",$&&"border-bad text-bad",C&&C.status!=="active"&&"border-amber-500/60",j),renderValue:s(i=>{if(!i)return(0,e.jsx)("span",{className:"text-ink-3",children:"Select secret…"});if(i.missing)return(0,e.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5 text-bad",children:[(0,e.jsx)(se,{className:"size-3.5 shrink-0"}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:i.label})]});const b=i.status&&i.status!=="active";return(0,e.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",title:i.title,children:[(0,e.jsx)(se,{className:R("size-3.5 shrink-0",b?"text-amber-600":"text-ink-3")}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:i.label}),b?(0,e.jsxs)("span",{className:"text-amber-600",children:["(",i.status,")"]}):null]})},"renderValue"),renderOption:s((i,{selected:b})=>{if(i.kind==="folder"||i.kind==="back"){const u=i.kind==="back"?jt:Je;return(0,e.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",title:i.title??i.label,children:[(0,e.jsx)(u,{className:"size-3.5 shrink-0 text-ink-3"}),(0,e.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,e.jsx)("span",{className:R("truncate text-sm",b&&"font-medium"),children:i.label}),i.pathHint?(0,e.jsx)("span",{className:"truncate font-mono text-(length:--text-micro) text-ink-3",children:i.pathHint}):null]})]})}return(0,e.jsxs)("span",{className:R("flex min-w-0 flex-1 items-center gap-1.5",i.disabled&&"opacity-60"),title:i.title??i.label,children:[(0,e.jsx)(se,{className:"size-3.5 shrink-0 text-ink-3"}),(0,e.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,e.jsx)("span",{className:R("min-w-0 truncate font-mono text-sm",b&&"font-medium"),children:i.label}),i.pathHint&&i.pathHint!==i.label?(0,e.jsx)("span",{className:"truncate font-mono text-(length:--text-micro) text-ink-3",children:i.pathHint}):null]}),Et(i.status)]})},"renderOption"),createItem:f?{render:s(i=>(0,e.jsxs)("span",{className:"flex items-center gap-1.5 text-sm",children:[(0,e.jsx)(Ve,{className:"size-3.5 shrink-0"}),i.trim()?(0,e.jsxs)("span",{children:["Create secret ",(0,e.jsxs)("span",{className:"font-mono",children:["“",i.trim(),"”"]}),"…"]}):(0,e.jsx)("span",{children:"Create new secret…"})]}),"render"),onSelect:s(i=>f(i),"onSelect")}:void 0})}s(_t,"SecretPicker");var Rt=/^[a-z][a-z0-9_]*$/,we="w-full rounded-md border border-line px-2.5 py-1.5 bg-transparent outline-none text-sm font-mono placeholder:text-ink-3/40 focus-visible:ring-2 focus-visible:ring-focus/40";function Ie({mode:t,initialName:r,initialValue:h,existingSecretNames:c,onCancel:y,onSubmit:f}){const[j,m]=(0,o.useState)(r),[N,p]=(0,o.useState)(h),[C,$]=(0,o.useState)(!1),[z,K]=(0,o.useState)(!1),[D,v]=(0,o.useState)(null),[i,b]=(0,o.useState)(!1),u=j.trim(),w=u?Rt.test(u)?c?.some(S=>S.toLowerCase()===u)?"A secret with this name already exists":null:"Use lowercase letters, digits and _":i?"Name is required":null,E=N.length===0&&i?"Value is required":null,T=!z&&u.length>0&&N.length>0&&!w;async function _(){if(b(!0),!!T){K(!0),v(null);try{await f(u,N)}catch(S){v(S instanceof Error?S.message:"Failed to create secret"),K(!1)}}}s(_,"handleSubmit");const q=t==="create"?"Create & bind":"Store & bind";return(0,e.jsxs)("div",{className:"w-72 space-y-3",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(We,{className:"text-sm font-medium",children:t==="create"?"Create secret":"Store value as secret"}),t==="store"?(0,e.jsxs)(Xe,{className:"text-(length:--text-micro) text-ink-3",children:["Moves the typed value into an encrypted organization secret and binds"," ",(0,e.jsx)("span",{className:"font-mono",children:r||"this variable"})," to it."]}):null]}),(0,e.jsxs)("label",{className:"block space-y-1",children:[(0,e.jsx)("span",{className:"text-(length:--text-micro) font-medium text-ink-3",children:"Name"}),(0,e.jsx)("input",{className:R(we,w&&"border-bad focus-visible:ring-bad/40"),value:j,autoFocus:!0,spellCheck:!1,placeholder:"secret_name","aria-label":"Secret name","aria-invalid":w?!0:void 0,onChange:s(S=>m(S.target.value),"onChange"),onBlur:s(()=>b(!0),"onBlur"),onKeyDown:s(S=>{S.key==="Enter"&&(S.preventDefault(),_())},"onKeyDown")}),w?(0,e.jsx)("span",{className:"block text-(length:--text-micro) text-bad",children:w}):null]}),(0,e.jsxs)("label",{className:"block space-y-1",children:[(0,e.jsx)("span",{className:"text-(length:--text-micro) font-medium text-ink-3",children:"Value"}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("input",{className:R(we,"pr-8",E&&"border-bad focus-visible:ring-bad/40"),type:C?"text":"password",value:N,readOnly:t==="store",spellCheck:!1,placeholder:t==="create"?"value":void 0,"aria-label":"Secret value","aria-invalid":E?!0:void 0,onChange:t==="create"?S=>p(S.target.value):void 0}),(0,e.jsx)("button",{type:"button",className:"absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-1 text-ink-3 hover:text-ink","aria-label":C?"Hide value":"Show value",onClick:s(()=>$(S=>!S),"onClick"),children:C?(0,e.jsx)(nt,{className:"h-3.5 w-3.5"}):(0,e.jsx)(rt,{className:"h-3.5 w-3.5"})})]}),E?(0,e.jsx)("span",{className:"block text-(length:--text-micro) text-bad",children:E}):null]}),D?(0,e.jsx)("p",{className:"text-(length:--text-micro) text-bad",children:D}):null,(0,e.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-0.5",children:[(0,e.jsx)(ie,{type:"button",variant:"ghost",size:"sm",onClick:y,disabled:z,children:"Cancel"}),(0,e.jsxs)(ie,{type:"button",size:"sm",onClick:s(()=>{_()},"onClick"),disabled:!T,children:[z?(0,e.jsx)(at,{className:"h-3.5 w-3.5 animate-spin"}):null,q]})]})]})}s(Ie,"SecretPopoverForm");function zt(t){return(0,e.jsx)(Ie,{mode:"create",...t})}s(zt,"CreateSecretPopover");function Vt(t){return(0,e.jsx)(Ie,{mode:"store",...t})}s(Vt,"ConvertToSecretPopover");var Tt=/(api[-_]?key|access[-_]?token|auth(?:_?token)?|authorization|bearer|secret|passwd|password|credential|jwt|private[-_]?key|cookie|connectionstring)/i,$t=[/^sk-[A-Za-z0-9-_]{16,}$/,/^gh[pousr]_[A-Za-z0-9]{20,}$/,/^github_pat_[A-Za-z0-9_]{20,}$/,/^xox[baprs]-[A-Za-z0-9-]{10,}$/,/^AKIA[0-9A-Z]{16}$/,/^AIza[0-9A-Za-z\-_]{20,}$/,/-----BEGIN (?:[A-Z ]+ )?PRIVATE KEY-----/,/^eyJ[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+$/];function Mt(t){return t.length<24||/\s/.test(t)||!/^[A-Za-z0-9+/=_\-.]+$/.test(t)?!1:[/[a-z]/.test(t),/[A-Z]/.test(t),/[0-9]/.test(t)].filter(Boolean).length>=2}s(Mt,"looksHighEntropy");function At(t,r){return r?Tt.test(t)||$t.some(h=>h.test(r))?!0:Mt(r):!1}s(At,"isSensitiveEnv");var Kt="w-full rounded-md border border-line px-2.5 py-1.5 bg-transparent outline-none text-sm font-mono placeholder:text-ink-3/40 focus-visible:ring-2 focus-visible:ring-focus/40",_e="min-w-0 flex-1 bg-transparent px-2 py-1.5 text-sm font-mono outline-none placeholder:text-ink-3/40";function Dt({row:t,isLast:r,secrets:h,userSecretDefinitions:c,recentlyUsedSecrets:y,disabled:f,nameIssue:j,showNameIssue:m,dirtyFields:N,onPatch:p,onRemove:C,onNameBlur:$,onNamePaste:z,onEnterInValueLast:K,onCreateSecret:D,onToast:v,focusRequest:i,onFocusConsumed:b}){const u=(0,o.useRef)(null),w=(0,o.useRef)(null),E=(0,o.useRef)(null),[T,_]=(0,o.useState)(null),[q,S]=(0,o.useState)(!1),[U,J]=(0,o.useState)(null),H=Me(t,h)??$e(t,c),L=t.source==="secret"?h.find(a=>a.id===t.secretId)??null:null,ne=(c?.length??0)>0,B=t.source==="text"&&!t.sensitiveDismissed&&At(t.name,t.textValue);(0,o.useEffect)(()=>{i&&(i==="name"?u.current?.focus():t.source==="text"?w.current?.focus():t.source==="secret"?E.current?.querySelector("[role=combobox]")?.focus():E.current?.querySelector("select,input")?.focus(),b())},[i,b,t.source]),(0,o.useEffect)(()=>{if(!U)return;const a=window.setTimeout(()=>J(null),5e3);return()=>window.clearTimeout(a)},[U]);function Z(a){if(a==="user_secret"){if(t.source==="user_secret")return;p({source:"user_secret",secretId:"",version:"latest"}),window.setTimeout(()=>E.current?.querySelector("select,input")?.focus(),0);return}const k=vt(t,a);switch(k.kind){case"noop":return;case"open-store":{const{name:F,value:Q}=k;window.setTimeout(()=>_({mode:"store",name:F,value:Q}),0);return}case"to-secret":p({source:"secret",userSecretKey:"",required:!0}),window.setTimeout(()=>{E.current?.querySelector("[role=combobox]")?.focus()},0);return;case"to-text":k.undoFrom&&J(k.undoFrom),p({source:"text",secretId:"",userSecretKey:"",required:!0,version:"latest"}),window.setTimeout(()=>w.current?.focus(),0);return}}s(Z,"switchSource");async function W(a,k){const F=await D(a,k);p({source:"secret",secretId:F.id,userSecretKey:"",required:!0,version:"latest",textValue:""}),v(`Secret ${F.name} created`),_(null)}s(W,"submitSecretPopover");function M(){const a=Ee(t.name)||"secret",{textValue:k}=t;window.setTimeout(()=>_({mode:"store",name:a,value:k}),0)}s(M,"openStoreAsSecret");const G=t.source==="text"?"Text value":t.source==="secret"?"Organization secret reference":"User secret reference",A=`${t.id}-name-error`,P=`${t.id}-health`,X=N.name||N.value,O=L?Math.max(0,L.latestVersion):0,Y=t.version==="latest"?"latest":`v${t.version}`,le=t.version!=="latest";return(0,e.jsxs)("div",{className:R("group/row grid grid-cols-(--gtc-13) items-start gap-x-1.5 gap-y-1 rounded-md px-1 py-1","@[40rem]/env:grid-cols-(--gtc-14) @[40rem]/env:items-center",X&&"bg-amber-500/[0.06] ring-1 ring-amber-500/20"),children:[(0,e.jsx)("div",{className:"col-start-1 row-start-1 min-w-0 @[40rem]/env:row-start-1 @[40rem]/env:self-start",children:(0,e.jsx)("input",{ref:u,className:R(Kt,N.name&&"border-amber-500/70 bg-amber-500/10 focus-visible:ring-amber-500/40",m&&j?.level==="error"&&"border-bad focus-visible:ring-bad/40",m&&j?.level==="warn"&&"border-amber-500 focus-visible:ring-amber-500/40"),placeholder:"KEY",value:t.name,spellCheck:!1,disabled:f,"aria-label":"Variable name","aria-invalid":m&&j?.level==="error"?!0:void 0,"aria-describedby":m&&j?A:void 0,onChange:s(a=>p({name:a.target.value}),"onChange"),onBlur:$,onPaste:s(a=>{t.name||z(a.clipboardData.getData("text"))&&a.preventDefault()},"onPaste"),onKeyDown:s(a=>{a.key==="Enter"&&(a.preventDefault(),t.source==="text"?w.current?.focus():E.current?.querySelector("[role=combobox],select,input")?.focus())},"onKeyDown")})}),(0,e.jsxs)("div",{className:"col-span-2 col-start-1 row-start-2 min-w-0 @[40rem]/env:col-span-1 @[40rem]/env:col-start-2 @[40rem]/env:row-start-1",children:[(0,e.jsxs)(ke,{open:T!==null,onOpenChange:s(a=>{a||_(null)},"onOpenChange"),children:[(0,e.jsx)(je,{asChild:!0,children:(0,e.jsxs)("div",{ref:E,className:R("relative flex items-stretch overflow-hidden rounded-md border border-line bg-transparent focus-within:ring-2 focus-within:ring-focus/40",N.value&&"border-amber-500/70 bg-amber-500/10 focus-within:ring-amber-500/40",f&&"opacity-60"),children:[(0,e.jsxs)(ye,{children:[(0,e.jsxs)(dt,{children:[(0,e.jsx)(ct,{asChild:!0,children:(0,e.jsx)(be,{asChild:!0,disabled:f,children:(0,e.jsxs)("button",{type:"button","aria-label":"Value source",className:"flex shrink-0 items-center gap-0.5 border-r border-line px-2 text-ink-3 hover:bg-bg-3/50 disabled:pointer-events-none",children:[t.source==="text"?(0,e.jsx)(Nt,{className:"size-3.5"}):t.source==="secret"?(0,e.jsx)(se,{className:"size-3.5"}):(0,e.jsx)(Te,{className:"size-3.5"}),(0,e.jsx)(Qe,{className:"size-3 opacity-60"})]})})}),(0,e.jsx)(ut,{side:"top",children:G})]}),(0,e.jsxs)(ge,{align:"start",className:"w-56",children:[(0,e.jsxs)(re,{className:"flex-col items-start gap-0.5",onSelect:s(()=>Z("text"),"onSelect"),children:[(0,e.jsx)("span",{className:"text-sm",children:"Text value"}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-ink-3",children:"Store the value inline as plain text."})]}),(0,e.jsxs)(re,{className:"flex-col items-start gap-0.5",onSelect:s(()=>Z("secret"),"onSelect"),children:[(0,e.jsx)("span",{className:"text-sm",children:"Organization secret"}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-ink-3",children:"Resolve a stored organization secret at run start."})]}),(0,e.jsxs)(re,{className:"flex-col items-start gap-0.5",onSelect:s(()=>Z("user_secret"),"onSelect"),children:[(0,e.jsx)("span",{className:"text-sm",children:"User secret"}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-ink-3",children:"Resolve the responsible user's own value at run start."})]})]})]}),t.source==="text"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("input",{ref:w,className:_e,placeholder:"value",value:t.textValue,type:B?"password":"text",spellCheck:!1,disabled:f,"aria-label":"Variable value",onChange:s(a=>p({textValue:a.target.value}),"onChange"),onKeyDown:s(a=>{a.key==="Enter"&&r&&(a.preventDefault(),K())},"onKeyDown")}),B?(0,e.jsxs)("div",{className:"flex shrink-0 items-stretch border-l border-line",children:[(0,e.jsxs)("button",{type:"button",onClick:M,disabled:f,className:"flex items-center gap-1 px-2 text-(length:--text-micro) text-amber-700 hover:bg-amber-500/10 dark:text-amber-400",title:"This value looks sensitive — store it as a secret",children:[(0,e.jsx)(ot,{className:"size-3.5"}),(0,e.jsx)("span",{className:"hidden @[30rem]/env:inline",children:"Store as secret"})]}),(0,e.jsx)("button",{type:"button",onClick:s(()=>p({sensitiveDismissed:!0}),"onClick"),disabled:f,"aria-label":"Dismiss sensitive-value suggestion",title:"Dismiss — keep this value as plain text",className:"flex items-center px-1.5 text-amber-700/60 hover:bg-amber-500/10 hover:text-amber-700 dark:text-amber-400/60 dark:hover:text-amber-400",children:(0,e.jsx)(Se,{className:"size-3"})})]}):null]}):t.source==="secret"?(0,e.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,e.jsx)(_t,{secretId:t.secretId,secrets:h,recentlyUsedSecrets:y,disabled:f,onSelect:s(a=>p({secretId:a,version:"latest"}),"onSelect"),onCreateNew:s(a=>_({mode:"create",name:Ee(a)||a.trim(),value:""}),"onCreateNew"),triggerClassName:R("rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0",L&&L.status==="active"&&"pr-24 has-[>svg]:!pr-24")}),L&&L.status==="active"?(0,e.jsxs)(ke,{open:q,onOpenChange:S,children:[(0,e.jsx)(je,{asChild:!0,children:(0,e.jsx)(ht,{selected:le,className:"absolute right-8 top-1/2 z-10 h-5 -translate-y-1/2 px-1.5",disabled:f,onClick:s(a=>{a.preventDefault(),a.stopPropagation(),S(k=>!k)},"onClick"),"aria-label":"Version",children:Y})}),(0,e.jsxs)(Ne,{align:"end",className:"w-44 p-1",role:"radiogroup","aria-label":"Secret version",children:[(0,e.jsxs)("button",{type:"button",role:"radio","aria-checked":t.version==="latest",onClick:s(()=>{p({version:"latest"}),S(!1)},"onClick"),className:R("flex w-full items-center justify-between rounded px-2 py-1.5 text-sm hover:bg-bg-3",t.version==="latest"&&"font-medium"),children:["latest ",(0,e.jsx)("span",{className:"text-(length:--text-micro) text-ink-3",children:"(recommended)"})]}),Array.from({length:O},(a,k)=>O-k).filter(a=>a>0).map(a=>(0,e.jsxs)("button",{type:"button",role:"radio","aria-checked":t.version===a,onClick:s(()=>{p({version:a}),S(!1)},"onClick"),className:R("flex w-full items-center rounded px-2 py-1.5 text-sm hover:bg-bg-3",t.version===a&&"font-medium text-amber-700 dark:text-amber-400"),children:["v",a]},a))]})]}):null]}):(0,e.jsxs)("div",{className:"grid min-w-0 flex-1 grid-cols-(--gtc-13)",children:[ne?(0,e.jsxs)("select",{"aria-label":"User secret",value:t.userSecretKey,disabled:f,onChange:s(a=>{const k=a.target.value,F=c?.find(Q=>Q.key===k);p({userSecretKey:k,...F&&!t.name.trim()?{name:F.key.toUpperCase()}:{}})},"onChange"),className:"min-w-0 bg-transparent px-2 py-1.5 text-sm font-mono outline-none disabled:pointer-events-none",children:[(0,e.jsx)("option",{value:"",children:"Select user secret..."}),t.userSecretKey&&!c?.some(a=>a.key===t.userSecretKey)?(0,e.jsxs)("option",{value:t.userSecretKey,children:["Unknown (",t.userSecretKey,")"]}):null,(c??[]).map(a=>(0,e.jsxs)("option",{value:a.key,children:[a.name,a.status!=="active"?` (${a.status})`:""]},a.id))]}):(0,e.jsx)("input",{className:_e,placeholder:"user-secret key",value:t.userSecretKey,spellCheck:!1,disabled:f,"aria-label":"User secret key",onChange:s(a=>p({userSecretKey:a.target.value}),"onChange")}),(0,e.jsxs)("select",{"aria-label":"Requirement",value:t.required?"required":"optional",disabled:f,onChange:s(a=>p({required:a.target.value==="required"}),"onChange"),className:"border-l border-line bg-transparent px-2 py-1.5 text-xs font-medium text-ink-3 outline-none disabled:pointer-events-none",children:[(0,e.jsx)("option",{value:"required",children:"Required"}),(0,e.jsx)("option",{value:"optional",children:"Optional"})]})]})]})}),(0,e.jsx)(Ne,{align:"start",className:"w-auto p-3",onInteractOutside:s(a=>{const k=a.detail.originalEvent.target;k&&E.current?.contains(k)&&a.preventDefault()},"onInteractOutside"),children:T?.mode==="store"?(0,e.jsx)(Vt,{initialName:T.name,initialValue:T.value,existingSecretNames:h.map(a=>a.name),onCancel:s(()=>_(null),"onCancel"),onSubmit:W}):T?.mode==="create"?(0,e.jsx)(zt,{initialName:T.name,initialValue:T.value,existingSecretNames:h.map(a=>a.name),onCancel:s(()=>_(null),"onCancel"),onSubmit:W}):null})]}),H?(0,e.jsx)("p",{id:P,role:"status",className:R("mt-0.5 text-(length:--text-micro)",H.level==="error"?"text-bad":"text-amber-600 dark:text-amber-400"),children:H.message}):null,U?(0,e.jsxs)("p",{className:"mt-0.5 inline-flex items-center gap-2 text-(length:--text-micro) text-ink-3",children:["Reverted to text —"," ",(0,e.jsx)("button",{type:"button",className:"font-medium text-ink underline underline-offset-2 hover:text-accent",onClick:s(()=>{p({source:"secret",secretId:U.secretId,version:U.version,textValue:""}),J(null)},"onClick"),children:"Undo"})]}):null]}),m&&j?(0,e.jsx)("p",{id:A,className:R("col-span-2 col-start-1 row-start-3 min-w-0 text-(length:--text-micro) @[40rem]/env:col-span-2 @[40rem]/env:row-start-2",j.level==="error"?"text-bad":"text-amber-600 dark:text-amber-400"),children:j.message}):null,(0,e.jsxs)("div",{className:"col-start-2 row-start-1 flex items-center justify-end gap-0.5 self-start @[40rem]/env:col-start-3 @[40rem]/env:self-center",children:[t.source==="text"&&!B&&(t.name.trim()||t.textValue)?(0,e.jsxs)(ye,{children:[(0,e.jsx)(be,{asChild:!0,disabled:f,children:(0,e.jsx)("button",{type:"button","aria-label":"More actions",className:"rounded p-1 text-ink-3 opacity-100 hover:bg-bg-3 hover:text-ink @[40rem]/env:opacity-0 @[40rem]/env:group-hover/row:opacity-100 @[40rem]/env:group-focus-within/row:opacity-100",children:(0,e.jsx)(st,{className:"size-4"})})}),(0,e.jsx)(ge,{align:"end",children:(0,e.jsx)(re,{onSelect:s(()=>{window.setTimeout(M,0)},"onSelect"),children:"Store as secret…"})})]}):null,(0,e.jsx)("button",{type:"button",onClick:C,disabled:f,"aria-label":`Remove ${t.name.trim()||"variable"}`,className:"rounded p-1 text-ink-3 opacity-100 hover:bg-bad/10 hover:text-bad @[40rem]/env:opacity-0 @[40rem]/env:group-hover/row:opacity-100 @[40rem]/env:group-focus-within/row:opacity-100",children:(0,e.jsx)(Se,{className:"size-4"})})]})]})}s(Dt,"EnvironmentVariableRow");var It=/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=(.*)$/;function qt(t){const r=t.indexOf(" #");return r>=0?t.slice(0,r):t}s(qt,"stripInlineComment");function Lt(t){const r=t.trim();if(r.length>=2){const h=r[0],c=r[r.length-1];if(h==='"'&&c==='"'||h==="'"&&c==="'")return r.slice(1,-1)}return qt(r).trim()}s(Lt,"unquote");function Pt(t){const r=[];for(const h of t.split(/\r?\n/)){const c=h.trim();if(!c||c.startsWith("#"))continue;const y=It.exec(c);if(!y)continue;const f=y[1],j=Lt(y[2]);r.push({key:f,value:j})}return r}s(Pt,"parseDotenv");var Ot=["WARDMOTE_"],Ft="Set the KEY to the env var name the process expects, for example GH_TOKEN. Choose a secret to resolve a stored value at run start. WARDMOTE_* variables are injected automatically.";function xe(t){if(!t||typeof t!="object")return[];const r=new Map;for(const[h,c]of Object.entries(t)){const y=h.trim();if(y)if(typeof c=="string")r.set(y,{type:"plain",value:c});else if(c?.type==="secret_ref"){const f=typeof c.secretId=="string"?c.secretId:"";if(!f)continue;r.set(y,{type:"secret_ref",secretId:f,version:typeof c.version=="number"?c.version:"latest"})}else if(c?.type==="user_secret_ref"){const f=typeof c.key=="string"?c.key.trim():"";if(!f)continue;r.set(y,{type:"user_secret_ref",key:f,version:typeof c.version=="number"?c.version:"latest",required:c.required!==!1})}else c?.type==="plain"?r.set(y,{type:"plain",value:typeof c.value=="string"?c.value:""}):r.set(y,{type:"plain",value:""})}return[...r.entries()].sort(([h],[c])=>h.localeCompare(c))}s(xe,"normalizedEnvEntries");function te(t){return JSON.stringify(xe(t))}s(te,"normalizedEnvKey");var me=3;function de(t){const r=t.slice(0,me).join(", ");return t.length>me?`${r} +${t.length-me} more`:r}s(de,"formatChangedNames");function Re(t){return t.map(r=>({...r}))}s(Re,"cloneRows");function Ut(t,r){return r?{name:t.name.trim()!==r.name.trim(),value:t.source!==r.source||t.textValue!==r.textValue||t.secretId!==r.secretId||t.userSecretKey!==r.userSecretKey||t.required!==r.required||t.version!==r.version}:{name:!!t.name.trim(),value:t.source!=="text"||!!t.textValue||!!t.secretId||t.version!=="latest"}}s(Ut,"rowDirtyFields");var bs=(0,o.forwardRef)(s(function({value:r,onChange:h,secrets:c,userSecretDefinitions:y,onCreateSecret:f,recentlyUsedSecrets:j,disabled:m,reservedPrefixes:N=Ot,footerHint:p,onDirtyChange:C,hideDraftActions:$=!1},z){const K=ft(),D=(0,o.useRef)(null),[v,i]=(0,o.useState)(()=>ce(r)),b=(0,o.useRef)(v),[u,w]=(0,o.useState)(()=>Re(v)),E=(0,o.useMemo)(()=>te(r),[]),T=(0,o.useRef)(E),_=(0,o.useRef)(E),q=(0,o.useRef)(null),[S,U]=(0,o.useState)(E),[J,H]=(0,o.useState)(()=>new Set(ce(r).map(n=>n.name.trim()).filter(Boolean))),[L,ne]=(0,o.useState)(null);(0,o.useEffect)(()=>{b.current=v},[v]);function B(n,l=b.current){T.current=n,U(n),w(Re(l))}s(B,"markCommitted");function Z(n){H(l=>{const d=new Set(l);for(const g of n){const x=g.name.trim();x&&d.add(x)}return d})}s(Z,"touchCommittedNames");function W(n){const l=ce(n);return i(l),Z(l),l}s(W,"adoptExternalValue"),(0,o.useEffect)(()=>{const n=te(r);if(n===_.current)return;_.current=n;const l=te(oe(b.current)),d=l!==T.current,g=q.current===n;if(g&&(q.current=null),!d){B(n,W(r));return}(g||l===n)&&(Z(b.current),B(n))},[r]);const M=(0,o.useMemo)(()=>oe(v),[v]),G=(0,o.useMemo)(()=>te(M),[M]),A=G!==S;(0,o.useEffect)(()=>{C?.(!m&&A)},[m,A,C]);const P=(0,o.useMemo)(()=>{const n=new Map(xe(oe(u)).map(([x,V])=>[x,JSON.stringify(V)])),l=new Map(xe(M).map(([x,V])=>[x,JSON.stringify(V)])),d=[],g=[];for(const[x,V]of l)n.has(x)?n.get(x)!==V&&g.push(x):d.push(x);return{added:d,changed:g,removed:[...n.keys()].filter(x=>!l.has(x))}},[u,M]),X=(0,o.useMemo)(()=>{const n=[];return P.added.length>0&&n.push(`New: ${de(P.added)}`),P.changed.length>0&&n.push(`Edited: ${de(P.changed)}`),P.removed.length>0&&n.push(`Removed: ${de(P.removed)}`),n.join(" · ")},[P]);(0,o.useEffect)(()=>{if(m||!A)return;function n(l){l.preventDefault(),l.returnValue=""}return s(n,"handleBeforeUnload"),window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[m,A]);const O=(0,o.useCallback)(()=>m||!A?null:(q.current=G,(0,kt.flushSync)(()=>{h(M)}),M??{}),[m,M,G,A,h]);(0,o.useImperativeHandle)(z,()=>({flushPendingDraft:O}),[O]),(0,o.useEffect)(()=>{const n=D.current?.closest("form");if(!n)return;function l(){O()}return s(l,"handleSubmit"),n.addEventListener("submit",l,!0),()=>n.removeEventListener("submit",l,!0)},[O]),(0,o.useEffect)(()=>{const n=D.current;if(!n)return;const l=n;function d(g){const x=g.target;if(!(x instanceof Element)||l.contains(x))return;const V=x.closest("button");if(!V||V.disabled)return;const I=`${V.getAttribute("aria-label")??""} ${V.textContent??""}`;(V.type==="submit"||/\b(save|create|update|test|import)\b/i.test(I))&&O()}return s(d,"handleDocumentClick"),document.addEventListener("click",d,!0),()=>document.removeEventListener("click",d,!0)},[O]);function Y(n){i(n)}s(Y,"updateDraft");function le(n,l){Y(v.map(d=>d.id===n?{...d,...l}:d))}s(le,"patchRow");function a(n){Y(v.filter(l=>l.id!==n))}s(a,"removeRow");function k(){const n=ue();i([...v,n]),ne({rowId:n.id,field:"name"})}s(k,"addRow");function F(n){const l=v.find(d=>d.id===n)?.name.trim();l&&H(d=>{if(d.has(l))return d;const g=new Set(d);return g.add(l),g})}s(F,"markTouched");function Q(n,l){const d=Pt(n);if(d.length===0)return!1;const g=v.filter(x=>x.id!==l).map(x=>({...x}));for(const{key:x,value:V}of d){const I=g.find(Be=>Be.name.trim()===x);I?(I.name=x,I.source="text",I.textValue=V,I.secretId="",I.sensitiveDismissed=!1,I.userSecretKey="",I.required=!0):g.push({...ue(),name:x,textValue:V})}return Y(g),K?.pushToast({title:`Imported ${d.length} variable${d.length===1?"":"s"}`,tone:"success"}),!0}s(Q,"bulkImport");function qe(n){const l=v.map(x=>({...x})),d=l[l.length-1];let g;d&&!d.name&&!d.textValue&&!d.secretId&&!d.userSecretKey?g=d:(g=ue(),l.push(g)),g.source="secret",g.secretId=n.id,g.version="latest",g.name||(g.name=yt(n.name)),Y(l)}s(qe,"bindRecentSecret");function Le(){A&&(q.current=G,h(M))}s(Le,"saveDraft");function Pe(){q.current=null,_.current=te(r);const n=W(r);B(_.current,n)}s(Pe,"revertDraft");const Oe=(0,o.useMemo)(()=>gt(v),[v]),pe=(0,o.useMemo)(()=>v.reduce((n,l)=>Me(l,c)||$e(l,y)?n+1:n,0),[v,c,y]),he=(0,o.useMemo)(()=>{const n=new Set(v.filter(l=>l.source==="secret"&&l.secretId).map(l=>l.secretId));return(j??[]).filter(l=>l.status==="active"&&!n.has(l.id)).slice(0,8)},[j,v]),Fe=v.length>0,ve=p===void 0?Ft:p,Ue=(0,o.useMemo)(()=>new Map(u.map(n=>[n.id,n])),[u]);return(0,e.jsx)(mt,{children:(0,e.jsxs)("div",{ref:D,className:"@container/env space-y-2",children:[pe>1?(0,e.jsxs)("p",{className:"inline-flex items-center gap-1.5 text-(length:--text-micro) font-medium text-amber-700 dark:text-amber-400",children:[(0,e.jsx)(tt,{className:"size-3.5"}),pe," bindings need attention"]}):null,Fe?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"hidden gap-x-1.5 @[40rem]/env:grid @[40rem]/env:grid-cols-(--gtc-14)",children:[(0,e.jsx)("span",{className:"text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"Name"}),(0,e.jsx)("span",{className:"text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"Value"}),(0,e.jsx)("span",{})]}),v.map((n,l)=>{const d=bt(n.name,Oe,N),g=J.has(n.name.trim());return(0,e.jsx)(Dt,{row:n,isLast:l===v.length-1,secrets:c,userSecretDefinitions:y,recentlyUsedSecrets:j,disabled:m,nameIssue:d,showNameIssue:g,dirtyFields:Ut(n,Ue.get(n.id)),onPatch:s(x=>le(n.id,x),"onPatch"),onRemove:s(()=>a(n.id),"onRemove"),onNameBlur:s(()=>F(n.id),"onNameBlur"),onNamePaste:s(x=>Q(x,n.id),"onNamePaste"),onEnterInValueLast:k,onCreateSecret:f,onToast:s(x=>K?.pushToast({title:x,tone:"success"}),"onToast"),focusRequest:L?.rowId===n.id?L.field:null,onFocusConsumed:s(()=>ne(null),"onFocusConsumed")},n.id)})]}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No environment variables"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-1",children:[(0,e.jsxs)("button",{type:"button",onClick:k,disabled:m,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-ink-3 transition-colors hover:bg-bg-3 hover:text-ink disabled:pointer-events-none disabled:opacity-50",children:[(0,e.jsx)(Ve,{className:"size-3.5"}),"Add variable"]}),he.length>0&&!m?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 text-(length:--text-micro) text-ink-3/70",children:[(0,e.jsx)(se,{className:"size-3"}),"Recently used:"]}),he.map(n=>(0,e.jsxs)("button",{type:"button",onClick:s(()=>qe(n),"onClick"),className:"inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 font-mono text-(length:--text-micro) text-ink-3 transition-colors hover:bg-bg-3/50 hover:text-ink",title:`Bind ${n.name}`,children:["+ ",n.name]},n.id))]}):null]}),A&&!m&&!$?(0,e.jsxs)("div",{role:"status",className:"mt-3 flex w-full flex-col gap-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-3 text-amber-950 shadow-sm dark:bg-amber-500/15 dark:text-amber-100 @[34rem]/env:flex-row @[34rem]/env:items-center @[34rem]/env:justify-between",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,e.jsx)("span",{className:"size-2 rounded-full bg-amber-500 shadow-(--shadow-extract-13)"}),(0,e.jsx)("span",{children:"Unsaved changes"})]}),X?(0,e.jsx)("p",{className:"min-w-0 truncate pl-4 text-xs text-amber-950/80 dark:text-amber-100/80",title:X,children:X}):null]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)(ie,{variant:"secondary",size:"sm",className:"h-9",type:"button",onClick:Pe,children:[(0,e.jsx)(it,{className:"size-4"}),"Revert"]}),(0,e.jsxs)(ie,{variant:"primary",size:"sm",className:"h-9",type:"button",onClick:Le,children:[(0,e.jsx)(lt,{className:"size-4"}),"Save"]})]})]}):null,ve?(0,e.jsx)("p",{className:"text-(length:--text-micro) text-ink-3/70",children:ve}):null,v.some(n=>n.source==="user_secret"&&n.userSecretKey)?(0,e.jsxs)("p",{className:"inline-flex items-start gap-1 text-(length:--text-micro) text-ink-3/70",children:[(0,e.jsx)(Te,{className:"mt-0.5 size-3 shrink-0"}),(0,e.jsx)("span",{children:"User secrets resolve from the user responsible for the run. Required bindings fail until that user sets their value under Secrets → My secrets."})]}):null]})})},"EnvironmentVariablesEditor"));export{zt as n,_t as r,bs as t};
|