PageSourceSearch

https://wirelingo.com/assets/AnalyticsDashboard-aP4LUyvJ.js

js wirelingo.com collected 2026-09-24 11:05:58 UTC 87,433 bytes, 1 lines download raw bytes

1import{R as w,g as Vt,r as k,j as e}from"./vendor-react-4XT1lARu.js";import{c as be,i as z,f as Se,b as M,N as Q,O as B,K as E}from"./i18n-D2s5SYoo.js";import{u as Ut,aK as Xt,co as _e,t as Y,at as Qt,au as Yt,bd as Ht,av as Jt,aG as Zt,aw as ea,e as ta,a7 as aa,o as g,v as R,am as ra,f as me,aH as Me,g as sa,a9 as xe,A as ia,w as H,V as st,bo as it,T as J,S as ye,bi as na,bj as oa,bk as la,j as nt,b1 as ot,aV as lt,ah as ct,ai as dt,aj as mt,ak as xt,al as ue,bm as ca,a8 as da,G as ma,m as xa,z as ua,x as ve,Z as pa,cv as ga}from"./index-BVK4sMpl.js";import{T as fa,a as ha,b as pe,c as ge}from"./tabs-CAN9dd7h.js";import{F as ya}from"./LockedContent-BUQyaf6R.js";import{R as ba}from"./RevisionAnalytics-D3wZ_fDE.js";import{S as va,P as ja,B as Na}from"./SageHistoryComponents-GZE0S7S3.js";import{S as $e}from"./skeleton-c6EPB6ZS.js";import{A as wa,a as Sa,b as _a}from"./avatar-PdGhGNzJ.js";import{f as K,p as ee,i as fe,D as ka,L as Ee,A as Da,a as he,b as La,c as Ca,G as Aa,g as ut,l as Pa,d as pt,e as Ta,h as Oa,R as G,X as Z,T as W,Y as je,B as Ie,C as Ma}from"./generateCategoricalChart-2KZu1iG2.js";import{A as vt,a as jt}from"./AreaChart-Dv1Vsn0a.js";import{A as Re}from"./award-CfXpwY__.js";import{B as Fe}from"./BarChart-Qt91yGq-.js";import{P as $a,a as Nt,b as wt}from"./PolarAngleAxis-Dlr1wjnd.js";import"./vendor-radix-Dw269-bE.js";import"./popover-Do544U9E.js";import"./eye-CR6l8q_5.js";import"./bot-BNbI91Jn.js";import"./index-Dh4i1-J3.js";var Ea=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function te(t){"@babel/helpers - typeof";return te=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},te(t)}function Ra(t,a){if(t==null)return{};var r=za(t,a),i,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],!(a.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function za(t,a){if(t==null)return{};var r={};for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(a.indexOf(i)>=0)continue;r[i]=t[i]}return r}function T(){return T=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},T.apply(this,arguments)}function gt(t,a){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);a&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function ae(t){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?gt(Object(r),!0).forEach(function(i){Ia(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Ia(t,a,r){return a=Fa(a),a in t?Object.defineProperty(t,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[a]=r,t}function Fa(t){var a=qa(t,"string");return te(a)=="symbol"?a:a+""}function qa(t,a){if(te(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,a||"default");if(te(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(t)}var Ba=function(a,r,i,n){var o="";return n.forEach(function(m,p){var l=ee(r,i,a,m);p?o+="L ".concat(l.x,",").concat(l.y):o+="M ".concat(l.x,",").concat(l.y)}),o+="Z",o},Ka=function(a){var r=a.cx,i=a.cy,n=a.innerRadius,o=a.outerRadius,m=a.polarAngles,p=a.radialLines;if(!m||!m.length||!p)return null;var l=ae({stroke:"#ccc"},K(a,!1));return w.createElement("g",{className:"recharts-polar-grid-angle"},m.map(function(d){var c=ee(r,i,n,d),f=ee(r,i,o,d);return w.createElement("line",T({},l,{key:"line-".concat(d),x1:c.x,y1:c.y,x2:f.x,y2:f.y}))}))},Ga=function(a){var r=a.cx,i=a.cy,n=a.radius,o=a.index,m=ae(ae({stroke:"#ccc"},K(a,!1)),{},{fill:"none"});return w.createElement("circle",T({},m,{className:be("recharts-polar-grid-concentric-circle",a.className),key:"circle-".concat(o),cx:r,cy:i,r:n}))},Wa=function(a){var r=a.radius,i=a.index,n=ae(ae({stroke:"#ccc"},K(a,!1)),{},{fill:"none"});return w.createElement("path",T({},n,{className:be("recharts-polar-grid-concentric-polygon",a.className),key:"path-".concat(i),d:Ba(r,a.cx,a.cy,a.polarAngles)}))},Va=function(a){var r=a.polarRadius,i=a.gridType;return!r||!r.length?null:w.createElement("g",{className:"recharts-polar-grid-concentric"},r.map(function(n,o){var m=o;return i==="circle"?w.createElement(Ga,T({key:m},a,{radius:n,index:o})):w.createElement(Wa,T({key:m},a,{radius:n,index:o}))}))},St=function(a){var r=a.cx,i=r===void 0?0:r,n=a.cy,o=n===void 0?0:n,m=a.innerRadius,p=m===void 0?0:m,l=a.outerRadius,d=l===void 0?0:l,c=a.gridType,f=c===void 0?"polygon":c,h=a.radialLines,v=h===void 0?!0:h,x=Ra(a,Ea);return d<=0?null:w.createElement("g",{className:"recharts-polar-grid"},w.createElement(Ka,T({cx:i,cy:o,innerRadius:p,outerRadius:d,gridType:f,radialLines:v},x)),w.createElement(Va,T({cx:i,cy:o,innerRadius:p,outerRadius:d,gridType:f,radialLines:v},x)))};St.displayName="PolarGrid";function Ua(t){return t&&t.length?t[0]:void 0}var Xa=Ua,Qa=Xa;const Ya=Vt(Qa);var Ha=["key"];function V(t){"@babel/helpers - typeof";return V=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},V(t)}function Ja(t,a){if(t==null)return{};var r=Za(t,a),i,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],!(a.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function Za(t,a){if(t==null)return{};var r={};for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(a.indexOf(i)>=0)continue;
1r[i]=t[i]}return r}function Ne(){return Ne=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Ne.apply(this,arguments)}function ft(t,a){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);a&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function D(t){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?ft(Object(r),!0).forEach(function(i){P(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ft(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function er(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function ht(t,a){for(var r=0;r<a.length;r++){var i=a[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,kt(i.key),i)}}function tr(t,a,r){return a&&ht(t.prototype,a),r&&ht(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ar(t,a,r){return a=we(a),rr(t,_t()?Reflect.construct(a,r||[],we(t).constructor):a.apply(t,r))}function rr(t,a){if(a&&(V(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sr(t)}function sr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_t=function(){return!!t})()}function we(t){return we=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},we(t)}function ir(t,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(a&&a.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),a&&qe(t,a)}function qe(t,a){return qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},qe(t,a)}function P(t,a,r){return a=kt(a),a in t?Object.defineProperty(t,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[a]=r,t}function kt(t){var a=nr(t,"string");return V(a)=="symbol"?a:a+""}function nr(t,a){if(V(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,a||"default");if(V(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(t)}var se=function(t){function a(){var r;er(this,a);for(var i=arguments.length,n=new Array(i),o=0;o<i;o++)n[o]=arguments[o];return r=ar(this,a,[].concat(n)),P(r,"state",{isAnimationFinished:!1}),P(r,"handleAnimationEnd",function(){var m=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),fe(m)&&m()}),P(r,"handleAnimationStart",function(){var m=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),fe(m)&&m()}),P(r,"handleMouseEnter",function(m){var p=r.props.onMouseEnter;p&&p(r.props,m)}),P(r,"handleMouseLeave",function(m){var p=r.props.onMouseLeave;p&&p(r.props,m)}),r}return ir(a,t),tr(a,[{key:"renderDots",value:function(i){var n=this.props,o=n.dot,m=n.dataKey,p=K(this.props,!1),l=K(o,!0),d=i.map(function(c,f){var h=D(D(D({key:"dot-".concat(f),r:3},p),l),{},{dataKey:m,cx:c.x,cy:c.y,index:f,payload:c});return a.renderDotItem(o,h)});return w.createElement(Ee,{className:"recharts-radar-dots"},d)}},{key:"renderPolygonStatically",value:function(i){var n=this.props,o=n.shape,m=n.dot,p=n.isRange,l=n.baseLinePoints,d=n.connectNulls,c;return w.isValidElement(o)?c=w.cloneElement(o,D(D({},this.props),{},{points:i})):fe(o)?c=o(D(D({},this.props),{},{points:i})):c=w.createElement($a,Ne({},K(this.props,!0),{onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,points:i,baseLinePoints:p?l:null,connectNulls:d})),w.createElement(Ee,{className:"recharts-radar-polygon"},c,m?this.renderDots(i):null)}},{key:"renderPolygonWithAnimation",value:function(){var i=this,n=this.props,o=n.points,m=n.isAnimationActive,p=n.animationBegin,l=n.animationDuration,d=n.animationEasing,c=n.animationId,f=this.state.prevPoints;return w.createElement(Da,{begin:p,duration:l,isActive:m,easing:d,from:{t:0},to:{t:1},key:"radar-".concat(c),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(h){var v=h.t,x=f&&f.length/o.length,S=o.map(function(y,b){var L=f&&f[Math.floor(b*x)];if(L){var j=he(L.x,y.x),ke=he(L.y,y.y);return D(D({},y),{},{x:j(v),y:ke(v)})}var O=he(y.cx,y.x),ie=he(y.cy,y.y);return D(D({},y),{},{x:O(v),y:ie(v)})});return i.renderPolygonStatically(S)})}},{key:"renderPolygon",value:function(){var i=this.props,n=i.points,o=i.isAnimationActive,m=i.isRange,p=this.state.prevPoints;return o&&n&&n.length&&!m&&(!p||!La(p,n))?this.renderPolygonWithAnimation():this.renderPolygonStatically(n)}},{key:"render",value:function(){var i=this.props,n=i.hide,o=i.className,m=i.points,p=i.isAnimationActive;if(n||!m||!m.length)return null;var l=this.state.isAnimationFinished,d=be("recharts-radar",o);return w.createElement(Ee,{className:d},this.renderPolygon(),(!p||l)&&Ca.renderCallByParent(this.props,m))}}],[{key:"getDerivedStateFromProps",value:function(i,n){return i.animationId!==n.prevAnimationId?{prevAnimationId:i.animationId,curPoints:i.points,prevPoints:n.curPoints}:i.points!==n.curPoints?{curPoints:i.points}:null}},{key:"renderDotItem",value:function(i,n){var o;if(w.isValidElement(i))o=w.cloneElement(i,n);else if(fe(i))o=i(n);else{var m=n.key,p=Ja(n,Ha);o=w.createElement(ka,Ne({},p,{key:m,className:be("recharts-radar-dot",typeof i!="boolean"?i.className:"")}))}return o}}])}(k.PureComponent);P(se,"displayName","Radar");P(se,"defaultProps",{angleAxisId:0,radiusAxisId:0,hide:!1,activeDot:!0,dot:!1,legendT
1ype:"rect",isAnimationActive:!Aa.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});P(se,"getComposedData",function(t){var a=t.radiusAxis,r=t.angleAxis,i=t.displayedData,n=t.dataKey,o=t.bandSize,m=r.cx,p=r.cy,l=!1,d=[],c=r.type!=="number"?o??0:0;i.forEach(function(h,v){var x=ut(h,r.dataKey,v),S=ut(h,n),y=r.scale(x)+c,b=Array.isArray(S)?Pa(S):S,L=pt(b)?void 0:a.scale(b);Array.isArray(S)&&S.length>=2&&(l=!0),d.push(D(D({},ee(m,p,L,y)),{},{name:x,value:S,cx:m,cy:p,radius:L,angle:y,payload:h}))});var f=[];return l&&d.forEach(function(h){if(Array.isArray(h.value)){var v=Ya(h.value),x=pt(v)?void 0:a.scale(v);f.push(D(D({},h),{},{radius:x},ee(m,p,x,h.angle)))}else f.push(h)}),{points:d,isRange:l,baseLinePoints:f}});var or=Ta({chartName:"RadarChart",GraphicalChild:se,axisComponents:[{axisType:"angleAxis",AxisComp:Nt},{axisType:"radiusAxis",AxisComp:wt}],formatAxisMap:Oa,defaultProps:{layout:"centric",startAngle:90,endAngle:-270,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const lr={korean:"ko-KR",japanese:"ja-JP",mandarin:"zh-CN",french:"fr-FR",spanish:"es-ES",german:"de-DE",portuguese:"pt-BR",italian:"it-IT",arabic:"ar-SA-u-ca-gregory",hindi:"hi-IN",russian:"ru-RU",dutch:"nl-NL",turkish:"tr-TR",polish:"pl-PL",swedish:"sv-SE",danish:"da-DK",norwegian:"nb-NO",finnish:"fi-FI",thai:"th-TH",vietnamese:"vi-VN",indonesian:"id-ID",english:"en-US"};function cr(t){return lr[(t??"").toLowerCase()]??"en-US"}const dr=[{value:"7d",label:"7 Days",shortLabel:"7D"},{value:"14d",label:"14 Days",shortLabel:"14D"},{value:"1m",label:"1 Month",shortLabel:"1m"},{value:"3m",label:"3 Months",shortLabel:"3m"},{value:"all",label:"All Time",shortLabel:"All"}];function Be(t){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function mr(t){const a=new Date,r=Be(a);if(t==="all")return{startDate:null,endDate:r};const i=new Date;switch(t){case"7d":i.setDate(a.getDate()-7);break;case"14d":i.setDate(a.getDate()-14);break;case"1m":i.setMonth(a.getMonth()-1);break;case"3m":i.setMonth(a.getMonth()-3);break}return{startDate:Be(i),endDate:r}}function xr(t){if(t<60)return`${t}`;const a=t/60;return a<24?a%1===0?`${a}`:`${a.toFixed(1)}`:a/24%1===0?`${a/24}`:`${(a/24).toFixed(2)}`}function ur(t,a){return t<60?a.analytics.talkMinutes:t/60<24?a.analytics.talkHours:a.analytics.talkDays}const pr={hidden:{opacity:0,y:20},visible:t=>({opacity:1,y:0,transition:{delay:t*.1,duration:.5,ease:[.25,.46,.45,.94]}})},Ke=t=>t.replace("#","");function re({value:t,suffix:a=""}){const[r,i]=k.useState(0),n=typeof t=="number"?t:parseInt(t)||0;return k.useEffect(()=>{if(typeof t!="number"){i(n);return}const o=1200,m=40,p=o/m;let l=0;const d=n/m,c=setInterval(()=>{l+=d,l>=n?(i(n),clearInterval(c)):i(Math.floor(l))},p);return()=>clearInterval(c)},[n,t]),e.jsxs(g.span,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},children:[typeof t=="number"?r.toLocaleString():t,a]})}const gr={"bg-gradient-to-br from-orange-500 to-red-500":{iconBg:"bg-gradient-to-br from-orange-500 to-red-500",iconColor:"text-white",shimmer:"from-orange-400/0 via-orange-400/10 to-orange-400/0",glowFrom:"from-orange-500/8",glowTo:"to-red-500/3",barColor:"from-orange-500 to-red-500"},"bg-gradient-to-br from-amber-500 to-yellow-600":{iconBg:"bg-gradient-to-br from-amber-500 to-yellow-600",iconColor:"text-white",shimmer:"from-amber-400/0 via-amber-400/10 to-amber-400/0",glowFrom:"from-amber-500/8",glowTo:"to-yellow-600/3",barColor:"from-amber-500 to-yellow-600"},"bg-gradient-to-br from-yellow-500 to-amber-600":{iconBg:"bg-gradient-to-br from-yellow-500 to-amber-600",iconColor:"text-white",shimmer:"from-yellow-400/0 via-yellow-400/10 to-yellow-400/0",glowFrom:"from-yellow-500/8",glowTo:"to-amber-600/3",barColor:"from-yellow-500 to-amber-600"},"bg-gradient-to-br from-emerald-500 to-teal-600":{iconBg:"bg-gradient-to-br from-emerald-500 to-teal-600",iconColor:"text-white",shimmer:"from-emerald-400/0 via-emerald-400/10 to-emerald-400/0",glowFrom:"from-emerald-500/8",glowTo:"to-teal-600/3",barColor:"from-emerald-500 to-teal-600"},"bg-gradient-to-br from-blue-500 to-indigo-600":{iconBg:"bg-gradient-to-br from-blue-500 to-indigo-600",iconColor:"text-white",shimmer:"from-blue-400/0 via-blue-400/10 to-blue-400/0",glowFrom:"from-blue-500/8",glowTo:"to-indigo-600/3",barColor:"from-blue-500 to-indigo-600"},"bg-gradient-to-br from-violet-500 to-purple-600":{iconBg:"bg-gradient-to-br from-violet-500 to-purple-600",iconColor:"text-white",shimmer:"from-violet-400/0 via-v
1iolet-400/10 to-violet-400/0",glowFrom:"from-violet-500/8",glowTo:"to-purple-600/3",barColor:"from-violet-500 to-purple-600"},"bg-gradient-to-br from-indigo-500 to-blue-600":{iconBg:"bg-gradient-to-br from-indigo-500 to-blue-600",iconColor:"text-white",shimmer:"from-indigo-400/0 via-indigo-400/10 to-indigo-400/0",glowFrom:"from-indigo-500/8",glowTo:"to-blue-600/3",barColor:"from-indigo-500 to-blue-600"},"bg-gradient-to-br from-cyan-500 to-sky-600":{iconBg:"bg-gradient-to-br from-cyan-500 to-sky-600",iconColor:"text-white",shimmer:"from-cyan-400/0 via-cyan-400/10 to-cyan-400/0",glowFrom:"from-cyan-500/8",glowTo:"to-sky-600/3",barColor:"from-cyan-500 to-sky-600"},"bg-gradient-to-br from-rose-500 to-pink-600":{iconBg:"bg-gradient-to-br from-rose-500 to-pink-600",iconColor:"text-white",shimmer:"from-rose-400/0 via-rose-400/10 to-rose-400/0",glowFrom:"from-rose-500/8",glowTo:"to-pink-600/3",barColor:"from-rose-500 to-pink-600"},"bg-gradient-to-br from-teal-500 to-emerald-600":{iconBg:"bg-gradient-to-br from-teal-500 to-emerald-600",iconColor:"text-white",shimmer:"from-teal-400/0 via-teal-400/10 to-teal-400/0",glowFrom:"from-teal-500/8",glowTo:"to-emerald-600/3",barColor:"from-teal-500 to-emerald-600"},"bg-gradient-to-br from-amber-500 to-orange-600":{iconBg:"bg-gradient-to-br from-amber-500 to-orange-600",iconColor:"text-white",shimmer:"from-amber-400/0 via-amber-400/10 to-amber-400/0",glowFrom:"from-amber-500/8",glowTo:"to-orange-600/3",barColor:"from-amber-500 to-orange-600"},"bg-gradient-to-br from-yellow-400 to-amber-500":{iconBg:"bg-gradient-to-br from-yellow-400 to-amber-500",iconColor:"text-white",shimmer:"from-yellow-400/0 via-yellow-400/10 to-yellow-400/0",glowFrom:"from-yellow-400/8",glowTo:"to-amber-500/3",barColor:"from-yellow-400 to-amber-500"},"bg-gradient-to-br from-emerald-500 to-green-600":{iconBg:"bg-gradient-to-br from-emerald-500 to-green-600",iconColor:"text-white",shimmer:"from-emerald-400/0 via-emerald-400/10 to-emerald-400/0",glowFrom:"from-emerald-500/8",glowTo:"to-green-600/3",barColor:"from-emerald-500 to-green-600"},"bg-gradient-to-br from-amber-500 to-orange-500":{iconBg:"bg-gradient-to-br from-amber-500 to-orange-500",iconColor:"text-white",shimmer:"from-amber-400/0 via-amber-400/10 to-amber-400/0",glowFrom:"from-amber-500/8",glowTo:"to-orange-500/3",barColor:"from-amber-500 to-orange-500"}},fr={iconBg:"bg-gradient-to-br from-primary to-[#5A7A6B]",iconColor:"text-white",shimmer:"from-primary/0 via-[#6B8E7B]/10 to-primary/0",glowFrom:"from-primary/8",glowTo:"to-primary/3",barColor:"from-primary to-[#5A7A6B]"};function N({title:t,value:a,subtitle:r,icon:i,gradient:n,index:o,suffix:m="",testId:p}){const l=gr[n]||fr;return e.jsx(g.div,{custom:o,initial:"hidden",animate:"visible",variants:pr,whileHover:{y:-3,transition:{duration:.25,ease:"easeOut"}},"data-testid":p,children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl p-5 bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] hover:shadow-[0_8px_30px_-5px_rgba(0,0,0,0.12),0_15px_35px_-5px_rgba(0,0,0,0.08)] transition-all duration-300 h-full group",children:[e.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${l.glowFrom} ${l.glowTo} pointer-events-none`}),e.jsx("div",{className:`absolute inset-0 bg-gradient-to-r ${l.shimmer} pointer-events-none stat-card-shimmer`}),e.jsx(g.div,{className:"absolute -top-2 -right-2 opacity-[0.04] group-hover:opacity-[0.08] transition-opacity duration-500",initial:{rotate:-10,scale:.8},animate:{rotate:0,scale:1},transition:{delay:o*.1+.3,duration:.6,ease:"easeOut"},children:e.jsx(i,{className:"w-20 h-20"})}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-3",children:[e.jsx(g.div,{className:`p-2 rounded-xl ${l.iconBg} shadow-sm`,initial:{scale:0,rotate:-20},animate:{scale:1,rotate:0},transition:{delay:o*.1+.2,duration:.5,type:"spring",stiffness:200},children:e.jsx(i,{className:`h-4 w-4 ${l.iconColor}`})}),e.jsx(g.p,{className:"text-muted-foreground text-[10px] font-semibold uppercase tracking-[0.08em]",initial:{opacity:0,x:-8}
1,animate:{opacity:1,x:0},transition:{delay:o*.1+.3,duration:.4},children:t})]}),e.jsx("h3",{className:"text-[28px] font-bold text-foreground tracking-tight leading-none",children:e.jsx(re,{value:a,suffix:m})}),r&&e.jsx(g.p,{className:"text-muted-foreground/60 text-[11px] mt-2 font-medium",initial:{opacity:0},animate:{opacity:1},transition:{delay:o*.1+.5,duration:.4},children:r}),e.jsx(g.div,{className:`h-[2px] mt-3 rounded-full bg-gradient-to-r ${l.barColor} opacity-20`,initial:{scaleX:0},animate:{scaleX:1},transition:{delay:o*.1+.6,duration:.8,ease:"easeOut"},style:{transformOrigin:"left"}})]})]})})}function hr({value:t,maxValue:a=100,size:r=100,strokeWidth:i=10,color:n="#16a34a"}){const o=(r-i)/2,m=2*Math.PI*o,p=Math.min(t/a,1),l=m*(1-p),d=Ke(n);return e.jsxs("div",{className:"relative",style:{width:r,height:r},children:[e.jsxs("svg",{width:r,height:r,className:"transform -rotate-90",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`ringGradient-${d}`,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:n}),e.jsx("stop",{offset:"100%",stopColor:`${n}88`})]})}),e.jsx("circle",{cx:r/2,cy:r/2,r:o,fill:"none",stroke:"currentColor",strokeWidth:i,className:"text-muted-foreground/30"}),e.jsx(g.circle,{cx:r/2,cy:r/2,r:o,fill:"none",stroke:`url(#ringGradient-${d})`,strokeWidth:i,strokeLinecap:"round",strokeDasharray:m,initial:{strokeDashoffset:m},animate:{strokeDashoffset:l},transition:{duration:1.5,ease:"easeOut"}})]}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs(g.span,{className:"text-xl font-bold",initial:{opacity:0}
1,animate:{opacity:1},transition:{delay:.5},children:[t,"%"]})})]})}function yr({data:t,dataKey:a,color:r="#16a34a",height:i=200,showGrid:n=!1,yAxisLabel:o}){const m=z(),{user:p}=Se(),l=_e(p==null?void 0:p.nativeLanguage),d=Ke(r);return t.length===0?e.jsx("div",{className:"flex items-center justify-center text-muted-foreground/50",style:{height:i},children:m.analytics.noDataYet}):e.jsx(G,{width:"100%",height:i,children:e.jsxs(vt,{data:t,margin:{left:10,right:10},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:`areaGradient-${d}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:r,stopOpacity:.4}),e.jsx("stop",{offset:"100%",stopColor:r,stopOpacity:0})]}),e.jsxs("linearGradient",{id:`lineGradient-${d}`,x1:"0",y1:"0",x2:"1",y2:"0",children:[e.jsx("stop",{offset:"0%",stopColor:r,stopOpacity:.8}),e.jsx("stop",{offset:"50%",stopColor:r}),e.jsx("stop",{offset:"100%",stopColor:r,stopOpacity:.8})]})]}),e.jsx(Z,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fontSize:11,fill:"#8a8a8a"},tickFormatter:c=>typeof c=="string"&&c.includes("-")?new Date(c).toLocaleDateString(l,{day:"numeric",month:"short"}):c}),e.jsx(je,{axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:"#c0c0c0"},width:35,tickFormatter:c=>`${c}${o==="Score"?"%":""}`}),e.jsx(W,{content:({active:c,payload:f,label:h})=>c&&f&&f.length?e.jsxs("div",{className:"bg-card backdrop-blur-xl border border-border rounded-xl p-3 shadow-xl shadow-black/5",children:[e.jsx("p",{className:"text-muted-foreground text-[11px] font-medium mb-1",children:typeof h=="string"&&h.includes("-")?new Date(h).toLocaleDateString(l,{month:"short",day:"numeric"}):h}),e.jsxs("p",{className:"font-bold text-foreground",style:{color:r},children:[f[0].value,o==="Score"?"%":""]})]}):null}),e.jsx(jt,{type:"monotone",dataKey:a,stroke:`url(#lineGradient-${d})`,strokeWidth:3,fill:`url(#areaGradient-${d})`,animationDuration:1500,animationEasing:"ease-out"})]})})}function ze({data:t,dataKey:a,nameKey:r,color:i="#16a34a",height:n=200,yAxisLabel:o}){const m=z(),p=Ke(i);return t.length===0?e.jsx("div",{className:"flex items-center justify-center text-muted-foreground/50",style:{height:n},children:m.analytics.noDataYet}):e.jsx(G,{width:"100%",height:n,children:e.jsxs(Fe,{data:t,margin:{left:10,right:10},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`barGradient-${p}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:i}),e.jsx("stop",{offset:"100%",stopColor:`${i}88`})]})}),e.jsx(Z,{dataKey:r,axisLine:!1,tickLine:!1,tick:{fontSize:11,fill:"#8a8a8a"}}),e.jsx(je,{axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:"#c0c0c0"},width:35,tickFormatter:l=>`${l}${o==="Score"?"%":""}`}),e.jsx(W,{content:({active:l,payload:d,label:c})=>l&&d&&d.length?e.jsxs("div",{className:"bg-card backdrop-blur-xl border border-border rounded-xl p-3 shadow-xl shadow-black/5",children:[e.jsx("p",{className:"text-muted-foreground text-[11px] font-medium capitalize mb-1",children:c}),e.jsxs("p",{className:"font-bold text-foreground",style:{color:i},children:[d[0].value,o==="Score"?"%":""]})]}):null,cursor:{fill:"rgba(107,142,123,0.06)"}}),e.jsx(Ie,{dataKey:a,fill:`url(#barGradient-${p})`,radius:[6,6,0,0],animationDuration:1200})]})})}function br({current:t,longest:a}){const r=z();return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(g.div,{className:"relative overflow-hidden rounded-xl p-4 bg-gradient-to-br from-orange-500/20 to-red-500/20",initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.3},children:[e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(g.div,{animate:{rotate:[0,10,-10,0]},transition:{repeat:1/0,duration:2},children:e.jsx(R,{className:"h-8 w-8 text-orange-500/30"})})}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-5 w-5 text-orange-500"}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:r.analytics.streakCurrentShort})]}),e.jsx("p",{className:"text-2xl font-bold text-orange-500 mt-1.5",children:e.jsx(re,{value:t})}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:r.analytics.dayStreakUnit})]})]}),e.jsxs(g.div,{className:"relative overflow-hidden rounded-xl p-4 bg-gradient-to-br from-yellow-500/20 to-amber-500/20",initial:{opacity:0,x:20}
1,animate:{opacity:1,x:0},transition:{delay:.4},children:[e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(g.div,{animate:{scale:[1,1.1,1]},transition:{repeat:1/0,duration:2},children:e.jsx(ve,{className:"h-8 w-8 text-yellow-500/30"})})}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ve,{className:"h-5 w-5 text-yellow-500"}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:r.analytics.streakBestShort})]}),e.jsx("p",{className:"text-2xl font-bold text-yellow-500 mt-1.5",children:e.jsx(re,{value:a})}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:r.analytics.dayStreakUnit})]})]})]})}const vr=t=>{const a=Math.floor(t/3600),r=Math.floor(t%3600/60);return a>0?`${a}h ${r}m`:`${r}m`},yt=["#16a34a","#3b82f6","#8b5cf6","#f97316","#ef4444","#06b6d4","#84cc16","#fbbf24"];function jr({data:t}){const a=z();return t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(ye,{className:"h-12 w-12 mb-3 text-muted-foreground/30"}),e.jsx("p",{className:"text-sm text-muted-foreground/50",children:a.analytics.completeTopicsPrompt})]}):e.jsxs("div",{className:"relative",children:[e.jsx(G,{width:"100%",height:280,children:e.jsxs(or,{cx:"50%",cy:"50%",outerRadius:"70%",data:t,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"radarGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#8b5cf6",stopOpacity:.6}),e.jsx("stop",{offset:"100%",stopColor:"#6366f1",stopOpacity:.15})]}),e.jsxs("linearGradient",{id:"radarStroke",x1:"0",y1:"0",x2:"1",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#a78bfa"}),e.jsx("stop",{offset:"100%",stopColor:"#818cf8"})]})]}),e.jsx(St,{stroke:"rgba(0,0,0,0.06)",gridType:"polygon"}),e.jsx(Nt,{dataKey:"name",tick:{fill:"#4a4a4a",fontSize:11,fontWeight:500},tickLine:!1}),e.jsx(wt,{angle:90,domain:[0,"auto"],tick:!1,axisLine:!1}),e.jsx(se,{name:"Topics",dataKey:"value",stroke:"url(#radarStroke)",strokeWidth:2,fill:"url(#radarGradient)",dot:{r:4,fill:"#8b5cf6",strokeWidth:2,stroke:"rgba(255,255,255,0.8)"},activeDot:{r:6,fill:"#a78bfa",strokeWidth:2,stroke:"rgba(255,255,255,0.8)"}}),e.jsx(W,{contentStyle:{backgroundColor:"white",border:"1px solid #f0f0f0",borderRadius:"12px",padding:"12px 16px",boxShadow:"0 4px 20px rgba(0,0,0,0.06)",color:"#1a1a1a"},formatter:r=>[`${r} ${a.analytics.topicsLessonsUnit}`,a.analytics.completedLabel],labelStyle:{fontWeight:600,marginBottom:4,color:"#4a4a4a"}})]})}),e.jsx("div",{className:"mt-6 pt-4 border-t border-border",children:e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2.5",children:t.slice(0,6).map((r,i)=>e.jsxs(g.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:i*.05},className:"flex items-center gap-2 px-3 py-2.5 rounded-lg bg-muted/40 hover:bg-muted/40 transition-colors",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:yt[i%yt.length]}}),e.jsx("span",{className:"text-xs font-medium truncate flex-1 capitalize text-foreground/70",children:r.name}),e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 shrink-0 rounded-md bg-muted text-muted-foreground font-medium",children:r.value})]},r.name))})})]})}function Nr({data:t}){if(!t||t.length===0)return e.jsx("p",{className:"text-primary text-xs text-center py-8",children:"No reading data for this period"});const a=t.map(l=>Number(l.minutes)),r=Math.max(...a,1),i=a.reduce((l,d)=>l+d,0),n=a.length>0?i/a.length:0,o=[0,Math.round(r*.25),Math.round(r*.5),Math.round(r*.75),Math.round(r)],m=[...new Set(o)].sort((l,d)=>d-l),p=t.length>14?Math.ceil(t.length/7):t.length>7?2:1;return e.jsxs("div",{"data-testid":"chart-daily-activity",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-primary"}),e.jsx("span",{className:"text-primary text-[10px]",children:"Daily reading"})]}),n>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-3 h-px border-t border-dashed border-primary/40"}),e.jsxs("span",{className:"text-primary text-[10px]",children:["Avg: ",Math.round(n),"m/day"]})]})]}),e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"flex flex-col justify-between pr-2 py-0",style:{height:128},children:m.map(l=>e.jsxs("span",{className:"text-muted-foreground text-[10px] tabular-nums leading-none",children:[l,"m"]},l))}),e.jsxs("div",{className:"flex-1 relative",children:[n>0&&e.jsx("div",{className:"absolute left-0 right-0 border-t border-dashed border-primary/20 pointer-events-none z-[1]",style:{to
1p:`${Math.max(0,100-n/r*100)}%`}}),e.jsx("div",{className:"flex items-end gap-px h-32",children:t.map((l,d)=>{const c=Number(l.minutes),f=Math.max(c/r*100,c>0?3:1),h=new Date(l.date+"T00:00:00"),v=h.toLocaleDateString("en",{month:"short",day:"numeric"}),x=h.toLocaleDateString("en",{weekday:"short"}),S=h.getDay()===0||h.getDay()===6;return e.jsxs("div",{className:"flex-1 h-full flex flex-col items-center justify-end group relative",children:[e.jsx("div",{className:`w-full rounded-t-sm transition-all duration-150 min-w-[2px] ${c===0?"bg-primary/15":S?"bg-primary/40 hover:bg-primary/60":"bg-gradient-to-t from-primary/60 to-primary hover:opacity-80"}`,style:{height:`${f}%`}}),e.jsxs("div",{className:"invisible group-hover:visible absolute -top-10 bg-card/90 text-foreground text-[11px] px-2.5 py-1.5 rounded-md whitespace-nowrap z-10 border border-primary/30 shadow-lg",children:[e.jsx("span",{className:"font-medium",children:v}),e.jsxs("span",{className:"text-primary ml-1",children:["(",x,")"]}),e.jsx("br",{}),e.jsxs("span",{className:"text-muted-foreground",children:[Math.round(c)," min"]})]})]},l.date)})}),e.jsx("div",{className:"flex mt-1.5",children:t.map((l,d)=>{const c=new Date(l.date+"T00:00:00"),f=d%p===0||d===t.length-1;return e.jsx("div",{className:"flex-1 text-center",children:f&&e.jsxs("span",{className:"text-muted-foreground/80 text-[10px] tabular-nums",children:[c.getDate(),"/",c.getMonth()+1]})},l.date)})})]})]})]})}function wr({dailyMinutes:t}){const a=z(),{user:r}=Se(),i=_e(r==null?void 0:r.nativeLanguage),n=new Date,o=[];for(let l=29;l>=0;l--){const d=new Date(n);d.setDate(d.getDate()-l);const c=Be(d),f=t.find(h=>h.date===c);o.push({date:d,minutes:(f==null?void 0:f.minutes)||0})}const m=o.filter(l=>l.minutes>0).length,p=Math.max(...o.map(l=>l.minutes),30);return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-10 gap-1.5",children:o.map(({date:l,minutes:d},c)=>{const f=d>0,h=f?Math.min(d/p,1):0,v=l.toDateString()===n.toDateString();return e.jsxs(g.div,{initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},transition:{delay:c*.015},className:"relative group",children:[e.jsxs("div",{className:`w-full aspect-square rounded-md flex items-center justify-center transition-all cursor-default ${v?"ring-2 ring-emerald-500 ring-offset-1 ring-offset-white":""}`,style:{background:f?`linear-gradient(135deg, rgba(34, 197, 94, ${.25+h*.75}), rgba(22, 163, 74, ${.3+h*.7}))`:void 0},children:[!f&&e.jsx("div",{className:"absolute inset-0 bg-muted rounded-md"}),f&&e.jsx(g.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.3+c*.015,type:"spring",stiffness:500},children:e.jsx("svg",{className:"w-3 h-3 text-white",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]}),e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-1 px-2 py-1 bg-card backdrop-blur-xl border border-border rounded-lg shadow-2xl opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10 whitespace-nowrap",children:[e.jsx("p",{className:"text-[10px] font-medium text-foreground/70",children:l.toLocaleDateString(i,{day:"numeric",month:"short"})}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:f?`${Math.round(d)} ${a.analytics.minutesSuffix}`:a.analytics.noActivity})]})]},c)})}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-3 h-3 rounded",style:{background:"rgba(34, 197, 94, 0.5)"}}),e.jsx("span",{className:"text-xs text-muted-foreground",children:a.analytics.activeLabel})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-3 h-3 rounded bg-muted"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:a.analytics.inactiveLabel})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:"text-sm font-semibold text-emerald-600",children:m}
1),e.jsxs("span",{className:"text-xs text-muted-foreground/50",children:[" ",a.analytics.outOfThirtyDays]})]})]})]})}function Sr({effortData:t}){const a=z(),{user:r}=Se(),i=_e(r==null?void 0:r.nativeLanguage),n=new Date,o=n.getMonth(),m=n.getFullYear(),p=new Date(m,o,1),l=new Date(m,o+1,0).getDate(),d=p.getDay(),c={};for(const x of t)c[x.date]={attempts:x.attempts,averageScore:x.averageScore};const f=[];for(let x=0;x<d;x++)f.push({day:null,date:null,attempts:0,averageScore:0});for(let x=1;x<=l;x++){const S=`${m}-${String(o+1).padStart(2,"0")}-${String(x).padStart(2,"0")}`,y=c[S];f.push({day:x,date:S,attempts:(y==null?void 0:y.attempts)||0,averageScore:(y==null?void 0:y.averageScore)||0})}const h=[a.howItWorks.daySun,a.howItWorks.dayMon,a.howItWorks.dayTue,a.howItWorks.dayWed,a.howItWorks.dayThu,a.howItWorks.dayFri,a.howItWorks.daySat],v=p.toLocaleDateString(i,{month:"long",year:"numeric"});return e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-center font-semibold text-sm text-foreground",children:v}),e.jsx("div",{className:"grid grid-cols-7 gap-1",children:h.map(x=>e.jsx("div",{className:"text-center text-xs font-medium text-muted-foreground/50 py-1",children:x},x))}),e.jsx("div",{className:"grid grid-cols-7 gap-1",children:f.map((x,S)=>{const y=`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`,b=x.date===y,L=x.attempts>0,j=L?Math.min(x.attempts/5,1):0;return e.jsx(g.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:S*.01},className:`relative aspect-square rounded-md flex items-center justify-center text-xs transition-all ${x.day===null?"bg-transparent":b?"ring-2 ring-emerald-500 ring-offset-1 ring-offset-white":""}`,style:{background:L?`linear-gradient(135deg, rgba(34, 197, 94, ${.2+j*.6}), rgba(22, 163, 74, ${.3+j*.7}))`:x.day!==null?"rgba(107, 142, 123, 0.08)":void 0},title:L?`${a.analytics.quizTooltipAttempts(x.attempts)} - ${a.analytics.quizTooltipAvgScore(x.averageScore)}`:void 0,children:x.day!==null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:L?"text-white font-medium":"text-muted-foreground/50",children:x.day}),L&&e.jsx("div",{className:"absolute -bottom-0.5 left-1/2 transform -translate-x-1/2",children:e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-green-400"})})]})},S)})}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border text-xs",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-3 h-3 rounded bg-green-500/30"}),e.jsx("span",{className:"text-muted-foreground",children:a.analytics.quizCalendarFew})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-3 h-3 rounded bg-green-500/70"}),e.jsx("span",{className:"text-muted-foreground",children:a.analytics.quizCalendarMany})]})]}),e.jsxs("div",{className:"text-muted-foreground",children:[t.length," ",a.analytics.activeDaysLabel]})]})]})}function bt({value:t,className:a}){const[r,i]=k.useState(0),n=k.useRef(null);return k.useEffect(()=>{var o;return(o=n.current)==null||o.stop(),n.current=ga(r,t,{duration:1.4,ease:"easeOut",onUpdate:m=>i(Math.round(m))}),()=>{var m;return(m=n.current)==null?void 0:m.stop()}},[t]),e.jsx("span",{className:a,children:r.toLocaleString()})}function Wr(){var Ye,He,Je,Ze,et,tt,at,rt;const t=z(),[,a]=Ut(),{user:r}=Se(),{hideAiFeatures:i}=Xt(),n=_e(r==null?void 0:r.nativeLanguage),[o,m]=k.useState("1m"),p={"7d":t.analytics.period7Days,"14d":t.analytics.period14Days,"1m":t.analytics.period1Month,"3m":t.analytics.period3Months,all:t.analytics.periodAllTime},l={"7d":t.analytics.period7DaysShort,"14d":t.analytics.period14DaysShort,"1m":t.analytics.period1MonthShort,"3m":t.analytics.period3MonthsShort,all:t.analytics.periodAllTimeShort},d=k.useMemo(()=>mr(o),[o]),{data:c,isLoading:f,error:h}=M({queryKey:["/api/user/analytics",{period:o}],queryFn:async()=>{const s=new URLSearchParams;d.startDate&&s.set("startDate",d.startDate),s.set("endDate",d.endDate);const u=await fetch(`/api/user/analytics?${s.toString()}`,{credentials:"include"});if(!u.ok){if((await u.json().catch(()=>({}))).requiresEmailVerification){const A=new Error("Email verification required");throw A.requiresEmailVerification=!0,A}throw new Error("Failed to fetch analytics")}return u.json()},staleTime:0,refetchOnMount:"always",placeholderData:E}),v=h&&(h==null?void 0:h.requiresEmailVerification),{data:x,isLoading:S}=M({queryKey:["/api/quiz/stats",{period:o}],queryFn:async()=>{const s=new URLSearchParams;d.startDate&&s.set("startDate",d.startDate),s.set("endDate",d.endDate);const u=await fetch(`/api/quiz/stats?${s.toString()}`,{credentials:"include"});if(!u.ok)throw new Error("Failed to fetch quiz stats");return u.json()},staleTime:0,refetchOnMount:"always",placeholderData:E}),{data:y}=M({queryKey:["/api/user/pronunciation-stats"],staleTime:0,refetchOnMount:"always",placeholderData:E}),{data:b,isLoading:L}=M({queryKey:["/api/video-call/stats",{period:o}],queryFn:async()=>{const s=new URLSearchParams;d.startDate&&s.set("startDate",d.startDate),s.set("endDate",d.endDate);const u=await fetch(`/api/video-call/stats?${s.toString()}`,{credentials:"include"});if(!u.ok)throw new Error("Failed to fetch sage stats");return u.json()},enabled:!i,staleTime:0,refetchOnMount:"always",placeholderData:E}),{data:j}=M({queryKey:["/api/xp/summary",{period:o}],queryFn:async()=>{const s=new URLSearchParams;d.startDate&&s.set("startDate",d.startDate),s.set("endDate",d.endDate);const u=await fetch(`/api/xp/summary?${s.toString()}`,{credentials:"include"});if(!u.ok)throw new Error("Failed to fetch XP data");return u.json()},staleTime:0,refetchOnMount:"always",placeholderData:E}),{data:ke=[]}=M({queryKey:["/api/video-call/sessions",{limit:200,offset:0,page:"analytics"}],queryFn:async()=>{const s=await fetch("/api/video-call/sessions?limit=200&offset=0");if(!s.ok)throw new Error("Failed to fetch sessions");return s.json()},enabled:!i,staleTime:0,refetchOnMount:"always"}),{data:O}=M({queryKey:["/api/xp/timeline",{period:o}],queryFn:async()=>{const s=new URLSearchParams;d.startDate&&s.set("startDate",d.startDate),s.set("endDate",d.endDate);const u=await fetch(`/api/xp/timeline?${s.toString()}`,{credentials:"include"});if(!u.ok)throw new Error("Failed to fetch XP timeline");return u.json()},staleTime:6e4,placeholderData:E}),{data:ie}=M({queryKey:["/api/active-users-count"],refetchInterval:6e4,staleTime:3e4,placeholderData:E}),[C,Dt]=k.useState(null),[ne,De]=k.useState("reading");k.useEffect(()=>{i&&ne==="sage"&&De("reading")},[i,ne]);const[U,Le]=k.useState(""),[oe,Ge]=k.useState("all"),[le,We]=k.useState("all"),[Ce,X]=k.useState(12),I=12,Lt=r&&(`${(r.firstName||"")[0]||""}${(r.lastName||"")[0]||""}`.toUpperCase()||((He=(Ye=r.username)==null?void 0:Ye[0])==null?void 0:He.toUpperCase()))||"U",Ve=r&&(`${r.firstName||""} ${r.lastName||""}
1`.trim()||r.username)||"",Ct=new Date().toLocaleString(cr(r==null?void 0:r.nativeLanguage),{month:"long"}),At=((Je=j==null?void 0:j.allTime)==null?void 0:Je.total)??0,Ue=((et=(Ze=j==null?void 0:j.periods)==null?void 0:Ze.month)==null?void 0:et.total)??0,F=k.useMemo(()=>{var _;if(!((_=O==null?void 0:O.timeline)!=null&&_.length))return[];const s=O.timeline;if(s.length<=60)return s;const u=Math.ceil(s.length/60);return s.filter((A,de)=>de%u===0||de===s.length-1)},[O]);if(v)return e.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-xl bg-gradient-to-br from-primary/20 to-emerald-500/20",children:e.jsx(Y,{className:"h-6 w-6 text-primary"})}),e.jsx("h1",{className:"text-3xl font-bold",children:t.analytics.pageTitle})]}),e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsxs(Qt,{className:"w-full max-w-md",children:[e.jsxs(Yt,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 h-14 w-14 rounded-full bg-muted flex items-center justify-center",children:e.jsx(Ht,{className:"h-7 w-7 text-muted-foreground/50"})}),e.jsx(Jt,{children:t.analytics.verifyEmailTitle}),e.jsx(Zt,{children:t.analytics.verifyEmailDescription})]}),e.jsx(ea,{className:"flex justify-center",children:e.jsxs(ta,{onClick:()=>a("/settings"),"data-testid":"button-verify-email",children:[e.jsx(aa,{className:"h-4 w-4 mr-2"}),t.analytics.verifyEmailButton]})})]})})]});if(f)return e.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-xl bg-gradient-to-br from-primary/20 to-emerald-500/20",children:e.jsx(Y,{className:"h-6 w-6 text-primary"})}),e.jsx("h1",{className:"text-3xl font-bold",children:t.analytics.pageTitle})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[1,2,3,4].map(s=>e.jsx($e,{className:"h-32 rounded-2xl"},s))})]});if(!c)return e.jsx("div",{className:"container mx-auto p-6",children:e.jsx("p",{className:"text-muted-foreground/50",children:t.analytics.noAnalyticsData})});const Pt={beginner:"#22c55e","upper beginner":"#84cc16",intermediate:"#3b82f6","upper intermediate":"#8b5cf6",advanced:"#f97316",native:"#ef4444"},Ae=Object.entries(c.articlesPerLevel).map(([s,u])=>({level:Q(s,t),count:u,fill:Pt[s.replace("-"," ")]||"#3b82f6"})),Pe=Object.entries(c.timePerLanguage).map(([s,u])=>({language:B(s,t),minutes:Math.round(u/60)})).filter(s=>s.minutes>0),Tt=Pe.length>=2&&Pe.reduce((s,u)=>s+u.minutes,0)>=10,Xe={technology:"technology",politics:"politics",space:"space",business:"business","weird-interesting":"weirdInteresting",culture:"culture",science:"science","global-security":"globalSecurity","health-and-medicine":"healthMedicine","environment-and-climate":"environment","energy-and-resources":"energy","transport-and-infrastructure":"transport","economics-and-markets":"economics","law-and-justice":"lawJustice","sports-and-entertainment":"sports",nature:"nature",other:"other",health:"healthMedicine","health-medicine":"healthMedicine",environment:"environment",energy:"energy",transport:"transport",economics:"economics","law-justice":"lawJustice",sports:"sports"},ce=Object.entries(c.topicsDistribution).map(([s,u])=>({name:Xe[s]?t.nav.topics[Xe[s]]:s.replace(/-/g," "),value:u})).sort((s,u)=>u.value-s.value),Ot=ce.length>0?ce[0].value:10;ce.slice(0,8);const Mt=ce.slice(0,5).map(s=>({...s,fullMark:Ot})),$t=[...new Set(c.articleCompletionTimes.map(s=>s.language))].sort(),Et=[...new Set(c.articleCompletionTimes.map(s=>s.level))].sort();let $=[...c.articleCompletionTimes];if(U.trim()){const s=U.toLowerCase();$=$.filter(u=>u.title.toLowerCase().includes(s)||u.englishTitle.toLowerCase().includes(s))}oe!=="all"&&($=$.filter(s=>s.language===oe)),le!=="all"&&($=$.filter(s=>s.level===le));let Te=[...$];C&&Te.sort((s,u)=>{const _=s[C.key],A=u[C.key];return _==null||A==null?0:_<A?C.direction==="asc"?-1:1:_>A?C.direction==="asc"?1:-1:0});const q=Te.length,Oe=Te.slice(0,Ce),Rt=Ce<q,zt=()=>{X(s=>s+I)},Qe=()=>{Le(""),Ge("all"),We("all"),X(I)},It=s=>{Dt(u=>
1(u==null?void 0:u.key)===s?{key:s,direction:u.direction==="asc"?"desc":"asc"}:{key:s,direction:"asc"})},Ft=x?Object.entries(x.byLevel).map(([s,u])=>({level:Q(s,t),attempts:u.attempts,avgScore:Math.round(u.averageScore)})):[],qt=x?Object.entries(x.byLanguage).map(([s,u])=>({language:B(s,t),attempts:u.attempts,avgScore:Math.round(u.averageScore)})):[],Bt=(x==null?void 0:x.scoreHistory.slice(0,20).map(s=>({date:s.date,score:Math.round(s.score)})).reverse())||[],Kt=c.dailyMinutes.map(s=>({date:s.date,minutes:Math.round(s.minutes)}));return e.jsx(ya,{feature:"progress",children:e.jsx("div",{className:"min-h-screen bg-background","data-testid":"analytics-dashboard",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 pt-6 pb-8 space-y-6",children:[e.jsxs(g.div,{className:"relative overflow-hidden rounded-2xl bg-gradient-to-r from-[#E8F3EE] to-[#D4E8DD] dark:from-[#1b2e22] dark:to-[#162619] shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)]",initial:{opacity:0,y:-10},animate:{opacity:1,y:0},transition:{duration:.5},children:[e.jsxs("div",{className:"absolute inset-0 opacity-20",children:[e.jsx("div",{className:"absolute top-0 right-0 w-96 h-96 bg-primary/8 rounded-full blur-3xl -translate-y-1/2 translate-x-1/3"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-64 h-64 bg-primary/10 rounded-full blur-3xl translate-y-1/3 -translate-x-1/4"})]}),e.jsxs("div",{className:"relative px-6 py-6 sm:px-8 sm:py-8",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-6",children:[e.jsxs("div",{className:"flex items-start gap-5",children:[e.jsx(g.div,{initial:{scale:.8,opacity:0}
1,animate:{scale:1,opacity:1},transition:{delay:.1,type:"spring",stiffness:200},children:e.jsxs("div",{className:"relative",children:[e.jsxs(wa,{className:"h-16 w-16 border-2 border-white","data-testid":"avatar-user",children:[(r==null?void 0:r.profileImageUrl)&&e.jsx(Sa,{src:r.profileImageUrl,alt:Ve,className:"object-cover"}),e.jsx(_a,{className:"bg-gradient-to-br from-emerald-400 to-teal-500 text-white text-lg font-semibold",children:Lt})]}),e.jsx("div",{className:"absolute -bottom-1 -right-1 h-5 w-5 rounded-full bg-emerald-500 border-2 border-white flex items-center justify-center",children:e.jsx(Y,{className:"h-2.5 w-2.5 text-white"})})]})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(g.h1,{className:"text-xl sm:text-2xl font-bold text-foreground truncate",initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:.15},"data-testid":"text-user-name",children:Ve}),e.jsx(g.p,{className:"text-sm text-muted-foreground mt-0.5",initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:t.analytics.learningProgress}),e.jsxs(g.div,{className:"flex items-center gap-4 mt-3 flex-wrap",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:.25},children:[e.jsxs("div",{className:"flex flex-col","data-testid":"total-xp-display",children:[e.jsx("span",{className:"text-2xl sm:text-3xl font-bold bg-gradient-to-r from-primary to-[#3D5447] dark:to-primary/70 bg-clip-text text-transparent leading-none",children:e.jsx(bt,{value:At})}),e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium uppercase tracking-wider mt-1",children:t.analytics.totalXp})]}),e.jsx("div",{className:"w-px h-10 bg-black/10 dark:bg-white/15"}),e.jsxs("div",{className:"flex flex-col","data-testid":"month-xp-display",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[Ue>200&&e.jsx(R,{className:"h-4 w-4 text-orange-400 flex-shrink-0"}),e.jsx("span",{className:"text-2xl sm:text-3xl font-bold text-primary leading-none",children:e.jsx(bt,{value:Ue})})]}),e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium uppercase tracking-wider mt-1",children:Ct})]})]})]})]}),e.jsxs(g.div,{className:"flex flex-col items-start lg:items-end gap-3 w-full lg:w-auto",initial:{opacity:0,x:10},animate:{opacity:1,x:0},transition:{delay:.2},children:[e.jsx("div",{className:"grid grid-cols-5 w-full gap-0.5 p-1 rounded-xl bg-muted border border-transparent","data-testid":"date-range-selector",children:dr.map(s=>e.jsxs("button",{onClick:()=>m(s.value),className:`py-1.5 text-xs font-medium rounded-lg transition-all duration-200 text-center truncate px-1 ${o===s.value?"bg-card text-foreground shadow-[0_1px_3px_rgba(0,0,0,0.1)]":"text-muted-foreground hover:text-foreground/70"}`,"data-testid":`button-period-${s.value}`,children:[e.jsx("span",{className:"sm:hidden",children:l[s.value]}),e.jsx("span",{className:"hidden sm:inline",children:p[s.value]})]},s.value))}),ie&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-muted/40","data-testid":"active-learners-badge",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-400"})]}),e.jsxs("span",{className:"text-xs text-foreground/70",children:[ie.count.toLocaleString()," ",t.analytics.activeNow]})]})]})]}),!O&&e.jsxs("div",{className:"mt-6 -mx-2",children:[e.jsx("div",{className:"flex items-center justify-between mb-2 px-2",children:e.jsx("span",{className:"text-[11px] text-muted-foreground/50 font-medium uppercase tracking-wider",children:t.analytics.cumulativeXp})}),e.jsx("div",{className:"h-[120px] flex items-center justify-center",children:e.jsx(ra,{className:"h-5 w-5 text-muted-foreground/50 animate-spin"})})]}),F.length>2&&e.jsxs("div",{className:"mt-6 -mx-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 px-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground/50 font-medium uppercase tracking-wider",children:t.analytics.cumulativeXp}
1),e.jsx("span",{className:"text-[11px] text-muted-foreground/50 transition-opacity duration-300",children:F.length>0?`${F[0].date.slice(5)} - ${F[F.length-1].date.slice(5)}`:""})]}),e.jsx("div",{className:"h-[120px]",children:e.jsx(G,{width:"100%",height:"100%",children:e.jsxs(vt,{data:F,margin:{top:4,right:4,bottom:0,left:4},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"xpCumulativeGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#22c55e",stopOpacity:.4}),e.jsx("stop",{offset:"50%",stopColor:"#22c55e",stopOpacity:.1}),e.jsx("stop",{offset:"100%",stopColor:"#22c55e",stopOpacity:0})]})}),e.jsx(Z,{dataKey:"date",hide:!0}),e.jsx(jt,{type:"monotone",dataKey:"cumulative",stroke:"#16a34a",strokeWidth:2.5,fill:"url(#xpCumulativeGradient)",dot:!1,isAnimationActive:!0,animationDuration:800,animationEasing:"ease-in-out"}),e.jsx(W,{content:({active:s,payload:u})=>{if(s&&u&&u.length){const _=u[0].payload,[A,de,Gt]=_.date.split("-").map(Number),Wt=new Date(A,de-1,Gt).toLocaleDateString(n,{month:"short",day:"numeric"});return e.jsxs("div",{className:"bg-card backdrop-blur-xl border border-border rounded-xl p-3 shadow-xl shadow-black/5","data-testid":"xp-tooltip",children:[e.jsx("p",{className:"text-muted-foreground text-[11px] font-medium mb-1",children:Wt}),e.jsx("p",{className:"font-bold text-foreground",children:t.analytics.xpTooltipTotal(_.cumulative.toLocaleString())}),_.daily>0&&e.jsx("p",{className:"text-muted-foreground text-[11px] mt-0.5",children:t.analytics.xpTooltipDaily(_.daily.toLocaleString())})]})}return null}})]})})})]})]})]}),e.jsxs(fa,{value:ne,onValueChange:De,className:"space-y-6",children:[e.jsx("div",{className:"flex items-center gap-1.5 p-1.5 bg-muted rounded-2xl max-w-2xl border border-transparent",children:[{value:"reading",icon:me,label:t.analytics.tabReading},{value:"sage",icon:Me,label:t.analytics.tabSage},{value:"revision",icon:sa,label:t.analytics.tabRevision},{value:"quizzes",icon:xe,label:t.analytics.tabQuizzes}].filter(s=>!(s.value==="sage"&&i)).map(s=>{const u=ne===s.value;return e.jsxs("button",{onClick:()=>De(s.value),className:`flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-xl transition-all duration-300 flex-1 justify-center ${u?"bg-card text-foreground shadow-[0_1px_3px_rgba(0,0,0,0.1)]":"text-muted-foreground hover:text-foreground/70"}`,"data-testid":`tab-${s.value}`,children:[e.jsx(s.icon,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:s.label})]},s.value)})}),e.jsxs(ha,{className:"hidden",children:[e.jsx(pe,{value:"reading"}),e.jsx(pe,{value:"sage"}),e.jsx(pe,{value:"revision"}),e.jsx(pe,{value:"quizzes"})]}),e.jsxs(ia,{mode:"wait",children:[e.jsxs(ge,{value:"reading",className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-4",children:[e.jsx(N,{title:t.analytics.currentStreakLabel,value:c.currentStreak,suffix:c.currentStreak===1?` ${t.revision.dayLabel}`:` ${t.revision.daysLabel}`,subtitle:`${t.revision.best}: ${c.longestStreak} ${c.longestStreak===1?t.revision.dayLabel:t.revision.daysLabel}`,icon:R,gradient:"bg-gradient-to-br from-orange-500 to-red-500",index:0,testId:"stat-current-streak"}),j&&e.jsx(N,{title:t.analytics.readingXp,value:((tt=j.customRange)==null?void 0:tt.reading)??j.allTime.reading,subtitle:t.analytics.readingXpSubtitle,icon:Re,gradient:"bg-gradient-to-br from-amber-500 to-yellow-600",index:1,testId:"stat-reading-xp"}),e.jsx(N,{title:t.analytics.lessonsRead,value:c.totalArticlesRead,subtitle:t.analytics.lessonsReadSubtitle,icon:me,gradient:"bg-gradient-to-br from-emerald-500 to-teal-600",index:2,testId:"stat-total-articles"}),e.jsx(N,{title:t.analytics.minutesRead,value:Math.round(c.totalMinutesRead),subtitle:t.analytics.totalReadingTime,icon:H,gradient:"bg-gradient-to-br from-blue-500 to-indigo-600",index:3,testId:"stat-total-minutes"}),e.jsx(N,{title:t.analytics.audioPlays,value:(y==null?void 0:y.totalPlays)||0,subtitle:t.analytics.audioPlaysSubtitle,icon:st,gradient:"bg-gradient-to-br from-violet-500 to-purple-600",index:4,testId:"stat-audio-plays"})]}),c.totalArticlesRead<3&&e.jsxs(g.div,{initial:{opacity:0,y:10}
1,animate:{opacity:1,y:0},transition:{delay:.5},className:"flex items-start gap-3 p-4 rounded-xl bg-gradient-to-r from-[#f5f5f7] to-[#f5f5f7] border border-transparent shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07)]","data-testid":"tip-complete-articles",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 shrink-0",children:e.jsx(it,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground/70",children:t.analytics.tipTitle}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.analytics.tipBody})]})]}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(Y,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.dailyActivity}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.readingMinutesOverTime})]})]}),e.jsx(Nr,{data:Kt})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-5",children:[e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.5},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6 h-full",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(J,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.lessonsByLevel}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.distributionByProficiency})]})]}),Ae.length===0?e.jsx("div",{className:"flex items-center justify-center text-muted-foreground/50",style:{height:220},children:t.analytics.noDataYet}):e.jsx(G,{width:"100%",height:220,children:e.jsxs(Fe,{data:Ae,margin:{left:10,right:10},children:[e.jsx(Z,{dataKey:"level",axisLine:!1,tickLine:!1,tick:{fontSize:11,fill:"#8a8a8a"}}),e.jsx(je,{axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:"#c0c0c0"},width:35,allowDecimals:!1}),e.jsx(W,{content:({active:s,payload:u,label:_})=>s&&u&&u.length?e.jsxs("div",{className:"bg-card backdrop-blur-xl border border-border rounded-xl p-3 shadow-xl shadow-black/5",children:[e.jsx("p",{className:"text-muted-foreground text-[11px] font-medium capitalize mb-1",children:_}),e.jsx("p",{className:"font-bold",style:{color:u[0].payload.fill},children:u[0].value})]}):null,cursor:{fill:"rgba(107,142,123,0.06)"}}),e.jsx(Ie,{dataKey:"count",radius:[6,6,0,0],animationDuration:1200,children:Ae.map((s,u)=>e.jsx(Ma,{fill:s.fill,fillOpacity:.85},u))})]})})]})}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.6},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6 h-full",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(ye,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.top5Topics}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.readingInterests})]})]}),e.jsx(jr,{data:Mt})]})})]}),Tt&&e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.7},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(H,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.timeByLanguage}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.minutesPerLanguage})]})]}),e.jsx(ze,{data:Pe,dataKey:"minutes",nameKey:"language",color:"#f97316",height:220})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-5",children:[e.jsx(g.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:.8},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6 h-full",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(me,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.thirtyDayActivity}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.readingConsistency})]})]}),e.jsx(wr,{dailyMinutes:c.dailyMinutes})]})}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.85},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6 h-full",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-5",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(R,{className:"h-4 w-4 text-orange-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.streaksAudio}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.keepMomentum})]})]}),e.jsxs(na,{children:[e.jsx(oa,{asChild:!0,children:e.jsx("button",{className:"p-1.5 rounded-lg text-muted-foreground/50 hover:text-foreground/70 hover:bg-muted transition-colors","aria-label":t.analytics.streakInfoAriaLabel,"data-testid":"button-streak-info",children:e.jsx(it,{className:"h-4 w-4"})})}),e.jsx(la,{side:"left",className:"max-w-[250px]",children:e.jsx("p",{className:"text-sm",children:t.analytics.streakInfoTooltip})})]})]}),e.jsx(br,{current:c.currentStreak,longest:c.longestStreak}),e.jsxs("div",{className:"mt-4 pt-4 border-t border-border",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10",children:e.jsx(st,{className:"h-3.5 w-3.5 text-primary"})}),e.jsx("span",{className:"text-sm text-muted-foreground",children:t.analytics.audioPlaysLabel})]}),e.jsx("span",{className:"text-lg font-bold text-primary",children:e.jsx(re,{value:(y==null?void 0:y.totalPlays)||0})})]}),y&&Object.keys(y.byLanguage).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:Object.entries(y.byLanguage).slice(0,4).map(([s,u])=>e.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-md bg-muted text-muted-foreground",children:[B(s,t),": ",u]},s))})]})]})})]}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:1},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)]",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(nt,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.lessonDetails}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:q===c.articleCompletionTimes.length?t.analytics.completedLessonsCount(q):t.analytics.filteredLessonsCount(q,c.articleCompletionTimes.length)})]})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{key:"completedAt",label:t.analytics.sortDate},{key:"timeToComplete",label:t.analytics.sortTime},{key:"language",label:t.analytics.sortLanguage},{key:"level",label:t.analytics.sortLevel}].map(s=>e.jsxs("button",{onClick:()=>It(s.key),className:`px-3 py-1.5 text-xs font-medium rounded-lg transition-all ${(C==null?void 0:C.key)===s.key?"bg-foreground text-white":"text-muted-foreground hover:text-foreground
1/70 bg-muted hover:bg-muted/80"}`,"data-testid":`sort-${s.key}`,children:[s.label,(C==null?void 0:C.key)===s.key&&e.jsx("span",{className:"ml-1",children:C.direction==="asc"?"↑":"↓"})]},s.key))})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ot,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground/50"}),e.jsx("input",{placeholder:t.analytics.searchLessonsPlaceholder,value:U,onChange:s=>{Le(s.target.value),X(I)},className:"w-full pl-9 pr-9 py-2 text-sm bg-muted border border-transparent rounded-xl text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-1 focus:ring-[#6B8E7B]/30","data-testid":"input-article-search"}),U&&e.jsx("button",{onClick:()=>Le(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground/50 hover:text-foreground/70","data-testid":"button-clear-search",children:e.jsx(lt,{className:"h-4 w-4"})})]}),e.jsxs(ct,{value:oe,onValueChange:s=>{Ge(s),X(I)},children:[e.jsx(dt,{className:"w-full sm:w-[140px] bg-muted border-transparent text-foreground/70 rounded-xl","data-testid":"select-language-filter",children:e.jsx(mt,{placeholder:t.analytics.languagePlaceholder})}),e.jsxs(xt,{children:[e.jsx(ue,{value:"all",children:t.analytics.allLanguages}),$t.map(s=>e.jsx(ue,{value:s,children:B(s,t)},s))]})]}),e.jsxs(ct,{value:le,onValueChange:s=>{We(s),X(I)},children:[e.jsx(dt,{className:"w-full sm:w-[140px] bg-muted border-transparent text-foreground/70 rounded-xl","data-testid":"select-level-filter",children:e.jsx(mt,{placeholder:t.analytics.levelPlaceholder})}),e.jsxs(xt,{children:[e.jsx(ue,{value:"all",children:t.analytics.allLevels}),Et.map(s=>e.jsx(ue,{value:s,children:Q(s,t)},s))]})]}),(U||oe!=="all"||le!=="all")&&e.jsxs("button",{onClick:Qe,className:"px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground/70 bg-muted hover:bg-muted/80 rounded-xl whitespace-nowrap transition-all","data-testid":"button-clear-filters",children:[e.jsx(lt,{className:"h-3 w-3 mr-1 inline"}),t.analytics.clearLabel]})]})]}),e.jsxs("div",{className:"px-6 pb-6",children:[c.articleCompletionTimes.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(g.div,{animate:{y:[-5,5,-5]},transition:{repeat:1/0,duration:3},children:e.jsx(nt,{className:"h-12 w-12 mb-4 text-muted-foreground/30"})}),e.jsx("p",{className:"text-base font-medium text-foreground/70",children:t.analytics.noCompletedLessons}),e.jsx("p",{className:"text-sm text-center max-w-sm mt-1 text-muted-foreground/50",children:t.analytics.startReadingPrompt})]}):Oe.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(ot,{className:"h-12 w-12 mb-4 text-muted-foreground/30"}),e.jsx("p",{className:"text-sm font-medium text-foreground/70",children:t.analytics.noMatchingLessons}),e.jsx("p",{className:"text-xs text-muted-foreground/50 text-center max-w-sm mt-1",children:t.analytics.tryAdjustingFilters}),e.jsx("button",{onClick:Qe,className:"mt-4 px-4 py-2 text-xs font-medium text-muted-foreground bg-muted hover:bg-muted/80 rounded-xl transition-all","data-testid":"button-clear-filters-empty",children:t.analytics.clearFilters})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Oe.map((s,u)=>e.jsxs(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:u*.05,duration:.4},whileHover:{y:-3},className:"group relative overflow-hidden rounded-xl bg-card border border-transparent shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07)] transition-all duration-300 hover:shadow-[0_4px_25px_-5px_rgba(0,0,0,0.1)]",children:[e.jsxs("div",{className:"relative h-32 overflow-hidden bg-muted",children:[s.imageUrl?e.jsx("img",{src:s.imageUrl,alt:s.englishTitle,className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105",loading:"lazy"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-[#f5f5f7] to-[#ebebeb]",children:e.jsx(me,{className:"h-8 w-8 text-muted-foreground
1/30"})}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-black/20 to-transparent"}),e.jsx("div",{className:"absolute top-2 left-2",children:e.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold rounded-md bg-card/90 text-card-foreground backdrop-blur-sm",children:B(s.language,t)})}),e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx("span",{className:"px-2 py-0.5 text-[10px] font-medium rounded-md bg-emerald-500/80 text-white backdrop-blur-sm",children:Q(s.level,t)})}),e.jsxs("div",{className:"absolute bottom-2 right-2 flex items-center gap-1 px-2 py-1 rounded-lg bg-black/50 backdrop-blur-sm",children:[e.jsx(H,{className:"h-3 w-3 text-white/70"}),e.jsx("span",{className:"text-[11px] font-medium text-white/90",children:vr(s.timeToComplete)})]})]}),e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"font-semibold text-sm line-clamp-2 leading-snug mb-1 text-foreground",children:s.title}),e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 mb-3",children:s.englishTitle}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400"}),e.jsx("span",{children:t.analytics.completedLabel})]}),e.jsx("span",{className:"text-muted-foreground/50",children:"·"}),e.jsx("span",{children:new Date(s.completedAt).toLocaleDateString(n,{day:"numeric",month:"short",year:"numeric"})})]})]})]},s.articleId))}),Rt&&e.jsxs("div",{className:"flex flex-col items-center mt-6 pt-6 border-t border-border",children:[e.jsx("p",{className:"text-xs text-muted-foreground/50 mb-3",children:t.analytics.showingOf(Oe.length,q)}),e.jsxs("button",{onClick:zt,className:"flex items-center gap-2 px-5 py-2.5 text-sm font-medium text-foreground/70 bg-muted hover:bg-muted/80 rounded-xl transition-all","data-testid":"button-load-more",children:[e.jsx(ca,{className:"h-4 w-4"}),t.analytics.loadMore(Math.min(I,q-Ce))]})]})]})]})})]},"reading"),e.jsx(ge,{value:"sage",className:"space-y-6",children:i?null:L?e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[1,2,3,4].map(s=>e.jsx($e,{className:"h-32 rounded-2xl bg-muted"},s))}):!b||b.totalSessions===0?e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:e.jsx("div",{className:"relative overflow-hidden rounded-2xl bg-card/80 backdrop-blur-xl border border-dashed border-border p-16",children:e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx(g.div,{animate:{y:[-5,5,-5]},transition:{repeat:1/0,duration:3},children:e.jsx(Me,{className:"h-16 w-16 mb-4 text-muted-foreground/30"})}),e.jsx("p",{className:"text-base font-medium text-foreground/70 mb-2",children:t.analytics.noSageConversations}),e.jsx("p",{className:"text-sm text-muted-foreground/50 text-center max-w-sm",children:t.analytics.startSagePrompt})]})})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(Me,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.thirtyDayActivity}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.conversationConsistency})]})]}),e.jsx(va,{sessions:ke})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-4",children:[e.jsx(N,{title:t.analytics.currentStreakLabel,value:b.currentStreak,suffix:b.currentStreak===1?` ${t.revision.dayLabel}`:` ${t.revision.daysLabel}`,subtitle:`${t.revision.best}: ${b.longestStreak} ${b.longestStreak===1?t.revision.dayLabel:t.revision.daysLabel}`,icon:R,gradient:"bg-gradient-to-br from-orange-500 to-red-500",index:0,testId:"stat-sage-streak"}),j&&e.jsx(N,{title:t.analytics.sageXp,value:((at=j.customRange)==null?void 0:at.sage)??j.allTime.sage,
1subtitle:t.analytics.sageXpSubtitle,icon:Re,gradient:"bg-gradient-to-br from-yellow-500 to-amber-600",index:1,testId:"stat-sage-xp"}),e.jsx(N,{title:t.analytics.conversations,value:b.totalSessions,subtitle:`${b.completedSessions} ${t.analytics.completedSuffix}`,icon:da,gradient:"bg-gradient-to-br from-blue-500 to-indigo-600",index:2,testId:"stat-sage-sessions"}),e.jsx(N,{title:`${t.analytics.talkPrefix} ${ur(b.totalMinutes,t)}`,value:xr(b.totalMinutes),subtitle:t.analytics.totalConversationTime,icon:H,gradient:"bg-gradient-to-br from-emerald-500 to-teal-600",index:3,testId:"stat-sage-time"}),e.jsx(N,{title:t.analytics.factsLearned,value:b.factsLearned,subtitle:t.analytics.fromConversations,icon:ye,gradient:"bg-gradient-to-br from-violet-500 to-purple-600",index:4,testId:"stat-sage-facts"})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-4",children:[e.jsx(N,{title:t.analytics.callsLabel,value:b.callCount,subtitle:t.analytics.freeConversations,icon:ja,gradient:"bg-gradient-to-br from-indigo-500 to-blue-600",index:4,testId:"stat-sage-calls"}),e.jsx(N,{title:t.analytics.discussLabel,value:b.discussCount,subtitle:t.analytics.lessonDiscussions,icon:Na,gradient:"bg-gradient-to-br from-cyan-500 to-sky-600",index:5,testId:"stat-sage-discuss"}),e.jsx(N,{title:t.analytics.avgLength,value:b.avgMinutes,suffix:` ${t.analytics.minutesSuffix}`,subtitle:t.analytics.perConversation,icon:H,gradient:"bg-gradient-to-br from-rose-500 to-pink-600",index:6,testId:"stat-sage-avg"}),e.jsx(N,{title:t.analytics.languageCount,value:b.languageCount,subtitle:t.analytics.practicedLabel,icon:ma,gradient:"bg-gradient-to-br from-teal-500 to-emerald-600",index:7,testId:"stat-sage-languages"}),e.jsx(N,{title:t.analytics.sageAssists,value:b.sageAssists,subtitle:t.analytics.translationsUsed,icon:xa,gradient:"bg-gradient-to-br from-amber-500 to-orange-600",index:8,testId:"stat-sage-assists"})]})]})},"sage"),e.jsx(ge,{value:"quizzes",className:"space-y-6",children:S?e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[1,2,3,4].map(s=>e.jsx($e,{className:"h-32 rounded-2xl bg-muted"},s))}):x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-4",children:[e.jsx(N,{title:t.analytics.totalQuizzes,value:x.totalCompleted,subtitle:`${x.totalAttempts} ${t.analytics.totalAttemptsSuffix}`,icon:J,gradient:"bg-gradient-to-br from-blue-500 to-indigo-600",index:0,testId:"stat-quiz-attempts"}),j&&e.jsx(N,{title:t.analytics.quizXp,value:((rt=j.customRange)==null?void 0:rt.quizzes)??j.allTime.quizzes,subtitle:t.analytics.quizXpSubtitle,icon:Re,gradient:"bg-gradient-to-br from-yellow-500 to-amber-600",index:1,testId:"stat-quiz-xp"}),e.jsx(N,{title:t.analytics.averageScore,value:Math.round(x.averageScore),suffix:"%",subtitle:t.analytics.overallPerformance,icon:ua,gradient:"bg-gradient-to-br from-amber-500 to-orange-500",index:2,testId:"stat-quiz-avg-score"}),e.jsx(N,{title:t.analytics.perfectScores,value:x.perfectScores,subtitle:x.totalCompleted>0?t.analytics.percentOfQuizzes(Math.round(x.perfectScores/x.totalCompleted*100)):t.analytics.noQuizzesYet,icon:ve,gradient:"bg-gradient-to-br from-yellow-400 to-amber-500",index:3,testId:"stat-quiz-perfect"}),e.jsx(N,{title:t.analytics.passRate,value:x.recentAttempts.length>0?Math.round(x.recentAttempts.filter(s=>s.passed).length/x.recentAttempts.length*100):0,suffix:"%",subtitle:t.analytics.quizzesPassed,icon:xe,gradient:"bg-gradient-to-br from-emerald-500 to-green-600",index:4,testId:"stat-quiz-pass-rate"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-5",children:[e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(Y,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.scoreHistory}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.recentQuizScores})]})]}),e.jsx(yr,{data:Bt,dataKey:"score",color:"#22c55e",height:220,yAxisLabel:"Score"})]})}),e.jsx(g.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:.5},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(J,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.performanceByLevel}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.avgScorePerLevel})]})]}),e.jsx(ze,{data:Ft,dataKey:"avgScore",nameKey:"level",color:"#3b82f6",height:220,yAxisLabel:"Score"})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-5",children:[e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.6},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(ye,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.performanceByLanguage}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.avgScorePerLanguage})]})]}),e.jsx(ze,{data:qt,dataKey:"avgScore",nameKey:"language",color:"#f97316",height:220,yAxisLabel:"Score"})]})}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.7},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(pa,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.recentAttemptsTitle}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.quizResultsWithLessons})]})]}),x.recentAttempts.length===0?e.jsx("div",{className:"py-8 text-center text-muted-foreground/50",children:t.analytics.noQuizAttempts}):e.jsx("div",{className:"space-y-2 max-h-[280px] overflow-y-auto",children:x.recentAttempts.slice(0,8).map((s,u)=>e.jsxs(g.div,{className:"flex items-center justify-between p-3 rounded-xl bg-muted/40 hover:bg-muted/40 border border-transparent transition-all",initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:u*.1},"data-testid":`quiz-attempt-${s.id}`,children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:`p-2 rounded-lg flex-shrink-0 ${s.passed?"bg-emerald-500/15":"bg-muted"}`,children:s.passed?e.jsx(ve,{className:"h-4 w-4 text-primary"}):e.jsx(J,{className:"h-4 w-4 text-muted-foreground/50"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate text-foreground",title:s.articleEnglishTitle||s.articleTitle||t.analytics.lessonQuizFallback,"data-testid":`quiz-attempt-title-${s.id}`,children:s.articleEnglishTitle||s.articleTitle||t.analytics.lessonQuizFallback}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-md bg-muted text-muted-foreground border border-transparent",children:B(s.language,t)}),e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-md bg-muted text-muted-foreground",children:Q(s.level,t)}),e.jsx("span",{className:"text-xs text-muted-foreground/50",children:new Date(s.startedAt).toLocaleDateString()})]})]})]}),e.jsxs("span",{className:`font-bold text-lg flex-shrink-0 ml-2 ${s.passed?"text-emerald-400":"text-muted-foreground/50"}`,children:[Math.round(s.scorePercent),"%"]})]},s.id))})]})})]}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.75},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(R,{className:"h-4 w-4 text-orange-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.effortOverTime}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.quizAttemptsAndScores})]})]}),x.effortOverTime&&x.effortOverTime.length>0?e.jsx(G,{width:"100%",height:220,children:e.jsxs(Fe,{data:x.effortOverTime,margin:{left:10,right:10},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"effortGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#f97316"}),e.jsx("stop",{offset:"100%",stopColor:"#f9731688"})]})}
1),e.jsx(Z,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:"#8a8a8a"},tickFormatter:s=>new Date(s).toLocaleDateString(n,{day:"numeric",month:"short"})}),e.jsx(je,{axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:"#c0c0c0"},width:30}),e.jsx(W,{content:({active:s,payload:u,label:_})=>s&&u&&u.length?e.jsxs("div",{className:"bg-card backdrop-blur-xl border border-border rounded-xl p-3 shadow-xl shadow-black/5",children:[e.jsx("p",{className:"text-muted-foreground text-[11px] font-medium mb-1",children:new Date(_).toLocaleDateString(n,{month:"short",day:"numeric"})}),e.jsx("p",{className:"text-orange-400 font-bold",children:t.analytics.quizTooltipAttempts(u[0].value)}),u[1]&&e.jsx("p",{className:"text-emerald-400 text-sm",children:t.analytics.quizTooltipAvgScore(u[1].value)})]}):null}),e.jsx(Ie,{dataKey:"attempts",fill:"url(#effortGradient)",radius:[4,4,0,0]})]})}):e.jsx("div",{className:"flex items-center justify-center h-[220px] text-muted-foreground/50",children:t.analytics.noEffortData})]})}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.8},children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-card shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] p-6",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(J,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.analytics.monthlyActivity}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.analytics.quizActivityThisMonth})]})]}),e.jsx(Sr,{effortData:x.effortOverTime||[]})]})}),e.jsx(g.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:.8},children:e.jsx("div",{className:"relative overflow-hidden rounded-2xl p-6 bg-gradient-to-r from-[#E8F3EE] to-[#D4E8DD] shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07)]",children:e.jsxs("div",{className:"relative z-10 flex flex-col md:flex-row items-center justify-between gap-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-card/50",children:e.jsx(xe,{className:"h-8 w-8 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-foreground/70 text-sm font-medium",children:t.analytics.quizPerformance}),e.jsx("p",{className:"text-4xl font-bold text-foreground",children:e.jsx(re,{value:Math.round(x.averageScore),suffix:"%"})})]})]}),e.jsxs("div",{className:"flex items-center gap-6 text-muted-foreground",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:x.totalCompleted}),e.jsx("p",{className:"text-xs",children:t.analytics.quizCompleted})]}),e.jsx("div",{className:"w-px h-10 bg-black/10 dark:bg-white/15"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:x.perfectScores}),e.jsx("p",{className:"text-xs",children:t.analytics.quizPerfect})]}),e.jsx("div",{className:"w-px h-10 bg-black/10 dark:bg-white/15"}),e.jsx("div",{className:"text-center",children:e.jsx(hr,{value:x.recentAttempts.length>0?Math.round(x.recentAttempts.filter(s=>s.passed).length/x.recentAttempts.length*100):0,size:60,strokeWidth:6,color:"#22c55e"})})]})]})})})]}):e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:e.jsx("div",{className:"relative overflow-hidden rounded-2xl bg-card/80 backdrop-blur-xl border border-dashed border-border p-16",children:e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx(g.div,{animate:{y:[-5,5,-5]},transition:{repeat:1/0,duration:3},children:e.jsx(xe,{className:"h-16 w-16 mb-4 text-muted-foreground/30"})}),e.jsx("p",{className:"text-base font-medium text-foreground/70 mb-2",children:t.analytics.noQuizData}),e.jsx("p",{className:"text-sm text-muted-foreground/50 text-center max-w-sm",children:t.analytics.completeQuizzesPrompt})]})})})},"quizzes"),e.jsx(ge,{value:"revision",className:"space-y-6",children:e.jsx(ba,{startDate:d.startDate,endD
1ate:d.endDate,onStartDailyReview:()=>a("/revision-hub?tab=practice&mode=daily_review"),onStartWeakPractice:()=>a("/revision-hub?tab=practice&mode=practice_weak")})},"revision")]})]})]})})})}export{Wr as default};

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.