@tickernelz/paperclip-pro-ui 2026.1012.0 → 2026.1012.1

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 (50) hide show
  1. package/dist/assets/{AgentAvatar-B47RVwPt.js → AgentAvatar-DySHTTwq.js} +1 -1
  2. package/dist/assets/{Agents.production-CaL_roCY.js → Agents.production-CF5r1j38.js} +2 -2
  3. package/dist/assets/{BreadcrumbContext-BRKP7-bF.js → BreadcrumbContext-C-JqFdLZ.js} +1 -1
  4. package/dist/assets/{CompanyActivity.production-B5ko3U6C.js → CompanyActivity.production-BxAfcJub.js} +1 -1
  5. package/dist/assets/{CompanyExport-D_8Cdnps.js → CompanyExport-CEeoEcyJ.js} +1 -1
  6. package/dist/assets/{CompanySkills.production-DKpb4vb9.js → CompanySkills.production-DHEEarUk.js} +1 -1
  7. package/dist/assets/{EmptyState-iwTwakaR.js → EmptyState-fxPFhH-R.js} +1 -1
  8. package/dist/assets/{MarkdownBody-CbLdPc8E.js → MarkdownBody-CEcIElD-.js} +1 -1
  9. package/dist/assets/{MarkdownEditor-98mZdmRX.js → MarkdownEditor-B6kwxxZP.js} +1 -1
  10. package/dist/assets/{OrgChart.production-CpVPwEak.js → OrgChart.production-R4TqTezh.js} +1 -1
  11. package/dist/assets/{PageSkeleton-Dl_gWB8z.js → PageSkeleton-iVZWoLsF.js} +1 -1
  12. package/dist/assets/{RoutineDetail.production-CmUbfGto.js → RoutineDetail.production-RCCl99aO.js} +1 -1
  13. package/dist/assets/{RoutineRunVariablesDialog-DrqOVV5i.js → RoutineRunVariablesDialog-BfaOkOdj.js} +1 -1
  14. package/dist/assets/{Routines.production-C3-E_ij7.js → Routines.production-i7GS-uxC.js} +1 -1
  15. package/dist/assets/{StatusIcon-Co-elrfc.js → StatusIcon-DxxLvme9.js} +1 -1
  16. package/dist/assets/{ToastContext-CYUmn7f8.js → ToastContext-BbzJdb2r.js} +1 -1
  17. package/dist/assets/{agent-avatar-url-B91C7fqh.js → agent-avatar-url-eBzFMwFS.js} +27 -27
  18. package/dist/assets/{alert-dialog-CfwPsmAH.js → alert-dialog-Ctnjtpv6.js} +1 -1
  19. package/dist/assets/{arrow-right-DW0tfmbi.js → arrow-right-DyKWA_SL.js} +1 -1
  20. package/dist/assets/{badge-B4XIQ7B_.js → badge-CUe24HAP.js} +1 -1
  21. package/dist/assets/{bot-zBrbL-yH.js → bot-wKcWfYKX.js} +1 -1
  22. package/dist/assets/{card-79GDCTP3.js → card-GbQ9sLu8.js} +1 -1
  23. package/dist/assets/{check-x_elx0uL.js → check-VcfFMsHr.js} +1 -1
  24. package/dist/assets/{checkbox-3gl2Un2H.js → checkbox-Cm-PyDSt.js} +1 -1
  25. package/dist/assets/{clipboard-_seTAJiP.js → clipboard-CYFyFXxJ.js} +1 -1
  26. package/dist/assets/{company-members-BXmr5rWO.js → company-members-CSVvQnvh.js} +1 -1
  27. package/dist/assets/{definition-I91EV37G.js → definition-urW_HpEG.js} +1 -1
  28. package/dist/assets/{dist-G74v2gk6.js → dist-CfR2_c4p.js} +1 -1
  29. package/dist/assets/{dist-Bgy8AcEI.js → dist-Dz68ZFqX.js} +1 -1
  30. package/dist/assets/{dist-D4yyXwCK.js → dist-Z45aKkJm.js} +1 -1
  31. package/dist/assets/{environments-x0bu3agB.js → environments-Cc8orNVy.js} +1 -1
  32. package/dist/assets/{external-link-DZQH1MR8.js → external-link-CAutrcht.js} +1 -1
  33. package/dist/assets/{file-text-DnkFEoqC.js → file-text-Dik8gyob.js} +1 -1
  34. package/dist/assets/{health-DIsZUg4d.js → health-D_DTw2-J.js} +1 -1
  35. package/dist/assets/{heartbeats-hynzhqu3.js → heartbeats-BgAe0g2m.js} +1 -1
  36. package/dist/assets/{index-SsNrNOjw.js → index-st-IN4Gf.js} +139 -139
  37. package/dist/assets/{input-DW5WzZI0.js → input-BARyUoy0.js} +1 -1
  38. package/dist/assets/{label-BnuPQCxV.js → label-D4Q0SI3t.js} +1 -1
  39. package/dist/assets/{mention-chips-DtMro9HO.js → mention-chips-BEoxPZei.js} +1 -1
  40. package/dist/assets/{rotate-ccw-wat5PoA5.js → rotate-ccw-BT1r8zDE.js} +1 -1
  41. package/dist/assets/{select-CtJdi3BB.js → select-yD0r8C3i.js} +1 -1
  42. package/dist/assets/{sheet-5L45GZhN.js → sheet-CAjfRCp9.js} +1 -1
  43. package/dist/assets/{skeleton-Cea_xEjg.js → skeleton-BFMc3stE.js} +1 -1
  44. package/dist/assets/{tabs-CVzr4EnB.js → tabs-C1f963Rn.js} +1 -1
  45. package/dist/assets/{use-adapter-capabilities-BzuoLi4n.js → use-adapter-capabilities-CsKGmy5W.js} +1 -1
  46. package/dist/assets/{use-copy-action-D1yLO8Yp.js → use-copy-action-B-Azftuv.js} +1 -1
  47. package/dist/assets/{useHiddenSettings-DuLvvhZD.js → useHiddenSettings-Uo-rfexH.js} +1 -1
  48. package/dist/index.html +39 -39
  49. package/dist/sw.js +1 -1
  50. package/package.json +1 -1
