@buoy-gg/js-top 7.0.39 → 7.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/lib/commonjs/index.js +4 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +4 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/web/index.mjs +3 -0
- package/package.json +39 -5
package/README.md
CHANGED
|
@@ -80,3 +80,7 @@ Use a Free or Pro Buoy account. History limits and paid features vary by tool; s
|
|
|
80
80
|
## License
|
|
81
81
|
|
|
82
82
|
Part of [React Buoy](https://buoy.gg). See buoy.gg for licensing.
|
|
83
|
+
|
|
84
|
+
## Web support (unreleased)
|
|
85
|
+
|
|
86
|
+
Register this package’s /web namespace in FloatingDevTools modules to use its shared panels and actions in a browser app. The browser build is available in this checkout and has not been published yet. See the [web setup guide](https://buoy.gg/buoy/latest/docs/web-preview) for registration, dependencies, and browser boundaries.
|
package/lib/commonjs/index.js
CHANGED
|
@@ -89,8 +89,10 @@ _JsTopController.JsTopController.registerClearHook(_longtasks.clearLongtasks);
|
|
|
89
89
|
// engine is off. (Promise/bridge patches are more invasive and stay lazy —
|
|
90
90
|
// they install on first engine start and cover work scheduled after it.)
|
|
91
91
|
try {
|
|
92
|
-
(
|
|
93
|
-
|
|
92
|
+
if (typeof window !== "undefined") {
|
|
93
|
+
(0, _timers.installTimerPatches)();
|
|
94
|
+
(0, _microtasks.installMicrotaskPatches)();
|
|
95
|
+
}
|
|
94
96
|
} catch {
|
|
95
97
|
// Never let instrumentation break an app at import time.
|
|
96
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_JsTopController","require","_promises","_bridge","_timers","_microtasks","_longtasks","_jsTopSyncAdapter","_JsTopModal","_JsTopHudOverlay","_preset","JsTopController","registerTierInstaller","installPromisePatches","installBridgePatch","installLongtaskObserver","registerLongtaskProvider","getLongtasks","registerFreezeStatsProvider","getFreezeStats","registerClearHook","clearLongtasks","installTimerPatches","installMicrotaskPatches"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;
|
|
1
|
+
{"version":3,"names":["_JsTopController","require","_promises","_bridge","_timers","_microtasks","_longtasks","_jsTopSyncAdapter","_JsTopModal","_JsTopHudOverlay","_preset","JsTopController","registerTierInstaller","installPromisePatches","installBridgePatch","installLongtaskObserver","registerLongtaskProvider","getLongtasks","registerFreezeStatsProvider","getFreezeStats","registerClearHook","clearLongtasks","window","installTimerPatches","installMicrotaskPatches"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AA8BA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAKA,IAAAQ,gBAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcAU,gCAAe,CAACC,qBAAqB,CAACC,+BAAqB,CAAC;AAC5DF,gCAAe,CAACC,qBAAqB,CAACE,0BAAkB,CAAC;AACzDH,gCAAe,CAACC,qBAAqB,CAACG,kCAAuB,CAAC;AAC9DJ,gCAAe,CAACK,wBAAwB,CAACC,uBAAY,CAAC;AACtDN,gCAAe,CAACO,2BAA2B,CAACC,yBAAc,CAAC;AAC3DR,gCAAe,CAACS,iBAAiB,CAACC,yBAAc,CAAC;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;EACF,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IACnC,IAAAC,2BAAmB,EAAC,CAAC;IACrB,IAAAC,mCAAuB,EAAC,CAAC;EACzB;AACF,CAAC,CAAC,MAAM;EACN;AAAA","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -34,8 +34,10 @@ JsTopController.registerClearHook(clearLongtasks);
|
|
|
34
34
|
// engine is off. (Promise/bridge patches are more invasive and stay lazy —
|
|
35
35
|
// they install on first engine start and cover work scheduled after it.)
|
|
36
36
|
try {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
if (typeof window !== "undefined") {
|
|
38
|
+
installTimerPatches();
|
|
39
|
+
installMicrotaskPatches();
|
|
40
|
+
}
|
|
39
41
|
} catch {
|
|
40
42
|
// Never let instrumentation break an app at import time.
|
|
41
43
|
}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["JsTopController","installPromisePatches","installBridgePatch","installTimerPatches","installMicrotaskPatches","clearLongtasks","getFreezeStats","getLongtasks","installLongtaskObserver","registerTierInstaller","registerLongtaskProvider","registerFreezeStatsProvider","registerClearHook","jsTopSyncAdapter","JsTopModal","JsTopHudOverlay","jsTopPreset","jsTopModalPreset","JS_TOP_ENABLED_COLOR","JS_TOP_DISABLED_COLOR"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,eAAe,QAAQ,iCAAiC;AACjE,SAASC,qBAAqB,QAAQ,kCAAkC;AACxE,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,mBAAmB,QAAQ,gCAAgC;AACpE,SAASC,uBAAuB,QAAQ,oCAAoC;AAC5E,SACEC,cAAc,EACdC,cAAc,EACdC,YAAY,EACZC,uBAAuB,QAClB,2BAA2B;AAElCR,eAAe,CAACS,qBAAqB,CAACR,qBAAqB,CAAC;AAC5DD,eAAe,CAACS,qBAAqB,CAACP,kBAAkB,CAAC;AACzDF,eAAe,CAACS,qBAAqB,CAACD,uBAAuB,CAAC;AAC9DR,eAAe,CAACU,wBAAwB,CAACH,YAAY,CAAC;AACtDP,eAAe,CAACW,2BAA2B,CAACL,cAAc,CAAC;AAC3DN,eAAe,CAACY,iBAAiB,CAACP,cAAc,CAAC;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;
|
|
1
|
+
{"version":3,"names":["JsTopController","installPromisePatches","installBridgePatch","installTimerPatches","installMicrotaskPatches","clearLongtasks","getFreezeStats","getLongtasks","installLongtaskObserver","registerTierInstaller","registerLongtaskProvider","registerFreezeStatsProvider","registerClearHook","window","jsTopSyncAdapter","JsTopModal","JsTopHudOverlay","jsTopPreset","jsTopModalPreset","JS_TOP_ENABLED_COLOR","JS_TOP_DISABLED_COLOR"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,eAAe,QAAQ,iCAAiC;AACjE,SAASC,qBAAqB,QAAQ,kCAAkC;AACxE,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,mBAAmB,QAAQ,gCAAgC;AACpE,SAASC,uBAAuB,QAAQ,oCAAoC;AAC5E,SACEC,cAAc,EACdC,cAAc,EACdC,YAAY,EACZC,uBAAuB,QAClB,2BAA2B;AAElCR,eAAe,CAACS,qBAAqB,CAACR,qBAAqB,CAAC;AAC5DD,eAAe,CAACS,qBAAqB,CAACP,kBAAkB,CAAC;AACzDF,eAAe,CAACS,qBAAqB,CAACD,uBAAuB,CAAC;AAC9DR,eAAe,CAACU,wBAAwB,CAACH,YAAY,CAAC;AACtDP,eAAe,CAACW,2BAA2B,CAACL,cAAc,CAAC;AAC3DN,eAAe,CAACY,iBAAiB,CAACP,cAAc,CAAC;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;EACF,IAAI,OAAOQ,MAAM,KAAK,WAAW,EAAE;IACnCV,mBAAmB,CAAC,CAAC;IACrBC,uBAAuB,CAAC,CAAC;EACzB;AACF,CAAC,CAAC,MAAM;EACN;AAAA;AAGF,SAASJ,eAAe,QAAQ,iCAAiC;AACjE,SAASc,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,UAAU,QAAQ,gCAAgC;AAK3D,SAASC,eAAe,QAAQ,qCAAqC;AACrE,SACEC,WAAW,EACXC,gBAAgB,EAChBC,oBAAoB,EACpBC,qBAAqB,QAChB,UAAU","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAoCH,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,YAAY,EACV,eAAe,EACf,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,aAAa,EACb,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,OAAO,GACR,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var nt=Object.defineProperty;var ro=Object.getOwnPropertyDescriptor;var no=Object.getOwnPropertyNames;var io=Object.prototype.hasOwnProperty;var so=(e,t)=>{for(var o in t)nt(e,o,{get:t[o],enumerable:!0})},rt=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of no(t))!io.call(e,n)&&n!==o&&nt(e,n,{get:()=>t[n],enumerable:!(r=ro(t,n))||r.enumerable});return e},M=(e,t,o)=>(rt(e,t,"default"),o&&rt(o,t,"default"));var f=process.env.NODE_ENV!=="production";typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);var b={};so(b,{AccessibilityInfo:()=>wo,ActivityIndicator:()=>go,Alert:()=>To,Animated:()=>Mo,AppRegistry:()=>ko,AppState:()=>Ae,Appearance:()=>vo,BackHandler:()=>Ao,Button:()=>ho,CheckBox:()=>No,Clipboard:()=>Oo,DeviceEventEmitter:()=>nr,Dimensions:()=>Ro,Easing:()=>Co,FlatList:()=>Ho,I18nManager:()=>Eo,Image:()=>$o,ImageBackground:()=>Ko,InteractionManager:()=>Io,Keyboard:()=>Po,KeyboardAvoidingView:()=>jo,LayoutAnimation:()=>zo,Linking:()=>Jo,LogBox:()=>rr,Modal:()=>fo,NativeEventEmitter:()=>Fo,NativeModules:()=>xo,PanResponder:()=>Bo,Picker:()=>Uo,PixelRatio:()=>Wo,Platform:()=>Lo,Pressable:()=>mo,ProgressBar:()=>qo,RefreshControl:()=>Go,SafeAreaView:()=>Yo,ScrollView:()=>ie,SectionList:()=>Qo,Share:()=>_o,StatusBar:()=>Xo,StyleSheet:()=>I,Switch:()=>bo,Text:()=>u,TextInput:()=>co,Touchable:()=>Zo,TouchableHighlight:()=>uo,TouchableNativeFeedback:()=>er,TouchableOpacity:()=>G,TouchableWithoutFeedback:()=>po,UIManager:()=>Vo,Vibration:()=>Do,View:()=>m,VirtualizedList:()=>tr,YellowBox:()=>or,findNodeHandle:()=>yo,unstable_createElement:()=>So,useColorScheme:()=>ir,useLocaleContext:()=>sr,useWindowDimensions:()=>ar});M(b,yn);import*as yn from"react-native-web";import{unstable_createElement as So,NativeModules as xo,AccessibilityInfo as wo,Animated as Mo,Appearance as vo,AppRegistry as ko,AppState as Ae,BackHandler as Ao,Clipboard as Oo,Dimensions as Ro,Easing as Co,I18nManager as Eo,Keyboard as Po,InteractionManager as Io,LayoutAnimation as zo,Linking as Jo,NativeEventEmitter as Fo,PanResponder as Bo,PixelRatio as Wo,Platform as Lo,Share as _o,StyleSheet as I,UIManager as Vo,Vibration as Do,CheckBox as No,FlatList as Ho,Image as $o,ImageBackground as Ko,KeyboardAvoidingView as jo,Picker as Uo,ProgressBar as qo,RefreshControl as Go,SafeAreaView as Yo,SectionList as Qo,StatusBar as Xo,Touchable as Zo,TouchableNativeFeedback as er,VirtualizedList as tr,YellowBox as or,LogBox as rr,DeviceEventEmitter as nr,useColorScheme as ir,useLocaleContext as sr,useWindowDimensions as ar}from"react-native-web";import*as g from"react-native-web";import{createElement as ao,forwardRef as lo}from"react";function F(e){let t=lo((r,n)=>{let{accessibilityState:i,accessibilityValue:s,...a}=r;for(let l of["busy","checked","disabled","expanded","selected"])i?.[l]!==void 0&&a[`aria-${l}`]===void 0&&(a[`aria-${l}`]=i[l]);for(let[l,c]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))s?.[l]!==void 0&&a[`aria-${c}`]===void 0&&(a[`aria-${c}`]=s[l]);return ao(e,{...a,ref:n})}),o=e.State;return o&&Object.assign(t,{State:o}),t.displayName=e.displayName??e.name??"NativeWebView",t}var m=F(g.View),u=F(g.Text),co=F(g.TextInput),G=F(g.TouchableOpacity),uo=F(g.TouchableHighlight),po=F(g.TouchableWithoutFeedback),mo=F(g.Pressable),ie=F(g.ScrollView),fo=F(g.Modal),bo=F(g.Switch),go=F(g.ActivityIndicator),ho=F(g.Button),yo=g.findNodeHandle,To={alert(e,t,o,r){if(typeof document>"u")return;let n=document.createElement("dialog");n.dataset.buoyRoot="",n.setAttribute("aria-label",e),n.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let i=document.createElement("h2");if(i.textContent=e,i.style.cssText="font-size:18px;margin:0 0 12px",n.appendChild(i),t){let c=document.createElement("p");c.textContent=t,c.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",n.appendChild(c)}let s=document.createElement("div");s.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let a=o?.length?o:[{text:"OK"}],l=()=>{n.close?.(),n.remove()};for(let c of a){let T=document.createElement("button");T.type="button",T.textContent=c.text??"OK",T.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${c.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,T.onclick=()=>{l(),c.onPress?.()},s.appendChild(T)}n.addEventListener("cancel",c=>{c.preventDefault(),r?.cancelable!==!1&&(l(),r?.onDismiss?.())}),n.appendChild(s),document.body.appendChild(n),n.showModal?n.showModal():n.setAttribute("open","")}};var be=typeof globalThis<"u"?globalThis:void 0,lr=(()=>{if(typeof be?.nativePerformanceNow=="function"){let e=be.nativePerformanceNow;return()=>e()}if(typeof be?.performance?.now=="function"){let e=be.performance;return()=>e.now()}return()=>Date.now()})(),cr=lr;function B(){return cr()}var d=typeof globalThis<"u"?globalThis:{},it=!1;function L(){return it}function se(e){it=e}var Oe=null;function ae(){return Oe||(Oe={setTimeout:d.setTimeout?.bind(d),setInterval:d.setInterval?.bind(d),clearInterval:d.clearInterval?.bind(d),clearTimeout:d.clearTimeout?.bind(d),setImmediate:d.setImmediate?.bind(d),requestAnimationFrame:d.requestAnimationFrame?.bind(d),queueMicrotask:d.queueMicrotask?.bind(d)}),Oe}function X(){return ae()}var v=Symbol.for("buoy.jsTop.patched"),Re=Symbol.for("buoy.jsTop.wrapped");var Z=new Float64Array(120),le=new Float64Array(120),Ce=new Float64Array(120),ee=new Float64Array(120).fill(-1);function N(e){return Math.floor(e/250)}function ur(e){let t=e%120;return ee[t]!==e&&(ee[t]=e,Z[t]=0,le[t]=0,Ce[t]=0),t}function Ee(e,t,o){if(!(t>e))return;let r=Math.max(e,t-3e4),n=N(r),i=N(t),s=r;for(;n<=i;){let a=(n+1)*250,l=Math.min(t,a),c=l-s;c>0&&o(ur(n),c),s=l,n++}}function st(e,t){Ee(e,t,(o,r)=>{Z[o]=Math.min(250,Z[o]+r)})}function at(e,t,o){let r=t-e;if(!(r>0)||!(o>0))return;let n=Math.min(1,o/r);Ee(e,t,(i,s)=>{le[i]=Math.min(250,le[i]+s*n)})}function lt(e,t){Ee(e,t,(o,r)=>{Ce[o]=Math.min(250,Ce[o]+r)})}function ct(e,t,o){let r=N(t),n=0;for(let i=r-o+1;i<=r;i++){let s=i%120;s>=0&&ee[s]===i&&(n+=e[s])}return n}function Pe(e){return ct(Z,e,20)}function ut(e){return ct(le,e,20)}function pt(e){let t=N(e),o=[];for(let r=t-20+1;r<=t;r++){let n=r%120;n>=0&&ee[n]===r?o.push(Math.max(0,Math.round((Z[n]-le[n])*10)/10)):o.push(0)}return o}function dt(e){let t=N(e),o=[];for(let n=t-120+1;n<=t;n++){let i=n%120;i>=0&&ee[i]===n?o.push(Math.round(Z[i]/250*100)):o.push(0)}let r=0;for(;r<o.length&&o[r]===0;)r++;return o.slice(Math.max(0,Math.min(r,o.length-1)))}function mt(){ee.fill(-1)}var Ie=0;function pr(){return typeof f<"u"&&f}function dr(e){return(e.split("?")[0]??e).split("/").filter(Boolean).slice(-2).join("/")}function mr(e){return/^[A-Z][A-Za-z0-9]*$/.test(e)}function ft(e,t){if(!pr()||e.symbolicated||!e.frames||e.frames.length===0||Ie>=3)return;e.symbolicated=!0;let o=e.frames[0];if(!o||!/^https?:\/\//.test(o.file))return;let r;try{r=`${new URL(o.file).origin}/symbolicate`}catch{return}Ie++;let n=JSON.stringify({stack:e.frames.map(i=>({file:i.file,lineNumber:i.line,column:i.col,methodName:""}))});fetch(r,{method:"POST",body:n}).then(i=>i.ok?i.json():null).then(i=>{let s=i?.stack?.find(W=>W.file&&!W.file.includes("node_modules"))??i?.stack?.[0];if(!s?.file&&i?.error){let W=/found: (\/.+)$/.exec(i.error);W&&(s={file:W[1]})}if(!s?.file)return;let a=dr(s.file),l=s.lineNumber,c=s.methodName&&s.methodName!=="<unknown>"?s.methodName:void 0;e.file=a,e.line=l??e.line;let T=`${a.split("/").pop()}${l!=null?`:${l}`:""}`;c&&mr(c)&&!e.caller?(e.caller=c,e.label=`${e.label} \u2190 <${c}> \xB7 ${T}`):e.label=`${e.label} \xB7 ${T}`}).catch(()=>{}).finally(()=>{Ie--})}var gr=500,hr=20,R=new Map,bt="other",gt=0,ze=0;function Fe(e,t,o){return{key:e,api:t,label:o,calls:0,totalMs:0,maxMs:0,scheduleCount:0,lastSeenAt:0,promoted:!1,lastCaptureAt:0,ring:new Float64Array(20),ringStamps:new Float64Array(20).fill(-1)}}function yt(e,t){let o=N(t),r=0;for(let n=o-20+1;n<=o;n++){let i=n%20;i>=0&&e.ringStamps[i]===n&&(r+=e.ring[i])}return r}function ht(e){let t=null,o=1/0;for(let n of R.values()){if(n.key===bt)continue;let i=yt(n,e)*1e6+n.lastSeenAt;i<o&&(o=i,t=n)}if(!t)return;let r=yr(bt,"other","other (evicted origins)");r.calls+=t.calls,r.totalMs+=t.totalMs,r.maxMs=Math.max(r.maxMs,t.maxMs),r.lastSeenAt=Math.max(r.lastSeenAt,t.lastSeenAt),R.delete(t.key)}function yr(e,t,o){let r=R.get(e);return r||(r=Fe(e,t,o),R.set(e,r)),r}function Tr(e){let t=[],o,r=e.split(`
|
|
3
|
+
`);for(let n of r){let i=/at\s+(.*?)\s+\((?:address at\s+)?(.*?):(\d+):(\d+)\)/.exec(n)??/at\s+()(.*?):(\d+):(\d+)$/.exec(n.trim());if(!i)continue;let s=i[1]??"";if(s.includes("buoyJsTop")||s==="Error"||i[2]?.includes("/js-top/"))continue;t.push({file:i[2]??"",line:Number(i[3]),col:Number(i[4])});let a=/^(react_stack_bottom_frame|runWithFiberInDEV|commitHookEffectList|flushPassive|performWork|renderWithHooks|safelyCall)/.test(s)||/^(then|catch|finally|resolve|reject|fulfilled|rejected|step|tryCallOne|tryCallTwo|tryCatch|invokeCallback|notify)$/.test(s);if(!o&&s&&s!=="anonymous"&&!a&&(o=s),t.length>=3)break}return{caller:o,frames:t}}function Sr(e,t){return t-e.lastCaptureAt<gr||(t-gt>1e3&&(gt=t,ze=0),ze>=hr)?!1:(ze++,e.lastCaptureAt=t,!0)}function Je(e){if(!e)return;let t=(e.split("?")[0]??e).replace(/\/\/&.*$/,""),o=/^[a-z]+:\/\/[^/]+\/(.*)$/.exec(t);return(o?o[1]:t).split("/").slice(-2).join("/")}function Tt(e){return R.has(e)}function ge(e,t,o,r=!0){let n=t,i=typeof n.displayName=="string"&&n.displayName||typeof n.name=="string"&&n.name||"anonymous",s=`${e}|${i}`,a=R.get(s);if(a||(R.size>=500&&ht(o),a=Fe(s,e,i==="anonymous"?ce(e):`${ce(e)} ${i}`),R.set(s,a)),a.scheduleCount++,!a.promoted&&(a.scheduleCount>=25||a.totalMs>=50)&&(a.promoted=!0),(a.promoted||e==="interval")&&r&&Sr(a,o)){let{caller:l,frames:c}=Tr(new Error().stack??""),T=c[0];if(T||l){let W=T?`${Je(T.file)??"?"}:${T.line}`:"?",y=`${s}@${l??"?"}:${W}`,x=R.get(y);if(!x){R.size>=500&&ht(o);let E=i==="anonymous"?ce(e):`${ce(e)} ${i}`;x=Fe(y,e,l?`${E} \u2190 ${l}`:i==="anonymous"?`${E} @ ${Je(T?.file??"")??"?"}`:E),x.caller=l,x.file=T?Je(T.file):void 0,x.line=T?.line,x.frames=c,x.promoted=!0,x.calls=a.calls,x.totalMs=a.totalMs,x.maxMs=a.maxMs,x.scheduleCount=a.scheduleCount,x.lastSeenAt=a.lastSeenAt,x.ring.set(a.ring),x.ringStamps.set(a.ringStamps),a.calls=0,a.totalMs=0,a.maxMs=0,a.ring.fill(0),a.ringStamps.fill(-1),R.set(y,x),ft(x,ce(e))}a.activeRefinedKey=y}}return a.activeRefinedKey??s}function ce(e){switch(e){case"timeout":return"setTimeout";case"interval":return"setInterval";case"immediate":return"setImmediate";case"raf":return"requestAnimationFrame";case"microtask":return"queueMicrotask";case"then":return"Promise.then";case"bridge":return"bridge";default:return e}}function St(e,t,o,r){let n=R.get(e);if(!n)return;n.calls++,n.totalMs+=t,t>n.maxMs&&(n.maxMs=t),n.lastSeenAt=r,!n.promoted&&n.totalMs>=50&&(n.promoted=!0);let i=r-o,s=i>0?Math.min(1,t/i):1,a=Math.max(o,r-5e3),l=N(a),c=N(r),T=a;for(;l<=c;){let W=(l+1)*250,y=Math.min(r,W),x=y-T;if(x>0){let E=l%20;E>=0&&(n.ringStamps[E]!==l&&(n.ringStamps[E]=l,n.ring[E]=0),n.ring[E]+=i>0?x*s:t)}T=y,l++}at(o,r,t)}function xt(e){return R.get(e)?.label??null}function wt(e,t,o){let r=[];for(let s of R.values()){let a=yt(s,e);a<=0&&s.totalMs<1||r.push({key:s.key,label:s.label,api:s.api,file:s.file,line:s.line,windowMs:Math.round(a*10)/10,pctOfBusy:t>0?Math.min(100,Math.round(a/t*1e3)/10):0,totalMs:Math.round(s.totalMs*10)/10,calls:s.calls,avgMs:s.calls>0?Math.round(s.totalMs/s.calls*100)/100:0,maxMs:Math.round(s.maxMs*100)/100,lastSeenAgoMs:s.lastSeenAt>0?Math.max(0,e-s.lastSeenAt):0,freezes:0,worstFreezeMs:0})}r.sort((s,a)=>a.windowMs-s.windowMs||a.totalMs-s.totalMs);let n=[],i=[];for(let s of r)(s.windowMs>=1||s.pctOfBusy>=.5||s.freezes>0?n:i).push(s);return i.length>=2?(n.push({key:"minor",label:`${i.length} minor origins (\u22641ms each)`,api:"other",windowMs:Math.round(i.reduce((s,a)=>s+a.windowMs,0)*10)/10,pctOfBusy:Math.round(i.reduce((s,a)=>s+a.pctOfBusy,0)*10)/10,totalMs:Math.round(i.reduce((s,a)=>s+a.totalMs,0)*10)/10,calls:i.reduce((s,a)=>s+a.calls,0),avgMs:0,maxMs:Math.max(0,...i.map(s=>s.maxMs)),lastSeenAgoMs:Math.min(...i.map(s=>s.lastSeenAgoMs)),freezes:0,worstFreezeMs:0}),n.slice(0,o)):r.slice(0,o)}function Mt(e,t,o){let r=R.get(e);if(!r)return null;let n=N(t),i=[],s=0;for(let a=n-20+1;a<=n;a++){let l=a%20,c=l>=0&&r.ringStamps[l]===a?Math.round(r.ring[l]*10)/10:0;i.push(c),s+=c}return{key:r.key,label:r.label,api:r.api,caller:r.caller,file:r.file,line:r.line,frames:r.frames,promoted:r.promoted,scheduleCount:r.scheduleCount,calls:r.calls,totalMs:Math.round(r.totalMs*10)/10,avgMs:r.calls>0?Math.round(r.totalMs/r.calls*100)/100:0,maxMs:Math.round(r.maxMs*100)/100,windowMs:Math.round(s*10)/10,pctOfBusy:o>0?Math.min(100,Math.round(s/o*1e3)/10):0,lastSeenAgoMs:r.lastSeenAt>0?Math.max(0,t-r.lastSeenAt):0,buckets:i}}function vt(){R.clear()}var xr=32,te=[],wr=20,kt=64,At=new Array(kt).fill(null),Be=0;function Ot(){return At}function Rt(e,t){let o=B(),r=te.length>0?te[te.length-1]:null,n=null;te.length<xr&&(n={originKey:e,start:o,childrenMs:0},te.push(n));try{return t()}finally{try{if(n){te.pop();let i=B(),s=i-o,a=Math.max(0,s-n.childrenMs);r&&(r.childrenMs+=s),St(e,a,o,i),!r&&s>=wr&&(At[Be]={originKey:e,start:o,end:i},Be=(Be+1)%kt)}}catch{}}}function $(e,t){if(typeof e!="function"||e[Re])return e;let o=L()?ge(t,e,B()):null,r=function(...n){return L()?((o===null||!Tt(o))&&(o=ge(t,e,B(),!1)),Rt(o,()=>e.apply(this,n))):e.apply(this,n)};return r[Re]=!0,r}function We(e,t,o){if(!L())return o();let r=ge(e,{name:t},B());return Rt(r,o)}function he(){let e=ae();if(typeof d.setTimeout=="function"&&!d.setTimeout[v]){let t=function(o,r,...n){let i=$(o,"timeout");return e.setTimeout(i,r,...n)};t[v]=!0,d.setTimeout=t}if(typeof d.setInterval=="function"&&!d.setInterval[v]){let t=function(o,r,...n){let i=$(o,"interval");return e.setInterval(i,r,...n)};t[v]=!0,d.setInterval=t}if(typeof d.setImmediate=="function"&&!d.setImmediate[v]&&e.setImmediate){let t=function(o,...r){let n=$(o,"immediate");return e.setImmediate(n,...r)};t[v]=!0,d.setImmediate=t}if(typeof d.requestAnimationFrame=="function"&&!d.requestAnimationFrame[v]&&e.requestAnimationFrame){let t=function(o){let r=$(o,"raf");return e.requestAnimationFrame(r)};t[v]=!0,d.requestAnimationFrame=t}}function ye(){let e=ae();if(typeof d.queueMicrotask=="function"&&!d.queueMicrotask[v]&&e.queueMicrotask){let t=function(o){let r=$(o,"microtask");return e.queueMicrotask(r)};t[v]=!0,d.queueMicrotask=t}}var Le=16,Mr=100,vr=3,kr=8,pe=null,de=0,Te=!1,ue=[],oe=1/0,re=0,_e=Le;function Ar(){let e=B(),t=de>0?e-de:0;if(de=e,Te){Te=!1,oe=1/0,re=e;return}if(t<=0)return;t<Mr&&(t<oe&&(oe=t),re===0&&(re=e),e-re>=1e3&&(ue.push(oe),ue.length>vr&&ue.shift(),_e=Math.max(kr,Math.min(...ue)),oe=1/0,re=e));let o=t-_e;o>1&&st(e-o,e)}function Ve(){if(pe!=null)return;let e=X();de=B(),Te=!1,ue=[],oe=1/0,re=0,_e=Le,pe=e.setInterval(Ar,Le)}function De(){pe!=null&&(X().clearInterval(pe),pe=null),de=0}function Ct(){Te=!0}import{definePersistedSetting as Or}from"@buoy-gg/shared-ui/web";var Rr="@react_buoy/js-top/prefs",Cr={enabled:!1},Et=Or(Rr,Cr,{sanitize:e=>({enabled:e.enabled===!0})});async function Pt(){return Et.load()}async function It(e){await Et.save(e)}var Er=250,Ne=class{constructor(){this.enabled=!1;this.enabledLoaded=!1;this.paused=!1;this.remoteSampling=!1;this.engineRunning=!1;this.tiers={timers:!1,promises:!1,bridge:!1,longtask:!1};this.notifyHandle=null;this.appStateSub=null;this.snapshot=this.buildSnapshot();this.subscribers=new Set;this.enabledSubscribers=new Set;this.tierInstallers=[];this.longtaskProvider=null;this.freezeStatsProvider=null;this.clearHooks=[];Pt().then(t=>{this.enabledLoaded=!0,t.enabled&&!this.enabled&&this.setEnabled(!0)})}subscribe(t){return this.subscribers.add(t),this.syncEngineState(),t(this.snapshot),()=>{this.subscribers.delete(t),this.syncEngineState()}}subscribeEnabled(t){return this.enabledSubscribers.add(t),t(this.enabled),()=>{this.enabledSubscribers.delete(t)}}setEnabled(t){this.enabled!==t&&(this.enabled=t,this.enabledLoaded&&It({enabled:t}),this.enabledSubscribers.forEach(o=>{try{o(t)}catch(r){f&&console.error("[js-top] enabled subscriber threw",r)}}),this.syncEngineState())}isEnabled(){return this.enabled}setRemoteSampling(t){this.remoteSampling!==t&&(this.remoteSampling=t,this.syncEngineState())}isRemoteSampling(){return this.remoteSampling}getStatus(){return this.engineRunning?this.paused?"paused":"running":"disabled"}pause(){this.paused||(this.paused=!0,se(!1),De(),this.emitSnapshot())}resume(){this.paused&&(this.paused=!1,this.engineRunning&&(se(!0),Ve()),this.emitSnapshot())}clear(){vt(),mt();for(let t of this.clearHooks)try{t()}catch{}this.emitSnapshot()}registerClearHook(t){this.clearHooks.push(t)}getSnapshot(){return this.snapshot}getOriginDetail(t){let o=B(),r=Pe(o),i=this.freezeStatsProvider?.(Date.now())?.byOrigin[t];if(t==="unattributed"){let a=pt(o),l=Math.round(a.reduce((c,T)=>c+T,0)*10)/10;return{key:t,label:"unattributed (events / React / native call-ins)",api:"unattributed",promoted:!1,scheduleCount:0,calls:0,totalMs:0,avgMs:0,maxMs:0,windowMs:l,pctOfBusy:r>0?Math.min(100,Math.round(l/r*1e3)/10):0,lastSeenAgoMs:0,buckets:a,freezes:i?.count??0,worstFreezeMs:Math.round(i?.maxMs??0)}}let s=Mt(t,o,r);return s?{...s,freezes:i?.count??0,worstFreezeMs:Math.round(i?.maxMs??0)}:null}registerTierInstaller(t){this.tierInstallers.push(t),this.engineRunning&&Object.assign(this.tiers,this.runInstaller(t))}registerLongtaskProvider(t){this.longtaskProvider=t}registerFreezeStatsProvider(t){this.freezeStatsProvider=t}shouldRun(){return this.subscribers.size>0||this.remoteSampling}syncEngineState(){let t=this.shouldRun();t&&!this.engineRunning?this.startEngine():!t&&this.engineRunning&&this.stopEngine()}runInstaller(t){try{return t()}catch(o){return f&&console.error("[js-top] tier installer threw",o),{}}}startEngine(){this.engineRunning=!0,he(),ye(),this.tiers={timers:!0,promises:!1,bridge:!1,longtask:!1};for(let t of this.tierInstallers)Object.assign(this.tiers,this.runInstaller(t));se(!this.paused),this.paused||Ve();try{this.appStateSub=Ae.addEventListener("change",()=>{Ct()})}catch{this.appStateSub=null}this.notifyHandle=X().setInterval(()=>this.emitSnapshot(),Er),this.emitSnapshot()}stopEngine(){if(this.engineRunning=!1,se(!1),De(),this.notifyHandle!=null&&(X().clearInterval(this.notifyHandle),this.notifyHandle=null),this.appStateSub){try{this.appStateSub.remove()}catch{}this.appStateSub=null}}buildSnapshot(){let t=B(),o=Pe(t),r=ut(t),n=Math.max(0,o-r),i=wt(t,o,30);n>=1&&(i.push({key:"unattributed",label:"unattributed (events / React / native call-ins)",api:"unattributed",windowMs:Math.round(n*10)/10,pctOfBusy:o>0?Math.min(100,Math.round(n/o*1e3)/10):0,totalMs:0,calls:0,avgMs:0,maxMs:0,lastSeenAgoMs:0,freezes:0,worstFreezeMs:0}),i.sort((l,c)=>c.windowMs-l.windowMs||c.totalMs-l.totalMs));let s=this.freezeStatsProvider?.(Date.now())??{count:0,worstMs:0,byOrigin:{}};for(let l of i){let c=s.byOrigin[l.key];c&&(l.freezes=c.count,l.worstFreezeMs=Math.round(c.maxMs))}let a=5e3;return{ts:Date.now(),paused:this.paused,busyPct:Math.min(100,Math.round(o/a*1e3)/10),busyHistory:dt(t),tiers:{...this.tiers},rows:i,totals:{attributedWindowMs:Math.round(r*10)/10,unattributedWindowMs:Math.round(n*10)/10,windowMs:a},freezeSummary:{count:s.count,worstMs:Math.round(s.worstMs)},longtasks:this.longtaskProvider?this.longtaskProvider():[]}}emitSnapshot(){this.snapshot=this.buildSnapshot(),this.subscribers.forEach(t=>{try{t(this.snapshot)}catch(o){f&&console.error("[js-top] snapshot subscriber threw",o)}})}isEngineActive(){return L()}},p=new Ne;function He(e,t){let o=e[t];if(typeof o!="function")return!1;if(o[v])return!0;let r=function(...n){for(let i=0;i<n.length;i++)typeof n[i]=="function"&&(n[i]=$(n[i],"then"));return o.apply(this,n)};return r[v]=!0,Object.defineProperty(r,"name",{value:t,configurable:!0}),e[t]=r,!0}function zt(){let e=d.Promise?.prototype;if(!e)return{promises:!1};let t=He(e,"then");return He(e,"catch"),He(e,"finally"),{promises:t}}function Jt(){let e=d.__fbBatchedBridge;if(!e)return{bridge:!1};let t=!1;if(typeof e.callFunctionReturnFlushedQueue=="function"&&!e.callFunctionReturnFlushedQueue[v]){let r=e.callFunctionReturnFlushedQueue.bind(e),n=function(i,s,a){return L()?We("bridge",`${i}.${s}`,()=>r(i,s,a)):r(i,s,a)};n[v]=!0,e.callFunctionReturnFlushedQueue=n,t=!0}if(typeof e.invokeCallbackAndReturnFlushedQueue=="function"&&!e.invokeCallbackAndReturnFlushedQueue[v]){let r=e.invokeCallbackAndReturnFlushedQueue.bind(e),n=function(i,s){return L()?We("bridge","nativeModuleCallback",()=>r(i,s)):r(i,s)};n[v]=!0,e.invokeCallbackAndReturnFlushedQueue=n,t=!0}let o=e.callFunctionReturnFlushedQueue?.[v]===!0;return{bridge:t||o}}var Pr=40,Ir=6e4,zr="unattributed",Ft=!1,Se=!1,ne=[];function Jr(e,t){let o=e+t,r=null,n=0;for(let i of Ot()){if(!i)continue;let s=Math.min(o,i.end)-Math.max(e,i.start);s>n&&(n=s,r=i.originKey)}return r}function Bt(){if(Ft)return{longtask:Se};Ft=!0;let e=d.PerformanceObserver;if(typeof e!="function")return{longtask:!1};try{new e(o=>{if(L())try{for(let r of o.getEntries()){if(r.entryType!=="longtask")continue;let n=r.startTime,i=r.duration;lt(n,n+i),ne.push({start:n,duration:i,at:Date.now(),originKey:Jr(n,i)}),ne.length>Pr&&ne.shift()}}catch{}}).observe({entryTypes:["longtask"]}),Se=!0}catch{Se=!1}return{longtask:Se}}function Wt(){return ne.map(e=>({start:e.start,duration:e.duration,at:e.at,originLabel:e.originKey?xt(e.originKey):null}))}function Lt(e){let t={},o=0,r=0;for(let n of ne){if(n.at>0&&e-n.at>Ir)continue;o++,n.duration>r&&(r=n.duration);let i=n.originKey??zr,s=t[i];s?(s.count++,n.duration>s.maxMs&&(s.maxMs=n.duration)):t[i]={count:1,maxMs:n.duration}}return{count:o,worstMs:r,byOrigin:t}}function _t(){ne.length=0}var Fr={version:1,getSnapshot:()=>({live:p.getSnapshot(),enabled:p.isEnabled()||p.isRemoteSampling()}),subscribe:e=>{let t=p.subscribe(()=>e()),o=p.subscribeEnabled(()=>e());return()=>{t(),o()}},actions:{setEnabled:e=>{let t=e.enabled;p.setRemoteSampling(t)},pause:()=>p.pause(),resume:()=>p.resume(),clear:()=>p.clear(),getOriginDetail:e=>p.getOriginDetail(e.key),sample:async e=>{let t=e,o=Math.min(Math.max(t?.durationMs??3e3,250),3e4),r=p.isRemoteSampling()||p.isEnabled();r||p.setRemoteSampling(!0),t?.clearFirst&&p.clear();try{return await new Promise(n=>setTimeout(n,o)),p.getSnapshot()}finally{r||p.setRemoteSampling(!1)}}}};import{useCallback as qr,useEffect as Gr,useMemo as Yr,useState as qt}from"react";import{Activity as Qr,JsModal as Xr,macOSColors as V,night as P,ModalHeader as fe,Pause as Zr,Play as en,Trash2 as tn}from"@buoy-gg/shared-ui/web";import{memo as Br}from"react";import{macOSColors as $e}from"@buoy-gg/shared-ui/web";import{jsx as Dt}from"react/jsx-runtime";var Wr=60;function Lr(e){return e>=80?$e.semantic.error:e>=40?$e.semantic.warning:$e.semantic.success}var Nt=Br(function({history:t}){let o=t.slice(-Wr);return Dt(m,{style:Vt.row,pointerEvents:"none",children:o.map((r,n)=>Dt(m,{style:[Vt.bar,{height:Math.max(2,r/100*28),backgroundColor:Lr(r)}]},`b${n}`))})}),Vt=I.create({row:{flexDirection:"row",alignItems:"flex-end",gap:1,height:28,alignSelf:"stretch"},bar:{flex:1,maxWidth:6,borderRadius:1,opacity:.9}});import{memo as _r,useState as Vr}from"react";import{macOSColors as xe,night as A}from"@buoy-gg/shared-ui/web";import{jsx as z,jsxs as j}from"react/jsx-runtime";var Dr=[{key:"windowMs",title:"RECENT"},{key:"calls",title:"CALLS"},{key:"avgMs",title:"AVG"},{key:"maxMs",title:"MAX"},{key:"totalMs",title:"TOTAL"}],Ht={timeout:{text:"TIMEOUT",color:"#38BDF8",prefix:"setTimeout"},interval:{text:"INTERVAL",color:"#22D3EE",prefix:"setInterval"},immediate:{text:"IMMED",color:"#60A5FA",prefix:"setImmediate"},raf:{text:"RAF",color:"#34D399",prefix:"requestAnimationFrame"},microtask:{text:"MICRO",color:"#A78BFA",prefix:"queueMicrotask"},then:{text:"PROMISE",color:"#BF5AF2",prefix:"Promise.then"},bridge:{text:"BRIDGE",color:"#FBBF24",prefix:"bridge"},unattributed:{text:"SYSTEM",color:"#8E8E93"},other:{text:"OTHER",color:"#8E8E93",prefix:"other"}};function we(e){return Ht[e]??Ht.other}function Ke(e){if(e.api==="unattributed")return"events \xB7 React \xB7 native call-ins";if(e.api==="other")return"evicted cold origins";let t=we(e.api).prefix,o=e.label;return t&&o.startsWith(t)&&(o=o.slice(t.length)),o=o.replace(/^[\s←@]+/,"").trim(),o.length>0?o:"anonymous"}function me(e){return e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e>=100?`${Math.round(e)}`:`${Math.round(e*10)/10}`}function Nr(e){return e.calls<=0?"measured by probe \xB7 not reachable from JS":`${me(e.calls)} calls \xB7 avg ${me(e.avgMs)} \xB7 max ${me(e.maxMs)} \xB7 total ${me(e.totalMs)} ms`}var Hr=_r(function({row:t,rank:o,onPress:r}){let n=we(t.api);return j(r?G:m,{style:C.row,...r?{onPress:()=>r(t),activeOpacity:.6}:{},children:[j(m,{style:C.topLine,children:[z(u,{style:C.rank,children:o}),z(m,{style:[C.badge,{borderColor:n.color,backgroundColor:`${n.color}1A`}],children:z(u,{style:[C.badgeText,{color:n.color}],children:n.text})}),z(u,{style:C.name,numberOfLines:1,children:Ke(t)}),t.freezes>0&&j(u,{style:[C.freezeBadge,t.worstFreezeMs>=100&&C.freezeBadgeSevere],children:["\u26A0 \xD7",t.freezes]}),j(u,{style:[C.windowMs,t.api!=="unattributed"&&t.pctOfBusy>=25&&{color:t.pctOfBusy>=50?xe.semantic.error:xe.semantic.warning}],children:[me(t.windowMs),z(u,{style:C.unit,children:" ms"})]}),j(u,{style:[C.pct,t.api==="unattributed"&&C.pctMuted],children:[Math.round(t.pctOfBusy),"%"]})]}),j(m,{style:C.subLine,children:[z(m,{style:C.barTrack,children:z(m,{style:[C.barFill,{width:`${Math.min(100,t.pctOfBusy)}%`,backgroundColor:n.color}]})}),z(u,{style:C.stats,numberOfLines:1,children:Nr(t)})]})]})},(e,t)=>e.rank===t.rank&&e.onPress===t.onPress&&e.row.key===t.row.key&&e.row.windowMs===t.row.windowMs&&e.row.calls===t.row.calls&&e.row.maxMs===t.row.maxMs&&e.row.totalMs===t.row.totalMs&&e.row.pctOfBusy===t.row.pctOfBusy&&e.row.freezes===t.row.freezes&&e.row.worstFreezeMs===t.row.worstFreezeMs);function $t({rows:e,onSelectRow:t}){let[o,r]=Vr("windowMs"),n=o==="windowMs"?e:[...e].sort((i,s)=>s[o]-i[o]);return j(m,{style:K.root,children:[j(m,{style:K.sortRow,children:[z(u,{style:K.sortLabel,children:"SORT"}),Dr.map(i=>z(G,{onPress:()=>r(i.key),style:[K.sortChip,o===i.key&&K.sortChipOn],children:z(u,{style:[K.sortChipText,o===i.key&&K.sortChipTextOn],children:i.title})},i.key))]}),j(ie,{style:K.body,children:[n.map((i,s)=>z(Hr,{row:i,rank:s+1,onPress:t},i.key)),n.length===0&&z(u,{style:K.empty,children:"No tasks observed yet \u2014 interact with the app."})]})]})}var K=I.create({root:{flex:1,minHeight:0},sortRow:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,borderBottomWidth:1,borderBottomColor:A.color.border,backgroundColor:A.color.surface},sortLabel:{color:A.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginRight:2},sortChip:{borderWidth:1,borderColor:A.color.border,borderRadius:4,paddingHorizontal:7,paddingVertical:3},sortChipOn:{borderColor:A.color.accentBorderStrong,backgroundColor:A.color.accentSoft},sortChipText:{color:A.color.textTertiary,fontSize:9,fontWeight:"600",fontVariant:["tabular-nums"]},sortChipTextOn:{color:A.color.accent},body:{flex:1},empty:{color:A.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:24}}),C=I.create({row:{paddingHorizontal:10,paddingVertical:8,borderBottomWidth:I.hairlineWidth,borderBottomColor:A.color.border,gap:5},topLine:{flexDirection:"row",alignItems:"center",gap:6},rank:{width:16,color:A.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:4,paddingVertical:1},badgeText:{fontSize:8,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:A.color.text,fontSize:13,fontWeight:"500"},freezeBadge:{color:xe.semantic.warning,fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},freezeBadgeSevere:{color:xe.semantic.error},windowMs:{color:A.color.text,fontSize:13,fontWeight:"700",fontVariant:["tabular-nums"]},unit:{color:A.color.textTertiary,fontSize:10,fontWeight:"400"},pct:{width:38,textAlign:"right",color:A.color.textSecondary,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},pctMuted:{color:A.color.textTertiary},subLine:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:22},barTrack:{width:72,height:4,borderRadius:2,backgroundColor:A.color.fillSecondary,overflow:"hidden"},barFill:{height:4,borderRadius:2,opacity:.85},stats:{flex:1,color:A.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]}});import{memo as $r}from"react";import{macOSColors as Me,night as O,useSafeAreaInsets as Kr}from"@buoy-gg/shared-ui/web";import{Fragment as jt,jsx as w,jsxs as J}from"react/jsx-runtime";var Kt={timeout:"Work scheduled with setTimeout. Time shown is the callback's exclusive run time on the JS thread.",interval:"A repeating setInterval. One scheduling site, many runs \u2014 a hot interval is the classic silent JS-FPS killer.",immediate:"Work scheduled with setImmediate \u2014 runs at the end of the current event-loop turn.",raf:"requestAnimationFrame work \u2014 runs once per frame while scheduled. Cost here directly trades against 60fps.",microtask:"queueMicrotask work \u2014 runs after the current task, before the thread yields.",then:"Promise reaction (.then/.catch/.finally). Named by the function that attached the reaction. Note: async/await bodies bypass .then and land in the System row instead.",bridge:"A native\u2192JS call-in over the legacy bridge (events, module callbacks), measured as its un-nested remainder.",unattributed:"Thread time the probe measured but no JS wrapper could claim: touch handlers, React commits, native call-ins, and async/await bodies. High here on New Architecture is normal \u2014 it's where UI work lives.",other:"Origins evicted from the table when the registry hit its cap \u2014 their totals are preserved here."};function jr(e){return Kt[e]??Kt.other}function Y(e){return e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e>=100?`${Math.round(e)}`:`${Math.round(e*100)/100}`}function Ur(e){if(e<=0)return"\u2014";let t=e/1e3;return t<1?"just now":t<60?`${Math.round(t)}s ago`:`${Math.floor(t/60)}m ago`}function q({label:e,value:t,accent:o}){return J(m,{style:h.stat,children:[w(u,{style:h.statLabel,children:e}),w(u,{style:[h.statValue,o?{color:o}:null],children:t})]})}var Ut=$r(function({detail:t}){let o=we(t.api),r=Kr({minBottom:12}),n=Math.max(1,...t.buckets);return J(ie,{style:h.root,contentContainerStyle:{paddingBottom:r.bottom},children:[J(m,{style:h.identityRow,children:[w(m,{style:[h.badge,{borderColor:o.color,backgroundColor:`${o.color}1A`}],children:w(u,{style:[h.badgeText,{color:o.color}],children:o.text})}),w(u,{style:h.name,numberOfLines:2,children:Ke(t)})]}),w(u,{style:h.explainer,children:jr(t.api)}),w(u,{style:h.sectionTitle,children:"ACTIVITY \xB7 LAST 5S"}),w(m,{style:h.chartRow,children:t.buckets.map((i,s)=>w(m,{style:h.chartBarSlot,children:w(m,{style:[h.chartBar,{height:Math.max(2,i/n*44),backgroundColor:o.color}]})},`bk${s}`))}),J(m,{style:h.chartLegend,children:[J(u,{style:h.chartLegendText,children:[Y(t.windowMs)," ms in window \xB7 ",t.pctOfBusy.toFixed(1),"% of busy time"]}),J(u,{style:h.chartLegendText,children:["peak ",Y(n)," ms/250ms"]})]}),w(u,{style:h.sectionTitle,children:"STATS \xB7 SINCE START"}),J(m,{style:h.statGrid,children:[w(q,{label:"RUNS",value:t.calls>0?Y(t.calls):"\u2014"}),w(q,{label:"SCHEDULED",value:t.scheduleCount>0?Y(t.scheduleCount):"\u2014"}),w(q,{label:"AVG / RUN",value:t.calls>0?`${Y(t.avgMs)} ms`:"\u2014"}),w(q,{label:"MAX / RUN",value:t.maxMs>0?`${Y(t.maxMs)} ms`:"\u2014",accent:t.maxMs>=50?Me.semantic.warning:void 0}),w(q,{label:"TOTAL",value:t.totalMs>0?`${Y(t.totalMs)} ms`:"\u2014"}),w(q,{label:"LAST RUN",value:Ur(t.lastSeenAgoMs)}),w(q,{label:"FREEZES \xB7 60S",value:t.freezes>0?`${t.freezes}`:"0",accent:t.freezes>0?Me.semantic.error:void 0}),w(q,{label:"WORST FREEZE",value:t.worstFreezeMs>0?`${t.worstFreezeMs} ms`:"\u2014",accent:t.worstFreezeMs>=100?Me.semantic.error:t.worstFreezeMs>0?Me.semantic.warning:void 0})]}),(t.caller||(t.frames?.length??0)>0)&&J(jt,{children:[w(u,{style:h.sectionTitle,children:"SCHEDULED FROM"}),J(m,{style:h.siteCard,children:[t.caller&&J(u,{style:h.siteCaller,children:[t.caller,"()"]}),t.file&&J(u,{style:h.siteFile,children:[t.file,t.line!=null?`:${t.line}`:""]}),t.frames?.map((i,s)=>J(u,{style:h.siteFrame,numberOfLines:1,children:[i.file,":",i.line,":",i.col]},`fr${s}`)),w(u,{style:h.siteNote,children:"Frames are bundle offsets (Hermes) \u2014 the caller name above is the readable part. Captured once when this origin got hot."})]})]}),!t.caller&&(t.frames?.length??0)===0&&t.api!=="unattributed"&&t.api!=="other"&&J(jt,{children:[w(u,{style:h.sectionTitle,children:"SCHEDULED FROM"}),w(u,{style:h.sitePending,children:t.promoted?"Stack capture pending \u2014 next schedule from this site will record it.":"Not hot enough yet \u2014 the scheduling stack is captured once an origin passes 25 schedules or 50ms total."})]})]})}),h=I.create({root:{flex:1,backgroundColor:"transparent",paddingHorizontal:12},identityRow:{flexDirection:"row",alignItems:"center",gap:8,paddingTop:12},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:5,paddingVertical:2},badgeText:{fontSize:9,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:O.color.text,fontSize:15,fontWeight:"600"},explainer:{color:O.color.textTertiary,fontSize:11,lineHeight:15,marginTop:6,marginBottom:4},sectionTitle:{color:O.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginTop:14,marginBottom:6},chartRow:{flexDirection:"row",alignItems:"flex-end",height:48,gap:2,backgroundColor:O.color.surface,borderRadius:6,borderWidth:1,borderColor:O.color.border,paddingHorizontal:6,paddingTop:2},chartBarSlot:{flex:1,alignItems:"center",justifyContent:"flex-end"},chartBar:{width:"70%",borderTopLeftRadius:2,borderTopRightRadius:2,opacity:.9},chartLegend:{flexDirection:"row",justifyContent:"space-between",marginTop:4},chartLegendText:{color:O.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},statGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},stat:{width:"23%",minWidth:76,flexGrow:1,backgroundColor:O.color.surface,borderWidth:1,borderColor:O.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:6},statLabel:{color:O.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.4,marginBottom:3},statValue:{color:O.color.text,fontSize:13,fontWeight:"600",fontVariant:["tabular-nums"]},siteCard:{backgroundColor:O.color.surface,borderWidth:1,borderColor:O.color.border,borderRadius:6,padding:10,gap:3},siteCaller:{color:O.color.text,fontSize:13,fontWeight:"600"},siteFile:{color:O.color.info,fontSize:11},siteFrame:{color:O.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},siteNote:{color:O.color.textTertiary,fontSize:9,opacity:.8,marginTop:4},sitePending:{color:O.color.textTertiary,fontSize:11}});import{Fragment as rn,jsx as S,jsxs as U}from"react/jsx-runtime";function Gt(e){return e>=80?V.semantic.error:e>=40?V.semantic.warning:V.semantic.success}function je(e){return e>=100?V.semantic.error:V.semantic.warning}function on(e){let t=e.rows.find(o=>o.api!=="unattributed"&&o.api!=="other");return t&&t.pctOfBusy>=25&&e.busyPct>=15?{color:t.pctOfBusy>=50?V.semantic.error:V.semantic.warning,icon:"\u25B2",text:`${t.label} is eating ${Math.round(t.pctOfBusy)}% of thread time \u2014 start there.`}:e.freezeSummary.count>0?{color:je(e.freezeSummary.worstMs),icon:"\u25B2",text:`${e.freezeSummary.count} freeze${e.freezeSummary.count===1?"":"s"} in the last 60s (worst ${e.freezeSummary.worstMs}ms) \u2014 check rows marked \u26A0.`}:e.busyPct>=80?{color:V.semantic.warning,icon:"\u25B2",text:"Thread saturated by UI/React work \u2014 open Highlight Updates to find re-renders."}:{color:V.semantic.success,icon:"\u25CF",text:`Thread healthy at ${Math.round(e.busyPct)}% load \u2014 nothing worth chasing.`}}function Ue({visible:e,onClose:t,onBack:o,onMinimize:r,initialModalState:n,minimizeTargetPosition:i,remoteSnapshot:s,remoteActions:a,embedded:l=!1}){let c=s!==void 0,[T,W]=qt(null);Gr(()=>{if(!(c||!e))return p.subscribe(W)},[c,e]);let y=c?s:T,x=Yr(()=>a??{pause:()=>p.pause(),resume:()=>p.resume(),clear:()=>p.clear()},[a]),E=y?.paused??!1,ve=(y?.rows.length??0)>0,[ke,Xe]=qt(null),oo=qr(Q=>Xe(Q.key),[]),Ze=!c&&ke?p.getOriginDetail(ke):null,et=ke!==null,tt=U(fe,{children:[et?S(fe.Navigation,{onBack:()=>Xe(null)}):o?S(fe.Navigation,{onBack:o}):null,S(fe.Content,{title:"",noMargin:!0,children:U(m,{style:k.titleRow,children:[S(Qr,{size:14,color:"#34D399"}),S(u,{style:k.title,children:"JS Top"}),y&&S(m,{style:[k.busyPill,{borderColor:Gt(y.busyPct)}],children:U(u,{style:[k.busyText,{color:Gt(y.busyPct)}],children:[y.busyPct.toFixed(0),"% BUSY"]})}),y&&y.freezeSummary.count>0&&S(m,{style:[k.busyPill,{borderColor:je(y.freezeSummary.worstMs)}],children:U(u,{style:[k.busyText,{color:je(y.freezeSummary.worstMs)}],children:["\u26A0 ",y.freezeSummary.count," \xB7"," ",y.freezeSummary.worstMs,"ms"]})})]})}),U(fe.Actions,{children:[S(G,{onPress:E?x.resume:x.pause,style:[k.actionBtn,E&&k.actionBtnActive],accessibilityLabel:E?"Resume sampling":"Pause sampling",children:E?S(en,{size:14,color:P.color.accent}):S(Zr,{size:14,color:P.color.textSecondary})}),S(G,{onPress:x.clear,disabled:!ve,style:[k.actionBtn,!ve&&k.actionBtnDisabled],accessibilityLabel:"Clear stats",children:S(tn,{size:14,color:ve?P.color.textTertiary:P.color.textTertiary})})]})]}),ot=S(m,{style:k.body,children:et?Ze?S(Ut,{detail:Ze}):S(u,{style:k.waiting,children:"This origin is no longer tracked (cleared or evicted)."}):y?U(rn,{children:[(()=>{let Q=on(y);return U(m,{style:[k.diagnosis,{borderLeftColor:Q.color}],children:[S(u,{style:[k.diagnosisIcon,{color:Q.color}],children:Q.icon}),S(u,{style:k.diagnosisText,children:Q.text})]})})(),U(m,{style:k.sparklineRow,children:[S(u,{style:k.sparklineCaption,children:"JS THREAD LOAD \xB7 LAST 30s"}),S(Nt,{history:y.busyHistory})]}),!y.tiers.bridge&&S(u,{style:k.tierBanner,children:"\u201CSystem\u201D rows are UI/React/native work pure JS can\u2019t name \u2014 timers, rAF and Promise chains are fully attributed."}),S($t,{rows:y.rows,onSelectRow:c?void 0:oo})]}):S(u,{style:k.waiting,children:c?"Waiting for device\u2026":"Starting engine\u2026"})});return l?U(m,{style:k.embeddedRoot,children:[S(m,{style:k.embeddedHeader,children:tt}),ot]}):S(Xr,{visible:e,onClose:t,onMinimize:r,minimizeTargetPosition:i,initialModalState:n,header:{showToggleButton:!0,customContent:tt},persistenceKey:"buoy-js-top-modal",enablePersistence:!0,initialMode:"bottomSheet",disableScrollWrapper:!0,children:ot})}var k=I.create({titleRow:{flexDirection:"row",alignItems:"center",gap:8},title:{color:P.color.text,fontSize:14,fontWeight:"500"},busyPill:{borderWidth:1,borderRadius:4,paddingHorizontal:6,paddingVertical:2},busyText:{fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},actionBtn:{width:32,height:32,borderRadius:8,backgroundColor:P.color.buttonSurface,borderWidth:1,borderColor:P.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:P.color.accentSoft,borderColor:P.color.accentBorderStrong},actionBtnDisabled:{opacity:.55},body:{flex:1,minHeight:0,backgroundColor:"transparent"},diagnosis:{flexDirection:"row",alignItems:"center",gap:8,marginHorizontal:10,marginTop:8,paddingHorizontal:10,paddingVertical:8,backgroundColor:P.color.surface,borderRadius:6,borderLeftWidth:3},diagnosisIcon:{fontSize:11,fontWeight:"700"},diagnosisText:{flex:1,color:P.color.text,fontSize:12,lineHeight:16},sparklineRow:{paddingHorizontal:10,paddingVertical:8,gap:4},sparklineCaption:{color:P.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.5},tierBanner:{color:P.color.textTertiary,fontSize:10,paddingHorizontal:10,paddingBottom:6},waiting:{color:P.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:32},embeddedRoot:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:V.background.base},embeddedHeader:{borderBottomWidth:1,borderBottomColor:V.border.default}});import{useEffect as Yt,useState as Qt}from"react";import{macOSColors as qe,night as Ge}from"@buoy-gg/shared-ui/web";import{jsx as an,jsxs as Xt}from"react/jsx-runtime";function nn(e){return e>=80?qe.semantic.error:e>=40?qe.semantic.warning:qe.semantic.success}function sn(){let[e,t]=Qt(()=>p.isEnabled()),[o,r]=Qt(null);if(Yt(()=>p.subscribeEnabled(t),[]),Yt(()=>{if(!e){r(null);return}return p.subscribe(r)},[e]),!e||!o)return null;let n=o.rows.find(i=>i.api!=="unattributed");return Xt(m,{style:Ye.pill,pointerEvents:"none",children:[Xt(u,{style:[Ye.busy,{color:nn(o.busyPct)}],children:[o.busyPct.toFixed(0),"%"]}),n&&an(u,{style:Ye.label,numberOfLines:1,children:n.label})]})}var Ye=I.create({pill:{position:"absolute",top:60,left:8,flexDirection:"row",alignItems:"center",gap:6,backgroundColor:Ge.color.buttonSurface,borderWidth:1,borderColor:Ge.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:4,maxWidth:220},busy:{fontSize:11,fontWeight:"700",fontVariant:["tabular-nums"]},label:{color:Ge.color.textSecondary,fontSize:10,flexShrink:1}});import{useEffect as ln,useState as cn}from"react";import{Activity as Zt}from"@buoy-gg/shared-ui/web";import{jsx as to}from"react/jsx-runtime";var Qe="#34D399",eo="#6B7280";function un({size:e}){let[t,o]=cn(()=>p.isEnabled());return ln(()=>p.subscribeEnabled(o),[]),to(Zt,{size:e,color:t?Qe:eo})}function pn(){return null}var dn={id:"js-top",name:"JS TOP",description:"Toggle the floating JS-thread busy pill",slot:"row",icon:un,component:pn,props:{},launchMode:"toggle-only",onPress:()=>{p.setEnabled(!p.isEnabled())}},mn={id:"js-top-modal",name:"TASKS",description:"Live Task Manager for the JS thread",slot:"both",icon:({size:e})=>to(Zt,{size:e,color:Qe}),component:Ue,props:{enableSharedModalDimensions:!1}};p.registerTierInstaller(zt);p.registerTierInstaller(Jt);p.registerTierInstaller(Bt);p.registerLongtaskProvider(Wt);p.registerFreezeStatsProvider(Lt);p.registerClearHook(_t);try{typeof window<"u"&&(he(),ye())}catch{}export{eo as JS_TOP_DISABLED_COLOR,Qe as JS_TOP_ENABLED_COLOR,p as JsTopController,sn as JsTopHudOverlay,Ue as JsTopModal,mn as jsTopModalPreset,dn as jsTopPreset,Fr as jsTopSyncAdapter};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/js-top",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.41",
|
|
4
4
|
"description": "Inspect instrumented JavaScript timers, promises and callbacks to investigate work on the React Native JS thread.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -12,11 +12,13 @@
|
|
|
12
12
|
],
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
15
|
+
"@buoy-gg/shared-ui": "^7.0.41"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": "*",
|
|
19
|
-
"react-native": ">=0.76.0"
|
|
19
|
+
"react-native": ">=0.76.0",
|
|
20
|
+
"react-native-web": "^0.21.0",
|
|
21
|
+
"react-dom": ">=18"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
24
|
"@types/react": "^19.1.0",
|
|
@@ -62,10 +64,42 @@
|
|
|
62
64
|
"js-thread",
|
|
63
65
|
"task-manager"
|
|
64
66
|
],
|
|
67
|
+
"exports": {
|
|
68
|
+
".": {
|
|
69
|
+
"browser": {
|
|
70
|
+
"types": "./lib/typescript/index.d.ts",
|
|
71
|
+
"default": "./lib/web/index.mjs"
|
|
72
|
+
},
|
|
73
|
+
"import": {
|
|
74
|
+
"types": "./lib/typescript/index.d.ts",
|
|
75
|
+
"default": "./lib/module/index.js"
|
|
76
|
+
},
|
|
77
|
+
"require": {
|
|
78
|
+
"types": "./lib/typescript/index.d.ts",
|
|
79
|
+
"default": "./lib/commonjs/index.js"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"./web": {
|
|
83
|
+
"types": "./lib/typescript/index.d.ts",
|
|
84
|
+
"default": "./lib/web/index.mjs"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"peerDependenciesMeta": {
|
|
88
|
+
"react-native": {
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
91
|
+
"react-native-web": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"react-dom": {
|
|
95
|
+
"optional": true
|
|
96
|
+
}
|
|
97
|
+
},
|
|
65
98
|
"scripts": {
|
|
66
|
-
"build": "bob build",
|
|
99
|
+
"build": "bob build && pnpm run build:web",
|
|
67
100
|
"typecheck": "tsc --noEmit",
|
|
68
101
|
"clean": "rimraf lib",
|
|
69
|
-
"test": "pnpm run typecheck"
|
|
102
|
+
"test": "pnpm run typecheck",
|
|
103
|
+
"build:web": "node ../../scripts/build-web.mjs js-top"
|
|
70
104
|
}
|
|
71
105
|
}
|