@buoy-gg/events 7.0.43 → 7.0.45
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/index.js +1 -1
- package/lib/commonjs/stores/unifiedEventStore.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/stores/unifiedEventStore.js +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/stores/unifiedEventStore.d.ts +9 -0
- package/lib/web/index.mjs +8 -8
- package/package.json +3 -3
package/lib/commonjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"COPY_PRESETS",{enumerable:true,get:function(){return _copySettings.COPY_PRESETS}});Object.defineProperty(exports,"DEFAULT_COPY_SETTINGS",{enumerable:true,get:function(){return _copySettings.DEFAULT_COPY_SETTINGS}});Object.defineProperty(exports,"EVENTS_TEST_ID",{enumerable:true,get:function(){return _testIDs.EVENTS_TEST_ID}});Object.defineProperty(exports,"EventsCopySettingsView",{enumerable:true,get:function(){return _EventsCopySettingsView.EventsCopySettingsView}});Object.defineProperty(exports,"EventsModal",{enumerable:true,get:function(){return _EventsModal.EventsModal}});Object.defineProperty(exports,"EventsToolView",{enumerable:true,get:function(){return _EventsModal.EventsToolView}});Object.defineProperty(exports,"PRESET_METADATA",{enumerable:true,get:function(){return _copySettings.PRESET_METADATA}});Object.defineProperty(exports,"ReactQueryEventDetail",{enumerable:true,get:function(){return _ReactQueryEventDetail.ReactQueryEventDetail}});Object.defineProperty(exports,"UnifiedEventDetail",{enumerable:true,get:function(){return _UnifiedEventDetail.UnifiedEventDetail}});Object.defineProperty(exports,"UnifiedEventFilters",{enumerable:true,get:function(){return _UnifiedEventFilters.UnifiedEventFilters}});Object.defineProperty(exports,"UnifiedEventItem",{enumerable:true,get:function(){return _UnifiedEventItem.UnifiedEventItem}});Object.defineProperty(exports,"UnifiedEventList",{enumerable:true,get:function(){return _UnifiedEventList.UnifiedEventList}});Object.defineProperty(exports,"UnifiedEventViewer",{enumerable:true,get:function(){return _UnifiedEventViewer.UnifiedEventViewer}});Object.defineProperty(exports,"buildCorrelationCountMap",{enumerable:true,get:function(){return _correlationUtils.buildCorrelationCountMap}});Object.defineProperty(exports,"clearCopySettings",{enumerable:true,get:function(){return _copySettingsStorage.clearCopySettings}});Object.defineProperty(exports,"createEventsTool",{enumerable:true,get:function(){return _preset.createEventsTool}});Object.defineProperty(exports,"detectActivePreset",{enumerable:true,get:function(){return _copySettings.detectActivePreset}});Object.defineProperty(exports,"estimateExportSize",{enumerable:true,get:function(){return _eventExportFormatter.estimateExportSize}});Object.defineProperty(exports,"eventFilterTestID",{enumerable:true,get:function(){return _testIDs.eventFilterTestID}});Object.defineProperty(exports,"eventIdentity",{enumerable:true,get:function(){return _testIDs.eventIdentity}});Object.defineProperty(exports,"eventRowTestID",{enumerable:true,get:function(){return _testIDs.eventRowTestID}});Object.defineProperty(exports,"eventsSyncAdapter",{enumerable:true,get:function(){return _eventsSyncAdapter.eventsSyncAdapter}});Object.defineProperty(exports,"eventsToolPreset",{enumerable:true,get:function(){return _preset.eventsToolPreset}});Object.defineProperty(exports,"filterEvents",{enumerable:true,get:function(){return _eventExportFormatter.filterEvents}});Object.defineProperty(exports,"findRelatedEvents",{enumerable:true,get:function(){return _correlationUtils.findRelatedEvents}});Object.defineProperty(exports,"generateExport",{enumerable:true,get:function(){return _eventExportFormatter.generateExport}});Object.defineProperty(exports,"generateJsonExport",{enumerable:true,get:function(){return _eventExportFormatter.generateJsonExport}});Object.defineProperty(exports,"generateMarkdownExport",{enumerable:true,get:function(){return _eventExportFormatter.generateMarkdownExport}});Object.defineProperty(exports,"generateMermaidExport",{enumerable:true,get:function(){return _eventExportFormatter.generateMermaidExport}});Object.defineProperty(exports,"generatePlaintextExport",{enumerable:true,get:function(){return _eventExportFormatter.generatePlaintextExport}});Object.defineProperty(exports,"getCorrelationColor",{enumerable:true,get:function(){return _correlationUtils.getCorrelationColor}});Object.defineProperty(exports,"getCorrelationGroup",{enumerable:true,get:function(){return _correlationUtils.getCorrelationGroup}});Object.defineProperty(exports,"getCorrelationLabel",{enumerable:true,get:function(){return _correlationUtils.getCorrelationLabel}});Object.defineProperty(exports,"getExportSummary",{enumerable:true,get:function(){return _eventExportFormatter.getExportSummary}});Object.defineProperty(exports,"getRelatedEventsCount",{enumerable:true,get:function(){return _correlationUtils.getRelatedEventsCount}});Object.defineProperty(exports,"hasRelatedEvents",{enumerable:true,get:function(){return _correlationUtils.hasRelatedEvents}});Object.defineProperty(exports,"isBuoyInternalEvent",{enumerable:true,get:function(){return _eventVisibility.isBuoyInternalEvent}});Object.defineProperty(exports,"isEventHiddenFromTool",{enumerable:true,get:function(){return _eventVisibility.isEventHiddenFromTool}});Object.defineProperty(exports,"isNetworkEventIgnored",{enumerable:true,get:function(){return _eventVisibility.isNetworkEventIgnored}});Object.defineProperty(exports,"loadCopySettings",{enumerable:true,get:function(){return _copySettingsStorage.loadCopySettings}});Object.defineProperty(exports,"saveCopySettings",{enumerable:true,get:function(){return _copySettingsStorage.saveCopySettings}});Object.defineProperty(exports,"unifiedEventStore",{enumerable:true,get:function(){return _unifiedEventStore.unifiedEventStore}});Object.defineProperty(exports,"useUnifiedEvents",{enumerable:true,get:function(){return _useUnifiedEvents.useUnifiedEvents}});var _preset=require("./preset");var _UnifiedEventViewer=require("./components/UnifiedEventViewer");var _EventsModal=require("./components/EventsModal");var _eventsSyncAdapter=require("./sync/eventsSyncAdapter");var _useUnifiedEvents=require("./hooks/useUnifiedEvents");var _eventVisibility=require("./utils/eventVisibility");var _copySettings=require("./types/copySettings");var _UnifiedEventItem=require("./components/UnifiedEventItem");var _UnifiedEventList=require("./components/UnifiedEventList");var _UnifiedEventFilters=require("./components/UnifiedEventFilters");var _UnifiedEventDetail=require("./components/UnifiedEventDetail");var _ReactQueryEventDetail=require("./components/ReactQueryEventDetail");var _EventsCopySettingsView=require("./components/EventsCopySettingsView");var _testIDs=require("./utils/testIDs");var _correlationUtils=require("./utils/correlationUtils");var _eventExportFormatter=require("./utils/eventExportFormatter");var _copySettingsStorage=require("./utils/copySettingsStorage");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"COPY_PRESETS",{enumerable:true,get:function(){return _copySettings.COPY_PRESETS}});Object.defineProperty(exports,"DEFAULT_COPY_SETTINGS",{enumerable:true,get:function(){return _copySettings.DEFAULT_COPY_SETTINGS}});Object.defineProperty(exports,"EVENTS_TEST_ID",{enumerable:true,get:function(){return _testIDs.EVENTS_TEST_ID}});Object.defineProperty(exports,"EventsCopySettingsView",{enumerable:true,get:function(){return _EventsCopySettingsView.EventsCopySettingsView}});Object.defineProperty(exports,"EventsModal",{enumerable:true,get:function(){return _EventsModal.EventsModal}});Object.defineProperty(exports,"EventsToolView",{enumerable:true,get:function(){return _EventsModal.EventsToolView}});Object.defineProperty(exports,"PRESET_METADATA",{enumerable:true,get:function(){return _copySettings.PRESET_METADATA}});Object.defineProperty(exports,"ReactQueryEventDetail",{enumerable:true,get:function(){return _ReactQueryEventDetail.ReactQueryEventDetail}});Object.defineProperty(exports,"UnifiedEventDetail",{enumerable:true,get:function(){return _UnifiedEventDetail.UnifiedEventDetail}});Object.defineProperty(exports,"UnifiedEventFilters",{enumerable:true,get:function(){return _UnifiedEventFilters.UnifiedEventFilters}});Object.defineProperty(exports,"UnifiedEventItem",{enumerable:true,get:function(){return _UnifiedEventItem.UnifiedEventItem}});Object.defineProperty(exports,"UnifiedEventList",{enumerable:true,get:function(){return _UnifiedEventList.UnifiedEventList}});Object.defineProperty(exports,"UnifiedEventViewer",{enumerable:true,get:function(){return _UnifiedEventViewer.UnifiedEventViewer}});Object.defineProperty(exports,"buildCorrelationCountMap",{enumerable:true,get:function(){return _correlationUtils.buildCorrelationCountMap}});Object.defineProperty(exports,"clearCopySettings",{enumerable:true,get:function(){return _copySettingsStorage.clearCopySettings}});Object.defineProperty(exports,"createEventsTool",{enumerable:true,get:function(){return _preset.createEventsTool}});Object.defineProperty(exports,"detectActivePreset",{enumerable:true,get:function(){return _copySettings.detectActivePreset}});Object.defineProperty(exports,"estimateExportSize",{enumerable:true,get:function(){return _eventExportFormatter.estimateExportSize}});Object.defineProperty(exports,"eventFilterTestID",{enumerable:true,get:function(){return _testIDs.eventFilterTestID}});Object.defineProperty(exports,"eventIdentity",{enumerable:true,get:function(){return _testIDs.eventIdentity}});Object.defineProperty(exports,"eventRowTestID",{enumerable:true,get:function(){return _testIDs.eventRowTestID}});Object.defineProperty(exports,"eventsSyncAdapter",{enumerable:true,get:function(){return _eventsSyncAdapter.eventsSyncAdapter}});Object.defineProperty(exports,"eventsToolPreset",{enumerable:true,get:function(){return _preset.eventsToolPreset}});Object.defineProperty(exports,"filterEvents",{enumerable:true,get:function(){return _eventExportFormatter.filterEvents}});Object.defineProperty(exports,"findRelatedEvents",{enumerable:true,get:function(){return _correlationUtils.findRelatedEvents}});Object.defineProperty(exports,"generateExport",{enumerable:true,get:function(){return _eventExportFormatter.generateExport}});Object.defineProperty(exports,"generateJsonExport",{enumerable:true,get:function(){return _eventExportFormatter.generateJsonExport}});Object.defineProperty(exports,"generateMarkdownExport",{enumerable:true,get:function(){return _eventExportFormatter.generateMarkdownExport}});Object.defineProperty(exports,"generateMermaidExport",{enumerable:true,get:function(){return _eventExportFormatter.generateMermaidExport}});Object.defineProperty(exports,"generatePlaintextExport",{enumerable:true,get:function(){return _eventExportFormatter.generatePlaintextExport}});Object.defineProperty(exports,"getCorrelationColor",{enumerable:true,get:function(){return _correlationUtils.getCorrelationColor}});Object.defineProperty(exports,"getCorrelationGroup",{enumerable:true,get:function(){return _correlationUtils.getCorrelationGroup}});Object.defineProperty(exports,"getCorrelationLabel",{enumerable:true,get:function(){return _correlationUtils.getCorrelationLabel}});Object.defineProperty(exports,"getExportSummary",{enumerable:true,get:function(){return _eventExportFormatter.getExportSummary}});Object.defineProperty(exports,"getRelatedEventsCount",{enumerable:true,get:function(){return _correlationUtils.getRelatedEventsCount}});Object.defineProperty(exports,"hasRelatedEvents",{enumerable:true,get:function(){return _correlationUtils.hasRelatedEvents}});Object.defineProperty(exports,"isBuoyInternalEvent",{enumerable:true,get:function(){return _eventVisibility.isBuoyInternalEvent}});Object.defineProperty(exports,"isEventHiddenFromTool",{enumerable:true,get:function(){return _eventVisibility.isEventHiddenFromTool}});Object.defineProperty(exports,"isNetworkEventIgnored",{enumerable:true,get:function(){return _eventVisibility.isNetworkEventIgnored}});Object.defineProperty(exports,"loadCopySettings",{enumerable:true,get:function(){return _copySettingsStorage.loadCopySettings}});Object.defineProperty(exports,"saveCopySettings",{enumerable:true,get:function(){return _copySettingsStorage.saveCopySettings}});Object.defineProperty(exports,"unifiedEventStore",{enumerable:true,get:function(){return _unifiedEventStore.unifiedEventStore}});Object.defineProperty(exports,"useUnifiedEvents",{enumerable:true,get:function(){return _useUnifiedEvents.useUnifiedEvents}});Object.defineProperty(exports,"watchEvents",{enumerable:true,get:function(){return _unifiedEventStore.watchEvents}});var _preset=require("./preset");var _UnifiedEventViewer=require("./components/UnifiedEventViewer");var _EventsModal=require("./components/EventsModal");var _eventsSyncAdapter=require("./sync/eventsSyncAdapter");var _useUnifiedEvents=require("./hooks/useUnifiedEvents");var _unifiedEventStore=require("./stores/unifiedEventStore");var _eventVisibility=require("./utils/eventVisibility");var _copySettings=require("./types/copySettings");var _UnifiedEventItem=require("./components/UnifiedEventItem");var _UnifiedEventList=require("./components/UnifiedEventList");var _UnifiedEventFilters=require("./components/UnifiedEventFilters");var _UnifiedEventDetail=require("./components/UnifiedEventDetail");var _ReactQueryEventDetail=require("./components/ReactQueryEventDetail");var _EventsCopySettingsView=require("./components/EventsCopySettingsView");var _testIDs=require("./utils/testIDs");var _correlationUtils=require("./utils/correlationUtils");var _eventExportFormatter=require("./utils/eventExportFormatter");var _copySettingsStorage=require("./utils/copySettingsStorage");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.unsubscribeFromZustand=exports.unsubscribeFromStorage=exports.unsubscribeFromRoutes=exports.unsubscribeFromRender=exports.unsubscribeFromRedux=exports.unsubscribeFromReactQuery=exports.unsubscribeFromNetwork=exports.unsubscribeFromJotai=exports.unsubscribeAll=exports.unifiedEventStore=exports.subscribeToZustand=exports.subscribeToStorage=exports.subscribeToRoutes=exports.subscribeToRender=exports.subscribeToRedux=exports.subscribeToReactQuery=exports.subscribeToNetwork=exports.subscribeToJotai=exports.subscribeToAll=exports.subscribe=exports.setLocalEnabledSources=exports.isSourceSubscribed=exports.getSubscriptionStatus=exports.getSubscriberCounts=exports.getSourceCounts=exports.getEvents=exports.getEventCount=exports.getDiscoveredSources=exports.getAvailableEventSources=exports.getActiveSources=exports.clearEvents=void 0;var _autoDiscoverEventSources=require("../utils/autoDiscoverEventSources");var _sharedUi=require("@buoy-gg/shared-ui");var _sourceIds=require("../sources/sourceIds");const MAX_EVENTS=200;const SUBSCRIBE_ALL_EXCLUDED_SOURCE_IDS=new Set(["render"]);class UnifiedEventStore extends _sharedUi.ChangeLog{activeSources=new Set;remoteAvailableSources=null;sourceUnsubscribers=new Map;remoteDiscoveryIds=new Set;localDiscoveryIds=new Set;localSyncChain=Promise.resolve();networkEventIdMap=new Map;constructor(){super({max:MAX_EVENTS})}getDiscoveredSources(){return(0,_autoDiscoverEventSources.getCachedDiscovery)().sources}getAvailableEventSources(){if(this.remoteAvailableSources){return this.remoteAvailableSources}return(0,_autoDiscoverEventSources.getCachedDiscovery)().availableEventSources}setRemoteAvailableSources(e){const s=e?new Set(e):null;const r=this.remoteAvailableSources;const o=r===null&&s===null||!!r&&!!s&&r.size===s.size&&[...s].every(t=>r.has(t));this.remoteAvailableSources=s;if(!o){this.notifyListeners()}}replaceEvents(e){this.activeSources=new Set(e.map(s=>s.source));this.setItems(e)}async subscribeToAll(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();for(const s of e){if(SUBSCRIBE_ALL_EXCLUDED_SOURCE_IDS.has(s.id)){continue}await this.subscribeToSource(s)}}async subscribeToSource(e){const s=this.sourceUnsubscribers.get(e.id);if(s){s.refCount++;return}const r={unsubscribe:()=>{},refCount:1};this.sourceUnsubscribers.set(e.id,r);try{if(e.setup){await e.setup()}const o=await e.subscribe(t=>{this.addEvent(t)});if(o){r.unsubscribe=o}}catch{if(this.sourceUnsubscribers.get(e.id)===r&&r.refCount<=1){this.sourceUnsubscribers.delete(e.id)}}}unsubscribeFromSource(e){const s=this.sourceUnsubscribers.get(e);if(!s)return;s.refCount--;if(s.refCount<=0){s.unsubscribe();this.sourceUnsubscribers.delete(e)}}async subscribeToStorage(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="storage");if(s){await this.subscribeToSource(s)}}unsubscribeFromStorage(){this.unsubscribeFromSource("storage");this.activeSources.delete("storage-async");this.activeSources.delete("storage-mmkv")}subscribeToRedux(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="redux");if(s){this.subscribeToSource(s)}}unsubscribeFromRedux(){this.unsubscribeFromSource("redux");this.activeSources.delete("redux")}subscribeToNetwork(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="network");if(s){this.subscribeToSource(s)}}unsubscribeFromNetwork(){this.unsubscribeFromSource("network");this.activeSources.delete("network")}subscribeToReactQuery(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="react-query");if(s){this.subscribeToSource(s)}}unsubscribeFromReactQuery(){this.unsubscribeFromSource("react-query");this.activeSources.delete("react-query");this.activeSources.delete("react-query-query");this.activeSources.delete("react-query-mutation")}subscribeToRoutes(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="route-events");if(s){this.subscribeToSource(s)}}unsubscribeFromRoutes(){this.unsubscribeFromSource("route-events");this.activeSources.delete("route")}subscribeToZustand(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="zustand");if(s){this.subscribeToSource(s)}}unsubscribeFromZustand(){this.unsubscribeFromSource("zustand");this.activeSources.delete("zustand")}subscribeToJotai(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="jotai");if(s){this.subscribeToSource(s)}}unsubscribeFromJotai(){this.unsubscribeFromSource("jotai");this.activeSources.delete("jotai")}subscribeToRender(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="render");if(s){this.subscribeToSource(s)}}unsubscribeFromRender(){this.unsubscribeFromSource("render");this.activeSources.delete("render")}addEvent(e){if(e.source==="network"){const s=e.originalEvent;if(s?.id){const r=this.networkEventIdMap.get(s.id);if(r){const o=this.items.findIndex(t=>t.id===r);if(o>=0){e.id=r;this.items=[...this.items.slice(0,o),e,...this.items.slice(o+1)];this.notifyListeners();return}}this.networkEventIdMap.set(s.id,e.id)}}this.push(e);this.activeSources.add(e.source);this.notifyListeners()}getEvents(e){if(!e||e.size===0){return this.items}return this.items.filter(s=>e.has(s.source))}getActiveSources(){return Array.from(this.activeSources)}getSourceCounts(){const e={"storage-async":0,"storage-mmkv":0,redux:0,network:0,"react-query":0,"react-query-query":0,"react-query-mutation":0,route:0,zustand:0,jotai:0,render:0};for(const s of this.items){e[s.source]++}return e}clearEvents(){this.activeSources.clear();this.networkEventIdMap.clear();this.clear()}subscribe(e){const s=super.subscribe(e);e(this.items);return s}getEventCount(){return this.items.length}unsubscribeAll(){for(const[,e]of this.sourceUnsubscribers){e.unsubscribe()}this.sourceUnsubscribers.clear();this.activeSources.clear();this.remoteDiscoveryIds.clear();this.localDiscoveryIds.clear()}setLocalEnabledSources(e){const s=async()=>{const r=new Set;for(const c of e){const i=_sourceIds.EVENT_SOURCE_TO_DISCOVERY_ID[c];if(i)r.add(i)}const o=this.localDiscoveryIds;this.localDiscoveryIds=r;const{sources:t}=(0,_autoDiscoverEventSources.getCachedDiscovery)();for(const c of r){if(!o.has(c)){const i=t.find(n=>n.id===c);if(i)await this.subscribeToSource(i)}}for(const c of o){if(!r.has(c)){this.unsubscribeFromSource(c)}}};this.localSyncChain=this.localSyncChain.then(s,s);return this.localSyncChain}async setRemoteEnabledSources(e){const{sources:s}=(0,_autoDiscoverEventSources.getCachedDiscovery)();let r;if(e==="all"){r=new Set(s.map(t=>t.id).filter(t=>!SUBSCRIBE_ALL_EXCLUDED_SOURCE_IDS.has(t)))}else{r=new Set;for(const t of e){const c=_sourceIds.EVENT_SOURCE_TO_DISCOVERY_ID[t];if(c)r.add(c)}}const o=this.remoteDiscoveryIds;this.remoteDiscoveryIds=r;for(const t of r){if(!o.has(t)){const c=s.find(i=>i.id===t);if(c)await this.subscribeToSource(c)}}for(const t of o){if(!r.has(t)){this.unsubscribeFromSource(t)}}}ensureRemoteSourcesDefault(){if(this.remoteDiscoveryIds.size===0){void this.setRemoteEnabledSources("all")}}clearRemoteSources(){for(const e of this.remoteDiscoveryIds){this.unsubscribeFromSource(e)}this.remoteDiscoveryIds.clear()}isSourceSubscribed(e){switch(e){case"storage-async":case"storage-mmkv":return this.sourceUnsubscribers.has("storage");case"redux":return this.sourceUnsubscribers.has("redux");case"network":return this.sourceUnsubscribers.has("network");case"react-query":case"react-query-query":case"react-query-mutation":return this.sourceUnsubscribers.has("react-query");case"route":return this.sourceUnsubscribers.has("route-events");case"zustand":return this.sourceUnsubscribers.has("zustand");case"jotai":return this.sourceUnsubscribers.has("jotai");case"render":return this.sourceUnsubscribers.has("render");default:return false}}getSubscriptionStatus(){return{"storage-async":this.sourceUnsubscribers.has("storage"),"storage-mmkv":this.sourceUnsubscribers.has("storage"),redux:this.sourceUnsubscribers.has("redux"),network:this.sourceUnsubscribers.has("network"),"react-query":this.sourceUnsubscribers.has("react-query"),"react-query-query":this.sourceUnsubscribers.has("react-query"),"react-query-mutation":this.sourceUnsubscribers.has("react-query"),route:this.sourceUnsubscribers.has("route-events"),zustand:this.sourceUnsubscribers.has("zustand"),jotai:this.sourceUnsubscribers.has("jotai"),render:this.sourceUnsubscribers.has("render")}}getSubscriberCounts(){return(0,_autoDiscoverEventSources.getAggregatedSubscriberCounts)()}}const unifiedEventStore=exports.unifiedEventStore=new UnifiedEventStore;const subscribeToStorage=()=>unifiedEventStore.subscribeToStorage();exports.subscribeToStorage=subscribeToStorage;const unsubscribeFromStorage=()=>unifiedEventStore.unsubscribeFromStorage();exports.unsubscribeFromStorage=unsubscribeFromStorage;const subscribeToRedux=()=>unifiedEventStore.subscribeToRedux();exports.subscribeToRedux=subscribeToRedux;const unsubscribeFromRedux=()=>unifiedEventStore.unsubscribeFromRedux();exports.unsubscribeFromRedux=unsubscribeFromRedux;const subscribeToNetwork=()=>unifiedEventStore.subscribeToNetwork();exports.subscribeToNetwork=subscribeToNetwork;const unsubscribeFromNetwork=()=>unifiedEventStore.unsubscribeFromNetwork();exports.unsubscribeFromNetwork=unsubscribeFromNetwork;const subscribeToReactQuery=()=>unifiedEventStore.subscribeToReactQuery();exports.subscribeToReactQuery=subscribeToReactQuery;const unsubscribeFromReactQuery=()=>unifiedEventStore.unsubscribeFromReactQuery();exports.unsubscribeFromReactQuery=unsubscribeFromReactQuery;const subscribeToRoutes=()=>unifiedEventStore.subscribeToRoutes();exports.subscribeToRoutes=subscribeToRoutes;const unsubscribeFromRoutes=()=>unifiedEventStore.unsubscribeFromRoutes();exports.unsubscribeFromRoutes=unsubscribeFromRoutes;const subscribeToZustand=()=>unifiedEventStore.subscribeToZustand();exports.subscribeToZustand=subscribeToZustand;const unsubscribeFromZustand=()=>unifiedEventStore.unsubscribeFromZustand();exports.unsubscribeFromZustand=unsubscribeFromZustand;const subscribeToJotai=()=>unifiedEventStore.subscribeToJotai();exports.subscribeToJotai=subscribeToJotai;const unsubscribeFromJotai=()=>unifiedEventStore.unsubscribeFromJotai();exports.unsubscribeFromJotai=unsubscribeFromJotai;const subscribeToRender=()=>unifiedEventStore.subscribeToRender();exports.subscribeToRender=subscribeToRender;const unsubscribeFromRender=()=>unifiedEventStore.unsubscribeFromRender();exports.unsubscribeFromRender=unsubscribeFromRender;const getEvents=u=>unifiedEventStore.getEvents(u);exports.getEvents=getEvents;const getActiveSources=()=>unifiedEventStore.getActiveSources();exports.getActiveSources=getActiveSources;const getSourceCounts=()=>unifiedEventStore.getSourceCounts();exports.getSourceCounts=getSourceCounts;const clearEvents=()=>unifiedEventStore.clearEvents();exports.clearEvents=clearEvents;const subscribe=u=>unifiedEventStore.subscribe(u);exports.subscribe=subscribe;const getEventCount=()=>unifiedEventStore.getEventCount();exports.getEventCount=getEventCount;const isSourceSubscribed=u=>unifiedEventStore.isSourceSubscribed(u);exports.isSourceSubscribed=isSourceSubscribed;const getSubscriptionStatus=()=>unifiedEventStore.getSubscriptionStatus();exports.getSubscriptionStatus=getSubscriptionStatus;const unsubscribeAll=()=>unifiedEventStore.unsubscribeAll();exports.unsubscribeAll=unsubscribeAll;const setLocalEnabledSources=u=>unifiedEventStore.setLocalEnabledSources(u);exports.setLocalEnabledSources=setLocalEnabledSources;const getDiscoveredSources=()=>unifiedEventStore.getDiscoveredSources();exports.getDiscoveredSources=getDiscoveredSources;const getAvailableEventSources=()=>unifiedEventStore.getAvailableEventSources();exports.getAvailableEventSources=getAvailableEventSources;const subscribeToAll=()=>unifiedEventStore.subscribeToAll();exports.subscribeToAll=subscribeToAll;const getSubscriberCounts=()=>unifiedEventStore.getSubscriberCounts();exports.getSubscriberCounts=getSubscriberCounts;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.watchEvents=exports.unsubscribeFromZustand=exports.unsubscribeFromStorage=exports.unsubscribeFromRoutes=exports.unsubscribeFromRender=exports.unsubscribeFromRedux=exports.unsubscribeFromReactQuery=exports.unsubscribeFromNetwork=exports.unsubscribeFromJotai=exports.unsubscribeAll=exports.unifiedEventStore=exports.subscribeToZustand=exports.subscribeToStorage=exports.subscribeToRoutes=exports.subscribeToRender=exports.subscribeToRedux=exports.subscribeToReactQuery=exports.subscribeToNetwork=exports.subscribeToJotai=exports.subscribeToAll=exports.subscribe=exports.setLocalEnabledSources=exports.isSourceSubscribed=exports.getSubscriptionStatus=exports.getSubscriberCounts=exports.getSourceCounts=exports.getEvents=exports.getEventCount=exports.getDiscoveredSources=exports.getAvailableEventSources=exports.getActiveSources=exports.clearEvents=void 0;var _autoDiscoverEventSources=require("../utils/autoDiscoverEventSources");var _sharedUi=require("@buoy-gg/shared-ui");var _sourceIds=require("../sources/sourceIds");const MAX_EVENTS=200;const SUBSCRIBE_ALL_EXCLUDED_SOURCE_IDS=new Set(["render"]);class UnifiedEventStore extends _sharedUi.ChangeLog{activeSources=new Set;remoteAvailableSources=null;sourceUnsubscribers=new Map;remoteDiscoveryIds=new Set;localDiscoveryIds=new Set;localSyncChain=Promise.resolve();networkEventIdMap=new Map;constructor(){super({max:MAX_EVENTS})}getDiscoveredSources(){return(0,_autoDiscoverEventSources.getCachedDiscovery)().sources}getAvailableEventSources(){if(this.remoteAvailableSources){return this.remoteAvailableSources}return(0,_autoDiscoverEventSources.getCachedDiscovery)().availableEventSources}setRemoteAvailableSources(e){const s=e?new Set(e):null;const r=this.remoteAvailableSources;const o=r===null&&s===null||!!r&&!!s&&r.size===s.size&&[...s].every(t=>r.has(t));this.remoteAvailableSources=s;if(!o){this.notifyListeners()}}replaceEvents(e){this.activeSources=new Set(e.map(s=>s.source));this.setItems(e)}async subscribeToAll(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();for(const s of e){if(SUBSCRIBE_ALL_EXCLUDED_SOURCE_IDS.has(s.id)){continue}await this.subscribeToSource(s)}}async subscribeToSource(e){const s=this.sourceUnsubscribers.get(e.id);if(s){s.refCount++;return}const r={unsubscribe:()=>{},refCount:1};this.sourceUnsubscribers.set(e.id,r);try{if(e.setup){await e.setup()}const o=await e.subscribe(t=>{this.addEvent(t)});if(o){r.unsubscribe=o}}catch{if(this.sourceUnsubscribers.get(e.id)===r&&r.refCount<=1){this.sourceUnsubscribers.delete(e.id)}}}unsubscribeFromSource(e){const s=this.sourceUnsubscribers.get(e);if(!s)return;s.refCount--;if(s.refCount<=0){s.unsubscribe();this.sourceUnsubscribers.delete(e)}}async subscribeToStorage(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="storage");if(s){await this.subscribeToSource(s)}}unsubscribeFromStorage(){this.unsubscribeFromSource("storage");this.activeSources.delete("storage-async");this.activeSources.delete("storage-mmkv")}subscribeToRedux(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="redux");if(s){this.subscribeToSource(s)}}unsubscribeFromRedux(){this.unsubscribeFromSource("redux");this.activeSources.delete("redux")}subscribeToNetwork(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="network");if(s){this.subscribeToSource(s)}}unsubscribeFromNetwork(){this.unsubscribeFromSource("network");this.activeSources.delete("network")}subscribeToReactQuery(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="react-query");if(s){this.subscribeToSource(s)}}unsubscribeFromReactQuery(){this.unsubscribeFromSource("react-query");this.activeSources.delete("react-query");this.activeSources.delete("react-query-query");this.activeSources.delete("react-query-mutation")}subscribeToRoutes(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="route-events");if(s){this.subscribeToSource(s)}}unsubscribeFromRoutes(){this.unsubscribeFromSource("route-events");this.activeSources.delete("route")}subscribeToZustand(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="zustand");if(s){this.subscribeToSource(s)}}unsubscribeFromZustand(){this.unsubscribeFromSource("zustand");this.activeSources.delete("zustand")}subscribeToJotai(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="jotai");if(s){this.subscribeToSource(s)}}unsubscribeFromJotai(){this.unsubscribeFromSource("jotai");this.activeSources.delete("jotai")}subscribeToRender(){const{sources:e}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const s=e.find(r=>r.id==="render");if(s){this.subscribeToSource(s)}}unsubscribeFromRender(){this.unsubscribeFromSource("render");this.activeSources.delete("render")}addEvent(e){if(e.source==="network"){const s=e.originalEvent;if(s?.id){const r=this.networkEventIdMap.get(s.id);if(r){const o=this.items.findIndex(t=>t.id===r);if(o>=0){e.id=r;this.items=[...this.items.slice(0,o),e,...this.items.slice(o+1)];this.notifyListeners();return}}this.networkEventIdMap.set(s.id,e.id)}}this.push(e);this.activeSources.add(e.source);this.notifyListeners()}getEvents(e){if(!e||e.size===0){return this.items}return this.items.filter(s=>e.has(s.source))}getActiveSources(){return Array.from(this.activeSources)}getSourceCounts(){const e={"storage-async":0,"storage-mmkv":0,redux:0,network:0,"react-query":0,"react-query-query":0,"react-query-mutation":0,route:0,zustand:0,jotai:0,render:0};for(const s of this.items){e[s.source]++}return e}clearEvents(){this.activeSources.clear();this.networkEventIdMap.clear();this.clear()}subscribe(e){const s=super.subscribe(e);e(this.items);return s}getEventCount(){return this.items.length}unsubscribeAll(){for(const[,e]of this.sourceUnsubscribers){e.unsubscribe()}this.sourceUnsubscribers.clear();this.activeSources.clear();this.remoteDiscoveryIds.clear();this.localDiscoveryIds.clear()}watch(e,s,r=Date.now()){const o=new Set(e);const t=new Set;for(const n of e){const b=_sourceIds.EVENT_SOURCE_TO_DISCOVERY_ID[n];if(b)t.add(b)}const{sources:c}=(0,_autoDiscoverEventSources.getCachedDiscovery)();const i=[];for(const n of t){const b=c.find(h=>h.id===n);if(!b)continue;i.push(n);void this.subscribeToSource(b)}let a=false;const d=this.subscribe(n=>{if(a)return;s(n.filter(b=>b.timestamp>=r&&o.has(b.source)))});return()=>{if(a)return;a=true;d();for(const n of i)this.unsubscribeFromSource(n)}}setLocalEnabledSources(e){const s=async()=>{const r=new Set;for(const c of e){const i=_sourceIds.EVENT_SOURCE_TO_DISCOVERY_ID[c];if(i)r.add(i)}const o=this.localDiscoveryIds;this.localDiscoveryIds=r;const{sources:t}=(0,_autoDiscoverEventSources.getCachedDiscovery)();for(const c of r){if(!o.has(c)){const i=t.find(a=>a.id===c);if(i)await this.subscribeToSource(i)}}for(const c of o){if(!r.has(c)){this.unsubscribeFromSource(c)}}};this.localSyncChain=this.localSyncChain.then(s,s);return this.localSyncChain}async setRemoteEnabledSources(e){const{sources:s}=(0,_autoDiscoverEventSources.getCachedDiscovery)();let r;if(e==="all"){r=new Set(s.map(t=>t.id).filter(t=>!SUBSCRIBE_ALL_EXCLUDED_SOURCE_IDS.has(t)))}else{r=new Set;for(const t of e){const c=_sourceIds.EVENT_SOURCE_TO_DISCOVERY_ID[t];if(c)r.add(c)}}const o=this.remoteDiscoveryIds;this.remoteDiscoveryIds=r;for(const t of r){if(!o.has(t)){const c=s.find(i=>i.id===t);if(c)await this.subscribeToSource(c)}}for(const t of o){if(!r.has(t)){this.unsubscribeFromSource(t)}}}ensureRemoteSourcesDefault(){if(this.remoteDiscoveryIds.size===0){void this.setRemoteEnabledSources("all")}}clearRemoteSources(){for(const e of this.remoteDiscoveryIds){this.unsubscribeFromSource(e)}this.remoteDiscoveryIds.clear()}isSourceSubscribed(e){switch(e){case"storage-async":case"storage-mmkv":return this.sourceUnsubscribers.has("storage");case"redux":return this.sourceUnsubscribers.has("redux");case"network":return this.sourceUnsubscribers.has("network");case"react-query":case"react-query-query":case"react-query-mutation":return this.sourceUnsubscribers.has("react-query");case"route":return this.sourceUnsubscribers.has("route-events");case"zustand":return this.sourceUnsubscribers.has("zustand");case"jotai":return this.sourceUnsubscribers.has("jotai");case"render":return this.sourceUnsubscribers.has("render");default:return false}}getSubscriptionStatus(){return{"storage-async":this.sourceUnsubscribers.has("storage"),"storage-mmkv":this.sourceUnsubscribers.has("storage"),redux:this.sourceUnsubscribers.has("redux"),network:this.sourceUnsubscribers.has("network"),"react-query":this.sourceUnsubscribers.has("react-query"),"react-query-query":this.sourceUnsubscribers.has("react-query"),"react-query-mutation":this.sourceUnsubscribers.has("react-query"),route:this.sourceUnsubscribers.has("route-events"),zustand:this.sourceUnsubscribers.has("zustand"),jotai:this.sourceUnsubscribers.has("jotai"),render:this.sourceUnsubscribers.has("render")}}getSubscriberCounts(){return(0,_autoDiscoverEventSources.getAggregatedSubscriberCounts)()}}const unifiedEventStore=exports.unifiedEventStore=new UnifiedEventStore;const subscribeToStorage=()=>unifiedEventStore.subscribeToStorage();exports.subscribeToStorage=subscribeToStorage;const unsubscribeFromStorage=()=>unifiedEventStore.unsubscribeFromStorage();exports.unsubscribeFromStorage=unsubscribeFromStorage;const subscribeToRedux=()=>unifiedEventStore.subscribeToRedux();exports.subscribeToRedux=subscribeToRedux;const unsubscribeFromRedux=()=>unifiedEventStore.unsubscribeFromRedux();exports.unsubscribeFromRedux=unsubscribeFromRedux;const subscribeToNetwork=()=>unifiedEventStore.subscribeToNetwork();exports.subscribeToNetwork=subscribeToNetwork;const unsubscribeFromNetwork=()=>unifiedEventStore.unsubscribeFromNetwork();exports.unsubscribeFromNetwork=unsubscribeFromNetwork;const subscribeToReactQuery=()=>unifiedEventStore.subscribeToReactQuery();exports.subscribeToReactQuery=subscribeToReactQuery;const unsubscribeFromReactQuery=()=>unifiedEventStore.unsubscribeFromReactQuery();exports.unsubscribeFromReactQuery=unsubscribeFromReactQuery;const subscribeToRoutes=()=>unifiedEventStore.subscribeToRoutes();exports.subscribeToRoutes=subscribeToRoutes;const unsubscribeFromRoutes=()=>unifiedEventStore.unsubscribeFromRoutes();exports.unsubscribeFromRoutes=unsubscribeFromRoutes;const subscribeToZustand=()=>unifiedEventStore.subscribeToZustand();exports.subscribeToZustand=subscribeToZustand;const unsubscribeFromZustand=()=>unifiedEventStore.unsubscribeFromZustand();exports.unsubscribeFromZustand=unsubscribeFromZustand;const subscribeToJotai=()=>unifiedEventStore.subscribeToJotai();exports.subscribeToJotai=subscribeToJotai;const unsubscribeFromJotai=()=>unifiedEventStore.unsubscribeFromJotai();exports.unsubscribeFromJotai=unsubscribeFromJotai;const subscribeToRender=()=>unifiedEventStore.subscribeToRender();exports.subscribeToRender=subscribeToRender;const unsubscribeFromRender=()=>unifiedEventStore.unsubscribeFromRender();exports.unsubscribeFromRender=unsubscribeFromRender;const getEvents=u=>unifiedEventStore.getEvents(u);exports.getEvents=getEvents;const getActiveSources=()=>unifiedEventStore.getActiveSources();exports.getActiveSources=getActiveSources;const getSourceCounts=()=>unifiedEventStore.getSourceCounts();exports.getSourceCounts=getSourceCounts;const clearEvents=()=>unifiedEventStore.clearEvents();exports.clearEvents=clearEvents;const subscribe=u=>unifiedEventStore.subscribe(u);exports.subscribe=subscribe;const getEventCount=()=>unifiedEventStore.getEventCount();exports.getEventCount=getEventCount;const isSourceSubscribed=u=>unifiedEventStore.isSourceSubscribed(u);exports.isSourceSubscribed=isSourceSubscribed;const getSubscriptionStatus=()=>unifiedEventStore.getSubscriptionStatus();exports.getSubscriptionStatus=getSubscriptionStatus;const unsubscribeAll=()=>unifiedEventStore.unsubscribeAll();exports.unsubscribeAll=unsubscribeAll;const setLocalEnabledSources=u=>unifiedEventStore.setLocalEnabledSources(u);exports.setLocalEnabledSources=setLocalEnabledSources;const getDiscoveredSources=()=>unifiedEventStore.getDiscoveredSources();exports.getDiscoveredSources=getDiscoveredSources;const getAvailableEventSources=()=>unifiedEventStore.getAvailableEventSources();exports.getAvailableEventSources=getAvailableEventSources;const subscribeToAll=()=>unifiedEventStore.subscribeToAll();exports.subscribeToAll=subscribeToAll;const watchEvents=(u,e,s)=>unifiedEventStore.watch(u,e,s);exports.watchEvents=watchEvents;const getSubscriberCounts=()=>unifiedEventStore.getSubscriberCounts();exports.getSubscriberCounts=getSubscriberCounts;
|
package/lib/module/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{eventsToolPreset,createEventsTool}from"./preset";export{UnifiedEventViewer}from"./components/UnifiedEventViewer";export{EventsModal,EventsToolView}from"./components/EventsModal";export{eventsSyncAdapter}from"./sync/eventsSyncAdapter";export{useUnifiedEvents}from"./hooks/useUnifiedEvents";export{isBuoyInternalEvent,isNetworkEventIgnored,isEventHiddenFromTool}from"./utils/eventVisibility";export{DEFAULT_COPY_SETTINGS,COPY_PRESETS,PRESET_METADATA,detectActivePreset}from"./types/copySettings";export{UnifiedEventItem}from"./components/UnifiedEventItem";export{UnifiedEventList}from"./components/UnifiedEventList";export{UnifiedEventFilters}from"./components/UnifiedEventFilters";export{UnifiedEventDetail}from"./components/UnifiedEventDetail";export{ReactQueryEventDetail}from"./components/ReactQueryEventDetail";export{EventsCopySettingsView}from"./components/EventsCopySettingsView";export{EVENTS_TEST_ID,eventRowTestID,eventFilterTestID,eventIdentity}from"./utils/testIDs";export{findRelatedEvents,hasRelatedEvents,getRelatedEventsCount,buildCorrelationCountMap,getCorrelationGroup,getCorrelationLabel,getCorrelationColor}from"./utils/correlationUtils";export{generateExport,generateMarkdownExport,generateJsonExport,generatePlaintextExport,generateMermaidExport,estimateExportSize,getExportSummary,filterEvents}from"./utils/eventExportFormatter";export{loadCopySettings,saveCopySettings,clearCopySettings}from"./utils/copySettingsStorage";export{unifiedEventStore}from"./stores/unifiedEventStore";
|
|
1
|
+
"use strict";export{eventsToolPreset,createEventsTool}from"./preset";export{UnifiedEventViewer}from"./components/UnifiedEventViewer";export{EventsModal,EventsToolView}from"./components/EventsModal";export{eventsSyncAdapter}from"./sync/eventsSyncAdapter";export{useUnifiedEvents}from"./hooks/useUnifiedEvents";export{watchEvents}from"./stores/unifiedEventStore";export{isBuoyInternalEvent,isNetworkEventIgnored,isEventHiddenFromTool}from"./utils/eventVisibility";export{DEFAULT_COPY_SETTINGS,COPY_PRESETS,PRESET_METADATA,detectActivePreset}from"./types/copySettings";export{UnifiedEventItem}from"./components/UnifiedEventItem";export{UnifiedEventList}from"./components/UnifiedEventList";export{UnifiedEventFilters}from"./components/UnifiedEventFilters";export{UnifiedEventDetail}from"./components/UnifiedEventDetail";export{ReactQueryEventDetail}from"./components/ReactQueryEventDetail";export{EventsCopySettingsView}from"./components/EventsCopySettingsView";export{EVENTS_TEST_ID,eventRowTestID,eventFilterTestID,eventIdentity}from"./utils/testIDs";export{findRelatedEvents,hasRelatedEvents,getRelatedEventsCount,buildCorrelationCountMap,getCorrelationGroup,getCorrelationLabel,getCorrelationColor}from"./utils/correlationUtils";export{generateExport,generateMarkdownExport,generateJsonExport,generatePlaintextExport,generateMermaidExport,estimateExportSize,getExportSummary,filterEvents}from"./utils/eventExportFormatter";export{loadCopySettings,saveCopySettings,clearCopySettings}from"./utils/copySettingsStorage";export{unifiedEventStore}from"./stores/unifiedEventStore";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{getCachedDiscovery as i,getAggregatedSubscriberCounts as
|
|
1
|
+
"use strict";import{getCachedDiscovery as i,getAggregatedSubscriberCounts as m}from"../utils/autoDiscoverEventSources";import{ChangeLog as v}from"@buoy-gg/shared-ui";import{EVENT_SOURCE_TO_DISCOVERY_ID as h}from"../sources/sourceIds";const g=200;const S=new Set(["render"]);class y extends v{activeSources=new Set;remoteAvailableSources=null;sourceUnsubscribers=new Map;remoteDiscoveryIds=new Set;localDiscoveryIds=new Set;localSyncChain=Promise.resolve();networkEventIdMap=new Map;constructor(){super({max:g})}getDiscoveredSources(){return i().sources}getAvailableEventSources(){if(this.remoteAvailableSources){return this.remoteAvailableSources}return i().availableEventSources}setRemoteAvailableSources(e){const s=e?new Set(e):null;const r=this.remoteAvailableSources;const o=r===null&&s===null||!!r&&!!s&&r.size===s.size&&[...s].every(t=>r.has(t));this.remoteAvailableSources=s;if(!o){this.notifyListeners()}}replaceEvents(e){this.activeSources=new Set(e.map(s=>s.source));this.setItems(e)}async subscribeToAll(){const{sources:e}=i();for(const s of e){if(S.has(s.id)){continue}await this.subscribeToSource(s)}}async subscribeToSource(e){const s=this.sourceUnsubscribers.get(e.id);if(s){s.refCount++;return}const r={unsubscribe:()=>{},refCount:1};this.sourceUnsubscribers.set(e.id,r);try{if(e.setup){await e.setup()}const o=await e.subscribe(t=>{this.addEvent(t)});if(o){r.unsubscribe=o}}catch{if(this.sourceUnsubscribers.get(e.id)===r&&r.refCount<=1){this.sourceUnsubscribers.delete(e.id)}}}unsubscribeFromSource(e){const s=this.sourceUnsubscribers.get(e);if(!s)return;s.refCount--;if(s.refCount<=0){s.unsubscribe();this.sourceUnsubscribers.delete(e)}}async subscribeToStorage(){const{sources:e}=i();const s=e.find(r=>r.id==="storage");if(s){await this.subscribeToSource(s)}}unsubscribeFromStorage(){this.unsubscribeFromSource("storage");this.activeSources.delete("storage-async");this.activeSources.delete("storage-mmkv")}subscribeToRedux(){const{sources:e}=i();const s=e.find(r=>r.id==="redux");if(s){this.subscribeToSource(s)}}unsubscribeFromRedux(){this.unsubscribeFromSource("redux");this.activeSources.delete("redux")}subscribeToNetwork(){const{sources:e}=i();const s=e.find(r=>r.id==="network");if(s){this.subscribeToSource(s)}}unsubscribeFromNetwork(){this.unsubscribeFromSource("network");this.activeSources.delete("network")}subscribeToReactQuery(){const{sources:e}=i();const s=e.find(r=>r.id==="react-query");if(s){this.subscribeToSource(s)}}unsubscribeFromReactQuery(){this.unsubscribeFromSource("react-query");this.activeSources.delete("react-query");this.activeSources.delete("react-query-query");this.activeSources.delete("react-query-mutation")}subscribeToRoutes(){const{sources:e}=i();const s=e.find(r=>r.id==="route-events");if(s){this.subscribeToSource(s)}}unsubscribeFromRoutes(){this.unsubscribeFromSource("route-events");this.activeSources.delete("route")}subscribeToZustand(){const{sources:e}=i();const s=e.find(r=>r.id==="zustand");if(s){this.subscribeToSource(s)}}unsubscribeFromZustand(){this.unsubscribeFromSource("zustand");this.activeSources.delete("zustand")}subscribeToJotai(){const{sources:e}=i();const s=e.find(r=>r.id==="jotai");if(s){this.subscribeToSource(s)}}unsubscribeFromJotai(){this.unsubscribeFromSource("jotai");this.activeSources.delete("jotai")}subscribeToRender(){const{sources:e}=i();const s=e.find(r=>r.id==="render");if(s){this.subscribeToSource(s)}}unsubscribeFromRender(){this.unsubscribeFromSource("render");this.activeSources.delete("render")}addEvent(e){if(e.source==="network"){const s=e.originalEvent;if(s?.id){const r=this.networkEventIdMap.get(s.id);if(r){const o=this.items.findIndex(t=>t.id===r);if(o>=0){e.id=r;this.items=[...this.items.slice(0,o),e,...this.items.slice(o+1)];this.notifyListeners();return}}this.networkEventIdMap.set(s.id,e.id)}}this.push(e);this.activeSources.add(e.source);this.notifyListeners()}getEvents(e){if(!e||e.size===0){return this.items}return this.items.filter(s=>e.has(s.source))}getActiveSources(){return Array.from(this.activeSources)}getSourceCounts(){const e={"storage-async":0,"storage-mmkv":0,redux:0,network:0,"react-query":0,"react-query-query":0,"react-query-mutation":0,route:0,zustand:0,jotai:0,render:0};for(const s of this.items){e[s.source]++}return e}clearEvents(){this.activeSources.clear();this.networkEventIdMap.clear();this.clear()}subscribe(e){const s=super.subscribe(e);e(this.items);return s}getEventCount(){return this.items.length}unsubscribeAll(){for(const[,e]of this.sourceUnsubscribers){e.unsubscribe()}this.sourceUnsubscribers.clear();this.activeSources.clear();this.remoteDiscoveryIds.clear();this.localDiscoveryIds.clear()}watch(e,s,r=Date.now()){const o=new Set(e);const t=new Set;for(const b of e){const a=h[b];if(a)t.add(a)}const{sources:c}=i();const n=[];for(const b of t){const a=c.find(f=>f.id===b);if(!a)continue;n.push(b);void this.subscribeToSource(a)}let d=false;const l=this.subscribe(b=>{if(d)return;s(b.filter(a=>a.timestamp>=r&&o.has(a.source)))});return()=>{if(d)return;d=true;l();for(const b of n)this.unsubscribeFromSource(b)}}setLocalEnabledSources(e){const s=async()=>{const r=new Set;for(const c of e){const n=h[c];if(n)r.add(n)}const o=this.localDiscoveryIds;this.localDiscoveryIds=r;const{sources:t}=i();for(const c of r){if(!o.has(c)){const n=t.find(d=>d.id===c);if(n)await this.subscribeToSource(n)}}for(const c of o){if(!r.has(c)){this.unsubscribeFromSource(c)}}};this.localSyncChain=this.localSyncChain.then(s,s);return this.localSyncChain}async setRemoteEnabledSources(e){const{sources:s}=i();let r;if(e==="all"){r=new Set(s.map(t=>t.id).filter(t=>!S.has(t)))}else{r=new Set;for(const t of e){const c=h[t];if(c)r.add(c)}}const o=this.remoteDiscoveryIds;this.remoteDiscoveryIds=r;for(const t of r){if(!o.has(t)){const c=s.find(n=>n.id===t);if(c)await this.subscribeToSource(c)}}for(const t of o){if(!r.has(t)){this.unsubscribeFromSource(t)}}}ensureRemoteSourcesDefault(){if(this.remoteDiscoveryIds.size===0){void this.setRemoteEnabledSources("all")}}clearRemoteSources(){for(const e of this.remoteDiscoveryIds){this.unsubscribeFromSource(e)}this.remoteDiscoveryIds.clear()}isSourceSubscribed(e){switch(e){case"storage-async":case"storage-mmkv":return this.sourceUnsubscribers.has("storage");case"redux":return this.sourceUnsubscribers.has("redux");case"network":return this.sourceUnsubscribers.has("network");case"react-query":case"react-query-query":case"react-query-mutation":return this.sourceUnsubscribers.has("react-query");case"route":return this.sourceUnsubscribers.has("route-events");case"zustand":return this.sourceUnsubscribers.has("zustand");case"jotai":return this.sourceUnsubscribers.has("jotai");case"render":return this.sourceUnsubscribers.has("render");default:return false}}getSubscriptionStatus(){return{"storage-async":this.sourceUnsubscribers.has("storage"),"storage-mmkv":this.sourceUnsubscribers.has("storage"),redux:this.sourceUnsubscribers.has("redux"),network:this.sourceUnsubscribers.has("network"),"react-query":this.sourceUnsubscribers.has("react-query"),"react-query-query":this.sourceUnsubscribers.has("react-query"),"react-query-mutation":this.sourceUnsubscribers.has("react-query"),route:this.sourceUnsubscribers.has("route-events"),zustand:this.sourceUnsubscribers.has("zustand"),jotai:this.sourceUnsubscribers.has("jotai"),render:this.sourceUnsubscribers.has("render")}}getSubscriberCounts(){return m()}}export const unifiedEventStore=new y;export const subscribeToStorage=()=>unifiedEventStore.subscribeToStorage();export const unsubscribeFromStorage=()=>unifiedEventStore.unsubscribeFromStorage();export const subscribeToRedux=()=>unifiedEventStore.subscribeToRedux();export const unsubscribeFromRedux=()=>unifiedEventStore.unsubscribeFromRedux();export const subscribeToNetwork=()=>unifiedEventStore.subscribeToNetwork();export const unsubscribeFromNetwork=()=>unifiedEventStore.unsubscribeFromNetwork();export const subscribeToReactQuery=()=>unifiedEventStore.subscribeToReactQuery();export const unsubscribeFromReactQuery=()=>unifiedEventStore.unsubscribeFromReactQuery();export const subscribeToRoutes=()=>unifiedEventStore.subscribeToRoutes();export const unsubscribeFromRoutes=()=>unifiedEventStore.unsubscribeFromRoutes();export const subscribeToZustand=()=>unifiedEventStore.subscribeToZustand();export const unsubscribeFromZustand=()=>unifiedEventStore.unsubscribeFromZustand();export const subscribeToJotai=()=>unifiedEventStore.subscribeToJotai();export const unsubscribeFromJotai=()=>unifiedEventStore.unsubscribeFromJotai();export const subscribeToRender=()=>unifiedEventStore.subscribeToRender();export const unsubscribeFromRender=()=>unifiedEventStore.unsubscribeFromRender();export const getEvents=u=>unifiedEventStore.getEvents(u);export const getActiveSources=()=>unifiedEventStore.getActiveSources();export const getSourceCounts=()=>unifiedEventStore.getSourceCounts();export const clearEvents=()=>unifiedEventStore.clearEvents();export const subscribe=u=>unifiedEventStore.subscribe(u);export const getEventCount=()=>unifiedEventStore.getEventCount();export const isSourceSubscribed=u=>unifiedEventStore.isSourceSubscribed(u);export const getSubscriptionStatus=()=>unifiedEventStore.getSubscriptionStatus();export const unsubscribeAll=()=>unifiedEventStore.unsubscribeAll();export const setLocalEnabledSources=u=>unifiedEventStore.setLocalEnabledSources(u);export const getDiscoveredSources=()=>unifiedEventStore.getDiscoveredSources();export const getAvailableEventSources=()=>unifiedEventStore.getAvailableEventSources();export const subscribeToAll=()=>unifiedEventStore.subscribeToAll();export const watchEvents=(u,e,s)=>unifiedEventStore.watch(u,e,s);export const getSubscriberCounts=()=>unifiedEventStore.getSubscriberCounts();
|
|
@@ -15,6 +15,7 @@ export { EventsModal, EventsToolView } from "./components/EventsModal";
|
|
|
15
15
|
export type { OptionalDetailComponents } from "./components/UnifiedEventDetail";
|
|
16
16
|
export { eventsSyncAdapter } from "./sync/eventsSyncAdapter";
|
|
17
17
|
export { useUnifiedEvents } from "./hooks/useUnifiedEvents";
|
|
18
|
+
export { watchEvents } from "./stores/unifiedEventStore";
|
|
18
19
|
export type { UseUnifiedEventsResult } from "./hooks/useUnifiedEvents";
|
|
19
20
|
export { isBuoyInternalEvent, isNetworkEventIgnored, isEventHiddenFromTool, } from "./utils/eventVisibility";
|
|
20
21
|
export type { UnifiedEvent, EventSource, EventStatus, EventFilter, SourceInfo, UnifiedEventListener, EventsCopySettings, CopyPresetName, } from "./types";
|
|
@@ -161,6 +161,14 @@ declare class UnifiedEventStore extends ChangeLog<UnifiedEvent> {
|
|
|
161
161
|
* refs the power toggle can't release. Ref-counting in the store still keeps
|
|
162
162
|
* a watching dashboard's subscriptions alive independently.
|
|
163
163
|
*/
|
|
164
|
+
/**
|
|
165
|
+
* Capture `sources` and hand `onEvents` every event from them since
|
|
166
|
+
* `since`, each at its latest version (a network request that finishes
|
|
167
|
+
* replaces its pending row). Ref-counted like the other consumers, so
|
|
168
|
+
* stopping never turns off capture someone else is using. Used by
|
|
169
|
+
* @buoy-gg/lifecycle's report of what the app did after a simulation.
|
|
170
|
+
*/
|
|
171
|
+
watch(sources: EventSource[], onEvents: (events: UnifiedEvent[]) => void, since?: number): () => void;
|
|
164
172
|
setLocalEnabledSources(sources: EventSource[]): Promise<void>;
|
|
165
173
|
/**
|
|
166
174
|
* Remote-consumer channel: the dashboard sync adapter declares which event
|
|
@@ -227,6 +235,7 @@ export declare const setLocalEnabledSources: (sources: EventSource[]) => Promise
|
|
|
227
235
|
export declare const getDiscoveredSources: () => DiscoveredEventSource[];
|
|
228
236
|
export declare const getAvailableEventSources: () => Set<EventSource>;
|
|
229
237
|
export declare const subscribeToAll: () => Promise<void>;
|
|
238
|
+
export declare const watchEvents: (sources: EventSource[], onEvents: (events: UnifiedEvent[]) => void, since?: number) => () => void;
|
|
230
239
|
export declare const getSubscriberCounts: () => AggregatedSubscriberCounts;
|
|
231
240
|
export type { AggregatedSubscriberCounts } from "../utils/autoDiscoverEventSources";
|
|
232
241
|
//# sourceMappingURL=unifiedEventStore.d.ts.map
|
package/lib/web/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use client";var Wt=Object.defineProperty;var Qr=Object.getOwnPropertyDescriptor;var Gr=Object.getOwnPropertyNames;var Zr=Object.prototype.hasOwnProperty;var Yr=(e,t)=>{for(var r in t)Wt(e,r,{get:t[r],enumerable:true})},Kt=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Gr(t))!Zr.call(e,o)&&o!==r&&Wt(e,o,{get:()=>t[o],enumerable:!(a=Qr(t,o))||a.enumerable});return e},Xr=(e,t,r)=>(Kt(e,t,"default"),r&&Kt(r,t,"default"));typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{EventsIcon as eo,EVENTS_ICON_COLOR as to}from"@buoy-gg/floating-tools-core/web";var _t={};Yr(_t,{AccessibilityInfo:()=>no,ActivityIndicator:()=>ea,Alert:()=>Gt,Animated:()=>io,AppRegistry:()=>lo,AppState:()=>uo,Appearance:()=>so,BackHandler:()=>co,Button:()=>ta,CheckBox:()=>Do,Clipboard:()=>mo,DeviceEventEmitter:()=>Uo,Dimensions:()=>po,Easing:()=>ho,FlatList:()=>Qt,I18nManager:()=>go,Image:()=>To,ImageBackground:()=>Io,InteractionManager:()=>yo,Keyboard:()=>fo,KeyboardAvoidingView:()=>Ao,LayoutAnimation:()=>bo,Linking:()=>vo,LogBox:()=>Oo,Modal:()=>Yo,NativeEventEmitter:()=>So,NativeModules:()=>ao,PanResponder:()=>Co,Picker:()=>qo,PixelRatio:()=>wo,Platform:()=>Eo,Pressable:()=>Zo,ProgressBar:()=>Bo,RefreshControl:()=>Fo,SafeAreaView:()=>Ro,ScrollView:()=>ue,SectionList:()=>jo,Share:()=>xo,StatusBar:()=>zo,StyleSheet:()=>le,Switch:()=>Xo,Text:()=>k,TextInput:()=>_o,Touchable:()=>Mo,TouchableHighlight:()=>Qo,TouchableNativeFeedback:()=>Po,TouchableOpacity:()=>ge,TouchableWithoutFeedback:()=>Go,UIManager:()=>$o,Vibration:()=>ko,View:()=>f,VirtualizedList:()=>No,YellowBox:()=>Vo,findNodeHandle:()=>ra,unstable_createElement:()=>oo,useColorScheme:()=>Lo,useLocaleContext:()=>Ho,useWindowDimensions:()=>Jo});Xr(_t,ro);import*as ro from"react-native-web";import{unstable_createElement as oo,NativeModules as ao,AccessibilityInfo as no,Animated as io,Appearance as so,AppRegistry as lo,AppState as uo,BackHandler as co,Clipboard as mo,Dimensions as po,Easing as ho,I18nManager as go,Keyboard as fo,InteractionManager as yo,LayoutAnimation as bo,Linking as vo,NativeEventEmitter as So,PanResponder as Co,PixelRatio as wo,Platform as Eo,Share as xo,StyleSheet as le,UIManager as $o,Vibration as ko,CheckBox as Do,FlatList as Qt,Image as To,ImageBackground as Io,KeyboardAvoidingView as Ao,Picker as qo,ProgressBar as Bo,RefreshControl as Fo,SafeAreaView as Ro,SectionList as jo,StatusBar as zo,Touchable as Mo,TouchableNativeFeedback as Po,VirtualizedList as No,YellowBox as Vo,LogBox as Oo,DeviceEventEmitter as Uo,useColorScheme as Lo,useLocaleContext as Ho,useWindowDimensions as Jo}from"react-native-web";import*as J from"react-native-web";import{createElement as Wo,forwardRef as Ko}from"react";function Z(e){let t=Ko((a,o)=>{let{accessibilityState:n,accessibilityValue:i,...l}=a;for(let s of["busy","checked","disabled","expanded","selected"])n?.[s]!==void 0&&l[`aria-${s}`]===void 0&&(l[`aria-${s}`]=n[s]);for(let[s,u]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[s]!==void 0&&l[`aria-${u}`]===void 0&&(l[`aria-${u}`]=i[s]);return Wo(e,{...l,ref:o})}),r=e.State;return r&&Object.assign(t,{State:r}),t.displayName=e.displayName??e.name??"NativeWebView",t}var f=Z(J.View),k=Z(J.Text),_o=Z(J.TextInput),ge=Z(J.TouchableOpacity),Qo=Z(J.TouchableHighlight),Go=Z(J.TouchableWithoutFeedback),Zo=Z(J.Pressable),ue=Z(J.ScrollView),Yo=Z(J.Modal),Xo=Z(J.Switch),ea=Z(J.ActivityIndicator),ta=Z(J.Button),ra=J.findNodeHandle,Gt={alert(e,t,r,a){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 n=document.createElement("h2");if(n.textContent=e,n.style.cssText="font-size:18px;margin:0 0 12px",o.appendChild(n),t){let u=document.createElement("p");u.textContent=t,u.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",o.appendChild(u)}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"}],s=()=>{o.close?.(),o.remove()};for(let u of l){let c=document.createElement("button");c.type="button",c.textContent=u.text??"OK",c.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${u.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,c.onclick=()=>{s(),u.onPress?.()},i.appendChild(c)}o.addEventListener("cancel",u=>{u.preventDefault(),a?.cancelable!==false&&(s(),a?.onDismiss?.())}),o.appendChild(i),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};import{useState as ot,useCallback as Ae,useEffect as oa,useRef as aa}from"react";import{JsModal as na,ModalHeader as Y,buoyColors as ia,night as X,Trash2 as sa,Copy as la,Search as ua,devToolsStorageKeys as ca,ToolbarCopyButton as da,UpgradeModal as ma,PowerToggleButton as pa,useSafeRouter as ha,windowDragProps as ga}from"@buoy-gg/shared-ui/web";import{useState as fe,useEffect as ye,useCallback as be,useMemo as ve,useRef as yt}from"react";import{useFeatureGate as fa,subscribeToSubscriberCountChanges as ya,useIgnoredPatterns as ba,useLimit as va}from"@buoy-gg/shared-ui/web";import{loadToolModule as ee,getToolModuleVersion as Zt}from"@buoy-gg/shared-ui/web/utils";var Sa=0;function me(e){return`${e}-${Date.now()}-${++Sa}`}function Ca(){try{let{storageEventStore:e}=ee("@buoy-gg/storage");return{id:"storage",name:"Storage",eventSources:["storage-async","storage-mmkv"],available:true,subscribe:t=>e.onEvent(r=>{if(r?.data?.initialScan)return;let a=wa(r);t(a)})}}catch{return null}}function wa(e){let t=e,r=t.storageType==="async"?"storage-async":"storage-mmkv",a=t.action;t.storageType==="async"&&(a={setItem:"Set Item",removeItem:"Remove Item",mergeItem:"Merge Item",clear:"Clear All",multiSet:"Multi Set",multiRemove:"Multi Remove",multiMerge:"Multi Merge"}[t.action]||t.action);let o="";if(t.storageType==="async")switch(t.action){case"setItem":case"removeItem":case"mergeItem":o=t.data?.key||"unknown key";break;case"multiSet":case"multiMerge":{let i=t.data?.pairs?.length||0;o=`${i} key${i!==1?"s":""}`;break}case"multiRemove":{let i=t.data?.keys?.length||0;o=`${i} key${i!==1?"s":""}`;break}case"clear":o="all keys";break}else o=t.data?.key||t.data?.instanceId||"unknown";let n="neutral";return(t.action.includes("set")||t.action.includes("Set")||t.action.includes("merge")||t.action.includes("Merge"))&&(n="success"),{id:me(r),source:r,timestamp:t.timestamp.getTime(),title:a,subtitle:o,status:n,originalEvent:e}}function Ea(){try{let{reduxActionStore:e}=ee("@buoy-gg/redux"),t=null;return{id:"redux",name:"Redux",eventSources:["redux"],available:true,subscribe:r=>e.subscribe(a=>{if(a.length>0){let o=a[0];if(o.id!==t){t=o.id;let n=xa(o);r(n)}}})}}catch{return null}}function xa(e){let t=e,r="neutral";switch(t.category){case"fulfilled":r="success";break;case"rejected":r="error";break;case"pending":r="pending";break;default:r=t.hasStateChange?"success":"neutral"}let a="";return t.payloadPreview?a=t.payloadPreview:t.hasStateChange&&t.diffSummary?a=t.diffSummary:t.duration!==void 0?a=`${t.duration.toFixed(1)}ms`:a=t.sliceName||"",{id:me("redux"),source:"redux",timestamp:t.timestamp,title:t.type,subtitle:a,status:r,originalEvent:e}}function $a(){try{let{networkEventStore:e,networkListener:t,addNetworkListener:r}=ee("@buoy-gg/network"),a=new Map;return{id:"network",name:"Network",eventSources:["network"],available:true,setup:()=>{let o=t();o.isActive||o.startListening(),o.listenerCount===0&&r(n=>{e.processNetworkEvent(n)})},subscribe:o=>{let n=Date.now();return e.onEvent(i=>{let l=i,s=a.get(l.id);if(s){let u=Yt(i);u.id=s,o(u)}else{if(typeof l.timestamp=="number"&&l.timestamp<n)return;let u=Yt(i);a.set(l.id,u.id),o(u)}},false)}}}catch{return null}}function Yt(e){let t=e,r="neutral";t.status===void 0?r="pending":t.error||t.status>=400?r="error":t.status>=200&&t.status<400&&(r="success");let a=t.operationName||`${t.method} ${t.path||t.url}`,o=[];return t.status!==void 0?o.push(`${t.status}`):t.error?o.push("Error"):o.push("Pending"),t.duration!==void 0&&o.push(`${t.duration.toFixed(0)}ms`),t.host&&o.push(t.host),{id:me("network"),source:"network",timestamp:t.timestamp,title:a,subtitle:o.join(" \xB7 "),status:r,originalEvent:e}}function ka(){try{let{reactQueryEventStore:e}=ee("@buoy-gg/react-query"),t=null;return{id:"react-query",name:"React Query",eventSources:["react-query","react-query-query","react-query-mutation"],available:true,subscribe:r=>{let a=true,o=new Set,n=i=>i.queryHash??(i.mutationId!==void 0?`m-${i.mutationId}`:null);return e.subscribe(i=>{if(a){a=false,i.length>0&&(t=i[0].id);return}if(i.length>0){let l=i[0];if(l.id!==t){t=l.id;let s=l.type??"",u=n(l);if(s==="query-fetch-start"||s==="mutation-start")u&&o.add(u);else if((s==="query-fetch-success"||s==="query-fetch-error"||s==="mutation-success"||s==="mutation-error")&&u&&!o.has(u))return;let c=Da(l);r(c)}}})}}}catch{return null}}function Xt(e){return!e||e.length===0?"unknown":e.map(t=>{if(typeof t=="string")return t;if(typeof t=="number")return String(t);if(typeof t=="object"&&t!==null){let r=Object.values(t)[0];return typeof r=="string"||typeof r=="number"?String(r):JSON.stringify(t).slice(0,20)}return String(t)}).join(" \u203A ")}function Da(e){let t=e,r=t.type.startsWith("mutation-")?"react-query-mutation":"react-query-query",a="neutral";switch(t.type){case"query-fetch-start":case"mutation-start":a="pending";break;case"query-fetch-success":case"mutation-success":a="success";break;case"query-fetch-error":case"mutation-error":a="error";break}let o="";t.queryKey?o=Xt(t.queryKey):t.mutationKey?o=Xt(t.mutationKey):t.mutationId!==void 0?o=`Mutation #${t.mutationId}`:o=t.type.replace(/-/g," ");let n=[];switch(t.type){case"query-fetch-start":n.push("Fetching");break;case"query-fetch-success":n.push("Success");break;case"query-fetch-error":n.push("Error");break;case"query-invalidated":n.push("Invalidated");break;case"mutation-start":n.push("Mutating");break;case"mutation-success":n.push("Success");break;case"mutation-error":n.push("Error");break}t.duration!==void 0&&n.push(`${t.duration.toFixed(0)}ms`);let i;t.queryHash?i=`rq-query-${t.queryHash}`:t.mutationId!==void 0&&(i=`rq-mutation-${t.mutationId}`);let l=1;switch(t.type){case"query-fetch-start":case"mutation-start":l=1;break;case"query-fetch-success":case"query-fetch-error":case"mutation-success":case"mutation-error":l=2;break;case"query-invalidated":l=3;break}return{id:me(r),source:r,timestamp:t.timestamp,title:o,subtitle:n.join(" \xB7 "),status:a,originalEvent:e,correlationId:i,sequenceInGroup:l}}function Ta(){try{let{routeEventStore:e}=ee("@buoy-gg/route-events");return{id:"route-events",name:"Routes",eventSources:["route"],available:true,subscribe:t=>e.onEvent(r=>{let a=Ia(r);t(a)})}}catch{return null}}function Ia(e){let t=e,r="neutral";(t.pathname==="/"||Object.keys(t.params).length>0)&&(r="success");let a=[],o=Object.keys(t.params).length;return o>0&&a.push(`${o} param${o!==1?"s":""}`),t.timeSincePrevious!==void 0&&t.timeSincePrevious>0&&(t.timeSincePrevious<1e3?a.push(`${t.timeSincePrevious}ms`):a.push(`${(t.timeSincePrevious/1e3).toFixed(1)}s`)),t.previousPathname&&t.previousPathname!==t.pathname&&a.push(`from ${t.previousPathname}`),{id:me("route"),source:"route",timestamp:t.timestamp,title:t.pathname||"/",subtitle:a.join(" \xB7 ")||"navigation",status:r,originalEvent:e}}function Aa(){try{let{zustandStateStore:e}=ee("@buoy-gg/zustand"),t=null;return{id:"zustand",name:"Zustand",eventSources:["zustand"],available:true,subscribe:r=>e.subscribe(a=>{if(a.length>0){let o=a[0];if(o.id!==t){t=o.id;let n=qa(o);r(n)}}})}}catch{return null}}function qa(e){let t=e,r="neutral";t.isSlowUpdate?r="pending":t.hasStateChange&&(r="success");let a=[];if(t.changedKeys&&t.changedKeys.length>0){let o=t.changedKeys.slice(0,3).join(", "),n=t.changedKeys.length>3?` +${t.changedKeys.length-3}`:"";a.push(`${o}${n}`)}else t.diffSummary&&a.push(t.diffSummary);return t.duration!==void 0&&a.push(`${t.duration.toFixed(1)}ms`),t.category==="replace"&&a.push("replace"),{id:me("zustand"),source:"zustand",timestamp:t.timestamp,title:t.storeName,subtitle:a.join(" \xB7 ")||(t.hasStateChange?"state changed":"no change"),status:r,originalEvent:e}}function Ba(){try{let{jotaiStateStore:e}=ee("@buoy-gg/jotai"),t=null;return{id:"jotai",name:"Jotai",eventSources:["jotai"],available:true,subscribe:r=>e.subscribe(a=>{if(a.length>0){let o=a[0];if(o.id!==t){t=o.id;let n=Fa(o);r(n)}}})}}catch{return null}}function Fa(e){let t=e,r="neutral";t.category==="write"&&t.hasValueChange?r="success":t.category==="read"&&(r="neutral");let a=[];return t.valuePreview?a.push(t.valuePreview):t.diffSummary&&a.push(t.diffSummary),t.category&&a.push(t.category),{id:me("jotai"),source:"jotai",timestamp:t.timestamp,title:t.atomLabel,subtitle:a.join(" \xB7 ")||(t.hasValueChange?"value changed":"no change"),status:r,originalEvent:e}}function Ra(){let e;try{e=ee("@buoy-gg/highlight-updates")}catch{return null}try{if(!e.RenderTracker||!e.HighlightUpdatesController)return null;let{RenderTracker:t,HighlightUpdatesController:r}=e;return{id:"render",name:"Render",eventSources:["render"],available:true,setup:()=>{r&&r.enableBackgroundTracking()},subscribe:a=>{r&&!r.isBackgroundTrackingEnabled()&&r.enableBackgroundTracking();let o=t.onRenderEvent((n,i)=>{let l=ja(n,i);a(l)});return()=>{o(),r.disableBackgroundTracking()}}}}catch{return null}}function ja(e,t){let r=e,a=t,o=a.componentName||a.displayName||a.viewType,n=[],i={mount:"mounted",props:"props changed",state:"state changed",hooks:"hooks changed",context:"context changed",parent:"parent re-rendered",unknown:"re-rendered"};if(n.push(i[r.cause.type]||r.cause.type),r.cause.type==="props"&&r.cause.changedKeys?.length){let s=r.cause.changedKeys.slice(0,3).join(", "),u=r.cause.changedKeys.length>3?` +${r.cause.changedKeys.length-3}`:"";n.push(`[${s}${u}]`)}if(r.cause.hookChanges?.length){let s=r.cause.hookChanges[0];s.description&&n.push(s.description)}n.push(`#${r.renderNumber}`);let l="neutral";switch(r.cause.type){case"mount":l="neutral";break;case"props":case"state":case"hooks":case"context":l="success";break;case"parent":l="pending";break;default:l="neutral"}return{id:me("render"),source:"render",timestamp:r.timestamp,title:o,subtitle:n.join(" \xB7 "),status:l,originalEvent:{event:r,render:a}}}function za(){let e=[],t=new Set,r=[Ca,Ea,$a,ka,Ta,Aa,Ba,Ra];for(let a of r){let o=a();o&&o.available&&(e.push(o),o.eventSources.forEach(n=>t.add(n)))}return{sources:e,availableEventSources:t}}function Ma(e){return{"storage-async":{label:"Storage",color:"#8B5CF6",icon:"server-outline"},"storage-mmkv":{label:"MMKV",color:"#F59E0B",icon:"flash-outline"},redux:{label:"Redux",color:"#3B82F6",icon:"git-branch-outline"},network:{label:"Network",color:"#10B981",icon:"globe-outline"},"react-query":{label:"Query",color:"#EC4899",icon:"sync-outline"},"react-query-query":{label:"Query",color:"#EC4899",icon:"sync-outline"},"react-query-mutation":{label:"Mutation",color:"#F97316",icon:"flash-outline"},route:{label:"Route",color:"#06B6D4",icon:"navigate-outline"},zustand:{label:"Zustand",color:"#764ABC",icon:"cube-outline"},jotai:{label:"Jotai",color:"#14B8A6",icon:"ellipse-outline"},render:{label:"Render",color:"#F472B6",icon:"layers-outline"}}[e]||{label:e,color:"#6B7280",icon:"help-outline"}}var bt=null,er=-1;function W(){return(!bt||er!==Zt())&&(er=Zt(),bt=za()),bt}function Pa(){let e=[],t=0;try{let{storageEventStore:r}=ee("@buoy-gg/storage"),a=r.getSubscriberCounts();e.push({sourceId:"storage",counts:a}),t+=a.total}catch{}try{let{networkEventStore:r}=ee("@buoy-gg/network"),a=r.getSubscriberCounts();e.push({sourceId:"network",counts:a}),t+=a.total}catch{}try{let{routeEventStore:r}=ee("@buoy-gg/route-events"),a=r.getSubscriberCounts();e.push({sourceId:"route-events",counts:a}),t+=a.total}catch{}try{let{RenderTracker:r,HighlightUpdatesController:a}=ee("@buoy-gg/highlight-updates"),o=r.getRenderEventCallbackCount(),n=a?.isEnabled?.()?1:0,i={eventCallbacks:o,arrayListeners:n,total:o+n};e.push({sourceId:"render",counts:i}),t+=i.total}catch{}return{sources:e,totalSubscribers:t}}import{ChangeLog as Na}from"@buoy-gg/shared-ui/web";var tr={"storage-async":"storage","storage-mmkv":"storage",redux:"redux",network:"network","react-query":"react-query","react-query-query":"react-query","react-query-mutation":"react-query",route:"route-events",zustand:"zustand",jotai:"jotai",render:"render"};var Va=200,rr=new Set(["render"]),Oa=class extends Na{constructor(){super({max:Va});this.activeSources=new Set;this.remoteAvailableSources=null;this.sourceUnsubscribers=new Map;this.remoteDiscoveryIds=new Set;this.localDiscoveryIds=new Set;this.localSyncChain=Promise.resolve();this.networkEventIdMap=new Map}getDiscoveredSources(){return W().sources}getAvailableEventSources(){return this.remoteAvailableSources?this.remoteAvailableSources:W().availableEventSources}setRemoteAvailableSources(e){let t=e?new Set(e):null,r=this.remoteAvailableSources,a=r===null&&t===null||!!r&&!!t&&r.size===t.size&&[...t].every(o=>r.has(o));this.remoteAvailableSources=t,a||this.notifyListeners()}replaceEvents(e){this.activeSources=new Set(e.map(t=>t.source)),this.setItems(e)}async subscribeToAll(){let{sources:e}=W();for(let t of e)rr.has(t.id)||await this.subscribeToSource(t)}async subscribeToSource(e){let t=this.sourceUnsubscribers.get(e.id);if(t){t.refCount++;return}let r={unsubscribe:()=>{},refCount:1};this.sourceUnsubscribers.set(e.id,r);try{e.setup&&await e.setup();let a=await e.subscribe(o=>{this.addEvent(o)});a&&(r.unsubscribe=a)}catch{this.sourceUnsubscribers.get(e.id)===r&&r.refCount<=1&&this.sourceUnsubscribers.delete(e.id)}}unsubscribeFromSource(e){let t=this.sourceUnsubscribers.get(e);t&&(t.refCount--,t.refCount<=0&&(t.unsubscribe(),this.sourceUnsubscribers.delete(e)))}async subscribeToStorage(){let{sources:e}=W(),t=e.find(r=>r.id==="storage");t&&await this.subscribeToSource(t)}unsubscribeFromStorage(){this.unsubscribeFromSource("storage"),this.activeSources.delete("storage-async"),this.activeSources.delete("storage-mmkv")}subscribeToRedux(){let{sources:e}=W(),t=e.find(r=>r.id==="redux");t&&this.subscribeToSource(t)}unsubscribeFromRedux(){this.unsubscribeFromSource("redux"),this.activeSources.delete("redux")}subscribeToNetwork(){let{sources:e}=W(),t=e.find(r=>r.id==="network");t&&this.subscribeToSource(t)}unsubscribeFromNetwork(){this.unsubscribeFromSource("network"),this.activeSources.delete("network")}subscribeToReactQuery(){let{sources:e}=W(),t=e.find(r=>r.id==="react-query");t&&this.subscribeToSource(t)}unsubscribeFromReactQuery(){this.unsubscribeFromSource("react-query"),this.activeSources.delete("react-query"),this.activeSources.delete("react-query-query"),this.activeSources.delete("react-query-mutation")}subscribeToRoutes(){let{sources:e}=W(),t=e.find(r=>r.id==="route-events");t&&this.subscribeToSource(t)}unsubscribeFromRoutes(){this.unsubscribeFromSource("route-events"),this.activeSources.delete("route")}subscribeToZustand(){let{sources:e}=W(),t=e.find(r=>r.id==="zustand");t&&this.subscribeToSource(t)}unsubscribeFromZustand(){this.unsubscribeFromSource("zustand"),this.activeSources.delete("zustand")}subscribeToJotai(){let{sources:e}=W(),t=e.find(r=>r.id==="jotai");t&&this.subscribeToSource(t)}unsubscribeFromJotai(){this.unsubscribeFromSource("jotai"),this.activeSources.delete("jotai")}subscribeToRender(){let{sources:e}=W(),t=e.find(r=>r.id==="render");t&&this.subscribeToSource(t)}unsubscribeFromRender(){this.unsubscribeFromSource("render"),this.activeSources.delete("render")}addEvent(e){if(e.source==="network"){let t=e.originalEvent;if(t?.id){let r=this.networkEventIdMap.get(t.id);if(r){let a=this.items.findIndex(o=>o.id===r);if(a>=0){e.id=r,this.items=[...this.items.slice(0,a),e,...this.items.slice(a+1)],this.notifyListeners();return}}this.networkEventIdMap.set(t.id,e.id)}}this.push(e),this.activeSources.add(e.source),this.notifyListeners()}getEvents(e){return!e||e.size===0?this.items:this.items.filter(t=>e.has(t.source))}getActiveSources(){return Array.from(this.activeSources)}getSourceCounts(){let e={"storage-async":0,"storage-mmkv":0,redux:0,network:0,"react-query":0,"react-query-query":0,"react-query-mutation":0,route:0,zustand:0,jotai:0,render:0};for(let t of this.items)e[t.source]++;return e}clearEvents(){this.activeSources.clear(),this.networkEventIdMap.clear(),this.clear()}subscribe(e){let t=super.subscribe(e);return e(this.items),t}getEventCount(){return this.items.length}unsubscribeAll(){for(let[,e]of this.sourceUnsubscribers)e.unsubscribe();this.sourceUnsubscribers.clear(),this.activeSources.clear(),this.remoteDiscoveryIds.clear(),this.localDiscoveryIds.clear()}setLocalEnabledSources(e){let t=async()=>{let r=new Set;for(let n of e){let i=tr[n];i&&r.add(i)}let a=this.localDiscoveryIds;this.localDiscoveryIds=r;let{sources:o}=W();for(let n of r)if(!a.has(n)){let i=o.find(l=>l.id===n);i&&await this.subscribeToSource(i)}for(let n of a)r.has(n)||this.unsubscribeFromSource(n)};return this.localSyncChain=this.localSyncChain.then(t,t),this.localSyncChain}async setRemoteEnabledSources(e){let{sources:t}=W(),r;if(e==="all")r=new Set(t.map(o=>o.id).filter(o=>!rr.has(o)));else{r=new Set;for(let o of e){let n=tr[o];n&&r.add(n)}}let a=this.remoteDiscoveryIds;this.remoteDiscoveryIds=r;for(let o of r)if(!a.has(o)){let n=t.find(i=>i.id===o);n&&await this.subscribeToSource(n)}for(let o of a)r.has(o)||this.unsubscribeFromSource(o)}ensureRemoteSourcesDefault(){this.remoteDiscoveryIds.size===0&&this.setRemoteEnabledSources("all")}clearRemoteSources(){for(let e of this.remoteDiscoveryIds)this.unsubscribeFromSource(e);this.remoteDiscoveryIds.clear()}isSourceSubscribed(e){switch(e){case"storage-async":case"storage-mmkv":return this.sourceUnsubscribers.has("storage");case"redux":return this.sourceUnsubscribers.has("redux");case"network":return this.sourceUnsubscribers.has("network");case"react-query":case"react-query-query":case"react-query-mutation":return this.sourceUnsubscribers.has("react-query");case"route":return this.sourceUnsubscribers.has("route-events");case"zustand":return this.sourceUnsubscribers.has("zustand");case"jotai":return this.sourceUnsubscribers.has("jotai");case"render":return this.sourceUnsubscribers.has("render");default:return false}}getSubscriptionStatus(){return{"storage-async":this.sourceUnsubscribers.has("storage"),"storage-mmkv":this.sourceUnsubscribers.has("storage"),redux:this.sourceUnsubscribers.has("redux"),network:this.sourceUnsubscribers.has("network"),"react-query":this.sourceUnsubscribers.has("react-query"),"react-query-query":this.sourceUnsubscribers.has("react-query"),"react-query-mutation":this.sourceUnsubscribers.has("react-query"),route:this.sourceUnsubscribers.has("route-events"),zustand:this.sourceUnsubscribers.has("zustand"),jotai:this.sourceUnsubscribers.has("jotai"),render:this.sourceUnsubscribers.has("render")}}getSubscriberCounts(){return Pa()}},L=new Oa;var Ua=e=>L.getEvents(e);var La=()=>L.clearEvents(),Ha=e=>L.subscribe(e);var or=e=>L.setLocalEnabledSources(e);var ar=()=>L.getAvailableEventSources();var nr=()=>L.getSubscriberCounts();import{persistentStorage as Se,devToolsStorageKeys as qe}from"@buoy-gg/shared-ui/web";async function Ja(e){try{let t=qe.events.enabledSources();await Se.setItem(t,JSON.stringify(e))}catch{}}async function Wa(){try{let e=qe.events.enabledSources(),t=await Se.getItem(e);return t&&t!==""?JSON.parse(t):null}catch{return null}}async function Ka(e){try{let t=qe.events.isCapturing();await Se.setItem(t,JSON.stringify(e))}catch{}}async function _a(){try{let e=qe.events.isCapturing(),t=await Se.getItem(e);return t!==null&&t!==""?JSON.parse(t):null}catch{return null}}async function ir(e){try{let t=qe.events.pausedAt();e===null?await Se.removeItem(t):await Se.setItem(t,JSON.stringify(e))}catch{}}async function Qa(){try{let e=qe.events.pausedAt(),t=await Se.getItem(e);if(t!==null&&t!==""){let r=JSON.parse(t);return typeof r=="number"?r:null}return null}catch{return null}}import{isDevToolsStorageKey as sr,isUrlIgnored as Ga}from"@buoy-gg/shared-ui/web";var Za=["api.keygen.sh","buoy.gg/api/license"];function vt(e){let t=e.originalEvent;if(!t)return false;if(e.source==="storage-async"||e.source==="storage-mmkv"){let r=t.data?.key||t.key;if(r&&sr(r))return true;let a=t.data?.keys||t.data?.pairs?.map(o=>o[0]);if(a&&a.length>0&&a.every(o=>sr(o)))return true}if(e.source==="network"){let r=t.host||"",a=t.url||"";for(let o of Za)if(r.includes(o)||a.includes(o))return true}return false}function St(e,t){if(e.source!=="network"||t.length===0)return false;let r=e.originalEvent?.url??"";return Ga(r,t)}function Ya(e,t){return vt(e)||St(e,t)}function Xa(e,t){if(e.title.toLowerCase().includes(t)||e.subtitle.toLowerCase().includes(t))return true;let r=e.originalEvent?.url;return typeof r=="string"&&r.toLowerCase().includes(t)}var lr=["storage-async","redux","network","react-query-query","react-query-mutation","route","zustand","jotai","render"],ur=lr.filter(e=>e!=="render"),Ct={"storage-async":["storage-async","storage-mmkv"],"storage-mmkv":["storage-mmkv"],redux:["redux"],network:["network"],"react-query":["react-query","react-query-query"],"react-query-query":["react-query","react-query-query"],"react-query-mutation":["react-query-mutation"],route:["route"],zustand:["zustand"],jotai:["jotai"],render:["render"]};function wt(e){let{isPro:t}=fa(),r=va("events.entries"),{patterns:a}=ba(),[o,n]=fe([]),[i,l]=fe(()=>new Set(ur)),[s,u]=fe(true),[c,d]=fe(""),h=yt(false),b=e?.capturingOverride??s,v=yt(null),p=yt([]),[y,m]=fe(0);ye(()=>{b?v.current!==null&&(p.current=[...p.current,[v.current,Date.now()]],v.current=null,m(w=>w+1),ir(null)):v.current===null&&(v.current=Date.now(),m(w=>w+1),ir(v.current))},[b]);let g=be(w=>{let F=v.current;if(F!==null&&w>F)return true;for(let[z,Q]of p.current)if(w>z&&w<=Q)return true;return false},[]),[$,U]=fe(()=>ar()),[C,I]=fe(0);ye(()=>ya(()=>{I(w=>w+1)}),[]);let x=ve(()=>lr.filter(w=>(Ct[w]||[w]).some(F=>$.has(F))),[$]);ye(()=>{let w=null,F=Ha(()=>{w==null&&(w=requestAnimationFrame(()=>{w=null,z()}))}),z=()=>{let Q=Ua();n(Q),U(q=>{let R=ar();return q.size===R.size&&[...R].every(ne=>q.has(ne))?q:new Set(R)})};return()=>{F(),w!=null&&cancelAnimationFrame(w)}},[]),ye(()=>{(async()=>{let w=await Wa(),F,z=x.filter(R=>ur.includes(R));if(w&&w.length>0){let R=w.filter(ne=>x.includes(ne));R.length>0?F=new Set(R):F=new Set(z)}else F=new Set(z);l(F);let Q=await _a(),q=Q!==null?Q:true;if(!q&&v.current===null){let R=await Qa();v.current=R??Date.now(),m(ne=>ne+1)}u(q),h.current=true,or(q?Array.from(F):[])})()},[x]),ye(()=>{h.current&&or(s?Array.from(i):[])},[i,s]),ye(()=>{h.current&&Ja(Array.from(i))},[i]),ye(()=>{h.current&&Ka(s)},[s]);let j=ve(()=>{let w=new Set;return i.forEach(F=>{let z=Ct[F];z&&z.forEach(Q=>w.add(Q))}),w},[i]),N=c.trim().toLowerCase(),pe=ve(()=>o.filter(w=>!g(w.timestamp)&&!vt(w)&&!St(w,a)),[o,a,g,y]),K=ve(()=>j.size===0?[]:pe.filter(w=>j.has(w.source)&&(N===""||Xa(w,N))),[pe,j,N]),he=ve(()=>K.slice(0,r),[K,r]),_=ve(()=>Math.max(0,K.length-r),[K,r]),Xe=ve(()=>{let w=pe.reduce((q,R)=>(q[R.source]=(q[R.source]??0)+1,q),{}),F=nr(),z={};for(let q of F.sources)z[q.sourceId]=q.counts.total;let Q={"storage-async":"storage","storage-mmkv":"storage",redux:"redux",network:"network","react-query":"react-query","react-query-query":"react-query","react-query-mutation":"react-query",route:"route-events",zustand:"zustand",jotai:"jotai",render:"render"};return x.map(q=>{let R=(Ct[q]||[q]).reduce((G,ft)=>G+(w[ft]||0),0),ne=Ma(q),Ie=Q[q],rt=Ie&&Ie in z?z[Ie]:void 0;return{source:q,...ne,count:R,enabled:i.has(q),subscriberCount:rt}}).sort((q,R)=>q.enabled&&!R.enabled?-1:!q.enabled&&R.enabled?1:0)},[pe,i,x,C]),pt=be(w=>{l(F=>{let z=new Set(F);return z.has(w)?z.delete(w):z.add(w),z})},[]),et=be(()=>{l(new Set(x))},[x]),Te=be(()=>{La()},[]),Ve=be(()=>{u(true)},[]),ht=be(()=>{u(false)},[]),gt=be(()=>{u(w=>!w)},[]),tt=nr().totalSubscribers;return{events:o,filteredEvents:he,availableSources:Xe,enabledSources:i,searchText:c,setSearchText:d,toggleSource:pt,enableAllSources:et,clearEvents:Te,totalCount:pe.length,filteredCount:he.length,isCapturing:s,startCapturing:Ve,stopCapturing:ht,toggleCapturing:gt,discoveredSources:$,hiddenEventsCount:_,isPro:t,totalSubscriberCount:tt}}import{memo as en}from"react";import{night as O}from"@buoy-gg/shared-ui/web";var S="buoy-events";function tn(e){return String(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"unknown"}function cr(e){let t=e.originalEvent??{};switch(e.source){case"storage-async":case"storage-mmkv":{let r=t.data??{},a=r.key??(Array.isArray(r.keys)?r.keys.join("+"):void 0)??(Array.isArray(r.pairs)?r.pairs.map(o=>o[0]).join("+"):void 0);return`${e.title} ${a??""}`}case"network":{let r=String(t.url??""),a=r.split("?")[0]??r;return`${t.method??""} ${a}`}case"react-query":case"react-query-query":case"react-query-mutation":return`${e.title} ${t.type??""}`;default:return e.title}}function dr(e){return`${S}-row-${e.source}-${tn(cr(e))}`}function mr(e){return`${S}-filter-${e}`}import{jsx as Ce,jsxs as Et}from"react/jsx-runtime";var xt=en(function({availableSources:e,onToggleSource:t,totalCount:r,filteredCount:a}){return e.length===0?null:Et(f,{style:re.container,testID:`${S}-filter-bar`,children:[Ce(ue,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:re.badgesRow,testID:`${S}-filter-scroll`,children:e.map(o=>{let n=o.enabled!==false,i=o.subscriberCount,l=i!==void 0,s=o.count||0,u=mr(o.source);return Et(ge,{testID:u,accessibilityRole:"button",accessibilityLabel:`${o.label} filter, ${n?"on":"off"}, ${s} event${s===1?"":"s"}`,style:[re.badge,n?{backgroundColor:O.color.surface,borderColor:o.color+"50"}:re.badgeDisabled],onPress:()=>t(o.source),activeOpacity:.7,children:[l&&Ce(f,{style:[re.countBadge,{backgroundColor:n?i>0?o.color+"25":O.color.fillSecondary:O.color.fill}],children:Ce(k,{style:[re.countText,{color:n?i>0?o.color:O.color.textTertiary:O.color.textTertiary}],testID:`${u}-subscribers`,children:i})}),Ce(f,{style:[re.dot,{backgroundColor:n?o.color:O.color.fillTertiary}]}),Ce(k,{style:[re.badgeLabel,{color:n?O.color.text:O.color.textTertiary}],numberOfLines:1,testID:`${u}-label`,children:o.label}),Ce(f,{style:[re.countBadge,{backgroundColor:n?s>0?o.color+"20":O.color.fill:O.color.fill}],children:Ce(k,{style:[re.countText,{color:n?s>0?o.color:O.color.textTertiary:O.color.textTertiary}],testID:`${u}-count`,children:s})})]},o.source)})}),a<r&&Et(k,{style:re.filterInfo,testID:`${S}-showing`,children:["Showing ",a," of ",r]})]})}),re=le.create({container:{paddingVertical:8,backgroundColor:"transparent",borderBottomWidth:1,borderBottomColor:O.color.border},badgesRow:{flexDirection:"row",gap:8,paddingHorizontal:12},badge:{flexDirection:"row",alignItems:"center",paddingVertical:5,paddingHorizontal:6,borderRadius:20,borderWidth:1,gap:6,flexShrink:0},badgeDisabled:{backgroundColor:O.color.surface,borderColor:O.color.border,opacity:.5},dot:{width:7,height:7,borderRadius:4},badgeLabel:{fontSize:12,fontWeight:"500"},countBadge:{minWidth:18,height:18,borderRadius:9,alignItems:"center",justifyContent:"center",paddingHorizontal:5},countText:{fontSize:10,fontWeight:"600",fontVariant:["tabular-nums"]},filterInfo:{marginTop:6,fontSize:11,color:O.color.textTertiary,textAlign:"center"}});import{memo as rn,useCallback as $t,useMemo as on}from"react";import{night as at,Zap as an,ProBadge as nn,ToolEmptyState as sn,resolveListEmptyState as ln}from"@buoy-gg/shared-ui/web";import{loadToolModule as Be,getToolModuleVersion as pr}from"@buoy-gg/shared-ui/web/utils";import{memo as un}from"react";import{CompactRow as cn,formatRelativeTime as dn,Pill as mn}from"@buoy-gg/shared-ui/web";import{jsx as V,jsxs as pn}from"react/jsx-runtime";function hn(){let e={StorageEventCard:null,getValueType:null,ReduxActionItem:null,NetworkEventItemCompact:null,RouteEventItemCompact:null,ZustandStateChangeItem:null,JotaiAtomChangeItem:null};try{let t=Be("@buoy-gg/storage");e.StorageEventCard=t.StorageEventCard,e.getValueType=t.getValueType}catch{}try{let t=Be("@buoy-gg/redux");e.ReduxActionItem=t.ReduxActionItem}catch{}try{let t=Be("@buoy-gg/network");e.NetworkEventItemCompact=t.NetworkEventItemCompact}catch{}try{let t=Be("@buoy-gg/route-events");e.RouteEventItemCompact=t.RouteEventItemCompact}catch{}try{let t=Be("@buoy-gg/zustand");e.ZustandStateChangeItem=t.ZustandStateChangeItem}catch{}try{let t=Be("@buoy-gg/jotai");e.JotaiAtomChangeItem=t.JotaiAtomChangeItem}catch{}return e}var kt,hr=-1;function gn(){return(!kt||hr!==pr())&&(kt=hn(),hr=pr()),kt}var gr={"storage-async":{label:"Storage",color:"#8B5CF6"},"storage-mmkv":{label:"MMKV",color:"#F59E0B"},redux:{label:"Redux",color:"#3B82F6"},network:{label:"Network",color:"#10B981"},"react-query":{label:"Query",color:"#EC4899"},"react-query-query":{label:"Query",color:"#EC4899"},"react-query-mutation":{label:"Mutation",color:"#F97316"},route:{label:"Route",color:"#06B6D4"},zustand:{label:"Zustand",color:"#764ABC"},jotai:{label:"Jotai",color:"#14B8A6"},render:{label:"Render",color:"#F472B6"}};function fn(e){switch(e){case"success":return"#10B981";case"error":return"#EF4444";case"pending":return"#F59E0B";case"neutral":default:return"#6B7280"}}function yn(e){return e==="storage-async"||e==="storage-mmkv"}function bn({label:e,color:t,testID:r}){return V(mn,{label:e,color:t,variant:"soft",size:"sm",style:{marginLeft:6},testID:r})}var vn={"storage-async":"STORAGE","storage-mmkv":"MMKV",redux:"REDUX",network:"NET","react-query":"QUERY","react-query-query":"QUERY","react-query-mutation":"MUTATION",route:"ROUTE",zustand:"ZUSTAND",jotai:"JOTAI",render:"RENDER"};function Oe({source:e,testID:t,children:r}){let a=gr[e].color,o=vn[e];return pn(f,{style:Dt.badgeWrapper,testID:t,children:[r,V(f,{style:[Dt.sourceBadge,{backgroundColor:`${a}20`}],children:V(k,{style:[Dt.sourceBadgeText,{color:a}],testID:t?`${t}-badge`:void 0,children:o})})]})}var fr=un(function({event:e,onPress:t,isSelected:r=false,isExpanded:a=false,onNavigate:o,correlationCount:n=1,correlationLabel:i,correlationColor:l}){let{StorageEventCard:s,getValueType:u,ReduxActionItem:c,NetworkEventItemCompact:d,RouteEventItemCompact:h,ZustandStateChangeItem:b,JotaiAtomChangeItem:v}=gn(),p=gr[e.source],y=fn(e.status),m=dr(e);if(yn(e.source)&&s&&u){let $=e.originalEvent,U={key:$.data?.key||"unknown",lastAction:$.action,totalOperations:1,lastEventTimestamp:new Date(e.timestamp),storageTypes:new Set([$.storageType||"async"]),valueType:$.data?.value!==void 0?u($.data.value):void 0};return V(Oe,{source:e.source,testID:m,children:V(s,{data:U,onPress:t,isSelected:r})})}if(e.source==="redux"&&c){let $=e.originalEvent;return V(Oe,{source:e.source,testID:m,children:V(c,{action:$,onPress:()=>t()})})}if(e.source==="network"&&d){let $=e.originalEvent;return V(f,{testID:m,children:V(d,{event:$,onPress:()=>t()})})}if(e.source==="route"&&h){let $=e.originalEvent;return V(Oe,{source:e.source,testID:m,children:V(h,{event:$,visitNumber:0,isExpanded:a,onPress:()=>t(),onNavigate:o})})}if(e.source==="zustand"&&b)return V(Oe,{source:e.source,testID:m,children:V(b,{change:e.originalEvent,onPress:()=>t()})});if(e.source==="jotai"&&v)return V(Oe,{source:e.source,testID:m,children:V(v,{change:e.originalEvent,onPress:()=>t()})});let g=i&&l?V(bn,{label:i,color:l,testID:`${m}-correlation`}):null;return V(cn,{statusDotColor:p.color,statusLabel:p.label,primaryText:e.title,secondaryText:e.subtitle,badgeText:n>1&&!i?`${n}`:"",badgeColor:l||y,customBadge:g,bottomRightText:dn(new Date(e.timestamp)),showChevron:true,isSelected:r,onPress:t,testID:m})}),Dt=le.create({badgeWrapper:{position:"relative"},sourceBadge:{position:"absolute",top:4,right:12,paddingHorizontal:6,paddingVertical:2,borderRadius:4,zIndex:10},sourceBadgeText:{fontSize:8,fontWeight:"700",letterSpacing:.5}});function Sn(e,t){return e.correlationId?t.filter(r=>r.correlationId===e.correlationId&&r.id!==e.id).sort((r,a)=>r.timestamp-a.timestamp):[]}function Cn(e,t){return e.correlationId?t.some(r=>r.correlationId===e.correlationId&&r.id!==e.id):false}function wn(e,t){return e.correlationId?t.filter(r=>r.correlationId===e.correlationId).length:1}function yr(e){let t=new Map;for(let r of e)if(r.correlationId){let a=t.get(r.correlationId)||0;t.set(r.correlationId,a+1)}return t}function br(e,t){return t.filter(r=>r.correlationId===e).sort((r,a)=>{let o=r.sequenceInGroup??0,n=a.sequenceInGroup??0;return o!==n?o-n:r.timestamp-a.timestamp})}function vr(e,t){if(!e.correlationId)return null;let r=br(e.correlationId,t);if(r.length<=1)return null;let a=r.findIndex(o=>o.id===e.id);return a===-1?null:`${a+1}/${r.length}`}var Sr=["#EC4899","#8B5CF6","#3B82F6","#10B981","#F59E0B","#EF4444","#06B6D4","#84CC16"];function Cr(e){let t=0;for(let a=0;a<e.length;a++)t=(t<<5)-t+e.charCodeAt(a),t|=0;let r=Math.abs(t)%Sr.length;return Sr[r]}import{jsx as Fe,jsxs as Tt}from"react/jsx-runtime";var It=rn(function({events:e,selectedEventId:t,expandedEventId:r,onEventPress:a,onNavigate:o,isCapturing:n,hiddenEventsCount:i=0,onUpgradePress:l,searchText:s="",totalCount:u=0,sourceCount:c,enabledSourceCount:d}){let h=on(()=>yr(e),[e]),b=$t(({item:y})=>{let m=y.correlationId&&h.get(y.correlationId)||1,g=vr(y,e),$=y.correlationId?Cr(y.correlationId):void 0;return Fe(fr,{event:y,isSelected:y.id===t,isExpanded:y.id===r,onPress:()=>a(y),onNavigate:o,correlationCount:m,correlationLabel:g,correlationColor:$})},[t,r,a,o,h,e]),v=$t(y=>y.id,[]),p=$t(()=>i<=0?null:Tt(ge,{style:we.hiddenBanner,onPress:l,activeOpacity:.8,testID:`${S}-hidden-banner`,accessibilityRole:"button",accessibilityLabel:`${i} hidden event${i!==1?"s":""}, upgrade for the full history`,children:[Tt(f,{style:we.hiddenBannerLeft,children:[Fe(an,{size:16,color:at.color.accent}),Tt(k,{style:we.hiddenBannerText,testID:`${S}-hidden-count`,children:[i," hidden event",i!==1?"s":""]})]}),Fe(nn,{})]}),[i,l]);if(e.length===0){let y=c===0,m=d===0,g=y?{otto:"scanning",title:"No Event Sources",message:`This tool reports on the other Buoy tools.
|
|
2
|
-
Install one \u2014 network, storage, redux, routes \u2014 and its events land here.`}:
|
|
3
|
-
Try interacting with your app.`},paused:{title:"Not Capturing",message:"Event capture is paused. Resume to see events."}});return Fe(sn,{...g,testID:`${S}-empty`,style:we.emptyContainer})}return Fe(Qt,{data:e,renderItem:b,keyExtractor:v,testID:`${S}-list`,style:we.list,contentContainerStyle:we.listContent,ItemSeparatorComponent:()=>Fe(f,{style:we.separator}),ListFooterComponent:p,showsVerticalScrollIndicator:true,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,removeClippedSubviews:!(typeof process<"u"&&process.env?.EXPO_PUBLIC_E2E)})}),we=le.create({list:{flex:1,backgroundColor:"transparent"},listContent:{paddingVertical:16},separator:{height:8},emptyContainer:{flex:1,justifyContent:"center",backgroundColor:"transparent"},hiddenBanner:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginHorizontal:16,marginTop:8,marginBottom:16,paddingVertical:12,paddingHorizontal:16,backgroundColor:at.color.surface,borderRadius:8,borderWidth:1,borderColor:at.color.border},hiddenBannerLeft:{flexDirection:"row",alignItems:"center",gap:8},hiddenBannerText:{fontSize:13,fontWeight:"500",color:at.color.text}});import{loadToolModule as Ee,getToolModuleVersion as At}from"@buoy-gg/shared-ui/web/utils";import{memo as En,useMemo as wr}from"react";import{night as ce,formatRelativeTime as xn,copyToClipboard as $n,parseValue as kn,useIgnoredPatterns as Dn,monoFont as Tn}from"@buoy-gg/shared-ui/web";import{DataViewer as In}from"@buoy-gg/shared-ui/web/dataViewer";import{memo as An,useMemo as qn}from"react";import{buoyColors as oe,night as M,displayValue as Bn,monoFont as Re}from"@buoy-gg/shared-ui/web";import{DataViewer as nt}from"@buoy-gg/shared-ui/web/dataViewer";import{jsx as T,jsxs as H}from"react/jsx-runtime";var Fn={"query-fetch-start":{label:"Query Fetching",color:M.color.accent,icon:"hourglass"},"query-fetch-success":{label:"Query Success",color:oe.success,icon:"checkmark"},"query-fetch-error":{label:"Query Error",color:oe.error,icon:"close"},"query-invalidated":{label:"Query Invalidated",color:oe.warning,icon:"refresh"},"mutation-start":{label:"Mutation Started",color:M.color.accent,icon:"hourglass"},"mutation-success":{label:"Mutation Success",color:oe.success,icon:"checkmark"},"mutation-error":{label:"Mutation Error",color:oe.error,icon:"close"}},Er=An(function({event:e}){let t=e.originalEvent,r=Fn[t.type]||{label:t.type,color:M.color.textTertiary,icon:"help"},a=t.type.startsWith("query-"),o=t.type.startsWith("mutation-"),n=qn(()=>{let c=a?t.queryKey:t.mutationKey;return c?Bn(c,true):o&&t.mutationId!==void 0?`Mutation #${t.mutationId}`:"No key"},[t,a,o]),i=new Date(t.timestamp).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:true}),l=a?!!t.queryData:!!t.mutationData,s=a?!!t.queryError:!!t.mutationError,u=o&&!!t.mutationVariables;return H(ue,{style:E.container,contentContainerStyle:E.contentContainer,children:[T(f,{style:E.section,children:H(f,{style:[E.eventTypeContainer,{borderColor:r.color+"4D"}],children:[T(k,{style:[E.eventTypeHeader,{backgroundColor:r.color+"15",color:r.color}],children:r.label}),H(f,{style:E.eventTypeContent,children:[H(f,{style:E.keyRow,children:[T(ue,{horizontal:true,style:E.keyScrollView,children:T(k,{style:E.keyText,children:n})}),T(Rn,{type:t.type,color:r.color})]}),t.duration!==void 0&&H(f,{style:E.row,children:[T(k,{style:E.labelText,children:"Duration:"}),H(k,{style:E.valueText,children:[t.duration.toFixed(0),"ms"]})]}),H(f,{style:E.row,children:[T(k,{style:E.labelText,children:"Timestamp:"}),T(k,{style:E.valueText,children:i})]}),a&&t.queryHash&&H(f,{style:E.row,children:[T(k,{style:E.labelText,children:"Query Hash:"}),T(k,{style:[E.valueText,E.hashText],numberOfLines:1,children:t.queryHash})]}),o&&t.mutationId!==void 0&&H(f,{style:E.row,children:[T(k,{style:E.labelText,children:"Mutation ID:"}),H(k,{style:E.valueText,children:["#",t.mutationId]})]})]})]})}),u&&T(f,{style:E.section,children:H(f,{style:E.dataContainer,children:[T(k,{style:[E.dataHeader,{color:oe.warning}],children:"Variables"}),T(f,{style:E.dataContent,children:T(nt,{title:"",data:t.mutationVariables,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})}),l&&T(f,{style:E.section,children:H(f,{style:E.dataContainer,children:[T(k,{style:[E.dataHeader,{color:oe.success}],children:a?"Query Data":"Mutation Result"}),T(f,{style:E.dataContent,children:T(nt,{title:"",data:a?t.queryData:t.mutationData,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})}),s&&T(f,{style:E.section,children:H(f,{style:[E.dataContainer,E.errorContainer],children:[T(k,{style:[E.dataHeader,E.errorHeader],children:"Error"}),T(f,{style:E.dataContent,children:T(nt,{title:"",data:a?t.queryError:t.mutationError,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})}),T(f,{style:E.section,children:H(f,{style:E.dataContainer,children:[T(k,{style:E.dataHeader,children:"Event Details"}),T(f,{style:E.dataContent,children:T(nt,{title:"",data:t,showTypeFilter:true,rawMode:true,initialExpanded:false})})]})})]})});function Rn({type:e,color:t}){let r=()=>e.includes("start")?"PENDING":e.includes("success")?"SUCCESS":e.includes("error")?"ERROR":e.includes("invalidated")?"INVALIDATED":e.toUpperCase();return T(f,{style:[E.statusChip,{backgroundColor:t+"15",borderColor:t+"33"}],children:T(k,{style:[E.statusChipText,{color:t}],children:r()})})}var E=le.create({container:{flex:1,backgroundColor:"transparent"},contentContainer:{padding:8,paddingBottom:24},section:{marginBottom:12},eventTypeContainer:{minWidth:200,backgroundColor:M.color.surface,borderRadius:6,borderWidth:1,overflow:"hidden",shadowColor:M.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},eventTypeHeader:{paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,borderBottomWidth:1,borderBottomColor:M.color.accentBorder,letterSpacing:.5,textTransform:"uppercase",fontFamily:Re},eventTypeContent:{padding:0},keyRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:M.color.separator},keyScrollView:{flex:1,marginRight:8},keyText:{fontSize:12,color:M.color.text,fontFamily:Re,lineHeight:18,backgroundColor:M.color.accentSoft,paddingHorizontal:8,paddingVertical:4,borderRadius:4,borderWidth:1,borderColor:M.color.accentBorderStrong},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:M.color.separator},labelText:{fontSize:10,color:M.color.textSecondary,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase",fontFamily:Re},valueText:{fontSize:12,color:M.color.text,fontWeight:"500",fontVariant:["tabular-nums"],fontFamily:Re},hashText:{flex:1,textAlign:"right",marginLeft:8},statusChip:{paddingHorizontal:8,paddingVertical:4,borderWidth:1,borderRadius:6,alignSelf:"flex-start"},statusChipText:{fontSize:11,fontWeight:"600",textTransform:"uppercase",letterSpacing:.5,fontFamily:Re},dataContainer:{minWidth:200,backgroundColor:M.color.surface,borderRadius:6,borderWidth:1,borderColor:M.color.accentBorderStrong,overflow:"hidden",shadowColor:M.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},dataHeader:{backgroundColor:M.color.accentSoft,paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:M.color.accent,borderBottomWidth:1,borderBottomColor:M.color.accentBorder,letterSpacing:.5,textTransform:"uppercase",fontFamily:Re},dataContent:{padding:8},errorContainer:{borderColor:oe.error+"4D"},errorHeader:{backgroundColor:oe.error+"1A",color:oe.error,borderBottomColor:oe.error+"33"}});import{Fragment as jn,jsx as D,jsxs as Ue}from"react/jsx-runtime";function zn(){let e={StorageEventDetailContent:null,ReduxActionDetailContent:null,NetworkEventDetailView:null,RenderDetailView:null,ZustandStateDetailContent:null,JotaiAtomDetailContent:null,RouteEventDetail:null};try{let t=Ee("@buoy-gg/storage");e.StorageEventDetailContent=t.StorageEventDetailContent}catch{}try{let t=Ee("@buoy-gg/redux");e.ReduxActionDetailContent=t.ReduxActionDetailContent}catch{}try{let t=Ee("@buoy-gg/network");e.NetworkEventDetailView=t.NetworkEventDetailView}catch{}try{let t=Ee("@buoy-gg/highlight-updates");e.RenderDetailView=t.RenderDetailView}catch{}try{let t=Ee("@buoy-gg/zustand");e.ZustandStateDetailContent=t.ZustandStateDetailContent}catch{}try{let t=Ee("@buoy-gg/jotai");e.JotaiAtomDetailContent=t.JotaiAtomDetailContent}catch{}try{let t=Ee("@buoy-gg/route-events");e.RouteEventDetail=t.RouteEventDetail}catch{}return e}var qt,xr=-1;function Mn(){return(!qt||xr!==At())&&(qt=zn(),xr=At()),qt}var Pn={"storage-async":{label:"AsyncStorage",color:"#8B5CF6"},"storage-mmkv":{label:"MMKV",color:"#F59E0B"},redux:{label:"Redux",color:"#3B82F6"},network:{label:"Network",color:"#10B981"},"react-query":{label:"React Query",color:"#EC4899"},"react-query-query":{label:"Query",color:"#EC4899"},"react-query-mutation":{label:"Mutation",color:"#F97316"},route:{label:"Route",color:"#06B6D4"},zustand:{label:"Zustand",color:"#764ABC"},jotai:{label:"Jotai",color:"#14B8A6"},render:{label:"Render",color:"#F472B6"}};function Nn(e){return e==="storage-async"||e==="storage-mmkv"}function Vn(e){let t=kn(e);return t===null?"null":t===void 0?"undefined":Array.isArray(t)?"array":typeof t=="boolean"?"boolean":typeof t=="number"?"number":typeof t=="string"?"string":typeof t=="object"?"object":"undefined"}function On({children:e}){return D(jn,{children:e})}var Bt=En(function({event:e,onBack:t,NetworkEventDetailViewComponent:r,networkDetailWrapper:a,RouteEventDetailComponent:o,detailComponents:n,onNavigate:i}){let l=wr(()=>({...Mn(),...n}),[n,At()]),s=Pn[e.source],u=new Date(e.timestamp),{values:c,toggle:d}=Dn(),h=wr(()=>{if(!Nn(e.source)||!l.StorageEventDetailContent)return null;let m=e.originalEvent,g={...m,timestamp:new Date(m.timestamp)};return{key:g.data?.key||"unknown",lastEvent:g,events:[g],totalOperations:1,currentValue:g.data?.value,valueType:Vn(g.data?.value),storageTypes:new Set([g.storageType||"async"])}},[e,l]);if(h&&l.StorageEventDetailContent){let{StorageEventDetailContent:m}=l;return D(f,{style:B.container,testID:`${S}-detail-storage`,children:D(m,{conversation:h,selectedEventIndex:0,onEventIndexChange:()=>{},disableInternalFooter:true})})}if(e.source==="redux"&&l.ReduxActionDetailContent){let{ReduxActionDetailContent:m}=l,g=e.originalEvent;return D(f,{style:B.container,testID:`${S}-detail-redux`,children:D(m,{action:g,actions:[g],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:true})})}let b=r??l.NetworkEventDetailView;if(e.source==="network"&&b){let m=e.originalEvent,g=a??On;return D(f,{style:B.container,children:D(g,{children:D(ue,{style:B.content,testID:`${S}-detail-network`,children:D(b,{event:m,ignoredPatterns:c,onTogglePattern:d})})})})}if(e.source==="react-query"||e.source==="react-query-query"||e.source==="react-query-mutation")return D(f,{style:B.container,testID:`${S}-detail-react-query`,children:D(Er,{event:e})});if(e.source==="zustand"&&l.ZustandStateDetailContent){let{ZustandStateDetailContent:m}=l,g=e.originalEvent;return D(f,{style:B.container,testID:`${S}-detail-zustand`,children:D(m,{change:g,changes:[g],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:true})})}if(e.source==="jotai"&&l.JotaiAtomDetailContent){let{JotaiAtomDetailContent:m}=l,g=e.originalEvent;return D(f,{style:B.container,testID:`${S}-detail-jotai`,children:D(m,{change:g,changes:[g],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:true})})}if(e.source==="render"&&l.RenderDetailView){let{RenderDetailView:m}=l,g=e.originalEvent;return D(f,{style:B.container,children:D(ue,{style:B.content,testID:`${S}-detail-render`,children:D(m,{render:g.render})})})}let v=o??l.RouteEventDetail;if(e.source==="route"&&v)return D(f,{style:B.container,children:D(f,{style:B.container,testID:`${S}-detail-route`,children:D(v,{event:e.originalEvent,onNavigate:i})})});let p=()=>e.originalEvent,y=async()=>{await $n({source:e.source,timestamp:u.toISOString(),title:e.title,subtitle:e.subtitle,data:p()})};return D(f,{style:B.container,testID:`${S}-detail`,children:Ue(ue,{style:B.content,contentContainerStyle:B.contentContainer,testID:`${S}-detail-scroll`,children:[D(f,{style:B.sourceBadgeRow,children:Ue(f,{style:[B.sourceBadge,{backgroundColor:s.color+"20"}],children:[D(f,{style:[B.sourceDot,{backgroundColor:s.color}]}),D(k,{style:[B.sourceLabel,{color:s.color}],testID:`${S}-detail-source`,children:s.label})]})}),D(k,{style:B.title,testID:`${S}-detail-title`,children:e.title}),D(k,{style:B.subtitle,testID:`${S}-detail-subtitle`,children:e.subtitle}),Ue(f,{style:B.timestampRow,children:[D(k,{style:B.timestampLabel,children:"Timestamp"}),Ue(k,{style:B.timestampValue,testID:`${S}-detail-timestamp`,children:[u.toLocaleTimeString()," (",xn(u),")"]})]}),Ue(f,{style:B.dataSection,children:[D(k,{style:B.sectionLabel,children:"Event Data"}),D(f,{style:B.dataContainer,testID:`${S}-detail-data`,children:D(In,{testIDPrefix:`${S}-detail-data`,data:p(),title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})})]})]})})}),B=le.create({container:{flex:1,backgroundColor:"transparent"},content:{flex:1},contentContainer:{padding:16},sourceBadgeRow:{flexDirection:"row",marginBottom:12},sourceBadge:{flexDirection:"row",alignItems:"center",paddingHorizontal:10,paddingVertical:6,borderRadius:12,gap:6},sourceDot:{width:6,height:6,borderRadius:3},sourceLabel:{fontSize:12,fontWeight:"600"},title:{fontSize:24,fontWeight:"700",color:ce.color.text,marginBottom:4},subtitle:{fontSize:16,color:ce.color.textTertiary,marginBottom:16},timestampRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,borderTopWidth:1,borderTopColor:ce.color.border,borderBottomWidth:1,borderBottomColor:ce.color.border,marginBottom:16},timestampLabel:{fontSize:14,color:ce.color.textTertiary},timestampValue:{fontSize:14,color:ce.color.text,fontFamily:Tn},dataSection:{marginTop:8},sectionLabel:{fontSize:12,fontWeight:"600",color:ce.color.textTertiary,textTransform:"uppercase",letterSpacing:.5,marginBottom:8},dataContainer:{backgroundColor:ce.color.surface,borderRadius:8,borderWidth:1,borderColor:ce.color.border,overflow:"hidden"}});import{useCallback as je,useEffect as Un,useMemo as it,useState as Ft}from"react";import{DynamicFilterView as $r,macOSColors as Le,night as He,FileText as kr,FileCode as Dr,Hash as Ln,Zap as Hn,AlertTriangle as Jn,Settings as Wn,Eye as Kn,XCircle as Tr,GitBranch as Ir,ToolbarCopyButton as _n,useFeatureGate as Qn,ProFeatureBanner as Gn,ExportPreview as Zn,monoFont as Yn}from"@buoy-gg/shared-ui/web";import{DataViewer as Xn}from"@buoy-gg/shared-ui/web/dataViewer";var Je={timestampFormat:"relative",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:true,includeTotalDuration:true,includeEventData:false,dataSizeThreshold:5,format:"markdown",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true},We={llm:{timestampFormat:"relative",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:true,includeTotalDuration:true,includeEventData:false,dataSizeThreshold:5,format:"markdown",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true},bugReport:{timestampFormat:"both",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:true,includeTotalDuration:true,includeEventData:true,dataSizeThreshold:10,format:"markdown",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true},json:{timestampFormat:"absolute",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:false,includeTotalDuration:false,includeEventData:true,dataSizeThreshold:-1,format:"json",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:false,showStorageDiff:false,stripVerboseFields:false},errors:{timestampFormat:"relative",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:true,includeTotalDuration:false,includeEventData:true,dataSizeThreshold:10,format:"markdown",filterMode:"errors",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true},minimal:{timestampFormat:"relative",includeSource:false,includeStatus:true,includeTitle:true,includeSubtitle:false,includeCorrelation:false,includeDuration:false,includeSummaryHeader:false,includeTotalDuration:false,includeEventData:false,dataSizeThreshold:1,format:"plaintext",filterMode:"all",filterSources:[],compactMode:true,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:false,stripVerboseFields:true},mermaid:{timestampFormat:"relative",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:false,includeCorrelation:true,includeDuration:true,includeSummaryHeader:false,includeTotalDuration:false,includeEventData:false,dataSizeThreshold:1,format:"mermaid",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true}};function Ar(e){for(let[t,r]of Object.entries(We))if(Object.keys(r).every(a=>{let o=e[a],n=r[a];return Array.isArray(o)&&Array.isArray(n)?o.length===n.length&&o.every((i,l)=>i===n[l]):o===n}))return t;return null}var P={llm:{label:"LLM",description:"AI-ready format",color:"#10B981"},bugReport:{label:"Bug Report",description:"Full context",color:"#EF4444"},json:{label:"JSON",description:"Machine-readable",color:"#F59E0B"},errors:{label:"Errors",description:"Failed only",color:"#EF4444"},minimal:{label:"Minimal",description:"Quick reference",color:"#6B7280"},mermaid:{label:"Diagram",description:"Visual flow",color:"#A855F7"}};var ze={success:"\u2705",pending:"\u23F3",error:"\u274C",neutral:"\u2796"},ei={success:"[OK]",pending:"[...]",error:"[ERR]",neutral:"[-]"},Rt={"storage-async":"Storage","storage-mmkv":"MMKV",redux:"Redux",network:"Network","react-query":"Query","react-query-query":"Query","react-query-mutation":"Mutation",route:"Route",zustand:"Zustand",jotai:"Jotai",render:"Render"};function xe(e){if(typeof e!="string")return e;let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.parse(e)}catch{return e}}function $e(e){if(e==null)return e;if(typeof e=="string")return xe(e);if(Array.isArray(e))return e.map($e);if(typeof e=="object"){let t={};for(let[r,a]of Object.entries(e))t[r]=$e(a);return t}return e}var ti=new Set(["image","imageUrl","imageURL","image_url","thumbnail","thumbnailUrl","thumbnail_url","icon","iconUrl","avatar","avatarUrl","photo","photoUrl","picture","pictureUrl","description","desc","longDescription","shortDescription","meta_description"]);function jt(e){if(e==null)return e;if(Array.isArray(e))return e.map(jt);if(typeof e=="object"){let t={};for(let[r,a]of Object.entries(e))ti.has(r)||typeof a=="string"&&ri(a)||(t[r]=jt(a));return t}return e}function ri(e){if(!e.startsWith("http"))return false;let t=e.toLowerCase();return t.includes("/photo")||t.includes("/image")||t.includes("unsplash.com")||t.includes("cloudinary.com")||t.includes("imgur.com")||/\.(jpg|jpeg|png|gif|webp|svg|bmp)(\?|$)/i.test(e)}function oi(e){if(e instanceof Date)return e.toISOString();if(!(e&&typeof e=="object"&&Object.keys(e).length===0))return e}function ai(e,t){let r=s=>{if(typeof s!="object"||s===null)return null;let u=s;return typeof u.id=="string"?u.id:typeof u.orderId=="string"?u.orderId:typeof u.key=="string"?u.key:null},a=new Set(e.map(r).filter(Boolean)),o=new Set(t.map(r).filter(Boolean));if(a.size===0&&o.size===0)return null;let n=t.filter(s=>{let u=r(s);return u&&!a.has(u)}),i=e.filter(s=>{let u=r(s);return u&&!o.has(u)}),l=t.length-n.length;return n.length+i.length<e.length&&n.length+i.length<t.length?{added:n,removed:i,unchanged:l}:null}function ni(e,t){let r={};if(e.action&&(r.action=e.action),e.storageType&&(r.storageType=e.storageType),e.timestamp!==void 0){let a=oi(e.timestamp);a!==void 0&&(r.timestamp=a)}if(e.data){let a={...e.data};if(t.smartJsonParsing&&(a.value!==void 0&&(a.value=xe(a.value)),a.prevValue!==void 0&&(a.prevValue=xe(a.prevValue))),t.showStorageDiff&&Array.isArray(a.value)&&Array.isArray(a.prevValue)){let o=ai(a.prevValue,a.value);if(o){let n={key:a.key};return o.added.length>0&&(n.added=o.added),o.removed.length>0&&(n.removed=o.removed),o.unchanged>0&&(n.unchangedCount=o.unchanged),r.data=n,r}}r.data=a}return r}function ii(e,t){if(!t.reduxChangedOnly)return t.smartJsonParsing?$e(e):e;let r={};if(e.type&&(r.type=e.type),e.payload&&(r.payload=t.smartJsonParsing?$e(e.payload):e.payload),e.sliceName&&(r.sliceName=e.sliceName),e.actionName&&(r.actionName=e.actionName),e.duration&&(r.duration=e.duration),e.hasStateChange!==void 0&&(r.hasStateChange=e.hasStateChange),e.diffSummary&&(r.diffSummary=e.diffSummary),e.changedKeysCount!==void 0&&(r.changedKeysCount=e.changedKeysCount),e.hasStateChange===true){let a=e.sliceName;if(a&&e.prevState&&e.nextState){let o=e.prevState,n=e.nextState;(o[a]!==void 0||n[a]!==void 0)&&(r.stateChange={slice:a,before:o[a],after:n[a]})}}return r}function qr(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.name=="string"?t.name:typeof t.id=="string"?t.id:typeof t.key=="string"?t.key:null}function Ke(e,t){let r=typeof e=="string"?xe(e):e,a=typeof t=="string"?xe(t):t;if(r==null&&a!==null&&a!==void 0)return"Created";if(r!=null&&a==null)return"Deleted";if(Array.isArray(r)&&Array.isArray(a)){let o=r.length,n=a.length,i=r.map(qr).filter(Boolean),l=a.map(qr).filter(Boolean);if(o===n&&o>0){let s=new Set(i),u=new Set(l),c=i.filter(d=>u.has(d));if(c.length===0&&i.length>0&&l.length>0)return`\u26A0\uFE0F Replaced: [${i.join(", ")}] \u2192 [${l.join(", ")}]`;if(c.length<o){let d=i.filter(b=>!u.has(b)),h=l.filter(b=>!s.has(b));return`Changed: -${d.join(", ")} +${h.join(", ")}`}}if(o===0&&n>0)return l.length>0?`Added: [${l.join(", ")}]`:`Added ${n} item${n>1?"s":""}`;if(o>0&&n===0)return i.length>0?`Removed all: [${i.join(", ")}]`:`Removed all ${o} item${o>1?"s":""}`;if(n>o){let s=new Set(i),u=l.filter(c=>!s.has(c));return u.length>0?`Added: [${u.join(", ")}] (${o} \u2192 ${n})`:`Added ${n-o} item${n-o>1?"s":""} (${o} \u2192 ${n})`}if(n<o){let s=new Set(l),u=i.filter(c=>!s.has(c));return u.length>0?`Removed: [${u.join(", ")}] (${o} \u2192 ${n})`:`Removed ${o-n} item${o-n>1?"s":""} (${o} \u2192 ${n})`}return`Updated (${n} item${n>1?"s":""})`}if(typeof r=="object"&&typeof a=="object"&&r&&a){let o=Object.keys(r),n=Object.keys(a),i=n.filter(s=>!o.includes(s)),l=o.filter(s=>!n.includes(s));return i.length>0&&l.length>0?`+${i.length} -${l.length} keys`:i.length>0?`Added: ${i.join(", ")}`:l.length>0?`Removed: ${l.join(", ")}`:"Updated"}return null}function si(e,t){let r={};if(e.id&&(r.id=e.id),e.type&&(r.type=e.type),e.timestamp&&(r.timestamp=e.timestamp),e.queryKey&&(r.queryKey=e.queryKey),e.mutationKey&&(r.mutationKey=e.mutationKey),e.mutationId&&(r.mutationId=e.mutationId),e.duration&&(r.duration=e.duration),e.queryData!==void 0&&(r.data=t.smartJsonParsing?$e(e.queryData):e.queryData),e.variables!==void 0&&(r.variables=t.smartJsonParsing?$e(e.variables):e.variables),e.queryError!==void 0){let a=e.queryError;a&&typeof a=="object"?r.error=a.message||a.name||a:r.error=e.queryError}if(e.mutationError!==void 0){let a=e.mutationError;a&&typeof a=="object"?r.error=a.message||a.name||a:r.error=e.mutationError}if(e.query&&typeof e.query=="object"){let a=e.query;if(a.state&&typeof a.state=="object"){let o=a.state;if(o.status&&(r.status=o.status),o.fetchStatus&&(r.fetchStatus=o.fetchStatus),o.error){let n=o.error;n&&typeof n=="object"&&(r.error=n.message||n.name||n)}}}if(e.mutation&&typeof e.mutation=="object"){let a=e.mutation;if(a.state&&typeof a.state=="object"){let o=a.state;if(o.status&&(r.status=o.status),o.failureCount&&(r.failureCount=o.failureCount),o.error){let n=o.error;n&&typeof n=="object"&&(r.error=n.message||n.name||n)}if(o.failureReason){let n=o.failureReason;n&&typeof n=="object"&&(r.failureReason=n.message||n.name||n)}}}return r}function st(e,t){let r=e.originalEvent;if(!r)return null;let a;return e.source==="storage-async"||e.source==="storage-mmkv"?a=ni(r,t):e.source==="redux"?a=ii(r,t):e.source==="react-query"||e.source==="react-query-query"||e.source==="react-query-mutation"?a=si(r,t):t.smartJsonParsing?a=$e(r):a=r,t.stripVerboseFields&&a&&(a=jt(a)),a}function _e(e){let t={totalEvents:e.length,success:0,pending:0,error:0,neutral:0,durationMs:0,sources:new Set};if(e.length===0)return t;let r=1/0,a=-1/0;for(let o of e)t[o.status]++,t.sources.add(o.source),o.timestamp<r&&(r=o.timestamp),o.timestamp>a&&(a=o.timestamp);return t.durationMs=a-r,t}function Qe(e,t){let r=[...e];if(t.filterMode!=="all"&&(r=r.filter(a=>{switch(t.filterMode){case"errors":return a.status==="error";case"success":return a.status==="success";case"pending":return a.status==="pending";default:return true}})),t.filterSources.length>0){let a=new Set(t.filterSources);r=r.filter(o=>a.has(o.source))}return r}function zt(e){return e<1e3?`+${e}ms`:e<6e4?`+${(e/1e3).toFixed(1)}s`:`+${(e/6e4).toFixed(1)}m`}function Br(e){return new Date(e).toISOString()}function lt(e,t,r){let a=zt(e-t),o=Br(e);switch(r){case"relative":return a;case"absolute":return o;case"both":return`${a} (${o})`}}function Mt(e,t){let r=0,a=[e],o=new Set;for(;a.length>0;){if(r>t)return{over:true,approxBytes:r};let n=a.pop();if(n==null)r+=4;else if(typeof n=="string")r+=n.length+2;else if(typeof n=="number")r+=8;else if(typeof n=="boolean")r+=5;else if(typeof n=="object"){if(o.has(n))continue;if(o.add(n),Array.isArray(n)){r+=2+n.length;for(let i=0;i<n.length;i++)a.push(n[i])}else{r+=2;for(let i in n)r+=i.length+4,a.push(n[i])}}else r+=4}return{over:r>t,approxBytes:r}}function ut(e,t){if(t===-1)return{data:e,truncated:false};let{over:r,approxBytes:a}=Mt(e,t*1024);if(r)return{data:`[Data truncated - \u2265${(a/1024).toFixed(1)}KB exceeds ${t}KB limit]`,truncated:true};try{return JSON.stringify(e),{data:e,truncated:false}}catch{return{data:"[Unable to serialize data]",truncated:true}}}function Fr(e,t){let r=0;for(let a of e)if(t.includeSource&&(r+=20),t.includeStatus&&(r+=10),t.includeTitle&&(r+=(a.title?.length||0)+10),t.includeSubtitle&&(r+=(a.subtitle?.length||0)+10),t.includeCorrelation&&(r+=20),t.includeDuration&&(r+=15),r+=30,t.includeEventData&&a.originalEvent){let o=t.dataSizeThreshold===-1?1048576:t.dataSizeThreshold*1024,{approxBytes:n}=Mt(a.originalEvent,o);r+=Math.min(n,o)}return t.includeSummaryHeader&&(r+=100),t.includeTotalDuration&&(r+=50),t.format==="markdown"&&(r*=1.2),t.format==="json"&&(r*=1.3),Math.round(r)}function li(e,t,r){let a=[],o=lt(e.timestamp,t,r.timestampFormat);if(a.push(`\`${o}\``),r.includeStatus&&a.push(ze[e.status]),r.includeSource&&a.push(`**${Rt[e.source]}**`),r.includeTitle&&a.push(e.title),r.showStorageDiff&&(e.source==="storage-async"||e.source==="storage-mmkv")){let n=e.originalEvent;if(n?.data){let i=n.data,l=Ke(i.prevValue,i.value);l&&a.push(`\u2192 ${l}`)}}return e.source==="redux"&&e.originalEvent?.hasStateChange===false&&a.push("(no state change)"),r.includeSubtitle&&e.subtitle&&a.push(`- ${e.subtitle}`),a.join(" ")}function ui(e,t){let r=[],a=e.originalEvent;if(!a?.data)return r;let o=a.data,n=t.smartJsonParsing?xe(o.prevValue):o.prevValue,i=t.smartJsonParsing?xe(o.value):o.value,l=Ke(o.prevValue,o.value);if(l&&r.push(` **Change:** ${l}`),Array.isArray(n)&&Array.isArray(i)){let s=n.map(c=>typeof c=="object"&&c&&"name"in c?c.name:null).filter(Boolean),u=i.map(c=>typeof c=="object"&&c&&"name"in c?c.name:null).filter(Boolean);(s.length>0||u.length>0)&&(s.length>0&&r.push(` Before: [${s.join(", ")}]`),r.push(` After: [${u.join(", ")}]`))}return r}function Pt(e,t){let r=Qe(e,t);if(r.length===0)return"No events to export.";let a=[...r].sort((s,u)=>s.timestamp-u.timestamp),o=a[0].timestamp,n=_e(a),i=[];if(i.push("## Event Flow"),t.includeSummaryHeader||t.includeTotalDuration){let s=[];if(t.includeTotalDuration&&s.push(`**Duration:** ${zt(n.durationMs).replace("+","")}`),s.push(`**Events:** ${n.totalEvents}`),t.includeSummaryHeader){let u=[];n.success>0&&u.push(`${n.success} ${ze.success}`),n.pending>0&&u.push(`${n.pending} ${ze.pending}`),n.error>0&&u.push(`${n.error} ${ze.error}`),n.neutral>0&&u.push(`${n.neutral} ${ze.neutral}`),u.length>0&&s.push(`**Status:** ${u.join(" ")}`)}i.push(s.join(" | "))}if(i.push(""),i.push("### Timeline"),i.push(""),t.compactMode)return a.forEach((s,u)=>{i.push(`${u+1}. ${li(s,o,t)}`)}),i.join(`
|
|
4
|
-
`);a.forEach((s,u)=>{let c=[],d=lt(s.timestamp,o,t.timestampFormat);if(c.push(`${u+1}. \`${d}\``),t.includeStatus&&c.push(ze[s.status]),t.includeSource&&c.push(`**${
|
|
1
|
+
"use client";var Kt=Object.defineProperty;var Qr=Object.getOwnPropertyDescriptor;var Gr=Object.getOwnPropertyNames;var Zr=Object.prototype.hasOwnProperty;var Yr=(e,t)=>{for(var r in t)Kt(e,r,{get:t[r],enumerable:true})},_t=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Gr(t))!Zr.call(e,o)&&o!==r&&Kt(e,o,{get:()=>t[o],enumerable:!(a=Qr(t,o))||a.enumerable});return e},Xr=(e,t,r)=>(_t(e,t,"default"),r&&_t(r,t,"default"));typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{EventsIcon as eo,EVENTS_ICON_COLOR as to}from"@buoy-gg/floating-tools-core/web";var Qt={};Yr(Qt,{AccessibilityInfo:()=>no,ActivityIndicator:()=>ea,Alert:()=>Zt,Animated:()=>io,AppRegistry:()=>lo,AppState:()=>uo,Appearance:()=>so,BackHandler:()=>co,Button:()=>ta,CheckBox:()=>Do,Clipboard:()=>po,DeviceEventEmitter:()=>Uo,Dimensions:()=>mo,Easing:()=>ho,FlatList:()=>Gt,I18nManager:()=>go,Image:()=>To,ImageBackground:()=>Io,InteractionManager:()=>yo,Keyboard:()=>fo,KeyboardAvoidingView:()=>Ao,LayoutAnimation:()=>bo,Linking:()=>vo,LogBox:()=>Oo,Modal:()=>Yo,NativeEventEmitter:()=>So,NativeModules:()=>ao,PanResponder:()=>Co,Picker:()=>qo,PixelRatio:()=>wo,Platform:()=>Eo,Pressable:()=>Zo,ProgressBar:()=>Bo,RefreshControl:()=>Fo,SafeAreaView:()=>Ro,ScrollView:()=>ue,SectionList:()=>jo,Share:()=>xo,StatusBar:()=>zo,StyleSheet:()=>le,Switch:()=>Xo,Text:()=>k,TextInput:()=>_o,Touchable:()=>Mo,TouchableHighlight:()=>Qo,TouchableNativeFeedback:()=>Po,TouchableOpacity:()=>ge,TouchableWithoutFeedback:()=>Go,UIManager:()=>$o,Vibration:()=>ko,View:()=>f,VirtualizedList:()=>No,YellowBox:()=>Vo,findNodeHandle:()=>ra,unstable_createElement:()=>oo,useColorScheme:()=>Lo,useLocaleContext:()=>Ho,useWindowDimensions:()=>Jo});Xr(Qt,ro);import*as ro from"react-native-web";import{unstable_createElement as oo,NativeModules as ao,AccessibilityInfo as no,Animated as io,Appearance as so,AppRegistry as lo,AppState as uo,BackHandler as co,Clipboard as po,Dimensions as mo,Easing as ho,I18nManager as go,Keyboard as fo,InteractionManager as yo,LayoutAnimation as bo,Linking as vo,NativeEventEmitter as So,PanResponder as Co,PixelRatio as wo,Platform as Eo,Share as xo,StyleSheet as le,UIManager as $o,Vibration as ko,CheckBox as Do,FlatList as Gt,Image as To,ImageBackground as Io,KeyboardAvoidingView as Ao,Picker as qo,ProgressBar as Bo,RefreshControl as Fo,SafeAreaView as Ro,SectionList as jo,StatusBar as zo,Touchable as Mo,TouchableNativeFeedback as Po,VirtualizedList as No,YellowBox as Vo,LogBox as Oo,DeviceEventEmitter as Uo,useColorScheme as Lo,useLocaleContext as Ho,useWindowDimensions as Jo}from"react-native-web";import*as W from"react-native-web";import{createElement as Wo,forwardRef as Ko}from"react";function Z(e){let t=Ko((a,o)=>{let{accessibilityState:n,accessibilityValue:i,...l}=a;for(let s of["busy","checked","disabled","expanded","selected"])n?.[s]!==void 0&&l[`aria-${s}`]===void 0&&(l[`aria-${s}`]=n[s]);for(let[s,u]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[s]!==void 0&&l[`aria-${u}`]===void 0&&(l[`aria-${u}`]=i[s]);return Wo(e,{...l,ref:o})}),r=e.State;return r&&Object.assign(t,{State:r}),t.displayName=e.displayName??e.name??"NativeWebView",t}var f=Z(W.View),k=Z(W.Text),_o=Z(W.TextInput),ge=Z(W.TouchableOpacity),Qo=Z(W.TouchableHighlight),Go=Z(W.TouchableWithoutFeedback),Zo=Z(W.Pressable),ue=Z(W.ScrollView),Yo=Z(W.Modal),Xo=Z(W.Switch),ea=Z(W.ActivityIndicator),ta=Z(W.Button),ra=W.findNodeHandle,Zt={alert(e,t,r,a){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 n=document.createElement("h2");if(n.textContent=e,n.style.cssText="font-size:18px;margin:0 0 12px",o.appendChild(n),t){let u=document.createElement("p");u.textContent=t,u.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",o.appendChild(u)}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"}],s=()=>{o.close?.(),o.remove()};for(let u of l){let c=document.createElement("button");c.type="button",c.textContent=u.text??"OK",c.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${u.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,c.onclick=()=>{s(),u.onPress?.()},i.appendChild(c)}o.addEventListener("cancel",u=>{u.preventDefault(),a?.cancelable!==false&&(s(),a?.onDismiss?.())}),o.appendChild(i),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};import{useState as ot,useCallback as Ae,useEffect as oa,useRef as aa}from"react";import{JsModal as na,ModalHeader as Y,buoyColors as ia,night as X,Trash2 as sa,Copy as la,Search as ua,devToolsStorageKeys as ca,ToolbarCopyButton as da,UpgradeModal as pa,PowerToggleButton as ma,useSafeRouter as ha,windowDragProps as ga}from"@buoy-gg/shared-ui/web";import{useState as fe,useEffect as ye,useCallback as be,useMemo as ve,useRef as yt}from"react";import{useFeatureGate as fa,subscribeToSubscriberCountChanges as ya,useIgnoredPatterns as ba,useLimit as va}from"@buoy-gg/shared-ui/web";import{loadToolModule as ee,getToolModuleVersion as Yt}from"@buoy-gg/shared-ui/web/utils";var Sa=0;function pe(e){return`${e}-${Date.now()}-${++Sa}`}function Ca(){try{let{storageEventStore:e}=ee("@buoy-gg/storage");return{id:"storage",name:"Storage",eventSources:["storage-async","storage-mmkv"],available:true,subscribe:t=>e.onEvent(r=>{if(r?.data?.initialScan)return;let a=wa(r);t(a)})}}catch{return null}}function wa(e){let t=e,r=t.storageType==="async"?"storage-async":"storage-mmkv",a=t.action;t.storageType==="async"&&(a={setItem:"Set Item",removeItem:"Remove Item",mergeItem:"Merge Item",clear:"Clear All",multiSet:"Multi Set",multiRemove:"Multi Remove",multiMerge:"Multi Merge"}[t.action]||t.action);let o="";if(t.storageType==="async")switch(t.action){case"setItem":case"removeItem":case"mergeItem":o=t.data?.key||"unknown key";break;case"multiSet":case"multiMerge":{let i=t.data?.pairs?.length||0;o=`${i} key${i!==1?"s":""}`;break}case"multiRemove":{let i=t.data?.keys?.length||0;o=`${i} key${i!==1?"s":""}`;break}case"clear":o="all keys";break}else o=t.data?.key||t.data?.instanceId||"unknown";let n="neutral";return(t.action.includes("set")||t.action.includes("Set")||t.action.includes("merge")||t.action.includes("Merge"))&&(n="success"),{id:pe(r),source:r,timestamp:t.timestamp.getTime(),title:a,subtitle:o,status:n,originalEvent:e}}function Ea(){try{let{reduxActionStore:e}=ee("@buoy-gg/redux"),t=null;return{id:"redux",name:"Redux",eventSources:["redux"],available:true,subscribe:r=>e.subscribe(a=>{if(a.length>0){let o=a[0];if(o.id!==t){t=o.id;let n=xa(o);r(n)}}})}}catch{return null}}function xa(e){let t=e,r="neutral";switch(t.category){case"fulfilled":r="success";break;case"rejected":r="error";break;case"pending":r="pending";break;default:r=t.hasStateChange?"success":"neutral"}let a="";return t.payloadPreview?a=t.payloadPreview:t.hasStateChange&&t.diffSummary?a=t.diffSummary:t.duration!==void 0?a=`${t.duration.toFixed(1)}ms`:a=t.sliceName||"",{id:pe("redux"),source:"redux",timestamp:t.timestamp,title:t.type,subtitle:a,status:r,originalEvent:e}}function $a(){try{let{networkEventStore:e,networkListener:t,addNetworkListener:r}=ee("@buoy-gg/network"),a=new Map;return{id:"network",name:"Network",eventSources:["network"],available:true,setup:()=>{let o=t();o.isActive||o.startListening(),o.listenerCount===0&&r(n=>{e.processNetworkEvent(n)})},subscribe:o=>{let n=Date.now();return e.onEvent(i=>{let l=i,s=a.get(l.id);if(s){let u=Xt(i);u.id=s,o(u)}else{if(typeof l.timestamp=="number"&&l.timestamp<n)return;let u=Xt(i);a.set(l.id,u.id),o(u)}},false)}}}catch{return null}}function Xt(e){let t=e,r="neutral";t.status===void 0?r="pending":t.error||t.status>=400?r="error":t.status>=200&&t.status<400&&(r="success");let a=t.operationName||`${t.method} ${t.path||t.url}`,o=[];return t.status!==void 0?o.push(`${t.status}`):t.error?o.push("Error"):o.push("Pending"),t.duration!==void 0&&o.push(`${t.duration.toFixed(0)}ms`),t.host&&o.push(t.host),{id:pe("network"),source:"network",timestamp:t.timestamp,title:a,subtitle:o.join(" \xB7 "),status:r,originalEvent:e}}function ka(){try{let{reactQueryEventStore:e}=ee("@buoy-gg/react-query"),t=null;return{id:"react-query",name:"React Query",eventSources:["react-query","react-query-query","react-query-mutation"],available:true,subscribe:r=>{let a=true,o=new Set,n=i=>i.queryHash??(i.mutationId!==void 0?`m-${i.mutationId}`:null);return e.subscribe(i=>{if(a){a=false,i.length>0&&(t=i[0].id);return}if(i.length>0){let l=i[0];if(l.id!==t){t=l.id;let s=l.type??"",u=n(l);if(s==="query-fetch-start"||s==="mutation-start")u&&o.add(u);else if((s==="query-fetch-success"||s==="query-fetch-error"||s==="mutation-success"||s==="mutation-error")&&u&&!o.has(u))return;let c=Da(l);r(c)}}})}}}catch{return null}}function er(e){return!e||e.length===0?"unknown":e.map(t=>{if(typeof t=="string")return t;if(typeof t=="number")return String(t);if(typeof t=="object"&&t!==null){let r=Object.values(t)[0];return typeof r=="string"||typeof r=="number"?String(r):JSON.stringify(t).slice(0,20)}return String(t)}).join(" \u203A ")}function Da(e){let t=e,r=t.type.startsWith("mutation-")?"react-query-mutation":"react-query-query",a="neutral";switch(t.type){case"query-fetch-start":case"mutation-start":a="pending";break;case"query-fetch-success":case"mutation-success":a="success";break;case"query-fetch-error":case"mutation-error":a="error";break}let o="";t.queryKey?o=er(t.queryKey):t.mutationKey?o=er(t.mutationKey):t.mutationId!==void 0?o=`Mutation #${t.mutationId}`:o=t.type.replace(/-/g," ");let n=[];switch(t.type){case"query-fetch-start":n.push("Fetching");break;case"query-fetch-success":n.push("Success");break;case"query-fetch-error":n.push("Error");break;case"query-invalidated":n.push("Invalidated");break;case"mutation-start":n.push("Mutating");break;case"mutation-success":n.push("Success");break;case"mutation-error":n.push("Error");break}t.duration!==void 0&&n.push(`${t.duration.toFixed(0)}ms`);let i;t.queryHash?i=`rq-query-${t.queryHash}`:t.mutationId!==void 0&&(i=`rq-mutation-${t.mutationId}`);let l=1;switch(t.type){case"query-fetch-start":case"mutation-start":l=1;break;case"query-fetch-success":case"query-fetch-error":case"mutation-success":case"mutation-error":l=2;break;case"query-invalidated":l=3;break}return{id:pe(r),source:r,timestamp:t.timestamp,title:o,subtitle:n.join(" \xB7 "),status:a,originalEvent:e,correlationId:i,sequenceInGroup:l}}function Ta(){try{let{routeEventStore:e}=ee("@buoy-gg/route-events");return{id:"route-events",name:"Routes",eventSources:["route"],available:true,subscribe:t=>e.onEvent(r=>{let a=Ia(r);t(a)})}}catch{return null}}function Ia(e){let t=e,r="neutral";(t.pathname==="/"||Object.keys(t.params).length>0)&&(r="success");let a=[],o=Object.keys(t.params).length;return o>0&&a.push(`${o} param${o!==1?"s":""}`),t.timeSincePrevious!==void 0&&t.timeSincePrevious>0&&(t.timeSincePrevious<1e3?a.push(`${t.timeSincePrevious}ms`):a.push(`${(t.timeSincePrevious/1e3).toFixed(1)}s`)),t.previousPathname&&t.previousPathname!==t.pathname&&a.push(`from ${t.previousPathname}`),{id:pe("route"),source:"route",timestamp:t.timestamp,title:t.pathname||"/",subtitle:a.join(" \xB7 ")||"navigation",status:r,originalEvent:e}}function Aa(){try{let{zustandStateStore:e}=ee("@buoy-gg/zustand"),t=null;return{id:"zustand",name:"Zustand",eventSources:["zustand"],available:true,subscribe:r=>e.subscribe(a=>{if(a.length>0){let o=a[0];if(o.id!==t){t=o.id;let n=qa(o);r(n)}}})}}catch{return null}}function qa(e){let t=e,r="neutral";t.isSlowUpdate?r="pending":t.hasStateChange&&(r="success");let a=[];if(t.changedKeys&&t.changedKeys.length>0){let o=t.changedKeys.slice(0,3).join(", "),n=t.changedKeys.length>3?` +${t.changedKeys.length-3}`:"";a.push(`${o}${n}`)}else t.diffSummary&&a.push(t.diffSummary);return t.duration!==void 0&&a.push(`${t.duration.toFixed(1)}ms`),t.category==="replace"&&a.push("replace"),{id:pe("zustand"),source:"zustand",timestamp:t.timestamp,title:t.storeName,subtitle:a.join(" \xB7 ")||(t.hasStateChange?"state changed":"no change"),status:r,originalEvent:e}}function Ba(){try{let{jotaiStateStore:e}=ee("@buoy-gg/jotai"),t=null;return{id:"jotai",name:"Jotai",eventSources:["jotai"],available:true,subscribe:r=>e.subscribe(a=>{if(a.length>0){let o=a[0];if(o.id!==t){t=o.id;let n=Fa(o);r(n)}}})}}catch{return null}}function Fa(e){let t=e,r="neutral";t.category==="write"&&t.hasValueChange?r="success":t.category==="read"&&(r="neutral");let a=[];return t.valuePreview?a.push(t.valuePreview):t.diffSummary&&a.push(t.diffSummary),t.category&&a.push(t.category),{id:pe("jotai"),source:"jotai",timestamp:t.timestamp,title:t.atomLabel,subtitle:a.join(" \xB7 ")||(t.hasValueChange?"value changed":"no change"),status:r,originalEvent:e}}function Ra(){let e;try{e=ee("@buoy-gg/highlight-updates")}catch{return null}try{if(!e.RenderTracker||!e.HighlightUpdatesController)return null;let{RenderTracker:t,HighlightUpdatesController:r}=e;return{id:"render",name:"Render",eventSources:["render"],available:true,setup:()=>{r&&r.enableBackgroundTracking()},subscribe:a=>{r&&!r.isBackgroundTrackingEnabled()&&r.enableBackgroundTracking();let o=t.onRenderEvent((n,i)=>{let l=ja(n,i);a(l)});return()=>{o(),r.disableBackgroundTracking()}}}}catch{return null}}function ja(e,t){let r=e,a=t,o=a.componentName||a.displayName||a.viewType,n=[],i={mount:"mounted",props:"props changed",state:"state changed",hooks:"hooks changed",context:"context changed",parent:"parent re-rendered",unknown:"re-rendered"};if(n.push(i[r.cause.type]||r.cause.type),r.cause.type==="props"&&r.cause.changedKeys?.length){let s=r.cause.changedKeys.slice(0,3).join(", "),u=r.cause.changedKeys.length>3?` +${r.cause.changedKeys.length-3}`:"";n.push(`[${s}${u}]`)}if(r.cause.hookChanges?.length){let s=r.cause.hookChanges[0];s.description&&n.push(s.description)}n.push(`#${r.renderNumber}`);let l="neutral";switch(r.cause.type){case"mount":l="neutral";break;case"props":case"state":case"hooks":case"context":l="success";break;case"parent":l="pending";break;default:l="neutral"}return{id:pe("render"),source:"render",timestamp:r.timestamp,title:o,subtitle:n.join(" \xB7 "),status:l,originalEvent:{event:r,render:a}}}function za(){let e=[],t=new Set,r=[Ca,Ea,$a,ka,Ta,Aa,Ba,Ra];for(let a of r){let o=a();o&&o.available&&(e.push(o),o.eventSources.forEach(n=>t.add(n)))}return{sources:e,availableEventSources:t}}function Ma(e){return{"storage-async":{label:"Storage",color:"#8B5CF6",icon:"server-outline"},"storage-mmkv":{label:"MMKV",color:"#F59E0B",icon:"flash-outline"},redux:{label:"Redux",color:"#3B82F6",icon:"git-branch-outline"},network:{label:"Network",color:"#10B981",icon:"globe-outline"},"react-query":{label:"Query",color:"#EC4899",icon:"sync-outline"},"react-query-query":{label:"Query",color:"#EC4899",icon:"sync-outline"},"react-query-mutation":{label:"Mutation",color:"#F97316",icon:"flash-outline"},route:{label:"Route",color:"#06B6D4",icon:"navigate-outline"},zustand:{label:"Zustand",color:"#764ABC",icon:"cube-outline"},jotai:{label:"Jotai",color:"#14B8A6",icon:"ellipse-outline"},render:{label:"Render",color:"#F472B6",icon:"layers-outline"}}[e]||{label:e,color:"#6B7280",icon:"help-outline"}}var bt=null,tr=-1;function H(){return(!bt||tr!==Yt())&&(tr=Yt(),bt=za()),bt}function Pa(){let e=[],t=0;try{let{storageEventStore:r}=ee("@buoy-gg/storage"),a=r.getSubscriberCounts();e.push({sourceId:"storage",counts:a}),t+=a.total}catch{}try{let{networkEventStore:r}=ee("@buoy-gg/network"),a=r.getSubscriberCounts();e.push({sourceId:"network",counts:a}),t+=a.total}catch{}try{let{routeEventStore:r}=ee("@buoy-gg/route-events"),a=r.getSubscriberCounts();e.push({sourceId:"route-events",counts:a}),t+=a.total}catch{}try{let{RenderTracker:r,HighlightUpdatesController:a}=ee("@buoy-gg/highlight-updates"),o=r.getRenderEventCallbackCount(),n=a?.isEnabled?.()?1:0,i={eventCallbacks:o,arrayListeners:n,total:o+n};e.push({sourceId:"render",counts:i}),t+=i.total}catch{}return{sources:e,totalSubscribers:t}}import{ChangeLog as Na}from"@buoy-gg/shared-ui/web";var vt={"storage-async":"storage","storage-mmkv":"storage",redux:"redux",network:"network","react-query":"react-query","react-query-query":"react-query","react-query-mutation":"react-query",route:"route-events",zustand:"zustand",jotai:"jotai",render:"render"};var Va=200,rr=new Set(["render"]),Oa=class extends Na{constructor(){super({max:Va});this.activeSources=new Set;this.remoteAvailableSources=null;this.sourceUnsubscribers=new Map;this.remoteDiscoveryIds=new Set;this.localDiscoveryIds=new Set;this.localSyncChain=Promise.resolve();this.networkEventIdMap=new Map}getDiscoveredSources(){return H().sources}getAvailableEventSources(){return this.remoteAvailableSources?this.remoteAvailableSources:H().availableEventSources}setRemoteAvailableSources(e){let t=e?new Set(e):null,r=this.remoteAvailableSources,a=r===null&&t===null||!!r&&!!t&&r.size===t.size&&[...t].every(o=>r.has(o));this.remoteAvailableSources=t,a||this.notifyListeners()}replaceEvents(e){this.activeSources=new Set(e.map(t=>t.source)),this.setItems(e)}async subscribeToAll(){let{sources:e}=H();for(let t of e)rr.has(t.id)||await this.subscribeToSource(t)}async subscribeToSource(e){let t=this.sourceUnsubscribers.get(e.id);if(t){t.refCount++;return}let r={unsubscribe:()=>{},refCount:1};this.sourceUnsubscribers.set(e.id,r);try{e.setup&&await e.setup();let a=await e.subscribe(o=>{this.addEvent(o)});a&&(r.unsubscribe=a)}catch{this.sourceUnsubscribers.get(e.id)===r&&r.refCount<=1&&this.sourceUnsubscribers.delete(e.id)}}unsubscribeFromSource(e){let t=this.sourceUnsubscribers.get(e);t&&(t.refCount--,t.refCount<=0&&(t.unsubscribe(),this.sourceUnsubscribers.delete(e)))}async subscribeToStorage(){let{sources:e}=H(),t=e.find(r=>r.id==="storage");t&&await this.subscribeToSource(t)}unsubscribeFromStorage(){this.unsubscribeFromSource("storage"),this.activeSources.delete("storage-async"),this.activeSources.delete("storage-mmkv")}subscribeToRedux(){let{sources:e}=H(),t=e.find(r=>r.id==="redux");t&&this.subscribeToSource(t)}unsubscribeFromRedux(){this.unsubscribeFromSource("redux"),this.activeSources.delete("redux")}subscribeToNetwork(){let{sources:e}=H(),t=e.find(r=>r.id==="network");t&&this.subscribeToSource(t)}unsubscribeFromNetwork(){this.unsubscribeFromSource("network"),this.activeSources.delete("network")}subscribeToReactQuery(){let{sources:e}=H(),t=e.find(r=>r.id==="react-query");t&&this.subscribeToSource(t)}unsubscribeFromReactQuery(){this.unsubscribeFromSource("react-query"),this.activeSources.delete("react-query"),this.activeSources.delete("react-query-query"),this.activeSources.delete("react-query-mutation")}subscribeToRoutes(){let{sources:e}=H(),t=e.find(r=>r.id==="route-events");t&&this.subscribeToSource(t)}unsubscribeFromRoutes(){this.unsubscribeFromSource("route-events"),this.activeSources.delete("route")}subscribeToZustand(){let{sources:e}=H(),t=e.find(r=>r.id==="zustand");t&&this.subscribeToSource(t)}unsubscribeFromZustand(){this.unsubscribeFromSource("zustand"),this.activeSources.delete("zustand")}subscribeToJotai(){let{sources:e}=H(),t=e.find(r=>r.id==="jotai");t&&this.subscribeToSource(t)}unsubscribeFromJotai(){this.unsubscribeFromSource("jotai"),this.activeSources.delete("jotai")}subscribeToRender(){let{sources:e}=H(),t=e.find(r=>r.id==="render");t&&this.subscribeToSource(t)}unsubscribeFromRender(){this.unsubscribeFromSource("render"),this.activeSources.delete("render")}addEvent(e){if(e.source==="network"){let t=e.originalEvent;if(t?.id){let r=this.networkEventIdMap.get(t.id);if(r){let a=this.items.findIndex(o=>o.id===r);if(a>=0){e.id=r,this.items=[...this.items.slice(0,a),e,...this.items.slice(a+1)],this.notifyListeners();return}}this.networkEventIdMap.set(t.id,e.id)}}this.push(e),this.activeSources.add(e.source),this.notifyListeners()}getEvents(e){return!e||e.size===0?this.items:this.items.filter(t=>e.has(t.source))}getActiveSources(){return Array.from(this.activeSources)}getSourceCounts(){let e={"storage-async":0,"storage-mmkv":0,redux:0,network:0,"react-query":0,"react-query-query":0,"react-query-mutation":0,route:0,zustand:0,jotai:0,render:0};for(let t of this.items)e[t.source]++;return e}clearEvents(){this.activeSources.clear(),this.networkEventIdMap.clear(),this.clear()}subscribe(e){let t=super.subscribe(e);return e(this.items),t}getEventCount(){return this.items.length}unsubscribeAll(){for(let[,e]of this.sourceUnsubscribers)e.unsubscribe();this.sourceUnsubscribers.clear(),this.activeSources.clear(),this.remoteDiscoveryIds.clear(),this.localDiscoveryIds.clear()}watch(e,t,r=Date.now()){let a=new Set(e),o=new Set;for(let u of e){let c=vt[u];c&&o.add(c)}let{sources:n}=H(),i=[];for(let u of o){let c=n.find(d=>d.id===u);c&&(i.push(u),this.subscribeToSource(c))}let l=false,s=this.subscribe(u=>{l||t(u.filter(c=>c.timestamp>=r&&a.has(c.source)))});return()=>{if(!l){l=true,s();for(let u of i)this.unsubscribeFromSource(u)}}}setLocalEnabledSources(e){let t=async()=>{let r=new Set;for(let n of e){let i=vt[n];i&&r.add(i)}let a=this.localDiscoveryIds;this.localDiscoveryIds=r;let{sources:o}=H();for(let n of r)if(!a.has(n)){let i=o.find(l=>l.id===n);i&&await this.subscribeToSource(i)}for(let n of a)r.has(n)||this.unsubscribeFromSource(n)};return this.localSyncChain=this.localSyncChain.then(t,t),this.localSyncChain}async setRemoteEnabledSources(e){let{sources:t}=H(),r;if(e==="all")r=new Set(t.map(o=>o.id).filter(o=>!rr.has(o)));else{r=new Set;for(let o of e){let n=vt[o];n&&r.add(n)}}let a=this.remoteDiscoveryIds;this.remoteDiscoveryIds=r;for(let o of r)if(!a.has(o)){let n=t.find(i=>i.id===o);n&&await this.subscribeToSource(n)}for(let o of a)r.has(o)||this.unsubscribeFromSource(o)}ensureRemoteSourcesDefault(){this.remoteDiscoveryIds.size===0&&this.setRemoteEnabledSources("all")}clearRemoteSources(){for(let e of this.remoteDiscoveryIds)this.unsubscribeFromSource(e);this.remoteDiscoveryIds.clear()}isSourceSubscribed(e){switch(e){case"storage-async":case"storage-mmkv":return this.sourceUnsubscribers.has("storage");case"redux":return this.sourceUnsubscribers.has("redux");case"network":return this.sourceUnsubscribers.has("network");case"react-query":case"react-query-query":case"react-query-mutation":return this.sourceUnsubscribers.has("react-query");case"route":return this.sourceUnsubscribers.has("route-events");case"zustand":return this.sourceUnsubscribers.has("zustand");case"jotai":return this.sourceUnsubscribers.has("jotai");case"render":return this.sourceUnsubscribers.has("render");default:return false}}getSubscriptionStatus(){return{"storage-async":this.sourceUnsubscribers.has("storage"),"storage-mmkv":this.sourceUnsubscribers.has("storage"),redux:this.sourceUnsubscribers.has("redux"),network:this.sourceUnsubscribers.has("network"),"react-query":this.sourceUnsubscribers.has("react-query"),"react-query-query":this.sourceUnsubscribers.has("react-query"),"react-query-mutation":this.sourceUnsubscribers.has("react-query"),route:this.sourceUnsubscribers.has("route-events"),zustand:this.sourceUnsubscribers.has("zustand"),jotai:this.sourceUnsubscribers.has("jotai"),render:this.sourceUnsubscribers.has("render")}}getSubscriberCounts(){return Pa()}},O=new Oa;var Ua=e=>O.getEvents(e);var La=()=>O.clearEvents(),Ha=e=>O.subscribe(e);var or=e=>O.setLocalEnabledSources(e);var ar=()=>O.getAvailableEventSources();var Ja=(e,t,r)=>O.watch(e,t,r),nr=()=>O.getSubscriberCounts();import{persistentStorage as Se,devToolsStorageKeys as qe}from"@buoy-gg/shared-ui/web";async function Wa(e){try{let t=qe.events.enabledSources();await Se.setItem(t,JSON.stringify(e))}catch{}}async function Ka(){try{let e=qe.events.enabledSources(),t=await Se.getItem(e);return t&&t!==""?JSON.parse(t):null}catch{return null}}async function _a(e){try{let t=qe.events.isCapturing();await Se.setItem(t,JSON.stringify(e))}catch{}}async function Qa(){try{let e=qe.events.isCapturing(),t=await Se.getItem(e);return t!==null&&t!==""?JSON.parse(t):null}catch{return null}}async function ir(e){try{let t=qe.events.pausedAt();e===null?await Se.removeItem(t):await Se.setItem(t,JSON.stringify(e))}catch{}}async function Ga(){try{let e=qe.events.pausedAt(),t=await Se.getItem(e);if(t!==null&&t!==""){let r=JSON.parse(t);return typeof r=="number"?r:null}return null}catch{return null}}import{isDevToolsStorageKey as sr,isUrlIgnored as Za}from"@buoy-gg/shared-ui/web";var Ya=["api.keygen.sh","buoy.gg/api/license"];function St(e){let t=e.originalEvent;if(!t)return false;if(e.source==="storage-async"||e.source==="storage-mmkv"){let r=t.data?.key||t.key;if(r&&sr(r))return true;let a=t.data?.keys||t.data?.pairs?.map(o=>o[0]);if(a&&a.length>0&&a.every(o=>sr(o)))return true}if(e.source==="network"){let r=t.host||"",a=t.url||"";for(let o of Ya)if(r.includes(o)||a.includes(o))return true}return false}function Ct(e,t){if(e.source!=="network"||t.length===0)return false;let r=e.originalEvent?.url??"";return Za(r,t)}function Xa(e,t){return St(e)||Ct(e,t)}function en(e,t){if(e.title.toLowerCase().includes(t)||e.subtitle.toLowerCase().includes(t))return true;let r=e.originalEvent?.url;return typeof r=="string"&&r.toLowerCase().includes(t)}var lr=["storage-async","redux","network","react-query-query","react-query-mutation","route","zustand","jotai","render"],ur=lr.filter(e=>e!=="render"),wt={"storage-async":["storage-async","storage-mmkv"],"storage-mmkv":["storage-mmkv"],redux:["redux"],network:["network"],"react-query":["react-query","react-query-query"],"react-query-query":["react-query","react-query-query"],"react-query-mutation":["react-query-mutation"],route:["route"],zustand:["zustand"],jotai:["jotai"],render:["render"]};function Et(e){let{isPro:t}=fa(),r=va("events.entries"),{patterns:a}=ba(),[o,n]=fe([]),[i,l]=fe(()=>new Set(ur)),[s,u]=fe(true),[c,d]=fe(""),h=yt(false),b=e?.capturingOverride??s,v=yt(null),m=yt([]),[y,p]=fe(0);ye(()=>{b?v.current!==null&&(m.current=[...m.current,[v.current,Date.now()]],v.current=null,p(w=>w+1),ir(null)):v.current===null&&(v.current=Date.now(),p(w=>w+1),ir(v.current))},[b]);let g=be(w=>{let F=v.current;if(F!==null&&w>F)return true;for(let[z,Q]of m.current)if(w>z&&w<=Q)return true;return false},[]),[$,L]=fe(()=>ar()),[C,I]=fe(0);ye(()=>ya(()=>{I(w=>w+1)}),[]);let x=ve(()=>lr.filter(w=>(wt[w]||[w]).some(F=>$.has(F))),[$]);ye(()=>{let w=null,F=Ha(()=>{w==null&&(w=requestAnimationFrame(()=>{w=null,z()}))}),z=()=>{let Q=Ua();n(Q),L(q=>{let R=ar();return q.size===R.size&&[...R].every(ne=>q.has(ne))?q:new Set(R)})};return()=>{F(),w!=null&&cancelAnimationFrame(w)}},[]),ye(()=>{(async()=>{let w=await Ka(),F,z=x.filter(R=>ur.includes(R));if(w&&w.length>0){let R=w.filter(ne=>x.includes(ne));R.length>0?F=new Set(R):F=new Set(z)}else F=new Set(z);l(F);let Q=await Qa(),q=Q!==null?Q:true;if(!q&&v.current===null){let R=await Ga();v.current=R??Date.now(),p(ne=>ne+1)}u(q),h.current=true,or(q?Array.from(F):[])})()},[x]),ye(()=>{h.current&&or(s?Array.from(i):[])},[i,s]),ye(()=>{h.current&&Wa(Array.from(i))},[i]),ye(()=>{h.current&&_a(s)},[s]);let j=ve(()=>{let w=new Set;return i.forEach(F=>{let z=wt[F];z&&z.forEach(Q=>w.add(Q))}),w},[i]),N=c.trim().toLowerCase(),me=ve(()=>o.filter(w=>!g(w.timestamp)&&!St(w)&&!Ct(w,a)),[o,a,g,y]),K=ve(()=>j.size===0?[]:me.filter(w=>j.has(w.source)&&(N===""||en(w,N))),[me,j,N]),he=ve(()=>K.slice(0,r),[K,r]),_=ve(()=>Math.max(0,K.length-r),[K,r]),Xe=ve(()=>{let w=me.reduce((q,R)=>(q[R.source]=(q[R.source]??0)+1,q),{}),F=nr(),z={};for(let q of F.sources)z[q.sourceId]=q.counts.total;let Q={"storage-async":"storage","storage-mmkv":"storage",redux:"redux",network:"network","react-query":"react-query","react-query-query":"react-query","react-query-mutation":"react-query",route:"route-events",zustand:"zustand",jotai:"jotai",render:"render"};return x.map(q=>{let R=(wt[q]||[q]).reduce((G,ft)=>G+(w[ft]||0),0),ne=Ma(q),Ie=Q[q],rt=Ie&&Ie in z?z[Ie]:void 0;return{source:q,...ne,count:R,enabled:i.has(q),subscriberCount:rt}}).sort((q,R)=>q.enabled&&!R.enabled?-1:!q.enabled&&R.enabled?1:0)},[me,i,x,C]),mt=be(w=>{l(F=>{let z=new Set(F);return z.has(w)?z.delete(w):z.add(w),z})},[]),et=be(()=>{l(new Set(x))},[x]),Te=be(()=>{La()},[]),Ve=be(()=>{u(true)},[]),ht=be(()=>{u(false)},[]),gt=be(()=>{u(w=>!w)},[]),tt=nr().totalSubscribers;return{events:o,filteredEvents:he,availableSources:Xe,enabledSources:i,searchText:c,setSearchText:d,toggleSource:mt,enableAllSources:et,clearEvents:Te,totalCount:me.length,filteredCount:he.length,isCapturing:s,startCapturing:Ve,stopCapturing:ht,toggleCapturing:gt,discoveredSources:$,hiddenEventsCount:_,isPro:t,totalSubscriberCount:tt}}import{memo as tn}from"react";import{night as U}from"@buoy-gg/shared-ui/web";var S="buoy-events";function rn(e){return String(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"unknown"}function cr(e){let t=e.originalEvent??{};switch(e.source){case"storage-async":case"storage-mmkv":{let r=t.data??{},a=r.key??(Array.isArray(r.keys)?r.keys.join("+"):void 0)??(Array.isArray(r.pairs)?r.pairs.map(o=>o[0]).join("+"):void 0);return`${e.title} ${a??""}`}case"network":{let r=String(t.url??""),a=r.split("?")[0]??r;return`${t.method??""} ${a}`}case"react-query":case"react-query-query":case"react-query-mutation":return`${e.title} ${t.type??""}`;default:return e.title}}function dr(e){return`${S}-row-${e.source}-${rn(cr(e))}`}function pr(e){return`${S}-filter-${e}`}import{jsx as Ce,jsxs as xt}from"react/jsx-runtime";var $t=tn(function({availableSources:e,onToggleSource:t,totalCount:r,filteredCount:a}){return e.length===0?null:xt(f,{style:re.container,testID:`${S}-filter-bar`,children:[Ce(ue,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:re.badgesRow,testID:`${S}-filter-scroll`,children:e.map(o=>{let n=o.enabled!==false,i=o.subscriberCount,l=i!==void 0,s=o.count||0,u=pr(o.source);return xt(ge,{testID:u,accessibilityRole:"button",accessibilityLabel:`${o.label} filter, ${n?"on":"off"}, ${s} event${s===1?"":"s"}`,style:[re.badge,n?{backgroundColor:U.color.surface,borderColor:o.color+"50"}:re.badgeDisabled],onPress:()=>t(o.source),activeOpacity:.7,children:[l&&Ce(f,{style:[re.countBadge,{backgroundColor:n?i>0?o.color+"25":U.color.fillSecondary:U.color.fill}],children:Ce(k,{style:[re.countText,{color:n?i>0?o.color:U.color.textTertiary:U.color.textTertiary}],testID:`${u}-subscribers`,children:i})}),Ce(f,{style:[re.dot,{backgroundColor:n?o.color:U.color.fillTertiary}]}),Ce(k,{style:[re.badgeLabel,{color:n?U.color.text:U.color.textTertiary}],numberOfLines:1,testID:`${u}-label`,children:o.label}),Ce(f,{style:[re.countBadge,{backgroundColor:n?s>0?o.color+"20":U.color.fill:U.color.fill}],children:Ce(k,{style:[re.countText,{color:n?s>0?o.color:U.color.textTertiary:U.color.textTertiary}],testID:`${u}-count`,children:s})})]},o.source)})}),a<r&&xt(k,{style:re.filterInfo,testID:`${S}-showing`,children:["Showing ",a," of ",r]})]})}),re=le.create({container:{paddingVertical:8,backgroundColor:"transparent",borderBottomWidth:1,borderBottomColor:U.color.border},badgesRow:{flexDirection:"row",gap:8,paddingHorizontal:12},badge:{flexDirection:"row",alignItems:"center",paddingVertical:5,paddingHorizontal:6,borderRadius:20,borderWidth:1,gap:6,flexShrink:0},badgeDisabled:{backgroundColor:U.color.surface,borderColor:U.color.border,opacity:.5},dot:{width:7,height:7,borderRadius:4},badgeLabel:{fontSize:12,fontWeight:"500"},countBadge:{minWidth:18,height:18,borderRadius:9,alignItems:"center",justifyContent:"center",paddingHorizontal:5},countText:{fontSize:10,fontWeight:"600",fontVariant:["tabular-nums"]},filterInfo:{marginTop:6,fontSize:11,color:U.color.textTertiary,textAlign:"center"}});import{memo as on,useCallback as kt,useMemo as an}from"react";import{night as at,Zap as nn,ProBadge as sn,ToolEmptyState as ln,resolveListEmptyState as un}from"@buoy-gg/shared-ui/web";import{loadToolModule as Be,getToolModuleVersion as mr}from"@buoy-gg/shared-ui/web/utils";import{memo as cn}from"react";import{CompactRow as dn,formatRelativeTime as pn,Pill as mn}from"@buoy-gg/shared-ui/web";import{jsx as V,jsxs as hn}from"react/jsx-runtime";function gn(){let e={StorageEventCard:null,getValueType:null,ReduxActionItem:null,NetworkEventItemCompact:null,RouteEventItemCompact:null,ZustandStateChangeItem:null,JotaiAtomChangeItem:null};try{let t=Be("@buoy-gg/storage");e.StorageEventCard=t.StorageEventCard,e.getValueType=t.getValueType}catch{}try{let t=Be("@buoy-gg/redux");e.ReduxActionItem=t.ReduxActionItem}catch{}try{let t=Be("@buoy-gg/network");e.NetworkEventItemCompact=t.NetworkEventItemCompact}catch{}try{let t=Be("@buoy-gg/route-events");e.RouteEventItemCompact=t.RouteEventItemCompact}catch{}try{let t=Be("@buoy-gg/zustand");e.ZustandStateChangeItem=t.ZustandStateChangeItem}catch{}try{let t=Be("@buoy-gg/jotai");e.JotaiAtomChangeItem=t.JotaiAtomChangeItem}catch{}return e}var Dt,hr=-1;function fn(){return(!Dt||hr!==mr())&&(Dt=gn(),hr=mr()),Dt}var gr={"storage-async":{label:"Storage",color:"#8B5CF6"},"storage-mmkv":{label:"MMKV",color:"#F59E0B"},redux:{label:"Redux",color:"#3B82F6"},network:{label:"Network",color:"#10B981"},"react-query":{label:"Query",color:"#EC4899"},"react-query-query":{label:"Query",color:"#EC4899"},"react-query-mutation":{label:"Mutation",color:"#F97316"},route:{label:"Route",color:"#06B6D4"},zustand:{label:"Zustand",color:"#764ABC"},jotai:{label:"Jotai",color:"#14B8A6"},render:{label:"Render",color:"#F472B6"}};function yn(e){switch(e){case"success":return"#10B981";case"error":return"#EF4444";case"pending":return"#F59E0B";case"neutral":default:return"#6B7280"}}function bn(e){return e==="storage-async"||e==="storage-mmkv"}function vn({label:e,color:t,testID:r}){return V(mn,{label:e,color:t,variant:"soft",size:"sm",style:{marginLeft:6},testID:r})}var Sn={"storage-async":"STORAGE","storage-mmkv":"MMKV",redux:"REDUX",network:"NET","react-query":"QUERY","react-query-query":"QUERY","react-query-mutation":"MUTATION",route:"ROUTE",zustand:"ZUSTAND",jotai:"JOTAI",render:"RENDER"};function Oe({source:e,testID:t,children:r}){let a=gr[e].color,o=Sn[e];return hn(f,{style:Tt.badgeWrapper,testID:t,children:[r,V(f,{style:[Tt.sourceBadge,{backgroundColor:`${a}20`}],children:V(k,{style:[Tt.sourceBadgeText,{color:a}],testID:t?`${t}-badge`:void 0,children:o})})]})}var fr=cn(function({event:e,onPress:t,isSelected:r=false,isExpanded:a=false,onNavigate:o,correlationCount:n=1,correlationLabel:i,correlationColor:l}){let{StorageEventCard:s,getValueType:u,ReduxActionItem:c,NetworkEventItemCompact:d,RouteEventItemCompact:h,ZustandStateChangeItem:b,JotaiAtomChangeItem:v}=fn(),m=gr[e.source],y=yn(e.status),p=dr(e);if(bn(e.source)&&s&&u){let $=e.originalEvent,L={key:$.data?.key||"unknown",lastAction:$.action,totalOperations:1,lastEventTimestamp:new Date(e.timestamp),storageTypes:new Set([$.storageType||"async"]),valueType:$.data?.value!==void 0?u($.data.value):void 0};return V(Oe,{source:e.source,testID:p,children:V(s,{data:L,onPress:t,isSelected:r})})}if(e.source==="redux"&&c){let $=e.originalEvent;return V(Oe,{source:e.source,testID:p,children:V(c,{action:$,onPress:()=>t()})})}if(e.source==="network"&&d){let $=e.originalEvent;return V(f,{testID:p,children:V(d,{event:$,onPress:()=>t()})})}if(e.source==="route"&&h){let $=e.originalEvent;return V(Oe,{source:e.source,testID:p,children:V(h,{event:$,visitNumber:0,isExpanded:a,onPress:()=>t(),onNavigate:o})})}if(e.source==="zustand"&&b)return V(Oe,{source:e.source,testID:p,children:V(b,{change:e.originalEvent,onPress:()=>t()})});if(e.source==="jotai"&&v)return V(Oe,{source:e.source,testID:p,children:V(v,{change:e.originalEvent,onPress:()=>t()})});let g=i&&l?V(vn,{label:i,color:l,testID:`${p}-correlation`}):null;return V(dn,{statusDotColor:m.color,statusLabel:m.label,primaryText:e.title,secondaryText:e.subtitle,badgeText:n>1&&!i?`${n}`:"",badgeColor:l||y,customBadge:g,bottomRightText:pn(new Date(e.timestamp)),showChevron:true,isSelected:r,onPress:t,testID:p})}),Tt=le.create({badgeWrapper:{position:"relative"},sourceBadge:{position:"absolute",top:4,right:12,paddingHorizontal:6,paddingVertical:2,borderRadius:4,zIndex:10},sourceBadgeText:{fontSize:8,fontWeight:"700",letterSpacing:.5}});function Cn(e,t){return e.correlationId?t.filter(r=>r.correlationId===e.correlationId&&r.id!==e.id).sort((r,a)=>r.timestamp-a.timestamp):[]}function wn(e,t){return e.correlationId?t.some(r=>r.correlationId===e.correlationId&&r.id!==e.id):false}function En(e,t){return e.correlationId?t.filter(r=>r.correlationId===e.correlationId).length:1}function yr(e){let t=new Map;for(let r of e)if(r.correlationId){let a=t.get(r.correlationId)||0;t.set(r.correlationId,a+1)}return t}function br(e,t){return t.filter(r=>r.correlationId===e).sort((r,a)=>{let o=r.sequenceInGroup??0,n=a.sequenceInGroup??0;return o!==n?o-n:r.timestamp-a.timestamp})}function vr(e,t){if(!e.correlationId)return null;let r=br(e.correlationId,t);if(r.length<=1)return null;let a=r.findIndex(o=>o.id===e.id);return a===-1?null:`${a+1}/${r.length}`}var Sr=["#EC4899","#8B5CF6","#3B82F6","#10B981","#F59E0B","#EF4444","#06B6D4","#84CC16"];function Cr(e){let t=0;for(let a=0;a<e.length;a++)t=(t<<5)-t+e.charCodeAt(a),t|=0;let r=Math.abs(t)%Sr.length;return Sr[r]}import{jsx as Fe,jsxs as It}from"react/jsx-runtime";var At=on(function({events:e,selectedEventId:t,expandedEventId:r,onEventPress:a,onNavigate:o,isCapturing:n,hiddenEventsCount:i=0,onUpgradePress:l,searchText:s="",totalCount:u=0,sourceCount:c,enabledSourceCount:d}){let h=an(()=>yr(e),[e]),b=kt(({item:y})=>{let p=y.correlationId&&h.get(y.correlationId)||1,g=vr(y,e),$=y.correlationId?Cr(y.correlationId):void 0;return Fe(fr,{event:y,isSelected:y.id===t,isExpanded:y.id===r,onPress:()=>a(y),onNavigate:o,correlationCount:p,correlationLabel:g,correlationColor:$})},[t,r,a,o,h,e]),v=kt(y=>y.id,[]),m=kt(()=>i<=0?null:It(ge,{style:we.hiddenBanner,onPress:l,activeOpacity:.8,testID:`${S}-hidden-banner`,accessibilityRole:"button",accessibilityLabel:`${i} hidden event${i!==1?"s":""}, upgrade for the full history`,children:[It(f,{style:we.hiddenBannerLeft,children:[Fe(nn,{size:16,color:at.color.accent}),It(k,{style:we.hiddenBannerText,testID:`${S}-hidden-count`,children:[i," hidden event",i!==1?"s":""]})]}),Fe(sn,{})]}),[i,l]);if(e.length===0){let y=c===0,p=d===0,g=y?{otto:"scanning",title:"No Event Sources",message:`This tool reports on the other Buoy tools.
|
|
2
|
+
Install one \u2014 network, storage, redux, routes \u2014 and its events land here.`}:p&&!s.trim()&&u>0?{otto:"filtering",title:"Every Source Is Off",message:`${u} event${u===1?" is":"s are"} captured. Turn a source chip back on to see them.`}:un({subject:"events",search:s,total:u,capturing:n,blocked:p?"Every source chip is off, so there is nothing to search. Turn one back on.":void 0,waiting:{otto:"listening",title:"No Events Yet",message:`Events will appear here as they occur.
|
|
3
|
+
Try interacting with your app.`},paused:{title:"Not Capturing",message:"Event capture is paused. Resume to see events."}});return Fe(ln,{...g,testID:`${S}-empty`,style:we.emptyContainer})}return Fe(Gt,{data:e,renderItem:b,keyExtractor:v,testID:`${S}-list`,style:we.list,contentContainerStyle:we.listContent,ItemSeparatorComponent:()=>Fe(f,{style:we.separator}),ListFooterComponent:m,showsVerticalScrollIndicator:true,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,removeClippedSubviews:!(typeof process<"u"&&process.env?.EXPO_PUBLIC_E2E)})}),we=le.create({list:{flex:1,backgroundColor:"transparent"},listContent:{paddingVertical:16},separator:{height:8},emptyContainer:{flex:1,justifyContent:"center",backgroundColor:"transparent"},hiddenBanner:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginHorizontal:16,marginTop:8,marginBottom:16,paddingVertical:12,paddingHorizontal:16,backgroundColor:at.color.surface,borderRadius:8,borderWidth:1,borderColor:at.color.border},hiddenBannerLeft:{flexDirection:"row",alignItems:"center",gap:8},hiddenBannerText:{fontSize:13,fontWeight:"500",color:at.color.text}});import{loadToolModule as Ee,getToolModuleVersion as qt}from"@buoy-gg/shared-ui/web/utils";import{memo as xn,useMemo as wr}from"react";import{night as ce,formatRelativeTime as $n,copyToClipboard as kn,parseValue as Dn,useIgnoredPatterns as Tn,monoFont as In}from"@buoy-gg/shared-ui/web";import{DataViewer as An}from"@buoy-gg/shared-ui/web/dataViewer";import{memo as qn,useMemo as Bn}from"react";import{buoyColors as oe,night as M,displayValue as Fn,monoFont as Re}from"@buoy-gg/shared-ui/web";import{DataViewer as nt}from"@buoy-gg/shared-ui/web/dataViewer";import{jsx as T,jsxs as J}from"react/jsx-runtime";var Rn={"query-fetch-start":{label:"Query Fetching",color:M.color.accent,icon:"hourglass"},"query-fetch-success":{label:"Query Success",color:oe.success,icon:"checkmark"},"query-fetch-error":{label:"Query Error",color:oe.error,icon:"close"},"query-invalidated":{label:"Query Invalidated",color:oe.warning,icon:"refresh"},"mutation-start":{label:"Mutation Started",color:M.color.accent,icon:"hourglass"},"mutation-success":{label:"Mutation Success",color:oe.success,icon:"checkmark"},"mutation-error":{label:"Mutation Error",color:oe.error,icon:"close"}},Er=qn(function({event:e}){let t=e.originalEvent,r=Rn[t.type]||{label:t.type,color:M.color.textTertiary,icon:"help"},a=t.type.startsWith("query-"),o=t.type.startsWith("mutation-"),n=Bn(()=>{let c=a?t.queryKey:t.mutationKey;return c?Fn(c,true):o&&t.mutationId!==void 0?`Mutation #${t.mutationId}`:"No key"},[t,a,o]),i=new Date(t.timestamp).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:true}),l=a?!!t.queryData:!!t.mutationData,s=a?!!t.queryError:!!t.mutationError,u=o&&!!t.mutationVariables;return J(ue,{style:E.container,contentContainerStyle:E.contentContainer,children:[T(f,{style:E.section,children:J(f,{style:[E.eventTypeContainer,{borderColor:r.color+"4D"}],children:[T(k,{style:[E.eventTypeHeader,{backgroundColor:r.color+"15",color:r.color}],children:r.label}),J(f,{style:E.eventTypeContent,children:[J(f,{style:E.keyRow,children:[T(ue,{horizontal:true,style:E.keyScrollView,children:T(k,{style:E.keyText,children:n})}),T(jn,{type:t.type,color:r.color})]}),t.duration!==void 0&&J(f,{style:E.row,children:[T(k,{style:E.labelText,children:"Duration:"}),J(k,{style:E.valueText,children:[t.duration.toFixed(0),"ms"]})]}),J(f,{style:E.row,children:[T(k,{style:E.labelText,children:"Timestamp:"}),T(k,{style:E.valueText,children:i})]}),a&&t.queryHash&&J(f,{style:E.row,children:[T(k,{style:E.labelText,children:"Query Hash:"}),T(k,{style:[E.valueText,E.hashText],numberOfLines:1,children:t.queryHash})]}),o&&t.mutationId!==void 0&&J(f,{style:E.row,children:[T(k,{style:E.labelText,children:"Mutation ID:"}),J(k,{style:E.valueText,children:["#",t.mutationId]})]})]})]})}),u&&T(f,{style:E.section,children:J(f,{style:E.dataContainer,children:[T(k,{style:[E.dataHeader,{color:oe.warning}],children:"Variables"}),T(f,{style:E.dataContent,children:T(nt,{title:"",data:t.mutationVariables,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})}),l&&T(f,{style:E.section,children:J(f,{style:E.dataContainer,children:[T(k,{style:[E.dataHeader,{color:oe.success}],children:a?"Query Data":"Mutation Result"}),T(f,{style:E.dataContent,children:T(nt,{title:"",data:a?t.queryData:t.mutationData,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})}),s&&T(f,{style:E.section,children:J(f,{style:[E.dataContainer,E.errorContainer],children:[T(k,{style:[E.dataHeader,E.errorHeader],children:"Error"}),T(f,{style:E.dataContent,children:T(nt,{title:"",data:a?t.queryError:t.mutationError,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})}),T(f,{style:E.section,children:J(f,{style:E.dataContainer,children:[T(k,{style:E.dataHeader,children:"Event Details"}),T(f,{style:E.dataContent,children:T(nt,{title:"",data:t,showTypeFilter:true,rawMode:true,initialExpanded:false})})]})})]})});function jn({type:e,color:t}){let r=()=>e.includes("start")?"PENDING":e.includes("success")?"SUCCESS":e.includes("error")?"ERROR":e.includes("invalidated")?"INVALIDATED":e.toUpperCase();return T(f,{style:[E.statusChip,{backgroundColor:t+"15",borderColor:t+"33"}],children:T(k,{style:[E.statusChipText,{color:t}],children:r()})})}var E=le.create({container:{flex:1,backgroundColor:"transparent"},contentContainer:{padding:8,paddingBottom:24},section:{marginBottom:12},eventTypeContainer:{minWidth:200,backgroundColor:M.color.surface,borderRadius:6,borderWidth:1,overflow:"hidden",shadowColor:M.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},eventTypeHeader:{paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,borderBottomWidth:1,borderBottomColor:M.color.accentBorder,letterSpacing:.5,textTransform:"uppercase",fontFamily:Re},eventTypeContent:{padding:0},keyRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:M.color.separator},keyScrollView:{flex:1,marginRight:8},keyText:{fontSize:12,color:M.color.text,fontFamily:Re,lineHeight:18,backgroundColor:M.color.accentSoft,paddingHorizontal:8,paddingVertical:4,borderRadius:4,borderWidth:1,borderColor:M.color.accentBorderStrong},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:M.color.separator},labelText:{fontSize:10,color:M.color.textSecondary,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase",fontFamily:Re},valueText:{fontSize:12,color:M.color.text,fontWeight:"500",fontVariant:["tabular-nums"],fontFamily:Re},hashText:{flex:1,textAlign:"right",marginLeft:8},statusChip:{paddingHorizontal:8,paddingVertical:4,borderWidth:1,borderRadius:6,alignSelf:"flex-start"},statusChipText:{fontSize:11,fontWeight:"600",textTransform:"uppercase",letterSpacing:.5,fontFamily:Re},dataContainer:{minWidth:200,backgroundColor:M.color.surface,borderRadius:6,borderWidth:1,borderColor:M.color.accentBorderStrong,overflow:"hidden",shadowColor:M.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},dataHeader:{backgroundColor:M.color.accentSoft,paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:M.color.accent,borderBottomWidth:1,borderBottomColor:M.color.accentBorder,letterSpacing:.5,textTransform:"uppercase",fontFamily:Re},dataContent:{padding:8},errorContainer:{borderColor:oe.error+"4D"},errorHeader:{backgroundColor:oe.error+"1A",color:oe.error,borderBottomColor:oe.error+"33"}});import{Fragment as zn,jsx as D,jsxs as Ue}from"react/jsx-runtime";function Mn(){let e={StorageEventDetailContent:null,ReduxActionDetailContent:null,NetworkEventDetailView:null,RenderDetailView:null,ZustandStateDetailContent:null,JotaiAtomDetailContent:null,RouteEventDetail:null};try{let t=Ee("@buoy-gg/storage");e.StorageEventDetailContent=t.StorageEventDetailContent}catch{}try{let t=Ee("@buoy-gg/redux");e.ReduxActionDetailContent=t.ReduxActionDetailContent}catch{}try{let t=Ee("@buoy-gg/network");e.NetworkEventDetailView=t.NetworkEventDetailView}catch{}try{let t=Ee("@buoy-gg/highlight-updates");e.RenderDetailView=t.RenderDetailView}catch{}try{let t=Ee("@buoy-gg/zustand");e.ZustandStateDetailContent=t.ZustandStateDetailContent}catch{}try{let t=Ee("@buoy-gg/jotai");e.JotaiAtomDetailContent=t.JotaiAtomDetailContent}catch{}try{let t=Ee("@buoy-gg/route-events");e.RouteEventDetail=t.RouteEventDetail}catch{}return e}var Bt,xr=-1;function Pn(){return(!Bt||xr!==qt())&&(Bt=Mn(),xr=qt()),Bt}var Nn={"storage-async":{label:"AsyncStorage",color:"#8B5CF6"},"storage-mmkv":{label:"MMKV",color:"#F59E0B"},redux:{label:"Redux",color:"#3B82F6"},network:{label:"Network",color:"#10B981"},"react-query":{label:"React Query",color:"#EC4899"},"react-query-query":{label:"Query",color:"#EC4899"},"react-query-mutation":{label:"Mutation",color:"#F97316"},route:{label:"Route",color:"#06B6D4"},zustand:{label:"Zustand",color:"#764ABC"},jotai:{label:"Jotai",color:"#14B8A6"},render:{label:"Render",color:"#F472B6"}};function Vn(e){return e==="storage-async"||e==="storage-mmkv"}function On(e){let t=Dn(e);return t===null?"null":t===void 0?"undefined":Array.isArray(t)?"array":typeof t=="boolean"?"boolean":typeof t=="number"?"number":typeof t=="string"?"string":typeof t=="object"?"object":"undefined"}function Un({children:e}){return D(zn,{children:e})}var Ft=xn(function({event:e,onBack:t,NetworkEventDetailViewComponent:r,networkDetailWrapper:a,RouteEventDetailComponent:o,detailComponents:n,onNavigate:i}){let l=wr(()=>({...Pn(),...n}),[n,qt()]),s=Nn[e.source],u=new Date(e.timestamp),{values:c,toggle:d}=Tn(),h=wr(()=>{if(!Vn(e.source)||!l.StorageEventDetailContent)return null;let p=e.originalEvent,g={...p,timestamp:new Date(p.timestamp)};return{key:g.data?.key||"unknown",lastEvent:g,events:[g],totalOperations:1,currentValue:g.data?.value,valueType:On(g.data?.value),storageTypes:new Set([g.storageType||"async"])}},[e,l]);if(h&&l.StorageEventDetailContent){let{StorageEventDetailContent:p}=l;return D(f,{style:B.container,testID:`${S}-detail-storage`,children:D(p,{conversation:h,selectedEventIndex:0,onEventIndexChange:()=>{},disableInternalFooter:true})})}if(e.source==="redux"&&l.ReduxActionDetailContent){let{ReduxActionDetailContent:p}=l,g=e.originalEvent;return D(f,{style:B.container,testID:`${S}-detail-redux`,children:D(p,{action:g,actions:[g],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:true})})}let b=r??l.NetworkEventDetailView;if(e.source==="network"&&b){let p=e.originalEvent,g=a??Un;return D(f,{style:B.container,children:D(g,{children:D(ue,{style:B.content,testID:`${S}-detail-network`,children:D(b,{event:p,ignoredPatterns:c,onTogglePattern:d})})})})}if(e.source==="react-query"||e.source==="react-query-query"||e.source==="react-query-mutation")return D(f,{style:B.container,testID:`${S}-detail-react-query`,children:D(Er,{event:e})});if(e.source==="zustand"&&l.ZustandStateDetailContent){let{ZustandStateDetailContent:p}=l,g=e.originalEvent;return D(f,{style:B.container,testID:`${S}-detail-zustand`,children:D(p,{change:g,changes:[g],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:true})})}if(e.source==="jotai"&&l.JotaiAtomDetailContent){let{JotaiAtomDetailContent:p}=l,g=e.originalEvent;return D(f,{style:B.container,testID:`${S}-detail-jotai`,children:D(p,{change:g,changes:[g],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:true})})}if(e.source==="render"&&l.RenderDetailView){let{RenderDetailView:p}=l,g=e.originalEvent;return D(f,{style:B.container,children:D(ue,{style:B.content,testID:`${S}-detail-render`,children:D(p,{render:g.render})})})}let v=o??l.RouteEventDetail;if(e.source==="route"&&v)return D(f,{style:B.container,children:D(f,{style:B.container,testID:`${S}-detail-route`,children:D(v,{event:e.originalEvent,onNavigate:i})})});let m=()=>e.originalEvent,y=async()=>{await kn({source:e.source,timestamp:u.toISOString(),title:e.title,subtitle:e.subtitle,data:m()})};return D(f,{style:B.container,testID:`${S}-detail`,children:Ue(ue,{style:B.content,contentContainerStyle:B.contentContainer,testID:`${S}-detail-scroll`,children:[D(f,{style:B.sourceBadgeRow,children:Ue(f,{style:[B.sourceBadge,{backgroundColor:s.color+"20"}],children:[D(f,{style:[B.sourceDot,{backgroundColor:s.color}]}),D(k,{style:[B.sourceLabel,{color:s.color}],testID:`${S}-detail-source`,children:s.label})]})}),D(k,{style:B.title,testID:`${S}-detail-title`,children:e.title}),D(k,{style:B.subtitle,testID:`${S}-detail-subtitle`,children:e.subtitle}),Ue(f,{style:B.timestampRow,children:[D(k,{style:B.timestampLabel,children:"Timestamp"}),Ue(k,{style:B.timestampValue,testID:`${S}-detail-timestamp`,children:[u.toLocaleTimeString()," (",$n(u),")"]})]}),Ue(f,{style:B.dataSection,children:[D(k,{style:B.sectionLabel,children:"Event Data"}),D(f,{style:B.dataContainer,testID:`${S}-detail-data`,children:D(An,{testIDPrefix:`${S}-detail-data`,data:m(),title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})})]})]})})}),B=le.create({container:{flex:1,backgroundColor:"transparent"},content:{flex:1},contentContainer:{padding:16},sourceBadgeRow:{flexDirection:"row",marginBottom:12},sourceBadge:{flexDirection:"row",alignItems:"center",paddingHorizontal:10,paddingVertical:6,borderRadius:12,gap:6},sourceDot:{width:6,height:6,borderRadius:3},sourceLabel:{fontSize:12,fontWeight:"600"},title:{fontSize:24,fontWeight:"700",color:ce.color.text,marginBottom:4},subtitle:{fontSize:16,color:ce.color.textTertiary,marginBottom:16},timestampRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,borderTopWidth:1,borderTopColor:ce.color.border,borderBottomWidth:1,borderBottomColor:ce.color.border,marginBottom:16},timestampLabel:{fontSize:14,color:ce.color.textTertiary},timestampValue:{fontSize:14,color:ce.color.text,fontFamily:In},dataSection:{marginTop:8},sectionLabel:{fontSize:12,fontWeight:"600",color:ce.color.textTertiary,textTransform:"uppercase",letterSpacing:.5,marginBottom:8},dataContainer:{backgroundColor:ce.color.surface,borderRadius:8,borderWidth:1,borderColor:ce.color.border,overflow:"hidden"}});import{useCallback as je,useEffect as Ln,useMemo as it,useState as Rt}from"react";import{DynamicFilterView as $r,macOSColors as Le,night as He,FileText as kr,FileCode as Dr,Hash as Hn,Zap as Jn,AlertTriangle as Wn,Settings as Kn,Eye as _n,XCircle as Tr,GitBranch as Ir,ToolbarCopyButton as Qn,useFeatureGate as Gn,ProFeatureBanner as Zn,ExportPreview as Yn,monoFont as Xn}from"@buoy-gg/shared-ui/web";import{DataViewer as ei}from"@buoy-gg/shared-ui/web/dataViewer";var Je={timestampFormat:"relative",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:true,includeTotalDuration:true,includeEventData:false,dataSizeThreshold:5,format:"markdown",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true},We={llm:{timestampFormat:"relative",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:true,includeTotalDuration:true,includeEventData:false,dataSizeThreshold:5,format:"markdown",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true},bugReport:{timestampFormat:"both",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:true,includeTotalDuration:true,includeEventData:true,dataSizeThreshold:10,format:"markdown",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true},json:{timestampFormat:"absolute",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:false,includeTotalDuration:false,includeEventData:true,dataSizeThreshold:-1,format:"json",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:false,showStorageDiff:false,stripVerboseFields:false},errors:{timestampFormat:"relative",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:true,includeCorrelation:true,includeDuration:true,includeSummaryHeader:true,includeTotalDuration:false,includeEventData:true,dataSizeThreshold:10,format:"markdown",filterMode:"errors",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true},minimal:{timestampFormat:"relative",includeSource:false,includeStatus:true,includeTitle:true,includeSubtitle:false,includeCorrelation:false,includeDuration:false,includeSummaryHeader:false,includeTotalDuration:false,includeEventData:false,dataSizeThreshold:1,format:"plaintext",filterMode:"all",filterSources:[],compactMode:true,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:false,stripVerboseFields:true},mermaid:{timestampFormat:"relative",includeSource:true,includeStatus:true,includeTitle:true,includeSubtitle:false,includeCorrelation:true,includeDuration:true,includeSummaryHeader:false,includeTotalDuration:false,includeEventData:false,dataSizeThreshold:1,format:"mermaid",filterMode:"all",filterSources:[],compactMode:false,smartJsonParsing:true,reduxChangedOnly:true,showStorageDiff:true,stripVerboseFields:true}};function Ar(e){for(let[t,r]of Object.entries(We))if(Object.keys(r).every(a=>{let o=e[a],n=r[a];return Array.isArray(o)&&Array.isArray(n)?o.length===n.length&&o.every((i,l)=>i===n[l]):o===n}))return t;return null}var P={llm:{label:"LLM",description:"AI-ready format",color:"#10B981"},bugReport:{label:"Bug Report",description:"Full context",color:"#EF4444"},json:{label:"JSON",description:"Machine-readable",color:"#F59E0B"},errors:{label:"Errors",description:"Failed only",color:"#EF4444"},minimal:{label:"Minimal",description:"Quick reference",color:"#6B7280"},mermaid:{label:"Diagram",description:"Visual flow",color:"#A855F7"}};var ze={success:"\u2705",pending:"\u23F3",error:"\u274C",neutral:"\u2796"},ti={success:"[OK]",pending:"[...]",error:"[ERR]",neutral:"[-]"},jt={"storage-async":"Storage","storage-mmkv":"MMKV",redux:"Redux",network:"Network","react-query":"Query","react-query-query":"Query","react-query-mutation":"Mutation",route:"Route",zustand:"Zustand",jotai:"Jotai",render:"Render"};function xe(e){if(typeof e!="string")return e;let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.parse(e)}catch{return e}}function $e(e){if(e==null)return e;if(typeof e=="string")return xe(e);if(Array.isArray(e))return e.map($e);if(typeof e=="object"){let t={};for(let[r,a]of Object.entries(e))t[r]=$e(a);return t}return e}var ri=new Set(["image","imageUrl","imageURL","image_url","thumbnail","thumbnailUrl","thumbnail_url","icon","iconUrl","avatar","avatarUrl","photo","photoUrl","picture","pictureUrl","description","desc","longDescription","shortDescription","meta_description"]);function zt(e){if(e==null)return e;if(Array.isArray(e))return e.map(zt);if(typeof e=="object"){let t={};for(let[r,a]of Object.entries(e))ri.has(r)||typeof a=="string"&&oi(a)||(t[r]=zt(a));return t}return e}function oi(e){if(!e.startsWith("http"))return false;let t=e.toLowerCase();return t.includes("/photo")||t.includes("/image")||t.includes("unsplash.com")||t.includes("cloudinary.com")||t.includes("imgur.com")||/\.(jpg|jpeg|png|gif|webp|svg|bmp)(\?|$)/i.test(e)}function ai(e){if(e instanceof Date)return e.toISOString();if(!(e&&typeof e=="object"&&Object.keys(e).length===0))return e}function ni(e,t){let r=s=>{if(typeof s!="object"||s===null)return null;let u=s;return typeof u.id=="string"?u.id:typeof u.orderId=="string"?u.orderId:typeof u.key=="string"?u.key:null},a=new Set(e.map(r).filter(Boolean)),o=new Set(t.map(r).filter(Boolean));if(a.size===0&&o.size===0)return null;let n=t.filter(s=>{let u=r(s);return u&&!a.has(u)}),i=e.filter(s=>{let u=r(s);return u&&!o.has(u)}),l=t.length-n.length;return n.length+i.length<e.length&&n.length+i.length<t.length?{added:n,removed:i,unchanged:l}:null}function ii(e,t){let r={};if(e.action&&(r.action=e.action),e.storageType&&(r.storageType=e.storageType),e.timestamp!==void 0){let a=ai(e.timestamp);a!==void 0&&(r.timestamp=a)}if(e.data){let a={...e.data};if(t.smartJsonParsing&&(a.value!==void 0&&(a.value=xe(a.value)),a.prevValue!==void 0&&(a.prevValue=xe(a.prevValue))),t.showStorageDiff&&Array.isArray(a.value)&&Array.isArray(a.prevValue)){let o=ni(a.prevValue,a.value);if(o){let n={key:a.key};return o.added.length>0&&(n.added=o.added),o.removed.length>0&&(n.removed=o.removed),o.unchanged>0&&(n.unchangedCount=o.unchanged),r.data=n,r}}r.data=a}return r}function si(e,t){if(!t.reduxChangedOnly)return t.smartJsonParsing?$e(e):e;let r={};if(e.type&&(r.type=e.type),e.payload&&(r.payload=t.smartJsonParsing?$e(e.payload):e.payload),e.sliceName&&(r.sliceName=e.sliceName),e.actionName&&(r.actionName=e.actionName),e.duration&&(r.duration=e.duration),e.hasStateChange!==void 0&&(r.hasStateChange=e.hasStateChange),e.diffSummary&&(r.diffSummary=e.diffSummary),e.changedKeysCount!==void 0&&(r.changedKeysCount=e.changedKeysCount),e.hasStateChange===true){let a=e.sliceName;if(a&&e.prevState&&e.nextState){let o=e.prevState,n=e.nextState;(o[a]!==void 0||n[a]!==void 0)&&(r.stateChange={slice:a,before:o[a],after:n[a]})}}return r}function qr(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.name=="string"?t.name:typeof t.id=="string"?t.id:typeof t.key=="string"?t.key:null}function Ke(e,t){let r=typeof e=="string"?xe(e):e,a=typeof t=="string"?xe(t):t;if(r==null&&a!==null&&a!==void 0)return"Created";if(r!=null&&a==null)return"Deleted";if(Array.isArray(r)&&Array.isArray(a)){let o=r.length,n=a.length,i=r.map(qr).filter(Boolean),l=a.map(qr).filter(Boolean);if(o===n&&o>0){let s=new Set(i),u=new Set(l),c=i.filter(d=>u.has(d));if(c.length===0&&i.length>0&&l.length>0)return`\u26A0\uFE0F Replaced: [${i.join(", ")}] \u2192 [${l.join(", ")}]`;if(c.length<o){let d=i.filter(b=>!u.has(b)),h=l.filter(b=>!s.has(b));return`Changed: -${d.join(", ")} +${h.join(", ")}`}}if(o===0&&n>0)return l.length>0?`Added: [${l.join(", ")}]`:`Added ${n} item${n>1?"s":""}`;if(o>0&&n===0)return i.length>0?`Removed all: [${i.join(", ")}]`:`Removed all ${o} item${o>1?"s":""}`;if(n>o){let s=new Set(i),u=l.filter(c=>!s.has(c));return u.length>0?`Added: [${u.join(", ")}] (${o} \u2192 ${n})`:`Added ${n-o} item${n-o>1?"s":""} (${o} \u2192 ${n})`}if(n<o){let s=new Set(l),u=i.filter(c=>!s.has(c));return u.length>0?`Removed: [${u.join(", ")}] (${o} \u2192 ${n})`:`Removed ${o-n} item${o-n>1?"s":""} (${o} \u2192 ${n})`}return`Updated (${n} item${n>1?"s":""})`}if(typeof r=="object"&&typeof a=="object"&&r&&a){let o=Object.keys(r),n=Object.keys(a),i=n.filter(s=>!o.includes(s)),l=o.filter(s=>!n.includes(s));return i.length>0&&l.length>0?`+${i.length} -${l.length} keys`:i.length>0?`Added: ${i.join(", ")}`:l.length>0?`Removed: ${l.join(", ")}`:"Updated"}return null}function li(e,t){let r={};if(e.id&&(r.id=e.id),e.type&&(r.type=e.type),e.timestamp&&(r.timestamp=e.timestamp),e.queryKey&&(r.queryKey=e.queryKey),e.mutationKey&&(r.mutationKey=e.mutationKey),e.mutationId&&(r.mutationId=e.mutationId),e.duration&&(r.duration=e.duration),e.queryData!==void 0&&(r.data=t.smartJsonParsing?$e(e.queryData):e.queryData),e.variables!==void 0&&(r.variables=t.smartJsonParsing?$e(e.variables):e.variables),e.queryError!==void 0){let a=e.queryError;a&&typeof a=="object"?r.error=a.message||a.name||a:r.error=e.queryError}if(e.mutationError!==void 0){let a=e.mutationError;a&&typeof a=="object"?r.error=a.message||a.name||a:r.error=e.mutationError}if(e.query&&typeof e.query=="object"){let a=e.query;if(a.state&&typeof a.state=="object"){let o=a.state;if(o.status&&(r.status=o.status),o.fetchStatus&&(r.fetchStatus=o.fetchStatus),o.error){let n=o.error;n&&typeof n=="object"&&(r.error=n.message||n.name||n)}}}if(e.mutation&&typeof e.mutation=="object"){let a=e.mutation;if(a.state&&typeof a.state=="object"){let o=a.state;if(o.status&&(r.status=o.status),o.failureCount&&(r.failureCount=o.failureCount),o.error){let n=o.error;n&&typeof n=="object"&&(r.error=n.message||n.name||n)}if(o.failureReason){let n=o.failureReason;n&&typeof n=="object"&&(r.failureReason=n.message||n.name||n)}}}return r}function st(e,t){let r=e.originalEvent;if(!r)return null;let a;return e.source==="storage-async"||e.source==="storage-mmkv"?a=ii(r,t):e.source==="redux"?a=si(r,t):e.source==="react-query"||e.source==="react-query-query"||e.source==="react-query-mutation"?a=li(r,t):t.smartJsonParsing?a=$e(r):a=r,t.stripVerboseFields&&a&&(a=zt(a)),a}function _e(e){let t={totalEvents:e.length,success:0,pending:0,error:0,neutral:0,durationMs:0,sources:new Set};if(e.length===0)return t;let r=1/0,a=-1/0;for(let o of e)t[o.status]++,t.sources.add(o.source),o.timestamp<r&&(r=o.timestamp),o.timestamp>a&&(a=o.timestamp);return t.durationMs=a-r,t}function Qe(e,t){let r=[...e];if(t.filterMode!=="all"&&(r=r.filter(a=>{switch(t.filterMode){case"errors":return a.status==="error";case"success":return a.status==="success";case"pending":return a.status==="pending";default:return true}})),t.filterSources.length>0){let a=new Set(t.filterSources);r=r.filter(o=>a.has(o.source))}return r}function Mt(e){return e<1e3?`+${e}ms`:e<6e4?`+${(e/1e3).toFixed(1)}s`:`+${(e/6e4).toFixed(1)}m`}function Br(e){return new Date(e).toISOString()}function lt(e,t,r){let a=Mt(e-t),o=Br(e);switch(r){case"relative":return a;case"absolute":return o;case"both":return`${a} (${o})`}}function Pt(e,t){let r=0,a=[e],o=new Set;for(;a.length>0;){if(r>t)return{over:true,approxBytes:r};let n=a.pop();if(n==null)r+=4;else if(typeof n=="string")r+=n.length+2;else if(typeof n=="number")r+=8;else if(typeof n=="boolean")r+=5;else if(typeof n=="object"){if(o.has(n))continue;if(o.add(n),Array.isArray(n)){r+=2+n.length;for(let i=0;i<n.length;i++)a.push(n[i])}else{r+=2;for(let i in n)r+=i.length+4,a.push(n[i])}}else r+=4}return{over:r>t,approxBytes:r}}function ut(e,t){if(t===-1)return{data:e,truncated:false};let{over:r,approxBytes:a}=Pt(e,t*1024);if(r)return{data:`[Data truncated - \u2265${(a/1024).toFixed(1)}KB exceeds ${t}KB limit]`,truncated:true};try{return JSON.stringify(e),{data:e,truncated:false}}catch{return{data:"[Unable to serialize data]",truncated:true}}}function Fr(e,t){let r=0;for(let a of e)if(t.includeSource&&(r+=20),t.includeStatus&&(r+=10),t.includeTitle&&(r+=(a.title?.length||0)+10),t.includeSubtitle&&(r+=(a.subtitle?.length||0)+10),t.includeCorrelation&&(r+=20),t.includeDuration&&(r+=15),r+=30,t.includeEventData&&a.originalEvent){let o=t.dataSizeThreshold===-1?1048576:t.dataSizeThreshold*1024,{approxBytes:n}=Pt(a.originalEvent,o);r+=Math.min(n,o)}return t.includeSummaryHeader&&(r+=100),t.includeTotalDuration&&(r+=50),t.format==="markdown"&&(r*=1.2),t.format==="json"&&(r*=1.3),Math.round(r)}function ui(e,t,r){let a=[],o=lt(e.timestamp,t,r.timestampFormat);if(a.push(`\`${o}\``),r.includeStatus&&a.push(ze[e.status]),r.includeSource&&a.push(`**${jt[e.source]}**`),r.includeTitle&&a.push(e.title),r.showStorageDiff&&(e.source==="storage-async"||e.source==="storage-mmkv")){let n=e.originalEvent;if(n?.data){let i=n.data,l=Ke(i.prevValue,i.value);l&&a.push(`\u2192 ${l}`)}}return e.source==="redux"&&e.originalEvent?.hasStateChange===false&&a.push("(no state change)"),r.includeSubtitle&&e.subtitle&&a.push(`- ${e.subtitle}`),a.join(" ")}function ci(e,t){let r=[],a=e.originalEvent;if(!a?.data)return r;let o=a.data,n=t.smartJsonParsing?xe(o.prevValue):o.prevValue,i=t.smartJsonParsing?xe(o.value):o.value,l=Ke(o.prevValue,o.value);if(l&&r.push(` **Change:** ${l}`),Array.isArray(n)&&Array.isArray(i)){let s=n.map(c=>typeof c=="object"&&c&&"name"in c?c.name:null).filter(Boolean),u=i.map(c=>typeof c=="object"&&c&&"name"in c?c.name:null).filter(Boolean);(s.length>0||u.length>0)&&(s.length>0&&r.push(` Before: [${s.join(", ")}]`),r.push(` After: [${u.join(", ")}]`))}return r}function Nt(e,t){let r=Qe(e,t);if(r.length===0)return"No events to export.";let a=[...r].sort((s,u)=>s.timestamp-u.timestamp),o=a[0].timestamp,n=_e(a),i=[];if(i.push("## Event Flow"),t.includeSummaryHeader||t.includeTotalDuration){let s=[];if(t.includeTotalDuration&&s.push(`**Duration:** ${Mt(n.durationMs).replace("+","")}`),s.push(`**Events:** ${n.totalEvents}`),t.includeSummaryHeader){let u=[];n.success>0&&u.push(`${n.success} ${ze.success}`),n.pending>0&&u.push(`${n.pending} ${ze.pending}`),n.error>0&&u.push(`${n.error} ${ze.error}`),n.neutral>0&&u.push(`${n.neutral} ${ze.neutral}`),u.length>0&&s.push(`**Status:** ${u.join(" ")}`)}i.push(s.join(" | "))}if(i.push(""),i.push("### Timeline"),i.push(""),t.compactMode)return a.forEach((s,u)=>{i.push(`${u+1}. ${ui(s,o,t)}`)}),i.join(`
|
|
4
|
+
`);a.forEach((s,u)=>{let c=[],d=lt(s.timestamp,o,t.timestampFormat);if(c.push(`${u+1}. \`${d}\``),t.includeStatus&&c.push(ze[s.status]),t.includeSource&&c.push(`**${jt[s.source]}**`),t.includeTitle&&c.push(s.title),t.includeCorrelation&&s.correlationId&&s.sequenceInGroup&&c.push(`(${s.sequenceInGroup})`),i.push(c.join(" ")),t.includeSubtitle&&s.subtitle&&i.push(` \u2514\u2500 ${s.subtitle}`),t.showStorageDiff&&!t.includeEventData&&(s.source==="storage-async"||s.source==="storage-mmkv")){let h=ci(s,t);i.push(...h)}if(t.includeEventData&&s.originalEvent){let h=st(s,t),{data:b,truncated:v}=ut(h,t.dataSizeThreshold);if(v)i.push(` \u2514\u2500 ${b}`);else{if(t.showStorageDiff&&(s.source==="storage-async"||s.source==="storage-mmkv")){let m=s.originalEvent;if(m?.data){let y=m.data,p=Ke(y.prevValue,y.value);p&&i.push(` **Change:** ${p}`)}}i.push(" ```json"),i.push(` ${JSON.stringify(b,null,2).split(`
|
|
5
5
|
`).join(`
|
|
6
6
|
`)}`),i.push(" ```")}}i.push("")});let l=a.filter(s=>s.status==="error");if(l.length>0&&t.includeEventData){i.push("---"),i.push(""),i.push("### Errors"),i.push("");for(let s of l){let u=lt(s.timestamp,o,t.timestampFormat);if(i.push(`**${s.title}** (${u})`),s.originalEvent){let c=st(s,t),{data:d,truncated:h}=ut(c,t.dataSizeThreshold);h||(i.push("```json"),i.push(JSON.stringify(d,null,2)),i.push("```"))}i.push("")}}return i.join(`
|
|
7
|
-
`)}function Rr(e,t){let r=Qe(e,t);if(r.length===0)return"[]";let a=[...r].sort((l,s)=>l.timestamp-s.timestamp),o=a[0].timestamp,n=_e(a),i={exportedAt:new Date().toISOString()};return t.includeSummaryHeader&&(i.summary={totalEvents:n.totalEvents,success:n.success,pending:n.pending,error:n.error,neutral:n.neutral,durationMs:n.durationMs,sources:Array.from(n.sources)}),i.events=a.map(l=>{let s={};if(s.timestamp=Br(l.timestamp),(t.timestampFormat==="relative"||t.timestampFormat==="both")&&(s.relativeMs=l.timestamp-o),t.includeSource&&(s.source=l.source),t.includeStatus&&(s.status=l.status),t.includeTitle&&(s.title=l.title),t.includeSubtitle&&(s.subtitle=l.subtitle),t.includeCorrelation&&l.correlationId&&(s.correlationId=l.correlationId,s.sequenceInGroup=l.sequenceInGroup),t.includeEventData&&l.originalEvent){let u=st(l,t),{data:c,truncated:d}=ut(u,t.dataSizeThreshold);if(s.data=c,d&&(s.dataTruncated=true),t.showStorageDiff&&(l.source==="storage-async"||l.source==="storage-mmkv")){let h=l.originalEvent;if(h?.data){let b=h.data,v=Ke(b.prevValue,b.value);v&&(s.changeSummary=v)}}}return s}),JSON.stringify(i,null,2)}function jr(e,t){let r=Qe(e,t);if(r.length===0)return"No events to export.";let a=[...r].sort((l,s)=>l.timestamp-s.timestamp),o=a[0].timestamp,n=_e(a),i=[];if(t.includeSummaryHeader||t.includeTotalDuration){let l=[`Event Flow (${n.totalEvents} events`];if(t.includeTotalDuration&&(l[0]+=`, ${
|
|
8
|
-
`)}var
|
|
7
|
+
`)}function Rr(e,t){let r=Qe(e,t);if(r.length===0)return"[]";let a=[...r].sort((l,s)=>l.timestamp-s.timestamp),o=a[0].timestamp,n=_e(a),i={exportedAt:new Date().toISOString()};return t.includeSummaryHeader&&(i.summary={totalEvents:n.totalEvents,success:n.success,pending:n.pending,error:n.error,neutral:n.neutral,durationMs:n.durationMs,sources:Array.from(n.sources)}),i.events=a.map(l=>{let s={};if(s.timestamp=Br(l.timestamp),(t.timestampFormat==="relative"||t.timestampFormat==="both")&&(s.relativeMs=l.timestamp-o),t.includeSource&&(s.source=l.source),t.includeStatus&&(s.status=l.status),t.includeTitle&&(s.title=l.title),t.includeSubtitle&&(s.subtitle=l.subtitle),t.includeCorrelation&&l.correlationId&&(s.correlationId=l.correlationId,s.sequenceInGroup=l.sequenceInGroup),t.includeEventData&&l.originalEvent){let u=st(l,t),{data:c,truncated:d}=ut(u,t.dataSizeThreshold);if(s.data=c,d&&(s.dataTruncated=true),t.showStorageDiff&&(l.source==="storage-async"||l.source==="storage-mmkv")){let h=l.originalEvent;if(h?.data){let b=h.data,v=Ke(b.prevValue,b.value);v&&(s.changeSummary=v)}}}return s}),JSON.stringify(i,null,2)}function jr(e,t){let r=Qe(e,t);if(r.length===0)return"No events to export.";let a=[...r].sort((l,s)=>l.timestamp-s.timestamp),o=a[0].timestamp,n=_e(a),i=[];if(t.includeSummaryHeader||t.includeTotalDuration){let l=[`Event Flow (${n.totalEvents} events`];if(t.includeTotalDuration&&(l[0]+=`, ${Mt(n.durationMs).replace("+","")}`),l[0]+=")",i.push(l[0]),t.includeSummaryHeader){let s=[];n.success>0&&s.push(`${n.success} success`),n.pending>0&&s.push(`${n.pending} pending`),n.error>0&&s.push(`${n.error} error`),n.neutral>0&&s.push(`${n.neutral} neutral`),s.length>0&&i.push(s.join(", "))}i.push("")}for(let l of a){let s=[],u=lt(l.timestamp,o,t.timestampFormat);if(s.push(u.padEnd(12)),t.includeStatus&&s.push(ti[l.status]),t.includeSource&&s.push(`${jt[l.source]}:`),t.includeTitle&&s.push(l.title),t.showStorageDiff&&(l.source==="storage-async"||l.source==="storage-mmkv")){let c=l.originalEvent;if(c?.data){let d=c.data,h=Ke(d.prevValue,d.value);h&&s.push(`-> ${h}`)}}if(l.source==="redux"&&l.originalEvent?.hasStateChange===false&&s.push("(no change)"),t.includeSubtitle&&l.subtitle&&s.push(`- ${l.subtitle}`),i.push(s.join(" ")),t.includeEventData&&l.originalEvent){let c=st(l,t),{data:d,truncated:h}=ut(c,t.dataSizeThreshold);h?i.push(` ${d}`):i.push(` Data: ${JSON.stringify(d)}`)}}return i.join(`
|
|
8
|
+
`)}var Vt=[{id:"U",icon:"\u{1F464}",label:"User",sources:[],group:"client"},{id:"App",icon:"\u{1F4F1}",label:"App",sources:["route","render"],group:"client"},{id:"Async",icon:"\u{1F4BE}",label:"AsyncStorage",sources:["storage-async"],group:"client"},{id:"MMKV",icon:"\u26A1",label:"MMKV",sources:["storage-mmkv"],group:"client"},{id:"Redux",icon:"\u{1F504}",label:"Redux",sources:["redux"],group:"client"},{id:"API",icon:"\u{1F310}",label:"API",sources:["network"],group:"server"},{id:"Cache",icon:"\u{1F4E6}",label:"QueryCache",sources:["react-query","react-query-query","react-query-mutation"],group:"server"}];function di(e){let t=new Set;for(let a of e)t.add(a.source);let r=[];r.push(Vt[0]),r.push(Vt[1]);for(let a of Vt.slice(2))a.sources.some(o=>t.has(o))&&r.push(a);return r}function pi(e){let t=e.some(a=>a.group==="client"),r=e.some(a=>a.group==="server");return t&&r&&e.length>=3}function ke(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${(e/6e4).toFixed(1)}m`}function Ge(e){return e.replace(/[#;:]/g," ").replace(/[\n\r]/g," ").replace(/"/g,"'").replace(/\s+/g," ").trim()}function mi(e){let t=["last-route","@dev/last","__debug","_persist","devtools/internal"],r=e.toLowerCase();return t.some(a=>r.includes(a))}function Ot(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function hi(e){return Pt(e,1024*1024).approxBytes}function gi(e){try{let t=new URL(e,"http://localhost");return["timestamp","t","_t","debug","client","version","cache","_"].forEach(r=>t.searchParams.delete(r)),t.pathname+(t.searchParams.toString()?"?"+t.searchParams.toString():"")}catch{return e}}function fi(e){let t=e.replace(/^@[\w-]+\//,"").replace(/^devtools\//,"").replace(/^dev\//,"").replace(/^buoy\//,"").replace(/^pokemon\//,""),r=t.split("/").filter(Boolean);return r.length>1&&(t=r.slice(-1).join("/")),t=t.replace(/-/g," ").replace(/_/g," "),t=t.split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1).toLowerCase()).join(" "),t.toLowerCase()==="saved"&&(t="Favorites"),t.substring(0,20)}function zr(e){let t=e;try{t=new URL(e,"http://localhost").pathname}catch{let a=t.indexOf("?");a>0&&(t=t.substring(0,a))}let r=t.split("/").filter(Boolean);if(r.length>=2){let a=r[r.length-1];return/^\d+$/.test(a)||/^[a-f0-9-]{36}$/i.test(a)?null:a.charAt(0).toUpperCase()+a.slice(1)}return r.length===1?r[0].charAt(0).toUpperCase()+r[0].slice(1):null}function yi(e,t){try{let r=new URL(t,"http://localhost"),a=r.pathname;if(a.includes("graphql"))return"GraphQL Request";a=a.replace(/^\/api\/v\d+/,"").replace(/^\/api/,"");let o=zr(a),n=a.split("/").filter(Boolean),i=n[0]?n[0].charAt(0).toUpperCase()+n[0].slice(1):"Data",l=r.searchParams.has("q")||r.searchParams.has("query")||r.searchParams.has("search");switch(e.toUpperCase()){case"GET":if(l){let s=r.searchParams.get("q")||r.searchParams.get("query")||r.searchParams.get("search");return s?`Search "${s}"`:`Search ${i}`}return o?`Fetch ${o}`:`Fetch ${i}`;case"POST":return a.includes("search")?`Search ${i}`:o?`Create ${o}`:`Create ${i}`;case"PUT":case"PATCH":return o?`Update ${o}`:`Update ${i}`;case"DELETE":return o?`Delete ${o}`:`Delete ${i}`;default:return`${e} ${i}`}}catch{return`${e} request`}}function Mr(e){if(e==="/"||e==="")return"Home";let t=e.split("/").filter(Boolean);if(t.length===0)return"Home";if(t.length===1)return`${t[0].charAt(0).toUpperCase()+t[0].slice(1)} List`;if(t.length>=2){let r=t[t.length-1];return/^\d+$/.test(r)?`${t[0].charAt(0).toUpperCase()+t[0].slice(1)} #${r}`:`${r.charAt(0).toUpperCase()+r.slice(1)} Details`}return e}function bi(e,t,r){let a=[],o=[],n=ke(e.timestamp-r);switch(e.source){case"route":{let i=e.originalEvent,l=String(i?.pathname||e.title),s=i?.previousPathname,u=i?.timeSincePrevious,c=Mr(l),d=s?Mr(s):null;d?(a.push(`U->>App: ${d} \u2192 ${c}`),u&&u>0&&o.push(`Note right of App: ${ke(u)} on ${d}`)):a.push(`U->>App: Open ${c}`);break}case"network":{let i=e.originalEvent,l=i?.method||"GET",s=i?.url||"",u=i?.status,c=i?.duration,d=i?.response||i?.data||i?.body,h=i?.responseSize||i?.size||i?.contentLength,b=yi(l,s),v=zr(s);if(a.push(`App->>+API: ${b}`),e.status==="error"){let y=u?`${u} Error`:"Failed";a.push(`API--x-App: ${y}`)}else{let y=v?`\u2713 ${v}`:"\u2713 Success";a.push(`API-->>-App: ${y}`)}let m=[];if(c&&m.push(ke(c)),h&&h>0)m.push(Ot(h));else if(d){let y=hi(d);y>1024&&m.push(Ot(y))}m.length>0&&o.push(`Note right of API: ${m.join(" \xB7 ")}`);break}case"storage-async":case"storage-mmkv":{let i=e.originalEvent,l=i?.data,s=i?.action||"access",u=l?.key||"data";if(mi(u))return{messages:[],notes:[],skip:true};let c=fi(u),d=e.source==="storage-mmkv"?"MMKV":"Async",h=C=>{if(typeof C=="string")return C;if(typeof C=="number")return String(C);if(typeof C=="object"&&C){if("name"in C)return String(C.name);if("id"in C)return String(C.id)}return null},b=C=>C.charAt(0).toUpperCase()+C.slice(1),v="",m="",y="",p="",g=l?.prevValue,$=l?.value;if(Array.isArray(g)&&Array.isArray($)){let C=g.length,I=$.length;if(p=`${C} \u2192 ${I} items`,I>C){v="\u2795",m="Add";let x=new Set(g.map(h).filter(Boolean));for(let j of $){let N=h(j);if(N&&!x.has(N)){y=b(N);break}}}else if(I<C){v="\u2796",m="Remove";let x=new Set($.map(h).filter(Boolean));for(let j of g){let N=h(j);if(N&&!x.has(N)){y=b(N);break}}}else v="\u{1F4DD}",m="Update"}else if(Array.isArray($)&&(!g||Array.isArray(g)&&g.length===0)){if(v="\u2795",m="Add",p=`\u2192 ${$.length} items`,$.length>0){let C=h($[0]);C&&(y=b(C))}}else Array.isArray(g)&&(!$||Array.isArray($)&&$.length===0)?(v="\u2796",m="Clear",p=`${g.length} \u2192 0 items`):s==="getItem"?(v="\u{1F4D6}",m="Load"):s==="removeItem"?(v="\u2796",m="Remove"):s==="clear"?(v="\u{1F5D1}\uFE0F",m="Clear"):(v="\u{1F4BE}",m="Save");let L;y?L=`App->>${d}: ${v} ${m} ${y} \u2192 ${c}`:L=`App->>${d}: ${v} ${m} ${c}`,a.push(L),p&&o.push(`Note right of ${d}: ${p}`);break}case"react-query":case"react-query-query":{let i=e.originalEvent,l=i?.type||"",s=i?.queryKey,u=i?.duration,c="data";if(Array.isArray(s)&&s.length>0){let d=s[s.length-1];typeof d=="string"&&!/^\d+$/.test(d)?c=d.charAt(0).toUpperCase()+d.slice(1):s.length>1&&typeof s[0]=="string"&&(c=s[0].charAt(0).toUpperCase()+s[0].slice(1))}if(l.includes("start")||l.includes("fetch")||e.status==="pending")a.push(`App->>+Cache: Fetch ${c}`);else if(e.status==="error")a.push("Cache--x-App: Failed to load");else if(e.status==="success"){let d=`\u2713 ${c} ready`;u&&(d+=` (${ke(u)})`),a.push(`Cache-->>-App: ${d}`)}else l.includes("invalidate")?a.push(`App->>Cache: Refresh ${c}`):a.push(`Cache-->>App: ${Ge(l)}`);break}case"react-query-mutation":{let i=e.originalEvent,l=i?.type||"",s=i?.mutationKey,u=i?.duration,c="Update";if(Array.isArray(s)&&s.length>0){let d=String(s[0]);d.includes("add")||d.includes("create")?c="Add":d.includes("delete")||d.includes("remove")?c="Delete":d.includes("update")||d.includes("edit")?c="Update":c=d.charAt(0).toUpperCase()+d.slice(1)}if(l.includes("start")||l.includes("loading")||e.status==="pending")a.push(`App->>+Cache: ${c}`);else if(e.status==="error")a.push(`Cache--x-App: ${c} failed`);else if(e.status==="success"){let d=`\u2713 ${c} complete`;u&&(d+=` (${ke(u)})`),a.push(`Cache-->>-App: ${d}`)}break}case"redux":{let i=e.originalEvent,l=i?.type||e.title,s=i?.hasStateChange,u=i?.diffSummary,c=l.split("/"),d;if(c.length>=2){let h=c[0].charAt(0).toUpperCase()+c[0].slice(1),b=c[1].replace(/([A-Z])/g," $1").replace(/(pending|fulfilled|rejected)$/i,"").trim();b=b.charAt(0).toUpperCase()+b.slice(1),d=`${b} (${h})`}else d=Ge(l).substring(0,25);a.push(`App->>Redux: ${d}`),s===false?o.push("Note right of Redux: No change"):u&&o.push(`Note right of Redux: ${Ge(u).substring(0,35)}`);break}case"render":{let i=e.originalEvent?.renderData,l=Ge(e.title).substring(0,20),s=i?.cause||"update",u=s==="mount"?"mounted":s==="props"?"props changed":s==="state"?"state changed":s==="context"?"context changed":s==="parent"?"parent re-rendered":s==="hooks"?"hook changed":s;a.push(`App->>App: Render ${l}`),o.push(`Note right of App: ${u}`);break}default:a.push(`App->>App: ${Ge(e.title).substring(0,30)}`)}return{messages:a,notes:o}}function Pr(e,t){let r=Qe(e,t);if(r.length===0)return`sequenceDiagram
|
|
9
9
|
participant U as \u{1F464} User
|
|
10
10
|
participant App as \u{1F4F1} App
|
|
11
|
-
Note over U,App: No events captured`;let a=[...r].sort((
|
|
12
|
-
`)}function Ot(e,t){switch(t.format){case"markdown":return Pt(e,t);case"json":return Rr(e,t);case"plaintext":return jr(e,t);case"mermaid":return Pr(e,t);default:return Pt(e,t)}}import{definePersistedSetting as bi,devToolsStorageKeys as vi}from"@buoy-gg/shared-ui/web";var Ut=bi(vi.events.copySettings(),Je,{sanitize:(e,t)=>({...e,filterSources:t?.filterSources??Je.filterSources})});async function Nr(e){await Ut.save(e)}async function Vr(){return Ut.loadOrNull()}async function Si(){await Ut.clear()}import{Fragment as Ci,jsx as ae,jsxs as Lt}from"react/jsx-runtime";var wi=50*1024,Ei=200*1024;function xi(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function $i(){let e=Date.now();return[{id:"mock-1",source:"storage-async",timestamp:e-2e3,title:"Set Item",subtitle:"user_cart",status:"success",originalEvent:{action:"setItem",key:"user_cart",value:{items:2}}},{id:"mock-2",source:"react-query-query",timestamp:e-1500,title:"cart \u203A items",subtitle:"Fetching...",status:"pending",originalEvent:{type:"query-fetch-start",queryKey:["cart","items"]},correlationId:"rq-query-cart",sequenceInGroup:1},{id:"mock-3",source:"react-query-query",timestamp:e-1e3,title:"cart \u203A items",subtitle:"Success \xB7 500ms",status:"success",originalEvent:{type:"query-fetch-success",queryKey:["cart","items"],data:{items:[]}},correlationId:"rq-query-cart",sequenceInGroup:2},{id:"mock-4",source:"network",timestamp:e-500,title:"POST /api/checkout",subtitle:"402 \xB7 450ms",status:"error",originalEvent:{method:"POST",url:"/api/checkout",status:402,error:"Payment required"}}]}function Or({events:e=[],initialSettings:t=Je,onSettingsChange:r}){let{isPro:a}=Qn(),[o,n]=Ft(t),[i,l]=Ft(false),[s,u]=Ft(false);Un(()=>{let I=true;return Vr().then(x=>{I&&x&&(n(x),r?.(x)),I&&u(true)}),()=>{I=false}},[r]);let c=je(I=>{n(I),r?.(I),Nr(I)},[r]),d=e.length>0,h=d?e:$i(),b=it(()=>Ar(o),[o]),v=it(()=>Fr(h,o),[h,o]),p=it(()=>v>=Ei?"danger":v>=wi?"warning":"none",[v]),y=je(()=>Ot(h,o),[h,o]),m=je(I=>{let x=We[I];c({...x,filterSources:[...x.filterSources]})},[c]),g=je((I,x)=>{let[j,N]=I.split("::");if(j==="preset"){m(N);return}if(j==="include"){c({...o,[N]:!o[N]});return}if(j==="format"){c({...o,format:x});return}if(j==="timestamp"){c({...o,timestampFormat:x});return}if(j==="filter"){c({...o,filterMode:x});return}if(j==="threshold"){c({...o,dataSizeThreshold:x});return}},[o,c,m]),$=je(()=>{let I=h.length;return ae(Zn,{expanded:i,onExpandedChange:l,summary:`${I} event${I!==1?"s":""} \xB7 ~${xi(v)}${d?"":" (mock data)"}`,warningLevel:p,warningText:{warning:"Large payload - preview may be slow",danger:"Very large payload - may cause performance issues"},testIDs:{expand:`${S}-preview-expand`,collapse:`${S}-preview-collapse`,summary:`${S}-preview-summary`,warning:`${S}-preview-size-warning`},renderBody:()=>{let x=y();return o.format==="json"?ae(Xn,{testIDPrefix:`${S}-preview-json`,data:JSON.parse(x),title:"",showTypeFilter:true,rawMode:true,initialExpanded:true}):Lt(f,{children:[o.format==="mermaid"&&ae(k,{style:De.mermaidHint,children:"\u{1F4A1} Paste into mermaid.live to visualize"}),ae(ue,{style:De.previewScroll,nestedScrollEnabled:true,testID:`${S}-preview-scroll`,children:ae(k,{style:De.previewText,selectable:a,testID:`${S}-preview-text`,children:x})})]})}})},[i,h,o,v,p,d,y,a]),U=je(()=>{let I=_e(h),x=d?`${I.totalEvents} events`:"Mock data (no events captured)";return Lt(Ci,{children:[ae(k,{style:De.statusLabel,testID:`${S}-export-status`,children:x}),ae(_n,{value:y()})]})},[d,h,y]),C=it(()=>({sections:[{id:"presets",title:"Presets",type:"custom",data:[{id:"preset::llm",label:P.llm.label,icon:Hn,color:P.llm.color,value:"llm",isActive:b==="llm",description:P.llm.description},{id:"preset::bugReport",label:P.bugReport.label,icon:Jn,color:P.bugReport.color,value:"bugReport",isActive:b==="bugReport",description:P.bugReport.description},{id:"preset::json",label:P.json.label,icon:Dr,color:P.json.color,value:"json",isActive:b==="json",description:P.json.description},{id:"preset::errors",label:P.errors.label,icon:Tr,color:P.errors.color,value:"errors",isActive:b==="errors",description:P.errors.description},{id:"preset::minimal",label:P.minimal.label,icon:kr,color:P.minimal.color,value:"minimal",isActive:b==="minimal",description:P.minimal.description},{id:"preset::mermaid",label:P.mermaid.label,icon:Ir,color:P.mermaid.color,value:"mermaid",isActive:b==="mermaid",description:P.mermaid.description},{id:"preset::custom",label:"Custom",icon:Wn,color:He.color.textSecondary,value:"custom",isActive:b===null,description:"User-configured"}]},{id:"include",title:"Include",type:"custom",data:[{id:"include::includeSource",label:"Source",value:"includeSource",isActive:o.includeSource},{id:"include::includeStatus",label:"Status",value:"includeStatus",isActive:o.includeStatus},{id:"include::includeTitle",label:"Title",value:"includeTitle",isActive:o.includeTitle},{id:"include::includeSubtitle",label:"Subtitle",value:"includeSubtitle",isActive:o.includeSubtitle},{id:"include::includeCorrelation",label:"Correlation",value:"includeCorrelation",isActive:o.includeCorrelation},{id:"include::includeDuration",label:"Duration",value:"includeDuration",isActive:o.includeDuration},{id:"include::includeSummaryHeader",label:"Summary",value:"includeSummaryHeader",isActive:o.includeSummaryHeader},{id:"include::includeEventData",label:"Data",value:"includeEventData",isActive:o.includeEventData}]},{id:"format",title:"Format",type:"custom",data:[{id:"format::markdown",label:"Markdown",icon:kr,color:Le.semantic.info,value:"markdown",isActive:o.format==="markdown"},{id:"format::json",label:"JSON",icon:Dr,color:Le.semantic.warning,value:"json",isActive:o.format==="json"},{id:"format::plaintext",label:"Text",icon:Ln,color:He.color.textSecondary,value:"plaintext",isActive:o.format==="plaintext"},{id:"format::mermaid",label:"Diagram",icon:Ir,color:"#A855F7",value:"mermaid",isActive:o.format==="mermaid",description:"Mermaid sequence diagram"}]},{id:"timestamp",title:"Timestamps",type:"custom",data:[{id:"timestamp::relative",label:"Relative",value:"relative",isActive:o.timestampFormat==="relative",description:"+0ms, +150ms"},{id:"timestamp::absolute",label:"Absolute",value:"absolute",isActive:o.timestampFormat==="absolute",description:"ISO format"},{id:"timestamp::both",label:"Both",value:"both",isActive:o.timestampFormat==="both",description:"Both formats"}]},{id:"filter",title:"Filter Events",type:"custom",data:[{id:"filter::all",label:"All",value:"all",isActive:o.filterMode==="all"},{id:"filter::errors",label:"Errors",icon:Tr,color:Le.semantic.error,value:"errors",isActive:o.filterMode==="errors"},{id:"filter::success",label:"Success",color:Le.semantic.success,value:"success",isActive:o.filterMode==="success"},{id:"filter::pending",label:"Pending",color:Le.semantic.warning,value:"pending",isActive:o.filterMode==="pending"}]},{id:"llmOptimization",title:"LLM Optimization",type:"custom",data:[{id:"include::compactMode",label:"Compact",value:"compactMode",isActive:o.compactMode,description:"One line per event"},{id:"include::smartJsonParsing",label:"Smart JSON",value:"smartJsonParsing",isActive:o.smartJsonParsing,description:"Parse nested JSON"},{id:"include::reduxChangedOnly",label:"Redux Diff",value:"reduxChangedOnly",isActive:o.reduxChangedOnly,description:"Only show changes"},{id:"include::showStorageDiff",label:"Storage Diff",value:"showStorageDiff",isActive:o.showStorageDiff,description:"Show what changed"},{id:"include::stripVerboseFields",label:"Strip Noise",value:"stripVerboseFields",isActive:o.stripVerboseFields,description:"Remove images/descriptions"}]}],previewSection:{enabled:true,title:"PREVIEW",icon:Kn,content:$,headerActions:U},onFilterChange:g}),[o,b,g,$,U]);return a?ae($r,{...C}):Lt(ue,{style:De.gatedContainer,contentContainerStyle:De.gatedContent,testID:`${S}-copy-settings-gated`,children:[ae(Gn,{featureName:"Events Export",description:"Export event flows to share with your team, debug issues, or feed into AI tools.",benefits:["Export to Markdown, JSON, or plain text","Customizable presets (LLM-ready, Bug Report, JSON)","Share event flows with teammates","Feed event context directly to AI assistants"]}),ae(f,{style:De.gatedPreview,children:ae($r,{...C})})]})}var De=le.create({previewScroll:{maxHeight:300},previewText:{fontFamily:Yn,fontSize:11,color:He.color.text,lineHeight:18},mermaidHint:{fontSize:11,color:He.color.textSecondary,marginBottom:8,paddingHorizontal:8,paddingVertical:6,backgroundColor:"#A855F715",borderRadius:6,overflow:"hidden"},statusLabel:{fontSize:11,fontWeight:"600",color:He.color.textTertiary,marginRight:8},gatedContainer:{flex:1},gatedContent:{padding:12,gap:12},gatedPreview:{}});import{TickProvider as Ur}from"@buoy-gg/shared-ui/web";import{Fragment as ct,jsx as A,jsxs as ie}from"react/jsx-runtime";function Ht({visible:e,onClose:t,onBack:r,onMinimize:a,enableSharedModalDimensions:o=false,inline:n=false,capturing:i,onCapturingChange:l,networkDetailWrapper:s,NetworkEventDetailViewComponent:u,RouteEventDetailComponent:c,detailComponents:d}){let h=ha(),b=i!=null&&l!=null,{filteredEvents:v,availableSources:p,toggleSource:y,clearEvents:m,totalCount:g,filteredCount:$,isCapturing:U,toggleCapturing:C,hiddenEventsCount:I,searchText:x,setSearchText:j}=wt(b?{capturingOverride:i}:void 0),N=b?i:U,pe=b?()=>l(!i):C,[K,he]=ot("list"),[_,Xe]=ot(null),[pt,et]=ot(false),[Te,Ve]=ot(false),ht=aa(null);oa(()=>{if(!Te)return;let G=requestAnimationFrame(()=>{ht.current?.focus()});return()=>cancelAnimationFrame(G)},[Te]);let gt=Ae(()=>{Ve(false),j("")},[j]),tt=Ae(G=>{try{h.push(G)}catch(ft){Gt.alert("Navigation Error",String(ft))}},[h]),w=Ae(G=>{Xe(G),he("detail")},[]),F=Ae(()=>{K==="detail"?(Xe(null),he("list")):K==="copySettings"&&he("list")},[K]),z=Ae(()=>{he("copySettings")},[]),Q=Ae(G=>{},[]),q=o?ca.modal.root():"buoy-events-modal";if(!e)return null;let R=()=>{if(K==="detail"&&_){let G={source:_.source,title:_.title,subtitle:_.subtitle,status:_.status,timestamp:new Date(_.timestamp).toISOString(),data:_.originalEvent};return ie(Y,{children:[A(Y.Navigation,{onBack:F}),A(Y.Content,{title:_.title,testID:`${S}-detail-heading`}),A(Y.Actions,{children:A(da,{value:G})})]})}return K==="copySettings"?ie(Y,{children:[A(Y.Navigation,{onBack:F}),A(Y.Content,{title:"Copy Settings",testID:`${S}-copy-settings-heading`})]}):ie(Y,{children:[r&&A(Y.Navigation,{onBack:r}),A(Y.Content,{title:"",children:Te?A(Y.Search,{value:x,onChangeText:j,onCancel:gt,placeholder:"Search events...",accessibilityLabel:"Search events",iconSize:14,testID:`${S}-search-field`,containerTestID:`${S}-search`,clearTestID:`${S}-search-clear`,onBlur:()=>{x.length===0&&Ve(false)}}):ie(f,{style:te.headerTitleContainer,children:[A(k,{style:te.headerTitle,testID:`${S}-title`,children:"Events"}),ie(k,{style:te.headerSubtitle,testID:`${S}-count`,children:[g," captured"]})]})}),ie(Y.Actions,{children:[!Te&&A(ge,{onPress:()=>Ve(true),style:[te.headerActionButton,x.length>0&&te.headerActionButtonActive],testID:`${S}-search-open`,accessibilityRole:"button",accessibilityLabel:"Search events",children:A(ua,{size:14,color:x.length>0?X.color.accent:X.color.textSecondary})}),A(ge,{onPress:z,style:[te.headerActionButton,g===0&&te.headerActionButtonDisabled],disabled:g===0,testID:`${S}-copy`,accessibilityRole:"button",accessibilityLabel:"Copy events",children:A(la,{size:14,color:g>0?X.color.textSecondary:X.color.textTertiary})}),A(pa,{isEnabled:N,onToggle:pe,testID:`${S}-power`,accessibilityLabel:"Toggle event capture"}),A(ge,{onPress:m,style:[te.headerActionButton,g===0&&te.headerActionButtonDisabled],disabled:g===0,testID:`${S}-clear`,accessibilityRole:"button",accessibilityLabel:"Clear events",children:A(sa,{size:14,color:g>0?X.color.textSecondary:X.color.textTertiary})})]})]})},ne=A(f,{style:te.container,children:K==="copySettings"?A(Or,{events:v}):K==="detail"&&_?A(Bt,{event:_,onBack:F,onNavigate:tt,networkDetailWrapper:s,NetworkEventDetailViewComponent:u,RouteEventDetailComponent:c,detailComponents:d}):ie(ct,{children:[A(xt,{availableSources:p,onToggleSource:y,totalCount:g,filteredCount:$}),A(It,{events:v,selectedEventId:void 0,expandedEventId:void 0,onEventPress:w,onNavigate:tt,isCapturing:N,hiddenEventsCount:I,searchText:x,totalCount:g,sourceCount:p.length,enabledSourceCount:p.filter(G=>G.enabled!==false).length,onUpgradePress:()=>et(true)})]})}),Ie=Ur?A(Ur,{children:ne}):ne,rt=A(ct,{children:A(ma,{visible:pt,onClose:()=>et(false),featureName:"Unlimited Events",description:"View your complete event history to debug complex flows and track down issues.",benefits:["Unlimited event history (vs 25 events)","Export events to Markdown, JSON, or plain text","Share event flows with teammates","Feed event context directly to AI assistants"]})});return n?ie(ct,{children:[ie(f,{style:te.inlineRoot,children:[A(f,{style:te.inlineHeader,...ga,children:R()}),Ie]}),rt]}):ie(ct,{children:[A(na,{visible:e,onClose:t,onMinimize:a,persistenceKey:q,header:{showToggleButton:true,customContent:R()},onModeChange:Q,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},disableScrollWrapper:true,children:Ie}),rt]})}var te=le.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:ia.border,backgroundColor:"transparent"},container:{flex:1,backgroundColor:"transparent"},headerTitleContainer:{flexDirection:"row",alignItems:"baseline",gap:8},headerTitle:{fontSize:16,fontWeight:"600",color:X.color.text},headerSubtitle:{fontSize:12,color:X.color.textTertiary},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:X.color.buttonSurface,borderWidth:1,borderColor:X.color.border,alignItems:"center",justifyContent:"center"},headerActionButtonDisabled:{opacity:.55},headerActionButtonActive:{backgroundColor:X.color.accentSoft,borderColor:X.color.accentBorderStrong}});function ki(e={}){return A(Ht,{...e,inline:true,visible:true,onClose:()=>{}})}import{createToolFactory as Di,defineToolPreset as Ti}from"@buoy-gg/shared-ui/web";import{jsx as Ii}from"react/jsx-runtime";var Lr=Ti({id:"events",name:"EVENTS",description:"Unified event timeline",slot:"both",icon:({size:e,color:t})=>Ii(eo,{size:e,color:t||to}),component:Ht,props:{enableSharedModalDimensions:false}}),Ai=Di(Lr);import{useState as qi,useCallback as Hr}from"react";import{night as de,Trash2 as Bi}from"@buoy-gg/shared-ui/web";import{jsx as Me,jsxs as Ze}from"react/jsx-runtime";function Fi(){let{filteredEvents:e,availableSources:t,toggleSource:r,clearEvents:a,totalCount:o,filteredCount:n,isCapturing:i}=wt(),[l,s]=qi(null),u=Hr(d=>{s(d)},[]),c=Hr(()=>{s(null)},[]);return l?Me(Bt,{event:l,onBack:c}):Ze(f,{style:Pe.container,children:[Ze(f,{style:Pe.header,children:[Ze(f,{children:[Me(k,{style:Pe.title,children:"Events"}),Ze(k,{style:Pe.subtitle,children:[o," event",o!==1?"s":""," captured"]})]}),Ze(ge,{style:Pe.clearButton,onPress:a,activeOpacity:.7,disabled:o===0,children:[Me(Bi,{size:16,color:o===0?de.color.textTertiary:de.color.danger}),Me(k,{style:[Pe.clearText,{color:o===0?de.color.textTertiary:de.color.danger}],children:"Clear"})]})]}),Me(xt,{availableSources:t,onToggleSource:r,totalCount:o,filteredCount:n}),Me(It,{events:e,selectedEventId:void 0,onEventPress:u,isCapturing:i,totalCount:o,sourceCount:t.length,enabledSourceCount:t.filter(d=>d.enabled!==false).length})]})}var Pe=le.create({container:{flex:1,backgroundColor:"transparent"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:16,paddingVertical:12,backgroundColor:de.color.surface,borderBottomWidth:1,borderBottomColor:de.color.border},title:{fontSize:20,fontWeight:"700",color:de.color.text},subtitle:{fontSize:12,color:de.color.textTertiary,marginTop:2},clearButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8,borderRadius:6,backgroundColor:de.color.dangerSoft},clearText:{fontSize:14,fontWeight:"600"}});import{approxJsonSize as Ri,isJsonSerializable as ji,isOverWireBudget as zi}from"@buoy-gg/shared-ui/web";var Ne=16*1024;function Jr(e,t){return{__buoyTruncated:true,approxBytes:e,note:t??`Payload (\u2265${(e/1024).toFixed(0)}KB approx) exceeds the ${Ne/1024}KB sync limit and stayed on the device. Open the tool on-device (or use the source tool's detail action) for the full payload.`}}var Ye={__buoyOmitted:"state-tree",note:"prevState/nextState stay on the device (use get_redux_state / the on-device tool)."},Mi={__buoyOmitted:"query-payload",note:"Query/mutation data stays on the device (open the Query tool or the on-device Events detail)."},dt={__buoyOmitted:"network-body",note:"Request/response body stays on the device (open the Network tool or the on-device Events detail)."},Wr={__buoyOmitted:"network-headers",note:"Request/response headers stay on the device (open the Network tool or the on-device Events detail)."},Pi={__buoyOmitted:"graphql-variables",note:"GraphQL variables stay on the device (open the Network tool or the on-device Events detail)."},Jt={__buoyOmitted:"storage-value",note:"Storage value stays on the device (open the Storage tool or the on-device Events detail)."},Ni={__buoyOmitted:"route-params",note:"Navigation params stay on the device (open the Routes tool or the on-device Events detail)."};function Vi(e){return e==="react-query"||e==="react-query-query"||e==="react-query-mutation"}function se(e,t){if(e!==void 0)return zi(e,Ne)?{...t}:e}function mt(e){return se(e,Mi)}function Kr(e){return e==null?e:e instanceof Error?{name:e.name,message:e.message}:mt(e)}var _r=new WeakMap;function Oi(e){let t=e.originalEvent;if(typeof t!="object"||t===null)return e;let r=_r.get(e);if(r!==void 0)return r;let a=e,o=t;if((e.source==="redux"||e.source==="zustand")&&("prevState"in o||"nextState"in o))o={...o,prevState:{...Ye},nextState:{...Ye},...e.source==="zustand"&&"partial"in o?{partial:{...Ye}}:{}},a={...e,originalEvent:o};else if(e.source==="jotai"&&("prevValue"in o||"nextValue"in o))o={...o,prevValue:{...Ye},nextValue:{...Ye}},a={...e,originalEvent:o};else if(e.source==="render"){let s=o.render,u=o.event,c=d=>{if(!d||typeof d!="object")return d;let{hookChanges:h,...b}=d;return b};o={...o,render:s&&{...s,renderHistory:void 0,lastRenderCause:c(s.lastRenderCause)},event:u&&{...u,capturedProps:void 0,capturedState:void 0,cause:c(u.cause)}},a={...e,originalEvent:o}}else if(Vi(e.source)){let{query:s,mutation:u,...c}=o;o={...c,queryData:mt(c.queryData),mutationData:mt(c.mutationData),mutationVariables:mt(c.mutationVariables),queryError:Kr(c.queryError),mutationError:Kr(c.mutationError)},a={...e,originalEvent:o}}else if(e.source==="network"){let s=typeof o.requestSize=="number"?o.requestSize:void 0,u=typeof o.responseSize=="number"?o.responseSize:void 0;o={...o,requestData:s!==void 0&&s>Ne?{...dt}:se(o.requestData,dt),responseData:u!==void 0&&u>Ne?{...dt}:se(o.responseData,dt),graphqlVariables:se(o.graphqlVariables,Pi),requestHeaders:se(o.requestHeaders,Wr),responseHeaders:se(o.responseHeaders,Wr)},a={...e,originalEvent:o}}else if(e.source==="storage-async"||e.source==="storage-mmkv"){let s=o.data;s&&(o={...o,data:{...s,value:se(s.value,Jt),prevValue:se(s.prevValue,Jt),pairs:se(s.pairs,Jt)}},a={...e,originalEvent:o})}else e.source==="route"&&(o={...o,params:se(o.params,Ni)},a={...e,originalEvent:o});let{bytes:n,sawRepeat:i,sawBigInt:l}=Ri(o,Ne);return n>Ne?a={...e,originalEvent:Jr(n)}:(i||l)&&!ji(o)&&(a={...e,originalEvent:Jr(-1,"Payload is not JSON-serializable (cyclic or bigint) and stayed on the device.")}),_r.set(e,a),a}var Ui={version:2,getSnapshot:()=>({events:L.getEvents().map(Oi),availableSources:Array.from(L.getAvailableEventSources())}),subscribe:e=>{L.ensureRemoteSourcesDefault();let t=L.subscribe(()=>e());return()=>{t(),L.clearRemoteSources()}},actions:{clearEvents:()=>{L.clearEvents()},setEnabledSources:e=>{let t=e?.sources??[];return L.setRemoteEnabledSources(t),{enabledSources:t}},exportEvents:e=>{let t=e??{},r={...t.preset&&We[t.preset]?We[t.preset]:Je,...t.settings??{}},a=L.getEvents(),o=typeof t.limit=="number"&&t.limit>0?t.limit:a.length,n=a.slice(0,o);return{output:Ot(n,r),returned:n.length,totalAvailable:a.length,includedData:r.includeEventData,format:r.format}}}};export{We as COPY_PRESETS,Je as DEFAULT_COPY_SETTINGS,S as EVENTS_TEST_ID,Or as EventsCopySettingsView,Ht as EventsModal,ki as EventsToolView,P as PRESET_METADATA,Er as ReactQueryEventDetail,Bt as UnifiedEventDetail,xt as UnifiedEventFilters,fr as UnifiedEventItem,It as UnifiedEventList,Fi as UnifiedEventViewer,yr as buildCorrelationCountMap,Si as clearCopySettings,Ai as createEventsTool,Ar as detectActivePreset,Fr as estimateExportSize,mr as eventFilterTestID,cr as eventIdentity,dr as eventRowTestID,Ui as eventsSyncAdapter,Lr as eventsToolPreset,Qe as filterEvents,Sn as findRelatedEvents,Ot as generateExport,Rr as generateJsonExport,Pt as generateMarkdownExport,Pr as generateMermaidExport,jr as generatePlaintextExport,Cr as getCorrelationColor,br as getCorrelationGroup,vr as getCorrelationLabel,_e as getExportSummary,wn as getRelatedEventsCount,Cn as hasRelatedEvents,vt as isBuoyInternalEvent,Ya as isEventHiddenFromTool,St as isNetworkEventIgnored,Vr as loadCopySettings,Nr as saveCopySettings,L as unifiedEventStore,wt as useUnifiedEvents};
|
|
11
|
+
Note over U,App: No events captured`;let a=[...r].sort((m,y)=>m.timestamp-y.timestamp),o=a[0].timestamp,n=di(a),i=pi(n),l=["sequenceDiagram"];if(l.push(" autonumber"),l.push(""),i){let m=n.filter(p=>p.group==="client"),y=n.filter(p=>p.group==="server");if(m.length>0){l.push(" box rgb(240, 248, 255) Client");for(let p of m)l.push(` participant ${p.id} as ${p.icon} ${p.label}`);l.push(" end")}if(y.length>0){l.push(" box rgb(255, 248, 240) External");for(let p of y)l.push(` participant ${p.id} as ${p.icon} ${p.label}`);l.push(" end")}}else for(let m of n)l.push(` participant ${m.id} as ${m.icon} ${m.label}`);l.push("");let s=a[a.length-1].timestamp-o,u=a.filter(m=>m.source==="network"),c=u.reduce((m,y)=>{let p=y.originalEvent,g=p?.responseSize||p?.size||0;return m+g},0),d=a.filter(m=>m.status==="error").length,h=[];h.push(`\u23F1\uFE0F ${ke(s)}`),h.push(`\u{1F4CA} ${a.length} events`),u.length>0&&h.push(`\u{1F310} ${u.length} API calls`),c>0&&h.push(`\u{1F4E6} ${Ot(c)}`),d>0&&h.push(`\u274C ${d} errors`),l.push(` Note over U,API: ${h.join(" \xB7 ")}`),l.push("");let b=new Map,v=0;for(let m of a){let y=bi(m,t,o);if(y.skip){v++;continue}let{messages:p,notes:g}=y,$=false,L="";if(m.source==="network"){let C=m.originalEvent?.url;if(C){let I=gi(C),x=b.get(I);if(x&&m.timestamp-x.timestamp<3e4){$=true;let j=m.timestamp-x.timestamp;L=`\u26A0\uFE0F Already fetched ${ke(j)} ago`,b.set(I,{timestamp:m.timestamp,count:x.count+1})}else b.set(I,{timestamp:m.timestamp,count:1})}}if($){l.push(" rect rgb(255, 245, 230)"),l.push(` Note over App,API: ${L}`);for(let C of p)l.push(` ${C}`);for(let C of g)l.push(` ${C}`);l.push(" end")}else if(m.status==="error"){l.push(" rect rgb(255, 235, 235)");for(let C of p)l.push(` ${C}`);for(let C of g)l.push(` ${C}`);l.push(" end")}else{for(let C of p)l.push(` ${C}`);for(let C of g)l.push(` ${C}`)}}return v>0&&(l.push(""),l.push(` Note over App: ${v} internal events hidden`)),l.join(`
|
|
12
|
+
`)}function Ut(e,t){switch(t.format){case"markdown":return Nt(e,t);case"json":return Rr(e,t);case"plaintext":return jr(e,t);case"mermaid":return Pr(e,t);default:return Nt(e,t)}}import{definePersistedSetting as vi,devToolsStorageKeys as Si}from"@buoy-gg/shared-ui/web";var Lt=vi(Si.events.copySettings(),Je,{sanitize:(e,t)=>({...e,filterSources:t?.filterSources??Je.filterSources})});async function Nr(e){await Lt.save(e)}async function Vr(){return Lt.loadOrNull()}async function Ci(){await Lt.clear()}import{Fragment as wi,jsx as ae,jsxs as Ht}from"react/jsx-runtime";var Ei=50*1024,xi=200*1024;function $i(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function ki(){let e=Date.now();return[{id:"mock-1",source:"storage-async",timestamp:e-2e3,title:"Set Item",subtitle:"user_cart",status:"success",originalEvent:{action:"setItem",key:"user_cart",value:{items:2}}},{id:"mock-2",source:"react-query-query",timestamp:e-1500,title:"cart \u203A items",subtitle:"Fetching...",status:"pending",originalEvent:{type:"query-fetch-start",queryKey:["cart","items"]},correlationId:"rq-query-cart",sequenceInGroup:1},{id:"mock-3",source:"react-query-query",timestamp:e-1e3,title:"cart \u203A items",subtitle:"Success \xB7 500ms",status:"success",originalEvent:{type:"query-fetch-success",queryKey:["cart","items"],data:{items:[]}},correlationId:"rq-query-cart",sequenceInGroup:2},{id:"mock-4",source:"network",timestamp:e-500,title:"POST /api/checkout",subtitle:"402 \xB7 450ms",status:"error",originalEvent:{method:"POST",url:"/api/checkout",status:402,error:"Payment required"}}]}function Or({events:e=[],initialSettings:t=Je,onSettingsChange:r}){let{isPro:a}=Gn(),[o,n]=Rt(t),[i,l]=Rt(false),[s,u]=Rt(false);Ln(()=>{let I=true;return Vr().then(x=>{I&&x&&(n(x),r?.(x)),I&&u(true)}),()=>{I=false}},[r]);let c=je(I=>{n(I),r?.(I),Nr(I)},[r]),d=e.length>0,h=d?e:ki(),b=it(()=>Ar(o),[o]),v=it(()=>Fr(h,o),[h,o]),m=it(()=>v>=xi?"danger":v>=Ei?"warning":"none",[v]),y=je(()=>Ut(h,o),[h,o]),p=je(I=>{let x=We[I];c({...x,filterSources:[...x.filterSources]})},[c]),g=je((I,x)=>{let[j,N]=I.split("::");if(j==="preset"){p(N);return}if(j==="include"){c({...o,[N]:!o[N]});return}if(j==="format"){c({...o,format:x});return}if(j==="timestamp"){c({...o,timestampFormat:x});return}if(j==="filter"){c({...o,filterMode:x});return}if(j==="threshold"){c({...o,dataSizeThreshold:x});return}},[o,c,p]),$=je(()=>{let I=h.length;return ae(Yn,{expanded:i,onExpandedChange:l,summary:`${I} event${I!==1?"s":""} \xB7 ~${$i(v)}${d?"":" (mock data)"}`,warningLevel:m,warningText:{warning:"Large payload - preview may be slow",danger:"Very large payload - may cause performance issues"},testIDs:{expand:`${S}-preview-expand`,collapse:`${S}-preview-collapse`,summary:`${S}-preview-summary`,warning:`${S}-preview-size-warning`},renderBody:()=>{let x=y();return o.format==="json"?ae(ei,{testIDPrefix:`${S}-preview-json`,data:JSON.parse(x),title:"",showTypeFilter:true,rawMode:true,initialExpanded:true}):Ht(f,{children:[o.format==="mermaid"&&ae(k,{style:De.mermaidHint,children:"\u{1F4A1} Paste into mermaid.live to visualize"}),ae(ue,{style:De.previewScroll,nestedScrollEnabled:true,testID:`${S}-preview-scroll`,children:ae(k,{style:De.previewText,selectable:a,testID:`${S}-preview-text`,children:x})})]})}})},[i,h,o,v,m,d,y,a]),L=je(()=>{let I=_e(h),x=d?`${I.totalEvents} events`:"Mock data (no events captured)";return Ht(wi,{children:[ae(k,{style:De.statusLabel,testID:`${S}-export-status`,children:x}),ae(Qn,{value:y()})]})},[d,h,y]),C=it(()=>({sections:[{id:"presets",title:"Presets",type:"custom",data:[{id:"preset::llm",label:P.llm.label,icon:Jn,color:P.llm.color,value:"llm",isActive:b==="llm",description:P.llm.description},{id:"preset::bugReport",label:P.bugReport.label,icon:Wn,color:P.bugReport.color,value:"bugReport",isActive:b==="bugReport",description:P.bugReport.description},{id:"preset::json",label:P.json.label,icon:Dr,color:P.json.color,value:"json",isActive:b==="json",description:P.json.description},{id:"preset::errors",label:P.errors.label,icon:Tr,color:P.errors.color,value:"errors",isActive:b==="errors",description:P.errors.description},{id:"preset::minimal",label:P.minimal.label,icon:kr,color:P.minimal.color,value:"minimal",isActive:b==="minimal",description:P.minimal.description},{id:"preset::mermaid",label:P.mermaid.label,icon:Ir,color:P.mermaid.color,value:"mermaid",isActive:b==="mermaid",description:P.mermaid.description},{id:"preset::custom",label:"Custom",icon:Kn,color:He.color.textSecondary,value:"custom",isActive:b===null,description:"User-configured"}]},{id:"include",title:"Include",type:"custom",data:[{id:"include::includeSource",label:"Source",value:"includeSource",isActive:o.includeSource},{id:"include::includeStatus",label:"Status",value:"includeStatus",isActive:o.includeStatus},{id:"include::includeTitle",label:"Title",value:"includeTitle",isActive:o.includeTitle},{id:"include::includeSubtitle",label:"Subtitle",value:"includeSubtitle",isActive:o.includeSubtitle},{id:"include::includeCorrelation",label:"Correlation",value:"includeCorrelation",isActive:o.includeCorrelation},{id:"include::includeDuration",label:"Duration",value:"includeDuration",isActive:o.includeDuration},{id:"include::includeSummaryHeader",label:"Summary",value:"includeSummaryHeader",isActive:o.includeSummaryHeader},{id:"include::includeEventData",label:"Data",value:"includeEventData",isActive:o.includeEventData}]},{id:"format",title:"Format",type:"custom",data:[{id:"format::markdown",label:"Markdown",icon:kr,color:Le.semantic.info,value:"markdown",isActive:o.format==="markdown"},{id:"format::json",label:"JSON",icon:Dr,color:Le.semantic.warning,value:"json",isActive:o.format==="json"},{id:"format::plaintext",label:"Text",icon:Hn,color:He.color.textSecondary,value:"plaintext",isActive:o.format==="plaintext"},{id:"format::mermaid",label:"Diagram",icon:Ir,color:"#A855F7",value:"mermaid",isActive:o.format==="mermaid",description:"Mermaid sequence diagram"}]},{id:"timestamp",title:"Timestamps",type:"custom",data:[{id:"timestamp::relative",label:"Relative",value:"relative",isActive:o.timestampFormat==="relative",description:"+0ms, +150ms"},{id:"timestamp::absolute",label:"Absolute",value:"absolute",isActive:o.timestampFormat==="absolute",description:"ISO format"},{id:"timestamp::both",label:"Both",value:"both",isActive:o.timestampFormat==="both",description:"Both formats"}]},{id:"filter",title:"Filter Events",type:"custom",data:[{id:"filter::all",label:"All",value:"all",isActive:o.filterMode==="all"},{id:"filter::errors",label:"Errors",icon:Tr,color:Le.semantic.error,value:"errors",isActive:o.filterMode==="errors"},{id:"filter::success",label:"Success",color:Le.semantic.success,value:"success",isActive:o.filterMode==="success"},{id:"filter::pending",label:"Pending",color:Le.semantic.warning,value:"pending",isActive:o.filterMode==="pending"}]},{id:"llmOptimization",title:"LLM Optimization",type:"custom",data:[{id:"include::compactMode",label:"Compact",value:"compactMode",isActive:o.compactMode,description:"One line per event"},{id:"include::smartJsonParsing",label:"Smart JSON",value:"smartJsonParsing",isActive:o.smartJsonParsing,description:"Parse nested JSON"},{id:"include::reduxChangedOnly",label:"Redux Diff",value:"reduxChangedOnly",isActive:o.reduxChangedOnly,description:"Only show changes"},{id:"include::showStorageDiff",label:"Storage Diff",value:"showStorageDiff",isActive:o.showStorageDiff,description:"Show what changed"},{id:"include::stripVerboseFields",label:"Strip Noise",value:"stripVerboseFields",isActive:o.stripVerboseFields,description:"Remove images/descriptions"}]}],previewSection:{enabled:true,title:"PREVIEW",icon:_n,content:$,headerActions:L},onFilterChange:g}),[o,b,g,$,L]);return a?ae($r,{...C}):Ht(ue,{style:De.gatedContainer,contentContainerStyle:De.gatedContent,testID:`${S}-copy-settings-gated`,children:[ae(Zn,{featureName:"Events Export",description:"Export event flows to share with your team, debug issues, or feed into AI tools.",benefits:["Export to Markdown, JSON, or plain text","Customizable presets (LLM-ready, Bug Report, JSON)","Share event flows with teammates","Feed event context directly to AI assistants"]}),ae(f,{style:De.gatedPreview,children:ae($r,{...C})})]})}var De=le.create({previewScroll:{maxHeight:300},previewText:{fontFamily:Xn,fontSize:11,color:He.color.text,lineHeight:18},mermaidHint:{fontSize:11,color:He.color.textSecondary,marginBottom:8,paddingHorizontal:8,paddingVertical:6,backgroundColor:"#A855F715",borderRadius:6,overflow:"hidden"},statusLabel:{fontSize:11,fontWeight:"600",color:He.color.textTertiary,marginRight:8},gatedContainer:{flex:1},gatedContent:{padding:12,gap:12},gatedPreview:{}});import{TickProvider as Ur}from"@buoy-gg/shared-ui/web";import{Fragment as ct,jsx as A,jsxs as ie}from"react/jsx-runtime";function Jt({visible:e,onClose:t,onBack:r,onMinimize:a,enableSharedModalDimensions:o=false,inline:n=false,capturing:i,onCapturingChange:l,networkDetailWrapper:s,NetworkEventDetailViewComponent:u,RouteEventDetailComponent:c,detailComponents:d}){let h=ha(),b=i!=null&&l!=null,{filteredEvents:v,availableSources:m,toggleSource:y,clearEvents:p,totalCount:g,filteredCount:$,isCapturing:L,toggleCapturing:C,hiddenEventsCount:I,searchText:x,setSearchText:j}=Et(b?{capturingOverride:i}:void 0),N=b?i:L,me=b?()=>l(!i):C,[K,he]=ot("list"),[_,Xe]=ot(null),[mt,et]=ot(false),[Te,Ve]=ot(false),ht=aa(null);oa(()=>{if(!Te)return;let G=requestAnimationFrame(()=>{ht.current?.focus()});return()=>cancelAnimationFrame(G)},[Te]);let gt=Ae(()=>{Ve(false),j("")},[j]),tt=Ae(G=>{try{h.push(G)}catch(ft){Zt.alert("Navigation Error",String(ft))}},[h]),w=Ae(G=>{Xe(G),he("detail")},[]),F=Ae(()=>{K==="detail"?(Xe(null),he("list")):K==="copySettings"&&he("list")},[K]),z=Ae(()=>{he("copySettings")},[]),Q=Ae(G=>{},[]),q=o?ca.modal.root():"buoy-events-modal";if(!e)return null;let R=()=>{if(K==="detail"&&_){let G={source:_.source,title:_.title,subtitle:_.subtitle,status:_.status,timestamp:new Date(_.timestamp).toISOString(),data:_.originalEvent};return ie(Y,{children:[A(Y.Navigation,{onBack:F}),A(Y.Content,{title:_.title,testID:`${S}-detail-heading`}),A(Y.Actions,{children:A(da,{value:G})})]})}return K==="copySettings"?ie(Y,{children:[A(Y.Navigation,{onBack:F}),A(Y.Content,{title:"Copy Settings",testID:`${S}-copy-settings-heading`})]}):ie(Y,{children:[r&&A(Y.Navigation,{onBack:r}),A(Y.Content,{title:"",children:Te?A(Y.Search,{value:x,onChangeText:j,onCancel:gt,placeholder:"Search events...",accessibilityLabel:"Search events",iconSize:14,testID:`${S}-search-field`,containerTestID:`${S}-search`,clearTestID:`${S}-search-clear`,onBlur:()=>{x.length===0&&Ve(false)}}):ie(f,{style:te.headerTitleContainer,children:[A(k,{style:te.headerTitle,testID:`${S}-title`,children:"Events"}),ie(k,{style:te.headerSubtitle,testID:`${S}-count`,children:[g," captured"]})]})}),ie(Y.Actions,{children:[!Te&&A(ge,{onPress:()=>Ve(true),style:[te.headerActionButton,x.length>0&&te.headerActionButtonActive],testID:`${S}-search-open`,accessibilityRole:"button",accessibilityLabel:"Search events",children:A(ua,{size:14,color:x.length>0?X.color.accent:X.color.textSecondary})}),A(ge,{onPress:z,style:[te.headerActionButton,g===0&&te.headerActionButtonDisabled],disabled:g===0,testID:`${S}-copy`,accessibilityRole:"button",accessibilityLabel:"Copy events",children:A(la,{size:14,color:g>0?X.color.textSecondary:X.color.textTertiary})}),A(ma,{isEnabled:N,onToggle:me,testID:`${S}-power`,accessibilityLabel:"Toggle event capture"}),A(ge,{onPress:p,style:[te.headerActionButton,g===0&&te.headerActionButtonDisabled],disabled:g===0,testID:`${S}-clear`,accessibilityRole:"button",accessibilityLabel:"Clear events",children:A(sa,{size:14,color:g>0?X.color.textSecondary:X.color.textTertiary})})]})]})},ne=A(f,{style:te.container,children:K==="copySettings"?A(Or,{events:v}):K==="detail"&&_?A(Ft,{event:_,onBack:F,onNavigate:tt,networkDetailWrapper:s,NetworkEventDetailViewComponent:u,RouteEventDetailComponent:c,detailComponents:d}):ie(ct,{children:[A($t,{availableSources:m,onToggleSource:y,totalCount:g,filteredCount:$}),A(At,{events:v,selectedEventId:void 0,expandedEventId:void 0,onEventPress:w,onNavigate:tt,isCapturing:N,hiddenEventsCount:I,searchText:x,totalCount:g,sourceCount:m.length,enabledSourceCount:m.filter(G=>G.enabled!==false).length,onUpgradePress:()=>et(true)})]})}),Ie=Ur?A(Ur,{children:ne}):ne,rt=A(ct,{children:A(pa,{visible:mt,onClose:()=>et(false),featureName:"Unlimited Events",description:"View your complete event history to debug complex flows and track down issues.",benefits:["Unlimited event history (vs 25 events)","Export events to Markdown, JSON, or plain text","Share event flows with teammates","Feed event context directly to AI assistants"]})});return n?ie(ct,{children:[ie(f,{style:te.inlineRoot,children:[A(f,{style:te.inlineHeader,...ga,children:R()}),Ie]}),rt]}):ie(ct,{children:[A(na,{visible:e,onClose:t,onMinimize:a,persistenceKey:q,header:{showToggleButton:true,customContent:R()},onModeChange:Q,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},disableScrollWrapper:true,children:Ie}),rt]})}var te=le.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:ia.border,backgroundColor:"transparent"},container:{flex:1,backgroundColor:"transparent"},headerTitleContainer:{flexDirection:"row",alignItems:"baseline",gap:8},headerTitle:{fontSize:16,fontWeight:"600",color:X.color.text},headerSubtitle:{fontSize:12,color:X.color.textTertiary},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:X.color.buttonSurface,borderWidth:1,borderColor:X.color.border,alignItems:"center",justifyContent:"center"},headerActionButtonDisabled:{opacity:.55},headerActionButtonActive:{backgroundColor:X.color.accentSoft,borderColor:X.color.accentBorderStrong}});function Di(e={}){return A(Jt,{...e,inline:true,visible:true,onClose:()=>{}})}import{createToolFactory as Ti,defineToolPreset as Ii}from"@buoy-gg/shared-ui/web";import{jsx as Ai}from"react/jsx-runtime";var Lr=Ii({id:"events",name:"EVENTS",description:"Unified event timeline",slot:"both",icon:({size:e,color:t})=>Ai(eo,{size:e,color:t||to}),component:Jt,props:{enableSharedModalDimensions:false}}),qi=Ti(Lr);import{useState as Bi,useCallback as Hr}from"react";import{night as de,Trash2 as Fi}from"@buoy-gg/shared-ui/web";import{jsx as Me,jsxs as Ze}from"react/jsx-runtime";function Ri(){let{filteredEvents:e,availableSources:t,toggleSource:r,clearEvents:a,totalCount:o,filteredCount:n,isCapturing:i}=Et(),[l,s]=Bi(null),u=Hr(d=>{s(d)},[]),c=Hr(()=>{s(null)},[]);return l?Me(Ft,{event:l,onBack:c}):Ze(f,{style:Pe.container,children:[Ze(f,{style:Pe.header,children:[Ze(f,{children:[Me(k,{style:Pe.title,children:"Events"}),Ze(k,{style:Pe.subtitle,children:[o," event",o!==1?"s":""," captured"]})]}),Ze(ge,{style:Pe.clearButton,onPress:a,activeOpacity:.7,disabled:o===0,children:[Me(Fi,{size:16,color:o===0?de.color.textTertiary:de.color.danger}),Me(k,{style:[Pe.clearText,{color:o===0?de.color.textTertiary:de.color.danger}],children:"Clear"})]})]}),Me($t,{availableSources:t,onToggleSource:r,totalCount:o,filteredCount:n}),Me(At,{events:e,selectedEventId:void 0,onEventPress:u,isCapturing:i,totalCount:o,sourceCount:t.length,enabledSourceCount:t.filter(d=>d.enabled!==false).length})]})}var Pe=le.create({container:{flex:1,backgroundColor:"transparent"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:16,paddingVertical:12,backgroundColor:de.color.surface,borderBottomWidth:1,borderBottomColor:de.color.border},title:{fontSize:20,fontWeight:"700",color:de.color.text},subtitle:{fontSize:12,color:de.color.textTertiary,marginTop:2},clearButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8,borderRadius:6,backgroundColor:de.color.dangerSoft},clearText:{fontSize:14,fontWeight:"600"}});import{approxJsonSize as ji,isJsonSerializable as zi,isOverWireBudget as Mi}from"@buoy-gg/shared-ui/web";var Ne=16*1024;function Jr(e,t){return{__buoyTruncated:true,approxBytes:e,note:t??`Payload (\u2265${(e/1024).toFixed(0)}KB approx) exceeds the ${Ne/1024}KB sync limit and stayed on the device. Open the tool on-device (or use the source tool's detail action) for the full payload.`}}var Ye={__buoyOmitted:"state-tree",note:"prevState/nextState stay on the device (use get_redux_state / the on-device tool)."},Pi={__buoyOmitted:"query-payload",note:"Query/mutation data stays on the device (open the Query tool or the on-device Events detail)."},dt={__buoyOmitted:"network-body",note:"Request/response body stays on the device (open the Network tool or the on-device Events detail)."},Wr={__buoyOmitted:"network-headers",note:"Request/response headers stay on the device (open the Network tool or the on-device Events detail)."},Ni={__buoyOmitted:"graphql-variables",note:"GraphQL variables stay on the device (open the Network tool or the on-device Events detail)."},Wt={__buoyOmitted:"storage-value",note:"Storage value stays on the device (open the Storage tool or the on-device Events detail)."},Vi={__buoyOmitted:"route-params",note:"Navigation params stay on the device (open the Routes tool or the on-device Events detail)."};function Oi(e){return e==="react-query"||e==="react-query-query"||e==="react-query-mutation"}function se(e,t){if(e!==void 0)return Mi(e,Ne)?{...t}:e}function pt(e){return se(e,Pi)}function Kr(e){return e==null?e:e instanceof Error?{name:e.name,message:e.message}:pt(e)}var _r=new WeakMap;function Ui(e){let t=e.originalEvent;if(typeof t!="object"||t===null)return e;let r=_r.get(e);if(r!==void 0)return r;let a=e,o=t;if((e.source==="redux"||e.source==="zustand")&&("prevState"in o||"nextState"in o))o={...o,prevState:{...Ye},nextState:{...Ye},...e.source==="zustand"&&"partial"in o?{partial:{...Ye}}:{}},a={...e,originalEvent:o};else if(e.source==="jotai"&&("prevValue"in o||"nextValue"in o))o={...o,prevValue:{...Ye},nextValue:{...Ye}},a={...e,originalEvent:o};else if(e.source==="render"){let s=o.render,u=o.event,c=d=>{if(!d||typeof d!="object")return d;let{hookChanges:h,...b}=d;return b};o={...o,render:s&&{...s,renderHistory:void 0,lastRenderCause:c(s.lastRenderCause)},event:u&&{...u,capturedProps:void 0,capturedState:void 0,cause:c(u.cause)}},a={...e,originalEvent:o}}else if(Oi(e.source)){let{query:s,mutation:u,...c}=o;o={...c,queryData:pt(c.queryData),mutationData:pt(c.mutationData),mutationVariables:pt(c.mutationVariables),queryError:Kr(c.queryError),mutationError:Kr(c.mutationError)},a={...e,originalEvent:o}}else if(e.source==="network"){let s=typeof o.requestSize=="number"?o.requestSize:void 0,u=typeof o.responseSize=="number"?o.responseSize:void 0;o={...o,requestData:s!==void 0&&s>Ne?{...dt}:se(o.requestData,dt),responseData:u!==void 0&&u>Ne?{...dt}:se(o.responseData,dt),graphqlVariables:se(o.graphqlVariables,Ni),requestHeaders:se(o.requestHeaders,Wr),responseHeaders:se(o.responseHeaders,Wr)},a={...e,originalEvent:o}}else if(e.source==="storage-async"||e.source==="storage-mmkv"){let s=o.data;s&&(o={...o,data:{...s,value:se(s.value,Wt),prevValue:se(s.prevValue,Wt),pairs:se(s.pairs,Wt)}},a={...e,originalEvent:o})}else e.source==="route"&&(o={...o,params:se(o.params,Vi)},a={...e,originalEvent:o});let{bytes:n,sawRepeat:i,sawBigInt:l}=ji(o,Ne);return n>Ne?a={...e,originalEvent:Jr(n)}:(i||l)&&!zi(o)&&(a={...e,originalEvent:Jr(-1,"Payload is not JSON-serializable (cyclic or bigint) and stayed on the device.")}),_r.set(e,a),a}var Li={version:2,getSnapshot:()=>({events:O.getEvents().map(Ui),availableSources:Array.from(O.getAvailableEventSources())}),subscribe:e=>{O.ensureRemoteSourcesDefault();let t=O.subscribe(()=>e());return()=>{t(),O.clearRemoteSources()}},actions:{clearEvents:()=>{O.clearEvents()},setEnabledSources:e=>{let t=e?.sources??[];return O.setRemoteEnabledSources(t),{enabledSources:t}},exportEvents:e=>{let t=e??{},r={...t.preset&&We[t.preset]?We[t.preset]:Je,...t.settings??{}},a=O.getEvents(),o=typeof t.limit=="number"&&t.limit>0?t.limit:a.length,n=a.slice(0,o);return{output:Ut(n,r),returned:n.length,totalAvailable:a.length,includedData:r.includeEventData,format:r.format}}}};export{We as COPY_PRESETS,Je as DEFAULT_COPY_SETTINGS,S as EVENTS_TEST_ID,Or as EventsCopySettingsView,Jt as EventsModal,Di as EventsToolView,P as PRESET_METADATA,Er as ReactQueryEventDetail,Ft as UnifiedEventDetail,$t as UnifiedEventFilters,fr as UnifiedEventItem,At as UnifiedEventList,Ri as UnifiedEventViewer,yr as buildCorrelationCountMap,Ci as clearCopySettings,qi as createEventsTool,Ar as detectActivePreset,Fr as estimateExportSize,pr as eventFilterTestID,cr as eventIdentity,dr as eventRowTestID,Li as eventsSyncAdapter,Lr as eventsToolPreset,Qe as filterEvents,Cn as findRelatedEvents,Ut as generateExport,Rr as generateJsonExport,Nt as generateMarkdownExport,Pr as generateMermaidExport,jr as generatePlaintextExport,Cr as getCorrelationColor,br as getCorrelationGroup,vr as getCorrelationLabel,_e as getExportSummary,En as getRelatedEventsCount,wn as hasRelatedEvents,St as isBuoyInternalEvent,Xa as isEventHiddenFromTool,Ct as isNetworkEventIgnored,Vr as loadCopySettings,Nr as saveCopySettings,O as unifiedEventStore,Et as useUnifiedEvents,Ja as watchEvents};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/events",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.45",
|
|
4
4
|
"description": "Review retained events from connected Buoy tools and export timeline data for investigation.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@buoy-gg/floating-tools-core": "^7.0.
|
|
38
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
37
|
+
"@buoy-gg/floating-tools-core": "^7.0.45",
|
|
38
|
+
"@buoy-gg/shared-ui": "^7.0.45"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "*"
|