@@ -1 +1 @@
1
- var E=Object.defineProperty;var o=(a,e)=>E(a,"name",{value:e,configurable:!0});import{i as C}from"./rolldown-runtime-ZpX3ckPj.js";import{G as v,Ia as L,M as A,Ra as w,T as R,fn as h,gn as k,j as N,k as I}from"./agent-avatar-url-B91C7fqh.js";var m=C(w(),1),i=C(L(),1),y=Object.defineProperty,g=o((a,e)=>y(a,"name",{value:e,configurable:!0}),"__name"),z="Avatar",[T,X]=N(z),M=[0,()=>{}],[P,_]=T(z),F=m.forwardRef(g(o(function(e,t){const{__scopeAvatar:s,...n}=e,[r,l]=m.useState("idle"),[d,u]=S();return(0,i.jsx)(P,{scope:s,imageLoadingStatus:r,setImageLoadingStatus:l,imageCount:d,setImageCount:u,children:(0,i.jsx)(A.span,{...n,ref:t})})},"Avatar2"),"Avatar")),U="AvatarImage",q=m.forwardRef(g(o(function(e,t){const{__scopeAvatar:s,src:n,onLoadingStatusChange:r,...l}=e,d=_(U,s);d.setImageCount;const u=j(n,{referrerPolicy:l.referrerPolicy,crossOrigin:l.crossOrigin,loadingStatus:d.imageLoadingStatus,setLoadingStatus:d.setImageLoadingStatus}),c=R(f=>{r?.(f)}),p=m.useRef(u);return I(()=>{const f=p.current;p.current=u,u!==f&&c(u)},[u,c]),u==="loaded"?(0,i.jsx)(A.img,{...l,ref:t,src:n}):null},"AvatarImage2"),"AvatarImage")),G="AvatarFallback",O=m.forwardRef(g(o(function(e,t){const{__scopeAvatar:s,delayMs:n,...r}=e,l=_(G,s),[d,u]=m.useState(n===void 0);return m.useEffect(()=>{if(n!==void 0){const c=window.setTimeout(()=>u(!0),n);return()=>window.clearTimeout(c)}},[n]),d&&l.imageLoadingStatus!=="loaded"?(0,i.jsx)(A.span,{...r,ref:t}):null},"AvatarFallback2"),"AvatarFallback"));function j(a,{loadingStatus:e,setLoadingStatus:t,referrerPolicy:s,crossOrigin:n}){return I(()=>{if(!a){t("error");return}const r=new window.Image,l=g(u=>{const c=u.currentTarget;t(x(c))},"handleLoad"),d=g(()=>t("error"),"handleError");return r.addEventListener("load",l),r.addEventListener("error",d),s&&(r.referrerPolicy=s),r.crossOrigin=n??null,r.src=a,t(x(r)),()=>{r.removeEventListener("load",l),r.removeEventListener("error",d),t("idle")}},[a,n,s,t]),e}o(j,"useImageLoadingStatus");g(j,"useImageLoadingStatus");function x(a){return a.complete?a.naturalWidth>0?"loaded":"error":"loading"}o(x,"getImageLoadingStatus");g(x,"getImageLoadingStatus");function S(){return M}o(S,"useImageCount");g(S,"useImageCount");function W(a){}o(W,"useUpdateImageCount");g(W,"useUpdateImageCount");function $({className:a,size:e="default",shape:t="circle",...s}){return(0,i.jsx)(F,{"data-slot":"avatar","data-size":e,"data-shape":t,className:v("group/avatar relative flex size-8 shrink-0 overflow-hidden select-none data-[size=lg]:size-10 data-[size=sm]:size-6 data-[size=xs]:size-5",t==="square"?"rounded-md":"rounded-full",a),...s})}o($,"Avatar");function B({className:a,...e}){return(0,i.jsx)(q,{"data-slot":"avatar-image",className:v("aspect-square size-full object-cover",a),...e})}o(B,"AvatarImage");function K({className:a,...e}){return(0,i.jsx)(O,{"data-slot":"avatar-fallback",className:v("bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[shape=square]/avatar:rounded-md group-data-[size=sm]/avatar:text-xs group-data-[size=xs]/avatar:text-(length:--text-nano)",a),...e})}o(K,"AvatarFallback");function Y({className:a,...e}){return(0,i.jsx)("div",{"data-slot":"avatar-group",className:v("*:data-[slot=avatar]:ring-background group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2",a),...e})}o(Y,"AvatarGroup");function Z({className:a,...e}){return(0,i.jsx)("div",{"data-slot":"avatar-group-count",className:v("bg-muted text-muted-foreground ring-background relative flex size-8 shrink-0 items-center justify-center rounded-full text-sm ring-2 group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",a),...e})}o(Z,"AvatarGroupCount");function b(a){const e=a.trim().split(/\s+/);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():a.slice(0,2).toUpperCase()}o(b,"deriveInitials");var V={xs:"text-sm",sm:"text-xs",default:"text-sm",lg:"text-sm"};function aa({name:a,avatarUrl:e,initials:t,size:s="default",shape:n="circle",className:r}){const l=t??b(a);return(0,i.jsxs)("span",{className:v("inline-flex min-w-0 gap-1.5 items-center",s==="xs"&&"gap-1",s==="lg"&&"gap-2",r),title:a,children:[(0,i.jsxs)($,{size:s,shape:n,"aria-hidden":"true",children:[e&&(0,i.jsx)(B,{src:e,alt:""}),(0,i.jsx)(K,{children:l})]}),(0,i.jsx)("span",{className:v("truncate",V[s]),children:a})]})}o(aa,"Identity");var D={16:"size-4",20:"size-5",24:"size-6",32:"size-8",40:"size-10",48:"size-12",64:"size-16",96:"size-24",128:"size-32",256:"size-64",512:"size-128"};function ea({agent:a,appearance:e,size:t=24,name:s,label:n,pose:r="rest",muted:l=!1,className:d}){const u=k(e??a?.appearance,a?.id),c=h(u,t,1,r,l),[p,f]=(0,m.useState)(null);return(0,i.jsx)("span",{"data-slot":"agent-avatar",className:v("relative inline-flex shrink-0 items-center justify-center align-middle",D[t],d),role:n?"img":void 0,"aria-label":n,"aria-hidden":n?void 0:!0,children:p===c?(0,i.jsx)("span",{className:"text-xs text-muted-foreground",children:b(s??a?.name??"Agent")}):(0,i.jsx)("img",{src:c,srcSet:u.customAvatarAssetId?void 0:`${h(u,t,2,r,l)} 2x`,alt:"",width:t,height:t,decoding:"async",loading:"lazy",className:"size-full object-contain",onError:o(()=>f(c),"onError")})})}o(ea,"AgentAvatar");export{$ as a,Z as c,b as i,B as l,D as n,K as o,aa as r,Y as s,ea as t};
1
+ var E=Object.defineProperty;var o=(a,e)=>E(a,"name",{value:e,configurable:!0});import{i as C}from"./rolldown-runtime-ZpX3ckPj.js";import{G as v,Ia as L,M as A,Ra as w,T as R,fn as h,gn as k,j as N,k as I}from"./agent-avatar-url-eBzFMwFS.js";var m=C(w(),1),i=C(L(),1),y=Object.defineProperty,g=o((a,e)=>y(a,"name",{value:e,configurable:!0}),"__name"),z="Avatar",[T,X]=N(z),M=[0,()=>{}],[P,_]=T(z),F=m.forwardRef(g(o(function(e,t){const{__scopeAvatar:s,...n}=e,[r,l]=m.useState("idle"),[d,u]=S();return(0,i.jsx)(P,{scope:s,imageLoadingStatus:r,setImageLoadingStatus:l,imageCount:d,setImageCount:u,children:(0,i.jsx)(A.span,{...n,ref:t})})},"Avatar2"),"Avatar")),U="AvatarImage",q=m.forwardRef(g(o(function(e,t){const{__scopeAvatar:s,src:n,onLoadingStatusChange:r,...l}=e,d=_(U,s);d.setImageCount;const u=j(n,{referrerPolicy:l.referrerPolicy,crossOrigin:l.crossOrigin,loadingStatus:d.imageLoadingStatus,setLoadingStatus:d.setImageLoadingStatus}),c=R(f=>{r?.(f)}),p=m.useRef(u);return I(()=>{const f=p.current;p.current=u,u!==f&&c(u)},[u,c]),u==="loaded"?(0,i.jsx)(A.img,{...l,ref:t,src:n}):null},"AvatarImage2"),"AvatarImage")),G="AvatarFallback",O=m.forwardRef(g(o(function(e,t){const{__scopeAvatar:s,delayMs:n,...r}=e,l=_(G,s),[d,u]=m.useState(n===void 0);return m.useEffect(()=>{if(n!==void 0){const c=window.setTimeout(()=>u(!0),n);return()=>window.clearTimeout(c)}},[n]),d&&l.imageLoadingStatus!=="loaded"?(0,i.jsx)(A.span,{...r,ref:t}):null},"AvatarFallback2"),"AvatarFallback"));function j(a,{loadingStatus:e,setLoadingStatus:t,referrerPolicy:s,crossOrigin:n}){return I(()=>{if(!a){t("error");return}const r=new window.Image,l=g(u=>{const c=u.currentTarget;t(x(c))},"handleLoad"),d=g(()=>t("error"),"handleError");return r.addEventListener("load",l),r.addEventListener("error",d),s&&(r.referrerPolicy=s),r.crossOrigin=n??null,r.src=a,t(x(r)),()=>{r.removeEventListener("load",l),r.removeEventListener("error",d),t("idle")}},[a,n,s,t]),e}o(j,"useImageLoadingStatus");g(j,"useImageLoadingStatus");function x(a){return a.complete?a.naturalWidth>0?"loaded":"error":"loading"}o(x,"getImageLoadingStatus");g(x,"getImageLoadingStatus");function S(){return M}o(S,"useImageCount");g(S,"useImageCount");function W(a){}o(W,"useUpdateImageCount");g(W,"useUpdateImageCount");function $({className:a,size:e="default",shape:t="circle",...s}){return(0,i.jsx)(F,{"data-slot":"avatar","data-size":e,"data-shape":t,className:v("group/avatar relative flex size-8 shrink-0 overflow-hidden select-none data-[size=lg]:size-10 data-[size=sm]:size-6 data-[size=xs]:size-5",t==="square"?"rounded-md":"rounded-full",a),...s})}o($,"Avatar");function B({className:a,...e}){return(0,i.jsx)(q,{"data-slot":"avatar-image",className:v("aspect-square size-full object-cover",a),...e})}o(B,"AvatarImage");function K({className:a,...e}){return(0,i.jsx)(O,{"data-slot":"avatar-fallback",className:v("bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[shape=square]/avatar:rounded-md group-data-[size=sm]/avatar:text-xs group-data-[size=xs]/avatar:text-(length:--text-nano)",a),...e})}o(K,"AvatarFallback");function Y({className:a,...e}){return(0,i.jsx)("div",{"data-slot":"avatar-group",className:v("*:data-[slot=avatar]:ring-background group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2",a),...e})}o(Y,"AvatarGroup");function Z({className:a,...e}){return(0,i.jsx)("div",{"data-slot":"avatar-group-count",className:v("bg-muted text-muted-foreground ring-background relative flex size-8 shrink-0 items-center justify-center rounded-full text-sm ring-2 group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",a),...e})}o(Z,"AvatarGroupCount");function b(a){const e=a.trim().split(/\s+/);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():a.slice(0,2).toUpperCase()}o(b,"deriveInitials");var V={xs:"text-sm",sm:"text-xs",default:"text-sm",lg:"text-sm"};function aa({name:a,avatarUrl:e,initials:t,size:s="default",shape:n="circle",className:r}){const l=t??b(a);return(0,i.jsxs)("span",{className:v("inline-flex min-w-0 gap-1.5 items-center",s==="xs"&&"gap-1",s==="lg"&&"gap-2",r),title:a,children:[(0,i.jsxs)($,{size:s,shape:n,"aria-hidden":"true",children:[e&&(0,i.jsx)(B,{src:e,alt:""}),(0,i.jsx)(K,{children:l})]}),(0,i.jsx)("span",{className:v("truncate",V[s]),children:a})]})}o(aa,"Identity");var D={16:"size-4",20:"size-5",24:"size-6",32:"size-8",40:"size-10",48:"size-12",64:"size-16",96:"size-24",128:"size-32",256:"size-64",512:"size-128"};function ea({agent:a,appearance:e,size:t=24,name:s,label:n,pose:r="rest",muted:l=!1,className:d}){const u=k(e??a?.appearance,a?.id),c=h(u,t,1,r,l),[p,f]=(0,m.useState)(null);return(0,i.jsx)("span",{"data-slot":"agent-avatar",className:v("relative inline-flex shrink-0 items-center justify-center align-middle",D[t],d),role:n?"img":void 0,"aria-label":n,"aria-hidden":n?void 0:!0,children:p===c?(0,i.jsx)("span",{className:"text-xs text-muted-foreground",children:b(s??a?.name??"Agent")}):(0,i.jsx)("img",{src:c,srcSet:u.customAvatarAssetId?void 0:`${h(u,t,2,r,l)} 2x`,alt:"",width:t,height:t,decoding:"async",loading:"lazy",className:"size-full object-contain",onError:o(()=>f(c),"onError")})})}o(ea,"AgentAvatar");export{$ as a,Z as c,b as i,B as l,D as n,K as o,aa as r,Y as s,ea as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-SsNrNOjw.js","assets/rolldown-runtime-ZpX3ckPj.js","assets/agent-avatar-url-B91C7fqh.js","assets/preload-helper-CceJXRIF.js","assets/BreadcrumbContext-BRKP7-bF.js","assets/label-BnuPQCxV.js","assets/mention-chips-DtMro9HO.js","assets/dist-G74v2gk6.js","assets/dist-Bgy8AcEI.js","assets/checkbox-3gl2Un2H.js","assets/check-x_elx0uL.js","assets/clipboard-_seTAJiP.js","assets/RoutineRunVariablesDialog-DrqOVV5i.js","assets/alert-dialog-CfwPsmAH.js","assets/AgentAvatar-B47RVwPt.js","assets/MarkdownEditor-98mZdmRX.js","assets/dist-D4yyXwCK.js","assets/dist-BhxPxuMy.js","assets/StatusIcon-Co-elrfc.js","assets/badge-B4XIQ7B_.js","assets/bot-zBrbL-yH.js","assets/select-CtJdi3BB.js","assets/ToastContext-CYUmn7f8.js","assets/sheet-5L45GZhN.js","assets/heartbeats-hynzhqu3.js","assets/useHiddenSettings-DuLvvhZD.js","assets/health-DIsZUg4d.js","assets/rotate-ccw-wat5PoA5.js","assets/environments-x0bu3agB.js","assets/input-DW5WzZI0.js","assets/company-members-BXmr5rWO.js","assets/card-79GDCTP3.js","assets/EmptyState-iwTwakaR.js","assets/PageSkeleton-Dl_gWB8z.js","assets/skeleton-Cea_xEjg.js","assets/tabs-CVzr4EnB.js","assets/use-adapter-capabilities-BzuoLi4n.js","assets/use-copy-action-D1yLO8Yp.js","assets/arrow-right-DW0tfmbi.js","assets/external-link-DZQH1MR8.js","assets/MarkdownBody-CbLdPc8E.js","assets/file-text-DnkFEoqC.js","assets/index-B2A-dAWv.css"])))=>i.map(i=>d[i]);
2
- var Ie=Object.defineProperty;var a=(e,n)=>Ie(e,"name",{value:n,configurable:!0});import{i as ae}from"./rolldown-runtime-ZpX3ckPj.js";import{B as re,G as T,Ia as Ae,Ra as Ce,St as b,ht as Se,mi as Ee,na as j,ut as _e,z as $}from"./agent-avatar-url-B91C7fqh.js";import{t as Le}from"./preload-helper-CceJXRIF.js";import{Ln as Me,ct as Te,f as ke,i as K,n as qe,r as ee,s as ie,yt as Pe}from"./BreadcrumbContext-BRKP7-bF.js";import{m as le}from"./alert-dialog-CfwPsmAH.js";import{t as oe}from"./AgentAvatar-B47RVwPt.js";import{t as Re}from"./tabs-CVzr4EnB.js";import{t as te}from"./bot-zBrbL-yH.js";import{i as Be,o as Fe,t as $e}from"./heartbeats-hynzhqu3.js";import{i as Ke,n as De,t as se}from"./environments-x0bu3agB.js";import{t as ne}from"./EmptyState-iwTwakaR.js";import{t as Oe}from"./PageSkeleton-Dl_gWB8z.js";import{Dt as ze,Ft as D,Gt as Ve,Kt as ce,Lt as Ge,Rt as Ue,Vt as He,Wt as Qe,Xt as We,Yt as ue,Zt as Xe,qt as Ye}from"./index-SsNrNOjw.js";var d=ae(Ce(),1),t=ae(Ae(),1),de=Ee,Ze=(0,d.lazy)(()=>Le(()=>import("./index-SsNrNOjw.js").then(e=>e.gt).then(e=>({default:e.ConfigureBuiltInAgentModal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42]))),Je=["all","active","paused","error","builtin"],et=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"paused",label:"Paused"},{value:"error",label:"Error"},{value:"builtin",label:"Built-in"}];function tt(e){return Je.includes(e)}a(tt,"isFilterTab");var z={label:"Local",detail:"Paperclip host",title:"Local - Paperclip host"},me={label:"—",detail:"Loading environment",title:"Loading environment"},pe=new Set(["terminated","pending_approval"]);function ge(e,n){return n==="all"?!0:n==="active"?e==="active"||e==="running"||e==="idle":n==="paused"?e==="paused":n==="error"?e==="error":!0}a(ge,"matchesFilter");function st(e,n,i){return e.filter(r=>pe.has(r.status)?!1:n==="builtin"?i.has(r.id):ge(r.status,n)).sort((r,o)=>r.name.localeCompare(o.name))}a(st,"filterAgents");function nt(e){const n=e.adapterConfig?.model;if(typeof n!="string")return null;const i=n.trim();return i.length>0?i:null}a(nt,"getConfiguredModel");function at(e){return e==="ssh"?"SSH":e.charAt(0).toUpperCase()+e.slice(1)}a(at,"formatEnvironmentDriver");function rt(e,n){const i=typeof e.config.provider=="string"?e.config.provider.trim():"";return i?n?.sandboxProviders?.[i]?.displayName??i:"Sandbox"}a(rt,"getSandboxProviderLabel");function it(e,n){const i=Ge(e)?"Managed by Paperclip":e.driver==="sandbox"?`${rt(e,n)} sandbox provider`:e.driver==="local"?"Paperclip host":at(e.driver);return{label:e.name,detail:i,title:`${e.name} - ${i}`}}a(it,"describeEnvironment");function lt(e){return{label:"Unknown environment",detail:e.slice(0,8),title:`Unknown environment - ${e}`}}a(lt,"describeMissingEnvironment");function ot(e,n,i,r){const o=e.defaultEnvironmentId??i;if(!o)return z;const m=n.get(o);return m?it(m,r):lt(o)}a(ot,"resolveAgentEnvironment");function xe(e,n,i){return e.reduce((r,o)=>{const m=xe(o.reports,n,i);return pe.has(o.status)?(r.push(...m),r):(((n==="builtin"?i.has(o.id):ge(o.status,n))||m.length>0)&&r.push({...o,reports:m}),r)},[]).sort((r,o)=>r.name.localeCompare(o.name))}a(xe,"filterOrgTree");function wt(){const{selectedCompanyId:e}=Se(),{openNewAgent:n}=Be(),{setBreadcrumbs:i}=qe(),r=ke(),o=Me(),{isMobile:m}=Ke(),N=o.pathname.split("/").pop()??"all",v=tt(N)?N:"all",[S,w]=(0,d.useState)("org"),I=m,l=I?"list":S,{data:u}=j({queryKey:b.instance.settings,queryFn:a(()=>De.get(),"queryFn"),enabled:!!e}),p=u?.experimental.enableBuiltInAgents===!0,f=v==="builtin"&&!p?"all":v,k=(0,d.useMemo)(()=>et.filter(s=>s.value!=="builtin"||p),[p]),{data:h}=j({queryKey:b.builtInAgents.list(e),queryFn:a(()=>We.list(e),"queryFn"),enabled:!!e&&p}),E=(0,d.useMemo)(()=>{const s=new Map;if(!p)return s;for(const c of h??[])c.agentId&&s.set(c.agentId,c);return s},[h,p]),V=(0,d.useMemo)(()=>new Set(E.keys()),[E]),[q,P]=(0,d.useState)(null),{data:g,isLoading:ve,error:G}=j({queryKey:b.agents.list(e),queryFn:a(()=>ee.list(e),"queryFn"),enabled:!!e}),{data:A}=j({queryKey:b.org(e),queryFn:a(()=>ee.org(e),"queryFn"),enabled:!!e&&l==="org"}),_=u?.experimental.enableEnvironments===!0,{data:C}=j({queryKey:b.environments.list(e),queryFn:a(()=>se.list(e),"queryFn"),enabled:!!e&&_}),{data:U}=j({queryKey:b.environments.capabilities(e),queryFn:a(()=>se.capabilities(e),"queryFn"),enabled:!!e&&_}),H=[...b.liveRuns(e),"agents-page"],R=Ve({companyId:e,resourceKey:"live-runs:agents-page",queryKey:H,enabled:!!e,refetchInterval:15e3,leaderOnly:!0}),{data:B,dataUpdatedAt:be}=j({queryKey:H,queryFn:a(()=>$e.liveRunsForCompany(e),"queryFn"),enabled:R.enabled,refetchInterval:R.refetchInterval});Qe(R,B,be);const Q=Ye(e),L=(0,d.useMemo)(()=>{const s=new Map;for(const c of B??[]){if(c.status!=="running"&&c.status!=="queued")continue;const x=s.get(c.agentId);if(x){x.liveCount+=1;continue}s.set(c.agentId,{runId:c.id,liveCount:1})}return s},[B]),je=(0,d.useMemo)(()=>{const s=new Map;for(const c of g??[])s.set(c.id,c);return s},[g]),W=(0,d.useMemo)(()=>{const s=new Map;for(const c of C??[])s.set(c.id,c);return s},[C]),X=(0,d.useMemo)(()=>{const s=new Map;for(const c of g??[])s.set(c.id,ot(c,W,u?.defaultEnvironmentId??null,U));return s},[g,W,U,u?.defaultEnvironmentId]);if((0,d.useEffect)(()=>{i([{label:"Agents"}])},[i]),(0,d.useEffect)(()=>{e&&v==="builtin"&&u&&!p&&r("/agents/all",{replace:!0})},[p,u,r,v,e]),!e)return(0,t.jsx)(ne,{icon:te,message:"Select a company to view agents."});if(ve)return(0,t.jsx)(Oe,{variant:"list"});const y=st(g??[],f,V),F=xe(A??[],f,V),Y=_&&C===void 0,Z=_&&(C===void 0||C.length>1),ye=a(s=>Y?me:X.get(s)??z,"resolveRenderedEnvironment"),Ne=a(s=>{const c=s.orgChainHealth?.status==="invalid_org_chain",x=E.get(s.id),we=x?.status==="needs_setup"||x?.status==="pending_approval",M=x&&we?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ue,{status:x.status}),x.status==="needs_setup"&&(0,t.jsx)("span",{onClick:a(J=>{J.preventDefault(),J.stopPropagation()},"onClick"),children:(0,t.jsx)(K,{size:"xs",variant:"outline",onClick:a(()=>P(x),"onClick"),children:"Set up"})})]}):null;return(0,t.jsx)(ze,{title:s.name,titleAccessory:(0,t.jsx)(Xe,{agentId:s.id,companyId:s.companyId}),titleClassName:"flex-1 xl:flex-none xl:w-56",titleTextClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitleClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitle:`${de[s.role]??s.role}${s.title?` - ${s.title}`:""}`,to:re(s),className:T("group",s.pausedAt&&f!=="paused"?"opacity-50":"",ce(Q.data,"agent",s.id)==="left"?"sm:text-foreground/55":""),leading:c?(0,t.jsx)(le,{className:"h-3.5 w-3.5 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(oe,{agent:s,size:32}),secondaryRow:M?(0,t.jsx)("div",{className:"xl:hidden flex flex-wrap items-center gap-1.5",children:M}):void 0,meta:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[M&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-1.5",children:M}),(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(he,{agent:s,environment:ye(s.id),showEnvironment:Z})})]}),metaSpacerClassName:"hidden xl:block",trailing:(0,t.jsx)("div",{className:"flex items-center gap-3",children:(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[L.has(s.id)&&(0,t.jsx)(O,{agentRef:$(s),runId:L.get(s.id).runId,liveCount:L.get(s.id).liveCount}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(D,{status:s.status})})]})})},s.id)},"renderAgentRow");return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsx)(Re,{value:f,onValueChange:a(s=>r(`/agents/${s}`),"onValueChange"),children:(0,t.jsx)(He,{items:k,value:f,onValueChange:a(s=>r(`/agents/${s}`),"onValueChange")})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[!I&&(0,t.jsxs)("div",{className:"flex items-center border border-border",role:"group","aria-label":"View mode",children:[(0,t.jsx)("button",{className:T("p-1.5 transition-colors",l==="list"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:a(()=>w("list"),"onClick"),title:"List view","aria-label":"List view","aria-pressed":l==="list",children:(0,t.jsx)(Fe,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{className:T("p-1.5 transition-colors",l==="org"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:a(()=>w("org"),"onClick"),title:"Org chart view","aria-label":"Org chart view","aria-pressed":l==="org",children:(0,t.jsx)(Pe,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)(K,{size:"sm",variant:"outline",onClick:n,children:[(0,t.jsx)(Te,{className:"h-3.5 w-3.5 mr-1.5"}),"New Agent"]})]})]}),y.length>0&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[y.length," agent",y.length!==1?"s":""]}),G&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:G.message}),g&&g.length===0&&(0,t.jsx)(ne,{icon:te,message:"Create your first agent to get started.",action:"New Agent",onAction:n}),l==="list"&&y.length>0&&(0,t.jsx)("div",{children:y.map(Ne)}),l==="list"&&g&&g.length>0&&y.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),l==="org"&&F.length>0&&(0,t.jsx)("div",{className:"py-1",children:F.map(s=>(0,t.jsx)(fe,{node:s,depth:0,agentMap:je,liveRunByAgent:L,environmentByAgentId:X,environmentDataLoading:Y,showEnvironment:Z,tab:f,memberships:Q.data,builtInByAgentId:E,onConfigureBuiltIn:P},s.id))}),l==="org"&&A&&A.length>0&&F.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),l==="org"&&A&&A.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No organizational hierarchy defined."}),q&&e&&(0,t.jsx)(d.Suspense,{fallback:null,children:(0,t.jsx)(Ze,{companyId:e,state:q,open:q!==null,onOpenChange:a(s=>{s||P(null)},"onOpenChange")})})]})}a(wt,"Agents");function fe({node:e,depth:n,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:m,showEnvironment:N,tab:v,memberships:S,builtInByAgentId:w,onConfigureBuiltIn:I}){const l=i.get(e.id),u=w.get(e.id),p=u?.status==="needs_setup"||u?.status==="pending_approval",f=!!(l&&l.orgChainHealth?.status==="invalid_org_chain"),k=ce(S,"agent",e.id);return(0,t.jsxs)("div",{style:{paddingLeft:n*24},children:[(0,t.jsxs)(ie,{to:l?re(l):`/agents/${e.id}`,className:T("group flex items-center gap-3 rounded-lg px-3 py-2 hover:bg-accent/50 transition-colors w-full text-left no-underline text-inherit",l?.pausedAt&&v!=="paused"&&"opacity-50",k==="left"&&"sm:text-foreground/55"),children:[f?(0,t.jsx)(le,{className:"h-3.5 w-3.5 shrink-0 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(oe,{agent:l??e,size:24}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"min-w-(--sz-7rem) truncate",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground ml-2",children:[de[e.role]??e.role,l?.title?` - ${l.title}`:""]})]}),u&&p&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,t.jsx)(ue,{status:u.status}),u.status==="needs_setup"&&(0,t.jsx)("span",{onClick:a(h=>{h.preventDefault(),h.stopPropagation()},"onClick"),children:(0,t.jsx)(K,{size:"xs",variant:"outline",onClick:a(()=>I(u),"onClick"),children:"Set up"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[(0,t.jsx)("span",{className:"sm:hidden",children:r.has(e.id)?(0,t.jsx)(O,{agentRef:l?$(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}):(0,t.jsx)(D,{status:e.status})}),(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[r.has(e.id)&&(0,t.jsx)(O,{agentRef:l?$(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}),l&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(he,{agent:l,environment:m?me:o.get(l.id)??z,showEnvironment:N})}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(D,{status:e.status})})]})]})]}),e.reports&&e.reports.length>0&&(0,t.jsx)("div",{className:"border-l border-border ml-4",children:e.reports.map(h=>(0,t.jsx)(fe,{node:h,depth:n+1,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:m,showEnvironment:N,tab:v,memberships:S,builtInByAgentId:w,onConfigureBuiltIn:I},h.id))})]})}a(fe,"OrgTreeNode");function he({agent:e,environment:n,showEnvironment:i}){const r=nt(e),o=Ue(e.adapterType);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate font-mono text-xs text-muted-foreground",title:r??void 0,children:r??"—"}),(0,t.jsx)("div",{className:"truncate font-mono text-(length:--text-micro) text-muted-foreground/70",title:o,children:o})]}),i&&(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate text-xs text-muted-foreground",title:n.title,children:n.label}),(0,t.jsx)("div",{className:"truncate text-(length:--text-micro) text-muted-foreground/70",children:n.detail})]}),(0,t.jsx)("span",{className:"w-24 whitespace-nowrap text-right text-xs text-muted-foreground",children:e.lastHeartbeatAt?_e(e.lastHeartbeatAt):"—"})]})}a(he,"AgentMetaColumns");function O({agentRef:e,runId:n,liveCount:i}){return(0,t.jsxs)(ie,{to:`/agents/${e}/runs/${n}`,className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-blue-500/10 hover:bg-blue-500/20 transition-colors no-underline",onClick:a(r=>r.stopPropagation(),"onClick"),children:[(0,t.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,t.jsx)("span",{className:"animate-pulse absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]}),(0,t.jsxs)("span",{className:"text-(length:--text-micro) font-medium text-blue-600 dark:text-blue-400",children:["Live",i>1?` (${i})`:""]})]})}a(O,"LiveRunIndicator");export{wt as Agents};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-st-IN4Gf.js","assets/rolldown-runtime-ZpX3ckPj.js","assets/agent-avatar-url-eBzFMwFS.js","assets/preload-helper-CceJXRIF.js","assets/BreadcrumbContext-C-JqFdLZ.js","assets/label-D4Q0SI3t.js","assets/mention-chips-BEoxPZei.js","assets/dist-CfR2_c4p.js","assets/dist-Dz68ZFqX.js","assets/checkbox-Cm-PyDSt.js","assets/check-VcfFMsHr.js","assets/clipboard-CYFyFXxJ.js","assets/RoutineRunVariablesDialog-BfaOkOdj.js","assets/alert-dialog-Ctnjtpv6.js","assets/AgentAvatar-DySHTTwq.js","assets/MarkdownEditor-B6kwxxZP.js","assets/dist-Z45aKkJm.js","assets/dist-BhxPxuMy.js","assets/StatusIcon-DxxLvme9.js","assets/badge-CUe24HAP.js","assets/bot-wKcWfYKX.js","assets/select-yD0r8C3i.js","assets/ToastContext-BbzJdb2r.js","assets/sheet-CAjfRCp9.js","assets/heartbeats-BgAe0g2m.js","assets/useHiddenSettings-Uo-rfexH.js","assets/health-D_DTw2-J.js","assets/rotate-ccw-BT1r8zDE.js","assets/environments-Cc8orNVy.js","assets/input-BARyUoy0.js","assets/company-members-CSVvQnvh.js","assets/card-GbQ9sLu8.js","assets/EmptyState-fxPFhH-R.js","assets/PageSkeleton-iVZWoLsF.js","assets/skeleton-BFMc3stE.js","assets/tabs-C1f963Rn.js","assets/use-adapter-capabilities-CsKGmy5W.js","assets/use-copy-action-B-Azftuv.js","assets/arrow-right-DyKWA_SL.js","assets/external-link-CAutrcht.js","assets/MarkdownBody-CEcIElD-.js","assets/file-text-Dik8gyob.js","assets/index-B2A-dAWv.css"])))=>i.map(i=>d[i]);
2
+ var Ie=Object.defineProperty;var a=(e,n)=>Ie(e,"name",{value:n,configurable:!0});import{i as ae}from"./rolldown-runtime-ZpX3ckPj.js";import{B as re,G as T,Ia as Ae,Ra as Ce,St as b,ht as Se,mi as Ee,na as j,ut as _e,z as $}from"./agent-avatar-url-eBzFMwFS.js";import{t as Le}from"./preload-helper-CceJXRIF.js";import{Ln as Me,ct as Te,f as ke,i as K,n as qe,r as ee,s as ie,yt as Pe}from"./BreadcrumbContext-C-JqFdLZ.js";import{m as le}from"./alert-dialog-Ctnjtpv6.js";import{t as oe}from"./AgentAvatar-DySHTTwq.js";import{t as Re}from"./tabs-C1f963Rn.js";import{t as te}from"./bot-wKcWfYKX.js";import{i as Be,o as Fe,t as $e}from"./heartbeats-BgAe0g2m.js";import{i as Ke,n as De,t as se}from"./environments-Cc8orNVy.js";import{t as ne}from"./EmptyState-fxPFhH-R.js";import{t as Oe}from"./PageSkeleton-iVZWoLsF.js";import{Dt as ze,Ft as D,Gt as Ve,Kt as ce,Lt as Ge,Rt as Ue,Vt as He,Wt as Qe,Xt as We,Yt as ue,Zt as Xe,qt as Ye}from"./index-st-IN4Gf.js";var d=ae(Ce(),1),t=ae(Ae(),1),de=Ee,Ze=(0,d.lazy)(()=>Le(()=>import("./index-st-IN4Gf.js").then(e=>e.gt).then(e=>({default:e.ConfigureBuiltInAgentModal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42]))),Je=["all","active","paused","error","builtin"],et=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"paused",label:"Paused"},{value:"error",label:"Error"},{value:"builtin",label:"Built-in"}];function tt(e){return Je.includes(e)}a(tt,"isFilterTab");var z={label:"Local",detail:"Paperclip host",title:"Local - Paperclip host"},me={label:"—",detail:"Loading environment",title:"Loading environment"},pe=new Set(["terminated","pending_approval"]);function ge(e,n){return n==="all"?!0:n==="active"?e==="active"||e==="running"||e==="idle":n==="paused"?e==="paused":n==="error"?e==="error":!0}a(ge,"matchesFilter");function st(e,n,i){return e.filter(r=>pe.has(r.status)?!1:n==="builtin"?i.has(r.id):ge(r.status,n)).sort((r,o)=>r.name.localeCompare(o.name))}a(st,"filterAgents");function nt(e){const n=e.adapterConfig?.model;if(typeof n!="string")return null;const i=n.trim();return i.length>0?i:null}a(nt,"getConfiguredModel");function at(e){return e==="ssh"?"SSH":e.charAt(0).toUpperCase()+e.slice(1)}a(at,"formatEnvironmentDriver");function rt(e,n){const i=typeof e.config.provider=="string"?e.config.provider.trim():"";return i?n?.sandboxProviders?.[i]?.displayName??i:"Sandbox"}a(rt,"getSandboxProviderLabel");function it(e,n){const i=Ge(e)?"Managed by Paperclip":e.driver==="sandbox"?`${rt(e,n)} sandbox provider`:e.driver==="local"?"Paperclip host":at(e.driver);return{label:e.name,detail:i,title:`${e.name} - ${i}`}}a(it,"describeEnvironment");function lt(e){return{label:"Unknown environment",detail:e.slice(0,8),title:`Unknown environment - ${e}`}}a(lt,"describeMissingEnvironment");function ot(e,n,i,r){const o=e.defaultEnvironmentId??i;if(!o)return z;const m=n.get(o);return m?it(m,r):lt(o)}a(ot,"resolveAgentEnvironment");function xe(e,n,i){return e.reduce((r,o)=>{const m=xe(o.reports,n,i);return pe.has(o.status)?(r.push(...m),r):(((n==="builtin"?i.has(o.id):ge(o.status,n))||m.length>0)&&r.push({...o,reports:m}),r)},[]).sort((r,o)=>r.name.localeCompare(o.name))}a(xe,"filterOrgTree");function wt(){const{selectedCompanyId:e}=Se(),{openNewAgent:n}=Be(),{setBreadcrumbs:i}=qe(),r=ke(),o=Me(),{isMobile:m}=Ke(),N=o.pathname.split("/").pop()??"all",v=tt(N)?N:"all",[S,w]=(0,d.useState)("org"),I=m,l=I?"list":S,{data:u}=j({queryKey:b.instance.settings,queryFn:a(()=>De.get(),"queryFn"),enabled:!!e}),p=u?.experimental.enableBuiltInAgents===!0,f=v==="builtin"&&!p?"all":v,k=(0,d.useMemo)(()=>et.filter(s=>s.value!=="builtin"||p),[p]),{data:h}=j({queryKey:b.builtInAgents.list(e),queryFn:a(()=>We.list(e),"queryFn"),enabled:!!e&&p}),E=(0,d.useMemo)(()=>{const s=new Map;if(!p)return s;for(const c of h??[])c.agentId&&s.set(c.agentId,c);return s},[h,p]),V=(0,d.useMemo)(()=>new Set(E.keys()),[E]),[q,P]=(0,d.useState)(null),{data:g,isLoading:ve,error:G}=j({queryKey:b.agents.list(e),queryFn:a(()=>ee.list(e),"queryFn"),enabled:!!e}),{data:A}=j({queryKey:b.org(e),queryFn:a(()=>ee.org(e),"queryFn"),enabled:!!e&&l==="org"}),_=u?.experimental.enableEnvironments===!0,{data:C}=j({queryKey:b.environments.list(e),queryFn:a(()=>se.list(e),"queryFn"),enabled:!!e&&_}),{data:U}=j({queryKey:b.environments.capabilities(e),queryFn:a(()=>se.capabilities(e),"queryFn"),enabled:!!e&&_}),H=[...b.liveRuns(e),"agents-page"],R=Ve({companyId:e,resourceKey:"live-runs:agents-page",queryKey:H,enabled:!!e,refetchInterval:15e3,leaderOnly:!0}),{data:B,dataUpdatedAt:be}=j({queryKey:H,queryFn:a(()=>$e.liveRunsForCompany(e),"queryFn"),enabled:R.enabled,refetchInterval:R.refetchInterval});Qe(R,B,be);const Q=Ye(e),L=(0,d.useMemo)(()=>{const s=new Map;for(const c of B??[]){if(c.status!=="running"&&c.status!=="queued")continue;const x=s.get(c.agentId);if(x){x.liveCount+=1;continue}s.set(c.agentId,{runId:c.id,liveCount:1})}return s},[B]),je=(0,d.useMemo)(()=>{const s=new Map;for(const c of g??[])s.set(c.id,c);return s},[g]),W=(0,d.useMemo)(()=>{const s=new Map;for(const c of C??[])s.set(c.id,c);return s},[C]),X=(0,d.useMemo)(()=>{const s=new Map;for(const c of g??[])s.set(c.id,ot(c,W,u?.defaultEnvironmentId??null,U));return s},[g,W,U,u?.defaultEnvironmentId]);if((0,d.useEffect)(()=>{i([{label:"Agents"}])},[i]),(0,d.useEffect)(()=>{e&&v==="builtin"&&u&&!p&&r("/agents/all",{replace:!0})},[p,u,r,v,e]),!e)return(0,t.jsx)(ne,{icon:te,message:"Select a company to view agents."});if(ve)return(0,t.jsx)(Oe,{variant:"list"});const y=st(g??[],f,V),F=xe(A??[],f,V),Y=_&&C===void 0,Z=_&&(C===void 0||C.length>1),ye=a(s=>Y?me:X.get(s)??z,"resolveRenderedEnvironment"),Ne=a(s=>{const c=s.orgChainHealth?.status==="invalid_org_chain",x=E.get(s.id),we=x?.status==="needs_setup"||x?.status==="pending_approval",M=x&&we?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ue,{status:x.status}),x.status==="needs_setup"&&(0,t.jsx)("span",{onClick:a(J=>{J.preventDefault(),J.stopPropagation()},"onClick"),children:(0,t.jsx)(K,{size:"xs",variant:"outline",onClick:a(()=>P(x),"onClick"),children:"Set up"})})]}):null;return(0,t.jsx)(ze,{title:s.name,titleAccessory:(0,t.jsx)(Xe,{agentId:s.id,companyId:s.companyId}),titleClassName:"flex-1 xl:flex-none xl:w-56",titleTextClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitleClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitle:`${de[s.role]??s.role}${s.title?` - ${s.title}`:""}`,to:re(s),className:T("group",s.pausedAt&&f!=="paused"?"opacity-50":"",ce(Q.data,"agent",s.id)==="left"?"sm:text-foreground/55":""),leading:c?(0,t.jsx)(le,{className:"h-3.5 w-3.5 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(oe,{agent:s,size:32}),secondaryRow:M?(0,t.jsx)("div",{className:"xl:hidden flex flex-wrap items-center gap-1.5",children:M}):void 0,meta:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[M&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-1.5",children:M}),(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(he,{agent:s,environment:ye(s.id),showEnvironment:Z})})]}),metaSpacerClassName:"hidden xl:block",trailing:(0,t.jsx)("div",{className:"flex items-center gap-3",children:(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[L.has(s.id)&&(0,t.jsx)(O,{agentRef:$(s),runId:L.get(s.id).runId,liveCount:L.get(s.id).liveCount}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(D,{status:s.status})})]})})},s.id)},"renderAgentRow");return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsx)(Re,{value:f,onValueChange:a(s=>r(`/agents/${s}`),"onValueChange"),children:(0,t.jsx)(He,{items:k,value:f,onValueChange:a(s=>r(`/agents/${s}`),"onValueChange")})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[!I&&(0,t.jsxs)("div",{className:"flex items-center border border-border",role:"group","aria-label":"View mode",children:[(0,t.jsx)("button",{className:T("p-1.5 transition-colors",l==="list"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:a(()=>w("list"),"onClick"),title:"List view","aria-label":"List view","aria-pressed":l==="list",children:(0,t.jsx)(Fe,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{className:T("p-1.5 transition-colors",l==="org"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:a(()=>w("org"),"onClick"),title:"Org chart view","aria-label":"Org chart view","aria-pressed":l==="org",children:(0,t.jsx)(Pe,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)(K,{size:"sm",variant:"outline",onClick:n,children:[(0,t.jsx)(Te,{className:"h-3.5 w-3.5 mr-1.5"}),"New Agent"]})]})]}),y.length>0&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[y.length," agent",y.length!==1?"s":""]}),G&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:G.message}),g&&g.length===0&&(0,t.jsx)(ne,{icon:te,message:"Create your first agent to get started.",action:"New Agent",onAction:n}),l==="list"&&y.length>0&&(0,t.jsx)("div",{children:y.map(Ne)}),l==="list"&&g&&g.length>0&&y.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),l==="org"&&F.length>0&&(0,t.jsx)("div",{className:"py-1",children:F.map(s=>(0,t.jsx)(fe,{node:s,depth:0,agentMap:je,liveRunByAgent:L,environmentByAgentId:X,environmentDataLoading:Y,showEnvironment:Z,tab:f,memberships:Q.data,builtInByAgentId:E,onConfigureBuiltIn:P},s.id))}),l==="org"&&A&&A.length>0&&F.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),l==="org"&&A&&A.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No organizational hierarchy defined."}),q&&e&&(0,t.jsx)(d.Suspense,{fallback:null,children:(0,t.jsx)(Ze,{companyId:e,state:q,open:q!==null,onOpenChange:a(s=>{s||P(null)},"onOpenChange")})})]})}a(wt,"Agents");function fe({node:e,depth:n,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:m,showEnvironment:N,tab:v,memberships:S,builtInByAgentId:w,onConfigureBuiltIn:I}){const l=i.get(e.id),u=w.get(e.id),p=u?.status==="needs_setup"||u?.status==="pending_approval",f=!!(l&&l.orgChainHealth?.status==="invalid_org_chain"),k=ce(S,"agent",e.id);return(0,t.jsxs)("div",{style:{paddingLeft:n*24},children:[(0,t.jsxs)(ie,{to:l?re(l):`/agents/${e.id}`,className:T("group flex items-center gap-3 rounded-lg px-3 py-2 hover:bg-accent/50 transition-colors w-full text-left no-underline text-inherit",l?.pausedAt&&v!=="paused"&&"opacity-50",k==="left"&&"sm:text-foreground/55"),children:[f?(0,t.jsx)(le,{className:"h-3.5 w-3.5 shrink-0 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(oe,{agent:l??e,size:24}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"min-w-(--sz-7rem) truncate",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground ml-2",children:[de[e.role]??e.role,l?.title?` - ${l.title}`:""]})]}),u&&p&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,t.jsx)(ue,{status:u.status}),u.status==="needs_setup"&&(0,t.jsx)("span",{onClick:a(h=>{h.preventDefault(),h.stopPropagation()},"onClick"),children:(0,t.jsx)(K,{size:"xs",variant:"outline",onClick:a(()=>I(u),"onClick"),children:"Set up"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[(0,t.jsx)("span",{className:"sm:hidden",children:r.has(e.id)?(0,t.jsx)(O,{agentRef:l?$(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}):(0,t.jsx)(D,{status:e.status})}),(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[r.has(e.id)&&(0,t.jsx)(O,{agentRef:l?$(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}),l&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(he,{agent:l,environment:m?me:o.get(l.id)??z,showEnvironment:N})}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(D,{status:e.status})})]})]})]}),e.reports&&e.reports.length>0&&(0,t.jsx)("div",{className:"border-l border-border ml-4",children:e.reports.map(h=>(0,t.jsx)(fe,{node:h,depth:n+1,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:m,showEnvironment:N,tab:v,memberships:S,builtInByAgentId:w,onConfigureBuiltIn:I},h.id))})]})}a(fe,"OrgTreeNode");function he({agent:e,environment:n,showEnvironment:i}){const r=nt(e),o=Ue(e.adapterType);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate font-mono text-xs text-muted-foreground",title:r??void 0,children:r??"—"}),(0,t.jsx)("div",{className:"truncate font-mono text-(length:--text-micro) text-muted-foreground/70",title:o,children:o})]}),i&&(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate text-xs text-muted-foreground",title:n.title,children:n.label}),(0,t.jsx)("div",{className:"truncate text-(length:--text-micro) text-muted-foreground/70",children:n.detail})]}),(0,t.jsx)("span",{className:"w-24 whitespace-nowrap text-right text-xs text-muted-foreground",children:e.lastHeartbeatAt?_e(e.lastHeartbeatAt):"—"})]})}a(he,"AgentMetaColumns");function O({agentRef:e,runId:n,liveCount:i}){return(0,t.jsxs)(ie,{to:`/agents/${e}/runs/${n}`,className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-blue-500/10 hover:bg-blue-500/20 transition-colors no-underline",onClick:a(r=>r.stopPropagation(),"onClick"),children:[(0,t.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,t.jsx)("span",{className:"animate-pulse absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]}),(0,t.jsxs)("span",{className:"text-(length:--text-micro) font-medium text-blue-600 dark:text-blue-400",children:["Live",i>1?` (${i})`:""]})]})}a(O,"LiveRunIndicator");export{wt as Agents};
@@ -1,4 +1,4 @@
1
- var On=Object.defineProperty;var a=(e,t)=>On(e,"name",{value:t,configurable:!0});import{i as jt}from"./rolldown-runtime-ZpX3ckPj.js";import{Er as st,Fa as jn,G as K,Hi as d,Ia as Bn,P as Nn,Ra as zn,St as de,Tr as Fn,Ui as qn,Vi as Bt,Wi as Hn,a as Wn,c as Vn,ht as Kn,ji as Qn,l as Jn,n as k,na as Gn,pt as Yn,r as Zn,t as Xn,u as ea}from"./agent-avatar-url-B91C7fqh.js";import{t as ta}from"./preload-helper-CceJXRIF.js";var l=jt(zn(),1),We=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Nt=/^[\\/]{2}/;function ra(e,t){return t+e.replace(/\\/g,"/")}a(ra,"normalizeProtocolRelativeUrl");var it="popstate";function lt(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}a(lt,"isLocation");function na(e={}){function t(n,o){let s=o.state?.masked,{pathname:i,search:u,hash:c}=s||n.location;return Oe("",{pathname:i,search:u,hash:c},o.state&&o.state.usr||null,o.state&&o.state.key||"default",s?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}a(t,"createBrowserLocation");function r(n,o){return typeof o=="string"?o:Q(o)}return a(r,"createBrowserHref"),oa(t,r,null,e)}a(na,"createBrowserHistory");function $(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}a($,"invariant");function M(e,t){if(!e)try{throw new Error(t)}catch{}}a(M,"warning");function aa(){return Math.random().toString(36).substring(2,10)}a(aa,"createKey");function ut(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}a(ut,"getHistoryState");function Oe(e,t,r=null,n,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?te(t):t,state:r,key:t&&t.key||n||aa(),mask:o}}a(Oe,"createLocation");function Q({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}a(Q,"createPath");function te(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}a(te,"parsePath");function oa(e,t,r,n={}){let{window:o=document.defaultView,v5Compat:s=!1}=n,i=o.history,u="POP",c=null,m=p();m==null&&(m=0,i.replaceState({...i.state,idx:m},""));function p(){return(i.state||{idx:null}).idx}a(p,"getIndex");function f(){u="POP";let h=p(),x=h==null?null:h-m;m=h,c&&c({action:u,location:y.location,delta:x})}a(f,"handlePop");function g(h,x){u="PUSH";let w=lt(h)?h:Oe(y.location,h,x);r&&r(w,h),m=p()+1;let I=ut(w,m),_=y.createHref(w.mask||w);try{i.pushState(I,"",_)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;o.location.assign(_)}s&&c&&c({action:u,location:y.location,delta:1})}a(g,"push");function b(h,x){u="REPLACE";let w=lt(h)?h:Oe(y.location,h,x);r&&r(w,h),m=p();let I=ut(w,m),_=y.createHref(w.mask||w);i.replaceState(I,"",_),s&&c&&c({action:u,location:y.location,delta:0})}a(b,"replace2");function v(h){return sa(o,h)}a(v,"createURL");let y={get action(){return u},get location(){return e(o,i)},listen(h){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(it,f),c=h,()=>{o.removeEventListener(it,f),c=null}},createHref(h){return t(o,h)},createURL:v,encodeLocation(h){let x=v(h);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:g,replace:b,go(h){return i.go(h)}};return y}a(oa,"getUrlBasedHistory");function sa(e,t,r=!1){let n="http://localhost";e&&(n=e.location.origin!=="null"?e.location.origin:e.location.href),$(n,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:Q(t);return o=o.replace(/ $/,"%20"),!r&&Nt.test(o)&&(o=n+o),new URL(o,n)}a(sa,"createBrowserURLImpl");var ia;ia=new WeakMap;function zt(e,t,r="/"){return Ft(e,t,r,!1)}a(zt,"matchRoutes");function Ft(e,t,r,n,o){let s=q((typeof t=="string"?te(t):t).pathname||"/",r);if(s==null)return null;let i=o??ua(e),u=null,c=ka(s);for(let m=0;u==null&&m<i.length;++m)u=ba(i[m],c,n);return u}a(Ft,"matchRoutesImpl");function la(e,t){let{route:r,pathname:n,params:o}=e;return{id:r.id,pathname:n,params:o,data:t[r.id],loaderData:t[r.id],handle:r.handle}}a(la,"convertRouteMatchToUiMatch");function ua(e){let t=qt(e);return ca(t),t}a(ua,"flattenAndRankRoutes");function qt(e,t=[],r=[],n="",o=!1){let s=a((i,u,c=o,m)=>{let p={relativePath:m===void 0?i.path||"":m,caseSensitive:i.caseSensitive===!0,childrenIndex:u,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(n)&&c)return;$(p.relativePath.startsWith(n),`Absolute route path "${p.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(n.length)}let f=B([n,p.relativePath]),g=r.concat(p);i.children&&i.children.length>0&&($(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),qt(i.children,t,g,f,c)),!(i.path==null&&!i.index)&&t.push({path:f,score:ya(f,i.index),routesMeta:g.map((b,v)=>{let[y,h]=Vt(b.relativePath,b.caseSensitive,v===g.length-1);return{...b,matcher:y,compiledParams:h}})})},"flattenRoute");return e.forEach((i,u)=>{if(i.path===""||!i.path?.includes("?"))s(i,u);else for(let c of Ht(i.path))s(i,u,!0,c)}),t}a(qt,"flattenRoutes");function Ht(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,o=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return o?[s,""]:[s];let i=Ht(n.join("/")),u=[];return u.push(...i.map(c=>c===""?s:[s,c].join("/"))),o&&u.push(...i),u.map(c=>e.startsWith("/")&&c===""?"/":c)}a(Ht,"explodeOptionalSegments");function ca(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:va(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}a(ca,"rankRouteBranches");var da=/^:[\w-]+$/,ma=3,fa=2,pa=1,ha=10,ga=-2,ct=a(e=>e==="*","isSplat");function ya(e,t){let r=e.split("/"),n=r.length;return r.some(ct)&&(n+=ga),t&&(n+=fa),r.filter(o=>!ct(o)).reduce((o,s)=>o+(da.test(s)?ma:s===""?pa:ha),n)}a(ya,"computeScore");function va(e,t){return e.length===t.length&&e.slice(0,-1).every((r,n)=>r===t[n])?e[e.length-1]-t[t.length-1]:0}a(va,"compareIndexes");function ba(e,t,r=!1){let{routesMeta:n}=e,o={},s="/",i=[];for(let u=0;u<n.length;++u){let c=n[u],m=u===n.length-1,p=s==="/"?t:t.slice(s.length)||"/",f={path:c.relativePath,caseSensitive:c.caseSensitive,end:m},g=c.matcher&&c.compiledParams?Wt(f,p,c.matcher,c.compiledParams):xe(f,p),b=c.route;if(!g&&m&&r&&!n[n.length-1].route.index&&(g=xe({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},p)),!g)return null;Object.assign(o,g.params),i.push({params:o,pathname:B([s,g.pathname]),pathnameBase:Ia(B([s,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(s=B([s,g.pathnameBase]))}return i}a(ba,"matchRouteBranch");function xe(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Vt(e.path,e.caseSensitive,e.end);return Wt(e,t,r,n)}a(xe,"matchPath");function Wt(e,t,r,n){let o=t.match(r);if(!o)return null;let s=o[0],i=X(s,1),u=o.slice(1);return{params:n.reduce((c,{paramName:m,isOptional:p},f)=>{if(m==="*"){let b=u[f]||"";i=X(s.slice(0,s.length-b.length),1)}const g=u[f];return p&&!g?c[m]=void 0:c[m]=(g||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:i,pattern:e}}a(Wt,"matchPathImpl");function Vt(e,t=!1,r=!0){M(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,i,u,c,m)=>{if(n.push({paramName:i,isOptional:u!=null}),u){let p=m.charAt(c+s.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}a(Vt,"compilePath");function ka(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return M(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}a(ka,"decodePath");function q(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}a(q,"stripBasename");function xa(e,t="/"){let{pathname:r,search:n="",hash:o=""}=typeof e=="string"?te(e):e,s;return r?(r=Kt(r),r.startsWith("/")||r.startsWith("\\")?s=dt(r.substring(1),"/"):s=dt(r,t)):s=t,{pathname:s,search:Sa(n),hash:Ra(o)}}a(xa,"resolvePath");function dt(e,t){let r=X(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}a(dt,"resolvePathname");function Le(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}a(Le,"getInvalidPathError");function wa(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}a(wa,"getPathContributingMatches");function Ve(e){let t=wa(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}a(Ve,"getResolveToMatches");function Re(e,t,r,n=!1){let o;typeof e=="string"?o=te(e):(o={...e},$(!o.pathname||!o.pathname.includes("?"),Le("?","pathname","search",o)),$(!o.pathname||!o.pathname.includes("#"),Le("#","pathname","hash",o)),$(!o.search||!o.search.includes("#"),Le("#","search","hash",o)));let s=e===""||o.pathname==="",i=s?"/":o.pathname,u;if(i==null)u=r;else{let f=t.length-1;if(!n&&i.startsWith("..")){let g=i.split("/");for(;g[0]==="..";)g.shift(),f-=1;o.pathname=g.join("/")}u=f>=0?t[f]:"/"}let c=xa(o,u),m=i&&i!=="/"&&i.endsWith("/"),p=(s||i===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(m||p)&&(c.pathname+="/"),c}a(Re,"resolveTo$1");var Kt=a(e=>e.replace(/[\\/]{2,}/g,"/"),"removeDoubleSlashes"),B=a(e=>Kt(e.join("/")),"joinPaths");function X(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}a(X,"removeTrailingSlash");var Ia=a(e=>X(e).replace(/^\/*/,"/"),"normalizePathname"),Sa=a(e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,"normalizeSearch"),Ra=a(e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,"normalizeHash"),Ca=class{static{a(this,"ErrorResponseImpl")}constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Qt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}a(Qt,"isRouteErrorResponse");function Ea(e){return B(e.map(t=>t.route.path).filter(Boolean))||"/"}a(Ea,"getRoutePattern");var Jt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Gt(e,t){let r=e;if(typeof r!="string"||!We.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,o=!1;if(Jt)try{let s=new URL(window.location.href),i=Nt.test(r)?new URL(ra(r,s.protocol)):new URL(r),u=q(i.pathname,t);i.origin===s.origin&&u!=null?r=u+i.search+i.hash:o=!0}catch{M(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:o,to:r}}a(Gt,"parseToInfo");var Ji=Object.getOwnPropertyNames(Object.prototype).sort().join("\0"),mt=new URL("http://localhost");function Ke(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),mt)}catch{return mt}}a(Ke,"getNavigatorCurrentUrl");function Me(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}a(Me,"isSameOrigin");function $a(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}a($a,"isExplicitUrl");function Qe(e,t,r,n){let o=null;try{o=e==null?null:new URL(e,r)}catch{}let s=new URL(t,r),i=o!=null&&!Me(o,r),u=!Me(s,r);if(n==="reject"){if(i||u)throw new Error("External navigation is not allowed")}else if(u&&(o==null||!$a(e,o)||!Me(o,s)))throw new Error("External navigation is not allowed")}a(Qe,"validateNavigationTarget");var Yt=["POST","PUT","PATCH","DELETE"],Gi=new Set(Yt),_a=["GET",...Yt],Yi=new Set(_a),Aa,Da,Pa,La;Aa=new WeakMap;Da=new WeakMap;Pa=new WeakMap;La=new WeakMap;var Ma=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Ta(e){try{return Ma.includes(new URL(e).protocol)}catch{return!1}}a(Ta,"hasInvalidProtocol");var re=l.createContext(null);re.displayName="DataRouter";var me=l.createContext(null);me.displayName="DataRouterState";var Zt=l.createContext(!1);function Xt(){return l.useContext(Zt)}a(Xt,"useIsRSCRouterContext");var er=l.createContext({isTransitioning:!1});er.displayName="ViewTransition";var Ua=l.createContext(new Map);Ua.displayName="Fetchers";var je=l.createContext(null);je.displayName="Await";var P=l.createContext(null);P.displayName="Navigation";var ne=l.createContext(null);ne.displayName="Location";var O=l.createContext({outlet:null,matches:[],isDataRoute:!1});O.displayName="Route";var Je=l.createContext(null);Je.displayName="RouteError";var tr="REACT_ROUTER_ERROR",Oa="REDIRECT",ja="ROUTE_ERROR_RESPONSE";function Ba(e){if(e.startsWith(`${tr}:${Oa}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}a(Ba,"decodeRedirectErrorDigest");function Na(e){if(e.startsWith(`${tr}:${ja}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ca(t.status,t.statusText,t.data)}catch{}}a(Na,"decodeRouteErrorResponseDigest");function za(e,{relative:t}={}){$(ae(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=l.useContext(P),{hash:o,pathname:s,search:i}=fe(e,{relative:t}),u=s;return r!=="/"&&(u=s==="/"?r:B([r,s])),n.createHref({pathname:u,search:i,hash:o})}a(za,"useHref");function ae(){return l.useContext(ne)!=null}a(ae,"useInRouterContext");function T(){return $(ae(),"useLocation() may be used only in the context of a <Router> component."),l.useContext(ne).location}a(T,"useLocation");function Zi(){return l.useContext(ne).navigationType}a(Zi,"useNavigationType");var rr="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nr(e){l.useContext(P).static||l.useLayoutEffect(e)}a(nr,"useIsomorphicLayoutEffect");function Ce(){let{isDataRoute:e}=l.useContext(O);return e?no():Fa()}a(Ce,"useNavigate$1");function Fa(){$(ae(),"useNavigate() may be used only in the context of a <Router> component.");let e=l.useContext(re),{basename:t,navigator:r}=l.useContext(P),{matches:n}=l.useContext(O),{pathname:o}=T(),s=JSON.stringify(Ve(n)),i=l.useRef(!1);return nr(()=>{i.current=!0}),l.useCallback((u,c={})=>{if(M(i.current,rr),!i.current)return;if(typeof u=="number"){r.go(u);return}let m=Re(u,JSON.parse(s),o,c.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:B([t,m.pathname])),Qe(typeof u=="string"?u:Q(u),r.createHref(m),Ke(r),"reject"),(c.replace?r.replace:r.push)(m,c.state,c)},[t,r,s,o,e])}a(Fa,"useNavigateUnstable");var qa=l.createContext(null);function Ha(e){let t=l.useContext(O).outlet;return l.useMemo(()=>t&&l.createElement(qa.Provider,{value:e},t),[t,e])}a(Ha,"useOutlet");function Wa(){let{matches:e}=l.useContext(O);return e[e.length-1]?.params??{}}a(Wa,"useParams");function fe(e,{relative:t}={}){let{matches:r}=l.useContext(O),{pathname:n}=T(),o=JSON.stringify(Ve(r));return l.useMemo(()=>Re(e,JSON.parse(o),n,t==="path"),[e,o,n,t])}a(fe,"useResolvedPath");function Va(e,t){return ar(e,t)}a(Va,"useRoutes");function ar(e,t,r){$(ae(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=l.useContext(P),{matches:o}=l.useContext(O),s=o[o.length-1],i=s?s.params:{},u=s?s.pathname:"/",c=s?s.pathnameBase:"/",m=s&&s.route;{let h=m&&m.path||"";ir(u,!m||h.endsWith("*")||h.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${h}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
1
+ var On=Object.defineProperty;var a=(e,t)=>On(e,"name",{value:t,configurable:!0});import{i as jt}from"./rolldown-runtime-ZpX3ckPj.js";import{Er as st,Fa as jn,G as K,Hi as d,Ia as Bn,P as Nn,Ra as zn,St as de,Tr as Fn,Ui as qn,Vi as Bt,Wi as Hn,a as Wn,c as Vn,ht as Kn,ji as Qn,l as Jn,n as k,na as Gn,pt as Yn,r as Zn,t as Xn,u as ea}from"./agent-avatar-url-eBzFMwFS.js";import{t as ta}from"./preload-helper-CceJXRIF.js";var l=jt(zn(),1),We=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Nt=/^[\\/]{2}/;function ra(e,t){return t+e.replace(/\\/g,"/")}a(ra,"normalizeProtocolRelativeUrl");var it="popstate";function lt(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}a(lt,"isLocation");function na(e={}){function t(n,o){let s=o.state?.masked,{pathname:i,search:u,hash:c}=s||n.location;return Oe("",{pathname:i,search:u,hash:c},o.state&&o.state.usr||null,o.state&&o.state.key||"default",s?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}a(t,"createBrowserLocation");function r(n,o){return typeof o=="string"?o:Q(o)}return a(r,"createBrowserHref"),oa(t,r,null,e)}a(na,"createBrowserHistory");function $(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}a($,"invariant");function M(e,t){if(!e)try{throw new Error(t)}catch{}}a(M,"warning");function aa(){return Math.random().toString(36).substring(2,10)}a(aa,"createKey");function ut(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}a(ut,"getHistoryState");function Oe(e,t,r=null,n,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?te(t):t,state:r,key:t&&t.key||n||aa(),mask:o}}a(Oe,"createLocation");function Q({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}a(Q,"createPath");function te(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}a(te,"parsePath");function oa(e,t,r,n={}){let{window:o=document.defaultView,v5Compat:s=!1}=n,i=o.history,u="POP",c=null,m=p();m==null&&(m=0,i.replaceState({...i.state,idx:m},""));function p(){return(i.state||{idx:null}).idx}a(p,"getIndex");function f(){u="POP";let h=p(),x=h==null?null:h-m;m=h,c&&c({action:u,location:y.location,delta:x})}a(f,"handlePop");function g(h,x){u="PUSH";let w=lt(h)?h:Oe(y.location,h,x);r&&r(w,h),m=p()+1;let I=ut(w,m),_=y.createHref(w.mask||w);try{i.pushState(I,"",_)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;o.location.assign(_)}s&&c&&c({action:u,location:y.location,delta:1})}a(g,"push");function b(h,x){u="REPLACE";let w=lt(h)?h:Oe(y.location,h,x);r&&r(w,h),m=p();let I=ut(w,m),_=y.createHref(w.mask||w);i.replaceState(I,"",_),s&&c&&c({action:u,location:y.location,delta:0})}a(b,"replace2");function v(h){return sa(o,h)}a(v,"createURL");let y={get action(){return u},get location(){return e(o,i)},listen(h){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(it,f),c=h,()=>{o.removeEventListener(it,f),c=null}},createHref(h){return t(o,h)},createURL:v,encodeLocation(h){let x=v(h);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:g,replace:b,go(h){return i.go(h)}};return y}a(oa,"getUrlBasedHistory");function sa(e,t,r=!1){let n="http://localhost";e&&(n=e.location.origin!=="null"?e.location.origin:e.location.href),$(n,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:Q(t);return o=o.replace(/ $/,"%20"),!r&&Nt.test(o)&&(o=n+o),new URL(o,n)}a(sa,"createBrowserURLImpl");var ia;ia=new WeakMap;function zt(e,t,r="/"){return Ft(e,t,r,!1)}a(zt,"matchRoutes");function Ft(e,t,r,n,o){let s=q((typeof t=="string"?te(t):t).pathname||"/",r);if(s==null)return null;let i=o??ua(e),u=null,c=ka(s);for(let m=0;u==null&&m<i.length;++m)u=ba(i[m],c,n);return u}a(Ft,"matchRoutesImpl");function la(e,t){let{route:r,pathname:n,params:o}=e;return{id:r.id,pathname:n,params:o,data:t[r.id],loaderData:t[r.id],handle:r.handle}}a(la,"convertRouteMatchToUiMatch");function ua(e){let t=qt(e);return ca(t),t}a(ua,"flattenAndRankRoutes");function qt(e,t=[],r=[],n="",o=!1){let s=a((i,u,c=o,m)=>{let p={relativePath:m===void 0?i.path||"":m,caseSensitive:i.caseSensitive===!0,childrenIndex:u,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(n)&&c)return;$(p.relativePath.startsWith(n),`Absolute route path "${p.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(n.length)}let f=B([n,p.relativePath]),g=r.concat(p);i.children&&i.children.length>0&&($(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),qt(i.children,t,g,f,c)),!(i.path==null&&!i.index)&&t.push({path:f,score:ya(f,i.index),routesMeta:g.map((b,v)=>{let[y,h]=Vt(b.relativePath,b.caseSensitive,v===g.length-1);return{...b,matcher:y,compiledParams:h}})})},"flattenRoute");return e.forEach((i,u)=>{if(i.path===""||!i.path?.includes("?"))s(i,u);else for(let c of Ht(i.path))s(i,u,!0,c)}),t}a(qt,"flattenRoutes");function Ht(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,o=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return o?[s,""]:[s];let i=Ht(n.join("/")),u=[];return u.push(...i.map(c=>c===""?s:[s,c].join("/"))),o&&u.push(...i),u.map(c=>e.startsWith("/")&&c===""?"/":c)}a(Ht,"explodeOptionalSegments");function ca(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:va(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}a(ca,"rankRouteBranches");var da=/^:[\w-]+$/,ma=3,fa=2,pa=1,ha=10,ga=-2,ct=a(e=>e==="*","isSplat");function ya(e,t){let r=e.split("/"),n=r.length;return r.some(ct)&&(n+=ga),t&&(n+=fa),r.filter(o=>!ct(o)).reduce((o,s)=>o+(da.test(s)?ma:s===""?pa:ha),n)}a(ya,"computeScore");function va(e,t){return e.length===t.length&&e.slice(0,-1).every((r,n)=>r===t[n])?e[e.length-1]-t[t.length-1]:0}a(va,"compareIndexes");function ba(e,t,r=!1){let{routesMeta:n}=e,o={},s="/",i=[];for(let u=0;u<n.length;++u){let c=n[u],m=u===n.length-1,p=s==="/"?t:t.slice(s.length)||"/",f={path:c.relativePath,caseSensitive:c.caseSensitive,end:m},g=c.matcher&&c.compiledParams?Wt(f,p,c.matcher,c.compiledParams):xe(f,p),b=c.route;if(!g&&m&&r&&!n[n.length-1].route.index&&(g=xe({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},p)),!g)return null;Object.assign(o,g.params),i.push({params:o,pathname:B([s,g.pathname]),pathnameBase:Ia(B([s,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(s=B([s,g.pathnameBase]))}return i}a(ba,"matchRouteBranch");function xe(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Vt(e.path,e.caseSensitive,e.end);return Wt(e,t,r,n)}a(xe,"matchPath");function Wt(e,t,r,n){let o=t.match(r);if(!o)return null;let s=o[0],i=X(s,1),u=o.slice(1);return{params:n.reduce((c,{paramName:m,isOptional:p},f)=>{if(m==="*"){let b=u[f]||"";i=X(s.slice(0,s.length-b.length),1)}const g=u[f];return p&&!g?c[m]=void 0:c[m]=(g||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:i,pattern:e}}a(Wt,"matchPathImpl");function Vt(e,t=!1,r=!0){M(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,i,u,c,m)=>{if(n.push({paramName:i,isOptional:u!=null}),u){let p=m.charAt(c+s.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}a(Vt,"compilePath");function ka(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return M(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}a(ka,"decodePath");function q(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}a(q,"stripBasename");function xa(e,t="/"){let{pathname:r,search:n="",hash:o=""}=typeof e=="string"?te(e):e,s;return r?(r=Kt(r),r.startsWith("/")||r.startsWith("\\")?s=dt(r.substring(1),"/"):s=dt(r,t)):s=t,{pathname:s,search:Sa(n),hash:Ra(o)}}a(xa,"resolvePath");function dt(e,t){let r=X(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}a(dt,"resolvePathname");function Le(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}a(Le,"getInvalidPathError");function wa(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}a(wa,"getPathContributingMatches");function Ve(e){let t=wa(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}a(Ve,"getResolveToMatches");function Re(e,t,r,n=!1){let o;typeof e=="string"?o=te(e):(o={...e},$(!o.pathname||!o.pathname.includes("?"),Le("?","pathname","search",o)),$(!o.pathname||!o.pathname.includes("#"),Le("#","pathname","hash",o)),$(!o.search||!o.search.includes("#"),Le("#","search","hash",o)));let s=e===""||o.pathname==="",i=s?"/":o.pathname,u;if(i==null)u=r;else{let f=t.length-1;if(!n&&i.startsWith("..")){let g=i.split("/");for(;g[0]==="..";)g.shift(),f-=1;o.pathname=g.join("/")}u=f>=0?t[f]:"/"}let c=xa(o,u),m=i&&i!=="/"&&i.endsWith("/"),p=(s||i===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(m||p)&&(c.pathname+="/"),c}a(Re,"resolveTo$1");var Kt=a(e=>e.replace(/[\\/]{2,}/g,"/"),"removeDoubleSlashes"),B=a(e=>Kt(e.join("/")),"joinPaths");function X(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}a(X,"removeTrailingSlash");var Ia=a(e=>X(e).replace(/^\/*/,"/"),"normalizePathname"),Sa=a(e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,"normalizeSearch"),Ra=a(e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,"normalizeHash"),Ca=class{static{a(this,"ErrorResponseImpl")}constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Qt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}a(Qt,"isRouteErrorResponse");function Ea(e){return B(e.map(t=>t.route.path).filter(Boolean))||"/"}a(Ea,"getRoutePattern");var Jt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Gt(e,t){let r=e;if(typeof r!="string"||!We.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,o=!1;if(Jt)try{let s=new URL(window.location.href),i=Nt.test(r)?new URL(ra(r,s.protocol)):new URL(r),u=q(i.pathname,t);i.origin===s.origin&&u!=null?r=u+i.search+i.hash:o=!0}catch{M(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:o,to:r}}a(Gt,"parseToInfo");var Ji=Object.getOwnPropertyNames(Object.prototype).sort().join("\0"),mt=new URL("http://localhost");function Ke(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),mt)}catch{return mt}}a(Ke,"getNavigatorCurrentUrl");function Me(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}a(Me,"isSameOrigin");function $a(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}a($a,"isExplicitUrl");function Qe(e,t,r,n){let o=null;try{o=e==null?null:new URL(e,r)}catch{}let s=new URL(t,r),i=o!=null&&!Me(o,r),u=!Me(s,r);if(n==="reject"){if(i||u)throw new Error("External navigation is not allowed")}else if(u&&(o==null||!$a(e,o)||!Me(o,s)))throw new Error("External navigation is not allowed")}a(Qe,"validateNavigationTarget");var Yt=["POST","PUT","PATCH","DELETE"],Gi=new Set(Yt),_a=["GET",...Yt],Yi=new Set(_a),Aa,Da,Pa,La;Aa=new WeakMap;Da=new WeakMap;Pa=new WeakMap;La=new WeakMap;var Ma=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Ta(e){try{return Ma.includes(new URL(e).protocol)}catch{return!1}}a(Ta,"hasInvalidProtocol");var re=l.createContext(null);re.displayName="DataRouter";var me=l.createContext(null);me.displayName="DataRouterState";var Zt=l.createContext(!1);function Xt(){return l.useContext(Zt)}a(Xt,"useIsRSCRouterContext");var er=l.createContext({isTransitioning:!1});er.displayName="ViewTransition";var Ua=l.createContext(new Map);Ua.displayName="Fetchers";var je=l.createContext(null);je.displayName="Await";var P=l.createContext(null);P.displayName="Navigation";var ne=l.createContext(null);ne.displayName="Location";var O=l.createContext({outlet:null,matches:[],isDataRoute:!1});O.displayName="Route";var Je=l.createContext(null);Je.displayName="RouteError";var tr="REACT_ROUTER_ERROR",Oa="REDIRECT",ja="ROUTE_ERROR_RESPONSE";function Ba(e){if(e.startsWith(`${tr}:${Oa}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}a(Ba,"decodeRedirectErrorDigest");function Na(e){if(e.startsWith(`${tr}:${ja}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ca(t.status,t.statusText,t.data)}catch{}}a(Na,"decodeRouteErrorResponseDigest");function za(e,{relative:t}={}){$(ae(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=l.useContext(P),{hash:o,pathname:s,search:i}=fe(e,{relative:t}),u=s;return r!=="/"&&(u=s==="/"?r:B([r,s])),n.createHref({pathname:u,search:i,hash:o})}a(za,"useHref");function ae(){return l.useContext(ne)!=null}a(ae,"useInRouterContext");function T(){return $(ae(),"useLocation() may be used only in the context of a <Router> component."),l.useContext(ne).location}a(T,"useLocation");function Zi(){return l.useContext(ne).navigationType}a(Zi,"useNavigationType");var rr="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nr(e){l.useContext(P).static||l.useLayoutEffect(e)}a(nr,"useIsomorphicLayoutEffect");function Ce(){let{isDataRoute:e}=l.useContext(O);return e?no():Fa()}a(Ce,"useNavigate$1");function Fa(){$(ae(),"useNavigate() may be used only in the context of a <Router> component.");let e=l.useContext(re),{basename:t,navigator:r}=l.useContext(P),{matches:n}=l.useContext(O),{pathname:o}=T(),s=JSON.stringify(Ve(n)),i=l.useRef(!1);return nr(()=>{i.current=!0}),l.useCallback((u,c={})=>{if(M(i.current,rr),!i.current)return;if(typeof u=="number"){r.go(u);return}let m=Re(u,JSON.parse(s),o,c.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:B([t,m.pathname])),Qe(typeof u=="string"?u:Q(u),r.createHref(m),Ke(r),"reject"),(c.replace?r.replace:r.push)(m,c.state,c)},[t,r,s,o,e])}a(Fa,"useNavigateUnstable");var qa=l.createContext(null);function Ha(e){let t=l.useContext(O).outlet;return l.useMemo(()=>t&&l.createElement(qa.Provider,{value:e},t),[t,e])}a(Ha,"useOutlet");function Wa(){let{matches:e}=l.useContext(O);return e[e.length-1]?.params??{}}a(Wa,"useParams");function fe(e,{relative:t}={}){let{matches:r}=l.useContext(O),{pathname:n}=T(),o=JSON.stringify(Ve(r));return l.useMemo(()=>Re(e,JSON.parse(o),n,t==="path"),[e,o,n,t])}a(fe,"useResolvedPath");function Va(e,t){return ar(e,t)}a(Va,"useRoutes");function ar(e,t,r){$(ae(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=l.useContext(P),{matches:o}=l.useContext(O),s=o[o.length-1],i=s?s.params:{},u=s?s.pathname:"/",c=s?s.pathnameBase:"/",m=s&&s.route;{let h=m&&m.path||"";ir(u,!m||h.endsWith("*")||h.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${h}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
2
 
3
3
  Please change the parent <Route path="${h}"> to <Route path="${h==="/"?"*":`${h}/*`}">.`)}let p=T(),f;if(t){let h=typeof t=="string"?te(t):t;$(c==="/"||h.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${h.pathname}" was given in the \`location\` prop.`),f=h}else f=p;let g=f.pathname||"/",b=g;if(c!=="/"){let h=c.replace(/^\//,"").split("/");b="/"+g.replace(/^\//,"").split("/").slice(h.length).join("/")}let v=r&&r.state.matches.length?r.state.matches.map(h=>Object.assign(h,{route:r.manifest[h.route.id]||h.route})):zt(e,{pathname:b});M(m||v!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),M(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let y=Ya(v&&v.map(h=>Object.assign({},h,{params:Object.assign({},i,h.params),pathname:B([c,n.encodeLocation?n.encodeLocation(h.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?c:B([c,n.encodeLocation?n.encodeLocation(h.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathnameBase])})),o,r);return t&&y?l.createElement(ne.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...f},navigationType:"POP"}},y):y}a(ar,"useRoutesImpl");function Ka(){let e=ro(),t=Qt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:n},s={padding:"2px 4px",backgroundColor:n},i=null;return i=l.createElement(l.Fragment,null,l.createElement("p",null,"💿 Hey developer 👋"),l.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",l.createElement("code",{style:s},"ErrorBoundary")," or"," ",l.createElement("code",{style:s},"errorElement")," prop on your route.")),l.createElement(l.Fragment,null,l.createElement("h2",null,"Unexpected Application Error!"),l.createElement("h3",{style:{fontStyle:"italic"}},t),r?l.createElement("pre",{style:o},r):null,i)}a(Ka,"DefaultErrorComponent");var Qa=l.createElement(Ka,null),or=class extends l.Component{static{a(this,"RenderErrorBoundary")}constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError&&this.props.onError(e,t)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=Na(e.digest);r&&(e=r)}let t=e!==void 0?l.createElement(O.Provider,{value:this.props.routeContext},l.createElement(Je.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?l.createElement(Ja,{error:e},t):t}};or.contextType=Zt;var Te=new WeakMap;function Ja({children:e,error:t}){let{basename:r,navigator:n}=l.useContext(P);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=Ba(t.digest);if(o){let s=Te.get(t);if(s)throw s;let i=Gt(o.location,r),u=i.absoluteURL||i.to;if(Qe(o.location,u,Ke(n),"allow-explicit"),Ta(u))throw new Error("Invalid redirect location");if(Jt&&!Te.get(t))if(i.isExternal||o.reloadDocument)window.location.href=u;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:o.replace}));throw Te.set(t,c),c}return l.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}a(Ja,"RSCErrorHandler");function Ga({routeContext:e,match:t,children:r}){let n=l.useContext(re);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),l.createElement(O.Provider,{value:e},r)}a(Ga,"RenderedRoute");function Ya(e,t=[],r){let n=r?.state;if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,s=n?.errors;if(s!=null){let p=o.findIndex(f=>f.route.id&&s?.[f.route.id]!==void 0);$(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),o=o.slice(0,Math.min(o.length,p+1))}let i=!1,u=-1;if(r&&n){i=n.renderFallback;for(let p=0;p<o.length;p++){let f=o[p];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=p),f.route.id){let{loaderData:g,errors:b}=n,v=f.route.loader&&!g.hasOwnProperty(f.route.id)&&(!b||b[f.route.id]===void 0);if(f.route.lazy||v){r.isStatic&&(i=!0),u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}}let c=r?.onError,m=n&&c?(p,f)=>{c(p,{location:n.location,params:n.matches?.[0]?.params??{},pattern:Ea(n.matches),errorInfo:f})}:void 0;return o.reduceRight((p,f,g)=>{let b,v=!1,y=null,h=null;n&&(b=s&&f.route.id?s[f.route.id]:void 0,y=f.route.errorElement||Qa,i&&(u<0&&g===0?(ir("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,h=null):u===g&&(v=!0,h=f.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,g+1)),w=a(()=>{let I;return b?I=y:v?I=h:f.route.Component?I=l.createElement(f.route.Component,null):f.route.element?I=f.route.element:I=p,l.createElement(Ga,{match:f,routeContext:{outlet:p,matches:x,isDataRoute:n!=null},children:I})},"getChildren");return n&&(f.route.ErrorBoundary||f.route.errorElement||g===0)?l.createElement(or,{location:n.location,revalidation:n.revalidation,component:y,error:b,children:w(),routeContext:{outlet:null,matches:x,isDataRoute:!0},onError:m}):w()},null)}a(Ya,"_renderMatches");function Ge(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}a(Ge,"getDataRouterConsoleError");function Za(e){let t=l.useContext(re);return $(t,Ge(e)),t}a(Za,"useDataRouterContext");function Ye(e){let t=l.useContext(me);return $(t,Ge(e)),t}a(Ye,"useDataRouterState");function Xa(e){let t=l.useContext(O);return $(t,Ge(e)),t}a(Xa,"useRouteContext");function Ze(e){let t=Xa(e),r=t.matches[t.matches.length-1];return $(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}a(Ze,"useCurrentRouteId");function eo(){return Ze("useRouteId")}a(eo,"useRouteId");function to(){let e=Ye("useNavigation");return l.useMemo(()=>{let{matches:t,historyAction:r,...n}=e.navigation;return n},[e.navigation])}a(to,"useNavigation");function sr(){let{matches:e,loaderData:t}=Ye("useMatches");return l.useMemo(()=>e.map(r=>la(r,t)),[e,t])}a(sr,"useMatches");function ro(){let e=l.useContext(Je),t=Ye("useRouteError"),r=Ze("useRouteError");return e!==void 0?e:t.errors?.[r]}a(ro,"useRouteError");function no(){let{router:e}=Za("useNavigate"),t=Ze("useNavigate"),r=l.useRef(!1);return nr(()=>{r.current=!0}),l.useCallback(async(n,o={})=>{M(r.current,rr),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}a(no,"useNavigateStable");var ft={};function ir(e,t,r){!t&&!ft[e]&&(ft[e]=!0,M(!1,r))}a(ir,"warningOnce");var pt={};function ao(e,t){!e&&!pt[t]&&(pt[t]=!0)}a(ao,"warnOnce");var Xi=l.memo(oo);function oo({routes:e,manifest:t,future:r,state:n,isStatic:o,onError:s}){return ar(e,void 0,{manifest:t,state:n,isStatic:o,onError:s,future:r})}a(oo,"DataRoutes2");function so({to:e,replace:t,state:r,relative:n}){$(ae(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o,navigator:s}=l.useContext(P);M(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=l.useContext(O),{pathname:u}=T(),c=Ce(),m=Re(e,Ve(i),u,n==="path");Qe(typeof e=="string"?e:Q(e),s.createHref(m),Ke(s),"reject");let p=JSON.stringify(m);return l.useEffect(()=>{c(JSON.parse(p),{replace:t,state:r,relative:n})},[c,p,n,t,r]),null}a(so,"Navigate$1");function el(e){return Ha(e.context)}a(el,"Outlet");function io(e){$(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}a(io,"Route");function lr({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:o,static:s=!1,useTransitions:i}){$(!ae(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),c=l.useMemo(()=>({basename:u,navigator:o,static:s,useTransitions:i,future:{}}),[u,o,s,i]);typeof r=="string"&&(r=te(r));let{pathname:m="/",search:p="",hash:f="",state:g=null,key:b="default",mask:v}=r,y=l.useMemo(()=>{let h=q(m,u);return h==null?null:{location:{pathname:h,search:p,hash:f,state:g,key:b,mask:v},navigationType:n}},[u,m,p,f,g,b,n,v]);return M(y!=null,`<Router basename="${u}"> is not able to match the URL "${m}${p}${f}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:l.createElement(P.Provider,{value:c},l.createElement(ne.Provider,{children:t,value:y}))}a(lr,"Router");function tl({children:e,location:t}){return Va(Be(e),t)}a(tl,"Routes");var rl=class extends l.Component{static{a(this,"AwaitErrorBoundary")}constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError&&this.props.onError(e,t)}render(){let{children:e,errorElement:t,resolve:r}=this.props,n=null,o=0;if(!(r instanceof Promise))o=1,n=Promise.resolve(),Object.defineProperty(n,"_tracked",{get:a(()=>!0,"get")}),Object.defineProperty(n,"_data",{get:a(()=>r,"get")});else if(this.state.error){o=2;let s=this.state.error;n=Promise.reject().catch(()=>{}),Object.defineProperty(n,"_tracked",{get:a(()=>!0,"get")}),Object.defineProperty(n,"_error",{get:a(()=>s,"get")})}else r._tracked?(n=r,o="_error"in n?2:"_data"in n?1:0):(o=0,Object.defineProperty(r,"_tracked",{get:a(()=>!0,"get")}),n=r.then(s=>Object.defineProperty(r,"_data",{get:a(()=>s,"get")}),s=>{this.props.onError?.(s),Object.defineProperty(r,"_error",{get:a(()=>s,"get")})}));if(o===2&&!t)throw n._error;if(o===2)return l.createElement(je.Provider,{value:n,children:t});if(o===1)return l.createElement(je.Provider,{value:n,children:e});throw n}};function Be(e,t=[]){let r=[];return l.Children.forEach(e,(n,o)=>{if(!l.isValidElement(n))return;let s=[...t,o];if(n.type===l.Fragment){r.push.apply(r,Be(n.props.children,s));return}$(n.type===io,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),$(!n.props.index||!n.props.children,"An index route cannot have child routes.");let i={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(i.children=Be(n.props.children,s)),r.push(i)}),r}a(Be,"createRoutesFromChildren");var be="get",ke="application/x-www-form-urlencoded";function Ee(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}a(Ee,"isHtmlElement");function lo(e){return Ee(e)&&e.tagName.toLowerCase()==="button"}a(lo,"isButtonElement");function uo(e){return Ee(e)&&e.tagName.toLowerCase()==="form"}a(uo,"isFormElement");function co(e){return Ee(e)&&e.tagName.toLowerCase()==="input"}a(co,"isInputElement");function mo(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}a(mo,"isModifiedEvent");function fo(e,t){return e.button===0&&(!t||t==="_self")&&!mo(e)}a(fo,"shouldProcessLinkClick");function Ne(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(o=>[r,o]):[[r,n]])},[]))}a(Ne,"createSearchParams");function po(e,t){let r=Ne(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(s=>{r.append(o,s)})}),r}a(po,"getSearchParamsForLocation");var ge=null;function ho(){if(ge===null)try{new FormData(document.createElement("form"),0),ge=!1}catch{ge=!0}return ge}a(ho,"isFormDataSubmitterSupported");var go=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ue(e){return e!=null&&!go.has(e)?(M(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ke}"`),null):e}a(Ue,"getFormEncType");function yo(e,t){let r,n,o,s,i;if(uo(e)){let u=e.getAttribute("action");n=u?q(u,t):null,r=e.getAttribute("method")||be,o=Ue(e.getAttribute("enctype"))||ke,s=new FormData(e)}else if(lo(e)||co(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||u.getAttribute("action");if(n=c?q(c,t):null,r=e.getAttribute("formmethod")||u.getAttribute("method")||be,o=Ue(e.getAttribute("formenctype"))||Ue(u.getAttribute("enctype"))||ke,s=new FormData(u,e),!ho()){let{name:m,type:p,value:f}=e;if(p==="image"){let g=m?`${m}.`:"";s.append(`${g}x`,"0"),s.append(`${g}y`,"0")}else m&&s.append(m,f)}}else{if(Ee(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=be,n=null,o=ke,i=e}return s&&o==="text/plain"&&(i=s,s=void 0),{action:n,method:r.toLowerCase(),encType:o,formData:s,body:i}}a(yo,"getFormSubmissionInfo");var nl=Object.getOwnPropertyNames(Object.prototype).sort().join("\0"),vo={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},bo=/[&><\u2028\u2029]/g;function ht(e){return e.replace(bo,t=>vo[t])}a(ht,"escapeHtml");function $e(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}a($e,"invariant2");function ur(e,t,r,n){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${n}`:o.pathname=`${o.pathname}.${n}`:o.pathname==="/"?o.pathname=`_root.${n}`:t&&q(o.pathname,t)==="/"?o.pathname=`${X(t)}/_root.${n}`:o.pathname=`${X(o.pathname)}.${n}`,o}a(ur,"singleFetchUrl");async function ko(e,t){if(e.id in t)return t[e.id];try{let r=await ta(()=>import(e.module),[]);return t[e.id]=r,r}catch{return window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}a(ko,"loadRouteModule");function xo(e){return e!=null&&typeof e.page=="string"}a(xo,"isPageLinkDescriptor");function wo(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}a(wo,"isHtmlLinkDescriptor");async function Io(e,t,r){return Co((await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let s=await ko(o,r);return s.links?s.links():[]}return[]}))).flat(1).filter(wo).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}a(Io,"getKeyedPrefetchLinks");function gt(e,t,r,n,o,s){let i=a((c,m)=>r[m]?c.route.id!==r[m].route.id:!0,"isNew"),u=a((c,m)=>r[m].pathname!==c.pathname||r[m].route.path?.endsWith("*")&&r[m].params["*"]!==c.params["*"],"matchPathChanged");return s==="assets"?t.filter((c,m)=>i(c,m)||u(c,m)):s==="data"?t.filter((c,m)=>{let p=n.routes[c.route.id];if(!p||!p.hasLoader)return!1;if(i(c,m)||u(c,m))return!0;if(c.route.shouldRevalidate){let f=c.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}a(gt,"getNewMatchesForLinks");function cr(e,t,{includeHydrateFallback:r}={}){return So(e.map(n=>{let o=t.routes[n.route.id];if(!o)return[];let s=[o.module];return o.clientActionModule&&(s=s.concat(o.clientActionModule)),o.clientLoaderModule&&(s=s.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(s=s.concat(o.hydrateFallbackModule)),o.imports&&(s=s.concat(o.imports)),s}).flat(1))}a(cr,"getModuleLinkHrefs");function So(e){return[...new Set(e)]}a(So,"dedupeHrefs");function Ro(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}a(Ro,"sortKeys");function Co(e,t){let r=new Set,n=new Set(t);return e.reduce((o,s)=>{if(t&&!xo(s)&&s.as==="script"&&s.href&&n.has(s.href))return o;let i=JSON.stringify(Ro(s));return r.has(i)||(r.add(i),o.push({key:i,link:s})),o},[])}a(Co,"dedupeLinkDescriptors");function Eo(e,t){return e.mode==="lazy"&&t===!0}a(Eo,"isFogOfWarEnabled");function $o({sri:e,...t},r){let n=new Set(r.state.matches.map(u=>u.route.id)),o=r.state.location.pathname.split("/").filter(Boolean),s=["/"];for(o.pop();o.length>0;)s.push(`/${o.join("/")}`),o.pop();s.forEach(u=>{let c=Ft(r.routes,u,r.basename||"/",!1,r.branches);c&&c.forEach(m=>n.add(m.route.id))});let i=[...n].reduce((u,c)=>Object.assign(u,{[c]:t.routes[c]}),{});return{...t,routes:i,sri:e?!0:void 0}}a($o,"getPartialManifest");function _e(){let e=l.useContext(re);return $e(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}a(_e,"useDataRouterContext2");function dr(){let e=l.useContext(me);return $e(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}a(dr,"useDataRouterStateContext");var Ae=l.createContext(void 0);Ae.displayName="FrameworkContext";function J(){let e=l.useContext(Ae);return $e(e,"You must render this element inside a <HydratedRouter> element"),e}a(J,"useFrameworkContext");function _o(e,t){let r=l.useContext(Ae),[n,o]=l.useState(!1),[s,i]=l.useState(!1),{onFocus:u,onBlur:c,onMouseEnter:m,onMouseLeave:p,onTouchStart:f}=t,g=l.useRef(null);l.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let y=a(x=>{x.forEach(w=>{i(w.isIntersecting)})},"callback"),h=new IntersectionObserver(y,{threshold:.5});return g.current&&h.observe(g.current),()=>{h.disconnect()}}},[e]),l.useEffect(()=>{if(n){let y=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(y)}}},[n]);let b=a(()=>{o(!0)},"setIntent"),v=a(()=>{o(!1),i(!1)},"cancelIntent");return r?e!=="intent"?[s,g,{}]:[s,g,{onFocus:ie(u,b),onBlur:ie(c,v),onMouseEnter:ie(m,b),onMouseLeave:ie(p,v),onTouchStart:ie(f,b)}]:[!1,g,{}]}a(_o,"usePrefetchBehavior");function ie(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}a(ie,"composeEventHandlers");function Ao(e,t,r){if(r&&!we)return[e[0]];if(t){let n=e.findIndex(o=>t[o.route.id]!==void 0);return e.slice(0,n+1)}return e}a(Ao,"getActiveMatches");function Do({page:e,...t}){let r=Xt(),{nonce:n}=J(),{router:o}=_e(),s=l.useMemo(()=>zt(o.routes,e,o.basename),[o.routes,e,o.basename]);return s?(t.nonce==null&&n&&(t={...t,nonce:n}),r?l.createElement(Lo,{page:e,matches:s,...t}):l.createElement(Mo,{page:e,matches:s,...t})):null}a(Do,"PrefetchPageLinks");function Po(e){let{manifest:t,routeModules:r}=J(),[n,o]=l.useState([]);return l.useEffect(()=>{let s=!1;return Io(e,t,r).then(i=>{s||o(i)}),()=>{s=!0}},[e,t,r]),n}a(Po,"useKeyedPrefetchLinks");function Lo({page:e,matches:t,...r}){let n=T(),{future:o}=J(),{basename:s}=_e(),i=l.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let u=ur(e,s,o.v8_trailingSlashAwareDataRequests,"rsc"),c=!1,m=[];for(let p of t)typeof p.route.shouldRevalidate=="function"?c=!0:m.push(p.route.id);return c&&m.length>0&&u.searchParams.set("_routes",m.join(",")),[u.pathname+u.search]},[s,o.v8_trailingSlashAwareDataRequests,e,n,t]);return l.createElement(l.Fragment,null,i.map(u=>l.createElement("link",{key:u,rel:"prefetch",as:"fetch",href:u,...r})))}a(Lo,"RSCPrefetchPageLinksImpl");function Mo({page:e,matches:t,...r}){let n=T(),{future:o,manifest:s,routeModules:i}=J(),{basename:u}=_e(),{loaderData:c,matches:m}=dr(),p=l.useMemo(()=>gt(e,t,m,s,n,"data"),[e,t,m,s,n]),f=l.useMemo(()=>gt(e,t,m,s,n,"assets"),[e,t,m,s,n]),g=l.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let y=new Set,h=!1;if(t.forEach(w=>{let I=s.routes[w.route.id];!I||!I.hasLoader||(!p.some(_=>_.route.id===w.route.id)&&w.route.id in c&&i[w.route.id]?.shouldRevalidate||I.hasClientLoader?h=!0:y.add(w.route.id))}),y.size===0)return[];let x=ur(e,u,o.v8_trailingSlashAwareDataRequests,"data");return h&&y.size>0&&x.searchParams.set("_routes",t.filter(w=>y.has(w.route.id)).map(w=>w.route.id).join(",")),[x.pathname+x.search]},[u,o.v8_trailingSlashAwareDataRequests,c,n,s,p,t,e,i]),b=l.useMemo(()=>cr(f,s),[f,s]),v=Po(f);return l.createElement(l.Fragment,null,g.map(y=>l.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...r})),b.map(y=>l.createElement("link",{key:y,rel:"modulepreload",href:y,...r})),v.map(({key:y,link:h})=>l.createElement("link",{key:y,nonce:r.nonce,...h,crossOrigin:h.crossOrigin??r.crossOrigin})))}a(Mo,"PrefetchPageLinksImpl");var we=!1;function To(){we=!0}a(To,"setIsHydrated");function Uo(e){let{manifest:t,serverHandoffString:r,isSpaMode:n,renderMeta:o,routeDiscovery:s,ssr:i,nonce:u}=J(),{router:c,static:m,staticContext:p}=_e(),{matches:f}=dr(),g=Xt(),b=Eo(s,i);e.nonce==null&&u&&(e={...e,nonce:u}),o&&(o.didRenderScripts=!0);let v=Ao(f,null,n);l.useEffect(()=>{To()},[]);let y=l.useMemo(()=>{if(g)return null;let w=p?`window.__reactRouterContext = ${r};window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());`:" ",I=m?`${t.hmr?.runtime?`import ${JSON.stringify(t.hmr.runtime)};`:""}${b?"":`import ${JSON.stringify(t.url)}`};
4
4
  ${v.map((_,C)=>{let A=`route${C}`,L=t.routes[_.route.id];$e(L,`Route ${_.route.id} not found in manifest`);let{clientActionModule:j,clientLoaderModule:D,clientMiddlewareModule:N,hydrateFallbackModule:G,module:U}=L,H=[...j?[{module:j,varName:`${A}_clientAction`}]:[],...D?[{module:D,varName:`${A}_clientLoader`}]:[],...N?[{module:N,varName:`${A}_clientMiddleware`}]:[],...G?[{module:G,varName:`${A}_HydrateFallback`}]:[],{module:U,varName:`${A}_main`}];return H.length===1?`import * as ${A} from ${JSON.stringify(U)};`:[H.map(z=>`import * as ${z.varName} from "${z.module}";`).join(`
@@ -1 +1 @@
1
- var xe=Object.defineProperty;var r=(t,a)=>xe(t,"name",{value:a,configurable:!0});import{i as ne}from"./rolldown-runtime-ZpX3ckPj.js";import{G as pe,Ia as he,Ra as ge,St as Y,Vi as W,ht as fe,na as X,ut as ye}from"./agent-avatar-url-B91C7fqh.js";import{Vn as ve,i as T,n as je,r as be,s as re}from"./BreadcrumbContext-BRKP7-bF.js";import{r as ee,t as Ne}from"./AgentAvatar-B47RVwPt.js";import{i as te,r as we,t as Ae}from"./tabs-CVzr4EnB.js";import{a as Te}from"./ToastContext-CYUmn7f8.js";import{a as y,c as L,l as _,n as F,r as k}from"./select-CtJdi3BB.js";import{t as se}from"./input-DW5WzZI0.js";import{o as Se,r as Ce}from"./company-members-BXmr5rWO.js";import{r as v,t as j}from"./card-79GDCTP3.js";import{t as Ee}from"./EmptyState-iwTwakaR.js";import{Ot as Ie,b as ae,hn as Ue,in as Pe,rn as Re,tn as De,xn as Le}from"./index-SsNrNOjw.js";var l=ne(ge(),1),e=ne(he(),1),_e=50,n="__all",Fe=[{value:n,label:"All actions"},{value:"issue.",label:"Tasks"},{value:"agent.",label:"Agents"},{value:"heartbeat.",label:"Runs"},{value:"approval.",label:"Approvals"},{value:"project.",label:"Projects"},{value:"goal.",label:"Goals"},{value:"tool_gateway.",label:"Tools"},{value:"cost.",label:"Costs"},{value:"company.",label:"Company"}],ke=[{value:n,label:"All entities"},{value:"issue",label:"Task"},{value:"agent",label:"Agent"},{value:"project",label:"Project"},{value:"goal",label:"Goal"},{value:"company",label:"Company"}];function Be(t){if(!t)return;const a=new Date(`${t}T00:00:00.000Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Be,"toStartIso");function Ve(t){if(!t)return;const a=new Date(`${t}T23:59:59.999Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Ve,"toEndIso");function $e({record:t,agentMap:a,userProfileMap:d}){const u=t.agentId??(t.actorType==="agent"?t.actorId:null),c=u?a.get(u):null;if(c)return(0,e.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5",title:c.name,children:[(0,e.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:(0,e.jsx)(Ne,{agent:c,size:16,className:"h-3 w-3"})}),(0,e.jsx)("span",{className:"truncate font-medium text-foreground",children:c.name})]});if(t.actorType==="user"&&t.actorId){const m=d.get(t.actorId);return(0,e.jsx)(ee,{name:m?.label??"User",avatarUrl:m?.image??null,size:"sm",className:"font-medium text-foreground"})}const h=t.actorType==="plugin"?"Plugin":t.actorType==="agent"?"Agent":t.actorType==="user"?"User":"System";return(0,e.jsx)(ee,{name:h,size:"sm",className:"font-medium text-foreground"})}r($e,"AuditActor");function qe({record:t}){const{issue:a,document:d}=t.entity,u=a?.identifier??a?.id??null;return u?(0,e.jsx)(re,{to:`/issues/${u}`,className:"font-medium text-primary hover:underline",children:a?.identifier?`${a.identifier}${a.title?` · ${a.title}`:""}`:"the task"}):d?(0,e.jsx)("span",{className:"font-medium text-foreground",children:d.key}):(0,e.jsx)("span",{className:"text-muted-foreground",children:t.entityType})}r(qe,"AuditEntityNode");function ze({record:t,agentMap:a,userProfileMap:d}){const u=Ie(t.action,t.details,{agentMap:a,userProfileMap:d}),c=t.responsibleUserId?d.get(t.responsibleUserId):null,h=!!(t.responsibleUserId&&!(t.actorType==="user"&&t.actorId===t.responsibleUserId)),m=c?.label??(t.responsibleUserId?"a user":null),g=t.entity.comment?.excerpt?.trim(),x=t.entity.issue&&t.entity.document?t.entity.document.key:null;return(0,e.jsx)("li",{className:"px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1 text-foreground",children:[(0,e.jsx)($e,{record:t,agentMap:a,userProfileMap:d}),(0,e.jsx)("span",{className:"text-muted-foreground",children:u}),(0,e.jsx)(qe,{record:t})]}),g?(0,e.jsxs)("p",{className:"line-clamp-2 border-l-2 border-border pl-2 text-muted-foreground",children:["“",g,"”"]}):null,x?(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Document ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:x})]}):null,(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[h&&m?(0,e.jsxs)("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5",children:["on behalf of ",m]}):null,t.runId&&t.agentId?(0,e.jsx)(re,{to:`/agents/${t.agentId}/runs/${t.runId}`,className:"text-primary hover:underline",children:"View run"}):null,(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro) opacity-70",children:t.action})]})]}),(0,e.jsx)("time",{className:"shrink-0 whitespace-nowrap text-xs text-muted-foreground",dateTime:t.createdAt,title:new Date(t.createdAt).toLocaleString(),children:ye(t.createdAt)})]})})}r(ze,"AuditRow");function Me(){return(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(De,{className:"h-10 w-10 text-muted-foreground/50"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Agent audit is a Paperclip Enterprise view"}),(0,e.jsxs)("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:["The agent audit log gives you a searchable, exportable record of everything your agents did — every comment, task change, approval, and run — with the responsible person for each action. Ask an administrator to grant you the"," ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:"audit:view_agent_actions"})," ","permission to view it."]})]})]})})}r(Me,"AuditUpsell");function Oe({companyId:t,lockedAgentId:a,hideHeader:d,mode:u,onModeChange:c}){const{pushToast:h}=Te(),[m,g]=(0,l.useState)(n),[x,B]=(0,l.useState)(n),[S,V]=(0,l.useState)(n),[C,$]=(0,l.useState)(n),[E,q]=(0,l.useState)(""),[I,z]=(0,l.useState)(""),[Z,Q]=(0,l.useState)(!1),[U,H]=(0,l.useState)(!1),M=X({queryKey:Y.agents.list(t),queryFn:r(()=>be.list(t),"queryFn")}),O=X({queryKey:Y.access.companyUserDirectory(t),queryFn:r(()=>Se.listUserDirectory(t),"queryFn"),retry:!1}),ie=(0,l.useMemo)(()=>new Map((M.data??[]).map(s=>[s.id,s])),[M.data]),le=(0,l.useMemo)(()=>Ce(O.data?.users),[O.data]),f=a?"agents":u??"all",o={actorScope:f,agentId:a??(m===n?void 0:m),responsibleUserId:x===n?void 0:x,action:S===n?void 0:S,entityType:C===n?void 0:C,from:Be(E),to:Ve(I)},b=!!(!a&&m!==n||x!==n||S!==n||C!==n||E||I),i=Le({queryKey:Y.audit.agentActions(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),queryFn:r(({pageParam:s})=>ae.listAgentActions(t,{...o,limit:_e,cursor:s??void 0}),"queryFn"),initialPageParam:null,getNextPageParam:r(s=>s.nextCursor??void 0,"getNextPageParam"),retry:r((s,p)=>!(p instanceof W&&p.status===403)&&s<2,"retry")}),K=i.error instanceof W&&i.error.status===403,P=i.data?.pages.some(s=>s.accessTier==="basic")??!1,oe=i.data?.pages.some(s=>s.accessTier==="full")??!1,G=(0,l.useMemo)(()=>{const s=i.data?.pages??[];return(P?s.filter(p=>p.accessTier!=="full"):s).flatMap(p=>p.items)},[i.data,P]),R=P?"basic":i.data?.pages[0]?.accessTier,N=P&&oe,ce=a?!0:R==="full",de=!!(N&&U&&!i.isFetching),D=!!(!a&&!de&&(K&&b||N)),w=!!(K&&!a&&f==="agents"&&c),ue=!!(!a&&c&&!w&&(f==="agents"||R==="full"));(0,l.useEffect)(()=>{w&&c?.("all")},[w,c]),(0,l.useEffect)(()=>{!a&&(R==="basic"||D)&&(g(n),B(n),V(n),$(n),q(""),z(""))},[R,N,a,D]),(0,l.useEffect)(()=>{if(!N){U&&H(!1);return}U||(H(!0),i.refetch())},[U,i,N]);const J=r(()=>{g(n),B(n),V(n),$(n),q(""),z("")},"clearFilters"),me=r(async()=>{Q(!0);try{const s=await ae.exportAgentActionsCsv(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),p=URL.createObjectURL(s),A=document.createElement("a");A.href=p,A.download=`${f==="agents"?"agent-audit":"activity"}-${t}.csv`,document.body.appendChild(A),A.click(),A.remove(),window.setTimeout(()=>URL.revokeObjectURL(p),5e3),h({title:"Audit exported",body:"Your CSV download has started.",tone:"success"})}catch(s){h({title:"Export failed",body:s instanceof Error?s.message:"Could not export the audit log.",tone:"error"})}finally{Q(!1)}},"handleExport");return K&&!D&&!w?(0,e.jsx)(Me,{}):(0,e.jsxs)("div",{className:"space-y-4",children:[d?null:(0,e.jsx)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Activity"}),(0,e.jsx)("p",{className:"mt-1 max-w-2xl text-sm text-muted-foreground",children:f==="agents"?"Every recorded agent action, newest first — with the responsible person and run behind each one.":"Everything happening in your company, newest first — people, agents, and the system. Each line is one recorded action."})]})}),ue?(0,e.jsx)(Ae,{value:f,onValueChange:r(s=>c?.(s),"onValueChange"),children:(0,e.jsxs)(we,{"aria-label":"Activity scope",children:[(0,e.jsx)(te,{value:"all",children:"All activity"}),(0,e.jsx)(te,{value:"agents",children:"Agent actions"})]})}):null,ce?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[a?null:(0,e.jsxs)(F,{value:m,onValueChange:g,children:[(0,e.jsx)(L,{className:"w-40",children:(0,e.jsx)(_,{placeholder:"Agent"})}),(0,e.jsxs)(k,{children:[(0,e.jsx)(y,{value:n,children:"All agents"}),(M.data??[]).map(s=>(0,e.jsx)(y,{value:s.id,children:s.name},s.id))]})]}),(0,e.jsxs)(F,{value:x,onValueChange:B,children:[(0,e.jsx)(L,{className:"w-52",children:(0,e.jsx)(_,{placeholder:"Responsible user"})}),(0,e.jsxs)(k,{children:[(0,e.jsx)(y,{value:n,children:"All responsible users"}),(O.data?.users??[]).map(s=>(0,e.jsx)(y,{value:s.principalId,children:s.user?.name??s.user?.email??s.principalId.slice(0,8)},s.principalId))]})]}),(0,e.jsxs)(F,{value:S,onValueChange:V,children:[(0,e.jsx)(L,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Action"})}),(0,e.jsx)(k,{children:Fe.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsxs)(F,{value:C,onValueChange:$,children:[(0,e.jsx)(L,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Entity"})}),(0,e.jsx)(k,{children:ke.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsx)(se,{type:"date","aria-label":"From date",value:E,max:I||void 0,onChange:r(s=>q(s.target.value),"onChange"),className:"w-36"}),(0,e.jsx)(se,{type:"date","aria-label":"To date",value:I,min:E||void 0,onChange:r(s=>z(s.target.value),"onChange"),className:"w-36"}),b?(0,e.jsx)(T,{variant:"ghost",size:"sm",onClick:J,children:"Clear filters"}):null,(0,e.jsxs)(T,{variant:"outline",size:"sm",className:"ml-auto",onClick:me,disabled:Z||i.isLoading||G.length===0,children:[(0,e.jsx)(Ue,{className:"mr-1.5 h-4 w-4"}),Z?"Exporting…":"Export CSV"]})]}):null,D||w?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Refreshing audit access…"})}):i.isLoading?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Loading…"})}):i.error?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:i.error instanceof Error?i.error.message:"Failed to load the audit log."}),(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.refetch(),"onClick"),children:"Try again"})]})}):G.length===0?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(Re,{className:"h-10 w-10 text-muted-foreground/40"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:b?"No actions match these filters":"Nothing here yet"}),(0,e.jsx)("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:b?"Try a wider date range or different filters.":f==="agents"?"As soon as your agents start doing things, their actions show up here.":"As soon as anyone in your company does something, it shows up here."})]}),b?(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:J,children:"Clear filters"}):null]})}):(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"px-0 py-0",children:(0,e.jsx)("ul",{className:pe("divide-y divide-border"),children:G.map(s=>(0,e.jsx)(ze,{record:s,agentMap:ie,userProfileMap:le},s.id))})})}),i.hasNextPage?(0,e.jsx)("div",{className:"flex justify-center",children:(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.fetchNextPage(),"onClick"),disabled:i.isFetchingNextPage,children:i.isFetchingNextPage?"Loading…":"Load more"})}):null,(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Recorded by Paperclip — entries can't be edited. Sensitive values are never stored."})]})}r(Oe,"AuditFeed");function nt(){const{selectedCompanyId:t}=fe(),{setBreadcrumbs:a}=je(),[d,u]=ve(),c=d.get("mode")==="agents"?"agents":"all";(0,l.useEffect)(()=>{a([{label:"Activity"}])},[a]);const h=(0,l.useCallback)(m=>{u(g=>{const x=new URLSearchParams(g);return m==="agents"?x.set("mode","agents"):x.delete("mode"),x},{replace:!0})},[u]);return t?(0,e.jsx)(Oe,{companyId:t,mode:c,onModeChange:h}):(0,e.jsx)(Ee,{icon:Pe,message:"Select a company to view activity."})}r(nt,"CompanyActivity");export{nt as CompanyActivity};
1
+ var xe=Object.defineProperty;var r=(t,a)=>xe(t,"name",{value:a,configurable:!0});import{i as ne}from"./rolldown-runtime-ZpX3ckPj.js";import{G as pe,Ia as he,Ra as ge,St as Y,Vi as W,ht as fe,na as X,ut as ye}from"./agent-avatar-url-eBzFMwFS.js";import{Vn as ve,i as T,n as je,r as be,s as re}from"./BreadcrumbContext-C-JqFdLZ.js";import{r as ee,t as Ne}from"./AgentAvatar-DySHTTwq.js";import{i as te,r as we,t as Ae}from"./tabs-C1f963Rn.js";import{a as Te}from"./ToastContext-BbzJdb2r.js";import{a as y,c as L,l as _,n as F,r as k}from"./select-yD0r8C3i.js";import{t as se}from"./input-BARyUoy0.js";import{o as Se,r as Ce}from"./company-members-CSVvQnvh.js";import{r as v,t as j}from"./card-GbQ9sLu8.js";import{t as Ee}from"./EmptyState-fxPFhH-R.js";import{Ot as Ie,b as ae,hn as Ue,in as Pe,rn as Re,tn as De,xn as Le}from"./index-st-IN4Gf.js";var l=ne(ge(),1),e=ne(he(),1),_e=50,n="__all",Fe=[{value:n,label:"All actions"},{value:"issue.",label:"Tasks"},{value:"agent.",label:"Agents"},{value:"heartbeat.",label:"Runs"},{value:"approval.",label:"Approvals"},{value:"project.",label:"Projects"},{value:"goal.",label:"Goals"},{value:"tool_gateway.",label:"Tools"},{value:"cost.",label:"Costs"},{value:"company.",label:"Company"}],ke=[{value:n,label:"All entities"},{value:"issue",label:"Task"},{value:"agent",label:"Agent"},{value:"project",label:"Project"},{value:"goal",label:"Goal"},{value:"company",label:"Company"}];function Be(t){if(!t)return;const a=new Date(`${t}T00:00:00.000Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Be,"toStartIso");function Ve(t){if(!t)return;const a=new Date(`${t}T23:59:59.999Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Ve,"toEndIso");function $e({record:t,agentMap:a,userProfileMap:d}){const u=t.agentId??(t.actorType==="agent"?t.actorId:null),c=u?a.get(u):null;if(c)return(0,e.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5",title:c.name,children:[(0,e.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:(0,e.jsx)(Ne,{agent:c,size:16,className:"h-3 w-3"})}),(0,e.jsx)("span",{className:"truncate font-medium text-foreground",children:c.name})]});if(t.actorType==="user"&&t.actorId){const m=d.get(t.actorId);return(0,e.jsx)(ee,{name:m?.label??"User",avatarUrl:m?.image??null,size:"sm",className:"font-medium text-foreground"})}const h=t.actorType==="plugin"?"Plugin":t.actorType==="agent"?"Agent":t.actorType==="user"?"User":"System";return(0,e.jsx)(ee,{name:h,size:"sm",className:"font-medium text-foreground"})}r($e,"AuditActor");function qe({record:t}){const{issue:a,document:d}=t.entity,u=a?.identifier??a?.id??null;return u?(0,e.jsx)(re,{to:`/issues/${u}`,className:"font-medium text-primary hover:underline",children:a?.identifier?`${a.identifier}${a.title?` · ${a.title}`:""}`:"the task"}):d?(0,e.jsx)("span",{className:"font-medium text-foreground",children:d.key}):(0,e.jsx)("span",{className:"text-muted-foreground",children:t.entityType})}r(qe,"AuditEntityNode");function ze({record:t,agentMap:a,userProfileMap:d}){const u=Ie(t.action,t.details,{agentMap:a,userProfileMap:d}),c=t.responsibleUserId?d.get(t.responsibleUserId):null,h=!!(t.responsibleUserId&&!(t.actorType==="user"&&t.actorId===t.responsibleUserId)),m=c?.label??(t.responsibleUserId?"a user":null),g=t.entity.comment?.excerpt?.trim(),x=t.entity.issue&&t.entity.document?t.entity.document.key:null;return(0,e.jsx)("li",{className:"px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1 text-foreground",children:[(0,e.jsx)($e,{record:t,agentMap:a,userProfileMap:d}),(0,e.jsx)("span",{className:"text-muted-foreground",children:u}),(0,e.jsx)(qe,{record:t})]}),g?(0,e.jsxs)("p",{className:"line-clamp-2 border-l-2 border-border pl-2 text-muted-foreground",children:["“",g,"”"]}):null,x?(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Document ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:x})]}):null,(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[h&&m?(0,e.jsxs)("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5",children:["on behalf of ",m]}):null,t.runId&&t.agentId?(0,e.jsx)(re,{to:`/agents/${t.agentId}/runs/${t.runId}`,className:"text-primary hover:underline",children:"View run"}):null,(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro) opacity-70",children:t.action})]})]}),(0,e.jsx)("time",{className:"shrink-0 whitespace-nowrap text-xs text-muted-foreground",dateTime:t.createdAt,title:new Date(t.createdAt).toLocaleString(),children:ye(t.createdAt)})]})})}r(ze,"AuditRow");function Me(){return(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(De,{className:"h-10 w-10 text-muted-foreground/50"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Agent audit is a Paperclip Enterprise view"}),(0,e.jsxs)("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:["The agent audit log gives you a searchable, exportable record of everything your agents did — every comment, task change, approval, and run — with the responsible person for each action. Ask an administrator to grant you the"," ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:"audit:view_agent_actions"})," ","permission to view it."]})]})]})})}r(Me,"AuditUpsell");function Oe({companyId:t,lockedAgentId:a,hideHeader:d,mode:u,onModeChange:c}){const{pushToast:h}=Te(),[m,g]=(0,l.useState)(n),[x,B]=(0,l.useState)(n),[S,V]=(0,l.useState)(n),[C,$]=(0,l.useState)(n),[E,q]=(0,l.useState)(""),[I,z]=(0,l.useState)(""),[Z,Q]=(0,l.useState)(!1),[U,H]=(0,l.useState)(!1),M=X({queryKey:Y.agents.list(t),queryFn:r(()=>be.list(t),"queryFn")}),O=X({queryKey:Y.access.companyUserDirectory(t),queryFn:r(()=>Se.listUserDirectory(t),"queryFn"),retry:!1}),ie=(0,l.useMemo)(()=>new Map((M.data??[]).map(s=>[s.id,s])),[M.data]),le=(0,l.useMemo)(()=>Ce(O.data?.users),[O.data]),f=a?"agents":u??"all",o={actorScope:f,agentId:a??(m===n?void 0:m),responsibleUserId:x===n?void 0:x,action:S===n?void 0:S,entityType:C===n?void 0:C,from:Be(E),to:Ve(I)},b=!!(!a&&m!==n||x!==n||S!==n||C!==n||E||I),i=Le({queryKey:Y.audit.agentActions(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),queryFn:r(({pageParam:s})=>ae.listAgentActions(t,{...o,limit:_e,cursor:s??void 0}),"queryFn"),initialPageParam:null,getNextPageParam:r(s=>s.nextCursor??void 0,"getNextPageParam"),retry:r((s,p)=>!(p instanceof W&&p.status===403)&&s<2,"retry")}),K=i.error instanceof W&&i.error.status===403,P=i.data?.pages.some(s=>s.accessTier==="basic")??!1,oe=i.data?.pages.some(s=>s.accessTier==="full")??!1,G=(0,l.useMemo)(()=>{const s=i.data?.pages??[];return(P?s.filter(p=>p.accessTier!=="full"):s).flatMap(p=>p.items)},[i.data,P]),R=P?"basic":i.data?.pages[0]?.accessTier,N=P&&oe,ce=a?!0:R==="full",de=!!(N&&U&&!i.isFetching),D=!!(!a&&!de&&(K&&b||N)),w=!!(K&&!a&&f==="agents"&&c),ue=!!(!a&&c&&!w&&(f==="agents"||R==="full"));(0,l.useEffect)(()=>{w&&c?.("all")},[w,c]),(0,l.useEffect)(()=>{!a&&(R==="basic"||D)&&(g(n),B(n),V(n),$(n),q(""),z(""))},[R,N,a,D]),(0,l.useEffect)(()=>{if(!N){U&&H(!1);return}U||(H(!0),i.refetch())},[U,i,N]);const J=r(()=>{g(n),B(n),V(n),$(n),q(""),z("")},"clearFilters"),me=r(async()=>{Q(!0);try{const s=await ae.exportAgentActionsCsv(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),p=URL.createObjectURL(s),A=document.createElement("a");A.href=p,A.download=`${f==="agents"?"agent-audit":"activity"}-${t}.csv`,document.body.appendChild(A),A.click(),A.remove(),window.setTimeout(()=>URL.revokeObjectURL(p),5e3),h({title:"Audit exported",body:"Your CSV download has started.",tone:"success"})}catch(s){h({title:"Export failed",body:s instanceof Error?s.message:"Could not export the audit log.",tone:"error"})}finally{Q(!1)}},"handleExport");return K&&!D&&!w?(0,e.jsx)(Me,{}):(0,e.jsxs)("div",{className:"space-y-4",children:[d?null:(0,e.jsx)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Activity"}),(0,e.jsx)("p",{className:"mt-1 max-w-2xl text-sm text-muted-foreground",children:f==="agents"?"Every recorded agent action, newest first — with the responsible person and run behind each one.":"Everything happening in your company, newest first — people, agents, and the system. Each line is one recorded action."})]})}),ue?(0,e.jsx)(Ae,{value:f,onValueChange:r(s=>c?.(s),"onValueChange"),children:(0,e.jsxs)(we,{"aria-label":"Activity scope",children:[(0,e.jsx)(te,{value:"all",children:"All activity"}),(0,e.jsx)(te,{value:"agents",children:"Agent actions"})]})}):null,ce?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[a?null:(0,e.jsxs)(F,{value:m,onValueChange:g,children:[(0,e.jsx)(L,{className:"w-40",children:(0,e.jsx)(_,{placeholder:"Agent"})}),(0,e.jsxs)(k,{children:[(0,e.jsx)(y,{value:n,children:"All agents"}),(M.data??[]).map(s=>(0,e.jsx)(y,{value:s.id,children:s.name},s.id))]})]}),(0,e.jsxs)(F,{value:x,onValueChange:B,children:[(0,e.jsx)(L,{className:"w-52",children:(0,e.jsx)(_,{placeholder:"Responsible user"})}),(0,e.jsxs)(k,{children:[(0,e.jsx)(y,{value:n,children:"All responsible users"}),(O.data?.users??[]).map(s=>(0,e.jsx)(y,{value:s.principalId,children:s.user?.name??s.user?.email??s.principalId.slice(0,8)},s.principalId))]})]}),(0,e.jsxs)(F,{value:S,onValueChange:V,children:[(0,e.jsx)(L,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Action"})}),(0,e.jsx)(k,{children:Fe.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsxs)(F,{value:C,onValueChange:$,children:[(0,e.jsx)(L,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Entity"})}),(0,e.jsx)(k,{children:ke.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsx)(se,{type:"date","aria-label":"From date",value:E,max:I||void 0,onChange:r(s=>q(s.target.value),"onChange"),className:"w-36"}),(0,e.jsx)(se,{type:"date","aria-label":"To date",value:I,min:E||void 0,onChange:r(s=>z(s.target.value),"onChange"),className:"w-36"}),b?(0,e.jsx)(T,{variant:"ghost",size:"sm",onClick:J,children:"Clear filters"}):null,(0,e.jsxs)(T,{variant:"outline",size:"sm",className:"ml-auto",onClick:me,disabled:Z||i.isLoading||G.length===0,children:[(0,e.jsx)(Ue,{className:"mr-1.5 h-4 w-4"}),Z?"Exporting…":"Export CSV"]})]}):null,D||w?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Refreshing audit access…"})}):i.isLoading?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Loading…"})}):i.error?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:i.error instanceof Error?i.error.message:"Failed to load the audit log."}),(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.refetch(),"onClick"),children:"Try again"})]})}):G.length===0?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(Re,{className:"h-10 w-10 text-muted-foreground/40"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:b?"No actions match these filters":"Nothing here yet"}),(0,e.jsx)("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:b?"Try a wider date range or different filters.":f==="agents"?"As soon as your agents start doing things, their actions show up here.":"As soon as anyone in your company does something, it shows up here."})]}),b?(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:J,children:"Clear filters"}):null]})}):(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"px-0 py-0",children:(0,e.jsx)("ul",{className:pe("divide-y divide-border"),children:G.map(s=>(0,e.jsx)(ze,{record:s,agentMap:ie,userProfileMap:le},s.id))})})}),i.hasNextPage?(0,e.jsx)("div",{className:"flex justify-center",children:(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.fetchNextPage(),"onClick"),disabled:i.isFetchingNextPage,children:i.isFetchingNextPage?"Loading…":"Load more"})}):null,(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Recorded by Paperclip — entries can't be edited. Sensitive values are never stored."})]})}r(Oe,"AuditFeed");function nt(){const{selectedCompanyId:t}=fe(),{setBreadcrumbs:a}=je(),[d,u]=ve(),c=d.get("mode")==="agents"?"agents":"all";(0,l.useEffect)(()=>{a([{label:"Activity"}])},[a]);const h=(0,l.useCallback)(m=>{u(g=>{const x=new URLSearchParams(g);return m==="agents"?x.set("mode","agents"):x.delete("mode"),x},{replace:!0})},[u]);return t?(0,e.jsx)(Oe,{companyId:t,mode:c,onModeChange:h}):(0,e.jsx)(Ee,{icon:Pe,message:"Select a company to view activity."})}r(nt,"CompanyActivity");export{nt as CompanyActivity};
@@ -1,4 +1,4 @@
1
- var ze=Object.defineProperty;var d=(e,r)=>ze(e,"name",{value:r,configurable:!0});import{i as we}from"./rolldown-runtime-ZpX3ckPj.js";import{$t as De,Bi as te,Ct as _e,Er as Ue,G as ne,Ia as We,Ra as qe,St as G,ht as Ke,na as X,ta as pe}from"./agent-avatar-url-B91C7fqh.js";import{Ln as Ye,f as Ze,i as H,it as Ge,lt as z,n as Xe,r as He,y as Je}from"./BreadcrumbContext-BRKP7-bF.js";import{Z as Ve}from"./mention-chips-DtMro9HO.js";import{h as Qe}from"./StatusIcon-Co-elrfc.js";import{a as et}from"./ToastContext-CYUmn7f8.js";import{t as fe}from"./MarkdownBody-CbLdPc8E.js";import{r as tt}from"./badge-B4XIQ7B_.js";import{t as me}from"./rotate-ccw-wat5PoA5.js";import{t as D}from"./EmptyState-iwTwakaR.js";import{t as st}from"./PageSkeleton-Dl_gWB8z.js";import{Jt as nt,Pt as rt,Ut as ot,a as at,dt as it,ft as he,hn as ct,ht as lt,i as dt,mt as ut,n as pt,pt as ft,r as mt,t as je,ut as ht}from"./index-SsNrNOjw.js";var h=we(qe(),1),xt=["agents","projects","skills","routines","tasks","attachments"],gt={agents:"Agents",projects:"Projects",skills:"Skills",routines:"Routines",tasks:"Tasks",attachments:"Attachments"};function bt(){return{agents:!0,projects:!0,skills:!0,routines:!0,tasks:!0,attachments:!0}}d(bt,"buildDefaultExportCategorySelection");function ye(e){return e.tasks||e.routines}d(ye,"isAttachmentsCategoryEnabled");function ve(e){const r=new Set;for(const a of e){if(!a.recurring)continue;const n=a.path.trim();if(!n)continue;r.add(n);const o=n.lastIndexOf("/");o>=0&&r.add(`${n.slice(0,o+1)}`)}return r}d(ve,"buildRecurringTaskPrefixes");function wt(e,r){for(const a of r)if(e===a||e.startsWith(a))return!0;return!1}d(wt,"isRecurringTaskFile");function jt(e){const r=new Set,a=new Set;for(const n of e)for(const o of n.attachments??[]){const c=o.sha256.trim().toLowerCase();c&&(n.recurring?r:a).add(c)}return{recurring:r,oneOff:a}}d(jt,"buildAttachmentShaOwnership");var yt=new Set(["agents","projects","skills","routines","tasks"]);function vt(e){const r=new Map;for(const a of e){const n=a.sha256.trim().toLowerCase();if(!n)continue;const o=r.get(n)??new Set,c=a.ownedBy&&a.ownedBy.length>0?a.ownedBy:["always"];for(const p of c)o.add(p);r.set(n,o)}return r}d(vt,"buildEmbeddedAssetShaOwnership");function kt(e,r){for(const a of e)if(!yt.has(a)||r[a])return!0;return!1}d(kt,"isEmbeddedAssetBlobIncluded");function ke(e,r){return e.startsWith("agents/")?"agents":e.startsWith("projects/")?"projects":e.startsWith("skills/")?"skills":e.startsWith("tasks/")?wt(e,r)?"routines":"tasks":e.startsWith("blobs/")?"attachments":null}d(ke,"categorizeExportFile");function St(e,r){const a=ve(r),n={agents:0,projects:0,skills:0,routines:0,tasks:0,attachments:0};for(const o of e){const c=ke(o,a);c&&(n[c]+=1)}return n}d(St,"countExportFilesByCategory");function Ct(e){const{filePaths:r,issues:a,categories:n}=e,o=ve(a),c=jt(a),p=vt(e.embeddedAssets??[]),f=n.attachments&&ye(n),x=new Set;for(const l of r){const b=ke(l,o);if(b===null){x.add(l);continue}if(b==="attachments"){const i=l.slice(6).trim().toLowerCase(),g=p.get(i);if(g&&kt(g,n)){x.add(l);continue}if(!f)continue;const j=c.recurring.has(i),y=c.oneOff.has(i);!j&&!y?g||x.add(l):(y&&n.tasks||j&&n.routines)&&x.add(l);continue}n[b]&&x.add(l)}return x}d(Ct,"buildExportCheckedFiles");function Se(e,r){if(!r.has(e))return r.add(e),e;let a=2;for(;;){const n=`${e}-${a}`;if(!r.has(n))return r.add(n),n;a+=1}}d(Se,"uniqueSlug");function Et(e){const r=new Set,a=new Map,n=[...e].sort((o,c)=>o.name.localeCompare(c.name));for(const o of n){const c=Ue(o.name)??"agent";a.set(o.id,Se(c,r))}return a}d(Et,"buildPortableAgentSlugMap");function Nt(e){const r=new Set,a=new Map,n=[...e].sort((o,c)=>o.name.localeCompare(c.name));for(const o of n){const c=De(o.name,o.name);a.set(o.id,Se(c,r))}return a}d(Nt,"buildPortableProjectSlugMap");function At(e){const r=Et(e.agents),a=Nt(e.projects),n={agents:e.orderedAgents.map(o=>r.get(o.id)).filter(o=>!!o),projects:e.orderedProjects.map(o=>a.get(o.id)).filter(o=>!!o)};return n.agents.length>0||n.projects.length>0?n:void 0}d(At,"buildPortableSidebarOrder");var t=we(We(),1);function Ce(e){const r=new Set,a=new Set,n=new Set;for(const o of e){const c=o.match(/^agents\/([^/]+)\//);c&&r.add(c[1]);const p=o.match(/^projects\/([^/]+)\//);p&&a.add(p[1]);const f=o.match(/^tasks\/([^/]+)\//);f&&n.add(f[1])}return{agents:r,projects:a,tasks:n,routines:new Set(n)}}d(Ce,"checkedSlugs");function Pt(e,r){const a=Ce(r),n=e.split(`
1
+ var ze=Object.defineProperty;var d=(e,r)=>ze(e,"name",{value:r,configurable:!0});import{i as we}from"./rolldown-runtime-ZpX3ckPj.js";import{$t as De,Bi as te,Ct as _e,Er as Ue,G as ne,Ia as We,Ra as qe,St as G,ht as Ke,na as X,ta as pe}from"./agent-avatar-url-eBzFMwFS.js";import{Ln as Ye,f as Ze,i as H,it as Ge,lt as z,n as Xe,r as He,y as Je}from"./BreadcrumbContext-C-JqFdLZ.js";import{Z as Ve}from"./mention-chips-BEoxPZei.js";import{h as Qe}from"./StatusIcon-DxxLvme9.js";import{a as et}from"./ToastContext-BbzJdb2r.js";import{t as fe}from"./MarkdownBody-CEcIElD-.js";import{r as tt}from"./badge-CUe24HAP.js";import{t as me}from"./rotate-ccw-BT1r8zDE.js";import{t as D}from"./EmptyState-fxPFhH-R.js";import{t as st}from"./PageSkeleton-iVZWoLsF.js";import{Jt as nt,Pt as rt,Ut as ot,a as at,dt as it,ft as he,hn as ct,ht as lt,i as dt,mt as ut,n as pt,pt as ft,r as mt,t as je,ut as ht}from"./index-st-IN4Gf.js";var h=we(qe(),1),xt=["agents","projects","skills","routines","tasks","attachments"],gt={agents:"Agents",projects:"Projects",skills:"Skills",routines:"Routines",tasks:"Tasks",attachments:"Attachments"};function bt(){return{agents:!0,projects:!0,skills:!0,routines:!0,tasks:!0,attachments:!0}}d(bt,"buildDefaultExportCategorySelection");function ye(e){return e.tasks||e.routines}d(ye,"isAttachmentsCategoryEnabled");function ve(e){const r=new Set;for(const a of e){if(!a.recurring)continue;const n=a.path.trim();if(!n)continue;r.add(n);const o=n.lastIndexOf("/");o>=0&&r.add(`${n.slice(0,o+1)}`)}return r}d(ve,"buildRecurringTaskPrefixes");function wt(e,r){for(const a of r)if(e===a||e.startsWith(a))return!0;return!1}d(wt,"isRecurringTaskFile");function jt(e){const r=new Set,a=new Set;for(const n of e)for(const o of n.attachments??[]){const c=o.sha256.trim().toLowerCase();c&&(n.recurring?r:a).add(c)}return{recurring:r,oneOff:a}}d(jt,"buildAttachmentShaOwnership");var yt=new Set(["agents","projects","skills","routines","tasks"]);function vt(e){const r=new Map;for(const a of e){const n=a.sha256.trim().toLowerCase();if(!n)continue;const o=r.get(n)??new Set,c=a.ownedBy&&a.ownedBy.length>0?a.ownedBy:["always"];for(const p of c)o.add(p);r.set(n,o)}return r}d(vt,"buildEmbeddedAssetShaOwnership");function kt(e,r){for(const a of e)if(!yt.has(a)||r[a])return!0;return!1}d(kt,"isEmbeddedAssetBlobIncluded");function ke(e,r){return e.startsWith("agents/")?"agents":e.startsWith("projects/")?"projects":e.startsWith("skills/")?"skills":e.startsWith("tasks/")?wt(e,r)?"routines":"tasks":e.startsWith("blobs/")?"attachments":null}d(ke,"categorizeExportFile");function St(e,r){const a=ve(r),n={agents:0,projects:0,skills:0,routines:0,tasks:0,attachments:0};for(const o of e){const c=ke(o,a);c&&(n[c]+=1)}return n}d(St,"countExportFilesByCategory");function Ct(e){const{filePaths:r,issues:a,categories:n}=e,o=ve(a),c=jt(a),p=vt(e.embeddedAssets??[]),f=n.attachments&&ye(n),x=new Set;for(const l of r){const b=ke(l,o);if(b===null){x.add(l);continue}if(b==="attachments"){const i=l.slice(6).trim().toLowerCase(),g=p.get(i);if(g&&kt(g,n)){x.add(l);continue}if(!f)continue;const j=c.recurring.has(i),y=c.oneOff.has(i);!j&&!y?g||x.add(l):(y&&n.tasks||j&&n.routines)&&x.add(l);continue}n[b]&&x.add(l)}return x}d(Ct,"buildExportCheckedFiles");function Se(e,r){if(!r.has(e))return r.add(e),e;let a=2;for(;;){const n=`${e}-${a}`;if(!r.has(n))return r.add(n),n;a+=1}}d(Se,"uniqueSlug");function Et(e){const r=new Set,a=new Map,n=[...e].sort((o,c)=>o.name.localeCompare(c.name));for(const o of n){const c=Ue(o.name)??"agent";a.set(o.id,Se(c,r))}return a}d(Et,"buildPortableAgentSlugMap");function Nt(e){const r=new Set,a=new Map,n=[...e].sort((o,c)=>o.name.localeCompare(c.name));for(const o of n){const c=De(o.name,o.name);a.set(o.id,Se(c,r))}return a}d(Nt,"buildPortableProjectSlugMap");function At(e){const r=Et(e.agents),a=Nt(e.projects),n={agents:e.orderedAgents.map(o=>r.get(o.id)).filter(o=>!!o),projects:e.orderedProjects.map(o=>a.get(o.id)).filter(o=>!!o)};return n.agents.length>0||n.projects.length>0?n:void 0}d(At,"buildPortableSidebarOrder");var t=we(We(),1);function Ce(e){const r=new Set,a=new Set,n=new Set;for(const o of e){const c=o.match(/^agents\/([^/]+)\//);c&&r.add(c[1]);const p=o.match(/^projects\/([^/]+)\//);p&&a.add(p[1]);const f=o.match(/^tasks\/([^/]+)\//);f&&n.add(f[1])}return{agents:r,projects:a,tasks:n,routines:new Set(n)}}d(Ce,"checkedSlugs");function Pt(e,r){const a=Ce(r),n=e.split(`
2
2
  `),o=[],c=new Set(["agents","projects","tasks","routines"]),p=new Set(["agents","projects"]);let f=null,x=null,l=!0,b=null,i=null,g=[],j=null,y=[];function T(){i!==null&&g.length>0&&(y.push(i),y.push(...g)),i=null,g=[]}d(T,"flushSidebarSection");function N(){T(),j!==null&&y.length>0&&(o.push(j),o.push(...y)),j=null,y=[]}d(N,"flushSection");for(const w of n){const U=w.match(/^([a-zA-Z_][\w-]*):\s*(.*)$/);if(U&&!w.startsWith(" ")){N(),x=null,l=!0;const E=U[0].split(":")[0];if(c.has(E)){f=E,j=w;continue}else if(E==="sidebar"){f=E,b=null,j=w;continue}else{f=null,o.push(w);continue}}if(f==="sidebar"){const E=w.match(/^ ([\w-]+):\s*$/);if(E&&!w.startsWith(" ")){T();const A=E[1];b=A&&p.has(A)?A:null,i=b?w:null;continue}const L=w.match(/^ - ["']?([^"'\n]+)["']?\s*$/);if(L&&b){const A=L[1],W=a[b];A&&W.has(A)&&g.push(w);continue}if(b){g.push(w);continue}}if(f&&c.has(f)){const E=w.match(/^ ([\w][\w-]*):\s*(.*)$/);if(E&&!w.startsWith(" ")){const L=E[1];x=L,l=a[f].has(L),l&&y.push(w);continue}if(x!==null){l&&y.push(w);continue}y.push(w);continue}o.push(w)}N();let C=o.join(`
3
3
  `);const _=C.match(/^\s{2}logoPath:\s*["']?([^"'\n]+)["']?\s*$/m);return _&&!r.has(_[1])&&(C=C.replace(/^\s{2}logoPath:\s*["']?([^"'\n]+)["']?\s*\n?/m,"")),C}d(Pt,"filterPaperclipYaml");function Ee(e,r){if(!r)return e;const a=r.toLowerCase();return e.map(n=>{if(n.kind==="file")return n.name.toLowerCase().includes(a)||n.path.toLowerCase().includes(a)?n:null;const o=Ee(n.children,r);return o.length>0?{...n,children:o}:null}).filter(n=>n!==null)}d(Ee,"filterTree");function Rt(e,r){const a=new Set,n=r.toLowerCase();function o(c,p){if(c.kind==="file"){if(c.name.toLowerCase().includes(n)||c.path.toLowerCase().includes(n))for(const f of p)a.add(f)}else for(const f of c.children)o(f,[...p,c.path])}d(o,"walk");for(const c of e)o(c,[]);return a}d(Rt,"collectMatchedParentDirs");var xe=10;function Tt(e,r,a,n){let o=0,c=0;return{nodes:e.map(p=>{if(p.kind==="dir"&&p.name==="tasks"){o=p.children.length;const f=[],x=[],l=a.toLowerCase();for(const g of p.children){const j=ft([g],"file"),y=n!==null&&j.has(n),T=a&&(g.name.toLowerCase().includes(l)||g.path.toLowerCase().includes(l)||[...j].some(N=>N.toLowerCase().includes(l)));y||T?f.push(g):x.push(g)}const b=Math.max(0,r-f.length),i=[...f,...x.slice(0,b)];return c=i.length,{...p,children:i}}return p}),totalTaskChildren:o,visibleTaskChildren:c}}d(Tt,"paginateTaskNodes");function Ne(e,r,a){const n={};for(const o of Object.keys(e))r.has(o)&&(n[o]=a[o]??e[o]);return n}d(Ne,"filterExportForDownload");function Lt(e,r,a){const n=Ne(e.files,r,a),o=dt(n,e.rootPath),c=new ArrayBuffer(o.byteLength);new Uint8Array(c).set(o);const p=new Blob([c],{type:"application/zip"}),f=URL.createObjectURL(p),x=document.createElement("a");x.href=f,x.download=`${e.rootPath}.zip`,document.body.appendChild(x),x.click(),x.remove(),window.setTimeout(()=>URL.revokeObjectURL(f),1e3)}d(Lt,"downloadZip");function Ot({data:e,onSkillClick:r}){return(0,t.jsx)("div",{className:"rounded-md border border-border bg-accent/20 px-4 py-3 mb-4",children:(0,t.jsx)("dl",{className:"grid grid-cols-(--gtc-5) gap-x-4 gap-y-1.5 text-sm",children:Object.entries(e).map(([a,n])=>(0,t.jsxs)("div",{className:"contents",children:[(0,t.jsx)("dt",{className:"text-muted-foreground whitespace-nowrap py-0.5",children:ht[a]??a}),(0,t.jsx)("dd",{className:"py-0.5",children:Array.isArray(n)?(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.map(o=>(0,t.jsx)("button",{type:"button",className:ne("inline-flex items-center rounded-md border border-border bg-background px-2 py-0.5 text-xs",a==="skills"&&r&&"cursor-pointer hover:bg-accent/50 hover:border-foreground/30 transition-colors"),onClick:d(()=>a==="skills"&&r?.(o),"onClick"),children:o},o))}):(0,t.jsx)("span",{children:n})})]},a))})})}d(Ot,"FrontmatterCard");var Mt={ceo:"CEO",cto:"CTO",cmo:"CMO",cfo:"CFO",coo:"COO",vp:"VP",manager:"Manager",engineer:"Engineer",agent:"Agent"};function Ft(e,r,a,n){const o=Ce(r),c=e.agents.filter(i=>o.agents.has(i.slug)),p=e.projects.filter(i=>o.projects.has(i.slug)),f=e.issues.filter(i=>o.tasks.has(i.slug)),x=e.skills.filter(i=>[...r].some(g=>g.startsWith(`skills/${i.key}/`)||g.startsWith("skills/")&&g.includes(`/${i.slug}/`))),l=[];l.push(`# ${a}`),l.push(""),n&&(l.push(`> ${n}`),l.push("")),c.length>0&&(l.push("![Org Chart](images/org-chart.png)"),l.push("")),l.push("## What's Inside"),l.push(""),l.push("This is an [Agent Company](https://paperclip.ing) package."),l.push("");const b=[];if(c.length>0&&b.push(["Agents",c.length]),p.length>0&&b.push(["Projects",p.length]),x.length>0&&b.push(["Skills",x.length]),f.length>0&&b.push(["Tasks",f.length]),b.length>0){l.push("| Content | Count |"),l.push("|---------|-------|");for(const[i,g]of b)l.push(`| ${i} | ${g} |`);l.push("")}if(c.length>0){l.push("### Agents"),l.push(""),l.push("| Agent | Role | Reports To |"),l.push("|-------|------|------------|");for(const i of c){const g=Mt[i.role]??i.role,j=i.reportsToSlug??"—";l.push(`| ${i.name} | ${g} | ${j} |`)}l.push("")}if(p.length>0){l.push("### Projects"),l.push("");for(const i of p){const g=i.description?` — ${i.description}`:"";l.push(`- **${i.name}**${g}`)}l.push("")}return l.push("## Getting Started"),l.push(""),l.push("```bash"),l.push("npx @tickernelz/paperclip-pro company import this-github-url-or-folder"),l.push("```"),l.push(""),l.push("See [Paperclip](https://paperclip.ing) for more information."),l.push(""),l.push("---"),l.push(`Exported from [Paperclip](https://paperclip.ing) on ${new Date().toISOString().split("T")[0]}`),l.push(""),l.join(`
4
4
  `)}d(Ft,"generateReadmeFromSelection");function It(e){const{src:r,selectedFile:a,allFiles:n,orgChartPreviewUrl:o}=e;if(/^(?:https?:|data:)/i.test(r))return null;if(r.replace(/^\.\//,"")==="images/org-chart.png"&&o)return o;const c=(a.includes("/")?a.slice(0,a.lastIndexOf("/")+1):"")+r,p=n[c]??n[r];return p?je(c in n?c:r,p):null}d(It,"resolveExportPreviewImageSrc");function $t({selectedFile:e,content:r,allFiles:a,orgChartPreviewUrl:n,onSkillClick:o}){if(!e||r===null)return(0,t.jsx)(D,{icon:z,message:"Select a file to preview its contents."});const c=pt(r),p=e.endsWith(".md")&&c!==null,f=p&&c?lt(c):null,x=mt(e,r)?je(e,r):null,l=p?b=>It({src:b,selectedFile:e,allFiles:a,orgChartPreviewUrl:n}):void 0;return(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"border-b border-border px-5 py-3",children:(0,t.jsx)("div",{className:"truncate font-mono text-sm",children:e})}),(0,t.jsx)("div",{className:"min-h-(--sz-560px) px-5 py-5",children:f?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Ot,{data:f.data,onSkillClick:o}),f.body.trim()&&(0,t.jsx)(fe,{resolveImageSrc:l,softBreaks:!1,linkIssueReferences:!1,children:f.body})]}):p?(0,t.jsx)(fe,{resolveImageSrc:l,softBreaks:!1,linkIssueReferences:!1,children:c??""}):x?(0,t.jsx)("div",{className:"flex min-h-(--sz-520px) items-center justify-center rounded-lg border border-border bg-accent/10 p-6",children:(0,t.jsx)("img",{src:x,alt:e,className:"max-h-(--sz-480px) max-w-full object-contain"})}):c!==null?(0,t.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words border-0 bg-transparent p-0 font-mono text-sm text-foreground",children:(0,t.jsx)("code",{children:c})}):(0,t.jsx)("div",{className:"rounded-lg border border-border bg-accent/10 px-4 py-3 text-sm text-muted-foreground",children:"Binary asset preview is not available for this file type."})})]})}d($t,"ExportPreviewPane");function ge(e){const r="/company/export/files/",a=Je(e),n=a.indexOf(r);return n===-1?null:decodeURIComponent(a.slice(n+22))||null}d(ge,"filePathFromLocation");function be(e){const r=e.split("/").slice(0,-1),a=[];let n="";for(const o of r)n=n?`${n}/${o}`:o,a.push(n);return a}d(be,"expandAncestors");function Bt(e){return(e instanceof DOMException||e instanceof Error)&&e.name==="AbortError"}d(Bt,"isAbortError");function se(e){return e instanceof Error?e.message:"Failed to load export data."}d(se,"previewErrorMessage");function Vt(){const{selectedCompanyId:e,selectedCompany:r}=Ke(),{setBreadcrumbs:a}=Xe(),{pushToast:n}=et(),o=Ze(),c=Ye(),p=(0,h.useRef)(ge(c.pathname)),{data:f}=X({queryKey:G.auth.session,queryFn:d(()=>_e.getSession(),"queryFn")}),{data:x=[]}=X({queryKey:G.agents.list(e),queryFn:d(()=>He.list(e),"queryFn"),enabled:!!e}),{data:l=[]}=X({queryKey:G.projects.list(e),queryFn:d(()=>Qe.list(e),"queryFn"),enabled:!!e}),{data:b}=X({queryKey:G.companies.exportFidelity(e),queryFn:d(()=>te.exportFidelity(e),"queryFn"),enabled:!!e}),[i,g]=(0,h.useState)(null),[j,y]=(0,h.useState)(null),[T,N]=(0,h.useState)(new Set),[C,_]=(0,h.useState)(()=>({...bt(),tasks:!1,routines:!1,attachments:!1})),[w,U]=(0,h.useState)(""),[E,L]=(0,h.useState)(xe),[A,W]=(0,h.useState)(!1),q=(0,h.useRef)(null),I=(0,h.useRef)(null),M=(0,h.useRef)(0),re=(0,h.useRef)(null),oe=f?.user?.id??f?.session?.userId??null,J=(0,h.useMemo)(()=>x.filter(s=>s.status!=="terminated"),[x]),V=(0,h.useMemo)(()=>l,[l]),{orderedAgents:ae}=nt({agents:J,companyId:e,userId:oe}),{orderedProjects:ie}=ot({projects:V,companyId:e,userId:oe}),ce=(0,h.useMemo)(()=>At({agents:J,orderedAgents:ae,projects:V,orderedProjects:ie}),[ae,ie,J,V]),Q=C.tasks||C.routines,ee=(0,h.useCallback)((s,u=!1)=>{y(s),s?o(`/company/export/files/${encodeURI(s)}`,{replace:u}):o("/company/export",{replace:u})},[o]);(0,h.useEffect)(()=>{if(!i)return;const s=ge(c.pathname);s&&s in i.files&&s!==j?(y(s),N(u=>{const m=new Set(u);for(const v of be(s))m.add(v);return m})):!s&&j&&y(null)},[c.pathname,i]),(0,h.useEffect)(()=>{a([{label:r?.name??"Organization",href:"/dashboard"},{label:"Settings",href:"/company/settings"},{label:"Export"}])},[r?.name,a]);const P=pe({mutationFn:d(({includeIssues:s,includeSkills:u,signal:m})=>te.exportPreview(e,{include:{company:!0,agents:!0,projects:!0,issues:s,skills:u},sidebarOrder:ce},{signal:m}),"mutationFn"),onSuccess:d((s,u)=>{if(u.requestId!==M.current)return;g(s);const m=he(s.files),v=new Set;for(const k of m)k.kind==="dir"&&k.name!=="tasks"&&v.add(k.path);const S=p.current;if(S&&S in s.files){y(S);const k=be(S);N(new Set([...v,...k]))}else{const k="README.md"in s.files?"README.md":Object.keys(s.files)[0];k&&ee(k,!0),N(v)}},"onSuccess"),onError:d((s,u)=>{u.requestId!==M.current||Bt(s)||n({tone:"error",title:"Export failed",body:se(s)})},"onError")});function F(){if(!e)return;I.current?.abort();const s=new AbortController,u=M.current+1;M.current=u,I.current=s,W(!1),P.mutate({includeIssues:Q,includeSkills:C.skills,requestId:u,signal:s.signal})}d(F,"startPreviewRequest");const K=pe({mutationFn:d(()=>te.exportBundle(e,{include:{company:!0,agents:!0,projects:!0,issues:Q,skills:C.skills},selectedFiles:Array.from(R).sort(),sidebarOrder:ce}),"mutationFn"),onSuccess:d(s=>{const u=new Set(Object.keys(s.files));Lt(s,u,s.files),n({tone:"success",title:"Export downloaded",body:`${u.size} file${u.size===1?"":"s"} exported as ${s.rootPath}.zip`})},"onSuccess"),onError:d(s=>{n({tone:"error",title:"Export failed",body:s instanceof Error?s.message:"Failed to build export package."})},"onError")});(0,h.useEffect)(()=>{e&&(re.current!==e&&(re.current=e,g(null),y(null)),F())},[e,Q,C.skills]),(0,h.useEffect)(()=>()=>{M.current+=1,I.current?.abort()},[]);const O=(0,h.useMemo)(()=>i?he(i.files):[],[i]),R=(0,h.useMemo)(()=>i?Ct({filePaths:Object.keys(i.files),issues:i.manifest.issues,categories:C,embeddedAssets:i.manifest.embeddedAssets??[]}):new Set,[i,C]),Ae=(0,h.useMemo)(()=>i?St(Object.keys(i.files),i.manifest.issues):null,[i]),{displayTree:Pe,totalTaskChildren:le,visibleTaskChildren:de}=(0,h.useMemo)(()=>{let s=O;w&&(s=Ee(s,w));const u=Tt(s,E,w,j);return{displayTree:u.nodes,totalTaskChildren:u.totalTaskChildren,visibleTaskChildren:u.visibleTaskChildren}},[O,w,E,j]),Re=(0,h.useMemo)(()=>{const s={};function u(m){if(m.kind==="file"){const S=R.has(m.path);return S||(s[m.path]="muted"),S}let v=!1;for(const S of m.children)u(S)&&(v=!0);return v||(s[m.path]="muted"),v}d(u,"walk");for(const m of O)u(m);return s},[O,R]),Y=(0,h.useMemo)(()=>{if(!i)return{};const s={...i.files},u=i.paperclipExtensionPath;if(u&&typeof i.files[u]=="string"&&(s[u]=Pt(i.files[u],R)),typeof i.files["README.md"]=="string"){const m=i.manifest.company?.name??r?.name??"Company",v=i.manifest.company?.description??null;s["README.md"]=Ft(i.manifest,R,m,v)}return s},[i,R,r?.name]),Te=(0,h.useMemo)(()=>i?at(Ne(i.files,R,Y),i.rootPath):0,[i,R,Y]),ue=(0,h.useMemo)(()=>ut(O),[O]),$=R.size,B=(0,h.useMemo)(()=>i?i.warnings.filter(s=>!/terminated agent/i.test(s)):[],[i]);function Le(s){N(u=>{const m=new Set(u);return m.has(s)?m.delete(s):m.add(s),m})}d(Le,"handleToggleDir");function Oe(s){_(u=>({...u,[s]:!u[s]}))}d(Oe,"handleToggleCategory");function Me(s){const u=w.length>0,m=s.length>0;if(m&&!u&&(q.current=new Set(T)),U(s),m){const v=Rt(O,s);N(S=>{const k=new Set(S);for(const Z of v)k.add(Z);return k})}else u&&q.current&&(N(q.current),q.current=null)}d(Me,"handleSearchChange");function Fe(s){if(!i)return;const u=i.manifest.skills.find(m=>m.key===s||m.slug===s)?.path??`skills/${s}/SKILL.md`;u in i.files&&(ee(u),N(m=>{const v=new Set(m);v.add("skills");const S=u.split("/").slice(0,-1);let k="";for(const Z of S)k=k?`${k}/${Z}`:Z,v.add(k);return v}))}d(Fe,"handleSkillClick");function Ie(){!i||R.size===0||K.isPending||K.mutate()}d(Ie,"handleDownload");function $e(){M.current+=1,I.current?.abort(),I.current=null,P.reset(),W(!0)}if(d($e,"handleCancelPreview"),!e)return(0,t.jsx)(D,{icon:z,message:"Select an organization to export."});if(P.isPending&&!i)return(0,t.jsx)(st,{variant:"detail"});if(A&&!i)return(0,t.jsx)(D,{icon:z,title:"Export preview cancelled",message:"The preview request was cancelled. Your export settings are unchanged.",action:"Retry preview",onAction:F,hideActionIcon:!0});if(P.isError&&!i)return(0,t.jsx)(D,{icon:z,title:"Export preview failed",message:se(P.error),description:"Retry the preview. You do not need to reload this page.",action:"Retry preview",onAction:F,hideActionIcon:!0});if(!i)return(0,t.jsx)(D,{icon:z,title:"Export preview unavailable",message:"No export preview is loaded.",action:"Load preview",onAction:F,hideActionIcon:!0});const Be=j?Y[j]??null:null;return(0,t.jsxs)("div",{className:"max-w-6xl",children:[(0,t.jsx)("div",{className:"sticky top-0 z-10 border-b border-border bg-background px-5 py-3",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[(0,t.jsxs)("span",{className:"font-medium",children:[r?.name??"Organization"," export"]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:["Exporting ",$.toLocaleString()," of ",ue.toLocaleString()," file",ue===1?"":"s",$>0&&` (~${rt(Te)})`]}),B.length>0&&(0,t.jsxs)("span",{className:"text-amber-500",children:[B.length," warning",B.length===1?"":"s"]})]}),(0,t.jsxs)(H,{size:"sm",onClick:Ie,disabled:$===0||K.isPending||P.isPending||P.isError||A,children:[(0,t.jsx)(ct,{className:"mr-1.5 h-3.5 w-3.5"}),K.isPending?"Building export...":`Export ${$.toLocaleString()} file${$===1?"":"s"}`]})]})}),B.length>0&&(0,t.jsx)("div",{className:"mx-5 mt-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:B.map(s=>(0,t.jsx)("div",{className:"text-xs text-amber-500",children:s},s))}),b&&b.warnings.length>0&&(0,t.jsxs)("div",{className:"mx-5 mt-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:[(0,t.jsx)("h3",{className:"mb-1.5 text-xs font-medium",children:"Not included in this export"}),b.warnings.map(s=>(0,t.jsx)("div",{className:ne("text-xs",s.severity==="blocker"?"font-medium text-destructive":"text-amber-500"),children:s.message},s.code))]}),(0,t.jsxs)("div",{className:"grid gap-4 xl:h-(--sz-calc-30) xl:grid-cols-(--gtc-25) xl:gap-0",children:[(0,t.jsxs)("aside",{className:"flex max-h-(--sz-24rem) flex-col overflow-hidden border-b border-border xl:max-h-none xl:border-b-0 xl:border-r",children:[(0,t.jsx)("div",{className:"border-b border-border px-4 py-3 shrink-0",children:(0,t.jsx)("h2",{className:"text-base font-semibold",children:"Package files"})}),(0,t.jsxs)("div",{className:"border-b border-border px-4 py-3 shrink-0",children:[(0,t.jsx)("h3",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"What to include"}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1.5",role:"group","aria-label":"What to include",children:xt.map(s=>{const u=s==="attachments"&&!ye(C),m=C[s]&&!u,v=Ae?.[s]??0,S=i.manifest.includes.issues||s!=="tasks"&&s!=="routines"&&s!=="attachments";return(0,t.jsxs)("label",{className:ne("flex items-center gap-2 text-sm",u?"cursor-not-allowed opacity-50":"cursor-pointer"),title:u?"Attachments travel with tasks and routines; re-enable one of them to include attachments.":void 0,children:[(0,t.jsx)("input",{type:"checkbox",checked:m,disabled:u,onChange:d(()=>Oe(s),"onChange"),className:"accent-foreground","data-export-category":s}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:gt[s]}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:S?v.toLocaleString():"—"})]},s)})}),(0,t.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"Task and routine history is opt-in because it can be large."})]}),(0,t.jsx)("div",{className:"border-b border-border px-3 py-2 shrink-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border px-2 py-1",children:[(0,t.jsx)(Ge,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("input",{type:"text",value:w,onChange:d(s=>Me(s.target.value),"onChange"),placeholder:"Search files...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-page-search-target":"true"})]})}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,t.jsx)(it,{nodes:Pe,selectedFile:j,expandedDirs:T,onToggleDir:Le,onSelectFile:ee,fileTones:Re,showCheckboxes:!1,wrapLabels:!1}),le>de&&!w&&(0,t.jsx)("div",{className:"px-4 py-2",children:(0,t.jsxs)("button",{type:"button",onClick:d(()=>L(s=>s+xe),"onClick"),className:"w-full rounded-md border border-border px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/30 hover:text-foreground transition-colors",children:["Show more tasks (",de," of ",le,")"]})})]})]}),(0,t.jsxs)("div",{className:"relative min-w-0 overflow-y-auto xl:pl-6",children:[(0,t.jsx)($t,{selectedFile:j,content:Be,allFiles:Y,orgChartPreviewUrl:`/api/companies/${encodeURIComponent(e)}/org.svg`,onSkillClick:Fe}),P.isPending?(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex min-h-(--sz-520px) items-center justify-center bg-background/90 px-6 text-center",role:"status","aria-live":"polite","aria-busy":"true","data-export-preview-state":"loading",children:(0,t.jsxs)("div",{className:"flex max-w-md flex-col items-center gap-3",children:[(0,t.jsx)(tt,{className:"h-6 w-6 animate-spin text-muted-foreground"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"Updating export preview…"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Large task histories can take a minute. You can untick Tasks or cancel this update."})]}),(0,t.jsxs)(H,{type:"button",variant:"outline",size:"sm",onClick:$e,children:[(0,t.jsx)(Ve,{}),"Cancel update"]})]})}):A?(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex min-h-(--sz-520px) items-center justify-center bg-background/90 px-6 text-center","data-export-preview-state":"cancelled",children:(0,t.jsxs)("div",{className:"flex max-w-md flex-col items-center gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"Preview update cancelled"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"The previous preview remains available. Retry when you are ready."})]}),(0,t.jsxs)(H,{type:"button",variant:"outline",size:"sm",onClick:F,children:[(0,t.jsx)(me,{}),"Retry preview"]})]})}):P.isError?(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex min-h-(--sz-520px) items-center justify-center bg-background/90 px-6 text-center",role:"alert","data-export-preview-state":"error",children:(0,t.jsxs)("div",{className:"flex max-w-md flex-col items-center gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-destructive",children:"Export preview failed"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:se(P.error)})]}),(0,t.jsxs)(H,{type:"button",variant:"outline",size:"sm",onClick:F,children:[(0,t.jsx)(me,{}),"Retry preview"]})]})}):null]})]})]})}d(Vt,"CompanyExport");export{Vt as CompanyExport};
@@ -1,4 +1,4 @@
1
- var gr=Object.defineProperty;var n=(t,l)=>gr(t,"name",{value:l,configurable:!0});import{i as yn}from"./rolldown-runtime-ZpX3ckPj.js";import{Fa as fr,G as M,Ia as br,Ra as jr,St as f,ht as vr,na as xe,t as ge,ta as Y,ut as yr}from"./agent-avatar-url-B91C7fqh.js";import{Bn as kr,Vn as Nr,ct as jt,f as wr,ft as Sr,i as y,it as Cr,n as Fr,r as Hs,s as pe,tt as kn,vt as Ir,xt as Ft}from"./BreadcrumbContext-BRKP7-bF.js";import{Z as Dr}from"./mention-chips-DtMro9HO.js";import{d as qe,m as Nn,p as $e,u as ze}from"./alert-dialog-CfwPsmAH.js";import{t as rn}from"./AgentAvatar-B47RVwPt.js";import{D as Lr,E as Ws,O as Br,T as Pr,_ as xt,a as bs,c as js,f as Bs,h as Ze,m as Ps,n as vt,o as As,r as vs,s as yt,t as Er,u as ys,v as Ls,w as Es,y as Tr}from"./checkbox-3gl2Un2H.js";import{c as _,f as Ar,t as Kr}from"./MarkdownEditor-98mZdmRX.js";import{i as Ts,r as wn,t as Sn}from"./tabs-CVzr4EnB.js";import{p as It}from"./StatusIcon-Co-elrfc.js";import{l as Cn,o as Mr,r as Fn,s as Rr,t as qr}from"./use-adapter-capabilities-BzuoLi4n.js";import{t as In}from"./check-x_elx0uL.js";import{a as $r,s as gs}from"./ToastContext-CYUmn7f8.js";import{a as Dn,i as Dt,s as Ln}from"./clipboard-_seTAJiP.js";import{r as ht,t as zr}from"./use-copy-action-D1yLO8Yp.js";import{n as _r,t as fs}from"./external-link-DZQH1MR8.js";import{E as Ur,t as kt}from"./MarkdownBody-CbLdPc8E.js";import{t as Lt}from"./file-text-DnkFEoqC.js";import{d as Vr,u as Bn}from"./sheet-5L45GZhN.js";import{t as le}from"./badge-B4XIQ7B_.js";import{t as Re}from"./input-DW5WzZI0.js";import{t as es}from"./EmptyState-iwTwakaR.js";import{t as Be}from"./PageSkeleton-Dl_gWB8z.js";import{$t as Or,Ct as pt,Et as Pn,G as Qr,H as Hr,J as Gr,K as Wr,Q as Yr,St as Gs,Tt as En,U as Xr,W as Zr,X as Jr,Y as ea,Z as sa,_ as ta,an as na,at as an,bt as gt,c as ra,cn as aa,d as la,et as ia,f as Ks,fn as oa,g as da,gn as ca,h as ua,hn as Nt,in as Tn,it as An,jt as ma,kt as xa,l as ha,ln as pa,lt as he,m as Kn,mn as Mn,nn as ga,nt as fa,o as ba,ot as Je,p as ft,pn as ks,rt as ja,s as va,sn as wt,tt as ya,u as ka,v as Na,vn as St,vt as Bt,wt as wa,xt as Sa,y as Ca,yn as ln,yt as Fa}from"./index-SsNrNOjw.js";var c=yn(jr(),1),e=yn(br(),1),on=16,dn=24,cn="min-h-9";function un(t){return(0,e.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...t,children:(0,e.jsx)("path",{d:"M12 4 21 19H3z"})})}n(un,"VercelMark");function Rn(t){const l=t.replace(/\r\n/g,`
1
+ var gr=Object.defineProperty;var n=(t,l)=>gr(t,"name",{value:l,configurable:!0});import{i as yn}from"./rolldown-runtime-ZpX3ckPj.js";import{Fa as fr,G as M,Ia as br,Ra as jr,St as f,ht as vr,na as xe,t as ge,ta as Y,ut as yr}from"./agent-avatar-url-eBzFMwFS.js";import{Bn as kr,Vn as Nr,ct as jt,f as wr,ft as Sr,i as y,it as Cr,n as Fr,r as Hs,s as pe,tt as kn,vt as Ir,xt as Ft}from"./BreadcrumbContext-C-JqFdLZ.js";import{Z as Dr}from"./mention-chips-BEoxPZei.js";import{d as qe,m as Nn,p as $e,u as ze}from"./alert-dialog-Ctnjtpv6.js";import{t as rn}from"./AgentAvatar-DySHTTwq.js";import{D as Lr,E as Ws,O as Br,T as Pr,_ as xt,a as bs,c as js,f as Bs,h as Ze,m as Ps,n as vt,o as As,r as vs,s as yt,t as Er,u as ys,v as Ls,w as Es,y as Tr}from"./checkbox-Cm-PyDSt.js";import{c as _,f as Ar,t as Kr}from"./MarkdownEditor-B6kwxxZP.js";import{i as Ts,r as wn,t as Sn}from"./tabs-C1f963Rn.js";import{p as It}from"./StatusIcon-DxxLvme9.js";import{l as Cn,o as Mr,r as Fn,s as Rr,t as qr}from"./use-adapter-capabilities-CsKGmy5W.js";import{t as In}from"./check-VcfFMsHr.js";import{a as $r,s as gs}from"./ToastContext-BbzJdb2r.js";import{a as Dn,i as Dt,s as Ln}from"./clipboard-CYFyFXxJ.js";import{r as ht,t as zr}from"./use-copy-action-B-Azftuv.js";import{n as _r,t as fs}from"./external-link-CAutrcht.js";import{E as Ur,t as kt}from"./MarkdownBody-CEcIElD-.js";import{t as Lt}from"./file-text-Dik8gyob.js";import{d as Vr,u as Bn}from"./sheet-CAjfRCp9.js";import{t as le}from"./badge-CUe24HAP.js";import{t as Re}from"./input-BARyUoy0.js";import{t as es}from"./EmptyState-fxPFhH-R.js";import{t as Be}from"./PageSkeleton-iVZWoLsF.js";import{$t as Or,Ct as pt,Et as Pn,G as Qr,H as Hr,J as Gr,K as Wr,Q as Yr,St as Gs,Tt as En,U as Xr,W as Zr,X as Jr,Y as ea,Z as sa,_ as ta,an as na,at as an,bt as gt,c as ra,cn as aa,d as la,et as ia,f as Ks,fn as oa,g as da,gn as ca,h as ua,hn as Nt,in as Tn,it as An,jt as ma,kt as xa,l as ha,ln as pa,lt as he,m as Kn,mn as Mn,nn as ga,nt as fa,o as ba,ot as Je,p as ft,pn as ks,rt as ja,s as va,sn as wt,tt as ya,u as ka,v as Na,vn as St,vt as Bt,wt as wa,xt as Sa,y as Ca,yn as ln,yt as Fa}from"./index-st-IN4Gf.js";var c=yn(jr(),1),e=yn(br(),1),on=16,dn=24,cn="min-h-9";function un(t){return(0,e.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...t,children:(0,e.jsx)("path",{d:"M12 4 21 19H3z"})})}n(un,"VercelMark");function Rn(t){const l=t.replace(/\r\n/g,`
2
2
  `);if(!l.startsWith(`---
3
3
  `))return l.trim();const a=l.indexOf(`
4
4
  ---
@@ -1 +1 @@
1
- var l=Object.defineProperty;var n=(s,t)=>l(s,"name",{value:t,configurable:!0});import{i as o}from"./rolldown-runtime-ZpX3ckPj.js";import{Ia as c}from"./agent-avatar-url-B91C7fqh.js";import{ct as i,i as u}from"./BreadcrumbContext-BRKP7-bF.js";var e=o(c(),1);function b({icon:s,title:t,message:m,description:r,action:a,onAction:x,hideActionIcon:d=!1}){return(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,e.jsx)("div",{className:"bg-muted/50 p-4 mb-4",children:(0,e.jsx)(s,{className:"h-10 w-10 text-muted-foreground/50"})}),t?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:"text-base font-semibold text-foreground mb-1.5",children:t}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground mb-4 max-w-md",children:m})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground mb-1",children:m}),r&&(0,e.jsx)("p",{className:"max-w-md text-sm text-muted-foreground mb-4",children:r})]}),a&&x&&(0,e.jsxs)(u,{onClick:x,children:[!d&&(0,e.jsx)(i,{className:"h-4 w-4 mr-1.5"}),a]})]})}n(b,"EmptyState");export{b as t};
1
+ var l=Object.defineProperty;var n=(s,t)=>l(s,"name",{value:t,configurable:!0});import{i as o}from"./rolldown-runtime-ZpX3ckPj.js";import{Ia as c}from"./agent-avatar-url-eBzFMwFS.js";import{ct as i,i as u}from"./BreadcrumbContext-C-JqFdLZ.js";var e=o(c(),1);function b({icon:s,title:t,message:m,description:r,action:a,onAction:x,hideActionIcon:d=!1}){return(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,e.jsx)("div",{className:"bg-muted/50 p-4 mb-4",children:(0,e.jsx)(s,{className:"h-10 w-10 text-muted-foreground/50"})}),t?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:"text-base font-semibold text-foreground mb-1.5",children:t}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground mb-4 max-w-md",children:m})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground mb-1",children:m}),r&&(0,e.jsx)("p",{className:"max-w-md text-sm text-muted-foreground mb-4",children:r})]}),a&&x&&(0,e.jsxs)(u,{onClick:x,children:[!d&&(0,e.jsx)(i,{className:"h-4 w-4 mr-1.5"}),a]})]})}n(b,"EmptyState");export{b as t};