try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`9b890047-6ec3-4bf4-be21-7afa06ac2619`,e._sentryDebugIdIdentifier=`sentry-dbid-9b890047-6ec3-4bf4-be21-7afa06ac2619`)}catch{}import{o as e}from"./rolldown-runtime-nx40z1zs.js";import{Ag as t,jg as n,mp as r,ng as i,op as a}from"./entry.client-mpghtlrl.js";import{t as o}from"./xds-icons-m106f2fc.js";import{n as s,r as c}from"./useWidget-nf2epnjz.js";import{l,s as u}from"./data-k1o1noin.js";var d=t(),f=e(n(),1),p=i(),m=`frame-counter`,h=30,g=60,_=2e3,v=e=>{let t=(0,d.c)(23),{visibility:n}=e,[r,i]=(0,f.useState)(60),[a,o]=(0,f.useState)(60),s=(0,f.useRef)(void 0),c,l;t[0]===a?(c=t[1],l=t[2]):(c=()=>(s.current=setInterval(()=>{let e=Math.floor(Math.random()*7)-3;i(Math.max(h,Math.min(g,a+e)))},_),()=>clearInterval(s.current)),l=[a],t[0]=a,t[1]=c,t[2]=l),(0,f.useEffect)(c,l);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{o(e=>e===60?30:60)},t[3]=u):u=t[3];let m=u,v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{o(60),i(60)},t[4]=v):v=t[4];let y=v,b=n===`persistent`,x=b?``:r>=55?`text-green-400`:r>=45?`text-yellow-400`:`text-red-400`,S=`flex h-full w-full flex-col items-center justify-center gap-6 ${b?``:`bg-black/40`} p-4`,C=`text-5xl font-bold tabular-nums ${x}`,w;t[5]!==C||t[6]!==r?(w=(0,p.jsx)(`span`,{className:C,children:r}),t[5]=C,t[6]=r,t[7]=w):w=t[7];let T=`text-sm uppercase tracking-widest opacity-50 ${b?`invisible`:``}`,E;t[8]===T?E=t[9]:(E=(0,p.jsx)(`span`,{className:T,children:`Frames per second`}),t[8]=T,t[9]=E);let D;t[10]!==w||t[11]!==E?(D=(0,p.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[w,E]}),t[10]=w,t[11]=E,t[12]=D):D=t[12];let O=`flex gap-3 ${b?`invisible`:``}`,k;t[13]===a?k=t[14]:(k=(0,p.jsxs)(`button`,{type:`button`,onClick:m,className:`rounded-md bg-white/10 px-4 py-2 text-sm hover:bg-white/20`,children:[`Target: `,a,` FPS`]}),t[13]=a,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,p.jsx)(`button`,{type:`button`,onClick:y,className:`rounded-md bg-white/10 px-4 py-2 text-sm hover:bg-white/20`,children:`Reset`}),t[15]=A):A=t[15];let j;t[16]!==O||t[17]!==k?(j=(0,p.jsxs)(`div`,{className:O,children:[k,A]}),t[16]=O,t[17]=k,t[18]=j):j=t[18];let M;return t[19]!==S||t[20]!==D||t[21]!==j?(M=(0,p.jsxs)(`div`,{className:S,children:[D,j]}),t[19]=S,t[20]=D,t[21]=j,t[22]=M):M=t[22],M},y=()=>{let e=(0,d.c)(14),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={from:a.widget.apps.byId.id},e[0]=t):t=e[0];let{appId:n}=r(t),i=n===m,f;e[1]!==i||e[2]!==n?(f=i?{title:`Frame Counter`,bg:`#000`,accent:`#4ade80`,tagline:`FPS monitor`,body:``}:l[n]??{title:n,bg:`#1a1a2e`,accent:`#e0e0e0`,tagline:`Unknown app`,body:`<div style="display:flex;align-items:center;justify-content:center;height:100vh;background:#1a1a2e;color:#e0e0e0"><div style="text-align:center"><div style="font-size:1.5rem;font-weight:700">Unknown</div><div style="font-size:.875rem;opacity:.6;margin-top:4px">Unknown app</div></div></div>`},e[1]=i,e[2]=n,e[3]=f):f=e[3];let h=f,g,_;e[4]===i?_=e[5]:(_=i?`📊`:(0,p.jsx)(o,{}),e[4]=i,e[5]=_);let y;e[6]!==h.title||e[7]!==_?(y={title:h.title,icon:_},e[6]=h.title,e[7]=_,e[8]=y):y=e[8],g=y,c(g);let{visibility:b}=s();if(b===`hidden`)return null;if(i){let t;return e[9]===b?t=e[10]:(t=(0,p.jsx)(v,{visibility:b}),e[9]=b,e[10]=t),t}let x=`<!DOCTYPE html>\n<html>\n<head><style>${u}</style></head>\n<body>${h.body}</body>\n</html>`,S=`App: ${n}`,C;return e[11]!==x||e[12]!==S?(C=(0,p.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:(0,p.jsx)(`iframe`,{srcDoc:x,className:`h-full w-full border-none`,title:S,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,allow:``})}),e[11]=x,e[12]=S,e[13]=C):C=e[13],C};export{y as App};