@tickernelz/wardmote-ui 2026.1118.1 → 2026.1118.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/assets/{AdapterManager-1binbhYj.js → AdapterManager-DvntZ2AW.js} +1 -1
  2. package/dist/assets/{AdvancedToolsRoute-DUyXR4Xj.js → AdvancedToolsRoute-CUW8D9Ux.js} +1 -1
  3. package/dist/assets/{AgentActionButtons-DSmnGirw.js → AgentActionButtons-CQLGCtfu.js} +1 -1
  4. package/dist/assets/{AgentChat-Dj952aW1.js → AgentChat-DCwwZA2b.js} +1 -1
  5. package/dist/assets/{AgentChats-Fv5j4CM9.js → AgentChats-DMMLdo-o.js} +1 -1
  6. package/dist/assets/{AgentDetail-CffT38lI.js → AgentDetail-BMVWOVp-.js} +1 -1
  7. package/dist/assets/{AgentTodoCard-De5ZJbUa.js → AgentTodoCard-C4BfJg4x.js} +1 -1
  8. package/dist/assets/{Agents-CDDoQ4Ds.js → Agents-C0IDC6KD.js} +3 -3
  9. package/dist/assets/{AppDetail-DnTOxWEY.js → AppDetail-DzEGsx94.js} +1 -1
  10. package/dist/assets/{AppNotConnected-CgnmB3mH.js → AppNotConnected-BVL32B49.js} +1 -1
  11. package/dist/assets/{ApprovalCard-D6X8gzHU.js → ApprovalCard-DCQ49PuW.js} +1 -1
  12. package/dist/assets/{ApprovalDetail-CWxiqPs6.js → ApprovalDetail-B0J70llD.js} +1 -1
  13. package/dist/assets/{ApprovalPayload-DFsO21LC.js → ApprovalPayload-8lqBw-XQ.js} +1 -1
  14. package/dist/assets/{Approvals-BW3osPe0.js → Approvals-BkiVjx0M.js} +1 -1
  15. package/dist/assets/{AppsReview-4g3PeYWn.js → AppsReview-CeXp22cE.js} +1 -1
  16. package/dist/assets/{ArtifactCard-BoIqK207.js → ArtifactCard-BV82tDLI.js} +1 -1
  17. package/dist/assets/{Artifacts-DDdlgUkk.js → Artifacts-CL5ZmZ3m.js} +1 -1
  18. package/dist/assets/{AssistantConnection-B7yxIifb.js → AssistantConnection-C5rmoEsm.js} +1 -1
  19. package/dist/assets/{AttentionInteractionResolver-BdcCqDXe.js → AttentionInteractionResolver-DxZpuIIF.js} +1 -1
  20. package/dist/assets/{AuditHub-CI0zjHie.js → AuditHub-DDPFGvHG.js} +1 -1
  21. package/dist/assets/{BoardChat--69z_C0h.js → BoardChat-DlaNGzcQ.js} +1 -1
  22. package/dist/assets/{BootstrapSetupUxLab-UIxdNUcO.js → BootstrapSetupUxLab-B2tOIzXd.js} +1 -1
  23. package/dist/assets/{Browse-VPYhJopu.js → Browse-xEc9mGl7.js} +1 -1
  24. package/dist/assets/{BudgetPolicyCard-45TwMzp3.js → BudgetPolicyCard-Ccr3EX5M.js} +1 -1
  25. package/dist/assets/{CaseDetail-CRN2rF4k.js → CaseDetail-CvMk_M-F.js} +1 -1
  26. package/dist/assets/{Cases-CFqnLAMq.js → Cases-H1Y4Oipe.js} +1 -1
  27. package/dist/assets/{ChatEndpointDetail-BTYAtutu.js → ChatEndpointDetail-CjDVQWl8.js} +1 -1
  28. package/dist/assets/{ChatEndpointSetup-CzrgHmvH.js → ChatEndpointSetup-BfohtKVM.js} +1 -1
  29. package/dist/assets/{Companies-C-U5WI6o.js → Companies-C4ObCu9j.js} +1 -1
  30. package/dist/assets/{CompanyAccess-DLgvUIoB.js → CompanyAccess-J5Vwnko2.js} +1 -1
  31. package/dist/assets/{CompanyActivity-8CeynedM.js → CompanyActivity-B7-kMNmz.js} +1 -1
  32. package/dist/assets/{CompanyConnections-BjMmsqei.js → CompanyConnections-D2N6UWXk.js} +1 -1
  33. package/dist/assets/{CompanyEnvironments-D6p-TNkv.js → CompanyEnvironments-ChSu4gxW.js} +1 -1
  34. package/dist/assets/{CompanyExport-Dw0QDMvs.js → CompanyExport-B_opHRSJ.js} +1 -1
  35. package/dist/assets/{CompanyImport-OSi3fM2l.js → CompanyImport-DZAMEBBy.js} +1 -1
  36. package/dist/assets/{CompanySettings-B-aPUQpY.js → CompanySettings-Rz8cwgKC.js} +1 -1
  37. package/dist/assets/{CompanySettingsPluginPage-Kp7iOUP1.js → CompanySettingsPluginPage-CM-ViPwj.js} +1 -1
  38. package/dist/assets/{CompanySkills-HZqJ5DZ8.js → CompanySkills-BnwPuZze.js} +1 -1
  39. package/dist/assets/{ConfigureBuiltInAgentModal-DL3wv3Mb.js → ConfigureBuiltInAgentModal-BAfoTveX.js} +1 -1
  40. package/dist/assets/{CopyableGatewayUrl-BLjhj10P.js → CopyableGatewayUrl-D90Bjxj0.js} +1 -1
  41. package/dist/assets/{Dashboard-DTmjsaEr.js → Dashboard-DepIxrje.js} +1 -1
  42. package/dist/assets/{DecisionDateChips-Br5r2jWZ.js → DecisionDateChips-89KkV4mo.js} +1 -1
  43. package/dist/assets/{DecisionQueuePage-zWDMjHf9.js → DecisionQueuePage-nU9qXzln.js} +1 -1
  44. package/dist/assets/{DesignGuide-BsH97scx.js → DesignGuide-40TixHZ-.js} +1 -1
  45. package/dist/assets/{EmailEndpointSetup-C7PhFwBy.js → EmailEndpointSetup-D7-8f1XV.js} +1 -1
  46. package/dist/assets/{ExecutionWorkspaceDetail-CTDvazWh.js → ExecutionWorkspaceDetail-CnUD3jLO.js} +1 -1
  47. package/dist/assets/{GatewayDetail-BtpnGGIB.js → GatewayDetail-Bg7GU-1a.js} +1 -1
  48. package/dist/assets/{GatewaysList-DrRfNyqk.js → GatewaysList-4vvZCBkY.js} +1 -1
  49. package/dist/assets/{GoalDetail-D5QqhxMg.js → GoalDetail-h7WsjaOO.js} +1 -1
  50. package/dist/assets/{GoalTree-CDexmAKW.js → GoalTree-yPtfejUx.js} +1 -1
  51. package/dist/assets/{Goals-CZinws4s.js → Goals-DOi3E4DX.js} +1 -1
  52. package/dist/assets/{ImageGalleryModal-VT9I4D2p.js → ImageGalleryModal-D_VQgcBt.js} +1 -1
  53. package/dist/assets/{Inbox-BiE243MO.js → Inbox-COKxRKhR.js} +1 -1
  54. package/dist/assets/{InstanceAdvanced-D_iqUmgn.js → InstanceAdvanced-DlMlwZbU.js} +1 -1
  55. package/dist/assets/{InviteLanding-LR84Xv76.js → InviteLanding-BGvJMHKw.js} +1 -1
  56. package/dist/assets/{IssueChatLongThreadPerf-BHdYa83T.js → IssueChatLongThreadPerf-C3U2FZKJ.js} +1 -1
  57. package/dist/assets/{IssueChatThread-Cno8fLc-.js → IssueChatThread-CDKaIB6v.js} +1 -1
  58. package/dist/assets/{IssueDetail-BWZWLO4k.js → IssueDetail-BCwHANTn.js} +1 -1
  59. package/dist/assets/{IssueOutputSection-BuwP0RQx.js → IssueOutputSection-BzXRmoV7.js} +1 -1
  60. package/dist/assets/{IssueRecoveryActionCard-O4GRNsPc.js → IssueRecoveryActionCard-BYtbaP-M.js} +1 -1
  61. package/dist/assets/{IssueReferencePill-EbOs3MtQ.js → IssueReferencePill-BT7NBEy_.js} +1 -1
  62. package/dist/assets/{IssueThreadInteractionCard-BUIzNywc.js → IssueThreadInteractionCard-Btd0rZ23.js} +1 -1
  63. package/dist/assets/{Issues-mVYaoqsX.js → Issues-XKf7zemQ.js} +1 -1
  64. package/dist/assets/{LiveNowTodoLine-DP95vmnd.js → LiveNowTodoLine-CoL6ZNuK.js} +1 -1
  65. package/dist/assets/{ManagedAiConnectionDetails-ZByBvcqo.js → ManagedAiConnectionDetails-CebBi-Tw.js} +1 -1
  66. package/dist/assets/{McpConnect-D42jtK1S.js → McpConnect-ByorZN7G.js} +1 -1
  67. package/dist/assets/{MembershipAction-Df2Qlkdz.js → MembershipAction-De0MBfgb.js} +1 -1
  68. package/dist/assets/{ModelsAndProviders-BzUob8BB.js → ModelsAndProviders-BqM4UJc7.js} +1 -1
  69. package/dist/assets/{NewAgent-BywRvCR0.js → NewAgent-pMTQYNxn.js} +1 -1
  70. package/dist/assets/{PipelineSettings-DFjxoW4i.js → PipelineSettings-C2k3BzLQ.js} +1 -1
  71. package/dist/assets/{Pipelines-CSW-En3n.js → Pipelines-Cr6Xs32p.js} +1 -1
  72. package/dist/assets/{PixelsOffice-B2b8M6LM.js → PixelsOffice-Dfd4XKSj.js} +1 -1
  73. package/dist/assets/{PluginPage-CfSIAMQa.js → PluginPage-fPlWyFSc.js} +1 -1
  74. package/dist/assets/{PluginSettings-TewUkGUA.js → PluginSettings-X_VHvvo5.js} +1 -1
  75. package/dist/assets/{ProfileDetailRoute-CCbLcj8f.js → ProfileDetailRoute-PAsWmN-1.js} +1 -1
  76. package/dist/assets/{ProfileSettings-D1D_hKPu.js → ProfileSettings-BACxlGZS.js} +1 -1
  77. package/dist/assets/{ProfileWizardRoute-BzFGrQkr.js → ProfileWizardRoute-Dbq0n7If.js} +1 -1
  78. package/dist/assets/{ProjectDetail-CEjUARCN.js → ProjectDetail-DOJZUIWu.js} +1 -1
  79. package/dist/assets/{ProjectWorkspaceDetail-7fFllUMH.js → ProjectWorkspaceDetail-ZNnaHnuA.js} +1 -1
  80. package/dist/assets/{ProjectWorkspacesContent-S4UUfVU1.js → ProjectWorkspacesContent-DrWfnTJY.js} +1 -1
  81. package/dist/assets/{Projects-NrtT8d2x.js → Projects-CCzxmEZ8.js} +1 -1
  82. package/dist/assets/{PublicIssueSharePage-CfQDHmOe.js → PublicIssueSharePage-BUSkP1Js.js} +1 -1
  83. package/dist/assets/{ReviewQueueCard-CksOubye.js → ReviewQueueCard-CrCN_30c.js} +1 -1
  84. package/dist/assets/{RichWorkProductCard-XPJ4R-il.js → RichWorkProductCard-DndJn4LV.js} +1 -1
  85. package/dist/assets/{RoutineDetail-AcrnXhjR.js → RoutineDetail-B5MzV_74.js} +1 -1
  86. package/dist/assets/{RoutineRunVariablesDialog-CtSVwZjy.js → RoutineRunVariablesDialog-kGyQVBid.js} +1 -1
  87. package/dist/assets/{Routines-B19G6Lkw.js → Routines-B2zX9h3J.js} +1 -1
  88. package/dist/assets/{ScrollToBottom-csHqjOIa.js → ScrollToBottom-Dd3SpeJi.js} +1 -1
  89. package/dist/assets/{Search-CnO6qC0m.js → Search-D4W3cZZf.js} +1 -1
  90. package/dist/assets/{Secrets-Xz6WSEnG.js → Secrets-C4nbuMIh.js} +1 -1
  91. package/dist/assets/{SkillSourceTree-BC2Ycl7g.js → SkillSourceTree-BvGzMa2u.js} +1 -1
  92. package/dist/assets/{SkillSources-BMogH_qp.js → SkillSources-DL2tNkcr.js} +1 -1
  93. package/dist/assets/{SkillStudio-HekOqqo_.js → SkillStudio-BnZ2cfDq.js} +1 -1
  94. package/dist/assets/{SourceTrustBadge-CXZGc8G4.js → SourceTrustBadge-CCPQEGrC.js} +1 -1
  95. package/dist/assets/{StatusCards-CL-RC2Mf.js → StatusCards-BkE-9R8F.js} +1 -1
  96. package/dist/assets/{SummarySlotCard-BJmo-gDJ.js → SummarySlotCard-D1EyiciB.js} +1 -1
  97. package/dist/assets/{TaskChatLab-CIZVb5Ed.js → TaskChatLab-D3PsNRr5.js} +1 -1
  98. package/dist/assets/{TaskChatMarker-CdRbWeYc.js → TaskChatMarker-DEF88_sr.js} +1 -1
  99. package/dist/assets/{TaskChatProtocolCard-C_A2mV-g.js → TaskChatProtocolCard-Ba_vhDxn.js} +1 -1
  100. package/dist/assets/{TaskChatThreadView-Bd3E40e0.js → TaskChatThreadView-BsPvbxiA.js} +1 -1
  101. package/dist/assets/{TaskTreeControls-DK6EZXLI.js → TaskTreeControls-BKOIbilg.js} +1 -1
  102. package/dist/assets/{Terminal-BcD_c9Om.js → Terminal-1uPX7VEe.js} +1 -1
  103. package/dist/assets/{TerminalView-XV2mBbcS.js → TerminalView-DDv6s-R_.js} +1 -1
  104. package/dist/assets/{TrustPresetSection-Ev8RdYhN.js → TrustPresetSection-BDb0N4Pe.js} +1 -1
  105. package/dist/assets/{UserProfile-C_BKVfMQ.js → UserProfile-DqPRuGWk.js} +1 -1
  106. package/dist/assets/{WhatNeedsMe-CYs2iX06.js → WhatNeedsMe-DtBxgH24.js} +1 -1
  107. package/dist/assets/{Workspaces-B8Wwbx8B.js → Workspaces-BQOyG5HK.js} +1 -1
  108. package/dist/assets/{connection-owner-Ca1nfKiA.js → connection-owner-CPrMcD3t.js} +1 -1
  109. package/dist/assets/{index-LM7k1NmC.js → index-QhteFtm-.js} +3 -3
  110. package/dist/assets/{issue-properties-CKLKB9AO.js → issue-properties--M7WE6Ot.js} +1 -1
  111. package/dist/assets/{issue-workspace-selection-CJYasFEQ.js → issue-workspace-selection-pUdSkrJA.js} +1 -1
  112. package/dist/assets/{pipeline-stage-presentation-BzvR-f05.js → pipeline-stage-presentation-Dv1xgEPW.js} +1 -1
  113. package/dist/assets/{shared-CMP5lH_Q.js → shared-B75ClBUg.js} +1 -1
  114. package/dist/assets/{system-notice-comment-BUfjKy0_.js → system-notice-comment-D0I6rz8Y.js} +1 -1
  115. package/dist/assets/{transcript-adapter-DiPtVkEm.js → transcript-adapter-ClaGWYVL.js} +1 -1
  116. package/dist/assets/{useSummaryDraftStream-uMW1O0Ga.js → useSummaryDraftStream-BDuMgNcA.js} +1 -1
  117. package/dist/index.html +1 -1
  118. package/dist/sw.js +1 -1
  119. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- var pl=Object.defineProperty;var t=(s,l)=>pl(s,"name",{value:l,configurable:!0});import{i as aa}from"./rolldown-runtime-ZpX3ckPj.js";import{Ir as fl,O as gl,l as K,la as kl,t as As,ua as jl}from"./createLucideIcon-CgrPXnTY.js";import{a as bl,n as vl,r as Xs,t as la,v as yl,y as Nl}from"./star-eem0qj3E.js";import{X as ia,_ as he,n as Zt,t as F,v as Ne}from"./queryKeys-BzT8CD34.js";import{n as wl}from"./CompanyContext-fQCNWI_f.js";import{at as Sl,dt as Tn,o as Cl,t as Pe,tt as ra}from"./router-CJbFZfVR.js";import{t as oa}from"./checkbox-Cf2_HXDG.js";import{c as ca,i as Ce,o as At,p as Cs,r as Is,s as qs,t as Fs}from"./dropdown-menu-rUbU8QKw.js";import{i as Il,r as Fl,t as Ll}from"./tabs-CjHzZxtD.js";import{c as ne,l as da,t as _l}from"./MarkdownEditor-ubJimjUH.js";import{t as qt}from"./arrow-left-CnGEiANj.js";import{t as Ie}from"./boxes-DVB7wdRh.js";import{t as Hs}from"./check-Bis3vECb.js";import{t as Ls}from"./chevron-down-nRcQ7bok.js";import{t as En}from"./chevron-left-DnUVccc_.js";import{t as Ps}from"./chevron-right-BP8JjEC_.js";import{t as ma}from"./circle-alert-C7T1cdKm.js";import{t as Dl}from"./circle-question-mark-CasEGiDp.js";import{t as Ot}from"./MarkdownBody-cPGkwwjq.js";import{t as Pl}from"./code-xml-CZhhm_-P.js";import{t as ua}from"./copy-C1cfcpxY.js";import{t as xa}from"./ellipsis-DyXbAp4P.js";import{t as us}from"./external-link-BIcMNNSN.js";import{t as Rl}from"./eye-D8HiVtuU.js";import{t as Ml}from"./file-code-corner-CwcL9g2p.js";import{t as gt}from"./file-text-CsPKrMTp.js";import{t as Al}from"./flask-conical-BxspRG7d.js";import{t as Qs}from"./folder-open-Dkshp3J4.js";import{t as Jt}from"./folder-search-B_Hz17IO.js";import{t as kt}from"./link-2-Cn4f4xsG.js";import{r as mt,t as w}from"./button-DI4w5WP7.js";import{t as Tl}from"./octagon-x-ZKE_ZOe_.js";import{t as Ut}from"./pause-B6AkvDer.js";import{t as Rs}from"./plus-CwNlqadt.js";import{t as ut}from"./refresh-cw-CfzWP9se.js";import{t as Tt}from"./save-Blub8a14.js";import{t as Ws}from"./search-CgZSuGC8.js";import{t as El}from"./settings-DuRZr7gk.js";import{t as zl}from"./shield-alert-BAXWoBTh.js";import{t as ha}from"./shield-check-RPyaLAc-.js";import{t as pa}from"./trash-QxFF084e.js";import{t as Ys}from"./triangle-alert-CnHMpmva.js";import{t as zn}from"./user-D5V640s5.js";import{t as Bl}from"./users-CEZ1U5q9.js";import{t as fa}from"./x-6E1yeU3Q.js";import{t as Kl}from"./MootMark-BZOhYsK8.js";import{i as Ze,n as Je,t as es}from"./tooltip-CW50mEoC.js";import{t as ie}from"./badge-jeXr866I.js";import{t as Bn}from"./AgentAvatar-BZiiDlCN.js";import{a as ga}from"./ToastContext-DyVJ6bCh.js";import{t as it}from"./agents-B8n-p0aX.js";import{t as $l}from"./projects-l3kQxnTp.js";import{a as xs,i as xt,n as ss,r as hs,s as ts,t as ns}from"./dialog-CeH7rDcv.js";import{t as Fe}from"./input-BBNGmECW.js";import{t as en}from"./github-icon-Cf0axVvi.js";import{n as ql}from"./BreadcrumbContext-DNbB7zWn.js";import"./AgentIdentity-DBHRFgMM.js";import{t as Vt}from"./textarea-CTx68BDs.js";import{t as Ol}from"./InlineBanner-DeTqU5Gp.js";import{t as ka}from"./AgentMultiSelect-BlUaNdZZ.js";import{t as Ul}from"./use-adapter-capabilities-BNfGiTEP.js";import{t as Vl}from"./use-copy-action-DFzauB4H.js";import{Br as Hl,Fa as ja,Ka as Ql,La as ba,T as Oe,Vr as Wl,Wa as Gl,Za as Ht,_ as Ue,no as Qt}from"./index-LM7k1NmC.js";import{a as rt,c as Xl,i as Yl,l as va,n as Zl,o as Et,r as zt,t as sn,u as ya}from"./SkillCardIcon-Byzb3JuD.js";import{t as Jl}from"./CopyText-BbOm2I6t.js";import{t as ei}from"./line-diff-DAcZgvm2.js";import{t as si}from"./SkillBinaryFile-N7sK2ZTh.js";import{_ as ti,a as ni,b as Ye,c as ai,d as li,g as tn,h as nn,i as ii,l as ri,m as jt,n as oi,p as an,r as ci,s as Ms,t as di,u as mi,v as Na,x as De,y as ui}from"./FolderControls-DI7QVvPv.js";import{a as ln,i as Kn,n as xi,o as hi,r as Us,t as pi}from"./company-skill-routes-D5LJ1l8M.js";var wa={name:"file-exclamation-point",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["file-warning"]};wa.node;var Sa=As(wa),Ca={name:"folder-input",size:24,node:[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]};Ca.node;var Ia=As(Ca),Fa={name:"folder-plus",size:24,node:[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};Fa.node;var rn=As(Fa),La={name:"git-fork",size:24,node:[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]};La.node;var _s=As(La),_a={name:"move-right",size:24,node:[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]};_a.node;var fi=As(_a),Da={name:"pin",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]};Da.node;var gi=As(Da),e=aa(kl(),1);function ki({skill:s}){const l=s.metadata?.skillSourceId??s.metadata?.legacySkillSourceId;if(typeof l!="string")return null;const i=s.metadata?.skillSourceState,o=s.metadata?.skillSourceId?i==="removed"?"Removed from source · last installed version retained":i==="not_syncing"?"Not syncing · installed copy retained":i==="update_failed"?"Update failed · last installed version retained":"Synced from GitHub":"Refresh this source to sync all files";return(0,e.jsxs)("div",{className:"flex flex-col gap-1 py-3 text-xs text-ink-3",children:[(0,e.jsx)("span",{children:o}),(0,e.jsxs)("span",{className:"break-all font-mono",children:[String(s.metadata?.skillSourcePath??""),s.sourceRef?` · ${s.sourceRef.slice(0,8)}`:""]}),(0,e.jsx)(Pe,{to:`/skills/sources/${l}`,className:"text-ink underline",children:"Manage source"})]})}t(ki,"SkillSourceProvenance");var d=aa(jl(),1);var ji=["skill_authentication_required","skill_company_boundary_denied","skill_workspace_boundary_denied","skill_source_validation_failed","skill_unsafe_content_blocked","skill_secret_handling_blocked","skill_actor_restricted"];var bi="An organization administrator can change the skill policy to allow this.",vi="This requires organization administration access. Ask an administrator to make this change.",yi={skill_authentication_required:"Sign in to manage skills.",skill_company_boundary_denied:"This skill belongs to another organization.",skill_workspace_boundary_denied:"This skill source is outside an allowed workspace.",skill_source_validation_failed:"This skill source failed validation.",skill_unsafe_content_blocked:"This skill contains unsafe content.",skill_secret_handling_blocked:"This skill exposes a secret value.",skill_actor_restricted:"This action isn't available for the current actor."},Ni={skill_authentication_required:"Sign in and try again.",skill_company_boundary_denied:"Open the skill from the organization that owns it.",skill_workspace_boundary_denied:"Import from a configured Wardmote workspace or the organization managed-skill directory.",skill_source_validation_failed:"Fix the flagged source and retry.",skill_unsafe_content_blocked:"Remove the fetch-and-execute or unsafe pattern before saving.",skill_secret_handling_blocked:"Remove the secret value before saving.",skill_actor_restricted:"Retry from an account with access to this action."};function wi(s){return s&&typeof s=="object"?s:null}t(wi,"asRecord");function Bt(s){return typeof s=="string"&&s.trim().length>0?s:null}t(Bt,"asString");function Si(s,l){if(!(s instanceof Zt))return null;const i=wi(s.body),o=Bt(i?.code),c=Bt(i?.reason),a=Bt(i?.remediation);return o==="skill_policy_denied"||c==="explicit_rule"||c==="policy_default"?{state:"policy",code:o,reason:c,title:l?`${l} is restricted by your organization policy.`:"This action is restricted by your organization policy.",remediation:a??bi}:o==="skill_policy_admin_required"?{state:"platform_admin",code:o,reason:c,title:"This change needs administration access.",remediation:a??vi}:o!==null&&ji.includes(o)||c==="platform_invariant"?{state:"platform",code:o,reason:c,title:(o&&yi[o])??"This action is blocked by a platform safety rule.",remediation:a??(o&&Ni[o])??"Fix the flagged issue and try again."}:null}t(Si,"classifySkillDenial");function Ci(){const[s,l]=(0,d.useState)(null);return{denial:s,capture:(0,d.useCallback)((i,o)=>{const c=Si(i,o);return c?(l(c),!0):!1},[]),reset:(0,d.useCallback)(()=>l(null),[])}}t(Ci,"useSkillPolicyDenial");function Ii({denial:s,onDismiss:l,className:i}){const o=l?(0,e.jsx)(w,{variant:"ghost",size:"sm",onClick:l,children:"Dismiss"}):void 0;return(0,e.jsx)(Ol,{tone:"warning",icon:s.state==="policy"?ha:Ys,title:s.title,actions:o,className:i,children:(0,e.jsx)("p",{children:s.remediation})})}t(Ii,"SkillPolicyDenialNotice");var ht=["./skills",".agents/skills",".claude/skills",".codex/skills",".cursor/skills"],Pa=34;function Ds(s,l){return`${s} ${l}`}t(Ds,"selectionKey");function Fi(s){return s.sourceType==="remote_managed"?!1:typeof s.cwd=="string"&&s.cwd.trim().length>0}t(Fi,"isScannableWorkspace");function Ra(s){return s.workspaces.filter(Fi)}t(Ra,"scannableWorkspaces");function Li(s){switch(s){case"git_repo":return"git";case"local_path":return"local";case"non_git_path":return"folder";case"remote_managed":return"remote";default:return s}}t(Li,"workspaceKindLabel");function _i(s){return Array.from(new Set(s.map(l=>Li(l.sourceType)))).join(", ")}t(_i,"summarizeWorkspaceKinds");function dt(s){return s.status==="new"||s.status==="conflict"}t(dt,"isSelectableCandidate");function Di(s,l){const i=l.trim().toLowerCase();return i?s.filter(o=>[o.name,o.slug,o.description,o.relativePath,o.workspaceName,o.directoryRoot,o.status].some(c=>c?.toLowerCase().includes(i))):s}t(Di,"filterCandidates");function Pi(s,l=[]){const i=new Map(l.map(c=>[c.id,c])),o=new Map;for(const c of s){let a=o.get(c.workspaceId);a||(a={key:c.workspaceId,workspaceId:c.workspaceId,workspaceName:c.workspaceName,isPrimary:i.get(c.workspaceId)?.isPrimary??!1,directories:[]},o.set(c.workspaceId,a));let m=a.directories.find(r=>r.directoryRoot===c.directoryRoot);m||(m={key:`${c.workspaceId} ${c.directoryRoot}`,directoryRoot:c.directoryRoot,candidates:[]},a.directories.push(m)),m.candidates.push(c)}return Array.from(o.values()).map(c=>({...c,directories:c.directories.sort((a,m)=>a.directoryRoot.localeCompare(m.directoryRoot))})).sort((c,a)=>c.isPrimary!==a.isPrimary?c.isPrimary?-1:1:c.workspaceName.localeCompare(a.workspaceName))}t(Pi,"groupCandidates");function Ri(s){return new Map}t(Ri,"defaultSelection");function Mi(s){const l=new Map;for(const i of s)i.status==="new"&&l.set(Ds(i.workspaceId,i.relativePath),{workspaceId:i.workspaceId,path:i.relativePath});return l}t(Mi,"selectAllSelection");function $n(s){return`${s.slug}-copy`}t($n,"suggestedConflictSlug");function Wt(s){if(s.slug===void 0)return!0;const l=s.slug.trim();return!!l&&fl(l)===l}t(Wt,"isValidSelectionSlug");function Gs(s){return s instanceof Zt?s.message||`Request failed: ${s.status}`:s instanceof Error?s.message:"Unexpected error"}t(Gs,"readableErrorMessage");function Ai(s){return s instanceof Zt?s.status===403:!1}t(Ai,"isGrantError");function Ti({status:s}){switch(s){case"already_imported":return(0,e.jsxs)(ie,{variant:"outline",className:"gap-1 px-1.5 py-0 font-normal text-ink-3 border-line/60",children:[(0,e.jsx)(kt,{className:"h-3 w-3"})," Imported"]});case"conflict":return(0,e.jsxs)(ie,{variant:"outline",className:"gap-1 px-1.5 py-0 font-normal text-amber-600 border-amber-500/40 dark:text-amber-400",children:[(0,e.jsx)(Ys,{className:"h-3 w-3"})," Conflict"]});case"skipped":return(0,e.jsxs)(ie,{variant:"outline",className:"gap-1 px-1.5 py-0 font-normal text-ink-3 border-line/60",children:[(0,e.jsx)(Sa,{className:"h-3 w-3"})," Skipped"]});default:return(0,e.jsxs)(ie,{variant:"outline",className:"gap-1 px-1.5 py-0 font-normal text-emerald-600 border-emerald-500/40 dark:text-emerald-400",children:[(0,e.jsx)(bl,{className:"h-3 w-3"})," New"]})}}t(Ti,"CandidateStatusBadge");function Ei({open:s,onOpenChange:l,companyId:i,onImportFromPath:o}){const c=ia(),a=ga(),[m,r]=(0,d.useState)("pick"),[x,g]=(0,d.useState)(""),[b,_]=(0,d.useState)(""),[f,v]=(0,d.useState)(null),[y,N]=(0,d.useState)(null),[D,k]=(0,d.useState)(null),[j,h]=(0,d.useState)(new Map),[P,A]=(0,d.useState)(null),[T,X]=(0,d.useState)(!1),[O,Q]=(0,d.useState)(null),C=(0,d.useRef)(0),M=Ne({queryKey:F.projects.list(i),queryFn:t(()=>$l.list(i),"queryFn"),enabled:s});(0,d.useEffect)(()=>{s&&(r("pick"),g(""),_(""),v(null),N(null),k(null),h(new Map),A(null),X(!1),Q(null),C.current+=1)},[s]);const ee=M.data??[],Y=(0,d.useMemo)(()=>{const L=x.trim().toLowerCase(),H=[...ee].sort((W,le)=>W.name.localeCompare(le.name));return L?H.filter(W=>W.name.toLowerCase().includes(L)):H},[ee,x]);function pe(L){v(L),N(null),k(null),h(new Map),r("scanning");const H=++C.current;ne.scanProjects(i,{projectIds:[L.id],mode:"preview"}).then(W=>{H===C.current&&(N(W),h(Ri(W.candidates)),r("select"))}).catch(W=>{H===C.current&&(k(W),r("select"))})}t(pe,"startScan");const ae=he({mutationFn:t(()=>{if(!f)throw new Error("No project selected.");const L=Array.from(j.values());return ne.scanProjects(i,{projectIds:[f.id],mode:"import",selection:L})},"mutationFn"),onSuccess:t(async L=>{A(L),r("result"),await c.invalidateQueries({queryKey:F.companySkills.list(i)});const H=L.imported.length;a.pushToast({tone:H>0?"success":"warn",title:H>0?"Skills imported":"Nothing imported",body:H>0?`${H} skill${H===1?"":"s"} imported as references from ${f?.name??"the project"}.`:"No skills were imported."})},"onSuccess"),onError:t(L=>{a.pushToast({tone:"error",title:"Import failed",body:Gs(L)})},"onError")}),Z=y?.candidates??[],Le=(0,d.useMemo)(()=>Z.filter(dt),[Z]),xe=(0,d.useMemo)(()=>Di(Z,b),[b,Z]),de=(0,d.useMemo)(()=>Pi(xe,f?.workspaces??[]),[xe,f]),S=j.size,U=Array.from(j.values()).some(L=>!Wt(L));function se(L){dt(L)&&h(H=>{const W=new Map(H),le=Ds(L.workspaceId,L.relativePath);return W.has(le)?W.delete(le):W.set(le,{workspaceId:L.workspaceId,path:L.relativePath,...L.status==="conflict"?{slug:$n(L)}:{}}),W})}t(se,"toggleCandidate");function Re(L,H){h(W=>{const le=new Map(W),te=Ds(L.workspaceId,L.relativePath),re=le.get(te);return re?(le.set(te,{...re,slug:H}),le):W})}t(Re,"renameCandidate");async function Me(L,H){if(!f)return;const W=H.toLowerCase().endsWith("/skill.md")?H.slice(0,-9)||".":H.toLowerCase()==="skill.md"?".":H,le=Ds(L,W);Q(le);try{const te=await ne.scanProjects(i,{projectIds:[f.id],mode:"preview",selection:[{workspaceId:L,path:W}]});N(te);const re=te.candidates.find(G=>G.workspaceId===L&&G.relativePath===W);re&&dt(re)?(h(G=>{const ge=new Map(G);return ge.set(le,{workspaceId:L,path:W,...re.status==="conflict"?{slug:$n(re)}:{}}),ge}),X(!1)):a.pushToast({tone:"warn",title:re?.status==="already_imported"?"Skill already imported":"Skill could not be added",body:re?.reason??"The selected folder does not contain a valid SKILL.md file."})}catch(te){a.pushToast({tone:"error",title:"Could not inspect skill",body:Gs(te)})}finally{Q(null)}}t(Me,"addBrowsedSkill");function ps(){h(Mi(Z))}t(ps,"selectAll");function as(){h(new Map)}t(as,"deselectAll");function we(){ae.isPending||l(!1)}t(we,"handleClose");function Ae(){C.current+=1,v(null),N(null),k(null),_(""),h(new Map),r("pick")}return t(Ae,"backToPick"),(0,e.jsx)(ns,{open:s,onOpenChange:t(L=>{L?l(!0):we()},"onOpenChange"),children:(0,e.jsxs)(ss,{showCloseButton:!1,className:"flex max-h-(--sz-85vh) flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl","data-testid":"import-skills-from-project-dialog",children:[(0,e.jsxs)("header",{className:"flex shrink-0 items-start justify-between gap-3 border-b border-line/60 px-5 py-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(ts,{className:"text-base font-semibold",children:"Import skills from project"}),(0,e.jsx)(hs,{className:"text-xs text-ink-3",children:"Pick a project, scan its workspaces for skills, and import them as references."})]}),(0,e.jsx)("button",{type:"button",className:"rounded-sm text-ink-3 opacity-70 transition-opacity hover:opacity-100",onClick:we,"aria-label":"Close import dialog",children:(0,e.jsx)(fa,{className:"h-4 w-4"})})]}),(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden","aria-live":"polite",children:[m==="pick"&&(0,e.jsx)(zi,{loading:M.isLoading,error:M.error,projects:Y,totalProjects:ee.length,filter:x,onFilterChange:g,onPick:pe}),m==="scanning"&&(0,e.jsx)(Bi,{projectName:f?.name??""}),m==="select"&&(0,e.jsx)($i,{scanError:D,onRetry:t(()=>f&&pe(f),"onRetry"),onImportFromPath:o,groups:de,totalCandidates:Z.length,filter:b,onFilterChange:_,selection:j,toggleCandidate:se,renameCandidate:Re,project:f,companyId:i,browseOpen:T,onBrowseOpenChange:X,onAddBrowsedSkill:Me,browseAddingKey:O}),m==="result"&&P&&(0,e.jsx)(qi,{result:P})]}),(0,e.jsxs)("footer",{className:"flex shrink-0 flex-col gap-2 border-t border-line/60 bg-bg-3/20 px-5 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-3",children:[m==="select"&&!D&&Z.length>0?(0,e.jsx)("div",{className:"min-w-0 flex-1 text-xs text-ink-3",children:(0,e.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(kt,{className:"h-3.5 w-3.5 shrink-0"}),"Files stay in the project — Studio edits save directly to them."]})}):(0,e.jsx)("div",{className:"hidden min-w-0 flex-1 sm:block"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2 sm:shrink-0",children:[m==="select"&&(0,e.jsxs)(e.Fragment,{children:[!D&&Z.length>0&&(0,e.jsxs)("div",{className:"mr-1 flex items-center gap-1",children:[(0,e.jsx)(w,{variant:"ghost",size:"sm",onClick:ps,disabled:Le.length===0,"data-testid":"select-all",children:"Select all"}),(0,e.jsx)(w,{variant:"ghost",size:"sm",onClick:as,disabled:S===0,"data-testid":"deselect-all",children:"Deselect all"})]}),(0,e.jsxs)(w,{variant:"secondary",size:"sm",onClick:Ae,children:[(0,e.jsx)(qt,{className:"mr-1 h-3.5 w-3.5"})," Back"]}),!D&&Z.length>0&&(0,e.jsx)(w,{size:"sm",onClick:t(()=>ae.mutate(),"onClick"),disabled:S===0||U||ae.isPending,"data-testid":"import-skills",children:ae.isPending?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(mt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"})," Importing…"]}):`Import ${S} skill${S===1?"":"s"}`})]}),m==="pick"&&(0,e.jsx)(w,{variant:"ghost",size:"sm",onClick:we,children:"Cancel"}),m==="result"&&(0,e.jsx)(w,{size:"sm",onClick:we,children:"Done"})]})]})]})})}t(Ei,"ImportSkillsFromProjectDialog");function zi({loading:s,error:l,projects:i,totalProjects:o,filter:c,onFilterChange:a,onPick:m}){return(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,e.jsx)("div",{className:"border-b border-line/60 px-5 py-3",children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)(Ws,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-3"}),(0,e.jsx)(Fe,{value:c,onChange:t(r=>a(r.target.value),"onChange"),placeholder:"Filter projects",className:"pl-7 text-xs","aria-label":"Filter projects","data-testid":"project-filter"})]})}),(0,e.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:s?(0,e.jsx)("div",{className:"p-6 text-center text-sm text-ink-3",children:"Loading projects…"}):l?(0,e.jsxs)("div",{className:"m-5 flex items-start gap-3 rounded-md border border-bad/40 bg-bad/10 p-4 text-sm text-bad",role:"alert",children:[(0,e.jsx)(ma,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,e.jsx)("div",{children:Gs(l)})]}):o===0?(0,e.jsx)(Oe,{icon:ra,message:"This organization has no projects yet."}):i.length===0?(0,e.jsx)(Oe,{icon:Ws,message:`No projects match "${c}".`}):(0,e.jsx)("ul",{className:"divide-y divide-line/60","data-testid":"project-list",children:i.map(r=>{const x=Ra(r),g=x.length===0,b=_i(r.workspaces);return(0,e.jsx)("li",{children:(0,e.jsxs)("button",{type:"button",className:K("flex w-full items-center gap-3 px-5 py-3 text-left transition-colors",g?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-bg-3/40"),onClick:t(()=>!g&&m(r),"onClick"),disabled:g,"aria-disabled":g,"data-testid":`project-row-${r.id}`,"data-disabled":g?"true":"false",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("div",{className:"truncate text-sm font-medium",children:r.name}),(0,e.jsxs)("div",{className:"mt-0.5 text-xs text-ink-3",children:[r.workspaces.length," workspace",r.workspaces.length===1?"":"s",b?` · ${b}`:""]}),g&&(0,e.jsx)("div",{className:"mt-1 text-(length:--text-micro) text-ink-3",children:"Remote-only project — no locally scannable workspaces to import from."})]}),!g&&(0,e.jsxs)(ie,{variant:"outline",className:"shrink-0 px-1.5 py-0 font-normal",children:[x.length," scannable"]})]})},r.id)})})})]})}t(zi,"PickProjectStep");function Bi({projectName:s}){return(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4 p-8 text-center","data-testid":"scanning-step",children:[(0,e.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,e.jsx)(Jt,{className:"h-10 w-10 text-ink-3/60"}),(0,e.jsx)(mt,{className:"h-5 w-5 animate-spin text-ink-3"})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("p",{className:"text-sm font-medium",children:["Scanning ",s||"project"," for skills…"]}),(0,e.jsx)("p",{className:"mt-1 text-xs text-ink-3",children:"Looking in well-known skill folders across each workspace."})]}),(0,e.jsxs)("div",{className:"flex max-w-md flex-wrap justify-center gap-1.5",children:[ht.map(l=>(0,e.jsx)(ie,{variant:"outline",className:"px-1.5 py-0 font-mono text-(length:--text-micro) font-normal text-ink-3",children:l},l)),(0,e.jsxs)(ie,{variant:"outline",className:"px-1.5 py-0 text-(length:--text-micro) font-normal text-ink-3",children:["+",Pa-ht.length," more"]})]})]})}t(Bi,"ScanningStep");function Ki({companyId:s,project:l,onBack:i,onAddSkill:o,addingKey:c}){const a=Ra(l),m=a.find(y=>y.isPrimary)??a[0]??null,[r,x]=(0,d.useState)(m?.id??""),[g,b]=(0,d.useState)("."),_=Ne({queryKey:["company-skills","browse-project",s,l.id,r,g],queryFn:t(()=>ne.browseProject(s,{projectId:l.id,workspaceId:r,path:g}),"queryFn"),enabled:!!r}),f=_.data;function v(y){x(y),b(".")}return t(v,"changeWorkspace"),(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"project-skill-browser",children:[(0,e.jsxs)("div",{className:"shrink-0 border-b border-line/60 px-5 py-3",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:"Browse project folders"}),(0,e.jsx)("p",{className:"mt-0.5 text-xs text-ink-3",children:"Open any folder and add directories or individual SKILL.md files."})]}),(0,e.jsxs)(w,{variant:"secondary",size:"sm",onClick:i,children:[(0,e.jsx)(qt,{className:"mr-1 h-3.5 w-3.5"})," Discovered skills"]})]}),a.length>1&&(0,e.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5","aria-label":"Project workspace",children:a.map(y=>(0,e.jsx)(w,{type:"button",variant:y.id===r?"secondary":"ghost",size:"sm",onClick:t(()=>v(y.id),"onClick"),children:y.name},y.id))})]}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-line/60 bg-bg-3/20 px-5 py-2",children:[(0,e.jsx)(w,{variant:"ghost",size:"sm",onClick:t(()=>f?.parentPath&&b(f.parentPath),"onClick"),disabled:!f?.parentPath,"aria-label":"Open parent folder",children:(0,e.jsx)(qt,{className:"h-3.5 w-3.5"})}),(0,e.jsx)("span",{className:"min-w-0 truncate font-mono text-xs text-ink-3",children:f?.path??g})]}),(0,e.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[_.isLoading?(0,e.jsxs)("div",{className:"flex items-center justify-center gap-2 p-8 text-sm text-ink-3",children:[(0,e.jsx)(mt,{className:"h-4 w-4 animate-spin"})," Loading folder…"]}):_.error?(0,e.jsx)("div",{className:"p-6 text-sm text-bad",children:Gs(_.error)}):f?.entries.length?(0,e.jsx)("ul",{className:"divide-y divide-line/60",children:f.entries.map(y=>{const N=y.kind==="file"?y.path.toLowerCase()==="skill.md"?".":y.path.slice(0,-9):y.path,D=Ds(r,N);return(0,e.jsxs)("li",{className:"flex items-center gap-3 px-5 py-2.5",children:[y.kind==="directory"?(0,e.jsx)(Xs,{className:"h-4 w-4 shrink-0 text-ink-3"}):(0,e.jsx)(gt,{className:"h-4 w-4 shrink-0 text-ink-3"}),(0,e.jsx)("button",{type:"button",className:K("min-w-0 flex-1 truncate text-left text-sm",y.kind==="directory"&&"font-medium hover:underline"),onClick:t(()=>y.kind==="directory"&&b(y.path),"onClick"),disabled:y.kind==="file",children:y.name}),y.isSkill?(0,e.jsx)(w,{size:"sm",onClick:t(()=>o(r,y.path),"onClick"),disabled:c===D,children:c===D?(0,e.jsx)(mt,{className:"h-3.5 w-3.5 animate-spin"}):"Add skill"}):y.kind==="directory"?(0,e.jsx)(Ps,{className:"h-4 w-4 text-ink-3"}):null]},y.path)})}):(0,e.jsx)("div",{className:"p-8 text-center text-sm text-ink-3",children:"This folder is empty."}),f?.truncated&&(0,e.jsx)("p",{className:"border-t border-line/60 px-5 py-2 text-xs text-ink-3",children:"Showing the first 250 entries."})]})]})}t(Ki,"ProjectSkillBrowser");function $i({scanError:s,onRetry:l,onImportFromPath:i,groups:o,totalCandidates:c,filter:a,onFilterChange:m,selection:r,toggleCandidate:x,renameCandidate:g,project:b,companyId:_,browseOpen:f,onBrowseOpenChange:v,onAddBrowsedSkill:y,browseAddingKey:N}){if(s){const D=Ai(s);return(0,e.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6","data-testid":"scan-error",children:(0,e.jsxs)("div",{className:"max-w-md text-center",children:[(0,e.jsx)("div",{className:"mx-auto mb-4 w-fit bg-bg-3/50 p-4",children:D?(0,e.jsx)(zl,{className:"h-10 w-10 text-ink-3/60"}):(0,e.jsx)(ma,{className:"h-10 w-10 text-ink-3/60"})}),(0,e.jsx)("p",{className:"text-base font-semibold",children:D?"You can't import skills here":"Scan failed"}),(0,e.jsx)("p",{className:"mt-1.5 text-sm text-ink-3",children:D?"Your account doesn't have permission to add skills to this organization. Ask an owner to grant the skills permission, then try again.":Gs(s)}),!D&&(0,e.jsx)(w,{variant:"secondary",size:"sm",className:"mt-4",onClick:l,children:"Try again"})]})})}return f&&b?(0,e.jsx)(Ki,{companyId:_,project:b,onBack:t(()=>v(!1),"onBack"),onAddSkill:y,addingKey:N}):c===0?(0,e.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6","data-testid":"select-empty",children:(0,e.jsxs)("div",{className:"max-w-md text-center",children:[(0,e.jsx)("div",{className:"mx-auto mb-4 w-fit bg-bg-3/50 p-4",children:(0,e.jsx)(Jt,{className:"h-10 w-10 text-ink-3/50"})}),(0,e.jsx)("p",{className:"text-base font-semibold",children:"No skills found"}),(0,e.jsxs)("p",{className:"mt-1.5 text-sm text-ink-3",children:["None of the well-known skill folders in this project's workspaces contain a"," ",(0,e.jsx)("code",{className:"rounded bg-bg-3 px-1 py-0.5 text-xs",children:"SKILL.md"}),". We searched"," ",ht.join(", ")," and ",Pa-ht.length," ","other agent-harness folders."]}),(0,e.jsxs)(w,{variant:"secondary",size:"sm",className:"mt-4",onClick:t(()=>v(!0),"onClick"),"data-testid":"browse-project-folders-empty",children:[(0,e.jsx)(Qs,{className:"mr-1.5 h-3.5 w-3.5"})," Browse project folders"]}),i&&(0,e.jsxs)("p",{className:"mt-3 text-sm text-ink-3",children:["For skills in non-standard folders, use"," ",(0,e.jsx)("button",{type:"button",className:"font-medium text-ink underline underline-offset-2",onClick:i,children:"Import from path or URL"}),"."]})]})}):(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"candidate-list",children:[(0,e.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-line/60 px-5 py-2.5",children:[(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Choose discovered skills, or browse any workspace folder."}),(0,e.jsxs)(w,{variant:"secondary",size:"sm",onClick:t(()=>v(!0),"onClick"),"data-testid":"browse-project-folders",children:[(0,e.jsx)(Qs,{className:"mr-1.5 h-3.5 w-3.5"})," Browse folders"]})]}),(0,e.jsx)("div",{className:"shrink-0 border-b border-line/60 px-5 py-2.5",children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)(Ws,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-3"}),(0,e.jsx)(Fe,{value:a,onChange:t(D=>m(D.target.value),"onChange"),placeholder:"Search discovered skills…",className:"h-8 pl-8 text-xs","aria-label":"Search discovered skills"})]})}),(0,e.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o.length===0?(0,e.jsxs)("div",{className:"flex h-full items-center justify-center p-6 text-sm text-ink-3",children:["No skills match “",a.trim(),"”."]}):o.map((D,k)=>(0,e.jsxs)("section",{children:[k>0&&!D.isPrimary&&o[k-1]?.isPrimary&&(0,e.jsx)("header",{className:"border-y border-line/60 bg-bg-3/30 px-5 py-2 text-xs uppercase tracking-wide text-ink-3",children:"Other Workspaces"}),(0,e.jsx)("header",{className:"sticky top-0 z-10 border-b border-line/60 bg-bg px-5 py-2 text-sm font-medium text-ink",children:D.workspaceName}),D.directories.map(j=>(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"bg-bg-3/30 px-5 py-1.5 font-mono text-(length:--text-micro) text-ink-3",children:j.directoryRoot}),(0,e.jsx)("ul",{className:"divide-y divide-line/60",children:j.candidates.map(h=>{const P=dt(h),A=Ds(h.workspaceId,h.relativePath),T=r.has(A),X=r.get(A);return(0,e.jsxs)("li",{className:K("flex items-start gap-3 px-5 py-2.5 transition-colors",P?"cursor-pointer hover:bg-bg-3/40":"opacity-70",T&&"bg-bg-3/50"),onClick:t(()=>x(h),"onClick"),"data-testid":`candidate-${h.relativePath}`,"data-status":h.status,"data-selected":T?"true":"false",children:[(0,e.jsx)("div",{className:"pt-0.5",onClick:t(O=>O.stopPropagation(),"onClick"),children:(0,e.jsx)(oa,{checked:T,onCheckedChange:t(()=>x(h),"onCheckedChange"),disabled:!P,"aria-label":`Select ${h.name}`})}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[(0,e.jsx)("span",{className:"min-w-0 truncate text-sm font-medium",children:h.name}),(0,e.jsx)(Ti,{status:h.status})]}),h.description&&(0,e.jsx)("p",{className:"mt-0.5 line-clamp-2 text-xs text-ink-3",children:h.description}),(0,e.jsx)("p",{className:"mt-0.5 font-mono text-(length:--text-micro) text-ink-3",children:h.relativePath}),h.reason&&(0,e.jsx)("p",{className:K("mt-0.5 text-(length:--text-micro)",h.status==="conflict"?"text-amber-600 dark:text-amber-400":"text-ink-3"),children:h.reason}),h.status==="conflict"&&T&&(0,e.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",onClick:t(O=>O.stopPropagation(),"onClick"),children:[(0,e.jsx)("label",{htmlFor:`rename-${h.workspaceId}-${h.slug}`,className:"shrink-0 text-xs text-ink-3",children:"Import as"}),(0,e.jsx)(Fe,{id:`rename-${h.workspaceId}-${h.slug}`,value:X?.slug??"",onChange:t(O=>g(h,O.target.value),"onChange"),className:"h-7 max-w-xs font-mono text-xs","aria-label":`Rename ${h.name}`,"aria-invalid":X?!Wt(X):void 0}),X&&!Wt(X)&&(0,e.jsx)("span",{className:"text-xs text-bad",children:"Use a lowercase URL-safe slug."})]})]})]},`${h.workspaceId} ${h.relativePath}`)})})]},j.key))]},D.key))})]})}t($i,"SelectStep");function qi({result:s}){const l=(0,d.useMemo)(()=>[...s.imported,...s.updated],[s]);return(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,e.jsxs)("div",{className:"border-b border-line/60 px-5 py-4","data-testid":"result-summary",children:[(0,e.jsxs)("div",{className:"flex items-start gap-3 rounded-md border border-emerald-500/30 bg-emerald-500/5 p-3",children:[(0,e.jsx)(kt,{className:"mt-0.5 h-4 w-4 shrink-0 text-emerald-600 dark:text-emerald-400"}),(0,e.jsxs)("div",{className:"text-xs leading-relaxed text-ink-3",children:[(0,e.jsx)("span",{className:"font-medium text-ink",children:"No files were copied."})," These skills reference the files in the project workspace — editing them in Skill Studio saves directly back to those files."]})]}),(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-ink-3",children:[(0,e.jsxs)("span",{className:"text-emerald-600 dark:text-emerald-400",children:["✓ ",s.imported.length," imported"]}),s.updated.length>0&&(0,e.jsxs)("span",{children:["↻ ",s.updated.length," updated"]}),s.skipped.length>0&&(0,e.jsxs)("span",{children:["⊘ ",s.skipped.length," skipped"]})]})]}),(0,e.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[l.length>0&&(0,e.jsxs)("section",{children:[(0,e.jsxs)("header",{className:"bg-bg-3/30 px-5 py-1.5 text-xs uppercase tracking-wide text-ink-3",children:["Imported · ",l.length]}),(0,e.jsx)("ul",{className:"divide-y divide-line/60","data-testid":"result-imported",children:l.map(i=>(0,e.jsxs)("li",{className:"flex items-center gap-3 px-5 py-2.5 text-sm",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("div",{className:"truncate font-medium",children:i.name}),i.description&&(0,e.jsx)("div",{className:"truncate text-xs text-ink-3",children:i.description})]}),(0,e.jsxs)(Pe,{to:ln(i.id),className:"inline-flex shrink-0 items-center gap-1 text-xs font-medium text-ink no-underline hover:underline",children:["Open ",(0,e.jsx)(us,{className:"h-3 w-3"})]})]},i.id))})]}),s.skipped.length>0&&(0,e.jsxs)("section",{children:[(0,e.jsxs)("header",{className:"bg-bg-3/30 px-5 py-1.5 text-xs uppercase tracking-wide text-ink-3",children:["Skipped · ",s.skipped.length]}),(0,e.jsx)("ul",{className:"divide-y divide-line/60","data-testid":"result-skipped",children:s.skipped.map((i,o)=>(0,e.jsxs)("li",{className:"flex items-start gap-2 px-5 py-2.5 text-xs",children:[(0,e.jsx)(Sa,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-ink-3"}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"font-mono text-ink-3",children:i.path??"—"}),i.reason&&(0,e.jsx)("span",{className:"ml-2 text-ink-3",children:i.reason})]})]},`${i.workspaceId??"?"}-${i.path??o}`))})]}),s.warnings.length>0&&(0,e.jsxs)("section",{children:[(0,e.jsxs)("header",{className:"bg-bg-3/30 px-5 py-1.5 text-xs uppercase tracking-wide text-ink-3",children:["Warnings · ",s.warnings.length]}),(0,e.jsx)("ul",{className:"divide-y divide-line/60","data-testid":"result-warnings",children:s.warnings.map((i,o)=>(0,e.jsxs)("li",{className:"flex items-start gap-2 px-5 py-2.5 text-xs",children:[(0,e.jsx)(Ys,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500"}),(0,e.jsx)("span",{className:"text-ink-3",children:i})]},o))})]})]})]})}t(qi,"ResultStep");var ot=288,Gt=224,Xt=400,qn=16,Ma="wardmote.skills.folderRail.width";function pt(s){return Math.min(Xt,Math.max(Gt,s))}t(pt,"clampFolderRailWidth");function Oi(){if(typeof window>"u")return ot;try{const s=window.localStorage.getItem(Ma);if(!s)return ot;const l=Number.parseInt(s,10);return Number.isFinite(l)?pt(l):ot}catch{return ot}}t(Oi,"readStoredFolderRailWidth");function On(s){if(!(typeof window>"u"))try{window.localStorage.setItem(Ma,String(pt(s)))}catch{}}t(On,"writeStoredFolderRailWidth");function Ui(s){return!s.systemKey&&!jt(s)&&!nn(s)}t(Ui,"folderIsEditable");function Vi(s,l){return an(s,l).map(i=>i.id).filter(i=>i!==l)}t(Vi,"ancestorIds");function Hi({result:s,selection:l,loading:i=!1,tags:o,activeTag:c,onSelect:a,onSelectTag:m,onCreateFolder:r,onRenameFolder:x,onEditFolder:g,onMoveFolder:b,onDeleteFolder:_,onEnsureMyFolder:f}){const v=(0,d.useMemo)(()=>Ye(s),[s]),[y,N]=(0,d.useState)(()=>new Set),[D,k]=(0,d.useState)(null),[j,h]=(0,d.useState)(""),[P,A]=(0,d.useState)(Oi),[T,X]=(0,d.useState)(!1),O=(0,d.useRef)(P),Q=(0,d.useRef)(null);(0,d.useEffect)(()=>{if(l==="all"||l==="unfiled")return;const S=Vi(v,l);S.length!==0&&N(U=>{const se=new Set(U);let Re=!1;for(const Me of S)se.has(Me)||(se.add(Me),Re=!0);return Re?se:U})},[v,l]);function C(S){N(U=>{const se=new Set(U);return se.has(S)?se.delete(S):se.add(S),se})}t(C,"toggle");function M(S){k(S.id),h(S.name)}t(M,"startRename");function ee(S){const U=j.trim();U&&U!==S.name&&x(S,U),k(null)}t(ee,"commitRename");const Y=s?.allCount??0,pe=s?.unfiledCount??0,ae=(0,d.useCallback)(S=>{const U=pt(S);O.current=U,A(U),On(U)},[]),Z=(0,d.useCallback)(S=>{S.preventDefault(),S.currentTarget.setPointerCapture(S.pointerId),Q.current={startX:S.clientX,startWidth:O.current},X(!0)},[]),Le=(0,d.useCallback)(S=>{if(!Q.current)return;const U=pt(Q.current.startWidth+S.clientX-Q.current.startX);O.current=U,A(U)},[]),xe=(0,d.useCallback)(()=>{Q.current&&(Q.current=null,X(!1),On(O.current))},[]),de=(0,d.useCallback)(S=>{S.key==="ArrowLeft"?(S.preventDefault(),ae(P-qn)):S.key==="ArrowRight"?(S.preventDefault(),ae(P+qn)):S.key==="Home"?(S.preventDefault(),ae(Gt)):S.key==="End"&&(S.preventDefault(),ae(Xt))},[ae,P]);return(0,e.jsxs)("div",{className:"relative hidden h-full shrink-0 md:flex",style:{width:`${P}px`},children:[(0,e.jsxs)("nav",{"aria-label":"Skill folders",className:"flex min-w-0 flex-1 flex-col overflow-y-auto border-r border-line pr-3",children:[(0,e.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2 pt-0.5",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"Folders"}),(0,e.jsx)(w,{variant:"ghost",size:"icon-sm",title:"New folder",onClick:t(()=>r(null),"onClick"),children:(0,e.jsx)(Rs,{className:"h-3.5 w-3.5"})})]}),i?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:"h-7 rounded-md bg-bg-3/60"}),(0,e.jsx)("div",{className:"h-7 rounded-md bg-bg-3/40"}),(0,e.jsx)("div",{className:"h-7 rounded-md bg-bg-3/30"})]}):(0,e.jsxs)("div",{className:"space-y-0.5",children:[(0,e.jsx)(ct,{active:l==="all",label:"All skills",count:Y,icon:(0,e.jsx)(ra,{className:"h-3.5 w-3.5"}),onSelect:t(()=>a("all"),"onSelect")}),v.my?(0,e.jsx)(Os,{node:v.my,depth:0,selection:l,expanded:y,renamingId:D,renameDraft:j,rootLabel:"My Skills",rootIcon:(0,e.jsx)(zn,{className:"h-3.5 w-3.5"}),onToggle:C,onSelect:a,onCreateFolder:r,onEditFolder:g,onMoveFolder:b,onDeleteFolder:_,onStartRename:M,onRenameDraftChange:h,onRenameCommit:ee,onRenameCancel:t(()=>k(null),"onRenameCancel")}):f?(0,e.jsx)(ct,{active:!1,label:"My Skills",count:0,icon:(0,e.jsx)(zn,{className:"h-3.5 w-3.5"}),muted:!0,onSelect:f}):null,(0,e.jsx)(Qi,{label:"Organization",onCreate:t(()=>r(null),"onCreate")}),v.company.length>0?v.company.map(S=>(0,e.jsx)(Os,{node:S,depth:0,selection:l,expanded:y,renamingId:D,renameDraft:j,onToggle:C,onSelect:a,onCreateFolder:r,onEditFolder:g,onMoveFolder:b,onDeleteFolder:_,onStartRename:M,onRenameDraftChange:h,onRenameCommit:ee,onRenameCancel:t(()=>k(null),"onRenameCancel")},S.folder.id)):(0,e.jsx)("div",{className:"px-2 py-1 text-xs text-ink-3",children:"No organization folders yet."}),v.projects?(0,e.jsx)(Os,{node:v.projects,depth:0,selection:l,expanded:y,renamingId:D,renameDraft:j,rootLabel:"Projects",rootIcon:(0,e.jsx)(Ie,{className:"h-3.5 w-3.5"}),onToggle:C,onSelect:a,onCreateFolder:r,onEditFolder:g,onMoveFolder:b,onDeleteFolder:_,onStartRename:M,onRenameDraftChange:h,onRenameCommit:ee,onRenameCancel:t(()=>k(null),"onRenameCancel")}):(0,e.jsx)(ct,{active:!1,label:"Projects",count:0,icon:(0,e.jsx)(Ie,{className:"h-3.5 w-3.5"}),muted:!0,disabled:!0,onSelect:t(()=>{},"onSelect")}),v.bundled?(0,e.jsx)(Os,{node:v.bundled,depth:0,selection:l,expanded:y,renamingId:D,renameDraft:j,rootLabel:"Bundled",rootIcon:(0,e.jsx)(Ie,{className:"h-3.5 w-3.5"}),onToggle:C,onSelect:a,onCreateFolder:r,onEditFolder:g,onMoveFolder:b,onDeleteFolder:_,onStartRename:M,onRenameDraftChange:h,onRenameCommit:ee,onRenameCancel:t(()=>k(null),"onRenameCancel")}):null,(0,e.jsx)("div",{className:"px-2 pb-1 pt-3 text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"System"}),(0,e.jsx)(ct,{active:l==="unfiled",label:"Unfiled",count:pe,icon:(0,e.jsx)(Ms,{color:null}),onSelect:t(()=>a("unfiled"),"onSelect")})]}),o.length>0?(0,e.jsxs)("div",{className:"mt-4 border-t border-line pt-3",children:[(0,e.jsxs)("div",{className:"mb-1.5 flex items-center gap-1.5 px-2 text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:[(0,e.jsx)(da,{className:"h-3 w-3"}),"Tags"]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-1.5 px-1",children:[c?(0,e.jsxs)("button",{type:"button",onClick:t(()=>m(null),"onClick"),className:"inline-flex items-center gap-1 rounded-full border border-line bg-bg-3/60 px-2 py-0.5 text-xs text-ink",children:[c,(0,e.jsx)(Hs,{className:"h-3 w-3"})]}):null,o.filter(S=>S.slug!==c).map(S=>(0,e.jsxs)("button",{type:"button",onClick:t(()=>m(S.slug),"onClick"),className:"inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 text-xs text-ink-3 transition-colors hover:bg-bg-3/40 hover:text-ink",children:[(0,e.jsx)("span",{className:"max-w-32 truncate",children:S.slug}),(0,e.jsx)("span",{className:"text-(length:--text-micro) opacity-70",children:S.count})]},S.slug))]})]}):null]}),(0,e.jsx)("div",{role:"separator","aria-label":"Resize skill folders","aria-orientation":"vertical","aria-valuemin":Gt,"aria-valuemax":Xt,"aria-valuenow":P,tabIndex:0,className:K("absolute inset-y-0 right-0 z-20 w-3 cursor-col-resize touch-none outline-none","before:absolute before:inset-y-0 before:left-1/2 before:w-px before:-translate-x-1/2 before:bg-transparent before:transition-colors","hover:before:bg-line focus-visible:before:bg-focus",T&&"before:bg-focus"),onPointerDown:Z,onPointerMove:Le,onPointerUp:xe,onPointerCancel:xe,onLostPointerCapture:xe,onKeyDown:de})]})}t(Hi,"SkillFolderRail");function Qi({label:s,onCreate:l}){return(0,e.jsxs)("div",{className:"group/heading flex items-center justify-between px-2 pb-0.5 pt-3",children:[(0,e.jsx)("span",{className:"text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:s}),(0,e.jsx)("button",{type:"button",onClick:l,title:`New ${s.toLowerCase()} folder`,className:"opacity-0 transition-opacity group-hover/heading:opacity-100",children:(0,e.jsx)(Rs,{className:"h-3 w-3 text-ink-3"})})]})}t(Qi,"RailHeading");function ct({active:s,label:l,count:i,icon:o,muted:c=!1,disabled:a=!1,onSelect:m}){return(0,e.jsxs)("button",{type:"button",className:K("grid w-full grid-cols-(--gtc-folder-row-actions) items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-bg-3/40",s?"bg-bg-3/60 text-ink":c?"text-ink-3/70":"text-ink-3"),"aria-current":s?"page":void 0,disabled:a,onClick:m,children:[(0,e.jsx)("span",{className:"flex h-4 w-4 items-center justify-center",children:o}),(0,e.jsx)("span",{className:"truncate",children:l}),(0,e.jsx)("span",{className:"text-right text-xs tabular-nums text-ink-3",children:i}),(0,e.jsx)("span",{className:"h-6 w-6","aria-hidden":"true"})]})}t(ct,"VirtualRow");function Os({node:s,depth:l,selection:i,expanded:o,renamingId:c,renameDraft:a,rootLabel:m,rootIcon:r,onToggle:x,onSelect:g,onCreateFolder:b,onEditFolder:_,onMoveFolder:f,onDeleteFolder:v,onStartRename:y,onRenameDraftChange:N,onRenameCommit:D,onRenameCancel:k}){const{folder:j,children:h}=s,P=o.has(j.id),A=i===j.id,T=Ui(j),X=!jt(j)&&!nn(j)&&j.depth<4,O=j.path.startsWith("my/"),Q=m??j.name;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:K("group grid grid-cols-(--gtc-folder-row-actions) items-center gap-2 rounded-md pr-2 text-sm transition-colors hover:bg-bg-3/40",A?"bg-bg-3/60 text-ink":"text-ink-3"),style:{paddingLeft:`${l*.75}rem`},children:[(0,e.jsx)("button",{type:"button","aria-label":P?"Collapse folder":"Expand folder",className:K("flex h-6 w-4 items-center justify-center text-ink-3",h.length===0&&"invisible"),onClick:t(()=>x(j.id),"onClick"),children:(0,e.jsx)(Ps,{className:K("h-3.5 w-3.5 transition-transform",P&&"rotate-90")})}),(0,e.jsxs)("button",{type:"button",className:"flex min-w-0 items-center gap-2 py-1 text-left","aria-current":A?"page":void 0,onClick:t(()=>{g(j.id),h.length>0&&x(j.id)},"onClick"),onDoubleClick:t(()=>T&&y(j),"onDoubleClick"),children:[r?(0,e.jsx)("span",{className:"flex h-4 w-4 items-center justify-center text-ink-3",children:r}):(0,e.jsx)(Ms,{color:j.color}),c===j.id?(0,e.jsx)("input",{value:a,onChange:t(C=>N(C.target.value),"onChange"),onClick:t(C=>C.stopPropagation(),"onClick"),onKeyDown:t(C=>{C.key==="Enter"&&D(j),C.key==="Escape"&&k()},"onKeyDown"),onBlur:t(()=>D(j),"onBlur"),className:"h-6 min-w-0 flex-1 rounded-sm border border-line bg-bg px-1 text-sm outline-none",autoFocus:!0}):(0,e.jsx)("span",{className:"truncate",children:Q})]}),(0,e.jsx)("span",{className:"text-right text-xs tabular-nums text-ink-3",children:j.itemCount}),T||X?(0,e.jsxs)(Fs,{children:[(0,e.jsx)(Cs,{asChild:!0,children:(0,e.jsx)(w,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100","aria-label":`Folder actions for ${Q}`,children:(0,e.jsx)(xa,{className:"h-3.5 w-3.5"})})}),(0,e.jsxs)(Is,{align:"end",children:[X?(0,e.jsxs)(Ce,{onSelect:t(()=>b(j.id),"onSelect"),children:[(0,e.jsx)(rn,{className:"h-3.5 w-3.5"}),"New subfolder"]}):null,T?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ce,{onSelect:t(()=>y(j),"onSelect"),children:"Rename"}),(0,e.jsx)(Ce,{onSelect:t(()=>_(j),"onSelect"),children:"Edit color"}),(0,e.jsxs)(Ce,{onSelect:t(()=>f(j,O?"company":"my"),"onSelect"),children:[(0,e.jsx)(fi,{className:"h-3.5 w-3.5"}),"Move to ",O?"Organization":"My Skills"]}),(0,e.jsx)(ca,{}),(0,e.jsxs)(Ce,{variant:"destructive",onSelect:t(()=>v(j),"onSelect"),children:[(0,e.jsx)(pa,{className:"h-3.5 w-3.5"}),"Delete"]})]}):null]})]}):(0,e.jsx)("span",{className:"h-6 w-6"})]}),P&&h.length>0?(0,e.jsx)("div",{children:h.map(C=>(0,e.jsx)(Os,{node:C,depth:l+1,selection:i,expanded:o,renamingId:c,renameDraft:a,onToggle:x,onSelect:g,onCreateFolder:b,onEditFolder:_,onMoveFolder:f,onDeleteFolder:v,onStartRename:y,onRenameDraftChange:N,onRenameCommit:D,onRenameCancel:k},C.folder.id))}):null]})}t(Os,"TreeBranch");function Wi({result:s,selection:l,onSelect:i}){const o=(0,d.useMemo)(()=>Ye(s),[s]),c=l==="all"||l==="unfiled"?[]:an(o,l);return(0,e.jsxs)("nav",{"aria-label":"Folder path",className:"flex flex-wrap items-center gap-1 text-sm",children:[(0,e.jsxs)("button",{type:"button",onClick:t(()=>i("all"),"onClick"),className:K("inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors hover:bg-bg-3/40",l==="all"?"font-medium text-ink":"text-ink-3"),children:[(0,e.jsx)(Ql,{className:"h-3.5 w-3.5"}),"All skills"]}),l==="unfiled"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ps,{className:"h-3.5 w-3.5 text-ink-3/60"}),(0,e.jsx)("span",{className:"rounded px-1.5 py-0.5 font-medium text-ink",children:"Unfiled"})]}):null,c.map((a,m)=>{const r=m===c.length-1,x=m===0?tn(a):a.name;return(0,e.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,e.jsx)(Ps,{className:"h-3.5 w-3.5 text-ink-3/60"}),(0,e.jsxs)("button",{type:"button",onClick:t(()=>i(a.id),"onClick"),className:K("inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors hover:bg-bg-3/40",r?"font-medium text-ink":"text-ink-3"),children:[a.color?(0,e.jsx)(Ms,{color:a.color}):null,x]})]},a.id)})]})}t(Wi,"FolderBreadcrumb");function Gi({open:s,onOpenChange:l,result:i,title:o,subtitle:c,currentFolderId:a,pending:m=!1,onMove:r,onCreateFolder:x}){const g=(0,d.useMemo)(()=>Ye(i),[i]),[b,_]=(0,d.useState)(""),[f,v]=(0,d.useState)(void 0),[y,N]=(0,d.useState)(void 0),[D,k]=(0,d.useState)(""),[j,h]=(0,d.useState)(!1);(0,d.useEffect)(()=>{s&&(_(""),v(void 0),N(void 0),k(""))},[s]);const P=b.trim().toLowerCase(),A=t(M=>!P||M.name.toLowerCase().includes(P)||M.path.toLowerCase().includes(P),"matches"),T=f,X=typeof T=="string"?g.byId.get(T)??null:null,O=T===void 0?null:T===null?"Unfiled":X?.path??null;async function Q(){const M=D.trim();if(M){h(!0);try{const ee=await x(y??null,M);ee&&v(ee),N(void 0),k("")}finally{h(!1)}}}t(Q,"submitNewFolder");function C(M,ee){const{folder:Y}=M,pe=jt(Y),ae=!pe,Z=T===Y.id,Le=a===Y.id,xe=ae&&!nn(Y)&&Y.depth<4,de=M.children,S=A(Y),U=Aa(M,A);return P&&!S&&!U?null:(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:K("group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm",ae?"cursor-pointer hover:bg-bg-3/40":"cursor-not-allowed opacity-50",Z&&"bg-bg-3/70"),style:{paddingLeft:`${.5+ee*.9}rem`},onClick:t(()=>ae&&v(Y.id),"onClick"),children:[Y.systemKey&&["my","projects","bundled"].includes(Y.systemKey)?(0,e.jsx)(Xs,{className:"h-3.5 w-3.5 shrink-0 text-ink-3"}):(0,e.jsx)(Ms,{color:Y.color}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:tn(Y)}),Le?(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"current"}):null,pe?(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"read-only"}):null,Z?(0,e.jsx)(Hs,{className:"h-3.5 w-3.5"}):null,xe?(0,e.jsx)("button",{type:"button",title:"New folder inside…",className:"opacity-0 transition-opacity group-hover:opacity-100",onClick:t(se=>{se.stopPropagation(),N(Y.id),k("")},"onClick"),children:(0,e.jsx)(rn,{className:"h-3.5 w-3.5 text-ink-3"})}):null]}),y===Y.id?(0,e.jsx)(Un,{depth:ee+1,value:D,pending:j,onChange:k,onSubmit:Q,onCancel:t(()=>N(void 0),"onCancel")}):null,de.map(se=>C(se,ee+1))]},Y.id)}return t(C,"renderNode"),(0,e.jsx)(ns,{open:s,onOpenChange:l,children:(0,e.jsxs)(ss,{className:"sm:max-w-lg",children:[(0,e.jsxs)(xs,{children:[(0,e.jsx)(ts,{children:o}),c?(0,e.jsx)(hs,{children:c}):null]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-line px-2.5",children:[(0,e.jsx)(Ws,{className:"h-3.5 w-3.5 text-ink-3"}),(0,e.jsx)("input",{value:b,onChange:t(M=>_(M.target.value),"onChange"),placeholder:"Search folders",className:"h-8 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-ink-3"})]}),(0,e.jsxs)("div",{className:"max-h-72 overflow-y-auto rounded-md border border-line p-1",children:[(0,e.jsxs)("div",{className:K("flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-bg-3/40",T===null&&"bg-bg-3/70"),onClick:t(()=>v(null),"onClick"),children:[(0,e.jsx)(Ms,{color:null}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:"Unfiled"}),a==null?(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"current"}):null,T===null?(0,e.jsx)(Hs,{className:"h-3.5 w-3.5"}):null]}),g.roots.map(M=>C(M,0)),(0,e.jsx)("div",{className:"mt-1 border-t border-line pt-1",children:y===null?(0,e.jsx)(Un,{depth:0,value:D,pending:j,onChange:k,onSubmit:Q,onCancel:t(()=>N(void 0),"onCancel")}):(0,e.jsxs)("button",{type:"button",onClick:t(()=>{N(null),k("")},"onClick"),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-ink-3 hover:bg-bg-3/40 hover:text-ink",children:[(0,e.jsx)(Rs,{className:"h-3.5 w-3.5"}),"New top-level folder…"]})})]}),(0,e.jsx)("div",{className:"min-h-5 text-xs text-ink-3",children:O?(0,e.jsxs)("span",{children:["Moving to ",(0,e.jsx)("span",{className:"font-mono text-ink",children:O})]}):(0,e.jsx)("span",{children:"Pick a destination folder."})}),(0,e.jsxs)(xt,{children:[(0,e.jsx)(w,{variant:"ghost",onClick:t(()=>l(!1),"onClick"),disabled:m,children:"Cancel"}),(0,e.jsx)(w,{disabled:m||T===void 0||T===a,onClick:t(()=>T!==void 0&&r(T),"onClick"),children:m?"Moving…":"Move here"})]})]})})}t(Gi,"MoveToFolderDialog");function Aa(s,l){return l(s.folder)?!0:s.children.some(i=>Aa(i,l))}t(Aa,"subtreeMatches");function Un({depth:s,value:l,pending:i,onChange:o,onSubmit:c,onCancel:a}){return(0,e.jsxs)("div",{className:"flex items-center gap-2 py-1",style:{paddingLeft:`${.5+s*.9}rem`},children:[(0,e.jsx)(rn,{className:"h-3.5 w-3.5 shrink-0 text-ink-3"}),(0,e.jsx)(Fe,{value:l,onChange:t(m=>o(m.target.value),"onChange"),placeholder:"Folder name",autoFocus:!0,className:"h-7 flex-1 text-sm",onKeyDown:t(m=>{m.key==="Enter"&&c(),m.key==="Escape"&&a()},"onKeyDown")}),(0,e.jsx)(w,{size:"sm",variant:"ghost",onClick:a,disabled:i,children:"Cancel"}),(0,e.jsx)(w,{size:"sm",onClick:c,disabled:i||!l.trim(),children:"Add"})]})}t(Un,"InlineNewFolder");var Vn=16,Hn=24,Qn="min-h-9";function Wn(s){return(0,e.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...s,children:(0,e.jsx)("path",{d:"M12 4 21 19H3z"})})}t(Wn,"VercelMark");function Ta(s){const l=s.replace(/\r\n/g,`
1
+ var pl=Object.defineProperty;var t=(s,l)=>pl(s,"name",{value:l,configurable:!0});import{i as aa}from"./rolldown-runtime-ZpX3ckPj.js";import{Ir as fl,O as gl,l as K,la as kl,t as As,ua as jl}from"./createLucideIcon-CgrPXnTY.js";import{a as bl,n as vl,r as Xs,t as la,v as yl,y as Nl}from"./star-eem0qj3E.js";import{X as ia,_ as he,n as Zt,t as F,v as Ne}from"./queryKeys-BzT8CD34.js";import{n as wl}from"./CompanyContext-fQCNWI_f.js";import{at as Sl,dt as Tn,o as Cl,t as Pe,tt as ra}from"./router-CJbFZfVR.js";import{t as oa}from"./checkbox-Cf2_HXDG.js";import{c as ca,i as Ce,o as At,p as Cs,r as Is,s as qs,t as Fs}from"./dropdown-menu-rUbU8QKw.js";import{i as Il,r as Fl,t as Ll}from"./tabs-CjHzZxtD.js";import{c as ne,l as da,t as _l}from"./MarkdownEditor-ubJimjUH.js";import{t as qt}from"./arrow-left-CnGEiANj.js";import{t as Ie}from"./boxes-DVB7wdRh.js";import{t as Hs}from"./check-Bis3vECb.js";import{t as Ls}from"./chevron-down-nRcQ7bok.js";import{t as En}from"./chevron-left-DnUVccc_.js";import{t as Ps}from"./chevron-right-BP8JjEC_.js";import{t as ma}from"./circle-alert-C7T1cdKm.js";import{t as Dl}from"./circle-question-mark-CasEGiDp.js";import{t as Ot}from"./MarkdownBody-cPGkwwjq.js";import{t as Pl}from"./code-xml-CZhhm_-P.js";import{t as ua}from"./copy-C1cfcpxY.js";import{t as xa}from"./ellipsis-DyXbAp4P.js";import{t as us}from"./external-link-BIcMNNSN.js";import{t as Rl}from"./eye-D8HiVtuU.js";import{t as Ml}from"./file-code-corner-CwcL9g2p.js";import{t as gt}from"./file-text-CsPKrMTp.js";import{t as Al}from"./flask-conical-BxspRG7d.js";import{t as Qs}from"./folder-open-Dkshp3J4.js";import{t as Jt}from"./folder-search-B_Hz17IO.js";import{t as kt}from"./link-2-Cn4f4xsG.js";import{r as mt,t as w}from"./button-DI4w5WP7.js";import{t as Tl}from"./octagon-x-ZKE_ZOe_.js";import{t as Ut}from"./pause-B6AkvDer.js";import{t as Rs}from"./plus-CwNlqadt.js";import{t as ut}from"./refresh-cw-CfzWP9se.js";import{t as Tt}from"./save-Blub8a14.js";import{t as Ws}from"./search-CgZSuGC8.js";import{t as El}from"./settings-DuRZr7gk.js";import{t as zl}from"./shield-alert-BAXWoBTh.js";import{t as ha}from"./shield-check-RPyaLAc-.js";import{t as pa}from"./trash-QxFF084e.js";import{t as Ys}from"./triangle-alert-CnHMpmva.js";import{t as zn}from"./user-D5V640s5.js";import{t as Bl}from"./users-CEZ1U5q9.js";import{t as fa}from"./x-6E1yeU3Q.js";import{t as Kl}from"./MootMark-BZOhYsK8.js";import{i as Ze,n as Je,t as es}from"./tooltip-CW50mEoC.js";import{t as ie}from"./badge-jeXr866I.js";import{t as Bn}from"./AgentAvatar-BZiiDlCN.js";import{a as ga}from"./ToastContext-DyVJ6bCh.js";import{t as it}from"./agents-B8n-p0aX.js";import{t as $l}from"./projects-l3kQxnTp.js";import{a as xs,i as xt,n as ss,r as hs,s as ts,t as ns}from"./dialog-CeH7rDcv.js";import{t as Fe}from"./input-BBNGmECW.js";import{t as en}from"./github-icon-Cf0axVvi.js";import{n as ql}from"./BreadcrumbContext-DNbB7zWn.js";import"./AgentIdentity-DBHRFgMM.js";import{t as Vt}from"./textarea-CTx68BDs.js";import{t as Ol}from"./InlineBanner-DeTqU5Gp.js";import{t as ka}from"./AgentMultiSelect-BlUaNdZZ.js";import{t as Ul}from"./use-adapter-capabilities-BNfGiTEP.js";import{t as Vl}from"./use-copy-action-DFzauB4H.js";import{Br as Hl,Fa as ja,Ka as Ql,La as ba,T as Oe,Vr as Wl,Wa as Gl,Za as Ht,_ as Ue,no as Qt}from"./index-QhteFtm-.js";import{a as rt,c as Xl,i as Yl,l as va,n as Zl,o as Et,r as zt,t as sn,u as ya}from"./SkillCardIcon-Byzb3JuD.js";import{t as Jl}from"./CopyText-BbOm2I6t.js";import{t as ei}from"./line-diff-DAcZgvm2.js";import{t as si}from"./SkillBinaryFile-N7sK2ZTh.js";import{_ as ti,a as ni,b as Ye,c as ai,d as li,g as tn,h as nn,i as ii,l as ri,m as jt,n as oi,p as an,r as ci,s as Ms,t as di,u as mi,v as Na,x as De,y as ui}from"./FolderControls-DI7QVvPv.js";import{a as ln,i as Kn,n as xi,o as hi,r as Us,t as pi}from"./company-skill-routes-D5LJ1l8M.js";var wa={name:"file-exclamation-point",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["file-warning"]};wa.node;var Sa=As(wa),Ca={name:"folder-input",size:24,node:[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]};Ca.node;var Ia=As(Ca),Fa={name:"folder-plus",size:24,node:[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};Fa.node;var rn=As(Fa),La={name:"git-fork",size:24,node:[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]};La.node;var _s=As(La),_a={name:"move-right",size:24,node:[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]};_a.node;var fi=As(_a),Da={name:"pin",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]};Da.node;var gi=As(Da),e=aa(kl(),1);function ki({skill:s}){const l=s.metadata?.skillSourceId??s.metadata?.legacySkillSourceId;if(typeof l!="string")return null;const i=s.metadata?.skillSourceState,o=s.metadata?.skillSourceId?i==="removed"?"Removed from source · last installed version retained":i==="not_syncing"?"Not syncing · installed copy retained":i==="update_failed"?"Update failed · last installed version retained":"Synced from GitHub":"Refresh this source to sync all files";return(0,e.jsxs)("div",{className:"flex flex-col gap-1 py-3 text-xs text-ink-3",children:[(0,e.jsx)("span",{children:o}),(0,e.jsxs)("span",{className:"break-all font-mono",children:[String(s.metadata?.skillSourcePath??""),s.sourceRef?` · ${s.sourceRef.slice(0,8)}`:""]}),(0,e.jsx)(Pe,{to:`/skills/sources/${l}`,className:"text-ink underline",children:"Manage source"})]})}t(ki,"SkillSourceProvenance");var d=aa(jl(),1);var ji=["skill_authentication_required","skill_company_boundary_denied","skill_workspace_boundary_denied","skill_source_validation_failed","skill_unsafe_content_blocked","skill_secret_handling_blocked","skill_actor_restricted"];var bi="An organization administrator can change the skill policy to allow this.",vi="This requires organization administration access. Ask an administrator to make this change.",yi={skill_authentication_required:"Sign in to manage skills.",skill_company_boundary_denied:"This skill belongs to another organization.",skill_workspace_boundary_denied:"This skill source is outside an allowed workspace.",skill_source_validation_failed:"This skill source failed validation.",skill_unsafe_content_blocked:"This skill contains unsafe content.",skill_secret_handling_blocked:"This skill exposes a secret value.",skill_actor_restricted:"This action isn't available for the current actor."},Ni={skill_authentication_required:"Sign in and try again.",skill_company_boundary_denied:"Open the skill from the organization that owns it.",skill_workspace_boundary_denied:"Import from a configured Wardmote workspace or the organization managed-skill directory.",skill_source_validation_failed:"Fix the flagged source and retry.",skill_unsafe_content_blocked:"Remove the fetch-and-execute or unsafe pattern before saving.",skill_secret_handling_blocked:"Remove the secret value before saving.",skill_actor_restricted:"Retry from an account with access to this action."};function wi(s){return s&&typeof s=="object"?s:null}t(wi,"asRecord");function Bt(s){return typeof s=="string"&&s.trim().length>0?s:null}t(Bt,"asString");function Si(s,l){if(!(s instanceof Zt))return null;const i=wi(s.body),o=Bt(i?.code),c=Bt(i?.reason),a=Bt(i?.remediation);return o==="skill_policy_denied"||c==="explicit_rule"||c==="policy_default"?{state:"policy",code:o,reason:c,title:l?`${l} is restricted by your organization policy.`:"This action is restricted by your organization policy.",remediation:a??bi}:o==="skill_policy_admin_required"?{state:"platform_admin",code:o,reason:c,title:"This change needs administration access.",remediation:a??vi}:o!==null&&ji.includes(o)||c==="platform_invariant"?{state:"platform",code:o,reason:c,title:(o&&yi[o])??"This action is blocked by a platform safety rule.",remediation:a??(o&&Ni[o])??"Fix the flagged issue and try again."}:null}t(Si,"classifySkillDenial");function Ci(){const[s,l]=(0,d.useState)(null);return{denial:s,capture:(0,d.useCallback)((i,o)=>{const c=Si(i,o);return c?(l(c),!0):!1},[]),reset:(0,d.useCallback)(()=>l(null),[])}}t(Ci,"useSkillPolicyDenial");function Ii({denial:s,onDismiss:l,className:i}){const o=l?(0,e.jsx)(w,{variant:"ghost",size:"sm",onClick:l,children:"Dismiss"}):void 0;return(0,e.jsx)(Ol,{tone:"warning",icon:s.state==="policy"?ha:Ys,title:s.title,actions:o,className:i,children:(0,e.jsx)("p",{children:s.remediation})})}t(Ii,"SkillPolicyDenialNotice");var ht=["./skills",".agents/skills",".claude/skills",".codex/skills",".cursor/skills"],Pa=34;function Ds(s,l){return`${s} ${l}`}t(Ds,"selectionKey");function Fi(s){return s.sourceType==="remote_managed"?!1:typeof s.cwd=="string"&&s.cwd.trim().length>0}t(Fi,"isScannableWorkspace");function Ra(s){return s.workspaces.filter(Fi)}t(Ra,"scannableWorkspaces");function Li(s){switch(s){case"git_repo":return"git";case"local_path":return"local";case"non_git_path":return"folder";case"remote_managed":return"remote";default:return s}}t(Li,"workspaceKindLabel");function _i(s){return Array.from(new Set(s.map(l=>Li(l.sourceType)))).join(", ")}t(_i,"summarizeWorkspaceKinds");function dt(s){return s.status==="new"||s.status==="conflict"}t(dt,"isSelectableCandidate");function Di(s,l){const i=l.trim().toLowerCase();return i?s.filter(o=>[o.name,o.slug,o.description,o.relativePath,o.workspaceName,o.directoryRoot,o.status].some(c=>c?.toLowerCase().includes(i))):s}t(Di,"filterCandidates");function Pi(s,l=[]){const i=new Map(l.map(c=>[c.id,c])),o=new Map;for(const c of s){let a=o.get(c.workspaceId);a||(a={key:c.workspaceId,workspaceId:c.workspaceId,workspaceName:c.workspaceName,isPrimary:i.get(c.workspaceId)?.isPrimary??!1,directories:[]},o.set(c.workspaceId,a));let m=a.directories.find(r=>r.directoryRoot===c.directoryRoot);m||(m={key:`${c.workspaceId} ${c.directoryRoot}`,directoryRoot:c.directoryRoot,candidates:[]},a.directories.push(m)),m.candidates.push(c)}return Array.from(o.values()).map(c=>({...c,directories:c.directories.sort((a,m)=>a.directoryRoot.localeCompare(m.directoryRoot))})).sort((c,a)=>c.isPrimary!==a.isPrimary?c.isPrimary?-1:1:c.workspaceName.localeCompare(a.workspaceName))}t(Pi,"groupCandidates");function Ri(s){return new Map}t(Ri,"defaultSelection");function Mi(s){const l=new Map;for(const i of s)i.status==="new"&&l.set(Ds(i.workspaceId,i.relativePath),{workspaceId:i.workspaceId,path:i.relativePath});return l}t(Mi,"selectAllSelection");function $n(s){return`${s.slug}-copy`}t($n,"suggestedConflictSlug");function Wt(s){if(s.slug===void 0)return!0;const l=s.slug.trim();return!!l&&fl(l)===l}t(Wt,"isValidSelectionSlug");function Gs(s){return s instanceof Zt?s.message||`Request failed: ${s.status}`:s instanceof Error?s.message:"Unexpected error"}t(Gs,"readableErrorMessage");function Ai(s){return s instanceof Zt?s.status===403:!1}t(Ai,"isGrantError");function Ti({status:s}){switch(s){case"already_imported":return(0,e.jsxs)(ie,{variant:"outline",className:"gap-1 px-1.5 py-0 font-normal text-ink-3 border-line/60",children:[(0,e.jsx)(kt,{className:"h-3 w-3"})," Imported"]});case"conflict":return(0,e.jsxs)(ie,{variant:"outline",className:"gap-1 px-1.5 py-0 font-normal text-amber-600 border-amber-500/40 dark:text-amber-400",children:[(0,e.jsx)(Ys,{className:"h-3 w-3"})," Conflict"]});case"skipped":return(0,e.jsxs)(ie,{variant:"outline",className:"gap-1 px-1.5 py-0 font-normal text-ink-3 border-line/60",children:[(0,e.jsx)(Sa,{className:"h-3 w-3"})," Skipped"]});default:return(0,e.jsxs)(ie,{variant:"outline",className:"gap-1 px-1.5 py-0 font-normal text-emerald-600 border-emerald-500/40 dark:text-emerald-400",children:[(0,e.jsx)(bl,{className:"h-3 w-3"})," New"]})}}t(Ti,"CandidateStatusBadge");function Ei({open:s,onOpenChange:l,companyId:i,onImportFromPath:o}){const c=ia(),a=ga(),[m,r]=(0,d.useState)("pick"),[x,g]=(0,d.useState)(""),[b,_]=(0,d.useState)(""),[f,v]=(0,d.useState)(null),[y,N]=(0,d.useState)(null),[D,k]=(0,d.useState)(null),[j,h]=(0,d.useState)(new Map),[P,A]=(0,d.useState)(null),[T,X]=(0,d.useState)(!1),[O,Q]=(0,d.useState)(null),C=(0,d.useRef)(0),M=Ne({queryKey:F.projects.list(i),queryFn:t(()=>$l.list(i),"queryFn"),enabled:s});(0,d.useEffect)(()=>{s&&(r("pick"),g(""),_(""),v(null),N(null),k(null),h(new Map),A(null),X(!1),Q(null),C.current+=1)},[s]);const ee=M.data??[],Y=(0,d.useMemo)(()=>{const L=x.trim().toLowerCase(),H=[...ee].sort((W,le)=>W.name.localeCompare(le.name));return L?H.filter(W=>W.name.toLowerCase().includes(L)):H},[ee,x]);function pe(L){v(L),N(null),k(null),h(new Map),r("scanning");const H=++C.current;ne.scanProjects(i,{projectIds:[L.id],mode:"preview"}).then(W=>{H===C.current&&(N(W),h(Ri(W.candidates)),r("select"))}).catch(W=>{H===C.current&&(k(W),r("select"))})}t(pe,"startScan");const ae=he({mutationFn:t(()=>{if(!f)throw new Error("No project selected.");const L=Array.from(j.values());return ne.scanProjects(i,{projectIds:[f.id],mode:"import",selection:L})},"mutationFn"),onSuccess:t(async L=>{A(L),r("result"),await c.invalidateQueries({queryKey:F.companySkills.list(i)});const H=L.imported.length;a.pushToast({tone:H>0?"success":"warn",title:H>0?"Skills imported":"Nothing imported",body:H>0?`${H} skill${H===1?"":"s"} imported as references from ${f?.name??"the project"}.`:"No skills were imported."})},"onSuccess"),onError:t(L=>{a.pushToast({tone:"error",title:"Import failed",body:Gs(L)})},"onError")}),Z=y?.candidates??[],Le=(0,d.useMemo)(()=>Z.filter(dt),[Z]),xe=(0,d.useMemo)(()=>Di(Z,b),[b,Z]),de=(0,d.useMemo)(()=>Pi(xe,f?.workspaces??[]),[xe,f]),S=j.size,U=Array.from(j.values()).some(L=>!Wt(L));function se(L){dt(L)&&h(H=>{const W=new Map(H),le=Ds(L.workspaceId,L.relativePath);return W.has(le)?W.delete(le):W.set(le,{workspaceId:L.workspaceId,path:L.relativePath,...L.status==="conflict"?{slug:$n(L)}:{}}),W})}t(se,"toggleCandidate");function Re(L,H){h(W=>{const le=new Map(W),te=Ds(L.workspaceId,L.relativePath),re=le.get(te);return re?(le.set(te,{...re,slug:H}),le):W})}t(Re,"renameCandidate");async function Me(L,H){if(!f)return;const W=H.toLowerCase().endsWith("/skill.md")?H.slice(0,-9)||".":H.toLowerCase()==="skill.md"?".":H,le=Ds(L,W);Q(le);try{const te=await ne.scanProjects(i,{projectIds:[f.id],mode:"preview",selection:[{workspaceId:L,path:W}]});N(te);const re=te.candidates.find(G=>G.workspaceId===L&&G.relativePath===W);re&&dt(re)?(h(G=>{const ge=new Map(G);return ge.set(le,{workspaceId:L,path:W,...re.status==="conflict"?{slug:$n(re)}:{}}),ge}),X(!1)):a.pushToast({tone:"warn",title:re?.status==="already_imported"?"Skill already imported":"Skill could not be added",body:re?.reason??"The selected folder does not contain a valid SKILL.md file."})}catch(te){a.pushToast({tone:"error",title:"Could not inspect skill",body:Gs(te)})}finally{Q(null)}}t(Me,"addBrowsedSkill");function ps(){h(Mi(Z))}t(ps,"selectAll");function as(){h(new Map)}t(as,"deselectAll");function we(){ae.isPending||l(!1)}t(we,"handleClose");function Ae(){C.current+=1,v(null),N(null),k(null),_(""),h(new Map),r("pick")}return t(Ae,"backToPick"),(0,e.jsx)(ns,{open:s,onOpenChange:t(L=>{L?l(!0):we()},"onOpenChange"),children:(0,e.jsxs)(ss,{showCloseButton:!1,className:"flex max-h-(--sz-85vh) flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl","data-testid":"import-skills-from-project-dialog",children:[(0,e.jsxs)("header",{className:"flex shrink-0 items-start justify-between gap-3 border-b border-line/60 px-5 py-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(ts,{className:"text-base font-semibold",children:"Import skills from project"}),(0,e.jsx)(hs,{className:"text-xs text-ink-3",children:"Pick a project, scan its workspaces for skills, and import them as references."})]}),(0,e.jsx)("button",{type:"button",className:"rounded-sm text-ink-3 opacity-70 transition-opacity hover:opacity-100",onClick:we,"aria-label":"Close import dialog",children:(0,e.jsx)(fa,{className:"h-4 w-4"})})]}),(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden","aria-live":"polite",children:[m==="pick"&&(0,e.jsx)(zi,{loading:M.isLoading,error:M.error,projects:Y,totalProjects:ee.length,filter:x,onFilterChange:g,onPick:pe}),m==="scanning"&&(0,e.jsx)(Bi,{projectName:f?.name??""}),m==="select"&&(0,e.jsx)($i,{scanError:D,onRetry:t(()=>f&&pe(f),"onRetry"),onImportFromPath:o,groups:de,totalCandidates:Z.length,filter:b,onFilterChange:_,selection:j,toggleCandidate:se,renameCandidate:Re,project:f,companyId:i,browseOpen:T,onBrowseOpenChange:X,onAddBrowsedSkill:Me,browseAddingKey:O}),m==="result"&&P&&(0,e.jsx)(qi,{result:P})]}),(0,e.jsxs)("footer",{className:"flex shrink-0 flex-col gap-2 border-t border-line/60 bg-bg-3/20 px-5 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-3",children:[m==="select"&&!D&&Z.length>0?(0,e.jsx)("div",{className:"min-w-0 flex-1 text-xs text-ink-3",children:(0,e.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(kt,{className:"h-3.5 w-3.5 shrink-0"}),"Files stay in the project — Studio edits save directly to them."]})}):(0,e.jsx)("div",{className:"hidden min-w-0 flex-1 sm:block"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2 sm:shrink-0",children:[m==="select"&&(0,e.jsxs)(e.Fragment,{children:[!D&&Z.length>0&&(0,e.jsxs)("div",{className:"mr-1 flex items-center gap-1",children:[(0,e.jsx)(w,{variant:"ghost",size:"sm",onClick:ps,disabled:Le.length===0,"data-testid":"select-all",children:"Select all"}),(0,e.jsx)(w,{variant:"ghost",size:"sm",onClick:as,disabled:S===0,"data-testid":"deselect-all",children:"Deselect all"})]}),(0,e.jsxs)(w,{variant:"secondary",size:"sm",onClick:Ae,children:[(0,e.jsx)(qt,{className:"mr-1 h-3.5 w-3.5"})," Back"]}),!D&&Z.length>0&&(0,e.jsx)(w,{size:"sm",onClick:t(()=>ae.mutate(),"onClick"),disabled:S===0||U||ae.isPending,"data-testid":"import-skills",children:ae.isPending?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(mt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"})," Importing…"]}):`Import ${S} skill${S===1?"":"s"}`})]}),m==="pick"&&(0,e.jsx)(w,{variant:"ghost",size:"sm",onClick:we,children:"Cancel"}),m==="result"&&(0,e.jsx)(w,{size:"sm",onClick:we,children:"Done"})]})]})]})})}t(Ei,"ImportSkillsFromProjectDialog");function zi({loading:s,error:l,projects:i,totalProjects:o,filter:c,onFilterChange:a,onPick:m}){return(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,e.jsx)("div",{className:"border-b border-line/60 px-5 py-3",children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)(Ws,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-3"}),(0,e.jsx)(Fe,{value:c,onChange:t(r=>a(r.target.value),"onChange"),placeholder:"Filter projects",className:"pl-7 text-xs","aria-label":"Filter projects","data-testid":"project-filter"})]})}),(0,e.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:s?(0,e.jsx)("div",{className:"p-6 text-center text-sm text-ink-3",children:"Loading projects…"}):l?(0,e.jsxs)("div",{className:"m-5 flex items-start gap-3 rounded-md border border-bad/40 bg-bad/10 p-4 text-sm text-bad",role:"alert",children:[(0,e.jsx)(ma,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,e.jsx)("div",{children:Gs(l)})]}):o===0?(0,e.jsx)(Oe,{icon:ra,message:"This organization has no projects yet."}):i.length===0?(0,e.jsx)(Oe,{icon:Ws,message:`No projects match "${c}".`}):(0,e.jsx)("ul",{className:"divide-y divide-line/60","data-testid":"project-list",children:i.map(r=>{const x=Ra(r),g=x.length===0,b=_i(r.workspaces);return(0,e.jsx)("li",{children:(0,e.jsxs)("button",{type:"button",className:K("flex w-full items-center gap-3 px-5 py-3 text-left transition-colors",g?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-bg-3/40"),onClick:t(()=>!g&&m(r),"onClick"),disabled:g,"aria-disabled":g,"data-testid":`project-row-${r.id}`,"data-disabled":g?"true":"false",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("div",{className:"truncate text-sm font-medium",children:r.name}),(0,e.jsxs)("div",{className:"mt-0.5 text-xs text-ink-3",children:[r.workspaces.length," workspace",r.workspaces.length===1?"":"s",b?` · ${b}`:""]}),g&&(0,e.jsx)("div",{className:"mt-1 text-(length:--text-micro) text-ink-3",children:"Remote-only project — no locally scannable workspaces to import from."})]}),!g&&(0,e.jsxs)(ie,{variant:"outline",className:"shrink-0 px-1.5 py-0 font-normal",children:[x.length," scannable"]})]})},r.id)})})})]})}t(zi,"PickProjectStep");function Bi({projectName:s}){return(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4 p-8 text-center","data-testid":"scanning-step",children:[(0,e.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,e.jsx)(Jt,{className:"h-10 w-10 text-ink-3/60"}),(0,e.jsx)(mt,{className:"h-5 w-5 animate-spin text-ink-3"})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("p",{className:"text-sm font-medium",children:["Scanning ",s||"project"," for skills…"]}),(0,e.jsx)("p",{className:"mt-1 text-xs text-ink-3",children:"Looking in well-known skill folders across each workspace."})]}),(0,e.jsxs)("div",{className:"flex max-w-md flex-wrap justify-center gap-1.5",children:[ht.map(l=>(0,e.jsx)(ie,{variant:"outline",className:"px-1.5 py-0 font-mono text-(length:--text-micro) font-normal text-ink-3",children:l},l)),(0,e.jsxs)(ie,{variant:"outline",className:"px-1.5 py-0 text-(length:--text-micro) font-normal text-ink-3",children:["+",Pa-ht.length," more"]})]})]})}t(Bi,"ScanningStep");function Ki({companyId:s,project:l,onBack:i,onAddSkill:o,addingKey:c}){const a=Ra(l),m=a.find(y=>y.isPrimary)??a[0]??null,[r,x]=(0,d.useState)(m?.id??""),[g,b]=(0,d.useState)("."),_=Ne({queryKey:["company-skills","browse-project",s,l.id,r,g],queryFn:t(()=>ne.browseProject(s,{projectId:l.id,workspaceId:r,path:g}),"queryFn"),enabled:!!r}),f=_.data;function v(y){x(y),b(".")}return t(v,"changeWorkspace"),(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"project-skill-browser",children:[(0,e.jsxs)("div",{className:"shrink-0 border-b border-line/60 px-5 py-3",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:"Browse project folders"}),(0,e.jsx)("p",{className:"mt-0.5 text-xs text-ink-3",children:"Open any folder and add directories or individual SKILL.md files."})]}),(0,e.jsxs)(w,{variant:"secondary",size:"sm",onClick:i,children:[(0,e.jsx)(qt,{className:"mr-1 h-3.5 w-3.5"})," Discovered skills"]})]}),a.length>1&&(0,e.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5","aria-label":"Project workspace",children:a.map(y=>(0,e.jsx)(w,{type:"button",variant:y.id===r?"secondary":"ghost",size:"sm",onClick:t(()=>v(y.id),"onClick"),children:y.name},y.id))})]}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-line/60 bg-bg-3/20 px-5 py-2",children:[(0,e.jsx)(w,{variant:"ghost",size:"sm",onClick:t(()=>f?.parentPath&&b(f.parentPath),"onClick"),disabled:!f?.parentPath,"aria-label":"Open parent folder",children:(0,e.jsx)(qt,{className:"h-3.5 w-3.5"})}),(0,e.jsx)("span",{className:"min-w-0 truncate font-mono text-xs text-ink-3",children:f?.path??g})]}),(0,e.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[_.isLoading?(0,e.jsxs)("div",{className:"flex items-center justify-center gap-2 p-8 text-sm text-ink-3",children:[(0,e.jsx)(mt,{className:"h-4 w-4 animate-spin"})," Loading folder…"]}):_.error?(0,e.jsx)("div",{className:"p-6 text-sm text-bad",children:Gs(_.error)}):f?.entries.length?(0,e.jsx)("ul",{className:"divide-y divide-line/60",children:f.entries.map(y=>{const N=y.kind==="file"?y.path.toLowerCase()==="skill.md"?".":y.path.slice(0,-9):y.path,D=Ds(r,N);return(0,e.jsxs)("li",{className:"flex items-center gap-3 px-5 py-2.5",children:[y.kind==="directory"?(0,e.jsx)(Xs,{className:"h-4 w-4 shrink-0 text-ink-3"}):(0,e.jsx)(gt,{className:"h-4 w-4 shrink-0 text-ink-3"}),(0,e.jsx)("button",{type:"button",className:K("min-w-0 flex-1 truncate text-left text-sm",y.kind==="directory"&&"font-medium hover:underline"),onClick:t(()=>y.kind==="directory"&&b(y.path),"onClick"),disabled:y.kind==="file",children:y.name}),y.isSkill?(0,e.jsx)(w,{size:"sm",onClick:t(()=>o(r,y.path),"onClick"),disabled:c===D,children:c===D?(0,e.jsx)(mt,{className:"h-3.5 w-3.5 animate-spin"}):"Add skill"}):y.kind==="directory"?(0,e.jsx)(Ps,{className:"h-4 w-4 text-ink-3"}):null]},y.path)})}):(0,e.jsx)("div",{className:"p-8 text-center text-sm text-ink-3",children:"This folder is empty."}),f?.truncated&&(0,e.jsx)("p",{className:"border-t border-line/60 px-5 py-2 text-xs text-ink-3",children:"Showing the first 250 entries."})]})]})}t(Ki,"ProjectSkillBrowser");function $i({scanError:s,onRetry:l,onImportFromPath:i,groups:o,totalCandidates:c,filter:a,onFilterChange:m,selection:r,toggleCandidate:x,renameCandidate:g,project:b,companyId:_,browseOpen:f,onBrowseOpenChange:v,onAddBrowsedSkill:y,browseAddingKey:N}){if(s){const D=Ai(s);return(0,e.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6","data-testid":"scan-error",children:(0,e.jsxs)("div",{className:"max-w-md text-center",children:[(0,e.jsx)("div",{className:"mx-auto mb-4 w-fit bg-bg-3/50 p-4",children:D?(0,e.jsx)(zl,{className:"h-10 w-10 text-ink-3/60"}):(0,e.jsx)(ma,{className:"h-10 w-10 text-ink-3/60"})}),(0,e.jsx)("p",{className:"text-base font-semibold",children:D?"You can't import skills here":"Scan failed"}),(0,e.jsx)("p",{className:"mt-1.5 text-sm text-ink-3",children:D?"Your account doesn't have permission to add skills to this organization. Ask an owner to grant the skills permission, then try again.":Gs(s)}),!D&&(0,e.jsx)(w,{variant:"secondary",size:"sm",className:"mt-4",onClick:l,children:"Try again"})]})})}return f&&b?(0,e.jsx)(Ki,{companyId:_,project:b,onBack:t(()=>v(!1),"onBack"),onAddSkill:y,addingKey:N}):c===0?(0,e.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6","data-testid":"select-empty",children:(0,e.jsxs)("div",{className:"max-w-md text-center",children:[(0,e.jsx)("div",{className:"mx-auto mb-4 w-fit bg-bg-3/50 p-4",children:(0,e.jsx)(Jt,{className:"h-10 w-10 text-ink-3/50"})}),(0,e.jsx)("p",{className:"text-base font-semibold",children:"No skills found"}),(0,e.jsxs)("p",{className:"mt-1.5 text-sm text-ink-3",children:["None of the well-known skill folders in this project's workspaces contain a"," ",(0,e.jsx)("code",{className:"rounded bg-bg-3 px-1 py-0.5 text-xs",children:"SKILL.md"}),". We searched"," ",ht.join(", ")," and ",Pa-ht.length," ","other agent-harness folders."]}),(0,e.jsxs)(w,{variant:"secondary",size:"sm",className:"mt-4",onClick:t(()=>v(!0),"onClick"),"data-testid":"browse-project-folders-empty",children:[(0,e.jsx)(Qs,{className:"mr-1.5 h-3.5 w-3.5"})," Browse project folders"]}),i&&(0,e.jsxs)("p",{className:"mt-3 text-sm text-ink-3",children:["For skills in non-standard folders, use"," ",(0,e.jsx)("button",{type:"button",className:"font-medium text-ink underline underline-offset-2",onClick:i,children:"Import from path or URL"}),"."]})]})}):(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"candidate-list",children:[(0,e.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-line/60 px-5 py-2.5",children:[(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Choose discovered skills, or browse any workspace folder."}),(0,e.jsxs)(w,{variant:"secondary",size:"sm",onClick:t(()=>v(!0),"onClick"),"data-testid":"browse-project-folders",children:[(0,e.jsx)(Qs,{className:"mr-1.5 h-3.5 w-3.5"})," Browse folders"]})]}),(0,e.jsx)("div",{className:"shrink-0 border-b border-line/60 px-5 py-2.5",children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)(Ws,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-3"}),(0,e.jsx)(Fe,{value:a,onChange:t(D=>m(D.target.value),"onChange"),placeholder:"Search discovered skills…",className:"h-8 pl-8 text-xs","aria-label":"Search discovered skills"})]})}),(0,e.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o.length===0?(0,e.jsxs)("div",{className:"flex h-full items-center justify-center p-6 text-sm text-ink-3",children:["No skills match “",a.trim(),"”."]}):o.map((D,k)=>(0,e.jsxs)("section",{children:[k>0&&!D.isPrimary&&o[k-1]?.isPrimary&&(0,e.jsx)("header",{className:"border-y border-line/60 bg-bg-3/30 px-5 py-2 text-xs uppercase tracking-wide text-ink-3",children:"Other Workspaces"}),(0,e.jsx)("header",{className:"sticky top-0 z-10 border-b border-line/60 bg-bg px-5 py-2 text-sm font-medium text-ink",children:D.workspaceName}),D.directories.map(j=>(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"bg-bg-3/30 px-5 py-1.5 font-mono text-(length:--text-micro) text-ink-3",children:j.directoryRoot}),(0,e.jsx)("ul",{className:"divide-y divide-line/60",children:j.candidates.map(h=>{const P=dt(h),A=Ds(h.workspaceId,h.relativePath),T=r.has(A),X=r.get(A);return(0,e.jsxs)("li",{className:K("flex items-start gap-3 px-5 py-2.5 transition-colors",P?"cursor-pointer hover:bg-bg-3/40":"opacity-70",T&&"bg-bg-3/50"),onClick:t(()=>x(h),"onClick"),"data-testid":`candidate-${h.relativePath}`,"data-status":h.status,"data-selected":T?"true":"false",children:[(0,e.jsx)("div",{className:"pt-0.5",onClick:t(O=>O.stopPropagation(),"onClick"),children:(0,e.jsx)(oa,{checked:T,onCheckedChange:t(()=>x(h),"onCheckedChange"),disabled:!P,"aria-label":`Select ${h.name}`})}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[(0,e.jsx)("span",{className:"min-w-0 truncate text-sm font-medium",children:h.name}),(0,e.jsx)(Ti,{status:h.status})]}),h.description&&(0,e.jsx)("p",{className:"mt-0.5 line-clamp-2 text-xs text-ink-3",children:h.description}),(0,e.jsx)("p",{className:"mt-0.5 font-mono text-(length:--text-micro) text-ink-3",children:h.relativePath}),h.reason&&(0,e.jsx)("p",{className:K("mt-0.5 text-(length:--text-micro)",h.status==="conflict"?"text-amber-600 dark:text-amber-400":"text-ink-3"),children:h.reason}),h.status==="conflict"&&T&&(0,e.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",onClick:t(O=>O.stopPropagation(),"onClick"),children:[(0,e.jsx)("label",{htmlFor:`rename-${h.workspaceId}-${h.slug}`,className:"shrink-0 text-xs text-ink-3",children:"Import as"}),(0,e.jsx)(Fe,{id:`rename-${h.workspaceId}-${h.slug}`,value:X?.slug??"",onChange:t(O=>g(h,O.target.value),"onChange"),className:"h-7 max-w-xs font-mono text-xs","aria-label":`Rename ${h.name}`,"aria-invalid":X?!Wt(X):void 0}),X&&!Wt(X)&&(0,e.jsx)("span",{className:"text-xs text-bad",children:"Use a lowercase URL-safe slug."})]})]})]},`${h.workspaceId} ${h.relativePath}`)})})]},j.key))]},D.key))})]})}t($i,"SelectStep");function qi({result:s}){const l=(0,d.useMemo)(()=>[...s.imported,...s.updated],[s]);return(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,e.jsxs)("div",{className:"border-b border-line/60 px-5 py-4","data-testid":"result-summary",children:[(0,e.jsxs)("div",{className:"flex items-start gap-3 rounded-md border border-emerald-500/30 bg-emerald-500/5 p-3",children:[(0,e.jsx)(kt,{className:"mt-0.5 h-4 w-4 shrink-0 text-emerald-600 dark:text-emerald-400"}),(0,e.jsxs)("div",{className:"text-xs leading-relaxed text-ink-3",children:[(0,e.jsx)("span",{className:"font-medium text-ink",children:"No files were copied."})," These skills reference the files in the project workspace — editing them in Skill Studio saves directly back to those files."]})]}),(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-ink-3",children:[(0,e.jsxs)("span",{className:"text-emerald-600 dark:text-emerald-400",children:["✓ ",s.imported.length," imported"]}),s.updated.length>0&&(0,e.jsxs)("span",{children:["↻ ",s.updated.length," updated"]}),s.skipped.length>0&&(0,e.jsxs)("span",{children:["⊘ ",s.skipped.length," skipped"]})]})]}),(0,e.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[l.length>0&&(0,e.jsxs)("section",{children:[(0,e.jsxs)("header",{className:"bg-bg-3/30 px-5 py-1.5 text-xs uppercase tracking-wide text-ink-3",children:["Imported · ",l.length]}),(0,e.jsx)("ul",{className:"divide-y divide-line/60","data-testid":"result-imported",children:l.map(i=>(0,e.jsxs)("li",{className:"flex items-center gap-3 px-5 py-2.5 text-sm",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("div",{className:"truncate font-medium",children:i.name}),i.description&&(0,e.jsx)("div",{className:"truncate text-xs text-ink-3",children:i.description})]}),(0,e.jsxs)(Pe,{to:ln(i.id),className:"inline-flex shrink-0 items-center gap-1 text-xs font-medium text-ink no-underline hover:underline",children:["Open ",(0,e.jsx)(us,{className:"h-3 w-3"})]})]},i.id))})]}),s.skipped.length>0&&(0,e.jsxs)("section",{children:[(0,e.jsxs)("header",{className:"bg-bg-3/30 px-5 py-1.5 text-xs uppercase tracking-wide text-ink-3",children:["Skipped · ",s.skipped.length]}),(0,e.jsx)("ul",{className:"divide-y divide-line/60","data-testid":"result-skipped",children:s.skipped.map((i,o)=>(0,e.jsxs)("li",{className:"flex items-start gap-2 px-5 py-2.5 text-xs",children:[(0,e.jsx)(Sa,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-ink-3"}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"font-mono text-ink-3",children:i.path??"—"}),i.reason&&(0,e.jsx)("span",{className:"ml-2 text-ink-3",children:i.reason})]})]},`${i.workspaceId??"?"}-${i.path??o}`))})]}),s.warnings.length>0&&(0,e.jsxs)("section",{children:[(0,e.jsxs)("header",{className:"bg-bg-3/30 px-5 py-1.5 text-xs uppercase tracking-wide text-ink-3",children:["Warnings · ",s.warnings.length]}),(0,e.jsx)("ul",{className:"divide-y divide-line/60","data-testid":"result-warnings",children:s.warnings.map((i,o)=>(0,e.jsxs)("li",{className:"flex items-start gap-2 px-5 py-2.5 text-xs",children:[(0,e.jsx)(Ys,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500"}),(0,e.jsx)("span",{className:"text-ink-3",children:i})]},o))})]})]})]})}t(qi,"ResultStep");var ot=288,Gt=224,Xt=400,qn=16,Ma="wardmote.skills.folderRail.width";function pt(s){return Math.min(Xt,Math.max(Gt,s))}t(pt,"clampFolderRailWidth");function Oi(){if(typeof window>"u")return ot;try{const s=window.localStorage.getItem(Ma);if(!s)return ot;const l=Number.parseInt(s,10);return Number.isFinite(l)?pt(l):ot}catch{return ot}}t(Oi,"readStoredFolderRailWidth");function On(s){if(!(typeof window>"u"))try{window.localStorage.setItem(Ma,String(pt(s)))}catch{}}t(On,"writeStoredFolderRailWidth");function Ui(s){return!s.systemKey&&!jt(s)&&!nn(s)}t(Ui,"folderIsEditable");function Vi(s,l){return an(s,l).map(i=>i.id).filter(i=>i!==l)}t(Vi,"ancestorIds");function Hi({result:s,selection:l,loading:i=!1,tags:o,activeTag:c,onSelect:a,onSelectTag:m,onCreateFolder:r,onRenameFolder:x,onEditFolder:g,onMoveFolder:b,onDeleteFolder:_,onEnsureMyFolder:f}){const v=(0,d.useMemo)(()=>Ye(s),[s]),[y,N]=(0,d.useState)(()=>new Set),[D,k]=(0,d.useState)(null),[j,h]=(0,d.useState)(""),[P,A]=(0,d.useState)(Oi),[T,X]=(0,d.useState)(!1),O=(0,d.useRef)(P),Q=(0,d.useRef)(null);(0,d.useEffect)(()=>{if(l==="all"||l==="unfiled")return;const S=Vi(v,l);S.length!==0&&N(U=>{const se=new Set(U);let Re=!1;for(const Me of S)se.has(Me)||(se.add(Me),Re=!0);return Re?se:U})},[v,l]);function C(S){N(U=>{const se=new Set(U);return se.has(S)?se.delete(S):se.add(S),se})}t(C,"toggle");function M(S){k(S.id),h(S.name)}t(M,"startRename");function ee(S){const U=j.trim();U&&U!==S.name&&x(S,U),k(null)}t(ee,"commitRename");const Y=s?.allCount??0,pe=s?.unfiledCount??0,ae=(0,d.useCallback)(S=>{const U=pt(S);O.current=U,A(U),On(U)},[]),Z=(0,d.useCallback)(S=>{S.preventDefault(),S.currentTarget.setPointerCapture(S.pointerId),Q.current={startX:S.clientX,startWidth:O.current},X(!0)},[]),Le=(0,d.useCallback)(S=>{if(!Q.current)return;const U=pt(Q.current.startWidth+S.clientX-Q.current.startX);O.current=U,A(U)},[]),xe=(0,d.useCallback)(()=>{Q.current&&(Q.current=null,X(!1),On(O.current))},[]),de=(0,d.useCallback)(S=>{S.key==="ArrowLeft"?(S.preventDefault(),ae(P-qn)):S.key==="ArrowRight"?(S.preventDefault(),ae(P+qn)):S.key==="Home"?(S.preventDefault(),ae(Gt)):S.key==="End"&&(S.preventDefault(),ae(Xt))},[ae,P]);return(0,e.jsxs)("div",{className:"relative hidden h-full shrink-0 md:flex",style:{width:`${P}px`},children:[(0,e.jsxs)("nav",{"aria-label":"Skill folders",className:"flex min-w-0 flex-1 flex-col overflow-y-auto border-r border-line pr-3",children:[(0,e.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2 pt-0.5",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"Folders"}),(0,e.jsx)(w,{variant:"ghost",size:"icon-sm",title:"New folder",onClick:t(()=>r(null),"onClick"),children:(0,e.jsx)(Rs,{className:"h-3.5 w-3.5"})})]}),i?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:"h-7 rounded-md bg-bg-3/60"}),(0,e.jsx)("div",{className:"h-7 rounded-md bg-bg-3/40"}),(0,e.jsx)("div",{className:"h-7 rounded-md bg-bg-3/30"})]}):(0,e.jsxs)("div",{className:"space-y-0.5",children:[(0,e.jsx)(ct,{active:l==="all",label:"All skills",count:Y,icon:(0,e.jsx)(ra,{className:"h-3.5 w-3.5"}),onSelect:t(()=>a("all"),"onSelect")}),v.my?(0,e.jsx)(Os,{node:v.my,depth:0,selection:l,expanded:y,renamingId:D,renameDraft:j,rootLabel:"My Skills",rootIcon:(0,e.jsx)(zn,{className:"h-3.5 w-3.5"}),onToggle:C,onSelect:a,onCreateFolder:r,onEditFolder:g,onMoveFolder:b,onDeleteFolder:_,onStartRename:M,onRenameDraftChange:h,onRenameCommit:ee,onRenameCancel:t(()=>k(null),"onRenameCancel")}):f?(0,e.jsx)(ct,{active:!1,label:"My Skills",count:0,icon:(0,e.jsx)(zn,{className:"h-3.5 w-3.5"}),muted:!0,onSelect:f}):null,(0,e.jsx)(Qi,{label:"Organization",onCreate:t(()=>r(null),"onCreate")}),v.company.length>0?v.company.map(S=>(0,e.jsx)(Os,{node:S,depth:0,selection:l,expanded:y,renamingId:D,renameDraft:j,onToggle:C,onSelect:a,onCreateFolder:r,onEditFolder:g,onMoveFolder:b,onDeleteFolder:_,onStartRename:M,onRenameDraftChange:h,onRenameCommit:ee,onRenameCancel:t(()=>k(null),"onRenameCancel")},S.folder.id)):(0,e.jsx)("div",{className:"px-2 py-1 text-xs text-ink-3",children:"No organization folders yet."}),v.projects?(0,e.jsx)(Os,{node:v.projects,depth:0,selection:l,expanded:y,renamingId:D,renameDraft:j,rootLabel:"Projects",rootIcon:(0,e.jsx)(Ie,{className:"h-3.5 w-3.5"}),onToggle:C,onSelect:a,onCreateFolder:r,onEditFolder:g,onMoveFolder:b,onDeleteFolder:_,onStartRename:M,onRenameDraftChange:h,onRenameCommit:ee,onRenameCancel:t(()=>k(null),"onRenameCancel")}):(0,e.jsx)(ct,{active:!1,label:"Projects",count:0,icon:(0,e.jsx)(Ie,{className:"h-3.5 w-3.5"}),muted:!0,disabled:!0,onSelect:t(()=>{},"onSelect")}),v.bundled?(0,e.jsx)(Os,{node:v.bundled,depth:0,selection:l,expanded:y,renamingId:D,renameDraft:j,rootLabel:"Bundled",rootIcon:(0,e.jsx)(Ie,{className:"h-3.5 w-3.5"}),onToggle:C,onSelect:a,onCreateFolder:r,onEditFolder:g,onMoveFolder:b,onDeleteFolder:_,onStartRename:M,onRenameDraftChange:h,onRenameCommit:ee,onRenameCancel:t(()=>k(null),"onRenameCancel")}):null,(0,e.jsx)("div",{className:"px-2 pb-1 pt-3 text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"System"}),(0,e.jsx)(ct,{active:l==="unfiled",label:"Unfiled",count:pe,icon:(0,e.jsx)(Ms,{color:null}),onSelect:t(()=>a("unfiled"),"onSelect")})]}),o.length>0?(0,e.jsxs)("div",{className:"mt-4 border-t border-line pt-3",children:[(0,e.jsxs)("div",{className:"mb-1.5 flex items-center gap-1.5 px-2 text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:[(0,e.jsx)(da,{className:"h-3 w-3"}),"Tags"]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-1.5 px-1",children:[c?(0,e.jsxs)("button",{type:"button",onClick:t(()=>m(null),"onClick"),className:"inline-flex items-center gap-1 rounded-full border border-line bg-bg-3/60 px-2 py-0.5 text-xs text-ink",children:[c,(0,e.jsx)(Hs,{className:"h-3 w-3"})]}):null,o.filter(S=>S.slug!==c).map(S=>(0,e.jsxs)("button",{type:"button",onClick:t(()=>m(S.slug),"onClick"),className:"inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 text-xs text-ink-3 transition-colors hover:bg-bg-3/40 hover:text-ink",children:[(0,e.jsx)("span",{className:"max-w-32 truncate",children:S.slug}),(0,e.jsx)("span",{className:"text-(length:--text-micro) opacity-70",children:S.count})]},S.slug))]})]}):null]}),(0,e.jsx)("div",{role:"separator","aria-label":"Resize skill folders","aria-orientation":"vertical","aria-valuemin":Gt,"aria-valuemax":Xt,"aria-valuenow":P,tabIndex:0,className:K("absolute inset-y-0 right-0 z-20 w-3 cursor-col-resize touch-none outline-none","before:absolute before:inset-y-0 before:left-1/2 before:w-px before:-translate-x-1/2 before:bg-transparent before:transition-colors","hover:before:bg-line focus-visible:before:bg-focus",T&&"before:bg-focus"),onPointerDown:Z,onPointerMove:Le,onPointerUp:xe,onPointerCancel:xe,onLostPointerCapture:xe,onKeyDown:de})]})}t(Hi,"SkillFolderRail");function Qi({label:s,onCreate:l}){return(0,e.jsxs)("div",{className:"group/heading flex items-center justify-between px-2 pb-0.5 pt-3",children:[(0,e.jsx)("span",{className:"text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:s}),(0,e.jsx)("button",{type:"button",onClick:l,title:`New ${s.toLowerCase()} folder`,className:"opacity-0 transition-opacity group-hover/heading:opacity-100",children:(0,e.jsx)(Rs,{className:"h-3 w-3 text-ink-3"})})]})}t(Qi,"RailHeading");function ct({active:s,label:l,count:i,icon:o,muted:c=!1,disabled:a=!1,onSelect:m}){return(0,e.jsxs)("button",{type:"button",className:K("grid w-full grid-cols-(--gtc-folder-row-actions) items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-bg-3/40",s?"bg-bg-3/60 text-ink":c?"text-ink-3/70":"text-ink-3"),"aria-current":s?"page":void 0,disabled:a,onClick:m,children:[(0,e.jsx)("span",{className:"flex h-4 w-4 items-center justify-center",children:o}),(0,e.jsx)("span",{className:"truncate",children:l}),(0,e.jsx)("span",{className:"text-right text-xs tabular-nums text-ink-3",children:i}),(0,e.jsx)("span",{className:"h-6 w-6","aria-hidden":"true"})]})}t(ct,"VirtualRow");function Os({node:s,depth:l,selection:i,expanded:o,renamingId:c,renameDraft:a,rootLabel:m,rootIcon:r,onToggle:x,onSelect:g,onCreateFolder:b,onEditFolder:_,onMoveFolder:f,onDeleteFolder:v,onStartRename:y,onRenameDraftChange:N,onRenameCommit:D,onRenameCancel:k}){const{folder:j,children:h}=s,P=o.has(j.id),A=i===j.id,T=Ui(j),X=!jt(j)&&!nn(j)&&j.depth<4,O=j.path.startsWith("my/"),Q=m??j.name;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:K("group grid grid-cols-(--gtc-folder-row-actions) items-center gap-2 rounded-md pr-2 text-sm transition-colors hover:bg-bg-3/40",A?"bg-bg-3/60 text-ink":"text-ink-3"),style:{paddingLeft:`${l*.75}rem`},children:[(0,e.jsx)("button",{type:"button","aria-label":P?"Collapse folder":"Expand folder",className:K("flex h-6 w-4 items-center justify-center text-ink-3",h.length===0&&"invisible"),onClick:t(()=>x(j.id),"onClick"),children:(0,e.jsx)(Ps,{className:K("h-3.5 w-3.5 transition-transform",P&&"rotate-90")})}),(0,e.jsxs)("button",{type:"button",className:"flex min-w-0 items-center gap-2 py-1 text-left","aria-current":A?"page":void 0,onClick:t(()=>{g(j.id),h.length>0&&x(j.id)},"onClick"),onDoubleClick:t(()=>T&&y(j),"onDoubleClick"),children:[r?(0,e.jsx)("span",{className:"flex h-4 w-4 items-center justify-center text-ink-3",children:r}):(0,e.jsx)(Ms,{color:j.color}),c===j.id?(0,e.jsx)("input",{value:a,onChange:t(C=>N(C.target.value),"onChange"),onClick:t(C=>C.stopPropagation(),"onClick"),onKeyDown:t(C=>{C.key==="Enter"&&D(j),C.key==="Escape"&&k()},"onKeyDown"),onBlur:t(()=>D(j),"onBlur"),className:"h-6 min-w-0 flex-1 rounded-sm border border-line bg-bg px-1 text-sm outline-none",autoFocus:!0}):(0,e.jsx)("span",{className:"truncate",children:Q})]}),(0,e.jsx)("span",{className:"text-right text-xs tabular-nums text-ink-3",children:j.itemCount}),T||X?(0,e.jsxs)(Fs,{children:[(0,e.jsx)(Cs,{asChild:!0,children:(0,e.jsx)(w,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100","aria-label":`Folder actions for ${Q}`,children:(0,e.jsx)(xa,{className:"h-3.5 w-3.5"})})}),(0,e.jsxs)(Is,{align:"end",children:[X?(0,e.jsxs)(Ce,{onSelect:t(()=>b(j.id),"onSelect"),children:[(0,e.jsx)(rn,{className:"h-3.5 w-3.5"}),"New subfolder"]}):null,T?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ce,{onSelect:t(()=>y(j),"onSelect"),children:"Rename"}),(0,e.jsx)(Ce,{onSelect:t(()=>_(j),"onSelect"),children:"Edit color"}),(0,e.jsxs)(Ce,{onSelect:t(()=>f(j,O?"company":"my"),"onSelect"),children:[(0,e.jsx)(fi,{className:"h-3.5 w-3.5"}),"Move to ",O?"Organization":"My Skills"]}),(0,e.jsx)(ca,{}),(0,e.jsxs)(Ce,{variant:"destructive",onSelect:t(()=>v(j),"onSelect"),children:[(0,e.jsx)(pa,{className:"h-3.5 w-3.5"}),"Delete"]})]}):null]})]}):(0,e.jsx)("span",{className:"h-6 w-6"})]}),P&&h.length>0?(0,e.jsx)("div",{children:h.map(C=>(0,e.jsx)(Os,{node:C,depth:l+1,selection:i,expanded:o,renamingId:c,renameDraft:a,onToggle:x,onSelect:g,onCreateFolder:b,onEditFolder:_,onMoveFolder:f,onDeleteFolder:v,onStartRename:y,onRenameDraftChange:N,onRenameCommit:D,onRenameCancel:k},C.folder.id))}):null]})}t(Os,"TreeBranch");function Wi({result:s,selection:l,onSelect:i}){const o=(0,d.useMemo)(()=>Ye(s),[s]),c=l==="all"||l==="unfiled"?[]:an(o,l);return(0,e.jsxs)("nav",{"aria-label":"Folder path",className:"flex flex-wrap items-center gap-1 text-sm",children:[(0,e.jsxs)("button",{type:"button",onClick:t(()=>i("all"),"onClick"),className:K("inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors hover:bg-bg-3/40",l==="all"?"font-medium text-ink":"text-ink-3"),children:[(0,e.jsx)(Ql,{className:"h-3.5 w-3.5"}),"All skills"]}),l==="unfiled"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ps,{className:"h-3.5 w-3.5 text-ink-3/60"}),(0,e.jsx)("span",{className:"rounded px-1.5 py-0.5 font-medium text-ink",children:"Unfiled"})]}):null,c.map((a,m)=>{const r=m===c.length-1,x=m===0?tn(a):a.name;return(0,e.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,e.jsx)(Ps,{className:"h-3.5 w-3.5 text-ink-3/60"}),(0,e.jsxs)("button",{type:"button",onClick:t(()=>i(a.id),"onClick"),className:K("inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors hover:bg-bg-3/40",r?"font-medium text-ink":"text-ink-3"),children:[a.color?(0,e.jsx)(Ms,{color:a.color}):null,x]})]},a.id)})]})}t(Wi,"FolderBreadcrumb");function Gi({open:s,onOpenChange:l,result:i,title:o,subtitle:c,currentFolderId:a,pending:m=!1,onMove:r,onCreateFolder:x}){const g=(0,d.useMemo)(()=>Ye(i),[i]),[b,_]=(0,d.useState)(""),[f,v]=(0,d.useState)(void 0),[y,N]=(0,d.useState)(void 0),[D,k]=(0,d.useState)(""),[j,h]=(0,d.useState)(!1);(0,d.useEffect)(()=>{s&&(_(""),v(void 0),N(void 0),k(""))},[s]);const P=b.trim().toLowerCase(),A=t(M=>!P||M.name.toLowerCase().includes(P)||M.path.toLowerCase().includes(P),"matches"),T=f,X=typeof T=="string"?g.byId.get(T)??null:null,O=T===void 0?null:T===null?"Unfiled":X?.path??null;async function Q(){const M=D.trim();if(M){h(!0);try{const ee=await x(y??null,M);ee&&v(ee),N(void 0),k("")}finally{h(!1)}}}t(Q,"submitNewFolder");function C(M,ee){const{folder:Y}=M,pe=jt(Y),ae=!pe,Z=T===Y.id,Le=a===Y.id,xe=ae&&!nn(Y)&&Y.depth<4,de=M.children,S=A(Y),U=Aa(M,A);return P&&!S&&!U?null:(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:K("group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm",ae?"cursor-pointer hover:bg-bg-3/40":"cursor-not-allowed opacity-50",Z&&"bg-bg-3/70"),style:{paddingLeft:`${.5+ee*.9}rem`},onClick:t(()=>ae&&v(Y.id),"onClick"),children:[Y.systemKey&&["my","projects","bundled"].includes(Y.systemKey)?(0,e.jsx)(Xs,{className:"h-3.5 w-3.5 shrink-0 text-ink-3"}):(0,e.jsx)(Ms,{color:Y.color}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:tn(Y)}),Le?(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"current"}):null,pe?(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"read-only"}):null,Z?(0,e.jsx)(Hs,{className:"h-3.5 w-3.5"}):null,xe?(0,e.jsx)("button",{type:"button",title:"New folder inside…",className:"opacity-0 transition-opacity group-hover:opacity-100",onClick:t(se=>{se.stopPropagation(),N(Y.id),k("")},"onClick"),children:(0,e.jsx)(rn,{className:"h-3.5 w-3.5 text-ink-3"})}):null]}),y===Y.id?(0,e.jsx)(Un,{depth:ee+1,value:D,pending:j,onChange:k,onSubmit:Q,onCancel:t(()=>N(void 0),"onCancel")}):null,de.map(se=>C(se,ee+1))]},Y.id)}return t(C,"renderNode"),(0,e.jsx)(ns,{open:s,onOpenChange:l,children:(0,e.jsxs)(ss,{className:"sm:max-w-lg",children:[(0,e.jsxs)(xs,{children:[(0,e.jsx)(ts,{children:o}),c?(0,e.jsx)(hs,{children:c}):null]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-line px-2.5",children:[(0,e.jsx)(Ws,{className:"h-3.5 w-3.5 text-ink-3"}),(0,e.jsx)("input",{value:b,onChange:t(M=>_(M.target.value),"onChange"),placeholder:"Search folders",className:"h-8 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-ink-3"})]}),(0,e.jsxs)("div",{className:"max-h-72 overflow-y-auto rounded-md border border-line p-1",children:[(0,e.jsxs)("div",{className:K("flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-bg-3/40",T===null&&"bg-bg-3/70"),onClick:t(()=>v(null),"onClick"),children:[(0,e.jsx)(Ms,{color:null}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:"Unfiled"}),a==null?(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"current"}):null,T===null?(0,e.jsx)(Hs,{className:"h-3.5 w-3.5"}):null]}),g.roots.map(M=>C(M,0)),(0,e.jsx)("div",{className:"mt-1 border-t border-line pt-1",children:y===null?(0,e.jsx)(Un,{depth:0,value:D,pending:j,onChange:k,onSubmit:Q,onCancel:t(()=>N(void 0),"onCancel")}):(0,e.jsxs)("button",{type:"button",onClick:t(()=>{N(null),k("")},"onClick"),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-ink-3 hover:bg-bg-3/40 hover:text-ink",children:[(0,e.jsx)(Rs,{className:"h-3.5 w-3.5"}),"New top-level folder…"]})})]}),(0,e.jsx)("div",{className:"min-h-5 text-xs text-ink-3",children:O?(0,e.jsxs)("span",{children:["Moving to ",(0,e.jsx)("span",{className:"font-mono text-ink",children:O})]}):(0,e.jsx)("span",{children:"Pick a destination folder."})}),(0,e.jsxs)(xt,{children:[(0,e.jsx)(w,{variant:"ghost",onClick:t(()=>l(!1),"onClick"),disabled:m,children:"Cancel"}),(0,e.jsx)(w,{disabled:m||T===void 0||T===a,onClick:t(()=>T!==void 0&&r(T),"onClick"),children:m?"Moving…":"Move here"})]})]})})}t(Gi,"MoveToFolderDialog");function Aa(s,l){return l(s.folder)?!0:s.children.some(i=>Aa(i,l))}t(Aa,"subtreeMatches");function Un({depth:s,value:l,pending:i,onChange:o,onSubmit:c,onCancel:a}){return(0,e.jsxs)("div",{className:"flex items-center gap-2 py-1",style:{paddingLeft:`${.5+s*.9}rem`},children:[(0,e.jsx)(rn,{className:"h-3.5 w-3.5 shrink-0 text-ink-3"}),(0,e.jsx)(Fe,{value:l,onChange:t(m=>o(m.target.value),"onChange"),placeholder:"Folder name",autoFocus:!0,className:"h-7 flex-1 text-sm",onKeyDown:t(m=>{m.key==="Enter"&&c(),m.key==="Escape"&&a()},"onKeyDown")}),(0,e.jsx)(w,{size:"sm",variant:"ghost",onClick:a,disabled:i,children:"Cancel"}),(0,e.jsx)(w,{size:"sm",onClick:c,disabled:i||!l.trim(),children:"Add"})]})}t(Un,"InlineNewFolder");var Vn=16,Hn=24,Qn="min-h-9";function Wn(s){return(0,e.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...s,children:(0,e.jsx)("path",{d:"M12 4 21 19H3z"})})}t(Wn,"VercelMark");function Ta(s){const l=s.replace(/\r\n/g,`
2
2
  `);if(!l.startsWith(`---
3
3
  `))return l.trim();const i=l.indexOf(`
4
4
  ---
@@ -1 +1 @@
1
- var Q=Object.defineProperty;var o=(n,r)=>Q(n,"name",{value:r,configurable:!0});import{i as B,n as $}from"./rolldown-runtime-ZpX3ckPj.js";import{la as z,ua as L}from"./createLucideIcon-CgrPXnTY.js";import{X as H,_ as R,n as X,t as f,v as G}from"./queryKeys-BzT8CD34.js";import{C as J,x as U,y as V}from"./ConnectionSetupFlow-8alK3I_h.js";import{t as q}from"./button-DI4w5WP7.js";import{t as W}from"./agents-B8n-p0aX.js";import{a as Y,i as Z,n as ee,r as te,s as ne,t as oe}from"./dialog-CeH7rDcv.js";import{t as re}from"./input-BBNGmECW.js";import{d as se}from"./model-picker-fields-D_I_l2UI.js";import{t as S}from"./InlineBanner-DeTqU5Gp.js";import{a as _}from"./agent-config-primitives-BJlDiwaH.js";import{ya as ae}from"./index-LM7k1NmC.js";var Ae=$({ConfigureBuiltInAgentModal:o(()=>ue,"ConfigureBuiltInAgentModal")}),d=B(L(),1),t=B(z(),1);function ie(n){return!["process","command","http"].includes(n)}o(ie,"isModelBasedAdapter");function le(n){return n.definition.defaultAdapterType??n.definition.allowedAdapterTypes?.[0]??"omp_local"}o(le,"defaultAdapterType");function de(n){const r=n.trim();if(!r)return;const i=Math.round(Number(r)*100);return Number.isFinite(i)&&i>=0?i:void 0}o(de,"parseBudgetMonthlyCents");function ue({companyId:n,state:r,open:i,onOpenChange:g,onConfigured:D}){const h=H(),{definition:s}=r,[a,T]=(0,d.useState)(()=>r.agent?.adapterType??le(r)),[c,v]=(0,d.useState)(()=>{const e=r.agent?.adapterConfig,l=typeof e=="object"&&e!==null?e.model:null;if(typeof l=="string")return l;const N=r.definition.defaultAdapterConfig?.model;return typeof N=="string"?N:""}),[P,k]=(0,d.useState)(!1),[x,F]=(0,d.useState)(()=>{const e=s.defaultBudgetMonthlyCents??0;return e>0?String(e/100):""}),[j,M]=(0,d.useState)(null),K=(0,d.useMemo)(()=>{const e=new Set(s.allowedAdapterTypes??[]);return new Set(J().map(l=>l.value).filter(l=>e.size>0&&!e.has(l)))},[s.allowedAdapterTypes]),u=ie(a),{data:O}=G({queryKey:f.agents.adapterModels(n,a,null),queryFn:o(()=>W.adapterModels(n,a,{}),"queryFn"),enabled:i&&!!n&&u}),y=O??[],C=u,m=c.trim(),A=!m||y.length===0||y.some(e=>e.id===m),w=A?null:`Model “${m}” is not available for ${a}. Choose a known model.`,b=de(x),E=(!x.trim()||b!==void 0)&&A&&(u?!C||m.length>0:!0),I=u?`Configure & enable ${s.displayName}`:`Provision ${s.displayName}`,p=R({mutationFn:o(async()=>{const e={};return c.trim()&&(e.model=c.trim()),await ae.provision(n,s.key,{adapterType:a,adapterConfig:e,...b!==void 0?{budgetMonthlyCents:b}:{}})},"mutationFn"),onSuccess:o(e=>{h.invalidateQueries({queryKey:f.builtInAgents.list(n)}),h.invalidateQueries({queryKey:f.agents.list(n)}),e.agentId&&h.invalidateQueries({queryKey:f.agents.detail(e.agentId)}),D?.(e),g(!1)},"onSuccess"),onError:o(e=>{M(e instanceof X?e.message:"Failed to configure the built-in agent.")},"onError")});return(0,t.jsx)(oe,{open:i,onOpenChange:o(e=>p.isPending?void 0:g(e),"onOpenChange"),children:(0,t.jsxs)(ee,{className:"sm:max-w-lg",children:[(0,t.jsxs)(Y,{children:[(0,t.jsxs)(ne,{children:["Set up the ",s.displayName]}),(0,t.jsx)(te,{children:s.shortPurpose})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)(S,{tone:"info",compact:!0,children:["Creates ",(0,t.jsx)("strong",{children:s.displayName})," in your roster, badged"," ",(0,t.jsx)("strong",{children:"Built-in"}),". Organizations that require hire approval will queue this for the board."]}),(0,t.jsx)(_,{label:"Adapter type",children:(0,t.jsx)(V,{value:a,onChange:o(e=>{T(e),v("")},"onChange"),disabledTypes:K})}),C&&(0,t.jsx)(U,{models:y,value:c,onChange:v,open:P,onOpenChange:k,allowDefault:!0,required:!0,groupByProvider:!1,preserveOrder:se(a),creatable:!0}),w&&(0,t.jsx)("p",{className:"text-sm text-bad",role:"alert",children:w}),!u&&(0,t.jsx)(S,{tone:"warning",compact:!0,children:"This adapter needs command or endpoint fields before it can run. Provision the built-in row now, then finish those fields from the full agent configuration."}),(0,t.jsx)(_,{label:"Monthly budget (optional)",hint:"Leave blank for no cap.",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm text-ink-3",children:"$"}),(0,t.jsx)(re,{type:"number",min:"0",step:"1",inputMode:"decimal",placeholder:"0",value:x,onChange:o(e=>F(e.target.value),"onChange"),className:"w-32"}),(0,t.jsx)("span",{className:"text-sm text-ink-3",children:"/ month"})]})}),j&&(0,t.jsx)("p",{className:"text-sm text-bad",role:"alert",children:j})]}),(0,t.jsxs)(Z,{children:[(0,t.jsx)(q,{variant:"ghost",onClick:o(()=>g(!1),"onClick"),disabled:p.isPending,children:"Not now"}),(0,t.jsx)(q,{onClick:o(()=>{M(null),p.mutate()},"onClick"),disabled:!E||p.isPending,children:p.isPending?"Configuring…":I})]})]})})}o(ue,"ConfigureBuiltInAgentModal");export{Ae as n,ue as t};
1
+ var Q=Object.defineProperty;var o=(n,r)=>Q(n,"name",{value:r,configurable:!0});import{i as B,n as $}from"./rolldown-runtime-ZpX3ckPj.js";import{la as z,ua as L}from"./createLucideIcon-CgrPXnTY.js";import{X as H,_ as R,n as X,t as f,v as G}from"./queryKeys-BzT8CD34.js";import{C as J,x as U,y as V}from"./ConnectionSetupFlow-8alK3I_h.js";import{t as q}from"./button-DI4w5WP7.js";import{t as W}from"./agents-B8n-p0aX.js";import{a as Y,i as Z,n as ee,r as te,s as ne,t as oe}from"./dialog-CeH7rDcv.js";import{t as re}from"./input-BBNGmECW.js";import{d as se}from"./model-picker-fields-D_I_l2UI.js";import{t as S}from"./InlineBanner-DeTqU5Gp.js";import{a as _}from"./agent-config-primitives-BJlDiwaH.js";import{ya as ae}from"./index-QhteFtm-.js";var Ae=$({ConfigureBuiltInAgentModal:o(()=>ue,"ConfigureBuiltInAgentModal")}),d=B(L(),1),t=B(z(),1);function ie(n){return!["process","command","http"].includes(n)}o(ie,"isModelBasedAdapter");function le(n){return n.definition.defaultAdapterType??n.definition.allowedAdapterTypes?.[0]??"omp_local"}o(le,"defaultAdapterType");function de(n){const r=n.trim();if(!r)return;const i=Math.round(Number(r)*100);return Number.isFinite(i)&&i>=0?i:void 0}o(de,"parseBudgetMonthlyCents");function ue({companyId:n,state:r,open:i,onOpenChange:g,onConfigured:D}){const h=H(),{definition:s}=r,[a,T]=(0,d.useState)(()=>r.agent?.adapterType??le(r)),[c,v]=(0,d.useState)(()=>{const e=r.agent?.adapterConfig,l=typeof e=="object"&&e!==null?e.model:null;if(typeof l=="string")return l;const N=r.definition.defaultAdapterConfig?.model;return typeof N=="string"?N:""}),[P,k]=(0,d.useState)(!1),[x,F]=(0,d.useState)(()=>{const e=s.defaultBudgetMonthlyCents??0;return e>0?String(e/100):""}),[j,M]=(0,d.useState)(null),K=(0,d.useMemo)(()=>{const e=new Set(s.allowedAdapterTypes??[]);return new Set(J().map(l=>l.value).filter(l=>e.size>0&&!e.has(l)))},[s.allowedAdapterTypes]),u=ie(a),{data:O}=G({queryKey:f.agents.adapterModels(n,a,null),queryFn:o(()=>W.adapterModels(n,a,{}),"queryFn"),enabled:i&&!!n&&u}),y=O??[],C=u,m=c.trim(),A=!m||y.length===0||y.some(e=>e.id===m),w=A?null:`Model “${m}” is not available for ${a}. Choose a known model.`,b=de(x),E=(!x.trim()||b!==void 0)&&A&&(u?!C||m.length>0:!0),I=u?`Configure & enable ${s.displayName}`:`Provision ${s.displayName}`,p=R({mutationFn:o(async()=>{const e={};return c.trim()&&(e.model=c.trim()),await ae.provision(n,s.key,{adapterType:a,adapterConfig:e,...b!==void 0?{budgetMonthlyCents:b}:{}})},"mutationFn"),onSuccess:o(e=>{h.invalidateQueries({queryKey:f.builtInAgents.list(n)}),h.invalidateQueries({queryKey:f.agents.list(n)}),e.agentId&&h.invalidateQueries({queryKey:f.agents.detail(e.agentId)}),D?.(e),g(!1)},"onSuccess"),onError:o(e=>{M(e instanceof X?e.message:"Failed to configure the built-in agent.")},"onError")});return(0,t.jsx)(oe,{open:i,onOpenChange:o(e=>p.isPending?void 0:g(e),"onOpenChange"),children:(0,t.jsxs)(ee,{className:"sm:max-w-lg",children:[(0,t.jsxs)(Y,{children:[(0,t.jsxs)(ne,{children:["Set up the ",s.displayName]}),(0,t.jsx)(te,{children:s.shortPurpose})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)(S,{tone:"info",compact:!0,children:["Creates ",(0,t.jsx)("strong",{children:s.displayName})," in your roster, badged"," ",(0,t.jsx)("strong",{children:"Built-in"}),". Organizations that require hire approval will queue this for the board."]}),(0,t.jsx)(_,{label:"Adapter type",children:(0,t.jsx)(V,{value:a,onChange:o(e=>{T(e),v("")},"onChange"),disabledTypes:K})}),C&&(0,t.jsx)(U,{models:y,value:c,onChange:v,open:P,onOpenChange:k,allowDefault:!0,required:!0,groupByProvider:!1,preserveOrder:se(a),creatable:!0}),w&&(0,t.jsx)("p",{className:"text-sm text-bad",role:"alert",children:w}),!u&&(0,t.jsx)(S,{tone:"warning",compact:!0,children:"This adapter needs command or endpoint fields before it can run. Provision the built-in row now, then finish those fields from the full agent configuration."}),(0,t.jsx)(_,{label:"Monthly budget (optional)",hint:"Leave blank for no cap.",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm text-ink-3",children:"$"}),(0,t.jsx)(re,{type:"number",min:"0",step:"1",inputMode:"decimal",placeholder:"0",value:x,onChange:o(e=>F(e.target.value),"onChange"),className:"w-32"}),(0,t.jsx)("span",{className:"text-sm text-ink-3",children:"/ month"})]})}),j&&(0,t.jsx)("p",{className:"text-sm text-bad",role:"alert",children:j})]}),(0,t.jsxs)(Z,{children:[(0,t.jsx)(q,{variant:"ghost",onClick:o(()=>g(!1),"onClick"),disabled:p.isPending,children:"Not now"}),(0,t.jsx)(q,{onClick:o(()=>{M(null),p.mutate()},"onClick"),disabled:!E||p.isPending,children:p.isPending?"Configuring…":I})]})]})})}o(ue,"ConfigureBuiltInAgentModal");export{Ae as n,ue as t};
@@ -1 +1 @@
1
- var $=Object.defineProperty;var n=(e,t)=>$(e,"name",{value:t,configurable:!0});import{i as A}from"./rolldown-runtime-ZpX3ckPj.js";import{$i as E,l as P,la as G,ua as L}from"./createLucideIcon-CgrPXnTY.js";import{X as M,_ as O,t as q,v as B}from"./queryKeys-BzT8CD34.js";import{G as R}from"./router-CJbFZfVR.js";import{t as K}from"./activity-BwGRpduS.js";import{t as U}from"./boxes-DVB7wdRh.js";import{t as H}from"./copy-C1cfcpxY.js";import{t as Q}from"./key-round-CGxQxRtN.js";import{t as v}from"./button-DI4w5WP7.js";import{i as N}from"./ToastContext-DyVJ6bCh.js";import{a as F,i as W,n as z,r as Y,s as J,t as V}from"./dialog-CeH7rDcv.js";import{t as X}from"./input-BBNGmECW.js";import{t as j}from"./tools-MhVvhrz_.js";import{t as Z}from"./clipboard-CTLKYvRL.js";import{Wa as ee,ao as C}from"./index-LM7k1NmC.js";var te=[{key:"overview",label:"Overview",icon:ee},{key:"apps",label:"Apps & tools",icon:U},{key:"tokens",label:"Tokens",icon:Q},{key:"activity",label:"Activity",icon:K},{key:"advanced",label:"Advanced",icon:R}];function ke(e,t){return`/apps/gateways/${e}/${t}`}n(ke,"gatewayTabHref");function Te(e){return te.some(t=>t.key===e)}n(Te,"isGatewayTabKey");var b=A(L(),1);function I(e){if(!e)return null;const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?null:t}n(I,"toDate");function ve(e){return`${e.tokenPrefix}•••`}n(ve,"maskedTokenLabel");function D(e,t=Date.now()){if(e.revokedAt)return"revoked";const o=I(e.expiresAt);if(!o)return"active";const s=o.getTime()-t;return s<=0?"expired":s<=12096e5?"expiring":"active"}n(D,"tokenStatus");var je={active:"Active",expiring:"Expiring",expired:"Expired",revoked:"Revoked"};function Ce(e,t=Date.now()){return e.tokens.filter(o=>{const s=D(o,t);return s==="active"||s==="expiring"}).length}n(Ce,"activeTokenCount");function Se(e,t=Date.now()){return e.tokens.filter(o=>D(o,t)==="expiring").length}n(Se,"expiringTokenCount");function Ae(e){return e.tokens.reduce((t,o)=>{const s=I(o.lastUsedAt);return s&&(!t||s.getTime()>t.getTime())?s:t},null)}n(Ae,"latestTokenActivity");function g(e){return e?e.length>12?`${e.slice(0,8)}…`:e:null}n(g,"shortId");function Ne(e,t,o){return e.contextScopeType!=="none"&&e.contextScopeId?e.contextScopeType==="project"?`Project · ${t.get(e.contextScopeId)??g(e.contextScopeId)}`:e.contextScopeType==="agent"?`Agent · ${o.get(e.contextScopeId)??g(e.contextScopeId)}`:`${e.contextScopeType} · ${g(e.contextScopeId)}`:e.projectId?`Project · ${t.get(e.projectId)??g(e.projectId)}`:e.agentId?`Agent · ${o.get(e.agentId)??g(e.agentId)}`:"Organization"}n(Ne,"formatScope");function Ie(e){return e.status==="active"}n(Ie,"isGatewayOn");function ne(e){if(!e)return"Profile unavailable";const{accessMode:t,allowedToolCount:o,totalToolCount:s,excludedToolCount:p}=e.summary,l=t==="all_except"?Math.max(s-p,0):o;return l===0?"No tools allowed":`${l} ${l===1?"tool":"tools"}`}n(ne,"allowedToolsLabel");function De(e,t,o){if(!e)return[];const s=new Map(t.map(i=>[i.id,i])),p=new Map(o.map(i=>[i.id,i])),l=new Map;for(const i of o)l.set(i.applicationId,[...l.get(i.applicationId)??[],i]);const u=new Map,x=new Set;for(const i of e.entries??[]){if(i.effect!=="include")continue;let c=i.applicationId??null;!c&&i.connectionId&&(c=p.get(i.connectionId)?.applicationId??null),c&&(x.add(c),(i.catalogEntryId||i.toolName)&&u.set(c,(u.get(c)??0)+1))}const y=[];for(const i of x){const c=s.get(i);if(!c||c.status==="archived")continue;const m=l.get(i)??[],h=m.find(f=>f.status!=="archived")??m[0]??null,d=m.find(f=>E(f.healthStatus));y.push({application:c,connection:h,toolCount:u.get(i)??0,needsAttention:!!d,attentionReason:d?"Sign-in expired — reconnect to restore access.":null})}return y.sort((i,c)=>i.application.name.localeCompare(c.application.name))}n(De,"deriveGatewayApps");function _e(e){return e.connection?C(e.connection):C(e.application.name)}n(_e,"gatewayAppDisplayName");var S=["cursor","claude_desktop","vscode","claude_code","opencode"];function $e(e){return[...e].sort((t,o)=>S.indexOf(t.client)-S.indexOf(o.client))}n($e,"orderedSnippets");function Ee(e,t=new Date){const o=t.toISOString().slice(0,16).replace(/[-:T]/g,"");return`${e.displaySlug}-${o}`}n(Ee,"defaultGatewayTokenName");function k(e,t){return typeof e=="string"?e.split(t.endpointPath).join(t.endpoint).replaceAll("pcgw_...",t.token):Array.isArray(e)?e.map(o=>k(o,t)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([o,s])=>[o,k(s,t)])):e}n(k,"replaceSnippetConfigValue");function Pe(e,t){return JSON.stringify(k(e,t),null,2)}n(Pe,"formatHydratedSnippetConfig");var a=A(G(),1),oe=n(e=>["tools","gateways",e],"gatewaysQueryKey");function Ge({companyId:e,open:t,onOpenChange:o,onCreated:s}){const p=M(),{pushToast:l}=N(),[u,x]=(0,b.useState)(""),[y,i]=(0,b.useState)(""),[c,m]=(0,b.useState)(""),h=B({queryKey:q.tools.profiles(e),queryFn:n(()=>j.listProfiles(e),"queryFn"),enabled:t}),d=(h.data?.profiles??[]).filter(r=>r.status!=="archived");(0,b.useEffect)(()=>{t&&!c&&d[0]&&m(d[0].id)},[t,c,d]);const f=O({mutationFn:n(()=>j.createGateway(e,{name:u.trim(),description:y.trim()||null,profileId:c,defaultProfileMode:"gateway_only",contextScopeType:"company"}),"mutationFn"),onSuccess:n(async r=>{l({title:"Gateway created",body:r.name,tone:"success"}),await p.invalidateQueries({queryKey:oe(e)}),x(""),i(""),o(!1),s?.(r.id)},"onSuccess"),onError:n(r=>{l({title:"Gateway was not created",body:r instanceof Error?r.message:String(r),tone:"error"})},"onError")});function _(r){r.preventDefault(),!(!u.trim()||!c)&&f.mutate()}n(_,"submit");const T=h.isLoading,w=!T&&d.length===0;return(0,a.jsx)(V,{open:t,onOpenChange:o,children:(0,a.jsxs)(z,{className:"sm:max-w-lg",children:[(0,a.jsxs)(F,{children:[(0,a.jsx)(J,{children:"New gateway"}),(0,a.jsx)(Y,{children:"One safe MCP endpoint that exposes only the apps in its access profile. Hand it to a client like Cursor or Claude Desktop."})]}),(0,a.jsxs)("form",{className:"space-y-4",onSubmit:_,children:[(0,a.jsxs)("label",{className:"block space-y-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Name"}),(0,a.jsx)(X,{value:u,onChange:n(r=>x(r.target.value),"onChange"),placeholder:"CTO agents",required:!0,autoFocus:!0})]}),(0,a.jsxs)("label",{className:"block space-y-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Access profile"}),(0,a.jsxs)("select",{className:"w-full rounded-md border border-line-strong bg-bg px-3 py-2 text-sm",value:c,onChange:n(r=>m(r.target.value),"onChange"),required:!0,disabled:w,children:[(0,a.jsx)("option",{value:"",disabled:!0,children:T?"Loading profiles…":"Choose a profile"}),d.map(r=>(0,a.jsxs)("option",{value:r.id,children:[r.name," — ",ne(r)]},r.id))]}),(0,a.jsx)("span",{className:"text-xs text-ink-3",children:"The profile decides which tools this gateway allows. You can change it later."})]}),(0,a.jsxs)("label",{className:"block space-y-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Description (optional)"}),(0,a.jsx)("textarea",{className:"min-h-16 w-full rounded-md border border-line-strong bg-bg px-3 py-2 text-sm",value:y,onChange:n(r=>i(r.target.value),"onChange"),placeholder:"Who this endpoint is for and when it should be rotated."})]}),w?(0,a.jsx)("p",{className:"text-xs text-bad",children:"Create an access profile under Advanced before adding a gateway."}):null,(0,a.jsxs)(W,{children:[(0,a.jsx)(v,{type:"button",variant:"ghost",onClick:n(()=>o(!1),"onClick"),children:"Cancel"}),(0,a.jsx)(v,{type:"submit",disabled:f.isPending||w||!u.trim()||!c,children:f.isPending?"Creating…":"Create gateway"})]})]})]})})}n(Ge,"NewGatewayDialog");function ie(e){if(typeof window>"u")return e;try{return new URL(e,window.location.origin).toString()}catch{return e}}n(ie,"gatewayEndpointUrl");function Le({endpointPath:e,className:t}){const{pushToast:o}=N(),s=ie(e);async function p(){try{await Z(s),o({title:"Gateway URL copied",tone:"success"})}catch{o({title:"Copy failed",body:"Clipboard access is unavailable.",tone:"error"})}}return n(p,"copy"),(0,a.jsxs)("button",{type:"button",onClick:n(l=>{l.stopPropagation(),p()},"onClick"),className:P("flex min-w-0 max-w-full items-center gap-1 text-left font-mono text-xs text-ink-3 hover:text-ink",t),title:`${s} — click to copy`,"aria-label":"Copy gateway URL",children:[(0,a.jsx)("span",{className:"min-w-0 truncate",children:s}),(0,a.jsx)(H,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"})]})}n(Le,"CopyableGatewayUrl");export{I as _,Ce as a,ke as b,De as c,Ne as d,_e as f,$e as g,ve as h,je as i,Se as l,Ae as m,Ge as n,ne as o,Ie as p,oe as r,Ee as s,Le as t,Pe as u,D as v,Te as x,te as y};
1
+ var $=Object.defineProperty;var n=(e,t)=>$(e,"name",{value:t,configurable:!0});import{i as A}from"./rolldown-runtime-ZpX3ckPj.js";import{$i as E,l as P,la as G,ua as L}from"./createLucideIcon-CgrPXnTY.js";import{X as M,_ as O,t as q,v as B}from"./queryKeys-BzT8CD34.js";import{G as R}from"./router-CJbFZfVR.js";import{t as K}from"./activity-BwGRpduS.js";import{t as U}from"./boxes-DVB7wdRh.js";import{t as H}from"./copy-C1cfcpxY.js";import{t as Q}from"./key-round-CGxQxRtN.js";import{t as v}from"./button-DI4w5WP7.js";import{i as N}from"./ToastContext-DyVJ6bCh.js";import{a as F,i as W,n as z,r as Y,s as J,t as V}from"./dialog-CeH7rDcv.js";import{t as X}from"./input-BBNGmECW.js";import{t as j}from"./tools-MhVvhrz_.js";import{t as Z}from"./clipboard-CTLKYvRL.js";import{Wa as ee,ao as C}from"./index-QhteFtm-.js";var te=[{key:"overview",label:"Overview",icon:ee},{key:"apps",label:"Apps & tools",icon:U},{key:"tokens",label:"Tokens",icon:Q},{key:"activity",label:"Activity",icon:K},{key:"advanced",label:"Advanced",icon:R}];function ke(e,t){return`/apps/gateways/${e}/${t}`}n(ke,"gatewayTabHref");function Te(e){return te.some(t=>t.key===e)}n(Te,"isGatewayTabKey");var b=A(L(),1);function I(e){if(!e)return null;const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?null:t}n(I,"toDate");function ve(e){return`${e.tokenPrefix}•••`}n(ve,"maskedTokenLabel");function D(e,t=Date.now()){if(e.revokedAt)return"revoked";const o=I(e.expiresAt);if(!o)return"active";const s=o.getTime()-t;return s<=0?"expired":s<=12096e5?"expiring":"active"}n(D,"tokenStatus");var je={active:"Active",expiring:"Expiring",expired:"Expired",revoked:"Revoked"};function Ce(e,t=Date.now()){return e.tokens.filter(o=>{const s=D(o,t);return s==="active"||s==="expiring"}).length}n(Ce,"activeTokenCount");function Se(e,t=Date.now()){return e.tokens.filter(o=>D(o,t)==="expiring").length}n(Se,"expiringTokenCount");function Ae(e){return e.tokens.reduce((t,o)=>{const s=I(o.lastUsedAt);return s&&(!t||s.getTime()>t.getTime())?s:t},null)}n(Ae,"latestTokenActivity");function g(e){return e?e.length>12?`${e.slice(0,8)}…`:e:null}n(g,"shortId");function Ne(e,t,o){return e.contextScopeType!=="none"&&e.contextScopeId?e.contextScopeType==="project"?`Project · ${t.get(e.contextScopeId)??g(e.contextScopeId)}`:e.contextScopeType==="agent"?`Agent · ${o.get(e.contextScopeId)??g(e.contextScopeId)}`:`${e.contextScopeType} · ${g(e.contextScopeId)}`:e.projectId?`Project · ${t.get(e.projectId)??g(e.projectId)}`:e.agentId?`Agent · ${o.get(e.agentId)??g(e.agentId)}`:"Organization"}n(Ne,"formatScope");function Ie(e){return e.status==="active"}n(Ie,"isGatewayOn");function ne(e){if(!e)return"Profile unavailable";const{accessMode:t,allowedToolCount:o,totalToolCount:s,excludedToolCount:p}=e.summary,l=t==="all_except"?Math.max(s-p,0):o;return l===0?"No tools allowed":`${l} ${l===1?"tool":"tools"}`}n(ne,"allowedToolsLabel");function De(e,t,o){if(!e)return[];const s=new Map(t.map(i=>[i.id,i])),p=new Map(o.map(i=>[i.id,i])),l=new Map;for(const i of o)l.set(i.applicationId,[...l.get(i.applicationId)??[],i]);const u=new Map,x=new Set;for(const i of e.entries??[]){if(i.effect!=="include")continue;let c=i.applicationId??null;!c&&i.connectionId&&(c=p.get(i.connectionId)?.applicationId??null),c&&(x.add(c),(i.catalogEntryId||i.toolName)&&u.set(c,(u.get(c)??0)+1))}const y=[];for(const i of x){const c=s.get(i);if(!c||c.status==="archived")continue;const m=l.get(i)??[],h=m.find(f=>f.status!=="archived")??m[0]??null,d=m.find(f=>E(f.healthStatus));y.push({application:c,connection:h,toolCount:u.get(i)??0,needsAttention:!!d,attentionReason:d?"Sign-in expired — reconnect to restore access.":null})}return y.sort((i,c)=>i.application.name.localeCompare(c.application.name))}n(De,"deriveGatewayApps");function _e(e){return e.connection?C(e.connection):C(e.application.name)}n(_e,"gatewayAppDisplayName");var S=["cursor","claude_desktop","vscode","claude_code","opencode"];function $e(e){return[...e].sort((t,o)=>S.indexOf(t.client)-S.indexOf(o.client))}n($e,"orderedSnippets");function Ee(e,t=new Date){const o=t.toISOString().slice(0,16).replace(/[-:T]/g,"");return`${e.displaySlug}-${o}`}n(Ee,"defaultGatewayTokenName");function k(e,t){return typeof e=="string"?e.split(t.endpointPath).join(t.endpoint).replaceAll("pcgw_...",t.token):Array.isArray(e)?e.map(o=>k(o,t)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([o,s])=>[o,k(s,t)])):e}n(k,"replaceSnippetConfigValue");function Pe(e,t){return JSON.stringify(k(e,t),null,2)}n(Pe,"formatHydratedSnippetConfig");var a=A(G(),1),oe=n(e=>["tools","gateways",e],"gatewaysQueryKey");function Ge({companyId:e,open:t,onOpenChange:o,onCreated:s}){const p=M(),{pushToast:l}=N(),[u,x]=(0,b.useState)(""),[y,i]=(0,b.useState)(""),[c,m]=(0,b.useState)(""),h=B({queryKey:q.tools.profiles(e),queryFn:n(()=>j.listProfiles(e),"queryFn"),enabled:t}),d=(h.data?.profiles??[]).filter(r=>r.status!=="archived");(0,b.useEffect)(()=>{t&&!c&&d[0]&&m(d[0].id)},[t,c,d]);const f=O({mutationFn:n(()=>j.createGateway(e,{name:u.trim(),description:y.trim()||null,profileId:c,defaultProfileMode:"gateway_only",contextScopeType:"company"}),"mutationFn"),onSuccess:n(async r=>{l({title:"Gateway created",body:r.name,tone:"success"}),await p.invalidateQueries({queryKey:oe(e)}),x(""),i(""),o(!1),s?.(r.id)},"onSuccess"),onError:n(r=>{l({title:"Gateway was not created",body:r instanceof Error?r.message:String(r),tone:"error"})},"onError")});function _(r){r.preventDefault(),!(!u.trim()||!c)&&f.mutate()}n(_,"submit");const T=h.isLoading,w=!T&&d.length===0;return(0,a.jsx)(V,{open:t,onOpenChange:o,children:(0,a.jsxs)(z,{className:"sm:max-w-lg",children:[(0,a.jsxs)(F,{children:[(0,a.jsx)(J,{children:"New gateway"}),(0,a.jsx)(Y,{children:"One safe MCP endpoint that exposes only the apps in its access profile. Hand it to a client like Cursor or Claude Desktop."})]}),(0,a.jsxs)("form",{className:"space-y-4",onSubmit:_,children:[(0,a.jsxs)("label",{className:"block space-y-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Name"}),(0,a.jsx)(X,{value:u,onChange:n(r=>x(r.target.value),"onChange"),placeholder:"CTO agents",required:!0,autoFocus:!0})]}),(0,a.jsxs)("label",{className:"block space-y-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Access profile"}),(0,a.jsxs)("select",{className:"w-full rounded-md border border-line-strong bg-bg px-3 py-2 text-sm",value:c,onChange:n(r=>m(r.target.value),"onChange"),required:!0,disabled:w,children:[(0,a.jsx)("option",{value:"",disabled:!0,children:T?"Loading profiles…":"Choose a profile"}),d.map(r=>(0,a.jsxs)("option",{value:r.id,children:[r.name," — ",ne(r)]},r.id))]}),(0,a.jsx)("span",{className:"text-xs text-ink-3",children:"The profile decides which tools this gateway allows. You can change it later."})]}),(0,a.jsxs)("label",{className:"block space-y-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Description (optional)"}),(0,a.jsx)("textarea",{className:"min-h-16 w-full rounded-md border border-line-strong bg-bg px-3 py-2 text-sm",value:y,onChange:n(r=>i(r.target.value),"onChange"),placeholder:"Who this endpoint is for and when it should be rotated."})]}),w?(0,a.jsx)("p",{className:"text-xs text-bad",children:"Create an access profile under Advanced before adding a gateway."}):null,(0,a.jsxs)(W,{children:[(0,a.jsx)(v,{type:"button",variant:"ghost",onClick:n(()=>o(!1),"onClick"),children:"Cancel"}),(0,a.jsx)(v,{type:"submit",disabled:f.isPending||w||!u.trim()||!c,children:f.isPending?"Creating…":"Create gateway"})]})]})]})})}n(Ge,"NewGatewayDialog");function ie(e){if(typeof window>"u")return e;try{return new URL(e,window.location.origin).toString()}catch{return e}}n(ie,"gatewayEndpointUrl");function Le({endpointPath:e,className:t}){const{pushToast:o}=N(),s=ie(e);async function p(){try{await Z(s),o({title:"Gateway URL copied",tone:"success"})}catch{o({title:"Copy failed",body:"Clipboard access is unavailable.",tone:"error"})}}return n(p,"copy"),(0,a.jsxs)("button",{type:"button",onClick:n(l=>{l.stopPropagation(),p()},"onClick"),className:P("flex min-w-0 max-w-full items-center gap-1 text-left font-mono text-xs text-ink-3 hover:text-ink",t),title:`${s} — click to copy`,"aria-label":"Copy gateway URL",children:[(0,a.jsx)("span",{className:"min-w-0 truncate",children:s}),(0,a.jsx)(H,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"})]})}n(Le,"CopyableGatewayUrl");export{I as _,Ce as a,ke as b,De as c,Ne as d,_e as f,$e as g,ve as h,je as i,Se as l,Ae as m,Ge as n,ne as o,Ie as p,oe as r,Ee as s,Le as t,Pe as u,D as v,Te as x,te as y};
@@ -1,2 +1,2 @@
1
- var J=Object.defineProperty;var d=(t,s)=>J(t,"name",{value:s,configurable:!0});import{i as H}from"./rolldown-runtime-ZpX3ckPj.js";import{_ as L,f as C,l as Q,la as Z,t as ee,ua as te}from"./createLucideIcon-CgrPXnTY.js";import{h as U}from"./star-eem0qj3E.js";import{X as se,_ as ae,t as g,v as y}from"./queryKeys-BzT8CD34.js";import{n as ne}from"./CompanyContext-fQCNWI_f.js";import{on as R,t as j}from"./router-CJbFZfVR.js";import{t as re}from"./activity-BwGRpduS.js";import{t as ie}from"./bot-kSfD9MPZ.js";import{t as oe}from"./chevron-right-BP8JjEC_.js";import{t as de}from"./flask-conical-BxspRG7d.js";import{t as _}from"./layout-dashboard-CGcwI_3-.js";import{t as k}from"./button-DI4w5WP7.js";import{t as le}from"./shield-check-RPyaLAc-.js";import{t as ce}from"./MootMark-BZOhYsK8.js";import{t as O}from"./agents-B8n-p0aX.js";import{n as ue,t as me}from"./useSharedPolling-CFeiZe2t.js";import{n as he}from"./slots-B7lwlN1w.js";import{n as pe}from"./BreadcrumbContext-DNbB7zWn.js";import{t as T}from"./InlineBanner-DeTqU5Gp.js";import{t as xe}from"./card-BVZvs7aX.js";import{$r as ge,Qa as fe,T as F,Xr as be,_ as ve,_n as je,an as ye,ba as ke,cn as Ne,gn as we,in as Ce,on as Ae,sa as Ie,sn as Se,to as A,xa as De}from"./index-LM7k1NmC.js";import{t as v}from"./MetricCard-CTOmJVRL.js";import{c as E,o as $e,s as Me}from"./smoke-lab-matrix-Cjauo09x.js";var K={name:"hourglass",size:24,node:[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]};K.node;var Le=ee(K),I=H(te(),1),P=new Set;function Re(t){return P.has(t)?!1:(P.add(t),!0)}d(Re,"claimOnboardingOffer");var e=H(Z(),1);function S(){return Array.from({length:14},(t,s)=>{const a=new Date;return a.setDate(a.getDate()-(13-s)),a.toISOString().slice(0,10)})}d(S,"getLast14Days");function _e(t){const s=new Date(t+"T12:00:00");return`${s.getMonth()+1}/${s.getDate()}`}d(_e,"formatDayLabel");function D(t){return{date:t,succeeded:0,failed:0,recovered:0,other:0,total:0,failedByErrorCode:{}}}d(D,"emptyRunDay");var p={succeeded:"var(--status-task-icon-done)",recovered:"var(--status-task-todo)",failed:"var(--status-task-icon-blocked)",other:"var(--hex-737373)"};function Oe(t){const s=[`${t.date}: ${t.total} run${t.total===1?"":"s"}`];if(t.succeeded>0&&s.push(` succeeded: ${t.succeeded}`),t.recovered>0&&s.push(` recovered: ${t.recovered} (retry succeeded)`),t.failed>0){s.push(` failed: ${t.failed}`);const a=Object.entries(t.failedByErrorCode??{}).sort((n,i)=>i[1]-n[1]);for(const[n,i]of a)s.push(` ${n}: ${i}`)}return t.other>0&&s.push(` other: ${t.other}`),s.join(`
1
+ var J=Object.defineProperty;var d=(t,s)=>J(t,"name",{value:s,configurable:!0});import{i as H}from"./rolldown-runtime-ZpX3ckPj.js";import{_ as L,f as C,l as Q,la as Z,t as ee,ua as te}from"./createLucideIcon-CgrPXnTY.js";import{h as U}from"./star-eem0qj3E.js";import{X as se,_ as ae,t as g,v as y}from"./queryKeys-BzT8CD34.js";import{n as ne}from"./CompanyContext-fQCNWI_f.js";import{on as R,t as j}from"./router-CJbFZfVR.js";import{t as re}from"./activity-BwGRpduS.js";import{t as ie}from"./bot-kSfD9MPZ.js";import{t as oe}from"./chevron-right-BP8JjEC_.js";import{t as de}from"./flask-conical-BxspRG7d.js";import{t as _}from"./layout-dashboard-CGcwI_3-.js";import{t as k}from"./button-DI4w5WP7.js";import{t as le}from"./shield-check-RPyaLAc-.js";import{t as ce}from"./MootMark-BZOhYsK8.js";import{t as O}from"./agents-B8n-p0aX.js";import{n as ue,t as me}from"./useSharedPolling-CFeiZe2t.js";import{n as he}from"./slots-B7lwlN1w.js";import{n as pe}from"./BreadcrumbContext-DNbB7zWn.js";import{t as T}from"./InlineBanner-DeTqU5Gp.js";import{t as xe}from"./card-BVZvs7aX.js";import{$r as ge,Qa as fe,T as F,Xr as be,_ as ve,_n as je,an as ye,ba as ke,cn as Ne,gn as we,in as Ce,on as Ae,sa as Ie,sn as Se,to as A,xa as De}from"./index-QhteFtm-.js";import{t as v}from"./MetricCard-CTOmJVRL.js";import{c as E,o as $e,s as Me}from"./smoke-lab-matrix-Cjauo09x.js";var K={name:"hourglass",size:24,node:[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]};K.node;var Le=ee(K),I=H(te(),1),P=new Set;function Re(t){return P.has(t)?!1:(P.add(t),!0)}d(Re,"claimOnboardingOffer");var e=H(Z(),1);function S(){return Array.from({length:14},(t,s)=>{const a=new Date;return a.setDate(a.getDate()-(13-s)),a.toISOString().slice(0,10)})}d(S,"getLast14Days");function _e(t){const s=new Date(t+"T12:00:00");return`${s.getMonth()+1}/${s.getDate()}`}d(_e,"formatDayLabel");function D(t){return{date:t,succeeded:0,failed:0,recovered:0,other:0,total:0,failedByErrorCode:{}}}d(D,"emptyRunDay");var p={succeeded:"var(--status-task-icon-done)",recovered:"var(--status-task-todo)",failed:"var(--status-task-icon-blocked)",other:"var(--hex-737373)"};function Oe(t){const s=[`${t.date}: ${t.total} run${t.total===1?"":"s"}`];if(t.succeeded>0&&s.push(` succeeded: ${t.succeeded}`),t.recovered>0&&s.push(` recovered: ${t.recovered} (retry succeeded)`),t.failed>0){s.push(` failed: ${t.failed}`);const a=Object.entries(t.failedByErrorCode??{}).sort((n,i)=>i[1]-n[1]);for(const[n,i]of a)s.push(` ${n}: ${i}`)}return t.other>0&&s.push(` other: ${t.other}`),s.join(`
2
2
  `)}d(Oe,"runDayTooltip");function W({days:t}){return(0,e.jsx)("div",{className:"flex gap-(--sz-3px) mt-1.5",children:t.map((s,a)=>(0,e.jsx)("div",{className:"flex-1 text-center",children:a===0||a===6||a===13?(0,e.jsx)("span",{className:"text-(length:--text-nano) text-ink-3 tabular-nums",children:_e(s)}):null},s))})}d(W,"DateLabels");function Te({items:t}){return(0,e.jsx)("div",{className:"flex flex-wrap gap-x-2.5 gap-y-0.5 mt-2",children:t.map(s=>(0,e.jsxs)("span",{className:"flex items-center gap-1 text-(length:--text-nano) text-ink-3",children:[(0,e.jsx)("span",{className:"h-1.5 w-1.5 rounded-full shrink-0",style:{backgroundColor:s.color}}),s.label]},s.label))})}d(Te,"ChartLegend");function q({title:t,subtitle:s,className:a,children:n}){return(0,e.jsxs)("div",{className:Q("border border-line rounded-lg p-4 space-y-3",a),children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-xs font-medium text-ink-3",children:t}),s&&(0,e.jsx)("span",{className:"text-(length:--text-nano) text-ink-3/60",children:s})]}),n]})}d(q,"ChartCard");function Fe(t=[]){const s=S(),a=new Map;for(const n of s)a.set(n,D(n));for(const n of t){const i=new Date(n.createdAt).toISOString().slice(0,10),r=a.get(i);if(r){if(n.status==="succeeded")r.succeeded++;else if(n.status==="failed"||n.status==="timed_out"){r.failed++;const c=n.errorCode&&n.errorCode.length>0?n.errorCode:"unknown";r.failedByErrorCode[c]=(r.failedByErrorCode[c]??0)+1}else r.other++;r.total++}}return Array.from(a.values())}d(Fe,"aggregateRuns");function V(t){return Array.isArray(t.activity)?t.activity:Array.isArray(t.runs)?Fe(t.runs):[]}d(V,"resolveRunActivity");function Ee(t){const s=V(t),a=s.length>0?s.map(l=>l.date):S(),n=new Map(s.map(l=>[l.date,l])),i=Math.max(...s.map(l=>l.total),1),r=s.some(l=>l.total>0),c=s.some(l=>l.recovered>0);if(!r)return(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"No runs yet"});const m=[{color:p.succeeded,label:"Succeeded"},...c?[{color:p.recovered,label:"Recovered"}]:[],{color:p.failed,label:"Failed"},{color:p.other,label:"Other"}];return(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"flex items-end gap-(--sz-3px) h-20",children:a.map(l=>{const h=n.get(l)??D(l),f=h.total,N=f/i*100;return(0,e.jsx)("div",{className:"flex-1 h-full flex flex-col justify-end",title:Oe(h),children:f>0?(0,e.jsxs)("div",{className:"flex flex-col-reverse gap-px overflow-hidden",style:{height:`${N}%`,minHeight:2},children:[h.succeeded>0&&(0,e.jsx)("div",{style:{flex:h.succeeded,backgroundColor:p.succeeded}}),h.recovered>0&&(0,e.jsx)("div",{style:{flex:h.recovered,backgroundColor:p.recovered}}),h.failed>0&&(0,e.jsx)("div",{style:{flex:h.failed,backgroundColor:p.failed}}),h.other>0&&(0,e.jsx)("div",{style:{flex:h.other,backgroundColor:p.other}})]}):(0,e.jsx)("div",{className:"bg-bg-3/30 rounded-sm",style:{height:2}})},l)})}),(0,e.jsx)(W,{days:a}),(0,e.jsx)(Te,{items:m})]})}d(Ee,"RunActivityChart");function Pe(t){const s=V(t),a=s.length>0?s.map(i=>i.date):S(),n=new Map(s.map(i=>[i.date,i]));return s.some(i=>i.total>0)?(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"flex items-end gap-(--sz-3px) h-20",children:a.map(i=>{const r=n.get(i)??D(i),c=r.succeeded+r.recovered,m=r.total>0?c/r.total:0,l=r.total===0?void 0:m>=.8?"var(--status-task-icon-done)":m>=.5?"var(--hex-eab308)":"var(--status-task-icon-blocked)";return(0,e.jsx)("div",{className:"flex-1 h-full flex flex-col justify-end",title:`${i}: ${r.total>0?Math.round(m*100):0}% (${c}/${r.total})`,children:r.total>0?(0,e.jsx)("div",{style:{height:`${m*100}%`,minHeight:2,backgroundColor:l}}):(0,e.jsx)("div",{className:"bg-bg-3/30 rounded-sm",style:{height:2}})},i)})}),(0,e.jsx)(W,{days:a})]}):(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"No runs yet"})}d(Pe,"SuccessRateChart");var qe={green:"bg-emerald-500",amber:"bg-amber-500",red:"bg-bad",unknown:"bg-ink-3/40"},ze={green:"All paths passing",amber:"Needs a run",red:"Failing paths",unknown:"No runs yet"};function Be(t){if(!t)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?"—":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(s)}d(Be,"formatTime");function He({companyId:t}){const{enabled:s,loaded:a}=be(),n=y({queryKey:g.smokeLab.runs(t),queryFn:d(()=>E.listRuns(t),"queryFn"),enabled:s&&a}).data?.runs?.[0],i=y({queryKey:g.smokeLab.run(t,n?.id??"__none__"),queryFn:d(()=>E.getRun(t,n.id),"queryFn"),enabled:s&&a&&!!n});if(!a||!s)return null;const r=i.data?.steps??[],c=Me(n,r),m=$e(r);return(0,e.jsxs)(j,{to:ge("smoke-lab"),className:"group flex items-center justify-between gap-3 rounded-lg border border-line bg-bg-2 p-4 shadow-sm transition-colors hover:bg-bg-3/40","data-testid":"smoke-lab-dashboard-card",children:[(0,e.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,e.jsx)("span",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-bg-3",children:(0,e.jsx)(de,{className:"h-4 w-4 text-ink-3"})}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:Q("h-2.5 w-2.5 shrink-0 rounded-full",qe[c])}),(0,e.jsx)("p",{className:"truncate text-sm font-semibold text-ink",children:"Integration smoke"})]}),(0,e.jsxs)("p",{className:"mt-0.5 truncate text-xs text-ink-3",children:[ze[c],m.length>0&&`: ${m.join(", ")}`]}),(0,e.jsx)("p",{className:"mt-0.5 truncate text-(length:--text-micro) text-ink-3/80",children:n?`Last run ${Be(n.startedAt)}`:"Run one from the Smoke Lab tab"})]})]}),(0,e.jsx)(oe,{className:"h-4 w-4 shrink-0 text-ink-3 transition-transform group-hover:translate-x-0.5"})]})}d(He,"SmokeLabDashboardCard");function Qe(){const{pathname:t}=U(),s=Se(),a=Ne(t),{onboardingOpen:n}=De();if(!a||n)return null;const i=d(()=>{s==="ios-manual"?ye(!0):Ce()},"install");return(0,e.jsxs)("section",{role:"region","aria-label":"Install Wardmote",className:"flex flex-wrap items-center gap-3 rounded-(--r-lg) border border-line bg-bg-2 p-4",children:[(0,e.jsx)(ce,{className:"size-7 shrink-0 text-ink","aria-hidden":"true"}),(0,e.jsxs)("div",{className:"flex min-w-48 flex-1 flex-col gap-0.5",children:[(0,e.jsx)("span",{className:"text-sm font-semibold text-ink",children:"Install Wardmote"}),(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"Opens in its own window and can notify you when an agent needs a decision."})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(k,{type:"button",variant:"ghost",size:"sm",onClick:d(()=>Ae(),"onClick"),children:"Not now"}),(0,e.jsx)(k,{type:"button",size:"sm",onClick:i,children:"Install"})]})]})}d(Qe,"InstallNudge");var Ue=5;function Ke(t,s){const a=Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),1),n=Date.UTC(s.getUTCFullYear(),s.getUTCMonth()+1,1),i=Math.max(s.getTime()-a,36e5);return Math.round(t*(n-a)/i)}d(Ke,"projectMonthEndSpendCents");function We(t){let s=0,a=0,n=0;const i=new Map;for(const r of t){s+=r.total,a+=r.succeeded+r.recovered,n+=r.failed;for(const[c,m]of Object.entries(r.failedByErrorCode))i.set(c,(i.get(c)??0)+m)}return{runs:s,failed:n,successRate:s>0?Math.round(a/s*1e3)/10:null,causes:[...i].sort((r,c)=>c[1]-r[1]).slice(0,Ue)}}d(We,"summarizeRunHealth");function Ve(t,s){return`${s>0?Math.round(t/s*1e3)/10:0}%`}d(Ve,"failurePercent");function z({title:t,subtitle:s,children:a}){return(0,e.jsxs)("section",{className:"min-w-0","aria-label":t,children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-ink-3 uppercase tracking-wide",children:t}),(0,e.jsx)("p",{className:"mb-3 text-xs text-ink-3",children:s}),(0,e.jsx)(xe,{className:"block py-0 divide-y divide-line overflow-hidden",children:a})]})}d(z,"DashboardListCard");function B(t){if(!t||t.length===0)return null;const s=t.filter(a=>a.status==="paused"&&a.pauseReason==="import");return s.length>0?{kind:"imported",pausedImportedAgentIds:s.map(a=>a.id)}:t.every(a=>a.status==="paused")?{kind:"all-paused"}:null}d(B,"derivePausedAgentBanner");function vt(){const{selectedCompanyId:t,companies:s}=ne(),{openOnboarding:a}=ke(),n=U(),{setBreadcrumbs:i}=pe(),{data:r,isFetching:c}=y({queryKey:g.agents.list(t),queryFn:d(()=>O.list(t),"queryFn"),enabled:!!t}),m=se(),l=ae({mutationFn:d(async()=>{const u=B(r);if(!(!u||u.kind!=="imported"))for(const w of u.pausedImportedAgentIds)try{await O.resume(w,t??void 0)}catch{}},"mutationFn"),onSettled:d(async()=>{await Promise.all([m.invalidateQueries({queryKey:g.agents.list(t)}),m.invalidateQueries({queryKey:g.dashboard(t)})])},"onSettled")}),h=je({pathname:n.pathname,agentsLoaded:r!==void 0,agentsRefreshing:c,agentCount:r?.length??0});(0,I.useEffect)(()=>{!h||!t||Re(t)&&a({companyId:t,initialStep:we()})},[h,t,a]),(0,I.useEffect)(()=>{i([{label:"Dashboard"}])},[i]);const f=g.dashboard(t),N=ue({companyId:t,resourceKey:"dashboard",queryKey:f,enabled:!!t}),{data:o,isLoading:Y,error:$,dataUpdatedAt:X}=y({queryKey:f,queryFn:d(()=>Ie.summary(t),"queryFn"),enabled:!!t});me(N,o,X);const x=(0,I.useMemo)(()=>We(o?.runActivity??[]),[o?.runActivity]);if(!t)return s.length===0?(0,e.jsx)(F,{icon:_,message:"Welcome to Wardmote. Set up your first organization and agent to get started.",action:"Get Started",onAction:a}):(0,e.jsx)(F,{icon:_,message:"Create or select an organization to view the dashboard."});if(Y)return(0,e.jsx)(ve,{variant:"dashboard"});const G=r!==void 0&&!c&&r.length===0,b=B(r),M=b?.kind==="imported"?b.pausedImportedAgentIds.length:0;return(0,e.jsxs)("div",{className:"space-y-6",children:[$&&(0,e.jsx)("p",{className:"text-sm text-bad",children:$.message}),(0,e.jsx)(Qe,{}),b?.kind==="imported"?(0,e.jsx)(T,{tone:"warning",icon:A,title:`${M} imported agent${M===1?" is":"s are"} paused and will not run.`,actions:(0,e.jsx)(k,{size:"sm",onClick:d(()=>l.mutate(),"onClick"),disabled:l.isPending,"data-testid":"dashboard-resume-imported-agents",children:l.isPending?"Resuming…":"Resume all"}),children:"Agents from an organization import arrive paused as a safety default. Resume them so assigned tasks can start."}):b?.kind==="all-paused"?(0,e.jsx)(T,{tone:"warning",icon:A,title:"All agents in this organization are paused — nothing will run.",actions:(0,e.jsx)(k,{variant:"ghost",size:"sm",asChild:!0,children:(0,e.jsx)(j,{to:"/agents",children:"Review agents"})}),children:"Resume at least one agent to let assigned tasks start."}):null,G&&(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border border-amber-300 bg-amber-50 px-4 py-3 dark:border-amber-500/25 dark:bg-amber-950/60",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,e.jsx)(ie,{className:"h-4 w-4 text-amber-600 dark:text-amber-400 shrink-0"}),(0,e.jsx)("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:"You have no agents."})]}),(0,e.jsx)("button",{onClick:d(()=>a({initialStep:3,companyId:t}),"onClick"),className:"text-sm font-medium text-amber-700 hover:text-amber-900 dark:text-amber-300 dark:hover:text-amber-100 underline underline-offset-2 shrink-0",children:"Create one here"})]}),o&&(0,e.jsxs)(e.Fragment,{children:[o.budgets.activeIncidents>0?(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3 rounded-xl border border-red-500/20 bg-(image:--gradient-extract-1) px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,e.jsx)(A,{className:"mt-0.5 h-4 w-4 shrink-0 text-red-700 dark:text-red-300"}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("p",{className:"text-sm font-medium text-red-950 dark:text-red-50",children:[o.budgets.activeIncidents," active budget incident",o.budgets.activeIncidents===1?"":"s"]}),(0,e.jsxs)("p",{className:"text-xs text-red-900/70 dark:text-red-100/70",children:[o.budgets.pausedAgents," agents paused · ",o.budgets.pausedProjects," projects paused · ",o.budgets.pendingApprovals," pending budget approvals"]})]})]}),(0,e.jsx)(j,{to:"/costs",className:"text-sm underline underline-offset-2 text-red-900 dark:text-red-100",children:"Open budgets"})]}):null,(0,e.jsxs)("div",{className:"grid grid-cols-2 xl:grid-cols-4 gap-1 sm:gap-2",children:[(0,e.jsx)(v,{icon:fe,value:C(o.costs.monthSpendCents),label:"Month Spend",to:"/costs",description:(0,e.jsxs)("span",{children:["On pace for ",C(Ke(o.costs.monthSpendCents,new Date)),o.costs.monthBudgetCents>0?` · ${o.costs.monthUtilizationPercent}% of ${C(o.costs.monthBudgetCents)} budget`:" · unlimited budget"]})}),(0,e.jsx)(v,{icon:re,value:x.successRate===null?"—":`${x.successRate}%`,label:"14-Day Success",to:"/activity/runs",description:(0,e.jsxs)("span",{children:[x.failed," failed of ",x.runs,o.runDurations.p50Ms!==null?` · p50 ${L(o.runDurations.p50Ms)}`:"",o.runDurations.p95Ms!==null?` · p95 ${L(o.runDurations.p95Ms)}`:""]})}),(0,e.jsx)(v,{icon:le,value:o.pendingApprovals+o.budgets.pendingApprovals,label:"Pending Approvals",to:"/approvals",description:(0,e.jsx)("span",{children:o.oldestPendingApprovalAt?`Oldest waiting since ${R(o.oldestPendingApprovalAt)}`:o.budgets.pendingApprovals>0?`${o.budgets.pendingApprovals} budget overrides awaiting board review`:"Nothing awaiting board review"})}),(0,e.jsx)(v,{icon:Le,value:o.wakeQueue.waiting,label:"Waiting Wakes",description:(0,e.jsx)("span",{children:o.wakeQueue.oldestWaitingAt?`Oldest queued ${R(o.wakeQueue.oldestWaitingAt)}`:"No wake waits for a run slot or its task"})})]}),(0,e.jsx)(He,{companyId:t}),(0,e.jsxs)("div",{className:"home-charts grid gap-4",children:[(0,e.jsx)(q,{title:"Run Activity",subtitle:"Last 14 days",children:(0,e.jsx)(Ee,{activity:o.runActivity})}),(0,e.jsx)(q,{title:"Success Rate",subtitle:"Last 14 days",children:(0,e.jsx)(Pe,{activity:o.runActivity})})]}),(0,e.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,e.jsx)(z,{title:"Agents to watch",subtitle:"Failures not recovered by a retry, last 14 days",children:o.agentFailures.length===0?(0,e.jsx)("p",{className:"px-4 py-3 text-sm text-ink-3",children:"No agent failed without recovering."}):o.agentFailures.map(u=>(0,e.jsxs)(j,{to:`/agents/${u.agentId}`,className:"dashboard-list-row flex items-baseline gap-3 text-sm text-inherit no-underline transition-colors hover:bg-bg-3/50",children:[(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",title:u.agentName,children:u.agentName}),(0,e.jsxs)("span",{className:"shrink-0 text-xs tabular-nums text-ink-3",children:[u.failed," of ",u.runs," runs · ",Ve(u.failed,u.runs)]})]},u.agentId))}),(0,e.jsx)(z,{title:"Failure causes",subtitle:"Error codes of unrecovered failures, last 14 days",children:x.causes.length===0?(0,e.jsx)("p",{className:"px-4 py-3 text-sm text-ink-3",children:"No unrecovered failures."}):x.causes.map(([u,w])=>(0,e.jsxs)("div",{className:"dashboard-list-row flex items-baseline gap-3 text-sm",children:[(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs",title:u,children:u}),(0,e.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-ink-3",children:w})]},u))})]}),(0,e.jsx)(he,{slotTypes:["dashboardWidget"],context:{companyId:t},className:"grid gap-4 md:grid-cols-2",itemClassName:"rounded-lg border bg-bg-2 p-4 shadow-sm"})]})]})}d(vt,"Dashboard");export{vt as Dashboard};