1import{j as e,a as q,u as se}from"./vendor-query-DvnPdOMX.js";import{r as v}from"./vendor-react-woJBpfBI.js";import{refreshCrawlerAccess as re,applyCrawlerFix as ae,dismissCrawlerFinding as ne,previewCrawlerFix as ie}from"./crawler-pVJDuxfQ.js";import{T as S,e5 as G,ab as U,a as m,c as K,R as le,an as T,b as oe,bK as I,U as P}from"./index-1YQNuixL.js";import{c as h}from"./vendor-utils-BNe0Xlio.js";import{O}from"./OverflowMenu-C97PGN8W.js";import{i as ce,j as de,P as Y,a as xe,h as ue}from"./CrawlerShared-CCMHcXg-.js";import{h as me,i as pe}from"./crawlerMenuItems-TfMWFAiN.js";import{gv as he,a4 as fe,az as H,T as L,p as Q,q as be,O as ge,m as je,X as V,ab as ye,s as ve,ao as Ne,R as we,ac as X,_ as ke,S as _e,C as M,i as D,aR as Ce}from"./vendor-icons-BLMEbmRV.js";import{u as Ae}from"./useClipboardFeedback-lLze0THa.js";import"./vendor-supabase-DaZXgOw0.js";import"./vendor-motion-ZmH_6coE.js";const Te={high_value_blocked:L,crawl_violation:L,declared_vs_actual:L,phantom_block:H,missing_llms_txt:fe,spoofed_identity:he},Se={high_value_blocked:"High-value blocked",crawl_violation:"Robots block",declared_vs_actual:"Access mismatch",phantom_block:"Traffic dropped",missing_llms_txt:"llms.txt",spoofed_identity:"Forged identity"};function Fe({finding:t,index:n,onOpenFix:a,menuCallbacks:r}){const i=Te[t.type]||Q,l=t.fix_action_type!==null,o=r?me(t,{...r,openFix:a}):[],x=e.jsxs("div",{className:h("flex items-start gap-3 pl-5 py-2.5",o.length>0?"pr-12":"pr-5",l&&"group cursor-pointer"),children:[e.jsxs("div",{className:"flex items-center gap-2 pt-0.5 flex-shrink-0",children:[e.jsx(S,{content:ce[t.severity],children:e.jsx("span",{className:h("w-1.5 h-1.5 rounded-full flex-shrink-0 cursor-help",de[t.severity])})}),e.jsx(S,{content:Se[t.type],children:e.jsx(i,{size:12,strokeWidth:1.5,className:"text-muted flex-shrink-0 cursor-help"})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.affected_bots.length>0&&e.jsxs("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[t.affected_bots.slice(0,3).map(g=>e.jsx(Y,{config:G(g),name:g,size:13,showTooltip:!0},g)),t.affected_bots.length>3&&e.jsxs("span",{className:"text-[9px] font-mono text-muted",children:["+",t.affected_bots.length-3]})]}),e.jsx("p",{className:"text-[12px] text-primary leading-snug truncate",children:t.headline})]}),e.jsx("p",{className:"text-[11px] text-secondary leading-snug mt-0.5",children:t.detail})]}),l&&e.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted group-hover:text-accent transition-colors duration-250 flex-shrink-0 pt-0.5",children:[e.jsx("span",{className:"hidden sm:inline",children:"Fix"}),e.jsx(be,{size:11,strokeWidth:1.5,className:"transition-transform duration-250 group-hover:translate-x-0.5"})]})]}),d=l?e.jsx(m,{direction:"up",distance:4,delay:.05+n*.04,children:e.jsx("button",{type:"button",onClick:()=>a(t),className:"w-full text-left",children:x})}):e.jsx(m,{direction:"up",distance:4,delay:.05+n*.04,children:x}),b=e.jsxs("div",{className:"group relative",children:[d,o.length>0&&e.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:e.jsx(O,{items:o,label:`Finding actions for ${t.headline}`})})]});return o.length>0?e.jsx(U,{items:o,triggerClassName:"w-full",children:b}):b}function Re({findings:t,onOpenFix:n,menuCallbacks:a}){if(t.length===0)return null;const r=t.slice(0,4);return e.jsx("div",{className:"border-b border-default divide-y divide-subtle",children:r.map((i,l)=>e.jsx(Fe,{finding:i,index:l,onOpenFix:n,menuCallbacks:a},i.id))})}const E="28px minmax(0, 1fr) 96px 80px 80px 64px 96px 32px",W=25;function Be({status:t,binding:n}){const a=t==="unknown",r=a?"allowed":t,i=r==="blocked"&&n==="advisory",l=n==="unverified",o=l&&r==="blocked"?"Block set":l&&a?"No policy":l&&r==="allowed"?"Allow set":r==="blocked"?"Blocked":a?"Default allow":r==="allowed"?"Allowed":r==="conflict"?"Conflict":"Partial",x=i||l?"bg-muted/60 text-secondary":r==="blocked"?"bg-warning-subtle text-warning":r==="allowed"?"bg-success-subtle text-success":r==="conflict"?"bg-error-subtle text-error":"bg-muted text-muted",d=l?"OpenAI publishes this bot's identity, but its current documentation does not state that robots.txt is authoritative. Confirm reachability with observed visits.":i?"Your robots.txt blocks this bot, but as a user-initiated fetcher it typically bypasses these rules when answering queries":a?"No explicit robots.txt rule found for this bot. It is reachable by default.":void 0;return e.jsx(S,{content:d,children:e.jsxs("span",{className:h("inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium",x,(i||a||l)&&"cursor-help"),children:[o,(i||l)&&e.jsx(Q,{size:9,strokeWidth:2,className:"opacity-60"})]})})}function $e({bot:t}){return t.name!=="OAI-AdsBot"?e.jsx(ue,{category:t.category,size:"sm"}):e.jsx(S,{content:"Reviews submitted ChatGPT ad landing pages. It does not affect organic visibility or model training.",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded bg-muted/60 px-1.5 py-0.5 text-[10px] font-medium text-secondary cursor-help",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[#10a37f]"}),"Ad review"]})})}function ze(t){return t.matched_rule?`${t.matched_rule.directive==="allow"?"A":"D"}: ${t.matched_rule.path}`:"-"}function Le(t){if(!t)return"-";try{const n=new Date(t),a=Date.now()-n.getTime(),r=Math.floor(a/6e4);if(r<1)return"now";if(r<60)return`${r}m`;
1const i=Math.floor(r/60);if(i<24)return`${i}h`;const l=Math.floor(i/24);return l<30?`${l}d`:`${Math.floor(l/30)}mo`}catch{return"-"}}function We({bots:t,findings:n,onRowClick:a,menuCallbacks:r}){const[i,l]=v.useState(1),[o,x]=v.useState(""),[d,b]=v.useState("all"),g=v.useMemo(()=>{const s=new Map;for(const c of n)for(const u of c.affected_bots)s.has(u)||s.set(u,c);return s},[n]),f=v.useMemo(()=>{let s=t;if(o){const c=o.toLowerCase();s=s.filter(u=>u.name.toLowerCase().includes(c)||u.category.toLowerCase().includes(c))}return d==="reachable"?s=s.filter(c=>(c.status==="allowed"||c.status==="unknown")&&(c.robots_txt_binding!=="unverified"||c.visits_succeeded>0)):d==="blocked"&&(s=s.filter(c=>c.status==="blocked"&&(c.robots_txt_binding!=="unverified"||c.visits_blocked>0))),s},[t,o,d]),A=Math.ceil(f.length/W),k=Math.min(i,Math.max(1,A)),N=(k-1)*W,j=f.slice(N,N+W),w=K(Math.min(j.length,30),.02),y=s=>{x(s),l(1)},R=s=>{b(s),l(1)};if(t.length===0)return e.jsxs("div",{className:"px-8 py-16 flex flex-col items-center text-center border-b border-default",children:[e.jsx("div",{className:"w-10 h-10 rounded bg-accent-subtle flex items-center justify-center mb-3",children:e.jsx(ge,{size:18,strokeWidth:1.5,className:"text-accent"})}),e.jsx("p",{className:"text-[13px] text-secondary",children:"No bot data available"})]});const p=o!==""||d!=="all";return e.jsxs("div",{className:"border-b border-default",children:[e.jsxs("div",{className:"px-4 h-11 border-b border-subtle flex items-center justify-between gap-3 bg-surface",children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsxs("div",{className:"relative group",children:[e.jsx(je,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted group-focus-within:text-accent transition-colors"}),e.jsx("input",{type:"text",value:o,onChange:s=>y(s.target.value),placeholder:"Search bots...",className:"h-8 w-52 pl-8 pr-3 rounded border border-default text-[12px] text-primary placeholder:text-muted focus:ring-2 focus:ring-accent/20 focus:border-accent transition-all"})]}),e.jsx("div",{className:"flex items-center gap-1",children:["all","reachable","blocked"].map(s=>e.jsx("button",{type:"button",onClick:()=>R(s),className:h("h-8 px-2.5 rounded text-[12px] font-medium transition-colors duration-250",d===s?"bg-accent-subtle text-accent":"text-secondary hover:text-primary hover:bg-muted"),children:s==="all"?"All":s==="reachable"?"Reachable":"Blocked"},s))}),p&&e.jsxs("button",{type:"button",onClick:()=>{x(""),b("all"),l(1)},className:"h-8 px-2 flex items-center gap-1 rounded text-[11px] text-muted hover:text-primary hover:bg-muted transition-colors duration-250",children:[e.jsx(V,{size:12,strokeWidth:1.5}),"Clear"]})]}),e.jsxs("span",{className:"text-[11px] text-muted font-mono tabular-nums flex-shrink-0",children:[f.length," bot",f.length!==1?"s":""]})]}),e.jsxs("div",{className:"grid items-center px-4 h-11 bg-surface border-y border-subtle sticky top-0 z-10 text-[10px] font-semibold uppercase tracking-wider text-muted",style:{gridTemplateColumns:E,gap:"8px"},children:[e.jsx("span",{}),e.jsx("span",{children:"Bot"}),e.jsx("span",{children:"Type"}),e.jsx("span",{className:"text-left",children:"Status"}),e.jsx("span",{className:"text-right",children:"Visits"}),e.jsx("span",{className:"text-right",children:"Last seen"}),e.jsx("span",{children:"Rule"}),e.jsx("span",{})]}),e.jsx(le,{children:j.map((s,c)=>{const u=g.get(s.name),B=s.status==="blocked"&&s.robots_txt_binding!=="binding",F=!!a&&(!B||!!u)&&(s.status==="blocked"||!!u),_=r?pe(s,u,{...r,openFix:u&&a?()=>a(s,u):void 0}):[],$=e.jsxs("div",{className:"group relative",children:[e.jsx(m,{delay:w[Math.min(c,29)]??0,direction:"up",distance:3,children:e.jsxs("button",{type:"button",disabled:!F,onClick:F?()=>a(s,u):void 0,className:h("group w-full text-left grid items-center px-4 h-11 min-h-11 max-h-11","border-b border-subtle transition-colors duration-250",F?"hover:bg-muted/50 cursor-pointer":"cursor-default"),style:{gridTemplateColumns:E,gap:"8px"},children:[e.jsx("span",{className:"flex items-center justify-center",children:e.jsx(Y,{config:G(s.name),name:s.name,size:16})}),e.jsx("div",{className:"flex items-center min-w-0",children:e.jsx("span",{className:"text-[12px] font-medium text-primary truncate",children:s.name})}),e.jsx("div",{children:e.jsx($e,{bot:s})}),e.jsx("span",{className:"text-left",children:e.jsx(Be,{status:s.status,binding:s.robots_txt_binding})}),e.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-mono tabular-nums text-secondary",children:s.visits_attempted>
10?s.visits_attempted.toLocaleString():"-"}),s.visit_trend_pct!==null&&s.visit_trend_pct!==0&&e.jsx(S,{content:`${s.visit_trend_pct>0?"+":""}${s.visit_trend_pct.toFixed(1)}% vs previous period`,children:e.jsx("span",{className:h("inline-flex items-center cursor-help",s.visit_trend_pct>0?"text-success":"text-error"),children:s.visit_trend_pct>0?e.jsx(ye,{size:10,strokeWidth:2}):e.jsx(H,{size:10,strokeWidth:2})})})]}),e.jsx("span",{className:"text-right text-[11px] font-mono tabular-nums text-muted",children:Le(s.last_seen)}),e.jsx("div",{className:"min-w-0",children:e.jsx(S,{content:s.matched_rule?`${s.matched_rule.directive==="allow"?"Allow":"Disallow"} ${s.matched_rule.path} (User-agent: ${s.matched_rule.user_agent})`:"No matching rule",children:e.jsx("span",{className:"block text-[11px] font-mono text-muted truncate cursor-help",children:ze(s)})})}),e.jsx("span",{className:"flex items-center justify-center",children:F&&_.length===0&&e.jsx(ve,{size:13,className:"text-muted opacity-0 group-hover:opacity-100 transition-opacity duration-250"})})]})}),_.length>0&&e.jsx("div",{className:"absolute right-2 top-1/2 z-[2] -translate-y-1/2",children:e.jsx(O,{items:_,label:`Bot access actions for ${s.name}`})})]});return _.length>0?e.jsx(U,{items:_,triggerClassName:"w-full",children:$},s.name):e.jsx("div",{children:$},s.name)})}),f.length===0&&p&&e.jsx("div",{className:"px-8 py-12 flex flex-col items-center text-center",children:e.jsx("p",{className:"text-[12px] text-muted",children:"No bots match your filters"})}),e.jsx(xe,{page:k,totalPages:A,total:f.length,onPageChange:l,label:"bot"})]})}function Ie(t){if(!t)return"-";try{const n=new Date(t),a=Date.now()-n.getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}catch{return"-"}}function Pe({robots:t,onRefresh:n,isRefreshing:a,hasCloudflarePolicyLayer:r=!1}){const[i,l]=v.useState(!1);return e.jsx(m,{direction:"up",distance:4,delay:.1,children:e.jsxs("div",{className:"px-5 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted flex items-center gap-1.5",children:[e.jsx(Ne,{size:11,strokeWidth:1.5}),"robots.txt"]}),n&&e.jsxs("button",{type:"button",onClick:n,disabled:a,className:"flex items-center gap-1 text-[10px] text-muted hover:text-secondary transition-colors duration-250 disabled:opacity-50",children:[e.jsx(we,{size:10,strokeWidth:1.5,className:h(a&&"animate-spin")}),"Refresh"]})]}),t.found?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-[12px] font-mono text-secondary",children:["Fetched ",Ie(t.fetched_at)]}),e.jsxs("p",{className:"text-[11px] font-mono text-muted mt-0.5",children:[t.rules.length," rule",t.rules.length===1?"":"s"," ·"," ",t.sitemaps.length," sitemap",t.sitemaps.length===1?"":"s"]}),t.raw&&e.jsx("button",{type:"button",onClick:()=>l(o=>!o),className:"mt-2 text-[11px] text-muted hover:text-accent transition-colors duration-250",children:i?"Hide source":"View source"}),i&&t.raw&&e.jsx("pre",{className:"mt-2 text-[10px] font-mono text-secondary bg-muted/30 rounded border border-subtle p-2 max-h-48 overflow-auto whitespace-pre-wrap break-all",children:t.raw})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-[12px] font-mono text-warning",children:t.status_code===404?"No robots.txt found":"Could not fetch"}),e.jsx("p",{className:"text-[11px] font-mono text-muted mt-0.5",children:t.error||"Site defaults to fully crawlable when no file exists"})]}),r&&e.jsxs("div",{className:"mt-3 border-t border-subtle pt-3",children:[e.jsx("p",{className:"text-[11px] leading-relaxed text-muted",children:"Cloudflare can block AI bots before robots.txt is evaluated. Review its Search, Agent, and Training policies."}),e.jsxs("a",{href:"https://developers.cloudflare.com/bots/additional-configurations/block-ai-bots/",target:"_blank",rel:"noreferrer",className:"mt-1.5 inline-flex items-center gap-1 text-[10px] font-medium text-secondary hover:text-accent transition-colors duration-250",children:["Cloudflare bot controls",e.jsx(X,{size:10,strokeWidth:1.5})]})]})]})})}function Me({llms:t,missingFinding:n,onOpenFix:a}){return e.jsx(m,{direction:"up",distance:4,delay:.16,children:e.jsxs("div",{className:"px-5 py-4",children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted flex items-center gap-1.5 mb-2",children:[e.jsx(ke,{size:11,strokeWidth:1.5}),"llms.txt"]}),t.found?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-[12px] font-mono text-success",children:"Found at /llms.txt"}),e.jsxs("p",{className:"text-[11px] font-mono text-muted mt-0.5",children:[t.line_count!=null&&`${t.line_count} lines`,t.last_modified&&` · updated ${t.last_modified}`]}),e.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1 text-[11px] text-muted hover:text-accent transition-colors duration-250",children:["View",e.jsx(X,{size:10,strokeWidth:1.5})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-[12px] font-mono text-secondary",children:t.error==="html_returned"?"HTML page returned instead of llms.txt":t.status_code===404?"Not found":"Not detected"}),t.url&&e.jsxs("p",{className:"text-[11px] font-mono text-muted mt-0.5",children:["Checked ",t.url.replace("https://","").replace("http://",""),t.status_code?` (${t.status_code})`:""]}),e.jsx("p",{className:"text-[11px] font-mono text-muted mt-0.5",children:"An emerging standard that lets AI crawlers discover your most important pages."}),n&&a&&e.jsx("button",{type:"button",onClick:()=>a(n),className:"mt-2 text-[11px] text-accent hover:text-accent-hover transition-colors duration-250",children:"Generate preview â"})]})]})})}function De(t){if(!t)return"-";try{const n=Date.now()-new Date(t).getTime(),a=Math.floor(n/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const r=Math.floor(a/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}catch{return"-"}}function Ee({summary:t,isLoading:n,onSubmitAll:a,isSubmitting:r,crawledPageCount:i}){const l=(t?.total_submitted??0)>0,o=!!a&&!!i&&(i>(t?.success??0)||(t?.failed??0)>0);return e.jsx(m,{direction:"up",distance:4,delay:.22,children:e.jsxs("div",{className:"px-5 py-4",children:[e.jsx(S,{placement:"top",content:e.jsxs("div",{className:"max-w-[240px]",children:[e.jsx("p",{className:"font-medium text-primary mb-1",children:"Submit to AI search"}),e.jsx("p",{className:"text-[11px] text-secondary leading-relaxed",children:"Notifies Bing via IndexNow when pages change. Bing's index powers Microsoft Copilot and supplements ChatGPT search."})]}),children:e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted flex items-center gap-1.5 mb-2 cursor-help w-fit",children:[e.jsx(_e,{size:11,strokeWidth:1.5}),"IndexNow"]})}),n&&!t?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-3 w-20 bg-muted/30 rounded-sm animate-pulse"}),e.jsx("div",{className:"h-2.5 w-32 bg-muted/30 rounded-sm animate-pulse"})]}):l?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-[12px] font-mono text-secondary",children:[t.success.toLocaleStr
1ing()," page",t.success!==1?"s":""," submitted"]}),e.jsxs("p",{className:"text-[11px] font-mono text-muted mt-0.5",children:[t.last_submitted_at&&`Last ${De(t.last_submitted_at)}`,t.failed>0&&` · ${t.failed} failed`]}),o&&e.jsx("button",{type:"button",onClick:a,disabled:r,className:"mt-2 text-[11px] text-accent hover:text-accent/80 transition-colors duration-250 disabled:opacity-50",children:r?"Submitting...":(t?.failed??0)>0?"Retry failed pages â":"Submit new pages â"})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-[12px] font-mono text-secondary",children:"No pages submitted yet"}),e.jsx("p",{className:"text-[11px] font-mono text-muted mt-0.5",children:"Notify Bing when pages change to accelerate AI search discovery."}),o&&e.jsx("button",{type:"button",onClick:a,disabled:r,className:"mt-2 text-[11px] text-accent hover:text-accent/80 transition-colors duration-250 disabled:opacity-50",children:r?"Submitting...":`Submit ${i} page${i!==1?"s":""} â`})]})]})})}function st({data:t,isLoading:n,brandId:a,rangeOptions:r,onOpenFix:i,canManage:l=!0,menuCallbacks:o,indexNowSummary:x,indexNowLoading:d,onSubmitAllToSearch:b,isSubmittingToSearch:g,crawledPageCount:f,hasCloudflarePolicyLayer:A=!1}){const k=q(),[N,j]=v.useState(!1),w=async()=>{if(!(!a||N||!l)){j(!0);try{await re(a,r),await k.invalidateQueries({predicate:p=>p.queryKey[0]==="crawler-access"&&p.queryKey[1]===a})}finally{j(!1)}}};if(n&&!t)return e.jsxs("div",{className:"space-y-0",children:[e.jsxs("div",{className:"px-8 py-6",children:[e.jsx(T,{className:"h-4 w-48 mb-3"}),e.jsx(T,{className:"h-3 w-64"})]}),e.jsx("div",{className:"border-b border-default",children:[0,1,2,3,4].map(p=>e.jsxs("div",{className:"border-b border-subtle px-4 h-11 flex items-center gap-3",children:[e.jsx(T,{className:"h-2 w-2 rounded-full"}),e.jsx(T,{className:"h-3 flex-1 max-w-[200px]"})]},p))})]});if(!t)return e.jsx("div",{className:"px-8 py-12 text-center",children:e.jsx("p",{className:"text-[11px] font-mono text-muted",children:"Crawler Access unavailable. Set a brand domain to enable."})});const y=(p,s)=>{s&&i(s)},R=t.findings.find(p=>p.type==="missing_llms_txt")??null;return e.jsxs("div",{className:"space-y-0",children:[e.jsx(Re,{findings:t.findings,onOpenFix:i,menuCallbacks:o}),e.jsx(We,{bots:t.bots,findings:t.findings,onRowClick:y,menuCallbacks:o}),e.jsxs("div",{className:"grid grid-cols-3 border-b border-default",children:[e.jsx("div",{className:"border-r border-default",children:e.jsx(Pe,{robots:t.robots_txt,onRefresh:l?w:void 0,isRefreshing:N,hasCloudflarePolicyLayer:A})}),e.jsx("div",{className:"border-r border-default",children:e.jsx(Me,{llms:t.llms_txt,missingFinding:R,onOpenFix:i})}),e.jsx(Ee,{summary:x,isLoading:d??!1,onSubmitAll:l?b:void 0,isSubmitting:g,crawledPageCount:f})]})]})}function z({label:t,value:n,isHero:a,isLast:r,total:i,index:l,tone:o="default",suffix:x}){const d=K(i,.06);return e.jsx(m,{delay:d[l],duration:.35,direction:"up",distance:8,className:h("flex-1",!r&&"border-r border-default"),children:e.jsxs("div",{className:"relative flex flex-col justify-center px-5 py-5",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted mb-2",children:t}),e.jsx("div",{className:"flex items-baseline gap-1.5",children:e.jsxs("p",{className:h("font-semibold tracking-tight tabular-nums leading-none",a?"text-[28px]":"text-[24px] font-mono",o==="warn"&&!a?"text-warning":"text-primary"),children:[e.jsx(oe,{value:n,delay:d[l]+.15,duration:800,decimals:0}),x&&e.jsx("span",{className:"text-[14px] font-normal text-muted ml-0.5",children:x})]})})]})})}function rt({summary:t}){const n=t.allowed+t.default_allowed;return e.jsxs("div",{className:"border-b border-default grid grid-cols-4",children:[e.jsx(z,{label:"Health Score",value:t.health_score,suffix:"/100",isHero:!0,index:0,total:4}),e.jsx(z,{label:"Reachable",value:n,index:1,total:4}),e.jsx(z,{label:"Blocked",value:t.blocked,index:2,total:4,tone:"warn"}),e.jsx(z,{label:"Issues",value:t.issues_detected,isLast:!0,index:3,total:4,tone:t.issues_detected>0?"warn":"default"})]})}function qe({lines:t,maxLines:n=60}){if(t.length===0)return e.jsx("pre",{className:"text-[11px] font-mono text-muted bg-muted/30 rounded border border-subtle p-3",children:"No changes"});const a=t.length>n,r=a?t.slice(0,n):t;return e.jsxs("div",{className:"rounded border border-subtle bg-muted/20 overflow-hidden",children:[e.jsx("pre",{className:"text-[11px] font-mono leading-relaxed p-3 overflow-x-auto whitespace-pre",children:r.map((i,l)=>e.jsxs("div",{className:h("flex items-start gap-2 -mx-3 px-3",i.kind==="add"&&"bg-success-subtle/40 text-success",i.kind==="remove"&&"bg-error-subtle/40 text-error line-through opacity-70",i.kind==="context"&&"text-secondary"),children:[e.jsx("span",{className:"select-none text-muted/40 w-3 flex-shrink-0",children:i.kind==="add"?"+":i.kind==="remove"?"
1-":" "}),e.jsx("span",{className:"flex-1 break-all",children:i.text||" "})]},l))}),a&&e.jsxs("div",{className:"border-t border-subtle px-3 py-1.5 text-[10px] font-mono text-muted",children:[t.length-n," more lines hidden"]})]})}function at({finding:t,brandId:n,days:a,onClose:r,onApplied:i,canManage:l=!0,hasAutoApplyIntegration:o=!1,onViewSpoofedTraffic:x}){const d=!!t,b=q(),{copiedKey:g,copy:f}=Ae(),A=g==="rule"||g==="proposed",[k,N]=v.useState(!1),[j,w]=v.useState(null);v.useEffect(()=>{d||(N(!1),w(null))},[d]);const{data:y,isLoading:R,error:p}=se({queryKey:["crawler-access-preview",n,t?.id,a],queryFn:()=>ie(n,t.id,a),enabled:d&&!!n&&!!t?.id,staleTime:300*1e3,retry:1});if(!t)return e.jsx(I.Slideover,{isOpen:!1,onClose:r,side:"right",width:"max-w-md",children:e.jsx("div",{})});const s=t.fix_action_type==="unblock_ai_crawlers",c=t.fix_action_type==="add_llms_txt",u=t.fix_action_type==="investigate",B=t.fix_action_type==="block_spoofed_bots",F=s?`Unblock ${t.affected_bots[0]||"AI crawler"}`:c?"Generate llms.txt":u?"Investigate":B?"Block impostor bots":"Fix",_=`(${(t.affected_bots.length>0?t.affected_bots:["GPTBot","ChatGPT-User","PerplexityBot","ClaudeBot"]).map(te=>`http.user_agent contains "${te}"`).join(" or ")}) and not cf.client.bot`,$=async()=>{await f(_,"rule")},Z=async()=>{y?.proposed&&await f(y.proposed,"proposed")},J=async()=>{if(!(!t||k||!l)){N(!0),w(null);try{const C=await ae(n,t.id,a);C.success?(w({success:!0,message:C.message||"Applied successfully"}),await b.invalidateQueries({queryKey:["crawler-access",n]}),i?.()):w({success:!1,message:C.message||C.error||"Could not apply this fix automatically"})}catch{w({success:!1,message:"Couldn't connect. Try again."})}finally{N(!1)}}},ee=async()=>{if(!(!t||!l))try{await ne(n,t.id,t.type,t.fix_action_type,"user_dismissed"),await b.invalidateQueries({queryKey:["crawler-access",n]}),P.success("Finding dismissed"),r()}catch{P.error("Could not dismiss finding")}};return e.jsx(I.Slideover,{isOpen:d,onClose:r,side:"right",width:"max-w-md",children:e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"sticky top-0 z-10 bg-surface border-b border-default px-5 py-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0 mr-3",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted mb-1",children:"Fix"}),e.jsx("h3",{className:"text-[15px] font-semibold text-primary truncate tracking-tight",children:F})]}),e.jsx("button",{type:"button",onClick:r,className:"w-7 h-7 rounded flex items-center justify-center text-muted hover:text-primary hover:bg-muted transition-colors duration-250 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent/30","aria-label":"Close drawer",children:e.jsx(V,{size:14,strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsx(m,{direction:"up",distance:3,delay:.02,children:e.jsxs("div",{className:"px-5 py-4 border-b border-default",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted mb-3",children:"The Problem"}),e.jsx("p",{className:"text-[13px] text-primary leading-snug",children:t.headline}),e.jsx("p",{className:"text-[12px] text-secondary mt-1.5 leading-snug font-mono",children:t.detail}),t.affected_pages.length>0&&e.jsxs("div",{className:"mt-3",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted mb-1.5",children:"Affected pages"}),e.jsx("ul",{className:"space-y-0.5",children:t.affected_pages.slice(0,5).map(C=>e.jsx("li",{className:"text-[11px] font-mono text-muted truncate",children:C},C))})]})]})}),(s||c)&&e.jsx(m,{direction:"up",distance:3,delay:.08,children:e.jsxs("div",{className:"px-5 py-4 border-b border-default",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted mb-3",children:"Proposed Change"}),R&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{className:"h-3 w-full"}),e.jsx(T,{className:"h-3 w-3/4"}),e.jsx(T,{className:"h-3 w-5/6"})]}),p!=null&&e.jsx("p",{className:"text-[11px] font-mono text-error",children:"Could not generate preview"}),y&&e.jsx(qe,{lines:y.diff_lines})]})}),(s||c)&&e.jsx(m,{direction:"up",distance:3,delay:.14,children:e.jsxs("div",{className:"px-5 py-4 border-b border-default",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted mb-3",children:"Apply the Fix"}),j&&e.jsx("div",{className:h("mb-3 px-3 py-2 rounded border text-[11px] font-mono",j.success?"bg-success-subtle border-success/30 text-success":"bg-warning-subtle border-warning/30 text-warning"),children:j.message}),e.jsxs("div",{className:"space-y-2",children:[l&&o&&e.jsx("button",{type:"button",onClick:J,disabled:k||!y,className:h("w-full h-9 rounded text-[12px] font-medium transition-colors duration-250","bg-accent-subtle text-accent hover:bg-accent hover:text-white","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-accent-subtle disabled:hover:text-accent"),children:k?"Applyingâ¦":"Apply via connected site"}),e.jsx("button",{type:"button",onClick:Z,disabled:!y,className:"w-full h-9 rounded border border-default text-[12px] font-medium text-secondary hover:text-primary hover:border-hover hover:bg-muted/50 transition-colors duration-250 disabled:opacity-50 inline-flex items-center justify-center gap-1.5",children:A?e.jsxs(e.Fragment,{children:[e.jsx(M,{size:12,strokeWidth:1.5})," Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{size:12,strokeWidth:1.5})," Copy ",c?"llms.txt":"robots.txt"," to clipboard"]})})]}),e.jsx("p",{className:"text-[11px] text-muted mt-3 leading-snug",children:j?.success?"Fix recorded. Re-run the access report in a few minutes to confirm the live file updated.":l?o?"Apply will push this change directly through your connected integration.":"Copy the file and update it via your CMS or deploy pipeline. Auto-apply is available for supported integrations.":"You can review and copy the proposed file, but only editors or owners can a
1pply or dismiss crawler fixes."})]})}),B&&e.jsxs(e.Fragment,{children:[e.jsx(m,{direction:"up",distance:3,delay:.08,children:e.jsxs("div",{className:"px-5 py-4 border-b border-default",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted mb-3",children:"What this is"}),e.jsx("p",{className:"text-[12px] text-secondary leading-relaxed",children:"A user agent is just a text header, so anything can claim to be GPTBot. These requests asked for URLs that do not exist on your site, which is what scanners do when they are looking for exposed config files and keys."}),e.jsx("p",{className:"text-[12px] text-secondary leading-relaxed mt-2",children:"They are excluded from your traffic numbers everywhere else in Trakkr. Nothing here needs fixing on your site."}),x&&e.jsx("button",{type:"button",onClick:x,className:"mt-3 inline-flex items-center gap-1.5 text-[11px] font-medium text-accent hover:underline",children:"See these requests in the feed"})]})}),e.jsx(m,{direction:"up",distance:3,delay:.14,children:e.jsxs("div",{className:"px-5 py-4 border-b border-default",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted mb-3",children:"Block them at your edge"}),e.jsx("p",{className:"text-[12px] text-secondary leading-relaxed mb-3",children:"Cloudflare verifies real AI crawlers by source IP. This custom WAF rule blocks anything claiming to be one that it cannot verify, and leaves genuine crawlers untouched."}),e.jsx("pre",{className:"px-3 py-2 rounded border border-default bg-muted/40 text-[11px] font-mono text-primary whitespace-pre-wrap break-all",children:_}),e.jsx("button",{type:"button",onClick:$,className:"mt-2 w-full h-9 rounded border border-default text-[12px] font-medium text-secondary hover:text-primary hover:border-hover hover:bg-muted/50 transition-colors duration-250 inline-flex items-center justify-center gap-1.5",children:A?e.jsxs(e.Fragment,{children:[e.jsx(M,{size:12,strokeWidth:1.5})," Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{size:12,strokeWidth:1.5})," Copy rule expression"]})}),e.jsx("p",{className:"text-[11px] text-muted mt-3 leading-snug",children:"Add it under Security · WAF · Custom rules in your Cloudflare dashboard. This also cuts the noise in your own logs, not just in Trakkr."})]})})]}),u&&e.jsx(m,{direction:"up",distance:3,delay:.08,children:e.jsxs("div",{className:"px-5 py-4 border-b border-default",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted mb-3",children:"Investigation Steps"}),e.jsxs("div",{className:"flex items-start gap-2 text-[12px] text-secondary leading-snug",children:[e.jsx(L,{size:13,strokeWidth:1.5,className:"text-warning mt-0.5 flex-shrink-0"}),e.jsx("p",{children:"There's no automated fix for this finding. The most common causes are Cloudflare bot fight, WAF rules, or rate limits at your CDN. Check those first, then re-run the access check from this drawer's parent panel."})]})]})}),l&&e.jsx(m,{direction:"up",distance:3,delay:.2,children:e.jsxs("div",{className:"px-5 py-4",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted mb-2",children:"Not interested?"}),e.jsxs("button",{type:"button",onClick:ee,className:"inline-flex items-center gap-1.5 h-8 px-2.5 -ml-2.5 rounded text-[12px] font-medium text-muted hover:text-secondary hover:bg-muted/50 transition-colors duration-250",children:[e.jsx(Ce,{size:13,strokeWidth:1.5}),"Mark as intentional"]}),e.jsx("p",{className:"text-[11px] text-muted mt-1.5 leading-snug",children:"Dismissed findings stop appearing in future reports until the underlying signal changes."})]})})]})]})})}export{Re as AccessFindingsStrip,at as AccessFixDrawer,rt as AccessHeroStats,We as BotAccessTable,st as CrawlerAccessTab,Ee as IndexNowPanel,Me as LlmsTxtPanel,qe as RobotsDiffView,Pe as RobotsTxtPanel};
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.