import{_ as F}from"./BiXAZkt9.js";import{A as $}from"./CzLssp15.js";import{h as M,B as P,k as s,e as R,u as j,c as l,o as n,a as e,I as p,t as r,g as t,b as _,v as y,w as k,d as w,L as b,J as E,K as H,O as J}from"./BzhixHsn.js";import{u as K}from"./4NrzHMof.js";import{u as O}from"./G5O1m7ek.js";import{L as W}from"./B9I6JWJy.js";import"./BYr6U6oc.js";import"./CawQPbYo.js";import"./Dx78NuNM.js";import"./C56gk0qC.js";import"./BmCC6msl.js";import"./EdM3CJ8e.js";import"./D0pu0OPX.js";import"./DkVjT0nP.js";import"./BdE42Imj.js";import"./C8B8ONuC.js";import"./DlAUqK2U.js";import"./Le8goM6p.js";import"./C9XbPd6k.js";import"./CHPRih2d.js";import"./D01W4VS-.js";import"./DU0NpF9R.js";import"./BSaEE8c4.js";import"./DdeO54y7.js";import"./BmLyE0U0.js";import"./CMS48I6h.js";const q={class:"bg-background text-foreground min-h-screen"},G={class:"mx-auto max-w-3xl space-y-8 px-4 py-10"},Q={class:"space-y-4"},U={class:"space-y-2 text-center"},X={class:"text-muted-foreground text-sm tracking-wide uppercase"},Y={class:"text-2xl font-semibold"},Z={key:0,class:"border-border bg-card/40 flex flex-col gap-4 rounded-xl border p-4 md:flex-row md:items-center md:justify-between"},tt={class:"flex items-center gap-3"},et={class:"text-lg font-medium"},st={key:0,class:"text-muted-foreground text-sm"},at={class:"flex gap-2"},ot={key:0,class:"text-muted-foreground flex flex-col items-center gap-2 py-10"},nt={key:1,class:"space-y-3 text-center"},rt={class:"text-lg font-semibold"},it={class:"text-muted-foreground text-sm"},lt={key:2},ct={class:"space-y-4"},Mt=M({__name:"[id]",setup(ut){const A=P(),T=s(()=>A.params.id),{t:a}=R(),{data:C,pending:z,error:I,refresh:N}=O(()=>`/v1/share-links/${T.value}`,{lazy:!0}),o=s(()=>C.value),v=s(()=>o.value?.messages??[]),B=s(()=>o.value?.assistant??null),c=K(B),u=s(()=>c.value?.name??o.value?.assistant_name??""),f=s(()=>c.value?.description??o.value?.assistant_description??""),d=s(()=>c.value?.id??o.value?.assistant_id??null),D=s(()=>{const i=c.value;return i?{...i,avatar_url:i.avatar_url||o.value?.assistant?.avatar_url||void 0}:u.value?{name:u.value,avatar_url:o.value?.assistant?.avatar_url||void 0}:null}),m=s(()=>o.value?.conversation_title??""),h=s(()=>{const i=v.value.find(x=>x.message_type==="ASSISTANT");return i?i.content.slice(0,160):""}),L=s(()=>m.value?a("share.metaTitle",{title:m.value}):a("share.defaultTitle"));j(()=>({title:L.value,meta:h.value?[{name:"description",content:h.value}]:[]}));const S=()=>{d.value&&J(`/chatwith/${d.value}`)};return(i,x)=>{const V=F;return n(),l("div",q,[e("div",G,[e("header",Q,[e("div",U,[e("p",X,r(t(a)("share.tagline")),1),e("h1",Y,r(t(m)||t(a)("share.defaultTitle")),1)]),t(o)&&t(u)?(n(),l("div",Z,[e("div",tt,[_($,{assistant:t(D),class:"size-12"},null,8,["assistant"]),e("div",null,[e("p",et,r(t(u)),1),t(f)?(n(),l("p",st,r(t(f)),1)):p("",!0)])]),e("div",at,[t(d)?(n(),y(t(b),{key:0,size:"sm",class:"w-full md:w-auto",onClick:S},{default:k(()=>[w(r(t(a)("share.chatWithAssistant")),1)]),_:1})):p("",!0)])])):p("",!0)]),t(z)?(n(),l("section",ot,[_(t(W),{class:"h-6 w-6 animate-spin"}),e("span",null,r(t(a)("share.loading")),1)])):t(I)?(n(),l("section",nt,[e("p",rt,r(t(a)("share.notFoundTitle")),1),e("p",it,r(t(a)("share.notFoundDescription")),1),_(t(b),{variant:"outline",onClick:t(N)},{default:k(()=>[w(r(t(a)("common.retry")),1)]),_:1},8,["onClick"])])):(n(),l("section",lt,[e("div",ct,[(n(!0),l(E,null,H(t(v),g=>(n(),y(V,{key:g.id,message:g,"enable-share":!1,"enable-followups":!1,"force-completed":!0},null,8,["message"]))),128))])]))])])}}});export{Mt as default};
