PageSourceSearch

https://mathheads.net/assets/ErrorAlert-DO-BiUYF.js

js mathheads.net collected 2026-10-05 21:55:57 UTC 6,280 bytes, 2 lines download raw bytes

1import{f as M,j as a,a as G,af as g,n as f,p as y,q as p,A as L,t as b,R as v,s as F,r as j,ag as O,a8 as S,a9 as R,X as d,ah as D,J as h,ai as Y,P as q,T as m,I as w,aj as N,_ as z,ak as U,Y as x,al as H,am as V,an as K}from"./index-BDS04hlE.js";import{F as Q}from"./useMultiplayerGameHistory-BQQZe5v1.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"116b6e6d4bcc8bf897c4111c3a1ba71ea9da58a0"},r._sentryModuleMetadata=r._sentryModuleMetadata||{},r._sentryModuleMetadata[new r.Error().stack]=function(t){for(var s=1;s<arguments.length;s++){var o=arguments[s];if(o!=null)for(var n in o)o.hasOwnProperty(n)&&(t[n]=o[n])}return t}({},r._sentryModuleMetadata[new r.Error().stack],{"_sentryBundlerPluginAppKey:mathheads-ui":!0});var e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="f77e6d1e-75c1-463d-8910-683d78a21142",r._sentryDebugIdIdentifier="sentry-dbid-f77e6d1e-75c1-463d-8910-683d78a21142")}catch{}})();const T=M(function(e,t){const{templateAreas:s,gap:o,rowGap:n,columnGap:l,column:c,row:i,autoFlow:A,autoRows:I,templateRows:_,autoColumns:E,templateColumns:P,...C}=e,$={display:"grid",gridTemplateAreas:s,gridGap:o,gridRowGap:n,gridColumnGap:l,gridAutoColumns:E,gridColumn:c,gridRow:i,gridAutoFlow:A,gridAutoRows:I,gridTemplateRows:_,gridTemplateColumns:P};return a.jsx(G.div,{ref:t,__css:$,...C})});T.displayName="Grid";const W=async(r,e=g.CLASSIC,t)=>{try{const s=f(e===g.SURVIVAL?`/survival/${r}/rank`:`/user/${r}/rank`,t);return await y({url:s,isPrivate:!0})}catch(s){return p(s),{ranking:"-",weeklyRanking:"-"}}},B=async r=>{try{const e=f("/user/rank",r),t=await y({url:e,isPrivate:!0,apiType:L.MULTIPLAYER});return{ranking:(t==null?void 0:t.ranking)??"-"}}catch(e){return p(e),{ranking:"-"}}};function te(r,e,t={}){const{enabled:s=!0,username:o}=t,{data:n,isInitialLoading:l,isFetching:c}=b({queryKey:e==="Multiplayer"?["rank",e,o]:["rank",e,r,o],queryFn:async()=>{if(e==="Multiplayer")return B(o);const i=e==="Survival"?g.SURVIVAL:g.CLASSIC;return W(r,i,o)},enabled:s,staleTime:v});return{ranking:n==null?void 0:n.ranking,weeklyRanking:n==null?void 0:n.weeklyRanking,isLoading:l,isFetching:c}}const se=async({statType:r,difficulty:e,aggregation:t,startUnixTime:s,endUnixTime:o,intervalSecs:n,isSurvival:l=!1,username:c})=>{try{let i=`/${l?"survival":"classic"}/game/stats?difficulty=${e}&entity=${r}&aggregation=${t}`;return s&&(i+=`&startUnixTime=${s}`),o&&(i+=`&endUnixTime=${o}`),n&&(i+=`&intervalSecs=${n}`),i=f(i,c),await y({url:i,isPrivate:!0})}catch(i){return p(i),[]}},X=async({difficulty:r,isSurvival:e=!1,username:t})=>{try{const o=f(`/${e?"survival":"classic"}/game/history?difficulty=${r}`,t);return await y({url:o,isPrivate:!0})}catch(s){return p(s),{games:[]}}};function J(r){return r.map(e=>{const{correctFirstAttempts:t}=e,o=t!==void 0&&e.score>0?`${Math.round(t/e.score*100)}%`:"—",n=O.calculateRewardXP({score:e.score,correctFirstAttempts:t??0,difficulty:e.difficulty}).total??0;return{id:e.gameId,score:String(e.score),accuracy:o,xpGained:n,playedAt:new Date(e.timestamp).toISOString()}})}function ae(r,e,{enabled:t=!0,username:s}={}){const o=e==="Survival",{data:n,isInitialLoading:l}=b({queryKey:["game-history",e,r,s],queryFn:()=>X({difficulty:r,isSurvival:o,username:s}),enabled:t,staleTime:v});return{entries:J((n==null?void 0:n.games)??[]),isLoading:l}}function ne(){const r=F();return j.useCallback((e,t,s)=>{r.removeQueries({queryKey:["game-history",e,t,s],exact:!0})},[r])}function k(r,e=!0){const t=e?Math.round(r):r;if(t<60)return`${t}s`;const s=Math.floor(t/60),o=t%60,n=Math.round(o*10)/10;return`${s}m ${n}s`}function u({icon:r,label:e,value:t,sub:s}){return a.jsxs(S,{border:"1px solid",borderColor:"gray.500",p:3,borderRadius:"lg",alignItems:"flex-start",flexGrow:1,children:[a.jsxs(R,{children:[typeof r=="string"?a.jsx(d,{children:r}):a.jsx(D,{as:r,boxSize:[4,6]}),a.jsx(d,{color:"gray.300",fontWeight:"bold",children:e})]}),a.jsx(h,{color:"white",size:"h5",children:t}),s?a.jsx(d,{color:"gray.300",fontSize:"sm",fontWeight:"semibold",w:"full",children:s}):null]})}function Z(){var n;const e=(n=Y().state)==null?void 0:n.stats,t=q(),s=()=>{t(m.TRAINING)},o=()=>{t(m.PLAY)};return j.useEffect(()=>{e||t(m.PLAY)},[e,t]),e?a.jsx(w,{h:"full",w:"full",flexGrow:"1",justifyContent:"center",children:a.jsxs(S,{spacing:[4,8],w:"full",children:[a.jsx(h,{size:"h3",children:"Training Complete!"}),a.jsxs(w,{bg:"gray.900",p:[3,5],borderRadius:"lg",w:"full",alignItems:"center",flexDir:"column",gap:"2",children:[a.jsx(d,{color:"gray.300",textTransform:"uppercase",fontWeight:"bold",children:"Result"}),a.jsxs(h,{color:"white",size:"h4",children:[e.score," problems in"," ",k(e.gameDurationInSecs)]}),a.jsxs(d,{color:"gray.300",fontWeight:"bold",children:[e.averageTimePerProblem,"s average per problem"]})]}),a.jsxs(T,{w:"full",templateColumns:["repeat(1, 1fr)","repeat(2, 1fr)"],gap:[3,6],children:[a.jsx(u,{label:"Accuracy",value:`${e.firstTryPercentage}%`,sub:`${e.firstTryCount}/${e.score} on first attempt`,icon:()=>a.jsx(N,{color:"red"})}),a.jsx(u,{label:"Fastest Time",value:`${e.fastestTime}
1s`,sub:`slowest: ${e.slowestTime}s`,icon:z}),a.jsx(u,{label:"Perfect Streak",value:e.streak,sub:"first-attempt correct in a row",icon:()=>a.jsx(Q,{color:"yellow"})}),e.fastestOperation===e.slowestOperation?a.jsx(u,{label:"Fastest Problem",value:e.fastestProblem,sub:`slowest: ${e.slowestProblem}`,icon:"🚀"}):a.jsx(u,{label:"Fastest Operation",value:e.fastestOperation,sub:`slowest: ${e.slowestOperation}`,icon:"🚀"})]}),a.jsx(U,{}),a.jsxs(R,{w:"full",justifyContent:"space-between",gap:"3",children:[a.jsx(x,{onClick:s,flex:[1,"unset"],children:"Train Again"}),a.jsx(x,{variant:"secondary",onClick:o,flex:[1,"unset"],children:"Leave"})]})]})}):null}const oe=Object.freeze(Object.defineProperty({__proto__:null,Stat:u,default:Z,formatGameDuration:k},Symbol.toStringTag,{value:"Module"}));function ie(r){return a.jsxs(H,{borderRadius:["none","md"],status:"error",...r,children:[a.jsx(V,{}),a.jsx(K,{children:"Something went wrong! Please reload the page."})]})}export{ie as E,T as G,u as S,oe as T,te as a,B as b,ae as c,k as f,se as g,ne as u};
2//# sourceMappingURL=ErrorAlert-DO-BiUYF.js.map

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.