import{n as e}from"./createLucideIcon-x_DqbPgA.js";import{t}from"./useQuery-qKYvnzn0.js";import{l as n}from"./chunk-UVKPFVEO-CKgCEGmW.js";import{t as r}from"./calendar-C7CTHQty.js";import{t as i}from"./external-link-CO5xDXge.js";import{t as a}from"./globe-fQH4zQ6J.js";import{t as o}from"./loader-circle-BS74HvID.js";import{t as s}from"./tag-xhy7XHlh.js";import{n as c}from"./utils-BHgrqvTr.js";var l=e();function u(){let{token:e}=n(),{data:u,isLoading:d,error:f}=t({queryKey:[`public`,e],queryFn:async()=>{let t=await fetch(`/api/v1/public/${e}`);if(!t.ok)throw Error(t.status===404?`This share link is invalid or has expired`:`Failed to load`);return t.json()},enabled:!!e});return d?(0,l.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-950`,children:(0,l.jsx)(o,{className:`w-8 h-8 animate-spin text-sky-600`})}):f||!u?(0,l.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-950 px-4`,children:(0,l.jsxs)(`div`,{className:`text-center`,children:[(0,l.jsx)(a,{className:`w-12 h-12 text-gray-300 dark:text-gray-700 mx-auto mb-3`}),(0,l.jsx)(`h1`,{className:`text-xl font-bold text-gray-900 dark:text-gray-100 mb-2`,children:`Link Not Found`}),(0,l.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:f?.message||`This share link is invalid or has expired`})]})}):(0,l.jsxs)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-gray-950`,children:[(0,l.jsx)(`header`,{className:`border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900`,children:(0,l.jsxs)(`div`,{className:`max-w-3xl mx-auto px-4 py-4 flex items-center gap-2`,children:[(0,l.jsx)(a,{className:`w-5 h-5 text-sky-600`}),(0,l.jsx)(`span`,{className:`font-bold text-sky-600`,children:`4D`}),(0,l.jsx)(`span`,{className:`font-semibold text-gray-800 dark:text-gray-100`,children:`Pocket`}),(0,l.jsxs)(`span`,{className:`text-xs text-gray-400 ml-2`,children:[`Shared by `,u.owner_display_name]})]})}),(0,l.jsxs)(`main`,{className:`max-w-3xl mx-auto px-4 py-8`,children:[(0,l.jsx)(`h1`,{className:`text-2xl md:text-3xl font-bold text-gray-900 dark:text-gray-100 mb-4`,children:u.title}),(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm text-gray-500 dark:text-gray-400 mb-6`,children:[(0,l.jsx)(`span`,{className:`inline-flex items-center gap-1 bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded-lg text-xs`,children:u.source_platform}),u.url&&(0,l.jsxs)(`a`,{href:u.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-sky-600 hover:underline`,children:[(0,l.jsx)(i,{className:`w-3.5 h-3.5`}),(0,l.jsx)(`span`,{children:`Original`})]}),(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,l.jsx)(r,{className:`w-3.5 h-3.5`}),c(u.created_at)]})]}),u.tags?.length>0&&(0,l.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-6`,children:u.tags.map(e=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1 bg-sky-50 dark:bg-sky-900/20 text-sky-700 dark:text-sky-400 px-2 py-1 rounded-lg text-xs`,children:[(0,l.jsx)(s,{className:`w-3 h-3`}),e]},e))}),u.summary&&(0,l.jsx)(`div`,{className:`bg-sky-50 dark:bg-sky-900/20 rounded-xl p-4 mb-6`,children:(0,l.jsx)(`p`,{className:`text-sm text-sky-800 dark:text-sky-300`,children:u.summary})}),u.description&&(0,l.jsx)(`p`,{className:`text-gray-600 dark:text-gray-300 mb-6`,children:u.description}),u.content&&(0,l.jsx)(`div`,{className:`prose dark:prose-invert max-w-none text-gray-800 dark:text-gray-200 whitespace-pre-wrap`,children:u.content})]}),(0,l.jsx)(`footer`,{className:`border-t border-gray-200 dark:border-gray-800 py-6 mt-12`,children:(0,l.jsxs)(`div`,{className:`max-w-3xl mx-auto px-4 text-center text-xs text-gray-400`,children:[`Shared via `,(0,l.jsx)(`span`,{className:`font-semibold text-sky-600`,children:`4DPocket`}),` - AI-powered personal knowledge base`]})})]})}export{u as default};