(()=>{var e={};e.id=583,e.ids=[583,888,660],e.modules={554:(e,t,s)=>{"use strict";s.a(e,async(e,r)=>{try{s.r(t),s.d(t,{config:()=>j,default:()=>u,getServerSideProps:()=>m,getStaticPaths:()=>p,getStaticProps:()=>h,reportWebVitals:()=>y,routeModule:()=>N,unstable_getServerProps:()=>b,unstable_getServerSideProps:()=>q,unstable_getStaticParams:()=>v,unstable_getStaticPaths:()=>f,unstable_getStaticProps:()=>g});var a=s(7093),i=s(5244),l=s(1323),o=s(2899),n=s.n(o),c=s(3414),x=s(7505),d=e([x]);x=(d.then?(await d)():d)[0];let u=(0,l.l)(x,"default"),h=(0,l.l)(x,"getStaticProps"),p=(0,l.l)(x,"getStaticPaths"),m=(0,l.l)(x,"getServerSideProps"),j=(0,l.l)(x,"config"),y=(0,l.l)(x,"reportWebVitals"),g=(0,l.l)(x,"unstable_getStaticProps"),f=(0,l.l)(x,"unstable_getStaticPaths"),v=(0,l.l)(x,"unstable_getStaticParams"),b=(0,l.l)(x,"unstable_getServerProps"),q=(0,l.l)(x,"unstable_getServerSideProps"),N=new a.PagesRouteModule({definition:{kind:i.x.PAGES,page:"/analytics",pathname:"/analytics",bundlePath:"",filename:""},components:{App:c.default,Document:n()},userland:x});r()}catch(e){r(e)}})},1398:(e,t,s)=>{"use strict";s.d(t,{Z:()=>n});var r=s(997),a=s(968),i=s.n(a),l=s(1664),o=s.n(l);function n({children:e}){return(0,r.jsxs)("div",{children:[(0,r.jsxs)(i(),{children:[r.jsx("title",{children:"Real-time NBA Analytics"}),r.jsx("meta",{name:"description",content:"AI-powered NBA analytics and commentary"}),r.jsx("link",{rel:"icon",href:"/favicon.ico"})]}),r.jsx("nav",{className:"bg-black text-white p-4",children:(0,r.jsxs)("div",{className:"container mx-auto flex items-center",children:[r.jsx("div",{className:"flex-1",children:r.jsx("span",{className:"text-neon-purple text-sm font-roboto",children:"Powered with ❤️ on SingleStore"})}),r.jsx("div",{className:"flex-1 text-center",children:r.jsx(o(),{href:"/",className:"text-3xl font-bold text-neon-green font-orbitron",children:"NBA OnTheFlyAI"})}),r.jsx("div",{className:"flex-1 flex justify-end",children:(0,r.jsxs)("ul",{className:"flex space-x-4",children:[r.jsx("li",{children:r.jsx(o(),{href:"/",className:"hover:text-green-400 text-neon-green font-orbitron",children:"Home"})}),r.jsx("li",{children:r.jsx(o(),{href:"/analytics",className:"hover:text-green-400 text-neon-green font-orbitron",children:"Analytics"})})]})})]})}),r.jsx("main",{children:e})]})}},5043:(e,t,s)=>{"use strict";s.a(e,async(e,r)=>{try{s.d(t,{v:()=>x});var a=s(8983),i=s(3809),l=s(2154),o=s(4283),n=s(7115),c=e([a,i,l,o,n]);[a,i,l,o,n]=c.then?(await c)():c;var x=(0,a.z)({chartName:"BarChart",GraphicalChild:i.$,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:l.K},{axisType:"yAxis",AxisComp:o.B}],formatAxisMap:n.t9});r()}catch(e){r(e)}})},3414:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>l});var r=s(997);s(6764);var a=s(968),i=s.n(a);let l=function({Component:e,pageProps:t}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i(),{children:[r.jsx("title",{children:"NBA Analytics"}),r.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700&family=Roboto:wght@400;700&display=swap",rel:"stylesheet"})]}),r.jsx(e,{...t})]})}},7505:(e,t,s)=>{"use strict";s.a(e,async(e,r)=>{try{s.r(t),s.d(t,{default:()=>g});var a=s(997),i=s(6689),l=s(1398),o=s(2305),n=s(5043),c=s(4206),x=s(2154),d=s(4283),u=s(6531),h=s(5450),p=s(3809),m=s(2332),j=s(8933),y=e([o,n,c,x,d,u,h,p,m,j]);[o,n,c,x,d,u,h,p,m,j]=y.then?(await y)():y;let f=({total:e})=>a.jsx(o.h,{width:"100%",height:300,children:(0,a.jsxs)(n.v,{data:[{name:"Total Commentaries",total:e}],children:[a.jsx(c.q,{strokeDasharray:"3 3"}),a.jsx(x.K,{dataKey:"name"}),a.jsx(d.B,{}),a.jsx(u.u,{}),a.jsx(h.D,{}),a.jsx(p.$,{dataKey:"total",fill:"#8884d8"})]})}),v=({commentaries:e=[]})=>{let t=e.map(e=>({timestamp:new Date(e.timestamp).toLocaleString(),length:e.commentary.length})).reverse();return a.jsx(o.h,{width:"100%",height:300,children:(0,a.jsxs)(m.w,{data:t,children:[a.jsx(c.q,{strokeDasharray:"3 3"}),a.jsx(x.K,{dataKey:"timestamp"}),a.jsx(d.B,{}),a.jsx(u.u,{}),a.jsx(h.D,{}),a.jsx(j.x,{type:"monotone",dataKey:"length",stroke:"#8884d8"})]})})};function g(){let[e,t]=(0,i.useState)(null),[s,r]=(0,i.useState)(""),o=async()=>{try{let e=await fetch(`/api/analytics?userPrompt=${s}`),r=await e.json();t(r)}catch(e){console.error("Error fetching analytics data:",e)}};return e?a.jsx(l.Z,{children:(0,a.jsxs)("div",{className:"container mx-auto px-4 py-8",children:[a.jsx("h1",{className:"text-3xl font-bold mb-6",children:"Analytics Dashboard"}),a.jsx("div",{className:"grid grid-cols-1 gap-6 mb-8",children:(0,a.jsxs)("div",{className:"p-6 rounded-lg shadow",children:[a.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Total Commentaries"}),a.jsx(f,{total:e.totalCommentaries})]})}),(0,a.jsxs)("div",{className:"p-6 rounded-lg shadow",children:[a.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Latest Commentaries"}),a.jsx(v,{commentaries:e.similaritySearch||[]}),a.jsx("input",{type:"text",value:s,onChange:e=>{r(e.target.value),o()},placeholder:"Enter your prompt",className:"input-class"}),(0,a.jsxs)("table",{className:"w-full mt-4",children:[a.jsx("thead",{children:(0,a.jsxs)("tr",{children:[a.jsx("th",{className:"px-4 py-2 text-left",children:"Timestamp"}),a.jsx("th",{className:"px-4 py-2 text-left",children:"Commentary"})]})}),a.jsx("tbody",{children:e?.similaritySearch?.map((e,t)=>a.jsxs("tr",{className:t%2==0?"bg-gray-800":"",children:[a.jsx("td",{className:"px-4 py-2",children:new Date(e.timestamp).toLocaleString()}),a.jsx("td",{className:"px-4 py-2",children:e.commentary})]},t))})]})]})]})}):a.jsx(l.Z,{children:(0,a.jsxs)("div",{className:"container mx-auto px-4 py-8",children:[a.jsx("h1",{className:"text-3xl font-bold mb-6",children:"Analytics Dashboard"}),a.jsx("p",{children:"Loading..."})]})})}r()}catch(e){r(e)}})},6764:()=>{},5502:e=>{"use strict";e.exports=require("eventemitter3")},8759:e=>{"use strict";e.exports=require("lodash/every")},6918:e=>{"use strict";e.exports=require("lodash/find")},8190:e=>{"use strict";e.exports=require("lodash/flatMap")},1712:e=>{"use strict";e.exports=require("lodash/get")},2327:e=>{"use strict";e.exports=require("lodash/isBoolean")},113:e=>{"use strict";e.exports=require("lodash/isEqual")},5716:e=>{"use strict";e.exports=require("lodash/isFunction")},8843:e=>{"use strict";e.exports=require("lodash/isNaN")},6069:e=>{"use strict";e.exports=require("lodash/isNil")},7078:e=>{"use strict";e.exports=require("lodash/isNumber")},5795:e=>{"use strict";e.exports=require("lodash/isObject")},5452:e=>{"use strict";e.exports=require("lodash/isPlainObject")},7026:e=>{"use strict";e.exports=require("lodash/isString")},3824:e=>{"use strict";e.exports=require("lodash/last")},9941:e=>{"use strict";e.exports=require("lodash/mapValues")},6625:e=>{"use strict";e.exports=require("lodash/max")},541:e=>{"use strict";e.exports=require("lodash/memoize")},604:e=>{"use strict";e.exports=require("lodash/min")},4042:e=>{"use strict";e.exports=require("lodash/range")},4129:e=>{"use strict";e.exports=require("lodash/some")},3672:e=>{"use strict";e.exports=require("lodash/sortBy")},1381:e=>{"use strict";e.exports=require("lodash/throttle")},9309:e=>{"use strict";e.exports=require("lodash/uniqBy")},5428:e=>{"use strict";e.exports=require("lodash/upperFirst")},2785:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},968:e=>{"use strict";e.exports=require("next/head")},6689:e=>{"use strict";e.exports=require("react")},1469:e=>{"use strict";e.exports=require("react-is")},3522:e=>{"use strict";e.exports=require("react-smooth")},997:e=>{"use strict";e.exports=require("react/jsx-runtime")},9540:e=>{"use strict";e.exports=require("recharts-scale")},8970:e=>{"use strict";e.exports=require("victory-vendor/d3-scale")},2725:e=>{"use strict";e.exports=require("victory-vendor/d3-shape")},6593:e=>{"use strict";e.exports=import("clsx")},4281:e=>{"use strict";e.exports=import("tiny-invariant")},1017:e=>{"use strict";e.exports=require("path")}};var t=require("../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[899,178],()=>s(554));module.exports=r})();