{"version":3,"sources":["../src/router/utils.ts","../src/router/router.ts","../src/router/dom/Route.tsx","../src/router/dom/Routes.tsx","../src/router/dom/Outlet.tsx","../src/router/dom/Link.tsx"],"names":["parseQuery","search","params","result","value","key","accumulator","part","isUnsafePath","path","createRoutesFromChildren","children","routes","child","childNode","props","component","subChildren","beforeEnter","route","nestedChildren","childChildren","matchRoutes","locationPathname","routePath","matchResult","matchPath","locationPath","routeSegments","locationSegments","i","routeSegment","locationSegment","RouterCtx","Context","RouteDepthCtx","getDefaultLocation","getCurrentLocation","pathname","globalLocation","globalNavigate","popstateListenerAttached","resetRouter","useLocation","reactive","updateLocation","newLocation","useRouter","routerContext","use","useNavigate","navigate","getNavigate","useParams","useQuery","location","Route","_props","isFNode","node","generateRouteKey","match","paramStr","a","b","k","v","Routes","currentLocation","childrenList","routeNodes","firstRouteIndex","beforeRouteChildren","afterRouteChildren","routeDefinitions","currentPath","matches","matchedContent","rootMatch","Component","routeKey","jsx","generateOutletKey","depth","Outlet","depthValue","outletKey","Link","event"],"mappings":"+HAGA,SAASA,CAAAA,CAAWC,CAAAA,CAAwC,CAC1D,GAAI,CAACA,CAAAA,CAAQ,OAAO,EAAC,CACrB,GAAI,OAAO,eAAA,CAAoB,IAAa,CAC1C,IAAMC,CAAAA,CAAS,IAAI,eAAA,CAAgBD,CAAM,CAAA,CACnCE,CAAAA,CAAiC,EAAC,CACxC,OAAAD,CAAAA,CAAO,OAAA,CAAQ,CAACE,CAAAA,CAAOC,CAAAA,GAAQF,EAAOE,CAAG,CAAA,CAAID,CAAK,CAAA,CAC3CD,CACT,CACA,OAAOF,CAAAA,CACJ,SAAA,CAAU,CAAC,CAAA,CACX,KAAA,CAAM,GAAG,CAAA,CACT,MAAA,CAAO,CAACK,EAAaC,CAAAA,GAAS,CAC7B,GAAM,CAACF,CAAAA,CAAKD,CAAK,CAAA,CAAIG,CAAAA,CAAK,KAAA,CAAM,GAAG,CAAA,CACnC,OAAIF,CAAAA,GAAKC,CAAAA,CA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AA,CACrBJ,CAAAA,CAAYlB,CAAAA,CAAM,KAAA,CAAM,SAAA,CAG9B,GAAIA,CAAAA,CAAM,KAAA,CAAM,WAAA,EACRA,CAAAA,CAAM,KAAA,CAAM,WAAA,CAAYA,CAAAA,CAAM,MAAM,CAAA,GAAM,MAAO,OAAO,IAAA,CAIhE,IAAMyB,CAAAA,CAAYJ,CAAAA,CAAkBrB,CAAAA,CAAOsB,CAAK,CAAA,CAGhD,OAAOF,GAAAA,CAAE9C,CAAAA,CAAc,QAAA,CAAU,CAC7B,KAAA,CAAOgD,CAAAA,CAAQ,CAAA,CACf,IAAKG,CAAAA,CACL,QAAA,CAAUL,GAAAA,CAAEF,CAAAA,CAAW,CAAE,MAAA,CAAQlB,CAAAA,CAAM,MAAO,CAAC,CACnD,CAAC,CACL,CChCO,SAAS0B,CAAAA,CAAKxE,CAAAA,CAAkB,CACnC,OAAOkE,GAAAA,CAAE,GAAA,CAAK,CACV,IAAA,CAAMlE,CAAAA,CAAM,EAAA,CACZ,KAAA,CAAOA,CAAAA,CAAM,KAAA,EAASA,CAAAA,CAAM,SAAA,CAC5B,KAAA,CAAOA,CAAAA,CAAM,KAAA,CAAQA,CAAAA,CAAM,MAAQ,oBAAA,CAAuB,kBAAA,CAC1D,OAAA,CAAUyE,CAAAA,EAAiB,CACvBA,CAAAA,CAAM,cAAA,EAAe,CAErBpC,GAAY,CAAErC,CAAAA,CAAM,EAAE,EAC1B,CAAA,CACA,QAAA,CAAUA,CAAAA,CAAM,QACpB,CAAC,CACL","file":"chunk-VQORJQ6I.mjs","sourcesContent":["import { RouteDefinition, RouteMatch } from './types'\n\n// Simple query parser (native URLSearchParams fallback) - internal use only\nfunction parseQuery(search: string): Record<string, string> {\n  if (!search) return {}\n  if (typeof URLSearchParams !== 'undefined') {\n    const params = new URLSearchParams(search)\n    const result: Record<string, string> = {}\n    params.forEach((value, key) => result[key] = value)\n    return result\n  }\n  return search\n    .substring(1)\n    .split('&')\n    .reduce((accumulator, part) => {\n      const [key, value] = part.split('=')\n      if (key) accumulator[decodeURIComponent(key)] = decodeURIComponent(value || '')\n      return accumulator\n    }, {} as Record<string, string>)\n}\n\nfunction isUnsafePath(path: string): boolean {\n  // Handle undefined or null path\n  if (!path || typeof path !== 'string') return true\n  // Prevent prototype pollution or massive strings\n  if (path.length > 2048) return true\n  if (path.includes('__proto__') || path.includes('constructor')) return true\n  // Basic XSS check for javascript: protocol\n  if (/^\\s*javascript:/i.test(path)) return true\n  return false\n}\n\n// Convert children FNodes to RouteDefinitions - internal use only\nfunction createRoutesFromChildren(children: unknown[]): RouteDefinition[] {\n  const routes: RouteDefinition[] = []\n\n  children.forEach(child => {\n    if (!child || typeof child !== 'object') return\n\n    // Assuming child is an FNode-like object (config)\n    // In Flexium, Route component returns null, but 'createNode' isn't called here.\n    // We are traversing the props passed to Router.\n    const childNode = child as Record<string, unknown>\n    const props = (childNode.props as Record<string, unknown>) || {}\n    const { path, component, children: subChildren, beforeEnter } = props\n\n    const route: RouteDefinition = {\n      path: typeof path === 'string' ? path : '/',\n      component: component as RouteDefinition['component'],\n      beforeEnter: beforeEnter as RouteDefinition['beforeEnter']\n    }\n\n    if (subChildren) {\n      // If subChildren is array\n      const nestedChildren = Array.isArray(subChildren) ? subChildren : [subChildren]\n      // We expect the children of a Route to be other Routes\n      // However, the 'children' prop in JSX might be the Route components themselves.\n      route.children = createRoutesFromChildren(nestedChildren)\n    }\n\n    // Also check child.children if props.children is empty (direct FNode structure)\n    const childChildren = childNode.children\n    if (!route.children && Array.isArray(childChildren) && childChildren.length > 0) {\n      route.children = createRoutesFromChildren(childChildren)\n    }\n\n    routes.push(route)\n  })\n  return routes\n}\n\n// Simple Matcher - internal use only\nfunction matchRoutes(routes: RouteDefinition[], locationPathname: string): RouteMatch[] | null {\n  // We want to find the best matching branch\n\n  for (const route of routes) {\n    // 1. Match current segment\n    // Simple exact match or parameter match logic needed?\n    // Let's implement simple param matching: /user/:id\n\n    const routePath = route.path\n\n    const matchResult = matchPath(routePath, locationPathname)\n    if (matchResult) {\n      return [{ route, params: matchResult.params, pathname: matchResult.path }]\n    }\n  }\n  return null\n}\n\nfunction matchPath(routePath: string, locationPath: string) {\n  // 1. Split into segments\n  const routeSegments = routePath.split('/').filter(Boolean)\n  const locationSegments = locationPath.split('/').filter(Boolean)\n\n  if (routeSegments.length !== locationSegments.length) return null\n\n  const params: Record<string, string> = {}\n\n  for (let i = 0; i < routeSegments.length; i++) {\n    const routeSegment = routeSegments[i]\n    const locationSegment = locationSegments[i]\n\n    if (routeSegment.startsWith(':')) {\n      const key = routeSegment.slice(1)\n      params[key] = locationSegment\n    } else if (routeSegment !== locationSegment) {\n      return null\n    }\n  }\n\n  return { params, path: locationPath }\n}\n\n// Export only what's needed by other router files\nexport { parseQuery, isUnsafePath, createRoutesFromChildren, matchRoutes }\n","import { reactive } from '../core/reactive'\nimport { Context } from '../core/context'\nimport { use } from '../core/use'\nimport type { Location, RouterContext } from './types'\nimport { parseQuery, isUnsafePath } from './utils'\n\n// Contexts\nexport const RouterCtx = new Context<RouterContext>(null as unknown as RouterContext)\nexport const RouteDepthCtx = new Context<number>(0)\n\n// Helper functions\nconst getDefaultLocation = (): Location => ({\n    pathname: '/',\n    search: '',\n    hash: '',\n    query: {},\n})\n\nconst getCurrentLocation = (): Location => {\n    if (typeof window === 'undefined') {\n        return getDefaultLocation()\n    }\n\n    // Handle srcdoc iframe - pathname may be empty or 'srcdoc'\n    let pathname = window.location.pathname\n    if (!pathname || pathname === 'srcdoc' || pathname === '/srcdoc') {\n        pathname = '/'\n    }\n\n    return {\n        pathname,\n        search: window.location.search,\n        hash: window.location.hash,\n        query: parseQuery(window.location.search),\n    }\n}\n\n// Global singleton location state\nlet globalLocation: Location | null = null\nlet globalNavigate: ((path: string) => void) | null = null\nlet popstateListenerAttached = false\n\n// Reset router state - used when app is re-rendered (e.g., srcdoc iframe update)\nexport function resetRouter(): void {\n    // Full reset - force reinitialization on next useLocation() call\n    globalLocation = null\n    globalNavigate = null\n    // Note: we don't reset popstateListenerAttached since the listener persists\n}\n\n// Create location state and navigation (singleton pattern)\nexport function useLocation(): [Location, (path: string) => void] {\n    // Return existing singleton if already created\n    if (globalLocation && globalNavigate) {\n        return [globalLocation, globalNavigate]\n    }\n\n    // Create a reactive location object (only once)\n    globalLocation = reactive<Location>(getCurrentLocation())\n\n    const updateLocation = (newLocation: Location) => {\n        if (!globalLocation) return\n        globalLocation.pathname = newLocation.pathname\n        globalLocation.search = newLocation.search\n        globalLocation.hash = newLocation.hash\n        globalLocation.query = newLocation.query\n    }\n\n    globalNavigate = (path: string) => {\n        if (typeof window === 'undefined') return\n        if (isUnsafePath(path)) {\n            return\n        }\n\n        // Try to update browser history, but continue even if it fails (e.g., in srcdoc iframe)\n        try {\n            window.history.pushState({}, '', path)\n        } catch {\n            // SecurityError in srcdoc iframe - ignore but continue with internal state update\n        }\n\n        // Always update internal location state for SPA navigation\n        const newLocation = {\n            pathname: path.split('?')[0].split('#')[0],\n            search: path.includes('?') ? '?' + path.split('?')[1].split('#')[0] : '',\n            hash: path.includes('#') ? '#' + path.split('#')[1] : '',\n            query: parseQuery(path.includes('?') ? '?' + path.split('?')[1].split('#')[0] : '')\n        }\n        updateLocation(newLocation)\n    }\n\n    // Listen to popstate (only once)\n    if (typeof window !== 'undefined' && !popstateListenerAttached) {\n        window.addEventListener('popstate', () => {\n            updateLocation(getCurrentLocation())\n        })\n        popstateListenerAttached = true\n    }\n\n    return [globalLocation, globalNavigate]\n}\n\n// Router hook - returns full router context\nexport function useRouter(): RouterContext {\n    const [routerContext] = use(RouterCtx)\n    if (!routerContext) {\n        throw new Error('useRouter() must be called within a <Routes> component')\n    }\n    return routerContext\n}\n\n// Navigate hook - returns navigate function\nexport function useNavigate(): (path: string) => void {\n    const [, navigate] = useLocation()\n    return navigate\n}\n\n// Get navigate function directly (for use in event handlers to avoid stale closures)\nexport function getNavigate(): (path: string) => void {\n    if (!globalNavigate) {\n        useLocation() // Initialize if needed\n    }\n    return globalNavigate!\n}\n\n// Params hook - returns route params\nexport function useParams<T extends Record<string, string> = Record<string, string>>(): T {\n    const router = useRouter()\n    return router.params as T\n}\n\n// Query hook - returns query params\nexport function useQuery<T extends Record<string, string> = Record<string, string>>(): T {\n    const [location] = useLocation()\n    return location.query as T\n}\n","import type { RouteProps } from '../types'\n\nexport function Route(_props: RouteProps) {\n    return null\n}\n","import { jsx as f } from '../../jsx-runtime'\nimport type { FNode, FNodeChild } from '../../dom/types'\nimport { RouterCtx, RouteDepthCtx, useLocation } from '../router'\nimport { createRoutesFromChildren, matchRoutes } from '../utils'\nimport { Route } from './Route'\n\nfunction isFNode(node: unknown): node is FNode {\n    return node !== null && typeof node === 'object' && !Array.isArray(node) && 'type' in node\n}\n\n// Generate a stable route key based on the matched route path pattern and params\nfunction generateRouteKey(match: { route: { path: string }, params: Record<string, string> }): string {\n    // Use the route path pattern + serialized params for a stable key\n    const paramStr = Object.entries(match.params)\n        .sort(([a], [b]) => a.localeCompare(b))\n        .map(([k, v]) => `${k}=${v}`)\n        .join('&')\n    return `route:${match.route.path}${paramStr ? '?' + paramStr : ''}`\n}\n\nexport function Routes(props: { children: FNodeChild }) {\n    const [currentLocation, navigate] = useLocation()\n\n    // Parse children to find <Route> definitions and other content\n    const childrenList: FNodeChild[] = Array.isArray(props.children) ? props.children : [props.children]\n\n    // Find routes for matching (but keep order with other children)\n    const routeNodes = childrenList.filter(child => isFNode(child) && child.type === Route)\n    // Track first Route index to insert matched content there\n    const firstRouteIndex = childrenList.findIndex(child => isFNode(child) && child.type === Route)\n\n    // Other children (non-Route) keep their positions relative to routes\n    let beforeRouteChildren: FNodeChild[] = []\n    let afterRouteChildren: FNodeChild[] = []\n\n    if (firstRouteIndex === -1) {\n        // No Route children - all are \"other\" children\n        beforeRouteChildren = childrenList.filter(child => !isFNode(child) || child.type !== Route)\n    } else {\n        // Split at first Route position\n        beforeRouteChildren = childrenList.slice(0, firstRouteIndex).filter(child => !isFNode(child) || child.type !== Route)\n        afterRouteChildren = childrenList.slice(firstRouteIndex).filter(child => !isFNode(child) || child.type !== Route)\n    }\n\n    // Create route definitions\n    const routeDefinitions = createRoutesFromChildren(routeNodes)\n\n    // DIRECT access to currentLocation.pathname\n    // This should trigger reactive tracking in the component's effect context\n    const currentPath = currentLocation.pathname\n    const matches = matchRoutes(routeDefinitions, currentPath) || []\n    const params = matches.length > 0 ? matches[matches.length - 1].params : {}\n\n    const routerContext = {\n        location: currentLocation,\n        navigate,\n        matches: matches,\n        params: params\n    }\n\n    // Render matched component\n    let matchedContent: FNodeChild = null\n\n    if (matches.length > 0) {\n        const rootMatch = matches[0]\n        const Component = rootMatch.route.component\n\n        // Generate a unique and stable key for this route\n        // This ensures proper cleanup when navigating between routes\n        const routeKey = generateRouteKey(rootMatch)\n\n        // Guard Check\n        if (rootMatch.route.beforeEnter) {\n            const result = rootMatch.route.beforeEnter(rootMatch.params)\n            if (result !== false) {\n                // Wrap in a keyed container to ensure proper cleanup\n                matchedContent = f(RouteDepthCtx.Provider, {\n                    value: 1,\n                    key: routeKey,\n                    children: f(Component, { params: rootMatch.params })\n                })\n            }\n        } else {\n            // Wrap in a keyed container to ensure proper cleanup\n            matchedContent = f(RouteDepthCtx.Provider, {\n                value: 1,\n                key: routeKey,\n                children: f(Component, { params: rootMatch.params })\n            })\n        }\n    }\n\n    return f(RouterCtx.Provider, {\n        value: routerContext,\n        children: [...beforeRouteChildren, matchedContent, ...afterRouteChildren]\n    })\n}\n","import { use } from '../../core/use'\nimport { jsx as f } from '../../jsx-runtime'\nimport { RouteDepthCtx, useRouter } from '../router'\n\n// Generate a stable key for nested route\nfunction generateOutletKey(match: { route: { path: string }, params: Record<string, string> }, depth: number): string {\n    const paramStr = Object.entries(match.params)\n        .sort(([a], [b]) => a.localeCompare(b))\n        .map(([k, v]) => `${k}=${v}`)\n        .join('&')\n    return `outlet:${depth}:${match.route.path}${paramStr ? '?' + paramStr : ''}`\n}\n\nexport function Outlet() {\n    const routerContext = useRouter()\n    const [depthValue] = use(RouteDepthCtx)\n    const depth = depthValue ?? 0\n\n    const [matches] = use(() => routerContext.matches)\n\n    if (depth >= matches.length) return null\n\n    const match = matches[depth]\n    const Component = match.route.component\n\n    // Guard\n    if (match.route.beforeEnter) {\n        if (match.route.beforeEnter(match.params) === false) return null\n    }\n\n    // Generate key for proper cleanup on nested route changes\n    const outletKey = generateOutletKey(match, depth)\n\n    // Render next level with proper key\n    return f(RouteDepthCtx.Provider, {\n        value: depth + 1,\n        key: outletKey,\n        children: f(Component, { params: match.params })\n    })\n}\n","import { jsx as f } from '../../jsx-runtime'\nimport type { LinkProps } from '../types'\n\n// Import the navigate function getter, not the function itself\n// This ensures we always use the current navigate implementation\nimport { getNavigate } from '../router'\n\nexport function Link(props: LinkProps) {\n    return f('a', {\n        href: props.to,\n        class: props.class || props.className,\n        style: props.style ? props.style + '; cursor: pointer;' : 'cursor: pointer;',\n        onclick: (event: Event) => {\n            event.preventDefault()\n            // Get current navigate function at click time\n            getNavigate()(props.to)\n        },\n        children: props.children\n    })\n}\n"]}