1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1218],{4329:(e,t,a)=>{a.d(t,{Rv:()=>u,S9:()=>r,bD:()=>i,cj:()=>c,eE:()=>o,fB:()=>n,ir:()=>s,w3:()=>l,wf:()=>d});let r={free:1,pro:-1},i={title:"Organize your learning journey",description:"Sign in to group flashcards by topic, course, or project. Free users get one collection to start.",button:"Sign In"},n={message:"Loading collections..."},s={count:e=>"".concat(e," collection").concat(1!==e?"s":""),freeLimit:(e,t)=>"".concat(e,"/").concat(t," Free"),createButton:"Create Collection"},o={title:"Ready to Organize",description:"Group related flashcards into collections. Perfect for courses, projects, or topics you want to master.",button:"Create Collection"},l={cardCount:e=>"".concat(e," card").concat(1!==e?"s":""),editTooltip:"Edit collection",deleteTooltip:"Delete collection",addFlashcards:"Add Flashcards",practice:"Practice"},c={title:"Delete Collection?",message:e=>'Are you sure you want to delete "'.concat(e,'"? This will remove all flashcards from this collection.'),confirmText:"Delete",cancelText:"Cancel"},d={createTitle:"Create Collection",editTitle:"Edit Collection",fields:{name:{label:"Name *",placeholder:"e.g., JavaScript Fundamentals"},description:{label:"Description",placeholder:"Optional description (max 135 chars)",charCount:(e,t)=>"".concat(e,"/").concat(t," characters")},color:{label:"Color"}},buttons:{cancel:"Cancel",save:"Save",saving:"Saving..."}},u={loadError:"Failed to load collections",createSuccess:"Collection created",updateSuccess:"Collection updated",deleteSuccess:"Collection deleted",nameRequired:"Collection name is required",freeLimitReached:"You've used your free collection! Upgrade to Pro to organize unlimited topics.",upgradeButton:"Upgrade"}},4981:(e,t,a)=>{a.d(t,{$_:()=>r,Kk:()=>n,Mw:()=>o,Ts:()=>s,Yg:()=>i});let r={gotIt:"Got it",almost:"Almost",reviewAgain:"Review Again"},i={easy:{label:"Basic",stars:1},medium:{label:"Intermediate",stars:2},hard:{label:"Advanced",stars:3}},n={new:"New",learning:"Learning",reviewing:"Reviewing",mastered:"Mastered"},s={emoji:"\uD83C\uDF89",title:"All caught up!",description:"You've reviewed all your due flashcards. Great work! We'll remind you when it's time to review again.",buttons:{reviewAnyway:"Review Anyway",tagMore:"Watch & Learn More"}},o={title:"Ready to remember what you watch?",description:"Watch a podcast or tutorial, tag the moments that matter, and TAGiT creates flashcards to help you remember.",button:"Start Watching"}},9616:(e,t,a)=>{a.d(t,{Ew:()=>r,sD:()=>n,uC:()=>s,xn:()=>i});let r={message:"Searching your content..."},i={title:"Your knowledge awaits",description:"Every insight you've saved is searchable. Start typing to find exactly what you need.",categories:[{id:"tags",title:"Tags",description:"Summaries & transcripts"},{id:"sessions",title:"Sessions",description:"Video titles & channels"},{id:"flashcards",title:"Flashcards",description:"Questions & answers"},{id:"timestamps",title:"Timestamps",description:"Find exact moments"}]},n={title:e=>'Nothing yet for "'.concat(e,'".'),description:"Try different keywords or tag more videos to build your library.",suggestions:{title:"Try:",items:["Check your spelling","Use different keywords","Search for broader terms","Clear filters to search all content","Use quotes for exact phrases"]}},s={title:"Couldn't search right now",description:"This happens sometimes. Try again in a moment.",retryButton:"Try Again"}},10190:(e,t,a)=>{a.d(t,{ad:()=>D,qY:()=>E,in:()=>F});var r=a(95155),i=a(12115),n=a(21891),s=a(69317),o=a(50233),l=a(71919);let c=(0,l.h)("useHighlights"),d=new Map,u=null,h=null,g=new Map,m=new Map;function p(e,t,a){return"".concat(e,":").concat(t,":").concat(a||"")}async function f(e,t){var a,r;if(0===t.length)return{};let i=d.get(e);if(i)return c.debug("[fetchBatchHighlights] Waiting for existing batch for ".concat(e)),i;let n=Date.now(),s=t.filter(t=>{let a=p(e,t),r=g.get(a);return!m.get(a)&&(!r||n-r.timestamp>=3e5)});if(0===s.length){let r={};for(let i of t){let t=p(e,i),n=m.get(t);n?r[i]=await n:r[i]=(null==(a=g.get(t))?void 0:a.highlights)||[]}return r}let o=[];for(let e=0;e<s.length;e+=50)o.push(s.slice(e,e+50));c.debug("[fetchBatchHighlights] Fetching ".concat(s.length," items in ").concat(o.length," batch(es)"));let l=new Map;for(let t of s){let a=p(e,t),r=new Promise((e,a)=>{l.set(t,{resolve:e,reject:a})});m.set(a,r)}try{let a=o.map(async t=>{var a;let r=await fetch("/api/highlights/batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contentType:e,contentIds:t})});return r.ok?(null==(a=(await r.json()).data)?void 0:a.highlights)||{}:(c.error("[fetchBatchHighlights] Batch fetch failed:",r.status),{})}),i=await Promise.all(a),n={};for(let t of i)for(let[a,r]of Object.entries(t)){let t=p(e,a);n[a]=r,g.set(t,{highlights:r,timestamp:Date.now()})}for(let t of s)if(!n[t]){let a=p(e,t);n[t]=[],g.set(a,{highlights:[],timestamp:Date.now()})}for(let t of s){let a=p(e,t),r=l.get(t);r&&r.resolve(n[t]||[]),m.delete(a)}let d={};for(let a of t){let t=p(e,a);d[a]=(null==(r=g.get(t))?void 0:r.highlights)||[]}return c.debug("[fetchBatchHighlights] Completed fetching highlights for ".concat(s.length," items")),d}catch(t){for(let a of(c.error("[fetchBatchHighlights] Error:",t),s)){let r=p(e,a),i=l.get(a);i&&i.reject(t instanceof Error?t:Error("Batch fetch failed")),m.delete(r)}return{}}}var b=a(87110);let x=(0,l.h)("useTextSelection");function v(e,t,a){let r=0,i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n=i.nextNode();for(;n;){var s;if(n===t)return r+a;r+=(null==(s=n.textContent)?void 0:s.length)||0,n=i.nextNode()}return r}function y(e){let t="",a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),r=a.nextNode();for(;r;)t+=r.textContent||"",r=a.nextNode();return t}function w(e,t){let a=e;for(;a;){if(a===t)return!0;a=a.parentNode}return!1}var T=a(58436),k=a(47650),j=a(24186),N=a(34256);function C(e){let{highlight:t,position:a,isPro:n,colorLabels:s,onUpdateColor:o,onUp
1dateNote:l,onDelete:c,onClose:d,onLabelChange:u}=e,h=(0,i.useRef)(null),g=(0,i.useRef)(null),[m,p]=(0,i.useState)(!1),[f,x]=(0,i.useState)(t.note||""),[v,y]=(0,i.useState)(null);(0,i.useEffect)(()=>{if(!a)return;let e=window.innerWidth,t=window.innerHeight,r=a.y+10,i=a.x-140;i<10&&(i=10),i+280>e-10&&(i=e-280-10),r+200>t-10&&(r=a.y-200-10),y({top:r,left:i})},[a]),(0,i.useEffect)(()=>{let e=e=>{var t;let a=e.target;!(!a||h.current&&h.current.contains(a))&&(null!=(t=a.closest)&&t.call(a,'[data-confirmation-modal="true"]')||w())},t=setTimeout(()=>{document.addEventListener("mousedown",e),document.addEventListener("touchend",e,{passive:!0})},150);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e),document.removeEventListener("touchend",e)}},[]),(0,i.useEffect)(()=>{let e=e=>{"Escape"===e.key&&w()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),(0,i.useEffect)(()=>{m&&g.current&&g.current.focus()},[m]);let w=(0,i.useCallback)(()=>{m&&f!==(t.note||"")&&l(f||null),d()},[m,f,t.note,l,d]),C=(0,i.useCallback)(()=>{l(f||null),p(!1)},[f,l]),S=(0,i.useCallback)(()=>{c()},[c]);if(!v)return null;let A=j.QO[t.color],E=b.KV-f.length,P=e=>{e.stopPropagation()},O=(0,r.jsxs)("div",{ref:h,className:(0,N.cn)("fixed z-50 w-72 rounded-lg shadow-xl","bg-white border border-gray-200","animate-in fade-in zoom-in-95 duration-150"),style:{top:v.top,left:v.left},role:"dialog","aria-label":"Highlight options",onClick:P,onTouchStart:P,onTouchEnd:P,children:[(0,r.jsx)("div",{className:"h-1.5 rounded-t-lg",style:{backgroundColor:A.bg}}),(0,r.jsxs)("div",{className:"p-3 space-y-3",children:[(0,r.jsxs)("div",{className:"text-sm text-gray-600 line-clamp-2 italic",children:['"',t.highlightedText,'"']}),(0,r.jsx)("div",{className:"space-y-1.5",children:m?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("textarea",{ref:g,value:f,onChange:e=>x(e.target.value),placeholder:j.gV.placeholder,rows:j.gV.rows,maxLength:b.KV,className:(0,N.cn)("w-full px-2 py-1.5 text-sm rounded border border-gray-200","focus:outline-none focus:ring-1 focus:ring-purple-500 focus:border-purple-500","resize-none")}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("span",{className:(0,N.cn)("text-xs",E<20?"text-red-500":"text-gray-400"),children:[E," remaining"]}),(0,r.jsx)("button",{onClick:C,className:"text-xs text-purple-600 hover:text-purple-700 font-medium",children:"Save"})]})]}):(0,r.jsx)("button",{onClick:()=>p(!0),className:(0,N.cn)("w-full text-left text-sm px-2 py-1.5 rounded","hover:bg-gray-50 transition-colors",t.note?"text-gray-700":"text-gray-400 italic"),children:t.note||"Add a note..."})}),(0,r.jsx)("div",{className:"pt-2 border-t border-gray-100",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-xs text-gray-500",children:"Color"}),(0,r.jsx)(T.o,{selectedColor:t.color,isPro:n,colorLabels:s,onSelectColor:o,onLabelChange:u,size:"sm"})]})}),t.isOrphaned&&(0,r.jsx)("div",{className:"p-2 bg-yellow-50 border border-yellow-200 rounded text-xs text-yellow-700",children:"This highlight may have moved due to text changes."}),(0,r.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-gray-100",children:[(0,r.jsx)("button",{onClick:w,className:"text-xs text-gray-500 hover:text-gray-700",children:"Close"}),(0,r.jsx)("button",{onClick:S,className:"text-xs text-red-500 hover:text-red-600",children:"Delete"})]})]})]});return"undefined"!=typeof document?(0,k.createPortal)(O,document.body):null}function S(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n").replace(/^[-*+]\s+/gm,"").replace(/^\d+\.\s+/gm,"").replace(/[ \t]+/g," ").split("\n").map(e=>e.trim()).filter(e=>e.length>0).join("\n").trim()}var A=a(53759);function E(e){let{contentType:t,contentId:l,videoId:f,fieldName:k,fieldIndex:j,text:E,className:P,disabled:O=!1,hideHighlights:I=!1,plainText:D=!1,onHighlightCreate:L,onHighlightDelete:F}=e,[G,M]=(0,i.useState)(null),z=(0,i.useRef)(null),H=(0,i.useCallback)(e=>{z.current=e,M(e)},[]),[R,Y]=(0,i.useState)(null),[_,W]=(0,i.useState)(null),{highlights:U,isLoading:q,isPro:B,colorLabels:V,createHighlight:K,updateHighlight:Q,deleteHighlight:J,updateColorLabel:$,undoLastAction:X,
1canUndo:Z}=function(e){let{contentType:t,contentId:a,videoId:r,autoLoad:n=!0,optimistic:s=!0}=e,[l,f]=(0,i.useState)([]),[b,x]=(0,i.useState)({}),[v,y]=(0,i.useState)(n),[w,T]=(0,i.useState)(null),[k,j]=(0,i.useState)(!1),[N,C]=(0,i.useState)([]),S=(0,i.useRef)([]),A=(0,i.useRef)([]);A.current=l;let E=(0,i.useCallback)(e=>{x(e.reduce((e,t)=>{let a=null!==t.fieldIndex?"".concat(t.fieldName,"[").concat(t.fieldIndex,"]"):t.fieldName;return e[a]||(e[a]=[]),e[a].push(t),e},{}))},[]),P=(0,i.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=p(t,a,r);try{e||(y(!0),T(null));let n=Date.now(),s=g.get(i);if(s&&n-s.timestamp<3e5){f(s.highlights),E(s.highlights),await O();return}let o=m.get(i);if(o){let e=await o;f(e),E(e),await O();return}let l=d.get(t);if(l){c.debug("[useHighlights] Waiting for pending batch for ".concat(t,"/").concat(a));let e=(await l)[a]||[];f(e),E(e),await O();return}let u=(async()=>{try{var e,n;let s="/api/highlights/content/".concat(t,"/").concat(a);r&&(s+="?videoId=".concat(encodeURIComponent(r)));let o=await fetch(s);if(!o.ok){let e=await o.json().catch(()=>({}));throw Error((null==(n=e.error)?void 0:n.message)||"Failed to fetch highlights")}let l=(null==(e=(await o.json()).data)?void 0:e.highlights)||[];return g.set(i,{highlights:l,timestamp:Date.now()}),l}finally{m.delete(i)}})();m.set(i,u);let h=await u;f(h),E(h),await O()}catch(t){T(t instanceof Error?t:Error("Unknown error")),c.error("[useHighlights] Error loading highlights:",t),e||o.v.error("Failed to load highlights")}finally{e||y(!1)}},[t,a,r,E]),O=(0,i.useCallback)(async()=>{try{let e=Date.now();if(u&&e-u.timestamp<6e4){j(u.isPro),C(u.labels);return}if(h){let e=await h;e&&(j(e.isPro),C(e.labels));return}h=(async()=>{try{let a=await fetch("/api/highlights/color-labels");if(a.ok){var e,t;let r=await a.json(),i={isPro:(null==(e=r.data)?void 0:e.isPro)||!1,labels:(null==(t=r.data)?void 0:t.labels)||[],timestamp:Date.now()};return u=i,i}return null}finally{h=null}})();let t=await h;t&&(j(t.isPro),C(t.labels))}catch(e){c.warn("[useHighlights] Failed to load color labels:",e)}},[]),I=(0,i.useCallback)(e=>{S.current=[e,...S.current.slice(0,9)]},[]),D=(0,i.useCallback)(e=>{let i=p(t,a,r),n=g.get(i);n&&g.set(i,{highlights:e(n.highlights),timestamp:Date.now()})},[t,a,r]),L=(0,i.useCallback)(async e=>{var i,n,l,d;let u={...e,contentType:t,contentId:a,...r&&{videoId:r}},h="temp-".concat(Date.now()),g={id:h,userId:"",contentType:t,contentId:a,videoId:r||null,fieldName:e.fieldName,fieldIndex:null!=(i=e.fieldIndex)?i:null,startOffset:e.startOffset,endOffset:e.endOffset,highlightedText:e.highlightedText,surroundingContext:e.surroundingContext||null,color:e.color||"purple",note:e.note||null,isOrphaned:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};s&&f(e=>{let t=[...e,g];return E(t),t});try{let e=await fetch("/api/highlights",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u),credentials:"include"});if(!e.ok){let t=await e.json().catch(()=>({}));return 403===e.status?o.v.error((null==(l=t.error)?void 0:l.message)||"This feature requires Pro subscription"):400===e.status?o.v.error((null==(d=t.error)?void 0:d.message)||"Invalid highlight data"):o.v.error("Failed to create highlight"),s&&f(e=>{let t=e.filter(e=>e.id!==h);return E(t),t}),null}let t=null==(n=(await e.json()).data)?void 0:n.highlight;return f(e=>{let a=e.map(e=>e.id===h?t:e);return E(a),a}),D(e=>[...e.filter(e=>e.id!==h),t]),I({type:"create",highlightId:t.id,newData:u}),t}catch(e){return c.error("[useHighlights] Error creating highlight:",e),o.v.error("Failed to create highlight"),s&&f(e=>{let t=e.filter(e=>e.id!==h);return E(t),t}),null}},[t,a,r,s,E,I,D]),F=(0,i.useCallback)(async(e,t)=>{let a=A.current.find(t=>t.id===e);if(!a)return o.v.error("Highlight not found"),null;let r={...a,...void 0!==t.color&&{color:t.color},...void 0!==t.note&&{note:t.note},...void 0!==t.isOrphaned&&{isOrphaned:t.isOrphaned},updatedAt:new Date().toISOString()};s&&f(t=>{let a=t.map(t=>t.id===e?r:t);return E(a),a});try{var i,n;let r=await fetch("/api/highlights/".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),credentials:"include"});if(!r.ok){let t=await r.json().catch(()=>({}));return 403===r.status?o.v.error((null==(n=t.error)?void 0:n.message)||"This feature requires Pro subscription"):o.v.error("Failed to update highlight"),s&&f(t=>{let r=t.map(t=>
1t.id===e?a:t);return E(r),r}),null}let l=null==(i=(await r.json()).data)?void 0:i.highlight;return f(t=>{let a=t.map(t=>t.id===e?l:t);return E(a),a}),D(t=>t.map(t=>t.id===e?l:t)),I({type:"update",highlightId:e,previousData:a}),l}catch(t){return c.error("[useHighlights] Error updating highlight:",t),o.v.error("Failed to update highlight"),s&&f(t=>{let r=t.map(t=>t.id===e?a:t);return E(r),r}),null}},[s,E,I,D]),G=(0,i.useCallback)(async e=>{let t=A.current.find(t=>t.id===e);if(!t)return o.v.error("Highlight not found"),!1;s&&(f(t=>{let a=t.filter(t=>t.id!==e);return E(a),a}),D(t=>t.filter(t=>t.id!==e)));try{if(!(await fetch("/api/highlights/".concat(e),{method:"DELETE",credentials:"include"})).ok)return o.v.error("Failed to delete highlight"),s&&(f(e=>{let a=[...e,t];return E(a),a}),D(e=>[...e,t])),!1;return I({type:"delete",highlightId:e,previousData:t}),!0}catch(e){return c.error("[useHighlights] Error deleting highlight:",e),o.v.error("Failed to delete highlight"),s&&(f(e=>{let a=[...e,t];return E(a),a}),D(e=>[...e,t])),!1}},[s,E,I,D]),M=(0,i.useCallback)(async(e,t)=>{var a,r;let i=await fetch("/api/highlights/color-labels",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({color:e,label:t}),credentials:"include"});if(!i.ok)throw Error((null==(r=(await i.json().catch(()=>({}))).error)?void 0:r.message)||"Failed to save label");let n=null==(a=(await i.json()).data)?void 0:a.label;C(t=>t.find(t=>t.color===e)?t.map(t=>t.color===e?n:t):[...t,n]),u=null},[]),z=(0,i.useCallback)(async()=>{let e=S.current[0];if(!e)return!1;try{switch(e.type){case"create":if(!(await fetch("/api/highlights/".concat(e.highlightId),{method:"DELETE",credentials:"include"})).ok)return o.v.error("Failed to undo highlight creation"),!1;f(t=>{let a=t.filter(t=>t.id!==e.highlightId);return E(a),a}),D(t=>t.filter(t=>t.id!==e.highlightId));break;case"update":if(e.previousData){let{color:t,note:a}=e.previousData;if(!(await fetch("/api/highlights/".concat(e.highlightId),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({color:t,note:a}),credentials:"include"})).ok)return o.v.error("Failed to undo highlight update"),!1;f(t=>{let a=t.map(t=>t.id===e.highlightId?e.previousData:t);return E(a),a}),D(t=>t.map(t=>t.id===e.highlightId?e.previousData:t))}break;case"delete":if(e.previousData){var t;let{contentType:a,contentId:r,videoId:i,fieldName:n,fieldIndex:s,startOffset:l,endOffset:c,highlightedText:d,surroundingContext:u,color:h,note:g}=e.previousData,m=await fetch("/api/highlights",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contentType:a,contentId:r,videoId:i,fieldName:n,fieldIndex:s,startOffset:l,endOffset:c,highlightedText:d,surroundingContext:u,color:h,note:g}),credentials:"include"});if(!m.ok)return o.v.error("Failed to restore highlight"),!1;let p=null==(t=(await m.json()).data)?void 0:t.highlight;if(!p)return o.v.error("Failed to restore highlight"),!1;f(e=>{let t=[...e,p];return E(t),t}),D(e=>[...e,p])}}return S.current=S.current.slice(1),o.v.success("Action undone"),!0}catch(e){return c.error("[useHighlights] Undo failed:",e),o.v.error("Failed to undo action"),!1}},[E,D]),H=S.current.length>0,R=(0,i.useRef)(!1);return(0,i.useEffect)(()=>{n&&a&&!R.current&&(R.current=!0,P())},[n,a]),(0,i.useEffect)(()=>{R.current=!1},[a]),{highlights:l,highlightsByField:b,isLoading:v,error:w,isPro:k,colorLabels:N,loadHighlights:P,createHighlight:L,updateHighlight:F,deleteHighlight:G,updateColorLabel:M,und
1oLastAction:z,canUndo:H}}({contentType:t,contentId:l,videoId:f,autoLoad:!0}),ee=(0,i.useMemo)(()=>U.filter(e=>{let t=e.fieldName===k,a=void 0===j?null===e.fieldIndex:e.fieldIndex===j;return t&&a}),[U,k,j]),et=(0,i.useMemo)(()=>I||0===ee.length?E:function(e,t){if(!t.length)return e;let a=[];for(let i of t){var r;let t=function(e,t,a,r){let i=function(e,t){let a=[],r=0;for(;r<e.length;){let i=e.indexOf(t,r);if(-1===i)break;a.push(i),r=i+1}return a}(e,t);if(0===i.length){let a=function(e,t){let a=S(e),r=S(t);if(!r)return null;let i=a.indexOf(r);if(-1===i)return null;let n=0,s=0,o=t=>{let a=e.slice(t).match(/^([-*+]\s+|\d+\.\s+)/);return a&&(0===t||"\n"===e[t-1])?{match:!0,length:a[1].length}:{match:!1,length:0}},l=t=>{for(;n<e.length&&s<t;){let t=o(n);if(t.match){n+=t.length;continue}let r=e[n];if("\r"===r){n++;continue}if(" "===r||" "===r){for(;n<e.length&&(" "===e[n]||" "===e[n]);)n++;s<a.length&&" "===a[s]&&s++;continue}n++,s++}return n},c=l(i),d=o(c);return d.match&&(c+=d.length,n=c),{startOffset:c,endOffset:l(i+r.length)}}(e,t);return a?{startOffset:a.startOffset,endOffset:a.endOffset,confident:!0}:null}if(1===i.length)return{startOffset:i[0],endOffset:i[0]+t.length,confident:!0};let n=function(e){if(!e)return null;let t=e.match(/^(.*?)\[.*?\](.*)$/);return t?{before:t[1],after:t[2]}:null}(a);if(n){let a=i.map(a=>({position:a,score:function(e,t,a,r){let i=e.slice(Math.max(0,t-r.before.length),t),n=e.slice(t+a.length,t+a.length+r.after.length),s=0;for(let e=1;e<=Math.min(i.length,r.before.length);e++)if(i[i.length-e]===r.before[r.before.length-e])s++;else break;let o=0;for(let e=0;e<Math.min(n.length,r.after.length);e++)if(n[e]===r.after[e])o++;else break;return s+o}(e,a,t,n)}));if(a.sort((e,t)=>t.score-e.score),a[0].score>a[1].score)return{startOffset:a[0].position,endOffset:a[0].position+t.length,confident:a[0].score>=5}}let s=i[0],o=Math.abs(i[0]-r);for(let e of i){let t=Math.abs(e-r);t<o&&(o=t,s=e)}return{startOffset:s,endOffset:s+t.length,confident:o<50}}(e,i.highlightedText,null!=(r=i.surroundingContext)?r:null,i.startOffset);t&&a.push({highlight:i,startOffset:t.startOffset,endOffset:t.endOffset,isOrphaned:i.isOrphaned||!t.confident})}a.sort((e,t)=>t.startOffset-e.startOffset);let i=e;for(let{highlight:t,startOffset:r,endOffset:n,isOrphaned:s}of a){let a,{color:o,id:l,note:c}=t;if(r<0||n>e.length||r>=n)continue;let d=["hl-".concat(o)];s&&d.push("hl-orphaned");let u='class="'.concat(d.join(" "),'"'),h='data-highlight-id="'.concat(l,'"'),g=c?' title="'.concat(c.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),'"'):"",m="<mark ".concat(u," ").concat(h).concat(g,">"),p="</mark>",f=i.slice(r,n);a=/(\n)([-*+]\s+|\d+\.\s+)/g.test(f)?m+f.replace(/(\n)([-*+]\s+|\d+\.\s+)/g,"".concat(p,"$1$2").concat(m))+p:m+f+p,i=i.slice(0,r)+a+i.slice(n)}return i}(E,ee),[E,ee,I]),{selection:ea,hasSelection:er,clearSelection:ei}=function(e){let{containerRef:t,containerReady:a=!0,enabled:r=!0,minLength:n=1,debounceMs:s=150,onSelection:o,onClear:l}=e,[c,d]=(0,i.useState)(null),u=(0,i.useRef)(null),h=(0,i.useRef)(!1),g=(0,i.useCallback)(()=>{let e=t.current;if(!e||!r)return;let a=window.getSelection();if(!a||a.isCollapsed){c&&(d(null),null==l||l());return}let i=a.anchorNode,s=a.focusNode;if(!i||!s)return;let u=w(i,e),h=w(s,e);if(!u||!h){c&&(d(null),null==l||l());return}let g=a.getRangeAt(0),m=v(e,g.startContainer,g.startOffset),p=v(e,g.endContainer,g.endOffset),f=Math.min(m,p),T=Math.max(m,p),k=a.toString();if(k.length<n){c&&(d(null),null==l||l());return}let j=function(e,t,a){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:b.GN,i=Math.max(0,t-r),n=Math.min(e.length,a+r),s=e.slice(i,t),o=e.slice(t,a),l=e.slice(a,n);return"".concat(s,"[").concat(o,"]").concat(l)}(y(e),f,T),N=function(){let e=window.getSelection();if(!e||0===e.rangeCount)return null;let t=e.getRangeAt(0),a=t.getClientRects();if(a.length>0){for(let e=a.length-1;e>=0;e--){let t=a[e];if(t.width>0&&t.height>0)return t}return a[a.length-1]}let r=t.getBoundingClientRect();if(0===r.width&&0===r.height){let e=t.startContainer;if(e.parentElement){let t=e.parentElement.getBoundingClientRect();if(t.width>0&&t.height>0)return t}}return r}();if(!N)return void x.warn("[useTextSelection] Could not get selection rect");let C=0===N.x&&0===N.y&&0===N.width&&0===N.height?null:N;C||x.warn("[useTextSelection] Selection rect has no position info");let S={text:k,startOffset:f,endOffset:T,surroundingContext:j,rect:C||N};d(S),null==o||o(S)},[t,r,n,c,o,l]),m=(0,i.useCallback)(()=>{var e;null==(e=window.getSelection())||e.removeAllRanges(),d(null),null==l||l()},[l]),p=(0,i.useCallback)(()=>{let e=t.current;return e?y(e):""},[t]),f=(0,i.useCallback)(e=>{let a=t.current;a&&a.contains(e.target)&&(h.current=!0)},[t]),T=(0,i.useCallback)(()=>{h.current&&(h.current=!1,u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{g()},s))},[g,s]),k=(0,i.useCallback)(e=>{let a=t.current;if(!a)return;let r=e.touches[0];if(r){let e=document.elementFromPoint(r.clientX,r.clientY);e&&a.contains(e)&&(h.current=!0)}},[t]),j=(0,i.useCallback)(()=>{h.current&&(h.current=!1,u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{g()},s+100))},[g,s]);return(0,i.useEffect)(()=>
1{if(!r||!a)return;let e=t.current;if(e)return e.addEventListener("mousedown",f),e.addEventListener("mouseup",T),document.addEventListener("mouseup",T),e.addEventListener("touchstart",k,{passive:!0}),e.addEventListener("touchend",j,{passive:!0}),document.addEventListener("touchend",j,{passive:!0}),()=>{let e=t.current;e&&(e.removeEventListener("mousedown",f),e.removeEventListener("mouseup",T),e.removeEventListener("touchstart",k),e.removeEventListener("touchend",j)),document.removeEventListener("mouseup",T),document.removeEventListener("touchend",j),u.current&&clearTimeout(u.current),h.current=!1}},[r,a,f,T,k,j,t]),(0,i.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]),{selection:c,hasSelection:null!==c,clearSelection:m,getContainerText:p}}({containerRef:z,containerReady:!!G,enabled:!O,minLength:1}),en=(0,i.useCallback)((e,t,a)=>{let r=Math.max(0,t-b.GN),i=Math.min(e.length,a+b.GN),n=e.slice(r,t),s=e.slice(t,a),o=e.slice(a,i);return"".concat(n,"[").concat(s,"]").concat(o)},[]),es=(0,i.useCallback)(async e=>{if(!ea)return;let t={startOffset:ea.startOffset,endOffset:ea.endOffset},a=ee.find(e=>e.startOffset<t.endOffset&&t.startOffset<e.endOffset);if(a){let r={startOffset:Math.min(a.startOffset,t.startOffset),endOffset:Math.max(a.endOffset,t.endOffset)},i=E.slice(r.startOffset,r.endOffset),n=en(E,r.startOffset,r.endOffset);if(await J(a.id)){let t={fieldName:k,fieldIndex:j,startOffset:r.startOffset,endOffset:r.endOffset,highlightedText:i,surroundingContext:n,color:e},a=await K(t);a&&(ei(),A.o.success("Highlights merged"),null==L||L(a))}}else{let t={fieldName:k,fieldIndex:j,startOffset:ea.startOffset,endOffset:ea.endOffset,highlightedText:ea.text,surroundingContext:ea.surroundingContext,color:e},a=await K(t);a&&(ei(),null==L||L(a))}},[ea,k,j,ee,E,en,J,K,ei,L]),eo=(0,i.useCallback)(e=>{let t=e.target.closest("mark[data-highlight-id]");if(t){e.stopPropagation();let a=t.getAttribute("data-highlight-id"),r=ee.find(e=>e.id===a);r&&(Y(r),W({x:e.clientX,y:e.clientY}))}},[ee]),el=(0,i.useCallback)(()=>{Y(null),W(null)},[]),ec=(0,i.useCallback)(async(e,t,a)=>{let r={};void 0!==t&&(r.color=t),void 0!==a&&(r.note=a),await Q(e,r),el()},[Q,el]),ed=(0,i.useCallback)(async e=>{el(),await J(e)&&(null==F||F(e),A.o.success("Highlight deleted",{action:{label:"Undo",onClick:()=>{X()}},duration:5e3}))},[J,el,F,X]);(0,i.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"z"===e.key&&Z&&(e.preventDefault(),X())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[Z,X]);let eu=(0,i.useMemo)(()=>{if(D){let e=a(65251).sanitize(et,{ALLOWED_TAGS:["mark","br","strong","em","a","span"],ALLOWED_ATTR:["href","target","rel","style","class","data-highlight-id","data-color"]});return(0,r.jsx)("span",{dangerouslySetInnerHTML:{__html:e}})}return(0,r.jsx)(n.Ay,{rehypePlugins:[s.A],components:{p:e=>{let{children:t}=e;return(0,r.jsx)("span",{className:"block",children:t})}},children:et})},[D,et]);return(0,r.jsxs)("span",{ref:H,className:(0,N.cn)("relative",P),onClick:eo,"data-highlightable":"true","data-content-type":t,"data-content-id":l,"data-field-name":k,"data-field-index":j,children:[eu,er&&ea&&!O&&(0,r.jsx)(T.X,{selection:ea,isPro:B,colorLabels:V,onHighlight:es,onClose:ei,onLabelChange:$}),R&&_&&(0,r.jsx)(C,{highlight:R,position:_,isPro:B,colorLabels:V,onUpdateColor:e=>ec(R.id,e),onUpdateNote:e=>ec(R.id,void 0,e),onDelete:()=>ed(R.id),onClose:el,onLabelChange:$})]})}a(98425),a(96403),a(86186);var P=a(90781),O=a(11178),I=a(92804);function D(e){let{forceShow:t=!1,className:a}=e,[n,s]=(0,i.useState)(!1),[o,l]=(0,i.useState)(!1);(0,i.useEffect)(()=>{if(!localStorage.getItem(j.eZ.storageKey)||t){let e=setTimeout(()=>{s(!0)},j.eZ.showDelay);return()=>clearTimeout(e)}},[t]);let c=()=>
1{l(!0),s(!1),localStorage.setItem(j.eZ.storageKey,"true")};return!n||o?null:(0,r.jsxs)("div",{className:(0,N.cn)("fixed bottom-24 right-6 z-40","bg-white rounded-xl shadow-lg border border-purple-100","p-4 max-w-xs","animate-fade-in",a),role:"tooltip","aria-label":"Highlighting feature tip",children:[(0,r.jsx)("button",{onClick:c,className:"absolute top-2 right-2 p-1 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Dismiss tip",children:(0,r.jsx)(P.n,{icon:I.A,size:16})}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"flex-shrink-0 w-10 h-10 bg-purple-100 rounded-full flex items-center justify-center animate-pulse",children:(0,r.jsx)(P.n,{icon:O.A,size:20,className:"text-purple-600"})}),(0,r.jsxs)("div",{className:"flex-1 pr-4",children:[(0,r.jsx)("h4",{className:"font-semibold text-gray-900 text-sm mb-1",children:"New: Text Highlighting"}),(0,r.jsx)("p",{className:"text-xs text-gray-600 leading-relaxed",children:"Select any text in tags, flashcards, or digest to highlight it. Add notes and organize by color!"})]})]}),(0,r.jsx)("button",{onClick:c,className:(0,N.cn)("mt-3 w-full py-2 px-3","bg-purple-600 hover:bg-purple-700 text-white","rounded-lg text-sm font-medium","transition-colors"),children:"Got it!"}),(0,r.jsx)("div",{className:"absolute -bottom-2 right-8 w-4 h-4 bg-white border-r border-b border-purple-100 transform rotate-45"})]})}let L=(0,l.h)("useHighlightsPrefetch");function F(e){let{contentType:t,contentIds:a,enabled:r=!0}=e,n=(0,i.useRef)(new Set);(0,i.useLayoutEffect)(()=>{if(!r||0===a.length)return;let e=a.filter(e=>!n.current.has(e));if(0===e.length)return;e.forEach(e=>n.current.add(e)),L.debug("[useHighlightsPrefetch] Prefetching highlights for ".concat(e.length," ").concat(t,"s"));let i=f(t,e);d.set(t,i),i.finally(()=>{d.delete(t)}),i.then(a=>{let r=Object.values(a).flat().length;L.debug("[useHighlightsPrefetch] Prefetched ".concat(r," highlights for ").concat(e.length," ").concat(t,"s"))}).catch(t=>{L.error("[useHighlightsPrefetch] Error prefetching:",t),e.forEach(e=>n.current.delete(e))})},[t,a,r])}},11218:(e,t,a)=>{a.d(t,{A:()=>z});var r=a(95155),i=a(12115),n=a(20063),s=a(15239),o=a(89599),l=a(70883),c=a(71919);(0,c.h)("guest-user");let d=l.Xn.GUEST_USER_ID;function u(){try{let e=localStorage.getItem(d);return e&&e.startsWith("guest-user-")?e:null}catch(e){return null}}var h=a(85797);let g=(0,c.h)("useGuestMigration"),m=(0,c.h)("GuestMigrationBanner");function p(e){let{className:t}=e,{isMigrating:a,migrationResult:n,triggerMigrationOnSignup:s}=function(){let[e,t]=(0,i.useState)(null),[a,r]=(0,i.useState)(!1),[n,s]=(0,i.useState)(null),[o,c]=(0,i.useState)(!0);(0,i.useEffect)(()=>{"true"!==localStorage.getItem(l.Xn.MIGRATION_COMPLETED)?d():c(!1)},[]);let d=async()=>{try{c(!0),await h.P.syncGuestUserId();let e=u(),a=e?"/api/auth/migrate-guest-data?guestUserId=".concat(encodeURIComponent(e)):"/api/auth/migrate-guest-data",r=await fetch(a,{method:"GET",headers:{"Content-Type":"application/json"}});if(r.ok){let e=await r.json();t(e)}else g.error("Failed to check guest data:",r.status),t({hasGuestData:!1,guestUserId:null,stats:{tags:0,sessions:0,flashcards:0}})}catch(e){g.error("Error checking guest data:",e),t({hasGuestData:!1,guestUserId:null,stats:{tags:0,sessions:0,flashcards:0}})}finally{c(!1)}},m=async()=>{try{r(!0),s(null);let e=localStorage.getItem(l.Xn.MIGRATION_COMPLETED);if("true"===e)return g.debug("[Migration] Migration already completed, skipping"),{success:!0,message:"Migration already completed",migratedTags:0,migratedSessions:0};let a=u(),i=await fetch("/api/auth/migrate-guest-data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guestUserId:a})}),n=await i.json();if(i.ok&&n.success)return s(n),localStorage.setItem(l.Xn.MIGRATION_COMPLETED,"true"),await h.P.notifyGuestDataMigrated(n.migratedTags||0,n.migratedSessions||0),t({hasGuestData:!1,guestUserId:null,stats:{tags:0,sessions:0,flashcards:0}}),n;{let e=n.error||"Migration failed";return s({success:!1,error:e,migratedTags:0,migratedSessions:0}),{success:!1,error:e,migratedTags:0,migratedSessions:0}}}catch(t){let e="Network error during migration";return g.error("Migration error:",t),s({success:!1,error:e,migratedTags:0,migratedSessions:0}),{success:!1,error:e,migratedTags:0,migratedSessions:0}}finally{r(!1)}},p=async()=>(g.debug("[Migration] Triggering migration after account creation"),await m());return{guestData:e,isMigrating:a,migrationResult:n,loading:o,checkGuestData:d,migrateGuestData:m,triggerMigrationOnSignup:p,getMigrationPromptMessage:()=>{if(!(null==e?void 0:e.hasGuestData))return null;let{tags:t,sessions:a,flashcards:r}=e.stats;return t>0&&r>0?"You have ".concat(t," tags and ").concat(r," flashcards from ").concat(a," videos as a guest. Sign in to keep this data permanently."):t>0&&a>0?"You have ".concat(t," tags from ").concat(a," videos as a guest. Sign in to keep this data permanently."):t>0?"You have ".concat(t," tags as a guest. Sign in to keep this data permanently."):a>0?"You have ".concat(a," video sessions as a guest. Sign in to keep this data permanently."):null},hasGuestData:(null==e?void 0:e.hasGuestData)||!1}}(),[o,c]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{"true"===sessionStorage.getItem("ivct-trigger-migration")&&(m.debug("[Migration Banner] Triggering migration for new user"),sessionStorage.removeItem("ivct-trigger-migration"),s())},[s]),(0,i.useEffect)(()=>
1{if(n){c(!0);let e=setTimeout(()=>c(!1),n.success?3e3:5e3);return()=>clearTimeout(e)}},[n]),a)return(0,r.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 ".concat(t),children:(0,r.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,r.jsx)("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-600"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-blue-800",children:"Migrating your data..."}),(0,r.jsx)("p",{className:"text-sm text-blue-600",children:"We're transferring your tags and sessions to your account."})]})]})});if(o&&n){if(n.success)return(0,r.jsx)("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4 ".concat(t),children:(0,r.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,r.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-green-800",children:"Migration completed!"}),(0,r.jsxs)("p",{className:"text-sm text-green-600",children:["Migrated ",n.migratedTags," tags and ",n.migratedSessions," sessions."]})]})]})});else if(n.error)return(0,r.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 ".concat(t),children:(0,r.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,r.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-red-800",children:"Migration failed"}),(0,r.jsx)("p",{className:"text-sm text-red-600",children:n.error})]})]})})}return null}var f=a(46676),b=a(24672),x=a(34256),v=a(90368),y=a(27937),w=a(9540),T=a(86651),k=a(65229),j=a(90781),N=a(91654),C=a(43165),S=a(50955),A=a(34614),E=a(18606),P=a(31391),O=a(74897),I=a(15273),D=a(13940),L=a(68381),F=a(10190);let G=(0,c.h)("EneySidebarLayout");function M(e){let{count:t}=e;if(t<=0)return null;let a=t>99?"99+":t.toString();return(0,r.jsx)("span",{className:" inline-flex items-center justify-center min-w-[20px] h-5 px-1.5 text-xs font-semibold bg-gradient-to-r from-orange-500 to-pink-500 text-white rounded-full shadow-lg shadow-orange-500/30 animate-pulse ",title:"".concat(t," flashcard").concat(1!==t?"s":""," due for review"),children:a})}let z=e=>{let{children:t,navigation:a,onNavigationClick:l,title:c,subtitle:d}=e,[u,h]=(0,i.useState)(!1),[g,m]=(0,i.useState)(!1),[z,H]=(0,i.useState)(""),R=(0,n.useRouter)(),Y=(0,n.usePathname)(),{user:_,signOut:W,isGuest:U}=(0,f.A)(),{dueCount:q,badgeEnabled:B}=(0,b.QR)();(0,i.useEffect)(()=>{let e=localStorage.getItem("sidebar-collapsed");null!==e&&m("true"===e)},[]),(0,i.useEffect)(()=>{let e=()=>{let e=.01*window.innerHeight;document.documentElement.style.setProperty("--vh","".concat(e,"px"))};return e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[]);let V=()=>{h(!u)},K=e=>{try{R.push(e),h(!1)}catch(e){G.error("Navigation error:",e)}},Q=()=>{let e=z.trim();if(e)try{R.push("/search?q=".concat(encodeURIComponent(e))),H("")}catch(e){G.error("Search navigation error:",e)}},J=e=>{let{icon:t,label:a,route:n,id:s,current:o=!1,badge:c,onboardingId:d,onMouseEnter:u}=e,m=s||n||"";return(0,r.jsxs)("button",{onClick:()=>(e=>{l?(l(e),h(!1)):K(e)})(m),onMouseEnter:u,"data-onboarding":d,title:g?a:void 0,className:"\n relative flex items-center w-full rounded-2xl transition-all duration-300 font-medium text-sm\n ".concat(g?"justify-center px-3 py-3":"gap-3 px-4 py-3 text-left","\n ").concat((n?Y===n:o)?"bg-gradient-to-r from-purple-500/20 to-pink-500/20 text-white border border-purple-400/30 shadow-lg glass":"text-white/70 hover:bg-white/10 hover:text-white glass","\n "),children:[(0,r.jsx)("span",{className:"flex-shrink-0",children:i.isValidElement(t)?t:(0,r.jsx)(t,{size:20})}),!g&&(0,r.jsx)("span",{children:a}),!g&&c&&(0,r.jsx)("span",{className:"ml-auto",children:c}),g&&c&&(0,r.jsx)("span",{className:"absolute -top-1 -right-1",children:c})]})};return(0,r.jsxs)("div",{className:"flex bg-gradient-to-br from-purple-900 via-purple-800 to-pink-800 relative",style:{minHeight:"100dvh"},children:[(0,r.jsxs)("div",{"data-sidebar":!0,className:"\n fixed top-0 bottom-0 left-0 transform transition-all duration-300 ease-in-out\n lg:translate-x-0 lg:z-20\n ".concat(u?"translate-x-0 z-50":"-translate-x-full lg:translate-x-0","\n ").concat(g?"lg:w-20":"lg:w-64"," w-64\n bg-gradient-to-b from-purple-900/95 to-purple-800/95 glass border-r border-purple-400/40 shadow-xl\n mobile-full-height\n "),style:{height:"100dvh"},children:[(0,r.jsx)("button",{onClick:()=>{let e=!g;m(e),localStorage.setItem("sidebar-collapsed",String(e))},className:"hidden lg:flex absolute -right-3 top-20 z-30 w-6 h-6 items-center justify-center bg-purple-600 hover:bg-purple-500 rounded-full border border-purple-400/50 shadow-lg text-white/80 hover:text-white transition-all duration-200",title:g?"Expand sidebar":"Collapse sidebar",children:g?(0,r.jsx)(y.A,{size:14}):(0,r.jsx)(v.A,{size:14})}),(0,r.jsxs)("div",{className:"flex flex-col h-full overflow-y-auto overscroll-contain ".concat(g?"p-3":"p-6"),children:[(0,r.jsxs)("div",{className:"flex items-center mb-8 flex-shrink-0 ".concat(g?"justify-center":"justify-between"),children:[(0,r.jsxs)("div",{className:"flex items-center ".concat(g?"justify-center":"gap-3"),children:[(0,r.jsx)("div",{className:"rounded-2xl shadow-lg overflow-hidden bg-white/10 backdrop-blur-sm ".concat(g?"w-10 h-10":"w-12 h-12"),children:(0,r.jsx)(s.default,{src:"/tagit-logo.png",alt:"TAGiT Logo",width:48,height:48,className:"w-full h-full object-contain",priority:!0})}),!g&&(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-2xl font-bold text-white",children:"TAGiT"}),(0,r.jsx)(x.Jw,{size:"sm"})]})]}),u&&!g&&(0,r.jsx)("button",{onClick:V,className:"lg:hidden text-white/70 hover:text-white","aria-label":"Close navigation menu",children:(0,r.jsx)(k.A,{size:24})})]}),(0,r.jsx)("div",{className:"flex-1 space-y-2 min-h-0 pt-2 pb-4 scrollbar-thin scrollbar-thumb-white/20 scrollbar-track-transparent ".concat(g?"px-1 -mx-1":"px-2 -mx-2"),children:a?a.map(e=>(0,r.jsx)(J,{icon:e.icon,label:e.name,id:e.id,current:e.current,badge:e.badge},e.id)):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(J,{icon:(0,r.jsx)(j.n,{icon:C.A,size:20}),label:"Dashboard",route:"/",onboardingId:"dashboard-nav"}),(0,r.jsx)(J,{icon:(0,r.jsx)(j.n,{icon:I.A,size:20}),label:"Daily Digest",route:"/digest",onboardingId:"digest-nav"}),(0,r.jsx)(J,{icon:(0,r.jsx)(j.n,{icon:N.A,size:20}),label:"Tags",route:"/sessions",onboardingId:"tags-nav"}),(0,r.jsx)(J,{icon:(0,r.jsx)(j.n,{icon:S.A,size:20}),label:"Study",route:"/study",onboardingId:"study-nav",badge:B?(0,r.jsx)(M,{count:q}):null}),(0,r.jsx)(J,{icon:(0,r.jsx)(j.n,{icon:A.A,size:20}),label:"Search",route:"/search",onboardingId:"search-nav"}),(0,r.jsx)(J,{icon:(0,r.jsx)(j.n,{icon:E.A,size:20}),label:"Export",route:"/export",onboardingId:"export-nav"})]})}),!a&&(0,r.jsx)("div",{className:"h-px bg-white/10 flex-shrink-0"}),!a&&(0,r.jsxs)("div",{className:"pt-6 border-t border-purple-400/20 flex-shrink-0 space-y-2",children:[!g&&(0,r.jsxs)("div",{className:"px-2 py-1.5 bg-white/10 rounded-xl glass border border-purple-400/30 mb-3","data-onboarding-dim":!0,children:[(0,r.jsx)("p",{className:"text-[10px] text-white/60 text-center mb-1",children:D.y6.title}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)(x.Tf,{url:"https://tagit.video",hashtags:["TAGiT","AI","Learning","VideoLearning","Productivity"],variant:"compact",showLabels:!1,platforms:["facebook","linkedin","twitter"]})})]}),(0,r.jsx)(J,{icon:(0,r.jsx)(j.n,{icon:P.A,size:20}),label:"Settings",route:"/settings",onboardingId:"settings-nav",onMouseEnter:L.Vf}),(0,r.jsx)(J,{icon:(0,r.jsx)(j.n,{icon:O.A,size:20}),label:"Feedback",route:"/feedback",onboardingId:"feedback-nav"})]}),!g&&(0,r.jsxs)("div",{className:"mt-3 pt-3 border-t border-purple-400/10 flex-shrink-0",children:[(0,r.jsxs)("p",{className:"text-xs text-white/40 text-center font-medium",children:["TAGiT by ",(0,r.jsx)("span",{className:"text-white/50",children:"Adam VisuAl+"})]}),(0,r.jsxs)("div",{className:"flex justify-center gap-3 mt-2",children:[(0,r.jsx)("button",{onClick:()=>K("/pricing"),className:"text-xs text-white/30 hover:text-white/50 transition-colors underline",children:"Pricing"}),(0,r.jsx)("button",{onClick:()=>
1K("/how-to"),className:"text-xs text-white/30 hover:text-white/50 transition-colors underline",children:"How to"}),(0,r.jsx)("button",{onClick:()=>K("/terms"),className:"text-xs text-white/30 hover:text-white/50 transition-colors underline",children:"Terms"}),(0,r.jsx)("button",{onClick:()=>K("/privacy"),className:"text-xs text-white/30 hover:text-white/50 transition-colors underline",children:"Privacy"})]})]})]})]}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col transition-all duration-300 overflow-x-hidden min-w-0 ".concat(g?"lg:ml-20":"lg:ml-64"),children:[(0,r.jsx)(p,{className:"mx-4 mt-4"}),(0,r.jsx)("header",{className:"sticky top-0 z-30 bg-gradient-to-r from-purple-600/90 to-pink-600/90 backdrop-blur-md border-b border-white/20 px-4 sm:px-6 py-4 cursor-pointer",onClick:e=>{let t=e.target;"BUTTON"===t.tagName||"INPUT"===t.tagName||"A"===t.tagName||t.closest("button")||t.closest("input")||t.closest("a")||window.scrollTo({top:0,behavior:"smooth"})},title:"Tap to scroll to top",children:(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3 md:gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 md:gap-4 min-w-0 flex-1",children:[(0,r.jsx)("button",{onClick:V,className:"lg:hidden text-white/70 hover:text-white flex-shrink-0","aria-label":"Open navigation menu",children:(0,r.jsx)(w.A,{size:24})}),(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-3 lg:gap-6 min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"flex-shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-base lg:text-xl font-semibold text-white whitespace-nowrap",children:c||"TAGiT Dashboard"}),(0,r.jsx)(x.Jw,{size:"sm"})]}),d&&(0,r.jsx)("p",{className:"text-sm text-white/70 mt-0.5",children:d})]}),(0,r.jsxs)("div",{className:"relative min-w-0 flex-1 max-w-md","data-onboarding":"header-search",children:[(0,r.jsx)(T.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-white/50 cursor-pointer hover:text-white/70 transition-colors flex-shrink-0",size:20,onClick:Q}),(0,r.jsx)("input",{type:"text",placeholder:"Search anything...",value:z,onChange:e=>H(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Q())},className:"pl-10 pr-4 py-3 w-full glass border border-white/20 rounded-2xl text-white placeholder-white/50 focus:outline-none focus:ring-2 focus:ring-purple-400 focus:border-transparent transition-colors"})]})]})]}),(0,r.jsx)("div",{className:"flex items-center gap-2 sm:gap-4 flex-shrink-0",children:(0,r.jsx)("div",{className:"w-auto",children:(0,r.jsx)(o.C,{})})})]})}),(0,r.jsx)("main",{className:"flex-1 p-4 sm:p-6 bg-white overflow-x-hidden",children:t})]}),u&&(0,r.jsx)("div",{className:"fixed top-0 left-0 right-0 bottom-0 bg-black/60 z-40 lg:hidden backdrop-blur-sm",style:{height:"100dvh"},onClick:V}),(0,r.jsx)(F.ad,{})]})}},13940:(e,t,a)=>{a.d(t,{IF:()=>i,y6:()=>r}),a(48674),a(42237),a(47152),a(57172),a(19283),a(44893),a(30940),a(24245),a(68990),a(62565),a(91530),a(66376),a(4981),a(4329),a(9616),a(58998).S$,a(86125),a(80705),a(47948);let r={title:"Spread the Knowledge",description:"Know someone who learns from YouTube? Share TAGiT with them."},i={title:"Quick Help",dismissLabel:"Dismiss",viewAllLink:{text:"View all FAQs",href:"/faq"},items:[{question:"How do I tag a YouTube video?",answer:"While watching any YouTube video, press Alt+T (Windows/Linux) or Opt+T (Mac) to instantly capture the moment. TAGiT will save the timestamp, extract the transcript, and generate an AI summary and flashcards automatically."},{question:"How do flashcards help me remember?",answer:"TAGiT uses spaced repetitionâa proven memory technique that shows you flashcards at optimal intervals. Instead of forgetting 90% within a week, you retain knowledge long-term by reviewing at scientifically-timed moments."},{question:"How do I remember videos I watch on my TV or phone?",answer:"TAGiT's Daily Digest automatically captures videos you watch on any deviceâTV, phone, or tablet. Wake up to an email with AI insights and flashcards from yesterday's videos. No manual tagging needed, just watch and learn."}]}},19283:(e,t,a)=>{a.d(t,{Rz:()=>i,aq:()=>r});let r={name:"TAGiT",badge:"BETA",logoAlt:"TAGiT Logo"},i={signIn:{label:"Sign In",ariaLabel:"Sign in to TAGiT"},getStarted:{label:"Try Free",ariaLabel:"Try TAGiT for free"},openApp:{label:"Open App",ariaLabel:"Open your TAGiT dashboard"}}},24186:(e,t,a)=>{a.d(t,{PY:()=>n,QO:()=>r,WA:()=>i,eZ:()=>o,gV:()=>s,sn:()=>l});let r={purple:{bg:"rgba(168, 85, 247, 0.3)",bgHover:"rgba(168, 85, 247, 0.45)",border:"rgba(168, 85, 247, 0.6)",name:"Purple"},yellow:{bg:"rgba(250, 204, 21, 0.3)",bgHover:"rgba(250, 204, 21, 0.45)",border:"rgba(250, 204, 21, 0.6)",name:"Yellow"},blue:{bg:"rgba(59, 130, 246, 0.3)",bgHover:"rgba(59, 130, 246, 0.45)",border:"rgba(59, 130, 246, 0.6)",name:"Blue"},green:{bg:"rgba(34, 197, 94, 0.3)",bgHover:"rgba(34, 197, 94, 0.45)",border:"rgba(34, 197, 94, 0.6)",name:"Green"},pink:{bg:"rgba(236, 72, 153, 0.3)",bgHover:"rgba(236, 72, 153, 0.45)",border:"rgba(236, 72, 153, 0.6)",name:"Pink"}},i={purple:"Important",yellow:"Key Point",blue:"Reference",green:"Action Item",pink:"Question"},n={height:40,padding:8,zIndex:50,animationDuration:150},s={maxLength:280,placeholder:"Add a note (optional)...",rows:2},o={storageKey:"tagit_highlight_coach_mark_shown",showDelay:500},l={emptyState:{title:"Highlight and add your first note.",description:"Select text on any tag, flashcard, or digest to highlight it and add notes. Your highlights will appear here for easy review.",tips:{header:"Quick tips:",items:["Select any text to see the highlight toolbar","Choose a color to categorize your highlights","Add notes to remember why it's important"]}},noteCard:{addNote:"Add note",editNotePlaceholder:"Add a note...",charactersRemaining:"characters remaining",goToSource:"Go to source",orphanedWarning:"This highlight may have moved due to text changes.",copyText:"Copy text",editNote:"Edit note",delete:"Delete"},notesTab:{searchPlaceholder:"Search highlights...",groupByLabel:"Group by:",noMatchesMessage:"No notes match your filters",notesSingular:"note",notesPlural:"notes"},contentTypes:{tag:"Tag",flashcard:"Flashcard",digest:"Digest"},groupLabels:{tags:"Tags",flashcards:"Flashcards",dailyDigest:"Daily Digest",today:"Today",thisWeek:"This Week",thisMonth:"This Month",older:"Older"}}},24245:(e,t,a)=>{a.d(t,{s:()=>r});let r={badge:{text:"TAGiT is a Chrome Extension"},description:"Get the Chrome Web Store link sent to your email to install on your computer",form:{placeholder:"Enter your email",submitButton:"Send me the link",submittingButton:"Sending..."},success:{message:"Email sent! Check your inbox"},errors:{invalidEmail:"Please enter a valid email address",generic:"Something went wrong"},privacyNotice:"We'll only send you the Chrome Web Store link. No spam, ever."}},24672:(e,t,a)=>{a.d(t,{QR:()=>p,bO:()=>u,kL:()=>g,ot:()=>h});var r=a(12115),i=a(46676),n=a(70883),s=a(9367);let o=(0,a(71919).h)("useFlashcardsDueCount"),l="flashcard-reviewed",c="badge-preference-changed",d="tagit_badge_pref";function u(){try{sessionStorage.removeItem(d)}catch(e){}window.dispatchEvent(new CustomEvent(c))}function h(){window.dispatchEvent(new CustomEvent(l))}function g(){window.postMessage({type:"TAGIT_FLASHCARD_REVIEWED",source:"tagit-dashboard"},window.location.origin)}function m(e){if("undefined"!=typeof navigator&&"setAppBadge"in navigator)try{e>0?navigator.setAppBadge(e):navigator.clearAppBadge()}catch(e){}}function p(){let[e,t]=(0,r.useState)(0),[a,u]=(0,r.useState)(!0),[h,g]=(0,r.useState)(null),[p,f]=(0,r.useState)(!1),{isGuest:b,user:x}=(0,i.A)(),v=(0,r.useRef)(!1),y=(0,r.useRef)(0),w=(0,r.useCallback)(async()=>
1{if(b)return!0;try{let e=sessionStorage.getItem(d);if(null!==e){let t="true"===e;return v.current=t,f(t),t}}catch(e){}try{let r=await fetch("/api/preferences");if(r.ok){var e,t,a;let i=null==(a=null==(t=(await r.json()).data)||null==(e=t.preferences)?void 0:e.badge_notifications)||a;v.current=i,f(i);try{sessionStorage.setItem(d,String(i))}catch(e){}return i}}catch(e){o.error("Error fetching badge preference:",e)}return v.current},[b]),T=(0,r.useCallback)(async()=>{try{var e;if(u(!0),g(null),y.current=Date.now(),!await w()){t(0),m(0),u(!1);return}let a=b?localStorage.getItem(n.Xn.GUEST_USER_ID):null,r=a?"/api/flashcards?excluded=false&showAll=false&guestUserId=".concat(encodeURIComponent(a)):"/api/flashcards?excluded=false&showAll=false",i=await fetch(r);if(!i.ok)throw Error("Failed to fetch due flashcards");let s=((null==(e=(await i.json()).data)?void 0:e.flashcards)||[]).length;t(s),m(s)}catch(e){o.error("Error fetching due flashcard count:",e),g(e instanceof Error?e.message:"Unknown error"),t(0),m(0)}finally{u(!1)}},[b,w]);return(0,r.useEffect)(()=>{T();let e=()=>{"visible"===document.visibilityState&&Date.now()-y.current>=12e4&&T()};document.addEventListener("visibilitychange",e);let t=()=>{setTimeout(T,s.L6.DUE_COUNT)};window.addEventListener(l,t);let a=()=>{T()};return window.addEventListener(c,a),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener(l,t),window.removeEventListener(c,a)}},[T,null==x?void 0:x.id]),{dueCount:e,isLoading:a,error:h,badgeEnabled:p,refetch:(0,r.useCallback)(async()=>{await T()},[T])}}},30940:(e,t,a)=>{a.d(t,{D9:()=>i,jJ:()=>s,oZ:()=>n,t5:()=>r});let r={video:{id:"video",label:"Video",title:"See It in Action",mobileTitle:"Video",altText:"TAGiT product demo video - Smart video bookmarking browser extension overview"},tagging:{id:"tagging",label:"Tagging",title:"Tag YouTube Moments",mobileTitle:"Tagging",image:"/screenshots/youtube.png",altText:"TAGiT YouTube tagging feature - One-click bookmark creation on YouTube videos with AI-powered summaries"},dashboard:{id:"dashboard",label:"Dashboard",title:"Dashboard Overview",mobileTitle:"Dashboard",image:"/screenshots/dashboard.png",altText:"TAGiT dashboard interface - Organized collection of bookmarked video moments with tags, summaries, and learning tools"},tags:{id:"tags",label:"Tags",title:"Your Tag Collection",mobileTitle:"Tags",image:"/screenshots/tags.png",altText:"TAGiT tags management - Categorized collection of video bookmarks with AI summaries, timestamps, and quick access"},flashcards:{id:"flashcards",label:"Flashcards",title:"Learn with Flashcards",mobileTitle:"Flashcards",image:"/screenshots/flashcards.png",altText:"TAGiT flashcards feature - AI-generated flashcards from video moments for spaced repetition learning"},dailyDigest:{id:"daily-digest",label:"Daily Digest",title:"Wake Up to Insights",mobileTitle:"Digest",image:"/screenshots/daily-digest.png",altText:"TAGiT Daily Digest - Automatic email with AI insights and flashcards from videos watched on any device"}},i=["video","tagging","dashboard","tags","flashcards","dailyDigest"],n="video",s={videoId:"6WT3vxdtySU",defaultTitle:"Remember What You Watch on YouTube with TAGiT"}},42237:(e,t,a)=>{a.d(t,{Mx:()=>o,cU:()=>i,fV:()=>r,nJ:()=>n,rH:()=>s});let r=[{title:"Daily Digest",description:"Forget to take notes? No problem. Wake up to AI insights from all the videos you watchedâacross any device."},{title:"One-Click Tagging",description:"Never lose a breakthrough moment. One click captures insights while they are fresh in your mind."},{title:"Highlight & Annotate",description:"Color-code key insights and add your own notes. Turn every video moment into a personal knowledge card."},{title:"AI-Powered Insights",description:"Get instant context-aware insights from every video. Never forget the details."},{title:"Smart Flashcards",description:"AI transforms your knowledge into study cards. Review for two minutes a day, remember for years."}],i=["Automatic capture removes frictionâthe #1 barrier to retention","Tagging at the moment strengthens memory encoding","Highlighting + note-taking activates elaborative encodingâthe gold standard for deep learning","Insights reduce cognitive load and improve c
1omprehension","Active recall is 2-3x more effective than passive review"],n={sectionTitle:"Turn YouTube into your second brain",sectionSubtitle:"Every video you watch becomes knowledge you keep",features:r},s={line1:"Turn YouTube into",line2Gradient:"your second brain"},o={prompt:"Want to learn more about how TAGiT can help you?",links:[{label:"How-To Guides",href:"/how-to"},{label:"Explore Use Cases",href:"/use-cases"},{label:"FAQ",href:"/faq"},{label:"View Pricing",href:"/pricing"}]}},44893:(e,t,a)=>{a.d(t,{E7:()=>n,Gm:()=>l,aC:()=>i,e6:()=>r,kY:()=>s,zG:()=>o});let r={name:"TAGiT",badge:"BETA",logoAlt:"TAGiT Logo",description:"Never lose an 'aha!' moment from videos. Your personal knowledge database."},i={product:{title:"Product",links:[{label:"Chrome Extension",href:"https://chromewebstore.google.com/detail/tagit-video-bookmarking-a/bdicikdkiobadnneahpfpgmbgchppnfn"},{label:"Features",href:"/welcome#features"},{label:"Pricing",href:"https://app.tagit.video/pricing"},{label:"How-To Guides",href:"/how-to"},{label:"Use Cases",href:"/use-cases"}]},company:{title:"Company",links:[{label:"About",href:"/about"},{label:"FAQ",href:"/faq"},{label:"Privacy Policy",href:"/privacy"},{label:"Terms of Service",href:"/terms"}]},resources:{title:"Resources",links:[{label:"Blog",href:"/blog",external:!1},{label:"Changelog",href:"/changelog",external:!1},{label:"Documentation",href:"https://github.com/adampao/tagit-video",external:!0}]}},n={links:[{platform:"x",href:"https://x.com/adamvisu",label:"X"},{platform:"youtube",href:"https://www.youtube.com/@tagit-video",label:"YouTube"},{platform:"website",href:"https://adampetritsis.com",label:"Personal Website"}]},s=[{name:"Dang.ai",href:"https://dang.ai/tool/remember-what-you-watch-on-youtube-tagit-video",imageUrl:"https://global-uploads.webflow.com/63d8afd87da01fb58ea3fbcb/6487e2868c6c8f93b4828827_dang-badge.png",alt:"TAGiT | dang.ai",width:150,height:54},{name:"SaasHub",href:"https://www.saashub.com/tagit?utm_source=badge&utm_campaign=badge&utm_content=tagit&badge_variant=color&badge_kind=approved",imageUrl:"https://cdn-b.saashub.com/img/badges/approved-color.png?v=1",alt:"TAGiT approved on SaasHub",width:150,height:40},{name:"PeerPush",href:"https://peerpush.net/p/ivct-instant-video-context-tagger",imageUrl:"https://peerpush.net/p/ivct-instant-video-context-tagger/badge.png",alt:"TAGiT on PeerPush",width:150,height:40},{name:"Toolsfine",href:"https://toolsfine.com/",imageUrl:"https://storage.tally.so/50405aca-bb69-4638-a8a1-7c8286995bef/job.toolsfine.com.favicon.webp",alt:"TAGiT on Toolsfine",width:40,height:40},{name:"NextGen Tools",href:"https://www.nxgntools.com/tools/tagit?utm_source=tagit",imageUrl:"https://www.nxgntools.com/api/embed/tagit?type=FEATURED_ON&hideUpvotes=true",alt:"NextGen Tools Badge - The #1 AI Tools Directory & Launch Platform",width:150,height:48},{name:"Wired Business",href:"https://wired.business",imageUrl:"https://wired.business/badge0-dark.svg",alt:"Featured on Wired Business",width:200,height:54},{name:"Twelve Tools",href:"https://twelve.tools",imageUrl:"https://twelve.tools/badge0-dark.svg",alt:"Featured on Twelve Tools",width:200,height:54}],o={title:"Featured On",subtitle:"TAGiT is trusted by leading software directories"},l={copyright:e=>"\xa9 ".concat(e," Adam VisuAl+ All rights reserved."),tagline:"Built with â¤ï¸ for learners everywhere"}},47152:(e,t,a)=>{a.d(t,{$:()=>r,Tc:()=>s,YH:()=>n,uq:()=>i});let r={titleLine1:"Built on 140 Years of",titleLine2Gradient:"Memory Science",subtitle:"TAGiT applies proven memory techniques: active recall + spaced repetition",subtitleHighlight:"proven memory techniques",description:"One-click bookmarking + AI summaries + flashcards = your personal knowledge database"},i={title:"The Forgetting Curve (Ebbinghaus, 1885)",subtitle:"Without active engagement, you lose 90% of what you learn within a week",bars:{immediately:{label:"Immediately",percentage:"100%"},twentyFourHours:{label:"24 Hours",percentage:"30%"},sevenDays:{label:"7 Days",percentage:"10%"},withTagit:{label:"With TAGiT",percentage:"85%"}},footnote:"Based on research showing active recall and spaced repetition can improve retention by up to 85%"},n={title:"How TAGiT Helps You Beat the Forgetting Curve",methods:[{title:"Remember more",description:"Tag insights while watchingâthe most effective time for memory encoding. Don't wait until later when the context is gone.",descriptionHighlight:"while watching"},{title:"Learn faster",description:"Flashcards force you to retrieve information from memoryâproven to be 2-3x more effective than passive review.",descriptionHighlight:"retrieve"},{title:"Never forget",description:"Review your tags over time to move knowledge from short
1-term to long-term memory. The right interval makes all the difference.",descriptionHighlight:"short-term to long-term"}]},s={text:"The forgetting curve was discovered by Hermann Ebbinghaus in 1885. Modern research continues to validate that active recall and spaced repetition are among the most effective learning techniques available (Dunlosky et al., 2013; Roediger & Karpicke, 2006).",references:[{label:"Ebbinghaus, H. (1885)",title:"Memory: A Contribution to Experimental Psychology",url:"https://psychclassics.yorku.ca/Ebbinghaus/index.htm"},{label:"Dunlosky et al. (2013)",title:"Improving Students' Learning With Effective Learning Techniques",url:"https://doi.org/10.1177/1529100612453266"},{label:"Roediger & Karpicke (2006)",title:"Test-Enhanced Learning: Taking Memory Tests Improves Long-Term Retention",url:"https://doi.org/10.1111/j.1467-9280.2006.01693.x"}]}},47948:(e,t,a)=>{a.d(t,{Ek:()=>c,Qe:()=>s,aP:()=>n,cL:()=>i,o3:()=>o,vM:()=>r,y7:()=>l});let r={step:(e,t)=>"Step ".concat(e," of ").concat(t),complete:e=>"".concat(e,"% complete")},i={back:"Back",next:"Next",skip:"Skip setup",finish:"Finish Setup",finishing:"Setting up..."},n={title:"Never forget what you learn",description:"Every morning, receive AI-powered insights and flashcards from the YouTube videos you watched. Turn passive watching into active learning.",features:[{id:"insights",title:"Key Insights",subtitle:"What matters most"},{id:"actions",title:"Action Items",subtitle:"What to do next"},{id:"chat",title:"Chat with Video",subtitle:"Ask anything"}]},s={title:"When should we send your digest?",description:"Choose a time when you can focus on learning",timeLabel:"Delivery Time",videosLabel:"Videos per digest",bestBadge:"Best",videosHint:{quick:"Quick digest - perfect for busy mornings",balanced:"Balanced digest - best for most users",comprehensive:"Comprehensive digest - for deep learners"},tip:"Morning digests help you start your day with fresh insights"},o={title:"How should we filter your videos?",description:"Choose what content appears in your digest",modes:{open:{title:"Include All Channels",description:"All videos from your history, except channels you block. Best for discovering insights from diverse content.",badge:"Recommended"},curated:{title:"Curated Channels Only",description:"Only include channels you specifically approve. Best for focused learning from trusted creators."}},note:"We automatically exclude Music, Sports, Gaming, Entertainment, and Shorts. You can customize this in settings later."},l={title:"Tell us about yourself",description:"Help AI personalize your insights (optional)",placeholder:"I'm a software developer interested in AI/ML and productivity. I watch videos to learn new technologies and improve my skills...",helperText:"This helps us tailor insights to your interests",whyHelps:{title:"Why this helps:",description:"When you mention your interests, our AI can connect video insights to your goals and suggest more relevant action items."},skipHint:"You can skip this and add it later in settings"},c={title:"You're all set!",description:"Review your Daily Digest settings",items:{deliveryTime:{title:"Delivery Time",description:e=>"Every morning at ".concat(e)},videosPerDigest:{title:"Videos per Digest",description:e=>"".concat(e," video").concat(1!==e?"s":""," (longest ones prioritized)")},contentFilter:{title:"Content Filter",openDescription:"Include all channels (you can block specific ones later)",curatedDescription:"Curated channels only (add channels in settings)"},personalization:{title:"Personalization"}},confirmation:{title:e=>"Your first digest arrives tomorrow at ".concat(e),description:"Watch some YouTube videos today, and we'll turn them into insights and flashcards."}}},48674:(e,t,a)=>{a.d(t,{Bt:()=>r,bD:()=>n,b_:()=>s,gw:()=>i});let r={stat:"Most of what you watch is gone within a week",headline:"Remember everything you watch on YouTube",subheadline:"Turn videos into lasting knowledge",tagline:"You choose what matters. TAGiT makes sure it sticks.",cta:{primary:{label:"Turn videos into lasting knowledge for free",ariaLabel:"Start using TAGiT for free - turn YouTube videos into lasting knowledge"},secondary:null},trustSignals:["No credit card required","Works with any YouTube video"],mobilePrompt:{title:"Get TAGiT on Desktop",description:"TAGiT works best with the Chrome extension on your computer."}},i=(e,t)=>"".concat(e," tags/month + ").concat(t," Daily Digests free"),n={prefix:"Most of what you watch is gone ",highlight:"within a week",suffix:""},s={normal:"Remember everything you",gradient:"watch on YouTube"}},50233:(e,t,a)=>{a.d(t,{v:()=>o});var r=a(53759),i=a(9367);let n="tagit_persisted_toast";class s{showPersistedToast(){try{let e=sessionStorage.getItem(n);if(e){sessionStorage.removeItem(n);let{type:t,message:a}=JSON.parse(e);this.add(t,a)}}catch(e){}}async add(e,t,a){this.queue.push({type:e,message:t,options:a}),this.isProcessing||await this.processQueue()}async processQueue(){var e;if(0===this.queue.length){this.isProcessing=!1;return}this.isProcessing=!0;let t=this.queue.shift(),a=(null==(e=t.options)?void 0:e.duration)||i.MD.TOAST_DURATION;switch(t.type){case"success":r.o.success(t.message,t.options);break;case"error":r.o.error(t.message,t.options);break;case"info":r.o.info(t.message,t.options)}await new Promise(e=>setTimeout(e,a+i.MD.TOAST_GAP)),await this.processQueue()}success(e,t){return this.add("success",e,t)}error(e,t){return this.add("error",e,t)}info(e,t){return this.add("info",e,t)}persistedSuccess(e){sessionStorage.setItem(n,JSON.stringify({type:"success",message:e}))}persistedError(e){sessionStorage.setItem(n,JSON.stringify({type:"error",message:e}))}constructor(){this.queue=[],this.isProcessing=!1,setTimeout(()=>this.showPersistedToast(),i.MD.TRANSITION_SHORT)}}let o=new s},57172:(e,t,a)=>{a.d(t,{S3:()=>i,Zn:()=>n,x1:()=>r});let r={line1:"Start Growing Your",line2Gradient:"Knowledge Library Today"},i=(e,t)=>"".concat(e," tags/month + ").concat(t," Daily Digests free"),n={title:"Start Growing Your Knowledge Library Today",subtitle:"Early adopters are already building their knowledge libraries",cta:{primary:{label:"Try Daily Digest Free",ariaLabel:"Try TAGiT Daily Digest for free"},secondary:{label:"Add to Chrome (free)",ariaLabel:"Add TAGiT Chrome extension for free"}},trustSignals:["Start free, no credit card","Upgrade anytime for more features"],emotionalCloser:"Never lose an 'aha!' moment again."}},58436:(e,t,a)=>{a.d(t,{X:()=>m,o:()=>p});var r=a(95155),i=a(12115),n=a(47650),s=a(90781),o=a(33983),l=a(92804),c=a(87110),d=a(24186),u=a(34256),h=a(53759);function g(e,t){let a=t.find(t=>t.color===e);return(null==a?void 0:a.label)||d.WA[e]}function m(e){let{selection:t,isPro:a,colorLabels:m,onHighlight:p,onClose:f,onLabelChange:b}=e,x=(0,i.useRef)(null),[v,y]=(0,i.useState)(null),[w,T]=(0,i.useState)(!1),[k,j]=(0,i.useState)(null),[N,C]=(0,i.useState)(""),[S,A]=(0,i.useState)(!1),E=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e,a;if(!(null==t?void 0:t.rect))return void T(!1);let r=t.rect,i=window.innerWidth,n=window.innerHeight;"number"==typeof r.top&&"number"==typeof r.left&&!isNaN(r.top)&&!isNaN(r.left)&&(r.to
1p>0||r.left>0||r.bottom>0||r.right>0)?(e=r.top-d.PY.height-d.PY.padding,a=r.left+r.width/2-100,e<d.PY.padding&&(e=r.bottom+d.PY.padding)):(e=window.scrollY+.2*n,a=i/2-100),a<d.PY.padding&&(a=d.PY.padding),a+200>i-d.PY.padding&&(a=i-200-d.PY.padding),y({top:e,left:a}),requestAnimationFrame(()=>{T(!0)})},[t]),(0,i.useEffect)(()=>{let e=e=>{x.current&&!x.current.contains(e.target)&&f()},t=setTimeout(()=>{document.addEventListener("mousedown",e)},100);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[f]),(0,i.useEffect)(()=>{let e=e=>{"Escape"===e.key&&f()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[f]);let P=(0,i.useCallback)(e=>{k||p(e)},[p,k]),O=(0,i.useCallback)((e,t)=>(e.preventDefault(),e.stopPropagation(),a||"purple"===t)?b?void(j(t),C(g(t,m)),setTimeout(()=>{var e;return null==(e=E.current)?void 0:e.focus()},50)):void h.o.error("Label editing not available"):void h.o.error("Custom labels for additional colors require Pro"),[a,m,b]),I=(0,i.useCallback)(async()=>{if(!k||!N.trim()||!b)return void j(null);let e=N.trim();if(e.length>50)return void h.o.error("Label must be ".concat(50," characters or less"));try{A(!0),await b(k,e),h.o.success("Label saved"),j(null)}catch(e){h.o.error("Failed to save label")}finally{A(!1)}},[k,N,b]),D=(0,i.useCallback)(()=>{j(null),C("")},[]),L=(0,i.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),I()):"Escape"===e.key&&D(),e.stopPropagation()},[I,D]);if(!v)return null;let F=a?[...c.um]:[c.PP],G=e=>{e.stopPropagation()},M=(0,r.jsx)("div",{ref:x,className:(0,u.cn)("fixed z-50 flex flex-col gap-1 px-2 py-1.5 rounded-lg","bg-white/95 backdrop-blur-sm shadow-lg border border-gray-200","transition-all duration-150",w?"opacity-100 scale-100":"opacity-0 scale-95"),style:{top:v.top,left:v.left,zIndex:d.PY.zIndex},role:"toolbar","aria-label":"Highlight toolbar",onClick:G,onTouchStart:G,onTouchEnd:G,children:k?(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-5 h-5 rounded-full flex-shrink-0",style:{backgroundColor:d.QO[k].bg}}),(0,r.jsx)("input",{ref:E,type:"text",value:N,onChange:e=>C(e.target.value),onKeyDown:L,maxLength:50,className:"w-32 px-2 py-1 text-sm border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-purple-400",placeholder:"Label name",disabled:S}),(0,r.jsx)("button",{onClick:I,disabled:S,className:"p-1 text-green-600 hover:bg-green-100 rounded disabled:opacity-50",title:"Save",children:(0,r.jsx)(s.n,{icon:o.A,size:14})}),(0,r.jsx)("button",{onClick:D,disabled:S,className:"p-1 text-gray-400 hover:bg-gray-100 rounded disabled:opacity-50",title:"Cancel",children:(0,r.jsx)(s.n,{icon:l.A,size:14})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[F.map(e=>{let t=d.QO[e],i=g(e,m),n=b&&(a||"purple"===e);return(0,r.jsx)("button",{onClick:()=>P(e),onContextMenu:t=>O(t,e),className:(0,u.cn)("w-7 h-7 rounded-full border-2 border-white","transition-transform duration-100 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-1"),style:{backgroundColor:t.bg},title:"".concat(i).concat(n?" (right-click to edit)":""),"aria-label":"Highlight with ".concat(i)},e)}),!a&&(0,r.jsx)("div",{className:"ml-1 pl-2 border-l border-gray-200",children:(0,r.jsx)("button",{onClick:()=>{window.open("/settings/subscription","_blank")},className:"text-xs text-purple-600 hover:text-purple-700 whitespace-nowrap",title:"Upgrade to Pro for more colors",children:"+4 colors"})})]}),b&&(0,r.jsx)("p",{className:"text-[10px] text-gray-400 text-center",children:"Right-click to rename"})]})});return"undefined"!=typeof document?(0,n.createPortal)(M,document.body):null}function p(e){let{selectedColor:t,isPro:a,colorLabels:n,onSelectColor:m,onLabelChange:p,size:f="md"}=e,[b,x]=(0,i.useState)(null),[v,y]=(0,i.useState)(""),[w,T]=(0,i.useState)(!1),k=(0,i.useRef)(null),j=a?[...c.um]:[c.PP],N={sm:"w-5 h-5",md:"w-6 h-6",lg:"w-8 h-8"},C=(0,i.useCallback)((e,t)=>{var r;if(e.preventDefault(),e.stopPropagation(),!a&&"purple"!==t)return void h.o.error("Custom labels for additional colors require Pro");p&&(x(t),y((null==(r=n.find(e=>e.color===t))?void 0:r.label)||d.WA[t]),setTimeout(()=>{var e;
1return null==(e=k.current)?void 0:e.focus()},50))},[a,n,p]),S=(0,i.useCallback)(async()=>{if(!b||!v.trim()||!p)return void x(null);let e=v.trim();if(e.length>50)return void h.o.error("Label must be ".concat(50," characters or less"));try{T(!0),await p(b,e),h.o.success("Label saved"),x(null)}catch(e){h.o.error("Failed to save label")}finally{T(!1)}},[b,v,p]),A=(0,i.useCallback)(()=>{x(null),y("")},[]),E=(0,i.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),S()):"Escape"===e.key&&A(),e.stopPropagation()},[S,A]);return b?(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("div",{className:(0,u.cn)(N[f],"rounded-full flex-shrink-0"),style:{backgroundColor:d.QO[b].bg}}),(0,r.jsx)("input",{ref:k,type:"text",value:v,onChange:e=>y(e.target.value),onKeyDown:E,maxLength:50,className:"w-24 px-1.5 py-0.5 text-xs border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-purple-400",placeholder:"Label",disabled:w}),(0,r.jsx)("button",{onClick:S,disabled:w,className:"p-0.5 text-green-600 hover:bg-green-100 rounded disabled:opacity-50",title:"Save",children:(0,r.jsx)(s.n,{icon:o.A,size:12})}),(0,r.jsx)("button",{onClick:A,disabled:w,className:"p-0.5 text-gray-400 hover:bg-gray-100 rounded disabled:opacity-50",title:"Cancel",children:(0,r.jsx)(s.n,{icon:l.A,size:12})})]}):(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[j.map(e=>{let i=d.QO[e],s=g(e,n),o=e===t,l=p&&(a||"purple"===e);return(0,r.jsx)("button",{onClick:()=>m(e),onContextMenu:t=>C(t,e),className:(0,u.cn)(N[f],"rounded-full transition-all duration-100","focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-1",o?"ring-2 ring-gray-400 scale-110":"hover:scale-105"),style:{backgroundColor:i.bg},title:"".concat(s).concat(l?" (right-click to edit)":""),"aria-label":"".concat(s).concat(o?" (selected)":""),"aria-pressed":o},e)}),!a&&1===j.length&&(0,r.jsx)("span",{className:"text-xs text-gray-400 ml-1",children:"Pro: +4"})]})}},58998:(e,t,a)=>{a.d(t,{Kx:()=>i,Mp:()=>n,S$:()=>r});let r=3,i=25,n=-1},62565:(e,t,a)=>{a.d(t,{Pj:()=>i,mq:()=>r});let r={header:{title:"Create Your Account",subtitle:"Takes 30 seconds. Start tagging videos immediately."},fields:{email:{label:"Email Address",placeholder:"[email protected]"},password:{label:"Password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢"},confirmPassword:{label:"Confirm Password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢"}},passwordRequirements:{title:"Password requirements:",items:["At least 8 characters","One uppercase letter (A-Z)","One lowercase letter (a-z)","One number (0-9)","One special character"]},buttons:{submit:{label:"Create Account",loadingLabel:"Creating account..."},google:{label:"Continue with Google"}},divider:"Or continue with",alternateAction:{text:"Already have an account?",linkText:"Sign in",href:"/auth/login"}},i={title:"Check Your Email",description:e=>"We've sent you a confirmation link at ".concat(e,". Please check your email and click the link to verify your account."),backToLogin:"Back to Sign In"}},66376:(e,t,a)=>{a.d(t,{JC:()=>d,aV:()=>n,hw:()=>s,iN:()=>o,jk:()=>c,nD:()=>u,pB:()=>l});let r={limit_reached:"You're learning fast! Keep going with Pro.",feature_locked:"Unlock this feature with Pro.",trial_ended:"Continue your progress â Keep Pro.",general:"Upgrade to remember with no limits."},i={limit_reached:(e,t)=>"You've saved ".concat(e," insights this month. That's great! Upgrade to Pro for unlimited tagging and never miss a moment."),feature_locked:"This feature is available to Pro users. Upgrade now to unlock advanced AI capabilities and unlimited tagging.",trial_ended:"Your 7-day Pro trial has ended. Continue with unlimited features by upgrading to Pro.",general:"Transform your learning with unlimited tagging, AI summaries, and flashcards."},n={label:"TAGiT Pro Features"},s={buttons:{startTrial:e=>"Start ".concat(e,"-Day Free Trial"),default:"Start 7-Day Free Trial",loading:"Starting Trial..."},ineligible:{title:"You have already used your free trial",description:"Choose a paid plan to continue with unlimited features"}},o={monthly:{title:"Monthly Plan",description:"Perfect for getting started",period:"per month"},yearly:{title:"Yearly Plan",description:e=>"Best value - ".concat(e," months free!"),period:"per year",savingsBadge:e=>"Save ".concat(e,"%")},loading:"Loading...",processing:"Processing..."},l={guarantee:"Cancel anytime. No hidden fees."},c={upgradeFailed:"Failed to start upgrade process. Please try again.",pricingNotAvailable:"Pricing not available. Please try again."};function d(e,t){let a=r[e];return"function"==typeof a?a(t):a}function u(e,t,a){let r=i[e];return"function"==typeof r?r(t,a):r}},68381:(e,t,a)=>{a.d(t,{FA:()=>s,Vf:()=>o});var r=a(1686);let i=["settings","all"],n=async()=>{let e=await fetch("/api/settings/all",{credentials:"include"});if(!e.ok)throw Error("Failed to fetch settings");let t=await e.json();if(!t.success){var a;throw Error((null==(a=t.error)?void 0:a.message)||"Failed to fetch settings")}return t.data};function s(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=(0,r.jE)(),{data:a,error:s,isLoading:o,isFetching:l}=(0,r.pw)({queryKey:i,queryFn:n,enabled:e,staleTime:6e4,gcTime:3e5,refetchOnWindowFocus:!1,refetchOnReconnect:!0,retry:2});return{data:a,error:s,isLoading:o,isValidating:l&&!o,mutate:()=>
1t.invalidateQueries({queryKey:i})}}function o(){n().catch(()=>{})}},68990:(e,t,a)=>{a.d(t,{F9:()=>i,Y1:()=>n,fB:()=>r});let r={header:{title:"Welcome Back",subtitle:"Your knowledge library is waiting."},fields:{email:{label:"Email Address",placeholder:"[email protected]"},password:{label:"Password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢"}},buttons:{submit:{label:"Sign In",loadingLabel:"Signing in..."},google:{label:"Continue with Google"},guest:{label:e=>"".concat(e," Tags, No Account"),labelStatic:"Try Without Account"},forgotPassword:"Forgot password?"},divider:"Or continue with",alternateAction:{text:"Don't have an account?",linkText:"Sign up",href:"/auth/signup"}},i={resetEmailSent:"Password reset email sent! Check your inbox and follow the instructions.",emailVerified:"Email verified successfully! You can now sign in.",googleSignInFailed:"Google sign-in failed. Please try again."},n={title:"Reset Password",description:"Enter your email address and we'll send you a link to reset your password.",emailPlaceholder:"Enter your email",buttons:{cancel:"Cancel",submit:{label:"Send Reset Link",loadingLabel:"Sending..."}}}},80705:(e,t,a)=>{a.d(t,{E0:()=>n,cn:()=>r,q4:()=>i});let r={title:"TAGiT Settings",description:"Fine-tune how you learn and remember."},i={title:"Subscription",description:"Manage your TAGiT Pro subscription",emoji:"\uD83D\uDCB3"},n={byLine:"TAGiT by",author:"Adam VisuAl+"}},86125:(e,t,a)=>{a.d(t,{Vt:()=>l,xV:()=>o});var r=a(4981),i=a(4329);let n=[{question:"What is spaced repetition and why does it work?",answer:"Spaced repetition is a scientifically-proven learning technique that shows you information at increasing intervals. Instead of cramming, you review cards just before you'd forget them. This builds stronger, longer-lasting memories and helps you retain up to 90% of what you learn."},{question:"How do I rate my understanding (".concat(r.$_.gotIt,", ").concat(r.$_.almost,", ").concat(r.$_.reviewAgain,")?"),answer:'When you flip a card, rate how well you remembered the answer. "'.concat(r.$_.gotIt,'" means you recalled it confidently, so the card will appear less often. "').concat(r.$_.almost,'" means you were close but not quite, so you\'ll see it at the normal interval. "').concat(r.$_.reviewAgain,"\" means you need more practice, so you'll see the card again sooner. Be honest for best results!")},{question:"What do the difficulty and mastery indicators mean?",answer:"Difficulty uses a star system: one star for ".concat(r.Yg.easy.label,", two stars for ").concat(r.Yg.medium.label,", and three stars for ").concat(r.Yg.hard.label,". Mastery (").concat(r.Kk.new," â ").concat(r.Kk.learning," â ").concat(r.Kk.reviewing," â ").concat(r.Kk.mastered,') tracks your progress with each card. Cards you consistently mark "').concat(r.$_.gotIt,'" move toward ').concat(r.Kk.mastered,', while "').concat(r.$_.reviewAgain,'" ratings keep them in active rotation.')},{question:"What is Focus Mode and how do I use it?",answer:'Focus Mode removes distractions for an immersive study experience. Press "F" on de
1sktop or tap the expand icon on mobile. Use keyboard shortcuts: Space to flip, 1/2/3 to rate ('.concat(r.$_.gotIt,"/").concat(r.$_.almost,"/").concat(r.$_.reviewAgain,"), and arrow keys to navigate. Press Escape to exit.")}],s=[{question:"What are collections and why should I use them?",answer:"TAGiT Collections lets you organize flashcards into meaningful groups by topic, course, project, or however you learn best. Instead of reviewing all cards together, you can focus on specific subjects when you need targeted practice. Perfect for exam prep or deep-diving into topics."},{question:"Can I add the same flashcard to multiple collections?",answer:'Yes! A single flashcard can belong to multiple collections. For example, a card about "React Hooks" could be in both your "JavaScript" collection and your "Interview Prep" collection. This gives you flexibility without duplicating cards.'},{question:"How do I practice a specific collection?",answer:'Click the "Practice" button on any collection card to start a focused study session with only those flashcards. Your reviews still count toward spaced repetition, and the system remembers your progress across all collections.'},{question:"What's the difference between free and Pro collections?",answer:"Free users can create ".concat(i.S9.free," collection to get started with organized learning. Pro TAGiT users get unlimited collections, perfect for managing multiple courses, projects, or areas of study. Upgrade anytime to unlock more organizational power."),link:{text:"View pricing",href:"/pricing"}}],o={title:"How Flashcards Work",dismissLabel:"Dismiss",viewAllLink:{text:"View all FAQs",href:"/faq"},items:n},l={title:"About Collections",dismissLabel:"Dismiss",viewAllLink:{text:"View all FAQs",href:"/faq"},items:s}},86186:(e,t,a)=>{a.d(t,{e:()=>o});var r=a(95155);a(12115);var i=a(90781),n=a(40282);let{emptyState:s}=a(24186).sn;function o(){return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[(0,r.jsx)("div",{className:"w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-6",children:(0,r.jsx)(i.n,{icon:n.A,size:32,className:"text-purple-600"})}),(0,r.jsx)("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:s.title}),(0,r.jsx)("p",{className:"text-gray-600 max-w-md mb-6",children:s.description}),(0,r.jsxs)("div",{className:"bg-purple-50 rounded-lg p-4 max-w-sm",children:[(0,r.jsx)("p",{className:"text-sm text-purple-800 font-medium mb-2",children:s.tips.header}),(0,r.jsx)("ul",{className:"text-sm text-purple-700 space-y-1 text-left",children:s.tips.items.map((e,t)=>(0,r.jsxs)("li",{children:["⢠",e]},t))})]})]})}},87110:(e,t,a)=>{a.d(t,{GN:()=>s,KV:()=>n,PP:()=>i,um:()=>r});let r=["purple","yellow","blue","green","pink"],i="purple",n=280,s=50},89599:(e,t,a)=>{a.d(t,{C:()=>p,H:()=>f});var r=a(95155),i=a(12115),n=a(46676),s=a(46367),o=a(90781),l=a(11168),c=a(41886),d=a(76767),u=a(9829),h=a(89051),g=a(98227),m=a(19448);function p(e){let{className:t=""}=e,{user:a,isGuest:s,signOut:d}=(0,n.A)(),[u,g]=(0,i.useState)(!1),[p,f]=(0,i.useState)(!1);(0,i.useEffect)(()=>{f(!0)},[]);let b=async()=>{await d(),g(!1)};return p?s?(0,r.jsxs)("a",{href:"/auth/login",className:"\n flex items-center gap-2 px-3 py-2 rounded-2xl transition-all duration-300 font-medium text-sm\n bg-white/10 hover:bg-white/20 text-white whitespace-nowrap\n ".concat(t,"\n "),suppressHydrationWarning:!0,children:[(0,r.jsx)(o.n,{icon:c.A,size:18,className:"text-white/70 flex-shrink-0"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0 hidden sm:block",children:[(0,r.jsx)("span",{className:"block text-sm",children:"Guest Mode"}),(0,r.jsx)("span",{className:"block text-xs text-white/60",children:"Click to sync"})]}),(0,r.jsx)("span",{className:"block text-sm sm:hidden",children:"Guest"}),(0,r.jsx)(o.n,{icon:h.A,size:14,className:"text-white/60 flex-shrink-0"})]}):a?(0,r.jsxs)("div",{className:"\n flex items-center gap-2 px-3 py-2 rounded-2xl transition-all duration-300 font-medium text-sm\n bg-white/10 text-white relative overflow-hidden\n ".concat(t,"\n "),children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,r.jsx)(o.n,{icon:l.A,size:18,className:"text-green-400"}),(0,r.jsx)("div",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 bg-green-400 rounded-full animate-pulse"})]}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("span",{className:"block text-sm text-white whitespace-nowrap",children:"Synced"}),(0,r.jsx)("span",{className:"block text-xs text-white/60 truncate max-w-[120px] sm:max-w-[180px]",title:a.email,children:a.email})]})]}),(0,r.jsx)("div",{className:"flex items-center gap-1 flex-shrink-0",children:u?(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("button",{onClick:b,className:"text-xs font-medium text-red-300 hover:text-red-200 px-2 py-1 hover:bg-red-500/20 rounded transition-colors whitespace-nowrap",children:"Sign Out"}),(0,r.jsx)("button",{onClick:()=>g(!1),className:"text-xs font-medium text-white/70 hover:text-white px-1",children:"\xd7"})]}):(0,r.jsx)("button",{onClick:()=>g(!0),className:"p-1.5 hover:bg-white/20 rounded-lg transition-colors",title:"Sign out",children:(0,r.jsx)(o.n,{icon:m.A,size:14,className:"text-white/70 hover:text-white"})})})]}):null:(0,r.jsxs)("div",{className:"\n flex items-center gap-2 px-3 py-2 rounded-2xl transition-all duration-300 font-medium text-sm\n bg-white/10 text-white whitespace-nowrap\n ".concat(t,"\n "),suppressHydrationWarning:!0,children:[(0,r.jsx)("div",{className:"w-4 h-4 bg-white/20 rounded animate-pulse"}),(0,r.jsx)("div",{className:"w-16 h-4 bg-white/20 rounded animate-pulse hidden sm:block"})]})}function f(){let{isGuest:e}=(0,n.A)();return e?(0,r.jsx)(s.KR,{className:"p-6",gradient:!0,children:(0,r.jsxs)("div",{className:"text-center space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"w-12 h-12 bg-gradient-to-r from-purple-500 to-pink-500 rounded-xl flex items-center justify-center",children:(0,r.jsx)(o.n,{icon:l.A,className:"text-white",size:24})}),(0,r.jsx)("div",{className:"w-12 h-12 bg-gradient-to-r from-blue-500 to-teal-500 rounded-xl flex items-center justify-center",children:(0,r.jsx)(o.n,{icon:u.A,className:"text-white",size:24})})]}),(0,r.jsx)("h3",{className:"text-xl font-bold text-gray-800",children:"Sync Across All Your Devices"}),(0,r.jsx)("p",{className:"text-gray-600 max-w-md mx-auto",children:"Sign in to access your tags and flashcards from anywhere. Your data is secured with enterprise-grade encryption."}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-6 text-sm text-gray-600 mb-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(o.n,{icon:g.A,size:16,className:"text-green-600"}),(0,r.jsx)("span",{children:"Cross-device sync"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(o.n,{icon:d.A,size:16,className:"text-blue-600"}),(0,r.jsx)("span",{children:"Secure backup"})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,r.jsx)("a",{href:"/auth/signup",className:"bg-gradient-to-r from-purple-600 to-pink-600 text-white px-6 py-3 rounded-2xl font-semibold hover:from-purple-700 hover:to-pink-700 transition-all duration-300 shadow-lg hover:shadow-xl",children:"Create Account"}),(0,r.jsx)("a",{href:"/auth/login",className:"border-2 border-purple-200 text-purple-700 px-6 py-3 rounded-2xl font-semibold hover:border-purple-300 hover:bg-purple-50 transition-all duration-300",children:"Sign In"})]}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Your local data will be preserved and synced when you sign in"})]})}):null}},91530:(e,t,a)=>{a.d(t,{Hz:()=>c,Vs:()=>l,XV:()=>h,bk:()=>n,dq:()=>u,hD:()=>r,mz:()=>d,xo:()=>i,xr:()=>o,yf:()=>s});let r={title:"Unlock Your Learning Path",subtitle:"For podcast listeners, tutorial watchers, and lifelong learnersâchoose how much you want to remember."},i={monthly:"Monthly",yearly:"Yearly",limitedOffer:"Limited Time Offer"},n={title:"Free Forever",price:"â¬0",description:"For casual learnersâcapture insights from podcasts and tutorials.",buttons:{getStarted:"Get Started Free",currentPlan:"Current Plan"}},s={title:"Pro",tagline:"Remember everything you watchâunlimited.",billingPeriod:{perMonth:"/month",perYear:"/year"},loading:"Loading pricing...",savings:(e,t)=>"Save â¬".concat(e.toFixed(2)," (").concat(t,"% off)")},o={activeTrial:"Active Trial - You have Pro access!",currentPlan:"Current Plan",renewsOn:e=>"Renews on ".concat(e),cancelsOn:e=>"Cancels on ".concat(e),manageButton:"Manage Subscription"},l={buttons:{startTrial:e=>"Start ".concat(e,"-Day Free Trial"),default:"Start 7-Day Free Trial",loading:"Starting Trial..."},ineligible:{title:"You have already used your free trial",description:"Choose a paid plan to continue with unlimited features"}},c={signUpAndSubscribe:"Sign Up & Subscribe",upgradeToPro:"Upgrade to Pro",loading:"Loading...",processing:"Processing..."},d={title:"Pricing Questions",dismissLabel:"Dismiss",viewAllLink:{text:"View all FAQs",href:"/faq"},items:[{question:"What makes TAGiT different from other YouTube note-taking tools?",answer:"TAGiT is a learning companion, not just a bookmarking tool. It combines one-click capture with memory science to help you actually retain what you learn from podcasts and tutorials. Key features include: instant timestamp tagging with summaries, automatic flashcard generation with spaced repetition, Daily Digest emails that capture videos you watched on any device, and Chat with Video for deeper understanding. Most of what you watch is forgotten within daysâTAGiT changes that."},{question:"Is TAGiT Pro worth it for lifelong learners?",answer:"Yes, especially if you regularly learn from YouTube podcasts and tutorials. TAGiT Pro includes: unlimited video tags and summaries, unlimited flashcards with spaced repetition, Daily Digest for cross-device learning, Chat with Video for deep Q&A with content, organized collections, and PDF/Mark
1down exports. Pro pays for itself by improving retention and saving hours of re-watching. Try free for 7 days."},{question:"Can I try TAGiT before committing to a paid plan?",answer:"Absolutely! Start with our free tier (no credit card required) which includes limited monthly tags, summaries, flashcards, and Daily Digest. Ready for more? Try TAGiT Pro free for 7 days with unlimited tags, unlimited features, Chat with Video, collections, and exports. Cancel anytime with no feesâyour knowledge library is never deleted."}]},u={guarantee:"Cancel anytime ⢠No hidden fees"},h={upgradeFailed:"Failed to start upgrade process. Please try again.",pricingNotAvailable:"Pricing not available. Please try again."}},96403:(e,t,a)=>{a.d(t,{T:()=>w});var r=a(95155),i=a(12115),n=a(90781),s=a(3031),o=a(6040),l=a(90832),c=a(89051),d=a(62817),u=a(77849),h=a(50955),g=a(91654),m=a(87110),p=a(24186),f=a(58436),b=a(34256),x=a(53759);let v={purple:"168, 85, 247",yellow:"250, 204, 21",blue:"59, 130, 246",green:"34, 197, 94",pink:"236, 72, 153"},y=(e,t)=>"rgba(".concat(v[e],", ").concat(t,")");function w(e){let{highlight:t,isPro:a,colorLabels:v,sourceTitle:w,sourceVideoTitle:T,onUpdateColor:k,onUpdateNote:j,onDelete:N,onGoToSource:C,onLabelChange:S}=e,[A,E]=(0,i.useState)(!1),[P,O]=(0,i.useState)(!1),[I,D]=(0,i.useState)(t.note||""),[L,F]=(0,i.useState)(!1);p.QO[t.color];let G=m.KV-I.length,{noteCard:M,contentTypes:z}=p.sn,H={tag:g.A,flashcard:h.A,digest:u.A}[t.contentType],R=z[t.contentType],Y=(0,i.useCallback)(()=>{navigator.clipboard.writeText(t.highlightedText),x.o.success("Copied to clipboard")},[t.highlightedText]),_=(0,i.useCallback)(async()=>{await j(t.id,I||null),O(!1)},[t.id,I,j]),W=(0,i.useCallback)(async()=>{F(!0);try{await N(t.id)}finally{F(!1)}},[t.id,N]);return(0,r.jsx)("div",{className:(0,b.cn)("note-card group relative overflow-hidden rounded-2xl","border flex flex-col","transition-all duration-300 ease-out","hover:shadow-xl hover:-translate-y-1"),style:{background:"linear-gradient(135deg, ".concat(y(t.color,.08),", ").concat(y(t.color,.18),")"),borderColor:y(t.color,.25)},children:(0,r.jsxs)("div",{className:"p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"group/quote flex items-start gap-2",children:[(0,r.jsx)("div",{className:(0,b.cn)("flex-1 cursor-pointer transition-opacity duration-200",A?"":"line-clamp-3"),onClick:()=>E(!A),children:(0,r.jsxs)("span",{className:"text-gray-800 leading-relaxed font-medium",children:['"',t.highlightedText,'"']})}),(0,r.jsx)("button",{onClick:Y,className:"p-1.5 text-gray-400 hover:text-gray-700 hover:bg-white/50 rounded-lg transition-all flex-shrink-0",title:M.copyText,children:(0,r.jsx)(n.n,{icon:s.A,size:14})})]}),P?(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("textarea",{value:I,onChange:e=>D(e.target.value),placeholder:M.editNotePlaceholder,rows:3,maxLength:m.KV,className:(0,b.cn)("w-full px-3 py-2 text-sm rounded-xl border","focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent","resize-none bg-white/70 border-white/50"),autoFocus:!0}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("span",{className:(0,b.cn)("text-xs",G<20?"text-red-500":"text-gray-500"),children:[G," ",M.charactersRemaining]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{onClick:()=>{D(t.note||""),O(!1)},className:"text-xs text-gray-500 hover:text-gray-700 px-2 py-1 rounded-lg hover:bg-white/50",children:"Cancel"}),(0,r.jsx)("button",{onClick:_,className:"text-xs text-purple-600 hover:text-purple-700 font-medium px-2 py-1 rounded-lg hover:bg-white/50",children:"Save"})]})]})]}):t.note?(0,r.jsxs)("div",{className:(0,b.cn)("group/note flex items-start gap-2 py-2 px-3 rounded-xl transition-colors duration-200","bg-white/40 hover:bg-white/60"),children:[(0,r.jsx)(n.n,{icon:d.A,size:14,className:"mt-0.5 text-gray-500 flex-shrink-0"}),(0,r.jsx)("div",{className:"flex-1 text-sm text-gray-700 cursor-pointer",onClick:()=>O(!0),children:t.note}),(0,r.jsx)("button",{onClick:()=>O(!0),className:"p-1.5 text-gray-400 hover:text-gray-600 hover:bg-white/50 rounded-lg transition-all",title:M.editNote,children:(0,r.jsx)(n.n,{icon:l.A,size:14})})]}):(0,r.jsxs)("button",{onClick:()=>O(!0),className:"text-xs text-gray-500 hover:text-gray-700 transition-colors flex items-center gap-1.5 px-2 py-1.5 rounded-lg hover:bg-white/40",children:[(0,r.jsx)(n.n,{icon:l.A,size:12}),M.addNote]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-600",children:[(0,r.jsx)(n.n,{icon:H,size:14,className:"opacity-60"}),(0,r.jsx)("span",{className:"font-medium",children:R}),t.sourceTitle&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"opacity-40",children:"\xb7"}),(0,r.jsx)("span",{className:"break-words line-clamp-1",children:t.sourceTitle})]})]}),T&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[(0,r.jsx)(n.n,{icon:u.A,size:14,className:"opacity-60"}),(0,r.jsx)("span",{className:"break-words line-clamp-1",children:T})]}),t.isOrphaned&&(0,r.jsx)("div",{className:"p-2 bg-amber-50 border border-amber-200/50 rounded text-xs text-amber-700",children:M.orphanedWarning}),(0,r.jsxs)("div",{className:"flex items-center justify-between pt-3 mt-auto",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(f.o,{selectedColor:t.color,isPro:a,colorLabels:v,onSelectColor:e=>k(t.id,e),onLabelChange:S,size:"sm"}),(0,r.jsx)("button",{onClick:W,disabled:L,className:"p-2 text-gray-400 hover:text-red-500 rounded-lg hover:bg-red-50/60 transition-colors disabled:opacity-50",title:M.delete,children:(0,r.jsx)(n.n,{icon:o.A,size:16})})]}),(0,r.jsxs)("button",{onClick:()=>C(t),className:(0,b.cn)("flex items-center gap-1.5 px-3 py-2 text-xs font-medium rounded-xl","text-gray-700 bg-white/70 hover:bg-white/90","border border-gray-200/50","transition-all duration-200"),children:[M.goToSource,(0,r.jsx)(n.n,{icon:c.A,size:14})]})]})]})})}},98425:(e,t,a)=>{a.d(t,{v:()=>f});var r=a(95155),i=a(12115),n=a(20063),s=a(90781),o=a(34614),l=a(79803),c=a(87110),d=a(96403),u=a(86186),h=a(24186),g=a(34256),m=a(53759);let p=(0,a(71919).h)("NotesTab");function f(e){var t,a,f;let{className:b}=e,x=(0,n.useRouter)(),[v,y]=(0,i.useState)([]),[w,T]=(0,i.useState)(!0),[k,j]=(0,i.useState)(!1),[N,C]=(0,i.useState)([]),[S,A]=(0,i.useState)(""),[E,P]=(0,i.useState)("content_type"),[O,I]=(0,i.useState)("all"),[D,L]=(0,i.useState)(!1),[F,G]=(0,i.useState)(!1),M=(0,i.useRef)(null),z=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=e=>{M.current&&!M.current.contains(e.target)&&L(!1),z.current&&!z.current.contains(e.target)&&G(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{H(),R()},[]);let H=async()=>{try{var e;T(!0);let t=await fetch("/api/highlights");if(!t.ok)throw Error("Failed to fetch highlights");let a=await t.json();y((null==(e=a.data)?void 0:e.highlights)||[])}catch(e){p.error("Failed to load highlights"),m.o.error("Failed to load notes")}finally{T(!1)}},R=async()=>{try{var e,t;let a=await fetch("/api/highlights/color-labels");if(!a.ok)return void p.warn("Failed to load color labels: HTTP",a.status);let r=await a.json();j((null==(e=r.data)?void 0:e.isPro)||!1),C((null==(t=r.data)?void 0:t.labels)||[])}catch(e){p.warn("Failed to load color labels:",e)}},Y=(0,i.useMemo)(()=>{let e=v;if(S.trim()){let t=S.toLowerCase();e=e.filter(e=>e.highlightedText.toLowerCase().includes(t)||e.note&&e.note.toLowerCase().includes(t))}return"all"!==O&&(e=e.filter(e=>e.color===O)),e},[v,S,O]),_=(0,i.useMemo)(()=>{let e={};for(let t of Y){let a,r;switch(E){case"content_type":a=t.contentType,r=({tag:"Tags",flashcard:"Flashcards",digest:"Daily Digest"})[t.contentType];break;case"color":a=t.color;let i=N.find(e=>e.color===t.color);r=(null==i?void 0:i.label)||h.QO[t.color].name;break;case"date":let n=new Date(t.createdAt),s=Math.floor((new Date().getTime()-n.getTime())/864e5);0===s?(a="today",r="Today"):s<7?(a="this_week",r="This Week"):s<30?(a="this_month",r="This Month"):(a="older",r="Older");break;case"video":a=t.videoId||t.contentId,r=t.sourceTitle||"Video ".concat(a.slice(0,8),"...");break;default:a="all",r="All Notes"}e[a]||(e[a]={label:r,highlights:[]}),e[a].highlights.push(t)}let t=Object.entries(e);if("date"===E){let e=["today","this_week","this_month","older"];t.sort((t,a)=>e.indexOf(t[0])-e.indexOf(a[0]))}else if("content_type"===E){let e=["tag","flashcard","digest"];t.sort((t,a)=>e.indexOf(t[0])-e.indexOf(a[0]))}return t},[Y,E,N]),W=(0,i.useMemo)(()=>[{value:"content_type",label:"Content Type"},{value:"color",label:"Color"},{value:"date",label:"Date"},{value:"video",label:"Video"}],[]),U=(0,i.useMemo)(()=>c.um.map(e=>{var t;return{value:e,label:(null==(t=N.find(t=>t.color===e))?void 0:t.label)||h.QO[e].name}}),[N]),q=(null==(t=W.find(e=>e.value===E))?void 0:t.label)||"Content Type",B="all"===O?"All Colors":(null==(a=U.find(e=>e.value===O))?void 0:a.label)||O,V=(0,i.useCallback)(async(e,t)=>{try{(await fetch("/api/highlights/".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({color:t})})).ok?y(a=>a.map(a=>a.id===e?{...a,color:t}:a)):(p.error("Failed to update color"),m.o.error("Failed to update color"))}catch(e){p.error("Failed to update color"),m.o.error("Failed to update color")}},[]),K=(0,i.useCallback)(async(e,t)=>{try{(await fetch("/api/highlights/".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({note:t})})).ok?(y(a=>a.map(a=>a.id===e?{...a,note:t}:a)),m.o.success("Note saved")):m.o.error("Failed to save note")}catch(e){m.o.error("Failed to save note")}},[]),Q=(0,i.useCallback)(async e=>{try{(await fetch("/api/highlights/".concat(e),{method:"DELETE"})).ok?(y(t=>t.filter(t=>t.id!==e)),m.o.success("Note deleted",{action:{label:"Undo",onClick:()=>H()},duration:5e3})):m.o.error("Failed to delete note")}catch(e){m.o.error("Failed to delete note")}},[]),J=(0,i.useCallback)(e=>{switch(e.contentType){case"tag":x.push("/sessions?tagId=".concat(e.contentId));break;case"flashcard":x.push("/study?card=".concat(e.contentId));break;case"digest":let t=e.videoId?"&video=".concat(e.videoId):"";x.push("/digest?highlight=".concat(e.contentId).concat(t))}},[x]),$=(0,i.useCallback)(async(e,t)=>{var a,r;let i=await fetch("/api/highlights/color-labels",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({color:e,label:t})});if(!i.ok)throw Error((null==(r=(await i.json().catch(()=>({}))).error)?void 0:r.message)||"Failed to save label");let n=null==(a=(await i.json()).data)?void 0:a.label;C(t=>t.find(t=>t.color===e)?t.map(t=>t.color===e?n:t):[...t,n])},[]);if(w)return(0,r.jsx)("div",{className:(0,g.cn)("space-y-4",b),children:[1,2,3].map(e=>(0,r.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4 animate-pulse",children:[(0,r.jsx)("div",{className:"h-1 bg-gray-200 rounded-t-lg mb-4"}),(0,r.jsx)("div",{className:"h-4 bg-gray-200 rounded w-3/4 mb-2"}),(0,r.jsx)("div",{className:"h-3 bg-gray-200 rounded w-1/2"})]},e))});if(0===v.length)return(0,r.jsx)(u.e,{});let X=0;return(0,r.jsxs)("div",{className:(0,g.cn)("space-y-4",b),children:[(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(s.n,{icon:o.A,size:18,className:"absolute left-3.5 to
1p-1/2 -translate-y-1/2 text-purple-400"}),(0,r.jsx)("input",{type:"text",placeholder:"Search ".concat(Y.length," highlighted ").concat(1===Y.length?"note":"notes","..."),value:S,onChange:e=>A(e.target.value),className:(0,g.cn)("w-full pl-10 pr-4 py-2.5 text-sm rounded-xl","bg-white/70 backdrop-blur-sm border border-purple-200/50","focus:outline-none focus:ring-2 focus:ring-purple-400/50 focus:border-purple-300","placeholder:text-gray-400 transition-all duration-200")})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",ref:M,children:[(0,r.jsx)("label",{className:"text-sm text-gray-500 whitespace-nowrap",children:"Group by:"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("button",{onClick:()=>{L(!D),G(!1)},className:(0,g.cn)("flex items-center gap-2 px-3 py-2 text-sm rounded-xl","bg-white/70 backdrop-blur-sm border border-purple-200/50","hover:bg-white/90 hover:border-purple-300 transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-purple-400/50",D&&"ring-2 ring-purple-400/50 border-purple-300"),children:[(0,r.jsx)("span",{className:"text-gray-700",children:q}),(0,r.jsx)(s.n,{icon:l.A,size:16,className:(0,g.cn)("text-purple-400 transition-transform duration-200",D&&"rotate-180")})]}),D&&(0,r.jsx)("div",{className:(0,g.cn)("absolute top-full left-0 mt-1.5 z-20 min-w-[140px]","bg-white/95 backdrop-blur-md rounded-xl","border border-purple-200/50 shadow-xl","overflow-hidden"),children:W.map(e=>(0,r.jsx)("button",{onClick:()=>{P(e.value),L(!1)},className:(0,g.cn)("w-full px-3.5 py-2 text-sm text-left transition-colors duration-150",e.value===E?"bg-purple-100/80 text-purple-700 font-medium":"text-gray-700 hover:bg-purple-50/60"),children:e.label},e.value))})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",ref:z,children:[(0,r.jsx)("label",{className:"text-sm text-gray-500 whitespace-nowrap",children:"Color:"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("button",{onClick:()=>{G(!F),L(!1)},className:(0,g.cn)("flex items-center gap-2 px-3 py-2 text-sm rounded-xl","bg-white/70 backdrop-blur-sm border border-purple-200/50","hover:bg-white/90 hover:border-purple-300 transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-purple-400/50",F&&"ring-2 ring-purple-400/50 border-purple-300"),children:["all"!==O&&(0,r.jsx)("span",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:null==(f=h.QO[O])?void 0:f.bg}}),(0,r.jsx)("span",{className:"text-gray-700",children:B}),(0,r.jsx)(s.n,{icon:l.A,size:16,className:(0,g.cn)("text-purple-400 transition-transform duration-200",F&&"rotate-180")})]}),F&&(0,r.jsxs)("div",{className:(0,g.cn)("absolute top-full left-0 mt-1.5 z-20 min-w-[160px]","bg-white/95 backdrop-blur-md rounded-xl","border border-purple-200/50 shadow-xl","overflow-hidden"),children:[(0,r.jsx)("button",{onClick:()=>{I("all"),G(!1)},className:(0,g.cn)("w-full px-3.5 py-2 text-sm text-left transition-colors duration-150 flex items-center gap-2","all"===O?"bg-purple-100/80 text-purple-700 font-medium":"text-gray-700 hover:bg-purple-50/60"),children:"All Colors"}),U.map(e=>{var t;return(0,r.jsxs)("button",{onClick:()=>{I(e.value),G(!1)},className:(0,g.cn)("w-full px-3.5 py-2 text-sm text-left transition-colors duration-150 flex items-center gap-2",e.value===O?"bg-purple-100/80 text-purple-700 font-medium":"text-gray-700 hover:bg-purple-50/60"),children:[(0,r.jsx)("span",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:null==(t=h.QO[e.value])?void 0:t.bg}}),e.label]},e.value)})]})]})]})]})]}),0===Y.length?(0,r.jsx)("div",{className:"text-center py-8 text-gray-500",children:"No notes match your filters"}):(0,r.jsx)("div",{className:"space-y-6",children:_.map(e=>{var t;let[a,{label:i,highlights:n}]=e,s=X;return(0,r.jsxs)("div",{children:[(0,r.jsxs)("h3",{className:"text-sm font-semibold text-gray-700 mb-3 flex items-center gap-2",children:["color"===E&&(0,r.jsx)("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:null==(t=h.QO[a])?void 0:t.bg}}),i,(0,r.jsxs)("span",{className:"text-gray-400 font-normal",children:["(",n.length,")"]})]}),(0,r.jsx)("div",{className:"columns-1 md:columns-2 xl:columns-3 gap-4",children:n.map((e,t)=>{let a=Math.min((s+t)*40,400);return X++,(0,r.jsx)("div",{className:"break-inside-avoid mb-4",style:{animation:"noteCardFadeIn 0.3s ease-out ".concat(a,"ms both")},children:(0,r.jsx)(d.T,{highlight:e,isPro:k,colorLabels:N,onUpdateColor:V,onUpdateNote:K,onDelete:Q,onGoToSource:J,onLabelChange:$})},e.id)})})]},a)})})]})}}}]);
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.