PageSourceSearch

https://tube-digest-ivory.vercel.app/_next/static/immutable/chunks/1q5_40n37ts5-.js

js tube-digest-ivory.vercel.app collected 2026-10-03 07:54:51 UTC 27,715 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,254338,e=>{"use strict";let t,r;var s=e.i(745332),a=e.i(869518),n=e.i(333518),o=e.i(442852),i=e.i(537511),l=e.i(812878),d=e.i(519455),c=e.i(793479),u=e.i(346090),m=e.i(107471);function h({session:e,onSignOut:t}){let[r,a]=(0,o.useState)(""),[n,i]=(0,o.useState)(""),[l,f]=(0,o.useState)("sign-in"),[p,x]=(0,o.useState)(!1),[g,b]=(0,o.useState)(""),v=async e=>{e.preventDefault(),b(""),x(!0);try{if("sign-in"===l){let{error:e}=await m.supabase.auth.signInWithPassword({email:r,password:n});if(e)throw e;b("Signed in.")}else{let{error:e}=await m.supabase.auth.signUp({email:r,password:n});if(e)throw e;b("Account created. Check your inbox if email confirmation is on.")}}catch(e){b(e instanceof Error?e.message:"Authentication failed")}finally{x(!1)}},w=async()=>{await m.supabase.auth.signOut(),(0,u.syncAccessTokenCookie)(null),t?.()};return e?(0,s.jsxs)("div",{className:"flex items-center gap-3 py-1",children:[(0,s.jsx)("span",{className:"text-sm text-muted-foreground truncate",children:e.user.email}),(0,s.jsx)("button",{type:"button",onClick:w,className:"text-xs text-muted-foreground hover:text-foreground transition-colors shrink-0 focus-ring rounded-sm",children:"Sign out"})]}):(0,s.jsx)("div",{className:"border-t border-border pt-4",children:(0,s.jsxs)("form",{onSubmit:v,className:"space-y-3",children:[(0,s.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Want to keep this digest? ",(0,s.jsx)("span",{className:"text-foreground font-medium",children:"Sign in"})]}),(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,s.jsx)("label",{htmlFor:"authEmail",className:"sr-only",children:"Email address"}),(0,s.jsx)(c.Input,{id:"authEmail",name:"email",type:"email",autoComplete:"email",spellCheck:!1,placeholder:"[email protected]",value:r,onChange:e=>a(e.target.value),required:!0,className:"flex-1"}),(0,s.jsx)("label",{htmlFor:"authPassword",className:"sr-only",children:"Password"}),(0,s.jsx)(c.Input,{id:"authPassword",name:"password",type:"password",autoComplete:"sign-in"===l?"current-password":"new-password",placeholder:"Password…",value:n,onChange:e=>i(e.target.value),required:!0,className:"flex-1"}),(0,s.jsx)(d.Button,{type:"submit",size:"sm",disabled:p,"aria-busy":p,className:"sm:w-auto w-full shrink-0",children:p?"sign-in"===l?"Signing in…":"Creating…":"sign-in"===l?"Sign in":"Create account"})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors focus-ring rounded-sm",onClick:()=>f(e=>"sign-in"===e?"sign-up":"sign-in"),children:"sign-in"===l?"Need an account?":"Have an account?"}),g&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground","aria-live":"polite",children:g})]})]})})}var f=e.i(294237),p=e.i(975157);let x=(0,f.cva)("flex flex-col rounded-lg text-card-foreground transition-colors duration-100",{variants:{variant:{default:"bg-card border border-border",glass:"bg-card border border-border",elevated:"bg-card border border-border shadow-sm",outline:"bg-transparent border border-border",ghost:"bg-transparent border-0 shadow-none"},interactive:{true:"cursor-pointer hover:bg-accent active:bg-accent/80",false:""}},defaultVariants:{variant:"default",interactive:!1}});function g({className:e,variant:t,interactive:r,...a}){return(0,s.jsx)("div",{"data-slot":"card",className:(0,p.cn)(x({variant:t,interactive:r}),e),...a})}var b=e.i(685149);function v({videoUrl:e,onVideoUrlChange:t,summaryFormat:r,onFormatChange:a,isProcessing:n,isAuthenticated:i,onSubmit:l,inputRef:u,elapsedSeconds:m=0,isPro:h=!1}){let f=(0,o.useRef)(null);return(0,s.jsx)(g,{className:"p-4 sm:p-5",children:(0,s.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)("label",{htmlFor:"videoUrl",className:"block text-sm font-medium text-foreground",children:"YouTube URL"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(c.Input,{ref:u||f,id:"videoUrl",name:"videoUrl",type:"url",inputMode:"url",autoComplete:"off",placeholder:"https://youtube.com/watch?v=…",value:e,onCh
1ange:e=>t(e.target.value),disabled:n,className:"pr-14 font-mono text-[13px] sm:text-sm","aria-label":"YouTube video URL"}),(0,s.jsxs)("kbd",{className:"absolute right-3 top-1/2 -translate-y-1/2 hidden sm:inline-flex h-5 items-center gap-0.5 rounded-sm border border-border bg-muted px-1.5 font-mono text-[10px] text-muted-foreground",children:[(0,s.jsx)("span",{className:"text-[10px]",children:"⌘"}),"K"]})]})]}),(0,s.jsxs)("fieldset",{className:"space-y-1.5",children:[(0,s.jsx)("legend",{className:"block text-sm font-medium text-foreground",children:"Digest format"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:b.FORMAT_OPTIONS.map(e=>{let t=!h&&"detailed"!==e.value,o=r===e.value;return(0,s.jsxs)("button",{type:"button",onClick:()=>!t&&a(e.value),disabled:n||t,"aria-pressed":o,"aria-disabled":t,"aria-label":t?`${e.label} (Pro)`:e.label,title:t?`${e.label} requires Pro`:e.description,className:`px-2.5 py-1 rounded-md text-xs transition-colors focus-ring ${t?"bg-muted text-muted-foreground/50 cursor-not-allowed":o?"bg-foreground text-background":"bg-muted text-muted-foreground hover:text-foreground"}`,children:[e.label,t&&(0,s.jsx)("svg",{"aria-hidden":"true",className:"inline-block size-2.5 ml-1 -mt-px",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})]},e.value)})})]}),(0,s.jsx)(d.Button,{type:"submit",disabled:n||!e,size:"default",className:"w-full","aria-busy":n,children:n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("svg",{className:"animate-spin size-4",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),m>=50?"Almost there…":m>=30?"Long video — still working…":m>=10?`Reading the tape… ${m}s`:"Digesting…"]}):i?"Digest this video":"Digest free — no account needed"}),!i&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground text-center leading-relaxed",children:"One free digest, no signup. Create an account to keep it, search your library, and build mind maps."})]})})}let w=new Set,y=new WeakMap,j=new WeakMap,N=new WeakMap,k=new WeakMap,C=new WeakMap,S=new WeakMap,T=new WeakMap,E=new WeakMap,M=new WeakSet,W=0,A=0,L="__aa_tgt",R="__aa_del",z="__aa_new",F=e=>{var r;let s=!(r=e).reduce((e,t)=>[...e,...Array.from(t.addedNodes),...Array.from(t.removedNodes)],[]).every(e=>"#comment"===e.nodeName)&&r.reduce((e,t)=>{if(!1===e)return!1;if(t.target instanceof Element){if($(t.target),!e.has(t.target)){e.add(t.target);for(let r=0;r<t.target.children.length;r++){let s=t.target.children.item(r);if(s){if(R in s)return!1;$(t.target,s),e.add(s)}}}if(t.removedNodes.length)for(let r=0;r<t.removedNodes.length;r++){let s=t.removedNodes[r];if(R in s)return!1;s instanceof Element&&(e.add(s),$(t.target,s),j.set(s,[t.previousSibling,t.nextSibling]))}}return e},new Set);s&&s.forEach(e=>{var r,s,a;let n,o;return n=(r=e).isConnected,o=y.has(r),void(n&&j.has(r)&&j.delete(r),(null==(s=N.get(r))?void 0:s.playState)!=="finished"&&(null==(a=N.get(r))||a.cancel()),z in r?J(r):o&&n?function(e){let t,r=y.get(e),s=D(e);if(!K(e))return y.set(e,s);if(O(e)){y.set(e,s),B(e);return}if(!r)return;let a=q(e);if("function"!=typeof a){let n=r.left-s.left,o=r.top-s.top,i=r.left+r.
1width-(s.left+s.width);0==r.top+r.height-(s.top+s.height)&&(o=0),0==i&&(n=0);let[l,d,c,u]=Y(e,r,s),m={transform:`translate(${n}px, ${o}px)`},h={transform:"translate(0, 0)"};l!==d&&(m.width=`${l}px`,h.width=`${d}px`),c!==u&&(m.height=`${c}px`,h.height=`${u}px`),t=e.animate([m,h],{duration:a.duration,easing:a.easing})}else{let[n]=Q(a(e,"remain",r,s));(t=new Animation(n)).play()}N.set(e,t),y.set(e,s),t.addEventListener("finish",P.bind(null,e,!1),{once:!0})}(r):o&&!n?function(e){var r;let s;if(!j.has(e)||!y.has(e))return;let[a,n]=j.get(e);Object.defineProperty(e,R,{value:!0,configurable:!0});let o=window.scrollX,i=window.scrollY;if(n&&n.parentNode&&n.parentNode instanceof Element?n.parentNode.insertBefore(e,n):a&&a.parentNode?a.parentNode.appendChild(e):null==(r=V(e))||r.appendChild(e),!K(e))return Z(e);let[l,d,c,u]=function(e){var t;let r=y.get(e),[s,,a]=Y(e,r,D(e)),n=e.parentElement;for(;n&&("static"===getComputedStyle(n).position||n instanceof HTMLBodyElement);)n=n.parentElement;n||(n=document.body);let o=getComputedStyle(n),i=N.has(e)&&(null==(t=N.get(e))?void 0:t.playState)!=="finished"?y.get(n):D(n);return[Math.round(r.top-i.top)-H(o.borderTopWidth),Math.round(r.left-i.left)-H(o.borderLeftWidth),s,a]}(e),m=q(e),h=y.get(e);(o!==W||i!==A)&&function(e,r,s,a){let n=W-r,o=A-s,i=document.documentElement.style.scrollBehavior;if("smooth"===getComputedStyle(t).scrollBehavior&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+n,window.scrollY+o),!e.parentElement)return;let l=e.parentElement,d=l.clientHeight,c=l.clientWidth,u=performance.now();!function e(){requestAnimationFrame(()=>{if(!G(a)){let t=d-l.clientHeight,r=c-l.clientWidth;u+a.duration>performance.now()?(window.scrollTo({left:window.scrollX-r,top:window.scrollY-t}),d=l.clientHeight,c=l.clientWidth,e()):document.documentElement.style.scrollBehavior=i}})}()}(e,o,i,m);let f={position:"absolute",top:`${l}px`,left:`${d}px`,width:`${c}px`,height:`${u}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(G(m)){let[t,r]=Q(m(e,"remove",h));(null==r?void 0:r.styleReset)!==!1&&(f=(null==r?void 0:r.styleReset)||f,Object.assign(e.style,f)),(s=new Animation(t)).play()}else Object.assign(e.style,f),s=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}
1],{duration:m.duration,easing:"ease-out"});N.set(e,s),s.addEventListener("finish",()=>Z(e,f),{once:!0})}(r):J(r))})};function O(e){let r=e.getBoundingClientRect(),s=(null==t?void 0:t.clientWidth)||0,a=(null==t?void 0:t.clientHeight)||0;return r.bottom<0||r.top>a||r.right<0||r.left>s}function B(e){let r=k.get(e);null==r||r.disconnect();let s=y.get(e),a=0;s||(s=D(e),y.set(e,s));let{offsetWidth:n,offsetHeight:o}=t,i=[s.top-5,n-(s.left+5+s.width),o-(s.top+5+s.height),s.left-5].map(e=>`${-1*Math.floor(e)}px`).join(" "),l=new IntersectionObserver(()=>{++a>1&&P(e)},{root:t,threshold:1,rootMargin:i});l.observe(e),k.set(e,l)}function P(e,t=!0){clearTimeout(E.get(e));let r=q(e),s=t?G(r)?500:r.duration:0;E.set(e,setTimeout(async()=>{let t=N.get(e);try{await (null==t?void 0:t.finished),y.set(e,D(e)),B(e)}catch{}},s))}function _(e){setTimeout(()=>{S.set(e,setInterval(()=>I(P.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function I(e){"function"==typeof requestIdleCallback?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let U="u">typeof window&&"ResizeObserver"in window;function $(e,t){t||L in e?!t||L in t||Object.defineProperty(t,L,{value:e}):Object.defineProperty(e,L,{value:e})}function H(e){return Number(e.replace(/[^0-9.\-]/g,""))}function D(e){let t=e.getBoundingClientRect(),{x:r,y:s}=function(e){let t=e.parentElement;for(;t;){if(t.scrollLeft||t.scrollTop)return{x:t.scrollLeft,y:t.scrollTop};t=t.parentElement}return{x:0,y:0}}(e);return{top:t.top+s,left:t.left+r,width:t.width,height:t.height}}function Y(e,t,r){let s=t.width,a=t.height,n=r.width,o=r.height,i=getComputedStyle(e);if("content-box"===i.getPropertyValue("box-sizing")){let e=H(i.paddingTop)+H(i.paddingBottom)+H(i.borderTopWidth)+H(i.borderBottomWidth),t=H(i.paddingLeft)+H(i.paddingRight)+H(i.borderRightWidth)+H(i.borderLeftWidth);s-=t,n-=t,a-=e,o-=e}return[s,n,a,o].map(Math.round)}function q(e){return L in e&&T.has(e[L])?T.get(e[L]):{duration:250,easing:"ease-in-out"}}function V(e){if(L in e)return e[L]}function K(e){let t=V(e);return!!t&&M.has(t)}function X(e,...t){t.forEach(t=>t(e,T.has(e)));for(let r=0;r<e.children.length;r++){let s=e.children.item(r);s&&t.forEach(e=>e(s,T.has(s)))}}function Q(e){return Array.isArray(e)?e:[e]}function G(e){return"function"==typeof e}function J(e){let t;z in e&&delete e[z];let r=D(e);y.set(e,r);let s=q(e);if(K(e)){if(O(e))return void B(e);if("function"!=typeof s)t=e.animate([{transform:"scale(.98)",opacity:0}
1,{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:1.5*s.duration,easing:"ease-in"});else{let[a]=Q(s(e,"add",r));(t=new Animation(a)).play()}N.set(e,t),t.addEventListener("finish",P.bind(null,e,!1),{once:!0})}}function Z(e,t){var r;e.remove(),y.delete(e),j.delete(e),N.delete(e),null==(r=k.get(e))||r.disconnect(),setTimeout(()=>{if(R in e&&delete e[R],Object.defineProperty(e,z,{value:!0,configurable:!0}),t&&e instanceof HTMLElement)for(let r in t)e.style[r]=""},0)}U&&(t=document.documentElement,new MutationObserver(F),r=new ResizeObserver(e=>{e.forEach(e=>{e.target===t&&(clearTimeout(E.get(t)),E.set(t,setTimeout(()=>{w.forEach(e=>X(e,e=>I(()=>P(e))))},100))),y.has(e.target)&&P(e.target)})}),window.addEventListener("scroll",()=>{A=window.scrollY,W=window.scrollX}),r.observe(t));var ee=e.i(165239);function et({className:e,...t}){return(0,s.jsx)("div",{"data-slot":"skeleton",className:(0,p.cn)("animate-pulse rounded-md bg-muted",e),...t})}function er(){return(0,s.jsxs)(g,{className:"p-3 h-full",children:[(0,s.jsx)(et,{className:"w-full aspect-video rounded-md mb-2"}),(0,s.jsx)(et,{className:"h-4 w-3/4 mb-1"}),(0,s.jsx)(et,{className:"h-3 w-1/2 mb-2"}),(0,s.jsx)(et,{className:"h-3 w-full mb-1"}),(0,s.jsx)(et,{className:"h-3 w-5/6 mb-2"}),(0,s.jsxs)("div",{className:"flex gap-1 mt-auto",children:[(0,s.jsx)(et,{className:"h-5 w-14 rounded-sm"}),(0,s.jsx)(et,{className:"h-5 w-16 rounded-sm"})]})]})}function es({summaries:e,searchQuery:t,onSearchChange:n,selectedTopic:i,onClearTopic:l,onFilterByTopic:d,isSearching:u}){let[m]=function(){let[e,t]=(0,o.useState)(),s=(0,o.useMemo)(()=>void 0,[]),a=(0,o.useCallback)(e=>{e instanceof HTMLElement?t(function(e,t={}){if(U&&r&&!(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!G(t)&&!t.disrespectUserMotionPreference)){M.add(e),"static"===getComputedStyle(e).position&&Object.assign(e.style,{position:"relative"}),X(e,P,_,e=>null==r?void 0:r.observe(e)),G(t)?T.set(e,t):T.set(e,{duration:250,easing:"ease-in-out",...t});let s=new MutationObserver(F);s.observe(e,{childList:!0}),C.set(e,s),w.add(e)}return Object.freeze({parent:e,enable:()=>{M.add(e)},disable:()=>{M.delete(e),X(e,e=>{let t=N.get(e);try{null==t||t.cancel()}catch{}N.delete(e);let r=E.get(e);r&&clearTimeout(r),E.delete(e);let s=S.get(e);s&&clearInterval(s),S.delete(e)})},isEnabled:()=>M.has(e),destroy:()=>{M.delete(e),w.delete(e),T.delete(e);let t=C.get(e);null==t||t.disconnect(),C.delete(e),X(e,e=>{null==r||r.unobserve(e);let t=N.get(e);try{null==t||t.cancel()}catch{}N.delete(e);let s=k.get(e);null==s||s.disconnect(),k.delete(e);let a=S.get(e);a&&clearInterval(a),S.delete(e);let n=E.get(e);n&&clearTimeout(n),E.delete(e),y.delete(e),j.delete(e)})}})}(e,s)):t(void 0)},[s]),n=(0,o.useCallback)(t=>{e&&(t?e.enable():e.disable())},[e]);return(0,o.useEffect)(()=>()=>{var t;null==(t=null==e?void 0:e.destroy)||t.call(e)},[e]),[a,n]}();return(0,s.jsxs)("section",{className:"mt-6 desk-rule !mt-8 !pt-8",children:[(0,s.jsxs)("div",{className:"mb-4 space-y-3",children:[(0,s.jsxs)("div",{className:"relative max-w-xl",children:[(0,s.jsx)("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,s.jsx)(c.Input,{type:"search",name:"search-summaries",autoComplete:"off",placeholder:"Search digests…","aria-label":"Search digests",value:t,onChange:e=>n(e.target.value),className:"pl-9"}),u&&(0,s.jsx)("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",role:"status","aria-label":"Searching",children:(0,s.jsxs)("svg",{className:"animate-spin size-4 text-muted-foreground",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})]}),i&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:"Topic"}),(0,s.jsx)("span",{className:"font-medium text-foreground",children:i}),(0,s.jsx)("button",{type:"button",onClick:l,className:"text-muted-foreground hover:text-foreground transition-colors text-xs focus-ring rounded-sm",children:"Clear"})]})]}),u&&(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3 mb-3",children:["search-skeleton-1","search-skeleton-2","search-skeleton-3","search-skeleton-4","search-skeleton-5","search-skeleton-6"].map(e=>(0,s.jsx)(er,{},e))}),!u&&0===e.length&&t.trim()&&(0,s.jsx)("div",{className:"py-10",children:(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"No digests match that search."})}),(0,s.jsx)("div",{ref:m,className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(e=>(0,s.jsxs)(g,{className:"p-3 h-full flex flex-col",children:[(0,s.jsxs)(a.default,{href:`/summary/${e.id}`,className:"group block min-w-0 focus-ring rounded-sm",children:[e.thumbnail_url&&(0,s.jsx)("div",{className:"relative overflow-hidden rounded-md mb-2 aspect-video bg-muted",children:(0,s.jsx)(ee.default,{src:e.thumbnail_url,alt:"",fill:!0,className:"object-cover",sizes:"(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"})}),(0,s.jsx)("h3",{className:"text-sm font-medium line-clamp-2 text-foreground group-hover:text-primary transition-colors mb-1 text-pretty",children:e.title||"Untitled video"})]}),e.channel_name&&(0,s.jsxs)("p",{className:"text-xs text-muted-foreground mb-2",children:[e.channel_name,e.duration&&(0,s.jsxs)("span",{className:"ml-1.5 font-mono tabular-nums",children:["· ",Math.floor(e.duration/60),"m"]})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2 flex-1",children:e.summary_text.length>120?`${e.summary_text.slice(0,120)}…`:e.summary_text}),e.topics&&e.topics.length>0&&(0,s.jsxs)("div",{className:"flex flex-wrap gap-1 mt-auto",children:[e.topics.slice(0,3).map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>d(e.topic),className:"tag",children:e.topic},e.id)),e.topics.length>3&&(0,s.jsxs)("span",{className:"text-xs text-muted-foreground font-mono",children:["+",e.topics.length-3]})]})]},e.id))})]})}var ea=e.i(34481),en=e.i(13421);
1e.s(["HomeDashboard",0,function(){let e=(0,n.useSearchParams)(),[t,r]=(0,o.useState)(""),[c,f]=(0,o.useState)("detailed"),[p,x]=(0,o.useState)(!1),[b,w]=(0,o.useState)(""),[y,j]=(0,o.useState)(""),[N,k]=(0,o.useState)([]),[C,S]=(0,o.useState)(""),[T,E]=(0,o.useState)(!1),[M,W]=(0,o.useState)(null),[A,L]=(0,o.useState)({total:0,thisWeek:0}),[R,z]=(0,o.useState)(null),[F,O]=(0,o.useState)(!1),[B,P]=(0,o.useState)(0),[_,I]=(0,o.useState)(null),U=(0,o.useRef)(null),$=(0,o.useRef)(null),H=(0,o.useRef)(!1),D=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),U.current?.focus())};window.addEventListener("keydown",e),(async()=>{let{data:e}=await m.supabase.auth.getSession();z(e.session),(0,u.syncAccessTokenCookie)(e.session?.access_token??null),O(!0)})();let{data:{subscription:t}}=m.supabase.auth.onAuthStateChange((e,t)=>{z(t),(0,u.syncAccessTokenCookie)(t?.access_token??null)});return()=>{window.removeEventListener("keydown",e),t.unsubscribe()}},[]),(0,o.useEffect)(()=>{let t=e.get("url");t&&((0,en.extractVideoId)(t)&&(r(t),U.current?.focus()),window.history.replaceState(null,"",window.location.pathname))},[e]);let Y=(0,o.useCallback)(async()=>{if(!R)return void k([]);try{let e=await (0,u.authedFetch)("/api/summaries?limit=9");if(!e.ok){if(401===e.status)return;throw Error("Failed to fetch summaries")}let t=await e.json();t.summaries&&k(t.summaries)}catch(e){console.error("Failed to fetch recent summaries:",e)}},[R]),q=(0,o.useCallback)(async()=>{if(!R)return void L({total:0,thisWeek:0});try{let e=await (0,u.authedFetch)("/api/summaries?stats=true");if(!e.ok){if(401===e.status)return;throw Error("Failed to fetch summary stats")}let t=await e.json();t.stats&&L({total:t.stats.total??0,thisWeek:t.stats.thisWeek??0})}catch(e){console.error("Failed to fetch stats:",e)}},[R]),V=(0,o.useCallback)(async()=>{if(!R)return void I(null);try{let e=await (0,u.authedFetch)("/api/subscription");if(e.ok){let t=await e.json();I(t)}}catch{}},[R]);(0,o.useEffect)(()=>{F&&R&&(Y(),q(),V())},[F,R,Y,q,V]),(0,o.useEffect)(()=>{if(!R)return;let e=C.trim();if(!e){$.current?.abort(),$.current=null,E(!1),H.current&&!M&&Y(),H.current=!1;return}H.current=!0,E(!0);let t=new AbortController;$.current?.abort(),$.current=t;let r=globalThis.setTimeout(async()=>{try{let r=await (0,u.authedFetch)(`/api/search?q=${encodeURIComponent(e)}`,{signal:t.signal});if(!r.ok){if(401===r.status)return;throw Error("Search failed")}let s=await r.json();s.summaries&&k(s.summaries)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;console.error("Search failed:",e)}finally{$.current===t&&E(!1)}},300);return()=>{globalThis.clearTimeout(r),t.abort()}},[C,M,R,Y]);let K=async e=>{if(e.preventDefault(),t){x(!0),j(""),w(""),P(0),D.current=setInterval(()=>{P(e=>e+1)},1e3);try{let e=await (0,u.authedFetch)("/api/summarize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({videoUrl:t,format:c})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to summarize video")}let r=e.body?.getReader(),s=new TextDecoder;if(!r)throw Error("No response body");let a="";for(;;){let{done:e,value:t}=await r.read();if(e)break;let n=s.decode(t,{stream:!0});a+=n,w(a)}}catch(t){let e=t instanceof Error?t.message:"An error occurred";e.includes("timeout")||e.includes("504")||e.includes("aborted")?j("This video was too long to summarize. Try a shorter video."):j(e)}finally{D.current&&(clearInterval(D.current),D.current=null),P(0),x(!1),Y(),q(),V()}}},X=_?.plan==="pro";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("header",{className:"mb-8 sm:mb-12",children:[(0,s.jsx)("h1",{className:"font-display text-3xl sm:text-4xl font-medium tracking-tight text-pretty text-foreground mb-3",children:"TubeDigest"}),(0,s.jsx)("p",{className:"text-base text-muted-foreground mb-6 max-w-md leading-relaxed",children:"Turn long YouTube videos into notes you can search, map, and keep."}),A.total>0&&(0,s.jsxs)("div",{className:"flex items-center gap-3 text-sm text-muted-foreground mb-6",children:[(0,s.jsxs)("span",{className:"font-mono tabular-nums",children:[A.total," digests"]}),(0,s.jsx)("span",{"aria-hidden":"true",className:"text-border",children:"·"}),(0,s.jsxs)("span",{className:"font-mono tabular-nums",children:[A.thisWeek," this week"]})]}),(0,s.jsxs)("nav",{"aria-label":"Key pages",className:"flex flex-wrap items-center gap-x-4 gap-y-2 text-sm mb-8",children:[(0,s.jsx)("a",{href:"#workflow",className:"text-muted-foreground hover:text-foreground transition-colors focus-ring rounded-sm",children:"How it works"}),(0,s.jsx)("a",{href:"#faq",className:"text-muted-foreground hover:text-foreground transition-colors focus-ring rounded-sm",children:"FAQ"}),(0,s.jsx)(a.default,{href:"/about",className:"text-muted-foreground hover:text-foreground transition-colors focus-ring rounded-sm",children:"About"}),(0,s.jsx)(a.default,{href:"/contact",className:"text-muted-foreground hover:text-foreground transition-colors focus-ring rounded-sm",children:"Contact"})]})]}),(0,s.jsxs)("section",{className:"max-w-2xl mb-6",children:[(0,s.jsx)(v,{videoUrl:t,onVideoUrlChange:r,summaryFormat:c,onFormatChange:f,isProcessing:p,isAuthenticated:!!R,onSubmit:K,inputRef:U,elapsedSeconds:B,isPro:X}),R&&_&&!X&&null!==_.usage.dailyLimit&&(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(ea.UsageMeter,{used:_.usage.summariesToday,limit:_.usage.dailyLimit})})]}),(0,s.jsx)("div",{className:"max-w-2xl mb-8",children:(0,s.jsx)(h,{session:R,onSignOut:()=>{w(""),r(""),S(""),W(null),k([]),L({total:0,thisWeek:0})}})}),y&&(0,s.jsx)("div",{className:"max-w-2xl mb-4",children:(0,s.jsx)("p",{className:"text-sm text-destructive","aria-live":"assertive",children:y})}),b&&(0,s.jsx)("section",{className:"max-w-3xl mb-8",children:(0,s.jsxs)(g,{className:"p-6 sm:p-8",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-6 pb-4 border-b border-border",children:[(0,s.jsx)("h2",{className:"font-display text-lg font-medium text-foreground",children:"Digest"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground font-mono",children:"just now"})]}),(0,s.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none prose-headings:font-medium prose-headings:text-foreground prose-headings:font-display prose-h2:text-base prose-h2:mt-6 prose-h2:mb-3 prose-h3:text-sm prose-h3:mt-4 prose-p:text-muted-foreground prose-p:leading-relaxed prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-strong:text-foreground prose-code:text-foreground prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded-sm prose-code:font-normal prose-code:font-mono prose-pre:bg-muted prose-pre:border prose-pre:border-border",children:(0,s.jsx)(i.default,{remarkPlugins:[l.default],children:b})}),F&&!R&&!p&&(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-border",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-foreground mb-1",children:"This preview w
1on't be saved"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Create a free account to keep this summary, search your library, and generate mind maps."})]})]})}),!b&&!p&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-8",children:[(0,s.jsx)("span",{className:"text-xs text-muted-foreground font-mono",children:"Try a URL"}),(0,s.jsx)(d.Button,{variant:"outline",size:"sm",onClick:()=>r("https://www.youtube.com/watch?v=jNQXAC9IVRw"),children:"Me at the Zoo"}),(0,s.jsx)(d.Button,{variant:"outline",size:"sm",onClick:()=>r("https://www.youtube.com/watch?v=dQw4w9WgXcQ"),children:"Never Gonna Give You Up"})]}),0===N.length&&!T&&!b&&R&&!C.trim()&&(0,s.jsxs)("div",{className:"py-10 border-t border-border",children:[(0,s.jsx)("p",{className:"font-display text-lg font-medium text-foreground mb-1",children:"Your desk is empty"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mb-4 max-w-sm leading-relaxed",children:"Paste a YouTube URL above. The first digest lands here as a searchable note."}),(0,s.jsx)(d.Button,{variant:"outline",size:"sm",onClick:()=>U.current?.focus(),children:"Focus the URL field"})]}),N.length>0&&(0,s.jsx)(es,{summaries:N,searchQuery:C,onSearchChange:e=>{W(null),S(e)},selectedTopic:M,onClearTopic:()=>{W(null),Y()},onFilterByTopic:e=>{R&&($.current?.abort(),W(e),S(""),E(!0),(0,u.authedFetch)("/api/summaries?limit=50").then(e=>e.json()).then(t=>{t.summaries&&k(t.summaries.filter(t=>t.topics?.some(t=>t.topic===e)))}).catch(e=>console.error("Filter failed:",e)).finally(()=>E(!1)))},isSearching:T})]})}],254338)}]);

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.