PageSourceSearch

https://adhocstudio.com/_nuxt/KlyASBGP.js

js adhocstudio.com collected 2026-10-09 21:41:59 UTC 8,610 bytes, 1 lines download raw bytes

1import{l as r,aO as W,z as s,u as fe,H as xe,o as Se,M as re,L as be,m as w,d as g,f as u,g as p,D as _,F as $,B as N,i as se,E as le}from"./5hkCUdGJ.js";const c={HIGH:"high",MEDIUM:"medium",LOW:"low"},ke=c.HIGH,ve=5,Ee=6,Te=3,Ce=8,Re=4,Pe=8,We=4,De=9e6,Ae=14e6,ie=60,ce=120,Oe=3,Fe=45,Y={[c.HIGH]:{backdropBlur:!0,maxBlurRadius:48,dropShadow:!0,parallax:!0,videoParallax:!0,alphaVideo:!0,splitChars:!0,liveSvgFilters:!0,webgl:!0,maxDpr:2,maxConcurrentVideos:3},[c.MEDIUM]:{backdropBlur:!1,maxBlurRadius:24,dropShadow:!0,parallax:!0,videoParallax:!0,alphaVideo:!1,splitChars:!1,liveSvgFilters:!1,webgl:!0,maxDpr:1.5,maxConcurrentVideos:1},[c.LOW]:{backdropBlur:!1,maxBlurRadius:0,dropShadow:!1,parallax:!1,videoParallax:!1,alphaVideo:!1,splitChars:!1,liveSvgFilters:!1,webgl:!1,maxDpr:1,maxConcurrentVideos:0}},d=s(ke),q=s(ve),S=s(!1),pe=s(!1),me=s({});let z=!1,K=null;function He(){const e=window.navigator||{},t=e.connection||e.mozConnection||e.webkitConnection||null,m=window.devicePixelRatio||1,M=window.screen?.width||window.innerWidth,y=window.screen?.height||window.innerHeight;return{cores:typeof e.hardwareConcurrency=="number"?e.hardwareConcurrency:null,memory:typeof e.deviceMemory=="number"?e.deviceMemory:null,dpr:m,rasterPixels:Math.round(M*y*m*m),effectiveType:t?.effectiveType||null,saveData:!!t?.saveData,isWebkit:/^((?!chrome|android|crios|fxios).)*safari/i.test(e.userAgent||""),isTouch:(e.maxTouchPoints||0)>0,reducedMotion:window.matchMedia("(prefers-reduced-motion: reduce)").matches,webgl:Ie()}}function Ie(){try{const e=document.createElement("canvas"),t=e.getContext("webgl2")||e.getContext("webgl");return t?(t.getExtension("WEBGL_lose_context")?.loseContext(),!0):!1}catch{return!1}}function Le(e){let t=ve;return e.cores!==null&&(e.cores>=Ce?t+=2:e.cores<=Re&&(t-=2)),e.memory!==null&&(e.memory>=Pe?t+=1:e.memory<=We&&(t-=2)),e.rasterPixels>=Ae?t-=2:e.rasterPixels>=De&&(t-=1),e.saveData&&(t-=3),e.effectiveType==="2g"||e.effectiveType==="slow-2g"?t-=3:e.effectiveType==="3g"&&(t-=1),e.webgl||(t-=3),e.isTouch&&(t-=1),e.isWebkit&&(t-=1),t}function Be(e){return e>=Ee?c.HIGH:e>=Te?c.MEDIUM:c.LOW}function Ge(){if(d.value===c.LOW)return null;let e=0,t=0,m=0,M=!1;const y=()=>{if(M)return;if(e+=1,e<=ie){m=performance.now();return}if((e-ie)%ce!==0)return;const l=performance.now(),x=ce*1e3/(l-m);if(m=l,t+=1,x<Fe){Ve(),b();return}t>=Oe&&b()};let E=()=>{};try{const{$gsap:l}=fe();if(l?.ticker)l.ticker.add(y),E=()=>l.ticker.remove(y);else throw new Error("no gsap ticker")}catch{let l=0;const x=()=>{y(),l=requestAnimationFrame(x)};l=requestAnimationFrame(x),E=()=>cancelAnimationFrame(l)}function b(){M||(M=!0,E())}return b}function Ve(e){const t=d.value===c.HIGH?c.MEDIUM:(d.value===c.MEDIUM,c.LOW);t!==d.value&&(d.value=t,D())}function D(){const e=document.documentElement,t=Y[d.value];e.dataset.perfTier=d.value,e.dataset.reducedMotion=S.value?"true":"false",e.style.setProperty("--perf-blur",`${t.maxBlurRadius}px`),e.style.setProperty("--perf-backdrop-blur",t.backdropBlur?`${t.maxBlurRadius}px`:"0px"),e.style.setProperty("--perf-shadow-opacity",t.dropShadow?"1":"0")}function $e(){if(z)return;z=!0;let e;try{e=He()}catch{D();return}me.value=e,S.value=e.reducedMotion,pe.value=e.saveData,q.value=Le(e),d.value=Be(q.value),D(),window.matchMedia("(prefers-reduced-motion: reduce)").addEventListener?.("change",m=>{S.value=m.matches,D()}),K=Ge()}function Ne(){K?.(),K=null}function Ue(){z||$e();const e=r(()=>Y[d.value]);return{tier:W(d),score:W(q),signals:W(me),isHigh:r(()=>d.value===c.HIGH),isMedium:r(()=>d.value===c.MEDIUM),isLow:r(()=>d.value===c.LOW),reducedMotion:W(S),saveData:W(pe),capabilities:e,canBackdropBlur:r(()=>e.value.backdropBlur),canDropShadow:r(()=>e.value.dropShadow),canLiveSvgFilters:r(()=>e.value.liveSvgFilters),canParallax:r(()=>e.value.parallax&&!S.value),canVideoParallax:r(()=>e.value.videoParallax&&!S.value),canAlphaVideo:r(()=>e.value.alphaVideo),canSplitChars:r(()=>e.value.splitChars&&!S.value),canWebgl:r(()=>e.value.webgl),maxBlurRadius:r(()=>e.value.maxBlurRadius),maxDpr:r(()=>e.value.maxDpr),maxConcurrentVideos:r(()=>e.value.maxConcurrentVideos),setTier(t){Y[t]&&(d.value=t,D())}}}const Ye=["data-tier"],qe=["data-state"],ze={class:"perf-monitor__score"},Ke={key:0,class:"perf-monitor__body"},Xe={class:"perf-monitor__list"},je=["data-state"],Je={class:"perf-monitor__list perf-monitor__list--device"},Qe={key:0,class:"perf-monitor__notice"},Ze={class:"perf-monitor__actions"},et=["onClick"],tt=["disabled"],at=250,ue=96,de=20,U=120,ot=55,nt=40,rt=5,st="p",lt={__name:"PerfTierMonitor",setup(e){const{tier:t,score:m,signals:M,reducedMotion:y,saveData:E,setTier:b}=Ue(),l=s(!1),x=s(null),A=s(null),T=s(null),O=s(0),X=s(0),C=s(null),j=s(0),F=s(0),J=s(0),R=s(0),I=s(null),H=s([]),Q=s(""),Z=r(()=>R.value?Math.round(J.value/R.value*100):0),L=r(()=>O.value>=ot?"good":O.value>=nt?"warn":"bad"),he=r(()=>[["avg",`${X.value}fps`,null],["worst",C.value===null?"—":`${C.value}fps`,null],["last frame",`${j.value}ms`,null],["longest",`${F.value}ms`,F.value>de*2?"bad":null],["dropped",`${Z.value}%`,Z.value>
1rt?"bad":"good"],["frames",R.value,null]]),_e=r(()=>{const a=M.value||{},o=[["cores",a.cores??"n/a"],["memory",a.memory?`${a.memory}GB`:"n/a"],["dpr",a.dpr??"n/a"],["viewport",Q.value],["raster px",a.rasterPixels?`${(a.rasterPixels/1e6).toFixed(1)}M`:"n/a"],["network",a.effectiveType??"n/a"],["webgl",a.webgl?"yes":"no"],["touch",a.isTouch?"yes":"no"],["webkit",a.isWebkit?"yes":"no"],["save-data",E.value?"on":"off"],["reduced-motion",y.value?"on":"off"]];return I.value!==null&&o.push(["js heap",`${I.value}MB`]),o});let B=()=>{};function we(){let a=0,o=performance.now(),n=o;const f=o,v=()=>{const i=performance.now(),h=i-n;n=i,a+=1,R.value+=1,h>de&&(J.value+=1),h>F.value&&(F.value=Math.round(h));const P=i-o;if(P<at)return;const k=a*1e3/P;O.value=Math.round(k),j.value=Math.round(P/a),X.value=Math.round(R.value*1e3/(i-f)),(C.value===null||k<C.value)&&(C.value=Math.round(k)),performance.memory&&(I.value=Math.round(performance.memory.usedJSHeapSize/1048576)),H.value.push(Math.min(k,U)),H.value.length>ue&&H.value.shift(),G(),a=0,o=i};try{const{$gsap:i}=fe();if(!i?.ticker)throw new Error("no gsap ticker");i.ticker.add(v),B=()=>i.ticker.remove(v)}catch{let i=0;const h=()=>{v(),i=requestAnimationFrame(h)};i=requestAnimationFrame(h),B=()=>cancelAnimationFrame(i)}}function G(){const a=x.value;if(!a||l.value)return;const o=a.getContext("2d");if(!o)return;const n=Math.min(window.devicePixelRatio||1,2),f=a.clientWidth,v=a.clientHeight;if(!f||!v)return;a.width!==Math.round(f*n)&&(a.width=Math.round(f*n),a.height=Math.round(v*n)),o.setTransform(n,0,0,n,0,0),o.clearRect(0,0,f,v),o.strokeStyle="rgba(255,255,255,0.18)",o.lineWidth=1;const i=v-60/U*v;o.beginPath(),o.moveTo(0,i),o.lineTo(f,i),o.stroke();const h=H.value;if(h.length<2)return;const P=f/(ue-1);o.beginPath(),h.forEach((k,ae)=>{const oe=ae*P,ne=v-k/U*v;ae===0?o.moveTo(oe,ne):o.lineTo(oe,ne)}
1),o.strokeStyle=L.value==="good"?"#4ade80":L.value==="warn"?"#fbbf24":"#f87171",o.lineWidth=1.5,o.stroke()}function ee(){l.value=!l.value,l.value||re(G)}function ge(a){Ne(),T.value=a,b(a)}function Me(){T.value=null,A.value&&b(A.value)}function te(){Q.value=`${window.innerWidth}×${window.innerHeight}`}function ye(a){a.altKey&&a.key.toLowerCase()===st&&(a.preventDefault(),ee())}const V=new AbortController;return Se(()=>{A.value=t.value,te(),we(),window.addEventListener("keydown",ye,{signal:V.signal}),window.addEventListener("resize",te,{signal:V.signal,passive:!0}),re(G)}),be(()=>{B(),V.abort()}),(a,o)=>(w(),g("aside",{class:le(["perf-monitor",{"is-collapsed":p(l)}])},[u("button",{class:"perf-monitor__bar",type:"button",onClick:ee},[u("span",{class:"perf-monitor__tier","data-tier":p(t)},_(p(t)),9,Ye),u("span",{class:"perf-monitor__fps","data-state":p(L)},_(p(O))+"fps",9,qe),u("span",ze,"score "+_(p(m)),1)]),p(l)?se("",!0):(w(),g("div",Ke,[u("canvas",{ref_key:"sparkline",ref:x,class:"perf-monitor__spark"},null,512),u("dl",Xe,[(w(!0),g($,null,N(p(he),([n,f,v])=>(w(),g("div",{key:n},[u("dt",null,_(n),1),u("dd",{"data-state":v},_(f),9,je)]))),128))]),u("dl",Je,[(w(!0),g($,null,N(p(_e),([n,f])=>(w(),g("div",{key:n},[u("dt",null,_(n),1),u("dd",null,_(f),1)]))),128))]),p(T)?(w(),g("p",Qe," forced — measured tier was “"+_(p(A))+"” ",1)):se("",!0),u("div",Ze,[(w(),g($,null,N(["high","medium","low"],n=>u("button",{key:n,type:"button",class:le({"is-active":p(T)===n}),onClick:f=>ge(n)},_(n.slice(0,3)),11,et)),64)),u("button",{type:"button",disabled:!p(T),onClick:Me}," auto ",8,tt)])]))],2))}},ct=xe(lt,[["__scopeId","data-v-f63d0b0f"]]);export{ct as default};

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.