import{_ as M}from"./BjGx28ax.js";import{A as P}from"./6was1jXH.js";import{h as R,B as j,k as s,e as E,f as H,u as J,c as l,o as n,a as e,I as _,t as i,g as t,b as v,v as w,w as A,d as b,L as T,J as K,K as O,O as W}from"./dgvVcRbD.js";import{u as q}from"./uuASzBh0.js";import{u as G}from"./BtWIKuWo.js";import{L as Q}from"./BnobUxhI.js";import"./BrAY5X9P.js";import"./DLwfb9rl.js";import"./8lporG8B.js";import"./PjxHOgst.js";import"./PBSS8bwl.js";import"./DjY5_9nl.js";import"./BesS-_33.js";import"./k_JGKJJP.js";import"./D8ey85JT.js";import"./ClvrI8Td.js";import"./DlAUqK2U.js";import"./C1qmphIB.js";import"./Dc4I8EvL.js";import"./BngqlKF6.js";import"./BWdbJVRO.js";import"./BULhecZF.js";import"./DXS-54NY.js";import"./Bsc0CIfh.js";import"./Bw0uuBPj.js";import"./XTzszJDu.js";const U={class:"bg-background text-foreground min-h-screen"},X={class:"mx-auto max-w-3xl space-y-8 px-4 py-10"},Y={class:"space-y-4"},Z={class:"space-y-2 text-center"},tt={class:"text-muted-foreground text-sm tracking-wide uppercase"},et={class:"text-2xl font-semibold"},st={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"},at={class:"flex items-center gap-3"},ot={class:"text-lg font-medium"},nt={key:0,class:"text-muted-foreground text-sm"},it={class:"flex gap-2"},rt={key:0,class:"text-muted-foreground flex flex-col items-center gap-2 py-10"},lt={key:1,class:"space-y-3 text-center"},ct={class:"text-lg font-semibold"},ut={class:"text-muted-foreground text-sm"},dt={key:2},mt={class:"space-y-4"},jt=R({__name:"[id]",async setup(pt){let c,f;const C=j(),I=s(()=>C.params.id),{t:a}=E(),{data:N,pending:z,error:B,refresh:D}=([c,f]=H(()=>G(()=>`/v1/share-links/${I.value}`)),c=await c,f(),c),o=s(()=>N.value),h=s(()=>o.value?.messages??[]),L=s(()=>o.value?.assistant??null),u=q(L),d=s(()=>u.value?.name??o.value?.assistant_name??""),x=s(()=>u.value?.description??o.value?.assistant_description??""),m=s(()=>u.value?.id??o.value?.assistant_id??null),S=s(()=>{const r=u.value;return r?{...r,avatar_url:r.avatar_url||o.value?.assistant?.avatar_url||void 0}:d.value?{name:d.value,avatar_url:o.value?.assistant?.avatar_url||void 0}:null}),p=s(()=>o.value?.conversation_title??""),g=s(()=>{const r=h.value.find(y=>y.message_type==="ASSISTANT");return r?r.content.slice(0,160):""}),V=s(()=>p.value?a("share.metaTitle",{title:p.value}):a("share.defaultTitle"));J(()=>({title:V.value,meta:g.value?[{name:"description",content:g.value}]:[]}));const F=()=>{m.value&&W(`/chatwith/${m.value}`)};return(r,y)=>{const $=M;return n(),l("div",U,[e("div",X,[e("header",Y,[e("div",Z,[e("p",tt,i(t(a)("share.tagline")),1),e("h1",et,i(t(p)||t(a)("share.defaultTitle")),1)]),t(o)&&t(d)?(n(),l("div",st,[e("div",at,[v(P,{assistant:t(S),class:"size-12"},null,8,["assistant"]),e("div",null,[e("p",ot,i(t(d)),1),t(x)?(n(),l("p",nt,i(t(x)),1)):_("",!0)])]),e("div",it,[t(m)?(n(),w(t(T),{key:0,size:"sm",class:"w-full md:w-auto",onClick:F},{default:A(()=>[b(i(t(a)("share.chatWithAssistant")),1)]),_:1})):_("",!0)])])):_("",!0)]),t(z)?(n(),l("section",rt,[v(t(Q),{class:"h-6 w-6 animate-spin"}),e("span",null,i(t(a)("share.loading")),1)])):t(B)?(n(),l("section",lt,[e("p",ct,i(t(a)("share.notFoundTitle")),1),e("p",ut,i(t(a)("share.notFoundDescription")),1),v(t(T),{variant:"outline",onClick:t(D)},{default:A(()=>[b(i(t(a)("common.retry")),1)]),_:1},8,["onClick"])])):(n(),l("section",dt,[e("div",mt,[(n(!0),l(K,null,O(t(h),k=>(n(),w($,{key:k.id,message:k,"enable-share":!1,"enable-followups":!1,"force-completed":!0},null,8,["message"]))),128))])]))])])}}});export{jt as default};
