1import{j as e}from"./query-B3Uosio-.js";import{r as v,L as p}from"./vendor-Cz7KfbQJ.js";import{r as K,a as A}from"./recentSearches-C5AGPYGB.js";import{u as M}from"./marketing-CbH3_Qok.js";import{u as U,b as O}from"./account-B_WyxdLH.js";import{u as B}from"./reports-CbceWjI8.js";import{u as Y,a as _}from"./savedKeywords-fSzRacsY.js";import{I as n}from"./Icon-DBcDewoy.js";import{a as w}from"./Skeleton-pb2yFlI6.js";import{a as f}from"./EmptyState-DQRdR_gs.js";import{r as H,t as P}from"./plan-DK3nbOu4.js";import"./index-Djj15zGT.js";const D={name:["nameSurname","name","fullName","displayName"],followers:["followers","followerCount","follows"]},G=["resetInDays","daysUntilReset","resetDays","renewInDays"],V=["resetDate","renewalDate","nextReset","periodEnd","resetAt","renewsAt"],Z=["data","results","rows","reports","listings","items","list","records"],j=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function q(t,o){if(Array.isArray(t))return t;if(j(t)){for(const r of o)if(Array.isArray(t[r]))return t[r];for(const r of Object.values(t))if(Array.isArray(r))return r}return[]}function L(t,o){if(j(t))for(const r of o){const i=t[r];if(i!=null&&i!=="")return i}}function I(t,o,r=""){const i=L(t,o);return typeof i=="string"?i:r}function J(t,o){const r=L(t,o);if(typeof r=="number"&&Number.isFinite(r))return r;if(typeof r=="string"&&r.trim()!==""){const i=Number(r.replace(/[^0-9.-]/g,""));if(Number.isFinite(i))return i}return null}function Q(t){if(!j(t))return null;for(const o of D.followers){const r=t[o];if(Array.isArray(r))return r.length;if(typeof r=="number"&&Number.isFinite(r))return r;if(typeof r=="string"&&r.trim()!==""&&Number.isFinite(Number(r)))return Number(r)}return null}function X(t){const o=H(t);return o==null?null:{remaining:o,total:P(t)}}function ee(){const t=new Date,o=new Date(t.getFullYear(),t.getMonth()+1,1);return Math.max(1,Math.ceil((o.getTime()-t.getTime())/864e5))}function te(t,o){for(const r of[t,o]){const i=J(r,G);if(i!=null&&i>=0)return Math.round(i);const s=I(r,V);if(s){const d=new Date(s);if(!Number.isNaN(d.getTime())){const c=Math.ceil((d.getTime()-Date.now())/864e5);if(c>=0)return c}}}return ee()}function re(t){return t<12?"Good morning":t<18?"Good afternoon":"Good evening"}const oe=[{g:"K",title:"Keyword Search",sub:"Deep-dive one keyword: volume, competition, top listings",to:"/keyword-search"},{g:"H",title:"Keyword Hunter",sub:"1, 2 and 3 word phrases from a single seed keyword",to:"/keyword-hunter"},{g:"F",title:"Follow Competitor",sub:"Daily sales, listings and review changes for 8 shops",to:"/follow-competitor"},{g:"M",title:"My Shop",sub:"Your own analytics and listing health score",to:"/my-shop"},{g:"P",title:"Product Ideas",sub:"New products matched to your niche, updated daily",to:"/suggestion"},{g:"R",title:"Reports",sub:"Weekly PDFs of your shop and market",to:"/reports"}],N={"product-research":{label:"Product Research",to:"/product-research"},"keyword-search":{label:"Keyword Search",to:"/keyword-search"}},T=new Intl.NumberFormat("en-US");function ae(t){const o=[];t.volume!=null&&o.push(`${T.format(t.volume)} volume`),t.competition!=null&&o.push(`${T.format(t.competition)} competition`);const r=Date.parse(t.savedAt);return Number.isFinite(r)&&o.push(A(r)),o.join(" · ")}const m={background:"var(--color-surface-panel)",borderRadius:14,padding:"13px 16px",boxSizing:"border-box"},x={fontSize:"var(--text-caption)",color:"var(--color-text-muted)"},g={fontSize:"var(--text-stat)",fontWeight:"var(--fw-extrabold)",color:"var(--color-text-primary)",marginTop:"var(--space-1h)"},b={fontSize:14,fontWeight:"var(--fw-bold)",color:"var(--color-text-default)"};function ge(){const{user:t}=M(),o=U(),r=O(),i=B(),s=I(t,D.name),d=s.trim().split(/\s+/)[0]||"there",c=(d[0]??"T").toUpperCase(),k=Q(t),y=v.useMemo(()=>K(),[]),h=Y(),C=_(),[E,S]=v.useState(null),R=v.useMemo(()=>{var l;return[...((l=h.data)==null?void 0:l.result)??[]].sort((u,$)=>(Date.parse($.savedAt)||0)-(Date.parse(u.savedAt)||0))},[h.data]),z=new Date,W=re(z.getHours()),F=z.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"});return e.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,fontFamily:"var(--font-family-base)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",height:46,marginBottom:"var(--space-1h)"},children:[e.jsxs("h1",{style:{margin:0,fontSize:"var(--text-display)",fontWeight:"var(--fw-bold)",letterSpacing:"var(--tracking-display)",color:"var(--color-text-primary)"},children:[W,", ",d]}),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"var(--space-3)"},children:[e.jsx(ne,{}),e.jsx(p,{to:"/settings","aria-label":s?`Account: ${s}
1`:"Account",style:{width:42,height:42,borderRadius:"var(--r-circle)",background:"var(--color-avatar-bg)",display:"grid",placeItems:"center",fontSize:14.5,fontWeight:"var(--fw-bold)",color:"var(--color-text-secondary)",textDecoration:"none",flexShrink:0},children:c})]})]}),e.jsxs("div",{style:{fontSize:"var(--text-body)",color:"var(--color-text-muted)",marginBottom:18},children:[F," · here is your market at a glance."]}),e.jsxs("div",{style:{display:"flex",gap:"var(--space-2)"},children:[e.jsx(ie,{loading:o.isLoading,credits:o.isError?null:X(o.data),resetDays:te(o.data,r.data)}),e.jsxs("div",{style:{...m,flex:1},children:[e.jsx("div",{style:x,children:"Shops followed"}),e.jsx("div",{style:g,children:k??"NaN"})]}),e.jsxs("div",{style:{...m,flex:1},children:[e.jsx("div",{style:x,children:"Niches researched"}),e.jsx("div",{style:g,children:y.length})]}),e.jsxs("div",{style:{...m,flex:1},children:[e.jsx("div",{style:x,children:"Reports this month"}),e.jsx("div",{style:g,children:i.isLoading?e.jsx(w,{variant:"text",width:36,height:18}):i.isError?"NaN":q(i.data,Z).length})]})]}),e.jsxs("div",{style:{position:"relative",background:"var(--color-surface-panel)",borderRadius:"var(--r-xl)",padding:"16px 18px",marginTop:"var(--space-4)",display:"flex",alignItems:"center",gap:"var(--space-3h)",overflow:"hidden"},children:[e.jsx("svg",{width:"64",height:"54",viewBox:"0 0 64 54",style:{position:"absolute",top:0,right:0,display:"block"},"aria-hidden":"true",children:e.jsx("path",{d:"M 0.8,0 A 18.5,18.5 0 0 1 19.3,19.1 A 24.7,24.7 0 0 0 50.8,43.7 A 10.4,10.4 0 0 1 64,53.7 V 0 Z",fill:"var(--color-bg-canvas)"})}),e.jsx(p,{to:"/follow-competitor","aria-label":"Open Follow Competitor",style:{position:"absolute",top:0,right:0,width:40,height:40,borderRadius:"var(--r-circle)",background:"var(--color-accent)",color:"var(--color-text-on-accent)",display:"grid",placeItems:"center"},children:e.jsx(n,{name:"arrow-up-right",size:15})}),e.jsx("div",{style:{width:40,height:40,borderRadius:"var(--r-circle)",background:"var(--color-accent-soft)",color:"var(--color-text-on-accent)",display:"grid",placeItems:"center",flexShrink:0},children:e.jsx(n,{name:"user-check",size:18})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:"var(--text-body)",fontWeight:"var(--fw-bold)",color:"var(--color-text-default)"},children:"Track your competitors' daily sales, listings and reviews"}),e.jsx("div",{style:{fontSize:"var(--text-caption)",color:"var(--color-text-muted)",marginTop:3},children:"Follow up to 8 shops and get their day-by-day changes in one place."})]})]}),e.jsx("div",{style:{...b,margin:"20px 4px 10px"},children:"Your tools"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"var(--space-2)"},children:oe.map(a=>e.jsxs(p,{to:a.to,style:{background:"var(--color-surface-panel)",borderRadius:"var(--r-lg)",padding:"var(--space-4)",display:"block",textDecoration:"none",color:"inherit"},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:"var(--r-sm)",background:"var(--color-accent-soft)",display:"grid",placeItems:"center",fontSize:14,fontWeight:"var(--fw-extrabold)",color:"var(--color-text-on-accent)"},children:a.g}),e.jsx("div",{style:{fontSize:"var(--text-body)",fontWeight:"var(--fw-bold)",color:"var(--color-text-default)",marginTop:11},children:a.title}),e.jsx("div",{style:{fontSize:11.5,color:"var(--color-text-muted)",marginTop:"var(--space-1)",lineHeight:1.5},children:a.sub})]},a.to))}),e.jsxs("div",{style:{background:"var(--color-surface-panel)",borderRadius:"var(--r-xl)",padding:"14px 20px 8px",marginTop:"var(--space-4)"},children:[e.jsx("div",{style:{...b,fontSize:"var(--text-body)",paddingBottom:"var(--space-1h)"},children:"Recent searches"}),y.length===0?e.jsx(f,{size:"compact",icon:e.jsx(n,{name:"search",size:"lg"}),title:"No recent searches yet",description:"Your recent keyword and product searches will show up here, ready to reopen."}):y.map(a=>{const l=N[a.source]??N["keyword-search"];return e.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"12px 0",borderTop:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{color:"var(--color-text-muted)",display:"inline-flex"},children:e.jsx(n,{name:"search",size:"sm"})}),e.jsx("span",{style:{fontSize:"var(--text-body)",fontWeight:"var(--fw-semibold)",color:"var(--color-text-default)",marginLeft:11},children:a.term}),e.jsxs("span",{style:{fontSize:11.5,color:"var(--color-text-muted)",marginLeft:"var(--space-2h)"},children:[l.label," · ",A(a.at)]}),e.jsx(p,{to:`${l.to}?keyword=${encodeURIComponent(a.term)}`,style:{marginLeft:"auto",fontSize:"var(--text-caption)",fontWeight:"var(--fw-bold)",color:"var(--color-text-accent)",textDecoration:"none"},children:"Open"})]},`${a.term}-${a.at}`)})]}),e.jsxs("div",{style:{background:"var(--color-surface-panel)",borderRadius:"var(--r-
1xl)",padding:"14px 20px 8px",marginTop:"var(--space-4)"},children:[e.jsx("div",{style:{...b,fontSize:"var(--text-body)",paddingBottom:"var(--space-1h)"},children:"Saved keywords"}),h.isError?e.jsx(f,{size:"compact",icon:e.jsx(n,{name:"bookmark",size:"lg"}),title:"Couldn't load saved keywords",description:"We couldn't reach your saved keywords just now. Please try again."}):h.isLoading?e.jsx("div",{style:{padding:"12px 0",borderTop:"1px solid var(--color-border-divider)"},children:e.jsx(w,{variant:"text",width:"55%",height:16})}):R.length===0?e.jsx(f,{size:"compact",icon:e.jsx(n,{name:"bookmark",size:"lg"}),title:"No saved keywords yet",description:"Save a keyword from Keyword Search to keep it here, ready to reopen."}):R.map(a=>{const l=ae(a),u=E===a.keyword;return e.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"12px 0",borderTop:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{color:"var(--color-text-muted)",display:"inline-flex"},children:e.jsx(n,{name:"bookmark",size:"sm"})}),e.jsx(p,{to:`/keyword-search?keyword=${encodeURIComponent(a.keyword)}`,style:{fontSize:"var(--text-body)",fontWeight:"var(--fw-semibold)",color:"var(--color-text-default)",marginLeft:11,textDecoration:"none"},children:a.keyword}),l?e.jsx("span",{style:{fontSize:11.5,color:"var(--color-text-muted)",marginLeft:"var(--space-2h)"},children:l}):null,e.jsx("button",{type:"button",onClick:()=>{S(a.keyword),C.mutate({save:!1,input:{keyword:a.keyword}},{onSettled:()=>S(null)})},disabled:u,"aria-label":`Remove ${a.keyword} from saved keywords`,title:"Remove from saved",style:{marginLeft:"auto",display:"grid",placeItems:"center",width:28,height:28,padding:0,border:"none",background:"transparent",borderRadius:"var(--r-circle)",color:"var(--color-text-muted)",cursor:u?"default":"pointer",opacity:u?.5:1},children:e.jsx(n,{name:"x",size:"sm"})})]},a.keyword)})]})]})}function ie({loading:t,credits:o,resetDays:r}){return e.jsxs("div",{style:{...m,flex:1.3},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsx("span",{style:x,children:"Credits"}),e.jsx("span",{style:{marginLeft:"auto",fontSize:"var(--text-body)",fontWeight:"var(--fw-bold)",color:"var(--color-text-primary)"},children:t?e.jsx(w,{variant:"text",width:64,height:14}):o?`${o.remaining.toLocaleString("en-US")} left`:"NaN"})]}),e.jsx("div",{style:{height:6,borderRadius:3,background:"var(--color-track)",marginTop:"var(--space-2h)",overflow:"hidden"},children:e.jsx("div",{style:{height:6,borderRadius:3,background:"var(--color-accent-strong)",width:t||!o?"0%":"100%",transition:"width var(--transition-base)"}})}),e.jsx("div",{style:{fontSize:"var(--text-micro)",color:"var(--color-text-muted)",marginTop:"var(--space-2)"},children:t?"Loading usageâ¦":o?`${o.total!=null?`${o.remaining} of ${o.total} credits`:`${o.remaining} credits`} · resets in ${r} ${r===1?"day":"days"}`:"Usage unavailable"})]})}function ne(){const[t,o]=v.useState(!1),[r,i]=v.useState(!1),s=!r,d={marginLeft:"auto",fontSize:"var(--text-micro)",fontWeight:"var(--fw-bold)",color:"var(--color-text-accent)",background:"transparent",border:"none",padding:0,cursor:"pointer"};return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{type:"button","aria-label":"Notifications","aria-expanded":t,onClick:()=>{o(c=>!c),t||i(!0)},style:{position:"relative",width:38,height:44,display:"grid",placeItems:"center",cursor:"pointer",background:"transparent",border:"none",padding:0,color:"var(--color-text-secondary)"},children:[e.jsx(n,{name:"bell",size:23}),s?e.jsx("span",{style:{position:"absolute",top:8,right:5,width:9,height:9,borderRadius:"var(--r-circle)",background:"var(--color-accent)",border:"2px solid var(--color-bg-canvas)"}}):null]}),t?e.jsxs("div",{role:"menu",style:{position:"absolute",top:50,right:0,width:372,background:"var(--modal-bg)",border:"1px solid var(--color-border-soft)",borderRadius:"var(--r-lg)",boxShadow:"var(--shadow-md)",zIndex:20,overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"14px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{fontSize:"var(--text-body)",fontWeight:"var(--fw-extrabold)",color:"var(--color-text-primary)"},children:"Notifications"}),e.jsx("button",{type:"button",onClick:()=>i(!0),style:d,children:"Mark all read"})]}),e.jsx(f,{size:"compact",icon:e.jsx(n,{name:"bell",size:"lg"}),title:"You're all caught up",description:"New activity from your tracked shops and keywords will appear here."}),e.jsx(p,{to:"/settings",style:{display:"block",textAlign:"center",padding:12,fontSize:"var(--text-caption)",fontWeight:"var(--fw-bold)",color:"var(--color-text-accent)",textDecoration:"none",borderTop:"1px solid var(--color-border-divider)"},children:"Notification settings"})]}):null]})}export{ge 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.