PageSourceSearch

https://www.syraa.fun/assets/ShareableChatRoute-DPh01QzX.js

js syraa.fun collected 2026-10-07 23:54:10 UTC 7,559 bytes, 1 lines download raw bytes

1import{j as e}from"./remotion-D54tqFOj.js";import{x as m}from"./vendor-charts-CXpta1tX.js";import{pr as y,p4 as S,gu as k,d5 as C,cq as U,a7 as p,cm as v,bw as A,hi as I,ef as L,al as M,il as O,pn as R,by as E}from"./index-O9bDP4Mv.js";import{M as b}from"./message-square-CcCFMNJh.js";function T(s){return{id:s.id,role:s.role,content:s.content,timestamp:typeof s.timestamp=="string"?new Date(s.timestamp):s.timestamp,toolUsage:s.toolUsage,toolUsages:s.toolUsages,...s.inlineUi?{inlineUi:s.inlineUi}:{},...s.inlineUiDismissed?{inlineUiDismissed:!0}:{},...s.swapActionsHidden?{swapActionsHidden:!0}:{},...s.swapInlineStatus?{swapInlineStatus:s.swapInlineStatus}:{},...O(s)}}function B({preloadedStatus:s,preloadedChat:x,preloadedErrorMessage:u=""}={}){var g;const{shareId:d}=y(),{anonymousId:i}=S(),[t,r]=m.useState(s??"loading"),[l,j]=m.useState(x??null),[h,o]=m.useState(u);if(m.useEffect(()=>{if(s!==void 0){r(s),j(x??null),o(u??"");return}if(!(d!=null&&d.trim())){r("notfound");return}let c=!1;return r("loading"),k.getByShareId(d.trim(),i??void 0).then(a=>{var n;c||(a.success&&a.chat?(j(a.chat),r("public")):"private"in a&&a.private?(r("private"),o(a.message??a.error??"This chat is private.")):"error"in a?(r((n=a.error)!=null&&n.toLowerCase().includes("not found")?"notfound":"error"),o(a.error??"Something went wrong.")):r("notfound"))}).catch(()=>{c||(r("error"),o("Failed to load this chat."))}),()=>{c=!0}},[d,i,s,x,u]),t==="loading")return e.jsx(C,{label:"Loading shared chat...",sublabel:"Just a moment",variant:"page"});if(t==="private")return e.jsxs("div",{className:"min-h-dvh flex flex-col bg-background overscroll-none",children:[e.jsxs("div",{className:"fixed inset-0 pointer-events-none overflow-hidden","aria-hidden":!0,children:[e.jsx("div",{className:"absolute top-1/4 left-1/4 w-[400px] h-[400px] rounded-full bg-primary/8 blur-[100px]"}),e.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-[300px] h-[300px] rounded-full bg-accent/6 blur-[80px]"})]}),e.jsx("div",{className:"relative flex flex-1 flex-col items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md flex flex-col items-center text-center",children:[e.jsxs("div",{className:"relative mb-6",children:[e.jsx("div",{className:"absolute inset-0 rounded-2xl bg-muted/50 blur-xl scale-150"}),e.jsx("div",{className:"relative flex h-24 w-24 items-center justify-center rounded-2xl border border-border/60 bg-card/80 shadow-xl backdrop-blur-sm",children:e.jsx(U,{className:"h-12 w-12 text-muted-foreground",strokeWidth:1.5})})]}),e.jsx("h1",{className:"text-2xl sm:text-3xl font-semibold text-foreground mb-2 tracking-tight",children:"This chat is private"}),e.jsx("p",{className:"text-muted-foreground text-base leading-relaxed max-w-sm mb-8",children:h}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full sm:w-auto",children:[e.jsx(p,{asChild:!0,variant:"default",className:"gap-2",children:e.jsxs(v,{to:"/",children:[e.jsx(A,{className:"h-4 w-4"}),"Back to Syra"]})}),e.jsx(p,{asChild:!0,variant:"outline",className:"gap-2 border-border/60",children:e.jsxs(v,{to:"/agent",children:[e.jsx(b,{className:"h-4 w-4"}),"Start your own chat"]})})]}),e.jsx("p",{className:"mt-8 text-xs text-muted-foreground/80",children:"Only the owner can view this conversation. If you have the link, they may have set it to private."})]})})]});if(t==="notfound"||t==="error")return e.jsx("div",{className:"min-h-dvh flex flex-col items-center justify-center bg-background px-4 py-8 pb-[max(2rem,env(safe-area-inset-bottom))]",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 text-center max-w-sm",children:[e.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-xl bg-muted",children:e.jsx(b,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("h1",{className:"text-xl font-semibold text-foreground",children:t==="notfound"?"Chat not found":"Something went wrong"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t==="notfound"?"This link may be invalid or the chat may have been deleted.":h}),e.jsx(p,{asChild:!0,children:e.jsx(v,{to:"/agent",children:"Go to Syra Agent"})})]})});const f=((l==null?void 0:l.messages)??[]).map(T),w=((g=I[0])==null?void 0:g.name)??"Syra";return e.jsxs("div",{className:"min-h-dvh flex flex-col bg-background overscroll-none",children:[e.jsxs("header",{className:"shrink-0 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between sm:gap-2 px-3 sm:px-4 py-3 border-b border-border bg-background/80 backdrop-blur-xl pt-[max(0.75rem,env(safe-area-inset-top))] pl-[max(0.75rem,env(safe-area-inset-left))] pr-[max(0.75rem,env(safe-area-inset-right))]",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl overflow-hidden bg-card",children:e.jsx("img",{src:"/logo.jpg",alt:"Syra",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h1",{className:"font-semibold text-foreground truncate",children:(l==null?void 0:l.title)??"Shared chat"}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:"Read-only · Shared with you"})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full sm:w-auto 
1sm:flex-shrink-0",children:[e.jsx(p,{asChild:!0,variant:"default",size:"sm",className:"gap-1.5 w-full sm:w-auto touch-manipulation min-h-[44px] sm:min-h-9",children:e.jsxs(v,{to:"/agent",children:[e.jsx(b,{className:"h-4 w-4"}),"New Chat"]})}),e.jsx(p,{asChild:!0,variant:"outline",size:"sm",className:"w-full sm:w-auto touch-manipulation min-h-[44px] sm:min-h-9",children:e.jsx(v,{to:"/agent",children:"Open in Syra"})})]})]}),e.jsx(L,{className:"flex-1 min-h-0 min-w-0",children:e.jsx("div",{className:"max-w-3xl mx-auto px-3 sm:px-4 py-4 sm:py-6 pb-[max(1.5rem,env(safe-area-inset-bottom))] w-full min-w-0",children:f.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx(b,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This chat has no messages yet."})]}):e.jsx("div",{className:"divide-y divide-border/50",children:f.map(c=>e.jsx(M,{message:c,agentName:w,onRegenerate:void 0,isRegenerateDisabled:!0,pumpfunCreateFormReadOnly:!0},c.id))})})})]})}function z(){var w,g;const{shareId:s}=y(),x=R(),{ready:u,anonymousId:d}=S(),[i,t]=m.useState("loading"),[r,l]=m.useState(null),[j,h]=m.useState(""),o=(w=x.state)==null?void 0:w.chat,f=(g=x.state)==null?void 0:g.fromOwner;return m.useEffect(()=>{if(!(s!=null&&s.trim())){t("notfound");return}const c=s.trim();if(f&&o&&o.id){l(o),t("owner");return}if(!u){t("loading");return}let a=!1;return t("loading"),k.getByShareId(c,d??void 0).then(n=>{var N;a||(n.success&&n.chat?(l(n.chat),t(n.isOwner?"owner":"shared")):"private"in n&&n.private?(t("private"),h(n.message??n.error??"This chat is private.")):"error"in n?(t((N=n.error)!=null&&N.toLowerCase().includes("not found")?"notfound":"error"),h(n.error??"Something went wrong.")):t("notfound"))}).catch(()=>{a||(t("error"),h("Failed to load this chat."))}),()=>{a=!0}},[s,u,d,f,o==null?void 0:o.id]),i==="loading"?e.jsx(C,{label:"Loading",sublabel:"Just a moment",variant:"page"}):i==="owner"&&r?e.jsx(E,{initialChatId:r.id,initialChat:r}):i==="shared"||i==="private"||i==="notfound"||i==="error"?e.jsx(B,{preloadedStatus:i==="shared"?"public":i,preloadedChat:i==="shared"?r??void 0:void 0,preloadedErrorMessage:j}):null}export{z as default};

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.