@buoy-gg/route-events 7.0.56 → 7.0.57
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/browserRouteRegistry.js +1 -1
- package/lib/commonjs/browserRoutes.js +1 -1
- package/lib/commonjs/components/RouteEventsModalWithTabs.js +1 -1
- package/lib/commonjs/components/RoutesSitemap.js +2 -2
- package/lib/commonjs/expoRouterStore.js +1 -1
- package/lib/commonjs/expoRouterStore.web.js +1 -1
- package/lib/commonjs/sync/routeEventsSyncAdapter.js +1 -1
- package/lib/module/browserRouteRegistry.js +1 -1
- package/lib/module/browserRoutes.js +1 -1
- package/lib/module/components/RouteEventsModalWithTabs.js +1 -1
- package/lib/module/components/RoutesSitemap.js +2 -2
- package/lib/module/expoRouterStore.js +1 -1
- package/lib/module/expoRouterStore.web.js +1 -1
- package/lib/module/sync/routeEventsSyncAdapter.js +1 -1
- package/lib/typescript/browserRouteRegistry.d.ts +4 -0
- package/lib/typescript/expoRouterStore.d.ts +2 -0
- package/lib/typescript/expoRouterStore.web.d.ts +2 -0
- package/lib/typescript/sync/routeEventsSyncAdapter.d.ts +5 -1
- package/lib/web/index.mjs +4 -4
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getBrowserRoutePaths=getBrowserRoutePaths;exports.getBrowserRoutesUpdatedAt=getBrowserRoutesUpdatedAt;exports.registerBrowserRoutes=registerBrowserRoutes;const declared=new Map;let updatedAt=null;function registerBrowserRoutes(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getBrowserRouteInfo=getBrowserRouteInfo;exports.getBrowserRoutePaths=getBrowserRoutePaths;exports.getBrowserRoutesUpdatedAt=getBrowserRoutesUpdatedAt;exports.registerBrowserRoutes=registerBrowserRoutes;const declared=new Map;let updatedAt=null;function registerBrowserRoutes(o){for(const e of o)declared.set(e,(declared.get(e)??0)+1);updatedAt=Date.now();let s=true;return()=>{if(!s)return;s=false;for(const e of o){const n=(declared.get(e)??1)-1;if(n)declared.set(e,n);else declared.delete(e)}updatedAt=Date.now()}}function getBrowserRoutePaths(){return[...declared.keys()]}function getBrowserRoutesUpdatedAt(){return updatedAt}function getBrowserRouteInfo(o){const s={segments:o.split("/").filter(Boolean),params:{}};const e=getBrowserRoutePaths();if(e.includes(o))return s;for(const n of e){const c=n.split("/").filter(Boolean);const u=[];const l=c.map(t=>{const r=/^\[(\.\.\.)?([^\]]+)\]$/.exec(t);if(!r)return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");u.push({name:r[2],deep:!!r[1]});return r[1]?"(.+)":"([^/]+)"});const a=new RegExp("^/"+l.join("/")+"/?$").exec(o);if(!a)continue;const p=t=>{try{return decodeURIComponent(t)}catch{return t}};const f={};u.forEach(({name:t,deep:r},d)=>{const i=a[d+1];f[t]=r?i.split("/").map(p):p(i)});return{segments:c,params:f}}return s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.startBrowserRouteCapture=startBrowserRouteCapture;var _utils=require("@buoy-gg/shared-ui/utils");var _RouteObserver=require("./RouteObserver");var _routeEventStore=require("./stores/routeEventStore");var _navigationStackStore=require("./stores/navigationStackStore");let leases=0;let stop;function startBrowserRouteCapture(){if(typeof window==="undefined")return()=>{};if(leases++===0){_routeEventStore.routeEventStore.hydrateBootCapture();let
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.startBrowserRouteCapture=startBrowserRouteCapture;var _utils=require("@buoy-gg/shared-ui/utils");var _RouteObserver=require("./RouteObserver");var _routeEventStore=require("./stores/routeEventStore");var _navigationStackStore=require("./stores/navigationStackStore");var _browserRouteRegistry=require("./browserRouteRegistry");let leases=0;let stop;function startBrowserRouteCapture(){if(typeof window==="undefined")return()=>{};if(leases++===0){_routeEventStore.routeEventStore.hydrateBootCapture();let m;let c;let h="";const o=[];let r=-1;const g=()=>{const e=window.history.state;if(!e||typeof e!=="object")return void 0;const t=e.key??e.__TSR_key;return typeof t==="string"||typeof t==="number"?String(t):void 0};const w=e=>{for(let t=r-1;t>=0;t--)if(o[t].href===e)return t;for(let t=r+1;t<o.length;t++)if(o[t].href===e)return t;return-1};const v=e=>{const t=g();if(e.href===h&&e.kind==="pop"&&(t===void 0||o[r]?.key===t))return;if(e.kind==="replace"&&r>=0)o[r]={href:e.href,key:t};else if(e.kind==="pop"){const u=t===void 0?-1:o.findIndex(i=>i.key===t);const n=u>=0?u:w(e.href);if(n>=0)r=n;else{o.splice(r+1);o.push({href:e.href,key:t});r++}}else{o.splice(r+1);o.push({href:e.href,key:t});r++}h=e.href;const s=(0,_utils.getBrowserRouteURL)(e.href);const a=Date.now();const f=(0,_browserRouteRegistry.getBrowserRouteInfo)(s.pathname);_RouteObserver.routeObserver.emit({pathname:s.pathname,params:{...f.params,...Object.fromEntries(s.searchParams)},segments:f.segments,previousPathname:m,timestamp:a,timeSincePrevious:c===void 0?void 0:a-c});m=s.pathname;c=a;_navigationStackStore.navigationStackStore.setStack(o.slice(0,r+1).map(({href:u},n)=>{const i=(0,_utils.getBrowserRouteURL)(u);const p=(0,_browserRouteRegistry.getBrowserRouteInfo)(i.pathname);return{key:`browser:${n}`,name:p.segments.join("/")||"index",pathname:i.pathname,params:{...p.params,...Object.fromEntries(i.searchParams)},index:n,isFocused:n===r,canPop:n>0}}))};const l=e=>{if(!Number.isInteger(e)||e<0||e>=o.length)throw new Error("That browser history entry is unavailable.");window.history.go(e-r)};_navigationStackStore.navigationStackStore.setActions({navigateToIndex:l,popToIndex:l,goBack:_utils.browserRouter.back,popToTop:()=>l(0),navigateToRoute:(e,t)=>{const s={...t};const a=`/${e.replace(/^\//,"")}`.replace(/\[(\.\.\.)?([^\]]+)\]/g,(f,u,n)=>{if(!(n in s))return f;const i=s[n];delete s[n];return u&&Array.isArray(i)?i.map(p=>encodeURIComponent(String(p))).join("/"):encodeURIComponent(String(i))});_utils.browserRouter.push({pathname:a==="/index"?"/":a,params:s});return true}});stop=(0,_utils.subscribeBrowserNavigation)(v);v({href:(0,_utils.getBrowserHref)(),kind:"initial"})}let d=false;return()=>{if(d)return;d=true;if(--leases===0){stop?.();stop=void 0;_navigationStackStore.navigationStackStore.setActions(null)}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.RouteEventsModalWithTabs=RouteEventsModalWithTabs;exports.RoutesToolView=RoutesToolView;var _react=require("react");var _reactNative=require("react-native");var _safeReactNavigation=require("../utils/safeReactNavigation");var _sharedUi=require("@buoy-gg/shared-ui");var _license=require("@buoy-gg/license");var _useRouteEvents=require("../hooks/useRouteEvents");var _routeEventStore=require("../stores/routeEventStore");var _RouteEventDetail=require("./RouteEventDetail");var _RouteFilterViewV=require("./RouteFilterViewV2");var _RoutesSitemap=require("./RoutesSitemap");var _ReactNavigationRoutes=require("./ReactNavigationRoutes");var _NavigationStack=require("./NavigationStack");var _RouteEventsTimeline=require("./RouteEventsTimeline");var _routeTemplate=require("../utils/routeTemplate");var _jsxRuntime=require("react/jsx-runtime");const CommonActions=(0,_safeReactNavigation.getCommonActions)();const TAB_PERSISTENCE={parse:t=>t==="routes"||t==="events"||t==="stack"?t:void 0,serialize:t=>t};const BOOLEAN_PERSISTENCE={parse:t=>t==="true",serialize:t=>t.toString()};const STRING_SET_PERSISTENCE={parse:t=>new Set(JSON.parse(t)),serialize:t=>JSON.stringify(Array.from(t))};function findScreenPath(t,u){if(!t||!t.routes)return null;for(const a of t.routes){if(a.name===u){return[a.name]}if(a.state){const d=findScreenPath(a.state,u);if(d){return[a.name,...d]}}}return null}function buildNestedNavigateAction(t,u){if(t.length===0)return null;const a=u&&Object.keys(u).length>0?u:void 0;if(t.length===1){return CommonActions.navigate(a?{name:t[0],params:a}:{name:t[0]})}let d=a?{screen:t[t.length-1],params:a}:{screen:t[t.length-1]};for(let b=t.length-2;b>=1;b--){d={screen:t[b],params:d}}return CommonActions.navigate({name:t[0],params:d})}function RouteEventsModalWithTabs({visible:t,onClose:u,onBack:a,onMinimize:d,enableSharedModalDimensions:b=false,inline:q=false,remote:r}){const I=(0,_sharedUi.useSafeRouter)();const y=(0,_safeReactNavigation.useSafeNavigationContainerRef)();const x=(0,_sharedUi.isExpoRouterAvailable)();const[m,O]=(0,_sharedUi.usePersistedState)(_sharedUi.devToolsStorageKeys.routeEvents.activeTab(),"events",TAB_PERSISTENCE);const[N,S]=(0,_react.useState)(false);const[U,K]=(0,_react.useState)("");const h=(0,_license.useIsPro)();const E=(0,_sharedUi.useLimit)("routeEvents.entries");(0,_react.useEffect)(()=>{if(N&&h){S(false)}},[N,h]);const[C,J]=(0,_sharedUi.usePersistedState)(_sharedUi.devToolsStorageKeys.routeEvents.isMonitoring(),true,BOOLEAN_PERSISTENCE);const{events:s,clearEvents:D,isListening:$}=(0,_useRouteEvents.useRouteEvents)({enabled:C});const R=C&&$;(0,_react.useEffect)(()=>{_routeEventStore.routeEventStore.setBootCapture(C)},[C]);const[j,A]=(0,_react.useState)(false);const[i,w]=(0,_react.useState)(null);const[_,G]=(0,_react.useState)(1);const[v,V]=(0,_react.useState)("");const[l,H]=(0,_sharedUi.usePersistedState)(_sharedUi.devToolsStorageKeys.routeEvents.eventFilters(),new Set(["/_sitemap","/api","/__dev"]),STRING_SET_PERSISTENCE);const ue=(0,_react.useRef)(null);const Q=(0,_react.useCallback)(e=>{},[]);const z=(0,_react.useCallback)(e=>{try{if(r){if(!r.onNavigatePath)return;if(!h&&e!=="/"){S(true);return}r.onNavigatePath(e);return}if(x){I.push(e)}else if(y){const{pathname:n,params:o}=(0,_routeTemplate.splitRouteHref)(e);const c=n.startsWith("/")?n.slice(1):n;const p=Object.keys(o).length>0;const k=y.getRootState?.();if(k){const f=findScreenPath(k,c);if(f){const T=buildNestedNavigateAction(f,o);if(T){y.dispatch(T);return}}}y.dispatch(CommonActions.navigate(p?{name:c,params:o}:{name:c}))}else{_reactNative.Alert.alert("Navigation Unavailable","No Expo Router or React Navigation container was found in this app.")}}catch(n){_reactNative.Alert.alert("Navigation Error",String(n))}},[I,y,x,r,h]);const X=(0,_react.useCallback)(()=>{J(e=>!e)},[]);const Y=(0,_react.useCallback)(()=>{if(s.length===0)return;if(!h){S(true);return}D()},[s.length,h,D]);const Z=(0,_react.useCallback)(e=>{H(n=>{const o=new Set(n);if(o.has(e)){o.delete(e)}else{o.add(e)}return o})},[]);const ee=(0,_react.useCallback)(e=>{H(n=>new Set([...n,e]))},[]);const te=(0,_react.useCallback)(()=>{A(!j)},[j]);const ne=(0,_react.useCallback)((e,n)=>{w(e);G(n)},[]);const oe=(0,_react.useCallback)(()=>{w(null)},[]);const se=(0,_react.useCallback)(e=>{w(null);O(e)},[]);const ae=(0,_react.useMemo)(()=>{const e=new Set;s.forEach(n=>{if(n.pathname){e.add(n.pathname)}});return Array.from(e).sort()},[s]);const g=(0,_react.useMemo)(()=>{return s.filter(e=>{if(!e.pathname)return false;const n=Array.from(l).some(o=>e.pathname.includes(o));if(n)return false;if(v.trim()){const o=v.toLowerCase();const c=e.pathname.toLowerCase().includes(o);const p=Object.entries(e.params||{}).some(([k,f])=>{const T=Array.isArray(f)?f.join(" "):f;return k.toLowerCase().includes(o)||T.toLowerCase().includes(o)});return c||p}return true})},[s,l,v]);const re=(0,_react.useMemo)(()=>g.slice(0,E),[g,E]);const P=(0,_react.useMemo)(()=>Math.max(0,g.length-E),[g.length,E]);const M=(0,_react.useMemo)(()=>{const e=new Map;const n=new Map;for(let o=s.length-1;o>=0;o--){const c=s[o];const p=(e.get(c.pathname)||0)+1;e.set(c.pathname,p);n.set(c,p)}return n},[s]);const ie=(0,_react.useMemo)(()=>{return{summary:{total:s.length,filtered:g.length,listening:R,ignoredPatterns:Array.from(l),timestamp:new Date().toISOString()},events:g.map((e,n)=>({index:n,visitNumber:M.get(e)||1,pathname:e.pathname,timestamp:e.timestamp,timestampRelative:(0,_sharedUi.formatRelativeTime)(e.timestamp),params:e.params,segments:e.segments,previousPathname:e.previousPathname,timeSincePrevious:e.timeSincePrevious}))}},[s.length,g,R,l,M]);if(!t)return null;const le=b?_sharedUi.devToolsStorageKeys.modal.root():_sharedUi.devToolsStorageKeys.routeEvents.modal();const B=null;const F=()=>{if(i){return(0,_jsxRuntime.jsx)(_RouteEventDetail.RouteEventDetail,{event:i,visitNumber:_,onNavigate:z})}if(m==="routes"){return x||r?.sitemap?(0,_jsxRuntime.jsx)(_RoutesSitemap.RoutesSitemap,{style:styles.contentWrapper,injectedRoutes:r?.sitemap?.routes,injectedSource:r?.sitemap?.source??null,injectedLastUpdatedAt:r?.sitemap?.lastUpdatedAt??null,onNavigateRoute:r?ce:void 0}):(0,_jsxRuntime.jsx)(_ReactNavigationRoutes.ReactNavigationRoutes,{style:styles.contentWrapper})}if(m==="stack"){return(0,_jsxRuntime.jsx)(_NavigationStack.NavigationStack,{style:styles.contentWrapper,injectedStack:r?r.stack??[]:void 0,onAction:r?.onStackAction,onCopyValueChange:K})}if(j){return(0,_jsxRuntime.jsx)(_RouteFilterViewV.RouteFilterViewV2,{ignoredPatterns:l,onTogglePattern:Z,onAddPattern:ee,availablePathnames:ae})}const e=s.length>0;if(g.length===0){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.contentWrapper,testID:"buoy-routes-events",children:[e&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.searchContainer,testID:"buoy-routes-search-field",children:(0,_jsxRuntime.jsx)(_sharedUi.SearchBar,{value:v,onChange:V,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),(0,_jsxRuntime.jsx)(_sharedUi.ToolEmptyState,{testID:"buoy-routes-empty",...(0,_sharedUi.resolveListEmptyState)({subject:"route events",search:v,total:s.length,capturing:R,waiting:{otto:"walking",title:"No route events yet",message:"Navigation events will appear here"},paused:{title:"Event listener is paused",message:"Press play to start monitoring"}})})]})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.contentWrapper,testID:"buoy-routes-events",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.searchContainer,testID:"buoy-routes-search-field",children:(0,_jsxRuntime.jsx)(_sharedUi.SearchBar,{value:v,onChange:V,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),P>0&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.lockedEventsBanner,testID:"buoy-routes-locked-banner",children:[(0,_jsxRuntime.jsx)(_sharedUi.Lock,{size:14,color:_sharedUi.night.color.warning}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.lockedEventsBannerText,testID:"buoy-routes-locked-banner-text",children:[P," older ",P===1?"event":"events"," locked"]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.lockedEventsBannerSubtext,children:"Upgrade to Pro for full history"})]}),(0,_jsxRuntime.jsx)(_RouteEventsTimeline.RouteEventsTimeline,{events:re,visitCounts:M,onNavigate:z,onSelectEvent:ne})]})};const L=i?(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:oe}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:i.pathname,testID:"buoy-routes-detail-title"}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Actions,{children:(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{testID:"buoy-routes-detail-copy",value:{pathname:i.pathname,previousPathname:i.previousPathname,params:i.params,segments:i.segments,timestamp:i.timestamp,timestampISO:new Date(i.timestamp).toISOString(),timeSincePrevious:i.timeSincePrevious,visitNumber:_},buttonStyle:styles.iconButton})})]}):j?(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:()=>A(false)}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"Filters",testID:"buoy-routes-filters-title"})]}):(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[a&&(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:a}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"",noMargin:true,children:(0,_jsxRuntime.jsx)(_sharedUi.TabSelector,{tabs:[{key:"routes",label:x?"Routes":"Screens"},{key:"events",label:`Events${s.length>0&&m!=="events"?` (${s.length})`:""}`},{key:"stack",label:"Stack"}],activeTab:m,onTabChange:e=>se(e),testIDPrefix:"buoy-routes-tab"})}),(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions,{children:[m==="stack"&&(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:U,buttonStyle:styles.iconButton,testID:"buoy-routes-stack-copy"}),m==="events"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:ie,buttonStyle:styles.iconButton,testID:"buoy-routes-copy"}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:te,style:[styles.iconButton,l.size>0&&styles.activeFilterButton],testID:"buoy-routes-filters",accessibilityRole:"button",accessibilityLabel:l.size>0?`Route filters, ${l.size} active`:"Route filters",children:(0,_jsxRuntime.jsx)(_sharedUi.Filter,{size:14,color:l.size>0?_sharedUi.night.color.accent:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_sharedUi.PowerToggleButton,{isEnabled:R,onToggle:X,accessibilityLabel:"Toggle route event monitoring",testID:"buoy-routes-power"}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:Y,style:styles.iconButton,testID:"buoy-routes-clear",accessibilityRole:"button",accessibilityLabel:"Clear route events",children:(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:14,color:_sharedUi.night.color.danger})})]})]})]});const ce=e=>{if(e.type==="layout"||e.type==="group")return;const n=e.type==="index"||e.path==="/";if(!h&&!n){S(true);return}r?.onNavigateRoute?.(e)};const W=(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:N,onClose:()=>S(false),featureName:"Route Event Management"});if(q){return(0,_jsxRuntime.jsxs)(_sharedUi.TickProvider,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.inlineRoot,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.inlineHeader,..._sharedUi.windowDragProps,children:L}),F(),B]}),W]})}return(0,_jsxRuntime.jsx)(_sharedUi.TickProvider,{children:(0,_jsxRuntime.jsxs)(_sharedUi.JsModal,{visible:t,onClose:u,onMinimize:d,persistenceKey:le,header:{showToggleButton:true,customContent:L},onModeChange:Q,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:true,styles:{},footer:B,footerHeight:B?68:0,children:[F(),W]})})}function RoutesToolView(t={}){return(0,_jsxRuntime.jsx)(RouteEventsModalWithTabs,{...t,inline:true,visible:true,onClose:()=>{}})}const styles=_reactNative.StyleSheet.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:_sharedUi.buoyColors.border,backgroundColor:"transparent"},iconButton:{padding:6,borderRadius:6,backgroundColor:_sharedUi.night.color.buttonSurface},activeFilterButton:{backgroundColor:_sharedUi.night.color.accentSoft},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:_sharedUi.night.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:_sharedUi.monoFont,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:_sharedUi.night.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:_sharedUi.monoFont},contentWrapper:{flex:1},statsContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:_sharedUi.night.color.surface,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border},statsText:{fontSize:11,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,textAlign:"center"},statsWarning:{color:_sharedUi.night.color.warning,fontWeight:"600"},searchContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:"transparent"},lockedEventsBanner:{flexDirection:"row",alignItems:"center",gap:8,backgroundColor:_sharedUi.night.color.warningSoft,borderWidth:1,borderColor:_sharedUi.night.color.warning+"30",borderRadius:8,paddingVertical:10,paddingHorizontal:14,marginHorizontal:16,marginBottom:8},lockedEventsBannerText:{fontSize:12,fontWeight:"600",color:_sharedUi.night.color.warning,fontFamily:_sharedUi.monoFont},lockedEventsBannerSubtext:{fontSize:11,color:_sharedUi.night.color.textSecondary,marginLeft:"auto"}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.RouteEventsModalWithTabs=RouteEventsModalWithTabs;exports.RoutesToolView=RoutesToolView;var _react=require("react");var _reactNative=require("react-native");var _safeReactNavigation=require("../utils/safeReactNavigation");var _sharedUi=require("@buoy-gg/shared-ui");var _license=require("@buoy-gg/license");var _useRouteEvents=require("../hooks/useRouteEvents");var _routeEventStore=require("../stores/routeEventStore");var _RouteEventDetail=require("./RouteEventDetail");var _RouteFilterViewV=require("./RouteFilterViewV2");var _RoutesSitemap=require("./RoutesSitemap");var _ReactNavigationRoutes=require("./ReactNavigationRoutes");var _NavigationStack=require("./NavigationStack");var _RouteEventsTimeline=require("./RouteEventsTimeline");var _routeTemplate=require("../utils/routeTemplate");var _jsxRuntime=require("react/jsx-runtime");const CommonActions=(0,_safeReactNavigation.getCommonActions)();const TAB_PERSISTENCE={parse:t=>t==="routes"||t==="events"||t==="stack"?t:void 0,serialize:t=>t};const BOOLEAN_PERSISTENCE={parse:t=>t==="true",serialize:t=>t.toString()};const STRING_SET_PERSISTENCE={parse:t=>new Set(JSON.parse(t)),serialize:t=>JSON.stringify(Array.from(t))};function findScreenPath(t,u){if(!t||!t.routes)return null;for(const a of t.routes){if(a.name===u){return[a.name]}if(a.state){const d=findScreenPath(a.state,u);if(d){return[a.name,...d]}}}return null}function buildNestedNavigateAction(t,u){if(t.length===0)return null;const a=u&&Object.keys(u).length>0?u:void 0;if(t.length===1){return CommonActions.navigate(a?{name:t[0],params:a}:{name:t[0]})}let d=a?{screen:t[t.length-1],params:a}:{screen:t[t.length-1]};for(let b=t.length-2;b>=1;b--){d={screen:t[b],params:d}}return CommonActions.navigate({name:t[0],params:d})}function RouteEventsModalWithTabs({visible:t,onClose:u,onBack:a,onMinimize:d,enableSharedModalDimensions:b=false,inline:q=false,remote:r}){const I=(0,_sharedUi.useSafeRouter)();const y=(0,_safeReactNavigation.useSafeNavigationContainerRef)();const x=_reactNative.Platform.OS==="web"||(0,_sharedUi.isExpoRouterAvailable)();const[m,O]=(0,_sharedUi.usePersistedState)(_sharedUi.devToolsStorageKeys.routeEvents.activeTab(),"events",TAB_PERSISTENCE);const[N,S]=(0,_react.useState)(false);const[U,K]=(0,_react.useState)("");const h=(0,_license.useIsPro)();const E=(0,_sharedUi.useLimit)("routeEvents.entries");(0,_react.useEffect)(()=>{if(N&&h){S(false)}},[N,h]);const[C,J]=(0,_sharedUi.usePersistedState)(_sharedUi.devToolsStorageKeys.routeEvents.isMonitoring(),true,BOOLEAN_PERSISTENCE);const{events:s,clearEvents:D,isListening:$}=(0,_useRouteEvents.useRouteEvents)({enabled:C});const R=C&&$;(0,_react.useEffect)(()=>{_routeEventStore.routeEventStore.setBootCapture(C)},[C]);const[j,A]=(0,_react.useState)(false);const[i,w]=(0,_react.useState)(null);const[_,G]=(0,_react.useState)(1);const[v,V]=(0,_react.useState)("");const[l,H]=(0,_sharedUi.usePersistedState)(_sharedUi.devToolsStorageKeys.routeEvents.eventFilters(),new Set(["/_sitemap","/api","/__dev"]),STRING_SET_PERSISTENCE);const ue=(0,_react.useRef)(null);const Q=(0,_react.useCallback)(e=>{},[]);const z=(0,_react.useCallback)(e=>{try{if(r){if(!r.onNavigatePath)return;if(!h&&e!=="/"){S(true);return}r.onNavigatePath(e);return}if(x){I.push(e)}else if(y){const{pathname:n,params:o}=(0,_routeTemplate.splitRouteHref)(e);const c=n.startsWith("/")?n.slice(1):n;const p=Object.keys(o).length>0;const k=y.getRootState?.();if(k){const f=findScreenPath(k,c);if(f){const T=buildNestedNavigateAction(f,o);if(T){y.dispatch(T);return}}}y.dispatch(CommonActions.navigate(p?{name:c,params:o}:{name:c}))}else{_reactNative.Alert.alert("Navigation Unavailable","No Expo Router or React Navigation container was found in this app.")}}catch(n){_reactNative.Alert.alert("Navigation Error",String(n))}},[I,y,x,r,h]);const X=(0,_react.useCallback)(()=>{J(e=>!e)},[]);const Y=(0,_react.useCallback)(()=>{if(s.length===0)return;if(!h){S(true);return}D()},[s.length,h,D]);const Z=(0,_react.useCallback)(e=>{H(n=>{const o=new Set(n);if(o.has(e)){o.delete(e)}else{o.add(e)}return o})},[]);const ee=(0,_react.useCallback)(e=>{H(n=>new Set([...n,e]))},[]);const te=(0,_react.useCallback)(()=>{A(!j)},[j]);const ne=(0,_react.useCallback)((e,n)=>{w(e);G(n)},[]);const oe=(0,_react.useCallback)(()=>{w(null)},[]);const se=(0,_react.useCallback)(e=>{w(null);O(e)},[]);const ae=(0,_react.useMemo)(()=>{const e=new Set;s.forEach(n=>{if(n.pathname){e.add(n.pathname)}});return Array.from(e).sort()},[s]);const g=(0,_react.useMemo)(()=>{return s.filter(e=>{if(!e.pathname)return false;const n=Array.from(l).some(o=>e.pathname.includes(o));if(n)return false;if(v.trim()){const o=v.toLowerCase();const c=e.pathname.toLowerCase().includes(o);const p=Object.entries(e.params||{}).some(([k,f])=>{const T=Array.isArray(f)?f.join(" "):f;return k.toLowerCase().includes(o)||T.toLowerCase().includes(o)});return c||p}return true})},[s,l,v]);const re=(0,_react.useMemo)(()=>g.slice(0,E),[g,E]);const P=(0,_react.useMemo)(()=>Math.max(0,g.length-E),[g.length,E]);const M=(0,_react.useMemo)(()=>{const e=new Map;const n=new Map;for(let o=s.length-1;o>=0;o--){const c=s[o];const p=(e.get(c.pathname)||0)+1;e.set(c.pathname,p);n.set(c,p)}return n},[s]);const ie=(0,_react.useMemo)(()=>{return{summary:{total:s.length,filtered:g.length,listening:R,ignoredPatterns:Array.from(l),timestamp:new Date().toISOString()},events:g.map((e,n)=>({index:n,visitNumber:M.get(e)||1,pathname:e.pathname,timestamp:e.timestamp,timestampRelative:(0,_sharedUi.formatRelativeTime)(e.timestamp),params:e.params,segments:e.segments,previousPathname:e.previousPathname,timeSincePrevious:e.timeSincePrevious}))}},[s.length,g,R,l,M]);if(!t)return null;const le=b?_sharedUi.devToolsStorageKeys.modal.root():_sharedUi.devToolsStorageKeys.routeEvents.modal();const B=null;const F=()=>{if(i){return(0,_jsxRuntime.jsx)(_RouteEventDetail.RouteEventDetail,{event:i,visitNumber:_,onNavigate:z})}if(m==="routes"){return x||r?.sitemap?(0,_jsxRuntime.jsx)(_RoutesSitemap.RoutesSitemap,{style:styles.contentWrapper,injectedRoutes:r?.sitemap?.routes,injectedSource:r?.sitemap?.source??null,injectedLastUpdatedAt:r?.sitemap?.lastUpdatedAt??null,onNavigateRoute:r?ce:void 0}):(0,_jsxRuntime.jsx)(_ReactNavigationRoutes.ReactNavigationRoutes,{style:styles.contentWrapper})}if(m==="stack"){return(0,_jsxRuntime.jsx)(_NavigationStack.NavigationStack,{style:styles.contentWrapper,injectedStack:r?r.stack??[]:void 0,onAction:r?.onStackAction,onCopyValueChange:K})}if(j){return(0,_jsxRuntime.jsx)(_RouteFilterViewV.RouteFilterViewV2,{ignoredPatterns:l,onTogglePattern:Z,onAddPattern:ee,availablePathnames:ae})}const e=s.length>0;if(g.length===0){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.contentWrapper,testID:"buoy-routes-events",children:[e&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.searchContainer,testID:"buoy-routes-search-field",children:(0,_jsxRuntime.jsx)(_sharedUi.SearchBar,{value:v,onChange:V,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),(0,_jsxRuntime.jsx)(_sharedUi.ToolEmptyState,{testID:"buoy-routes-empty",...(0,_sharedUi.resolveListEmptyState)({subject:"route events",search:v,total:s.length,capturing:R,waiting:{otto:"walking",title:"No route events yet",message:"Navigation events will appear here"},paused:{title:"Event listener is paused",message:"Press play to start monitoring"}})})]})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.contentWrapper,testID:"buoy-routes-events",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.searchContainer,testID:"buoy-routes-search-field",children:(0,_jsxRuntime.jsx)(_sharedUi.SearchBar,{value:v,onChange:V,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),P>0&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.lockedEventsBanner,testID:"buoy-routes-locked-banner",children:[(0,_jsxRuntime.jsx)(_sharedUi.Lock,{size:14,color:_sharedUi.night.color.warning}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.lockedEventsBannerText,testID:"buoy-routes-locked-banner-text",children:[P," older ",P===1?"event":"events"," locked"]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.lockedEventsBannerSubtext,children:"Upgrade to Pro for full history"})]}),(0,_jsxRuntime.jsx)(_RouteEventsTimeline.RouteEventsTimeline,{events:re,visitCounts:M,onNavigate:z,onSelectEvent:ne})]})};const L=i?(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:oe}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:i.pathname,testID:"buoy-routes-detail-title"}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Actions,{children:(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{testID:"buoy-routes-detail-copy",value:{pathname:i.pathname,previousPathname:i.previousPathname,params:i.params,segments:i.segments,timestamp:i.timestamp,timestampISO:new Date(i.timestamp).toISOString(),timeSincePrevious:i.timeSincePrevious,visitNumber:_},buttonStyle:styles.iconButton})})]}):j?(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:()=>A(false)}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"Filters",testID:"buoy-routes-filters-title"})]}):(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[a&&(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:a}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"",noMargin:true,children:(0,_jsxRuntime.jsx)(_sharedUi.TabSelector,{tabs:[{key:"routes",label:x?"Routes":"Screens"},{key:"events",label:`Events${s.length>0&&m!=="events"?` (${s.length})`:""}`},{key:"stack",label:"Stack"}],activeTab:m,onTabChange:e=>se(e),testIDPrefix:"buoy-routes-tab"})}),(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions,{children:[m==="stack"&&(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:U,buttonStyle:styles.iconButton,testID:"buoy-routes-stack-copy"}),m==="events"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:ie,buttonStyle:styles.iconButton,testID:"buoy-routes-copy"}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:te,style:[styles.iconButton,l.size>0&&styles.activeFilterButton],testID:"buoy-routes-filters",accessibilityRole:"button",accessibilityLabel:l.size>0?`Route filters, ${l.size} active`:"Route filters",children:(0,_jsxRuntime.jsx)(_sharedUi.Filter,{size:14,color:l.size>0?_sharedUi.night.color.accent:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_sharedUi.PowerToggleButton,{isEnabled:R,onToggle:X,accessibilityLabel:"Toggle route event monitoring",testID:"buoy-routes-power"}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:Y,style:styles.iconButton,testID:"buoy-routes-clear",accessibilityRole:"button",accessibilityLabel:"Clear route events",children:(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:14,color:_sharedUi.night.color.danger})})]})]})]});const ce=e=>{if(e.type==="layout"||e.type==="group")return;const n=e.type==="index"||e.path==="/";if(!h&&!n){S(true);return}r?.onNavigateRoute?.(e)};const W=(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:N,onClose:()=>S(false),featureName:"Route Event Management"});if(q){return(0,_jsxRuntime.jsxs)(_sharedUi.TickProvider,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.inlineRoot,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.inlineHeader,..._sharedUi.windowDragProps,children:L}),F(),B]}),W]})}return(0,_jsxRuntime.jsx)(_sharedUi.TickProvider,{children:(0,_jsxRuntime.jsxs)(_sharedUi.JsModal,{visible:t,onClose:u,onMinimize:d,persistenceKey:le,header:{showToggleButton:true,customContent:L},onModeChange:Q,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:true,styles:{},footer:B,footerHeight:B?68:0,children:[F(),W]})})}function RoutesToolView(t={}){return(0,_jsxRuntime.jsx)(RouteEventsModalWithTabs,{...t,inline:true,visible:true,onClose:()=>{}})}const styles=_reactNative.StyleSheet.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:_sharedUi.buoyColors.border,backgroundColor:"transparent"},iconButton:{padding:6,borderRadius:6,backgroundColor:_sharedUi.night.color.buttonSurface},activeFilterButton:{backgroundColor:_sharedUi.night.color.accentSoft},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:_sharedUi.night.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:_sharedUi.monoFont,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:_sharedUi.night.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:_sharedUi.monoFont},contentWrapper:{flex:1},statsContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:_sharedUi.night.color.surface,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border},statsText:{fontSize:11,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,textAlign:"center"},statsWarning:{color:_sharedUi.night.color.warning,fontWeight:"600"},searchContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:"transparent"},lockedEventsBanner:{flexDirection:"row",alignItems:"center",gap:8,backgroundColor:_sharedUi.night.color.warningSoft,borderWidth:1,borderColor:_sharedUi.night.color.warning+"30",borderRadius:8,paddingVertical:10,paddingHorizontal:14,marginHorizontal:16,marginBottom:8},lockedEventsBannerText:{fontSize:12,fontWeight:"600",color:_sharedUi.night.color.warning,fontFamily:_sharedUi.monoFont},lockedEventsBannerSubtext:{fontSize:11,color:_sharedUi.night.color.textSecondary,marginLeft:"auto"}});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.RoutesSitemap=RoutesSitemap;var _react=require("react");var _sharedUi=require("@buoy-gg/shared-ui");var _reactNative=require("react-native");var _license=require("@buoy-gg/license");var _useRouteSitemap=require("../useRouteSitemap");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");const IS_DESKTOP=_reactNative.Platform.OS==="web";const ACTION_ICON_SIZE=IS_DESKTOP?22:16;const HOME_ROUTE={path:"/",name:"index",type:"index",params:[],nodeType:"route",contextKey:"/",isInternal:false,children:[],depth:0};function RoutesSitemap({style:e,injectedRoutes:s,injectedSource:l,injectedLastUpdatedAt:h,onNavigateRoute:d}){const[r,p]=(0,_react.useState)("");const[x,a]=(0,_react.useState)(false);const[m,C]=(0,_react.useState)(new Set(["Static Routes","Dynamic Routes"]));const[u,b]=(0,_react.useState)(false);const[S,T]=(0,_react.useState)(false);const f=(0,_license.useIsPro)();(0,_react.useEffect)(()=>{if(S&&f){T(false)}},[S,f]);const y=(0,_sharedUi.useSafeRouter)();const{groups:j,stats:n,isLoaded:W,isSupported:$,filteredRoutes:w,routes:L,refresh:F,lastUpdatedAt:D,source:I}=(0,_useRouteSitemap.useRouteSitemap)({searchQuery:r,sortBy:"path",injectedRoutes:s,injectedSource:l,injectedLastUpdatedAt:h});const H=(0,_react.useMemo)(()=>{return{summary:{total:n.total,static:n.static,dynamic:n.dynamic,layouts:n.layouts,groups:n.groups,timestamp:new Date().toISOString()},groups:j.map(t=>({title:t.title,description:t.description,count:t.routes.length,routes:t.routes.map(o=>({path:o.path,name:o.name,type:o.type,params:o.params,depth:o.depth,hasChildren:o.children.length>0,childrenCount:o.children.length}))})),allRoutes:L.map(t=>t.path)}},[j,n,L]);const E=(0,_react.useCallback)(t=>{C(o=>{const i=new Set(o);if(i.has(t)){i.delete(t)}else{i.add(t)}return i})},[]);const B=(0,_react.useCallback)((t,o=0,i={})=>{const v=t.params;if(o>=v.length){let c=t.path;Object.entries(i).forEach(([g,k])=>{if(t.type==="catch-all"){c=c.replace(`[...${g}]`,k)}else{c=c.replace(`[${g}]`,k)}});try{y.push(c)}catch(g){_reactNative.Alert.alert("Navigation Error",String(g))}return}const V=v[o];const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.RoutesSitemap=RoutesSitemap;var _react=require("react");var _sharedUi=require("@buoy-gg/shared-ui");var _reactNative=require("react-native");var _license=require("@buoy-gg/license");var _useRouteSitemap=require("../useRouteSitemap");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");const IS_DESKTOP=_reactNative.Platform.OS==="web"&&!(0,_license.isCapacitorNative)();const ACTION_ICON_SIZE=IS_DESKTOP?22:16;const HOME_ROUTE={path:"/",name:"index",type:"index",params:[],nodeType:"route",contextKey:"/",isInternal:false,children:[],depth:0};function RoutesSitemap({style:e,injectedRoutes:s,injectedSource:l,injectedLastUpdatedAt:h,onNavigateRoute:d}){const[r,p]=(0,_react.useState)("");const[x,a]=(0,_react.useState)(false);const[m,C]=(0,_react.useState)(new Set(["Static Routes","Dynamic Routes"]));const[u,b]=(0,_react.useState)(false);const[S,T]=(0,_react.useState)(false);const f=(0,_license.useIsPro)();(0,_react.useEffect)(()=>{if(S&&f){T(false)}},[S,f]);const y=(0,_sharedUi.useSafeRouter)();const{groups:j,stats:n,isLoaded:W,isSupported:$,filteredRoutes:w,routes:L,refresh:F,lastUpdatedAt:D,source:I}=(0,_useRouteSitemap.useRouteSitemap)({searchQuery:r,sortBy:"path",injectedRoutes:s,injectedSource:l,injectedLastUpdatedAt:h});const H=(0,_react.useMemo)(()=>{return{summary:{total:n.total,static:n.static,dynamic:n.dynamic,layouts:n.layouts,groups:n.groups,timestamp:new Date().toISOString()},groups:j.map(t=>({title:t.title,description:t.description,count:t.routes.length,routes:t.routes.map(o=>({path:o.path,name:o.name,type:o.type,params:o.params,depth:o.depth,hasChildren:o.children.length>0,childrenCount:o.children.length}))})),allRoutes:L.map(t=>t.path)}},[j,n,L]);const E=(0,_react.useCallback)(t=>{C(o=>{const i=new Set(o);if(i.has(t)){i.delete(t)}else{i.add(t)}return i})},[]);const B=(0,_react.useCallback)((t,o=0,i={})=>{const v=t.params;if(o>=v.length){let c=t.path;Object.entries(i).forEach(([g,k])=>{if(t.type==="catch-all"){c=c.replace(`[...${g}]`,k)}else{c=c.replace(`[${g}]`,k)}});try{y.push(c)}catch(g){_reactNative.Alert.alert("Navigation Error",String(g))}return}const V=v[o];const G=t.type==="catch-all"?`[...${V}]`:`[${V}]`;_reactNative.Alert.prompt("Enter Parameter Value",`Enter value for ${G}:
|
|
2
2
|
|
|
3
|
-
Route: ${t.path}`,[{text:"Cancel",style:"cancel"},{text:o<v.length-1?"Next":"Navigate",onPress:c=>{if(c&&c.trim()){const g={...i,[V]:c.trim()};B(t,o+1,g)}else{_reactNative.Alert.alert("Invalid Value","Please enter a value for the parameter")}}}],"plain-text")},[y]);const R=(0,_react.useCallback)((t,o)=>{if(d){d(t);return}if(!f&&!o?.bypassPro){T(true);return}if(t.type==="layout"||t.type==="group"){_reactNative.Alert.alert("Cannot Navigate",`${t.type==="layout"?"Layouts":"Route groups"} are not navigable routes`);return}if(t.type==="dynamic"||t.type==="catch-all"){if(t.params.length===0){try{y.push(t.path)}catch(i){_reactNative.Alert.alert("Navigation Error",String(i))}return}B(t);return}try{y.push(t.path)}catch(i){_reactNative.Alert.alert("Navigation Error",String(i))}},[y,B,f,d]);const P=(0,_react.useCallback)(()=>{R(HOME_ROUTE,{bypassPro:true})},[R]);const O=(0,_react.useCallback)(()=>{if(u)return;b(true);F();setTimeout(()=>b(false),400)},[u,F]);const A=(0,_react.useMemo)(()=>{if(!D)return"Awaiting route data";return`Updated ${(0,_sharedUi.formatRelativeTime)(D)}`},[D]);const G=(0,_react.useMemo)(()=>{if(!I)return"Source: unknown";return`Source: ${I}`},[I]);const z=(0,_react.useMemo)(()=>{if(r&&w.length>0){return[{title:"Search Results",icon:"",routes:w}]}return j},[r,w,j]);if(!W){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.container,e],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.loadingContainer,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.loadingText,testID:"buoy-routes-sitemap-loading",children:$?"Loading routes...":"Route sitemap isn't available on the dashboard \u2014 the route tree lives on the device. Use the Events tab to see navigation here."})})})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,e],children:[x&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.searchContainer,testID:"buoy-routes-sitemap-search-field",children:[(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:16,color:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.searchInput,placeholder:"Search routes...",placeholderTextColor:_sharedUi.night.color.placeholder,value:r,onChangeText:p,autoCapitalize:"none",autoCorrect:false,autoFocus:true,testID:"buoy-routes-sitemap-search",accessibilityLabel:"Search routes"}),r.length>0&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>p(""),style:styles.clearButton,testID:"buoy-routes-sitemap-search-clear",accessibilityRole:"button",accessibilityLabel:"Clear route search",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.clearButtonText,children:"\u2715"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.closeSearchButton,onPress:()=>{a(false);p("")},testID:"buoy-routes-sitemap-search-done",accessibilityRole:"button",accessibilityLabel:"Done searching routes",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.closeSearchText,children:"Done"})})]}),(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{testID:"buoy-routes-sitemap-scroll",style:styles.scrollView,contentContainerStyle:styles.scrollContent,children:[!x&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,IS_DESKTOP&&styles.iconButtonDesktop],onPress:P,accessibilityLabel:"Go to home route",accessibilityRole:"button",testID:"buoy-routes-sitemap-home",children:(0,_jsxRuntime.jsx)(_sharedUi.Home,{size:ACTION_ICON_SIZE,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Home"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_sharedUi.CopyButton,{value:H,testID:"buoy-routes-sitemap-copy",size:IS_DESKTOP?ACTION_ICON_SIZE:14,buttonStyle:IS_DESKTOP?styles.actionButtonHeaderDesktop:styles.actionButtonHeader}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Copy"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,IS_DESKTOP&&styles.iconButtonDesktop,u&&styles.refreshButtonDisabled],onPress:O,disabled:u,testID:"buoy-routes-sitemap-refresh",accessibilityRole:"button",accessibilityLabel:"Refresh route tree",children:(0,_jsxRuntime.jsx)(_sharedUi.RefreshCw,{size:ACTION_ICON_SIZE,color:u?_sharedUi.night.color.textTertiary:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Refresh"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,IS_DESKTOP&&styles.iconButtonDesktop],onPress:()=>a(true),testID:"buoy-routes-sitemap-search-open",accessibilityRole:"button",accessibilityLabel:"Search routes",children:(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:ACTION_ICON_SIZE,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Search"})]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statsGrid,children:[(0,_jsxRuntime.jsx)(StatItem,{value:n.total,label:"Total",id:"total"}),(0,_jsxRuntime.jsx)(StatItem,{value:n.static,label:"Static",id:"static"}),(0,_jsxRuntime.jsx)(StatItem,{value:n.dynamic,label:"Dynamic",id:"dynamic"}),(0,_jsxRuntime.jsx)(StatItem,{value:n.catchAll,label:"Catch-All",id:"catch-all"}),(0,_jsxRuntime.jsx)(StatItem,{value:n.layouts,label:"Layouts",id:"layouts"}),(0,_jsxRuntime.jsx)(StatItem,{value:n.groups,label:"Groups",id:"groups"})]})]}),z.length===0?(0,_jsxRuntime.jsx)(_sharedUi.ToolEmptyState,{testID:"buoy-routes-sitemap-empty",otto:"map",title:"No routes found",message:"Nothing in the router matches. Clear the search to see the whole tree."}):z.map(t=>(0,_jsxRuntime.jsx)(RouteGroupView,{group:t,isExpanded:r.length>0||m.has(t.title),onToggleExpand:()=>E(t.title),onNavigate:R},t.title)),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.metaFooter,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.metaText,testID:"buoy-routes-sitemap-updated",children:A}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sourceBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sourceText,testID:"buoy-routes-sitemap-source",children:G})})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:S,onClose:()=>T(false),featureName:"Route Navigation"})]})}function StatItem({value:e,label:s,id:l}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statItem,testID:`buoy-routes-stat-${l}`,accessibilityLabel:`${s}, ${e}`,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statValue,testID:`buoy-routes-stat-${l}-value`,children:e}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statLabel,children:s})]})}function RouteGroupView({group:e,isExpanded:s,onToggleExpand:l,onNavigate:h}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.groupContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.groupHeader,onPress:l,activeOpacity:.7,testID:(0,_testIDs.sitemapGroupTestID)(e.title),accessibilityRole:"button",accessibilityLabel:`${e.title}, ${e.routes.length} routes`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.groupHeaderLeft,children:[s?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupTitle,children:e.title})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.groupBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupCount,testID:`${(0,_testIDs.sitemapGroupTestID)(e.title)}-count`,children:e.routes.length})})]}),e.description&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.groupDescription,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupDescriptionText,children:e.description})}),s&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.routesList,children:e.routes.map((d,r)=>(0,_jsxRuntime.jsx)(RouteItemView,{route:d,onNavigate:h},`${d.path}-${r}`))})]})}function RouteItemView({route:e,depth:s=0,onNavigate:l}){const[h,d]=(0,_react.useState)(false);const r=e.children.length>0;const p=getRouteTypeColor(e.type);const x=e.type!=="layout"&&e.type!=="group";const a=(0,_testIDs.sitemapRouteTestID)(e.path);const m=r;const C=m?h:true;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.routeItem,{marginLeft:s*12}],testID:a,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeCard,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeHeader,children:[m?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.routeHeaderLeft,onPress:()=>d(!h),activeOpacity:.7,testID:`${a}-toggle`,accessibilityRole:"button",accessibilityLabel:`${e.path}, ${e.type}, ${e.children.length} nested`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandIndicator,children:h?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.routePath,numberOfLines:3,testID:`${a}-path`,children:e.path})]}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeHeaderLeft,accessible:true,accessibilityLabel:`${e.path}, ${e.type}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandIndicator}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.routePath,numberOfLines:3,testID:`${a}-path`,children:e.path})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeHeaderActions,children:[r&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.childCountBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.childCountText,testID:`${a}-children-count`,children:e.children.length})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.typeTag,{backgroundColor:`${p}15`,borderColor:`${p}40`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.typeText,{color:p}],testID:`${a}-type`,children:e.type.toUpperCase()})}),(0,_jsxRuntime.jsx)(_sharedUi.InlineCopyButton,{value:e.path,buttonStyle:styles.iconAction,testID:`${a}-copy`}),x&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.goButton,onPress:()=>l(e),activeOpacity:.7,testID:`${a}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${e.path}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.goButtonText,children:"Go"})})]})]}),C&&r&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.childrenContainer,children:e.children.map((u,b)=>(0,_jsxRuntime.jsx)(RouteItemView,{route:u,depth:s+1,onNavigate:l},`${u.path}-${b}`))})]})})}function getRouteTypeColor(e){switch(e){case"static":return"#3B82F6";case"dynamic":return"#F59E0B";case"catch-all":return"#EC4899";case"index":return"#10B981";case"layout":return"#8B5CF6";case"group":return"#6366F1";case"not-found":return"#EF4444";default:return"#6B7280"}}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},loadingText:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont,textAlign:"center",lineHeight:20,paddingHorizontal:32,maxWidth:420},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,paddingBottom:4},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"30%",minWidth:90,backgroundColor:_sharedUi.night.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},statLabel:{fontSize:10,color:_sharedUi.night.color.textTertiary,marginTop:4,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5},actionWrapper:{flex:1,alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionWrapperDesktop:{gap:8,minWidth:72},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated},actionButtonHeaderDesktop:{padding:12,borderRadius:8,backgroundColor:_sharedUi.night.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},iconButtonDesktop:{padding:12,borderRadius:8,backgroundColor:_sharedUi.night.color.surfaceElevated},actionLabel:{fontSize:8,color:_sharedUi.night.color.textTertiary,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5},actionLabelDesktop:{fontSize:12},refreshButtonDisabled:{opacity:.5},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:_sharedUi.night.color.border},metaText:{fontSize:12,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},sourceText:{fontSize:11,color:_sharedUi.night.color.textSecondary,textTransform:"capitalize",fontFamily:_sharedUi.monoFont},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border},searchInput:{flex:1,color:_sharedUi.night.color.text,fontSize:14,fontFamily:_sharedUi.monoFont},clearButton:{padding:4},clearButtonText:{color:_sharedUi.night.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:_sharedUi.night.color.accent,fontSize:14,fontWeight:"600",fontFamily:_sharedUi.monoFont},scrollView:{flex:1},scrollContent:{paddingBottom:8},emptyState:{padding:32,alignItems:"center"},emptyText:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:_sharedUi.night.color.surface,borderLeftWidth:3,borderLeftColor:_sharedUi.night.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:_sharedUi.monoFont},routesList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:_sharedUi.night.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:_sharedUi.night.color.fillTertiary},groupDescriptionText:{fontSize:11,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,lineHeight:16},routeItem:{marginBottom:6},routeCard:{backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,overflow:"hidden",shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},routeHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:7,paddingHorizontal:10,gap:8},expandIndicator:{width:18,alignItems:"center"},routeHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},routePath:{fontSize:13,fontWeight:"600",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,flex:1},routeHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},childCountBadge:{backgroundColor:"#6B728015",borderColor:"#6B728040",borderWidth:1,borderRadius:12,paddingHorizontal:7,paddingVertical:2,minWidth:22,alignItems:"center",justifyContent:"center"},childCountText:{fontSize:11,fontWeight:"600",color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont},typeTag:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},typeText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont},iconAction:{width:28,height:24,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated,borderWidth:1,borderColor:_sharedUi.night.color.border,alignItems:"center",justifyContent:"center"},goButton:{height:24,paddingHorizontal:10,borderRadius:4,alignItems:"center",justifyContent:"center",backgroundColor:_sharedUi.night.color.accentSoft,borderWidth:1,borderColor:_sharedUi.night.color.accentBorder},goButtonText:{fontSize:12,color:_sharedUi.night.color.accent,fontFamily:_sharedUi.monoFont,fontWeight:"600"},childrenContainer:{borderLeftWidth:2,borderLeftColor:_sharedUi.night.color.border,marginLeft:16,marginRight:8,marginTop:2,marginBottom:8}});
|
|
3
|
+
Route: ${t.path}`,[{text:"Cancel",style:"cancel"},{text:o<v.length-1?"Next":"Navigate",onPress:c=>{if(c&&c.trim()){const g={...i,[V]:c.trim()};B(t,o+1,g)}else{_reactNative.Alert.alert("Invalid Value","Please enter a value for the parameter")}}}],"plain-text")},[y]);const R=(0,_react.useCallback)((t,o)=>{if(d){d(t);return}if(!f&&!o?.bypassPro){T(true);return}if(t.type==="layout"||t.type==="group"){_reactNative.Alert.alert("Cannot Navigate",`${t.type==="layout"?"Layouts":"Route groups"} are not navigable routes`);return}if(t.type==="dynamic"||t.type==="catch-all"){if(t.params.length===0){try{y.push(t.path)}catch(i){_reactNative.Alert.alert("Navigation Error",String(i))}return}B(t);return}try{y.push(t.path)}catch(i){_reactNative.Alert.alert("Navigation Error",String(i))}},[y,B,f,d]);const P=(0,_react.useCallback)(()=>{R(HOME_ROUTE,{bypassPro:true})},[R]);const O=(0,_react.useCallback)(()=>{if(u)return;b(true);F();setTimeout(()=>b(false),400)},[u,F]);const A=(0,_react.useMemo)(()=>{if(!D)return"Awaiting route data";return`Updated ${(0,_sharedUi.formatRelativeTime)(D)}`},[D]);const N=(0,_react.useMemo)(()=>{if(!I)return"Source: unknown";return`Source: ${I}`},[I]);const z=(0,_react.useMemo)(()=>{if(r&&w.length>0){return[{title:"Search Results",icon:"",routes:w}]}return j},[r,w,j]);if(!W){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.container,e],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.loadingContainer,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.loadingText,testID:"buoy-routes-sitemap-loading",children:$?"Loading routes...":"Route sitemap isn't available on the dashboard \u2014 the route tree lives on the device. Use the Events tab to see navigation here."})})})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,e],children:[x&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.searchContainer,testID:"buoy-routes-sitemap-search-field",children:[(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:16,color:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.searchInput,placeholder:"Search routes...",placeholderTextColor:_sharedUi.night.color.placeholder,value:r,onChangeText:p,autoCapitalize:"none",autoCorrect:false,autoFocus:true,testID:"buoy-routes-sitemap-search",accessibilityLabel:"Search routes"}),r.length>0&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>p(""),style:styles.clearButton,testID:"buoy-routes-sitemap-search-clear",accessibilityRole:"button",accessibilityLabel:"Clear route search",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.clearButtonText,children:"\u2715"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.closeSearchButton,onPress:()=>{a(false);p("")},testID:"buoy-routes-sitemap-search-done",accessibilityRole:"button",accessibilityLabel:"Done searching routes",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.closeSearchText,children:"Done"})})]}),(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{testID:"buoy-routes-sitemap-scroll",style:styles.scrollView,contentContainerStyle:styles.scrollContent,children:[!x&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,IS_DESKTOP&&styles.iconButtonDesktop],onPress:P,accessibilityLabel:"Go to home route",accessibilityRole:"button",testID:"buoy-routes-sitemap-home",children:(0,_jsxRuntime.jsx)(_sharedUi.Home,{size:ACTION_ICON_SIZE,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Home"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_sharedUi.CopyButton,{value:H,testID:"buoy-routes-sitemap-copy",size:IS_DESKTOP?ACTION_ICON_SIZE:14,buttonStyle:IS_DESKTOP?styles.actionButtonHeaderDesktop:styles.actionButtonHeader}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Copy"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,IS_DESKTOP&&styles.iconButtonDesktop,u&&styles.refreshButtonDisabled],onPress:O,disabled:u,testID:"buoy-routes-sitemap-refresh",accessibilityRole:"button",accessibilityLabel:"Refresh route tree",children:(0,_jsxRuntime.jsx)(_sharedUi.RefreshCw,{size:ACTION_ICON_SIZE,color:u?_sharedUi.night.color.textTertiary:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Refresh"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.actionWrapper,IS_DESKTOP&&styles.actionWrapperDesktop],children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.iconButton,IS_DESKTOP&&styles.iconButtonDesktop],onPress:()=>a(true),testID:"buoy-routes-sitemap-search-open",accessibilityRole:"button",accessibilityLabel:"Search routes",children:(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:ACTION_ICON_SIZE,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionLabel,IS_DESKTOP&&styles.actionLabelDesktop],children:"Search"})]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statsGrid,children:[(0,_jsxRuntime.jsx)(StatItem,{value:n.total,label:"Total",id:"total"}),(0,_jsxRuntime.jsx)(StatItem,{value:n.static,label:"Static",id:"static"}),(0,_jsxRuntime.jsx)(StatItem,{value:n.dynamic,label:"Dynamic",id:"dynamic"}),(0,_jsxRuntime.jsx)(StatItem,{value:n.catchAll,label:"Catch-All",id:"catch-all"}),(0,_jsxRuntime.jsx)(StatItem,{value:n.layouts,label:"Layouts",id:"layouts"}),(0,_jsxRuntime.jsx)(StatItem,{value:n.groups,label:"Groups",id:"groups"})]})]}),z.length===0?(0,_jsxRuntime.jsx)(_sharedUi.ToolEmptyState,{testID:"buoy-routes-sitemap-empty",otto:"map",title:"No routes found",message:"Nothing in the router matches. Clear the search to see the whole tree."}):z.map(t=>(0,_jsxRuntime.jsx)(RouteGroupView,{group:t,isExpanded:r.length>0||m.has(t.title),onToggleExpand:()=>E(t.title),onNavigate:R},t.title)),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.metaFooter,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.metaText,testID:"buoy-routes-sitemap-updated",children:A}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sourceBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sourceText,testID:"buoy-routes-sitemap-source",children:N})})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:S,onClose:()=>T(false),featureName:"Route Navigation"})]})}function StatItem({value:e,label:s,id:l}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statItem,testID:`buoy-routes-stat-${l}`,accessibilityLabel:`${s}, ${e}`,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statValue,testID:`buoy-routes-stat-${l}-value`,children:e}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statLabel,children:s})]})}function RouteGroupView({group:e,isExpanded:s,onToggleExpand:l,onNavigate:h}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.groupContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.groupHeader,onPress:l,activeOpacity:.7,testID:(0,_testIDs.sitemapGroupTestID)(e.title),accessibilityRole:"button",accessibilityLabel:`${e.title}, ${e.routes.length} routes`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.groupHeaderLeft,children:[s?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupTitle,children:e.title})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.groupBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupCount,testID:`${(0,_testIDs.sitemapGroupTestID)(e.title)}-count`,children:e.routes.length})})]}),e.description&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.groupDescription,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.groupDescriptionText,children:e.description})}),s&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.routesList,children:e.routes.map((d,r)=>(0,_jsxRuntime.jsx)(RouteItemView,{route:d,onNavigate:h},`${d.path}-${r}`))})]})}function RouteItemView({route:e,depth:s=0,onNavigate:l}){const[h,d]=(0,_react.useState)(false);const r=e.children.length>0;const p=getRouteTypeColor(e.type);const x=e.type!=="layout"&&e.type!=="group";const a=(0,_testIDs.sitemapRouteTestID)(e.path);const m=r;const C=m?h:true;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.routeItem,{marginLeft:s*12}],testID:a,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeCard,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeHeader,children:[m?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.routeHeaderLeft,onPress:()=>d(!h),activeOpacity:.7,testID:`${a}-toggle`,accessibilityRole:"button",accessibilityLabel:`${e.path}, ${e.type}, ${e.children.length} nested`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandIndicator,children:h?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:14,color:_sharedUi.night.color.textSecondary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:14,color:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.routePath,numberOfLines:3,testID:`${a}-path`,children:e.path})]}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeHeaderLeft,accessible:true,accessibilityLabel:`${e.path}, ${e.type}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandIndicator}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.routePath,numberOfLines:3,testID:`${a}-path`,children:e.path})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.routeHeaderActions,children:[r&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.childCountBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.childCountText,testID:`${a}-children-count`,children:e.children.length})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.typeTag,{backgroundColor:`${p}15`,borderColor:`${p}40`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.typeText,{color:p}],testID:`${a}-type`,children:e.type.toUpperCase()})}),(0,_jsxRuntime.jsx)(_sharedUi.InlineCopyButton,{value:e.path,buttonStyle:styles.iconAction,testID:`${a}-copy`}),x&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.goButton,onPress:()=>l(e),activeOpacity:.7,testID:`${a}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${e.path}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.goButtonText,children:"Go"})})]})]}),C&&r&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.childrenContainer,children:e.children.map((u,b)=>(0,_jsxRuntime.jsx)(RouteItemView,{route:u,depth:s+1,onNavigate:l},`${u.path}-${b}`))})]})})}function getRouteTypeColor(e){switch(e){case"static":return"#3B82F6";case"dynamic":return"#F59E0B";case"catch-all":return"#EC4899";case"index":return"#10B981";case"layout":return"#8B5CF6";case"group":return"#6366F1";case"not-found":return"#EF4444";default:return"#6B7280"}}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},loadingText:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont,textAlign:"center",lineHeight:20,paddingHorizontal:32,maxWidth:420},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,paddingBottom:4},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"30%",minWidth:90,backgroundColor:_sharedUi.night.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},statLabel:{fontSize:10,color:_sharedUi.night.color.textTertiary,marginTop:4,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5},actionWrapper:{flex:1,alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionWrapperDesktop:{gap:8,minWidth:72},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated},actionButtonHeaderDesktop:{padding:12,borderRadius:8,backgroundColor:_sharedUi.night.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},iconButtonDesktop:{padding:12,borderRadius:8,backgroundColor:_sharedUi.night.color.surfaceElevated},actionLabel:{fontSize:8,color:_sharedUi.night.color.textTertiary,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.5},actionLabelDesktop:{fontSize:12},refreshButtonDisabled:{opacity:.5},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:_sharedUi.night.color.border},metaText:{fontSize:12,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},sourceText:{fontSize:11,color:_sharedUi.night.color.textSecondary,textTransform:"capitalize",fontFamily:_sharedUi.monoFont},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border},searchInput:{flex:1,color:_sharedUi.night.color.text,fontSize:14,fontFamily:_sharedUi.monoFont},clearButton:{padding:4},clearButtonText:{color:_sharedUi.night.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:_sharedUi.night.color.accent,fontSize:14,fontWeight:"600",fontFamily:_sharedUi.monoFont},scrollView:{flex:1},scrollContent:{paddingBottom:8},emptyState:{padding:32,alignItems:"center"},emptyText:{color:_sharedUi.night.color.textSecondary,fontSize:14,fontFamily:_sharedUi.monoFont},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:_sharedUi.night.color.surface,borderLeftWidth:3,borderLeftColor:_sharedUi.night.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:_sharedUi.monoFont},routesList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:_sharedUi.night.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:_sharedUi.night.color.fillTertiary},groupDescriptionText:{fontSize:11,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,lineHeight:16},routeItem:{marginBottom:6},routeCard:{backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,overflow:"hidden",shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},routeHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:7,paddingHorizontal:10,gap:8},expandIndicator:{width:18,alignItems:"center"},routeHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},routePath:{fontSize:13,fontWeight:"600",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,flex:1},routeHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},childCountBadge:{backgroundColor:"#6B728015",borderColor:"#6B728040",borderWidth:1,borderRadius:12,paddingHorizontal:7,paddingVertical:2,minWidth:22,alignItems:"center",justifyContent:"center"},childCountText:{fontSize:11,fontWeight:"600",color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont},typeTag:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},typeText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont},iconAction:{width:28,height:24,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated,borderWidth:1,borderColor:_sharedUi.night.color.border,alignItems:"center",justifyContent:"center"},goButton:{height:24,paddingHorizontal:10,borderRadius:4,alignItems:"center",justifyContent:"center",backgroundColor:_sharedUi.night.color.accentSoft,borderWidth:1,borderColor:_sharedUi.night.color.accentBorder},goButtonText:{fontSize:12,color:_sharedUi.night.color.accent,fontFamily:_sharedUi.monoFont,fontWeight:"600"},childrenContainer:{borderLeftWidth:2,borderLeftColor:_sharedUi.night.color.border,marginLeft:16,marginRight:8,marginTop:2,marginBottom:8}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getExpoRouterStore=getExpoRouterStore;exports.getRouteNodeMetadata=getRouteNodeMetadata;exports.isExpoRouterStoreSupported=isExpoRouterStoreSupported;exports.loadRouteNode=loadRouteNode;let cachedStore=null;let cachedStoreSource=null;let importError=null;let hasLoggedMissingStore=false;let hasLoggedMissingRouteNode=false;let lastRouteNodeTimestamp=null;function logOnce(e,o){if(__DEV__){if(o){console.error(`[RouteEvents] ${e}`,o)}else{console.warn(`[RouteEvents] ${e}`)}}}function isExpoRouterStoreSupported(){return typeof require!=="undefined"}function getExpoRouterStore(){if(cachedStore){return cachedStore}if(!isExpoRouterStoreSupported()){return null}const e=()=>{try{const t=require("expo-router/build/global-state/router-store");if(t?.store){cachedStore=t.store;cachedStoreSource="build";importError=null;hasLoggedMissingStore=false;return true}}catch(t){importError=t}return false};const o=()=>{try{const t=require("expo-router/src/global-state/router-store");if(t?.store){cachedStore=t.store;cachedStoreSource="src";importError=null;hasLoggedMissingStore=false;return true}}catch(t){importError=t}return false};if(e()||o()){return cachedStore}if(!hasLoggedMissingStore){logOnce("Unable to load expo-router internals. @buoy-gg/route-events requires expo-router >= 2.0.0. Install expo-router and ensure it is configured before using the Routes tab.",importError??void 0);hasLoggedMissingStore=true}return null}function loadRouteNode(){const e=getExpoRouterStore();if(!e){return null}if(e.routeNode){hasLoggedMissingRouteNode=false;lastRouteNodeTimestamp=Date.now();return e.routeNode}const o=e.navigationRef?.isReady?.();if(__DEV__&&!hasLoggedMissingRouteNode&&o){logOnce("Expo Router route tree is unavailable. Ensure your app directory is configured and that expo-router is initialized before opening the Route Events devtool.");hasLoggedMissingRouteNode=true}return null}function getRouteNodeMetadata(){return{source:cachedStoreSource,lastLoadedAt:lastRouteNodeTimestamp}}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getExpoRouterStore=getExpoRouterStore;exports.getRouteNodeMetadata=getRouteNodeMetadata;exports.isExpoRouterStoreSupported=isExpoRouterStoreSupported;exports.isRouteListComplete=isRouteListComplete;exports.loadRouteNode=loadRouteNode;let cachedStore=null;let cachedStoreSource=null;let importError=null;let hasLoggedMissingStore=false;let hasLoggedMissingRouteNode=false;let lastRouteNodeTimestamp=null;function logOnce(e,o){if(__DEV__){if(o){console.error(`[RouteEvents] ${e}`,o)}else{console.warn(`[RouteEvents] ${e}`)}}}function isExpoRouterStoreSupported(){return typeof require!=="undefined"}function getExpoRouterStore(){if(cachedStore){return cachedStore}if(!isExpoRouterStoreSupported()){return null}const e=()=>{try{const t=require("expo-router/build/global-state/router-store");if(t?.store){cachedStore=t.store;cachedStoreSource="build";importError=null;hasLoggedMissingStore=false;return true}}catch(t){importError=t}return false};const o=()=>{try{const t=require("expo-router/src/global-state/router-store");if(t?.store){cachedStore=t.store;cachedStoreSource="src";importError=null;hasLoggedMissingStore=false;return true}}catch(t){importError=t}return false};if(e()||o()){return cachedStore}if(!hasLoggedMissingStore){logOnce("Unable to load expo-router internals. @buoy-gg/route-events requires expo-router >= 2.0.0. Install expo-router and ensure it is configured before using the Routes tab.",importError??void 0);hasLoggedMissingStore=true}return null}function loadRouteNode(){const e=getExpoRouterStore();if(!e){return null}if(e.routeNode){hasLoggedMissingRouteNode=false;lastRouteNodeTimestamp=Date.now();return e.routeNode}const o=e.navigationRef?.isReady?.();if(__DEV__&&!hasLoggedMissingRouteNode&&o){logOnce("Expo Router route tree is unavailable. Ensure your app directory is configured and that expo-router is initialized before opening the Route Events devtool.");hasLoggedMissingRouteNode=true}return null}function getRouteNodeMetadata(){return{source:cachedStoreSource,lastLoadedAt:lastRouteNodeTimestamp}}function isRouteListComplete(){return true}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getExpoRouterStore=getExpoRouterStore;exports.getRouteNodeMetadata=getRouteNodeMetadata;exports.isExpoRouterStoreSupported=isExpoRouterStoreSupported;exports.loadRouteNode=loadRouteNode;var _utils=require("@buoy-gg/shared-ui/utils");var _browserRouteRegistry=require("./browserRouteRegistry");function isExpoRouterStoreSupported(){return typeof window!=="undefined"}function loadRouteNode(){if(!isExpoRouterStoreSupported())return null;const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getExpoRouterStore=getExpoRouterStore;exports.getRouteNodeMetadata=getRouteNodeMetadata;exports.isExpoRouterStoreSupported=isExpoRouterStoreSupported;exports.isRouteListComplete=isRouteListComplete;exports.loadRouteNode=loadRouteNode;var _utils=require("@buoy-gg/shared-ui/utils");var _browserRouteRegistry=require("./browserRouteRegistry");function isExpoRouterStoreSupported(){return typeof window!=="undefined"}function loadRouteNode(){if(!isExpoRouterStoreSupported())return null;const o=new Set([...(0,_browserRouteRegistry.getBrowserRoutePaths)(),new URL((0,_utils.getBrowserHref)()).pathname]);return{route:"",type:"layout",contextKey:"browser",children:[...o].map(e=>({route:e.replace(/^\//,"")||"index",type:"route",contextKey:e,children:[],dynamic:e.split("/").flatMap(r=>{const t=/^\[(\.\.\.)?([^\]]+)\]$/.exec(r);return t?[{name:t[2],deep:!!t[1]}]:[]})}))}}function getExpoRouterStore(){return{routeNode:loadRouteNode(),navigationRef:{isReady:()=>typeof window!=="undefined"}}}function getRouteNodeMetadata(){return{source:null,lastLoadedAt:(0,_browserRouteRegistry.getBrowserRoutesUpdatedAt)()}}function isRouteListComplete(){return(0,_browserRouteRegistry.getBrowserRoutePaths)().length>0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.routeEventsSyncAdapter=exports.SNAPSHOT_PARAM_INLINE_LIMIT=void 0;var _sharedUi=require("@buoy-gg/shared-ui");var _sitemapMatch=require("./sitemapMatch");var _routeEventStore=require("../stores/routeEventStore");var _navigationStackStore=require("../stores/navigationStackStore");var _RouteParser=require("../RouteParser");var _expoRouterStore=require("../expoRouterStore");const SNAPSHOT_PARAM_INLINE_LIMIT=exports.SNAPSHOT_PARAM_INLINE_LIMIT=16*1024;const PARAMS_ON_DEVICE=Object.freeze({__buoyOmitted:"route-params",note:"Navigation params stay on the device."});function shouldOmitParams(t){if(t==null)return false;return(0,_sharedUi.isOverWireBudget)(t,SNAPSHOT_PARAM_INLINE_LIMIT)}function toWireParams(t){if(!shouldOmitParams(t))return t;return PARAMS_ON_DEVICE}function toWireEvent(t){if(!shouldOmitParams(t.params))return t;return{...t,params:toWireParams(t.params)}}function toWireStackItem(t){if(!shouldOmitParams(t.params))return t;return{...t,params:toWireParams(t.params)}}function getSitemapSnapshot(){const t=(0,_expoRouterStore.getRouteNodeMetadata)();return{routes:_RouteParser.RouteParser.parseRouteTree((0,_expoRouterStore.loadRouteNode)()),source:t.source,lastUpdatedAt:t.lastLoadedAt}}const routeEventsSyncAdapter=exports.routeEventsSyncAdapter={version:3,getSnapshot:()=>({events:_routeEventStore.routeEventStore.getEvents().map(toWireEvent),sitemap:getSitemapSnapshot(),stack:_navigationStackStore.navigationStackStore.getStack().map(toWireStackItem)}),subscribe:t=>{const a=_routeEventStore.routeEventStore.subscribeToEvents(t);const e=_navigationStackStore.navigationStackStore.subscribe(t);let r=null;if(!(0,_expoRouterStore.loadRouteNode)()){let
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.routeEventsSyncAdapter=exports.SNAPSHOT_PARAM_INLINE_LIMIT=void 0;var _sharedUi=require("@buoy-gg/shared-ui");var _sitemapMatch=require("./sitemapMatch");var _routeEventStore=require("../stores/routeEventStore");var _navigationStackStore=require("../stores/navigationStackStore");var _RouteParser=require("../RouteParser");var _expoRouterStore=require("../expoRouterStore");async function resetBrowserHistory(t,a){const e=_navigationStackStore.navigationStackStore.getStack();const r=e.findIndex(o=>o.isFocused);const n=_navigationStackStore.navigationStackStore.getActions();if(r<0||!n||typeof t.replace!=="function"){throw new Error("This app's history isn't captured yet, so Buoy can't start over. Open the Routes tool once, or navigate without reset.")}if(r>0){const o=globalThis;await new Promise((i,s)=>{const c=v=>{clearTimeout(p);o.removeEventListener?.("popstate",u);if(v)i();else s(new Error("The app didn't go back to its first page, so nothing was reset. Try again, or navigate without reset."))};const u=()=>setTimeout(()=>c(true),0);const p=setTimeout(()=>c(false),1500);o.addEventListener?.("popstate",u);n.popToTop()})}if(_navigationStackStore.navigationStackStore.getStack().findIndex(o=>o.isFocused)!==0){throw new Error("The app isn't on its first page, so nothing was reset. Try again, or navigate without reset.")}t.replace(a);return{navigated:a,replaced:true,reset:true}}const SNAPSHOT_PARAM_INLINE_LIMIT=exports.SNAPSHOT_PARAM_INLINE_LIMIT=16*1024;const PARAMS_ON_DEVICE=Object.freeze({__buoyOmitted:"route-params",note:"Navigation params stay on the device."});function shouldOmitParams(t){if(t==null)return false;return(0,_sharedUi.isOverWireBudget)(t,SNAPSHOT_PARAM_INLINE_LIMIT)}function toWireParams(t){if(!shouldOmitParams(t))return t;return PARAMS_ON_DEVICE}function toWireEvent(t){if(!shouldOmitParams(t.params))return t;return{...t,params:toWireParams(t.params)}}function toWireStackItem(t){if(!shouldOmitParams(t.params))return t;return{...t,params:toWireParams(t.params)}}function getSitemapSnapshot(){const t=(0,_expoRouterStore.getRouteNodeMetadata)();return{routes:_RouteParser.RouteParser.parseRouteTree((0,_expoRouterStore.loadRouteNode)()),source:t.source,lastUpdatedAt:t.lastLoadedAt}}const routeEventsSyncAdapter=exports.routeEventsSyncAdapter={version:3,getSnapshot:()=>({events:_routeEventStore.routeEventStore.getEvents().map(toWireEvent),sitemap:getSitemapSnapshot(),stack:_navigationStackStore.navigationStackStore.getStack().map(toWireStackItem)}),subscribe:t=>{const a=_routeEventStore.routeEventStore.subscribeToEvents(t);const e=_navigationStackStore.navigationStackStore.subscribe(t);let r=null;if(!(0,_expoRouterStore.loadRouteNode)()){let n=0;const o=100;const i=()=>{n+=1;if((0,_expoRouterStore.loadRouteNode)()){r=null;t();return}r=n<o?setTimeout(i,100):null};r=setTimeout(i,100)}return()=>{a();e();if(r)clearTimeout(r)}},actions:{clearEvents:()=>{_routeEventStore.routeEventStore.clearEvents()},getCurrentRoute:()=>{const t=_routeEventStore.routeEventStore.getEvents()[0];if(t&&_routeEventStore.routeEventStore.isCapturing()){return{path:t.pathname,params:toWireParams(t.params),at:t.timestamp,source:"event"}}const a=_navigationStackStore.navigationStackStore.getStack();const e=a.find(r=>r.isFocused)??a[a.length-1];if(e?.pathname){return{path:e.pathname,params:toWireParams(e.params??{}),at:null,source:"stack"}}if(t){return{path:t.pathname,params:toWireParams(t.params),at:t.timestamp,source:"event",stale:true}}return{path:null,params:{},at:null,source:null}},navigate:t=>{const a=t;const e=a?.path;if(!e){throw new Error("navigate requires a 'path' param")}const r=(0,_sharedUi.getSafeRouter)();if(!r){const i=_navigationStackStore.navigationStackStore.getActions();const s=e.replace(/^\//,"");if(!i?.navigateToRoute||!s){throw new Error("expo-router is not available here and no navigation container was captured \u2014 is <RouteTracker /> mounted inside your NavigationContainer?")}const c=i.navigateToRoute(s,a?.params);if(!c){throw new Error(`Could not navigate to "${s}" \u2014 no navigation container is live.`)}return{navigated:e,replaced:false,via:"react-navigation"}}let n=[];try{n=getSitemapSnapshot().routes}catch{n=[]}if((0,_expoRouterStore.isRouteListComplete)()&&(0,_sitemapMatch.pathMatchesSitemap)(e,n)===false){throw new Error(`No screen matches "${e}". Navigating there would open expo-router's "Unmatched Route" page, which replaces the app's layout (and disconnects Buoy). Read the sitemap for the paths this app has.`)}if(a?.reset===true){if(typeof r.canDismiss!=="function")return resetBrowserHistory(r,e);try{if(r.canDismiss())r.dismissAll?.()}catch{}r.navigate(e);return{navigated:e,replaced:false,reset:true}}const o=a?.replace===true&&typeof r.replace==="function"?r.replace:r.navigate;o(e);return{navigated:e,replaced:a?.replace===true}},stackNavigateToIndex:t=>{const a=t?.index;if(typeof a!=="number"){throw new Error("stackNavigateToIndex requires a numeric 'index'")}const e=_navigationStackStore.navigationStackStore.getActions();if(!e)throw new Error("navigation stack is not available");e.navigateToIndex(a);return{navigatedToIndex:a}},stackPopToIndex:t=>{const a=t?.index;if(typeof a!=="number"){throw new Error("stackPopToIndex requires a numeric 'index'")}const e=_navigationStackStore.navigationStackStore.getActions();if(!e)throw new Error("navigation stack is not available");e.popToIndex(a);return{poppedToIndex:a}},stackGoBack:()=>{const t=_navigationStackStore.navigationStackStore.getActions();if(!t)throw new Error("navigation stack is not available");t.goBack();return{wentBack:true}},stackPopToTop:()=>{const t=_navigationStackStore.navigationStackStore.getActions();if(!t)throw new Error("navigation stack is not available");t.popToTop();return{poppedToTop:true}}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const r=new Map;let u=null;export function registerBrowserRoutes(o){for(const e of o)r.set(e,(r.get(e)??0)+1);u=Date.now();let s=true;return()=>{if(!s)return;s=false;for(const e of o){const c=(r.get(e)??1)-1;if(c)r.set(e,c);else r.delete(e)}u=Date.now()}}export function getBrowserRoutePaths(){return[...r.keys()]}export function getBrowserRoutesUpdatedAt(){return u}export function getBrowserRouteInfo(o){const s={segments:o.split("/").filter(Boolean),params:{}};const e=getBrowserRoutePaths();if(e.includes(o))return s;for(const c of e){const a=c.split("/").filter(Boolean);const f=[];const g=a.map(t=>{const n=/^\[(\.\.\.)?([^\]]+)\]$/.exec(t);if(!n)return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");f.push({name:n[2],deep:!!n[1]});return n[1]?"(.+)":"([^/]+)"});const i=new RegExp("^/"+g.join("/")+"/?$").exec(o);if(!i)continue;const p=t=>{try{return decodeURIComponent(t)}catch{return t}};const l={};f.forEach(({name:t,deep:n},m)=>{const d=i[m+1];l[t]=n?d.split("/").map(p):p(d)});return{segments:a,params:l}}return s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{browserRouter as
|
|
1
|
+
"use strict";import{browserRouter as g,getBrowserHref as B,getBrowserRouteURL as k,subscribeBrowserNavigation as I}from"@buoy-gg/shared-ui/utils";import{routeObserver as j}from"./RouteObserver";import{routeEventStore as P}from"./stores/routeEventStore";import{navigationStackStore as l}from"./stores/navigationStackStore";import{getBrowserRouteInfo as v}from"./browserRouteRegistry";let R=0;let d;export function startBrowserRouteCapture(){if(typeof window==="undefined")return()=>{};if(R++===0){P.hydrateBootCapture();let y;let m;let w="";const o=[];let r=-1;const S=()=>{const e=window.history.state;if(!e||typeof e!=="object")return void 0;const t=e.key??e.__TSR_key;return typeof t==="string"||typeof t==="number"?String(t):void 0};const T=e=>{for(let t=r-1;t>=0;t--)if(o[t].href===e)return t;for(let t=r+1;t<o.length;t++)if(o[t].href===e)return t;return-1};const b=e=>{const t=S();if(e.href===w&&e.kind==="pop"&&(t===void 0||o[r]?.key===t))return;if(e.kind==="replace"&&r>=0)o[r]={href:e.href,key:t};else if(e.kind==="pop"){const f=t===void 0?-1:o.findIndex(i=>i.key===t);const n=f>=0?f:T(e.href);if(n>=0)r=n;else{o.splice(r+1);o.push({href:e.href,key:t});r++}}else{o.splice(r+1);o.push({href:e.href,key:t});r++}w=e.href;const s=k(e.href);const a=Date.now();const p=v(s.pathname);j.emit({pathname:s.pathname,params:{...p.params,...Object.fromEntries(s.searchParams)},segments:p.segments,previousPathname:y,timestamp:a,timeSincePrevious:m===void 0?void 0:a-m});y=s.pathname;m=a;l.setStack(o.slice(0,r+1).map(({href:f},n)=>{const i=k(f);const u=v(i.pathname);return{key:`browser:${n}`,name:u.segments.join("/")||"index",pathname:i.pathname,params:{...u.params,...Object.fromEntries(i.searchParams)},index:n,isFocused:n===r,canPop:n>0}}))};const c=e=>{if(!Number.isInteger(e)||e<0||e>=o.length)throw new Error("That browser history entry is unavailable.");window.history.go(e-r)};l.setActions({navigateToIndex:c,popToIndex:c,goBack:g.back,popToTop:()=>c(0),navigateToRoute:(e,t)=>{const s={...t};const a=`/${e.replace(/^\//,"")}`.replace(/\[(\.\.\.)?([^\]]+)\]/g,(p,f,n)=>{if(!(n in s))return p;const i=s[n];delete s[n];return f&&Array.isArray(i)?i.map(u=>encodeURIComponent(String(u))).join("/"):encodeURIComponent(String(i))});g.push({pathname:a==="/index"?"/":a,params:s});return true}});d=I(b);b({href:B(),kind:"initial"})}let h=false;return()=>{if(h)return;h=true;if(--R===0){d?.();d=void 0;l.setActions(null)}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useState as T,useCallback as g,useEffect as oe,useRef as Ie,useMemo as N}from"react";import{Text as re,View as S,TouchableOpacity as ae,StyleSheet as Ae,Alert as se}from"react-native";import{getCommonActions as De,useSafeNavigationContainerRef as ze}from"../utils/safeReactNavigation";const U=De();import{useSafeRouter as Le,isExpoRouterAvailable as Me,windowDragProps as Fe,ToolEmptyState as We,resolveListEmptyState as je,usePersistedState as J,monoFont as W}from"@buoy-gg/shared-ui";import{JsModal as Ve,ModalHeader as m,TabSelector as He,formatRelativeTime as Oe,devToolsStorageKeys as B,Trash2 as _e,Filter as Ue,SearchBar as ie,ToolbarCopyButton as K,Lock as Je,ProUpgradeModal as Ke,PowerToggleButton as $e,buoyColors as Ge,night as s,TickProvider as le,useLimit as Qe}from"@buoy-gg/shared-ui";import{useIsPro as qe}from"@buoy-gg/license";import{useRouteEvents as Xe}from"../hooks/useRouteEvents";import{routeEventStore as Ye}from"../stores/routeEventStore";import{RouteEventDetail as Ze}from"./RouteEventDetail";import{RouteFilterViewV2 as et}from"./RouteFilterViewV2";import{RoutesSitemap as tt}from"./RoutesSitemap";import{ReactNavigationRoutes as nt}from"./ReactNavigationRoutes";import{NavigationStack as ot}from"./NavigationStack";import{RouteEventsTimeline as rt}from"./RouteEventsTimeline";import{splitRouteHref as at}from"../utils/routeTemplate";import{jsx as n,jsxs as u,Fragment as st}from"react/jsx-runtime";const it={parse:t=>t==="routes"||t==="events"||t==="stack"?t:void 0,serialize:t=>t};const lt={parse:t=>t==="true",serialize:t=>t.toString()};const ct={parse:t=>new Set(JSON.parse(t)),serialize:t=>JSON.stringify(Array.from(t))};function ce(t,f){if(!t||!t.routes)return null;for(const l of t.routes){if(l.name===f){return[l.name]}if(l.state){const v=ce(l.state,f);if(v){return[l.name,...v]}}}return null}function ut(t,f){if(t.length===0)return null;const l=f&&Object.keys(f).length>0?f:void 0;if(t.length===1){return U.navigate(l?{name:t[0],params:l}:{name:t[0]})}let v=l?{screen:t[t.length-1],params:l}:{screen:t[t.length-1]};for(let P=t.length-2;P>=1;P--){v={screen:t[P],params:v}}return U.navigate({name:t[0],params:v})}export function RouteEventsModalWithTabs({visible:t,onClose:f,onBack:l,onMinimize:v,enableSharedModalDimensions:P=false,inline:ue=false,remote:c}){const $=Le();const w=ze();const I=Me();const[E,de]=J(B.routeEvents.activeTab(),"events",it);const[j,x]=T(false);const[me,ge]=T("");const y=qe();const A=Qe("routeEvents.entries");oe(()=>{if(j&&y){x(false)}},[j,y]);const[D,pe]=J(B.routeEvents.isMonitoring(),true,lt);const{events:i,clearEvents:G,isListening:he}=Xe({enabled:D});const z=D&&he;oe(()=>{Ye.setBootCapture(D)},[D]);const[L,Q]=T(false);const[d,V]=T(null);const[q,fe]=T(1);const[C,X]=T("");const[p,Y]=J(B.routeEvents.eventFilters(),new Set(["/_sitemap","/api","/__dev"]),ct);const dt=Ie(null);const ve=g(e=>{},[]);const Z=g(e=>{try{if(c){if(!c.onNavigatePath)return;if(!y&&e!=="/"){x(true);return}c.onNavigatePath(e);return}if(I){$.push(e)}else if(w){const{pathname:o,params:r}=at(e);const h=o.startsWith("/")?o.slice(1):o;const R=Object.keys(r).length>0;const M=w.getRootState?.();if(M){const k=ce(M,h);if(k){const F=ut(k,r);if(F){w.dispatch(F);return}}}w.dispatch(U.navigate(R?{name:h,params:r}:{name:h}))}else{se.alert("Navigation Unavailable","No Expo Router or React Navigation container was found in this app.")}}catch(o){se.alert("Navigation Error",String(o))}},[$,w,I,c,y]);const be=g(()=>{pe(e=>!e)},[]);const ye=g(()=>{if(i.length===0)return;if(!y){x(true);return}G()},[i.length,y,G]);const Se=g(e=>{Y(o=>{const r=new Set(o);if(r.has(e)){r.delete(e)}else{r.add(e)}return r})},[]);const Ee=g(e=>{Y(o=>new Set([...o,e]))},[]);const Ce=g(()=>{Q(!L)},[L]);const Re=g((e,o)=>{V(e);fe(o)},[]);const ke=g(()=>{V(null)},[]);const Te=g(e=>{V(null);de(e)},[]);const Ne=N(()=>{const e=new Set;i.forEach(o=>{if(o.pathname){e.add(o.pathname)}});return Array.from(e).sort()},[i]);const b=N(()=>{return i.filter(e=>{if(!e.pathname)return false;const o=Array.from(p).some(r=>e.pathname.includes(r));if(o)return false;if(C.trim()){const r=C.toLowerCase();const h=e.pathname.toLowerCase().includes(r);const R=Object.entries(e.params||{}).some(([M,k])=>{const F=Array.isArray(k)?k.join(" "):k;return M.toLowerCase().includes(r)||F.toLowerCase().includes(r)});return h||R}return true})},[i,p,C]);const Pe=N(()=>b.slice(0,A),[b,A]);const H=N(()=>Math.max(0,b.length-A),[b.length,A]);const O=N(()=>{const e=new Map;const o=new Map;for(let r=i.length-1;r>=0;r--){const h=i[r];const R=(e.get(h.pathname)||0)+1;e.set(h.pathname,R);o.set(h,R)}return o},[i]);const we=N(()=>{return{summary:{total:i.length,filtered:b.length,listening:z,ignoredPatterns:Array.from(p),timestamp:new Date().toISOString()},events:b.map((e,o)=>({index:o,visitNumber:O.get(e)||1,pathname:e.pathname,timestamp:e.timestamp,timestampRelative:Oe(e.timestamp),params:e.params,segments:e.segments,previousPathname:e.previousPathname,timeSincePrevious:e.timeSincePrevious}))}},[i.length,b,z,p,O]);if(!t)return null;const xe=P?B.modal.root():B.routeEvents.modal();const _=null;const ee=()=>{if(d){return n(Ze,{event:d,visitNumber:q,onNavigate:Z})}if(E==="routes"){return I||c?.sitemap?n(tt,{style:a.contentWrapper,injectedRoutes:c?.sitemap?.routes,injectedSource:c?.sitemap?.source??null,injectedLastUpdatedAt:c?.sitemap?.lastUpdatedAt??null,onNavigateRoute:c?Be:void 0}):n(nt,{style:a.contentWrapper})}if(E==="stack"){return n(ot,{style:a.contentWrapper,injectedStack:c?c.stack??[]:void 0,onAction:c?.onStackAction,onCopyValueChange:ge})}if(L){return n(et,{ignoredPatterns:p,onTogglePattern:Se,onAddPattern:Ee,availablePathnames:Ne})}const e=i.length>0;if(b.length===0){return u(S,{style:a.contentWrapper,testID:"buoy-routes-events",children:[e&&n(S,{style:a.searchContainer,testID:"buoy-routes-search-field",children:n(ie,{value:C,onChange:X,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),n(We,{testID:"buoy-routes-empty",...je({subject:"route events",search:C,total:i.length,capturing:z,waiting:{otto:"walking",title:"No route events yet",message:"Navigation events will appear here"},paused:{title:"Event listener is paused",message:"Press play to start monitoring"}})})]})}return u(S,{style:a.contentWrapper,testID:"buoy-routes-events",children:[n(S,{style:a.searchContainer,testID:"buoy-routes-search-field",children:n(ie,{value:C,onChange:X,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),H>0&&u(S,{style:a.lockedEventsBanner,testID:"buoy-routes-locked-banner",children:[n(Je,{size:14,color:s.color.warning}),u(re,{style:a.lockedEventsBannerText,testID:"buoy-routes-locked-banner-text",children:[H," older ",H===1?"event":"events"," locked"]}),n(re,{style:a.lockedEventsBannerSubtext,children:"Upgrade to Pro for full history"})]}),n(rt,{events:Pe,visitCounts:O,onNavigate:Z,onSelectEvent:Re})]})};const te=d?u(m,{children:[n(m.Navigation,{onBack:ke}),n(m.Content,{title:d.pathname,testID:"buoy-routes-detail-title"}),n(m.Actions,{children:n(K,{testID:"buoy-routes-detail-copy",value:{pathname:d.pathname,previousPathname:d.previousPathname,params:d.params,segments:d.segments,timestamp:d.timestamp,timestampISO:new Date(d.timestamp).toISOString(),timeSincePrevious:d.timeSincePrevious,visitNumber:q},buttonStyle:a.iconButton})})]}):L?u(m,{children:[n(m.Navigation,{onBack:()=>Q(false)}),n(m.Content,{title:"Filters",testID:"buoy-routes-filters-title"})]}):u(m,{children:[l&&n(m.Navigation,{onBack:l}),n(m.Content,{title:"",noMargin:true,children:n(He,{tabs:[{key:"routes",label:I?"Routes":"Screens"},{key:"events",label:`Events${i.length>0&&E!=="events"?` (${i.length})`:""}`},{key:"stack",label:"Stack"}],activeTab:E,onTabChange:e=>Te(e),testIDPrefix:"buoy-routes-tab"})}),u(m.Actions,{children:[E==="stack"&&n(K,{value:me,buttonStyle:a.iconButton,testID:"buoy-routes-stack-copy"}),E==="events"&&u(st,{children:[n(K,{value:we,buttonStyle:a.iconButton,testID:"buoy-routes-copy"}),n(ae,{onPress:Ce,style:[a.iconButton,p.size>0&&a.activeFilterButton],testID:"buoy-routes-filters",accessibilityRole:"button",accessibilityLabel:p.size>0?`Route filters, ${p.size} active`:"Route filters",children:n(Ue,{size:14,color:p.size>0?s.color.accent:s.color.textSecondary})}),n($e,{isEnabled:z,onToggle:be,accessibilityLabel:"Toggle route event monitoring",testID:"buoy-routes-power"}),n(ae,{onPress:ye,style:a.iconButton,testID:"buoy-routes-clear",accessibilityRole:"button",accessibilityLabel:"Clear route events",children:n(_e,{size:14,color:s.color.danger})})]})]})]});const Be=e=>{if(e.type==="layout"||e.type==="group")return;const o=e.type==="index"||e.path==="/";if(!y&&!o){x(true);return}c?.onNavigateRoute?.(e)};const ne=n(Ke,{visible:j,onClose:()=>x(false),featureName:"Route Event Management"});if(ue){return u(le,{children:[u(S,{style:a.inlineRoot,children:[n(S,{style:a.inlineHeader,...Fe,children:te}),ee(),_]}),ne]})}return n(le,{children:u(Ve,{visible:t,onClose:f,onMinimize:v,persistenceKey:xe,header:{showToggleButton:true,customContent:te},onModeChange:ve,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:true,styles:{},footer:_,footerHeight:_?68:0,children:[ee(),ne]})})}export function RoutesToolView(t={}){return n(RouteEventsModalWithTabs,{...t,inline:true,visible:true,onClose:()=>{}})}const a=Ae.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:Ge.border,backgroundColor:"transparent"},iconButton:{padding:6,borderRadius:6,backgroundColor:s.color.buttonSurface},activeFilterButton:{backgroundColor:s.color.accentSoft},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:s.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:W,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:s.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:W},contentWrapper:{flex:1},statsContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:s.color.surface,borderBottomWidth:1,borderBottomColor:s.color.border},statsText:{fontSize:11,color:s.color.textSecondary,fontFamily:W,textAlign:"center"},statsWarning:{color:s.color.warning,fontWeight:"600"},searchContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:"transparent"},lockedEventsBanner:{flexDirection:"row",alignItems:"center",gap:8,backgroundColor:s.color.warningSoft,borderWidth:1,borderColor:s.color.warning+"30",borderRadius:8,paddingVertical:10,paddingHorizontal:14,marginHorizontal:16,marginBottom:8},lockedEventsBannerText:{fontSize:12,fontWeight:"600",color:s.color.warning,fontFamily:W},lockedEventsBannerSubtext:{fontSize:11,color:s.color.textSecondary,marginLeft:"auto"}});
|
|
1
|
+
"use strict";import{useState as P,useCallback as g,useEffect as oe,useRef as Ie,useMemo as T}from"react";import{Text as re,View as S,TouchableOpacity as ae,StyleSheet as Ae,Alert as se,Platform as De}from"react-native";import{getCommonActions as ze,useSafeNavigationContainerRef as Le}from"../utils/safeReactNavigation";const U=ze();import{useSafeRouter as Me,isExpoRouterAvailable as Fe,windowDragProps as We,ToolEmptyState as je,resolveListEmptyState as Ve,usePersistedState as J,monoFont as W}from"@buoy-gg/shared-ui";import{JsModal as He,ModalHeader as m,TabSelector as Oe,formatRelativeTime as _e,devToolsStorageKeys as B,Trash2 as Ue,Filter as Je,SearchBar as ie,ToolbarCopyButton as K,Lock as Ke,ProUpgradeModal as $e,PowerToggleButton as Ge,buoyColors as Qe,night as s,TickProvider as le,useLimit as qe}from"@buoy-gg/shared-ui";import{useIsPro as Xe}from"@buoy-gg/license";import{useRouteEvents as Ye}from"../hooks/useRouteEvents";import{routeEventStore as Ze}from"../stores/routeEventStore";import{RouteEventDetail as et}from"./RouteEventDetail";import{RouteFilterViewV2 as tt}from"./RouteFilterViewV2";import{RoutesSitemap as nt}from"./RoutesSitemap";import{ReactNavigationRoutes as ot}from"./ReactNavigationRoutes";import{NavigationStack as rt}from"./NavigationStack";import{RouteEventsTimeline as at}from"./RouteEventsTimeline";import{splitRouteHref as st}from"../utils/routeTemplate";import{jsx as n,jsxs as u,Fragment as it}from"react/jsx-runtime";const lt={parse:t=>t==="routes"||t==="events"||t==="stack"?t:void 0,serialize:t=>t};const ct={parse:t=>t==="true",serialize:t=>t.toString()};const ut={parse:t=>new Set(JSON.parse(t)),serialize:t=>JSON.stringify(Array.from(t))};function ce(t,f){if(!t||!t.routes)return null;for(const l of t.routes){if(l.name===f){return[l.name]}if(l.state){const v=ce(l.state,f);if(v){return[l.name,...v]}}}return null}function dt(t,f){if(t.length===0)return null;const l=f&&Object.keys(f).length>0?f:void 0;if(t.length===1){return U.navigate(l?{name:t[0],params:l}:{name:t[0]})}let v=l?{screen:t[t.length-1],params:l}:{screen:t[t.length-1]};for(let N=t.length-2;N>=1;N--){v={screen:t[N],params:v}}return U.navigate({name:t[0],params:v})}export function RouteEventsModalWithTabs({visible:t,onClose:f,onBack:l,onMinimize:v,enableSharedModalDimensions:N=false,inline:ue=false,remote:c}){const $=Me();const w=Le();const I=De.OS==="web"||Fe();const[E,de]=J(B.routeEvents.activeTab(),"events",lt);const[j,x]=P(false);const[me,ge]=P("");const y=Xe();const A=qe("routeEvents.entries");oe(()=>{if(j&&y){x(false)}},[j,y]);const[D,pe]=J(B.routeEvents.isMonitoring(),true,ct);const{events:i,clearEvents:G,isListening:he}=Ye({enabled:D});const z=D&&he;oe(()=>{Ze.setBootCapture(D)},[D]);const[L,Q]=P(false);const[d,V]=P(null);const[q,fe]=P(1);const[C,X]=P("");const[p,Y]=J(B.routeEvents.eventFilters(),new Set(["/_sitemap","/api","/__dev"]),ut);const mt=Ie(null);const ve=g(e=>{},[]);const Z=g(e=>{try{if(c){if(!c.onNavigatePath)return;if(!y&&e!=="/"){x(true);return}c.onNavigatePath(e);return}if(I){$.push(e)}else if(w){const{pathname:o,params:r}=st(e);const h=o.startsWith("/")?o.slice(1):o;const R=Object.keys(r).length>0;const M=w.getRootState?.();if(M){const k=ce(M,h);if(k){const F=dt(k,r);if(F){w.dispatch(F);return}}}w.dispatch(U.navigate(R?{name:h,params:r}:{name:h}))}else{se.alert("Navigation Unavailable","No Expo Router or React Navigation container was found in this app.")}}catch(o){se.alert("Navigation Error",String(o))}},[$,w,I,c,y]);const be=g(()=>{pe(e=>!e)},[]);const ye=g(()=>{if(i.length===0)return;if(!y){x(true);return}G()},[i.length,y,G]);const Se=g(e=>{Y(o=>{const r=new Set(o);if(r.has(e)){r.delete(e)}else{r.add(e)}return r})},[]);const Ee=g(e=>{Y(o=>new Set([...o,e]))},[]);const Ce=g(()=>{Q(!L)},[L]);const Re=g((e,o)=>{V(e);fe(o)},[]);const ke=g(()=>{V(null)},[]);const Pe=g(e=>{V(null);de(e)},[]);const Te=T(()=>{const e=new Set;i.forEach(o=>{if(o.pathname){e.add(o.pathname)}});return Array.from(e).sort()},[i]);const b=T(()=>{return i.filter(e=>{if(!e.pathname)return false;const o=Array.from(p).some(r=>e.pathname.includes(r));if(o)return false;if(C.trim()){const r=C.toLowerCase();const h=e.pathname.toLowerCase().includes(r);const R=Object.entries(e.params||{}).some(([M,k])=>{const F=Array.isArray(k)?k.join(" "):k;return M.toLowerCase().includes(r)||F.toLowerCase().includes(r)});return h||R}return true})},[i,p,C]);const Ne=T(()=>b.slice(0,A),[b,A]);const H=T(()=>Math.max(0,b.length-A),[b.length,A]);const O=T(()=>{const e=new Map;const o=new Map;for(let r=i.length-1;r>=0;r--){const h=i[r];const R=(e.get(h.pathname)||0)+1;e.set(h.pathname,R);o.set(h,R)}return o},[i]);const we=T(()=>{return{summary:{total:i.length,filtered:b.length,listening:z,ignoredPatterns:Array.from(p),timestamp:new Date().toISOString()},events:b.map((e,o)=>({index:o,visitNumber:O.get(e)||1,pathname:e.pathname,timestamp:e.timestamp,timestampRelative:_e(e.timestamp),params:e.params,segments:e.segments,previousPathname:e.previousPathname,timeSincePrevious:e.timeSincePrevious}))}},[i.length,b,z,p,O]);if(!t)return null;const xe=N?B.modal.root():B.routeEvents.modal();const _=null;const ee=()=>{if(d){return n(et,{event:d,visitNumber:q,onNavigate:Z})}if(E==="routes"){return I||c?.sitemap?n(nt,{style:a.contentWrapper,injectedRoutes:c?.sitemap?.routes,injectedSource:c?.sitemap?.source??null,injectedLastUpdatedAt:c?.sitemap?.lastUpdatedAt??null,onNavigateRoute:c?Be:void 0}):n(ot,{style:a.contentWrapper})}if(E==="stack"){return n(rt,{style:a.contentWrapper,injectedStack:c?c.stack??[]:void 0,onAction:c?.onStackAction,onCopyValueChange:ge})}if(L){return n(tt,{ignoredPatterns:p,onTogglePattern:Se,onAddPattern:Ee,availablePathnames:Te})}const e=i.length>0;if(b.length===0){return u(S,{style:a.contentWrapper,testID:"buoy-routes-events",children:[e&&n(S,{style:a.searchContainer,testID:"buoy-routes-search-field",children:n(ie,{value:C,onChange:X,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),n(je,{testID:"buoy-routes-empty",...Ve({subject:"route events",search:C,total:i.length,capturing:z,waiting:{otto:"walking",title:"No route events yet",message:"Navigation events will appear here"},paused:{title:"Event listener is paused",message:"Press play to start monitoring"}})})]})}return u(S,{style:a.contentWrapper,testID:"buoy-routes-events",children:[n(S,{style:a.searchContainer,testID:"buoy-routes-search-field",children:n(ie,{value:C,onChange:X,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),H>0&&u(S,{style:a.lockedEventsBanner,testID:"buoy-routes-locked-banner",children:[n(Ke,{size:14,color:s.color.warning}),u(re,{style:a.lockedEventsBannerText,testID:"buoy-routes-locked-banner-text",children:[H," older ",H===1?"event":"events"," locked"]}),n(re,{style:a.lockedEventsBannerSubtext,children:"Upgrade to Pro for full history"})]}),n(at,{events:Ne,visitCounts:O,onNavigate:Z,onSelectEvent:Re})]})};const te=d?u(m,{children:[n(m.Navigation,{onBack:ke}),n(m.Content,{title:d.pathname,testID:"buoy-routes-detail-title"}),n(m.Actions,{children:n(K,{testID:"buoy-routes-detail-copy",value:{pathname:d.pathname,previousPathname:d.previousPathname,params:d.params,segments:d.segments,timestamp:d.timestamp,timestampISO:new Date(d.timestamp).toISOString(),timeSincePrevious:d.timeSincePrevious,visitNumber:q},buttonStyle:a.iconButton})})]}):L?u(m,{children:[n(m.Navigation,{onBack:()=>Q(false)}),n(m.Content,{title:"Filters",testID:"buoy-routes-filters-title"})]}):u(m,{children:[l&&n(m.Navigation,{onBack:l}),n(m.Content,{title:"",noMargin:true,children:n(Oe,{tabs:[{key:"routes",label:I?"Routes":"Screens"},{key:"events",label:`Events${i.length>0&&E!=="events"?` (${i.length})`:""}`},{key:"stack",label:"Stack"}],activeTab:E,onTabChange:e=>Pe(e),testIDPrefix:"buoy-routes-tab"})}),u(m.Actions,{children:[E==="stack"&&n(K,{value:me,buttonStyle:a.iconButton,testID:"buoy-routes-stack-copy"}),E==="events"&&u(it,{children:[n(K,{value:we,buttonStyle:a.iconButton,testID:"buoy-routes-copy"}),n(ae,{onPress:Ce,style:[a.iconButton,p.size>0&&a.activeFilterButton],testID:"buoy-routes-filters",accessibilityRole:"button",accessibilityLabel:p.size>0?`Route filters, ${p.size} active`:"Route filters",children:n(Je,{size:14,color:p.size>0?s.color.accent:s.color.textSecondary})}),n(Ge,{isEnabled:z,onToggle:be,accessibilityLabel:"Toggle route event monitoring",testID:"buoy-routes-power"}),n(ae,{onPress:ye,style:a.iconButton,testID:"buoy-routes-clear",accessibilityRole:"button",accessibilityLabel:"Clear route events",children:n(Ue,{size:14,color:s.color.danger})})]})]})]});const Be=e=>{if(e.type==="layout"||e.type==="group")return;const o=e.type==="index"||e.path==="/";if(!y&&!o){x(true);return}c?.onNavigateRoute?.(e)};const ne=n($e,{visible:j,onClose:()=>x(false),featureName:"Route Event Management"});if(ue){return u(le,{children:[u(S,{style:a.inlineRoot,children:[n(S,{style:a.inlineHeader,...We,children:te}),ee(),_]}),ne]})}return n(le,{children:u(He,{visible:t,onClose:f,onMinimize:v,persistenceKey:xe,header:{showToggleButton:true,customContent:te},onModeChange:ve,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:true,styles:{},footer:_,footerHeight:_?68:0,children:[ee(),ne]})})}export function RoutesToolView(t={}){return n(RouteEventsModalWithTabs,{...t,inline:true,visible:true,onClose:()=>{}})}const a=Ae.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:Qe.border,backgroundColor:"transparent"},iconButton:{padding:6,borderRadius:6,backgroundColor:s.color.buttonSurface},activeFilterButton:{backgroundColor:s.color.accentSoft},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:s.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:W,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:s.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:W},contentWrapper:{flex:1},statsContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:s.color.surface,borderBottomWidth:1,borderBottomColor:s.color.border},statsText:{fontSize:11,color:s.color.textSecondary,fontFamily:W,textAlign:"center"},statsWarning:{color:s.color.warning,fontWeight:"600"},searchContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:"transparent"},lockedEventsBanner:{flexDirection:"row",alignItems:"center",gap:8,backgroundColor:s.color.warningSoft,borderWidth:1,borderColor:s.color.warning+"30",borderRadius:8,paddingVertical:10,paddingHorizontal:14,marginHorizontal:16,marginBottom:8},lockedEventsBannerText:{fontSize:12,fontWeight:"600",color:s.color.warning,fontFamily:W},lockedEventsBannerSubtext:{fontSize:11,color:s.color.textSecondary,marginLeft:"auto"}});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";import{useState as B,useCallback as w,useMemo as H,useEffect as de}from"react";import{night as o,ToolEmptyState as pe,monoFont as c}from"@buoy-gg/shared-ui";import{View as n,Text as l,TextInput as ue,TouchableOpacity as C,ScrollView as he,StyleSheet as ye,Alert as T,Platform as ge}from"react-native";import{
|
|
1
|
+
"use strict";import{useState as B,useCallback as w,useMemo as H,useEffect as de}from"react";import{night as o,ToolEmptyState as pe,monoFont as c}from"@buoy-gg/shared-ui";import{View as n,Text as l,TextInput as ue,TouchableOpacity as C,ScrollView as he,StyleSheet as ye,Alert as T,Platform as ge}from"react-native";import{isCapacitorNative as fe}from"@buoy-gg/license";import{useSafeRouter as me}from"@buoy-gg/shared-ui";import{Search as q,ChevronDown as J,ChevronRight as X,Home as be,InlineCopyButton as xe,CopyButton as Ce,RefreshCw as Se,formatRelativeTime as De,ProUpgradeModal as Ie}from"@buoy-gg/shared-ui";import{useIsPro as Be}from"@buoy-gg/license";import{useRouteSitemap as Te}from"../useRouteSitemap";import{sitemapGroupTestID as Y,sitemapRouteTestID as Re}from"../utils/testIDs";import{jsx as t,jsxs as i}from"react/jsx-runtime";const d=ge.OS==="web"&&!fe();const F=d?22:16;const Le={path:"/",name:"index",type:"index",params:[],nodeType:"route",contextKey:"/",isInternal:false,children:[],depth:0};export function RoutesSitemap({style:r,injectedRoutes:g,injectedSource:f,injectedLastUpdatedAt:S,onNavigateRoute:b}){const[p,D]=B("");const[z,h]=B(false);const[v,E]=B(new Set(["Static Routes","Dynamic Routes"]));const[x,W]=B(false);const[P,V]=B(false);const $=Be();de(()=>{if(P&&$){V(false)}},[P,$]);const L=me();const{groups:k,stats:u,isLoaded:te,isSupported:oe,filteredRoutes:j,routes:_,refresh:K,lastUpdatedAt:O,source:N}=Te({searchQuery:p,sortBy:"path",injectedRoutes:g,injectedSource:f,injectedLastUpdatedAt:S});const re=H(()=>{return{summary:{total:u.total,static:u.static,dynamic:u.dynamic,layouts:u.layouts,groups:u.groups,timestamp:new Date().toISOString()},groups:k.map(a=>({title:a.title,description:a.description,count:a.routes.length,routes:a.routes.map(s=>({path:s.path,name:s.name,type:s.type,params:s.params,depth:s.depth,hasChildren:s.children.length>0,childrenCount:s.children.length}))})),allRoutes:_.map(a=>a.path)}},[k,u,_]);const ae=w(a=>{E(s=>{const y=new Set(s);if(y.has(a)){y.delete(a)}else{y.add(a)}return y})},[]);const G=w((a,s=0,y={})=>{const U=a.params;if(s>=U.length){let m=a.path;Object.entries(y).forEach(([I,Z])=>{if(a.type==="catch-all"){m=m.replace(`[...${I}]`,Z)}else{m=m.replace(`[${I}]`,Z)}});try{L.push(m)}catch(I){T.alert("Navigation Error",String(I))}return}const M=U[s];const ce=a.type==="catch-all"?`[...${M}]`:`[${M}]`;T.prompt("Enter Parameter Value",`Enter value for ${ce}:
|
|
2
2
|
|
|
3
|
-
Route: ${a.path}`,[{text:"Cancel",style:"cancel"},{text:s<U.length-1?"Next":"Navigate",onPress:m=>{if(m&&m.trim()){const I={...y,[M]:m.trim()};N(a,s+1,I)}else{T.alert("Invalid Value","Please enter a value for the parameter")}}}],"plain-text")},[L]);const A=w((a,s)=>{if(b){b(a);return}if(!$&&!s?.bypassPro){V(true);return}if(a.type==="layout"||a.type==="group"){T.alert("Cannot Navigate",`${a.type==="layout"?"Layouts":"Route groups"} are not navigable routes`);return}if(a.type==="dynamic"||a.type==="catch-all"){if(a.params.length===0){try{L.push(a.path)}catch(y){T.alert("Navigation Error",String(y))}return}N(a);return}try{L.push(a.path)}catch(y){T.alert("Navigation Error",String(y))}},[L,N,$,b]);const ne=w(()=>{A(Re,{bypassPro:true})},[A]);const ie=w(()=>{if(x)return;v(true);K();setTimeout(()=>v(false),400)},[x,K]);const le=H(()=>{if(!O)return"Awaiting route data";return`Updated ${Se(O)}`},[O]);const se=H(()=>{if(!G)return"Source: unknown";return`Source: ${G}`},[G]);const Q=H(()=>{if(p&&j.length>0){return[{title:"Search Results",icon:"",routes:j}]}return k},[p,j,k]);if(!te){return t(n,{style:[e.container,r],children:t(n,{style:e.loadingContainer,children:t(l,{style:e.loadingText,testID:"buoy-routes-sitemap-loading",children:oe?"Loading routes...":"Route sitemap isn't available on the dashboard \u2014 the route tree lives on the device. Use the Events tab to see navigation here."})})})}return i(n,{style:[e.container,r],children:[z&&i(n,{style:e.searchContainer,testID:"buoy-routes-sitemap-search-field",children:[t(q,{size:16,color:o.color.textTertiary}),t(ue,{style:e.searchInput,placeholder:"Search routes...",placeholderTextColor:o.color.placeholder,value:p,onChangeText:D,autoCapitalize:"none",autoCorrect:false,autoFocus:true,testID:"buoy-routes-sitemap-search",accessibilityLabel:"Search routes"}),p.length>0&&t(C,{onPress:()=>D(""),style:e.clearButton,testID:"buoy-routes-sitemap-search-clear",accessibilityRole:"button",accessibilityLabel:"Clear route search",children:t(l,{style:e.clearButtonText,children:"\u2715"})}),t(C,{style:e.closeSearchButton,onPress:()=>{h(false);D("")},testID:"buoy-routes-sitemap-search-done",accessibilityRole:"button",accessibilityLabel:"Done searching routes",children:t(l,{style:e.closeSearchText,children:"Done"})})]}),i(he,{testID:"buoy-routes-sitemap-scroll",style:e.scrollView,contentContainerStyle:e.scrollContent,children:[!z&&i(n,{style:e.header,children:[i(n,{style:e.actionsRow,children:[i(n,{style:[e.actionWrapper,d&&e.actionWrapperDesktop],children:[t(C,{style:[e.iconButton,d&&e.iconButtonDesktop],onPress:ne,accessibilityLabel:"Go to home route",accessibilityRole:"button",testID:"buoy-routes-sitemap-home",children:t(me,{size:F,color:o.color.textSecondary})}),t(l,{style:[e.actionLabel,d&&e.actionLabelDesktop],children:"Home"})]}),i(n,{style:[e.actionWrapper,d&&e.actionWrapperDesktop],children:[t(xe,{value:re,testID:"buoy-routes-sitemap-copy",size:d?F:14,buttonStyle:d?e.actionButtonHeaderDesktop:e.actionButtonHeader}),t(l,{style:[e.actionLabel,d&&e.actionLabelDesktop],children:"Copy"})]}),i(n,{style:[e.actionWrapper,d&&e.actionWrapperDesktop],children:[t(C,{style:[e.iconButton,d&&e.iconButtonDesktop,x&&e.refreshButtonDisabled],onPress:ie,disabled:x,testID:"buoy-routes-sitemap-refresh",accessibilityRole:"button",accessibilityLabel:"Refresh route tree",children:t(Ce,{size:F,color:x?o.color.textTertiary:o.color.textSecondary})}),t(l,{style:[e.actionLabel,d&&e.actionLabelDesktop],children:"Refresh"})]}),i(n,{style:[e.actionWrapper,d&&e.actionWrapperDesktop],children:[t(C,{style:[e.iconButton,d&&e.iconButtonDesktop],onPress:()=>h(true),testID:"buoy-routes-sitemap-search-open",accessibilityRole:"button",accessibilityLabel:"Search routes",children:t(q,{size:F,color:o.color.textSecondary})}),t(l,{style:[e.actionLabel,d&&e.actionLabelDesktop],children:"Search"})]})]}),i(n,{style:e.statsGrid,children:[t(R,{value:u.total,label:"Total",id:"total"}),t(R,{value:u.static,label:"Static",id:"static"}),t(R,{value:u.dynamic,label:"Dynamic",id:"dynamic"}),t(R,{value:u.catchAll,label:"Catch-All",id:"catch-all"}),t(R,{value:u.layouts,label:"Layouts",id:"layouts"}),t(R,{value:u.groups,label:"Groups",id:"groups"})]})]}),Q.length===0?t(pe,{testID:"buoy-routes-sitemap-empty",otto:"map",title:"No routes found",message:"Nothing in the router matches. Clear the search to see the whole tree."}):Q.map(a=>t(Le,{group:a,isExpanded:p.length>0||W.has(a.title),onToggleExpand:()=>ae(a.title),onNavigate:A},a.title)),i(n,{style:e.metaFooter,children:[t(l,{style:e.metaText,testID:"buoy-routes-sitemap-updated",children:le}),t(n,{style:e.sourceBadge,children:t(l,{style:e.sourceText,testID:"buoy-routes-sitemap-source",children:se})})]})]}),t(De,{visible:P,onClose:()=>V(false),featureName:"Route Navigation"})]})}function R({value:r,label:g,id:f}){return i(n,{style:e.statItem,testID:`buoy-routes-stat-${f}`,accessibilityLabel:`${g}, ${r}`,children:[t(l,{style:e.statValue,testID:`buoy-routes-stat-${f}-value`,children:r}),t(l,{style:e.statLabel,children:g})]})}function Le({group:r,isExpanded:g,onToggleExpand:f,onNavigate:S}){return i(n,{style:e.groupContainer,children:[i(C,{style:e.groupHeader,onPress:f,activeOpacity:.7,testID:Y(r.title),accessibilityRole:"button",accessibilityLabel:`${r.title}, ${r.routes.length} routes`,children:[i(n,{style:e.groupHeaderLeft,children:[g?t(J,{size:14,color:o.color.textSecondary}):t(X,{size:14,color:o.color.textSecondary}),t(l,{style:e.groupTitle,children:r.title})]}),t(n,{style:e.groupBadge,children:t(l,{style:e.groupCount,testID:`${Y(r.title)}-count`,children:r.routes.length})})]}),r.description&&t(n,{style:e.groupDescription,children:t(l,{style:e.groupDescriptionText,children:r.description})}),g&&t(n,{style:e.routesList,children:r.routes.map((b,p)=>t(ee,{route:b,onNavigate:S},`${b.path}-${p}`))})]})}function ee({route:r,depth:g=0,onNavigate:f}){const[S,b]=B(false);const p=r.children.length>0;const D=we(r.type);const z=r.type!=="layout"&&r.type!=="group";const h=Te(r.path);const W=p;const E=W?S:true;return t(n,{style:[e.routeItem,{marginLeft:g*12}],testID:h,children:i(n,{style:e.routeCard,children:[i(n,{style:e.routeHeader,children:[W?i(C,{style:e.routeHeaderLeft,onPress:()=>b(!S),activeOpacity:.7,testID:`${h}-toggle`,accessibilityRole:"button",accessibilityLabel:`${r.path}, ${r.type}, ${r.children.length} nested`,children:[t(n,{style:e.expandIndicator,children:S?t(J,{size:14,color:o.color.textSecondary}):t(X,{size:14,color:o.color.textSecondary})}),t(l,{style:e.routePath,numberOfLines:3,testID:`${h}-path`,children:r.path})]}):i(n,{style:e.routeHeaderLeft,accessible:true,accessibilityLabel:`${r.path}, ${r.type}`,children:[t(n,{style:e.expandIndicator}),t(l,{style:e.routePath,numberOfLines:3,testID:`${h}-path`,children:r.path})]}),i(n,{style:e.routeHeaderActions,children:[p&&t(n,{style:e.childCountBadge,children:t(l,{style:e.childCountText,testID:`${h}-children-count`,children:r.children.length})}),t(n,{style:[e.typeTag,{backgroundColor:`${D}15`,borderColor:`${D}40`}],children:t(l,{style:[e.typeText,{color:D}],testID:`${h}-type`,children:r.type.toUpperCase()})}),t(be,{value:r.path,buttonStyle:e.iconAction,testID:`${h}-copy`}),z&&t(C,{style:e.goButton,onPress:()=>f(r),activeOpacity:.7,testID:`${h}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${r.path}`,children:t(l,{style:e.goButtonText,children:"Go"})})]})]}),E&&p&&t(n,{style:e.childrenContainer,children:r.children.map((x,v)=>t(ee,{route:x,depth:g+1,onNavigate:f},`${x.path}-${v}`))})]})})}function we(r){switch(r){case"static":return"#3B82F6";case"dynamic":return"#F59E0B";case"catch-all":return"#EC4899";case"index":return"#10B981";case"layout":return"#8B5CF6";case"group":return"#6366F1";case"not-found":return"#EF4444";default:return"#6B7280"}}const e=ye.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},loadingText:{color:o.color.textSecondary,fontSize:14,fontFamily:c,textAlign:"center",lineHeight:20,paddingHorizontal:32,maxWidth:420},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:o.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,paddingBottom:4},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"30%",minWidth:90,backgroundColor:o.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:o.color.text,fontFamily:c},statLabel:{fontSize:10,color:o.color.textTertiary,marginTop:4,fontFamily:c,textTransform:"uppercase",letterSpacing:.5},actionWrapper:{flex:1,alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionWrapperDesktop:{gap:8,minWidth:72},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:o.color.surfaceElevated},actionButtonHeaderDesktop:{padding:12,borderRadius:8,backgroundColor:o.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},iconButtonDesktop:{padding:12,borderRadius:8,backgroundColor:o.color.surfaceElevated},actionLabel:{fontSize:8,color:o.color.textTertiary,fontFamily:c,textTransform:"uppercase",letterSpacing:.5},actionLabelDesktop:{fontSize:12},refreshButtonDisabled:{opacity:.5},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:o.color.border},metaText:{fontSize:12,color:o.color.textSecondary,fontFamily:c},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:o.color.border,backgroundColor:o.color.surface},sourceText:{fontSize:11,color:o.color.textSecondary,textTransform:"capitalize",fontFamily:c},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:o.color.border},searchInput:{flex:1,color:o.color.text,fontSize:14,fontFamily:c},clearButton:{padding:4},clearButtonText:{color:o.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:o.color.accent,fontSize:14,fontWeight:"600",fontFamily:c},scrollView:{flex:1},scrollContent:{paddingBottom:8},emptyState:{padding:32,alignItems:"center"},emptyText:{color:o.color.textSecondary,fontSize:14,fontFamily:c},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:o.color.surface,borderLeftWidth:3,borderLeftColor:o.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:o.color.text,fontFamily:c,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:c},routesList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:o.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:o.color.fillTertiary},groupDescriptionText:{fontSize:11,color:o.color.textSecondary,fontFamily:c,lineHeight:16},routeItem:{marginBottom:6},routeCard:{backgroundColor:o.color.surface,borderRadius:6,borderWidth:1,borderColor:o.color.border,overflow:"hidden",shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},routeHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:7,paddingHorizontal:10,gap:8},expandIndicator:{width:18,alignItems:"center"},routeHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},routePath:{fontSize:13,fontWeight:"600",color:o.color.text,fontFamily:c,flex:1},routeHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},childCountBadge:{backgroundColor:"#6B728015",borderColor:"#6B728040",borderWidth:1,borderRadius:12,paddingHorizontal:7,paddingVertical:2,minWidth:22,alignItems:"center",justifyContent:"center"},childCountText:{fontSize:11,fontWeight:"600",color:o.color.textSecondary,fontFamily:c},typeTag:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},typeText:{fontSize:10,fontWeight:"600",fontFamily:c},iconAction:{width:28,height:24,borderRadius:4,backgroundColor:o.color.surfaceElevated,borderWidth:1,borderColor:o.color.border,alignItems:"center",justifyContent:"center"},goButton:{height:24,paddingHorizontal:10,borderRadius:4,alignItems:"center",justifyContent:"center",backgroundColor:o.color.accentSoft,borderWidth:1,borderColor:o.color.accentBorder},goButtonText:{fontSize:12,color:o.color.accent,fontFamily:c,fontWeight:"600"},childrenContainer:{borderLeftWidth:2,borderLeftColor:o.color.border,marginLeft:16,marginRight:8,marginTop:2,marginBottom:8}});
|
|
3
|
+
Route: ${a.path}`,[{text:"Cancel",style:"cancel"},{text:s<U.length-1?"Next":"Navigate",onPress:m=>{if(m&&m.trim()){const I={...y,[M]:m.trim()};G(a,s+1,I)}else{T.alert("Invalid Value","Please enter a value for the parameter")}}}],"plain-text")},[L]);const A=w((a,s)=>{if(b){b(a);return}if(!$&&!s?.bypassPro){V(true);return}if(a.type==="layout"||a.type==="group"){T.alert("Cannot Navigate",`${a.type==="layout"?"Layouts":"Route groups"} are not navigable routes`);return}if(a.type==="dynamic"||a.type==="catch-all"){if(a.params.length===0){try{L.push(a.path)}catch(y){T.alert("Navigation Error",String(y))}return}G(a);return}try{L.push(a.path)}catch(y){T.alert("Navigation Error",String(y))}},[L,G,$,b]);const ne=w(()=>{A(Le,{bypassPro:true})},[A]);const ie=w(()=>{if(x)return;W(true);K();setTimeout(()=>W(false),400)},[x,K]);const le=H(()=>{if(!O)return"Awaiting route data";return`Updated ${De(O)}`},[O]);const se=H(()=>{if(!N)return"Source: unknown";return`Source: ${N}`},[N]);const Q=H(()=>{if(p&&j.length>0){return[{title:"Search Results",icon:"",routes:j}]}return k},[p,j,k]);if(!te){return t(n,{style:[e.container,r],children:t(n,{style:e.loadingContainer,children:t(l,{style:e.loadingText,testID:"buoy-routes-sitemap-loading",children:oe?"Loading routes...":"Route sitemap isn't available on the dashboard \u2014 the route tree lives on the device. Use the Events tab to see navigation here."})})})}return i(n,{style:[e.container,r],children:[z&&i(n,{style:e.searchContainer,testID:"buoy-routes-sitemap-search-field",children:[t(q,{size:16,color:o.color.textTertiary}),t(ue,{style:e.searchInput,placeholder:"Search routes...",placeholderTextColor:o.color.placeholder,value:p,onChangeText:D,autoCapitalize:"none",autoCorrect:false,autoFocus:true,testID:"buoy-routes-sitemap-search",accessibilityLabel:"Search routes"}),p.length>0&&t(C,{onPress:()=>D(""),style:e.clearButton,testID:"buoy-routes-sitemap-search-clear",accessibilityRole:"button",accessibilityLabel:"Clear route search",children:t(l,{style:e.clearButtonText,children:"\u2715"})}),t(C,{style:e.closeSearchButton,onPress:()=>{h(false);D("")},testID:"buoy-routes-sitemap-search-done",accessibilityRole:"button",accessibilityLabel:"Done searching routes",children:t(l,{style:e.closeSearchText,children:"Done"})})]}),i(he,{testID:"buoy-routes-sitemap-scroll",style:e.scrollView,contentContainerStyle:e.scrollContent,children:[!z&&i(n,{style:e.header,children:[i(n,{style:e.actionsRow,children:[i(n,{style:[e.actionWrapper,d&&e.actionWrapperDesktop],children:[t(C,{style:[e.iconButton,d&&e.iconButtonDesktop],onPress:ne,accessibilityLabel:"Go to home route",accessibilityRole:"button",testID:"buoy-routes-sitemap-home",children:t(be,{size:F,color:o.color.textSecondary})}),t(l,{style:[e.actionLabel,d&&e.actionLabelDesktop],children:"Home"})]}),i(n,{style:[e.actionWrapper,d&&e.actionWrapperDesktop],children:[t(Ce,{value:re,testID:"buoy-routes-sitemap-copy",size:d?F:14,buttonStyle:d?e.actionButtonHeaderDesktop:e.actionButtonHeader}),t(l,{style:[e.actionLabel,d&&e.actionLabelDesktop],children:"Copy"})]}),i(n,{style:[e.actionWrapper,d&&e.actionWrapperDesktop],children:[t(C,{style:[e.iconButton,d&&e.iconButtonDesktop,x&&e.refreshButtonDisabled],onPress:ie,disabled:x,testID:"buoy-routes-sitemap-refresh",accessibilityRole:"button",accessibilityLabel:"Refresh route tree",children:t(Se,{size:F,color:x?o.color.textTertiary:o.color.textSecondary})}),t(l,{style:[e.actionLabel,d&&e.actionLabelDesktop],children:"Refresh"})]}),i(n,{style:[e.actionWrapper,d&&e.actionWrapperDesktop],children:[t(C,{style:[e.iconButton,d&&e.iconButtonDesktop],onPress:()=>h(true),testID:"buoy-routes-sitemap-search-open",accessibilityRole:"button",accessibilityLabel:"Search routes",children:t(q,{size:F,color:o.color.textSecondary})}),t(l,{style:[e.actionLabel,d&&e.actionLabelDesktop],children:"Search"})]})]}),i(n,{style:e.statsGrid,children:[t(R,{value:u.total,label:"Total",id:"total"}),t(R,{value:u.static,label:"Static",id:"static"}),t(R,{value:u.dynamic,label:"Dynamic",id:"dynamic"}),t(R,{value:u.catchAll,label:"Catch-All",id:"catch-all"}),t(R,{value:u.layouts,label:"Layouts",id:"layouts"}),t(R,{value:u.groups,label:"Groups",id:"groups"})]})]}),Q.length===0?t(pe,{testID:"buoy-routes-sitemap-empty",otto:"map",title:"No routes found",message:"Nothing in the router matches. Clear the search to see the whole tree."}):Q.map(a=>t(we,{group:a,isExpanded:p.length>0||v.has(a.title),onToggleExpand:()=>ae(a.title),onNavigate:A},a.title)),i(n,{style:e.metaFooter,children:[t(l,{style:e.metaText,testID:"buoy-routes-sitemap-updated",children:le}),t(n,{style:e.sourceBadge,children:t(l,{style:e.sourceText,testID:"buoy-routes-sitemap-source",children:se})})]})]}),t(Ie,{visible:P,onClose:()=>V(false),featureName:"Route Navigation"})]})}function R({value:r,label:g,id:f}){return i(n,{style:e.statItem,testID:`buoy-routes-stat-${f}`,accessibilityLabel:`${g}, ${r}`,children:[t(l,{style:e.statValue,testID:`buoy-routes-stat-${f}-value`,children:r}),t(l,{style:e.statLabel,children:g})]})}function we({group:r,isExpanded:g,onToggleExpand:f,onNavigate:S}){return i(n,{style:e.groupContainer,children:[i(C,{style:e.groupHeader,onPress:f,activeOpacity:.7,testID:Y(r.title),accessibilityRole:"button",accessibilityLabel:`${r.title}, ${r.routes.length} routes`,children:[i(n,{style:e.groupHeaderLeft,children:[g?t(J,{size:14,color:o.color.textSecondary}):t(X,{size:14,color:o.color.textSecondary}),t(l,{style:e.groupTitle,children:r.title})]}),t(n,{style:e.groupBadge,children:t(l,{style:e.groupCount,testID:`${Y(r.title)}-count`,children:r.routes.length})})]}),r.description&&t(n,{style:e.groupDescription,children:t(l,{style:e.groupDescriptionText,children:r.description})}),g&&t(n,{style:e.routesList,children:r.routes.map((b,p)=>t(ee,{route:b,onNavigate:S},`${b.path}-${p}`))})]})}function ee({route:r,depth:g=0,onNavigate:f}){const[S,b]=B(false);const p=r.children.length>0;const D=ze(r.type);const z=r.type!=="layout"&&r.type!=="group";const h=Re(r.path);const v=p;const E=v?S:true;return t(n,{style:[e.routeItem,{marginLeft:g*12}],testID:h,children:i(n,{style:e.routeCard,children:[i(n,{style:e.routeHeader,children:[v?i(C,{style:e.routeHeaderLeft,onPress:()=>b(!S),activeOpacity:.7,testID:`${h}-toggle`,accessibilityRole:"button",accessibilityLabel:`${r.path}, ${r.type}, ${r.children.length} nested`,children:[t(n,{style:e.expandIndicator,children:S?t(J,{size:14,color:o.color.textSecondary}):t(X,{size:14,color:o.color.textSecondary})}),t(l,{style:e.routePath,numberOfLines:3,testID:`${h}-path`,children:r.path})]}):i(n,{style:e.routeHeaderLeft,accessible:true,accessibilityLabel:`${r.path}, ${r.type}`,children:[t(n,{style:e.expandIndicator}),t(l,{style:e.routePath,numberOfLines:3,testID:`${h}-path`,children:r.path})]}),i(n,{style:e.routeHeaderActions,children:[p&&t(n,{style:e.childCountBadge,children:t(l,{style:e.childCountText,testID:`${h}-children-count`,children:r.children.length})}),t(n,{style:[e.typeTag,{backgroundColor:`${D}15`,borderColor:`${D}40`}],children:t(l,{style:[e.typeText,{color:D}],testID:`${h}-type`,children:r.type.toUpperCase()})}),t(xe,{value:r.path,buttonStyle:e.iconAction,testID:`${h}-copy`}),z&&t(C,{style:e.goButton,onPress:()=>f(r),activeOpacity:.7,testID:`${h}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${r.path}`,children:t(l,{style:e.goButtonText,children:"Go"})})]})]}),E&&p&&t(n,{style:e.childrenContainer,children:r.children.map((x,W)=>t(ee,{route:x,depth:g+1,onNavigate:f},`${x.path}-${W}`))})]})})}function ze(r){switch(r){case"static":return"#3B82F6";case"dynamic":return"#F59E0B";case"catch-all":return"#EC4899";case"index":return"#10B981";case"layout":return"#8B5CF6";case"group":return"#6366F1";case"not-found":return"#EF4444";default:return"#6B7280"}}const e=ye.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},loadingText:{color:o.color.textSecondary,fontSize:14,fontFamily:c,textAlign:"center",lineHeight:20,paddingHorizontal:32,maxWidth:420},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:o.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,paddingBottom:4},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"30%",minWidth:90,backgroundColor:o.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:o.color.text,fontFamily:c},statLabel:{fontSize:10,color:o.color.textTertiary,marginTop:4,fontFamily:c,textTransform:"uppercase",letterSpacing:.5},actionWrapper:{flex:1,alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionWrapperDesktop:{gap:8,minWidth:72},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:o.color.surfaceElevated},actionButtonHeaderDesktop:{padding:12,borderRadius:8,backgroundColor:o.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},iconButtonDesktop:{padding:12,borderRadius:8,backgroundColor:o.color.surfaceElevated},actionLabel:{fontSize:8,color:o.color.textTertiary,fontFamily:c,textTransform:"uppercase",letterSpacing:.5},actionLabelDesktop:{fontSize:12},refreshButtonDisabled:{opacity:.5},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:o.color.border},metaText:{fontSize:12,color:o.color.textSecondary,fontFamily:c},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:o.color.border,backgroundColor:o.color.surface},sourceText:{fontSize:11,color:o.color.textSecondary,textTransform:"capitalize",fontFamily:c},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:o.color.border},searchInput:{flex:1,color:o.color.text,fontSize:14,fontFamily:c},clearButton:{padding:4},clearButtonText:{color:o.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:o.color.accent,fontSize:14,fontWeight:"600",fontFamily:c},scrollView:{flex:1},scrollContent:{paddingBottom:8},emptyState:{padding:32,alignItems:"center"},emptyText:{color:o.color.textSecondary,fontSize:14,fontFamily:c},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:o.color.surface,borderLeftWidth:3,borderLeftColor:o.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:o.color.text,fontFamily:c,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:c},routesList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:o.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:o.color.fillTertiary},groupDescriptionText:{fontSize:11,color:o.color.textSecondary,fontFamily:c,lineHeight:16},routeItem:{marginBottom:6},routeCard:{backgroundColor:o.color.surface,borderRadius:6,borderWidth:1,borderColor:o.color.border,overflow:"hidden",shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},routeHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:7,paddingHorizontal:10,gap:8},expandIndicator:{width:18,alignItems:"center"},routeHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},routePath:{fontSize:13,fontWeight:"600",color:o.color.text,fontFamily:c,flex:1},routeHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},childCountBadge:{backgroundColor:"#6B728015",borderColor:"#6B728040",borderWidth:1,borderRadius:12,paddingHorizontal:7,paddingVertical:2,minWidth:22,alignItems:"center",justifyContent:"center"},childCountText:{fontSize:11,fontWeight:"600",color:o.color.textSecondary,fontFamily:c},typeTag:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},typeText:{fontSize:10,fontWeight:"600",fontFamily:c},iconAction:{width:28,height:24,borderRadius:4,backgroundColor:o.color.surfaceElevated,borderWidth:1,borderColor:o.color.border,alignItems:"center",justifyContent:"center"},goButton:{height:24,paddingHorizontal:10,borderRadius:4,alignItems:"center",justifyContent:"center",backgroundColor:o.color.accentSoft,borderWidth:1,borderColor:o.color.accentBorder},goButtonText:{fontSize:12,color:o.color.accent,fontFamily:c,fontWeight:"600"},childrenContainer:{borderLeftWidth:2,borderLeftColor:o.color.border,marginLeft:16,marginRight:8,marginTop:2,marginBottom:8}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";let o=null;let l=null;let u=null;let n=false;let s=false;let i=null;function a(e,r){if(__DEV__){if(r){console.error(`[RouteEvents] ${e}`,r)}else{console.warn(`[RouteEvents] ${e}`)}}}export function isExpoRouterStoreSupported(){return typeof require!=="undefined"}export function getExpoRouterStore(){if(o){return o}if(!isExpoRouterStoreSupported()){return null}const e=()=>{try{const t=require("expo-router/build/global-state/router-store");if(t?.store){o=t.store;l="build";u=null;n=false;return true}}catch(t){u=t}return false};const r=()=>{try{const t=require("expo-router/src/global-state/router-store");if(t?.store){o=t.store;l="src";u=null;n=false;return true}}catch(t){u=t}return false};if(e()||r()){return o}if(!n){a("Unable to load expo-router internals. @buoy-gg/route-events requires expo-router >= 2.0.0. Install expo-router and ensure it is configured before using the Routes tab.",u??void 0);n=true}return null}export function loadRouteNode(){const e=getExpoRouterStore();if(!e){return null}if(e.routeNode){s=false;i=Date.now();return e.routeNode}const r=e.navigationRef?.isReady?.();if(__DEV__&&!s&&r){a("Expo Router route tree is unavailable. Ensure your app directory is configured and that expo-router is initialized before opening the Route Events devtool.");s=true}return null}export function getRouteNodeMetadata(){return{source:l,lastLoadedAt:i}}
|
|
1
|
+
"use strict";let o=null;let l=null;let u=null;let n=false;let s=false;let i=null;function a(e,r){if(__DEV__){if(r){console.error(`[RouteEvents] ${e}`,r)}else{console.warn(`[RouteEvents] ${e}`)}}}export function isExpoRouterStoreSupported(){return typeof require!=="undefined"}export function getExpoRouterStore(){if(o){return o}if(!isExpoRouterStoreSupported()){return null}const e=()=>{try{const t=require("expo-router/build/global-state/router-store");if(t?.store){o=t.store;l="build";u=null;n=false;return true}}catch(t){u=t}return false};const r=()=>{try{const t=require("expo-router/src/global-state/router-store");if(t?.store){o=t.store;l="src";u=null;n=false;return true}}catch(t){u=t}return false};if(e()||r()){return o}if(!n){a("Unable to load expo-router internals. @buoy-gg/route-events requires expo-router >= 2.0.0. Install expo-router and ensure it is configured before using the Routes tab.",u??void 0);n=true}return null}export function loadRouteNode(){const e=getExpoRouterStore();if(!e){return null}if(e.routeNode){s=false;i=Date.now();return e.routeNode}const r=e.navigationRef?.isReady?.();if(__DEV__&&!s&&r){a("Expo Router route tree is unavailable. Ensure your app directory is configured and that expo-router is initialized before opening the Route Events devtool.");s=true}return null}export function getRouteNodeMetadata(){return{source:l,lastLoadedAt:i}}export function isRouteListComplete(){return true}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{getBrowserHref as
|
|
1
|
+
"use strict";import{getBrowserHref as u}from"@buoy-gg/shared-ui/utils";import{getBrowserRoutePaths as o,getBrowserRoutesUpdatedAt as i}from"./browserRouteRegistry";export function isExpoRouterStoreSupported(){return typeof window!=="undefined"}export function loadRouteNode(){if(!isExpoRouterStoreSupported())return null;const r=new Set([...o(),new URL(u()).pathname]);return{route:"",type:"layout",contextKey:"browser",children:[...r].map(e=>({route:e.replace(/^\//,"")||"index",type:"route",contextKey:e,children:[],dynamic:e.split("/").flatMap(n=>{const t=/^\[(\.\.\.)?([^\]]+)\]$/.exec(n);return t?[{name:t[2],deep:!!t[1]}]:[]})}))}}export function getExpoRouterStore(){return{routeNode:loadRouteNode(),navigationRef:{isReady:()=>typeof window!=="undefined"}}}export function getRouteNodeMetadata(){return{source:null,lastLoadedAt:i()}}export function isRouteListComplete(){return o().length>0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{getSafeRouter as
|
|
1
|
+
"use strict";import{getSafeRouter as w}from"@buoy-gg/shared-ui";import{pathMatchesSitemap as T}from"./sitemapMatch";import{routeEventStore as u}from"../stores/routeEventStore";import{navigationStackStore as o}from"../stores/navigationStackStore";import{RouteParser as k}from"../RouteParser";import{loadRouteNode as m,getRouteNodeMetadata as E,isRouteListComplete as b}from"../expoRouterStore";import{isOverWireBudget as x}from"@buoy-gg/shared-ui";async function y(t,a){const e=o.getStack();const r=e.findIndex(n=>n.isFocused);const s=o.getActions();if(r<0||!s||typeof t.replace!=="function"){throw new Error("This app's history isn't captured yet, so Buoy can't start over. Open the Routes tool once, or navigate without reset.")}if(r>0){const n=globalThis;await new Promise((i,c)=>{const l=v=>{clearTimeout(h);n.removeEventListener?.("popstate",f);if(v)i();else c(new Error("The app didn't go back to its first page, so nothing was reset. Try again, or navigate without reset."))};const f=()=>setTimeout(()=>l(true),0);const h=setTimeout(()=>l(false),1500);n.addEventListener?.("popstate",f);s.popToTop()})}if(o.getStack().findIndex(n=>n.isFocused)!==0){throw new Error("The app isn't on its first page, so nothing was reset. Try again, or navigate without reset.")}t.replace(a);return{navigated:a,replaced:true,reset:true}}export const SNAPSHOT_PARAM_INLINE_LIMIT=16*1024;const S=Object.freeze({__buoyOmitted:"route-params",note:"Navigation params stay on the device."});function d(t){if(t==null)return false;return x(t,SNAPSHOT_PARAM_INLINE_LIMIT)}function p(t){if(!d(t))return t;return S}function I(t){if(!d(t.params))return t;return{...t,params:p(t.params)}}function R(t){if(!d(t.params))return t;return{...t,params:p(t.params)}}function g(){const t=E();return{routes:k.parseRouteTree(m()),source:t.source,lastUpdatedAt:t.lastLoadedAt}}export const routeEventsSyncAdapter={version:3,getSnapshot:()=>({events:u.getEvents().map(I),sitemap:g(),stack:o.getStack().map(R)}),subscribe:t=>{const a=u.subscribeToEvents(t);const e=o.subscribe(t);let r=null;if(!m()){let s=0;const n=100;const i=()=>{s+=1;if(m()){r=null;t();return}r=s<n?setTimeout(i,100):null};r=setTimeout(i,100)}return()=>{a();e();if(r)clearTimeout(r)}},actions:{clearEvents:()=>{u.clearEvents()},getCurrentRoute:()=>{const t=u.getEvents()[0];if(t&&u.isCapturing()){return{path:t.pathname,params:p(t.params),at:t.timestamp,source:"event"}}const a=o.getStack();const e=a.find(r=>r.isFocused)??a[a.length-1];if(e?.pathname){return{path:e.pathname,params:p(e.params??{}),at:null,source:"stack"}}if(t){return{path:t.pathname,params:p(t.params),at:t.timestamp,source:"event",stale:true}}return{path:null,params:{},at:null,source:null}},navigate:t=>{const a=t;const e=a?.path;if(!e){throw new Error("navigate requires a 'path' param")}const r=w();if(!r){const i=o.getActions();const c=e.replace(/^\//,"");if(!i?.navigateToRoute||!c){throw new Error("expo-router is not available here and no navigation container was captured \u2014 is <RouteTracker /> mounted inside your NavigationContainer?")}const l=i.navigateToRoute(c,a?.params);if(!l){throw new Error(`Could not navigate to "${c}" \u2014 no navigation container is live.`)}return{navigated:e,replaced:false,via:"react-navigation"}}let s=[];try{s=g().routes}catch{s=[]}if(b()&&T(e,s)===false){throw new Error(`No screen matches "${e}". Navigating there would open expo-router's "Unmatched Route" page, which replaces the app's layout (and disconnects Buoy). Read the sitemap for the paths this app has.`)}if(a?.reset===true){if(typeof r.canDismiss!=="function")return y(r,e);try{if(r.canDismiss())r.dismissAll?.()}catch{}r.navigate(e);return{navigated:e,replaced:false,reset:true}}const n=a?.replace===true&&typeof r.replace==="function"?r.replace:r.navigate;n(e);return{navigated:e,replaced:a?.replace===true}},stackNavigateToIndex:t=>{const a=t?.index;if(typeof a!=="number"){throw new Error("stackNavigateToIndex requires a numeric 'index'")}const e=o.getActions();if(!e)throw new Error("navigation stack is not available");e.navigateToIndex(a);return{navigatedToIndex:a}},stackPopToIndex:t=>{const a=t?.index;if(typeof a!=="number"){throw new Error("stackPopToIndex requires a numeric 'index'")}const e=o.getActions();if(!e)throw new Error("navigation stack is not available");e.popToIndex(a);return{poppedToIndex:a}},stackGoBack:()=>{const t=o.getActions();if(!t)throw new Error("navigation stack is not available");t.goBack();return{wentBack:true}},stackPopToTop:()=>{const t=o.getActions();if(!t)throw new Error("navigation stack is not available");t.popToTop();return{poppedToTop:true}}}};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare function registerBrowserRoutes(paths: readonly string[]): () => void;
|
|
2
2
|
export declare function getBrowserRoutePaths(): string[];
|
|
3
3
|
export declare function getBrowserRoutesUpdatedAt(): number | null;
|
|
4
|
+
export declare function getBrowserRouteInfo(pathname: string): {
|
|
5
|
+
segments: string[];
|
|
6
|
+
params: Record<string, string | string[]>;
|
|
7
|
+
};
|
|
4
8
|
//# sourceMappingURL=browserRouteRegistry.d.ts.map
|
|
@@ -32,5 +32,7 @@ export declare function getRouteNodeMetadata(): {
|
|
|
32
32
|
source: "build" | "src" | null;
|
|
33
33
|
lastLoadedAt: number | null;
|
|
34
34
|
};
|
|
35
|
+
/** Whether the route list is the whole app. expo-router's tree always is. */
|
|
36
|
+
export declare function isRouteListComplete(): boolean;
|
|
35
37
|
export {};
|
|
36
38
|
//# sourceMappingURL=expoRouterStore.d.ts.map
|
|
@@ -10,4 +10,6 @@ export declare function getRouteNodeMetadata(): {
|
|
|
10
10
|
source: 'build' | 'src' | null;
|
|
11
11
|
lastLoadedAt: number | null;
|
|
12
12
|
};
|
|
13
|
+
/** Without registerBrowserRoutes the list holds only the current page, so it can't rule a path out. */
|
|
14
|
+
export declare function isRouteListComplete(): boolean;
|
|
13
15
|
//# sourceMappingURL=expoRouterStore.web.d.ts.map
|
|
@@ -90,7 +90,11 @@ export declare const routeEventsSyncAdapter: {
|
|
|
90
90
|
* Navigate the device to a concrete path. The dashboard resolves any
|
|
91
91
|
* dynamic params into a concrete path before invoking this.
|
|
92
92
|
*/
|
|
93
|
-
navigate: (params?: unknown) => {
|
|
93
|
+
navigate: (params?: unknown) => Promise<{
|
|
94
|
+
navigated: string;
|
|
95
|
+
replaced: boolean;
|
|
96
|
+
reset: boolean;
|
|
97
|
+
}> | {
|
|
94
98
|
navigated: string;
|
|
95
99
|
replaced: boolean;
|
|
96
100
|
via: string;
|
package/lib/web/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";var It=Object.defineProperty;var vo=Object.getOwnPropertyDescriptor;var xo=Object.getOwnPropertyNames;var So=Object.prototype.hasOwnProperty;var Co=(e,t)=>{for(var o in t)It(e,o,{get:t[o],enumerable:true})},kt=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of xo(t))!So.call(e,a)&&a!==o&&It(e,a,{get:()=>t[a],enumerable:!(r=vo(t,a))||r.enumerable});return e},To=(e,t,o)=>(kt(e,t,"default"),o&&kt(o,t,"default"));typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{RoutesIcon as Ro}from"@buoy-gg/floating-tools-core/web";import{useState as we,useCallback as ue,useEffect as Bt,useRef as wo,useMemo as Ie}from"react";var Dt={};Co(Dt,{AccessibilityInfo:()=>Do,ActivityIndicator:()=>Sr,Alert:()=>_,Animated:()=>Eo,AppRegistry:()=>Lo,AppState:()=>$o,Appearance:()=>Po,BackHandler:()=>Fo,Button:()=>Cr,CheckBox:()=>Qo,Clipboard:()=>zo,DeviceEventEmitter:()=>ur,Dimensions:()=>Ao,Easing:()=>No,FlatList:()=>Pt,I18nManager:()=>Wo,Image:()=>qo,ImageBackground:()=>Zo,InteractionManager:()=>Vo,Keyboard:()=>jo,KeyboardAvoidingView:()=>Xo,LayoutAnimation:()=>Oo,Linking:()=>Ho,LogBox:()=>cr,Modal:()=>vr,NativeEventEmitter:()=>Mo,NativeModules:()=>Bo,PanResponder:()=>Uo,Picker:()=>Yo,PixelRatio:()=>Go,Platform:()=>Et,Pressable:()=>br,ProgressBar:()=>er,RefreshControl:()=>tr,SafeAreaView:()=>or,ScrollView:()=>Ue,SectionList:()=>rr,Share:()=>Ko,StatusBar:()=>ar,StyleSheet:()=>ve,Switch:()=>xr,Text:()=>p,TextInput:()=>Lt,Touchable:()=>nr,TouchableHighlight:()=>yr,TouchableNativeFeedback:()=>ir,TouchableOpacity:()=>W,TouchableWithoutFeedback:()=>fr,UIManager:()=>_o,Vibration:()=>Jo,View:()=>c,VirtualizedList:()=>sr,YellowBox:()=>lr,findNodeHandle:()=>Tr,unstable_createElement:()=>ko,useColorScheme:()=>dr,useLocaleContext:()=>pr,useWindowDimensions:()=>mr});To(Dt,Io);import*as Io from"react-native-web";import{unstable_createElement as ko,NativeModules as Bo,AccessibilityInfo as Do,Animated as Eo,Appearance as Po,AppRegistry as Lo,AppState as $o,BackHandler as Fo,Clipboard as zo,Dimensions as Ao,Easing as No,I18nManager as Wo,Keyboard as jo,InteractionManager as Vo,LayoutAnimation as Oo,Linking as Ho,NativeEventEmitter as Mo,PanResponder as Uo,PixelRatio as Go,Platform as Et,Share as Ko,StyleSheet as ve,UIManager as _o,Vibration as Jo,CheckBox as Qo,FlatList as Pt,Image as qo,ImageBackground as Zo,KeyboardAvoidingView as Xo,Picker as Yo,ProgressBar as er,RefreshControl as tr,SafeAreaView as or,SectionList as rr,StatusBar as ar,Touchable as nr,TouchableNativeFeedback as ir,VirtualizedList as sr,YellowBox as lr,LogBox as cr,DeviceEventEmitter as ur,useColorScheme as dr,useLocaleContext as pr,useWindowDimensions as mr}from"react-native-web";import*as Y from"react-native-web";import{createElement as hr,forwardRef as gr}from"react";function te(e){let t=gr((r,a)=>{let{accessibilityState:i,accessibilityValue:n,...u}=r;for(let s of["busy","checked","disabled","expanded","selected"])i?.[s]!==void 0&&u[`aria-${s}`]===void 0&&(u[`aria-${s}`]=i[s]);for(let[s,m]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))n?.[s]!==void 0&&u[`aria-${m}`]===void 0&&(u[`aria-${m}`]=n[s]);return hr(e,{...u,ref:a})}),o=e.State;return o&&Object.assign(t,{State:o}),t.displayName=e.displayName??e.name??"NativeWebView",t}var c=te(Y.View),p=te(Y.Text),Lt=te(Y.TextInput),W=te(Y.TouchableOpacity),yr=te(Y.TouchableHighlight),fr=te(Y.TouchableWithoutFeedback),br=te(Y.Pressable),Ue=te(Y.ScrollView),vr=te(Y.Modal),xr=te(Y.Switch),Sr=te(Y.ActivityIndicator),Cr=te(Y.Button),Tr=Y.findNodeHandle,_={alert(e,t,o,r){if(typeof document>"u")return;let a=document.createElement("dialog");a.dataset.buoyRoot="",a.setAttribute("aria-label",e),a.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let i=document.createElement("h2");if(i.textContent=e,i.style.cssText="font-size:18px;margin:0 0 12px",a.appendChild(i),t){let m=document.createElement("p");m.textContent=t,m.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",a.appendChild(m)}let n=document.createElement("div");n.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let u=o?.length?o:[{text:"OK"}],s=()=>{a.close?.(),a.remove()};for(let m of u){let I=document.createElement("button");I.type="button",I.textContent=m.text??"OK",I.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${m.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,I.onclick=()=>{s(),m.onPress?.()},n.appendChild(I)}a.addEventListener("cancel",m=>{m.preventDefault(),r?.cancelable!==false&&(s(),r?.onDismiss?.())}),a.appendChild(n),document.body.appendChild(a),a.showModal?a.showModal():a.setAttribute("open","")}};import{browserRouter as Dn}from"@buoy-gg/shared-ui/web/utils";function Rr(){return null}import{useSafeRouter as wr,isExpoRouterAvailable as Ir,windowDragProps as kr,ToolEmptyState as Br,resolveListEmptyState as Dr,usePersistedState as at,monoFont as Ge}from"@buoy-gg/shared-ui/web";import{JsModal as Er,ModalHeader as ie,TabSelector as Pr,formatRelativeTime as Lr,devToolsStorageKeys as $e,Trash2 as $r,Filter as Fr,SearchBar as $t,ToolbarCopyButton as nt,Lock as zr,ProUpgradeModal as Ar,PowerToggleButton as Nr,buoyColors as Wr,night as M,TickProvider as Ft,useLimit as jr}from"@buoy-gg/shared-ui/web";import{useIsPro as Vr}from"@buoy-gg/license/web";import{useEventStoreEvents as Or}from"@buoy-gg/shared-ui/web";import{BaseEventStore as Hr,devToolsStorageKeys as Mr,persistentStorage as Ur}from"@buoy-gg/shared-ui/web";var zt=class{constructor(){this.listeners=new Set}emit(e){this.listeners.forEach(t=>{try{t(e)}catch(o){console.error("[RouteObserver] Error in listener:",o)}})}addListener(e){return this.listeners.add(e),()=>this.listeners.delete(e)}removeListener(e){this.listeners.delete(e)}},Fe=new zt;var Gr=class extends Hr{constructor(){super({storeName:"route-events",maxEvents:500});this.routeObserverUnsubscribe=null;this.bootCaptureRelease=null;this.bootCaptureHydrated=false}setBootCapture(e){e&&!this.bootCaptureRelease?this.bootCaptureRelease=this.subscribeToEvents(()=>{}):!e&&this.bootCaptureRelease&&(this.bootCaptureRelease(),this.bootCaptureRelease=null)}hydrateBootCapture(){this.bootCaptureHydrated||(this.bootCaptureHydrated=true,Ur.getItem(Mr.routeEvents.isMonitoring()).then(e=>{this.bootCaptureRelease||this.setBootCapture(e!=="false")}).catch(()=>this.setBootCapture(true)))}startCapturing(){this.routeObserverUnsubscribe||(this.routeObserverUnsubscribe=Fe.addListener(e=>{this.addEvent(e)}))}stopCapturing(){this.routeObserverUnsubscribe&&(this.routeObserverUnsubscribe(),this.routeObserverUnsubscribe=null)}isCapturing(){return this.routeObserverUnsubscribe!==null}isListening(){return this.isCapturing()}},he=new Gr;function At(e={}){let{maxEvents:t=500,enabled:o=true}=e,{events:r,clearEvents:a,isActive:i}=Or(he,{maxEvents:t,enabled:o});return{events:r,clearEvents:a,isListening:i}}import{Navigation as Kr,night as Ke,monoFont as _r}from"@buoy-gg/shared-ui/web";import{InlineCopyButton as ze,night as it,monoFont as st}from"@buoy-gg/shared-ui/web";import{DataViewer as Jr}from"@buoy-gg/shared-ui/web/dataViewer";import{jsx as F,jsxs as J}from"react/jsx-runtime";function Qr(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/6e4),o=(e%6e4/1e3).toFixed(0);return`${t}m ${o}s`}function lt({event:e,visitNumber:t,routeTemplate:o}){let r=e.params&&Object.keys(e.params).length>0;return J(c,{style:x.container,children:[J(c,{style:x.section,children:[o&&J(c,{style:x.detailRow,testID:"buoy-routes-detail-template",children:[F(p,{style:x.detailLabel,children:"Template:"}),F(p,{style:x.detailValue,testID:"buoy-routes-detail-template-value",children:o}),F(ze,{value:o,buttonStyle:x.copyButton})]}),e.previousPathname&&J(c,{style:x.detailRow,testID:"buoy-routes-detail-from",children:[F(p,{style:x.detailLabel,children:"From:"}),F(p,{style:x.detailValue,testID:"buoy-routes-detail-from-value",children:e.previousPathname}),F(ze,{value:e.previousPathname,buttonStyle:x.copyButton})]}),J(c,{style:x.detailRow,testID:"buoy-routes-detail-to",children:[F(p,{style:x.detailLabel,children:"To:"}),F(p,{style:x.detailValue,testID:"buoy-routes-detail-to-value",children:e.pathname}),F(ze,{value:e.pathname,buttonStyle:x.copyButton})]})]}),J(c,{style:x.section,children:[e.timeSincePrevious!==void 0&&J(c,{style:x.detailRow,testID:"buoy-routes-detail-duration",children:[F(p,{style:x.detailLabel,children:"Duration:"}),F(p,{style:x.detailValue,testID:"buoy-routes-detail-duration-value",children:Qr(e.timeSincePrevious)})]}),J(c,{style:x.detailRow,testID:"buoy-routes-detail-time",children:[F(p,{style:x.detailLabel,children:"Time:"}),F(p,{style:x.detailValue,testID:"buoy-routes-detail-time-value",children:new Date(e.timestamp).toLocaleString()})]})]}),J(c,{style:x.section,children:[e.segments&&e.segments.length>0&&J(c,{style:x.detailRow,testID:"buoy-routes-detail-segments",children:[F(p,{style:x.detailLabel,children:"Segments:"}),F(p,{style:x.detailValue,testID:"buoy-routes-detail-segments-value",children:e.segments.join(" \u2192 ")}),F(ze,{value:JSON.stringify(e.segments),buttonStyle:x.copyButton})]}),r&&J(c,{style:x.dataViewerContainer,children:[J(c,{style:x.dataViewerHeader,children:[J(p,{style:x.dataViewerTitle,testID:"buoy-routes-detail-params-title",children:["Parameters (",Object.keys(e.params).length,")"]}),F(ze,{value:JSON.stringify(e.params,null,2),buttonStyle:x.copyButton})]}),F(Jr,{data:e.params,title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})]}),t>1&&J(c,{style:x.detailRow,testID:"buoy-routes-detail-visited",children:[F(p,{style:x.detailLabel,children:"Visited:"}),J(p,{style:x.detailValue,testID:"buoy-routes-detail-visited-value",children:[t," time",t!==1?"s":""]})]})]})]})}var x=ve.create({container:{gap:12},section:{gap:8},detailRow:{flexDirection:"row",alignItems:"center",gap:8},detailLabel:{fontSize:10,color:it.color.textSecondary,fontFamily:st,fontWeight:"600",minWidth:70},detailValue:{fontSize:11,color:it.color.text,fontFamily:st,flex:1},copyButton:{padding:4,borderRadius:4},dataViewerContainer:{marginTop:4},dataViewerHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},dataViewerTitle:{fontSize:11,color:it.color.textSecondary,fontFamily:st,fontWeight:"600"}});function ct(e,t){if(!t||t.length===0)return null;let o="/"+t.map(r=>/^\d+$/.test(r)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(r)?"[id]":r).join("/");return o!==e?o:null}function Nt(e,t){if(!t)return e;let o=new Set(e.split("/").filter(Boolean).map(a=>{try{return decodeURIComponent(a)}catch{return a}})),r=[];for(let[a,i]of Object.entries(t)){let n=Array.isArray(i)?i:[i];if(!(n.length>0&&n.every(u=>o.has(String(u)))))for(let u of n)r.push(`${encodeURIComponent(a)}=${encodeURIComponent(String(u))}`)}return r.length?`${e}?${r.join("&")}`:e}function qr(e){let t=e.indexOf("?");if(t<0)return{pathname:e,params:{}};let o={};for(let r of e.slice(t+1).split("&")){if(!r)continue;let[a,i=""]=r.split("=");try{o[decodeURIComponent(a)]=decodeURIComponent(i)}catch{o[a]=i}}return{pathname:e.slice(0,t),params:o}}import{jsx as Ae,jsxs as Wt}from"react/jsx-runtime";function jt({event:e,visitNumber:t=1,onNavigate:o}){let r=ct(e.pathname,e.segments);return Wt(c,{style:ke.container,children:[Ae(Ue,{testID:"buoy-routes-detail-scroll",style:ke.scroll,contentContainerStyle:ke.scrollContent,showsVerticalScrollIndicator:true,children:Ae(lt,{event:e,visitNumber:t,routeTemplate:r})}),o&&Ae(c,{style:ke.footer,children:Wt(W,{style:ke.goButton,onPress:()=>o(Nt(e.pathname,e.params)),activeOpacity:.8,testID:"buoy-routes-detail-go",accessibilityRole:"button",accessibilityLabel:`Go to route ${e.pathname}`,children:[Ae(Kr,{size:16,color:Ke.color.onAccent}),Ae(p,{style:ke.goButtonText,children:"Go to route"})]})})]})}var ke=ve.create({container:{flex:1,backgroundColor:"transparent"},scroll:{flex:1},scrollContent:{padding:14},footer:{paddingHorizontal:16,paddingVertical:12,backgroundColor:"transparent",borderTopWidth:1,borderTopColor:Ke.color.border},goButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,backgroundColor:Ke.color.accent,paddingVertical:12,borderRadius:8},goButtonText:{fontSize:13,fontWeight:"600",color:Ke.color.onAccent,fontFamily:_r,textTransform:"uppercase",letterSpacing:.5}});import{Filter as Vt,DynamicFilterView as Zr}from"@buoy-gg/shared-ui/web";import{jsx as Xr}from"react/jsx-runtime";function Yr({ignoredPatterns:e,onTogglePattern:t,onAddPattern:o,availablePathnames:r=[]}){return Xr(Zr,{...{addFilterSection:{enabled:true,placeholder:"Enter pattern (e.g., /_sitemap)",title:"ACTIVE FILTERS",icon:Vt},availableItemsSection:{enabled:true,title:"AVAILABLE ROUTES FROM EVENTS",emptyMessage:"No routes available. Routes from navigation events will appear here.",items:r},howItWorksSection:{enabled:true,title:"HOW FILTERS WORK",description:"Filtered routes will not appear in the route events list. Patterns match if the route contains the specified text.",examples:["\u2022 /_sitemap \u2192 filters /_sitemap routes","\u2022 /api \u2192 filters /api/users, /api/posts","\u2022 [id] \u2192 filters all routes with [id] param"],icon:Vt},onPatternToggle:t,onPatternAdd:o,activePatterns:e}})}import{useState as Be,useCallback as Ne,useMemo as _e,useEffect as ea}from"react";import{night as y,ToolEmptyState as ta,monoFont as U}from"@buoy-gg/shared-ui/web";import{useSafeRouter as oa}from"@buoy-gg/shared-ui/web";import{Search as Ot,ChevronDown as Ht,ChevronRight as Mt,Home as ra,InlineCopyButton as aa,CopyButton as na,RefreshCw as ia,formatRelativeTime as sa,ProUpgradeModal as la}from"@buoy-gg/shared-ui/web";import{useIsPro as ca}from"@buoy-gg/license/web";import{useState as ua,useEffect as Ut,useMemo as Se,useCallback as da}from"react";var ge=class{static parseRouteTree(e){if(!e)return[];let t=[];return this.traverseNode(e,"",t,0),t}static traverseNode(e,t,o,r){let a=this.buildPath(e,t),i=this.detectRouteType(e),n=this.shouldIncludeRoute(e),u={path:a,name:e.route,type:i,params:this.extractParams(e),nodeType:e.type,contextKey:e.contextKey,isInternal:e.internal??false,children:[],depth:r};n&&o.push(u);for(let s of e.children)this.traverseNode(s,a,n?u.children:o,r+1)}static buildPath(e,t){if(e.type==="layout"&&e.route==="_layout"||e.route.startsWith("(")&&e.route.endsWith(")"))return t;if(e.route==="index")return t||"/";let o=e.route;return!t||t==="/"?`/${o}`:`${t}/${o}`}static detectRouteType(e){let t=e.route;return e.dynamic?.some(o=>o.notFound)?"not-found":e.dynamic?.some(o=>o.deep)?"catch-all":e.dynamic&&e.dynamic.length>0?"dynamic":e.type==="layout"?"layout":t.startsWith("(")&&t.endsWith(")")?"group":t==="index"?"index":"static"}static extractParams(e){return!e.dynamic||e.dynamic.length===0?[]:e.dynamic.map(t=>t.name)}static shouldIncludeRoute(e){return!(e.internal||e.generated||e.type==="api")}static organizeRoutes(e){let t=[],o=this.flattenRoutes(e).filter(n=>n.type==="static"||n.type==="index"),r=this.flattenRoutes(e).filter(n=>n.type==="dynamic"||n.type==="catch-all"),a=this.flattenRoutes(e).filter(n=>n.type==="layout"),i=this.flattenRoutes(e).filter(n=>n.type==="group");return o.length>0&&t.push({title:"Static Routes",icon:"",routes:o}),r.length>0&&t.push({title:"Dynamic Routes",icon:"",description:"Routes that accept parameters",routes:r}),a.length>0&&t.push({title:"Layouts",icon:"",description:"Shared UI for nested screens",routes:a}),i.length>0&&t.push({title:"Route Groups",icon:"",routes:i}),t}static flattenRoutes(e){let t=[];function o(r){t.push(r),r.children.forEach(o)}return e.forEach(o),t}static getRouteStats(e){let t=this.flattenRoutes(e);return{total:t.length,static:t.filter(o=>o.type==="static").length,dynamic:t.filter(o=>o.type==="dynamic").length,catchAll:t.filter(o=>o.type==="catch-all").length,layouts:t.filter(o=>o.type==="layout").length,groups:t.filter(o=>o.type==="group").length}}static filterRoutes(e,t){if(!t)return e;let o=t.toLowerCase();return this.flattenRoutes(e).filter(r=>r.path.toLowerCase().includes(o)||r.name.toLowerCase().includes(o)||r.type.toLowerCase().includes(o)||r.params.some(a=>a.toLowerCase().includes(o)))}static buildTreeString(e,t=0){let o="";return e.forEach((r,a)=>{let i=a===e.length-1,n=`${this.buildTreePrefix(t,i)}${r.path}`;r.params.length>0&&(n+=` { ${r.params.join(", ")} }`),o+=n+`
|
|
2
|
-
`,r.children.length>0&&(o+=this.buildTreeString(r.children,t+1))}),o}static buildTreePrefix(e,t){return e===0?"":" ".repeat(e-1)+(t?"\u2514\u2500 ":"\u251C\u2500 ")}static sortRoutes(e,t="path"){let o=[...e];return o.sort((r,a)=>{switch(t){case"path":return r.path.localeCompare(a.path);case"type":return r.type.localeCompare(a.type);case"name":return r.name.localeCompare(a.name);default:return 0}}),o}static findRouteByPath(e,t){return this.flattenRoutes(e).find(o=>o.path===t)||null}static getParentRoutes(e,t){let o=[],r=this.flattenRoutes(e);if(!r.find(n=>n.path===t))return o;let a=t.split("/").filter(Boolean),i="";for(let n=0;n<a.length-1;n++){i+="/"+a[n];let u=r.find(
|
|
1
|
+
"use client";var Bt=Object.defineProperty;var So=Object.getOwnPropertyDescriptor;var To=Object.getOwnPropertyNames;var Co=Object.prototype.hasOwnProperty;var wo=(e,t)=>{for(var o in t)Bt(e,o,{get:t[o],enumerable:true})},Dt=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of To(t))!Co.call(e,a)&&a!==o&&Bt(e,a,{get:()=>t[a],enumerable:!(r=So(t,a))||r.enumerable});return e},Io=(e,t,o)=>(Dt(e,t,"default"),o&&Dt(o,t,"default"));var Bn=(()=>{try{let e=globalThis.Capacitor;if(e&&typeof e.isNativePlatform=="function"&&e.isNativePlatform())return e.DEBUG===true}catch{}return process.env.NODE_ENV!=="production"})();typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{RoutesIcon as Ro}from"@buoy-gg/floating-tools-core/web";import{useState as Ie,useCallback as ue,useEffect as Et,useRef as ko,useMemo as Re}from"react";var Pt={};wo(Pt,{AccessibilityInfo:()=>Po,ActivityIndicator:()=>Cr,Alert:()=>J,Animated:()=>Lo,AppRegistry:()=>Fo,AppState:()=>zo,Appearance:()=>$o,BackHandler:()=>No,Button:()=>wr,CheckBox:()=>Xo,Clipboard:()=>Ao,DeviceEventEmitter:()=>pr,Dimensions:()=>Wo,Easing:()=>jo,FlatList:()=>Lt,I18nManager:()=>Vo,Image:()=>Yo,ImageBackground:()=>Zo,InteractionManager:()=>Ho,Keyboard:()=>Oo,KeyboardAvoidingView:()=>er,LayoutAnimation:()=>Mo,Linking:()=>Uo,LogBox:()=>dr,Modal:()=>Sr,NativeEventEmitter:()=>Go,NativeModules:()=>Eo,PanResponder:()=>_o,Picker:()=>tr,PixelRatio:()=>Ko,Platform:()=>at,Pressable:()=>xr,ProgressBar:()=>or,RefreshControl:()=>rr,SafeAreaView:()=>ar,ScrollView:()=>Ue,SectionList:()=>nr,Share:()=>Qo,StatusBar:()=>ir,StyleSheet:()=>ve,Switch:()=>Tr,Text:()=>h,TextInput:()=>$t,Touchable:()=>sr,TouchableHighlight:()=>br,TouchableNativeFeedback:()=>lr,TouchableOpacity:()=>V,TouchableWithoutFeedback:()=>vr,UIManager:()=>Jo,Vibration:()=>qo,View:()=>c,VirtualizedList:()=>cr,YellowBox:()=>ur,findNodeHandle:()=>Ir,unstable_createElement:()=>Do,useColorScheme:()=>mr,useLocaleContext:()=>hr,useWindowDimensions:()=>gr});Io(Pt,Bo);import*as Bo from"react-native-web";import{unstable_createElement as Do,NativeModules as Eo,AccessibilityInfo as Po,Animated as Lo,Appearance as $o,AppRegistry as Fo,AppState as zo,BackHandler as No,Clipboard as Ao,Dimensions as Wo,Easing as jo,I18nManager as Vo,Keyboard as Oo,InteractionManager as Ho,LayoutAnimation as Mo,Linking as Uo,NativeEventEmitter as Go,PanResponder as _o,PixelRatio as Ko,Platform as at,Share as Qo,StyleSheet as ve,UIManager as Jo,Vibration as qo,CheckBox as Xo,FlatList as Lt,Image as Yo,ImageBackground as Zo,KeyboardAvoidingView as er,Picker as tr,ProgressBar as or,RefreshControl as rr,SafeAreaView as ar,SectionList as nr,StatusBar as ir,Touchable as sr,TouchableNativeFeedback as lr,VirtualizedList as cr,YellowBox as ur,LogBox as dr,DeviceEventEmitter as pr,useColorScheme as mr,useLocaleContext as hr,useWindowDimensions as gr}from"react-native-web";import*as ee from"react-native-web";import{createElement as fr,forwardRef as yr}from"react";function oe(e){let t=yr((r,a)=>{let{accessibilityState:i,accessibilityValue:n,...u}=r;for(let l of["busy","checked","disabled","expanded","selected"])i?.[l]!==void 0&&u[`aria-${l}`]===void 0&&(u[`aria-${l}`]=i[l]);for(let[l,g]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))n?.[l]!==void 0&&u[`aria-${g}`]===void 0&&(u[`aria-${g}`]=n[l]);return fr(e,{...u,ref:a})}),o=e.State;return o&&Object.assign(t,{State:o}),t.displayName=e.displayName??e.name??"NativeWebView",t}var c=oe(ee.View),h=oe(ee.Text),$t=oe(ee.TextInput),V=oe(ee.TouchableOpacity),br=oe(ee.TouchableHighlight),vr=oe(ee.TouchableWithoutFeedback),xr=oe(ee.Pressable),Ue=oe(ee.ScrollView),Sr=oe(ee.Modal),Tr=oe(ee.Switch),Cr=oe(ee.ActivityIndicator),wr=oe(ee.Button),Ir=ee.findNodeHandle,J={alert(e,t,o,r){if(typeof document>"u")return;let a=document.createElement("dialog");a.dataset.buoyRoot="",a.setAttribute("aria-label",e),a.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let i=document.createElement("h2");if(i.textContent=e,i.style.cssText="font-size:18px;margin:0 0 12px",a.appendChild(i),t){let g=document.createElement("p");g.textContent=t,g.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",a.appendChild(g)}let n=document.createElement("div");n.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let u=o?.length?o:[{text:"OK"}],l=()=>{a.close?.(),a.remove()};for(let g of u){let d=document.createElement("button");d.type="button",d.textContent=g.text??"OK",d.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${g.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,d.onclick=()=>{l(),g.onPress?.()},n.appendChild(d)}a.addEventListener("cancel",g=>{g.preventDefault(),r?.cancelable!==false&&(l(),r?.onDismiss?.())}),a.appendChild(n),document.body.appendChild(a),a.showModal?a.showModal():a.setAttribute("open","")}};import{browserRouter as Fn}from"@buoy-gg/shared-ui/web/utils";function Rr(){return null}import{useSafeRouter as kr,isExpoRouterAvailable as Br,windowDragProps as Dr,ToolEmptyState as Er,resolveListEmptyState as Pr,usePersistedState as nt,monoFont as Ge}from"@buoy-gg/shared-ui/web";import{JsModal as Lr,ModalHeader as ie,TabSelector as $r,formatRelativeTime as Fr,devToolsStorageKeys as $e,Trash2 as zr,Filter as Nr,SearchBar as Ft,ToolbarCopyButton as it,Lock as Ar,ProUpgradeModal as Wr,PowerToggleButton as jr,buoyColors as Vr,night as G,TickProvider as zt,useLimit as Or}from"@buoy-gg/shared-ui/web";import{useIsPro as Hr}from"@buoy-gg/license/web";import{useEventStoreEvents as Mr}from"@buoy-gg/shared-ui/web";import{BaseEventStore as Ur,devToolsStorageKeys as Gr,persistentStorage as _r}from"@buoy-gg/shared-ui/web";var Nt=class{constructor(){this.listeners=new Set}emit(e){this.listeners.forEach(t=>{try{t(e)}catch(o){console.error("[RouteObserver] Error in listener:",o)}})}addListener(e){return this.listeners.add(e),()=>this.listeners.delete(e)}removeListener(e){this.listeners.delete(e)}},Fe=new Nt;var Kr=class extends Ur{constructor(){super({storeName:"route-events",maxEvents:500});this.routeObserverUnsubscribe=null;this.bootCaptureRelease=null;this.bootCaptureHydrated=false}setBootCapture(e){e&&!this.bootCaptureRelease?this.bootCaptureRelease=this.subscribeToEvents(()=>{}):!e&&this.bootCaptureRelease&&(this.bootCaptureRelease(),this.bootCaptureRelease=null)}hydrateBootCapture(){this.bootCaptureHydrated||(this.bootCaptureHydrated=true,_r.getItem(Gr.routeEvents.isMonitoring()).then(e=>{this.bootCaptureRelease||this.setBootCapture(e!=="false")}).catch(()=>this.setBootCapture(true)))}startCapturing(){this.routeObserverUnsubscribe||(this.routeObserverUnsubscribe=Fe.addListener(e=>{this.addEvent(e)}))}stopCapturing(){this.routeObserverUnsubscribe&&(this.routeObserverUnsubscribe(),this.routeObserverUnsubscribe=null)}isCapturing(){return this.routeObserverUnsubscribe!==null}isListening(){return this.isCapturing()}},he=new Kr;function At(e={}){let{maxEvents:t=500,enabled:o=true}=e,{events:r,clearEvents:a,isActive:i}=Mr(he,{maxEvents:t,enabled:o});return{events:r,clearEvents:a,isListening:i}}import{Navigation as Qr,night as _e,monoFont as Jr}from"@buoy-gg/shared-ui/web";import{InlineCopyButton as ze,night as st,monoFont as lt}from"@buoy-gg/shared-ui/web";import{DataViewer as qr}from"@buoy-gg/shared-ui/web/dataViewer";import{jsx as N,jsxs as q}from"react/jsx-runtime";function Xr(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/6e4),o=(e%6e4/1e3).toFixed(0);return`${t}m ${o}s`}function ct({event:e,visitNumber:t,routeTemplate:o}){let r=e.params&&Object.keys(e.params).length>0;return q(c,{style:T.container,children:[q(c,{style:T.section,children:[o&&q(c,{style:T.detailRow,testID:"buoy-routes-detail-template",children:[N(h,{style:T.detailLabel,children:"Template:"}),N(h,{style:T.detailValue,testID:"buoy-routes-detail-template-value",children:o}),N(ze,{value:o,buttonStyle:T.copyButton})]}),e.previousPathname&&q(c,{style:T.detailRow,testID:"buoy-routes-detail-from",children:[N(h,{style:T.detailLabel,children:"From:"}),N(h,{style:T.detailValue,testID:"buoy-routes-detail-from-value",children:e.previousPathname}),N(ze,{value:e.previousPathname,buttonStyle:T.copyButton})]}),q(c,{style:T.detailRow,testID:"buoy-routes-detail-to",children:[N(h,{style:T.detailLabel,children:"To:"}),N(h,{style:T.detailValue,testID:"buoy-routes-detail-to-value",children:e.pathname}),N(ze,{value:e.pathname,buttonStyle:T.copyButton})]})]}),q(c,{style:T.section,children:[e.timeSincePrevious!==void 0&&q(c,{style:T.detailRow,testID:"buoy-routes-detail-duration",children:[N(h,{style:T.detailLabel,children:"Duration:"}),N(h,{style:T.detailValue,testID:"buoy-routes-detail-duration-value",children:Xr(e.timeSincePrevious)})]}),q(c,{style:T.detailRow,testID:"buoy-routes-detail-time",children:[N(h,{style:T.detailLabel,children:"Time:"}),N(h,{style:T.detailValue,testID:"buoy-routes-detail-time-value",children:new Date(e.timestamp).toLocaleString()})]})]}),q(c,{style:T.section,children:[e.segments&&e.segments.length>0&&q(c,{style:T.detailRow,testID:"buoy-routes-detail-segments",children:[N(h,{style:T.detailLabel,children:"Segments:"}),N(h,{style:T.detailValue,testID:"buoy-routes-detail-segments-value",children:e.segments.join(" \u2192 ")}),N(ze,{value:JSON.stringify(e.segments),buttonStyle:T.copyButton})]}),r&&q(c,{style:T.dataViewerContainer,children:[q(c,{style:T.dataViewerHeader,children:[q(h,{style:T.dataViewerTitle,testID:"buoy-routes-detail-params-title",children:["Parameters (",Object.keys(e.params).length,")"]}),N(ze,{value:JSON.stringify(e.params,null,2),buttonStyle:T.copyButton})]}),N(qr,{data:e.params,title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})]}),t>1&&q(c,{style:T.detailRow,testID:"buoy-routes-detail-visited",children:[N(h,{style:T.detailLabel,children:"Visited:"}),q(h,{style:T.detailValue,testID:"buoy-routes-detail-visited-value",children:[t," time",t!==1?"s":""]})]})]})]})}var T=ve.create({container:{gap:12},section:{gap:8},detailRow:{flexDirection:"row",alignItems:"center",gap:8},detailLabel:{fontSize:10,color:st.color.textSecondary,fontFamily:lt,fontWeight:"600",minWidth:70},detailValue:{fontSize:11,color:st.color.text,fontFamily:lt,flex:1},copyButton:{padding:4,borderRadius:4},dataViewerContainer:{marginTop:4},dataViewerHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},dataViewerTitle:{fontSize:11,color:st.color.textSecondary,fontFamily:lt,fontWeight:"600"}});function ut(e,t){if(!t||t.length===0)return null;let o="/"+t.map(r=>/^\d+$/.test(r)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(r)?"[id]":r).join("/");return o!==e?o:null}function Wt(e,t){if(!t)return e;let o=new Set(e.split("/").filter(Boolean).map(a=>{try{return decodeURIComponent(a)}catch{return a}})),r=[];for(let[a,i]of Object.entries(t)){let n=Array.isArray(i)?i:[i];if(!(n.length>0&&n.every(u=>o.has(String(u)))))for(let u of n)r.push(`${encodeURIComponent(a)}=${encodeURIComponent(String(u))}`)}return r.length?`${e}?${r.join("&")}`:e}function Yr(e){let t=e.indexOf("?");if(t<0)return{pathname:e,params:{}};let o={};for(let r of e.slice(t+1).split("&")){if(!r)continue;let[a,i=""]=r.split("=");try{o[decodeURIComponent(a)]=decodeURIComponent(i)}catch{o[a]=i}}return{pathname:e.slice(0,t),params:o}}import{jsx as Ne,jsxs as jt}from"react/jsx-runtime";function Vt({event:e,visitNumber:t=1,onNavigate:o}){let r=ut(e.pathname,e.segments);return jt(c,{style:ke.container,children:[Ne(Ue,{testID:"buoy-routes-detail-scroll",style:ke.scroll,contentContainerStyle:ke.scrollContent,showsVerticalScrollIndicator:true,children:Ne(ct,{event:e,visitNumber:t,routeTemplate:r})}),o&&Ne(c,{style:ke.footer,children:jt(V,{style:ke.goButton,onPress:()=>o(Wt(e.pathname,e.params)),activeOpacity:.8,testID:"buoy-routes-detail-go",accessibilityRole:"button",accessibilityLabel:`Go to route ${e.pathname}`,children:[Ne(Qr,{size:16,color:_e.color.onAccent}),Ne(h,{style:ke.goButtonText,children:"Go to route"})]})})]})}var ke=ve.create({container:{flex:1,backgroundColor:"transparent"},scroll:{flex:1},scrollContent:{padding:14},footer:{paddingHorizontal:16,paddingVertical:12,backgroundColor:"transparent",borderTopWidth:1,borderTopColor:_e.color.border},goButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,backgroundColor:_e.color.accent,paddingVertical:12,borderRadius:8},goButtonText:{fontSize:13,fontWeight:"600",color:_e.color.onAccent,fontFamily:Jr,textTransform:"uppercase",letterSpacing:.5}});import{Filter as Ot,DynamicFilterView as Zr}from"@buoy-gg/shared-ui/web";import{jsx as ea}from"react/jsx-runtime";function ta({ignoredPatterns:e,onTogglePattern:t,onAddPattern:o,availablePathnames:r=[]}){return ea(Zr,{...{addFilterSection:{enabled:true,placeholder:"Enter pattern (e.g., /_sitemap)",title:"ACTIVE FILTERS",icon:Ot},availableItemsSection:{enabled:true,title:"AVAILABLE ROUTES FROM EVENTS",emptyMessage:"No routes available. Routes from navigation events will appear here.",items:r},howItWorksSection:{enabled:true,title:"HOW FILTERS WORK",description:"Filtered routes will not appear in the route events list. Patterns match if the route contains the specified text.",examples:["\u2022 /_sitemap \u2192 filters /_sitemap routes","\u2022 /api \u2192 filters /api/users, /api/posts","\u2022 [id] \u2192 filters all routes with [id] param"],icon:Ot},onPatternToggle:t,onPatternAdd:o,activePatterns:e}})}import{useState as Be,useCallback as Ae,useMemo as Ke,useEffect as oa}from"react";import{night as b,ToolEmptyState as ra,monoFont as _}from"@buoy-gg/shared-ui/web";import{isCapacitorNative as aa}from"@buoy-gg/license/web";import{useSafeRouter as na}from"@buoy-gg/shared-ui/web";import{Search as Ht,ChevronDown as Mt,ChevronRight as Ut,Home as ia,InlineCopyButton as sa,CopyButton as la,RefreshCw as ca,formatRelativeTime as ua,ProUpgradeModal as da}from"@buoy-gg/shared-ui/web";import{useIsPro as pa}from"@buoy-gg/license/web";import{useState as ma,useEffect as Gt,useMemo as Se,useCallback as ha}from"react";var ge=class{static parseRouteTree(e){if(!e)return[];let t=[];return this.traverseNode(e,"",t,0),t}static traverseNode(e,t,o,r){let a=this.buildPath(e,t),i=this.detectRouteType(e),n=this.shouldIncludeRoute(e),u={path:a,name:e.route,type:i,params:this.extractParams(e),nodeType:e.type,contextKey:e.contextKey,isInternal:e.internal??false,children:[],depth:r};n&&o.push(u);for(let l of e.children)this.traverseNode(l,a,n?u.children:o,r+1)}static buildPath(e,t){if(e.type==="layout"&&e.route==="_layout"||e.route.startsWith("(")&&e.route.endsWith(")"))return t;if(e.route==="index")return t||"/";let o=e.route;return!t||t==="/"?`/${o}`:`${t}/${o}`}static detectRouteType(e){let t=e.route;return e.dynamic?.some(o=>o.notFound)?"not-found":e.dynamic?.some(o=>o.deep)?"catch-all":e.dynamic&&e.dynamic.length>0?"dynamic":e.type==="layout"?"layout":t.startsWith("(")&&t.endsWith(")")?"group":t==="index"?"index":"static"}static extractParams(e){return!e.dynamic||e.dynamic.length===0?[]:e.dynamic.map(t=>t.name)}static shouldIncludeRoute(e){return!(e.internal||e.generated||e.type==="api")}static organizeRoutes(e){let t=[],o=this.flattenRoutes(e).filter(n=>n.type==="static"||n.type==="index"),r=this.flattenRoutes(e).filter(n=>n.type==="dynamic"||n.type==="catch-all"),a=this.flattenRoutes(e).filter(n=>n.type==="layout"),i=this.flattenRoutes(e).filter(n=>n.type==="group");return o.length>0&&t.push({title:"Static Routes",icon:"",routes:o}),r.length>0&&t.push({title:"Dynamic Routes",icon:"",description:"Routes that accept parameters",routes:r}),a.length>0&&t.push({title:"Layouts",icon:"",description:"Shared UI for nested screens",routes:a}),i.length>0&&t.push({title:"Route Groups",icon:"",routes:i}),t}static flattenRoutes(e){let t=[];function o(r){t.push(r),r.children.forEach(o)}return e.forEach(o),t}static getRouteStats(e){let t=this.flattenRoutes(e);return{total:t.length,static:t.filter(o=>o.type==="static").length,dynamic:t.filter(o=>o.type==="dynamic").length,catchAll:t.filter(o=>o.type==="catch-all").length,layouts:t.filter(o=>o.type==="layout").length,groups:t.filter(o=>o.type==="group").length}}static filterRoutes(e,t){if(!t)return e;let o=t.toLowerCase();return this.flattenRoutes(e).filter(r=>r.path.toLowerCase().includes(o)||r.name.toLowerCase().includes(o)||r.type.toLowerCase().includes(o)||r.params.some(a=>a.toLowerCase().includes(o)))}static buildTreeString(e,t=0){let o="";return e.forEach((r,a)=>{let i=a===e.length-1,n=`${this.buildTreePrefix(t,i)}${r.path}`;r.params.length>0&&(n+=` { ${r.params.join(", ")} }`),o+=n+`
|
|
2
|
+
`,r.children.length>0&&(o+=this.buildTreeString(r.children,t+1))}),o}static buildTreePrefix(e,t){return e===0?"":" ".repeat(e-1)+(t?"\u2514\u2500 ":"\u251C\u2500 ")}static sortRoutes(e,t="path"){let o=[...e];return o.sort((r,a)=>{switch(t){case"path":return r.path.localeCompare(a.path);case"type":return r.type.localeCompare(a.type);case"name":return r.name.localeCompare(a.name);default:return 0}}),o}static findRouteByPath(e,t){return this.flattenRoutes(e).find(o=>o.path===t)||null}static getParentRoutes(e,t){let o=[],r=this.flattenRoutes(e);if(!r.find(n=>n.path===t))return o;let a=t.split("/").filter(Boolean),i="";for(let n=0;n<a.length-1;n++){i+="/"+a[n];let u=r.find(l=>l.path===i);u&&o.push(u)}return o}};import{getBrowserHref as ga}from"@buoy-gg/shared-ui/web/utils";var De=new Map,dt=null;function fa(e){for(let o of e)De.set(o,(De.get(o)??0)+1);dt=Date.now();let t=true;return()=>{if(t){t=false;for(let o of e){let r=(De.get(o)??1)-1;r?De.set(o,r):De.delete(o)}dt=Date.now()}}}function pt(){return[...De.keys()]}function ya(){return dt}function _t(e){let t={segments:e.split("/").filter(Boolean),params:{}},o=pt();if(o.includes(e))return t;for(let r of o){let a=r.split("/").filter(Boolean),i=[],n=a.map(d=>{let p=/^\[(\.\.\.)?([^\]]+)\]$/.exec(d);return p?(i.push({name:p[2],deep:!!p[1]}),p[1]?"(.+)":"([^/]+)"):d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}),u=new RegExp("^/"+n.join("/")+"/?$").exec(e);if(!u)continue;let l=d=>{try{return decodeURIComponent(d)}catch{return d}},g={};return i.forEach(({name:d,deep:p},S)=>{let L=u[S+1];g[d]=p?L.split("/").map(l):l(L)}),{segments:a,params:g}}return t}function mt(){return typeof window<"u"}function We(){return mt()?{route:"",type:"layout",contextKey:"browser",children:[...new Set([...pt(),new URL(ga()).pathname])].map(e=>({route:e.replace(/^\//,"")||"index",type:"route",contextKey:e,children:[],dynamic:e.split("/").flatMap(t=>{let o=/^\[(\.\.\.)?([^\]]+)\]$/.exec(t);return o?[{name:o[2],deep:!!o[1]}]:[]})}))}:null}function ht(){return{source:null,lastLoadedAt:ya()}}function ba(){return pt().length>0}function Qe(e={}){let{searchQuery:t="",sortBy:o="path",autoRefresh:r=false,refreshInterval:a=1e3,injectedRoutes:i,injectedSource:n=null,injectedLastUpdatedAt:u=null}=e,l=i!=null,[g,d]=ma(()=>{let k=We(),M=ht();return{node:k,version:0,lastUpdatedAt:M.lastLoadedAt,source:M.source}}),p=g.node,S=g.version,L=g.lastUpdatedAt,H=g.source,$=ha(()=>{d(k=>{let M=We(),Q=ht();return{node:M,version:k.version+1,lastUpdatedAt:Q.lastLoadedAt,source:Q.source}})},[]);Gt(()=>{if(p||l||!mt())return;let k=0,M=100,Q=()=>{k++,$(),k<M&&(A=setTimeout(Q,100))},A=setTimeout(Q,100);return()=>clearTimeout(A)},[p,$,l]),Gt(()=>{if(!r)return;let k=setInterval($,a);return()=>clearInterval(k)},[r,a,$]);let D=l?i.length>0:!!p,w=l?true:mt(),R=Se(()=>l?i:p?ge.parseRouteTree(p):[],[p,S,l,i]),te=Se(()=>ge.sortRoutes(R,o),[R,o]),E=Se(()=>t?ge.filterRoutes(te,t):te,[te,t]),K=Se(()=>ge.organizeRoutes(E),[E]),pe=Se(()=>ge.getRouteStats(R),[R]);return{routes:te,groups:K,stats:pe,filteredRoutes:E,isLoaded:D,isSupported:w,refresh:$,findRoute:k=>ge.findRouteByPath(R,k),getParents:k=>ge.getParentRoutes(R,k),lastUpdatedAt:l?u:L,source:l?n:H}}function va(e){let{findRoute:t}=Qe();return Se(()=>t(e),[t,e])}function xa(e){let{getParents:t}=Qe();return Se(()=>t(e),[t,e])}function gt(e){return String(e).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"root"}function Sa(e,t){return`buoy-routes-event-row-${gt(e)}-${t}`}function Ta(e){return`buoy-routes-route-${gt(e)}`}function Kt(e){return`buoy-routes-group-${gt(e)}`}function Ca(e){return`buoy-routes-stack-item-${e}`}import{jsx as m,jsxs as z}from"react/jsx-runtime";var Y=at.OS==="web"&&!aa(),Je=Y?22:16,wa={path:"/",name:"index",type:"index",params:[],nodeType:"route",contextKey:"/",isInternal:false,children:[],depth:0};function ft({style:e,injectedRoutes:t,injectedSource:o,injectedLastUpdatedAt:r,onNavigateRoute:a}){let[i,n]=Be(""),[u,l]=Be(false),[g,d]=Be(new Set(["Static Routes","Dynamic Routes"])),[p,S]=Be(false),[L,H]=Be(false),$=pa();oa(()=>{L&&$&&H(false)},[L,$]);let D=na(),{groups:w,stats:R,isLoaded:te,isSupported:E,filteredRoutes:K,routes:pe,refresh:k,lastUpdatedAt:M,source:Q}=Qe({searchQuery:i,sortBy:"path",injectedRoutes:t,injectedSource:o,injectedLastUpdatedAt:r}),A=Ke(()=>({summary:{total:R.total,static:R.static,dynamic:R.dynamic,layouts:R.layouts,groups:R.groups,timestamp:new Date().toISOString()},groups:w.map(x=>({title:x.title,description:x.description,count:x.routes.length,routes:x.routes.map(B=>({path:B.path,name:B.name,type:B.type,params:B.params,depth:B.depth,hasChildren:B.children.length>0,childrenCount:B.children.length}))})),allRoutes:pe.map(x=>x.path)}),[w,R,pe]),Te=Ae(x=>{d(B=>{let Z=new Set(B);return Z.has(x)?Z.delete(x):Z.add(x),Z})},[]),fe=Ae((x,B=0,Z={})=>{let Pe=x.params;if(B>=Pe.length){let ne=x.path;Object.entries(Z).forEach(([ye,He])=>{x.type==="catch-all"?ne=ne.replace(`[...${ye}]`,He):ne=ne.replace(`[${ye}]`,He)});try{D.push(ne)}catch(ye){J.alert("Navigation Error",String(ye))}return}let Le=Pe[B],et=x.type==="catch-all"?`[...${Le}]`:`[${Le}]`;J.prompt("Enter Parameter Value",`Enter value for ${et}:
|
|
3
3
|
|
|
4
|
-
Route: ${b.path}`,[{text:"Cancel",style:"cancel"},{text:w<Pe.length-1?"Next":"Navigate",onPress:ne=>{if(ne&&ne.trim()){let fe={...X,[Le]:ne.trim()};ye(b,w+1,fe)}else _.alert("Invalid Value","Please enter a value for the parameter")}}],"plain-text")},[N]),xe=Ne((b,w)=>{if(a){a(b);return}if(!V&&!w?.bypassPro){ae(true);return}if(b.type==="layout"||b.type==="group"){_.alert("Cannot Navigate",`${b.type==="layout"?"Layouts":"Route groups"} are not navigable routes`);return}if(b.type==="dynamic"||b.type==="catch-all"){if(b.params.length===0){try{N.push(b.path)}catch(X){_.alert("Navigation Error",String(X))}return}ye(b);return}try{N.push(b.path)}catch(X){_.alert("Navigation Error",String(X))}},[N,ye,V,a]),le=Ne(()=>{xe(Sa,{bypassPro:true})},[xe]),f=Ne(()=>{v||(T(true),R(),setTimeout(()=>T(false),400))},[v,R]),E=_e(()=>O?`Updated ${sa(O)}`:"Awaiting route data",[O]),H=_e(()=>K?`Source: ${K}`:"Source: unknown",[K]),ce=_e(()=>i&&G.length>0?[{title:"Search Results",icon:"",routes:G}]:P,[i,G,P]);return ee?L(c,{style:[l.container,e],children:[u&&L(c,{style:l.searchContainer,testID:"buoy-routes-sitemap-search-field",children:[d(Ot,{size:16,color:y.color.textTertiary}),d(Lt,{style:l.searchInput,placeholder:"Search routes...",placeholderTextColor:y.color.placeholder,value:i,onChangeText:n,autoCapitalize:"none",autoCorrect:false,autoFocus:true,testID:"buoy-routes-sitemap-search",accessibilityLabel:"Search routes"}),i.length>0&&d(W,{onPress:()=>n(""),style:l.clearButton,testID:"buoy-routes-sitemap-search-clear",accessibilityRole:"button",accessibilityLabel:"Clear route search",children:d(p,{style:l.clearButtonText,children:"\u2715"})}),d(W,{style:l.closeSearchButton,onPress:()=>{s(false),n("")},testID:"buoy-routes-sitemap-search-done",accessibilityRole:"button",accessibilityLabel:"Done searching routes",children:d(p,{style:l.closeSearchText,children:"Done"})})]}),L(Ue,{testID:"buoy-routes-sitemap-scroll",style:l.scrollView,contentContainerStyle:l.scrollContent,children:[!u&&L(c,{style:l.header,children:[L(c,{style:l.actionsRow,children:[L(c,{style:[l.actionWrapper,Z&&l.actionWrapperDesktop],children:[d(W,{style:[l.iconButton,Z&&l.iconButtonDesktop],onPress:le,accessibilityLabel:"Go to home route",accessibilityRole:"button",testID:"buoy-routes-sitemap-home",children:d(ra,{size:Qe,color:y.color.textSecondary})}),d(p,{style:[l.actionLabel,Z&&l.actionLabelDesktop],children:"Home"})]}),L(c,{style:[l.actionWrapper,Z&&l.actionWrapperDesktop],children:[d(na,{value:z,testID:"buoy-routes-sitemap-copy",size:Z?Qe:14,buttonStyle:Z?l.actionButtonHeaderDesktop:l.actionButtonHeader}),d(p,{style:[l.actionLabel,Z&&l.actionLabelDesktop],children:"Copy"})]}),L(c,{style:[l.actionWrapper,Z&&l.actionWrapperDesktop],children:[d(W,{style:[l.iconButton,Z&&l.iconButtonDesktop,v&&l.refreshButtonDisabled],onPress:f,disabled:v,testID:"buoy-routes-sitemap-refresh",accessibilityRole:"button",accessibilityLabel:"Refresh route tree",children:d(ia,{size:Qe,color:v?y.color.textTertiary:y.color.textSecondary})}),d(p,{style:[l.actionLabel,Z&&l.actionLabelDesktop],children:"Refresh"})]}),L(c,{style:[l.actionWrapper,Z&&l.actionWrapperDesktop],children:[d(W,{style:[l.iconButton,Z&&l.iconButtonDesktop],onPress:()=>s(true),testID:"buoy-routes-sitemap-search-open",accessibilityRole:"button",accessibilityLabel:"Search routes",children:d(Ot,{size:Qe,color:y.color.textSecondary})}),d(p,{style:[l.actionLabel,Z&&l.actionLabelDesktop],children:"Search"})]})]}),L(c,{style:l.statsGrid,children:[d(Ee,{value:D.total,label:"Total",id:"total"}),d(Ee,{value:D.static,label:"Static",id:"static"}),d(Ee,{value:D.dynamic,label:"Dynamic",id:"dynamic"}),d(Ee,{value:D.catchAll,label:"Catch-All",id:"catch-all"}),d(Ee,{value:D.layouts,label:"Layouts",id:"layouts"}),d(Ee,{value:D.groups,label:"Groups",id:"groups"})]})]}),ce.length===0?d(ta,{testID:"buoy-routes-sitemap-empty",otto:"map",title:"No routes found",message:"Nothing in the router matches. Clear the search to see the whole tree."}):ce.map(b=>d(Ca,{group:b,isExpanded:i.length>0||m.has(b.title),onToggleExpand:()=>Ce(b.title),onNavigate:xe},b.title)),L(c,{style:l.metaFooter,children:[d(p,{style:l.metaText,testID:"buoy-routes-sitemap-updated",children:E}),d(c,{style:l.sourceBadge,children:d(p,{style:l.sourceText,testID:"buoy-routes-sitemap-source",children:H})})]})]}),d(la,{visible:$,onClose:()=>ae(false),featureName:"Route Navigation"})]}):d(c,{style:[l.container,e],children:d(c,{style:l.loadingContainer,children:d(p,{style:l.loadingText,testID:"buoy-routes-sitemap-loading",children:k?"Loading routes...":"Route sitemap isn't available on the dashboard \u2014 the route tree lives on the device. Use the Events tab to see navigation here."})})})}function Ee({value:e,label:t,id:o}){return L(c,{style:l.statItem,testID:`buoy-routes-stat-${o}`,accessibilityLabel:`${t}, ${e}`,children:[d(p,{style:l.statValue,testID:`buoy-routes-stat-${o}-value`,children:e}),d(p,{style:l.statLabel,children:t})]})}function Ca({group:e,isExpanded:t,onToggleExpand:o,onNavigate:r}){return L(c,{style:l.groupContainer,children:[L(W,{style:l.groupHeader,onPress:o,activeOpacity:.7,testID:Gt(e.title),accessibilityRole:"button",accessibilityLabel:`${e.title}, ${e.routes.length} routes`,children:[L(c,{style:l.groupHeaderLeft,children:[t?d(Ht,{size:14,color:y.color.textSecondary}):d(Mt,{size:14,color:y.color.textSecondary}),d(p,{style:l.groupTitle,children:e.title})]}),d(c,{style:l.groupBadge,children:d(p,{style:l.groupCount,testID:`${Gt(e.title)}-count`,children:e.routes.length})})]}),e.description&&d(c,{style:l.groupDescription,children:d(p,{style:l.groupDescriptionText,children:e.description})}),t&&d(c,{style:l.routesList,children:e.routes.map((a,i)=>d(Kt,{route:a,onNavigate:r},`${a.path}-${i}`))})]})}function Kt({route:e,depth:t=0,onNavigate:o}){let[r,a]=Be(false),i=e.children.length>0,n=Ta(e.type),u=e.type!=="layout"&&e.type!=="group",s=va(e.path),m=i,I=m?r:true;return d(c,{style:[l.routeItem,{marginLeft:t*12}],testID:s,children:L(c,{style:l.routeCard,children:[L(c,{style:l.routeHeader,children:[m?L(W,{style:l.routeHeaderLeft,onPress:()=>a(!r),activeOpacity:.7,testID:`${s}-toggle`,accessibilityRole:"button",accessibilityLabel:`${e.path}, ${e.type}, ${e.children.length} nested`,children:[d(c,{style:l.expandIndicator,children:r?d(Ht,{size:14,color:y.color.textSecondary}):d(Mt,{size:14,color:y.color.textSecondary})}),d(p,{style:l.routePath,numberOfLines:3,testID:`${s}-path`,children:e.path})]}):L(c,{style:l.routeHeaderLeft,accessible:true,accessibilityLabel:`${e.path}, ${e.type}`,children:[d(c,{style:l.expandIndicator}),d(p,{style:l.routePath,numberOfLines:3,testID:`${s}-path`,children:e.path})]}),L(c,{style:l.routeHeaderActions,children:[i&&d(c,{style:l.childCountBadge,children:d(p,{style:l.childCountText,testID:`${s}-children-count`,children:e.children.length})}),d(c,{style:[l.typeTag,{backgroundColor:`${n}15`,borderColor:`${n}40`}],children:d(p,{style:[l.typeText,{color:n}],testID:`${s}-type`,children:e.type.toUpperCase()})}),d(aa,{value:e.path,buttonStyle:l.iconAction,testID:`${s}-copy`}),u&&d(W,{style:l.goButton,onPress:()=>o(e),activeOpacity:.7,testID:`${s}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${e.path}`,children:d(p,{style:l.goButtonText,children:"Go"})})]})]}),I&&i&&d(c,{style:l.childrenContainer,children:e.children.map((v,T)=>d(Kt,{route:v,depth:t+1,onNavigate:o},`${v.path}-${T}`))})]})})}function Ta(e){switch(e){case"static":return"#3B82F6";case"dynamic":return"#F59E0B";case"catch-all":return"#EC4899";case"index":return"#10B981";case"layout":return"#8B5CF6";case"group":return"#6366F1";case"not-found":return"#EF4444";default:return"#6B7280"}}var l=ve.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},loadingText:{color:y.color.textSecondary,fontSize:14,fontFamily:U,textAlign:"center",lineHeight:20,paddingHorizontal:32,maxWidth:420},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:y.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,paddingBottom:4},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"30%",minWidth:90,backgroundColor:y.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:y.color.text,fontFamily:U},statLabel:{fontSize:10,color:y.color.textTertiary,marginTop:4,fontFamily:U,textTransform:"uppercase",letterSpacing:.5},actionWrapper:{flex:1,alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionWrapperDesktop:{gap:8,minWidth:72},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:y.color.surfaceElevated},actionButtonHeaderDesktop:{padding:12,borderRadius:8,backgroundColor:y.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},iconButtonDesktop:{padding:12,borderRadius:8,backgroundColor:y.color.surfaceElevated},actionLabel:{fontSize:8,color:y.color.textTertiary,fontFamily:U,textTransform:"uppercase",letterSpacing:.5},actionLabelDesktop:{fontSize:12},refreshButtonDisabled:{opacity:.5},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:y.color.border},metaText:{fontSize:12,color:y.color.textSecondary,fontFamily:U},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:y.color.border,backgroundColor:y.color.surface},sourceText:{fontSize:11,color:y.color.textSecondary,textTransform:"capitalize",fontFamily:U},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:y.color.border},searchInput:{flex:1,color:y.color.text,fontSize:14,fontFamily:U},clearButton:{padding:4},clearButtonText:{color:y.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:y.color.accent,fontSize:14,fontWeight:"600",fontFamily:U},scrollView:{flex:1},scrollContent:{paddingBottom:8},emptyState:{padding:32,alignItems:"center"},emptyText:{color:y.color.textSecondary,fontSize:14,fontFamily:U},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:y.color.surface,borderLeftWidth:3,borderLeftColor:y.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:y.color.text,fontFamily:U,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:U},routesList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:y.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:y.color.fillTertiary},groupDescriptionText:{fontSize:11,color:y.color.textSecondary,fontFamily:U,lineHeight:16},routeItem:{marginBottom:6},routeCard:{backgroundColor:y.color.surface,borderRadius:6,borderWidth:1,borderColor:y.color.border,overflow:"hidden",shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},routeHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:7,paddingHorizontal:10,gap:8},expandIndicator:{width:18,alignItems:"center"},routeHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},routePath:{fontSize:13,fontWeight:"600",color:y.color.text,fontFamily:U,flex:1},routeHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},childCountBadge:{backgroundColor:"#6B728015",borderColor:"#6B728040",borderWidth:1,borderRadius:12,paddingHorizontal:7,paddingVertical:2,minWidth:22,alignItems:"center",justifyContent:"center"},childCountText:{fontSize:11,fontWeight:"600",color:y.color.textSecondary,fontFamily:U},typeTag:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},typeText:{fontSize:10,fontWeight:"600",fontFamily:U},iconAction:{width:28,height:24,borderRadius:4,backgroundColor:y.color.surfaceElevated,borderWidth:1,borderColor:y.color.border,alignItems:"center",justifyContent:"center"},goButton:{height:24,paddingHorizontal:10,borderRadius:4,alignItems:"center",justifyContent:"center",backgroundColor:y.color.accentSoft,borderWidth:1,borderColor:y.color.accentBorder},goButtonText:{fontSize:12,color:y.color.accent,fontFamily:U,fontWeight:"600"},childrenContainer:{borderLeftWidth:2,borderLeftColor:y.color.border,marginLeft:16,marginRight:8,marginTop:2,marginBottom:8}});import{useState as _t,useMemo as qe,useEffect as Jt}from"react";import{ChevronDown as Ra,ChevronRight as wa,InlineCopyButton as Ia,ProUpgradeModal as ka,buoyColors as Ze,night as j,useSafeAreaInsets as Ba,ToolEmptyState as Da,monoFont as se}from"@buoy-gg/shared-ui/web";import{useIsPro as Ea}from"@buoy-gg/license/web";import{DataViewer as Pa}from"@buoy-gg/shared-ui/web/dataViewer";import{useSyncExternalStore as La}from"react";var $a=class{constructor(){this.stack=[];this.actions=null;this.listeners=new Set}getStack(){return this.stack}setStack(e){this.stack=e,this.listeners.forEach(t=>t())}getActions(){return this.actions}setActions(e){this.actions=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}},Q=new $a;var Fa=[];function Qt(){let e=La(r=>Q.subscribe(r),()=>Q.getStack(),()=>Fa),t=e.find(r=>r.isFocused)??null,o=()=>{let r=Q.getActions();if(!r)throw new Error("Mount RouteTracker to capture browser navigation.");return r};return{stack:e,focusedRoute:t,stackDepth:e.length,isAtRoot:!t||t.index===0,isLoaded:e.length>0,error:null,refresh:()=>{},navigateToIndex:r=>o().navigateToIndex(r),navigateToRoute:(r,a)=>o().navigateToRoute?.(r,a)??false,popToIndex:r=>o().popToIndex(r),goBack:()=>o().goBack(),popToTop:()=>o().popToTop()}}import{jsx as C,jsxs as oe}from"react/jsx-runtime";function qt({style:e,injectedStack:t,onAction:o,onCopyValueChange:r}){let a=Qt(),i=t!=null,n=Ba({minBottom:8}),u=i?t:a.stack,s=i?true:a.isLoaded,m=i?null:a.error,I=qe(()=>u.find(f=>f.isFocused)??null,[u]),v=u.length,T=v<=1,$=f=>o?o("navigateToIndex",{index:f}):a.navigateToIndex(f),ae=f=>o?o("popToIndex",{index:f}):a.popToIndex(f),V=()=>o?o("goBack"):a.goBack(),N=()=>o?o("popToTop"):a.popToTop(),[P,D]=_t(null),[ee,k]=_t(false),G=Ea();Jt(()=>{ee&&G&&k(false)},[ee,G]);let pe=qe(()=>{let f=u.map(E=>({pathname:E.pathname,name:E.name,params:E.params,isFocused:E.isFocused}));return JSON.stringify(f,null,2)},[u]);Jt(()=>{r?.(pe)},[pe,r]);let R=qe(()=>P!==null&&u[P]?u[P]:I,[P,u,I]),O=qe(()=>P!==null&&u[P]&&!u[P].isFocused,[P,u]);if(!s)return C(c,{style:[h.container,e],children:C(c,{style:h.loadingContainer,children:C(p,{style:h.loadingText,testID:"buoy-routes-stack-loading",children:"Loading navigation stack..."})})});if(m)return C(c,{style:[h.container,e],children:oe(c,{style:h.errorContainer,testID:"buoy-routes-stack-error",children:[C(p,{style:h.errorText,children:"Error loading stack"}),C(p,{style:h.errorDetail,testID:"buoy-routes-stack-error-detail",children:m.message})]})});if(u.length===0)return C(c,{style:[h.container,e],children:C(Da,{testID:"buoy-routes-stack-empty",otto:"walking",title:"No navigation stack",message:"Navigate to a route to see the stack"})});let K=(f,E,H,ce)=>{if(o){let b=globalThis.window?.confirm;(!b||b(`${f}
|
|
4
|
+
Route: ${x.path}`,[{text:"Cancel",style:"cancel"},{text:B<Pe.length-1?"Next":"Navigate",onPress:ne=>{if(ne&&ne.trim()){let ye={...Z,[Le]:ne.trim()};fe(x,B+1,ye)}else J.alert("Invalid Value","Please enter a value for the parameter")}}],"plain-text")},[D]),xe=Ae((x,B)=>{if(a){a(x);return}if(!$&&!B?.bypassPro){H(true);return}if(x.type==="layout"||x.type==="group"){J.alert("Cannot Navigate",`${x.type==="layout"?"Layouts":"Route groups"} are not navigable routes`);return}if(x.type==="dynamic"||x.type==="catch-all"){if(x.params.length===0){try{D.push(x.path)}catch(Z){J.alert("Navigation Error",String(Z))}return}fe(x);return}try{D.push(x.path)}catch(Z){J.alert("Navigation Error",String(Z))}},[D,fe,$,a]),le=Ae(()=>{xe(wa,{bypassPro:true})},[xe]),v=Ae(()=>{p||(S(true),k(),setTimeout(()=>S(false),400))},[p,k]),F=Ke(()=>M?`Updated ${ua(M)}`:"Awaiting route data",[M]),U=Ke(()=>Q?`Source: ${Q}`:"Source: unknown",[Q]),ce=Ke(()=>i&&K.length>0?[{title:"Search Results",icon:"",routes:K}]:w,[i,K,w]);return te?z(c,{style:[s.container,e],children:[u&&z(c,{style:s.searchContainer,testID:"buoy-routes-sitemap-search-field",children:[m(Ht,{size:16,color:b.color.textTertiary}),m($t,{style:s.searchInput,placeholder:"Search routes...",placeholderTextColor:b.color.placeholder,value:i,onChangeText:n,autoCapitalize:"none",autoCorrect:false,autoFocus:true,testID:"buoy-routes-sitemap-search",accessibilityLabel:"Search routes"}),i.length>0&&m(V,{onPress:()=>n(""),style:s.clearButton,testID:"buoy-routes-sitemap-search-clear",accessibilityRole:"button",accessibilityLabel:"Clear route search",children:m(h,{style:s.clearButtonText,children:"\u2715"})}),m(V,{style:s.closeSearchButton,onPress:()=>{l(false),n("")},testID:"buoy-routes-sitemap-search-done",accessibilityRole:"button",accessibilityLabel:"Done searching routes",children:m(h,{style:s.closeSearchText,children:"Done"})})]}),z(Ue,{testID:"buoy-routes-sitemap-scroll",style:s.scrollView,contentContainerStyle:s.scrollContent,children:[!u&&z(c,{style:s.header,children:[z(c,{style:s.actionsRow,children:[z(c,{style:[s.actionWrapper,Y&&s.actionWrapperDesktop],children:[m(V,{style:[s.iconButton,Y&&s.iconButtonDesktop],onPress:le,accessibilityLabel:"Go to home route",accessibilityRole:"button",testID:"buoy-routes-sitemap-home",children:m(ia,{size:Je,color:b.color.textSecondary})}),m(h,{style:[s.actionLabel,Y&&s.actionLabelDesktop],children:"Home"})]}),z(c,{style:[s.actionWrapper,Y&&s.actionWrapperDesktop],children:[m(la,{value:A,testID:"buoy-routes-sitemap-copy",size:Y?Je:14,buttonStyle:Y?s.actionButtonHeaderDesktop:s.actionButtonHeader}),m(h,{style:[s.actionLabel,Y&&s.actionLabelDesktop],children:"Copy"})]}),z(c,{style:[s.actionWrapper,Y&&s.actionWrapperDesktop],children:[m(V,{style:[s.iconButton,Y&&s.iconButtonDesktop,p&&s.refreshButtonDisabled],onPress:v,disabled:p,testID:"buoy-routes-sitemap-refresh",accessibilityRole:"button",accessibilityLabel:"Refresh route tree",children:m(ca,{size:Je,color:p?b.color.textTertiary:b.color.textSecondary})}),m(h,{style:[s.actionLabel,Y&&s.actionLabelDesktop],children:"Refresh"})]}),z(c,{style:[s.actionWrapper,Y&&s.actionWrapperDesktop],children:[m(V,{style:[s.iconButton,Y&&s.iconButtonDesktop],onPress:()=>l(true),testID:"buoy-routes-sitemap-search-open",accessibilityRole:"button",accessibilityLabel:"Search routes",children:m(Ht,{size:Je,color:b.color.textSecondary})}),m(h,{style:[s.actionLabel,Y&&s.actionLabelDesktop],children:"Search"})]})]}),z(c,{style:s.statsGrid,children:[m(Ee,{value:R.total,label:"Total",id:"total"}),m(Ee,{value:R.static,label:"Static",id:"static"}),m(Ee,{value:R.dynamic,label:"Dynamic",id:"dynamic"}),m(Ee,{value:R.catchAll,label:"Catch-All",id:"catch-all"}),m(Ee,{value:R.layouts,label:"Layouts",id:"layouts"}),m(Ee,{value:R.groups,label:"Groups",id:"groups"})]})]}),ce.length===0?m(ra,{testID:"buoy-routes-sitemap-empty",otto:"map",title:"No routes found",message:"Nothing in the router matches. Clear the search to see the whole tree."}):ce.map(x=>m(Ia,{group:x,isExpanded:i.length>0||g.has(x.title),onToggleExpand:()=>Te(x.title),onNavigate:xe},x.title)),z(c,{style:s.metaFooter,children:[m(h,{style:s.metaText,testID:"buoy-routes-sitemap-updated",children:F}),m(c,{style:s.sourceBadge,children:m(h,{style:s.sourceText,testID:"buoy-routes-sitemap-source",children:U})})]})]}),m(da,{visible:L,onClose:()=>H(false),featureName:"Route Navigation"})]}):m(c,{style:[s.container,e],children:m(c,{style:s.loadingContainer,children:m(h,{style:s.loadingText,testID:"buoy-routes-sitemap-loading",children:E?"Loading routes...":"Route sitemap isn't available on the dashboard \u2014 the route tree lives on the device. Use the Events tab to see navigation here."})})})}function Ee({value:e,label:t,id:o}){return z(c,{style:s.statItem,testID:`buoy-routes-stat-${o}`,accessibilityLabel:`${t}, ${e}`,children:[m(h,{style:s.statValue,testID:`buoy-routes-stat-${o}-value`,children:e}),m(h,{style:s.statLabel,children:t})]})}function Ia({group:e,isExpanded:t,onToggleExpand:o,onNavigate:r}){return z(c,{style:s.groupContainer,children:[z(V,{style:s.groupHeader,onPress:o,activeOpacity:.7,testID:Kt(e.title),accessibilityRole:"button",accessibilityLabel:`${e.title}, ${e.routes.length} routes`,children:[z(c,{style:s.groupHeaderLeft,children:[t?m(Mt,{size:14,color:b.color.textSecondary}):m(Ut,{size:14,color:b.color.textSecondary}),m(h,{style:s.groupTitle,children:e.title})]}),m(c,{style:s.groupBadge,children:m(h,{style:s.groupCount,testID:`${Kt(e.title)}-count`,children:e.routes.length})})]}),e.description&&m(c,{style:s.groupDescription,children:m(h,{style:s.groupDescriptionText,children:e.description})}),t&&m(c,{style:s.routesList,children:e.routes.map((a,i)=>m(Qt,{route:a,onNavigate:r},`${a.path}-${i}`))})]})}function Qt({route:e,depth:t=0,onNavigate:o}){let[r,a]=Be(false),i=e.children.length>0,n=Ra(e.type),u=e.type!=="layout"&&e.type!=="group",l=Ta(e.path),g=i,d=g?r:true;return m(c,{style:[s.routeItem,{marginLeft:t*12}],testID:l,children:z(c,{style:s.routeCard,children:[z(c,{style:s.routeHeader,children:[g?z(V,{style:s.routeHeaderLeft,onPress:()=>a(!r),activeOpacity:.7,testID:`${l}-toggle`,accessibilityRole:"button",accessibilityLabel:`${e.path}, ${e.type}, ${e.children.length} nested`,children:[m(c,{style:s.expandIndicator,children:r?m(Mt,{size:14,color:b.color.textSecondary}):m(Ut,{size:14,color:b.color.textSecondary})}),m(h,{style:s.routePath,numberOfLines:3,testID:`${l}-path`,children:e.path})]}):z(c,{style:s.routeHeaderLeft,accessible:true,accessibilityLabel:`${e.path}, ${e.type}`,children:[m(c,{style:s.expandIndicator}),m(h,{style:s.routePath,numberOfLines:3,testID:`${l}-path`,children:e.path})]}),z(c,{style:s.routeHeaderActions,children:[i&&m(c,{style:s.childCountBadge,children:m(h,{style:s.childCountText,testID:`${l}-children-count`,children:e.children.length})}),m(c,{style:[s.typeTag,{backgroundColor:`${n}15`,borderColor:`${n}40`}],children:m(h,{style:[s.typeText,{color:n}],testID:`${l}-type`,children:e.type.toUpperCase()})}),m(sa,{value:e.path,buttonStyle:s.iconAction,testID:`${l}-copy`}),u&&m(V,{style:s.goButton,onPress:()=>o(e),activeOpacity:.7,testID:`${l}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${e.path}`,children:m(h,{style:s.goButtonText,children:"Go"})})]})]}),d&&i&&m(c,{style:s.childrenContainer,children:e.children.map((p,S)=>m(Qt,{route:p,depth:t+1,onNavigate:o},`${p.path}-${S}`))})]})})}function Ra(e){switch(e){case"static":return"#3B82F6";case"dynamic":return"#F59E0B";case"catch-all":return"#EC4899";case"index":return"#10B981";case"layout":return"#8B5CF6";case"group":return"#6366F1";case"not-found":return"#EF4444";default:return"#6B7280"}}var s=ve.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"},loadingText:{color:b.color.textSecondary,fontSize:14,fontFamily:_,textAlign:"center",lineHeight:20,paddingHorizontal:32,maxWidth:420},header:{flexDirection:"column",padding:8,borderBottomWidth:1,borderBottomColor:b.color.border,gap:12,marginBottom:8},actionsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,paddingBottom:4},statsGrid:{flexDirection:"row",flexWrap:"wrap",gap:8},statItem:{flexGrow:1,flexShrink:1,flexBasis:"30%",minWidth:90,backgroundColor:b.color.surface,borderRadius:8,paddingVertical:10,paddingHorizontal:12,alignItems:"center"},statValue:{fontSize:18,fontWeight:"800",color:b.color.text,fontFamily:_},statLabel:{fontSize:10,color:b.color.textTertiary,marginTop:4,fontFamily:_,textTransform:"uppercase",letterSpacing:.5},actionWrapper:{flex:1,alignItems:"center",justifyContent:"center",gap:4,minWidth:48},actionWrapperDesktop:{gap:8,minWidth:72},actionButtonHeader:{padding:6,borderRadius:4,backgroundColor:b.color.surfaceElevated},actionButtonHeaderDesktop:{padding:12,borderRadius:8,backgroundColor:b.color.surfaceElevated},iconButton:{padding:6,borderRadius:4,alignItems:"center",justifyContent:"center"},iconButtonDesktop:{padding:12,borderRadius:8,backgroundColor:b.color.surfaceElevated},actionLabel:{fontSize:8,color:b.color.textTertiary,fontFamily:_,textTransform:"uppercase",letterSpacing:.5},actionLabelDesktop:{fontSize:12},refreshButtonDisabled:{opacity:.5},metaFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,paddingHorizontal:16,paddingVertical:16,marginTop:16,borderTopWidth:1,borderTopColor:b.color.border},metaText:{fontSize:12,color:b.color.textSecondary,fontFamily:_},sourceBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:b.color.border,backgroundColor:b.color.surface},sourceText:{fontSize:11,color:b.color.textSecondary,textTransform:"capitalize",fontFamily:_},searchContainer:{flexDirection:"row",alignItems:"center",padding:8,gap:8,borderBottomWidth:1,borderBottomColor:b.color.border},searchInput:{flex:1,color:b.color.text,fontSize:14,fontFamily:_},clearButton:{padding:4},clearButtonText:{color:b.color.textTertiary,fontSize:18},closeSearchButton:{paddingHorizontal:8,paddingVertical:4},closeSearchText:{color:b.color.accent,fontSize:14,fontWeight:"600",fontFamily:_},scrollView:{flex:1},scrollContent:{paddingBottom:8},emptyState:{padding:32,alignItems:"center"},emptyText:{color:b.color.textSecondary,fontSize:14,fontFamily:_},groupContainer:{marginVertical:4},groupHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,paddingHorizontal:16,backgroundColor:b.color.surface,borderLeftWidth:3,borderLeftColor:b.color.fillTertiary},groupHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},groupTitle:{fontSize:12,fontWeight:"700",color:b.color.text,fontFamily:_,textTransform:"uppercase",letterSpacing:.8},groupBadge:{backgroundColor:"#3B82F615",borderColor:"#3B82F640",borderWidth:1,borderRadius:12,paddingHorizontal:8,paddingVertical:3,minWidth:24,alignItems:"center",justifyContent:"center"},groupCount:{fontSize:11,fontWeight:"600",color:"#3B82F6",fontFamily:_},routesList:{backgroundColor:"transparent"},groupDescription:{paddingHorizontal:16,paddingVertical:8,marginBottom:8,backgroundColor:b.color.surfaceElevated,borderLeftWidth:3,borderLeftColor:b.color.fillTertiary},groupDescriptionText:{fontSize:11,color:b.color.textSecondary,fontFamily:_,lineHeight:16},routeItem:{marginBottom:6},routeCard:{backgroundColor:b.color.surface,borderRadius:6,borderWidth:1,borderColor:b.color.border,overflow:"hidden",shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:2,elevation:1},routeHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:7,paddingHorizontal:10,gap:8},expandIndicator:{width:18,alignItems:"center"},routeHeaderLeft:{flexDirection:"row",alignItems:"center",gap:8,flex:1},routePath:{fontSize:13,fontWeight:"600",color:b.color.text,fontFamily:_,flex:1},routeHeaderActions:{flexDirection:"row",alignItems:"center",gap:6},childCountBadge:{backgroundColor:"#6B728015",borderColor:"#6B728040",borderWidth:1,borderRadius:12,paddingHorizontal:7,paddingVertical:2,minWidth:22,alignItems:"center",justifyContent:"center"},childCountText:{fontSize:11,fontWeight:"600",color:b.color.textSecondary,fontFamily:_},typeTag:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},typeText:{fontSize:10,fontWeight:"600",fontFamily:_},iconAction:{width:28,height:24,borderRadius:4,backgroundColor:b.color.surfaceElevated,borderWidth:1,borderColor:b.color.border,alignItems:"center",justifyContent:"center"},goButton:{height:24,paddingHorizontal:10,borderRadius:4,alignItems:"center",justifyContent:"center",backgroundColor:b.color.accentSoft,borderWidth:1,borderColor:b.color.accentBorder},goButtonText:{fontSize:12,color:b.color.accent,fontFamily:_,fontWeight:"600"},childrenContainer:{borderLeftWidth:2,borderLeftColor:b.color.border,marginLeft:16,marginRight:8,marginTop:2,marginBottom:8}});import{useState as Jt,useMemo as qe,useEffect as qt}from"react";import{ChevronDown as ka,ChevronRight as Ba,InlineCopyButton as Da,ProUpgradeModal as Ea,buoyColors as Xe,night as O,useSafeAreaInsets as Pa,ToolEmptyState as La,monoFont as se}from"@buoy-gg/shared-ui/web";import{useIsPro as $a}from"@buoy-gg/license/web";import{DataViewer as Fa}from"@buoy-gg/shared-ui/web/dataViewer";import{useSyncExternalStore as za}from"react";var Na=class{constructor(){this.stack=[];this.actions=null;this.listeners=new Set}getStack(){return this.stack}setStack(e){this.stack=e,this.listeners.forEach(t=>t())}getActions(){return this.actions}setActions(e){this.actions=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}},W=new Na;var Aa=[];function Xt(){let e=za(r=>W.subscribe(r),()=>W.getStack(),()=>Aa),t=e.find(r=>r.isFocused)??null,o=()=>{let r=W.getActions();if(!r)throw new Error("Mount RouteTracker to capture browser navigation.");return r};return{stack:e,focusedRoute:t,stackDepth:e.length,isAtRoot:!t||t.index===0,isLoaded:e.length>0,error:null,refresh:()=>{},navigateToIndex:r=>o().navigateToIndex(r),navigateToRoute:(r,a)=>o().navigateToRoute?.(r,a)??false,popToIndex:r=>o().popToIndex(r),goBack:()=>o().goBack(),popToTop:()=>o().popToTop()}}import{jsx as I,jsxs as re}from"react/jsx-runtime";function Yt({style:e,injectedStack:t,onAction:o,onCopyValueChange:r}){let a=Xt(),i=t!=null,n=Pa({minBottom:8}),u=i?t:a.stack,l=i?true:a.isLoaded,g=i?null:a.error,d=qe(()=>u.find(v=>v.isFocused)??null,[u]),p=u.length,S=p<=1,L=v=>o?o("navigateToIndex",{index:v}):a.navigateToIndex(v),H=v=>o?o("popToIndex",{index:v}):a.popToIndex(v),$=()=>o?o("goBack"):a.goBack(),D=()=>o?o("popToTop"):a.popToTop(),[w,R]=Jt(null),[te,E]=Jt(false),K=$a();qt(()=>{te&&K&&E(false)},[te,K]);let pe=qe(()=>{let v=u.map(F=>({pathname:F.pathname,name:F.name,params:F.params,isFocused:F.isFocused}));return JSON.stringify(v,null,2)},[u]);qt(()=>{r?.(pe)},[pe,r]);let k=qe(()=>w!==null&&u[w]?u[w]:d,[w,u,d]),M=qe(()=>w!==null&&u[w]&&!u[w].isFocused,[w,u]);if(!l)return I(c,{style:[f.container,e],children:I(c,{style:f.loadingContainer,children:I(h,{style:f.loadingText,testID:"buoy-routes-stack-loading",children:"Loading navigation stack..."})})});if(g)return I(c,{style:[f.container,e],children:re(c,{style:f.errorContainer,testID:"buoy-routes-stack-error",children:[I(h,{style:f.errorText,children:"Error loading stack"}),I(h,{style:f.errorDetail,testID:"buoy-routes-stack-error-detail",children:g.message})]})});if(u.length===0)return I(c,{style:[f.container,e],children:I(La,{testID:"buoy-routes-stack-empty",otto:"walking",title:"No navigation stack",message:"Navigate to a route to see the stack"})});let Q=(v,F,U,ce)=>{if(o){let x=globalThis.window?.confirm;(!x||x(`${v}
|
|
5
5
|
|
|
6
|
-
${E}`))&&ce();return}_.alert(f,E,[{text:"Cancel",style:"cancel"},{text:H,style:"destructive",onPress:ce}])},z=()=>{if(!G){k(true);return}if(T){_.alert("Cannot Go Back","Already at the root of the stack");return}V()},Ce=()=>{if(!G){k(true);return}if(T){_.alert("Already at Top","Stack only has one screen");return}K("Pop to Top","This will remove all screens except the root screen.","Pop to Top",N)},ye=f=>{D(P===f?null:f)},xe=()=>{if(!G){k(true);return}if(R){if(R.isFocused){_.alert("Already There","This route is already visible");return}$(R.index)}},le=()=>{if(!G){k(true);return}if(!R)return;if(R.isFocused){_.alert("Cannot Pop","Selected route is already visible");return}if(R.index===v-1){_.alert("Cannot Pop","No screens above selected route");return}let f=v-1-R.index,E=R.index;K("Pop to Route",`Remove ${f} screen${f!==1?"s":""} above ${R.pathname}?`,"Pop",()=>ae(E))};return oe(c,{style:[h.container,e],children:[C(Ue,{testID:"buoy-routes-stack-scroll",style:h.stackScroll,contentContainerStyle:[h.stackContent,{paddingBottom:h.stackContent.padding+n.bottom}],children:[...u].reverse().map((f,E)=>{let H=u.length-1-E,ce=P===H,b=Object.keys(f.params).length>0,w=xa(H);return C(c,{style:h.stackItemWrapper,testID:w,children:oe(c,{style:[h.stackItem,ce&&h.stackItemSelected],children:[oe(W,{style:h.stackItemHeader,onPress:()=>ye(H),activeOpacity:.7,testID:`${w}-toggle`,accessibilityRole:"button",accessibilityLabel:`${f.pathname}, ${f.isFocused?"focused":"mounted"}, position ${H} of ${v-1}`,children:[C(c,{style:h.expandIndicator,children:ce?C(Ra,{size:14,color:j.color.textSecondary}):C(wa,{size:14,color:j.color.textSecondary})}),C(p,{style:h.stackItemPath,numberOfLines:1,testID:`${w}-path`,children:f.pathname}),C(Ia,{value:f.pathname,buttonStyle:h.copyRouteButton,testID:`${w}-copy`}),C(c,{style:[h.statusBadge,{backgroundColor:f.isFocused?`${Ze.success}15`:"#3B82F615",borderColor:f.isFocused?`${Ze.success}40`:"#3B82F640"}],children:C(p,{style:[h.statusBadgeText,{color:f.isFocused?Ze.success:"#3B82F6"}],testID:`${w}-status`,children:f.isFocused?"FOCUSED":"MOUNTED"})})]}),ce&&oe(c,{style:h.expandedContent,children:[oe(c,{style:h.detailRow,children:[C(p,{style:h.detailLabel,children:"Route Name:"}),C(p,{style:h.detailValue,testID:`${w}-name`,children:f.name})]}),oe(c,{style:h.detailRow,children:[C(p,{style:h.detailLabel,children:"Position:"}),oe(p,{style:h.detailValue,testID:`${w}-position`,children:[H," / ",v-1]})]}),b&&C(c,{style:h.dataViewerContainer,children:C(Pa,{title:"Parameters",data:f.params,showTypeFilter:false})}),oe(c,{style:h.actionsRow,children:[oe(c,{style:h.actionWrapper,children:[C(W,{style:[h.actionButton,T&&h.actionButtonDisabled],onPress:z,disabled:T,testID:`${w}-back`,accessibilityRole:"button",accessibilityLabel:"Go back one screen",children:C(p,{style:[h.actionButtonText,T&&h.actionButtonTextDisabled],children:"Back"})}),C(p,{style:h.helpText,children:"Go back one screen"})]}),oe(c,{style:h.actionWrapper,children:[C(W,{style:[h.actionButton,f.isFocused&&h.actionButtonDisabled],onPress:xe,disabled:f.isFocused,testID:`${w}-go`,accessibilityRole:"button",accessibilityLabel:`Navigate to ${f.pathname}`,children:C(p,{style:[h.actionButtonText,f.isFocused&&h.actionButtonTextDisabled],children:"Go"})}),C(p,{style:h.helpText,children:"Navigate to this route"})]}),oe(c,{style:h.actionWrapper,children:[C(W,{style:[h.actionButton,(f.isFocused||H===v-1)&&h.actionButtonDisabled],onPress:le,disabled:f.isFocused||H===v-1,testID:`${w}-pop-to`,accessibilityRole:"button",accessibilityLabel:`Remove screens above ${f.pathname}`,children:C(p,{style:[h.actionButtonText,(f.isFocused||H===v-1)&&h.actionButtonTextDisabled],children:"Pop To"})}),C(p,{style:h.helpText,children:"Remove screens above this"})]})]})]})]})},`stack-${H}-${f.key}`)})}),C(ka,{visible:ee,onClose:()=>k(false),featureName:"Stack Navigation"})]})}var h=ve.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},loadingText:{color:j.color.textSecondary,fontSize:14,fontFamily:se},errorContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},errorText:{color:Ze.error,fontSize:16,fontWeight:"600",fontFamily:se,marginBottom:8},errorDetail:{color:j.color.textSecondary,fontSize:12,fontFamily:se,textAlign:"center"},emptyContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyText:{color:j.color.text,fontSize:16,fontWeight:"600",fontFamily:se,marginBottom:8},emptySubtext:{color:j.color.textSecondary,fontSize:14,fontFamily:se,textAlign:"center"},stackScroll:{flex:1},stackContent:{padding:8},stackItemWrapper:{marginBottom:6},stackItem:{backgroundColor:j.color.surface,borderRadius:6,borderWidth:1,borderColor:j.color.border,overflow:"hidden"},stackItemSelected:{borderColor:j.color.accent,borderWidth:2},stackItemHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:12,gap:8},expandIndicator:{width:20,alignItems:"center"},stackItemPath:{fontSize:13,fontWeight:"600",color:j.color.text,fontFamily:se,flex:1},copyRouteButton:{padding:4,marginLeft:4},statusBadge:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},statusBadgeText:{fontSize:10,fontWeight:"600",fontFamily:se},expandedContent:{paddingHorizontal:12,paddingTop:8,paddingBottom:12,borderTopWidth:1,borderTopColor:j.color.border},detailRow:{marginBottom:8},detailLabel:{fontSize:10,color:j.color.textSecondary,fontFamily:se,marginBottom:2},detailValue:{fontSize:12,color:j.color.text,fontFamily:se},dataViewerContainer:{marginTop:4,marginHorizontal:-12,marginBottom:8},actionsRow:{flexDirection:"row",gap:6,marginTop:12},actionWrapper:{flex:1},actionButton:{backgroundColor:j.color.surfaceElevated,paddingVertical:8,paddingHorizontal:8,borderRadius:6,alignItems:"center"},actionButtonDisabled:{opacity:.5},actionButtonText:{fontSize:12,fontWeight:"600",color:j.color.text,fontFamily:se},actionButtonTextDisabled:{color:j.color.textTertiary},helpText:{fontSize:9,color:j.color.textSecondary,fontFamily:se,textAlign:"center",marginTop:4,lineHeight:12}});import{useCallback as za}from"react";import{Navigation as Aa,night as gt,EVENT_LIST_PRESET as Na,monoFont as Zt}from"@buoy-gg/shared-ui/web";import{memo as Wa,useMemo as de}from"react";import{CompactRow as ja,RelativeTime as Va,buoyColors as Xt,night as Xe,monoFont as Yt}from"@buoy-gg/shared-ui/web";import{jsx as je}from"react/jsx-runtime";function Oa(e){return e.pathname==="/"?"home":ct(e.pathname,e.segments)?"dynamic":e.params&&Object.keys(e.params).length>0?"with-params":"default"}function Ha(e){switch(e){case"home":return Xt.success;case"dynamic":return Xe.color.accent;case"with-params":return Xt.warning;default:return Xe.color.textSecondary}}function Ma(e){switch(e){case"home":return"Home";case"dynamic":return"Dynamic";case"with-params":return"Params";default:return"Static"}}function Ua(e){if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/6e4),o=Math.floor(e%6e4/1e3);return o>0?`${t}m ${o}s`:`${t}m`}function Ga(e){let t=[];e.timeSincePrevious!==void 0&&e.timeSincePrevious>0&&t.push(Ua(e.timeSincePrevious));let o=e.segments?.length||0;return o>0&&t.push(`depth ${o}`),t.join(" \xB7 ")||"root"}function Ka(e){if(e.params&&Object.keys(e.params).length>0){let t=Object.keys(e.params).length;return`${t} PARAM${t!==1?"S":""}`}}var eo=Wa(function({event:e,visitNumber:t,isExpanded:o,onPress:r,onNavigate:a,index:i}){let n=de(()=>Oa(e),[e]),u=de(()=>ct(e.pathname,e.segments),[e.pathname,e.segments]),s=de(()=>Ha(n),[n]),m=de(()=>Ma(n),[n]),I=de(()=>Ga(e),[e]),v=de(()=>Ka(e),[e]),T=de(()=>ba(e.pathname,t),[e.pathname,t]),$=de(()=>`${e.pathname}, ${m}, ${I}`,[e.pathname,m,I]),ae=de(()=>{if(o)return je(lt,{event:e,visitNumber:t,routeTemplate:u})},[o,e,t,u]),V=de(()=>{if(a)return je(W,{style:to.goButton,onPress:()=>a(Nt(e.pathname,e.params)),testID:`${T}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${e.pathname}`,children:je(p,{style:to.goButtonText,children:"Go"})})},[a,e.pathname,T]);return je(ja,{statusDotColor:s,statusLabel:m,statusSublabel:I,primaryText:e.pathname,badgeText:v,badgeColor:s,trailingAction:V,bottomRightText:je(Va,{timestamp:e.timestamp}),showChevron:true,expandedContent:ae,isExpanded:o,expandedGlowColor:s,onPress:()=>r(i),testID:T,statusTestID:`${T}-status`,statusSublabelTestID:`${T}-sublabel`,accessibilityLabel:$})}),to=ve.create({badgeText:{fontSize:11,fontWeight:"600",fontFamily:Yt},goButton:{backgroundColor:Xe.color.accent,paddingHorizontal:8,paddingVertical:4,borderRadius:4},goButtonText:{fontSize:10,fontWeight:"600",color:Xe.color.onAccent,fontFamily:Yt}});import{jsx as Ve,jsxs as _a}from"react/jsx-runtime";function Ja({events:e,visitCounts:t,onNavigate:o,onSelectEvent:r}){let a=za(i=>{let n=e[i];n&&r(n,t.get(n)||1)},[e,t,r]);return e.length===0?_a(c,{style:Ye.emptyState,testID:"buoy-routes-empty",children:[Ve(Aa,{size:48,color:gt.color.textTertiary}),Ve(p,{style:Ye.emptyTitle,testID:"buoy-routes-empty-title",children:"No events yet"}),Ve(p,{style:Ye.emptySubtitle,testID:"buoy-routes-empty-subtitle",children:"Navigation events will appear here"})]}):Ve(Pt,{testID:"buoy-routes-timeline",contentContainerStyle:Ye.listContent,data:e,keyExtractor:i=>`${i.timestamp}-${i.pathname}`,renderItem:({item:i,index:n})=>Ve(eo,{event:i,visitNumber:t.get(i)||1,isExpanded:false,index:n,onPress:a,onNavigate:o}),showsVerticalScrollIndicator:true,...Na})}var Ye=ve.create({listContent:{paddingVertical:8},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:gt.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:Zt,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:gt.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:Zt}});import{Fragment as Qa,jsx as S,jsxs as re}from"react/jsx-runtime";var yt=Rr(),qa={parse:e=>e==="routes"||e==="events"||e==="stack"?e:void 0,serialize:e=>e},Za={parse:e=>e==="true",serialize:e=>e.toString()},Xa={parse:e=>new Set(JSON.parse(e)),serialize:e=>JSON.stringify(Array.from(e))};function oo(e,t){if(!e||!e.routes)return null;for(let o of e.routes){if(o.name===t)return[o.name];if(o.state){let r=oo(o.state,t);if(r)return[o.name,...r]}}return null}function Ya(e,t){if(e.length===0)return null;let o=t&&Object.keys(t).length>0?t:void 0;if(e.length===1)return yt.navigate(o?{name:e[0],params:o}:{name:e[0]});let r=o?{screen:e[e.length-1],params:o}:{screen:e[e.length-1]};for(let a=e.length-2;a>=1;a--)r={screen:e[a],params:r};return yt.navigate({name:e[0],params:r})}function ft({visible:e,onClose:t,onBack:o,onMinimize:r,enableSharedModalDimensions:a=false,inline:i=false,remote:n}){let u=wr(),s=void 0,m=Ir(),[I,v]=at($e.routeEvents.activeTab(),"events",qa),[T,$]=we(false),[ae,V]=we(""),N=Vr(),P=jr("routeEvents.entries");Bt(()=>{T&&N&&$(false)},[T,N]);let[D,ee]=at($e.routeEvents.isMonitoring(),true,Za),{events:k,clearEvents:G,isListening:pe}=At({enabled:D}),R=D&&pe;Bt(()=>{he.setBootCapture(D)},[D]);let[O,K]=we(false),[z,Ce]=we(null),[ye,xe]=we(1),[le,f]=we(""),[E,H]=at($e.routeEvents.eventFilters(),new Set(["/_sitemap","/api","/__dev"]),Xa),ce=wo(null),b=ue(g=>{},[]),w=ue(g=>{try{if(n){if(!n.onNavigatePath)return;if(!N&&g!=="/"){$(true);return}n.onNavigatePath(g);return}if(m)u.push(g);else if(s){let{pathname:B,params:q}=qr(g),me=B.startsWith("/")?B.slice(1):B,Te=Object.keys(q).length>0,Re=s.getRootState?.();if(Re){let Me=oo(Re,me);if(Me){let wt=Ya(Me,q);if(wt){s.dispatch(wt);return}}}s.dispatch(yt.navigate(Te?{name:me,params:q}:{name:me}))}else _.alert("Navigation Unavailable","No Expo Router or React Navigation container was found in this app.")}catch(B){_.alert("Navigation Error",String(B))}},[u,s,m,n,N]),X=ue(()=>{ee(g=>!g)},[]),Pe=ue(()=>{if(k.length!==0){if(!N){$(true);return}G()}},[k.length,N,G]),Le=ue(g=>{H(B=>{let q=new Set(B);return q.has(g)?q.delete(g):q.add(g),q})},[]),et=ue(g=>{H(B=>new Set([...B,g]))},[]),ne=ue(()=>{K(!O)},[O]),fe=ue((g,B)=>{Ce(g),xe(B)},[]),He=ue(()=>{Ce(null)},[]),mo=ue(g=>{Ce(null),v(g)},[]),ho=Ie(()=>{let g=new Set;return k.forEach(B=>{B.pathname&&g.add(B.pathname)}),Array.from(g).sort()},[k]),be=Ie(()=>k.filter(g=>{if(!g.pathname||Array.from(E).some(B=>g.pathname.includes(B)))return false;if(le.trim()){let B=le.toLowerCase(),q=g.pathname.toLowerCase().includes(B),me=Object.entries(g.params||{}).some(([Te,Re])=>{let Me=Array.isArray(Re)?Re.join(" "):Re;return Te.toLowerCase().includes(B)||Me.toLowerCase().includes(B)});return q||me}return true}),[k,E,le]),go=Ie(()=>be.slice(0,P),[be,P]),tt=Ie(()=>Math.max(0,be.length-P),[be.length,P]),ot=Ie(()=>{let g=new Map,B=new Map;for(let q=k.length-1;q>=0;q--){let me=k[q],Te=(g.get(me.pathname)||0)+1;g.set(me.pathname,Te),B.set(me,Te)}return B},[k]),yo=Ie(()=>({summary:{total:k.length,filtered:be.length,listening:R,ignoredPatterns:Array.from(E),timestamp:new Date().toISOString()},events:be.map((g,B)=>({index:B,visitNumber:ot.get(g)||1,pathname:g.pathname,timestamp:g.timestamp,timestampRelative:Lr(g.timestamp),params:g.params,segments:g.segments,previousPathname:g.previousPathname,timeSincePrevious:g.timeSincePrevious}))}),[k.length,be,R,E,ot]);if(!e)return null;let fo=a?$e.modal.root():$e.routeEvents.modal(),rt=null,Ct=()=>{if(z)return S(jt,{event:z,visitNumber:ye,onNavigate:w});if(I==="routes")return m||n?.sitemap?S(ht,{style:A.contentWrapper,injectedRoutes:n?.sitemap?.routes,injectedSource:n?.sitemap?.source??null,injectedLastUpdatedAt:n?.sitemap?.lastUpdatedAt??null,onNavigateRoute:n?bo:void 0}):S(ht,{style:A.contentWrapper});if(I==="stack")return S(qt,{style:A.contentWrapper,injectedStack:n?n.stack??[]:void 0,onAction:n?.onStackAction,onCopyValueChange:V});if(O)return S(Yr,{ignoredPatterns:E,onTogglePattern:Le,onAddPattern:et,availablePathnames:ho});let g=k.length>0;return be.length===0?re(c,{style:A.contentWrapper,testID:"buoy-routes-events",children:[g&&S(c,{style:A.searchContainer,testID:"buoy-routes-search-field",children:S($t,{value:le,onChange:f,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),S(Br,{testID:"buoy-routes-empty",...Dr({subject:"route events",search:le,total:k.length,capturing:R,waiting:{otto:"walking",title:"No route events yet",message:"Navigation events will appear here"},paused:{title:"Event listener is paused",message:"Press play to start monitoring"}})})]}):re(c,{style:A.contentWrapper,testID:"buoy-routes-events",children:[S(c,{style:A.searchContainer,testID:"buoy-routes-search-field",children:S($t,{value:le,onChange:f,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),tt>0&&re(c,{style:A.lockedEventsBanner,testID:"buoy-routes-locked-banner",children:[S(zr,{size:14,color:M.color.warning}),re(p,{style:A.lockedEventsBannerText,testID:"buoy-routes-locked-banner-text",children:[tt," older ",tt===1?"event":"events"," locked"]}),S(p,{style:A.lockedEventsBannerSubtext,children:"Upgrade to Pro for full history"})]}),S(Ja,{events:go,visitCounts:ot,onNavigate:w,onSelectEvent:fe})]})},Tt=z?re(ie,{children:[S(ie.Navigation,{onBack:He}),S(ie.Content,{title:z.pathname,testID:"buoy-routes-detail-title"}),S(ie.Actions,{children:S(nt,{testID:"buoy-routes-detail-copy",value:{pathname:z.pathname,previousPathname:z.previousPathname,params:z.params,segments:z.segments,timestamp:z.timestamp,timestampISO:new Date(z.timestamp).toISOString(),timeSincePrevious:z.timeSincePrevious,visitNumber:ye},buttonStyle:A.iconButton})})]}):O?re(ie,{children:[S(ie.Navigation,{onBack:()=>K(false)}),S(ie.Content,{title:"Filters",testID:"buoy-routes-filters-title"})]}):re(ie,{children:[o&&S(ie.Navigation,{onBack:o}),S(ie.Content,{title:"",noMargin:true,children:S(Pr,{tabs:[{key:"routes",label:m?"Routes":"Screens"},{key:"events",label:`Events${k.length>0&&I!=="events"?` (${k.length})`:""}`},{key:"stack",label:"Stack"}],activeTab:I,onTabChange:g=>mo(g),testIDPrefix:"buoy-routes-tab"})}),re(ie.Actions,{children:[I==="stack"&&S(nt,{value:ae,buttonStyle:A.iconButton,testID:"buoy-routes-stack-copy"}),I==="events"&&re(Qa,{children:[S(nt,{value:yo,buttonStyle:A.iconButton,testID:"buoy-routes-copy"}),S(W,{onPress:ne,style:[A.iconButton,E.size>0&&A.activeFilterButton],testID:"buoy-routes-filters",accessibilityRole:"button",accessibilityLabel:E.size>0?`Route filters, ${E.size} active`:"Route filters",children:S(Fr,{size:14,color:E.size>0?M.color.accent:M.color.textSecondary})}),S(Nr,{isEnabled:R,onToggle:X,accessibilityLabel:"Toggle route event monitoring",testID:"buoy-routes-power"}),S(W,{onPress:Pe,style:A.iconButton,testID:"buoy-routes-clear",accessibilityRole:"button",accessibilityLabel:"Clear route events",children:S($r,{size:14,color:M.color.danger})})]})]})]}),bo=g=>{if(g.type==="layout"||g.type==="group")return;let B=g.type==="index"||g.path==="/";if(!N&&!B){$(true);return}n?.onNavigateRoute?.(g)},Rt=S(Ar,{visible:T,onClose:()=>$(false),featureName:"Route Event Management"});return i?re(Ft,{children:[re(c,{style:A.inlineRoot,children:[S(c,{style:A.inlineHeader,...kr,children:Tt}),Ct(),rt]}),Rt]}):S(Ft,{children:re(Er,{visible:e,onClose:t,onMinimize:r,persistenceKey:fo,header:{showToggleButton:true,customContent:Tt},onModeChange:b,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:true,styles:{},footer:rt,footerHeight:rt?68:0,children:[Ct(),Rt]})})}function en(e={}){return S(ft,{...e,inline:true,visible:true,onClose:()=>{}})}var A=ve.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:Wr.border,backgroundColor:"transparent"},iconButton:{padding:6,borderRadius:6,backgroundColor:M.color.buttonSurface},activeFilterButton:{backgroundColor:M.color.accentSoft},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:M.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:Ge,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:M.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:Ge},contentWrapper:{flex:1},statsContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:M.color.surface,borderBottomWidth:1,borderBottomColor:M.color.border},statsText:{fontSize:11,color:M.color.textSecondary,fontFamily:Ge,textAlign:"center"},statsWarning:{color:M.color.warning,fontWeight:"600"},searchContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:"transparent"},lockedEventsBanner:{flexDirection:"row",alignItems:"center",gap:8,backgroundColor:M.color.warningSoft,borderWidth:1,borderColor:M.color.warning+"30",borderRadius:8,paddingVertical:10,paddingHorizontal:14,marginHorizontal:16,marginBottom:8},lockedEventsBannerText:{fontSize:12,fontWeight:"600",color:M.color.warning,fontFamily:Ge},lockedEventsBannerSubtext:{fontSize:11,color:M.color.textSecondary,marginLeft:"auto"}});import{createToolFactory as tn,defineToolPreset as on}from"@buoy-gg/shared-ui/web";import{jsx as rn}from"react/jsx-runtime";var ro=on({id:"route-events",name:"ROUTES",description:"Route tracking & navigation inspector",slot:"both",icon:({size:e})=>rn(Ro,{size:e}),component:ft,props:{enableSharedModalDimensions:false}}),an=tn(ro,e=>({enableSharedModalDimensions:e.enableSharedModalDimensions??false}));import{useEffect as nn}from"react";import{browserRouter as ao,getBrowserHref as sn,getBrowserRouteURL as no,subscribeBrowserNavigation as ln}from"@buoy-gg/shared-ui/web/utils";var io=0,bt;function cn(){if(typeof window>"u")return()=>{};if(io++===0){he.hydrateBootCapture();let t,o,r="",a=[],i=-1,n=s=>{if(s.href===r&&s.kind==="pop")return;if(s.kind==="replace"&&i>=0)a[i]=s.href;else if(s.kind==="pop"){let v=a.lastIndexOf(s.href,i-1),T=a.indexOf(s.href,i+1);v>=0?i=v:T>=0?i=T:(a.splice(i+1),a.push(s.href),i++)}else a.splice(i+1),a.push(s.href),i++;r=s.href;let m=no(s.href),I=Date.now();Fe.emit({pathname:m.pathname,params:Object.fromEntries(m.searchParams),segments:m.pathname.split("/").filter(Boolean),previousPathname:t,timestamp:I,timeSincePrevious:o===void 0?void 0:I-o}),t=m.pathname,o=I,Q.setStack(a.map((v,T)=>{let $=no(v);return{key:`browser:${T}`,name:$.pathname,pathname:$.pathname,params:Object.fromEntries($.searchParams),index:T,isFocused:T===i,canPop:T>0}}))},u=s=>{if(!Number.isInteger(s)||s<0||s>=a.length)throw new Error("That browser history entry is unavailable.");window.history.go(s-i)};Q.setActions({navigateToIndex:u,popToIndex:u,goBack:ao.back,popToTop:()=>u(0),navigateToRoute:(s,m)=>(ao.push({pathname:s,params:m}),true)}),bt=ln(n),n({href:sn(),kind:"initial"})}let e=false;return()=>{e||(e=true,--io===0&&(bt?.(),bt=void 0,Q.setActions(null)))}}function un(){return nn(cn,[]),null}import{useEffect as so,useRef as vt}from"react";import{useSafePathname as dn,useSafeSegments as pn,useSafeGlobalSearchParams as mn}from"@buoy-gg/shared-ui/web";function hn(e){let t=dn(),o=pn(),r=mn(),a=vt(e),i=vt(void 0),n=vt(void 0);so(()=>{a.current=e},[e]),so(()=>{let u=Date.now(),s=n.current?u-n.current:void 0,m={pathname:t,params:r,segments:o,timestamp:u,previousPathname:i.current,timeSincePrevious:s};i.current=t,n.current=u,Fe.emit(m),a.current&&a.current(m)},[t,o,r])}import{useEffect as lo,useRef as xt}from"react";function co(e){if(!e||!e.routes||e.routes.length===0)return{route:null,segments:[]};let t=e.routes[e.index??0],o=[t.name];if(t.state){let r=co(t.state);if(r.route)return{route:r.route,segments:[...o,...r.segments]}}return{route:t,segments:o}}function uo(e,t,o,r){if(!e)return;let{route:a,segments:i}=co(e);if(!a)return;let n=`/${a.name}`;if(n===t.current)return;let u=Date.now(),s=o.current?u-o.current:void 0,m={pathname:n,params:a.params||{},segments:i,timestamp:u,previousPathname:t.current,timeSincePrevious:s};t.current=n,o.current=u,Fe.emit(m),r.current&&r.current(m)}function gn(e){let t=void 0,o=xt(e),r=xt(void 0),a=xt(void 0);lo(()=>{o.current=e},[e]),lo(()=>{if(!t)return;let i=t.getRootState?.();i&&uo(i,r,a,o);let n=t.addListener?.("state",()=>{let u=t.getRootState?.();uo(u,r,a,o)});return()=>{n?.()}},[t])}import{getSafeRouter as yn}from"@buoy-gg/shared-ui/web";function fn(e,t){let o=[],r=false,a=u=>{for(let s of u??[])(s.name?.includes("+not-found")||s.path?.includes("+not-found"))&&(r=true),typeof s.path=="string"&&o.push(s.path),a(s.children)};if(a(t),r||o.length===0)return;let i=u=>"/"+u.split("?")[0].split("#")[0].split("/").filter(s=>s&&!/^\(.*\)$/.test(s)).join("/"),n=i(e);return o.some(u=>{let s=i(u);return s===n?true:new RegExp("^"+s.split("/").map(m=>/^\[\.\.\..+\]$/.test(m)?".+":/^\[.+\]$/.test(m)?"[^/]+":m.replace(/[.*+?^${}()|\\]/g,"\\$&")).join("/")+"$").test(n)})}import{isOverWireBudget as bn}from"@buoy-gg/shared-ui/web";var vn=16*1024,xn=Object.freeze({__buoyOmitted:"route-params",note:"Navigation params stay on the device."});function St(e){return e==null?false:bn(e,vn)}function Oe(e){return St(e)?xn:e}function Sn(e){return St(e.params)?{...e,params:Oe(e.params)}:e}function Cn(e){return St(e.params)?{...e,params:Oe(e.params)}:e}function po(){let e=pt();return{routes:ge.parseRouteTree(We()),source:e.source,lastUpdatedAt:e.lastLoadedAt}}var Tn={version:3,getSnapshot:()=>({events:he.getEvents().map(Sn),sitemap:po(),stack:Q.getStack().map(Cn)}),subscribe:e=>{let t=he.subscribeToEvents(e),o=Q.subscribe(e),r=null;if(!We()){let a=0,i=100,n=()=>{if(a+=1,We()){r=null,e();return}r=a<i?setTimeout(n,100):null};r=setTimeout(n,100)}return()=>{t(),o(),r&&clearTimeout(r)}},actions:{clearEvents:()=>{he.clearEvents()},getCurrentRoute:()=>{let e=he.getEvents()[0];if(e&&he.isCapturing())return{path:e.pathname,params:Oe(e.params),at:e.timestamp,source:"event"};let t=Q.getStack(),o=t.find(r=>r.isFocused)??t[t.length-1];return o?.pathname?{path:o.pathname,params:Oe(o.params??{}),at:null,source:"stack"}:e?{path:e.pathname,params:Oe(e.params),at:e.timestamp,source:"event",stale:true}:{path:null,params:{},at:null,source:null}},navigate:e=>{let t=e,o=t?.path;if(!o)throw new Error("navigate requires a 'path' param");let r=yn();if(!r){let i=Q.getActions(),n=o.replace(/^\//,"");if(!i?.navigateToRoute||!n)throw new Error("expo-router is not available here and no navigation container was captured \u2014 is <RouteTracker /> mounted inside your NavigationContainer?");if(!i.navigateToRoute(n,t?.params))throw new Error(`Could not navigate to "${n}" \u2014 no navigation container is live.`);return{navigated:o,replaced:false,via:"react-navigation"}}let a=[];try{a=po().routes}catch{a=[]}if(fn(o,a)===false)throw new Error(`No screen matches "${o}". Navigating there would open expo-router's "Unmatched Route" page, which replaces the app's layout (and disconnects Buoy). Read the sitemap for the paths this app has.`);if(t?.reset===true){try{r.canDismiss?.()&&r.dismissAll?.()}catch{}return r.navigate(o),{navigated:o,replaced:false,reset:true}}return(t?.replace===true&&typeof r.replace=="function"?r.replace:r.navigate)(o),{navigated:o,replaced:t?.replace===true}},stackNavigateToIndex:e=>{let t=e?.index;if(typeof t!="number")throw new Error("stackNavigateToIndex requires a numeric 'index'");let o=Q.getActions();if(!o)throw new Error("navigation stack is not available");return o.navigateToIndex(t),{navigatedToIndex:t}},stackPopToIndex:e=>{let t=e?.index;if(typeof t!="number")throw new Error("stackPopToIndex requires a numeric 'index'");let o=Q.getActions();if(!o)throw new Error("navigation stack is not available");return o.popToIndex(t),{poppedToIndex:t}},stackGoBack:()=>{let e=Q.getActions();if(!e)throw new Error("navigation stack is not available");return e.goBack(),{wentBack:true}},stackPopToTop:()=>{let e=Q.getActions();if(!e)throw new Error("navigation stack is not available");return e.popToTop(),{poppedToTop:true}}}};export{qt as NavigationStack,jt as RouteEventDetail,lt as RouteEventExpandedContent,eo as RouteEventItemCompact,ft as RouteEventsModalWithTabs,zt as RouteObserver,ge as RouteParser,un as RouteTracker,ht as RoutesSitemap,en as RoutesToolView,an as createRouteEventsTool,Q as navigationStackStore,ma as registerBrowserRoutes,he as routeEventStore,Tn as routeEventsSyncAdapter,ro as routeEventsToolPreset,Fe as routeObserver,Qt as useNavigationStack,fa as useParentRoutes,ya as useRoute,At as useRouteEvents,hn as useRouteObserver,gn as useRouteObserverReactNavigation,Je as useRouteSitemap};
|
|
6
|
+
${F}`))&&ce();return}J.alert(v,F,[{text:"Cancel",style:"cancel"},{text:U,style:"destructive",onPress:ce}])},A=()=>{if(!K){E(true);return}if(S){J.alert("Cannot Go Back","Already at the root of the stack");return}$()},Te=()=>{if(!K){E(true);return}if(S){J.alert("Already at Top","Stack only has one screen");return}Q("Pop to Top","This will remove all screens except the root screen.","Pop to Top",D)},fe=v=>{R(w===v?null:v)},xe=()=>{if(!K){E(true);return}if(k){if(k.isFocused){J.alert("Already There","This route is already visible");return}L(k.index)}},le=()=>{if(!K){E(true);return}if(!k)return;if(k.isFocused){J.alert("Cannot Pop","Selected route is already visible");return}if(k.index===p-1){J.alert("Cannot Pop","No screens above selected route");return}let v=p-1-k.index,F=k.index;Q("Pop to Route",`Remove ${v} screen${v!==1?"s":""} above ${k.pathname}?`,"Pop",()=>H(F))};return re(c,{style:[f.container,e],children:[I(Ue,{testID:"buoy-routes-stack-scroll",style:f.stackScroll,contentContainerStyle:[f.stackContent,{paddingBottom:f.stackContent.padding+n.bottom}],children:[...u].reverse().map((v,F)=>{let U=u.length-1-F,ce=w===U,x=Object.keys(v.params).length>0,B=Ca(U);return I(c,{style:f.stackItemWrapper,testID:B,children:re(c,{style:[f.stackItem,ce&&f.stackItemSelected],children:[re(V,{style:f.stackItemHeader,onPress:()=>fe(U),activeOpacity:.7,testID:`${B}-toggle`,accessibilityRole:"button",accessibilityLabel:`${v.pathname}, ${v.isFocused?"focused":"mounted"}, position ${U} of ${p-1}`,children:[I(c,{style:f.expandIndicator,children:ce?I(ka,{size:14,color:O.color.textSecondary}):I(Ba,{size:14,color:O.color.textSecondary})}),I(h,{style:f.stackItemPath,numberOfLines:1,testID:`${B}-path`,children:v.pathname}),I(Da,{value:v.pathname,buttonStyle:f.copyRouteButton,testID:`${B}-copy`}),I(c,{style:[f.statusBadge,{backgroundColor:v.isFocused?`${Xe.success}15`:"#3B82F615",borderColor:v.isFocused?`${Xe.success}40`:"#3B82F640"}],children:I(h,{style:[f.statusBadgeText,{color:v.isFocused?Xe.success:"#3B82F6"}],testID:`${B}-status`,children:v.isFocused?"FOCUSED":"MOUNTED"})})]}),ce&&re(c,{style:f.expandedContent,children:[re(c,{style:f.detailRow,children:[I(h,{style:f.detailLabel,children:"Route Name:"}),I(h,{style:f.detailValue,testID:`${B}-name`,children:v.name})]}),re(c,{style:f.detailRow,children:[I(h,{style:f.detailLabel,children:"Position:"}),re(h,{style:f.detailValue,testID:`${B}-position`,children:[U," / ",p-1]})]}),x&&I(c,{style:f.dataViewerContainer,children:I(Fa,{title:"Parameters",data:v.params,showTypeFilter:false})}),re(c,{style:f.actionsRow,children:[re(c,{style:f.actionWrapper,children:[I(V,{style:[f.actionButton,S&&f.actionButtonDisabled],onPress:A,disabled:S,testID:`${B}-back`,accessibilityRole:"button",accessibilityLabel:"Go back one screen",children:I(h,{style:[f.actionButtonText,S&&f.actionButtonTextDisabled],children:"Back"})}),I(h,{style:f.helpText,children:"Go back one screen"})]}),re(c,{style:f.actionWrapper,children:[I(V,{style:[f.actionButton,v.isFocused&&f.actionButtonDisabled],onPress:xe,disabled:v.isFocused,testID:`${B}-go`,accessibilityRole:"button",accessibilityLabel:`Navigate to ${v.pathname}`,children:I(h,{style:[f.actionButtonText,v.isFocused&&f.actionButtonTextDisabled],children:"Go"})}),I(h,{style:f.helpText,children:"Navigate to this route"})]}),re(c,{style:f.actionWrapper,children:[I(V,{style:[f.actionButton,(v.isFocused||U===p-1)&&f.actionButtonDisabled],onPress:le,disabled:v.isFocused||U===p-1,testID:`${B}-pop-to`,accessibilityRole:"button",accessibilityLabel:`Remove screens above ${v.pathname}`,children:I(h,{style:[f.actionButtonText,(v.isFocused||U===p-1)&&f.actionButtonTextDisabled],children:"Pop To"})}),I(h,{style:f.helpText,children:"Remove screens above this"})]})]})]})]})},`stack-${U}-${v.key}`)})}),I(Ea,{visible:te,onClose:()=>E(false),featureName:"Stack Navigation"})]})}var f=ve.create({container:{flex:1,backgroundColor:"transparent"},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},loadingText:{color:O.color.textSecondary,fontSize:14,fontFamily:se},errorContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},errorText:{color:Xe.error,fontSize:16,fontWeight:"600",fontFamily:se,marginBottom:8},errorDetail:{color:O.color.textSecondary,fontSize:12,fontFamily:se,textAlign:"center"},emptyContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyText:{color:O.color.text,fontSize:16,fontWeight:"600",fontFamily:se,marginBottom:8},emptySubtext:{color:O.color.textSecondary,fontSize:14,fontFamily:se,textAlign:"center"},stackScroll:{flex:1},stackContent:{padding:8},stackItemWrapper:{marginBottom:6},stackItem:{backgroundColor:O.color.surface,borderRadius:6,borderWidth:1,borderColor:O.color.border,overflow:"hidden"},stackItemSelected:{borderColor:O.color.accent,borderWidth:2},stackItemHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:12,gap:8},expandIndicator:{width:20,alignItems:"center"},stackItemPath:{fontSize:13,fontWeight:"600",color:O.color.text,fontFamily:se,flex:1},copyRouteButton:{padding:4,marginLeft:4},statusBadge:{borderRadius:4,paddingHorizontal:6,paddingVertical:2,borderWidth:1},statusBadgeText:{fontSize:10,fontWeight:"600",fontFamily:se},expandedContent:{paddingHorizontal:12,paddingTop:8,paddingBottom:12,borderTopWidth:1,borderTopColor:O.color.border},detailRow:{marginBottom:8},detailLabel:{fontSize:10,color:O.color.textSecondary,fontFamily:se,marginBottom:2},detailValue:{fontSize:12,color:O.color.text,fontFamily:se},dataViewerContainer:{marginTop:4,marginHorizontal:-12,marginBottom:8},actionsRow:{flexDirection:"row",gap:6,marginTop:12},actionWrapper:{flex:1},actionButton:{backgroundColor:O.color.surfaceElevated,paddingVertical:8,paddingHorizontal:8,borderRadius:6,alignItems:"center"},actionButtonDisabled:{opacity:.5},actionButtonText:{fontSize:12,fontWeight:"600",color:O.color.text,fontFamily:se},actionButtonTextDisabled:{color:O.color.textTertiary},helpText:{fontSize:9,color:O.color.textSecondary,fontFamily:se,textAlign:"center",marginTop:4,lineHeight:12}});import{useCallback as Wa}from"react";import{Navigation as ja,night as yt,EVENT_LIST_PRESET as Va,monoFont as Zt}from"@buoy-gg/shared-ui/web";import{memo as Oa,useMemo as de}from"react";import{CompactRow as Ha,RelativeTime as Ma,buoyColors as eo,night as Ye,monoFont as to}from"@buoy-gg/shared-ui/web";import{jsx as je}from"react/jsx-runtime";function Ua(e){return e.pathname==="/"?"home":ut(e.pathname,e.segments)?"dynamic":e.params&&Object.keys(e.params).length>0?"with-params":"default"}function Ga(e){switch(e){case"home":return eo.success;case"dynamic":return Ye.color.accent;case"with-params":return eo.warning;default:return Ye.color.textSecondary}}function _a(e){switch(e){case"home":return"Home";case"dynamic":return"Dynamic";case"with-params":return"Params";default:return"Static"}}function Ka(e){if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/6e4),o=Math.floor(e%6e4/1e3);return o>0?`${t}m ${o}s`:`${t}m`}function Qa(e){let t=[];e.timeSincePrevious!==void 0&&e.timeSincePrevious>0&&t.push(Ka(e.timeSincePrevious));let o=e.segments?.length||0;return o>0&&t.push(`depth ${o}`),t.join(" \xB7 ")||"root"}function Ja(e){if(e.params&&Object.keys(e.params).length>0){let t=Object.keys(e.params).length;return`${t} PARAM${t!==1?"S":""}`}}var oo=Oa(function({event:e,visitNumber:t,isExpanded:o,onPress:r,onNavigate:a,index:i}){let n=de(()=>Ua(e),[e]),u=de(()=>ut(e.pathname,e.segments),[e.pathname,e.segments]),l=de(()=>Ga(n),[n]),g=de(()=>_a(n),[n]),d=de(()=>Qa(e),[e]),p=de(()=>Ja(e),[e]),S=de(()=>Sa(e.pathname,t),[e.pathname,t]),L=de(()=>`${e.pathname}, ${g}, ${d}`,[e.pathname,g,d]),H=de(()=>{if(o)return je(ct,{event:e,visitNumber:t,routeTemplate:u})},[o,e,t,u]),$=de(()=>{if(a)return je(V,{style:ro.goButton,onPress:()=>a(Wt(e.pathname,e.params)),testID:`${S}-go`,accessibilityRole:"button",accessibilityLabel:`Go to ${e.pathname}`,children:je(h,{style:ro.goButtonText,children:"Go"})})},[a,e.pathname,S]);return je(Ha,{statusDotColor:l,statusLabel:g,statusSublabel:d,primaryText:e.pathname,badgeText:p,badgeColor:l,trailingAction:$,bottomRightText:je(Ma,{timestamp:e.timestamp}),showChevron:true,expandedContent:H,isExpanded:o,expandedGlowColor:l,onPress:()=>r(i),testID:S,statusTestID:`${S}-status`,statusSublabelTestID:`${S}-sublabel`,accessibilityLabel:L})}),ro=ve.create({badgeText:{fontSize:11,fontWeight:"600",fontFamily:to},goButton:{backgroundColor:Ye.color.accent,paddingHorizontal:8,paddingVertical:4,borderRadius:4},goButtonText:{fontSize:10,fontWeight:"600",color:Ye.color.onAccent,fontFamily:to}});import{jsx as Ve,jsxs as qa}from"react/jsx-runtime";function Xa({events:e,visitCounts:t,onNavigate:o,onSelectEvent:r}){let a=Wa(i=>{let n=e[i];n&&r(n,t.get(n)||1)},[e,t,r]);return e.length===0?qa(c,{style:Ze.emptyState,testID:"buoy-routes-empty",children:[Ve(ja,{size:48,color:yt.color.textTertiary}),Ve(h,{style:Ze.emptyTitle,testID:"buoy-routes-empty-title",children:"No events yet"}),Ve(h,{style:Ze.emptySubtitle,testID:"buoy-routes-empty-subtitle",children:"Navigation events will appear here"})]}):Ve(Lt,{testID:"buoy-routes-timeline",contentContainerStyle:Ze.listContent,data:e,keyExtractor:i=>`${i.timestamp}-${i.pathname}`,renderItem:({item:i,index:n})=>Ve(oo,{event:i,visitNumber:t.get(i)||1,isExpanded:false,index:n,onPress:a,onNavigate:o}),showsVerticalScrollIndicator:true,...Va})}var Ze=ve.create({listContent:{paddingVertical:8},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:yt.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:Zt,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:yt.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:Zt}});import{Fragment as Ya,jsx as C,jsxs as ae}from"react/jsx-runtime";var bt=Rr(),Za={parse:e=>e==="routes"||e==="events"||e==="stack"?e:void 0,serialize:e=>e},en={parse:e=>e==="true",serialize:e=>e.toString()},tn={parse:e=>new Set(JSON.parse(e)),serialize:e=>JSON.stringify(Array.from(e))};function ao(e,t){if(!e||!e.routes)return null;for(let o of e.routes){if(o.name===t)return[o.name];if(o.state){let r=ao(o.state,t);if(r)return[o.name,...r]}}return null}function on(e,t){if(e.length===0)return null;let o=t&&Object.keys(t).length>0?t:void 0;if(e.length===1)return bt.navigate(o?{name:e[0],params:o}:{name:e[0]});let r=o?{screen:e[e.length-1],params:o}:{screen:e[e.length-1]};for(let a=e.length-2;a>=1;a--)r={screen:e[a],params:r};return bt.navigate({name:e[0],params:r})}function vt({visible:e,onClose:t,onBack:o,onMinimize:r,enableSharedModalDimensions:a=false,inline:i=false,remote:n}){let u=kr(),l=void 0,g=at.OS==="web"||Br(),[d,p]=nt($e.routeEvents.activeTab(),"events",Za),[S,L]=Ie(false),[H,$]=Ie(""),D=Hr(),w=Or("routeEvents.entries");Et(()=>{S&&D&&L(false)},[S,D]);let[R,te]=nt($e.routeEvents.isMonitoring(),true,en),{events:E,clearEvents:K,isListening:pe}=At({enabled:R}),k=R&&pe;Et(()=>{he.setBootCapture(R)},[R]);let[M,Q]=Ie(false),[A,Te]=Ie(null),[fe,xe]=Ie(1),[le,v]=Ie(""),[F,U]=nt($e.routeEvents.eventFilters(),new Set(["/_sitemap","/api","/__dev"]),tn),ce=ko(null),x=ue(y=>{},[]),B=ue(y=>{try{if(n){if(!n.onNavigatePath)return;if(!D&&y!=="/"){L(true);return}n.onNavigatePath(y);return}if(g)u.push(y);else if(l){let{pathname:P,params:X}=Yr(y),me=P.startsWith("/")?P.slice(1):P,Ce=Object.keys(X).length>0,we=l.getRootState?.();if(we){let Me=ao(we,me);if(Me){let kt=on(Me,X);if(kt){l.dispatch(kt);return}}}l.dispatch(bt.navigate(Ce?{name:me,params:X}:{name:me}))}else J.alert("Navigation Unavailable","No Expo Router or React Navigation container was found in this app.")}catch(P){J.alert("Navigation Error",String(P))}},[u,l,g,n,D]),Z=ue(()=>{te(y=>!y)},[]),Pe=ue(()=>{if(E.length!==0){if(!D){L(true);return}K()}},[E.length,D,K]),Le=ue(y=>{U(P=>{let X=new Set(P);return X.has(y)?X.delete(y):X.add(y),X})},[]),et=ue(y=>{U(P=>new Set([...P,y]))},[]),ne=ue(()=>{Q(!M)},[M]),ye=ue((y,P)=>{Te(y),xe(P)},[]),He=ue(()=>{Te(null)},[]),go=ue(y=>{Te(null),p(y)},[]),fo=Re(()=>{let y=new Set;return E.forEach(P=>{P.pathname&&y.add(P.pathname)}),Array.from(y).sort()},[E]),be=Re(()=>E.filter(y=>{if(!y.pathname||Array.from(F).some(P=>y.pathname.includes(P)))return false;if(le.trim()){let P=le.toLowerCase(),X=y.pathname.toLowerCase().includes(P),me=Object.entries(y.params||{}).some(([Ce,we])=>{let Me=Array.isArray(we)?we.join(" "):we;return Ce.toLowerCase().includes(P)||Me.toLowerCase().includes(P)});return X||me}return true}),[E,F,le]),yo=Re(()=>be.slice(0,w),[be,w]),tt=Re(()=>Math.max(0,be.length-w),[be.length,w]),ot=Re(()=>{let y=new Map,P=new Map;for(let X=E.length-1;X>=0;X--){let me=E[X],Ce=(y.get(me.pathname)||0)+1;y.set(me.pathname,Ce),P.set(me,Ce)}return P},[E]),bo=Re(()=>({summary:{total:E.length,filtered:be.length,listening:k,ignoredPatterns:Array.from(F),timestamp:new Date().toISOString()},events:be.map((y,P)=>({index:P,visitNumber:ot.get(y)||1,pathname:y.pathname,timestamp:y.timestamp,timestampRelative:Fr(y.timestamp),params:y.params,segments:y.segments,previousPathname:y.previousPathname,timeSincePrevious:y.timeSincePrevious}))}),[E.length,be,k,F,ot]);if(!e)return null;let vo=a?$e.modal.root():$e.routeEvents.modal(),rt=null,wt=()=>{if(A)return C(Vt,{event:A,visitNumber:fe,onNavigate:B});if(d==="routes")return g||n?.sitemap?C(ft,{style:j.contentWrapper,injectedRoutes:n?.sitemap?.routes,injectedSource:n?.sitemap?.source??null,injectedLastUpdatedAt:n?.sitemap?.lastUpdatedAt??null,onNavigateRoute:n?xo:void 0}):C(ft,{style:j.contentWrapper});if(d==="stack")return C(Yt,{style:j.contentWrapper,injectedStack:n?n.stack??[]:void 0,onAction:n?.onStackAction,onCopyValueChange:$});if(M)return C(ta,{ignoredPatterns:F,onTogglePattern:Le,onAddPattern:et,availablePathnames:fo});let y=E.length>0;return be.length===0?ae(c,{style:j.contentWrapper,testID:"buoy-routes-events",children:[y&&C(c,{style:j.searchContainer,testID:"buoy-routes-search-field",children:C(Ft,{value:le,onChange:v,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),C(Er,{testID:"buoy-routes-empty",...Pr({subject:"route events",search:le,total:E.length,capturing:k,waiting:{otto:"walking",title:"No route events yet",message:"Navigation events will appear here"},paused:{title:"Event listener is paused",message:"Press play to start monitoring"}})})]}):ae(c,{style:j.contentWrapper,testID:"buoy-routes-events",children:[C(c,{style:j.searchContainer,testID:"buoy-routes-search-field",children:C(Ft,{value:le,onChange:v,placeholder:"Search pathname or params...",testID:"buoy-routes-search"})}),tt>0&&ae(c,{style:j.lockedEventsBanner,testID:"buoy-routes-locked-banner",children:[C(Ar,{size:14,color:G.color.warning}),ae(h,{style:j.lockedEventsBannerText,testID:"buoy-routes-locked-banner-text",children:[tt," older ",tt===1?"event":"events"," locked"]}),C(h,{style:j.lockedEventsBannerSubtext,children:"Upgrade to Pro for full history"})]}),C(Xa,{events:yo,visitCounts:ot,onNavigate:B,onSelectEvent:ye})]})},It=A?ae(ie,{children:[C(ie.Navigation,{onBack:He}),C(ie.Content,{title:A.pathname,testID:"buoy-routes-detail-title"}),C(ie.Actions,{children:C(it,{testID:"buoy-routes-detail-copy",value:{pathname:A.pathname,previousPathname:A.previousPathname,params:A.params,segments:A.segments,timestamp:A.timestamp,timestampISO:new Date(A.timestamp).toISOString(),timeSincePrevious:A.timeSincePrevious,visitNumber:fe},buttonStyle:j.iconButton})})]}):M?ae(ie,{children:[C(ie.Navigation,{onBack:()=>Q(false)}),C(ie.Content,{title:"Filters",testID:"buoy-routes-filters-title"})]}):ae(ie,{children:[o&&C(ie.Navigation,{onBack:o}),C(ie.Content,{title:"",noMargin:true,children:C($r,{tabs:[{key:"routes",label:g?"Routes":"Screens"},{key:"events",label:`Events${E.length>0&&d!=="events"?` (${E.length})`:""}`},{key:"stack",label:"Stack"}],activeTab:d,onTabChange:y=>go(y),testIDPrefix:"buoy-routes-tab"})}),ae(ie.Actions,{children:[d==="stack"&&C(it,{value:H,buttonStyle:j.iconButton,testID:"buoy-routes-stack-copy"}),d==="events"&&ae(Ya,{children:[C(it,{value:bo,buttonStyle:j.iconButton,testID:"buoy-routes-copy"}),C(V,{onPress:ne,style:[j.iconButton,F.size>0&&j.activeFilterButton],testID:"buoy-routes-filters",accessibilityRole:"button",accessibilityLabel:F.size>0?`Route filters, ${F.size} active`:"Route filters",children:C(Nr,{size:14,color:F.size>0?G.color.accent:G.color.textSecondary})}),C(jr,{isEnabled:k,onToggle:Z,accessibilityLabel:"Toggle route event monitoring",testID:"buoy-routes-power"}),C(V,{onPress:Pe,style:j.iconButton,testID:"buoy-routes-clear",accessibilityRole:"button",accessibilityLabel:"Clear route events",children:C(zr,{size:14,color:G.color.danger})})]})]})]}),xo=y=>{if(y.type==="layout"||y.type==="group")return;let P=y.type==="index"||y.path==="/";if(!D&&!P){L(true);return}n?.onNavigateRoute?.(y)},Rt=C(Wr,{visible:S,onClose:()=>L(false),featureName:"Route Event Management"});return i?ae(zt,{children:[ae(c,{style:j.inlineRoot,children:[C(c,{style:j.inlineHeader,...Dr,children:It}),wt(),rt]}),Rt]}):C(zt,{children:ae(Lr,{visible:e,onClose:t,onMinimize:r,persistenceKey:vo,header:{showToggleButton:true,customContent:It},onModeChange:x,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:true,styles:{},footer:rt,footerHeight:rt?68:0,children:[wt(),Rt]})})}function rn(e={}){return C(vt,{...e,inline:true,visible:true,onClose:()=>{}})}var j=ve.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:Vr.border,backgroundColor:"transparent"},iconButton:{padding:6,borderRadius:6,backgroundColor:G.color.buttonSurface},activeFilterButton:{backgroundColor:G.color.accentSoft},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:G.color.text,fontSize:16,fontWeight:"600",marginTop:16,marginBottom:8,fontFamily:Ge,letterSpacing:.5,textTransform:"uppercase"},emptySubtitle:{color:G.color.textSecondary,fontSize:14,textAlign:"center",fontFamily:Ge},contentWrapper:{flex:1},statsContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:G.color.surface,borderBottomWidth:1,borderBottomColor:G.color.border},statsText:{fontSize:11,color:G.color.textSecondary,fontFamily:Ge,textAlign:"center"},statsWarning:{color:G.color.warning,fontWeight:"600"},searchContainer:{paddingHorizontal:16,paddingVertical:8,backgroundColor:"transparent"},lockedEventsBanner:{flexDirection:"row",alignItems:"center",gap:8,backgroundColor:G.color.warningSoft,borderWidth:1,borderColor:G.color.warning+"30",borderRadius:8,paddingVertical:10,paddingHorizontal:14,marginHorizontal:16,marginBottom:8},lockedEventsBannerText:{fontSize:12,fontWeight:"600",color:G.color.warning,fontFamily:Ge},lockedEventsBannerSubtext:{fontSize:11,color:G.color.textSecondary,marginLeft:"auto"}});import{createToolFactory as an,defineToolPreset as nn}from"@buoy-gg/shared-ui/web";import{jsx as sn}from"react/jsx-runtime";var no=nn({id:"route-events",name:"ROUTES",description:"Route tracking & navigation inspector",slot:"both",icon:({size:e})=>sn(Ro,{size:e}),component:vt,props:{enableSharedModalDimensions:false}}),ln=an(no,e=>({enableSharedModalDimensions:e.enableSharedModalDimensions??false}));import{useEffect as cn}from"react";import{browserRouter as io,getBrowserHref as un,getBrowserRouteURL as so,subscribeBrowserNavigation as dn}from"@buoy-gg/shared-ui/web/utils";var lo=0,xt;function pn(){if(typeof window>"u")return()=>{};if(lo++===0){he.hydrateBootCapture();let t,o,r="",a=[],i=-1,n=()=>{let d=window.history.state;if(!d||typeof d!="object")return;let p=d.key??d.__TSR_key;return typeof p=="string"||typeof p=="number"?String(p):void 0},u=d=>{for(let p=i-1;p>=0;p--)if(a[p].href===d)return p;for(let p=i+1;p<a.length;p++)if(a[p].href===d)return p;return-1},l=d=>{let p=n();if(d.href===r&&d.kind==="pop"&&(p===void 0||a[i]?.key===p))return;if(d.kind==="replace"&&i>=0)a[i]={href:d.href,key:p};else if(d.kind==="pop"){let $=p===void 0?-1:a.findIndex(w=>w.key===p),D=$>=0?$:u(d.href);D>=0?i=D:(a.splice(i+1),a.push({href:d.href,key:p}),i++)}else a.splice(i+1),a.push({href:d.href,key:p}),i++;r=d.href;let S=so(d.href),L=Date.now(),H=_t(S.pathname);Fe.emit({pathname:S.pathname,params:{...H.params,...Object.fromEntries(S.searchParams)},segments:H.segments,previousPathname:t,timestamp:L,timeSincePrevious:o===void 0?void 0:L-o}),t=S.pathname,o=L,W.setStack(a.slice(0,i+1).map(({href:$},D)=>{let w=so($),R=_t(w.pathname);return{key:`browser:${D}`,name:R.segments.join("/")||"index",pathname:w.pathname,params:{...R.params,...Object.fromEntries(w.searchParams)},index:D,isFocused:D===i,canPop:D>0}}))},g=d=>{if(!Number.isInteger(d)||d<0||d>=a.length)throw new Error("That browser history entry is unavailable.");window.history.go(d-i)};W.setActions({navigateToIndex:g,popToIndex:g,goBack:io.back,popToTop:()=>g(0),navigateToRoute:(d,p)=>{let S={...p},L=`/${d.replace(/^\//,"")}`.replace(/\[(\.\.\.)?([^\]]+)\]/g,(H,$,D)=>{if(!(D in S))return H;let w=S[D];return delete S[D],$&&Array.isArray(w)?w.map(R=>encodeURIComponent(String(R))).join("/"):encodeURIComponent(String(w))});return io.push({pathname:L==="/index"?"/":L,params:S}),true}}),xt=dn(l),l({href:un(),kind:"initial"})}let e=false;return()=>{e||(e=true,--lo===0&&(xt?.(),xt=void 0,W.setActions(null)))}}function mn(){return cn(pn,[]),null}import{useEffect as co,useRef as St}from"react";import{useSafePathname as hn,useSafeSegments as gn,useSafeGlobalSearchParams as fn}from"@buoy-gg/shared-ui/web";function yn(e){let t=hn(),o=gn(),r=fn(),a=St(e),i=St(void 0),n=St(void 0);co(()=>{a.current=e},[e]),co(()=>{let u=Date.now(),l=n.current?u-n.current:void 0,g={pathname:t,params:r,segments:o,timestamp:u,previousPathname:i.current,timeSincePrevious:l};i.current=t,n.current=u,Fe.emit(g),a.current&&a.current(g)},[t,o,r])}import{useEffect as uo,useRef as Tt}from"react";function po(e){if(!e||!e.routes||e.routes.length===0)return{route:null,segments:[]};let t=e.routes[e.index??0],o=[t.name];if(t.state){let r=po(t.state);if(r.route)return{route:r.route,segments:[...o,...r.segments]}}return{route:t,segments:o}}function mo(e,t,o,r){if(!e)return;let{route:a,segments:i}=po(e);if(!a)return;let n=`/${a.name}`;if(n===t.current)return;let u=Date.now(),l=o.current?u-o.current:void 0,g={pathname:n,params:a.params||{},segments:i,timestamp:u,previousPathname:t.current,timeSincePrevious:l};t.current=n,o.current=u,Fe.emit(g),r.current&&r.current(g)}function bn(e){let t=void 0,o=Tt(e),r=Tt(void 0),a=Tt(void 0);uo(()=>{o.current=e},[e]),uo(()=>{if(!t)return;let i=t.getRootState?.();i&&mo(i,r,a,o);let n=t.addListener?.("state",()=>{let u=t.getRootState?.();mo(u,r,a,o)});return()=>{n?.()}},[t])}import{getSafeRouter as vn}from"@buoy-gg/shared-ui/web";function xn(e,t){let o=[],r=false,a=u=>{for(let l of u??[])(l.name?.includes("+not-found")||l.path?.includes("+not-found"))&&(r=true),typeof l.path=="string"&&o.push(l.path),a(l.children)};if(a(t),r||o.length===0)return;let i=u=>"/"+u.split("?")[0].split("#")[0].split("/").filter(l=>l&&!/^\(.*\)$/.test(l)).join("/"),n=i(e);return o.some(u=>{let l=i(u);return l===n?true:new RegExp("^"+l.split("/").map(g=>/^\[\.\.\..+\]$/.test(g)?".+":/^\[.+\]$/.test(g)?"[^/]+":g.replace(/[.*+?^${}()|\\]/g,"\\$&")).join("/")+"$").test(n)})}import{isOverWireBudget as Sn}from"@buoy-gg/shared-ui/web";async function Tn(e,t){let o=W.getStack().findIndex(a=>a.isFocused),r=W.getActions();if(o<0||!r||typeof e.replace!="function")throw new Error("This app's history isn't captured yet, so Buoy can't start over. Open the Routes tool once, or navigate without reset.");if(o>0){let a=globalThis;await new Promise((i,n)=>{let u=d=>{clearTimeout(g),a.removeEventListener?.("popstate",l),d?i():n(new Error("The app didn't go back to its first page, so nothing was reset. Try again, or navigate without reset."))},l=()=>setTimeout(()=>u(true),0),g=setTimeout(()=>u(false),1500);a.addEventListener?.("popstate",l),r.popToTop()})}if(W.getStack().findIndex(a=>a.isFocused)!==0)throw new Error("The app isn't on its first page, so nothing was reset. Try again, or navigate without reset.");return e.replace(t),{navigated:t,replaced:true,reset:true}}var Cn=16*1024,wn=Object.freeze({__buoyOmitted:"route-params",note:"Navigation params stay on the device."});function Ct(e){return e==null?false:Sn(e,Cn)}function Oe(e){return Ct(e)?wn:e}function In(e){return Ct(e.params)?{...e,params:Oe(e.params)}:e}function Rn(e){return Ct(e.params)?{...e,params:Oe(e.params)}:e}function ho(){let e=ht();return{routes:ge.parseRouteTree(We()),source:e.source,lastUpdatedAt:e.lastLoadedAt}}var kn={version:3,getSnapshot:()=>({events:he.getEvents().map(In),sitemap:ho(),stack:W.getStack().map(Rn)}),subscribe:e=>{let t=he.subscribeToEvents(e),o=W.subscribe(e),r=null;if(!We()){let a=0,i=100,n=()=>{if(a+=1,We()){r=null,e();return}r=a<i?setTimeout(n,100):null};r=setTimeout(n,100)}return()=>{t(),o(),r&&clearTimeout(r)}},actions:{clearEvents:()=>{he.clearEvents()},getCurrentRoute:()=>{let e=he.getEvents()[0];if(e&&he.isCapturing())return{path:e.pathname,params:Oe(e.params),at:e.timestamp,source:"event"};let t=W.getStack(),o=t.find(r=>r.isFocused)??t[t.length-1];return o?.pathname?{path:o.pathname,params:Oe(o.params??{}),at:null,source:"stack"}:e?{path:e.pathname,params:Oe(e.params),at:e.timestamp,source:"event",stale:true}:{path:null,params:{},at:null,source:null}},navigate:e=>{let t=e,o=t?.path;if(!o)throw new Error("navigate requires a 'path' param");let r=vn();if(!r){let i=W.getActions(),n=o.replace(/^\//,"");if(!i?.navigateToRoute||!n)throw new Error("expo-router is not available here and no navigation container was captured \u2014 is <RouteTracker /> mounted inside your NavigationContainer?");if(!i.navigateToRoute(n,t?.params))throw new Error(`Could not navigate to "${n}" \u2014 no navigation container is live.`);return{navigated:o,replaced:false,via:"react-navigation"}}let a=[];try{a=ho().routes}catch{a=[]}if(ba()&&xn(o,a)===false)throw new Error(`No screen matches "${o}". Navigating there would open expo-router's "Unmatched Route" page, which replaces the app's layout (and disconnects Buoy). Read the sitemap for the paths this app has.`);if(t?.reset===true){if(typeof r.canDismiss!="function")return Tn(r,o);try{r.canDismiss()&&r.dismissAll?.()}catch{}return r.navigate(o),{navigated:o,replaced:false,reset:true}}return(t?.replace===true&&typeof r.replace=="function"?r.replace:r.navigate)(o),{navigated:o,replaced:t?.replace===true}},stackNavigateToIndex:e=>{let t=e?.index;if(typeof t!="number")throw new Error("stackNavigateToIndex requires a numeric 'index'");let o=W.getActions();if(!o)throw new Error("navigation stack is not available");return o.navigateToIndex(t),{navigatedToIndex:t}},stackPopToIndex:e=>{let t=e?.index;if(typeof t!="number")throw new Error("stackPopToIndex requires a numeric 'index'");let o=W.getActions();if(!o)throw new Error("navigation stack is not available");return o.popToIndex(t),{poppedToIndex:t}},stackGoBack:()=>{let e=W.getActions();if(!e)throw new Error("navigation stack is not available");return e.goBack(),{wentBack:true}},stackPopToTop:()=>{let e=W.getActions();if(!e)throw new Error("navigation stack is not available");return e.popToTop(),{poppedToTop:true}}}};export{Yt as NavigationStack,Vt as RouteEventDetail,ct as RouteEventExpandedContent,oo as RouteEventItemCompact,vt as RouteEventsModalWithTabs,Nt as RouteObserver,ge as RouteParser,mn as RouteTracker,ft as RoutesSitemap,rn as RoutesToolView,ln as createRouteEventsTool,W as navigationStackStore,fa as registerBrowserRoutes,he as routeEventStore,kn as routeEventsSyncAdapter,no as routeEventsToolPreset,Fe as routeObserver,Xt as useNavigationStack,xa as useParentRoutes,va as useRoute,At as useRouteEvents,yn as useRouteObserver,bn as useRouteObserverReactNavigation,Qe as useRouteSitemap};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/route-events",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.57",
|
|
4
4
|
"description": "Inspect reported navigation state and supported route actions in React Native apps using Expo Router or React Navigation.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
],
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
38
|
-
"@buoy-gg/floating-tools-core": "^7.0.
|
|
37
|
+
"@buoy-gg/shared-ui": "^7.0.57",
|
|
38
|
+
"@buoy-gg/floating-tools-core": "^7.0.57"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@buoy-gg/license": "7.0.
|
|
41
|
+
"@buoy-gg/license": "7.0.57",
|
|
42
42
|
"react": "*"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@types/react-native": "^0.73.0",
|
|
66
66
|
"expo-router": "~5.0.7",
|
|
67
67
|
"typescript": "~5.8.3",
|
|
68
|
-
"@buoy-gg/license": "^7.0.
|
|
68
|
+
"@buoy-gg/license": "^7.0.57"
|
|
69
69
|
},
|
|
70
70
|
"react-native-builder-bob": {
|
|
71
71
|
"source": "src",
|