1import{W as O,F as _e,q as Fe,Q as Re,u as qe,r as I,j as e,X as ye,O as Y,U as xe,aP as He,ab as Ie,b9 as Ye,b4 as Qe,B as se,o as Xe,ba as N,cc as ve,f as Je,C as f,K as A,aC as ae,N as C,aa as V,a as k,p as oe,aA as D,H as Ne,G,am as we,aE as Ze,z as et,a$ as $e,M as tt}from"./index-tc5-nNLC.js";import{P as he}from"./progress-CJIgvptw.js";import{A as Be}from"./award-C2MYBTvh.js";import{R as at}from"./rocket-BSE7fGo7.js";import{C as st}from"./chevron-up-1gTexUQn.js";import{C as rt}from"./chevron-down-DOFZ7rzv.js";import{G as nt}from"./globe-CrY5Q3gB.js";import{C as it}from"./credit-card-B0XDcUdX.js";import{C as lt}from"./circle-check-B8vEXYAG.js";import{E as ot}from"./external-link-wMXh6D17.js";import{T as ct,a as dt,b as W,c as q}from"./tabs-D2OfY7RH.js";import{S as ke,a as Se,b as Ae,c as Ce,d as T}from"./select-Bsa-6vNv.js";import{L as mt}from"./log-in-DrADV0ef.js";import{D as xt}from"./download-DtCkiRGd.js";import{E as ce}from"./eye-7YOw3q0i.js";import{T as ht}from"./trending-down-Dsd0TGG8.js";import{A as ut}from"./arrow-up-right-_tEZZH8K.js";import{A as pt}from"./arrow-down-right-ByzGt8di.js";import{i as ft,D as gt,f as bt,E as jt,L as de,a as ee,C as yt,A as vt,b as H,c as Nt,d as ue,h as wt,e as kt,g as Ue,u as St,G as At,j as Le,k as Ct,X as ne,Y as ie,l as Lt,R as ge,T as be,B as Pt}from"./generateCategoricalChart-DZpWJM6e.js";import{B as Dt}from"./BarChart-DMhIEJ_f.js";import{A as Tt,a as Pe}from"./AreaChart-CihOxIpK.js";import{C as Ke}from"./CartesianGrid-Czk3FTe6.js";import"./index-C-y5wYFI.js";import"./throttle-BDyZMAVR.js";import"./index-Bf1HScv8.js";const je=["/api/builder-onboarding/progress"];function Et(){return O({queryKey:je,staleTime:3e4})}function Ot(){return _e({mutationFn:async t=>{const s=await Re("POST",`/api/builder-onboarding/step/${t}/complete`);if(!s.ok)throw new Error("Failed to complete step");return s.json()},onSuccess:()=>Fe.invalidateQueries({queryKey:je})})}function _t(){return _e({mutationFn:async()=>{const t=await Re("POST","/api/builder-onboarding/dismiss");if(!t.ok)throw new Error("Failed to dismiss");return t.json()},onSuccess:()=>Fe.invalidateQueries({queryKey:je})})}const Ft={profile_complete:Ye,membership_activated:Be,payout_connected:it,chain_published:Ie,qr_deployed:He,community_joined:xe,directory_ready:nt};function Rt(){var g;const{data:t,isLoading:s}=Et(),a=Ot(),r=_t(),[,i]=qe(),[o,l]=I.useState(!0);if(s||!t||(g=t.progress)!=null&&g.dismissed)return null;const{steps:m,completedCount:d,totalCount:p,allComplete:u,badgeUnlocked:b}=t,h=Math.round(d/p*100),j=c=>{c.done||(c.autoDetect||a.mutate(c.key),c.ctaExternal?window.location.href=c.ctaHref:i(c.ctaHref))},x=()=>r.mutate();return u&&b?e.jsxs("div",{className:"relative rounded-xl border border-emerald-500/30 bg-emerald-950/30 backdrop-blur p-5 mb-6 flex items-center gap-4","data-testid":"builder-checklist-complete",children:[e.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-emerald-500/20 flex items-center justify-center",children:e.jsx(Be,{className:"h-6 w-6 text-emerald-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-emerald-300 font-semibold",children:"Builder badge unlocked! ð"}),e.jsx("p",{className:"text-emerald-400/70 text-sm",children:"You're fully activated as a chain builder. Your profile is live in the builder directory."})]}),e.jsx("button",{onClick:x,className:"absolute top-3 right-3 text-emerald-500/50 hover:text-emerald-300 transition-colors","aria-label":"Dismiss","data-testid":"builder-checklist-dismiss",children:e.jsx(ye,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"rounded-xl border border-slate-700/60 bg-slate-900/60 backdrop-blur mb-6 overflow-hidden","data-testid":"builder-checklist",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 cursor-pointer select-none",onClick:()=>l(c=>!c),"data-testid":"builder-checklist-header",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"flex-shrink-0 w-9 h-9 rounded-lg bg-emerald-500/15 flex items-center justify-center",children:e.jsx(at,{className:"h-5 w-5 text-emerald-400"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-white font-semibold text-sm",children:"Getting started as a builder"}),e.jsxs(Y,{className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30 text-xs",children:[d,"/",p]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(he,{value:h,className:"h-1.5 w-32 bg-slate-700"}),e.jsxs("span",{className:"text-slate-500 text-xs",children:[h,"% complete"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-2",children:[d>0&&e.jsx("button",{onClick:c=>{c.stopPropagation(),x()},className:"text-slate-600 hover:text-slate-400 transition-colors p-1","aria-label":"Dismiss checklist","data-testid":"builder-checklist-dismiss-header",children:e.jsx(ye,{className:"h-3.5 w-3.5"})}),o?e.jsx(st,{className:"h-4 w-4 text-slate-500"}):e.jsx(rt,{className:"h-4 w-4 text-slate-500"})]})]}),o&&e.jsx("div",{className:"border-t border-slate-800 divide-y divide-slate-800/50",children:m.map(c=>{const v=Ft[c.key]??Qe;return e.jsxs("div",{className:`flex items-start gap-3 px-5 py-3.5 transition-colors ${c.done?"opacity-60":"hover:bg-slate-800/30"}`,"data-testid":`builder-step-${c.key}`,children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:c.done?e.jsx(lt,{className:"h-5 w-5 text-emerald-400"}):e.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-slate-600 flex items-center justify-center",children:e.jsx(v,{className:"h-3 w-3 text-slate-500"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:`text-sm font-medium ${c.done?"text-slate-400 line-through":"text-white"}`,children:c.title}),!c.done&&e.jsx("p",{className:"text-xs text-slate-500 mt-0.5 leading-snug",children:c.description}),c.done&&c.completedAt&&e.jsxs("p",{className:"text-xs text-slate-600 mt-0.5",children:["Completed"," ",new Date(c.completedAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})]})]}),!c.done&&e.jsx("div",{className:"flex-shrink-0 ml-2",children:c.ctaExternal?e.jsxs(se,{size:"sm",variant:"outline",className:"h-7 text-xs border-slate-600 text-slate-300 hover:bg-slate-700 hover:text-white gap-1",onClick:()=>j(c),"data-testid":`builder-step-cta-${c.key}`,children:[c.cta,e.jsx(ot,{className:"h-3 w-3"})]}):e.jsx(Xe,{href:c.ctaHref,children:e.jsx(se,{size:"sm",variant:"outline",className:"h-7 text-xs border-emerald-700/50 text-emerald-400 hover:bg-emerald-900/30 hover:text-emerald-300",onClick:()=>{c.autoDetect||a.mutate(c.key)},"data-testid":`builder-step-cta-${c.key}`,children:c.cta})})})]},c.key)})})]})}var It=["type","layout","connectNulls","ref"],$t=["key"];function $(t){"@babel/helpers - typeof";return $=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},$(t)}function De(t,s){if(t==null)return{};var a=Bt(t,s),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(s.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function Bt(t,s){if(t==null)return{};var a={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(s.indexOf(r)>=0)continue;a[r]=t[r]}return a}function Q(){return Q=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var a=arguments[s];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},Q.apply(this,arguments)}function Te(t,s){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);
vendor: 8,612 bytes, lines 1-2
1s&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),a.push.apply(a,r)}return a}function S(t){for(var s=1;s<arguments.length;s++){var a=arguments[s]!=null?arguments[s]:{};s%2?Te(Object(a),!0).forEach(function(r){L(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):Te(Object(a)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))})}return t}function R(t){return zt(t)||Mt(t)||Kt(t)||Ut()}function Ut(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kt(t,s){if(t){if(typeof t=="string")return pe(t,s);var a=Object.prototype.toString.call(t).slice(8,-1);if(a==="Object"&&t.constructor&&(a=t.constructor.name),a==="Map"||a==="Set")return Array.from(t);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return pe(t,s)}}function Mt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function zt(t){if(Array.isArray(t))return pe(t)}function pe(t,s){(s==null||s>t.length)&&(s=t.length);for(var a=0,r=new Array(s);a<s;a++)r[a]=t[a];return r}function Vt(t,s){if(!(t instanceof s))throw new TypeError("Cannot call a class as a function")}function Ee(t,s){for(var a=0;a<s.length;a++){var r=s[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ze(r.key),r)}}function Gt(t,s,a){return s&&Ee(t.prototype,s),a&&Ee(t,a),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wt(t,s,a){return s=re(s),qt(t,Me()?Reflect.construct(s,a||[],re(t).constructor):s.apply(t,a))}function qt(t,s){if(s&&($(s)==="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ht(t)}function Ht(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Me(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Me=function(){return!!t})()}function re(t){return re=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},re(t)}function Yt(t,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(s&&s.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),s&&fe(t,s)}function fe(t,s){return fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},fe(t,s)}function L(t,s,a){return s=ze(s),s in t?Object.defineProperty(t,s,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[s]=a,t}function ze(t){var s=Qt(t,"string");return $(s)=="symbol"?s:s+""}function Qt(t,s){if($(t)!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var r=a.call(t,s);if($(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var X=function(t){function s(){var a;Vt(this,s);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return a=Wt(this,s,[].concat(i)),L(a,"state",{isAnimationFinished:!0,totalLength:0}),L(a,"generateSimpleStrokeDasharray",function(l,m){return"".concat(m,"px ").concat(l-m,"px")}),L(a,"getStrokeDasharray",function(l,m,d){var p=d.reduce(function(v,n){return v+n});if(!p)return a.generateSimpleStrokeDasharray(m,l);for(var u=Math.floor(l/p),b=l%p,h=m-l,j=[],x=0,g=0;x<d.length;g+=d[x],++x)if(g+d[x]>b){j=[].concat(R(d.slice(0,x)),[b-g]);break}var c=j.length%2===0?[0,h]:[h];return[].concat(R(s.repeat(d,u)),R(j),c).map(function(v){return"".concat(v,"px")}).join(", ")}),L(a,"id",St("recharts-line-")),L(a,"pathRef",function(l){a.mainCurve=l}),L(a,"handleAnimationEnd",function(){a.setState({isAnimationFinished:!0}),a.props.onAnimationEnd&&a.props.onAnimationEnd()}),L(a,"handleAnimationStart",function(){a.setState({isAnimationFinished:!1}),a.props.onAnimationStart&&a.props.onAnimationStart()}),a}return Yt(s,t),Gt(s,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,l=o.points,m=o.xAxis,d=o.yAxis,p=o.layout,u=o.children,b=bt(u,jt);if(!b)return null;var h=function(g,c){return{x:g.x,y:g.y,value:g.value,errorVal:Ue(g.payload,c)}},j={clipPath:r?"url(#clipPath-".concat(i,")"):null};return N.createElement(de,j,b.map(function(x){return N.cloneElement(x,{key:"bar-".concat(x.props.dataKey),data:l,xAxis:m,yAxis:d,layout:p,dataPointFormatter:h})}))}},{key:"renderDots",value:function(r,i,o){var l=this.props.isAnimationActive;if(l&&!this.state.isAnimationFinished)return null;var m=this.props,d=m.dot,p=m.points,u=m.dataKey,b=ee(this.props,!1),h=ee(d,!0),j=p.map(function(g,c){var v=S(S(S({key:"dot-".concat(c),r:3},b),h),{},{index:c,cx:g.x,cy:g.y,value:g.value,dataKey:u,payload:g.payload,points:p});return s.renderDotItem(d,v)}),x={clipPath:r?"url(#clipPath-".concat(i?"":"dots-").concat(o,")"):null};return N.createElement(de,Q({className:"recharts-line-dots",key:"dots"},x),j)}},{key:"renderCurveStatically",value:function(r,i,o,l){var m=this.props,d=m.type,p=m.layout,u=m.connectNulls;m.ref;var b=De(m,It),h=S(S(S({},ee(b,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(o,")"):null,points:r},l),{},{type:d,layout:p,connectNulls:u});return N.createElement(yt,Q({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,i){var o=this,l=this.props,m=l.points,d=l.strokeDasharray,p=l.isAnimationActive,u=l.animationBegin,b=l.animationDuration,h=l.animationEasing,j=l.animationId,x=l.animateNewValues,g=l.width,c=l.height,v=this.state,n=v.prevPoints,y=v.totalLength;return N.createElement(vt,{begin:u,duration:b,isActive:p,easing:h,from:{t:0},to:{t:1},key:"line-".concat(j),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(_){var P=_.t;if(n){var B=n.length/m.length,E=m.map(function(w,le){var M=Math.floor(le*B);if(n[M]){var z=n[M],F=H(z.x,w.x),Ve=H(z.y,w.y);return S(S({},w),{},{x:F(P),y:Ve(P)})}if(x){var Ge=H(g*2,w.x),We=H(c/2,w.y);return S(S({},w),{},{x:Ge(P),y:We(P)})}return S(S({},w),{},{x:w.x,y:w.y})});return o.renderCurveStatically(E,r,i)}var J=H(0,y),U=J(P),K;if(d){var Z="".concat(d).split(/[,\s]+/gim).map(function(w){return parseFloat(w)});K=o.getStrokeDasharray(U,y,Z)}else K=o.generateSimpleStrokeDasharray(y,U);return o.renderCurveStatically(m,r,i,{strokeDasharray:K})})}},{key:"renderCurve",value:function(r,i){var o=this.props,l=o.points,m=o.isAnimationActive,d=this.state,p=d.prevPoints,u=d.totalLength;return m&&l&&l.length&&(!p&&u>0||!Nt(p,l))?this.renderCurveWithAnimation(r,i):this.renderCurveStatically(l,r,i)}},{key:"render",value:function(){var r,i=this.props,o=i.hide,l=i.dot,m=i.points,d=i.className,p=i.xAxis,u=i.yAxis,b=i.top,h=i.left,j=i.width,x=i.height,g=i.isAnimationActive,c=i.id;if(o||!m||!m.length)return null;var v=this.state.isAnimationFinished,n=m.length===1,y=ve("recharts-line",d),_=p&&p.allowDataOverflow,P=u&&u.allowDataOverflow,B=_||P,E=ue(c)?this.id:c,J=(r=ee(l,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},U=J.r,K=U===void 0?3:U,Z=J.strokeWidth,w=Z===void 0?2:Z,le=wt(l)?l:{},M=le.clipDot,z=M===void 0?!0:M,F=K*2+w;return N.createElement(de,{className:y},_||P?N.createElement("defs",null,N.createElement("clipPath",{id:"clipPath-".concat(E)},N.createElement("rect",{x:_?h:h-j/2,y:P?b:b-x/2,width:_?j:j*2,height:P?x:x*2})),!z&&N.createElement("clipPath",{id:"clipPath-dots-".concat(E)},N.createElement("rect",{x:h-F/2,y:b-F/2,width:j+F,height:x+F}))):null,!n&&this.renderCurve(B,E),this.renderErrorBar(B,E),(n||l)&&this.renderDots(B,z,E),(!g||v)&&kt.renderCallByParent(this.props,m))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:i.curPoints}:r.points!==i.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,i){for(var o=r.length%2!==0?[].concat(R(r),[0]):r,l=[],m=0;m<i;
2++m)l=[].concat(R(l),R(o));return l}},{key:"renderDotItem",value:function(r,i){var o;if(N.isValidElement(r))o=N.cloneElement(r,i);else if(ft(r))o=r(i);else{var l=i.key,m=De(i,$t),d=ve("recharts-line-dot",typeof r!="boolean"?r.className:"");o=N.createElement(gt,Q({key:l},m,{className:d}))}return o}}])}(I.PureComponent);L(X,"displayName","Line");L(X,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!At.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});L(X,"getComposedData",function(t){var s=t.props,a=t.xAxis,r=t.yAxis,i=t.xAxisTicks,o=t.yAxisTicks,l=t.dataKey,m=t.bandSize,d=t.displayedData,p=t.offset,u=s.layout,b=d.map(function(h,j){var x=Ue(h,l);return u==="horizontal"?{x:Le({axis:a,ticks:i,bandSize:m,entry:h,index:j}),y:ue(x)?null:r.scale(x),value:x,payload:h}:{x:ue(x)?null:a.scale(x),y:Le({axis:r,ticks:o,bandSize:m,entry:h,index:j}),value:x,payload:h}});return S({points:b,layout:u},p)});var Xt=Ct({chartName:"LineChart",GraphicalChild:X,axisComponents:[{axisType:"xAxis",AxisComp:ne},{axisType:"yAxis",AxisComp:ie}],formatAxisMap:Lt});function te({title:t,value:s,trend:a,icon:r,format:i="number",testId:o}){const l=()=>i==="currency"?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(s/100):i==="percent"?`${s.toFixed(1)}%`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString();return e.jsx(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50","data-testid":o,children:e.jsxs(k,{className:"p-6",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-400 mb-1",children:t}),e.jsx("p",{className:"text-2xl font-bold text-white",children:l()})]}),e.jsx("div",{className:"p-2 bg-cyan-500/10 rounded-lg",children:e.jsx(r,{className:"h-5 w-5 text-cyan-400"})})]}),a!==0&&e.jsxs("div",{className:`flex items-center gap-1 mt-3 text-sm ${a>0?"text-green-400":"text-red-400"}`,children:[a>0?e.jsx(ut,{className:"h-4 w-4"}):e.jsx(pt,{className:"h-4 w-4"}),e.jsxs("span",{children:[Math.abs(a).toFixed(1),"%"]}),e.jsx("span",{className:"text-slate-500 ml-1",children:"vs last period"})]})]})})}function Jt(){const{data:t,isLoading:s}=O({queryKey:["/api/creator/earnings-by-layer"]});if(s)return e.jsx(D,{className:"h-48 w-full bg-slate-800"});if(!t||t.length===0)return e.jsx("div",{className:"h-48 flex items-center justify-center text-slate-500 text-sm",children:"No earnings data by layer yet"});const a=t.map(r=>({name:(r.sourceLayer||"Other").replace(/_/g," "),amount:Number(r.totalAmountCents)/100}));return e.jsx(ge,{width:"100%",height:Math.max(160,a.length*44),children:e.jsxs(Dt,{data:a,layout:"vertical",margin:{top:4,right:20,left:0,bottom:4},children:[e.jsx(ne,{type:"number",hide:!0}),e.jsx(ie,{type:"category",dataKey:"name",tick:{fill:"#94a3b8",fontSize:12},width:110,tickLine:!1,axisLine:!1}),e.jsx(be,{contentStyle:{background:"#1e293b",border:"1px solid #334155",borderRadius:8,fontSize:12},labelStyle:{color:"#e2e8f0"},formatter:r=>[`$${r.toFixed(2)}`,"Revenue"],cursor:{fill:"rgba(255,255,255,0.04)"}}),e.jsx(Pt,{dataKey:"amount",fill:"#22d3ee",radius:[0,4,4,0],"data-testid":"bar-earnings"})]})})}function Zt({totalViews:t,totalEngagements:s,viewsTrend:a}){const r=Math.max(t/7,1),i=Math.max(s/7,1),o=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map((l,m)=>{const d=1+a/100*(m/6-.5);return{day:l,views:Math.round(r*Math.max(.4,d)),engagements:Math.round(i*Math.max(.4,d))}});return e.jsx(ge,{width:"100%",height:180,children:e.jsxs(Tt,{data:o,margin:{top:4,right:4,left:-20,bottom:0},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"viewsGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#22d3ee",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"#22d3ee",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"engGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#a78bfa",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"#a78bfa",stopOpacity:0})]})]}),e.jsx(Ke,{strokeDasharray:"3 3",stroke:"#1e293b"}),e.jsx(ne,{dataKey:"day",tick:{fill:"#64748b",fontSize:11}
2,axisLine:!1,tickLine:!1}),e.jsx(ie,{tick:{fill:"#64748b",fontSize:11},axisLine:!1,tickLine:!1}),e.jsx(be,{contentStyle:{background:"#1e293b",border:"1px solid #334155",borderRadius:8,fontSize:12},labelStyle:{color:"#e2e8f0"}}),e.jsx(Pe,{type:"monotone",dataKey:"views",stroke:"#22d3ee",strokeWidth:2,fill:"url(#viewsGrad)",name:"Views",dot:!1}),e.jsx(Pe,{type:"monotone",dataKey:"engagements",stroke:"#a78bfa",strokeWidth:2,fill:"url(#engGrad)",name:"Engagements",dot:!1})]})})}function ea({timeline:t}){if(!t||t.length===0)return e.jsx("div",{className:"h-48 flex items-center justify-center text-slate-500 text-sm",children:"No timeline data yet"});const s=t.map(a=>({date:new Date(a.date).toLocaleDateString("en-US",{month:"short",day:"numeric"}),revenue:a.revenue/100}));return e.jsx(ge,{width:"100%",height:200,children:e.jsxs(Xt,{data:s,margin:{top:4,right:16,left:-20,bottom:0},children:[e.jsx(Ke,{strokeDasharray:"3 3",stroke:"#1e293b"}),e.jsx(ne,{dataKey:"date",tick:{fill:"#64748b",fontSize:11},axisLine:!1,tickLine:!1}),e.jsx(ie,{tick:{fill:"#64748b",fontSize:11},axisLine:!1,tickLine:!1,tickFormatter:a=>`$${a}`}),e.jsx(be,{contentStyle:{background:"#1e293b",border:"1px solid #334155",borderRadius:8,fontSize:12},labelStyle:{color:"#e2e8f0"},formatter:a=>[`$${a.toFixed(2)}`,"Revenue"]}),e.jsx(X,{type:"monotone",dataKey:"revenue",stroke:"#4ade80",strokeWidth:2,dot:!1,name:"Revenue"})]})})}const Oe=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ta=[{label:`Morning 36â10am`,patterns:["morning","6am","7am","8am","9am","10am"]},{label:`Midday 411amâ2pm`,patterns:["midday","noon","11am","12pm","1pm","2pm"]},{label:`Evening 55â8pm`,patterns:["evening","after","5pm","6pm","7pm","8pm"]},{label:`Night 69pm+`,patterns:["night","late","9pm","10pm","11pm"]}];function aa({bestDays:t,bestTimes:s}){const a=i=>t.some(o=>o.toLowerCase().startsWith(i.toLowerCase().slice(0,3))),r=i=>s.some(o=>i.some(l=>o.toLowerCase().includes(l)));return e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs("div",{className:"grid min-w-[340px] gap-px",style:{gridTemplateColumns:"80px repeat(7, 1fr)"},children:[e.jsx("div",{className:"text-[10px] text-slate-600 flex items-end pb-1",children:"Time"}),Oe.map(i=>e.jsx("div",{className:`text-[11px] text-center pb-1 font-medium ${a(i)?"text-amber-400":"text-slate-500"}`,children:i},i)),ta.map(i=>e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[10px] text-slate-500 pr-2 py-1 flex items-center leading-tight whitespace-pre-line self-center",children:i.label},`label-${i.label}`),Oe.map(o=>{const l=a(o),m=r(i.patterns),d=l&&m;return e.jsx("div",{className:`mx-px my-px rounded h-9 flex items-center justify-center text-xs font-bold transition-colors ${d?"bg-amber-500/60 text-amber-200":l?"bg-amber-500/15 text-amber-600/50":m?"bg-cyan-500/15 text-cyan-600/50":"bg-slate-800/60"}`,children:d?"â":""},`${o}-${i.label}`)})]}))]}),e.jsx("p",{className:"text-[11px] text-slate-500 mt-3",children:"â Best time to post · based on your audience engagement patterns"})]})}function me({type:t}){switch(t){case"reel":case"highlight_reel":return e.jsx($e,{className:"h-4 w-4 text-purple-400"});case"route":return e.jsx(tt,{className:"h-4 w-4 text-green-400"});case"chain":return e.jsx(Ie,{className:"h-4 w-4 text-cyan-400"});default:return e.jsx(ae,{className:"h-4 w-4 text-slate-400"})}}function La(){const{user:t,isLoading:s}
6=Je(),[a,r]=I.useState("overview"),[i,o]=I.useState("week"),[l,m]=I.useState("month");I.useEffect(()=>{document.title="Creator Analytics | Slant"},[]);const{data:d,isLoading:p}=O({queryKey:["/api/premium/creator/analytics/overview"],enabled:!!t}),{data:u,isLoading:b}=O({queryKey:["/api/premium/creator/analytics/content",{period:i}],enabled:!!t&&a==="content"}),{data:h,isLoading:j}=O({queryKey:["/api/premium/creator/analytics/followers"],enabled:!!t&&a==="audience"}),{data:x,isLoading:g}=O({queryKey:["/api/premium/creator/analytics/revenue",{period:l}],enabled:!!t&&a==="revenue"}),{data:c,isLoading:v}=O({queryKey:["/api/premium/creator/analytics/trends"],enabled:!!t&&a==="trends"});return s?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-2 border-cyan-500 border-t-transparent"})}):t?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900",children:e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold text-white flex items-center gap-3","data-testid":"analytics-title",children:[e.jsx(ae,{className:"h-8 w-8 text-cyan-400"}),"Creator Analytics"]}),e.jsx("p",{className:"text-slate-400 mt-1",children:"Track and optimize your content performance"})]}),e.jsxs(se,{variant:"outline",className:"gap-2 border-slate-600 text-slate-300 hover:bg-slate-800","data-testid":"btn-export-analytics",children:[e.jsx(xt,{className:"h-4 w-4"}),"Export"]})]}),e.jsxs(ct,{value:a,onValueChange:r,className:"w-full",children:[e.jsxs(dt,{className:"bg-slate-800/60 border border-slate-700 mb-6",children:[e.jsx(W,{value:"overview",className:"data-[state=active]:bg-cyan-500/20 data-[state=active]:text-cyan-400","data-testid":"tab-overview",children:"Overview"}),e.jsx(W,{value:"content",className:"data-[state=active]:bg-cyan-500/20 data-[state=active]:text-cyan-400","data-testid":"tab-content",children:"Content"}),e.jsx(W,{value:"audience",className:"data-[state=active]:bg-cyan-500/20 data-[state=active]:text-cyan-400","data-testid":"tab-audience",children:"Audience"}),e.jsx(W,{value:"revenue",className:"data-[state=active]:bg-cyan-500/20 data-[state=active]:text-cyan-400","data-testid":"tab-revenue",children:"Revenue"}),e.jsxs(W,{value:"trends",className:"data-[state=active]:bg-cyan-500/20 data-[state=active]:text-cyan-400","data-testid":"tab-trends",children:[e.jsx(oe,{className:"h-4 w-4 mr-2"}),"AI Insights"]})]}),e.jsxs(q,{value:"overview",children:[e.jsx(Rt,{}),p?e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[1,2,3,4].map(n=>e.jsx(D,{className:"h-32 bg-slate-800"},n))}),e.jsx(D,{className:"h-64 bg-slate-800"})]}):d?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(te,{title:"Total Views",value:d.totalViews,trend:d.trends.viewsTrend,icon:ce,testId:"metric-views"}),e.jsx(te,{title:"Engagements",value:d.totalEngagements,trend:d.trends.engagementTrend,icon:Ne,testId:"metric-engagements"}),e.jsx(te,{title:"Followers",value:d.followerCount,trend:d.trends.followerTrend,icon:xe,testId:"metric-followers"}),e.jsx(te,{title:"Revenue",value:d.totalRevenue,trend:d.trends.revenueTrend,icon:G,format:"currency",testId:"metric-revenue"})]}),e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50",children:[e.jsxs(A,{children:[e.jsxs(C,{className:"text-lg text-white flex items-center gap-2",children:[e.jsx(G,{className:"h-5 w-5 text-green-400"}),"Earnings by Layer"]}),e.jsx(V,{className:"text-slate-400",children:"Revenue breakdown by ecosystem layer"})]}),e.jsx(k,{children:e.jsx(Jt,{})})]}),e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50",children:[e.jsxs(A,{children:[e.jsxs(C,{className:"text-lg text-white flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5 text-cyan-400"}),"Views & Engagements â 7-Day Trend"]}),e.jsx(V,{className:"text-slate-400",children:"Estimated daily distribution based on your current totals"})]}),e.jsxs(k,{children:[e.jsx(Zt,{totalViews:d.totalViews,totalEngagements:d.totalEngagements,viewsTrend:d.trends.viewsTrend}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-slate-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-3 h-0.5 bg-cyan-400 inline-block rounded"})," Views"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-3 h-0.5 bg-vi
6olet-400 inline-block rounded"})," Engagements"]})]})]})]})]}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(ae,{className:"h-16 w-16 mx-auto text-slate-600 mb-4"}),e.jsx("p",{className:"text-slate-400",children:"No analytics data available yet"}),e.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Start creating content to see your analytics"})]})]}),e.jsxs(q,{value:"content",children:[e.jsxs("div",{className:"mb-4 flex justify-between items-center",children:[e.jsx("h2",{className:"text-lg font-semibold text-white",children:"Content Performance"}),e.jsxs(ke,{value:i,onValueChange:n=>o(n),children:[e.jsx(Se,{className:"w-40 bg-slate-800 border-slate-700 text-white","data-testid":"select-content-period",children:e.jsx(Ae,{})}),e.jsxs(Ce,{children:[e.jsx(T,{value:"day",children:"Last 24 hours"}),e.jsx(T,{value:"week",children:"Last 7 days"}),e.jsx(T,{value:"month",children:"Last 30 days"}),e.jsx(T,{value:"all",children:"All time"})]})]})]}),b?e.jsx("div",{className:"space-y-4",children:[1,2,3,4,5].map(n=>e.jsx(D,{className:"h-20 bg-slate-800"},n))}):u!=null&&u.items.length?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50 p-4",children:[e.jsx("p",{className:"text-sm text-slate-400",children:"Total Views"}),e.jsx("p",{className:"text-2xl font-bold text-white",children:u.summary.totalViews.toLocaleString()})]}),e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50 p-4",children:[e.jsx("p",{className:"text-sm text-slate-400",children:"Total Engagements"}),e.jsx("p",{className:"text-2xl font-bold text-white",children:u.summary.totalEngagements.toLocaleString()})]}),e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50 p-4",children:[e.jsx("p",{className:"text-sm text-slate-400",children:"Avg. Engagement Rate"}),e.jsxs("p",{className:"text-2xl font-bold text-white",children:[u.summary.avgEngagementRate.toFixed(1),"%"]})]})]}),u.items.map(n=>e.jsx(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50","data-testid":`content-item-${n.id}`,children:e.jsx(k,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-20 h-14 rounded bg-slate-700 flex items-center justify-center flex-shrink-0",children:n.thumbnailUrl?e.jsx("img",{src:n.thumbnailUrl,alt:"",className:"w-full h-full object-cover rounded"}):e.jsx(me,{type:n.type})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-white truncate",children:n.title}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(Y,{variant:"outline",className:"text-xs border-slate-600 text-slate-400",children:n.type}),n.trending&&e.jsxs(Y,{className:"text-xs bg-orange-500/20 text-orange-400 border-orange-500/50",children:[e.jsx(we,{className:"h-3 w-3 mr-1"}),"Trending"]})]})]}),e.jsx("span",{className:"text-sm text-slate-500",children:new Date(n.createdAt).toLocaleDateString()})]}),e.jsxs("div",{className:"flex items-center gap-6 mt-3 text-sm text-slate-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ce,{className:"h-4 w-4"}),n.views.toLocaleString()]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ne,{className:"h-4 w-4"}),n.likes.toLocaleString()]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ze,{className:"h-4 w-4"}),n.comments]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(et,{className:"h-4 w-4"}),n.shares]}),n.revenue>0&&e.jsxs("span",{className:"flex items-center gap-1 text-green-400",children:[e.jsx(G,{className:"h-4 w-4"}),(n.revenue/100).toFixed(2)]})]})]})]})})},n.id))]}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx($e,{className:"h-16 w-16 mx-auto text-slate-600 mb-4"}),e.jsx("p",{className:"text-slate-400",children:"No content data available"})]})]}),e.jsx(q,{value:"audience",children:j?e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[1,2,3,4].map(n=>e.jsx(D,{className:"h-24 bg-slate-800"},n))}),e.jsx(D,{className:"h-64 bg-slate-800"})]}):h?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50 p-4","data-testid":"metric-total-followers",children:[e.jsx("p",{className:"text-sm text-slate-400",children:"Total Followers"}),e.jsx("p",{className:"text-2xl font-bold text-white",children:h.totalFollowers.toLocaleStr
6ing()})]}),e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50 p-4","data-testid":"metric-new-followers",children:[e.jsx("p",{className:"text-sm text-slate-400",children:"New Followers"}),e.jsxs("p",{className:"text-2xl font-bold text-green-400",children:["+",h.newFollowers.toLocaleString()]})]}),e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50 p-4","data-testid":"metric-unfollowers",children:[e.jsx("p",{className:"text-sm text-slate-400",children:"Unfollowers"}),e.jsxs("p",{className:"text-2xl font-bold text-red-400",children:["-",h.unfollowers.toLocaleString()]})]}),e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50 p-4","data-testid":"metric-growth-rate",children:[e.jsx("p",{className:"text-sm text-slate-400",children:"Growth Rate"}),e.jsxs("p",{className:`text-2xl font-bold ${h.growthRate>=0?"text-green-400":"text-red-400"}`,children:[h.growthRate>=0?"+":"",h.growthRate.toFixed(1),"%"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50",children:[e.jsx(A,{children:e.jsx(C,{className:"text-lg text-white",children:"Top Sources"})}),e.jsx(k,{children:e.jsx("div",{className:"space-y-4",children:h.topSources.map((n,y)=>e.jsxs("div",{"data-testid":`source-${y}`,children:[e.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[e.jsx("span",{className:"text-slate-300",children:n.source}),e.jsxs("span",{className:"text-slate-400",children:[n.count," (",n.percentage.toFixed(1),"%)"]})]}),e.jsx(he,{value:n.percentage,className:"h-2"})]},n.source))})})]}),e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50",children:[e.jsx(A,{children:e.jsx(C,{className:"text-lg text-white",children:"Audience Interests"})}),e.jsx(k,{children:e.jsx("div",{className:"flex flex-wrap gap-2",children:h.demographics.interests.map(n=>e.jsxs(Y,{variant:"outline",className:"border-cyan-500/50 text-cyan-400",children:[n.interest," (",n.percentage.toFixed(0),"%)"]},n.interest))})})]})]})]}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(xe,{className:"h-16 w-16 mx-auto text-slate-600 mb-4"}),e.jsx("p",{className:"text-slate-400",children:"No audience data available"})]})}),e.jsxs(q,{value:"revenue",children:[e.jsxs("div",{className:"mb-4 flex justify-between items-center",children:[e.jsx("h2",{className:"text-lg font-semibold text-white",children:"Revenue Analytics"}),e.jsxs(ke,{value:l,onValueChange:n=>m(n),children:[e.jsx(Se,{className:"w-40 bg-slate-800 border-slate-700 text-white","data-testid":"select-revenue-period",children:e.jsx(Ae,{})}),e.jsxs(Ce,{children:[e.jsx(T,{value:"week",children:"Last 7 days"}),e.jsx(T,{value:"month",children:"Last 30 days"}),e.jsx(T,{value:"quarter",children:"Last 90 days"}),e.jsx(T,{value:"year",children:"Last year"})]})]})]}),g?e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[1,2,3].map(n=>e.jsx(D,{className:"h-24 bg-slate-800"},n))}),e.jsx(D,{className:"h-64 bg-slate-800"})]}):x?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50 p-4","data-testid":"metric-total-revenue",children:[e.jsx("p",{className:"text-sm text-slate-400",children:"Total Revenue"}),e.jsx("p",{className:"text-2xl font-bold text-white",children:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(x.totalRevenue/100)})]}),e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50 p-4","data-testid":"metric-period-revenue",children:[e.jsx("p",{className:"text-sm text-slate-400",children:"Period Revenue"}),e.jsx("p",{className:"text-2xl font-bold text-green-400",children:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(x.periodRevenue/100)})]}),e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50 p-4","data-testid":"metric-projected-revenue",children:[e.jsx("p",{className:"text-sm text-slate-400",children:"Projected (30d)"}),e.jsx("p",{className:"text-2xl font-bold text-cyan-400",children:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(x.projectedRevenue/100)})]})]}),x.timeline&&x.timeline.length>0&&e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50",children:[e.jsx(A,{children:e.jsxs(C,{className:"text-lg text-white flex items-center gap-2",children:[e.jsx(G,{className:"h-5 w-5 text-green-400"}),"Revenue Over Time"]})}),e.jsx(k,{children:e.jsx(ea,{timeline:x.timeline})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50",children:[e.jsx(A,{children:e.jsx(C,{className:"text-lg text-white",children:"Revenue by Type"})}),e.jsx(k,{children:e.jsx("div",{className:"space-y-4",children:x.revenueByType.map((n,y)=>e.jsxs("div",{"data-testid":`revenue-type-${y}`,children:[e.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[e.jsx("span",{className:"text-slate-300 capitalize",children:n.type.replace("_"," ")}),e.jsx("span",{className:"text-slate-400",children:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(n.amount/100)})]}),e.jsx(he,{value:n.percentage,className:"h-2"})]},n.type))})})]}),e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50",children:[e.jsx(A,{children:e.jsx(C,{className:"text-lg text-white",children:"Top Earning Content"})}),e.jsx(k,{children:e.jsx("div",{className:"space-y-3",children:x.topEarning.slice(0,5).map((n,y)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-800/60 rounded-lg","data-testid":`top-earning-${y}`,children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-green-500/20 flex items-center justify-center text-sm font-bold text-green-400",children:y+1}),e.jsx(me,{type:n.type}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-white truncate",children:n.title}),e.jsxs("p",{className:"text-xs text-slate-500",children:[n.transactions," transactions"]})]}),e.jsx("span",{className:"text-green-400 font-medium",children:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(n.revenue/100)})]},n.id))})})]})]})]}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(G,{className:"h-16 w-16 mx-auto text-slate-600 mb-4"}),e.jsx("p",{className:"text-slate-400",children:"No revenue data available"})]})]}),e.jsx(q,{value:"trends",children:v?e.jsx("div",{className:"space-y-6",children:[1,2,3].map(n=>e.jsx(D,{className:"h-48 bg-slate-800"},n))}):c?e.jsxs("div",{className:"space-y-6",children:[e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50",children:[e.jsxs(A,{children:[e.jsxs(C,{className:"text-lg text-white flex items-center gap-2",children:[e.jsx(oe,{className:"h-5 w-5 text-cyan-400"}),"AI Recommendations"]}),e.jsx(V,{className:"text-slate-400",children:"Personalized suggestions to grow your audience and revenue"})]}),e.jsx(k,{children:e.jsx("div",{className:"space-y-4",children:c.recommendations.map((n,y)=>e.jsx("div",{className:`p-4 rounded-lg border ${n.priority==="high"?"bg-red-500/10 border-red-500/30":n.priority==="medium"?"bg-yellow-500/10 border-yellow-500/30":"bg-slate-800/60 border-slate-700"}`,"data-testid":`recommendation-${y}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Y,{variant:"outline",className:`text-xs ${n.priority==="high"?"border-red-500 text-red-400":n.priority==="medium"?"border-yellow-500 text-yellow-400":"border-slate-500 text-slate-400"}`,children:n.priority}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-white",children:n.title}),e.jsx("p",{className:"text-sm text-slate-400 mt-1",children:n.description}),e.jsxs("p",{className:"text-xs text-cyan-400 mt-2",children:["Expected impact: ",n.expectedImpact]})]})]})},y))})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50",children:[e.jsx(A,{children:e.jsx(C,{className:"text-lg text-white",children:"Content Trends"})}),e.jsx(k,{children:e.jsx("div",{className:"space-y-3",children:c.contentTrends.map((n,y)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-slate-800/60 rounded-lg","data-testid":`content-trend-${y}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(me,{type:n.type}),e.jsx("span",{className:"text-slate-300 capitalize",children:n.type.replace("_"," ")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n.trend==="rising"?e.jsx(we,{className:"h-4 w-4 text-green-400"}):n.trend==="declining"?e.jsx(ht,{className:"h-4 w-4 text-red-400"}):e.jsx("span",{className:"h-4 w-4 text-slate-400",children:"â"}),e.jsxs("span",{className:`text-sm ${n.trend==="rising"?"text-green-400":n.trend==="declining"?"text-red-400":"text-slate-400"}`,children:[n.changePercent>0?"+":"",n.changePercent.toFixed(1),"%"]})]})]},n.type))})})]}),e.jsxs(f,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50",children:[e.jsxs(A,{children:[e.jsx(C,{className:"text-lg text-white",children:"Optimal Posting Times"}),e.jsx(V,{className:"text-slate-400",children:c.engagementPatterns.optimalFrequency})]}),e.jsx(k,{children:e.jsx(aa,{bestDays:c.engagementPatterns.bestDays,bestTimes:c.engagementPatterns.bestTimes})})]})]})]}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(oe,{className:"h-16 w-16 mx-auto text-slate-600 mb-4"}),e.jsx("p",{className:"text-slate-400",children:"No trend data available"}),e.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Create more content to unlock AI insights"})]})})]})]})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 bg-gradient-to-br from-slate-900 to-slate-800",children:e.jsxs(f,{className:"max-w-md w-full bg-slate-900/60 backdrop-blur-xl border-slate-700/50","data-testid":"analytics-login-prompt",children:[e.jsxs(A,{className:"text-center",children:[e.jsx(ae,{className:"h-16 w-16 mx-auto text-cyan-400 mb-4"}),e.jsx(C,{className:"text-2xl text-white",children:"Creator Analytics"}),e.jsx(V,{className:"text-slate-400",children:"Track your content performance, audience growth, and revenue. Sign in to access your analytics."})]}),e.jsx(k,{children:e.jsxs(se,{className:"w-full gap-2 bg-gradient-to-r from-cyan-500 to-blue-600 hover:brightness-110",onClick:()=>window.location.href="/api/login","data-testid":"analytics-login-btn",children:[e.jsx(mt,{className:"h-4 w-4"}),"Sign In to Continue"]})})]})})}export{La 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.