PageSourceSearch

https://kasbu.bio/assets/js/AnalyticsContent-DNM8OIUT.js

js kasbu.bio collected 2026-09-24 13:24:32 UTC 47,133 bytes, 1 lines download raw bytes

1import{c as e,af as a,r as s,ah as t,al as n,df as r,j as l,aF as i,c0 as c,ay as o,a as d,cD as x,bY as m,e1 as u,aw as g,ab as p,cI as h,a3 as f,ca as y,dm as j,aM as v,aE as N,bW as b,eg as w,aq as k,ar as _,H as P,aC as C}from"../index-DEUA2RFd.js";import{C as S,a as D,d as L,b as A,c as z}from"./card-BM8RaaJO.js";import{aP as M,aK as R,aR as $,aT as T,aU as U,aL as V,aM as F,aN as E,aO as I,aQ as B,aS as O,aV as H,aW as K,W as q,aX as G,aY as W}from"./AreaChart-Bsir-7xi.js";import{S as Y}from"./skeleton-CE5ZlPwg.js";import{p as J}from"./breadcrumb-ZXBinHjl.js";import{C as X}from"./chevron-up-D3rSpFhM.js";import{A as Q}from"./arrow-down-RvD_XCac.js";import{C as Z}from"./chevron-down-B9Gs8iyb.js";import{A as ee,a as ae,b as se}from"./avatar-I3VCS5W5.js";import{A as te}from"./InspirationPage-CYvrBLKs.js";import{C as ne}from"./compass-skf8wjeJ.js";import{E as re}from"./eye-YpN3FKU4.js";import{S as le}from"./share-2-DSimZDpM.js";import"./cjs-helpers-BrGt3VpK.js";import"./supabase-vendor-DuR9KhUO.js";import"./with-selector-d5dkZrVI.js";import"./index-Bed6uwTu.js";import"./use-mobile-BhPKCqSJ.js";import"./dropdown-menu-BV6eXa4T.js";import"./floating-ui.utils.dom-BqM5d6Lx.js";import"./tslib.es6-BXeS4LEp.js";import"./circle-xMfCT8u9.js";import"./index-Bg74Md2a.js";import"./SiteHeader-DdZxADr9.js";import"./LandingMenuButton-Ck_e3ITg.js";import"./SectionEmbed-BINTU38_.js";import"./ProfileBubble-BA6XW-U-.js";import"./LanguageDropdown-ClOZWKE3.js";import"./useDragScroll-BPo1Qk45.js";import"./PageHero-D9HUkQUD.js";import"./text-animate-D6vWegnb.js";import"./footer-2-DBYs8qBf.js";import"./CurvedLoop-DDiKkCHA.js";import"./video-Cl5vLW4e.js";import"./folder-WoeZHZ5D.js";const ie=e("trending-down",[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]),ce=e("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]),oe={mobile:"#5865F2",desktop:"#7c6aef",tablet:"#a196f5"},de={chrome:"#4285F4",safari:"#006CFF",firefox:"#FF7139",edge:"#0078D7",opera:"#FF1B2D",samsung:"#1428A0",other:"#9ca3af"};function xe(e){var a,s,t;return{id:e.id,eventName:e.event_name,tableName:e.table_name,recordId:e.record_id,changedFields:e.changed_fields,title:(null==(a=e.new_data)?void 0:a.title)??(null==(s=e.new_data)?void 0:s.grid_name)??null,source:(null==(t=e.metadata)?void 0:t.source)??null,createdAt:e.created_at}}function me(e){return{id:`visit-${e.id}`,eventName:"profile_viewed",tableName:"profile_visits",recordId:null,changedFields:null,title:null,source:null,createdAt:e.visited_at,country:e.country,city:e.city,deviceType:e.device_type,browser:(a=e.user_agent,a?/Edg\//i.test(a)?"edge":/OPR\/|Opera/i.test(a)?"opera":/Firefox\//i.test(a)?"firefox":/Chrome\/|CriOS/i.test(a)?"chrome":/Safari\//i.test(a)?"safari":"other":null)};var a}const ue=(e=50,l=-1)=>{var i;const{user:c}=a(),o=(null==(i=t())?void 0:i.activeProfileId)??null,[d,x]=s.useState([]),[m,u]=s.useState(!0),[g,p]=s.useState(!1),[h,f]=s.useState(!0),y=s.useRef(null),j=s.useRef(null),v=s.useCallback(async(a,s)=>{if(c){s?p(!0):u(!0);try{const t=j.current;let l=n.from("sauron_eye_audit").select("id, event_name, table_name, record_id, changed_fields, new_data, metadata, created_at").eq("user_id",c.id);t&&(l=l.gte("created_at",t)),a&&(l=l.lt("created_at",a));const{data:i,error:d}=await l.order("created_at",{ascending:!1}).limit(e);if(d)throw d;let m=[];try{let s=n.from("profile_visits").select("id, visited_at, country, city, device_type, user_agent").eq("profile_id",c.id);t&&(s=s.gte("visited_at",t)),a&&(s=s.lt("visited_at",a));const{data:r}=await s.order("visited_at",{ascending:!1}).limit(e);m=r??[]}catch{}let u=[];if(o)try{u=(await r(o,a??void 0,e)).filter(e=>!t||e.followedAt>=t).map(e=>({id:`follow-${e.id}`,eventName:"follower_gained",tableName:"follows",recordId:e.id,changedFields:null,title:e.title,source:null,createdAt:e.followedAt,actorUsername:e.username,actorPhotoUrl:e.photoUrl}))}catch{}const g=[...(i??[]).map(xe),...m.map(me),...u].sort((e,a)=>a.createdAt.localeCompare(e.createdAt)).slice(0,e),p=((null==i?void 0:i.length)??0)>=e,h=m.length>=e,v=u.length>=e;f(p||h||v),g.length>0&&(y.current=g[g.length-1].createdAt),x(e=>s?[...e,...g]:g)}catch(t){console.error("Error fetching profile activity:",t),s||x([])}finally{s?p(!1):u(!1)}}},[c,e,o]);s.useEffect(()=>{if(!c)return void u(!1);let e=null;if(l>=0){const a=new Date;0===l?a.setHours(0,0,0,0):a.setDate(a.getDate()-l),e=a.toISOString()}j.current=e,y.current=null,x([]),f(!0),v(null,!1)},[c,l,v]);const N=s.useCallback(()=>{!g&&h&&v(y.current,!0)},[g,h,v]);
1return{activity:d,loading:m,loadingMore:g,hasMore:h,loadMore:N}},ge=s.createContext(null);function pe(){const e=s.useContext(ge);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const he=s.forwardRef(({id:e,className:a,children:t,config:n,...r},c)=>{const o=s.useId(),d=`chart-${e||o.replace(/:/g,"")}`;return l.jsx(ge.Provider,{value:{config:n},children:l.jsxs("div",{"data-chart":d,ref:c,className:i("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",a),...r,children:[l.jsx(fe,{id:d,config:n}),l.jsx(R,{children:t})]})})});he.displayName="Chart";const fe=({id:e,config:a})=>{const s=Object.entries(a).filter(([,e])=>e.color);return s.length?l.jsx("style",{dangerouslySetInnerHTML:{__html:`\n[data-chart=${e}] {\n${s.map(([e,a])=>`  --color-${e}: ${a.color};`).join("\n")}\n}\n`}}):null},ye=M,je=s.forwardRef(({active:e,payload:a,className:t,indicator:n="dot",hideLabel:r=!1,hideIndicator:c=!1,label:o,labelFormatter:d,labelClassName:x,formatter:m,color:u,nameKey:g,labelKey:p},h)=>{const{config:f}=pe(),y=s.useMemo(()=>{var e;if(r||!(null==a?void 0:a.length))return null;const[s]=a,t=`${p||(null==s?void 0:s.dataKey)||(null==s?void 0:s.name)||"value"}`,n=ve(f,s,t),c=p||"string"!=typeof o?null==n?void 0:n.label:(null==(e=f[o])?void 0:e.label)||o;return d?l.jsx("div",{className:i("font-medium",x),children:d(c,a)}):c?l.jsx("div",{className:i("font-medium",x),children:c}):null},[o,d,a,r,x,f,p]);if(!e||!(null==a?void 0:a.length))return null;const j=1===a.length&&"dot"!==n;return l.jsxs("div",{ref:h,className:i("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",t),children:[j?null:y,l.jsx("div",{className:"grid gap-1.5",children:a.filter(e=>"none"!==e.type).map((e,a)=>{var s;const t=`${g||e.name||e.dataKey||"value"}`,r=ve(f,e,t),o=u||(null==(s=e.payload)?void 0:s.fill)||e.color;return l.jsx("div",{className:i("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===n&&"items-center"),children:m&&void 0!==(null==e?void 0:e.value)&&e.name?m(e.value,e.name,e,a,e.payload):l.jsxs(l.Fragment,{children:[(null==r?void 0:r.icon)?l.jsx(r.icon,{}):!c&&l.jsx("div",{className:i("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===n,"w-1":"line"===n,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===n,"my-0.5":j&&"dashed"===n}),style:{"--color-bg":o,"--color-border":o}}),l.jsxs("div",{className:i("flex flex-1 justify-between leading-none",j?"items-end":"items-center"),children:[l.jsxs("div",{className:"grid gap-1.5",children:[j?y:null,l.jsx("span",{className:"text-muted-foreground",children:(null==r?void 0:r.label)||e.name})]}),void 0!==e.value&&null!==e.value&&l.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:String(e.value)})]})]})},e.dataKey)})})]})});je.displayName="ChartTooltip";function ve(e,a,s){if("object"!=typeof a||null===a)return;const t="payload"in a&&"object"==typeof a.payload&&null!==a.payload?a.payload:void 0;let n=s;return s in a&&"string"==typeof a[s]?n=a[s]:t&&s in t&&"string"==typeof t[s]&&(n=t[s]),n in e?e[n]:e[s]}s.forwardRef(({className:e,hideIcon:a=!1,payload:s,verticalAlign:t="bottom",nameKey:n},r)=>{const{config:c}=pe();return(null==s?void 0:s.length)?l.jsx("div",{ref:r,className:i("flex items-center justify-center gap-4","top"===t?"pb-3":"pt-3",e),children:s.filter(e=>"none"!==e.type).map(e=>{const s=`${n||e.dataKey||"value"}`,t=ve(c,e,s);return l.jsxs("div",{className:i("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[(null==t?void 0:t.icon)&&!a?l.jsx(t.icon,{}):l.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),null==t?void 0:t.label]},String(e.value))})}):null}).displayName="ChartLegend";const Ne=s.forwardRef(({className:e,...a},s)=>l.jsx("div",{className:"relative w-full overflow-auto",children:l.jsx("table",{ref:s,className:i("w-full caption-bottom text-sm",e),...a})}));Ne.displayName="Table";const be=s.forwardRef(({className:e,...a},s)=>l.jsx("thead",{ref:s,className:i("[&_tr]:border-b",e),...a}));be.displayName="TableHeader";const we=s.forwardRef(({className:e,...a},s)=>l.jsx("tbody",{ref:s,className:i("[&_tr:last-child]:border-0",e),...a}));
1we.displayName="TableBody";s.forwardRef(({className:e,...a},s)=>l.jsx("tfoot",{ref:s,className:i("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...a})).displayName="TableFooter";const ke=s.forwardRef(({className:e,...a},s)=>l.jsx("tr",{ref:s,className:i("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...a}));ke.displayName="TableRow";const _e=s.forwardRef(({className:e,...a},s)=>l.jsx("th",{ref:s,className:i("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...a}));_e.displayName="TableHead";const Pe=s.forwardRef(({className:e,...a},s)=>l.jsx("td",{ref:s,className:i("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...a}));Pe.displayName="TableCell";s.forwardRef(({className:e,...a},s)=>l.jsx("caption",{ref:s,className:i("mt-4 text-sm text-muted-foreground",e),...a})).displayName="TableCaption";const Ce=J("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Se({className:e,variant:a,...s}){return l.jsx("div",{className:i(Ce({variant:a}),e),...s})}const De=s.createContext(null);function Le(){const e=s.useContext(De);if(!e)throw new Error("DeltaIcon and DeltaValue must be used inside a `Delta` component.");return e.value}function Ae({className:e,value:a,variant:s="default",...t}){return l.jsx(De.Provider,{value:{value:a},children:"badge"===s?l.jsx(Se,{className:i("gap-1 border-none tabular-nums [&_svg]:size-4 [&_svg]:shrink-0",a>0?"bg-emerald-500/10 text-emerald-500":"bg-red-500/10 text-red-500",e),"data-slot":"delta",variant:"secondary",...t}):l.jsx("div",{className:i("inline-flex items-center gap-1 text-gray-500 tabular-nums","[&_svg]:size-3 [&_svg]:shrink-0",a>0?"text-emerald-600":"",a<0?"text-rose-600":"",e),"data-slot":"delta",...t})})}function ze({value:e,children:a}){return l.jsx("span",{className:i("inline-flex size-3 shrink-0 items-center justify-center rounded-full","[&_svg]:size-2! [&_svg]:shrink-0 [&_svg]:stroke-3! [&_svg]:text-white",e>0&&"bg-emerald-500",e<0&&"bg-red-500",(!e||0===e)&&"bg-gray-500"),"data-slot":"delta-icon",children:a})}function Me({variant:e="default",filled:a=!1,className:s,...t}){const n=Le(),r=i(s),d=e=>a?l.jsx(ze,{value:n,children:e}):e,x=a?{}:{"data-slot":"delta-icon"};return d(n&&0!==n?n>0?"trend"===e?l.jsx(ce,{...x,className:r,...t}):"arrow"===e?l.jsx(o,{...x,className:r,...t}):l.jsx(X,{...x,className:r,...t}):"trend"===e?l.jsx(ie,{...x,className:r,...t}):"arrow"===e?l.jsx(Q,{...x,className:r,...t}):l.jsx(Z,{...x,className:r,...t}):l.jsx(c,{...x,className:r,...t}))}function Re({className:e,precision:a=1,suffix:s="%",absolute:t=!0,...n}){const r=Le(),c=(t?Math.abs(r):r).toFixed(a);return l.jsxs("span",{className:i("tabular-nums",e),"data-slot":"delta-value",...n,children:[c,s]})}const $e={Mexico:"MX","United States":"US","United Kingdom":"GB",Canada:"CA",Brazil:"BR",Argentina:"AR",Colombia:"CO",Spain:"ES",France:"FR",Germany:"DE",Italy:"IT",Japan:"JP",China:"CN",India:"IN",Australia:"AU",Netherlands:"NL",Belgium:"BE",Switzerland:"CH",Sweden:"SE",Norway:"NO",Denmark:"DK",Finland:"FI",Poland:"PL",Russia:"RU","South Korea":"KR",Chile:"CL",Peru:"PE",Venezuela:"VE",Ecuador:"EC",Uruguay:"UY",Paraguay:"PY",Bolivia:"BO","Costa Rica":"CR",Panama:"PA",Guatemala:"GT",Honduras:"HN","El Salvador":"SV",Nicaragua:"NI","Dominican Republic":"DO","Puerto Rico":"PR",Cuba:"CU"};function Te(e){return l.jsx(W,{fill:"#f3f4f6",fillOpacity:.5,radius:8,stroke:"none",...e})}function Ue({data:e,peakHour:a,gradId:s,config:t,className:n="aspect-[16/6] min-h-[150px] w-full"}){return l.jsx(he,{className:n,config:t,children:l.jsxs(H,{accessibilityLayer:!0,data:e,margin:{left:4,right:8,top:18,bottom:0},children:[l.jsxs("defs",{children:[l.jsxs("linearGradient",{id:s,x1:"0",x2:"0",y1:"0",y2:"1",children:[l.jsx("stop",{offset:"0%",stopColor:"var(--color-count)",stopOpacity:.45}),l.jsx("stop",{offset:"100%",stopColor:"var(--color-count)",stopOpacity:0})]}),l.jsxs("linearGradient",{id:`${s}-stroke`,x1:"0",x2:"0",y1:"0",y2:"1",children:[l.jsx("stop",{offset:"0%",stopColor:"var(--color-count)",stopOpacity:1}),l.jsx("stop",{offset:"100%",stopColor:"var(--color-count)",stopOpacity:0})]})]}),l.jsx(F,{className:"stroke-gray-200",vertical:!1}
1),l.jsx(E,{axisLine:!1,dataKey:"label",interval:2,tickLine:!1,tickMargin:8}),l.jsx(I,{allowDecimals:!1,axisLine:!1,tick:{className:"tabular-nums"},tickLine:!1,tickMargin:8,width:Xe}),l.jsx(ye,{content:l.jsx(je,{className:"min-w-[8.5rem]",indicator:"line"}),cursor:l.jsx(Te,{})}),l.jsxs(K,{dataKey:"count",radius:4,strokeWidth:.5,children:[e.map(e=>{const t=!!a&&e.hour===a.hour&&e.count>0;return l.jsx(q,{fill:t?"var(--color-count)":`url(#${s})`,stroke:t?"transparent":`url(#${s}-stroke)`},e.hour)}),l.jsx(G,{dataKey:"count",content:s=>{const{x:t,y:n,width:r,index:i}=s;if(null==a||null==i)return null;const c=e[i];return c&&c.hour===a.hour&&c.count?l.jsx("text",{x:Number(t)+Number(r)/2,y:Number(n)-6,textAnchor:"middle",className:"fill-gray-900 text-[11px] tabular-nums",children:a.label}):null}})]})]})})}function Ve({value:e,name:a}){const{t:s}=d(),t=(n=e)&&"Unknown"!==n&&"Localhost"!==n?($e[n]||(2===n.length?n:n.substring(0,2))).toUpperCase():"";var n;return t?l.jsx("img",{alt:s("settings.analyticsPage.flagAlt",{code:t}),className:"h-3.5 w-5 shrink-0 rounded object-cover",height:14,loading:"lazy",src:`https://flag.vercel.app/s/${t}.svg`,title:a,width:20}):l.jsx("span",{className:"text-base leading-none",children:"🌍"})}function Fe({ariaLabel:e,items:a,total:s}){const t=[...a].sort((e,a)=>a.value-e.value);return l.jsx("ul",{"aria-label":e,className:"relative z-10 my-auto flex w-full flex-col gap-0.5",children:t.map(e=>{const a=s>0?Math.round(e.value/s*100):0,t=e.color??"hsl(var(--chart-2))";return l.jsxs("li",{className:"group relative flex h-9 items-center gap-2 overflow-hidden px-3",children:[l.jsxs("div",{className:"z-10 flex w-full items-center justify-between gap-2 text-sm",children:[l.jsx("span",{className:"text-pretty",children:e.label}),l.jsxs("span",{className:"font-medium tabular-nums",children:[a,"%"]})]}),l.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute top-0 left-0 h-full border-r-2 border-solid",style:{width:`${Math.max(a,2)}%`,borderRightColor:`color-mix(in srgb, ${t} 80%, transparent)`,backgroundImage:`linear-gradient(to right, color-mix(in srgb, ${t} 4%, transparent), color-mix(in srgb, ${t} 36%, transparent))`}})]},e.label)})})}function Ee({title:e,header:a,description:t,caption:n,rows:r,total:i,emptyLabel:c}){const{t:o,language:x}=d(),m=y(x),[u,g]=s.useState(!1),p=r.length>6,h=u?r:r.slice(0,6);return l.jsxs(S,{className:"relative flex flex-col shadow-none",children:[l.jsxs(D,{children:[l.jsx(A,{children:e}),l.jsx(z,{children:t})]}),l.jsx(L,{className:"p-0 pb-2",children:r.length>0?l.jsxs("div",{className:"relative w-full overflow-x-auto",children:[l.jsxs(Ne,{className:"border-t",children:[l.jsx("caption",{className:"sr-only",children:n}),l.jsx(be,{children:l.jsxs(ke,{children:[l.jsx(_e,{className:"pl-6",children:a}),l.jsx(_e,{className:"text-end tabular-nums",children:o("settings.analyticsPage.visitsCol")}),l.jsx(_e,{className:"pr-6 text-end",children:o("settings.analyticsPage.shareCol")})]})}),l.jsx(we,{children:h.map(e=>{const a=i>0?Math.round(e.count/i*100):0;return l.jsxs(ke,{className:"hover:bg-transparent",children:[l.jsx(Pe,{className:"max-w-[220px] truncate pl-6 font-medium",children:l.jsxs("span",{className:"inline-flex max-w-full items-center gap-2",children:[l.jsx(Ve,{name:e.name,value:e.code}),l.jsx("span",{className:"min-w-0 truncate text-xs",children:e.name})]})}),l.jsx(Pe,{className:"text-end text-gray-500 text-xs tabular-nums",children:e.count.toLocaleString(m)}),l.jsx(Pe,{className:"pr-6 text-end text-gray-500 text-xs",children:l.jsxs("span",{className:"tabular-nums",children:[a,"%"]})})]},e.key)})})]}),p&&!u&&l.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 flex h-16 items-end justify-center bg-gradient-to-t from-white via-white/85 to-transparent",children:l.jsxs("button",{className:"pointer-events-auto inline-flex items-center gap-1 rounded-md px-3 py-1.5 font-medium text-gray-500 text-xs transition-colors hover:text-gray-900",onClick:()=>g(!0),type:"button",children:[o("settings.analyticsPage.viewAll"),l.jsx(te,{className:"size-3.5"})]})})]}):l.jsx("p",{className:"px-6 py-10 text-center text-gray-500 text-sm",children:c})})]})}const Ie={card_created:"bg-emerald-500",card_updated:"bg-sky-500",card_deleted:"bg-rose-500",grid_created:"bg-emerald-500",grid_updated:"bg-sky-500",grid_deleted:"bg-rose-500",follower_gained:"bg-violet-500"},Be={card_created:"cardCreated",card_updated:"cardUpdated",card_deleted:"cardDeleted",grid_created:"gridCreated",grid_updated:"gridUpdated",grid_deleted:"gridDeleted",follower_gained:"followerGained"},Oe={card_created:"created",card_updated:"updated",card_deleted:"deleted",grid_created:"created",grid_updated:"updated",grid_deleted:"deleted",follower_gained:"followed"};function He(e,a){const s=Ie[e]??"bg-slate-400",t=Be[e],n=Oe[e];return{label:t?a(`settings.analyticsPage.events.${t}`):e.replace(/_/g," ").replace(/^./,e=>e.toUpperCase()),action:a(n?`settings.analyticsPage.actions.${n}`:"settings.analyticsPage.actions.changed"),dot:s}}function Ke(e,a){return new Date(e).toLocaleDateString(a,{month:"short",day:"numeric"})}function qe(e,a){return new Date(e).toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"})}function Ge(e,a,s){const t=new Date(e).getTime(),n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return a("settings.analyticsPage.justNow");if(r<60)return a("settings.analyticsPage.minutesAgo",{n:String(r)});const l=Math.floor(r/60);if(l<24)return a("settings.analyticsPage.hoursAgo",{n:String(l)}
1);const i=Math.floor(l/24);return i<7?a("settings.analyticsPage.daysAgo",{n:String(i)}):Ke(e,s)}function We({days:e,onViewAll:a}){const{t:s}=d(),{activity:t,loading:n}=ue(50,e),{userRole:r}=x(),i=h(r),c=l.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b px-4 py-3",children:[l.jsxs("span",{className:"flex items-center gap-2.5",children:[l.jsxs("span",{className:"relative flex size-2.5",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-red-400 opacity-75"}),l.jsx("span",{className:"relative inline-flex size-2.5 rounded-full bg-red-500"})]}),l.jsx("span",{className:"font-medium text-gray-900 text-sm leading-none",children:s("settings.analyticsPage.live")})]}),a&&l.jsxs("button",{className:"inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1 font-medium text-gray-500 text-xs transition-colors hover:bg-gray-100 hover:text-gray-900",onClick:a,type:"button",children:[s("settings.analyticsPage.viewMore"),l.jsx(te,{className:"size-3.5"})]})]});return n?l.jsxs(S,{className:"flex h-96 flex-col overflow-hidden shadow-none",children:[c,l.jsx("div",{className:"space-y-3 p-4",children:Array.from({length:4}).map((e,a)=>l.jsx(Y,{className:"h-10 w-full"},a))})]}):0===t.length?l.jsxs(S,{className:"flex h-96 flex-col overflow-hidden shadow-none",children:[c,l.jsx("p",{className:"px-6 py-10 text-center text-gray-500 text-sm",children:s("settings.analyticsPage.noActivity")})]}):l.jsxs(S,{className:"flex h-96 flex-col overflow-hidden shadow-none",children:[c,l.jsx(Je,{rows:t.slice(0,8),blurCity:!i})]})}const Ye={chrome:$,safari:ne,firefox:u,edge:m,opera:m};function Je({rows:e,blurCity:a=!1}){const{t:s,language:t}=d(),n=y(t);return l.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",children:[l.jsx("ol",{className:"relative px-4 py-3.5",children:e.map((t,r)=>{const i="profile_viewed"===t.eventName,c=r===e.length-1;let o,d,x=null;if(i){const e=(t.deviceType??"desktop").toLowerCase(),n="mobile"===e?g:"tablet"===e?T:U,r=Ye[(t.browser??"").toLowerCase()]??m,i=t.city&&"Unknown"!==t.city?t.city:null,c=t.country&&"Unknown"!==t.country?t.country:null;d=re,o=s("settings.analyticsPage.profileViewed"),x=l.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[l.jsx(n,{className:"size-3.5 shrink-0 text-gray-300"}),l.jsx(r,{className:"size-3.5 shrink-0 text-gray-300"}),c&&l.jsx(Ve,{value:c,name:c}),l.jsx("span",{className:"truncate "+(a?"select-none blur-[3px]":""),children:i??c??s("settings.analyticsPage.unknown")})]})}else{const e=t.tableName.includes("grid");d=e?v:O,o=He(t.eventName,s).label,x=l.jsx("span",{className:"truncate",children:t.title||s(e?"settings.analyticsPage.untitledGrid":"settings.analyticsPage.untitledCard")})}return l.jsxs("li",{className:"relative flex items-center gap-3 py-3.5",children:[!c&&l.jsx("span",{className:"absolute left-[3.5px] top-1/2 bottom-[-50%] w-px bg-gray-300","aria-hidden":"true"}),l.jsx("span",{className:"relative z-10 size-2 shrink-0 rounded-full bg-gray-300"}),l.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 text-sm text-gray-900",children:[l.jsx(d,{className:"size-3.5 shrink-0 text-gray-500"}),l.jsx("span",{className:"truncate",children:o})]}),l.jsxs("span",{className:"flex min-w-0 shrink-0 items-center gap-3 text-xs text-gray-500",children:[l.jsx("span",{className:"min-w-0 max-w-[11rem] truncate",children:x}),l.jsx("span",{className:"shrink-0 tabular-nums",children:Ge(t.createdAt,s,n)})]})]},t.id)})}),l.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-white via-white/80 to-transparent","aria-hidden":"true"}),a&&l.jsxs("a",{className:"absolute inset-x-0 bottom-0 z-10 flex items-center justify-center gap-1.5 px-4 pb-3 pt-6 font-medium text-gray-500 text-xs transition-colors hover:text-gray-900",href:"/upgrade?reason=analytics",children:[l.jsx(p,{className:"size-3 shrink-0"}),s("settings.analyticsPage.cityLocked")]})]})}const Xe=38,Qe=[{key:"today",value:0},{key:"d7",value:7},{key:"d30",value:30},{key:"d90",value:90},{key:"all",value:-1}
1],Ze=(e,a)=>!a&&0!==e;function ea({days:e,isPro:a,onChange:s,className:t=""}){const{t:n}=d();return l.jsx("div",{className:`flex items-center gap-1 rounded-xl bg-gray-100 p-1 ${t}`,children:Qe.map(({key:t,value:r})=>{const i=Ze(r,a);return l.jsxs("button",{onClick:()=>s(r),className:"inline-flex items-center gap-1 rounded-lg px-3 py-1.5 font-medium text-xs transition-all "+(e===r?"bg-white text-gray-900 shadow-sm":"text-gray-500 hover:text-gray-900"),type:"button",children:[i&&l.jsx(p,{className:"size-3 shrink-0 opacity-60"}),n(`settings.analyticsPage.range.${t}`)]},r)})})}function aa({onBack:e,isPro:a}){const{t:t,language:n}=d(),r=y(n),[i,c]=s.useState(-1),[o,x]=s.useState("all"),{activity:m,loading:u,loadingMore:h,hasMore:N,loadMore:b}=ue(50,i),w=m.filter(e=>"views"===o?"profile_viewed"===e.eventName:"changes"!==o||"profile_viewed"!==e.eventName&&"follower_gained"!==e.eventName),k=f.useRef(null);return f.useEffect(()=>{const e=k.current;if(!e)return;const a=new IntersectionObserver(e=>{var a;(null==(a=e[0])?void 0:a.isIntersecting)&&b()},{threshold:.1});return a.observe(e),()=>a.disconnect()},[b]),l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b px-6 py-4 shrink-0",children:[l.jsxs("button",{className:"inline-flex items-center gap-1.5 rounded-md px-2 py-1.5 text-sm text-gray-500 hover:bg-gray-100 hover:text-gray-900 transition-colors",onClick:e,type:"button",children:[l.jsx(te,{className:"size-4 rotate-180"}),t("settings.cancellation.back")]}),l.jsx("div",{className:"hidden h-4 w-px bg-gray-200 sm:block"}),l.jsxs("div",{className:"order-last flex w-full items-center gap-2 sm:order-none sm:w-auto",children:[l.jsxs("span",{className:"relative flex size-2",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-red-400 opacity-75"}),l.jsx("span",{className:"relative inline-flex size-2 rounded-full bg-red-500"})]}),l.jsx("span",{className:"font-semibold text-sm",children:t("settings.analyticsPage.activityLog")})]}),l.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[l.jsx("div",{className:"flex items-center gap-1 bg-gray-100 rounded-xl p-1",children:["all","views","changes"].map(e=>l.jsx("button",{onClick:()=>x(e),className:"px-3 py-1.5 rounded-lg text-xs font-medium transition-all "+(o===e?"bg-white text-gray-900 shadow-sm":"text-gray-500 hover:text-gray-900"),type:"button",children:t("all"===e?"settings.analyticsPage.filterAll":"views"===e?"settings.analyticsPage.filterViews":"settings.analyticsPage.filterChanges")}
1,e))}),l.jsx(ea,{days:i,isPro:!0,onChange:c})]})]}),!a&&l.jsxs("a",{className:"flex shrink-0 items-center justify-center gap-1.5 border-b bg-gray-50 px-6 py-2 font-medium text-gray-500 text-xs transition-colors hover:text-gray-900",href:"/upgrade?reason=analytics",children:[l.jsx(p,{className:"size-3 shrink-0"}),t("settings.analyticsPage.cityLocked")]}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:u?l.jsx("div",{className:"space-y-2 p-6",children:Array.from({length:8}).map((e,a)=>l.jsx(Y,{className:"h-10 w-full"},a))}):0===w.length?l.jsx("p",{className:"py-20 text-center text-gray-500 text-sm",children:t("settings.analyticsPage.noActivity")}):l.jsxs("div",{className:"divide-y",children:[w.map(e=>{var s;if("profile_viewed"===e.eventName){const s=(e.deviceType??"desktop").toLowerCase(),n="mobile"===s?g:"tablet"===s?T:U,i=e.city&&"Unknown"!==e.city?e.city:null,c=e.country&&"Unknown"!==e.country?e.country:null;return l.jsx("div",{className:"transition-colors hover:bg-gray-50",children:l.jsxs("div",{className:"grid items-center gap-4 px-6 py-3 text-sm grid-cols-[minmax(0,0.85fr)_auto_minmax(0,1.2fr)_minmax(0,0.5fr)]",children:[l.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-gray-900",children:[l.jsx(re,{className:"size-4 shrink-0 text-gray-500"}),l.jsx("span",{className:"truncate font-medium",children:t("settings.analyticsPage.profileViewed")})]}),l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"inline-block size-2 shrink-0 rounded-full bg-gray-500/40"}),l.jsx("span",{className:"text-gray-500 text-xs",children:t("settings.analyticsPage.view")})]}),l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c&&l.jsx(Ve,{value:c,name:c}),l.jsx("span",{className:"truncate text-xs",children:i&&c?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"font-medium text-gray-900 "+(a?"":"select-none blur-[3px]"),children:i}),l.jsxs("span",{className:"text-gray-500",children:[", ",c]})]}):i?l.jsx("span",{className:"text-gray-500 "+(a?"":"select-none blur-[3px]"),children:i}):l.jsx("span",{className:"text-gray-500",children:c??t("settings.analyticsPage.unknown")})}),l.jsx(n,{className:"size-3.5 shrink-0 text-gray-500 ml-1"})]}),l.jsxs("span",{className:"flex flex-col items-end text-end",children:[l.jsx("span",{className:"text-gray-900 text-xs tabular-nums",children:Ke(e.createdAt,r)}),l.jsx("span",{className:"text-gray-500 text-xs tabular-nums",children:qe(e.createdAt,r)})]})]})},e.id)}if("follower_gained"===e.eventName){const a=He(e.eventName,t),n=(null==(s=e.title)?void 0:s.trim())||e.actorUsername||"";return l.jsx("div",{className:"transition-colors hover:bg-gray-50",children:l.jsxs("div",{className:"grid items-center gap-4 px-6 py-3 text-sm grid-cols-[minmax(0,0.85fr)_auto_minmax(0,1.2fr)_minmax(0,0.5fr)]",children:[l.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-gray-900",children:[l.jsx(j,{className:"size-4 shrink-0 text-gray-500"}),l.jsx("span",{className:"truncate font-medium",children:a.label})]}),l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:`inline-block size-2 shrink-0 rounded-full ${a.dot}`}),l.jsx("span",{className:"text-gray-900 text-xs",children:a.action})]}),l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsxs(ee,{className:"size-6 shrink-0",children:[l.jsx(ae,{src:e.actorPhotoUrl??void 0,alt:""}),l.jsx(se,{className:"bg-gray-100 text-[10px] font-semibold uppercase text-gray-400",children:n.charAt(0)})]}),e.actorUsername?l.jsxs("a",{href:`/${e.actorUsername}`,className:"truncate rounded outline-none hover:underline focus-visible:ring-2 focus-visible:ring-gray-400/60",children:["@",e.actorUsername]}):l.jsx("span",{className:"truncate text-gray-500",children:n})]}),l.jsxs("span",{className:"flex flex-col items-end text-end",children:[l.jsx("span",{className:"text-gray-900 text-xs tabular-nums",children:Ke(e.createdAt,r)}),l.jsx("span",{className:"text-gray-500 text-xs tabular-nums",children:qe(e.createdAt,r)})]})]})},e.id)}const n=He(e.eventName,t),i=e.tableName.includes("grid"),c=function(e,a){return e&&0!==e.length?e.includes("*")?a("settings.analyticsPage.allFields"):e.map(e=>e.replace(/_/g," ")).join(", "):null}(e.changedFields,t),o=e.title||t(i?"settings.analyticsPage.untitledGrid":"settings.analyticsPage.untitledCard"),d=i?v:O;return l.jsx("div",{className:"transition-colors hover:bg-gray-50",children:l.jsxs("div",{className:"grid items-center gap-4 px-6 py-3 text-sm grid-cols-[minmax(0,0.85fr)_auto_minmax(0,1.2fr)_minmax(0,0.5fr)]",children:[l.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-gray-900",children:[l.jsx(d,{className:"size-4 shrink-0 text-gray-500"}),l.jsx("span",{className:"truncate font-medium",children:n.label})]}),l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:`inline-block size-2 shrink-0 rounded-full ${n.dot}`}),l.jsx("span",{className:"text-gray-900 text-xs capitalize",children:n.action})]}),l.jsxs("div",{className:"flex min-w-0 flex-col",children:[l.jsx("span",{className:"truncate",children:o}),c&&l.jsx("span",{className:"truncate text-gray-500 text-xs",children:c})]}),l.jsxs("span",{className:"flex flex-col items-end text-end",children:[l.jsx("span",{className:"text-gray-900 text-xs tabular-nums",children:Ke(e.createdAt,r)}),l.jsx("span",{className:"text-gray-500 text-xs tabular-nums",children:qe(e.createdAt,r)})]})]})},e.id)}),l.jsxs("div",{ref:k,className:"py-2 flex justify-center",children:[h&&l.jsx(Y,{className:"h-8 w-full mx-6"}),!h&&N&&l.jsx("span",{className:"text-gray-500 text-xs",children:t("settings.analyticsPage.loadingMore")})]})]})})]})}function sa({periodVisits:e}){const{t:a,language:s}=d(),t=y(s),n=w();return l.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 flex justify-center px-4",children:l.jsx(S,{className:"pointer-events-auto sticky top-24 h-fit w-full max-w-sm",children:l.jsxs(L,{className:"flex flex-col items-center gap-3 p-6 text-center",children:[l.jsx("span",{className:"flex size-10 items-center justify-center rounded-full bg-gray-100",children:l.jsx(b,{className:"size-5 text-gray-900"})}),l.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-gray-100 px-2.5 py-1 font-medium text-gray-500 text-xs tabular-nums",children:[l.jsx(re,{className:"size-3.5 shrink-0"}
1),a("settings.analyticsPage.teaserVisits",{count:e.toLocaleString(t)})]}),l.jsx(A,{className:"text-balance",children:a("settings.analyticsPage.lockedTitle")}),l.jsx(z,{className:"text-pretty",children:a("settings.analyticsPage.lockedBody")}),l.jsx(ta,{price:n})]})})})}function ta({price:e}){const{t:a}=d();return l.jsx(N,{fullWidth:!0,href:"/upgrade?reason=analytics",trailing:"arrow",variant:"primary",children:e?a("settings.analyticsPage.lockedCtaPriced",{price:e}):a("settings.analyticsPage.lockedCta")})}function na(){var e;const{t:a}=d(),s=null==(e=t())?void 0:e.activeProfile,n="undefined"!=typeof window?window.location.origin:"https://kasbu.bio",r=(null==s?void 0:s.username)?`${n}/${s.username}`:null;return l.jsx(S,{className:"mx-auto w-full max-w-md shadow-none",children:l.jsxs(L,{className:"flex flex-col items-center gap-3 p-6 text-center",children:[l.jsx("span",{className:"flex size-10 items-center justify-center rounded-full bg-gray-100",children:l.jsx(le,{className:"size-5 text-gray-900"})}),l.jsx(A,{children:a("settings.analyticsPage.noTrafficTitle")}),l.jsx(z,{className:"text-pretty",children:a("settings.analyticsPage.noTrafficBody")}),r&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"max-w-full truncate font-mono text-gray-500 text-xs",children:r.replace(/^https?:\/\//,"")}),l.jsx(N,{fullWidth:!0,onClick:async()=>{if(r){if(k(_.shareClicked,{method:"function"==typeof navigator.share?"native":"copy",surface:"analytics_no_traffic"}),navigator.share)try{return void(await navigator.share({title:`@${null==s?void 0:s.username}`,url:r}))}catch(e){if("AbortError"===(null==e?void 0:e.name))return}try{await navigator.clipboard.writeText(r),P(a("toasts.share.copied.title"),a("toasts.share.copied.description"))}catch{C(a("toasts.share.copyError.title"),a("toasts.share.copyError.description"))}}},trailing:"arrow",variant:"primary",children:a("settings.analyticsPage.noTrafficCta")})]})]})})}function ra(e,r){const l=((e=30)=>{var r;const{user:l}=a(),[i,c]=s.useState(!0),[o,d]=s.useState([]),[x,m]=s.useState([]),[u,g]=s.useState([]),[p,h]=s.useState([]),[f,y]=s.useState([]),[j,v]=s.useState([]),[N,b]=s.useState([]),[w,k]=s.useState(0),[_,P]=s.useState(0),[C,S]=s.useState(0),[D,L]=s.useState(0),[A,z]=s.useState(0),[M,R]=s.useState(0),$=(null==(r=t())?void 0:r.activeProfileId)??null;return s.useEffect(()=>{l&&(async()=>{c(!0);try{const a=e<0?3650:0===e?1:e,{data:s,error:t}=await n.rpc("get_profile_analytics",{p_user_id:l.id,p_days:a,p_profile_id:$});if(t)throw t;k(s.total_visits??0),P(s.unique_visitors??0),S(s.today_visits??0),L(s.today_unique_visitors??0),z(s.monthly_visits??0),R(s.unique_visitors_period??0),d((s.visits_by_day??[]).map(e=>({date:e.date,count:e.count}))),m((s.visits_by_hour??[]).map(e=>({hour:e.hour,count:e.count}))),g((s.today_visits_by_hour??[]).map(e=>({hour:e.hour,count:e.count}))),h((s.devices??[]).map(e=>({name:e.name.charAt(0).toUpperCase()+e.name.slice(1),value:e.count,color:oe[e.name.toLowerCase()]??"#a196f5"}))),y((s.countries??[]).map(e=>({code:e.code,name:e.code,count:e.count}))),v(s.cities??[]),b((s.browsers??[]).map(e=>({name:e.name,value:e.count,color:de[e.name.toLowerCase()]??de.other})))}catch(a){console.error("Error fetching analytics:",a)}finally{c(!1)}})()},[l,e,$]),{loading:i,visitsData:o,hourData:x,todayHourData:u,deviceData:p,countryData:f,cityData:j,browserData:N,totalVisits:w,uniqueVisitors:_,uniqueVisitorsPeriod:M,todayVisits:C,todayUniqueVisitors:D,monthlyVisits:A}})(e);return r??l}const la=({isMobile:e=!1,days:a,onDaysChange:t,demo:n})=>{const{t:r,language:i}=d(),c=y(i),{userRole:o}=x(),m=n?n.isPro:h(o),[u,g]=s.useState(30),[p,j]=s.useState(!1);f.useEffect(()=>{void 0!==a&&g(a)},[a]);const{loading:v,visitsData:N,hourData:b,todayHourData:w,deviceData:k,countryData:_,cityData:P,browserData:C,totalVisits:M,uniqueVisitors:R,uniqueVisitorsPeriod:$,todayVisits:T,todayUniqueVisitors:U,monthlyVisits:O}=ra(u,null==n?void 0:n.data),H=-1===u?r("settings.analyticsPage.allTime"):0===u?r("settings.analyticsPage.range.today"):r("settings.analyticsPage.lastDays",{days:String(u)}),K={count:{label:r("settings.analyticsPage.visits"),color:"hsl(var(--chart-1))"}};const q=-1===u?M:0===u?T:O,G=-1===u?R:0===u?U:$,W=!m&&0===M,J=Ze(u,m)&&!W,X=s.useMemo(()=>{var e,a;if(N.length<2)return 0;const s=(null==(e=N[0])?void 0:e.count)??0,t=(null==(a=N[N.length-1])?void 0:a.count)??0;return s?(t-s)/s*100:0},[N]),Q=s.useMemo(()=>Array.from({length:24},(e,a)=>{var s;return{hour:a,count:(null==(s=w.find(e=>e.hour===a))?void 0:s.count)??0,label:`${String(a).padStart(2,"0")}h`}}),[w]),Z=s.useMemo(()=>Array.from({length:24},(e,a)=>{var s;return{hour:a,count:(null==(s=b.find(e=>e.hour===a))?void 0:s.count)??0,label:`${String(a).padStart(2,"0")}h`}}),[b]),ee=s.useMemo(()=>Q.reduce((e,a)=>a.count>((null==e?void 0:e.count)??-1)?a:e,void 0),[Q]),ae=s.useMemo(()=>Z.reduce((e,a)=>a.count>((null==e?void 0:e.count)??-1)?a:e,void 0),[Z]),se=k.reduce((e,a)=>e+a.value,0),te=C.reduce((e,a)=>e+a.value,0),ne=e?"pb-6 px-4 pt-4 bg-white":"p-6 bg-white";return p?l.jsx("div",{className:e?"bg-white min-h-screen":"bg-white",children:l.jsx(aa,{onBack:()=>j(!1),isPro:m})}):v?l.jsx("div",{className:ne,children:l.jsxs("div",{className:"mx-auto max-w-6xl space-y-6",children:[l.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[0,1,2,3].map(e=>l.jsxs(S,{className:"shadow-none",children:[l.jsx(D,{children:l.jsx(Y,{className:"h-3 w-24"})}),l.jsxs(L,{className:"flex flex-col gap-2",children:[l.jsx(Y,{className:"h-8 w-20"}),l.jsx(Y,{className:"h-3 w-16"})]})]},e))}),l.jsxs(S,{className:"shadow-none",children:[l.jsx(D,{children:l.jsx(Y,{className:"h-5 w-40"})}),l.jsx(L,{children:l.jsx(Y,{className:"h-[260px] w-full"})})]}),l.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[0,1,2,3].map(e=>l.jsxs(S,{className:"shadow-none",children:[l.jsx(D,{children:l.jsx(Y,{className:"h-5 w-36"})}),l.jsx(L,{children:l.jsx(Y,{className:"h-[260px] w-full"})})]},e))})]})}):l.jsx("div",{className:ne,children:l.jsxs("div",{className:"mx-auto max-w-6xl space-y-6",children:[!m&&!W&&l.jsxs("p",{className:"text-gray-500 text-xs",children:[l.jsx("a",{href:"/upgrade?reason=analytics",className:"underline hover:text-gray-900",children:r("settings.analyticsPage.upgradeLink")})," ",r("settings.analyticsPage.upgradeRest")]}),l.jsx(ea,{className:"w-fit",days:u,isPro:m,onChange:e=>{g(e),null==t||t(e)}}),W&&l.jsx(na,{}),l.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[l.jsxs(S,{className:"shadow-none",children:[l.jsx(D,{className:"p-4 pb-0",children:l.jsx(A,{className:"font-normal text-gray-500 text-xs",children:r("settings.analyticsPage.visits")})}),l.jsxs(L,{className:"flex flex-col gap-1 p-4 pt-2",children:[l.jsx("p",{className:"font-semibold text-2xl tabular-nums",children:q.toLocaleStr
1ing(c)}),l.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[0!==u&&0!==X&&l.jsxs(Ae,{value:X,children:[l.jsx(Me,{}),l.jsx(Re,{})]}),l.jsx("span",{className:"text-gray-500",children:H})]})]})]}),l.jsxs(S,{className:"shadow-none",children:[l.jsx(D,{className:"p-4 pb-0",children:l.jsx(A,{className:"font-normal text-gray-500 text-xs",children:r("settings.analyticsPage.uniqueVisitors")})}),l.jsxs(L,{className:"flex flex-col gap-1 p-4 pt-2",children:[l.jsx("p",{className:"font-semibold text-2xl tabular-nums",children:G.toLocaleString(c)}),l.jsx("span",{className:"text-gray-500 text-xs",children:H})]})]}),l.jsxs(S,{className:"shadow-none",children:[l.jsx(D,{className:"p-4 pb-0",children:l.jsx(A,{className:"font-normal text-gray-500 text-xs",children:r("settings.analyticsPage.today")})}),l.jsxs(L,{className:"flex flex-col gap-1 p-4 pt-2",children:[l.jsx("p",{className:"font-semibold text-2xl tabular-nums",children:T.toLocaleString(c)}),l.jsx("span",{className:"text-gray-500 text-xs",children:r("settings.analyticsPage.unique",{count:U.toLocaleString(c)})})]})]}),l.jsxs(S,{className:"shadow-none",children:[l.jsx(D,{className:"p-4 pb-0",children:l.jsx(A,{className:"font-normal text-gray-500 text-xs",children:r("settings.analyticsPage.allTime")})}),l.jsxs(L,{className:"flex flex-col gap-1 p-4 pt-2",children:[l.jsx("p",{className:"font-semibold text-2xl tabular-nums",children:M.toLocaleString(c)}),l.jsx("span",{className:"text-gray-500 text-xs",children:r("settings.analyticsPage.totalVisits")})]})]})]}),l.jsxs("div",{className:"relative",children:[l.jsxs("div",{"aria-hidden":J,className:"space-y-6 "+(J?"pointer-events-none select-none blur-[6px]":""),children:[0===u?l.jsx(S,{className:"shadow-none",children:l.jsxs(L,{className:"flex flex-col gap-4 p-4",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2 md:pe-2",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"font-semibold text-2xl tabular-nums tracking-tight",children:q.toLocaleString(c)}),l.jsx("span",{className:"text-pretty text-gray-500 text-xs",children:r("settings.analyticsPage.visitsToday")})]}),ee&&ee.count>0&&l.jsx("div",{className:"flex flex-col items-end gap-1",children:l.jsxs("span",{className:"inline-flex w-fit items-center gap-1 text-gray-500 text-xs",children:[l.jsx("span",{children:r("settings.analyticsPage.peak")}),l.jsx("span",{className:"font-medium text-gray-900 tabular-nums",children:ee.count}),l.jsx("span",{children:r("settings.analyticsPage.peakAt")}),l.jsx("span",{className:"font-medium text-gray-900",children:ee.label})]})})]}),l.jsx(Ue,{className:"aspect-auto h-[168px] w-full",config:K,data:Q,gradId:"analytics-today-hours",peakHour:ee})]})}):l.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[l.jsxs(S,{className:"shadow-none",children:[l.jsxs(D,{className:"space-y-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(A,{children:r("settings.analyticsPage.visitsOverTime")}),0!==X&&l.jsxs(Ae,{value:X,variant:"badge",children:[l.jsx(Me,{variant:"trend"}),l.jsx(Re,{})]})]}),l.jsx(z,{children:r("settings.analyticsPage.profileVisitsPeriod",{period:H.toLowerCase()})})]}),l.jsx(L,{children:l.jsx(he,{className:"aspect-[16/7] min-h-[150px] w-full",config:K,children:l.jsxs(V,{accessibilityLayer:!0,data:N,margin:{left:4,right:8,top:8,bottom:0},children:[l.jsx("defs",{children:l.jsxs("linearGradient",{id:"analytics-visits-grad",x1:"0",x2:"0",y1:"0",y2:"1",children:[l.jsx("stop",{offset:"0%",stopColor:"var(--color-count)",stopOpacity:.45}),l.jsx("stop",{offset:"55%",stopColor:"var(--color-count)",stopOpacity:.12}),l.jsx("stop",{offset:"100%",stopColor:"var(--color-count)",stopOpacity:0})]})}),l.jsx(F,{className:"stroke-gray-200",vertical:!1}),l.jsx(E,{axisLine:!1,dataKey:"date",interval:"preserveStartEnd",minTickGap:28,tickFormatter:e=>new Date(e).toLocaleDateString(c,{month:"short",day:"numeric"}),tickLine:!1,tickMargin:8}),l.jsx(I,{allowDecimals:!1,axisLine:!1,tick:{className:"tabular-nums"},tickLine:!1,tickMargin:8,width:Xe}),l.jsx(ye,{content:l.jsx(je,{className:"min-w-[8.5rem]",indicator:"line",labelFormatter:e=>new Date(e).toLocaleDateString(c,{weekday:"short",month:"short",day:"numeric"})}),cursor:!1}),l.jsx(B,{dataKey:"count",dot:!1,fill:"url(#analytics-visits-grad)",stroke:"var(--color-count)",strokeWidth:2,type:"natural"})]})})})]}),l.jsx(S,{className:"shadow-none",children:l.jsxs(L,{className:"flex flex-col gap-4 p-4",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2 md:pe-2",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"font-semibold text-2xl tabular-nums tracking-tight",children:((null==ae?void 0:ae.count)??0).toLocaleStr
1ing(c)}),l.jsx("span",{className:"text-pretty text-gray-500 text-xs",children:r("settings.analyticsPage.peakHourLabel",{period:H.toLowerCase()})})]}),ae&&ae.count>0&&l.jsx("div",{className:"flex flex-col items-end gap-1",children:l.jsxs("span",{className:"inline-flex w-fit items-center gap-1 text-gray-500 text-xs",children:[l.jsx("span",{children:r("settings.analyticsPage.peakAtLabel")}),l.jsx("span",{className:"font-medium text-gray-900",children:ae.label})]})})]}),l.jsx(Ue,{data:Z,peakHour:ae,gradId:"analytics-peak-hours",config:K})]})})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[l.jsxs(S,{className:"flex flex-col shadow-none",children:[l.jsxs(D,{className:"border-b",children:[l.jsx(A,{children:r("settings.analyticsPage.deviceBreakdown")}),l.jsx(z,{children:r("settings.analyticsPage.deviceBreakdownDesc")})]}),l.jsx(L,{className:"p-0 py-1",children:k.length>0?l.jsx(Fe,{ariaLabel:r("settings.analyticsPage.deviceBreakdown"),items:k.map(e=>({label:e.name,value:e.value,color:e.color})),total:se}):l.jsx("p",{className:"py-12 text-center text-gray-500 text-sm",children:r("settings.analyticsPage.noData")})})]}),l.jsxs(S,{className:"flex flex-col shadow-none",children:[l.jsxs(D,{className:"border-b",children:[l.jsx(A,{children:r("settings.analyticsPage.browserBreakdown")}),l.jsx(z,{children:r("settings.analyticsPage.browserBreakdownDesc")})]}),l.jsx(L,{className:"p-0 py-1",children:C.length>0?l.jsx(Fe,{ariaLabel:r("settings.analyticsPage.browserBreakdown"),items:C.map(e=>({label:e.name,value:e.value,color:e.color})),total:te}):l.jsx("p",{className:"py-12 text-center text-gray-500 text-sm",children:r("settings.analyticsPage.noData")})})]}),l.jsx(Ee,{caption:r("settings.analyticsPage.topCountriesCaption"),description:r("settings.analyticsPage.topCountriesDesc"),emptyLabel:r("settings.analyticsPage.noData"),rows:_.map(e=>({key:e.code,name:e.name||e.code,code:e.code,count:e.count})),title:r("settings.analyticsPage.topCountries"),header:r("settings.analyticsPage.countriesHeader"),total:_.reduce((e,a)=>e+a.count,0)}),l.jsx(Ee,{caption:r("settings.analyticsPage.topCitiesCaption"),description:r("settings.analyticsPage.topCitiesDesc"),emptyLabel:r("settings.analyticsPage.noCityData"),rows:P.map(e=>({key:`${e.country}-${e.name}`,name:e.name,code:e.country,count:e.count})),title:r("settings.analyticsPage.topCities"),header:r("settings.analyticsPage.citiesHeader"),total:P.reduce((e,a)=>e+a.count,0)})]})]}),J&&l.jsx(sa,{periodVisits:q})]}),l.jsx(We,{days:u,onViewAll:()=>j(!0)})]})})};export{Je as ActivityTimeline,We as ProfileActivityCard,la 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.