1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,25809,e=>{"use strict";var t=e.i(68834),r=e.i(79473);let s=(0,t.create)()((0,r.persist)(e=>({email:"",codeforcesId:"",justRegistered:!1,profileCompleted:!1,hydrated:!1,setCodeforcesId:t=>e({codeforcesId:t}),setEmail:t=>e({email:t}),setJustRegistered:t=>e({justRegistered:t}),setProfileCompleted:t=>e({profileCompleted:t}),setHydrated:t=>e({hydrated:t})}),{name:"user-store",onRehydrateStorage:()=>e=>{e?.setHydrated(!0)},partialize:e=>({codeforcesId:e.codeforcesId,profileCompleted:e.profileCompleted,hydrated:e.hydrated}),storage:(0,r.createJSONStorage)(()=>localStorage)}));e.s(["default",0,s])},75830,86318,e=>{"use strict";var t=e.i(71645),r=e.i(30030),s=e.i(20783),i=e.i(43476);function a(e){var r;let a,n=(r=e,(a=t.forwardRef((e,r)=>{let{children:i,...a}=e;if(t.isValidElement(i)){var n;let e,o,l=(n=i,(o=(e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?n.ref:(o=(e=Object.getOwnPropertyDescriptor(n,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?n.props.ref:n.props.ref||n.ref),c=function(e,t){let r={...t};for(let s in t){let i=e[s],a=t[s];/^on[A-Z]/.test(s)?i&&a?r[s]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[s]=i):"style"===s?r[s]={...i,...a}:"className"===s&&(r[s]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(a,i.props);return i.type!==t.Fragment&&(c.ref=r?(0,s.composeRefs)(r,l):l),t.cloneElement(i,c)}return t.Children.count(i)>1?t.Children.only(null):null})).displayName=`${r}.SlotClone`,a),l=t.forwardRef((e,r)=>{let{children:s,...a}=e,l=t.Children.toArray(s),c=l.find(o);if(c){let e=c.props.children,s=l.map(r=>r!==c?r:t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null);return(0,i.jsx)(n,{...a,ref:r,children:t.isValidElement(e)?t.cloneElement(e,void 0,s):null})}return(0,i.jsx)(n,{...a,ref:r,children:s})});return l.displayName=`${e}.Slot`,l}var n=Symbol("radix.slottable");function o(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===n}function l(e){let n=e+"CollectionProvider",[o,l]=(0,r.createContextScope)(n),[c,d]=o(n,{collectionRef:{current:null},itemMap:new Map}),u=e=>{let{scope:r,children:s}=e,a=t.default.useRef(null),n=t.default.useRef(new Map).current;return(0,i.jsx)(c,{scope:r,itemMap:n,collectionRef:a,children:s})};u.displayName=n;let f=e+"CollectionSlot",h=a(f),m=t.default.forwardRef((e,t)=>{let{scope:r,children:a}=e,n=d(f,r),o=(0,s.useComposedRefs)(t,n.collectionRef);return(0,i.jsx)(h,{ref:o,children:a})});m.displayName=f;let p=e+"CollectionItemSlot",g="data-radix-collection-item",y=a(p),x=t.default.forwardRef((e,r)=>{let{scope:a,children:n,...o}=e,l=t.default.useRef(null),c=(0,s.useComposedRefs)(r,l),u=d(p,a);return t.default.useEffect(()=>(u.itemMap.set(l,{ref:l,...o}),()=>void u.itemMap.delete(l))),(0,i.jsx)(y,{...{[g]:""},ref:c,children:n})});return x.displayName=p,[{Provider:u,Slot:m,ItemSlot:x},function(r){let s=d(e+"CollectionConsumer",r);return t.default.useCallback(()=>{let e=s.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(s.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[s.collectionRef,s.itemMap])},l]}var c=new WeakMap;function d(e,t){var r,s;let i,a,n;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let o=(r=e,s=t,i=r.length,(n=(a=u(s))>=0?a:i+a)<0||n>=i?-1:n);return -1===o?void 0:e[o]}function u(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],c.set(this,!0)}set(e,t){return c.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let s,i=this.has(t),a=this.#e.length,n=u(e),o=n>=0?n:a+n,l=o<0||o>=a?-1:o;if(l===this.size||i&&l===this.size-1||-1===l)return this.set(t,r),this;let c=this.size+ +!i;n<0&&o++;let d=[...this.#e],f=!1;for(let e=o;e<c;e++)if(o===e){let a=d[e];d[e]===t&&(a=d[e+1]),i&&this.delete(t),s=this.get(a),this.set(t,r)}else{f||d[e-1]!==t||(f=!0);let r=d[f?e:e-1],i=s;s=this.get(r),this.delete(r),this.set(r,i)}return this}with(t,r,s){let i=new e(this);return i.insert(t,r,s),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let s=this.#e.indexOf(e);return -1===s?this:this.insert(s,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let s=this.#e.indexOf(e);return -1===s?this:this.insert(s+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=d(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=d(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return d(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let s=r+t;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let s=r+t;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(e,t){let r=0;for(let s of this){if(Reflect.apply(e,t,[s,r,this]))return s;r++}}findIndex(e,t){let r=0;for(let s of this){if(Reflect.apply(e,t,[s,r,this]))return r;r++}return -1}filter(t,r){let s=[],i=0;for(let e of this)Reflect.apply(t,r,[e,i,this])&&s.push(e),i++;return new e(s)}map(t,r){let s=[],i=0;for(let e of this)s.push([e[0],Reflect.apply(t,r,[e,i,this])]),i++;return new e(s)}reduce(...e){let[t,r]=e,s=0,i=r??this.at(0);for(let r of this)i=0===s&&1===e.length?r:Reflect.apply(t,this,[i,r,s,this]),s++;return i}reduceRight(...e){let[t,r]=e,s=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let i=this.at(r);
1s=r===this.size-1&&1===e.length?i:Reflect.apply(t,this,[s,i,r,this])}return s}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),s=this.get(r);t.set(r,s)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let s=new e,i=this.size-1;if(void 0===t)return s;t<0&&(t+=this.size),void 0!==r&&r>0&&(i=r-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),r=this.get(t);s.set(t,r)}return s}every(e,t){let r=0;for(let s of this){if(!Reflect.apply(e,t,[s,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let s of this){if(Reflect.apply(e,t,[s,r,this]))return!0;r++}return!1}}),e.s(["createCollection",()=>l],75830);var f=t.createContext(void 0);function h(e){let r=t.useContext(f);return e||r||"ltr"}e.s(["useDirection",()=>h],86318)},13118,e=>{"use strict";var t=e.i(43476),r=e.i(66027),s=e.i(25809),i=e.i(71645),a=e.i(81140),n=e.i(30030),o=e.i(75830),l=e.i(20783),c=e.i(10772),d=e.i(48425),u=e.i(30207),f=e.i(69340),h=e.i(86318),m="rovingFocusGroup.onEntryFocus",p={bubbles:!1,cancelable:!0},g="RovingFocusGroup",[y,x,v]=(0,o.createCollection)(g),[b,w]=(0,n.createContextScope)(g,[v]),[j,k]=b(g),S=i.forwardRef((e,r)=>(0,t.jsx)(y.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,t.jsx)(y.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,t.jsx)(N,{...e,ref:r})})}));S.displayName=g;var N=i.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:s,orientation:n,loop:o=!1,dir:c,currentTabStopId:y,defaultCurrentTabStopId:v,onCurrentTabStopIdChange:b,onEntryFocus:w,preventScrollOnEntryFocus:k=!1,...S}=e,N=i.useRef(null),R=(0,l.useComposedRefs)(r,N),C=(0,h.useDirection)(c),[E,I]=(0,f.useControllableState)({prop:y,defaultProp:v??null,onChange:b,caller:g}),[F,q]=i.useState(!1),P=(0,u.useCallbackRef)(w),T=x(s),D=i.useRef(!1),[O,z]=i.useState(0);return i.useEffect(()=>{let e=N.current;if(e)return e.addEventListener(m,P),()=>e.removeEventListener(m,P)},[P]),(0,t.jsx)(j,{scope:s,orientation:n,dir:C,loop:o,currentTabStopId:E,onItemFocus:i.useCallback(e=>I(e),[I]),onItemShiftTab:i.useCallback(()=>q(!0),[]),onFocusableItemAdd:i.useCallback(()=>z(e=>e+1),[]),onFocusableItemRemove:i.useCallback(()=>z(e=>e-1),[]),children:(0,t.jsx)(d.Primitive.div,{tabIndex:F||0===O?-1:0,"data-orientation":n,...S,ref:R,style:{outline:"none",...e.style},onMouseDown:(0,a.composeEventHandlers)(e.onMouseDown,()=>{D.current=!0}),onFocus:(0,a.composeEventHandlers)(e.onFocus,e=>{let t=!D.current;if(e.target===e.currentTarget&&t&&!F){let t=new CustomEvent(m,p);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=T().filter(e=>e.focusable);A([e.find(e=>e.active),e.find(e=>e.id===E),...e].filter(Boolean).map(e=>e.ref.current),k)}}D.current=!1}),onBlur:(0,a.composeEventHandlers)(e.onBlur,()=>q(!1))})})}),R="RovingFocusGroupItem",C=i.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:s,focusable:n=!0,active:o=!1,tabStopId:l,children:u,...f}=e,h=(0,c.useId)(),m=l||h,p=k(R,s),g=p.currentTabStopId===m,v=x(s),{onFocusableItemAdd:b,onFocusableItemRemove:w,currentTabStopId:j}=p;return i.useEffect(()=>{if(n)return b(),()=>w()},[n,b,w]),(0,t.jsx)(y.ItemSlot,{scope:s,id:m,focusable:n,active:o,children:(0,t.jsx)(d.Primitive.span,{tabIndex:g?0:-1,"data-orientation":p.orientation,...f,ref:r,onMouseDown:(0,a.composeEventHandlers)(e.onMouseDown,e=>{n?p.onItemFocus(m):e.preventDefault()}),onFocus:(0,a.composeEventHandlers)(e.onFocus,()=>p.onItemFocus(m)),onKeyDown:(0,a.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void p.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,r){var s;let i=(s=e.key,"rtl"!==r?s:"ArrowLeft"===s?"ArrowRight":"ArrowRight"===s?"ArrowLeft":s);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return E[i]}(e,p.orientation,p.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=v().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var r,s;"prev"===t&&i.reverse();let a=i.indexOf(e.currentTarget);i=p.loop?(r=i,s=a+1,r.map((e,t)=>r[(s+t)%r.length])):i.slice(a+1)}setTimeout(()=>A(i))}}),children:"function"==typeof u?u({isCurrentTabStop:g,hasTabStop:null!=j}):u})})});C.displayName=R;var E={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function A(e,t=!1){let r=document.activeElement;for(let s of e)if(s===r||(s.focus({preventScroll:t}),document.activeElement!==r))return}var I=e.i(96626),F="Tabs",[q,P]=(0,n.createContextScope)(F,[w]),T=w(),[D,O]=q(F),z=i.forwardRef((e,r)=>{let{__scopeTabs:s,value:i,onValueChange:a,defaultValue:n,orientation:o="horizontal",dir:l,activationMode:u="automatic",...m}=e,p=(0,h.useDirection)(l),[g,y]=(0,f.useControllableState)({prop:i,onChange:a,defaultProp:n??"",caller:F});return(0,t.jsx)(D,{scope:s,baseId:(0,c.useId)(),value:g,onValueChange:y,orientation:o,dir:p,activationMode:u,children:(0,t.jsx)(d.Primitive.div,{dir:p,"data-orientation":o,...m,ref:r})})});z.displayName=F;var M="TabsList",K=i.forwardRef((e,r)=>{let{__scopeTabs:s,loop:i=!0,...a}=e,n=O(M,s),o=T(s);return(0,t.jsx)(S,{asChild:!0,...o,orientation:n.orientation,dir:n.dir,loop:i,children:(0,t.jsx)(d.Primitive.div,{role:"tablist","aria-orientation":n.orientation,...a,ref:r})})});K.displayName=M;var _="TabsTrigger",B=i.forwardRef((e,r)=>{let{__scopeTabs:s,value:i,disabled:n=!1,...o}=e,l=O(_,s),c=T(s),u=$(l.baseId,i),f=L(l.baseId,i),h=i===l.value;return(0,t.jsx)(C,{asChild:!0,...c,focusable:!n,active:h,children:(0,t.jsx)(d.Primitive.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":f,"data-state":h?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:u,...o,ref:r,onMouseDown:(0,a.composeEventHandlers)(e.onMouseDown,e=>{n||0!==e.button||!1!==e.ctrlKey?e.preventDefault():l.onValueChange(i)}),onKeyDown:(0,a.composeEventHandlers)(e.onKeyDown,e=>
1{[" ","Enter"].includes(e.key)&&l.onValueChange(i)}),onFocus:(0,a.composeEventHandlers)(e.onFocus,()=>{let e="manual"!==l.activationMode;h||n||!e||l.onValueChange(i)})})})});B.displayName=_;var H="TabsContent",V=i.forwardRef((e,r)=>{let{__scopeTabs:s,value:a,forceMount:n,children:o,...l}=e,c=O(H,s),u=$(c.baseId,a),f=L(c.baseId,a),h=a===c.value,m=i.useRef(h);return i.useEffect(()=>{let e=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,t.jsx)(I.Presence,{present:n||h,children:({present:s})=>(0,t.jsx)(d.Primitive.div,{"data-state":h?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!s,id:f,tabIndex:0,...l,ref:r,style:{...e.style,animationDuration:m.current?"0s":void 0},children:s&&o})})});function $(e,t){return`${e}-trigger-${t}`}function L(e,t){return`${e}-content-${t}`}V.displayName=H;var Q=e.i(47163);function U({className:e,...r}){return(0,t.jsx)(z,{"data-slot":"tabs",className:(0,Q.cn)("flex flex-col gap-2",e),...r})}function G({className:e,...r}){return(0,t.jsx)(K,{"data-slot":"tabs-list",className:(0,Q.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...r})}function J({className:e,...r}){return(0,t.jsx)(B,{"data-slot":"tabs-trigger",className:(0,Q.cn)("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function W({className:e,...r}){return(0,t.jsx)(V,{"data-slot":"tabs-content",className:(0,Q.cn)("flex-1 outline-none",e),...r})}function Y({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"skeleton",className:(0,Q.cn)("bg-accent-foreground animate-pulse rounded-md",e),...r})}let Z=()=>(0,t.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,t.jsx)(Y,{className:"h-10 w-full mt-5"}),(0,t.jsx)(Y,{className:"h-10 w-40 mt-5"}),(0,t.jsx)("div",{className:"flex flex-col gap-3 mt-10",children:Array.from({length:5}).map((e,r)=>(0,t.jsx)(Y,{className:"h-20 w-full mt-2"},r))})]}),X={"binary search":["binary search"],"ternary search":["ternary search"],sorting:["sortings"],"two pointers":["two pointers"],"sliding window":["two pointers"],"prefix sum":["prefix sums"],"difference array":["difference array"],"prefix difference array":["prefix sums","difference array"],subarray:["arrays"],matrix:["matrices"],implementation:["implementation"],math:["math"],"number theory":["number theory"],"gcd lcm":["math"],"modular arithmetic":["math"],combinatorics:["combinatorics"],probability:["probabilities"],"bit manipulation":["bitmasks"],bitmasking:["bitmasks"],greedy:["greedy"],constructive:["constructive algorithms"],"dynamic programming":["dp"],dp:["dp"],knapsack:["dp"],"dp on trees":["dp","trees"],graph:["graphs"],graphs:["graphs"],dfs:["dfs"],bfs:["bfs"],"shortest path":["shortest paths"],dijkstra:["shortest paths"],"bellman ford":["shortest paths"],"floyd warshall":["shortest paths"],mst:["minimum spanning tree"],"topological sort":["graphs"],"strongly connected components":["graphs"],scc:["graphs"],tree:["trees"],trees:["trees"],"binary tree":["trees"],lca:["trees"],"centroid decomposition":["trees"],"binary lifting":["trees"],stack:["data structures"],queue:["data structures"],deque:["data structures"],heap:["data structures"],"priority queue":["data structures"],"set map":["data structures"],"segment tree":["segment tree"],"fenwick tree":["fenwick tree"],"binary indexed tree":["fenwick tree"],"sparse table":["sparse table"],"disjoint set union":["dsu"],"union find":["dsu"],string:["strings"],strings:["strings"],"pattern matching":["strings"],kmp:["strings"],"z algorithm":["strings"],hashing:["hashing"],"rolling hash":["hashing"],trie:["trees"],geometry:["geometry"],"computational geometry":["geometry"],"game theory":["games"],games:["games"],"brute force":["brute force"],backtracking:["brute force"],recursion:["recursion"],"meet in the middle":["meet-in-the-middle"],"divide and conquer":["divide and conquer"],interactive:["interactive"],flows:["flows"],"network flow":["flows"],"constructive algorithms":["constructive algorithms"],randomized:["random"],probabilities:["probabilities"]};var ee=e.i(6081),et=e.i(97265),er=e.i(49148);let es=e=>e.toLowerCase().replace(/[^a-z ]/g,"").trim();var ei=e.i(50962),ei=ei,ea=e.i(23287),ea=ea,en=e.i(22016),eo=e.i(28231);let el=({question:e})=>{let r=`https://codeforces.com/contest/${e.contestId}/problem/${e.index}`;return(0,t.jsx)(en.default,{href:r,children:(0,t.jsxs)("div",{className:`flex justify-between items-center border p-3 text-primary 2 border-accent-foreground rounded-lg font-sans 3 ${e.solved?"bg-green-100/20":"hover:bg-accent-foreground"}`,children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h1",{className:"text-lg flex items-center gap-2",children:[e.name,e.solved&&(0,t.jsx)(ea.default,{className:"size-4 text-blue-500 mb-0.5"})]}),(0,t.jsxs)("p",{className:"text-gray-500",children:["Rating: ",e.rating]})]}),(0,t.jsx)("div",{className:"flex items-center gap-3",children:(0,t.jsx)(en.default,{href:r,target:"_blank",children:(0,t.jsxs)(eo.Tooltip,{children:[(0,t.jsx)(eo.TooltipTrigger,{children:(0,t.jsx)(ei.default,{className:"size-5"})}),(0,t.jsx)(eo.TooltipContent,{children:(0,t.jsx)("p",{className:"font-sans",children:"Visit"})})]})})})]},e._id)})},ec=async({username:e,rating:t,dailyLimit:r,improveTopics:s,experiencedTopics:i,leveledQuestions:a})=>{try{let n=await fetch("/api/ai",{method:"POST",body:JSON.stringify({username:e,rating:t,dailyLimit:r,improveTopics:s,experiencedTopics:i,leveledQuestions:a})}),o=await n.json();if(!n.ok)throw Error(o.message||"Failed to fetch AI selected problems");return console.log("Data",o),{success:!0,selectedProblems:o.selectedProblems}}catch(e){return console.error("Error fetching AI selected problems:",e),{success:!1,message:e.message||"Error fetching AI selected problems"}}},ed=()=>(0,t.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,t.jsx)(Y,{className:"h-10 w-full mt-5"}),(0,t.jsx)(Y,{className:"h-10 w-40 mt-5"}),(0,t.jsx)("div",{className:"flex flex-col gap-3 mt-10",children:Array.from({length:5}).map((e,r)=>(0,t.jsx)(Y,{className:"h-20 w-full mt-2"},r))})]}),eu=()=>{let{hydrated:e,username:s}=(0,er.profileStore)(),{data:i,isLoading:a,isError:n}=(0,r.useQuery)({queryKey:["past-questions"],queryFn:()=>(0,ee.userPrevQuestions)(s),enabled:e&&!!s});return!e||a?(0,t.jsx)(ed,{}):(0,t.jsx)("div",{className:"flex flex-col gap-3 my-5",children:i&&i.data.length>0?i.data.map(e=>(0,t.jsx)(el,{question:e})):(0,t.jsx)("p",{className:"text-gray-400",children:"No past questions foun
3d."})})};var ef=e.i(46696),eh=e.i(67881);let em=async(e,t)=>fetch("/api/redis/sync-questions",{method:"POST",body:JSON.stringify({codeforcesId:e,updatedTodaysQuestions:t})}).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.message||"Sync failed");return t}),ep=async(e,t,r)=>{try{let s=await fetch("/api/user/update-questions",{method:"PUT",body:JSON.stringify({codeforcesId:e,updatedTodaysQuestions:t,solvedQuestionsTags:r})}),i=await s.json();if(!s.ok)throw Error(i.message||"Failed to update questions in DB");return{success:!0,message:i.message||"Questions updated in DB successfully",data:i}}catch(e){return console.error("Error updating questions in DB:",e),{success:!1,message:e.message||"Error updating questions in DB"}}};var eg=e.i(45532),ey=e.i(59338),ex=e.i(60112);let ev=({tabValue:e})=>{let{hydrated:s,todaysQuestions:a,setTodaysQuestions:n}=(0,et.problemsStore)(),{codeforcesId:o,setCodeforcesId:l}=(0,er.profileStore)(),{openCodeforcesDialog:c,setOpenCodeforcesDialog:d}=(0,ex.appStore)(),[u,f]=(0,i.useState)(new Set),{data:h,isLoading:m,isRefetching:p,refetch:g}=(0,r.useQuery)({queryKey:["userSubmissions"],queryFn:()=>(0,ee.getUserSubmissions)(o),enabled:!1}),y=async()=>{if("past"===e)return void(0,ef.toast)("Sync is only available for today's problems.");let t=await (0,ey.checkVerified)();if(!t.verified)return void d(!0);{l(t.codeforcesId);let e=await g();if(e.data&&e.data.submissions&&0===e.data.submissions.length)return void(0,ef.toast)("You haven't made any submissions yet.")}};(0,i.useEffect)(()=>{if(!h)return;let e=new Set;h.submissions.forEach(t=>{if("OK"===t.verdict){let r=`${t.problem.name}`;e.add(r)}}),console.log("User submissions set updated:",e),f(e)},[h]),(0,i.useEffect)(()=>{if(!a||0===u.size)return;let e=!1,t=[],r=a.map(r=>{if(u.has(r.name)){var s;return e=!0,t.push((s=r.rating)>=800&&s<=1e3?"easy":s>1e3&&s<=1200?"medium":s>1200&&s<=1400?"hard":"expert"),{...r,solved:!0}}return r});if(!e||(n(r),0===t.length)){console.log("No new solved questions to sync."),(0,ef.toast)("No new solved questions to sync.");return}(async()=>{let e=await ep(o,r,t);e.success?em(o,r).then(e=>{(0,ef.toast)(e.message||"Questions synced in the background successfully.")}).catch(e=>{(0,ef.toast)(e.message||"Failed to sync questions in the background.")}):ef.toast.error(e.message||"Failed to update questions in DB.")})()},[u]);let x=!a||0===a.length||m||p||!s;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh.Button,{onClick:y,disabled:x,className:"cursor-pointer",children:m||p?"Syncing...":"Sync Submissions"}),c&&(0,t.jsx)(eg.default,{})]})};e.s(["default",0,()=>{let{hydrated:e,profileCompleted:a}=(0,s.default)(),{hydrated:n,username:o,rating:l,dailyLimit:c,improveTopics:d,experiencedTopics:u}=(0,er.profileStore)(),{hydrated:f,todaysQuestions:h,setTodaysQuestions:m}=(0,et.problemsStore)(),[p,g]=(0,i.useState)("today"),[y,x]=(0,i.useState)(5),{leveledQuestions:v,loading:b,isError:w}=(()=>{let{hydrated:e,leveledQuestions:t,setLeveledQuestions:s}=(0,et.problemsStore)(),{username:a,rating:n,updatedSettings:o,hydrated:l,improveTopics:c,experiencedTopics:d}=(0,er.profileStore)(),[u,f]=(0,i.useState)(!1),[h,m]=(0,i.useState)(!0),p=o&&o.rating?o.rating:n,g=p-300,y=p+300,x=c.flatMap(e=>X[es(e)]??[]),v=d.flatMap(e=>X[es(e)]??[]),b=async()=>{let e=await (0,ee.getQuestions)({ratingLow:g,ratingHigh:y});if(!e.success)throw Error("Failed to fetch problems");let t=await (0,ee.userPrevQuestions)(a);if(!t.success)throw Error("Failed to fetch previous questions");let r=new Set(t.data.map(e=>e.id)),s=e.data.data.filter(e=>!r.has(e._id)).filter(e=>e.tags.some(e=>x.includes(es(e)))).map(e=>{let t,r;return{problem:e,score:(t=Math.exp(-Math.pow(e.rating-p,2)/8e4),r=.3,e.tags.some(e=>x.includes(es(e)))?r=1:e.tags.some(e=>v.includes(es(e)))&&(r=.6),.65*t+.35*r)}}).sort((e,t)=>t.score-e.score).filter(e=>!r.has(e.problem._id));return{low:s.filter(e=>e.problem.rating<p),mid:s.filter(e=>e.problem.rating===p),high:s.filter(e=>e.problem.rating>p)}},w=(0,r.useQuery)({queryKey:["leveledQuestions",a,p,c.join(","),d.join(",")],queryFn:b,enabled:!1,staleTime:6e5});return(0,i.useEffect)(()=>{e&&l&&0!==c.length&&(t.low.length>0||t.mid.length>0||t.high.length>0?m(!1):(m(!0),w.refetch().then(({data:e})=>{e&&s(e)}).catch(()=>f(!0)).finally(()=>m(!1))))},[c.join(","),l,e]),{leveledQuestions:t,loading:h,isError:u}}
3)(),j=v.low.length+v.mid.length+v.high.length,{data:k,isError:S}=(0,r.useQuery)({queryKey:["questions",o],queryFn:()=>ec({username:o,rating:l,dailyLimit:c,improveTopics:d,experiencedTopics:u,leveledQuestions:v}),enabled:!!(n&&!b&&j>0)});(0,i.useEffect)(()=>{k?.selectedProblems&&m(k.selectedProblems)},[k,m]);let N=h.length>0;return e&&n&&f&&j>0&&N?w||S?(0,t.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,t.jsx)("p",{className:"text-red-500",children:"Error loading questions. Please try again later."})}):(0,t.jsx)("div",{className:"flex flex-1 flex-col",children:a?(0,t.jsx)("div",{className:"flex flex-col flex-1",children:(0,t.jsxs)(U,{defaultValue:"today",onValueChange:e=>g(e),className:"font-sans",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)(G,{className:"bg-white/80 *:px-3",children:[(0,t.jsx)(J,{value:"today",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"Today"}),(0,t.jsx)(J,{value:"past",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"Past"})]}),(0,t.jsx)(ev,{tabValue:p})]}),(0,t.jsxs)(W,{value:"today",children:[(0,t.jsx)("div",{className:"flex flex-col gap-3 my-5",children:h.slice(0,y).map(e=>(0,t.jsx)(el,{question:e},e._id))}),c>5?(0,t.jsxs)("div",{className:"w-full flex justify-between items-center",children:[(0,t.jsx)("button",{className:"text-blue-500 hover:underline cursor-pointer",onClick:()=>x(e=>10===e?5:10),children:10===y?"Show less":"Load More"}),(0,t.jsx)("p",{className:"text-gray-500",children:10===y?"You are viewing all problems for today!":"You can load more problems to solve today!"})]}):(0,t.jsx)("p",{className:"text-gray-500 text-end",children:"Solve this all and you are done for the day!"})]}),(0,t.jsx)(W,{value:"past",children:(0,t.jsx)(eu,{})})]})}):(0,t.jsx)("h1",{children:"Hi"})}):(0,t.jsx)(Z,{})}],13118)}]);
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.