(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6901],{16120:function(e,t,s){Promise.resolve().then(s.bind(s,20513))},87461:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});var r=s(64090),a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),n=(e,t)=>{let s=(0,r.forwardRef)((s,n)=>{let{color:l="currentColor",size:c=24,strokeWidth:d=2,absoluteStrokeWidth:o,className:x="",children:h,...u}=s;return(0,r.createElement)("svg",{ref:n,...a,width:c,height:c,stroke:l,strokeWidth:o?24*Number(d)/Number(c):d,className:["lucide","lucide-".concat(i(e)),x].join(" "),...u},[...t.map(e=>{let[t,s]=e;return(0,r.createElement)(t,s)}),...Array.isArray(h)?h:[h]])});return s.displayName="".concat(e),s}},53879:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},37841:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},18994:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},63013:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]])},13716:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("MousePointerClick",[["path",{d:"m9 9 5 12 1.8-5.2L21 14Z",key:"1b76lo"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}]])},90043:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]])},73354:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]])},34059:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},47907:function(e,t,s){"use strict";var r=s(15313);s.o(r,"useParams")&&s.d(t,{useParams:function(){return r.useParams}}),s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},20513:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return g}});var r=s(3827),a=s(64090),i=s(89966),n=s(47907),l=s(18994),c=s(63013),d=s(90043),o=s(73354),x=s(53879),h=s(37841),u=s(34059),m=s(13716),p=s(71774);function g(){let e=(0,n.useRouter)(),t=(0,n.useParams)().id,{t:s}=(0,p.Z)(),{data:g,isLoading:b,error:y}=(0,i.ZP)(t?"/api/analytics/".concat(t):null);if((0,a.useEffect)(()=>{y&&e.push("/dashboard")},[y,e]),b)return(0,r.jsx)("div",{className:"flex items-center justify-center min-h-[60vh]",children:(0,r.jsx)(l.Z,{className:"h-8 w-8 animate-spin text-gray-500"})});if(!g)return null;let f=Math.max(...g.dailyViews.map(e=>e.views),1),w=g.deviceBreakdown.mobile+g.deviceBreakdown.desktop+g.deviceBreakdown.tablet,j=[{key:"desktop",icon:c.Z,barClass:"bg-blue-500",iconClass:"text-blue-500",label:"Desktop"},{key:"mobile",icon:d.Z,barClass:"bg-green-500",iconClass:"text-green-500",label:"Mobile"},{key:"tablet",icon:o.Z,barClass:"bg-purple-500",iconClass:"text-purple-500",label:"Tablet"}];return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)("button",{onClick:()=>e.push("/dashboard"),className:"text-gray-400 hover:text-white hover:bg-white/[0.06] px-3 py-2 rounded-lg transition-colors inline-flex items-center",children:[(0,r.jsx)(x.Z,{className:"h-4 w-4 mr-1"})," ",s("back")]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-white",children:s("analytics")}),(0,r.jsx)("p",{className:"text-gray-400 text-sm",children:g.pageTitle})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,r.jsxs)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-2xl p-6 flex items-center gap-4",children:[(0,r.jsx)("div",{className:"p-3 bg-blue-500/10 rounded-full",children:(0,r.jsx)(h.Z,{className:"h-6 w-6 text-blue-400"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-2xl font-bold text-white",children:g.totalViews.toLocaleString()}),(0,r.jsx)("p",{className:"text-sm text-gray-400",children:s("totalViews")})]})]}),(0,r.jsxs)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-2xl p-6 flex items-center gap-4",children:[(0,r.jsx)("div",{className:"p-3 bg-green-500/10 rounded-full",children:(0,r.jsx)(u.Z,{className:"h-6 w-6 text-green-400"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-2xl font-bold text-white",children:g.uniqueVisitors.toLocaleString()}),(0,r.jsx)("p",{className:"text-sm text-gray-400",children:s("uniqueVisitors")})]})]}),(0,r.jsxs)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-2xl p-6 flex items-center gap-4",children:[(0,r.jsx)("div",{className:"p-3 bg-amber-500/10 rounded-full",children:(0,r.jsx)(m.Z,{className:"h-6 w-6 text-amber-400"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-2xl font-bold text-white",children:g.ctaClicks.toLocaleString()}),(0,r.jsx)("p",{className:"text-sm text-gray-400",children:s("ctaClicks")})]})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,r.jsxs)("div",{className:"lg:col-span-2 bg-white/[0.03] border border-white/[0.06] rounded-2xl p-6",children:[(0,r.jsx)("h3",{className:"text-gray-200 font-semibold mb-4",children:s("dailyViews")}),0===g.dailyViews.length?(0,r.jsx)("p",{className:"text-gray-500 text-sm",children:s("noData")}):(0,r.jsx)("div",{className:"flex items-end gap-1 h-48",children:g.dailyViews.map(e=>(0,r.jsx)("div",{className:"flex-1 bg-indigo-500/30 hover:bg-indigo-500/50 rounded-t transition-colors relative group",style:{height:"".concat(e.views/f*100,"%"),minHeight:"4px"},children:(0,r.jsxs)("div",{className:"absolute -top-8 left-1/2 -translate-x-1/2 bg-[#12121f] text-white text-xs px-2 py-1 rounded border border-white/[0.08] opacity-0 group-hover:opacity-100 whitespace-nowrap",children:[e.date,": ",e.views]})},e.date))})]}),(0,r.jsxs)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-2xl p-6",children:[(0,r.jsx)("h3",{className:"text-gray-200 font-semibold mb-4",children:s("devices")}),(0,r.jsx)("div",{className:"space-y-4",children:j.map(e=>{let{key:t,icon:s,barClass:a,iconClass:i,label:n}=e;return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(s,{className:"h-4 w-4 ".concat(i)}),(0,r.jsx)("span",{className:"text-sm text-gray-300",children:n})]}),(0,r.jsxs)("span",{className:"font-medium text-white",children:[w>0?Math.round(g.deviceBreakdown[t]/w*100):0,"%"]})]}),(0,r.jsx)("div",{className:"w-full bg-white/[0.06] rounded-full h-2",children:(0,r.jsx)("div",{className:"".concat(a," h-2 rounded-full"),style:{width:"".concat(w>0?g.deviceBreakdown[t]/w*100:0,"%")}})})]},t)})})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,r.jsxs)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-2xl p-6",children:[(0,r.jsx)("h3",{className:"text-gray-200 font-semibold mb-4",children:s("topReferrers")}),0===g.topReferrers.length?(0,r.jsx)("p",{className:"text-gray-500 text-sm",children:s("noData")}):(0,r.jsx)("div",{className:"space-y-3",children:g.topReferrers.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm text-gray-300 truncate max-w-[200px]",children:e.referrer}),(0,r.jsx)("span",{className:"text-sm font-medium bg-white/[0.06] text-gray-300 rounded px-2 py-0.5",children:e.count})]},t))})]}),(0,r.jsxs)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-2xl p-6",children:[(0,r.jsx)("h3",{className:"text-gray-200 font-semibold mb-4",children:s("topCtaClicks")}),0===g.topCtaLabels.length?(0,r.jsx)("p",{className:"text-gray-500 text-sm",children:s("noData")}):(0,r.jsx)("div",{className:"space-y-3",children:g.topCtaLabels.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm text-gray-300 truncate max-w-[200px]",children:e.label}),(0,r.jsx)("span",{className:"text-sm font-medium bg-amber-500/10 text-amber-400 px-2 py-0.5 rounded",children:e.count})]},t))})]})]})]})}}},function(e){e.O(0,[9966,1774,2971,8069,1744],function(){return e(e.s=16120)}),_N_E=e.O()}]);