1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,970065,e=>{"use strict";var r=e.i(843476),t=e.i(647163);function a({className:e,...a}){return(0,r.jsx)("div",{"data-slot":"card",className:(0,t.cn)("bg-gray-900 text-gray-100 border-gray-800 flex flex-col rounded-xl border shadow-sm","py-6",e),...a})}function s({className:e,...a}){return(0,r.jsx)("div",{"data-slot":"card-header",className:(0,t.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...a})}function i({className:e,...a}){return(0,r.jsx)("div",{"data-slot":"card-title",className:(0,t.cn)("leading-none font-semibold text-white",e),...a})}function n({className:e,...a}){return(0,r.jsx)("div",{"data-slot":"card-description",className:(0,t.cn)("text-gray-300 text-sm",e),...a})}function o({className:e,...a}){return(0,r.jsx)("div",{"data-slot":"card-content",className:(0,t.cn)("px-6",e),...a}
1)}function c({className:e,...a}){return(0,r.jsx)("div",{"data-slot":"card-footer",className:(0,t.cn)("flex items-center px-6 [.border-t]:pt-6",e),...a})}e.s(["Card",()=>a,"CardContent",()=>o,"CardDescription",()=>n,"CardFooter",()=>c,"CardHeader",()=>s,"CardTitle",()=>i])},671428,e=>{"use strict";var r=e.i(843476),t=e.i(647163);function a({className:e,...a}){return(0,r.jsx)("div",{"data-slot":"skeleton",className:(0,t.cn)("bg-gray-800 animate-pulse rounded-md",e),...a})}e.s(["Skeleton",()=>a])},16715,e=>{"use strict";let r=(0,e.i(475254).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",()=>r],16715)},107233,e=>{"use strict";let r=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",()=>r],107233)},620278,e=>{"use strict";let r=(0,e.i(475254).default)("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);e.s(["Target",()=>r],620278)},284614,e=>{"use strict";let r=(0,e.i(475254).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s(["User",()=>r],284614)},929365,e=>{"use strict";var r=e.i(266027),t=e.i(912598),a=e.i(869230),s=e.i(992571),i=class extends a.QueryObserver{constructor(e,r){super(e,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:(0,s.infiniteQueryBehavior)()})}getOptimisticResult(e){return e.behavior=(0,s.infiniteQueryBehavior)(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,r){let{state:t}=e,a=super.createResult(e,r),{isFetching:i,isRefetching:n,isError:o,isRefetchError:c}=a,l=t.fetchMeta?.fetchMore?.direction,d=o&&"forward"===l,u=i&&"forward"===l,h=o&&"backward"===l,g=i&&"backward"===l;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,s.hasNextPage)(r,t.data),hasPreviousPage:(0,s.hasPreviousPage)(r,t.data),isFetchNextPageError:d,isFetchingNextPage:u,isFetchPreviousPageError:h,isFetchingPreviousPage:g,isRefetchError:c&&!d&&!h,isRefetching:n&&!u&&!g}}},n=e.i(469637);function o(e={}){var r;let a=(0,t.useQueryClient)(),{limit:s=10,currentWordId:c,sessionContext:l,timeOfDay:d,sessionLength:u,learningGoal:h,difficultyFilter:g,partOfSpeechFilter:m,enabled:x=!0}=e,{data:f,isLoading:p,error:b,fetchNextPage:y,hasNextPage:w,refetch:v}=(r={queryKey:["recommendations","personalized",c,l,d,u,h,g,m,s],queryFn:async({pageParam:e=0})=>{let r=new URLSearchParams({limit:s.toString(),...c&&{currentWordId:c},...l&&{sessionContext:l},...d&&{timeOfDay:d},...u&&{sessionLength:u.toString()},...h&&{learningGoal:h},...g&&{difficultyFilter:g},...m&&{partOfSpeechFilter:m},...e>0&&{offset:e.toString()}}),t=await fetch(`/api/recommendations/personalized?${r}`);if(!t.ok)throw Error(`Failed to fetch recommendations: ${t.statusText}`);return t.json()},getNextPageParam:(e,r)=>{let t=r.reduce((e,r)=>e+r.recommendations.length,0);if(!(e.recommendations.length<s))return t},initialPageParam:0,enabled:x,staleTime:12e4,gcTime:6e5},(0,n.useBaseQuery)(r,i,void 0)),N=f?.pages.flatMap(e=>e.recommendations)||[],j=f?.pages[0]?.totalCount||N.length,k=async()=>{await v()},C=async(e,r,t)=>{try{if(!(await fetch("/api/recommendations/personalized",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wordId:e,action:r,feedback:t,sessionContext:l,timeOfDay:d,sessionLength:u,learningGoal:h})})).ok)throw Error("Failed to provide feedback");a.invalidateQueries({queryKey:["recommendations"]})}catch(e){console.error("Error providing feedback:",e)}};return{recommendations:N,loading:p,error:b instanceof Error?b.message:null,refresh:k,loadMore:()=>{w&&y()},provideFeedback:C,hasMore:w??!1,totalCount:j}}function c(e={}){let{currentWordId:t,sessionContext:a="main_practice",limit:s=5,enabled:i=!0}=e,{data:n,isLoading:o,error:l,refetch:d}=(0,r.useQuery)({queryKey:["recommendations","nextWords",t,a,s],queryFn:async()=>{let e=new URLSearchParams({limit:s.toString(),sessionContext:a,...t&&{currentWordId:t}}
1),r=await fetch(`/api/recommendations/next-words?${e}`);if(!r.ok)throw Error(`Failed to fetch next words: ${r.statusText}`);return r.json()},enabled:i,staleTime:12e4,gcTime:6e5}),u=async()=>{await d()};return{nextWords:n?.nextWords||[],loading:o,error:l instanceof Error?l.message:null,refresh:u}}e.s(["useNextWords",()=>c,"useRecommendations",()=>o],929365)},261072,e=>{"use strict";var r=e.i(843476),t=e.i(522016),a=e.i(271645),s=e.i(647163);e.i(972694);var i=e.i(950467),n=e.i(778204);function o({currentLetter:e,className:o,variant:c="horizontal"}){let[l,d]=(0,a.useState)([]),[u,h]=(0,a.useState)(!0),g=(0,i.useTrackEvent)(),m="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");(0,a.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/browse/alphabet-counts");if(e.ok){let r=await e.json();d(r.counts||[])}}catch(e){console.error("Failed to fetch letter counts:",e)}finally{h(!1)}})()},[]);let x=e=>{let r=l.find(r=>r.letter.toUpperCase()===e);return r?.count||0},f=(e,r)=>{r>0&&g(n.EVENT_NAMES.BROWSE_LETTER_CLICKED,{letter:e,word_count:r})};return"grid"===c?(0,r.jsx)("div",{className:(0,s.cn)("grid grid-cols-6 gap-2 md:grid-cols-8 lg:grid-cols-13",o),children:m.map(a=>{let i=x(a),n=e?.toUpperCase()===a,o=i>0;return(0,r.jsxs)(t.default,{href:o?`/browse/${a.toLowerCase()}`:"#",prefetch:o,className:(0,s.cn)("flex flex-col items-center justify-center p-3 rounded-lg border transition-all duration-200","hover:shadow-md",o?"hover:border-blue-500/50 hover:bg-blue-900/20 border-gray-800":"opacity-50 cursor-not-allowed border-gray-800",n&&"border-blue-500 bg-blue-900/30 shadow-md",!o&&"border-gray-800 bg-gray-900"),onClick:e=>{o?f(a,i):e.preventDefault()},children:[(0,r.jsx)("span",{className:(0,s.cn)("text-lg font-bold",n?"text-blue-400":o?"text-white":"text-gray-600"),children:a}),!u&&(0,r.jsx)("span",{className:(0,s.cn)("text-xs mt-1",n?"text-blue-400":o?"text-gray-400 dark:text-gray-400":"text-gray-600 dark:text-gray-500"),children:o?i.toLocaleString():"0"})]},a)})}):(0,r.jsx)("div",{className:(0,s.cn)("flex flex-wrap gap-1 justify-center",o),children:m.map(a=>{let i=x(a),n=e?.toUpperCase()===a,o=i>0;return(0,r.jsx)(t.default,{href:o?`/browse/${a.toLowerCase()}`:"#",prefetch:o,className:(0,s.cn)("flex items-center justify-center w-10 h-10 rounded-md border transition-all duration-200","text-sm font-semibold",o?"hover:border-blue-500/50 hover:bg-blue-900/20 border-gray-800":"opacity-50 cursor-not-allowed border-gray-800",n&&"border-blue-500 bg-blue-900/30 text-blue-400",!n&&o&&"border-gray-800 text-white hover:text-blue-400",!o&&"border-gray-800 bg-gray-900 text-gray-600"),title:o?`${i} words starting with ${a}`:`No words starting with ${a}`,onClick:e=>{o?f(a,i):e.preventDefault()},children:a},a)})})}function c({currentLetter:e,className:t}){return(0,r.jsx)(o,{currentLetter:e,className:(0,s.cn)("gap-0.5",t),variant:"horizontal"})}function l({currentLetter:e,className:t}){return(0,r.jsx)(o,{currentLetter:e,className:t,variant:"grid"})}e.s(["AlphabetNavigator",()=>o,"AlphabetNavigatorCompact",()=>c,"AlphabetNavigatorGrid",()=>l])},352557,750570,e=>{"use strict";var r=e.i(843476),t=e.i(271645),a=e.i(970065),s=e.i(167881),i=e.i(994179),n=e.i(283086),o=e.i(25652),c=e.i(620278),l=e.i(16715),d=e.i(284614),u=e.i(107233);let h=(0,e.i(475254).default)("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);e.s(["GripVertical",()=>h],750570);var g=e.i(522016),m=e.i(672136),x=e.i(929365),f=e.i(671428),p=e.i(265554),b=e.i(846696);e.i(972694);var y=e.i(950467),w=e.i(778204),v=e.i(647163);function N({onDragStart:e,onDragEnd:N,isDraggingEnabled:j=!1}){let{data:k}=(0,m.useAuthClient)(),[C,P]=(0,t.useState)(!1),[T,S]=(0,t.useState)(1),[E,_]=(0,t.useState)(new Set),M=(0,y.useTrackEvent)(),{recommendations:R,loading:A,error:L,refresh:O}=(0,x.useRecommendations)({limit:8,offset:(T-1)*8,sessionContext:"main_practice",learningGoal:"exploration",enabled:!0});(0,t.useEffect)(()=>{P(!0),S(1)},[]),(0,t.useEffect)(()=>{R.length>
10&&k?.user?.id&&R.forEach(e=>{M(w.EVENT_NAMES.RECOMMENDATION_SHOWN,{recommendation_type:"browse_page",word:e.word,source:"browse_recommendations",algorithm_version:e.algorithmType})})},[R,k?.user?.id,M]);let B=async(e,r,t)=>{if(t.preventDefault(),t.stopPropagation(),!E.has(e)){_(r=>new Set(r).add(e));try{if((await fetch(`/api/favorites/${e}`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)window.dispatchEvent(new CustomEvent("favoriteStatusChanged",{detail:{wordId:e,isFavorited:!0}})),window.dispatchEvent(new CustomEvent("wordAddedToPractice",{detail:{wordId:e,wordName:r}})),b.toast.success(`Added "${r}" to practice!`,{description:"It will appear in your practice queue now."}),O();else throw Error("Failed to add")}catch(e){console.error("Error adding to practice:",e),b.toast.error("Failed to add word")}finally{_(r=>{let t=new Set(r);return t.delete(e),t})}}};return C&&k?.user?.id?A?(0,r.jsx)("div",{className:"mb-12",children:(0,r.jsxs)(a.Card,{className:"bg-gray-900 border-gray-800",children:[(0,r.jsx)(a.CardHeader,{children:(0,r.jsxs)(a.CardTitle,{className:"flex items-center gap-2 text-white",children:[(0,r.jsx)(n.Sparkles,{className:"h-5 w-5 text-blue-400"}),"Loading Your Recommendations..."]})}),(0,r.jsx)(a.CardContent,{children:(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[1,2,3,4].map(e=>(0,r.jsxs)("div",{className:"p-4 border border-gray-800 rounded-lg bg-gray-800",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)(f.Skeleton,{className:"h-6 w-20"}),(0,r.jsx)(f.Skeleton,{className:"h-6 w-6 rounded-full"})]}),(0,r.jsx)(f.Skeleton,{className:"h-6 w-full mb-2"}),(0,r.jsx)(f.Skeleton,{className:"h-4 w-3/4 mb-2"}),(0,r.jsx)(f.Skeleton,{className:"h-4 w-full"})]},e))})})]})}):L||0===R.length?null:(0,r.jsx)("div",{className:"mb-12",children:(0,r.jsxs)(a.Card,{className:"bg-gradient-to-br from-blue-900/30 to-indigo-900/30 border-blue-500/30",children:[(0,r.jsxs)(a.CardHeader,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(n.Sparkles,{className:"h-5 w-5 text-blue-400"}),(0,r.jsx)(a.CardTitle,{className:"text-xl text-white",children:"Recommended for You"}),(0,r.jsxs)(i.Badge,{variant:"secondary",className:"bg-blue-500/20 text-blue-400",children:[(0,r.jsx)(d.User,{className:"h-3 w-3 mr-1"}),"Personalized"]})]}),(0,r.jsx)(s.Button,{variant:"ghost",size:"sm",onClick:()=>{S(e=>e+1),O()},className:"text-gray-400 hover:text-white",children:(0,r.jsx)(l.RefreshCw,{className:"h-4 w-4"})})]}),(0,r.jsx)("p",{className:"text-sm text-gray-400 mt-2",children:"AI-powered word suggestions based on your learning progress and preferences"})]}),(0,r.jsxs)(a.CardContent,{children:[(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:R.slice(0,8).map(t=>{let a=E.has(t.id);return(0,r.jsxs)("div",{draggable:j,onDragStart:r=>{if(j&&e){r.dataTransfer.effectAllowed="move",r.dataTransfer.setData("text/plain",JSON.stringify({wordId:t.id,word:t.word}));let a=r.currentTarget,s=a.getBoundingClientRect();r.dataTransfer.setDragImage(a,s.width/2,s.height/2),e(t.id,t.word)}},onDragEnd:()=>{j&&N&&N()},className:(0,v.cn)("relative group",j&&"cursor-grab active:cursor-grabbing"),children:[j&&(0,r.jsx)("div",{className:"absolute top-2 left-2 z-20 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:(0,r.jsx)("div",{className:"p-1 rounded bg-black/50 text-white",children:(0,r.jsx)(h,{className:"h-3 w-3"})})}),(0,r.jsxs)(g.default,{prefetch:!1,href:`/word/${t.slug||t.word.toLowerCase()}`,draggable:!1,className:"p-4 bg-gray-900 rounded-lg border border-gray-800 hover:border-blue-500/50 hover:shadow-md transition-all duration-200 relative block",onClick:()=>{M(w.EVENT_NAMES.RECOMMENDATION_CLICKED,{recommendation_type:"browse_page",word:t.word,source:"browse_recommendations",algorithm_version:t.algorithmType})},children:[(0,r.jsx)("div",{className:"absolute top-3 right-3 z-10",children:(0,r.jsx)(p.FavoriteButtonIcon,{wordId:t.id,word:t.word,className:"h-5 w-5"})}),(0,r.jsx)("div",{className:"flex items-center justify-between mb-3 pr-8",children:(0,r.jsx)(i.Badge,{variant:"secondary",className:`text-xs ${(e=>{switch(e){case"beginner":return"bg-green-500/20 text-green-400";case"intermediate":return"bg-yellow-500/20 text-yellow-400";case"advanced":return"bg-orange-500/20 text-orange-400";case"expert":return"bg-red-500/20 text-red-400";default:return"bg-gray-500/20 text-gray-400"}})(t.difficulty)}`,children:t.difficulty})}),(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsx)("h3",{className:"font-semibold text-white",children:t.word}),(0,r.jsxs)("div",{className:"flex items-center gap-1 mt-1 text-gray-400",children:[(e=>{switch(e){case"difficulty_progression":return(0,r.jsx)(o.TrendingUp,{className:"h-4 w-4"});case"phonetic_learning_path":return(0,r.jsx)(c.Target,{className:"h-4 w-4"});case"behavioral_pattern":return(0,r.jsx)(d.User,{className:"h-4 w-4"});default:return(0,r.jsx)(n.Sparkles,{className:"h-4 w-4"})}})(t.algorithmType),(0,r.jsx)("span",{className:"text-xs text-gray-400 dark:text-gray-400",children:(e=>{switch(e){case"difficulty_progression":return"Perfect Difficulty";case"phonetic_learning_path":return"Sound Pattern";case"behavioral_pattern":return"Your Style";case"collaborative_filtering":return"Popular Pick";case"spaced_repetition":return"Review Time";default:return"AI Pick"}})(t.algorithmType)})]})]}),(0,r.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("div",{className:"h-2 w-2 rounded-full bg-blue-500"}),(0,r.jsxs)("span",{className:"text-xs text-gray-400 dark:text-gray-400",children:[Math.round(100*t.confidence),"% match"]})]})}),(0,r.jsx)(s.Button,{variant:"outline",size:"sm",className:"w-full text-xs bg-transparent border-gray-700 text-gray-300 hover:bg-gray-800",onClick:e=>B(t.id,t.word,e),disabled:a,children:a?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mr-1.5 h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Adding..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.Plus,{className:"h-3 w-3 mr-1.5"}),"Add to Practice"]})})]})]},t.id)})}),(0,r.jsxs)("div",{className:"flex items-center justify-between pt-4 border-t border-gray-800",children:[(0,r.jsxs)("div",{className:"text-sm text-gray-400",children:[(0,r.jsx)(n.Sparkles,{className:"h-4 w-4 inline mr-1"}),"These words are selected based on your learning patterns"]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(g.default,{prefetch:!1,href:"/dashboard/recommendations",children:(0,r.jsx)(s.Button,{variant:"outline",size:"sm",className:"bg-transparent border-gray-700 text-gray-300 hover:bg-gray-800",children:"View All"})}),(0,r.jsx)(g.default,{prefetch:!1,href:"/dashboard/recommendations?tab=phonetic_learning_path",children:(0,r.jsxs)(s.Button,{variant:"outline",size:"sm",className:"bg-transparent border-gray-700 text-gray-300 hover:bg-gray-800",children:[(0,r.jsx)(c.Target,{className:"h-4 w-4 mr-2"}),"Learning Path"]})})]})]})]})]})}):null}e.s(["BrowseRecommendations",()=>N],352557)}]);
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.