progy 0.16.0 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/public/main.js +1 -1
- package/package.json +7 -38
package/dist/public/main.js
CHANGED
|
@@ -3167,7 +3167,7 @@ ${X.themeCSS}`;if(X.fontFamily!==void 0)J+=`
|
|
|
3167
3167
|
transition-transform duration-200 ease-in-out
|
|
3168
3168
|
${X?"translate-x-4":"translate-x-0"}
|
|
3169
3169
|
`},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var u7=W7(b2(),1);function BV7(){let X=w2(nn),Y=w2(bh6),J=w2(on),Q=w2(pW),Z=w2(tn),K=w2(OX),G=w2(TQ),B=w2(xh6),z=w2(xq6),F=w2(_1),q=w2(fq6),H=w2(lW),U=w2(dW),O=w2(Kl),D=async(N)=>{if(!F)return;let E=B?.questions.length||1;if(N/E>=0.7)try{await fetch("/progress/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"quiz",id:F.id,success:!0})}),gq6(),mq6()}catch(w){console.error("Failed to update quiz progress:",w)}},A=(N,E)=>{let R="text-zinc-400";if(N.includes("error")||N.includes("❌")||N.includes("failed"))R="text-red-400";else if(N.includes("warning"))R="text-amber-400";else if(N.includes("passed")||N.includes("ok")||N.includes("✅")||N.includes("Great job"))R="text-emerald-400";else if(N.includes("\uD83D\uDCA1")||N.includes("\uD83D\uDD27")||N.includes("\uD83D\uDCCD")||N.includes("\uD83D\uDCDD"))R="text-blue-300";else if(N.includes("help:")||N.includes("note:"))R="text-blue-400";else if(N.includes("\uD83D\uDCAA"))R="text-amber-300";return u7.jsxDEV("div",{className:R,children:N},E,!1,void 0,this)};return u7.jsxDEV(Dl,{value:X,onValueChange:(N)=>an(N),className:"flex-1 flex flex-col min-h-0 bg-[#0a0a0a] rounded-xl border border-zinc-800/50 overflow-hidden",children:[u7.jsxDEV("div",{className:"flex-none px-4 py-2 border-b border-zinc-800/50 bg-zinc-900/40 flex items-center justify-between",children:[u7.jsxDEV(Al,{className:"bg-zinc-800/30 p-0.5 h-9",children:[u7.jsxDEV(UJ,{value:"description",className:"px-4 py-1.5 text-xs data-[state=active]:bg-zinc-700 data-[state=active]:text-zinc-100",children:[u7.jsxDEV(EB,{className:"w-3.5 h-3.5 mr-2"},void 0,!1,void 0,this)," Description"]},void 0,!0,void 0,this),u7.jsxDEV(UJ,{value:"output",className:"px-4 py-1.5 text-xs data-[state=active]:bg-zinc-700 data-[state=active]:text-zinc-100",children:[u7.jsxDEV(QJ,{className:"w-3.5 h-3.5 mr-2"},void 0,!1,void 0,this)," Output"]},void 0,!0,void 0,this),u7.jsxDEV(UJ,{value:"ai",className:"px-4 py-1.5 text-xs data-[state=active]:bg-zinc-700 data-[state=active]:text-zinc-100",children:[u7.jsxDEV(A3,{className:`w-3.5 h-3.5 mr-2 ${K?"text-rust":""}`},void 0,!1,void 0,this)," AI Mentor"]},void 0,!0,void 0,this),F?.hasQuiz&&u7.jsxDEV(UJ,{value:"quiz",className:"px-4 py-1.5 text-xs data-[state=active]:bg-zinc-700 data-[state=active]:text-zinc-100",children:[u7.jsxDEV(rZ,{className:"w-3.5 h-3.5 mr-2"},void 0,!1,void 0,this)," Quiz"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X==="output"&&Q&&u7.jsxDEV("div",{className:"flex items-center gap-4",children:[u7.jsxDEV("div",{className:"flex items-center gap-2 bg-zinc-800/50 px-3 py-1.5 rounded-full border border-zinc-700/50",children:[u7.jsxDEV(Y26,{htmlFor:"mode-switch-content",className:"text-zinc-500 text-[10px] font-bold uppercase tracking-tight",children:"Raw"},void 0,!1,void 0,this),u7.jsxDEV(GV7,{id:"mode-switch-content",checked:q,onCheckedChange:yh6,className:"scale-75"},void 0,!1,void 0,this),u7.jsxDEV(Y26,{htmlFor:"mode-switch-content",className:`text-[10px] font-bold uppercase tracking-tight ${q?"text-rust":"text-zinc-500"}`,children:"Friendly"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H&&u7.jsxDEV("span",{className:"text-[10px] font-bold text-rust animate-pulse flex items-center gap-2",children:[u7.jsxDEV(j3,{className:"w-3 h-3 animate-spin"},void 0,!1,void 0,this)," Compiling..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),u7.jsxDEV(tW,{value:"description",className:"flex-1 min-h-0 m-0 outline-none",children:u7.jsxDEV(tZ,{className:"h-full p-6",children:J.loading?u7.jsxDEV("div",{className:"flex flex-col items-center justify-center h-full text-zinc-600 gap-4 text-center min-h-[300px]",children:[u7.jsxDEV(j3,{className:"w-8 h-8 animate-spin text-rust"},void 0,!1,void 0,this),u7.jsxDEV("p",{className:"text-sm",children:"Carregando instruções..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Y?u7.jsxDEV(yG6,{content:Y},void 0,!1,void 0,this):u7.jsxDEV("div",{className:"flex flex-col items-center justify-center h-full text-zinc-600 gap-4 text-center min-h-[300px]",children:[u7.jsxDEV("div",{className:"w-12 h-12 bg-zinc-900 rounded-full flex items-center justify-center animate-pulse",children:u7.jsxDEV(EB,{className:"w-6 h-6"},void 0,!1,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV("p",{className:"text-sm",children:"Selecione um exercício para ver o conteúdo"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV(tW,{value:"output",className:"flex-1 min-h-0 m-0 outline-none bg-zinc-950 font-mono text-sm",children:u7.jsxDEV(tZ,{className:"w-full h-full p-6",children:[!Q&&u7.jsxDEV("pre",{className:"font-mono text-sm leading-relaxed text-zinc-600 italic",children:"// Run tests to see output..."},void 0,!1,void 0,this),Q&&q&&Z?u7.jsxDEV(yG6,{content:Z},void 0,!1,void 0,this):Q&&u7.jsxDEV("pre",{className:"font-mono text-sm leading-relaxed whitespace-pre-wrap break-all",children:Q.split(`
|
|
3170
|
-
`).map(A)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV(tW,{value:"quiz",className:"flex-1 min-h-0 m-0 outline-none bg-[#0a0a0a]",children:z.loading?u7.jsxDEV("div",{className:"flex flex-col items-center justify-center h-full text-zinc-500 gap-3",children:[u7.jsxDEV(j3,{className:"w-6 h-6 animate-spin text-rust"},void 0,!1,void 0,this),u7.jsxDEV("span",{className:"text-sm",children:"Carregando Quiz..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):B?u7.jsxDEV(ZV7,{quiz:B,onComplete:D},void 0,!1,void 0,this):F?.hasQuiz?u7.jsxDEV("div",{className:"flex flex-col items-center justify-center h-full text-zinc-500 gap-4 flex-1",children:[u7.jsxDEV("div",{className:"w-12 h-12 bg-zinc-900 rounded-full flex items-center justify-center",children:u7.jsxDEV(rZ,{className:"w-6 h-6 text-zinc-700"},void 0,!1,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV("p",{className:"text-sm",children:"Não foi possível carregar o quiz para este exercício."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):u7.jsxDEV("div",{className:"flex flex-col items-center justify-center h-full text-zinc-600 gap-4 text-center py-12",children:[u7.jsxDEV("div",{className:"w-12 h-12 bg-zinc-900 rounded-full flex items-center justify-center",children:u7.jsxDEV(rZ,{className:"w-6 h-6 text-zinc-800"},void 0,!1,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV("p",{className:"text-sm",children:"Este exercício não possui quiz."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV(tW,{value:"ai",className:"flex-1 min-h-0 m-0 outline-none",children:u7.jsxDEV(tZ,{className:"h-full p-6",children:U?u7.jsxDEV("div",{className:"flex flex-col items-center justify-center h-full text-zinc-500 gap-6 py-12 text-center",children:[u7.jsxDEV("div",{className:"w-16 h-16 bg-zinc-900 rounded-full flex items-center justify-center border border-zinc-800",children:u7.jsxDEV("div",{className:"w-12 h-12 bg-zinc-900 rounded-full flex items-center justify-center border border-zinc-800 shadow-inner",children:u7.jsxDEV(J8,{className:"w-6 h-6 text-zinc-700"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV("div",{className:"space-y-2 max-w-xs",children:[u7.jsxDEV("h3",{className:"text-zinc-100 font-bold",children:"AI Mentor Locked"},void 0,!1,void 0,this),u7.jsxDEV("p",{className:"text-xs text-zinc-500",children:"Upgrade to Pro to get instant hints, code explanations, and personalized guidance."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u7.jsxDEV(Sa,{children:u7.jsxDEV(D0,{className:"font-bold bg-gradient-to-r from-rust to-orange-500 hover:from-rust/90 hover:to-orange-500/90 text-white",children:"Unlock AI Mentor"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):u7.jsxDEV(u7.Fragment,{children:K||G?u7.jsxDEV("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:[u7.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[u7.jsxDEV("div",{className:"flex items-center gap-2 text-rust font-black uppercase tracking-widest text-[10px]",children:[u7.jsxDEV(A3,{className:`w-4 h-4 ${G?"animate-pulse":""}`},void 0,!1,void 0,this)," AI Mentor"]},void 0,!0,void 0,this),u7.jsxDEV("div",{className:"flex items-center gap-2",children:[G&&u7.jsxDEV(j3,{className:"w-3 h-3 animate-spin text-rust"},void 0,!1,void 0,this),u7.jsxDEV("button",{onClick:()=>{OX.set(null),TQ.set(!1)},className:"text-zinc-500 hover:text-zinc-300 transition-colors text-xs",children:"Back to History"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!K&&G?u7.jsxDEV("div",{className:"flex flex-col items-center justify-center py-20 bg-zinc-900/20 border border-zinc-800/50 rounded-2xl border-dashed",children:[u7.jsxDEV(j3,{className:"w-8 h-8 animate-spin text-rust mb-4"},void 0,!1,void 0,this),u7.jsxDEV("p",{className:"text-sm text-zinc-500 italic",children:"O Mentor IA está analisando seu código..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):u7.jsxDEV("div",{className:"prose prose-invert prose-sm max-w-none bg-zinc-900/30 border border-zinc-800/50 rounded-2xl p-6 shadow-2xl",children:[u7.jsxDEV(yG6,{content:K||""},void 0,!1,void 0,this),G&&u7.jsxDEV("div",{className:"mt-4 flex items-center gap-2 text-zinc-500 italic text-[10px]",children:[u7.jsxDEV("span",{className:"flex gap-1",children:[u7.jsxDEV("span",{className:"w-1 h-1 bg-rust rounded-full animate-bounce [animation-delay:-0.3s]"},void 0,!1,void 0,this),u7.jsxDEV("span",{className:"w-1 h-1 bg-rust rounded-full animate-bounce [animation-delay:-0.15s]"},void 0,!1,void 0,this),u7.jsxDEV("span",{className:"w-1 h-1 bg-rust rounded-full animate-bounce"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),"IA está escrevendo..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):u7.jsxDEV("div",{className:"space-y-8",children:[u7.jsxDEV("div",{className:"text-center space-y-4 py-8",children:[u7.jsxDEV("div",{className:"w-12 h-12 bg-rust/10 rounded-full flex items-center justify-center mx-auto border border-rust/20",children:u7.jsxDEV(A3,{className:"w-6 h-6 text-rust"},void 0,!1,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV("div",{children:[u7.jsxDEV("h3",{className:"text-zinc-100 font-bold mb-1",children:"Ready to Help!"},void 0,!1,void 0,this),u7.jsxDEV("p",{className:"text-xs text-zinc-500 max-w-xs mx-auto",children:"Stuck? Ask for a hint or get a full explanation of the code."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u7.jsxDEV("div",{className:"flex items-center justify-center gap-3",children:[u7.jsxDEV(D0,{variant:"secondary",size:"sm",onClick:I56,className:"bg-zinc-800/50 hover:bg-zinc-800 border-zinc-700/50 text-xs",children:[u7.jsxDEV(A3,{className:"w-3.5 h-3.5 mr-2 text-rust"},void 0,!1,void 0,this)," get Hint"]},void 0,!0,void 0,this),u7.jsxDEV(D0,{variant:"secondary",size:"sm",onClick:$56,className:"bg-zinc-800/50 hover:bg-zinc-800 border-zinc-700/50 text-xs",children:[u7.jsxDEV(A3,{className:"w-3.5 h-3.5 mr-2 text-purple-400"},void 0,!1,void 0,this)," Explain Code"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(()=>{let N=O.filter((E)=>E.exerciseId===F?.id).sort((E,R)=>R.timestamp-E.timestamp);if(N.length===0)return null;return u7.jsxDEV("div",{className:"space-y-3",children:[u7.jsxDEV("div",{className:"flex items-center gap-2 text-[10px] font-bold text-zinc-500 uppercase tracking-widest px-1",children:[u7.jsxDEV($W,{className:"w-3 h-3"},void 0,!1,void 0,this)," History"]},void 0,!0,void 0,this),u7.jsxDEV("div",{className:"space-y-2",children:N.map((E)=>u7.jsxDEV("button",{onClick:()=>OX.set(E.content),className:"w-full text-left p-3 rounded-xl bg-zinc-900/30 border border-zinc-800/50 hover:bg-zinc-800/50 hover:border-zinc-700/50 transition-all group",children:[u7.jsxDEV("div",{className:"flex items-center justify-between mb-1",children:[u7.jsxDEV("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded border ${E.type==="hint"?"bg-rust/10 text-rust border-rust/20":"bg-purple-500/10 text-purple-400 border-purple-500/20"}`,children:E.type==="hint"?"HINT":"EXPLANATION"},void 0,!1,void 0,this),u7.jsxDEV("span",{className:"text-[10px] text-zinc-600 group-hover:text-zinc-500",children:new Date(E.timestamp).toLocaleTimeString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u7.jsxDEV("p",{className:"text-xs text-zinc-400 line-clamp-2 pl-1 border-l-2 border-zinc-800 group-hover:border-zinc-600",children:E.content.replace(/[#*`]/g,"")},void 0,!1,void 0,this)]},E.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})()]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var vC=W7(P2(),1);var Z0=W7(b2(),1);function zV7({children:X}){let[Y,J]=vC.useState(!1),[Q,Z]=vC.useState(""),[K,G]=vC.useState("medium"),[B,z]=vC.useState(!1),[F,q]=vC.useState(null),[H,U]=vC.useState(null),O=async()=>{if(!Q.trim())return;z(!0),q(null);try{let D=await sn({endpoint:"generate",prompt:Q,difficulty:K});if(D.error){q(D.error);return}U(D),J(!1),en(null)}catch(D){q(D.message||"Failed to generate challenge. Please try again.")}finally{z(!1)}};return Z0.jsxDEV(Cl,{open:Y,onOpenChange:J,children:[Z0.jsxDEV(N06,{asChild:!0,children:X},void 0,!1,void 0,this),Z0.jsxDEV(Pl,{className:"bg-zinc-900 max-w-2xl",children:Z0.jsxDEV("div",{className:"",children:[Z0.jsxDEV("div",{className:"flex items-center gap-3 mb-6",children:[Z0.jsxDEV("div",{className:"bg-gradient-to-br from-rust to-orange-500 p-2 rounded-xl shadow-lg shadow-rust/20",children:Z0.jsxDEV(v8,{className:"w-5 h-5 text-white"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z0.jsxDEV("div",{children:[Z0.jsxDEV("h2",{className:"text-xl font-bold text-white",children:"Generate Challenge"},void 0,!1,void 0,this),Z0.jsxDEV("p",{className:"text-xs text-zinc-500",children:"The AI will create a challenge with code for you to correct"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z0.jsxDEV("div",{className:"space-y-4",children:[Z0.jsxDEV("div",{children:[Z0.jsxDEV("label",{className:"text-xs font-semibold text-zinc-400 block mb-2",children:"What do you want to practice?"},void 0,!1,void 0,this),Z0.jsxDEV("textarea",{value:Q,onChange:(D)=>Z(D.target.value),placeholder:"Ex: ownership with vectors, pattern matching with enums, traits and generics...",className:"w-full h-24 bg-zinc-800 border border-zinc-700 rounded-lg px-4 py-3 text-sm text-white placeholder:text-zinc-600 focus:outline-none focus:border-transparent resize-none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z0.jsxDEV("div",{children:[Z0.jsxDEV("label",{className:"text-xs font-semibold text-zinc-400 block mb-2",children:"Difficulty"},void 0,!1,void 0,this),Z0.jsxDEV("div",{className:"flex gap-2",children:["easy","medium","hard"].map((D)=>Z0.jsxDEV("button",{onClick:()=>G(D),className:`cursor-pointer flex-1 py-2 px-4 rounded-lg text-xs font-semibold transition-all ${K===D?D==="easy"?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30":D==="medium"?"bg-amber-500/20 text-amber-400 border border-amber-500/30":"bg-red-500/20 text-red-400 border border-red-500/30":"bg-zinc-800 text-zinc-500 border border-zinc-700 hover:border-zinc-600"}`,children:D==="easy"?"Easy":D==="medium"?"Medium":"Hard"},D,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F&&Z0.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 text-red-400 text-xs",children:F},void 0,!1,void 0,this),Z0.jsxDEV(D0,{onClick:O,disabled:B||!Q.trim(),className:"w-full bg-gradient-to-r from-rust to-orange-500 hover:from-rust/90 hover:to-orange-500/90 font-bold shadow-lg shadow-rust/20",children:B?Z0.jsxDEV(Z0.Fragment,{children:[Z0.jsxDEV(j3,{className:"w-4 h-4 mr-2 animate-spin"},void 0,!1,void 0,this),"Gerando..."]},void 0,!0,void 0,this):Z0.jsxDEV(Z0.Fragment,{children:[Z0.jsxDEV(A3,{className:"w-4 h-4 mr-2"},void 0,!1,void 0,this),"Gerar Desafio"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var gG6=W7(P2(),1);var ZQ=W7(P2(),1);function mG6(){return mG6=Object.assign?Object.assign.bind():function(X){for(var Y=1;Y<arguments.length;Y++){var J=arguments[Y];for(var Q in J)({}).hasOwnProperty.call(J,Q)&&(X[Q]=J[Q])}return X},mG6.apply(null,arguments)}function VI2(X,Y){if(X==null)return{};var J={};for(var Q in X)if({}.hasOwnProperty.call(X,Q)){if(Y.indexOf(Q)!==-1)continue;J[Q]=X[Q]}return J}function wI2(X){ZQ.useEffect(X,[])}var TI2=["id","volume","playbackRate","soundEnabled","interrupt","onload"];function SI2(X,Y){var J=Y===void 0?{}:Y,Q=J.volume,Z=Q===void 0?1:Q,K=J.playbackRate,G=K===void 0?1:K,B=J.soundEnabled,z=B===void 0?!0:B,F=J.interrupt,q=F===void 0?!1:F,H=J.onload,U=VI2(J,TI2),O=ZQ.default.useRef(null),D=ZQ.default.useRef(!1),A=ZQ.default.useState(null),N=A[0],E=A[1],R=ZQ.default.useState(null),w=R[0],$=R[1],S=function(){if(typeof H==="function")H.call(this);if(D.current)E(this.duration()*1000);$(this)};wI2(function(){return Promise.resolve().then(() => W7(qV7(),1)).then(function(x){if(!D.current){var u;O.current=(u=x.Howl)!==null&&u!==void 0?u:x.default.Howl,D.current=!0,new O.current(mG6({src:Array.isArray(X)?X:[X],volume:Z,rate:G,onload:S},U))}}),function(){D.current=!1}}),ZQ.default.useEffect(function(){if(O.current&&w)$(new O.current(mG6({src:Array.isArray(X)?X:[X],volume:Z,onload:S},U)))},[JSON.stringify(X)]),ZQ.default.useEffect(function(){if(w){if(w.volume(Z),!U.sprite)w.rate(G)}},[w,Z,G]);var I=ZQ.default.useCallback(function(x){if(typeof x>"u")x={};if(!w||!z&&!x.forceSoundEnabled)return;if(q)w.stop();if(x.playbackRate)w.rate(x.playbackRate);w.play(x.id)},[w,z,q]),k=ZQ.default.useCallback(function(x){if(!w)return;w.stop(x)},[w]),_=ZQ.default.useCallback(function(x){if(!w)return;w.pause(x)},[w]),f=[I,{sound:w,stop:k,pause:_,duration:N}];return f}var xj6=SI2;function HV7(){let X=w2(lW),Y=w2(_1),J=w2(eZ),Q=gG6.useRef(!1),[Z]=xj6("/sounds/success-2.mp3",{volume:0.4,interrupt:!0}),[K]=xj6("/sounds/error.mp3",{volume:0.4,interrupt:!0});return gG6.useEffect(()=>{if(Q.current&&!X){if(Y){let G=J[Y.id];if(G==="pass")Z();else if(G==="fail")K()}}Q.current=X},[X,Y,J,Z,K]),null}var v7=W7(b2(),1);function UV7(){let X=w2(lW),Y=w2(TQ),J=w2(pW),Q=w2(HD),Z=w2(_1),K=w2(eZ),G=w2(dW),B=w2(WD),z=w2(hh6),F=w2(yq6),q=w2(hq6),H=w2(S56),[U,O]=WV7.useState("learning");return v7.jsxDEV("div",{className:"container mx-auto gap-6 flex flex-1 py-6 min-h-full",children:[v7.jsxDEV(HV7,{},void 0,!1,void 0,this),v7.jsxDEV("aside",{className:"w-full max-w-[22vw] h-full flex flex-col overflow-hidden rounded-2xl border border-zinc-800/50 bg-zinc-900/30 backdrop-blur-sm shadow-xl",children:[v7.jsxDEV("div",{className:"p-4 border-b border-zinc-800/50 bg-zinc-900/50 space-y-4",children:[B&&v7.jsxDEV("div",{className:"flex items-center justify-between",children:[v7.jsxDEV("div",{className:"flex flex-col",children:[v7.jsxDEV("span",{className:"text-[10px] text-zinc-500 font-bold uppercase tracking-wider",children:["Level ",Math.floor(B.stats.totalXp/100)+1]},void 0,!0,void 0,this),v7.jsxDEV("span",{className:"text-sm font-black text-zinc-100 tabular-nums",children:[B.stats.totalXp," XP"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV("div",{className:"w-8 h-8 rounded-full border-2 border-zinc-800 flex items-center justify-center bg-zinc-900 relative",children:[v7.jsxDEV("svg",{className:"absolute inset-0 -rotate-90",viewBox:"0 0 40 40",children:[v7.jsxDEV("circle",{cx:"20",cy:"20",r:"18",fill:"transparent",stroke:"currentColor",strokeWidth:"3",className:"text-zinc-800"},void 0,!1,void 0,this),v7.jsxDEV("circle",{cx:"20",cy:"20",r:"18",fill:"transparent",stroke:"currentColor",strokeWidth:"3",strokeDasharray:2*Math.PI*18,strokeDashoffset:2*Math.PI*18*(1-B.stats.totalXp%100/100),className:"text-rust"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV("span",{className:"text-[10px] font-black text-zinc-100",children:Math.floor(B.stats.totalXp/100)+1},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV("div",{className:"space-y-1.5",children:[v7.jsxDEV("div",{className:"flex items-center justify-between text-[10px] font-medium text-zinc-500",children:[v7.jsxDEV("span",{children:"Progress"},void 0,!1,void 0,this),v7.jsxDEV("span",{className:"text-zinc-300",children:[F,"/",q]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV("div",{className:"h-1.5 w-full bg-zinc-800 rounded-full overflow-hidden",children:v7.jsxDEV("div",{className:"h-full bg-gradient-to-r from-rust to-orange-400",style:{width:`${z}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV(Dl,{value:U,onValueChange:(D)=>O(D),className:"flex flex-col h-full",children:[v7.jsxDEV("div",{className:"p-2 border-b border-zinc-800/50 bg-zinc-900/50",children:v7.jsxDEV(Al,{className:"w-full bg-zinc-800/50",children:[v7.jsxDEV(UJ,{value:"learning",className:"flex-1 gap-2 data-[state=active]:bg-zinc-700 py-2",children:[v7.jsxDEV(XJ,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this),"Learning Path"]},void 0,!0,void 0,this),v7.jsxDEV(UJ,{value:"practice",className:"flex-1 gap-2 data-[state=active]:bg-rust py-2",children:[v7.jsxDEV(v8,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this),"Practice"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),v7.jsxDEV(tW,{value:"learning",className:"flex-1 overflow-hidden m-0 text-zinc-100",children:v7.jsxDEV(tZ,{className:"h-full px-2 py-2",children:Object.keys(Q).length===0?v7.jsxDEV("div",{className:"space-y-4 p-2",children:[v7.jsxDEV("div",{className:"h-10 bg-zinc-800/50 rounded-xl animate-pulse"},void 0,!1,void 0,this),v7.jsxDEV("div",{className:"h-10 bg-zinc-800/50 rounded-xl animate-pulse"},void 0,!1,void 0,this),v7.jsxDEV("div",{className:"h-10 bg-zinc-800/50 rounded-xl animate-pulse"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):v7.jsxDEV(NH6,{type:"single",collapsible:!0,className:"w-full space-y-1",value:H,onValueChange:(D)=>S56.set(D),children:Object.keys(Q).filter((D)=>D!=="practice").map((D)=>{let A=Q[D]||[],N=A.filter((w)=>K[w.id]==="pass").length,E=N===A.length&&A.length>0,R=A.length>0&&A.every((w)=>w.isLocked);return v7.jsxDEV(RH6,{value:D,className:"border-none",children:[v7.jsxDEV(VH6,{className:"hover:no-underline py-3 px-3 rounded-xl hover:bg-zinc-800/30 text-zinc-300 text-sm transition-colors [&[data-state=open]]:bg-zinc-800/50",children:[v7.jsxDEV("div",{className:"flex items-center gap-3 truncate",children:[R?v7.jsxDEV("div",{className:"w-5 h-5 rounded-full bg-zinc-800 flex items-center justify-center",children:v7.jsxDEV(J8,{className:"w-3 h-3 text-zinc-600"},void 0,!1,void 0,this)},void 0,!1,void 0,this):E?v7.jsxDEV("div",{className:"w-5 h-5 rounded-full bg-emerald-500/20 flex items-center justify-center",children:v7.jsxDEV(Y8,{className:"w-3 h-3 text-emerald-400"},void 0,!1,void 0,this)},void 0,!1,void 0,this):v7.jsxDEV("div",{className:"w-5 h-5 rounded-full bg-zinc-800 flex items-center justify-center",children:v7.jsxDEV("span",{className:"text-[8px] font-bold text-zinc-500",children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this),v7.jsxDEV("span",{className:`font-semibold truncate ${E?"text-zinc-500":""}`,children:A[0]?.moduleTitle||D.replace(/^\d+_/,"").replace(/_/g," ")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV(rW,{variant:E?"outline":"secondary",className:`ml-auto mr-2 text-[10px] h-5 px-2 ${E?"text-emerald-400 border-emerald-500/30 bg-emerald-500/10":""}`,children:[N,"/",A.length]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV(wH6,{className:"pb-2 pt-1 space-y-1",children:A.map((w)=>{let $=K[w.id],S=Z?.id===w.id,I=w.isLocked;return v7.jsxDEV("button",{onClick:()=>{if(I)return;KJ.open(`/editor/${w.id}`),en(w)},title:I?w.lockReason:void 0,className:`w-full text-left pl-10 pr-3 py-2.5 text-xs rounded-lg transition-all flex items-center gap-2 group
|
|
3170
|
+
`).map(A)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV(tW,{value:"quiz",className:"flex-1 min-h-0 m-0 outline-none bg-[#0a0a0a]",children:z.loading?u7.jsxDEV("div",{className:"flex flex-col items-center justify-center h-full text-zinc-500 gap-3",children:[u7.jsxDEV(j3,{className:"w-6 h-6 animate-spin text-rust"},void 0,!1,void 0,this),u7.jsxDEV("span",{className:"text-sm",children:"Carregando Quiz..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):B?u7.jsxDEV(ZV7,{quiz:B,onComplete:D},void 0,!1,void 0,this):F?.hasQuiz?u7.jsxDEV("div",{className:"flex flex-col items-center justify-center h-full text-zinc-500 gap-4 flex-1",children:[u7.jsxDEV("div",{className:"w-12 h-12 bg-zinc-900 rounded-full flex items-center justify-center",children:u7.jsxDEV(rZ,{className:"w-6 h-6 text-zinc-700"},void 0,!1,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV("p",{className:"text-sm",children:"Não foi possível carregar o quiz para este exercício."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):u7.jsxDEV("div",{className:"flex flex-col items-center justify-center h-full text-zinc-600 gap-4 text-center py-12",children:[u7.jsxDEV("div",{className:"w-12 h-12 bg-zinc-900 rounded-full flex items-center justify-center",children:u7.jsxDEV(rZ,{className:"w-6 h-6 text-zinc-800"},void 0,!1,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV("p",{className:"text-sm",children:"Este exercício não possui quiz."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV(tW,{value:"ai",className:"flex-1 min-h-0 m-0 outline-none",children:u7.jsxDEV(tZ,{className:"h-full p-6",children:U?u7.jsxDEV("div",{className:"flex flex-col items-center justify-center h-full text-zinc-500 gap-6 py-12 text-center",children:[u7.jsxDEV("div",{className:"w-16 h-16 bg-zinc-900 rounded-full flex items-center justify-center border border-zinc-800",children:u7.jsxDEV("div",{className:"w-12 h-12 bg-zinc-900 rounded-full flex items-center justify-center border border-zinc-800 shadow-inner",children:u7.jsxDEV(J8,{className:"w-6 h-6 text-zinc-700"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV("div",{className:"space-y-2 max-w-xs",children:[u7.jsxDEV("h3",{className:"text-zinc-100 font-bold",children:"AI Mentor Locked"},void 0,!1,void 0,this),u7.jsxDEV("p",{className:"text-xs text-zinc-500",children:"Upgrade to Pro to get instant hints, code explanations, and personalized guidance."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u7.jsxDEV(Sa,{children:u7.jsxDEV(D0,{className:"font-bold bg-gradient-to-r from-rust to-orange-500 hover:from-rust/90 hover:to-orange-500/90 text-white",children:"Unlock AI Mentor"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):u7.jsxDEV(u7.Fragment,{children:K||G?u7.jsxDEV("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:[u7.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[u7.jsxDEV("div",{className:"flex items-center gap-2 text-rust font-black uppercase tracking-widest text-[10px]",children:[u7.jsxDEV(A3,{className:`w-4 h-4 ${G?"animate-pulse":""}`},void 0,!1,void 0,this)," AI Mentor"]},void 0,!0,void 0,this),u7.jsxDEV("div",{className:"flex items-center gap-2",children:[G&&u7.jsxDEV(j3,{className:"w-3 h-3 animate-spin text-rust"},void 0,!1,void 0,this),u7.jsxDEV("button",{onClick:()=>{OX.set(null),TQ.set(!1)},className:"text-zinc-500 hover:text-zinc-300 transition-colors text-xs",children:"Back to History"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!K&&G?u7.jsxDEV("div",{className:"flex flex-col items-center justify-center py-20 bg-zinc-900/20 border border-zinc-800/50 rounded-2xl border-dashed",children:[u7.jsxDEV(j3,{className:"w-8 h-8 animate-spin text-rust mb-4"},void 0,!1,void 0,this),u7.jsxDEV("p",{className:"text-sm text-zinc-500 italic",children:"O Mentor IA está analisando seu código..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):u7.jsxDEV("div",{className:"prose prose-invert prose-sm max-w-none bg-zinc-900/30 border border-zinc-800/50 rounded-2xl p-6 shadow-2xl",children:[u7.jsxDEV(yG6,{content:K||""},void 0,!1,void 0,this),G&&u7.jsxDEV("div",{className:"mt-4 flex items-center gap-2 text-zinc-500 italic text-[10px]",children:[u7.jsxDEV("span",{className:"flex gap-1",children:[u7.jsxDEV("span",{className:"w-1 h-1 bg-rust rounded-full animate-bounce [animation-delay:-0.3s]"},void 0,!1,void 0,this),u7.jsxDEV("span",{className:"w-1 h-1 bg-rust rounded-full animate-bounce [animation-delay:-0.15s]"},void 0,!1,void 0,this),u7.jsxDEV("span",{className:"w-1 h-1 bg-rust rounded-full animate-bounce"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),"IA está escrevendo..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):u7.jsxDEV("div",{className:"space-y-8",children:[u7.jsxDEV("div",{className:"text-center space-y-4 py-8",children:[u7.jsxDEV("div",{className:"w-12 h-12 bg-rust/10 rounded-full flex items-center justify-center mx-auto border border-rust/20",children:u7.jsxDEV(A3,{className:"w-6 h-6 text-rust"},void 0,!1,void 0,this)},void 0,!1,void 0,this),u7.jsxDEV("div",{children:[u7.jsxDEV("h3",{className:"text-zinc-100 font-bold mb-1",children:"Ready to Help!"},void 0,!1,void 0,this),u7.jsxDEV("p",{className:"text-xs text-zinc-500 max-w-xs mx-auto",children:"Stuck? Ask for a hint or get a full explanation of the code."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u7.jsxDEV("div",{className:"flex items-center justify-center gap-3",children:[u7.jsxDEV(D0,{variant:"secondary",size:"sm",onClick:I56,className:"bg-zinc-800/50 hover:bg-zinc-800 border-zinc-700/50 text-xs",children:[u7.jsxDEV(A3,{className:"w-3.5 h-3.5 mr-2 text-rust"},void 0,!1,void 0,this)," get Hint"]},void 0,!0,void 0,this),u7.jsxDEV(D0,{variant:"secondary",size:"sm",onClick:$56,className:"bg-zinc-800/50 hover:bg-zinc-800 border-zinc-700/50 text-xs",children:[u7.jsxDEV(A3,{className:"w-3.5 h-3.5 mr-2 text-purple-400"},void 0,!1,void 0,this)," Explain Code"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(()=>{let N=(Array.isArray(O)?O:[]).filter((E)=>E.exerciseId===F?.id).sort((E,R)=>R.timestamp-E.timestamp);if(N.length===0)return null;return u7.jsxDEV("div",{className:"space-y-3",children:[u7.jsxDEV("div",{className:"flex items-center gap-2 text-[10px] font-bold text-zinc-500 uppercase tracking-widest px-1",children:[u7.jsxDEV($W,{className:"w-3 h-3"},void 0,!1,void 0,this)," History"]},void 0,!0,void 0,this),u7.jsxDEV("div",{className:"space-y-2",children:N.map((E)=>u7.jsxDEV("button",{onClick:()=>OX.set(E.content),className:"w-full text-left p-3 rounded-xl bg-zinc-900/30 border border-zinc-800/50 hover:bg-zinc-800/50 hover:border-zinc-700/50 transition-all group",children:[u7.jsxDEV("div",{className:"flex items-center justify-between mb-1",children:[u7.jsxDEV("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded border ${E.type==="hint"?"bg-rust/10 text-rust border-rust/20":"bg-purple-500/10 text-purple-400 border-purple-500/20"}`,children:E.type==="hint"?"HINT":"EXPLANATION"},void 0,!1,void 0,this),u7.jsxDEV("span",{className:"text-[10px] text-zinc-600 group-hover:text-zinc-500",children:new Date(E.timestamp).toLocaleTimeString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u7.jsxDEV("p",{className:"text-xs text-zinc-400 line-clamp-2 pl-1 border-l-2 border-zinc-800 group-hover:border-zinc-600",children:E.content.replace(/[#*`]/g,"")},void 0,!1,void 0,this)]},E.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})()]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var vC=W7(P2(),1);var Z0=W7(b2(),1);function zV7({children:X}){let[Y,J]=vC.useState(!1),[Q,Z]=vC.useState(""),[K,G]=vC.useState("medium"),[B,z]=vC.useState(!1),[F,q]=vC.useState(null),[H,U]=vC.useState(null),O=async()=>{if(!Q.trim())return;z(!0),q(null);try{let D=await sn({endpoint:"generate",prompt:Q,difficulty:K});if(D.error){q(D.error);return}U(D),J(!1),en(null)}catch(D){q(D.message||"Failed to generate challenge. Please try again.")}finally{z(!1)}};return Z0.jsxDEV(Cl,{open:Y,onOpenChange:J,children:[Z0.jsxDEV(N06,{asChild:!0,children:X},void 0,!1,void 0,this),Z0.jsxDEV(Pl,{className:"bg-zinc-900 max-w-2xl",children:Z0.jsxDEV("div",{className:"",children:[Z0.jsxDEV("div",{className:"flex items-center gap-3 mb-6",children:[Z0.jsxDEV("div",{className:"bg-gradient-to-br from-rust to-orange-500 p-2 rounded-xl shadow-lg shadow-rust/20",children:Z0.jsxDEV(v8,{className:"w-5 h-5 text-white"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z0.jsxDEV("div",{children:[Z0.jsxDEV("h2",{className:"text-xl font-bold text-white",children:"Generate Challenge"},void 0,!1,void 0,this),Z0.jsxDEV("p",{className:"text-xs text-zinc-500",children:"The AI will create a challenge with code for you to correct"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z0.jsxDEV("div",{className:"space-y-4",children:[Z0.jsxDEV("div",{children:[Z0.jsxDEV("label",{className:"text-xs font-semibold text-zinc-400 block mb-2",children:"What do you want to practice?"},void 0,!1,void 0,this),Z0.jsxDEV("textarea",{value:Q,onChange:(D)=>Z(D.target.value),placeholder:"Ex: ownership with vectors, pattern matching with enums, traits and generics...",className:"w-full h-24 bg-zinc-800 border border-zinc-700 rounded-lg px-4 py-3 text-sm text-white placeholder:text-zinc-600 focus:outline-none focus:border-transparent resize-none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z0.jsxDEV("div",{children:[Z0.jsxDEV("label",{className:"text-xs font-semibold text-zinc-400 block mb-2",children:"Difficulty"},void 0,!1,void 0,this),Z0.jsxDEV("div",{className:"flex gap-2",children:["easy","medium","hard"].map((D)=>Z0.jsxDEV("button",{onClick:()=>G(D),className:`cursor-pointer flex-1 py-2 px-4 rounded-lg text-xs font-semibold transition-all ${K===D?D==="easy"?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30":D==="medium"?"bg-amber-500/20 text-amber-400 border border-amber-500/30":"bg-red-500/20 text-red-400 border border-red-500/30":"bg-zinc-800 text-zinc-500 border border-zinc-700 hover:border-zinc-600"}`,children:D==="easy"?"Easy":D==="medium"?"Medium":"Hard"},D,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F&&Z0.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 text-red-400 text-xs",children:F},void 0,!1,void 0,this),Z0.jsxDEV(D0,{onClick:O,disabled:B||!Q.trim(),className:"w-full bg-gradient-to-r from-rust to-orange-500 hover:from-rust/90 hover:to-orange-500/90 font-bold shadow-lg shadow-rust/20",children:B?Z0.jsxDEV(Z0.Fragment,{children:[Z0.jsxDEV(j3,{className:"w-4 h-4 mr-2 animate-spin"},void 0,!1,void 0,this),"Gerando..."]},void 0,!0,void 0,this):Z0.jsxDEV(Z0.Fragment,{children:[Z0.jsxDEV(A3,{className:"w-4 h-4 mr-2"},void 0,!1,void 0,this),"Gerar Desafio"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var gG6=W7(P2(),1);var ZQ=W7(P2(),1);function mG6(){return mG6=Object.assign?Object.assign.bind():function(X){for(var Y=1;Y<arguments.length;Y++){var J=arguments[Y];for(var Q in J)({}).hasOwnProperty.call(J,Q)&&(X[Q]=J[Q])}return X},mG6.apply(null,arguments)}function VI2(X,Y){if(X==null)return{};var J={};for(var Q in X)if({}.hasOwnProperty.call(X,Q)){if(Y.indexOf(Q)!==-1)continue;J[Q]=X[Q]}return J}function wI2(X){ZQ.useEffect(X,[])}var TI2=["id","volume","playbackRate","soundEnabled","interrupt","onload"];function SI2(X,Y){var J=Y===void 0?{}:Y,Q=J.volume,Z=Q===void 0?1:Q,K=J.playbackRate,G=K===void 0?1:K,B=J.soundEnabled,z=B===void 0?!0:B,F=J.interrupt,q=F===void 0?!1:F,H=J.onload,U=VI2(J,TI2),O=ZQ.default.useRef(null),D=ZQ.default.useRef(!1),A=ZQ.default.useState(null),N=A[0],E=A[1],R=ZQ.default.useState(null),w=R[0],$=R[1],S=function(){if(typeof H==="function")H.call(this);if(D.current)E(this.duration()*1000);$(this)};wI2(function(){return Promise.resolve().then(() => W7(qV7(),1)).then(function(x){if(!D.current){var u;O.current=(u=x.Howl)!==null&&u!==void 0?u:x.default.Howl,D.current=!0,new O.current(mG6({src:Array.isArray(X)?X:[X],volume:Z,rate:G,onload:S},U))}}),function(){D.current=!1}}),ZQ.default.useEffect(function(){if(O.current&&w)$(new O.current(mG6({src:Array.isArray(X)?X:[X],volume:Z,onload:S},U)))},[JSON.stringify(X)]),ZQ.default.useEffect(function(){if(w){if(w.volume(Z),!U.sprite)w.rate(G)}},[w,Z,G]);var I=ZQ.default.useCallback(function(x){if(typeof x>"u")x={};if(!w||!z&&!x.forceSoundEnabled)return;if(q)w.stop();if(x.playbackRate)w.rate(x.playbackRate);w.play(x.id)},[w,z,q]),k=ZQ.default.useCallback(function(x){if(!w)return;w.stop(x)},[w]),_=ZQ.default.useCallback(function(x){if(!w)return;w.pause(x)},[w]),f=[I,{sound:w,stop:k,pause:_,duration:N}];return f}var xj6=SI2;function HV7(){let X=w2(lW),Y=w2(_1),J=w2(eZ),Q=gG6.useRef(!1),[Z]=xj6("/sounds/success-2.mp3",{volume:0.4,interrupt:!0}),[K]=xj6("/sounds/error.mp3",{volume:0.4,interrupt:!0});return gG6.useEffect(()=>{if(Q.current&&!X){if(Y){let G=J[Y.id];if(G==="pass")Z();else if(G==="fail")K()}}Q.current=X},[X,Y,J,Z,K]),null}var v7=W7(b2(),1);function UV7(){let X=w2(lW),Y=w2(TQ),J=w2(pW),Q=w2(HD),Z=w2(_1),K=w2(eZ),G=w2(dW),B=w2(WD),z=w2(hh6),F=w2(yq6),q=w2(hq6),H=w2(S56),[U,O]=WV7.useState("learning");return v7.jsxDEV("div",{className:"container mx-auto gap-6 flex flex-1 py-6 min-h-full",children:[v7.jsxDEV(HV7,{},void 0,!1,void 0,this),v7.jsxDEV("aside",{className:"w-full max-w-[22vw] h-full flex flex-col overflow-hidden rounded-2xl border border-zinc-800/50 bg-zinc-900/30 backdrop-blur-sm shadow-xl",children:[v7.jsxDEV("div",{className:"p-4 border-b border-zinc-800/50 bg-zinc-900/50 space-y-4",children:[B&&v7.jsxDEV("div",{className:"flex items-center justify-between",children:[v7.jsxDEV("div",{className:"flex flex-col",children:[v7.jsxDEV("span",{className:"text-[10px] text-zinc-500 font-bold uppercase tracking-wider",children:["Level ",Math.floor(B.stats.totalXp/100)+1]},void 0,!0,void 0,this),v7.jsxDEV("span",{className:"text-sm font-black text-zinc-100 tabular-nums",children:[B.stats.totalXp," XP"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV("div",{className:"w-8 h-8 rounded-full border-2 border-zinc-800 flex items-center justify-center bg-zinc-900 relative",children:[v7.jsxDEV("svg",{className:"absolute inset-0 -rotate-90",viewBox:"0 0 40 40",children:[v7.jsxDEV("circle",{cx:"20",cy:"20",r:"18",fill:"transparent",stroke:"currentColor",strokeWidth:"3",className:"text-zinc-800"},void 0,!1,void 0,this),v7.jsxDEV("circle",{cx:"20",cy:"20",r:"18",fill:"transparent",stroke:"currentColor",strokeWidth:"3",strokeDasharray:2*Math.PI*18,strokeDashoffset:2*Math.PI*18*(1-B.stats.totalXp%100/100),className:"text-rust"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV("span",{className:"text-[10px] font-black text-zinc-100",children:Math.floor(B.stats.totalXp/100)+1},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV("div",{className:"space-y-1.5",children:[v7.jsxDEV("div",{className:"flex items-center justify-between text-[10px] font-medium text-zinc-500",children:[v7.jsxDEV("span",{children:"Progress"},void 0,!1,void 0,this),v7.jsxDEV("span",{className:"text-zinc-300",children:[F,"/",q]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV("div",{className:"h-1.5 w-full bg-zinc-800 rounded-full overflow-hidden",children:v7.jsxDEV("div",{className:"h-full bg-gradient-to-r from-rust to-orange-400",style:{width:`${z}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV(Dl,{value:U,onValueChange:(D)=>O(D),className:"flex flex-col h-full",children:[v7.jsxDEV("div",{className:"p-2 border-b border-zinc-800/50 bg-zinc-900/50",children:v7.jsxDEV(Al,{className:"w-full bg-zinc-800/50",children:[v7.jsxDEV(UJ,{value:"learning",className:"flex-1 gap-2 data-[state=active]:bg-zinc-700 py-2",children:[v7.jsxDEV(XJ,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this),"Learning Path"]},void 0,!0,void 0,this),v7.jsxDEV(UJ,{value:"practice",className:"flex-1 gap-2 data-[state=active]:bg-rust py-2",children:[v7.jsxDEV(v8,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this),"Practice"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),v7.jsxDEV(tW,{value:"learning",className:"flex-1 overflow-hidden m-0 text-zinc-100",children:v7.jsxDEV(tZ,{className:"h-full px-2 py-2",children:Object.keys(Q).length===0?v7.jsxDEV("div",{className:"space-y-4 p-2",children:[v7.jsxDEV("div",{className:"h-10 bg-zinc-800/50 rounded-xl animate-pulse"},void 0,!1,void 0,this),v7.jsxDEV("div",{className:"h-10 bg-zinc-800/50 rounded-xl animate-pulse"},void 0,!1,void 0,this),v7.jsxDEV("div",{className:"h-10 bg-zinc-800/50 rounded-xl animate-pulse"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):v7.jsxDEV(NH6,{type:"single",collapsible:!0,className:"w-full space-y-1",value:H,onValueChange:(D)=>S56.set(D),children:Object.keys(Q).filter((D)=>D!=="practice").map((D)=>{let A=Array.isArray(Q[D])?Q[D]:[],N=A.filter((w)=>K[w.id]==="pass").length,E=N===A.length&&A.length>0,R=A.length>0&&A.every((w)=>w.isLocked);return v7.jsxDEV(RH6,{value:D,className:"border-none",children:[v7.jsxDEV(VH6,{className:"hover:no-underline py-3 px-3 rounded-xl hover:bg-zinc-800/30 text-zinc-300 text-sm transition-colors [&[data-state=open]]:bg-zinc-800/50",children:[v7.jsxDEV("div",{className:"flex items-center gap-3 truncate",children:[R?v7.jsxDEV("div",{className:"w-5 h-5 rounded-full bg-zinc-800 flex items-center justify-center",children:v7.jsxDEV(J8,{className:"w-3 h-3 text-zinc-600"},void 0,!1,void 0,this)},void 0,!1,void 0,this):E?v7.jsxDEV("div",{className:"w-5 h-5 rounded-full bg-emerald-500/20 flex items-center justify-center",children:v7.jsxDEV(Y8,{className:"w-3 h-3 text-emerald-400"},void 0,!1,void 0,this)},void 0,!1,void 0,this):v7.jsxDEV("div",{className:"w-5 h-5 rounded-full bg-zinc-800 flex items-center justify-center",children:v7.jsxDEV("span",{className:"text-[8px] font-bold text-zinc-500",children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this),v7.jsxDEV("span",{className:`font-semibold truncate ${E?"text-zinc-500":""}`,children:A[0]?.moduleTitle||D.replace(/^\d+_/,"").replace(/_/g," ")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV(rW,{variant:E?"outline":"secondary",className:`ml-auto mr-2 text-[10px] h-5 px-2 ${E?"text-emerald-400 border-emerald-500/30 bg-emerald-500/10":""}`,children:[N,"/",A.length]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV(wH6,{className:"pb-2 pt-1 space-y-1",children:A.map((w)=>{let $=K[w.id],S=Z?.id===w.id,I=w.isLocked;return v7.jsxDEV("button",{onClick:()=>{if(I)return;KJ.open(`/editor/${w.id}`),en(w)},title:I?w.lockReason:void 0,className:`w-full text-left pl-10 pr-3 py-2.5 text-xs rounded-lg transition-all flex items-center gap-2 group
|
|
3171
3171
|
${I?"opacity-50 cursor-not-allowed text-zinc-600 border-l-2 border-transparent":S?"bg-gradient-to-r from-rust/20 to-transparent text-rust font-bold border-l-2 border-rust":"cursor-pointer text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800/30 border-l-2 border-transparent"}`,children:[I?v7.jsxDEV(J8,{className:"w-3 h-3 text-zinc-600"},void 0,!1,void 0,this):v7.jsxDEV(SW,{className:`w-3 h-3 ${S?"text-rust":"text-zinc-600 group-hover:text-zinc-400"}`},void 0,!1,void 0,this),v7.jsxDEV("span",{className:"truncate flex-1",children:w.friendlyName||w.exerciseName},void 0,!1,void 0,this),v7.jsxDEV("div",{className:"flex items-center gap-1.5 ml-auto",children:[w.difficulty&&v7.jsxDEV("div",{className:`w-1.5 h-1.5 rounded-full ${w.difficulty==="easy"?"bg-emerald-500":w.difficulty==="medium"?"bg-amber-500":"bg-red-500"}`,title:w.difficulty},void 0,!1,void 0,this),w.tags?.[0]&&v7.jsxDEV(rW,{variant:"outline",className:"text-[8px] h-3.5 px-1 py-0 border-zinc-700/50 text-zinc-500",children:w.tags[0]},void 0,!1,void 0,this),!I&&$==="pass"&&v7.jsxDEV(v1,{className:"w-3.5 h-3.5 text-emerald-400"},void 0,!1,void 0,this),!I&&$==="fail"&&v7.jsxDEV(z9,{className:"w-3.5 h-3.5 text-red-400"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},w.id,!0,void 0,this)})},void 0,!1,void 0,this)]},D,!0,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),v7.jsxDEV(tW,{value:"practice",className:"flex-1 overflow-hidden m-0 text-zinc-100",children:v7.jsxDEV(tZ,{className:"h-full px-2 py-2",children:[v7.jsxDEV("div",{className:"mb-4",children:v7.jsxDEV(zV7,{children:v7.jsxDEV(D0,{variant:"outline",className:"w-full justify-center bg-zinc-800/30 border-zinc-700/50 hover:bg-zinc-800 hover:text-rust transition-all text-xs font-semibold h-9",children:[v7.jsxDEV(v8,{className:"w-3.5 h-3.5 mr-2"},void 0,!1,void 0,this),"Gerar Desafio"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Q.practice&&Array.isArray(Q.practice)?v7.jsxDEV("div",{className:"space-y-1",children:Q.practice.map((D)=>{let A=K[D.id],N=Z?.id===D.id;return v7.jsxDEV("button",{onClick:()=>{KJ.open(`/editor/${D.id}`),en(D)},className:`w-full text-left px-3 py-3 text-xs rounded-lg transition-all flex items-center gap-3 group
|
|
3172
3172
|
${N?"bg-gradient-to-r from-rust/20 to-transparent text-rust font-bold border-l-2 border-rust":"text-zinc-400 hover:text-zinc-200 hover:bg-zinc-800/30 border-l-2 border-transparent"}`,children:[v7.jsxDEV(v8,{className:`w-4 h-4 ${N?"text-rust":"text-zinc-600"}`},void 0,!1,void 0,this),v7.jsxDEV("span",{className:"truncate flex-1",children:D.exerciseName},void 0,!1,void 0,this),A==="pass"&&v7.jsxDEV(v1,{className:"w-3.5 h-3.5 text-emerald-400"},void 0,!1,void 0,this),A==="fail"&&v7.jsxDEV(z9,{className:"w-3.5 h-3.5 text-red-400"},void 0,!1,void 0,this)]},D.id,!0,void 0,this)})},void 0,!1,void 0,this):v7.jsxDEV("div",{className:"text-center py-8 text-zinc-500",children:[v7.jsxDEV(v8,{className:"w-8 h-8 mx-auto mb-3 text-zinc-700"},void 0,!1,void 0,this),v7.jsxDEV("p",{className:"text-sm",children:"Nenhum exercício gerado ainda"},void 0,!1,void 0,this),v7.jsxDEV("p",{className:"text-xs text-zinc-600 mt-1",children:'Clique em "Gerar Desafio" para criar um!'},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV("section",{className:"flex-1 flex flex-col gap-4 h-full min-h-0",children:[!Z&&v7.jsxDEV(n56,{className:"w-full flex-none p-3 border-zinc-800/50 bg-gradient-to-br from-zinc-900/60 via-zinc-900/40 to-transparent backdrop-blur-sm",children:v7.jsxDEV("div",{className:"text-center py-8 text-zinc-500",children:[v7.jsxDEV(QJ,{className:"w-10 h-10 mx-auto mb-3 text-zinc-700"},void 0,!1,void 0,this),v7.jsxDEV("p",{children:"Select an exercise to start coding"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Z&&v7.jsxDEV(n56,{className:"flex-none py-2 px-0 border-zinc-800/50 bg-gradient-to-br from-zinc-900/60 via-zinc-900/40 to-transparent backdrop-blur-sm",children:v7.jsxDEV(TH6,{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[v7.jsxDEV("div",{className:"space-y-1",children:[v7.jsxDEV("div",{className:"flex items-center gap-2",children:status==="pass"?v7.jsxDEV(rW,{className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30 text-[10px]",children:[v7.jsxDEV(v1,{className:"w-3 h-3 mr-1"},void 0,!1,void 0,this)," Mastered"]},void 0,!0,void 0,this):v7.jsxDEV(rW,{className:"bg-rust/20 text-rust border-rust/30 text-[10px]",children:"Active Challenge"},void 0,!1,void 0,this)},void 0,!1,void 0,this),v7.jsxDEV("h2",{className:"text-2xl font-black tracking-tight text-white line-clamp-1",children:Z?.friendlyName||Z?.exerciseName},void 0,!1,void 0,this),v7.jsxDEV("p",{className:"text-zinc-500 text-xs flex items-center gap-2",children:[v7.jsxDEV("span",{className:"text-zinc-600",children:Z?.moduleTitle||Z?.module.replace(/_/g," ")},void 0,!1,void 0,this),v7.jsxDEV("span",{className:"text-zinc-700",children:"•"},void 0,!1,void 0,this),v7.jsxDEV(py6,{path:Z?.path||"",className:"bg-zinc-800/50 hover:bg-zinc-700/50 px-2 py-1 rounded text-zinc-400 hover:text-zinc-300 text-[10px] w-auto h-auto transition-colors font-mono",children:Z?.path.split("prog").pop()},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v7.jsxDEV("div",{className:"flex items-center gap-2",children:[v7.jsxDEV(D0,{size:"lg",disabled:X||Z?.isLocked,onClick:L56,className:`font-bold shadow-xl ${Z?.isLocked?"bg-zinc-700 shadow-none cursor-not-allowed":"shadow-rust/20 bg-gradient-to-r from-rust to-orange-500 hover:from-rust/90 hover:to-orange-500/90"}`,children:Z?.isLocked?v7.jsxDEV(v7.Fragment,{children:[v7.jsxDEV(J8,{className:"mr-2 h-4 w-4"},void 0,!1,void 0,this)," Locked"]},void 0,!0,void 0,this):X?v7.jsxDEV(v7.Fragment,{children:[v7.jsxDEV(j3,{className:"mr-2 h-4 w-4 animate-spin"},void 0,!1,void 0,this)," Compiling..."]},void 0,!0,void 0,this):v7.jsxDEV(v7.Fragment,{children:[v7.jsxDEV(JJ,{className:"mr-2 h-4 w-4 fill-white"},void 0,!1,void 0,this)," Run Tests"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),v7.jsxDEV(Sa,{children:v7.jsxDEV(D0,{variant:"secondary",size:"lg",onClick:$56,disabled:Y,className:"font-semibold bg-zinc-800/50 hover:bg-zinc-800 border-zinc-700/50",children:[G?v7.jsxDEV(J8,{className:"mr-2 h-4 w-4 text-zinc-500"},void 0,!1,void 0,this):v7.jsxDEV(A3,{className:"mr-2 h-4 w-4 text-purple-400"},void 0,!1,void 0,this),"Explain"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),v7.jsxDEV(Sa,{children:v7.jsxDEV(D0,{variant:"secondary",size:"lg",onClick:I56,disabled:Y,className:"font-semibold bg-zinc-800/50 hover:bg-zinc-800 border-zinc-700/50",children:[G?v7.jsxDEV(J8,{className:"mr-2 h-4 w-4 text-zinc-500"},void 0,!1,void 0,this):v7.jsxDEV(A3,{className:"mr-2 h-4 w-4 text-rust"},void 0,!1,void 0,this),"Hint"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),v7.jsxDEV(BV7,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var kG=W7(P2(),1);var $2=W7(b2(),1);function MV7(){let[X,Y]=kG.useState([]),[J,Q]=kG.useState(""),[Z,K]=kG.useState(!1),[G,B]=kG.useState(!1),[z,F]=kG.useState(null),[q,H]=kG.useState(null),[U,O]=kG.useState({ahead:0,behind:0,currentBranch:"main"}),D=async()=>{try{K(!0),F(null);let E=await fetch("/local/git/status");if(!E.ok)throw Error(await E.text());let R=await E.json();Y(R.changes||[]),O({ahead:R.ahead||0,behind:R.behind||0,currentBranch:R.currentBranch||"main"})}catch(E){F(E.message)}finally{K(!1)}};kG.useEffect(()=>{D();let E=setInterval(D,1e4);return()=>clearInterval(E)},[]);let A=async()=>{if(!J)return;try{K(!0),F(null);let E=await fetch("/local/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:J})});if(!E.ok){let R=await E.json();throw Error(R.error||"Commit failed")}Q(""),H("Changes committed successfully!"),setTimeout(()=>H(null),3000),D()}catch(E){F(E.message)}finally{K(!1)}},N=async()=>{try{B(!0),F(null);let E=await fetch("/local/git/sync",{method:"POST"});if(!E.ok){let R=await E.json();throw Error(R.error||"Sync failed")}H("Synced with GitHub!"),setTimeout(()=>H(null),3000),D()}catch(E){F(E.message)}finally{B(!1)}};return $2.jsxDEV("div",{className:"flex flex-col h-full bg-zinc-900/40 border border-zinc-800 rounded-2xl overflow-hidden backdrop-blur-md shadow-2xl animate-in fade-in zoom-in duration-300",children:[$2.jsxDEV("div",{className:"p-6 border-b border-zinc-800 bg-zinc-900/60 flex items-center justify-between",children:[$2.jsxDEV("div",{className:"flex items-center gap-4",children:[$2.jsxDEV("div",{className:"bg-rust/10 p-2.5 rounded-xl text-rust border border-rust/20",children:$2.jsxDEV(RQ,{size:24},void 0,!1,void 0,this)},void 0,!1,void 0,this),$2.jsxDEV("div",{children:[$2.jsxDEV("h2",{className:"text-xl font-black text-zinc-100 italic tracking-tight flex items-center gap-2",children:["Sync System",$2.jsxDEV("span",{className:"text-[10px] bg-zinc-800 text-zinc-400 px-2 py-0.5 rounded-full font-bold not-italic tracking-widest border border-zinc-700",children:"EXPERIMENTAL"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$2.jsxDEV("p",{className:"text-[10px] text-zinc-500 font-bold uppercase tracking-[0.2em] mt-0.5",children:U.ahead>0?`${U.ahead} Commits to Push`:"Source Control"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$2.jsxDEV("button",{onClick:D,disabled:Z,className:"p-2 hover:bg-zinc-800 rounded-xl text-zinc-400 transition-all active:scale-95 disabled:opacity-30",title:"Refresh Status",children:$2.jsxDEV(_W,{size:18,className:Z?"animate-spin":""},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$2.jsxDEV("div",{className:"flex-1 overflow-y-auto p-10 custom-scrollbar",children:$2.jsxDEV("div",{className:"container mx-auto space-y-8",children:[z&&$2.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/20 text-red-400 p-4 rounded-xl text-sm flex items-start gap-4 animate-in slide-in-from-top-2",children:[$2.jsxDEV(PQ,{size:20,className:"mt-0.5 shrink-0"},void 0,!1,void 0,this),$2.jsxDEV("div",{className:"flex-1",children:[$2.jsxDEV("p",{className:"font-black uppercase text-[10px] tracking-widest mb-1",children:"Error Detected"},void 0,!1,void 0,this),$2.jsxDEV("p",{className:"text-zinc-300 font-medium",children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q&&$2.jsxDEV("div",{className:"bg-green-500/10 border border-green-500/20 text-green-400 p-4 rounded-xl text-sm flex items-center gap-4 animate-in zoom-in",children:[$2.jsxDEV(Y8,{size:20},void 0,!1,void 0,this),$2.jsxDEV("div",{children:[$2.jsxDEV("p",{className:"font-black uppercase text-[10px] tracking-widest mb-0.5",children:"Success"},void 0,!1,void 0,this),$2.jsxDEV("p",{className:"text-zinc-100 font-bold",children:q},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$2.jsxDEV("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[$2.jsxDEV("div",{className:"space-y-4",children:[$2.jsxDEV("div",{className:"flex items-center justify-between mb-2",children:[$2.jsxDEV("h3",{className:"text-[10px] font-black text-zinc-500 uppercase tracking-[0.3em]",children:"PENDING CHANGES"},void 0,!1,void 0,this),$2.jsxDEV("span",{className:"text-[10px] font-black text-rust tabular-nums",children:[X.length," FILES"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$2.jsxDEV("div",{className:"bg-zinc-950/40 border border-zinc-800/80 rounded-2xl p-2 min-h-[300px] flex flex-col shadow-inner",children:Z&&!X.length?$2.jsxDEV("div",{className:"flex-1 flex flex-col items-center justify-center text-zinc-600 gap-4",children:[$2.jsxDEV(aZ,{className:"animate-spin text-rust",size:32},void 0,!1,void 0,this),$2.jsxDEV("span",{className:"text-[10px] font-black uppercase tracking-widest animate-pulse",children:"Scanning Course Files..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):X.length===0?$2.jsxDEV("div",{className:"flex-1 flex flex-col items-center justify-center text-zinc-700 gap-4 opacity-40",children:[$2.jsxDEV(Y8,{size:48,strokeWidth:1.5},void 0,!1,void 0,this),$2.jsxDEV("p",{className:"text-xs font-bold italic tracking-wide",children:"Workspace is synchronized"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$2.jsxDEV("div",{className:"space-y-1 overflow-y-auto max-h-[500px] p-2 custom-scrollbar",children:X.map((E,R)=>$2.jsxDEV("div",{className:"flex items-center gap-4 text-sm text-zinc-300 p-3 bg-zinc-900/30 hover:bg-zinc-800/50 border border-zinc-800/30 hover:border-zinc-700/50 rounded-xl group transition-all",children:[$2.jsxDEV("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center font-mono text-[10px] font-black ${E.code.includes("M")?"bg-blue-500/10 text-blue-400 border border-blue-500/20":E.code.includes("?")?"bg-green-500/10 text-green-400 border border-green-500/20":E.code.includes("D")?"bg-red-500/10 text-red-400 border border-red-500/20":"bg-zinc-800 text-zinc-500"}`,children:E.code.trim()||"?"},void 0,!1,void 0,this),$2.jsxDEV("div",{className:"flex-1 min-w-0",children:[$2.jsxDEV("p",{className:"truncate font-bold text-zinc-200 text-xs",title:E.file,children:E.file},void 0,!1,void 0,this),$2.jsxDEV("p",{className:"text-[9px] text-zinc-600 font-black uppercase tracking-tighter",children:E.code.includes("M")?"Modified":E.code.includes("?")?"Untracked":"Deleted"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},R,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$2.jsxDEV("div",{className:"space-y-4 flex flex-col",children:[$2.jsxDEV("div",{className:"flex items-center mb-2",children:$2.jsxDEV("h3",{className:"text-[10px] font-black text-zinc-500 uppercase tracking-[0.3em]",children:"PREPARE UPDATE"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$2.jsxDEV("div",{className:"bg-zinc-900/40 border border-zinc-800 rounded-2xl p-6 space-y-6 flex-1 shadow-lg",children:[$2.jsxDEV("div",{className:"space-y-3",children:[$2.jsxDEV("div",{className:"flex items-center justify-between",children:[$2.jsxDEV("label",{className:"text-[10px] font-black text-zinc-500 uppercase tracking-widest",children:"Update Description"},void 0,!1,void 0,this),$2.jsxDEV("span",{className:"text-[9px] font-bold text-zinc-600 tabular-nums",children:[J.length,"/200"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$2.jsxDEV("textarea",{value:J,onChange:(E)=>Q(E.target.value.substring(0,200)),placeholder:"Briefly describe your changes...",className:"w-full bg-zinc-950 border border-zinc-800 rounded-xl p-4 text-sm text-zinc-100 focus:outline-none focus:border-rust/50 focus:ring-1 focus:ring-rust/20 transition-all resize-none h-32 font-medium"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$2.jsxDEV("div",{className:"flex flex-col gap-3",children:[$2.jsxDEV("button",{onClick:A,disabled:!J||Z||G||X.length===0,className:"w-full bg-gradient-to-r from-rust to-orange-500 hover:brightness-110 disabled:opacity-20 disabled:grayscale text-white py-4 rounded-xl text-xs font-black uppercase tracking-[0.2em] transition-all shadow-xl shadow-rust/10 active:scale-[0.98] flex items-center justify-center gap-3",children:[Z&&!G?$2.jsxDEV(aZ,{className:"animate-spin",size:16},void 0,!1,void 0,this):$2.jsxDEV(Y8,{size:18},void 0,!1,void 0,this),"COMMIT TO HISTORY"]},void 0,!0,void 0,this),$2.jsxDEV("div",{className:"relative py-2 flex items-center",children:[$2.jsxDEV("div",{className:"flex-1 border-t border-zinc-800"},void 0,!1,void 0,this),$2.jsxDEV("span",{className:"px-3 text-[9px] font-black text-zinc-700 uppercase tracking-widest",children:"or"},void 0,!1,void 0,this),$2.jsxDEV("div",{className:"flex-1 border-t border-zinc-800"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$2.jsxDEV("button",{onClick:N,disabled:Z||G,className:"w-full bg-zinc-800/50 hover:bg-zinc-800 border border-zinc-700/50 hover:border-zinc-600 disabled:opacity-20 text-zinc-300 hover:text-white rounded-xl py-4 font-black uppercase tracking-[0.2em] text-xs transition-all active:scale-[0.98] flex items-center justify-center gap-3",children:[G?$2.jsxDEV(aZ,{className:"animate-spin text-rust",size:16},void 0,!1,void 0,this):$2.jsxDEV(EQ,{size:18},void 0,!1,void 0,this),"PUSH & PULL (SYNC) ",U.ahead>0&&`(${U.ahead})`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$2.jsxDEV("p",{className:"text-[9px] text-zinc-600 font-bold text-center italic mt-auto",children:"Your work is automatically cached locally, but syncing ensures persistence across devices."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var uG6=W7(b2(),1);function OV7(){return uG6.jsxDEV("div",{className:"w-full h-full bg-zinc-950/50 flex-1 flex flex-col items-center justify-center p-8",children:uG6.jsxDEV("div",{className:"container mx-auto h-full max-h-[800px]",children:uG6.jsxDEV(MV7,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var J26=W7(P2(),1);var yY=W7(P2(),1);var P4=W7(b2(),1);function DV7({onClose:X}){let Y=w2(Bq),J=w2(zq),[Q,Z]=yY.useState("vs-code"),[K,G]=yY.useState(""),[B,z]=yY.useState(""),[F,q]=yY.useState(""),[H,U]=yY.useState(""),[O,D]=yY.useState("openai"),[A,N]=yY.useState("gpt-4o-mini"),[E,R]=yY.useState(!1),[w,$]=yY.useState(!1);yY.useEffect(()=>{if(w56(),Y?.metadata)try{let I=JSON.parse(Y.metadata);if(I.ide)Z(I.ide)}catch(I){}},[Y]),yY.useEffect(()=>{if(J.openaiKey)G(J.openaiKey);if(J.anthropicKey)z(J.anthropicKey);if(J.geminiKey)q(J.geminiKey);if(J.xaiKey)U(J.xaiKey);if(J.ide)Z(J.ide);if(J.aiProvider)D(J.aiProvider);if(J.aiModel)N(J.aiModel)},[J]);let S=async()=>{R(!0),await Ih6({ide:Q}),await Sh6({openaiKey:K,anthropicKey:B,geminiKey:F,xaiKey:H,ide:Q,aiProvider:O,aiModel:A}),R(!1),$(!0),setTimeout(()=>{$(!1),X()},1500)};return P4.jsxDEV(Cl,{open:!0,onOpenChange:(I)=>!I&&X(),children:P4.jsxDEV(Pl,{className:"w-full max-w-lg bg-zinc-900 p-8 rounded-3xl border-none",showCloseButton:!1,children:[P4.jsxDEV(E06,{className:"flex flex-row justify-between items-center mb-8",children:[P4.jsxDEV(R06,{className:"text-xl font-black text-white flex items-center gap-3",children:[P4.jsxDEV(oZ,{className:"w-6 h-6 text-rust"},void 0,!1,void 0,this),"Settings"]},void 0,!0,void 0,this),P4.jsxDEV(Ta,{asChild:!0,children:P4.jsxDEV("button",{className:"p-2 hover:bg-zinc-800 rounded-full transition-colors",children:P4.jsxDEV(ZJ,{className:"w-5 h-5 text-zinc-500"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P4.jsxDEV("div",{className:"space-y-8",children:[P4.jsxDEV("div",{className:"space-y-4",children:[P4.jsxDEV("div",{className:"flex items-center gap-2",children:[P4.jsxDEV(vW,{className:"w-4 h-4 text-zinc-400"},void 0,!1,void 0,this),P4.jsxDEV("h3",{className:"text-sm font-bold text-zinc-200",children:"Integrated IDE"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P4.jsxDEV("p",{className:"text-xs text-zinc-500 -mt-2",children:"Choose which editor you're using for a better experience."},void 0,!1,void 0,this),P4.jsxDEV("div",{className:"grid grid-cols-2 gap-3",children:[{id:"vs-code",name:"VS Code"},{id:"cursor",name:"Cursor"},{id:"zed",name:"Zed"},{id:"antigravity",name:"Antigravity"},{id:"vim",name:"Vim/Neovim"}].map((I)=>P4.jsxDEV("button",{onClick:()=>Z(I.id),className:`p-3 text-xs font-semibold rounded-xl border transition-all text-left flex items-center justify-between
|
|
3173
3173
|
${Q===I.id?"bg-rust/10 border-rust text-white":"bg-zinc-950/50 border-zinc-800 text-zinc-500 hover:border-zinc-700 hover:text-zinc-300"}`,children:[I.name,Q===I.id&&P4.jsxDEV(CQ,{className:"w-3.5 h-3.5"},void 0,!1,void 0,this)]},I.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P4.jsxDEV("div",{className:"space-y-4",children:[P4.jsxDEV("div",{className:"flex items-center gap-2",children:[P4.jsxDEV(wW,{className:"w-4 h-4 text-zinc-400"},void 0,!1,void 0,this),P4.jsxDEV("h3",{className:"text-sm font-bold text-zinc-200",children:"AI Tutor Configuration"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P4.jsxDEV("p",{className:"text-xs text-zinc-500 -mt-2",children:["Configure your AI provider. Keys are stored locally in ",P4.jsxDEV("code",{className:"bg-zinc-800 px-1 rounded",children:".progy/"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),P4.jsxDEV("div",{className:"space-y-4",children:[P4.jsxDEV("div",{className:"grid grid-cols-2 gap-2",children:[{id:"openai",name:"OpenAI",model:"gpt-4o-mini"},{id:"anthropic",name:"Anthropic",model:"claude-sonnet-4-5"},{id:"google",name:"Google",model:"gemini-3-flash-preview"},{id:"xai",name:"xAI",model:"grok-4-1-fast-reasoning"}].map((I)=>P4.jsxDEV("button",{onClick:()=>{D(I.id),N(I.model)},className:`p-2.5 text-xs font-semibold rounded-xl border transition-all text-left flex items-center gap-2
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "progy",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"description": "The interactive CLI and learning platform for Progy courses.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,15 +37,12 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@nanostores/query": "^0.3.4",
|
|
39
39
|
"@nanostores/react": "^0.7.2",
|
|
40
|
+
"@progy/core": "0.1.0",
|
|
40
41
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
41
42
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
42
|
-
"@radix-ui/react-label": "^2.1.8",
|
|
43
|
-
"@radix-ui/react-tabs": "^1.1.13",
|
|
44
|
-
"@types/adm-zip": "^0.5.7",
|
|
45
43
|
"@types/bun": "latest",
|
|
46
44
|
"@types/react": "^19.0.0",
|
|
47
45
|
"@types/react-dom": "^19.0.0",
|
|
48
|
-
"autoprefixer": "^10.4.19",
|
|
49
46
|
"class-variance-authority": "^0.7.0",
|
|
50
47
|
"clsx": "^2.1.1",
|
|
51
48
|
"highlight.js": "^11.11.1",
|
|
@@ -56,47 +53,22 @@
|
|
|
56
53
|
"react-dom": "19.2.4",
|
|
57
54
|
"react-markdown": "^9.0.1",
|
|
58
55
|
"rehype-highlight": "^7.0.0",
|
|
59
|
-
"tailwind-merge": "^2.3.0"
|
|
60
|
-
"@progy/core": "0.1.0"
|
|
56
|
+
"tailwind-merge": "^2.3.0"
|
|
61
57
|
},
|
|
62
58
|
"peerDependencies": {
|
|
63
59
|
"typescript": "^5"
|
|
64
60
|
},
|
|
65
61
|
"dependencies": {
|
|
66
|
-
"@ai-sdk/react": "^3.0.79",
|
|
67
|
-
"@codemirror/autocomplete": "^6.20.0",
|
|
68
|
-
"@codemirror/commands": "^6.10.2",
|
|
69
|
-
"@codemirror/lang-cpp": "^6.0.3",
|
|
70
|
-
"@codemirror/lang-css": "^6.3.1",
|
|
71
|
-
"@codemirror/lang-go": "^6.0.1",
|
|
72
|
-
"@codemirror/lang-html": "^6.4.11",
|
|
73
|
-
"@codemirror/lang-javascript": "^6.2.4",
|
|
74
|
-
"@codemirror/lang-json": "^6.0.2",
|
|
75
|
-
"@codemirror/lang-markdown": "^6.5.0",
|
|
76
|
-
"@codemirror/lang-python": "^6.2.1",
|
|
77
|
-
"@codemirror/lang-rust": "^6.0.2",
|
|
78
|
-
"@codemirror/lang-sql": "^6.10.0",
|
|
79
|
-
"@codemirror/lang-yaml": "^6.1.2",
|
|
80
|
-
"@codemirror/language": "^6.12.1",
|
|
81
|
-
"@codemirror/legacy-modes": "^6.5.2",
|
|
82
|
-
"@codemirror/lint": "^6.9.3",
|
|
83
|
-
"@codemirror/search": "^6.6.0",
|
|
84
|
-
"@codemirror/state": "^6.5.4",
|
|
85
|
-
"@codemirror/theme-one-dark": "^6.1.3",
|
|
86
|
-
"@codemirror/view": "^6.39.13",
|
|
87
62
|
"@nanostores/persistent": "^1.3.3",
|
|
88
63
|
"@nanostores/router": "^1.0.0",
|
|
89
|
-
"@
|
|
64
|
+
"@tailwindcss/typography": "^0.5.19",
|
|
90
65
|
"@types/katex": "^0.16.8",
|
|
91
|
-
"@types/mdast": "^4.0.4",
|
|
92
|
-
"@types/unist": "^3.0.3",
|
|
93
|
-
"adm-zip": "^0.5.16",
|
|
94
|
-
"ai": "^6.0.77",
|
|
95
66
|
"better-auth": "^1.4.18",
|
|
96
67
|
"cmdk": "^1.1.1",
|
|
97
|
-
"codemirror": "^6.0.2",
|
|
98
68
|
"commander": "^12.1.0",
|
|
99
69
|
"katex": "^0.16.28",
|
|
70
|
+
"mermaid": "^11.12.2",
|
|
71
|
+
"react-resizable-panels": "^4.6.2",
|
|
100
72
|
"rehype-katex": "^7.0.1",
|
|
101
73
|
"remark-breaks": "^4.0.0",
|
|
102
74
|
"remark-callouts": "^2.0.0",
|
|
@@ -104,11 +76,8 @@
|
|
|
104
76
|
"remark-gfm": "^4.0.1",
|
|
105
77
|
"remark-math": "^6.0.0",
|
|
106
78
|
"sharp": "^0.34.5",
|
|
107
|
-
"shiki": "^3.22.0",
|
|
108
|
-
"smol-toml": "^1.6.0",
|
|
109
79
|
"unist-util-visit": "^5.1.0",
|
|
110
80
|
"use-sound": "^5.0.0",
|
|
111
|
-
"use-stick-to-bottom": "^1.1.3"
|
|
112
|
-
"zod": "^4.3.6"
|
|
81
|
+
"use-stick-to-bottom": "^1.1.3"
|
|
113
82
|
}
|
|
114
83
|
}
|