1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1035],{41035:(e,t,s)=>{s.r(t),s.d(t,{default:()=>u});var a=s(95155),l=s(12115),n=s(88072);let r=(e,t)=>"".concat(e,"-").concat(t),i=e=>Math.round(100*e),d=e=>{let{leftPercent:t,rightPercent:s}=e;return(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsxs)("div",{className:"relative h-2 w-full overflow-hidden rounded-full bg-white/10",children:[(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 bg-amber-300",style:{width:"".concat(Math.max(2,t),"%")}}),(0,a.jsx)("div",{className:"absolute inset-y-0 right-0 bg-emerald-400",style:{width:"".concat(Math.max(2,s),"%")}}),(0,a.jsx)("span",{className:"absolute left-1/2 top-1/2 h-4 w-px -translate-y-1/2 bg-white/50"})]})})},c=(e,t)=>Array.from(e.entries()).filter(e=>{let[,t]=e;return t>0}).sort((e,t)=>t[1]-e[1]||e[0]-t[0]).filter(e=>{let[,t]=e;return t>1}).slice(0,t).map(e=>{let[t,s]=e;return{label:String(t),count:s}}),o=(e,t,s)=>{let a=[];for(let l=1;l<=t&&(e.get(l)||a.push(l),!(a.length>=s));l+=1);return a},m=e=>{let{items:t,emptyLabel:s}=e;if(!t.length)return(0,a.jsx)("p",{className:"text-xs text-white/60",children:s});let l=Math.max(...t.map(e=>e.count));return(0,a.jsx)("div",{className:"mt-3 space-y-2",children:t.map(e=>{let t=Math.max(12,Math.round(e.count/l*100));return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-white/70",children:[(0,a.jsx)("span",{children:e.label}),(0,a.jsx)("span",{children:e.count})]}),(0,a.jsx)("div",{className:"h-1.5 w-full rounded-full bg-white/10",children:(0,a.jsx)("div",{className:"h-1.5 rounded-full bg-emerald-400",style:{width:"".concat(t,"%")}})})]},e.label)})})},x=e=>{let{items:t,emptyLabel:s}=e;return t.length?(0,a.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:t.map(e=>(0,a.jsx)("span",{className:"rounded-full border border-white/15 bg-white/10 px-2 py-0.5 text-xs text-white/80",children:e},e))}):(0,a.jsx)("p",{className:"text-xs text-white/60",children:s})};function h(e){var t,s;let{initialLotteryId:n,initialLotteryName:h,initialMainRange:u,initialBonusRange:b,limit:p=18,variant:g="standalone"}=e,[f,w]=(0,l.useState)({id:n,name:h,mainRange:u,bonusRange:b}),[j,N]=(0,l.useState)([]),[v,y]=(0,l.useState)(!1),[k,L]=(0,l.useState)(null);(0,l.useEffect)(()=>{let e=e=>{let t=e.detail;(null==t?void 0:t.id)&&(0,l.startTransition)(()=>{w(e=>{var s,a,l,n;return{id:null!=(s=t.id)?s:e.id,name:null!=(a=t.name)?a:e.name,mainRange:null!=(l=t.mainRange)?l:e.mainRange,bonusRange:null!=(n=t.bonusRange)?n:e.bonusRange}})})};return window.addEventListener("lottery-change",e),()=>window.removeEventListener("lottery-change",e)},[]),(0,l.useEffect)(()=>{if(!f.id)return void N([]);let e=!1;return(async()=>{y(!0),L(null);try{let t=await fetch("/api/analytics/number-matrix?lotteryId=".concat(f.id,"&limit=").concat(p));if(!t.ok)throw Error("Failed to load pattern insights");let s=await t.json();e||N(Array.isArray(s.draws)?s.draws:[])}catch(t){e||L(t instanceof Error?t.message:"Failed to load insights")}finally{e||y(!1)}})(),()=>{e=!0}},[f.id,p]);let E=(0,l.useMemo)(()=>((e,t,s)=>{if(!e.length||t<=0)return null;let a=new Map,l=new Map,n=0,i=0,d=0,m=0,x=Math.floor(t/2);e.forEach(e=>{var t,s;Array.from(new Set(null!=(t=e.main_numbers)?t:[])).filter(e=>Number.isFinite(e)).map(e=>Math.trunc(e)).forEach(e=>{var t;a.set(e,(null!=(t=a.get(e))?t:0)+1),e%2==0?i+=1:n+=1,e<=x?m+=1:d+=1}),(null!=(s=e.bonus_numbers)?s:[]).filter(e=>Number.isFinite(e)).map(e=>Math.trunc(e)).forEach(e=>{var t;l.set(e,(null!=(t=l.get(e))?t:0)+1)})});let h=n+i,u=d+m,b=c(a,5),p=o(a,t,5),g=s>0?c(l,5):[],f=s>0?o(l,s,5):[];return{totalDraws:e.length,topRepeats:b,coldNumbers:p,oddPct:h?n/h:0,evenPct:h?i/h:0,highPct:u?d/u:0,lowPct:u?m/u:0,highLowLabel:{low:r(1,x),high:r(x+1,t)},bonusRepeats:g,bonusCold:f,hasBonus:s>0}})(j,f.mainRange,f.bonusRange),[j,f.mainRange,f.bonusRange]),R=E?(e=>{let t=Math.max(5,Math.min(95,Math.round(100*e)));return{left:t,right:100-t}})(E.lowPct):null,M=f.name?"".concat(f.name," Insights"):"Lottery Pattern Insights",P="embedded"===g,S=(0,a.jsxs)(a.Fragment,{children:[P?(0,a.jsxs)(a.Fragment,{children:[v&&(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Loading insights..."}),k&&(0,a.jsx)("p",{className:"rounded-lg border border-rose-500/40 bg-rose-500/10 px-3 py-2 text-xs text-rose-200",children:k})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-3 text-center sm:text-left",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.35em] text-emerald-200/70",children:"Lottery Pattern Insights"}),(0,a.jsx)("h3",{className:"text-2xl font-bold text-white",children:M}),(0,a.jsxs)("p",{className:"text-xs text-white/60",children:["Tracking the last ",p," draws for repeats, gaps, parity, and bonus ball behavior."]})]}),v&&(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Loading insights..."}),k&&(0,a.jsx)("p",{className:"rounded-lg border border-rose-500/40 bg-rose-500/10 px-3 py-2 text-xs text-rose-200",children:k})]}),E?(0,a.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3 ".concat(P?"mt-4":"mt-5"),children:[(0,a.jsxs)("div",{className:"rounded-2xl border border-emerald-400/20 bg-black/35 p-4",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.25em] text-emerald-200/70",children:"Main - Hot/Cold Numbers"}
1),(0,a.jsx)(m,{items:E.topRepeats,emptyLabel:"No repeats yet."}),(0,a.jsx)("div",{className:"mt-3 text-xs font-semibold uppercase tracking-[0.2em] text-white/50",children:"Cold numbers"}),(0,a.jsx)(x,{items:E.coldNumbers,emptyLabel:"None"})]}),(0,a.jsxs)("div",{className:"rounded-2xl border border-emerald-400/20 bg-black/35 p-4",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.25em] text-emerald-200/70",children:"Odd vs even numbers"}),(0,a.jsxs)("div",{className:"mt-2 flex items-center justify-between text-xs text-white/70",children:[(0,a.jsxs)("span",{children:["Odd ",i(E.oddPct),"%"]}),(0,a.jsxs)("span",{children:["Even ",i(E.evenPct),"%"]})]}),(0,a.jsx)(d,{leftPercent:i(E.oddPct),rightPercent:i(E.evenPct)}),(0,a.jsxs)("div",{className:"mt-4 border-t border-white/10 pt-4",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.25em] text-emerald-200/70",children:"High vs low numbers"}),(0,a.jsxs)("div",{className:"mt-2 flex items-center justify-between text-xs text-white/70",children:[(0,a.jsxs)("span",{children:["Low ",E.highLowLabel.low,": ",i(E.lowPct),"%"]}),(0,a.jsxs)("span",{children:["High ",E.highLowLabel.high,": ",i(E.highPct),"%"]})]}),(0,a.jsxs)("div",{className:"mt-3 flex h-2 w-full overflow-hidden rounded-full bg-white/10",children:[(0,a.jsx)("div",{className:"h-2 bg-cyan-400",style:{width:"".concat(null!=(t=null==R?void 0:R.left)?t:50,"%")}}),(0,a.jsx)("div",{className:"h-2 bg-purple-300",style:{width:"".concat(null!=(s=null==R?void 0:R.right)?s:50,"%")}})]})]})]}),(0,a.jsxs)("div",{className:"rounded-2xl border border-emerald-400/20 bg-black/35 p-4 md:col-span-2 xl:col-span-1",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.25em] text-emerald-200/70",children:"Bonus - Hot/Cold Numbers"}),E.hasBonus?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m,{items:E.bonusRepeats,emptyLabel:"No repeats yet."}),(0,a.jsx)("div",{className:"mt-3 text-xs font-semibold uppercase tracking-[0.2em] text-white/50",children:"Cold bonus"}),(0,a.jsx)(x,{items:E.bonusCold,emptyLabel:"None"})]}):(0,a.jsx)("p",{className:"mt-2 text-sm text-white/80",children:"No bonus ball for this lottery."})]})]}):!v&&!k&&(0,a.jsx)("p",{className:"mt-4 text-xs text-white/60",children:"No draw history available yet."})]});return P?!v||E||k?(0,a.jsx)("div",{className:"mt-4",children:S}):(0,a.jsx)("div",{className:"mt-4 min-h-[520px] sm:min-h-[420px]",children:(0,a.jsx)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:[0,1,2].map(e=>(0,a.jsx)("div",{className:"h-40 animate-pulse rounded-2xl border border-emerald-400/20 bg-white/5","aria-hidden":"true"},"insight-skeleton-".concat(e)))})}):(0,a.jsx)("section",{className:"rounded-3xl border border-white/10 bg-gradient-to-br from-slate-950 via-slate-900/70 to-black p-6 text-white shadow-2xl",children:S})}function u(e){var t,s;let{lotteryId:r,mainRange:i,bonusRange:d=0,showInsights:c=!1}=e,[o,m]=(0,l.useState)(!0),[x,u]=(0,l.useState)({id:r,name:null,main:i,bonus:d});return(0,l.useEffect)(()=>{let e=e=>{let t=e.detail;(null==t?void 0:t.id)&&(0,l.startTransition)(()=>{u(e=>{var s,a,l,n;return{id:null!=(s=t.id)?s:e.id,name:null!=(a=t.name)?a:e.name,main:null!=(l=t.mainRange)?l:e.main,bonus:null!=(n=t.bonusRange)?n:e.bonus}})})};return window.addEventListener("lottery-change",e),()=>window.removeEventListener("lottery-change",e)},[d,i]),(0,a.jsx)("section",{className:"min-h-[620px] rounded-3xl border border-white/10 bg-white/5 p-4 sm:min-h-[520px] sm:p-6",children:(0,a.jsxs)("div",{className:"space-y-3 text-center",children:[(0,a.jsxs)("p",{className:"text-2xl font-bold text-white",children:["Spot Patterns? ",(0,a.jsx)("span",{className:"text-emerald-300",children:"ai spots more."})]}),(0,a.jsx)(n.A,{lotteryId:x.id,lotteryName:null!=(t=x.name)?t:void 0,mainRange:x.main,showBonus:o,onToggleBonus:m}),c?(0,a.jsx)(h,{initialLotteryId:x.id,initialLotteryName:null!=(s=x.name)?s:"Lottery",initialMainRange:x.main,initialBonusRange:x.bonus,variant:"embedded"}):null]})})}},88072:(e,t,s)=>{s.d(t,{A:()=>n});var a=s(95155),l=s(12115);function n(e){let{lotteryId:t,lotteryName:s,mainRange:n,limit:r=18,showBonus:i=!0,onToggleBonus:d}=e,[c,o]=(0,l.useState)([]),[m,x]=(0,l.useState)(!1),[h,u]=(0,l.useState)(null);(0,l.useEffect)(()=>
1{if(!t)return void o([]);let e=!1;return(async()=>{x(!0),u(null);try{let a=await fetch("/api/analytics/number-matrix?lotteryId=".concat(t,"&limit=").concat(r));if(!a.ok)throw Error("Failed to load pattern grid");let l=await a.json();if(!e){var s;o(null!=(s=l.draws)?s:[])}}catch(t){e||u(t instanceof Error?t.message:"Failed to load data")}finally{e||x(!1)}})(),()=>{e=!0}},[t,r]);let b=(0,l.useMemo)(()=>Array.from({length:n},(e,t)=>t+1),[n]);return t?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 text-sm text-white",children:[(0,a.jsxs)("div",{className:"space-y-1 text-left",children:[(0,a.jsx)("p",{className:"font-semibold text-base sm:text-lg text-white",children:s?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("span",{className:"text-emerald-300",children:[s,"\xae"]})," Insights from the Past 18 Draws"]}):"Insights from the Past 18 Draws"}),(0,a.jsxs)("p",{className:"text-xs text-white/60",children:["Each row is a past draw. Green"," ",(0,a.jsx)("span",{className:"inline-flex items-center gap-1",children:(0,a.jsx)("span",{className:"inline-block h-2 w-2 rounded-full bg-emerald-400"})})," ","= main numbers. Yellow"," ",(0,a.jsx)("span",{className:"inline-flex items-center gap-1",children:(0,a.jsx)("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-300"})})," ","= bonus number."]})]}),(d||m)&&(0,a.jsxs)("div",{className:"flex flex-col items-end gap-2 text-xs text-white/70",children:[d&&(0,a.jsxs)("label",{className:"flex items-center gap-1 text-white",children:[(0,a.jsx)("input",{type:"checkbox",className:"accent-emerald-400",checked:i,onChange:e=>d(e.target.checked)}),"Show bonus balls"]}),m&&(0,a.jsx)("span",{children:"Loadingâ¦"})]})]}),h&&(0,a.jsx)("div",{className:"text-xs text-red-400 bg-red-400/10 border border-red-500/40 rounded px-3 py-2",children:h}),(0,a.jsx)("div",{className:"space-y-[2px]",children:c.map(e=>{let t=new Set(e.main_numbers);return(0,a.jsx)("div",{className:"grid gap-[1px]",style:{gridTemplateColumns:"repeat(".concat(n,", minmax(0, 1fr))")},children:b.map(s=>{var l;let n=t.has(s),r=i&&(null==(l=e.bonus_numbers)?void 0:l.includes(s)),d="";return n&&r?d="bg-amber-500":r?d="bg-amber-300":n&&(d="bg-emerald-400"),(0,a.jsxs)("div",{className:"relative h-[0.45rem] flex items-center justify-center",children:[(0,a.jsx)("span",{className:"absolute inset-x-0 top-1/2 block h-px -translate-y-1/2 bg-white/10"}),d&&(0,a.jsx)("span",{className:"block rounded-full ".concat(d),style:{width:"0.24rem",height:"0.24rem"}})]},s)})},e.id)})})]}):null}}}]);
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.