@buoy-gg/js-top 7.0.63 → 7.0.65
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/lib/commonjs/js-top/engine/JsTopController.js +1 -1
- package/lib/commonjs/js-top/engine/symbolicate.js +1 -1
- package/lib/commonjs/js-top/engine/symbolicate.web.js +1 -1
- package/lib/module/js-top/engine/JsTopController.js +1 -1
- package/lib/module/js-top/engine/symbolicate.js +1 -1
- package/lib/module/js-top/engine/symbolicate.web.js +1 -1
- package/lib/web/index.mjs +2 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.JsTopController=void 0;var _types=require("../types");var _now=require("./now");var _state=require("./state");var _timers=require("./patches/timers");var _microtasks=require("./patches/microtasks");var _aggregator=require("./aggregator");var _originRegistry=require("./originRegistry");var _busyProbe=require("./busyProbe");var _preferences=require("../utils/preferences");var _sharedUi=require("@buoy-gg/shared-ui");const NOTIFY_INTERVAL_MS=_types.BUCKET_MS;class JsTopControllerImpl{enabled=false;enabledLoaded=false;paused=false;remoteSampling=false;engineRunning=false;tiers={timers:false,promises:false,bridge:false,longtask:false};notifyHandle=null;appStateSub=null;snapshot=this.buildSnapshot();subscribers=new Set;enabledSubscribers=new Set;tierInstallers=[];longtaskProvider=null;freezeStatsProvider=null;clearHooks=[];constructor(){void(0,_preferences.loadJsTopPrefs)().then(e=>{this.enabledLoaded=true;if(e.enabled&&!this.enabled)this.setEnabled(true)})}subscribe(e){this.subscribers.add(e);this.syncEngineState();e(this.snapshot);return()=>{this.subscribers.delete(e);this.syncEngineState()}}subscribeEnabled(e){this.enabledSubscribers.add(e);e(this.enabled);return()=>{this.enabledSubscribers.delete(e)}}setEnabled(e){if(this.enabled===e)return;this.enabled=e;if(this.enabledLoaded)void(0,_preferences.saveJsTopPrefs)({enabled:e});this.enabledSubscribers.forEach(t=>{try{t(e)}catch(i){if(__DEV__){console.error("[js-top] enabled subscriber threw",i)}}});this.syncEngineState()}isEnabled(){return this.enabled}setRemoteSampling(e){if(this.remoteSampling===e)return;this.remoteSampling=e;this.syncEngineState()}isRemoteSampling(){return this.remoteSampling}getStatus(){if(!this.engineRunning)return"disabled";return this.paused?"paused":"running"}pause(){if(this.paused)return;this.paused=true;(0,_state.setActive)(false);(0,_busyProbe.stopBusyProbe)();this.emitSnapshot()}resume(){if(!this.paused)return;this.paused=false;if(this.engineRunning){(0,_state.setActive)(true);(0,_busyProbe.startBusyProbe)()}this.emitSnapshot()}clear(){(0,_originRegistry.resetOrigins)();(0,_aggregator.resetAggregator)();for(const e of this.clearHooks){try{e()}catch{}}this.emitSnapshot()}registerClearHook(e){this.clearHooks.push(e)}getSnapshot(){return this.snapshot}getOriginDetail(e){const t=(0,_now.now)();const i=(0,_aggregator.windowBusyMs)(t);const a=this.freezeStatsProvider?.(Date.now());const s=a?.byOrigin[e];if(e==="unattributed"){const u=(0,_aggregator.windowResidualBuckets)(t);const r=Math.round(u.reduce((n,l)=>n+l,0)*10)/10;return{key:e,label:"unattributed (events / React / native call-ins)",api:"unattributed",promoted:false,scheduleCount:0,calls:0,totalMs:0,avgMs:0,maxMs:0,windowMs:r,pctOfBusy:i>0?Math.min(100,Math.round(r/i*1e3)/10):0,lastSeenAgoMs:0,buckets:u,freezes:s?.count??0,worstFreezeMs:Math.round(s?.maxMs??0)}}const o=(0,_originRegistry.getOriginDetailBase)(e,t,i);if(!o)return null;return{...o,freezes:s?.count??0,worstFreezeMs:Math.round(s?.maxMs??0)}}registerTierInstaller(e){this.tierInstallers.push(e);if(this.engineRunning){Object.assign(this.tiers,this.runInstaller(e))}}registerLongtaskProvider(e){this.longtaskProvider=e}registerFreezeStatsProvider(e){this.freezeStatsProvider=e}shouldRun(){return this.subscribers.size>0||this.remoteSampling}syncEngineState(){const e=this.shouldRun();if(e&&!this.engineRunning)this.startEngine();else if(!e&&this.engineRunning)this.stopEngine()}runInstaller(e){try{return e()}catch(t){if(__DEV__){console.error("[js-top] tier installer threw",t)}return{}}}startEngine(){this.engineRunning=true;(0,_timers.installTimerPatches)();(0,_microtasks.installMicrotaskPatches)();this.tiers={timers:true,promises:false,bridge:false,longtask:false};for(const e of this.tierInstallers){Object.assign(this.tiers,this.runInstaller(e))}(0,_state.setActive)(!this.paused);if(!this.paused)(0,_busyProbe.startBusyProbe)();try{this.appStateSub=(0,_sharedUi.subscribeRealAppState)(()=>{(0,_busyProbe.suppressNextGap)()})}catch{this.appStateSub=null}this.notifyHandle=(0,_state.getOriginals)().setInterval(()=>this.emitSnapshot(),NOTIFY_INTERVAL_MS);this.emitSnapshot()}stopEngine(){this.engineRunning=false;(0,_state.setActive)(false);(0,_busyProbe.stopBusyProbe)();if(this.notifyHandle!=null){(0,_state.getOriginals)().clearInterval(this.notifyHandle);this.notifyHandle=null}if(this.appStateSub){try{this.appStateSub.remove()}catch{}this.appStateSub=null}}buildSnapshot(){const e=(0,_now.now)();const t=(0,_aggregator.windowBusyMs)(e);const i=(0,_aggregator.windowAttributedMs)(e);const a=Math.max(0,t-i);const s=(0,_originRegistry.buildRows)(e,t,_types.SNAPSHOT_ROWS);if(a>=1){s.push({key:"unattributed",label:"unattributed (events / React / native call-ins)",api:"unattributed",windowMs:Math.round(a*10)/10,pctOfBusy:t>0?Math.min(100,Math.round(a/t*1e3)/10):0,totalMs:0,calls:0,avgMs:0,maxMs:0,lastSeenAgoMs:0,freezes:0,worstFreezeMs:0});s.sort((r,n)=>n.windowMs-r.windowMs||n.totalMs-r.totalMs)}const o=this.freezeStatsProvider?.(Date.now())??{count:0,worstMs:0,byOrigin:{}};for(const r of s){const n=o.byOrigin[r.key];if(n){r.freezes=n.count;r.worstFreezeMs=Math.round(n.maxMs)}}const u=_types.WINDOW_BUCKETS*_types.BUCKET_MS;return{ts:Date.now(),paused:this.paused,busyPct:Math.min(100,Math.round(t/u*1e3)/10),busyHistory:(0,_aggregator.busyHistory)(e),tiers:{...this.tiers},rows:s,totals:{attributedWindowMs:Math.round(i*10)/10,unattributedWindowMs:Math.round(a*10)/10,windowMs:u},freezeSummary:{count:o.count,worstMs:Math.round(o.worstMs)},longtasks:this.longtaskProvider?this.longtaskProvider():[]}}emitSnapshot(){this.snapshot=this.buildSnapshot();this.subscribers.forEach(e=>{try{e(this.snapshot)}catch(t){if(__DEV__){console.error("[js-top] snapshot subscriber threw",t)}}})}isEngineActive(){return(0,_state.isActive)()}}const JsTopController=exports.JsTopController=new JsTopControllerImpl;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.JsTopController=void 0;var _types=require("../types");var _now=require("./now");var _state=require("./state");var _timers=require("./patches/timers");var _microtasks=require("./patches/microtasks");var _aggregator=require("./aggregator");var _originRegistry=require("./originRegistry");var _busyProbe=require("./busyProbe");var _preferences=require("../utils/preferences");var _sharedUi=require("@buoy-gg/shared-ui");const NOTIFY_INTERVAL_MS=_types.BUCKET_MS;class JsTopControllerImpl{enabled=false;enabledLoaded=false;paused=false;remoteSampling=false;engineRunning=false;tiers={timers:false,promises:false,bridge:false,longtask:false};notifyHandle=null;appStateSub=null;snapshot=this.buildSnapshot();subscribers=new Set;enabledSubscribers=new Set;tierInstallers=[];longtaskProvider=null;freezeStatsProvider=null;clearHooks=[];constructor(){void(0,_preferences.loadJsTopPrefs)().then(e=>{this.enabledLoaded=true;if(e.enabled&&!this.enabled)this.setEnabled(true)})}subscribe(e){this.subscribers.add(e);this.syncEngineState();e(this.snapshot);return()=>{this.subscribers.delete(e);this.syncEngineState()}}subscribeEnabled(e){this.enabledSubscribers.add(e);e(this.enabled);return()=>{this.enabledSubscribers.delete(e)}}setEnabled(e){if(this.enabled===e)return;this.enabled=e;if(this.enabledLoaded)void(0,_preferences.saveJsTopPrefs)({enabled:e});this.enabledSubscribers.forEach(t=>{try{t(e)}catch(i){if(__DEV__){console.error("[Buoy]","[js-top] enabled subscriber threw",i)}}});this.syncEngineState()}isEnabled(){return this.enabled}setRemoteSampling(e){if(this.remoteSampling===e)return;this.remoteSampling=e;this.syncEngineState()}isRemoteSampling(){return this.remoteSampling}getStatus(){if(!this.engineRunning)return"disabled";return this.paused?"paused":"running"}pause(){if(this.paused)return;this.paused=true;(0,_state.setActive)(false);(0,_busyProbe.stopBusyProbe)();this.emitSnapshot()}resume(){if(!this.paused)return;this.paused=false;if(this.engineRunning){(0,_state.setActive)(true);(0,_busyProbe.startBusyProbe)()}this.emitSnapshot()}clear(){(0,_originRegistry.resetOrigins)();(0,_aggregator.resetAggregator)();for(const e of this.clearHooks){try{e()}catch{}}this.emitSnapshot()}registerClearHook(e){this.clearHooks.push(e)}getSnapshot(){return this.snapshot}getOriginDetail(e){const t=(0,_now.now)();const i=(0,_aggregator.windowBusyMs)(t);const a=this.freezeStatsProvider?.(Date.now());const s=a?.byOrigin[e];if(e==="unattributed"){const u=(0,_aggregator.windowResidualBuckets)(t);const r=Math.round(u.reduce((n,l)=>n+l,0)*10)/10;return{key:e,label:"unattributed (events / React / native call-ins)",api:"unattributed",promoted:false,scheduleCount:0,calls:0,totalMs:0,avgMs:0,maxMs:0,windowMs:r,pctOfBusy:i>0?Math.min(100,Math.round(r/i*1e3)/10):0,lastSeenAgoMs:0,buckets:u,freezes:s?.count??0,worstFreezeMs:Math.round(s?.maxMs??0)}}const o=(0,_originRegistry.getOriginDetailBase)(e,t,i);if(!o)return null;return{...o,freezes:s?.count??0,worstFreezeMs:Math.round(s?.maxMs??0)}}registerTierInstaller(e){this.tierInstallers.push(e);if(this.engineRunning){Object.assign(this.tiers,this.runInstaller(e))}}registerLongtaskProvider(e){this.longtaskProvider=e}registerFreezeStatsProvider(e){this.freezeStatsProvider=e}shouldRun(){return this.subscribers.size>0||this.remoteSampling}syncEngineState(){const e=this.shouldRun();if(e&&!this.engineRunning)this.startEngine();else if(!e&&this.engineRunning)this.stopEngine()}runInstaller(e){try{return e()}catch(t){if(__DEV__){console.error("[Buoy]","[js-top] tier installer threw",t)}return{}}}startEngine(){this.engineRunning=true;(0,_timers.installTimerPatches)();(0,_microtasks.installMicrotaskPatches)();this.tiers={timers:true,promises:false,bridge:false,longtask:false};for(const e of this.tierInstallers){Object.assign(this.tiers,this.runInstaller(e))}(0,_state.setActive)(!this.paused);if(!this.paused)(0,_busyProbe.startBusyProbe)();try{this.appStateSub=(0,_sharedUi.subscribeRealAppState)(()=>{(0,_busyProbe.suppressNextGap)()})}catch{this.appStateSub=null}this.notifyHandle=(0,_state.getOriginals)().setInterval(()=>this.emitSnapshot(),NOTIFY_INTERVAL_MS);this.emitSnapshot()}stopEngine(){this.engineRunning=false;(0,_state.setActive)(false);(0,_busyProbe.stopBusyProbe)();if(this.notifyHandle!=null){(0,_state.getOriginals)().clearInterval(this.notifyHandle);this.notifyHandle=null}if(this.appStateSub){try{this.appStateSub.remove()}catch{}this.appStateSub=null}}buildSnapshot(){const e=(0,_now.now)();const t=(0,_aggregator.windowBusyMs)(e);const i=(0,_aggregator.windowAttributedMs)(e);const a=Math.max(0,t-i);const s=(0,_originRegistry.buildRows)(e,t,_types.SNAPSHOT_ROWS);if(a>=1){s.push({key:"unattributed",label:"unattributed (events / React / native call-ins)",api:"unattributed",windowMs:Math.round(a*10)/10,pctOfBusy:t>0?Math.min(100,Math.round(a/t*1e3)/10):0,totalMs:0,calls:0,avgMs:0,maxMs:0,lastSeenAgoMs:0,freezes:0,worstFreezeMs:0});s.sort((r,n)=>n.windowMs-r.windowMs||n.totalMs-r.totalMs)}const o=this.freezeStatsProvider?.(Date.now())??{count:0,worstMs:0,byOrigin:{}};for(const r of s){const n=o.byOrigin[r.key];if(n){r.freezes=n.count;r.worstFreezeMs=Math.round(n.maxMs)}}const u=_types.WINDOW_BUCKETS*_types.BUCKET_MS;return{ts:Date.now(),paused:this.paused,busyPct:Math.min(100,Math.round(t/u*1e3)/10),busyHistory:(0,_aggregator.busyHistory)(e),tiers:{...this.tiers},rows:s,totals:{attributedWindowMs:Math.round(i*10)/10,unattributedWindowMs:Math.round(a*10)/10,windowMs:u},freezeSummary:{count:o.count,worstMs:Math.round(o.worstMs)},longtasks:this.longtaskProvider?this.longtaskProvider():[]}}emitSnapshot(){this.snapshot=this.buildSnapshot();this.subscribers.forEach(e=>{try{e(this.snapshot)}catch(t){if(__DEV__){console.error("[Buoy]","[js-top] snapshot subscriber threw",t)}}})}isEngineActive(){return(0,_state.isActive)()}}const JsTopController=exports.JsTopController=new JsTopControllerImpl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.buoyJsTopSymbolicateOrigin=buoyJsTopSymbolicateOrigin;const MAX_IN_FLIGHT=3;let inFlight=0;function isDev(){return typeof __DEV__!=="undefined"&&__DEV__}function tailPath(e){const s=e.split("?")[0]??e;const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.buoyJsTopSymbolicateOrigin=buoyJsTopSymbolicateOrigin;var _sharedUi=require("@buoy-gg/shared-ui");const MAX_IN_FLIGHT=3;let inFlight=0;function isDev(){return typeof __DEV__!=="undefined"&&__DEV__}function tailPath(e){const s=e.split("?")[0]??e;const n=s.split("/").filter(Boolean);return n.slice(-2).join("/")}function looksLikeComponent(e){return/^[A-Z][A-Za-z0-9]*$/.test(e)}function buoyJsTopSymbolicateOrigin(e,s){if(!isDev())return;if(e.symbolicated||!e.frames||e.frames.length===0)return;if(inFlight>=MAX_IN_FLIGHT)return;e.symbolicated=true;const n=e.frames[0];if(!n||!/^https?:\/\//.test(n.file))return;let c;try{c=`${new URL(n.file).origin}/symbolicate`}catch{return}inFlight++;const a=JSON.stringify({stack:e.frames.map(t=>({file:t.file,lineNumber:t.line,column:t.col,methodName:""}))});(0,_sharedUi.buoyFetch)(c,{method:"POST",body:a}).then(t=>t.ok?t.json():null).then(t=>{let i=t?.stack?.find(l=>l.file&&!l.file.includes("node_modules"))??t?.stack?.[0];if(!i?.file&&t?.error){const l=/found: (\/.+)$/.exec(t.error);if(l)i={file:l[1]}}if(!i?.file)return;const u=tailPath(i.file);const o=i.lineNumber;const r=i.methodName&&i.methodName!=="<unknown>"?i.methodName:void 0;e.file=u;e.line=o??e.line;const f=`${u.split("/").pop()}${o!=null?`:${o}`:""}`;if(r&&looksLikeComponent(r)&&!e.caller){e.caller=r;e.label=`${e.label} \u2190 <${r}> \xB7 ${f}`}else{e.label=`${e.label} \xB7 ${f}`}}).catch(()=>{}).finally(()=>{inFlight--})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.buoyJsTopSymbolicateOrigin=buoyJsTopSymbolicateOrigin;exports.decodeMappings=decodeMappings;exports.lookup=lookup;const MAX_IN_FLIGHT=3;let inFlight=0;function isDev(){return typeof __DEV__!=="undefined"&&__DEV__}const B64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";const B64_INDEX=new Map([...B64].map((e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.buoyJsTopSymbolicateOrigin=buoyJsTopSymbolicateOrigin;exports.decodeMappings=decodeMappings;exports.lookup=lookup;var _sharedUi=require("@buoy-gg/shared-ui");const MAX_IN_FLIGHT=3;let inFlight=0;function isDev(){return typeof __DEV__!=="undefined"&&__DEV__}const B64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";const B64_INDEX=new Map([...B64].map((e,s)=>[e,s]));function decodeMappings(e){const s=[];let o=0;let i=0;let n=0;let t=0;for(const l of e.split(";")){const a=[];let u=0;for(const g of l.split(",")){if(!g)continue;const r=[];let c=0;let f=0;for(const h of g){const p=B64_INDEX.get(h);if(p===void 0)break;c+=(p&31)<<f;if(p&32){f+=5}else{r.push(c&1?-(c>>1):c>>1);c=0;f=0}}if(!r.length)continue;u+=r[0];if(r.length===1)a.push([u]);else if(r.length>=4){o+=r[1];i+=r[2];n+=r[3];if(r.length>=5){t+=r[4];a.push([u,o,i,n,t])}else{a.push([u,o,i,n])}}}s.push(a)}return s}function lookup(e,s,o){const i=e.lines[s-1];if(!i?.length)return null;let n;for(const l of i){if(l[0]<=o-1)n=l;else break}if(!n||n.length<4)return null;const t=e.sources[n[1]];if(!t)return null;return{file:t,line:n[2]+1,name:n.length>=5?e.names[n[4]]:void 0}}const maps=new Map;function loadMap(e){let s=maps.get(e);if(!s){s=(async()=>{const o=await(await(0,_sharedUi.buoyFetch)(e)).text();const i=Math.max(o.lastIndexOf("//# sourceMappingURL="),o.lastIndexOf("//@ sourceMappingURL="));if(i<0)return null;const n=/^\/\/[#@]\s*sourceMappingURL=(\S+)/.exec(o.slice(i));if(!n)return null;const t=new URL(n[1],e).href;const l=await(await(0,_sharedUi.buoyFetch)(t)).json();if(!l.mappings||!l.sources)return null;return{sources:l.sources,names:l.names??[],lines:decodeMappings(l.mappings)}})().catch(()=>null);maps.set(e,s)}return s}function tailPath(e){const s=e.split("?")[0]??e;return s.split("/").filter(Boolean).slice(-2).join("/")}function looksLikeComponent(e){return/^[A-Z][A-Za-z0-9]*$/.test(e)}function buoyJsTopSymbolicateOrigin(e,s){if(!isDev())return;if(e.symbolicated||!e.frames||e.frames.length===0)return;if(inFlight>=MAX_IN_FLIGHT)return;e.symbolicated=true;const o=e.frames.filter(i=>/^(https?|capacitor|file):\/\//.test(i.file));if(!o.length)return;inFlight++;(async()=>{for(const i of o){const n=await loadMap(i.file.split("?")[0]??i.file);if(!n)continue;const t=lookup(n,i.line,i.col);if(!t||t.file.includes("node_modules"))continue;const l=tailPath(t.file);e.file=l;e.line=t.line;const a=`${l.split("/").pop()}:${t.line}`;if(t.name&&looksLikeComponent(t.name)&&!e.caller){e.caller=t.name;e.label=`${e.label} \u2190 <${t.name}> \xB7 ${a}`}else{e.label=`${e.label} \xB7 ${a}`}return}})().catch(()=>{}).finally(()=>{inFlight--})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{BUCKET_MS as h,WINDOW_BUCKETS as m,SNAPSHOT_ROWS as S}from"../types";import{now as d}from"./now";import{setActive as
|
|
1
|
+
"use strict";import{BUCKET_MS as h,WINDOW_BUCKETS as m,SNAPSHOT_ROWS as S}from"../types";import{now as d}from"./now";import{setActive as l,isActive as M}from"./state";import{installTimerPatches as w}from"./patches/timers";import{installMicrotaskPatches as y}from"./patches/microtasks";import{busyHistory as v,resetAggregator as E,windowAttributedMs as R,windowBusyMs as c,windowResidualBuckets as z}from"./aggregator";import{buildRows as P,getOriginDetailBase as _,resetOrigins as k}from"./originRegistry";import{startBusyProbe as b,stopBusyProbe as p,suppressNextGap as O}from"./busyProbe";import{getOriginals as f}from"./state";import{loadJsTopPrefs as I,saveJsTopPrefs as B}from"../utils/preferences";import{subscribeRealAppState as H}from"@buoy-gg/shared-ui";const T=h;class A{enabled=false;enabledLoaded=false;paused=false;remoteSampling=false;engineRunning=false;tiers={timers:false,promises:false,bridge:false,longtask:false};notifyHandle=null;appStateSub=null;snapshot=this.buildSnapshot();subscribers=new Set;enabledSubscribers=new Set;tierInstallers=[];longtaskProvider=null;freezeStatsProvider=null;clearHooks=[];constructor(){void I().then(t=>{this.enabledLoaded=true;if(t.enabled&&!this.enabled)this.setEnabled(true)})}subscribe(t){this.subscribers.add(t);this.syncEngineState();t(this.snapshot);return()=>{this.subscribers.delete(t);this.syncEngineState()}}subscribeEnabled(t){this.enabledSubscribers.add(t);t(this.enabled);return()=>{this.enabledSubscribers.delete(t)}}setEnabled(t){if(this.enabled===t)return;this.enabled=t;if(this.enabledLoaded)void B({enabled:t});this.enabledSubscribers.forEach(e=>{try{e(t)}catch(i){if(__DEV__){console.error("[Buoy]","[js-top] enabled subscriber threw",i)}}});this.syncEngineState()}isEnabled(){return this.enabled}setRemoteSampling(t){if(this.remoteSampling===t)return;this.remoteSampling=t;this.syncEngineState()}isRemoteSampling(){return this.remoteSampling}getStatus(){if(!this.engineRunning)return"disabled";return this.paused?"paused":"running"}pause(){if(this.paused)return;this.paused=true;l(false);p();this.emitSnapshot()}resume(){if(!this.paused)return;this.paused=false;if(this.engineRunning){l(true);b()}this.emitSnapshot()}clear(){k();E();for(const t of this.clearHooks){try{t()}catch{}}this.emitSnapshot()}registerClearHook(t){this.clearHooks.push(t)}getSnapshot(){return this.snapshot}getOriginDetail(t){const e=d();const i=c(e);const a=this.freezeStatsProvider?.(Date.now());const s=a?.byOrigin[t];if(t==="unattributed"){const u=z(e);const r=Math.round(u.reduce((n,g)=>n+g,0)*10)/10;return{key:t,label:"unattributed (events / React / native call-ins)",api:"unattributed",promoted:false,scheduleCount:0,calls:0,totalMs:0,avgMs:0,maxMs:0,windowMs:r,pctOfBusy:i>0?Math.min(100,Math.round(r/i*1e3)/10):0,lastSeenAgoMs:0,buckets:u,freezes:s?.count??0,worstFreezeMs:Math.round(s?.maxMs??0)}}const o=_(t,e,i);if(!o)return null;return{...o,freezes:s?.count??0,worstFreezeMs:Math.round(s?.maxMs??0)}}registerTierInstaller(t){this.tierInstallers.push(t);if(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(){const t=this.shouldRun();if(t&&!this.engineRunning)this.startEngine();else if(!t&&this.engineRunning)this.stopEngine()}runInstaller(t){try{return t()}catch(e){if(__DEV__){console.error("[Buoy]","[js-top] tier installer threw",e)}return{}}}startEngine(){this.engineRunning=true;w();y();this.tiers={timers:true,promises:false,bridge:false,longtask:false};for(const t of this.tierInstallers){Object.assign(this.tiers,this.runInstaller(t))}l(!this.paused);if(!this.paused)b();try{this.appStateSub=H(()=>{O()})}catch{this.appStateSub=null}this.notifyHandle=f().setInterval(()=>this.emitSnapshot(),T);this.emitSnapshot()}stopEngine(){this.engineRunning=false;l(false);p();if(this.notifyHandle!=null){f().clearInterval(this.notifyHandle);this.notifyHandle=null}if(this.appStateSub){try{this.appStateSub.remove()}catch{}this.appStateSub=null}}buildSnapshot(){const t=d();const e=c(t);const i=R(t);const a=Math.max(0,e-i);const s=P(t,e,S);if(a>=1){s.push({key:"unattributed",label:"unattributed (events / React / native call-ins)",api:"unattributed",windowMs:Math.round(a*10)/10,pctOfBusy:e>0?Math.min(100,Math.round(a/e*1e3)/10):0,totalMs:0,calls:0,avgMs:0,maxMs:0,lastSeenAgoMs:0,freezes:0,worstFreezeMs:0});s.sort((r,n)=>n.windowMs-r.windowMs||n.totalMs-r.totalMs)}const o=this.freezeStatsProvider?.(Date.now())??{count:0,worstMs:0,byOrigin:{}};for(const r of s){const n=o.byOrigin[r.key];if(n){r.freezes=n.count;r.worstFreezeMs=Math.round(n.maxMs)}}const u=m*h;return{ts:Date.now(),paused:this.paused,busyPct:Math.min(100,Math.round(e/u*1e3)/10),busyHistory:v(t),tiers:{...this.tiers},rows:s,totals:{attributedWindowMs:Math.round(i*10)/10,unattributedWindowMs:Math.round(a*10)/10,windowMs:u},freezeSummary:{count:o.count,worstMs:Math.round(o.worstMs)},longtasks:this.longtaskProvider?this.longtaskProvider():[]}}emitSnapshot(){this.snapshot=this.buildSnapshot();this.subscribers.forEach(t=>{try{t(this.snapshot)}catch(e){if(__DEV__){console.error("[Buoy]","[js-top] snapshot subscriber threw",e)}}})}isEngineActive(){return M()}}export const JsTopController=new A;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";import{buoyFetch as d}from"@buoy-gg/shared-ui";const p=3;let s=0;function h(){return typeof __DEV__!=="undefined"&&__DEV__}function b(e){const c=e.split("?")[0]??e;const i=c.split("/").filter(Boolean);return i.slice(-2).join("/")}function y(e){return/^[A-Z][A-Za-z0-9]*$/.test(e)}export function buoyJsTopSymbolicateOrigin(e,c){if(!h())return;if(e.symbolicated||!e.frames||e.frames.length===0)return;if(s>=p)return;e.symbolicated=true;const i=e.frames[0];if(!i||!/^https?:\/\//.test(i.file))return;let f;try{f=`${new URL(i.file).origin}/symbolicate`}catch{return}s++;const u=JSON.stringify({stack:e.frames.map(t=>({file:t.file,lineNumber:t.line,column:t.col,methodName:""}))});d(f,{method:"POST",body:u}).then(t=>t.ok?t.json():null).then(t=>{let n=t?.stack?.find(l=>l.file&&!l.file.includes("node_modules"))??t?.stack?.[0];if(!n?.file&&t?.error){const l=/found: (\/.+)$/.exec(t.error);if(l)n={file:l[1]}}if(!n?.file)return;const a=b(n.file);const o=n.lineNumber;const r=n.methodName&&n.methodName!=="<unknown>"?n.methodName:void 0;e.file=a;e.line=o??e.line;const m=`${a.split("/").pop()}${o!=null?`:${o}`:""}`;if(r&&y(r)&&!e.caller){e.caller=r;e.label=`${e.label} \u2190 <${r}> \xB7 ${m}`}else{e.label=`${e.label} \xB7 ${m}`}}).catch(()=>{}).finally(()=>{s--})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";import{buoyFetch as h}from"@buoy-gg/shared-ui";const _=3;let g=0;function x(){return typeof __DEV__!=="undefined"&&__DEV__}const w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";const y=new Map([...w].map((e,l)=>[e,l]));export function decodeMappings(e){const l=[];let o=0;let i=0;let n=0;let t=0;for(const s of e.split(";")){const a=[];let f=0;for(const m of s.split(",")){if(!m)continue;const r=[];let c=0;let u=0;for(const b of m){const p=y.get(b);if(p===void 0)break;c+=(p&31)<<u;if(p&32){u+=5}else{r.push(c&1?-(c>>1):c>>1);c=0;u=0}}if(!r.length)continue;f+=r[0];if(r.length===1)a.push([f]);else if(r.length>=4){o+=r[1];i+=r[2];n+=r[3];if(r.length>=5){t+=r[4];a.push([f,o,i,n,t])}else{a.push([f,o,i,n])}}}l.push(a)}return l}export function lookup(e,l,o){const i=e.lines[l-1];if(!i?.length)return null;let n;for(const s of i){if(s[0]<=o-1)n=s;else break}if(!n||n.length<4)return null;const t=e.sources[n[1]];if(!t)return null;return{file:t,line:n[2]+1,name:n.length>=5?e.names[n[4]]:void 0}}const d=new Map;function M(e){let l=d.get(e);if(!l){l=(async()=>{const o=await(await h(e)).text();const i=Math.max(o.lastIndexOf("//# sourceMappingURL="),o.lastIndexOf("//@ sourceMappingURL="));if(i<0)return null;const n=/^\/\/[#@]\s*sourceMappingURL=(\S+)/.exec(o.slice(i));if(!n)return null;const t=new URL(n[1],e).href;const s=await(await h(t)).json();if(!s.mappings||!s.sources)return null;return{sources:s.sources,names:s.names??[],lines:decodeMappings(s.mappings)}})().catch(()=>null);d.set(e,l)}return l}function L(e){const l=e.split("?")[0]??e;return l.split("/").filter(Boolean).slice(-2).join("/")}function $(e){return/^[A-Z][A-Za-z0-9]*$/.test(e)}export function buoyJsTopSymbolicateOrigin(e,l){if(!x())return;if(e.symbolicated||!e.frames||e.frames.length===0)return;if(g>=_)return;e.symbolicated=true;const o=e.frames.filter(i=>/^(https?|capacitor|file):\/\//.test(i.file));if(!o.length)return;g++;(async()=>{for(const i of o){const n=await M(i.file.split("?")[0]??i.file);if(!n)continue;const t=lookup(n,i.line,i.col);if(!t||t.file.includes("node_modules"))continue;const s=L(t.file);e.file=s;e.line=t.line;const a=`${s.split("/").pop()}:${t.line}`;if(t.name&&$(t.name)&&!e.caller){e.caller=t.name;e.label=`${e.label} \u2190 <${t.name}> \xB7 ${a}`}else{e.label=`${e.label} \xB7 ${a}`}return}})().catch(()=>{}).finally(()=>{g--})}
|
package/lib/web/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";var
|
|
2
|
-
`);for(let o of n){let i=/at\s+(.*?)\s+\((?:address at\s+)?(.*?):(\d+):(\d+)\)/.exec(o)??/at\s+()(.*?):(\d+):(\d+)$/.exec(o.trim())??/^([^@\s]*)@(.+?):(\d+):(\d+)$/.exec(o.trim());if(!i)continue;let a=i[1]??"";if(a.includes("buoyJsTop")||a==="Error"||i[2]?.includes("/js-top/"))continue;t.push({file:i[2]??"",line:Number(i[3]),col:Number(i[4])});let s=/^(react_stack_bottom_frame|runWithFiberInDEV|commitHookEffectList|flushPassive|performWork|renderWithHooks|safelyCall)/.test(a)||/^(then|catch|finally|resolve|reject|fulfilled|rejected|step|tryCallOne|tryCallTwo|tryCatch|invokeCallback|notify)$/.test(a);if(!r&&a&&a!=="anonymous"&&!s&&(r=a),t.length>=3)break}return{caller:r,frames:t}}function Xt(e,t){return t-e.lastCaptureAt<Qt||(t-Qe>1e3&&(Qe=t,we=0),we>=Gt)?false:(we++,e.lastCaptureAt=t,true)}function Se(e){if(!e)return;let t=(e.split("?")[0]??e).replace(/\/\/&.*$/,""),r=/^[a-z]+:\/\/[^/]+\/(.*)$/.exec(t);return(r?r[1]:t).split("/").slice(-2).join("/")}function er(e){return T.has(e)}function ve(e,t,r,n=true){let o=t,i=typeof o.displayName=="string"&&o.displayName||typeof o.name=="string"&&o.name||"anonymous",a=`${e}|${i}`,s=T.get(a);if(s||(T.size>=500&&Ye(r),s=xe(a,e,i==="anonymous"?X(e):`${X(e)} ${i}`),T.set(a,s)),s.scheduleCount++,!s.promoted&&(s.scheduleCount>=25||s.totalMs>=50)&&(s.promoted=true),(s.promoted||e==="interval")&&n&&Xt(s,r)){let{caller:l,frames:d}=Zt(new Error().stack??""),f=d[0];if(f||l){let F=f?`${Se(f.file)??"?"}:${f.line}`:"?",m=`${a}@${l??"?"}:${F}`,b=T.get(m);if(!b){T.size>=500&&Ye(r);let x=i==="anonymous"?X(e):`${X(e)} ${i}`;b=xe(m,e,l?`${x} \u2190 ${l}`:i==="anonymous"?`${x} @ ${Se(f?.file??"")??"?"}`:x),b.caller=l,b.file=f?Se(f.file):void 0,b.line=f?.line,b.frames=d,b.promoted=true,b.calls=s.calls,b.totalMs=s.totalMs,b.maxMs=s.maxMs,b.scheduleCount=s.scheduleCount,b.lastSeenAt=s.lastSeenAt,b.ring.set(s.ring),b.ringStamps.set(s.ringStamps),s.calls=0,s.totalMs=0,s.maxMs=0,s.ring.fill(0),s.ringStamps.fill(-1),T.set(m,b),_t(b,X(e))}s.activeRefinedKey=m}}return s.activeRefinedKey??a}function X(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 tr(e,t,r,n){let o=T.get(e);if(!o)return;o.calls++,o.totalMs+=t,t>o.maxMs&&(o.maxMs=t),o.lastSeenAt=n,!o.promoted&&o.totalMs>=50&&(o.promoted=true);let i=n-r,a=i>0?Math.min(1,t/i):1,s=Math.max(r,n-5e3),l=P(s),d=P(n),f=s;for(;l<=d;){let F=(l+1)*250,m=Math.min(n,F),b=m-f;if(b>0){let x=l%20;x>=0&&(o.ringStamps[x]!==l&&(o.ringStamps[x]=l,o.ring[x]=0),o.ring[x]+=i>0?b*a:t)}f=m,l++}It(r,n,t)}function rr(e){return T.get(e)?.label??null}function nr(e,t,r){let n=[];for(let a of T.values()){let s=Ge(a,e);s<=0&&a.totalMs<1||n.push({key:a.key,label:a.label,api:a.api,file:a.file,line:a.line,windowMs:Math.round(s*10)/10,pctOfBusy:t>0?Math.min(100,Math.round(s/t*1e3)/10):0,totalMs:Math.round(a.totalMs*10)/10,calls:a.calls,avgMs:a.calls>0?Math.round(a.totalMs/a.calls*100)/100:0,maxMs:Math.round(a.maxMs*100)/100,lastSeenAgoMs:a.lastSeenAt>0?Math.max(0,e-a.lastSeenAt):0,freezes:0,worstFreezeMs:0})}n.sort((a,s)=>s.windowMs-a.windowMs||s.totalMs-a.totalMs);let o=[],i=[];for(let a of n)(a.windowMs>=1||a.pctOfBusy>=.5||a.freezes>0?o:i).push(a);return i.length>=2?(o.push({key:"minor",label:`${i.length} minor origins (\u22641ms each)`,api:"other",windowMs:Math.round(i.reduce((a,s)=>a+s.windowMs,0)*10)/10,pctOfBusy:Math.round(i.reduce((a,s)=>a+s.pctOfBusy,0)*10)/10,totalMs:Math.round(i.reduce((a,s)=>a+s.totalMs,0)*10)/10,calls:i.reduce((a,s)=>a+s.calls,0),avgMs:0,maxMs:Math.max(0,...i.map(a=>a.maxMs)),lastSeenAgoMs:Math.min(...i.map(a=>a.lastSeenAgoMs)),freezes:0,worstFreezeMs:0}),o.slice(0,r)):n.slice(0,r)}function or(e,t,r){let n=T.get(e);if(!n)return null;let o=P(t),i=[],a=0;for(let s=o-20+1;s<=o;s++){let l=s%20,d=l>=0&&n.ringStamps[l]===s?Math.round(n.ring[l]*10)/10:0;i.push(d),a+=d}return{key:n.key,label:n.label,api:n.api,caller:n.caller,file:n.file,line:n.line,frames:n.frames,promoted:n.promoted,scheduleCount:n.scheduleCount,calls:n.calls,totalMs:Math.round(n.totalMs*10)/10,avgMs:n.calls>0?Math.round(n.totalMs/n.calls*100)/100:0,maxMs:Math.round(n.maxMs*100)/100,windowMs:Math.round(a*10)/10,pctOfBusy:r>0?Math.min(100,Math.round(a/r*1e3)/10):0,lastSeenAgoMs:n.lastSeenAt>0?Math.max(0,t-n.lastSeenAt):0,buckets:i}}function ir(){T.clear()}var ar=32,J=[],sr=20,Ze=64,Xe=new Array(Ze).fill(null),ke=0;function lr(){return Xe}function et(e,t){let r=I(),n=J.length>0?J[J.length-1]:null,o=null;J.length<ar&&(o={originKey:e,start:r,childrenMs:0},J.push(o));try{return t()}finally{try{if(o){J.pop();let i=I(),a=i-r,s=Math.max(0,a-o.childrenMs);n&&(n.childrenMs+=a),tr(e,s,r,i),!n&&a>=sr&&(Xe[ke]={originKey:e,start:r,end:i},ke=(ke+1)%Ze)}}catch{}}}function K(e,t){if(typeof e!="function"||e[qe])return e;let r=V()?ve(t,e,I()):null,n=function(...o){return V()?((r===null||!er(r))&&(r=ve(t,e,I(),false)),et(r,()=>e.apply(this,o))):e.apply(this,o)};return n[qe]=true,n}function tt(e,t,r){if(!V())return r();let n=ve(e,{name:t},I());return et(n,r)}function rt(){let e=ge();if(typeof h.setTimeout=="function"&&!h.setTimeout[v]){let t=function(r,n,...o){let i=K(r,"timeout");return e.setTimeout(i,n,...o)};t[v]=true,h.setTimeout=t}if(typeof h.setInterval=="function"&&!h.setInterval[v]){let t=function(r,n,...o){let i=K(r,"interval");return e.setInterval(i,n,...o)};t[v]=true,h.setInterval=t}if(typeof h.setImmediate=="function"&&!h.setImmediate[v]&&e.setImmediate){let t=function(r,...n){let o=K(r,"immediate");return e.setImmediate(o,...n)};t[v]=true,h.setImmediate=t}if(typeof h.requestAnimationFrame=="function"&&!h.requestAnimationFrame[v]&&e.requestAnimationFrame){let t=function(r){let n=K(r,"raf");return e.requestAnimationFrame(n)};t[v]=true,h.requestAnimationFrame=t}}function nt(){let e=ge();if(typeof h.queueMicrotask=="function"&&!h.queueMicrotask[v]&&e.queueMicrotask){let t=function(r){let n=K(r,"microtask");return e.queueMicrotask(n)};t[v]=true,h.queueMicrotask=t}}var Te=16,cr=100,ur=3,dr=8,ee=null,te=0,ce=false,re=[],_=1/0,Q=0,Ce=Te;function hr(){let e=I(),t=te>0?e-te:0;if(te=e,ce){ce=false,_=1/0,Q=e;return}if(t<=0)return;t<cr&&(t<_&&(_=t),Q===0&&(Q=e),e-Q>=1e3&&(re.push(_),re.length>ur&&re.shift(),Ce=Math.max(dr,Math.min(...re)),_=1/0,Q=e));let r=t-Ce;r>1&&Ot(e-r,e)}function ot(){if(ee!=null)return;let e=le();te=I(),ce=false,re=[],_=1/0,Q=0,Ce=Te,ee=e.setInterval(hr,Te)}function it(){ee!=null&&(le().clearInterval(ee),ee=null),te=0}function fr(){ce=true}import{definePersistedSetting as mr}from"@buoy-gg/shared-ui/web";var pr="@react_buoy/js-top/prefs",gr={enabled:false},at=mr(pr,gr,{sanitize:e=>({enabled:e.enabled===true})});async function br(){return at.load()}async function yr(e){await at.save(e)}import{subscribeRealAppState as Mr}from"@buoy-gg/shared-ui/web";var wr=250,xr=class{constructor(){this.enabled=false;this.enabledLoaded=false;this.paused=false;this.remoteSampling=false;this.engineRunning=false;this.tiers={timers:false,promises:false,bridge:false,longtask:false};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=[];br().then(e=>{this.enabledLoaded=true,e.enabled&&!this.enabled&&this.setEnabled(true)})}subscribe(e){return this.subscribers.add(e),this.syncEngineState(),e(this.snapshot),()=>{this.subscribers.delete(e),this.syncEngineState()}}subscribeEnabled(e){return this.enabledSubscribers.add(e),e(this.enabled),()=>{this.enabledSubscribers.delete(e)}}setEnabled(e){this.enabled!==e&&(this.enabled=e,this.enabledLoaded&&yr({enabled:e}),this.enabledSubscribers.forEach(t=>{try{t(e)}catch(r){Y&&console.error("[js-top] enabled subscriber threw",r)}}),this.syncEngineState())}isEnabled(){return this.enabled}setRemoteSampling(e){this.remoteSampling!==e&&(this.remoteSampling=e,this.syncEngineState())}isRemoteSampling(){return this.remoteSampling}getStatus(){return this.engineRunning?this.paused?"paused":"running":"disabled"}pause(){this.paused||(this.paused=true,se(false),it(),this.emitSnapshot())}resume(){this.paused&&(this.paused=false,this.engineRunning&&(se(true),ot()),this.emitSnapshot())}clear(){ir(),Wt();for(let e of this.clearHooks)try{e()}catch{}this.emitSnapshot()}registerClearHook(e){this.clearHooks.push(e)}getSnapshot(){return this.snapshot}getOriginDetail(e){let t=I(),r=Je(t),n=this.freezeStatsProvider?.(Date.now())?.byOrigin[e];if(e==="unattributed"){let i=$t(t),a=Math.round(i.reduce((s,l)=>s+l,0)*10)/10;return{key:e,label:"unattributed (events / React / native call-ins)",api:"unattributed",promoted:false,scheduleCount:0,calls:0,totalMs:0,avgMs:0,maxMs:0,windowMs:a,pctOfBusy:r>0?Math.min(100,Math.round(a/r*1e3)/10):0,lastSeenAgoMs:0,buckets:i,freezes:n?.count??0,worstFreezeMs:Math.round(n?.maxMs??0)}}let o=or(e,t,r);return o?{...o,freezes:n?.count??0,worstFreezeMs:Math.round(n?.maxMs??0)}:null}registerTierInstaller(e){this.tierInstallers.push(e),this.engineRunning&&Object.assign(this.tiers,this.runInstaller(e))}registerLongtaskProvider(e){this.longtaskProvider=e}registerFreezeStatsProvider(e){this.freezeStatsProvider=e}shouldRun(){return this.subscribers.size>0||this.remoteSampling}syncEngineState(){let e=this.shouldRun();e&&!this.engineRunning?this.startEngine():!e&&this.engineRunning&&this.stopEngine()}runInstaller(e){try{return e()}catch(t){return Y&&console.error("[js-top] tier installer threw",t),{}}}startEngine(){this.engineRunning=true,rt(),nt(),this.tiers={timers:true,promises:false,bridge:false,longtask:false};for(let e of this.tierInstallers)Object.assign(this.tiers,this.runInstaller(e));se(!this.paused),this.paused||ot();try{this.appStateSub=Mr(()=>{fr()})}catch{this.appStateSub=null}this.notifyHandle=le().setInterval(()=>this.emitSnapshot(),wr),this.emitSnapshot()}stopEngine(){if(this.engineRunning=false,se(false),it(),this.notifyHandle!=null&&(le().clearInterval(this.notifyHandle),this.notifyHandle=null),this.appStateSub){try{this.appStateSub.remove()}catch{}this.appStateSub=null}}buildSnapshot(){let e=I(),t=Je(e),r=Lt(e),n=Math.max(0,t-r),o=nr(e,t,30);n>=1&&(o.push({key:"unattributed",label:"unattributed (events / React / native call-ins)",api:"unattributed",windowMs:Math.round(n*10)/10,pctOfBusy:t>0?Math.min(100,Math.round(n/t*1e3)/10):0,totalMs:0,calls:0,avgMs:0,maxMs:0,lastSeenAgoMs:0,freezes:0,worstFreezeMs:0}),o.sort((s,l)=>l.windowMs-s.windowMs||l.totalMs-s.totalMs));let i=this.freezeStatsProvider?.(Date.now())??{count:0,worstMs:0,byOrigin:{}};for(let s of o){let l=i.byOrigin[s.key];l&&(s.freezes=l.count,s.worstFreezeMs=Math.round(l.maxMs))}let a=5e3;return{ts:Date.now(),paused:this.paused,busyPct:Math.min(100,Math.round(t/a*1e3)/10),busyHistory:Dt(e),tiers:{...this.tiers},rows:o,totals:{attributedWindowMs:Math.round(r*10)/10,unattributedWindowMs:Math.round(n*10)/10,windowMs:a},freezeSummary:{count:i.count,worstMs:Math.round(i.worstMs)},longtasks:this.longtaskProvider?this.longtaskProvider():[]}}emitSnapshot(){this.snapshot=this.buildSnapshot(),this.subscribers.forEach(e=>{try{e(this.snapshot)}catch(t){Y&&console.error("[js-top] snapshot subscriber threw",t)}})}isEngineActive(){return V()}},u=new xr;function ze(e,t){let r=e[t];if(typeof r!="function")return false;if(r[v])return true;let n=function(...o){for(let i=0;i<o.length;i++)typeof o[i]=="function"&&(o[i]=K(o[i],"then"));return r.apply(this,o)};return n[v]=true,Object.defineProperty(n,"name",{value:t,configurable:true}),e[t]=n,true}function Sr(){let e=h.Promise?.prototype;if(!e)return{promises:false};let t=ze(e,"then");return ze(e,"catch"),ze(e,"finally"),{promises:t}}function vr(){let e=h.__fbBatchedBridge;if(!e)return{bridge:false};let t=false;if(typeof e.callFunctionReturnFlushedQueue=="function"&&!e.callFunctionReturnFlushedQueue[v]){let n=e.callFunctionReturnFlushedQueue.bind(e),o=function(i,a,s){return V()?tt("bridge",`${i}.${a}`,()=>n(i,a,s)):n(i,a,s)};o[v]=true,e.callFunctionReturnFlushedQueue=o,t=true}if(typeof e.invokeCallbackAndReturnFlushedQueue=="function"&&!e.invokeCallbackAndReturnFlushedQueue[v]){let n=e.invokeCallbackAndReturnFlushedQueue.bind(e),o=function(i,a){return V()?tt("bridge","nativeModuleCallback",()=>n(i,a)):n(i,a)};o[v]=true,e.invokeCallbackAndReturnFlushedQueue=o,t=true}let r=e.callFunctionReturnFlushedQueue?.[v]===true;return{bridge:t||r}}var kr=40,Tr=6e4,Cr="unattributed",st=false,ue=false,G=[];function zr(e,t){let r=e+t,n=null,o=0;for(let i of lr()){if(!i)continue;let a=Math.min(r,i.end)-Math.max(e,i.start);a>o&&(o=a,n=i.originKey)}return n}function Ar(){if(st)return{longtask:ue};st=true;let e=h.PerformanceObserver;if(typeof e!="function")return{longtask:false};try{new e(t=>{if(V())try{for(let r of t.getEntries()){if(r.entryType!=="longtask")continue;let n=r.startTime,o=r.duration;Pt(n,n+o),G.push({start:n,duration:o,at:Date.now(),originKey:zr(n,o)}),G.length>kr&&G.shift()}}catch{}}).observe({entryTypes:["longtask"]}),ue=true}catch{ue=false}return{longtask:ue}}function Rr(){return G.map(e=>({start:e.start,duration:e.duration,at:e.at,originLabel:e.originKey?rr(e.originKey):null}))}function Br(e){let t={},r=0,n=0;for(let o of G){if(o.at>0&&e-o.at>Tr)continue;r++,o.duration>n&&(n=o.duration);let i=o.originKey??Cr,a=t[i];a?(a.count++,o.duration>a.maxMs&&(a.maxMs=o.duration)):t[i]={count:1,maxMs:o.duration}}return{count:r,worstMs:n,byOrigin:t}}function Er(){G.length=0}var Fr={version:1,getSnapshot:()=>({live:u.getSnapshot(),enabled:u.isEnabled()||u.isRemoteSampling()}),subscribe:e=>{let t=u.subscribe(()=>e()),r=u.subscribeEnabled(()=>e());return()=>{t(),r()}},actions:{setEnabled:e=>{let t=e.enabled;u.setRemoteSampling(t)},pause:()=>u.pause(),resume:()=>u.resume(),clear:()=>u.clear(),getOriginDetail:e=>u.getOriginDetail(e.key),sample:async e=>{let t=e,r=Math.min(Math.max(t?.durationMs??3e3,250),3e4),n=u.isRemoteSampling()||u.isEnabled();n||u.setRemoteSampling(true),t?.clearFirst&&u.clear();try{return await new Promise(o=>setTimeout(o,r)),u.getSnapshot()}finally{n||u.setRemoteSampling(false)}}}};import{useCallback as Or,useEffect as Ir,useMemo as Pr,useState as lt}from"react";var ct={};At(ct,{AccessibilityInfo:()=>Wr,ActivityIndicator:()=>Pn,Alert:()=>Dn,Animated:()=>Hr,AppRegistry:()=>jr,AppState:()=>Nr,Appearance:()=>Vr,BackHandler:()=>qr,Button:()=>Ln,CheckBox:()=>sn,Clipboard:()=>Ur,DeviceEventEmitter:()=>vn,Dimensions:()=>Jr,Easing:()=>Kr,FlatList:()=>ln,I18nManager:()=>_r,Image:()=>cn,ImageBackground:()=>un,InteractionManager:()=>Gr,Keyboard:()=>Qr,KeyboardAvoidingView:()=>dn,LayoutAnimation:()=>Yr,Linking:()=>Zr,LogBox:()=>Sn,Modal:()=>On,NativeEventEmitter:()=>Xr,NativeModules:()=>Dr,PanResponder:()=>en,Picker:()=>hn,PixelRatio:()=>tn,Platform:()=>rn,Pressable:()=>Fn,ProgressBar:()=>fn,RefreshControl:()=>mn,SafeAreaView:()=>pn,ScrollView:()=>Ae,SectionList:()=>gn,Share:()=>nn,StatusBar:()=>bn,StyleSheet:()=>W,Switch:()=>In,Text:()=>c,TextInput:()=>Rn,Touchable:()=>yn,TouchableHighlight:()=>Bn,TouchableNativeFeedback:()=>Mn,TouchableOpacity:()=>ne,TouchableWithoutFeedback:()=>En,UIManager:()=>on,Vibration:()=>an,View:()=>p,VirtualizedList:()=>wn,YellowBox:()=>xn,findNodeHandle:()=>$n,unstable_createElement:()=>$r,useColorScheme:()=>kn,useLocaleContext:()=>Tn,useWindowDimensions:()=>Cn});Rt(ct,Lr);import*as Lr from"react-native-web";import{unstable_createElement as $r,NativeModules as Dr,AccessibilityInfo as Wr,Animated as Hr,Appearance as Vr,AppRegistry as jr,AppState as Nr,BackHandler as qr,Clipboard as Ur,Dimensions as Jr,Easing as Kr,I18nManager as _r,Keyboard as Qr,InteractionManager as Gr,LayoutAnimation as Yr,Linking as Zr,NativeEventEmitter as Xr,PanResponder as en,PixelRatio as tn,Platform as rn,Share as nn,StyleSheet as W,UIManager as on,Vibration as an,CheckBox as sn,FlatList as ln,Image as cn,ImageBackground as un,KeyboardAvoidingView as dn,Picker as hn,ProgressBar as fn,RefreshControl as mn,SafeAreaView as pn,SectionList as gn,StatusBar as bn,Touchable as yn,TouchableNativeFeedback as Mn,VirtualizedList as wn,YellowBox as xn,LogBox as Sn,DeviceEventEmitter as vn,useColorScheme as kn,useLocaleContext as Tn,useWindowDimensions as Cn}from"react-native-web";import*as A from"react-native-web";import{createElement as zn,forwardRef as An}from"react";function E(e){let t=An((n,o)=>{let{accessibilityState:i,accessibilityValue:a,...s}=n;for(let l of["busy","checked","disabled","expanded","selected"])i?.[l]!==void 0&&s[`aria-${l}`]===void 0&&(s[`aria-${l}`]=i[l]);for(let[l,d]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))a?.[l]!==void 0&&s[`aria-${d}`]===void 0&&(s[`aria-${d}`]=a[l]);return zn(e,{...s,ref:o})}),r=e.State;return r&&Object.assign(t,{State:r}),t.displayName=e.displayName??e.name??"NativeWebView",t}var p=E(A.View),c=E(A.Text),Rn=E(A.TextInput),ne=E(A.TouchableOpacity),Bn=E(A.TouchableHighlight),En=E(A.TouchableWithoutFeedback),Fn=E(A.Pressable),Ae=E(A.ScrollView),On=E(A.Modal),In=E(A.Switch),Pn=E(A.ActivityIndicator),Ln=E(A.Button),$n=A.findNodeHandle,Dn={alert(e,t,r,n){if(typeof document>"u")return;let o=document.createElement("dialog");o.dataset.buoyRoot="",o.setAttribute("aria-label",e),o.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",o.appendChild(i),t){let d=document.createElement("p");d.textContent=t,d.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",o.appendChild(d)}let a=document.createElement("div");a.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let s=r?.length?r:[{text:"OK"}],l=()=>{o.close?.(),o.remove()};for(let d of s){let f=document.createElement("button");f.type="button",f.textContent=d.text??"OK",f.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${d.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,f.onclick=()=>{l(),d.onPress?.()},a.appendChild(f)}o.addEventListener("cancel",d=>{d.preventDefault(),n?.cancelable!==false&&(l(),n?.onDismiss?.())}),o.appendChild(a),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};import{Activity as Wn,JsModal as Hn,macOSColors as O,night as z,ModalHeader as oe,Pause as Vn,Play as jn,Trash2 as Nn}from"@buoy-gg/shared-ui/web";import{memo as qn}from"react";import{macOSColors as Re}from"@buoy-gg/shared-ui/web";import{jsx as ut}from"react/jsx-runtime";var Un=60;function Jn(e){return e>=80?Re.semantic.error:e>=40?Re.semantic.warning:Re.semantic.success}var Kn=qn(function({history:e}){let t=e.slice(-Un);return ut(p,{style:dt.row,pointerEvents:"none",children:t.map((r,n)=>ut(p,{style:[dt.bar,{height:Math.max(2,r/100*28),backgroundColor:Jn(r)}]},`b${n}`))})}),dt=W.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 _n,useState as Qn}from"react";import{macOSColors as de,night as S}from"@buoy-gg/shared-ui/web";import{jsx as R,jsxs as L}from"react/jsx-runtime";var Gn=[{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 Be(e){return ht[e]??ht.other}function ft(e){if(e.api==="unattributed")return"events \xB7 React \xB7 native call-ins";if(e.api==="other")return"evicted cold origins";let t=Be(e.api).prefix,r=e.label;return t&&r.startsWith(t)&&(r=r.slice(t.length)),r=r.replace(/^[\s←@]+/,"").trim(),r.length>0?r:"anonymous"}function ie(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 Yn(e){return e.calls<=0?"measured by probe \xB7 not reachable from JS":`${ie(e.calls)} calls \xB7 avg ${ie(e.avgMs)} \xB7 max ${ie(e.maxMs)} \xB7 total ${ie(e.totalMs)} ms`}var Zn=_n(function({row:e,rank:t,onPress:r}){let n=Be(e.api);return L(r?ne:p,{style:C.row,...r?{onPress:()=>r(e),activeOpacity:.6}:{},children:[L(p,{style:C.topLine,children:[R(c,{style:C.rank,children:t}),R(p,{style:[C.badge,{borderColor:n.color,backgroundColor:`${n.color}1A`}],children:R(c,{style:[C.badgeText,{color:n.color}],children:n.text})}),R(c,{style:C.name,numberOfLines:1,children:ft(e)}),e.freezes>0&&L(c,{style:[C.freezeBadge,e.worstFreezeMs>=100&&C.freezeBadgeSevere],children:["\u26A0 \xD7",e.freezes]}),L(c,{style:[C.windowMs,e.api!=="unattributed"&&e.pctOfBusy>=25&&{color:e.pctOfBusy>=50?de.semantic.error:de.semantic.warning}],children:[ie(e.windowMs),R(c,{style:C.unit,children:" ms"})]}),L(c,{style:[C.pct,e.api==="unattributed"&&C.pctMuted],children:[Math.round(e.pctOfBusy),"%"]})]}),L(p,{style:C.subLine,children:[R(p,{style:C.barTrack,children:R(p,{style:[C.barFill,{width:`${Math.min(100,e.pctOfBusy)}%`,backgroundColor:n.color}]})}),R(c,{style:C.stats,numberOfLines:1,children:Yn(e)})]})]})},(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 Xn({rows:e,onSelectRow:t}){let[r,n]=Qn("windowMs"),o=r==="windowMs"?e:[...e].sort((i,a)=>a[r]-i[r]);return L(p,{style:$.root,children:[L(p,{style:$.sortRow,children:[R(c,{style:$.sortLabel,children:"SORT"}),Gn.map(i=>R(ne,{onPress:()=>n(i.key),style:[$.sortChip,r===i.key&&$.sortChipOn],children:R(c,{style:[$.sortChipText,r===i.key&&$.sortChipTextOn],children:i.title})},i.key))]}),L(Ae,{style:$.body,children:[o.map((i,a)=>R(Zn,{row:i,rank:a+1,onPress:t},i.key)),o.length===0&&R(c,{style:$.empty,children:"No tasks observed yet \u2014 interact with the app."})]})]})}var $=W.create({root:{flex:1,minHeight:0},sortRow:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,borderBottomWidth:1,borderBottomColor:S.color.border,backgroundColor:S.color.surface},sortLabel:{color:S.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginRight:2},sortChip:{borderWidth:1,borderColor:S.color.border,borderRadius:4,paddingHorizontal:7,paddingVertical:3},sortChipOn:{borderColor:S.color.accentBorderStrong,backgroundColor:S.color.accentSoft},sortChipText:{color:S.color.textTertiary,fontSize:9,fontWeight:"600",fontVariant:["tabular-nums"]},sortChipTextOn:{color:S.color.accent},body:{flex:1},empty:{color:S.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:24}}),C=W.create({row:{paddingHorizontal:10,paddingVertical:8,borderBottomWidth:W.hairlineWidth,borderBottomColor:S.color.border,gap:5},topLine:{flexDirection:"row",alignItems:"center",gap:6},rank:{width:16,color:S.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:S.color.text,fontSize:13,fontWeight:"500"},freezeBadge:{color:de.semantic.warning,fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},freezeBadgeSevere:{color:de.semantic.error},windowMs:{color:S.color.text,fontSize:13,fontWeight:"700",fontVariant:["tabular-nums"]},unit:{color:S.color.textTertiary,fontSize:10,fontWeight:"400"},pct:{width:38,textAlign:"right",color:S.color.textSecondary,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},pctMuted:{color:S.color.textTertiary},subLine:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:22},barTrack:{width:72,height:4,borderRadius:2,backgroundColor:S.color.fillSecondary,overflow:"hidden"},barFill:{height:4,borderRadius:2,opacity:.85},stats:{flex:1,color:S.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]}});import{memo as eo}from"react";import{macOSColors as he,night as k,useSafeAreaInsets as to}from"@buoy-gg/shared-ui/web";import{Fragment as mt,jsx as M,jsxs as B}from"react/jsx-runtime";var pt={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 ro(e){return pt[e]??pt.other}function j(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 no(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 H({label:e,value:t,accent:r}){return B(p,{style:g.stat,children:[M(c,{style:g.statLabel,children:e}),M(c,{style:[g.statValue,r?{color:r}:null],children:t})]})}var oo=eo(function({detail:e}){let t=Be(e.api),r=to({minBottom:12}),n=Math.max(1,...e.buckets);return B(Ae,{style:g.root,contentContainerStyle:{paddingBottom:r.bottom},children:[B(p,{style:g.identityRow,children:[M(p,{style:[g.badge,{borderColor:t.color,backgroundColor:`${t.color}1A`}],children:M(c,{style:[g.badgeText,{color:t.color}],children:t.text})}),M(c,{style:g.name,numberOfLines:2,children:ft(e)})]}),M(c,{style:g.explainer,children:ro(e.api)}),M(c,{style:g.sectionTitle,children:"ACTIVITY \xB7 LAST 5S"}),M(p,{style:g.chartRow,children:e.buckets.map((o,i)=>M(p,{style:g.chartBarSlot,children:M(p,{style:[g.chartBar,{height:Math.max(2,o/n*44),backgroundColor:t.color}]})},`bk${i}`))}),B(p,{style:g.chartLegend,children:[B(c,{style:g.chartLegendText,children:[j(e.windowMs)," ms in window \xB7 ",e.pctOfBusy.toFixed(1),"% of busy time"]}),B(c,{style:g.chartLegendText,children:["peak ",j(n)," ms/250ms"]})]}),M(c,{style:g.sectionTitle,children:"STATS \xB7 SINCE START"}),B(p,{style:g.statGrid,children:[M(H,{label:"RUNS",value:e.calls>0?j(e.calls):"\u2014"}),M(H,{label:"SCHEDULED",value:e.scheduleCount>0?j(e.scheduleCount):"\u2014"}),M(H,{label:"AVG / RUN",value:e.calls>0?`${j(e.avgMs)} ms`:"\u2014"}),M(H,{label:"MAX / RUN",value:e.maxMs>0?`${j(e.maxMs)} ms`:"\u2014",accent:e.maxMs>=50?he.semantic.warning:void 0}),M(H,{label:"TOTAL",value:e.totalMs>0?`${j(e.totalMs)} ms`:"\u2014"}),M(H,{label:"LAST RUN",value:no(e.lastSeenAgoMs)}),M(H,{label:"FREEZES \xB7 60S",value:e.freezes>0?`${e.freezes}`:"0",accent:e.freezes>0?he.semantic.error:void 0}),M(H,{label:"WORST FREEZE",value:e.worstFreezeMs>0?`${e.worstFreezeMs} ms`:"\u2014",accent:e.worstFreezeMs>=100?he.semantic.error:e.worstFreezeMs>0?he.semantic.warning:void 0})]}),(e.caller||(e.frames?.length??0)>0)&&B(mt,{children:[M(c,{style:g.sectionTitle,children:"SCHEDULED FROM"}),B(p,{style:g.siteCard,children:[e.caller&&B(c,{style:g.siteCaller,children:[e.caller,"()"]}),e.file&&B(c,{style:g.siteFile,children:[e.file,e.line!=null?`:${e.line}`:""]}),e.frames?.map((o,i)=>B(c,{style:g.siteFrame,numberOfLines:1,children:[o.file,":",o.line,":",o.col]},`fr${i}`)),M(c,{style:g.siteNote,children:"Frames are bundle offsets (Hermes) \u2014 the caller name above is the readable part. Captured once when this origin got hot."})]})]}),!e.caller&&(e.frames?.length??0)===0&&e.api!=="unattributed"&&e.api!=="other"&&B(mt,{children:[M(c,{style:g.sectionTitle,children:"SCHEDULED FROM"}),M(c,{style:g.sitePending,children:e.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."})]})]})}),g=W.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:k.color.text,fontSize:15,fontWeight:"600"},explainer:{color:k.color.textTertiary,fontSize:11,lineHeight:15,marginTop:6,marginBottom:4},sectionTitle:{color:k.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginTop:14,marginBottom:6},chartRow:{flexDirection:"row",alignItems:"flex-end",height:48,gap:2,backgroundColor:k.color.surface,borderRadius:6,borderWidth:1,borderColor:k.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:k.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},statGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},stat:{width:"23%",minWidth:76,flexGrow:1,backgroundColor:k.color.surface,borderWidth:1,borderColor:k.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:6},statLabel:{color:k.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.4,marginBottom:3},statValue:{color:k.color.text,fontSize:13,fontWeight:"600",fontVariant:["tabular-nums"]},siteCard:{backgroundColor:k.color.surface,borderWidth:1,borderColor:k.color.border,borderRadius:6,padding:10,gap:3},siteCaller:{color:k.color.text,fontSize:13,fontWeight:"600"},siteFile:{color:k.color.info,fontSize:11},siteFrame:{color:k.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},siteNote:{color:k.color.textTertiary,fontSize:9,opacity:.8,marginTop:4},sitePending:{color:k.color.textTertiary,fontSize:11}});import{Fragment as io,jsx as y,jsxs as D}from"react/jsx-runtime";function gt(e){return e>=80?O.semantic.error:e>=40?O.semantic.warning:O.semantic.success}function Ee(e){return e>=100?O.semantic.error:O.semantic.warning}function ao(e){let t=e.rows.find(r=>r.api!=="unattributed"&&r.api!=="other");return t&&t.pctOfBusy>=25&&e.busyPct>=15?{color:t.pctOfBusy>=50?O.semantic.error:O.semantic.warning,icon:"\u25B2",text:`${t.label} is eating ${Math.round(t.pctOfBusy)}% of thread time \u2014 start there.`}:e.freezeSummary.count>0?{color:Ee(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:O.semantic.warning,icon:"\u25B2",text:"Thread saturated by UI/React work \u2014 open Highlight Updates to find re-renders."}:{color:O.semantic.success,icon:"\u25CF",text:`Thread healthy at ${Math.round(e.busyPct)}% load \u2014 nothing worth chasing.`}}function bt({visible:e,onClose:t,onBack:r,onMinimize:n,initialModalState:o,minimizeTargetPosition:i,remoteSnapshot:a,remoteActions:s,embedded:l=false}){let d=a!==void 0,[f,F]=lt(null);Ir(()=>{if(!(d||!e))return u.subscribe(F)},[d,e]);let m=d?a:f,b=Pr(()=>s??{pause:()=>u.pause(),resume:()=>u.resume(),clear:()=>u.clear()},[s]),x=m?.paused??false,fe=(m?.rows.length??0)>0,[me,Le]=lt(null),kt=Or(N=>Le(N.key),[]),$e=!d&&me?u.getOriginDetail(me):null,De=me!==null,We=D(oe,{children:[De?y(oe.Navigation,{onBack:()=>Le(null)}):r?y(oe.Navigation,{onBack:r}):null,y(oe.Content,{title:"",noMargin:true,children:D(p,{style:w.titleRow,children:[y(Wn,{size:14,color:"#34D399"}),y(c,{style:w.title,children:"JS Top"}),m&&y(p,{style:[w.busyPill,{borderColor:gt(m.busyPct)}],children:D(c,{style:[w.busyText,{color:gt(m.busyPct)}],children:[m.busyPct.toFixed(0),"% BUSY"]})}),m&&m.freezeSummary.count>0&&y(p,{style:[w.busyPill,{borderColor:Ee(m.freezeSummary.worstMs)}],children:D(c,{style:[w.busyText,{color:Ee(m.freezeSummary.worstMs)}],children:["\u26A0 ",m.freezeSummary.count," \xB7"," ",m.freezeSummary.worstMs,"ms"]})})]})}),D(oe.Actions,{children:[y(ne,{onPress:x?b.resume:b.pause,style:[w.actionBtn,x&&w.actionBtnActive],accessibilityLabel:x?"Resume sampling":"Pause sampling",children:x?y(jn,{size:14,color:z.color.accent}):y(Vn,{size:14,color:z.color.textSecondary})}),y(ne,{onPress:b.clear,disabled:!fe,style:[w.actionBtn,!fe&&w.actionBtnDisabled],accessibilityLabel:"Clear stats",children:y(Nn,{size:14,color:fe?z.color.textTertiary:z.color.textTertiary})})]})]}),He=y(p,{style:w.body,children:De?$e?y(oo,{detail:$e}):y(c,{style:w.waiting,children:"This origin is no longer tracked (cleared or evicted)."}):m?D(io,{children:[(()=>{let N=ao(m);return D(p,{style:[w.diagnosis,{borderLeftColor:N.color}],children:[y(c,{style:[w.diagnosisIcon,{color:N.color}],children:N.icon}),y(c,{style:w.diagnosisText,children:N.text})]})})(),D(p,{style:w.sparklineRow,children:[y(c,{style:w.sparklineCaption,children:"JS THREAD LOAD \xB7 LAST 30s"}),y(Kn,{history:m.busyHistory})]}),!m.tiers.bridge&&y(c,{style:w.tierBanner,children:"\u201CSystem\u201D rows are UI/React/native work pure JS can\u2019t name \u2014 timers, rAF and Promise chains are fully attributed."}),y(Xn,{rows:m.rows,onSelectRow:d?void 0:kt})]}):y(c,{style:w.waiting,children:d?"Waiting for device\u2026":"Starting engine\u2026"})});return l?D(p,{style:w.embeddedRoot,children:[y(p,{style:w.embeddedHeader,children:We}),He]}):y(Hn,{visible:e,onClose:t,onMinimize:n,minimizeTargetPosition:i,initialModalState:o,header:{showToggleButton:true,customContent:We},persistenceKey:"buoy-js-top-modal",enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:He})}var w=W.create({titleRow:{flexDirection:"row",alignItems:"center",gap:8},title:{color:z.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:z.color.buttonSurface,borderWidth:1,borderColor:z.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:z.color.accentSoft,borderColor:z.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:z.color.surface,borderRadius:6,borderLeftWidth:3},diagnosisIcon:{fontSize:11,fontWeight:"700"},diagnosisText:{flex:1,color:z.color.text,fontSize:12,lineHeight:16},sparklineRow:{paddingHorizontal:10,paddingVertical:8,gap:4},sparklineCaption:{color:z.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.5},tierBanner:{color:z.color.textTertiary,fontSize:10,paddingHorizontal:10,paddingBottom:6},waiting:{color:z.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:32},embeddedRoot:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:O.background.base},embeddedHeader:{borderBottomWidth:1,borderBottomColor:O.border.default}});import{useEffect as yt,useState as Mt}from"react";import{macOSColors as Fe,night as Oe}from"@buoy-gg/shared-ui/web";import{jsx as so,jsxs as wt}from"react/jsx-runtime";function lo(e){return e>=80?Fe.semantic.error:e>=40?Fe.semantic.warning:Fe.semantic.success}function co(){let[e,t]=Mt(()=>u.isEnabled()),[r,n]=Mt(null);if(yt(()=>u.subscribeEnabled(t),[]),yt(()=>{if(!e){n(null);return}return u.subscribe(n)},[e]),!e||!r)return null;let o=r.rows.find(i=>i.api!=="unattributed");return wt(p,{style:Ie.pill,pointerEvents:"none",children:[wt(c,{style:[Ie.busy,{color:lo(r.busyPct)}],children:[r.busyPct.toFixed(0),"%"]}),o&&so(c,{style:Ie.label,numberOfLines:1,children:o.label})]})}var Ie=W.create({pill:{position:"absolute",top:60,left:8,flexDirection:"row",alignItems:"center",gap:6,backgroundColor:Oe.color.buttonSurface,borderWidth:1,borderColor:Oe.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:4,maxWidth:220},busy:{fontSize:11,fontWeight:"700",fontVariant:["tabular-nums"]},label:{color:Oe.color.textSecondary,fontSize:10,flexShrink:1}});import{useEffect as uo,useState as ho}from"react";import{Activity as xt}from"@buoy-gg/shared-ui/web";import{jsx as St}from"react/jsx-runtime";var Pe="#34D399",vt="#6B7280";function fo({size:e}){let[t,r]=ho(()=>u.isEnabled());return uo(()=>u.subscribeEnabled(r),[]),St(xt,{size:e,color:t?Pe:vt})}function mo(){return null}var po={id:"js-top",name:"JS TOP",description:"Toggle the floating JS-thread busy pill",slot:"row",icon:fo,component:mo,props:{},launchMode:"toggle-only",onPress:()=>{u.setEnabled(!u.isEnabled())}},go={id:"js-top-modal",name:"TASKS",description:"Live Task Manager for the JS thread",slot:"both",icon:({size:e})=>St(xt,{size:e,color:Pe}),component:bt,props:{enableSharedModalDimensions:false}};u.registerTierInstaller(Sr);u.registerTierInstaller(vr);u.registerTierInstaller(Ar);u.registerLongtaskProvider(Rr);u.registerFreezeStatsProvider(Br);u.registerClearHook(Er);try{typeof window<"u"&&(rt(),nt())}catch{}export{vt as JS_TOP_DISABLED_COLOR,Pe as JS_TOP_ENABLED_COLOR,u as JsTopController,co as JsTopHudOverlay,bt as JsTopModal,go as jsTopModalPreset,po as jsTopPreset,Fr as jsTopSyncAdapter};
|
|
1
|
+
"use client";var Te=Object.defineProperty;var Ar=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var zr=Object.prototype.hasOwnProperty;var s=(e,t)=>Te(e,"name",{value:t,configurable:true});var Br=(e,t)=>{for(var r in t)Te(e,r,{get:t[r],enumerable:true})},at=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Er(t))!zr.call(e,o)&&o!==r&&Te(e,o,{get:()=>t[o],enumerable:!(n=Ar(t,o))||n.enumerable});return e},Rr=(e,t,r)=>(at(e,t,"default"),r&&at(r,t,"default"));var ee=(()=>{try{let e=globalThis.Capacitor;if(e&&typeof e.isNativePlatform=="function"&&e.isNativePlatform())return e.DEBUG===true}catch{}return process.env.NODE_ENV!=="production"})();typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);var ce=typeof globalThis<"u"?globalThis:void 0,Or=(()=>{if(typeof ce?.nativePerformanceNow=="function"){let e=ce.nativePerformanceNow;return()=>e()}if(typeof ce?.performance?.now=="function"){let e=ce.performance;return()=>e.now()}return()=>Date.now()})(),Pr=Or;function I(){return Pr()}s(I,"now");var f=typeof globalThis<"u"?globalThis:{},it=false;function V(){return it}s(V,"isActive");function te(e){it=e}s(te,"setActive");var Ce=null;function de(){return Ce||(Ce={setTimeout:f.setTimeout?.bind(f),setInterval:f.setInterval?.bind(f),clearInterval:f.clearInterval?.bind(f),clearTimeout:f.clearTimeout?.bind(f),setImmediate:f.setImmediate?.bind(f),requestAnimationFrame:f.requestAnimationFrame?.bind(f),queueMicrotask:f.queueMicrotask?.bind(f)}),Ce}s(de,"captureOriginals");function re(){return de()}s(re,"getOriginals");var k=Symbol.for("buoy.jsTop.patched"),st=Symbol.for("buoy.jsTop.wrapped");var q=new Float64Array(120),ne=new Float64Array(120),Ae=new Float64Array(120),U=new Float64Array(120).fill(-1);function L(e){return Math.floor(e/250)}s(L,"epochOf");function lt(e){let t=e%120;return U[t]!==e&&(U[t]=e,q[t]=0,ne[t]=0,Ae[t]=0),t}s(lt,"slotFor");function he(e,t,r){if(!(t>e))return;let n=Math.max(e,t-3e4),o=L(n),a=L(t),i=n;for(;o<=a;){let l=(o+1)*250,c=Math.min(t,l),d=c-i;d>0&&r(lt(o),d),i=c,o++}}s(he,"distribute");function ut(e,t){he(e,t,(r,n)=>{q[r]=Math.min(250,q[r]+n)})}s(ut,"bookBusyRange");function ct(e,t,r){let n=t-e;if(!(n>0)||!(r>0))return;let o=Math.min(1,r/n);he(e,t,(a,i)=>{ne[a]=Math.min(250,ne[a]+i*o)})}s(ct,"bookAttributedRange");function dt(e,t){he(e,t,(r,n)=>{Ae[r]=Math.min(250,Ae[r]+n)})}s(dt,"bookLongtaskRange");function Ee(e,t,r){let n=L(t),o=0;for(let a=n-r+1;a<=n;a++){let i=a%120;i>=0&&U[i]===a&&(o+=e[i])}return o}s(Ee,"sumWindow");function ze(e){return Ee(q,e,20)}s(ze,"windowBusyMs");function ht(e){return Ee(ne,e,20)}s(ht,"windowAttributedMs");function mt(e){let t=L(e),r=[];for(let n=t-20+1;n<=t;n++){let o=n%120;o>=0&&U[o]===n?r.push(Math.max(0,Math.round((q[o]-ne[o])*10)/10)):r.push(0)}return r}s(mt,"windowResidualBuckets");function ft(e){let t=L(e),r=[];for(let o=t-120+1;o<=t;o++){let a=o%120;a>=0&&U[a]===o?r.push(Math.round(q[a]/250*100)):r.push(0)}let n=0;for(;n<r.length&&r[n]===0;)n++;return r.slice(Math.max(0,Math.min(n,r.length-1)))}s(ft,"busyHistory");function pt(){U.fill(-1)}s(pt,"resetAggregator");import{buoyFetch as bt}from"@buoy-gg/shared-ui/web";var Fr=3,Be=0;function gt(){return typeof ee<"u"&&ee}s(gt,"isDev");var Ir="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lr=new Map([...Ir].map((e,t)=>[e,t]));function yt(e){let t=[],r=0,n=0,o=0,a=0;for(let i of e.split(";")){let l=[],c=0;for(let d of i.split(",")){if(!d)continue;let u=[],C=0,p=0;for(let y of d){let S=Lr.get(y);if(S===void 0)break;C+=(S&31)<<p,S&32?p+=5:(u.push(C&1?-(C>>1):C>>1),C=0,p=0)}u.length&&(c+=u[0],u.length===1?l.push([c]):u.length>=4&&(r+=u[1],n+=u[2],o+=u[3],u.length>=5?(a+=u[4],l.push([c,r,n,o,a])):l.push([c,r,n,o])))}t.push(l)}return t}s(yt,"decodeMappings");function wt(e,t,r){let n=e.lines[t-1];if(!n?.length)return null;let o;for(let i of n)if(i[0]<=r-1)o=i;else break;if(!o||o.length<4)return null;let a=e.sources[o[1]];return a?{file:a,line:o[2]+1,name:o.length>=5?e.names[o[4]]:void 0}:null}s(wt,"lookup");var Mt=new Map;function xt(e){let t=Mt.get(e);return t||(t=(async()=>{let r=await(await bt(e)).text(),n=Math.max(r.lastIndexOf("//# sourceMappingURL="),r.lastIndexOf("//@ sourceMappingURL="));if(n<0)return null;let o=/^\/\/[#@]\s*sourceMappingURL=(\S+)/.exec(r.slice(n));if(!o)return null;let a=new URL(o[1],e).href,i=await(await bt(a)).json();return!i.mappings||!i.sources?null:{sources:i.sources,names:i.names??[],lines:yt(i.mappings)}})().catch(()=>null),Mt.set(e,t)),t}s(xt,"loadMap");function St(e){return(e.split("?")[0]??e).split("/").filter(Boolean).slice(-2).join("/")}s(St,"tailPath");function vt(e){return/^[A-Z][A-Za-z0-9]*$/.test(e)}s(vt,"looksLikeComponent");function kt(e,t){if(!gt()||e.symbolicated||!e.frames||e.frames.length===0||Be>=Fr)return;e.symbolicated=true;let r=e.frames.filter(n=>/^(https?|capacitor|file):\/\//.test(n.file));r.length&&(Be++,(async()=>{for(let n of r){let o=await xt(n.file.split("?")[0]??n.file);if(!o)continue;let a=wt(o,n.line,n.col);if(!a||a.file.includes("node_modules"))continue;let i=St(a.file);e.file=i,e.line=a.line;let l=`${i.split("/").pop()}:${a.line}`;a.name&&vt(a.name)&&!e.caller?(e.caller=a.name,e.label=`${e.label} \u2190 <${a.name}> \xB7 ${l}`):e.label=`${e.label} \xB7 ${l}`;return}})().catch(()=>{}).finally(()=>{Be--}))}s(kt,"buoyJsTopSymbolicateOrigin");var $r=500,Dr=20,A=new Map,Tt="other",Ct=0,Re=0;function me(e,t,r){return{key:e,api:t,label:r,calls:0,totalMs:0,maxMs:0,scheduleCount:0,lastSeenAt:0,promoted:false,lastCaptureAt:0,ring:new Float64Array(20),ringStamps:new Float64Array(20).fill(-1)}}s(me,"makeOrigin");function Oe(e,t){let r=L(t),n=0;for(let o=r-20+1;o<=r;o++){let a=o%20;a>=0&&e.ringStamps[a]===o&&(n+=e.ring[a])}return n}s(Oe,"windowMsOf");function Pe(e){let t=null,r=1/0;for(let o of A.values()){if(o.key===Tt)continue;let a=Oe(o,e)*1e6+o.lastSeenAt;a<r&&(r=a,t=o)}if(!t)return;let n=At(Tt,"other","other (evicted origins)");n.calls+=t.calls,n.totalMs+=t.totalMs,n.maxMs=Math.max(n.maxMs,t.maxMs),n.lastSeenAt=Math.max(n.lastSeenAt,t.lastSeenAt),A.delete(t.key)}s(Pe,"evictColdest");function At(e,t,r){let n=A.get(e);return n||(n=me(e,t,r),A.set(e,n)),n}s(At,"getOrCreate");function Et(e){let t=[],r,n=e.split(`
|
|
2
|
+
`);for(let o of n){let a=/at\s+(.*?)\s+\((?:address at\s+)?(.*?):(\d+):(\d+)\)/.exec(o)??/at\s+()(.*?):(\d+):(\d+)$/.exec(o.trim())??/^([^@\s]*)@(.+?):(\d+):(\d+)$/.exec(o.trim());if(!a)continue;let i=a[1]??"";if(i.includes("buoyJsTop")||i==="Error"||a[2]?.includes("/js-top/"))continue;t.push({file:a[2]??"",line:Number(a[3]),col:Number(a[4])});let l=/^(react_stack_bottom_frame|runWithFiberInDEV|commitHookEffectList|flushPassive|performWork|renderWithHooks|safelyCall)/.test(i)||/^(then|catch|finally|resolve|reject|fulfilled|rejected|step|tryCallOne|tryCallTwo|tryCatch|invokeCallback|notify)$/.test(i);if(!r&&i&&i!=="anonymous"&&!l&&(r=i),t.length>=3)break}return{caller:r,frames:t}}s(Et,"parseStack");function zt(e,t){return t-e.lastCaptureAt<$r||(t-Ct>1e3&&(Ct=t,Re=0),Re>=Dr)?false:(Re++,e.lastCaptureAt=t,true)}s(zt,"allowCapture");function fe(e){if(!e)return;let t=(e.split("?")[0]??e).replace(/\/\/&.*$/,""),r=/^[a-z]+:\/\/[^/]+\/(.*)$/.exec(t);return(r?r[1]:t).split("/").slice(-2).join("/")}s(fe,"shortFile");function Bt(e){return A.has(e)}s(Bt,"buoyJsTopOriginExists");function pe(e,t,r,n=true){let o=t,a=typeof o.displayName=="string"&&o.displayName||typeof o.name=="string"&&o.name||"anonymous",i=`${e}|${a}`,l=A.get(i);if(l||(A.size>=500&&Pe(r),l=me(i,e,a==="anonymous"?_(e):`${_(e)} ${a}`),A.set(i,l)),l.scheduleCount++,!l.promoted&&(l.scheduleCount>=25||l.totalMs>=50)&&(l.promoted=true),(l.promoted||e==="interval")&&n&&zt(l,r)){let{caller:c,frames:d}=Et(new Error().stack??""),u=d[0];if(u||c){let C=u?`${fe(u.file)??"?"}:${u.line}`:"?",p=`${i}@${c??"?"}:${C}`,y=A.get(p);if(!y){A.size>=500&&Pe(r);let S=a==="anonymous"?_(e):`${_(e)} ${a}`;y=me(p,e,c?`${S} \u2190 ${c}`:a==="anonymous"?`${S} @ ${fe(u?.file??"")??"?"}`:S),y.caller=c,y.file=u?fe(u.file):void 0,y.line=u?.line,y.frames=d,y.promoted=true,y.calls=l.calls,y.totalMs=l.totalMs,y.maxMs=l.maxMs,y.scheduleCount=l.scheduleCount,y.lastSeenAt=l.lastSeenAt,y.ring.set(l.ring),y.ringStamps.set(l.ringStamps),l.calls=0,l.totalMs=0,l.maxMs=0,l.ring.fill(0),l.ringStamps.fill(-1),A.set(p,y),kt(y,_(e))}l.activeRefinedKey=p}}return l.activeRefinedKey??i}s(pe,"buoyJsTopScheduleOrigin");function _(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}}s(_,"apiLabel");function Rt(e,t,r,n){let o=A.get(e);if(!o)return;o.calls++,o.totalMs+=t,t>o.maxMs&&(o.maxMs=t),o.lastSeenAt=n,!o.promoted&&o.totalMs>=50&&(o.promoted=true);let a=n-r,i=a>0?Math.min(1,t/a):1,l=Math.max(r,n-5e3),c=L(l),d=L(n),u=l;for(;c<=d;){let C=(c+1)*250,p=Math.min(n,C),y=p-u;if(y>0){let S=c%20;S>=0&&(o.ringStamps[S]!==c&&(o.ringStamps[S]=c,o.ring[S]=0),o.ring[S]+=a>0?y*i:t)}u=p,c++}ct(r,n,t)}s(Rt,"buoyJsTopBookExclusive");function Ot(e){return A.get(e)?.label??null}s(Ot,"labelForOrigin");function Pt(e,t,r){let n=[];for(let i of A.values()){let l=Oe(i,e);l<=0&&i.totalMs<1||n.push({key:i.key,label:i.label,api:i.api,file:i.file,line:i.line,windowMs:Math.round(l*10)/10,pctOfBusy:t>0?Math.min(100,Math.round(l/t*1e3)/10):0,totalMs:Math.round(i.totalMs*10)/10,calls:i.calls,avgMs:i.calls>0?Math.round(i.totalMs/i.calls*100)/100:0,maxMs:Math.round(i.maxMs*100)/100,lastSeenAgoMs:i.lastSeenAt>0?Math.max(0,e-i.lastSeenAt):0,freezes:0,worstFreezeMs:0})}n.sort((i,l)=>l.windowMs-i.windowMs||l.totalMs-i.totalMs);let o=[],a=[];for(let i of n)(i.windowMs>=1||i.pctOfBusy>=.5||i.freezes>0?o:a).push(i);return a.length>=2?(o.push({key:"minor",label:`${a.length} minor origins (\u22641ms each)`,api:"other",windowMs:Math.round(a.reduce((i,l)=>i+l.windowMs,0)*10)/10,pctOfBusy:Math.round(a.reduce((i,l)=>i+l.pctOfBusy,0)*10)/10,totalMs:Math.round(a.reduce((i,l)=>i+l.totalMs,0)*10)/10,calls:a.reduce((i,l)=>i+l.calls,0),avgMs:0,maxMs:Math.max(0,...a.map(i=>i.maxMs)),lastSeenAgoMs:Math.min(...a.map(i=>i.lastSeenAgoMs)),freezes:0,worstFreezeMs:0}),o.slice(0,r)):n.slice(0,r)}s(Pt,"buildRows");function Ft(e,t,r){let n=A.get(e);if(!n)return null;let o=L(t),a=[],i=0;for(let l=o-20+1;l<=o;l++){let c=l%20,d=c>=0&&n.ringStamps[c]===l?Math.round(n.ring[c]*10)/10:0;a.push(d),i+=d}return{key:n.key,label:n.label,api:n.api,caller:n.caller,file:n.file,line:n.line,frames:n.frames,promoted:n.promoted,scheduleCount:n.scheduleCount,calls:n.calls,totalMs:Math.round(n.totalMs*10)/10,avgMs:n.calls>0?Math.round(n.totalMs/n.calls*100)/100:0,maxMs:Math.round(n.maxMs*100)/100,windowMs:Math.round(i*10)/10,pctOfBusy:r>0?Math.min(100,Math.round(i/r*1e3)/10):0,lastSeenAgoMs:n.lastSeenAt>0?Math.max(0,t-n.lastSeenAt):0,buckets:a}}s(Ft,"getOriginDetailBase");function It(){A.clear()}s(It,"resetOrigins");var Wr=32,Q=[],Hr=20,Lt=64,$t=new Array(Lt).fill(null),Fe=0;function Dt(){return $t}s(Dt,"recentIntervals");function Ie(e,t){let r=I(),n=Q.length>0?Q[Q.length-1]:null,o=null;Q.length<Wr&&(o={originKey:e,start:r,childrenMs:0},Q.push(o));try{return t()}finally{try{if(o){Q.pop();let a=I(),i=a-r,l=Math.max(0,i-o.childrenMs);n&&(n.childrenMs+=i),Rt(e,l,r,a),!n&&i>=Hr&&($t[Fe]={originKey:e,start:r,end:a},Fe=(Fe+1)%Lt)}}catch{}}}s(Ie,"buoyJsTopRunFrame");function J(e,t){if(typeof e!="function"||e[st])return e;let r=V()?pe(t,e,I()):null,n=s(function(...o){return V()?((r===null||!Bt(r))&&(r=pe(t,e,I(),false)),Ie(r,()=>e.apply(this,o))):e.apply(this,o)},"buoyJsTopTaskWrapper");return n[st]=true,n}s(J,"buoyJsTopWrapTask");function Le(e,t,r){if(!V())return r();let n=pe(e,{name:t},I());return Ie(n,r)}s(Le,"buoyJsTopRunAs");function $e(){let e=de();if(typeof f.setTimeout=="function"&&!f.setTimeout[k]){let t=s(function(r,n,...o){let a=J(r,"timeout");return e.setTimeout(a,n,...o)},"buoyJsTopSetTimeout");t[k]=true,f.setTimeout=t}if(typeof f.setInterval=="function"&&!f.setInterval[k]){let t=s(function(r,n,...o){let a=J(r,"interval");return e.setInterval(a,n,...o)},"buoyJsTopSetInterval");t[k]=true,f.setInterval=t}if(typeof f.setImmediate=="function"&&!f.setImmediate[k]&&e.setImmediate){let t=s(function(r,...n){let o=J(r,"immediate");return e.setImmediate(o,...n)},"buoyJsTopSetImmediate");t[k]=true,f.setImmediate=t}if(typeof f.requestAnimationFrame=="function"&&!f.requestAnimationFrame[k]&&e.requestAnimationFrame){let t=s(function(r){let n=J(r,"raf");return e.requestAnimationFrame(n)},"buoyJsTopRequestAnimationFrame");t[k]=true,f.requestAnimationFrame=t}}s($e,"installTimerPatches");function De(){let e=de();if(typeof f.queueMicrotask=="function"&&!f.queueMicrotask[k]&&e.queueMicrotask){let t=s(function(r){let n=J(r,"microtask");return e.queueMicrotask(n)},"buoyJsTopQueueMicrotask");t[k]=true,f.queueMicrotask=t}}s(De,"installMicrotaskPatches");var We=16,Vr=100,jr=3,Nr=8,oe=null,ae=0,be=false,ie=[],G=1/0,Y=0,He=We;function Wt(){let e=I(),t=ae>0?e-ae:0;if(ae=e,be){be=false,G=1/0,Y=e;return}if(t<=0)return;t<Vr&&(t<G&&(G=t),Y===0&&(Y=e),e-Y>=1e3&&(ie.push(G),ie.length>jr&&ie.shift(),He=Math.max(Nr,Math.min(...ie)),G=1/0,Y=e));let r=t-He;r>1&&ut(e-r,e)}s(Wt,"buoyJsTopProbeTick");function Ve(){if(oe!=null)return;let e=re();ae=I(),be=false,ie=[],G=1/0,Y=0,He=We,oe=e.setInterval(Wt,We)}s(Ve,"startBusyProbe");function je(){oe!=null&&(re().clearInterval(oe),oe=null),ae=0}s(je,"stopBusyProbe");function Ht(){be=true}s(Ht,"suppressNextGap");import{definePersistedSetting as Jr}from"@buoy-gg/shared-ui/web";var Kr="@react_buoy/js-top/prefs",qr={enabled:false},Vt=Jr(Kr,qr,{sanitize:s(e=>({enabled:e.enabled===true}),"sanitize")});async function jt(){return Vt.load()}s(jt,"loadJsTopPrefs");async function Nt(e){await Vt.save(e)}s(Nt,"saveJsTopPrefs");import{subscribeRealAppState as Ur}from"@buoy-gg/shared-ui/web";var _r=250,Jt=class Lo{constructor(){this.enabled=false;this.enabledLoaded=false;this.paused=false;this.remoteSampling=false;this.engineRunning=false;this.tiers={timers:false,promises:false,bridge:false,longtask:false};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=[];jt().then(t=>{this.enabledLoaded=true,t.enabled&&!this.enabled&&this.setEnabled(true)})}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&&Nt({enabled:t}),this.enabledSubscribers.forEach(r=>{try{r(t)}catch(n){ee&&console.error("[Buoy]","[js-top] enabled subscriber threw",n)}}),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=true,te(false),je(),this.emitSnapshot())}resume(){this.paused&&(this.paused=false,this.engineRunning&&(te(true),Ve()),this.emitSnapshot())}clear(){It(),pt();for(let t of this.clearHooks)try{t()}catch{}this.emitSnapshot()}registerClearHook(t){this.clearHooks.push(t)}getSnapshot(){return this.snapshot}getOriginDetail(t){let r=I(),n=ze(r),o=this.freezeStatsProvider?.(Date.now())?.byOrigin[t];if(t==="unattributed"){let i=mt(r),l=Math.round(i.reduce((c,d)=>c+d,0)*10)/10;return{key:t,label:"unattributed (events / React / native call-ins)",api:"unattributed",promoted:false,scheduleCount:0,calls:0,totalMs:0,avgMs:0,maxMs:0,windowMs:l,pctOfBusy:n>0?Math.min(100,Math.round(l/n*1e3)/10):0,lastSeenAgoMs:0,buckets:i,freezes:o?.count??0,worstFreezeMs:Math.round(o?.maxMs??0)}}let a=Ft(t,r,n);return a?{...a,freezes:o?.count??0,worstFreezeMs:Math.round(o?.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(r){return ee&&console.error("[Buoy]","[js-top] tier installer threw",r),{}}}startEngine(){this.engineRunning=true,$e(),De(),this.tiers={timers:true,promises:false,bridge:false,longtask:false};for(let t of this.tierInstallers)Object.assign(this.tiers,this.runInstaller(t));te(!this.paused),this.paused||Ve();try{this.appStateSub=Ur(()=>{Ht()})}catch{this.appStateSub=null}this.notifyHandle=re().setInterval(()=>this.emitSnapshot(),_r),this.emitSnapshot()}stopEngine(){if(this.engineRunning=false,te(false),je(),this.notifyHandle!=null&&(re().clearInterval(this.notifyHandle),this.notifyHandle=null),this.appStateSub){try{this.appStateSub.remove()}catch{}this.appStateSub=null}}buildSnapshot(){let t=I(),r=ze(t),n=ht(t),o=Math.max(0,r-n),a=Pt(t,r,30);o>=1&&(a.push({key:"unattributed",label:"unattributed (events / React / native call-ins)",api:"unattributed",windowMs:Math.round(o*10)/10,pctOfBusy:r>0?Math.min(100,Math.round(o/r*1e3)/10):0,totalMs:0,calls:0,avgMs:0,maxMs:0,lastSeenAgoMs:0,freezes:0,worstFreezeMs:0}),a.sort((c,d)=>d.windowMs-c.windowMs||d.totalMs-c.totalMs));let i=this.freezeStatsProvider?.(Date.now())??{count:0,worstMs:0,byOrigin:{}};for(let c of a){let d=i.byOrigin[c.key];d&&(c.freezes=d.count,c.worstFreezeMs=Math.round(d.maxMs))}let l=5e3;return{ts:Date.now(),paused:this.paused,busyPct:Math.min(100,Math.round(r/l*1e3)/10),busyHistory:ft(t),tiers:{...this.tiers},rows:a,totals:{attributedWindowMs:Math.round(n*10)/10,unattributedWindowMs:Math.round(o*10)/10,windowMs:l},freezeSummary:{count:i.count,worstMs:Math.round(i.worstMs)},longtasks:this.longtaskProvider?this.longtaskProvider():[]}}emitSnapshot(){this.snapshot=this.buildSnapshot(),this.subscribers.forEach(t=>{try{t(this.snapshot)}catch(r){ee&&console.error("[Buoy]","[js-top] snapshot subscriber threw",r)}})}isEngineActive(){return V()}};s(Jt,"JsTopControllerImpl");var Qr=Jt,m=new Qr;function ge(e,t){let r=e[t];if(typeof r!="function")return false;if(r[k])return true;let n=s(function(...o){for(let a=0;a<o.length;a++)typeof o[a]=="function"&&(o[a]=J(o[a],"then"));return r.apply(this,o)},"patched");return n[k]=true,Object.defineProperty(n,"name",{value:t,configurable:true}),e[t]=n,true}s(ge,"patchMethod");function Kt(){let e=f.Promise?.prototype;if(!e)return{promises:false};let t=ge(e,"then");return ge(e,"catch"),ge(e,"finally"),{promises:t}}s(Kt,"installPromisePatches");function qt(){let e=f.__fbBatchedBridge;if(!e)return{bridge:false};let t=false;if(typeof e.callFunctionReturnFlushedQueue=="function"&&!e.callFunctionReturnFlushedQueue[k]){let n=e.callFunctionReturnFlushedQueue.bind(e),o=s(function(a,i,l){return V()?Le("bridge",`${a}.${i}`,()=>n(a,i,l)):n(a,i,l)},"buoyJsTopCallFunction");o[k]=true,e.callFunctionReturnFlushedQueue=o,t=true}if(typeof e.invokeCallbackAndReturnFlushedQueue=="function"&&!e.invokeCallbackAndReturnFlushedQueue[k]){let n=e.invokeCallbackAndReturnFlushedQueue.bind(e),o=s(function(a,i){return V()?Le("bridge","nativeModuleCallback",()=>n(a,i)):n(a,i)},"buoyJsTopInvokeCallback");o[k]=true,e.invokeCallbackAndReturnFlushedQueue=o,t=true}let r=e.callFunctionReturnFlushedQueue?.[k]===true;return{bridge:t||r}}s(qt,"installBridgePatch");var Gr=40,Yr=6e4,Zr="unattributed",Ut=false,ye=false,Z=[];function _t(e,t){let r=e+t,n=null,o=0;for(let a of Dt()){if(!a)continue;let i=Math.min(r,a.end)-Math.max(e,a.start);i>o&&(o=i,n=a.originKey)}return n}s(_t,"correlate");function Qt(){if(Ut)return{longtask:ye};Ut=true;let e=f.PerformanceObserver;if(typeof e!="function")return{longtask:false};try{new e(t=>{if(V())try{for(let r of t.getEntries()){if(r.entryType!=="longtask")continue;let n=r.startTime,o=r.duration;dt(n,n+o),Z.push({start:n,duration:o,at:Date.now(),originKey:_t(n,o)}),Z.length>Gr&&Z.shift()}}catch{}}).observe({entryTypes:["longtask"]}),ye=true}catch{ye=false}return{longtask:ye}}s(Qt,"installLongtaskObserver");function Gt(){return Z.map(e=>({start:e.start,duration:e.duration,at:e.at,originLabel:e.originKey?Ot(e.originKey):null}))}s(Gt,"getLongtasks");function Yt(e){let t={},r=0,n=0;for(let o of Z){if(o.at>0&&e-o.at>Yr)continue;r++,o.duration>n&&(n=o.duration);let a=o.originKey??Zr,i=t[a];i?(i.count++,o.duration>i.maxMs&&(i.maxMs=o.duration)):t[a]={count:1,maxMs:o.duration}}return{count:r,worstMs:n,byOrigin:t}}s(Yt,"getFreezeStats");function Zt(){Z.length=0}s(Zt,"clearLongtasks");var Xr={version:1,getSnapshot:s(()=>({live:m.getSnapshot(),enabled:m.isEnabled()||m.isRemoteSampling()}),"getSnapshot"),subscribe:s(e=>{let t=m.subscribe(()=>e()),r=m.subscribeEnabled(()=>e());return()=>{t(),r()}},"subscribe"),actions:{setEnabled:s(e=>{let t=e.enabled;m.setRemoteSampling(t)},"setEnabled"),pause:s(()=>m.pause(),"pause"),resume:s(()=>m.resume(),"resume"),clear:s(()=>m.clear(),"clear"),getOriginDetail:s(e=>m.getOriginDetail(e.key),"getOriginDetail"),sample:s(async e=>{let t=e,r=Math.min(Math.max(t?.durationMs??3e3,250),3e4),n=m.isRemoteSampling()||m.isEnabled();n||m.setRemoteSampling(true),t?.clearFirst&&m.clear();try{return await new Promise(o=>setTimeout(o,r)),m.getSnapshot()}finally{n||m.setRemoteSampling(false)}},"sample")}};import{useCallback as en,useEffect as tn,useMemo as rn,useState as Xt}from"react";var er={};Br(er,{AccessibilityInfo:()=>sn,ActivityIndicator:()=>so,Alert:()=>co,Animated:()=>ln,AppRegistry:()=>cn,AppState:()=>dn,Appearance:()=>un,BackHandler:()=>hn,Button:()=>lo,CheckBox:()=>En,Clipboard:()=>mn,DeviceEventEmitter:()=>Jn,Dimensions:()=>fn,Easing:()=>pn,FlatList:()=>zn,I18nManager:()=>bn,Image:()=>Bn,ImageBackground:()=>Rn,InteractionManager:()=>yn,Keyboard:()=>gn,KeyboardAvoidingView:()=>On,LayoutAnimation:()=>wn,Linking:()=>Mn,LogBox:()=>Nn,Modal:()=>ao,NativeEventEmitter:()=>xn,NativeModules:()=>an,PanResponder:()=>Sn,Picker:()=>Pn,PixelRatio:()=>vn,Platform:()=>kn,Pressable:()=>oo,ProgressBar:()=>Fn,RefreshControl:()=>In,SafeAreaView:()=>Ln,ScrollView:()=>Ke,SectionList:()=>$n,Share:()=>Tn,StatusBar:()=>Dn,StyleSheet:()=>j,Switch:()=>io,Text:()=>h,TextInput:()=>to,Touchable:()=>Wn,TouchableHighlight:()=>ro,TouchableNativeFeedback:()=>Hn,TouchableOpacity:()=>le,TouchableWithoutFeedback:()=>no,UIManager:()=>Cn,Vibration:()=>An,View:()=>b,VirtualizedList:()=>Vn,YellowBox:()=>jn,findNodeHandle:()=>uo,unstable_createElement:()=>on,useColorScheme:()=>Kn,useLocaleContext:()=>qn,useWindowDimensions:()=>Un});Rr(er,nn);import*as nn from"react-native-web";import{unstable_createElement as on,NativeModules as an,AccessibilityInfo as sn,Animated as ln,Appearance as un,AppRegistry as cn,AppState as dn,BackHandler as hn,Clipboard as mn,Dimensions as fn,Easing as pn,I18nManager as bn,Keyboard as gn,InteractionManager as yn,LayoutAnimation as wn,Linking as Mn,NativeEventEmitter as xn,PanResponder as Sn,PixelRatio as vn,Platform as kn,Share as Tn,StyleSheet as j,UIManager as Cn,Vibration as An,CheckBox as En,FlatList as zn,Image as Bn,ImageBackground as Rn,KeyboardAvoidingView as On,Picker as Pn,ProgressBar as Fn,RefreshControl as In,SafeAreaView as Ln,SectionList as $n,StatusBar as Dn,Touchable as Wn,TouchableNativeFeedback as Hn,VirtualizedList as Vn,YellowBox as jn,LogBox as Nn,DeviceEventEmitter as Jn,useColorScheme as Kn,useLocaleContext as qn,useWindowDimensions as Un}from"react-native-web";import*as B from"react-native-web";import{createElement as Ne,forwardRef as tr,useCallback as _n,useRef as Qn}from"react";import{useEffect as Gn,useState as Yn}from"react";import{createPortal as Zn}from"react-dom";var Xn='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';import{jsx as eo}from"react/jsx-runtime";var se=Symbol.for("@buoy-gg/portal-host"),rr=s(e=>{if(!(e instanceof Element))return false;if(e.closest("input, textarea, select"))return true;let t=e.closest("[contenteditable]")?.getAttribute("contenteditable")?.toLowerCase();return t===""||t==="true"||t==="plaintext-only"},"isTextField");function Je(){let e=document;if(e[se])return e[se].host;let t=document.createElement("div");t.dataset.buoyPortalHost="",Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:Xn});let r=s(()=>{let u=document.fullscreenElement,C=u&&u.tagName!=="CANVAS"?u:document.body;t.parentElement!==C&&C.appendChild(t)},"move"),n=new Map,o=s(u=>{(!t.contains(u.target)||!rr(u.target))&&n.set(u.code||u.key,{key:u.key,code:u.code,location:u.location,keyCode:u.keyCode,which:u.which,altKey:u.altKey,ctrlKey:u.ctrlKey,metaKey:u.metaKey,shiftKey:u.shiftKey})},"down"),a=s(u=>{n.delete(u.code||u.key)},"up"),i=s(()=>n.clear(),"clear"),l=s(()=>{let u=[...n.values()];n.clear();for(let C of u)document.dispatchEvent(new KeyboardEvent("keyup",{...C,bubbles:true}))},"focus"),c=s(u=>{rr(u.target)&&u.stopPropagation()},"key"),d=s(u=>u.stopPropagation(),"wheel");return r(),document.addEventListener("fullscreenchange",r),document.addEventListener("keydown",o,true),document.addEventListener("keyup",a,true),window.addEventListener("blur",i),t.addEventListener("focusin",l),t.addEventListener("keydown",c),t.addEventListener("keyup",c),t.addEventListener("keypress",c),t.addEventListener("wheel",d,{passive:true}),e[se]={host:t,users:0,dispose:s(()=>{document.removeEventListener("fullscreenchange",r),document.removeEventListener("keydown",o,true),document.removeEventListener("keyup",a,true),window.removeEventListener("blur",i),t.remove(),delete e[se]},"dispose")},t}s(Je,"getBuoyPortalHost");function nr({children:e}){let[t,r]=Yn(null);return Gn(()=>{let n=Je(),o=document[se];return o.users++,r(n),()=>{--o.users===0&&o.dispose()}},[]),t?Zn(eo("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),t):null}s(nr,"BuoyPortal");function R(e){let t=tr((n,o)=>{let{accessibilityState:a,accessibilityValue:i,...l}=n;for(let c of["busy","checked","disabled","expanded","selected"])a?.[c]!==void 0&&l[`aria-${c}`]===void 0&&(l[`aria-${c}`]=a[c]);for(let[c,d]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[c]!==void 0&&l[`aria-${d}`]===void 0&&(l[`aria-${d}`]=i[c]);return Ne(e,{...l,ref:o})}),r=e.State;return r&&Object.assign(t,{State:r}),t.displayName=e.displayName??e.name??"NativeWebView",t}s(R,"withAccessibility");var b=R(B.View),h=R(B.Text),to=R(B.TextInput),le=R(B.TouchableOpacity),ro=R(B.TouchableHighlight),no=R(B.TouchableWithoutFeedback),oo=R(B.Pressable),Ke=R(B.ScrollView),or=tr((e,t)=>{let r=Qn(null),n=_n(o=>{if(o){let a=o;for(;a.parentElement&&a.parentElement!==document.body;)a=a.parentElement;a.parentElement===document.body&&(r.current=a,Object.assign(a.style,{position:"relative",zIndex:"2147483647",pointerEvents:"auto"}),Je().appendChild(a))}else r.current&&(document.body.appendChild(r.current),r.current=null);typeof t=="function"?t(o):t&&(t.current=o)},[t]);return Ne(nr,null,Ne(B.Modal,{...e,ref:n}))});or.displayName="Modal";var ao=R(or),io=R(B.Switch),so=R(B.ActivityIndicator),lo=R(B.Button),uo=B.findNodeHandle,co={alert(e,t,r,n){if(typeof document>"u")return;let o=document.createElement("dialog");o.dataset.buoyRoot="",o.setAttribute("aria-label",e),o.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 a=document.createElement("h2");if(a.textContent=e,a.style.cssText="font-size:18px;margin:0 0 12px",o.appendChild(a),t){let d=document.createElement("p");d.textContent=t,d.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",o.appendChild(d)}let i=document.createElement("div");i.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let l=r?.length?r:[{text:"OK"}],c=s(()=>{o.close?.(),o.remove()},"close");for(let d of l){let u=document.createElement("button");u.type="button",u.textContent=d.text??"OK",u.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${d.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,u.onclick=()=>{c(),d.onPress?.()},i.appendChild(u)}o.addEventListener("cancel",d=>{d.preventDefault(),n?.cancelable!==false&&(c(),n?.onDismiss?.())}),o.appendChild(i),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};import{Activity as ho,JsModal as mo,macOSColors as F,night as z,ModalHeader as ue,Pause as fo,Play as po,Trash2 as bo}from"@buoy-gg/shared-ui/web";import{memo as go}from"react";import{macOSColors as qe}from"@buoy-gg/shared-ui/web";import{jsx as ar}from"react/jsx-runtime";var yo=60;function ir(e){return e>=80?qe.semantic.error:e>=40?qe.semantic.warning:qe.semantic.success}s(ir,"barColor");var wo=go(s(function({history:e}){let t=e.slice(-yo);return ar(b,{style:sr.row,pointerEvents:"none",children:t.map((r,n)=>ar(b,{style:[sr.bar,{height:Math.max(2,r/100*28),backgroundColor:ir(r)}]},`b${n}`))})},"BusySparkline")),sr=j.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 Mo,useState as xo}from"react";import{macOSColors as we,night as v}from"@buoy-gg/shared-ui/web";import{jsx as O,jsxs as $}from"react/jsx-runtime";var So=[{key:"windowMs",title:"RECENT"},{key:"calls",title:"CALLS"},{key:"avgMs",title:"AVG"},{key:"maxMs",title:"MAX"},{key:"totalMs",title:"TOTAL"}],lr={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 Me(e){return lr[e]??lr.other}s(Me,"badgeFor");function Ue(e){if(e.api==="unattributed")return"events \xB7 React \xB7 native call-ins";if(e.api==="other")return"evicted cold origins";let t=Me(e.api).prefix,r=e.label;return t&&r.startsWith(t)&&(r=r.slice(t.length)),r=r.replace(/^[\s←@]+/,"").trim(),r.length>0?r:"anonymous"}s(Ue,"displayName");function X(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}`}s(X,"fmt");function ur(e){return e.calls<=0?"measured by probe \xB7 not reachable from JS":`${X(e.calls)} calls \xB7 avg ${X(e.avgMs)} \xB7 max ${X(e.maxMs)} \xB7 total ${X(e.totalMs)} ms`}s(ur,"statsLine");var vo=Mo(s(function({row:e,rank:t,onPress:r}){let n=Me(e.api);return $(r?le:b,{style:E.row,...r?{onPress:s(()=>r(e),"onPress"),activeOpacity:.6}:{},children:[$(b,{style:E.topLine,children:[O(h,{style:E.rank,children:t}),O(b,{style:[E.badge,{borderColor:n.color,backgroundColor:`${n.color}1A`}],children:O(h,{style:[E.badgeText,{color:n.color}],children:n.text})}),O(h,{style:E.name,numberOfLines:1,children:Ue(e)}),e.freezes>0&&$(h,{style:[E.freezeBadge,e.worstFreezeMs>=100&&E.freezeBadgeSevere],children:["\u26A0 \xD7",e.freezes]}),$(h,{style:[E.windowMs,e.api!=="unattributed"&&e.pctOfBusy>=25&&{color:e.pctOfBusy>=50?we.semantic.error:we.semantic.warning}],children:[X(e.windowMs),O(h,{style:E.unit,children:" ms"})]}),$(h,{style:[E.pct,e.api==="unattributed"&&E.pctMuted],children:[Math.round(e.pctOfBusy),"%"]})]}),$(b,{style:E.subLine,children:[O(b,{style:E.barTrack,children:O(b,{style:[E.barFill,{width:`${Math.min(100,e.pctOfBusy)}%`,backgroundColor:n.color}]})}),O(h,{style:E.stats,numberOfLines:1,children:ur(e)})]})]})},"TaskRow"),(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 cr({rows:e,onSelectRow:t}){let[r,n]=xo("windowMs"),o=r==="windowMs"?e:[...e].sort((a,i)=>i[r]-a[r]);return $(b,{style:D.root,children:[$(b,{style:D.sortRow,children:[O(h,{style:D.sortLabel,children:"SORT"}),So.map(a=>O(le,{onPress:()=>n(a.key),style:[D.sortChip,r===a.key&&D.sortChipOn],children:O(h,{style:[D.sortChipText,r===a.key&&D.sortChipTextOn],children:a.title})},a.key))]}),$(Ke,{style:D.body,children:[o.map((a,i)=>O(vo,{row:a,rank:i+1,onPress:t},a.key)),o.length===0&&O(h,{style:D.empty,children:"No tasks observed yet \u2014 interact with the app."})]})]})}s(cr,"TaskTable");var D=j.create({root:{flex:1,minHeight:0},sortRow:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,borderBottomWidth:1,borderBottomColor:v.color.border,backgroundColor:v.color.surface},sortLabel:{color:v.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginRight:2},sortChip:{borderWidth:1,borderColor:v.color.border,borderRadius:4,paddingHorizontal:7,paddingVertical:3},sortChipOn:{borderColor:v.color.accentBorderStrong,backgroundColor:v.color.accentSoft},sortChipText:{color:v.color.textTertiary,fontSize:9,fontWeight:"600",fontVariant:["tabular-nums"]},sortChipTextOn:{color:v.color.accent},body:{flex:1},empty:{color:v.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:24}}),E=j.create({row:{paddingHorizontal:10,paddingVertical:8,borderBottomWidth:j.hairlineWidth,borderBottomColor:v.color.border,gap:5},topLine:{flexDirection:"row",alignItems:"center",gap:6},rank:{width:16,color:v.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:v.color.text,fontSize:13,fontWeight:"500"},freezeBadge:{color:we.semantic.warning,fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},freezeBadgeSevere:{color:we.semantic.error},windowMs:{color:v.color.text,fontSize:13,fontWeight:"700",fontVariant:["tabular-nums"]},unit:{color:v.color.textTertiary,fontSize:10,fontWeight:"400"},pct:{width:38,textAlign:"right",color:v.color.textSecondary,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},pctMuted:{color:v.color.textTertiary},subLine:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:22},barTrack:{width:72,height:4,borderRadius:2,backgroundColor:v.color.fillSecondary,overflow:"hidden"},barFill:{height:4,borderRadius:2,opacity:.85},stats:{flex:1,color:v.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]}});import{memo as ko}from"react";import{macOSColors as xe,night as T,useSafeAreaInsets as To}from"@buoy-gg/shared-ui/web";import{Fragment as dr,jsx as M,jsxs as P}from"react/jsx-runtime";var hr={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 mr(e){return hr[e]??hr.other}s(mr,"explainerFor");function N(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}`}s(N,"fmt");function fr(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`}s(fr,"agoFmt");function W({label:e,value:t,accent:r}){return P(b,{style:g.stat,children:[M(h,{style:g.statLabel,children:e}),M(h,{style:[g.statValue,r?{color:r}:null],children:t})]})}s(W,"Stat");var Co=ko(s(function({detail:e}){let t=Me(e.api),r=To({minBottom:12}),n=Math.max(1,...e.buckets);return P(Ke,{style:g.root,contentContainerStyle:{paddingBottom:r.bottom},children:[P(b,{style:g.identityRow,children:[M(b,{style:[g.badge,{borderColor:t.color,backgroundColor:`${t.color}1A`}],children:M(h,{style:[g.badgeText,{color:t.color}],children:t.text})}),M(h,{style:g.name,numberOfLines:2,children:Ue(e)})]}),M(h,{style:g.explainer,children:mr(e.api)}),M(h,{style:g.sectionTitle,children:"ACTIVITY \xB7 LAST 5S"}),M(b,{style:g.chartRow,children:e.buckets.map((o,a)=>M(b,{style:g.chartBarSlot,children:M(b,{style:[g.chartBar,{height:Math.max(2,o/n*44),backgroundColor:t.color}]})},`bk${a}`))}),P(b,{style:g.chartLegend,children:[P(h,{style:g.chartLegendText,children:[N(e.windowMs)," ms in window \xB7 ",e.pctOfBusy.toFixed(1),"% of busy time"]}),P(h,{style:g.chartLegendText,children:["peak ",N(n)," ms/250ms"]})]}),M(h,{style:g.sectionTitle,children:"STATS \xB7 SINCE START"}),P(b,{style:g.statGrid,children:[M(W,{label:"RUNS",value:e.calls>0?N(e.calls):"\u2014"}),M(W,{label:"SCHEDULED",value:e.scheduleCount>0?N(e.scheduleCount):"\u2014"}),M(W,{label:"AVG / RUN",value:e.calls>0?`${N(e.avgMs)} ms`:"\u2014"}),M(W,{label:"MAX / RUN",value:e.maxMs>0?`${N(e.maxMs)} ms`:"\u2014",accent:e.maxMs>=50?xe.semantic.warning:void 0}),M(W,{label:"TOTAL",value:e.totalMs>0?`${N(e.totalMs)} ms`:"\u2014"}),M(W,{label:"LAST RUN",value:fr(e.lastSeenAgoMs)}),M(W,{label:"FREEZES \xB7 60S",value:e.freezes>0?`${e.freezes}`:"0",accent:e.freezes>0?xe.semantic.error:void 0}),M(W,{label:"WORST FREEZE",value:e.worstFreezeMs>0?`${e.worstFreezeMs} ms`:"\u2014",accent:e.worstFreezeMs>=100?xe.semantic.error:e.worstFreezeMs>0?xe.semantic.warning:void 0})]}),(e.caller||(e.frames?.length??0)>0)&&P(dr,{children:[M(h,{style:g.sectionTitle,children:"SCHEDULED FROM"}),P(b,{style:g.siteCard,children:[e.caller&&P(h,{style:g.siteCaller,children:[e.caller,"()"]}),e.file&&P(h,{style:g.siteFile,children:[e.file,e.line!=null?`:${e.line}`:""]}),e.frames?.map((o,a)=>P(h,{style:g.siteFrame,numberOfLines:1,children:[o.file,":",o.line,":",o.col]},`fr${a}`)),M(h,{style:g.siteNote,children:"Frames are bundle offsets (Hermes) \u2014 the caller name above is the readable part. Captured once when this origin got hot."})]})]}),!e.caller&&(e.frames?.length??0)===0&&e.api!=="unattributed"&&e.api!=="other"&&P(dr,{children:[M(h,{style:g.sectionTitle,children:"SCHEDULED FROM"}),M(h,{style:g.sitePending,children:e.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."})]})]})},"TaskDetailView")),g=j.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:T.color.text,fontSize:15,fontWeight:"600"},explainer:{color:T.color.textTertiary,fontSize:11,lineHeight:15,marginTop:6,marginBottom:4},sectionTitle:{color:T.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginTop:14,marginBottom:6},chartRow:{flexDirection:"row",alignItems:"flex-end",height:48,gap:2,backgroundColor:T.color.surface,borderRadius:6,borderWidth:1,borderColor:T.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:T.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},statGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},stat:{width:"23%",minWidth:76,flexGrow:1,backgroundColor:T.color.surface,borderWidth:1,borderColor:T.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:6},statLabel:{color:T.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.4,marginBottom:3},statValue:{color:T.color.text,fontSize:13,fontWeight:"600",fontVariant:["tabular-nums"]},siteCard:{backgroundColor:T.color.surface,borderWidth:1,borderColor:T.color.border,borderRadius:6,padding:10,gap:3},siteCaller:{color:T.color.text,fontSize:13,fontWeight:"600"},siteFile:{color:T.color.info,fontSize:11},siteFrame:{color:T.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},siteNote:{color:T.color.textTertiary,fontSize:9,opacity:.8,marginTop:4},sitePending:{color:T.color.textTertiary,fontSize:11}});import{Fragment as Ao,jsx as w,jsxs as H}from"react/jsx-runtime";function _e(e){return e>=80?F.semantic.error:e>=40?F.semantic.warning:F.semantic.success}s(_e,"busyColor");function Se(e){return e>=100?F.semantic.error:F.semantic.warning}s(Se,"freezeColor");function pr(e){let t=e.rows.find(r=>r.api!=="unattributed"&&r.api!=="other");return t&&t.pctOfBusy>=25&&e.busyPct>=15?{color:t.pctOfBusy>=50?F.semantic.error:F.semantic.warning,icon:"\u25B2",text:`${t.label} is eating ${Math.round(t.pctOfBusy)}% of thread time \u2014 start there.`}:e.freezeSummary.count>0?{color:Se(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:F.semantic.warning,icon:"\u25B2",text:"Thread saturated by UI/React work \u2014 open Highlight Updates to find re-renders."}:{color:F.semantic.success,icon:"\u25CF",text:`Thread healthy at ${Math.round(e.busyPct)}% load \u2014 nothing worth chasing.`}}s(pr,"diagnose");function Qe({visible:e,onClose:t,onBack:r,onMinimize:n,initialModalState:o,minimizeTargetPosition:a,remoteSnapshot:i,remoteActions:l,embedded:c=false}){let d=i!==void 0,[u,C]=Xt(null);tn(()=>{if(!(d||!e))return m.subscribe(C)},[d,e]);let p=d?i:u,y=rn(()=>l??{pause:s(()=>m.pause(),"pause"),resume:s(()=>m.resume(),"resume"),clear:s(()=>m.clear(),"clear")},[l]),S=p?.paused??false,ve=(p?.rows.length??0)>0,[ke,et]=Xt(null),Cr=en(K=>et(K.key),[]),tt=!d&&ke?m.getOriginDetail(ke):null,rt=ke!==null,nt=H(ue,{children:[rt?w(ue.Navigation,{onBack:()=>et(null)}):r?w(ue.Navigation,{onBack:r}):null,w(ue.Content,{title:"",noMargin:true,children:H(b,{style:x.titleRow,children:[w(ho,{size:14,color:"#34D399"}),w(h,{style:x.title,children:"JS Top"}),p&&w(b,{style:[x.busyPill,{borderColor:_e(p.busyPct)}],children:H(h,{style:[x.busyText,{color:_e(p.busyPct)}],children:[p.busyPct.toFixed(0),"% BUSY"]})}),p&&p.freezeSummary.count>0&&w(b,{style:[x.busyPill,{borderColor:Se(p.freezeSummary.worstMs)}],children:H(h,{style:[x.busyText,{color:Se(p.freezeSummary.worstMs)}],children:["\u26A0 ",p.freezeSummary.count," \xB7"," ",p.freezeSummary.worstMs,"ms"]})})]})}),H(ue.Actions,{children:[w(le,{onPress:S?y.resume:y.pause,style:[x.actionBtn,S&&x.actionBtnActive],accessibilityLabel:S?"Resume sampling":"Pause sampling",children:S?w(po,{size:14,color:z.color.accent}):w(fo,{size:14,color:z.color.textSecondary})}),w(le,{onPress:y.clear,disabled:!ve,style:[x.actionBtn,!ve&&x.actionBtnDisabled],accessibilityLabel:"Clear stats",children:w(bo,{size:14,color:ve?z.color.textTertiary:z.color.textTertiary})})]})]}),ot=w(b,{style:x.body,children:rt?tt?w(Co,{detail:tt}):w(h,{style:x.waiting,children:"This origin is no longer tracked (cleared or evicted)."}):p?H(Ao,{children:[(()=>{let K=pr(p);return H(b,{style:[x.diagnosis,{borderLeftColor:K.color}],children:[w(h,{style:[x.diagnosisIcon,{color:K.color}],children:K.icon}),w(h,{style:x.diagnosisText,children:K.text})]})})(),H(b,{style:x.sparklineRow,children:[w(h,{style:x.sparklineCaption,children:"JS THREAD LOAD \xB7 LAST 30s"}),w(wo,{history:p.busyHistory})]}),!p.tiers.bridge&&w(h,{style:x.tierBanner,children:"\u201CSystem\u201D rows are UI/React/native work pure JS can\u2019t name \u2014 timers, rAF and Promise chains are fully attributed."}),w(cr,{rows:p.rows,onSelectRow:d?void 0:Cr})]}):w(h,{style:x.waiting,children:d?"Waiting for device\u2026":"Starting engine\u2026"})});return c?H(b,{style:x.embeddedRoot,children:[w(b,{style:x.embeddedHeader,children:nt}),ot]}):w(mo,{visible:e,onClose:t,onMinimize:n,minimizeTargetPosition:a,initialModalState:o,header:{showToggleButton:true,customContent:nt},persistenceKey:"buoy-js-top-modal",enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:ot})}s(Qe,"JsTopModal");var x=j.create({titleRow:{flexDirection:"row",alignItems:"center",gap:8},title:{color:z.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:z.color.buttonSurface,borderWidth:1,borderColor:z.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:z.color.accentSoft,borderColor:z.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:z.color.surface,borderRadius:6,borderLeftWidth:3},diagnosisIcon:{fontSize:11,fontWeight:"700"},diagnosisText:{flex:1,color:z.color.text,fontSize:12,lineHeight:16},sparklineRow:{paddingHorizontal:10,paddingVertical:8,gap:4},sparklineCaption:{color:z.color.textTertiary,fontSize:8,fontWeight:"700",letterSpacing:.5},tierBanner:{color:z.color.textTertiary,fontSize:10,paddingHorizontal:10,paddingBottom:6},waiting:{color:z.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:32},embeddedRoot:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:F.background.base},embeddedHeader:{borderBottomWidth:1,borderBottomColor:F.border.default}});import{useEffect as br,useState as gr}from"react";import{macOSColors as Ge,night as Ye}from"@buoy-gg/shared-ui/web";import{jsx as Eo,jsxs as yr}from"react/jsx-runtime";function wr(e){return e>=80?Ge.semantic.error:e>=40?Ge.semantic.warning:Ge.semantic.success}s(wr,"busyColor");function Mr(){let[e,t]=gr(()=>m.isEnabled()),[r,n]=gr(null);if(br(()=>m.subscribeEnabled(t),[]),br(()=>{if(!e){n(null);return}return m.subscribe(n)},[e]),!e||!r)return null;let o=r.rows.find(a=>a.api!=="unattributed");return yr(b,{style:Ze.pill,pointerEvents:"none",children:[yr(h,{style:[Ze.busy,{color:wr(r.busyPct)}],children:[r.busyPct.toFixed(0),"%"]}),o&&Eo(h,{style:Ze.label,numberOfLines:1,children:o.label})]})}s(Mr,"JsTopHudOverlay");var Ze=j.create({pill:{position:"absolute",top:60,left:8,flexDirection:"row",alignItems:"center",gap:6,backgroundColor:Ye.color.buttonSurface,borderWidth:1,borderColor:Ye.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:4,maxWidth:220},busy:{fontSize:11,fontWeight:"700",fontVariant:["tabular-nums"]},label:{color:Ye.color.textSecondary,fontSize:10,flexShrink:1}});import{useEffect as zo,useState as Bo}from"react";import{Activity as xr}from"@buoy-gg/shared-ui/web";import{jsx as Sr}from"react/jsx-runtime";var Xe="#34D399",vr="#6B7280";function kr({size:e}){let[t,r]=Bo(()=>m.isEnabled());return zo(()=>m.subscribeEnabled(r),[]),Sr(xr,{size:e,color:t?Xe:vr})}s(kr,"JsTopToggleIcon");function Tr(){return null}s(Tr,"EmptyComponent");var Ro={id:"js-top",name:"JS TOP",description:"Toggle the floating JS-thread busy pill",slot:"row",icon:kr,component:Tr,props:{},launchMode:"toggle-only",onPress:s(()=>{m.setEnabled(!m.isEnabled())},"onPress")},Oo={id:"js-top-modal",name:"TASKS",description:"Live Task Manager for the JS thread",slot:"both",icon:s(({size:e})=>Sr(xr,{size:e,color:Xe}),"icon"),component:Qe,props:{enableSharedModalDimensions:false}};m.registerTierInstaller(Kt);m.registerTierInstaller(qt);m.registerTierInstaller(Qt);m.registerLongtaskProvider(Gt);m.registerFreezeStatsProvider(Yt);m.registerClearHook(Zt);try{typeof window<"u"&&($e(),De())}catch{}export{vr as JS_TOP_DISABLED_COLOR,Xe as JS_TOP_ENABLED_COLOR,m as JsTopController,Mr as JsTopHudOverlay,Qe as JsTopModal,Oo as jsTopModalPreset,Ro as jsTopPreset,Xr 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.65",
|
|
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,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
15
|
+
"@buoy-gg/shared-ui": "^7.0.65"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": "*"
|