1import{c as e,r as s,j as a,h as t,i as l,S as r}from"./main-DnEwdPd8.js";import{a as n}from"./clickLogs-DURmdQvH.js";import{G as i}from"./globe-WSwsd6nC.js";import{T as c}from"./triangle-alert-B1iHYsKt.js"; 2/** 3 * @license lucide-react v0.460.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const d=e("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]),o=e("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]),m=e("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]),x=e("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]),h=e("WalletCards",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]]),p=[{label:"ìµê·¼ 7ì¼",value:"7d"},{label:"ìµê·¼ 30ì¼",value:"30d"},{label:"ìµê·¼ 90ì¼",value:"90d"}],u=Array.from({length:24},(e,s)=>`${String(s).padStart(2,"0")}ì`),g=e=>"7d"===e?7:"90d"===e?90:30,j=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,y=(e,s)=>0===s?0===e?0:100:(e-s)/s*100,f=({value:e})=>{const s=e>=0,t=s?o:d;return a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-semibold "+(s?"text-emerald-600":"text-red-600"),children:[a.jsx(t,{className:"w-3.5 h-3.5"}),Math.abs(e).toFixed(1),"%"]})}; 8/** 9 * @license lucide-react v0.460.0 - ISC 10 * 11 * This source code is licensed under the ISC license. 12 * See the LICENSE file in the root directory of this source tree. 13 */function N({platforms:e}){const[d,o]=s.useState("30d"),[N,b]=s.useState(!1),[v,w]=s.useState(""),[k,S]=s.useState([]),[M,D]=s.useState([]);s.useEffect(()=>{(async()=>{b(!0),w("");try{const e=g(d),s=Date.now(),a=864e5,t=new Date(s-e*a).toISOString(),l=new Date(s-2*e*a).toISOString(),{currentLogs:r,previousLogs:i}=await n(t,l);S(r),D(i)}catch(e){(e instanceof Error?e.message:String(e)).toLowerCase().includes("row-level security")?w("íµê³ ì¡°í ê¶íì´ ììµëë¤. click_logs SELECT ì ì± ì íì¸í´ì£¼ì¸ì."):w("íµê³ ë°ì´í°ë¥¼ ë¶ë¬ì¤ì§ 못íìµëë¤. ì ì í ë¤ì ìëí´ì£¼ì¸ì.")}finally{b(!1)}})()},[d]);const C=s.useMemo(()=>new Map(e.map(e=>[e.id,e.name])),[e]),L=s.useMemo(()=>{const e=k.length,s=M.length,a=new Set(k.map(e=>e.user_id).filter(Boolean)).size,t=new Set(M.map(e=>e.user_id).filter(Boolean)).size,l=k.filter(e=>Boolean(e.platform_id)).length,r=M.filter(e=>Boolean(e.platform_id)).length,n=e>0?l/e*100:0,i=s>0?r/s*100:0,c=new Set(k.map(e=>e.item_id).filter(Boolean)).size,d=new Set(M.map(e=>e.item_id).filter(Boolean)).size;return{totalClicks:e,totalClicksDelta:y(e,s),uniqueUsers:a,uniqueUsersDelta:y(a,t),mappedRate:n,mappedRateDelta:y(n,i),uniqueItems:c,uniqueItemsDelta:y(c,d)}},[k,M]),_=s.useMemo(()=>{const e=new Map;
13k.forEach(s=>{const a=s.platform_id||"unmapped";e.set(a,(e.get(a)||0)+1)});const s=k.length||1;return Array.from(e.entries()).map(([e,a])=>({platformId:e,name:"unmapped"===e?"미매í":C.get(e)||"ì ì ìë íë«í¼",count:a,rate:a/s*100})).sort((e,s)=>s.count-e.count).slice(0,6)},[k,C]),q=s.useMemo(()=>{const e=new Map;return k.forEach(s=>{const a=(e=>{if(!e)return"ì ì ìì";try{return new URL(e).hostname.replace(/^www\./,"")}catch{return"ì ì ìì"}})(s.original_url);e.set(a,(e.get(a)||0)+1)}),Array.from(e.entries()).map(([e,s])=>({domain:e,count:s})).sort((e,s)=>s.count-e.count).slice(0,8)},[k]),R=s.useMemo(()=>{const e=g(d),s=new Date,a=new Map;for(let r=e-1;r>=0;r-=1){const e=new Date(s.getTime()-24*r*60*60*1e3),t=j(e);a.set(t,0)}k.forEach(e=>{const s=j(new Date(e.clicked_at));a.has(s)&&a.set(s,(a.get(s)||0)+1)});const t=Array.from(a.entries()).map(([e,s])=>({date:e,label:e.slice(5),count:s})),l=Math.max(...t.map(e=>e.count),1);return{points:t,maxCount:l}},[k,d]),z=s.useMemo(()=>{const e=Array.from({length:24},()=>0);
13k.forEach(s=>{const a=new Date(s.clicked_at).getHours();e[a]+=1});const s=Math.max(...e,1);return e.map((e,a)=>({hour:a,label:u[a],count:e,ratio:e/s*100}))},[k]),A=s.useMemo(()=>{const e=[];return L.mappedRate<60&&e.push("ì í´ ë§¤íë¥ ì´ 60% 미ë§ì
ëë¤. ëë©ì¸ 매ì¹/íì± íë«í¼ ì¤ì ì ì ê²íì¸ì."),L.totalClicksDelta<-20&&e.push("ì´ì ê¸°ê° ëë¹ í´ë¦ìê° 20% ì´ì ê°ìíìµëë¤. ìµê·¼ ë±ë¡ ì¼í몰/ìí í´ë¦ ëì ì ì ê²íì¸ì."),L.uniqueUsersDelta<-15&&e.push("íì± ì¬ì©ì ìê° ê°ì ì¤ì
ëë¤. ì ê· ì ì
(ì ì¥ ë²í¼ ë
¸ì¶/ì¨ë³´ë©) ê°ì ì´ íìí©ëë¤."),0===e.length&&e.push("íì¬ ì£¼ì ì§íê° ìì ì ì
ëë¤. ìì íë«í¼/ëë©ì¸ ì±ê³¼ë¥¼ ì ì§íì¸ì."),e},[L]);return N?a.jsx(t,{children:a.jsx(l,{className:"p-6 text-sm text-gray-600",children:"íµê³ ë°ì´í°ë¥¼ ë¶ë¬ì¤ë ì¤ì
ëë¤..."})}):v?a.jsx(t,{children:a.jsx(l,{className:"p-6",children:a.jsx("div",{className:"rounded-xl border border-red-200 bg-red-50 p-4 text-sm text-red-700",children:v})})}):a.jsxs("div",{className:"space-y-4",children:[a.jsx(t,{children:a.jsxs(l,{className:"p-6 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-gray-900",children:"ì´ì íµê³ ê°ì"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"GA íµì¬ ì§í를 ì´ì ê´ì ì¼ë¡ ë¨ìíí´ ì ê³µí©ëë¤."})]}),a.jsx("div",{className:"w-40",children:a.jsx(r,{value:d,onChange:o,options:p})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-3",children:[a.jsx(t,{className:"border-gray-200",children:a.jsxs(l,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-xs text-gray-500",children:"ì´ í´ë¦ ì´ë²¤í¸"}),a.jsx(m,{className:"w-4 h-4 text-primary-500"})]}),a.jsx("div",{className:"text-2xl font-bold text-gray-900",children:L.totalClicks.toLocaleString()}),a.jsx(f,{value:L.totalClicksDelta})]})}),a.jsx(t,{className:"border-gray-200",children:a.jsxs(l,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-xs text-gray-500",children:"íì± ì¬ì©ì"}),a.jsx(x,{className:"w-4 h-4 text-indigo-500"})]}),a.jsx("div",{className:"text-2xl font-bold text-gray-900",children:L.uniqueUsers.toLocaleString()}),a.jsx(f,{value:L.uniqueUsersDelta})]})}),a.jsx(t,{className:"border-gray-200",children:a.jsxs(l,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-xs text-gray-500",children:"ì í´ ë§¤íë¥ "}),a.jsx(h,{className:"w-4 h-4 text-emerald-500"})]}),a.jsxs("div",{className:"text-2xl font-bold text-gray-900",children:[L.mappedRate.toFixed(1),"%"]}),a.jsx(f,{value:L.mappedRateDelta})]})}),a.jsx(t,{className:"border-gray-200",children:a.jsxs(l,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-xs text-gray-500",children:"í´ë¦ë ìí ì"}),a.jsx(i,{className:"w-4 h-4 text-amber-500"})]}),a.jsx("div",{className:"text-2xl font-bold text-gray-900",children:L.uniqueItems.toLocaleString()}),a.jsx(f,{value:L.uniqueItemsDelta})]})})]})]})}),a.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[a.jsx(t,{children:a.jsxs(l,{className:"p-6",children:[a.jsx("h3",{className:"text-base font-bold text-gray-900 mb-4",children:"ì¼ìë³ í´ë¦ ì¶ì¸"}),a.jsx("div",{className:"space-y-2",children:R.points.map(e=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"w-14 text-xs text-gray-500",children:e.label}),a.jsx("div",{className:"flex-1 h-2.5 bg-gray-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-primary-500 rounded-full",style:{width:e.count/R.maxCount*100+"%"}})}),a.jsx("span",{className:"w-10 text-right text-xs font-semibold text-gray-700",children:e.count})]},e.date))})]})}),a.jsx(t,{children:a.jsxs(l,{className:"p-6",children:[a.jsx("h3",{className:"text-base font-bold text-gray-900 mb-4",children:"ìì íë«í¼ 기ì¬ë"}),a.jsxs("div",{className:"space-y-3",children:[0===_.length&&a.jsx("div",{className:"text-sm text-gray-500",children:"íìí ë°ì´í°ê° ììµëë¤."}),_.map(e=>a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{className:"font-medium text-gray-800",children:e.name}),a.jsxs("span",{className:"text-gray-600",children:[e.count.toLocaleStr
13ing()," (",e.rate.toFixed(1),"%)"]})]}),a.jsx("div",{className:"h-2.5 bg-gray-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-indigo-500 rounded-full",style:{width:`${e.rate}%`}})})]},e.platformId))]})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[a.jsx(t,{children:a.jsxs(l,{className:"p-6",children:[a.jsx("h3",{className:"text-base font-bold text-gray-900 mb-4",children:"ìê°ëë³ í´ë¦ ë¶í¬"}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:z.map(e=>a.jsxs("div",{className:"rounded-lg border border-gray-200 p-2",children:[a.jsx("div",{className:"text-xs text-gray-500 mb-1",children:e.label}),a.jsx("div",{className:"h-1.5 bg-gray-100 rounded-full overflow-hidden mb-1",children:a.jsx("div",{className:"h-full bg-emerald-500 rounded-full",style:{width:`${e.ratio}%`}})}),a.jsx("div",{className:"text-xs font-semibold text-gray-700",children:e.count})]},e.hour))})]})}),a.jsx(t,{children:a.jsxs(l,{className:"p-6",children:[a.jsx("h3",{className:"text-base font-bold text-gray-900 mb-4",children:"ìì ì ì
ëë©ì¸"}),a.jsxs("div",{className:"space-y-2",children:[0===q.length&&a.jsx("div",{className:"text-sm text-gray-500",children:"íìí ë°ì´í°ê° ììµëë¤."}),q.map(e=>a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-200 px-3 py-2 text-sm",children:[a.jsx("span",{className:"font-medium text-gray-800",children:e.domain}),a.jsx("span",{className:"text-gray-600",children:e.count.toLocaleString()})]},e.domain))]})]})})]}),a.jsx(t,{children:a.jsxs(l,{className:"p-6",children:[a.jsx("h3",{className:"text-base font-bold text-gray-900 mb-3",children:"ì´ì ì¸ì¬ì´í¸"}),a.jsx("div",{className:"space-y-2",children:A.map((e,s)=>a.jsxs("div",{className:"flex items-start gap-2 text-sm text-gray-700",children:[a.jsx(c,{className:"w-4 h-4 mt-0.5 text-amber-500"}),a.jsx("span",{children:e})]},`${e}-${s}`))})]})})]})}export{N as AnalyticsOverviewPanel};
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.