Spaces:
Running
Running
github-actions[bot] commited on
Commit Β·
d8ca394
1
Parent(s): 332c825
π Auto-deploy frontend from GitHub (54a9b2d)
Browse filesThis view is limited to 50 files because it contains too many changes. Β See raw diff
- assets/{AIChatPage-C5Aol7Ef.js β AIChatPage-BEC3mijo.js} +2 -2
- assets/AdminDashboard-B7yRI4wL.js +0 -0
- assets/AdminDashboard-C9BDGBhi.js +0 -0
- assets/{AssessmentPage-D98zS7Za.js β AssessmentPage-DI0qCtR6.js} +2 -2
- assets/{AvatarShop-AFWgueuK.js β AvatarShop-CAPwOQHq.js} +2 -2
- assets/{ChatMarkdown-vDoOnX8q.js β ChatMarkdown-BWVWW9Zs.js} +1 -1
- assets/{CompetencyRadarChart-CB4_VQS8.js β CompetencyRadarChart-C3fx_ulE.js} +1 -1
- assets/{ConfirmModal-BsY1WFdG.js β ConfirmModal-BjVnuYqC.js} +1 -1
- assets/{FloatingAITutor-CSSEfiYF.js β FloatingAITutor-BkNIiXkv.js} +2 -2
- assets/{GradesPage-wWFYB1uJ.js β GradesPage-CU5DI0dR.js} +2 -2
- assets/HeroBanner-Co1DN6x_.js +0 -13
- assets/HeroBanner-DPijLb9x.js +8 -0
- assets/{InitialAssessmentModal-BbFsU9kR.js β InitialAssessmentModal-C4M589Rr.js} +1 -1
- assets/{LeaderboardPage-CoNMThBG.js β LeaderboardPage-BGY9czx-.js} +3 -3
- assets/{LearningPath-B69Oihj_.js β LearningPath-BIfd3u7Y.js} +1 -1
- assets/LoginPage-CptqcE8b.js +1 -0
- assets/LoginPage-CqIFZBqL.js +0 -6
- assets/{LogoutActionButton-DQLJH-aF.js β LogoutActionButton-D5BV__Zd.js} +1 -1
- assets/{ModuleFolderCard-BQjDrVls.js β ModuleFolderCard-DKst1S7k.js} +1 -1
- assets/{ModulesPage-CyxYQpv4.js β ModulesPage-D_ceNMZi.js} +0 -0
- assets/NotificationDropdown-IzxN6ZqA.js +21 -0
- assets/ProfileModal-BLj_o7UC.js +0 -11
- assets/ProfileModal-xyqhi5Hx.js +11 -0
- assets/ProfilePictureUploader-B3ToJmez.js +147 -0
- assets/ProfilePictureUploader-Byg9gnjl.js +0 -109
- assets/{QuizBattlePage-B6iQUgiR.js β QuizBattlePage-CgKinHpO.js} +0 -0
- assets/RewardsModal-DfvIngtK.js +1 -0
- assets/RewardsModal-gGwAMPUb.js +0 -1
- assets/RightSidebar-C9HBuSrc.js +0 -1
- assets/RightSidebar-GlSyU02g.js +1 -0
- assets/{ScientificCalculator-C3ad9xEg.js β ScientificCalculator-C0Zl3TP5.js} +1 -1
- assets/SettingsModal-CQfmcUsu.js +0 -17
- assets/SettingsModal-DILgCJsp.js +17 -0
- assets/Sidebar-1AFatJJg.js +6 -0
- assets/Sidebar-CnFPEtsr.js +0 -6
- assets/{SupplementalBanner-DX4KIC1c.js β SupplementalBanner-BaFvS7H9.js} +1 -1
- assets/{SupplementalPillCarousel-BcOOOGo2.js β SupplementalPillCarousel-Dxq4aiMj.js} +1 -1
- assets/TeacherDashboard-DH_EClon.js +0 -0
- assets/TeacherDashboard-DyMHG-dm.js +0 -0
- assets/XPNotification-B5D6Y4_2.js +0 -1
- assets/XPNotification-Doid3miV.js +1 -0
- assets/{automationService-pLIzsro_.js β automationService-JEEI7dc9.js} +1 -1
- assets/{bell-D_pyutJs.js β bell-Bp_utT8v.js} +2 -2
- assets/button-BqKfG4Jj.js +0 -1
- assets/button-CaSK4KoS.js +1 -0
- assets/{chart-column-B4tQNTpN.js β chart-column-C9VTl-3A.js} +1 -1
- assets/{chatService-BuuZ3z6i.js β chatService-oZskyXOh.js} +1 -1
- assets/{check-BLN5Dl8e.js β check-6eXlU5jr.js} +1 -1
- assets/{chevron-left-BYtw_nqd.js β chevron-left-Cr0wYLQi.js} +2 -2
- assets/{chevron-right-bwYIKoxv.js β chevron-right-CbkkCalp.js} +2 -2
assets/{AIChatPage-C5Aol7Ef.js β AIChatPage-BEC3mijo.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
| 2 |
-
import{az as F,l as $,_ as z,g as S,m as C,F as D}from"./index-mbyiCUYG.js";import{r as a,j as e}from"./vendor-react-B4AQeu28.js";import{B as O}from"./button-BqKfG4Jj.js";import{I}from"./input-DEPoMoHZ.js";import H from"./ChatMarkdown-vDoOnX8q.js";import{P as Y}from"./plus-CbpDHvDO.js";import{S as G}from"./search-F2fS74Xk.js";import{T as Q}from"./trash-2-8qZ3aehj.js";import{S as W}from"./send-iW1LmVFw.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-mbyiCUYG.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};
|
|
|
|
| 1 |
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B3ruOzo6.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-BPuEd8FG.js","assets/vendor-charts-D7t7JfSr.js","assets/vendor-markdown-yqZQ_iQm.js","assets/vendor-markdown-CfVKi3_s.css","assets/index-trN1hCQB.css"])))=>i.map(i=>d[i]);
|
| 2 |
+
import{aB as F,u as $,_ as D,k as S,m as C,F as z}from"./index-B3ruOzo6.js";import{r as a,j as e}from"./vendor-react-B4AQeu28.js";import{B as O}from"./button-CaSK4KoS.js";import{I}from"./input-kh84w1XK.js";import H from"./ChatMarkdown-BWVWW9Zs.js";import{P as Y}from"./plus-Dx0gdu7_.js";import{S as G}from"./search-DeasjpAx.js";import{T as Q}from"./trash-2-CjkT7lLr.js";import{S as W}from"./send-CTO7uejQ.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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})},B=()=>{const t=m.current;return t?t.scrollHeight-t.scrollTop-t.clientHeight<=120:!0},E=()=>{h.current=B()};a.useEffect(()=>{D(async()=>{const{warmupBackend:t}=await import("./index-B3ruOzo6.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)},R=(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=>R(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:E,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};
|
assets/AdminDashboard-B7yRI4wL.js
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
assets/AdminDashboard-C9BDGBhi.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
assets/{AssessmentPage-D98zS7Za.js β AssessmentPage-DI0qCtR6.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
import{r as n,j as e}from"./vendor-react-B4AQeu28.js";import{B as P}from"./button-
|
| 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=[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]],se=Y("minimize-2",ee),we=({testId:S,questions:u,userName:k,onComplete:_,onCancel:z})=>{const[h,b]=n.useState("testing"),[l,E]=n.useState(0),[i,g]=n.useState(null),[d,C]=n.useState(()=>{try{const s=sessionStorage.getItem("mathpulse_diagnostic_responses");return s?JSON.parse(s):[]}catch{return[]}}),[w,D]=n.useState([]),[F,A]=n.useState(0),[j,v]=n.useState(null),[y,p]=n.useState(!1),o=n.useRef(null),f=n.useRef(Date.now()),c=u.length,m=u[l],M=Math.round((l+(i?1:0))/c*100),[I]=n.useState(Array.from({length:10},(s,t)=>({id:t,size:Math.random()*80+30,x:Math.random()*100,y:Math.random()*100,duration:Math.random()*20+15,delay:Math.random()*-20,color:["bg-purple-500/10","bg-blue-500/10","bg-cyan-500/10","bg-emerald-500/10"][Math.floor(Math.random()*4)]}))),N=n.useCallback(()=>{f.current=Date.now(),o.current&&clearInterval(o.current),o.current=setInterval(()=>{A(Math.floor((Date.now()-f.current)/1e3))},200)},[]);n.useEffect(()=>(N(),()=>{o.current&&clearInterval(o.current)}),[l,N]);const R=n.useCallback(()=>{const s=document.getElementById("assessment-container");s&&(document.fullscreenElement?document.exitFullscreen&&document.exitFullscreen().then(()=>{p(!1)}).catch(t=>{console.error("Exit fullscreen error:",t)}):s.requestFullscreen().then(()=>{p(!0)}).catch(t=>{console.error("Fullscreen error:",t)}))},[]);n.useEffect(()=>{const s=()=>{p(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",s),()=>document.removeEventListener("fullscreenchange",s)},[]);const B=s=>{g(s)},T=()=>{if(!i)return;o.current&&clearInterval(o.current);const s=Math.floor((Date.now()-f.current)/1e3),t=[...w,!0],r=[...d,{question_id:m.question_id,student_answer:i,time_spent_seconds:s}];D(t),C(r),g(null),l<c-1?E(x=>x+1):$(r)},$=async s=>{b("submitting"),v(null);try{sessionStorage.setItem("mathpulse_diagnostic_responses",JSON.stringify(s))}catch{}try{const t=await Q(S,s);sessionStorage.removeItem("mathpulse_diagnostic"),sessionStorage.removeItem("mathpulse_diagnostic_responses"),b("results"),setTimeout(()=>{_({overallRisk:t.overall_risk,overallScorePercent:t.overall_score_percent,intervention:t.recommended_intervention,xpEarned:t.xp_earned,badgeUnlocked:t.badge_unlocked})},3e3)}catch(t){const r=t instanceof Error?t.message:"Submission failed. Your answers are saved locally.";v(r)}},q=s=>{const t=Math.floor(s/60),r=s%60;return`${t}:${r.toString().padStart(2,"0")}`},L=["A","B","C","D"];return e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-md flex items-center justify-center p-4 sm:p-6 overflow-hidden",children:e.jsxs("div",{id:"assessment-container",className:"bg-white/95 backdrop-blur-xl border border-white/20 rounded-3xl shadow-[0_0_50px_rgba(0,0,0,0.3)] w-full max-w-4xl h-[95vh] sm:h-[90vh] md:h-[85vh] flex flex-col relative z-10 overflow-hidden transition-all duration-300",children:[e.jsx("div",{className:"absolute inset-0 pointer-events-none z-0 overflow-hidden",children:I.map(s=>e.jsx(a.div,{className:`absolute rounded-full blur-3xl ${s.color.replace("/10","/30")}`,style:{width:s.size*1.5,height:s.size*1.5,left:`${s.x}%`,top:`${s.y}%`},animate:{x:[0,Math.random()*100-50,0],y:[0,Math.random()*100-50,0],scale:[1,1.3,1]},transition:{duration:s.duration,repeat:1/0,ease:"linear",delay:s.delay}},s.id))}),e.jsxs(a.div,{className:"shrink-0 text-white border-b border-white/10 shadow-md relative z-10",style:{backgroundColor:"#9956DE"},children:[e.jsxs("div",{className:"flex items-center justify-between p-4 sm:p-5 md:p-6",children:[e.jsxs("div",{className:"flex-1 min-w-0 mr-2",children:[e.jsx("h2",{className:"text-lg sm:text-xl md:text-2xl font-bold truncate",children:"Diagnostic Assessment"}),e.jsxs("p",{className:"text-white/80 text-xs sm:text-sm font-medium truncate",children:[m.domain," β’ ",m.difficulty]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:R,className:"w-9 h-9 sm:w-10 sm:h-10 bg-white/20 hover:bg-white/30 rounded-xl flex items-center justify-center transition-colors",title:y?"Exit Fullscreen":"Enter Fullscreen",children:y?e.jsx(se,{size:18}):e.jsx(H,{size:18})}),e.jsx("button",{onClick:z,className:"w-9 h-9 sm:w-10 sm:h-10 bg-white/20 hover:bg-white/30 rounded-xl flex items-center justify-center transition-colors",children:e.jsx(W,{size:20})})]})]}),e.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 md:px-6 pb-3 sm:pb-4 md:pb-5",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"bg-white/20 px-3 py-1 rounded-full flex items-center gap-1",children:[e.jsx(J,{size:16}),e.jsxs("span",{className:"font-bold text-sm",children:[d.length," / ",c]})]})}),e.jsxs("div",{className:"flex items-center gap-1 bg-white/20 px-3 py-1 rounded-full",children:[e.jsx(X,{size:16}),e.jsx("span",{className:"font-bold text-sm",children:q(F)})]})]}),e.jsxs("div",{className:"px-4 sm:px-5 md:px-6 pb-3 sm:pb-4 md:pb-5",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:["Question ",l+1," of ",c]}),e.jsxs("span",{className:"text-sm font-bold",children:[M,"%"]})]}),e.jsx("div",{className:"flex items-center gap-1",children:u.map((s,t)=>{let r="bg-white/30";return t<l?r=w[t]?"bg-[#75D06A]":"bg-[#FF8B8B]":t===l&&(r="bg-white scale-y-150 shadow-[0_0_8px_white]"),e.jsx(a.div,{className:`flex-1 h-2 rounded-full transition-all duration-300 ${r}`},t)})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4 sm:p-5 md:p-6 lg:p-8 relative flex flex-col bg-white/70 backdrop-blur-md",children:h==="testing"&&e.jsx(O,{mode:"wait",children:e.jsxs(a.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"flex flex-col flex-1 relative z-10",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsx("h3",{className:"font-extrabold text-[#0a1628] leading-snug break-words text-sm sm:text-base md:text-lg lg:text-xl",children:m.question_text}),e.jsx("p",{className:"text-xs sm:text-sm font-semibold opacity-70 uppercase tracking-wide text-[#9956DE] mt-2",children:"Select the correct answer"})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 sm:gap-3 md:gap-4",children:L.map(s=>{const t=m.options[s];if(!t)return null;const r=i===s;let x="bg-[#edf1f7] hover:bg-[#dde3eb] border-[#dde3eb]";return r&&(x="bg-purple-50 border-[#9956DE]"),e.jsx(a.button,{whileHover:{scale:1.01},whileTap:{scale:.99},onClick:()=>B(s),className:`w-full text-left p-2.5 sm:p-3 md:p-4 rounded-xl border-2 transition-all ${x} cursor-pointer shadow-sm hover:shadow-md flex items-center min-h-[3rem] sm:min-h-[4rem] md:min-h-[5rem]`,children:e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 w-full min-w-0",children:[e.jsx("div",{className:`w-8 h-8 sm:w-10 sm:h-10 rounded-xl shrink-0 flex items-center justify-center font-bold text-sm sm:text-base ${r?"bg-[#9956DE] text-white shadow-inner":"bg-white text-[#0a1628] shadow-sm"}`,children:s}),e.jsx("span",{className:"font-semibold text-[#0a1628] text-xs sm:text-sm md:text-base break-words",children:t}),r&&e.jsx(K,{size:18,className:"ml-auto text-[#9956DE] flex-shrink-0"})]})},s)})})]},l)})}),e.jsx("div",{className:"p-4 sm:p-5 md:p-6 bg-[#edf1f7] border-t border-[#dde3eb]",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm text-[#5a6578]",children:i?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(U,{size:16}),"Ready for the next one!"]}):e.jsx("span",{children:"Select an answer to continue"})}),e.jsxs(P,{onClick:T,disabled:!i,className:`font-bold px-6 py-2.5 sm:py-3 rounded-xl flex items-center gap-2 transition-all shadow-md hover:shadow-lg text-sm ${i?"bg-[#9956DE] hover:bg-[#8850CE] text-white shadow-[#9956DE]/20":"bg-[#dde3eb] text-slate-500 cursor-not-allowed"}`,children:[l<c-1?"Next Question":"Submit Assessment",e.jsx(V,{size:18})]})]})}),h==="submitting"&&e.jsx(a.div,{initial:{opacity:0},animate:{opacity:1},className:"absolute inset-0 bg-white/95 backdrop-blur-xl flex items-center justify-center z-50 rounded-3xl",children:e.jsxs(a.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},className:"text-center p-8",children:[e.jsx("div",{className:"mx-auto mb-4 h-16 w-16 rounded-full border-4 border-[#9956DE] border-t-transparent animate-spin"}),e.jsx("h2",{className:"text-2xl font-bold text-[#0a1628] mb-2",children:"Analyzing your results..."}),e.jsx("p",{className:"text-sm text-[#5a6578] max-w-xs mx-auto",children:"We're evaluating your responses and building your personalized learning path."}),j&&e.jsx("div",{className:"mt-4 p-3 bg-red-50 border border-red-200 rounded-lg max-w-sm mx-auto",children:e.jsx("p",{className:"text-sm text-red-700",children:j})})]})}),h==="results"&&e.jsx(a.div,{initial:{opacity:0},animate:{opacity:1},className:"absolute inset-0 bg-white/95 backdrop-blur-xl flex items-center justify-center z-50 rounded-3xl overflow-y-auto",children:e.jsxs(a.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",damping:25,stiffness:200},className:"text-center p-6 sm:p-8 max-w-md mx-auto",children:[e.jsx(a.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.2,type:"spring"},className:`w-24 h-24 mx-auto rounded-full flex items-center justify-center mb-4 ${d.length>=c*.7?"bg-gradient-to-br from-[#75D06A] to-[#6ED1CF]":"bg-gradient-to-br from-[#FFB356] to-[#FF8B8B]"}`,children:d.length>=c*.7?e.jsx(Z,{size:48,className:"text-white"}):e.jsx(G,{size:48,className:"text-white"})}),e.jsx("h2",{className:"text-3xl font-bold font-display text-[#0a1628] mb-2",children:"Assessment Complete!"}),e.jsxs("p",{className:"text-[#5a6578] mb-6",children:["Great job, ",k,"! Your personalized learning path is ready."]}),e.jsxs("div",{className:"bg-gradient-to-br from-[#1FA7E1]/10 to-[#6ED1CF]/10 rounded-2xl p-5 mb-5",children:[e.jsxs("div",{className:"text-sm text-[#5a6578] mb-2",children:["You answered ",d.length," questions"]}),e.jsx("div",{className:"text-xs text-[#5a6578]",children:"Results will be available shortly..."})]}),e.jsx("p",{className:"text-xs text-slate-400 mb-4",children:"Redirecting to dashboard..."})]})})]})})};export{we as default};
|
|
|
|
| 1 |
+
import{r as n,j as e}from"./vendor-react-B4AQeu28.js";import{B as P}from"./button-CaSK4KoS.js";import{s as Q}from"./diagnosticService-CLsUcd9M.js";import{e as Y,m as a,Z as J,k as O,T as U,z as Z,p as G}from"./index-B3ruOzo6.js";import{M as H}from"./maximize-2-Cr4HMoWg.js";import{X as W}from"./x-BNHnAXzL.js";import{C as X}from"./clock-C73na4Cu.js";import{C as K}from"./circle-check-big-CWdn1Nqf.js";import{C as V}from"./chevron-right-CbkkCalp.js";import"./vendor-radix-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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.
|
| 5 |
* See the LICENSE file in the root directory of this source tree.
|
| 6 |
+
*/const ee=[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]],se=Y("minimize-2",ee),we=({testId:k,questions:u,userName:S,onComplete:_,onCancel:z})=>{const[h,b]=n.useState("testing"),[l,E]=n.useState(0),[i,g]=n.useState(null),[d,C]=n.useState(()=>{try{const s=sessionStorage.getItem("mathpulse_diagnostic_responses");return s?JSON.parse(s):[]}catch{return[]}}),[w,D]=n.useState([]),[F,A]=n.useState(0),[j,v]=n.useState(null),[y,p]=n.useState(!1),o=n.useRef(null),f=n.useRef(Date.now()),c=u.length,m=u[l],M=Math.round((l+(i?1:0))/c*100),[I]=n.useState(Array.from({length:10},(s,t)=>({id:t,size:Math.random()*80+30,x:Math.random()*100,y:Math.random()*100,duration:Math.random()*20+15,delay:Math.random()*-20,color:["bg-purple-500/10","bg-blue-500/10","bg-cyan-500/10","bg-emerald-500/10"][Math.floor(Math.random()*4)]}))),N=n.useCallback(()=>{f.current=Date.now(),o.current&&clearInterval(o.current),o.current=setInterval(()=>{A(Math.floor((Date.now()-f.current)/1e3))},200)},[]);n.useEffect(()=>(N(),()=>{o.current&&clearInterval(o.current)}),[l,N]);const R=n.useCallback(()=>{const s=document.getElementById("assessment-container");s&&(document.fullscreenElement?document.exitFullscreen&&document.exitFullscreen().then(()=>{p(!1)}).catch(t=>{console.error("Exit fullscreen error:",t)}):s.requestFullscreen().then(()=>{p(!0)}).catch(t=>{console.error("Fullscreen error:",t)}))},[]);n.useEffect(()=>{const s=()=>{p(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",s),()=>document.removeEventListener("fullscreenchange",s)},[]);const B=s=>{g(s)},T=()=>{if(!i)return;o.current&&clearInterval(o.current);const s=Math.floor((Date.now()-f.current)/1e3),t=[...w,!0],r=[...d,{question_id:m.question_id,student_answer:i,time_spent_seconds:s}];D(t),C(r),g(null),l<c-1?E(x=>x+1):$(r)},$=async s=>{b("submitting"),v(null);try{sessionStorage.setItem("mathpulse_diagnostic_responses",JSON.stringify(s))}catch{}try{const t=await Q(k,s);sessionStorage.removeItem("mathpulse_diagnostic"),sessionStorage.removeItem("mathpulse_diagnostic_responses"),b("results"),setTimeout(()=>{_({overallRisk:t.overall_risk,overallScorePercent:t.overall_score_percent,intervention:t.recommended_intervention,xpEarned:t.xp_earned,badgeUnlocked:t.badge_unlocked})},3e3)}catch(t){const r=t instanceof Error?t.message:"Submission failed. Your answers are saved locally.";v(r)}},q=s=>{const t=Math.floor(s/60),r=s%60;return`${t}:${r.toString().padStart(2,"0")}`},L=["A","B","C","D"];return e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-md flex items-center justify-center p-4 sm:p-6 overflow-hidden",children:e.jsxs("div",{id:"assessment-container",className:"bg-white/95 backdrop-blur-xl border border-white/20 rounded-3xl shadow-[0_0_50px_rgba(0,0,0,0.3)] w-full max-w-4xl h-[95vh] sm:h-[90vh] md:h-[85vh] flex flex-col relative z-10 overflow-hidden transition-all duration-300",children:[e.jsx("div",{className:"absolute inset-0 pointer-events-none z-0 overflow-hidden",children:I.map(s=>e.jsx(a.div,{className:`absolute rounded-full blur-3xl ${s.color.replace("/10","/30")}`,style:{width:s.size*1.5,height:s.size*1.5,left:`${s.x}%`,top:`${s.y}%`},animate:{x:[0,Math.random()*100-50,0],y:[0,Math.random()*100-50,0],scale:[1,1.3,1]},transition:{duration:s.duration,repeat:1/0,ease:"linear",delay:s.delay}},s.id))}),e.jsxs(a.div,{className:"shrink-0 text-white border-b border-white/10 shadow-md relative z-10",style:{backgroundColor:"#9956DE"},children:[e.jsxs("div",{className:"flex items-center justify-between p-4 sm:p-5 md:p-6",children:[e.jsxs("div",{className:"flex-1 min-w-0 mr-2",children:[e.jsx("h2",{className:"text-lg sm:text-xl md:text-2xl font-bold truncate",children:"Diagnostic Assessment"}),e.jsxs("p",{className:"text-white/80 text-xs sm:text-sm font-medium truncate",children:[m.domain," β’ ",m.difficulty]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:R,className:"w-9 h-9 sm:w-10 sm:h-10 bg-white/20 hover:bg-white/30 rounded-xl flex items-center justify-center transition-colors",title:y?"Exit Fullscreen":"Enter Fullscreen",children:y?e.jsx(se,{size:18}):e.jsx(H,{size:18})}),e.jsx("button",{onClick:z,className:"w-9 h-9 sm:w-10 sm:h-10 bg-white/20 hover:bg-white/30 rounded-xl flex items-center justify-center transition-colors",children:e.jsx(W,{size:20})})]})]}),e.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 md:px-6 pb-3 sm:pb-4 md:pb-5",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"bg-white/20 px-3 py-1 rounded-full flex items-center gap-1",children:[e.jsx(J,{size:16}),e.jsxs("span",{className:"font-bold text-sm",children:[d.length," / ",c]})]})}),e.jsxs("div",{className:"flex items-center gap-1 bg-white/20 px-3 py-1 rounded-full",children:[e.jsx(X,{size:16}),e.jsx("span",{className:"font-bold text-sm",children:q(F)})]})]}),e.jsxs("div",{className:"px-4 sm:px-5 md:px-6 pb-3 sm:pb-4 md:pb-5",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:["Question ",l+1," of ",c]}),e.jsxs("span",{className:"text-sm font-bold",children:[M,"%"]})]}),e.jsx("div",{className:"flex items-center gap-1",children:u.map((s,t)=>{let r="bg-white/30";return t<l?r=w[t]?"bg-[#75D06A]":"bg-[#FF8B8B]":t===l&&(r="bg-white scale-y-150 shadow-[0_0_8px_white]"),e.jsx(a.div,{className:`flex-1 h-2 rounded-full transition-all duration-300 ${r}`},t)})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4 sm:p-5 md:p-6 lg:p-8 relative flex flex-col bg-white/70 backdrop-blur-md",children:h==="testing"&&e.jsx(O,{mode:"wait",children:e.jsxs(a.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"flex flex-col flex-1 relative z-10",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsx("h3",{className:"font-extrabold text-[#0a1628] leading-snug break-words text-sm sm:text-base md:text-lg lg:text-xl",children:m.question_text}),e.jsx("p",{className:"text-xs sm:text-sm font-semibold opacity-70 uppercase tracking-wide text-[#9956DE] mt-2",children:"Select the correct answer"})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 sm:gap-3 md:gap-4",children:L.map(s=>{const t=m.options[s];if(!t)return null;const r=i===s;let x="bg-[#edf1f7] hover:bg-[#dde3eb] border-[#dde3eb]";return r&&(x="bg-purple-50 border-[#9956DE]"),e.jsx(a.button,{whileHover:{scale:1.01},whileTap:{scale:.99},onClick:()=>B(s),className:`w-full text-left p-2.5 sm:p-3 md:p-4 rounded-xl border-2 transition-all ${x} cursor-pointer shadow-sm hover:shadow-md flex items-center min-h-[3rem] sm:min-h-[4rem] md:min-h-[5rem]`,children:e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 w-full min-w-0",children:[e.jsx("div",{className:`w-8 h-8 sm:w-10 sm:h-10 rounded-xl shrink-0 flex items-center justify-center font-bold text-sm sm:text-base ${r?"bg-[#9956DE] text-white shadow-inner":"bg-white text-[#0a1628] shadow-sm"}`,children:s}),e.jsx("span",{className:"font-semibold text-[#0a1628] text-xs sm:text-sm md:text-base break-words",children:t}),r&&e.jsx(K,{size:18,className:"ml-auto text-[#9956DE] flex-shrink-0"})]})},s)})})]},l)})}),e.jsx("div",{className:"p-4 sm:p-5 md:p-6 bg-[#edf1f7] border-t border-[#dde3eb]",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm text-[#5a6578]",children:i?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(U,{size:16}),"Ready for the next one!"]}):e.jsx("span",{children:"Select an answer to continue"})}),e.jsxs(P,{onClick:T,disabled:!i,className:`font-bold px-6 py-2.5 sm:py-3 rounded-xl flex items-center gap-2 transition-all shadow-md hover:shadow-lg text-sm ${i?"bg-[#9956DE] hover:bg-[#8850CE] text-white shadow-[#9956DE]/20":"bg-[#dde3eb] text-slate-500 cursor-not-allowed"}`,children:[l<c-1?"Next Question":"Submit Assessment",e.jsx(V,{size:18})]})]})}),h==="submitting"&&e.jsx(a.div,{initial:{opacity:0},animate:{opacity:1},className:"absolute inset-0 bg-white/95 backdrop-blur-xl flex items-center justify-center z-50 rounded-3xl",children:e.jsxs(a.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},className:"text-center p-8",children:[e.jsx("div",{className:"mx-auto mb-4 h-16 w-16 rounded-full border-4 border-[#9956DE] border-t-transparent animate-spin"}),e.jsx("h2",{className:"text-2xl font-bold text-[#0a1628] mb-2",children:"Analyzing your results..."}),e.jsx("p",{className:"text-sm text-[#5a6578] max-w-xs mx-auto",children:"We're evaluating your responses and building your personalized learning path."}),j&&e.jsx("div",{className:"mt-4 p-3 bg-red-50 border border-red-200 rounded-lg max-w-sm mx-auto",children:e.jsx("p",{className:"text-sm text-red-700",children:j})})]})}),h==="results"&&e.jsx(a.div,{initial:{opacity:0},animate:{opacity:1},className:"absolute inset-0 bg-white/95 backdrop-blur-xl flex items-center justify-center z-50 rounded-3xl overflow-y-auto",children:e.jsxs(a.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",damping:25,stiffness:200},className:"text-center p-6 sm:p-8 max-w-md mx-auto",children:[e.jsx(a.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.2,type:"spring"},className:`w-24 h-24 mx-auto rounded-full flex items-center justify-center mb-4 ${d.length>=c*.7?"bg-gradient-to-br from-[#75D06A] to-[#6ED1CF]":"bg-gradient-to-br from-[#FFB356] to-[#FF8B8B]"}`,children:d.length>=c*.7?e.jsx(Z,{size:48,className:"text-white"}):e.jsx(G,{size:48,className:"text-white"})}),e.jsx("h2",{className:"text-3xl font-bold font-display text-[#0a1628] mb-2",children:"Assessment Complete!"}),e.jsxs("p",{className:"text-[#5a6578] mb-6",children:["Great job, ",S,"! Your personalized learning path is ready."]}),e.jsxs("div",{className:"bg-gradient-to-br from-[#1FA7E1]/10 to-[#6ED1CF]/10 rounded-2xl p-5 mb-5",children:[e.jsxs("div",{className:"text-sm text-[#5a6578] mb-2",children:["You answered ",d.length," questions"]}),e.jsx("div",{className:"text-xs text-[#5a6578]",children:"Results will be available shortly..."})]}),e.jsx("p",{className:"text-xs text-slate-400 mb-4",children:"Redirecting to dashboard..."})]})})]})})};export{we as default};
|
assets/{AvatarShop-AFWgueuK.js β AvatarShop-CAPwOQHq.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 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-
|
| 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{e as se,L as ae,g 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),[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};
|
|
|
|
| 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-BPuEd8FG.js";import{e as S,u as le,L as w,a0 as R,m as y,k as ie,l as c,aJ as ne,aK as ce}from"./index-B3ruOzo6.js";import{u as de}from"./useFeatureAccess-CSvNejlY.js";import{T as me,a as ue,b as xe}from"./tooltip-CLSYbTYK.js";import{C as pe}from"./CompositeAvatar-Col05lJc.js";import{M as j}from"./avatarData-BuQSOXo3.js";import{S as O}from"./save-DXz2z5YH.js";import{S as V}from"./sparkles-Bq0AaIRg.js";import{S as fe}from"./shirt-BBR3GIpi.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-D7t7JfSr.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:B,loading:H}=de(D?.uid||null),K=!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([]),[G,T]=i.useState(0),[_,I]=i.useState(null),[d,h]=i.useState(null),[P,z]=i.useState(j),[J,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 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}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 H?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..."})]}):B?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:[K,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:G})]})}),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:J,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&&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:_===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};
|
assets/{ChatMarkdown-vDoOnX8q.js β ChatMarkdown-BWVWW9Zs.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{b1 as d,_ as c}from"./index-
|
|
|
|
| 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-B3ruOzo6.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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-CB4_VQS8.js β CompetencyRadarChart-C3fx_ulE.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{r as g,j as t}from"./vendor-react-B4AQeu28.js";import{h as A,a5 as P,l as B,m as L,B as O,R as W,a as H}from"./index-mbyiCUYG.js";import{collection as R,getDocs as q,query as K,orderBy as U,limit as $,Timestamp as G,getDoc as J,doc as V}from"./vendor-firebase-firestore-CP9q7ISf.js";import{g as X,s as Y}from"./subjects-BGUwH4Kn.js";import{S as Z}from"./sparkles-THbTTiEe.js";import{R as ee,e as te,P as se,f as ne,g as ae,h as oe,T as re}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-B4tQNTpN.js";const I=["#1FA7E1","#9956DE","#75D06A","#FFB356","#7274ED","#FF8B8B","#6ED1CF","#FB96BB"];async function ie(a){try{const r=R(A,"users",a,"quizResults"),d=K(r,U("timestamp","desc"),$(500)),l=await q(d);return l.empty?F(a):l.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 J(V(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 ce(a){try{const r=R(A,"users",a,"moduleProgress"),d=await q(r);if(d.empty)return{};const l={};return d.forEach(s=>{const e=s.data();l[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||[]}}),l}catch(r){return console.error("[competencyService] fetchModuleProgress failed:",r),{}}}function _(a,r,d,l){const s=r.filter(p=>p.moduleId===a),e=s.length>0?s.reduce((p,b)=>p+b.score,0)/s.length:0,h=["identification","multiple_choice"],u=s.filter(p=>h.includes(p.questionType)),i=u.length>0?u.reduce((p,b)=>p+b.score,0)/u.length:e*.9,o=["word_problem","equation_based","enumeration"],n=s.filter(p=>o.includes(p.questionType)),c=n.length>0?n.reduce((p,b)=>p+b.score,0)/n.length:e*.85,m=d,f=m?.lessonsCompleted?.length||0,N=m?.quizzesCompleted?.length||0,D=m?.sessionsCompleted||0,y=l.find(p=>p.id===a),x=y?.lessons?.length||1,C=y?.quizzes?.length||1,z=Math.min(100,f/x*100),k=Math.min(100,N/C*100),v=Math.min(100,(z+k+D*5)/2.5);if(s.length<2){const p=v>50?60+v*.3:v*.8;return{overallMastery:e,conceptGrasp:i,application:c,engagement:v,consistency:Math.min(100,p)}}const w=s.map(p=>p.score),M=w.reduce((p,b)=>p+b,0)/w.length,E=w.reduce((p,b)=>p+Math.pow(b-M,2),0)/w.length,j=Math.sqrt(E)/Math.max(M,1),S=Math.max(0,Math.min(100,(1-j)*100));return{overallMastery:Math.round(e),conceptGrasp:Math.round(i),application:Math.round(c),engagement:Math.round(v),consistency:Math.round(S)}}async function le(a){try{const r=R(A,"users",a,"competencyMatrix"),d=await q(r);if(d.empty)return{};const l={};return d.forEach(s=>{const e=s.data();l[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}}),l}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 de(a){const[r,d]=g.useState([]),[l,s]=g.useState([]),[e,h]=g.useState("N/A"),[u,i]=g.useState(!0),[o,n]=g.useState(null),[c,m]=g.useState(!1),f=g.useRef(0),N=g.useCallback(async(y,x)=>{if(x!==f.current)return;const z=X(null)[0]??"gen-math",k=Y.find(j=>j.id===z)?.modules||[],v=k.map((j,S)=>({id:j.id,name:j.title.length>15?j.title.substring(0,15).trim()+"...":j.title,color:I[S%I.length]})),w=await le(a);if(x!==f.current)return;if(Object.keys(w).length>0){ue(w,v,d,h),m(!1),i(!1);return}const M=await ie(a),E=await ce(a);if(x!==f.current)return;const T=M.length>0;m(!T),pe(M,E,v,k,d,h),i(!1)},[a]),D=g.useCallback(async()=>{if(!a){i(!1);return}const y=++f.current;i(!0),n(null);try{const x=await new Promise(C=>{const z=P(a,k=>{z(),C(k)})});if(y!==f.current)return;await N(x,y)}catch(x){console.error("[useCompetencyMatrix] Failed to load:",x),y===f.current&&(n("Failed to load competency data. Please try again."),i(!1))}},[a,N]);return g.useEffect(()=>{if(!a)return;const y=P(a,x=>{const C=++f.current;N(x,C)});return()=>y()},[a,N]),{data:r,modulesList:l,topModule:e,loading:u,error:o,isEmpty:c,refresh:D}}function ue(a,r,d,l){let s=-1,e="N/A";const h=Q.map(u=>{const i={metric:u.label,fullMark:100};return r.forEach(o=>{const n=a[o.id];n&&(u.key==="progress"?i[o.id]=n.overallMastery:u.key==="concept"?i[o.id]=n.conceptGrasp:u.key==="application"?i[o.id]=n.application:u.key==="engagement"?i[o.id]=n.engagement:u.key==="consistency"&&(i[o.id]=n.consistency))}),i});r.forEach(u=>{const i=a[u.id];if(i){const o=(i.overallMastery+i.conceptGrasp+i.application+i.engagement+i.consistency)/5;o>s&&(s=o,e=u.name)}}),l(e),d(h)}function pe(a,r,d,l,s,e){let h=-1,u="N/A";const i=Q.map(o=>{const n={metric:o.label,fullMark:100};return l.forEach(c=>{const m=r[c.id],f=_(c.id,a,m??{moduleId:c.id,sessionsCompleted:0,moduleTitle:c.title,lessonsCompleted:[],quizzesCompleted:[]},l);o.key==="progress"?n[c.id]=f.overallMastery:o.key==="concept"?n[c.id]=f.conceptGrasp:o.key==="application"?n[c.id]=f.application:o.key==="engagement"?n[c.id]=f.engagement:o.key==="consistency"&&(n[c.id]=f.consistency)}),n});l.forEach(o=>{const n=r[o.id],c=_(o.id,a,n??{moduleId:o.id,sessionsCompleted:0,moduleTitle:o.title,lessonsCompleted:[],quizzesCompleted:[]},l),m=(c.overallMastery+c.conceptGrasp+c.application+c.engagement+c.consistency)/5;m>h&&(h=m,u=d.find(f=>f.id===o.id)?.name||"N/A")}),e(u),s(i)}const ze=()=>{const{userProfile:a}=B(),{data:r,modulesList:d,topModule:l,loading:s,error:e,isEmpty:h,refresh:u}=de(a?.uid??""),[i,o]=g.useState(!1);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 rounded-[16px] border border-slate-200 shadow-sm p-6 lg:p-8 group",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[t.jsx("div",{className:"absolute -right-12 -bottom-12 w-32 h-32 bg-[#9956DE]/5 rounded-full transition-transform duration-500 group-hover:scale-[1.8] group-hover:-translate-y-4 group-hover:-translate-x-4"}),t.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between mb-6 relative z-10 gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-[12px] bg-gradient-to-br from-[#a855f7] to-[#9333ea] flex items-center justify-center shadow-[0_4px_12px_rgba(168,85,247,0.2)]",children:t.jsx(O,{size:20,className:"text-white"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-[15px] font-bold text-slate-900",children:"Competency Matrix"}),t.jsx("p",{className:"text-[12px] text-slate-500",children:"Realtime performance across modules"})]})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[!s&&!h&&!e&&t.jsxs("div",{className:"flex items-center gap-2 bg-[#f5f3ff] border border-[#e0e7ff] px-3 py-1.5 rounded-full",children:[t.jsx(Z,{size:12,className:"text-amber-500"}),t.jsx("span",{className:"text-[11px] font-bold text-[#9956DE] uppercase tracking-wider",children:l})]}),!s&&t.jsx("button",{onClick:u,className:"w-8 h-8 rounded-full bg-white border border-slate-200 flex items-center justify-center hover:bg-[#f5f3ff] hover:border-[#9956DE]/30 transition-colors shadow-sm",title:"Refresh",children:t.jsx(W,{size:13,className:"text-slate-400"})})]})]}),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-[#9956DE]/20 border-t-[#9956DE] rounded-full animate-spin"}),t.jsx("p",{className:"text-[13px] 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-14 h-14 rounded-[16px] bg-gradient-to-br from-slate-100 to-slate-50 flex items-center justify-center border border-slate-200",children:t.jsx(H,{size:24,className:"text-slate-400"})}),t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-[13px] font-semibold text-slate-600 mb-1",children:e?"Unable to load competency data":"No activity yet"}),t.jsx("p",{className:"text-[12px] text-slate-400 max-w-[260px]",children:e||"Complete quizzes and lessons to see your competency matrix here."})]}),e&&t.jsx("button",{onClick:u,className:"px-4 py-2 text-[12px] font-semibold bg-[#9956DE] text-white rounded-full hover:bg-[#8b45d1] transition-colors shadow-md",children:"Try Again"})]}):t.jsx(ee,{width:"100%",height:"100%",children:t.jsxs(te,{cx:"50%",cy:"50%",outerRadius:i?"75%":"70%",data:r,children:[t.jsx(se,{stroke:"#e2e8f0",strokeDasharray:"4 4",polarRadius:[20,40,60,80,100]}),t.jsx(ne,{dataKey:"metric",tick:{fill:"#475569",fontSize:12,fontWeight:600}}),t.jsx(ae,{angle:90,domain:[0,100],tick:{fill:"#94a3b8",fontSize:10},tickCount:6,axisLine:!1}),d.map(n=>t.jsx(oe,{name:n.name,dataKey:n.id,stroke:n.color,strokeWidth:2,fill:n.color,fillOpacity:.3,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(re,{cursor:!1,content:({active:n,payload:c})=>n&&c&&c.length?t.jsxs("div",{className:"bg-white/95 backdrop-blur-[12px] shadow-[0_8px_24px_rgba(0,0,0,0.12)] border border-slate-100 rounded-[12px] p-4",children:[t.jsx("p",{className:"font-bold text-slate-800 text-[13px] mb-2",children:c[0].payload.metric}),t.jsx("div",{className:"flex flex-col gap-1.5",children:c.map(m=>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:m.stroke}}),t.jsx("span",{className:"text-[11px] font-semibold text-slate-600 truncate max-w-[120px]",children:String(m.name)})]}),t.jsxs("span",{className:"text-[13px] font-bold",style:{color:m.stroke},children:[Math.round(m.value),"%"]})]},m.name))})]}):null})]})})}),!s&&!h&&!e&&d.length>0&&t.jsx("div",{className:"flex flex-wrap justify-center items-center gap-3 mt-4 relative z-10",children:d.map(n=>t.jsxs("div",{className:"flex items-center gap-1.5 bg-slate-50 px-2.5 py-1 rounded-full border border-slate-100",children:[t.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.color}}),t.jsx("span",{className:"text-[10px] font-bold text-slate-600 uppercase tracking-wider",children:n.name.length>15?n.name.substring(0,12)+"...":n.name})]},n.id))})]})};export{ze as CompetencyRadarChart};
|
|
|
|
| 1 |
+
import{r as g,j as t}from"./vendor-react-B4AQeu28.js";import{g as A,a7 as I,u as B,m as L,B as O,R as W,a as H}from"./index-B3ruOzo6.js";import{collection as R,getDocs as q,query as K,orderBy as U,limit as $,Timestamp as G,getDoc as J,doc as V}from"./vendor-firebase-firestore-CP9q7ISf.js";import{g as X,s as Y}from"./subjects-DEj_AlYz.js";import{S as Z}from"./sparkles-Bq0AaIRg.js";import{R as ee,g as te,h as se,i as ne,j as ae,k as oe,T as re}from"./vendor-charts-D7t7JfSr.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-BPuEd8FG.js";import"./vendor-markdown-yqZQ_iQm.js";import"./chart-column-C9VTl-3A.js";const P=["#1FA7E1","#9956DE","#75D06A","#FFB356","#7274ED","#FF8B8B","#6ED1CF","#FB96BB"];async function ie(a){try{const r=R(A,"users",a,"quizResults"),d=K(r,U("timestamp","desc"),$(500)),l=await q(d);return l.empty?F(a):l.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 J(V(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 ce(a){try{const r=R(A,"users",a,"moduleProgress"),d=await q(r);if(d.empty)return{};const l={};return d.forEach(s=>{const e=s.data();l[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||[]}}),l}catch(r){return console.error("[competencyService] fetchModuleProgress failed:",r),{}}}function _(a,r,d,l){const s=r.filter(p=>p.moduleId===a),e=s.length>0?s.reduce((p,b)=>p+b.score,0)/s.length:0,h=["identification","multiple_choice"],u=s.filter(p=>h.includes(p.questionType)),i=u.length>0?u.reduce((p,b)=>p+b.score,0)/u.length:e*.9,o=["word_problem","equation_based","enumeration"],n=s.filter(p=>o.includes(p.questionType)),c=n.length>0?n.reduce((p,b)=>p+b.score,0)/n.length:e*.85,m=d,f=m?.lessonsCompleted?.length||0,N=m?.quizzesCompleted?.length||0,D=m?.sessionsCompleted||0,y=l.find(p=>p.id===a),x=y?.lessons?.length||1,k=y?.quizzes?.length||1,z=Math.min(100,f/x*100),C=Math.min(100,N/k*100),v=Math.min(100,(z+C+D*5)/2.5);if(s.length<2){const p=v>50?60+v*.3:v*.8;return{overallMastery:e,conceptGrasp:i,application:c,engagement:v,consistency:Math.min(100,p)}}const w=s.map(p=>p.score),M=w.reduce((p,b)=>p+b,0)/w.length,E=w.reduce((p,b)=>p+Math.pow(b-M,2),0)/w.length,j=Math.sqrt(E)/Math.max(M,1),S=Math.max(0,Math.min(100,(1-j)*100));return{overallMastery:Math.round(e),conceptGrasp:Math.round(i),application:Math.round(c),engagement:Math.round(v),consistency:Math.round(S)}}async function le(a){try{const r=R(A,"users",a,"competencyMatrix"),d=await q(r);if(d.empty)return{};const l={};return d.forEach(s=>{const e=s.data();l[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}}),l}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 de(a){const[r,d]=g.useState([]),[l,s]=g.useState([]),[e,h]=g.useState("N/A"),[u,i]=g.useState(!0),[o,n]=g.useState(null),[c,m]=g.useState(!1),f=g.useRef(0),N=g.useCallback(async(y,x)=>{if(x!==f.current)return;const z=X(null)[0]??"gen-math",C=Y.find(j=>j.id===z)?.modules||[],v=C.map((j,S)=>({id:j.id,name:j.title.length>15?j.title.substring(0,15).trim()+"...":j.title,color:P[S%P.length]})),w=await le(a);if(x!==f.current)return;if(Object.keys(w).length>0){ue(w,v,d,h),m(!1),i(!1);return}const M=await ie(a),E=await ce(a);if(x!==f.current)return;const T=M.length>0;m(!T),pe(M,E,v,C,d,h),i(!1)},[a]),D=g.useCallback(async()=>{if(!a){i(!1);return}const y=++f.current;i(!0),n(null);try{const x=await new Promise(k=>{const z=I(a,C=>{z(),k(C)})});if(y!==f.current)return;await N(x,y)}catch(x){console.error("[useCompetencyMatrix] Failed to load:",x),y===f.current&&(n("Failed to load competency data. Please try again."),i(!1))}},[a,N]);return g.useEffect(()=>{if(!a)return;const y=I(a,x=>{const k=++f.current;N(x,k)});return()=>y()},[a,N]),{data:r,modulesList:l,topModule:e,loading:u,error:o,isEmpty:c,refresh:D}}function ue(a,r,d,l){let s=-1,e="N/A";const h=Q.map(u=>{const i={metric:u.label,fullMark:100};return r.forEach(o=>{const n=a[o.id];n&&(u.key==="progress"?i[o.id]=n.overallMastery:u.key==="concept"?i[o.id]=n.conceptGrasp:u.key==="application"?i[o.id]=n.application:u.key==="engagement"?i[o.id]=n.engagement:u.key==="consistency"&&(i[o.id]=n.consistency))}),i});r.forEach(u=>{const i=a[u.id];if(i){const o=(i.overallMastery+i.conceptGrasp+i.application+i.engagement+i.consistency)/5;o>s&&(s=o,e=u.name)}}),l(e),d(h)}function pe(a,r,d,l,s,e){let h=-1,u="N/A";const i=Q.map(o=>{const n={metric:o.label,fullMark:100};return l.forEach(c=>{const m=r[c.id],f=_(c.id,a,m??{moduleId:c.id,sessionsCompleted:0,moduleTitle:c.title,lessonsCompleted:[],quizzesCompleted:[]},l);o.key==="progress"?n[c.id]=f.overallMastery:o.key==="concept"?n[c.id]=f.conceptGrasp:o.key==="application"?n[c.id]=f.application:o.key==="engagement"?n[c.id]=f.engagement:o.key==="consistency"&&(n[c.id]=f.consistency)}),n});l.forEach(o=>{const n=r[o.id],c=_(o.id,a,n??{moduleId:o.id,sessionsCompleted:0,moduleTitle:o.title,lessonsCompleted:[],quizzesCompleted:[]},l),m=(c.overallMastery+c.conceptGrasp+c.application+c.engagement+c.consistency)/5;m>h&&(h=m,u=d.find(f=>f.id===o.id)?.name||"N/A")}),e(u),s(i)}const ze=()=>{const{userProfile:a}=B(),{data:r,modulesList:d,topModule:l,loading:s,error:e,isEmpty:h,refresh:u}=de(a?.uid??""),[i,o]=g.useState(!1);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 rounded-[16px] border border-slate-200 shadow-sm p-6 lg:p-8 group",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[t.jsx("div",{className:"absolute -right-12 -bottom-12 w-32 h-32 bg-[#9956DE]/5 rounded-full transition-transform duration-500 group-hover:scale-[1.8] group-hover:-translate-y-4 group-hover:-translate-x-4"}),t.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between mb-6 relative z-10 gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-[12px] bg-gradient-to-br from-[#a855f7] to-[#9333ea] flex items-center justify-center shadow-[0_4px_12px_rgba(168,85,247,0.2)]",children:t.jsx(O,{size:20,className:"text-white"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-[15px] font-bold text-slate-900",children:"Competency Matrix"}),t.jsx("p",{className:"text-[12px] text-slate-500",children:"Realtime performance across modules"})]})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[!s&&!h&&!e&&t.jsxs("div",{className:"flex items-center gap-2 bg-[#f5f3ff] border border-[#e0e7ff] px-3 py-1.5 rounded-full",children:[t.jsx(Z,{size:12,className:"text-amber-500"}),t.jsx("span",{className:"text-[11px] font-bold text-[#9956DE] uppercase tracking-wider",children:l})]}),!s&&t.jsx("button",{onClick:u,className:"w-8 h-8 rounded-full bg-white border border-slate-200 flex items-center justify-center hover:bg-[#f5f3ff] hover:border-[#9956DE]/30 transition-colors shadow-sm",title:"Refresh",children:t.jsx(W,{size:13,className:"text-slate-400"})})]})]}),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-[#9956DE]/20 border-t-[#9956DE] rounded-full animate-spin"}),t.jsx("p",{className:"text-[13px] 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-14 h-14 rounded-[16px] bg-gradient-to-br from-slate-100 to-slate-50 flex items-center justify-center border border-slate-200",children:t.jsx(H,{size:24,className:"text-slate-400"})}),t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-[13px] font-semibold text-slate-600 mb-1",children:e?"Unable to load competency data":"No activity yet"}),t.jsx("p",{className:"text-[12px] text-slate-400 max-w-[260px]",children:e||"Complete quizzes and lessons to see your competency matrix here."})]}),e&&t.jsx("button",{onClick:u,className:"px-4 py-2 text-[12px] font-semibold bg-[#9956DE] text-white rounded-full hover:bg-[#8b45d1] transition-colors shadow-md",children:"Try Again"})]}):t.jsx(ee,{width:"100%",height:"100%",children:t.jsxs(te,{cx:"50%",cy:"50%",outerRadius:i?"75%":"70%",data:r,children:[t.jsx(se,{stroke:"#e2e8f0",strokeDasharray:"4 4",polarRadius:[20,40,60,80,100]}),t.jsx(ne,{dataKey:"metric",tick:{fill:"#475569",fontSize:12,fontWeight:600}}),t.jsx(ae,{angle:90,domain:[0,100],tick:{fill:"#94a3b8",fontSize:10},tickCount:6,axisLine:!1}),d.map(n=>t.jsx(oe,{name:n.name,dataKey:n.id,stroke:n.color,strokeWidth:2,fill:n.color,fillOpacity:.3,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(re,{cursor:!1,content:({active:n,payload:c})=>n&&c&&c.length?t.jsxs("div",{className:"bg-white/95 backdrop-blur-[12px] shadow-[0_8px_24px_rgba(0,0,0,0.12)] border border-slate-100 rounded-[12px] p-4",children:[t.jsx("p",{className:"font-bold text-slate-800 text-[13px] mb-2",children:c[0].payload.metric}),t.jsx("div",{className:"flex flex-col gap-1.5",children:c.map(m=>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:m.stroke}}),t.jsx("span",{className:"text-[11px] font-semibold text-slate-600 truncate max-w-[120px]",children:String(m.name)})]}),t.jsxs("span",{className:"text-[13px] font-bold",style:{color:m.stroke},children:[Math.round(m.value),"%"]})]},m.name))})]}):null})]})})}),!s&&!h&&!e&&d.length>0&&t.jsx("div",{className:"flex flex-wrap justify-center items-center gap-3 mt-4 relative z-10",children:d.map(n=>t.jsxs("div",{className:"flex items-center gap-1.5 bg-slate-50 px-2.5 py-1 rounded-full border border-slate-100",children:[t.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.color}}),t.jsx("span",{className:"text-[10px] font-bold text-slate-600 uppercase tracking-wider",children:n.name.length>15?n.name.substring(0,12)+"...":n.name})]},n.id))})]})};export{ze as CompetencyRadarChart};
|
assets/{ConfirmModal-BsY1WFdG.js β ConfirmModal-BjVnuYqC.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{j as e}from"./vendor-react-B4AQeu28.js";import{B as i}from"./button-
|
|
|
|
| 1 |
+
import{j as e}from"./vendor-react-B4AQeu28.js";import{B as i}from"./button-CaSK4KoS.js";import{k as f,m as r,v as h}from"./index-B3ruOzo6.js";import{X as y}from"./x-BNHnAXzL.js";import{T as j}from"./trash-2-CjkT7lLr.js";import{L as w}from"./log-out-CoRJnfoO.js";import"./vendor-radix-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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-CSSEfiYF.js β FloatingAITutor-BkNIiXkv.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatMarkdown-
|
| 2 |
-
import{
|
|
|
|
| 1 |
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatMarkdown-BWVWW9Zs.js","assets/index-B3ruOzo6.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-BPuEd8FG.js","assets/vendor-charts-D7t7JfSr.js","assets/vendor-markdown-yqZQ_iQm.js","assets/vendor-markdown-CfVKi3_s.css","assets/index-trN1hCQB.css"])))=>i.map(i=>d[i]);
|
| 2 |
+
import{aB as C,_ as y,m as b,E as A}from"./index-B3ruOzo6.js";import{r as i,j as e}from"./vendor-react-B4AQeu28.js";import{M}from"./maximize-2-Cr4HMoWg.js";import{M as w}from"./minus-B69_eMXI.js";import{X as g}from"./x-BNHnAXzL.js";import{S as L}from"./send-CTO7uejQ.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.js";import"./vendor-markdown-yqZQ_iQm.js";const E=i.lazy(()=>y(()=>import("./ChatMarkdown-BWVWW9Zs.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-B3ruOzo6.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-wWFYB1uJ.js β GradesPage-CU5DI0dR.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-
|
| 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};
|
|
|
|
| 1 |
+
import{r as o,j as e}from"./vendor-react-B4AQeu28.js";import{B as v}from"./button-CaSK4KoS.js";import{u as J,aC as K,aD as W,D as X,A as Z,p as D,T as R}from"./index-B3ruOzo6.js";import{g as q,S as E}from"./subjects-DEj_AlYz.js";import{u as ee}from"./useCurriculum-CQZ78SzC.js";import{D as te}from"./download-BbFDZT3H.js";import{F as P}from"./funnel-8X5OzLOw.js";import"./vendor-radix-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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-C9VTl-3A.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 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(D,{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=>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(D,{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};
|
assets/HeroBanner-Co1DN6x_.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 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{c 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-mbyiCUYG.js";import{j as e,r as o}from"./vendor-react-B4AQeu28.js";import{D as V,a as $}from"./dialog-fiLCzxmY.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-oZO0Ye1Q.js";import{C as z}from"./circle-alert-CJ47UAgT.js";import{C as U}from"./circle-check-BENuYz-J.js";import{S as Z}from"./sparkles-THbTTiEe.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.
|
| 6 |
-
* See the LICENSE file in the root directory of this source tree.
|
| 7 |
-
*/const O=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],J=y("hand",O);/**
|
| 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 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/HeroBanner-DPijLb9x.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 B,T as v,g as y,Y as w,k as P,m as p,A as T,B as u,p as k,Z as E,b as M,_}from"./index-B3ruOzo6.js";import{j as e,r as o}from"./vendor-react-B4AQeu28.js";import{D as V,a as Q}from"./dialog-KaD0jw5O.js";import{R as $,L as G,C as Y,X as q,Y as W,T as X,f as F}from"./vendor-charts-D7t7JfSr.js";import{collection as A,query as S,limit as C,orderBy as L,getDocs as R}from"./vendor-firebase-firestore-CP9q7ISf.js";import{X as K}from"./x-BNHnAXzL.js";import{C as D}from"./circle-alert-CTR2Lqp7.js";import{S as U}from"./shield-alert-kYf2Mbtd.js";import{C as Z}from"./circle-check-DyFN6-07.js";import{S as O}from"./sparkles-Bq0AaIRg.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-BPuEd8FG.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.
|
| 6 |
+
* See the LICENSE file in the root directory of this source tree.
|
| 7 |
+
*/const J=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],I=B("hand",J),ee=({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(Y,{strokeDasharray:"3 3",stroke:"#e2e8f0"}),e.jsx(q,{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 se(s){const t=A(y,"assessmentResults",s,"attempts"),a=S(t,L("completedAt","desc"),C(10));return(await R(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 te(s){const t=A(y,"assessmentResults",s,"attempts"),a=S(t,L("completedAt","desc"),C(1)),i=await R(a);if(i.empty)return null;const r=i.docs[0].data();return{...r,completedAt:r.completedAt?.toDate?.()?.toISOString()||r.completedAt}}const ae={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"},re=({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 ${ae[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(O,{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(k,{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))})]})]}),le=({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
|
| 8 |
+
${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(U,{className:"w-4 h-4"}):s.latestRiskLevel==="Needs Attention"?e.jsx(D,{className:"w-4 h-4"}):e.jsx(Z,{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(k,{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})]})]}),oe=({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(le,{summary:s}):t?e.jsx(re,{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(D,{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."})]}),ie=({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=w(a,h=>{N(h)});return()=>l()}},[s,a,n]);const z=n||x;o.useEffect(()=>{s&&a&&(g(!0),Promise.all([i?Promise.resolve(i):te(a),se(a)]).then(([l,h])=>{c(l),j(h)}).catch(console.error).finally(()=>g(!1)))},[s,a,i]);const H=[{key:"latest",label:"Last Results",icon:e.jsx(T,{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:H.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(P,{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(oe,{heroBannerSummary:z,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(ee,{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")]})})]})})},ne=o.lazy(()=>_(()=>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=w(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(E,{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(I,{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(M,{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(ie,{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(ne,{layers:a,className:"w-full h-full scale-[1.25] lg:scale-[1.3] origin-bottom"})})})})]})};export{Ae as default};
|
assets/{InitialAssessmentModal-BbFsU9kR.js β InitialAssessmentModal-C4M589Rr.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{B as j}from"./button-
|
|
|
|
| 1 |
+
import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{B as j}from"./button-CaSK4KoS.js";import{g as y}from"./diagnosticService-CLsUcd9M.js";import{updateDoc as N,doc as v,serverTimestamp as w}from"./vendor-firebase-firestore-CP9q7ISf.js";import{m as o,B as k,v as C,o as L,g as z}from"./index-B3ruOzo6.js";import{X as S}from"./x-BNHnAXzL.js";import{C as A}from"./circle-check-big-CWdn1Nqf.js";import"./vendor-radix-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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-CoNMThBG.js β LeaderboardPage-BGY9czx-.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
-
import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{
|
| 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"}]],te=O("badge-check",ee),se=({student:s,onClose:f})=>{const[i,u]=l.useState([]),[p,h]=l.useState(!1);if(l.useEffect(()=>{s?.uid&&(h(!0),W(s.uid).then(u).catch(d=>console.error("Failed to load achievements:",d)).finally(()=>h(!1)))},[s?.uid]),!s)return null;const j={trophy:e.jsx(m,{size:24,className:"text-rose-500"}),flame:e.jsx(U,{size:24,className:"text-orange-500"}),star:e.jsx(H,{size:24,className:"text-rose-400"}),"book-open":e.jsx(y,{size:24,className:"text-sky-600"}),"badge-check":e.jsx(te,{size:24,className:"text-emerald-600"}),crown:e.jsx(T,{size:24,className:"text-rose-500"}),target:e.jsx(P,{size:24,className:"text-rose-500"})};return e.jsx(q,{children:e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[e.jsx(n.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:f,className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),e.jsxs(n.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:f,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:s.avatar}),s.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:s.name}),e.jsx("p",{className:"text-slate-500 mb-4",children:s.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:s.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:s.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:s.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:[s.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:s.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:s.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:["#",s.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:["#",s.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:s.rank.change>0?e.jsxs("span",{className:"flex items-center gap-1 text-emerald-600",children:[e.jsx(E,{size:20}),"+",s.rank.change]}):s.rank.change<0?e.jsxs("span",{className:"flex items-center gap-1 text-red-600",children:[e.jsx(E,{size:20,className:"rotate-180"}),s.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(_,{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:s,onBack:f})=>{const{currentUser:i,userProfile:u}=$(),p=u,{leaderboard:h,loading:j}=J(i?.uid||null),[d]=l.useState("section"),[g,I]=l.useState("weekly"),[M,z]=l.useState(null),[Y,v]=l.useState(!0),[F,S]=l.useState(null),[D,C]=l.useState([]),w=[p?.grade,p?.section].filter(Boolean).join(" - "),N=l.useCallback(async()=>{if(!i){v(!1);return}v(!0),S(null);try{const t=g==="all"?"all":"week",r=await Q(i.uid,!1,t,20);if(!r||r.length===0){C([]);return}const c=r.map(a=>({id:a.userId,uid:a.userId,name:a.name,avatar:a.userId===i.uid?s||a.photo||"":a.photo||"",level:a.level,totalXP:a.xp,section:w||"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(c)}catch(t){console.error("Error loading leaderboard:",t),S(t instanceof Error?t.message:"Failed to load leaderboard")}finally{v(!1)}},[i,w,g,s]);l.useEffect(()=>{N()},[N]);const x=(()=>{let t=D;if(d==="section"){const c=w||"";c&&(t=t.filter(a=>a.section===c))}return t.sort((c,a)=>{const B=d==="section"?"section":"global";return(c.rank[B]||999)-(a.rank[B]||999)})})(),A=x.find(t=>t.isYou)?.rank.section||x.length+1,R=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),b=(t,r)=>t?t.startsWith("http")||t.startsWith("data:")?e.jsx("img",{src:t,alt:"Avatar",className:"w-full h-full object-cover rounded-full"}):e.jsx(X,{size:r,className:"text-slate-400 opacity-70"}):e.jsx(X,{size:r,className:"text-slate-400 opacity-70"});return Y?e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-3",children:[e.jsx(_,{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:N,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(_,{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-[-20px] top-0 h-[100vh] min-h-[800px] z-[-1] pointer-events-none overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_50%_100%,#9333ea_0%,#c084fc_40%,transparent_80%)]"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-[250vw] md:w-[200vw] h-[150vh] opacity-75 pointer-events-none",style:{WebkitMaskImage:"radial-gradient(circle at 50% 100%, black 10%, transparent 60%)"},children:e.jsx(n.div,{className:"absolute bottom-0 left-1/2 w-[600vw] h-[600vw] md:w-[400vw] md:h-[400vw]",style:{x:"-50%",y:"50%",originX:.5,originY:.5,background:`repeating-conic-gradient(from 0deg at 50% 50%,
|
| 7 |
rgba(255,255,255,0.7) 0deg, rgba(255,255,255,0.7) 6deg,
|
| 8 |
-
transparent 6deg, transparent 12deg)`},animate:{rotate:360},transition:{duration:160,repeat:1/0,ease:"linear"}})}),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]",style:{WebkitMaskImage:"linear-gradient(to bottom, transparent, black 15%)"}}),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(t=>e.jsx("button",{onClick:()=>I(t),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===t?"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:t==="all"?"All Time":t},t))}),e.jsxs(n.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(R),"%"]})," of other players!"]})})]}),e.jsxs("div",{className:"w-full max-w-[1000px] flex items-end justify-center gap-3 md:gap-6 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(n.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-[30%] sm:w-[32%] max-w-[280px] 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:b(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(n.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-[38%] sm:w-[40%] max-w-[330px]",children:[e.jsxs("div",{className:"flex flex-col items-center mb-3 md:mb-5 relative z-40 w-full",children:[e.jsx(n.div,{animate:{y:[0,-6,0]},transition:{repeat:1/0,duration:2.2,ease:"easeInOut"},className:"mb-[-10px] z-30",children:e.jsx(T,{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:b(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(n.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-[30%] sm:w-[32%] max-w-[280px] 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:b(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-32 px-4 sm:px-10 flex flex-col items-center mt-[-20px] md:mt-[-40px] transition-all duration-300 hover:-translate-y-2 min-h-[50vh] group",children:[e.jsxs("div",{className:"absolute top-0 left-0 right-0 bottom-[-500px] z-[-2] overflow-hidden rounded-t-[2.5rem] pointer-events-none",children:[e.jsx("div",{className:"absolute top-[-5%] left-[-10%] w-[70%] h-[400px] bg-purple-400/30 rounded-full blur-[100px]"}),e.jsx("div",{className:"absolute top-[15%] right-[-5%] w-[60%] h-[350px] bg-amber-300/20 rounded-full blur-[120px]"}),e.jsx("div",{className:"absolute top-[45%] left-[15%] w-[80%] h-[400px] bg-fuchsia-300/20 rounded-full blur-[120px]"})]}),e.jsx("div",{className:"absolute top-0 left-0 right-0 bottom-[-500px] z-[-1] rounded-t-[2.5rem] bg-gradient-to-b from-white/60 to-white/20 backdrop-blur-2xl transition-all duration-300 shadow-[0_-15px_40px_rgba(0,0,0,0.1),inset_0_2px_15px_rgba(255,255,255,0.7),inset_0_1px_1px_rgba(255,255,255,1)] group-hover:shadow-[0_-20px_50px_rgba(0,0,0,0.15),inset_0_2px_15px_rgba(255,255,255,0.8),inset_0_1px_1px_rgba(255,255,255,1)] border-t border-white/80"}),e.jsx("div",{className:"w-12 h-1.5 bg-slate-300/60 rounded-full mb-6 mt-[-10px] shadow-[inset_0_1px_2px_rgba(0,0,0,0.1)] backdrop-blur-md"}),e.jsxs("div",{className:"w-full max-w-4xl space-y-3.5",children:[L.map((t,r)=>{const c=t.rank.global||r+4;return e.jsxs(n.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{delay:r*.05+.3},onClick:()=>z(t),className:`flex items-center gap-4 p-3.5 md:p-4 rounded-3xl cursor-pointer bg-white border transition-all duration-300 ${t.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:c}),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:b(t.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:[t.name,t.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:[t.totalXP," ",e.jsx("span",{className:"text-[10px] text-slate-400 font-normal uppercase",children:"XP"})]})})]})]},t.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(se,{student:M,onClose:()=>z(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};
|
|
|
|
| 1 |
+
import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{e as O,aF as W,k as H,m as n,a as y,p as P,A as k,z as m,T as E,o as _,a0 as T,a1 as U,V as q,u as G,aG as V,R as $,L as K,x as X}from"./index-B3ruOzo6.js";import{X as Q}from"./x-BNHnAXzL.js";import{C as Z}from"./clock-C73na4Cu.js";import{u as J}from"./useFeatureAccess-CSvNejlY.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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"}]],te=O("badge-check",ee),se=({student:s,onClose:f})=>{const[i,u]=l.useState([]),[p,h]=l.useState(!1);if(l.useEffect(()=>{s?.uid&&(h(!0),W(s.uid).then(u).catch(d=>console.error("Failed to load achievements:",d)).finally(()=>h(!1)))},[s?.uid]),!s)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(te,{size:24,className:"text-emerald-600"}),crown:e.jsx(T,{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(n.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:f,className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),e.jsxs(n.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:f,className:"absolute top-4 right-4 p-2 hover:bg-slate-100 rounded-xl transition-colors z-10",children:e.jsx(Q,{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:s.avatar}),s.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:s.name}),e.jsx("p",{className:"text-slate-500 mb-4",children:s.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:s.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:s.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:s.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:[s.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:s.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:s.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:["#",s.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:["#",s.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:s.rank.change>0?e.jsxs("span",{className:"flex items-center gap-1 text-emerald-600",children:[e.jsx(E,{size:20}),"+",s.rank.change]}):s.rank.change<0?e.jsxs("span",{className:"flex items-center gap-1 text-red-600",children:[e.jsx(E,{size:20,className:"rotate-180"}),s.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(_,{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:s,onBack:f})=>{const{currentUser:i,userProfile:u}=G(),p=u,{leaderboard:h,loading:j}=J(i?.uid||null),[d]=l.useState("section"),[g,I]=l.useState("weekly"),[M,z]=l.useState(null),[R,v]=l.useState(!0),[F,S]=l.useState(null),[Y,C]=l.useState([]),w=[p?.grade,p?.section].filter(Boolean).join(" - "),N=l.useCallback(async()=>{if(!i){v(!1);return}v(!0),S(null);try{const t=g==="all"?"all":"week",r=await V(i.uid,!1,t,20);if(!r||r.length===0){C([]);return}const c=r.map(a=>({id:a.userId,uid:a.userId,name:a.name,avatar:a.userId===i.uid?s||a.photo||"":a.photo||"",level:a.level,totalXP:a.xp,section:w||"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(c)}catch(t){console.error("Error loading leaderboard:",t),S(t instanceof Error?t.message:"Failed to load leaderboard")}finally{v(!1)}},[i,w,g,s]);l.useEffect(()=>{N()},[N]);const x=(()=>{let t=Y;if(d==="section"){const c=w||"";c&&(t=t.filter(a=>a.section===c))}return t.sort((c,a)=>{const B=d==="section"?"section":"global";return(c.rank[B]||999)-(a.rank[B]||999)})})(),A=x.find(t=>t.isYou)?.rank.section||x.length+1,D=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),b=(t,r)=>t?t.startsWith("http")||t.startsWith("data:")?e.jsx("img",{src:t,alt:"Avatar",className:"w-full h-full object-cover rounded-full"}):e.jsx(X,{size:r,className:"text-slate-400 opacity-70"}):e.jsx(X,{size:r,className:"text-slate-400 opacity-70"});return R?e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-3",children:[e.jsx(_,{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:N,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($,{size:14}),"Try Again"]})]}):j?e.jsxs("div",{className:"flex flex-col justify-center items-center h-[500px] gap-3",children:[e.jsx(_,{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-[-20px] top-0 h-[100vh] min-h-[800px] z-[-1] pointer-events-none overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_50%_100%,#9333ea_0%,#c084fc_40%,transparent_80%)]"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-[250vw] md:w-[200vw] h-[150vh] opacity-75 pointer-events-none",style:{WebkitMaskImage:"radial-gradient(circle at 50% 100%, black 10%, transparent 60%)"},children:e.jsx(n.div,{className:"absolute bottom-0 left-1/2 w-[600vw] h-[600vw] md:w-[400vw] md:h-[400vw]",style:{x:"-50%",y:"50%",originX:.5,originY:.5,background:`repeating-conic-gradient(from 0deg at 50% 50%,
|
| 7 |
rgba(255,255,255,0.7) 0deg, rgba(255,255,255,0.7) 6deg,
|
| 8 |
+
transparent 6deg, transparent 12deg)`},animate:{rotate:360},transition:{duration:160,repeat:1/0,ease:"linear"}})}),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]",style:{WebkitMaskImage:"linear-gradient(to bottom, transparent, black 15%)"}}),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(t=>e.jsx("button",{onClick:()=>I(t),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===t?"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:t==="all"?"All Time":t},t))}),e.jsxs(n.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(D),"%"]})," of other players!"]})})]}),e.jsxs("div",{className:"w-full max-w-[1000px] flex items-end justify-center gap-3 md:gap-6 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(n.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-[30%] sm:w-[32%] max-w-[280px] 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:b(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(n.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-[38%] sm:w-[40%] max-w-[330px]",children:[e.jsxs("div",{className:"flex flex-col items-center mb-3 md:mb-5 relative z-40 w-full",children:[e.jsx(n.div,{animate:{y:[0,-6,0]},transition:{repeat:1/0,duration:2.2,ease:"easeInOut"},className:"mb-[-10px] z-30",children:e.jsx(T,{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:b(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(n.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-[30%] sm:w-[32%] max-w-[280px] 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:b(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-32 px-4 sm:px-10 flex flex-col items-center mt-[-20px] md:mt-[-40px] transition-all duration-300 hover:-translate-y-2 min-h-[50vh] group",children:[e.jsxs("div",{className:"absolute top-0 left-0 right-0 bottom-[-500px] z-[-2] overflow-hidden rounded-t-[2.5rem] pointer-events-none",children:[e.jsx("div",{className:"absolute top-[-5%] left-[-10%] w-[70%] h-[400px] bg-purple-400/30 rounded-full blur-[100px]"}),e.jsx("div",{className:"absolute top-[15%] right-[-5%] w-[60%] h-[350px] bg-amber-300/20 rounded-full blur-[120px]"}),e.jsx("div",{className:"absolute top-[45%] left-[15%] w-[80%] h-[400px] bg-fuchsia-300/20 rounded-full blur-[120px]"})]}),e.jsx("div",{className:"absolute top-0 left-0 right-0 bottom-[-500px] z-[-1] rounded-t-[2.5rem] bg-gradient-to-b from-white/60 to-white/20 backdrop-blur-2xl transition-all duration-300 shadow-[0_-15px_40px_rgba(0,0,0,0.1),inset_0_2px_15px_rgba(255,255,255,0.7),inset_0_1px_1px_rgba(255,255,255,1)] group-hover:shadow-[0_-20px_50px_rgba(0,0,0,0.15),inset_0_2px_15px_rgba(255,255,255,0.8),inset_0_1px_1px_rgba(255,255,255,1)] border-t border-white/80"}),e.jsx("div",{className:"w-12 h-1.5 bg-slate-300/60 rounded-full mb-6 mt-[-10px] shadow-[inset_0_1px_2px_rgba(0,0,0,0.1)] backdrop-blur-md"}),e.jsxs("div",{className:"w-full max-w-4xl space-y-3.5",children:[L.map((t,r)=>{const c=t.rank.global||r+4;return e.jsxs(n.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{delay:r*.05+.3},onClick:()=>z(t),className:`flex items-center gap-4 p-3.5 md:p-4 rounded-3xl cursor-pointer bg-white border transition-all duration-300 ${t.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:c}),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:b(t.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:[t.name,t.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:[t.totalXP," ",e.jsx("span",{className:"text-[10px] text-slate-400 font-normal uppercase",children:"XP"})]})})]})]},t.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(se,{student:M,onClose:()=>z(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-B69Oihj_.js β LearningPath-BIfd3u7Y.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{r as m,d as p,j as r}from"./vendor-react-B4AQeu28.js";import{
|
|
|
|
| 1 |
+
import{r as m,d as p,j as r}from"./vendor-react-B4AQeu28.js";import{u as j,a5 as P,a6 as I,w as N,a as k,b as w}from"./index-B3ruOzo6.js";import{M as L}from"./ModuleFolderCard-DKst1S7k.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.js";import"./vendor-markdown-yqZQ_iQm.js";import"./useSubjectAvailability-D7FKRlYS.js";import"./clock-C73na4Cu.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(w,{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(L,{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-CptqcE8b.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{r as s,j as e}from"./vendor-react-B4AQeu28.js";import{B as Me}from"./button-CaSK4KoS.js";import{I as D}from"./input-kh84w1XK.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-B3ruOzo6.js";import{S as Ie}from"./sparkles-Bq0AaIRg.js";import{M as Le}from"./mail-BXNRz1ib.js";import{E as De,a as ze}from"./eye-WyNbhirJ.js";import{S as qe}from"./shield-check-Cwi1kdxV.js";import"./vendor-radix-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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/LoginPage-CqIFZBqL.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
| 1 |
-
import{r as s,j as e}from"./vendor-react-B4AQeu28.js";import{B as Me}from"./button-BqKfG4Jj.js";import{I as D}from"./input-DEPoMoHZ.js";import{c as Ee,m as r,B as Te,T as Ce,A as Re,U as te,G as se,a as ae,L as re,b as ie,s as oe,d as Ie,e as le}from"./index-mbyiCUYG.js";import{S as Le}from"./sparkles-THbTTiEe.js";import{M as De}from"./mail-DWQ9UHXG.js";import{E as ze,a as _e}from"./eye-DakyBxPE.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.
|
| 5 |
-
* See the LICENSE file in the root directory of this source tree.
|
| 6 |
-
*/const qe=[["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:"m9 12 2 2 4-4",key:"dzmm74"}]],Be=Ee("shield-check",qe),ne="/assets/shader-bg-DA7bEbBA.mp4",Oe=[{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.",Ve=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}},Ge=i=>i.replace(/^Firebase:\s*/i,"").replace(/\s*\(auth\/[a-z-]+\)\.?/i,"").trim(),ce=(i,c)=>{const{code:o,message:d}=Ve(i),h=Ge(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},it=()=>{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,_]=s.useState(""),[A,de]=s.useState(!1),[l,q]=s.useState(!1),[M,ue]=s.useState(""),[n,B]=s.useState("student"),[b,me]=s.useState("Grade 11"),[w,O]=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),C=s.useRef(null),R=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(()=>Oe.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=C.current?.duration;t&&Number.isFinite(t)&&t>0&&Z(t)},ve=()=>{const t=R.current?.duration;t&&Number.isFinite(t)&&t>0&&Z(t)};s.useEffect(()=>{if(!N)return;const t=C.current,a=R.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)&&O(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:Be,color:"rose"}],ke=async(t,a,u)=>{m(null),x(!0),h(t),_(a),B(u),q(!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 Ie(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:C,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:R,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(Le,{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:Te,label:"AI Predictions",desc:"Smart detection",color:"sky"},{icon:Ce,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:()=>B(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=>O(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(De,{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=>_(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(ze,{size:16}):e.jsx(_e,{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:()=>{q(!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{it as default};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/{LogoutActionButton-DQLJH-aF.js β LogoutActionButton-D5BV__Zd.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{
|
| 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,j as i}from"./index-B3ruOzo6.js";import{j as t}from"./vendor-react-B4AQeu28.js";import{L as l}from"./log-out-CoRJnfoO.js";/**
|
| 2 |
* @license lucide-react v0.487.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
assets/{ModuleFolderCard-BQjDrVls.js β ModuleFolderCard-DKst1S7k.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{j as e}from"./vendor-react-B4AQeu28.js";import{u as g}from"./useSubjectAvailability-
|
| 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-D7FKRlYS.js";import{e as w,m as f,a as j,v,L as k}from"./index-B3ruOzo6.js";import{C as y}from"./clock-C73na4Cu.js";/**
|
| 2 |
* @license lucide-react v0.487.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
assets/{ModulesPage-CyxYQpv4.js β ModulesPage-D_ceNMZi.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
assets/NotificationDropdown-IzxN6ZqA.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import{e as t,y as h,k as b,m as f,b as u,U as y}from"./index-B3ruOzo6.js";import{j as e}from"./vendor-react-B4AQeu28.js";import"./vendor-firebase-firestore-CP9q7ISf.js";import{C as N,f as w}from"./formatDistanceToNow-DTsqWUq4.js";import{B as c}from"./bell-Bp_utT8v.js";import{C as k}from"./circle-check-DyFN6-07.js";import{C as j}from"./circle-alert-CTR2Lqp7.js";import{S as g}from"./sparkles-Bq0AaIRg.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 v=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],V=t("activity",v);/**
|
| 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 _=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],F=t("database",_);/**
|
| 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 A=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],B=t("file-text",A);/**
|
| 17 |
+
* @license lucide-react v0.487.0 - ISC
|
| 18 |
+
*
|
| 19 |
+
* This source code is licensed under the ISC license.
|
| 20 |
+
* See the LICENSE file in the root directory of this source tree.
|
| 21 |
+
*/const C=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],L=t("info",C),S=({isOpen:i,onClose:a,onViewAll:o})=>{const{notifications:n,markAsRead:d,markAllAsRead:x,unreadCount:m}=h(),r=n.slice(0,5),p=s=>{switch(s){case"sparkles":case"achievement_unlocked":case"level_up":return e.jsx(g,{className:"w-4 h-4"});case"alert-circle":case"risk_alert":case"system_alert":return e.jsx(j,{className:"w-4 h-4"});case"check-circle-2":case"quiz_result":return e.jsx(k,{className:"w-4 h-4"});case"users":case"new_assignment":return e.jsx(y,{className:"w-4 h-4"});default:return e.jsx(c,{className:"w-4 h-4"})}},l=s=>{switch(s){case"sparkles":case"achievement_unlocked":case"level_up":return"from-[#a855f7] to-[#9333ea] text-white bg-purple-50/30";case"alert-circle":case"risk_alert":case"system_alert":return"from-[#f43f5e] to-[#e11d48] text-white bg-rose-50/30";case"check-circle-2":case"quiz_result":return"bg-emerald-50 text-emerald-500 border border-emerald-100";case"users":case"new_assignment":return"bg-blue-50 text-blue-500 border border-blue-100";default:return"bg-slate-50 text-slate-500 border border-slate-100"}};return e.jsx(b,{children:i&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[90]",onClick:a}),e.jsxs(f.div,{initial:{opacity:0,scale:.95,y:-10,x:10},animate:{opacity:1,scale:1,y:0,x:0},exit:{opacity:0,scale:.95,y:-10,x:10},className:"fixed top-[80px] right-[24px] xl:right-[32px] w-[380px] bg-white/95 backdrop-blur-xl rounded-[20px] shadow-[0_8px_32px_rgba(0,0,0,0.12)] border border-white z-[100] flex flex-col overflow-hidden origin-top-right",children:[e.jsxs("div",{className:"p-4 border-b border-[#f1f5f9] flex justify-between items-center bg-white/50",children:[e.jsx("h3",{className:"text-[16px] font-bold text-[#1e293b]",children:"Notifications"}),e.jsxs("button",{onClick:()=>x(),disabled:m===0,className:"text-[12px] font-bold text-[#a855f7] hover:text-[#9333ea] transition-colors flex items-center gap-1.5 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:text-[#a855f7]",children:[e.jsx(N,{className:"w-3.5 h-3.5"})," Mark all as read"]})]}),e.jsx("div",{className:"max-h-[360px] overflow-y-auto no-scrollbar flex flex-col divide-y divide-[#f1f5f9]",children:r.length>0?r.map(s=>e.jsxs("div",{onClick:()=>{d(s.id)},className:`p-4 hover:bg-slate-50 transition-colors cursor-pointer flex gap-3 ${s.isRead?"opacity-70":l(s.type).split(" ")[2]}`,children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center shrink-0 shadow-sm ${l(s.type).split(" ").slice(0,2).join(" ")}`,children:p(s.type)}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex justify-between items-start mb-0.5",children:[e.jsx("h4",{className:"text-[13px] font-bold text-[#1e293b]",children:s.title}),!s.isRead&&e.jsx("span",{className:"w-2 h-2 rounded-full bg-[#a855f7] shadow-[0_0_4px_rgba(168,85,247,0.6)] mt-1"})]}),e.jsx("p",{className:"text-[12px] text-[#475569] line-clamp-2 leading-relaxed",children:s.message}),e.jsxs("span",{className:`text-[10px] font-bold mt-1 block ${s.isRead?"text-[#94a3b8]":"text-[#a855f7]"}`,children:[w(s.createdAt)," ago"]})]})]},s.id)):e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(c,{className:"w-8 h-8 text-[#94a3b8] mx-auto mb-2 opacity-20"}),e.jsx("p",{className:"text-[13px] font-medium text-[#64748b]",children:"No new notifications"})]})}),e.jsx("div",{className:"p-3 border-t border-[#f1f5f9] bg-white",children:e.jsxs("button",{onClick:()=>{o(),a()},className:"w-full py-2 bg-purple-50 text-[#9333ea] hover:bg-purple-100 transition-colors rounded-xl text-[13px] font-bold flex items-center justify-center gap-2",children:["View All Notifications ",e.jsx(u,{className:"w-4 h-4"})]})})]})]})})};export{V as A,F as D,B as F,L as I,S as N};
|
assets/ProfileModal-BLj_o7UC.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
import{r,j as e}from"./vendor-react-B4AQeu28.js";import{B as c}from"./button-BqKfG4Jj.js";import{I as d}from"./input-DEPoMoHZ.js";import{S as _,a as R,c as U,d as h}from"./select-B04HpeAZ.js";import{c 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-mbyiCUYG.js";import{P as V,M as z,V as C}from"./ProfilePictureUploader-Byg9gnjl.js";import{X}from"./x-oZO0Ye1Q.js";import{M as Y}from"./mail-DWQ9UHXG.js";import{C as L}from"./circle-help-BP0kOuya.js";import{S as $}from"./save-DgO_wXsk.js";import"./vendor-radix-xDOIcVzp.js";import"./vendor-charts-Ckgeb0nY.js";import"./chevron-up-B_-cQcm8.js";import"./check-BLN5Dl8e.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-BEbLkPkH.js";import"./plus-CbpDHvDO.js";import"./upload-CKMt4jtd.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/ProfileModal-xyqhi5Hx.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import{r,j as e}from"./vendor-react-B4AQeu28.js";import{e as S,k as _,m as k,U as h,A as c,a as w,D,W as R,aG as U,aP as B,l as T}from"./index-B3ruOzo6.js";import{B as x}from"./button-CaSK4KoS.js";import{I as d}from"./input-kh84w1XK.js";import{S as G,a as $,c as q,d as p}from"./select-C142YWNr.js";import{P as V,M as z,V as C,v as X}from"./ProfilePictureUploader-B3ToJmez.js";import{X as Y}from"./x-BNHnAXzL.js";import{M as H}from"./mail-BXNRz1ib.js";import{C as L}from"./circle-help-C5HGdkRZ.js";import{S as K}from"./save-DXz2z5YH.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.js";import"./vendor-markdown-yqZQ_iQm.js";import"./chevron-up-CTb5_AvY.js";import"./check-6eXlU5jr.js";import"./minus-B69_eMXI.js";import"./plus-Dx0gdu7_.js";import"./upload-BBhypj4u.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"}]],Q=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 W=[["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"}]],J=S("phone",W),Ne=({isOpen:i,onClose:o,profileData:u,onSave:E})=>{const[s,t]=r.useState(u),[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([U(void 0,!1,"all",5),B(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 P=()=>{const a=X({name:s.name,phone:s.phone});if(a){T.error(a);return}E(s),b(!1)},I=()=>{t(u),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(_,{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(Y,{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(h,{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,maxLength:100,autoComplete:"name",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(H,{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(J,{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,type:"tel",inputMode:"tel",maxLength:20,autoComplete:"tel",pattern:"^\\+?[0-9 ()\\-.]{7,20}$",placeholder:"+63 912 345 6789",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(G,{value:s.gender||"",onValueChange:a=>{t({...s,gender:a||void 0})},disabled:!l,children:[e.jsx($,{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(q,{children:[e.jsx(p,{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(p,{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(p,{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(Q,{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(c,{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(h,{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(c,{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(D,{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(c,{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(c,{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(h,{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(R,{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(x,{onClick:I,variant:"outline",className:"px-5 py-2 rounded-lg border-[#d1cec6] hover:bg-white font-body font-medium text-[#5a6578]",children:"Cancel"}),e.jsxs(x,{onClick:P,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(K,{size:16}),"Save Changes"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(x,{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(x,{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{Ne as default};
|
assets/ProfilePictureUploader-B3ToJmez.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import{e as Re,j as be,I as Ue,a_ as Gt,a$ as Kt,u as Xt,O as Yt,P as Qt,Q as er,k as tr,m as Me,l as Fe}from"./index-B3ruOzo6.js";import{g as rr,r as x,j as g}from"./vendor-react-B4AQeu28.js";import{_ as nr,o as R,p as or,q as ir,r as sr,s as ar}from"./vendor-radix-BPuEd8FG.js";import{B as Le}from"./button-CaSK4KoS.js";import{updateProfile as cr}from"./vendor-firebase-auth-Bcpr4O6E.js";import"./vendor-firebase-core-DCQrgkxC.js";import{r as ur,u as lr,a as dr}from"./vendor-firebase-storage-dc5X5yTv.js";import{X as pr}from"./x-BNHnAXzL.js";import{M as fr}from"./minus-B69_eMXI.js";import{P as hr}from"./plus-Dx0gdu7_.js";import{U as mr}from"./upload-BBhypj4u.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 gr=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],vr=Re("camera",gr);/**
|
| 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 _r=[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"m21 3-6.75 6.75",key:"pv0uzu"}],["circle",{cx:"10",cy:"14",r:"6",key:"1qwbdc"}]],Da=Re("mars",_r);/**
|
| 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 wr=[["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M9 19h6",key:"456am0"}],["circle",{cx:"12",cy:"9",r:"6",key:"1nw4tq"}]],ja=Re("venus",wr);function d(e,r,t){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),r(a,c);const u=i.prototype,l=Object.keys(u);for(let f=0;f<l.length;f++){const p=l[f];p in a||(a[p]=u[p].bind(a))}}const o=t?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=t?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>t?.Parent&&a instanceof t.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class H extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _t extends Error{constructor(r){super(`Encountered unidirectional transform during encode: ${r}`),this.name="ZodEncodeError"}}const wt={};function J(e){return wt}function yt(e){const r=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>r.indexOf(+n)===-1).map(([n,o])=>o)}function Ce(e,r){return typeof r=="bigint"?r.toString():r}function Oe(e){return{get value(){{const r=e();return Object.defineProperty(this,"value",{value:r}),r}}}}function Te(e){return e==null}function De(e){const r=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(r,t)}const We=Symbol("evaluating");function z(e,r,t){let n;Object.defineProperty(e,r,{get(){if(n!==We)return n===void 0&&(n=We,n=t()),n},set(o){Object.defineProperty(e,r,{value:o})},configurable:!0})}function V(e,r,t){Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})}function M(...e){const r={};for(const t of e){const n=Object.getOwnPropertyDescriptors(t);Object.assign(r,n)}return Object.defineProperties({},r)}function Je(e){return JSON.stringify(e)}function yr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const zt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function de(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const zr=Oe(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function re(e){if(de(e)===!1)return!1;const r=e.constructor;if(r===void 0||typeof r!="function")return!0;const t=r.prototype;return!(de(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function bt(e){return re(e)?{...e}:Array.isArray(e)?[...e]:e}const br=new Set(["string","number","symbol"]);function me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(e,r,t){const n=new e._zod.constr(r??e._zod.def);return(!r||t?.parent)&&(n._zod.parent=e),n}function m(e){const r=e;if(!r)return{};if(typeof r=="string")return{error:()=>r};if(r?.message!==void 0){if(r?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");r.error=r.message}return delete r.message,typeof r.error=="string"?{...r,error:()=>r.error}:r}function Sr(e){return Object.keys(e).filter(r=>e[r]._zod.optin==="optional"&&e[r]._zod.optout==="optional")}function kr(e,r){const t=e._zod.def,n=t.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=M(e._zod.def,{get shape(){const i={};for(const a in r){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=t.shape[a])}return V(this,"shape",i),i},checks:[]});return F(e,s)}function Pr(e,r){const t=e._zod.def,n=t.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=M(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in r){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);r[a]&&delete i[a]}return V(this,"shape",i),i},checks:[]});return F(e,s)}function Er(e,r){if(!re(r))throw new Error("Invalid input to extend: expected a plain object");const t=e._zod.def.checks;if(t&&t.length>0){const s=e._zod.def.shape;for(const i in r)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=M(e._zod.def,{get shape(){const s={...e._zod.def.shape,...r};return V(this,"shape",s),s}});return F(e,o)}function xr(e,r){if(!re(r))throw new Error("Invalid input to safeExtend: expected a plain object");const t=M(e._zod.def,{get shape(){const n={...e._zod.def.shape,...r};return V(this,"shape",n),n}});return F(e,t)}function Cr(e,r){const t=M(e._zod.def,{get shape(){const n={...e._zod.def.shape,...r._zod.def.shape};return V(this,"shape",n),n},get catchall(){return r._zod.def.catchall},checks:[]});return F(e,t)}function $r(e,r,t){const o=r._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=M(r._zod.def,{get shape(){const a=r._zod.def.shape,c={...a};if(t)for(const u in t){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return V(this,"shape",c),c},checks:[]});return F(r,i)}function Zr(e,r,t){const n=M(r._zod.def,{get shape(){const o=r._zod.def.shape,s={...o};if(t)for(const i in t){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return V(this,"shape",s),s}});return F(r,n)}function q(e,r=0){if(e.aborted===!0)return!0;for(let t=r;t<e.issues.length;t++)if(e.issues[t]?.continue!==!0)return!0;return!1}function St(e,r){return r.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ae(e){return typeof e=="string"?e:e?.message}function B(e,r,t){const n={...e,path:e.path??[]};if(!e.message){const o=ae(e.inst?._zod.def?.error?.(e))??ae(r?.error?.(e))??ae(t.customError?.(e))??ae(t.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,r?.reportInput||delete n.input,n}function je(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ne(...e){const[r,t,n]=e;return typeof r=="string"?{message:r,code:"custom",input:t,inst:n}:{...r}}const kt=(e,r)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:r,enumerable:!1}),e.message=JSON.stringify(r,Ce,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Pt=d("$ZodError",kt),Et=d("$ZodError",kt,{Parent:Error});function Rr(e,r=t=>t.message){const t={},n=[];for(const o of e.issues)o.path.length>0?(t[o.path[0]]=t[o.path[0]]||[],t[o.path[0]].push(r(o))):n.push(r(o));return{formErrors:n,fieldErrors:t}}function Or(e,r=t=>t.message){const t={_errors:[]},n=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>n({issues:i}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)t._errors.push(r(s));else{let i=t,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(r(s))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return n(e),t}const Ae=e=>(r,t,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},i=r._zod.run({value:t,issues:[]},s);if(i instanceof Promise)throw new H;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>B(c,s,J())));throw zt(a,o?.callee),a}return i.value},Ie=e=>async(r,t,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=r._zod.run({value:t,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>B(c,s,J())));throw zt(a,o?.callee),a}return i.value},ge=e=>(r,t,n)=>{const o=n?{...n,async:!1}:{async:!1},s=r._zod.run({value:t,issues:[]},o);if(s instanceof Promise)throw new H;return s.issues.length?{success:!1,error:new(e??Pt)(s.issues.map(i=>B(i,o,J())))}:{success:!0,data:s.value}},Tr=ge(Et),ve=e=>async(r,t,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=r._zod.run({value:t,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>B(i,o,J())))}:{success:!0,data:s.value}},Dr=ve(Et),jr=e=>(r,t,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ae(e)(r,t,o)},Ar=e=>(r,t,n)=>Ae(e)(r,t,n),Ir=e=>async(r,t,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ie(e)(r,t,o)},Nr=e=>async(r,t,n)=>Ie(e)(r,t,n),Ur=e=>(r,t,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ge(e)(r,t,o)},Mr=e=>(r,t,n)=>ge(e)(r,t,n),Fr=e=>async(r,t,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ve(e)(r,t,o)},Lr=e=>async(r,t,n)=>ve(e)(r,t,n),Wr=/^[cC][^\s-]{8,}$/,Jr=/^[0-9a-z]+$/,Br=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Vr=/^[0-9a-vA-V]{20}$/,qr=/^[A-Za-z0-9]{27}$/,Hr=/^[a-zA-Z0-9_-]{21}$/,Gr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Kr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Be=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Xr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Yr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Qr(){return new RegExp(Yr,"u")}const en=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,rn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,nn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,on=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,xt=/^[A-Za-z0-9_-]*$/,sn=/^\+[1-9]\d{6,14}$/,Ct="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",an=new RegExp(`^${Ct}$`);function $t(e){const r="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${r}`:e.precision===0?`${r}:[0-5]\\d`:`${r}:[0-5]\\d\\.\\d{${e.precision}}`:`${r}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cn(e){return new RegExp(`^${$t(e)}$`)}function un(e){const r=$t({precision:e.precision}),t=["Z"];e.local&&t.push(""),e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${r}(?:${t.join("|")})`;return new RegExp(`^${Ct}T(?:${n})$`)}const ln=e=>{const r=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${r}$`)},dn=/^[^A-Z]*$/,pn=/^[^a-z]*$/,N=d("$ZodCheck",(e,r)=>{var t;e._zod??(e._zod={}),e._zod.def=r,(t=e._zod).onattach??(t.onattach=[])}),fn=d("$ZodCheckMaxLength",(e,r)=>{var t;N.init(e,r),(t=e._zod.def).when??(t.when=n=>{const o=n.value;return!Te(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;r.maximum<o&&(n._zod.bag.maximum=r.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=r.maximum)return;const i=je(o);n.issues.push({origin:i,code:"too_big",maximum:r.maximum,inclusive:!0,input:o,inst:e,continue:!r.abort})}}),hn=d("$ZodCheckMinLength",(e,r)=>{var t;N.init(e,r),(t=e._zod.def).when??(t.when=n=>{const o=n.value;return!Te(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;r.minimum>o&&(n._zod.bag.minimum=r.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=r.minimum)return;const i=je(o);n.issues.push({origin:i,code:"too_small",minimum:r.minimum,inclusive:!0,input:o,inst:e,continue:!r.abort})}}),mn=d("$ZodCheckLengthEquals",(e,r)=>{var t;N.init(e,r),(t=e._zod.def).when??(t.when=n=>{const o=n.value;return!Te(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=r.length,o.maximum=r.length,o.length=r.length}),e._zod.check=n=>{const o=n.value,s=o.length;if(s===r.length)return;const i=je(o),a=s>r.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!r.abort})}}),_e=d("$ZodCheckStringFormat",(e,r)=>{var t,n;N.init(e,r),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=r.format,r.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(r.pattern))}),r.pattern?(t=e._zod).check??(t.check=o=>{r.pattern.lastIndex=0,!r.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:r.format,input:o.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:e,continue:!r.abort})}):(n=e._zod).check??(n.check=()=>{})}),gn=d("$ZodCheckRegex",(e,r)=>{_e.init(e,r),e._zod.check=t=>{r.pattern.lastIndex=0,!r.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:r.pattern.toString(),inst:e,continue:!r.abort})}}),vn=d("$ZodCheckLowerCase",(e,r)=>{r.pattern??(r.pattern=dn),_e.init(e,r)}),_n=d("$ZodCheckUpperCase",(e,r)=>{r.pattern??(r.pattern=pn),_e.init(e,r)}),wn=d("$ZodCheckIncludes",(e,r)=>{N.init(e,r);const t=me(r.includes),n=new RegExp(typeof r.position=="number"?`^.{${r.position}}${t}`:t);r.pattern=n,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(r.includes,r.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:o.value,inst:e,continue:!r.abort})}}),yn=d("$ZodCheckStartsWith",(e,r)=>{N.init(e,r);const t=new RegExp(`^${me(r.prefix)}.*`);r.pattern??(r.pattern=t),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(t)}),e._zod.check=n=>{n.value.startsWith(r.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:n.value,inst:e,continue:!r.abort})}}),zn=d("$ZodCheckEndsWith",(e,r)=>{N.init(e,r);const t=new RegExp(`.*${me(r.suffix)}$`);r.pattern??(r.pattern=t),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(t)}),e._zod.check=n=>{n.value.endsWith(r.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:n.value,inst:e,continue:!r.abort})}}),bn=d("$ZodCheckOverwrite",(e,r)=>{N.init(e,r),e._zod.check=t=>{t.value=r.tx(t.value)}});class Sn{constructor(r=[]){this.content=[],this.indent=0,this&&(this.args=r)}indented(r){this.indent+=1,r(this),this.indent-=1}write(r){if(typeof r=="function"){r(this,{execution:"sync"}),r(this,{execution:"async"});return}const n=r.split(`
|
| 17 |
+
`).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const r=Function,t=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new r(...t,o.join(`
|
| 18 |
+
`))}}const kn={major:4,minor:3,patch:6},C=d("$ZodType",(e,r)=>{var t;e??(e={}),e._zod.def=r,e._zod.bag=e._zod.bag||{},e._zod.version=kn;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const s of o._zod.onattach)s(e);if(n.length===0)(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,a,c)=>{let u=q(i),l;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(u)continue;const p=i.issues.length,h=f._zod.check(i);if(h instanceof Promise&&c?.async===!1)throw new H;if(l||h instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await h,i.issues.length!==p&&(u||(u=q(i,p)))});else{if(i.issues.length===p)continue;u||(u=q(i,p))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(q(i))return i.aborted=!0,i;const u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new H;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new H;return c.then(u=>o(u,n,a))}return o(c,n,a)}}z(e,"~standard",()=>({validate:o=>{try{const s=Tr(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Dr(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Ne=d("$ZodString",(e,r)=>{C.init(e,r),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ln(e._zod.bag),e._zod.parse=(t,n)=>{if(r.coerce)try{t.value=String(t.value)}catch{}return typeof t.value=="string"||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:e}),t}}),S=d("$ZodStringFormat",(e,r)=>{_e.init(e,r),Ne.init(e,r)}),Pn=d("$ZodGUID",(e,r)=>{r.pattern??(r.pattern=Kr),S.init(e,r)}),En=d("$ZodUUID",(e,r)=>{if(r.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[r.version];if(n===void 0)throw new Error(`Invalid UUID version: "${r.version}"`);r.pattern??(r.pattern=Be(n))}else r.pattern??(r.pattern=Be());S.init(e,r)}),xn=d("$ZodEmail",(e,r)=>{r.pattern??(r.pattern=Xr),S.init(e,r)}),Cn=d("$ZodURL",(e,r)=>{S.init(e,r),e._zod.check=t=>{try{const n=t.value.trim(),o=new URL(n);r.hostname&&(r.hostname.lastIndex=0,r.hostname.test(o.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:t.value,inst:e,continue:!r.abort})),r.protocol&&(r.protocol.lastIndex=0,r.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:t.value,inst:e,continue:!r.abort})),r.normalize?t.value=o.href:t.value=n;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!r.abort})}}}),$n=d("$ZodEmoji",(e,r)=>{r.pattern??(r.pattern=Qr()),S.init(e,r)}),Zn=d("$ZodNanoID",(e,r)=>{r.pattern??(r.pattern=Hr),S.init(e,r)}),Rn=d("$ZodCUID",(e,r)=>{r.pattern??(r.pattern=Wr),S.init(e,r)}),On=d("$ZodCUID2",(e,r)=>{r.pattern??(r.pattern=Jr),S.init(e,r)}),Tn=d("$ZodULID",(e,r)=>{r.pattern??(r.pattern=Br),S.init(e,r)}),Dn=d("$ZodXID",(e,r)=>{r.pattern??(r.pattern=Vr),S.init(e,r)}),jn=d("$ZodKSUID",(e,r)=>{r.pattern??(r.pattern=qr),S.init(e,r)}),An=d("$ZodISODateTime",(e,r)=>{r.pattern??(r.pattern=un(r)),S.init(e,r)}),In=d("$ZodISODate",(e,r)=>{r.pattern??(r.pattern=an),S.init(e,r)}),Nn=d("$ZodISOTime",(e,r)=>{r.pattern??(r.pattern=cn(r)),S.init(e,r)}),Un=d("$ZodISODuration",(e,r)=>{r.pattern??(r.pattern=Gr),S.init(e,r)}),Mn=d("$ZodIPv4",(e,r)=>{r.pattern??(r.pattern=en),S.init(e,r),e._zod.bag.format="ipv4"}),Fn=d("$ZodIPv6",(e,r)=>{r.pattern??(r.pattern=tn),S.init(e,r),e._zod.bag.format="ipv6",e._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e,continue:!r.abort})}}}),Ln=d("$ZodCIDRv4",(e,r)=>{r.pattern??(r.pattern=rn),S.init(e,r)}),Wn=d("$ZodCIDRv6",(e,r)=>{r.pattern??(r.pattern=nn),S.init(e,r),e._zod.check=t=>{const n=t.value.split("/");try{if(n.length!==2)throw new Error;const[o,s]=n;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e,continue:!r.abort})}}});function Zt(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Jn=d("$ZodBase64",(e,r)=>{r.pattern??(r.pattern=on),S.init(e,r),e._zod.bag.contentEncoding="base64",e._zod.check=t=>{Zt(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e,continue:!r.abort})}});function Bn(e){if(!xt.test(e))return!1;const r=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),t=r.padEnd(Math.ceil(r.length/4)*4,"=");return Zt(t)}const Vn=d("$ZodBase64URL",(e,r)=>{r.pattern??(r.pattern=xt),S.init(e,r),e._zod.bag.contentEncoding="base64url",e._zod.check=t=>{Bn(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e,continue:!r.abort})}}),qn=d("$ZodE164",(e,r)=>{r.pattern??(r.pattern=sn),S.init(e,r)});function Hn(e,r=null){try{const t=e.split(".");if(t.length!==3)return!1;const[n]=t;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||r&&(!("alg"in o)||o.alg!==r))}catch{return!1}}const Gn=d("$ZodJWT",(e,r)=>{S.init(e,r),e._zod.check=t=>{Hn(t.value,r.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:e,continue:!r.abort})}}),Kn=d("$ZodUnknown",(e,r)=>{C.init(e,r),e._zod.parse=t=>t}),Xn=d("$ZodNever",(e,r)=>{C.init(e,r),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function Ve(e,r,t){e.issues.length&&r.issues.push(...St(t,e.issues)),r.value[t]=e.value}const Yn=d("$ZodArray",(e,r)=>{C.init(e,r),e._zod.parse=(t,n)=>{const o=t.value;if(!Array.isArray(o))return t.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),t;t.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],c=r.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>Ve(u,t,i))):Ve(c,t,i)}return s.length?Promise.all(s).then(()=>t):t}});function pe(e,r,t,n,o){if(e.issues.length){if(o&&!(t in n))return;r.issues.push(...St(t,e.issues))}e.value===void 0?t in n&&(r.value[t]=void 0):r.value[t]=e.value}function Rt(e){const r=Object.keys(e.shape);for(const n of r)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const t=Sr(e.shape);return{...e,keys:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(t)}}function Ot(e,r,t,n,o,s){const i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(const f in r){if(a.has(f))continue;if(u==="never"){i.push(f);continue}const p=c.run({value:r[f],issues:[]},n);p instanceof Promise?e.push(p.then(h=>pe(h,t,f,r,l))):pe(p,t,f,r,l)}return i.length&&t.issues.push({code:"unrecognized_keys",keys:i,input:r,inst:s}),e.length?Promise.all(e).then(()=>t):t}const Qn=d("$ZodObject",(e,r)=>{if(C.init(e,r),!Object.getOwnPropertyDescriptor(r,"shape")?.get){const a=r.shape;Object.defineProperty(r,"shape",{get:()=>{const c={...a};return Object.defineProperty(r,"shape",{value:c}),c}})}const n=Oe(()=>Rt(r));z(e._zod,"propValues",()=>{const a=r.shape,c={};for(const u in a){const l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(const f of l.values)c[u].add(f)}}return c});const o=de,s=r.catchall;let i;e._zod.parse=(a,c)=>{i??(i=n.value);const u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const l=[],f=i.shape;for(const p of i.keys){const h=f[p],w=h._zod.optout==="optional",v=h._zod.run({value:u[p],issues:[]},c);v instanceof Promise?l.push(v.then(y=>pe(y,a,p,u,w))):pe(v,a,p,u,w)}return s?Ot(l,u,a,c,n.value,e):l.length?Promise.all(l).then(()=>a):a}}),eo=d("$ZodObjectJIT",(e,r)=>{Qn.init(e,r);const t=e._zod.parse,n=Oe(()=>Rt(r)),o=p=>{const h=new Sn(["shape","payload","ctx"]),w=n.value,v=_=>{const b=Je(_);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};h.write("const input = payload.value;");const y=Object.create(null);let D=0;for(const _ of w.keys)y[_]=`key_${D++}`;h.write("const newResult = {};");for(const _ of w.keys){const b=y[_],E=Je(_),X=p[_]?._zod?.optout==="optional";h.write(`const ${b} = ${v(_)};`),X?h.write(`
|
| 19 |
+
if (${b}.issues.length) {
|
| 20 |
+
if (${E} in input) {
|
| 21 |
+
payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
|
| 22 |
+
...iss,
|
| 23 |
+
path: iss.path ? [${E}, ...iss.path] : [${E}]
|
| 24 |
+
})));
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
if (${b}.value === undefined) {
|
| 29 |
+
if (${E} in input) {
|
| 30 |
+
newResult[${E}] = undefined;
|
| 31 |
+
}
|
| 32 |
+
} else {
|
| 33 |
+
newResult[${E}] = ${b}.value;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
`):h.write(`
|
| 37 |
+
if (${b}.issues.length) {
|
| 38 |
+
payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
|
| 39 |
+
...iss,
|
| 40 |
+
path: iss.path ? [${E}, ...iss.path] : [${E}]
|
| 41 |
+
})));
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
if (${b}.value === undefined) {
|
| 45 |
+
if (${E} in input) {
|
| 46 |
+
newResult[${E}] = undefined;
|
| 47 |
+
}
|
| 48 |
+
} else {
|
| 49 |
+
newResult[${E}] = ${b}.value;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
`)}h.write("payload.value = newResult;"),h.write("return payload;");const P=h.compile();return(_,b)=>P(p,_,b)};let s;const i=de,a=!wt.jitless,u=a&&zr.value,l=r.catchall;let f;e._zod.parse=(p,h)=>{f??(f=n.value);const w=p.value;return i(w)?a&&u&&h?.async===!1&&h.jitless!==!0?(s||(s=o(r.shape)),p=s(p,h),l?Ot([],w,p,h,f,e):p):t(p,h):(p.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),p)}});function qe(e,r,t,n){for(const s of e)if(s.issues.length===0)return r.value=s.value,r;const o=e.filter(s=>!q(s));return o.length===1?(r.value=o[0].value,o[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:t,errors:e.map(s=>s.issues.map(i=>B(i,n,J())))}),r)}const to=d("$ZodUnion",(e,r)=>{C.init(e,r),z(e._zod,"optin",()=>r.options.some(o=>o._zod.optin==="optional")?"optional":void 0),z(e._zod,"optout",()=>r.options.some(o=>o._zod.optout==="optional")?"optional":void 0),z(e._zod,"values",()=>{if(r.options.every(o=>o._zod.values))return new Set(r.options.flatMap(o=>Array.from(o._zod.values)))}),z(e._zod,"pattern",()=>{if(r.options.every(o=>o._zod.pattern)){const o=r.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>De(s.source)).join("|")})$`)}});const t=r.options.length===1,n=r.options[0]._zod.run;e._zod.parse=(o,s)=>{if(t)return n(o,s);let i=!1;const a=[];for(const c of r.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>qe(c,o,e,s)):qe(a,o,e,s)}}),ro=d("$ZodIntersection",(e,r)=>{C.init(e,r),e._zod.parse=(t,n)=>{const o=t.value,s=r.left._zod.run({value:o,issues:[]},n),i=r.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>He(t,c,u)):He(t,s,i)}});function $e(e,r){if(e===r)return{valid:!0,data:e};if(e instanceof Date&&r instanceof Date&&+e==+r)return{valid:!0,data:e};if(re(e)&&re(r)){const t=Object.keys(r),n=Object.keys(e).filter(s=>t.indexOf(s)!==-1),o={...e,...r};for(const s of n){const i=$e(e[s],r[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(r)){if(e.length!==r.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let n=0;n<e.length;n++){const o=e[n],s=r[n],i=$e(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};t.push(i.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function He(e,r,t){const n=new Map;let o;for(const a of r.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const c of a.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(a);for(const a of t.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(a);const s=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),q(e))return e;const i=$e(r.value,t.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const no=d("$ZodEnum",(e,r)=>{C.init(e,r);const t=yt(r.entries),n=new Set(t);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.filter(o=>br.has(typeof o)).map(o=>typeof o=="string"?me(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:t,input:i,inst:e}),o}}),oo=d("$ZodTransform",(e,r)=>{C.init(e,r),e._zod.parse=(t,n)=>{if(n.direction==="backward")throw new _t(e.constructor.name);const o=r.transform(t.value,t);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(t.value=i,t));if(o instanceof Promise)throw new H;return t.value=o,t}});function Ge(e,r){return e.issues.length&&r===void 0?{issues:[],value:void 0}:e}const Tt=d("$ZodOptional",(e,r)=>{C.init(e,r),e._zod.optin="optional",e._zod.optout="optional",z(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,void 0]):void 0),z(e._zod,"pattern",()=>{const t=r.innerType._zod.pattern;return t?new RegExp(`^(${De(t.source)})?$`):void 0}),e._zod.parse=(t,n)=>{if(r.innerType._zod.optin==="optional"){const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>Ge(s,t.value)):Ge(o,t.value)}return t.value===void 0?t:r.innerType._zod.run(t,n)}}),io=d("$ZodExactOptional",(e,r)=>{Tt.init(e,r),z(e._zod,"values",()=>r.innerType._zod.values),z(e._zod,"pattern",()=>r.innerType._zod.pattern),e._zod.parse=(t,n)=>r.innerType._zod.run(t,n)}),so=d("$ZodNullable",(e,r)=>{C.init(e,r),z(e._zod,"optin",()=>r.innerType._zod.optin),z(e._zod,"optout",()=>r.innerType._zod.optout),z(e._zod,"pattern",()=>{const t=r.innerType._zod.pattern;return t?new RegExp(`^(${De(t.source)}|null)$`):void 0}),z(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,null]):void 0),e._zod.parse=(t,n)=>t.value===null?t:r.innerType._zod.run(t,n)}),ao=d("$ZodDefault",(e,r)=>{C.init(e,r),e._zod.optin="optional",z(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);if(t.value===void 0)return t.value=r.defaultValue,t;const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>Ke(s,r)):Ke(o,r)}});function Ke(e,r){return e.value===void 0&&(e.value=r.defaultValue),e}const co=d("$ZodPrefault",(e,r)=>{C.init(e,r),e._zod.optin="optional",z(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>(n.direction==="backward"||t.value===void 0&&(t.value=r.defaultValue),r.innerType._zod.run(t,n))}),uo=d("$ZodNonOptional",(e,r)=>{C.init(e,r),z(e._zod,"values",()=>{const t=r.innerType._zod.values;return t?new Set([...t].filter(n=>n!==void 0)):void 0}),e._zod.parse=(t,n)=>{const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>Xe(s,e)):Xe(o,e)}});function Xe(e,r){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:r}),e}const lo=d("$ZodCatch",(e,r)=>{C.init(e,r),z(e._zod,"optin",()=>r.innerType._zod.optin),z(e._zod,"optout",()=>r.innerType._zod.optout),z(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>(t.value=s.value,s.issues.length&&(t.value=r.catchValue({...t,error:{issues:s.issues.map(i=>B(i,n,J()))},input:t.value}),t.issues=[]),t)):(t.value=o.value,o.issues.length&&(t.value=r.catchValue({...t,error:{issues:o.issues.map(s=>B(s,n,J()))},input:t.value}),t.issues=[]),t)}}),po=d("$ZodPipe",(e,r)=>{C.init(e,r),z(e._zod,"values",()=>r.in._zod.values),z(e._zod,"optin",()=>r.in._zod.optin),z(e._zod,"optout",()=>r.out._zod.optout),z(e._zod,"propValues",()=>r.in._zod.propValues),e._zod.parse=(t,n)=>{if(n.direction==="backward"){const s=r.out._zod.run(t,n);return s instanceof Promise?s.then(i=>ce(i,r.in,n)):ce(s,r.in,n)}const o=r.in._zod.run(t,n);return o instanceof Promise?o.then(s=>ce(s,r.out,n)):ce(o,r.out,n)}});function ce(e,r,t){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:e.value,issues:e.issues},t)}const fo=d("$ZodReadonly",(e,r)=>{C.init(e,r),z(e._zod,"propValues",()=>r.innerType._zod.propValues),z(e._zod,"values",()=>r.innerType._zod.values),z(e._zod,"optin",()=>r.innerType?._zod?.optin),z(e._zod,"optout",()=>r.innerType?._zod?.optout),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(Ye):Ye(o)}});function Ye(e){return e.value=Object.freeze(e.value),e}const ho=d("$ZodCustom",(e,r)=>{N.init(e,r),C.init(e,r),e._zod.parse=(t,n)=>t,e._zod.check=t=>{const n=t.value,o=r.fn(n);if(o instanceof Promise)return o.then(s=>Qe(s,t,n,e));Qe(o,t,n,e)}});function Qe(e,r,t,n){if(!e){const o={code:"custom",input:t,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),r.issues.push(ne(o))}}var et;class mo{constructor(){this._map=new WeakMap,this._idmap=new Map}add(r,...t){const n=t[0];return this._map.set(r,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,r),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(r){const t=this._map.get(r);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(r),this}get(r){const t=r._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(r)};return Object.keys(o).length?o:void 0}return this._map.get(r)}has(r){return this._map.has(r)}}function go(){return new mo}(et=globalThis).__zod_globalRegistry??(et.__zod_globalRegistry=go());const te=globalThis.__zod_globalRegistry;function vo(e,r){return new e({type:"string",...m(r)})}function _o(e,r){return new e({type:"string",format:"email",check:"string_format",abort:!1,...m(r)})}function tt(e,r){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...m(r)})}function wo(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...m(r)})}function yo(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...m(r)})}function zo(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...m(r)})}function bo(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...m(r)})}function So(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...m(r)})}function ko(e,r){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...m(r)})}function Po(e,r){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...m(r)})}function Eo(e,r){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...m(r)})}function xo(e,r){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...m(r)})}function Co(e,r){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...m(r)})}function $o(e,r){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...m(r)})}function Zo(e,r){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...m(r)})}function Ro(e,r){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...m(r)})}function Oo(e,r){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...m(r)})}function To(e,r){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...m(r)})}function Do(e,r){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...m(r)})}function jo(e,r){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...m(r)})}function Ao(e,r){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...m(r)})}function Io(e,r){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...m(r)})}function No(e,r){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...m(r)})}function Uo(e,r){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...m(r)})}function Mo(e,r){return new e({type:"string",format:"date",check:"string_format",...m(r)})}function Fo(e,r){return new e({type:"string",format:"time",check:"string_format",precision:null,...m(r)})}function Lo(e,r){return new e({type:"string",format:"duration",check:"string_format",...m(r)})}function Wo(e){return new e({type:"unknown"})}function Jo(e,r){return new e({type:"never",...m(r)})}function Dt(e,r){return new fn({check:"max_length",...m(r),maximum:e})}function fe(e,r){return new hn({check:"min_length",...m(r),minimum:e})}function jt(e,r){return new mn({check:"length_equals",...m(r),length:e})}function Bo(e,r){return new gn({check:"string_format",format:"regex",...m(r),pattern:e})}function Vo(e){return new vn({check:"string_format",format:"lowercase",...m(e)})}function qo(e){return new _n({check:"string_format",format:"uppercase",...m(e)})}function Ho(e,r){return new wn({check:"string_format",format:"includes",...m(r),includes:e})}function Go(e,r){return new yn({check:"string_format",format:"starts_with",...m(r),prefix:e})}function Ko(e,r){return new zn({check:"string_format",format:"ends_with",...m(r),suffix:e})}function K(e){return new bn({check:"overwrite",tx:e})}function Xo(e){return K(r=>r.normalize(e))}function Yo(){return K(e=>e.trim())}function Qo(){return K(e=>e.toLowerCase())}function ei(){return K(e=>e.toUpperCase())}function ti(){return K(e=>yr(e))}function ri(e,r,t){return new e({type:"array",element:r,...m(t)})}function ni(e,r,t){return new e({type:"custom",check:"custom",fn:r,...m(t)})}function oi(e){const r=ii(t=>(t.addIssue=n=>{if(typeof n=="string")t.issues.push(ne(n,t.value,r._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),t.issues.push(ne(o))}},e(t.value,t)));return r}function ii(e,r){const t=new N({check:"custom",...m(r)});return t._zod.check=e,t}function At(e){let r=e?.target??"draft-2020-12";return r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??te,target:r,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Z(e,r,t={path:[],schemaPath:[]}){var n;const o=e._zod.def,s=r.seen.get(e);if(s)return s.count++,t.schemaPath.includes(e)&&(s.cycle=t.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:t.path};r.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const l={...t,schemaPath:[...t.schemaPath,e],path:t.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(r,i.schema,l);else{const p=i.schema,h=r.processors[o.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,r,p,l)}const f=e._zod.parent;f&&(i.ref||(i.ref=f),Z(f,r,l),r.seen.get(f).isParent=!0)}const c=r.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),r.io==="input"&&T(e)&&(delete i.schema.examples,delete i.schema.default),r.io==="input"&&i.schema._prefault&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,r.seen.get(e).schema}function It(e,r){const t=e.seen.get(r);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}const o=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const f=e.external.registry.get(i[0])?.id,p=e.external.uri??(w=>w);if(f)return{ref:p(f)};const h=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=h,{defId:h,ref:`${p("__shared")}#/${a}/${h}`}}if(i[1]===t)return{ref:"#"};const u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);const l=a.schema;for(const f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
| 53 |
+
|
| 54 |
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(r===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(r!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Nt(e,r){const t=e.seen.get(r);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=i=>{const a=e.seen.get(i);if(a.ref===null)return;const c=a.def??a.schema,u={...c},l=a.ref;if(a.ref=null,l){n(l);const p=e.seen.get(l),h=p.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(h)):Object.assign(c,h),Object.assign(c,u),i._zod.parent===l)for(const v in c)v==="$ref"||v==="allOf"||v in u||delete c[v];if(h.$ref&&p.def)for(const v in c)v==="$ref"||v==="allOf"||v in p.def&&JSON.stringify(c[v])===JSON.stringify(p.def[v])&&delete c[v]}const f=i._zod.parent;if(f&&f!==l){n(f);const p=e.seen.get(f);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(const h in c)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(c[h])===JSON.stringify(p.def[h])&&delete c[h]}e.override({zodSchema:i,jsonSchema:c,path:a.path??[]})};for(const i of[...e.seen.entries()].reverse())n(i[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(r)?.id;if(!i)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(i)}Object.assign(o,t.def??t.schema);const s=e.external?.defs??{};for(const i of e.seen.entries()){const a=i[1];a.def&&a.defId&&(s[a.defId]=a.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...r["~standard"],jsonSchema:{input:he(r,"input",e.processors),output:he(r,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function T(e,r){const t=r??{seen:new Set};if(t.seen.has(e))return!1;t.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return T(n.element,t);if(n.type==="set")return T(n.valueType,t);if(n.type==="lazy")return T(n.getter(),t);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return T(n.innerType,t);if(n.type==="intersection")return T(n.left,t)||T(n.right,t);if(n.type==="record"||n.type==="map")return T(n.keyType,t)||T(n.valueType,t);if(n.type==="pipe")return T(n.in,t)||T(n.out,t);if(n.type==="object"){for(const o in n.shape)if(T(n.shape[o],t))return!0;return!1}if(n.type==="union"){for(const o of n.options)if(T(o,t))return!0;return!1}if(n.type==="tuple"){for(const o of n.items)if(T(o,t))return!0;return!!(n.rest&&T(n.rest,t))}return!1}const si=(e,r={})=>t=>{const n=At({...t,processors:r});return Z(e,n),It(n,e),Nt(n,e)},he=(e,r,t={})=>n=>{const{libraryOptions:o,target:s}=n??{},i=At({...o??{},target:s,io:r,processors:t});return Z(e,i),It(i,e),Nt(i,e)},ai={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ci=(e,r,t,n)=>{const o=t;o.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=ai[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(f=>({...r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},ui=(e,r,t,n)=>{t.not={}},li=(e,r,t,n)=>{},di=(e,r,t,n)=>{const o=e._zod.def,s=yt(o.entries);s.every(i=>typeof i=="number")&&(t.type="number"),s.every(i=>typeof i=="string")&&(t.type="string"),t.enum=s},pi=(e,r,t,n)=>{if(r.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},fi=(e,r,t,n)=>{if(r.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},hi=(e,r,t,n)=>{const o=t,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=Z(s.element,r,{...n,path:[...n.path,"items"]})},mi=(e,r,t,n)=>{const o=t,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const u in i)o.properties[u]=Z(i[u],r,{...n,path:[...n.path,"properties",u]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{const l=s.shape[u]._zod;return r.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Z(s.catchall,r,{...n,path:[...n.path,"additionalProperties"]})):r.io==="output"&&(o.additionalProperties=!1)},gi=(e,r,t,n)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>Z(a,r,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));s?t.oneOf=i:t.anyOf=i},vi=(e,r,t,n)=>{const o=e._zod.def,s=Z(o.left,r,{...n,path:[...n.path,"allOf",0]}),i=Z(o.right,r,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];t.allOf=c},_i=(e,r,t,n)=>{const o=e._zod.def,s=Z(o.innerType,r,n),i=r.seen.get(e);r.target==="openapi-3.0"?(i.ref=o.innerType,t.nullable=!0):t.anyOf=[s,{type:"null"}]},wi=(e,r,t,n)=>{const o=e._zod.def;Z(o.innerType,r,n);const s=r.seen.get(e);s.ref=o.innerType},yi=(e,r,t,n)=>{const o=e._zod.def;Z(o.innerType,r,n);const s=r.seen.get(e);s.ref=o.innerType,t.default=JSON.parse(JSON.stringify(o.defaultValue))},zi=(e,r,t,n)=>{const o=e._zod.def;Z(o.innerType,r,n);const s=r.seen.get(e);s.ref=o.innerType,r.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},bi=(e,r,t,n)=>{const o=e._zod.def;Z(o.innerType,r,n);const s=r.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=i},Si=(e,r,t,n)=>{const o=e._zod.def,s=r.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Z(s,r,n);const i=r.seen.get(e);i.ref=s},ki=(e,r,t,n)=>{const o=e._zod.def;Z(o.innerType,r,n);const s=r.seen.get(e);s.ref=o.innerType,t.readOnly=!0},Ut=(e,r,t,n)=>{const o=e._zod.def;Z(o.innerType,r,n);const s=r.seen.get(e);s.ref=o.innerType},Pi=d("ZodISODateTime",(e,r)=>{An.init(e,r),k.init(e,r)});function Ei(e){return Uo(Pi,e)}const xi=d("ZodISODate",(e,r)=>{In.init(e,r),k.init(e,r)});function Ci(e){return Mo(xi,e)}const $i=d("ZodISOTime",(e,r)=>{Nn.init(e,r),k.init(e,r)});function Zi(e){return Fo($i,e)}const Ri=d("ZodISODuration",(e,r)=>{Un.init(e,r),k.init(e,r)});function Oi(e){return Lo(Ri,e)}const Ti=(e,r)=>{Pt.init(e,r),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>Or(e,t)},flatten:{value:t=>Rr(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ce,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ce,2)}},isEmpty:{get(){return e.issues.length===0}}})},A=d("ZodError",Ti,{Parent:Error}),Di=Ae(A),ji=Ie(A),Ai=ge(A),Ii=ve(A),Ni=jr(A),Ui=Ar(A),Mi=Ir(A),Fi=Nr(A),Li=Ur(A),Wi=Mr(A),Ji=Fr(A),Bi=Lr(A),$=d("ZodType",(e,r)=>(C.init(e,r),Object.assign(e["~standard"],{jsonSchema:{input:he(e,"input"),output:he(e,"output")}}),e.toJSONSchema=si(e,{}),e.def=r,e.type=r.type,Object.defineProperty(e,"_def",{value:r}),e.check=(...t)=>e.clone(M(r,{checks:[...r.checks??[],...t.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>F(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Di(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ai(e,t,n),e.parseAsync=async(t,n)=>ji(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ii(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ni(e,t,n),e.decode=(t,n)=>Ui(e,t,n),e.encodeAsync=async(t,n)=>Mi(e,t,n),e.decodeAsync=async(t,n)=>Fi(e,t,n),e.safeEncode=(t,n)=>Li(e,t,n),e.safeDecode=(t,n)=>Wi(e,t,n),e.safeEncodeAsync=async(t,n)=>Ji(e,t,n),e.safeDecodeAsync=async(t,n)=>Bi(e,t,n),e.refine=(t,n)=>e.check(Ns(t,n)),e.superRefine=t=>e.check(Us(t)),e.overwrite=t=>e.check(K(t)),e.optional=()=>ot(e),e.exactOptional=()=>Ps(e),e.nullable=()=>it(e),e.nullish=()=>ot(it(e)),e.nonoptional=t=>Rs(e,t),e.array=()=>hs(e),e.or=t=>_s([e,t]),e.and=t=>ys(e,t),e.transform=t=>st(e,Ss(t)),e.default=t=>Cs(e,t),e.prefault=t=>Zs(e,t),e.catch=t=>Ts(e,t),e.pipe=t=>st(e,t),e.readonly=()=>As(e),e.describe=t=>{const n=e.clone();return te.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return te.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return te.get(e);const n=e.clone();return te.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Mt=d("_ZodString",(e,r)=>{Ne.init(e,r),$.init(e,r),e._zod.processJSONSchema=(n,o,s)=>ci(e,n,o);const t=e._zod.bag;e.format=t.format??null,e.minLength=t.minimum??null,e.maxLength=t.maximum??null,e.regex=(...n)=>e.check(Bo(...n)),e.includes=(...n)=>e.check(Ho(...n)),e.startsWith=(...n)=>e.check(Go(...n)),e.endsWith=(...n)=>e.check(Ko(...n)),e.min=(...n)=>e.check(fe(...n)),e.max=(...n)=>e.check(Dt(...n)),e.length=(...n)=>e.check(jt(...n)),e.nonempty=(...n)=>e.check(fe(1,...n)),e.lowercase=n=>e.check(Vo(n)),e.uppercase=n=>e.check(qo(n)),e.trim=()=>e.check(Yo()),e.normalize=(...n)=>e.check(Xo(...n)),e.toLowerCase=()=>e.check(Qo()),e.toUpperCase=()=>e.check(ei()),e.slugify=()=>e.check(ti())}),Vi=d("ZodString",(e,r)=>{Ne.init(e,r),Mt.init(e,r),e.email=t=>e.check(_o(qi,t)),e.url=t=>e.check(So(Hi,t)),e.jwt=t=>e.check(No(us,t)),e.emoji=t=>e.check(ko(Gi,t)),e.guid=t=>e.check(tt(rt,t)),e.uuid=t=>e.check(wo(ue,t)),e.uuidv4=t=>e.check(yo(ue,t)),e.uuidv6=t=>e.check(zo(ue,t)),e.uuidv7=t=>e.check(bo(ue,t)),e.nanoid=t=>e.check(Po(Ki,t)),e.guid=t=>e.check(tt(rt,t)),e.cuid=t=>e.check(Eo(Xi,t)),e.cuid2=t=>e.check(xo(Yi,t)),e.ulid=t=>e.check(Co(Qi,t)),e.base64=t=>e.check(jo(ss,t)),e.base64url=t=>e.check(Ao(as,t)),e.xid=t=>e.check($o(es,t)),e.ksuid=t=>e.check(Zo(ts,t)),e.ipv4=t=>e.check(Ro(rs,t)),e.ipv6=t=>e.check(Oo(ns,t)),e.cidrv4=t=>e.check(To(os,t)),e.cidrv6=t=>e.check(Do(is,t)),e.e164=t=>e.check(Io(cs,t)),e.datetime=t=>e.check(Ei(t)),e.date=t=>e.check(Ci(t)),e.time=t=>e.check(Zi(t)),e.duration=t=>e.check(Oi(t))});function Ft(e){return vo(Vi,e)}const k=d("ZodStringFormat",(e,r)=>{S.init(e,r),Mt.init(e,r)}),qi=d("ZodEmail",(e,r)=>{xn.init(e,r),k.init(e,r)}),rt=d("ZodGUID",(e,r)=>{Pn.init(e,r),k.init(e,r)}),ue=d("ZodUUID",(e,r)=>{En.init(e,r),k.init(e,r)}),Hi=d("ZodURL",(e,r)=>{Cn.init(e,r),k.init(e,r)}),Gi=d("ZodEmoji",(e,r)=>{$n.init(e,r),k.init(e,r)}),Ki=d("ZodNanoID",(e,r)=>{Zn.init(e,r),k.init(e,r)}),Xi=d("ZodCUID",(e,r)=>{Rn.init(e,r),k.init(e,r)}),Yi=d("ZodCUID2",(e,r)=>{On.init(e,r),k.init(e,r)}),Qi=d("ZodULID",(e,r)=>{Tn.init(e,r),k.init(e,r)}),es=d("ZodXID",(e,r)=>{Dn.init(e,r),k.init(e,r)}),ts=d("ZodKSUID",(e,r)=>{jn.init(e,r),k.init(e,r)}),rs=d("ZodIPv4",(e,r)=>{Mn.init(e,r),k.init(e,r)}),ns=d("ZodIPv6",(e,r)=>{Fn.init(e,r),k.init(e,r)}),os=d("ZodCIDRv4",(e,r)=>{Ln.init(e,r),k.init(e,r)}),is=d("ZodCIDRv6",(e,r)=>{Wn.init(e,r),k.init(e,r)}),ss=d("ZodBase64",(e,r)=>{Jn.init(e,r),k.init(e,r)}),as=d("ZodBase64URL",(e,r)=>{Vn.init(e,r),k.init(e,r)}),cs=d("ZodE164",(e,r)=>{qn.init(e,r),k.init(e,r)}),us=d("ZodJWT",(e,r)=>{Gn.init(e,r),k.init(e,r)}),ls=d("ZodUnknown",(e,r)=>{Kn.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>li()});function nt(){return Wo(ls)}const ds=d("ZodNever",(e,r)=>{Xn.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>ui(e,t,n)});function ps(e){return Jo(ds,e)}const fs=d("ZodArray",(e,r)=>{Yn.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>hi(e,t,n,o),e.element=r.element,e.min=(t,n)=>e.check(fe(t,n)),e.nonempty=t=>e.check(fe(1,t)),e.max=(t,n)=>e.check(Dt(t,n)),e.length=(t,n)=>e.check(jt(t,n)),e.unwrap=()=>e.element});function hs(e,r){return ri(fs,e,r)}const ms=d("ZodObject",(e,r)=>{eo.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>mi(e,t,n,o),z(e,"shape",()=>r.shape),e.keyof=()=>zs(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:nt()}),e.loose=()=>e.clone({...e._zod.def,catchall:nt()}),e.strict=()=>e.clone({...e._zod.def,catchall:ps()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Er(e,t),e.safeExtend=t=>xr(e,t),e.merge=t=>Cr(e,t),e.pick=t=>kr(e,t),e.omit=t=>Pr(e,t),e.partial=(...t)=>$r(Lt,e,t[0]),e.required=(...t)=>Zr(Wt,e,t[0])});function gs(e,r){const t={type:"object",shape:e??{},...m(r)};return new ms(t)}const vs=d("ZodUnion",(e,r)=>{to.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>gi(e,t,n,o),e.options=r.options});function _s(e,r){return new vs({type:"union",options:e,...m(r)})}const ws=d("ZodIntersection",(e,r)=>{ro.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>vi(e,t,n,o)});function ys(e,r){return new ws({type:"intersection",left:e,right:r})}const Ze=d("ZodEnum",(e,r)=>{no.init(e,r),$.init(e,r),e._zod.processJSONSchema=(n,o,s)=>di(e,n,o),e.enum=r.entries,e.options=Object.values(r.entries);const t=new Set(Object.keys(r.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(t.has(i))s[i]=r.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ze({...r,checks:[],...m(o),entries:s})},e.exclude=(n,o)=>{const s={...r.entries};for(const i of n)if(t.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ze({...r,checks:[],...m(o),entries:s})}});function zs(e,r){const t=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ze({type:"enum",entries:t,...m(r)})}const bs=d("ZodTransform",(e,r)=>{oo.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>fi(e,t),e._zod.parse=(t,n)=>{if(n.direction==="backward")throw new _t(e.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(ne(s,t.value,r));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),t.issues.push(ne(i))}};const o=r.transform(t.value,t);return o instanceof Promise?o.then(s=>(t.value=s,t)):(t.value=o,t)}});function Ss(e){return new bs({type:"transform",transform:e})}const Lt=d("ZodOptional",(e,r)=>{Tt.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>Ut(e,t,n,o),e.unwrap=()=>e._zod.def.innerType});function ot(e){return new Lt({type:"optional",innerType:e})}const ks=d("ZodExactOptional",(e,r)=>{io.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>Ut(e,t,n,o),e.unwrap=()=>e._zod.def.innerType});function Ps(e){return new ks({type:"optional",innerType:e})}const Es=d("ZodNullable",(e,r)=>{so.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>_i(e,t,n,o),e.unwrap=()=>e._zod.def.innerType});function it(e){return new Es({type:"nullable",innerType:e})}const xs=d("ZodDefault",(e,r)=>{ao.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>yi(e,t,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Cs(e,r){return new xs({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():bt(r)}})}const $s=d("ZodPrefault",(e,r)=>{co.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>zi(e,t,n,o),e.unwrap=()=>e._zod.def.innerType});function Zs(e,r){return new $s({type:"prefault",innerType:e,get defaultValue(){return typeof r=="function"?r():bt(r)}})}const Wt=d("ZodNonOptional",(e,r)=>{uo.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>wi(e,t,n,o),e.unwrap=()=>e._zod.def.innerType});function Rs(e,r){return new Wt({type:"nonoptional",innerType:e,...m(r)})}const Os=d("ZodCatch",(e,r)=>{lo.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>bi(e,t,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ts(e,r){return new Os({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}const Ds=d("ZodPipe",(e,r)=>{po.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>Si(e,t,n,o),e.in=r.in,e.out=r.out});function st(e,r){return new Ds({type:"pipe",in:e,out:r})}const js=d("ZodReadonly",(e,r)=>{fo.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>ki(e,t,n,o),e.unwrap=()=>e._zod.def.innerType});function As(e){return new js({type:"readonly",innerType:e})}const Is=d("ZodCustom",(e,r)=>{ho.init(e,r),$.init(e,r),e._zod.processJSONSchema=(t,n,o)=>pi(e,t)});function Ns(e,r={}){return ni(Is,e,r)}function Us(e){return oi(e)}const Ms=/[<>]/,Fs=/^\+?[0-9 ()\-.]{7,20}$/,Ls=Ft().trim().min(1,"Full name is required").max(100,"Full name must be 100 characters or fewer").refine(e=>!Ms.test(e),{message:"Full name cannot contain < or > characters"}),Ws=Ft().trim().max(20,"Phone number must be 20 characters or fewer").refine(e=>e.length===0||Fs.test(e),{message:"Phone number must contain only digits and + ( ) - . spaces"}),Js=gs({name:Ls,phone:Ws.optional()});function Aa(e){const r=Js.safeParse({name:e.name??"",phone:e.phone??""});return r.success?null:r.error.issues[0]?.message??"Invalid profile data"}var Se,at;function Bs(){if(at)return Se;at=1;var e=!1,r,t,n,o,s,i,a,c,u,l,f,p,h,w,v;function y(){if(!e){e=!0;var P=navigator.userAgent,_=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(P),b=/(Mac OS X)|(Windows)|(Linux)/.exec(P);if(p=/\b(iPhone|iP[ao]d)/.exec(P),h=/\b(iP[ao]d)/.exec(P),l=/Android/i.exec(P),w=/FBAN\/\w+;/i.exec(P),v=/Mobile/i.exec(P),f=!!/Win64/.exec(P),_){r=_[1]?parseFloat(_[1]):_[5]?parseFloat(_[5]):NaN,r&&document&&document.documentMode&&(r=document.documentMode);var E=/(?:Trident\/(\d+.\d+))/.exec(P);i=E?parseFloat(E[1])+4:r,t=_[2]?parseFloat(_[2]):NaN,n=_[3]?parseFloat(_[3]):NaN,o=_[4]?parseFloat(_[4]):NaN,o?(_=/(?:Chrome\/(\d+\.\d+))/.exec(P),s=_&&_[1]?parseFloat(_[1]):NaN):s=NaN}else r=t=n=s=o=NaN;if(b){if(b[1]){var j=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(P);a=j?parseFloat(j[1].replace("_",".")):!0}else a=!1;c=!!b[2],u=!!b[3]}else a=c=u=!1}}var D={ie:function(){return y()||r},ieCompatibilityMode:function(){return y()||i>r},ie64:function(){return D.ie()&&f},firefox:function(){return y()||t},opera:function(){return y()||n},webkit:function(){return y()||o},safari:function(){return D.webkit()},chrome:function(){return y()||s},windows:function(){return y()||c},osx:function(){return y()||a},linux:function(){return y()||u},iphone:function(){return y()||p},mobile:function(){return y()||p||h||l||v},nativeApp:function(){return y()||w},android:function(){return y()||l},ipad:function(){return y()||h}};return Se=D,Se}var ke,ct;function Vs(){if(ct)return ke;ct=1;var e=!!(typeof window<"u"&&window.document&&window.document.createElement),r={canUseDOM:e,canUseWorkers:typeof Worker<"u",canUseEventListeners:e&&!!(window.addEventListener||window.attachEvent),canUseViewport:e&&!!window.screen,isInWorker:!e};return ke=r,ke}var Pe,ut;function qs(){if(ut)return Pe;ut=1;var e=Vs(),r;e.canUseDOM&&(r=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);/**
|
| 55 |
+
* Checks if an event is supported in the current execution environment.
|
| 56 |
+
*
|
| 57 |
+
* NOTE: This will not work correctly for non-generic events such as `change`,
|
| 58 |
+
* `reset`, `load`, `error`, and `select`.
|
| 59 |
+
*
|
| 60 |
+
* Borrows from Modernizr.
|
| 61 |
+
*
|
| 62 |
+
* @param {string} eventNameSuffix Event name, e.g. "click".
|
| 63 |
+
* @param {?boolean} capture Check if the capture phase is supported.
|
| 64 |
+
* @return {boolean} True if the event is supported.
|
| 65 |
+
* @internal
|
| 66 |
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
| 67 |
+
*/function t(n,o){if(!e.canUseDOM||o&&!("addEventListener"in document))return!1;var s="on"+n,i=s in document;if(!i){var a=document.createElement("div");a.setAttribute(s,"return;"),i=typeof a[s]=="function"}return!i&&r&&n==="wheel"&&(i=document.implementation.hasFeature("Events.wheel","3.0")),i}return Pe=t,Pe}var Ee,lt;function Hs(){if(lt)return Ee;lt=1;var e=Bs(),r=qs(),t=10,n=40,o=800;function s(i){var a=0,c=0,u=0,l=0;return"detail"in i&&(c=i.detail),"wheelDelta"in i&&(c=-i.wheelDelta/120),"wheelDeltaY"in i&&(c=-i.wheelDeltaY/120),"wheelDeltaX"in i&&(a=-i.wheelDeltaX/120),"axis"in i&&i.axis===i.HORIZONTAL_AXIS&&(a=c,c=0),u=a*t,l=c*t,"deltaY"in i&&(l=i.deltaY),"deltaX"in i&&(u=i.deltaX),(u||l)&&i.deltaMode&&(i.deltaMode==1?(u*=n,l*=n):(u*=o,l*=o)),u&&!a&&(a=u<1?-1:1),l&&!c&&(c=l<1?-1:1),{spinX:a,spinY:c,pixelX:u,pixelY:l}}return s.getEventType=function(){return e.firefox()?"DOMMouseScroll":r("wheel")?"wheel":"mousewheel"},Ee=s,Ee}var xe,dt;function Gs(){return dt||(dt=1,xe=Hs()),xe}var Ks=Gs();const Xs=rr(Ks);function Ys(e,r,t,n,o,s){s===void 0&&(s=0);var i=G(e,r,s),a=i.width,c=i.height,u=Math.min(a,t),l=Math.min(c,n);return u>l*o?{width:l*o,height:l}:{width:u,height:u/o}}function Qs(e){return e.width>e.height?e.width/e.naturalWidth:e.height/e.naturalHeight}function Q(e,r,t,n,o){o===void 0&&(o=0);var s=G(r.width,r.height,o),i=s.width,a=s.height;return{x:pt(e.x,i,t.width,n),y:pt(e.y,a,t.height,n)}}function pt(e,r,t,n){var o=Math.abs(r*n/2-t/2);return we(e,-o,o)}function ft(e,r){return Math.sqrt(Math.pow(e.y-r.y,2)+Math.pow(e.x-r.x,2))}function ht(e,r){return Math.atan2(r.y-e.y,r.x-e.x)*180/Math.PI}function ea(e,r,t,n,o,s,i){s===void 0&&(s=0),i===void 0&&(i=!0);var a=i?ta:ra,c=G(r.width,r.height,s),u=G(r.naturalWidth,r.naturalHeight,s),l={x:a(100,((c.width-t.width/o)/2-e.x/o)/c.width*100),y:a(100,((c.height-t.height/o)/2-e.y/o)/c.height*100),width:a(100,t.width/c.width*100/o),height:a(100,t.height/c.height*100/o)},f=Math.round(a(u.width,l.width*u.width/100)),p=Math.round(a(u.height,l.height*u.height/100)),h=u.width>=u.height*n,w=h?{width:Math.round(p*n),height:p}:{width:f,height:Math.round(f/n)},v=R(R({},w),{x:Math.round(a(u.width-w.width,l.x*u.width/100)),y:Math.round(a(u.height-w.height,l.y*u.height/100))});return{croppedAreaPercentages:l,croppedAreaPixels:v}}function ta(e,r){return Math.min(e,Math.max(0,r))}function ra(e,r){return r}function na(e,r,t,n,o,s){var i=G(r.width,r.height,t),a=we(n.width/i.width*(100/e.width),o,s),c={x:a*i.width/2-n.width/2-i.width*a*(e.x/100),y:a*i.height/2-n.height/2-i.height*a*(e.y/100)};return{crop:c,zoom:a}}function oa(e,r,t){var n=Qs(r);return t.height>t.width?t.height/(e.height*n):t.width/(e.width*n)}function ia(e,r,t,n,o,s){t===void 0&&(t=0);var i=G(r.naturalWidth,r.naturalHeight,t),a=we(oa(e,r,n),o,s),c=n.height>n.width?n.height/e.height:n.width/e.width,u={x:((i.width-e.width)/2-e.x)*c,y:((i.height-e.height)/2-e.y)*c};return{crop:u,zoom:a}}function mt(e,r){return{x:(r.x+e.x)/2,y:(r.y+e.y)/2}}function sa(e){return e*Math.PI/180}function G(e,r,t){var n=sa(t);return{width:Math.abs(Math.cos(n)*e)+Math.abs(Math.sin(n)*r),height:Math.abs(Math.sin(n)*e)+Math.abs(Math.cos(n)*r)}}function we(e,r,t){return Math.min(Math.max(e,r),t)}function le(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.filter(function(t){return typeof t=="string"&&t.length>0}).join(" ").trim()}var aa=`.reactEasyCrop_Container {
|
| 68 |
+
position: absolute;
|
| 69 |
+
top: 0;
|
| 70 |
+
left: 0;
|
| 71 |
+
right: 0;
|
| 72 |
+
bottom: 0;
|
| 73 |
+
overflow: hidden;
|
| 74 |
+
user-select: none;
|
| 75 |
+
touch-action: none;
|
| 76 |
+
cursor: move;
|
| 77 |
+
display: flex;
|
| 78 |
+
justify-content: center;
|
| 79 |
+
align-items: center;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
.reactEasyCrop_Image,
|
| 83 |
+
.reactEasyCrop_Video {
|
| 84 |
+
will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
.reactEasyCrop_Contain {
|
| 88 |
+
max-width: 100%;
|
| 89 |
+
max-height: 100%;
|
| 90 |
+
margin: auto;
|
| 91 |
+
position: absolute;
|
| 92 |
+
top: 0;
|
| 93 |
+
bottom: 0;
|
| 94 |
+
left: 0;
|
| 95 |
+
right: 0;
|
| 96 |
+
}
|
| 97 |
+
.reactEasyCrop_Cover_Horizontal {
|
| 98 |
+
width: 100%;
|
| 99 |
+
height: auto;
|
| 100 |
+
}
|
| 101 |
+
.reactEasyCrop_Cover_Vertical {
|
| 102 |
+
width: auto;
|
| 103 |
+
height: 100%;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
.reactEasyCrop_CropArea {
|
| 107 |
+
position: absolute;
|
| 108 |
+
left: 50%;
|
| 109 |
+
top: 50%;
|
| 110 |
+
transform: translate(-50%, -50%);
|
| 111 |
+
border: 1px solid rgba(255, 255, 255, 0.5);
|
| 112 |
+
box-sizing: border-box;
|
| 113 |
+
box-shadow: 0 0 0 9999em;
|
| 114 |
+
color: rgba(0, 0, 0, 0.5);
|
| 115 |
+
overflow: hidden;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
.reactEasyCrop_CropAreaRound {
|
| 119 |
+
border-radius: 50%;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
.reactEasyCrop_CropAreaGrid::before {
|
| 123 |
+
content: ' ';
|
| 124 |
+
box-sizing: border-box;
|
| 125 |
+
position: absolute;
|
| 126 |
+
border: 1px solid rgba(255, 255, 255, 0.5);
|
| 127 |
+
top: 0;
|
| 128 |
+
bottom: 0;
|
| 129 |
+
left: 33.33%;
|
| 130 |
+
right: 33.33%;
|
| 131 |
+
border-top: 0;
|
| 132 |
+
border-bottom: 0;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
.reactEasyCrop_CropAreaGrid::after {
|
| 136 |
+
content: ' ';
|
| 137 |
+
box-sizing: border-box;
|
| 138 |
+
position: absolute;
|
| 139 |
+
border: 1px solid rgba(255, 255, 255, 0.5);
|
| 140 |
+
top: 33.33%;
|
| 141 |
+
bottom: 33.33%;
|
| 142 |
+
left: 0;
|
| 143 |
+
right: 0;
|
| 144 |
+
border-left: 0;
|
| 145 |
+
border-right: 0;
|
| 146 |
+
}
|
| 147 |
+
`,ca=1,ua=3,la=1,da=(function(e){nr(r,e);function r(){var t=e!==null&&e.apply(this,arguments)||this;return t.cropperRef=x.createRef(),t.imageRef=x.createRef(),t.videoRef=x.createRef(),t.containerPosition={x:0,y:0},t.containerRef=null,t.styleRef=null,t.containerRect=null,t.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},t.dragStartPosition={x:0,y:0},t.dragStartCrop={x:0,y:0},t.gestureZoomStart=0,t.gestureRotationStart=0,t.isTouching=!1,t.lastPinchDistance=0,t.lastPinchRotation=0,t.rafDragTimeout=null,t.rafPinchTimeout=null,t.wheelTimer=null,t.currentDoc=typeof document<"u"?document:null,t.currentWindow=typeof window<"u"?window:null,t.resizeObserver=null,t.previousCropSize=null,t.isInitialized=!1,t.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},t.initResizeObserver=function(){if(!(typeof window.ResizeObserver>"u"||!t.containerRef)){var n=!0;t.resizeObserver=new window.ResizeObserver(function(o){if(n){n=!1;return}t.computeSizes()}),t.resizeObserver.observe(t.containerRef)}},t.preventZoomSafari=function(n){return n.preventDefault()},t.cleanEvents=function(){t.currentDoc&&(t.currentDoc.removeEventListener("mousemove",t.onMouseMove),t.currentDoc.removeEventListener("mouseup",t.onDragStopped),t.currentDoc.removeEventListener("touchmove",t.onTouchMove),t.currentDoc.removeEventListener("touchend",t.onDragStopped),t.currentDoc.removeEventListener("gesturechange",t.onGestureChange),t.currentDoc.removeEventListener("gestureend",t.onGestureEnd),t.currentDoc.removeEventListener("scroll",t.onScroll))},t.clearScrollEvent=function(){t.containerRef&&t.containerRef.removeEventListener("wheel",t.onWheel),t.wheelTimer&&clearTimeout(t.wheelTimer)},t.onMediaLoad=function(){var n=t.computeSizes();n&&(t.previousCropSize=n,t.emitCropData(),t.setInitialCrop(n),t.isInitialized=!0),t.props.onMediaLoaded&&t.props.onMediaLoaded(t.mediaSize)},t.setInitialCrop=function(n){if(t.props.initialCroppedAreaPercentages){var o=na(t.props.initialCroppedAreaPercentages,t.mediaSize,t.props.rotation,n,t.props.minZoom,t.props.maxZoom),s=o.crop,i=o.zoom;t.props.onCropChange(s),t.props.onZoomChange&&t.props.onZoomChange(i)}else if(t.props.initialCroppedAreaPixels){var a=ia(t.props.initialCroppedAreaPixels,t.mediaSize,t.props.rotation,n,t.props.minZoom,t.props.maxZoom),s=a.crop,i=a.zoom;t.props.onCropChange(s),t.props.onZoomChange&&t.props.onZoomChange(i)}},t.computeSizes=function(){var n,o,s,i,a,c,u=t.imageRef.current||t.videoRef.current;if(u&&t.containerRef){t.containerRect=t.containerRef.getBoundingClientRect(),t.saveContainerPosition();var l=t.containerRect.width/t.containerRect.height,f=((n=t.imageRef.current)===null||n===void 0?void 0:n.naturalWidth)||((o=t.videoRef.current)===null||o===void 0?void 0:o.videoWidth)||0,p=((s=t.imageRef.current)===null||s===void 0?void 0:s.naturalHeight)||((i=t.videoRef.current)===null||i===void 0?void 0:i.videoHeight)||0,h=u.offsetWidth<f||u.offsetHeight<p,w=f/p,v=void 0;if(h)switch(t.state.mediaObjectFit){default:case"contain":v=l>w?{width:t.containerRect.height*w,height:t.containerRect.height}:{width:t.containerRect.width,height:t.containerRect.width/w};break;case"horizontal-cover":v={width:t.containerRect.width,height:t.containerRect.width/w};break;case"vertical-cover":v={width:t.containerRect.height*w,height:t.containerRect.height};break}else v={width:u.offsetWidth,height:u.offsetHeight};t.mediaSize=R(R({},v),{naturalWidth:f,naturalHeight:p}),t.props.setMediaSize&&t.props.setMediaSize(t.mediaSize);var y=t.props.cropSize?t.props.cropSize:Ys(t.mediaSize.width,t.mediaSize.height,t.containerRect.width,t.containerRect.height,t.props.aspect,t.props.rotation);return(((a=t.state.cropSize)===null||a===void 0?void 0:a.height)!==y.height||((c=t.state.cropSize)===null||c===void 0?void 0:c.width)!==y.width)&&t.props.onCropSizeChange&&t.props.onCropSizeChange(y),t.setState({cropSize:y},t.recomputeCropPosition),t.props.setCropSize&&t.props.setCropSize(y),y}},t.saveContainerPosition=function(){if(t.containerRef){var n=t.containerRef.getBoundingClientRect();t.containerPosition={x:n.left,y:n.top}}},t.onMouseDown=function(n){t.currentDoc&&(n.preventDefault(),t.currentDoc.addEventListener("mousemove",t.onMouseMove),t.currentDoc.addEventListener("mouseup",t.onDragStopped),t.saveContainerPosition(),t.onDragStart(r.getMousePoint(n)))},t.onMouseMove=function(n){return t.onDrag(r.getMousePoint(n))},t.onScroll=function(n){t.currentDoc&&(n.preventDefault(),t.saveContainerPosition())},t.onTouchStart=function(n){t.currentDoc&&(t.isTouching=!0,!(t.props.onTouchRequest&&!t.props.onTouchRequest(n))&&(t.currentDoc.addEventListener("touchmove",t.onTouchMove,{passive:!1}),t.currentDoc.addEventListener("touchend",t.onDragStopped),t.saveContainerPosition(),n.touches.length===2?t.onPinchStart(n):n.touches.length===1&&t.onDragStart(r.getTouchPoint(n.touches[0]))))},t.onTouchMove=function(n){n.preventDefault(),n.touches.length===2?t.onPinchMove(n):n.touches.length===1&&t.onDrag(r.getTouchPoint(n.touches[0]))},t.onGestureStart=function(n){t.currentDoc&&(n.preventDefault(),t.currentDoc.addEventListener("gesturechange",t.onGestureChange),t.currentDoc.addEventListener("gestureend",t.onGestureEnd),t.gestureZoomStart=t.props.zoom,t.gestureRotationStart=t.props.rotation)},t.onGestureChange=function(n){if(n.preventDefault(),!t.isTouching){var o=r.getMousePoint(n),s=t.gestureZoomStart-1+n.scale;if(t.setNewZoom(s,o,{shouldUpdatePosition:!0}),t.props.onRotationChange){var i=t.gestureRotationStart+n.rotation;t.props.onRotationChange(i)}}},t.onGestureEnd=function(n){t.cleanEvents()},t.onDragStart=function(n){var o,s,i=n.x,a=n.y;t.dragStartPosition={x:i,y:a},t.dragStartCrop=R({},t.props.crop),(s=(o=t.props).onInteractionStart)===null||s===void 0||s.call(o)},t.onDrag=function(n){var o=n.x,s=n.y;t.currentWindow&&(t.rafDragTimeout&&t.currentWindow.cancelAnimationFrame(t.rafDragTimeout),t.rafDragTimeout=t.currentWindow.requestAnimationFrame(function(){if(t.state.cropSize&&!(o===void 0||s===void 0)){var i=o-t.dragStartPosition.x,a=s-t.dragStartPosition.y,c={x:t.dragStartCrop.x+i,y:t.dragStartCrop.y+a},u=t.props.restrictPosition?Q(c,t.mediaSize,t.state.cropSize,t.props.zoom,t.props.rotation):c;t.props.onCropChange(u)}}))},t.onDragStopped=function(){var n,o;t.isTouching=!1,t.cleanEvents(),t.emitCropData(),(o=(n=t.props).onInteractionEnd)===null||o===void 0||o.call(n)},t.onWheel=function(n){if(t.currentWindow&&!(t.props.onWheelRequest&&!t.props.onWheelRequest(n))){n.preventDefault();var o=r.getMousePoint(n),s=Xs(n).pixelY,i=t.props.zoom-s*t.props.zoomSpeed/200;t.setNewZoom(i,o,{shouldUpdatePosition:!0}),t.state.hasWheelJustStarted||t.setState({hasWheelJustStarted:!0},function(){var a,c;return(c=(a=t.props).onInteractionStart)===null||c===void 0?void 0:c.call(a)}),t.wheelTimer&&clearTimeout(t.wheelTimer),t.wheelTimer=t.currentWindow.setTimeout(function(){return t.setState({hasWheelJustStarted:!1},function(){var a,c;return(c=(a=t.props).onInteractionEnd)===null||c===void 0?void 0:c.call(a)})},250)}},t.getPointOnContainer=function(n,o){var s=n.x,i=n.y;if(!t.containerRect)throw new Error("The Cropper is not mounted");return{x:t.containerRect.width/2-(s-o.x),y:t.containerRect.height/2-(i-o.y)}},t.getPointOnMedia=function(n){var o=n.x,s=n.y,i=t.props,a=i.crop,c=i.zoom;return{x:(o+a.x)/c,y:(s+a.y)/c}},t.setNewZoom=function(n,o,s){var i=s===void 0?{}:s,a=i.shouldUpdatePosition,c=a===void 0?!0:a;if(!(!t.state.cropSize||!t.props.onZoomChange)){var u=we(n,t.props.minZoom,t.props.maxZoom);if(c){var l=t.getPointOnContainer(o,t.containerPosition),f=t.getPointOnMedia(l),p={x:f.x*u-l.x,y:f.y*u-l.y},h=t.props.restrictPosition?Q(p,t.mediaSize,t.state.cropSize,u,t.props.rotation):p;t.props.onCropChange(h)}t.props.onZoomChange(u)}},t.getCropData=function(){if(!t.state.cropSize)return null;var n=t.props.restrictPosition?Q(t.props.crop,t.mediaSize,t.state.cropSize,t.props.zoom,t.props.rotation):t.props.crop;return ea(n,t.mediaSize,t.state.cropSize,t.getAspect(),t.props.zoom,t.props.rotation,t.props.restrictPosition)},t.emitCropData=function(){var n=t.getCropData();if(n){var o=n.croppedAreaPercentages,s=n.croppedAreaPixels;t.props.onCropComplete&&t.props.onCropComplete(o,s),t.props.onCropAreaChange&&t.props.onCropAreaChange(o,s)}},t.emitCropAreaChange=function(){var n=t.getCropData();if(n){var o=n.croppedAreaPercentages,s=n.croppedAreaPixels;t.props.onCropAreaChange&&t.props.onCropAreaChange(o,s)}},t.recomputeCropPosition=function(){var n,o;if(t.state.cropSize){var s=t.props.crop;if(t.isInitialized&&(!((n=t.previousCropSize)===null||n===void 0)&&n.width)&&(!((o=t.previousCropSize)===null||o===void 0)&&o.height)){var i=Math.abs(t.previousCropSize.width-t.state.cropSize.width)>1e-6||Math.abs(t.previousCropSize.height-t.state.cropSize.height)>1e-6;if(i){var a=t.state.cropSize.width/t.previousCropSize.width,c=t.state.cropSize.height/t.previousCropSize.height;s={x:t.props.crop.x*a,y:t.props.crop.y*c}}}var u=t.props.restrictPosition?Q(s,t.mediaSize,t.state.cropSize,t.props.zoom,t.props.rotation):s;t.previousCropSize=t.state.cropSize,t.props.onCropChange(u),t.emitCropData()}},t.onKeyDown=function(n){var o,s,i=t.props,a=i.crop,c=i.onCropChange,u=i.keyboardStep,l=i.zoom,f=i.rotation,p=u;if(t.state.cropSize){n.shiftKey&&(p*=.2);var h=R({},a);switch(n.key){case"ArrowUp":h.y-=p,n.preventDefault();break;case"ArrowDown":h.y+=p,n.preventDefault();break;case"ArrowLeft":h.x-=p,n.preventDefault();break;case"ArrowRight":h.x+=p,n.preventDefault();break;default:return}t.props.restrictPosition&&(h=Q(h,t.mediaSize,t.state.cropSize,l,f)),n.repeat||(s=(o=t.props).onInteractionStart)===null||s===void 0||s.call(o),c(h)}},t.onKeyUp=function(n){var o,s;switch(n.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":n.preventDefault();break;default:return}t.emitCropData(),(s=(o=t.props).onInteractionEnd)===null||s===void 0||s.call(o)},t}return r.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=aa,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))},r.prototype.componentWillUnmount=function(){var t,n;!this.currentDoc||!this.currentWindow||(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.computeSizes),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&((n=this.styleRef.parentNode)===null||n===void 0||n.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},r.prototype.componentDidUpdate=function(t){var n,o,s,i,a,c,u,l,f;t.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):t.aspect!==this.props.aspect?this.computeSizes():t.objectFit!==this.props.objectFit?this.computeSizes():t.zoom!==this.props.zoom?this.recomputeCropPosition():((n=t.cropSize)===null||n===void 0?void 0:n.height)!==((o=this.props.cropSize)===null||o===void 0?void 0:o.height)||((s=t.cropSize)===null||s===void 0?void 0:s.width)!==((i=this.props.cropSize)===null||i===void 0?void 0:i.width)?this.computeSizes():(((a=t.crop)===null||a===void 0?void 0:a.x)!==((c=this.props.crop)===null||c===void 0?void 0:c.x)||((u=t.crop)===null||u===void 0?void 0:u.y)!==((l=this.props.crop)===null||l===void 0?void 0:l.y))&&this.emitCropAreaChange(),t.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),t.video!==this.props.video&&((f=this.videoRef.current)===null||f===void 0||f.load());var p=this.getObjectFit();p!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:p},this.computeSizes)},r.prototype.getAspect=function(){var t=this.props,n=t.cropSize,o=t.aspect;return n?n.width/n.height:o},r.prototype.getObjectFit=function(){var t,n,o,s;if(this.props.objectFit==="cover"){var i=this.imageRef.current||this.videoRef.current;if(i&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var a=this.containerRect.width/this.containerRect.height,c=((t=this.imageRef.current)===null||t===void 0?void 0:t.naturalWidth)||((n=this.videoRef.current)===null||n===void 0?void 0:n.videoWidth)||0,u=((o=this.imageRef.current)===null||o===void 0?void 0:o.naturalHeight)||((s=this.videoRef.current)===null||s===void 0?void 0:s.videoHeight)||0,l=c/u;return l<a?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},r.prototype.onPinchStart=function(t){var n=r.getTouchPoint(t.touches[0]),o=r.getTouchPoint(t.touches[1]);this.lastPinchDistance=ft(n,o),this.lastPinchRotation=ht(n,o),this.onDragStart(mt(n,o))},r.prototype.onPinchMove=function(t){var n=this;if(!(!this.currentDoc||!this.currentWindow)){var o=r.getTouchPoint(t.touches[0]),s=r.getTouchPoint(t.touches[1]),i=mt(o,s);this.onDrag(i),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var a=ft(o,s),c=n.props.zoom*(a/n.lastPinchDistance);n.setNewZoom(c,i,{shouldUpdatePosition:!1}),n.lastPinchDistance=a;var u=ht(o,s),l=n.props.rotation+(u-n.lastPinchRotation);n.props.onRotationChange&&n.props.onRotationChange(l),n.lastPinchRotation=u})}},r.prototype.render=function(){var t=this,n,o=this.props,s=o.image,i=o.video,a=o.mediaProps,c=o.cropperProps,u=o.transform,l=o.crop,f=l.x,p=l.y,h=o.rotation,w=o.zoom,v=o.cropShape,y=o.showGrid,D=o.roundCropAreaPixels,P=o.style,_=P.containerStyle,b=P.cropAreaStyle,E=P.mediaStyle,j=o.classes,X=j.containerClassName,ye=j.cropAreaClassName,L=j.mediaClassName,U=(n=this.state.mediaObjectFit)!==null&&n!==void 0?n:this.getObjectFit();return x.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(oe){return t.containerRef=oe},"data-testid":"container",style:_,className:le("reactEasyCrop_Container",X)},s?x.createElement("img",R({alt:"",className:le("reactEasyCrop_Image",U==="contain"&&"reactEasyCrop_Contain",U==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",U==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",L)},a,{src:s,ref:this.imageRef,style:R(R({},E),{transform:u||"translate(".concat(f,"px, ").concat(p,"px) rotate(").concat(h,"deg) scale(").concat(w,")")}),onLoad:this.onMediaLoad})):i&&x.createElement("video",R({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:le("reactEasyCrop_Video",U==="contain"&&"reactEasyCrop_Contain",U==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",U==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",L)},a,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:R(R({},E),{transform:u||"translate(".concat(f,"px, ").concat(p,"px) rotate(").concat(h,"deg) scale(").concat(w,")")}),controls:!1}),(Array.isArray(i)?i:[{src:i}]).map(function(Y){return x.createElement("source",R({key:Y.src},Y))})),this.state.cropSize&&x.createElement("div",R({ref:this.cropperRef,style:R(R({},b),{width:D?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:D?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:le("reactEasyCrop_CropArea",v==="round"&&"reactEasyCrop_CropAreaRound",y&&"reactEasyCrop_CropAreaGrid",ye)},c)))},r.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:ua,minZoom:ca,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:la},r.getMousePoint=function(t){return{x:Number(t.clientX),y:Number(t.clientY)}},r.getTouchPoint=function(t){return{x:Number(t.clientX),y:Number(t.clientY)}},r})(x.Component);function pa({className:e,defaultValue:r,value:t,min:n=0,max:o=100,...s}){const i=x.useMemo(()=>Array.isArray(t)?t:Array.isArray(r)?r:[n,o],[t,r,n,o]);return g.jsxs(or,{"data-slot":"slider",defaultValue:r,value:t,min:n,max:o,className:be("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",e),...s,children:[g.jsx(ir,{"data-slot":"slider-track",className:be("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:g.jsx(sr,{"data-slot":"slider-range",className:be("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),Array.from({length:i.length},(a,c)=>g.jsx(ar,{"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 Jt=["image/png","image/jpeg","image/webp"],Bt=2*1024*1024,Vt=256,fa=e=>{const r=e.normalize("NFKD").toLowerCase(),t=r.lastIndexOf("."),n=t>0?r.slice(0,t):r,o=t>0?r.slice(t).replace(/[^.a-z0-9]/g,""):"";return`${n.replace(/[^a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"profile-picture"}${o}`},ha=(e,r,t=Date.now())=>`profile-pictures/${e}/${t}-${fa(r)}`,qt=e=>Jt.includes(e.type)?e.size>Bt?"Profile pictures must be 2MB or smaller.":e.name.trim()?null:"Please choose a valid image file.":"Only PNG, JPEG, and WebP images are allowed.",ma=e=>new Promise((r,t)=>{const n=URL.createObjectURL(e),o=new Image,s=setTimeout(()=>{URL.revokeObjectURL(n),t(new Error("Image loading timed out. Please try a different file."))},15e3);o.onload=()=>{clearTimeout(s),URL.revokeObjectURL(n),r(o)},o.onerror=()=>{clearTimeout(s),URL.revokeObjectURL(n),t(new Error("Unable to read the selected image. Please try another file."))},o.crossOrigin="anonymous",o.src=n}),gt=(e,r,t)=>new Promise((n,o)=>{e.toBlob(s=>{if(!s){o(new Error("Failed to prepare the image for upload."));return}n(s)},r,t)}),ga=async(e,r=Vt)=>{const t=await ma(e),n=document.createElement("canvas");n.width=r,n.height=r;const o=n.getContext("2d");if(!o)throw new Error("Your browser cannot process image uploads right now.");const s=t.naturalWidth||t.width,i=t.naturalHeight||t.height,a=Math.min(s,i),c=Math.max(0,(s-a)/2),u=Math.max(0,(i-a)/2);o.clearRect(0,0,r,r),o.drawImage(t,c,u,a,a,0,0,r,r);try{return await gt(n,"image/webp",.9)}catch{return await gt(n,"image/jpeg",.9)}},ee=(e,r,t)=>{let n;const o=new Promise((s,i)=>{n=setTimeout(()=>i(new Error(`${t} timed out after ${Math.round(r/1e3)}s`)),r)});return Promise.race([e,o]).finally(()=>clearTimeout(n))},va=async(e,r,t)=>{const n=Kt.options.projectId;if(!n)throw new Error("Firebase project ID is not configured.");const o=await e.getIdToken(),s=`https://firestore.googleapis.com/v1/projects/${n}/databases/(default)/documents/users/${r}?updateMask.fieldPaths=photo&updateMask.fieldPaths=updatedAt`,i=await fetch(s,{method:"PATCH",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({fields:{photo:{stringValue:t},updatedAt:{timestampValue:new Date().toISOString()}}})});if(!i.ok){const a=await i.text().catch(()=>"");throw new Error(`Firestore REST update failed (${i.status}): ${a}`)}},_a=async({file:e,uid:r,currentUser:t=Ue.currentUser,syncFirestore:n=!0})=>{const o=qt(e);if(o)throw new Error(o);const s=t??Ue.currentUser;if(!s)throw new Error("You need to be signed in to change your profile picture.");const i=r||s.uid;if(!i)throw new Error("Unable to determine which profile should be updated.");if(s.uid!==i)throw new Error("The signed-in user does not match the profile being edited.");const a=await ee(ga(e,Vt),2e4,"Image processing"),c=ha(i,e.name),u=ur(Gt,c),l=await ee(lr(u,a,{contentType:a.type||"image/webp",cacheControl:"public, max-age=31536000, immutable"}),3e4,"Storage upload"),f=await ee(dr(l.ref),1e4,"Download URL retrieval");try{await ee(cr(s,{photoURL:f}),1e4,"Auth profile update")}catch(p){console.warn("[PROFILE UPLOAD] Auth profile update failed (non-fatal):",p)}if(n)try{await ee(va(s,i,f),1e4,"Firestore profile sync")}catch(p){console.error("[PROFILE UPLOAD] Firestore REST sync failed:",p),console.warn("[PROFILE UPLOAD] Photo was uploaded but the database record may be stale. It will refresh on next login.")}return f},wa=e=>`${(e/(1024*1024)).toFixed(1)} MB`,ya=e=>{const r=(e||"").trim();return r?r.split(/\s+/).slice(0,2).map(t=>t[0]?.toUpperCase()).join(""):"U"},za=e=>new Promise((r,t)=>{const n=new Image;n.onload=()=>r(n),n.onerror=()=>t(new Error("Unable to load the image for cropping.")),n.src=e}),vt=(e,r,t)=>new Promise((n,o)=>{e.toBlob(s=>{if(!s){o(new Error("Failed to prepare the cropped image."));return}n(s)},r,t)}),ba=async(e,r,t)=>{const n=await za(e),o=document.createElement("canvas"),s=640;o.width=s,o.height=s;const i=o.getContext("2d");if(!i)throw new Error("Your browser cannot process the selected image right now.");i.clearRect(0,0,s,s),i.drawImage(n,r.x,r.y,r.width,r.height,0,0,s,s);let a;try{a=await vt(o,"image/webp",.92)}catch{a=await vt(o,"image/jpeg",.92)}if(!a)throw new Error("Could not create an image from the cropped area.");const c=a.type==="image/webp"?"webp":"jpg",l=`${t.name.replace(/\.[^/.]+$/,"")||"profile-picture"}-cropped.${c}`;return new File([a],l,{type:a.type,lastModified:Date.now()})},Ia=({uid:e,photoURL:r,displayName:t,className:n="",onUploaded:o,syncFirestore:s=!0})=>{const{currentUser:i,refreshProfile:a}=Xt(),[c,u]=x.useState(null),[l,f]=x.useState(null),[p,h]=x.useState({x:0,y:0}),[w,v]=x.useState(1),[y,D]=x.useState(null),[P,_]=x.useState(""),[b,E]=x.useState(!1),j=x.useRef(null);x.useEffect(()=>{if(!c){f(null);return}const O=URL.createObjectURL(c);return f(O),()=>URL.revokeObjectURL(O)},[c]);const X=l||r||"",ye=x.useMemo(()=>`${Jt.map(I=>I.replace("image/","").toUpperCase()).join(", ")} up to ${wa(Bt)}. The image will be cropped to a circular avatar.`,[]),L=()=>{u(null),h({x:0,y:0}),v(1),D(null),_(""),j.current&&(j.current.value="")},U=O=>{const I=O.target.files?.[0]||null;if(!I)return;const W=qt(I);if(W){_(W),u(null),O.target.value="";return}_(""),u(I),h({x:0,y:0}),v(1),D(null)},Y=async()=>{if(!c){_("Choose an image before saving.");return}E(!0),_("");const O=6e4;let I;try{const W=(async()=>{const se=l&&y?await ba(l,y,c):c,ze=e||i?.uid;return _a({file:se,uid:ze,currentUser:i,syncFirestore:s})})(),ie=new Promise((se,ze)=>{I=setTimeout(()=>ze(new Error("Upload timed out. Please check your connection and try again.")),O)}),Ht=await Promise.race([W,ie]);o?.(Ht),a().catch(se=>console.warn("[ProfilePictureUploader] refreshProfile failed:",se)),Fe.success("Profile picture updated."),L()}catch(W){const ie=W instanceof Error?W.message:"Failed to update your profile picture.";_(ie),Fe.error(ie)}finally{clearTimeout(I),E(!1)}},oe=()=>{j.current?.click()};return g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:`flex items-center gap-4 rounded-xl border border-slate-200 bg-white p-4 shadow-sm ${n}`,children:[g.jsxs("div",{className:"relative cursor-pointer group",onClick:oe,role:"button",tabIndex:0,onKeyDown:O=>O.key==="Enter"&&oe(),"aria-label":"Change profile picture",children:[g.jsxs(Yt,{className:"size-16 sm:size-20 ring-4 ring-sky-50 shadow-sm transition-transform duration-200 group-hover:scale-105",children:[g.jsx(Qt,{src:X,alt:`${t||"User"} profile picture`}),g.jsx(er,{className:"bg-gradient-to-br from-sky-600 to-cyan-500 text-lg font-semibold text-white",children:ya(t)})]}),g.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:g.jsx(vr,{size:14})})]}),g.jsxs("div",{className:"space-y-1 flex-1",children:[g.jsx("p",{className:"text-sm font-semibold text-slate-900",children:"Profile picture"}),g.jsx("p",{className:"text-xs text-slate-500",children:"Click your avatar to upload a new photo."}),P&&g.jsx("p",{className:"text-xs font-medium text-rose-600 mt-1",children:P})]}),g.jsx("input",{ref:j,type:"file",accept:"image/*",onChange:U,className:"sr-only","aria-label":"Choose profile picture"})]}),g.jsx(tr,{children:l&&g.jsxs(g.Fragment,{children:[g.jsx(Me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[60]",onClick:L}),g.jsx(Me.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:O=>O.stopPropagation(),children:g.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-lg overflow-hidden flex flex-col",children:[g.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-100",children:[g.jsx("h3",{className:"text-lg font-bold text-slate-900",children:"Update profile picture"}),g.jsx("button",{onClick:L,className:"p-2 text-slate-400 hover:text-slate-600 hover:bg-slate-100 rounded-full transition-colors","aria-label":"Close modal",children:g.jsx(pr,{size:20})})]}),g.jsxs("div",{className:"p-4 sm:p-6 bg-slate-50 flex flex-col items-center",children:[g.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:g.jsx(da,{image:l,crop:p,zoom:w,aspect:1,cropShape:"round",showGrid:!1,objectFit:"cover",restrictPosition:!0,onCropChange:h,onZoomChange:v,onCropComplete:(O,I)=>D(I),style:{containerStyle:{backgroundColor:"#f8fafc"}}})}),g.jsxs("div",{className:"mt-6 w-full max-w-xs flex items-center gap-4",children:[g.jsx(fr,{size:18,className:"text-slate-500"}),g.jsx(pa,{value:[w],min:1,max:3,step:.05,onValueChange:O=>v(O[0]||1),"aria-label":"Profile picture zoom",className:"flex-1 cursor-pointer"}),g.jsx(hr,{size:18,className:"text-slate-500"})]}),g.jsx("p",{className:"mt-4 text-xs text-slate-500 text-center",children:ye})]}),g.jsxs("div",{className:"p-4 border-t border-slate-100 flex items-center justify-end gap-3 bg-white",children:[g.jsx(Le,{type:"button",variant:"ghost",onClick:L,disabled:b,className:"font-medium text-slate-600 hover:text-slate-900 hover:bg-slate-100 px-5",children:"Cancel"}),g.jsx(Le,{type:"button",onClick:Y,disabled:b||!c,className:"bg-sky-600 hover:bg-sky-700 text-white min-w-[120px] gap-2 shadow-sm",children:b?g.jsxs(g.Fragment,{children:[g.jsx(mr,{size:16,className:"animate-pulse"}),"Saving..."]}):"Save picture"})]})]})})]})})]})};export{Da as M,Ia as P,ja as V,Aa as v};
|
assets/ProfilePictureUploader-Byg9gnjl.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
| 1 |
-
import{c 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-mbyiCUYG.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-BqKfG4Jj.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-oZO0Ye1Q.js";import{M as je}from"./minus-BEbLkPkH.js";import{P as Ue}from"./plus-CbpDHvDO.js";import{U as Fe}from"./upload-CKMt4jtd.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 Ie=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Le=X("camera",Ie);/**
|
| 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 Oe=[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"m21 3-6.75 6.75",key:"pv0uzu"}],["circle",{cx:"10",cy:"14",r:"6",key:"1qwbdc"}]],Mt=X("mars",Oe);/**
|
| 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 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`,
|
| 20 |
-
* `reset`, `load`, `error`, and `select`.
|
| 21 |
-
*
|
| 22 |
-
* Borrows from Modernizr.
|
| 23 |
-
*
|
| 24 |
-
* @param {string} eventNameSuffix Event name, e.g. "click".
|
| 25 |
-
* @param {?boolean} capture Check if the capture phase is supported.
|
| 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;
|
| 33 |
-
right: 0;
|
| 34 |
-
bottom: 0;
|
| 35 |
-
overflow: hidden;
|
| 36 |
-
user-select: none;
|
| 37 |
-
touch-action: none;
|
| 38 |
-
cursor: move;
|
| 39 |
-
display: flex;
|
| 40 |
-
justify-content: center;
|
| 41 |
-
align-items: center;
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
.reactEasyCrop_Image,
|
| 45 |
-
.reactEasyCrop_Video {
|
| 46 |
-
will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
.reactEasyCrop_Contain {
|
| 50 |
-
max-width: 100%;
|
| 51 |
-
max-height: 100%;
|
| 52 |
-
margin: auto;
|
| 53 |
-
position: absolute;
|
| 54 |
-
top: 0;
|
| 55 |
-
bottom: 0;
|
| 56 |
-
left: 0;
|
| 57 |
-
right: 0;
|
| 58 |
-
}
|
| 59 |
-
.reactEasyCrop_Cover_Horizontal {
|
| 60 |
-
width: 100%;
|
| 61 |
-
height: auto;
|
| 62 |
-
}
|
| 63 |
-
.reactEasyCrop_Cover_Vertical {
|
| 64 |
-
width: auto;
|
| 65 |
-
height: 100%;
|
| 66 |
-
}
|
| 67 |
-
|
| 68 |
-
.reactEasyCrop_CropArea {
|
| 69 |
-
position: absolute;
|
| 70 |
-
left: 50%;
|
| 71 |
-
top: 50%;
|
| 72 |
-
transform: translate(-50%, -50%);
|
| 73 |
-
border: 1px solid rgba(255, 255, 255, 0.5);
|
| 74 |
-
box-sizing: border-box;
|
| 75 |
-
box-shadow: 0 0 0 9999em;
|
| 76 |
-
color: rgba(0, 0, 0, 0.5);
|
| 77 |
-
overflow: hidden;
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
-
.reactEasyCrop_CropAreaRound {
|
| 81 |
-
border-radius: 50%;
|
| 82 |
-
}
|
| 83 |
-
|
| 84 |
-
.reactEasyCrop_CropAreaGrid::before {
|
| 85 |
-
content: ' ';
|
| 86 |
-
box-sizing: border-box;
|
| 87 |
-
position: absolute;
|
| 88 |
-
border: 1px solid rgba(255, 255, 255, 0.5);
|
| 89 |
-
top: 0;
|
| 90 |
-
bottom: 0;
|
| 91 |
-
left: 33.33%;
|
| 92 |
-
right: 33.33%;
|
| 93 |
-
border-top: 0;
|
| 94 |
-
border-bottom: 0;
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
.reactEasyCrop_CropAreaGrid::after {
|
| 98 |
-
content: ' ';
|
| 99 |
-
box-sizing: border-box;
|
| 100 |
-
position: absolute;
|
| 101 |
-
border: 1px solid rgba(255, 255, 255, 0.5);
|
| 102 |
-
top: 33.33%;
|
| 103 |
-
bottom: 33.33%;
|
| 104 |
-
left: 0;
|
| 105 |
-
right: 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-B6iQUgiR.js β QuizBattlePage-CgKinHpO.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
assets/RewardsModal-DfvIngtK.js
ADDED
|
@@ -0,0 +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-CP9q7ISf.js";import{aL as u,A as j,aM as U,aN as P,U as B,D as $,N as I,x as R,W as L,T as g,aO as M,a0 as N,R as T,S as q,X,V as w,a1 as v,B as G,Z as H,p as V,z as W,G as Z,a as O,aF as Q,g as J}from"./index-B3ruOzo6.js";import{X as K}from"./x-BNHnAXzL.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.js";import"./vendor-markdown-yqZQ_iQm.js";const Y={BookOpen:O,GraduationCap:Z,Trophy:W,Target:V,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:I,Calendar:$,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),[E,C]=d.useState({});d.useEffect(()=>{if(!o||!i)return;(async()=>{b(!0);try{const t=await Q(i);_(new Set(t.map(a=>a.id)));const r=await F(S(J,"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(K,{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/RewardsModal-gGwAMPUb.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 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-mbyiCUYG.js";import{X as W}from"./x-oZO0Ye1Q.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-C9HBuSrc.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 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-mbyiCUYG.js";import{C as M}from"./circle-check-big-BnoZ8KZB.js";import{T as O,a as Z,b as H}from"./tooltip-Cd2m83Wr.js";import{C as T}from"./chevron-right-bwYIKoxv.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/RightSidebar-GlSyU02g.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{k as B,m as c,Z as E,X as q,$ as P,z as W,a0 as v,a1 as X,o as Y,x as _}from"./index-B3ruOzo6.js";import{C as M}from"./circle-check-big-CWdn1Nqf.js";import{T as O,a as Z,b as H}from"./tooltip-CLSYbTYK.js";import{C as T}from"./chevron-right-CbkkCalp.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.js";import"./vendor-markdown-yqZQ_iQm.js";const k=[{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(E,{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)%k.length)},5e3);return()=>clearInterval(r)},[]);const t=k[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(E,{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}`},G=({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(_,{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(G,{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(_,{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-C3ad9xEg.js β ScientificCalculator-C0Zl3TP5.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{r as c,j as e}from"./vendor-react-B4AQeu28.js";import{
|
| 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,i as de,k as U,m as ue}from"./index-B3ruOzo6.js";import{a as fe,C as pe}from"./chevron-up-CTb5_AvY.js";import{X as be}from"./x-BNHnAXzL.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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-CQfmcUsu.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-mbyiCUYG.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-CoeUXWgK.css"])))=>i.map(i=>d[i]);
|
| 2 |
-
import{c 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-mbyiCUYG.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-B04HpeAZ.js";import{B as f}from"./button-BqKfG4Jj.js";import{I as n}from"./input-DEPoMoHZ.js";import{S as d}from"./switch-CHYfNJFI.js";import pe from"./ConfirmModal-BsY1WFdG.js";import{P as Ze,M as es,V as ss}from"./ProfilePictureUploader-Byg9gnjl.js";import{B as ye}from"./bell-D_pyutJs.js";import{D as je}from"./download-C2PVrIq3.js";import{X as ge}from"./x-oZO0Ye1Q.js";import{C as ts}from"./circle-help-BP0kOuya.js";import{C as as}from"./clock-BLtPbCgT.js";import{T as ns}from"./trash-2-8qZ3aehj.js";import{E as is,a as ls}from"./eye-DakyBxPE.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-B_-cQcm8.js";import"./check-BLN5Dl8e.js";import"./log-out-Ddy014zi.js";import"./minus-BEbLkPkH.js";import"./plus-CbpDHvDO.js";import"./upload-CKMt4jtd.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-mbyiCUYG.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/SettingsModal-DILgCJsp.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B3ruOzo6.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-BPuEd8FG.js","assets/vendor-charts-D7t7JfSr.js","assets/vendor-markdown-yqZQ_iQm.js","assets/vendor-markdown-CfVKi3_s.css","assets/index-trN1hCQB.css"])))=>i.map(i=>d[i]);
|
| 2 |
+
import{e as se,u as Te,aQ as Le,aR as Me,aS as _e,aT as De,aU as qe,aV as Ie,x as Fe,S as Ve,W as Oe,a as Ge,k as He,m as V,L as Ue,_ as fe,l as x,aW as Qe,aX as We,aY as Xe,aZ as Be}from"./index-B3ruOzo6.js";import{r as a,j as e}from"./vendor-react-B4AQeu28.js";import{S as $e,a as Ye,b as Je,c as Ke,d as Z}from"./select-C142YWNr.js";import{B as f}from"./button-CaSK4KoS.js";import{I as n}from"./input-kh84w1XK.js";import{S as d}from"./switch-UwrfTEB3.js";import pe from"./ConfirmModal-BjVnuYqC.js";import{P as Ze,M as es,V as ss,v as ts}from"./ProfilePictureUploader-B3ToJmez.js";import{B as ye}from"./bell-Bp_utT8v.js";import{D as je}from"./download-BbFDZT3H.js";import{X as ge}from"./x-BNHnAXzL.js";import{C as as}from"./circle-help-C5HGdkRZ.js";import{C as ns}from"./clock-C73na4Cu.js";import{T as is}from"./trash-2-CjkT7lLr.js";import{E as ls,a as rs}from"./eye-WyNbhirJ.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.js";import"./vendor-markdown-yqZQ_iQm.js";import"./chevron-up-CTb5_AvY.js";import"./check-6eXlU5jr.js";import"./log-out-CoRJnfoO.js";import"./minus-B69_eMXI.js";import"./plus-Dx0gdu7_.js";import"./upload-BBhypj4u.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 cs=[["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"}]],os=se("palette",cs);/**
|
| 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 ds=[["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"}]],xs=se("server",ds);/**
|
| 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 ms=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],hs=se("smartphone",ms),us=()=>{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 o=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:o,saveAdminConfig:L}},ee=()=>JSON.parse(JSON.stringify(Qe)),Qs=({isOpen:m,onClose:y,profileData:l,onSave:E,settingsData:z,onSaveSettings:R,onApplySettingsPreview:C,onExportData:T,onClearCache:_,onResetData:S})=>{const o=l?.role||"student",{teacherPrefs:L,adminConfig:k,saveTeacherPrefs:u,saveAdminConfig:ve}=us(),[p,Ne]=a.useState("account"),[c,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,bs]=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(""),W=a.useRef(!1),X=a.useRef(ee());a.useEffect(()=>{if(!m){W.current=!1;return}if(W.current)return;W.current=!0;const s=z?JSON.parse(JSON.stringify(z)):ee();X.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?.(X.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:os},{id:"privacy",label:"Privacy & Security",icon:Ve}];return o==="student"&&s.push({id:"learning",label:"Learning",icon:Oe}),o==="teacher"&&s.push({id:"teaching",label:"Teaching",icon:Ge}),o==="admin"&&s.push({id:"system",label:"System",icon:xs}),s.push({id:"data",label:"Data & Storage",icon:je}),s},[o]),r=s=>{te(t=>s(t))},B=s=>{Se(s),ce(""),de(!1),s==="password"&&xe(""),s==="email"&&me(c.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 We(M,Q),x.success("Password updated")}else if(b==="email"){if(!F.includes("@")){x.error("Enter a valid email");return}await Xe(M,F),h(s=>({...s,email:F})),x.success("Email updated")}else if(b==="delete"){await Be(M,c.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()=>{const s=ts({name:c.name,phone:c.phone});if(s){x.error(s);return}ae(!0);try{E&&await E(c),R&&await R(i),o==="teacher"&&await u(j),o==="admin"&&await ve(v),y()}catch(t){x.error(t instanceof Error?t.message:"Failed to save settings")}finally{ae(!1)}},$=()=>{P(!1),q(!1),I(!1),C?.(X.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),B("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:$,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:$,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:c.uid,photoURL:c.photo,displayName:c.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:c.name||"",onChange:s=>h(t=>({...t,name:s.target.value})),maxLength:100,autoComplete:"name",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:c.email||"",disabled:!0,className:"flex-1 bg-slate-100"}),e.jsx(f,{variant:"outline",size:"sm",onClick:()=>B("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:c.phone||"",onChange:s=>h(t=>({...t,phone:s.target.value})),maxLength:20,inputMode:"tel",autoComplete:"tel",pattern:"^\\+?[0-9 ()\\-.]{7,20}$",placeholder:"+63 912 345 6789",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($e,{value:c.gender||"",onValueChange:s=>h(t=>({...t,gender:s})),children:[e.jsx(Ye,{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(as,{className:"size-4 text-gray-500"}),e.jsx("span",{children:"Prefer not to say"})]})})]})]})]}),o==="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:c.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:c.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:c.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:c.school||"",onChange:s=>h(t=>({...t,school:s.target.value})),className:"max-w-md"})]})]}),o==="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:c.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:c.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:c.yearsOfExperience||"",onChange:s=>h(t=>({...t,yearsOfExperience:s.target.value})),className:"max-w-md"})]})]}),o==="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:c.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:()=>B("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}}))})]}),o==="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(Y=>({...Y,pushPreferences:{...Y.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-B3ruOzo6.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(ns,{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"&&o==="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(hs,{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"&&o==="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"&&o==="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:[o==="student"&&"Reset quizzes, diagnostic state, XP, and learning progress for retesting.",o==="teacher"&&"Reset imported records, managed classrooms, and teacher-generated quiz artifacts.",o==="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(is,{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:$,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(ls,{size:16}):e.jsx(rs,{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 ${o} 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{Qs as default};
|
assets/Sidebar-1AFatJJg.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import{r as x,j as e}from"./vendor-react-B4AQeu28.js";import{S as _,a as $,L as u,M as B}from"./LogoutActionButton-D5BV__Zd.js";import{e as P,m as c,j as D,U as S,G as N,a as m,S as G,X as U,z as q}from"./index-B3ruOzo6.js";import{T as M,a as L,b as C}from"./tooltip-CLSYbTYK.js";import{X as F}from"./x-BNHnAXzL.js";import{C as Q}from"./chevron-right-CbkkCalp.js";import{C as W}from"./chevron-left-Cr0wYLQi.js";import{C as z}from"./chart-column-C9VTl-3A.js";import{S as X}from"./shirt-BBR3GIpi.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=P("cpu",J),R=({activeTab:b,setActiveTab:A,userRole:f="student",onOpenSettings:g,onLogout:y,sidebarCollapsed:o=!1,setSidebarCollapsed:j,mode:T="desktop",onRequestClose:v,forceCollapsed:n=!1})=>{const[E,p]=x.useState(!1),[k,t]=x.useState(null),i=T==="mobile",r=!n&&E,h=typeof g=="function",a=!i&&(n||o&&!r),l=a,I=!i&&!n;x.useEffect(()=>{n&&(p(!1),t(null))},[n]),x.useEffect(()=>{l||t(null)},[l]);const O=f==="admin"?[{label:"Management",items:[{icon:u,label:"Overview"},{icon:S,label:"User Management"},{icon:N,label:"Subjects"},{icon:m,label:"Content"}]},{label:"Insights",items:[{icon:z,label:"Analytics"},{icon:K,label:"AI Monitoring"},{icon:G,label:"Audit Log"}]}]:f==="teacher"?[{label:"Teaching",items:[{icon:u,label:"Dashboard"},{icon:S,label:"My Students"},{icon:m,label:"Classes"}]},{label:"Insights",items:[{icon:z,label:"Analytics"}]}]:[{label:"Learn",items:[{icon:u,label:"Dashboard"},{icon:m,label:"Modules"},{icon:B,label:"AI Chat"}]},{label:"Progress",items:[{icon:N,label:"Grades",displayLabel:"Assessment"},{icon:U,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:i?{width:280}:{width:a?80:280},transition:{type:"spring",stiffness:360,damping:34},onMouseEnter:()=>I&&o&&p(!0),onMouseLeave:()=>{p(!1),t(null)},className:D("h-full bg-[#f7f9fc] border border-[#dde3eb] shadow-sm flex flex-col",i?"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"})})]}),i&&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})}),!i&&!n&&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,H)=>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(M,{open:l&&k===s.label,children:[e.jsx(L,{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:()=>A(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(C,{side:"right",sideOffset:16,className:"font-bold text-xs",children:s.displayLabel||s.label})]},s.label))})]},H))})]}),e.jsxs("div",{className:"mt-4 space-y-2 border-t border-[#dde3eb] pt-4",children:[e.jsxs(M,{open:l&&k==="Settings",children:[e.jsx(L,{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(_,{size:18,strokeWidth:2,className:"flex-shrink-0"}),(!a||r)&&e.jsx("span",{className:"font-body text-xs",children:"Settings"})]})}),l&&e.jsx(C,{side:"right",sideOffset:16,className:"font-bold text-xs",children:"Settings"})]}),y&&e.jsx("div",{className:"text-[#5a6578]",children:e.jsx($,{onClick:y,collapsed:a})})]})]})},ie=Object.freeze(Object.defineProperty({__proto__:null,default:R},Symbol.toStringTag,{value:"Module"}));export{K as C,R as S,ie as a};
|
assets/Sidebar-CnFPEtsr.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
| 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-DQLJH-aF.js";import{c 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-mbyiCUYG.js";import{T as L,a as C,b as z}from"./tooltip-Cd2m83Wr.js";import{X as F}from"./x-oZO0Ye1Q.js";import{C as Q}from"./chevron-right-bwYIKoxv.js";import{C as W}from"./chevron-left-BYtw_nqd.js";import{C as A}from"./chart-column-B4tQNTpN.js";import{S as V}from"./shirt-nq7Lov7c.js";import"./log-out-Ddy014zi.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-DX4KIC1c.js β SupplementalBanner-BaFvS7H9.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{j as e,r as y}from"./vendor-react-B4AQeu28.js";import{
|
|
|
|
| 1 |
+
import{j as e,r as y}from"./vendor-react-B4AQeu28.js";import{k as j,m as p,v as h,a as f,T as m,B as x}from"./index-B3ruOzo6.js";import{X as v}from"./x-BNHnAXzL.js";import{S as w}from"./sparkles-Bq0AaIRg.js";import{C as g}from"./chevron-right-CbkkCalp.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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-BcOOOGo2.js β SupplementalPillCarousel-Dxq4aiMj.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{r as a,j as e}from"./vendor-react-B4AQeu28.js";import{m as f,
|
| 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,v as x}from"./index-B3ruOzo6.js";import{C as n}from"./chevron-right-CbkkCalp.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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-DH_EClon.js
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
assets/TeacherDashboard-DyMHG-dm.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
assets/XPNotification-B5D6Y4_2.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{g as n,m as i,$ as m}from"./index-mbyiCUYG.js";import{S as c}from"./sparkles-THbTTiEe.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/XPNotification-Doid3miV.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{r as l,j as e}from"./vendor-react-B4AQeu28.js";import{k as n,m as i,a1 as m}from"./index-B3ruOzo6.js";import{S as c}from"./sparkles-Bq0AaIRg.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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-pLIzsro_.js β automationService-JEEI7dc9.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 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{
|
|
|
|
| 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{g as r,b0 as $}from"./index-B3ruOzo6.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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-D_pyutJs.js β bell-Bp_utT8v.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
import{
|
| 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
|
|
|
|
| 1 |
+
import{e}from"./index-B3ruOzo6.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=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],a=e("bell",o);export{a as B};
|
assets/button-BqKfG4Jj.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 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-mbyiCUYG.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/button-CaSK4KoS.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{j as y}from"./vendor-react-B4AQeu28.js";import{S as k}from"./vendor-radix-BPuEd8FG.js";import{c as V}from"./vendor-charts-D7t7JfSr.js";import{j}from"./index-B3ruOzo6.js";const g=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,m=V,p=(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=p("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:j(N({variant:r,size:e,className:n})),...u})}export{w as B,p as c};
|
assets/{chart-column-B4tQNTpN.js β chart-column-C9VTl-3A.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{
|
| 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-B3ruOzo6.js";/**
|
| 2 |
* @license lucide-react v0.487.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
assets/{chatService-BuuZ3z6i.js β chatService-oZskyXOh.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-CP9q7ISf.js";import{
|
|
|
|
| 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{g as a}from"./index-B3ruOzo6.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-BPuEd8FG.js";import"./vendor-charts-D7t7JfSr.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};
|
assets/{check-BLN5Dl8e.js β check-6eXlU5jr.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{c}from"./index-
|
| 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-B3ruOzo6.js";/**
|
| 2 |
* @license lucide-react v0.487.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
assets/{chevron-left-BYtw_nqd.js β chevron-left-Cr0wYLQi.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
import{
|
| 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=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],
|
|
|
|
| 1 |
+
import{e}from"./index-B3ruOzo6.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=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],c=e("chevron-left",o);export{c as C};
|
assets/{chevron-right-bwYIKoxv.js β chevron-right-CbkkCalp.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
import{
|
| 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
|
|
|
|
| 1 |
+
import{e as o}from"./index-B3ruOzo6.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 e=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],c=o("chevron-right",e);export{c as C};
|