PageSourceSearch

https://mydailyread.ai/assets/save-BhBHvvno.js

js mydailyread.ai collected 2026-10-02 01:12:11 UTC 3,368 bytes, 1 lines download raw bytes

1import{j as o,i as g,r as i,s as x,L as h}from"./index-BA5ELD1M.js";import{u as y}from"./useEntitlement-CRKMOiis.js";import{P as w}from"./PaywallGate-9iW--Bn5.js";import"./useQuery-W8mduZl1.js";import"./useServerFn-CRWTr4th.js";import"./payments.functions-RWrWjTUK.js";const b=new Set(["youtube.com","youtu.be","vimeo.com","twitch.tv","tiktok.com","instagram.com","spotify.com","soundcloud.com","podcasts.apple.com","twitter.com","x.com","threads.net","bsky.app","mastodon.social","linkedin.com","facebook.com","github.com","gitlab.com","bitbucket.org","codesandbox.io","codepen.io","stackblitz.com","npmjs.com","pypi.org","dribbble.com","behance.net","figma.com","framer.com","producthunt.com","amazon.com","amazon.co.uk","amazon.de","ebay.com","etsy.com","shopify.com","notion.so","docs.google.com","drive.google.com","dropbox.com","are.na","pinterest.com","google.com","maps.google.com","goodreads.com","imdb.com","letterboxd.com"]);function k(r){const e=r.toLowerCase().replace(/^www\./,""),t=e.split(".");return t.length<=2?e:t[t.length-1].length===2?t.slice(-3).join("."):t.slice(-2).join(".")}function j(r){let e;try{e=new URL(r)}catch{return"summary"}const t=e.hostname.toLowerCase().replace(/^www\./,""),s=k(e.hostname);return e.pathname.toLowerCase().endsWith(".pdf")||s==="reddit.com"||t.endsWith("redd.it")||t==="news.ycombinator.com"&&e.pathname.startsWith("/item")||b.has(t)||b.has(s)?"bookmark":"summary"}function v(){const{url:r,title:e,source:t,close:s}=g.useSearch(),{data:m}=y(),l=m?.source==="grace",[n,a]=i.useState("idle"),[d,c]=i.useState("");return i.useEffect(()=>{if(!r){a("error"),c("No URL provided.");return}if(l){a("blocked"),c("Your team access ended — saving is paused until you continue on a personal plan.");return}let u=!1;return(async()=>{a("saving");const{data:p}=await x.auth.getUser();if(!p.user)return;const{error:f}=await x.from("saved_links").insert({user_id:p.user.id,url:r,title:e??null,source:t??"chrome-extension",kind:j(r)});u||(f?(a("error"),c(f.message)):(a("done"),c("Saved to your daily read."),setTimeout(()=>window.close(),s==="1"?0:1200)))})(),()=>{u=!0}},[r,e,t,l,s]),o.jsx("main",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:o.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card p-8 text-center shadow-[var(--shadow-card)]",children:[o.jsx("h1",{className:"font-serif text-2xl font-semibold",children:n==="done"?"Saved":n==="blocked"?"Read-only mode":n==="error"?"Couldn't save":"Saving…"}),e&&o.jsx("p",{className:"mt-3 truncate text-sm text-muted-foreground",title:e,children:e}),r&&o.jsx("p",{className:"mt-1 truncate text-xs text-muted-foreground/80",title:r,children:r}),d&&o.jsx("p",{className:`mt-4 text-sm ${n==="error"||n==="blocked"?"text-destructive":"text-primary"}`,children:d}),o.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-3 text-sm",children:[n==="blocked"&&o.jsx(h,{to:"/billing",className:"rounded-lg bg-primary px-4 py-2 text-primary-foreground",children:"Continue on a personal plan"}),o.jsx(h,{to:"/",className:"text-muted-foreground underline-offset-4 hover:underline",children:"Home"}),o.jsx("button",{onClick:()=>window.close(),className:"text-muted-foreground underline-offset-4 hover:underline",children:"Close tab"})]})]})})}const T=()=>o.jsx(w,{children:o.jsx(v,{})});export{T as component};

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.