module.exports=[18622,(a,b,c)=>{b.exports=a.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},75218,(a,b,c)=>{"use strict";b.exports=a.r(18622)},37425,(a,b,c)=>{"use strict";b.exports=a.r(75218).vendored["react-ssr"].ReactJsxRuntime},14177,(a,b,c)=>{"use strict";b.exports=a.r(75218).vendored["react-ssr"].React},41360,(a,b,c)=>{"use strict";b.exports=a.r(75218).vendored["react-ssr"].ReactDOM},87576,a=>{"use strict";var b=a.i(37425),c=a.i(34944),d=a.i(14177);function e({params:a}){let{session:e}=(0,d.use)(a),[f,g]=(0,d.useState)([]),[h,i]=(0,d.useState)(0),[j,k]=(0,d.useState)(!1),[l,m]=(0,d.useState)(10),[n,o]=(0,d.useState)({width:1920,height:1080}),[p,q]=(0,d.useState)(null),[r,s]=(0,d.useState)([]);(0,d.useEffect)(()=>{fetch(`/api/screenshots/list?pattern=${e}`).then(a=>a.json()).then(a=>{let b=a.files.filter(a=>a.includes("jank-")&&a.includes(e)).sort((a,b)=>parseInt(a.match(/jank-(\d+)ms/)?.[1]||"0",10)-parseInt(b.match(/jank-(\d+)ms/)?.[1]||"0",10));if(g(b),b.length>0){let a=new Image;a.onload=()=>{o({width:a.naturalWidth,height:a.naturalHeight})},a.src=`/api/screenshots/${b[0]}`}}),fetch(`/api/jank/${e}`).then(a=>a.json()).then(a=>{s(a.clsMarkers||[])}).catch(()=>{s([])})},[e]),(0,d.useEffect)(()=>{if(!j||0===f.length)return;let a=setInterval(()=>{i(a=>a>=f.length-1?(k(!1),a):a+1)},1e3/l);return()=>clearInterval(a)},[j,f.length,l]);let[,t]=(0,d.useState)(0);if((0,d.useEffect)(()=>{let a=()=>t(a=>a+1);return window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),0===f.length)return(0,b.jsx)("div",{className:"p-8",children:"Loading frames..."});let u=f[h],v=u?.match(/jank-(\d+)ms/)?.[1]||"0",w=parseInt(v,10),x=r.find(a=>100>Math.abs(a.timestamp-w)),y={};if(p&&x?.boundingBox){let a=p.parentElement?.getBoundingClientRect(),b=n.width,c=n.height;if(a){let d,e,f,g,h=a.width/a.height,i=b/c;h>i?(d=(e=a.height)*i,f=(a.width-d)/2,g=0):(e=(d=a.width)/i,f=0,g=(a.height-e)/2);let j=d/b;y={left:`${f+x.boundingBox.x*j}px`,top:`${g+x.boundingBox.y*j}px`,width:`${x.boundingBox.width*j}px`,height:`${x.boundingBox.height*j}px`}}}return(0,b.jsxs)("div",{className:"flex flex-col h-screen bg-black",children:[(0,b.jsxs)("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden",children:[(0,b.jsx)(c.default,{ref:q,src:`/api/screenshots/${u}`,alt:`Frame ${h}`,className:"w-full h-full object-contain",fill:!0,unoptimized:!0}),x?.boundingBox&&p&&(0,b.jsx)("div",{className:"absolute border-2 border-red-500 pointer-events-none",style:y})]}),(0,b.jsxs)("div",{className:"bg-gray-900 text-white p-4 space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("button",{type:"button",onClick:()=>k(!j),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 rounded",children:j?"Pause":"Play"}),(0,b.jsx)("button",{type:"button",onClick:()=>i(Math.max(0,h-1)),disabled:0===h,className:"px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded disabled:opacity-50",children:"Previous"}),(0,b.jsx)("button",{type:"button",onClick:()=>i(Math.min(f.length-1,h+1)),disabled:h===f.length-1,className:"px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded disabled:opacity-50",children:"Next"}),(0,b.jsxs)("span",{className:"flex-1 text-center",children:["Frame ",h+1," / ",f.length," (",v,"ms)"]}),(0,b.jsxs)("label",{className:"flex items-center gap-2",children:["Speed:",(0,b.jsx)("input",{type:"range",min:"1",max:"30",value:l,onChange:a=>m(Number(a.target.value)),className:"w-32"}),(0,b.jsxs)("span",{className:"w-12",children:[l," fps"]})]})]}),(0,b.jsxs)("div",{className:"relative w-full",children:[(0,b.jsx)("input",{type:"range",min:"0",max:f.length-1,value:h,onChange:a=>i(Number(a.target.value)),className:"w-full"}),r.map(a=>{let c=f.findIndex(b=>parseInt(b.match(/jank-(\d+)ms/)?.[1]||"0",10)>=a.timestamp);if(-1===c)return null;let d=c/(f.length-1)*100;return(0,b.jsxs)("div",{className:"absolute top-0 h-full pointer-events-none",style:{left:`${d}%`},children:[(0,b.jsx)("div",{className:"w-0.5 h-full bg-red-500"}),(0,b.jsx)("div",{className:"absolute -top-6 left-0 -translate-x-1/2 bg-red-500 text-white text-xs px-2 py-0.5 rounded whitespace-nowrap",children:a.clsScore?(0,b.jsxs)(b.Fragment,{children:["CLS ",a.clsScore.toFixed(4)," @ ",a.timestamp,"ms",a.element&&(0,b.jsxs)("span",{className:"ml-1 opacity-75",children:["<",a.element.toLowerCase(),">"]})]}):`CLS ${a.timestamp}ms`})]},a.timestamp)})]})]})]})}a.s(["default",()=>e])}];

//# sourceMappingURL=%5Broot-of-the-server%5D__4feaccaf._.js.map