PageSourceSearch

https://bbcc.ai/build/assets/EzAnalytics-fcR8fBW5.js

js bbcc.ai collected 2026-10-05 12:12:53 UTC 32,067 bytes, 143 lines download raw bytes

1import{u as Se,r as c,b as F,j as e,H as ze}from"./app-DP13319Q.js";import{D as $e}from"./DraggableMenu-Bk7Spryo.js";import"./model-viewer-BNdxy5m2.js";import{F as l,h as X,b as Z,f as x,a as _,l as Fe,m as _e,e as L,n as Le,j as De,o as Ve,p as Re,al as Ae}from"./index-CtyZ6W6U.js";import{l as Te}from"./index.module-D1uRunsO.js";import{M as D}from"./react-tooltip.min-DW3XhwOj.js";import{R as V,L as Me,C as J,X as ee,Y as te,T as R,a as Ee,b as Pe,P as Ue,c as Be,d as Ie,B as qe,e as He}from"./PieChart-BalIiA8L.js";/* empty css            */import"./index-DQkUn08L.js";import"./clsx-B-dksMZM.js";function tt(){var W,Y;const{auth:se,template:s,initialFunnels:f}=Se().props,[ae,le]=c.useState(!0),[A,v]=c.useState([]),[b,re]=c.useState(""),[h,T]=c.useState("fuzzy"),[M,E]=c.useState(1),[oe,N]=c.useState(!0),[P,y]=c.useState(!1),[U,m]=c.useState(""),[i,B]=c.useState(null),[n,k]=c.useState(null),[j,C]=c.useState("30d"),[I,q]=c.useState(!1),[H]=Te(b,500),[S,ie]=c.useState(null);c.useEffect(()=>{if(s!=null&&s.image){const t=new Blob([s.image],{type:"text/html"}),a=URL.createObjectURL(t);return ie(a),()=>{URL.revokeObjectURL(a)}}},[s==null?void 0:s.image]),c.useEffect(()=>{f&&(v(f.data),N(f.next_page_url!==null))},[f]),c.useEffect(()=>{H&&w()},[H,h]);const w=async()=>{try{y(!0);const t=await F.get("/search-ez-funnels-analytics",{params:{query:b,type:h,page:1}});v(t.data.data),E(1),N(t.data.next_page_url!==null)}catch(t){console.error("Search error:",t),m("Failed to search funnels. Please try again."),setTimeout(()=>m(""),5e3)}finally{y(!1)}},ne=async()=>{var t,a,o;try{y(!0);const r=((t=document.querySelector('meta[name="csrf-token"]'))==null?void 0:t.getAttribute("content"))||"",p=await F.get("/search-ez-funnels-analytics",{params:{query:b,type:h,page:M+1,with:"customDomains,handleDomains"},headers:{"X-CSRF-TOKEN":r,"Content-Type":"application/json"}});p.data&&p.data.data&&(v($=>[...$,...p.data.data]),E(M+1),N(p.data.next_page_url!==null))}catch(r){console.error("Load more error:",r),m(((o=(a=r.response)==null?void 0:a.data)==null?void 0:o.message)||"Failed to load more items. Please try again."),setTimeout(()=>m(""),5e3)}finally{y(!1)}},u=async t=>{B(t),q(!0);try{const a=await F.get(`/get-funnel-analytics/${t.id}`,{params:{time_range:j}});k(a.data)}catch(a){console.error("Error fetching analytics data:",a),m("Failed to load analytics data. Please try again."),setTimeout(()=>m(""),5e3),k(null)}finally{q(!1)}},ce=t=>new Date(t).toLocaleDateString("en-US",{weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}),de=t=>{var o;return(o=t.split("?")[0].split(".").pop())==null?void 0:o.toLowerCase()},xe=t=>t?["jpg","jpeg","png","gif","bmp","tiff","tif","webp","apng","svg","ico"].includes(t):!1,me=s!=null&&s.image&&xe(de(s.image))?e.jsx("style",{children:`
2            .blur-bg {
3                background: url('${s.user_id===0?"https://admin.ez3d.ai/":"https://ez.wiki/"}${s.image}') no-repeat center center;
4                background-size: cover;
5            }
6        `}):null,pe=c.useMemo(()=>{var Q;if(!s)return null;const t=((Q=s.image.split(".").pop())==null?void 0:Q.toLowerCase())||"",o=`${s.user_id===0?"https://admin.ez3d.ai/":"https://ez.wiki/"}${s.image}`,r=["jpg","jpeg","png","gif","bmp","tiff","tif","webp","apng","svg","ico"],p=["ppt","pptx","pdf","xls","xlsx","doc","docx","pages","ai","psd","eps","ttf","dxf","xps","rar","zip","ods","odt","odp"],$=/(?:youtube(?:-nocookie)?\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?/ ]{11})/i,ue=/(?:https?:\/\/)?(?:www\.)?linkedin\.com\/(?:in|posts|company|feed|showcase|embed\/feed\/update\/urn:li:[^/]+:[^"&?/ ]+)/i,ge=/^https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)(?:[?]?.*)$/im,fe=/^(https?:\/\/)?(www\.)?fb\.watch\/[a-zA-Z0-9(\.\?)?]/,be=/^(https?:\/\/)?(www\.)?facebook\.com\/[a-zA-Z0-9(\.\?)?]/,ye=/<iframe.*?src=["'](.*?)["'].*?>.*?<\/iframe>/is,je=/<blockquote/,g=s.image.match($),we=s.image.match(ue),G=s.image.match(ge),ve=s.image.match(fe),Ne=s.image.match(be),ke=s.image.match(ye)||je.test(s.image);if(r.includes(t))return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
7                        .blur-overlay {
8                            position: fixed;
9                            top: 0;
10                            left: 0;
11                            width: 100%;
12                            height: 100%;
13                            backdrop-filter: blur(20px);
14                            z-index: -1;
15                        }
16                    `}),e.jsx("div",{className:"blur-overlay"}
16),e.jsx("img",{src:o,alt:"Background",className:"absolute inset-0 max-w-full max-h-full m-auto z-0 rounded-lg",onError:d=>console.error("Image failed to load",d)})]});if(p.includes(t))return e.jsx("iframe",{src:`https://docs.google.com/viewer?url=${o}&embedded=true`,className:"fixed top-0 left-0 w-full h-full",frameBorder:"0",loading:"lazy",allow:"autoplay; fullscreen",allowFullScreen:!0,sandbox:"allow-scripts allow-same-origin",title:"Document Viewer",scrolling:"yes"});if(ke){const d=s.image.replace(/<(iframe|blockquote)([^>]*)\s(height|width|style)=["'][^"']*["']([^>]*)>/gi,'<$1$2$4 class="fixed top-0 left-0 w-full h-full" scrolling="yes">').replace(/class="([^"]*)"/g,'class="$1 absolute inset-0 m-auto"'),Ce=/<(iframe|blockquote)[^>]*class="/i.test(d)?d:d.replace(/<(iframe|blockquote)/g,'<$1 scrolling="yes" class="absolute w-full h-full inset-0 m-auto"');return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
17                        .blur-overlay {
18                            position: fixed;
19                            top: 0;
20                            left: 0;
21                            width: 100%;
22                            height: 100%;
23                            backdrop-filter: blur(20px);
24                            z-index: -2;
25                        }
26                        .twitter-tweet {
27                            position: fixed;
28                            top: 0;
29                            left: 0;
30                            width: 100vw;
31                            height: 100vh;
32                            object-fit: cover;
33                            z-index: 0;
34                            border: none;
35                        }
36                    `}),e.jsx("div",{className:"blur-overlay"}),e.jsx("div",{className:"fixed top-0 left-0 w-full h-full object-cover",dangerouslySetInnerHTML:{__html:Ce}})]})}if(g){const d=s.option==="autoplay"?"autoplay=1":s.option==="mute"?"autoplay=1&mute=1":"mute=1";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed top-0 left-0 w-full h-full z-[-2]",children:e.jsx("iframe",{loading:"lazy",src:`https://www.youtube.com/embed/${g[1]}?${d}&loop=1&playlist=${g[1]}&controls=0&showinfo=0&modestbranding=1&iv_load_policy=3`,className:"w-full h-full object-cover",frameBorder:"0",allow:"autoplay; fullscreen",allowFullScreen:!0})}),e.jsx("style",{children:`
37                        .blur-overlay {
38                            position: fixed;
39                            top: 0;
40                            left: 0;
41                            width: 100%;
42                            height: 100%;
43                            backdrop-filter: blur(20px);
44                            z-index: -1;
45                        }
46                    `}),e.jsx("div",{className:"blur-overlay"}),e.jsx("iframe",{id:"bgVideo",loading:"lazy",className:"fixed top-0 left-0 w-full h-full object-cover",src:`https://www.youtube.com/embed/${g[1]}?${s.option}=1&mute=1&loop=1&playlist=${g[1]}`,title:"YouTube video player",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",referrerPolicy:"strict-origin-when-cross-origin",allowFullScreen:!0})]})}if(we){let d=s.image;return d.includes("?compact=1")||(d+=(d.includes("?")?"&":"?")+"compact=1"),e.jsx("div",{className:"fixed top-0 left-0 w-full h-full flex justify-center items-center bg-black",children:e.jsx("iframe",{id:"bgVideo",src:d,className:"w-full h-full",frameBorder:"0",allowFullScreen:!0,title:"Embedded LinkedIn Post",scrolling:"yes"})})}return G?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
47                        .blur-overlay {
48                            position: fixed;
49                            top: 0;
50                            left: 0;
51                            width: 100%;
52                            height: 100%;
53                            backdrop-filter: blur(20px);
54                            z-index: -1;
55                        }
56                    `}),e.jsx("div",{className:"blur-overlay"}),e.jsx("iframe",{loading:"lazy",id:"bgVideo",allow:"camera; microphone; fullscreen; display-capture; autoplay",src:`https://player.vimeo.com/video/${G[3]}?h=33160d1512&color=de0101`,className:"fixed top-0 left-0 w-full h-full object-cover",frameBorder:"0",allowFullScreen:!0})]}):ve||Ne&&!s.image.includes("groups")?e.jsx("div",{className:"fixed top-0 left-0 w-full h-full",children:e.jsx("div",{className:"fb-post","data-href":s.image,"data-width":"1400","data-show-text":"true"})}):t==="mp4"?e.jsxs(e.Fragment,{children:[e.jsxs("video",{autoPlay:!0,loop:!0,muted:!0,playsInl
56ine:!0,className:"fixed top-0 left-0 w-full h-full object-cover z-[-3]",children:[e.jsx("source",{src:o,type:"video/mp4"}),"Your browser does not support the video tag."]}),e.jsx("style",{children:`
57                        .blur-overlay {
58                            position: fixed;
59                            top: 0;
60                            left: 0;
61                            width: 100%;
62                            height: 100%;
63                            backdrop-filter: blur(20px);
64                            z-index: -2;
65                        }
66                    `}),e.jsx("div",{className:"blur-overlay"}),e.jsxs("video",{id:"bgVideo",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:"absolute inset-0 max-w-full max-h-full m-auto",controls:!0,children:[e.jsx("source",{src:o,type:"video/mp4"}),"Your browser does not support the video tag."]})]}):t==="glb"?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
67                        .blur-overlay {
68                            position: fixed;
69                            top: 0;
70                            left: 0;
71                            width: 100%;
72                            height: 100%;
73                            backdrop-filter: blur(20px);
74                            z-index: -1;
75                        }
76                    `}),e.jsx("div",{className:"blur-overlay"}),e.jsx("model-viewer",{src:o,alt:"3D model",className:"fixed top-0 left-0 w-full h-full",ar:!0,"auto-rotate":!0,"camera-controls":!0,"shadow-intensity":"1"})]}):he(s.image)?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
77                        .blur-overlay {
78                            position: fixed;
79                            top: 0;
80                            left: 0;
81                            width: 100%;
82                            height: 100%;
83                            backdrop-filter: blur(20px);
84                            z-index: -1;
85                        }
86                    `}),e.jsx("div",{className:"blur-overlay"}),e.jsx("iframe",{loading:"lazy",id:"bgVideo",allow:"camera; microphone; fullscreen; display-capture; autoplay",src:s.image,className:"fixed top-0 left-0 w-full h-full",frameBorder:"0",allowFullScreen:!0,scrolling:"yes"})]}):S?e.jsx("iframe",{src:S,className:"fixed top-0 left-0 w-full h-full border-none",allow:"microphone *; camera *; autoplay *; fullscreen *; display-capture *;",sandbox:`allow-forms allow-modals allow-orientation-lock allow-pointer-lock 
87                            allow-popups allow-popups-to-escape-sandbox allow-presentation 
88                            allow-same-origin allow-scripts allow-top-navigation 
89                            allow-top-navigation-by-user-activation allow-downloads allow-storage-access-by-user-activation`,allowFullScreen:!0,loading:"lazy",name:"binauralMixerFrame",allowTransparency:"true",scrolling:"yes"}):null},[s,S]),he=t=>{try{return new URL(t),!0}catch{return!1}},z=t=>new Intl.NumberFormat().format(t),O=t=>{if(t<60)return`${Math.round(t)}s`;const a=Math.floor(t/60),o=t%60;return`${a}m ${Math.round(o)}s`},K=["#0088FE","#00C49F","#FFBB28","#FF8042","#8884D8","#82CA9D"];return e.jsxs(e.Fragment,{children:[e.jsxs(ze,{children:[e.jsx("title",{children:"EZ Analytics - Funnel Visitor Analytics"}),me,e.jsx("meta",{name:"description",content:"View detailed analytics for your funnels including visitor statistics, traffic sources, and more"}),e.jsx("style",{children:`
90                    .react-tooltip {
91                        z-index: 99999 !important;
92                        opacity: 1 !important;
93                        font-size: 12px;
94                        padding: 4px 8px;
95                    }
96                    .chart-container {
97                        background: rgba(255, 255, 255, 0.05);
98                        border-radius: 10px;
99                        padding: 20px;
100                        margin-bottom: 20px;
101                        border: 1px solid rgba(255, 255, 255, 0.1);
102                    }
103                    .stat-card {
104                        background: linear-gradient(135deg, rgba(147, 51, 234, 0.2), rgba(59, 130, 246, 0.2));
105                        border: 1px solid rgba(255, 255, 255, 0.1);
106                        border-radius: 10px;
107                        padding: 20px;
108                        backdrop-filter: blur(10px);
109                        transition: transform 0.3s ease;
110                    }
111                    .stat-card:hover {
112                        transform: translateY(-2px);
113                    }
114                    .custom-scrollbar {
115                        scrollbar-width: thin;
116                        scrollbar-color: #4b5563 #1f2937;
117                    }
118                    .custom-scrollbar::-webkit-scrollbar {
119                        width: 8px;
120                    }
121                    .custom-scrollbar::-webkit-scrollbar-track {
122                        background: #1f2937;
123                        border-radius: 4px;
124                    }
125                    .custom-scrollbar::-webkit-scrollbar-thumb {
126                        background: #4b5563;
127                        border-radius: 4px;
128                    }
129                    .custom-scrollbar::-webkit-scrollbar-thumb:hover {
130                        background: #6b7280;
131                    }
132                    .recharts-tooltip-wrapper {
133                        background-color: #1f2937 !important;
134                        border: 1px solid #4b5563 !important;
135                        border-radius: 6px !important;
136                    }
137                    .recharts-tooltip-label {
138                        color: #d1d5db !important;
139                    }
140                    .recharts-tooltip-item {
141                        color: #9ca3af !important;
142                    }
143                `})]}),e.jsx(D,{id:"action-tooltip"}),e.jsx(D,{id:"form-tooltip"}),e.jsx(D,{id:"modal-tooltip"}),e.jsx($e,{auth:se}),e.jsxs("main",{className:`relative flex justify-end p-4 min-h-screen overflow-hidden ${(W=s==null?void 0:s.image.split(".").pop())!=null&&W.toLowerCase()&&["jpg","jpeg","png","gif","bmp","tiff","tif","webp","apng","svg","ico"].includes(((Y=s.image.split(".").pop())==null?void 0:Y.toLowerCase())||"")?"blur-bg":""}`,children:[e.jsx("div",{className:"absolute inset-0 z-0",children:pe}),ae&&e.jsxs("div",{className:"relative mt-4 mx-auto bottom-4 z-50 backdrop-blur-sm p-4 rounded-xl border border-white-700 overflow-y-auto shadow-2xl w-full max-w-7xl",children:[e.jsx("button",{onClick:()=>le(!1),className:"absolute top-2 right-2 w-8 h-8 bg-black rounded-full flex items-center justify-center z-50 hover:bg-gray-800 transition-colors focus:outline-none focus:ring-2 focus:ring-white","aria-label":"Close panel","data-tooltip-id":"action-tooltip","data-tooltip-content":"Hide Control Panel",children:e.jsx(l,{icon:X,className:"text-white text-lg",style:{textShadow:"0.7px 0.7px 0 rgb(255,0,0), -0.7px -0.7px 0 rgb(0,255,255)"}})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-gray-800/80 border border-gray-700 rounded-lg p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsxs("div",{className:"relative flex-grow",children:[e.jsx("input",{type:"text",placeholder:"Search by token or domain",className:"w-full bg-white text-gray-900 px-3 py-2 pl-10 rounded-md focus:outline-none focus:ring-2 focus:ring-yellow-400 min-w-0",value:b,onChange:t=>re(t.target.value),onKeyPress:t=>t.key==="Enter"&&w(),"data-tooltip-id":"form-tooltip","data-tooltip-content":"Search your funnels"}),e.jsx(l,{icon:Z,className:"absolute left-3 top-3 text-gray-500"})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs("button",{className:`font-semibold px-3 py-2 flex items-center gap-1.5 whitespace-nowrap rounded-l-md border-r transition-colors ${h==="fuzzy"?"bg-green-600 text-white border-green-700 hover:bg-green-700":"bg-gray-600 text-gray-300 border-gray-700 hover:bg-gray-700"}`,onClick:()=>{T("fuzzy"),w()},"data-tooltip-id":"action-tooltip","data-tooltip-content":"Use fuzzy (approximate) search",children:[e.jsx(l,{icon:Z,className:"h-4 w-4"}),"Fuzzy"]}),e.jsxs("button",{className:`font-semibold px-3 py-2 flex items-center gap-1.5 whitespace-nowrap rounded-r-md transition-colors ${h==="exact"?"bg-green-600 text-white hover:bg-green-700":"bg-gray-600 text-gray-300 hover:bg-gray-700"}`,onClick:()=>{T("exact"),w()},"data-tooltip-id":"action-tooltip","data-tooltip-content":"Use exact match search",children:[e.jsx(l,{icon:x,className:"h-4 w-4"}),"Exact"]})]})]}),e.jsx("div",{className:"max-h-[65vh] overflow-y-auto custom-scrollbar space-y-2",children:A.length===0?e.jsxs("div",{className:"text-center py-8 text-gray-300",children:[e.jsx(l,{icon:_,className:"text-2xl mb-2"}),e.jsx("p",{children:"No funnels found. Create one to get started!"})]}):A.map(t=>{var a,o;return e.jsxs("div",{className:`flex items-center p-4 gap-1 rounded-lg transition-all ${(i==null?void 0:i.id)===t.id?"bg-purple-900/80 border-2 border-yellow-400":"bg-[#5d0f6e] hover:bg-purple-800/80"}`,children:[e.jsx("span",{className:"text-4xl select-none",children:"📊"}),e.jsx("div",{className:"flex-grow min-w-0",children:e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsxs("a",{href:`https://ez.wiki/${encodeURIComponent(t.token)}`,target:"_blank",className:"text-yellow-400 font-semibold truncate hover:underline",rel:"noopener noreferrer","data-tooltip-id":"action-tooltip","data-tooltip-content":"Open funnel link in new tab",children:["https://ez.wiki/",t.token]}),(a=t.handle_domains)==null?void 0:a.map(r=>e.jsxs("a",{href:`https://${r.domain}.${r.domainselected}`,target:"_blank",className:"text-yellow-400 font-semibold truncate hover:underline",rel:"noopener noreferrer","data-tooltip-id":"action-tooltip","data-tooltip-content":"Open handle domain in new tab",children:["https://",r.domain,".",r.domainselected]},r.id)),(o=t.custom_domains)==null?void 0:o.map(r=>e.jsxs("a",{href:`https://${r.domainselected}/${r.domain}`,target:"_blank",className:"text-yellow-400 font-semibold truncate hover:underline",rel:"noopener noreferrer","data-tooltip-id":"action-tooltip","data-tooltip-content":"Open custom domain in new tab",children:["https://",r.domainselected,"/",r.domain]},r.id)),e.jsx("p",{className:"text-purple-300 text-sm whitespace-nowrap",children:ce(t.created_at)})]})}),e.jsx("button",{className:`font-bold py-1 px-5 rounded-md text-sm transition-colors whitespace-nowrap ${(i==null?void 0:i.id)===t.id?"bg-yellow-500 text-black hover:bg-yellow-600":"bg-yellow-400 text-black hover:bg-yellow-500"}`,onClick:()=>u(t),"data-tooltip-id":"action-tooltip","data-tooltip-content":"View analytics for this funnel",disabled:I,children:(i==null?void 0:i.id)===t.id?"Viewing Analytics":"View Analytics"})]},t.id)})}),oe&&e.jsx("div",{className:"flex justify-center mt-4",children:e.jsx("button",{className:"bg-black text-white border border-white px-8 py-2 rounded-md font-semibold hover:bg-white hover:text-black transition-colors disabled:opacity-50",onClick:ne,disabled:P,"data-tooltip-id":"action-tooltip","data-tooltip-content":"Load more of your funnels",children:P?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("svg",{className:"animate-spin h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Loading..."]}):"Load More"})})]}),i?e.jsxs("div",{className:"bg-gray-800/80 border border-gray-700 rounded-lg p-6 space-y-6",children:[U&&e.jsxs("div",{className:"bg-red-500/90 text-white p-3 rounded-lg mb-4 flex items-center gap-2",children:[e.jsx(l,{icon:_}),U]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("h2",{className:"text-yellow-400 text-xl font-bold",children:["Analytics for: ",e.jsx("span",{className:"text-white",children:i.token})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex bg-gray-700 rounded-md overflow-hidden border border-gray-600",children:[e.jsx("button",{onClick:()=>{C("7d"),i&&u(i)},className:`px-3 py-1 ${j==="7d"?"bg-blue-600 text-white":"text-gray-300 hover:text-white hover:bg-gray-600"}`,"data-tooltip-id":"action-tooltip","data-tooltip-content":"Last 7 days",children:"7D"}),e.jsx("button",{onClick:()=>{C("30d"),i&&u(i)},className:`px-3 py-1 ${j==="30d"?"bg-blue-600 text-white":"text-gray-300 hover:text-white hover:bg-gray-600"}`,"data-tooltip-id":"action-tooltip","data-tooltip-content":"Last 30 days",children:"30D"}),e.jsx("button",{onClick:()=>{C("90d"),i&&u(i)},className:`px-3 py-1 ${j==="90d"?"bg-blue-600 text-white":"text-gray-300 hover:text-white hover:bg-gray-600"}`,"data-tooltip-id":"action-tooltip","data-tooltip-content":"Last 90 days",children:"90D"})]}),e.jsx("button",{onClick:()=>{B(null),k(null)},className:"text-gray-300 hover:text-white bg-gray-700 p-2 rounded-md hover:bg-gray-600 border border-gray-600","data-tooltip-id":"action-tooltip","data-tooltip-content":"Close analytics",children:e.jsx(l,{icon:X})})]})]}),e.jsx("hr",{className:"border-t border-gray-700"}),I?e.jsx("div",{className:"flex justify-center items-center h-64",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-yellow-400 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-300",children:"Loading analytics data..."})]})}
143):n?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"stat-card",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(l,{icon:Fe,className:"text-blue-400"}),e.jsx("h3",{className:"text-gray-300 text-sm",children:"Total Visitors"})]}),e.jsx("p",{className:"text-2xl font-bold text-white",children:z(n.total_visitors)}),e.jsxs("p",{className:"text-gray-400 text-xs mt-1",children:["Unique: ",z(n.unique_visitors)]})]}),e.jsxs("div",{className:"stat-card",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(l,{icon:_e,className:"text-green-400"}),e.jsx("h3",{className:"text-gray-300 text-sm",children:"Page Views"})]}),e.jsx("p",{className:"text-2xl font-bold text-white",children:z(n.page_views)}),e.jsxs("p",{className:"text-gray-400 text-xs mt-1",children:["Views per visitor: ",(n.page_views/n.total_visitors).toFixed(1)]})]}),e.jsxs("div",{className:"stat-card",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(l,{icon:L,className:"text-purple-400"}),e.jsx("h3",{className:"text-gray-300 text-sm",children:"Avg. Duration"})]}),e.jsx("p",{className:"text-2xl font-bold text-white",children:O(n.avg_session_duration)}),e.jsx("p",{className:"text-gray-400 text-xs mt-1",children:"Session length"})]}),e.jsxs("div",{className:"stat-card",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(l,{icon:Le,className:"text-red-400"}),e.jsx("h3",{className:"text-gray-300 text-sm",children:"Bounce Rate"})]}),e.jsxs("p",{className:"text-2xl font-bold text-white",children:[n.bounce_rate.toFixed(1),"%"]}),e.jsx("p",{className:"text-gray-400 text-xs mt-1",children:"Single-page visits"})]})]}),e.jsxs("div",{className:"chart-container",children:[e.jsxs("h3",{className:"text-yellow-400 text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(l,{icon:L}),"Visitors Over Time"]}),e.jsx(V,{width:"100%",height:300,children:e.jsxs(Me,{data:n.daily_visits,children:[e.jsx(J,{strokeDasharray:"3 3",stroke:"#374151"}),e.jsx(ee,{dataKey:"date",stroke:"#9ca3af",tick:{fill:"#9ca3af"}}),e.jsx(te,{stroke:"#9ca3af",tick:{fill:"#9ca3af"}}),e.jsx(R,{contentStyle:{backgroundColor:"#1f2937",borderColor:"#4b5563",borderRadius:"6px",color:"#d1d5db"},labelStyle:{color:"#9ca3af",fontWeight:"bold"},formatter:t=>[t,"Visitors"]}),e.jsx(Ee,{wrapperStyle:{color:"#9ca3af"}}),e.jsx(Pe,{type:"monotone",dataKey:"visits",stroke:"#8884d8",strokeWidth:3,name:"Visitors",dot:{stroke:"#8884d8",strokeWidth:2,r:4},activeDot:{r:6,strokeWidth:0}})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"chart-container",children:[e.jsxs("h3",{className:"text-yellow-400 text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(l,{icon:De}),"Traffic Sources"]}),e.jsx(V,{width:"100%",height:250,children:e.jsxs(Ue,{children:[e.jsx(Be,{data:n.traffic_sources,cx:"50%",cy:"50%",labelLine:!1,label:({name:t,percentage:a})=>`${t}: ${a.toFixed(1)}%`,outerRadius:80,fill:"#8884d8",dataKey:"visitors",children:n.traffic_sources.map((t,a)=>e.jsx(Ie,{fill:K[a%K.length]},`cell-${a}`))}),e.jsx(R,{formatter:(t,a,o)=>{const r=o.payload.percentage||0;return[`${t} visitors (${r.toFixed(1)}%)`,a]},contentStyle:{backgroundColor:"#1f2937",borderColor:"#4b5563",borderRadius:"6px",color:"#d1d5db"}})]})})]}),e.jsxs("div",{className:"chart-container",children:[e.jsxs("h3",{className:"text-yellow-400 text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(l,{icon:Ve}),"Device Usage"]}),e.jsx(V,{width:"100%",height:250,children:e.jsxs(qe,{data:n.devices,children:[e.jsx(J,{strokeDasharray:"3 3",stroke:"#374151"}),e.jsx(ee,{dataKey:"device",stroke:"#9ca3af",tick:{fill:"#9ca3af"}}),e.jsx(te,{stroke:"#9ca3af",tick:{fill:"#9ca3af"}}),e.jsx(R,{formatter:(t,a,o)=>{const r=o.payload.percentage||0;return[`${t} visitors (${r.toFixed(1)}%)`,a]},contentStyle:{backgroundColor:"#1f2937",borderColor:"#4b5563",borderRadius:"6px",color:"#d1d5db"}}),e.jsx(He,{dataKey:"visitors",fill:"#82ca9d",radius:[4,4,0,0],name:"Visitors"})]})})]})]}),e.jsxs("div",{className:"chart-container",children:[e.jsxs("h3",{className:"text-yellow-400 text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(l,{icon:Re}),"Top Visitor Locations"]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-gray-300",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-700",children:[e.jsx("th",{className:"text-left py-3 px-4 text-sm font-semibold",children:"Country"}),e.jsx("th",{className:"text-left py-3 px-4 text-sm font-semibold",children:"City"}),e.jsx("th",{className:"text-left py-3 px-4 text-sm font-semibold",children:"Visitors"}),e.jsx("th",{className:"text-left py-3 px-4 text-sm font-semibold",children:"Percentage"})]})}),e.jsx("tbody",{children:n.locations.slice(0,5).map((t,a)=>e.jsxs("tr",{className:"border-b border-gray-800 hover:bg-gray-700/50 transition-colors",children:[e.jsxs("td",{className:"py-3 px-4 flex items-center gap-2",children:[e.jsx(l,{icon:Ae,className:"text-blue-400"}),t.country||"Unknown"]}),e.jsx("td",{className:"py-3 px-4",children:t.city||"Unknown"}),e.jsx("td",{className:"py-3 px-4 font-semibold",children:t.visitors}),e.jsx("td",{className:"py-3 px-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-24 bg-gray-700 rounded-full h-2",children:e.jsx("div",{className:"bg-yellow-500 h-2 rounded-full",style:{width:`${t.visitors/n.total_visitors*100}
143%`}})}),e.jsxs("span",{className:"text-sm",children:[n.total_visitors>0?(t.visitors/n.total_visitors*100).toFixed(1):"0.0","%"]})]})})]},a))})]})})]}),e.jsxs("div",{className:"chart-container",children:[e.jsx("h3",{className:"text-yellow-400 text-lg font-semibold mb-4",children:"Top Pages"}),e.jsx("div",{className:"space-y-3",children:n.top_pages.map((t,a)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-900/50 rounded-lg border border-gray-800",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"text-gray-300 truncate text-sm",children:t.url})}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-white font-semibold",children:[t.visitors," visitors"]}),e.jsxs("span",{className:"text-gray-400 text-sm",children:[O(t.avg_duration)," avg"]})]})]},a))})]})]}):e.jsxs("div",{className:"text-center py-12 text-gray-400",children:[e.jsx(l,{icon:_,className:"text-3xl mb-4"}),e.jsx("p",{children:"No analytics data available for this funnel in the selected time range."}),e.jsx("button",{onClick:()=>i&&u(i),className:"mt-4 bg-yellow-500 text-black font-semibold px-4 py-2 rounded-md hover:bg-yellow-600 transition-colors",children:"Try Again"})]})]}):e.jsx("div",{className:"bg-gray-800/80 border border-gray-700 rounded-lg p-6 space-y-6 flex flex-col items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(l,{icon:L,className:"text-yellow-400 text-5xl mb-4"}),e.jsx("h2",{className:"text-yellow-400 text-xl font-bold mb-2",children:"Select a Funnel to View Analytics"}),e.jsx("p",{className:"text-gray-300 mb-6",children:'Click the "View Analytics" button on any funnel to see detailed visitor statistics'}),e.jsxs("div",{className:"bg-gray-700/50 p-4 rounded-lg border border-dashed border-gray-600 max-w-md",children:[e.jsx("h3",{className:"text-yellow-400 font-semibold mb-3 text-lg",children:"Analytics Features:"}),e.jsxs("ul",{className:"text-gray-300 text-sm space-y-2 text-left",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(l,{icon:x,className:"text-green-400 mt-1"}),e.jsx("span",{children:"Visitor counts and trends over time"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(l,{icon:x,className:"text-green-400 mt-1"}),e.jsx("span",{children:"Traffic source analysis (Direct, Search, Social, Referral)"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(l,{icon:x,className:"text-green-400 mt-1"}),e.jsx("span",{children:"Device and browser breakdown (Desktop vs Mobile)"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(l,{icon:x,className:"text-green-400 mt-1"}),e.jsx("span",{children:"Geographic visitor locations (Country & City)"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(l,{icon:x,className:"text-green-400 mt-1"}),e.jsx("span",{children:"Session duration and bounce rates"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(l,{icon:x,className:"text-green-400 mt-1"}),e.jsx("span",{children:"Interactive charts and visualizations"})]})]})]}),e.jsxs("div",{className:"mt-6 text-xs text-gray-400",children:[e.jsxs("p",{children:["Data is collected from the ",e.jsx("code",{children:"visitor_analytics"})," table matching funnel URLs"]}),e.jsx("p",{children:"Time ranges: 7 days, 30 days, or 90 days"})]})]})})]})]})]})]})}export{tt as default};

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.