1import{N as $e,a5 as Ue,r as d,a as ze,a6 as N,j as e,T,X as re,E as ie,C as x,b as f,d as b,aE as Ve,o as C,e as h,ab as g,ap as ne,aF as oe,$ as K,a0 as F,a1 as P,a2 as A,a3 as n,d0 as Ie,cY as qe,B as y,a4 as V,V as He,bM as I,bN as q,bO as w,bP as o,bQ as H,bR as l,bU as Oe,U as le,aD as Ge,ar as Qe,aY as Be,s as v,D as ce,au as Je,c2 as i,a7 as S}from"./index-CuSEeJFb.js";import{T as Ye,a as Xe,b as D,c as R}from"./tabs-CcPOXtvT.js";import{H as O}from"./history-CN2Tjn9d.js";import{T as _e}from"./trending-down-C0n_6ywh.js";import{T as We}from"./trophy-Cek-Y59u.js";import{M as de}from"./minus-LVFLuFlS.js";import{A as Ze}from"./arrow-up-Uui5xrmv.js";import{A as es}from"./arrow-down-CLUMqGAm.js";function cs(){const{activeCompanyId:p}=$e(),E=Ue(),[G,Q]=d.useState(!1),[me,M]=d.useState("track"),[m,B]=d.useState(null),[L,xe]=d.useState(""),[J,he]=d.useState("United States"),[Y,ue]=d.useState("English"),[X,pe]=d.useState("desktop"),[$,ge]=d.useState(""),[_,W]=d.useState(!1),[j,je]=d.useState(null),[Z,ye]=d.useState(""),[u,U]=d.useState([""]),[ee,ve]=d.useState("United States"),{data:z,isLoading:we}=ze({queryKey:["/api/seo-history/serp-position",{companyId:p}],enabled:!!p}),se=(z==null?void 0:z.data)||[],ke=N({mutationFn:async s=>(await S("/api/seo-history/serp-position",{method:"POST",body:JSON.stringify(s)})).json(),onSuccess:()=>{E.invalidateQueries({queryKey:["/api/seo-history/serp-position"]}),i({title:"Tracking Saved",description:"Your tracking results have been saved to history."})},onError:s=>{i({title:"Save Failed",description:s.message||"Failed to save tracking to history",variant:"destructive"})}}),te=N({mutationFn:async({id:s,isStarred:t})=>(await S(`/api/seo-history/serp-position/${s}`,{method:"PATCH",body:JSON.stringify({isStarred:t})})).json(),onSuccess:()=>{E.invalidateQueries({queryKey:["/api/seo-history/serp-position"]}),i({title:"Updated",description:"Tracking record has been updated."})},onError:s=>{i({title:"Update Failed",description:s.message||"Failed to update tracking record",variant:"destructive"})}}),ae=N({mutationFn:async s=>(await S(`/api/seo-history/serp-position/${s}`,{method:"DELETE"})).json(),onSuccess:()=>{E.invalidateQueries({queryKey:["/api/seo-history/serp-position"]}),i({title:"Deleted",description:"Tracking record has been deleted from history."})},onError:s=>{i({title:"Delete Failed",description:s.message||"Failed to delete tracking record",variant:"destructive"})}}),Ne=N({mutationFn:async s=>(await S("/api/serp-tracking/track-keywords",{method:"POST",body:JSON.stringify(s)})).json(),onSuccess:(s,t)=>{if(B(s.data),M("results"),i({title:"Keywords Tracked Successfully",description:`Tracked ${s.data.summary.totalKeywords} keywords. Found rankings for ${s.data.summary.rankedKeywords} keywords.`}),p){const r=t.keywords,c=`${r.slice(0,3).join(", ")}${r.length>3?"...":""}`;ke.mutate({companyId:p,title:c,keywords:r,domain:t.domain,location:t.location,language:t.language,device:t.device,totalKeywords:s.data.summary.totalKeywords,averagePosition:s.data.summary.averagePosition,rankedKeywords:s.data.summary.rankedKeywords,unrankedKeywords:s.data.summary.unrankedKeywords,results:{rankings:s.data.keywords,positionDistribution:{top3:s.data.keywords.filter(a=>a.position&&a.position<=3).length,top10:s.data.keywords.filter(a=>a.position&&a.position<=10).length,top20:s.data.keywords.filter(a=>a.position&&a.position<=20).length,top50:s.data.keywords.filter(a=>a.position&&a.position<=50).length,top100:s.data.keywords.filter(a=>a.position&&a.position<=100).length,notRanked:s.data.keywords.filter(a=>!a.position).length},improvements:0,declines:0,unchanged:s.data.keywords.length}})}},onError:s=>{i({title:"Tracking Failed",description:s.message||"Failed to track keyword positions",variant:"destructive"})},onSettled:()=>{Q(!1)}}),fe=N({mutationFn:async s=>(await S("/api/serp-tracking/competitor-analysis",{method:"POST",body:JSON.stringify(s)})).json(),onSuccess:s=>{je(s.data),i({title:"Competitor Analysis Complete",description:`Analyzed ${s.data.keywords.length} keywords across ${s.data.competitors.length} competitors.`})},onError:s=>{i({title:"Analysis Failed",description:s.message||"Failed to analyze competitors",variant:"destructive"})},onSettled:()=>{W(!1)}}),be=async s=>{if(s.preventDefault(),!p){i({title:"Company Required",description:"Please select a company before analyzing competitors",variant:"destructive"});return}const t=Z.split(` 2`).map(c=>c.trim()).filter(c=>c.length>0);if(t.length===0){i({title:"Keywords Required",description:"Please enter at least one keyword to analyze",variant:"destructive"});return}if(t.length>
220){i({title:"Too Many Keywords",description:"Maximum 20 keywords for competitor analysis",variant:"destructive"});return}const r=u.map(c=>c.trim().replace(/^https?:\/\//,"").replace(/^www\./,"").split("/")[0]).filter(c=>c.length>0);if(r.length===0){i({title:"Competitors Required",description:"Please enter at least one competitor domain",variant:"destructive"});return}if(r.length>10){i({title:"Too Many Competitors",description:"Maximum 10 competitors per analysis",variant:"destructive"});return}W(!0),fe.mutate({keywords:t,competitors:r,location:ee,companyId:p})},Ce=()=>{u.length<10&&U([...u,""])},Se=s=>{u.length>1&&U(u.filter((t,r)=>r!==s))},Te=(s,t)=>{const r=[...u];r[s]=t,U(r)},Ke=async s=>{if(s.preventDefault(),!p){i({title:"Company Required",description:"Please select a company before tracking keywords",variant:"destructive"});return}if(!L.trim()){i({title:"Keywords Required",description:"Please enter at least one keyword to track",variant:"destructive"});return}const t=L.split(` 3`).map(r=>r.trim()).filter(r=>r.length>0);if(t.length===0){i({title:"No Valid Keywords",description:"Please enter valid keywords (one per line)",variant:"destructive"});return}if(t.length>50){i({title:"Too Many Keywords",description:"Maximum 50 keywords per tracking request",variant:"destructive"});return}Q(!0),Ne.mutate({keywords:t,location:J,language:Y,device:X,...$&&{domain:$},companyId:p})},Fe=(s,t)=>!s||!t?e.jsx(de,{className:"w-4 h-4 text-gray-400"}):s<t?e.jsx(Ze,{className:"w-4 h-4 text-green-600"}):s>t?e.jsx(es,{className:"w-4 h-4 text-red-600"}):e.jsx(de,{className:"w-4 h-4 text-gray-400"}),Pe=s=>s?s<=3?e.jsx(v,{className:"bg-green-100 text-green-800",children:"Top 3"}):s<=10?e.jsx(v,{className:"bg-blue-100 text-blue-800",children:"Page 1"}):s<=20?e.jsx(v,{className:"bg-yellow-100 text-yellow-800",children:"Page 2"}):e.jsxs(v,{variant:"secondary",children:["Page ",Math.ceil(s/10)]}):e.jsx(v,{variant:"secondary",children:"Not Ranked"}),Ae=s=>{switch(s){case"low":return"text-green-600";case"medium":return"text-yellow-600";case"high":return"text-red-600";default:return"text-gray-600"}},De=s=>{var t,r;if(s.results){const c={keywords:s.results.rankings.map(a=>({keyword:a.keyword,position:a.position,url:a.url,title:a.title,searchVolume:a.searchVolume,competition:a.competition,cpc:a.cpc,previousPosition:a.previousPosition,positionChange:a.positionChange})),summary:{totalKeywords:s.totalKeywords||0,rankedKeywords:s.rankedKeywords||0,unrankedKeywords:s.unrankedKeywords||0,averagePosition:s.averagePosition||0,location:s.location,language:s.language,device:s.device||"desktop",domain:s.domain||void 0,trackedAt:((t=s.trackedAt)==null?void 0:t.toString())||((r=s.createdAt)==null?void 0:r.toString())||new Date().toISOString()}};B(c),M("results"),i({title:"Loaded from History",description:`Viewing results for "${s.title}"`})}},Re=s=>{te.mutate({id:s.id,isStarred:!s.isStarred})},Ee=s=>{ae.mutate(s)},Me=s=>s?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}):"N/A";return e.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-2",children:"ð¯ SERP Position Tracking"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Track keyword rankings in real-time using live DataForSEO API data"})]}),e.jsxs(Ye,{value:me,onValueChange:M,className:"space-y-6",children:[e.jsxs(Xe,{className:"grid w-full grid-cols-4",children:[e.jsxs(D,{value:"track","data-testid":"tab-track",children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),"Track Keywords"]}),e.jsxs(D,{value:"results","data-testid":"tab-results",children:[e.jsx(re,{className:"w-4 h-4 mr-2"}),"Results"]}),e.jsxs(D,{value:"competitors","data-testid":"tab-competitors",children:[e.jsx(ie,{className:"w-4 h-4 mr-2"}),"Competitor Analysis"]}),e.jsxs(D,{value:"history","data-testid":"tab-history",children:[e.jsx(O,{className:"w-4 h-4 mr-2"}),"History"]})]}),e.jsx(R,{value:"track",className:"space-y-6",children:e.jsxs(x,{children:[e.jsxs(f,{children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(Ve,{className:"w-5 h-5 text-orange-600"}),"Keyword Position Tracking"]}),e.jsx(C,{children:"Enter keywords to track their positions in search results using live DataForSEO API"})]}),e.jsx(h,{children:e.jsxs("form",{onSubmit:Ke,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(g,{htmlFor:"keywords",children:"Keywords (one per line)"}),e.jsx(ne,{id:"keywords",placeholder:`marketing automation 4email marketing software 5crm software`,value:L,onChange:s=>xe(s.target.value),className:"min-h-[120px]","data-testid":"input-keywords"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Maximum 50 keywords per request"})]}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"domain",children:"Domain to Track (optional)"}),e.jsx(oe,{id:"domain",placeholder:"example.com",value:$,onChange:s=>ge(s.target.value),"data-testid":"input-domain"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Leave empty to track top result for each keyword"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(g,{htmlFor:"location",children:"Location"}),e.jsxs(K,{value:J,onValueChange:he,children:[e.jsx(F,{"data-testid":"select-location",children:e.jsx(P,{})}),e.jsxs(A,{children:[e.jsx(n,{value:"United States",children:"United States"}),e.jsx(n,{value:"Canada",children:"Canada"}),e.jsx(n,{value:"United Kingdom",children:"United Kingdom"}),e.jsx(n,{value:"Australia",children:"Australia"}),e.jsx(n,{value:"Germany",children:"Germany"}),e.jsx(n,{value:"France",children:"France"})]})]})]}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"language",children:"Language"}),e.jsxs(K,{value:Y,onValueChange:ue,children:[e.jsx(F,{"data-testid":"select-language",children:e.jsx(P,{})}),e.jsxs(A,{children:[e.jsx(n,{value:"English",children:"English"}),e.jsx(n,{value:"Spanish",children:"Spanish"}),e.jsx(n,{value:"French",children:"French"}),e.jsx(n,{value:"German",children:"German"})]})]})]}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"device",children:"Device"}),e.jsxs(K,{value:X,onValueChange:pe,children:[e.jsx(F,{"data-testid":"select-device",children:e.jsx(P,{})}),e.jsxs(A,{children:[e.jsx(n,{value:"desktop",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"w-4 h-4"}),"Desktop"]})}),e.jsx(n,{value:"mobile",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"w-4 h-4"}),"Mobile"]})})]})]})]})]})]}),e.jsx(y,{type:"submit",disabled:G,className:"w-full bg-orange-600 hover:bg-orange-700","data-testid":"button-track-keywords",children:G?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4 mr-2 animate-spin"}),"Tracking Keywords..."]}):e.jsxs(e.Fragment,{children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),"Track Keyword Positions"]})})]})})]})}),e.jsx(R,{value:"results",className:"space-y-6",children:m?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(x,{children:e.jsx(h,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{className:"w-5 h-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Total Keywords"}),e.jsx("p",{className:"text-2xl font-bold",children:m.summary.totalKeywords})]})]})})}),e.jsx(x,{children:e.jsx(h,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(He,{className:"w-5 h-5 text-green-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Ranked Keywords"}),e.jsx("p",{className:"text-2xl font-bold text-green-600",children:m.summary.rankedKeywords})]})]})})}),e.jsx(x,{children:e.jsx(h,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"w-5 h-5 text-red-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Not Ranked"}),e.jsx("p",{className:"text-2xl font-bold text-red-600",children:m.summary.unrankedKeywords})]})]})})}),e.jsx(x,{children:e.jsx(h,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{className:"w-5 h-5 text-blue-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Average Position"}),e.jsx("p",{className:"text-2xl font-bold text-blue-600",children:m.summary.averagePosition>0?Math.round(m.summary.averagePosition):"-"})]})]})})})]}),e.jsxs(x,{children:[e.jsxs(f,{children:[e.jsx(b,{children:"Keyword Rankings"}),e.jsxs(C,{children:["Live ranking data from DataForSEO ⢠",m.summary.location," ⢠",m.summary.device,m.summary.domain&&` ⢠Tracking ${m.summary.domain}`]})]}),e.jsx(h,{children:e.jsxs(I,{children:[e.jsx(q,{children:e.jsxs(w,{children:[e.jsx(o,{children:"Keyword"}),e.jsx(o,{children:"Position"}),e.jsx(o,{children:"Status"}),e.jsx(o,{children:"Search Volume"}),e.jsx(o,{children:"Competition"}),e.jsx(o,{children:"CPC"}),e.jsx(o,{children:"URL"})]})}),e.jsx(H,{children:m.keywords.map((s,t)=>{var r;return e.jsxs(w,{children:[e.jsx(l,{className:"font-medium",children:s.keyword}),e.jsx(l,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.position||"-",Fe(s.position,s.previousPosition)]})}),e.jsx(l,{children:Pe(s.position)}),e.jsx(l,{children:((r=s.searchVolume)==null?void 0:r.toLocaleStr
5ing())||"-"}),e.jsx(l,{children:e.jsx("span",{className:Ae(s.competition||"unknown"),children:s.competition||"unknown"})}),e.jsx(l,{children:s.cpc?`$${s.cpc.toFixed(2)}`:"-"}),e.jsx(l,{children:s.url?e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-600 hover:text-blue-800",children:[e.jsx(Oe,{className:"w-3 h-3"}),"View"]}):"-"})]},t)})})]})})]})]}):e.jsx(x,{children:e.jsxs(h,{className:"p-8 text-center",children:[e.jsx(T,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-gray-600 mb-2",children:"No Tracking Data"}),e.jsx("p",{className:"text-gray-500",children:"Track some keywords first to see ranking results here."})]})})}),e.jsxs(R,{value:"competitors",className:"space-y-6",children:[e.jsxs(x,{children:[e.jsxs(f,{children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(le,{className:"w-5 h-5 text-orange-600"}),"Competitor Keyword Analysis"]}),e.jsx(C,{children:"Compare keyword rankings across multiple competitors using live DataForSEO data"})]}),e.jsx(h,{children:e.jsxs("form",{onSubmit:be,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(g,{htmlFor:"competitor-keywords",children:"Keywords to Compare (one per line)"}),e.jsx(ne,{id:"competitor-keywords",placeholder:`marketing automation 6email marketing software 7crm software`,value:Z,onChange:s=>ye(s.target.value),className:"min-h-[120px]","data-testid":"input-competitor-keywords"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Maximum 20 keywords per analysis"})]}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"competitor-location",children:"Location"}),e.jsxs(K,{value:ee,onValueChange:ve,children:[e.jsx(F,{"data-testid":"select-competitor-location",children:e.jsx(P,{})}),e.jsxs(A,{children:[e.jsx(n,{value:"United States",children:"United States"}),e.jsx(n,{value:"Canada",children:"Canada"}),e.jsx(n,{value:"United Kingdom",children:"United Kingdom"}),e.jsx(n,{value:"Australia",children:"Australia"}),e.jsx(n,{value:"Germany",children:"Germany"}),e.jsx(n,{value:"France",children:"France"})]})]})]})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx(g,{children:"Competitor Domains"}),e.jsxs(y,{type:"button",variant:"outline",size:"sm",onClick:Ce,disabled:u.length>=10,"data-testid":"button-add-competitor",children:[e.jsx(Ge,{className:"w-4 h-4 mr-1"}),"Add"]})]}),e.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto",children:u.map((s,t)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{placeholder:"competitor.com",value:s,onChange:r=>Te(t,r.target.value),"data-testid":`input-competitor-domain-${t}`}),u.length>1&&e.jsx(y,{type:"button",variant:"ghost",size:"icon",onClick:()=>Se(t),"data-testid":`button-remove-competitor-${t}`,children:e.jsx(Qe,{className:"w-4 h-4 text-gray-400 hover:text-red-500"})})]},t))}),e.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Maximum 10 competitors per analysis"})]})})]}),e.jsx(y,{type:"submit",disabled:_,className:"w-full bg-orange-600 hover:bg-orange-700","data-testid":"button-analyze-competitors",children:_?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4 mr-2 animate-spin"}),"Analyzing Competitors..."]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 mr-2"}),"Analyze Competitor Rankings"]})})]})})]}),j&&e.jsxs(x,{children:[e.jsxs(f,{children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(We,{className:"w-5 h-5 text-yellow-600"}),"Ranking Comparison"]}),e.jsxs(C,{children:["Keyword rankings for ",j.competitors.length," competitors ⢠",j.location," ⢠Analyzed ",new Date(j.analyzedAt).toLocaleString()]})]}),e.jsx(h,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(I,{children:[e.jsx(q,{children:e.jsxs(w,{children:[e.jsx(o,{className:"sticky left-0 bg-white dark:bg-gray-800",children:"Keyword"}),j.competitors.map((s,t)=>e.jsx(o,{className:"text-center min-w-[120px]",children:e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[e.jsx(Be,{className:"w-3 h-3"}),s]})},t))]})}),e.jsx(H,{children:j.rankings.map((s,t)=>e.jsxs(w,{children:[e.jsx(l,{className:"font-medium sticky left-0 bg-white dark:bg-gray-800",children:s.keyword}),j.competitors.map((r,c)=>{const a=s.rankings.find(Le=>Le.domain===r),k=a==null?void 0:a.position;return e.jsx(l,{className:"text-center",children:k?e.jsxs(v,{className:k<=3?"bg-green-100 text-green-800":k<=10?"bg-blue-100 text-blue-800":k<=20?"bg-yellow-100 text-yellow-800":"bg-gray-100 text-gray-800",children:["#",k]}):e.jsx("span",{className:"text-gray-400",children:"-"})},c)})]},t))})]})})})]})]}),e.jsx(R,{value:"history",className:"space-y-6",children:e.jsxs(x,{children:[e.jsxs(f,{children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(O,{className:"w-5 h-5 text-orange-600"}),"Tracking History"]}),e.jsx(C,{children:"View and manage your past SERP tracking sessions"})]}),e.jsx(h,{children:we?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(V,{className:"w-8 h-8 animate-spin text-orange-600"})}):se.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(O,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-gray-600 mb-2",children:"No History Yet"}),e.jsx("p",{className:"text-gray-500",children:"Complete a keyword tracking to see it here."})]}):e.jsxs(I,{children:[e.jsx(q,{children:e.jsxs(w,{children:[e.jsx(o,{children:"Title"}),e.jsx(o,{children:"Keywords Count"}),e.jsx(o,{children:"Avg Position"}),e.jsx(o,{children:"Ranked"}),e.jsx(o,{children:"Date"}),e.jsx(o,{children:"Actions"})]})}),e.jsx(H,{children:se.map(s=>e.jsxs(w,{"data-testid":`history-row-${s.id}`,children:[e.jsx(l,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.isStarred&&e.jsx(ce,{className:"w-4 h-4 text-yellow-500 fill-yellow-500"}),s.title]})}),e.jsx(l,{children:s.totalKeywords||0}),e.jsx(l,{children:s.averagePosition?Math.round(s.averagePosition):"-"}),e.jsx(l,{children:e.jsx(v,{variant:"secondary",className:"bg-green-100 text-green-800",children:s.rankedKeywords||0})}),e.jsx(l,{children:Me(s.createdAt)}),e.jsx(l,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{variant:"outline",size:"sm",onClick:()=>De(s),"data-testid":`button-view-${s.id}`,children:e.jsx(ie,{className:"w-4 h-4"})}),e.jsx(y,{variant:"outline",size:"sm",onClick:()=>Re(s),disabled:te.isPending,"data-testid":`button-star-${s.id}`,children:e.jsx(ce,{className:`w-4 h-4 ${s.isStarred?"text-yellow-500 fill-yellow-500":""}`})}),e.jsx(y,{variant:"outline",size:"sm",onClick:()=>Ee(s.id),disabled:ae.isPending,className:"text-red-600 hover:text-red-700 hover:bg-red-50","data-testid":`button-delete-${s.id}`,children:e.jsx(Je,{className:"w-4 h-4"})})]})})]},s.id))})]})})]})})]})]})})}export{cs 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.