github-actions[bot] commited on
Commit
7573bf4
Β·
1 Parent(s): 2f06545

πŸš€ Auto-deploy frontend from GitHub (de0680e)

Browse files
This view is limited to 50 files because it contains too many changes. Β  See raw diff
Files changed (50) hide show
  1. assets/{AIChatPage-CI1qQgCG.js β†’ AIChatPage-mgDEqx28.js} +2 -2
  2. assets/{AdminDashboard-B2eiYi-q.js β†’ AdminDashboard-DrvV_gE1.js} +0 -0
  3. assets/{AssessmentPage-YsCyxvJJ.js β†’ AssessmentPage-Zx-Hx4dd.js} +1 -1
  4. assets/{AvatarShop-BeFk31yM.js β†’ AvatarShop-Bl68yioD.js} +2 -2
  5. assets/{ChatMarkdown-fgwaycBR.js β†’ ChatMarkdown-BSQ2GO-C.js} +1 -1
  6. assets/{CompetencyRadarChart-CBuH8ru8.js β†’ CompetencyRadarChart-CsWJvNpV.js} +1 -1
  7. assets/{ConfirmModal-6cgkqXAT.js β†’ ConfirmModal-D2z4s_BB.js} +1 -1
  8. assets/{FloatingAITutor-BIdguqCV.js β†’ FloatingAITutor-D0ZeNKA0.js} +2 -2
  9. assets/{GradesPage-Y0HsmLPP.js β†’ GradesPage-BAqThNDB.js} +2 -2
  10. assets/{HeroBanner-CKiXGluA.js β†’ HeroBanner-DQ9n4La7.js} +3 -3
  11. assets/{InitialAssessmentModal-CknVaqMx.js β†’ InitialAssessmentModal-D5CEKMhd.js} +1 -1
  12. assets/{LeaderboardPage-D9eaC9ey.js β†’ LeaderboardPage-IhqEnbdk.js} +3 -3
  13. assets/{LearningPath-BBE0vZ0S.js β†’ LearningPath-COPS3nvD.js} +1 -1
  14. assets/{LoginPage-DLaoyzV8.js β†’ LoginPage-LluNGRPB.js} +1 -1
  15. assets/{LogoutActionButton-lUNItet6.js β†’ LogoutActionButton-Dl6IiDHd.js} +1 -1
  16. assets/{ModuleFolderCard-DKBrO5a8.js β†’ ModuleFolderCard-Du9VPsWG.js} +1 -1
  17. assets/{ModulesPage-cZJm_yoJ.js β†’ ModulesPage-Bm1A4Op1.js} +0 -0
  18. assets/{ProfileModal-Gwxh5tYO.js β†’ ProfileModal-bQKyq1JA.js} +3 -3
  19. assets/{ProfilePictureUploader-CX_IZAwE.js β†’ ProfilePictureUploader-CyCaD4jN.js} +4 -4
  20. assets/{QuizBattlePage-Bwu0snEF.js β†’ QuizBattlePage-BaCri_Ce.js} +0 -0
  21. assets/{RewardsModal-CPyFRkMy.js β†’ RewardsModal-kuski-56.js} +1 -1
  22. assets/RightSidebar-CmYzVUKQ.js +0 -1
  23. assets/RightSidebar-u-5bXOuZ.js +1 -0
  24. assets/{ScientificCalculator-DRuSfTXj.js β†’ ScientificCalculator-DNPhV2R9.js} +1 -1
  25. assets/SettingsModal-BbkSqdYG.js +0 -16
  26. assets/SettingsModal-tD3B9SgO.js +17 -0
  27. assets/{Sidebar-2LZAqf7E.js β†’ Sidebar-BxInp2XA.js} +2 -2
  28. assets/{SupplementalBanner-DFkcXPOZ.js β†’ SupplementalBanner-B_AwC-uH.js} +1 -1
  29. assets/{SupplementalPillCarousel-BqNTelmK.js β†’ SupplementalPillCarousel-dQl-2GJp.js} +1 -1
  30. assets/TeacherDashboard-BmaSDmQs.js +0 -0
  31. assets/TeacherDashboard-CZdYfdg9.js +0 -0
  32. assets/{XPNotification-DRsFdUWw.js β†’ XPNotification-CsIvt8Wa.js} +1 -1
  33. assets/{automationService-7m3RFJA3.js β†’ automationService-rXKxA-Jx.js} +1 -1
  34. assets/{bell-clcSMJn6.js β†’ bell-CiUaN6S3.js} +1 -1
  35. assets/{button-DCfeFHoH.js β†’ button-BPmLcOpC.js} +1 -1
  36. assets/card-D4dmQVNb.js +0 -6
  37. assets/{chart-column-B3jJOD5i.js β†’ chart-column-CLoxLorp.js} +1 -1
  38. assets/{chatService-DwVkLoat.js β†’ chatService-DL-kTPZE.js} +1 -1
  39. assets/{check-BLSo9L0H.js β†’ check-Dk6iwDFI.js} +1 -1
  40. assets/{check-check-B_HghS1Z.js β†’ check-check-DFG24Nyg.js} +1 -1
  41. assets/{chevron-left-BWpgclqc.js β†’ chevron-left-CzSo_K0d.js} +1 -1
  42. assets/{chevron-right-COqGruhh.js β†’ chevron-right-U0AqPOPj.js} +1 -1
  43. assets/{chevron-up-Cdvz2TMJ.js β†’ chevron-up-BpMhRyJp.js} +2 -2
  44. assets/{circle-alert-CP9K3300.js β†’ circle-alert-DDOZHhZK.js} +1 -1
  45. assets/{circle-check-C0FPGTrp.js β†’ circle-check-C5Psopk3.js} +1 -1
  46. assets/{circle-check-big-m1SvzGFL.js β†’ circle-check-big-BNRlH5pv.js} +1 -1
  47. assets/{circle-help-B8apTIdU.js β†’ circle-help-PS1uII8x.js} +1 -1
  48. assets/{clipboard-check-DqBu2Pqb.js β†’ clipboard-check-RuPght2T.js} +1 -1
  49. assets/{clock-D1Ecvltm.js β†’ clock-8t0UYgg3.js} +1 -1
  50. assets/{diagnosticService-BDYTUoqk.js β†’ diagnosticService-DacNtsbN.js} +2 -2
assets/{AIChatPage-CI1qQgCG.js β†’ AIChatPage-mgDEqx28.js} RENAMED
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BaOs5Ayg.js","assets/vendor-react-B4AQeu28.js","assets/vendor-firebase-firestore-CH1lNiRF.js","assets/vendor-firebase-core-CO26nNq6.js","assets/vendor-firebase-auth-BLpRW_zO.js","assets/vendor-firebase-storage-B3igpVVS.js","assets/vendor-firebase-analytics-CTiUNb0-.js","assets/vendor-radix-BorKzPz9.js","assets/vendor-charts-D8hf8tI0.js","assets/vendor-markdown-yqZQ_iQm.js","assets/vendor-markdown-CfVKi3_s.css","assets/index-DdX2rVyy.css"])))=>i.map(i=>d[i]);
2
- import{ay as D,u as F,_ as $,j as S,m as C,D as z}from"./index-BaOs5Ayg.js";import{r as a,j as e}from"./vendor-react-B4AQeu28.js";import{B as O}from"./button-DCfeFHoH.js";import{I}from"./input-D28h_UTJ.js";import H from"./ChatMarkdown-fgwaycBR.js";import{P as Y}from"./plus-DkG35AoH.js";import{S as G}from"./search-Bq99THgc.js";import{T as Q}from"./trash-2-HTnKafZd.js";import{S as W}from"./send-CwwDU3uJ.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";function q(r){return r?r instanceof Date?r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):typeof r=="object"&&"toDate"in r?r.toDate().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):String(r):""}const xe=()=>{const{sessions:r,activeSessionId:o,isLoading:l,loadingSessionId:A,setActiveSessionId:d,createNewSession:b,sendMessage:L,deleteSession:T,getActiveSession:_}=D(),{userProfile:c}=F(),[x,P]=a.useState(""),[n,g]=a.useState(""),[y,j]=a.useState(!1),m=a.useRef(null),h=a.useRef(!0),u=a.useRef(!1),i=_(),f=i?.messages||[],M=f.some(t=>t.sender==="ai"&&t.id.startsWith("stream-")),v=l&&o===A&&!M,w=(t="auto")=>{const s=m.current;s&&s.scrollTo({top:s.scrollHeight,behavior:t})},E=()=>{const t=m.current;return t?t.scrollHeight-t.scrollTop-t.clientHeight<=120:!0},R=()=>{h.current=E()};a.useEffect(()=>{$(async()=>{const{warmupBackend:t}=await import("./index-BaOs5Ayg.js").then(s=>s.b2);return{warmupBackend:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(({warmupBackend:t})=>{t()}).catch(t=>{console.warn("AI chat warmup skipped:",t)})},[]),a.useEffect(()=>{if(!h.current)return;const t=window.requestAnimationFrame(()=>w("auto"));return()=>window.cancelAnimationFrame(t)},[f,v]),a.useEffect(()=>{h.current=!0,w("auto")},[o]);const N=async()=>{if(!(!n.trim()||l||y||u.current)){u.current=!0,j(!0);try{let t=o;t||(t=b(),d(t));const s=n.trim();g(""),await L(t,s)}finally{u.current=!1,j(!1)}}},k=()=>{const t=b();d(t)},B=(t,s)=>{s.stopPropagation(),T(t)},p=r.filter(t=>t.title.toLowerCase().includes(x.toLowerCase())||t.preview.toLowerCase().includes(x.toLowerCase()));return e.jsxs("div",{className:"h-full min-h-0 overflow-hidden flex gap-4 px-4 sm:px-6 xl:px-10 py-6",children:[e.jsxs("div",{className:"w-80 min-h-0 flex flex-col bg-[#f7f9fc] rounded-3xl border border-[#dde3eb] overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-[#dde3eb] flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-r from-sky-600 to-sky-500 rounded-2xl flex items-center justify-center",children:e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-10 h-10 object-contain drop-shadow-md"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold font-display text-[#0a1628]",children:"L.O.L.I."}),e.jsx("p",{className:"text-[10px] text-[#5a6578]",children:"Your AI Math Tutor"})]})]}),e.jsxs("button",{onClick:k,className:"w-full bg-gradient-to-r from-sky-600 to-sky-500 hover:from-sky-700 hover:to-sky-600 text-white px-4 py-3 rounded-xl text-sm font-bold transition-all shadow-md hover:shadow-lg flex items-center justify-center gap-2",children:[e.jsx(Y,{size:18}),"New Chat"]}),e.jsxs("div",{className:"relative mt-3",children:[e.jsx(G,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500",size:14}),e.jsx(I,{type:"text",placeholder:"Search conversations...",value:x,onChange:t=>P(t.target.value),className:"w-full pl-9 pr-3 py-2 text-xs rounded-xl border-[#dde3eb] focus:border-sky-600 focus:ring-2 focus:ring-sky-100"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[e.jsx("div",{className:"flex items-center justify-between mb-2 px-2",children:e.jsxs("span",{className:"text-xs font-bold text-[#5a6578]",children:[p.length," Conversations"]})}),e.jsx(S,{children:p.map(t=>e.jsxs(C.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},onClick:()=>d(t.id),className:`group p-3 rounded-2xl cursor-pointer transition-all duration-200 border relative ${o===t.id?"bg-sky-50 border-sky-200 shadow-sm":"bg-[#edf1f7] border-transparent hover:bg-[#dde3eb] hover:border-[#dde3eb]"}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-1",children:[e.jsx("h3",{className:`text-xs font-bold mb-0.5 pr-6 line-clamp-1 ${o===t.id?"text-sky-700":"text-[#0a1628]"}`,children:t.title}),e.jsx("button",{onClick:s=>B(t.id,s),className:"absolute top-2 right-2 p-1.5 rounded-lg opacity-0 group-hover:opacity-100 hover:bg-red-100 text-slate-500 hover:text-red-600 transition-all",children:e.jsx(Q,{size:12})})]}),e.jsx("p",{className:"text-[10px] text-[#5a6578] mb-2 line-clamp-2",children:t.preview}),e.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[e.jsx("span",{className:"text-slate-500",children:t.date}),e.jsxs("span",{className:`px-2 py-0.5 rounded-full ${o===t.id?"bg-sky-100 text-sky-600":"bg-[#dde3eb] text-[#5a6578]"}`,children:[t.messageCount," msgs"]})]})]},t.id))}),p.length===0&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-16 h-16 object-contain mx-auto mb-2 opacity-60 drop-shadow-sm grayscale contrast-50"}),e.jsx("p",{className:"text-sm text-slate-500",children:"No conversations found"}),e.jsx("p",{className:"text-xs text-slate-500/60 mt-1",children:"Start a new chat!"})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-[#f7f9fc] rounded-3xl border border-[#dde3eb] overflow-hidden",children:o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-4 border-b border-[#dde3eb] flex items-center justify-between flex-shrink-0",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-bold font-display text-[#0a1628]",children:i?.title}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:i?.date})]}),e.jsx("div",{className:"flex items-center gap-2",children:i?.topics.map((t,s)=>e.jsx("span",{className:"px-3 py-1 bg-sky-50 text-sky-600 text-xs font-bold rounded-lg",children:t},s))})]}),e.jsxs("div",{ref:m,onScroll:R,className:"flex-1 overflow-y-auto overscroll-contain p-6 space-y-4 bg-[#edf1f7] min-h-0",children:[e.jsx(S,{children:f.map(t=>e.jsxs(C.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex items-end gap-2 ${t.sender==="user"?"justify-end":"justify-start"}`,children:[t.sender!=="user"&&e.jsx("div",{className:"w-7 h-7 rounded-full bg-gradient-to-r from-sky-600 to-sky-500 flex items-center justify-center flex-shrink-0 mb-1",children:e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI",className:"w-5 h-5 object-contain"})}),e.jsxs("div",{className:`max-w-[70%] rounded-2xl px-5 py-3 ${t.sender==="user"?"bg-gradient-to-r from-sky-600 to-sky-500 text-white":"bg-white text-[#0a1628] shadow-md border border-[#dde3eb]"}`,children:[t.sender==="user"?e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:t.text}):e.jsx(H,{children:t.text}),e.jsx("p",{className:`text-[10px] mt-1.5 ${t.sender==="user"?"text-sky-200":"text-slate-500"}`,children:q(t.timestamp)})]}),t.sender==="user"&&e.jsx(z,{src:c?.photo,name:c?.name,gender:c?.gender,className:"w-7 h-7 flex-shrink-0 mb-1",fallbackClassName:"text-[10px]"})]},t.id))}),v&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"bg-white text-[#0a1628] shadow-md border border-[#dde3eb] rounded-2xl px-5 py-3 max-w-[70%]",children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce [animation-delay:150ms]"}),e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce [animation-delay:300ms]"})]})})})]}),e.jsx("div",{className:"p-4 border-t border-[#dde3eb] bg-white flex-shrink-0",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(I,{type:"text",value:n,onChange:t=>g(t.target.value),onKeyPress:t=>t.key==="Enter"&&N(),placeholder:"Ask me anything about math...",className:"flex-1 px-5 py-3 rounded-xl border-[#dde3eb] focus:border-sky-600 focus:ring-2 focus:ring-sky-100 text-sm"}),e.jsx(O,{onClick:N,disabled:!n.trim()||l||y,className:"px-6 bg-gradient-to-r from-sky-600 to-sky-500 hover:from-sky-700 hover:to-sky-600 text-white rounded-xl transition-all disabled:opacity-50 disabled:cursor-not-allowed shadow-md hover:shadow-lg",children:e.jsx(W,{size:18})})]})})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 text-center",children:[e.jsx("div",{className:"w-24 h-24 bg-gradient-to-r from-sky-100 to-cyan-100 rounded-3xl flex items-center justify-center mb-6",children:e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-20 h-20 object-contain drop-shadow-lg"})}),e.jsx("h2",{className:"text-2xl font-bold font-display text-[#0a1628] mb-1",children:"Welcome to L.O.L.I."}),e.jsx("p",{className:"text-sky-600 text-sm font-bold tracking-wide uppercase mb-4",children:"Logical Operations & Learning Intelligence"}),e.jsx("p",{className:"text-[#5a6578] mb-6 max-w-md",children:"Your personal AI math tutor is here to help! Start a new conversation or select one from the sidebar."}),e.jsx("button",{onClick:k,className:"px-6 py-3 bg-gradient-to-r from-sky-600 to-sky-500 hover:from-sky-700 hover:to-sky-600 text-white rounded-xl font-bold shadow-lg hover:shadow-xl transition-all",children:"Start Your First Chat"}),e.jsx("div",{className:"mt-8 grid grid-cols-3 gap-4 max-w-2xl",children:["Algebra","Geometry","Calculus"].map(t=>e.jsxs("div",{className:"p-4 bg-[#edf1f7] rounded-xl border border-[#dde3eb]",children:[e.jsx("p",{className:"text-sm font-bold text-[#0a1628]",children:t}),e.jsxs("p",{className:"text-xs text-[#5a6578] mt-1",children:["Get help with ",t.toLowerCase()]})]},t))})]})})]})};export{xe as default};
 
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-uASBzalf.js","assets/vendor-react-B4AQeu28.js","assets/vendor-firebase-firestore-CP9q7ISf.js","assets/vendor-firebase-core-DCQrgkxC.js","assets/vendor-firebase-auth-Bcpr4O6E.js","assets/vendor-firebase-storage-dc5X5yTv.js","assets/vendor-firebase-analytics-CHPyhRzk.js","assets/vendor-radix-xDOIcVzp.js","assets/vendor-charts-Ckgeb0nY.js","assets/vendor-markdown-yqZQ_iQm.js","assets/vendor-markdown-CfVKi3_s.css","assets/index-D9pRNq5G.css"])))=>i.map(i=>d[i]);
2
+ import{az as F,l as $,_ as z,g as S,m as C,F as D}from"./index-uASBzalf.js";import{r as a,j as e}from"./vendor-react-B4AQeu28.js";import{B as O}from"./button-BPmLcOpC.js";import{I}from"./input--XHWlmp1.js";import H from"./ChatMarkdown-BSQ2GO-C.js";import{P as Y}from"./plus-Cy6hz5PP.js";import{S as G}from"./search-Col42W4Q.js";import{T as Q}from"./trash-2-D7q6y9vT.js";import{S as W}from"./send-bMgoXVnc.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";function q(r){return r?r instanceof Date?r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):typeof r=="object"&&"toDate"in r?r.toDate().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):String(r):""}const xe=()=>{const{sessions:r,activeSessionId:o,isLoading:l,loadingSessionId:A,setActiveSessionId:d,createNewSession:b,sendMessage:L,deleteSession:T,getActiveSession:_}=F(),{userProfile:c}=$(),[x,P]=a.useState(""),[n,g]=a.useState(""),[y,j]=a.useState(!1),m=a.useRef(null),h=a.useRef(!0),u=a.useRef(!1),i=_(),f=i?.messages||[],M=f.some(t=>t.sender==="ai"&&t.id.startsWith("stream-")),v=l&&o===A&&!M,w=(t="auto")=>{const s=m.current;s&&s.scrollTo({top:s.scrollHeight,behavior:t})},E=()=>{const t=m.current;return t?t.scrollHeight-t.scrollTop-t.clientHeight<=120:!0},R=()=>{h.current=E()};a.useEffect(()=>{z(async()=>{const{warmupBackend:t}=await import("./index-uASBzalf.js").then(s=>s.b3);return{warmupBackend:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(({warmupBackend:t})=>{t()}).catch(t=>{console.warn("AI chat warmup skipped:",t)})},[]),a.useEffect(()=>{if(!h.current)return;const t=window.requestAnimationFrame(()=>w("auto"));return()=>window.cancelAnimationFrame(t)},[f,v]),a.useEffect(()=>{h.current=!0,w("auto")},[o]);const N=async()=>{if(!(!n.trim()||l||y||u.current)){u.current=!0,j(!0);try{let t=o;t||(t=b(),d(t));const s=n.trim();g(""),await L(t,s)}finally{u.current=!1,j(!1)}}},k=()=>{const t=b();d(t)},B=(t,s)=>{s.stopPropagation(),T(t)},p=r.filter(t=>t.title.toLowerCase().includes(x.toLowerCase())||t.preview.toLowerCase().includes(x.toLowerCase()));return e.jsxs("div",{className:"h-full min-h-0 overflow-hidden flex gap-4 px-4 sm:px-6 xl:px-10 py-6",children:[e.jsxs("div",{className:"w-80 min-h-0 flex flex-col bg-[#f7f9fc] rounded-3xl border border-[#dde3eb] overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-[#dde3eb] flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-r from-sky-600 to-sky-500 rounded-2xl flex items-center justify-center",children:e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-10 h-10 object-contain drop-shadow-md"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold font-display text-[#0a1628]",children:"L.O.L.I."}),e.jsx("p",{className:"text-[10px] text-[#5a6578]",children:"Your AI Math Tutor"})]})]}),e.jsxs("button",{onClick:k,className:"w-full bg-gradient-to-r from-sky-600 to-sky-500 hover:from-sky-700 hover:to-sky-600 text-white px-4 py-3 rounded-xl text-sm font-bold transition-all shadow-md hover:shadow-lg flex items-center justify-center gap-2",children:[e.jsx(Y,{size:18}),"New Chat"]}),e.jsxs("div",{className:"relative mt-3",children:[e.jsx(G,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500",size:14}),e.jsx(I,{type:"text",placeholder:"Search conversations...",value:x,onChange:t=>P(t.target.value),className:"w-full pl-9 pr-3 py-2 text-xs rounded-xl border-[#dde3eb] focus:border-sky-600 focus:ring-2 focus:ring-sky-100"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[e.jsx("div",{className:"flex items-center justify-between mb-2 px-2",children:e.jsxs("span",{className:"text-xs font-bold text-[#5a6578]",children:[p.length," Conversations"]})}),e.jsx(S,{children:p.map(t=>e.jsxs(C.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},onClick:()=>d(t.id),className:`group p-3 rounded-2xl cursor-pointer transition-all duration-200 border relative ${o===t.id?"bg-sky-50 border-sky-200 shadow-sm":"bg-[#edf1f7] border-transparent hover:bg-[#dde3eb] hover:border-[#dde3eb]"}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-1",children:[e.jsx("h3",{className:`text-xs font-bold mb-0.5 pr-6 line-clamp-1 ${o===t.id?"text-sky-700":"text-[#0a1628]"}`,children:t.title}),e.jsx("button",{onClick:s=>B(t.id,s),className:"absolute top-2 right-2 p-1.5 rounded-lg opacity-0 group-hover:opacity-100 hover:bg-red-100 text-slate-500 hover:text-red-600 transition-all",children:e.jsx(Q,{size:12})})]}),e.jsx("p",{className:"text-[10px] text-[#5a6578] mb-2 line-clamp-2",children:t.preview}),e.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[e.jsx("span",{className:"text-slate-500",children:t.date}),e.jsxs("span",{className:`px-2 py-0.5 rounded-full ${o===t.id?"bg-sky-100 text-sky-600":"bg-[#dde3eb] text-[#5a6578]"}`,children:[t.messageCount," msgs"]})]})]},t.id))}),p.length===0&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-16 h-16 object-contain mx-auto mb-2 opacity-60 drop-shadow-sm grayscale contrast-50"}),e.jsx("p",{className:"text-sm text-slate-500",children:"No conversations found"}),e.jsx("p",{className:"text-xs text-slate-500/60 mt-1",children:"Start a new chat!"})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-[#f7f9fc] rounded-3xl border border-[#dde3eb] overflow-hidden",children:o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-4 border-b border-[#dde3eb] flex items-center justify-between flex-shrink-0",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-bold font-display text-[#0a1628]",children:i?.title}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:i?.date})]}),e.jsx("div",{className:"flex items-center gap-2",children:i?.topics.map((t,s)=>e.jsx("span",{className:"px-3 py-1 bg-sky-50 text-sky-600 text-xs font-bold rounded-lg",children:t},s))})]}),e.jsxs("div",{ref:m,onScroll:R,className:"flex-1 overflow-y-auto overscroll-contain p-6 space-y-4 bg-[#edf1f7] min-h-0",children:[e.jsx(S,{children:f.map(t=>e.jsxs(C.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex items-end gap-2 ${t.sender==="user"?"justify-end":"justify-start"}`,children:[t.sender!=="user"&&e.jsx("div",{className:"w-7 h-7 rounded-full bg-gradient-to-r from-sky-600 to-sky-500 flex items-center justify-center flex-shrink-0 mb-1",children:e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI",className:"w-5 h-5 object-contain"})}),e.jsxs("div",{className:`max-w-[70%] rounded-2xl px-5 py-3 ${t.sender==="user"?"bg-gradient-to-r from-sky-600 to-sky-500 text-white":"bg-white text-[#0a1628] shadow-md border border-[#dde3eb]"}`,children:[t.sender==="user"?e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:t.text}):e.jsx(H,{children:t.text}),e.jsx("p",{className:`text-[10px] mt-1.5 ${t.sender==="user"?"text-sky-200":"text-slate-500"}`,children:q(t.timestamp)})]}),t.sender==="user"&&e.jsx(D,{src:c?.photo,name:c?.name,gender:c?.gender,className:"w-7 h-7 flex-shrink-0 mb-1",fallbackClassName:"text-[10px]"})]},t.id))}),v&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"bg-white text-[#0a1628] shadow-md border border-[#dde3eb] rounded-2xl px-5 py-3 max-w-[70%]",children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce [animation-delay:150ms]"}),e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce [animation-delay:300ms]"})]})})})]}),e.jsx("div",{className:"p-4 border-t border-[#dde3eb] bg-white flex-shrink-0",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(I,{type:"text",value:n,onChange:t=>g(t.target.value),onKeyPress:t=>t.key==="Enter"&&N(),placeholder:"Ask me anything about math...",className:"flex-1 px-5 py-3 rounded-xl border-[#dde3eb] focus:border-sky-600 focus:ring-2 focus:ring-sky-100 text-sm"}),e.jsx(O,{onClick:N,disabled:!n.trim()||l||y,className:"px-6 bg-gradient-to-r from-sky-600 to-sky-500 hover:from-sky-700 hover:to-sky-600 text-white rounded-xl transition-all disabled:opacity-50 disabled:cursor-not-allowed shadow-md hover:shadow-lg",children:e.jsx(W,{size:18})})]})})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 text-center",children:[e.jsx("div",{className:"w-24 h-24 bg-gradient-to-r from-sky-100 to-cyan-100 rounded-3xl flex items-center justify-center mb-6",children:e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-20 h-20 object-contain drop-shadow-lg"})}),e.jsx("h2",{className:"text-2xl font-bold font-display text-[#0a1628] mb-1",children:"Welcome to L.O.L.I."}),e.jsx("p",{className:"text-sky-600 text-sm font-bold tracking-wide uppercase mb-4",children:"Logical Operations & Learning Intelligence"}),e.jsx("p",{className:"text-[#5a6578] mb-6 max-w-md",children:"Your personal AI math tutor is here to help! Start a new conversation or select one from the sidebar."}),e.jsx("button",{onClick:k,className:"px-6 py-3 bg-gradient-to-r from-sky-600 to-sky-500 hover:from-sky-700 hover:to-sky-600 text-white rounded-xl font-bold shadow-lg hover:shadow-xl transition-all",children:"Start Your First Chat"}),e.jsx("div",{className:"mt-8 grid grid-cols-3 gap-4 max-w-2xl",children:["Algebra","Geometry","Calculus"].map(t=>e.jsxs("div",{className:"p-4 bg-[#edf1f7] rounded-xl border border-[#dde3eb]",children:[e.jsx("p",{className:"text-sm font-bold text-[#0a1628]",children:t}),e.jsxs("p",{className:"text-xs text-[#5a6578] mt-1",children:["Get help with ",t.toLowerCase()]})]},t))})]})})]})};export{xe as default};
assets/{AdminDashboard-B2eiYi-q.js β†’ AdminDashboard-DrvV_gE1.js} RENAMED
The diff for this file is too large to render. See raw diff
 
assets/{AssessmentPage-YsCyxvJJ.js β†’ AssessmentPage-Zx-Hx4dd.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{r as n,j as e}from"./vendor-react-B4AQeu28.js";import{B as P}from"./button-DCfeFHoH.js";import{s as Q}from"./diagnosticService-BDYTUoqk.js";import{e as Y,m as a,Z as J,j as O,T as U,x as Z,y as G}from"./index-BaOs5Ayg.js";import{M as H}from"./maximize-2-EHa6JURc.js";import{X as W}from"./x-TNvtuOD9.js";import{C as X}from"./clock-D1Ecvltm.js";import{C as K}from"./circle-check-big-m1SvzGFL.js";import{C as V}from"./chevron-right-COqGruhh.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-markdown-yqZQ_iQm.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{r as n,j as e}from"./vendor-react-B4AQeu28.js";import{B as P}from"./button-BPmLcOpC.js";import{s as Q}from"./diagnosticService-DacNtsbN.js";import{e as Y,m as a,Z as J,g as O,T as U,z as Z,q as G}from"./index-uASBzalf.js";import{M as H}from"./maximize-2-B2yMqxTx.js";import{X as W}from"./x-CBb03rh3.js";import{C as X}from"./clock-8t0UYgg3.js";import{C as K}from"./circle-check-big-BNRlH5pv.js";import{C as V}from"./chevron-right-U0AqPOPj.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-markdown-yqZQ_iQm.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{AvatarShop-BeFk31yM.js β†’ AvatarShop-Bl68yioD.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{r as i,j as e}from"./vendor-react-B4AQeu28.js";import{f as se,L as ae,h as re,g as oe}from"./vendor-radix-BorKzPz9.js";import{e as S,u as le,L as w,W as R,m as y,j as ie,t as c,aG as ne,aH as ce}from"./index-BaOs5Ayg.js";import{u as de}from"./useFeatureAccess-BSpfx3vY.js";import{T as me,a as ue,b as xe}from"./tooltip-ChRIOid3.js";import{C as pe}from"./CompositeAvatar-Col05lJc.js";import{M as j}from"./avatarData-BuQSOXo3.js";import{S as O}from"./save-CQIJrhLf.js";import{S as V}from"./sparkles-By-vFjpv.js";import{S as fe}from"./shirt-S3NBuaPm.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
@@ -28,4 +28,4 @@ import{r as i,j as e}from"./vendor-react-B4AQeu28.js";import{f as se,L as ae,h a
28
  .animate-spin-slow {
29
  animation: spin-slow 1s linear infinite;
30
  }
31
- `,X=["Wow!","Cute!","I love it!","Perfect!","So cool!","Awesome!"],q=["Gain more XP to buy me more clothes!","Help me get stylish!","Let's earn some XP to unlock more!","I'd love to try on more outfits!","Keep learning to unlock new looks!"],Y="top_blue",F="mathpulse:avatar-inventory:v2",je=600*1e3,Ne=2e4,Ye=({onSaveProfile:k,onNavigateToModules:U})=>{const{userProfile:l,refreshProfile:$,currentUser:D}=le(),{cosmeticShop:H,loading:B}=de(D?.uid||null),G=!1,[m,A]=i.useState({top:l?.avatarLayers?.top??Y,bottom:l?.avatarLayers?.bottom||"",shoes:l?.avatarLayers?.shoes||"",accessory:l?.avatarLayers?.accessory||""}),[x,p]=i.useState(!1),[f,E]=i.useState([]),[K,T]=i.useState(0),[_,I]=i.useState(null),[d,h]=i.useState(null),[P,z]=i.useState(j),[W,Z]=i.useState("top"),C=i.useRef(l);C.current=l;const b=i.useRef(!1),v=i.useRef(null);i.useEffect(()=>{if(typeof window>"u")return;const t=Date.now();try{const o=sessionStorage.getItem(F);if(o){const s=JSON.parse(o);if(Array.isArray(s.items)&&typeof s.expiresAt=="number"&&s.expiresAt>t){z(s.items);return}}}catch{}z(j);try{sessionStorage.setItem(F,JSON.stringify({expiresAt:t+je,items:j}))}catch{}},[]),i.useEffect(()=>{if(l&&l.role==="student"){const t=l;E(t.ownedAvatarItems||[]),T(t.currentXP||0)}},[l]),i.useEffect(()=>{A({top:l?.avatarLayers?.top??Y,bottom:l?.avatarLayers?.bottom||"",shoes:l?.avatarLayers?.shoes||"",accessory:l?.avatarLayers?.accessory||""})},[]),i.useEffect(()=>{if(!d){const t=setInterval(()=>{Math.random()>.6&&h(q[Math.floor(Math.random()*q.length)])},4e3);return()=>clearInterval(t)}},[d]),i.useEffect(()=>{if(d){const t=setTimeout(()=>{h(null)},3500);return()=>clearTimeout(t)}},[d]);const J=(t,o)=>{const s=P.find(n=>n.id===o);if(s&&(s.price&&s.price>0||s.isReward)&&!f.includes(o)){c.error("This item is locked. Earn or purchase it first!");return}const a={...m,[t]:m[t]===o?"":o};A(a),h(X[Math.floor(Math.random()*X.length)]),g(a,{showSuccessToast:!1,showSavingState:!1})},Q=async(t,o,s)=>{if(t.stopPropagation(),!l?.uid){c.error("You must be logged in to purchase items");return}if(f.includes(o)){c.info("You already own this item");return}I(o);try{const a=await ne(l.uid,o,s);a.success?(c.success(a.message||"Item purchased!"),E(n=>[...n,o]),a.currentXP!==void 0&&T(a.currentXP),await $()):c.error(a.message||"Failed to purchase item")}catch(a){console.error("Purchase error:",a),c.error("Error purchasing item")}finally{I(null)}},L=t=>({top:typeof t.top=="string"?t.top:"",bottom:typeof t.bottom=="string"?t.bottom:"",shoes:typeof t.shoes=="string"?t.shoes:"",accessory:typeof t.accessory=="string"?t.accessory:""}),ee=(t,o,s)=>{let a;const n=new Promise((r,u)=>{a=setTimeout(()=>{u(new Error(`${s} timed out after ${Math.round(o/1e3)}s`))},o)});return Promise.race([t,n]).finally(()=>{a!==void 0&&clearTimeout(a)})},g=async(t,o={})=>{const s=C.current;if(!s?.uid)return;const{showSuccessToast:a=!0,showSavingState:n=!0}=o;if(b.current){v.current={layers:L(t),options:{showSuccessToast:a,showSavingState:n}},n&&p(!0);return}b.current=!0,n&&p(!0);try{const r=L(t);await ee(ce(s.uid,{avatarLayers:r}),Ne,"Avatar save"),k&&k(r),a&&c.success("Avatar saved successfully")}catch(r){if(console.error(r),a){const u=r instanceof Error&&r.message.includes("timed out");c.error(u?"Avatar save timed out. Please try again.":"Failed to save avatar")}}finally{const r=v.current;if(v.current=null,b.current=!1,r){g(r.layers,r.options);return}(n||x)&&p(!1)}},te=async()=>{await g(m,{showSuccessToast:!0,showSavingState:!0})},M=[{id:"top",label:"Tops",icon:e.jsx(fe,{size:16})},{id:"bottom",label:"Bottoms",icon:e.jsx(ge,{size:16,className:"rotate-90"})},{id:"shoes",label:"Shoes",icon:e.jsx(be,{size:16})},{id:"accessory",label:"Accessories",icon:e.jsx(R,{size:16})}];return B?e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-3",children:[e.jsx("div",{className:"animate-spin",children:e.jsx(O,{size:24,className:"opacity-50"})}),e.jsx("p",{className:"text-sm text-slate-400 font-medium",children:"Loading..."})]}):H?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:ye}),e.jsx("div",{className:"h-full w-full flex items-start xl:items-center justify-center p-4 sm:p-6 lg:p-8 overflow-y-auto xl:overflow-hidden",children:e.jsxs("div",{className:"relative w-full max-w-[1000px] min-h-[500px] xl:h-[80vh] xl:max-h-[700px] rounded-[2rem] p-6 lg:p-8 bg-gradient-to-br from-white via-sky-50/30 to-white border border-slate-200/80 shadow-[0_8px_30px_rgb(0,0,0,0.04)] flex flex-col xl:flex-row gap-8 xl:gap-12 overflow-visible xl:overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-[2rem] pointer-events-none",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-sky-400/30 to-transparent"}),e.jsx("div",{className:"absolute -top-40 -right-40 w-96 h-96 bg-blue-100/40 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-96 h-96 bg-purple-100/30 rounded-full blur-3xl"})]}),e.jsxs("div",{className:"flex flex-col xl:h-full min-h-0 relative z-10 w-full xl:w-[50%] mx-auto xl:mx-0 flex-1",children:[e.jsxs("div",{className:"mb-6 flex flex-col gap-2 shrink-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between xl:justify-start gap-4",children:[e.jsxs("h1",{className:"text-3xl md:text-4xl font-display font-black text-[#0a1628] tracking-tight flex items-center gap-2.5",children:[e.jsx("span",{className:"whitespace-nowrap",children:"Avatar Studio"})," ",e.jsx(V,{className:"text-blue-500 fill-blue-500",size:28})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[G,e.jsxs("div",{className:"bg-gradient-to-br from-amber-400 to-orange-500 rounded-xl px-3 py-1.5 shadow-md flex items-center gap-2 h-fit",children:[e.jsx(N,{className:"text-white shrink-0",size:16}),e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsxs("button",{onClick:U,className:"cursor-pointer hover:opacity-90 transition-opacity active:scale-95 text-left",children:[e.jsx("p",{className:"text-white text-[9px] font-bold uppercase tracking-wider leading-none mb-0.5",children:"XP Balance"}),e.jsx("p",{className:"text-white text-base font-black leading-none",children:K})]})}),e.jsx(xe,{side:"bottom",className:"bg-slate-900 text-white border border-slate-700",children:"Review more lessons to earn more XP!"})]})]})]})]}),e.jsx("p",{className:"text-slate-500 font-medium text-sm md:text-base",children:"Design your perfect learning companion."})]}),e.jsxs(se,{value:W,onValueChange:t=>Z(t),className:"flex flex-col flex-1 min-h-0",children:[e.jsx(ae,{className:"flex flex-nowrap shrink-0 justify-start space-x-1 sm:space-x-2 mb-4 bg-white shadow-sm p-1 rounded-full border border-slate-100 w-fit overflow-x-auto max-w-full scrollbar-hide",children:M.map(t=>e.jsxs(re,{value:t.id,className:"flex items-center gap-1.5 px-4 py-2 rounded-full font-bold text-[13px] text-slate-500 hover:bg-slate-50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-600 data-[state=active]:to-sky-500 data-[state=active]:text-white transition-all shadow-sm outline-none whitespace-nowrap",children:[t.icon,t.label]},t.id))}),e.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden min-h-0 pb-6 scrollbar-hide px-2 -mx-2",children:M.map(t=>{const o=P.filter(s=>s.category===t.id);return e.jsx(oe,{value:t.id,className:"outline-none pt-2 h-full",children:o.length===0?e.jsxs("div",{className:"w-full h-full min-h-[250px] flex flex-col items-center justify-center border-2 border-dashed border-slate-200 rounded-[2rem] bg-slate-50/50 p-8 text-center",children:[e.jsx(R,{size:48,className:"text-slate-300 mb-4 opacity-50"}),e.jsx("h3",{className:"font-bold text-xl text-slate-500 mb-2",children:"Accessories coming soon"}),e.jsx("p",{className:"text-slate-400 text-sm max-w-xs",children:"We're crafting some awesome gear for your avatar! Check back later."})]}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 lg:gap-6",children:o.map(s=>{const a=m[t.id]===s.id,n=f.includes(s.id),r=!!((s.price&&s.price>0||s.isReward)&&!n);return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("button",{onClick:()=>!r&&J(t.id,s.id),disabled:r,className:`relative w-full aspect-square rounded-2xl border-2 transition-all flex flex-col items-center justify-center group ${a&&!r?"bg-white border-blue-500 shadow-md scale-[1.02] z-10":r?"bg-slate-50 border-slate-200 opacity-50 cursor-not-allowed":"bg-white border-slate-100 hover:border-sky-300 hover:shadow-lg hover:scale-[1.02] hover:z-10"}`,children:[a&&!r&&e.jsxs("div",{className:"absolute top-1.5 left-1/2 -translate-x-1/2 px-1.5 py-0.5 bg-gradient-to-r from-blue-500 to-sky-400 text-white text-[9px] font-black rounded-full flex items-center gap-1 z-10 whitespace-nowrap",children:["Equipped ",e.jsx(V,{size:9,className:"fill-white"})]}),r&&e.jsx("div",{className:"absolute inset-0 bg-black/20 z-20 flex items-center justify-center rounded-[1rem]",children:e.jsx(w,{className:"text-white",size:24})}),e.jsx("img",{src:s.thumbnail,alt:s.name,className:`w-3/4 h-3/4 object-contain transition-transform e-filter ${!r&&"group-hover:scale-110"}`,style:{"--filter":r?"grayscale(70%)":"none"}})]}),e.jsx("p",{className:"text-xs font-bold text-slate-700 text-center line-clamp-2",children:s.name}),r&&(s.isReward?e.jsxs("div",{className:"w-full py-1 bg-slate-200 text-slate-500 text-[9px] font-bold flex items-center justify-center gap-1 rounded shadow-sm border border-slate-300",children:[e.jsx(w,{size:11})," Exclusive Reward"]}):e.jsx(y.button,{initial:{opacity:0},animate:{opacity:1},onClick:u=>Q(u,s.id,s.price||0),disabled:_===s.id,className:"w-full py-1 bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white text-[9px] font-bold flex items-center justify-center gap-1 rounded shadow-sm transition-all disabled:opacity-70",children:_===s.id?e.jsx(y.div,{animate:{rotate:360},transition:{repeat:1/0,duration:1},children:e.jsx(N,{size:11})}):e.jsxs(e.Fragment,{children:[e.jsx(N,{size:11}),s.price," XP"]})}))]},s.id)})})},t.id)})})]})]}),e.jsxs("div",{className:"flex flex-col gap-4 relative z-10 w-full xl:w-[350px] max-w-[420px] xl:max-w-none shrink-0 xl:self-center mx-auto xl:mx-0",children:[e.jsxs("div",{className:"bg-[#0f1422] rounded-[2rem] overflow-hidden relative shadow-[0_20px_50px_rgba(15,20,34,0.2)] h-[400px] w-full flex items-center justify-center mx-auto border-4 border-slate-800",children:[e.jsx("div",{className:"absolute top-[-10%] left-0 right-0 h-[110%] pointer-events-none mix-blend-screen opacity-70 avatar-gloss"}),e.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 w-[220px] h-[25px] bg-sky-500/20 blur-xl rounded-full"}),e.jsxs("div",{className:"relative w-full h-[80%] z-10 flex justify-center items-center animate-avatar-float",children:[e.jsx(pe,{layers:m,className:"w-full h-full absolute inset-0 z-20"}),e.jsx(ie,{children:d&&e.jsxs(y.div,{initial:{opacity:0,y:-10,scale:.8},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.8},transition:{duration:.3},className:"absolute -top-24 left-1/2 -translate-x-1/2 z-30 bg-white text-slate-800 px-4 py-2 rounded-full shadow-lg border-2 border-sky-300 whitespace-nowrap font-bold text-sm max-w-xs text-center",children:[d,e.jsx("div",{className:"absolute -bottom-2 left-1/2 -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent border-t-white"})]})})]})]}),e.jsxs("button",{onClick:te,disabled:x,className:"w-full max-w-[450px] mx-auto h-[54px] bg-blue-600 hover:bg-blue-500 text-white rounded-xl font-bold text-base flex items-center justify-center gap-2 transition-colors shadow-md disabled:opacity-70 disabled:cursor-not-allowed active:scale-[0.98]",children:[x?e.jsx("div",{className:"animate-spin-slow",children:e.jsx(O,{size:24,className:"opacity-50"})}):null,x?"Saving...":"Save Profile Avatar"]})]})]})})]}):e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-slate-100 flex items-center justify-center",children:e.jsx(w,{className:"w-7 h-7 text-slate-400"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-700 mb-1",children:"Avatar Shop Locked"}),e.jsx("p",{className:"text-xs text-slate-400",children:"This feature is temporarily unavailable while you focus on your learning."})]})]})};export{Ye as default};
 
1
+ import{r as i,j as e}from"./vendor-react-B4AQeu28.js";import{e as se,L as ae,g as re,f as oe}from"./vendor-radix-xDOIcVzp.js";import{e as S,l as le,L as w,Y as R,m as y,g as ie,n as c,aH as ne,aI as ce}from"./index-uASBzalf.js";import{u as de}from"./useFeatureAccess-C_Ctl5Sh.js";import{T as me,a as ue,b as xe}from"./tooltip-1ASn-3cE.js";import{C as pe}from"./CompositeAvatar-Col05lJc.js";import{M as j}from"./avatarData-BuQSOXo3.js";import{S as O}from"./save-CoDXj-im.js";import{S as V}from"./sparkles-DHVr5IP1.js";import{S as fe}from"./shirt-DFJQeZbT.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
28
  .animate-spin-slow {
29
  animation: spin-slow 1s linear infinite;
30
  }
31
+ `,X=["Wow!","Cute!","I love it!","Perfect!","So cool!","Awesome!"],q=["Gain more XP to buy me more clothes!","Help me get stylish!","Let's earn some XP to unlock more!","I'd love to try on more outfits!","Keep learning to unlock new looks!"],Y="top_blue",F="mathpulse:avatar-inventory:v2",je=600*1e3,Ne=2e4,Ye=({onSaveProfile:k,onNavigateToModules:U})=>{const{userProfile:l,refreshProfile:$,currentUser:D}=le(),{cosmeticShop:H,loading:B}=de(D?.uid||null),G=!1,[m,A]=i.useState({top:l?.avatarLayers?.top??Y,bottom:l?.avatarLayers?.bottom||"",shoes:l?.avatarLayers?.shoes||"",accessory:l?.avatarLayers?.accessory||""}),[x,p]=i.useState(!1),[f,E]=i.useState([]),[K,T]=i.useState(0),[I,_]=i.useState(null),[d,h]=i.useState(null),[P,z]=i.useState(j),[Z,J]=i.useState("top"),C=i.useRef(l);C.current=l;const b=i.useRef(!1),v=i.useRef(null);i.useEffect(()=>{if(typeof window>"u")return;const t=Date.now();try{const o=sessionStorage.getItem(F);if(o){const s=JSON.parse(o);if(Array.isArray(s.items)&&typeof s.expiresAt=="number"&&s.expiresAt>t){z(s.items);return}}}catch{}z(j);try{sessionStorage.setItem(F,JSON.stringify({expiresAt:t+je,items:j}))}catch{}},[]),i.useEffect(()=>{if(l&&l.role==="student"){const t=l;E(t.ownedAvatarItems||[]),T(t.currentXP||0)}},[l]),i.useEffect(()=>{A({top:l?.avatarLayers?.top??Y,bottom:l?.avatarLayers?.bottom||"",shoes:l?.avatarLayers?.shoes||"",accessory:l?.avatarLayers?.accessory||""})},[]),i.useEffect(()=>{if(!d){const t=setInterval(()=>{Math.random()>.6&&h(q[Math.floor(Math.random()*q.length)])},4e3);return()=>clearInterval(t)}},[d]),i.useEffect(()=>{if(d){const t=setTimeout(()=>{h(null)},3500);return()=>clearTimeout(t)}},[d]);const W=(t,o)=>{const s=P.find(n=>n.id===o);if(s&&(s.price&&s.price>0||s.isReward)&&!f.includes(o)){c.error("This item is locked. Earn or purchase it first!");return}const a={...m,[t]:m[t]===o?"":o};A(a),h(X[Math.floor(Math.random()*X.length)]),g(a,{showSuccessToast:!1,showSavingState:!1})},Q=async(t,o,s)=>{if(t.stopPropagation(),!l?.uid){c.error("You must be logged in to purchase items");return}if(f.includes(o)){c.info("You already own this item");return}_(o);try{const a=await ne(l.uid,o,s);a.success?(c.success(a.message||"Item purchased!"),E(n=>[...n,o]),a.currentXP!==void 0&&T(a.currentXP),await $()):c.error(a.message||"Failed to purchase item")}catch(a){console.error("Purchase error:",a),c.error("Error purchasing item")}finally{_(null)}},L=t=>({top:typeof t.top=="string"?t.top:"",bottom:typeof t.bottom=="string"?t.bottom:"",shoes:typeof t.shoes=="string"?t.shoes:"",accessory:typeof t.accessory=="string"?t.accessory:""}),ee=(t,o,s)=>{let a;const n=new Promise((r,u)=>{a=setTimeout(()=>{u(new Error(`${s} timed out after ${Math.round(o/1e3)}s`))},o)});return Promise.race([t,n]).finally(()=>{a!==void 0&&clearTimeout(a)})},g=async(t,o={})=>{const s=C.current;if(!s?.uid)return;const{showSuccessToast:a=!0,showSavingState:n=!0}=o;if(b.current){v.current={layers:L(t),options:{showSuccessToast:a,showSavingState:n}},n&&p(!0);return}b.current=!0,n&&p(!0);try{const r=L(t);await ee(ce(s.uid,{avatarLayers:r}),Ne,"Avatar save"),k&&k(r),a&&c.success("Avatar saved successfully")}catch(r){if(console.error(r),a){const u=r instanceof Error&&r.message.includes("timed out");c.error(u?"Avatar save timed out. Please try again.":"Failed to save avatar")}}finally{const r=v.current;if(v.current=null,b.current=!1,r){g(r.layers,r.options);return}(n||x)&&p(!1)}},te=async()=>{await g(m,{showSuccessToast:!0,showSavingState:!0})},M=[{id:"top",label:"Tops",icon:e.jsx(fe,{size:16})},{id:"bottom",label:"Bottoms",icon:e.jsx(ge,{size:16,className:"rotate-90"})},{id:"shoes",label:"Shoes",icon:e.jsx(be,{size:16})},{id:"accessory",label:"Accessories",icon:e.jsx(R,{size:16})}];return B?e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-3",children:[e.jsx("div",{className:"animate-spin",children:e.jsx(O,{size:24,className:"opacity-50"})}),e.jsx("p",{className:"text-sm text-slate-400 font-medium",children:"Loading..."})]}):H?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:ye}),e.jsx("div",{className:"h-full w-full flex items-start xl:items-center justify-center p-4 sm:p-6 lg:p-8 overflow-y-auto xl:overflow-hidden",children:e.jsxs("div",{className:"relative w-full max-w-[1000px] min-h-[500px] xl:h-[80vh] xl:max-h-[700px] rounded-[2rem] p-6 lg:p-8 bg-gradient-to-br from-white via-sky-50/30 to-white border border-slate-200/80 shadow-[0_8px_30px_rgb(0,0,0,0.04)] flex flex-col xl:flex-row gap-8 xl:gap-12 overflow-visible xl:overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-[2rem] pointer-events-none",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-sky-400/30 to-transparent"}),e.jsx("div",{className:"absolute -top-40 -right-40 w-96 h-96 bg-blue-100/40 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-96 h-96 bg-purple-100/30 rounded-full blur-3xl"})]}),e.jsxs("div",{className:"flex flex-col xl:h-full min-h-0 relative z-10 w-full xl:w-[50%] mx-auto xl:mx-0 flex-1",children:[e.jsxs("div",{className:"mb-6 flex flex-col gap-2 shrink-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between xl:justify-start gap-4",children:[e.jsxs("h1",{className:"text-3xl md:text-4xl font-display font-black text-[#0a1628] tracking-tight flex items-center gap-2.5",children:[e.jsx("span",{className:"whitespace-nowrap",children:"Avatar Studio"})," ",e.jsx(V,{className:"text-blue-500 fill-blue-500",size:28})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[G,e.jsxs("div",{className:"bg-gradient-to-br from-amber-400 to-orange-500 rounded-xl px-3 py-1.5 shadow-md flex items-center gap-2 h-fit",children:[e.jsx(N,{className:"text-white shrink-0",size:16}),e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsxs("button",{onClick:U,className:"cursor-pointer hover:opacity-90 transition-opacity active:scale-95 text-left",children:[e.jsx("p",{className:"text-white text-[9px] font-bold uppercase tracking-wider leading-none mb-0.5",children:"XP Balance"}),e.jsx("p",{className:"text-white text-base font-black leading-none",children:K})]})}),e.jsx(xe,{side:"bottom",className:"bg-slate-900 text-white border border-slate-700",children:"Review more lessons to earn more XP!"})]})]})]})]}),e.jsx("p",{className:"text-slate-500 font-medium text-sm md:text-base",children:"Design your perfect learning companion."})]}),e.jsxs(se,{value:Z,onValueChange:t=>J(t),className:"flex flex-col flex-1 min-h-0",children:[e.jsx(ae,{className:"flex flex-nowrap shrink-0 justify-start space-x-1 sm:space-x-2 mb-4 bg-white shadow-sm p-1 rounded-full border border-slate-100 w-fit overflow-x-auto max-w-full scrollbar-hide",children:M.map(t=>e.jsxs(re,{value:t.id,className:"flex items-center gap-1.5 px-4 py-2 rounded-full font-bold text-[13px] text-slate-500 hover:bg-slate-50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-600 data-[state=active]:to-sky-500 data-[state=active]:text-white transition-all shadow-sm outline-none whitespace-nowrap",children:[t.icon,t.label]},t.id))}),e.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden min-h-0 pb-6 scrollbar-hide px-2 -mx-2",children:M.map(t=>{const o=P.filter(s=>s.category===t.id);return e.jsx(oe,{value:t.id,className:"outline-none pt-2 h-full",children:o.length===0?e.jsxs("div",{className:"w-full h-full min-h-[250px] flex flex-col items-center justify-center border-2 border-dashed border-slate-200 rounded-[2rem] bg-slate-50/50 p-8 text-center",children:[e.jsx(R,{size:48,className:"text-slate-300 mb-4 opacity-50"}),e.jsx("h3",{className:"font-bold text-xl text-slate-500 mb-2",children:"Accessories coming soon"}),e.jsx("p",{className:"text-slate-400 text-sm max-w-xs",children:"We're crafting some awesome gear for your avatar! Check back later."})]}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 lg:gap-6",children:o.map(s=>{const a=m[t.id]===s.id,n=f.includes(s.id),r=!!((s.price&&s.price>0||s.isReward)&&!n);return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("button",{onClick:()=>!r&&W(t.id,s.id),disabled:r,className:`relative w-full aspect-square rounded-2xl border-2 transition-all flex flex-col items-center justify-center group ${a&&!r?"bg-white border-blue-500 shadow-md scale-[1.02] z-10":r?"bg-slate-50 border-slate-200 opacity-50 cursor-not-allowed":"bg-white border-slate-100 hover:border-sky-300 hover:shadow-lg hover:scale-[1.02] hover:z-10"}`,children:[a&&!r&&e.jsxs("div",{className:"absolute top-1.5 left-1/2 -translate-x-1/2 px-1.5 py-0.5 bg-gradient-to-r from-blue-500 to-sky-400 text-white text-[9px] font-black rounded-full flex items-center gap-1 z-10 whitespace-nowrap",children:["Equipped ",e.jsx(V,{size:9,className:"fill-white"})]}),r&&e.jsx("div",{className:"absolute inset-0 bg-black/20 z-20 flex items-center justify-center rounded-[1rem]",children:e.jsx(w,{className:"text-white",size:24})}),e.jsx("img",{src:s.thumbnail,alt:s.name,className:`w-3/4 h-3/4 object-contain transition-transform e-filter ${!r&&"group-hover:scale-110"}`,style:{"--filter":r?"grayscale(70%)":"none"}})]}),e.jsx("p",{className:"text-xs font-bold text-slate-700 text-center line-clamp-2",children:s.name}),r&&(s.isReward?e.jsxs("div",{className:"w-full py-1 bg-slate-200 text-slate-500 text-[9px] font-bold flex items-center justify-center gap-1 rounded shadow-sm border border-slate-300",children:[e.jsx(w,{size:11})," Exclusive Reward"]}):e.jsx(y.button,{initial:{opacity:0},animate:{opacity:1},onClick:u=>Q(u,s.id,s.price||0),disabled:I===s.id,className:"w-full py-1 bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white text-[9px] font-bold flex items-center justify-center gap-1 rounded shadow-sm transition-all disabled:opacity-70",children:I===s.id?e.jsx(y.div,{animate:{rotate:360},transition:{repeat:1/0,duration:1},children:e.jsx(N,{size:11})}):e.jsxs(e.Fragment,{children:[e.jsx(N,{size:11}),s.price," XP"]})}))]},s.id)})})},t.id)})})]})]}),e.jsxs("div",{className:"flex flex-col gap-4 relative z-10 w-full xl:w-[350px] max-w-[420px] xl:max-w-none shrink-0 xl:self-center mx-auto xl:mx-0",children:[e.jsxs("div",{className:"bg-[#0f1422] rounded-[2rem] overflow-hidden relative shadow-[0_20px_50px_rgba(15,20,34,0.2)] h-[400px] w-full flex items-center justify-center mx-auto border-4 border-slate-800",children:[e.jsx("div",{className:"absolute top-[-10%] left-0 right-0 h-[110%] pointer-events-none mix-blend-screen opacity-70 avatar-gloss"}),e.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 w-[220px] h-[25px] bg-sky-500/20 blur-xl rounded-full"}),e.jsxs("div",{className:"relative w-full h-[80%] z-10 flex justify-center items-center animate-avatar-float",children:[e.jsx(pe,{layers:m,className:"w-full h-full absolute inset-0 z-20"}),e.jsx(ie,{children:d&&e.jsxs(y.div,{initial:{opacity:0,y:-10,scale:.8},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.8},transition:{duration:.3},className:"absolute -top-24 left-1/2 -translate-x-1/2 z-30 bg-white text-slate-800 px-4 py-2 rounded-full shadow-lg border-2 border-sky-300 whitespace-nowrap font-bold text-sm max-w-xs text-center",children:[d,e.jsx("div",{className:"absolute -bottom-2 left-1/2 -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent border-t-white"})]})})]})]}),e.jsxs("button",{onClick:te,disabled:x,className:"w-full max-w-[450px] mx-auto h-[54px] bg-blue-600 hover:bg-blue-500 text-white rounded-xl font-bold text-base flex items-center justify-center gap-2 transition-colors shadow-md disabled:opacity-70 disabled:cursor-not-allowed active:scale-[0.98]",children:[x?e.jsx("div",{className:"animate-spin-slow",children:e.jsx(O,{size:24,className:"opacity-50"})}):null,x?"Saving...":"Save Profile Avatar"]})]})]})})]}):e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-slate-100 flex items-center justify-center",children:e.jsx(w,{className:"w-7 h-7 text-slate-400"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-700 mb-1",children:"Avatar Shop Locked"}),e.jsx("p",{className:"text-xs text-slate-400",children:"This feature is temporarily unavailable while you focus on your learning."})]})]})};export{Ye as default};
assets/{ChatMarkdown-fgwaycBR.js β†’ ChatMarkdown-BSQ2GO-C.js} RENAMED
@@ -1,2 +1,2 @@
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-markdown-yqZQ_iQm.js","assets/vendor-react-B4AQeu28.js","assets/vendor-markdown-CfVKi3_s.css"])))=>i.map(i=>d[i]);
2
- import{b0 as d,_ as c}from"./index-BaOs5Ayg.js";import{r as m,j as r}from"./vendor-react-B4AQeu28.js";import{M as h,r as x,a as y}from"./vendor-markdown-yqZQ_iQm.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";let a=null;const p=()=>(a||(a=c(()=>import("./vendor-markdown-yqZQ_iQm.js").then(l=>l.k),__vite__mapDeps([0,1,2]))),a),M=({children:l})=>{if(m.useEffect(()=>{p()},[]),!l||typeof l!="string")return null;const t=d(l);return r.jsx("div",{className:"chat-markdown",children:r.jsx(h,{remarkPlugins:[y],rehypePlugins:[x],components:{a:({href:e,children:s})=>r.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:s}),code:e=>{const{inline:s,className:o,children:n,...i}=e;return r.jsx("code",{className:`${s?"bg-gray-100 dark:bg-gray-800 rounded px-1 py-0.5 text-sm":"block bg-gray-100 dark:bg-gray-900 rounded p-3 overflow-x-auto my-2"} ${o||""}`,...i,children:n})},blockquote:({children:e})=>r.jsx("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 italic text-gray-600 dark:text-gray-400 my-2",children:e}),h1:({children:e})=>r.jsx("h1",{className:"text-2xl font-bold my-2",children:e}),h2:({children:e})=>r.jsx("h2",{className:"text-xl font-bold my-2",children:e}),h3:({children:e})=>r.jsx("h3",{className:"text-lg font-bold my-2",children:e}),h4:({children:e})=>r.jsx("h4",{className:"text-base font-bold my-2",children:e}),h5:({children:e})=>r.jsx("h5",{className:"text-sm font-bold my-2",children:e}),h6:({children:e})=>r.jsx("h6",{className:"text-xs font-bold my-2",children:e}),ul:({children:e})=>r.jsx("ul",{className:"list-disc list-inside my-2",children:e}),ol:({children:e})=>r.jsx("ol",{className:"list-decimal list-inside my-2",children:e}),li:({children:e})=>r.jsx("li",{className:"ml-2",children:e}),hr:()=>r.jsx("hr",{className:"my-4 border-t border-gray-300 dark:border-gray-600"}),p:({children:e})=>r.jsx("p",{className:"my-1",children:e})},children:t})})};export{M as default};
 
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-markdown-yqZQ_iQm.js","assets/vendor-react-B4AQeu28.js","assets/vendor-markdown-CfVKi3_s.css"])))=>i.map(i=>d[i]);
2
+ import{b1 as d,_ as c}from"./index-uASBzalf.js";import{r as m,j as r}from"./vendor-react-B4AQeu28.js";import{M as h,r as x,a as y}from"./vendor-markdown-yqZQ_iQm.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";let a=null;const p=()=>(a||(a=c(()=>import("./vendor-markdown-yqZQ_iQm.js").then(l=>l.k),__vite__mapDeps([0,1,2]))),a),M=({children:l})=>{if(m.useEffect(()=>{p()},[]),!l||typeof l!="string")return null;const t=d(l);return r.jsx("div",{className:"chat-markdown",children:r.jsx(h,{remarkPlugins:[y],rehypePlugins:[x],components:{a:({href:e,children:s})=>r.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:s}),code:e=>{const{inline:s,className:o,children:n,...i}=e;return r.jsx("code",{className:`${s?"bg-gray-100 dark:bg-gray-800 rounded px-1 py-0.5 text-sm":"block bg-gray-100 dark:bg-gray-900 rounded p-3 overflow-x-auto my-2"} ${o||""}`,...i,children:n})},blockquote:({children:e})=>r.jsx("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 italic text-gray-600 dark:text-gray-400 my-2",children:e}),h1:({children:e})=>r.jsx("h1",{className:"text-2xl font-bold my-2",children:e}),h2:({children:e})=>r.jsx("h2",{className:"text-xl font-bold my-2",children:e}),h3:({children:e})=>r.jsx("h3",{className:"text-lg font-bold my-2",children:e}),h4:({children:e})=>r.jsx("h4",{className:"text-base font-bold my-2",children:e}),h5:({children:e})=>r.jsx("h5",{className:"text-sm font-bold my-2",children:e}),h6:({children:e})=>r.jsx("h6",{className:"text-xs font-bold my-2",children:e}),ul:({children:e})=>r.jsx("ul",{className:"list-disc list-inside my-2",children:e}),ol:({children:e})=>r.jsx("ol",{className:"list-decimal list-inside my-2",children:e}),li:({children:e})=>r.jsx("li",{className:"ml-2",children:e}),hr:()=>r.jsx("hr",{className:"my-4 border-t border-gray-300 dark:border-gray-600"}),p:({children:e})=>r.jsx("p",{className:"my-1",children:e})},children:t})})};export{M as default};
assets/{CompetencyRadarChart-CBuH8ru8.js β†’ CompetencyRadarChart-CsWJvNpV.js} RENAMED
@@ -1 +1 @@
1
- import{r as g,j as t}from"./vendor-react-B4AQeu28.js";import{f as A,a4 as I,u as B,m as L,B as O,a as W}from"./index-BaOs5Ayg.js";import{collection as E,getDocs as R,query as H,orderBy as K,limit as U,Timestamp as G,getDoc as Y,doc as $}from"./vendor-firebase-firestore-CH1lNiRF.js";import{g as J,s as V}from"./subjects-BFghB0SQ.js";import{S as X}from"./sparkles-By-vFjpv.js";import{R as Z,f as ee,P as te,g as se,h as ne,i as ae,T as oe}from"./vendor-charts-D8hf8tI0.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-markdown-yqZQ_iQm.js";import"./chart-column-B3jJOD5i.js";const P=["#1FA7E1","#9956DE","#75D06A","#FFB356","#7274ED","#FF8B8B","#6ED1CF","#FB96BB"];async function re(a){try{const r=E(A,"users",a,"quizResults"),u=H(r,K("timestamp","desc"),U(500)),d=await R(u);return d.empty?F(a):d.docs.map(s=>{const e=s.data();return{quizId:s.id,moduleId:e.moduleId||"",subjectId:e.subjectId||"",score:typeof e.score=="number"?e.score:0,totalQuestions:e.totalQuestions||0,correctAnswers:e.correctAnswers||0,questionType:e.questionType||"multiple_choice",timestamp:e.timestamp instanceof G||e.timestamp?.toDate?e.timestamp.toDate():new Date,timeSpent:e.timeSpent||0}})}catch(r){return console.error("[competencyService] fetchQuizResults failed, falling back:",r),F(a)}}async function F(a){const r=await Y($(A,"progress",a));return r.exists()?(r.data().quizAttempts||[]).map((s,e)=>({quizId:String(s.quizId||`attempt-${e}`),moduleId:String(s.moduleId||s.quizId||""),subjectId:String(s.subjectId||""),score:typeof s.score=="number"?s.score:0,totalQuestions:s.totalQuestions||0,correctAnswers:typeof s.correctAnswers=="number"?s.correctAnswers:0,questionType:s.questionType||"multiple_choice",timestamp:s.completedAt?new Date(s.completedAt):new Date,timeSpent:s.timeSpent||0})):[]}async function ie(a){try{const r=E(A,"users",a,"moduleProgress"),u=await R(r);if(u.empty)return{};const d={};return u.forEach(s=>{const e=s.data();d[s.id]={moduleId:s.id,subjectId:e.subjectId||"",sessionsCompleted:e.sessionsCompleted||0,lastActive:e.lastActive?e.lastActive instanceof G?e.lastActive.toDate():new Date(e.lastActive):new Date,moduleTitle:e.moduleTitle||s.id,lessonsCompleted:e.lessonsCompleted||[],quizzesCompleted:e.quizzesCompleted||[]}}),d}catch(r){return console.error("[competencyService] fetchModuleProgress failed:",r),{}}}function _(a,r,u,d){const s=r.filter(m=>m.moduleId===a),e=s.length>0?s.reduce((m,b)=>m+b.score,0)/s.length:0,h=["identification","multiple_choice"],p=s.filter(m=>h.includes(m.questionType)),i=p.length>0?p.reduce((m,b)=>m+b.score,0)/p.length:e*.9,o=["word_problem","equation_based","enumeration"],l=s.filter(m=>o.includes(m.questionType)),n=l.length>0?l.reduce((m,b)=>m+b.score,0)/l.length:e*.85,f=u,c=f?.lessonsCompleted?.length||0,k=f?.quizzesCompleted?.length||0,S=f?.sessionsCompleted||0,y=d.find(m=>m.id===a),x=y?.lessons?.length||1,N=y?.quizzes?.length||1,C=Math.min(100,c/x*100),M=Math.min(100,k/N*100),v=Math.min(100,(C+M+S*5)/2.5);if(s.length<2){const m=v>50?60+v*.3:v*.8;return{overallMastery:e,conceptGrasp:i,application:n,engagement:v,consistency:Math.min(100,m)}}const w=s.map(m=>m.score),z=w.reduce((m,b)=>m+b,0)/w.length,D=w.reduce((m,b)=>m+Math.pow(b-z,2),0)/w.length,j=Math.sqrt(D)/Math.max(z,1),q=Math.max(0,Math.min(100,(1-j)*100));return{overallMastery:Math.round(e),conceptGrasp:Math.round(i),application:Math.round(n),engagement:Math.round(v),consistency:Math.round(q)}}async function le(a){try{const r=E(A,"users",a,"competencyMatrix"),u=await R(r);if(u.empty)return{};const d={};return u.forEach(s=>{const e=s.data();d[s.id]={moduleId:s.id,moduleName:e.moduleName||s.id,overallMastery:e.overallMastery??0,conceptGrasp:e.conceptGrasp??0,application:e.application??0,engagement:e.engagement??0,consistency:e.consistency??0,computedAt:e.computedAt?.toDate?.()||new Date}}),d}catch(r){return console.error("[competencyService] fetchCachedCompetencyMatrix failed:",r),{}}}const Q=[{key:"progress",label:"Overall Mastery"},{key:"concept",label:"Concept Grasp"},{key:"application",label:"Application"},{key:"engagement",label:"Engagement"},{key:"consistency",label:"Consistency"}];function ce(a){const[r,u]=g.useState([]),[d,s]=g.useState([]),[e,h]=g.useState("N/A"),[p,i]=g.useState(!0),[o,l]=g.useState(null),[n,f]=g.useState(!1),c=g.useRef(0),k=g.useCallback(async(y,x)=>{if(x!==c.current)return;const C=J(null)[0]??"gen-math",M=V.find(j=>j.id===C)?.modules||[],v=M.map((j,q)=>({id:j.id,name:j.title.length>15?j.title.substring(0,15).trim()+"...":j.title,color:P[q%P.length]})),w=await le(a);if(x!==c.current)return;if(Object.keys(w).length>0){de(w,v,u,h),f(!1),i(!1);return}const z=await re(a),D=await ie(a);if(x!==c.current)return;const T=z.length>0;f(!T),ue(z,D,v,M,u,h),i(!1)},[a]),S=g.useCallback(async()=>{if(!a){i(!1);return}const y=++c.current;i(!0),l(null);try{const x=await new Promise(N=>{const C=I(a,M=>{C(),N(M)})});if(y!==c.current)return;await k(x,y)}catch(x){console.error("[useCompetencyMatrix] Failed to load:",x),y===c.current&&(l("Failed to load competency data. Please try again."),i(!1))}},[a,k]);return g.useEffect(()=>{if(!a)return;const y=I(a,x=>{const N=++c.current;k(x,N)});return()=>y()},[a,k]),{data:r,modulesList:d,topModule:e,loading:p,error:o,isEmpty:n,refresh:S}}function de(a,r,u,d){let s=-1,e="N/A";const h=Q.map(p=>{const i={metric:p.label,fullMark:100};return r.forEach(o=>{const l=a[o.id];l&&(p.key==="progress"?i[o.id]=l.overallMastery:p.key==="concept"?i[o.id]=l.conceptGrasp:p.key==="application"?i[o.id]=l.application:p.key==="engagement"?i[o.id]=l.engagement:p.key==="consistency"&&(i[o.id]=l.consistency))}),i});r.forEach(p=>{const i=a[p.id];if(i){const o=(i.overallMastery+i.conceptGrasp+i.application+i.engagement+i.consistency)/5;o>s&&(s=o,e=p.name)}}),d(e),u(h)}function ue(a,r,u,d,s,e){let h=-1,p="N/A";const i=Q.map(o=>{const l={metric:o.label,fullMark:100};return d.forEach(n=>{const f=r[n.id],c=_(n.id,a,f??{moduleId:n.id,sessionsCompleted:0,moduleTitle:n.title,lessonsCompleted:[],quizzesCompleted:[]},d);o.key==="progress"?l[n.id]=c.overallMastery:o.key==="concept"?l[n.id]=c.conceptGrasp:o.key==="application"?l[n.id]=c.application:o.key==="engagement"?l[n.id]=c.engagement:o.key==="consistency"&&(l[n.id]=c.consistency)}),l});d.forEach(o=>{const l=r[o.id],n=_(o.id,a,l??{moduleId:o.id,sessionsCompleted:0,moduleTitle:o.title,lessonsCompleted:[],quizzesCompleted:[]},d),f=(n.overallMastery+n.conceptGrasp+n.application+n.engagement+n.consistency)/5;f>h&&(h=f,p=u.find(c=>c.id===o.id)?.name||"N/A")}),e(p),s(i)}const Me=()=>{const{userProfile:a}=B(),{data:r,modulesList:u,topModule:d,loading:s,error:e,isEmpty:h,refresh:p}=ce(a?.uid??""),[i,o]=g.useState(!1),l=()=>{p()};return t.jsxs(L.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,ease:[.22,1,.36,1]},className:"relative overflow-hidden bg-white/80 backdrop-blur-xl border border-white/50 shadow-[0_8px_30px_rgb(0,0,0,0.04)] rounded-[2rem] p-6 lg:p-8 isolate group",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[t.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-violet-400/5 rounded-full blur-3xl -translate-y-1/2 translate-x-1/4"}),t.jsx("div",{className:"absolute bottom-0 left-0 w-48 h-48 bg-rose-400/5 rounded-full blur-3xl translate-y-1/3 -translate-x-1/3"}),t.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between mb-8 relative z-10 gap-4",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"p-2 bg-violet-100 text-violet-600 rounded-xl",children:t.jsx(O,{size:20,className:"stroke-[2.5]"})}),t.jsx("h3",{className:"text-xl font-display font-extrabold text-[#0a1628] tracking-tight",children:"Competency Matrix"})]}),t.jsx("p",{className:"text-sm text-[#5a6578] font-body ml-12",children:"Your realtime performance across modules"})]}),!s&&!h&&!e&&t.jsxs("div",{className:"flex items-center gap-3 bg-slate-50 border border-slate-100 px-4 py-2 rounded-2xl ml-12 sm:ml-0",children:[t.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-white shadow-sm border border-slate-100",children:t.jsx(X,{size:14,className:"text-amber-500"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Top Module"}),t.jsx("p",{className:"text-sm font-bold text-slate-700",children:d})]})]}),!s&&t.jsx("button",{onClick:l,className:"sm:ml-auto text-xs font-semibold text-slate-400 hover:text-violet-600 transition-colors px-2 py-1 rounded-lg hover:bg-violet-50",title:"Refresh competency data",children:"Refresh"})]}),t.jsx("div",{className:"h-[300px] sm:h-[360px] w-full relative z-10",children:s?t.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 border-4 border-violet-200 border-t-violet-500 rounded-full animate-spin"}),t.jsx("p",{className:"text-sm text-slate-400 font-medium",children:"Analyzing skill vectors..."})]})}):h||e?t.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-4",children:[t.jsx("div",{className:"w-16 h-16 rounded-2xl bg-slate-100 flex items-center justify-center",children:t.jsx(W,{size:28,className:"text-slate-400"})}),t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-sm font-semibold text-slate-600 mb-1",children:e?"Unable to load competency data":"No activity yet"}),t.jsx("p",{className:"text-xs text-slate-400 max-w-[260px]",children:e||"Complete quizzes and lessons to see your competency matrix here."})]}),e&&t.jsx("button",{onClick:l,className:"px-4 py-2 text-xs font-semibold bg-violet-100 text-violet-700 rounded-xl hover:bg-violet-200 transition-colors",children:"Try Again"})]}):t.jsx(Z,{width:"100%",height:"100%",children:t.jsxs(ee,{cx:"50%",cy:"50%",outerRadius:i?"75%":"70%",data:r,children:[t.jsx(te,{stroke:"#e2e8f0",strokeDasharray:"4 4",polarRadius:[20,40,60,80,100]}),t.jsx(se,{dataKey:"metric",tick:{fill:"#475569",fontSize:12,fontWeight:600,fontFamily:"Inter, sans-serif"}}),t.jsx(ne,{angle:90,domain:[0,100],tick:{fill:"#94a3b8",fontSize:10},tickCount:6,axisLine:!1}),u.map(n=>t.jsx(ae,{name:n.name,dataKey:n.id,stroke:n.color,strokeWidth:2,fill:n.color,fillOpacity:.35,dot:{r:3,fill:"#fff",stroke:n.color,strokeWidth:2},activeDot:{r:5,fill:n.color,stroke:"#fff",strokeWidth:2},isAnimationActive:!0,animationDuration:1500,animationEasing:"ease-out"},n.id)),t.jsx(oe,{cursor:!1,content:({active:n,payload:f})=>n&&f&&f.length?t.jsxs("div",{className:"bg-white/95 backdrop-blur shadow-[0_10px_40px_-10px_rgba(0,0,0,0.15)] border border-slate-100 rounded-xl p-4",children:[t.jsx("p",{className:"font-display font-bold text-slate-800 text-sm mb-3",children:f[0].payload.metric}),t.jsx("div",{className:"flex flex-col gap-2",children:f.map(c=>t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:c.stroke}}),t.jsx("span",{className:"text-xs font-bold text-slate-600 uppercase tracking-wide truncate max-w-[120px]",title:String(c.name),children:String(c.name)})]}),t.jsxs("span",{className:"text-sm font-black",style:{color:c.stroke},children:[Math.round(c.value),"%"]})]},c.name))})]}):null})]})})}),!s&&!h&&!e&&u.length>0&&t.jsx("div",{className:"flex flex-wrap justify-center items-center gap-3 md:gap-5 mt-[5px] z-10 relative",children:u.map(n=>t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:n.color}}),t.jsx("span",{className:"text-[10px] font-bold text-slate-600 uppercase tracking-widest",children:n.name.length>15?n.name.substring(0,12)+"...":n.name})]},n.id))})]})};export{Me as CompetencyRadarChart};
 
1
+ import{r as g,j as t}from"./vendor-react-B4AQeu28.js";import{h as A,a5 as I,l as B,m as L,B as O,a as W}from"./index-uASBzalf.js";import{collection as E,getDocs as R,query as H,orderBy as K,limit as U,Timestamp as G,getDoc as Y,doc as $}from"./vendor-firebase-firestore-CP9q7ISf.js";import{g as J,s as V}from"./subjects-F8wTuRgo.js";import{S as X}from"./sparkles-DHVr5IP1.js";import{R as Z,e as ee,P as te,f as se,g as ne,h as ae,T as oe}from"./vendor-charts-Ckgeb0nY.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-markdown-yqZQ_iQm.js";import"./chart-column-CLoxLorp.js";const P=["#1FA7E1","#9956DE","#75D06A","#FFB356","#7274ED","#FF8B8B","#6ED1CF","#FB96BB"];async function re(a){try{const r=E(A,"users",a,"quizResults"),u=H(r,K("timestamp","desc"),U(500)),d=await R(u);return d.empty?F(a):d.docs.map(s=>{const e=s.data();return{quizId:s.id,moduleId:e.moduleId||"",subjectId:e.subjectId||"",score:typeof e.score=="number"?e.score:0,totalQuestions:e.totalQuestions||0,correctAnswers:e.correctAnswers||0,questionType:e.questionType||"multiple_choice",timestamp:e.timestamp instanceof G||e.timestamp?.toDate?e.timestamp.toDate():new Date,timeSpent:e.timeSpent||0}})}catch(r){return console.error("[competencyService] fetchQuizResults failed, falling back:",r),F(a)}}async function F(a){const r=await Y($(A,"progress",a));return r.exists()?(r.data().quizAttempts||[]).map((s,e)=>({quizId:String(s.quizId||`attempt-${e}`),moduleId:String(s.moduleId||s.quizId||""),subjectId:String(s.subjectId||""),score:typeof s.score=="number"?s.score:0,totalQuestions:s.totalQuestions||0,correctAnswers:typeof s.correctAnswers=="number"?s.correctAnswers:0,questionType:s.questionType||"multiple_choice",timestamp:s.completedAt?new Date(s.completedAt):new Date,timeSpent:s.timeSpent||0})):[]}async function ie(a){try{const r=E(A,"users",a,"moduleProgress"),u=await R(r);if(u.empty)return{};const d={};return u.forEach(s=>{const e=s.data();d[s.id]={moduleId:s.id,subjectId:e.subjectId||"",sessionsCompleted:e.sessionsCompleted||0,lastActive:e.lastActive?e.lastActive instanceof G?e.lastActive.toDate():new Date(e.lastActive):new Date,moduleTitle:e.moduleTitle||s.id,lessonsCompleted:e.lessonsCompleted||[],quizzesCompleted:e.quizzesCompleted||[]}}),d}catch(r){return console.error("[competencyService] fetchModuleProgress failed:",r),{}}}function _(a,r,u,d){const s=r.filter(m=>m.moduleId===a),e=s.length>0?s.reduce((m,b)=>m+b.score,0)/s.length:0,h=["identification","multiple_choice"],p=s.filter(m=>h.includes(m.questionType)),i=p.length>0?p.reduce((m,b)=>m+b.score,0)/p.length:e*.9,o=["word_problem","equation_based","enumeration"],l=s.filter(m=>o.includes(m.questionType)),n=l.length>0?l.reduce((m,b)=>m+b.score,0)/l.length:e*.85,f=u,c=f?.lessonsCompleted?.length||0,k=f?.quizzesCompleted?.length||0,S=f?.sessionsCompleted||0,y=d.find(m=>m.id===a),x=y?.lessons?.length||1,N=y?.quizzes?.length||1,C=Math.min(100,c/x*100),M=Math.min(100,k/N*100),v=Math.min(100,(C+M+S*5)/2.5);if(s.length<2){const m=v>50?60+v*.3:v*.8;return{overallMastery:e,conceptGrasp:i,application:n,engagement:v,consistency:Math.min(100,m)}}const w=s.map(m=>m.score),z=w.reduce((m,b)=>m+b,0)/w.length,D=w.reduce((m,b)=>m+Math.pow(b-z,2),0)/w.length,j=Math.sqrt(D)/Math.max(z,1),q=Math.max(0,Math.min(100,(1-j)*100));return{overallMastery:Math.round(e),conceptGrasp:Math.round(i),application:Math.round(n),engagement:Math.round(v),consistency:Math.round(q)}}async function le(a){try{const r=E(A,"users",a,"competencyMatrix"),u=await R(r);if(u.empty)return{};const d={};return u.forEach(s=>{const e=s.data();d[s.id]={moduleId:s.id,moduleName:e.moduleName||s.id,overallMastery:e.overallMastery??0,conceptGrasp:e.conceptGrasp??0,application:e.application??0,engagement:e.engagement??0,consistency:e.consistency??0,computedAt:e.computedAt?.toDate?.()||new Date}}),d}catch(r){return console.error("[competencyService] fetchCachedCompetencyMatrix failed:",r),{}}}const Q=[{key:"progress",label:"Overall Mastery"},{key:"concept",label:"Concept Grasp"},{key:"application",label:"Application"},{key:"engagement",label:"Engagement"},{key:"consistency",label:"Consistency"}];function ce(a){const[r,u]=g.useState([]),[d,s]=g.useState([]),[e,h]=g.useState("N/A"),[p,i]=g.useState(!0),[o,l]=g.useState(null),[n,f]=g.useState(!1),c=g.useRef(0),k=g.useCallback(async(y,x)=>{if(x!==c.current)return;const C=J(null)[0]??"gen-math",M=V.find(j=>j.id===C)?.modules||[],v=M.map((j,q)=>({id:j.id,name:j.title.length>15?j.title.substring(0,15).trim()+"...":j.title,color:P[q%P.length]})),w=await le(a);if(x!==c.current)return;if(Object.keys(w).length>0){de(w,v,u,h),f(!1),i(!1);return}const z=await re(a),D=await ie(a);if(x!==c.current)return;const T=z.length>0;f(!T),ue(z,D,v,M,u,h),i(!1)},[a]),S=g.useCallback(async()=>{if(!a){i(!1);return}const y=++c.current;i(!0),l(null);try{const x=await new Promise(N=>{const C=I(a,M=>{C(),N(M)})});if(y!==c.current)return;await k(x,y)}catch(x){console.error("[useCompetencyMatrix] Failed to load:",x),y===c.current&&(l("Failed to load competency data. Please try again."),i(!1))}},[a,k]);return g.useEffect(()=>{if(!a)return;const y=I(a,x=>{const N=++c.current;k(x,N)});return()=>y()},[a,k]),{data:r,modulesList:d,topModule:e,loading:p,error:o,isEmpty:n,refresh:S}}function de(a,r,u,d){let s=-1,e="N/A";const h=Q.map(p=>{const i={metric:p.label,fullMark:100};return r.forEach(o=>{const l=a[o.id];l&&(p.key==="progress"?i[o.id]=l.overallMastery:p.key==="concept"?i[o.id]=l.conceptGrasp:p.key==="application"?i[o.id]=l.application:p.key==="engagement"?i[o.id]=l.engagement:p.key==="consistency"&&(i[o.id]=l.consistency))}),i});r.forEach(p=>{const i=a[p.id];if(i){const o=(i.overallMastery+i.conceptGrasp+i.application+i.engagement+i.consistency)/5;o>s&&(s=o,e=p.name)}}),d(e),u(h)}function ue(a,r,u,d,s,e){let h=-1,p="N/A";const i=Q.map(o=>{const l={metric:o.label,fullMark:100};return d.forEach(n=>{const f=r[n.id],c=_(n.id,a,f??{moduleId:n.id,sessionsCompleted:0,moduleTitle:n.title,lessonsCompleted:[],quizzesCompleted:[]},d);o.key==="progress"?l[n.id]=c.overallMastery:o.key==="concept"?l[n.id]=c.conceptGrasp:o.key==="application"?l[n.id]=c.application:o.key==="engagement"?l[n.id]=c.engagement:o.key==="consistency"&&(l[n.id]=c.consistency)}),l});d.forEach(o=>{const l=r[o.id],n=_(o.id,a,l??{moduleId:o.id,sessionsCompleted:0,moduleTitle:o.title,lessonsCompleted:[],quizzesCompleted:[]},d),f=(n.overallMastery+n.conceptGrasp+n.application+n.engagement+n.consistency)/5;f>h&&(h=f,p=u.find(c=>c.id===o.id)?.name||"N/A")}),e(p),s(i)}const Me=()=>{const{userProfile:a}=B(),{data:r,modulesList:u,topModule:d,loading:s,error:e,isEmpty:h,refresh:p}=ce(a?.uid??""),[i,o]=g.useState(!1),l=()=>{p()};return t.jsxs(L.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,ease:[.22,1,.36,1]},className:"relative overflow-hidden bg-white/80 backdrop-blur-xl border border-white/50 shadow-[0_8px_30px_rgb(0,0,0,0.04)] rounded-[2rem] p-6 lg:p-8 isolate group",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[t.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-violet-400/5 rounded-full blur-3xl -translate-y-1/2 translate-x-1/4"}),t.jsx("div",{className:"absolute bottom-0 left-0 w-48 h-48 bg-rose-400/5 rounded-full blur-3xl translate-y-1/3 -translate-x-1/3"}),t.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between mb-8 relative z-10 gap-4",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"p-2 bg-violet-100 text-violet-600 rounded-xl",children:t.jsx(O,{size:20,className:"stroke-[2.5]"})}),t.jsx("h3",{className:"text-xl font-display font-extrabold text-[#0a1628] tracking-tight",children:"Competency Matrix"})]}),t.jsx("p",{className:"text-sm text-[#5a6578] font-body ml-12",children:"Your realtime performance across modules"})]}),!s&&!h&&!e&&t.jsxs("div",{className:"flex items-center gap-3 bg-slate-50 border border-slate-100 px-4 py-2 rounded-2xl ml-12 sm:ml-0",children:[t.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-white shadow-sm border border-slate-100",children:t.jsx(X,{size:14,className:"text-amber-500"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Top Module"}),t.jsx("p",{className:"text-sm font-bold text-slate-700",children:d})]})]}),!s&&t.jsx("button",{onClick:l,className:"sm:ml-auto text-xs font-semibold text-slate-400 hover:text-violet-600 transition-colors px-2 py-1 rounded-lg hover:bg-violet-50",title:"Refresh competency data",children:"Refresh"})]}),t.jsx("div",{className:"h-[300px] sm:h-[360px] w-full relative z-10",children:s?t.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 border-4 border-violet-200 border-t-violet-500 rounded-full animate-spin"}),t.jsx("p",{className:"text-sm text-slate-400 font-medium",children:"Analyzing skill vectors..."})]})}):h||e?t.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-4",children:[t.jsx("div",{className:"w-16 h-16 rounded-2xl bg-slate-100 flex items-center justify-center",children:t.jsx(W,{size:28,className:"text-slate-400"})}),t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-sm font-semibold text-slate-600 mb-1",children:e?"Unable to load competency data":"No activity yet"}),t.jsx("p",{className:"text-xs text-slate-400 max-w-[260px]",children:e||"Complete quizzes and lessons to see your competency matrix here."})]}),e&&t.jsx("button",{onClick:l,className:"px-4 py-2 text-xs font-semibold bg-violet-100 text-violet-700 rounded-xl hover:bg-violet-200 transition-colors",children:"Try Again"})]}):t.jsx(Z,{width:"100%",height:"100%",children:t.jsxs(ee,{cx:"50%",cy:"50%",outerRadius:i?"75%":"70%",data:r,children:[t.jsx(te,{stroke:"#e2e8f0",strokeDasharray:"4 4",polarRadius:[20,40,60,80,100]}),t.jsx(se,{dataKey:"metric",tick:{fill:"#475569",fontSize:12,fontWeight:600,fontFamily:"Inter, sans-serif"}}),t.jsx(ne,{angle:90,domain:[0,100],tick:{fill:"#94a3b8",fontSize:10},tickCount:6,axisLine:!1}),u.map(n=>t.jsx(ae,{name:n.name,dataKey:n.id,stroke:n.color,strokeWidth:2,fill:n.color,fillOpacity:.35,dot:{r:3,fill:"#fff",stroke:n.color,strokeWidth:2},activeDot:{r:5,fill:n.color,stroke:"#fff",strokeWidth:2},isAnimationActive:!0,animationDuration:1500,animationEasing:"ease-out"},n.id)),t.jsx(oe,{cursor:!1,content:({active:n,payload:f})=>n&&f&&f.length?t.jsxs("div",{className:"bg-white/95 backdrop-blur shadow-[0_10px_40px_-10px_rgba(0,0,0,0.15)] border border-slate-100 rounded-xl p-4",children:[t.jsx("p",{className:"font-display font-bold text-slate-800 text-sm mb-3",children:f[0].payload.metric}),t.jsx("div",{className:"flex flex-col gap-2",children:f.map(c=>t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:c.stroke}}),t.jsx("span",{className:"text-xs font-bold text-slate-600 uppercase tracking-wide truncate max-w-[120px]",title:String(c.name),children:String(c.name)})]}),t.jsxs("span",{className:"text-sm font-black",style:{color:c.stroke},children:[Math.round(c.value),"%"]})]},c.name))})]}):null})]})})}),!s&&!h&&!e&&u.length>0&&t.jsx("div",{className:"flex flex-wrap justify-center items-center gap-3 md:gap-5 mt-[5px] z-10 relative",children:u.map(n=>t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:n.color}}),t.jsx("span",{className:"text-[10px] font-bold text-slate-600 uppercase tracking-widest",children:n.name.length>15?n.name.substring(0,12)+"...":n.name})]},n.id))})]})};export{Me as CompetencyRadarChart};
assets/{ConfirmModal-6cgkqXAT.js β†’ ConfirmModal-D2z4s_BB.js} RENAMED
@@ -1 +1 @@
1
- import{j as e}from"./vendor-react-B4AQeu28.js";import{B as i}from"./button-DCfeFHoH.js";import{j as f,m as r,p as h}from"./index-BaOs5Ayg.js";import{X as j}from"./x-TNvtuOD9.js";import{T as y}from"./trash-2-HTnKafZd.js";import{L as w}from"./log-out-BenDMDly.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-markdown-yqZQ_iQm.js";const O=({isOpen:s,onClose:t,onConfirm:n,title:a,message:l,confirmText:c="Confirm",cancelText:d="Cancel",type:m="warning",icon:x="warning",zIndexClass:g="z-50"})=>{const b=()=>{switch(x){case"logout":return e.jsx(w,{size:32});case"delete":return e.jsx(y,{size:32});case"warning":default:return e.jsx(h,{size:32})}},o=(()=>{switch(m){case"danger":return{iconBg:"bg-red-100",iconColor:"text-red-600",buttonBg:"bg-red-600 hover:bg-red-700",buttonText:"text-white"};case"warning":return{iconBg:"bg-rose-100",iconColor:"text-rose-600",buttonBg:"bg-rose-600 hover:bg-rose-700",buttonText:"text-white"};case"info":default:return{iconBg:"bg-sky-100",iconColor:"text-sky-600",buttonBg:"bg-sky-600 hover:bg-sky-700",buttonText:"text-white"}}})(),p=async()=>{try{await n(),t()}catch{}};return e.jsx(f,{children:s&&e.jsx(e.Fragment,{children:e.jsx(r.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`fixed inset-0 bg-black/50 backdrop-blur-sm ${g} flex items-center justify-center p-4`,children:e.jsxs(r.div,{initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:20},transition:{type:"spring",damping:25,stiffness:300},onClick:u=>u.stopPropagation(),className:"bg-[#f7f9fc] rounded-3xl shadow-2xl max-w-md w-full overflow-hidden border border-[#dde3eb]",children:[e.jsx("button",{onClick:t,className:"absolute top-4 right-4 p-2 text-slate-500 hover:text-[#0a1628] hover:bg-[#dde3eb] rounded-xl transition-colors z-10",children:e.jsx(j,{size:20})}),e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(r.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1,type:"spring",damping:15},className:`w-20 h-20 ${o.iconBg} rounded-full flex items-center justify-center mx-auto mb-6 ${o.iconColor}`,children:b()}),e.jsx("h2",{className:"text-2xl font-display font-bold text-[#0a1628] mb-3",children:a}),e.jsx("p",{className:"text-[#5a6578] mb-8 leading-relaxed",children:l}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(i,{onClick:t,variant:"outline",size:"lg",className:"flex-1 h-12 rounded-xl border-[#dde3eb] hover:border-[#d1cec6] hover:bg-[#edf1f7] font-bold",children:d}),e.jsx(i,{onClick:p,size:"lg",className:`flex-1 h-12 rounded-xl font-bold ${o.buttonBg} ${o.buttonText} transition-colors shadow-lg`,children:c})]})]})]})})})})};export{O as default};
 
1
+ import{j as e}from"./vendor-react-B4AQeu28.js";import{B as i}from"./button-BPmLcOpC.js";import{g as f,m as r,w as h}from"./index-uASBzalf.js";import{X as y}from"./x-CBb03rh3.js";import{T as j}from"./trash-2-D7q6y9vT.js";import{L as w}from"./log-out-Dr0BHRO4.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-markdown-yqZQ_iQm.js";const O=({isOpen:s,onClose:t,onConfirm:n,title:a,message:l,confirmText:c="Confirm",cancelText:d="Cancel",type:m="warning",icon:x="warning",zIndexClass:g="z-50"})=>{const b=()=>{switch(x){case"logout":return e.jsx(w,{size:32});case"delete":return e.jsx(j,{size:32});case"warning":default:return e.jsx(h,{size:32})}},o=(()=>{switch(m){case"danger":return{iconBg:"bg-red-100",iconColor:"text-red-600",buttonBg:"bg-red-600 hover:bg-red-700",buttonText:"text-white"};case"warning":return{iconBg:"bg-rose-100",iconColor:"text-rose-600",buttonBg:"bg-rose-600 hover:bg-rose-700",buttonText:"text-white"};case"info":default:return{iconBg:"bg-sky-100",iconColor:"text-sky-600",buttonBg:"bg-sky-600 hover:bg-sky-700",buttonText:"text-white"}}})(),p=async()=>{try{await n(),t()}catch{}};return e.jsx(f,{children:s&&e.jsx(e.Fragment,{children:e.jsx(r.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`fixed inset-0 bg-black/50 backdrop-blur-sm ${g} flex items-center justify-center p-4`,children:e.jsxs(r.div,{initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:20},transition:{type:"spring",damping:25,stiffness:300},onClick:u=>u.stopPropagation(),className:"bg-[#f7f9fc] rounded-3xl shadow-2xl max-w-md w-full overflow-hidden border border-[#dde3eb]",children:[e.jsx("button",{onClick:t,className:"absolute top-4 right-4 p-2 text-slate-500 hover:text-[#0a1628] hover:bg-[#dde3eb] rounded-xl transition-colors z-10",children:e.jsx(y,{size:20})}),e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(r.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.1,type:"spring",damping:15},className:`w-20 h-20 ${o.iconBg} rounded-full flex items-center justify-center mx-auto mb-6 ${o.iconColor}`,children:b()}),e.jsx("h2",{className:"text-2xl font-display font-bold text-[#0a1628] mb-3",children:a}),e.jsx("p",{className:"text-[#5a6578] mb-8 leading-relaxed",children:l}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(i,{onClick:t,variant:"outline",size:"lg",className:"flex-1 h-12 rounded-xl border-[#dde3eb] hover:border-[#d1cec6] hover:bg-[#edf1f7] font-bold",children:d}),e.jsx(i,{onClick:p,size:"lg",className:`flex-1 h-12 rounded-xl font-bold ${o.buttonBg} ${o.buttonText} transition-colors shadow-lg`,children:c})]})]})]})})})})};export{O as default};
assets/{FloatingAITutor-BIdguqCV.js β†’ FloatingAITutor-D0ZeNKA0.js} RENAMED
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatMarkdown-fgwaycBR.js","assets/index-BaOs5Ayg.js","assets/vendor-react-B4AQeu28.js","assets/vendor-firebase-firestore-CH1lNiRF.js","assets/vendor-firebase-core-CO26nNq6.js","assets/vendor-firebase-auth-BLpRW_zO.js","assets/vendor-firebase-storage-B3igpVVS.js","assets/vendor-firebase-analytics-CTiUNb0-.js","assets/vendor-radix-BorKzPz9.js","assets/vendor-charts-D8hf8tI0.js","assets/vendor-markdown-yqZQ_iQm.js","assets/vendor-markdown-CfVKi3_s.css","assets/index-DdX2rVyy.css"])))=>i.map(i=>d[i]);
2
- import{ay as C,_ as y,m as b,w as A}from"./index-BaOs5Ayg.js";import{r as i,j as e}from"./vendor-react-B4AQeu28.js";import{M}from"./maximize-2-EHa6JURc.js";import{M as w}from"./minus-DfrEv-SC.js";import{X as g}from"./x-TNvtuOD9.js";import{S as L}from"./send-CwwDU3uJ.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";const E=i.lazy(()=>y(()=>import("./ChatMarkdown-fgwaycBR.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])));function O(a){return a?a instanceof Date?a.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):typeof a=="object"&&"toDate"in a?a.toDate().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):String(a):""}const Q=({constraintsRef:a,onFullScreen:j})=>{const{activeSessionId:r,setActiveSessionId:v,createNewSession:N,getActiveSession:k,sendMessage:I,isLoading:o}=C(),[s,l]=i.useState(!1),[c,u]=i.useState(()=>typeof window>"u"?!1:window.localStorage.getItem("floating_ai_tutor_minimized")==="1"),[n,m]=i.useState(""),h=i.useRef(null);i.useEffect(()=>{typeof window>"u"||window.localStorage.setItem("floating_ai_tutor_minimized",c?"1":"0")},[c]),i.useEffect(()=>{s&&y(async()=>{const{warmupBackend:t}=await import("./index-BaOs5Ayg.js").then(d=>d.b2);return{warmupBackend:t}},__vite__mapDeps([1,2,3,4,5,6,7,8,9,10,11,12])).then(({warmupBackend:t})=>{t()}).catch(t=>{console.warn("Floating tutor warmup skipped:",t)})},[s]),i.useEffect(()=>{if(s&&!r){const t={id:"1",sender:"ai",text:"Hi! I'm your AI math tutor. What would you like to learn about today?",timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},d=N(t);v(d)}},[s]);const x=k()?.messages||[],S=()=>{h.current?.scrollIntoView({behavior:"smooth"})};i.useEffect(()=>{S()},[x]);const p=async()=>{if(!n.trim()||!r||o)return;const t=n.trim();m(""),await I(r,t)},_=()=>{j()},f=()=>{l(!1),u(!0)},z=()=>{u(!1)};return e.jsxs("div",{className:"pointer-events-none flex flex-col items-end",children:[e.jsxs("div",{className:`pointer-events-auto mb-4 w-80 bg-[#f7f9fc] rounded-3xl shadow-2xl border border-[#dde3eb] flex flex-col overflow-hidden transition-all duration-300 origin-bottom-right select-none ${s?"opacity-100 scale-100 translate-y-0":"opacity-0 scale-95 translate-y-10 pointer-events-none h-0"}`,style:{"--max-h":s?"32rem":"0",willChange:"transform, opacity"},children:[e.jsxs("div",{className:"bg-gradient-to-r from-sky-600 to-sky-500 p-4 flex items-center justify-between flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-white/20 rounded-xl flex items-center justify-center backdrop-blur-sm",children:e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-9 h-9 object-contain drop-shadow-md"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-bold text-sm",children:"L.O.L.I."}),e.jsxs("p",{className:"text-sky-100 text-[10px] leading-tight",children:["Logical Operations &",e.jsx("br",{}),"Learning Intelligence"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:_,type:"button","aria-label":"Open fullscreen",className:"p-2 hover:bg-white/20 rounded-lg transition-colors",title:"Open fullscreen",children:e.jsx(M,{size:16,className:"text-white"})}),e.jsx("button",{type:"button","aria-label":"Minimize AI tutor launcher",onClick:f,className:"p-2 hover:bg-white/20 rounded-lg transition-colors",title:"Minimize",children:e.jsx(w,{size:16,className:"text-white"})}),e.jsx("button",{type:"button","aria-label":"Close chat",onClick:()=>l(!1),className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:e.jsx(g,{size:16,className:"text-white"})})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 bg-[#edf1f7]",children:[x.map(t=>e.jsx("div",{className:`flex ${t.sender==="user"?"justify-end":"justify-start"}`,children:e.jsxs("div",{className:`max-w-[75%] rounded-2xl px-4 py-2.5 ${t.sender==="user"?"bg-sky-600 text-white":"bg-white text-[#0a1628] shadow-sm border border-[#dde3eb]"}`,children:[t.sender==="user"?e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.text}):e.jsx(i.Suspense,{fallback:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.text}),children:e.jsx(E,{children:t.text})}),e.jsx("p",{className:`text-[10px] mt-1 ${t.sender==="user"?"text-sky-200":"text-slate-500"}`,children:O(t.timestamp)})]})},t.id)),o&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"bg-white text-[#0a1628] shadow-sm border border-[#dde3eb] rounded-2xl px-4 py-2.5 max-w-[75%]",children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce [animation-delay:150ms]"}),e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce [animation-delay:300ms]"})]})})}),e.jsx("div",{ref:h})]}),e.jsx("div",{className:"p-4 border-t border-[#dde3eb] bg-white flex-shrink-0",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:"ai-tutor-input",name:"ai-tutor-input","aria-label":"Ask AI tutor a question",type:"text",value:n,onChange:t=>m(t.target.value),onKeyPress:t=>t.key==="Enter"&&p(),placeholder:"Ask me anything...",className:"flex-1 px-4 py-2.5 rounded-xl border border-[#dde3eb] focus:outline-none focus:ring-2 focus:ring-sky-500 text-sm bg-[#f7f9fc]"}),e.jsx("button",{type:"button","aria-label":"Send message",onClick:p,className:"p-2.5 bg-sky-600 hover:bg-sky-700 text-white rounded-xl transition-colors disabled:opacity-50 disabled:cursor-not-allowed",disabled:!n.trim()||o,children:e.jsx(L,{size:18})})]})})]}),e.jsx("div",{className:"pointer-events-auto relative self-end",children:c?e.jsx(b.button,{type:"button",onClick:z,whileHover:{scale:1.08},whileTap:{scale:.95},transition:{duration:.15,ease:"easeOut"},className:"h-9 w-9 rounded-full bg-slate-900/85 text-white shadow-lg ring-1 ring-white/20 backdrop-blur-sm flex items-center justify-center","aria-label":"Restore AI tutor launcher",title:"Show AI tutor",style:{willChange:"transform"},children:e.jsx(A,{size:14})}):e.jsxs("div",{className:"relative group",children:[!s&&e.jsxs("div",{className:"absolute right-full mr-4 top-1/2 -translate-y-1/2 px-4 py-2 bg-slate-800 text-white text-sm rounded-xl opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none whitespace-nowrap shadow-xl z-50",children:["Hello! I'm L.O.L.I., how may I help you?",e.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 -right-1 w-3 h-3 bg-slate-800 rotate-45"})]}),!s&&e.jsx("button",{type:"button","aria-label":"Minimize AI tutor launcher",title:"Minimize",onClick:f,className:"absolute -top-2 -left-2 z-10 h-6 w-6 rounded-full bg-white text-slate-700 border border-slate-200 shadow-md hover:bg-slate-100 transition-colors flex items-center justify-center",children:e.jsx(w,{size:12})}),e.jsx(b.button,{type:"button",onClick:()=>l(!s),whileHover:{scale:1.1},whileTap:{scale:.9},transition:{duration:.15,ease:"easeOut"},className:"w-16 h-16 bg-gradient-to-br from-sky-600 to-sky-500 rounded-xl shadow-2xl flex items-center justify-center text-white hover:shadow-sky-300/50 transition-all","aria-label":s?"Close AI tutor chat":"Open AI tutor chat",style:{willChange:"transform"},children:s?e.jsx(g,{size:28}):e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-14 h-14 object-contain drop-shadow-lg"})})]})})]})};export{Q as default};
 
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatMarkdown-BSQ2GO-C.js","assets/index-uASBzalf.js","assets/vendor-react-B4AQeu28.js","assets/vendor-firebase-firestore-CP9q7ISf.js","assets/vendor-firebase-core-DCQrgkxC.js","assets/vendor-firebase-auth-Bcpr4O6E.js","assets/vendor-firebase-storage-dc5X5yTv.js","assets/vendor-firebase-analytics-CHPyhRzk.js","assets/vendor-radix-xDOIcVzp.js","assets/vendor-charts-Ckgeb0nY.js","assets/vendor-markdown-yqZQ_iQm.js","assets/vendor-markdown-CfVKi3_s.css","assets/index-D9pRNq5G.css"])))=>i.map(i=>d[i]);
2
+ import{az as C,_ as y,m as b,E as A}from"./index-uASBzalf.js";import{r as i,j as e}from"./vendor-react-B4AQeu28.js";import{M}from"./maximize-2-B2yMqxTx.js";import{M as w}from"./minus-Bfei9C79.js";import{X as g}from"./x-CBb03rh3.js";import{S as L}from"./send-bMgoXVnc.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";const E=i.lazy(()=>y(()=>import("./ChatMarkdown-BSQ2GO-C.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])));function O(a){return a?a instanceof Date?a.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):typeof a=="object"&&"toDate"in a?a.toDate().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):String(a):""}const Q=({constraintsRef:a,onFullScreen:j})=>{const{activeSessionId:r,setActiveSessionId:v,createNewSession:N,getActiveSession:k,sendMessage:I,isLoading:o}=C(),[s,l]=i.useState(!1),[c,u]=i.useState(()=>typeof window>"u"?!1:window.localStorage.getItem("floating_ai_tutor_minimized")==="1"),[n,m]=i.useState(""),h=i.useRef(null);i.useEffect(()=>{typeof window>"u"||window.localStorage.setItem("floating_ai_tutor_minimized",c?"1":"0")},[c]),i.useEffect(()=>{s&&y(async()=>{const{warmupBackend:t}=await import("./index-uASBzalf.js").then(d=>d.b3);return{warmupBackend:t}},__vite__mapDeps([1,2,3,4,5,6,7,8,9,10,11,12])).then(({warmupBackend:t})=>{t()}).catch(t=>{console.warn("Floating tutor warmup skipped:",t)})},[s]),i.useEffect(()=>{if(s&&!r){const t={id:"1",sender:"ai",text:"Hi! I'm your AI math tutor. What would you like to learn about today?",timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},d=N(t);v(d)}},[s]);const x=k()?.messages||[],S=()=>{h.current?.scrollIntoView({behavior:"smooth"})};i.useEffect(()=>{S()},[x]);const p=async()=>{if(!n.trim()||!r||o)return;const t=n.trim();m(""),await I(r,t)},_=()=>{j()},f=()=>{l(!1),u(!0)},z=()=>{u(!1)};return e.jsxs("div",{className:"pointer-events-none flex flex-col items-end",children:[e.jsxs("div",{className:`pointer-events-auto mb-4 w-80 bg-[#f7f9fc] rounded-3xl shadow-2xl border border-[#dde3eb] flex flex-col overflow-hidden transition-all duration-300 origin-bottom-right select-none ${s?"opacity-100 scale-100 translate-y-0":"opacity-0 scale-95 translate-y-10 pointer-events-none h-0"}`,style:{"--max-h":s?"32rem":"0",willChange:"transform, opacity"},children:[e.jsxs("div",{className:"bg-gradient-to-r from-sky-600 to-sky-500 p-4 flex items-center justify-between flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-white/20 rounded-xl flex items-center justify-center backdrop-blur-sm",children:e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-9 h-9 object-contain drop-shadow-md"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-bold text-sm",children:"L.O.L.I."}),e.jsxs("p",{className:"text-sky-100 text-[10px] leading-tight",children:["Logical Operations &",e.jsx("br",{}),"Learning Intelligence"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:_,type:"button","aria-label":"Open fullscreen",className:"p-2 hover:bg-white/20 rounded-lg transition-colors",title:"Open fullscreen",children:e.jsx(M,{size:16,className:"text-white"})}),e.jsx("button",{type:"button","aria-label":"Minimize AI tutor launcher",onClick:f,className:"p-2 hover:bg-white/20 rounded-lg transition-colors",title:"Minimize",children:e.jsx(w,{size:16,className:"text-white"})}),e.jsx("button",{type:"button","aria-label":"Close chat",onClick:()=>l(!1),className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:e.jsx(g,{size:16,className:"text-white"})})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 bg-[#edf1f7]",children:[x.map(t=>e.jsx("div",{className:`flex ${t.sender==="user"?"justify-end":"justify-start"}`,children:e.jsxs("div",{className:`max-w-[75%] rounded-2xl px-4 py-2.5 ${t.sender==="user"?"bg-sky-600 text-white":"bg-white text-[#0a1628] shadow-sm border border-[#dde3eb]"}`,children:[t.sender==="user"?e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.text}):e.jsx(i.Suspense,{fallback:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.text}),children:e.jsx(E,{children:t.text})}),e.jsx("p",{className:`text-[10px] mt-1 ${t.sender==="user"?"text-sky-200":"text-slate-500"}`,children:O(t.timestamp)})]})},t.id)),o&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"bg-white text-[#0a1628] shadow-sm border border-[#dde3eb] rounded-2xl px-4 py-2.5 max-w-[75%]",children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce [animation-delay:150ms]"}),e.jsx("div",{className:"w-2 h-2 bg-sky-400 rounded-full animate-bounce [animation-delay:300ms]"})]})})}),e.jsx("div",{ref:h})]}),e.jsx("div",{className:"p-4 border-t border-[#dde3eb] bg-white flex-shrink-0",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:"ai-tutor-input",name:"ai-tutor-input","aria-label":"Ask AI tutor a question",type:"text",value:n,onChange:t=>m(t.target.value),onKeyPress:t=>t.key==="Enter"&&p(),placeholder:"Ask me anything...",className:"flex-1 px-4 py-2.5 rounded-xl border border-[#dde3eb] focus:outline-none focus:ring-2 focus:ring-sky-500 text-sm bg-[#f7f9fc]"}),e.jsx("button",{type:"button","aria-label":"Send message",onClick:p,className:"p-2.5 bg-sky-600 hover:bg-sky-700 text-white rounded-xl transition-colors disabled:opacity-50 disabled:cursor-not-allowed",disabled:!n.trim()||o,children:e.jsx(L,{size:18})})]})})]}),e.jsx("div",{className:"pointer-events-auto relative self-end",children:c?e.jsx(b.button,{type:"button",onClick:z,whileHover:{scale:1.08},whileTap:{scale:.95},transition:{duration:.15,ease:"easeOut"},className:"h-9 w-9 rounded-full bg-slate-900/85 text-white shadow-lg ring-1 ring-white/20 backdrop-blur-sm flex items-center justify-center","aria-label":"Restore AI tutor launcher",title:"Show AI tutor",style:{willChange:"transform"},children:e.jsx(A,{size:14})}):e.jsxs("div",{className:"relative group",children:[!s&&e.jsxs("div",{className:"absolute right-full mr-4 top-1/2 -translate-y-1/2 px-4 py-2 bg-slate-800 text-white text-sm rounded-xl opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none whitespace-nowrap shadow-xl z-50",children:["Hello! I'm L.O.L.I., how may I help you?",e.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 -right-1 w-3 h-3 bg-slate-800 rotate-45"})]}),!s&&e.jsx("button",{type:"button","aria-label":"Minimize AI tutor launcher",title:"Minimize",onClick:f,className:"absolute -top-2 -left-2 z-10 h-6 w-6 rounded-full bg-white text-slate-700 border border-slate-200 shadow-md hover:bg-slate-100 transition-colors flex items-center justify-center",children:e.jsx(w,{size:12})}),e.jsx(b.button,{type:"button",onClick:()=>l(!s),whileHover:{scale:1.1},whileTap:{scale:.9},transition:{duration:.15,ease:"easeOut"},className:"w-16 h-16 bg-gradient-to-br from-sky-600 to-sky-500 rounded-xl shadow-2xl flex items-center justify-center text-white hover:shadow-sky-300/50 transition-all","aria-label":s?"Close AI tutor chat":"Open AI tutor chat",style:{willChange:"transform"},children:s?e.jsx(g,{size:28}):e.jsx("img",{src:"/avatar/avatar_icon.png",alt:"AI Tutor",className:"w-14 h-14 object-contain drop-shadow-lg"})})]})})]})};export{Q as default};
assets/{GradesPage-Y0HsmLPP.js β†’ GradesPage-BAqThNDB.js} RENAMED
@@ -1,2 +1,2 @@
1
- import{r as o,j as e}from"./vendor-react-B4AQeu28.js";import{B as v}from"./button-DCfeFHoH.js";import{u as J,az as K,aA as W,z as X,A as Z,y as z,T as R}from"./index-BaOs5Ayg.js";import{g as q,S as E}from"./subjects-BFghB0SQ.js";import{u as ee}from"./useCurriculum-DDCuCvMR.js";import{D as te}from"./download-DX_YebqQ.js";import{F as P}from"./funnel-BT77sgnz.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-markdown-yqZQ_iQm.js";import"./chart-column-B3jJOD5i.js";const ge=()=>{const{currentUser:i,userProfile:w}=J(),[n,N]=o.useState("all"),[x,D]=o.useState("all"),[M,u]=o.useState(!0),[h,L]=o.useState(null),[F,G]=o.useState([]),y=w?.grade,S=q(y),_=new Set(S),{isLoading:Q}=ee(y);o.useEffect(()=>{},[Q]);const O=t=>{if(t==null)return"N/A";const s=t instanceof Date?t:new Date(t);return Number.isNaN(s.getTime())?"N/A":s.toISOString().split("T")[0]};o.useEffect(()=>{if(!i)return;u(!0);const t=K(i.uid,a=>{L(a),u(!1)}),s=W(i.uid,a=>{G(a),u(!1)});return()=>{t(),s()}},[i]);const b=h?.averageScore?Math.round(h.averageScore):0,U=h?.quizzesCompleted??0,B=b>0?(b/100*4).toFixed(2):"0.00",I={"gen-math":"indigo","stats-prob":"violet"},k={indigo:{dot:"bg-indigo-500",bar:"bg-indigo-500"},violet:{dot:"bg-violet-500",bar:"bg-violet-500"},fuchsia:{dot:"bg-fuchsia-500",bar:"bg-fuchsia-500"},purple:{dot:"bg-purple-500",bar:"bg-purple-500"},slate:{dot:"bg-slate-500",bar:"bg-slate-500"}},A=E.reduce((t,s)=>(t[s.id]={label:s.name,color:I[s.id]||"slate"},t),{}),c=E.filter(t=>_.has(t.id)).map(t=>t.name),T=Object.entries({}).filter(([t])=>_.has(t)).map(([t,s])=>{const a=A[t]||{label:t,color:"slate"},r=[],f=r.length>0?Math.round(r.reduce((g,p)=>g+p.score,0)/r.length):Math.round(s?.progress??0);return{subject:a.label,average:f,quizzes:r.length||s?.completedModules,color:a.color}}),H=S.map(t=>{const s=A[t]||{label:t,color:"slate"};return{subject:s.label,average:0,quizzes:0,color:s.color}}),C=T.length>0?T:H,$=F.slice().sort((t,s)=>{const a=t.completedAt?.toDate?.()?.getTime()??0;return(s.completedAt?.toDate?.()?.getTime()??0)-a}).slice(0,10).map((t,s)=>({id:s+1,title:t.title||`Assessment ${s+1}`,subject:t.subject||"General",score:t.score,date:t.completedAt?O(t.completedAt.toDate()):"N/A",type:t.type==="practice"?"practice":(t.type==="diagnostic","module"),status:t.score>=80?"Excellent":t.score>=60?"Passing":"Needs Review"})).filter(t=>c.includes(t.subject)),m=$.filter(t=>{if(!c.includes(t.subject))return!1;const s=n==="all"||t.subject===n,a=x==="all"||t.type===x;return s&&a});o.useEffect(()=>{n!=="all"&&(c.includes(n)||N("all"))},[c,n]);const V=()=>{const t=l=>{const j=String(l??"");return/[",\n]/.test(j)?`"${j.replace(/"/g,'""')}"`:j},s=[],a=w?.name||i?.displayName||i?.email||"Student",r=new Date().toISOString().split("T")[0];s.push("Grade Report"),s.push(`Student,${t(a)}`),s.push(`Export Date,${t(r)}`),s.push(`Subject Filter,${t(n)}`),s.push(`Type Filter,${t(x)}`),s.push(""),s.push("Subject Performance"),s.push("Subject,Average Score"),C.forEach(l=>{s.push([t(l.subject),t(l.average)].join(","))}),s.push(""),s.push("Recent Quizzes"),s.push("Title,Subject,Score,Date,Type,Status"),m.length===0?s.push("No quiz data available for the selected filters"):m.forEach(l=>{s.push([t(l.title),t(l.subject),t(l.score),t(l.date),t(l.type),t(l.status)].join(","))});const f=s.join(`
2
- `),g=new Blob([f],{type:"text/csv;charset=utf-8;"}),p=window.URL.createObjectURL(g),d=document.createElement("a"),Y=a.replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()||"student";d.href=p,d.setAttribute("download",`grade-report-${Y}-${r}.csv`),document.body.appendChild(d),d.click(),document.body.removeChild(d),window.URL.revokeObjectURL(p)};return M?e.jsx("div",{className:"p-8 flex justify-center items-center h-full",children:e.jsx("div",{className:"w-10 h-10 border-4 border-indigo-500 border-t-transparent rounded-full animate-spin"})}):e.jsxs("div",{className:"p-4 sm:p-6 lg:p-8 space-y-8 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 bg-white p-6 rounded-[2rem] shadow-[0_8px_30px_-12px_rgba(0,0,0,0.06)] border border-slate-50",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-display font-black text-slate-800 tracking-tight",children:"Assessment"}),e.jsx("p",{className:"text-slate-400 font-bold mt-1 text-[13px]",children:"Review your performance across subjects"})]}),e.jsxs("div",{className:"flex gap-3 w-full sm:w-auto",children:[e.jsxs(v,{variant:"outline",className:"flex-1 sm:flex-none border-slate-200 text-slate-500 font-bold rounded-xl h-11 px-5 hover:bg-slate-50 hover:text-slate-700",children:[e.jsx(X,{className:"w-4 h-4 mr-2 text-slate-400"}),"This Semester"]}),e.jsxs(v,{className:"flex-1 sm:flex-none bg-indigo-600 hover:bg-indigo-700 text-white font-bold rounded-xl h-11 px-5 shadow-[0_8px_20px_-8px_rgba(79,70,229,0.5)] hover:-translate-y-0.5 transition-all",onClick:V,children:[e.jsx(te,{className:"w-4 h-4 mr-2"}),"Report"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 p-6 sm:p-8 shadow-[0_8px_24px_-10px_rgba(0,0,0,0.05)] relative overflow-hidden group hover:border-indigo-100 transition-colors",children:[e.jsx("div",{className:"absolute -right-8 -top-8 w-32 h-32 bg-indigo-50 rounded-full group-hover:scale-110 transition-transform duration-500"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-14 h-14 bg-indigo-100 text-indigo-600 rounded-2xl flex items-center justify-center mb-6 shadow-sm",children:e.jsx(Z,{className:"w-7 h-7"})}),e.jsx("p",{className:"text-slate-400 font-bold text-sm tracking-wide uppercase",children:"Overall GPA"}),e.jsx("div",{className:"flex items-end gap-2 mt-2",children:e.jsx("h3",{className:"text-4xl font-display font-black text-slate-800",children:B})})]})]}),e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 p-6 sm:p-8 shadow-[0_8px_24px_-10px_rgba(0,0,0,0.05)] relative overflow-hidden group hover:border-emerald-100 transition-colors",children:[e.jsx("div",{className:"absolute -right-8 -top-8 w-32 h-32 bg-emerald-50 rounded-full group-hover:scale-110 transition-transform duration-500"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-14 h-14 bg-emerald-100 text-emerald-600 rounded-2xl flex items-center justify-center mb-6 shadow-sm",children:e.jsx(z,{className:"w-7 h-7"})}),e.jsx("p",{className:"text-slate-400 font-bold text-sm tracking-wide uppercase",children:"Average Score"}),e.jsx("div",{className:"flex items-end gap-2 mt-2",children:e.jsxs("h3",{className:"text-4xl font-display font-black text-slate-800",children:[b,"%"]})})]})]}),e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 p-6 sm:p-8 shadow-[0_8px_24px_-10px_rgba(0,0,0,0.05)] relative overflow-hidden group hover:border-violet-100 transition-colors",children:[e.jsx("div",{className:"absolute -right-8 -top-8 w-32 h-32 bg-violet-50 rounded-full group-hover:scale-110 transition-transform duration-500"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-14 h-14 bg-violet-100 text-violet-600 rounded-2xl flex items-center justify-center mb-6 shadow-sm",children:e.jsx(R,{className:"w-7 h-7"})}),e.jsx("p",{className:"text-slate-400 font-bold text-sm tracking-wide uppercase",children:"Quizzes Completed"}),e.jsx("div",{className:"flex items-end gap-2 mt-2",children:e.jsx("h3",{className:"text-4xl font-display font-black text-slate-800",children:U})})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 shadow-[0_8px_30px_-12px_rgba(0,0,0,0.06)] overflow-hidden flex flex-col h-full",children:[e.jsxs("div",{className:"p-6 sm:p-8 border-b border-slate-50 flex flex-col sm:flex-row justify-between items-start sm:items-center gap-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-display font-black text-xl text-slate-800",children:"Recent Assessments"}),e.jsx("p",{className:"text-slate-400 font-bold text-[13px] mt-1",children:"Your latest quiz and practice results"})]}),e.jsxs("div",{className:"flex items-center gap-3 w-full sm:w-auto",children:[e.jsxs("div",{className:"relative flex-1 sm:flex-none",children:[e.jsxs("select",{value:n,onChange:t=>N(t.target.value),className:"appearance-none w-full pl-4 pr-10 py-2.5 border-none bg-slate-50 rounded-xl text-sm font-bold text-slate-600 focus:ring-2 focus:ring-indigo-500/30 transition-all cursor-pointer min-w-[140px] shadow-sm",children:[e.jsx("option",{value:"all",children:"All Subjects"}),c.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsx(P,{className:"w-4 h-4 text-slate-400 absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none"})]}),e.jsxs("div",{className:"relative flex-1 sm:flex-none",children:[e.jsxs("select",{value:x,onChange:t=>D(t.target.value),className:"appearance-none w-full pl-4 pr-10 py-2.5 border-none bg-slate-50 rounded-xl text-sm font-bold text-slate-600 focus:ring-2 focus:ring-indigo-500/30 transition-all cursor-pointer min-w-[120px] shadow-sm",children:[e.jsx("option",{value:"all",children:"All Types"}),e.jsx("option",{value:"module",children:"Module Quiz"}),e.jsx("option",{value:"practice",children:"Practice"})]}),e.jsx(P,{className:"w-4 h-4 text-slate-400 absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none"})]})]})]}),e.jsx("div",{className:"overflow-x-auto flex-1 p-2",children:e.jsxs("table",{className:"w-full text-left border-separate border-spacing-y-2 px-4 sm:px-6 mb-4",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider border-b border-transparent",children:"Assessment"}),e.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider border-b border-transparent min-w-[120px]",children:"Subject"}),e.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider border-b border-transparent",children:"Type"}),e.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider text-right border-b border-transparent",children:"Score"})]})}),e.jsx("tbody",{children:m.length>0?m.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/70 transition-colors",children:[e.jsxs("td",{className:"px-4 py-4 rounded-l-2xl",children:[e.jsx("p",{className:"text-[14px] font-bold text-slate-800",children:t.title}),e.jsx("p",{className:"text-[11px] font-bold text-slate-400 mt-1",children:t.date})]}),e.jsx("td",{className:"px-4 py-4",children:e.jsx("span",{className:"inline-flex flex-col gap-1 items-start",children:e.jsx("span",{className:"text-[13px] font-bold text-slate-600 truncate max-w-[140px] block",children:t.subject})})}),e.jsx("td",{className:"px-4 py-4",children:e.jsx("span",{className:`inline-flex items-center px-3 py-1.5 rounded-lg text-[11px] font-bold uppercase tracking-wide ${t.type==="practice"?"bg-emerald-100/50 text-emerald-600":"bg-indigo-100/50 text-indigo-600"}`,children:t.type==="practice"?"Practice":"Quiz"})}),e.jsx("td",{className:"px-4 py-4 text-right rounded-r-2xl",children:e.jsxs("span",{className:`inline-flex items-center px-3 py-1.5 rounded-xl text-[13px] font-black ${t.score>=80?"bg-emerald-100 text-emerald-700":t.score>=60?"bg-amber-100 text-amber-700":"bg-rose-100 text-rose-700"}`,children:[t.score,"%"]})})]},t.id)):e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-6 py-16 text-center",children:e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx("div",{className:"w-16 h-16 bg-slate-50 rounded-full flex items-center justify-center mb-4",children:e.jsx(z,{className:"w-8 h-8 text-slate-300"})}),e.jsx("p",{className:"text-slate-500 font-bold text-sm",children:"No recent assessments match the selected filters."})]})})})})]})})]})}),e.jsxs("div",{className:"space-y-6 lg:space-y-8 flex flex-col",children:[e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 p-6 sm:p-8 shadow-[0_8px_30px_-12px_rgba(0,0,0,0.06)]",children:[e.jsx("div",{className:"flex items-center justify-between mb-8",children:e.jsx("h3",{className:"font-display font-black text-lg text-slate-800",children:"Subject Performance"})}),e.jsx("div",{className:"space-y-7",children:C.map((t,s)=>{const a=k[t.color]||k.slate;return e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex justify-between items-end mb-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[14px] font-bold text-slate-800 flex items-center gap-2",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${a.dot} group-hover:scale-125 transition-transform`}),t.subject]}),e.jsxs("p",{className:"text-[11px] text-slate-400 font-bold ml-4 mt-0.5",children:[t.quizzes," activities"]})]}),e.jsxs("span",{className:"text-[15px] font-black text-slate-800",children:[t.average,"%"]})]}),e.jsx("div",{className:"h-2.5 w-full bg-slate-100 rounded-full overflow-hidden shadow-inner",children:e.jsx("div",{className:`h-full rounded-full e-w ${a.bar} shadow-sm relative overflow-hidden transition-all duration-1000`,style:{"--w":`${Math.max(t.average,5)}%`},children:e.jsx("div",{className:"absolute inset-0 bg-white/20 w-1/2 -skew-x-12 translate-x-[-100%] group-hover:animate-[shimmer_1.5s_ease-out]"})})})]},s)})})]}),e.jsxs("div",{className:"relative bg-gradient-to-br from-indigo-600 to-violet-700 rounded-[2rem] p-6 sm:p-8 shadow-[0_12px_30px_-10px_rgba(79,70,229,0.5)] text-white overflow-hidden group",children:[e.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 bg-white/10 rounded-full blur-3xl -mt-10 -mr-10 group-hover:bg-white/20 transition-all duration-700 ease-in-out"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-indigo-400/30 rounded-full blur-2xl -mb-10 -ml-10"}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"w-12 h-12 bg-white/10 rounded-2xl flex items-center justify-center mb-5 backdrop-blur-sm border border-white/20 shadow-sm group-hover:scale-110 transition-transform",children:e.jsx(R,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-display font-black tracking-tight mb-2 leading-tight",children:"Keep up the momentum!"}),e.jsxs("p",{className:"text-white/80 text-[13px] font-medium leading-relaxed mb-8 max-w-[90%]",children:["You've completed ",e.jsx("span",{className:"font-black text-white",children:$.length})," activities recently. Try a practice session to boost your lowest scores."]}),e.jsx(v,{className:"w-full bg-white text-indigo-600 hover:bg-slate-50 border-0 font-black h-12 rounded-xl shadow-[0_8px_16px_rgba(0,0,0,0.15)] hover:shadow-[0_8px_24px_rgba(0,0,0,0.2)] hover:-translate-y-0.5 transition-all",children:"Start Practice Session"})]})]})]})]})]})};export{ge as default};
 
1
+ import{r as o,j as e}from"./vendor-react-B4AQeu28.js";import{B as v}from"./button-BPmLcOpC.js";import{l as J,aA as K,aB as W,D as X,A as Z,q as R,T as D}from"./index-uASBzalf.js";import{g as q,S as E}from"./subjects-F8wTuRgo.js";import{u as ee}from"./useCurriculum-DZVkK6Ec.js";import{D as te}from"./download-CVrPjUr0.js";import{F as P}from"./funnel-CSHS_tp4.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-markdown-yqZQ_iQm.js";import"./chart-column-CLoxLorp.js";const ge=()=>{const{currentUser:i,userProfile:w}=J(),[n,N]=o.useState("all"),[x,z]=o.useState("all"),[M,u]=o.useState(!0),[h,L]=o.useState(null),[F,G]=o.useState([]),y=w?.grade,S=q(y),_=new Set(S),{isLoading:Q}=ee(y);o.useEffect(()=>{},[Q]);const B=t=>{if(t==null)return"N/A";const s=t instanceof Date?t:new Date(t);return Number.isNaN(s.getTime())?"N/A":s.toISOString().split("T")[0]};o.useEffect(()=>{if(!i)return;u(!0);const t=K(i.uid,a=>{L(a),u(!1)}),s=W(i.uid,a=>{G(a),u(!1)});return()=>{t(),s()}},[i]);const b=h?.averageScore?Math.round(h.averageScore):0,O=h?.quizzesCompleted??0,U=b>0?(b/100*4).toFixed(2):"0.00",I={"gen-math":"indigo","stats-prob":"violet"},k={indigo:{dot:"bg-indigo-500",bar:"bg-indigo-500"},violet:{dot:"bg-violet-500",bar:"bg-violet-500"},fuchsia:{dot:"bg-fuchsia-500",bar:"bg-fuchsia-500"},purple:{dot:"bg-purple-500",bar:"bg-purple-500"},slate:{dot:"bg-slate-500",bar:"bg-slate-500"}},A=E.reduce((t,s)=>(t[s.id]={label:s.name,color:I[s.id]||"slate"},t),{}),c=E.filter(t=>_.has(t.id)).map(t=>t.name),T=Object.entries({}).filter(([t])=>_.has(t)).map(([t,s])=>{const a=A[t]||{label:t,color:"slate"},r=[],f=r.length>0?Math.round(r.reduce((g,p)=>g+p.score,0)/r.length):Math.round(s?.progress??0);return{subject:a.label,average:f,quizzes:r.length||s?.completedModules,color:a.color}}),H=S.map(t=>{const s=A[t]||{label:t,color:"slate"};return{subject:s.label,average:0,quizzes:0,color:s.color}}),C=T.length>0?T:H,$=F.slice().sort((t,s)=>{const a=t.completedAt?.toDate?.()?.getTime()??0;return(s.completedAt?.toDate?.()?.getTime()??0)-a}).slice(0,10).map((t,s)=>({id:s+1,title:t.title||`Assessment ${s+1}`,subject:t.subject||"General",score:t.score,date:t.completedAt?B(t.completedAt.toDate()):"N/A",type:t.type==="practice"?"practice":(t.type==="diagnostic","module"),status:t.score>=80?"Excellent":t.score>=60?"Passing":"Needs Review"})).filter(t=>c.includes(t.subject)),m=$.filter(t=>{if(!c.includes(t.subject))return!1;const s=n==="all"||t.subject===n,a=x==="all"||t.type===x;return s&&a});o.useEffect(()=>{n!=="all"&&(c.includes(n)||N("all"))},[c,n]);const V=()=>{const t=l=>{const j=String(l??"");return/[",\n]/.test(j)?`"${j.replace(/"/g,'""')}"`:j},s=[],a=w?.name||i?.displayName||i?.email||"Student",r=new Date().toISOString().split("T")[0];s.push("Grade Report"),s.push(`Student,${t(a)}`),s.push(`Export Date,${t(r)}`),s.push(`Subject Filter,${t(n)}`),s.push(`Type Filter,${t(x)}`),s.push(""),s.push("Subject Performance"),s.push("Subject,Average Score"),C.forEach(l=>{s.push([t(l.subject),t(l.average)].join(","))}),s.push(""),s.push("Recent Quizzes"),s.push("Title,Subject,Score,Date,Type,Status"),m.length===0?s.push("No quiz data available for the selected filters"):m.forEach(l=>{s.push([t(l.title),t(l.subject),t(l.score),t(l.date),t(l.type),t(l.status)].join(","))});const f=s.join(`
2
+ `),g=new Blob([f],{type:"text/csv;charset=utf-8;"}),p=window.URL.createObjectURL(g),d=document.createElement("a"),Y=a.replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()||"student";d.href=p,d.setAttribute("download",`grade-report-${Y}-${r}.csv`),document.body.appendChild(d),d.click(),document.body.removeChild(d),window.URL.revokeObjectURL(p)};return M?e.jsx("div",{className:"p-8 flex justify-center items-center h-full",children:e.jsx("div",{className:"w-10 h-10 border-4 border-indigo-500 border-t-transparent rounded-full animate-spin"})}):e.jsxs("div",{className:"p-4 sm:p-6 lg:p-8 space-y-8 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 bg-white p-6 rounded-[2rem] shadow-[0_8px_30px_-12px_rgba(0,0,0,0.06)] border border-slate-50",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-display font-black text-slate-800 tracking-tight",children:"Assessment"}),e.jsx("p",{className:"text-slate-400 font-bold mt-1 text-[13px]",children:"Review your performance across subjects"})]}),e.jsxs("div",{className:"flex gap-3 w-full sm:w-auto",children:[e.jsxs(v,{variant:"outline",className:"flex-1 sm:flex-none border-slate-200 text-slate-500 font-bold rounded-xl h-11 px-5 hover:bg-slate-50 hover:text-slate-700",children:[e.jsx(X,{className:"w-4 h-4 mr-2 text-slate-400"}),"This Semester"]}),e.jsxs(v,{className:"flex-1 sm:flex-none bg-indigo-600 hover:bg-indigo-700 text-white font-bold rounded-xl h-11 px-5 shadow-[0_8px_20px_-8px_rgba(79,70,229,0.5)] hover:-translate-y-0.5 transition-all",onClick:V,children:[e.jsx(te,{className:"w-4 h-4 mr-2"}),"Report"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 p-6 sm:p-8 shadow-[0_8px_24px_-10px_rgba(0,0,0,0.05)] relative overflow-hidden group hover:border-indigo-100 transition-colors",children:[e.jsx("div",{className:"absolute -right-8 -top-8 w-32 h-32 bg-indigo-50 rounded-full group-hover:scale-110 transition-transform duration-500"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-14 h-14 bg-indigo-100 text-indigo-600 rounded-2xl flex items-center justify-center mb-6 shadow-sm",children:e.jsx(Z,{className:"w-7 h-7"})}),e.jsx("p",{className:"text-slate-400 font-bold text-sm tracking-wide uppercase",children:"Overall GPA"}),e.jsx("div",{className:"flex items-end gap-2 mt-2",children:e.jsx("h3",{className:"text-4xl font-display font-black text-slate-800",children:U})})]})]}),e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 p-6 sm:p-8 shadow-[0_8px_24px_-10px_rgba(0,0,0,0.05)] relative overflow-hidden group hover:border-emerald-100 transition-colors",children:[e.jsx("div",{className:"absolute -right-8 -top-8 w-32 h-32 bg-emerald-50 rounded-full group-hover:scale-110 transition-transform duration-500"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-14 h-14 bg-emerald-100 text-emerald-600 rounded-2xl flex items-center justify-center mb-6 shadow-sm",children:e.jsx(R,{className:"w-7 h-7"})}),e.jsx("p",{className:"text-slate-400 font-bold text-sm tracking-wide uppercase",children:"Average Score"}),e.jsx("div",{className:"flex items-end gap-2 mt-2",children:e.jsxs("h3",{className:"text-4xl font-display font-black text-slate-800",children:[b,"%"]})})]})]}),e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 p-6 sm:p-8 shadow-[0_8px_24px_-10px_rgba(0,0,0,0.05)] relative overflow-hidden group hover:border-violet-100 transition-colors",children:[e.jsx("div",{className:"absolute -right-8 -top-8 w-32 h-32 bg-violet-50 rounded-full group-hover:scale-110 transition-transform duration-500"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-14 h-14 bg-violet-100 text-violet-600 rounded-2xl flex items-center justify-center mb-6 shadow-sm",children:e.jsx(D,{className:"w-7 h-7"})}),e.jsx("p",{className:"text-slate-400 font-bold text-sm tracking-wide uppercase",children:"Quizzes Completed"}),e.jsx("div",{className:"flex items-end gap-2 mt-2",children:e.jsx("h3",{className:"text-4xl font-display font-black text-slate-800",children:O})})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 shadow-[0_8px_30px_-12px_rgba(0,0,0,0.06)] overflow-hidden flex flex-col h-full",children:[e.jsxs("div",{className:"p-6 sm:p-8 border-b border-slate-50 flex flex-col sm:flex-row justify-between items-start sm:items-center gap-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-display font-black text-xl text-slate-800",children:"Recent Assessments"}),e.jsx("p",{className:"text-slate-400 font-bold text-[13px] mt-1",children:"Your latest quiz and practice results"})]}),e.jsxs("div",{className:"flex items-center gap-3 w-full sm:w-auto",children:[e.jsxs("div",{className:"relative flex-1 sm:flex-none",children:[e.jsxs("select",{value:n,onChange:t=>N(t.target.value),className:"appearance-none w-full pl-4 pr-10 py-2.5 border-none bg-slate-50 rounded-xl text-sm font-bold text-slate-600 focus:ring-2 focus:ring-indigo-500/30 transition-all cursor-pointer min-w-[140px] shadow-sm",children:[e.jsx("option",{value:"all",children:"All Subjects"}),c.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsx(P,{className:"w-4 h-4 text-slate-400 absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none"})]}),e.jsxs("div",{className:"relative flex-1 sm:flex-none",children:[e.jsxs("select",{value:x,onChange:t=>z(t.target.value),className:"appearance-none w-full pl-4 pr-10 py-2.5 border-none bg-slate-50 rounded-xl text-sm font-bold text-slate-600 focus:ring-2 focus:ring-indigo-500/30 transition-all cursor-pointer min-w-[120px] shadow-sm",children:[e.jsx("option",{value:"all",children:"All Types"}),e.jsx("option",{value:"module",children:"Module Quiz"}),e.jsx("option",{value:"practice",children:"Practice"})]}),e.jsx(P,{className:"w-4 h-4 text-slate-400 absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none"})]})]})]}),e.jsx("div",{className:"overflow-x-auto flex-1 p-2",children:e.jsxs("table",{className:"w-full text-left border-separate border-spacing-y-2 px-4 sm:px-6 mb-4",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider border-b border-transparent",children:"Assessment"}),e.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider border-b border-transparent min-w-[120px]",children:"Subject"}),e.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider border-b border-transparent",children:"Type"}),e.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider text-right border-b border-transparent",children:"Score"})]})}),e.jsx("tbody",{children:m.length>0?m.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/70 transition-colors",children:[e.jsxs("td",{className:"px-4 py-4 rounded-l-2xl",children:[e.jsx("p",{className:"text-[14px] font-bold text-slate-800",children:t.title}),e.jsx("p",{className:"text-[11px] font-bold text-slate-400 mt-1",children:t.date})]}),e.jsx("td",{className:"px-4 py-4",children:e.jsx("span",{className:"inline-flex flex-col gap-1 items-start",children:e.jsx("span",{className:"text-[13px] font-bold text-slate-600 truncate max-w-[140px] block",children:t.subject})})}),e.jsx("td",{className:"px-4 py-4",children:e.jsx("span",{className:`inline-flex items-center px-3 py-1.5 rounded-lg text-[11px] font-bold uppercase tracking-wide ${t.type==="practice"?"bg-emerald-100/50 text-emerald-600":"bg-indigo-100/50 text-indigo-600"}`,children:t.type==="practice"?"Practice":"Quiz"})}),e.jsx("td",{className:"px-4 py-4 text-right rounded-r-2xl",children:e.jsxs("span",{className:`inline-flex items-center px-3 py-1.5 rounded-xl text-[13px] font-black ${t.score>=80?"bg-emerald-100 text-emerald-700":t.score>=60?"bg-amber-100 text-amber-700":"bg-rose-100 text-rose-700"}`,children:[t.score,"%"]})})]},t.id)):e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-6 py-16 text-center",children:e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx("div",{className:"w-16 h-16 bg-slate-50 rounded-full flex items-center justify-center mb-4",children:e.jsx(R,{className:"w-8 h-8 text-slate-300"})}),e.jsx("p",{className:"text-slate-500 font-bold text-sm",children:"No recent assessments match the selected filters."})]})})})})]})})]})}),e.jsxs("div",{className:"space-y-6 lg:space-y-8 flex flex-col",children:[e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 p-6 sm:p-8 shadow-[0_8px_30px_-12px_rgba(0,0,0,0.06)]",children:[e.jsx("div",{className:"flex items-center justify-between mb-8",children:e.jsx("h3",{className:"font-display font-black text-lg text-slate-800",children:"Subject Performance"})}),e.jsx("div",{className:"space-y-7",children:C.map((t,s)=>{const a=k[t.color]||k.slate;return e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex justify-between items-end mb-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[14px] font-bold text-slate-800 flex items-center gap-2",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${a.dot} group-hover:scale-125 transition-transform`}),t.subject]}),e.jsxs("p",{className:"text-[11px] text-slate-400 font-bold ml-4 mt-0.5",children:[t.quizzes," activities"]})]}),e.jsxs("span",{className:"text-[15px] font-black text-slate-800",children:[t.average,"%"]})]}),e.jsx("div",{className:"h-2.5 w-full bg-slate-100 rounded-full overflow-hidden shadow-inner",children:e.jsx("div",{className:`h-full rounded-full e-w ${a.bar} shadow-sm relative overflow-hidden transition-all duration-1000`,style:{"--w":`${Math.max(t.average,5)}%`},children:e.jsx("div",{className:"absolute inset-0 bg-white/20 w-1/2 -skew-x-12 translate-x-[-100%] group-hover:animate-[shimmer_1.5s_ease-out]"})})})]},s)})})]}),e.jsxs("div",{className:"relative bg-gradient-to-br from-indigo-600 to-violet-700 rounded-[2rem] p-6 sm:p-8 shadow-[0_12px_30px_-10px_rgba(79,70,229,0.5)] text-white overflow-hidden group",children:[e.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 bg-white/10 rounded-full blur-3xl -mt-10 -mr-10 group-hover:bg-white/20 transition-all duration-700 ease-in-out"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-indigo-400/30 rounded-full blur-2xl -mb-10 -ml-10"}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"w-12 h-12 bg-white/10 rounded-2xl flex items-center justify-center mb-5 backdrop-blur-sm border border-white/20 shadow-sm group-hover:scale-110 transition-transform",children:e.jsx(D,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-display font-black tracking-tight mb-2 leading-tight",children:"Keep up the momentum!"}),e.jsxs("p",{className:"text-white/80 text-[13px] font-medium leading-relaxed mb-8 max-w-[90%]",children:["You've completed ",e.jsx("span",{className:"font-black text-white",children:$.length})," activities recently. Try a practice session to boost your lowest scores."]}),e.jsx(v,{className:"w-full bg-white text-indigo-600 hover:bg-slate-50 border-0 font-black h-12 rounded-xl shadow-[0_8px_16px_rgba(0,0,0,0.15)] hover:shadow-[0_8px_24px_rgba(0,0,0,0.2)] hover:-translate-y-0.5 transition-all",children:"Start Practice Session"})]})]})]})]})]})};export{ge as default};
assets/{HeroBanner-CKiXGluA.js β†’ HeroBanner-DQ9n4La7.js} RENAMED
@@ -1,5 +1,5 @@
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardAvatar-CbAKGmA6.js","assets/vendor-react-B4AQeu28.js","assets/avatarData-BuQSOXo3.js"])))=>i.map(i=>d[i]);
2
- import{e as y,T as v,f as w,Q as k,j as M,m as p,A as P,B as u,y as A,Z as T,b as _,_ as E}from"./index-BaOs5Ayg.js";import{j as e,r as o}from"./vendor-react-B4AQeu28.js";import{D as V,a as Q}from"./dialog-CHtYkwVl.js";import{R as $,L as G,C as q,X as Y,Y as W,T as X,b as F}from"./vendor-charts-D8hf8tI0.js";import{collection as S,query as C,limit as L,orderBy as R,getDocs as D}from"./vendor-firebase-firestore-CH1lNiRF.js";import{X as K}from"./x-TNvtuOD9.js";import{C as z}from"./circle-alert-CP9K3300.js";import{C as U}from"./circle-check-C0FPGTrp.js";import{S as Z}from"./sparkles-By-vFjpv.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-markdown-yqZQ_iQm.js";/**
3
  * @license lucide-react v0.487.0 - ISC
4
  *
5
  * This source code is licensed under the ISC license.
@@ -9,5 +9,5 @@ import{e as y,T as v,f as w,Q as k,j as M,m as p,A as P,B as u,y as A,Z as T,b a
9
  *
10
  * This source code is licensed under the ISC license.
11
  * See the LICENSE file in the root directory of this source tree.
12
- */const I=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],ee=y("shield-alert",I),se=({history:s})=>{if(s.length===0)return e.jsxs("div",{className:"text-center py-12 text-slate-400",children:[e.jsx(v,{className:"w-12 h-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:"Complete more assessments to see your progress history."})]});const t=s.map(a=>({date:new Date(a.completedAt).toLocaleDateString("en-US",{month:"short",day:"numeric"}),score:a.percentage,level:a.proficiencyLevel}));return e.jsx("div",{className:"w-full",children:e.jsx($,{width:"100%",height:250,children:e.jsxs(G,{data:t,margin:{top:10,right:20,left:0,bottom:5},children:[e.jsx(q,{strokeDasharray:"3 3",stroke:"#e2e8f0"}),e.jsx(Y,{dataKey:"date",tick:{fontSize:12,fill:"#64748b"}}),e.jsx(W,{domain:[0,100],tick:{fontSize:12,fill:"#64748b"}}),e.jsx(X,{contentStyle:{borderRadius:"12px",border:"1px solid #e2e8f0",boxShadow:"0 4px 12px rgba(0,0,0,0.08)"}}),e.jsx(F,{type:"monotone",dataKey:"score",stroke:"#0ea5e9",strokeWidth:3,dot:{fill:"#0ea5e9",strokeWidth:2,r:5},activeDot:{r:7,fill:"#0284c7"}})]})})})};async function te(s){const t=S(w,"assessmentResults",s,"attempts"),a=C(t,R("completedAt","desc"),L(10));return(await D(a)).docs.map(n=>{const r=n.data();return{attemptId:r.attemptId,score:r.score,totalQuestions:r.totalQuestions,percentage:r.percentage,completedAt:r.completedAt?.toDate?.()?.toISOString()||r.completedAt,proficiencyLevel:r.proficiencyLevel}})}async function ae(s){const t=S(w,"assessmentResults",s,"attempts"),a=C(t,R("completedAt","desc"),L(1)),i=await D(a);if(i.empty)return null;const r=i.docs[0].data();return{...r,completedAt:r.completedAt?.toDate?.()?.toISOString()||r.completedAt}}const re={Beginner:"bg-amber-100 text-amber-700 border-amber-300",Developing:"bg-blue-100 text-blue-700 border-blue-300",Proficient:"bg-emerald-100 text-emerald-700 border-emerald-300",Advanced:"bg-violet-100 text-violet-700 border-violet-300"},le=({result:s})=>e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-gradient-to-br from-sky-500 to-teal-600 rounded-xl p-6 text-white",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sky-200 text-sm font-medium",children:"Total Score"}),e.jsxs("p",{className:"text-4xl font-bold",children:[s.score,"/",s.totalQuestions]}),e.jsxs("p",{className:"text-sky-200 text-sm mt-1",children:[s.percentage,"% Correct"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sky-200 text-sm font-medium",children:"Proficiency"}),e.jsx("span",{className:`inline-block mt-1 px-3 py-1 rounded-full text-sm font-semibold border ${re[s.proficiencyLevel]}`,children:s.proficiencyLevel})]})]})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-semibold text-slate-800 mb-3 flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4 text-sky-500"}),"Competency Breakdown"]}),e.jsx("div",{className:"space-y-2",children:s.competencyBreakdown.map((t,a)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-slate-700",children:t.topic}),e.jsxs("p",{className:"text-xs text-slate-500",children:[t.correctAnswers,"/",t.totalQuestions," correct"]})]}),e.jsx("div",{className:"w-20 h-2 bg-slate-200 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full ${t.accuracyPercent>=70?"bg-emerald-500":"bg-red-400"}`,style:{width:`${t.accuracyPercent}%`}})}),e.jsxs("span",{className:"text-sm font-semibold text-slate-600 w-10 text-right",children:[t.accuracyPercent,"%"]})]},a))})]}),s.aiNarrative&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Z,{className:"w-4 h-4 text-amber-500 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-amber-800 leading-relaxed",children:s.aiNarrative})]})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-semibold text-slate-800 mb-3 flex items-center gap-2",children:[e.jsx(A,{className:"w-4 h-4 text-sky-500"}),"Question Breakdown"]}),e.jsx("div",{className:"space-y-3",children:s.answers.map((t,a)=>e.jsxs("div",{className:`p-4 rounded-xl border-2 ${t.isCorrect?"border-emerald-200 bg-emerald-50/30":"border-red-200 bg-red-50/30"}`,children:[e.jsxs("p",{className:"text-sm font-medium text-slate-800 mb-2",children:["Q",a+1,". ",t.questionText]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("span",{className:"text-slate-500",children:["Your answer: ",e.jsx("span",{className:t.isCorrect?"text-emerald-600 font-medium":"text-red-500 font-medium",children:t.userAnswer||"β€”"})]}),!t.isCorrect&&e.jsxs("span",{className:"text-slate-500",children:["Correct: ",e.jsx("span",{className:"text-emerald-600 font-medium",children:t.correctAnswer})]})]}),t.explanation&&e.jsx("p",{className:"text-xs text-slate-500 mt-2 leading-relaxed",children:t.explanation})]},a))})]})]}),oe=({summary:s})=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[e.jsxs("div",{className:"bg-sky-50 border border-sky-100 rounded-2xl p-4 flex items-center gap-4 flex-1",children:[e.jsxs("div",{className:"w-12 h-12 bg-sky-500 rounded-full flex items-center justify-center text-white font-bold text-lg shadow-sm",children:[s.latestScorePercent,"%"]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-slate-500",children:"Latest Score"}),e.jsx("p",{className:"text-slate-800 font-bold",children:s.headline})]})]}),s.latestRiskLevel&&e.jsxs("div",{className:`px-4 py-2 rounded-full text-sm font-semibold flex items-center gap-2
13
- ${s.latestRiskLevel==="At Risk"?"bg-red-100 text-red-700":s.latestRiskLevel==="Needs Attention"?"bg-amber-100 text-amber-700":"bg-emerald-100 text-emerald-700"}`,children:[s.latestRiskLevel==="At Risk"?e.jsx(ee,{className:"w-4 h-4"}):s.latestRiskLevel==="Needs Attention"?e.jsx(z,{className:"w-4 h-4"}):e.jsx(U,{className:"w-4 h-4"}),s.latestRiskLevel]})]}),e.jsx("div",{className:"bg-slate-50 p-5 rounded-2xl border border-slate-100",children:e.jsx("p",{className:"text-slate-700 leading-relaxed",children:s.summary})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.strengths?.length>0&&e.jsxs("div",{className:"border border-emerald-100 bg-emerald-50/30 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-semibold text-emerald-800 mb-3 flex items-center gap-2",children:[e.jsx(v,{className:"w-4 h-4"}),"Strengths"]}),e.jsx("ul",{className:"space-y-2",children:s.strengths.map((t,a)=>e.jsxs("li",{className:"text-sm text-emerald-700 flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 mt-1.5 flex-shrink-0"}),e.jsx("span",{children:t})]},a))})]}),s.weaknesses?.length>0&&e.jsxs("div",{className:"border border-amber-100 bg-amber-50/30 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-semibold text-amber-800 mb-3 flex items-center gap-2",children:[e.jsx(A,{className:"w-4 h-4"}),"Focus Areas"]}),e.jsx("ul",{className:"space-y-2",children:s.weaknesses.map((t,a)=>e.jsxs("li",{className:"text-sm text-amber-700 flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 mt-1.5 flex-shrink-0"}),e.jsx("span",{children:t})]},a))})]})]}),s.recommendation&&e.jsxs("div",{className:"bg-gradient-to-br from-indigo-50 to-purple-50 rounded-xl p-5 border border-indigo-100",children:[e.jsxs("h4",{className:"font-semibold text-indigo-900 mb-2 flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4 text-indigo-500"}),"Recommended Next Step"]}),e.jsx("p",{className:"text-sm text-indigo-800 leading-relaxed",children:s.recommendation})]})]}),ie=({heroBannerSummary:s,latestResult:t,loading:a})=>a?e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-32 bg-slate-200 rounded-xl"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-slate-200 rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-slate-200 rounded w-1/2"}),e.jsx("div",{className:"h-4 bg-slate-200 rounded w-5/6"})]})]}):!s&&!t?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-16 h-16 bg-sky-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(u,{className:"w-8 h-8 text-sky-500"})}),e.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-2",children:"Let's personalize your learning"}),e.jsx("p",{className:"text-sm text-slate-500 max-w-xs mx-auto",children:"Complete your diagnostic assessment so I can understand your strengths, weak areas, and the best next lessons for you."})]}):s?.status==="ready"?e.jsx(oe,{summary:s}):t?e.jsx(le,{result:t}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-16 h-16 bg-amber-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(z,{className:"w-8 h-8 text-amber-500"})}),e.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-2",children:"Your learning summary is being prepared"}),e.jsx("p",{className:"text-sm text-slate-500 max-w-xs mx-auto",children:"Please try opening this again in a moment."})]}),ne=({isOpen:s,onClose:t,studentId:a,latestResult:i,heroBannerSummary:n})=>{const[r,d]=o.useState("latest"),[f,c]=o.useState(i||null),[m,j]=o.useState([]),[b,g]=o.useState(!1),[x,N]=o.useState(null);o.useEffect(()=>{if(s&&a&&!n){const l=k(a,h=>{N(h)});return()=>l()}},[s,a,n]);const H=n||x;o.useEffect(()=>{s&&a&&(g(!0),Promise.all([i?Promise.resolve(i):ae(a),te(a)]).then(([l,h])=>{c(l),j(h)}).catch(console.error).finally(()=>g(!1)))},[s,a,i]);const B=[{key:"latest",label:"Last Results",icon:e.jsx(P,{className:"w-4 h-4"})},{key:"history",label:"History & Trends",icon:e.jsx(v,{className:"w-4 h-4"})}];return e.jsx(V,{open:s,onOpenChange:l=>!l&&t(),children:e.jsxs(Q,{className:"max-w-2xl max-h-[85vh] overflow-y-auto p-0 bg-white rounded-2xl shadow-2xl border-0",children:[e.jsxs("div",{className:"sticky top-0 z-10 bg-white border-b border-slate-200 rounded-t-2xl px-6 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h2",{className:"text-xl font-bold text-slate-800",children:"Assessment Results"}),e.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-slate-100 transition-colors",children:e.jsx(K,{className:"w-5 h-5 text-slate-400"})})]}),e.jsx("div",{className:"flex gap-1 bg-slate-100 p-1 rounded-lg",children:B.map(l=>e.jsxs("button",{onClick:()=>d(l.key),className:`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-all ${r===l.key?"bg-white text-sky-600 shadow-sm":"text-slate-600 hover:text-slate-800"}`,children:[l.icon,l.label]},l.key))})]}),e.jsx("div",{className:"px-6 py-5",children:e.jsxs(M,{mode:"wait",children:[r==="latest"&&e.jsx(p.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},children:e.jsx(ie,{heroBannerSummary:H,latestResult:f,loading:b})},"latest"),r==="history"&&e.jsxs(p.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},children:[e.jsx(se,{history:m}),m.length>0&&e.jsxs("div",{className:"mt-6 space-y-2",children:[e.jsx("h3",{className:"font-semibold text-slate-800 mb-3",children:"All Attempts"}),m.map((l,h)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded-lg",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-slate-700",children:["Attempt ",m.length-h]}),e.jsx("p",{className:"text-xs text-slate-500",children:new Date(l.completedAt).toLocaleDateString()})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-sm font-semibold text-sky-600",children:[l.percentage,"%"]}),e.jsx("p",{className:"text-xs text-slate-500",children:l.proficiencyLevel})]})]},h))]})]},"history")]})})]})})},de=o.lazy(()=>E(()=>import("./DashboardAvatar-CbAKGmA6.js"),__vite__mapDeps([0,1,2]))),Ae=({userName:s="Student",userLevel:t=1,avatarLayers:a,onContinueLearning:i,showAssessmentTooltip:n,onOpenAssessment:r,studentId:d,assessmentCompleted:f=!1})=>{const[c,m]=o.useState(!1),[j,b]=o.useState(null);o.useEffect(()=>{if(!c||!d)return;const x=k(d,N=>{b(N)});return()=>x()},[c,d]),o.useEffect(()=>{c||b(null)},[c]);const g=()=>{const x=new Date().getHours();return x<12?"Good Morning":x<18?"Good Afternoon":"Good Evening"};return e.jsxs(p.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,ease:[.22,1,.36,1]},className:"relative w-full mt-0 rounded-[2rem] p-6 lg:p-8 bg-gradient-to-br from-white via-sky-50/50 to-white border border-slate-200/80 card-elevated-lg",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-[2rem] pointer-events-none",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-sky-400/50 to-transparent"}),e.jsx("div",{className:"absolute top-0 right-0 w-96 h-96 bg-sky-100/40 rounded-full blur-3xl -translate-y-1/2 translate-x-1/4"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-64 h-64 bg-rose-100/30 rounded-full blur-3xl translate-y-1/2 -translate-x-1/4"}),e.jsx("div",{className:"absolute inset-0 bg-dot-pattern opacity-40"})]}),e.jsx("div",{className:"relative z-10 flex min-h-[140px] lg:min-h-[160px] items-center justify-between gap-6 pb-0",children:e.jsxs("div",{className:"flex-1 min-w-0 pr-40 lg:pr-[280px] py-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"px-3 md:px-4 py-1.5 rounded-full bg-sky-100 border border-sky-200",children:e.jsxs("span",{className:"text-xs md:text-sm font-body font-bold text-sky-700",children:["Level ",t]})}),e.jsxs("div",{className:"px-3 md:px-4 py-1.5 rounded-full bg-rose-50 border border-rose-200",children:[e.jsx(T,{size:14,className:"inline -mt-0.5 text-rose-500 mr-1"}),e.jsx("span",{className:"text-xs md:text-sm font-body font-bold text-rose-700",children:"Active"})]})]}),e.jsxs("h1",{className:"text-xl md:text-2xl lg:text-3xl font-display font-black text-[#0a1628] mb-1.5 tracking-tight leading-[1.1]",children:[g(),", ",s,"! ",e.jsx(J,{size:20,className:"inline -mt-1 ml-1"})]}),e.jsx("p",{className:"text-slate-500 mb-1 text-xs md:text-sm font-body font-bold",children:"Today is a great day to move one step forward in math mastery."}),e.jsx("p",{className:"text-[11px] md:text-xs text-slate-400 font-body mb-4",children:"Focus on your next recommended lesson and keep your momentum."}),e.jsxs(p.button,{onClick:i,whileHover:{scale:1.03},whileTap:{scale:.97},className:"mt-2 bg-gradient-to-r from-purple-600 to-[#9956DE] text-white px-5 py-2 rounded-xl font-body font-bold text-sm shadow-lg shadow-purple-500/20 hover:shadow-purple-500/30 transition-all flex items-center gap-2 group",children:["Continue Learning",e.jsx(_,{size:14,className:"group-hover:translate-x-1 transition-transform"})]})]})}),n&&e.jsx(p.div,{initial:{opacity:0,scale:.9,x:10},animate:{opacity:1,scale:1,x:0},transition:{delay:.5,type:"spring"},onClick:r,className:"absolute hidden md:block right-[150px] lg:right-[250px] bottom-16 lg:bottom-20 z-30 cursor-pointer drop-shadow-lg group",children:e.jsxs("div",{className:"bg-white px-4 py-3 rounded-2xl rounded-br-sm border-2 border-amber-300 relative transition-all group-hover:bg-amber-50 group-hover:border-amber-400 group-hover:-translate-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-amber-500",children:e.jsx(u,{size:16})}),e.jsxs("p",{className:"text-xs lg:text-sm font-bold text-amber-900 leading-tight",children:["Don't forget to take the",e.jsx("br",{}),"Initial Assessment!"]})]}),e.jsx("div",{className:"absolute -right-2 bottom-0 w-4 h-4 bg-white border-2 border-transparent border-r-amber-300 border-b-amber-300 rotate-45 group-hover:bg-amber-50 group-hover:border-r-amber-400 group-hover:border-b-amber-400 transition-colors"})]})}),f&&!n&&e.jsx(p.div,{initial:{opacity:0,scale:.9,x:10},animate:{opacity:1,scale:1,x:0},transition:{delay:.5,type:"spring"},onClick:()=>d&&m(!0),className:"absolute hidden md:block right-[150px] lg:right-[250px] bottom-16 lg:bottom-20 z-30 cursor-pointer drop-shadow-lg group",children:e.jsxs("div",{className:"bg-white px-4 py-3 rounded-2xl rounded-br-sm border-2 border-teal-300 relative transition-all group-hover:bg-teal-50 group-hover:border-teal-400 group-hover:-translate-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 bg-teal-100 rounded-full flex items-center justify-center shrink-0",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"text-teal-600",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}),e.jsxs("p",{className:"text-xs lg:text-sm font-bold text-teal-900 leading-tight",children:["Assessment Complete!",e.jsx("br",{}),e.jsx("span",{className:"text-[10px] lg:text-[11px] font-normal text-teal-700",children:"View results & history"})]})]}),e.jsx("div",{className:"absolute -right-2 bottom-0 w-4 h-4 bg-white border-2 border-transparent border-r-teal-300 border-b-teal-300 rotate-45 group-hover:bg-teal-50 group-hover:border-r-teal-400 group-hover:border-b-teal-400 transition-colors"})]})}),c&&d&&e.jsx(ne,{isOpen:c,onClose:()=>m(!1),studentId:d,heroBannerSummary:j}),e.jsx("div",{className:"hidden md:block absolute right-0 lg:right-10 bottom-0 w-[150px] lg:w-[270px] pointer-events-none z-20",style:{clipPath:"inset(-100% -50% 0 -50%)"},children:e.jsx("div",{className:"relative w-full aspect-[4/5] translate-y-[21%] lg:translate-y-[19%] drop-shadow-2xl",children:e.jsx(o.Suspense,{fallback:e.jsx("div",{className:"w-full h-full scale-[1.25] lg:scale-[1.3] origin-bottom"}),children:e.jsx(de,{layers:a,className:"w-full h-full scale-[1.25] lg:scale-[1.3] origin-bottom"})})})})]})};export{Ae as default};
 
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardAvatar-CbAKGmA6.js","assets/vendor-react-B4AQeu28.js","assets/avatarData-BuQSOXo3.js"])))=>i.map(i=>d[i]);
2
+ import{e as y,T as v,h as w,W as k,g as M,m as p,A as P,B as u,q as A,Z as T,b as _,_ as E}from"./index-uASBzalf.js";import{j as e,r as o}from"./vendor-react-B4AQeu28.js";import{D as V,a as $}from"./dialog-CNHSYTtM.js";import{R as Q,L as q,C as G,X as W,Y,T as X,d as F}from"./vendor-charts-Ckgeb0nY.js";import{collection as S,query as C,limit as L,orderBy as R,getDocs as D}from"./vendor-firebase-firestore-CP9q7ISf.js";import{X as K}from"./x-CBb03rh3.js";import{C as z}from"./circle-alert-DDOZHhZK.js";import{C as U}from"./circle-check-C5Psopk3.js";import{S as Z}from"./sparkles-DHVr5IP1.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-markdown-yqZQ_iQm.js";/**
3
  * @license lucide-react v0.487.0 - ISC
4
  *
5
  * This source code is licensed under the ISC license.
 
9
  *
10
  * This source code is licensed under the ISC license.
11
  * See the LICENSE file in the root directory of this source tree.
12
+ */const I=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],ee=y("shield-alert",I),se=({history:s})=>{if(s.length===0)return e.jsxs("div",{className:"text-center py-12 text-slate-400",children:[e.jsx(v,{className:"w-12 h-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:"Complete more assessments to see your progress history."})]});const t=s.map(a=>({date:new Date(a.completedAt).toLocaleDateString("en-US",{month:"short",day:"numeric"}),score:a.percentage,level:a.proficiencyLevel}));return e.jsx("div",{className:"w-full",children:e.jsx(Q,{width:"100%",height:250,children:e.jsxs(q,{data:t,margin:{top:10,right:20,left:0,bottom:5},children:[e.jsx(G,{strokeDasharray:"3 3",stroke:"#e2e8f0"}),e.jsx(W,{dataKey:"date",tick:{fontSize:12,fill:"#64748b"}}),e.jsx(Y,{domain:[0,100],tick:{fontSize:12,fill:"#64748b"}}),e.jsx(X,{contentStyle:{borderRadius:"12px",border:"1px solid #e2e8f0",boxShadow:"0 4px 12px rgba(0,0,0,0.08)"}}),e.jsx(F,{type:"monotone",dataKey:"score",stroke:"#0ea5e9",strokeWidth:3,dot:{fill:"#0ea5e9",strokeWidth:2,r:5},activeDot:{r:7,fill:"#0284c7"}})]})})})};async function te(s){const t=S(w,"assessmentResults",s,"attempts"),a=C(t,R("completedAt","desc"),L(10));return(await D(a)).docs.map(n=>{const r=n.data();return{attemptId:r.attemptId,score:r.score,totalQuestions:r.totalQuestions,percentage:r.percentage,completedAt:r.completedAt?.toDate?.()?.toISOString()||r.completedAt,proficiencyLevel:r.proficiencyLevel}})}async function ae(s){const t=S(w,"assessmentResults",s,"attempts"),a=C(t,R("completedAt","desc"),L(1)),i=await D(a);if(i.empty)return null;const r=i.docs[0].data();return{...r,completedAt:r.completedAt?.toDate?.()?.toISOString()||r.completedAt}}const re={Beginner:"bg-amber-100 text-amber-700 border-amber-300",Developing:"bg-blue-100 text-blue-700 border-blue-300",Proficient:"bg-emerald-100 text-emerald-700 border-emerald-300",Advanced:"bg-violet-100 text-violet-700 border-violet-300"},le=({result:s})=>e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-gradient-to-br from-sky-500 to-teal-600 rounded-xl p-6 text-white",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sky-200 text-sm font-medium",children:"Total Score"}),e.jsxs("p",{className:"text-4xl font-bold",children:[s.score,"/",s.totalQuestions]}),e.jsxs("p",{className:"text-sky-200 text-sm mt-1",children:[s.percentage,"% Correct"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sky-200 text-sm font-medium",children:"Proficiency"}),e.jsx("span",{className:`inline-block mt-1 px-3 py-1 rounded-full text-sm font-semibold border ${re[s.proficiencyLevel]}`,children:s.proficiencyLevel})]})]})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-semibold text-slate-800 mb-3 flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4 text-sky-500"}),"Competency Breakdown"]}),e.jsx("div",{className:"space-y-2",children:s.competencyBreakdown.map((t,a)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-slate-700",children:t.topic}),e.jsxs("p",{className:"text-xs text-slate-500",children:[t.correctAnswers,"/",t.totalQuestions," correct"]})]}),e.jsx("div",{className:"w-20 h-2 bg-slate-200 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full ${t.accuracyPercent>=70?"bg-emerald-500":"bg-red-400"}`,style:{width:`${t.accuracyPercent}%`}})}),e.jsxs("span",{className:"text-sm font-semibold text-slate-600 w-10 text-right",children:[t.accuracyPercent,"%"]})]},a))})]}),s.aiNarrative&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Z,{className:"w-4 h-4 text-amber-500 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-amber-800 leading-relaxed",children:s.aiNarrative})]})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-semibold text-slate-800 mb-3 flex items-center gap-2",children:[e.jsx(A,{className:"w-4 h-4 text-sky-500"}),"Question Breakdown"]}),e.jsx("div",{className:"space-y-3",children:s.answers.map((t,a)=>e.jsxs("div",{className:`p-4 rounded-xl border-2 ${t.isCorrect?"border-emerald-200 bg-emerald-50/30":"border-red-200 bg-red-50/30"}`,children:[e.jsxs("p",{className:"text-sm font-medium text-slate-800 mb-2",children:["Q",a+1,". ",t.questionText]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("span",{className:"text-slate-500",children:["Your answer: ",e.jsx("span",{className:t.isCorrect?"text-emerald-600 font-medium":"text-red-500 font-medium",children:t.userAnswer||"β€”"})]}),!t.isCorrect&&e.jsxs("span",{className:"text-slate-500",children:["Correct: ",e.jsx("span",{className:"text-emerald-600 font-medium",children:t.correctAnswer})]})]}),t.explanation&&e.jsx("p",{className:"text-xs text-slate-500 mt-2 leading-relaxed",children:t.explanation})]},a))})]})]}),oe=({summary:s})=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[e.jsxs("div",{className:"bg-sky-50 border border-sky-100 rounded-2xl p-4 flex items-center gap-4 flex-1",children:[e.jsxs("div",{className:"w-12 h-12 bg-sky-500 rounded-full flex items-center justify-center text-white font-bold text-lg shadow-sm",children:[s.latestScorePercent,"%"]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-slate-500",children:"Latest Score"}),e.jsx("p",{className:"text-slate-800 font-bold",children:s.headline})]})]}),s.latestRiskLevel&&e.jsxs("div",{className:`px-4 py-2 rounded-full text-sm font-semibold flex items-center gap-2
13
+ ${s.latestRiskLevel==="At Risk"?"bg-red-100 text-red-700":s.latestRiskLevel==="Needs Attention"?"bg-amber-100 text-amber-700":"bg-emerald-100 text-emerald-700"}`,children:[s.latestRiskLevel==="At Risk"?e.jsx(ee,{className:"w-4 h-4"}):s.latestRiskLevel==="Needs Attention"?e.jsx(z,{className:"w-4 h-4"}):e.jsx(U,{className:"w-4 h-4"}),s.latestRiskLevel]})]}),e.jsx("div",{className:"bg-slate-50 p-5 rounded-2xl border border-slate-100",children:e.jsx("p",{className:"text-slate-700 leading-relaxed",children:s.summary})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.strengths?.length>0&&e.jsxs("div",{className:"border border-emerald-100 bg-emerald-50/30 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-semibold text-emerald-800 mb-3 flex items-center gap-2",children:[e.jsx(v,{className:"w-4 h-4"}),"Strengths"]}),e.jsx("ul",{className:"space-y-2",children:s.strengths.map((t,a)=>e.jsxs("li",{className:"text-sm text-emerald-700 flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 mt-1.5 flex-shrink-0"}),e.jsx("span",{children:t})]},a))})]}),s.weaknesses?.length>0&&e.jsxs("div",{className:"border border-amber-100 bg-amber-50/30 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-semibold text-amber-800 mb-3 flex items-center gap-2",children:[e.jsx(A,{className:"w-4 h-4"}),"Focus Areas"]}),e.jsx("ul",{className:"space-y-2",children:s.weaknesses.map((t,a)=>e.jsxs("li",{className:"text-sm text-amber-700 flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 mt-1.5 flex-shrink-0"}),e.jsx("span",{children:t})]},a))})]})]}),s.recommendation&&e.jsxs("div",{className:"bg-gradient-to-br from-indigo-50 to-purple-50 rounded-xl p-5 border border-indigo-100",children:[e.jsxs("h4",{className:"font-semibold text-indigo-900 mb-2 flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4 text-indigo-500"}),"Recommended Next Step"]}),e.jsx("p",{className:"text-sm text-indigo-800 leading-relaxed",children:s.recommendation})]})]}),ie=({heroBannerSummary:s,latestResult:t,loading:a})=>a?e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-32 bg-slate-200 rounded-xl"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-slate-200 rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-slate-200 rounded w-1/2"}),e.jsx("div",{className:"h-4 bg-slate-200 rounded w-5/6"})]})]}):!s&&!t?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-16 h-16 bg-sky-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(u,{className:"w-8 h-8 text-sky-500"})}),e.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-2",children:"Let's personalize your learning"}),e.jsx("p",{className:"text-sm text-slate-500 max-w-xs mx-auto",children:"Complete your diagnostic assessment so I can understand your strengths, weak areas, and the best next lessons for you."})]}):s?.status==="ready"?e.jsx(oe,{summary:s}):t?e.jsx(le,{result:t}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-16 h-16 bg-amber-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(z,{className:"w-8 h-8 text-amber-500"})}),e.jsx("h3",{className:"text-lg font-bold text-slate-800 mb-2",children:"Your learning summary is being prepared"}),e.jsx("p",{className:"text-sm text-slate-500 max-w-xs mx-auto",children:"Please try opening this again in a moment."})]}),ne=({isOpen:s,onClose:t,studentId:a,latestResult:i,heroBannerSummary:n})=>{const[r,d]=o.useState("latest"),[f,c]=o.useState(i||null),[m,j]=o.useState([]),[b,g]=o.useState(!1),[x,N]=o.useState(null);o.useEffect(()=>{if(s&&a&&!n){const l=k(a,h=>{N(h)});return()=>l()}},[s,a,n]);const H=n||x;o.useEffect(()=>{s&&a&&(g(!0),Promise.all([i?Promise.resolve(i):ae(a),te(a)]).then(([l,h])=>{c(l),j(h)}).catch(console.error).finally(()=>g(!1)))},[s,a,i]);const B=[{key:"latest",label:"Last Results",icon:e.jsx(P,{className:"w-4 h-4"})},{key:"history",label:"History & Trends",icon:e.jsx(v,{className:"w-4 h-4"})}];return e.jsx(V,{open:s,onOpenChange:l=>!l&&t(),children:e.jsxs($,{className:"max-w-2xl max-h-[85vh] overflow-y-auto p-0 bg-white rounded-2xl shadow-2xl border-0",children:[e.jsxs("div",{className:"sticky top-0 z-10 bg-white border-b border-slate-200 rounded-t-2xl px-6 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h2",{className:"text-xl font-bold text-slate-800",children:"Assessment Results"}),e.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-slate-100 transition-colors",children:e.jsx(K,{className:"w-5 h-5 text-slate-400"})})]}),e.jsx("div",{className:"flex gap-1 bg-slate-100 p-1 rounded-lg",children:B.map(l=>e.jsxs("button",{onClick:()=>d(l.key),className:`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-all ${r===l.key?"bg-white text-sky-600 shadow-sm":"text-slate-600 hover:text-slate-800"}`,children:[l.icon,l.label]},l.key))})]}),e.jsx("div",{className:"px-6 py-5",children:e.jsxs(M,{mode:"wait",children:[r==="latest"&&e.jsx(p.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},children:e.jsx(ie,{heroBannerSummary:H,latestResult:f,loading:b})},"latest"),r==="history"&&e.jsxs(p.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},children:[e.jsx(se,{history:m}),m.length>0&&e.jsxs("div",{className:"mt-6 space-y-2",children:[e.jsx("h3",{className:"font-semibold text-slate-800 mb-3",children:"All Attempts"}),m.map((l,h)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded-lg",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-slate-700",children:["Attempt ",m.length-h]}),e.jsx("p",{className:"text-xs text-slate-500",children:new Date(l.completedAt).toLocaleDateString()})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-sm font-semibold text-sky-600",children:[l.percentage,"%"]}),e.jsx("p",{className:"text-xs text-slate-500",children:l.proficiencyLevel})]})]},h))]})]},"history")]})})]})})},de=o.lazy(()=>E(()=>import("./DashboardAvatar-CbAKGmA6.js"),__vite__mapDeps([0,1,2]))),Ae=({userName:s="Student",userLevel:t=1,avatarLayers:a,onContinueLearning:i,showAssessmentTooltip:n,onOpenAssessment:r,studentId:d,assessmentCompleted:f=!1})=>{const[c,m]=o.useState(!1),[j,b]=o.useState(null);o.useEffect(()=>{if(!c||!d)return;const x=k(d,N=>{b(N)});return()=>x()},[c,d]),o.useEffect(()=>{c||b(null)},[c]);const g=()=>{const x=new Date().getHours();return x<12?"Good Morning":x<18?"Good Afternoon":"Good Evening"};return e.jsxs(p.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,ease:[.22,1,.36,1]},className:"relative w-full mt-0 rounded-[2rem] p-6 lg:p-8 bg-gradient-to-br from-white via-sky-50/50 to-white border border-slate-200/80 card-elevated-lg",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-[2rem] pointer-events-none",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-sky-400/50 to-transparent"}),e.jsx("div",{className:"absolute top-0 right-0 w-96 h-96 bg-sky-100/40 rounded-full blur-3xl -translate-y-1/2 translate-x-1/4"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-64 h-64 bg-rose-100/30 rounded-full blur-3xl translate-y-1/2 -translate-x-1/4"}),e.jsx("div",{className:"absolute inset-0 bg-dot-pattern opacity-40"})]}),e.jsx("div",{className:"relative z-10 flex min-h-[140px] lg:min-h-[160px] items-center justify-between gap-6 pb-0",children:e.jsxs("div",{className:"flex-1 min-w-0 pr-40 lg:pr-[280px] py-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"px-3 md:px-4 py-1.5 rounded-full bg-sky-100 border border-sky-200",children:e.jsxs("span",{className:"text-xs md:text-sm font-body font-bold text-sky-700",children:["Level ",t]})}),e.jsxs("div",{className:"px-3 md:px-4 py-1.5 rounded-full bg-rose-50 border border-rose-200",children:[e.jsx(T,{size:14,className:"inline -mt-0.5 text-rose-500 mr-1"}),e.jsx("span",{className:"text-xs md:text-sm font-body font-bold text-rose-700",children:"Active"})]})]}),e.jsxs("h1",{className:"text-xl md:text-2xl lg:text-3xl font-display font-black text-[#0a1628] mb-1.5 tracking-tight leading-[1.1]",children:[g(),", ",s,"! ",e.jsx(J,{size:20,className:"inline -mt-1 ml-1"})]}),e.jsx("p",{className:"text-slate-500 mb-1 text-xs md:text-sm font-body font-bold",children:"Today is a great day to move one step forward in math mastery."}),e.jsx("p",{className:"text-[11px] md:text-xs text-slate-400 font-body mb-4",children:"Focus on your next recommended lesson and keep your momentum."}),e.jsxs(p.button,{onClick:i,whileHover:{scale:1.03},whileTap:{scale:.97},className:"mt-2 bg-gradient-to-r from-purple-600 to-[#9956DE] text-white px-5 py-2 rounded-xl font-body font-bold text-sm shadow-lg shadow-purple-500/20 hover:shadow-purple-500/30 transition-all flex items-center gap-2 group",children:["Continue Learning",e.jsx(_,{size:14,className:"group-hover:translate-x-1 transition-transform"})]})]})}),n&&e.jsx(p.div,{initial:{opacity:0,scale:.9,x:10},animate:{opacity:1,scale:1,x:0},transition:{delay:.5,type:"spring"},onClick:r,className:"absolute hidden md:block right-[150px] lg:right-[250px] bottom-16 lg:bottom-20 z-30 cursor-pointer drop-shadow-lg group",children:e.jsxs("div",{className:"bg-white px-4 py-3 rounded-2xl rounded-br-sm border-2 border-amber-300 relative transition-all group-hover:bg-amber-50 group-hover:border-amber-400 group-hover:-translate-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-amber-500",children:e.jsx(u,{size:16})}),e.jsxs("p",{className:"text-xs lg:text-sm font-bold text-amber-900 leading-tight",children:["Don't forget to take the",e.jsx("br",{}),"Initial Assessment!"]})]}),e.jsx("div",{className:"absolute -right-2 bottom-0 w-4 h-4 bg-white border-2 border-transparent border-r-amber-300 border-b-amber-300 rotate-45 group-hover:bg-amber-50 group-hover:border-r-amber-400 group-hover:border-b-amber-400 transition-colors"})]})}),f&&!n&&e.jsx(p.div,{initial:{opacity:0,scale:.9,x:10},animate:{opacity:1,scale:1,x:0},transition:{delay:.5,type:"spring"},onClick:()=>d&&m(!0),className:"absolute hidden md:block right-[150px] lg:right-[250px] bottom-16 lg:bottom-20 z-30 cursor-pointer drop-shadow-lg group",children:e.jsxs("div",{className:"bg-white px-4 py-3 rounded-2xl rounded-br-sm border-2 border-teal-300 relative transition-all group-hover:bg-teal-50 group-hover:border-teal-400 group-hover:-translate-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 bg-teal-100 rounded-full flex items-center justify-center shrink-0",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"text-teal-600",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}),e.jsxs("p",{className:"text-xs lg:text-sm font-bold text-teal-900 leading-tight",children:["Assessment Complete!",e.jsx("br",{}),e.jsx("span",{className:"text-[10px] lg:text-[11px] font-normal text-teal-700",children:"View results & history"})]})]}),e.jsx("div",{className:"absolute -right-2 bottom-0 w-4 h-4 bg-white border-2 border-transparent border-r-teal-300 border-b-teal-300 rotate-45 group-hover:bg-teal-50 group-hover:border-r-teal-400 group-hover:border-b-teal-400 transition-colors"})]})}),c&&d&&e.jsx(ne,{isOpen:c,onClose:()=>m(!1),studentId:d,heroBannerSummary:j}),e.jsx("div",{className:"hidden md:block absolute right-0 lg:right-10 bottom-0 w-[150px] lg:w-[270px] pointer-events-none z-20",style:{clipPath:"inset(-100% -50% 0 -50%)"},children:e.jsx("div",{className:"relative w-full aspect-[4/5] translate-y-[21%] lg:translate-y-[19%] drop-shadow-2xl",children:e.jsx(o.Suspense,{fallback:e.jsx("div",{className:"w-full h-full scale-[1.25] lg:scale-[1.3] origin-bottom"}),children:e.jsx(de,{layers:a,className:"w-full h-full scale-[1.25] lg:scale-[1.3] origin-bottom"})})})})]})};export{Ae as default};
assets/{InitialAssessmentModal-CknVaqMx.js β†’ InitialAssessmentModal-D5CEKMhd.js} RENAMED
@@ -1 +1 @@
1
- import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{B as j}from"./button-DCfeFHoH.js";import{g as y}from"./diagnosticService-BDYTUoqk.js";import{updateDoc as N,doc as v,serverTimestamp as w}from"./vendor-firebase-firestore-CH1lNiRF.js";import{m as o,B as k,p as C,l as L,f as z}from"./index-BaOs5Ayg.js";import{X as S}from"./x-TNvtuOD9.js";import{C as A}from"./circle-check-big-m1SvzGFL.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-markdown-yqZQ_iQm.js";const H=({isOpen:n,onClose:d,onDismiss:m,userId:c,strand:x,gradeLevel:p,onAssessmentStart:u,onAssessmentComplete:I})=>{const[t,a]=l.useState(!1),[r,i]=l.useState(null),h=async()=>{a(!0),i(null);try{const s=await y(x,p);sessionStorage.setItem("mathpulse_diagnostic",JSON.stringify({testId:s.test_id,questions:s.questions,totalItems:s.total_items,estimatedMinutes:s.estimated_minutes})),u(s.test_id,s.questions)}catch(s){const b=s instanceof Error?s.message:"Failed to load assessment";i(b),a(!1)}},f=()=>{sessionStorage.setItem("mathpulse_iar_session_dismissed","true"),d()},g=async()=>{try{await N(v(z,"users",c),{assessmentDismissed:!0,assessmentDismissedAt:w()})}catch(s){console.error("[diagnostic] Failed to save dismiss state:",s)}m()};return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:s=>s.stopPropagation(),children:e.jsxs(o.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{type:"spring",damping:25,stiffness:200},className:"bg-white rounded-2xl shadow-2xl max-w-[36rem] w-full flex flex-col overflow-hidden pointer-events-auto",onClick:s=>s.stopPropagation(),style:{willChange:"transform, opacity"},children:[e.jsxs("div",{className:"px-5 py-3 border-b border-[#dde3eb] flex items-center justify-between bg-[#edf1f7] flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-purple-100 rounded-lg flex items-center justify-center text-purple-600",children:e.jsx(k,{size:18})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold text-[#0a1628] leading-tight",children:"Initial Assessment"}),e.jsx("p",{className:"text-[11px] text-[#5a6578]",children:"Analyze your strengths & weaknesses"})]})]}),e.jsx("button",{onClick:f,"aria-label":"Close assessment modal",className:"ml-auto w-8 h-8 rounded-lg flex items-center justify-center text-[#5a6578] hover:bg-[#dde3eb] hover:text-[#0a1628] transition-colors",children:e.jsx(S,{size:18})})]}),e.jsx("div",{className:"p-5 text-center space-y-3",children:e.jsxs(o.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.3,ease:"easeOut"},children:[e.jsx("div",{className:"w-20 h-20 bg-purple-50 rounded-full flex items-center justify-center mx-auto mb-3",children:e.jsx("svg",{className:"w-9 h-9 text-purple-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"})})}),e.jsx("h3",{className:"text-lg font-bold text-[#0a1628]",children:"Welcome to MathPulse AI!"}),e.jsx("p",{className:"text-[13px] text-[#5a6578] max-w-[19rem] mx-auto leading-relaxed",children:"To personalize your learning path, complete a DepEd competency-based SHS diagnostic (15 items, around 11.6 minutes)."}),e.jsxs("div",{className:"grid grid-cols-2 gap-2.5 max-w-[22rem] mx-auto text-left mt-4",children:[e.jsxs("div",{className:"bg-[#edf1f7] p-2.5 rounded-lg border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-[13px] text-[#0a1628] mb-1",children:[e.jsx(A,{size:14,className:"text-teal-500"}),"Personalized Path"]}),e.jsx("p",{className:"text-[10px] text-[#5a6578] pl-[18px]",children:"Get recommendations based on your level."})]}),e.jsxs("div",{className:"bg-[#edf1f7] p-2.5 rounded-lg border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-[13px] text-[#0a1628] mb-1",children:[e.jsx(C,{size:14,className:"text-rose-500"}),"Identify Risks"]}),e.jsx("p",{className:"text-[10px] text-[#5a6578] pl-[18px]",children:"Spot areas that need more attention early."})]})]}),r&&e.jsx("div",{className:"mt-3 p-2.5 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("p",{className:"text-xs text-red-700",children:r})}),e.jsxs("div",{className:"pt-3 space-y-2.5",children:[e.jsx(j,{onClick:h,disabled:t,className:"bg-gradient-to-r from-purple-600 to-purple-500 hover:from-purple-700 hover:to-purple-600 text-white px-5 py-3 rounded-xl text-sm font-bold shadow-lg shadow-purple-200 w-full max-w-[320px] mx-auto",children:t?e.jsxs(e.Fragment,{children:[e.jsx(L,{size:16,className:"animate-spin mr-2"}),"Crafting your assessment..."]}):"Start Assessment"}),t&&e.jsx("p",{className:"text-[10px] text-slate-400 max-w-[18rem] mx-auto text-center leading-relaxed",children:"This may take up to 90 seconds while AI generates your personalized test."}),!t&&e.jsx("button",{onClick:g,disabled:t,className:"block mx-auto text-xs text-slate-500 hover:text-[#5a6578] transition-colors font-medium disabled:opacity-40",children:"Skip for now"})]})]})})]})}):null};export{H as default};
 
1
+ import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{B as j}from"./button-BPmLcOpC.js";import{g as y}from"./diagnosticService-DacNtsbN.js";import{updateDoc as N,doc as v,serverTimestamp as w}from"./vendor-firebase-firestore-CP9q7ISf.js";import{m as o,B as k,w as C,p as L,h as z}from"./index-uASBzalf.js";import{X as S}from"./x-CBb03rh3.js";import{C as A}from"./circle-check-big-BNRlH5pv.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-markdown-yqZQ_iQm.js";const H=({isOpen:n,onClose:d,onDismiss:m,userId:c,strand:x,gradeLevel:p,onAssessmentStart:u,onAssessmentComplete:I})=>{const[t,a]=l.useState(!1),[r,i]=l.useState(null),h=async()=>{a(!0),i(null);try{const s=await y(x,p);sessionStorage.setItem("mathpulse_diagnostic",JSON.stringify({testId:s.test_id,questions:s.questions,totalItems:s.total_items,estimatedMinutes:s.estimated_minutes})),u(s.test_id,s.questions)}catch(s){const b=s instanceof Error?s.message:"Failed to load assessment";i(b),a(!1)}},f=()=>{sessionStorage.setItem("mathpulse_iar_session_dismissed","true"),d()},g=async()=>{try{await N(v(z,"users",c),{assessmentDismissed:!0,assessmentDismissedAt:w()})}catch(s){console.error("[diagnostic] Failed to save dismiss state:",s)}m()};return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:s=>s.stopPropagation(),children:e.jsxs(o.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{type:"spring",damping:25,stiffness:200},className:"bg-white rounded-2xl shadow-2xl max-w-[36rem] w-full flex flex-col overflow-hidden pointer-events-auto",onClick:s=>s.stopPropagation(),style:{willChange:"transform, opacity"},children:[e.jsxs("div",{className:"px-5 py-3 border-b border-[#dde3eb] flex items-center justify-between bg-[#edf1f7] flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-purple-100 rounded-lg flex items-center justify-center text-purple-600",children:e.jsx(k,{size:18})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold text-[#0a1628] leading-tight",children:"Initial Assessment"}),e.jsx("p",{className:"text-[11px] text-[#5a6578]",children:"Analyze your strengths & weaknesses"})]})]}),e.jsx("button",{onClick:f,"aria-label":"Close assessment modal",className:"ml-auto w-8 h-8 rounded-lg flex items-center justify-center text-[#5a6578] hover:bg-[#dde3eb] hover:text-[#0a1628] transition-colors",children:e.jsx(S,{size:18})})]}),e.jsx("div",{className:"p-5 text-center space-y-3",children:e.jsxs(o.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.3,ease:"easeOut"},children:[e.jsx("div",{className:"w-20 h-20 bg-purple-50 rounded-full flex items-center justify-center mx-auto mb-3",children:e.jsx("svg",{className:"w-9 h-9 text-purple-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"})})}),e.jsx("h3",{className:"text-lg font-bold text-[#0a1628]",children:"Welcome to MathPulse AI!"}),e.jsx("p",{className:"text-[13px] text-[#5a6578] max-w-[19rem] mx-auto leading-relaxed",children:"To personalize your learning path, complete a DepEd competency-based SHS diagnostic (15 items, around 11.6 minutes)."}),e.jsxs("div",{className:"grid grid-cols-2 gap-2.5 max-w-[22rem] mx-auto text-left mt-4",children:[e.jsxs("div",{className:"bg-[#edf1f7] p-2.5 rounded-lg border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-[13px] text-[#0a1628] mb-1",children:[e.jsx(A,{size:14,className:"text-teal-500"}),"Personalized Path"]}),e.jsx("p",{className:"text-[10px] text-[#5a6578] pl-[18px]",children:"Get recommendations based on your level."})]}),e.jsxs("div",{className:"bg-[#edf1f7] p-2.5 rounded-lg border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-[13px] text-[#0a1628] mb-1",children:[e.jsx(C,{size:14,className:"text-rose-500"}),"Identify Risks"]}),e.jsx("p",{className:"text-[10px] text-[#5a6578] pl-[18px]",children:"Spot areas that need more attention early."})]})]}),r&&e.jsx("div",{className:"mt-3 p-2.5 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("p",{className:"text-xs text-red-700",children:r})}),e.jsxs("div",{className:"pt-3 space-y-2.5",children:[e.jsx(j,{onClick:h,disabled:t,className:"bg-gradient-to-r from-purple-600 to-purple-500 hover:from-purple-700 hover:to-purple-600 text-white px-5 py-3 rounded-xl text-sm font-bold shadow-lg shadow-purple-200 w-full max-w-[320px] mx-auto",children:t?e.jsxs(e.Fragment,{children:[e.jsx(L,{size:16,className:"animate-spin mr-2"}),"Crafting your assessment..."]}):"Start Assessment"}),t&&e.jsx("p",{className:"text-[10px] text-slate-400 max-w-[18rem] mx-auto text-center leading-relaxed",children:"This may take up to 90 seconds while AI generates your personalized test."}),!t&&e.jsx("button",{onClick:g,disabled:t,className:"block mx-auto text-xs text-slate-500 hover:text-[#5a6578] transition-colors font-medium disabled:opacity-40",children:"Skip for now"})]})]})})]})}):null};export{H as default};
assets/{LeaderboardPage-D9eaC9ey.js β†’ LeaderboardPage-IhqEnbdk.js} RENAMED
@@ -1,8 +1,8 @@
1
- import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{e as Y,aC as W,j as H,m as c,a as y,y as P,A as k,x as m,T as E,l as z,W as X,X as U,O as q,u as $,aD as G,R as K,L as Q,r as T}from"./index-BaOs5Ayg.js";import{X as V}from"./x-TNvtuOD9.js";import{C as Z}from"./clock-D1Ecvltm.js";import{u as J}from"./useFeatureAccess-BSpfx3vY.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const ee=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],se=Y("badge-check",ee),te=({student:t,onClose:b})=>{const[i,u]=l.useState([]),[p,h]=l.useState(!1);if(l.useEffect(()=>{t?.uid&&(h(!0),W(t.uid).then(u).catch(d=>console.error("Failed to load achievements:",d)).finally(()=>h(!1)))},[t?.uid]),!t)return null;const j={trophy:e.jsx(m,{size:24,className:"text-rose-500"}),flame:e.jsx(q,{size:24,className:"text-orange-500"}),star:e.jsx(U,{size:24,className:"text-rose-400"}),"book-open":e.jsx(y,{size:24,className:"text-sky-600"}),"badge-check":e.jsx(se,{size:24,className:"text-emerald-600"}),crown:e.jsx(X,{size:24,className:"text-rose-500"}),target:e.jsx(P,{size:24,className:"text-rose-500"})};return e.jsx(H,{children:e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[e.jsx(c.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:b,className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),e.jsxs(c.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"relative bg-[#f7f9fc] rounded-2xl shadow-2xl border border-[#dde3eb] w-full max-w-2xl max-h-[90vh] overflow-hidden",children:[e.jsxs("div",{className:"bg-gradient-to-r from-sky-600 to-sky-500 p-8 text-white relative overflow-hidden",children:[e.jsx("div",{className:"accent-line absolute top-0 left-0 right-0"}),e.jsx("button",{onClick:b,className:"absolute top-4 right-4 p-2 hover:bg-slate-100 rounded-xl transition-colors z-10",children:e.jsx(V,{size:20})}),e.jsx("div",{className:"relative z-10",children:e.jsxs("div",{className:"flex items-start gap-6",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-24 h-24 bg-white/10 backdrop-blur-sm rounded-2xl flex items-center justify-center text-6xl border border-slate-300",children:t.avatar}),t.isOnline&&e.jsx("div",{className:"absolute -bottom-2 -right-2 w-6 h-6 bg-green-500 rounded-full border-4 border-white"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-3xl font-display font-bold mb-2",children:t.name}),e.jsx("p",{className:"text-slate-500 mb-4",children:t.section}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"bg-slate-100 backdrop-blur-sm rounded-xl px-4 py-2 border border-slate-200",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Level"}),e.jsx("p",{className:"text-xl font-bold",children:t.level})]}),e.jsxs("div",{className:"bg-slate-100 backdrop-blur-sm rounded-xl px-4 py-2 border border-slate-200",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Total XP"}),e.jsx("p",{className:"text-xl font-bold",children:t.totalXP})]})]})]})]})}),e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-sky-500/5 rounded-full -translate-y-1/2 translate-x-1/2"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-48 h-48 bg-rose-500/5 rounded-full translate-y-1/2 -translate-x-1/2"})]}),e.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-320px)]",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"font-display font-bold text-lg text-[#0a1628] mb-4",children:"Performance Stats"}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] p-4 text-center",children:[e.jsx(y,{size:24,className:"text-sky-600 mx-auto mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:t.stats.quizzesCompleted}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Quizzes"})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] p-4 text-center",children:[e.jsx(P,{size:24,className:"text-emerald-600 mx-auto mb-2"}),e.jsxs("p",{className:"text-2xl font-bold text-[#0a1628]",children:[t.stats.averageScore,"%"]}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Avg Score"})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] p-4 text-center",children:[e.jsx(k,{size:24,className:"text-rose-600 mx-auto mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:t.stats.modulesCompleted}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Modules"})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] p-4 text-center",children:[e.jsx(Z,{size:24,className:"text-rose-600 mx-auto mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:t.stats.studyHours}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Hours"})]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"font-display font-bold text-lg text-[#0a1628] mb-4",children:"Rankings"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded-xl p-4",children:[e.jsx(m,{size:20,className:"text-rose-600 mb-2"}),e.jsxs("p",{className:"text-2xl font-bold text-rose-900",children:["#",t.rank.global]}),e.jsx("p",{className:"text-xs text-rose-700 mt-1 font-body",children:"School"})]}),e.jsxs("div",{className:"bg-sky-50 border border-sky-200 rounded-xl p-4",children:[e.jsx(m,{size:20,className:"text-sky-600 mb-2"}),e.jsxs("p",{className:"text-2xl font-bold text-sky-900",children:["#",t.rank.section]}),e.jsx("p",{className:"text-xs text-sky-700 mt-1 font-body",children:"Section"})]}),e.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded-xl p-4",children:[e.jsx(m,{size:20,className:"text-rose-600 mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-rose-900",children:t.rank.change>0?e.jsxs("span",{className:"flex items-center gap-1 text-emerald-600",children:[e.jsx(E,{size:20}),"+",t.rank.change]}):t.rank.change<0?e.jsxs("span",{className:"flex items-center gap-1 text-red-600",children:[e.jsx(E,{size:20,className:"rotate-180"}),t.rank.change]}):"0"}),e.jsx("p",{className:"text-xs text-rose-700 mt-1 font-body",children:"This Week"})]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"font-display font-bold text-lg text-[#0a1628] mb-4",children:"Achievements"}),p?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(z,{size:24,className:"text-sky-500 animate-spin"})}):i.length>0?e.jsx("div",{className:"grid grid-cols-3 gap-3",children:i.map(d=>e.jsxs("div",{className:"rounded-xl p-4 text-center transition-all bg-white border-2 border-sky-200",children:[e.jsx("div",{className:"text-3xl mb-2",children:j[d.icon]||e.jsx(k,{size:24,className:"text-slate-500 mx-auto"})}),e.jsx("p",{className:"font-bold text-xs text-[#0a1628] mb-1 font-body",children:d.title}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:d.description})]},d.id))}):e.jsxs("div",{className:"flex flex-col items-center py-8 gap-2",children:[e.jsx(k,{size:32,className:"text-[#d1cec6]"}),e.jsx("p",{className:"text-sm text-[#5a6578] font-body",children:"No achievements unlocked yet"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-display font-bold text-lg text-[#0a1628] mb-4",children:"Recent Activity"}),e.jsxs("div",{className:"flex flex-col items-center py-8 gap-2",children:[e.jsx(y,{size:32,className:"text-[#d1cec6]"}),e.jsx("p",{className:"text-sm text-[#5a6578] font-body",children:"Activity history coming soon"})]})]})]})]})]})})},ue=({currentUserPhoto:t,onBack:b})=>{const{currentUser:i,userProfile:u}=$(),p=u,{leaderboard:h,loading:j}=J(i?.uid||null),[d]=l.useState("section"),[g,M]=l.useState("weekly"),[I,_]=l.useState(null),[D,v]=l.useState(!0),[F,C]=l.useState(null),[R,S]=l.useState([]),N=[p?.grade,p?.section].filter(Boolean).join(" - "),w=l.useCallback(async()=>{if(!i){v(!1);return}v(!0),C(null);try{const s=g==="all"?"all":"week",r=await G(i.uid,!1,s,20);if(!r||r.length===0){S([]);return}const n=r.map(a=>({id:a.userId,uid:a.userId,name:a.name,avatar:a.userId===i.uid?t||a.photo||"":a.photo||"",level:a.level,totalXP:a.xp,section:N||"Grade 11 - STEM A",rank:{global:a.rank,section:a.rank,change:0},stats:{quizzesCompleted:0,averageScore:0,modulesCompleted:0,studyHours:0},isOnline:!1,isYou:a.userId===i.uid}));S(n)}catch(s){console.error("Error loading leaderboard:",s),C(s instanceof Error?s.message:"Failed to load leaderboard")}finally{v(!1)}},[i,N,g,t]);l.useEffect(()=>{w()},[w]);const x=(()=>{let s=R;if(d==="section"){const n=N||"";n&&(s=s.filter(a=>a.section===n))}return s.sort((n,a)=>{const B=d==="section"?"section":"global";return(n.rank[B]||999)-(a.rank[B]||999)})})(),A=x.find(s=>s.isYou)?.rank.section||x.length+1,O=x.length>1?Math.max(10,Math.min(99,100-A/Math.max(1,x.length)*100)):90,o=x.slice(0,3),L=x.slice(3),f=(s,r)=>s?s.startsWith("http")||s.startsWith("data:")?e.jsx("img",{src:s,alt:"Avatar",className:"w-full h-full object-cover rounded-full"}):e.jsx(T,{size:r,className:"text-slate-400 opacity-70"}):e.jsx(T,{size:r,className:"text-slate-400 opacity-70"});return D?e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-3",children:[e.jsx(z,{className:"w-8 h-8 animate-spin text-purple-600"}),e.jsx("p",{className:"text-sm text-slate-400 font-medium",children:"Loading leaderboard..."})]}):F?e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-red-50 flex items-center justify-center",children:e.jsx(m,{className:"w-7 h-7 text-red-400"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-700 mb-1",children:"Couldn't load leaderboard"}),e.jsx("p",{className:"text-xs text-slate-400",children:F})]}),e.jsxs("button",{onClick:w,className:"flex items-center gap-2 px-4 py-2 bg-purple-600 text-white text-sm font-medium rounded-xl hover:bg-purple-700 transition-colors",children:[e.jsx(K,{size:14}),"Try Again"]})]}):j?e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-3",children:[e.jsx(z,{className:"w-8 h-8 animate-spin text-purple-600"}),e.jsx("p",{className:"text-sm text-slate-400 font-medium",children:"Loading..."})]}):h?e.jsxs("div",{className:"w-full min-h-screen relative flex flex-col items-center font-body text-white",children:[e.jsxs("div",{className:"absolute inset-x-[-30px] top-[-30px] bottom-0 z-[-1] pointer-events-none overflow-hidden bg-[#f5ecff]",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_50%_100%,#9333ea_0%,#c084fc_50%,transparent_100%)]"}),e.jsx("div",{className:"absolute inset-x-[-30px] top-[-30px] bottom-0 opacity-50 pointer-events-none mix-blend-plus-lighter overflow-hidden",children:e.jsx("div",{className:"animate-sunburst-spin absolute top-[540px] md:top-[600px] left-1/2",style:{width:"2000px",height:"2000px",marginLeft:"-1000px",marginTop:"-1000px",willChange:"transform",background:`repeating-conic-gradient(from 0deg at 50% 50%,
7
  rgba(255, 250, 193, 1) 0deg, rgba(255, 250, 193, 0.7) 4deg,
8
- transparent 4deg, transparent 8deg)`}})}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-[150vw] h-[100vh] bg-[radial-gradient(ellipse_at_50%_100%,#7e22ce_10%,transparent_60%)] mix-blend-overlay"})]}),e.jsx("div",{className:"absolute inset-0 bg-math-pattern opacity-[0.03] mix-blend-overlay pointer-events-none z-[-1] leaderboard-mask"}),e.jsxs("div",{className:"relative z-10 w-full px-4 sm:px-8 py-4 md:py-6 flex flex-col items-center",children:[e.jsx("div",{className:"w-full flex justify-center items-center mb-4 mt-2",children:e.jsx("h1",{className:"text-3xl md:text-4xl font-display font-bold tracking-wide text-slate-800 drop-shadow-sm",children:"Leaderboard"})}),e.jsx("div",{className:"bg-slate-800/5 backdrop-blur-md rounded-full p-1 flex gap-1 mb-3 shadow-[inset_0_2px_4px_rgba(0,0,0,0.05)] border border-slate-800/10 w-full max-w-[340px]",children:["daily","weekly","all"].map(s=>e.jsx("button",{onClick:()=>M(s),className:`flex-1 py-1.5 rounded-full text-[13px] md:text-sm font-semibold transition-all capitalize inline-flex justify-center items-center ${g===s?"bg-white text-purple-700 shadow-md border border-white/50 backdrop-blur-lg":"text-slate-600 hover:text-purple-700 hover:bg-white/50"}`,children:s==="all"?"All Time":s},s))}),e.jsxs(c.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"w-full max-w-[420px] mb-4 bg-[#FFB356] p-2.5 md:p-3 rounded-full shadow-lg flex items-center gap-3 relative overflow-hidden ring-1 ring-white/20",children:[e.jsx("div",{className:"absolute inset-0 bg-noise opacity-[0.15] mix-blend-overlay pointer-events-none"}),e.jsx("div",{className:"bg-white/25 backdrop-blur-md px-4 py-2 min-w-[60px] rounded-full flex flex-col items-center justify-center shadow-sm z-10 border border-white/20",children:e.jsxs("span",{className:"text-xl md:text-2xl font-display font-bold text-white leading-none",children:["#",A]})}),e.jsx("div",{className:"z-10 flex-1 pr-2 md:pr-4",children:e.jsxs("p",{className:"font-medium text-white/90 text-sm md:text-[15px] leading-snug text-center",children:["You are doing better than ",e.jsxs("span",{className:"font-black text-white drop-shadow-sm",children:[Math.round(O),"%"]})," of other players!"]})})]}),e.jsxs("div",{className:"w-full max-w-[800px] flex items-end justify-center gap-2 md:gap-4 h-[280px] md:h-[310px] relative z-20 mt-8 md:mt-12 mx-auto px-2 sm:px-4 group perspective-1000",children:[e.jsxs(c.div,{initial:{opacity:0,y:40},animate:{opacity:1,y:0},transition:{delay:.15,type:"spring",stiffness:90},className:"flex flex-col items-center relative z-10 w-[28%] sm:w-[30%] max-w-[145px] mx-1 md:mr-2",children:[e.jsxs("div",{className:"flex flex-col items-center mb-2 md:mb-4 relative z-40 w-full",children:[e.jsx("div",{className:"w-14 h-14 md:w-[72px] md:h-[72px] rounded-full border-[3px] border-[#FF8B8B] bg-[#111827] flex items-center justify-center shadow-[0_0_18px_rgba(255,139,139,0.6)] overflow-hidden",children:f(o[1]?.avatar,26)}),e.jsx("h3",{className:"font-semibold text-white mt-1.5 md:mt-2 text-xs md:text-sm drop-shadow-md w-full text-center pb-1 px-1 whitespace-normal break-words leading-tight relative z-50",children:o[1]?.name||"---"})]}),e.jsxs("div",{className:"w-[90%] relative mt-2",children:[e.jsx("div",{className:"w-full h-10 md:h-14 absolute -bottom-5 md:-bottom-7 bg-[#D96C6A] rounded-[50%] shadow-[0_15px_25px_rgba(0,0,0,0.4)] z-0"}),e.jsx("div",{className:"w-full h-[100px] md:h-[130px] bg-[#D96C6A] relative z-10 flex flex-col items-center justify-start overflow-hidden",children:e.jsx("span",{className:"absolute inset-x-0 top-3 flex items-center justify-center text-[60px] md:text-[80px] font-black text-white/10 drop-shadow",children:"2"})}),e.jsx("div",{className:"w-full h-10 md:h-14 absolute -top-5 md:-top-7 bg-[#FF8B8B] rounded-[50%] z-20 shadow-[0_4px_8px_rgba(0,0,0,0.3)] flex flex-col items-center justify-center",children:e.jsxs("div",{className:"text-black/25 font-black text-[18px] md:text-[26px] transform scale-y-75 uppercase tracking-widest pointer-events-none z-30",children:[o[1]?.totalXP||0," XP"]})})]})]}),e.jsxs(c.div,{initial:{opacity:0,y:60},animate:{opacity:1,y:0},transition:{delay:.05,type:"spring",stiffness:100},className:"flex flex-col items-center relative z-30 w-[35%] sm:w-[38%] max-w-[190px]",children:[e.jsxs("div",{className:"flex flex-col items-center mb-3 md:mb-5 relative z-40 w-full",children:[e.jsx(c.div,{animate:{y:[0,-6,0]},transition:{repeat:1/0,duration:2.2,ease:"easeInOut"},className:"mb-[-10px] z-30",children:e.jsx(X,{size:30,className:"text-yellow-300 fill-yellow-300 drop-shadow-[0_0_12px_rgba(250,204,21,0.9)] md:w-9 md:h-9"})}),e.jsx("div",{className:"w-16 h-16 md:w-[86px] md:h-[86px] rounded-full border-[4px] border-[#fde68a] bg-[#111827] flex items-center justify-center shadow-[0_0_24px_rgba(250,204,21,0.6)] overflow-hidden",children:f(o[0]?.avatar,34)}),e.jsx("h3",{className:"font-semibold text-white mt-1.5 md:mt-2 text-sm md:text-base drop-shadow-md w-full text-center pb-1 px-1 whitespace-normal break-words leading-tight relative z-50",children:o[0]?.name||"---"})]}),e.jsxs("div",{className:"w-[95%] relative mt-2",children:[e.jsx("div",{className:"w-full h-12 md:h-16 absolute -bottom-6 md:-bottom-8 bg-[#6F2BAF] rounded-[50%] shadow-[0_20px_30px_rgba(0,0,0,0.5)] z-0"}),e.jsx("div",{className:"w-full h-[140px] md:h-[180px] bg-[#6F2BAF] relative z-10 flex flex-col items-center justify-start overflow-hidden",children:e.jsx("span",{className:"absolute inset-x-0 top-4 flex items-center justify-center text-[80px] md:text-[110px] font-black text-white/10 drop-shadow",children:"1"})}),e.jsx("div",{className:"w-full h-12 md:h-16 absolute -top-6 md:-top-8 bg-[#9956DE] rounded-[50%] z-20 shadow-[0_5px_12px_rgba(0,0,0,0.4)] flex flex-col items-center justify-center",children:e.jsxs("div",{className:"text-black/25 font-black text-[22px] md:text-[32px] transform scale-y-75 uppercase tracking-widest pointer-events-none z-30",children:[o[0]?.totalXP||0," XP"]})})]})]}),e.jsxs(c.div,{initial:{opacity:0,y:40},animate:{opacity:1,y:0},transition:{delay:.25,type:"spring",stiffness:90},className:"flex flex-col items-center relative z-10 w-[28%] sm:w-[30%] max-w-[145px] mx-1 md:ml-2",children:[e.jsxs("div",{className:"flex flex-col items-center mb-2 md:mb-4 relative z-40 w-full",children:[e.jsx("div",{className:"w-14 h-14 md:w-[72px] md:h-[72px] rounded-full border-[3px] border-[#FFB356] bg-[#111827] flex items-center justify-center shadow-[0_0_18px_rgba(255,179,86,0.6)] overflow-hidden",children:f(o[2]?.avatar,26)}),e.jsx("h3",{className:"font-semibold text-white mt-1.5 md:mt-2 text-xs md:text-sm drop-shadow-md w-full text-center pb-1 px-1 whitespace-normal break-words leading-tight relative z-50",children:o[2]?.name||"---"})]}),e.jsxs("div",{className:"w-[90%] relative mt-2",children:[e.jsx("div",{className:"w-full h-10 md:h-14 absolute -bottom-5 md:-bottom-7 bg-[#DE7949] rounded-[50%] shadow-[0_15px_25px_rgba(0,0,0,0.4)] z-0"}),e.jsx("div",{className:"w-full h-[75px] md:h-[100px] bg-[#DE7949] relative z-10 flex flex-col items-center justify-start overflow-hidden",children:e.jsx("span",{className:"absolute inset-x-0 top-1 flex items-center justify-center text-[50px] md:text-[70px] font-black text-white/10 drop-shadow",children:"3"})}),e.jsx("div",{className:"w-full h-10 md:h-14 absolute -top-5 md:-top-7 bg-[#FFB356] rounded-[50%] z-20 shadow-[0_4px_8px_rgba(0,0,0,0.3)] flex flex-col items-center justify-center",children:e.jsxs("div",{className:"text-black/25 font-black text-[16px] md:text-[22px] transform scale-y-75 uppercase tracking-widest pointer-events-none z-30",children:[o[2]?.totalXP||0," XP"]})})]})]})]})]}),e.jsxs("div",{className:"w-full flex-grow relative z-20 pt-6 pb-8 px-4 sm:px-10 flex flex-col items-center mt-[-15px] md:mt-[-30px] bg-white rounded-t-[2.5rem] shadow-[0_-10px_30px_rgba(0,0,0,0.1)] border-t border-slate-100 min-h-[50vh]",children:[e.jsx("div",{className:"w-12 h-1.5 bg-slate-200 rounded-full mb-6 mt-[-5px]"}),e.jsxs("div",{className:"w-full max-w-4xl space-y-3.5",children:[L.map((s,r)=>{const n=s.rank.global||r+4;return e.jsxs(c.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{delay:r*.05+.3},onClick:()=>_(s),className:`flex items-center gap-4 p-3.5 md:p-4 rounded-3xl cursor-pointer bg-white border transition-all duration-300 ${s.isYou?"border-[#8B5CF6]/40 shadow-xl shadow-[#8B5CF6]/20 ring-2 ring-[#8B5CF6]/10":"border-slate-100 shadow-[0_12px_25px_rgba(0,0,0,0.08)] hover:shadow-[0_16px_30px_rgba(0,0,0,0.12)]"}`,children:[e.jsx("div",{className:"w-9 h-9 md:w-11 md:h-11 rounded-full border-2 border-slate-100 bg-white flex items-center justify-center font-display font-bold text-slate-500 shadow-sm text-sm",children:n}),e.jsx("div",{className:"w-11 h-11 md:w-14 md:h-14 bg-slate-100 rounded-full flex items-center justify-center text-xl overflow-hidden shadow-sm relative border-[3px] border-[#F1F5F9]",children:f(s.avatar,24)}),e.jsxs("div",{className:"flex-1 flex justify-between items-center pr-2",children:[e.jsx("div",{children:e.jsxs("h4",{className:"font-display font-bold text-[#1E293B] text-[15px] md:text-lg flex items-center gap-2 tracking-wide",children:[s.name,s.isYou&&e.jsx("span",{className:"text-[9px] uppercase tracking-wider bg-[#8B5CF6] text-white px-1.5 py-0.5 rounded font-bold",children:"You"})]})}),e.jsx("div",{children:e.jsxs("p",{className:"text-[13px] md:text-[15px] font-bold text-slate-500 text-right",children:[s.totalXP," ",e.jsx("span",{className:"text-[10px] text-slate-400 font-normal uppercase",children:"XP"})]})})]})]},s.id)}),L.length===0&&e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-slate-400 font-medium",children:"No other participants found in this view."})})]})]}),e.jsx(te,{student:I,onClose:()=>_(null)})]}):e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-slate-100 flex items-center justify-center",children:e.jsx(Q,{className:"w-7 h-7 text-slate-400"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-700 mb-1",children:"Leaderboard Locked"}),e.jsx("p",{className:"text-xs text-slate-400",children:"This feature is temporarily unavailable while you focus on your learning."})]})]})};export{ue as default};
 
1
+ import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{e as O,aD as q,g as H,m as c,a as y,q as P,A as k,z as m,T as E,p as z,Y as X,$ as U,Q as W,l as $,aE as Q,R as G,L as K,y as T}from"./index-uASBzalf.js";import{X as V}from"./x-CBb03rh3.js";import{C as Z}from"./clock-8t0UYgg3.js";import{u as J}from"./useFeatureAccess-C_Ctl5Sh.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
5
  * See the LICENSE file in the root directory of this source tree.
6
+ */const ee=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],se=O("badge-check",ee),te=({student:t,onClose:b})=>{const[i,u]=l.useState([]),[p,h]=l.useState(!1);if(l.useEffect(()=>{t?.uid&&(h(!0),q(t.uid).then(u).catch(d=>console.error("Failed to load achievements:",d)).finally(()=>h(!1)))},[t?.uid]),!t)return null;const j={trophy:e.jsx(m,{size:24,className:"text-rose-500"}),flame:e.jsx(W,{size:24,className:"text-orange-500"}),star:e.jsx(U,{size:24,className:"text-rose-400"}),"book-open":e.jsx(y,{size:24,className:"text-sky-600"}),"badge-check":e.jsx(se,{size:24,className:"text-emerald-600"}),crown:e.jsx(X,{size:24,className:"text-rose-500"}),target:e.jsx(P,{size:24,className:"text-rose-500"})};return e.jsx(H,{children:e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[e.jsx(c.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:b,className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),e.jsxs(c.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"relative bg-[#f7f9fc] rounded-2xl shadow-2xl border border-[#dde3eb] w-full max-w-2xl max-h-[90vh] overflow-hidden",children:[e.jsxs("div",{className:"bg-gradient-to-r from-sky-600 to-sky-500 p-8 text-white relative overflow-hidden",children:[e.jsx("div",{className:"accent-line absolute top-0 left-0 right-0"}),e.jsx("button",{onClick:b,className:"absolute top-4 right-4 p-2 hover:bg-slate-100 rounded-xl transition-colors z-10",children:e.jsx(V,{size:20})}),e.jsx("div",{className:"relative z-10",children:e.jsxs("div",{className:"flex items-start gap-6",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-24 h-24 bg-white/10 backdrop-blur-sm rounded-2xl flex items-center justify-center text-6xl border border-slate-300",children:t.avatar}),t.isOnline&&e.jsx("div",{className:"absolute -bottom-2 -right-2 w-6 h-6 bg-green-500 rounded-full border-4 border-white"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-3xl font-display font-bold mb-2",children:t.name}),e.jsx("p",{className:"text-slate-500 mb-4",children:t.section}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"bg-slate-100 backdrop-blur-sm rounded-xl px-4 py-2 border border-slate-200",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Level"}),e.jsx("p",{className:"text-xl font-bold",children:t.level})]}),e.jsxs("div",{className:"bg-slate-100 backdrop-blur-sm rounded-xl px-4 py-2 border border-slate-200",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Total XP"}),e.jsx("p",{className:"text-xl font-bold",children:t.totalXP})]})]})]})]})}),e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-sky-500/5 rounded-full -translate-y-1/2 translate-x-1/2"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-48 h-48 bg-rose-500/5 rounded-full translate-y-1/2 -translate-x-1/2"})]}),e.jsxs("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-320px)]",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"font-display font-bold text-lg text-[#0a1628] mb-4",children:"Performance Stats"}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] p-4 text-center",children:[e.jsx(y,{size:24,className:"text-sky-600 mx-auto mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:t.stats.quizzesCompleted}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Quizzes"})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] p-4 text-center",children:[e.jsx(P,{size:24,className:"text-emerald-600 mx-auto mb-2"}),e.jsxs("p",{className:"text-2xl font-bold text-[#0a1628]",children:[t.stats.averageScore,"%"]}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Avg Score"})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] p-4 text-center",children:[e.jsx(k,{size:24,className:"text-rose-600 mx-auto mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:t.stats.modulesCompleted}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Modules"})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-[#dde3eb] p-4 text-center",children:[e.jsx(Z,{size:24,className:"text-rose-600 mx-auto mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-[#0a1628]",children:t.stats.studyHours}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Hours"})]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"font-display font-bold text-lg text-[#0a1628] mb-4",children:"Rankings"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded-xl p-4",children:[e.jsx(m,{size:20,className:"text-rose-600 mb-2"}),e.jsxs("p",{className:"text-2xl font-bold text-rose-900",children:["#",t.rank.global]}),e.jsx("p",{className:"text-xs text-rose-700 mt-1 font-body",children:"School"})]}),e.jsxs("div",{className:"bg-sky-50 border border-sky-200 rounded-xl p-4",children:[e.jsx(m,{size:20,className:"text-sky-600 mb-2"}),e.jsxs("p",{className:"text-2xl font-bold text-sky-900",children:["#",t.rank.section]}),e.jsx("p",{className:"text-xs text-sky-700 mt-1 font-body",children:"Section"})]}),e.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded-xl p-4",children:[e.jsx(m,{size:20,className:"text-rose-600 mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-rose-900",children:t.rank.change>0?e.jsxs("span",{className:"flex items-center gap-1 text-emerald-600",children:[e.jsx(E,{size:20}),"+",t.rank.change]}):t.rank.change<0?e.jsxs("span",{className:"flex items-center gap-1 text-red-600",children:[e.jsx(E,{size:20,className:"rotate-180"}),t.rank.change]}):"0"}),e.jsx("p",{className:"text-xs text-rose-700 mt-1 font-body",children:"This Week"})]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"font-display font-bold text-lg text-[#0a1628] mb-4",children:"Achievements"}),p?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(z,{size:24,className:"text-sky-500 animate-spin"})}):i.length>0?e.jsx("div",{className:"grid grid-cols-3 gap-3",children:i.map(d=>e.jsxs("div",{className:"rounded-xl p-4 text-center transition-all bg-white border-2 border-sky-200",children:[e.jsx("div",{className:"text-3xl mb-2",children:j[d.icon]||e.jsx(k,{size:24,className:"text-slate-500 mx-auto"})}),e.jsx("p",{className:"font-bold text-xs text-[#0a1628] mb-1 font-body",children:d.title}),e.jsx("p",{className:"text-xs text-[#5a6578]",children:d.description})]},d.id))}):e.jsxs("div",{className:"flex flex-col items-center py-8 gap-2",children:[e.jsx(k,{size:32,className:"text-[#d1cec6]"}),e.jsx("p",{className:"text-sm text-[#5a6578] font-body",children:"No achievements unlocked yet"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-display font-bold text-lg text-[#0a1628] mb-4",children:"Recent Activity"}),e.jsxs("div",{className:"flex flex-col items-center py-8 gap-2",children:[e.jsx(y,{size:32,className:"text-[#d1cec6]"}),e.jsx("p",{className:"text-sm text-[#5a6578] font-body",children:"Activity history coming soon"})]})]})]})]})]})})},ue=({currentUserPhoto:t,onBack:b})=>{const{currentUser:i,userProfile:u}=$(),p=u,{leaderboard:h,loading:j}=J(i?.uid||null),[d]=l.useState("section"),[g,M]=l.useState("weekly"),[I,_]=l.useState(null),[D,v]=l.useState(!0),[F,S]=l.useState(null),[R,C]=l.useState([]),N=[p?.grade,p?.section].filter(Boolean).join(" - "),w=l.useCallback(async()=>{if(!i){v(!1);return}v(!0),S(null);try{const s=g==="all"?"all":"week",r=await Q(i.uid,!1,s,20);if(!r||r.length===0){C([]);return}const n=r.map(a=>({id:a.userId,uid:a.userId,name:a.name,avatar:a.userId===i.uid?t||a.photo||"":a.photo||"",level:a.level,totalXP:a.xp,section:N||"Grade 11 - STEM A",rank:{global:a.rank,section:a.rank,change:0},stats:{quizzesCompleted:0,averageScore:0,modulesCompleted:0,studyHours:0},isOnline:!1,isYou:a.userId===i.uid}));C(n)}catch(s){console.error("Error loading leaderboard:",s),S(s instanceof Error?s.message:"Failed to load leaderboard")}finally{v(!1)}},[i,N,g,t]);l.useEffect(()=>{w()},[w]);const x=(()=>{let s=R;if(d==="section"){const n=N||"";n&&(s=s.filter(a=>a.section===n))}return s.sort((n,a)=>{const B=d==="section"?"section":"global";return(n.rank[B]||999)-(a.rank[B]||999)})})(),A=x.find(s=>s.isYou)?.rank.section||x.length+1,Y=x.length>1?Math.max(10,Math.min(99,100-A/Math.max(1,x.length)*100)):90,o=x.slice(0,3),L=x.slice(3),f=(s,r)=>s?s.startsWith("http")||s.startsWith("data:")?e.jsx("img",{src:s,alt:"Avatar",className:"w-full h-full object-cover rounded-full"}):e.jsx(T,{size:r,className:"text-slate-400 opacity-70"}):e.jsx(T,{size:r,className:"text-slate-400 opacity-70"});return D?e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-3",children:[e.jsx(z,{className:"w-8 h-8 animate-spin text-purple-600"}),e.jsx("p",{className:"text-sm text-slate-400 font-medium",children:"Loading leaderboard..."})]}):F?e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-red-50 flex items-center justify-center",children:e.jsx(m,{className:"w-7 h-7 text-red-400"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-700 mb-1",children:"Couldn't load leaderboard"}),e.jsx("p",{className:"text-xs text-slate-400",children:F})]}),e.jsxs("button",{onClick:w,className:"flex items-center gap-2 px-4 py-2 bg-purple-600 text-white text-sm font-medium rounded-xl hover:bg-purple-700 transition-colors",children:[e.jsx(G,{size:14}),"Try Again"]})]}):j?e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-3",children:[e.jsx(z,{className:"w-8 h-8 animate-spin text-purple-600"}),e.jsx("p",{className:"text-sm text-slate-400 font-medium",children:"Loading..."})]}):h?e.jsxs("div",{className:"w-full min-h-screen relative flex flex-col items-center font-body text-white",children:[e.jsxs("div",{className:"absolute inset-x-[-30px] top-[-30px] bottom-0 z-[-1] pointer-events-none overflow-hidden bg-[#f5ecff]",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_50%_100%,#9333ea_0%,#c084fc_50%,transparent_100%)]"}),e.jsx("div",{className:"absolute inset-x-[-30px] top-[-30px] bottom-0 opacity-50 pointer-events-none mix-blend-plus-lighter overflow-hidden",children:e.jsx("div",{className:"animate-sunburst-spin absolute top-[540px] md:top-[600px] left-1/2",style:{width:"2000px",height:"2000px",marginLeft:"-1000px",marginTop:"-1000px",willChange:"transform",background:`repeating-conic-gradient(from 0deg at 50% 50%,
7
  rgba(255, 250, 193, 1) 0deg, rgba(255, 250, 193, 0.7) 4deg,
8
+ transparent 4deg, transparent 8deg)`}})}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-[150vw] h-[100vh] bg-[radial-gradient(ellipse_at_50%_100%,#7e22ce_10%,transparent_60%)] mix-blend-overlay"})]}),e.jsx("div",{className:"absolute inset-0 bg-math-pattern opacity-[0.03] mix-blend-overlay pointer-events-none z-[-1] leaderboard-mask"}),e.jsxs("div",{className:"relative z-10 w-full px-4 sm:px-8 py-4 md:py-6 flex flex-col items-center",children:[e.jsx("div",{className:"w-full flex justify-center items-center mb-4 mt-2",children:e.jsx("h1",{className:"text-3xl md:text-4xl font-display font-bold tracking-wide text-slate-800 drop-shadow-sm",children:"Leaderboard"})}),e.jsx("div",{className:"bg-slate-800/5 backdrop-blur-md rounded-full p-1 flex gap-1 mb-3 shadow-[inset_0_2px_4px_rgba(0,0,0,0.05)] border border-slate-800/10 w-full max-w-[340px]",children:["daily","weekly","all"].map(s=>e.jsx("button",{onClick:()=>M(s),className:`flex-1 py-1.5 rounded-full text-[13px] md:text-sm font-semibold transition-all capitalize inline-flex justify-center items-center ${g===s?"bg-white text-purple-700 shadow-md border border-white/50 backdrop-blur-lg":"text-slate-600 hover:text-purple-700 hover:bg-white/50"}`,children:s==="all"?"All Time":s},s))}),e.jsxs(c.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"w-full max-w-[420px] mb-4 bg-[#FFB356] p-2.5 md:p-3 rounded-full shadow-lg flex items-center gap-3 relative overflow-hidden ring-1 ring-white/20",children:[e.jsx("div",{className:"absolute inset-0 bg-noise opacity-[0.15] mix-blend-overlay pointer-events-none"}),e.jsx("div",{className:"bg-white/25 backdrop-blur-md px-4 py-2 min-w-[60px] rounded-full flex flex-col items-center justify-center shadow-sm z-10 border border-white/20",children:e.jsxs("span",{className:"text-xl md:text-2xl font-display font-bold text-white leading-none",children:["#",A]})}),e.jsx("div",{className:"z-10 flex-1 pr-2 md:pr-4",children:e.jsxs("p",{className:"font-medium text-white/90 text-sm md:text-[15px] leading-snug text-center",children:["You are doing better than ",e.jsxs("span",{className:"font-black text-white drop-shadow-sm",children:[Math.round(Y),"%"]})," of other players!"]})})]}),e.jsxs("div",{className:"w-full max-w-[800px] flex items-end justify-center gap-2 md:gap-4 h-[280px] md:h-[310px] relative z-20 mt-8 md:mt-12 mx-auto px-2 sm:px-4 group perspective-1000",children:[e.jsxs(c.div,{initial:{opacity:0,y:40},animate:{opacity:1,y:0},transition:{delay:.15,type:"spring",stiffness:90},className:"flex flex-col items-center relative z-10 w-[28%] sm:w-[30%] max-w-[145px] mx-1 md:mr-2",children:[e.jsxs("div",{className:"flex flex-col items-center mb-2 md:mb-4 relative z-40 w-full",children:[e.jsx("div",{className:"w-14 h-14 md:w-[72px] md:h-[72px] rounded-full border-[3px] border-[#FF8B8B] bg-[#111827] flex items-center justify-center shadow-[0_0_18px_rgba(255,139,139,0.6)] overflow-hidden",children:f(o[1]?.avatar,26)}),e.jsx("h3",{className:"font-semibold text-white mt-1.5 md:mt-2 text-xs md:text-sm drop-shadow-md w-full text-center pb-1 px-1 whitespace-normal break-words leading-tight relative z-50",children:o[1]?.name||"---"})]}),e.jsxs("div",{className:"w-[90%] relative mt-2",children:[e.jsx("div",{className:"w-full h-10 md:h-14 absolute -bottom-5 md:-bottom-7 bg-[#D96C6A] rounded-[50%] shadow-[0_15px_25px_rgba(0,0,0,0.4)] z-0"}),e.jsx("div",{className:"w-full h-[100px] md:h-[130px] bg-[#D96C6A] relative z-10 flex flex-col items-center justify-start overflow-hidden",children:e.jsx("span",{className:"absolute inset-x-0 top-3 flex items-center justify-center text-[60px] md:text-[80px] font-black text-white/10 drop-shadow",children:"2"})}),e.jsx("div",{className:"w-full h-10 md:h-14 absolute -top-5 md:-top-7 bg-[#FF8B8B] rounded-[50%] z-20 shadow-[0_4px_8px_rgba(0,0,0,0.3)] flex flex-col items-center justify-center",children:e.jsxs("div",{className:"text-black/25 font-black text-[18px] md:text-[26px] transform scale-y-75 uppercase tracking-widest pointer-events-none z-30",children:[o[1]?.totalXP||0," XP"]})})]})]}),e.jsxs(c.div,{initial:{opacity:0,y:60},animate:{opacity:1,y:0},transition:{delay:.05,type:"spring",stiffness:100},className:"flex flex-col items-center relative z-30 w-[35%] sm:w-[38%] max-w-[190px]",children:[e.jsxs("div",{className:"flex flex-col items-center mb-3 md:mb-5 relative z-40 w-full",children:[e.jsx(c.div,{animate:{y:[0,-6,0]},transition:{repeat:1/0,duration:2.2,ease:"easeInOut"},className:"mb-[-10px] z-30",children:e.jsx(X,{size:30,className:"text-yellow-300 fill-yellow-300 drop-shadow-[0_0_12px_rgba(250,204,21,0.9)] md:w-9 md:h-9"})}),e.jsx("div",{className:"w-16 h-16 md:w-[86px] md:h-[86px] rounded-full border-[4px] border-[#fde68a] bg-[#111827] flex items-center justify-center shadow-[0_0_24px_rgba(250,204,21,0.6)] overflow-hidden",children:f(o[0]?.avatar,34)}),e.jsx("h3",{className:"font-semibold text-white mt-1.5 md:mt-2 text-sm md:text-base drop-shadow-md w-full text-center pb-1 px-1 whitespace-normal break-words leading-tight relative z-50",children:o[0]?.name||"---"})]}),e.jsxs("div",{className:"w-[95%] relative mt-2",children:[e.jsx("div",{className:"w-full h-12 md:h-16 absolute -bottom-6 md:-bottom-8 bg-[#6F2BAF] rounded-[50%] shadow-[0_20px_30px_rgba(0,0,0,0.5)] z-0"}),e.jsx("div",{className:"w-full h-[140px] md:h-[180px] bg-[#6F2BAF] relative z-10 flex flex-col items-center justify-start overflow-hidden",children:e.jsx("span",{className:"absolute inset-x-0 top-4 flex items-center justify-center text-[80px] md:text-[110px] font-black text-white/10 drop-shadow",children:"1"})}),e.jsx("div",{className:"w-full h-12 md:h-16 absolute -top-6 md:-top-8 bg-[#9956DE] rounded-[50%] z-20 shadow-[0_5px_12px_rgba(0,0,0,0.4)] flex flex-col items-center justify-center",children:e.jsxs("div",{className:"text-black/25 font-black text-[22px] md:text-[32px] transform scale-y-75 uppercase tracking-widest pointer-events-none z-30",children:[o[0]?.totalXP||0," XP"]})})]})]}),e.jsxs(c.div,{initial:{opacity:0,y:40},animate:{opacity:1,y:0},transition:{delay:.25,type:"spring",stiffness:90},className:"flex flex-col items-center relative z-10 w-[28%] sm:w-[30%] max-w-[145px] mx-1 md:ml-2",children:[e.jsxs("div",{className:"flex flex-col items-center mb-2 md:mb-4 relative z-40 w-full",children:[e.jsx("div",{className:"w-14 h-14 md:w-[72px] md:h-[72px] rounded-full border-[3px] border-[#FFB356] bg-[#111827] flex items-center justify-center shadow-[0_0_18px_rgba(255,179,86,0.6)] overflow-hidden",children:f(o[2]?.avatar,26)}),e.jsx("h3",{className:"font-semibold text-white mt-1.5 md:mt-2 text-xs md:text-sm drop-shadow-md w-full text-center pb-1 px-1 whitespace-normal break-words leading-tight relative z-50",children:o[2]?.name||"---"})]}),e.jsxs("div",{className:"w-[90%] relative mt-2",children:[e.jsx("div",{className:"w-full h-10 md:h-14 absolute -bottom-5 md:-bottom-7 bg-[#DE7949] rounded-[50%] shadow-[0_15px_25px_rgba(0,0,0,0.4)] z-0"}),e.jsx("div",{className:"w-full h-[75px] md:h-[100px] bg-[#DE7949] relative z-10 flex flex-col items-center justify-start overflow-hidden",children:e.jsx("span",{className:"absolute inset-x-0 top-1 flex items-center justify-center text-[50px] md:text-[70px] font-black text-white/10 drop-shadow",children:"3"})}),e.jsx("div",{className:"w-full h-10 md:h-14 absolute -top-5 md:-top-7 bg-[#FFB356] rounded-[50%] z-20 shadow-[0_4px_8px_rgba(0,0,0,0.3)] flex flex-col items-center justify-center",children:e.jsxs("div",{className:"text-black/25 font-black text-[16px] md:text-[22px] transform scale-y-75 uppercase tracking-widest pointer-events-none z-30",children:[o[2]?.totalXP||0," XP"]})})]})]})]})]}),e.jsxs("div",{className:"w-full flex-grow relative z-20 pt-6 pb-8 px-4 sm:px-10 flex flex-col items-center mt-[-15px] md:mt-[-30px] bg-white rounded-t-[2.5rem] shadow-[0_-10px_30px_rgba(0,0,0,0.1)] border-t border-slate-100 min-h-[50vh]",children:[e.jsx("div",{className:"w-12 h-1.5 bg-slate-200 rounded-full mb-6 mt-[-5px]"}),e.jsxs("div",{className:"w-full max-w-4xl space-y-3.5",children:[L.map((s,r)=>{const n=s.rank.global||r+4;return e.jsxs(c.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{delay:r*.05+.3},onClick:()=>_(s),className:`flex items-center gap-4 p-3.5 md:p-4 rounded-3xl cursor-pointer bg-white border transition-all duration-300 ${s.isYou?"border-[#8B5CF6]/40 shadow-xl shadow-[#8B5CF6]/20 ring-2 ring-[#8B5CF6]/10":"border-slate-100 shadow-[0_12px_25px_rgba(0,0,0,0.08)] hover:shadow-[0_16px_30px_rgba(0,0,0,0.12)]"}`,children:[e.jsx("div",{className:"w-9 h-9 md:w-11 md:h-11 rounded-full border-2 border-slate-100 bg-white flex items-center justify-center font-display font-bold text-slate-500 shadow-sm text-sm",children:n}),e.jsx("div",{className:"w-11 h-11 md:w-14 md:h-14 bg-slate-100 rounded-full flex items-center justify-center text-xl overflow-hidden shadow-sm relative border-[3px] border-[#F1F5F9]",children:f(s.avatar,24)}),e.jsxs("div",{className:"flex-1 flex justify-between items-center pr-2",children:[e.jsx("div",{children:e.jsxs("h4",{className:"font-display font-bold text-[#1E293B] text-[15px] md:text-lg flex items-center gap-2 tracking-wide",children:[s.name,s.isYou&&e.jsx("span",{className:"text-[9px] uppercase tracking-wider bg-[#8B5CF6] text-white px-1.5 py-0.5 rounded font-bold",children:"You"})]})}),e.jsx("div",{children:e.jsxs("p",{className:"text-[13px] md:text-[15px] font-bold text-slate-500 text-right",children:[s.totalXP," ",e.jsx("span",{className:"text-[10px] text-slate-400 font-normal uppercase",children:"XP"})]})})]})]},s.id)}),L.length===0&&e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-slate-400 font-medium",children:"No other participants found in this view."})})]})]}),e.jsx(te,{student:I,onClose:()=>_(null)})]}):e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-slate-100 flex items-center justify-center",children:e.jsx(K,{className:"w-7 h-7 text-slate-400"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-700 mb-1",children:"Leaderboard Locked"}),e.jsx("p",{className:"text-xs text-slate-400",children:"This feature is temporarily unavailable while you focus on your learning."})]})]})};export{ue as default};
assets/{LearningPath-BBE0vZ0S.js β†’ LearningPath-COPS3nvD.js} RENAMED
@@ -1 +1 @@
1
- import{r as m,d as p,j as r}from"./vendor-react-B4AQeu28.js";import{u as j,a2 as P,a3 as I,q as N,a as k,b as L}from"./index-BaOs5Ayg.js";import{M as S}from"./ModuleFolderCard-DKBrO5a8.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";import"./useSubjectAvailability-Bvu3fXaT.js";import"./clock-D1Ecvltm.js";const V=({onNavigateToModules:c,atRiskSubjects:d=[],priorityTopics:o=[],modules:a})=>{const{userProfile:l}=j(),[u,h]=m.useState(null),i=p.useMemo(()=>{const e=o.length>0?o:d.map(s=>P(s)).filter(s=>s!==null),t=new Set;return e.filter(s=>t.has(s)?!1:(t.add(s),!0))},[o,d]),x=p.useMemo(()=>{if(i.length===0)return a.slice(0,3);const e=new Map(i.map((t,s)=>[I[t],s]));return[...a].sort((t,s)=>{const n=e.get(t.id)??Number.POSITIVE_INFINITY,b=e.get(s.id)??Number.POSITIVE_INFINITY;return n-b}).slice(0,3)},[a,i]);m.useEffect(()=>{l?.uid&&N(l.uid).then(h).catch(console.error)},[l?.uid]);const g=x.slice(0,3).map(e=>{const t=u?.subjects?.[e.subject]?.modulesProgress?.[e.id],s=e.lessons.length,n=t?.progress??(s>0?Math.round((t?.lessonsCompleted?.length||0)/s*100):0);return{...e,progress:n,status:n===100?"Completed":n>0?"In Progress":"Not Started"}}),f=g.some(e=>e.progress>0)?"Continue Learning":"Start Learning";return r.jsxs("div",{children:[r.jsxs("div",{className:"flex justify-between items-center mb-6 px-1",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-[14px] bg-indigo-50 border border-indigo-100 flex items-center justify-center text-indigo-500 shadow-inner",children:r.jsx(k,{size:20,strokeWidth:2.5})}),r.jsx("h2",{className:"font-display font-black text-[24px] text-slate-800 tracking-tight",children:f})]}),r.jsxs("button",{onClick:()=>c?.(),className:"text-primary font-bold text-sm flex items-center gap-1 hover:gap-2 transition-all bg-primary/10 px-4 py-2 rounded-xl hover:bg-primary/20",children:["View All ",r.jsx(L,{size:16})]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-6",children:g.map((e,t)=>r.jsx(S,{module:e,index:t,onClick:()=>c?.(e.id),isAtRisk:i.length>0,badgeLabel:e.status!=="Not Started"?e.status:void 0},e.id))})]})};export{V as default};
 
1
+ import{r as m,d as p,j as r}from"./vendor-react-B4AQeu28.js";import{l as j,a3 as P,a4 as I,x as N,a as k,b as L}from"./index-uASBzalf.js";import{M as S}from"./ModuleFolderCard-Du9VPsWG.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";import"./useSubjectAvailability-jmWCWhoq.js";import"./clock-8t0UYgg3.js";const V=({onNavigateToModules:c,atRiskSubjects:d=[],priorityTopics:o=[],modules:a})=>{const{userProfile:l}=j(),[u,h]=m.useState(null),i=p.useMemo(()=>{const e=o.length>0?o:d.map(s=>P(s)).filter(s=>s!==null),t=new Set;return e.filter(s=>t.has(s)?!1:(t.add(s),!0))},[o,d]),x=p.useMemo(()=>{if(i.length===0)return a.slice(0,3);const e=new Map(i.map((t,s)=>[I[t],s]));return[...a].sort((t,s)=>{const n=e.get(t.id)??Number.POSITIVE_INFINITY,b=e.get(s.id)??Number.POSITIVE_INFINITY;return n-b}).slice(0,3)},[a,i]);m.useEffect(()=>{l?.uid&&N(l.uid).then(h).catch(console.error)},[l?.uid]);const g=x.slice(0,3).map(e=>{const t=u?.subjects?.[e.subject]?.modulesProgress?.[e.id],s=e.lessons.length,n=t?.progress??(s>0?Math.round((t?.lessonsCompleted?.length||0)/s*100):0);return{...e,progress:n,status:n===100?"Completed":n>0?"In Progress":"Not Started"}}),f=g.some(e=>e.progress>0)?"Continue Learning":"Start Learning";return r.jsxs("div",{children:[r.jsxs("div",{className:"flex justify-between items-center mb-6 px-1",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-[14px] bg-indigo-50 border border-indigo-100 flex items-center justify-center text-indigo-500 shadow-inner",children:r.jsx(k,{size:20,strokeWidth:2.5})}),r.jsx("h2",{className:"font-display font-black text-[24px] text-slate-800 tracking-tight",children:f})]}),r.jsxs("button",{onClick:()=>c?.(),className:"text-primary font-bold text-sm flex items-center gap-1 hover:gap-2 transition-all bg-primary/10 px-4 py-2 rounded-xl hover:bg-primary/20",children:["View All ",r.jsx(L,{size:16})]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-6",children:g.map((e,t)=>r.jsx(S,{module:e,index:t,onClick:()=>c?.(e.id),isAtRisk:i.length>0,badgeLabel:e.status!=="Not Started"?e.status:void 0},e.id))})]})};export{V as default};
assets/{LoginPage-DLaoyzV8.js β†’ LoginPage-LluNGRPB.js} RENAMED
@@ -1 +1 @@
1
- import{r as s,j as e}from"./vendor-react-B4AQeu28.js";import{B as Me}from"./button-DCfeFHoH.js";import{I as D}from"./input-D28h_UTJ.js";import{m as r,B as Ee,T as Te,A as Re,U as te,G as se,a as ae,L as re,b as ie,s as oe,c as Ce,d as le}from"./index-BaOs5Ayg.js";import{S as Ie}from"./sparkles-By-vFjpv.js";import{M as Le}from"./mail-BbG1phxL.js";import{E as De,a as ze}from"./eye-Ig3S6mOs.js";import{S as qe}from"./shield-check-Dgisjfmb.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-markdown-yqZQ_iQm.js";const ne="/assets/shader-bg-DA7bEbBA.mp4",Be=[{id:"length",label:"At least 8 characters",test:i=>i.length>=8},{id:"upper-lower",label:"Contains uppercase and lowercase letters",test:i=>/[A-Z]/.test(i)&&/[a-z]/.test(i)},{id:"number",label:"Contains at least one number",test:i=>/\d/.test(i)},{id:"special",label:"Contains at least one special character",test:i=>/[^A-Za-z0-9]/.test(i)}],z="Use at least 8 characters with uppercase, lowercase, number, and special character.",Oe=i=>{const c=typeof i=="object"&&i!==null?i:null,o=i instanceof Error?i.message:"";if(c?.code&&typeof c.code=="string")return{code:c.code.toLowerCase(),message:o};const d=o.match(/auth\/[a-z-]+/i);return{code:d?d[0].toLowerCase():"",message:o}},_e=i=>i.replace(/^Firebase:\s*/i,"").replace(/\s*\(auth\/[a-z-]+\)\.?/i,"").trim(),ce=(i,c)=>{const{code:o,message:d}=Oe(i),h=_e(d);return o==="auth/invalid-credential"||o==="auth/wrong-password"||o==="auth/user-not-found"?"Invalid email or password. Please check your credentials and try again.":o==="auth/email-already-in-use"?"This email is already registered. Please sign in instead.":o==="auth/weak-password"||o==="auth/password-does-not-meet-requirements"?h?`Password does not meet signup requirements. ${h}`:`Password does not meet signup requirements. ${z}`:o==="auth/too-many-requests"?"Access to this account has been temporarily disabled due to many failed login attempts. You can immediately restore it by resetting your password or you can try again later.":o==="auth/network-request-failed"?"Network error. Please check your internet connection and try again.":o.startsWith("auth/")?h||c:d.includes("Firebase:")||d.includes("auth/")?c:d||c},rt=()=>{const i=["Grade 11"],c={"Grade 11":["STEM A","STEM B","ABM A","HUMSS A"]},o={teacher:["Mathematics","Science","English","Technology","Humanities"]},[d,h]=s.useState(""),[f,q]=s.useState(""),[A,de]=s.useState(!1),[l,B]=s.useState(!1),[M,ue]=s.useState(""),[n,O]=s.useState("student"),[b,me]=s.useState("Grade 11"),[w,_]=s.useState(c["Grade 11"][0]),[g,V]=s.useState("Mathematics"),[G,x]=s.useState(!1),[v,m]=s.useState(null),[pe,xe]=s.useState(!1),[ye,he]=s.useState(!1),[E,be]=s.useState(16),[F,U]=s.useState("primary"),[$,T]=s.useState(0),R=s.useRef(null),C=s.useRef(null),N=pe&&ye,j=s.useRef("primary"),k=s.useRef(0),S=s.useRef(!1),W=1.1,H=.34,Y=t=>{const a=Math.max(0,Math.min(1,t));Math.abs(k.current-a)<.02||(k.current=a,T(a))},Z=t=>{!Number.isFinite(t)||t<=0||Math.abs(E-t)>.05&&be(t)},I=s.useMemo(()=>Be.map(t=>({...t,met:t.test(f)})),[f]),fe=s.useMemo(()=>I.every(t=>t.met),[I]),J=s.useMemo(()=>{if(!l||!v)return!1;const t=v.toLowerCase();return t.includes("password requirements not met")||t.includes("password does not meet")},[v,l]),ge=()=>{const t=R.current?.duration;t&&Number.isFinite(t)&&t>0&&Z(t)},ve=()=>{const t=C.current?.duration;t&&Number.isFinite(t)&&t>0&&Z(t)};s.useEffect(()=>{if(!N)return;const t=R.current,a=C.current;if(!t||!a)return;let u=!1,p=0;j.current="primary",U("primary"),S.current=!1,k.current=0,T(0),t.loop=!1,a.loop=!1,t.currentTime=0,a.currentTime=0,a.pause(),t.play().catch(()=>{});const P=()=>{if(u)return;const y=j.current==="primary"?t:a,K=j.current==="primary"?a:t,Pe=Number.isFinite(y.duration)&&y.duration>0?y.duration:E,L=Math.max(Pe-y.currentTime,0);if(L<=W){S.current||(S.current=!0,K.currentTime=0,K.play().catch(()=>{}));const Ae=1-L/W;if(Y(Ae),L<=.03||y.ended){y.pause(),y.currentTime=0;const ee=j.current==="primary"?"secondary":"primary";j.current=ee,U(ee),S.current=!1,k.current=0,T(0)}}else Y(0);p=window.requestAnimationFrame(P)};return p=window.requestAnimationFrame(P),()=>{u=!0,p&&window.cancelAnimationFrame(p)}},[E,N]);const Q=N?H*(1-$):0,X=N?H*$:0,je=F==="primary"?Q:X,we=F==="secondary"?Q:X;s.useEffect(()=>{n==="teacher"&&!o.teacher.includes(g)&&V(o.teacher[0])},[g,n]),s.useEffect(()=>{const t=c[b]||[];t.length>0&&!t.includes(w)&&_(t[0])},[b,w]);const Ne=[{label:"Student",role:"student",email:"teststudent@school.edu",password:"TestPass123!",icon:se,color:"sky"},{label:"Teacher",role:"teacher",email:"testteacher@school.edu",password:"TestPass123!",icon:ae,color:"emerald"},{label:"Admin",role:"admin",email:"testadmin@school.edu",password:"TestPass123!",icon:qe,color:"rose"}],ke=async(t,a,u)=>{m(null),x(!0),h(t),q(a),O(u),B(!1);try{oe(u),await le(t,a)}catch(p){m(ce(p,"Demo sign-in failed. Please try again.")),x(!1)}},Se=async t=>{t.preventDefault(),m(null),x(!0);try{if(l){if(!M.trim()){m("Please enter your name"),x(!1);return}if(n==="student"&&!b){m("Please select a grade level"),x(!1);return}if(n!=="student"&&!g){m("Please select a department"),x(!1);return}if(n==="admin"){m("Admin account creation is restricted. Please contact an existing administrator."),x(!1);return}if(!fe){m(`Password does not meet signup requirements. ${z}`),x(!1);return}oe(n),await Ce(d,f,M,n,n==="student"?{grade:b,section:w}:{department:g})}else await le(d,f)}catch(a){const u=l?`Sign-up failed. ${z}`:"Sign-in failed. Please check your credentials and try again.";m(ce(a,u)),x(!1)}};return e.jsxs("div",{className:"h-screen w-full flex items-center justify-center px-6 overflow-hidden relative login-bg",children:[e.jsx("video",{ref:R,autoPlay:!0,muted:!0,playsInline:!0,preload:"auto",onCanPlay:()=>xe(!0),onLoadedMetadata:ge,className:"absolute inset-0 w-full h-full object-cover transition-opacity duration-150 e-opacity",style:{"--o":je},src:ne}),e.jsx("video",{ref:C,autoPlay:!0,muted:!0,playsInline:!0,preload:"auto",onCanPlay:()=>he(!0),onLoadedMetadata:ve,className:"absolute inset-0 w-full h-full object-cover transition-opacity duration-150 e-opacity",style:{"--o":we},src:ne}),e.jsx("div",{className:"absolute inset-0 pointer-events-none login-frost-overlay"}),e.jsx("div",{className:"absolute top-[10%] left-[-10%] w-[60%] h-[60%] rounded-full blur-[140px] pointer-events-none mix-blend-multiply login-orb-purple"}),e.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[70%] h-[70%] rounded-full blur-[160px] pointer-events-none mix-blend-multiply login-orb-pink"}),e.jsx("div",{className:"absolute top-[40%] left-[40%] w-[40%] h-[40%] rounded-full blur-[120px] pointer-events-none mix-blend-screen login-orb-blue"}),e.jsx("div",{className:"relative z-10 w-full max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-12 items-center",children:[e.jsxs(r.div,{initial:{opacity:0,x:-40},animate:{opacity:1,x:0},transition:{duration:.8,ease:[.22,1,.36,1]},className:"flex flex-col justify-center space-y-8",children:[e.jsxs(r.div,{className:"flex items-center gap-2.5",children:[e.jsx(r.div,{className:"relative flex items-center justify-center drop-shadow-md",children:e.jsx("img",{src:"/mathpulse_logo.png",alt:"MathPulse AI Logo",className:"w-16 h-16 object-contain flex-shrink-0"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-display font-black tracking-tight text-slate-900 bg-clip-text text-transparent bg-gradient-to-r from-purple-600 via-pink-600 to-sky-500",children:"MathPulse"}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(Ie,{size:12,className:"text-rose-500"}),e.jsx("span",{className:"text-xs text-slate-500 font-body font-medium tracking-wide",children:"Powered by Machine Learning"})]})]})]}),e.jsxs(r.div,{className:"space-y-5",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2,duration:.8},children:[e.jsxs("h2",{className:"text-4xl lg:text-5xl xl:text-[3.4rem] font-display font-extrabold leading-[1.1] tracking-tight text-slate-900",children:["Transform Your",e.jsx("br",{}),e.jsx("span",{className:"bg-gradient-to-r from-sky-600 via-cyan-500 to-sky-500 bg-clip-text text-transparent",children:"Math Journey"})]}),e.jsx("p",{className:"text-base text-slate-500 leading-relaxed max-w-md font-body",children:"AI-powered predictive system designed to identify at-risk students and provide personalized learning recommendations."})]}),e.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{icon:Ee,label:"AI Predictions",desc:"Smart detection",color:"sky"},{icon:Te,label:"Analytics",desc:"Real-time data",color:"rose"},{icon:Re,label:"Gamified",desc:"Learn & earn",color:"emerald"}].map((t,a)=>{const u=t.icon,p={sky:"border-sky-200/60 hover:border-sky-300",rose:"border-rose-200/60 hover:border-rose-300",emerald:"border-emerald-200/60 hover:border-emerald-300"},P={sky:"text-sky-600",rose:"text-rose-500",emerald:"text-emerald-600"},y={sky:"bg-sky-100",rose:"bg-rose-100",emerald:"bg-emerald-100"};return e.jsxs(r.div,{className:`bg-white/80 backdrop-blur-xl border ${p[t.color]} rounded-xl p-4 transition-all cursor-pointer group shadow-md shadow-slate-900/[0.04]`,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.5+a*.1},whileHover:{scale:1.03,y:-4},children:[e.jsx("div",{className:`w-9 h-9 rounded-lg ${y[t.color]} flex items-center justify-center mb-3`,children:e.jsx(u,{size:18,className:P[t.color]})}),e.jsx("h3",{className:"text-sm font-display font-semibold text-slate-800 mb-0.5",children:t.label}),e.jsx("p",{className:"text-xs text-slate-400 font-body",children:t.desc})]},a)})})]}),e.jsx(r.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.8,delay:.15,ease:[.22,1,.36,1]},className:"relative flex justify-center lg:justify-end",children:e.jsxs("div",{className:"bg-white/85 backdrop-blur-2xl border border-slate-200/60 rounded-3xl p-7 w-full max-w-md relative overflow-hidden shadow-[0_20px_60px_-15px_rgba(168,85,247,0.15)]",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-[3px] bg-gradient-to-r from-purple-500 via-pink-500 to-sky-500"}),e.jsx("div",{className:"absolute -top-40 left-1/2 -translate-x-1/2 w-80 h-80 bg-gradient-to-br from-purple-400/20 to-pink-400/20 rounded-full blur-[60px] pointer-events-none"}),e.jsxs("div",{className:"text-center mb-6 relative",children:[e.jsx(r.h3,{className:"text-2xl font-display font-bold text-slate-900 mb-2",initial:{opacity:0},animate:{opacity:1},transition:{delay:.4},children:l?"Create Account":"Welcome Back"}),e.jsx(r.p,{className:"text-sm text-slate-500 font-body",initial:{opacity:0},animate:{opacity:1},transition:{delay:.5},children:l?"Begin your learning journey":"Sign in to continue learning"})]}),e.jsxs("form",{onSubmit:Se,className:"space-y-4 mb-5 relative",children:[v&&!J&&e.jsx(r.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"bg-rose-50 border border-rose-200 text-rose-600 px-4 py-3 rounded-lg text-sm font-body",children:v}),l&&e.jsxs(r.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Full Name"}),e.jsxs("div",{className:"relative",children:[e.jsx(te,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx(D,{type:"text",placeholder:"Your Name",value:M,onChange:t=>ue(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border-slate-200/80 text-slate-900 placeholder:text-slate-400 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all",required:!0})]})]}),l&&e.jsxs(r.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.45},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Account Type"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{role:"student",label:"Student"},{role:"teacher",label:"Teacher"}].map(t=>{const a=n===t.role;return e.jsx("button",{type:"button",onClick:()=>O(t.role),className:`rounded-lg border px-3 py-2 text-xs font-body font-semibold transition-all ${a?"border-sky-400 bg-sky-50 text-sky-700":"border-slate-200 bg-slate-50 text-slate-500 hover:border-slate-300"}`,children:t.label},t.role)})})]}),l&&n==="student"&&e.jsxs(r.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Grade Level"}),e.jsxs("div",{className:"relative",children:[e.jsx(se,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx("select",{value:b,onChange:t=>me(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border border-slate-200/80 text-slate-900 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all appearance-none",required:!0,children:i.map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),l&&n==="student"&&e.jsxs(r.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Section"}),e.jsxs("div",{className:"relative",children:[e.jsx(te,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx("select",{value:w,onChange:t=>_(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border border-slate-200/80 text-slate-900 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all appearance-none",required:!0,children:(c[b]||[]).map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),l&&n!=="student"&&e.jsxs(r.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Department"}),e.jsxs("div",{className:"relative",children:[e.jsx(ae,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx("select",{value:g,onChange:t=>V(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border border-slate-200/80 text-slate-900 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all appearance-none",required:!0,children:o.teacher.map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),e.jsxs(r.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.5},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Email Address"}),e.jsxs("div",{className:"relative",children:[e.jsx(Le,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx(D,{type:"email",placeholder:"your.email@school.edu",value:d,onChange:t=>h(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border-slate-200/80 text-slate-900 placeholder:text-slate-400 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all",required:!0})]})]}),e.jsxs(r.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.6},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx(D,{type:A?"text":"password",placeholder:"β€’β€’β€’β€’β€’β€’β€’β€’",value:f,onChange:t=>q(t.target.value),className:"w-full pl-11 pr-11 py-3 rounded-lg bg-slate-100/70 border-slate-200/80 text-slate-900 placeholder:text-slate-400 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all",required:!0,minLength:l?8:6}),e.jsx(r.button,{type:"button",onClick:()=>de(!A),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 transition-colors",whileTap:{scale:.9},children:A?e.jsx(De,{size:16}):e.jsx(ze,{size:16})})]}),l&&e.jsxs("div",{className:"mt-2 rounded-lg border border-sky-100/80 bg-sky-50/70 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] font-body font-semibold uppercase tracking-wider text-slate-600",children:"Password requirements"}),e.jsx("ul",{className:"mt-2 space-y-1",children:I.map(t=>e.jsxs("li",{className:`flex items-center gap-2 text-[11px] font-body ${t.met?"text-emerald-700":"text-slate-500"}`,children:[e.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${t.met?"bg-emerald-500":"bg-slate-300"}`}),e.jsx("span",{children:t.label})]},t.id))}),J&&e.jsx("p",{className:"mt-2 text-[11px] font-body font-semibold text-rose-600",children:"Password does not meet signup requirements."})]})]}),e.jsx(r.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.7},children:e.jsxs(Me,{type:"submit",disabled:G,className:"w-full bg-gradient-to-r from-purple-600 to-pink-500 hover:from-purple-500 hover:to-pink-400 text-white font-body font-semibold py-3 rounded-xl shadow-lg shadow-purple-600/25 hover:shadow-pink-500/35 hover:scale-[1.02] transition-all text-sm group relative overflow-hidden disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(r.span,{className:"absolute inset-0 bg-gradient-to-r from-white/0 via-white/15 to-white/0",animate:{x:["-100%","100%"]},transition:{duration:3,repeat:1/0,repeatDelay:2}}),e.jsxs("span",{className:"relative flex items-center justify-center gap-2",children:[G?"Please wait...":l?"Create Account":"Sign In",e.jsx(ie,{size:16,className:"group-hover:translate-x-1 transition-transform"})]})]})}),e.jsx("div",{className:"text-center",children:e.jsx("button",{type:"button",onClick:()=>{B(!l),m(null)},className:"text-sm text-slate-400 hover:text-sky-500 font-body font-medium transition-colors",children:l?"Already have an account? Sign in":"Don't have an account? Create one"})})]}),!l&&e.jsxs(r.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.85},className:"mb-4 relative",children:[e.jsxs("div",{className:"relative flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"flex-1 h-px bg-slate-200"}),e.jsx("span",{className:"text-[10px] font-body font-semibold text-slate-400 uppercase tracking-widest",children:"Quick Demo Access"}),e.jsx("div",{className:"flex-1 h-px bg-slate-200"})]}),e.jsx("div",{className:"flex flex-col gap-2",children:Ne.map(t=>{const a=t.icon,u={sky:"bg-sky-100",emerald:"bg-emerald-100",rose:"bg-rose-100"},p={sky:"text-sky-600",emerald:"text-emerald-600",rose:"text-rose-500"};return e.jsxs(r.button,{type:"button",onClick:()=>ke(t.email,t.password,t.role),className:"group flex items-center gap-3 w-full px-4 py-2.5 rounded-lg bg-slate-50/80 border border-slate-200/70 hover:border-sky-300 hover:bg-sky-50/80 hover:shadow-sm transition-all text-left",whileHover:{scale:1.01},whileTap:{scale:.99},children:[e.jsx("div",{className:`w-8 h-8 rounded-md flex items-center justify-center shrink-0 ${u[t.color]}`,children:e.jsx(a,{size:15,className:p[t.color]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-xs font-body font-semibold text-slate-700 group-hover:text-sky-600 transition-colors",children:[t.label," Account"]}),e.jsx("p",{className:"text-[10px] text-slate-400 font-body truncate",children:t.email})]}),e.jsx(ie,{size:14,className:"text-slate-300 group-hover:text-sky-500 group-hover:translate-x-0.5 transition-all shrink-0"})]},t.label)})})]}),e.jsxs(r.p,{className:"text-xs text-slate-400 text-center mt-4 font-body relative",initial:{opacity:0},animate:{opacity:1},transition:{delay:1},children:[e.jsx(re,{size:10,className:"inline mr-1 -mt-0.5"})," Your data is encrypted and secure"]})]})})]})})]})};export{rt as default};
 
1
+ import{r as s,j as e}from"./vendor-react-B4AQeu28.js";import{B as Me}from"./button-BPmLcOpC.js";import{I as D}from"./input--XHWlmp1.js";import{m as r,B as Ee,T as Te,A as Re,U as te,G as se,a as ae,L as re,b as ie,s as oe,c as Ce,d as le}from"./index-uASBzalf.js";import{S as Ie}from"./sparkles-DHVr5IP1.js";import{M as Le}from"./mail-BF4xxwnI.js";import{E as De,a as ze}from"./eye-DIwMshM-.js";import{S as qe}from"./shield-check-vm2tbr1-.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-markdown-yqZQ_iQm.js";const ne="/assets/shader-bg-DA7bEbBA.mp4",Be=[{id:"length",label:"At least 8 characters",test:i=>i.length>=8},{id:"upper-lower",label:"Contains uppercase and lowercase letters",test:i=>/[A-Z]/.test(i)&&/[a-z]/.test(i)},{id:"number",label:"Contains at least one number",test:i=>/\d/.test(i)},{id:"special",label:"Contains at least one special character",test:i=>/[^A-Za-z0-9]/.test(i)}],z="Use at least 8 characters with uppercase, lowercase, number, and special character.",Oe=i=>{const c=typeof i=="object"&&i!==null?i:null,o=i instanceof Error?i.message:"";if(c?.code&&typeof c.code=="string")return{code:c.code.toLowerCase(),message:o};const d=o.match(/auth\/[a-z-]+/i);return{code:d?d[0].toLowerCase():"",message:o}},_e=i=>i.replace(/^Firebase:\s*/i,"").replace(/\s*\(auth\/[a-z-]+\)\.?/i,"").trim(),ce=(i,c)=>{const{code:o,message:d}=Oe(i),h=_e(d);return o==="auth/invalid-credential"||o==="auth/wrong-password"||o==="auth/user-not-found"?"Invalid email or password. Please check your credentials and try again.":o==="auth/email-already-in-use"?"This email is already registered. Please sign in instead.":o==="auth/weak-password"||o==="auth/password-does-not-meet-requirements"?h?`Password does not meet signup requirements. ${h}`:`Password does not meet signup requirements. ${z}`:o==="auth/too-many-requests"?"Access to this account has been temporarily disabled due to many failed login attempts. You can immediately restore it by resetting your password or you can try again later.":o==="auth/network-request-failed"?"Network error. Please check your internet connection and try again.":o.startsWith("auth/")?h||c:d.includes("Firebase:")||d.includes("auth/")?c:d||c},rt=()=>{const i=["Grade 11"],c={"Grade 11":["STEM A","STEM B","ABM A","HUMSS A"]},o={teacher:["Mathematics","Science","English","Technology","Humanities"]},[d,h]=s.useState(""),[f,q]=s.useState(""),[A,de]=s.useState(!1),[l,B]=s.useState(!1),[M,ue]=s.useState(""),[n,O]=s.useState("student"),[b,me]=s.useState("Grade 11"),[w,_]=s.useState(c["Grade 11"][0]),[g,V]=s.useState("Mathematics"),[G,x]=s.useState(!1),[v,m]=s.useState(null),[pe,xe]=s.useState(!1),[ye,he]=s.useState(!1),[E,be]=s.useState(16),[F,U]=s.useState("primary"),[$,T]=s.useState(0),R=s.useRef(null),C=s.useRef(null),N=pe&&ye,j=s.useRef("primary"),k=s.useRef(0),S=s.useRef(!1),W=1.1,H=.34,Y=t=>{const a=Math.max(0,Math.min(1,t));Math.abs(k.current-a)<.02||(k.current=a,T(a))},Z=t=>{!Number.isFinite(t)||t<=0||Math.abs(E-t)>.05&&be(t)},I=s.useMemo(()=>Be.map(t=>({...t,met:t.test(f)})),[f]),fe=s.useMemo(()=>I.every(t=>t.met),[I]),J=s.useMemo(()=>{if(!l||!v)return!1;const t=v.toLowerCase();return t.includes("password requirements not met")||t.includes("password does not meet")},[v,l]),ge=()=>{const t=R.current?.duration;t&&Number.isFinite(t)&&t>0&&Z(t)},ve=()=>{const t=C.current?.duration;t&&Number.isFinite(t)&&t>0&&Z(t)};s.useEffect(()=>{if(!N)return;const t=R.current,a=C.current;if(!t||!a)return;let u=!1,p=0;j.current="primary",U("primary"),S.current=!1,k.current=0,T(0),t.loop=!1,a.loop=!1,t.currentTime=0,a.currentTime=0,a.pause(),t.play().catch(()=>{});const P=()=>{if(u)return;const y=j.current==="primary"?t:a,K=j.current==="primary"?a:t,Pe=Number.isFinite(y.duration)&&y.duration>0?y.duration:E,L=Math.max(Pe-y.currentTime,0);if(L<=W){S.current||(S.current=!0,K.currentTime=0,K.play().catch(()=>{}));const Ae=1-L/W;if(Y(Ae),L<=.03||y.ended){y.pause(),y.currentTime=0;const ee=j.current==="primary"?"secondary":"primary";j.current=ee,U(ee),S.current=!1,k.current=0,T(0)}}else Y(0);p=window.requestAnimationFrame(P)};return p=window.requestAnimationFrame(P),()=>{u=!0,p&&window.cancelAnimationFrame(p)}},[E,N]);const Q=N?H*(1-$):0,X=N?H*$:0,je=F==="primary"?Q:X,we=F==="secondary"?Q:X;s.useEffect(()=>{n==="teacher"&&!o.teacher.includes(g)&&V(o.teacher[0])},[g,n]),s.useEffect(()=>{const t=c[b]||[];t.length>0&&!t.includes(w)&&_(t[0])},[b,w]);const Ne=[{label:"Student",role:"student",email:"teststudent@school.edu",password:"TestPass123!",icon:se,color:"sky"},{label:"Teacher",role:"teacher",email:"testteacher@school.edu",password:"TestPass123!",icon:ae,color:"emerald"},{label:"Admin",role:"admin",email:"testadmin@school.edu",password:"TestPass123!",icon:qe,color:"rose"}],ke=async(t,a,u)=>{m(null),x(!0),h(t),q(a),O(u),B(!1);try{oe(u),await le(t,a)}catch(p){m(ce(p,"Demo sign-in failed. Please try again.")),x(!1)}},Se=async t=>{t.preventDefault(),m(null),x(!0);try{if(l){if(!M.trim()){m("Please enter your name"),x(!1);return}if(n==="student"&&!b){m("Please select a grade level"),x(!1);return}if(n!=="student"&&!g){m("Please select a department"),x(!1);return}if(n==="admin"){m("Admin account creation is restricted. Please contact an existing administrator."),x(!1);return}if(!fe){m(`Password does not meet signup requirements. ${z}`),x(!1);return}oe(n),await Ce(d,f,M,n,n==="student"?{grade:b,section:w}:{department:g})}else await le(d,f)}catch(a){const u=l?`Sign-up failed. ${z}`:"Sign-in failed. Please check your credentials and try again.";m(ce(a,u)),x(!1)}};return e.jsxs("div",{className:"h-screen w-full flex items-center justify-center px-6 overflow-hidden relative login-bg",children:[e.jsx("video",{ref:R,autoPlay:!0,muted:!0,playsInline:!0,preload:"auto",onCanPlay:()=>xe(!0),onLoadedMetadata:ge,className:"absolute inset-0 w-full h-full object-cover transition-opacity duration-150 e-opacity",style:{"--o":je},src:ne}),e.jsx("video",{ref:C,autoPlay:!0,muted:!0,playsInline:!0,preload:"auto",onCanPlay:()=>he(!0),onLoadedMetadata:ve,className:"absolute inset-0 w-full h-full object-cover transition-opacity duration-150 e-opacity",style:{"--o":we},src:ne}),e.jsx("div",{className:"absolute inset-0 pointer-events-none login-frost-overlay"}),e.jsx("div",{className:"absolute top-[10%] left-[-10%] w-[60%] h-[60%] rounded-full blur-[140px] pointer-events-none mix-blend-multiply login-orb-purple"}),e.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[70%] h-[70%] rounded-full blur-[160px] pointer-events-none mix-blend-multiply login-orb-pink"}),e.jsx("div",{className:"absolute top-[40%] left-[40%] w-[40%] h-[40%] rounded-full blur-[120px] pointer-events-none mix-blend-screen login-orb-blue"}),e.jsx("div",{className:"relative z-10 w-full max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-12 items-center",children:[e.jsxs(r.div,{initial:{opacity:0,x:-40},animate:{opacity:1,x:0},transition:{duration:.8,ease:[.22,1,.36,1]},className:"flex flex-col justify-center space-y-8",children:[e.jsxs(r.div,{className:"flex items-center gap-2.5",children:[e.jsx(r.div,{className:"relative flex items-center justify-center drop-shadow-md",children:e.jsx("img",{src:"/mathpulse_logo.png",alt:"MathPulse AI Logo",className:"w-16 h-16 object-contain flex-shrink-0"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-display font-black tracking-tight text-slate-900 bg-clip-text text-transparent bg-gradient-to-r from-purple-600 via-pink-600 to-sky-500",children:"MathPulse"}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(Ie,{size:12,className:"text-rose-500"}),e.jsx("span",{className:"text-xs text-slate-500 font-body font-medium tracking-wide",children:"Powered by Machine Learning"})]})]})]}),e.jsxs(r.div,{className:"space-y-5",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2,duration:.8},children:[e.jsxs("h2",{className:"text-4xl lg:text-5xl xl:text-[3.4rem] font-display font-extrabold leading-[1.1] tracking-tight text-slate-900",children:["Transform Your",e.jsx("br",{}),e.jsx("span",{className:"bg-gradient-to-r from-sky-600 via-cyan-500 to-sky-500 bg-clip-text text-transparent",children:"Math Journey"})]}),e.jsx("p",{className:"text-base text-slate-500 leading-relaxed max-w-md font-body",children:"AI-powered predictive system designed to identify at-risk students and provide personalized learning recommendations."})]}),e.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{icon:Ee,label:"AI Predictions",desc:"Smart detection",color:"sky"},{icon:Te,label:"Analytics",desc:"Real-time data",color:"rose"},{icon:Re,label:"Gamified",desc:"Learn & earn",color:"emerald"}].map((t,a)=>{const u=t.icon,p={sky:"border-sky-200/60 hover:border-sky-300",rose:"border-rose-200/60 hover:border-rose-300",emerald:"border-emerald-200/60 hover:border-emerald-300"},P={sky:"text-sky-600",rose:"text-rose-500",emerald:"text-emerald-600"},y={sky:"bg-sky-100",rose:"bg-rose-100",emerald:"bg-emerald-100"};return e.jsxs(r.div,{className:`bg-white/80 backdrop-blur-xl border ${p[t.color]} rounded-xl p-4 transition-all cursor-pointer group shadow-md shadow-slate-900/[0.04]`,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.5+a*.1},whileHover:{scale:1.03,y:-4},children:[e.jsx("div",{className:`w-9 h-9 rounded-lg ${y[t.color]} flex items-center justify-center mb-3`,children:e.jsx(u,{size:18,className:P[t.color]})}),e.jsx("h3",{className:"text-sm font-display font-semibold text-slate-800 mb-0.5",children:t.label}),e.jsx("p",{className:"text-xs text-slate-400 font-body",children:t.desc})]},a)})})]}),e.jsx(r.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.8,delay:.15,ease:[.22,1,.36,1]},className:"relative flex justify-center lg:justify-end",children:e.jsxs("div",{className:"bg-white/85 backdrop-blur-2xl border border-slate-200/60 rounded-3xl p-7 w-full max-w-md relative overflow-hidden shadow-[0_20px_60px_-15px_rgba(168,85,247,0.15)]",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-[3px] bg-gradient-to-r from-purple-500 via-pink-500 to-sky-500"}),e.jsx("div",{className:"absolute -top-40 left-1/2 -translate-x-1/2 w-80 h-80 bg-gradient-to-br from-purple-400/20 to-pink-400/20 rounded-full blur-[60px] pointer-events-none"}),e.jsxs("div",{className:"text-center mb-6 relative",children:[e.jsx(r.h3,{className:"text-2xl font-display font-bold text-slate-900 mb-2",initial:{opacity:0},animate:{opacity:1},transition:{delay:.4},children:l?"Create Account":"Welcome Back"}),e.jsx(r.p,{className:"text-sm text-slate-500 font-body",initial:{opacity:0},animate:{opacity:1},transition:{delay:.5},children:l?"Begin your learning journey":"Sign in to continue learning"})]}),e.jsxs("form",{onSubmit:Se,className:"space-y-4 mb-5 relative",children:[v&&!J&&e.jsx(r.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"bg-rose-50 border border-rose-200 text-rose-600 px-4 py-3 rounded-lg text-sm font-body",children:v}),l&&e.jsxs(r.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Full Name"}),e.jsxs("div",{className:"relative",children:[e.jsx(te,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx(D,{type:"text",placeholder:"Your Name",value:M,onChange:t=>ue(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border-slate-200/80 text-slate-900 placeholder:text-slate-400 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all",required:!0})]})]}),l&&e.jsxs(r.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.45},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Account Type"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{role:"student",label:"Student"},{role:"teacher",label:"Teacher"}].map(t=>{const a=n===t.role;return e.jsx("button",{type:"button",onClick:()=>O(t.role),className:`rounded-lg border px-3 py-2 text-xs font-body font-semibold transition-all ${a?"border-sky-400 bg-sky-50 text-sky-700":"border-slate-200 bg-slate-50 text-slate-500 hover:border-slate-300"}`,children:t.label},t.role)})})]}),l&&n==="student"&&e.jsxs(r.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Grade Level"}),e.jsxs("div",{className:"relative",children:[e.jsx(se,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx("select",{value:b,onChange:t=>me(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border border-slate-200/80 text-slate-900 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all appearance-none",required:!0,children:i.map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),l&&n==="student"&&e.jsxs(r.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Section"}),e.jsxs("div",{className:"relative",children:[e.jsx(te,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx("select",{value:w,onChange:t=>_(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border border-slate-200/80 text-slate-900 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all appearance-none",required:!0,children:(c[b]||[]).map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),l&&n!=="student"&&e.jsxs(r.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Department"}),e.jsxs("div",{className:"relative",children:[e.jsx(ae,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx("select",{value:g,onChange:t=>V(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border border-slate-200/80 text-slate-900 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all appearance-none",required:!0,children:o.teacher.map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),e.jsxs(r.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.5},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Email Address"}),e.jsxs("div",{className:"relative",children:[e.jsx(Le,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx(D,{type:"email",placeholder:"your.email@school.edu",value:d,onChange:t=>h(t.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg bg-slate-100/70 border-slate-200/80 text-slate-900 placeholder:text-slate-400 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all",required:!0})]})]}),e.jsxs(r.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.6},children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-slate-500 mb-2 uppercase tracking-wider",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{size:16,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx(D,{type:A?"text":"password",placeholder:"β€’β€’β€’β€’β€’β€’β€’β€’",value:f,onChange:t=>q(t.target.value),className:"w-full pl-11 pr-11 py-3 rounded-lg bg-slate-100/70 border-slate-200/80 text-slate-900 placeholder:text-slate-400 focus:border-sky-400 focus:ring-2 focus:ring-sky-400/20 focus:bg-white text-sm font-body transition-all",required:!0,minLength:l?8:6}),e.jsx(r.button,{type:"button",onClick:()=>de(!A),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 transition-colors",whileTap:{scale:.9},children:A?e.jsx(De,{size:16}):e.jsx(ze,{size:16})})]}),l&&e.jsxs("div",{className:"mt-2 rounded-lg border border-sky-100/80 bg-sky-50/70 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] font-body font-semibold uppercase tracking-wider text-slate-600",children:"Password requirements"}),e.jsx("ul",{className:"mt-2 space-y-1",children:I.map(t=>e.jsxs("li",{className:`flex items-center gap-2 text-[11px] font-body ${t.met?"text-emerald-700":"text-slate-500"}`,children:[e.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${t.met?"bg-emerald-500":"bg-slate-300"}`}),e.jsx("span",{children:t.label})]},t.id))}),J&&e.jsx("p",{className:"mt-2 text-[11px] font-body font-semibold text-rose-600",children:"Password does not meet signup requirements."})]})]}),e.jsx(r.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.7},children:e.jsxs(Me,{type:"submit",disabled:G,className:"w-full bg-gradient-to-r from-purple-600 to-pink-500 hover:from-purple-500 hover:to-pink-400 text-white font-body font-semibold py-3 rounded-xl shadow-lg shadow-purple-600/25 hover:shadow-pink-500/35 hover:scale-[1.02] transition-all text-sm group relative overflow-hidden disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(r.span,{className:"absolute inset-0 bg-gradient-to-r from-white/0 via-white/15 to-white/0",animate:{x:["-100%","100%"]},transition:{duration:3,repeat:1/0,repeatDelay:2}}),e.jsxs("span",{className:"relative flex items-center justify-center gap-2",children:[G?"Please wait...":l?"Create Account":"Sign In",e.jsx(ie,{size:16,className:"group-hover:translate-x-1 transition-transform"})]})]})}),e.jsx("div",{className:"text-center",children:e.jsx("button",{type:"button",onClick:()=>{B(!l),m(null)},className:"text-sm text-slate-400 hover:text-sky-500 font-body font-medium transition-colors",children:l?"Already have an account? Sign in":"Don't have an account? Create one"})})]}),!l&&e.jsxs(r.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.85},className:"mb-4 relative",children:[e.jsxs("div",{className:"relative flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"flex-1 h-px bg-slate-200"}),e.jsx("span",{className:"text-[10px] font-body font-semibold text-slate-400 uppercase tracking-widest",children:"Quick Demo Access"}),e.jsx("div",{className:"flex-1 h-px bg-slate-200"})]}),e.jsx("div",{className:"flex flex-col gap-2",children:Ne.map(t=>{const a=t.icon,u={sky:"bg-sky-100",emerald:"bg-emerald-100",rose:"bg-rose-100"},p={sky:"text-sky-600",emerald:"text-emerald-600",rose:"text-rose-500"};return e.jsxs(r.button,{type:"button",onClick:()=>ke(t.email,t.password,t.role),className:"group flex items-center gap-3 w-full px-4 py-2.5 rounded-lg bg-slate-50/80 border border-slate-200/70 hover:border-sky-300 hover:bg-sky-50/80 hover:shadow-sm transition-all text-left",whileHover:{scale:1.01},whileTap:{scale:.99},children:[e.jsx("div",{className:`w-8 h-8 rounded-md flex items-center justify-center shrink-0 ${u[t.color]}`,children:e.jsx(a,{size:15,className:p[t.color]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-xs font-body font-semibold text-slate-700 group-hover:text-sky-600 transition-colors",children:[t.label," Account"]}),e.jsx("p",{className:"text-[10px] text-slate-400 font-body truncate",children:t.email})]}),e.jsx(ie,{size:14,className:"text-slate-300 group-hover:text-sky-500 group-hover:translate-x-0.5 transition-all shrink-0"})]},t.label)})})]}),e.jsxs(r.p,{className:"text-xs text-slate-400 text-center mt-4 font-body relative",initial:{opacity:0},animate:{opacity:1},transition:{delay:1},children:[e.jsx(re,{size:10,className:"inline mr-1 -mt-0.5"})," Your data is encrypted and secure"]})]})})]})})]})};export{rt as default};
assets/{LogoutActionButton-lUNItet6.js β†’ LogoutActionButton-Dl6IiDHd.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e as a,m as s,i}from"./index-BaOs5Ayg.js";import{j as t}from"./vendor-react-B4AQeu28.js";import{L as l}from"./log-out-BenDMDly.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e as a,m as s,k as i}from"./index-uASBzalf.js";import{j as t}from"./vendor-react-B4AQeu28.js";import{L as l}from"./log-out-Dr0BHRO4.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{ModuleFolderCard-DKBrO5a8.js β†’ ModuleFolderCard-Du9VPsWG.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{j as e}from"./vendor-react-B4AQeu28.js";import{u as g}from"./useSubjectAvailability-Bvu3fXaT.js";import{e as w,m as f,a as j,p as v,L as k}from"./index-BaOs5Ayg.js";import{C as y}from"./clock-D1Ecvltm.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{j as e}from"./vendor-react-B4AQeu28.js";import{u as g}from"./useSubjectAvailability-jmWCWhoq.js";import{e as w,m as f,a as j,w as v,L as k}from"./index-uASBzalf.js";import{C as y}from"./clock-8t0UYgg3.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{ModulesPage-cZJm_yoJ.js β†’ ModulesPage-Bm1A4Op1.js} RENAMED
The diff for this file is too large to render. See raw diff
 
assets/{ProfileModal-Gwxh5tYO.js β†’ ProfileModal-bQKyq1JA.js} RENAMED
@@ -1,11 +1,11 @@
1
- import{r,j as e}from"./vendor-react-B4AQeu28.js";import{B as c}from"./button-DCfeFHoH.js";import{I as d}from"./input-D28h_UTJ.js";import{S as _,a as R,c as U,d as h}from"./select-DIjxRWza.js";import{e as S,j as D,m as k,U as u,A as x,a as w,z as B,aM as T,aD as q,aO as G}from"./index-BaOs5Ayg.js";import{P as V,M as z,V as C}from"./ProfilePictureUploader-CX_IZAwE.js";import{X}from"./x-TNvtuOD9.js";import{M as Y}from"./mail-BbG1phxL.js";import{C as L}from"./circle-help-B8apTIdU.js";import{S as $}from"./save-CQIJrhLf.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./chevron-up-Cdvz2TMJ.js";import"./check-BLSo9L0H.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-markdown-yqZQ_iQm.js";import"./minus-DfrEv-SC.js";import"./plus-DkG35AoH.js";import"./upload-DayXhGwD.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const O=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]],H=S("building",O);/**
7
  * @license lucide-react v0.487.0 - ISC
8
  *
9
  * This source code is licensed under the ISC license.
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const K=[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]],Q=S("phone",K),ye=({isOpen:i,onClose:o,profileData:p,onSave:M})=>{const[s,t]=r.useState(p),[l,b]=r.useState(!1),[E,g]=r.useState(!1),[m,j]=r.useState([]),[y,v]=r.useState(0);r.useEffect(()=>{if(!i)return;const a=n=>{n.key==="Escape"&&o()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[i,o]),r.useEffect(()=>{if(!i||s.role!=="student"||!s.uid)return;const a=s.uid;(async()=>{g(!0);try{const[f,F]=await Promise.all([q(void 0,!1,"all",5),G(a)]);j(f),v(F)}catch(f){console.error("Failed to load leaderboard for profile modal:",f),j([]),v(0)}finally{g(!1)}})()},[i,s.role,s.uid]);const I=()=>{M(s),b(!1)},P=()=>{t(p),b(!1)},A=a=>{switch(a){case"student":return"bg-sky-100 text-sky-700 border-sky-200";case"teacher":return"bg-rose-100 text-rose-700 border-rose-200";case"admin":return"bg-rose-100 text-rose-700 border-rose-200";default:return"bg-zinc-100 text-zinc-700 border-zinc-200"}},N=m.find(a=>a.userId===s.uid);return e.jsx(D,{children:i&&e.jsxs(e.Fragment,{children:[e.jsx(k.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:o,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50"}),e.jsx(k.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",duration:.5},className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:a=>a.stopPropagation(),children:e.jsxs("div",{className:"bg-[#f7f9fc] rounded-2xl shadow-2xl w-full max-w-3xl max-h-[90vh] overflow-hidden border border-[#dde3eb]",children:[e.jsxs("div",{className:"bg-gradient-to-r from-sky-600 to-sky-500 p-6 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-white/30 to-transparent"}),e.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 bg-white/10 rounded-full -mr-24 -mt-24"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-36 h-36 bg-white/5 rounded-full -ml-18 -mb-18"}),e.jsxs("div",{className:"relative z-10 flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-xl font-display font-bold text-white mb-1",children:"Profile Settings"}),e.jsx("p",{className:"text-white/90 text-sm font-body",children:"Manage your account information"})]}),e.jsx("button",{onClick:o,className:"text-white/80 hover:text-white hover:bg-white/10 p-2 rounded-lg transition-all",children:e.jsx(X,{size:20})})]})]}),e.jsxs("div",{className:"overflow-y-auto max-h-[calc(90vh-200px)] p-6 scrollbar-thin scrollbar-thumb-[#d1cec6] scrollbar-track-[#edf1f7]",children:[e.jsxs("div",{className:"mb-8 space-y-4",children:[e.jsx(V,{uid:s.uid,photoURL:s.photo,displayName:s.name,onUploaded:a=>t(n=>({...n,photo:a}))}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-display font-bold text-[#0a1628]",children:s.name}),e.jsx("span",{className:`inline-block mt-2 px-3 py-1 rounded-full text-xs font-body font-semibold border ${A(s.role)}`,children:s.role.charAt(0).toUpperCase()+s.role.slice(1)})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-display font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-sky-600 rounded-full"}),"Basic Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Full Name"}),e.jsxs("div",{className:"relative",children:[e.jsx(u,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.name,onChange:a=>t({...s,name:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Email Address"}),e.jsxs("div",{className:"relative",children:[e.jsx(Y,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{type:"email",value:s.email,onChange:a=>t({...s,email:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Phone Number"}),e.jsxs("div",{className:"relative",children:[e.jsx(Q,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.phone,onChange:a=>t({...s,phone:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Gender"}),e.jsxs(_,{value:s.gender||"",onValueChange:a=>{t({...s,gender:a||void 0})},disabled:!l,children:[e.jsx(R,{className:"w-full bg-white border-[#dde3eb] rounded-lg [&>span]:flex [&>span]:items-center [&>span]:gap-2",children:e.jsxs("span",{className:"flex items-center gap-2",children:[s.gender==="male"&&e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"size-4 text-blue-500"}),e.jsx("span",{children:"Male"})]}),s.gender==="female"&&e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"size-4 text-pink-500"}),e.jsx("span",{children:"Female"})]}),s.gender==="prefer_not_to_say"&&e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"size-4 text-gray-500"}),e.jsx("span",{children:"Prefer not to say"})]}),!s.gender&&e.jsx("span",{className:"text-muted-foreground",children:"Select gender (optional)"})]})}),e.jsxs(U,{children:[e.jsx(h,{value:"male",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"size-4 text-blue-500"}),e.jsx("span",{children:"Male"})]})}),e.jsx(h,{value:"female",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{className:"size-4 text-pink-500"}),e.jsx("span",{children:"Female"})]})}),e.jsx(h,{value:"prefer_not_to_say",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"size-4 text-gray-500"}),e.jsx("span",{children:"Prefer not to say"})]})})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:s.role==="student"?"School":s.role==="teacher"?"Department":"Office Location"}),e.jsxs("div",{className:"relative",children:[e.jsx(H,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.school||s.department||s.office||"",onChange:a=>{s.role==="student"?t({...s,school:a.target.value}):s.role==="teacher"?t({...s,department:a.target.value}):t({...s,office:a.target.value})},disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]})]})]}),s.role==="student"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-teal-600 rounded-full"}),"Academic Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Learner's Reference Number (LRN)"}),e.jsxs("div",{className:"relative",children:[e.jsx(x,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.lrn||"",onChange:a=>t({...s,lrn:a.target.value}),disabled:!l,className:"pl-10 bg-[#edf1f7] border-[#dde3eb] rounded-xl disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Grade Level"}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.grade||"",onChange:a=>t({...s,grade:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Section"}),e.jsxs("div",{className:"relative",children:[e.jsx(u,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.section||"",onChange:a=>t({...s,section:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-rose-600 rounded-full"}),"Leaderboard Overview"]}),E?e.jsx("div",{className:"rounded-lg border border-[#dde3eb] bg-white p-4 text-sm font-body text-[#5a6578]",children:"Loading leaderboard data..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"rounded-lg border border-rose-200 bg-rose-50 p-3",children:[e.jsx("p",{className:"text-xs font-body font-semibold text-rose-700 uppercase tracking-wider",children:"Your Rank"}),e.jsx("p",{className:"text-2xl font-display font-bold text-rose-800 mt-1",children:y>0?`#${y}`:"Unranked"})]}),e.jsxs("div",{className:"rounded-lg border border-sky-200 bg-sky-50 p-3",children:[e.jsx("p",{className:"text-xs font-body font-semibold text-sky-700 uppercase tracking-wider",children:"Total XP"}),e.jsx("p",{className:"text-2xl font-display font-bold text-sky-800 mt-1",children:N?.xp??0})]}),e.jsxs("div",{className:"rounded-lg border border-emerald-200 bg-emerald-50 p-3",children:[e.jsx("p",{className:"text-xs font-body font-semibold text-emerald-700 uppercase tracking-wider",children:"Level"}),e.jsx("p",{className:"text-2xl font-display font-bold text-emerald-800 mt-1",children:N?.level??"-"})]})]}),e.jsxs("div",{className:"rounded-lg border border-[#dde3eb] bg-white overflow-hidden",children:[e.jsx("div",{className:"px-4 py-2 border-b border-[#dde3eb] bg-[#f7f9fc]",children:e.jsx("p",{className:"text-xs font-body font-semibold text-[#5a6578] uppercase tracking-wider",children:"Top Students"})}),e.jsx("div",{className:"divide-y divide-[#edf1f7]",children:m.length>0?m.map(a=>e.jsxs("div",{className:"px-4 py-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-7 h-7 rounded-full bg-[#edf1f7] text-[#0a1628] text-xs font-display font-bold flex items-center justify-center",children:a.rank}),e.jsxs("p",{className:"text-sm font-body font-semibold text-[#0a1628] truncate",children:[a.name,a.userId===s.uid?" (You)":""]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-sm font-body font-semibold text-[#0a1628]",children:[a.xp," XP"]}),e.jsxs("p",{className:"text-xs font-body text-[#5a6578]",children:["Lv ",a.level]})]})]},a.userId)):e.jsx("div",{className:"px-4 py-6 text-center text-sm font-body text-[#5a6578]",children:"No leaderboard data available yet."})})]})]})]})]}),s.role==="teacher"&&e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-display font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-rose-500 rounded-full"}),"Teaching Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Teacher ID"}),e.jsxs("div",{className:"relative",children:[e.jsx(x,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.teacherId||"",onChange:a=>t({...s,teacherId:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Subject/Specialization"}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.subject||"",onChange:a=>t({...s,subject:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Years of Experience"}),e.jsxs("div",{className:"relative",children:[e.jsx(B,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.yearsOfExperience||"",onChange:a=>t({...s,yearsOfExperience:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Qualification"}),e.jsxs("div",{className:"relative",children:[e.jsx(x,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.qualification||"",onChange:a=>t({...s,qualification:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]})]})]}),s.role==="admin"&&e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-display font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-rose-600 rounded-full"}),"Administrative Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Admin ID"}),e.jsxs("div",{className:"relative",children:[e.jsx(x,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.adminId||"",onChange:a=>t({...s,adminId:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Position/Title"}),e.jsxs("div",{className:"relative",children:[e.jsx(u,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.position||"",onChange:a=>t({...s,position:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Access Level/Permissions"}),e.jsxs("div",{className:"relative",children:[e.jsx(T,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.permissions||"",onChange:a=>t({...s,permissions:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]})]})]})]})]}),e.jsx("div",{className:"border-t border-[#dde3eb] p-5 bg-[#edf1f7]",children:e.jsx("div",{className:"flex gap-3 justify-end",children:l?e.jsxs(e.Fragment,{children:[e.jsx(c,{onClick:P,variant:"outline",className:"px-5 py-2 rounded-lg border-[#d1cec6] hover:bg-white font-body font-medium text-[#5a6578]",children:"Cancel"}),e.jsxs(c,{onClick:I,className:"px-5 py-2 rounded-lg bg-sky-600 hover:bg-sky-700 text-white font-body font-semibold flex items-center gap-2",children:[e.jsx($,{size:16}),"Save Changes"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{onClick:o,variant:"outline",className:"px-5 py-2 rounded-lg border-[#d1cec6] hover:bg-white font-body font-medium text-[#5a6578]",children:"Close"}),e.jsx(c,{onClick:()=>b(!0),className:"px-5 py-2 rounded-lg bg-sky-600 hover:bg-sky-700 text-white font-body font-semibold",children:"Edit Profile"})]})})})]})})]})})};export{ye as default};
 
1
+ import{r,j as e}from"./vendor-react-B4AQeu28.js";import{B as c}from"./button-BPmLcOpC.js";import{I as d}from"./input--XHWlmp1.js";import{S as _,a as R,c as U,d as h}from"./select--QYuvUGV.js";import{e as S,g as D,m as k,U as u,A as x,a as w,D as B,aN as T,aE as q,aP as G}from"./index-uASBzalf.js";import{P as V,M as z,V as C}from"./ProfilePictureUploader-CyCaD4jN.js";import{X}from"./x-CBb03rh3.js";import{M as Y}from"./mail-BF4xxwnI.js";import{C as L}from"./circle-help-PS1uII8x.js";import{S as $}from"./save-CoDXj-im.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./chevron-up-BpMhRyJp.js";import"./check-Dk6iwDFI.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-markdown-yqZQ_iQm.js";import"./minus-Bfei9C79.js";import"./plus-Cy6hz5PP.js";import"./upload-Ds5w3QNw.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
5
  * See the LICENSE file in the root directory of this source tree.
6
+ */const H=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]],K=S("building",H);/**
7
  * @license lucide-react v0.487.0 - ISC
8
  *
9
  * This source code is licensed under the ISC license.
10
  * See the LICENSE file in the root directory of this source tree.
11
+ */const O=[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]],Q=S("phone",O),ye=({isOpen:i,onClose:o,profileData:p,onSave:E})=>{const[s,t]=r.useState(p),[l,b]=r.useState(!1),[M,g]=r.useState(!1),[m,j]=r.useState([]),[y,v]=r.useState(0);r.useEffect(()=>{if(!i)return;const a=n=>{n.key==="Escape"&&o()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[i,o]),r.useEffect(()=>{if(!i||s.role!=="student"||!s.uid)return;const a=s.uid;(async()=>{g(!0);try{const[f,F]=await Promise.all([q(void 0,!1,"all",5),G(a)]);j(f),v(F)}catch(f){console.error("Failed to load leaderboard for profile modal:",f),j([]),v(0)}finally{g(!1)}})()},[i,s.role,s.uid]);const I=()=>{E(s),b(!1)},P=()=>{t(p),b(!1)},A=a=>{switch(a){case"student":return"bg-sky-100 text-sky-700 border-sky-200";case"teacher":return"bg-rose-100 text-rose-700 border-rose-200";case"admin":return"bg-rose-100 text-rose-700 border-rose-200";default:return"bg-zinc-100 text-zinc-700 border-zinc-200"}},N=m.find(a=>a.userId===s.uid);return e.jsx(D,{children:i&&e.jsxs(e.Fragment,{children:[e.jsx(k.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:o,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50"}),e.jsx(k.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",duration:.5},className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:a=>a.stopPropagation(),children:e.jsxs("div",{className:"bg-[#f7f9fc] rounded-2xl shadow-2xl w-full max-w-3xl max-h-[90vh] overflow-hidden border border-[#dde3eb]",children:[e.jsxs("div",{className:"bg-gradient-to-r from-sky-600 to-sky-500 p-6 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-white/30 to-transparent"}),e.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 bg-white/10 rounded-full -mr-24 -mt-24"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-36 h-36 bg-white/5 rounded-full -ml-18 -mb-18"}),e.jsxs("div",{className:"relative z-10 flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-xl font-display font-bold text-white mb-1",children:"Profile Settings"}),e.jsx("p",{className:"text-white/90 text-sm font-body",children:"Manage your account information"})]}),e.jsx("button",{onClick:o,className:"text-white/80 hover:text-white hover:bg-white/10 p-2 rounded-lg transition-all",children:e.jsx(X,{size:20})})]})]}),e.jsxs("div",{className:"overflow-y-auto max-h-[calc(90vh-200px)] p-6 scrollbar-thin scrollbar-thumb-[#d1cec6] scrollbar-track-[#edf1f7]",children:[e.jsxs("div",{className:"mb-8 space-y-4",children:[e.jsx(V,{uid:s.uid,photoURL:s.photo,displayName:s.name,onUploaded:a=>t(n=>({...n,photo:a}))}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-display font-bold text-[#0a1628]",children:s.name}),e.jsx("span",{className:`inline-block mt-2 px-3 py-1 rounded-full text-xs font-body font-semibold border ${A(s.role)}`,children:s.role.charAt(0).toUpperCase()+s.role.slice(1)})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-display font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-sky-600 rounded-full"}),"Basic Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Full Name"}),e.jsxs("div",{className:"relative",children:[e.jsx(u,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.name,onChange:a=>t({...s,name:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Email Address"}),e.jsxs("div",{className:"relative",children:[e.jsx(Y,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{type:"email",value:s.email,onChange:a=>t({...s,email:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Phone Number"}),e.jsxs("div",{className:"relative",children:[e.jsx(Q,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.phone,onChange:a=>t({...s,phone:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Gender"}),e.jsxs(_,{value:s.gender||"",onValueChange:a=>{t({...s,gender:a||void 0})},disabled:!l,children:[e.jsx(R,{className:"w-full bg-white border-[#dde3eb] rounded-lg [&>span]:flex [&>span]:items-center [&>span]:gap-2",children:e.jsxs("span",{className:"flex items-center gap-2",children:[s.gender==="male"&&e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"size-4 text-blue-500"}),e.jsx("span",{children:"Male"})]}),s.gender==="female"&&e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"size-4 text-pink-500"}),e.jsx("span",{children:"Female"})]}),s.gender==="prefer_not_to_say"&&e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"size-4 text-gray-500"}),e.jsx("span",{children:"Prefer not to say"})]}),!s.gender&&e.jsx("span",{className:"text-muted-foreground",children:"Select gender (optional)"})]})}),e.jsxs(U,{children:[e.jsx(h,{value:"male",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"size-4 text-blue-500"}),e.jsx("span",{children:"Male"})]})}),e.jsx(h,{value:"female",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{className:"size-4 text-pink-500"}),e.jsx("span",{children:"Female"})]})}),e.jsx(h,{value:"prefer_not_to_say",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"size-4 text-gray-500"}),e.jsx("span",{children:"Prefer not to say"})]})})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:s.role==="student"?"School":s.role==="teacher"?"Department":"Office Location"}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.school||s.department||s.office||"",onChange:a=>{s.role==="student"?t({...s,school:a.target.value}):s.role==="teacher"?t({...s,department:a.target.value}):t({...s,office:a.target.value})},disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]})]})]}),s.role==="student"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-teal-600 rounded-full"}),"Academic Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Learner's Reference Number (LRN)"}),e.jsxs("div",{className:"relative",children:[e.jsx(x,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.lrn||"",onChange:a=>t({...s,lrn:a.target.value}),disabled:!l,className:"pl-10 bg-[#edf1f7] border-[#dde3eb] rounded-xl disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Grade Level"}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.grade||"",onChange:a=>t({...s,grade:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Section"}),e.jsxs("div",{className:"relative",children:[e.jsx(u,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.section||"",onChange:a=>t({...s,section:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-rose-600 rounded-full"}),"Leaderboard Overview"]}),M?e.jsx("div",{className:"rounded-lg border border-[#dde3eb] bg-white p-4 text-sm font-body text-[#5a6578]",children:"Loading leaderboard data..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"rounded-lg border border-rose-200 bg-rose-50 p-3",children:[e.jsx("p",{className:"text-xs font-body font-semibold text-rose-700 uppercase tracking-wider",children:"Your Rank"}),e.jsx("p",{className:"text-2xl font-display font-bold text-rose-800 mt-1",children:y>0?`#${y}`:"Unranked"})]}),e.jsxs("div",{className:"rounded-lg border border-sky-200 bg-sky-50 p-3",children:[e.jsx("p",{className:"text-xs font-body font-semibold text-sky-700 uppercase tracking-wider",children:"Total XP"}),e.jsx("p",{className:"text-2xl font-display font-bold text-sky-800 mt-1",children:N?.xp??0})]}),e.jsxs("div",{className:"rounded-lg border border-emerald-200 bg-emerald-50 p-3",children:[e.jsx("p",{className:"text-xs font-body font-semibold text-emerald-700 uppercase tracking-wider",children:"Level"}),e.jsx("p",{className:"text-2xl font-display font-bold text-emerald-800 mt-1",children:N?.level??"-"})]})]}),e.jsxs("div",{className:"rounded-lg border border-[#dde3eb] bg-white overflow-hidden",children:[e.jsx("div",{className:"px-4 py-2 border-b border-[#dde3eb] bg-[#f7f9fc]",children:e.jsx("p",{className:"text-xs font-body font-semibold text-[#5a6578] uppercase tracking-wider",children:"Top Students"})}),e.jsx("div",{className:"divide-y divide-[#edf1f7]",children:m.length>0?m.map(a=>e.jsxs("div",{className:"px-4 py-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-7 h-7 rounded-full bg-[#edf1f7] text-[#0a1628] text-xs font-display font-bold flex items-center justify-center",children:a.rank}),e.jsxs("p",{className:"text-sm font-body font-semibold text-[#0a1628] truncate",children:[a.name,a.userId===s.uid?" (You)":""]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-sm font-body font-semibold text-[#0a1628]",children:[a.xp," XP"]}),e.jsxs("p",{className:"text-xs font-body text-[#5a6578]",children:["Lv ",a.level]})]})]},a.userId)):e.jsx("div",{className:"px-4 py-6 text-center text-sm font-body text-[#5a6578]",children:"No leaderboard data available yet."})})]})]})]})]}),s.role==="teacher"&&e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-display font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-rose-500 rounded-full"}),"Teaching Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Teacher ID"}),e.jsxs("div",{className:"relative",children:[e.jsx(x,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.teacherId||"",onChange:a=>t({...s,teacherId:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Subject/Specialization"}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.subject||"",onChange:a=>t({...s,subject:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Years of Experience"}),e.jsxs("div",{className:"relative",children:[e.jsx(B,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.yearsOfExperience||"",onChange:a=>t({...s,yearsOfExperience:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Qualification"}),e.jsxs("div",{className:"relative",children:[e.jsx(x,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.qualification||"",onChange:a=>t({...s,qualification:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]})]})]}),s.role==="admin"&&e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-display font-bold text-[#0a1628] mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"w-1 h-4 bg-rose-600 rounded-full"}),"Administrative Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Admin ID"}),e.jsxs("div",{className:"relative",children:[e.jsx(x,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.adminId||"",onChange:a=>t({...s,adminId:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Position/Title"}),e.jsxs("div",{className:"relative",children:[e.jsx(u,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.position||"",onChange:a=>t({...s,position:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-xs font-body font-semibold text-[#5a6578] mb-2 uppercase tracking-wider",children:"Access Level/Permissions"}),e.jsxs("div",{className:"relative",children:[e.jsx(T,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),e.jsx(d,{value:s.permissions||"",onChange:a=>t({...s,permissions:a.target.value}),disabled:!l,className:"pl-10 bg-white border-[#dde3eb] rounded-lg font-body text-[#0a1628] focus:border-sky-400 focus:ring-sky-400/20 disabled:opacity-100 disabled:cursor-default"})]})]})]})]})]})]}),e.jsx("div",{className:"border-t border-[#dde3eb] p-5 bg-[#edf1f7]",children:e.jsx("div",{className:"flex gap-3 justify-end",children:l?e.jsxs(e.Fragment,{children:[e.jsx(c,{onClick:P,variant:"outline",className:"px-5 py-2 rounded-lg border-[#d1cec6] hover:bg-white font-body font-medium text-[#5a6578]",children:"Cancel"}),e.jsxs(c,{onClick:I,className:"px-5 py-2 rounded-lg bg-sky-600 hover:bg-sky-700 text-white font-body font-semibold flex items-center gap-2",children:[e.jsx($,{size:16}),"Save Changes"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{onClick:o,variant:"outline",className:"px-5 py-2 rounded-lg border-[#d1cec6] hover:bg-white font-body font-medium text-[#5a6578]",children:"Close"}),e.jsx(c,{onClick:()=>b(!0),className:"px-5 py-2 rounded-lg bg-sky-600 hover:bg-sky-700 text-white font-body font-semibold",children:"Edit Profile"})]})})})]})})]})})};export{ye as default};
assets/{ProfilePictureUploader-CX_IZAwE.js β†’ ProfilePictureUploader-CyCaD4jN.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e as X,i as B,F as V,aZ as ve,a_ as ge,u as we,J as xe,K as ye,N as be,j as Ce,m as K,t as J}from"./index-BaOs5Ayg.js";import{g as Pe,r as g,j as p}from"./vendor-react-B4AQeu28.js";import{_ as Re,p as b,q as Ee,r as Se,s as _e,t as ze}from"./vendor-radix-BorKzPz9.js";import{B as Q}from"./button-DCfeFHoH.js";import{updateProfile as De}from"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-core-CO26nNq6.js";import{r as Me,u as Ae,a as Ne}from"./vendor-firebase-storage-B3igpVVS.js";import{X as Te}from"./x-TNvtuOD9.js";import{M as je}from"./minus-DfrEv-SC.js";import{P as Ue}from"./plus-DkG35AoH.js";import{U as Fe}from"./upload-DayXhGwD.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
@@ -13,7 +13,7 @@ import{e as X,i as B,F as V,aZ as ve,a_ as ge,u as we,J as xe,K as ye,N as be,j
13
  *
14
  * This source code is licensed under the ISC license.
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const ke=[["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M9 19h6",key:"456am0"}],["circle",{cx:"12",cy:"9",r:"6",key:"1nw4tq"}]],At=X("venus",ke);var $,ee;function We(){if(ee)return $;ee=1;var a=!1,o,e,t,r,i,n,s,c,l,u,d,h,m,w,y;function f(){if(!a){a=!0;var x=navigator.userAgent,v=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(x),E=/(Mac OS X)|(Windows)|(Linux)/.exec(x);if(h=/\b(iPhone|iP[ao]d)/.exec(x),m=/\b(iP[ao]d)/.exec(x),u=/Android/i.exec(x),w=/FBAN\/\w+;/i.exec(x),y=/Mobile/i.exec(x),d=!!/Win64/.exec(x),v){o=v[1]?parseFloat(v[1]):v[5]?parseFloat(v[5]):NaN,o&&document&&document.documentMode&&(o=document.documentMode);var _=/(?:Trident\/(\d+.\d+))/.exec(x);n=_?parseFloat(_[1])+4:o,e=v[2]?parseFloat(v[2]):NaN,t=v[3]?parseFloat(v[3]):NaN,r=v[4]?parseFloat(v[4]):NaN,r?(v=/(?:Chrome\/(\d+\.\d+))/.exec(x),i=v&&v[1]?parseFloat(v[1]):NaN):i=NaN}else o=e=t=i=r=NaN;if(E){if(E[1]){var P=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(x);s=P?parseFloat(P[1].replace("_",".")):!0}else s=!1;c=!!E[2],l=!!E[3]}else s=c=l=!1}}var R={ie:function(){return f()||o},ieCompatibilityMode:function(){return f()||n>o},ie64:function(){return R.ie()&&d},firefox:function(){return f()||e},opera:function(){return f()||t},webkit:function(){return f()||r},safari:function(){return R.webkit()},chrome:function(){return f()||i},windows:function(){return f()||c},osx:function(){return f()||s},linux:function(){return f()||l},iphone:function(){return f()||h},mobile:function(){return f()||h||m||u||y},nativeApp:function(){return f()||w},android:function(){return f()||u},ipad:function(){return f()||m}};return $=R,$}var H,te;function Ze(){if(te)return H;te=1;var a=!!(typeof window<"u"&&window.document&&window.document.createElement),o={canUseDOM:a,canUseWorkers:typeof Worker<"u",canUseEventListeners:a&&!!(window.addEventListener||window.attachEvent),canUseViewport:a&&!!window.screen,isInWorker:!a};return H=o,H}var q,re;function Be(){if(re)return q;re=1;var a=Ze(),o;a.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);/**
17
  * Checks if an event is supported in the current execution environment.
18
  *
19
  * NOTE: This will not work correctly for non-generic events such as `change`,
@@ -26,7 +26,7 @@ import{e as X,i as B,F as V,aZ as ve,a_ as ge,u as we,J as xe,K as ye,N as be,j
26
  * @return {boolean} True if the event is supported.
27
  * @internal
28
  * @license Modernizr 3.0.0pre (Custom Build) | MIT
29
- */function e(t,r){if(!a.canUseDOM||r&&!("addEventListener"in document))return!1;var i="on"+t,n=i in document;if(!n){var s=document.createElement("div");s.setAttribute(i,"return;"),n=typeof s[i]=="function"}return!n&&o&&t==="wheel"&&(n=document.implementation.hasFeature("Events.wheel","3.0")),n}return q=e,q}var G,oe;function $e(){if(oe)return G;oe=1;var a=We(),o=Be(),e=10,t=40,r=800;function i(n){var s=0,c=0,l=0,u=0;return"detail"in n&&(c=n.detail),"wheelDelta"in n&&(c=-n.wheelDelta/120),"wheelDeltaY"in n&&(c=-n.wheelDeltaY/120),"wheelDeltaX"in n&&(s=-n.wheelDeltaX/120),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(s=c,c=0),l=s*e,u=c*e,"deltaY"in n&&(u=n.deltaY),"deltaX"in n&&(l=n.deltaX),(l||u)&&n.deltaMode&&(n.deltaMode==1?(l*=t,u*=t):(l*=r,u*=r)),l&&!s&&(s=l<1?-1:1),u&&!c&&(c=u<1?-1:1),{spinX:s,spinY:c,pixelX:l,pixelY:u}}return i.getEventType=function(){return a.firefox()?"DOMMouseScroll":o("wheel")?"wheel":"mousewheel"},G=i,G}var Y,ie;function He(){return ie||(ie=1,Y=$e()),Y}var qe=He();const Ge=Pe(qe);function Ye(a,o,e,t,r,i){i===void 0&&(i=0);var n=A(a,o,i),s=n.width,c=n.height,l=Math.min(s,e),u=Math.min(c,t);return l>u*r?{width:u*r,height:u}:{width:l,height:l/r}}function Xe(a){return a.width>a.height?a.width/a.naturalWidth:a.height/a.naturalHeight}function T(a,o,e,t,r){r===void 0&&(r=0);var i=A(o.width,o.height,r),n=i.width,s=i.height;return{x:ne(a.x,n,e.width,t),y:ne(a.y,s,e.height,t)}}function ne(a,o,e,t){var r=Math.abs(o*t/2-e/2);return O(a,-r,r)}function ae(a,o){return Math.sqrt(Math.pow(a.y-o.y,2)+Math.pow(a.x-o.x,2))}function se(a,o){return Math.atan2(o.y-a.y,o.x-a.x)*180/Math.PI}function Ve(a,o,e,t,r,i,n){i===void 0&&(i=0),n===void 0&&(n=!0);var s=n?Ke:Je,c=A(o.width,o.height,i),l=A(o.naturalWidth,o.naturalHeight,i),u={x:s(100,((c.width-e.width/r)/2-a.x/r)/c.width*100),y:s(100,((c.height-e.height/r)/2-a.y/r)/c.height*100),width:s(100,e.width/c.width*100/r),height:s(100,e.height/c.height*100/r)},d=Math.round(s(l.width,u.width*l.width/100)),h=Math.round(s(l.height,u.height*l.height/100)),m=l.width>=l.height*t,w=m?{width:Math.round(h*t),height:h}:{width:d,height:Math.round(d/t)},y=b(b({},w),{x:Math.round(s(l.width-w.width,u.x*l.width/100)),y:Math.round(s(l.height-w.height,u.y*l.height/100))});return{croppedAreaPercentages:u,croppedAreaPixels:y}}function Ke(a,o){return Math.min(a,Math.max(0,o))}function Je(a,o){return o}function Qe(a,o,e,t,r,i){var n=A(o.width,o.height,e),s=O(t.width/n.width*(100/a.width),r,i),c={x:s*n.width/2-t.width/2-n.width*s*(a.x/100),y:s*n.height/2-t.height/2-n.height*s*(a.y/100)};return{crop:c,zoom:s}}function et(a,o,e){var t=Xe(o);return e.height>e.width?e.height/(a.height*t):e.width/(a.width*t)}function tt(a,o,e,t,r,i){e===void 0&&(e=0);var n=A(o.naturalWidth,o.naturalHeight,e),s=O(et(a,o,t),r,i),c=t.height>t.width?t.height/a.height:t.width/a.width,l={x:((n.width-a.width)/2-a.x)*c,y:((n.height-a.height)/2-a.y)*c};return{crop:l,zoom:s}}function ce(a,o){return{x:(o.x+a.x)/2,y:(o.y+a.y)/2}}function rt(a){return a*Math.PI/180}function A(a,o,e){var t=rt(e);return{width:Math.abs(Math.cos(t)*a)+Math.abs(Math.sin(t)*o),height:Math.abs(Math.sin(t)*a)+Math.abs(Math.cos(t)*o)}}function O(a,o,e){return Math.min(Math.max(a,o),e)}function L(){for(var a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];return a.filter(function(e){return typeof e=="string"&&e.length>0}).join(" ").trim()}var ot=`.reactEasyCrop_Container {
30
  position: absolute;
31
  top: 0;
32
  left: 0;
@@ -106,4 +106,4 @@ import{e as X,i as B,F as V,aZ as ve,a_ as ge,u as we,J as xe,K as ye,N as be,j
106
  border-left: 0;
107
  border-right: 0;
108
  }
109
- `,it=1,nt=3,at=1,st=(function(a){Re(o,a);function o(){var e=a!==null&&a.apply(this,arguments)||this;return e.cropperRef=g.createRef(),e.imageRef=g.createRef(),e.videoRef=g.createRef(),e.containerPosition={x:0,y:0},e.containerRef=null,e.styleRef=null,e.containerRect=null,e.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},e.dragStartPosition={x:0,y:0},e.dragStartCrop={x:0,y:0},e.gestureZoomStart=0,e.gestureRotationStart=0,e.isTouching=!1,e.lastPinchDistance=0,e.lastPinchRotation=0,e.rafDragTimeout=null,e.rafPinchTimeout=null,e.wheelTimer=null,e.currentDoc=typeof document<"u"?document:null,e.currentWindow=typeof window<"u"?window:null,e.resizeObserver=null,e.previousCropSize=null,e.isInitialized=!1,e.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},e.initResizeObserver=function(){if(!(typeof window.ResizeObserver>"u"||!e.containerRef)){var t=!0;e.resizeObserver=new window.ResizeObserver(function(r){if(t){t=!1;return}e.computeSizes()}),e.resizeObserver.observe(e.containerRef)}},e.preventZoomSafari=function(t){return t.preventDefault()},e.cleanEvents=function(){e.currentDoc&&(e.currentDoc.removeEventListener("mousemove",e.onMouseMove),e.currentDoc.removeEventListener("mouseup",e.onDragStopped),e.currentDoc.removeEventListener("touchmove",e.onTouchMove),e.currentDoc.removeEventListener("touchend",e.onDragStopped),e.currentDoc.removeEventListener("gesturechange",e.onGestureChange),e.currentDoc.removeEventListener("gestureend",e.onGestureEnd),e.currentDoc.removeEventListener("scroll",e.onScroll))},e.clearScrollEvent=function(){e.containerRef&&e.containerRef.removeEventListener("wheel",e.onWheel),e.wheelTimer&&clearTimeout(e.wheelTimer)},e.onMediaLoad=function(){var t=e.computeSizes();t&&(e.previousCropSize=t,e.emitCropData(),e.setInitialCrop(t),e.isInitialized=!0),e.props.onMediaLoaded&&e.props.onMediaLoaded(e.mediaSize)},e.setInitialCrop=function(t){if(e.props.initialCroppedAreaPercentages){var r=Qe(e.props.initialCroppedAreaPercentages,e.mediaSize,e.props.rotation,t,e.props.minZoom,e.props.maxZoom),i=r.crop,n=r.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(n)}else if(e.props.initialCroppedAreaPixels){var s=tt(e.props.initialCroppedAreaPixels,e.mediaSize,e.props.rotation,t,e.props.minZoom,e.props.maxZoom),i=s.crop,n=s.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(n)}},e.computeSizes=function(){var t,r,i,n,s,c,l=e.imageRef.current||e.videoRef.current;if(l&&e.containerRef){e.containerRect=e.containerRef.getBoundingClientRect(),e.saveContainerPosition();var u=e.containerRect.width/e.containerRect.height,d=((t=e.imageRef.current)===null||t===void 0?void 0:t.naturalWidth)||((r=e.videoRef.current)===null||r===void 0?void 0:r.videoWidth)||0,h=((i=e.imageRef.current)===null||i===void 0?void 0:i.naturalHeight)||((n=e.videoRef.current)===null||n===void 0?void 0:n.videoHeight)||0,m=l.offsetWidth<d||l.offsetHeight<h,w=d/h,y=void 0;if(m)switch(e.state.mediaObjectFit){default:case"contain":y=u>w?{width:e.containerRect.height*w,height:e.containerRect.height}:{width:e.containerRect.width,height:e.containerRect.width/w};break;case"horizontal-cover":y={width:e.containerRect.width,height:e.containerRect.width/w};break;case"vertical-cover":y={width:e.containerRect.height*w,height:e.containerRect.height};break}else y={width:l.offsetWidth,height:l.offsetHeight};e.mediaSize=b(b({},y),{naturalWidth:d,naturalHeight:h}),e.props.setMediaSize&&e.props.setMediaSize(e.mediaSize);var f=e.props.cropSize?e.props.cropSize:Ye(e.mediaSize.width,e.mediaSize.height,e.containerRect.width,e.containerRect.height,e.props.aspect,e.props.rotation);return(((s=e.state.cropSize)===null||s===void 0?void 0:s.height)!==f.height||((c=e.state.cropSize)===null||c===void 0?void 0:c.width)!==f.width)&&e.props.onCropSizeChange&&e.props.onCropSizeChange(f),e.setState({cropSize:f},e.recomputeCropPosition),e.props.setCropSize&&e.props.setCropSize(f),f}},e.saveContainerPosition=function(){if(e.containerRef){var t=e.containerRef.getBoundingClientRect();e.containerPosition={x:t.left,y:t.top}}},e.onMouseDown=function(t){e.currentDoc&&(t.preventDefault(),e.currentDoc.addEventListener("mousemove",e.onMouseMove),e.currentDoc.addEventListener("mouseup",e.onDragStopped),e.saveContainerPosition(),e.onDragStart(o.getMousePoint(t)))},e.onMouseMove=function(t){return e.onDrag(o.getMousePoint(t))},e.onScroll=function(t){e.currentDoc&&(t.preventDefault(),e.saveContainerPosition())},e.onTouchStart=function(t){e.currentDoc&&(e.isTouching=!0,!(e.props.onTouchRequest&&!e.props.onTouchRequest(t))&&(e.currentDoc.addEventListener("touchmove",e.onTouchMove,{passive:!1}),e.currentDoc.addEventListener("touchend",e.onDragStopped),e.saveContainerPosition(),t.touches.length===2?e.onPinchStart(t):t.touches.length===1&&e.onDragStart(o.getTouchPoint(t.touches[0]))))},e.onTouchMove=function(t){t.preventDefault(),t.touches.length===2?e.onPinchMove(t):t.touches.length===1&&e.onDrag(o.getTouchPoint(t.touches[0]))},e.onGestureStart=function(t){e.currentDoc&&(t.preventDefault(),e.currentDoc.addEventListener("gesturechange",e.onGestureChange),e.currentDoc.addEventListener("gestureend",e.onGestureEnd),e.gestureZoomStart=e.props.zoom,e.gestureRotationStart=e.props.rotation)},e.onGestureChange=function(t){if(t.preventDefault(),!e.isTouching){var r=o.getMousePoint(t),i=e.gestureZoomStart-1+t.scale;if(e.setNewZoom(i,r,{shouldUpdatePosition:!0}),e.props.onRotationChange){var n=e.gestureRotationStart+t.rotation;e.props.onRotationChange(n)}}},e.onGestureEnd=function(t){e.cleanEvents()},e.onDragStart=function(t){var r,i,n=t.x,s=t.y;e.dragStartPosition={x:n,y:s},e.dragStartCrop=b({},e.props.crop),(i=(r=e.props).onInteractionStart)===null||i===void 0||i.call(r)},e.onDrag=function(t){var r=t.x,i=t.y;e.currentWindow&&(e.rafDragTimeout&&e.currentWindow.cancelAnimationFrame(e.rafDragTimeout),e.rafDragTimeout=e.currentWindow.requestAnimationFrame(function(){if(e.state.cropSize&&!(r===void 0||i===void 0)){var n=r-e.dragStartPosition.x,s=i-e.dragStartPosition.y,c={x:e.dragStartCrop.x+n,y:e.dragStartCrop.y+s},l=e.props.restrictPosition?T(c,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):c;e.props.onCropChange(l)}}))},e.onDragStopped=function(){var t,r;e.isTouching=!1,e.cleanEvents(),e.emitCropData(),(r=(t=e.props).onInteractionEnd)===null||r===void 0||r.call(t)},e.onWheel=function(t){if(e.currentWindow&&!(e.props.onWheelRequest&&!e.props.onWheelRequest(t))){t.preventDefault();var r=o.getMousePoint(t),i=Ge(t).pixelY,n=e.props.zoom-i*e.props.zoomSpeed/200;e.setNewZoom(n,r,{shouldUpdatePosition:!0}),e.state.hasWheelJustStarted||e.setState({hasWheelJustStarted:!0},function(){var s,c;return(c=(s=e.props).onInteractionStart)===null||c===void 0?void 0:c.call(s)}),e.wheelTimer&&clearTimeout(e.wheelTimer),e.wheelTimer=e.currentWindow.setTimeout(function(){return e.setState({hasWheelJustStarted:!1},function(){var s,c;return(c=(s=e.props).onInteractionEnd)===null||c===void 0?void 0:c.call(s)})},250)}},e.getPointOnContainer=function(t,r){var i=t.x,n=t.y;if(!e.containerRect)throw new Error("The Cropper is not mounted");return{x:e.containerRect.width/2-(i-r.x),y:e.containerRect.height/2-(n-r.y)}},e.getPointOnMedia=function(t){var r=t.x,i=t.y,n=e.props,s=n.crop,c=n.zoom;return{x:(r+s.x)/c,y:(i+s.y)/c}},e.setNewZoom=function(t,r,i){var n=i===void 0?{}:i,s=n.shouldUpdatePosition,c=s===void 0?!0:s;if(!(!e.state.cropSize||!e.props.onZoomChange)){var l=O(t,e.props.minZoom,e.props.maxZoom);if(c){var u=e.getPointOnContainer(r,e.containerPosition),d=e.getPointOnMedia(u),h={x:d.x*l-u.x,y:d.y*l-u.y},m=e.props.restrictPosition?T(h,e.mediaSize,e.state.cropSize,l,e.props.rotation):h;e.props.onCropChange(m)}e.props.onZoomChange(l)}},e.getCropData=function(){if(!e.state.cropSize)return null;var t=e.props.restrictPosition?T(e.props.crop,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):e.props.crop;return Ve(t,e.mediaSize,e.state.cropSize,e.getAspect(),e.props.zoom,e.props.rotation,e.props.restrictPosition)},e.emitCropData=function(){var t=e.getCropData();if(t){var r=t.croppedAreaPercentages,i=t.croppedAreaPixels;e.props.onCropComplete&&e.props.onCropComplete(r,i),e.props.onCropAreaChange&&e.props.onCropAreaChange(r,i)}},e.emitCropAreaChange=function(){var t=e.getCropData();if(t){var r=t.croppedAreaPercentages,i=t.croppedAreaPixels;e.props.onCropAreaChange&&e.props.onCropAreaChange(r,i)}},e.recomputeCropPosition=function(){var t,r;if(e.state.cropSize){var i=e.props.crop;if(e.isInitialized&&(!((t=e.previousCropSize)===null||t===void 0)&&t.width)&&(!((r=e.previousCropSize)===null||r===void 0)&&r.height)){var n=Math.abs(e.previousCropSize.width-e.state.cropSize.width)>1e-6||Math.abs(e.previousCropSize.height-e.state.cropSize.height)>1e-6;if(n){var s=e.state.cropSize.width/e.previousCropSize.width,c=e.state.cropSize.height/e.previousCropSize.height;i={x:e.props.crop.x*s,y:e.props.crop.y*c}}}var l=e.props.restrictPosition?T(i,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):i;e.previousCropSize=e.state.cropSize,e.props.onCropChange(l),e.emitCropData()}},e.onKeyDown=function(t){var r,i,n=e.props,s=n.crop,c=n.onCropChange,l=n.keyboardStep,u=n.zoom,d=n.rotation,h=l;if(e.state.cropSize){t.shiftKey&&(h*=.2);var m=b({},s);switch(t.key){case"ArrowUp":m.y-=h,t.preventDefault();break;case"ArrowDown":m.y+=h,t.preventDefault();break;case"ArrowLeft":m.x-=h,t.preventDefault();break;case"ArrowRight":m.x+=h,t.preventDefault();break;default:return}e.props.restrictPosition&&(m=T(m,e.mediaSize,e.state.cropSize,u,d)),t.repeat||(i=(r=e.props).onInteractionStart)===null||i===void 0||i.call(r),c(m)}},e.onKeyUp=function(t){var r,i;switch(t.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":t.preventDefault();break;default:return}e.emitCropData(),(i=(r=e.props).onInteractionEnd)===null||i===void 0||i.call(r)},e}return o.prototype.componentDidMount=function(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=ot,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))},o.prototype.componentWillUnmount=function(){var e,t;!this.currentDoc||!this.currentWindow||(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.computeSizes),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&((t=this.styleRef.parentNode)===null||t===void 0||t.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},o.prototype.componentDidUpdate=function(e){var t,r,i,n,s,c,l,u,d;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():((t=e.cropSize)===null||t===void 0?void 0:t.height)!==((r=this.props.cropSize)===null||r===void 0?void 0:r.height)||((i=e.cropSize)===null||i===void 0?void 0:i.width)!==((n=this.props.cropSize)===null||n===void 0?void 0:n.width)?this.computeSizes():(((s=e.crop)===null||s===void 0?void 0:s.x)!==((c=this.props.crop)===null||c===void 0?void 0:c.x)||((l=e.crop)===null||l===void 0?void 0:l.y)!==((u=this.props.crop)===null||u===void 0?void 0:u.y))&&this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&((d=this.videoRef.current)===null||d===void 0||d.load());var h=this.getObjectFit();h!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:h},this.computeSizes)},o.prototype.getAspect=function(){var e=this.props,t=e.cropSize,r=e.aspect;return t?t.width/t.height:r},o.prototype.getObjectFit=function(){var e,t,r,i;if(this.props.objectFit==="cover"){var n=this.imageRef.current||this.videoRef.current;if(n&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var s=this.containerRect.width/this.containerRect.height,c=((e=this.imageRef.current)===null||e===void 0?void 0:e.naturalWidth)||((t=this.videoRef.current)===null||t===void 0?void 0:t.videoWidth)||0,l=((r=this.imageRef.current)===null||r===void 0?void 0:r.naturalHeight)||((i=this.videoRef.current)===null||i===void 0?void 0:i.videoHeight)||0,u=c/l;return u<s?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},o.prototype.onPinchStart=function(e){var t=o.getTouchPoint(e.touches[0]),r=o.getTouchPoint(e.touches[1]);this.lastPinchDistance=ae(t,r),this.lastPinchRotation=se(t,r),this.onDragStart(ce(t,r))},o.prototype.onPinchMove=function(e){var t=this;if(!(!this.currentDoc||!this.currentWindow)){var r=o.getTouchPoint(e.touches[0]),i=o.getTouchPoint(e.touches[1]),n=ce(r,i);this.onDrag(n),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var s=ae(r,i),c=t.props.zoom*(s/t.lastPinchDistance);t.setNewZoom(c,n,{shouldUpdatePosition:!1}),t.lastPinchDistance=s;var l=se(r,i),u=t.props.rotation+(l-t.lastPinchRotation);t.props.onRotationChange&&t.props.onRotationChange(u),t.lastPinchRotation=l})}},o.prototype.render=function(){var e=this,t,r=this.props,i=r.image,n=r.video,s=r.mediaProps,c=r.cropperProps,l=r.transform,u=r.crop,d=u.x,h=u.y,m=r.rotation,w=r.zoom,y=r.cropShape,f=r.showGrid,R=r.roundCropAreaPixels,x=r.style,v=x.containerStyle,E=x.cropAreaStyle,_=x.mediaStyle,P=r.classes,k=P.containerClassName,W=P.cropAreaClassName,D=P.mediaClassName,z=(t=this.state.mediaObjectFit)!==null&&t!==void 0?t:this.getObjectFit();return g.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(U){return e.containerRef=U},"data-testid":"container",style:v,className:L("reactEasyCrop_Container",k)},i?g.createElement("img",b({alt:"",className:L("reactEasyCrop_Image",z==="contain"&&"reactEasyCrop_Contain",z==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",z==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",D)},s,{src:i,ref:this.imageRef,style:b(b({},_),{transform:l||"translate(".concat(d,"px, ").concat(h,"px) rotate(").concat(m,"deg) scale(").concat(w,")")}),onLoad:this.onMediaLoad})):n&&g.createElement("video",b({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:L("reactEasyCrop_Video",z==="contain"&&"reactEasyCrop_Contain",z==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",z==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",D)},s,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:b(b({},_),{transform:l||"translate(".concat(d,"px, ").concat(h,"px) rotate(").concat(m,"deg) scale(").concat(w,")")}),controls:!1}),(Array.isArray(n)?n:[{src:n}]).map(function(N){return g.createElement("source",b({key:N.src},N))})),this.state.cropSize&&g.createElement("div",b({ref:this.cropperRef,style:b(b({},E),{width:R?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:R?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:L("reactEasyCrop_CropArea",y==="round"&&"reactEasyCrop_CropAreaRound",f&&"reactEasyCrop_CropAreaGrid",W)},c)))},o.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:nt,minZoom:it,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:at},o.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},o.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},o})(g.Component);function ct({className:a,defaultValue:o,value:e,min:t=0,max:r=100,...i}){const n=g.useMemo(()=>Array.isArray(e)?e:Array.isArray(o)?o:[t,r],[e,o,t,r]);return p.jsxs(Ee,{"data-slot":"slider",defaultValue:o,value:e,min:t,max:r,className:B("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",a),...i,children:[p.jsx(Se,{"data-slot":"slider-track",className:B("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-4 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),children:p.jsx(_e,{"data-slot":"slider-range",className:B("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),Array.from({length:n.length},(s,c)=>p.jsx(ze,{"data-slot":"slider-thumb",className:"border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},c))]})}const pe=["image/png","image/jpeg","image/webp"],he=2*1024*1024,de=256,lt=a=>{const o=a.normalize("NFKD").toLowerCase(),e=o.lastIndexOf("."),t=e>0?o.slice(0,e):o,r=e>0?o.slice(e).replace(/[^.a-z0-9]/g,""):"";return`${t.replace(/[^a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"profile-picture"}${r}`},ut=(a,o,e=Date.now())=>`profile-pictures/${a}/${e}-${lt(o)}`,fe=a=>pe.includes(a.type)?a.size>he?"Profile pictures must be 2MB or smaller.":a.name.trim()?null:"Please choose a valid image file.":"Only PNG, JPEG, and WebP images are allowed.",pt=a=>new Promise((o,e)=>{const t=URL.createObjectURL(a),r=new Image,i=setTimeout(()=>{URL.revokeObjectURL(t),e(new Error("Image loading timed out. Please try a different file."))},15e3);r.onload=()=>{clearTimeout(i),URL.revokeObjectURL(t),o(r)},r.onerror=()=>{clearTimeout(i),URL.revokeObjectURL(t),e(new Error("Unable to read the selected image. Please try another file."))},r.crossOrigin="anonymous",r.src=t}),le=(a,o,e)=>new Promise((t,r)=>{a.toBlob(i=>{if(!i){r(new Error("Failed to prepare the image for upload."));return}t(i)},o,e)}),ht=async(a,o=de)=>{const e=await pt(a),t=document.createElement("canvas");t.width=o,t.height=o;const r=t.getContext("2d");if(!r)throw new Error("Your browser cannot process image uploads right now.");const i=e.naturalWidth||e.width,n=e.naturalHeight||e.height,s=Math.min(i,n),c=Math.max(0,(i-s)/2),l=Math.max(0,(n-s)/2);r.clearRect(0,0,o,o),r.drawImage(e,c,l,s,s,0,0,o,o);try{return await le(t,"image/webp",.9)}catch{return await le(t,"image/jpeg",.9)}},j=(a,o,e)=>{let t;const r=new Promise((i,n)=>{t=setTimeout(()=>n(new Error(`${e} timed out after ${Math.round(o/1e3)}s`)),o)});return Promise.race([a,r]).finally(()=>clearTimeout(t))},dt=async(a,o,e)=>{const t=ge.options.projectId;if(!t)throw new Error("Firebase project ID is not configured.");const r=await a.getIdToken(),i=`https://firestore.googleapis.com/v1/projects/${t}/databases/(default)/documents/users/${o}?updateMask.fieldPaths=photo&updateMask.fieldPaths=updatedAt`,n=await fetch(i,{method:"PATCH",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify({fields:{photo:{stringValue:e},updatedAt:{timestampValue:new Date().toISOString()}}})});if(!n.ok){const s=await n.text().catch(()=>"");throw new Error(`Firestore REST update failed (${n.status}): ${s}`)}},ft=async({file:a,uid:o,currentUser:e=V.currentUser,syncFirestore:t=!0})=>{const r=fe(a);if(r)throw new Error(r);const i=e??V.currentUser;if(!i)throw new Error("You need to be signed in to change your profile picture.");const n=o||i.uid;if(!n)throw new Error("Unable to determine which profile should be updated.");if(i.uid!==n)throw new Error("The signed-in user does not match the profile being edited.");const s=await j(ht(a,de),2e4,"Image processing"),c=ut(n,a.name),l=Me(ve,c),u=await j(Ae(l,s,{contentType:s.type||"image/webp",cacheControl:"public, max-age=31536000, immutable"}),3e4,"Storage upload"),d=await j(Ne(u.ref),1e4,"Download URL retrieval");try{await j(De(i,{photoURL:d}),1e4,"Auth profile update")}catch(h){console.warn("[PROFILE UPLOAD] Auth profile update failed (non-fatal):",h)}if(t)try{await j(dt(i,n,d),1e4,"Firestore profile sync")}catch(h){console.error("[PROFILE UPLOAD] Firestore REST sync failed:",h),console.warn("[PROFILE UPLOAD] Photo was uploaded but the database record may be stale. It will refresh on next login.")}return d},mt=a=>`${(a/(1024*1024)).toFixed(1)} MB`,vt=a=>{const o=(a||"").trim();return o?o.split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()).join(""):"U"},gt=a=>new Promise((o,e)=>{const t=new Image;t.onload=()=>o(t),t.onerror=()=>e(new Error("Unable to load the image for cropping.")),t.src=a}),ue=(a,o,e)=>new Promise((t,r)=>{a.toBlob(i=>{if(!i){r(new Error("Failed to prepare the cropped image."));return}t(i)},o,e)}),wt=async(a,o,e)=>{const t=await gt(a),r=document.createElement("canvas"),i=640;r.width=i,r.height=i;const n=r.getContext("2d");if(!n)throw new Error("Your browser cannot process the selected image right now.");n.clearRect(0,0,i,i),n.drawImage(t,o.x,o.y,o.width,o.height,0,0,i,i);let s;try{s=await ue(r,"image/webp",.92)}catch{s=await ue(r,"image/jpeg",.92)}if(!s)throw new Error("Could not create an image from the cropped area.");const c=s.type==="image/webp"?"webp":"jpg",u=`${e.name.replace(/\.[^/.]+$/,"")||"profile-picture"}-cropped.${c}`;return new File([s],u,{type:s.type,lastModified:Date.now()})},Nt=({uid:a,photoURL:o,displayName:e,className:t="",onUploaded:r,syncFirestore:i=!0})=>{const{currentUser:n,refreshProfile:s}=we(),[c,l]=g.useState(null),[u,d]=g.useState(null),[h,m]=g.useState({x:0,y:0}),[w,y]=g.useState(1),[f,R]=g.useState(null),[x,v]=g.useState(""),[E,_]=g.useState(!1),P=g.useRef(null);g.useEffect(()=>{if(!c){d(null);return}const C=URL.createObjectURL(c);return d(C),()=>URL.revokeObjectURL(C)},[c]);const k=u||o||"",W=g.useMemo(()=>`${pe.map(S=>S.replace("image/","").toUpperCase()).join(", ")} up to ${mt(he)}. The image will be cropped to a circular avatar.`,[]),D=()=>{l(null),m({x:0,y:0}),y(1),R(null),v(""),P.current&&(P.current.value="")},z=C=>{const S=C.target.files?.[0]||null;if(!S)return;const M=fe(S);if(M){v(M),l(null),C.target.value="";return}v(""),l(S),m({x:0,y:0}),y(1),R(null)},N=async()=>{if(!c){v("Choose an image before saving.");return}_(!0),v("");const C=6e4;let S;try{const M=(async()=>{const I=u&&f?await wt(u,f,c):c,Z=a||n?.uid;return ft({file:I,uid:Z,currentUser:n,syncFirestore:i})})(),F=new Promise((I,Z)=>{S=setTimeout(()=>Z(new Error("Upload timed out. Please check your connection and try again.")),C)}),me=await Promise.race([M,F]);r?.(me),s().catch(I=>console.warn("[ProfilePictureUploader] refreshProfile failed:",I)),J.success("Profile picture updated."),D()}catch(M){const F=M instanceof Error?M.message:"Failed to update your profile picture.";v(F),J.error(F)}finally{clearTimeout(S),_(!1)}},U=()=>{P.current?.click()};return p.jsxs(p.Fragment,{children:[p.jsxs("section",{className:`flex items-center gap-4 rounded-xl border border-slate-200 bg-white p-4 shadow-sm ${t}`,children:[p.jsxs("div",{className:"relative cursor-pointer group",onClick:U,role:"button",tabIndex:0,onKeyDown:C=>C.key==="Enter"&&U(),"aria-label":"Change profile picture",children:[p.jsxs(xe,{className:"size-16 sm:size-20 ring-4 ring-sky-50 shadow-sm transition-transform duration-200 group-hover:scale-105",children:[p.jsx(ye,{src:k,alt:`${e||"User"} profile picture`}),p.jsx(be,{className:"bg-gradient-to-br from-sky-600 to-cyan-500 text-lg font-semibold text-white",children:vt(e)})]}),p.jsx("span",{className:"absolute -right-1 -top-1 inline-flex items-center justify-center rounded-full bg-slate-900 p-1.5 text-white shadow-md transition-colors group-hover:bg-slate-700",children:p.jsx(Le,{size:14})})]}),p.jsxs("div",{className:"space-y-1 flex-1",children:[p.jsx("p",{className:"text-sm font-semibold text-slate-900",children:"Profile picture"}),p.jsx("p",{className:"text-xs text-slate-500",children:"Click your avatar to upload a new photo."}),x&&p.jsx("p",{className:"text-xs font-medium text-rose-600 mt-1",children:x})]}),p.jsx("input",{ref:P,type:"file",accept:"image/*",onChange:z,className:"sr-only","aria-label":"Choose profile picture"})]}),p.jsx(Ce,{children:u&&p.jsxs(p.Fragment,{children:[p.jsx(K.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[60]",onClick:D}),p.jsx(K.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",duration:.5,bounce:.3},className:"fixed inset-0 z-[60] flex items-center justify-center p-4 sm:p-6",onClick:C=>C.stopPropagation(),children:p.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-lg overflow-hidden flex flex-col",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-100",children:[p.jsx("h3",{className:"text-lg font-bold text-slate-900",children:"Update profile picture"}),p.jsx("button",{onClick:D,className:"p-2 text-slate-400 hover:text-slate-600 hover:bg-slate-100 rounded-full transition-colors","aria-label":"Close modal",children:p.jsx(Te,{size:20})})]}),p.jsxs("div",{className:"p-4 sm:p-6 bg-slate-50 flex flex-col items-center",children:[p.jsx("div",{className:"relative h-[350px] sm:h-[450px] w-[350px] sm:w-[450px] mx-auto overflow-hidden rounded-xl bg-slate-100 ring-1 ring-inset ring-slate-200 shadow-inner",children:p.jsx(st,{image:u,crop:h,zoom:w,aspect:1,cropShape:"round",showGrid:!1,objectFit:"cover",restrictPosition:!0,onCropChange:m,onZoomChange:y,onCropComplete:(C,S)=>R(S),style:{containerStyle:{backgroundColor:"#f8fafc"}}})}),p.jsxs("div",{className:"mt-6 w-full max-w-xs flex items-center gap-4",children:[p.jsx(je,{size:18,className:"text-slate-500"}),p.jsx(ct,{value:[w],min:1,max:3,step:.05,onValueChange:C=>y(C[0]||1),"aria-label":"Profile picture zoom",className:"flex-1 cursor-pointer"}),p.jsx(Ue,{size:18,className:"text-slate-500"})]}),p.jsx("p",{className:"mt-4 text-xs text-slate-500 text-center",children:W})]}),p.jsxs("div",{className:"p-4 border-t border-slate-100 flex items-center justify-end gap-3 bg-white",children:[p.jsx(Q,{type:"button",variant:"ghost",onClick:D,disabled:E,className:"font-medium text-slate-600 hover:text-slate-900 hover:bg-slate-100 px-5",children:"Cancel"}),p.jsx(Q,{type:"button",onClick:N,disabled:E||!c,className:"bg-sky-600 hover:bg-sky-700 text-white min-w-[120px] gap-2 shadow-sm",children:E?p.jsxs(p.Fragment,{children:[p.jsx(Fe,{size:16,className:"animate-pulse"}),"Saving..."]}):"Save picture"})]})]})})]})})]})};export{Mt as M,Nt as P,At as V};
 
1
+ import{e as X,k as B,I as V,a_ as ve,a$ as ge,l as we,N as xe,O as ye,P as be,g as Ce,m as K,n as J}from"./index-uASBzalf.js";import{g as Pe,r as g,j as u}from"./vendor-react-B4AQeu28.js";import{_ as Re,o as b,p as Ee,q as Se,r as _e,s as ze}from"./vendor-radix-xDOIcVzp.js";import{B as Q}from"./button-BPmLcOpC.js";import{updateProfile as De}from"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-core-DCQrgkxC.js";import{r as Me,u as Ae,a as Ne}from"./vendor-firebase-storage-dc5X5yTv.js";import{X as Te}from"./x-CBb03rh3.js";import{M as je}from"./minus-Bfei9C79.js";import{P as Ue}from"./plus-Cy6hz5PP.js";import{U as Fe}from"./upload-Ds5w3QNw.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
13
  *
14
  * This source code is licensed under the ISC license.
15
  * See the LICENSE file in the root directory of this source tree.
16
+ */const ke=[["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M9 19h6",key:"456am0"}],["circle",{cx:"12",cy:"9",r:"6",key:"1nw4tq"}]],At=X("venus",ke);var $,ee;function We(){if(ee)return $;ee=1;var a=!1,o,e,t,r,i,n,s,c,l,p,d,h,m,w,y;function f(){if(!a){a=!0;var x=navigator.userAgent,v=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(x),E=/(Mac OS X)|(Windows)|(Linux)/.exec(x);if(h=/\b(iPhone|iP[ao]d)/.exec(x),m=/\b(iP[ao]d)/.exec(x),p=/Android/i.exec(x),w=/FBAN\/\w+;/i.exec(x),y=/Mobile/i.exec(x),d=!!/Win64/.exec(x),v){o=v[1]?parseFloat(v[1]):v[5]?parseFloat(v[5]):NaN,o&&document&&document.documentMode&&(o=document.documentMode);var _=/(?:Trident\/(\d+.\d+))/.exec(x);n=_?parseFloat(_[1])+4:o,e=v[2]?parseFloat(v[2]):NaN,t=v[3]?parseFloat(v[3]):NaN,r=v[4]?parseFloat(v[4]):NaN,r?(v=/(?:Chrome\/(\d+\.\d+))/.exec(x),i=v&&v[1]?parseFloat(v[1]):NaN):i=NaN}else o=e=t=i=r=NaN;if(E){if(E[1]){var P=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(x);s=P?parseFloat(P[1].replace("_",".")):!0}else s=!1;c=!!E[2],l=!!E[3]}else s=c=l=!1}}var R={ie:function(){return f()||o},ieCompatibilityMode:function(){return f()||n>o},ie64:function(){return R.ie()&&d},firefox:function(){return f()||e},opera:function(){return f()||t},webkit:function(){return f()||r},safari:function(){return R.webkit()},chrome:function(){return f()||i},windows:function(){return f()||c},osx:function(){return f()||s},linux:function(){return f()||l},iphone:function(){return f()||h},mobile:function(){return f()||h||m||p||y},nativeApp:function(){return f()||w},android:function(){return f()||p},ipad:function(){return f()||m}};return $=R,$}var H,te;function Ze(){if(te)return H;te=1;var a=!!(typeof window<"u"&&window.document&&window.document.createElement),o={canUseDOM:a,canUseWorkers:typeof Worker<"u",canUseEventListeners:a&&!!(window.addEventListener||window.attachEvent),canUseViewport:a&&!!window.screen,isInWorker:!a};return H=o,H}var q,re;function Be(){if(re)return q;re=1;var a=Ze(),o;a.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);/**
17
  * Checks if an event is supported in the current execution environment.
18
  *
19
  * NOTE: This will not work correctly for non-generic events such as `change`,
 
26
  * @return {boolean} True if the event is supported.
27
  * @internal
28
  * @license Modernizr 3.0.0pre (Custom Build) | MIT
29
+ */function e(t,r){if(!a.canUseDOM||r&&!("addEventListener"in document))return!1;var i="on"+t,n=i in document;if(!n){var s=document.createElement("div");s.setAttribute(i,"return;"),n=typeof s[i]=="function"}return!n&&o&&t==="wheel"&&(n=document.implementation.hasFeature("Events.wheel","3.0")),n}return q=e,q}var G,oe;function $e(){if(oe)return G;oe=1;var a=We(),o=Be(),e=10,t=40,r=800;function i(n){var s=0,c=0,l=0,p=0;return"detail"in n&&(c=n.detail),"wheelDelta"in n&&(c=-n.wheelDelta/120),"wheelDeltaY"in n&&(c=-n.wheelDeltaY/120),"wheelDeltaX"in n&&(s=-n.wheelDeltaX/120),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(s=c,c=0),l=s*e,p=c*e,"deltaY"in n&&(p=n.deltaY),"deltaX"in n&&(l=n.deltaX),(l||p)&&n.deltaMode&&(n.deltaMode==1?(l*=t,p*=t):(l*=r,p*=r)),l&&!s&&(s=l<1?-1:1),p&&!c&&(c=p<1?-1:1),{spinX:s,spinY:c,pixelX:l,pixelY:p}}return i.getEventType=function(){return a.firefox()?"DOMMouseScroll":o("wheel")?"wheel":"mousewheel"},G=i,G}var Y,ie;function He(){return ie||(ie=1,Y=$e()),Y}var qe=He();const Ge=Pe(qe);function Ye(a,o,e,t,r,i){i===void 0&&(i=0);var n=A(a,o,i),s=n.width,c=n.height,l=Math.min(s,e),p=Math.min(c,t);return l>p*r?{width:p*r,height:p}:{width:l,height:l/r}}function Xe(a){return a.width>a.height?a.width/a.naturalWidth:a.height/a.naturalHeight}function T(a,o,e,t,r){r===void 0&&(r=0);var i=A(o.width,o.height,r),n=i.width,s=i.height;return{x:ne(a.x,n,e.width,t),y:ne(a.y,s,e.height,t)}}function ne(a,o,e,t){var r=Math.abs(o*t/2-e/2);return O(a,-r,r)}function ae(a,o){return Math.sqrt(Math.pow(a.y-o.y,2)+Math.pow(a.x-o.x,2))}function se(a,o){return Math.atan2(o.y-a.y,o.x-a.x)*180/Math.PI}function Ve(a,o,e,t,r,i,n){i===void 0&&(i=0),n===void 0&&(n=!0);var s=n?Ke:Je,c=A(o.width,o.height,i),l=A(o.naturalWidth,o.naturalHeight,i),p={x:s(100,((c.width-e.width/r)/2-a.x/r)/c.width*100),y:s(100,((c.height-e.height/r)/2-a.y/r)/c.height*100),width:s(100,e.width/c.width*100/r),height:s(100,e.height/c.height*100/r)},d=Math.round(s(l.width,p.width*l.width/100)),h=Math.round(s(l.height,p.height*l.height/100)),m=l.width>=l.height*t,w=m?{width:Math.round(h*t),height:h}:{width:d,height:Math.round(d/t)},y=b(b({},w),{x:Math.round(s(l.width-w.width,p.x*l.width/100)),y:Math.round(s(l.height-w.height,p.y*l.height/100))});return{croppedAreaPercentages:p,croppedAreaPixels:y}}function Ke(a,o){return Math.min(a,Math.max(0,o))}function Je(a,o){return o}function Qe(a,o,e,t,r,i){var n=A(o.width,o.height,e),s=O(t.width/n.width*(100/a.width),r,i),c={x:s*n.width/2-t.width/2-n.width*s*(a.x/100),y:s*n.height/2-t.height/2-n.height*s*(a.y/100)};return{crop:c,zoom:s}}function et(a,o,e){var t=Xe(o);return e.height>e.width?e.height/(a.height*t):e.width/(a.width*t)}function tt(a,o,e,t,r,i){e===void 0&&(e=0);var n=A(o.naturalWidth,o.naturalHeight,e),s=O(et(a,o,t),r,i),c=t.height>t.width?t.height/a.height:t.width/a.width,l={x:((n.width-a.width)/2-a.x)*c,y:((n.height-a.height)/2-a.y)*c};return{crop:l,zoom:s}}function ce(a,o){return{x:(o.x+a.x)/2,y:(o.y+a.y)/2}}function rt(a){return a*Math.PI/180}function A(a,o,e){var t=rt(e);return{width:Math.abs(Math.cos(t)*a)+Math.abs(Math.sin(t)*o),height:Math.abs(Math.sin(t)*a)+Math.abs(Math.cos(t)*o)}}function O(a,o,e){return Math.min(Math.max(a,o),e)}function L(){for(var a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];return a.filter(function(e){return typeof e=="string"&&e.length>0}).join(" ").trim()}var ot=`.reactEasyCrop_Container {
30
  position: absolute;
31
  top: 0;
32
  left: 0;
 
106
  border-left: 0;
107
  border-right: 0;
108
  }
109
+ `,it=1,nt=3,at=1,st=(function(a){Re(o,a);function o(){var e=a!==null&&a.apply(this,arguments)||this;return e.cropperRef=g.createRef(),e.imageRef=g.createRef(),e.videoRef=g.createRef(),e.containerPosition={x:0,y:0},e.containerRef=null,e.styleRef=null,e.containerRect=null,e.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},e.dragStartPosition={x:0,y:0},e.dragStartCrop={x:0,y:0},e.gestureZoomStart=0,e.gestureRotationStart=0,e.isTouching=!1,e.lastPinchDistance=0,e.lastPinchRotation=0,e.rafDragTimeout=null,e.rafPinchTimeout=null,e.wheelTimer=null,e.currentDoc=typeof document<"u"?document:null,e.currentWindow=typeof window<"u"?window:null,e.resizeObserver=null,e.previousCropSize=null,e.isInitialized=!1,e.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},e.initResizeObserver=function(){if(!(typeof window.ResizeObserver>"u"||!e.containerRef)){var t=!0;e.resizeObserver=new window.ResizeObserver(function(r){if(t){t=!1;return}e.computeSizes()}),e.resizeObserver.observe(e.containerRef)}},e.preventZoomSafari=function(t){return t.preventDefault()},e.cleanEvents=function(){e.currentDoc&&(e.currentDoc.removeEventListener("mousemove",e.onMouseMove),e.currentDoc.removeEventListener("mouseup",e.onDragStopped),e.currentDoc.removeEventListener("touchmove",e.onTouchMove),e.currentDoc.removeEventListener("touchend",e.onDragStopped),e.currentDoc.removeEventListener("gesturechange",e.onGestureChange),e.currentDoc.removeEventListener("gestureend",e.onGestureEnd),e.currentDoc.removeEventListener("scroll",e.onScroll))},e.clearScrollEvent=function(){e.containerRef&&e.containerRef.removeEventListener("wheel",e.onWheel),e.wheelTimer&&clearTimeout(e.wheelTimer)},e.onMediaLoad=function(){var t=e.computeSizes();t&&(e.previousCropSize=t,e.emitCropData(),e.setInitialCrop(t),e.isInitialized=!0),e.props.onMediaLoaded&&e.props.onMediaLoaded(e.mediaSize)},e.setInitialCrop=function(t){if(e.props.initialCroppedAreaPercentages){var r=Qe(e.props.initialCroppedAreaPercentages,e.mediaSize,e.props.rotation,t,e.props.minZoom,e.props.maxZoom),i=r.crop,n=r.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(n)}else if(e.props.initialCroppedAreaPixels){var s=tt(e.props.initialCroppedAreaPixels,e.mediaSize,e.props.rotation,t,e.props.minZoom,e.props.maxZoom),i=s.crop,n=s.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(n)}},e.computeSizes=function(){var t,r,i,n,s,c,l=e.imageRef.current||e.videoRef.current;if(l&&e.containerRef){e.containerRect=e.containerRef.getBoundingClientRect(),e.saveContainerPosition();var p=e.containerRect.width/e.containerRect.height,d=((t=e.imageRef.current)===null||t===void 0?void 0:t.naturalWidth)||((r=e.videoRef.current)===null||r===void 0?void 0:r.videoWidth)||0,h=((i=e.imageRef.current)===null||i===void 0?void 0:i.naturalHeight)||((n=e.videoRef.current)===null||n===void 0?void 0:n.videoHeight)||0,m=l.offsetWidth<d||l.offsetHeight<h,w=d/h,y=void 0;if(m)switch(e.state.mediaObjectFit){default:case"contain":y=p>w?{width:e.containerRect.height*w,height:e.containerRect.height}:{width:e.containerRect.width,height:e.containerRect.width/w};break;case"horizontal-cover":y={width:e.containerRect.width,height:e.containerRect.width/w};break;case"vertical-cover":y={width:e.containerRect.height*w,height:e.containerRect.height};break}else y={width:l.offsetWidth,height:l.offsetHeight};e.mediaSize=b(b({},y),{naturalWidth:d,naturalHeight:h}),e.props.setMediaSize&&e.props.setMediaSize(e.mediaSize);var f=e.props.cropSize?e.props.cropSize:Ye(e.mediaSize.width,e.mediaSize.height,e.containerRect.width,e.containerRect.height,e.props.aspect,e.props.rotation);return(((s=e.state.cropSize)===null||s===void 0?void 0:s.height)!==f.height||((c=e.state.cropSize)===null||c===void 0?void 0:c.width)!==f.width)&&e.props.onCropSizeChange&&e.props.onCropSizeChange(f),e.setState({cropSize:f},e.recomputeCropPosition),e.props.setCropSize&&e.props.setCropSize(f),f}},e.saveContainerPosition=function(){if(e.containerRef){var t=e.containerRef.getBoundingClientRect();e.containerPosition={x:t.left,y:t.top}}},e.onMouseDown=function(t){e.currentDoc&&(t.preventDefault(),e.currentDoc.addEventListener("mousemove",e.onMouseMove),e.currentDoc.addEventListener("mouseup",e.onDragStopped),e.saveContainerPosition(),e.onDragStart(o.getMousePoint(t)))},e.onMouseMove=function(t){return e.onDrag(o.getMousePoint(t))},e.onScroll=function(t){e.currentDoc&&(t.preventDefault(),e.saveContainerPosition())},e.onTouchStart=function(t){e.currentDoc&&(e.isTouching=!0,!(e.props.onTouchRequest&&!e.props.onTouchRequest(t))&&(e.currentDoc.addEventListener("touchmove",e.onTouchMove,{passive:!1}),e.currentDoc.addEventListener("touchend",e.onDragStopped),e.saveContainerPosition(),t.touches.length===2?e.onPinchStart(t):t.touches.length===1&&e.onDragStart(o.getTouchPoint(t.touches[0]))))},e.onTouchMove=function(t){t.preventDefault(),t.touches.length===2?e.onPinchMove(t):t.touches.length===1&&e.onDrag(o.getTouchPoint(t.touches[0]))},e.onGestureStart=function(t){e.currentDoc&&(t.preventDefault(),e.currentDoc.addEventListener("gesturechange",e.onGestureChange),e.currentDoc.addEventListener("gestureend",e.onGestureEnd),e.gestureZoomStart=e.props.zoom,e.gestureRotationStart=e.props.rotation)},e.onGestureChange=function(t){if(t.preventDefault(),!e.isTouching){var r=o.getMousePoint(t),i=e.gestureZoomStart-1+t.scale;if(e.setNewZoom(i,r,{shouldUpdatePosition:!0}),e.props.onRotationChange){var n=e.gestureRotationStart+t.rotation;e.props.onRotationChange(n)}}},e.onGestureEnd=function(t){e.cleanEvents()},e.onDragStart=function(t){var r,i,n=t.x,s=t.y;e.dragStartPosition={x:n,y:s},e.dragStartCrop=b({},e.props.crop),(i=(r=e.props).onInteractionStart)===null||i===void 0||i.call(r)},e.onDrag=function(t){var r=t.x,i=t.y;e.currentWindow&&(e.rafDragTimeout&&e.currentWindow.cancelAnimationFrame(e.rafDragTimeout),e.rafDragTimeout=e.currentWindow.requestAnimationFrame(function(){if(e.state.cropSize&&!(r===void 0||i===void 0)){var n=r-e.dragStartPosition.x,s=i-e.dragStartPosition.y,c={x:e.dragStartCrop.x+n,y:e.dragStartCrop.y+s},l=e.props.restrictPosition?T(c,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):c;e.props.onCropChange(l)}}))},e.onDragStopped=function(){var t,r;e.isTouching=!1,e.cleanEvents(),e.emitCropData(),(r=(t=e.props).onInteractionEnd)===null||r===void 0||r.call(t)},e.onWheel=function(t){if(e.currentWindow&&!(e.props.onWheelRequest&&!e.props.onWheelRequest(t))){t.preventDefault();var r=o.getMousePoint(t),i=Ge(t).pixelY,n=e.props.zoom-i*e.props.zoomSpeed/200;e.setNewZoom(n,r,{shouldUpdatePosition:!0}),e.state.hasWheelJustStarted||e.setState({hasWheelJustStarted:!0},function(){var s,c;return(c=(s=e.props).onInteractionStart)===null||c===void 0?void 0:c.call(s)}),e.wheelTimer&&clearTimeout(e.wheelTimer),e.wheelTimer=e.currentWindow.setTimeout(function(){return e.setState({hasWheelJustStarted:!1},function(){var s,c;return(c=(s=e.props).onInteractionEnd)===null||c===void 0?void 0:c.call(s)})},250)}},e.getPointOnContainer=function(t,r){var i=t.x,n=t.y;if(!e.containerRect)throw new Error("The Cropper is not mounted");return{x:e.containerRect.width/2-(i-r.x),y:e.containerRect.height/2-(n-r.y)}},e.getPointOnMedia=function(t){var r=t.x,i=t.y,n=e.props,s=n.crop,c=n.zoom;return{x:(r+s.x)/c,y:(i+s.y)/c}},e.setNewZoom=function(t,r,i){var n=i===void 0?{}:i,s=n.shouldUpdatePosition,c=s===void 0?!0:s;if(!(!e.state.cropSize||!e.props.onZoomChange)){var l=O(t,e.props.minZoom,e.props.maxZoom);if(c){var p=e.getPointOnContainer(r,e.containerPosition),d=e.getPointOnMedia(p),h={x:d.x*l-p.x,y:d.y*l-p.y},m=e.props.restrictPosition?T(h,e.mediaSize,e.state.cropSize,l,e.props.rotation):h;e.props.onCropChange(m)}e.props.onZoomChange(l)}},e.getCropData=function(){if(!e.state.cropSize)return null;var t=e.props.restrictPosition?T(e.props.crop,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):e.props.crop;return Ve(t,e.mediaSize,e.state.cropSize,e.getAspect(),e.props.zoom,e.props.rotation,e.props.restrictPosition)},e.emitCropData=function(){var t=e.getCropData();if(t){var r=t.croppedAreaPercentages,i=t.croppedAreaPixels;e.props.onCropComplete&&e.props.onCropComplete(r,i),e.props.onCropAreaChange&&e.props.onCropAreaChange(r,i)}},e.emitCropAreaChange=function(){var t=e.getCropData();if(t){var r=t.croppedAreaPercentages,i=t.croppedAreaPixels;e.props.onCropAreaChange&&e.props.onCropAreaChange(r,i)}},e.recomputeCropPosition=function(){var t,r;if(e.state.cropSize){var i=e.props.crop;if(e.isInitialized&&(!((t=e.previousCropSize)===null||t===void 0)&&t.width)&&(!((r=e.previousCropSize)===null||r===void 0)&&r.height)){var n=Math.abs(e.previousCropSize.width-e.state.cropSize.width)>1e-6||Math.abs(e.previousCropSize.height-e.state.cropSize.height)>1e-6;if(n){var s=e.state.cropSize.width/e.previousCropSize.width,c=e.state.cropSize.height/e.previousCropSize.height;i={x:e.props.crop.x*s,y:e.props.crop.y*c}}}var l=e.props.restrictPosition?T(i,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):i;e.previousCropSize=e.state.cropSize,e.props.onCropChange(l),e.emitCropData()}},e.onKeyDown=function(t){var r,i,n=e.props,s=n.crop,c=n.onCropChange,l=n.keyboardStep,p=n.zoom,d=n.rotation,h=l;if(e.state.cropSize){t.shiftKey&&(h*=.2);var m=b({},s);switch(t.key){case"ArrowUp":m.y-=h,t.preventDefault();break;case"ArrowDown":m.y+=h,t.preventDefault();break;case"ArrowLeft":m.x-=h,t.preventDefault();break;case"ArrowRight":m.x+=h,t.preventDefault();break;default:return}e.props.restrictPosition&&(m=T(m,e.mediaSize,e.state.cropSize,p,d)),t.repeat||(i=(r=e.props).onInteractionStart)===null||i===void 0||i.call(r),c(m)}},e.onKeyUp=function(t){var r,i;switch(t.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":t.preventDefault();break;default:return}e.emitCropData(),(i=(r=e.props).onInteractionEnd)===null||i===void 0||i.call(r)},e}return o.prototype.componentDidMount=function(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=ot,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))},o.prototype.componentWillUnmount=function(){var e,t;!this.currentDoc||!this.currentWindow||(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.computeSizes),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&((t=this.styleRef.parentNode)===null||t===void 0||t.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},o.prototype.componentDidUpdate=function(e){var t,r,i,n,s,c,l,p,d;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():((t=e.cropSize)===null||t===void 0?void 0:t.height)!==((r=this.props.cropSize)===null||r===void 0?void 0:r.height)||((i=e.cropSize)===null||i===void 0?void 0:i.width)!==((n=this.props.cropSize)===null||n===void 0?void 0:n.width)?this.computeSizes():(((s=e.crop)===null||s===void 0?void 0:s.x)!==((c=this.props.crop)===null||c===void 0?void 0:c.x)||((l=e.crop)===null||l===void 0?void 0:l.y)!==((p=this.props.crop)===null||p===void 0?void 0:p.y))&&this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&((d=this.videoRef.current)===null||d===void 0||d.load());var h=this.getObjectFit();h!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:h},this.computeSizes)},o.prototype.getAspect=function(){var e=this.props,t=e.cropSize,r=e.aspect;return t?t.width/t.height:r},o.prototype.getObjectFit=function(){var e,t,r,i;if(this.props.objectFit==="cover"){var n=this.imageRef.current||this.videoRef.current;if(n&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var s=this.containerRect.width/this.containerRect.height,c=((e=this.imageRef.current)===null||e===void 0?void 0:e.naturalWidth)||((t=this.videoRef.current)===null||t===void 0?void 0:t.videoWidth)||0,l=((r=this.imageRef.current)===null||r===void 0?void 0:r.naturalHeight)||((i=this.videoRef.current)===null||i===void 0?void 0:i.videoHeight)||0,p=c/l;return p<s?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},o.prototype.onPinchStart=function(e){var t=o.getTouchPoint(e.touches[0]),r=o.getTouchPoint(e.touches[1]);this.lastPinchDistance=ae(t,r),this.lastPinchRotation=se(t,r),this.onDragStart(ce(t,r))},o.prototype.onPinchMove=function(e){var t=this;if(!(!this.currentDoc||!this.currentWindow)){var r=o.getTouchPoint(e.touches[0]),i=o.getTouchPoint(e.touches[1]),n=ce(r,i);this.onDrag(n),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var s=ae(r,i),c=t.props.zoom*(s/t.lastPinchDistance);t.setNewZoom(c,n,{shouldUpdatePosition:!1}),t.lastPinchDistance=s;var l=se(r,i),p=t.props.rotation+(l-t.lastPinchRotation);t.props.onRotationChange&&t.props.onRotationChange(p),t.lastPinchRotation=l})}},o.prototype.render=function(){var e=this,t,r=this.props,i=r.image,n=r.video,s=r.mediaProps,c=r.cropperProps,l=r.transform,p=r.crop,d=p.x,h=p.y,m=r.rotation,w=r.zoom,y=r.cropShape,f=r.showGrid,R=r.roundCropAreaPixels,x=r.style,v=x.containerStyle,E=x.cropAreaStyle,_=x.mediaStyle,P=r.classes,k=P.containerClassName,W=P.cropAreaClassName,D=P.mediaClassName,z=(t=this.state.mediaObjectFit)!==null&&t!==void 0?t:this.getObjectFit();return g.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(U){return e.containerRef=U},"data-testid":"container",style:v,className:L("reactEasyCrop_Container",k)},i?g.createElement("img",b({alt:"",className:L("reactEasyCrop_Image",z==="contain"&&"reactEasyCrop_Contain",z==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",z==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",D)},s,{src:i,ref:this.imageRef,style:b(b({},_),{transform:l||"translate(".concat(d,"px, ").concat(h,"px) rotate(").concat(m,"deg) scale(").concat(w,")")}),onLoad:this.onMediaLoad})):n&&g.createElement("video",b({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:L("reactEasyCrop_Video",z==="contain"&&"reactEasyCrop_Contain",z==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",z==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",D)},s,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:b(b({},_),{transform:l||"translate(".concat(d,"px, ").concat(h,"px) rotate(").concat(m,"deg) scale(").concat(w,")")}),controls:!1}),(Array.isArray(n)?n:[{src:n}]).map(function(N){return g.createElement("source",b({key:N.src},N))})),this.state.cropSize&&g.createElement("div",b({ref:this.cropperRef,style:b(b({},E),{width:R?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:R?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:L("reactEasyCrop_CropArea",y==="round"&&"reactEasyCrop_CropAreaRound",f&&"reactEasyCrop_CropAreaGrid",W)},c)))},o.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:nt,minZoom:it,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:at},o.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},o.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},o})(g.Component);function ct({className:a,defaultValue:o,value:e,min:t=0,max:r=100,...i}){const n=g.useMemo(()=>Array.isArray(e)?e:Array.isArray(o)?o:[t,r],[e,o,t,r]);return u.jsxs(Ee,{"data-slot":"slider",defaultValue:o,value:e,min:t,max:r,className:B("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",a),...i,children:[u.jsx(Se,{"data-slot":"slider-track",className:B("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-4 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),children:u.jsx(_e,{"data-slot":"slider-range",className:B("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),Array.from({length:n.length},(s,c)=>u.jsx(ze,{"data-slot":"slider-thumb",className:"border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},c))]})}const ue=["image/png","image/jpeg","image/webp"],he=2*1024*1024,de=256,lt=a=>{const o=a.normalize("NFKD").toLowerCase(),e=o.lastIndexOf("."),t=e>0?o.slice(0,e):o,r=e>0?o.slice(e).replace(/[^.a-z0-9]/g,""):"";return`${t.replace(/[^a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"profile-picture"}${r}`},pt=(a,o,e=Date.now())=>`profile-pictures/${a}/${e}-${lt(o)}`,fe=a=>ue.includes(a.type)?a.size>he?"Profile pictures must be 2MB or smaller.":a.name.trim()?null:"Please choose a valid image file.":"Only PNG, JPEG, and WebP images are allowed.",ut=a=>new Promise((o,e)=>{const t=URL.createObjectURL(a),r=new Image,i=setTimeout(()=>{URL.revokeObjectURL(t),e(new Error("Image loading timed out. Please try a different file."))},15e3);r.onload=()=>{clearTimeout(i),URL.revokeObjectURL(t),o(r)},r.onerror=()=>{clearTimeout(i),URL.revokeObjectURL(t),e(new Error("Unable to read the selected image. Please try another file."))},r.crossOrigin="anonymous",r.src=t}),le=(a,o,e)=>new Promise((t,r)=>{a.toBlob(i=>{if(!i){r(new Error("Failed to prepare the image for upload."));return}t(i)},o,e)}),ht=async(a,o=de)=>{const e=await ut(a),t=document.createElement("canvas");t.width=o,t.height=o;const r=t.getContext("2d");if(!r)throw new Error("Your browser cannot process image uploads right now.");const i=e.naturalWidth||e.width,n=e.naturalHeight||e.height,s=Math.min(i,n),c=Math.max(0,(i-s)/2),l=Math.max(0,(n-s)/2);r.clearRect(0,0,o,o),r.drawImage(e,c,l,s,s,0,0,o,o);try{return await le(t,"image/webp",.9)}catch{return await le(t,"image/jpeg",.9)}},j=(a,o,e)=>{let t;const r=new Promise((i,n)=>{t=setTimeout(()=>n(new Error(`${e} timed out after ${Math.round(o/1e3)}s`)),o)});return Promise.race([a,r]).finally(()=>clearTimeout(t))},dt=async(a,o,e)=>{const t=ge.options.projectId;if(!t)throw new Error("Firebase project ID is not configured.");const r=await a.getIdToken(),i=`https://firestore.googleapis.com/v1/projects/${t}/databases/(default)/documents/users/${o}?updateMask.fieldPaths=photo&updateMask.fieldPaths=updatedAt`,n=await fetch(i,{method:"PATCH",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify({fields:{photo:{stringValue:e},updatedAt:{timestampValue:new Date().toISOString()}}})});if(!n.ok){const s=await n.text().catch(()=>"");throw new Error(`Firestore REST update failed (${n.status}): ${s}`)}},ft=async({file:a,uid:o,currentUser:e=V.currentUser,syncFirestore:t=!0})=>{const r=fe(a);if(r)throw new Error(r);const i=e??V.currentUser;if(!i)throw new Error("You need to be signed in to change your profile picture.");const n=o||i.uid;if(!n)throw new Error("Unable to determine which profile should be updated.");if(i.uid!==n)throw new Error("The signed-in user does not match the profile being edited.");const s=await j(ht(a,de),2e4,"Image processing"),c=pt(n,a.name),l=Me(ve,c),p=await j(Ae(l,s,{contentType:s.type||"image/webp",cacheControl:"public, max-age=31536000, immutable"}),3e4,"Storage upload"),d=await j(Ne(p.ref),1e4,"Download URL retrieval");try{await j(De(i,{photoURL:d}),1e4,"Auth profile update")}catch(h){console.warn("[PROFILE UPLOAD] Auth profile update failed (non-fatal):",h)}if(t)try{await j(dt(i,n,d),1e4,"Firestore profile sync")}catch(h){console.error("[PROFILE UPLOAD] Firestore REST sync failed:",h),console.warn("[PROFILE UPLOAD] Photo was uploaded but the database record may be stale. It will refresh on next login.")}return d},mt=a=>`${(a/(1024*1024)).toFixed(1)} MB`,vt=a=>{const o=(a||"").trim();return o?o.split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()).join(""):"U"},gt=a=>new Promise((o,e)=>{const t=new Image;t.onload=()=>o(t),t.onerror=()=>e(new Error("Unable to load the image for cropping.")),t.src=a}),pe=(a,o,e)=>new Promise((t,r)=>{a.toBlob(i=>{if(!i){r(new Error("Failed to prepare the cropped image."));return}t(i)},o,e)}),wt=async(a,o,e)=>{const t=await gt(a),r=document.createElement("canvas"),i=640;r.width=i,r.height=i;const n=r.getContext("2d");if(!n)throw new Error("Your browser cannot process the selected image right now.");n.clearRect(0,0,i,i),n.drawImage(t,o.x,o.y,o.width,o.height,0,0,i,i);let s;try{s=await pe(r,"image/webp",.92)}catch{s=await pe(r,"image/jpeg",.92)}if(!s)throw new Error("Could not create an image from the cropped area.");const c=s.type==="image/webp"?"webp":"jpg",p=`${e.name.replace(/\.[^/.]+$/,"")||"profile-picture"}-cropped.${c}`;return new File([s],p,{type:s.type,lastModified:Date.now()})},Nt=({uid:a,photoURL:o,displayName:e,className:t="",onUploaded:r,syncFirestore:i=!0})=>{const{currentUser:n,refreshProfile:s}=we(),[c,l]=g.useState(null),[p,d]=g.useState(null),[h,m]=g.useState({x:0,y:0}),[w,y]=g.useState(1),[f,R]=g.useState(null),[x,v]=g.useState(""),[E,_]=g.useState(!1),P=g.useRef(null);g.useEffect(()=>{if(!c){d(null);return}const C=URL.createObjectURL(c);return d(C),()=>URL.revokeObjectURL(C)},[c]);const k=p||o||"",W=g.useMemo(()=>`${ue.map(S=>S.replace("image/","").toUpperCase()).join(", ")} up to ${mt(he)}. The image will be cropped to a circular avatar.`,[]),D=()=>{l(null),m({x:0,y:0}),y(1),R(null),v(""),P.current&&(P.current.value="")},z=C=>{const S=C.target.files?.[0]||null;if(!S)return;const M=fe(S);if(M){v(M),l(null),C.target.value="";return}v(""),l(S),m({x:0,y:0}),y(1),R(null)},N=async()=>{if(!c){v("Choose an image before saving.");return}_(!0),v("");const C=6e4;let S;try{const M=(async()=>{const I=p&&f?await wt(p,f,c):c,Z=a||n?.uid;return ft({file:I,uid:Z,currentUser:n,syncFirestore:i})})(),F=new Promise((I,Z)=>{S=setTimeout(()=>Z(new Error("Upload timed out. Please check your connection and try again.")),C)}),me=await Promise.race([M,F]);r?.(me),s().catch(I=>console.warn("[ProfilePictureUploader] refreshProfile failed:",I)),J.success("Profile picture updated."),D()}catch(M){const F=M instanceof Error?M.message:"Failed to update your profile picture.";v(F),J.error(F)}finally{clearTimeout(S),_(!1)}},U=()=>{P.current?.click()};return u.jsxs(u.Fragment,{children:[u.jsxs("section",{className:`flex items-center gap-4 rounded-xl border border-slate-200 bg-white p-4 shadow-sm ${t}`,children:[u.jsxs("div",{className:"relative cursor-pointer group",onClick:U,role:"button",tabIndex:0,onKeyDown:C=>C.key==="Enter"&&U(),"aria-label":"Change profile picture",children:[u.jsxs(xe,{className:"size-16 sm:size-20 ring-4 ring-sky-50 shadow-sm transition-transform duration-200 group-hover:scale-105",children:[u.jsx(ye,{src:k,alt:`${e||"User"} profile picture`}),u.jsx(be,{className:"bg-gradient-to-br from-sky-600 to-cyan-500 text-lg font-semibold text-white",children:vt(e)})]}),u.jsx("span",{className:"absolute -right-1 -top-1 inline-flex items-center justify-center rounded-full bg-slate-900 p-1.5 text-white shadow-md transition-colors group-hover:bg-slate-700",children:u.jsx(Le,{size:14})})]}),u.jsxs("div",{className:"space-y-1 flex-1",children:[u.jsx("p",{className:"text-sm font-semibold text-slate-900",children:"Profile picture"}),u.jsx("p",{className:"text-xs text-slate-500",children:"Click your avatar to upload a new photo."}),x&&u.jsx("p",{className:"text-xs font-medium text-rose-600 mt-1",children:x})]}),u.jsx("input",{ref:P,type:"file",accept:"image/*",onChange:z,className:"sr-only","aria-label":"Choose profile picture"})]}),u.jsx(Ce,{children:p&&u.jsxs(u.Fragment,{children:[u.jsx(K.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[60]",onClick:D}),u.jsx(K.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",duration:.5,bounce:.3},className:"fixed inset-0 z-[60] flex items-center justify-center p-4 sm:p-6",onClick:C=>C.stopPropagation(),children:u.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-lg overflow-hidden flex flex-col",children:[u.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-100",children:[u.jsx("h3",{className:"text-lg font-bold text-slate-900",children:"Update profile picture"}),u.jsx("button",{onClick:D,className:"p-2 text-slate-400 hover:text-slate-600 hover:bg-slate-100 rounded-full transition-colors","aria-label":"Close modal",children:u.jsx(Te,{size:20})})]}),u.jsxs("div",{className:"p-4 sm:p-6 bg-slate-50 flex flex-col items-center",children:[u.jsx("div",{className:"relative h-[350px] sm:h-[450px] w-[350px] sm:w-[450px] mx-auto overflow-hidden rounded-xl bg-slate-100 ring-1 ring-inset ring-slate-200 shadow-inner",children:u.jsx(st,{image:p,crop:h,zoom:w,aspect:1,cropShape:"round",showGrid:!1,objectFit:"cover",restrictPosition:!0,onCropChange:m,onZoomChange:y,onCropComplete:(C,S)=>R(S),style:{containerStyle:{backgroundColor:"#f8fafc"}}})}),u.jsxs("div",{className:"mt-6 w-full max-w-xs flex items-center gap-4",children:[u.jsx(je,{size:18,className:"text-slate-500"}),u.jsx(ct,{value:[w],min:1,max:3,step:.05,onValueChange:C=>y(C[0]||1),"aria-label":"Profile picture zoom",className:"flex-1 cursor-pointer"}),u.jsx(Ue,{size:18,className:"text-slate-500"})]}),u.jsx("p",{className:"mt-4 text-xs text-slate-500 text-center",children:W})]}),u.jsxs("div",{className:"p-4 border-t border-slate-100 flex items-center justify-end gap-3 bg-white",children:[u.jsx(Q,{type:"button",variant:"ghost",onClick:D,disabled:E,className:"font-medium text-slate-600 hover:text-slate-900 hover:bg-slate-100 px-5",children:"Cancel"}),u.jsx(Q,{type:"button",onClick:N,disabled:E||!c,className:"bg-sky-600 hover:bg-sky-700 text-white min-w-[120px] gap-2 shadow-sm",children:E?u.jsxs(u.Fragment,{children:[u.jsx(Fe,{size:16,className:"animate-pulse"}),"Saving..."]}):"Save picture"})]})]})})]})})]})};export{Mt as M,Nt as P,At as V};
assets/{QuizBattlePage-Bwu0snEF.js β†’ QuizBattlePage-BaCri_Ce.js} RENAMED
The diff for this file is too large to render. See raw diff
 
assets/{RewardsModal-CPyFRkMy.js β†’ RewardsModal-kuski-56.js} RENAMED
@@ -1 +1 @@
1
- import{r as d,j as e}from"./vendor-react-B4AQeu28.js";import{getDoc as F,doc as S}from"./vendor-firebase-firestore-CH1lNiRF.js";import{aI as u,A as j,aJ as U,aK as P,U as B,z as I,aL as $,r as R,aM as L,T as g,aN as M,W as N,R as T,S as q,P as X,O as w,X as v,B as G,Z as H,y as W,x as Z,G as J,a as K,aC as O,f as Q}from"./index-BaOs5Ayg.js";import{X as V}from"./x-TNvtuOD9.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";const Y={BookOpen:K,GraduationCap:J,Trophy:Z,Target:W,Zap:H,Brain:G,Star:v,Flame:w,Swords:X,Shield:q,RefreshCw:T,Crown:N,Sun:M,TrendingUp:g,Globe:L,User:R,UserPlus:$,Calendar:I,Users:B,Compass:P,Heart:U,Award:j},me=({isOpen:o,onClose:c,userLevel:n,currentXP:x,xpToNextLevel:m,totalXP:p,userId:i})=>{const[y,b]=d.useState(!0),[k,_]=d.useState(new Set),[C,E]=d.useState({});d.useEffect(()=>{if(!o||!i)return;(async()=>{b(!0);try{const t=await O(i);_(new Set(t.map(a=>a.id)));const r=await F(S(Q,"progress",i));r.exists()&&E(r.data())}catch(t){console.error("Error loading achievements:",t)}finally{b(!1)}})()},[o,i]);const D=s=>{const{condition:t,threshold:r}=s,a=C;let l=0,f=r??1;switch(t){case"lesson_complete":l=a.totalLessonsCompleted||0;break;case"quiz_complete":l=a.totalQuizzesCompleted||0;break;case"battle_win":case"battle_undefeated":l=a.battleWins||0;break;case"mastery_10":case"social_streak_30":case"social_daily_return":l=a.consecutiveDaysActive||0;break;case"mastery_xp":l=p;break;case"explore_friend_added":case"social_friend":case"explore_social":l=a.friendsAdded||0;break;case"perfect_score":{l=(a.quizAttempts||[]).filter(A=>A.score===100).length;break}default:return}return{progress:Math.min(l,f),total:f}},h=u.map(s=>{const t=Y[s.icon.name]??j,r=k.has(s.id),a=D(s);return{id:s.id,icon:t,title:s.title,description:s.description,progress:a?.progress,total:a?.total,unlocked:r,color:r?s.iconColor:"text-slate-500",bgColor:r?s.iconColor.replace("text-","bg-").replace("-500","/10").replace("-400","/10").replace("-600","/10"):"bg-slate-100"}}),z=h.filter(s=>s.unlocked).length;return o?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-8",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:c}),e.jsxs("div",{className:"relative bg-[#f7f9fc] rounded-2xl shadow-2xl border border-[#dde3eb] w-full max-w-2xl max-h-[85vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"bg-gradient-to-r from-[#9956DE] via-[#7274ED] to-[#1FA7E1] p-6 text-white relative flex-shrink-0",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_14%_12%,rgba(251,150,187,0.35),transparent_42%),radial-gradient(circle_at_80%_80%,rgba(117,208,106,0.25),transparent_38%)]"}),e.jsxs("div",{className:"flex items-center justify-between mb-4 relative z-10",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-display font-bold",children:"Rewards & Achievements"}),e.jsxs("p",{className:"text-white/90 text-sm font-body",children:[z," / ",u.length," Achievements Unlocked"]})]}),e.jsx("button",{onClick:c,className:"text-white/90 hover:text-white hover:bg-white/20 p-2 rounded-xl transition-colors",children:e.jsx(V,{size:24})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 relative z-10",children:[e.jsxs("div",{className:"bg-white/15 backdrop-blur-sm rounded-xl p-4 border border-white/25",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(N,{size:18,className:"text-[#FFB356]"}),e.jsx("span",{className:"text-xs font-medium text-white/90 font-body",children:"Level"})]}),e.jsx("p",{className:"text-2xl font-bold",children:n})]}),e.jsxs("div",{className:"bg-white/15 backdrop-blur-sm rounded-xl p-4 border border-white/25",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(v,{size:18,className:"text-[#6ED1CF]"}),e.jsx("span",{className:"text-xs font-medium text-white/90 font-body",children:"Total XP"})]}),e.jsx("p",{className:"text-2xl font-bold",children:p.toLocaleString()})]}),e.jsxs("div",{className:"bg-white/15 backdrop-blur-sm rounded-xl p-4 border border-white/25",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(w,{size:18,className:"text-[#FF8B8B]"}),e.jsx("span",{className:"text-xs font-medium text-white/90 font-body",children:"Daily Rewards"})]}),e.jsx("p",{className:"text-2xl font-bold",children:"Check-in"})]})]}),e.jsxs("div",{className:"mt-4 relative z-10",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"text-sm font-bold text-white font-body",children:["Level ",n]}),e.jsxs("span",{className:"text-sm font-bold text-white font-body",children:["Level ",n+1]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex justify-between items-center mb-1",children:e.jsxs("span",{className:"text-xs text-white/90",children:[x," / ",m," XP"]})}),e.jsx("div",{className:"h-3 bg-white/20 rounded-full overflow-hidden border border-white/20",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-[#6ED1CF] via-[#75D06A] to-[#FFB356] rounded-full transition-all duration-500 e-w",style:{"--w":`${x/m*100}%`}})})]})]})]}),e.jsx("div",{className:"p-6 overflow-y-auto flex-1",children:y?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin w-8 h-8 border-2 border-[#9956DE] border-t-transparent rounded-full"})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-lg font-display font-bold text-[#0a1628] mb-4",children:"Achievements"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:h.map(s=>{const t=s.icon;return e.jsx("div",{className:`${s.unlocked?"bg-white border-[#9956DE]/25":"bg-[#edf1f7] border-[#dde3eb]"} border-2 rounded-xl p-4 transition-all ${s.unlocked?"shadow-md":"opacity-60"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-12 h-12 ${s.bgColor} rounded-xl flex items-center justify-center flex-shrink-0`,children:e.jsx(t,{size:24,className:s.color})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h4",{className:`text-sm font-bold ${s.unlocked?"text-[#0a1628]":"text-slate-500"} font-body`,children:s.title}),s.unlocked&&e.jsx("span",{className:"px-2 py-0.5 bg-[#75D06A] text-white text-[9px] font-bold rounded-full",children:"Unlocked"})]}),e.jsx("p",{className:`text-xs ${s.unlocked?"text-[#5a6578]":"text-slate-500"} mb-2`,children:s.description}),s.progress!==void 0&&s.total!==void 0&&!s.unlocked&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"Progress"}),e.jsxs("span",{className:"text-[10px] font-bold text-[#5a6578]",children:[s.progress," / ",s.total]})]}),e.jsx("div",{className:"h-1.5 bg-[#dde3eb] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-[#7274ED] to-[#1FA7E1] rounded-full transition-all e-w",style:{"--w":`${s.progress/s.total*100}%`}})})]})]})]})},s.id)})})]}),e.jsxs("div",{className:"bg-white rounded-xl p-5 border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-[#7274ED] to-[#1FA7E1] rounded-lg flex items-center justify-center",children:e.jsx(g,{size:16,className:"text-white"})}),e.jsx("h3",{className:"text-base font-display font-bold text-[#0a1628]",children:"How to Earn XP"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{activity:"Complete a video lesson",xp:50},{activity:"Complete exercises",xp:100},{activity:"Perfect quiz score",xp:150},{activity:"Finish a quiz",xp:75},{activity:"Daily check-in",xp:"20-100"}].map((s,t)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-[#1FA7E1] rounded-full"}),e.jsxs("span",{className:"text-xs text-[#5a6578] font-body",children:[s.activity,":"]}),e.jsxs("span",{className:"text-xs font-bold text-[#7274ED]",children:["+",s.xp," XP"]})]},t))})]})]})})]})]}):null};export{me as default};
 
1
+ import{r as d,j as e}from"./vendor-react-B4AQeu28.js";import{getDoc as F,doc as S}from"./vendor-firebase-firestore-CP9q7ISf.js";import{aJ as u,A as j,aK as U,aL as P,U as $,D as B,aM as I,y as R,aN as q,T as g,aO as L,Y as N,R as M,S as T,V as G,Q as w,$ as v,B as H,Z as X,q as Q,z as V,G as Z,a as J,aD as K,h as O}from"./index-uASBzalf.js";import{X as W}from"./x-CBb03rh3.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";const Y={BookOpen:J,GraduationCap:Z,Trophy:V,Target:Q,Zap:X,Brain:H,Star:v,Flame:w,Swords:G,Shield:T,RefreshCw:M,Crown:N,Sun:L,TrendingUp:g,Globe:q,User:R,UserPlus:I,Calendar:B,Users:$,Compass:P,Heart:U,Award:j},me=({isOpen:o,onClose:c,userLevel:n,currentXP:x,xpToNextLevel:m,totalXP:p,userId:i})=>{const[y,b]=d.useState(!0),[k,_]=d.useState(new Set),[E,C]=d.useState({});d.useEffect(()=>{if(!o||!i)return;(async()=>{b(!0);try{const t=await K(i);_(new Set(t.map(a=>a.id)));const r=await F(S(O,"progress",i));r.exists()&&C(r.data())}catch(t){console.error("Error loading achievements:",t)}finally{b(!1)}})()},[o,i]);const D=s=>{const{condition:t,threshold:r}=s,a=E;let l=0,f=r??1;switch(t){case"lesson_complete":l=a.totalLessonsCompleted||0;break;case"quiz_complete":l=a.totalQuizzesCompleted||0;break;case"battle_win":case"battle_undefeated":l=a.battleWins||0;break;case"mastery_10":case"social_streak_30":case"social_daily_return":l=a.consecutiveDaysActive||0;break;case"mastery_xp":l=p;break;case"explore_friend_added":case"social_friend":case"explore_social":l=a.friendsAdded||0;break;case"perfect_score":{l=(a.quizAttempts||[]).filter(A=>A.score===100).length;break}default:return}return{progress:Math.min(l,f),total:f}},h=u.map(s=>{const t=Y[s.icon.name]??j,r=k.has(s.id),a=D(s);return{id:s.id,icon:t,title:s.title,description:s.description,progress:a?.progress,total:a?.total,unlocked:r,color:r?s.iconColor:"text-slate-500",bgColor:r?s.iconColor.replace("text-","bg-").replace("-500","/10").replace("-400","/10").replace("-600","/10"):"bg-slate-100"}}),z=h.filter(s=>s.unlocked).length;return o?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-8",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:c}),e.jsxs("div",{className:"relative bg-[#f7f9fc] rounded-2xl shadow-2xl border border-[#dde3eb] w-full max-w-2xl max-h-[85vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"bg-gradient-to-r from-[#9956DE] via-[#7274ED] to-[#1FA7E1] p-6 text-white relative flex-shrink-0",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_14%_12%,rgba(251,150,187,0.35),transparent_42%),radial-gradient(circle_at_80%_80%,rgba(117,208,106,0.25),transparent_38%)]"}),e.jsxs("div",{className:"flex items-center justify-between mb-4 relative z-10",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-display font-bold",children:"Rewards & Achievements"}),e.jsxs("p",{className:"text-white/90 text-sm font-body",children:[z," / ",u.length," Achievements Unlocked"]})]}),e.jsx("button",{onClick:c,className:"text-white/90 hover:text-white hover:bg-white/20 p-2 rounded-xl transition-colors",children:e.jsx(W,{size:24})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 relative z-10",children:[e.jsxs("div",{className:"bg-white/15 backdrop-blur-sm rounded-xl p-4 border border-white/25",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(N,{size:18,className:"text-[#FFB356]"}),e.jsx("span",{className:"text-xs font-medium text-white/90 font-body",children:"Level"})]}),e.jsx("p",{className:"text-2xl font-bold",children:n})]}),e.jsxs("div",{className:"bg-white/15 backdrop-blur-sm rounded-xl p-4 border border-white/25",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(v,{size:18,className:"text-[#6ED1CF]"}),e.jsx("span",{className:"text-xs font-medium text-white/90 font-body",children:"Total XP"})]}),e.jsx("p",{className:"text-2xl font-bold",children:p.toLocaleString()})]}),e.jsxs("div",{className:"bg-white/15 backdrop-blur-sm rounded-xl p-4 border border-white/25",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(w,{size:18,className:"text-[#FF8B8B]"}),e.jsx("span",{className:"text-xs font-medium text-white/90 font-body",children:"Daily Rewards"})]}),e.jsx("p",{className:"text-2xl font-bold",children:"Check-in"})]})]}),e.jsxs("div",{className:"mt-4 relative z-10",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"text-sm font-bold text-white font-body",children:["Level ",n]}),e.jsxs("span",{className:"text-sm font-bold text-white font-body",children:["Level ",n+1]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex justify-between items-center mb-1",children:e.jsxs("span",{className:"text-xs text-white/90",children:[x," / ",m," XP"]})}),e.jsx("div",{className:"h-3 bg-white/20 rounded-full overflow-hidden border border-white/20",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-[#6ED1CF] via-[#75D06A] to-[#FFB356] rounded-full transition-all duration-500 e-w",style:{"--w":`${x/m*100}%`}})})]})]})]}),e.jsx("div",{className:"p-6 overflow-y-auto flex-1",children:y?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin w-8 h-8 border-2 border-[#9956DE] border-t-transparent rounded-full"})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-lg font-display font-bold text-[#0a1628] mb-4",children:"Achievements"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:h.map(s=>{const t=s.icon;return e.jsx("div",{className:`${s.unlocked?"bg-white border-[#9956DE]/25":"bg-[#edf1f7] border-[#dde3eb]"} border-2 rounded-xl p-4 transition-all ${s.unlocked?"shadow-md":"opacity-60"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-12 h-12 ${s.bgColor} rounded-xl flex items-center justify-center flex-shrink-0`,children:e.jsx(t,{size:24,className:s.color})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h4",{className:`text-sm font-bold ${s.unlocked?"text-[#0a1628]":"text-slate-500"} font-body`,children:s.title}),s.unlocked&&e.jsx("span",{className:"px-2 py-0.5 bg-[#75D06A] text-white text-[9px] font-bold rounded-full",children:"Unlocked"})]}),e.jsx("p",{className:`text-xs ${s.unlocked?"text-[#5a6578]":"text-slate-500"} mb-2`,children:s.description}),s.progress!==void 0&&s.total!==void 0&&!s.unlocked&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"Progress"}),e.jsxs("span",{className:"text-[10px] font-bold text-[#5a6578]",children:[s.progress," / ",s.total]})]}),e.jsx("div",{className:"h-1.5 bg-[#dde3eb] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-[#7274ED] to-[#1FA7E1] rounded-full transition-all e-w",style:{"--w":`${s.progress/s.total*100}%`}})})]})]})]})},s.id)})})]}),e.jsxs("div",{className:"bg-white rounded-xl p-5 border border-[#dde3eb]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-[#7274ED] to-[#1FA7E1] rounded-lg flex items-center justify-center",children:e.jsx(g,{size:16,className:"text-white"})}),e.jsx("h3",{className:"text-base font-display font-bold text-[#0a1628]",children:"How to Earn XP"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{activity:"Complete a video lesson",xp:50},{activity:"Complete exercises",xp:100},{activity:"Perfect quiz score",xp:150},{activity:"Finish a quiz",xp:75},{activity:"Daily check-in",xp:"20-100"}].map((s,t)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-[#1FA7E1] rounded-full"}),e.jsxs("span",{className:"text-xs text-[#5a6578] font-body",children:[s.activity,":"]}),e.jsxs("span",{className:"text-xs font-bold text-[#7274ED]",children:["+",s.xp," XP"]})]},t))})]})]})})]})]}):null};export{me as default};
assets/RightSidebar-CmYzVUKQ.js DELETED
@@ -1 +0,0 @@
1
- import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{q as S}from"./quiz_battle_avatar-BXHPSput.js";import{j as B,m as c,Z as _,P,V as q,x as W,W as v,X,l as Y,r as k}from"./index-BaOs5Ayg.js";import{C as M}from"./circle-check-big-m1SvzGFL.js";import{T as O,a as Z,b as H}from"./tooltip-ChRIOid3.js";import{C as T}from"./chevron-right-COqGruhh.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";const E=[{id:1,title:"Quiz Battle",subtitle:"Challenge players worldwide!",bgColor:"bg-[#9956de]",orbColor:"bg-[#6D28D9]",icon:e.jsx(P,{size:24,className:"text-white"}),buttonText:"Join Battle",actionType:"quiz-battle",avatarText:"Waiting for you to join..."},{id:2,title:"Topic Explorer",subtitle:"Dive into a new math topic today",bgColor:"bg-[#FF8B8B]",orbColor:"bg-[#E06A6A]",icon:e.jsx(_,{size:24,className:"text-white"}),buttonText:"Explore",actionType:"explore",avatarText:"Knowledge is power!"},{id:3,title:"Speed Runner",subtitle:"Finish a quiz in under 5 mins",bgColor:"bg-[#75D06A]",orbColor:"bg-[#58B34D]",icon:e.jsx(M,{size:24,className:"text-white"}),buttonText:null,actionType:null,avatarText:"Ready for action!"}],J=({onNavigateToQuizBattle:s,userPhoto:a})=>{const[x,m]=l.useState(0);l.useEffect(()=>{const r=setInterval(()=>{m(o=>(o+1)%E.length)},5e3);return()=>clearInterval(r)},[]);const t=E[x];return e.jsx("div",{className:"bg-white rounded-[24px] p-4 shadow-sm border border-slate-100 flex flex-col gap-6 mt-4 relative overflow-hidden",children:e.jsx("div",{className:"relative h-[185px] rounded-[-20px] rounded-2xl overflow-hidden cursor-pointer group",children:e.jsx(B,{mode:"wait",children:e.jsxs(c.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.3},className:`absolute inset-0 ${t.bgColor} p-4 sm:p-5 flex flex-col justify-between overflow-hidden`,children:[e.jsxs("div",{className:"absolute top-4 right-4 flex gap-1 items-center z-20",children:[e.jsx("div",{className:"w-3 h-1.5 rounded-full bg-white/60"}),e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-white/40"}),e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-white/40"})]}),t.actionType==="quiz-battle"&&e.jsx("div",{className:"absolute -right-4 -bottom-6 w-32 h-32 opacity-25 mix-blend-overlay pointer-events-none z-0 transform group-hover:scale-105 transition-transform duration-700",children:e.jsx("img",{src:S,alt:"",className:"w-full h-full object-contain"})}),e.jsx("div",{className:`absolute -right-4 -top-8 w-36 h-36 rounded-full ${t.orbColor} opacity-90 blur-2xl group-hover:scale-110 transition-transform duration-700 pointer-events-none`}),e.jsx("div",{className:"absolute right-4 top-1/2 -translate-y-1/2 w-[48px] h-[48px] rounded-2xl rotate-12 bg-white/20 backdrop-blur-md shadow-sm border border-white/20 group-hover:rotate-[25deg] group-hover:scale-110 transition-transform duration-700 flex items-center justify-center z-10",children:t.icon}),e.jsxs("div",{className:"relative z-10 w-full pr-[60px]",children:[e.jsx("h3",{className:"font-display font-bold text-[20px] leading-tight text-white mb-0.5",children:t.title}),e.jsx("p",{className:"text-[12px] font-medium text-white/90 leading-snug",children:t.subtitle}),t.buttonText&&e.jsx("button",{onClick:r=>{r.stopPropagation(),t.actionType==="quiz-battle"&&s&&s()},className:"mt-2.5 bg-white text-[#0a1628] px-2 py-1 rounded-lg font-bold text-xs shadow-sm hover:scale-105 transition-transform uppercase tracking-wider whitespace-nowrap w-fit",children:t.buttonText})]}),e.jsxs("div",{className:"flex items-center gap-2.5 relative z-10 mt-auto pt-2",children:[a?e.jsxs("div",{className:"relative group/avatar shrink-0",children:[e.jsx("div",{className:"absolute inset-0 bg-white/40 blur-md rounded-full animate-pulse"}),e.jsx("img",{src:a,alt:"You",className:"w-8 h-8 rounded-full border-[2px] border-white object-cover relative z-10 shadow-md group-hover/avatar:scale-110 transition-transform"}),t.actionType==="quiz-battle"&&e.jsx("div",{className:"absolute -bottom-1 -right-1 w-[16px] h-[16px] bg-[#75D06A] border-2 border-[#7C3AED] rounded-full z-20 flex items-center justify-center",children:e.jsx(_,{size:8,className:"text-white",fill:"currentColor"})})]}):null,e.jsx("span",{className:"text-[12px] font-bold text-white tracking-wide leading-tight flex-1 pr-[60px]",children:t.avatarText})]})]},t.id)})})})},K=s=>{if(s>=1e3){const a=s/1e3;return a>=10?`${Math.round(a)}k`:`${a.toFixed(1)}k`}return`${s}`},V=({entry:s,rank:a,isYou:x,userPhoto:m,rankColor:t})=>{const r=x?s?.photo||m:s?.photo,o=x?"You":s?.name||"---",h=s?.xp||0;return e.jsxs(e.Fragment,{children:[e.jsxs(c.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.3+a*.1},className:"relative mb-2",children:[a===1&&e.jsx("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 z-20",children:e.jsx(v,{size:22,className:"text-amber-400 drop-shadow-md mb-1",fill:"#fbbf24",strokeWidth:1.5})}),e.jsx("div",{className:`w-10 h-10 rounded-full border-[3px] ${a===1?"w-[52px] h-[52px]":""} ${t.border} z-10 relative overflow-hidden ${t.shadow} bg-white`,children:r?e.jsx("img",{src:r,alt:o,className:"w-full h-full object-cover",onError:f=>{f.target.style.display="none"}}):e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-slate-200 to-slate-300 flex items-center justify-center",children:e.jsx(k,{size:a===1?22:16,className:"text-slate-400"})})}),e.jsx("div",{className:`absolute -bottom-2 left-1/2 -translate-x-1/2 ${t.badge} text-white text-[10px] font-bold px-2 py-0.5 rounded-full z-20 shadow-sm`,children:a})]}),e.jsxs("div",{className:"mt-2 text-center",children:[e.jsx("span",{className:`block ${a===1?"text-[13px] font-black":"text-[12px] font-bold"} text-[#0a1628] truncate max-w-[80px]`,children:o}),e.jsxs("span",{className:`block ${a===1?"text-[11px]":"text-[10px]"} ${t.badge.replace("bg-","text-").replace("-500","-600").replace("-400","-600").replace("amber","amber")} font-bold`,children:[K(h)," XP"]})]})]})},ce=({currentUserId:s,onOpenRewards:a,onOpenLeaderboard:x,onNavigateToModules:m,onNavigateToQuizBattle:t,userLevel:r,userPhoto:o,currentXP:h,xpToNextLevel:f})=>{const N=h/f*100,[$,D]=l.useState([]),[F,u]=l.useState(!0),[y,g]=l.useState(null),p=l.useRef(null),n=l.useRef(null);l.useEffect(()=>{if(!s){u(!1);return}u(!0),g(null);const d=q(b=>{D(b),u(!1),g(null),n.current&&(clearTimeout(n.current),n.current=null)},s,!1,"all",3);return p.current=d,n.current=setTimeout(()=>{u(!1),g("Leaderboard data unavailable")},15e3),()=>{n.current&&(clearTimeout(n.current),n.current=null),p.current&&(p.current(),p.current=null)}},[s]);const i=$.slice(0,3);i.some(d=>d.userId===s);const z=[{bg:"from-amber-100 to-amber-50",border:"border-amber-400",badge:"bg-amber-500",shadow:"shadow-md"},{bg:"from-slate-200 to-slate-100",border:"border-sky-400",badge:"bg-sky-500",shadow:"shadow-sm"},{bg:"from-orange-50 to-slate-50",border:"border-orange-400",badge:"bg-orange-500",shadow:"shadow-sm"}],A=["74px","54px","38px"],L=["w-[78px]","w-[70px]","w-[70px]"],j=(d,b,C,R,w)=>e.jsxs("div",{className:"flex flex-col items-center relative z-10",children:[e.jsx(V,{entry:d,rank:C,isYou:R==="You",userPhoto:o,rankColor:z[w]}),e.jsxs(c.div,{initial:{height:0},animate:{height:A[b]},transition:{delay:.2+b*.1,duration:.5,ease:"easeOut"},className:`${L[b]} bg-gradient-to-b ${z[w].bg} rounded-t-xl rounded-b-md border-t-2 border-white/20 flex items-center justify-center relative shadow-[inset_0_-4px_6px_rgba(0,0,0,0.05),0_4px_6px_rgba(0,0,0,0.05)]`,children:[e.jsx("span",{className:`${w===0?"text-amber-400 text-3xl":"text-slate-400 text-2xl"} font-black opacity-40 translate-y-1`,children:C}),e.jsx("div",{className:"absolute top-0 left-0 right-0 h-1.5 bg-white/70 rounded-t-xl"})]})]});return e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(c.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.1,duration:.4,ease:[.22,1,.36,1]},onClick:a,className:"rounded-2xl border border-[#9956DE]/25 cursor-pointer transition-all group relative overflow-hidden bg-gradient-to-br from-[#9956DE] via-[#7274ED] to-[#1FA7E1] hover:shadow-[0_16px_40px_rgba(114,116,237,0.28)] hover:-translate-y-0.5",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_18%_8%,rgba(251,150,187,0.32),transparent_42%),radial-gradient(circle_at_85%_84%,rgba(117,208,106,0.24),transparent_40%)]"}),e.jsxs("div",{className:"relative z-10 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"shrink-0 w-8 h-8 bg-white/20 rounded-xl flex items-center justify-center border border-white/35 backdrop-blur-sm",children:e.jsx(W,{size:14,className:"text-white"})}),e.jsxs("h3",{className:"font-display font-bold text-[13px] leading-tight text-white tracking-wide",children:["Rewards & ",e.jsx("br",{className:"hidden 2xl:block"})," Achievements"]})]}),e.jsx(T,{size:14,className:"shrink-0 text-white/80 group-hover:text-white group-hover:translate-x-0.5 transition-all"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-1 mb-3 bg-white/10 p-1.5 rounded-xl border border-white/20 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-body px-1 text-white",children:[e.jsx(v,{size:12,className:"text-[#FFB356]"}),e.jsxs("span",{className:"font-bold",children:["Lv ",r]})]}),e.jsx("div",{className:"w-px h-3 bg-white/35"}),e.jsxs(O,{children:[e.jsx(Z,{asChild:!0,children:e.jsxs("button",{onClick:d=>{d.stopPropagation(),m?.()},className:"flex items-center gap-1.5 text-xs font-body px-1 text-white cursor-pointer transition-colors active:scale-95",children:[e.jsx(X,{size:12,className:"text-[#6ED1CF]"}),e.jsxs("span",{className:"font-bold whitespace-nowrap",children:[h," XP"]})]})}),e.jsx(H,{side:"top",className:"bg-slate-900 text-white border border-slate-700",children:"Review more lessons to earn more XP!"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[e.jsxs("span",{className:"text-[11px] font-body text-white/90",children:["Next: Level ",r+1]}),e.jsxs("span",{className:"text-[11px] font-body font-semibold text-white",children:[Math.round(N),"%"]})]}),e.jsx("div",{className:"h-2 bg-white/25 rounded-full overflow-hidden border border-white/20",children:e.jsx(c.div,{initial:{width:0},animate:{width:`${N}%`},transition:{duration:1,ease:"easeOut"},className:"h-full bg-gradient-to-r from-[#6ED1CF] via-[#75D06A] to-[#FFB356] rounded-full"})})]})]})]}),e.jsx(c.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.2,duration:.4,ease:[.22,1,.36,1]},children:e.jsx(J,{onNavigateToQuizBattle:t,userPhoto:o})}),e.jsxs(c.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.3,duration:.4,ease:[.22,1,.36,1]},onClick:x,className:"bg-white rounded-xl border border-slate-200/80 hover:shadow-md hover:border-amber-200/60 transition-all group overflow-hidden cursor-pointer",children:[e.jsxs("div",{className:"p-3 border-b border-slate-100 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-7 h-7 bg-amber-50 rounded-lg flex items-center justify-center border border-amber-200/60 transition-colors group-hover:bg-amber-100/50",children:e.jsx(v,{size:14,className:"text-amber-500"})}),e.jsx("h3",{className:"font-display font-bold text-sm text-[#0a1628]",children:"Leaderboards"})]}),e.jsx(T,{size:14,className:"text-slate-400 group-hover:translate-x-0.5 group-hover:text-amber-500 transition-transform"})]}),e.jsx("div",{className:"pt-8 pb-3 px-2 bg-gradient-to-b from-slate-50/30 to-white flex items-end justify-center gap-1.5 min-h-[170px]",children:F?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-8",children:[e.jsx(Y,{className:"w-5 h-5 animate-spin text-amber-400 mb-2"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Loading rankings..."})]}):y||i.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-8",children:[e.jsx(k,{className:"w-8 h-8 text-slate-300 mb-2"}),e.jsx("span",{className:"text-xs text-slate-400 text-center",children:y||"No rankings available yet"})]}):e.jsxs(e.Fragment,{children:[j(i[1],1,2,i[1]?.name||"---",1),j(i[0],0,1,i[0]?.name||"---",0),j(i[2],2,3,i[2]?.name||"---",2)]})})]})]})};export{ce as default};
 
 
assets/RightSidebar-u-5bXOuZ.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{r as o,j as e}from"./vendor-react-B4AQeu28.js";import{q as S}from"./quiz_battle_avatar-BXHPSput.js";import{g as B,m as c,Z as _,V as q,X as P,z as W,Y as v,$ as X,p as Y,y as k}from"./index-uASBzalf.js";import{C as M}from"./circle-check-big-BNRlH5pv.js";import{T as O,a as Z,b as H}from"./tooltip-1ASn-3cE.js";import{C as T}from"./chevron-right-U0AqPOPj.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";const E=[{id:1,title:"Quiz Battle",subtitle:"Challenge players worldwide!",bgColor:"bg-[#9956de]",orbColor:"bg-[#6D28D9]",icon:e.jsx(q,{size:24,className:"text-white"}),buttonText:"Join Battle",actionType:"quiz-battle",avatarText:"Waiting for you to join..."},{id:2,title:"Topic Explorer",subtitle:"Dive into a new math topic today",bgColor:"bg-[#FF8B8B]",orbColor:"bg-[#E06A6A]",icon:e.jsx(_,{size:24,className:"text-white"}),buttonText:"Explore",actionType:"explore",avatarText:"Knowledge is power!"},{id:3,title:"Speed Runner",subtitle:"Finish a quiz in under 5 mins",bgColor:"bg-[#75D06A]",orbColor:"bg-[#58B34D]",icon:e.jsx(M,{size:24,className:"text-white"}),buttonText:null,actionType:null,avatarText:"Ready for action!"}],J=({onNavigateToQuizBattle:s,userPhoto:a})=>{const[x,m]=o.useState(0);o.useEffect(()=>{const r=setInterval(()=>{m(l=>(l+1)%E.length)},5e3);return()=>clearInterval(r)},[]);const t=E[x];return e.jsx("div",{className:"bg-white rounded-[24px] p-4 shadow-sm border border-slate-100 flex flex-col gap-6 mt-4 relative overflow-hidden",children:e.jsx("div",{className:"relative h-[185px] rounded-[-20px] rounded-2xl overflow-hidden cursor-pointer group",children:e.jsx(B,{mode:"wait",children:e.jsxs(c.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.3},className:`absolute inset-0 ${t.bgColor} p-4 sm:p-5 flex flex-col justify-between overflow-hidden`,children:[e.jsxs("div",{className:"absolute top-4 right-4 flex gap-1 items-center z-20",children:[e.jsx("div",{className:"w-3 h-1.5 rounded-full bg-white/60"}),e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-white/40"}),e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-white/40"})]}),t.actionType==="quiz-battle"&&e.jsx("div",{className:"absolute -right-4 -bottom-6 w-32 h-32 opacity-25 mix-blend-overlay pointer-events-none z-0 transform group-hover:scale-105 transition-transform duration-700",children:e.jsx("img",{src:S,alt:"",className:"w-full h-full object-contain"})}),e.jsx("div",{className:`absolute -right-4 -top-8 w-36 h-36 rounded-full ${t.orbColor} opacity-90 blur-2xl group-hover:scale-110 transition-transform duration-700 pointer-events-none`}),e.jsx("div",{className:"absolute right-4 top-1/2 -translate-y-1/2 w-[48px] h-[48px] rounded-2xl rotate-12 bg-white/20 backdrop-blur-md shadow-sm border border-white/20 group-hover:rotate-[25deg] group-hover:scale-110 transition-transform duration-700 flex items-center justify-center z-10",children:t.icon}),e.jsxs("div",{className:"relative z-10 w-full pr-[60px]",children:[e.jsx("h3",{className:"font-display font-bold text-[20px] leading-tight text-white mb-0.5",children:t.title}),e.jsx("p",{className:"text-[12px] font-medium text-white/90 leading-snug",children:t.subtitle}),t.buttonText&&e.jsx("button",{onClick:r=>{r.stopPropagation(),t.actionType==="quiz-battle"&&s&&s()},className:"mt-2.5 bg-white text-[#0a1628] px-2 py-1 rounded-lg font-bold text-xs shadow-sm hover:scale-105 transition-transform uppercase tracking-wider whitespace-nowrap w-fit",children:t.buttonText})]}),e.jsxs("div",{className:"flex items-center gap-2.5 relative z-10 mt-auto pt-2",children:[a?e.jsxs("div",{className:"relative group/avatar shrink-0",children:[e.jsx("div",{className:"absolute inset-0 bg-white/40 blur-md rounded-full animate-pulse"}),e.jsx("img",{src:a,alt:"You",className:"w-8 h-8 rounded-full border-[2px] border-white object-cover relative z-10 shadow-md group-hover/avatar:scale-110 transition-transform"}),t.actionType==="quiz-battle"&&e.jsx("div",{className:"absolute -bottom-1 -right-1 w-[16px] h-[16px] bg-[#75D06A] border-2 border-[#7C3AED] rounded-full z-20 flex items-center justify-center",children:e.jsx(_,{size:8,className:"text-white",fill:"currentColor"})})]}):null,e.jsx("span",{className:"text-[12px] font-bold text-white tracking-wide leading-tight flex-1 pr-[60px]",children:t.avatarText})]})]},t.id)})})})},K=s=>{if(s>=1e3){const a=s/1e3;return a>=10?`${Math.round(a)}k`:`${a.toFixed(1)}k`}return`${s}`},V=({entry:s,rank:a,isYou:x,userPhoto:m,rankColor:t})=>{const r=x?s?.photo||m:s?.photo,l=x?"You":s?.name||"---",h=s?.xp||0;return e.jsxs(e.Fragment,{children:[e.jsxs(c.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.3+a*.1},className:"relative mb-2",children:[a===1&&e.jsx("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 z-20",children:e.jsx(v,{size:22,className:"text-amber-400 drop-shadow-md mb-1",fill:"#fbbf24",strokeWidth:1.5})}),e.jsx("div",{className:`w-10 h-10 rounded-full border-[3px] ${a===1?"w-[52px] h-[52px]":""} ${t.border} z-10 relative overflow-hidden ${t.shadow} bg-white`,children:r?e.jsx("img",{src:r,alt:l,className:"w-full h-full object-cover",onError:f=>{f.target.style.display="none"}}):e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-slate-200 to-slate-300 flex items-center justify-center",children:e.jsx(k,{size:a===1?22:16,className:"text-slate-400"})})}),e.jsx("div",{className:`absolute -bottom-2 left-1/2 -translate-x-1/2 ${t.badge} text-white text-[10px] font-bold px-2 py-0.5 rounded-full z-20 shadow-sm`,children:a})]}),e.jsxs("div",{className:"mt-2 text-center",children:[e.jsx("span",{className:`block ${a===1?"text-[13px] font-black":"text-[12px] font-bold"} text-[#0a1628] truncate max-w-[80px]`,children:l}),e.jsxs("span",{className:`block ${a===1?"text-[11px]":"text-[10px]"} ${t.badge.replace("bg-","text-").replace("-500","-600").replace("-400","-600").replace("amber","amber")} font-bold`,children:[K(h)," XP"]})]})]})},ce=({currentUserId:s,onOpenRewards:a,onOpenLeaderboard:x,onNavigateToModules:m,onNavigateToQuizBattle:t,userLevel:r,userPhoto:l,currentXP:h,xpToNextLevel:f})=>{const N=h/f*100,[$,D]=o.useState([]),[F,u]=o.useState(!0),[y,g]=o.useState(null),p=o.useRef(null),n=o.useRef(null);o.useEffect(()=>{if(!s){u(!1);return}u(!0),g(null);const d=P(b=>{D(b),u(!1),g(null),n.current&&(clearTimeout(n.current),n.current=null)},s,!1,"all",3);return p.current=d,n.current=setTimeout(()=>{u(!1),g("Leaderboard data unavailable")},15e3),()=>{n.current&&(clearTimeout(n.current),n.current=null),p.current&&(p.current(),p.current=null)}},[s]);const i=$.slice(0,3);i.some(d=>d.userId===s);const z=[{bg:"from-amber-100 to-amber-50",border:"border-amber-400",badge:"bg-amber-500",shadow:"shadow-md"},{bg:"from-slate-200 to-slate-100",border:"border-sky-400",badge:"bg-sky-500",shadow:"shadow-sm"},{bg:"from-orange-50 to-slate-50",border:"border-orange-400",badge:"bg-orange-500",shadow:"shadow-sm"}],A=["74px","54px","38px"],L=["w-[78px]","w-[70px]","w-[70px]"],w=(d,b,C,R,j)=>e.jsxs("div",{className:"flex flex-col items-center relative z-10",children:[e.jsx(V,{entry:d,rank:C,isYou:R==="You",userPhoto:l,rankColor:z[j]}),e.jsxs(c.div,{initial:{height:0},animate:{height:A[b]},transition:{delay:.2+b*.1,duration:.5,ease:"easeOut"},className:`${L[b]} bg-gradient-to-b ${z[j].bg} rounded-t-xl rounded-b-md border-t-2 border-white/20 flex items-center justify-center relative shadow-[inset_0_-4px_6px_rgba(0,0,0,0.05),0_4px_6px_rgba(0,0,0,0.05)]`,children:[e.jsx("span",{className:`${j===0?"text-amber-400 text-3xl":"text-slate-400 text-2xl"} font-black opacity-40 translate-y-1`,children:C}),e.jsx("div",{className:"absolute top-0 left-0 right-0 h-1.5 bg-white/70 rounded-t-xl"})]})]});return e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(c.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.1,duration:.4,ease:[.22,1,.36,1]},onClick:a,className:"rounded-2xl border border-[#9956DE]/25 cursor-pointer transition-all group relative overflow-hidden bg-gradient-to-br from-[#9956DE] via-[#7274ED] to-[#1FA7E1] hover:shadow-[0_16px_40px_rgba(114,116,237,0.28)] hover:-translate-y-0.5",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_18%_8%,rgba(251,150,187,0.32),transparent_42%),radial-gradient(circle_at_85%_84%,rgba(117,208,106,0.24),transparent_40%)]"}),e.jsxs("div",{className:"relative z-10 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"shrink-0 w-8 h-8 bg-white/20 rounded-xl flex items-center justify-center border border-white/35 backdrop-blur-sm",children:e.jsx(W,{size:14,className:"text-white"})}),e.jsxs("h3",{className:"font-display font-bold text-[13px] leading-tight text-white tracking-wide",children:["Rewards & ",e.jsx("br",{className:"hidden 2xl:block"})," Achievements"]})]}),e.jsx(T,{size:14,className:"shrink-0 text-white/80 group-hover:text-white group-hover:translate-x-0.5 transition-all"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-1 mb-3 bg-white/10 p-1.5 rounded-xl border border-white/20 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-body px-1 text-white",children:[e.jsx(v,{size:12,className:"text-[#FFB356]"}),e.jsxs("span",{className:"font-bold",children:["Lv ",r]})]}),e.jsx("div",{className:"w-px h-3 bg-white/35"}),e.jsxs(O,{children:[e.jsx(Z,{asChild:!0,children:e.jsxs("button",{onClick:d=>{d.stopPropagation(),m?.()},className:"flex items-center gap-1.5 text-xs font-body px-1 text-white cursor-pointer transition-colors active:scale-95",children:[e.jsx(X,{size:12,className:"text-[#6ED1CF]"}),e.jsxs("span",{className:"font-bold whitespace-nowrap",children:[h," XP"]})]})}),e.jsx(H,{side:"top",className:"bg-slate-900 text-white border border-slate-700",children:"Review more lessons to earn more XP!"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[e.jsxs("span",{className:"text-[11px] font-body text-white/90",children:["Next: Level ",r+1]}),e.jsxs("span",{className:"text-[11px] font-body font-semibold text-white",children:[Math.round(N),"%"]})]}),e.jsx("div",{className:"h-2 bg-white/25 rounded-full overflow-hidden border border-white/20",children:e.jsx(c.div,{initial:{width:0},animate:{width:`${N}%`},transition:{duration:1,ease:"easeOut"},className:"h-full bg-gradient-to-r from-[#6ED1CF] via-[#75D06A] to-[#FFB356] rounded-full"})})]})]})]}),e.jsx(c.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.2,duration:.4,ease:[.22,1,.36,1]},children:e.jsx(J,{onNavigateToQuizBattle:t,userPhoto:l})}),e.jsxs(c.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.3,duration:.4,ease:[.22,1,.36,1]},onClick:x,className:"bg-white rounded-xl border border-slate-200/80 hover:shadow-md hover:border-amber-200/60 transition-all group overflow-hidden cursor-pointer",children:[e.jsxs("div",{className:"p-3 border-b border-slate-100 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-7 h-7 bg-amber-50 rounded-lg flex items-center justify-center border border-amber-200/60 transition-colors group-hover:bg-amber-100/50",children:e.jsx(v,{size:14,className:"text-amber-500"})}),e.jsx("h3",{className:"font-display font-bold text-sm text-[#0a1628]",children:"Leaderboards"})]}),e.jsx(T,{size:14,className:"text-slate-400 group-hover:translate-x-0.5 group-hover:text-amber-500 transition-transform"})]}),e.jsx("div",{className:"pt-8 pb-3 px-2 bg-gradient-to-b from-slate-50/30 to-white flex items-end justify-center gap-1.5 min-h-[170px]",children:F?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-8",children:[e.jsx(Y,{className:"w-5 h-5 animate-spin text-amber-400 mb-2"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Loading rankings..."})]}):y||i.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-8",children:[e.jsx(k,{className:"w-8 h-8 text-slate-300 mb-2"}),e.jsx("span",{className:"text-xs text-slate-400 text-center",children:y||"No rankings available yet"})]}):e.jsxs(e.Fragment,{children:[w(i[1],1,2,i[1]?.name||"---",1),w(i[0],0,1,i[0]?.name||"---",0),w(i[2],2,3,i[2]?.name||"---",2)]})})]})]})};export{ce as default};
assets/{ScientificCalculator-DRuSfTXj.js β†’ ScientificCalculator-DNPhV2R9.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{r as c,j as e}from"./vendor-react-B4AQeu28.js";import{e as Z,h as de,j as U,m as ue}from"./index-BaOs5Ayg.js";import{C as fe,a as pe}from"./chevron-up-Cdvz2TMJ.js";import{X as be}from"./x-TNvtuOD9.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{r as c,j as e}from"./vendor-react-B4AQeu28.js";import{e as Z,j as de,g as U,m as ue}from"./index-uASBzalf.js";import{a as fe,C as pe}from"./chevron-up-BpMhRyJp.js";import{X as be}from"./x-CBb03rh3.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/SettingsModal-BbkSqdYG.js DELETED
@@ -1,16 +0,0 @@
1
- import{r as a,j as e}from"./vendor-react-B4AQeu28.js";import{S as Se,a as Ae,b as Pe,c as Ee,d as J}from"./select-DIjxRWza.js";import{e as K,u as ze,aP as Re,aQ as Te,aR as Me,aS as Le,aT as qe,aU as De,r as Ie,S as Fe,aM as Ve,a as Oe,j as _e,m as V,L as He,aV as Ge,t as u,aW as Ue,aX as Xe,aY as Qe}from"./index-BaOs5Ayg.js";import{B as p}from"./button-DCfeFHoH.js";import{I as n}from"./input-D28h_UTJ.js";import{S as d}from"./switch-CblAJO7o.js";import me from"./ConfirmModal-6cgkqXAT.js";import{P as We,M as Be,V as Ye}from"./ProfilePictureUploader-CX_IZAwE.js";import{B as Je}from"./bell-clcSMJn6.js";import{D as he}from"./download-DX_YebqQ.js";import{X as ue}from"./x-TNvtuOD9.js";import{C as $e}from"./circle-help-B8apTIdU.js";import{C as Ke}from"./clock-D1Ecvltm.js";import{T as Ze}from"./trash-2-HTnKafZd.js";import{E as es,a as ss}from"./eye-Ig3S6mOs.js";import"./vendor-radix-BorKzPz9.js";import"./chevron-up-Cdvz2TMJ.js";import"./check-BLSo9L0H.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";import"./log-out-BenDMDly.js";import"./minus-DfrEv-SC.js";import"./plus-DkG35AoH.js";import"./upload-DayXhGwD.js";/**
2
- * @license lucide-react v0.487.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const ts=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],as=K("palette",ts);/**
7
- * @license lucide-react v0.487.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const ns=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],is=K("server",ns);/**
12
- * @license lucide-react v0.487.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const ls=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],rs=K("smartphone",ls),cs=()=>{const{userProfile:x,userRole:j}=ze(),[l,P]=a.useState(Re),[E,z]=a.useState(Te),[k,R]=a.useState(!1),[L,S]=a.useState(null);a.useEffect(()=>{if(!x?.uid)return;(async()=>{R(!0),S(null);try{if(j==="teacher"){const h=await qe(x.uid);P(h)}if(j==="admin"){const h=await De();z(h)}}catch(h){S(h instanceof Error?h.message:"Failed to load settings")}finally{R(!1)}})()},[x?.uid,j]);const r=a.useCallback(async w=>{if(!x?.uid)return;const h=await Me(x.uid,w);P(h)},[x?.uid]),T=a.useCallback(async w=>{const h=await Le(w);z(h)},[]);return{teacherPrefs:l,adminConfig:E,loading:k,error:L,saveTeacherPrefs:r,saveAdminConfig:T}},$=()=>JSON.parse(JSON.stringify(Ge)),Vs=({isOpen:x,onClose:j,profileData:l,onSave:P,settingsData:E,onSaveSettings:z,onApplySettingsPreview:k,onExportData:R,onClearCache:L,onResetData:S})=>{const r=l?.role||"student",{teacherPrefs:T,adminConfig:w,saveTeacherPrefs:h,saveAdminConfig:be}=cs(),[f,fe]=a.useState("account"),[o,m]=a.useState({}),[i,Z]=a.useState($()),[y,g]=a.useState(T),[v,N]=a.useState(w),[O,ee]=a.useState(!1),[q,se]=a.useState(!1),[_,te]=a.useState(!1),[H,ae]=a.useState(!1),[ne,os]=a.useState(!1),[pe,D]=a.useState(!1),[je,I]=a.useState(!1),[ye,A]=a.useState(!1),[M,ie]=a.useState(""),[b,ge]=a.useState(null),[C,le]=a.useState(!1),[G,re]=a.useState(!1),[U,ce]=a.useState(""),[F,oe]=a.useState(""),X=a.useRef(!1),Q=a.useRef($());a.useEffect(()=>{if(!x){X.current=!1;return}if(X.current)return;X.current=!0;const s=E?JSON.parse(JSON.stringify(E)):$();Q.current=s,m({uid:l?.uid,name:l?.name||"",email:l?.email||"",phone:l?.phone||"",photo:l?.photo||"",avatarLayers:l?.avatarLayers,role:l?.role,gender:l?.gender,lrn:l?.lrn||"",grade:l?.grade||"",section:l?.section||"",school:l?.school||"",department:l?.department||"",subject:l?.subject||"",yearsOfExperience:l?.yearsOfExperience||"",qualification:l?.qualification||"",position:l?.position||""}),Z(s),g(T),N(w)},[x,l,E,T,w]),a.useEffect(()=>{x&&k?.(i)},[x,i,k]),a.useEffect(()=>{if(!x)return;const s=t=>{t.key==="Escape"&&(k?.(Q.current),j())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[x,j,k]);const de=a.useMemo(()=>{const s=[{id:"account",label:"Account",icon:Ie},{id:"notifications",label:"Notifications",icon:Je},{id:"appearance",label:"Appearance",icon:as},{id:"privacy",label:"Privacy & Security",icon:Fe}];return r==="student"&&s.push({id:"learning",label:"Learning",icon:Ve}),r==="teacher"&&s.push({id:"teaching",label:"Teaching",icon:Oe}),r==="admin"&&s.push({id:"system",label:"System",icon:is}),s.push({id:"data",label:"Data & Storage",icon:he}),s},[r]),c=s=>{Z(t=>s(t))},W=s=>{ge(s),ie(""),re(!1),s==="password"&&ce(""),s==="email"&&oe(o.email||""),A(!0)},xe=async()=>{if(!M.trim()){u.error("Current password is required");return}le(!0);try{if(b==="password"){if(U.length<8){u.error("New password must be at least 8 characters");return}await Ue(M,U),u.success("Password updated")}else if(b==="email"){if(!F.includes("@")){u.error("Enter a valid email");return}await Xe(M,F),m(s=>({...s,email:F})),u.success("Email updated")}else if(b==="delete"){await Qe(M,o.uid||""),u.success("Account deleted"),j();return}A(!1)}catch(s){u.error(s instanceof Error?s.message:"Authentication failed")}finally{le(!1)}},ve=async()=>{ee(!0);try{P&&await P(o),z&&await z(i),r==="teacher"&&await h(y),r==="admin"&&await be(v),j()}catch(s){u.error(s instanceof Error?s.message:"Failed to save settings")}finally{ee(!1)}},B=()=>{A(!1),D(!1),I(!1),k?.(Q.current),j()},Ne=async()=>{if(!(!R||_)){te(!0);try{await R()}catch(s){u.error(s instanceof Error?s.message:"Failed to export data")}finally{te(!1)}}},we=async()=>{if(!(!L||H)){ae(!0);try{await L()}catch(s){u.error(s instanceof Error?s.message:"Failed to clear cache")}finally{ae(!1)}}},Ce=async()=>{if(!(!S||q)){D(!1),se(!0);try{await S(),u.success("Testing data reset completed")}catch(s){u.error(s instanceof Error?s.message:"Failed to reset testing data")}finally{se(!1)}}},ke=()=>{I(!1),W("delete")};return x?e.jsx(_e,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[e.jsx(V.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:B,className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),e.jsxs(V.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2},className:"relative bg-[#f7f9fc] rounded-2xl shadow-2xl border border-[#dde3eb] w-full max-w-4xl max-h-[85vh] overflow-hidden flex",children:[e.jsxs("div",{className:"w-64 bg-slate-50 border-r border-slate-200 p-6 overflow-y-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-xl font-display font-bold text-[#0a1628]",children:"Settings"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Manage your preferences"})]}),e.jsx("nav",{className:"space-y-1",children:de.map(s=>{const t=s.icon;return e.jsxs("button",{onClick:()=>fe(s.id),className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl text-left transition-all ${f===s.id?"bg-sky-50 text-sky-700 shadow-sm":"text-slate-500 hover:bg-slate-100 hover:text-sky-700"}`,children:[e.jsx(t,{size:18}),e.jsx("span",{className:"text-sm font-medium",children:s.label})]},s.id)})})]}),e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-[#dde3eb]",children:[e.jsx("h3",{className:"text-lg font-display font-bold text-[#0a1628]",children:de.find(s=>s.id===f)?.label}),e.jsx("button",{onClick:B,className:"p-2 hover:bg-[#edf1f7] rounded-xl transition-colors",children:e.jsx(ue,{size:20,className:"text-[#5a6578]"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[f==="account"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(We,{uid:o.uid,photoURL:o.photo,displayName:o.name,onUploaded:s=>m(t=>({...t,photo:s}))}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Full Name"}),e.jsx(n,{type:"text",value:o.name||"",onChange:s=>m(t=>({...t,name:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Email Address"}),e.jsxs("div",{className:"flex items-center gap-2 max-w-md",children:[e.jsx(n,{type:"email",value:o.email||"",disabled:!0,className:"flex-1 bg-slate-100"}),e.jsx(p,{variant:"outline",size:"sm",onClick:()=>W("email"),children:"Change"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Phone Number"}),e.jsx(n,{type:"tel",value:o.phone||"",onChange:s=>m(t=>({...t,phone:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Gender"}),e.jsxs(Se,{value:o.gender||"",onValueChange:s=>m(t=>({...t,gender:s})),children:[e.jsx(Ae,{className:"max-w-md bg-white border-[#dde3eb] rounded-lg",children:e.jsx(Pe,{placeholder:"Select gender (optional)"})}),e.jsxs(Ee,{children:[e.jsx(J,{value:"male",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Be,{className:"size-4 text-blue-500"}),e.jsx("span",{children:"Male"})]})}),e.jsx(J,{value:"female",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ye,{className:"size-4 text-pink-500"}),e.jsx("span",{children:"Female"})]})}),e.jsx(J,{value:"prefer_not_to_say",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{className:"size-4 text-gray-500"}),e.jsx("span",{children:"Prefer not to say"})]})})]})]})]}),r==="student"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"LRN"}),e.jsx(n,{value:o.lrn||"",onChange:s=>m(t=>({...t,lrn:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Grade Level"}),e.jsx(n,{value:o.grade||"",onChange:s=>m(t=>({...t,grade:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Section"}),e.jsx(n,{value:o.section||"",onChange:s=>m(t=>({...t,section:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"School"}),e.jsx(n,{value:o.school||"",onChange:s=>m(t=>({...t,school:s.target.value})),className:"max-w-md"})]})]}),r==="teacher"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Department"}),e.jsx(n,{value:o.department||"",onChange:s=>m(t=>({...t,department:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Subject"}),e.jsx(n,{value:o.subject||"",onChange:s=>m(t=>({...t,subject:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Years of Experience"}),e.jsx(n,{value:o.yearsOfExperience||"",onChange:s=>m(t=>({...t,yearsOfExperience:s.target.value})),className:"max-w-md"})]})]}),r==="admin"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Position"}),e.jsx(n,{value:o.position||"",onChange:s=>m(t=>({...t,position:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Change Password"}),e.jsxs(p,{variant:"outline",className:"rounded-xl",onClick:()=>W("password"),children:[e.jsx(He,{size:16,className:"mr-2"}),"Update Password"]})]})]}),f==="notifications"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Email Notifications"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Receive updates via email"})]}),e.jsx(d,{checked:i.notifications.emailNotifications,onCheckedChange:s=>c(t=>({...t,notifications:{...t.notifications,emailNotifications:s}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Push Notifications"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Get notified on your device"})]}),e.jsx(d,{checked:i.notifications.pushNotifications,onCheckedChange:s=>c(t=>({...t,notifications:{...t.notifications,pushNotifications:s}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Sound Effects"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Play sounds for notifications"})]}),e.jsx(d,{checked:i.notifications.soundEnabled,onCheckedChange:s=>c(t=>({...t,notifications:{...t.notifications,soundEnabled:s}}))})]}),r==="teacher"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Student Submissions"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Notify when students submit work"})]}),e.jsx(d,{checked:y.notifyOnSubmission,onCheckedChange:s=>g(t=>({...t,notifyOnSubmission:s}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Student Activity Alerts"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Notify on at-risk student activity"})]}),e.jsx(d,{checked:y.notifyOnStudentActivity,onCheckedChange:s=>g(t=>({...t,notifyOnStudentActivity:s}))})]})]}),e.jsxs("div",{className:"pt-4",children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] mb-3 font-body",children:"Notification Types"}),e.jsx("div",{className:"space-y-3",children:[{key:"quizReminders",label:"Quiz Reminders"},{key:"newContent",label:"New Content"},{key:"achievements",label:"Achievements"},{key:"streakAlerts",label:"Streak Alerts"},{key:"weeklySummary",label:"Weekly Summary"}].map(s=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:i.notifications.notificationTypes[s.key],onChange:t=>c(Y=>({...Y,notifications:{...Y.notifications,notificationTypes:{...Y.notifications.notificationTypes,[s.key]:t.target.checked}}})),className:"w-4 h-4 rounded border-[#dde3eb] text-sky-600 focus:ring-sky-500"}),e.jsx("span",{className:"text-sm text-[#0a1628] font-body",children:s.label})]},s.key))})]}),e.jsxs("div",{className:"pt-4 border-t border-[#dde3eb]",children:[e.jsxs("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:[e.jsx(Ke,{size:16,className:"inline mr-2"}),"Quiet Hours"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(n,{type:"time",value:i.notifications.quietHours.start,onChange:s=>c(t=>({...t,notifications:{...t.notifications,quietHours:{...t.notifications.quietHours,start:s.target.value}}})),className:"w-32"}),e.jsx("span",{className:"text-[#5a6578]",children:"to"}),e.jsx(n,{type:"time",value:i.notifications.quietHours.end,onChange:s=>c(t=>({...t,notifications:{...t.notifications,quietHours:{...t.notifications.quietHours,end:s.target.value}}})),className:"w-32"})]})]})]}),f==="appearance"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Dark Mode"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Toggle dark theme"})]}),e.jsx(d,{checked:i.appearance.darkMode,onCheckedChange:s=>c(t=>({...t,appearance:{...t.appearance,darkMode:s}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-3 block font-body uppercase tracking-wider text-xs",children:"Font Size"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Small"}),e.jsx("input",{type:"range",min:"12",max:"20",value:i.appearance.fontSize,onChange:s=>c(t=>({...t,appearance:{...t.appearance,fontSize:Number(s.target.value)}})),className:"flex-1"}),e.jsx("span",{className:"text-xs text-slate-500",children:"Large"}),e.jsxs("span",{className:"text-xs font-mono text-slate-600 w-8",children:[i.appearance.fontSize,"px"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Compact View"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Show more content on screen"})]}),e.jsx(d,{checked:i.appearance.compactView,onCheckedChange:s=>c(t=>({...t,appearance:{...t.appearance,compactView:s}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Reduce Animations"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Minimize motion effects"})]}),e.jsx(d,{checked:i.appearance.reduceAnimations,onCheckedChange:s=>c(t=>({...t,appearance:{...t.appearance,reduceAnimations:s}}))})]})]}),f==="privacy"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Profile Visibility"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Who can see your profile"})]}),e.jsxs("select",{value:i.privacy.profileVisibility,onChange:s=>c(t=>({...t,privacy:{...t.privacy,profileVisibility:s.target.value}})),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm bg-white text-[#0a1628]",children:[e.jsx("option",{value:"everyone",children:"Everyone"}),e.jsx("option",{value:"students_and_staff",children:"Students and Staff"}),e.jsx("option",{value:"private",children:"Private"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Show Activity Status"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Let others see when you're online"})]}),e.jsx(d,{checked:i.privacy.showActivityStatus,onCheckedChange:s=>c(t=>({...t,privacy:{...t.privacy,showActivityStatus:s}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Data Sharing"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Share anonymous usage data"})]}),e.jsx(d,{checked:i.privacy.dataSharing,onCheckedChange:s=>c(t=>({...t,privacy:{...t.privacy,dataSharing:s}}))})]})]}),f==="learning"&&r==="student"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Daily XP Goal"}),e.jsx(n,{type:"number",value:i.learning.dailyXpGoal,onChange:s=>c(t=>({...t,learning:{...t.learning,dailyXpGoal:Number(s.target.value||0)}})),className:"max-w-xs"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Preferred Study Time"}),e.jsxs("select",{value:i.learning.preferredStudyTime,onChange:s=>c(t=>({...t,learning:{...t.learning,preferredStudyTime:s.target.value}})),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm w-full max-w-xs bg-white text-[#0a1628]",children:[e.jsx("option",{value:"morning",children:"Morning (6AM - 12PM)"}),e.jsx("option",{value:"afternoon",children:"Afternoon (12PM - 6PM)"}),e.jsx("option",{value:"evening",children:"Evening (6PM - 12PM)"}),e.jsx("option",{value:"night",children:"Night (12AM - 6AM)"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Auto-play Next Lesson"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Automatically start the next lesson"})]}),e.jsx(d,{checked:i.learning.autoPlayLessons,onCheckedChange:s=>c(t=>({...t,learning:{...t.learning,autoPlayLessons:s}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Show Hints During Quizzes"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Display helpful hints for questions"})]}),e.jsx(d,{checked:i.learning.showHints,onCheckedChange:s=>c(t=>({...t,learning:{...t.learning,showHints:s}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Quiz Difficulty Preference"}),e.jsxs("select",{value:i.learning.quizDifficultyPreference,onChange:s=>c(t=>({...t,learning:{...t.learning,quizDifficultyPreference:s.target.value}})),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm w-full max-w-xs bg-white text-[#0a1628]",children:[e.jsx("option",{value:"adaptive",children:"Adaptive (Recommended)"}),e.jsx("option",{value:"easy",children:"Easy"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"hard",children:"Hard"})]})]}),e.jsxs("div",{className:"pt-4 border-t border-[#dde3eb]",children:[e.jsxs("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:[e.jsx(rs,{size:16,className:"inline mr-2"}),"Study Reminders"]}),e.jsx(n,{type:"time",value:i.learning.studyReminderTime,onChange:s=>c(t=>({...t,learning:{...t.learning,studyReminderTime:s.target.value}})),className:"w-32"})]})]}),f==="teaching"&&r==="teacher"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Quiz Defaults"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Time Limit (min)"}),e.jsx(n,{type:"number",value:y.quizDefaults.timeLimitMinutes,onChange:s=>g(t=>({...t,quizDefaults:{...t.quizDefaults,timeLimitMinutes:Number(s.target.value)}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Passing Score (%)"}),e.jsx(n,{type:"number",value:y.quizDefaults.passingScore,onChange:s=>g(t=>({...t,quizDefaults:{...t.quizDefaults,passingScore:Number(s.target.value)}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Max Attempts"}),e.jsx(n,{type:"number",value:y.quizDefaults.maxAttempts,onChange:s=>g(t=>({...t,quizDefaults:{...t.quizDefaults,maxAttempts:Number(s.target.value)}}))})]})]}),e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body pt-4",children:"Class Preferences"}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Auto-Enroll Students"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Automatically enroll new students"})]}),e.jsx(d,{checked:y.classPreferences.autoEnroll,onCheckedChange:s=>g(t=>({...t,classPreferences:{...t.classPreferences,autoEnroll:s}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Class Visibility"}),e.jsxs("select",{value:y.classPreferences.classVisibility,onChange:s=>g(t=>({...t,classPreferences:{...t.classPreferences,classVisibility:s.target.value}})),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm bg-white text-[#0a1628]",children:[e.jsx("option",{value:"public",children:"Public"}),e.jsx("option",{value:"private",children:"Private"}),e.jsx("option",{value:"invite_only",children:"Invite Only"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-t border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Student Analytics Visibility"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Let students see their leaderboard rank"})]}),e.jsx(d,{checked:y.studentAnalyticsVisibility,onCheckedChange:s=>g(t=>({...t,studentAnalyticsVisibility:s}))})]})]}),f==="system"&&r==="admin"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Maintenance Mode"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Disable platform access for non-admins"})]}),e.jsx(d,{checked:v.maintenanceMode,onCheckedChange:s=>N(t=>({...t,maintenanceMode:s}))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Default Grade Level"}),e.jsx(n,{value:v.defaultGradeLevel,onChange:s=>N(t=>({...t,defaultGradeLevel:s.target.value}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Default Curriculum"}),e.jsx(n,{value:v.defaultCurriculum,onChange:s=>N(t=>({...t,defaultCurriculum:s.target.value}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Max Class Size"}),e.jsx(n,{type:"number",value:v.maxClassSize,onChange:s=>N(t=>({...t,maxClassSize:Number(s.target.value)}))})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Audit Log Visible"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Show audit logs in admin dashboard"})]}),e.jsx(d,{checked:v.auditLogVisible,onCheckedChange:s=>N(t=>({...t,auditLogVisible:s}))})]}),e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body pt-4",children:"AI Configuration"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Model Name"}),e.jsx(n,{value:v.aiConfig.modelName,onChange:s=>N(t=>({...t,aiConfig:{...t.aiConfig,modelName:s.target.value}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Temperature"}),e.jsx(n,{type:"number",step:"0.1",min:"0",max:"2",value:v.aiConfig.temperature,onChange:s=>N(t=>({...t,aiConfig:{...t.aiConfig,temperature:Number(s.target.value)}}))})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"API Endpoint"}),e.jsx(n,{value:v.aiConfig.endpoint,onChange:s=>N(t=>({...t,aiConfig:{...t.aiConfig,endpoint:s.target.value}}))})]})]})]}),f==="data"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"p-4 bg-sky-50 border border-sky-200 rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-sky-900 mb-1 font-body",children:"Download Your Data"}),e.jsx("p",{className:"text-xs text-sky-700 mb-3",children:"Export all your learning data and progress"}),e.jsxs(p,{variant:"outline",size:"sm",className:"rounded-xl",onClick:Ne,disabled:_,children:[e.jsx(he,{size:16,className:"mr-2"}),_?"Exporting...":"Request Data Export"]})]}),e.jsxs("div",{className:"p-4 bg-white border border-[#dde3eb] rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] mb-1 font-body",children:"Clear Cache"}),e.jsx("p",{className:"text-xs text-[#5a6578] mb-3",children:"Free up space by clearing cached data"}),e.jsx(p,{variant:"outline",size:"sm",className:"rounded-xl",onClick:we,disabled:H,children:H?"Clearing...":"Clear Cache"})]}),e.jsxs("div",{className:"p-4 bg-rose-50 border border-rose-200 rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-rose-900 mb-1",children:"Reset Progress"}),e.jsxs("p",{className:"text-xs text-rose-700 mb-3",children:[r==="student"&&"Reset quizzes, diagnostic state, XP, and learning progress for retesting.",r==="teacher"&&"Reset imported records, managed classrooms, and teacher-generated quiz artifacts.",r==="admin"&&"Reset admin testing artifacts like personal audit/content update records."]}),e.jsx(p,{variant:"outline",size:"sm",className:"rounded-xl text-rose-700 border-rose-300",disabled:!S||q,onClick:()=>D(!0),children:q?"Resetting...":"Reset Testing Data"})]}),e.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-red-900 mb-1",children:"Delete Account"}),e.jsx("p",{className:"text-xs text-red-700 mb-3",children:"Permanently delete your account and all data"}),e.jsxs(p,{variant:"outline",size:"sm",className:"rounded-xl text-red-700 border-red-300",onClick:()=>I(!0),disabled:ne,children:[e.jsx(Ze,{size:16,className:"mr-2"}),ne?"Deleting...":"Delete Account"]})]})]})]}),e.jsxs("div",{className:"p-6 border-t border-[#dde3eb] bg-[#edf1f7] flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-slate-500 font-body",children:"MathPulse AI v2.1.0"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{variant:"outline",onClick:B,className:"rounded-lg border-[#dde3eb]",disabled:O,children:"Cancel"}),e.jsx(p,{onClick:ve,className:"rounded-lg bg-sky-600 hover:bg-sky-700 text-white",disabled:O,children:O?"Saving...":"Save Changes"})]})]})]})]})]}),ye&&e.jsx(V.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[130] bg-black/50 backdrop-blur-sm flex items-center justify-center p-4",onClick:()=>{C||A(!1)},children:e.jsxs(V.div,{initial:{opacity:0,scale:.95,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:12},transition:{duration:.2},className:"w-full max-w-md rounded-2xl border border-[#dde3eb] bg-[#f7f9fc] shadow-2xl",onClick:s=>s.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[#dde3eb] px-6 py-4",children:[e.jsxs("h4",{className:"text-lg font-display font-bold text-[#0a1628]",children:[b==="password"&&"Change Password",b==="email"&&"Change Email",b==="delete"&&"Delete Account"]}),e.jsx("button",{onClick:()=>{C||A(!1)},className:"p-2 rounded-xl hover:bg-[#edf1f7] transition-colors","aria-label":"Close",children:e.jsx(ue,{size:18,className:"text-[#5a6578]"})})]}),e.jsxs("div",{className:"px-6 py-5 space-y-4",children:[e.jsx("p",{className:"text-sm text-[#5a6578]",children:"Enter your current password to continue."}),e.jsxs("div",{className:"relative",children:[e.jsx(n,{type:G?"text":"password",value:M,onChange:s=>ie(s.target.value),placeholder:"Current password",autoFocus:!0,className:"pr-10",disabled:C,onKeyDown:s=>{s.key==="Enter"&&xe()}}),e.jsx("button",{type:"button",onClick:()=>re(!G),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",tabIndex:-1,children:G?e.jsx(es,{size:16}):e.jsx(ss,{size:16})})]}),b==="password"&&e.jsx("div",{className:"relative",children:e.jsx(n,{type:"password",value:U,onChange:s=>ce(s.target.value),placeholder:"New password (min 8 chars)",disabled:C})}),b==="email"&&e.jsx(n,{type:"email",value:F,onChange:s=>oe(s.target.value),placeholder:"New email address",disabled:C}),b==="delete"&&e.jsx("p",{className:"text-sm text-red-600 font-medium",children:"This action is permanent and cannot be undone."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(p,{variant:"outline",onClick:()=>A(!1),disabled:C,children:"Cancel"}),e.jsx(p,{onClick:()=>void xe(),className:b==="delete"?"bg-red-600 hover:bg-red-700 text-white":"bg-sky-600 hover:bg-sky-700 text-white",disabled:C,children:C?"Processing...":b==="delete"?"Delete Forever":"Confirm"})]})]})]})}),e.jsx(me,{isOpen:pe,onClose:()=>D(!1),onConfirm:Ce,title:"Reset Testing Data?",message:`Reset ${r} testing data? This will clear quizzes, diagnostic assessments, assessment history, XP, and learning progress. This action cannot be undone.`,confirmText:q?"Resetting...":"Reset Data",cancelText:"Cancel",type:"warning",icon:"warning",zIndexClass:"z-[130]"}),e.jsx(me,{isOpen:je,onClose:()=>I(!1),onConfirm:ke,title:"Delete Account?",message:"You will need to re-authenticate to permanently delete your account. This cannot be undone.",confirmText:"Continue",cancelText:"Cancel",type:"danger",icon:"delete",zIndexClass:"z-[130]"})]})}):null};export{Vs as default};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/SettingsModal-tD3B9SgO.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-uASBzalf.js","assets/vendor-react-B4AQeu28.js","assets/vendor-firebase-firestore-CP9q7ISf.js","assets/vendor-firebase-core-DCQrgkxC.js","assets/vendor-firebase-auth-Bcpr4O6E.js","assets/vendor-firebase-storage-dc5X5yTv.js","assets/vendor-firebase-analytics-CHPyhRzk.js","assets/vendor-radix-xDOIcVzp.js","assets/vendor-charts-Ckgeb0nY.js","assets/vendor-markdown-yqZQ_iQm.js","assets/vendor-markdown-CfVKi3_s.css","assets/index-D9pRNq5G.css"])))=>i.map(i=>d[i]);
2
+ import{e as se,l as Te,aQ as Le,aR as Me,aS as _e,aT as De,aU as qe,aV as Ie,y as Fe,S as Ve,aN as Oe,a as Ge,g as He,m as V,L as Ue,_ as fe,n as x,aW as Qe,aX as Xe,aY as Be,aZ as We}from"./index-uASBzalf.js";import{r as a,j as e}from"./vendor-react-B4AQeu28.js";import{S as Ye,a as $e,b as Je,c as Ke,d as Z}from"./select--QYuvUGV.js";import{B as f}from"./button-BPmLcOpC.js";import{I as n}from"./input--XHWlmp1.js";import{S as d}from"./switch-CZbBlSot.js";import pe from"./ConfirmModal-D2z4s_BB.js";import{P as Ze,M as es,V as ss}from"./ProfilePictureUploader-CyCaD4jN.js";import{B as ye}from"./bell-CiUaN6S3.js";import{D as je}from"./download-CVrPjUr0.js";import{X as ge}from"./x-CBb03rh3.js";import{C as ts}from"./circle-help-PS1uII8x.js";import{C as as}from"./clock-8t0UYgg3.js";import{T as ns}from"./trash-2-D7q6y9vT.js";import{E as is,a as ls}from"./eye-DIwMshM-.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";import"./chevron-up-BpMhRyJp.js";import"./check-Dk6iwDFI.js";import"./log-out-Dr0BHRO4.js";import"./minus-Bfei9C79.js";import"./plus-Cy6hz5PP.js";import"./upload-Ds5w3QNw.js";/**
3
+ * @license lucide-react v0.487.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const rs=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],cs=se("palette",rs);/**
8
+ * @license lucide-react v0.487.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */const os=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],ds=se("server",os);/**
13
+ * @license lucide-react v0.487.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */const xs=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],ms=se("smartphone",xs),hs=()=>{const{userProfile:m,userRole:y}=Te(),[l,E]=a.useState(Le),[z,R]=a.useState(Me),[C,T]=a.useState(!1),[_,S]=a.useState(null);a.useEffect(()=>{if(!m?.uid)return;(async()=>{T(!0),S(null);try{if(y==="teacher"){const u=await qe(m.uid);E(u)}if(y==="admin"){const u=await Ie();R(u)}}catch(u){S(u instanceof Error?u.message:"Failed to load settings")}finally{T(!1)}})()},[m?.uid,y]);const c=a.useCallback(async k=>{if(!m?.uid)return;const u=await _e(m.uid,k);E(u)},[m?.uid]),L=a.useCallback(async k=>{const u=await De(k);R(u)},[]);return{teacherPrefs:l,adminConfig:z,loading:C,error:_,saveTeacherPrefs:c,saveAdminConfig:L}},ee=()=>JSON.parse(JSON.stringify(Qe)),Us=({isOpen:m,onClose:y,profileData:l,onSave:E,settingsData:z,onSaveSettings:R,onApplySettingsPreview:C,onExportData:T,onClearCache:_,onResetData:S})=>{const c=l?.role||"student",{teacherPrefs:L,adminConfig:k,saveTeacherPrefs:u,saveAdminConfig:ve}=hs(),[p,Ne]=a.useState("account"),[o,h]=a.useState({}),[i,te]=a.useState(ee()),[j,g]=a.useState(L),[v,N]=a.useState(k),[O,ae]=a.useState(!1),[D,ne]=a.useState(!1),[G,ie]=a.useState(!1),[H,le]=a.useState(!1),[re,us]=a.useState(!1),[ke,q]=a.useState(!1),[we,I]=a.useState(!1),[Ce,P]=a.useState(!1),[M,ce]=a.useState(""),[b,Se]=a.useState(null),[w,oe]=a.useState(!1),[U,de]=a.useState(!1),[Q,xe]=a.useState(""),[F,me]=a.useState(""),X=a.useRef(!1),B=a.useRef(ee());a.useEffect(()=>{if(!m){X.current=!1;return}if(X.current)return;X.current=!0;const s=z?JSON.parse(JSON.stringify(z)):ee();B.current=s,h({uid:l?.uid,name:l?.name||"",email:l?.email||"",phone:l?.phone||"",photo:l?.photo||"",avatarLayers:l?.avatarLayers,role:l?.role,gender:l?.gender,lrn:l?.lrn||"",grade:l?.grade||"",section:l?.section||"",school:l?.school||"",department:l?.department||"",subject:l?.subject||"",yearsOfExperience:l?.yearsOfExperience||"",qualification:l?.qualification||"",position:l?.position||""}),te(s),g(L),N(k)},[m,l,z,L,k]),a.useEffect(()=>{m&&C?.(i)},[m,i,C]),a.useEffect(()=>{if(!m)return;const s=t=>{t.key==="Escape"&&(C?.(B.current),y())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[m,y,C]);const he=a.useMemo(()=>{const s=[{id:"account",label:"Account",icon:Fe},{id:"notifications",label:"Notifications",icon:ye},{id:"appearance",label:"Appearance",icon:cs},{id:"privacy",label:"Privacy & Security",icon:Ve}];return c==="student"&&s.push({id:"learning",label:"Learning",icon:Oe}),c==="teacher"&&s.push({id:"teaching",label:"Teaching",icon:Ge}),c==="admin"&&s.push({id:"system",label:"System",icon:ds}),s.push({id:"data",label:"Data & Storage",icon:je}),s},[c]),r=s=>{te(t=>s(t))},W=s=>{Se(s),ce(""),de(!1),s==="password"&&xe(""),s==="email"&&me(o.email||""),P(!0)},ue=async()=>{if(!M.trim()){x.error("Current password is required");return}oe(!0);try{if(b==="password"){if(Q.length<8){x.error("New password must be at least 8 characters");return}await Xe(M,Q),x.success("Password updated")}else if(b==="email"){if(!F.includes("@")){x.error("Enter a valid email");return}await Be(M,F),h(s=>({...s,email:F})),x.success("Email updated")}else if(b==="delete"){await We(M,o.uid||""),x.success("Account deleted"),y();return}P(!1)}catch(s){x.error(s instanceof Error?s.message:"Authentication failed")}finally{oe(!1)}},Pe=async()=>{ae(!0);try{E&&await E(o),R&&await R(i),c==="teacher"&&await u(j),c==="admin"&&await ve(v),y()}catch(s){x.error(s instanceof Error?s.message:"Failed to save settings")}finally{ae(!1)}},Y=()=>{P(!1),q(!1),I(!1),C?.(B.current),y()},Ae=async()=>{if(!(!T||G)){ie(!0);try{await T()}catch(s){x.error(s instanceof Error?s.message:"Failed to export data")}finally{ie(!1)}}},Ee=async()=>{if(!(!_||H)){le(!0);try{await _()}catch(s){x.error(s instanceof Error?s.message:"Failed to clear cache")}finally{le(!1)}}},ze=async()=>{if(!(!S||D)){q(!1),ne(!0);try{await S(),x.success("Testing data reset completed")}catch(s){x.error(s instanceof Error?s.message:"Failed to reset testing data")}finally{ne(!1)}}},Re=()=>{I(!1),W("delete")};return m?e.jsx(He,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[e.jsx(V.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:Y,className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),e.jsxs(V.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2},className:"relative bg-[#f7f9fc] rounded-2xl shadow-2xl border border-[#dde3eb] w-full max-w-4xl max-h-[85vh] overflow-hidden flex",children:[e.jsxs("div",{className:"w-64 bg-slate-50 border-r border-slate-200 p-6 overflow-y-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-xl font-display font-bold text-[#0a1628]",children:"Settings"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1 font-body",children:"Manage your preferences"})]}),e.jsx("nav",{className:"space-y-1",children:he.map(s=>{const t=s.icon;return e.jsxs("button",{onClick:()=>Ne(s.id),className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl text-left transition-all ${p===s.id?"bg-sky-50 text-sky-700 shadow-sm":"text-slate-500 hover:bg-slate-100 hover:text-sky-700"}`,children:[e.jsx(t,{size:18}),e.jsx("span",{className:"text-sm font-medium",children:s.label})]},s.id)})})]}),e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-[#dde3eb]",children:[e.jsx("h3",{className:"text-lg font-display font-bold text-[#0a1628]",children:he.find(s=>s.id===p)?.label}),e.jsx("button",{onClick:Y,className:"p-2 hover:bg-[#edf1f7] rounded-xl transition-colors",children:e.jsx(ge,{size:20,className:"text-[#5a6578]"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[p==="account"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(Ze,{uid:o.uid,photoURL:o.photo,displayName:o.name,onUploaded:s=>h(t=>({...t,photo:s}))}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Full Name"}),e.jsx(n,{type:"text",value:o.name||"",onChange:s=>h(t=>({...t,name:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Email Address"}),e.jsxs("div",{className:"flex items-center gap-2 max-w-md",children:[e.jsx(n,{type:"email",value:o.email||"",disabled:!0,className:"flex-1 bg-slate-100"}),e.jsx(f,{variant:"outline",size:"sm",onClick:()=>W("email"),children:"Change"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Phone Number"}),e.jsx(n,{type:"tel",value:o.phone||"",onChange:s=>h(t=>({...t,phone:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Gender"}),e.jsxs(Ye,{value:o.gender||"",onValueChange:s=>h(t=>({...t,gender:s})),children:[e.jsx($e,{className:"max-w-md bg-white border-[#dde3eb] rounded-lg",children:e.jsx(Je,{placeholder:"Select gender (optional)"})}),e.jsxs(Ke,{children:[e.jsx(Z,{value:"male",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(es,{className:"size-4 text-blue-500"}),e.jsx("span",{children:"Male"})]})}),e.jsx(Z,{value:"female",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ss,{className:"size-4 text-pink-500"}),e.jsx("span",{children:"Female"})]})}),e.jsx(Z,{value:"prefer_not_to_say",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ts,{className:"size-4 text-gray-500"}),e.jsx("span",{children:"Prefer not to say"})]})})]})]})]}),c==="student"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"LRN"}),e.jsx(n,{value:o.lrn||"",onChange:s=>h(t=>({...t,lrn:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Grade Level"}),e.jsx(n,{value:o.grade||"",onChange:s=>h(t=>({...t,grade:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Section"}),e.jsx(n,{value:o.section||"",onChange:s=>h(t=>({...t,section:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"School"}),e.jsx(n,{value:o.school||"",onChange:s=>h(t=>({...t,school:s.target.value})),className:"max-w-md"})]})]}),c==="teacher"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Department"}),e.jsx(n,{value:o.department||"",onChange:s=>h(t=>({...t,department:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Subject"}),e.jsx(n,{value:o.subject||"",onChange:s=>h(t=>({...t,subject:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Years of Experience"}),e.jsx(n,{value:o.yearsOfExperience||"",onChange:s=>h(t=>({...t,yearsOfExperience:s.target.value})),className:"max-w-md"})]})]}),c==="admin"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Position"}),e.jsx(n,{value:o.position||"",onChange:s=>h(t=>({...t,position:s.target.value})),className:"max-w-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Change Password"}),e.jsxs(f,{variant:"outline",className:"rounded-xl",onClick:()=>W("password"),children:[e.jsx(Ue,{size:16,className:"mr-2"}),"Update Password"]})]})]}),p==="notifications"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Email Notifications"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Receive updates via email"})]}),e.jsx(d,{checked:i.notifications.emailNotifications,onCheckedChange:s=>r(t=>({...t,notifications:{...t.notifications,emailNotifications:s}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Push Notifications"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Get notified on your device"})]}),e.jsx(d,{checked:i.notifications.pushNotifications,onCheckedChange:s=>r(t=>({...t,notifications:{...t.notifications,pushNotifications:s}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Sound Effects"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Play sounds for notifications"})]}),e.jsx(d,{checked:i.notifications.soundEnabled,onCheckedChange:s=>r(t=>({...t,notifications:{...t.notifications,soundEnabled:s}}))})]}),c==="teacher"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Student Submissions"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Notify when students submit work"})]}),e.jsx(d,{checked:j.notifyOnSubmission,onCheckedChange:s=>g(t=>({...t,notifyOnSubmission:s}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Student Activity Alerts"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Notify on at-risk student activity"})]}),e.jsx(d,{checked:j.notifyOnStudentActivity,onCheckedChange:s=>g(t=>({...t,notifyOnStudentActivity:s}))})]})]}),e.jsxs("div",{className:"pt-4",children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] mb-3 font-body",children:"Notification Types"}),e.jsx("div",{className:"space-y-3",children:[{key:"quizReminders",label:"Quiz Reminders"},{key:"newContent",label:"New Content"},{key:"achievements",label:"Achievements"},{key:"streakAlerts",label:"Streak Alerts"},{key:"weeklySummary",label:"Weekly Summary"}].map(s=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:i.notifications.notificationTypes[s.key],onChange:t=>r(A=>({...A,notifications:{...A.notifications,notificationTypes:{...A.notifications.notificationTypes,[s.key]:t.target.checked}}})),className:"w-4 h-4 rounded border-[#dde3eb] text-sky-600 focus:ring-sky-500"}),e.jsx("span",{className:"text-sm text-[#0a1628] font-body",children:s.label})]},s.key))})]}),e.jsxs("div",{className:"pt-4 border-t border-[#dde3eb]",children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] mb-1 font-body",children:"Push Notification Categories"}),e.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Choose which kinds of pushes you want to receive on this device."}),e.jsxs("div",{className:"flex items-center justify-between py-2 mb-2 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h5",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Enable Push (master)"}),e.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Turn off to silence ALL push categories."})]}),e.jsx(d,{checked:i.pushPreferences.pushEnabled,onCheckedChange:s=>r(t=>({...t,pushPreferences:{...t.pushPreferences,pushEnabled:s}}))})]}),e.jsx("div",{className:"space-y-2",children:[{key:"achievement",label:"πŸ† Achievements unlocked"},{key:"quiz_battle",label:"βš”οΈ Quiz battle invites & results"},{key:"daily_reward",label:"🎁 Daily reward reminders"},{key:"assignment",label:"πŸ“š New assignments / deadlines"},{key:"grade_posted",label:"πŸ“ Grades posted"},{key:"streak_reminder",label:"πŸ”₯ Streak reminders"},{key:"leaderboard",label:"πŸ“Š Leaderboard updates"},{key:"system",label:"πŸ”” System announcements"}].map(s=>{const t=s.key;return e.jsxs("label",{className:"flex items-center justify-between py-1.5",children:[e.jsx("span",{className:"text-sm text-[#0a1628] font-body",children:s.label}),e.jsx(d,{checked:!!i.pushPreferences[t],onCheckedChange:A=>r($=>({...$,pushPreferences:{...$.pushPreferences,[s.key]:A}})),disabled:!i.pushPreferences.pushEnabled&&t!=="pushEnabled"})]},s.key)})}),e.jsx("div",{className:"mt-4",children:e.jsxs(f,{type:"button",variant:"outline",size:"sm",onClick:async()=>{try{const{httpsCallable:s}=await fe(async()=>{const{httpsCallable:J}=await import("./vendor-firebase-core-DCQrgkxC.js").then(K=>K.a9);return{httpsCallable:J}},[]),{cloudFunctions:t}=await fe(async()=>{const{cloudFunctions:J}=await import("./index-uASBzalf.js").then(K=>K.b2);return{cloudFunctions:J}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),be=(await s(t,"sendTestPush")({}))?.data?.sent??0;be>0?x.success(`Sent test push to ${be} device(s).`):x.message("No active devices found. Enable browser notifications first.")}catch(s){x.error(s instanceof Error?s.message:"Failed to send test push")}},children:[e.jsx(ye,{size:14,className:"mr-2"}),"Send test push"]})})]}),e.jsxs("div",{className:"pt-4 border-t border-[#dde3eb]",children:[e.jsxs("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:[e.jsx(as,{size:16,className:"inline mr-2"}),"Quiet Hours"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(n,{type:"time",value:i.notifications.quietHours.start,onChange:s=>r(t=>({...t,notifications:{...t.notifications,quietHours:{...t.notifications.quietHours,start:s.target.value}}})),className:"w-32"}),e.jsx("span",{className:"text-[#5a6578]",children:"to"}),e.jsx(n,{type:"time",value:i.notifications.quietHours.end,onChange:s=>r(t=>({...t,notifications:{...t.notifications,quietHours:{...t.notifications.quietHours,end:s.target.value}}})),className:"w-32"})]})]})]}),p==="appearance"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Dark Mode"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Toggle dark theme"})]}),e.jsx(d,{checked:i.appearance.darkMode,onCheckedChange:s=>r(t=>({...t,appearance:{...t.appearance,darkMode:s}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-3 block font-body uppercase tracking-wider text-xs",children:"Font Size"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Small"}),e.jsx("input",{type:"range",min:"12",max:"20",value:i.appearance.fontSize,onChange:s=>r(t=>({...t,appearance:{...t.appearance,fontSize:Number(s.target.value)}})),className:"flex-1"}),e.jsx("span",{className:"text-xs text-slate-500",children:"Large"}),e.jsxs("span",{className:"text-xs font-mono text-slate-600 w-8",children:[i.appearance.fontSize,"px"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Compact View"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Show more content on screen"})]}),e.jsx(d,{checked:i.appearance.compactView,onCheckedChange:s=>r(t=>({...t,appearance:{...t.appearance,compactView:s}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Reduce Animations"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Minimize motion effects"})]}),e.jsx(d,{checked:i.appearance.reduceAnimations,onCheckedChange:s=>r(t=>({...t,appearance:{...t.appearance,reduceAnimations:s}}))})]})]}),p==="privacy"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Profile Visibility"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Who can see your profile"})]}),e.jsxs("select",{value:i.privacy.profileVisibility,onChange:s=>r(t=>({...t,privacy:{...t.privacy,profileVisibility:s.target.value}})),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm bg-white text-[#0a1628]",children:[e.jsx("option",{value:"everyone",children:"Everyone"}),e.jsx("option",{value:"students_and_staff",children:"Students and Staff"}),e.jsx("option",{value:"private",children:"Private"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Show Activity Status"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Let others see when you're online"})]}),e.jsx(d,{checked:i.privacy.showActivityStatus,onCheckedChange:s=>r(t=>({...t,privacy:{...t.privacy,showActivityStatus:s}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Data Sharing"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Share anonymous usage data"})]}),e.jsx(d,{checked:i.privacy.dataSharing,onCheckedChange:s=>r(t=>({...t,privacy:{...t.privacy,dataSharing:s}}))})]})]}),p==="learning"&&c==="student"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Daily XP Goal"}),e.jsx(n,{type:"number",value:i.learning.dailyXpGoal,onChange:s=>r(t=>({...t,learning:{...t.learning,dailyXpGoal:Number(s.target.value||0)}})),className:"max-w-xs"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Preferred Study Time"}),e.jsxs("select",{value:i.learning.preferredStudyTime,onChange:s=>r(t=>({...t,learning:{...t.learning,preferredStudyTime:s.target.value}})),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm w-full max-w-xs bg-white text-[#0a1628]",children:[e.jsx("option",{value:"morning",children:"Morning (6AM - 12PM)"}),e.jsx("option",{value:"afternoon",children:"Afternoon (12PM - 6PM)"}),e.jsx("option",{value:"evening",children:"Evening (6PM - 12PM)"}),e.jsx("option",{value:"night",children:"Night (12AM - 6AM)"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Auto-play Next Lesson"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Automatically start the next lesson"})]}),e.jsx(d,{checked:i.learning.autoPlayLessons,onCheckedChange:s=>r(t=>({...t,learning:{...t.learning,autoPlayLessons:s}}))})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Show Hints During Quizzes"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Display helpful hints for questions"})]}),e.jsx(d,{checked:i.learning.showHints,onCheckedChange:s=>r(t=>({...t,learning:{...t.learning,showHints:s}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:"Quiz Difficulty Preference"}),e.jsxs("select",{value:i.learning.quizDifficultyPreference,onChange:s=>r(t=>({...t,learning:{...t.learning,quizDifficultyPreference:s.target.value}})),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm w-full max-w-xs bg-white text-[#0a1628]",children:[e.jsx("option",{value:"adaptive",children:"Adaptive (Recommended)"}),e.jsx("option",{value:"easy",children:"Easy"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"hard",children:"Hard"})]})]}),e.jsxs("div",{className:"pt-4 border-t border-[#dde3eb]",children:[e.jsxs("label",{className:"text-sm font-bold text-[#5a6578] mb-2 block font-body uppercase tracking-wider text-xs",children:[e.jsx(ms,{size:16,className:"inline mr-2"}),"Study Reminders"]}),e.jsx(n,{type:"time",value:i.learning.studyReminderTime,onChange:s=>r(t=>({...t,learning:{...t.learning,studyReminderTime:s.target.value}})),className:"w-32"})]})]}),p==="teaching"&&c==="teacher"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Quiz Defaults"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Time Limit (min)"}),e.jsx(n,{type:"number",value:j.quizDefaults.timeLimitMinutes,onChange:s=>g(t=>({...t,quizDefaults:{...t.quizDefaults,timeLimitMinutes:Number(s.target.value)}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Passing Score (%)"}),e.jsx(n,{type:"number",value:j.quizDefaults.passingScore,onChange:s=>g(t=>({...t,quizDefaults:{...t.quizDefaults,passingScore:Number(s.target.value)}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Max Attempts"}),e.jsx(n,{type:"number",value:j.quizDefaults.maxAttempts,onChange:s=>g(t=>({...t,quizDefaults:{...t.quizDefaults,maxAttempts:Number(s.target.value)}}))})]})]}),e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body pt-4",children:"Class Preferences"}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Auto-Enroll Students"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Automatically enroll new students"})]}),e.jsx(d,{checked:j.classPreferences.autoEnroll,onCheckedChange:s=>g(t=>({...t,classPreferences:{...t.classPreferences,autoEnroll:s}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Class Visibility"}),e.jsxs("select",{value:j.classPreferences.classVisibility,onChange:s=>g(t=>({...t,classPreferences:{...t.classPreferences,classVisibility:s.target.value}})),className:"px-3 py-2 border border-[#dde3eb] rounded-lg text-sm bg-white text-[#0a1628]",children:[e.jsx("option",{value:"public",children:"Public"}),e.jsx("option",{value:"private",children:"Private"}),e.jsx("option",{value:"invite_only",children:"Invite Only"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-t border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Student Analytics Visibility"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Let students see their leaderboard rank"})]}),e.jsx(d,{checked:j.studentAnalyticsVisibility,onCheckedChange:s=>g(t=>({...t,studentAnalyticsVisibility:s}))})]})]}),p==="system"&&c==="admin"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Maintenance Mode"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Disable platform access for non-admins"})]}),e.jsx(d,{checked:v.maintenanceMode,onCheckedChange:s=>N(t=>({...t,maintenanceMode:s}))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Default Grade Level"}),e.jsx(n,{value:v.defaultGradeLevel,onChange:s=>N(t=>({...t,defaultGradeLevel:s.target.value}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Default Curriculum"}),e.jsx(n,{value:v.defaultCurriculum,onChange:s=>N(t=>({...t,defaultCurriculum:s.target.value}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Max Class Size"}),e.jsx(n,{type:"number",value:v.maxClassSize,onChange:s=>N(t=>({...t,maxClassSize:Number(s.target.value)}))})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-[#dde3eb]",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body",children:"Audit Log Visible"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Show audit logs in admin dashboard"})]}),e.jsx(d,{checked:v.auditLogVisible,onCheckedChange:s=>N(t=>({...t,auditLogVisible:s}))})]}),e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] font-body pt-4",children:"AI Configuration"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Model Name"}),e.jsx(n,{value:v.aiConfig.modelName,onChange:s=>N(t=>({...t,aiConfig:{...t.aiConfig,modelName:s.target.value}}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"Temperature"}),e.jsx(n,{type:"number",step:"0.1",min:"0",max:"2",value:v.aiConfig.temperature,onChange:s=>N(t=>({...t,aiConfig:{...t.aiConfig,temperature:Number(s.target.value)}}))})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"text-xs text-[#5a6578] block mb-1",children:"API Endpoint"}),e.jsx(n,{value:v.aiConfig.endpoint,onChange:s=>N(t=>({...t,aiConfig:{...t.aiConfig,endpoint:s.target.value}}))})]})]})]}),p==="data"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"p-4 bg-sky-50 border border-sky-200 rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-sky-900 mb-1 font-body",children:"Download Your Data"}),e.jsx("p",{className:"text-xs text-sky-700 mb-3",children:"Export all your learning data and progress"}),e.jsxs(f,{variant:"outline",size:"sm",className:"rounded-xl",onClick:Ae,disabled:G,children:[e.jsx(je,{size:16,className:"mr-2"}),G?"Exporting...":"Request Data Export"]})]}),e.jsxs("div",{className:"p-4 bg-white border border-[#dde3eb] rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-[#0a1628] mb-1 font-body",children:"Clear Cache"}),e.jsx("p",{className:"text-xs text-[#5a6578] mb-3",children:"Free up space by clearing cached data"}),e.jsx(f,{variant:"outline",size:"sm",className:"rounded-xl",onClick:Ee,disabled:H,children:H?"Clearing...":"Clear Cache"})]}),e.jsxs("div",{className:"p-4 bg-rose-50 border border-rose-200 rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-rose-900 mb-1",children:"Reset Progress"}),e.jsxs("p",{className:"text-xs text-rose-700 mb-3",children:[c==="student"&&"Reset quizzes, diagnostic state, XP, and learning progress for retesting.",c==="teacher"&&"Reset imported records, managed classrooms, and teacher-generated quiz artifacts.",c==="admin"&&"Reset admin testing artifacts like personal audit/content update records."]}),e.jsx(f,{variant:"outline",size:"sm",className:"rounded-xl text-rose-700 border-rose-300",disabled:!S||D,onClick:()=>q(!0),children:D?"Resetting...":"Reset Testing Data"})]}),e.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-xl",children:[e.jsx("h4",{className:"text-sm font-bold text-red-900 mb-1",children:"Delete Account"}),e.jsx("p",{className:"text-xs text-red-700 mb-3",children:"Permanently delete your account and all data"}),e.jsxs(f,{variant:"outline",size:"sm",className:"rounded-xl text-red-700 border-red-300",onClick:()=>I(!0),disabled:re,children:[e.jsx(ns,{size:16,className:"mr-2"}),re?"Deleting...":"Delete Account"]})]})]})]}),e.jsxs("div",{className:"p-6 border-t border-[#dde3eb] bg-[#edf1f7] flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-slate-500 font-body",children:"MathPulse AI v2.1.0"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{variant:"outline",onClick:Y,className:"rounded-lg border-[#dde3eb]",disabled:O,children:"Cancel"}),e.jsx(f,{onClick:Pe,className:"rounded-lg bg-sky-600 hover:bg-sky-700 text-white",disabled:O,children:O?"Saving...":"Save Changes"})]})]})]})]})]}),Ce&&e.jsx(V.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[130] bg-black/50 backdrop-blur-sm flex items-center justify-center p-4",onClick:()=>{w||P(!1)},children:e.jsxs(V.div,{initial:{opacity:0,scale:.95,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:12},transition:{duration:.2},className:"w-full max-w-md rounded-2xl border border-[#dde3eb] bg-[#f7f9fc] shadow-2xl",onClick:s=>s.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[#dde3eb] px-6 py-4",children:[e.jsxs("h4",{className:"text-lg font-display font-bold text-[#0a1628]",children:[b==="password"&&"Change Password",b==="email"&&"Change Email",b==="delete"&&"Delete Account"]}),e.jsx("button",{onClick:()=>{w||P(!1)},className:"p-2 rounded-xl hover:bg-[#edf1f7] transition-colors","aria-label":"Close",children:e.jsx(ge,{size:18,className:"text-[#5a6578]"})})]}),e.jsxs("div",{className:"px-6 py-5 space-y-4",children:[e.jsx("p",{className:"text-sm text-[#5a6578]",children:"Enter your current password to continue."}),e.jsxs("div",{className:"relative",children:[e.jsx(n,{type:U?"text":"password",value:M,onChange:s=>ce(s.target.value),placeholder:"Current password",autoFocus:!0,className:"pr-10",disabled:w,onKeyDown:s=>{s.key==="Enter"&&ue()}}),e.jsx("button",{type:"button",onClick:()=>de(!U),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",tabIndex:-1,children:U?e.jsx(is,{size:16}):e.jsx(ls,{size:16})})]}),b==="password"&&e.jsx("div",{className:"relative",children:e.jsx(n,{type:"password",value:Q,onChange:s=>xe(s.target.value),placeholder:"New password (min 8 chars)",disabled:w})}),b==="email"&&e.jsx(n,{type:"email",value:F,onChange:s=>me(s.target.value),placeholder:"New email address",disabled:w}),b==="delete"&&e.jsx("p",{className:"text-sm text-red-600 font-medium",children:"This action is permanent and cannot be undone."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(f,{variant:"outline",onClick:()=>P(!1),disabled:w,children:"Cancel"}),e.jsx(f,{onClick:()=>void ue(),className:b==="delete"?"bg-red-600 hover:bg-red-700 text-white":"bg-sky-600 hover:bg-sky-700 text-white",disabled:w,children:w?"Processing...":b==="delete"?"Delete Forever":"Confirm"})]})]})]})}),e.jsx(pe,{isOpen:ke,onClose:()=>q(!1),onConfirm:ze,title:"Reset Testing Data?",message:`Reset ${c} testing data? This will clear quizzes, diagnostic assessments, assessment history, XP, and learning progress. This action cannot be undone.`,confirmText:D?"Resetting...":"Reset Data",cancelText:"Cancel",type:"warning",icon:"warning",zIndexClass:"z-[130]"}),e.jsx(pe,{isOpen:we,onClose:()=>I(!1),onConfirm:Re,title:"Delete Account?",message:"You will need to re-authenticate to permanently delete your account. This cannot be undone.",confirmText:"Continue",cancelText:"Cancel",type:"danger",icon:"delete",zIndexClass:"z-[130]"})]})}):null};export{Us as default};
assets/{Sidebar-2LZAqf7E.js β†’ Sidebar-BxInp2XA.js} RENAMED
@@ -1,6 +1,6 @@
1
- import{r as p,j as e}from"./vendor-react-B4AQeu28.js";import{S as N,a as $,L as u,M as P}from"./LogoutActionButton-lUNItet6.js";import{e as D,m as c,i as G,U as S,G as M,a as f,S as U,P as _,x as q}from"./index-BaOs5Ayg.js";import{T as L,a as C,b as A}from"./tooltip-ChRIOid3.js";import{X as F}from"./x-TNvtuOD9.js";import{C as Q}from"./chevron-right-COqGruhh.js";import{C as W}from"./chevron-left-BWpgclqc.js";import{C as z}from"./chart-column-B3jJOD5i.js";import{S as X}from"./shirt-S3NBuaPm.js";import"./log-out-BenDMDly.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const J=[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]],K=D("cpu",J),me=({activeTab:b,setActiveTab:E,userRole:x="student",onOpenSettings:g,onLogout:y,sidebarCollapsed:i=!1,setSidebarCollapsed:j,mode:T="desktop",onRequestClose:v,forceCollapsed:o=!1})=>{const[I,m]=p.useState(!1),[k,t]=p.useState(null),n=T==="mobile",r=!o&&I,h=typeof g=="function",a=!n&&(o||i&&!r),l=a,H=!n&&!o;p.useEffect(()=>{o&&(m(!1),t(null))},[o]),p.useEffect(()=>{l||t(null)},[l]);const O=x==="admin"?[{label:"Management",items:[{icon:u,label:"Overview"},{icon:S,label:"User Management"},{icon:M,label:"Subjects"},{icon:f,label:"Content"}]},{label:"Insights",items:[{icon:z,label:"Analytics"},{icon:K,label:"AI Monitoring"},{icon:U,label:"Audit Log"},{icon:N,label:"Settings"}]}]:x==="teacher"?[{label:"Teaching",items:[{icon:u,label:"Dashboard"},{icon:S,label:"My Students"},{icon:f,label:"Classes"}]},{label:"Insights",items:[{icon:z,label:"Analytics"}]}]:[{label:"Learn",items:[{icon:u,label:"Dashboard"},{icon:f,label:"Modules"},{icon:P,label:"AI Chat"}]},{label:"Progress",items:[{icon:M,label:"Grades",displayLabel:"Assessment"},{icon:_,label:"Quiz Battle",displayLabel:"Quiz Battle"},{icon:q,label:"Leaderboard",displayLabel:"Leadership Board"}]},{label:"Customization",items:[{icon:X,label:"Avatar Studio",displayLabel:"Avatar Studio"}]}];return e.jsxs(c.aside,{initial:!1,animate:n?{width:280}:{width:a?80:280},transition:{type:"spring",stiffness:360,damping:34},onMouseEnter:()=>H&&i&&m(!0),onMouseLeave:()=>{m(!1),t(null)},className:G("h-full bg-[#f7f9fc] border border-[#dde3eb] shadow-sm flex flex-col",n?"rounded-2xl p-4":"rounded-3xl p-5"),children:[e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:`mb-8 flex items-center ${a?"justify-center":"justify-between"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:"/mathpulse_logo.png",alt:"MathPulse AI",className:"w-12 h-12 object-contain drop-shadow-md flex-shrink-0"}),(!a||r)&&e.jsx("div",{children:e.jsx("h2",{className:"text-base font-bold font-display text-[#0a1628] whitespace-nowrap",children:"MathPulse AI"})})]}),n&&v&&e.jsx("button",{onClick:v,className:"p-2 hover:bg-[#dde3eb] rounded-lg transition-colors text-[#5a6578]","aria-label":"Close navigation",children:e.jsx(F,{size:20})}),!n&&!o&&j&&(!i||r)&&e.jsx(c.button,{whileHover:{scale:1.1},whileTap:{scale:.95},onClick:()=>j(!i),className:"p-2 hover:bg-[#dde3eb] rounded-lg transition-colors text-[#5a6578]","aria-label":i?"Expand sidebar":"Collapse sidebar",title:i?"Expand sidebar":"Collapse sidebar",children:i?e.jsx(Q,{size:20}):e.jsx(W,{size:20})})]}),e.jsx("nav",{className:"flex-1 min-h-0 overflow-y-auto space-y-5 pr-1",children:O.map((d,B)=>e.jsxs("div",{children:[a?e.jsx("div",{className:"px-4 mb-2 flex items-center gap-2",children:e.jsx("div",{className:"flex-1 h-[1px] bg-[#dde3eb]"})}):d.label&&e.jsx("p",{className:"px-4 mb-2 text-[10px] font-bold text-[#5a6578] uppercase tracking-widest",children:d.label}),e.jsx("div",{className:"space-y-1",children:d.items.map(s=>e.jsxs(L,{open:l&&k===s.label,children:[e.jsx(C,{asChild:!0,children:e.jsxs(c.button,{whileHover:{x:2},whileTap:{scale:.98},onMouseEnter:()=>{l&&t(s.label)},onMouseLeave:()=>{t(w=>w===s.label?null:w)},onFocus:()=>t(null),onClick:()=>E(s.label),className:`w-full flex items-center gap-3 px-4 py-3 rounded-2xl cursor-pointer transition-all duration-200 border whitespace-nowrap ${a?"justify-center":""} ${b===s.label?"bg-sky-50 border-sky-200 shadow-sm text-sky-700":"bg-transparent border-transparent text-[#5a6578] hover:bg-[#dde3eb] hover:border-[#dde3eb] hover:text-[#0a1628]"}`,children:[e.jsx(s.icon,{size:18,strokeWidth:b===s.label?2.5:2,className:"flex-shrink-0"}),(!a||r)&&e.jsx("span",{className:"font-body font-bold text-xs",children:s.displayLabel||s.label}),b===s.label&&(!a||r)&&e.jsx(c.div,{layoutId:"sidebar-active-indicator",className:"ml-auto w-2 h-2 rounded-full bg-sky-500",transition:{type:"spring",duration:.4}})]})}),l&&e.jsx(A,{side:"right",sideOffset:16,className:"font-bold text-xs",children:s.displayLabel||s.label})]},s.label))})]},B))})]}),e.jsxs("div",{className:"mt-4 space-y-2 border-t border-[#dde3eb] pt-4",children:[x!=="admin"?e.jsxs(L,{open:l&&k==="Settings",children:[e.jsx(C,{asChild:!0,children:e.jsxs(c.button,{whileHover:{x:2},whileTap:{scale:.98},onMouseEnter:()=>{l&&t("Settings")},onMouseLeave:()=>{t(d=>d==="Settings"?null:d)},onFocus:()=>t(null),className:`w-full flex items-center gap-3 px-4 py-3 rounded-2xl font-bold border transition-all duration-200 whitespace-nowrap ${a?"justify-center":""} ${b==="Settings"?"bg-sky-50 border-sky-200 text-sky-700 shadow-sm":h?"border-transparent text-[#5a6578] hover:bg-[#dde3eb] hover:border-[#dde3eb] hover:text-[#0a1628]":"border-transparent text-[#a0aec0] cursor-not-allowed opacity-60"}`,onClick:h?g:void 0,disabled:!h,"aria-disabled":!h,"aria-label":"Open settings",children:[e.jsx(N,{size:18,strokeWidth:2,className:"flex-shrink-0"}),(!a||r)&&e.jsx("span",{className:"font-body text-xs",children:"Settings"})]})}),l&&e.jsx(A,{side:"right",sideOffset:16,className:"font-bold text-xs",children:"Settings"})]}):null,y&&e.jsx("div",{className:"text-[#5a6578]",children:e.jsx($,{onClick:y,collapsed:a})})]})]})};export{me as default};
 
1
+ import{r as p,j as e}from"./vendor-react-B4AQeu28.js";import{S as N,a as $,L as u,M as D}from"./LogoutActionButton-Dl6IiDHd.js";import{e as G,m as c,k as P,U as S,G as M,a as f,S as U,V as _,z as q}from"./index-uASBzalf.js";import{T as L,a as C,b as z}from"./tooltip-1ASn-3cE.js";import{X as F}from"./x-CBb03rh3.js";import{C as Q}from"./chevron-right-U0AqPOPj.js";import{C as W}from"./chevron-left-CzSo_K0d.js";import{C as A}from"./chart-column-CLoxLorp.js";import{S as V}from"./shirt-DFJQeZbT.js";import"./log-out-Dr0BHRO4.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
5
  * See the LICENSE file in the root directory of this source tree.
6
+ */const X=[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]],J=G("cpu",X),me=({activeTab:b,setActiveTab:E,userRole:x="student",onOpenSettings:g,onLogout:y,sidebarCollapsed:o=!1,setSidebarCollapsed:j,mode:T="desktop",onRequestClose:v,forceCollapsed:i=!1})=>{const[I,m]=p.useState(!1),[k,t]=p.useState(null),n=T==="mobile",r=!i&&I,h=typeof g=="function",a=!n&&(i||o&&!r),l=a,H=!n&&!i;p.useEffect(()=>{i&&(m(!1),t(null))},[i]),p.useEffect(()=>{l||t(null)},[l]);const O=x==="admin"?[{label:"Management",items:[{icon:u,label:"Overview"},{icon:S,label:"User Management"},{icon:M,label:"Subjects"},{icon:f,label:"Content"}]},{label:"Insights",items:[{icon:A,label:"Analytics"},{icon:J,label:"AI Monitoring"},{icon:U,label:"Audit Log"},{icon:N,label:"Settings"}]}]:x==="teacher"?[{label:"Teaching",items:[{icon:u,label:"Dashboard"},{icon:S,label:"My Students"},{icon:f,label:"Classes"}]},{label:"Insights",items:[{icon:A,label:"Analytics"}]}]:[{label:"Learn",items:[{icon:u,label:"Dashboard"},{icon:f,label:"Modules"},{icon:D,label:"AI Chat"}]},{label:"Progress",items:[{icon:M,label:"Grades",displayLabel:"Assessment"},{icon:_,label:"Quiz Battle",displayLabel:"Quiz Battle"},{icon:q,label:"Leaderboard",displayLabel:"Leadership Board"}]},{label:"Customization",items:[{icon:V,label:"Avatar Studio",displayLabel:"Avatar Studio"}]}];return e.jsxs(c.aside,{initial:!1,animate:n?{width:280}:{width:a?80:280},transition:{type:"spring",stiffness:360,damping:34},onMouseEnter:()=>H&&o&&m(!0),onMouseLeave:()=>{m(!1),t(null)},className:P("h-full bg-[#f7f9fc] border border-[#dde3eb] shadow-sm flex flex-col",n?"rounded-2xl p-4":"rounded-3xl p-5"),children:[e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:`mb-8 flex items-center ${a?"justify-center":"justify-between"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:"/mathpulse_logo.png",alt:"MathPulse AI",className:"w-12 h-12 object-contain drop-shadow-md flex-shrink-0"}),(!a||r)&&e.jsx("div",{children:e.jsx("h2",{className:"text-base font-bold font-display text-[#0a1628] whitespace-nowrap",children:"MathPulse AI"})})]}),n&&v&&e.jsx("button",{onClick:v,className:"p-2 hover:bg-[#dde3eb] rounded-lg transition-colors text-[#5a6578]","aria-label":"Close navigation",children:e.jsx(F,{size:20})}),!n&&!i&&j&&(!o||r)&&e.jsx(c.button,{whileHover:{scale:1.1},whileTap:{scale:.95},onClick:()=>j(!o),className:"p-2 hover:bg-[#dde3eb] rounded-lg transition-colors text-[#5a6578]","aria-label":o?"Expand sidebar":"Collapse sidebar",title:o?"Expand sidebar":"Collapse sidebar",children:o?e.jsx(Q,{size:20}):e.jsx(W,{size:20})})]}),e.jsx("nav",{className:"flex-1 min-h-0 overflow-y-auto space-y-5 pr-1",children:O.map((d,B)=>e.jsxs("div",{children:[a?e.jsx("div",{className:"px-4 mb-2 flex items-center gap-2",children:e.jsx("div",{className:"flex-1 h-[1px] bg-[#dde3eb]"})}):d.label&&e.jsx("p",{className:"px-4 mb-2 text-[10px] font-bold text-[#5a6578] uppercase tracking-widest",children:d.label}),e.jsx("div",{className:"space-y-1",children:d.items.map(s=>e.jsxs(L,{open:l&&k===s.label,children:[e.jsx(C,{asChild:!0,children:e.jsxs(c.button,{whileHover:{x:2},whileTap:{scale:.98},onMouseEnter:()=>{l&&t(s.label)},onMouseLeave:()=>{t(w=>w===s.label?null:w)},onFocus:()=>t(null),onClick:()=>E(s.label),className:`w-full flex items-center gap-3 px-4 py-3 rounded-2xl cursor-pointer transition-all duration-200 border whitespace-nowrap ${a?"justify-center":""} ${b===s.label?"bg-sky-50 border-sky-200 shadow-sm text-sky-700":"bg-transparent border-transparent text-[#5a6578] hover:bg-[#dde3eb] hover:border-[#dde3eb] hover:text-[#0a1628]"}`,children:[e.jsx(s.icon,{size:18,strokeWidth:b===s.label?2.5:2,className:"flex-shrink-0"}),(!a||r)&&e.jsx("span",{className:"font-body font-bold text-xs",children:s.displayLabel||s.label}),b===s.label&&(!a||r)&&e.jsx(c.div,{layoutId:"sidebar-active-indicator",className:"ml-auto w-2 h-2 rounded-full bg-sky-500",transition:{type:"spring",duration:.4}})]})}),l&&e.jsx(z,{side:"right",sideOffset:16,className:"font-bold text-xs",children:s.displayLabel||s.label})]},s.label))})]},B))})]}),e.jsxs("div",{className:"mt-4 space-y-2 border-t border-[#dde3eb] pt-4",children:[x!=="admin"?e.jsxs(L,{open:l&&k==="Settings",children:[e.jsx(C,{asChild:!0,children:e.jsxs(c.button,{whileHover:{x:2},whileTap:{scale:.98},onMouseEnter:()=>{l&&t("Settings")},onMouseLeave:()=>{t(d=>d==="Settings"?null:d)},onFocus:()=>t(null),className:`w-full flex items-center gap-3 px-4 py-3 rounded-2xl font-bold border transition-all duration-200 whitespace-nowrap ${a?"justify-center":""} ${b==="Settings"?"bg-sky-50 border-sky-200 text-sky-700 shadow-sm":h?"border-transparent text-[#5a6578] hover:bg-[#dde3eb] hover:border-[#dde3eb] hover:text-[#0a1628]":"border-transparent text-[#a0aec0] cursor-not-allowed opacity-60"}`,onClick:h?g:void 0,disabled:!h,"aria-disabled":!h,"aria-label":"Open settings",children:[e.jsx(N,{size:18,strokeWidth:2,className:"flex-shrink-0"}),(!a||r)&&e.jsx("span",{className:"font-body text-xs",children:"Settings"})]})}),l&&e.jsx(z,{side:"right",sideOffset:16,className:"font-bold text-xs",children:"Settings"})]}):null,y&&e.jsx("div",{className:"text-[#5a6578]",children:e.jsx($,{onClick:y,collapsed:a})})]})]})};export{me as default};
assets/{SupplementalBanner-DFkcXPOZ.js β†’ SupplementalBanner-B_AwC-uH.js} RENAMED
@@ -1 +1 @@
1
- import{j as e,r as j}from"./vendor-react-B4AQeu28.js";import{j as y,m as p,p as h,a as f,T as m,B as x}from"./index-BaOs5Ayg.js";import{X as v}from"./x-TNvtuOD9.js";import{S as w}from"./sparkles-By-vFjpv.js";import{C as g}from"./chevron-right-COqGruhh.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";const b={"General Mathematics":[{label:"Functions Deep Dive",description:"Interactive review of function types and graphs",icon:e.jsx(m,{size:14})},{label:"Business Math Basics",description:"Simple & compound interest practice",icon:e.jsx(f,{size:14})}],"Statistics and Probability":[{label:"Distribution Visualizer",description:"Explore normal distribution curves",icon:e.jsx(m,{size:14})},{label:"Hypothesis Practice",description:"Step-by-step hypothesis testing",icon:e.jsx(x,{size:14})}],"Pre-Calculus":[{label:"Conic Sections Explorer",description:"Visual parabola, ellipse, hyperbola tool",icon:e.jsx(m,{size:14})},{label:"Trig Identity Practice",description:"Identity verification drill set",icon:e.jsx(x,{size:14})}],"Basic Calculus":[{label:"Limits Visualizer",description:"Graphical approach to limits",icon:e.jsx(m,{size:14})},{label:"Derivative Rules Drill",description:"Practice chain rule & implicit diff",icon:e.jsx(x,{size:14})}]};function u(i){const s=i.toLowerCase();return s==="functions"||s.includes("function")||s==="businessmath"||s.includes("business")||s==="logic"||s.includes("reason")||s.includes("general")||s.includes("gen-math")||s.includes("gen math")?"General Mathematics":s.includes("stat")||s.includes("prob")?"Statistics and Probability":s.includes("pre-calc")||s.includes("pre calc")||s.includes("precalc")?"Pre-Calculus":s.includes("basic")||s.includes("calc")?"Basic Calculus":null}function N(i){const s=i.trim().toLowerCase();return s==="functions"?"Functions and Graphs":s==="businessmath"?"Business and Financial Mathematics":s==="logic"?"Logic and Reasoning":i}const k=({atRiskSubjects:i=[],onAction:s,onDismiss:n})=>{const[l,a]=j.useState(!1);if(l||i.length===0)return null;const r=()=>{a(!0),n?.()};return e.jsx(y,{children:!l&&e.jsx(p.div,{initial:{opacity:0,y:-10,height:0},animate:{opacity:1,y:0,height:"auto"},exit:{opacity:0,y:-10,height:0},className:"overflow-hidden",children:e.jsxs("div",{className:"relative bg-gradient-to-r from-sky-600 via-sky-500 to-sky-600 rounded-2xl p-5 text-white shadow-lg shadow-sky-500/20",children:[e.jsx("button",{onClick:r,className:"absolute top-3 right-3 w-7 h-7 bg-white/20 hover:bg-white/30 rounded-full flex items-center justify-center transition-colors",children:e.jsx(v,{size:14})}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-white/20 rounded-xl flex items-center justify-center flex-shrink-0",children:e.jsx(w,{size:24})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-bold text-lg mb-1",children:"Supplemental Materials Available"}),e.jsx("p",{className:"text-sky-100 text-sm mb-3",children:"Based on your diagnostic assessment, we've identified topics that could use extra practice. Strengthening these areas will improve your overall performance."}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:i.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 bg-white/20 backdrop-blur-sm px-3 py-1 rounded-full text-xs font-semibold",children:[e.jsx(h,{size:12}),N(t)]},t))}),e.jsxs("button",{onClick:s,className:"inline-flex items-center gap-2 bg-white text-sky-600 font-bold text-sm px-4 py-2 rounded-xl hover:bg-sky-50 transition-colors",children:["Review Topics",e.jsx(g,{size:16})]})]})]})]})})})},z=({quizSubject:i,atRiskSubjects:s=[]})=>{const n=i?u(i):null;if(!s.some(r=>{const t=u(r);return t&&t===n})||!n)return null;const a=b[n]||[];return e.jsx(p.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"mb-4 overflow-hidden",children:e.jsxs("div",{className:"bg-gradient-to-r from-rose-50 to-orange-50 border border-rose-200 rounded-xl p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx(h,{size:14,className:"text-rose-600"}),e.jsxs("span",{className:"text-xs font-bold text-rose-800",children:["Supplemental Focus Area β€” ",n]})]}),e.jsx("p",{className:"text-xs text-rose-700 mb-2",children:"This topic was flagged in your diagnostic. Take your time and review the explanations carefully."}),a.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.slice(0,2).map((r,t)=>e.jsxs("span",{className:"inline-flex items-center gap-1 bg-rose-100 text-rose-700 px-2 py-0.5 rounded-md text-xs font-medium",children:[r.icon,r.label]},t))})]})})},C=({quizSubject:i,quizScore:s=0,atRiskSubjects:n=[],onAction:l})=>{const a=i?u(i):null,r=n.some(c=>{const d=u(c);return d&&d===a});if(s>=70&&!r)return null;const t=a?b[a]||[]:[],o=s<70;return e.jsx(p.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.5},className:"mt-4",children:e.jsx("div",{className:`rounded-2xl p-4 border-2 ${o?"bg-orange-50 border-orange-200":"bg-sky-50 border-sky-200"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0 ${o?"bg-orange-500":"bg-sky-500"}`,children:e.jsx(f,{size:20,className:"text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-display font-bold text-[#0a1628] text-sm mb-1",children:o?"Review Recommended":"Supplemental Materials"}),e.jsx("p",{className:"text-xs text-[#5a6578] mb-2",children:o?`You scored ${s}% on this quiz. We recommend reviewing the following resources to strengthen your understanding.`:"This topic was identified as an area for growth. Check out these additional resources."}),t.length>0&&e.jsx("div",{className:"space-y-1.5 mb-3",children:t.map((c,d)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:`w-5 h-5 rounded flex items-center justify-center ${o?"bg-orange-100 text-orange-600":"bg-sky-100 text-sky-600"}`,children:c.icon}),e.jsx("span",{className:"font-medium text-[#0a1628]",children:c.label}),e.jsxs("span",{className:"text-slate-500",children:["β€” ",c.description]})]},d))}),l&&e.jsxs("button",{onClick:l,className:`inline-flex items-center gap-1.5 text-xs font-bold px-3 py-1.5 rounded-lg transition-colors ${o?"bg-orange-500 hover:bg-orange-600 text-white":"bg-sky-500 hover:bg-sky-600 text-white"}`,children:["Review Topics",e.jsx(g,{size:12})]})]})]})})})},I=i=>{switch(i.variant){case"compact":return e.jsx(z,{...i});case"results":return e.jsx(C,{...i});case"full":default:return e.jsx(k,{...i})}};export{I as default};
 
1
+ import{j as e,r as y}from"./vendor-react-B4AQeu28.js";import{g as j,m as p,w as h,a as f,T as m,B as x}from"./index-uASBzalf.js";import{X as v}from"./x-CBb03rh3.js";import{S as w}from"./sparkles-DHVr5IP1.js";import{C as g}from"./chevron-right-U0AqPOPj.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";const b={"General Mathematics":[{label:"Functions Deep Dive",description:"Interactive review of function types and graphs",icon:e.jsx(m,{size:14})},{label:"Business Math Basics",description:"Simple & compound interest practice",icon:e.jsx(f,{size:14})}],"Statistics and Probability":[{label:"Distribution Visualizer",description:"Explore normal distribution curves",icon:e.jsx(m,{size:14})},{label:"Hypothesis Practice",description:"Step-by-step hypothesis testing",icon:e.jsx(x,{size:14})}],"Pre-Calculus":[{label:"Conic Sections Explorer",description:"Visual parabola, ellipse, hyperbola tool",icon:e.jsx(m,{size:14})},{label:"Trig Identity Practice",description:"Identity verification drill set",icon:e.jsx(x,{size:14})}],"Basic Calculus":[{label:"Limits Visualizer",description:"Graphical approach to limits",icon:e.jsx(m,{size:14})},{label:"Derivative Rules Drill",description:"Practice chain rule & implicit diff",icon:e.jsx(x,{size:14})}]};function u(i){const s=i.toLowerCase();return s==="functions"||s.includes("function")||s==="businessmath"||s.includes("business")||s==="logic"||s.includes("reason")||s.includes("general")||s.includes("gen-math")||s.includes("gen math")?"General Mathematics":s.includes("stat")||s.includes("prob")?"Statistics and Probability":s.includes("pre-calc")||s.includes("pre calc")||s.includes("precalc")?"Pre-Calculus":s.includes("basic")||s.includes("calc")?"Basic Calculus":null}function N(i){const s=i.trim().toLowerCase();return s==="functions"?"Functions and Graphs":s==="businessmath"?"Business and Financial Mathematics":s==="logic"?"Logic and Reasoning":i}const k=({atRiskSubjects:i=[],onAction:s,onDismiss:n})=>{const[l,a]=y.useState(!1);if(l||i.length===0)return null;const r=()=>{a(!0),n?.()};return e.jsx(j,{children:!l&&e.jsx(p.div,{initial:{opacity:0,y:-10,height:0},animate:{opacity:1,y:0,height:"auto"},exit:{opacity:0,y:-10,height:0},className:"overflow-hidden",children:e.jsxs("div",{className:"relative bg-gradient-to-r from-sky-600 via-sky-500 to-sky-600 rounded-2xl p-5 text-white shadow-lg shadow-sky-500/20",children:[e.jsx("button",{onClick:r,className:"absolute top-3 right-3 w-7 h-7 bg-white/20 hover:bg-white/30 rounded-full flex items-center justify-center transition-colors",children:e.jsx(v,{size:14})}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-white/20 rounded-xl flex items-center justify-center flex-shrink-0",children:e.jsx(w,{size:24})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-bold text-lg mb-1",children:"Supplemental Materials Available"}),e.jsx("p",{className:"text-sky-100 text-sm mb-3",children:"Based on your diagnostic assessment, we've identified topics that could use extra practice. Strengthening these areas will improve your overall performance."}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:i.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 bg-white/20 backdrop-blur-sm px-3 py-1 rounded-full text-xs font-semibold",children:[e.jsx(h,{size:12}),N(t)]},t))}),e.jsxs("button",{onClick:s,className:"inline-flex items-center gap-2 bg-white text-sky-600 font-bold text-sm px-4 py-2 rounded-xl hover:bg-sky-50 transition-colors",children:["Review Topics",e.jsx(g,{size:16})]})]})]})]})})})},z=({quizSubject:i,atRiskSubjects:s=[]})=>{const n=i?u(i):null;if(!s.some(r=>{const t=u(r);return t&&t===n})||!n)return null;const a=b[n]||[];return e.jsx(p.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"mb-4 overflow-hidden",children:e.jsxs("div",{className:"bg-gradient-to-r from-rose-50 to-orange-50 border border-rose-200 rounded-xl p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx(h,{size:14,className:"text-rose-600"}),e.jsxs("span",{className:"text-xs font-bold text-rose-800",children:["Supplemental Focus Area β€” ",n]})]}),e.jsx("p",{className:"text-xs text-rose-700 mb-2",children:"This topic was flagged in your diagnostic. Take your time and review the explanations carefully."}),a.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.slice(0,2).map((r,t)=>e.jsxs("span",{className:"inline-flex items-center gap-1 bg-rose-100 text-rose-700 px-2 py-0.5 rounded-md text-xs font-medium",children:[r.icon,r.label]},t))})]})})},C=({quizSubject:i,quizScore:s=0,atRiskSubjects:n=[],onAction:l})=>{const a=i?u(i):null,r=n.some(c=>{const d=u(c);return d&&d===a});if(s>=70&&!r)return null;const t=a?b[a]||[]:[],o=s<70;return e.jsx(p.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.5},className:"mt-4",children:e.jsx("div",{className:`rounded-2xl p-4 border-2 ${o?"bg-orange-50 border-orange-200":"bg-sky-50 border-sky-200"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0 ${o?"bg-orange-500":"bg-sky-500"}`,children:e.jsx(f,{size:20,className:"text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-display font-bold text-[#0a1628] text-sm mb-1",children:o?"Review Recommended":"Supplemental Materials"}),e.jsx("p",{className:"text-xs text-[#5a6578] mb-2",children:o?`You scored ${s}% on this quiz. We recommend reviewing the following resources to strengthen your understanding.`:"This topic was identified as an area for growth. Check out these additional resources."}),t.length>0&&e.jsx("div",{className:"space-y-1.5 mb-3",children:t.map((c,d)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:`w-5 h-5 rounded flex items-center justify-center ${o?"bg-orange-100 text-orange-600":"bg-sky-100 text-sky-600"}`,children:c.icon}),e.jsx("span",{className:"font-medium text-[#0a1628]",children:c.label}),e.jsxs("span",{className:"text-slate-500",children:["β€” ",c.description]})]},d))}),l&&e.jsxs("button",{onClick:l,className:`inline-flex items-center gap-1.5 text-xs font-bold px-3 py-1.5 rounded-lg transition-colors ${o?"bg-orange-500 hover:bg-orange-600 text-white":"bg-sky-500 hover:bg-sky-600 text-white"}`,children:["Review Topics",e.jsx(g,{size:12})]})]})]})})})},I=i=>{switch(i.variant){case"compact":return e.jsx(z,{...i});case"results":return e.jsx(C,{...i});case"full":default:return e.jsx(k,{...i})}};export{I as default};
assets/{SupplementalPillCarousel-BqNTelmK.js β†’ SupplementalPillCarousel-dQl-2GJp.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{r as a,j as e}from"./vendor-react-B4AQeu28.js";import{m as f,p as x}from"./index-BaOs5Ayg.js";import{C as n}from"./chevron-right-COqGruhh.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";const o={pillBg:"#E9D5FF",pillText:"#6B21A8",headerText:"#1F2937",arrowBg:"#F3F4F6"},b={functions:"Functions & Graphs",businessmath:"Business Math",logic:"Logic & Reasoning",statistics:"Statistics",probability:"Probability",precalc:"Pre-Calculus",calculus:"Basic Calculus",geometry:"Geometry",trigonometry:"Trigonometry",algebra:"Algebra"};function g(t){const s=t.toLowerCase().trim();return b[s]||t.split(/[-_]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join(" ")}const L=({atRiskSubjects:t=[],onTopicClick:s})=>{const l=a.useRef(null),[c,m]=a.useState(!1);if(t.length===0)return null;const h=()=>{if(l.current){const{scrollLeft:r,scrollWidth:i,clientWidth:d}=l.current;m(r+d<i-10)}},p=r=>{s?.(r)},u=()=>{l.current&&l.current.scrollBy({left:200,behavior:"smooth"})};return e.jsxs(f.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},className:"mb-4",children:[e.jsx("h3",{className:"text-base font-bold mb-3",style:{color:o.headerText},children:"Recommended for Review"}),e.jsxs("div",{className:"relative flex items-center",children:[e.jsx("div",{ref:l,onScroll:h,className:"flex gap-2 overflow-x-auto scrollbar-hide pb-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t.slice(0,8).map((r,i)=>e.jsxs("button",{onClick:()=>p(r),className:"flex items-center gap-1.5 px-4 py-2 rounded-full text-sm font-semibold transition-all hover:scale-[1.02] whitespace-nowrap",style:{backgroundColor:o.pillBg,color:o.pillText},children:[e.jsx(x,{size:14}),g(r),e.jsx(n,{size:14})]},`${r}-${i}`))}),c&&e.jsx("button",{onClick:u,className:"flex-shrink-0 ml-2 w-8 h-8 rounded-full flex items-center justify-center transition-colors",style:{backgroundColor:o.arrowBg},"aria-label":"Scroll right",children:e.jsx(n,{size:16,className:"text-gray-600"})})]}),e.jsx("style",{children:`
2
  .scrollbar-hide::-webkit-scrollbar {
3
  display: none;
4
  }
 
1
+ import{r as a,j as e}from"./vendor-react-B4AQeu28.js";import{m as f,w as x}from"./index-uASBzalf.js";import{C as n}from"./chevron-right-U0AqPOPj.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";const o={pillBg:"#E9D5FF",pillText:"#6B21A8",headerText:"#1F2937",arrowBg:"#F3F4F6"},b={functions:"Functions & Graphs",businessmath:"Business Math",logic:"Logic & Reasoning",statistics:"Statistics",probability:"Probability",precalc:"Pre-Calculus",calculus:"Basic Calculus",geometry:"Geometry",trigonometry:"Trigonometry",algebra:"Algebra"};function g(t){const s=t.toLowerCase().trim();return b[s]||t.split(/[-_]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join(" ")}const L=({atRiskSubjects:t=[],onTopicClick:s})=>{const l=a.useRef(null),[c,m]=a.useState(!1);if(t.length===0)return null;const h=()=>{if(l.current){const{scrollLeft:r,scrollWidth:i,clientWidth:d}=l.current;m(r+d<i-10)}},p=r=>{s?.(r)},u=()=>{l.current&&l.current.scrollBy({left:200,behavior:"smooth"})};return e.jsxs(f.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},className:"mb-4",children:[e.jsx("h3",{className:"text-base font-bold mb-3",style:{color:o.headerText},children:"Recommended for Review"}),e.jsxs("div",{className:"relative flex items-center",children:[e.jsx("div",{ref:l,onScroll:h,className:"flex gap-2 overflow-x-auto scrollbar-hide pb-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t.slice(0,8).map((r,i)=>e.jsxs("button",{onClick:()=>p(r),className:"flex items-center gap-1.5 px-4 py-2 rounded-full text-sm font-semibold transition-all hover:scale-[1.02] whitespace-nowrap",style:{backgroundColor:o.pillBg,color:o.pillText},children:[e.jsx(x,{size:14}),g(r),e.jsx(n,{size:14})]},`${r}-${i}`))}),c&&e.jsx("button",{onClick:u,className:"flex-shrink-0 ml-2 w-8 h-8 rounded-full flex items-center justify-center transition-colors",style:{backgroundColor:o.arrowBg},"aria-label":"Scroll right",children:e.jsx(n,{size:16,className:"text-gray-600"})})]}),e.jsx("style",{children:`
2
  .scrollbar-hide::-webkit-scrollbar {
3
  display: none;
4
  }
assets/TeacherDashboard-BmaSDmQs.js ADDED
The diff for this file is too large to render. See raw diff
 
assets/TeacherDashboard-CZdYfdg9.js DELETED
The diff for this file is too large to render. See raw diff
 
assets/{XPNotification-DRsFdUWw.js β†’ XPNotification-CsIvt8Wa.js} RENAMED
@@ -1 +1 @@
1
- import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{j as n,m as i,X as m}from"./index-BaOs5Ayg.js";import{S as c}from"./sparkles-By-vFjpv.js";import"./vendor-firebase-firestore-CH1lNiRF.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";const b=({xp:r,message:a,show:t,onComplete:s})=>(l.useEffect(()=>{if(t){const o=setTimeout(()=>{s()},3e3);return()=>clearTimeout(o)}},[t,s]),e.jsx(n,{children:t&&e.jsx(i.div,{initial:{opacity:0,y:-50,scale:.8},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-20,scale:.9},transition:{type:"spring",damping:25,stiffness:200},className:"fixed top-8 left-1/2 -translate-x-1/2 z-50",style:{willChange:"transform, opacity"},children:e.jsxs("div",{className:"bg-gradient-to-r from-rose-400 via-orange-500 to-rose-500 text-white px-6 py-4 rounded-2xl shadow-2xl border-2 border-rose-300 flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-10 h-10 bg-white/20 rounded-xl flex items-center justify-center",children:e.jsx(m,{size:20,className:"text-white",fill:"currentColor"})}),e.jsx(i.div,{className:"absolute -top-1 -right-1",animate:{rotate:[0,360]},transition:{duration:2,repeat:1/0,ease:"linear"},style:{willChange:"transform"},children:e.jsx(c,{size:16,className:"text-rose-200"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold",children:a}),e.jsxs("p",{className:"text-2xl font-black",children:["+",r," XP"]})]})]})})}));export{b as default};
 
1
+ import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{g as n,m as i,$ as m}from"./index-uASBzalf.js";import{S as c}from"./sparkles-DHVr5IP1.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";const b=({xp:r,message:a,show:t,onComplete:s})=>(l.useEffect(()=>{if(t){const o=setTimeout(()=>{s()},3e3);return()=>clearTimeout(o)}},[t,s]),e.jsx(n,{children:t&&e.jsx(i.div,{initial:{opacity:0,y:-50,scale:.8},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-20,scale:.9},transition:{type:"spring",damping:25,stiffness:200},className:"fixed top-8 left-1/2 -translate-x-1/2 z-50",style:{willChange:"transform, opacity"},children:e.jsxs("div",{className:"bg-gradient-to-r from-rose-400 via-orange-500 to-rose-500 text-white px-6 py-4 rounded-2xl shadow-2xl border-2 border-rose-300 flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-10 h-10 bg-white/20 rounded-xl flex items-center justify-center",children:e.jsx(m,{size:20,className:"text-white",fill:"currentColor"})}),e.jsx(i.div,{className:"absolute -top-1 -right-1",animate:{rotate:[0,360]},transition:{duration:2,repeat:1/0,ease:"linear"},style:{willChange:"transform"},children:e.jsx(c,{size:16,className:"text-rose-200"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold",children:a}),e.jsxs("p",{className:"text-2xl font-black",children:["+",r," XP"]})]})]})})}));export{b as default};
assets/{automationService-7m3RFJA3.js β†’ automationService-rXKxA-Jx.js} RENAMED
@@ -1 +1 @@
1
- import{doc as g,collection as a,serverTimestamp as c,setDoc as l,addDoc as D,query as z,where as b,getDocs as A,updateDoc as C,writeBatch as Q}from"./vendor-firebase-firestore-CH1lNiRF.js";import{f as r,a$ as $}from"./index-BaOs5Ayg.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-react-B4AQeu28.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";const m=async(e,n,o,u,i)=>{try{const t=g(a(r,"notifications")),s={id:t.id,userId:e,type:n,title:o,message:u,read:!1,...i?{actionUrl:i}:{},createdAt:new Date},d={id:s.id,userId:s.userId,type:s.type,title:s.title,message:s.message,read:s.read,createdAt:c(),link:i||null};return await l(t,{...d}),s}catch(t){throw console.error("Error creating notification:",t),t}};async function E(e){if(!e)return 0;const n=a(r,"deepDiagnosticAssignments"),o=z(n,b("lrn","==",e));return(await A(o)).docs.filter(i=>{const t=i.data().status;return t==="pending"||t==="queued"||t==="in_progress"||t==="expired"}).length}async function M(e,n,o="Grade 11",u,i="iar_only",t="initial_assessment"){if(t==="followup_diagnostic"){const s=a(r,"deepDiagnosticAssignments"),d=z(s,b("lrn","==",e)),f=await A(d);if(!f.empty){const p=Q(r);let w=!1;for(const h of f.docs){const I=h.data().status;(I==="pending"||I==="queued")&&(p.update(h.ref,{status:"in_progress",startedAt:c()}),w=!0)}w&&await p.commit()}}return await l(g(r,"diagnosticResults",e),{lrn:e,results:n,gradeLevel:o,workflowMode:i,assessmentType:t,questionBreakdown:u||null,completedAt:c(),processed:!1,processing:!1}),{success:!0,event:"diagnostic_completed",lrn:e,message:`Diagnostic submitted for ${e}. Processing will begin automatically.`,remedialQuizzesCreated:0,notifications:["Your diagnostic results are being processed. Check back shortly!"]}}async function x(e){return await D(a(r,"quizResults"),{lrn:e.lrn,studentId:e.lrn,quizId:e.quizId,subject:e.subject,score:e.score,totalQuestions:e.totalQuestions,correctAnswers:e.correctAnswers,timeSpentSeconds:e.timeSpentSeconds,answers:e.answers||null,submittedAt:c()}),{success:!0,event:"quiz_submitted",lrn:e.lrn,message:`Quiz submitted for ${e.lrn}. Risk recalculation will run automatically.`,remedialQuizzesCreated:0,notifications:[`Quiz result recorded for ${e.subject}.`]}}async function N(e){return await $(e.lrn),await m(e.lrn,"reminder","Welcome to MathPulse AI!","Complete your diagnostic assessment to get started with personalised learning."),e.teacherId&&await m(e.teacherId,"message","New Student Enrolled",`${e.name} has joined. Diagnostic assessment is pending.`),{success:!0,event:"student_enrolled",lrn:e.lrn,message:`Student ${e.name} enrolled and initialised`,remedialQuizzesCreated:0,notifications:[`Welcome ${e.name}! Please complete the diagnostic assessment.`]}}async function W(e){return await D(a(r,"dataImports"),{teacherId:e.teacherId,studentCount:e.students.length,columnMapping:e.columnMapping,importedAt:c(),processed:!1}),await m(e.teacherId,"message","Data Import Processed",`Data import complete β€” ${e.students.length} student records processed.`),{success:!0,event:"data_imported",message:`Data import processed for ${e.students.length} students`,remedialQuizzesCreated:0,notifications:[`Data import complete β€” ${e.students.length} student records processed.`]}}async function G(e){const n=g(r,"curriculumContent",e.contentId);return e.action==="delete"?await C(n,{deleted:!0,deletedBy:e.adminId,deletedAt:c(),contentType:e.contentType,subjectId:e.subjectId||null}):await l(n,{contentType:e.contentType,subjectId:e.subjectId||null,details:e.details||null,updatedBy:e.adminId,action:e.action,updatedAt:c()},{merge:!0}),{success:!0,event:"content_updated",message:`Content ${e.action} processed for ${e.contentType}`,remedialQuizzesCreated:0,notifications:[]}}export{E as getPendingDeepDiagnosticCount,G as triggerContentUpdated,W as triggerDataImported,M as triggerDiagnosticCompleted,x as triggerQuizSubmitted,N as triggerStudentEnrolled};
 
1
+ import{doc as g,collection as a,serverTimestamp as c,setDoc as l,addDoc as D,query as b,where as z,getDocs as A,updateDoc as C,writeBatch as Q}from"./vendor-firebase-firestore-CP9q7ISf.js";import{h as r,b0 as $}from"./index-uASBzalf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-react-B4AQeu28.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";const m=async(e,n,o,u,i)=>{try{const t=g(a(r,"notifications")),s={id:t.id,userId:e,type:n,title:o,message:u,read:!1,...i?{actionUrl:i}:{},createdAt:new Date},d={id:s.id,userId:s.userId,type:s.type,title:s.title,message:s.message,read:s.read,createdAt:c(),link:i||null};return await l(t,{...d}),s}catch(t){throw console.error("Error creating notification:",t),t}};async function E(e){if(!e)return 0;const n=a(r,"deepDiagnosticAssignments"),o=b(n,z("lrn","==",e));return(await A(o)).docs.filter(i=>{const t=i.data().status;return t==="pending"||t==="queued"||t==="in_progress"||t==="expired"}).length}async function M(e,n,o="Grade 11",u,i="iar_only",t="initial_assessment"){if(t==="followup_diagnostic"){const s=a(r,"deepDiagnosticAssignments"),d=b(s,z("lrn","==",e)),f=await A(d);if(!f.empty){const p=Q(r);let w=!1;for(const h of f.docs){const I=h.data().status;(I==="pending"||I==="queued")&&(p.update(h.ref,{status:"in_progress",startedAt:c()}),w=!0)}w&&await p.commit()}}return await l(g(r,"diagnosticResults",e),{lrn:e,results:n,gradeLevel:o,workflowMode:i,assessmentType:t,questionBreakdown:u||null,completedAt:c(),processed:!1,processing:!1}),{success:!0,event:"diagnostic_completed",lrn:e,message:`Diagnostic submitted for ${e}. Processing will begin automatically.`,remedialQuizzesCreated:0,notifications:["Your diagnostic results are being processed. Check back shortly!"]}}async function x(e){return await D(a(r,"quizResults"),{lrn:e.lrn,studentId:e.lrn,quizId:e.quizId,subject:e.subject,score:e.score,totalQuestions:e.totalQuestions,correctAnswers:e.correctAnswers,timeSpentSeconds:e.timeSpentSeconds,answers:e.answers||null,submittedAt:c()}),{success:!0,event:"quiz_submitted",lrn:e.lrn,message:`Quiz submitted for ${e.lrn}. Risk recalculation will run automatically.`,remedialQuizzesCreated:0,notifications:[`Quiz result recorded for ${e.subject}.`]}}async function N(e){return await $(e.lrn),await m(e.lrn,"reminder","Welcome to MathPulse AI!","Complete your diagnostic assessment to get started with personalised learning."),e.teacherId&&await m(e.teacherId,"message","New Student Enrolled",`${e.name} has joined. Diagnostic assessment is pending.`),{success:!0,event:"student_enrolled",lrn:e.lrn,message:`Student ${e.name} enrolled and initialised`,remedialQuizzesCreated:0,notifications:[`Welcome ${e.name}! Please complete the diagnostic assessment.`]}}async function W(e){return await D(a(r,"dataImports"),{teacherId:e.teacherId,studentCount:e.students.length,columnMapping:e.columnMapping,importedAt:c(),processed:!1}),await m(e.teacherId,"message","Data Import Processed",`Data import complete β€” ${e.students.length} student records processed.`),{success:!0,event:"data_imported",message:`Data import processed for ${e.students.length} students`,remedialQuizzesCreated:0,notifications:[`Data import complete β€” ${e.students.length} student records processed.`]}}async function G(e){const n=g(r,"curriculumContent",e.contentId);return e.action==="delete"?await C(n,{deleted:!0,deletedBy:e.adminId,deletedAt:c(),contentType:e.contentType,subjectId:e.subjectId||null}):await l(n,{contentType:e.contentType,subjectId:e.subjectId||null,details:e.details||null,updatedBy:e.adminId,action:e.action,updatedAt:c()},{merge:!0}),{success:!0,event:"content_updated",message:`Content ${e.action} processed for ${e.contentType}`,remedialQuizzesCreated:0,notifications:[]}}export{E as getPendingDeepDiagnosticCount,G as triggerContentUpdated,W as triggerDataImported,M as triggerDiagnosticCompleted,x as triggerQuizSubmitted,N as triggerStudentEnrolled};
assets/{bell-clcSMJn6.js β†’ bell-CiUaN6S3.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{button-DCfeFHoH.js β†’ button-BPmLcOpC.js} RENAMED
@@ -1 +1 @@
1
- import{j as y}from"./vendor-react-B4AQeu28.js";import{S as k}from"./vendor-radix-BorKzPz9.js";import{c as V}from"./vendor-charts-D8hf8tI0.js";import{i as p}from"./index-BaOs5Ayg.js";const g=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,m=V,j=(n,r)=>e=>{var o;if(r?.variants==null)return m(n,e?.class,e?.className);const{variants:u,defaultVariants:i}=r,b=Object.keys(u).map(t=>{const a=e?.[t],d=i?.[t];if(a===null)return null;const s=g(a)||g(d);return u[t][s]}),v=e&&Object.entries(e).reduce((t,a)=>{let[d,s]=a;return s===void 0||(t[d]=s),t},{}),f=r==null||(o=r.compoundVariants)===null||o===void 0?void 0:o.reduce((t,a)=>{let{class:d,className:s,...h}=a;return Object.entries(h).every(x=>{let[c,l]=x;return Array.isArray(l)?l.includes({...i,...v}[c]):{...i,...v}[c]===l})?[...t,d,s]:t},[]);return m(n,b,f,e?.class,e?.className)},N=j("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9 rounded-md"}},defaultVariants:{variant:"default",size:"default"}});function w({className:n,variant:r,size:e,asChild:o=!1,...u}){const i=o?k:"button";return y.jsx(i,{"data-slot":"button",className:p(N({variant:r,size:e,className:n})),...u})}export{w as B,j as c};
 
1
+ import{j as y}from"./vendor-react-B4AQeu28.js";import{S as k}from"./vendor-radix-xDOIcVzp.js";import{c as V}from"./vendor-charts-Ckgeb0nY.js";import{k as p}from"./index-uASBzalf.js";const g=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,m=V,j=(n,r)=>e=>{var o;if(r?.variants==null)return m(n,e?.class,e?.className);const{variants:u,defaultVariants:i}=r,b=Object.keys(u).map(t=>{const a=e?.[t],d=i?.[t];if(a===null)return null;const s=g(a)||g(d);return u[t][s]}),v=e&&Object.entries(e).reduce((t,a)=>{let[d,s]=a;return s===void 0||(t[d]=s),t},{}),f=r==null||(o=r.compoundVariants)===null||o===void 0?void 0:o.reduce((t,a)=>{let{class:d,className:s,...h}=a;return Object.entries(h).every(x=>{let[c,l]=x;return Array.isArray(l)?l.includes({...i,...v}[c]):{...i,...v}[c]===l})?[...t,d,s]:t},[]);return m(n,b,f,e?.class,e?.className)},N=j("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9 rounded-md"}},defaultVariants:{variant:"default",size:"default"}});function w({className:n,variant:r,size:e,asChild:o=!1,...u}){const i=o?k:"button";return y.jsx(i,{"data-slot":"button",className:p(N({variant:r,size:e,className:n})),...u})}export{w as B,j as c};
assets/card-D4dmQVNb.js DELETED
@@ -1,6 +0,0 @@
1
- import{e as o,i as r}from"./index-BaOs5Ayg.js";import{j as e}from"./vendor-react-B4AQeu28.js";/**
2
- * @license lucide-react v0.487.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const d=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],n=o("copy",d);function i({className:a,...t}){return e.jsx("div",{"data-slot":"card",className:r("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border",a),...t})}function l({className:a,...t}){return e.jsx("div",{"data-slot":"card-header",className:r("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 pt-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...t})}function u({className:a,...t}){return e.jsx("h4",{"data-slot":"card-title",className:r("leading-none",a),...t})}function x({className:a,...t}){return e.jsx("p",{"data-slot":"card-description",className:r("text-muted-foreground",a),...t})}function p({className:a,...t}){return e.jsx("div",{"data-slot":"card-content",className:r("px-6 [&:last-child]:pb-6",a),...t})}export{n as C,i as a,l as b,u as c,p as d,x as e};
 
 
 
 
 
 
 
assets/{chart-column-B3jJOD5i.js β†’ chart-column-CLoxLorp.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e as t}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e as t}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{chatService-DwVkLoat.js β†’ chatService-DL-kTPZE.js} RENAMED
@@ -1 +1 @@
1
- import{doc as c,collection as u,getDoc as g,serverTimestamp as i,setDoc as w,updateDoc as p,query as l,where as d,orderBy as y,getDocs as A}from"./vendor-firebase-firestore-CH1lNiRF.js";import{f as a}from"./index-BaOs5Ayg.js";import"./vendor-firebase-core-CO26nNq6.js";import"./vendor-react-B4AQeu28.js";import"./vendor-firebase-auth-BLpRW_zO.js";import"./vendor-firebase-storage-B3igpVVS.js";import"./vendor-firebase-analytics-CTiUNb0-.js";import"./vendor-radix-BorKzPz9.js";import"./vendor-charts-D8hf8tI0.js";import"./vendor-markdown-yqZQ_iQm.js";const Q=async(s,t="New Conversation")=>{try{const e=c(u(a,"chatSessions")),n={id:e.id,userId:s,title:t,messages:[],createdAt:new Date,updatedAt:new Date,isActive:!0};return await w(e,{...n,createdAt:i(),updatedAt:i()}),n}catch(e){throw console.error("Error creating chat session:",e),e}},R=async s=>{try{const t=l(u(a,"chatSessions"),d("userId","==",s),d("isActive","==",!0),y("updatedAt","desc"));return(await A(t)).docs.map(n=>{const r=n.data();return{...r,createdAt:r.createdAt?.toDate()||new Date,updatedAt:r.updatedAt?.toDate()||new Date}})}catch(t){return console.error("Error getting chat sessions:",t),[]}},b=async s=>{try{const t=await g(c(a,"chatSessions",s));if(t.exists()){const e=t.data();return{...e,createdAt:e.createdAt?.toDate()||new Date,updatedAt:e.updatedAt?.toDate()||new Date}}return null}catch(t){return console.error("Error getting chat session:",t),null}},q=async(s,t,e,n)=>{try{const r=c(u(a,"chatMessages")),o={id:r.id,userId:"",role:t,content:e,timestamp:new Date,...n?{context:n}:{}},m=await g(c(a,"chatSessions",s));m.exists()&&(o.userId=m.data().userId);const h={id:o.id,userId:o.userId,role:o.role,content:o.content,sessionId:s,timestamp:i()};return o.context&&(h.context=o.context),await w(r,h),await p(c(a,"chatSessions",s),{updatedAt:i()}),o}catch(r){throw console.error("Error adding message:",r),r}},B=async(s,t)=>{try{const e=l(u(a,"chatMessages"),d("sessionId","==",s),d("userId","==",t),y("timestamp","asc"));return(await A(e)).docs.map(r=>{const o=r.data();return{...o,timestamp:o.timestamp?.toDate()||new Date}})}catch(e){return console.error("Error getting session messages:",e),[]}},N=async(s,t)=>{try{await p(c(a,"chatSessions",s),{title:t,updatedAt:i()})}catch(e){throw console.error("Error updating session title:",e),e}},U=async s=>{try{await p(c(a,"chatSessions",s),{isActive:!1,updatedAt:i()})}catch(t){throw console.error("Error deleting session:",t),t}};export{q as addMessageToSession,Q as createChatSession,U as deleteSession,b as getChatSession,B as getSessionMessages,R as getUserChatSessions,N as updateSessionTitle};
 
1
+ import{doc as c,collection as u,getDoc as g,serverTimestamp as i,setDoc as w,updateDoc as p,query as l,where as d,orderBy as y,getDocs as A}from"./vendor-firebase-firestore-CP9q7ISf.js";import{h as a}from"./index-uASBzalf.js";import"./vendor-firebase-core-DCQrgkxC.js";import"./vendor-react-B4AQeu28.js";import"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-storage-dc5X5yTv.js";import"./vendor-firebase-analytics-CHPyhRzk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./vendor-markdown-yqZQ_iQm.js";const Q=async(s,t="New Conversation")=>{try{const e=c(u(a,"chatSessions")),n={id:e.id,userId:s,title:t,messages:[],createdAt:new Date,updatedAt:new Date,isActive:!0};return await w(e,{...n,createdAt:i(),updatedAt:i()}),n}catch(e){throw console.error("Error creating chat session:",e),e}},R=async s=>{try{const t=l(u(a,"chatSessions"),d("userId","==",s),d("isActive","==",!0),y("updatedAt","desc"));return(await A(t)).docs.map(n=>{const r=n.data();return{...r,createdAt:r.createdAt?.toDate()||new Date,updatedAt:r.updatedAt?.toDate()||new Date}})}catch(t){return console.error("Error getting chat sessions:",t),[]}},b=async s=>{try{const t=await g(c(a,"chatSessions",s));if(t.exists()){const e=t.data();return{...e,createdAt:e.createdAt?.toDate()||new Date,updatedAt:e.updatedAt?.toDate()||new Date}}return null}catch(t){return console.error("Error getting chat session:",t),null}},q=async(s,t,e,n)=>{try{const r=c(u(a,"chatMessages")),o={id:r.id,userId:"",role:t,content:e,timestamp:new Date,...n?{context:n}:{}},h=await g(c(a,"chatSessions",s));h.exists()&&(o.userId=h.data().userId);const m={id:o.id,userId:o.userId,role:o.role,content:o.content,sessionId:s,timestamp:i()};return o.context&&(m.context=o.context),await w(r,m),await p(c(a,"chatSessions",s),{updatedAt:i()}),o}catch(r){throw console.error("Error adding message:",r),r}},B=async(s,t)=>{try{const e=l(u(a,"chatMessages"),d("sessionId","==",s),d("userId","==",t),y("timestamp","asc"));return(await A(e)).docs.map(r=>{const o=r.data();return{...o,timestamp:o.timestamp?.toDate()||new Date}})}catch(e){return console.error("Error getting session messages:",e),[]}},N=async(s,t)=>{try{await p(c(a,"chatSessions",s),{title:t,updatedAt:i()})}catch(e){throw console.error("Error updating session title:",e),e}},U=async s=>{try{await p(c(a,"chatSessions",s),{isActive:!1,updatedAt:i()})}catch(t){throw console.error("Error deleting session:",t),t}};export{q as addMessageToSession,Q as createChatSession,U as deleteSession,b as getChatSession,B as getSessionMessages,R as getUserChatSessions,N as updateSessionTitle};
assets/{check-BLSo9L0H.js β†’ check-Dk6iwDFI.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e as c}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e as c}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{check-check-B_HghS1Z.js β†’ check-check-DFG24Nyg.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{chevron-left-BWpgclqc.js β†’ chevron-left-CzSo_K0d.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{chevron-right-COqGruhh.js β†’ chevron-right-U0AqPOPj.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e as o}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e as o}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{chevron-up-Cdvz2TMJ.js β†’ chevron-up-BpMhRyJp.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e as o}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
@@ -8,4 +8,4 @@ import{e as o}from"./index-BaOs5Ayg.js";/**
8
  *
9
  * This source code is licensed under the ISC license.
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const e=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],t=o("chevron-up",e);export{t as C,r as a};
 
1
+ import{e as o}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
8
  *
9
  * This source code is licensed under the ISC license.
10
  * See the LICENSE file in the root directory of this source tree.
11
+ */const e=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],t=o("chevron-up",e);export{r as C,t as a};
assets/{circle-alert-CP9K3300.js β†’ circle-alert-DDOZHhZK.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{circle-check-C0FPGTrp.js β†’ circle-check-C5Psopk3.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e as c}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e as c}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{circle-check-big-m1SvzGFL.js β†’ circle-check-big-BNRlH5pv.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e as c}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e as c}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{circle-help-B8apTIdU.js β†’ circle-help-PS1uII8x.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e as c}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e as c}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{clipboard-check-DqBu2Pqb.js β†’ clipboard-check-RuPght2T.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{clock-D1Ecvltm.js β†’ clock-8t0UYgg3.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{e as c}from"./index-BaOs5Ayg.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
 
1
+ import{e as c}from"./index-uASBzalf.js";/**
2
  * @license lucide-react v0.487.0 - ISC
3
  *
4
  * This source code is licensed under the ISC license.
assets/{diagnosticService-BDYTUoqk.js β†’ diagnosticService-DacNtsbN.js} RENAMED
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BaOs5Ayg.js","assets/vendor-react-B4AQeu28.js","assets/vendor-firebase-firestore-CH1lNiRF.js","assets/vendor-firebase-core-CO26nNq6.js","assets/vendor-firebase-auth-BLpRW_zO.js","assets/vendor-firebase-storage-B3igpVVS.js","assets/vendor-firebase-analytics-CTiUNb0-.js","assets/vendor-radix-BorKzPz9.js","assets/vendor-charts-D8hf8tI0.js","assets/vendor-markdown-yqZQ_iQm.js","assets/vendor-markdown-CfVKi3_s.css","assets/index-DdX2rVyy.css"])))=>i.map(i=>d[i]);
2
- import{_ as w}from"./index-BaOs5Ayg.js";const y="https://deign86-mathpulse-api-v3test.hf.space";async function P(g,h){const f=`${y}/api/diagnostic/generate`,{auth:i}=await w(async()=>{const{auth:e}=await import("./index-BaOs5Ayg.js").then(a=>a.b1);return{auth:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),c=i.currentUser,l=async()=>{const e=new Headers({"Content-Type":"application/json"});if(c){const a=await c.getIdToken(!1);a&&e.set("Authorization",`Bearer ${a}`)}return e},u=async e=>fetch(f,{method:"POST",headers:await l(),body:JSON.stringify({strand:g,grade_level:h}),signal:e}),d=(e,a)=>{let t="Something went wrong. Please try again.";try{const s=JSON.parse(a);if(s.detail){const o=String(s.detail);o.includes("Database unavailable")||o.includes("unavailable")?t="Our servers are temporarily busy. Please try again in a moment.":o.includes("timeout")||o.includes("timed out")?t="The request timed out. Please check your connection and try again.":t=o}}catch{!e.ok&&a&&(t="Failed to start assessment. Please try again.")}return t},n=2,r=3e4;for(let e=1;e<=n;e++){const a=new AbortController,t=setTimeout(()=>a.abort(),r);try{const s=await u(a.signal);if(s.ok)return clearTimeout(t),s.json();if(s.status>=400&&s.status<500){clearTimeout(t);const m=await s.text().catch(()=>"");throw new Error(d(s,m))}const o=await s.text().catch(()=>""),p=d(s,o);if(clearTimeout(t),e<n){const m=e*2e3;console.warn(`[generateDiagnostic] attempt ${e} failed (${s.status}), retrying in ${m}ms...`),await new Promise(T=>setTimeout(T,m));continue}throw new Error(p)}catch(s){if(clearTimeout(t),s instanceof DOMException&&s.name==="AbortError"){if(e<n){console.warn(`[generateDiagnostic] attempt ${e} timed out, retrying...`);continue}throw new Error("The request timed out. Please check your connection and try again.")}throw s}}throw new Error("Failed to generate assessment after multiple attempts.")}async function _(g,h){const f=`${y}/api/diagnostic/submit`,i=new Headers({"Content-Type":"application/json"}),{auth:c}=await w(async()=>{const{auth:n}=await import("./index-BaOs5Ayg.js").then(r=>r.b1);return{auth:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),l=c.currentUser;if(l){const n=await l.getIdToken(!1);n&&i.set("Authorization",`Bearer ${n}`)}const u=new AbortController,d=setTimeout(()=>u.abort(),6e4);try{const n=await fetch(f,{method:"POST",headers:i,body:JSON.stringify({test_id:g,responses:h}),signal:u.signal});if(!n.ok){const r=await n.text().catch(()=>"");let e="Something went wrong. Please try again.";try{const a=JSON.parse(r);if(a.detail){const t=String(a.detail);t.includes("session")||t.includes("not found")?e="Your assessment session has expired. Please restart the assessment.":t.includes("Database unavailable")||t.includes("unavailable")?e="Our servers are temporarily busy. Please try again in a moment.":t.includes("timeout")||t.includes("timed out")?e="The request timed out. Please check your connection and try again.":e=t}}catch{r.includes("404")||r.includes("not found")?e="Your assessment session has expired. Please restart the assessment.":r&&(e="Something went wrong. Please try again.")}throw new Error(e)}return n.json()}finally{clearTimeout(d)}}export{P as g,_ as s};
 
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-uASBzalf.js","assets/vendor-react-B4AQeu28.js","assets/vendor-firebase-firestore-CP9q7ISf.js","assets/vendor-firebase-core-DCQrgkxC.js","assets/vendor-firebase-auth-Bcpr4O6E.js","assets/vendor-firebase-storage-dc5X5yTv.js","assets/vendor-firebase-analytics-CHPyhRzk.js","assets/vendor-radix-xDOIcVzp.js","assets/vendor-charts-Ckgeb0nY.js","assets/vendor-markdown-yqZQ_iQm.js","assets/vendor-markdown-CfVKi3_s.css","assets/index-D9pRNq5G.css"])))=>i.map(i=>d[i]);
2
+ import{_ as w}from"./index-uASBzalf.js";const y="https://deign86-mathpulse-api-v3test.hf.space";async function P(g,h){const f=`${y}/api/diagnostic/generate`,{auth:i}=await w(async()=>{const{auth:e}=await import("./index-uASBzalf.js").then(a=>a.b2);return{auth:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),c=i.currentUser,l=async()=>{const e=new Headers({"Content-Type":"application/json"});if(c){const a=await c.getIdToken(!1);a&&e.set("Authorization",`Bearer ${a}`)}return e},u=async e=>fetch(f,{method:"POST",headers:await l(),body:JSON.stringify({strand:g,grade_level:h}),signal:e}),d=(e,a)=>{let t="Something went wrong. Please try again.";try{const s=JSON.parse(a);if(s.detail){const o=String(s.detail);o.includes("Database unavailable")||o.includes("unavailable")?t="Our servers are temporarily busy. Please try again in a moment.":o.includes("timeout")||o.includes("timed out")?t="The request timed out. Please check your connection and try again.":t=o}}catch{!e.ok&&a&&(t="Failed to start assessment. Please try again.")}return t},n=2,r=3e4;for(let e=1;e<=n;e++){const a=new AbortController,t=setTimeout(()=>a.abort(),r);try{const s=await u(a.signal);if(s.ok)return clearTimeout(t),s.json();if(s.status>=400&&s.status<500){clearTimeout(t);const m=await s.text().catch(()=>"");throw new Error(d(s,m))}const o=await s.text().catch(()=>""),p=d(s,o);if(clearTimeout(t),e<n){const m=e*2e3;console.warn(`[generateDiagnostic] attempt ${e} failed (${s.status}), retrying in ${m}ms...`),await new Promise(T=>setTimeout(T,m));continue}throw new Error(p)}catch(s){if(clearTimeout(t),s instanceof DOMException&&s.name==="AbortError"){if(e<n){console.warn(`[generateDiagnostic] attempt ${e} timed out, retrying...`);continue}throw new Error("The request timed out. Please check your connection and try again.")}throw s}}throw new Error("Failed to generate assessment after multiple attempts.")}async function _(g,h){const f=`${y}/api/diagnostic/submit`,i=new Headers({"Content-Type":"application/json"}),{auth:c}=await w(async()=>{const{auth:n}=await import("./index-uASBzalf.js").then(r=>r.b2);return{auth:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),l=c.currentUser;if(l){const n=await l.getIdToken(!1);n&&i.set("Authorization",`Bearer ${n}`)}const u=new AbortController,d=setTimeout(()=>u.abort(),6e4);try{const n=await fetch(f,{method:"POST",headers:i,body:JSON.stringify({test_id:g,responses:h}),signal:u.signal});if(!n.ok){const r=await n.text().catch(()=>"");let e="Something went wrong. Please try again.";try{const a=JSON.parse(r);if(a.detail){const t=String(a.detail);t.includes("session")||t.includes("not found")?e="Your assessment session has expired. Please restart the assessment.":t.includes("Database unavailable")||t.includes("unavailable")?e="Our servers are temporarily busy. Please try again in a moment.":t.includes("timeout")||t.includes("timed out")?e="The request timed out. Please check your connection and try again.":e=t}}catch{r.includes("404")||r.includes("not found")?e="Your assessment session has expired. Please restart the assessment.":r&&(e="Something went wrong. Please try again.")}throw new Error(e)}return n.json()}finally{clearTimeout(d)}}export{P as g,_ as s};