1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1353],{15173:(e,t,s)=>{function n(e){var t;return"/tutor"===e||null!=(t=null==e?void 0:e.startsWith("/tutor/"))&&t}function r(e){return!!(null==e?void 0:e.startsWith("/student/"))&&!e.startsWith("/student/profile")}function i(e){var t;return null!=(t=null==e?void 0:e.startsWith("/student/profile"))&&t}s.d(t,{Kp:()=>n,LE:()=>r,_S:()=>i})},22320:(e,t,s)=>{s.d(t,{A:()=>f});var n=s(79490),r=s(77066),i=s(39162),a=s(46202),l=s(43352),o=s(70820),c=s(88313),d=s(15173),u=s(44950),h=s(65344),m=s(52736),x=s(65947);function p(e){return"group flex gap-2 items-center px-3 py-2 rounded transition-colors ".concat(e?"bg-[#FBF4E6] text-coral font-semibold":"text-[#242424] font-normal hover:bg-[#FBF4E6] hover:text-coral hover:font-semibold")}function f(e){var t,s;let{variant:f="compact",align:g="right",avatarUrl:v,displayName:b,showRole:w=!0,className:j="",extraLink:y}=e,{user:N,signOut:C}=(0,l.As)(),{roles:k}=(0,o.z)(),L=(0,a.a8)(),E=(0,i.c)("header"),_=(0,i.c)("common"),[S,I]=(0,r.useState)(!1),[A,R]=(0,r.useState)(!1);if(!N)return null;let M=b||(0,c.ZE)(N,"User"),P=v||(null==(t=N.user_metadata)?void 0:t.profile_image_url)||(null==(s=N.user_metadata)?void 0:s.avatar_url),T=k.includes("tutor")?"roleTutor":"roleStudent",F=(0,d.Kp)(L),z=(0,d.LE)(L),B=(0,d._S)(L),D=async()=>{try{R(!0),await C()}catch(e){console.error("Sign out error:",e)}finally{R(!1),I(!1)}},O=(0,n.jsxs)(n.Fragment,{children:[S&&(0,n.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:()=>I(!1)}),S&&(0,n.jsx)("div",{className:"absolute z-50 mt-2 min-w-[197px] rounded-xl border bg-white overflow-hidden ".concat("right"===g?"right-0":"left-0"),style:{borderColor:"#D9D9D9",boxShadow:"0px 4px 10px 0px rgba(0, 0, 0, 0.25)"},children:(0,n.jsxs)("div",{className:"p-2 font-noto",style:{fontSize:"12px"},children:[(0,n.jsxs)("div",{className:"px-3 py-2 mb-2 border-b",style:{borderColor:"#D9D9D9"},children:[(0,n.jsx)("span",{style:{color:"#B8BFCA"},children:_("signedInAs")}),(0,n.jsx)("br",{}),(0,n.jsx)("span",{style:{color:"#242424"},children:(0,c.g8)(N)})]}),k.includes("tutor")&&(0,n.jsxs)(a.N_,{href:"/tutor",className:p(F),onClick:()=>I(!1),children:[(0,n.jsx)(u.A,{className:"w-4 h-4 flex-shrink-0 text-[#242424] transition-colors group-hover:text-coral",style:F?{color:"var(--color-primary)"}:void 0}),E("tutorDashboard")]}),(0,n.jsxs)(a.N_,{href:"/student/dashboard",className:p(z),onClick:()=>I(!1),children:[(0,n.jsx)(u.A,{className:"w-4 h-4 flex-shrink-0 text-[#242424] transition-colors group-hover:text-coral",style:z?{color:"var(--color-primary)"}:void 0}),E("studentDashboard")]}),(0,n.jsxs)(a.N_,{href:"/student/profile",className:p(B),onClick:()=>I(!1),children:[(0,n.jsx)(h.A,{className:"w-4 h-4 flex-shrink-0 text-[#242424] transition-colors group-hover:text-coral",style:B?{color:"var(--color-primary)"}:void 0}),E("profileSettings")]}),y&&(0,n.jsxs)(a.N_,{href:y.href,className:"group flex gap-2 items-center px-3 py-2 rounded text-[#242424] font-normal transition-colors hover:bg-[#FBF4E6] hover:text-coral hover:font-semibold",onClick:()=>I(!1),children:[(0,n.jsx)(h.A,{className:"w-4 h-4 flex-shrink-0 text-[#242424] transition-colors group-hover:text-coral"}),y.label]}),(0,n.jsx)("div",{className:"pt-2 mt-2 border-t",style:{borderColor:"#D9D9D9"},children:(0,n.jsxs)("button",{onClick:D,disabled:A,className:"flex gap-2 items-center px-3 py-2 w-full rounded text-coral font-normal [&_svg]:text-coral transition-colors hover:bg-[#FBF4E6] hover:font-semibold disabled:opacity-50",children:[(0,n.jsx)(m.A,{className:"w-4 h-4 flex-shrink-0"}),_(A?"signingOut":"signOut")]})})]})})]});return"full"===f?(0,n.jsxs)("div",{className:"relative ml-2 pl-2 border-l border-token-border ".concat(j),children:[(0,n.jsxs)("button",{onClick:()=>I(!S),className:"flex gap-3 items-center px-2 py-1.5 rounded-[10px] border transition-all ".concat(S?"shadow-[0px_4px_10px_0px_rgba(0,0,0,0.25)]":"border-transparent"),style:{backgroundColor:S?"#FEF9F4":"#FFFFFF",borderColor:S?"#D9D9D9":"transparent"},children:[(0,n.jsx)("div",{className:"flex overflow-hidden justify-center items-center w-8 h-8 flex-shrink-0 text-sm font-medium text-white rounded-full bg-token-primary",children:P?(0,n.jsx)("img",{src:P,alt:String(M),className:"object-cover w-8 h-8 rounded-full"}):String(M).charAt(0).toUpperCase()}),(0,n.jsxs)("div",{className:"hidden lg:block text-left font-noto",style:{fontSize:"12px"},children:[(0,n.jsx)("div",{className:"font-medium leading-tight",style:{color:"#4B5563"},children:String(M)}),w&&(0,n.jsx)("div",{className:"font-normal leading-tight",style:{color:"#B8BFCA"}
1,children:E(T)})]}),(0,n.jsx)(x.A,{className:"w-2 h-2 flex-shrink-0 transition-transform ".concat(S?"rotate-180":""),style:{color:"#272636"}})]}),O]}):"compact"===f?(0,n.jsxs)("div",{className:"relative ".concat(j),children:[(0,n.jsxs)("button",{onClick:()=>I(!S),className:"flex gap-2 items-center",children:[(0,n.jsx)("div",{className:"flex overflow-hidden justify-center items-center w-8 h-8 text-sm font-medium text-white rounded-full bg-token-primary",children:P?(0,n.jsx)("img",{src:P,alt:String(M),className:"object-cover w-8 h-8 rounded-full"}):String(M).charAt(0).toUpperCase()}),(0,n.jsx)(x.A,{className:"w-4 h-4 text-token-text-muted transition-transform ".concat(S?"rotate-180":"")})]}),O]}):(0,n.jsxs)("div",{className:"relative ".concat(j),children:[(0,n.jsxs)("button",{onClick:()=>I(!S),className:"flex gap-2 items-center px-3 py-2 rounded-lg transition-colors hover:bg-token-surface-accent",style:{backgroundColor:S?"#FEF9F4":void 0,border:S?"1px solid #D9D9D9":void 0,boxShadow:S?"0px 4px 10px 0px rgba(0, 0, 0, 0.25)":void 0},children:[(0,n.jsx)("div",{className:"flex overflow-hidden justify-center items-center w-8 h-8 text-sm font-medium text-white rounded-full bg-token-primary",children:P?(0,n.jsx)("img",{src:P,alt:String(M),className:"object-cover w-8 h-8 rounded-full"}):String(M).charAt(0).toUpperCase()}),(0,n.jsx)("span",{className:"hidden md:block text-sm text-token-text-secondary max-w-[150px] truncate",children:String(M)}),(0,n.jsx)(x.A,{className:"w-4 h-4 text-token-text-muted transition-transform ".concat(S?"rotate-180":"")})]}),O]})}},37152:(e,t,s)=>{let n;s.d(t,{T8:()=>j,Pm:()=>y});var r=s(79490),i=s(77066),a=s(43352),l=s(42046),o=s(34600),c=s(68364);function d(e){return!e||"object"!=typeof e||Array.isArray(e)?null:e}function u(e){return"string"==typeof e&&e.length>0}class h{accept(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();for(let[e,s]of this.entries)t-s>=this.options.ttlMs&&this.entries.delete(e);if(this.entries.has(e))return!1;for(this.entries.set(e,t);this.entries.size>this.options.capacity;){let e=this.entries.keys().next().value;e&&this.entries.delete(e)}return!0}clear(){this.entries.clear()}get size(){return this.entries.size}constructor(e={capacity:1e3,ttlMs:6e5}){this.options=e,this.entries=new Map}}function m(e,t,s){console[e]("[chat-rtm]",{event:t,...s})}class x{schedule(e,t){let s=setTimeout(()=>{this.timers.delete(s),e()},t);this.timers.add(s)}cancelAll(){for(let e of this.timers)clearTimeout(e);this.timers.clear()}pendingCount(){return this.timers.size}async runNext(){throw Error("TimerReconnectScheduler does not support runNext")}constructor(){this.timers=new Set}}class p{getHealth(){return this.health}start(){return"stopped"===this.health&&this.setHealth("connecting"),null!=this.startPromise||(this.startPromise=this.connect()),this.startPromise}async stop(){this.reconnectScheduler.cancelAll(),this.reconnectPending=!1,this.reconnectAttempt=0,this.clearProactiveRenewal(),this.removeFocusListener();let e=this.rtm;for(let e of(this.rtm=null,this.session=null,this.priorUserId=null,this.startPromise=null,this.restorePromise=null,this.renewPromise=null,this.inboxReady=!1,this.conversations.clear(),this.acquireChains.clear(),this.dedupe.clear(),this.disposers.splice(0)))e();this.setHealth("stopped"),await (null==e?void 0:e.disconnect().catch(()=>void 0))}onHealth(e){return this.healthListeners.add(e),()=>{this.healthListeners.delete(e)}}onInboxReady(e){return this.inboxReadyListeners.add(e),this.inboxReady&&queueMicrotask(e),()=>{this.inboxReadyListeners.delete(e)}}onInboxEvent(e){return this.inboxListeners.add(e),()=>{this.inboxListeners.delete(e)}}onConversationEvent(e,t){var s;let n=null!=(s=this.conversationListeners.get(e))?s:new Set;return n.add(t),this.conversationListeners.set(e,n),()=>{n.delete(t),0===n.size&&this.conversationListeners.delete(e)}}async acquireConversation(e){var t;await this.start();let s=null!=(t=this.acquireChains.get(e.conversationId))?t:Promise.resolve(),n=(async()=>(await s.catch(()=>void 0),this.acquireConversationLocked(e)))(),r=n.then(()=>void 0,()=>void 0);return this.acquireChains.set(e.conversationId,r),r.finally(()=>{this.acquireChains.get(e.conversationId)===r&&this.acquireChains.delete(e.conversationId)}),n}async acquireConversationLocked(e){let t=this.conversations.get(e.conversationId);if(t&&t.currentUserRole!==e.role)throw Error("Conversation role mismatch");let s=await this.loadConversationAccess(e.conversationId,e.role),n=this.conversations.get(e.conversationId);if(n){if(n.currentUserRole!==e.role)throw Error("Conversation role mismatch");n.refCount+=1}else{let t=this.rtm;if(!t)throw Error("General Chat RTM is not connected");await t.subscribe(s.conversationChannelName,{withPresence:!1});let n=this.conversations.get(e.conversationId);n?n.refCount+=1:this.conversations.set(e.conversationId,{...s,refCount:1})}let r=!1;return async()=>{r||(r=!0,await this.releaseConversation(e.conversationId))}}
1async connect(){this.setHealth("connecting");let e=null;try{let t=await this.fetchSession();if(e=await this.connectRtm({tokenProvider:()=>this.fetchSession(),enablePresence:!1,onTokenRenewalError:e=>this.handleRenewalError(e)}),"stopped"===this.health)return void await e.disconnect().catch(()=>void 0);this.session=t,this.rtm=e,this.installOneSetOfListeners(e),this.installFocusListener(),await e.subscribe(t.inboxChannelName,{withPresence:!1}),await this.restoreConversationSubscriptions(),this.reconnectAttempt=0,this.setHealth("healthy"),this.emitInboxReady(),this.scheduleProactiveRenewal(t.expiresAt)}catch(t){throw await this.abortFailedStart(e),t}}async fetchSession(){let e=await this.loadSession(this.clientInstanceId,this.role);return this.priorUserId&&this.priorUserId!==e.userId&&this.dedupe.clear(),this.priorUserId=e.userId,this.session&&(this.session={...this.session,...e},this.scheduleProactiveRenewal(e.expiresAt)),e}installOneSetOfListeners(e){this.disposers.push(e.onMessage(e=>{this.handleRawMessage(e)}),e.onLinkState(e=>{this.handleLinkState(e)}))}handleRawMessage(e){let t;if(e.publisher){try{var s;t=JSON.parse((s=e.message,"string"==typeof s?s:new TextDecoder().decode(s)))}catch(e){return}this.handleMessage({channelName:e.channelName,transportPublisherUserId:e.publisher,event:t})}}handleMessage(e){var t,s,n;let r=null==(t=this.session)?void 0:t.inboxChannelName,i=[...this.conversations.values()].find(t=>t.conversationChannelName===e.channelName),a=function(e,t){let s;if(!t.publisherUserId||e.transportPublisherUserId!==t.publisherUserId||"xpeak-chat-server"!==e.transportPublisherUserId||e.channelName!==t.channelName)return null;let n=d(e.event);if(!n)return null;try{s=JSON.stringify(n)}catch(e){return null}if(i=s,new TextEncoder().encode(i).byteLength>24576)return null;let r=d(n.payload);if(!r||1!==n.schemaVersion||!u(n.eventId)||!u(n.correlationId)||"number"!=typeof n.sentAt||!Number.isFinite(n.sentAt))return null;if("conversation.message.created"===n.eventType){var i,a;if("conversation"!==n.scopeType||!u(n.scopeId)||!t.conversationId||n.scopeId!==t.conversationId||!u(n.messageId))return null;let e=function(e){if(!u(e.id)||!u(e.sender_id)||"string"!=typeof e.content||!u(e.created_at)||!u(e.message_type))return null;let t={id:e.id,sender_id:e.sender_id,content:e.content,created_at:e.created_at,message_type:e.message_type};return"string"==typeof e.file_name&&e.file_name&&(t.file_name=e.file_name),"number"==typeof e.file_size&&Number.isFinite(e.file_size)&&(t.file_size=e.file_size),"string"==typeof e.file_type&&e.file_type&&(t.file_type=e.file_type),t}(null!=(a=d(r.message))?a:{});return e&&n.messageId===e.id&&"boolean"==typeof r.requiresHydration?{schemaVersion:1,eventId:n.eventId,correlationId:n.correlationId,messageId:n.messageId,eventType:"conversation.message.created",scopeType:"conversation",scopeId:n.scopeId,sentAt:n.sentAt,payload:{message:e,requiresHydration:r.requiresHydration}}:null}if("conversation.state.invalidated"===n.eventType){if("inbox"!==n.scopeType||!u(n.scopeId)||!t.inboxChannelName||n.scopeId!==t.inboxChannelName||!u(r.conversationId)||"student"!==r.targetRole&&"tutor"!==r.targetRole||"message-created"!==r.reason&&"marked-read"!==r.reason)return null;let e=r.requiresHydration,s=r.messageId;return(void 0===e||"boolean"==typeof e)&&(!0!==e||u(s))?{schemaVersion:1,eventId:n.eventId,correlationId:n.correlationId,eventType:"conversation.state.invalidated",scopeType:"inbox",scopeId:n.scopeId,sentAt:n.sentAt,payload:{conversationId:r.conversationId,targetRole:r.targetRole,reason:r.reason,...void 0!==e?{requiresHydration:e}:{},...u(s)?{messageId:s}:{}}}:null}return null}(e,{publisherUserId:null==(s=this.session)?void 0:s.chatPublisherUserId,channelName:e.channelName,inboxChannelName:r,conversationId:null==i?void 0:i.conversationId});if(a&&this.dedupe.accept(a.eventId)){if(m("info","message_received",{eventId:a.eventId,eventType:a.eventType,scopeType:a.scopeType}),"conversation.state.invalidated"===a.eventType)return void this.inboxListeners.forEach(e=>e(a));
1null==(n=this.conversationListeners.get(a.scopeId))||n.forEach(e=>e(a))}}handleLinkState(e){if("stopped"!==this.health){var t;if("SAME_UID_LOGIN"===e.reasonCode){this.setHealth("degraded"),m("error","same_uid_login",{clientInstanceId:this.clientInstanceId}),this.shutdownRtmOnly();return}if("CONNECTED"===e.currentState)return void this.serializedRestore();("DISCONNECTED"===(t=e.currentState)||"FAILED"===t||"SUSPENDED"===t)&&(this.setHealth("degraded"),this.scheduleOneReconnect())}}scheduleOneReconnect(){var e;if("stopped"===this.health||this.reconnectPending)return;this.reconnectPending=!0;let t=null!=(e=this.reconnectDelays[Math.min(this.reconnectAttempt,this.reconnectDelays.length-1)])?e:3e4;this.reconnectAttempt+=1,this.reconnectScheduler.schedule(async()=>{if(this.reconnectPending=!1,"stopped"!==this.health)try{await this.performReconnect()}catch(e){this.setHealth("degraded"),this.scheduleOneReconnect()}},t)}async performReconnect(){if(this.rtm&&this.session)return void await this.serializedRestore();this.startPromise=null,await this.start()}serializedRestore(){return null!=this.restorePromise||(this.restorePromise=this.restoreSubscriptions().catch(e=>{throw this.setHealth("degraded"),e}).finally(()=>{this.restorePromise=null})),this.restorePromise}async restoreSubscriptions(){this.rtm&&this.session&&"stopped"!==this.health&&(await this.rtm.subscribe(this.session.inboxChannelName,{withPresence:!1}),await this.restoreConversationSubscriptions(),this.reconnectAttempt=0,this.setHealth("healthy"),this.emitInboxReady())}async restoreConversationSubscriptions(){if(this.rtm)for(let e of this.conversations.values())await this.rtm.subscribe(e.conversationChannelName,{withPresence:!1})}async releaseConversation(e){let t=this.conversations.get(e);if(t){if(t.refCount<=1){var s;this.conversations.delete(e),await (null==(s=this.rtm)?void 0:s.unsubscribe(t.conversationChannelName).catch(()=>void 0));return}t.refCount-=1}}async shutdownRtmOnly(){this.reconnectScheduler.cancelAll(),this.reconnectPending=!1,this.clearProactiveRenewal();let e=this.rtm;for(let e of(this.rtm=null,this.startPromise=null,this.restorePromise=null,this.inboxReady=!1,this.disposers.splice(0)))e();await (null==e?void 0:e.disconnect().catch(()=>void 0))}async abortFailedStart(e){var t;this.startPromise=null;let s=null!=(t=this.rtm)?t:e;for(let e of(this.rtm=null,this.session=null,this.inboxReady=!1,this.disposers.splice(0)))e();"stopped"!==this.health&&this.setHealth("degraded"),await (null==s?void 0:s.disconnect().catch(()=>void 0))}scheduleProactiveRenewal(e){this.clearProactiveRenewal();let t=Date.parse(e);if(!Number.isFinite(t))return;let s=Math.min(Math.max(0,t-6e4-Date.now()),0x7fffffff);this.renewTimer=setTimeout(()=>{this.runProactiveRenewal()},s)}clearProactiveRenewal(){null!==this.renewTimer&&(clearTimeout(this.renewTimer),this.renewTimer=null)}checkRenewalDeadline(){if(!this.session||!this.rtm||"stopped"===this.health)return;let e=Date.parse(this.session.expiresAt);Number.isFinite(e)&&e-Date.now()<=6e4&&this.runProactiveRenewal()}runProactiveRenewal(){return null!=this.renewPromise||(this.renewPromise=this.renewTokenNow().catch(e=>{this.handleRenewalError(e)}).finally(()=>{this.renewPromise=null})),this.renewPromise}async renewTokenNow(){this.rtm&&(await this.rtm.renewTokenNow(),this.session&&this.scheduleProactiveRenewal(this.session.expiresAt))}handleRenewalError(e){"stopped"!==this.health&&(this.setHealth("degraded"),m("error","token_renewal_failed",{clientInstanceId:this.clientInstanceId}),this.scheduleOneReconnect())}installFocusListener(){if(this.focusDisposer)return;let e=()=>{this.checkRenewalDeadline()};window.addEventListener("focus",e),this.focusDisposer=()=>{window.removeEventListener("focus",e)}}removeFocusListener(){var e;null==(e=this.focusDisposer)||e.call(this),this.focusDisposer=null}emitInboxReady(){for(let e of(this.inboxReady=!0,this.inboxReadyListeners))e()}setHealth(e){if(this.health!==e)for(let t of(this.health=e,this.healthListeners))t(e)}constructor(e){var t,s,n,r,i;this.reconnectDelays=[1e3,2e3,5e3,1e4,3e4],this.health="stopped",this.startPromise=null,this.restorePromise=null,this.renewPromise=null,this.rtm=null,this.session=null,this.priorUserId=null,this.inboxReady=!1,this.reconnectPending=!1,this.reconnectAttempt=0,this.renewTimer=null,this.focusDisposer=null,this.disposers=[],this.conversations=new Map,this.acquireChains=new Map,this.healthListeners=new Set,this.inboxReadyListeners=new Set,this.inboxListeners=new Set,this.conversationListeners=new Map,this.clientInstanceId=e.clientInstanceId,this.role=e.role,this.loadSession=null!=(t=e.loadSession)?t:o.Q1.generateGeneralChatSession.bind(o.Q1),this.loadConversationAccess=null!=(s=e.loadConversationAccess)?s:o.Q1.getConversationRealtimeAccess.bind(o.Q1),this.connectRtm=null!=(n=e.connectRtm)?n:c.Lm.connect,this.reconnectScheduler
1=null!=(r=e.reconnectScheduler)?r:new x,this.dedupe=null!=(i=e.dedupe)?i:new h}}var f=s(37811);let g=(0,i.createContext)(null),v=null,b=null;function w(){null!==b&&(clearTimeout(b),b=null)}function j(e){var t;let{user:s}=(0,a.As)(),o=null!=(t=null==s?void 0:s.id)?t:null,{role:c}=e,d="false"!==f.env.NEXT_PUBLIC_GENERAL_CHAT_RTM_ENABLED,[u,h]=(0,i.useState)(null);return(0,i.useEffect)(()=>d&&o?(h(function(e,t){if(w(),(null==v?void 0:v.userId)===e&&v.role===t)return v.refCount+=1,v.manager;if(v){let e=v;v=null,e.manager.stop()}let s=new p({clientInstanceId:(null!=n||(n=(0,l.l)()),n),role:t});return v={userId:e,role:t,manager:s,refCount:1},s.start(),s}(o,c)),()=>{!function(e,t){if(!v||v.userId!==e||v.role!==t||(v.refCount-=1,v.refCount>0))return;let s=v;w(),b=setTimeout(()=>{b=null,v===s&&v.refCount<=0&&(v=null,s.manager.stop())},0)}(o,c),h(null)}):void h(null),[d,o,c]),(0,r.jsx)(g.Provider,{value:u,children:e.children})}function y(){return(0,i.useContext)(g)}},38305:(e,t,s)=>{s.d(t,{A:()=>f});var n=s(79490),r=s(77066),i=s(39162),a=s(51186),l=s(92579);let o={chrome:{macos:{major:90,minor:0,patch:0},windows:{major:90,minor:0,patch:0},android:{major:97,minor:0,patch:0},ios:{major:120,minor:0,patch:0},default:{major:90,minor:0,patch:0}},safari:{macos:{major:15,minor:6,patch:0},ios:{major:15,minor:6,patch:0},default:{major:15,minor:6,patch:0}},edge:{macos:{major:116,minor:0,patch:0},windows:{major:116,minor:0,patch:0},default:{major:116,minor:0,patch:0}},firefox:{macos:{major:85,minor:0,patch:0},windows:{major:85,minor:0,patch:0},default:{major:85,minor:0,patch:0}},wechat:{macos:{major:3,minor:8,patch:6},windows:{major:3,minor:9,patch:8},android:{major:8,minor:0,patch:45},ios:{major:8,minor:0,patch:45},default:{major:8,minor:0,patch:45}},wecom:{android:{major:4,minor:1,patch:6},ios:{major:4,minor:1,patch:6},default:{major:4,minor:1,patch:6}}};function c(e){var t,s;if(!e)return null;let n=e.match(/(\d+)(?:\.(\d+))?(?:\.(\d+))?/);return n?{major:Number(n[1]),minor:Number(null!=(t=n[2])?t:0),patch:Number(null!=(s=n[3])?s:0)}:null}function d(e,t){for(let s of t){let t=e.match(s);if(null==t?void 0:t[1])return t[1]}return null}let u={supported:!1,reason:"unknown",browser:{family:"unknown",version:null,versionLabel:"unknown",os:"other",isMobile:!1},requiredVersion:null,requiredVersionLabel:null};function h(e){try{var t;let s=function(e){var t,s,n,r,i,a;let l=e||"",o=/iPhone|iPad|iPod/i.test(l)?"ios":/Android/i.test(l)?"android":/Mac OS X|Macintosh/i.test(l)?"macos":/Windows/i.test(l)?"windows":"other",u="ios"===o||"android"===o||/Mobile/i.test(l);if(/wxwork/i.test(l)||/WeCom/i.test(l)){let e=null!=(t=d(l,[/wxwork\/([\d.]+)/i,/WeCom\/([\d.]+)/i]))?t:"unknown";return{family:"wecom",version:c(e),versionLabel:e,os:o,isMobile:u}}if(/MicroMessenger/i.test(l)){let e=null!=(s=d(l,[/MicroMessenger\/([\d.]+)/i]))?s:"unknown";return{family:"wechat",version:c(e),versionLabel:e,os:o,isMobile:u}}if(/Edg(?:e|A|iOS)?\//i.test(l)){let e=null!=(n=d(l,[/Edg(?:e|A|iOS)?\/([\d.]+)/i]))?n:"unknown";return{family:"edge",version:c(e),versionLabel:e,os:o,isMobile:u}}if(/Firefox\//i.test(l)||/FxiOS\//i.test(l)){let e=null!=(r=d(l,[/Firefox\/([\d.]+)/i,/FxiOS\/([\d.]+)/i]))?r:"unknown";return{family:"firefox",version:c(e),versionLabel:e,os:o,isMobile:u}}if(/CriOS\//i.test(l)||/Chrome\//i.test(l)&&!/Edg/i.test(l)){let e=null!=(i=d(l,[/CriOS\/([\d.]+)/i,/Chrome\/([\d.]+)/i]))?i:"unknown";return{family:"chrome",version:c(e),versionLabel:e,os:o,isMobile:u}}if(/Safari\//i.test(l)&&/Version\//i.test(l)&&!/Chrome|CriOS|Edg/i.test(l)){let e=null!=(a=d(l,[/Version\/([\d.]+)/i]))?a:"unknown";return{family:"safari",version:c(e),versionLabel:e,os:o,isMobile:u}}return{family:"unknown",version:null,versionLabel:"unknown",os:o,isMobile:u}}(e),n=function(e){var t,s;if("unknown"===e.family)return null;let n=o[e.family];return null!=(s=null!=(t=n[e.os])?t:n.default)?s:null}(s),r=n?n.patch>0?"".concat(n.major,".").concat(n.minor,".").concat(n.patch):n.minor>0?"".concat(n.major,".").concat(n.minor):"".concat(n.major):null;if("unknown"===s.family)return{supported:!1,reason:"unknown",browser:s,requiredVersion:null,requiredVersionLabel:null};if(!n)return{supported:!1,reason:"unsupported_browser",browser:s,requiredVersion:null,requiredVersionLabel:null};if(!s.version||(t=s.version,!((t.major!==n.major?t.major-n.major:t.minor!==n.minor?t.minor-n.minor:t.patch-n.patch)>=0)))return{supported:!1,reason:"version_too_low",browser:s,requiredVersion:n,requiredVersionLabel:r};return{supported:!0,reason:"ok",browser:s,requiredVersion:n,requiredVersionLabel:r}}catch(e){return u}}let m="xpeak:agora-browser-compat-dismissed";var x=s(70427);function p(){try{return"1"===sessionStorage.getItem(m)}catch(e){return!1}}function f(){var e;let t,s=(0,i.c)("browserCompat"),o=(0,r.useRef)(null),[c,d]=(0,r.useState)(null),[f,g]=(0,r.useState)(p);(0,r.useEffect)(()=>{d(function(){try{if("undefined"==typeof navigator)return h("");return h(navigator.userAgent)}catch(e){return u}}()),g(p())},[]);let v=!!(c&&function(e){try{return!e.supported&&"version_too_low"===e.reason}catch(e){return!1}}(c)&&!f);return((0,r.useLayoutEffect)(()=>{let e=document.documentElement;if(!v){e.removeAttribute("data-browser-compat-banner"),e.style.removeProperty(x.xH);return}let t=()=>{var t;let s=null==(t=o.current)?void 0:t.offsetHeight;e.setAttribute("data-browser-compat-banner","true"),e.style.setProperty(x.xH,s?"".concat(s,"px"):x.k5)};t();let s=new ResizeObserver(t);return o.current&&s.observe(o.current),()=>{s.disconnect(),e.removeAttribute("data-browser-compat-banner"),e.style.removeProperty(x.xH)}},[v,c]),v&&c)?(0,n.jsx)("div",{ref:o,role:"status","aria-live":"polite",className:"fixed left-0 right-0 z-[9998] border-b border-amber-300 bg-amber-50 text-amber-950 dar
1k:border-amber-700 dark:bg-amber-950/40 dark:text-amber-100",style:{top:"var(--impersonation-banner-height, 0px)"},children:(0,n.jsxs)("div",{className:"mx-auto flex max-w-screen-xl items-start gap-3 px-4 py-2.5",children:[(0,n.jsx)(a.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1 text-sm",children:[(0,n.jsx)("p",{className:"font-medium",children:s("bannerTitle")}),(0,n.jsx)("p",{className:"mt-0.5 text-amber-900/90 dark:text-amber-100/90",children:s("bannerBody",{browser:(t=c.browser.family,s("browserFamily.".concat(t))),current:c.browser.versionLabel,required:null!=(e=c.requiredVersionLabel)?e:""})})]}),(0,n.jsx)("button",{type:"button",onClick:()=>{try{sessionStorage.setItem(m,"1")}catch(e){}g(!0)},className:"shrink-0 rounded p-1 text-amber-800 hover:bg-amber-100 dark:text-amber-200 dark:hover:bg-amber-900/50","aria-label":s("bannerDismiss"),children:(0,n.jsx)(l.A,{className:"h-4 w-4"})})]})}):null}},51740:(e,t,s)=>{s.d(t,{Bz:()=>l,M$:()=>h,MJ:()=>c,R8:()=>d,Z8:()=>u,sk:()=>o});let n="student.tutors.listMode",r="student.tutors.browseScrollY",i="student.tutors.expectBackToBrowse";function a(){return"undefined"!=typeof sessionStorage}function l(e){if(a())try{sessionStorage.setItem(n,e)}catch(e){}}function o(){return"browse"===function(){if(!a())return null;try{let e=sessionStorage.getItem(n);if("browse"===e||"recommendations"===e)return e}catch(e){}return null}()?"/student/tutors?mode=browse":"/student/tutors"}function c(e){if(a())try{sessionStorage.setItem(r,String(Math.max(0,Math.round(e))))}catch(e){}}function d(){if(!a())return null;try{let e=sessionStorage.getItem(r);if(null==e)return null;sessionStorage.removeItem(r);let t=Number(e);return Number.isFinite(t)&&t>=0?t:null}catch(e){return null}}function u(){if(a())try{sessionStorage.setItem(i,"1"),l("browse"),c(window.scrollY)}catch(e){}}function h(){if(!a())return!1;try{let e=sessionStorage.getItem(i);if("1"!==e)return!1;return sessionStorage.removeItem(i),!0}catch(e){return!1}}},61353:(e,t,s)=>{s.d(t,{default:()=>eC});var n=s(79490),r=s(77066),i=s(39743),a=s(46202),l=s(39162),o=s(43352),c=s(70820),d=s(92579),u=s(13682),h=s(65947),m=s(38666),x=s(74088),p=s(2125),f=s(77598),g=s(27550);function v(e){let{className:t}=e;return(0,n.jsxs)("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":!0,children:[(0,n.jsxs)("g",{clipPath:"url(#clip0_697_8745)",children:[(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00065 14.6667C11.6826 14.6667 14.6673 11.6819 14.6673 8.00004C14.6673 4.31814 11.6826 1.33337 8.00065 1.33337C4.31875 1.33337 1.33398 4.31814 1.33398 8.00004C1.33398 11.6819 4.31875 14.6667 8.00065 14.6667Z",stroke:"#FF6B6B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.jsx)("path",{d:"M1.33398 8H14.6673",stroke:"#FF6B6B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00065 14.6667C9.47342 14.6667 10.6673 11.6819 10.6673 8.00004C10.6673 4.31814 9.47342 1.33337 8.00065 1.33337C6.52788 1.33337 5.33398 4.31814 5.33398 8.00004C5.33398 11.6819 6.52788 14.6667 8.00065 14.6667Z",stroke:"#FF6B6B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.jsx)("path",{d:"M3.28516 3.38074C4.49159 4.58717 6.15825 5.33337 7.99919 5.33337C9.84015 5.33337 11.5068 4.58717 12.7133 3.38074",stroke:"#FF6B6B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.jsx)("path",{d:"M12.7133 12.6193C11.5068 11.4128 9.84015 10.6666 7.99919 10.6666C6.15825 10.6666 4.49159 11.4128 3.28516 12.6193",stroke:"#FF6B6B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,n.jsx)("defs",{children:(0,n.jsx)("clipPath",{id:"clip0_697_8745",children:(0,n.jsx)("rect",{width:"16",height:"16",fill:"white"})})})]})}var b=s(61837);function w(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.filter(Boolean).join(" ")}let j=[{label:"English",code:"EN",flag:"\uD83C\uDDFA\uD83C\uDDF8"},{label:"Espa\xf1ol",code:"ES",flag:"\uD83C\uDDEA\uD83C\uDDF8"},{label:"䏿",code:"ZH",flag:"\uD83C\uDDE8\uD83C\uDDF3"},{label:"æ¥æ¬èª",code:"JA",flag:"\uD83C\uDDEF\uD83C\uDDF5"}];function y(e){var t;let{options:s=j,value:i,onSelect:a,size:l="md",variant:o="outlined",width:c="auto",className:d="",iconSrc:u,iconVariant:m="default",iconColor:x="default"}=e,[p,y]=(0,r.useState)(!1),N=(0,r.useRef)(null),C=(0,r.useRef)(null),k=s.find(e=>e.code===i)||s[0],L=(null==k||null==(t=k.label)?void 0:t.toUpperCase())||"ENGLISH";(0,r.useEffect)(()=>{let e=e=>{N.current&&!N.current.contains(e.target)&&y(!1)};if(p)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[p]);let E="icon"===o;return(0,n.jsxs)("div",{ref:N,className:"relative",children:[(0,n.jsx)("button",{ref:C,type:"button",onClick:()=>y(!p),onKeyDown:e=>{switch(e.key){case"Enter":case" ":e.preventDefault(),y(!p);break;case"Escape":var t;
1y(!1),null==(t=C.current)||t.focus()}},className:w("flex items-center justify-center transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-coral focus:ring-offset-0 rounded-lg",E?"w-10 h-10 p-0 hover:bg-token-surface-accent":w("justify-between gap-1.5",{sm:"px-2 py-0.5 text-sm h-[17px]",md:"px-4 py-2 text-base",lg:"px-4 py-3 text-lg"}[l],{default:"border-0 bg-cream text-coral hover:opacity-80 focus:opacity-80",outlined:"border-2 border-token-text-muted bg-transparent text-token-text hover:border-token-primary focus:border-token-primary",filled:"border border-transparent bg-token-surface-alt text-token-text hover:bg-token-surface focus:bg-token-surface focus:border-token-primary"}[o],{auto:"w-auto min-w-[95px]",sm:"w-auto min-w-[95px]",md:"w-24",lg:"w-28",xl:"w-32"}[c]),d),"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"Select language",children:E?"figma"===m?(0,n.jsx)(v,{}):u?(0,n.jsx)(f.default,{src:u,alt:"",width:24,height:24,className:"w-6 h-6 object-contain"}):(0,n.jsx)(g.A,{className:"w-6 h-6 text-token-text-secondary"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(g.A,{className:"w-4 h-4 flex-shrink-0 text-coral"}),(0,n.jsx)("span",{className:"font-medium text-sm uppercase",children:L})]}),(0,n.jsx)(h.A,{className:w("w-3 h-3 flex-shrink-0 transition-transform duration-200 text-coral",p&&"rotate-180")})]})}),p&&(0,n.jsx)(b.Zp,{variant:"elevated",padding:"none",className:w("absolute z-50 mt-1 shadow-token-lg border border-token-border rounded-token-lg overflow-hidden",{auto:"w-auto min-w-[160px]",sm:"w-40",md:"w-48",lg:"w-56",xl:"w-64"}[c]),children:(0,n.jsx)("ul",{role:"listbox","aria-label":"Language options",children:s.map(e=>(0,n.jsx)("li",{role:"option","aria-selected":e.code===i,children:(0,n.jsxs)("button",{type:"button",onClick:()=>{a(e),y(!1)},className:w("w-full flex items-center gap-2 px-4 py-2 text-left transition-colors duration-150 focus:outline-none cursor-pointer","hover:bg-token-surface-alt focus:bg-token-surface-alt",e.code===i&&"bg-token-surface-alt"),children:[(0,n.jsx)("span",{className:"flex-shrink-0",children:e.flag}),(0,n.jsx)("span",{children:e.label})]})},e.code))})})]})}var N=s(34600),C=s(36046);let k=x.dI.map(e=>({label:x.kf[e],code:e,flag:x.hh[e]}));function L(e){let{size:t="sm",variant:s="default",width:r="auto",className:i,iconSrc:l,iconVariant:c="default",iconColor:d="default"}=e,u=(0,m.Ym)(),h=(0,a.rd)(),f=(0,a.a8)(),{user:g}=(0,o.As)();return(0,n.jsx)(y,{options:k,value:u,onSelect:e=>{let t=e.code;if(t===u)return;let s="https:"===window.location.protocol;document.cookie="".concat(x.gB,"=").concat(t,";path=/;max-age=31536000;SameSite=Lax").concat(s?";Secure":""),localStorage.setItem(x.zl,t);let n=!!((null==g?void 0:g.id)&&(0,N.iD)());(0,C.N8)({locale:t,isLoggedIn:n,update:e=>N.HJ.updatePreferences(e)}),(0,p.R)(t),h.replace(f,{locale:t})},size:t,variant:s,width:r,className:i,iconSrc:l,iconVariant:c,iconColor:d})}var E=s(22320),_=s(85754),S=s(88313);let I="xpeak_header_bind_email_seen",A="xpeak_header_bind_email_nav_lock";function R(){return"undefined"!=typeof localStorage}function M(){return"undefined"!=typeof sessionStorage}function P(){if(R())try{localStorage.setItem(I,"1")}catch(e){}}function T(){return"undefined"==typeof performance?"ssr":String(performance.timeOrigin)}function F(e){if(M())try{sessionStorage.setItem(A,JSON.stringify({navId:T(),variant:e}))}catch(e){}}var z=s(74597);function B(e){var t;let{compact:s=!1}=e,{user:i,refreshAuthState:a,clearStaleAuth:d}=(0,o.As)(),{roles:u}=(0,c.z)(),h=(0,l.c)("student.bindEmailPrompt"),m=(0,r.useRef)(null),[x,p]=(0,r.useState)(null),[f,g]=(0,r.useState)(!1),[v,b]=(0,r.useState)(!1);(0,r.useEffect)(()=>{p(function(e){if(e)return"icon";let t=function(){if(!M())return null;try{let e=sessionStorage.getItem(A);if(!e)return null;let t=JSON.parse(e);if(t&&"string"==typeof t.navId&&("pill"===t.variant||"icon"===t.variant))return{navId:t.navId,variant:t.variant};return null}catch(e){return null}}();if(t&&t.navId===T())return t.variant;let s=!function(){if(!R())return!1;try{return"1"===localStorage.getItem(I)}catch(e){return!1}}()?"pill":"icon";return F(s),s}(s))},[s]);let w=null!==x&&u.includes("student")&&(t=null==i?void 0:i.email,(0,S.g3)(t));(0,r.useEffect)(()=>{w&&P()},[w]);let j=()=>{var e;b(!1),null==(e=m.current)||e.blur()},y=async()=>{g(!1),j(),await d(),window.location.assign("/auth/login?error=bind_email_relogin_failed")},N=async()=>{g(!1),j(),await a({bustCache:!0})};return w?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"relative",onMouseEnter:()=>{f||b(!0)},onMouseLeave:()=>b(!1),children:[(0,n.jsxs)("button",{ref:m,type:"button","data-testid":"header-bind-email-cue","data-variant":x,"aria-label":h("headerCta"),onClick:()=>{b(!1),g(!0)},className:"pill"===x?"relative flex h-8 items-center gap-1.5 rounded-full border border-coral bg-coral-light px-3 text-sm font-medium text-coral transition-colors hover:bg-[#FFD6D6]":"relative flex h-8 w-8 items-center justify-center rounded-full border border-coral bg-coral-light text-coral transition-colors hover:bg-[#FFD6D6]",children:[(0,n.jsx)(_.A,{className:"h-4 w-4","aria-hidden":!0}),"pill"===x?(0,n.jsx)("span",{children:h("headerCta")}):null,(0,n.jsx)("span",{className:"absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full bg-coral","aria-hidden":!0})]}),v&&!f?(0,n.jsx)("span",{role:"tooltip",className:"pointer-events-none absolute left-1/2 top-full z-50 mt-2 -translate-x-1/2 whitespace-nowrap rounded-md bg-[#2A2A2A] px-2 py-1 text-xs text-white",children:h("headerTooltip")}):null]}),(0,n.jsx)(z.A,{open:f,onSkip:()=>{g(!1),j(),s||(P(),F("icon"),p("icon"))},onSuccess:N,onManualLoginRequired:y})]}):null}var D=s(9313),O=s(70427);function W(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];(0,r.useLayoutEffect)(()=>{var s,n;if(!t)return;let r=e.current;if(!r)return;let i=!1,a=()=>
1{if(i||"none"===getComputedStyle(r).display)return;let e=r.offsetHeight;e<=0||document.documentElement.style.setProperty("--app-header-height","".concat(e,"px"))};a();let l=new ResizeObserver(a);return l.observe(r),window.addEventListener("resize",a),null==(n=document.fonts)||null==(s=n.ready)||s.then(a),()=>{i=!0,l.disconnect(),window.removeEventListener("resize",a)}},[t,e])}var H=s(51740);let V=(0,r.createContext)(null);function U(e){let{heroBackgroundColor:t}=e,{user:s,loading:i}=(0,o.As)(),{roles:m}=(0,c.z)(),x=(0,a.a8)(),p=(0,l.c)("header"),f=(0,l.c)("common"),[g,v]=(0,r.useState)(!1),[b,w]=(0,r.useState)(!1),j=null==x?void 0:x.startsWith("/lessons/"),y=null==x?void 0:x.startsWith("/student/"),N=y||j&&!!s&&m.includes("student"),C=y||j&&!!s,k=(0,r.useRef)(null);W(k,!C);let _=j&&m.includes("tutor")&&!m.includes("student"),S=_?"/tutor":"/student/dashboard",I=["/","/meet-grace","/pricing","/business","/help","/support","/become-a-tutor","/word-maze","/topic-spark","/sentence-explorer","/xpeakai","/career","/password-reset"].some(e=>x===e||(null==x?void 0:x.startsWith(e+"/"))),A=(null==x?void 0:x.startsWith("/auth/"))||(null==x?void 0:x.includes("password-reset"));return(0,r.useEffect)(()=>{if(N&&1){let e=e=>{w(e.detail.isOpen)};return window.addEventListener("student-mobile-sidebar-toggle",e),()=>{window.removeEventListener("student-mobile-sidebar-toggle",e)}}},[N]),(0,n.jsxs)(n.Fragment,{children:[N&&s&&(0,n.jsx)("header",{className:"!fixed inset-x-0 top-0 z-[100] w-full border-b shadow-sm md:hidden bg-token-surface border-token-border ".concat(O.T9),children:(0,n.jsxs)("div",{className:"flex justify-between items-center px-4 h-14",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(E.A,{variant:"compact",align:"left"}),(0,n.jsx)("button",{onClick:()=>{w(!b),window.dispatchEvent(new CustomEvent("student-mobile-sidebar-toggle",{detail:{isOpen:!b}}))},className:"p-2",children:b?(0,n.jsx)(d.A,{className:"w-6 h-6"}):(0,n.jsx)(u.A,{className:"w-6 h-6"})})]}),(0,n.jsx)(D.g,{href:s?"/student/dashboard":"/",className:"h-6 w-auto"})]})}),C&&s&&(()=>{let e=(()=>{if(j){let e=p("breadcrumbLessonDetail");return(null==x?void 0:x.includes("/pre-check"))?e=p("breadcrumbLessonPrepare"):(null==x?void 0:x.includes("/video"))&&(e=p("breadcrumbLessonLive")),[{label:p("breadcrumbHome"),href:S},{label:p("breadcrumbLessons"),href:_?"/tutor/lessons":"/student/lessons"},{label:e,href:x||"/lessons"}]}let e=[{label:p("breadcrumbHome"),href:"/student/dashboard"}];return(null==x?void 0:x.startsWith("/student/dashboard"))?e.push({label:p("breadcrumbDashboard"),href:"/student/dashboard"}):(null==x?void 0:x.startsWith("/student/grace"))?(e.push({label:p("breadcrumbGrace"),href:"/student/grace"}),(null==x?void 0:x.startsWith("/student/grace/picture-books"))?e.push({label:p("pictureBooks"),href:"/student/grace/picture-books"}):(null==x?void 0:x.startsWith("/student/grace/ai-topic"))&&e.push({label:p("aiTopic"),href:"/student/grace/ai-topic?tab=my"})):(null==x?void 0:x.startsWith("/student/lessons"))?(e.push({label:p("breadcrumbLessons"),href:"/student/lessons"}),x.includes("/ai-summary")&&e.push({label:p("breadcrumbAiSummary"),href:x})):(null==x?void 0:x.startsWith("/student/tutors"))?e.push({label:p("breadcrumbTutors"),href:(0,H.sk)()}):(null==x?void 0:x.startsWith("/student/chat"))?e.push({label:p("breadcrumbMessages"),href:"/student/chat"}):(null==x?void 0:x.startsWith("/student/billing"))||(null==x?void 0:x.startsWith("/student/invoices"))?e.push({label:p("breadcrumbBilling"),href:"/student/billing-payments"}):(null==x?void 0:x.startsWith("/student/profile"))?e.push({label:p("breadcrumbProfile"),href:"/student/profile"}):e.push({label:p("breadcrumbDashboard"),href:"/student/dashboard"}),e})();return(0,n.jsxs)("header",{className:"!fixed inset-x-0 top-0 z-[100] hidden md:flex w-full h-16 items-center border-b shadow-sm bg-token-surface border-token-border px-4 sm:px-6 lg:px-8 ".concat(O.T9),children:[(0,n.jsx)(D.g,{href:S,className:"h-6 md:h-7 w-auto shrink-0"}),(0,n.jsx)("div",{className:"w-px h-6 bg-[#EBE0CC] mx-4 shrink-0","aria-hidden":!0}),(0,n.jsx)("nav",{className:"flex-1 min-w-0 flex items-center justify-start font-noto",style:{fontSize:"14px",lineHeight:"19px",fontWeight:400},"aria-label":"Breadcrumb",children:(0,n.jsx)("ol",{className:"flex items-center gap-2 text-[#242424] min-w-0 flex-wrap",children:e.map((t,s)=>(0,n.jsxs)("li",{className:"flex items-center gap-2 min-w-0",children:[s>0&&(0,n.jsx)("span",{className:"text-[#242424] text-lg font-normal leading-none shrink-0","aria-hidden":"true",children:">"}),(0,n.jsx)(a.N_,{href:t.href,className:"transition-colors truncate ".concat(s===e.length-1?"text-coral hover:text-coral/90":"text-[#242424] hover:text-coral"),children:t.label})]},s))})}),(0,n.jsxs)("div",{className:"flex items-center gap-4 md:gap-6 flex-shrink-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L,{size:"sm",variant:"icon",iconVariant:"figma",className:"rounded-lg"}),(0,n.jsx)(B,{})]}),(0,n.jsx)(E.A,{variant:"full",align:"right"})]})]})})(),!C&&(0,n.jsxs)("header",{ref:k,className:"!fixed inset-x-0 top-0 z-[100] w-full relative ".concat(O.T9," ").concat(I?"bg-cream":A?"border-b-2 border-cream shadow-sm bg-cream":"border-b shadow-sm bg-token-surface"),children:[A&&(0,n.jsx)("div",{className:"absolute inset-0 opacity-30 pointer-events-none",style:{backgroundImage:"radial-gradient(circle, #636162 1px, transparent 1px)",backgroundSize:"16px 16px"}}),(0,n.jsxs)("nav",{className:"relative z-10 max-w-[1920px] mx-auto px-4 md:px-8 lg:px-12 py-4 md:py-6 flex flex-nowrap items-center justify-between gap-3",children:[(0,n.jsx)(D.g,{href:s?"/student/dashboard":"/",className:"h-6 md:h-7 w-auto shrink-0"}),(I||!s)&&(0,n.jsxs)("div",{className:"hidden lg:flex flex-nowrap items-center gap-8 xl:gap-20 shrink-0 whitespace-nowrap ".concat(I||A?"bg-beige rounded-full px-6 xl:px-10 py-2.5":""),children:[(0,n.jsx)(a.N_,{href:"/meet-grace",className:"text-sm font-light transition-colors text-dark-gray xl:text-base hover:text-coral",children:p("grace")}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)("button",{onClick:()=>v(!g),onMouseEnter:()=>v(!0),className:"flex items-center gap-2.5 text-dark-gray font-light text-sm xl:text-base hover:text-coral transition-colors",children:[p("features"),(0,n.jsx)(h.A,{className:"w-4 h-4 text-[#656153]"})]}),g&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>v(!1)}),(0,n.jsx)("div",{className:"absolute left-0 z-50 mt-2 w-48 bg-white rounded-lg border shadow-lg border-beige",onMouseLeave:()=>v(!1),children:(0,n.jsxs)("div",{className:"p-2",children:[(0,n.jsx)(a.N_,{href:"/word-maze",className:"block px-3 py-2 text-sm rounded-md transition-colors text-dark-gray hover:bg-beige",onClick:()=>v(!1),children:p("wordMaze")}),(0,n.jsx)(a.N_,{href:"/topic-spark",className:"block px-3 py-2 text-sm rounded-md transition-colors text-dark-gray hover:bg-beige",onClick:()=>v(!1),children:p("aiTopic")})]})})]})]}),(0,n.jsx)(a.N_,{href:"/pricing",className:"text-sm font-light transition-colors text-dark-gray xl:text-base hover:text-coral",children:p("pricing")}),(0,n.jsx)(a.N_,{href:"/business",className:"text-sm font-light transition-colors text-dark-gray xl:text-base hover:text-coral",children:p("b2b")})]}),(0,n.jsxs)("div",{className:"flex flex-nowrap gap-2 items-center md:gap-4 lg:gap-8 shrink-0 whitespace-nowrap",children:[(I||!s)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"hidden md:flex",children:(0,n.jsx)(L,{size:"sm",variant:"default"})}),!m.includes("tutor")&&(0,n.jsx)(a.N_,{href:"/become-a-tutor",className:"hidden text-xs font-medium uppercase transition-opacity md:block text-coral lg:text-sm hover:opacity-80",children:p("becomeATutor")})]}),i?(0,n.jsx)("div",{className:"w-20 h-10 rounded-lg animate-pulse bg-token-surface-accent"}):s?(0,n.jsx)(E.A,{variant:"inline",align:"right"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.N_,{href:"/auth/login",className:"hidden text-xs font-medium uppercase transition-opacity sm:block text-coral lg:text-sm hover:opacity-80",children:f("login")}),(0,n.jsx)(a.N_,{href:"/auth/signup",children:(0,n.jsxs)("button",{className:"bg-coral text-white font-medium text-xs lg:text-sm uppercase rounded-full px-3 lg:px-4 py-2 lg:py-2.5 flex items-center gap-2",children:[f("signUp"),(0,n.jsx)("div",{className:"flex justify-center items-center w-6 h-6 bg-white rounded-full lg:w-7 lg:h-7",children:(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[(0,n.jsx)("path",{d:"M8.29 5.79L5.37 2.87C5.07 2.57 5.37 2.07 5.79 2.07V2.07C6.01 2.07 6.22 2.16 6.37 2.31L9.29 5.23C9.68 5.62 9.68 6.25 9.29 6.64L6.37 9.56C6.07 9.86 5.57 9.56 5.57 9.14V9.14C5.57 8.92 5.66 8.71 5.81 8.56L8.29 5.79Z",fill:"#FF6B6B"}),(0,n.jsx)("rect",{x:"3",y:"5",width:"5",height:"2",rx:"1",fill:"#FF6B6B"})]})})]})})]})]})]})]})]})}var Z=s(49287);let q=[{href:"/legal",labelKey:"legal"},{href:"/legal/terms",labelKey:"terms"},{href:"/legal/privacy",labelKey:"privacy"},{href:"/legal/refunds",labelKey:"refunds"}];function K(e){let{className:t}=e;
1return(0,n.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z"})})}function J(e){let{className:t}=e;return(0,n.jsxs)("svg",{className:t,viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M3.6 2.2c-.3.2-.5.6-.5 1.1v17.4c0 .5.2.9.5 1.1l9.7-9.8L3.6 2.2z",fill:"#4285F4"}),(0,n.jsx)("path",{d:"M16.1 14.7l-2.8-2.8-9.7 9.8c.3.3.8.4 1.2.2l11.3-7.2z",fill:"#34A853"}),(0,n.jsx)("path",{d:"M16.1 9.3L4.8 2.1c-.4-.2-.9-.1-1.2.2l9.7 9.8 2.8-2.8z",fill:"#FBBC04"}),(0,n.jsx)("path",{d:"M20.5 10.9l-4.4-2.6-2.8 2.8 2.8 2.8 4.4-2.5c.7-.4.7-1.5 0-1.9z",fill:"#EA4335"})]})}function Q(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M17.6 9.5l1.4-2.4c.1-.2 0-.4-.2-.5-.2-.1-.4 0-.5.2l-1.4 2.4A8.1 8.1 0 0 0 12 7.8c-1.8 0-3.4.6-4.9 1.4L5.7 6.8c-.1-.2-.3-.3-.5-.2-.2.1-.3.3-.2.5l1.4 2.4C4.1 11.1 2.8 13.4 2.8 16h18.4c0-2.6-1.3-4.9-3.6-6.5zM8.4 13.4a.9.9 0 1 1 0-1.8.9.9 0 0 1 0 1.8zm7.2 0a.9.9 0 1 1 0-1.8.9.9 0 0 1 0 1.8zM5.2 17.2h13.6v1.4c0 1.1-.9 2-2 2H7.2c-1.1 0-2-.9-2-2v-1.4z"})})}let G="group flex w-full items-center gap-2.5 rounded-xl border border-[#E7E0D4] bg-[#E4D9C6] px-3.5 py-2.5 text-left text-[#141313] shadow-[inset_0_1px_0_rgba(255,255,255,0.45)] transition-colors hover:border-coral/50 hover:bg-[#EDE4D4] hover:text-coral focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-coral focus-visible:ring-offset-2 focus-visible:ring-offset-[#EEE7DA]";function Y(){let e=(0,l.c)("footer"),[t,s]=r.useState(Z.Vc),i=r.useMemo(Z.Ay,[]);return r.useEffect(()=>{let e=!1,t=window.location.host;return(0,Z.w$)(t).then(n=>{e||s((0,Z.Pj)({country:n,host:t}))}).catch(()=>{e||s((0,Z.Pj)({host:t}))}),()=>{e=!0}},[]),(0,n.jsxs)("footer",{className:"relative bg-[#EEE7DA] pb-8 md:pb-12 overflow-hidden",children:[(0,n.jsx)("div",{className:"hidden lg:block absolute inset-0 pointer-events-none",children:(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1920",height:"408",viewBox:"0 0 1920 408",fill:"none",className:"w-full h-auto absolute top-0 left-0",preserveAspectRatio:"xMidYMin meet",children:[(0,n.jsx)("path",{d:"M-194 238.757C126 108.757 921.314 -166.34 1233 151.757C1549 474.258 489 85 1297.5 132.757C1879.08 167.111 1989.17 366.757 1971 474.257",stroke:"url(#paint0_linear_697_8769)",strokeWidth:"55",strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.jsx)("defs",{children:(0,n.jsxs)("linearGradient",{id:"paint0_linear_697_8769",x1:"128.5",y1:"109.63",x2:"1972.83",y2:"239.129",gradientUnits:"userSpaceOnUse",children:[(0,n.jsx)("stop",{stopColor:"white",stopOpacity:"0"}),(0,n.jsx)("stop",{offset:"0.5",stopColor:"white",stopOpacity:"0.5"}),(0,n.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]})})]})}),(0,n.jsxs)("div",{className:"absolute top-0 left-4 sm:left-8 md:left-12 lg:left-20 xl:left-40 h-[42px] sm:h-[56px] md:h-[70px] lg:h-[84px] pointer-events-none",children:[(0,n.jsx)("div",{className:"absolute top-0 left-[18px] sm:left-[24px] md:left-[30px] lg:left-[37px] w-[25px] sm:w-[35px] md:w-[43px] lg:w-[51px] h-[2.5px] sm:h-[3px] md:h-[4px] lg:h-[5px] bg-coral rounded-full z-10"}),(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 204 138",fill:"none",className:"h-full w-auto",children:[(0,n.jsx)("path",{opacity:"0.4",d:"M60 0H144L204 138H0L60 0Z",fill:"url(#paint0_linear_697_8770)"}),(0,n.jsx)("defs",{children:(0,n.jsxs)("linearGradient",{id:"paint0_linear_697_8770",x1:"102",y1:"-15.5493",x2:"102",y2:"99",gradientUnits:"userSpaceOnUse",children:[(0,n.jsx)("stop",{stopColor:"#FF6B6B"}),(0,n.jsx)("stop",{offset:"1",stopColor:"#FF6B6B",stopOpacity:"0"})]})})]}),(0,n.jsx)("svg",{className:"absolute top-[9px] sm:top-[12px] md:top-[15px] lg:top-[18px] left-[24px] sm:left-[32px] md:left-[40px] lg:left-[48px] w-[5px] h-[5px] sm:w-[7px] sm:h-[7px] md:w-[8px] md:h-[8px] lg:w-[10px] lg:h-[10px]",viewBox:"0 0 15 15",fill:"none",children:(0,n.jsx)("path",{d:"M7.5 0L9.18 5.82L15 7.5L9.18 9.18L7.5 15L5.82 9.18L0 7.5L5.82 5.82L7.5 0Z",fill:"white"})}),(0,n.jsx)("svg",{className:"absolute top-[4px] sm:top-[5px] md:top-[6px] lg:top-[8px] left-[34px] sm:left-[45px] md:left-[56px] lg:left-[68px] w-[3px] h-[3px] sm:w-[4px] sm:h-[4px] md:w-[5px] md:h-[5px] lg:w-[6px] lg:h-[6px]",viewBox:"0 0 9 9",fill:"none",children:(0,n.jsx)("path",{d:"M4.5 0L5.5 3.5L9 4.5L5.5 5.5L4.5 9L3.5 5.5L0 4.5L3.5 3.5L4.5 0Z",fill:"white"})}),(0,n.jsx)("svg",{className:"absolute top-[19px] sm:top-[25px] md:top-[31px] lg:top-[38px] left-[36px] sm:left-[48px] md:left-[60px] lg:left-[72px] opacity-40 w-[3px] h-[3px] sm:w-[4px] sm:h-[4px] md:w-[5px] md:h-[5px] lg:w-[6px] lg:h-[6px]",viewBox:"0 0 9 9",fill:"none",children:(0,n.jsx)("path",{d:"M4.5 0L5.5 3.5L9 4.5L5.5 5.5L4.5 9L3.5 5.5L0 4.5L3.5 3.5L4.5 0Z",fill:"white"})})]}),(0,n.jsxs)("div",{className:"max-w-[1920px] mx-auto px-4 md:px-8 lg:px-20 xl:px-40 relative z-10 pt-[60px] sm:pt-[65px] md:pt-[55px] lg:pt-[50px]",children:[(0,n.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-2 ".concat("lg:grid-cols-[1fr_1fr_1fr_1.2fr]"," gap-4 sm:gap-6 md:gap-8 lg:gap-16 mb-6 sm:mb-8 md:mb-12 lg:mb-16"),
1children:[(0,n.jsxs)("div",{className:"flex flex-col col-span-2 sm:col-span-1 lg:col-span-1",children:[(0,n.jsx)("h3",{className:"text-coral font-extrabold text-[20px] sm:text-[24px] lg:text-[28px] leading-[1.22] mb-3 sm:mb-4",children:e("xpeakAI")}),(0,n.jsx)("p",{className:"text-[#636162] font-normal text-sm sm:text-base lg:text-[18px] leading-[1.56] mb-6 sm:mb-7 lg:mb-8",children:e("tagline")}),(0,n.jsx)("p",{className:"text-[#141313] font-medium text-sm sm:text-base lg:text-[18px] leading-[1.56] uppercase mb-3 sm:mb-4",children:e("follow")}),(0,n.jsxs)("div",{className:"flex gap-2 sm:gap-3",children:[(0,n.jsx)("a",{href:"#",className:"w-[32px] h-[32px] sm:w-[35px] sm:h-[35px] lg:w-[38px] lg:h-[38px] bg-[#E4D9C6] rounded-full flex items-center justify-center text-[#636162] hover:text-coral transition-colors","aria-label":"Twitter",children:(0,n.jsx)("svg",{className:"h-[14px] w-[14px] sm:h-[16px] sm:w-[16px] lg:h-[18px] lg:w-[18px]",fill:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M24 4.5
157c-.883.392-1.832.656-2.828.775 1.017-.609 1.798-1.574 2.165-2.724-.951.564-2.005.974-3.127 1.195-.897-.957-2.178-1.555-3.594-1.555-3.179 0-5.515 2.966-4.797 6.045-4.091-.205-7.719-2.165-10.148-5.144-1.29 2.213-.669 5.108 1.523 6.574-.806-.026-1.566-.247-2.229-.616-.054 2.281 1.581 4.415 3.949 4.89-.693.188-1.452.232-2.224.084.626 1.956 2.444 3.379 4.6 3.419-2.07 1.623-4.678 2.348-7.29 2.04 2.179 1.397 4.768 2.212 7.548 2.212 9.142 0 14.307-7.721 13.995-14.646.962-.695 1.797-1.562 2.457-2.549z"})})}),(0,n.jsx)("a",{href:"#",className:"w-[32px] h-[32px] sm:w-[35px] sm:h-[35px] lg:w-[38px] lg:h-[38px] bg-[#E4D9C6] rounded-full flex items-center justify-center text-[#636162] hover:text-coral transition-colors","aria-label":"Instagram",children:(0,n.jsx)("svg",{className:"h-[14px] w-[14px] sm:h-[16px] sm:w-[16px] lg:h-[18px] lg:w-[18px]",fill:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M7.75 2h8.5A5.75 5.75 0 0 1 22 7.75v8.5A5.75 5.75 0 0 1 16.25 22h-8.5A5.75 5.75 0 0 1 2 16.25v-8.5A5.75 5.75 0 0 1 7.75 2zm0 1.5A4.25 4.25 0 0 0 3.5 7.75v8.5A4.25 4.25 0 0 0 7.75 20.5h8.5A4.25 4.25 0 0 0 20.5 16.25v-8.5A4.25 4.25 0 0 0 16.25 3.5zm4.25 2.25a6.25 6.25 0 1 1 0 12.5 6.25 6.25 0 0 1 0-12.5zm0 1.5a4.75 4.75 0 1 0 0 9.5 4.75 4.75 0 0 0 0-9.5zm6.25 1.25a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})})}),(0,n.jsx)("a",{href:"#",className:"w-[32px] h-[32px] sm:w-[35px] sm:h-[35px] lg:w-[38px] lg:h-[38px] bg-[#E4D9C6] rounded-full flex items-center justify-center text-[#636162] hover:text-coral transition-colors","aria-label":"LinkedIn",children:(0,n.jsx)("svg",{className:"h-[14px] w-[14px] sm:h-[16px] sm:w-[16px] lg:h-[18px] lg:w-[18px]",fill:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.761 0 5-2.239 5-5v-14c0-2.761-2.239-5-5-5zm-11 19h-3v-9h3v9zm-1.5-10.268c-.966 0-1.75-.784-1.75-1.75s.784-1.75 1.75-1.75 1.75.784 1.75 1.75-.784 1.75-1.75 1.75zm13.5 10.268h-3v-4.604c0-1.099-.021-2.513-1.531-2.513-1.531 0-1.767 1.197-1.767 2.434v4.683h-3v-9h2.881v1.233h.041c.401-.761 1.381-1.563 2.845-1.563 3.043 0 3.604 2.004 3.604 4.609v4.721z"})})})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"text-[#141313] font-medium text-sm sm:text-base lg:text-[18px] leading-[1.56] uppercase mb-4 sm:mb-5 lg:mb-6",children:e("product")}),(0,n.jsxs)("ul",{className:"space-y-2 sm:space-y-2.5 lg:space-y-3",children:[(0,n.jsx)("li",{children:(0,n.jsx)(a.N_,{href:"/meet-grace",className:"text-[#636162] font-light text-sm sm:text-base leading-[1.75] uppercase hover:text-coral transition-colors",children:e("meetGrace")})}),(0,n.jsx)("li",{children:(0,n.jsx)(a.N_,{href:"/topic-spark",className:"text-[#636162] font-light text-sm sm:text-base leading-[1.75] uppercase hover:text-coral transition-colors",children:e("topicSpark")})}),(0,n.jsx)("li",{children:(0,n.jsx)(a.N_,{href:"/word-maze",className:"text-[#636162] font-light text-sm sm:text-base leading-[1.75] uppercase hover:text-coral transition-colors",children:e("wordMaze")})}),(0,n.jsx)("li",{children:(0,n.jsx)(a.N_,{href:"/pricing",className:"text-[#636162] font-light text-sm sm:text-base leading-[1.75] uppercase hover:text-coral transition-colors",children:e("pricing")})}),(0,n.jsx)("li",{children:(0,n.jsx)(a.N_,{href:"/support",className:"text-[#636162] font-light text-sm sm:text-base leading-[1.75] uppercase hover:text-coral transition-colors",children:e("help")})})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"text-[#141313] font-medium text-sm sm:text-base lg:text-[18px] leading-[1.56] uppercase mb-4 sm:mb-5 lg:mb-6",children:e("company")}),(0,n.jsxs)("ul",{className:"space-y-2 sm:space-y-2.5 lg:space-y-3",children:[(0,n.jsx)("li",{children:(0,n.jsx)(a.N_,{href:"/xpeakai",className:"text-[#636162] font-light text-sm sm:text-base leading-[1.75] uppercase hover:text-coral transition-colors",children:e("xpeakAI")})}),(0,n.jsx)("li",{children:(0,n.jsx)(a.N_,{href:"/become-a-tutor",className:"text-[#636162] font-light text-sm sm:text-base leading-[1.75] uppercase hover:text-coral transition-colors",children:e("becomeATutor")})}),(0,n.jsx)("li",{children:(0,n.jsx)(a.N_,{href:"/career",className:"text-[#636162] font-light text-sm sm:text-base leading-[1.75] uppercase hover:text-coral transition-colors",children:e("careers")})})]})]}),!1,(0,n.jsxs)("div",{className:"col-span-2 sm:col-span-1 lg:col-span-1",children:[(0,n.jsx)("h4",{className:"text-[#141313] font-medium text-sm sm:text-base lg:text-[18px] leading-[1.56] uppercase mb-4 sm:mb-5 lg:mb-6",children:e("appDownload")}),(0,n.jsx)("p",{className:"text-[#636162] font-light text-xs sm:text-sm uppercase mb-3 sm:mb-4 leading-[1.75]",children:e("appDownloadDescription")}),(0,n.jsxs)("div",{className:"flex flex-col gap-2.5 max-w-[220px]",children:[(0,n.jsxs)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:G,"aria-label":e("appStoreAria"),children:[(0,n.jsx)(K,{className:"h-7 w-7 shrink-0 text-[#141313] transition-colors group-hover:text-coral"}),(0,n.jsxs)("span",{className:"flex min-w-0 flex-col leading-tight",children:[(0,n.jsx)("span",{className:"text-[10px] font-light tracking-wide text-[#636162] transition-colors group-hover:text-coral/80",children:e("appStoreLine1")}),(0,n.jsx)("span",{className:"text-[15px] font-semibold tracking-tight",children:e("appStoreLine2")})]})]}),(0,n.jsxs)("a",{href:Z.rm,target:"_blank",rel:"noopener noreferrer",className:G,"aria-label":e("googlePlayAria"),children:[(0,n.jsx)(J,{className:"h-7 w-7 shrink-0"}),(0,n.jsxs)("span",{className:"flex min-w-0 flex-col leading-tight",children:[(0,n.jsx)("span",{className:"text-[10px] font-light tracking-wide text-[#636162] transition-colors group-hover:text-coral/80",children:e("googlePlayLine1")}),(0,n.jsx)("span",{className:"text-[15px] font-semibold tracking-tight",children:e("googlePlayLine2")})]})]}),(0,n.jsxs)("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:G,"aria-label":e("androidApkAria"),children:[(0,n.jsx)(Q,{className:"h-7 w-7 shrink-0 text-[#3DDC84]"}),(0,n.jsxs)("span",{className:"flex min-w-0 flex-col leading-tight",children:[(0,n.jsx)("span",{className:"text-[15px] font-semibold tracking-tight",children:e("androidApkLine1")}),(0,n.jsx)("span",{className:"text-[10px] font-light tracking-wide text-[#636162] transition-colors group-hover:text-coral/80",children:e("androidApkLine2")})]})]})]})]})]}
1),(0,n.jsxs)("div",{className:"border-t border-[#E7E0D4] pt-6 md:pt-8 flex flex-col md:flex-row items-center justify-between gap-4",children:[(0,n.jsx)("p",{className:"text-[#636162] font-light text-xs md:text-sm uppercase text-center md:text-left",children:e("copyright")}),(0,n.jsx)("div",{className:"flex flex-wrap justify-center md:justify-end gap-y-1 max-w-full md:max-w-[70%] lg:max-w-[65%] ".concat("gap-x-3 md:gap-x-6"),children:q.map(t=>(0,n.jsx)(a.N_,{href:t.href,className:"text-[#636162] font-light text-xs md:text-sm uppercase hover:text-coral transition-colors",children:e(t.labelKey)},t.href))})]})]})]})}function $(){let{user:e,isEmailVerified:t}=(0,o.As)();return!e||t?null:(0,n.jsx)("div",{className:"bg-token-warning-surface border-b border-token-warning text-token-warning px-4 py-2 text-center text-sm",children:"Please verify your email address to continue."})}var X=s(38305),ee=s(15173),et=s(44950),es=s(20368),en=s(65344),er=s(52736);function ei(){var e,t,s,i;let{user:m,loading:x,signOut:p}=(0,o.As)(),{roles:f}=(0,c.z)(),g=(0,S.ZE)(m,"User"),v=(0,a.a8)(),b=(0,l.c)("common"),w=(0,l.c)("header"),[j,y]=(0,r.useState)(!1),[N,C]=(0,r.useState)(!1),[k,E]=(0,r.useState)(!1),_=(0,r.useRef)(null),I=(0,r.useRef)(null);W(I);let A=null==v?void 0:v.startsWith("/lessons/"),R=(null==v?void 0:v.startsWith("/student/"))||A&&!!m&&f.includes("student"),M="/pricing"===v&&!!m,P=R&&!!m||M,T=["/","/meet-grace","/pricing","/help","/support","/become-a-tutor","/word-maze","/topic-spark","/xpeakai","/career","/password-reset"].some(e=>v===e||(null==v?void 0:v.startsWith(e+"/"))),F=null==v?void 0:v.startsWith("/auth/"),z=async()=>{try{C(!0),await p()}catch(e){console.error("Sign out error:",e)}finally{C(!1),y(!1)}};(0,r.useEffect)(()=>{let e=e=>{_.current&&!_.current.contains(e.target)&&y(!1)};if(j)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[j]),(0,r.useEffect)(()=>{if(!(R||M)||!m)return;let e=e=>{var t,s;E(null!=(s=null==(t=e.detail)?void 0:t.isOpen)&&s)};return window.addEventListener("student-mobile-sidebar-toggle",e),()=>{window.removeEventListener("student-mobile-sidebar-toggle",e)}},[R,M,m]);let H=e=>"flex items-center gap-2 px-3 py-2 text-sm rounded-md transition-colors ".concat(e?"text-token-primary font-medium bg-token-surface-accent":"text-token-text hover:bg-token-surface-accent"),V=(0,ee.Kp)(v),U=(0,ee.LE)(v),Z=(0,ee._S)(v);return(0,n.jsxs)("header",{ref:I,className:"!fixed inset-x-0 top-0 z-[100] w-full shadow-sm md:hidden relative ".concat(T?M?"bg-cream border-b border-token-border/60":"bg-cream":F?"bg-cream border-b-2 border-cream":"bg-token-surface border-b"," ").concat(O.T9),children:[F&&(0,n.jsx)("div",{className:"absolute inset-0 opacity-30 pointer-events-none",style:{backgroundImage:"radial-gradient(circle, #636162 1px, transparent 1px)",backgroundSize:"16px 16px"}}),(0,n.jsxs)("div",{className:"relative z-10 flex h-14 items-center justify-between px-4",children:[P?(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsxs)("div",{className:"relative",ref:_,children:[(0,n.jsxs)("button",{onClick:()=>y(!j),className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"w-8 h-8 rounded-full bg-token-primary flex items-center justify-center text-white text-sm font-medium overflow-hidden",children:(null==(e=m.user_metadata)?void 0:e.profile_image_url)||(null==(t=m.user_metadata)?void 0:t.avatar_url)?(0,n.jsx)("img",{src:m.user_metadata.profile_image_url||m.user_metadata.avatar_url,alt:g,className:"w-8 h-8 rounded-full object-cover"}):g.charAt(0).toUpperCase()||"U"}),(0,n.jsx)(h.A,{className:"w-4 h-4 text-token-text-muted transition-transform ".concat(j?"rotate-180":"")})]}),j&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:()=>y(!1)}),(0,n.jsx)("div",{className:"absolute left-0 mt-2 w-56 bg-token-surface border border-token-border rounded-lg shadow-lg z-50",children:(0,n.jsxs)("div",{className:"p-2",children:[(0,n.jsxs)("div",{className:"px-3 py-2 text-xs text-token-text-muted border-b border-token-border mb-2",children:[b("signedInAs"),(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-token-text font-medium",children:(0,S.g8)(m)})]}
1),!R&&(0,n.jsxs)(a.N_,{href:"/student/dashboard",className:H(U),onClick:()=>y(!1),children:[(0,n.jsx)(et.A,{className:"w-4 h-4"}),w("studentDashboard")]}),f.includes("tutor")&&(0,n.jsxs)(a.N_,{href:"/tutor",className:H(V),onClick:()=>y(!1),children:[(0,n.jsx)(et.A,{className:"w-4 h-4"}),w("tutorDashboard")]}),!f.includes("tutor")&&(0,n.jsxs)(a.N_,{href:"/become-a-tutor",className:"flex items-center gap-2 px-3 py-2 text-sm text-token-text hover:bg-token-surface-accent rounded-md transition-colors",onClick:()=>y(!1),children:[(0,n.jsx)(es.A,{className:"w-4 h-4"}),w("becomeATutor")]}),(0,n.jsxs)(a.N_,{href:"/student/profile",className:H(Z),onClick:()=>y(!1),children:[(0,n.jsx)(en.A,{className:"w-4 h-4"}),b("profileSettings")]}),(0,n.jsx)("div",{className:"border-t border-token-border mt-2 pt-2",children:(0,n.jsxs)("button",{onClick:z,disabled:N,className:"flex items-center gap-2 w-full px-3 py-2 text-sm text-token-error hover:bg-token-error-surface rounded-md transition-colors disabled:opacity-50",children:[(0,n.jsx)(er.A,{className:"w-4 h-4"}),b(N?"signingOut":"signOut")]})})]})})]})]}),(R||M)&&(0,n.jsx)("button",{type:"button","aria-expanded":k,onClick:()=>{E(!k),window.dispatchEvent(new CustomEvent("student-mobile-sidebar-toggle",{detail:{isOpen:!k}}))},className:"p-2",children:k?(0,n.jsx)(d.A,{className:"w-6 h-6"}):(0,n.jsx)(u.A,{className:"w-6 h-6"})})]}):(0,n.jsx)(D.g,{href:m?"/student/dashboard":"/",className:"h-6 w-auto"}),P?(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L,{size:"sm",variant:"icon",iconVariant:"figma",className:"rounded-lg"}),(0,n.jsx)(B,{compact:!0}),(0,n.jsx)(D.g,{href:"/student/dashboard",className:"h-6 w-auto"})]}):(0,n.jsx)("div",{className:"flex items-center gap-2",children:x?(0,n.jsx)("div",{className:"w-8 h-8 rounded-full bg-token-surface-accent animate-pulse"}):m?(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[A&&(0,n.jsx)(L,{size:"sm",variant:"icon",iconVariant:"figma",className:"rounded-lg"}),(0,n.jsxs)("div",{className:"relative",ref:_,children:[(0,n.jsxs)("button",{onClick:()=>y(!j),className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"w-8 h-8 rounded-full bg-token-primary flex items-center justify-center text-white text-sm font-medium overflow-hidden",children:(null==(s=m.user_metadata)?void 0:s.profile_image_url)||(null==(i=m.user_metadata)?void 0:i.avatar_url)?(0,n.jsx)("img",{src:m.user_metadata.profile_image_url||m.user_metadata.avatar_url,alt:g,className:"w-8 h-8 rounded-full object-cover"}):g.charAt(0).toUpperCase()||"U"}),(0,n.jsx)(h.A,{className:"w-4 h-4 text-token-text-muted transition-transform ".concat(j?"rotate-180":"")})]}),j&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:()=>y(!1)}),(0,n.jsx)("div",{className:"absolute right-0 mt-2 w-56 bg-token-surface border border-token-border rounded-lg shadow-lg z-50",children:(0,n.jsxs)("div",{className:"p-2",children:[(0,n.jsxs)("div",{className:"px-3 py-2 text-xs text-token-text-muted border-b border-token-border mb-2",children:[b("signedInAs"),(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-token-text font-medium",children:(0,S.g8)(m)})]}),(0,n.jsxs)(a.N_,{href:"/student/dashboard",className:H(U),onClick:()=>y(!1),children:[(0,n.jsx)(et.A,{className:"w-4 h-4"}),w("studentDashboard")]}),f.includes("tutor")&&(0,n.jsxs)(a.N_,{href:"/tutor",className:H(V),onClick:()=>y(!1),children:[(0,n.jsx)(et.A,{className:"w-4 h-4"}),w("tutorDashboard")]}),!f.includes("tutor")&&(0,n.jsxs)(a.N_,{href:"/become-a-tutor",className:"flex items-center gap-2 px-3 py-2 text-sm text-token-text hover:bg-token-surface-accent rounded-md transition-colors",onClick:()=>y(!1),children:[(0,n.jsx)(es.A,{className:"w-4 h-4"}),w("becomeATutor")]}),(0,n.jsxs)(a.N_,{href:"/student/profile",className:H(Z),onClick:()=>y(!1),children:[(0,n.jsx)(en.A,{className:"w-4 h-4"}),b("profileSettings")]}),(0,n.jsx)("div",{className:"border-t border-token-border mt-2 pt-2",children:(0,n.jsxs)("button",{onClick:z,disabled:N,className:"flex items-center gap-2 w-full px-3 py-2 text-sm text-token-error hover:bg-token-error-surface rounded-md transition-colors disabled:opacity-50",children:[(0,n.jsx)(er.A,{className:"w-4 h-4"}),b(N?"signingOut":"signOut")]})})]})})]})]})]}):(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L,{size:"sm",variant:"icon",iconVariant:"figma",className:"rounded-lg"}),(0,n.jsx)(a.N_,{href:"/auth/login",className:"text-xs font-medium uppercase transition-opacity hover:opacity-80 ".concat(T?"text-coral":"text-token-text-secondary"),children:b("login")}),(0,n.jsx)(a.N_,{href:"/auth/signup",children:(0,n.jsxs)("button",{className:"bg-coral text-white font-medium text-xs uppercase rounded-full px-3 py-2 flex items-center gap-2",children:[b("signUp"),(0,n.jsx)("div",{className:"flex justify-center items-center w-5 h-5 bg-white rounded-full",children:(0,n.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:[(0,n.jsx)("path",{d:"M8.29 5.79L5.37 2.87C5.07 2.57 5.37 2.07 5.79 2.07V2.07C6.01 2.07 6.22 2.16 6.37 2.31L9.29 5.23C9.68 5.62 9.68 6.25 9.29 6.64L6.37 9.56C6.07 9.86 5.57 9.56 5.57 9.14V9.14C5.57 8.92 5.66 8.71 5.81 8.56L8.29 5.79Z",fill:"#FF6B6B"}),(0,n.jsx)("rect",{x:"3",y:"5",width:"5",height:"2",rx:"1",fill:"#FF6B6B"})]})})]})})]})})]})]})}var ea=s(16970);
1function el(e){let{color:t,size:s=24,variant:r="filled"}=e;return(0,n.jsx)("svg",{width:s,height:.93*s,viewBox:"0 0 20 18.6367",fill:"none","aria-hidden":!0,children:(0,n.jsx)("path",{d:"M0.753065 8.63999C0.53885 8.63999 0.324635 8.56859 0.181825 8.35437C-0.103794 8.06875 -0.0323895 7.56892 0.25323 7.35471L8.67901 0.428429C9.46446 -0.14281 10.6069 -0.14281 11.321 0.428429L19.7468 7.2833C20.0324 7.49752 20.1038 7.99735 19.8182 8.28297C19.5326 8.56859 19.1041 8.63999 18.8185 8.35437L10.4641 1.64231C10.2499 1.4995 9.82149 1.4995 9.60727 1.64231L1.18149 8.49718C1.03868 8.63999 0.895874 8.63999 0.753065 8.63999ZM16.8192 18.6367H12.1779C11.7494 18.6367 11.4638 18.3511 11.4638 17.9226V14.5666C11.4638 14.0668 10.6069 13.5669 9.9643 13.5669C9.32165 13.5669 8.5362 13.9954 8.5362 14.5666V17.9226C8.5362 18.3511 8.25058 18.6367 7.82215 18.6367H3.32364C2.25257 18.6367 1.46711 17.8512 1.46711 16.8516V10.0681C1.46711 9.63966 1.75273 9.35404 2.18116 9.35404C2.60959 9.35404 2.89521 9.63966 2.89521 10.0681V16.8516C2.89521 17.0658 3.03802 17.2086 3.32364 17.2086H7.17951V14.5666C7.17951 13.1385 8.67901 12.1388 10.0357 12.1388C11.3924 12.1388 12.9633 13.1385 12.9633 14.5666V17.2086H16.8906C17.1048 17.2086 17.2476 17.2086 17.2476 16.7802V10.0681C17.2476 9.63966 17.5332 9.35404 17.9616 9.35404C18.3901 9.35404 18.6757 9.63966 18.6757 10.0681V16.8516C18.6043 17.9226 17.8902 18.6367 16.8192 18.6367Z",fill:"filled"===r?t:"none",stroke:"outline"===r?t:void 0,strokeWidth:"outline"===r?1.2:void 0})})}function eo(e){let{color:t,size:s=24}=e;return(0,n.jsx)("svg",{width:s,height:.85*s,viewBox:"0 0 20 17",fill:"none","aria-hidden":!0,children:(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.67995 1.38856e-06C8.09435 -0.000387487 8.50439 0.0809073 8.88459 0.239856C9.26493 0.39891 9.60762 0.631814 9.89094 0.92359L10 1.03605L10.1091 0.92359C10.6622 0.354463 11.4486 1.38856e-06 12.321 1.38856e-06H16.9621C17.3617 3.7604e-05 17.7572 0.0758882 18.1261 0.223932C18.4952 0.37208 18.8307 0.589651 19.1126 0.86288C19.3944 1.13602 19.6178 1.46022 19.77 1.81633C19.9221 2.17243 20 2.55388 20 2.93896V12.5469C20 13.3246 19.6818 14.0722 19.1126 14.6239C18.5432 15.1758 17.7696 15.4867 16.9621 15.4868H12.2903C12.0927 15.487 11.8966 15.5228 11.7123 15.5923L11.6171 15.6281C11.245 15.768 10.9391 16.0385 10.7605 16.3875L10.6474 16.6065V16.6085C10.5737 16.7559 10.447 16.8745 10.2895 16.9409C10.1189 17.0138 9.92427 17.0194 9.74916 16.9568C9.5742 16.8942 9.43299 16.7686 9.35356 16.6085L9.35257 16.6065L9.23954 16.3875C9.0837 16.0812 8.829 15.8369 8.51874 15.6869L8.38291 15.6281L8.28773 15.5923C8.10359 15.5229 7.90663 15.4868 7.7097 15.4868H3.03787C2.23041 15.4867 1.45676 15.1758 0.887369 14.6239C0.318202 14.0722 0 13.3246 0 12.5469L0 2.93896C2.49415e-05 2.55388 0.0778761 2.17243 0.230022 1.81633C0.382222 1.46022 0.605626 1.13602 0.887369 0.86288C1.16929 0.589651 1.50484 0.37208 1.87388 0.223932C2.24277 0.0758881 2.63831 3.745e-05 3.03787 1.38856e-06H7.67995ZM3.03787 1.38041C2.15843 1.38056 1.43576 2.07378 1.43565 2.93896V12.5469C1.43565 13.4121 2.15837 14.1053 3.03787 14.1054H7.7097C8.08592 14.1055 8.45869 14.1737 8.80924 14.3055L8.90541 14.3403C9.27373 14.4788 9.61066 14.6864 9.89689 14.9494L10 15.0439L10.1031 14.9494C10.3893 14.6865 10.7254 14.4788 11.0936 14.3403L11.1898 14.3055C11.5403 14.1737 11.914 14.1054 12.2903 14.1054H16.9621C17.8416 14.1053 18.5643 13.4121 18.5643 12.5469V2.93896C18.5642 2.07378 17.8416 1.38056 16.9621 1.38041H12.321C11.4415 1.38041 10.7179 2.07369 10.7178 2.93896V12.8225C10.7178 13.0039 10.6437 13.1793 10.5096 13.3092C10.3754 13.4393 10.1921 13.5132 10 13.5132C9.8079 13.5132 9.62464 13.4393 9.49038 13.3092C9.35631 13.1793 9.28217 13.0039 9.28217 12.8225V2.93896C9.28207 2.07369 8.55853 1.38041 7.67896 1.38041H3.03787Z",fill:t})})}function ec(e){let{color:t,size:s=24}=e;return(0,n.jsx)("svg",{width:s,height:s,viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 0C12.652 4.07132e-06 15.1962 1.05333 17.0714 2.92859C18.9467 4.80385 20 7.34796 20 10C20 12.652 18.9467 15.1962 17.0714 17.0714C15.1962 18.9467 12.652 20 10 20C7.34796 20 4.80385 18.9467 2.92859 17.0714C1.05332 15.1962 0 12.652 0 10C5.74951e-06 7.34798 1.05333 4.80384 2.92859 2.92859C4.80383 1.05335 7.34795 0 10 0ZM10 1.27737C7.68643 1.27737 5.46807 2.19618 3.83212 3.83212C2.19617 5.46807 1.27738 7.68644 1.27737 10C1.27737 12.3136 2.19616 14.5319 3.83212 16.1679C4.56596 16.9017 5.41734 17.4897 6.34149 17.9167L6.48451 17.9828V15.3166C6.48448 15.255 6.49804 15.1932 6.52298 15.1351C6.54781 15.0776 6.58431 15.0247 6.6305 14.9803L6.70645 14.9201C6.73381 14.9023 6.76286 14.8868 6.79325 14.8747C6.85373 14.8507 6.91971 14.8382 6.98659 14.8382H7.62675L7.48077 14.6715L4.74255 11.5338L4.71395 11.4964L4.70211 11.4806C4.65329 11.4056 4.62665 11.3184 4.62616 11.23C4.62579 11.1407 4.65237 11.053 4.70211 10.9765L9.57388 3.48392C9.59412 3.45268 9.61845 3.42328 9.64589 3.39712L9.6449 3.39613L9.66068 3.38134L9.66167 3.38232L9.69817 3.35372L9.73072 3.33103L9.77116 3.30933L9.8264 3.28763L9.8915 3.26889L9.93194 3.26198L10.003 3.25705L10.0385 3.25903L10.1026 3.26692L10.1509 3.27875L10.1874 3.29256C10.2016 3.29782 10.2092 3.30108 10.217 3.3044L10.2703 3.333L10.2999 3.35273L10.3699 3.4129L10.3877 3.43263L10.4251 3.48392L15.2979 10.9765C15.3495 11.0558 15.3762 11.1474 15.3738 11.2399C15.3714 11.3324 15.34 11.4233 15.2841 11.5003L15.2683 11.522L12.5173 14.6715L12.3713 14.8382H13.0124L13.1111 14.8481C13.2083 14.866
17 13.2981 14.9126 13.3685 14.9803C13.4621 15.0703 13.5145 15.1913 13.5145 15.3166V17.9828L13.6575 17.9167C14.4532 17.5493 15.1959 17.0637 15.8552 16.4668L15.8572 16.4648L16.1669 16.1699L16.1679 16.1679C17.7016 14.6342 18.6058 12.5881 18.7128 10.432V10.4291L18.7226 10.002V10C18.7226 7.83102 17.9157 5.74504 16.4668 4.1448L16.4648 4.14283L16.1699 3.8331L16.1679 3.83212L15.8749 3.55198C14.3784 2.18838 12.4535 1.38752 10.432 1.28724H10.4291L10.002 1.27737H10ZM10.5011 9.52555C10.5011 9.55345 10.4985 9.57976 10.4942 9.60446L10.4794 9.69027L10.5622 9.71789C10.9437 9.84561 11.2651 10.0995 11.4697 10.432C11.6741 10.7645 11.7496 11.155 11.6828 11.5348C11.6158 11.9149 11.4098 12.2603 11.1018 12.5104C10.7937 12.7604 10.4034 12.8991 9.99901 12.899C9.5948 12.8988 9.20395 12.7612 8.89623 12.5113C8.58847 12.2612 8.38298 11.914 8.31624 11.5338C8.24966 11.1539 8.3255 10.7624 8.53028 10.4301C8.73523 10.0978 9.05642 9.84429 9.43776 9.71691L9.52259 9.68929L9.50483 9.6015C9.5001 9.57747 9.4979 9.55183 9.49793 9.52555V5.41527L5.78615 11.1235L5.74472 11.1876L5.79503 11.2448L8.90314 14.8037L8.93273 14.8382H11.0673L11.0969 14.8037L14.205 11.2438L14.2553 11.1866L14.2138 11.1225L10.5011 5.41428V9.52555ZM10.002 10.5839C9.90975 10.5824 9.81666 10.597 9.72973 10.6303C9.64311 10.6635 9.56451 10.7144 9.49793 10.7773C9.43105 10.8405 9.37742 10.916 9.34109 10.9992C9.30496 11.0822 9.28586 11.1724 9.28586 11.2636C9.28594 11.3546 9.30484 11.4448 9.34109 11.5279L9.40817 11.6463C9.43438 11.6833 9.4647 11.7175 9.49793 11.7489C9.56451 11.8117 9.64311 11.8626 9.72973 11.8958C9.81666 11.9291 9.90975 11.9437 10.002 11.9422C10.1848 11.9391 10.3606 11.8677 10.4902 11.741C10.6197 11.6142 10.6923 11.4427 10.6924 11.2636C10.6924 11.0843 10.6199 10.9121 10.4902 10.7852C10.3606 10.6584 10.1848 10.5871 10.002 10.5839Z",fill:t})})}function ed(e){let{color:t,size:s=24,active:r=!1}=e;return r?(0,n.jsx)("svg",{width:s,height:s,viewBox:"0 0 18 18",fill:"none","aria-hidden":!0,children:(0,n.jsx)("path",{d:"M8.082 2.13a1.002 1.002 0 0 1 1.836 0l1.635 3.794c.1.234.288.42.532.522l3.793 1.635a1.002 1.002 0 0 1 0 1.836L12.084 11.55a1.002 1.002 0 0 0-.532.523l-1.635 3.793a1.002 1.002 0 0 1-1.836 0L6.447 12.07a1.002 1.002 0 0 0-.524-.523L2.13 9.913a1.002 1.002 0 0 1 0-1.836L5.923 6.44a1.002 1.002 0 0 0 .524-.523L8.082 2.13Z",fill:t})}):(0,n.jsx)("svg",{width:s,height:s,viewBox:"0 0 15.4621 15.4623",fill:"none","aria-hidden":!0,children:(0,n.jsx)("path",{d:"M9.55957 5.22363C9.6888 5.52955 9.93238 5.77309 10.2383 5.90234L14.5654 7.73047L10.2383 9.55957C9.93235 9.68879 9.68884 9.93237 9.55957 10.2383L7.73047 14.5654L5.90234 10.2383C5.77307 9.93242 5.52952 9.68879 5.22363 9.55957L0.895508 7.73047L5.22363 5.90234C5.52958 5.7731 5.7731 5.52958 5.90234 5.22363L7.73047 0.895508L9.55957 5.22363Z",stroke:t,strokeWidth:1.4})})}function eu(e){let{color:t,size:s=24}=e;return(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:[(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 0C15.5228 0 20 4.47715 20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0ZM10 1.4C5.25029 1.4 1.4 5.25029 1.4 10C1.4 14.7497 5.25029 18.6 10 18.6C14.7497 18.6 18.6 14.7497 18.6 10C18.6 5.25029 14.7497 1.4 10 1.4Z",fill:t}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.15L12.35 10L10 16.85L7.65 10Z M11.4 10A1.4 1.4 0 1 1 8.6 10A1.4 1.4 0 1 1 11.4 10Z",fill:t})]})}function eh(e){let{color:t,size:s=24}=e;return(0,n.jsx)("svg",{width:s,height:s,viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 0C15.5141 0 20 4.48592 20 10C20 15.5141 15.5141 20 10 20C4.48592 20 0 15.5141 0 10C0 4.48592 4.48592 0 10 0ZM9.94646 14.9237C8.14999 14.9237 5.70218 15.6189 4.25144 16.0876L4.00357 16.168L4.19492 16.3444C5.6779 17.7108 7.59177 18.508 9.59746 18.603L10 18.6129C12.1374 18.612 14.1976 17.8122 15.7753 16.3702L15.9677 16.1937L15.7198 16.1134C14.2797 15.6459 11.7726 14.9237 9.94646 14.9237ZM10 1.38707C5.25073 1.38707 1.38707 5.25073 1.38707 10L1.39401 10.3312C1.45751 11.9844 1.99907 13.5864 2.95657 14.9415L3.023 15.0357L3.13107 14.998C4.08172 14.669 5.9709 14.0645 7.82669 13.7458L8.22526 13.6774L7.88023 13.4662C6.70938 12.7469 5.92209 11.4665 5.92207 9.99802V7.46381C5.92289 6.38238 6.35237 5.34555 7.1168 4.58061C7.8814 3.81564 8.91844 3.38524 10 3.3839L10.2023 3.38886C11.2101 3.44006 12.1664 3.86346 12.8832 4.58061C13.6476 5.345
155 14.0771 6.38238 14.0779 7.46381V9.99802C14.0779 11.4773 13.2788 12.7637 12.095 13.4801L11.748 13.6903L12.1475 13.7607C14.0306 14.0925 15.9391 14.7099 16.8461 15.0268L16.9542 15.0644L17.0206 14.9722C18.0559 13.5211 18.6129 11.7826 18.6129 10C18.6129 5.25073 14.7493 1.38707 10 1.38707ZM10 4.77097C9.28661 4.77211 8.60266 5.05661 8.09835 5.56117C7.59402 6.06591 7.30971 6.7503 7.30914 7.46381V9.99802L7.32302 10.2637C7.38452 10.8797 7.65701 11.459 8.09835 11.9007C8.60266 12.4052 9.28661 12.6897 10 12.6909L10.2657 12.677C10.8816 12.615 11.4603 12.3422 11.9016 11.9007C12.343 11.459 12.6155 10.8797 12.677 10.2637L12.6909 9.99802V7.46381C12.6908 6.07154 11.6294 4.92291 10.2746 4.78485L10 4.77097Z",fill:t})})}let em="#FF6B6B";var ex=s(49886);let ep=[{key:"home",href:"/student/dashboard",labelKey:"home"},{key:"tutors",href:"/student/tutors",labelKey:"tutors"},{key:"lessons",href:"/student/lessons",labelKey:"lessons"},{key:"grace",href:"/student/grace",labelKey:"grace"},{key:"explore",href:"/student/explore",labelKey:"explore"},{key:"me",href:"/student/profile",labelKey:"me"}];function ef(e,t){switch(e){case"home":return"/student/dashboard"===t||"/pricing"===t;case"tutors":return!!(null==t?void 0:t.startsWith("/student/tutors"));case"lessons":return!!(null==t?void 0:t.startsWith("/student/lessons"));case"grace":return!!t&&("/student/grace"===t||t.startsWith("/student/grace/practice")||t.startsWith("/student/grace/sentence-explorer"));case"explore":return!!t&&(t.startsWith("/student/explore")||t.startsWith("/student/grace/ai-topic")||t.startsWith("/student/grace/picture-books")||t.startsWith("/student/word-maze"));case"me":return!!(null==t?void 0:t.startsWith("/student/profile"))}}function eg(e,t){let s=t?"#FFFFFF":"#B8BFCA",r=t?20:24;switch(e){case"home":return(0,n.jsx)(el,{color:s,size:r,variant:t?"filled":"outline"});case"tutors":return(0,n.jsx)(eo,{color:s,size:r});case"lessons":return(0,n.jsx)(ec,{color:s,size:r});case"grace":return(0,n.jsx)(ed,{color:s,size:r,active:t});case"explore":return(0,n.jsx)(eu,{color:s,size:r});case"me":return(0,n.jsx)(eh,{color:s,size:r})}}function ev(){let e=(0,a.a8)(),t=(0,l.c)("nav"),s=(0,r.useRef)(null),[i,o]=(0,r.useState)(0);(0,r.useLayoutEffect)(()=>{let e=s.current;if(!e)return;let t=()=>o(e.getBoundingClientRect().width);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let c=function(e){let t=ep.findIndex(t=>ef(t.key,e));return t>=0?t:0}(e),d=(0,ex.Mv)(i,c,ep.length),u=(0,ex.dI)(i,d);return(0,n.jsxs)("nav",{ref:s,className:"md:hidden fixed bottom-0 left-0 right-0 z-50 bg-transparent overflow-visible","aria-label":"Student navigation",style:{paddingBottom:"max(env(safe-area-inset-bottom), ".concat(ex.B3,"px)")},children:[i>0&&(0,n.jsxs)("svg",{width:i,height:ex.Wx,className:"absolute top-0 left-0 pointer-events-none","aria-hidden":!0,children:[(0,n.jsx)("path",{d:u,fill:"#FFFFFF"}),(0,n.jsx)("path",{d:u,fill:"none",stroke:"rgba(0,0,0,0.08)",strokeWidth:1})]}),(0,n.jsx)("div",{className:"absolute left-0 right-0 bottom-0 bg-white",style:{height:"max(env(safe-area-inset-bottom), ".concat(ex.B3,"px)")},"aria-hidden":!0}),(0,n.jsx)("div",{className:"relative flex items-end",style:{height:ex.Wx,paddingBottom:14},children:ep.map(s=>{let r=ef(s.key,e),i="tutors"===s.key?(0,H.sk)():s.href;return(0,n.jsxs)(a.N_,{href:i,className:"relative z-[1] flex min-w-0 flex-1 flex-col items-center justify-end gap-1 px-0.5","aria-current":r?"page":void 0,children:[(0,n.jsx)("div",{className:"flex h-10 items-end justify-center",children:r?(0,n.jsx)("span",{className:"mb-1.5 flex h-8 w-8 items-center justify-center rounded-full shadow-[0_4px_4px_rgba(255,107,107,0.3)]",style:{backgroundColor:em},children:eg(s.key,!0)}):eg(s.key,!1)}),(0,n.jsx)("span",{className:"w-full truncate text-center text-[10px] leading-3",style:{color:r?em:"#B8BFCA",fontWeight:r?700:400},children:t(s.labelKey)})]},s.key)})})]})}var eb=s(36899);function ew(){let e=(0,a.a8)(),{user:t,loading:s}=(0,o.As)(),{roles:i}=(0,c.z)(),d=(0,l.c)("nav"),u=(0,l.c)("header"),[h,m]=(0,r.useState)(null),x=(0,r.useRef)(null),p=!i.includes("tutor"),f=(0,eb.E)({pathname:e,user:t,loading:s});if((0,r.useEffect)(()=>{let e=e=>{var t,s;let n=e.target;!(!n||(null==(t=n.closest)?void 0:t.call(n,"[data-mobile-bottom-nav]")))&&(null!=(s=x.current)&&s.contains(n)||m(null))};if(h)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[h]),"hidden"===f)return null;if("student"===f)return(0,n.jsx)(ev,{});let g="/meet-grace"===e||(null==e?void 0:e.startsWith("/word-maze"))||(null==e?void 0:e.startsWith("/topic-spark")),v="/business"===e||(null==e?void 0:e.startsWith("/business/"))||"/become-a-tutor"===e||(null==e?void 0:e.startsWith("/become-a-tutor/")),b=e=>{m(t=>t===e?null:e)},w=e=>"block px-4 py-2.5 mx-2 rounded-md transition-colors ".concat(e?"bg-token-primary/10 text-token-primary":"text-token-text hover:bg-token-surface-accent");return(0,n.jsxs)(n.Fragment,{children:[h&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:()=>m(null)}),(0,n.jsx)("div",{ref:x,className:"fixed bottom-16 z-50 w-56 rounded-lg border border-token-border bg-token-surface shadow-lg ".concat("others"===h?"right-2":"left-1/2 -translate-x-1/2"),children:(0,n.jsxs)("div",{className:"py-2",children:["features"===h&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.N_,{href:"/meet-grace",className:w("/meet-grace"===e),onClick:()=>m(null),children:(0,n.jsx)("span",{className:"text-sm font-medium",children:d("grace")})}),(0,n.jsx)(a.N_,{href:"/word-maze",className:w("/word-maze"===e),onClick:()=>m(null),children:(0,n.jsx)("span",{className:"text-sm font-medium",children:u("wordMaze")})}),(0,n.jsx)(a.N_,{href:"/topic-spark",className:w("/topic-spark"===e),onClick:()=>m(null),children:(0,n.jsx)("span",{className:"text-sm font-medium",children:u("aiTopic")})})]}),"others"===h&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.N_,{href:"/business",className:w("/business"===e||!!(null==e?void 0:e.startsWith("/business/"))),onClick:()=>m(null),children:(0,n.jsx)("span",{className:"text-sm font-medium",children:u("b2b")})}),p&&(0,n.jsx)(a.N_,{href:"/become-a-tutor",className:w("/become-a-tutor"===e||!!(null==e?void 0:e.startsWith("/become-a-tutor/"))),onClick:()=>m(null),children:(0,n.jsx)("span",{className:"text-sm font-medium",children:u("becomeATutor")})})]})]})})]}),(0,n.jsx)("nav",{"data-mobile-bottom-nav":!0,className:"md:hidden fixed bottom-0 left-0 right-0 z-50 bg-token-surface border-t",children:(0,n.jsxs)("div",{className:"grid h-16 grid-cols-4",children:[(0,n.jsx)(a.N_,{href:"/",className:"flex flex-col items-center justify-center ".concat("/"===e?"text-token-primary":"text-token-text-secondary"),children:(0,n.jsx)("span",{className:"text-xs",children:d("home")})}),(0,n.jsxs)("button",{type:"button",onClick:()=>b("features"),className:"relative flex flex-col items-center justify-center ".concat(g||"features"===h?"text-token-primary":"text-token-text-secondary"),children:[(0,n.jsx)("span",{className:"text-xs",children:d("features")}),"features"===h&&(0,n.jsx)(ea.A,{className:"absolute top-1 h-3 w-3"})]}),(0,n.jsx)(a.N_,{href:"/pricing",className:"flex flex-col items-center justify-center ".concat("/pricing"===e?"text-token-primary":"text-token-text-secondary"),children:(0,n.jsx)("span",{className:"text-xs",children:d("pricing")})}),(0,n.jsxs)("button",{type:"button",onClick:()=>b("others"),className:"relative flex flex-col items-center justify-center ".concat(v||"others"===h?"text-token-primary":"text-token-text-secondary"),children:[(0,n.jsx)("span",{className:"text-xs",children:d("others")}),"others"===h&&(0,n.jsx)(ea.A,{className:"absolute top-1 h-3 w-3"})]})]})})]})}var ej=s(12252),ey=s(93974),eN=s(37152);
1function eC(e){let{children:t,heroBackgroundColor:s}=e;return(0,n.jsx)(r.Suspense,{fallback:(0,n.jsx)(eL,{heroBackgroundColor:s,shareOverlayMode:!1,children:t}),children:(0,n.jsx)(ek,{heroBackgroundColor:s,children:t})})}function ek(e){let{children:t,heroBackgroundColor:s}=e,r="1"===(0,i.useSearchParams)().get("fromShare");return(0,n.jsx)(eL,{heroBackgroundColor:s,shareOverlayMode:r,children:t})}function eL(e){let{children:t,heroBackgroundColor:s,shareOverlayMode:r}=e,i=(0,a.a8)(),{user:l,loading:c}=(0,o.As)(),d=(0,eb.E)({pathname:i,user:l,loading:c});["/pricing","/auth/login","/auth/signup","/password-reset","/verify-email","/checkout","/dashboard","/profile","/tutor","/student/tutor-application","/meet-grace","/topic-spark","/word-maze","/sentence-explorer","/become-a-tutor","/help","/support","/career","/"].some(e=>i.startsWith(e));let u=["/lessons","/student/dashboard","/student/lessons","/student/tutors","/student/chat","/student/recordings","/student/profile","/student/billing-payments","/student/invoices","/student/grace","/student/explore","/student/word-maze","/student/system-check","/student/onboarding","/student/tutor-application"].some(e=>i.startsWith(e)),h=(null==i?void 0:i.includes("auth/signup"))||(null==i?void 0:i.includes("auth/login"))||(null==i?void 0:i.includes("password-reset")),m=(null==i?void 0:i.includes("/auth/"))||(null==i?void 0:i.includes("password-reset")),x=!(s||u||m),p=(0,ej.C)(r);return(0,n.jsx)(V.Provider,{value:s||null,children:(0,n.jsx)(eN.T8,{role:"student",children:(0,n.jsx)(ey.sd,{children:(0,n.jsxs)("div",{className:"min-h-screen flex flex-col",children:[(0,n.jsx)("div",{className:"hidden md:block",children:(0,n.jsx)(U,{heroBackgroundColor:s})}),r?null:(0,n.jsx)(ei,{}),(0,n.jsx)($,{}),l?(0,n.jsx)(X.A,{}):null,(0,n.jsx)("main",{className:u?"flex min-h-0 flex-1 flex-col overflow-hidden":"flex-grow",children:(0,n.jsx)("div",{className:"".concat(x?"pt-14 md:pt-16 impersonation-content-offset-with-header app-shell-content-offset-with-header":"impersonation-content-offset app-shell-content-offset").concat(u?" flex min-h-0 flex-1 flex-col overflow-hidden":""," ").concat(p),children:t})}),!l&&!h&&(0,n.jsx)(Y,{}),r?null:(0,n.jsx)(ew,{}),r||"marketing"!==d?null:(0,n.jsx)("div",{className:"h-16 md:hidden"}),r||"student"!==d?null:(0,n.jsx)("div",{className:"md:hidden",style:{height:"calc(".concat(ex.Wx,"px + max(env(safe-area-inset-bottom), ").concat(ex.B3,"px))")}})]})})})})}},68266:(e,t,s)=>{s.d(t,{JJ:()=>x,Jl:()=>v,M7:()=>f,OI:()=>j,Tk:()=>b,i1:()=>p,mg:()=>w,pp:()=>m,vQ:()=>y});let n="xpeak-chat-message-sound-enabled",r="/sounds/chat-message.mp3",i=null,a=0,l=null,o=!1,c=!1,d=null,u=null,h={student:null,tutor:null};function m(e){i=e}function x(){return i}function p(){return"false"!==localStorage.getItem(n)}function f(e){localStorage.setItem(n,e?"true":"false"),e&&g(),window.dispatchEvent(new CustomEvent("xpeak-chat-message-sound-pref",{detail:{enabled:e}}))}function g(){if(!o)try{let e=new Audio(r);e.preload="auto",e.muted=!0,e.volume=0;let t=e.play(),s=()=>{e.pause(),e.currentTime=0,o=!0,d&&(window.removeEventListener("pointerdown",d),d=null),u&&(window.removeEventListener("keydown",u),u=null),c=!1};t&&"function"==typeof t.then?t.then(s).catch(()=>{}):s()}catch(e){}}function v(){if(o||c)return()=>void 0;c=!0;let e=()=>{g()};return d=e,u=e,window.addEventListener("pointerdown",e,{passive:!0}),window.addEventListener("keydown",e),()=>void 0}function b(e){var t,s;if(!p())return;let n=null!=(s=null==e||null==(t=e.now)?void 0:t.call(e))?s:Date.now();if(!(n-a<1500)){a=n;try{let t=(null==e?void 0:e.createAudio)?e.createAudio(r):(null!=l||(l=new Audio(r)),l.preload="auto",l);t.muted=!1,0===t.volume&&(t.volume=1),t.currentTime=0;let s=t.play();s&&"function"==typeof s.catch&&s.catch(()=>{o=!1,v()})}catch(e){}}}function w(e,t){var s;return"conversation.state.invalidated"===e.eventType&&e.payload.targetRole===t.role&&!!((s={enabled:p(),reason:e.payload.reason,conversationId:e.payload.conversationId,activeConversationId:i}).enabled&&"message-created"===s.reason&&s.conversationId&&(!s.activeConversationId||s.activeConversationId!==s.conversationId)&&1)&&(b({createAudio:t.createAudio,now:t.now}),!0)}function j(e,t,s){var n;let r=(n=h[e],function(e,t){let s=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return!!s&&null!==e&&t>e}(n,t,p())&&b(s),t);return h[e]=r,r}function y(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;h[e]=t}},68364:(e,t,s)=>{s.d(t,{Lm:()=>l});let n=new Set(["SNAPSHOT","INTERVAL","REMOTE_JOIN","REMOTE_LEAVE","REMOTE_TIMEOUT","REMOTE_STATE_CHANGED","ERROR_OUT_OF_SERVICE"]);function r(e){let t=e instanceof Error?e.message:String(null!=e?e:"");return t.includes("-13001")||t.includes("Presence service not connected")||t.includes("PRESENCE_NOT_CONNECTED")||t.includes("PRESENCE_NOT_READY")||t.includes("CHANNEL_PRESENCE_NOT_READY")}async function i(e){let t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,n="wait-presence-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8)),r=!1,i=new Promise(e=>{t=e}),a=e=>{r||(r=!0,t(e))},l=e=>{let{channelName:t,channelType:s,eventType:r}=e;t===n&&"MESSAGE"===s&&"SNAPSHOT"===r&&a(!0)},o=setTimeout(()=>a(!1),s);e.addEventListener("presence",l);try{return await e.subscribe(n,{withPresence:!0,beQuiet:!0,withLock:!1,withMessage:!1,withMetadata:!1}),await i}catch(e){return!1}finally{clearTimeout(o),e.removeEventListener("presence",l),e.unsubscribe(n).catch(()=>{})}}async function a(e,t){var s,n;
1let r=null!=(s=null==t?void 0:t.timeoutMs)?s:5e3,a=null!=(n=null==t?void 0:t.attempts)?n:3;for(let t=0;t<a;t++)if(t>0&&await function(e){return new Promise(t=>{setTimeout(t,e)})}(1e3*t),await i(e,r))return!0;return!1}class l{static async connect(e){let t=await e.tokenProvider(),n="".trim();if(n&&n!==t.appId)throw Error("Agora Signaling App ID does not match the token issuer");let r=!1!==e.enablePresence,{default:i}=await Promise.all([s.e(4012),s.e(7020)]).then(s.t.bind(s,3072,23)),o=new i.RTM(t.appId,t.userId),c=new l(o,t.appId,t.userId,e.tokenProvider,e.onTokenRenewalError,r),d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15e3;return new Promise((s,n)=>{let r=!1,i=setTimeout(()=>{r||(r=!0,a(),n(Error("Agora RTM link CONNECTED timeout")))},t),a=e.onLinkState(e=>{if(!r){if("CONNECTED"===e.currentState){r=!0,clearTimeout(i),a(),s();return}"FAILED"===e.currentState&&(r=!0,clearTimeout(i),a(),n(Error("Agora RTM link failed: ".concat(e.reasonCode||e.reason||"FAILED"))))}})})}(c,15e3);return await o.login({token:t.token}),await d,r&&(c.presenceChannelReady=await a(o)),c}get identity(){return{appId:this.appId,userId:this.userId}}get isPresenceReady(){return this.presenceChannelReady}async subscribe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(this.enablePresence&&!1!==t.withPresence)){await this.client.subscribe(e,{withMessage:!0,withPresence:!1,beQuiet:!0,withLock:!1,withMetadata:!1}),this.subscribedChannels.add(e);return}try{await this.client.subscribe(e,{withMessage:!0,withPresence:!0,beQuiet:!1}),this.subscribedChannels.add(e),this.presenceChannelReady=!0;return}catch(e){if(!r(e))throw e}if(await a(this.client))try{await this.client.subscribe(e,{withMessage:!0,withPresence:!0,beQuiet:!1}),this.subscribedChannels.add(e),this.presenceChannelReady=!0;return}catch(e){if(!r(e))throw e}await this.client.subscribe(e,{withMessage:!0,withPresence:!1,beQuiet:!0,withLock:!1,withMetadata:!1}),this.subscribedChannels.add(e),this.presenceChannelReady=!1}async ensurePresenceSubscription(e){if(!this.subscribedChannels.has(e))return!1;if(this.presenceChannelReady)return!0;if(!await a(this.client))return!1;try{return await this.client.unsubscribe(e),this.subscribedChannels.delete(e),await this.client.subscribe(e,{withMessage:!0,withPresence:!0,beQuiet:!1}),this.subscribedChannels.add(e),this.presenceChannelReady=!0,!0}catch(t){if(this.subscribedChannels.has(e)||(await this.client.subscribe(e,{withMessage:!0,withPresence:!1,beQuiet:!0,withLock:!1,withMetadata:!1}).catch(()=>void 0),this.subscribedChannels.add(e)),!r(t))throw t;return this.presenceChannelReady=!1,!1}}async unsubscribe(e){this.subscribedChannels.has(e)&&(await this.client.unsubscribe(e),this.subscribedChannels.delete(e))}async publish(e,t){await this.client.publish(e,t)}async getOnlineUserIds(e){return new Set((await this.client.presence.getOnlineUsers(e,"MESSAGE",{includedUserId:!0,includedState:!1})).occupants.map(e=>e.userId))}onMessage(e){return this.client.addEventListener("message",e),()=>{this.client.removeEventListener("message",e)}}onPresence(e){let t=t=>{let s=function(e){var t,s,r,i,a,l,o;if(!n.has(e.eventType))return null;let c=e.eventType,d=e.publisher||void 0,u=null!=(i=null==(t=e.interval)?void 0:t.join.users)?i:[],h=null!=(a=null==(s=e.interval)?void 0:s.leave.users)?a:[],m=null!=(l=null==(r=e.interval)?void 0:r.timeout.users)?l:[];return{channelName:e.channelName,eventType:c,publisher:d,snapshotUserIds:(null!=(o=e.snapshot)?o:[]).map(e=>e.userId),joinedUserIds:u.length>0?u:"REMOTE_JOIN"===c&&d?[d]:[],leftUserIds:h.length>0?h:"REMOTE_LEAVE"===c&&d?[d]:[],timeoutUserIds:m.length>0?m:"REMOTE_TIMEOUT"===c&&d?[d]:[],timestamp:e.timestamp}}(t);s&&e(s)};return this.client.addEventListener("presence",t),()=>{this.client.removeEventListener("presence",t)}}onLinkState(e){return this.client.addEventListener("linkState",e),()=>{this.client.removeEventListener("linkState",e)}}onStatus(e){return this.client.addEventListener("status",e),()=>{this.client.removeEventListener("status",e)}}async disconnect(){this.client.removeEventListener("tokenPrivilegeWillExpire",this.handleTokenPrivilegeWillExpire),await Promise.allSettled([...this.subscribedChannels].map(e=>this.client.unsubscribe(e))),this.subscribedChannels.clear(),await this.client.logout()}renewTokenNow(){return null!=this.renewPromise||(this.renewPromise=this.renewToken().finally(()=>{this.renewPromise=null})),this.renewPromise}async renewToken(){let e=await this.tokenProvider();if(e.appId!==this.appId||e.userId!==this.userId)throw Error("Renewed Agora Signaling token changed client identity");await this.client.renewToken(e.token)}constructor(e,t,s,n,r,i=!0){this.client=e,this.appId=t,this.userId=s,this.tokenProvider=n,this.onTokenRenewalError=r,this.enablePresence=i,this.subscribedChannels=new Set,this.presenceChannelReady=!1,this.renewPromise=null,this.handleTokenPrivilegeWillExpire=async()=>{try{await this.renewTokenNow()}catch(t){var e;null==(e=this.onTokenRenewalError)||e.call(this,t)}},this.client.addEventListener("tokenPrivilegeWillExpire",this.handleTokenPrivilegeWillExpire)}}},70427:(e,t,s)=>{s.d(t,{T9:()=>i,k5:()=>r,xH:()=>n});let n="--browser-compat-banner-height",r="52px",i="app-shell-banner-offset-top"},93974:(e,t,s)=>{s.d(t,{Fu:()=>x,dT:()=>c,k$:()=>u,kM:()=>d,sd:()=>m});var n=s(77066),r=s(43352),i=s(34600),a=s(68266),l=s(37152);let o="xpeak-student-chat-unread";function c(e){window.dispatchEvent(new CustomEvent(o,{detail:{unreadTotal:e}}))}function d(e){return"healthy"===e?3e5:6e4}
1function u(e){return"conversation.state.invalidated"===e.eventType&&"student"===e.payload.targetRole}let h=(0,n.createContext)(null);function m(e){let{children:t}=e,{session:s,user:c}=(0,r.As)(),[m,x]=(0,n.useState)({student:0,tutor:0}),p=(0,n.useCallback)(e=>{(0,a.OI)("student",e),x(t=>({...t,student:e}))},[]),f=(0,n.useCallback)(async()=>{if(!(null==s?void 0:s.access_token)||!c){(0,a.vQ)("student",0),x(e=>({...e,student:0}));return}try{var e;let t=await i.o5.getStudentConversationsUnreadCount();p(null!=(e=t.unread_count)?e:0)}catch(e){}},[null==s?void 0:s.access_token,c,p]);(0,n.useEffect)(()=>{f()},[f]),(0,n.useEffect)(()=>(0,a.Jl)(),[]);let g=(0,l.Pm)(),[v,b]=(0,n.useState)(()=>{var e;return null!=(e=null==g?void 0:g.getHealth())?e:null});(0,n.useEffect)(()=>g?(b(g.getHealth()),g.onHealth(b)):void b(null),[g]);let w=d(v);(0,n.useEffect)(()=>{let e=setInterval(()=>void f(),w);return()=>clearInterval(e)},[f,w]),(0,n.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&f()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[f]),(0,n.useEffect)(()=>{let e=e=>{var t;"number"==typeof(null==(t=e.detail)?void 0:t.unreadTotal)&&p(e.detail.unreadTotal)};return window.addEventListener(o,e),()=>window.removeEventListener(o,e)},[p]),(0,n.useEffect)(()=>{if(!g)return;let e=g.onInboxEvent(e=>{(0,a.mg)(e,{role:"student"}),u(e)&&f()}),t=g.onInboxReady(()=>{f()});return()=>{e(),t()}},[g,f]);let j={unreadTotal:m.student,refresh:f};return(0,n.createElement)(h.Provider,{value:j},t)}function x(){let e=(0,n.useContext)(h);return e||{unreadTotal:0,refresh:async()=>{}}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.