1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26224],{17687:(e,t,r)=>{r.d(t,{A:()=>s});let s=(0,r(41285).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},20449:(e,t,r)=>{r.d(t,{A:()=>s});let s=(0,r(41285).A)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},26224:(e,t,r)=>{r.r(t),r.d(t,{default:()=>h});var s=r(95818),l=r(16418),n=r(17687),a=r(41285);let d=(0,a.A)("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);var i=r(20449),o=r(41102);let c=(0,a.A)("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);function x(e,t){return t||null===e?{className:"bg-destructive text-destructive-foreground",label:"Lá»i"}:e<300?{className:"bg-success text-success-foreground",label:"Nhanh"}:e<=1e3?{className:"bg-accent text-foreground",label:"Trung b\xecnh"}:{className:"bg-destructive text-destructive-foreground",label:"Cháºm"}}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null===e?"â":e.toFixed(t)}async function u(e){try{let t=await fetch("/api/tools/seo-fetch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})}),r=await t.json();if(!t.ok)throw Error(r.error||"Kh\xf4ng thá» Äo URL n\xe0y.");return{url:e,finalUrl:r.finalUrl,timingMs:r.timingMs,redirects:r.redirectChain.length,sizeKb:r.byteLength/1024,error:null}}catch(t){return{url:e,finalUrl:null,timingMs:null,redirects:0,sizeKb:null,error:t instanceof Error?t.message:"Kh\xf4ng thá» Äo URL n\xe0y."}}}function h(){let[e,t]=(0,l.useState)("https://example.com\nhttps://example.org"),[r,a]=(0,l.useState)(!1),[h,p]=(0,l.useState)(""),[g,f]=(0,l.useState)(!1),[b,j]=(0,l.useState)([]),[N,y]=(0,l.useState)("timingMs"),[v,w]=(0,l.useState)("asc"),k=(0,l.useMemo)(()=>{let e=[...b];return e.sort((e,t)=>{var r,s;let l="asc"===v?1:-1;return"url"===N?e.url.localeCompare(t.url)*l:((null!==(r=e[N])&&void 0!==r?r:Number.POSITIVE_INFINITY)-(null!==(s=t[N])&&void 0!==s?s:Number.POSITIVE_INFINITY))*l}),e},[b,v,N]),M=(0,l.useMemo)(()=>0===b.length?"":["url,finalUrl,totalMs,redirects,sizeKb,error",...b.map(e=>{var t;return[e.url,e.finalUrl||"",null!==(t=e.timingMs)&&void 0!==t?t:"",e.redirects,null===e.sizeKb?"":e.sizeKb.toFixed(2),e.error||""].join(",")})].join("\n"),[b]),C=(0,l.useMemo)(()=>Math.max(...b.map(e=>e.timingMs||0),1),[b]),U=e=>{if(N===e){w(e=>"asc"===e?"desc":"asc");return}y(e),w("asc")},S=async()=>{let t=Array.from(new Set(e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean)));if(0===t.length){p("Nháºp \xedt nhất 1 URL."),j([]);return}a(!0),p(""),j([]);try{let e=await Promise.all(t.map(e=>u(e)));j(e)}catch(e){p("Kh\xf4ng thá» ho\xe0n tất ph\xe9p Äo.")}finally{a(!1)}},A=async()=>{if(M)await (async()=>{try{if(navigator.clipboard&&document.hasFocus())await navigator.clipboard.writeText(M);else throw Error("Clipboard requires focused document")}catch(t){let e=document.createElement("textarea");e.value=M,e.setAttribute("readonly",""),e.style.position="fixed",e.style.left="-9999px",e.style.top="0",document.body.appendChild(e),e.focus(),e.select(),document.execCommand("copy"),document.body.removeChild(e)}})(),f(!0),window.setTimeout(()=>f(!1),1800)};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-sm font-semibold text-foreground",children:["URL list",(0,s.jsx)("textarea",{value:e,onChange:e=>t(e.target.value),rows:12,placeholder:"Má»i d\xf2ng má»t URL",className:"rounded-lg border border-border bg-background mt-2 w-full px-4 py-3 font-mono text-sm text-foreground outline-none placeholder:text-muted-foreground"})]}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-3",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>void S(),disabled:r,className:"inline-flex items-center gap-2 rounded-full bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground disabled:opacity-50",children:[r?(0,s.jsx)(n.A,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(d,{className:"h-4 w-4"}),"Ph\xe2n t\xedch"]}),(0,s.jsxs)("button",{type:"button",onClick:()=>void A(),disabled:!M,className:"inline-flex items-center gap-2 rounded-full px-4 py-2 text-sm font-semibold ".concat(g?"bg-success text-success-foreground":"bg-
1accent text-foreground"," disabled:opacity-50"),children:[g?(0,s.jsx)(i.A,{className:"h-4 w-4"}):(0,s.jsx)(o.A,{className:"h-4 w-4"}),g?"Ä\xe3 copy CSV":"Copy CSV"]})]}),h?(0,s.jsx)("div",{className:"mt-4 rounded-2xl bg-destructive px-4 py-3 text-sm font-medium text-destructive-foreground",children:h}):null]}),(0,s.jsx)("div",{children:(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-border bg-background p-4",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"URL"}),(0,s.jsx)("p",{className:"mt-1 text-2xl font-bold text-foreground",children:b.length})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-border bg-background p-4",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"TB"}),(0,s.jsxs)("p",{className:"mt-1 text-2xl font-bold text-foreground",children:[b.length?m(b.reduce((e,t)=>e+(t.timingMs||0),0)/b.length):"0","ms"]})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-border bg-background p-4",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Lá»i"}),(0,s.jsx)("p",{className:"mt-1 text-2xl font-bold text-foreground",children:b.filter(e=>e.error).length})]})]})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex items-center justify-between gap-3",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-bold text-foreground",children:"Waterfall ưá»c lượng"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Segment redirect chá» minh hoạ, kh\xf4ng phải timing ch\xednh x\xe1c."})]})}),r?(0,s.jsx)("div",{className:"flex min-h-40 items-center justify-center",children:(0,s.jsx)(n.A,{className:"h-8 w-8 animate-spin text-foreground"})}):b.length>0?(0,s.jsx)("div",{className:"mt-5 space-y-4",children:b.map(e=>{let t=e.timingMs&&e.redirects>0?Math.min(35,Math.max(12,e.redirects/5*20)):0,r=e.error?0:100-t;return(0,s.jsxs)("div",{className:"rounded-2xl border border-border bg-background p-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,s.jsx)("p",{className:"min-w-0 flex-1 break-all text-sm font-semibold text-foreground",children:e.url}),(0,s.jsx)("span",{className:"rounded-full px-3 py-1 text-xs font-semibold ".concat(x(e.timingMs,e.error).className),children:e.error||"".concat(m(e.timingMs)," ms")})]}),e.error?null:(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)("div",{className:"h-4 overflow-hidden rounded-full bg-background",children:(0,s.jsxs)("div",{className:"flex h-full",style:{width:"".concat(Math.max((e.timingMs||0)/C*100,12),"%")},children:[t>0?(0,s.jsx)("div",{className:"h-full bg-accent",style:{width:"".concat(t,"%")}}):null,(0,s.jsx)("div",{className:"h-full bg-primary",style:{width:"".concat(r,"%")}})]})}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-3 text-xs text-muted-foreground",children:[(0,s.jsxs)("span",{children:["Redirect: ",e.redirects]}),(0,s.jsxs)("span",{children:["Size: ",m(e.sizeKb,2)," KB"]}),e.finalUrl&&e.finalUrl!==e.url?(0,s.jsxs)("span",{children:["Ä\xedch: ",e.finalUrl]}):null]})]})]},e.url)})}):(0,s.jsx)("div",{className:"mt-5 rounded-2xl border border-border bg-background px-4 py-6 text-sm text-muted-foreground",children:"Chưa c\xf3 dữ liá»u."})]}),(0,s.jsx)("div",{children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"min-w-full text-sm",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b border-border text-left text-muted-foreground",children:[[["url","URL"],["timingMs","Tá»ng ms"],["redirects","Redirect"],["sizeKb","KB"]].map(e=>{let[t,r]=e;return(0,s.jsx)("th",{className:"px-3 py-3 font-semibold",children:(0,s.jsxs)("button",{type:"button",onClick:()=>U(t),className:"inline-flex items-center gap-2 text-left text-foreground",children:[r,(0,s.jsx)(c,{className:"h-3.5 w-3.5"})]})},t)}),(0,s.jsx)("th",{className:"px-3 py-3 font-semibold text-foreground",children:"Ä\xe1nh gi\xe1"})]})}),(0,s.jsx)("tbody",{children:r?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:5,className:"px-3 py-10 text-center",children:(0,s.jsx)(n.A,{className:"mx-auto h-6 w-6 animate-spin text-foreground"})})}):k.length>0?k.map(e=>{let t=x(e.timingMs,e.error);return(0,s.jsxs)("tr",{className:"border-b border-border align-top",children:[(0,s.jsxs)("td",{className:"px-3 py-4",children:[(0,s.jsx)("p",{className:"break-all font-medium text-foreground",children:e.url}),e.finalUrl&&e.finalUrl!==e.url?(0,s.jsxs)("p",{className:"mt-1 break-all text-xs text-muted-foreground",children:["â ",e.finalUrl]}):null,e.error?(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e.error}):null]}),(0,s.jsx)("td",{className:"px-3 py-4 text-foreground",children:null===e.timingMs?"â":"".concat(m(e.timingMs)," ms")}
1),(0,s.jsx)("td",{className:"px-3 py-4 text-foreground",children:e.redirects}),(0,s.jsx)("td",{className:"px-3 py-4 text-foreground",children:null===e.sizeKb?"â":"".concat(m(e.sizeKb,2)," KB")}),(0,s.jsx)("td",{className:"px-3 py-4",children:(0,s.jsx)("span",{className:"rounded-full px-3 py-1 text-xs font-semibold ".concat(t.className),children:t.label})})]},e.url)}):(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:5,className:"px-3 py-8 text-center text-muted-foreground",children:"Chưa c\xf3 kết quả."})})})]})})})]})}},41102:(e,t,r)=>{r.d(t,{A:()=>s});let s=(0,r(41285).A)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])}}]);
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.