PageSourceSearch

https://karpeles.com/assets/BookmarksPage-5_a-1p3i.js

js karpeles.com collected 2026-09-24 23:36:44 UTC 4,154 bytes, 1 lines download raw bytes

1import{u as v,j as o,P as j,a as g,e as C}from"./index-xbUMZdnk.js";import{a as m}from"./redux-vendor-BfV9BRyV.js";import{u as B,a as N}from"./react-vendor-ChC4-WML.js";const z="_bookmarksSection_1xzei_1",S="_importStatus_1xzei_6",w="_importError_1xzei_11",A="_emptyState_1xzei_16",I="_emptyIcon_1xzei_24",E="_emptyActions_1xzei_29",T="_secondaryButton_1xzei_37",D="_bookmarksHeader_1xzei_47",R="_bookmarksCount_1xzei_56",F="_bookmarksActions_1xzei_60",G="_shareBtn_1xzei_66",H="_clearBtn_1xzei_67",L="_bookmarksGrid_1xzei_86",M="_bookmarkCard_1xzei_92",P="_removeBtn_1xzei_107",U="_bookmarkImage_1xzei_131",$="_bookmarkContent_1xzei_137",O="_bookmarkTitle_1xzei_141",K="_bookmarkDescription_1xzei_148",t={bookmarksSection:z,importStatus:S,importError:w,emptyState:A,emptyIcon:I,emptyActions:E,secondaryButton:T,bookmarksHeader:D,bookmarksCount:R,bookmarksActions:F,shareBtn:G,clearBtn:H,bookmarksGrid:L,bookmarkCard:M,removeBtn:P,bookmarkImage:U,bookmarkContent:$,bookmarkTitle:O,bookmarkDescription:K};function W(){const s=B(),d=N(),{items:n,count:k,actions:p}=v(),[h,b]=m.useState(!1),[u,_]=m.useState(null),x=m.useMemo(()=>[...n].sort((e,r)=>!e.addedAt||!r.addedAt?0:r.addedAt.localeCompare(e.addedAt)),[n]);m.useEffect(()=>{const r=new URLSearchParams(d.search).get("shared");if(!r)return;const i=r.split("|||").map(a=>a.trim()).filter(Boolean);if(i.length===0)return;let c=!0;return(async()=>{b(!0),_(null);try{for(const a of i){const l=await g(a);if(!c)return;C({title:l.title,imageUrl:l.web_address||l.L_web_address||"",description:l.description||""})}}catch(a){if(!c)return;_(a instanceof Error?a.message:"Failed to import shared bookmarks")}finally{c&&b(!1)}})(),()=>{c=!1}},[d.search]);const y=async()=>{if(n.length===0)return;const e=n.map(i=>i.title),r=`${window.location.origin}/bookmarks?shared=${encodeURIComponent(e.join("|||"))}`;if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(r),window.alert("Favorites link copied to clipboard!");return}catch{}window.prompt("Copy this link to share your favorites:",r)},f=()=>{window.confirm("Are you sure you want to remove all favorites? This cannot be undone.")&&p.clear()};return o.jsxs("section",{className:t.bookmarksSection,children:[o.jsx("h1",{children:"My Favorites"}),h&&o.jsx("p",{className:t.importStatus,children:"Importing shared favorites..."}),u&&o.jsx("p",{className:t.importError,children:u}),k===0?o.jsxs("div",{className:t.emptyState,children:[o.jsx("div",{className:t.emptyIcon,children:"⭐"}),o.jsx("h2",{children:"No favorites yet"}),o.jsx("p",{children:"Start building your personal collection by saving manuscripts you love!"}),o.jsxs("div",{className:t.emptyActions,children:[o.jsx("button",{type:"button",className:"btn-primary",onClick:()=>s("/collection"),children:"Browse Collection"}),o.jsx("button",{type:"button",className:t.secondaryButton,onClick:()=>s("/research"),children:"Research with AI"})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:t.bookmarksHeader,children:[o.jsxs("span",{className:t.bookmarksCount,children:[k," manuscript",k!==1?"s":""," saved"]}),o.jsxs("div",{className:t.bookmarksActions,children:[o.jsx("button",{type:"button",className:t.shareBtn,onClick:y,children:"📤 Share My Favorites"}),o.jsx("button",{type:"button",className:t.clearBtn,onClick:f,children:"🗑️ Clear All"})]})]}),o.jsx("div",{className:t.bookmarksGrid,children:x.map(e=>o.jsxs("article",{className:t.bookmarkCard,role:"button",tabIndex:0,"aria-label":`Open ${e.title}`,onClick:()=>s("/research",{state:{title:e.title}}),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),s("/research",{state:{title:e.title}}))},children:[o.jsx("button",{type:"button",className:t.removeBtn,"aria-label":"Remove from favorites",onClick:r=>{r.stopPropagation(),p.remove(e.title)},children:"×"}),o.jsx("img",{loading:"lazy",decoding:"async",src:e.imageUrl||j,alt:e.title,className:t.bookmarkImage}),o.jsxs("div",{className:t.bookmarkContent,children:[o.jsx("h3",{className:t.bookmarkTitle,children:e.title}),o.jsx("p",{className:t.bookmarkDescription,children:e.description})]})]},e.title))})]})]})}export{W as BookmarksPage};

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.