1import{c as m,aj as p,r as a,j as e,ak as b,O as r}from"./index-C5MtA4Vx.js";import{C as g}from"./circle-check-CrQbSfxK.js";import{S as u}from"./save-BsvA-dh8.js";import{E as f}from"./external-link-BtFG2lqD.js";const v=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],w=m("rotate-ccw",v);function k(){const{robotsTxt:d}=p.useLoaderData(),[s,i]=a.useState(d),[o,n]=a.useState(!1),[l,c]=a.useState(!1),x=async()=>{if(!r)return alert("Sanity project ID not set in .env");n(!0);try{await r.createOrReplace({_type:"siteSettings",_id:"siteSettings",robotsTxt:s}).catch(()=>r.patch("siteSettings").setIfMissing({_type:"siteSettings"}).set({robotsTxt:s}).commit()),c(!0),setTimeout(()=>c(!1),3e3)}finally{n(!1)}};return e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-white",children:"Robots.txt"}),e.jsx("p",{className:"text-white/50 text-sm mt-1",children:"Control how search engines crawl your site"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:()=>i(b),className:"flex items-center gap-2 px-4 py-2.5 bg-white/5 hover:bg-white/10 text-white/60 hover:text-white text-sm font-medium rounded-lg transition-colors border border-white/10",children:[e.jsx(w,{size:14}),"Reset to default"]}),e.jsxs("button",{onClick:x,disabled:o,className:"flex items-center gap-2 px-5 py-2.5 bg-orange-500 hover:bg-orange-600 disabled:opacity-60 text-white text-sm font-medium rounded-lg transition-colors",children:[l?e.jsx(g,{size:14}):e.jsx(u,{size:14}),l?"Saved!":o?"Savingâ¦":"Save Changes"]}),e.jsxs("a",{href:"/robots.txt",target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 px-4 py-2.5 bg-transparent border border-white/20 hover:border-white/40 text-white/80 hover:text-white text-sm font-medium rounded-lg transition-colors",children:[e.jsx(f,{size:14}),"View Live"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-[#161b22] rounded-xl border border-white/5 overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-3.5 border-b border-white/5 flex items-center justify-between",children:[e.jsx("p",{className:"text-white/50 text-xs font-mono uppercase tracking-wider",children:"EDITOR"}),e.jsx("span",{className:"text-white/30 text-xs",children:"/robots.txt"})]}),e.jsx("textarea",{value:s,onChange:t=>i(t.target.value),className:"w-full h-80 bg-transparent p-5 text-sm text-green-400/90 font-mono resize-none focus:outline-none leading-relaxed",spellCheck:!1})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-[#161b22] rounded-xl border border-white/5 p-5",children:[e.jsx("h2",{className:"text-white font-semibold text-sm mb-4",children:"Quick Reference"}),e.jsx("div",{className:"space-y-3",children:[{directive:"User-agent: *",desc:"Applies to all bots"},{directive:"User-agent: Googlebot",desc:"Applies to Google only"},{directive:"Allow: /",desc:"Allow crawling of a path"},{directive:"Disallow: /admin",desc:"Block a path from crawling"},{directive:"Crawl-delay: 10",desc:"Seconds between requests"},{directive:"Sitemap: https://â¦/sitemap.xml",desc:"Point to your sitemap"}].map(({directive:t,desc:h})=>e.jsxs("div",{className:"flex gap-3",children:[e.jsx("code",{className:"text-orange-400 text-xs font-mono bg-orange-500/10 px-2 py-0.5 rounded flex-shrink-0 h-fit",children:t}),e.jsx("span",{className:"text-white/50 text-xs",children:h})]},t))})]}),e.jsxs("div",{className:"bg-blue-500/5 border border-blue-500/20 rounded-xl p-4",children:[e.jsx("p",{className:"text-blue-400 text-xs font-medium mb-1",children:"Note"}),e.jsxs("p",{className:"text-white/50 text-xs leading-relaxed",children:["Changes saved here update the live ",e.jsx("code",{className:"text-white/70",children:"/robots.txt"})," immediately on your next server restart or rebuild. The current Sanity cache refreshes every 5 minutes."]})]})]})]})]})}export{k as component};
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.