1import{n as e,o as t}from"./rolldown-runtime-CMxvf4Kt.js";import{F as n,L as r}from"../vendor/vendor-data-runtime-nLFaCKB0.js";import{n as i,t as a}from"./agent-Doq2Q6Wt.js";import{Ao as o,Et as s,g as c,jo as l}from"./app-const-BzFqCjOv.js";import{A as u,Fn as d,bo as f,to as p,vo as m,wo as h}from"./ScrollArea-CdDxdn_v.js";import{Sa as g,n as _,qn as ee}from"./es-D7HWafs1.js";import{Cc as te,Fr as ne,_f as re,et as v,kg as ie,ph as y,rd as ae,y_ as b}from"../vendor/vendor-icons-BXJMWD35.js";import{Wn as x,Yn as S,a as oe,bt as se,cn as ce,n as le}from"./agent-Dh3-_0ai.js";import{n as ue,t as de}from"./agentDocument-GhemY2N0.js";import{r as fe,t as pe}from"./swr-C_leGIiU.js";import{t as me}from"./swrKeys-D98yQcag.js";import{C as he,l as ge,t as C}from"./selectors-BZArZxfP.js";import{Eo as _e,St as ve,n as ye,xt as be}from"./store-JX60g0Lu.js";import{i as xe,n as Se}from"./global-DfKpeTkj.js";import{n as Ce,t as we}from"./document-B0YnY6Mv.js";import{n as Te,r as Ee}from"./src-DYf_YQ1m.js";import{E as De,Ft as w,O as Oe,Pt as ke,T,k as Ae,lr as je,vr as Me}from"./index-Doip7UYu.js";import{n as Ne,t as Pe}from"./useWorkspaceAwareNavigate--pLVtz2A.js";var E,D,O,k,A,j,Fe,Ie=e((()=>{se(),c(),De(),E=new Set([`acceptance`,`agent`,`page`,`task`,`tasks`,`verify`]),D=new Set(Object.values(ce)),O=new Set([`_next`,`api`,`f`,`oidc`,`trpc`,`webapi`]),k=new Set([`agent`,`acceptance`,`community`,`downloads`,`eval`,`group`,`image`,`memory`,`page`,`resource`,`settings`,`task`,`tasks`,`video`,`verify`]),A=(e,t)=>{let n=e.split(`/`).filter(Boolean);return E.has(n[0])?{segments:n,workspaceSlug:void 0}:t.has(n[0])&&E.has(n[1])?{segments:n.slice(1),workspaceSlug:n[0]}:null},j=(e,t)=>{let n=new URL(s).host;if(!t)return e.host===n;try{let r=new URL(t);return r.protocol!==`http:`&&r.protocol!==`https:`?e.host===n:e.host===r.host}catch{return!1}},Fe=(e,t,n=[])=>{if(!e)return null;let r=e.startsWith(`/`)&&!e.startsWith(`//`),i;try{i=new URL(e,t||`https://app.lobehub.com`)}catch{return null}if(!r&&!j(i,t))return null;let a=A(i.pathname,new Set(n)),o=`${i.pathname}${i.search}${i.hash}`;if(!a){let e=i.pathname.split(`/`).find(Boolean);if(!e||O.has(e)||!k.has(e)&&!n.includes(e))return null;let t=n.includes(e)?e:void 0;return{pathname:o,type:`route`,...t?{workspaceSlug:t}:{}}}let{segments:s,workspaceSlug:c}=a;if(s[0]===`acceptance`&&s[1])return{acceptanceId:s[1],pathname:o,type:`acceptance`,...c?{workspaceSlug:c}:{}};if(s[0]===`page`&&s[1])return{documentId:T(s[1],`docs`),pathname:o,type:`document`,...c?{workspaceSlug:c}:{}};if(s[0]===`task`&&s[1])return{pathname:o,taskId:s[1],type:`task`,...c?{workspaceSlug:c}:{}};if(s[0]===`verify`&&s[1])return{pathname:o,runId:s[1],type:`verify`,...c?{workspaceSlug:c}:{}};if(s[0]===`agent`&&s[1]){if(D.has(s[1]))return{pathname:o,type:`route`};let e=s[1];if(s[2]===`docs`&&s[3])return{agentId:e,documentId:T(s[3],`docs`),pathname:o,type:`document`,...c?{workspaceSlug:c}:{}};if(s[2]===`task`&&s[3])return{agentId:e,pathname:o,taskId:s[3],type:`task`,...c?{workspaceSlug:c}:{}};if(s.length===2)return{agentId:e,pathname:o,type:`agent`,...c?{workspaceSlug:c}:{}}}return{pathname:o,type:`route`,...c?{workspaceSlug:c}:{}}}})),M,N,P,Le=e((()=>{v(),M=t(l()),N=t(o()),P=(0,M.memo)(({domain:e,size:t=15})=>{let[n,r]=(0,M.useState)(!1);return n?(0,N.jsx)(ae,{size:t}):(0,N.jsx)(`img`,{alt:``,height:t,src:`https://icons.duckduckgo.com/ip3/${e}.ico`,style:{borderRadius:3,objectFit:`contain`},width:t,onError:()=>r(!0)})}),P.displayName=`FaviconIcon`})),F,I,L,R,z,B,Re=e((()=>{_(),f(),v(),F=t(l()),n(),pe(),i(),Ce(),be(),ke(),I=t(o()),L=h(({css:e,cssVar:t})=>({content:e` 2 width: 320px; 3 padding: 16px; 4 `,description:e` 5 overflow: hidden; 6 display: -webkit-box; 7 -webkit-box-orient: vertical; 8 -webkit-line-clamp: 3; 9 10 line-height: 1.55; 11 color: ${t.colorTextSecondary}; 12 `,icon:e` 13 display: grid; 14 flex: none; 15 place-items: center; 16 17 width: 36px; 18 height: 36px; 19 border-radius: ${t.borderRadiusLG}; 20 21 color: ${t.colorTextSecondary}; 22 23 background: ${t.colorFillTertiary}; 24 `,title:e` 25 overflow: hidden; 26 27 font-weight: 600; 28 line-height: 1.4; 29 text-overflow: ellipsis; 30 white-space: nowrap; 31 `,type:e` 32 font-size: 12px; 33 color: ${t.colorTextTertiary}; 34 `})),R=(e,t)=>{switch(e){case`delivered`:return t(`internalLink.preview.verifyStatus.delivered`);case`errored`:return t(`internalLink.preview.verifyStatus.errored`);case`failed`:return t(`internalLink.preview.verifyStatus.failed`);case`passed`:return t(`internalLink.preview.verifyStatus.passed`);case`planned`:return t(`internalLink.preview.verifyStatus.planned`);case`repairing`:return t(`internalLink.preview.verifyStatus.repairing`);case`uncertain`:return t(`internalLink.preview.verifyStatus.uncertain`);case`unverified`:return t(`internalLink.preview.verifyStatus.unverified`);case`verifying`:return t(`internalLink.preview.verifyStatus.verifying`);default:return null}},z=async(e,t)=>{switch(e.type){case`acceptance`:{let n=await w.getAcceptanceBundle(e.acceptanceId);if(!n)return null;let r=n.checks.filter(e=>e.state===`passed`).length,i=n.checks.filter(e=>e.state===`failed`||e.state===`uncertain`).length;return{description:n.acceptance.requirement||n.latestReport?.summary,meta:t(`internalLink.preview.acceptanceCounts`,{exceptions:i,passed:r,total:n.checks.length}),secondaryMeta:t(`internalLink.preview.acceptanceRounds`,{count:n.rounds.length}),title:n.subject.title||n.subject.id}}case`agent`:return a.getAgentConfigById(e.agentId);case`document`:{let t=await we.getDocumentById(e.documentId);return t?{description:t.content,title:t.title||t.filename}:null}case`task`:{let t=(await ve.getDetail(e.taskId)).data;return t?{description:t.description||t.instruction,title:t.name||t.identifier}:null}case`verify`:{let n=await w.getReportBundle(e.runId);if(!n)return null;let{report:r,run:i}=n,a=r?.verdict??i.status,o=r?t(`internalLink.preview.verifyCounts`,{failed:r.failedChecks??0,passed:r.passedChecks??0,uncertain:r.uncertainChecks??0}
34):null,s=(i.scenario??`coding`)===`coding`?i.context:null,c=i.context?.testedAt,l=[s?.branch,s?.commit?.slice(0,10),c?new Date(c).toLocaleString():null].filter(Boolean);return{description:r?.summary,meta:[R(a,t),o].filter(Boolean).join(` · `),secondaryMeta:l.join(` · `),title:i.title}}case`route`:return null}},B=(0,F.memo)(({children:e,fallbackTitle:t,reference:n})=>{let{t:i}=r(`chat`),[a,o]=(0,F.useState)(!1),{data:s,isLoading:c}=fe(a?[`internal-entity-preview`,n.type,n.pathname]:null,()=>z(n,i),{revalidateOnFocus:!1}),l=n.type===`acceptance`?b:n.type===`agent`?ie:n.type===`task`?ne:n.type===`verify`?y:re,f=i(`internalLink.preview.${n.type}`);return(0,I.jsx)(u,{content:c?(0,I.jsx)(`div`,{className:L.content,children:(0,I.jsx)(ee,{active:!0,avatar:!0,paragraph:{rows:2}})}):(0,I.jsxs)(m,{className:L.content,gap:12,children:[(0,I.jsxs)(m,{horizontal:!0,align:`center`,gap:12,children:[n.type===`agent`&&s?.avatar?(0,I.jsx)(g,{avatar:s.avatar,background:s.backgroundColor??void 0,shape:`square`,size:36}):(0,I.jsx)(`span`,{className:L.icon,children:(0,I.jsx)(p,{icon:l,size:19})}),(0,I.jsxs)(m,{flex:1,gap:2,style:{minWidth:0},children:[(0,I.jsx)(`span`,{className:L.type,children:f}),(0,I.jsx)(`span`,{className:L.title,children:s?.title||t})]})]}),s?.description&&(0,I.jsx)(d,{className:L.description,fontSize:13,children:s.description}),s?.meta&&(0,I.jsx)(d,{fontSize:12,type:`secondary`,children:s.meta}),s?.secondaryMeta&&(0,I.jsx)(d,{fontSize:12,type:`secondary`,children:s.secondaryMeta})]}),mouseEnterDelay:.35,open:a,placement:`top`,styles:{content:{borderRadius:12,overflow:`hidden`,padding:0}},trigger:`hover`,triggerProps:{role:`link`},onOpenChange:o,children:e})}),B.displayName=`InternalEntityPreview`})),V,H,U,ze,W,Be=e((()=>{c(),Ee(),_(),f(),v(),V=t(l()),Pe(),pe(),ue(),le(),_e(),Re(),H=t(o()),U=h(({css:e,cssVar:t})=>({link:e` 35 display: inline-flex; 36 gap: 4px; 37 align-items: center; 38 39 color: ${t.colorText} !important; 40 text-decoration-color: ${t.colorBorder}; 41 text-decoration-line: underline; 42 text-decoration-thickness: 1px; 43 text-underline-offset: 3px; 44 45 transition: 46 color 0.15s, 47 text-decoration-color 0.15s; 48 49 &:hover { 50 color: ${t.colorText} !important; 51 text-decoration-color: ${t.colorTextSecondary}; 52 } 53 54 &:focus-visible { 55 border-radius: 2px; 56 outline: 2px solid ${t.colorPrimaryBorder}; 57 outline-offset: 2px; 58 } 59 60 > svg { 61 flex: none; 62 color: ${t.colorTextSecondary}; 63 } 64 `})),ze={acceptance:b,agent:ie,document:re,task:ne,verify:y},W=(0,V.memo)(({href:e,label:t,reference:n})=>{let r=Ne(),i=oe(e=>e.activeAgentId),[a,o,s,c,l]=ye(e=>[e.openAcceptance,e.openAgentDetail,e.openDocument,e.openTaskDetail,e.openVerifyReport]),u=n.type===`document`?n.agentId:void 0,d=!!u&&u===i,{data:f,mutate:m}=fe(d?me.documentsList(u):null,()=>de.listDocuments({agentId:u})),h=(0,V.useCallback)(async e=>{if(!(e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)){if(e.preventDefault(),`workspaceSlug`in n&&n.workspaceSlug&&n.type!==`verify`&&n.type!==`acceptance`){r(n.pathname,{escape:!0});return}if(n.type===`document`&&n.agentId&&n.agentId!==i){r(n.pathname,{escape:!0});return}switch(n.type){case`acceptance`:a(n.acceptanceId);break;case`agent`:o(n.agentId);break;case`document`:{let e=(d?f??await m().catch(()=>void 0):void 0)?.find(e=>e.documentId===n.documentId)?.id;s(n.documentId,e);break}case`task`:c(n.taskId);break;case`verify`:l(n.runId);break;case`route`:r(n.pathname);break}}},[i,f,r,a,o,s,c,l,n,m,d]),g=n.type===`route`?void 0:ze[n.type],_=(0,H.jsxs)(`a`,{[Te]:`true`,className:U.link,href:e,rel:`noopener noreferrer`,target:`_blank`,onClick:h,children:[g&&(0,H.jsx)(p,{icon:g,size:14}),t]});return n.type===`route`||n.workspaceSlug?_:(0,H.jsx)(B,{fallbackTitle:t,reference:n,children:_})}),W.displayName=`InternalEntityLink`})),Ve,G,K,He=e((()=>{Ve=t(l()),G=t(o()),K=(0,Ve.memo)(({size:e=`1em`})=>(0,G.jsx)(`svg`,{fill:`currentColor`,height:e,role:`img`,viewBox:`0 0 24 24`,width:e,xmlns:`http://www.w3.org/2000/svg`,children:(0,G.jsx)(`path`,{d:`M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z`})})),K.displayName=`LinearIcon`})),q,J,Y,X,Ue=e((()=>{c(),_(),f(),v(),q=t(l()),n(),Se(),x(),C(),J=t(o()),Y=h(({css:e,cssVar:t})=>({chip:e` 65 color: ${t.colorLink}; 66 text-decoration: none; 67 transition: color 0.15s; 68 69 &:hover { 70 color: ${t.colorLinkHover}; 71 } 72 `,icon:e` 73 display: inline-flex; 74 margin-inline-end: 4px; 75 vertical-align: -0.15em; 76 `,sideBrowser:e` 77 pointer-events: none; 78 opacity: 0; 79 transition: opacity 0.15s; 80 `,wrapper:e` 81 display: inline-flex; 82 gap: 2px; 83 align-items: center; 84 85 &:hover [data-side-browser], 86 &:focus-within [data-side-browser] { 87 pointer-events: auto; 88 opacity: 1; 89 } 90 `})),X=(0,q.memo)(({href:e,icon:t,label:n})=>{let{t:i}=r(`chat`),a=xe(e=>e.openInBrowserTab);return S(he.enableInAppBrowser),(0,q.useCallback)(t=>{t.preventDefault(),a(e)},[e,a]),(0,J.jsxs)(`a`,{className:Y.chip,href:e,rel:`noopener noreferrer`,target:`_blank`,children:[t&&(0,J.jsx)(`span`,{className:Y.icon,children:t}),n]})}),X.displayName=`LinkChip`})),We,Z,Q,$,Ge=e((()=>{je(),v(),We=t(l()),Oe(),x(),C(),Ie(),Le(),Be(),He(),Ue(),Z=t(o()),Q=15,$=(0,We.memo)(({node:e})=>{let{linkHref:t,linkKind:n,linkLabel:r,linkDomain:i}=e?.properties||{},a=S(ge.enableMessageLinkIcon),o=Ae(),s=r||t||``,c=Fe(t,typeof window>`u`?void 0:window.location.origin,o.map(e=>e.slug));return t&&c?(0,Z.jsx)(W,{href:t,label:s,reference:c}):a?n===`github`?(0,Z.jsx)(X,{href:t,icon:(0,Z.jsx)(Me,{size:Q}),label:s}):n===`linear`?(0,Z.jsx)(X,{href:t,icon:(0,Z.jsx)(K,{size:Q}),label:s}):n===`email`?(0,Z.jsx)(X,{href:t,icon:(0,Z.jsx)(te,{size:Q}),label:s}):(0,Z.jsx)(X,{href:t,icon:(0,Z.jsx)(P,{domain:i||``,size:Q}),label:s}):(0,Z.jsx)(X,{href:t,label:s})}
90),$.displayName=`LobeLinkRender`}));export{Ge as n,$ as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.