"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[689],{2689:(e,s,t)=>{t.d(s,{default:()=>ea});var a=t(5155),r=t(2115),l=t(1567);let i=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...r})});i.displayName="Card",r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",t),...r})}).displayName="CardHeader",r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",t),...r})}).displayName="CardTitle",r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("text-sm text-muted-foreground",t),...r})}).displayName="CardDescription",r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("p-6 pt-0",t),...r})}).displayName="CardContent",r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("flex items-center p-6 pt-0",t),...r})}).displayName="CardFooter";let n=r.forwardRef((e,s)=>{let{className:t,type:r,...i}=e;return(0,a.jsx)("input",{type:r,className:(0,l.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:s,...i})});n.displayName="Input";var o=t(3312),c=t(853),d=t(6889),m=t(865),h=t(5686),x=t(767),u=t(872),g=t(5564);let f="search_history";var p=t(3084),j=t(4113);function v(e){let{data:s}=e,{SiteName:t,Title:r,Description:l,LargeScreenshot:i}=s;return(0,a.jsxs)("div",{className:"rounded-xl border bg-blue-50/50 p-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3 mb-6",children:[(0,a.jsx)("svg",{className:"h-6 w-6 text-blue-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M21 12a9 9 0 0 1-9 9m9-9a9 9 0 0 0-9-9m9 9H3m9 9a9 9 0 0 1-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 0 1 9-9"})}),(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-800",children:t||"No SiteName"})]}),(0,a.jsxs)("div",{className:"bg-white/80 rounded-lg border p-4 mb-6 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("svg",{className:"h-5 w-5 text-blue-400 flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M4 7V4h16v3"}),(0,a.jsx)("path",{d:"M9 20h6"}),(0,a.jsx)("path",{d:"M12 4v16"})]}),(0,a.jsx)("p",{className:"text-sm text-gray-600",children:r||"No Title"})]}),(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsxs)("svg",{className:"h-5 w-5 text-blue-400 flex-shrink-0 mt-0.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"}),(0,a.jsx)("path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"})]}),(0,a.jsx)("p",{className:"text-sm text-gray-600 break-words",children:l||"No Description"})]})]}),i&&(0,a.jsx)("div",{className:"overflow-hidden rounded-lg border shadow-sm max-w-[66%] mx-auto",children:(0,a.jsx)("img",{src:i,alt:t||"Screenshot",className:"w-full h-auto hover:scale-105 transition-transform duration-300",loading:"lazy"})})]})}var w=t(3601),N=t(8617);function y(e){let{data:s}=e,{GlobalRank:t,CountryRank:r,CategoryRank:l}=s;return(0,a.jsxs)("div",{className:"rounded-xl border bg-green-50/50 p-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("svg",{className:"h-5 w-5 text-green-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("rect",{x:"2",y:"12",width:"6",height:"10"}),(0,a.jsx)("rect",{x:"9",y:"8",width:"6",height:"14"}),(0,a.jsx)("rect",{x:"16",y:"16",width:"6",height:"6"})]}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"排名"})]}),(0,a.jsx)(w.Bc,{children:(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{children:(0,a.jsx)(N.A,{className:"h-4 w-4 text-gray-400"})}),(0,a.jsx)(w.ZI,{children:(0,a.jsx)("p",{className:"text-sm",children:"网站在不同类别的排名情况"})})]})})]}),(0,a.jsx)("div",{className:"grid gap-4 md:grid-cols-3",children:(0,a.jsxs)(w.Bc,{children:[(0,a.jsx)("div",{className:"p-4 rounded-lg bg-white/70 border text-center",children:(0,a.jsxs)(w.m_,{children:[(0,a.jsxs)(w.k$,{children:[(0,a.jsx)("div",{className:"flex items-center justify-center gap-2 mb-2",children:(0,a.jsxs)("svg",{className:"h-4 w-4 text-purple-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,a.jsx)("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),(0,a.jsx)("path",{d:"M2 12h20"})]})}),(0,a.jsxs)("p",{className:"text-3xl font-bold text-purple-600",children:["#",(null==t?void 0:t.Rank)||"N/A"]})]}),(0,a.jsx)(w.ZI,{children:(0,a.jsx)("p",{children:"全球排名"})})]})}),(0,a.jsx)("div",{className:"p-4 rounded-lg bg-white/70 border text-center",children:(0,a.jsxs)(w.m_,{children:[(0,a.jsxs)(w.k$,{children:[(0,a.jsx)("div",{className:"flex items-center justify-center gap-2 mb-2",children:(0,a.jsxs)("svg",{className:"h-4 w-4 text-indigo-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"}),(0,a.jsx)("circle",{cx:"12",cy:"10",r:"3"})]})}),(0,a.jsxs)("p",{className:"text-3xl font-bold text-indigo-600",children:["#",(null==r?void 0:r.Rank)||"N/A"]})]}),(0,a.jsx)(w.ZI,{children:(0,a.jsxs)("p",{children:["国家或地区排名 (",(null==r?void 0:r.CountryCode)||"N/A",")"]})})]})}),(0,a.jsx)("div",{className:"p-4 rounded-lg bg-white/70 border text-center",children:(0,a.jsxs)(w.m_,{children:[(0,a.jsxs)(w.k$,{children:[(0,a.jsx)("div",{className:"flex items-center justify-center gap-2 mb-2",children:(0,a.jsxs)("svg",{className:"h-4 w-4 text-pink-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),(0,a.jsx)("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]})}),(0,a.jsxs)("p",{className:"text-3xl font-bold text-pink-600",children:["#",(null==l?void 0:l.Rank)||"N/A"]})]}),(0,a.jsx)(w.ZI,{children:(0,a.jsxs)("p",{children:["类别排名 (",(null==l?void 0:l.Category)||"N/A",")"]})})]})})]})})]})}function b(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toString()}function k(e){let{data:s}=e,{Engagments:t}=s;return(0,a.jsxs)("div",{className:"rounded-xl border bg-indigo-50/50 p-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("svg",{className:"h-5 w-5 text-indigo-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),(0,a.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,a.jsx)("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),(0,a.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"用户参与度"})]}),(0,a.jsx)(w.Bc,{children:(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{children:(0,a.jsx)(N.A,{className:"h-4 w-4 text-gray-400"})}),(0,a.jsx)(w.ZI,{children:(0,a.jsx)("p",{className:"text-sm",children:"用户参与度关键指标"})})]})})]}),(0,a.jsx)("div",{className:"grid gap-4 md:grid-cols-4",children:(0,a.jsxs)(w.Bc,{children:[(0,a.jsx)("div",{className:"p-4 rounded-lg bg-white/70 border text-center",children:(0,a.jsxs)(w.m_,{children:[(0,a.jsxs)(w.k$,{children:[(0,a.jsx)("div",{className:"flex items-center justify-center gap-2 mb-2",children:(0,a.jsxs)("svg",{className:"h-4 w-4 text-gray-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})}),(0,a.jsx)("p",{className:"text-2xl font-bold",children:"string"==typeof(null==t?void 0:t.Visits)?b(Number(t.Visits)):"N/A"})]}),(0,a.jsx)(w.ZI,{children:(0,a.jsx)("p",{children:"Monthly Visits"})})]})}),(0,a.jsx)("div",{className:"p-4 rounded-lg bg-white/70 border text-center",children:(0,a.jsxs)(w.m_,{children:[(0,a.jsxs)(w.k$,{children:[(0,a.jsx)("div",{className:"flex items-center justify-center gap-2 mb-2",children:(0,a.jsx)("svg",{className:"h-4 w-4 text-gray-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M3 12h4l3 8 4-16 3 8h4"})})}),(0,a.jsx)("p",{className:"text-2xl font-bold",children:"string"==typeof(null==t?void 0:t.PagePerVisit)?Number(t.PagePerVisit).toFixed(1):"N/A"})]}),(0,a.jsx)(w.ZI,{children:(0,a.jsx)("p",{children:"Pages per Visit"})})]})}),(0,a.jsx)("div",{className:"p-4 rounded-lg bg-white/70 border text-center",children:(0,a.jsxs)(w.m_,{children:[(0,a.jsxs)(w.k$,{children:[(0,a.jsx)("div",{className:"flex items-center justify-center gap-2 mb-2",children:(0,a.jsx)("svg",{className:"h-4 w-4 text-gray-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"})})}),(0,a.jsx)("p",{className:"text-2xl font-bold",children:"string"==typeof(null==t?void 0:t.BounceRate)?"".concat((100*Number(t.BounceRate)).toFixed(2),"%"):"N/A"})]}),(0,a.jsx)(w.ZI,{children:(0,a.jsx)("p",{children:"Bounce Rate"})})]})}),(0,a.jsx)("div",{className:"p-4 rounded-lg bg-white/70 border text-center",children:(0,a.jsxs)(w.m_,{children:[(0,a.jsxs)(w.k$,{children:[(0,a.jsx)("div",{className:"flex items-center justify-center gap-2 mb-2",children:(0,a.jsxs)("svg",{className:"h-4 w-4 text-gray-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,a.jsx)("polyline",{points:"12 6 12 12 16 14"})]})}),(0,a.jsx)("p",{className:"text-2xl font-bold",children:"string"==typeof(null==t?void 0:t.TimeOnSite)?function(e){let s=Math.floor(e/3600),t=Math.floor(e%3600/60),a=Math.floor(e%60),r=[];return s>0&&r.push(s.toString().padStart(2,"0")),r.push(t.toString().padStart(2,"0")),r.push(a.toString().padStart(2,"0")),r.join(":")}(Number(t.TimeOnSite)):"N/A"})]}),(0,a.jsx)(w.ZI,{children:(0,a.jsx)("p",{children:"Avg. Visit Duration"})})]})})]})})]})}var S=t(5781);function C(e){let{monthlyData:s}=e,t=(0,r.useRef)(null),l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!t.current)return;let e=Object.entries(s||{}).sort((e,s)=>{let[t]=e,[a]=s;return new Date(t).getTime()-new Date(a).getTime()}),a=e.map(e=>{let[s]=e;return new Date(s).toLocaleDateString("en-US",{month:"short",year:"2-digit"})}),r=e.map(e=>{let[,s]=e;return s});return l.current&&l.current.destroy(),l.current=new S.t1(t.current,{type:"line",data:{labels:a,datasets:[{label:"Monthly Visits",data:r,borderColor:"rgb(59, 130, 246)",backgroundColor:"rgba(59, 130, 246, 0.1)",borderWidth:2,fill:!0,tension:.4,pointRadius:4,pointBackgroundColor:"white",pointBorderColor:"rgb(59, 130, 246)",pointBorderWidth:2}]},options:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:"rgba(0, 0, 0, 0.8)",padding:12,callbacks:{label:function(e){return"Visits: ".concat(b(e.raw))}}}},scales:{x:{grid:{display:!1}},y:{beginAtZero:!0,ticks:{callback:function(e){return b(Number(e))}}}}}}),()=>{l.current&&l.current.destroy()}},[s]),(0,a.jsx)("div",{className:"relative h-[300px]",children:(0,a.jsx)("canvas",{ref:t})})}function A(e){let{trafficSources:s}=e,t=(0,r.useRef)(null),l=(0,r.useRef)(null),i=["rgba(99, 102, 241, 0.85)","rgba(34, 197, 94, 0.85)","rgba(249, 115, 22, 0.85)","rgba(168, 85, 247, 0.85)","rgba(236, 72, 153, 0.85)","rgba(14, 165, 233, 0.85)","rgba(234, 179, 8, 0.85)","rgba(239, 68, 68, 0.85)","rgba(20, 184, 166, 0.85)","rgba(139, 92, 246, 0.85)"],n=Object.entries(s||{}).filter(e=>{let[,s]=e;return s>0}).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t});return(0,r.useEffect)(()=>{if(!t.current)return;let e=n.map(e=>{let[s,t]=e;return{source:s,value:100*t}});return l.current&&l.current.destroy(),l.current=new S.t1(t.current,{type:"pie",data:{labels:e.map(e=>e.source),datasets:[{data:e.map(e=>e.value),backgroundColor:i.slice(0,e.length),borderColor:"white",borderWidth:2,hoverBorderWidth:0,hoverOffset:15}]},options:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:"rgba(0, 0, 0, 0.8)",padding:12,titleFont:{size:14,weight:"bold"},bodyFont:{size:13},callbacks:{label:function(e){return"".concat(e.label,": ").concat(e.raw.toFixed(1),"%")}}}}}}),()=>{l.current&&l.current.destroy()}},[s]),(0,a.jsxs)("div",{className:"flex flex-col lg:flex-row items-stretch gap-8",children:[(0,a.jsx)("div",{className:"w-full lg:w-[60%] bg-white/70 rounded-xl border shadow-sm flex items-center",children:(0,a.jsx)("div",{className:"relative h-[300px] m-4 w-full",children:(0,a.jsx)("canvas",{ref:t})})}),(0,a.jsx)("div",{className:"w-full lg:w-[40%] bg-white/70 rounded-xl border p-6 shadow-sm",children:(0,a.jsx)("div",{className:"space-y-3",children:n.map((e,s)=>{let[t,r]=e;return(0,a.jsxs)("div",{className:"flex items-center p-3 rounded-lg bg-gray-50/80 hover:bg-gray-50 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[(0,a.jsx)("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:i[s]}}),(0,a.jsx)("span",{className:"font-medium text-gray-700",children:t})]}),(0,a.jsxs)("div",{className:"flex items-baseline gap-1",children:[(0,a.jsx)("span",{className:"text-lg font-semibold text-gray-900",children:(100*r).toFixed(1)}),(0,a.jsx)("span",{className:"text-sm text-gray-500",children:"%"})]})]},t)})})})]})}function z(e){let{data:s}=e,{EstimatedMonthlyVisits:t,TrafficSources:r}=s;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"rounded-xl border bg-orange-50/50 p-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("svg",{className:"h-5 w-5 text-orange-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M3 3v18h18"}),(0,a.jsx)("path",{d:"m19 9-5 5-4-4-3 3"})]}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"月访问量趋势"})]}),(0,a.jsx)(w.Bc,{children:(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{children:(0,a.jsx)(N.A,{className:"h-4 w-4 text-gray-400"})}),(0,a.jsx)(w.ZI,{children:(0,a.jsx)("p",{className:"text-sm",children:"网站月访问量趋势"})})]})})]}),(0,a.jsx)("div",{className:"bg-white/70 rounded-lg border p-4",children:(0,a.jsx)(C,{monthlyData:t})})]}),(0,a.jsxs)("div",{className:"rounded-xl border bg-cyan-50/50 p-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"h-5 w-5 text-cyan-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M22 2H2l8 9.46V19l4 2v-9.54L22 2Z"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"流量来源"})]}),(0,a.jsx)(w.Bc,{children:(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{children:(0,a.jsx)(N.A,{className:"h-4 w-4 text-gray-400"})}),(0,a.jsx)(w.ZI,{children:(0,a.jsx)("p",{className:"text-sm",children:"流量来源分布"})})]})})]}),(0,a.jsx)("div",{id:"traffic-sources-chart",children:(0,a.jsx)(A,{trafficSources:r})})]})]})}S.t1.register(S.PP,S.kc,S.FN,S.No,S.ZT,S.P$,S.hE,S.m_,S.s$,S.Bs,S.dN);var L=t(8197),E=t(7223),I=t(6122),T=t(2823),D=t(4226);function F(e){var s;let{data:t}=e,{TopCountryShares:r}=t,l=[...r||[]].sort((e,s)=>(s.Value||0)-(e.Value||0)),i=l.reduce((e,s)=>e+(s.Value||0),0),n=l.slice(0,5),o=l.slice(5),c=o.reduce((e,s)=>e+(s.Value||0),0);return(0,a.jsxs)("div",{className:"rounded-xl border bg-violet-50/50 p-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(L.A,{className:"h-5 w-5 text-violet-500"}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"地理分布"})]}),(0,a.jsx)(w.Bc,{children:(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{children:(0,a.jsx)(N.A,{className:"h-4 w-4 text-gray-400"})}),(0,a.jsx)(w.ZI,{children:(0,a.jsx)("p",{className:"text-sm",children:"流量来源分布"})})]})})]}),(0,a.jsxs)("div",{className:"grid gap-6 md:grid-cols-2",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[n.map((e,s)=>(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(E.A,{className:"h-3.5 w-3.5 text-violet-400"}),(0,a.jsx)("span",{className:"font-medium",children:e.CountryCode||"Unknown"})]}),(0,a.jsxs)("span",{className:"text-gray-600",children:[(100*(e.Value||0)).toFixed(1),"%"]})]}),(0,a.jsx)("div",{className:"h-2 w-full rounded-full bg-gray-100",children:(0,a.jsx)("div",{className:"h-full rounded-full bg-violet-500/80 transition-all",style:{width:"".concat((100*(e.Value||0)).toFixed(1),"%")}})})]},e.CountryCode)),o.length>0&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,a.jsx)("span",{className:"font-medium text-gray-600",children:"Others"}),(0,a.jsxs)("span",{className:"text-gray-600",children:[(100*c).toFixed(1),"%"]})]}),(0,a.jsx)("div",{className:"h-2 w-full rounded-full bg-gray-100",children:(0,a.jsx)("div",{className:"h-full rounded-full bg-gray-400/60 transition-all",style:{width:"".concat((100*c).toFixed(1),"%")}})})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"rounded-lg border bg-white/70 p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)(I.A,{className:"h-4 w-4 text-violet-500"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Top Region"})]}),(0,a.jsxs)("div",{className:"mt-1",children:[(0,a.jsx)("div",{className:"text-2xl font-bold text-gray-900",children:(null===(s=n[0])||void 0===s?void 0:s.CountryCode)||"N/A"}),(0,a.jsx)("div",{className:"text-sm text-gray-500 mt-1",children:n[0]?"".concat((100*n[0].Value).toFixed(1),"% of traffic"):"No data"})]})]}),(0,a.jsxs)("div",{className:"rounded-lg border bg-white/70 p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)(T.A,{className:"h-4 w-4 text-violet-500"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Regions"})]}),(0,a.jsxs)("div",{className:"mt-1",children:[(0,a.jsx)("div",{className:"text-2xl font-bold text-gray-900",children:(null==r?void 0:r.length)||0}),(0,a.jsx)("div",{className:"text-sm text-gray-500 mt-1",children:"Total regions"})]})]}),(0,a.jsxs)("div",{className:"rounded-lg border bg-white/70 p-4 col-span-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)(D.A,{className:"h-4 w-4 text-violet-500"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Coverage Rate"})]}),(0,a.jsxs)("div",{className:"flex items-end justify-between",children:[(0,a.jsxs)("div",{className:"text-2xl font-bold text-gray-900",children:[(100*i).toFixed(1),"%"]}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:"of total traffic tracked"})]})]})]})]})]})}var _=t(1864),B=t(6261),R=t(2509),M=t(9136),V=t(4807);function $(e){let{data:s}=e,{TopKeywords:t}=s,[i,n]=(0,r.useState)("EstimatedValue"),[o,c]=(0,r.useState)("desc"),d=e=>{i===e?c("asc"===o?"desc":"asc"):(n(e),c("desc"))},m=(t||[]).sort((e,s)=>("asc"===o?1:-1)*(e[i]-s[i])),h=Math.max(...m.map(e=>e.EstimatedValue)),x=e=>{let{field:s}=e;return i!==s?null:"asc"===o?(0,a.jsx)(_.A,{className:"h-4 w-4 text-rose-500"}):(0,a.jsx)(B.A,{className:"h-4 w-4 text-rose-500"})};return(0,a.jsxs)("div",{className:"rounded-xl border bg-rose-50/50 p-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("svg",{className:"h-5 w-5 text-rose-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"}),(0,a.jsx)("path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"})]}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"主要关键词"})]}),(0,a.jsx)(w.Bc,{children:(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{children:(0,a.jsx)(N.A,{className:"h-4 w-4 text-gray-400"})}),(0,a.jsx)(w.ZI,{children:(0,a.jsx)("p",{className:"text-sm",children:"驱动流量到此网站的关键词"})})]})})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b",children:[(0,a.jsx)("th",{className:"text-left py-3 px-4 font-medium",children:(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(R.A,{className:"h-4 w-4 text-gray-400"}),"Keyword"]})}),[{key:"EstimatedValue",label:"Traffic",icon:(0,a.jsx)(T.A,{className:"h-4 w-4"})},{key:"Volume",label:"Volume",icon:(0,a.jsx)(M.A,{className:"h-4 w-4"})},{key:"Cpc",label:"CPC",icon:(0,a.jsx)(V.A,{className:"h-4 w-4"})}].map(e=>{let{key:s,label:t,icon:n}=e;return(0,a.jsxs)("th",{onClick:()=>d(s),className:(0,l.cn)("text-right py-3 px-4 font-medium cursor-pointer transition-colors relative group",i===s?"bg-rose-100/50 text-rose-600":"hover:bg-rose-50/50"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[r.cloneElement(n,{className:(0,l.cn)("h-4 w-4",i===s?"text-rose-500":"text-gray-400")}),(0,a.jsx)("span",{className:(0,l.cn)("transition-colors",i===s?"text-rose-600":"text-gray-600","group-hover:text-rose-500"),children:t}),(0,a.jsx)(x,{field:s})]}),i===s&&(0,a.jsx)("div",{className:"absolute bottom-0 left-0 w-full h-0.5 bg-rose-500"})]},s)})]})}),(0,a.jsx)("tbody",{children:m.map((e,s)=>(0,a.jsxs)("tr",{className:"border-b last:border-0 hover:bg-white/50 transition-colors",children:[(0,a.jsx)("td",{className:"py-3 px-4 max-w-[200px] truncate",children:e.Name||"N/A"}),(0,a.jsx)("td",{className:"py-3 px-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,a.jsx)("div",{className:"flex-1 h-1.5 bg-gray-100 rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-rose-400 rounded-full",style:{width:"".concat(e.EstimatedValue/h*100,"%")}})}),(0,a.jsx)("span",{className:"text-right text-sm tabular-nums",children:b(e.EstimatedValue||0)})]})}),(0,a.jsx)("td",{className:"py-3 px-4 text-right tabular-nums",children:b(e.Volume||0)}),(0,a.jsxs)("td",{className:"py-3 px-4 text-right tabular-nums",children:["$",e.Cpc?e.Cpc.toFixed(2):"0.00"]})]},s))})]})})]})}var O=t(3950),W=t(1868),Z=t(2640),P=t(1544),q=t(1190),U=t(6075),H=t(1620),G=t(8003),J=t(2239);let K=J.bL,X=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(J.B8,{ref:s,className:(0,l.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...r})});X.displayName=J.B8.displayName;let Y=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(J.l9,{ref:s,className:(0,l.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...r})});Y.displayName=J.l9.displayName;let Q=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(J.UC,{ref:s,className:(0,l.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r})});function ee(e){let{domain:s}=e,{toast:t}=(0,g.dj)(),[l,i]=(0,r.useState)(null),n=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=e=>{n.current&&!n.current.contains(e.target)&&i(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);let d=()=>{let e=new Date,s=e.getFullYear(),t=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0"),r=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0"),i=String(e.getSeconds()).padStart(2,"0");return"".concat(s).concat(t).concat(a,"-").concat(r,"-").concat(l,"-").concat(i)},m=async()=>{try{let e=document.querySelector(".result-content");if(!e)return;let a=e.querySelectorAll(".overflow-x-auto");a.forEach(e=>{e.classList.remove("overflow-x-auto")});let r=await (0,H.$E)(e,{quality:1,backgroundColor:"#ffffff"});a.forEach(e=>{e.classList.add("overflow-x-auto")});let l="".concat(s,"-").concat(d(),"-webspy.site.png");(0,G.saveAs)(r,l),t({title:"Download successful",description:"Screenshot saved to your device"})}catch(e){console.error("Download failed:",e),t({title:"Download failed",description:"Please try again later",variant:"destructive"})}},h=async()=>{let e={title:"".concat(s," - WebSpy.Site"),text:"Check out ".concat(s,"'s traffic data on WebSpy.Site"),url:window.location.href};try{navigator.share?await navigator.share(e):(await navigator.clipboard.writeText(e.url),t({title:"Link copied",description:"You can now share it with others"}))}catch(e){console.error("Share failed:",e),t({title:"Share failed",description:"Please try copying the URL manually",variant:"destructive"})}};return(0,a.jsx)("div",{className:"flex flex-col items-center mx-auto max-w-2xl",children:(0,a.jsxs)("div",{className:"flex items-center gap-4 bg-white/50 p-2 rounded-lg border shadow-sm",children:[(0,a.jsxs)(K,{value:l||"",onValueChange:e=>{i(l===e?null:e)},className:"w-auto",ref:n,children:[(0,a.jsx)(X,{className:"h-8 flex gap-1",children:(0,a.jsxs)(w.Bc,{children:[(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{asChild:!0,children:(0,a.jsx)(Y,{value:"traffic",className:"h-7 w-7 p-0",children:(0,a.jsx)(O.A,{className:"h-4 w-4"})})}),(0,a.jsx)(w.ZI,{children:"Traffic Analysis"})]}),(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{asChild:!0,children:(0,a.jsx)(Y,{value:"tech",className:"h-7 w-7 p-0",children:(0,a.jsx)(W.A,{className:"h-4 w-4"})})}),(0,a.jsx)(w.ZI,{children:"Technical Tools"})]}),(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{asChild:!0,children:(0,a.jsx)(Y,{value:"security",className:"h-7 w-7 p-0",children:(0,a.jsx)(Z.A,{className:"h-4 w-4"})})}),(0,a.jsx)(w.ZI,{children:"Security Analysis"})]}),(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{asChild:!0,children:(0,a.jsx)(Y,{value:"performance",className:"h-7 w-7 p-0",children:(0,a.jsx)(P.A,{className:"h-4 w-4"})})}),(0,a.jsx)(w.ZI,{children:"Performance Tools"})]}),(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{asChild:!0,children:(0,a.jsx)(Y,{value:"archive",className:"h-7 w-7 p-0",children:(0,a.jsx)(c.A,{className:"h-4 w-4"})})}),(0,a.jsx)(w.ZI,{children:"Research Tools"})]})]})}),l&&(0,a.jsx)("div",{className:"relative",children:Object.entries({traffic:[{name:"Moz",desc:"SEO software and domain authority metrics",url:"https://moz.com/domain-analysis?site=".concat(s),icon:"https://www.google.com/s2/favicons?domain=moz.com&sz=32"},{name:"SpyFu",desc:"Competitor keyword research and PPC analysis",url:"https://www.spyfu.com/overview/domain/".concat(s),icon:"https://www.google.com/s2/favicons?domain=spyfu.com&sz=32"},{name:"Domain Authority",desc:"Check domain authority and SEO metrics",url:"https://websiteseochecker.com/domain-authority-checker/",icon:"https://www.google.com/s2/favicons?domain=websiteseochecker.com&sz=32"},{name:"SEMrush",desc:"SEO and competitive analysis tools",url:"https://www.semrush.com/analytics/overview/?searchType=domain&q=https://".concat(s),icon:"https://www.google.com/s2/favicons?domain=semrush.com&sz=32"},{name:"Ahrefs",desc:"SEO tools and backlink analysis",url:"https://app.ahrefs.com/site-explorer/overview/v2/subdomains/live?target=".concat(s),icon:"https://www.google.com/s2/favicons?domain=ahrefs.com&sz=32"},{name:"Cloudflare Radar",desc:"Domain traffic and security insights",url:"https://radar.cloudflare.com/domains/domain/".concat(s),icon:"https://www.google.com/s2/favicons?domain=cloudflare.com&sz=32"}],tech:[{name:"SecurityHeaders",desc:"Security header analysis and rating",url:"https://securityheaders.com/?q=".concat(s),icon:"https://www.google.com/s2/favicons?domain=securityheaders.com&sz=32"},{name:"DNS Checker",desc:"Global DNS propagation checker",url:"https://dnschecker.org/#A/".concat(s),icon:"https://www.google.com/s2/favicons?domain=dnschecker.org&sz=32"},{name:"SSL Labs",desc:"SSL/TLS configuration analysis",url:"https://www.ssllabs.com/ssltest/analyze.html?d=".concat(s),icon:"https://www.google.com/s2/favicons?domain=ssllabs.com&sz=32"},{name:"BuiltWith",desc:"Technology stack and platform detection",url:"https://builtwith.com/".concat(s),icon:"https://www.google.com/s2/favicons?domain=builtwith.com&sz=32"},{name:"Web-Check",desc:"Comprehensive web technology analysis",url:"https://web-check.xyz/check/https%3A%2F%2F".concat(s),icon:"https://www.google.com/s2/favicons?domain=web-check.xyz&sz=32"}],security:[{name:"VirusTotal",desc:"Domain security and malware analysis",url:"https://www.virustotal.com/gui/domain/".concat(s),icon:"https://www.google.com/s2/favicons?domain=virustotal.com&sz=32"},{name:"URLScan",desc:"Website scanning and threat detection",url:"https://urlscan.io/domain/".concat(s),icon:"https://www.google.com/s2/favicons?domain=urlscan.io&sz=32"},{name:"Sucuri",desc:"Security and malware scanner",url:"https://sitecheck.sucuri.net/results/".concat(s),icon:"https://www.google.com/s2/favicons?domain=sucuri.net&sz=32"},{name:"Tencent Security",desc:"Website security and violation check",url:"https://www.110.cqqgsafe.com/search/violation?kw=".concat(s),icon:"https://www.google.com/s2/favicons?domain=110.cqqgsafe.com&sz=32"},{name:"Tencent URL Check",desc:"URL security analysis and threat detection",url:"https://urlsec.qq.com/check.html?url=".concat(s),icon:"https://www.google.com/s2/favicons?domain=urlsec.qq.com&sz=32"},{name:"GFW Checker",desc:"Check if domain is blocked by GFW",url:"https://www.ggcx.com/main/GFW",icon:"https://www.google.com/s2/favicons?domain=ggcx.com&sz=32"},{name:"Shodan",desc:"Server and infrastructure analysis",url:"https://www.shodan.io/search/report?query=".concat(s),icon:"https://www.google.com/s2/favicons?domain=shodan.io&sz=32"}],performance:[{name:"PageSpeed",desc:"Google's page performance insights",url:"https://pagespeed.web.dev/analysis?url=https://".concat(s),icon:"https://www.google.com/s2/favicons?domain=web.dev&sz=32"},{name:"GTmetrix",desc:"Website performance and optimization analysis",url:"https://gtmetrix.com/?url=".concat(s),icon:"https://www.google.com/s2/favicons?domain=gtmetrix.com&sz=32"},{name:"WebPageTest",desc:"Advanced performance testing tools",url:"https://www.webpagetest.org/",icon:"https://www.google.com/s2/favicons?domain=webpagetest.org&sz=32"},{name:"Pingdom",desc:"Website speed and uptime monitoring",url:"https://tools.pingdom.com/",icon:"https://www.google.com/s2/favicons?domain=pingdom.com&sz=32"}],archive:[{name:"Internet Archive",desc:"Historical website snapshots and backups",url:"https://web.archive.org/web/".concat(s),icon:"https://www.google.com/s2/favicons?domain=web.archive.org&sz=32"},{name:"WhoIs",desc:"Domain registration and ownership info",url:"https://who.is/whois/".concat(s),icon:"https://www.google.com/s2/favicons?domain=who.is&sz=32"},{name:"ViewDNS",desc:"Reverse WhoIs and DNS research tools",url:"https://viewdns.info/reversewhois/?q=".concat(s),icon:"https://www.google.com/s2/favicons?domain=viewdns.info&sz=32"}]}).map(e=>{let[s,t]=e;return(0,a.jsx)(Q,{value:s,className:"absolute top-1 left-0 bg-white rounded-lg border shadow-sm p-2 min-w-[400px]",children:(0,a.jsx)("div",{className:"flex flex-col gap-2",children:t.map(e=>(0,a.jsxs)(o.$,{variant:"ghost",size:"sm",className:"h-12 w-full justify-start",onClick:()=>{window.open(e.url,"_blank"),i(null)},children:[(0,a.jsx)("img",{src:e.icon,alt:e.name,className:"w-4 h-4 mr-2"}),(0,a.jsxs)("div",{className:"flex flex-col items-start",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,a.jsx)("span",{className:"text-xs text-gray-500",children:e.desc})]})]},e.name))})},s)})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(o.$,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:m,title:"Download Screenshot",children:(0,a.jsx)(q.A,{className:"h-4 w-4"})}),(0,a.jsx)(o.$,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:h,title:"Share",children:(0,a.jsx)(U.A,{className:"h-4 w-4"})})]})]})})}function es(e){let{data:s}=e;if(!s||0===Object.keys(s).length)return(0,a.jsx)("p",{className:"text-center text-gray-500",children:"No Data to Display"});let t=window.location.href;return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(ee,{domain:s.SiteName})}),(0,a.jsxs)("div",{className:"result-content space-y-6 p-8 pt-4 pb-12",children:[(0,a.jsx)(v,{data:s}),(0,a.jsx)(y,{data:s}),(0,a.jsx)(k,{data:s}),(0,a.jsx)(z,{data:s}),(0,a.jsx)(F,{data:s}),(0,a.jsx)($,{data:s}),(0,a.jsxs)("div",{className:"flex flex-col items-center space-y-4 p-6 bg-white rounded-xl border",children:[(0,a.jsx)(p.h,{value:t,size:120}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-gray-600",children:[(0,a.jsx)(j.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-sm break-all text-center",children:t})]})]})]})]})}Q.displayName=J.UC.displayName;let et="domain_favorites";function ea(e){let{initialDomain:s=""}=e,{fetchData:t}=function(){let{toast:e}=(0,g.dj)(),[s,t]=(0,r.useState)(!1),[a,l]=(0,r.useState)(null);return{data:a,isLoading:s,fetchData:async s=>{t(!0);try{let e="/api/similarweb?domain=".concat(encodeURIComponent(s)),t=await fetch(e,{headers:{accept:"*/*","accept-language":"zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",dnt:"1","sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-origin"}});if(!t.ok){let e=await t.text();throw console.error("Error response:",e),Error("Network response error: ".concat(t.status))}let a=await t.json();return l(a),a}catch(s){return console.error("Error fetching data:",s),e({title:"Error",description:"Failed to obtain data, please try again",variant:"destructive"}),null}finally{t(!1)}}}}(),{history:l,addToHistory:p,clearHistory:j}=function(){let[e,s]=(0,r.useState)([]);return(0,r.useEffect)(()=>{let e=localStorage.getItem(f);if(e)try{let t=JSON.parse(e);Array.isArray(t)&&s(t)}catch(e){console.error("Failed to parse search history:",e),localStorage.removeItem(f)}},[]),{history:e,addToHistory:e=>{let t=e.trim().toLowerCase();t&&s(e=>{let s=e.filter(e=>e!==t),a=[t,...s].slice(0,100);try{localStorage.setItem(f,JSON.stringify(a))}catch(e){console.error("Failed to save search history:",e)}return a})},clearHistory:()=>{s([]),localStorage.removeItem(f)}}}(),{favorites:v,addToFavorites:w,removeFromFavorites:N,clearFavorites:y,updateFavoriteNote:b}=function(){let[e,s]=(0,r.useState)([]);return(0,r.useEffect)(()=>{(()=>{try{let e=localStorage.getItem(et);if(e){let t=JSON.parse(e);Array.isArray(t)&&s(t)}}catch(e){console.error("Failed to load favorites:",e),localStorage.removeItem(et)}})()},[]),{favorites:e,addToFavorites:(e,t)=>{let a=e.trim().toLowerCase();a&&s(e=>{if(e.some(e=>e.domain===a))return e;let s=[{domain:a,addedAt:Date.now(),note:t},...e].slice(0,100);try{localStorage.setItem(et,JSON.stringify(s))}catch(e){console.error("Failed to save favorites:",e)}return s})},removeFromFavorites:e=>{s(s=>{let t=s.filter(s=>s.domain!==e);try{localStorage.setItem(et,JSON.stringify(t))}catch(e){console.error("Failed to save favorites after removal:",e)}return t})},clearFavorites:()=>{s([]);try{localStorage.removeItem(et)}catch(e){console.error("Failed to clear favorites:",e)}},updateFavoriteNote:(e,t)=>{s(s=>{let a=s.map(s=>s.domain===e?{...s,note:t}:s);try{localStorage.setItem(et,JSON.stringify(a))}catch(e){console.error("Failed to save favorites after note update:",e)}return a})}}}(),[k,S]=(0,r.useState)(!1),[C,A]=(0,r.useState)(s),[z,L]=(0,r.useState)(null),[E,I]=(0,r.useState)("history"),[T,D]=(0,r.useState)(null),[F,_]=(0,r.useState)(""),B=e=>{try{let s=e.trim();return(s=(s=s.replace(/^https?:\/\//i,"")).replace(/\/+$/,"")).includes("/")&&(s=s.split("/")[0]),s}catch(s){return e}},R=e=>{let s=B(e);window.history.pushState({},"","/".concat(s))},M=async e=>{e&&e.preventDefault();let s=document.getElementById("domain"),a=null==s?void 0:s.value.trim();if(a){a=B(a),S(!1);let e=await t(a);e&&(p(a),L(e),R(a))}},V=e=>{let s=document.getElementById("domain");s&&(s.value=e,A(e),M())},$=l.filter(e=>e.toLowerCase().includes(C.toLowerCase()));(0,r.useEffect)(()=>{if(s){let e=B(s),t=document.getElementById("domain");t&&(t.value=e,M())}},[s]),(0,r.useEffect)(()=>{let e=document.querySelector("button");if(e){let s=e=>{e.preventDefault(),M()};return e.addEventListener("click",s),()=>{e.removeEventListener("click",s)}}},[]),(0,r.useEffect)(()=>{let e=e=>{let s=document.querySelector(".history-dropdown"),t=document.getElementById("domain");s&&t&&!s.contains(e.target)&&!t.contains(e.target)&&S(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);let O=(e,s)=>{e.stopPropagation(),v.some(e=>e.domain===s)?N(s):w(s)};return(0,a.jsxs)(i,{className:"max-w-3xl mx-auto p-8 pb-0",children:[(0,a.jsxs)("form",{onSubmit:M,className:"relative",children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("div",{className:"relative flex-1",children:[(0,a.jsx)(n,{type:"text",id:"domain",placeholder:"input URL, eg:google.com",className:"pr-10",onChange:e=>A(e.target.value),onFocus:()=>S(!0)}),(0,a.jsx)(c.A,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"})]}),(0,a.jsx)(o.$,{type:"submit",children:"查询"})]}),k&&(l.length>0||v.length>0)&&(0,a.jsx)("div",{className:"absolute z-50 w-full mt-1 bg-white rounded-md border shadow-lg history-dropdown",children:(0,a.jsx)("div",{className:"flex items-center justify-between p-2 border-b",children:(0,a.jsxs)(K,{defaultValue:"history",className:"w-full",children:[(0,a.jsxs)(X,{className:"grid w-full grid-cols-2",children:[(0,a.jsxs)(Y,{value:"history",onClick:()=>I("history"),children:[(0,a.jsx)(d.A,{className:"h-4 w-4 mr-1"}),"历史 (",$.length,"/100)"]}),(0,a.jsxs)(Y,{value:"favorites",onClick:()=>I("favorites"),children:[(0,a.jsx)(m.A,{className:"h-4 w-4 mr-1"}),"收藏 (",v.length,"/100)"]})]}),(0,a.jsxs)(Q,{value:"history",children:[(0,a.jsx)("div",{className:"flex items-center justify-end p-2",children:(0,a.jsxs)(o.$,{variant:"ghost",size:"sm",className:"h-8 text-gray-500 hover:text-red-500",onClick:()=>{j(),S(!1)},children:[(0,a.jsx)(h.A,{className:"h-4 w-4 mr-1"}),"清空历史"]})}),(0,a.jsx)("div",{className:"max-h-64 overflow-y-auto",children:$.length>0?$.map((e,s)=>(0,a.jsxs)("button",{className:"w-full px-4 py-2 text-left hover:bg-gray-50 flex items-center gap-2",onClick:()=>V(e),children:[(0,a.jsx)(d.A,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)("span",{className:"flex-1",children:e}),(0,a.jsx)(m.A,{className:"h-4 w-4 ".concat(v.some(s=>s.domain===e)?"text-yellow-400 fill-yellow-400":"text-gray-400 hover:text-yellow-400"),onClick:s=>O(s,e)}),(0,a.jsx)(x.A,{className:"h-4 w-4 text-gray-400 hover:text-gray-600",onClick:s=>{s.stopPropagation();let t=l.filter(s=>s!==e);localStorage.setItem("search_history",JSON.stringify(t)),window.location.reload()}})]},"".concat(e,"-").concat(s))):(0,a.jsx)("div",{className:"p-4 text-center text-gray-500",children:"暂无历史记录"})})]}),(0,a.jsxs)(Q,{value:"favorites",children:[(0,a.jsx)("div",{className:"flex items-center justify-end p-2",children:(0,a.jsxs)(o.$,{variant:"ghost",size:"sm",className:"h-8 text-gray-500 hover:text-red-500",onClick:()=>{y(),S(!1)},children:[(0,a.jsx)(h.A,{className:"h-4 w-4 mr-1"}),"清空收藏"]})}),(0,a.jsx)("div",{className:"max-h-64 overflow-y-auto",children:v.length>0?v.map(e=>(0,a.jsx)("div",{className:"w-full px-4 py-2 hover:bg-gray-50",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(m.A,{className:"h-4 w-4 text-yellow-400 fill-yellow-400"}),(0,a.jsxs)("button",{className:"flex-1 text-left",onClick:()=>V(e.domain),children:[(0,a.jsx)("div",{children:e.domain}),e.note&&T!==e.domain&&(0,a.jsx)("div",{className:"text-sm text-gray-500 mt-1",children:e.note})]}),T===e.domain?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(n,{value:F,onChange:e=>_(e.target.value),className:"h-8 text-sm",placeholder:"Add note...",autoFocus:!0,onKeyDown:s=>{"Enter"===s.key&&(b(e.domain,F),D(null))}}),(0,a.jsx)(o.$,{variant:"ghost",size:"sm",onClick:()=>{b(e.domain,F),D(null)},children:"保存"}),(0,a.jsx)(o.$,{variant:"ghost",size:"sm",onClick:()=>D(null),children:"取消"})]}):(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(u.A,{className:"h-4 w-4 text-gray-400 hover:text-gray-600 cursor-pointer",onClick:()=>{D(e.domain),_(e.note||"")}}),(0,a.jsx)(x.A,{className:"h-4 w-4 text-gray-400 hover:text-gray-600 cursor-pointer",onClick:s=>{s.stopPropagation(),N(e.domain)}})]})]})},e.domain)):(0,a.jsx)("div",{className:"p-4 text-center text-gray-500",children:"暂无收藏"})})]})]})})}),(0,a.jsxs)("div",{className:"text-sm text-gray-500 mt-4",children:[(0,a.jsx)("p",{children:"\uD83D\uDCA1 贴心提示:"}),(0,a.jsxs)("ul",{className:"list-disc pl-5 space-y-1",children:[(0,a.jsx)("li",{children:"最近 100 条查询记录自动保存,随时查看分析历史"}),(0,a.jsx)("li",{children:"标星收藏重要网站,添加备注,方便后续追踪"}),(0,a.jsx)("li",{children:'快捷访问:直接在浏览器地址栏输入 "webspy.site/目标域名" 即可查看流量报告'})]})]})]}),(0,a.jsx)("div",{className:"mt-8 overflow-x-hidden",children:z&&(0,a.jsx)(es,{data:z})})]})}},3312:(e,s,t)=>{t.d(s,{$:()=>c});var a=t(5155),r=t(2115),l=t(2317),i=t(1027),n=t(1567);let o=(0,i.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=r.forwardRef((e,s)=>{let{className:t,variant:r,size:i,asChild:c=!1,...d}=e,m=c?l.DX:"button";return(0,a.jsx)(m,{className:(0,n.cn)(o({variant:r,size:i,className:t})),ref:s,...d})});c.displayName="Button"},3601:(e,s,t)=>{t.d(s,{Bc:()=>n,ZI:()=>d,k$:()=>c,m_:()=>o});var a=t(5155),r=t(2115),l=t(5448),i=t(1567);let n=l.Kq,o=l.bL,c=l.l9,d=r.forwardRef((e,s)=>{let{className:t,sideOffset:r=4,...n}=e;return(0,a.jsx)(l.UC,{ref:s,sideOffset:r,className:(0,i.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})});d.displayName=l.UC.displayName},5564:(e,s,t)=>{t.d(s,{dj:()=>h});var a=t(2115);let r=0,l=new Map,i=e=>{if(l.has(e))return;let s=setTimeout(()=>{l.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);l.set(e,s)},n=(e,s)=>{switch(s.type){case"ADD_TOAST":return{...e,toasts:[s.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===s.toast.id?{...e,...s.toast}:e)};case"DISMISS_TOAST":{let{toastId:t}=s;return t?i(t):e.toasts.forEach(e=>{i(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===t||void 0===t?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===s.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==s.toastId)}}},o=[],c={toasts:[]};function d(e){c=n(c,e),o.forEach(e=>{e(c)})}function m(e){let{...s}=e,t=(r=(r+1)%Number.MAX_SAFE_INTEGER).toString(),a=()=>d({type:"DISMISS_TOAST",toastId:t});return d({type:"ADD_TOAST",toast:{...s,id:t,open:!0,onOpenChange:e=>{e||a()}}}),{id:t,dismiss:a,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function h(){let[e,s]=a.useState(c);return a.useEffect(()=>(o.push(s),()=>{let e=o.indexOf(s);e>-1&&o.splice(e,1)}),[e]),{...e,toast:m,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},1567:(e,s,t)=>{t.d(s,{cn:()=>l});var a=t(3463),r=t(9795);function l(){for(var e=arguments.length,s=Array(e),t=0;t